本文整理汇总了PHP中NewsStory类的典型用法代码示例。如果您正苦于以下问题:PHP NewsStory类的具体用法?PHP NewsStory怎么用?PHP NewsStory使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了NewsStory类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}
示例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>
';
}
示例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;
}
}
示例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();
示例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;
示例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:
示例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');
示例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');
示例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;