本文整理汇总了PHP中NewsStory类的典型用法代码示例。如果您正苦于以下问题:PHP NewsStory类的具体用法?PHP NewsStory怎么用?PHP NewsStory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了NewsStory类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: news_com_update
function news_com_update($story_id, $total_num)
{
$article = new NewsStory($story_id);
if (!$article->updateComments($total_num)) {
return false;
}
return true;
}
开发者ID:BackupTheBerlios,项目名称:soopa,代码行数:8,代码来源:comment_functions.php
示例2: 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
示例3: allHeadlines
function allHeadlines()
{
$s = new NewsStory();
$s->orderBy('date desc, rank desc, id desc');
$res = $s->find(array());
$out = array();
foreach ($res as $story) {
if (strlen($story->title) > 33) {
$story->title = substr($story->title, 0, 30) . '...';
}
$out[$story->id] = Date::format($story->date, 'm/d') . ' - ' . $story->title;
}
return $out;
}
开发者ID:vojtajina,项目名称:sitellite,代码行数:14,代码来源:Story.php
示例4: b_marquee_news
function b_marquee_news($limit, $dateformat, $itemssize)
{
include_once XOOPS_ROOT_PATH . '/modules/marquee/include/functions.php';
include_once XOOPS_ROOT_PATH . '/modules/news/class/class.newsstory.php';
$block = $stories = array();
$story = new NewsStory();
$restricted = marquee_getmoduleoption('restrictindex', 'news');
$stories = $story->getAllPublished($limit, 0, $restricted, 0, 1, true, 'published');
if (count($stories) > 0) {
foreach ($stories as $onestory) {
if ($itemssize > 0) {
$title = xoops_substr($onestory->title(), 0, $itemssize + 3);
} else {
$title = $onestory->title();
}
$block[] = array('date' => formatTimestamp($onestory->published(), $dateformat), 'category' => $onestory->topic_title(), 'author' => $onestory->uid(), 'title' => $title, 'link' => "<a href='" . XOOPS_URL . '/modules/news/article.php?storyid=' . $onestory->storyid() . "'>" . $title . '</a>');
}
}
return $block;
}
开发者ID:BackupTheBerlios,项目名称:haxoo-svn,代码行数:20,代码来源:news.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 = getmoduleoption('restrictindex');
$dateformat = getmoduleoption('dateformat');
$infotips = 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'] = xoops_substr(strip_tags($story->hometext()), 0, $infotips);
$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:BackupTheBerlios,项目名称:soopa,代码行数:36,代码来源:news_bigstory.php
示例6: news_tag_iteminfo
function news_tag_iteminfo(&$items)
{
if (empty($items) || !is_array($items)) {
return false;
}
$items_id = array();
foreach (array_keys($items) as $cat_id) {
foreach (array_keys($items[$cat_id]) as $item_id) {
$items_id[] = intval($item_id);
}
}
require_once XOOPS_ROOT_PATH . '/modules/news/class/class.newsstory.php';
$tempNews = new NewsStory();
$items_obj = $tempNews->getStoriesByIds($items_id);
foreach (array_keys($items) as $cat_id) {
foreach (array_keys($items[$cat_id]) as $item_id) {
if (isset($items_obj[$item_id])) {
$item_obj =& $items_obj[$item_id];
$items[$cat_id][$item_id] = array('title' => $item_obj->title(), 'uid' => $item_obj->uid(), 'link' => "article.php?storyid={$item_id}", 'time' => $item_obj->published(), 'tags' => '', 'content' => '');
}
}
}
unset($items_obj);
}
开发者ID:BackupTheBerlios,项目名称:haxoo-svn,代码行数:24,代码来源:news.php
示例7: b_news_topics_moderate
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 = getmoduleoption('dateformat');
$infotips = getmoduleoption('infotips');
$storyarray = NewsStory::getAllSubmitted(0, true, 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'] = xoops_substr(strip_tags($newstory->hometext()), 0, $infotips);
$htmltitle = ' title="' . $story['infotips'] . '"';
}
if (!isset($title) || $title == "") {
$linktitle = "<a href='" . XOOPS_URL . "/modules/news/index.php?op=edit&storyid=" . $newstory->storyid() . "' target='_blank'" . $htmltitle . ">" . _AD_NOSUBJECT . "</a>";
} else {
$linktitle = "<a href='" . XOOPS_URL . "/modules/news/submit.php?op=edit&storyid=" . $newstory->storyid() . "' target='_blank'" . $htmltitle . ">" . $title . "</a>";
}
$story = array();
$story['title'] = $linktitle;
$story['date'] = formatTimestamp($newstory->created(), $dateformat);
$story['author'] = "<a href='" . XOOPS_URL . "/userinfo.php?uid=" . $newstory->uid() . "'>" . $newstory->uname() . "</a>";
$story['action'] = "<a href='" . XOOPS_URL . "/modules/news/admin/index.php?op=delete&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:BackupTheBerlios,项目名称:soopa,代码行数:40,代码来源:news_moderate.php
示例8: PrintPage
function PrintPage($storyid)
{
global $xoopsConfig, $xoopsModule;
$story = new NewsStory($storyid);
$datetime = formatTimestamp($story->published());
echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">';
echo '<html><head>';
echo '<meta http-equiv="Content-Type" content="text/html; charset=' . _CHARSET . '" />';
echo '<title>' . $xoopsConfig['sitename'] . '</title>';
echo '<meta name="AUTHOR" content="' . $xoopsConfig['sitename'] . '" />';
echo '<meta name="COPYRIGHT" content="Copyright (c) 2001 by ' . $xoopsConfig['sitename'] . '" />';
echo '<meta name="DESCRIPTION" content="' . $xoopsConfig['slogan'] . '" />';
echo '<meta name="GENERATOR" content="' . XOOPS_VERSION . '" />';
echo '<body bgcolor="#ffffff" text="#000000" onload="window.print()">
<table border="0"><tr><td align="center">
<table border="0" width="640" cellpadding="0" cellspacing="1" bgcolor="#000000"><tr><td>
<table border="0" width="640" 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>' . _NW_DATE . '</b> ' . $datetime . ' | <b>' . _NW_TOPICC . '</b> ' . $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(_NW_THISCOMESFROM, $xoopsConfig['sitename']);
echo '<br /><a href="' . XOOPS_URL . '/">' . XOOPS_URL . '</a><br /><br />
' . _NW_URLFORSTORY . ' <!-- Tag below can be used to display Permalink image --><!--img src="' . XOOPS_URL . '/modules/' . $xoopsModule->dirname() . '/images/x.gif" /--><br />
<a href="' . XOOPS_URL . '/modules/' . $xoopsModule->dirname() . '/article.php?storyid=' . $story->storyid() . '">' . XOOPS_URL . '/article.php?storyid=' . $story->storyid() . '</a>
</td></tr></table>
</body>
</html>
';
}
开发者ID:amjadtbssm,项目名称:website,代码行数:37,代码来源:print.php
示例9: 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 . ' <b>' . $article->uname() . '</b> ' . _DATE . ' <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
示例10: mktime
}
if ($fromyear != 0 && $frommonth != 0) {
$xoopsTpl->assign('show_articles', true);
$xoopsTpl->assign('lang_articles', _NW_ARTICLES);
$xoopsTpl->assign('currentmonth', $months_arr[$frommonth]);
$xoopsTpl->assign('currentyear', $fromyear);
$xoopsTpl->assign('lang_actions', _NW_ACTIONS);
$xoopsTpl->assign('lang_date', _NW_DATE);
$xoopsTpl->assign('lang_views', _NW_VIEWS);
// must adjust the selected time to server timestamp
$timeoffset = $useroffset - $xoopsConfig['server_TZ'];
$monthstart = mktime(0 - $timeoffset, 0, 0, $frommonth, 1, $fromyear);
$monthend = mktime(23 - $timeoffset, 59, 59, $frommonth + 1, 0, $fromyear);
$monthend = $monthend > time() ? time() : $monthend;
$count = 0;
$news = new NewsStory();
$storyarray = $news->getArchive($monthstart, $monthend, $restricted);
$count = count($storyarray);
if (is_array($storyarray) && $count > 0) {
foreach ($storyarray as $article) {
$story = array();
$htmltitle = '';
if ($infotips > 0) {
$story['infotips'] = news_make_infotips($article->hometext());
$htmltitle = ' title="' . $story['infotips'] . '"';
}
$story['title'] = "<a href='" . XOOPS_URL . '/modules/news/index.php?storytopic=' . $article->topicid() . "'>" . $article->topic_title() . "</a>: <a href='" . XOOPS_URL . "/modules/news/article.php?storyid=" . $article->storyid() . "'" . $htmltitle . ">" . $article->title() . "</a>";
$story['counter'] = $article->counter();
$story['date'] = formatTimestamp($article->published(), $dateformat, $useroffset);
$story['print_link'] = XOOPS_URL . '/modules/news/print.php?storyid=' . $article->storyid();
$story['mail_link'] = 'mailto:?subject=' . sprintf(_NW_INTARTICLE, $xoopsConfig['sitename']) . '&body=' . sprintf(_NW_INTARTFOUND, $xoopsConfig['sitename']) . ': ' . XOOPS_URL . '/modules/' . $xoopsModule->dirname() . '/article.php?storyid=' . $article->storyid();
开发者ID:BackupTheBerlios,项目名称:haxoo-svn,代码行数:31,代码来源:archive.php
示例11: header
<?php
if (@file_exists('inc/app/sitesearch/data/sitesearch.pid')) {
header('Location: ' . site_prefix() . '/index/sitesearch-app?ctype=sitellite_news&show_types=yes');
exit;
}
if ($box['context'] == 'action') {
page_title(intl_get('News Search'));
}
if (!$parameters['query']) {
echo template_simple('search.spt', $parameters);
return;
}
loader_import('news.Functions');
loader_import('news.Story');
$story = new NewsStory();
if (!$parameters['limit']) {
$parameters['limit'] = 10;
}
if (!$parameters['offset']) {
$parameters['offset'] = 0;
}
$story->limit($parameters['limit']);
$story->offset($parameters['offset']);
loader_import('help.Help');
$params = array();
foreach (help_split_query($parameters['query']) as $item) {
$q = db_quote('%' . $item . '%');
$params[] = 'title like ' . $q . ' or
summary like ' . $q . ' or
body like ' . $q;
开发者ID:vojtajina,项目名称:sitellite,代码行数:31,代码来源:index.php
示例12: redirect_header
* @author Instant Zero
* @copyright (c) Instant Zero - http://www.instant-zero.com
*/
include_once '../../mainfile.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/class/class.sfiles.php';
include_once XOOPS_ROOT_PATH . '/modules/news/include/functions.php';
if (!news_getmoduleoption('newsbythisauthor')) {
redirect_header('index.php', 2, _ERRORS);
exit;
}
$xoopsOption['template_main'] = 'news_whos_who.html';
include_once XOOPS_ROOT_PATH . '/header.php';
$option = news_getmoduleoption('displayname');
$article = new NewsStory();
$uid_ids = array();
$uid_ids = $article->getWhosWho(news_getmoduleoption('restrictindex'));
if (count($uid_ids) > 0) {
$lst_uid = implode(',', $uid_ids);
$member_handler =& xoops_gethandler('member');
$critere = new Criteria('uid', '(' . $lst_uid . ')', 'IN');
$tbl_users = $member_handler->getUsers($critere);
foreach ($tbl_users as $one_user) {
$uname = '';
switch ($option) {
case 1:
// Username
$uname = $one_user->getVar('uname');
break;
case 2:
开发者ID:trabisdementia,项目名称:xuups,代码行数:31,代码来源:whoswho.php
示例13: redirect_header
if (!isset($xoopsUser) || !is_object($xoopsUser)) {
redirect_header(XOOPS_URL . '/modules/news/index.php', 3, _NOPERM);
exit;
}
}
// 2) Is the story published ?
$storyid = 0;
if (isset($_GET['storyid'])) {
$storyid = intval($_GET['storyid']);
} else {
if (isset($_POST['storyid'])) {
$storyid = intval($_POST['storyid']);
}
}
if (!empty($storyid)) {
$article = new NewsStory($storyid);
if ($article->published() == 0 || $article->published() > time()) {
redirect_header(XOOPS_URL . '/modules/news/index.php', 2, _NW_NOSTORY);
exit;
}
// Expired
if ($article->expired() != 0 && $article->expired() < time()) {
redirect_header(XOOPS_URL . '/modules/news/index.php', 2, _NW_NOSTORY);
exit;
}
} else {
redirect_header(XOOPS_URL . '/modules/news/index.php', 2, _NW_NOSTORY);
exit;
}
// 3) Does the user can see this news ? If he can't see it, he can't vote for
$gperm_handler =& xoops_gethandler('groupperm');
开发者ID:trabisdementia,项目名称:xuups,代码行数:31,代码来源:ratenews.php
示例14: formatTimestamp
$tpl->assign('channel_desc', XoopsLocal::convert_encoding(htmlspecialchars($xoopsConfig['slogan'], ENT_QUOTES)));
$tpl->assign('channel_lastbuild', formatTimestamp(time(), 'rss'));
$tpl->assign('channel_webmaster', checkEmail($xoopsConfig['adminmail'], true));
$tpl->assign('channel_editor', checkEmail($xoopsConfig['adminmail'], true));
$tpl->assign('channel_category', 'News');
$tpl->assign('channel_generator', 'XOOPS');
$tpl->assign('channel_language', _LANGCODE);
$tpl->assign('image_url', XOOPS_URL . '/images/logo.png');
$dimention = getimagesize(XOOPS_ROOT_PATH . '/images/logo.png');
if (empty($dimention[0])) {
$width = 88;
} else {
$width = $dimention[0] > 144 ? 144 : $dimention[0];
}
if (empty($dimention[1])) {
$height = 31;
} else {
$height = $dimention[1] > 400 ? 400 : $dimention[1];
}
$tpl->assign('image_width', $width);
$tpl->assign('image_height', $height);
if (@(include_once XOOPS_ROOT_PATH . '/modules/news/class/class.newsstory.php')) {
$sarray = NewsStory::getAllPublished(10, 0, true);
}
if (!empty($sarray) && is_array($sarray)) {
foreach ($sarray as $story) {
$tpl->append('items', array('title' => XoopsLocal::convert_encoding(htmlspecialchars($story->title(), ENT_QUOTES)), 'link' => XOOPS_URL . '/modules/news/article.php?storyid=' . $story->storyid(), 'guid' => XOOPS_URL . '/modules/news/article.php?storyid=' . $story->storyid(), 'pubdate' => formatTimestamp($story->published(), 'rss'), 'description' => XoopsLocal::convert_encoding(htmlspecialchars($story->hometext(), ENT_QUOTES))));
}
}
}
$tpl->display('db:system_rss.html');
开发者ID:yunsite,项目名称:xoopsdc,代码行数:31,代码来源:backend.php
示例15: error_reporting
// Author: Kazumi Ono (AKA onokazu) //
// URL: http://www.myweb.ne.jp/, http://www.xoops.org/, http://jp.xoops.org/ //
// Project: The XOOPS Project //
// ------------------------------------------------------------------------- //
error_reporting(0);
include_once 'header.php';
$myts =& MyTextSanitizer::getInstance();
include_once XOOPS_ROOT_PATH . '/modules/news/class/class.newsstory.php';
require_once XOOPS_ROOT_PATH . '/modules/news/fpdf/fpdf.inc.php';
include_once XOOPS_ROOT_PATH . '/modules/news/include/functions.php';
$storyid = isset($_GET['storyid']) ? intval($_GET['storyid']) : 0;
if (empty($storyid)) {
redirect_header(XOOPS_URL . '/modules/news/index.php', 2, _NW_NOSTORY);
exit;
}
$article = new NewsStory($storyid);
// Not yet published
if ($article->published() == 0 || $article->published() > time()) {
redirect_header(XOOPS_URL . '/modules/news/index.php', 2, _NW_NOSTORY);
exit;
}
// Expired
if ($article->expired() != 0 && $article->expired() < time()) {
redirect_header(XOOPS_URL . '/modules/news/index.php', 2, _NW_NOSTORY);
exit;
}
$gperm_handler =& xoops_gethandler('groupperm');
if (is_object($xoopsUser)) {
$groups = $xoopsUser->getGroups();
} else {
$groups = XOOPS_GROUP_ANONYMOUS;
开发者ID:BackupTheBerlios,项目名称:haxoo-svn,代码行数:31,代码来源:makepdf.php
示例16: intval
$uid = 0;
}
if (isset($_GET['storyid'])) {
$storyid = intval($_GET['storyid']);
} else {
if (isset($_POST['storyid'])) {
$storyid = intval($_POST['storyid']);
} else {
$storyid = 0;
}
}
if (empty($storyid)) {
$story = new NewsStory();
$editmode = false;
} else {
$story = new NewsStory($storyid);
$editmode = true;
}
$story->setUid($uid);
$story->setTitle($_POST['title']);
$story->setHometext($_POST['hometext']);
$story->setTopicId(intval($_POST['topic_id']));
$story->setHostname(xoops_getenv('REMOTE_ADDR'));
$story->setNohtml($nohtml_db);
$nosmiley = isset($_POST['nosmiley']) ? intval($_POST['nosmiley']) : 0;
$story->setNosmiley($nosmiley);
$notifypub = isset($_POST['notifypub']) ? intval($_POST['notifypub']) : 0;
$story->setNotifyPub($notifypub);
$story->setType($_POST['type']);
if (!empty($_POST['autodate']) && $approveprivilege) {
$publish_date = $_POST['publish_date'];
开发者ID:BackupTheBerlios,项目名称:haxoo-svn,代码行数:31,代码来源:submit.php
示例17: 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, $xoopsModuleConfig;
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($xoopsModuleConfig['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='1' 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> </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='1' 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='1' 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:BackupTheBerlios,项目名称:soopa,代码行数:101,代码来源:index.php
示例18: intval
//If no post_id show a error
$op = 'form';
if (isset($_GET['post_id'])) {
$post_id = intval($_GET['post_id']);
} elseif (isset($_POST['post']) || isset($_POST['post_id'])) {
$op = 'post';
$post_id = intval($_POST['post_id']);
} else {
redirect_header('index.php', 3, _MD_ERRORPOST);
}
switch ($op) {
case 'post':
//get the post
$post_handler =& xoops_getmodulehandler('post', 'newbb');
$post = $post_handler->get($post_id);
$story = new NewsStory();
$story->setTitle($post->getVar('subject', 'e'));
/**/
$story->setHometext($post->getVar('post_text', 'e'));
/**/
$story->setUid($post->getVar('uid'));
/**/
$story->setTopicId(1);
/**/
$story->setHostname(xoops_getenv('REMOTE_ADDR'));
/**/
$dohtml = $post->getVar('dohtml');
$nohtml = empty($dohtml) ? 1 : 0;
$story->setNohtml($nohtml);
/**/
$story->setNosmiley(0);
开发者ID:BackupTheBerlios,项目名称:soopa,代码行数:31,代码来源:posttonews.php
示例19: isset
include_once '../../mainfile.php';
include_once XOOPS_ROOT_PATH . '/modules/news/class/class.newsstory.php';
include_once XOOPS_ROOT_PATH . '/modules/news/class/class.sfiles.php';
include_once XOOPS_ROOT_PATH . '/class/xoopstree.php';
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/keyhighlighter.class.php';
include_once XOOPS_ROOT_PATH . '/modules/news/config.php';
$storyid = isset($_GET['storyid']) ? intval($_GET['storyid']) : 0;
if (empty($storyid)) {
redirect_header(XOOPS_URL . '/modules/news/index.php', 2, _NW_NOSTORY);
exit;
}
$myts =& MyTextSanitizer::getInstance();
// Not yet published
$article = new NewsStory($storyid);
if ($article->published() == 0 || $article->published() > time()) {
redirect_header(XOOPS_URL . '/modules/news/index.php', 2, _NW_NOTYETSTORY);
exit;
}
// Expired
if ($article->expired() != 0 && $article->expired() < time()) {
redirect_header(XOOPS_URL . '/modules/news/index.php', 2, _NW_NOSTORY);
exit;
}
$gperm_handler =& xoops_gethandler('groupperm');
if (is_object($xoopsUser)) {
$groups = $xoopsUser->getGroups();
} else {
$groups = XOOPS_GROUP_ANONYMOUS;
}
开发者ID:trabisdementia,项目名称:xuups,代码行数:31,代码来源:article.php
示例20: 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
注:本文中的NewsStory类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论