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; }
*/ if (nw_getmoduleoption('showsummarytable', NW_MODULE_DIR_NAME)) { $xoopsTpl->assign('showsummary', true); $xoopsTpl->assign('lang_other_story',_MA_NW_OTHER_ARTICLES); $count=0; $tmparticle = new nw_NewsStory(); $infotips=nw_getmoduleoption('infotips', NW_MODULE_DIR_NAME); $sarray = $tmparticle->getAllPublished($cfg['article_summary_items_count'], 0, $xoopsModuleConfig['restrictindex']); if(count($sarray)>0) { foreach ($sarray as $onearticle) { $count++; $htmltitle=''; $tooltips=''; $htmltitle=''; if($infotips>0) { $tooltips = nw_make_infotips($onearticle->hometext()); $htmltitle=' title="'.$tooltips.'"'; } $xoopsTpl->append('summary', array('story_id'=>$onearticle->storyid(), 'htmltitle'=>$htmltitle, 'infotips'=>$tooltips, 'story_title'=>$onearticle->title(), 'story_hits'=>$onearticle->counter(), 'story_published'=>formatTimestamp($onearticle->published,$dateformat))); } } $xoopsTpl->assign('summary_count',$count); unset($tmparticle); } else { $xoopsTpl->assign('showsummary', false); } /** * Show a link to go to the previous article and to the next article *
/** * Function used to prepare an article to be showned */ function prepare2show($filescount) { include_once NW_MODULE_PATH . '/include/functions.php'; global $xoopsUser, $xoopsConfig, $xoopsModuleConfig; $myts =& MyTextSanitizer::getInstance(); $infotips = nw_getmoduleoption('infotips', NW_MODULE_DIR_NAME); //DNPROSSI SEO $seo_enabled = nw_getmoduleoption('nw_seo_enable', NW_MODULE_DIR_NAME); $story = array(); $story['id'] = $this->storyid(); $story['poster'] = $this->uname(); $story['author_name'] = $this->uname(); $story['author_uid'] = $this->uid(); if ( $story['poster'] != false ) { $story['poster'] = "<a href='".XOOPS_URL."/userinfo.php?uid=".$this->uid()."'>".$story['poster']."</a>"; } else { if($xoopsModuleConfig['displayname']!=3) { $story['poster'] = $xoopsConfig['anonymous']; } } if ($xoopsModuleConfig['ratenews']) { $story['rating'] = number_format($this->rating(), 2); if ($this->votes == 1) { $story['votes'] = _MA_NW_ONEVOTE; } else { $story['votes'] = sprintf(_MA_NW_NUMVOTES,$this->votes); } } $story['posttimestamp'] = $this->published(); $story['posttime'] = formatTimestamp($story['posttimestamp'],nw_getmoduleoption('dateformat', NW_MODULE_DIR_NAME)); $story['topic_description'] = $myts->displayTarea($this->topic_description); $auto_summary = ''; $tmp = ''; $auto_summary = $this->auto_summary($this->bodytext(),$tmp); $story['text'] = $this->hometext(); $story['text'] = str_replace('[summary]', $auto_summary, $story['text']); $introcount = strlen($story['text']); $fullcount = strlen($this->bodytext()); $totalcount = $introcount + $fullcount; $morelink = ''; if ( $fullcount > 1 ) { //DNPROSSI SEO if ( $seo_enabled == 1 ) { $story_path = nw_remove_accents($this->title()); $morelink .= '<a href="' . NW_MODULE_URL . '/articles.item.' . $this->storyid() . '/' . $story_path . ''; } else { $morelink .= '<a href="' . NW_MODULE_URL . '/article.php?storyid=' . $this->storyid() . ''; } $morelink .= '">'._MA_NW_READMORE.'</a>'; $morelink .= ' | '.sprintf(_MA_NW_BYTESMORE,$totalcount); if (XOOPS_COMMENT_APPROVENONE != $xoopsModuleConfig['com_rule']) { $morelink .= ' | '; } } if (XOOPS_COMMENT_APPROVENONE != $xoopsModuleConfig['com_rule']) { $ccount = $this->comments(); //DNPROSSI SEO if ( $seo_enabled == 1 ) { $story_url = nw_remove_accents($this->title()); $morelink .= '<a href="' . NW_MODULE_URL . '/articles.item.' . $this->storyid() . '/'.$story_url . ''; $morelink2 = '<a href="' . NW_MODULE_URL . '/articles.item.' . $this->storyid() . '/'.$story_url . ''; } else { $morelink .= '<a href="' . NW_MODULE_URL . '/article.php?storyid=' . $this->storyid() . ''; $morelink2 = '<a href="' . NW_MODULE_URL . '/article.php?storyid=' . $this->storyid() . ''; } if ( $ccount == 0 ) { $morelink .= '">'._MA_NW_COMMENTS.'</a>'; } else { if ( $fullcount < 1 ) { if ( $ccount == 1 ) { $morelink .= '">'._MA_NW_READMORE.'</a> | '.$morelink2.'">'._MA_NW_ONECOMMENT.'</a>'; } else { $morelink .= '">'._MA_NW_READMORE.'</a> | '.$morelink2.'">'; $morelink .= sprintf(_MA_NW_NUMCOMMENTS, $ccount); $morelink .= '</a>'; } } else { if ( $ccount == 1 ) { $morelink .= '">'._MA_NW_ONECOMMENT.'</a>'; } else { $morelink .= '">'; $morelink .= sprintf(_MA_NW_NUMCOMMENTS, $ccount); $morelink .= '</a>'; } } } } $story['morelink'] = $morelink; $story['adminlink'] = ''; $approveprivilege = 0; if(nw_is_admin_group()) { $approveprivilege = 1; } if($xoopsModuleConfig['authoredit']==1 && (is_object($xoopsUser) && $xoopsUser->getVar('uid')==$this->uid())) { $approveprivilege = 1; } if ($approveprivilege) { $story['adminlink'] = $this->adminlink(); } $story['mail_link'] = 'mailto:?subject='.sprintf(_MA_NW_INTARTICLE,$xoopsConfig['sitename']).'&body='.sprintf(_MA_NW_INTARTFOUND, $xoopsConfig['sitename']).': '.NW_MODULE_URL . '/article.php?storyid='.$this->storyid(); $story['imglink'] = ''; $story['align'] = ''; if ( $this->topicdisplay() ) { $story['imglink'] = $this->imglink(); $story['align'] = $this->topicalign(); } if($infotips>0) { $story['infotips'] = ' title="'.nw_make_infotips($this->hometext()).'"'; } else { $story['infotips'] = ''; } //DNPROSSI SEO if ( $seo_enabled == 1 ) { $story_path = nw_remove_accents($this->title()); $story['title'] = "<a href='" . NW_MODULE_URL . "/articles.item." . $this->storyid() . "/" . $story_path . "'>" . $this->title() . "</a>"; } else { $story['title'] = "<a href='" . NW_MODULE_URL . "/article.php?storyid=" . $this->storyid() . "'" . $story['infotips'] . ">" . $this->title() . "</a>"; } $story['hits'] = $this->counter(); if($filescount>0) { $story['files_attached']= true; $story['attached_link']="<a href='".NW_MODULE_URL . '/article.php?storyid='.$this->storyid()."' title='"._MA_NW_ATTACHEDLIB."'><img src='".NW_MODULE_URL . '/images/attach.png'."' title='"._MA_NW_ATTACHEDLIB."'></a>"; } else { $story['files_attached']= false; $story['attached_link']=''; } return $story; }
/** * 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; }
$cat_path = str_replace('"','', nw_remove_accents($oldtopictitle)); $topic_link=sprintf("<a href='%s'>%s</a>", NW_MODULE_URL . '/articles.cat.' . $oldtopic . '/' . $cat_path , $oldtopictitle); } else { $topic_link=sprintf("<a href='%s'>%s</a>", NW_MODULE_URL . '/index.php?storytopic=' . $oldtopic, $oldtopictitle); } $xoopsTpl->append('topics',array('topic_id'=>$oldtopic, 'topic_count_articles' => sprintf(_AM_NW_TOTAL, $count_articles), 'topic_count_reads' => $count_reads, 'topic_color'=>$oldtopiccolor, 'topic_title'=>$oldtopictitle, 'topic_link'=> $topic_link, 'news'=>$articlestpl)); } $oldtopic=$article['topicid']; $oldtopictitle=$article['topic_title']; $oldtopiccolor='#'.$myts->displayTarea($article['topic_color']); $articlestpl = array(); $count_articles = $count_reads = 0; } $htmltitle=''; if($infotips>0) { $htmltitle = ' title="'.nw_make_infotips($article['hometext']).'"'; } $count_articles++; $count_reads += $article['counter']; // DNPROSSI SEO if ( $seo_enabled == 1 ) { $item_path = str_replace('"', '', nw_remove_accents($article['title'])); $articlestpl[] = array( 'id'=>$article['storyid'], 'hometext'=>$article['hometext'], 'title'=>$article['title'], 'hits'=>$article['counter'], 'created'=>formatTimestamp($article['created'],$dateformat), 'article_link'=>sprintf("<a href='%s'%s>%s</a>",NW_MODULE_URL . '/articles.item.' . $article['storyid'] . '/' . $item_path . '', $htmltitle,$article['title']), 'published'=>formatTimestamp($article['published'],$dateformat), 'rating' => $article['rating']);
// 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); $story['title'] = "<a href='" . NW_MODULE_URL . '/articles.cat.' . $article->topicid() . '/' . $cat_path . '' . "'>" . $article->topic_title() . "</a>: <a href='". NW_MODULE_URL ."/articles.item." . $article->storyid() . "/" . $item_path . "'" . $htmltitle . ">" . $article->title() . "</a>"; $story['print_link'] = NW_MODULE_URL . '/articles.print.' . $article->storyid() . '/' .$print_item; } else { $story['title'] = "<a href='". NW_MODULE_URL . '/index.php?storytopic=' . $article->topicid() . "'>" . $article->topic_title() . "</a>: <a href='" . NW_MODULE_URL . "/article.php?storyid=" . $article->storyid() . "'" . $htmltitle.">" . $article->title() . "</a>"; $story['print_link'] = NW_MODULE_URL . '/print.php?storyid=' . $article->storyid(); } $story['counter'] = $article->counter(); $story['date'] = formatTimestamp($article->published(),$dateformat,$useroffset);
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; }