⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 news_top.php

📁 在综合英文版XOOPS 2.09, 2.091, 2.092 的基础上正式发布XOOPS 2.09中文版 XOOPS 2.09x 版主要是PHP5升级、bug修正和安全补正: 1 全面兼容PHP 5.
💻 PHP
字号:
<?php// $Id: news_top.php,v 1.12 2004/06/18 11:01:23 mithyt2 Exp $//  ------------------------------------------------------------------------ ////                XOOPS - PHP Content Management System                      ////                    Copyright (c) 2000 XOOPS.org                           ////                       <http://www.xoops.org/>                             //// ------------------------------------------------------------------------- ////  This program is free software; you can redistribute it and/or modify     ////  it under the terms of the GNU General Public License as published by     ////  the Free Software Foundation; either version 2 of the License, or        ////  (at your option) any later version.                                      ////                                                                           ////  You may not change or alter any portion of this comment or credits       ////  of supporting developers from this source code or any supporting         ////  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 ////  ------------------------------------------------------------------------ //function b_news_top_show($options) {    global $xoopsDB;    $myts =& MyTextSanitizer::getInstance();    include_once XOOPS_ROOT_PATH."/modules/news/class/class.newsstory.php";    $block = array();    if ( $options[7] == 0 ) {        $stories = NewsStory::getAllPublished($options[1],0,false,0,1, true, $options[0]);    }    else {        $topics = array_slice($options, 7);        $stories = NewsStory::getAllPublished($options[1],0,false,$topics, 1, true, $options[0]);    }    $isSetSpotlight = 0; // to be used to remember the newest story    foreach ( $stories as $key => $story ) {        $news = array();        $title = $story->title();		if (strlen($title) >= $options[2]) {			$title = xoops_substr($title,0,($options[2]-1));		}        //if spotlight is enabled and this is either the first article or the selected one        //if (($options[4] == 1) && (($options[5] > 0 && $options[5] == $story->storyid()) || ($key == 0))) {        if ( !empty($options[4])        	 && ( (!empty($options[5]) && $options[5] == $story->storyid()) || (empty($options[5]) && empty($isSetSpotlight)) )        ) {            $spotlight = array();            $spotlight['title'] = $title;            $spotlight['id'] = $story->storyid();            $spotlight['date'] = formatTimestamp($story->published(), "s");            $spotlight['hits'] = intval($story->counter());        	$spotlight['text'] = $story->hometext();            if (!empty($options[6])) {        		$dohtml = ($story->nohtml() ==0)?1:0;                $spotlight['image'] = $myts->displayTarea($options[6], $dohtml);            }            $block['spotlight'] = $spotlight;            $isSetSpotlight = 1;        }        else {            $news['title'] = $title;            $news['id'] = $story->storyid();        	$news['count'] = ( strtolower($options[0]) == "counter" )? intval($story->counter()):formatTimestamp($story->published(),"s");            if ($options[3] > 0) {                $news['teaser'] = xoops_substr($story->hometext('InForm'), 0, $options[3]-1);            }            else {                $news['teaser'] = "";            }            $block['stories'][] = $news;        }    }    //If spotlight article was not in the fetched stories    if (!empty($options[4]) && empty($isSetSpotlight) && !empty($options[5])) {        $spotlightArticle = new NewsStory($options[5]);        $spotlight = array();        $spotlight['title'] = xoops_substr($spotlightArticle->title(),0,($options[2]-1));;        $spotlight['text'] = $spotlightArticle->hometext();        $spotlight['id'] = $spotlightArticle->storyid();        $spotlight['date'] = formatTimestamp($spotlightArticle->published(), "s");        $spotlight['hits'] = intval($spotlightArticle->counter());        if (!empty($options[6])) {        	$dohtml = ($story->nohtml() ==0)?1:0;            $spotlight['image'] = $myts->displayTarea($options[6], $dohtml);        }        $block['spotlight'] = $spotlight;    }    return $block;}function b_news_top_edit($options) {    global $xoopsDB;    $form = ""._MB_NEWS_ORDER."&nbsp;<select name='options[0]'>";    $form .= "<option value='published'";    if ( $options[0] == "published" ) {        $form .= " selected='selected'";    }    $form .= ">"._MB_NEWS_DATE."</option>\n";    $form .= "<option value='counter'";    if($options[0] == "counter"){        $form .= " selected='selected'";    }    $form .= ">"._MB_NEWS_HITS."</option>\n";    $form .= "</select>\n";    $form .= "&nbsp;"._MB_NEWS_DISP."&nbsp;<input type='text' name='options[1]' value='".$options[1]."'/>&nbsp;"._MB_NEWS_ARTCLS."";    $form .= "&nbsp;<br><br />"._MB_NEWS_CHARS."&nbsp;<input type='text' name='options[2]' value='".$options[2]."'/>&nbsp;"._MB_NEWS_LENGTH."<br /><br />";    $form .= _MB_NEWS_TEASER." <input type='text' name='options[3]' value='".$options[3]."' />"._MB_NEWS_LENGTH;    $form .= "<br /><br />";    $form .= _MB_NEWS_SPOTLIGHT." <input type='radio' name='options[4]' value='1'";    if ($options[4] == 1) {        $form .= " checked='checked'";    }    $form .= " />"._YES;    $form .= "<input type='radio' name='options[4]' value='0'";    if ($options[4] == 0) {        $form .= " checked='checked'";    }    $form .= " />"._NO;    $form .= "<br /><br />";    include_once XOOPS_ROOT_PATH."/modules/news/class/class.newsstory.php";    $articles = NewsStory::getAllPublished(0,0,false,0,0,false);    $form .= "<select id='options[5]' name ='options[5]'>";    $form .= "<option value='0'>"._MB_NEWS_FIRST."</option>";    foreach ($articles as $storyid => $storytitle) {        $sel = "";        if ($options[5] == $storyid) {            $sel = " selected='selected'";        }        $form .= "<option value='$storyid'$sel>".$storytitle."</option>";    }    $form .= "</select><br /><br />";    $options[6] = (strlen($options[6])<5)?'':strval($options[6]);    $form .= _MB_NEWS_IMAGE."&nbsp;<input type='text' id='spotlightimage' name='options[6]' value='".$options[6]."' size='50'/>";    $form .= "<img onmouseover='style.cursor=\"hand\"' onclick='javascript:openWithSelfMain(\"".XOOPS_URL."/imagemanager.php?target=spotlightimage\",\"imgmanager\",400,430);' src='".XOOPS_URL."/images/image.gif' alt='image' />";    $form .= "<br /><br /><br /><select id='options[7]' name='options[7]' multiple='multiple'>";    include_once XOOPS_ROOT_PATH."/class/xoopsstory.php";    $xt = new XoopsTopic($xoopsDB->prefix("topics"));    $alltopics = $xt->getTopicsList();    $alltopics[0]['title'] = "所有类别";    ksort($alltopics);    $size = count($options);    foreach ($alltopics as $topicid => $topic) {        $sel = "";        for ( $i = 7; $i < $size; $i++ ) {            if ($options[$i] == $topicid) {                $sel = " selected='selected'";            }        }        $form .= "<option value='$topicid'$sel>".$topic['title']."</option>";    }    $form .= "</select><br />";    return $form;}?>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -