예제 #1
0
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;
}
예제 #2
0
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;
}
예제 #3
0
/**
 * 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&amp;storyid=" . $newstory->storyid() . "' target='_blank'".$htmltitle.">" . _AD_NOSUBJECT . "</a>";
            } else {
                $linktitle = "<a href='" . NW_MODULE_URL . "/submit.php?op=edit&amp;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&amp;storyid=" . $newstory->storyid() . "'>" . _EDIT. "</a> - <a href='" . NW_MODULE_URL . "/admin/index.php?op=delete&amp;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;
}
예제 #4
0
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;
}
예제 #5
0
$editor=nw_getWysiwygForm(_MA_NW_THESCOOP, 'hometext', $hometext, 15, 60, '100%', '350px', 'hometext_hidden');
$sform->addElement($editor,true);

//Extra info
//If admin -> if submit privilege
if ($approveprivilege) {
    $editor2=nw_getWysiwygForm(_AM_NW_EXTEXT, 'bodytext', $bodytext, 15, 60, '100%', '350px', 'bodytext_hidden');
	$sform->addElement($editor2,false);

    if(nw_getmoduleoption('tags', NW_MODULE_DIR_NAME)) {
		$itemIdForTag = isset($storyid) ? $storyid : 0;
		require_once XOOPS_ROOT_PATH.'/modules/tag/include/formtag.php';
		$sform->addElement(new XoopsFormTag('item_tag', 60, 255, $itemIdForTag, 0));
    }

    if(nw_getmoduleoption('metadata', NW_MODULE_DIR_NAME)) {
		$sform->addElement(new xoopsFormText(_MA_NW_META_DESCRIPTION, 'description', 50, 255, $description), false);
		$sform->addElement(new xoopsFormText(_MA_NW_META_KEYWORDS, 'keywords', 50, 255, $keywords), false);
    }
}

// Manage upload(s)
$allowupload = false;
switch ($xoopsModuleConfig['uploadgroups'])
{
	case 1: //Submitters and Approvers
		$allowupload = true;
		break;
	case 2: //Approvers only
		$allowupload = $approveprivilege ? true : false;
		break;
예제 #6
0
$xoopsTpl->assign('topics', $tbl_topics);

$xoopsTpl->assign('advertisement', nw_getmoduleoption('advertisement', NW_MODULE_DIR_NAME));

//DNPROSSI - ADDED
$xoopsTpl->assign('newsmodule_url', NW_MODULE_URL);

/**
 * Manage all the meta datas
 */
nw_CreateMetaDatas();

$xoopsTpl->assign('xoops_pagetitle', _AM_NW_TOPICS_DIRECTORY);
$meta_description = _AM_NW_TOPICS_DIRECTORY . ' - '.$myts->htmlSpecialChars($xoopsModule->name());
if(isset($xoTheme) && is_object($xoTheme)) {
	$xoTheme->addMeta( 'meta', 'description', $meta_description);
} else {	// Compatibility for old Xoops versions
	$xoopsTpl->assign('xoops_meta_description', $meta_description);
}

// DNPROSSI SEO
$seo_enabled = nw_getmoduleoption('nw_seo_enable', NW_MODULE_DIR_NAME);
if ( $seo_enabled == 1 ) {
	$xoopsTpl->assign('urlrewrite', true);
} else {
	$xoopsTpl->assign('urlrewrite', false);
}

include_once XOOPS_ROOT_PATH.'/footer.php';
?>
예제 #7
0
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;
}
예제 #8
0
//  source code which is considered copyrighted (c) material of the          //
//  original comment or credit authors.                                      //
//                                                                           //
//  This program is distributed in the hope that it will be useful,          //
//  but WITHOUT ANY WARRANTY; without even the implied warranty of           //
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            //
//  GNU General Public License for more details.                             //
//                                                                           //
//  You should have received a copy of the GNU General Public License        //
//  along with this program; if not, write to the Free Software              //
//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA //
//  ------------------------------------------------------------------------ //

/*
 * Created on 03/12/2008
 *
 * This page will display a list of articles which belong to a tag
 *
 * @package News
 * @author Hervé Thouzard of Instant Zero
 * @copyright (c) Instant Zero - http://www.instant-zero.com
 */
require_once 'header.php';
require_once NW_MODULE_PATH . '/include/functions.php';
if(!nw_getmoduleoption('tags', NW_MODULE_DIR_NAME)) {
    redirect_header('index.php', 2, _ERRORS);
    exit();
}
require_once XOOPS_ROOT_PATH.'/modules/tag/list.tag.php';
?>
예제 #9
0
	redirect_header(NW_MODULE_URL . '/article.php?storyid='.$storyid, 4, $ratemessage);
	exit();
} else {		// Display the form to vote
	$xoopsOption['template_main'] = 'nw_news_ratenews.html';
    include_once XOOPS_ROOT_PATH.'/header.php';
    $news = null;
    $news = new nw_NewsStory($storyid);
    if(is_object($news)) {
    	$title = $news->title('Show');
    } else {
		redirect_header(NW_MODULE_URL . '/index.php', 3, _ERRORS);
		exit();
    }
    //DNPROSSI - ADDED
    $xoopsTpl->assign('newsmodule_url', NW_MODULE_URL);

	$xoopsTpl->assign('advertisement', nw_getmoduleoption('advertisement', NW_MODULE_DIR_NAME));
    $xoopsTpl->assign('news', array('storyid' => $storyid, 'title' => $title));
    $xoopsTpl->assign('lang_voteonce', _MA_NW_VOTEONCE);
    $xoopsTpl->assign('lang_ratingscale', _MA_NW_RATINGSCALE);
    $xoopsTpl->assign('lang_beobjective', _MA_NW_BEOBJECTIVE);
    $xoopsTpl->assign('lang_donotvote', _MA_NW_DONOTVOTE);
    $xoopsTpl->assign('lang_rateit', _MA_NW_RATEIT);
    $xoopsTpl->assign('lang_cancel', _CANCEL);
    $xoopsTpl->assign('xoops_pagetitle',$title . ' - ' . _MA_NW_RATETHISNEWS . ' - ' .  $myts->htmlSpecialChars($xoopsModule->name()));
	nw_CreateMetaDatas();
    include_once XOOPS_ROOT_PATH.'/footer.php';
}
include_once XOOPS_ROOT_PATH.'/footer.php';
?>
예제 #10
0
/**
* 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;
}
예제 #11
0
function PrintPage()
{
	global $xoopsConfig, $xoopsModule, $story, $xoops_meta_keywords,$xoops_meta_description;
	$myts =& MyTextSanitizer::getInstance();
    $datetime = formatTimestamp($story->published(),nw_getmoduleoption('dateformat', NW_MODULE_DIR_NAME));
?>
	<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
	<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo _LANGCODE; ?>" lang="<?php echo _LANGCODE; ?>">
<?php
	echo "<head>\n";
	echo '<title>'.$myts->htmlSpecialChars($story->title()) . ' - ' . _MA_NW_PRINTER . ' - ' . $myts->htmlSpecialChars($story->topic_title()) . ' - ' . $xoopsConfig['sitename'].'</title>';
	echo '<meta http-equiv="Content-Type" content="text/html; charset='._CHARSET.'" />';
	echo '<meta name="AUTHOR" content="'.$xoopsConfig['sitename'].'" />';
	echo '<meta name="keywords" content="'.$xoops_meta_keywords.'" />';
	echo '<meta name="COPYRIGHT" content="Copyright (c) 2006 by '.$xoopsConfig['sitename'].'" />';
	echo '<meta name="DESCRIPTION" content="'.$xoops_meta_description.'" />';
	echo '<meta name="GENERATOR" content="XOOPS" />';
	$supplemental = '';
	if(nw_getmoduleoption('footNoteLinks', NW_MODULE_DIR_NAME)) {
		$supplemental = "footnoteLinks('content','content'); ";
?>
  <script type="text/javascript">
	// <![CDATA[
    /*------------------------------------------------------------------------------
    Function:       footnoteLinks()
    Author:         Aaron Gustafson (aaron at easy-designs dot net)
    Creation Date:  8 May 2005
    Version:        1.3
    Homepage:       http://www.easy-designs.net/code/footnoteLinks/
    License:        Creative Commons Attribution-ShareAlike 2.0 License
                    http://creativecommons.org/licenses/by-sa/2.0/
    Note:           This version has reduced functionality as it is a demo of
                    the script's development
    ------------------------------------------------------------------------------*/
    function footnoteLinks(containerID,targetID) {
      if (!document.getElementById ||
          !document.getElementsByTagName ||
          !document.createElement) return false;
      if (!document.getElementById(containerID) ||
          !document.getElementById(targetID)) return false;
      var container = document.getElementById(containerID);
      var target    = document.getElementById(targetID);
      var h2        = document.createElement('h2');
      addClass.apply(h2,['printOnly']);
      var h2_txt    = document.createTextNode('<?php echo _MA_NW_LINKS; ?>');
      h2.appendChild(h2_txt);
      var coll = container.getElementsByTagName('*');
      var ol   = document.createElement('ol');
      addClass.apply(ol,['printOnly']);
      var myArr = [];
      var thisLink;
      var num = 1;
      for (var i=0; i<coll.length; i++) {
        if ( coll[i].getAttribute('href') ||
             coll[i].getAttribute('cite') ) {
          thisLink = coll[i].getAttribute('href') ? coll[i].href : coll[i].cite;
          var note = document.createElement('sup');
          addClass.apply(note,['printOnly']);
          var note_txt;
          var j = inArray.apply(myArr,[thisLink]);
          if ( j || j===0 ) { // if a duplicate
            // get the corresponding number from
            // the array of used links
            note_txt = document.createTextNode(j+1);
          } else { // if not a duplicate
            var li     = document.createElement('li');
            var li_txt = document.createTextNode(thisLink);
            li.appendChild(li_txt);
            ol.appendChild(li);
            myArr.push(thisLink);
            note_txt = document.createTextNode(num);
            num++;
          }
          note.appendChild(note_txt);
          if (coll[i].tagName.toLowerCase() == 'blockquote') {
            var lastChild = lastChildContainingText.apply(coll[i]);
            lastChild.appendChild(note);
          } else {
            coll[i].parentNode.insertBefore(note, coll[i].nextSibling);
          }
        }
      }
      target.appendChild(h2);
      target.appendChild(ol);
      return true;
    }
	// ]]>
  </script>
  <script type="text/javascript">
	// <![CDATA[
    /*------------------------------------------------------------------------------
    Excerpts from the jsUtilities Library
    Version:        2.1
    Homepage:       http://www.easy-designs.net/code/jsUtilities/
    License:        Creative Commons Attribution-ShareAlike 2.0 License
                    http://creativecommons.org/licenses/by-sa/2.0/
    Note:           If you change or improve on this script, please let us know.
    ------------------------------------------------------------------------------*/
    if(Array.prototype.push == null) {
      Array.prototype.push = function(item) {
        this[this.length] = item;
        return this.length;
      };
    };
    // ---------------------------------------------------------------------
    //                  function.apply (if unsupported)
    //           Courtesy of Aaron Boodman - http://youngpup.net
    // ---------------------------------------------------------------------
    if (!Function.prototype.apply) {
      Function.prototype.apply = function(oScope, args) {
        var sarg = [];
        var rtrn, call;
        if (!oScope) oScope = window;
        if (!args) args = [];
        for (var i = 0; i < args.length; i++) {
          sarg[i] = "args["+i+"]";
        };
        call = "oScope.__applyTemp__(" + sarg.join(",") + ");";
        oScope.__applyTemp__ = this;
        rtrn = eval(call);
        oScope.__applyTemp__ = null;
    	return rtrn;
      };
    };
    function inArray(needle) {
      for (var i=0; i < this.length; i++) {
        if (this[i] === needle) {
          return i;
        }
      }
      return false;
    }
    function addClass(theClass) {
      if (this.className != '') {
        this.className += ' ' + theClass;
      } else {
        this.className = theClass;
      }
    }
    function lastChildContainingText() {
      var testChild = this.lastChild;
      var contentCntnr = ['p','li','dd'];
      while (testChild.nodeType != 1) {
        testChild = testChild.previousSibling;
      }
      var tag = testChild.tagName.toLowerCase();
      var tagInArr = inArray.apply(contentCntnr, [tag]);
      if (!tagInArr && tagInArr!==0) {
        testChild = lastChildContainingText.apply(testChild);
      }
      return testChild;
    }
	// ]]>
  </script>
  <style type="text/css" media="screen">
    .printOnly {
      display: none;
    }
  </style>
<?php
	}
	echo '</head>';
	echo '<body bgcolor="#ffffff" text="#000000" onload="'.$supplemental.' window.print()">
		<div id="content">
    	<table border="0"><tr><td align="center">
    	<table border="0" width="100%" cellpadding="0" cellspacing="1" bgcolor="#000000"><tr><td>
    	<table border="0" width="100%" cellpadding="20" cellspacing="1" bgcolor="#ffffff"><tr><td align="center">
    	<img src="'.XOOPS_URL.'/images/logo.gif" border="0" alt="" /><br /><br />
    	<h3>'.$story->title().'</h3>
    	<small><b>'._MA_NW_DATE.'</b>&nbsp;'.$datetime.' | <b>'._MA_NW_TOPICC.'</b>&nbsp;'.$myts->htmlSpecialChars($story->topic_title()).'</small><br /><br /></td></tr>';
	echo '<tr valign="top" style="font:12px;"><td>'.$story->hometext().'<br />';
	$bodytext = $story->bodytext();
	$bodytext = str_replace('[pagebreak]',"<br style=\"page-break-after:always;\" />",$bodytext);
	if ( $bodytext != '' ){
    		echo $bodytext.'<br /><br />';
	}
	echo '</td></tr></table></td></tr></table>
	<br /><br />';
	printf(_MA_NW_THISCOMESFROM,htmlspecialchars($xoopsConfig['sitename'],ENT_QUOTES));
	echo '<br /><a href="'.XOOPS_URL.'/">'.XOOPS_URL.'</a><br /><br />
    	'._MA_NW_URLFORSTORY.' <!-- Tag below can be used to display Permalink image --><!--img src="' . NW_MODULE_URL . '/images/x.gif" /--><br />
    	<a class="ignore" href="' . NW_MODULE_URL . '/article.php?storyid='.$story->storyid().'">' . NW_MODULE_URL . '/article.php?storyid='.$story->storyid().'</a>
    	</td></tr></table></div>
    	</body>
    	</html>
    	';
}
예제 #12
0
if (!isset($returnside)) {
	$returnside = isset($_POST['returnside']) ? intval($_POST['returnside']) : 0;
	if(empty($returnside))	{
		$returnside = isset($_GET['returnside']) ? intval($_GET['returnside']) : 0;
	}
}

if(!isset($returnside)) {
	$returnside = 0;
}
$sform->addElement(new XoopsFormHidden('returnside', $returnside), false);

if (!isset($type)) {
    if ($approveprivilege) {
        $type = "admin";
    }
    else {
        $type = "user";
    }
}
$type_hidden = new XoopsFormHidden('type', $type);
$sform->addElement($type_hidden);

echo '<h1>'._MA_NW_SUBMITNEWS.'</h1>';
if(xoops_trim(nw_getmoduleoption('submitintromsg', NW_MODULE_DIR_NAME)) != '') {
	echo "<div class='infotext'><br /><br />".nl2br(nw_getmoduleoption('submitintromsg', NW_MODULE_DIR_NAME))."<br /><br /></div>";
}

$sform->display();
?>
예제 #13
0
		}
		unset($xt);
	}
}

$modversion['sub'][$i]['name'] = _MI_NW_SMNAME2;
$modversion['sub'][$i]['url'] = "archive.php";
if ($cansubmit) {
	$i++;
    $modversion['sub'][$i]['name'] = _MI_NW_SMNAME1;
    $modversion['sub'][$i]['url'] = "submit.php";
}
unset($cansubmit);

include_once NW_MODULE_PATH . '/include/functions.php';
if(nw_getmoduleoption('newsbythisauthor', NW_MODULE_DIR_NAME)) {
	$i++;
	$modversion['sub'][$i]['name'] = _MI_NW_WHOS_WHO;
	$modversion['sub'][$i]['url'] = "whoswho.php";
}

$i++;
$modversion['sub'][$i]['name'] = _MI_NW_TOPICS_DIRECTORY;
$modversion['sub'][$i]['url'] = "topics_directory.php";


// Search
$modversion['hasSearch'] = 1;
$modversion['search']['file'] = "include/search.inc.php";
$modversion['search']['func'] = "nw_search";
예제 #14
0
					foreach ($_POST['delupload'] as $onefile) {
						$sfiles = new nw_sFiles($onefile);
						$sfiles->delete();
					}
				}

				if(isset($_POST['xoops_upload_file'])) {
					$fldname = $_FILES[$_POST['xoops_upload_file'][0]];
					$fldname = (get_magic_quotes_gpc()) ? stripslashes($fldname['name']) : $fldname['name'];
					if(xoops_trim($fldname!='')) {
						$sfiles = new nw_sFiles();
						$destname=$sfiles->createUploadName(NW_ATTACHED_FILES_PATH,$fldname);
						/**
						 * You can attach files to your news
						 */
						$permittedtypes = explode("\n",str_replace("\r",'',nw_getmoduleoption('mimetypes', NW_MODULE_DIR_NAME)));
						array_walk($permittedtypes, 'trim');
						$uploader = new XoopsMediaUploader( NW_ATTACHED_FILES_PATH, $permittedtypes, $xoopsModuleConfig['maxuploadsize']);
						$uploader->setTargetFileName($destname);
						if ($uploader->fetchMedia($_POST['xoops_upload_file'][0])) {
							if ($uploader->upload()) {
								$sfiles->setFileRealName($uploader->getMediaName());
								$sfiles->setStoryid($story->storyid());
								$sfiles->setMimetype($sfiles->giveMimetype(NW_ATTACHED_FILES_PATH.'/'.$uploader->getMediaName()));
								$sfiles->setDownloadname($destname);
								if(!$sfiles->store()) {
									echo _AM_NW_UPLOAD_DBERROR_SAVE;
								}
							} else {
								echo _AM_NW_UPLOAD_ERROR. ' ' . $uploader->getErrors();
							}
예제 #15
0
$filename = NW_MODULE_PATH . '/language/'.$xoopsConfig['language'].'/main.php';
if (file_exists( $filename)) {
	include_once $filename;
} else {
	include_once NW_MODULE_PATH . '/language/english/main.php';
}

$filename = XOOPS_ROOT_PATH.'/Frameworks/tcpdf/config/lang/'._LANGCODE.'.php';
if(file_exists($filename)) {
	include_once $filename;
} else {
	include_once XOOPS_ROOT_PATH.'/Frameworks/tcpdf/config/lang/en.php';
}

$dateformat = nw_getmoduleoption('dateformat', NW_MODULE_DIR_NAME);

//DNPROSSI Added - xlanguage installed and active 
$module_handler =& xoops_gethandler('module');
$xlanguage = $module_handler->getByDirname('xlanguage');
if ( is_object($xlanguage) && $xlanguage->getVar('isactive') == true ) 
{ $xlang = true; } else { $xlang = false; }  	

$content = '';
$content .= '<b><i><u>'.$myts->undoHtmlSpecialChars($article->title()).'</u></i></b><br /><b>'.$myts->undoHtmlSpecialChars($article->topic_title()).'</b><br />'._POSTEDBY.' : '.$myts->undoHtmlSpecialChars($article->uname()).'<br />'._MA_NW_POSTEDON.' '.formatTimestamp($article->published(),$dateformat).'<br /><br /><br />';
//$content .= $myts->undoHtmlSpecialChars($article->hometext()) . '<br /><br /><br />' . $myts->undoHtmlSpecialChars($article->bodytext());
//$content = str_replace('[pagebreak]','<br />',$content);
$content .= $myts->undoHtmlSpecialChars($article->hometext()) . '<br />' . $myts->undoHtmlSpecialChars($article->bodytext());
$content = str_replace('[pagebreak]','<tcpdf method="AddPage" />',$content);

//DNPROSSI Added - Get correct language and remove tags from text to be sent to PDF
예제 #16
0
function nw_search($queryarray, $andor, $limit, $offset, $userid){
	global $xoopsDB, $xoopsUser;
	include_once NW_MODULE_PATH . '/include/functions.php';
	$restricted=nw_getmoduleoption('restrictindex', NW_MODULE_DIR_NAME);
	$highlight = false;
	$highlight=nw_getmoduleoption('keywordshighlight', NW_MODULE_DIR_NAME);	// keywords highlighting

	$module_handler =& xoops_gethandler('module');
	$module =& $module_handler->getByDirname(NW_MODULE_DIR_NAME);
    $modid= $module->getVar('mid');
    $searchparam='';

	$gperm_handler =& xoops_gethandler('groupperm');
	if (is_object($xoopsUser)) {
	    $groups = $xoopsUser->getGroups();
	} else {
		$groups = XOOPS_GROUP_ANONYMOUS;
	}

	$sql = "SELECT storyid, topicid, uid, title, created FROM ".$xoopsDB->prefix('nw_stories')." WHERE (published>0 AND published<=".time().") AND (expired = 0 OR expired > ".time().') ';

	if ( $userid != 0 ) {
		$sql .= " AND uid=".$userid." ";
	}
	// because count() returns 1 even if a supplied variable
	// is not an array, we must check if $querryarray is really an array
	if ( is_array($queryarray) && $count = count($queryarray) ) {
		$sql .= " AND ((hometext LIKE '%$queryarray[0]%' OR bodytext LIKE '%$queryarray[0]%' OR title LIKE '%$queryarray[0]%' OR keywords LIKE '%$queryarray[0]%' OR description LIKE '%$queryarray[0]%')";
		for($i=1;$i<$count;$i++){
			$sql .= " $andor ";
			$sql .= "(hometext LIKE '%$queryarray[$i]%' OR bodytext LIKE '%$queryarray[$i]%' OR title LIKE '%$queryarray[$i]%' OR keywords LIKE '%$queryarray[$i]%' OR description LIKE '%$queryarray[$i]%')";
		}
		$sql .= ") ";
		// keywords highlighting
		if($highlight) {
			$searchparam='&keywords='.urlencode(trim(implode(' ',$queryarray)));
		}
	}

	$sql .= "ORDER BY created DESC";
	$result = $xoopsDB->query($sql,$limit,$offset);
	$ret = array();
	$i = 0;
 	while($myrow = $xoopsDB->fetchArray($result)){
		$display=true;
		if($modid && $gperm_handler) {
			if ($restricted && !$gperm_handler->checkRight("nw_view", $myrow['topicid'], $groups, $modid)) {
				$display=false;
			}
		}

		if ($display) {
			$ret[$i]['image'] = "images/forum.gif";
			$ret[$i]['link'] = "article.php?storyid=".$myrow['storyid']."".$searchparam;
			$ret[$i]['title'] = $myrow['title'];
			$ret[$i]['time'] = $myrow['created'];
			$ret[$i]['uid'] = $myrow['uid'];
			$i++;
		}
	}

	include_once NW_MODULE_PATH . '/config.php';
	$searchincomments = $cfg['config_search_comments'];

	if($searchincomments && (isset($limit) && $i<=$limit)) {
		include_once XOOPS_ROOT_PATH.'/include/comment_constants.php';
		$ind=$i;
		$sql = "SELECT com_id, com_modid, com_itemid, com_created, com_uid, com_title, com_text, com_status FROM ".$xoopsDB->prefix("xoopscomments")." WHERE (com_id>0) AND (com_modid=$modid) AND (com_status=".XOOPS_COMMENT_ACTIVE.") ";
		if ( $userid != 0 ) {
			$sql .= " AND com_uid=".$userid." ";
		}

		if ( is_array($queryarray) && $count = count($queryarray) ) {
			$sql .= " AND ((com_title LIKE '%$queryarray[0]%' OR com_text LIKE '%$queryarray[0]%')";
			for($i=1;$i<$count;$i++){
				$sql .= " $andor ";
				$sql .= "(com_title LIKE '%$queryarray[$i]%' OR com_text LIKE '%$queryarray[$i]%')";
			}
			$sql .= ") ";
		}
		$i=$ind;
		$sql .= "ORDER BY com_created DESC";
		$result = $xoopsDB->query($sql,$limit,$offset);
		while($myrow = $xoopsDB->fetchArray($result)) {
			$display=true;
			if($modid && $gperm_handler) {
				if ($restricted && !$gperm_handler->checkRight("nw_view", $myrow['com_itemid'], $groups, $modid)) {
					$display=false;
				}
			}
			if($i+1>$limit) {
				$display=false;
			}

			if ($display) {
				$ret[$i]['image'] = "images/forum.gif";
				$ret[$i]['link'] = "article.php?storyid=".$myrow['com_itemid']."".$searchparam;
				$ret[$i]['title'] = $myrow['com_title'];
				$ret[$i]['time'] = $myrow['com_created'];
				$ret[$i]['uid'] = $myrow['com_uid'];
				$i++;
			}
		}
	}

	return $ret;
}
예제 #17
0
/**
 * 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>&nbsp;" . _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&amp;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();
}
예제 #18
0
/**
 * Create an infotip
 *
 * @package News
 * @author Instant Zero (http://xoops.instant-zero.com)
 * @copyright (c) Instant Zero
 */
function nw_make_infotips($text)
{
	$infotips = nw_getmoduleoption('infotips', NW_MODULE_DIR_NAME);
	if($infotips>0) {
		$myts =& MyTextSanitizer::getInstance();
		return $myts->htmlSpecialChars(xoops_substr(strip_tags($text),0,$infotips));
	}
}
예제 #19
0
	/**
	 * Returns the content of the summary and the titles requires for the list selector
	 */
	function auto_summary($text, &$titles)
	{
		$auto_summary = '';
		if(nw_getmoduleoption('enhanced_pagenav', NW_MODULE_DIR_NAME)) {
	    	$expr_matches = array();
	    	$posdeb = preg_match_all('/(\[pagebreak:|\[pagebreak).*\]/iU', $text, $expr_matches);
	    	if(count($expr_matches) > 0) {
				$delimiters = $expr_matches[0];
				$arr_search = array('[pagebreak:', '[pagebreak', ']');
				$arr_replace = array('', '', '');
				$cpt = 1;
				if(isset($titles) && is_array($titles)) {
					$titles[] = strip_tags(sprintf(_MA_NW_PAGE_AUTO_SUMMARY,1, $this->title()));
				}
				$item = "<a href='".NW_MODULE_URL . '/article.php?storyid='.$this->storyid()."&page=0'>".sprintf(_MA_NW_PAGE_AUTO_SUMMARY,1, $this->title()).'</a><br />';
				$auto_summary .= $item;

				foreach($delimiters as $item) {
					$cpt++;
					$item = str_replace($arr_search, $arr_replace, $item);
					if(xoops_trim($item) == '') {
						$item = $cpt;
					}
					$titles[] = strip_tags(sprintf(_MA_NW_PAGE_AUTO_SUMMARY,$cpt, $item));
					$item = "<a href='".NW_MODULE_URL . '/article.php?storyid='.$this->storyid().'&page='.($cpt-1)."'>".sprintf(_MA_NW_PAGE_AUTO_SUMMARY,$cpt, $item).'</a><br />';
					$auto_summary .= $item;
				}
    		}
		}
		return $auto_summary;
	}
예제 #20
0
function nw_b_news_latestnews_show($options)
{
    global $xoopsTpl, $xoopsUser, $xoopsConfig;
    include_once NW_MODULE_PATH . '/include/functions.php';

    $block = array();
    
    include_once NW_MODULE_PATH . '/class/class.newsstory.php';
    include_once NW_MODULE_PATH . '/class/class.sfiles.php';
    include_once NW_MODULE_PATH . '/class/class.newstopic.php';
    include_once NW_MODULE_PATH . '/class/class.latestnews.php'; //Bandit-X
    include_once XOOPS_ROOT_PATH . '/class/tree.php';

    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';
    }

    $myts =& MyTextSanitizer::getInstance();
    $sfiles = new nw_sFiles();

    $dateformat = nw_getmoduleoption('dateformat', NW_MODULE_PATH);
    if($dateformat == '') {
		$dateformat = 's';
	}

    $limit = $options[0];
    $column_count = $options[1];
    $letters = $options[2];
    $imgwidth = $options[3];
    $imgheight = $options[4];
    $border = $options[5];
    $bordercolor = $options[6];
    $selected_stories = $options[7];
	
	$block['spec']['columnwidth'] = intval(1/$column_count*100);
    if ($options[8] == 1) {
   	    $imgposition = 'right';
    } else {
        $imgposition = 'left';
    }
    
	$xoopsTpl->assign( 'xoops_module_header' , '<style type="text/css">
	.itemText {text-align: left;} 
	.latestnews { border-bottom: 1px solid #cccccc; } 
	</style>' . $xoopsTpl->get_template_vars("xoops_module_header") );

     if (!isset($options[26])) {
        $sarray = nw_Latestnewsstory::getAllPublished($limit, $selected_stories, 0, true, 0, 0, true, $options[25], false);
    } else {
   	    $topics = array_slice($options, 26);
       	$sarray = nw_Latestnewsstory::getAllPublished($limit, $selected_stories, 0, true, $topics, 0, true, $options[25], false);
   	}

    $scount = count($sarray);
    $k = 0;
    $columns = array();
    if($scount > 0)
    {
    	$storieslist=array();
    	foreach ($sarray as $storyid => $thisstory) {
    		$storieslist[] = $thisstory->storyid();
    	}
		$filesperstory = $sfiles->getCountbyStories($storieslist);

	    foreach ($sarray as $key => $thisstory) {
            $storyid = $thisstory->storyid();
	    	$filescount = array_key_exists($thisstory->storyid(),$filesperstory) ? $filesperstory[$thisstory->storyid()] : 0;
            $published = formatTimestamp($thisstory->published(), $dateformat);
			$bodytext = $thisstory->bodytext;
			$news = $thisstory->prepare2show($filescount);
            
            $len = strlen($thisstory->hometext());
            if ($letters < $len && $letters > 0){

			$patterns = array();
			$replacements = array();
			
			if($options[4] != 0) { $height = 'height="'.$imgheight.'"'; } // set height = 0 in block option for auto height
			
            $startdiv = '<div style="float:'.$imgposition.'"><a href="' . NW_MODULE_URL . '/article.php?storyid='.$storyid.'">'; 
            $style = 'style="border: '.$border.'px solid #'.$bordercolor.'"';
			$enddiv = 'alt="'.$thisstory->title.'" width="'.$imgwidth.'" '.$height.' /></a></div>';
		
     		$patterns[] = "/\[img align=(['\"]?)(left|center|right)\\1 width=(['\"]?)([0-9]*)\\3]([^\"\(\)\?\&'<>]*)\[\/img\]/sU";
			$patterns[] = "/\[img align=(['\"]?)(left|center|right)\\1]([^\"\(\)\?\&'<>]*)\[\/img\]/sU";
			$patterns[] = "/\[img]([^\"\(\)\?\&'<>]*)\[\/img\]/sU"; 
			$patterns[] = "/<img src=\"(.*)\" \/>/sU";             
			$patterns[] = "/<img src=(.*) \/>/sU";             

			$replacements[] = $startdiv.'<img '.$style.' src="\\3" '.$enddiv;
			$replacements[] = $startdiv.'<img '.$style.' src="\\3" '.$enddiv;
			$replacements[] = $startdiv.'<img '.$style.' src="\\1" '.$enddiv;
			$replacements[] = $startdiv.'<img '.$style.' src="\\1" '.$enddiv;
			$replacements[] = $startdiv.'<img '.$style.' src="\\1" '.$enddiv;

			$letters = strrpos(substr($thisstory->hometext,0, $letters), ' ');
			$news['text'] = preg_replace($patterns, $replacements, xoops_substr($thisstory->hometext, 0, $letters + 3));
			}
			
            if(is_object($xoopsUser) && $xoopsUser->isAdmin(-1)){
                $news['admin'] = '<a href="' . NW_MODULE_URL . '/admin/index.php?op=edit&amp;storyid='.$storyid.'"><img src="' . NW_MODULE_URL . '/images/edit_block.png" alt="'._EDIT.'" width="18" /></a> <a href="' . NW_MODULE_URL . '/admin/index.php?op=delete&amp;storyid='.$storyid.'"><img src="' . NW_MODULE_URL . '/images/delete_block.png" alt="'._DELETE.'" width="20" /></a>';
            } else {
       	        $news['admin'] = '';
            }
            if ($options[9] == 1) {
        	   $block['topiclink'] = '| <a href="' . NW_MODULE_URL . '/topics_directory.php">'._AM_NW_TOPICS_DIRECTORY.'</a> ';
            }
       	    if ($options[10] == 1) {
        	   $block['archivelink'] = '| <a href="' . NW_MODULE_URL . '/archive.php">'._MA_NW_NEWSARCHIVES.'</a> ';
            }
            if ($options[11] == 1) {
                if (empty($xoopsUser))
                {
                    $block['submitlink'] = '';
                } else {
                    $block['submitlink'] = '| <a href="' . NW_MODULE_URL . '/submit.php">'._MA_NW_SUBMITNEWS.'</a> ';
                }
            }

            $news['poster'] = '';
        	if ($options[12] == 1) {
                if ( $thisstory->uname() != '' ) {
					$news['poster'] = ''._MB_NW_LATESTNEWS_POSTER.' '.$thisstory->uname().'';
				}
            }
	        $news['posttime'] = '';
            if ($options[13] == 1) {
                if ( $thisstory->uname() != '' ) {
                    $news['posttime'] = ''._ON.' '.$published.'';
                } else
                {
					$news['posttime'] = ''._MB_NW_POSTED.' '._ON.' '.$published.'';
				}
	        } 
	        $news['topic_image'] = '';
	        $news['topic_articlepicture'] = '';
			if ($options[14] == 1) {
       			$news['topic_image'] = ''.$thisstory->imglink().'';
        	}        
	        $news['topic_title'] = '';
			if ($options[15] == 1) {
       			$news['topic_title'] = ''.$thisstory->textlink().'';
       			$news['topic_separator'] =  ( $thisstory->textlink() != '' ) ? _MB_NW_SP : '';
        	}
        	
            $news['read'] = '';
			if ($options[16] == 1) {
                $news['read']= '&nbsp;('.$thisstory->counter.' '._READS.')';
        	}

            $comments = $thisstory->comments();
            if(!empty($bodytext) || $comments>0){
            	$news['more'] = '<a href="' . NW_MODULE_URL . '/article.php?storyid='.$storyid.'">'. _MA_NW_READMORE .'</a>';
			}else{
        		$news['more'] = '';
			}
			
			if ($options[17] == 1) {
				if ($comments > 0) {
				//shows 1 comment instead of 1 comm. if comments ==1
				//langugage file modified accordingly
  		            if ($comments == 1) {
						$news['comment'] ='&nbsp;'._MA_NW_ONECOMMENT.'</a>&nbsp;';
	            	} else {
						$news['comment'] ='&nbsp;'.$comments.'&nbsp;'._MB_NW_NW_COMMENTS.'</a>&nbsp;';
					}
				} else {
					$news['comment'] ='&nbsp;'._MB_NW_NO_COMMENT.'</a>&nbsp;';
				}
			}

            $news['print'] = '';
			if ($options[18] == 1) {
                $news['print']= '<a href="' . NW_MODULE_URL . '/print.php?storyid='.$storyid.'" rel="nofollow"><img src="' . NW_MODULE_URL . '/images/print.png" width="22" alt="'._MA_NW_PRINTERFRIENDLY.'" /></a>';
        	}

            $news['pdf'] = '';
			if ($options[19] == 1) {
   				 $news['pdf']= '&nbsp;<a href="' . NW_MODULE_URL . '/makepdf.php?storyid='.$storyid.'" rel="nofollow"><img src="' . NW_MODULE_URL . '/images/acrobat.png" width="20" alt="'._MA_NW_MAKEPDF.'" /></a>&nbsp;';
        	}

            $news['email'] = '';
			if ($options[20] == 1) {
                $news['email']= '<a href="mailto:?subject='.sprintf(_MA_NW_INTARTICLE,$xoopsConfig['sitename']).'&amp;body='.sprintf(_MA_NW_INTARTFOUND, $xoopsConfig['sitename']).':  ' . NW_MODULE_URL . '/article.php?storyid='.$storyid.'" rel="nofollow"><img src="' . NW_MODULE_URL . '/images/friend.png" width="20" alt="'._MA_NW_SENDSTORY.'" /></a>&nbsp;';
        	}

			if ($options[21] == 1) {
//            $block['morelink'] = '&nbsp;<a href="' . NW_MODULE_URL . '/index.php?storytopic=0&start='.$limit.'">'._MB_NW_NW_MORE_STORIES.'</A> ';
              $block['morelink'] = '&nbsp;<a href="' . NW_MODULE_URL . '/index.php ">'._MB_NW_MORE_STORIES.'</A> ';
        	}
            
	        if ($options[22] == 1) {
				$block['latestnews_scroll'] = true;
	        } else {
				$block['latestnews_scroll'] = false;
	        }
			
	        $block['scrollheight'] = $options[23];
	        $block['scrollspeed'] = $options[24];

			$columns[$k][] = $news;
            $k++;
        	if ($k == $column_count) {
	            $k = 0;
        	}
		}
 	}
    unset($news);
    $block['columns']  = $columns;
    return $block;
}
예제 #21
0
function my_highlighter ($matches) {
	$color = nw_getmoduleoption('highlightcolor', NW_MODULE_DIR_NAME);
	if(substr($color,0,1)!='#') {
		$color='#'.$color;
	}
	return '<span style="font-weight: bolder; background-color: '.$color.';">' . $matches[0] . '</span>';
}
예제 #22
0
// 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.'&nbsp;<b>'.$article->uname().'</b>&nbsp;'._DATE.'&nbsp;<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;
	}
}
?>
예제 #23
0
 * 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'];
	}
}
?>