function nw_tag_iteminfo(&$items) { if(empty($items) || !is_array($items)){ return false; } $items_id = array(); foreach(array_keys($items) as $cat_id){ foreach(array_keys($items[$cat_id]) as $item_id){ $items_id[] = intval($item_id); } } require_once NW_MODULE_PATH . '/class/class.newsstory.php'; $tempnw = new nw_NewsStory(); $items_obj = $tempnw->getStoriesByIds($items_id); foreach(array_keys($items) as $cat_id){ foreach(array_keys($items[$cat_id]) as $item_id) { if(isset($items_obj[$item_id])) { $item_obj =& $items_obj[$item_id]; $items[$cat_id][$item_id] = array( 'title' => $item_obj->title(), 'uid' => $item_obj->uid(), 'link' => "article.php?storyid={$item_id}", 'time' => $item_obj->published(), 'tags' => '', // tag_parse_tag($item_obj->getVar("item_tags", "n")), // optional 'content' => '', ); } } } unset($items_obj); }
function nw_com_update($story_id, $total_num){ $story_id = intval($story_id); $total_num = intval($total_num); $article = new nw_NewsStory($story_id); if (!$article->updateComments($total_num)) { return false; } return true; }
function nw_b_news_bigstory_show() { include_once NW_MODULE_PATH . '/include/functions.php'; include_once NW_MODULE_PATH . '/class/class.newsstory.php'; $myts =& MyTextSanitizer::getInstance(); $restricted=nw_getmoduleoption('restrictindex', NW_MODULE_DIR_NAME); $dateformat=nw_getmoduleoption('dateformat', NW_MODULE_DIR_NAME); $infotips=nw_getmoduleoption('infotips', NW_MODULE_DIR_NAME); $block = array(); $onestory = new nw_NewsStory(); $stories = $onestory->getBigStory(1,0,$restricted,0,1, true, 'counter'); if(count($stories)==0) { $block['message'] = _MB_NW_NOTYET; } else { foreach ( $stories as $key => $story ) { $htmltitle=''; if($infotips>0) { $block['infotips'] = nw_make_infotips($story->hometext()); $htmltitle=' title="'.$block['infotips'].'"'; } //DNPROSSI ADDED $block['newsmodule_url']= NW_MODULE_URL; $block['htmltitle']=$htmltitle; $block['message'] = _MB_NW_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); } } // DNPROSSI SEO $seo_enabled = nw_getmoduleoption('nw_seo_enable', NW_MODULE_DIR_NAME); if ( $seo_enabled == 1 ) { $block['urlrewrite']= "true"; } else { $block['urlrewrite']= "false"; } return $block; }
/** * Dispay a block where news moderators can show news that need to be moderated. */ function nw_b_news_topics_moderate() { include_once NW_MODULE_PATH . '/class/class.newsstory.php'; include_once NW_MODULE_PATH . '/include/functions.php'; $block = array(); $dateformat=nw_getmoduleoption('dateformat', NW_MODULE_DIR_NAME); $infotips=nw_getmoduleoption('infotips', NW_MODULE_DIR_NAME); $storyarray = nw_NewsStory :: getAllSubmitted(0, true, nw_getmoduleoption('restrictindex', NW_MODULE_DIR_NAME)); if ( count( $storyarray ) > 0 ) { $block['lang_story_title'] = _MB_NW_TITLE; $block['lang_story_date'] = _MB_NW_POSTED; $block['lang_story_author'] =_MB_NW_POSTER; $block['lang_story_action'] =_MB_NW_ACTION; $block['lang_story_topic'] =_MB_NW_TOPIC; $myts =& MyTextSanitizer::getInstance(); foreach( $storyarray as $newstory ) { $title = $newstory -> title(); $htmltitle=''; if($infotips>0) { $story['infotips'] = nw_make_infotips($newstory->hometext()); $htmltitle=' title="'.$story['infotips'].'"'; } if (!isset( $title ) || ($title == '')) { $linktitle = "<a href='" . NW_MODULE_URL . "/index.php?op=edit&storyid=" . $newstory->storyid() . "' target='_blank'".$htmltitle.">" . _AD_NOSUBJECT . "</a>"; } else { $linktitle = "<a href='" . NW_MODULE_URL . "/submit.php?op=edit&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='" . NW_MODULE_URL . "/admin/index.php?op=edit&storyid=" . $newstory->storyid() . "'>" . _EDIT. "</a> - <a href='" . NW_MODULE_URL . "/admin/index.php?op=delete&storyid=" . $newstory->storyid() . "'>" . _MB_NW_DELETE . "</a>"; $story['topic_title'] = $newstory->topic_title(); $story['topic_color']= '#'.$myts->displayTarea($newstory->topic_color); $block['stories'][] =& $story; unset($story); } } return $block; }
/** * Statistics about stories, topics and authors * * You can reach the statistics from the admin part of the news module by clicking on the "Statistics" tabs * The number of visible elements in each table is equal to the module's option called "storycountadmin" * There are 3 kind of different statistics : * - Topics statistics * For each topic you can see its number of articles, the number of time each topics was viewed, the number * of attached files, the number of expired articles and the number of unique authors. * - Articles statistics * This part is decomposed in 3 tables : * a) Most readed articles * This table resumes, for all the news in your database, the most readed articles. * The table contains, for each news, its topic, its title, the author and the number of views. * b) Less readed articles * That's the opposite action of the previous table and its content is the same * c) Best rated articles * You will find here the best rated articles, the content is the same that the previous tables, the last column is just changing and contains the article's rating * - Authors statistics * This part is also decomposed in 3 tables * a) Most readed authors * To create this table, the program compute the total number of reads per author and displays the most readed author and the number of views * b) Best rated authors * To created this table's content, the program compute the rating's average of each author and create a table * c) Biggest contributors * The goal of this table is to know who is creating the biggest number of articles. */ function Stats() { global $xoopsModule, $xoopsConfig; xoops_cp_header(); $myts =& MyTextSanitizer::getInstance(); if (file_exists(NW_MODULE_PATH . '/language/'.$xoopsConfig['language'].'/main.php')) { include_once NW_MODULE_PATH . '/language/'.$xoopsConfig['language'].'/main.php'; } else { include_once NW_MODULE_PATH . '/language/english/main.php'; } adminmenu(6); $news = new nw_NewsStory(); $stats = array(); $stats=$news->GetStats(nw_getmoduleoption('storycountadmin', NW_MODULE_DIR_NAME)); $totals=array(0,0,0,0,0); printf("<h1>%s</h1>\n",_AM_NW_STATS); // First part of the stats, everything about topics $storiespertopic=$stats['storiespertopic']; $readspertopic=$stats['readspertopic']; $filespertopic=$stats['filespertopic']; $expiredpertopic=$stats['expiredpertopic']; $authorspertopic=$stats['authorspertopic']; $class=''; echo "<div style='text-align: center;'><b>" . _AM_NW_STATS0 . "</b><br />\n"; echo "<table border='0' width='100%'><tr class='bg3'><td align='center'>"._AM_NW_TOPIC."</td><td align='center'>" . _MA_NW_ARTICLES . "</td><td>" . _MA_NW_VIEWS . "</td><td>" . _AM_NW_UPLOAD_ATTACHFILE . "</td><td>" . _AM_NW_EXPARTS ."</td><td>" ._AM_NW_STATS1 ."</td></tr>"; foreach ( $storiespertopic as $topicid => $data ) { $url=NW_MODULE_URL . '/index.php?storytopic=' . $topicid; $views=0; if(array_key_exists($topicid,$readspertopic)) { $views=$readspertopic[$topicid]; } $attachedfiles=0; if(array_key_exists($topicid,$filespertopic)) { $attachedfiles=$filespertopic[$topicid]; } $expired=0; if(array_key_exists($topicid,$expiredpertopic)) { $expired=$expiredpertopic[$topicid]; } $authors=0; if(array_key_exists($topicid,$authorspertopic)) { $authors=$authorspertopic[$topicid]; } $articles=$data['cpt']; $totals[0]+=$articles; $totals[1]+=$views; $totals[2]+=$attachedfiles; $totals[3]+=$expired; $class = ($class == 'even') ? 'odd' : 'even'; printf("<tr class='".$class."'><td align='left'><a href='%s' target ='_blank'>%s</a></td><td align='right'>%u</td><td align='right'>%u</td><td align='right'>%u</td><td align='right'>%u</td><td align='right'>%u</td></tr>\n",$url,$myts->displayTarea($data['topic_title']),$articles,$views,$attachedfiles,$expired,$authors); } $class = ($class == 'even') ? 'odd' : 'even'; printf("<tr class='".$class."'><td align='center'><b>%s</b></td><td align='right'><b>%u</b></td><td align='right'><b>%u</b></td><td align='right'><b>%u</b></td><td align='right'><b>%u</b></td><td> </td>\n",_AM_NW_STATS2,$totals[0],$totals[1],$totals[2],$totals[3]); echo '</table></div><br /><br /><br />'; // Second part of the stats, everything about stories // a) Most readed articles $mostreadnews=$stats['mostreadnews']; echo "<div style='text-align: center;'><b>" . _AM_NW_STATS3 . '</b><br /><br />' . _AM_NW_STATS4 . "<br />\n"; echo "<table border='0' width='100%'><tr class='bg3'><td align='center'>"._AM_NW_TOPIC."</td><td align='center'>" . _AM_NW_TITLE . "</td><td>" . _AM_NW_POSTER . "</td><td>" . _MA_NW_VIEWS . "</td></tr>\n"; foreach ( $mostreadnews as $storyid => $data ) { $url1=NW_MODULE_URL . '/index.php?storytopic=' . $data['topicid']; $url2=NW_MODULE_URL . '/article.php?storyid=' . $storyid; $url3=XOOPS_URL . '/userinfo.php?uid=' . $data['uid']; $class = ($class == 'even') ? 'odd' : 'even'; printf("<tr class='".$class."'><td align='left'><a href='%s' target ='_blank'>%s</a></td><td align='left'><a href='%s' target='_blank'>%s</a></td><td><a href='%s' target='_blank'>%s</a></td><td align='right'>%u</td></tr>\n",$url1,$myts->displayTarea($data['topic_title']),$url2,$myts->displayTarea($data['title']),$url3,$myts->htmlSpecialChars($news->uname($data['uid'])),$data['counter']); } echo '</table>'; // b) Less readed articles $lessreadnews=$stats['lessreadnews']; echo '<br /><br />'._AM_NW_STATS5; echo "<table border='0' width='100%'><tr class='bg3'><td align='center'>"._AM_NW_TOPIC."</td><td align='center'>" . _AM_NW_TITLE . "</td><td>" . _AM_NW_POSTER . "</td><td>" . _MA_NW_VIEWS . "</td></tr>\n"; foreach ( $lessreadnews as $storyid => $data ) { $url1=NW_MODULE_URL . '/index.php?storytopic=' . $data['topicid']; $url2=NW_MODULE_URL . '/article.php?storyid=' . $storyid; $url3=XOOPS_URL . '/userinfo.php?uid=' . $data['uid']; $class = ($class == 'even') ? 'odd' : 'even'; printf("<tr class='".$class."'><td align='left'><a href='%s' target ='_blank'>%s</a></td><td align='left'><a href='%s' target='_blank'>%s</a></td><td><a href='%s' target='_blank'>%s</a></td><td align='right'>%u</td></tr>\n",$url1,$myts->displayTarea($data['topic_title']),$url2,$myts->displayTarea($data['title']),$url3,$myts->htmlSpecialChars($news->uname($data['uid'])),$data['counter']); } echo '</table>'; // c) Best rated articles (this is an average) $bestratednews=$stats['besratednw']; echo '<br /><br />'._AM_NW_STATS6; echo "<table border='0' width='100%'><tr class='bg3'><td align='center'>"._AM_NW_TOPIC."</td><td align='center'>" . _AM_NW_TITLE . "</td><td>" . _AM_NW_POSTER . "</td><td>" . _MA_NW_RATING . "</td></tr>\n"; foreach ( $bestratednews as $storyid => $data ) { $url1=NW_MODULE_URL . '/index.php?storytopic=' . $data['topicid']; $url2=NW_MODULE_URL . '/article.php?storyid=' . $storyid; $url3=XOOPS_URL . '/userinfo.php?uid=' . $data['uid']; $class = ($class == 'even') ? 'odd' : 'even'; printf("<tr class='".$class."'><td align='left'><a href='%s' target ='_blank'>%s</a></td><td align='left'><a href='%s' target='_blank'>%s</a></td><td><a href='%s' target='_blank'>%s</a></td><td align='right'>%s</td></tr>\n",$url1,$myts->displayTarea($data['topic_title']),$url2,$myts->displayTarea($data['title']),$url3,$myts->htmlSpecialChars($news->uname($data['uid'])),number_format($data['rating'], 2)); } echo '</table></div><br /><br /><br />'; // Last part of the stats, everything about authors // a) Most readed authors $mostreadedauthors=$stats['mostreadedauthors']; echo "<div style='text-align: center;'><b>" . _AM_NW_STATS10 . '</b><br /><br />' . _AM_NW_STATS7 . "<br />\n"; echo "<table border='0' width='100%'><tr class='bg3'><td>"._AM_NW_POSTER.'</td><td>' . _MA_NW_VIEWS . "</td></tr>\n"; foreach ( $mostreadedauthors as $uid => $reads) { $url=XOOPS_URL . '/userinfo.php?uid=' . $uid; $class = ($class == 'even') ? 'odd' : 'even'; printf("<tr class='".$class."'><td align='left'><a href='%s' target ='_blank'>%s</a></td><td align='right'>%u</td></tr>\n",$url,$myts->htmlSpecialChars($news->uname($uid)),$reads); } echo '</table>'; // b) Best rated authors $bestratedauthors=$stats['bestratedauthors']; echo '<br /><br />'._AM_NW_STATS8; echo "<table border='0' width='100%'><tr class='bg3'><td>"._AM_NW_POSTER."</td><td>" . _MA_NW_RATING . "</td></tr>\n"; foreach ( $bestratedauthors as $uid => $rating) { $url=XOOPS_URL . '/userinfo.php?uid=' . $uid; $class = ($class == 'even') ? 'odd' : 'even'; printf("<tr class='".$class."'><td align='left'><a href='%s' target ='_blank'>%s</a></td><td align='right'>%u</td></tr>\n",$url,$myts->htmlSpecialChars($news->uname($uid)),$rating); } echo '</table>'; // c) Biggest contributors $biggestcontributors=$stats['biggestcontributors']; echo '<br /><br />'._AM_NW_STATS9; echo "<table border='0' width='100%'><tr class='bg3'><td>"._AM_NW_POSTER."</td><td>" . _AM_NW_STATS11 . "</td></tr>\n"; foreach ( $biggestcontributors as $uid => $count) { $url=XOOPS_URL . '/userinfo.php?uid=' . $uid; $class = ($class == 'even') ? 'odd' : 'even'; printf("<tr class='".$class."'><td align='left'><a href='%s' target ='_blank'>%s</a></td><td align='right'>%u</td></tr>\n",$url,$myts->htmlSpecialChars($news->uname($uid)),$count); } echo '</table></div><br />'; }
error_reporting(0); include_once 'header.php'; $myts =& MyTextSanitizer::getInstance(); include_once NW_MODULE_PATH . '/class/class.newsstory.php'; include_once NW_MODULE_PATH . '/include/functions.php'; // Verifications on the article $storyid = isset($_GET['storyid']) ? intval($_GET['storyid']) : 0; if (empty($storyid)) { redirect_header(NW_MODULE_URL . '/index.php',2,_MA_NW_NOSTORY); exit(); } $article = new nw_NewsStory($storyid); // Not yet published if ( $article->published() == 0 || $article->published() > time() ) { redirect_header(NW_MODULE_URL . '/index.php', 2, _MA_NW_NOSTORY); exit(); } // Expired if ( $article->expired() != 0 && $article->expired() < time() ) { redirect_header(NW_MODULE_URL . '/index.php', 2, _MA_NW_NOSTORY); exit(); } $gperm_handler =& xoops_gethandler('groupperm'); if (is_object($xoopsUser)) { $groups = $xoopsUser->getGroups();
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 nw_NewsStory($storyid); if ( $article->published() == 0 || $article->published() > time() ) { redirect_header(NW_MODULE_URL . '/index.php', 2, _MA_NW_NOSTORY); exit(); } // Expired if ( $article->expired() != 0 && $article->expired() < time() ) { redirect_header(NW_MODULE_URL . '/index.php', 2, _MA_NW_NOSTORY); exit(); } } else { redirect_header(NW_MODULE_URL . '/index.php', 2, _MA_NW_NOSTORY); exit(); }
function nw_Latestnewsstory($id=-1){ parent::nw_NewsStory($id); }
$topicid = isset($_GET['topicid']) ? intval($_GET['topicid']) : 0; if($topicid == 0) { exit(); } if (function_exists('mb_http_output')) { mb_http_output('pass'); } $restricted = nw_getmoduleoption('restrictindex', NW_MODULE_DIR_NAME); $newsnumber = nw_getmoduleoption('storyhome', NW_MODULE_DIR_NAME); $charset = 'utf-8'; header ('Content-Type:text/xml; charset='.$charset); $story = new nw_NewsStory(); $tpl = new XoopsTpl(); $tpl->xoops_setCaching(2); $tpl->xoops_setCacheTime(3600); // Change this to the value you want if (!$tpl->is_cached('db:nw_news_rss.html', $topicid)) { $xt = new nw_NewsTopic($topicid); $sarray = $story->getAllPublished($newsnumber, 0, $restricted, $topicid); if (is_array($sarray) && count($sarray)>0) { $sitename = htmlspecialchars($xoopsConfig['sitename'], ENT_QUOTES); $slogan = htmlspecialchars($xoopsConfig['slogan'], ENT_QUOTES); $tpl->assign('channel_title', xoops_utf8_encode($sitename)); $tpl->assign('channel_link', XOOPS_URL.'/'); $tpl->assign('channel_desc', xoops_utf8_encode($slogan)); $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
include_once NW_MODULE_PATH . '/include/functions.php'; include_once NW_MODULE_PATH . '/class/class.newstopic.php'; include_once NW_MODULE_PATH . '/class/keyhighlighter.class.php'; include_once NW_MODULE_PATH . '/config.php'; $storyid = (isset($_GET['storyid'])) ? intval($_GET['storyid']) : 0; if (empty($storyid)) { redirect_header(NW_MODULE_URL . '/index.php',2,_MA_NW_NOSTORY); exit(); } $myts =& MyTextSanitizer::getInstance(); // Not yet published $article = new nw_NewsStory($storyid); if ( $article->published() == 0 || $article->published() > time() ) { redirect_header(NW_MODULE_URL . '/index.php', 2, _MA_NW_NOTYETSTORY); exit(); } // Expired if ( $article->expired() != 0 && $article->expired() < time() ) { redirect_header(NW_MODULE_URL . '/index.php', 2, _MA_NW_NOSTORY); exit(); } $gperm_handler =& xoops_gethandler('groupperm'); if (is_object($xoopsUser)) { $groups = $xoopsUser->getGroups(); } else { $groups = XOOPS_GROUP_ANONYMOUS;
$xoopsTpl->assign('column_width', intval(1/$column_count*100)); if ($xoopsModuleConfig['ratenews']) { $xoopsTpl->assign('rates', true); $xoopsTpl->assign('lang_ratingc', _MA_NW_RATINGC); $xoopsTpl->assign('lang_ratethisnews', _MA_NW_RATETHISNEWS); } else { $xoopsTpl->assign('rates', false); } $xt = new nw_NewsTopic(); $alltopics =& $xt->getTopicsList(true,$xoopsModuleConfig['restrictindex']); $smarty_topics = array(); $topicstories = array(); foreach ($alltopics as $topicid => $topic) { $allstories = nw_NewsStory::getAllPublished($xoopsModuleConfig['storyhome'], 0, $xoopsModuleConfig['restrictindex'], $topicid); $storieslist=array(); foreach ($allstories as $thisstory) { $storieslist[]=$thisstory->storyid(); } $filesperstory = $sfiles->getCountbyStories($storieslist); foreach ($allstories as $thisstory) { $filescount = array_key_exists($thisstory->storyid(),$filesperstory) ? $filesperstory[$thisstory->storyid()] : 0; $story = $thisstory->prepare2show($filescount); $story['topic_title'] = $thisstory->textlink(); $story['topic_separator'] = ( $thisstory->textlink() != '' ) ? _MA_NW_SP : ''; $story['news_title'] = $story['title']; $topicstories[$topicid][] = $story; } if(isset($topicstories[$topicid])) { $smarty_topics[$topicstories[$topicid][0]['posttimestamp']] = array('title' => $topic['title'], 'stories' => $topicstories[$topicid], 'id' => $topicid, 'topic_color'=>$topic['color']);
function nw_b_news_randomnews_show($options) { include_once NW_MODULE_PATH . '/include/functions.php'; $myts =& MyTextSanitizer::getInstance(); $block = array(); $block['sort']=$options[0]; $tmpstory = new nw_NewsStory; $restricted = nw_getmoduleoption('restrictindex', NW_MODULE_DIR_NAME); $dateformat = nw_getmoduleoption('dateformat', NW_MODULE_DIR_NAME); $infotips = nw_getmoduleoption('infotips', NW_MODULE_DIR_NAME); 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) { $html = $story->nohtml() == 1 ? 0 : 1; $news['teaser'] = nw_truncate_tagsafe($myts->displayTarea($story->hometext, $html), $options[3]+3); $news['infotips'] = ''; } else { $news['teaser'] = ''; if($infotips>0) { $news['infotips'] = ' title="'.nw_make_infotips($story->hometext()).'"'; } else { $news['infotips'] = ''; } } $block['stories'][] = $news; } //DNPROSSI ADDED $block['newsmodule_url']= NW_MODULE_URL; $block['lang_read_more']=_MB_NW_READMORE; // DNPROSSI SEO $seo_enabled = nw_getmoduleoption('nw_seo_enable', NW_MODULE_DIR_NAME); if ( $seo_enabled == 1 ) { $block['urlrewrite']= "true"; } else { $block['urlrewrite']= "false"; } return $block; }
$xoopsTpl->assign('show_articles', true); $xoopsTpl->assign('lang_articles', _MA_NW_ARTICLES); $xoopsTpl->assign('currentmonth', $months_arr[$frommonth]); $xoopsTpl->assign('currentyear', $fromyear); $xoopsTpl->assign('lang_actions', _MA_NW_ACTIONS); $xoopsTpl->assign('lang_date', _MA_NW_DATE); $xoopsTpl->assign('lang_views', _MA_NW_VIEWS); // must adjust the selected time to server timestamp $timeoffset = $useroffset - $xoopsConfig['server_TZ']; $monthstart = mktime(0 - $timeoffset, 0, 0, $frommonth, 1, $fromyear); $monthend = mktime(23 - $timeoffset, 59, 59, $frommonth + 1, 0, $fromyear); $monthend = ($monthend > time()) ? time() : $monthend; $count=0; $news = new nw_NewsStory(); $storyarray = $news->getArchive($monthstart, $monthend, $restricted); $count=count($storyarray); if(is_array($storyarray) && $count>0) { foreach ($storyarray as $article) { $story = array(); $htmltitle=''; if($infotips>0) { $story['infotips'] = nw_make_infotips($article->hometext()); $htmltitle=' title="'.$story['infotips'].'"'; } $seo_enabled = nw_getmoduleoption('nw_seo_enable', NW_MODULE_DIR_NAME); if ( $seo_enabled == 1 ) { $cat_path = nw_remove_accents($article->topic_title()); $item_path = nw_remove_accents($article->title()); $print_item = nw_remove_accents(_MA_NW_PRINTERFRIENDLY);
/** * Function used to edit the block */ function nw_b_news_top_edit($options) { global $xoopsDB; $tmpstory = new nw_NewsStory; $form = _MB_NW_ORDER." <select name='options[]'>"; $form .= "<option value='published'"; if ( $options[0] == 'published' ) { $form .= " selected='selected'"; } $form .= '>'._MB_NW_DATE."</option>\n"; $form .= "<option value='counter'"; if($options[0] == 'counter'){ $form .= " selected='selected'"; } $form .= '>'._MB_NW_HITS.'</option>'; $form .= "<option value='rating'"; if ( $options[0] == 'rating' ) { $form .= " selected='selected'"; } $form .= '>' . _MB_NW_RATE . '</option>'; $form .= "</select>\n"; $form .= ' '._MB_NW_DISP." <input type='text' name='options[]' value='".$options[1]."'/> "._MB_NW_ARTCLS; $form .= " <br /><br />"._MB_NW_CHARS." <input type='text' name='options[]' value='".$options[2]."'/> "._MB_NW_LENGTH.'<br /><br />'; $form .= _MB_NW_TEASER." <input type='text' name='options[]' value='".$options[3]."' />"._MB_NW_LENGTH; $form .= '<br /><br />'; $form .= _MB_NW_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_NW_WHAT_PUBLISH ." <select name='options[]'><option value='1'"; if ($options[5] == 1) { $form .= ' selected'; } $form .= ' />'._MB_NW_RECENT_NEWS; $form .= "</option><option value='0'"; if ($options[5] == 0) { $form .= ' selected'; } $form .= ' />'._MB_NW_RECENT_SPECIFIC.'</option></select>'; $form .= '<br /><br />'._MB_NW_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_NW_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_NW_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_NW_DISP." <select name='options[]'><option value='1' "; if($options[8]==1) { $form .= 'selected'; } $form .= '>'._MB_NW_VIEW_TYPE1."</option><option value='2' "; if($options[8]==2) { $form .= 'selected'; } $form .= '>'._MB_NW_VIEW_TYPE2.'</option></select><br /><br />'; $form .= "<table border=0>\n"; $form .= "<tr><td colspan='2' align='center'><u>"._MB_NW_DEFAULT_COLORS."</u></td></tr>"; $form .= "<tr><td>"._MB_NW_TAB_COLOR1 . "</td><td><input type='text' name='options[]' value='".$options[9]."' size=7></td></tr>"; $form .= "<tr><td>"._MB_NW_TAB_COLOR2 . "</td><td><input type='text' name='options[]' value='".$options[10]."' size=7></td></tr>"; $form .= "<tr><td>"._MB_NW_TAB_COLOR3 . "</td><td><input type='text' name='options[]' value='".$options[11]."' size=7></td></tr>"; $form .= "<tr><td>"._MB_NW_TAB_COLOR4 . "</td><td><input type='text' name='options[]' value='".$options[12]."' size=7></td></tr>"; $form .= "<tr><td>"._MB_NW_TAB_COLOR5 . "</td><td><input type='text' name='options[]' value='".$options[13]."' size=7></td></tr>"; $form .= "</table>\n"; $form .= '<br /><br />'._MB_NW_SPOTLIGHT_TOPIC."<br /><select name='options[]' multiple='multiple'>"; include_once NW_MODULE_PATH . '/class/class.newstopic.php'; $topics_arr=array(); include_once XOOPS_ROOT_PATH . '/class/xoopstree.php'; $xt = new XoopsTree($xoopsDB->prefix('nw_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; }
while ( $link = $db->fetchArray($result7) ) { if(trim($links)=='') { $links="\n\n"._AMS_MA_NW_RELATEDARTICLES."\n\n"; } $links .= _AMS_MA_NW_EXTERNALLINK.' [url='.$link['link_link'].']'.$link['link_title'].'[/url]'."\n"; } } // The forum $forum=''; if($use_forum && $one_amstopic['forum_id']!=0) { $forum = "\n\n".'[url='.XOOPS_URL.'/modules/newbb/viewforum.php?forum='.$one_amstopic['forum_id'].']'._AMS_AM_NW_LINKEDFORUM.'[/url]'."\n"; } // We create the story $news = new nw_NewsStory(); $news->setUid($text_lastversion['uid']); $news->setTitle($article['title']); $news->created=$article['created']; $news->setPublished($article['published']); $news->setExpired($article['expired']); $news->setHostname($article['hostname']); $news->setNohtml($article['nohtml']); $news->setNosmiley($article['nosmiley']); $news->setHometext($text_lastversion['hometext']); $news->setBodytext($text_lastversion['bodytext'].$links.$forum); $news->Setkeywords(''); $news->Setdescription(''); $news->counter=$article['counter']; $news->setTopicId($news_topicid); $news->setIhome($article['ihome']);
include_once 'header.php'; include_once NW_MODULE_PATH . '/class/class.newsstory.php'; include_once NW_MODULE_PATH . '/class/class.newstopic.php'; include_once NW_MODULE_PATH . '/class/class.sfiles.php'; include_once NW_MODULE_PATH . '/include/functions.php'; if(!nw_getmoduleoption('newsbythisauthor', NW_MODULE_DIR_NAME)) { redirect_header('index.php',2,_ERRORS); exit(); } $xoopsOption['template_main'] = 'nw_news_whos_who.html'; include_once XOOPS_ROOT_PATH.'/header.php'; $option = nw_getmoduleoption('displayname', NW_MODULE_DIR_NAME); $article = new nw_NewsStory(); $uid_ids = array(); $uid_ids = $article->getWhosWho(nw_getmoduleoption('restrictindex', NW_MODULE_DIR_NAME)); if(count($uid_ids) > 0) { $lst_uid = implode(',', $uid_ids); $member_handler =& xoops_gethandler('member'); $critere = new Criteria('uid', '('.$lst_uid.')', 'IN'); $tbl_users = $member_handler->getUsers($critere); foreach($tbl_users as $one_user) { $uname = ''; switch($option) { case 1: // Username $uname = $one_user->getVar('uname'); break; case 2: // Display full name (if it is not empty)
include_once NW_MODULE_PATH . '/language/english/modinfo.php'; } $uid= (isset($_GET['uid'])) ? intval($_GET['uid']) : 0; if (empty($uid)) { redirect_header('index.php',2,_ERRORS); exit(); } if(!nw_getmoduleoption('newsbythisauthor', NW_MODULE_DIR_NAME)) { redirect_header('index.php',2,_ERRORS); exit(); } $myts =& MyTextSanitizer::getInstance(); $articles = new nw_NewsStory(); $xoopsOption['template_main'] = 'nw_news_by_this_author.html'; include_once XOOPS_ROOT_PATH.'/header.php'; $dateformat=nw_getmoduleoption('dateformat', NW_MODULE_DIR_NAME); $infotips=nw_getmoduleoption('infotips', NW_MODULE_DIR_NAME); $thisuser = new XoopsUser($uid); switch($xoopsModuleConfig['displayname']) { case 1: // Username $authname=$thisuser->getVar('uname'); break; case 2: // Display full name (if it is not empty) if(xoops_trim($thisuser->getVar('name')) == '') { $authname=$thisuser->getVar('uname');
function nw_b_news_archives_edit($options) { global $xoopsDB; $syear = $smonth = $eyear = $emonth = $older = $recent = 0; $selsyear = $selsmonth = $seleyear = $selemonth = 0; $form = ''; $selsyear = $options[1]; $selsmonth = $options[2]; $seleyear = $options[3]; $selemonth = $options[4]; $tmpstory = new nw_NewsStory; $tmpstory->GetOlderRecentnews($older, $recent); // We are searching for the module's older and more recent article's date // Min and max value for the two dates selectors // We are going to use the older news for the starting date $syear = date('Y', $older); $smonth = date('n', $older); $eyear = date('Y', $recent); $emonth = date('n', $recent); // Verify parameters if($selsyear == 0 && $selsmonth == 0) { $selsyear = $syear; $selsmonth = $smonth; } if($seleyear == 0 && $selemonth == 0) { $seleyear = $eyear; $selemonth = $emonth; } // Sort order ************************************************************* // (0=older first, 1=newer first) $form .= '<b>'._MB_NW_ORDER."</b> <select name='options[]'>"; $form .= "<option value='0'"; if ( $options[0] == 0 ) { $form .= " selected='selected'"; } $form .= '>'._MB_NW_OLDER_FIRST."</option>\n"; $form .= "<option value='1'"; if($options[0] == 1){ $form .= " selected='selected'"; } $form .= '>'._MB_NW_RECENT_FIRST.'</option>'; $form .= "</select>\n"; // Starting and ending dates ********************************************** $form .= '<br /><br /><b>'._MB_NW_STARTING_DATE.'</b><br />'; $form .= _MB_NW_CAL_YEAR." <select name='options[]'>"; for($i=$syear; $i<=$eyear; $i++) { $selected = ($i == $selsyear) ? "selected='selected'" : ''; $form .= "<option value='".$i."'".$selected.'>'.$i.'</option>'; } $form .= '</select> '._MB_NW_CAL_MONTH." <select name='options[]'>"; for($i=1; $i<=12; $i++) { $selected = ($i == $selsmonth) ? "selected='selected'" : ''; $form .= "<option value='".$i."'".$selected.'>'.$i.'</option>'; } $form .= '</select>'; $form .= '<br /><br /><b>'._MB_NW_ENDING_DATE.'</b><br />'; $form .= _MB_NW_CAL_YEAR." <select name='options[]'>"; for($i=$syear; $i<=$eyear; $i++) { $selected = ($i == $seleyear) ? "selected='selected'" : ''; $form .= "<option value='".$i."'".$selected.'>'.$i.'</option>'; } $form .= '</select> '._MB_NW_CAL_MONTH." <select name='options[]'>"; for($i=1; $i<=12; $i++) { $selected = ($i == $selemonth) ? "selected='selected'" : ''; $form .= "<option value='".$i."'".$selected.'>'.$i.'</option>'; } $form .= '</select>'; // Or until today ********************************************************* $form .= '<br />'; $checked = $options[5] == 1 ? " checked='checked'" : ''; $form .= "<input type='checkbox' value='1' name='options[]'".$checked.'>'; $form .= ' <b>'._MB_NW_UNTIL_TODAY.'</b>'; return $form; }
* * @page_title Story's title - Printer Friendly Page - Topic's title - Site's name * * @template_name This page does not use any template * */ include_once 'header.php'; include_once NW_MODULE_PATH . '/class/class.newsstory.php'; include_once NW_MODULE_PATH . '/include/functions.php'; $storyid = isset($_GET['storyid']) ? intval($_GET['storyid']) : 0; if ( empty($storyid) ) { redirect_header(NW_MODULE_URL . '/index.php',2,_MA_NW_NOSTORY); } // Verify that the article is published $story = new nw_NewsStory($storyid); // Not yet published if ( $story->published() == 0 || $story->published() > time() ) { redirect_header(NW_MODULE_URL . '/index.php', 2, _MA_NW_NOSTORY); exit(); } // Expired if ( $story->expired() != 0 && $story->expired() < time() ) { redirect_header(NW_MODULE_URL . '/index.php', 2, _MA_NW_NOSTORY); exit(); } // Verify permissions $gperm_handler =& xoops_gethandler('groupperm');
if(isset($_GET['storyid'])) { $storyid=intval($_GET['storyid']); } else { if(isset($_POST['storyid'])) { $storyid=intval($_POST['storyid']); } else { $storyid=0; } } if (empty($storyid)) { $story = new nw_NewsStory(); $editmode = false; } else { $story = new nw_NewsStory($storyid); $editmode = true; } $story->setUid($uid); $story->setTitle($_POST['title']); $story->setHometext($_POST['hometext']); $story->setTopicId(intval($_POST['topic_id'])); $story->setHostname(xoops_getenv('REMOTE_ADDR')); $story->setNohtml($nohtml_db); $nosmiley = isset($_POST['nosmiley']) ? intval($_POST['nosmiley']) : 0; $story->setNosmiley($nosmiley); $notifypub = isset($_POST['notifypub']) ? intval($_POST['notifypub']) : 0; $story->setNotifyPub($notifypub); $story->setType($_POST['type']); if (!empty( $_POST['autodate'] ) && $approveprivilege) {
// We verify that the user can post comments ********************************** if(!isset($xoopsModuleConfig)) { die(); } if($xoopsModuleConfig['com_rule'] == 0) { // Comments are deactivate die(); } if($xoopsModuleConfig['com_anonpost'] == 0 && !is_object($xoopsUser)) { // Anonymous users can't post die(); } // **************************************************************************** $com_itemid = isset($_GET['com_itemid']) ? intval($_GET['com_itemid']) : 0; if ($com_itemid > 0) { $article = new nw_NewsStory($com_itemid); if($article->storyid>0) { $com_replytext = _POSTEDBY.' <b>'.$article->uname().'</b> '._DATE.' <b>'.formatTimestamp($article->published(),nw_getmoduleoption('dateformat', NW_MODULE_DIR_NAME)).'</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'; } else { exit; } } ?>
* 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 'header.php'; include_once NW_MODULE_PATH . '/class/class.newsstory.php'; include_once NW_MODULE_PATH . '/include/functions.php'; if(!nw_getmoduleoption('firefox_microsummaries', NW_MODULE_DIR_NAME)) { exit(); } $story = new nw_NewsStory(); $restricted = nw_getmoduleoption('restrictindex', NW_MODULE_DIR_NAME); $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']; } } ?>