| Server IP : 195.130.67.5 / Your IP : 216.73.216.231 Web Server : Microsoft-IIS/10.0 System : Windows NT WEBSERVER1 10.0 build 17763 (Windows Server 2016) i586 User : IUSR ( 0) PHP Version : 7.4.19 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/inetpub/wwwroot/icd/components/com_article_list/ |
Upload File : |
<?php
/**
/************************************************************************
* Article List - Joomla! Component
* Copyright (C) 2008 by Dwayne Hill
* Homepage : www.jettheblackcat.com
* Version : 1.0.0 beta 1
* License :
* The Article List component is released under the GNU General public License, version 2
* See: http://www.gnu.org/licenses/old-licenses/gpl-2.0.html for the full license.
* Warranty:
* JetTheBlackCat.com PRODUCTS ARE DISTRIBUTED AS IS.
* NO WARRANTY OF ANY KIND IS EXPRESSED OR IMPLIED.
* YOU USE IT AT YOUR OWN RISK.
* JetTheBlackCat AND ANY ASSOCIATES WILL NOT BE LIABLE FOR ANY DAMAGES,
* INCLUDING BUT NOT LIMITED TO DATA LOSS, LOSS OF PROFITS
* OR ANY OTHER KIND OF LOSS RELATED TO JetTheBlackCat products
************************************************************************/
// no direct access
defined( '_VALID_MOS' ) or die( 'Restricted access' );
defined( '_JEXEC' ) or die( 'Restricted access' );
global $mosConfig_offset, $mosConfig_live_site;
jimport('joomla.html.pagination');
$now = _CURRENT_SERVER_TIME;
$access = !$mainframe->getCfg( 'shownoauth' );
$nullDate = $database->getNullDate();
jimport('joomla.application.component.view');
$menu =& JSite::getMenu();
$item = $menu->getActive();
$mparams =& $menu->getParams($item->id);
$type = sql_quote($mparams->get( 'type', '1' ));
$catid = sql_quote($mparams->get( 'catid', '0' ));
$secid = sql_quote($mparams->get( 'secid', '0' ));
$show_front = sql_quote($mparams->get( 'show_front', '1' ));
$customsearch = sql_quote($mparams->get( 'customsearch'));
$moduleclass_sfx = sql_quote($mparams->get( 'moduleclass_sfx'));
$title = sql_quote($mparams->get( 'title'));
$letter = sql_quote($mparams->get( 'letter'));
$list_order = sql_quote($mparams->get( 'list_order'));
$list_sort = sql_quote($mparams->get( 'list_sort'));
$url =& JFactory::getURI();
$url2=$url->toString();
$lim = $mainframe->getUserStateFromRequest("$option.limit", 'limit', 14, 'int'); //I guess getUserStateFromRequest is for session or different reasons
$lim0 = JRequest::getVar('limitstart', 0, '', 'int');
// select between Content Items, Static Content or both
switch ( $type ) {
case 2:
//Static Content only
$query = "SELECT SQL_CALC_FOUND_ROWS a.id, a.title"
. "\n FROM #__content AS a"
. "\n WHERE ( a.state = 1 AND a.sectionid = 0 )"
. ( $letter ? "\n AND (a.title like '$letter%')" : '' )
. ( $customsearch ? "\n AND (a.title like '$customsearch')" : '' )
. "\n AND ( a.publish_up = '$nullDate' OR a.publish_up <= '$now' )"
. "\n AND ( a.publish_down = '$nullDate' OR a.publish_down >= '$now' )"
. ( $access ? "\n AND a.access <= $my->gid" : '' )
. "\n ORDER BY $list_order $list_sort "
//. "\n LIMIT $lim0, $lim"
;
$database->setQuery( $query, $lim0, $lim );
$rows = $database->loadObjectList();
////Here the beauty starts
$database->setQuery('SELECT FOUND_ROWS();'); //no reloading the query! Just asking for total without limit
$pageNav = new JPagination( $database->loadResult(), $lim0, $lim );
break;
case 3:
//Both
$query = "SELECT SQL_CALC_FOUND_ROWS a.id, a.title, a.sectionid, a.catid, cc.access AS cat_access, s.access AS sec_access, cc.published AS cat_state, s.published AS sec_state"
. "\n FROM #__content AS a"
. "\n LEFT JOIN #__categories AS cc ON cc.id = a.catid"
. "\n LEFT JOIN #__sections AS s ON s.id = a.sectionid"
. "\n WHERE a.state = 1"
. ( $letter ? "\n AND (a.title like '$letter%')" : '' )
. ( $customsearch ? "\n AND (a.title like '$customsearch')" : '' )
. "\n AND ( a.publish_up = '$nullDate' OR a.publish_up <= '$now' )"
. "\n AND ( a.publish_down = '$nullDate' OR a.publish_down >= '$now' )"
. ( $access ? "\n AND a.access <= $my->gid" : '' )
. "\n ORDER BY $list_order $list_sort "
//. "\n LIMIT $lim0, $lim"
;
$database->setQuery( $query, $lim0, $lim );
$temp = $database->loadObjectList();
$rows = array();
if (count($temp)) {
foreach ($temp as $row ) {
if (($row->cat_state == 1 || $row->cat_state == '') && ($row->sec_state == 1 || $row->sec_state == '') && ($row->cat_access <= $my->gid || $row->cat_access == '' || !$access) && ($row->sec_access <= $my->gid || $row->sec_access == '' || !$access)) {
$rows[] = $row;
}
}
}
unset($temp);
////Here the beauty starts
$database->setQuery('SELECT FOUND_ROWS();'); //no reloading the query! Just asking for total without limit
$pageNav = new JPagination( $database->loadResult(), $lim0, $lim );
break;
case 1:
default:
//Content Items only
$query = "SELECT SQL_CALC_FOUND_ROWS a.id, a.title, a.sectionid, a.catid,a.created"
. "\n FROM #__content AS a"
. "\n LEFT JOIN #__content_frontpage AS f ON f.content_id = a.id"
. "\n INNER JOIN #__categories AS cc ON cc.id = a.catid"
. "\n INNER JOIN #__sections AS s ON s.id = a.sectionid"
. "\n WHERE ( a.state = 1 AND a.sectionid > 0 )"
. ( $letter ? "\n AND (a.title like '$letter%')" : '' )
. ( $customsearch ? "\n AND (a.title like '$customsearch')" : '' )
. "\n AND ( a.publish_up = '$nullDate' OR a.publish_up <= '$now' )"
. "\n AND ( a.publish_down = '$nullDate' OR a.publish_down >= '$now' )"
. ( $access ? "\n AND a.access <= $my->gid AND cc.access <= $my->gid AND s.access <= $my->gid" : '' )
. ( $catid ? "\n AND ( a.catid IN ( $catid ) )" : '' )
. ( $secid ? "\n AND ( a.sectionid IN ( $secid ) )" : '' )
. ( $show_front == "0" ? "\n AND f.content_id IS NULL" : '' )
. "\n AND s.published = 1"
. "\n AND cc.published = 1"
. "\n ORDER BY $list_order $list_sort "
//. "\n LIMIT $lim0, $lim"
;
//$rL=&$database->loadAssocList();
$database->setQuery( $query, $lim0, $lim );
$rows = $database->loadObjectList();
////Here the beauty starts
$database->setQuery('SELECT FOUND_ROWS();'); //no reloading the query! Just asking for total without limit
$pageNav = new JPagination( $database->loadResult(), $lim0, $lim );
break;
}
//echo $query;
//echo '<br>';
// needed to reduce queries used by getItemid for Content Items
if ( ( $type == 1 ) || ( $type == 3 ) ) {
$bs = $mainframe->getBlogSectionCount();
$bc = $mainframe->getBlogCategoryCount();
$gbs = $mainframe->getGlobalBlogSectionCount();
}
// Output
?>
<script language="javascript" type="text/javascript">
function tableOrdering( order, dir, task )
{
var form = document.adminForm;
form.filter_order.value = order;
form.filter_order_Dir.value = dir;
document.adminForm.submit( task );
}
</script>
<div class="componentheading<?php echo $pageclass_sfx ?>">
<?php echo $title; ?>
</div>
<form action="<?php echo $url2;?>" method="post" name="adminForm">
<table width="100%" cellpadding="0" cellspacing="0" border="0" align="center" class="contentpane">
<tr>
<td colspan="5">
<table>
<tr>
<td align="left" width="40%" nowrap="nowrap">
<?php
echo ' '.JText::_('Display Num').' ';
echo $pageNav->getLimitBox(); //displays a dropdown select box
?>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="sectiontableheader<?php echo $pageclass_sfx ?>" align="right" width="5%">
<?php echo JText::_('Num'); ?>
</td>
<td class="sectiontableheader<?php echo $moduleclass_sfx; ?>" <?php echo $title;?> >
<?php echo JHTML::_('grid.sort', 'Item Title', 'a.title', $this->lists['order_Dir'], $this->lists['order'] ); ?>
</td>
<td class="sectiontableheader<?php echo $pageclass_sfx ?>" width="25%">
<?php echo JHTML::_('grid.sort', 'Date', 'a.created', $this->lists['order_Dir'], $this->lists['order'] ); ?>
</td>
</tr>
<?php
$rowtype = 1;
$article_num=0;
foreach ($rows as $row)
{
$article_num++;
// get Itemid
switch ( $type ) {
case 2:
$query = "SELECT id"
. "\n FROM #__menu"
. "\n WHERE type = 'content_typed'"
. "\n AND componentid = $row->id"
;
$database->setQuery( $query );
$Itemid = $database->loadResult();
break;
case 3:
if ( $row->sectionid ) {
$Itemid = $mainframe->getItemid( $row->id, 0, 0, $bs, $bc, $gbs );
} else {
$query = "SELECT id"
. "\n FROM #__menu"
. "\n WHERE type = 'content_typed'"
. "\n AND componentid = $row->id"
;
$database->setQuery( $query );
$Itemid = $database->loadResult();
}
break;
case 1:
default:
$Itemid = $mainframe->getItemid( $row->id, 0, 0, $bs, $bc, $gbs );
break;
}
// Blank itemid checker for SEF
if ($Itemid == NULL) {
$Itemid = '';
} else {
$Itemid = '&Itemid='.$Itemid;
}
$link = JRoute::_( 'index.php?option=com_content&view=article&id='. $row->id . $Itemid );
?>
<tr class="sectiontableentry<?php echo $rowtype.$moduleclass_sfx; ?>">
<td align="right">
<?php echo $pageNav->getRowOffset( $article_num-1 ); ?>
</td>
<td><a href="<?php echo $link; ?>"><?php echo $row->title; ?></a></td>
<td valign="top" colspan="2">
<?php $date =& JFactory::getDate( $row->created, -2 );
echo $date->toFormat($format = '%A,%d %B %Y ') ;
?>
</td>
</tr>
<?php
if ($rowtype == '1') {
$rowtype = '2';
} else {
$rowtype = '1';
}
}
?>
<tr>
<td colspan="5"> </td>
</tr>
<tr>
<td align="center" colspan="4" class="sectiontablefooter">
<?php echo $pageNav->getPagesLinks(); ?>
</td>
</tr>
<tr>
<td colspan="5" align="right">
<?php echo $pageNav->getPagesCounter(); ?>
</td>
</tr>
</table>
</form>
<?php
function sql_quote( $value )
{
if( get_magic_quotes_gpc() )
{
$value = stripslashes( $value );
}
//check if this function exists
if( function_exists( "mysql_real_escape_string" ) )
{
$value = mysql_real_escape_string( $value );
}
//for PHP version < 4.3.0 use addslashes
else
{
$value = addslashes( $value );
}
return $value;
}
?>