Exemplo n.º 1
0
function b_news_randomnews_show($options)
{
    include_once XOOPS_ROOT_PATH . '/modules/news/include/functions.php';
    $myts =& MyTextSanitizer::getInstance();
    $block = array();
    $block['sort'] = $options[0];
    $tmpstory = new NewsStory();
    $restricted = getmoduleoption('restrictindex');
    $dateformat = getmoduleoption('dateformat');
    $infotips = getmoduleoption('infotips');
    if ($dateformat == '') {
        $dateformat = 's';
    }
    if ($options[4] == 0) {
        $stories = $tmpstory->getRandomNews($options[1], 0, $restricted, 0, 1, $options[0]);
    } else {
        $topics = array_slice($options, 4);
        $stories = $tmpstory->getRandomNews($options[1], 0, $restricted, $topics, 1, $options[0]);
    }
    unset($tmpstory);
    if (count($stories) == 0) {
        return '';
    }
    foreach ($stories as $story) {
        $news = array();
        $title = $story->title();
        if (strlen($title) > $options[2]) {
            $title = xoops_substr($title, 0, $options[2] + 3);
        }
        $news['title'] = $title;
        $news['id'] = $story->storyid();
        $news['date'] = formatTimestamp($story->published(), $dateformat);
        $news['hits'] = $story->counter();
        $news['rating'] = $story->rating();
        $news['votes'] = $story->votes();
        $news['author'] = sprintf("%s %s", _POSTEDBY, $story->uname());
        $news['topic_title'] = $story->topic_title();
        $news['topic_color'] = '#' . $myts->displayTarea($story->topic_color);
        if ($options[3] > 0) {
            $news['teaser'] = xoops_substr(strip_tags($myts->displayTarea($story->hometext)), 0, $options[3] + 3);
            $news['infotips'] = '';
        } else {
            $news['teaser'] = "";
            if ($infotips > 0) {
                $news['infotips'] = ' title="' . xoops_substr(strip_tags($story->hometext()), 0, $infotips) . '"';
            } else {
                $news['infotips'] = '';
            }
        }
        $block['stories'][] = $news;
    }
    $block['lang_read_more'] = _MB_READMORE;
    return $block;
}
Exemplo n.º 2
0
function b_news_topics_show()
{
    global $storytopic;
    // Don't know why this is used and where it's coming from ....
    include_once XOOPS_ROOT_PATH . '/modules/news/include/functions.php';
    include_once XOOPS_ROOT_PATH . "/modules/news/class/class.newstopic.php";
    $xt = new NewsTopic();
    $jump = XOOPS_URL . "/modules/news/index.php?storytopic=";
    $storytopic = !empty($storytopic) ? intval($storytopic) : 0;
    $restricted = getmoduleoption('restrictindex');
    $block['selectbox'] = $xt->MakeMyTopicSelBox(1, $storytopic, "storytopic", "location=\"" . $jump . "\"+this.options[this.selectedIndex].value", $restricted, 'news_view');
    return $block;
}
Exemplo n.º 3
0
function b_news_topicsnav_show($options)
{
    include_once XOOPS_ROOT_PATH . '/modules/news/include/functions.php';
    include_once XOOPS_ROOT_PATH . "/modules/news/class/class.newstopic.php";
    $myts =& MyTextSanitizer::getInstance();
    $block = array();
    $newscountbytopic = array();
    $perms = '';
    $xt = new NewsTopic();
    $restricted = getmoduleoption('restrictindex');
    if ($restricted) {
        global $xoopsUser;
        $module_handler =& xoops_gethandler('module');
        $newsModule =& $module_handler->getByDirname('news');
        $groups = is_object($xoopsUser) ? $xoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS;
        $gperm_handler =& xoops_gethandler('groupperm');
        $topics = $gperm_handler->getItemIds('news_view', $groups, $newsModule->getVar('mid'));
        if (count($topics) > 0) {
            $topics = implode(',', $topics);
            $perms = " AND topic_id IN (" . $topics . ") ";
        } else {
            return '';
        }
    }
    $topics_arr = $xt->getChildTreeArray(0, "topic_title", $perms);
    if ($options[0] == 1) {
        $newscountbytopic = $xt->getNewsCountByTopic();
    }
    if (is_array($topics_arr) && count($topics_arr)) {
        foreach ($topics_arr as $onetopic) {
            if ($options[0] == 1) {
                $count = 0;
                if (array_key_exists($onetopic['topic_id'], $newscountbytopic)) {
                    $count = $newscountbytopic[$onetopic['topic_id']];
                }
            } else {
                $count = '';
            }
            $block['topics'][] = array('id' => $onetopic['topic_id'], 'news_count' => $count, 'topic_color' => '#' . $onetopic['topic_color'], 'title' => $myts->displayTarea($onetopic['topic_title']));
        }
    }
    return $block;
}
Exemplo n.º 4
0
function b_news_topics_moderate()
{
    include_once XOOPS_ROOT_PATH . "/modules/news/class/class.newsstory.php";
    include_once XOOPS_ROOT_PATH . '/modules/news/include/functions.php';
    $block = array();
    $dateformat = getmoduleoption('dateformat');
    $infotips = getmoduleoption('infotips');
    $storyarray = NewsStory::getAllSubmitted(0, true, getmoduleoption('restrictindex'));
    if (count($storyarray) > 0) {
        $block['lang_story_title'] = _MB_TITLE;
        $block['lang_story_date'] = _MB_POSTED;
        $block['lang_story_author'] = _MB_POSTER;
        $block['lang_story_action'] = _MB_ACTION;
        $block['lang_story_topic'] = _MB_TOPIC;
        $myts =& MyTextSanitizer::getInstance();
        foreach ($storyarray as $newstory) {
            $title = $newstory->title();
            $htmltitle = '';
            if ($infotips > 0) {
                $story['infotips'] = xoops_substr(strip_tags($newstory->hometext()), 0, $infotips);
                $htmltitle = ' title="' . $story['infotips'] . '"';
            }
            if (!isset($title) || $title == "") {
                $linktitle = "<a href='" . XOOPS_URL . "/modules/news/index.php?op=edit&amp;storyid=" . $newstory->storyid() . "' target='_blank'" . $htmltitle . ">" . _AD_NOSUBJECT . "</a>";
            } else {
                $linktitle = "<a href='" . XOOPS_URL . "/modules/news/submit.php?op=edit&amp;storyid=" . $newstory->storyid() . "' target='_blank'" . $htmltitle . ">" . $title . "</a>";
            }
            $story = array();
            $story['title'] = $linktitle;
            $story['date'] = formatTimestamp($newstory->created(), $dateformat);
            $story['author'] = "<a href='" . XOOPS_URL . "/userinfo.php?uid=" . $newstory->uid() . "'>" . $newstory->uname() . "</a>";
            $story['action'] = "<a href='" . XOOPS_URL . "/modules/news/admin/index.php?op=delete&amp;storyid=" . $newstory->storyid() . "'>" . _MB_DELETE . "</a>";
            $story['topic_title'] = $newstory->topic_title();
            $story['topic_color'] = '#' . $myts->displayTarea($newstory->topic_color);
            $block['stories'][] =& $story;
            unset($story);
        }
    }
    return $block;
}
Exemplo n.º 5
0
function PrintPage()
{
    global $xoopsConfig, $xoopsModule, $story, $xoops_meta_keywords, $xoops_meta_description;
    $myts =& MyTextSanitizer::getInstance();
    $datetime = formatTimestamp($story->published(), getmoduleoption('dateformat'));
    echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">';
    echo '<html><head>';
    echo '<meta http-equiv="Content-Type" content="text/html; charset=' . _CHARSET . '" />';
    echo '<title>' . $myts->htmlSpecialChars($story->title()) . ' - ' . _NW_PRINTER . ' - ' . $myts->htmlSpecialChars($story->topic_title()) . ' - ' . $xoopsConfig['sitename'] . '</title>';
    echo '<meta name="AUTHOR" content="' . $xoopsConfig['sitename'] . '" />';
    echo '<meta name="keywords" content="' . $xoops_meta_keywords . '" />';
    echo '<meta name="COPYRIGHT" content="Copyright (c) 2001 by ' . $xoopsConfig['sitename'] . '" />';
    echo '<meta name="DESCRIPTION" content="' . $xoops_meta_description . '" />';
    echo '<meta name="GENERATOR" content="' . XOOPS_VERSION . '" />';
    echo '<body bgcolor="#ffffff" text="#000000" onload="window.print()">
    	<table border="0"><tr><td align="center">
    	<table border="0" width="640" cellpadding="0" cellspacing="1" bgcolor="#000000"><tr><td>
    	<table border="0" width="640" cellpadding="20" cellspacing="1" bgcolor="#ffffff"><tr><td align="center">
    	<img src="' . XOOPS_URL . '/images/logo.gif" border="0" alt="" /><br /><br />
    	<h3>' . $story->title() . '</h3>
    	<small><b>' . _NW_DATE . '</b>&nbsp;' . $datetime . ' | <b>' . _NW_TOPICC . '</b>&nbsp;' . $myts->htmlSpecialChars($story->topic_title()) . '</small><br /><br /></td></tr>';
    echo '<tr valign="top" style="font:12px;"><td>' . $story->hometext() . '<br />';
    $bodytext = $story->bodytext();
    $bodytext = str_replace("[pagebreak]", "<br style=\"page-break-after:always;\">", $bodytext);
    if ($bodytext != '') {
        echo $bodytext . '<br /><br />';
    }
    echo '</td></tr></table></td></tr></table>
	<br /><br />';
    printf(_NW_THISCOMESFROM, htmlspecialchars($xoopsConfig['sitename'], ENT_QUOTES));
    echo '<br /><a href="' . XOOPS_URL . '/">' . XOOPS_URL . '</a><br /><br />
    	' . _NW_URLFORSTORY . ' <!-- Tag below can be used to display Permalink image --><!--img src="' . XOOPS_URL . '/modules/' . $xoopsModule->dirname() . '/images/x.gif" /--><br />
    	<a href="' . XOOPS_URL . '/modules/' . $xoopsModule->dirname() . '/article.php?storyid=' . $story->storyid() . '">' . XOOPS_URL . '/modules/news/article.php?storyid=' . $story->storyid() . '</a>
    	</td></tr></table>
    	</body>
    	</html>
    	';
}
Exemplo n.º 6
0
function b_news_bigstory_show()
{
    include_once XOOPS_ROOT_PATH . '/modules/news/include/functions.php';
    include_once XOOPS_ROOT_PATH . "/modules/news/class/class.newsstory.php";
    $myts =& MyTextSanitizer::getInstance();
    $restricted = getmoduleoption('restrictindex');
    $dateformat = getmoduleoption('dateformat');
    $infotips = getmoduleoption('infotips');
    $block = array();
    $onestory = new NewsStory();
    $stories = $onestory->getBigStory(1, 0, $restricted, 0, 1, true, 'counter');
    if (count($stories) == 0) {
        $block['message'] = _MB_NEWS_NOTYET;
    } else {
        foreach ($stories as $key => $story) {
            $htmltitle = '';
            if ($infotips > 0) {
                $block['infotips'] = xoops_substr(strip_tags($story->hometext()), 0, $infotips);
                $htmltitle = ' title="' . $block['infotips'] . '"';
            }
            $block['htmltitle'] = $htmltitle;
            $block['message'] = _MB_NEWS_TMRSI;
            $block['story_title'] = $story->title('Show');
            $block['story_id'] = $story->storyid();
            $block['story_date'] = formatTimestamp($story->published(), $dateformat);
            $block['story_hits'] = $story->counter();
            $block['story_rating'] = $story->rating();
            $block['story_votes'] = $story->votes();
            $block['story_author'] = $story->uname();
            $block['story_text'] = $story->hometext();
            $block['story_topic_title'] = $story->topic_title();
            $block['story_topic_color'] = '#' . $myts->displayTarea($story->topic_color);
        }
    }
    return $block;
}
Exemplo n.º 7
0
    $columns = array();
    $i = 0;
    foreach ($smarty_topics as $thistopictimestamp => $thistopic) {
        $columns[$i][] = $thistopic;
        $i++;
        if ($i == $column_count) {
            $i = 0;
        }
    }
    //$xoopsTpl->assign('topics', $smarty_topics);
    $xoopsTpl->assign('columns', $columns);
}
/**
* Create the website navigation's bar
*/
if (getmoduleoption('sitenavbar')) {
    $content = CreateSiteNavBar();
    $xoopsTpl->assign("xoops_module_header", $content);
}
/**
 * Create a clickable path from the root to the current topic (if we are viewing a topic)
 * Actually this is not used in the default templates but you can use it as you want
 * You can comment the code to optimize the requests count
 */
if ($xoopsOption['storytopic']) {
    $mytree = new XoopsTree($xoopsDB->prefix("topics"), "topic_id", "topic_pid");
    $topicpath = $mytree->getNicePathFromId($xoopsOption['storytopic'], "topic_title", "index.php?op=1");
    $xoopsTpl->assign('topic_path', $topicpath);
    unset($mytree);
}
/**
Exemplo n.º 8
0
// You should have received a copy of the GNU General Public License        //
// along with this program; if not, write to the Free Software              //
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA //
// ------------------------------------------------------------------------ //
include_once '../../../include/cp_header.php';
include_once XOOPS_ROOT_PATH . "/class/xoopstopic.php";
include_once XOOPS_ROOT_PATH . "/class/xoopslists.php";
include_once XOOPS_ROOT_PATH . "/modules/news/class/class.newsstory.php";
include_once XOOPS_ROOT_PATH . "/modules/news/class/class.newstopic.php";
include_once XOOPS_ROOT_PATH . "/modules/news/class/class.sfiles.php";
include_once XOOPS_ROOT_PATH . '/class/uploader.php';
include_once XOOPS_ROOT_PATH . '/class/pagenav.php';
include_once XOOPS_ROOT_PATH . '/modules/news/admin/functions.php';
include_once XOOPS_ROOT_PATH . '/modules/news/include/functions.php';
include_once XOOPS_ROOT_PATH . "/class/tree.php";
$dateformat = getmoduleoption('dateformat');
$myts =& MyTextSanitizer::getInstance();
$topicscount = 0;
/**
 * Show new submissions
 *
 * This list can be view in the module's admin when you click on the tab named "Post/Edit News"
 * Submissions are news that was submit by users but who are not approved, so you need to edit
 * them to approve them.
 * Actually you can see the the story's title, the topic, the posted date, the author and a
 * link to delete the story. If you click on the story's title, you will be able to edit the news.
 * The table contains ALL the new submissions.
 * The system's block called "Waiting Contents" is listing the number of those news.
 */
function newSubmissions()
{
Exemplo n.º 9
0
 /**
  * Returns the user's name of the current story according to the module's option "displayname"
  */
 function uname($uid = 0)
 {
     global $xoopsConfig;
     include_once XOOPS_ROOT_PATH . '/modules/news/include/functions.php';
     static $tblusers = array();
     $option = -1;
     if (!$uid) {
         $uid = $this->uid();
     }
     if (is_array($tblusers) && array_key_exists($uid, $tblusers)) {
         return $tblusers[$uid];
     }
     $option = getmoduleoption('displayname');
     if (!$option) {
         $option = 1;
     }
     switch ($option) {
         case 1:
             // Username
             $tblusers[$uid] = XoopsUser::getUnameFromId($uid);
             return $tblusers[$uid];
         case 2:
             // Display full name (if it is not empty)
             $member_handler =& xoops_gethandler('member');
             $thisuser = $member_handler->getUser($uid);
             if (is_object($thisuser)) {
                 $return = $thisuser->getVar('name');
                 if ($return == "") {
                     $return = $thisuser->getVar('uname');
                 }
             } else {
                 $return = $xoopsConfig['anonymous'];
             }
             $tblusers[$uid] = $return;
             return $return;
         case 3:
             // Nothing
             $tblusers[$uid] = '';
             return '';
     }
 }
Exemplo n.º 10
0
function my_highlighter($matches)
{
    $color = getmoduleoption('highlightcolor');
    if (substr($color, 0, 1) != '#') {
        $color = '#' . $color;
    }
    return '<span style="font-weight: bolder; background-color: ' . $color . ';">' . $matches[0] . '</span>';
}
Exemplo n.º 11
0
// ************
$i = 1;
global $xoopsDB, $xoopsUser, $xoopsConfig, $xoopsModule, $xoopsModuleConfig;
// We try to "win" some time
// 1)  Check to see it the module is the current module
if (is_object($xoopsModule) && $xoopsModule->getVar('dirname') == $modversion['dirname'] && $xoopsModule->getVar('isactive')) {
    // 2) If there's no topics to display as sub menus we can go on
    $sql = "SELECT COUNT(*) as cpt FROM " . $xoopsDB->prefix("topics") . " WHERE menu=1";
    $result = $xoopsDB->query($sql);
    list($count) = $xoopsDB->fetchRow($result);
    if ($count > 0) {
        include_once XOOPS_ROOT_PATH . "/class/tree.php";
        include_once XOOPS_ROOT_PATH . "/modules/news/class/class.newstopic.php";
        include_once XOOPS_ROOT_PATH . "/modules/news/include/functions.php";
        $xt = new NewsTopic();
        $allTopics = $xt->getAllTopics(getmoduleoption('restrictindex'));
        $topic_tree = new XoopsObjectTree($allTopics, 'topic_id', 'topic_pid');
        $topics_arr = $topic_tree->getAllChild(0);
        if ($module) {
            foreach ($topics_arr as $onetopic) {
                if ($gperm_handler->checkRight('news_view', $onetopic->topic_id(), $groups, $xoopsModule->getVar('mid')) && $onetopic->menu()) {
                    $modversion['sub'][$i]['name'] = $onetopic->topic_title();
                    $modversion['sub'][$i]['url'] = "index.php?storytopic=" . $onetopic->topic_id();
                }
                $i++;
            }
        }
        unset($xt);
    }
}
$modversion['sub'][$i]['name'] = _MI_NEWS_SMNAME2;
Exemplo n.º 12
0
        foreach ($storyarray as $article) {
            $story = array();
            $htmltitle = '';
            if ($infotips > 0) {
                $story['infotips'] = xoops_substr(strip_tags($article->hometext()), 0, $infotips);
                $htmltitle = ' title="' . $story['infotips'] . '"';
            }
            $story['title'] = "<a href='" . XOOPS_URL . "/modules/news/index.php?storytopic=" . $article->topicid() . "'>" . $article->topic_title() . "</a>: <a href='" . XOOPS_URL . "/modules/news/article.php?storyid=" . $article->storyid() . "'" . $htmltitle . ">" . $article->title() . "</a>";
            $story['counter'] = $article->counter();
            $story['date'] = formatTimestamp($article->published(), $dateformat, $useroffset);
            $story['print_link'] = XOOPS_URL . '/modules/news/print.php?storyid=' . $article->storyid();
            $story['mail_link'] = 'mailto:?subject=' . sprintf(_NW_INTARTICLE, $xoopsConfig['sitename']) . '&amp;body=' . sprintf(_NW_INTARTFOUND, $xoopsConfig['sitename']) . ':  ' . XOOPS_URL . '/modules/' . $xoopsModule->dirname() . '/article.php?storyid=' . $article->storyid();
            $xoopsTpl->append('stories', $story);
        }
    }
    $xoopsTpl->assign('lang_printer', _NW_PRINTERFRIENDLY);
    $xoopsTpl->assign('lang_sendstory', _NW_SENDSTORY);
    $xoopsTpl->assign('lang_storytotal', sprintf(_NW_THEREAREINTOTAL, $count));
} else {
    $xoopsTpl->assign('show_articles', false);
}
$xoopsTpl->assign('lang_newsarchives', _NW_NEWSARCHIVES);
/**
* Create the website navigation's bar
*/
$sitenavbar = getmoduleoption('sitenavbar');
if ($sitenavbar) {
    $content = CreateSiteNavBar();
    $xoopsTpl->assign("xoops_module_header", $content);
}
include_once XOOPS_ROOT_PATH . "/footer.php";
Exemplo n.º 13
0
 * @template_var	string	lang_donotvote		Fixed text "Do not vote for your own resource."
 * @template_var	string	lang_rateit			Fixed text "Rate It!"
 * @template_var	string	lang_cancel			Fixed text "Cancel"
 * @template_var	array	news				Contains some information about the story
 *									Structure :
 * @template_var					int		storyid		Story's ID
 * @template_var					string	title		story's title
 */
include_once "header.php";
include_once XOOPS_ROOT_PATH . "/class/module.errorhandler.php";
include_once XOOPS_ROOT_PATH . '/modules/news/include/functions.php';
include_once XOOPS_ROOT_PATH . "/modules/news/class/class.newsstory.php";
$myts =& MyTextSanitizer::getInstance();
// Verify the perms
// 1) Is the vote activated in the module ?
$ratenews = getmoduleoption('ratenews');
if (!$ratenews) {
    redirect_header(XOOPS_URL . '/modules/news/index.php', 3, _NOPERM);
    exit;
}
// 2) Is the story published ?
$storyid = 0;
if (isset($_GET['storyid'])) {
    $storyid = intval($_GET['storyid']);
} else {
    if (isset($_POST['storyid'])) {
        $storyid = intval($_POST['storyid']);
    }
}
if (!empty($storyid)) {
    $article = new NewsStory($storyid);
Exemplo n.º 14
0
//  the Free Software Foundation; either version 2 of the License, or        //
//  (at your option) any later version.                                      //
//                                                                           //
//  You may not change or alter any portion of this comment or credits       //
//  of supporting developers from this source code or any supporting         //
//  source code which is considered copyrighted (c) material of the          //
//  original comment or credit authors.                                      //
//                                                                           //
//  This program is distributed in the hope that it will be useful,          //
//  but WITHOUT ANY WARRANTY; without even the implied warranty of           //
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            //
//  GNU General Public License for more details.                             //
//                                                                           //
//  You should have received a copy of the GNU General Public License        //
//  along with this program; if not, write to the Free Software              //
//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA //
//  ------------------------------------------------------------------------ //
include_once '../../mainfile.php';
include_once XOOPS_ROOT_PATH . '/modules/news/class/class.newsstory.php';
include_once XOOPS_ROOT_PATH . '/modules/news/include/functions.php';
$com_itemid = isset($_GET['com_itemid']) ? intval($_GET['com_itemid']) : 0;
if ($com_itemid > 0) {
    $article = new NewsStory($com_itemid);
    $com_replytext = _POSTEDBY . '&nbsp;<b>' . $article->uname() . '</b>&nbsp;' . _DATE . '&nbsp;<b>' . formatTimestamp($article->published(), getmoduleoption('dateformat')) . '</b><br /><br />' . $article->hometext();
    $bodytext = $article->bodytext();
    if ($bodytext != '') {
        $com_replytext .= '<br /><br />' . $bodytext . '';
    }
    $com_replytitle = $article->title();
    include_once XOOPS_ROOT_PATH . '/include/comment_new.php';
}
Exemplo n.º 15
0
/**
 * Creates, for Mozilla/Netscape and Opera the site navigation's bar
 *
 * @package News
 * @author Hervé Thouzard (www.herve-thouzard.com)
 * @copyright (c) The Xoops Project - www.xoops.org
*/
function CreateSiteNavBar()
{
    global $xoopsConfig;
    $content = '';
    $myts =& MyTextSanitizer::getInstance();
    include_once XOOPS_ROOT_PATH . "/modules/news/class/class.newstopic.php";
    $content = sprintf("<link rel=\"Home\" title=\"%s\" href=\"%s/\" />\n", $xoopsConfig['sitename'], XOOPS_URL);
    $content .= sprintf("<link rel=\"Contents\" href=\"%s\" />\n", XOOPS_URL . '/modules/news/index.php');
    $content .= sprintf("<link rel=\"Search\" href=\"%s\" />\n", XOOPS_URL . '/search.php');
    $content .= sprintf("<link rel=\"Glossary\" href=\"%s\" />\n", XOOPS_URL . '/modules/news/archive.php');
    $content .= sprintf("<link rel=\"%s\" href=\"%s\" />\n", $myts->htmlSpecialChars(_NW_SUBMITNEWS), XOOPS_URL . '/modules/news/submit.php');
    $content .= sprintf("<link rel=\"alternate\" type=\"application/rss+xml\" title=\"%s\" href=\"%s/\" />\n", $xoopsConfig['sitename'], XOOPS_URL . '/backend.php');
    // create chapters
    include_once XOOPS_ROOT_PATH . "/class/tree.php";
    include_once XOOPS_ROOT_PATH . "/modules/news/class/class.newstopic.php";
    $xt = new NewsTopic();
    $allTopics = $xt->getAllTopics(getmoduleoption('restrictindex'));
    $topic_tree = new XoopsObjectTree($allTopics, 'topic_id', 'topic_pid');
    $topics_arr = $topic_tree->getAllChild(0);
    foreach ($topics_arr as $onetopic) {
        $content .= sprintf("<link rel=\"Chapter\" title=\"%s\" href=\"%s\" />\n", $onetopic->topic_title(), XOOPS_URL . '/modules/news/index.php?storytopic=' . $onetopic->topic_id());
    }
    return $content;
}
Exemplo n.º 16
0
function news_search($queryarray, $andor, $limit, $offset, $userid)
{
    global $xoopsDB, $xoopsUser;
    include_once XOOPS_ROOT_PATH . '/modules/news/include/functions.php';
    $restricted = getmoduleoption('restrictindex');
    $highlight = false;
    $highlight = getmoduleoption('keywordshighlight');
    // keywords highlighting
    $module_handler =& xoops_gethandler('module');
    $module =& $module_handler->getByDirname('news');
    $modid = $module->getVar('mid');
    $searchparam = '';
    $gperm_handler =& xoops_gethandler('groupperm');
    if (is_object($xoopsUser)) {
        $groups = $xoopsUser->getGroups();
    } else {
        $groups = XOOPS_GROUP_ANONYMOUS;
    }
    $sql = "SELECT storyid, topicid, uid, title, created FROM " . $xoopsDB->prefix("stories") . " WHERE (published>0 AND published<=" . time() . ") ";
    if ($userid != 0) {
        $sql .= " AND uid=" . $userid . " ";
    }
    // because count() returns 1 even if a supplied variable
    // is not an array, we must check if $querryarray is really an array
    if (is_array($queryarray) && ($count = count($queryarray))) {
        $sql .= " AND ((hometext LIKE '%{$queryarray['0']}%' OR bodytext LIKE '%{$queryarray['0']}%' OR title LIKE '%{$queryarray['0']}%' OR keywords LIKE '%{$queryarray['0']}%' OR description LIKE '%{$queryarray['0']}%')";
        for ($i = 1; $i < $count; $i++) {
            $sql .= " {$andor} ";
            $sql .= "(hometext LIKE '%{$queryarray[$i]}%' OR bodytext LIKE '%{$queryarray[$i]}%' OR title LIKE '%{$queryarray[$i]}%' OR keywords LIKE '%{$queryarray[$i]}%' OR description LIKE '%{$queryarray[$i]}%')";
        }
        $sql .= ") ";
        // keywords highlighting
        if ($highlight) {
            $searchparam = '&keywords=' . urlencode(trim(implode(' ', $queryarray)));
        }
    }
    $sql .= "ORDER BY created DESC";
    $result = $xoopsDB->query($sql, $limit, $offset);
    $ret = array();
    $i = 0;
    while ($myrow = $xoopsDB->fetchArray($result)) {
        $display = true;
        if ($modid && $gperm_handler) {
            if ($restricted && !$gperm_handler->checkRight("news_view", $myrow['topicid'], $groups, $modid)) {
                $display = false;
            }
        }
        if ($display) {
            $ret[$i]['image'] = "images/forum.gif";
            $ret[$i]['link'] = "article.php?storyid=" . $myrow['storyid'] . "" . $searchparam;
            $ret[$i]['title'] = $myrow['title'];
            $ret[$i]['time'] = $myrow['created'];
            $ret[$i]['uid'] = $myrow['uid'];
            $i++;
        }
    }
    // Set this var to FALSE to not use the search in the comments
    $searchincomments = true;
    if ($searchincomments && (isset($limit) && $i <= $limit)) {
        include_once XOOPS_ROOT_PATH . '/include/comment_constants.php';
        $ind = $i;
        $sql = "SELECT com_id, com_modid, com_itemid, com_created, com_uid, com_title, com_text, com_status FROM " . $xoopsDB->prefix("xoopscomments") . " WHERE (com_id>0) AND (com_modid={$modid}) AND (com_status=" . XOOPS_COMMENT_ACTIVE . ") ";
        if ($userid != 0) {
            $sql .= " AND com_uid=" . $userid . " ";
        }
        if (is_array($queryarray) && ($count = count($queryarray))) {
            $sql .= " AND ((com_title LIKE '%{$queryarray['0']}%' OR com_text LIKE '%{$queryarray['0']}%')";
            for ($i = 1; $i < $count; $i++) {
                $sql .= " {$andor} ";
                $sql .= "(com_title LIKE '%{$queryarray[$i]}%' OR com_text LIKE '%{$queryarray[$i]}%')";
            }
            $sql .= ") ";
        }
        $i = $ind;
        $sql .= "ORDER BY com_created DESC";
        $result = $xoopsDB->query($sql, $limit, $offset);
        while ($myrow = $xoopsDB->fetchArray($result)) {
            $display = true;
            if ($modid && $gperm_handler) {
                if ($restricted && !$gperm_handler->checkRight("news_view", $myrow['com_itemid'], $groups, $modid)) {
                    $display = false;
                }
            }
            if ($i + 1 > $limit) {
                $display = false;
            }
            if ($display) {
                $ret[$i]['image'] = "images/forum.gif";
                $ret[$i]['link'] = "article.php?storyid=" . $myrow['com_itemid'] . "" . $searchparam;
                $ret[$i]['title'] = $myrow['com_title'];
                $ret[$i]['time'] = $myrow['com_created'];
                $ret[$i]['uid'] = $myrow['com_uid'];
                $i++;
            }
        }
    }
    return $ret;
}
Exemplo n.º 17
0
     $pubdate = strtotime($publish_date['date']) + $publish_date['time'];
     //$offset = $xoopsUser -> timezone() - $xoopsConfig['server_TZ'];
     //$pubdate = $pubdate - ( $offset * 3600 );
     $story->setPublished($pubdate);
 }
 if (!empty($_POST['autoexpdate']) && $approveprivilege) {
     $expiry_date = $_POST['expiry_date'];
     $expiry_date = strtotime($expiry_date['date']) + $expiry_date['time'];
     $offset = $xoopsUser->timezone() - $xoopsConfig['server_TZ'];
     $expiry_date = $expiry_date - $offset * 3600;
     $story->setExpired($expiry_date);
 } else {
     $story->setExpired(0);
 }
 if ($approveprivilege) {
     if (getmoduleoption('metadata')) {
         $story->Setdescription($_POST['description']);
         $story->Setkeywords($_POST['keywords']);
     }
     $story->setTopicdisplay($_POST['topicdisplay']);
     // Display Topic Image ? (Yes or No)
     $story->setTopicalign($_POST['topicalign']);
     // Topic Align, 'Right' or 'Left'
     $story->setIhome($_POST['ihome']);
     // Publish in home ? (Yes or No)
     if (isset($_POST['bodytext'])) {
         $story->setBodytext($_POST['bodytext']);
     } else {
         $story->setBodytext(' ');
     }
     $approve = isset($_POST['approve']) ? intval($_POST['approve']) : 0;
Exemplo n.º 18
0
if (!getmoduleoption('topicsrss')) {
    exit;
}
$topicid = 0;
if (isset($_GET['topicid'])) {
    $topicid = intval($_GET['topicid']);
}
if (!$topicid) {
    exit;
}
$myts =& MyTextSanitizer::getInstance();
if (function_exists('mb_http_output')) {
    mb_http_output('pass');
}
$restricted = getmoduleoption('restrictindex');
$newsnumber = getmoduleoption('storyhome');
header('Content-Type:text/xml; charset=utf-8');
$story = new NewsStory();
$tpl = new XoopsTpl();
$tpl->xoops_setCaching(2);
$tpl->xoops_setCacheTime(0);
if (!$tpl->is_cached('db:system_rss.html')) {
    $sarray = $story->getAllPublished($newsnumber, 0, $restricted, $topicid);
    if (is_array($sarray) && count($sarray) > 0) {
        $tpl->assign('channel_title', xoops_utf8_encode(htmlspecialchars($xoopsConfig['sitename'], ENT_QUOTES)));
        $tpl->assign('channel_link', XOOPS_URL . '/');
        $tpl->assign('channel_desc', xoops_utf8_encode(htmlspecialchars($xoopsConfig['slogan'], ENT_QUOTES)));
        $tpl->assign('channel_lastbuild', formatTimestamp(time(), 'rss'));
        $tpl->assign('channel_webmaster', checkEmail($xoopsConfig['adminmail'], true));
        // Fed up with spam
        $tpl->assign('channel_editor', checkEmail($xoopsConfig['adminmail'], true));
Exemplo n.º 19
0
/**
* Notes about the spotlight :
* If you have restricted topics on index page (in fact if the program must completly respect the permissions) and if
* the news you have selected to be viewed in the spotlight can't be viewed by someone then the spotlight is not visible !
* This is available in the classical and in the tabbed view.
* But if you have uncheck the option "Restrict topics on index page", then the news will be visible but users without
* permissions will be rejected when they will try to read news content.
*
* Also, if you have selected a tabbed view and wanted to use the Spotlight but did not choosed a story, then the block
* will switch to the "most recent news" mode (the visible news will be searched according to the permissions)
*/
function b_news_top_show($options)
{
    global $xoopsConfig;
    include_once XOOPS_ROOT_PATH . '/modules/news/include/functions.php';
    $myts =& MyTextSanitizer::getInstance();
    $block = array();
    $displayname = getmoduleoption('displayname');
    $tabskin = getmoduleoption('tabskin');
    if (file_exists(XOOPS_ROOT_PATH . '/modules/news/language/' . $xoopsConfig['language'] . '/main.php')) {
        include_once XOOPS_ROOT_PATH . '/modules/news/language/' . $xoopsConfig['language'] . '/main.php';
    } else {
        include_once XOOPS_ROOT_PATH . '/modules/news/language/english/main.php';
    }
    $block['displayview'] = $options[8];
    $block['tabskin'] = $tabskin;
    $block['imagesurl'] = XOOPS_URL . '/modules/news/images/';
    $restricted = getmoduleoption('restrictindex');
    $dateformat = getmoduleoption('dateformat');
    $infotips = getmoduleoption('infotips');
    $newsrating = getmoduleoption('ratenews');
    if ($dateformat == '') {
        $dateformat = 's';
    }
    // Is the spotlight visible ?
    if ($options[4] == 1 && $restricted && $options[5] == 0) {
        $permittedtopics = MygetItemIds();
        $permstory = new NewsStory($options[6]);
        if (!in_array($permstory->topicid(), $permittedtopics)) {
            $usespotlight = false;
            $topicstitles = array();
        }
        unset($permstory);
        $options[4] == 0;
    }
    // Try to see what tabs are visibles (if we are in restricted view of course)
    if ($options[8] == 2 && $restricted && $options[14] != 0) {
        $topics2 = array();
        $permittedtopics = MygetItemIds();
        $topics = array_slice($options, 14);
        foreach ($topics as $onetopic) {
            if (in_array($onetopic, $permittedtopics)) {
                $topics2[] = $onetopic;
            }
        }
        $before = array_slice($options, 0, 14);
        $options = array_merge($before, $topics2);
    }
    if ($options[8] == 2) {
        $defcolors[1] = array('#F90', '#FFFFFF', '#F90', '#C60', '#999');
        // Bar Style
        $defcolors[2] = array('#F90', '#FFFFFF', '#F90', '#AAA', '#666');
        // Beveled
        $defcolors[3] = array('#F90', '#FFFFFF', '', '#789', '#789');
        // Classic
        $defcolors[4] = array('#F90', '#FFFFFF', '', '', '');
        // Folders
        $defcolors[5] = array('#F90', '#FFFFFF', '#CCC', 'inherit', '#999');
        // MacOs
        $defcolors[6] = array('#F90', '#FFFFFF', '#FFF', '#DDD', '#999');
        // Plain
        $defcolors[7] = array('#F90', '#FFFFFF', '', '', '');
        // Rounded
        $defcolors[8] = array('#F90', '#FFFFFF', '#F90', '#930', '#C60');
        // ZDnet
        $myurl = $_SERVER["PHP_SELF"];
        if (substr($myurl, strlen($myurl) - 1, 1) == '/') {
            $myurl .= "index.php";
        }
        $myurl .= '?';
        foreach ($_GET as $key => $value) {
            if ($key != 'NewsTab') {
                $myurl .= $key . '=' . $value . '&';
            }
        }
        $block['url'] = $myurl;
        $tabscount = 0;
        $usespotlight = false;
        if (isset($_GET['NewsTab'])) {
            $_SESSION['NewsTab'] = intval($_GET['NewsTab']);
            $currenttab = intval($_GET['NewsTab']);
        } elseif (isset($_SESSION['NewsTab'])) {
            $currenttab = intval($_SESSION['NewsTab']);
        } else {
            $currenttab = 0;
        }
        $tmpstory = new NewsStory();
        $topic = new NewsTopic();
        $topicstitles = array();
        if ($options[4] == 1) {
            // Spotlight enabled
            $topicstitles[0] = _MB_NEWS_SPOTLIGHT_TITLE;
            $tabscount++;
            $usespotlight = true;
        }
        if ($options[5] == 0 && $restricted) {
            // Use a specific news and we are in restricted mode
            $permittedtopics = MygetItemIds();
            $permstory = new NewsStory($options[6]);
            if (!in_array($permstory->topicid(), $permittedtopics)) {
                $usespotlight = false;
                $topicstitles = array();
            }
            unset($permstory);
        }
        $block['use_spotlight'] = $usespotlight;
        if (isset($options[14]) && $options[14] != 0) {
            // Topic to use
            $topics = array_slice($options, 14);
            $tabscount += count($topics);
            $topicstitles = $topic->getTopicTitleFromId($topics, $topicstitles);
        }
        $tabs = array();
        if ($usespotlight) {
            $tabs[] = array('id' => 0, 'title' => _MB_NEWS_SPOTLIGHT_TITLE);
        }
        if (count($topics) > 0) {
            foreach ($topics as $onetopic) {
                if (isset($topicstitles[$onetopic])) {
                    $tabs[] = array('id' => $onetopic, 'title' => $topicstitles[$onetopic]['title'], 'picture' => $topicstitles[$onetopic]['picture']);
                }
            }
        }
        $block['tabs'] = $tabs;
        $block['current_is_spotlight'] = false;
        $block['current_tab'] = $currenttab;
        $block['use_rating'] = $newsrating;
        if ($currenttab == 0 && $usespotlight) {
            // Spotlight or not ?
            $block['current_is_spotlight'] = true;
            if ($options[5] == 0 && $options[6] == 0) {
                // If the story to use was no selected then we switch to the "recent news" mode.
                $options[5] = 1;
            }
            if ($options[5] == 0) {
                // Use a specific news
                $tmpstory->NewsStory(intval($options[6]));
            } else {
                // Use the most recent news
                $stories = array();
                $stories = $tmpstory->getAllPublished(1, 0, $restricted, 0, 1, true, $options[0]);
                if (count($stories) > 0) {
                    $firststory = $stories[0];
                    $tmpstory->NewsStory($firststory->storyid());
                } else {
                    $block['use_spotlight'] = false;
                }
            }
            $spotlight = array();
            $spotlight['title'] = $tmpstory->title();
            if ($options[7] != "") {
                $spotlight['image'] = sprintf("<a href='%s'>%s</a>", XOOPS_URL . '/modules/news/article.php?storyid=' . $tmpstory->storyid(), $myts->displayTarea($options[7], $tmpstory->nohtml));
            }
            $spotlight['text'] = $tmpstory->hometext();
            $spotlight['id'] = $tmpstory->storyid();
            $spotlight['date'] = formatTimestamp($tmpstory->published(), $dateformat);
            $spotlight['hits'] = $tmpstory->counter();
            $spotlight['rating'] = number_format($tmpstory->rating(), 2);
            $spotlight['votes'] = $tmpstory->votes();
            if (strlen(xoops_trim($tmpstory->bodytext())) > 0) {
                $spotlight['read_more'] = true;
            } else {
                $spotlight['read_more'] = false;
            }
            $spotlight['readmore'] = sprintf("<a href='%s'>%s</a>", XOOPS_URL . '/modules/news/article.php?storyid=' . $tmpstory->storyid(), _MB_READMORE);
            $spotlight['title_with_link'] = sprintf("<a href='%s'>%s</a>", XOOPS_URL . '/modules/news/article.php?storyid=' . $tmpstory->storyid(), $tmpstory->title());
            if ($tmpstory->votes() == 1) {
                $spotlight['number_votes'] = _NW_ONEVOTE;
            } else {
                $spotlight['number_votes'] = sprintf(_NW_NUMVOTES, $tmpstory->votes());
            }
            $spotlight['votes_with_text'] = sprintf(_NW_NUMVOTES, $tmpstory->votes());
            $spotlight['topicid'] = $tmpstory->topicid();
            $spotlight['topic_title'] = $tmpstory->topic_title();
            // Added, topic's image and description
            $spotlight['topic_image'] = XOOPS_URL . '/modules/news/images/topics/' . $tmpstory->topic_imgurl();
            $spotlight['topic_description'] = $myts->displayTarea($tmpstory->topic_description, 1);
            if ($displayname != 3) {
                $spotlight['author'] = sprintf("%s %s", _POSTEDBY, $tmpstory->uname());
                $spotlight['author_with_link'] = sprintf("%s <a href='%s'>%s</a>", _POSTEDBY, XOOPS_URL . '/userinfo.php?uid=' . $tmpstory->uid(), $tmpstory->uname());
            } else {
                $spotlight['author'] = '';
                $spotlight['author_with_link'] = '';
            }
            $spotlight['author_id'] = $tmpstory->uid();
            // Create the summary table under the spotlight text
            if (isset($options[14]) && $options[14] == 0) {
                // Use all topics
                $stories = $tmpstory->getAllPublished($options[1], 0, $restricted, 0, 1, true, $options[0]);
            } else {
                // Use some topics
                $topics = array_slice($options, 14);
                $stories = $tmpstory->getAllPublished($options[1], 0, $restricted, $topics, 1, true, $options[0]);
            }
            if (count($stories) > 0) {
                foreach ($stories as $key => $story) {
                    $news = array();
                    $title = $story->title();
                    if (strlen($title) > $options[2]) {
                        $title = xoops_substr($title, 0, $options[2] + 3);
                    }
                    $news['title'] = $title;
                    $news['id'] = $story->storyid();
                    $news['date'] = formatTimestamp($story->published(), $dateformat);
                    $news['hits'] = $story->counter();
                    $news['rating'] = number_format($story->rating(), 2);
                    $news['votes'] = $story->votes();
                    $news['topicid'] = $story->topicid();
                    $news['topic_title'] = $story->topic_title();
                    $news['topic_color'] = '#' . $myts->displayTarea($story->topic_color);
                    if ($displayname != 3) {
                        $news['author'] = sprintf("%s %s", _POSTEDBY, $story->uname());
                    } else {
                        $news['author'] = '';
                    }
                    if ($options[3] > 0) {
                        $news['teaser'] = xoops_substr(strip_tags($story->hometext()), 0, $options[3] + 3);
                    } else {
                        $news['teaser'] = "";
                    }
                    if ($infotips > 0) {
                        $news['infotips'] = ' title="' . xoops_substr(strip_tags($story->hometext()), 0, $infotips) . '"';
                    } else {
                        $news['infotips'] = '';
                    }
                    $news['title_with_link'] = sprintf("<a href='%s'%s>%s</a>", XOOPS_URL . '/modules/news/article.php?storyid=' . $story->storyid(), $news['infotips'], $title);
                    $spotlight['news'][] = $news;
                }
            }
            $block['spotlight'] = $spotlight;
        } else {
            if ($tabscount > 0) {
                $topics = array_slice($options, 14);
                $thetopic = $currenttab;
                $stories = $tmpstory->getAllPublished($options[1], 0, $restricted, $thetopic, 1, true, $options[0]);
                $topic->getTopic($thetopic);
                // Added, topic's image and description
                $block['topic_image'] = XOOPS_URL . '/modules/news/images/topics/' . $topic->topic_imgurl();
                $block['topic_description'] = $topic->topic_description();
                $smallheader = array();
                $stats = $topic->getTopicMiniStats($thetopic);
                $smallheader[] = sprintf("<a href='%s'>%s</a>", XOOPS_URL . '/modules/news/index.php?storytopic=' . $thetopic, _MB_READMORE);
                $smallheader[] = sprintf("%u %s", $stats['count'], _NW_ARTICLES);
                $smallheader[] = sprintf("%u %s", $stats['reads'], _READS);
                if (count($stories) > 0) {
                    foreach ($stories as $key => $story) {
                        $news = array();
                        $title = $story->title();
                        if (strlen($title) > $options[2]) {
                            $title = xoops_substr(strip_tags($title), 0, $options[2] + 3);
                        }
                        if ($options[7] != "") {
                            $news['image'] = sprintf("<a href='%s'>%s</a>", XOOPS_URL . '/modules/news/article.php?storyid=' . $story->storyid(), $myts->displayTarea($options[7], $story->nohtml));
                        }
                        if ($options[3] > 0) {
                            $news['text'] = xoops_substr(strip_tags($story->hometext()), 0, $options[3] + 3);
                        } else {
                            $news['text'] = '';
                        }
                        if ($story->votes() == 1) {
                            $news['number_votes'] = _NW_ONEVOTE;
                        } else {
                            $news['number_votes'] = sprintf(_NW_NUMVOTES, $story->votes());
                        }
                        $topic->getTopic($story->topicid());
                        if ($infotips > 0) {
                            $news['infotips'] = ' title="' . xoops_substr(strip_tags($story->hometext()), 0, $infotips) . '"';
                        } else {
                            $news['infotips'] = '';
                        }
                        $news['title'] = sprintf("<a href='%s' %s>%s</a>", XOOPS_URL . '/modules/news/article.php?storyid=' . $story->storyid(), $news['infotips'], $title);
                        $news['id'] = $story->storyid();
                        $news['date'] = formatTimestamp($story->published(), $dateformat);
                        $news['hits'] = $story->counter();
                        $news['rating'] = number_format($story->rating(), 2);
                        $news['votes'] = $story->votes();
                        $news['topicid'] = $story->topicid();
                        $news['topic_title'] = $story->topic_title();
                        $news['topic_color'] = '#' . $topic->topic_color();
                        if ($displayname != 3) {
                            $news['author'] = sprintf("%s %s", _POSTEDBY, $story->uname());
                        } else {
                            $news['author'] = '';
                        }
                        $news['title_with_link'] = sprintf("<a href='%s'%s>%s</a>", XOOPS_URL . '/modules/news/article.php?storyid=' . $story->storyid(), $news['infotips'], $title);
                        $block['news'][] = $news;
                    }
                    $block['smallheader'] = $smallheader;
                }
            }
        }
        $block['lang_on'] = _ON;
        // on
        $block['lang_reads'] = _READS;
        // reads
        // Default values
        $block['color1'] = $defcolors[$tabskin][0];
        $block['color2'] = $defcolors[$tabskin][1];
        $block['color3'] = $defcolors[$tabskin][2];
        $block['color4'] = $defcolors[$tabskin][3];
        $block['color5'] = $defcolors[$tabskin][4];
        if (xoops_trim($options[9]) != '') {
            $block['color1'] = $options[9];
        }
        if (xoops_trim($options[10]) != '') {
            $block['color2'] = $options[10];
        }
        if (xoops_trim($options[11]) != '') {
            $block['color3'] = $options[11];
        }
        if (xoops_trim($options[12]) != '') {
            $block['color4'] = $options[12];
        }
        if (xoops_trim($options[13]) != '') {
            $block['color5'] = $options[13];
        }
    } else {
        // ************************ Classical view **************************************************************************************************************
        $tmpstory = new NewsStory();
        if (isset($options[14]) && $options[14] == 0) {
            $stories = $tmpstory->getAllPublished($options[1], 0, $restricted, 0, 1, true, $options[0]);
        } else {
            $topics = array_slice($options, 14);
            $stories = $tmpstory->getAllPublished($options[1], 0, $restricted, $topics, 1, true, $options[0]);
        }
        if (!count($stories)) {
            return '';
        }
        $topic = new NewsTopic();
        foreach ($stories as $key => $story) {
            $news = array();
            $title = $story->title();
            if (strlen($title) > $options[2]) {
                $title = xoops_substr($title, 0, $options[2] + 3);
            }
            $topic->getTopic($story->topicid());
            //if spotlight is enabled and this is either the first article or the selected one
            if ($options[5] == 0 && $options[4] == 1 && ($options[6] > 0 && $options[6] == $story->storyid() || $options[6] == 0 && $key == 0)) {
                $spotlight = array();
                $visible = true;
                if ($restricted) {
                    $permittedtopics = MygetItemIds();
                    if (!in_array($story->topicid(), $permittedtopics)) {
                        $visible = false;
                    }
                }
                if ($visible) {
                    $spotlight['title'] = $title;
                    if ($options[7] != "") {
                        $spotlight['image'] = sprintf("<a href='%s'>%s</a>", XOOPS_URL . '/modules/news/article.php?storyid=' . $story->storyid(), $myts->displayTarea($options[7], $story->nohtml));
                    }
                    $spotlight['text'] = $story->hometext();
                    $spotlight['id'] = $story->storyid();
                    $spotlight['date'] = formatTimestamp($story->published(), $dateformat);
                    $spotlight['hits'] = $story->counter();
                    $spotlight['rating'] = $story->rating();
                    $spotlight['votes'] = $story->votes();
                    $spotlight['topicid'] = $story->topicid();
                    $spotlight['topic_title'] = $story->topic_title();
                    $spotlight['topic_color'] = '#' . $topic->topic_color();
                    // Added, topic's image and description
                    $spotlight['topic_image'] = XOOPS_URL . '/modules/news/images/topics/' . $story->topic_imgurl();
                    $spotlight['topic_description'] = $myts->displayTarea($story->topic_description, 1);
                    if (strlen(xoops_trim($story->bodytext())) > 0) {
                        $spotlight['read_more'] = true;
                    } else {
                        $spotlight['read_more'] = false;
                    }
                    if ($displayname != 3) {
                        $spotlight['author'] = sprintf("%s %s", _POSTEDBY, $story->uname());
                    } else {
                        $spotlight['author'] = '';
                    }
                }
                $block['spotlight'] = $spotlight;
            } else {
                $news['title'] = $title;
                $news['id'] = $story->storyid();
                $news['date'] = formatTimestamp($story->published(), $dateformat);
                $news['hits'] = $story->counter();
                $news['rating'] = $story->rating();
                $news['votes'] = $story->votes();
                $news['topicid'] = $story->topicid();
                $news['topic_title'] = $story->topic_title();
                $news['topic_color'] = '#' . $topic->topic_color();
                if ($displayname != 3) {
                    $news['author'] = sprintf("%s %s", _POSTEDBY, $story->uname());
                } else {
                    $news['author'] = '';
                }
                if ($options[3] > 0) {
                    $news['teaser'] = xoops_substr(strip_tags($story->hometext()), 0, $options[3] + 3);
                    $news['infotips'] = '';
                } else {
                    $news['teaser'] = "";
                    if ($infotips > 0) {
                        $news['infotips'] = ' title="' . xoops_substr(strip_tags($story->hometext()), 0, $infotips) . '"';
                    } else {
                        $news['infotips'] = '';
                    }
                }
                $block['stories'][] = $news;
            }
        }
        // If spotlight article was not in the fetched stories
        if (!isset($spotlight) && $options[4]) {
            $block['use_spotlight'] = true;
            $visible = true;
            if ($options[5] == 0 && $restricted) {
                // Use a specific news and we are in restricted mode
                $permittedtopics = MygetItemIds();
                $permstory = new NewsStory($options[6]);
                if (!in_array($permstory->topicid(), $permittedtopics)) {
                    $visible = false;
                }
                unset($permstory);
            }
            if ($options[5] == 0) {
                // Use a specific news
                if ($visible) {
                    $spotlightArticle = new NewsStory($options[6]);
                } else {
                    $block['use_spotlight'] = false;
                }
            } else {
                // Use the most recent news
                $stories = array();
                $stories = $tmpstory->getAllPublished(1, 0, $restricted, 0, 1, true, $options[0]);
                if (count($stories) > 0) {
                    $firststory = $stories[0];
                    $spotlightArticle = new NewsStory($firststory->storyid());
                } else {
                    $block['use_spotlight'] = false;
                }
            }
            if ($block['use_spotlight'] == true) {
                $spotlight = array();
                $topic->getTopic($spotlightArticle->storyid());
                $spotlight['title'] = xoops_substr($spotlightArticle->title(), 0, $options[2] - 1);
                if ($options[7] != "") {
                    $spotlight['image'] = sprintf("<a href='%s'>%s</a>", XOOPS_URL . '/modules/news/article.php?storyid=' . $spotlightArticle->storyid(), $myts->displayTarea($options[7], $spotlightArticle->nohtml));
                }
                $spotlight['topicid'] = $spotlightArticle->topicid();
                $spotlight['topic_title'] = $spotlightArticle->topic_title();
                $spotlight['topic_color'] = '#' . $topic->topic_color();
                $spotlight['text'] = $spotlightArticle->hometext();
                $spotlight['id'] = $spotlightArticle->storyid();
                $spotlight['date'] = formatTimestamp($spotlightArticle->published(), $dateformat);
                $spotlight['hits'] = $spotlightArticle->counter();
                $spotlight['rating'] = $spotlightArticle->rating();
                $spotlight['votes'] = $spotlightArticle->votes();
                // Added, topic's image and description
                $spotlight['topic_image'] = XOOPS_URL . '/modules/news/images/topics/' . $spotlightArticle->topic_imgurl();
                $spotlight['topic_description'] = $myts->displayTarea($spotlightArticle->topic_description, 1);
                if ($displayname != 3) {
                    $spotlight['author'] = sprintf("%s %s", _POSTEDBY, $spotlightArticle->uname());
                } else {
                    $spotlight['author'] = '';
                }
                if (strlen(xoops_trim($spotlightArticle->bodytext())) > 0) {
                    $spotlight['read_more'] = true;
                } else {
                    $spotlight['read_more'] = false;
                }
                $block['spotlight'] = $spotlight;
            }
        }
    }
    $block['lang_read_more'] = _MB_READMORE;
    // Read More...
    $block['lang_orderby'] = _MB_NEWS_ORDER;
    // "Order By"
    $block['lang_orderby_date'] = _MB_NEWS_DATE;
    // Published date
    $block['lang_orderby_hits'] = _MB_NEWS_HITS;
    // Number of Hits
    $block['lang_orderby_rating'] = _MB_NEWS_RATE;
    // Rating
    $block['sort'] = $options[0];
    // "published" or "counter" or "rating"
    return $block;
}