コード例 #1
0
	/**
	 * 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']).'&amp;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;
	}
コード例 #2
0
ファイル: article.php プロジェクト: severnaya99/Sg-2010
}
if (!$gperm_handler->checkRight('nw_view', $article->topicid(), $groups, $xoopsModule->getVar('mid'))) {
	redirect_header(NW_MODULE_URL . '/index.php', 3, _NOPERM);
	exit();
}

$storypage = isset($_GET['page']) ? intval($_GET['page']) : 0;
$dateformat = nw_getmoduleoption('dateformat', NW_MODULE_DIR_NAME);
$hcontent='';

/**
 * update counter only when viewing top page and when you are not the author or an admin
 */
if (empty($_GET['com_id']) && $storypage == 0) {
	if(is_object($xoopsUser)) {
		if( ($xoopsUser->getVar('uid')==$article->uid()) || nw_is_admin_group()) {
			// nothing ! ;-)
		} else {
    		$article->updateCounter();
    	}
    } else {
        $article->updateCounter();
	}
}
$xoopsOption['template_main'] = 'nw_news_article.html';
include_once XOOPS_ROOT_PATH.'/header.php';

//DNPROSSI - ADDED
nw_callJavascriptFile('noconflict.js');
$xoTheme->addStylesheet(NW_MODULE_URL.'/js/css/prettyPhoto.css');
nw_callJavascriptFile('prettyphoto/jquery.prettyPhoto.js');
コード例 #3
0
ファイル: submit.php プロジェクト: severnaya99/Sg-2010
        $published = $story->published();
        if (isset($published) && $published > 0) {
            $approve = 1;
        }
        if ( $story -> published() != 0) {
            $published = $story->published();
        }
		if ( $story -> expired() != 0) {
            $expired = $story->expired();
        } else {
            $expired = 0;
        }
		$type = $story -> type();
        $topicdisplay = $story -> topicdisplay();
        $topicalign = $story -> topicalign( false );
        if(!nw_is_admin_group()) {
        	include_once NW_MODULE_PATH . '/include/storyform.inc.php';
        } else {
        	include_once NW_MODULE_PATH . '/include/storyform.original.php';
        }
        echo'</td></tr></table>';
        break;

	case 'preview':
		$topic_id = intval($_POST['topic_id']);
		$xt = new nw_NewsTopic($topic_id);
		if(isset($_GET['storyid'])) {
			$storyid=intval($_GET['storyid']);
		} else {
			if(isset($_POST['storyid'])) {
				$storyid=intval($_POST['storyid']);