function b_marquee_news($limit, $dateformat, $itemssize) { include_once XOOPS_ROOT_PATH . '/modules/marquee/include/functions.php'; include_once XOOPS_ROOT_PATH . '/modules/news/class/class.newsstory.php'; $block = $stories = array(); $story = new NewsStory(); $restricted = marquee_getmoduleoption('restrictindex', 'news'); $stories = $story->getAllPublished($limit, 0, $restricted, 0, 1, true, 'published'); if (count($stories) > 0) { foreach ($stories as $onestory) { if ($itemssize > 0) { $title = xoops_substr($onestory->title(), 0, $itemssize + 3); } else { $title = $onestory->title(); } $block[] = array('date' => formatTimestamp($onestory->published(), $dateformat), 'category' => $onestory->topic_title(), 'author' => $onestory->uid(), 'title' => $title, 'link' => "<a href='" . XOOPS_URL . '/modules/news/article.php?storyid=' . $onestory->storyid() . "'>" . $title . '</a>'); } } return $block; }
function &getRecentPosts($respond = true) { if (!$this->_checkUser($this->params[1], $this->params[2])) { $this->response->add(new XoopsXmlRpcFault(104)); } else { include_once XOOPS_ROOT_PATH . '/modules/news/class/class.newsstory.php'; if (isset($this->params[4]) && intval($this->params[4]) > 0) { $stories =& NewsStory::getAllPublished(intval($this->params[3]), 0, $this->params[4]); } else { $stories =& NewsStory::getAllPublished(intval($this->params[3])); } $scount = count($stories); $ret = array(); for ($i = 0; $i < $scount; $i++) { $ret[] = array('uid' => $stories[$i]->uid(), 'published' => $stories[$i]->published(), 'storyid' => $stories[$i]->storyId(), 'title' => $stories[$i]->title('Edit'), 'hometext' => $stories[$i]->hometext('Edit'), 'moretext' => $stories[$i]->bodytext('Edit')); } if (!$respond) { return $ret; } else { if (count($ret) == 0) { $this->response->add(new XoopsXmlRpcFault(106, 'Found 0 Entries')); } else { $arr = new XoopsXmlRpcArray(); $count = count($ret); for ($i = 0; $i < $count; $i++) { $struct = new XoopsXmlRpcStruct(); $content = ''; foreach ($ret[$i] as $key => $value) { switch ($key) { case 'uid': $struct->add('userid', new XoopsXmlRpcString($value)); break; case 'published': $struct->add('dateCreated', new XoopsXmlRpcDatetime($value)); break; case 'storyid': $struct->add('postid', new XoopsXmlRpcString($value)); $struct->add('link', new XoopsXmlRpcString(XOOPS_URL . '/modules/news/article.php?item_id=' . $value)); $struct->add('permaLink', new XoopsXmlRpcString(XOOPS_URL . '/modules/news/article.php?item_id=' . $value)); break; case 'title': $struct->add('title', new XoopsXmlRpcString($value)); break; default: $content .= '<' . $key . '>' . trim($value) . '</' . $key . '>'; break; } } $struct->add('description', new XoopsXmlRpcString($content)); $arr->add($struct); unset($struct); } $this->response->add($arr); } } } }
/** * Function used to edit the block */ function b_news_top_edit($options) { global $xoopsDB; $tmpstory = new NewsStory(); $form = _MB_NEWS_ORDER . " <select name='options[]'>"; $form .= "<option value='published'"; if ($options[0] == 'published') { $form .= " selected='selected'"; } $form .= '>' . _MB_NEWS_DATE . "</option>\n"; $form .= "<option value='counter'"; if ($options[0] == 'counter') { $form .= " selected='selected'"; } $form .= '>' . _MB_NEWS_HITS . '</option>'; $form .= "<option value='rating'"; if ($options[0] == 'rating') { $form .= " selected='selected'"; } $form .= '>' . _MB_NEWS_RATE . '</option>'; $form .= "</select>\n"; $form .= ' ' . _MB_NEWS_DISP . " <input type='text' name='options[]' value='" . $options[1] . "'/> " . _MB_NEWS_ARTCLS; $form .= " <br /><br />" . _MB_NEWS_CHARS . " <input type='text' name='options[]' value='" . $options[2] . "'/> " . _MB_NEWS_LENGTH . '<br /><br />'; $form .= _MB_NEWS_TEASER . " <input type='text' name='options[]' value='" . $options[3] . "' />" . _MB_NEWS_LENGTH; $form .= '<br /><br />'; $form .= _MB_NEWS_SPOTLIGHT . " <input type='radio' name='options[]' value='1'"; if ($options[4] == 1) { $form .= " checked='checked'"; } $form .= ' />' . _YES; $form .= "<input type='radio' name='options[]' value='0'"; if ($options[4] == 0) { $form .= " checked='checked'"; } $form .= ' />' . _NO . '<br /><br />'; $form .= _MB_NEWS_WHAT_PUBLISH . " <select name='options[]'><option value='1'"; if ($options[5] == 1) { $form .= ' selected'; } $form .= ' />' . _MB_NEWS_RECENT_NEWS; $form .= "</option><option value='0'"; if ($options[5] == 0) { $form .= ' selected'; } $form .= ' />' . _MB_NEWS_RECENT_SPECIFIC . '</option></select>'; $form .= '<br /><br />' . _MB_NEWS_SPOTLIGHT_ARTICLE . '<br />'; $articles = $tmpstory->getAllPublished(200, 0, false, 0, 0, false); // I have limited the listbox to the last 200 articles $form .= "<select name ='options[]'>"; $form .= "<option value='0'>" . _MB_NEWS_FIRST . '</option>'; foreach ($articles as $storyid => $storytitle) { $sel = ''; if ($options[6] == $storyid) { $sel = " selected='selected'"; } $form .= "<option value='{$storyid}'{$sel}>" . $storytitle . '</option>'; } $form .= '</select><br /><br />'; $form .= _MB_NEWS_IMAGE . " <input type='text' id='spotlightimage' name='options[]' value='" . $options[7] . "' size='50'/>"; $form .= " <img align='middle' onmouseover='style.cursor=\"hand\"' onclick='javascript:openWithSelfMain(\"" . XOOPS_URL . "/imagemanager.php?target=spotlightimage\",\"imgmanager\",400,430);' src='" . XOOPS_URL . "/images/image.gif' alt='image' title='image' />"; $form .= '<br /><br />' . _MB_NEWS_DISP . " <select name='options[]'><option value='1' "; if ($options[8] == 1) { $form .= 'selected'; } $form .= '>' . _MB_NEWS_VIEW_TYPE1 . "</option><option value='2' "; if ($options[8] == 2) { $form .= 'selected'; } $form .= '>' . _MB_NEWS_VIEW_TYPE2 . '</option></select><br /><br />'; $form .= "<table border=0>\n"; $form .= "<tr><td colspan='2' align='center'><u>" . _MB_NEWS_DEFAULT_COLORS . "</u></td></tr>"; $form .= "<tr><td>" . _MB_NEWS_TAB_COLOR1 . "</td><td><input type='text' name='options[]' value='" . $options[9] . "' size=7></td></tr>"; $form .= "<tr><td>" . _MB_NEWS_TAB_COLOR2 . "</td><td><input type='text' name='options[]' value='" . $options[10] . "' size=7></td></tr>"; $form .= "<tr><td>" . _MB_NEWS_TAB_COLOR3 . "</td><td><input type='text' name='options[]' value='" . $options[11] . "' size=7></td></tr>"; $form .= "<tr><td>" . _MB_NEWS_TAB_COLOR4 . "</td><td><input type='text' name='options[]' value='" . $options[12] . "' size=7></td></tr>"; $form .= "<tr><td>" . _MB_NEWS_TAB_COLOR5 . "</td><td><input type='text' name='options[]' value='" . $options[13] . "' size=7></td></tr>"; $form .= "</table>\n"; $form .= '<br /><br />' . _MB_SPOTLIGHT_TOPIC . "<br /><select name='options[]' multiple='multiple'>"; include_once XOOPS_ROOT_PATH . '/modules/news/class/class.newstopic.php'; $topics_arr = array(); include_once XOOPS_ROOT_PATH . '/class/xoopstree.php'; $xt = new XoopsTree($xoopsDB->prefix('topics'), 'topic_id', 'topic_pid'); $topics_arr = $xt->getChildTreeArray(0, 'topic_title'); $size = count($options); foreach ($topics_arr as $onetopic) { $sel = ''; if ($onetopic['topic_pid'] != 0) { $onetopic['prefix'] = str_replace('.', '-', $onetopic['prefix']) . ' '; } else { $onetopic['prefix'] = str_replace('.', '', $onetopic['prefix']); } for ($i = 14; $i < $size; $i++) { if ($options[$i] == $onetopic['topic_id']) { $sel = " selected='selected'"; } } $form .= "<option value='" . $onetopic['topic_id'] . "'{$sel}>" . $onetopic['prefix'] . $onetopic['topic_title'] . '</option>'; } $form .= '</select><br />'; return $form; }
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)); // Fed up with spam $tpl->assign('channel_category', 'News'); $tpl->assign('channel_generator', 'XOOPS'); $tpl->assign('channel_language', _LANGCODE); $tpl->assign('image_url', XOOPS_URL . '/images/logo.gif'); $dimention = getimagesize(XOOPS_ROOT_PATH . '/images/logo.gif'); if (empty($dimention[0])) {
$tpl->assign('channel_desc', XoopsLocal::convert_encoding(htmlspecialchars($xoopsConfig['slogan'], ENT_QUOTES))); $tpl->assign('channel_lastbuild', formatTimestamp(time(), 'rss')); $tpl->assign('channel_webmaster', checkEmail($xoopsConfig['adminmail'], true)); $tpl->assign('channel_editor', checkEmail($xoopsConfig['adminmail'], true)); $tpl->assign('channel_category', 'News'); $tpl->assign('channel_generator', 'XOOPS'); $tpl->assign('channel_language', _LANGCODE); $tpl->assign('image_url', XOOPS_URL . '/images/logo.png'); $dimention = getimagesize(XOOPS_ROOT_PATH . '/images/logo.png'); if (empty($dimention[0])) { $width = 88; } else { $width = $dimention[0] > 144 ? 144 : $dimention[0]; } if (empty($dimention[1])) { $height = 31; } else { $height = $dimention[1] > 400 ? 400 : $dimention[1]; } $tpl->assign('image_width', $width); $tpl->assign('image_height', $height); if (@(include_once XOOPS_ROOT_PATH . '/modules/news/class/class.newsstory.php')) { $sarray = NewsStory::getAllPublished(10, 0, true); } if (!empty($sarray) && is_array($sarray)) { foreach ($sarray as $story) { $tpl->append('items', array('title' => XoopsLocal::convert_encoding(htmlspecialchars($story->title(), ENT_QUOTES)), 'link' => XOOPS_URL . '/modules/news/article.php?storyid=' . $story->storyid(), 'guid' => XOOPS_URL . '/modules/news/article.php?storyid=' . $story->storyid(), 'pubdate' => formatTimestamp($story->published(), 'rss'), 'description' => XoopsLocal::convert_encoding(htmlspecialchars($story->hometext(), ENT_QUOTES)))); } } } $tpl->display('db:system_rss.html');
* Created on 28 oct. 2006 * * This file is responsible for creating micro summaries for Firefox 2 web navigator * For more information, see this page : http://wiki.mozilla.org/Microsummaries * * @package News * @author Instant Zero (http://xoops.instant-zero.com) * @copyright (c) Instant Zero * * NOTE : If you use this code, please make credit. * */ 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'; if (!news_getmoduleoption('firefox_microsummaries')) { exit; } $story = new NewsStory(); $restricted = news_getmoduleoption('restrictindex'); $sarray = array(); // Get the last news from all topics according to the module's restrictions $sarray = $story->getAllPublished(1, 0, $restricted, 0); if (count($sarray) > 0) { $laststory = null; $laststory = $sarray[0]; if (is_object($laststory)) { header('Content-Type:text;'); echo $laststory->title() . ' - ' . $xoopsConfig['sitename']; } }
$xoopsOption['template_main'] = 'news_by_topic.html'; include_once XOOPS_ROOT_PATH . '/header.php'; $xoopsTpl->assign('columnwidth', intval(1 / $column_count * 100)); if ($xoopsModuleConfig['ratenews']) { $xoopsTpl->assign('rates', true); $xoopsTpl->assign('lang_ratingc', _NW_RATINGC); $xoopsTpl->assign('lang_ratethisnews', _NW_RATETHISNEWS); } else { $xoopsTpl->assign('rates', false); } $xt = new NewsTopic(); $alltopics =& $xt->getTopicsList(true, $xoopsModuleConfig['restrictindex']); $smarty_topics = array(); $topicstories = array(); foreach ($alltopics as $topicid => $topic) { $allstories = NewsStory::getAllPublished($xoopsModuleConfig['storyhome'], 0, $xoopsModuleConfig['restrictindex'], $topicid); foreach ($allstories as $thisstory) { $topicstories[$topicid][] = $thisstory->prepare2show($sfiles); } if (isset($topicstories[$topicid])) { $smarty_topics[$topicstories[$topicid][0]['posttimestamp']] = array('title' => $topic['title'], 'stories' => $topicstories[$topicid], 'id' => $topicid, 'topic_color' => $topic['color']); } } krsort($smarty_topics); $columns = array(); $i = 0; foreach ($smarty_topics as $thistopictimestamp => $thistopic) { $columns[$i][] = $thistopic; $i++; if ($i == $column_count) { $i = 0;
$topic_select = ob_get_contents(); ob_end_clean(); $xoopsTpl->assign('topic_select', $topic_select); $storynum_options = ''; for ($i = 5; $i <= 30; $i = $i + 5) { $sel = ''; if ($i == $xoopsOption['storynum']) { $sel = ' selected="selected"'; } $storynum_options .= '<option value="' . $i . '"' . $sel . '>' . $i . '</option>'; } $xoopsTpl->assign('storynum_options', $storynum_options); } else { $xoopsTpl->assign('displaynav', false); } $sarray = NewsStory::getAllPublished($xoopsOption['storynum'], $start, $xoopsOption['storytopic']); $scount = count($sarray); for ($i = 0; $i < $scount; $i++) { $story = array(); $story['id'] = $sarray[$i]->storyid(); $story['poster'] = $sarray[$i]->uname(); if ($story['poster'] != false) { $story['poster'] = "<a href='" . XOOPS_URL . "/userinfo.php?uid=" . $sarray[$i]->uid() . "'>" . $story['poster'] . "</a>"; } else { $story['poster'] = $xoopsConfig['anonymous']; } $story['posttime'] = formatTimestamp($sarray[$i]->published()); $story['text'] = $sarray[$i]->hometext(); $introcount = strlen($story['text']); $fullcount = strlen($sarray[$i]->bodytext()); $totalcount = $introcount + $fullcount;
/** * Shows last x published stories * * This list can be view in the module's admin when you click on the tab named "Post/Edit News" * Actually you can see the the story's ID, its title, the topic, the author, the number of hits * and two links. The first link is used to edit the story while the second is used to remove the story. * The table only contains the last X published stories. * You can modify the number of visible stories with the module's option named * "Number of new articles to display in admin area". * As the number of displayed stories is limited, below this list you can find a text box * that you can use to enter a story's Id, then with the scrolling list you can select * if you want to edit or delete the story. */ function lastStories() { global $xoopsModule, $xoopsModuleConfig, $dateformat; news_collapsableBar('laststories', 'toplaststories'); echo "<img onclick='toggle('toptable'); toggleIcon('toptableicon');' id='toplaststories' name='toplaststories' src=" . XOOPS_URL . "/modules/news/images/close12.gif alt='' /></a> " . sprintf(_AM_LAST10ARTS, $xoopsModuleConfig['storycountadmin']) . "</h4>"; echo "<div id='laststories'>"; echo "<br />"; echo "<div style='text-align: center;'>"; $start = isset($_GET['start']) ? intval($_GET['start']) : 0; $storyarray = NewsStory::getAllPublished($xoopsModuleConfig['storycountadmin'], $start, false, 0, 1); $storiescount = NewsStory::getAllPublishedCount($xoopsModuleConfig['storycountadmin'], 0, false, 0, 1); $pagenav = new XoopsPageNav($storiescount, $xoopsModuleConfig['storycountadmin'], $start, 'start', 'op=newarticle'); $class = ''; echo "<table width='100%' cellspacing='1' cellpadding='3' border='0' class='outer'><tr class='bg3'><td align='center'>" . _AM_STORYID . "</td><td align='center'>" . _AM_TITLE . "</td><td align='center'>" . _AM_TOPIC . "</td><td align='center'>" . _AM_POSTER . "</td><td align='center' class='nw'>" . _AM_PUBLISHED . "</td><td align='center' class='nw'>" . _AM_HITS . "</td><td align='center'>" . _AM_ACTION . "</td></tr>"; foreach ($storyarray as $eachstory) { $published = formatTimestamp($eachstory->published(), $dateformat); // $expired = ( $eachstory -> expired() > 0 ) ? formatTimestamp($eachstory->expired(),$dateformat) : '---'; $topic = $eachstory->topic(); $class = $class == 'even' ? 'odd' : 'even'; echo "<tr class='" . $class . "'>"; echo "<td align='center'><b>" . $eachstory->storyid() . "</b>\n \t</td><td align='left'><a href='" . XOOPS_URL . "/modules/news/article.php?storyid=" . $eachstory->storyid() . "'>" . $eachstory->title() . "</a>\n \t</td><td align='center'>" . $topic->topic_title() . "\n \t</td><td align='center'><a href='" . XOOPS_URL . "/userinfo.php?uid=" . $eachstory->uid() . "'>" . $eachstory->uname() . "</a></td><td align='center' class='nw'>" . $published . "</td><td align='center'>" . $eachstory->counter() . "</td><td align='center'><a href='" . XOOPS_URL . "/modules/news/submit.php?returnside=1&op=edit&storyid=" . $eachstory->storyid() . "'>" . _AM_EDIT . "</a>-<a href='" . XOOPS_URL . "/modules/news/admin/index.php?op=delete&storyid=" . $eachstory->storyid() . "'>" . _AM_DELETE . "</a>"; echo "</td></tr>\n"; } echo "</table><br />"; echo "<div align='right'>" . $pagenav->renderNav() . '</div><br />'; echo "<form action='index.php' method='post'>" . _AM_STORYID . " <input type='text' name='storyid' size='10' />\n \t<select name='op'>\n \t\t<option value='edit' selected='selected'>" . _AM_EDIT . "</option>\n \t\t<option value='delete'>" . _AM_DELETE . "</option>\n \t</select>\n\t\t<input type='hidden' name='returnside' value='1'>\n \t<input type='submit' value='" . _AM_GO . "' />\n \t</form>\n\t</div>"; echo "</div><br />"; }
* * When you are viewing an article, you can see a summary table containing * the first n links to the last published news. * This summary table is visible according to a module's option (showsummarytable) * The number of items is equal to the module's option "storyhome" ("Select the number * of news items to display on top page") * We also use the module's option "restrictindex" ("Restrict Topics on Index Page"), like * this you (the webmaster) select if users can see restricted stories or not. */ if (news_getmoduleoption('showsummarytable')) { $xoopsTpl->assign('showsummary', true); $xoopsTpl->assign('lang_other_story', _NW_OTHER_ARTICLES); $count = 0; $tmparticle = new NewsStory(); $infotips = news_getmoduleoption('infotips'); $sarray = $tmparticle->getAllPublished($cfg['article_summary_items_count'], 0, $xoopsModuleConfig['restrictindex']); if (count($sarray) > 0) { foreach ($sarray as $onearticle) { $count++; $htmltitle = ''; $tooltips = ''; $htmltitle = ''; if ($infotips > 0) { $tooltips = news_make_infotips($onearticle->hometext()); $htmltitle = ' title="' . $tooltips . '"'; } $xoopsTpl->append('summary', array('story_id' => $onearticle->storyid(), 'htmltitle' => $htmltitle, 'infotips' => $tooltips, 'story_title' => $onearticle->title(), 'story_hits' => $onearticle->counter(), 'story_published' => formatTimestamp($onearticle->published, $dateformat))); } } $xoopsTpl->assign('summary_count', $count); unset($tmparticle);
function lastStories() { global $xoopsDB, $xoopsConfig, $xoopsModule; echo "<table width='100%' border='0' cellspacing='1' class='outer'><tr><td class=\"odd\">"; echo "<div style='text-align: center;'><b>" . _AM_LAST10ARTS . "</b><br />"; $storyarray = NewsStory::getAllPublished(10, 0, 0, 1); echo "<table border='1' width='100%'><tr class='bg3'><td align='center'>" . _AM_STORYID . "</td><td align='center'>" . _AM_TITLE . "</td><td align='center'>" . _AM_TOPIC . "</td><td align='center'>" . _AM_POSTER . "</td><td align='center' class='nw'>" . _AM_PUBLISHED . "</td><td align='center' class='nw'>" . _AM_EXPIRED . "</td><td align='center'>" . _AM_ACTION . "</td></tr>"; foreach ($storyarray as $eachstory) { $published = formatTimestamp($eachstory->published()); $expired = $eachstory->expired() > 0 ? formatTimestamp($eachstory->expired()) : '---'; $topic = $eachstory->topic(); echo "\n <tr><td align='center'><b>" . $eachstory->storyid() . "</b>\n </td><td align='left'>" . RENDER_NEWS_TITLE($eachstory) . "</td><td align='center'>" . $topic->topic_title() . "\n </td><td align='center'><a href='" . XOOPS_URL . "/userinfo.php?uid=" . $eachstory->uid() . "'>" . $eachstory->uname() . "</a></td><td align='center' class='nw'>" . $published . "</td><td align='center'>" . $expired . "</td><td align='center'><a href='index.php?op=edit&storyid=" . $eachstory->storyid() . "'>" . _AM_EDIT . "</a>-<a href='index.php?op=delete&storyid=" . $eachstory->storyid() . "'>" . _AM_DELETE . "</a>"; echo "</td></tr>\n"; } echo "</table><br />"; echo "<form action='index.php' method='post'>\n " . _AM_STORYID . " <input type='text' name='storyid' size='10' />\n <select name='op'>\n <option value='edit' selected='selected'>" . _AM_EDIT . "</option>\n <option value='delete'>" . _AM_DELETE . "</option>\n </select>\n <input type='submit' value='" . _AM_GO . "' />\n </form>\n </div>\n "; echo "</td></tr></table>"; }
* According to a module's option "showprevnextlink" ("Show Previous and Next link ?") * you can display, at the bottom of each article, two links used to navigate thru stories. * This feature uses the module's option "restrictindex" so that we can, or can't see * restricted stories */ if (getmoduleoption('showprevnextlink')) { $previous = -1; $next = -1; $lastread = -1; $warning = false; $previoustitle = ''; $nexttitle = ''; $lasttitle = ''; $xoopsTpl->assign('nav_links', true); $tmparticle = new NewsStory(); $sarray = $tmparticle->getAllPublished(0, 0, $xoopsModuleConfig['restrictindex'], 0, 0, false); if (is_array($sarray)) { while (list($storyid, $storytitle) = each($sarray)) { if ($warning) { $next = $storyid; $nexttitle = $storytitle; $warning = false; } if ($storyid == $article->storyid()) { if ($previous == -1) { $previous = $lastread; $previoustitle = $lasttitle; } $warning = true; } $lastread = $storyid;
/** * @todo make SmartyNewsRenderer class */ function getAnnouncements($topicid, $limit = 5, $start = 0) { global $xoopsUser, $xoopsConfig, $xoopsModule, $xoopsTpl; $module_handler = xoops_gethandler('module'); if (!($count =& $module_handler->getByDirname('news')) || $topicid == 0) { $xoopsTpl->assign('xhelp_useAnnouncements', false); return false; } include_once XOOPS_ROOT_PATH . '/modules/news/class/class.newsstory.php'; $news_version = round($count->getVar('version') / 100, 2); switch ($news_version) { case "1.1": $sarray = NewsStory::getAllPublished($limit, $start, $topicid); break; case "1.21": default: $sarray = NewsStory::getAllPublished($limit, $start, false, $topicid); } $scount = count($sarray); for ($i = 0; $i < $scount; $i++) { $story = array(); $story['id'] = $sarray[$i]->storyid(); $story['poster'] = $sarray[$i]->uname(); if ($story['poster'] != false) { $story['poster'] = "<a href='" . XOOPS_URL . "/userinfo.php?uid=" . $sarray[$i]->uid() . "'>" . $story['poster'] . "</a>"; } else { $story['poster'] = $xoopsConfig['anonymous']; } $story['posttime'] = formatTimestamp($sarray[$i]->published()); $story['text'] = $sarray[$i]->hometext(); $introcount = strlen($story['text']); $fullcount = strlen($sarray[$i]->bodytext()); $totalcount = $introcount + $fullcount; $morelink = ''; if ($fullcount > 1) { $morelink .= '<a href="' . XOOPS_URL . '/modules/news/article.php?storyid=' . $sarray[$i]->storyid() . ''; $morelink .= '">' . _XHELP_ANNOUNCE_READMORE . '</a> | '; //$morelink .= sprintf(_NW_BYTESMORE,$totalcount); //$morelink .= ' | '; } $ccount = $sarray[$i]->comments(); $morelink .= '<a href="' . XOOPS_URL . '/modules/news/article.php?storyid=' . $sarray[$i]->storyid() . ''; $morelink2 = '<a href="' . XOOPS_URL . '/modules/news/article.php?storyid=' . $sarray[$i]->storyid() . ''; if ($ccount == 0) { $morelink .= '">' . _XHELP_COMMMENTS . '</a>'; } else { if ($fullcount < 1) { if ($ccount == 1) { $morelink .= '">' . _XHELP_ANNOUNCE_READMORE . '</a> | ' . $morelink2 . '">' . _XHELP_ANNOUNCE_ONECOMMENT . '</a>'; } else { $morelink .= '">' . _XHELP_ANNOUNCE_READMORE . '</a> | ' . $morelink2 . '">'; $morelink .= sprintf(_XHELP_ANNOUNCE_NUMCOMMENTS, $ccount); $morelink .= '</a>'; } } else { if ($ccount == 1) { $morelink .= '">' . _XHELP_ANNOUNCE_ONECOMMENT . '</a>'; } else { $morelink .= '">'; $morelink .= sprintf(_XHELP_ANNOUNCE_NUMCOMMENTS, $ccount); $morelink .= '</a>'; } } } $story['morelink'] = $morelink; $story['adminlink'] = ''; if ($xoopsUser && $xoopsUser->isAdmin($xoopsModule->mid())) { $story['adminlink'] = $sarray[$i]->adminlink(); } //$story['mail_link'] = 'mailto:?subject='.sprintf(_NW_INTARTICLE,$xoopsConfig['sitename']).'&body='.sprintf(_NW_INTARTFOUND, $xoopsConfig['sitename']).': '.XOOPS_URL.'/modules/news/article.php?storyid='.$sarray[$i]->storyid(); $story['imglink'] = ''; $story['align'] = ''; if ($sarray[$i]->topicdisplay()) { $story['imglink'] = $sarray[$i]->imglink(); $story['align'] = $sarray[$i]->topicalign(); } $story['title'] = $sarray[$i]->textlink() . ' : ' . "<a href='" . XOOPS_URL . "/modules/news/article.php?storyid=" . $sarray[$i]->storyid() . "'>" . $sarray[$i]->title() . "</a>"; $story['hits'] = $sarray[$i]->counter(); // The line below can be used to display a Permanent Link image // $story['title'] .= " <a href='".XOOPS_URL."/modules/news/article.php?storyid=".$sarray[$i]->storyid()."'><img src='".XOOPS_URL."/modules/news/images/x.gif' alt='Permanent Link' /></a>"; $xoopsTpl->append('xhelp_announcements', $story); $xoopsTpl->assign('xhelp_useAnnouncements', true); unset($story); } }