Open news/class/class.newsstory.php and around line 171 replace by this function:
/**
* Returns published stories according to some options
*/
function getAllPublished($limit=0, $start=0, $checkRight=false, $topic=0, $ihome=0, $asobject=true, $order = 'published', $topic_frontpage=false)
{
$db =& Database::getInstance();
$myts =& MyTextSanitizer::getInstance();
$ret = array();
$sql = 'SELECT s.*, t.* FROM '.$db->prefix('stories').' s, '. $db->prefix('topics').' t WHERE (s.published > 0 AND s.published <= '.time().') AND (s.expired = 0 OR s.expired > '.time().') AND (s.topicid=t.topic_id) ';
if ($topic != 0) {
if (!is_array($topic)) {
if($checkRight) {
$topics = news_MygetItemIds('news_view');
if(!in_array ($topic,$topics)) {
return null;
} else {
$sql .= ' AND s.topicid='.intval($topic).' AND (s.ihome=1 OR s.ihome=0)';
}
} else {
$sql .= ' AND s.topicid='.intval($topic).' AND (s.ihome=1 OR s.ihome=0)';
}
} else {
if($checkRight) {
$topics = news_MygetItemIds('news_view');
$topic = array_intersect($topic,$topics);
}
if(count($topic)>0) {
$sql .= ' AND s.topicid IN ('.implode(',', $topic).')';
} else {
return null;
}
}
} else {
if($checkRight) {
$topics = news_MygetItemIds('news_view');
if(count($topics)>0) {
$topics = implode(',', $topics);
$sql .= ' AND s.topicid IN ('.$topics.')';
} else {
return null;
}
}
if (intval($ihome) == 0) {
$sql .= ' AND s.ihome=0';
}
}
if($topic_frontpage) {
$sql .=' AND t.topic_frontpage=1';
}
$sort = 'DESC';
if ($order == 'title') {
$sort = 'ASC';
}
$sql .= " ORDER BY s.$order $sort";
$result = $db->query($sql,intval($limit),intval($start));
while ( $myrow = $db->fetchArray($result) ) {
if ($asobject) {
$ret[] = new NewsStory($myrow);
} else {
$ret[$myrow['storyid']] = $myts->htmlSpecialChars($myrow['title']);
}
}
return $ret;
}
Then open news/index.php
and replace around line 181 by this one
$sarray = NewsStory::getAllPublished($xoopsOption['storynum'], $start, $xoopsModuleConfig['restrictindex'], $xoopsOption['storytopic'], 0, true, 'title', $topic_frontpage);
and replace around line 247 by this one:
$allstories = NewsStory::getAllPublished($xoopsModuleConfig['storyhome'], 0, $xoopsModuleConfig['restrictindex'], $topicid, 0, true , 'title');
I'll be glad if I receive my first donation ever
Link is on xuups.com