当前位置: 首页>>代码示例>>PHP>>正文


PHP news_getmoduleoption函数代码示例

本文整理汇总了PHP中news_getmoduleoption函数的典型用法代码示例。如果您正苦于以下问题:PHP news_getmoduleoption函数的具体用法?PHP news_getmoduleoption怎么用?PHP news_getmoduleoption使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了news_getmoduleoption函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: b_news_randomnews_show

function b_news_randomnews_show($options)
{
    include_once XOOPS_ROOT_PATH . '/modules/news/include/functions.php';
    $myts =& MyTextSanitizer::getInstance();
    $block = array();
    $block['sort'] = $options[0];
    $tmpstory = new NewsStory();
    $restricted = news_getmoduleoption('restrictindex');
    $dateformat = news_getmoduleoption('dateformat');
    $infotips = news_getmoduleoption('infotips');
    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'] = news_truncate_tagsafe($myts->displayTarea($story->hometext, $html), $options[3] + 3);
            $news['infotips'] = '';
        } else {
            $news['teaser'] = '';
            if ($infotips > 0) {
                $news['infotips'] = ' title="' . news_make_infotips($story->hometext()) . '"';
            } else {
                $news['infotips'] = '';
            }
        }
        $block['stories'][] = $news;
    }
    $block['lang_read_more'] = _MB_READMORE;
    return $block;
}
开发者ID:BackupTheBerlios,项目名称:haxoo-svn,代码行数:55,代码来源:news_randomnews.php

示例2: b_news_topics_show

function b_news_topics_show()
{
    global $storytopic;
    // Don't know why this is used and where it's coming from ....
    include_once XOOPS_ROOT_PATH . '/modules/news/include/functions.php';
    include_once XOOPS_ROOT_PATH . '/modules/news/class/class.newstopic.php';
    include_once XOOPS_ROOT_PATH . "/modules/news/class/tree.php";
    $jump = XOOPS_URL . '/modules/news/index.php?storytopic=';
    $storytopic = !empty($storytopic) ? intval($storytopic) : 0;
    $restricted = news_getmoduleoption('restrictindex');
    $xt = new NewsTopic();
    $allTopics = $xt->getAllTopics($restricted);
    $topic_tree = new 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);
    return $block;
}
开发者ID:BackupTheBerlios,项目名称:haxoo-svn,代码行数:17,代码来源:news_topics.php

示例3: b_news_topicsnav_show

function b_news_topicsnav_show($options)
{
    include_once XOOPS_ROOT_PATH . '/modules/news/include/functions.php';
    include_once XOOPS_ROOT_PATH . '/modules/news/class/class.newstopic.php';
    $myts =& MyTextSanitizer::getInstance();
    $block = array();
    $newscountbytopic = array();
    $perms = '';
    $xt = new NewsTopic();
    $restricted = news_getmoduleoption('restrictindex');
    if ($restricted) {
        global $xoopsUser;
        $module_handler =& xoops_gethandler('module');
        $newsModule =& $module_handler->getByDirname('news');
        $groups = is_object($xoopsUser) ? $xoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS;
        $gperm_handler =& xoops_gethandler('groupperm');
        $topics = $gperm_handler->getItemIds('news_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->getNewsCountByTopic();
    }
    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'], 'news_count' => $count, 'topic_color' => '#' . $onetopic['topic_color'], 'title' => $myts->displayTarea($onetopic['topic_title']));
        }
    }
    return $block;
}
开发者ID:BackupTheBerlios,项目名称:haxoo-svn,代码行数:43,代码来源:news_topicsnav.php

示例4: b_news_topics_moderate

/**
 * Dispay a block where news moderators can show news that need to be moderated.
 */
function b_news_topics_moderate()
{
    include_once XOOPS_ROOT_PATH . '/modules/news/class/class.newsstory.php';
    include_once XOOPS_ROOT_PATH . '/modules/news/include/functions.php';
    $block = array();
    $dateformat = news_getmoduleoption('dateformat');
    $infotips = news_getmoduleoption('infotips');
    $storyarray = NewsStory::getAllSubmitted(0, true, news_getmoduleoption('restrictindex'));
    if (count($storyarray) > 0) {
        $block['lang_story_title'] = _MB_TITLE;
        $block['lang_story_date'] = _MB_POSTED;
        $block['lang_story_author'] = _MB_POSTER;
        $block['lang_story_action'] = _MB_ACTION;
        $block['lang_story_topic'] = _MB_TOPIC;
        $myts =& MyTextSanitizer::getInstance();
        foreach ($storyarray as $newstory) {
            $title = $newstory->title();
            $htmltitle = '';
            if ($infotips > 0) {
                $story['infotips'] = news_make_infotips($newstory->hometext());
                $htmltitle = ' title="' . $story['infotips'] . '"';
            }
            if (!isset($title) || $title == '') {
                $linktitle = "<a href='" . XOOPS_URL . "/modules/news/index.php?op=edit&amp;storyid=" . $newstory->storyid() . "' target='_blank'" . $htmltitle . ">" . _AD_NOSUBJECT . "</a>";
            } else {
                $linktitle = "<a href='" . XOOPS_URL . "/modules/news/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='" . XOOPS_URL . "/modules/news/admin/index.php?op=edit&amp;storyid=" . $newstory->storyid() . "'>" . _EDIT . "</a> - <a href='" . XOOPS_URL . "/modules/news/admin/index.php?op=delete&amp;storyid=" . $newstory->storyid() . "'>" . _MB_DELETE . "</a>";
            $story['topic_title'] = $newstory->topic_title();
            $story['topic_color'] = '#' . $myts->displayTarea($newstory->topic_color);
            $block['stories'][] =& $story;
            unset($story);
        }
    }
    return $block;
}
开发者ID:trabisdementia,项目名称:xuups,代码行数:43,代码来源:news_moderate.php

示例5: b_news_bigstory_show

function b_news_bigstory_show()
{
    include_once XOOPS_ROOT_PATH . '/modules/news/include/functions.php';
    include_once XOOPS_ROOT_PATH . '/modules/news/class/class.newsstory.php';
    $myts =& MyTextSanitizer::getInstance();
    $restricted = news_getmoduleoption('restrictindex');
    $dateformat = news_getmoduleoption('dateformat');
    $infotips = news_getmoduleoption('infotips');
    $block = array();
    $onestory = new NewsStory();
    $stories = $onestory->getBigStory(1, 0, $restricted, 0, 1, true, 'counter');
    if (count($stories) == 0) {
        $block['message'] = _MB_NEWS_NOTYET;
    } else {
        foreach ($stories as $key => $story) {
            $htmltitle = '';
            if ($infotips > 0) {
                $block['infotips'] = news_make_infotips($story->hometext());
                $htmltitle = ' title="' . $block['infotips'] . '"';
            }
            $block['htmltitle'] = $htmltitle;
            $block['message'] = _MB_NEWS_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);
        }
    }
    return $block;
}
开发者ID:trabisdementia,项目名称:xuups,代码行数:36,代码来源:news_bigstory.php

示例6: NewsStory

 * Created on 28 oct. 2006
 *
 * 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 '../../mainfile.php';
include_once XOOPS_ROOT_PATH . '/modules/news/class/class.newsstory.php';
include_once XOOPS_ROOT_PATH . '/modules/news/include/functions.php';
if (!news_getmoduleoption('firefox_microsummaries')) {
    exit;
}
$story = new NewsStory();
$restricted = news_getmoduleoption('restrictindex');
$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'];
    }
}
开发者ID:severnaya99,项目名称:Sg-2010,代码行数:31,代码来源:micro_summary.php

示例7: isset

include_once '../../mainfile.php';
include_once XOOPS_ROOT_PATH . '/modules/news/class/class.newsstory.php';
include_once XOOPS_ROOT_PATH . '/modules/news/include/functions.php';
// 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 NewsStory($com_itemid);
    if ($article->storyid > 0) {
        $com_replytext = _POSTEDBY . '&nbsp;<b>' . $article->uname() . '</b>&nbsp;' . _DATE . '&nbsp;<b>' . formatTimestamp($article->published(), news_getmoduleoption('dateformat')) . '</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;
    }
}
开发者ID:trabisdementia,项目名称:xuups,代码行数:31,代码来源:comment_new.php

示例8: array

include_once XOOPS_ROOT_PATH . '/header.php';
include_once XOOPS_ROOT_PATH . '/modules/news/class/class.newsstory.php';
include_once XOOPS_ROOT_PATH . '/language/' . $xoopsConfig['language'] . '/calendar.php';
include_once XOOPS_ROOT_PATH . '/modules/news/include/functions.php';
$lastyear = 0;
$lastmonth = 0;
$months_arr = array(1 => _CAL_JANUARY, 2 => _CAL_FEBRUARY, 3 => _CAL_MARCH, 4 => _CAL_APRIL, 5 => _CAL_MAY, 6 => _CAL_JUNE, 7 => _CAL_JULY, 8 => _CAL_AUGUST, 9 => _CAL_SEPTEMBER, 10 => _CAL_OCTOBER, 11 => _CAL_NOVEMBER, 12 => _CAL_DECEMBER);
$fromyear = isset($_GET['year']) ? intval($_GET['year']) : 0;
$frommonth = isset($_GET['month']) ? intval($_GET['month']) : 0;
$pgtitle = '';
if ($fromyear && $frommonth) {
    $pgtitle = sprintf(" - %d - %d", $fromyear, $frommonth);
}
$infotips = news_getmoduleoption('infotips');
$restricted = news_getmoduleoption('restrictindex');
$dateformat = news_getmoduleoption('dateformat');
if ($dateformat == '') {
    $dateformat = 'm';
}
$myts =& MyTextSanitizer::getInstance();
$xoopsTpl->assign('xoops_pagetitle', $myts->htmlSpecialChars(_NW_NEWSARCHIVES) . $pgtitle . ' - ' . $xoopsModule->name('s'));
$useroffset = '';
if (is_object($xoopsUser)) {
    $timezone = $xoopsUser->timezone();
    if (isset($timezone)) {
        $useroffset = $xoopsUser->timezone();
    } else {
        $useroffset = $xoopsConfig['default_TZ'];
    }
}
$result = $xoopsDB->query('SELECT published FROM ' . $xoopsDB->prefix('stories') . ' WHERE (published>0 AND published<=' . time() . ') AND (expired = 0 OR expired <= ' . time() . ') ORDER BY published DESC');
开发者ID:BackupTheBerlios,项目名称:haxoo-svn,代码行数:31,代码来源:archive.php

示例9: auto_summary

 /**
  * Returns the content of the summary and the titles requires for the list selector
  */
 function auto_summary($text, &$titles)
 {
     $auto_summary = '';
     if (news_getmoduleoption('enhanced_pagenav')) {
         $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(_NW_PAGE_AUTO_SUMMARY, 1, $this->title()));
             }
             $item = "<a href='" . XOOPS_URL . '/modules/news/article.php?storyid=' . $this->storyid() . "&page=0'>" . sprintf(_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(_NW_PAGE_AUTO_SUMMARY, $cpt, $item));
                 $item = "<a href='" . XOOPS_URL . '/modules/news/article.php?storyid=' . $this->storyid() . '&page=' . ($cpt - 1) . "'>" . sprintf(_NW_PAGE_AUTO_SUMMARY, $cpt, $item) . '</a><br />';
                 $auto_summary .= $item;
             }
         }
     }
     return $auto_summary;
 }
开发者ID:BackupTheBerlios,项目名称:haxoo-svn,代码行数:33,代码来源:class.newsstory.php

示例10: news_make_infotips

/**
 * Create an infotip
 *
 * @package News
 * @author Instant Zero (http://xoops.instant-zero.com)
 * @copyright (c) Instant Zero
 */
function news_make_infotips($text)
{
    $infotips = news_getmoduleoption('infotips');
    if ($infotips > 0) {
        $myts =& MyTextSanitizer::getInstance();
        return $myts->htmlSpecialChars(xoops_substr(strip_tags($text), 0, $infotips));
    }
}
开发者ID:mambax7,项目名称:xoopseditors,代码行数:15,代码来源:functions.php

示例11: PrintPage

function PrintPage()
{
    global $xoopsConfig, $xoopsModule, $story, $xoops_meta_keywords, $xoops_meta_description;
    $myts =& MyTextSanitizer::getInstance();
    $datetime = formatTimestamp($story->published(), news_getmoduleoption('dateformat'));
    ?>
<!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()) . ' - ' . _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 (news_getmoduleoption('footNoteLinks')) {
        $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 _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[
//.........这里部分代码省略.........
开发者ID:trabisdementia,项目名称:xuups,代码行数:101,代码来源:print.php

示例12: unset

                $i++;
            }
        }
        unset($xt);
    }
}
$modversion['sub'][$i]['name'] = _MI_NEWS_SMNAME2;
$modversion['sub'][$i]['url'] = "archive.php";
if ($cansubmit) {
    $i++;
    $modversion['sub'][$i]['name'] = _MI_NEWS_SMNAME1;
    $modversion['sub'][$i]['url'] = "submit.php";
}
unset($cansubmit);
include_once XOOPS_ROOT_PATH . '/modules/news/include/functions.php';
if (news_getmoduleoption('newsbythisauthor')) {
    $i++;
    $modversion['sub'][$i]['name'] = _MI_NEWS_WHOS_WHO;
    $modversion['sub'][$i]['url'] = "whoswho.php";
}
$i++;
$modversion['sub'][$i]['name'] = _MI_NEWS_TOPICS_DIRECTORY;
$modversion['sub'][$i]['url'] = "topics_directory.php";
// Search
$modversion['hasSearch'] = 1;
$modversion['search']['file'] = "include/search.inc.php";
$modversion['search']['func'] = "news_search";
// Comments
$modversion['hasComments'] = 1;
$modversion['comments']['pageName'] = 'article.php';
$modversion['comments']['itemName'] = 'storyid';
开发者ID:BackupTheBerlios,项目名称:haxoo-svn,代码行数:31,代码来源:xoops_version.php

示例13: my_highlighter

function my_highlighter($matches)
{
    $color = news_getmoduleoption('highlightcolor');
    if (substr($color, 0, 1) != '#') {
        $color = '#' . $color;
    }
    return '<span style="font-weight: bolder; background-color: ' . $color . ';">' . $matches[0] . '</span>';
}
开发者ID:trabisdementia,项目名称:xuups,代码行数:8,代码来源:article.php

示例14: isset

include_once XOOPS_ROOT_PATH . '/class/template.php';
include_once XOOPS_ROOT_PATH . '/modules/news/class/class.newsstory.php';
include_once XOOPS_ROOT_PATH . '/modules/news/class/class.newstopic.php';
include_once XOOPS_ROOT_PATH . '/modules/news/include/functions.php';
if (!news_getmoduleoption('topicsrss')) {
    exit;
}
$topicid = isset($_GET['topicid']) ? intval($_GET['topicid']) : 0;
if ($topicid == 0) {
    exit;
}
if (function_exists('mb_http_output')) {
    mb_http_output('pass');
}
$restricted = news_getmoduleoption('restrictindex');
$newsnumber = news_getmoduleoption('storyhome');
$charset = 'utf-8';
header('Content-Type:text/xml; charset=' . $charset);
$story = new NewsStory();
$tpl = new XoopsTpl();
$tpl->xoops_setCaching(2);
$tpl->xoops_setCacheTime(3600);
// Change this to the value you want
if (!$tpl->is_cached('db:news_rss.html', $topicid)) {
    $xt = new NewsTopic($topicid);
    $sarray = $story->getAllPublished($newsnumber, 0, $restricted, $topicid);
    if (is_array($sarray) && count($sarray) > 0) {
        $sitename = htmlspecialchars($xoopsConfig['sitename'], ENT_QUOTES);
        $slogan = htmlspecialchars($xoopsConfig['slogan'], ENT_QUOTES);
        $tpl->assign('channel_title', xoops_utf8_encode($sitename));
        $tpl->assign('channel_link', XOOPS_URL . '/');
开发者ID:severnaya99,项目名称:Sg-2010,代码行数:31,代码来源:backendt.php

示例15: Stats

/**
 * Statistics about stories, topics and authors
 *
 * You can reach the statistics from the admin part of the news module by clicking on the "Statistics" tabs
 * The number of visible elements in each table is equal to the module's option called "storycountadmin"
 * There are 3 kind of different statistics :
 * - Topics statistics
 *   For each topic you can see its number of articles, the number of time each topics was viewed, the number
 *   of attached files, the number of expired articles and the number of unique authors.
 * - Articles statistics
 *   This part is decomposed in 3 tables :
 *   a) Most readed articles
 *      This table resumes, for all the news in your database, the most readed articles.
 *      The table contains, for each news, its topic, its title, the author and the number of views.
 *   b) Less readed articles
 *      That's the opposite action of the previous table and its content is the same
 *   c) Best rated articles
 *      You will find here the best rated articles, the content is the same that the previous tables, the last column is just changing and contains the article's rating
 * - Authors statistics
 *   This part is also decomposed in 3 tables
 *   a) Most readed authors
 *		To create this table, the program compute the total number of reads per author and displays the most readed author and the number of views
 *   b) Best rated authors
 *      To created this table's content, the program compute the rating's average of each author and create a table
 *   c) Biggest contributors
 *      The goal of this table is to know who is creating the biggest number of articles.
 */
function Stats()
{
    global $xoopsModule, $xoopsConfig;
    xoops_cp_header();
    $myts =& MyTextSanitizer::getInstance();
    if (file_exists(XOOPS_ROOT_PATH . '/modules/news/language/' . $xoopsConfig['language'] . '/main.php')) {
        include_once XOOPS_ROOT_PATH . '/modules/news/language/' . $xoopsConfig['language'] . '/main.php';
    } else {
        include_once XOOPS_ROOT_PATH . '/modules/news/language/english/main.php';
    }
    adminmenu(6);
    $news = new NewsStory();
    $stats = array();
    $stats = $news->GetStats(news_getmoduleoption('storycountadmin'));
    $totals = array(0, 0, 0, 0, 0);
    printf("<h1>%s</h1>\n", _AM_NEWS_STATS);
    // First part of the stats, everything about topics
    $storiespertopic = $stats['storiespertopic'];
    $readspertopic = $stats['readspertopic'];
    $filespertopic = $stats['filespertopic'];
    $expiredpertopic = $stats['expiredpertopic'];
    $authorspertopic = $stats['authorspertopic'];
    $class = '';
    echo "<div style='text-align: center;'><b>" . _AM_NEWS_STATS0 . "</b><br />\n";
    echo "<table border='0' width='100%'><tr class='bg3'><td align='center'>" . _AM_TOPIC . "</td><td align='center'>" . _NW_ARTICLES . "</td><td>" . _NW_VIEWS . "</td><td>" . _AM_UPLOAD_ATTACHFILE . "</td><td>" . _AM_EXPARTS . "</td><td>" . _AM_NEWS_STATS1 . "</td></tr>";
    foreach ($storiespertopic as $topicid => $data) {
        $url = XOOPS_URL . '/modules/' . $xoopsModule->dirname() . '/index.php?storytopic=' . $topicid;
        $views = 0;
        if (array_key_exists($topicid, $readspertopic)) {
            $views = $readspertopic[$topicid];
        }
        $attachedfiles = 0;
        if (array_key_exists($topicid, $filespertopic)) {
            $attachedfiles = $filespertopic[$topicid];
        }
        $expired = 0;
        if (array_key_exists($topicid, $expiredpertopic)) {
            $expired = $expiredpertopic[$topicid];
        }
        $authors = 0;
        if (array_key_exists($topicid, $authorspertopic)) {
            $authors = $authorspertopic[$topicid];
        }
        $articles = $data['cpt'];
        $totals[0] += $articles;
        $totals[1] += $views;
        $totals[2] += $attachedfiles;
        $totals[3] += $expired;
        $class = $class == 'even' ? 'odd' : 'even';
        printf("<tr class='" . $class . "'><td align='left'><a href='%s' target ='_blank'>%s</a></td><td align='right'>%u</td><td align='right'>%u</td><td align='right'>%u</td><td align='right'>%u</td><td align='right'>%u</td></tr>\n", $url, $myts->displayTarea($data['topic_title']), $articles, $views, $attachedfiles, $expired, $authors);
    }
    $class = $class == 'even' ? 'odd' : 'even';
    printf("<tr class='" . $class . "'><td align='center'><b>%s</b></td><td align='right'><b>%u</b></td><td align='right'><b>%u</b></td><td align='right'><b>%u</b></td><td align='right'><b>%u</b></td><td>&nbsp;</td>\n", _AM_NEWS_STATS2, $totals[0], $totals[1], $totals[2], $totals[3]);
    echo '</table></div><br /><br /><br />';
    // Second part of the stats, everything about stories
    // a) Most readed articles
    $mostreadednews = $stats['mostreadednews'];
    echo "<div style='text-align: center;'><b>" . _AM_NEWS_STATS3 . '</b><br /><br />' . _AM_NEWS_STATS4 . "<br />\n";
    echo "<table border='0' width='100%'><tr class='bg3'><td align='center'>" . _AM_TOPIC . "</td><td align='center'>" . _AM_TITLE . "</td><td>" . _AM_POSTER . "</td><td>" . _NW_VIEWS . "</td></tr>\n";
    foreach ($mostreadednews as $storyid => $data) {
        $url1 = XOOPS_URL . '/modules/' . $xoopsModule->dirname() . '/index.php?storytopic=' . $data['topicid'];
        $url2 = XOOPS_URL . '/modules/' . $xoopsModule->dirname() . '/article.php?storyid=' . $storyid;
        $url3 = XOOPS_URL . '/userinfo.php?uid=' . $data['uid'];
        $class = $class == 'even' ? 'odd' : 'even';
        printf("<tr class='" . $class . "'><td align='left'><a href='%s' target ='_blank'>%s</a></td><td align='left'><a href='%s' target='_blank'>%s</a></td><td><a href='%s' target='_blank'>%s</a></td><td align='right'>%u</td></tr>\n", $url1, $myts->displayTarea($data['topic_title']), $url2, $myts->displayTarea($data['title']), $url3, $myts->htmlSpecialChars($news->uname($data['uid'])), $data['counter']);
    }
    echo '</table>';
    // b) Less readed articles
    $lessreadednews = $stats['lessreadednews'];
    echo '<br /><br />' . _AM_NEWS_STATS5;
    echo "<table border='0' width='100%'><tr class='bg3'><td align='center'>" . _AM_TOPIC . "</td><td align='center'>" . _AM_TITLE . "</td><td>" . _AM_POSTER . "</td><td>" . _NW_VIEWS . "</td></tr>\n";
    foreach ($lessreadednews as $storyid => $data) {
        $url1 = XOOPS_URL . '/modules/' . $xoopsModule->dirname() . '/index.php?storytopic=' . $data['topicid'];
//.........这里部分代码省略.........
开发者ID:severnaya99,项目名称:Sg-2010,代码行数:101,代码来源:index.php


注:本文中的news_getmoduleoption函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。