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; }
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); $newscountbytopic = $xt->getnwCountByTopic(); if(is_array($topics_arr) && count($topics_arr)) { foreach ($topics_arr as $onetopic) { $count = 0; if(array_key_exists($onetopic['topic_id'],$newscountbytopic)) { $count = $newscountbytopic[$onetopic['topic_id']]; } if($onetopic['topic_pid'] != 0) { $onetopic['prefix'] = str_replace('.','-',$onetopic['prefix']) . ' '; } else { $onetopic['prefix'] = str_replace('.','',$onetopic['prefix']); } $tbl_topics[] = array('id'=>$onetopic['topic_id'], 'nw_count'=>$count, 'topic_color'=>'#'.$onetopic['topic_color'], 'prefix'=>$onetopic['prefix'], 'title'=>$myts->displayTarea($onetopic['topic_title'])); } }