function nw_b_news_topicsnav_show($options) { include_once NW_MODULE_PATH . '/include/functions.php'; include_once NW_MODULE_PATH . '/class/class.newstopic.php'; $myts =& MyTextSanitizer::getInstance(); $block = array(); $newscountbytopic=array(); $perms=''; $xt = new nw_NewsTopic(); $restricted=nw_getmoduleoption('restrictindex', NW_MODULE_DIR_NAME); if ($restricted) { global $xoopsUser; $module_handler =& xoops_gethandler('module'); $newsModule =& $module_handler->getByDirname(NW_MODULE_DIR_NAME); $groups = is_object($xoopsUser) ? $xoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS; $gperm_handler =& xoops_gethandler('groupperm'); $topics = $gperm_handler->getItemIds('nw_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->getnwCountByTopic(); } 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'], 'nw_count'=>$count, 'topic_color'=>'#'.$onetopic['topic_color'], 'title'=>$myts->displayTarea($onetopic['topic_title'])); } } //DNPROSSI ADDED $block['newsmodule_url']= NW_MODULE_URL; // 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; }
function nw_b_news_topics_show() { global $storytopic; // Don't know why this is used and where it's coming from .... include_once NW_MODULE_PATH . '/include/functions.php'; include_once NW_MODULE_PATH . '/class/class.newstopic.php'; include_once NW_MODULE_PATH . "/class/tree.php"; $jump = NW_MODULE_URL . '/index.php?storytopic='; $storytopic = !empty($storytopic) ? intval($storytopic) : 0; $restricted = nw_getmoduleoption('restrictindex', NW_MODULE_DIR_NAME); $xt = new nw_NewsTopic(); $allTopics = $xt->getAllTopics($restricted); $topic_tree = new nw_MyXoopsObjectTree($allTopics, 'topic_id', 'topic_pid'); $additional = " onchange='location=\"".$jump."\"+this.options[this.selectedIndex].value'"; $block['selectbox'] = $topic_tree->makeSelBox('storytopic', 'topic_title', '-- ', '', true, 0, $additional); //DNPROSSI ADDED $block['newsmodule_url']= NW_MODULE_URL; return $block; }
$notification_handler =& xoops_gethandler('notification'); $ams_news_topics=array(); // Key => AMS Id, Value => News ID // The import by itself // Read topics by their order $mytree = new XoopsTree($ams_topics,'topic_id','topic_pid'); $ams_topics = $mytree->getChildTreeArray(0,'weight'); foreach($ams_topics as $one_amstopic) { // First we create the topic $topicpid=0; if($one_amstopic['topic_pid']!=0) { // Search for its the parent if(array_key_exists($one_amstopic['topic_pid'],$ams_news_topics)) { $topicpid=$ams_news_topics[$one_amstopic['topic_pid']]; } } $news_topic = new nw_NewsTopic(); $news_topic->setTopicPid($topicpid); $news_topic->setTopicTitle($one_amstopic['topic_title']); $news_topic->setTopicImgurl($one_amstopic['topic_imgurl']); $news_topic->setMenu(0); $news_topic->setTopicFrontpage(1); $news_topic->Settopic_rssurl(''); $news_topic->setTopicDescription(''); $news_topic->setTopic_color('000000'); $news_topic->store(); echo '<br>- The following topic was imported : '.$news_topic->topic_title(); $ams_topicid = $one_amstopic['topic_id']; $news_topicid = $news_topic->topic_id(); $ams_news_topics[$ams_topicid] = $news_topicid; // Then we insert all its articles
/** * Creates all the meta datas : * - For Mozilla/Netscape and Opera the site navigation's bar * - The Dublin's Core Metadata * - The link for Firefox 2 micro summaries * - The meta keywords * - The meta description * * @package News * @author Instant Zero (http://xoops.instant-zero.com) * @copyright (c) Instant Zero */ function nw_CreateMetaDatas($story = null) { global $xoopsConfig, $xoTheme, $xoopsTpl; $content = ''; $myts =& MyTextSanitizer::getInstance(); include_once NW_MODULE_PATH . '/class/class.newstopic.php'; /** * Firefox and Opera Navigation's Bar */ if(nw_getmoduleoption('sitenavbar', NW_MODULE_DIR_NAME)) { $content .= sprintf("<link rel=\"Home\" title=\"%s\" href=\"%s/\" />\n",$xoopsConfig['sitename'],XOOPS_URL); $content .= sprintf("<link rel=\"Contents\" href=\"%s\" />\n",NW_MODULE_URL . '/index.php'); $content .= sprintf("<link rel=\"Search\" href=\"%s\" />\n",XOOPS_URL.'/search.php'); $content .= sprintf("<link rel=\"Glossary\" href=\"%s\" />\n",NW_MODULE_URL . '/archive.php'); $content .= sprintf("<link rel=\"%s\" href=\"%s\" />\n",$myts->htmlSpecialChars(_MA_NW_SUBMITNEWS), NW_MODULE_URL . '/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 NW_MODULE_PATH . '/class/class.newstopic.php'; $xt = new nw_NewsTopic(); $allTopics = $xt->getAllTopics(nw_getmoduleoption('restrictindex', NW_MODULE_DIR_NAME)); $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(),NW_MODULE_URL . '/index.php?storytopic='.$onetopic->topic_id()); } } /** * Meta Keywords and Description * If you have set this module's option to 'yes' and if the information was entered, then they are rendered in the page else they are computed */ $meta_keywords = ''; if(isset($story) && is_object($story)) { if(xoops_trim($story->keywords()) != '') { $meta_keywords = $story->keywords(); } else { $meta_keywords = nw_createmeta_keywords($story->hometext().' '.$story->bodytext()); } if(xoops_trim($story->description())!='') { $meta_description = strip_tags($story->description); } else { $meta_description = strip_tags($story->title); } if(isset($xoTheme) && is_object($xoTheme)) { $xoTheme->addMeta( 'meta', 'keywords', $meta_keywords); $xoTheme->addMeta( 'meta', 'description', $meta_description); } elseif(isset($xoopsTpl) && is_object($xoopsTpl)) { // Compatibility for old Xoops versions $xoopsTpl->assign('xoops_meta_keywords', $meta_keywords); $xoopsTpl->assign('xoops_meta_description', $meta_description); } } /** * Dublin Core's meta datas */ if(nw_getmoduleoption('dublincore', NW_MODULE_DIR_NAME) && isset($story) && is_object($story)) { $config_handler =& xoops_gethandler('config'); $xoopsConfigMetaFooter =& $config_handler->getConfigsByCat(XOOPS_CONF_METAFOOTER); $content .= '<meta name="DC.Title" content="'.nw_DublinQuotes($story->title())."\" />\n"; $content .= '<meta name="DC.Creator" content="'.nw_DublinQuotes($story->uname())."\" />\n"; $content .= '<meta name="DC.Subject" content="'.nw_DublinQuotes($meta_keywords)."\" />\n"; $content .= '<meta name="DC.Description" content="'.nw_DublinQuotes($story->title())."\" />\n"; $content .= '<meta name="DC.Publisher" content="'.nw_DublinQuotes($xoopsConfig['sitename'])."\" />\n"; $content .= '<meta name="DC.Date.created" scheme="W3CDTF" content="'.date('Y-m-d',$story->created)."\" />\n"; $content .= '<meta name="DC.Date.issued" scheme="W3CDTF" content="'.date('Y-m-d',$story->published)."\" />\n"; $content .= '<meta name="DC.Identifier" content="'.NW_MODULE_URL . '/article.php?storyid='.$story->storyid()."\" />\n"; $content .= '<meta name="DC.Source" content="'.XOOPS_URL."\" />\n"; $content .= '<meta name="DC.Language" content="'._LANGCODE."\" />\n"; $content .= '<meta name="DC.Relation.isReferencedBy" content="'.NW_MODULE_URL . '/index.php?storytopic='.$story->topicid()."\" />\n"; if(isset($xoopsConfigMetaFooter['meta_copyright'])) { $content .= '<meta name="DC.Rights" content="'.nw_DublinQuotes($xoopsConfigMetaFooter['meta_copyright'])."\" />\n"; } } /** * Firefox 2 micro summaries */ if(nw_getmoduleoption('firefox_microsummaries', NW_MODULE_DIR_NAME)) { $content .= sprintf("<link rel=\"microsummary\" href=\"%s\" />\n",NW_MODULE_URL . '/micro_summary.php'); } if(isset($xoopsTpl) && is_object($xoopsTpl)) { $xoopsTpl->assign('xoops_module_header', $content); } }
function getAllTopics($checkRight = true, $permission = "nw_view") { $topics_arr = array(); $db =& Database::getInstance(); $table = $db->prefix('nw_topics'); $sql = "SELECT * FROM ".$table; if ($checkRight) { $topics = nw_MygetItemIds($permission); if (count($topics) == 0) { return array(); } $topics = implode(',', $topics); $sql .= " WHERE topic_id IN (".$topics.")"; } $sql .= " ORDER BY topic_title"; $result = $db->query($sql); while ($array = $db->fetchArray($result)) { $topic = new nw_NewsTopic(); $topic->makeTopic($array); $topics_arr[$array['topic_id']] = $topic; unset($topic); } return $topics_arr; }
if (file_exists(XOOPS_ROOT_PATH.'/language/'.$xoopsConfig['language'].'/calendar.php')) { include_once XOOPS_ROOT_PATH.'/language/'.$xoopsConfig['language'].'/calendar.php'; } else { include_once XOOPS_ROOT_PATH.'/language/english/calendar.php'; } include_once XOOPS_ROOT_PATH.'/class/xoopsformloader.php'; include_once NW_MODULE_PATH . '/include/functions.php'; include_once NW_MODULE_PATH . '/config.php'; $sform = new XoopsThemeForm(_MA_NW_SUBMITNEWS, "storyform", NW_MODULE_URL . '/submit.php'); $sform->setExtra('enctype="multipart/form-data"'); $sform->addElement(new XoopsFormText(_MA_NW_TITLE, 'title', 50, 255, $title), true); // Topic's selection box if (!isset($xt)) { $xt = new nw_NewsTopic(); } if($xt->getAllTopicsCount()==0) { redirect_header("index.php",4,_MA_NW_POST_SORRY); exit(); } include_once XOOPS_ROOT_PATH."/class/tree.php"; $allTopics = $xt->getAllTopics($xoopsModuleConfig['restrictindex'],'nw_submit'); $topic_tree = new XoopsObjectTree($allTopics, 'topic_id', 'topic_pid'); $topic_select = $topic_tree->makeSelBox('topic_id', 'topic_title', '-- ', $topicid, false); $sform->addElement(new XoopsFormLabel(_MA_NW_TOPIC, $topic_select)); //If admin - show admin form //TODO: Change to "If submit privilege"
* @author Instant Zero * @copyright (c) Instant Zero - http://xoops.instant-zero.com */ 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 . '/include/functions.php'; $xoopsOption['template_main'] = 'nw_news_topics_directory.html'; include_once XOOPS_ROOT_PATH.'/header.php'; $myts =& MyTextSanitizer::getInstance(); $newscountbytopic = $tbl_topics = array(); $perms = ''; $xt = new nw_NewsTopic(); $restricted = nw_getmoduleoption('restrictindex', NW_MODULE_DIR_NAME); if ($restricted) { global $xoopsUser; $module_handler =& xoops_gethandler('module'); $newsModule =& $module_handler->getByDirname(NW_MODULE_DIR_NAME); $groups = is_object($xoopsUser) ? $xoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS; $gperm_handler =& xoops_gethandler('groupperm'); $topics = $gperm_handler->getItemIds('nw_view', $groups, $newsModule->getVar('mid')); if(count($topics) >0 ) { $topics = implode(',', $topics); $perms = ' AND topic_id IN ('.$topics.') '; } else { return ''; } }
$xoopsOption['template_main'] = 'nw_news_by_topic.html'; include_once XOOPS_ROOT_PATH.'/header.php'; //DNPROSSI - ADDED $xoopsTpl->assign('newsmodule_url', NW_MODULE_URL); $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();
/** * Cloner - DNPROSSI */ function NewsCloner() { global $xoopsDB, $xoopsConfig, $xoopsModule, $myts; include_once XOOPS_ROOT_PATH.'/class/xoopsformloader.php'; xoops_cp_header(); adminmenu(8); $clone_modulename = ''; $start = isset($_GET['start']) ? intval($_GET['start']) : 0; $result = $xoopsDB->query('SELECT * FROM ' . $xoopsDB->prefix('news_clonerdata')); $ix = 0; $iy = 0; while ( $clone = $xoopsDB->fetchArray($result) ) { //DNPROSSI - Control if clone dir exists if ( is_dir(XOOPS_ROOT_PATH . "/modules/" . $clone['clone_dir']) ) { $clone_arr[$ix] = $clone; $ix++; } else { $nonclone_arr[$iy] = $clone; $iy++; } } // If cloned dir does not exists because deleted remove from dtb if ( isset($nonclone_arr) ) { for ($iy = 0; $iy < count($nonclone_arr); $iy++) { $result = $xoopsDB->queryF("DELETE FROM " . $xoopsDB->prefix('news_clonerdata') . " WHERE clone_dir = '" . $nonclone_arr[$iy]['clone_dir'] . "' ;"); } } $totalclones = count($clone_arr); $class=''; echo '<h4>' . _AM_NW_CLONER . '</h4>'; nw_collapsableBar('NewsCloner', 'topNewsCloner'); echo "<img onclick=\"toggle('toptable'); toggleIcon('toptableicon');\" id='topNewsCloner' name='topNewsCloner' src='" . NW_MODULE_URL . "/images/close12.gif' alt='' /></a> " . _AM_NW_CLONER_CLONES . ' (' . $totalclones . ')'."</h4>"; echo "<div id='NewsCloner'>"; echo '<br />'; echo "<div style='text-align: center;'>"; echo "<table width='100%' cellspacing='1' cellpadding='3' border='0' class='outer'><tr class='bg3'><td align='center'>" . _AM_NW_CLONER_NAME . "</td><td align='center'>" . _AM_NW_CLONER_DIRFOL . "</td><td align='center'>" . _AM_NW_SUBPREFIX . "</td><td align='center'>" . _AM_NW_CLONER_VERSION . "</td><td align='center'>" . _AM_NW_ACTION . "</td><td align='center'>" . _AM_NW_CLONER_ACTION_INSTALL . "</td></tr>"; if(is_array($clone_arr) && $totalclones) { $cpt=1; $tmpcpt=$start; $ok=true; $output=''; while($ok) { if($tmpcpt < $totalclones) { //DNPROSSI - Upgrade if clone version is different from original news version //DNPROSSI - Install if cloned if ( $clone_arr[$tmpcpt]['clone_dir'] != $clone_arr[0]['clone_dir'] ) { if ( $clone_arr[$tmpcpt]['clone_version'] != $clone_arr[0]['clone_version'] ) { $linkupgrade = NW_MODULE_URL . '/admin/index.php?op=cloneupgrade&clone_id=' . $clone_arr[$tmpcpt]['clone_id']; $action = sprintf("<a href='%s'>%s</a>", $linkupgrade, _AM_NW_UPGRADE); if ( $clone_arr[$tmpcpt]['clone_installed'] == 1 ) { $linkupgrade = XOOPS_URL . '/modules/system/admin.php?fct=modulesadmin&op=uninstall&module=' . $clone_arr[$tmpcpt]['clone_dir']; $installaction = sprintf("<a href='%s'>%s</a>", $linkupgrade, _AM_NW_CLONER_UNINSTALL); } else { $linkupgrade = XOOPS_URL . '/modules/system/admin.php?fct=modulesadmin&op=install&module=' . $clone_arr[$tmpcpt]['clone_dir']; $installaction = sprintf("<a href='%s'>%s</a>", $linkupgrade, _AM_NW_CLONER_INSTALL); } } else { $action = _AM_NW_UPGRADE; if ( $clone_arr[$tmpcpt]['clone_installed'] == 1 ) { $linkupgrade = XOOPS_URL . '/modules/system/admin.php?fct=modulesadmin&op=uninstall&module=' . $clone_arr[$tmpcpt]['clone_dir']; $installaction = sprintf("<a href='%s'>%s</a>", $linkupgrade, _AM_NW_CLONER_UNINSTALL); } else { $linkupgrade = XOOPS_URL . '/modules/system/admin.php?fct=modulesadmin&op=install&module=' . $clone_arr[$tmpcpt]['clone_dir']; $installaction = sprintf("<a href='%s'>%s</a>", $linkupgrade, _AM_NW_CLONER_INSTALL); } } } else { $linkupgrade = XOOPS_URL . '/modules/system/admin.php?fct=modulesadmin&op=update&module=' . $clone_arr[$tmpcpt]['clone_dir']; $action = sprintf("<a href='%s'>%s</a>", $linkupgrade, _AM_NW_CLONER_UPDATE); $installaction = ''; } $class = ($class == 'even') ? 'odd' : 'even'; $output = $output . "<tr class='" . $class . "'><td align='center'>" . $clone_arr[$tmpcpt]['clone_name'] . "</td><td align='center'>" . $clone_arr[$tmpcpt]['clone_dir'] . "</td><td align='center'>" . $clone_arr[$tmpcpt]['clone_subprefix'] . "</td><td align='center'>" . $clone_arr[$tmpcpt]['clone_version'] . "</td><td>" . $action . "</td><td>" . $installaction . "</td></tr>"; } else { $ok=false; } if($cpt>=nw_getmoduleoption('storycountadmin', NW_MODULE_DIR_NAME)) { $ok=false; } $tmpcpt++; $cpt++; } echo $output; } $pagenav = new XoopsPageNav( $totalclones, nw_getmoduleoption('storycountadmin', NW_MODULE_DIR_NAME), $start, 'start', 'op=clonemanager'); echo "</table><div align='right'>".$pagenav->renderNav().'</div><br />'; echo "</div></div><br />\n"; $clone_id = isset($_GET['clone_id']) ? intval($_GET['clone_id']) : 0; if($clone_id>0) { $xtmod = new nw_NewsTopic($clone_id); $clone_name=$xtmod->clone_name('E'); $clone_dir=$xtmod->clone_dir('E'); $clone_version=$xtmod->clone_version('E'); $op='modClone'; $btnlabel=_AM_NW_MODIFY; $parent=$xtmod->topic_pid(); $formlabel=_AM_NW_MODIFYTOPIC; $oldnewsimport=$xtmod->menu(); $topic_frontpage=$xtmod->topic_frontpage(); $topic_color=$xtmod->topic_color(); unset($xtmod); } else { $clone_name=''; $clone_frontpage=1; $clone_dir=''; $op='addTopic'; $btnlabel=_AM_NW_ADD; $parent=-1; $oldnewsimport=0; $clone_version=''; $formlabel=_AM_NW_ADD_TOPIC; } //Draw Form $sform = new XoopsThemeForm(_AM_NW_CLONER_ADD, "clonerform", NW_MODULE_URL . "/admin/index.php", "post"); $filedir_tray = new XoopsFormElementTray(_AM_NW_CLONER_NEWNAME, ""); $label = sprintf(_AM_NW_CLONER_NEWNAMEDESC, $xoopsModule->name()); $filedir_tray->addElement(new XoopsFormLabel($label), false); $filedir_tray->addElement(new XoopsFormText(_AM_NW_CLONER_NEWNAMELABEL, "clone_modulename", 50, 255, $clone_modulename), true); $sform->addElement($filedir_tray); $sform->addElement(new XoopsFormHidden("op", "clonerapply"), false); $button_tray = new XoopsFormElementTray("" ,""); $submit_btn = new XoopsFormButton("", "post", _SUBMIT, "submit"); $button_tray->addElement($submit_btn); $sform->addElement($button_tray); $sform->display(); //recalc original subprefix $sub = nw_remove_numbers(NW_SUBPREFIX); $result2 = $xoopsDB->query("SELECT * FROM " . $xoopsDB->prefix($sub.'_stories')); $count = $xoopsDB->getRowsNum($result2); $tmpmodule_handler =& xoops_gethandler('module'); //Draw Import News Form $sform = new XoopsThemeForm(_AM_NW_CLONER_IMPORTNEWS, "clonerimportform", NW_MODULE_URL . "/admin/index.php", "post"); if ( $tmpmodule_handler->getByDirname('news') && nw_TableExists($xoopsDB->prefix('stories')) && $count >= 0) { $sform->addElement(new XoopsFormLabel("", _AM_NW_CLONER_IMPORTNEWSDESC2), false); } $sform->addElement(new XoopsFormHidden('op', 'clonenewsimport'), false); if ( $tmpmodule_handler->getByDirname('news') && nw_TableExists($xoopsDB->prefix('stories')) && $count == 0) { $button_tray = new XoopsFormElementTray(_AM_NW_CLONER_IMPORTNEWSDESC1 , _AM_NW_CLONER_IMPORTNEWSDESC2); $submit_btn = new XoopsFormButton("", "post", _AM_NW_CLONER_IMPORTNEWSSUB, "submit"); $button_tray->addElement($submit_btn); $sform->addElement($button_tray); } $sform->display(); }
/** * 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 nw_b_news_top_show($options) { global $xoopsConfig; include_once NW_MODULE_PATH . '/include/functions.php'; $myts =& MyTextSanitizer::getInstance(); $block = array(); $displayname = nw_getmoduleoption('displayname', NW_MODULE_DIR_NAME); $tabskin = nw_getmoduleoption('tabskin', NW_MODULE_DIR_NAME); 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'; } $block['displayview']=$options[8]; $block['tabskin']=$tabskin; $block['imagesurl']= NW_MODULE_URL . '/images/'; //DNPROSSI ADDED $block['newsmodule_url']= NW_MODULE_URL; $restricted=nw_getmoduleoption('restrictindex', NW_MODULE_DIR_NAME); $dateformat=nw_getmoduleoption('dateformat', NW_MODULE_DIR_NAME); $infotips=nw_getmoduleoption('infotips', NW_MODULE_DIR_NAME); $newsrating=nw_getmoduleoption('ratenews', NW_MODULE_DIR_NAME); if($dateformat=='') { $dateformat='s'; } $perm_verified=false; $news_visible=true; // Is the spotlight visible ? if($options[4]==1 && $restricted && $options[5]==0) { $perm_verified=true; $permittedtopics=nw_MygetItemIds(); $permstory = new nw_NewsStory($options[6]); if(!in_array($permstory->topicid(),$permittedtopics)) { $usespotlight=false; $news_visible = false; $topicstitles=array(); } $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=nw_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) { // Tabbed view ******************************************************************************************** $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!='nwTab') { $myurl.=$key.'='.$value.'&'; } } $block['url']=$myurl; $tabscount=0; $usespotlight=false; if(isset($_GET['nwTab'])) { $_SESSION['nwTab']=intval($_GET['nwTab']); $currenttab = intval($_GET['nwTab']); } elseif(isset($_SESSION['nwTab'])) { $currenttab = intval($_SESSION['nwTab']); } else { $currenttab=0; } $tmpstory = new nw_NewsStory(); $topic= new nw_NewsTopic(); $topicstitles=array(); if($options[4]==1) { // Spotlight enabled $topicstitles[0]=_MB_NW_SPOTLIGHT_TITLE; $tabscount++; $usespotlight=true; } if($options[5]==0 && $restricted) { // Use a specific news and we are in restricted mode if(!$perm_verified) { $permittedtopics=nw_MygetItemIds(); $permstory = new nw_NewsStory($options[6]); if(!in_array($permstory->topicid(),$permittedtopics)) { $usespotlight=false; $topicstitles=array(); } //unset($permstory); } else { if(!$news_visible) { $usespotlight=false; $topicstitles=array(); } } } $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_NW_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 if(!isset($permstory)) { $tmpstory->nw_NewsStory($options[6]); } else { $tmpstory = $permstory; } } 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->nw_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>", NW_MODULE_URL . '/article.php?storyid='.$tmpstory->storyid(),$myts->displayTarea($options[7], $tmpstory->nohtml)); } $spotlight['text'] = $tmpstory->hometext(); // Added 16 february 2007 ***************************************** $story_user = null; $story_user = new XoopsUser($tmpstory->uid()); if(is_object($story_user)) { $spotlight['avatar'] = XOOPS_UPLOAD_URL.'/'.$story_user->getVar('user_avatar'); } // **************************************************************** $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>", NW_MODULE_URL . '/article.php?storyid='.$tmpstory->storyid(),_MB_NW_READMORE); $spotlight['title_with_link'] = sprintf("<a href='%s'>%s</a>", NW_MODULE_URL . '/article.php?storyid='.$tmpstory->storyid(),$tmpstory->title()); if($tmpstory->votes()==1) { $spotlight['number_votes']=_MA_NW_ONEVOTE; } else { $spotlight['number_votes']=sprintf(_MA_NW_NUMVOTES,$tmpstory->votes()); } $spotlight['votes_with_text']=sprintf(_MA_NW_NUMVOTES,$tmpstory->votes()); $spotlight['topicid'] = $tmpstory->topicid(); $spotlight['topic_title'] = $tmpstory->topic_title(); // Added, topic's image and description $spotlight['topic_image']=NW_TOPICS_FILES_URL . '/'.$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) { $html = $story->nohtml() == 1 ? 0 : 1; $news['teaser'] = nw_truncate_tagsafe($myts->displayTarea($story->hometext(), $html), $options[3]+3); } else { $news['teaser'] = ''; } if($infotips>0) { $news['infotips'] = ' title="'.nw_make_infotips($story->hometext()).'"'; } else { $news['infotips'] = ''; } $news['title_with_link'] = sprintf("<a href='%s'%s>%s</a>", NW_MODULE_URL . '/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']= NW_TOPICS_FILES_URL . '/'.$topic->topic_imgurl(); $block['topic_description']=$topic->topic_description(); $smallheader=array(); $stats=$topic->getTopicMiniStats($thetopic); $smallheader[]=sprintf("<a href='%s'>%s</a>", NW_MODULE_URL . '/index.php?storytopic='.$thetopic,_MB_NW_READMORE); $smallheader[]=sprintf("%u %s",$stats['count'],_MA_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 = nw_truncate_tagsafe($title, $options[2]+3); } if ($options[7] != '') { $news['image'] = sprintf("<a href='%s'>%s</a>", NW_MODULE_URL . '/article.php?storyid='.$story->storyid(),$myts->displayTarea($options[7], $story->nohtml)); } if($options[3]>0) { $html = $story->nohtml() == 1 ? 0 : 1; $news['text'] = nw_truncate_tagsafe($myts->displayTarea($story->hometext(), $html), $options[3]+3); } else { $news['text'] = ''; } if($story->votes()==1) { $news['number_votes']=_MA_NW_ONEVOTE; } else { $news['number_votes']=sprintf(_MA_NW_NUMVOTES,$story->votes()); } if($infotips>0) { $news['infotips'] = ' title="'.nw_make_infotips($story->hometext()).'"'; } else { $news['infotips'] = ''; } $news['title']=sprintf("<a href='%s' %s>%s</a>", NW_MODULE_URL . '/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'] = '#'.$myts->displayTarea($story->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>", NW_MODULE_URL . '/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 nw_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 nw_NewsTopic(); foreach ($stories as $key => $story) { $news = array(); $title = $story->title(); if (strlen($title) > $options[2]) { $title = xoops_substr($title,0,$options[2]+3); } //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=nw_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>", NW_MODULE_URL . '/article.php?storyid='.$story->storyid(),$myts->displayTarea($options[7], $story->nohtml)); } // Added 16 february 2007 ***************************************** $story_user = null; $story_user = new XoopsUser($story->uid()); if(is_object($story_user)) { $spotlight['avatar'] = XOOPS_UPLOAD_URL.'/'.$story_user->getVar('user_avatar'); } // **************************************************************** $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'] = '#'.$myts->displayTarea($story->topic_color); // Added, topic's image and description $spotlight['topic_image']= NW_TOPICS_FILES_URL . '/'.$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'] = '#'.$myts->displayTarea($story->topic_color); if($displayname!=3) { $news['author']= sprintf("%s %s",_POSTEDBY,$story->uname()); } else { $news['author']= ''; } 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; } } // 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=nw_MygetItemIds(); $permstory = new nw_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 nw_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 nw_NewsStory($firststory->storyid()); } else { $block['use_spotlight']=false; } } if($block['use_spotlight']==true) { $spotlight = array(); $spotlight['title'] = xoops_substr($spotlightArticle->title(),0,($options[2]-1));; if ($options[7] != '') { $spotlight['image'] = sprintf("<a href='%s'>%s</a>", NW_MODULE_URL . '/article.php?storyid='.$spotlightArticle->storyid(),$myts->displayTarea($options[7], $spotlightArticle->nohtml)); } // Added 16 february 2007 ***************************************** $story_user = null; $story_user = new XoopsUser($spotlightArticle->uid()); if(is_object($story_user)) { $spotlight['avatar'] = XOOPS_UPLOAD_URL.'/'.$story_user->getVar('user_avatar'); } // **************************************************************** $spotlight['topicid'] = $spotlightArticle->topicid(); $spotlight['topic_title'] = $spotlightArticle->topic_title(); $spotlight['topic_color'] = '#'.$myts->displayTarea($spotlightArticle->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']= NW_TOPICS_FILES_URL . '/'.$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; } } } if(isset($permstory)) { unset($permstory); } $block['lang_read_more'] = $myts->htmlSpecialChars(_MB_NW_READMORE); // Read More... $block['lang_orderby'] = $myts->htmlSpecialChars(_MB_NW_ORDER); // "Order By" $block['lang_orderby_date'] = $myts->htmlSpecialChars(_MB_NW_DATE); // Published date $block['lang_orderby_hits'] = $myts->htmlSpecialChars(_MB_NW_HITS); // Number of Hits $block['lang_orderby_rating'] = $myts->htmlSpecialChars(_MB_NW_RATE); // Rating $block['sort'] = $options[0]; // "published" or "counter" or "rating" // 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; }
// 1) Check to see if 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 if(!isset($_SESSION['items_count']) || $_SESSION['items_count']== -1) { $sql = "SELECT COUNT(*) as cpt FROM ".$xoopsDB->prefix("nw_topics")." WHERE menu=1"; $result = $xoopsDB->query($sql); list($count) = $xoopsDB->fetchRow($result); $_SESSION['items_count'] = $count; } else { $count = $_SESSION['items_count']; } if($count>0) { include_once XOOPS_ROOT_PATH.'/class/tree.php'; include_once NW_MODULE_PATH . '/class/class.newstopic.php'; include_once NW_MODULE_PATH . '/include/functions.php'; $xt = new nw_NewsTopic(); $allTopics = $xt->getAllTopics(nw_getmoduleoption('restrictindex', NW_MODULE_DIR_NAME)); $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('nw_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); } }
$expired = 0; } $type = $story -> type(); $topicdisplay = $story -> topicdisplay(); $topicalign = $story -> topicalign( false ); if(!nw_is_admin_group()) { include_once NW_MODULE_PATH . '/include/storyform.inc.php'; } else { include_once NW_MODULE_PATH . '/include/storyform.original.php'; } echo'</td></tr></table>'; break; case 'preview': $topic_id = intval($_POST['topic_id']); $xt = new nw_NewsTopic($topic_id); 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($storyid); $published = $story->published(); $expired = $story->expired(); } else {
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 $tpl->assign('channel_category', $xt->topic_title()); $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');