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; }
/** * 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); } }
$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" if ($approveprivilege) { //Show topic image? $sform->addElement(new XoopsFormRadioYN(_AM_NW_TOPICDISPLAY, 'topicdisplay', $topicdisplay)); //Select image position $posselect = new XoopsFormSelect(_AM_NW_TOPICALIGN, 'topicalign', $topicalign); $posselect->addOption('R', _AM_NW_RIGHT); $posselect->addOption('L', _AM_NW_LEFT); $sform->addElement($posselect); //Publish in home?
$xoopsTpl->assign('lang_ratethisnews', _MA_NW_RATETHISNEWS); } else { $xoopsTpl->assign('rates', false); } if($xoopsOption['storytopic']) { $xt->getTopic($xoopsOption['storytopic']); $xoopsTpl->assign('topic_description', $xt->topic_description('S')); $xoopsTpl->assign('topic_color', '#'.$xt->topic_color('S')); $topictitle=$xt->topic_title(); } if ($xoopsModuleConfig['displaynav'] == 1 ) { $xoopsTpl->assign('displaynav', true); $allTopics = $xt->getAllTopics($xoopsModuleConfig['restrictindex']); $topic_tree = new XoopsObjectTree($allTopics, 'topic_id', 'topic_pid'); $topic_select = $topic_tree->makeSelBox('storytopic', 'topic_title', '-- ', $xoopsOption['storytopic'], true); $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);
/** * News export * * You can use this function in the module's admin when you click on the tab named "News Export" * First select a range of date, possibly a range of topics and if you want, check the option "Include Topics Definitions" * to also export the topics. * News, and topics, will be exported to the XML format. */ function NewsExport() { include_once XOOPS_ROOT_PATH.'/class/xoopsformloader.php'; xoops_cp_header(); adminmenu(4); echo '<br /><br /><br />'; $sform = new XoopsThemeForm(_AM_NW_EXPORT_NEWS, 'exportform', NW_MODULE_URL . '/admin/index.php', 'post'); $dates_tray = new XoopsFormElementTray(_AM_NW_EXPORT_BETWEEN); $date1 = new XoopsFormTextDateSelect('', 'date1',15,time()); $date2 = new XoopsFormTextDateSelect(_AM_NW_EXPORT_AND, 'date2',15,time()); $dates_tray->addElement($date1); $dates_tray->addElement($date2); $sform->addElement($dates_tray); $topiclist=new XoopsFormSelect(_AM_NW_PRUNE_TOPICS, 'export_topics','',5,true); $topics_arr=array(); $xt = new nw_NewsTopic(); $allTopics = $xt->getAllTopics(false); // The webmaster can see everything $topic_tree = new XoopsObjectTree($allTopics, 'topic_id', 'topic_pid'); $topics_arr = $topic_tree->getAllChild(0); if(count($topics_arr)) { foreach ($topics_arr as $onetopic) { $topiclist->addOption($onetopic->topic_id(),$onetopic->topic_title()); } } $topiclist->setDescription(_AM_NW_EXPORT_PRUNE_DSC); $sform->addElement($topiclist,false); $sform->addElement(new XoopsFormRadioYN(_AM_NW_EXPORT_INCTOPICS, 'includetopics',0),false); $sform->addElement(new XoopsFormHidden('op', 'launchexport'), false); $button_tray = new XoopsFormElementTray('' ,''); $submit_btn = new XoopsFormButton('', 'post', _SUBMIT, 'submit'); $button_tray->addElement($submit_btn); $sform->addElement($button_tray); $sform->display(); }
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); } }