| Server IP : 195.130.67.5 / Your IP : 216.73.217.154 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 : /Old Sites/eadsa/modules/mod_j15featuredarticles/ |
Upload File : |
<?php
// no direct access
defined('_JEXEC') or die('Go Away');
/**
* Featured Articles Helper
*
* @static
*/
class modFeaturedArticlesHelper
{
/**
* Gets an array of items
*
* @param JParameter Module parameters
* @return mixed Array of items, false on failure
*/
function &getItems(&$params)
{
require_once(JPATH_SITE.DS.'components'.DS.'com_content'.DS.'helpers'.DS.'route.php');
$db =& JFactory::getDBO();
$ids = trim( $params->get('ids') );
$ordering = $params->get('ordering');
if ($ordering == "1")
{
$sql = 'Select a.*, '.
'CASE WHEN CHAR_LENGTH(a.alias) THEN CONCAT_WS(":", a.id, a.alias) ELSE a.id END as slug, '.
'CASE WHEN CHAR_LENGTH(cc.alias) THEN CONCAT_WS(":", cc.id, cc.alias) ELSE cc.id END as catslug '.
'FROM #__content as a '.
'INNER JOIN #__categories AS cc ON cc.id = a.catid '.
'INNER JOIN #__sections AS s ON s.id = a.sectionid '.
'WHERE a.id in '.$ids.' AND s.id > 0 '.
'and a.state = 1';
}
if ($ordering == "2")
{
$sql = 'Select a.*, '.
'CASE WHEN CHAR_LENGTH(a.alias) THEN CONCAT_WS(":", a.id, a.alias) ELSE a.id END as slug, '.
'CASE WHEN CHAR_LENGTH(cc.alias) THEN CONCAT_WS(":", cc.id, cc.alias) ELSE cc.id END as catslug '.
'FROM #__content as a '.
'INNER JOIN #__categories AS cc ON cc.id = a.catid '.
'INNER JOIN #__sections AS s ON s.id = a.sectionid '.
'WHERE a.id in '.$ids.' AND s.id > 0 '.
'and a.state = 1 Order by id DESC';
}
if ($ordering == "3")
{
$sql = "Select a.*, ".
"CASE WHEN CHAR_LENGTH(a.alias) THEN CONCAT_WS(\":\", a.id, a.alias) ELSE a.id END as slug, ".
"CASE WHEN CHAR_LENGTH(cc.alias) THEN CONCAT_WS(\":\", cc.id, cc.alias) ELSE cc.id END as catslug ".
"FROM #__content as a ".
"INNER JOIN #__categories AS cc ON cc.id = a.catid ".
"INNER JOIN #__sections AS s ON s.id = a.sectionid ".
"WHERE a.id in ".$ids." AND s.id > 0 and a.state = 1 ORDER BY FIELD(a.id, ".preg_replace('/[\()]/', '', $ids).")";
}
if ($ordering == "4")
{
$sql = 'Select a.*, '.
'CASE WHEN CHAR_LENGTH(a.alias) THEN CONCAT_WS(":", a.id, a.alias) ELSE a.id END as slug, '.
'CASE WHEN CHAR_LENGTH(cc.alias) THEN CONCAT_WS(":", cc.id, cc.alias) ELSE cc.id END as catslug '.
'FROM #__content as a '.
'INNER JOIN #__categories AS cc ON cc.id = a.catid '.
'INNER JOIN #__sections AS s ON s.id = a.sectionid '.
'WHERE a.id in '.$ids.' AND s.id > 0 and a.state = 1 ORDER BY ordering';
}
$db->setQuery($sql);
if ($items = $db->loadObjectList())
{
$i = 0;
$lists = array();
foreach ( $items as $item )
{
$lists[$i]->link = JRoute::_(ContentHelperRoute::getArticleRoute($item->slug, $item->catslug, $item->sectionid));
$lists[$i]->title = htmlspecialchars( $item->title );
$strip = trim( $params->get('striphtml') );
if ($strip == 1)
{
$lists[$i]->introtext = strip_tags( $item->introtext );
$lists[$i]->fulltext = strip_tags( $item->fulltext );
}
else
{
$lists[$i]->introtext = htmlspecialchars( $item->introtext );
$lists[$i]->fulltext = htmlspecialchars( $item->fulltext );
}
$i++;
}
return $lists;
}
else
{
return false;
}
}
}