function news_com_update($story_id, $total_num)
{
    $article = new NewsStory($story_id);
    if (!$article->updateComments($total_num)) {
        return false;
    }
    return true;
}
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;
}
Exemple #3
0
 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;
 }
Exemple #4
0
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;
}
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;
}
Exemple #6
0
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);
}
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&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=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;
}
Exemple #8
0
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>&nbsp;' . $datetime . ' | <b>' . _NW_TOPICC . '</b>&nbsp;' . $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>
    	';
}
Exemple #9
0
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;
    }
}
}
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']) . '&amp;body=' . sprintf(_NW_INTARTFOUND, $xoopsConfig['sitename']) . ':  ' . XOOPS_URL . '/modules/' . $xoopsModule->dirname() . '/article.php?storyid=' . $article->storyid();
Exemple #11
0
<?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;
Exemple #12
0
 * @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:
Exemple #13
0
    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');
Exemple #14
0
    $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');
// 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;
Exemple #16
0
     $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'];
Exemple #17
0
/**
 * 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>&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='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'];
        $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>";
    // c) Best rated articles (this is an average)
    $besratednews = $stats['besratednews'];
    echo '<br /><br />' . _AM_NEWS_STATS6;
    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_RATING . "</td></tr>\n";
    foreach ($besratednews 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'>%s</td></tr>\n", $url1, $myts->displayTarea($data['topic_title']), $url2, $myts->displayTarea($data['title']), $url3, $myts->htmlSpecialChars($news->uname($data['uid'])), number_format($data['rating'], 2));
    }
    echo "</table></div><br /><br /><br />";
    // Last part of the stats, everything about authors
    // a) Most readed authors
    $mostreadedauthors = $stats['mostreadedauthors'];
    echo "<div style='text-align: center;'><b>" . _AM_NEWS_STATS10 . "</b><br /><br />" . _AM_NEWS_STATS7 . "<br />\n";
    echo "<table border='1' width='100%'><tr class='bg3'><td>" . _AM_POSTER . "</td><td>" . _NW_VIEWS . "</td></tr>\n";
    foreach ($mostreadedauthors as $uid => $reads) {
        $url = XOOPS_URL . '/userinfo.php?uid=' . $uid;
        $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></tr>\n", $url, $myts->htmlSpecialChars($news->uname($uid)), $reads);
    }
    echo "</table>";
    // b) Best rated authors
    $bestratedauthors = $stats['bestratedauthors'];
    echo '<br /><br />' . _AM_NEWS_STATS8;
    echo "<table border='1' width='100%'><tr class='bg3'><td>" . _AM_POSTER . "</td><td>" . _NW_RATING . "</td></tr>\n";
    foreach ($bestratedauthors as $uid => $rating) {
        $url = XOOPS_URL . '/userinfo.php?uid=' . $uid;
        $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></tr>\n", $url, $myts->htmlSpecialChars($news->uname($uid)), $rating);
    }
    echo "</table>";
    // c) Biggest contributors
    $biggestcontributors = $stats['biggestcontributors'];
    echo '<br /><br />' . _AM_NEWS_STATS9;
    echo "<table border='1' width='100%'><tr class='bg3'><td>" . _AM_POSTER . "</td><td>" . _AM_NEWS_STATS11 . "</td></tr>\n";
    foreach ($biggestcontributors as $uid => $count) {
        $url = XOOPS_URL . '/userinfo.php?uid=' . $uid;
        $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></tr>\n", $url, $myts->htmlSpecialChars($news->uname($uid)), $count);
    }
    echo "</table></div><br />";
}
Exemple #18
0
//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);
Exemple #19
0
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;
}
Exemple #20
0
 * 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'];
    }
}
Exemple #21
0
}
$topicid = 0;
if (isset($_GET['topicid'])) {
    $topicid = intval($_GET['topicid']);
}
if (!$topicid) {
    exit;
}
$myts =& MyTextSanitizer::getInstance();
if (function_exists('mb_http_output')) {
    mb_http_output('pass');
}
$restricted = getmoduleoption('restrictindex');
$newsnumber = getmoduleoption('storyhome');
header('Content-Type:text/xml; charset=utf-8');
$story = new NewsStory();
$tpl = new XoopsTpl();
$tpl->xoops_setCaching(2);
$tpl->xoops_setCacheTime(0);
if (!$tpl->is_cached('db:system_rss.html')) {
    $sarray = $story->getAllPublished($newsnumber, 0, $restricted, $topicid);
    if (is_array($sarray) && count($sarray) > 0) {
        $tpl->assign('channel_title', xoops_utf8_encode(htmlspecialchars($xoopsConfig['sitename'], ENT_QUOTES)));
        $tpl->assign('channel_link', XOOPS_URL . '/');
        $tpl->assign('channel_desc', xoops_utf8_encode(htmlspecialchars($xoopsConfig['slogan'], ENT_QUOTES)));
        $tpl->assign('channel_lastbuild', formatTimestamp(time(), 'rss'));
        $tpl->assign('channel_webmaster', checkEmail($xoopsConfig['adminmail'], true));
        // Fed up with spam
        $tpl->assign('channel_editor', checkEmail($xoopsConfig['adminmail'], true));
        // Fed up with spam
        $tpl->assign('channel_category', 'News');
Exemple #22
0
<?php

loader_import('news.Story');
loader_import('news.Functions');
$story = new NewsStory();
$story->limit($parameters['limit']);
$story->orderBy('date desc, rank desc, id desc');
if (!isset($parameters['sec'])) {
    $params = array();
} else {
    $params = array('category' => $parameters['sec']);
}
$res = $story->find($params);
if (!$res) {
    $res = array();
}
echo template_simple('sidebar.spt', array('list' => $res, 'dates' => $parameters['dates'], 'thumbs' => $parameters['thumbs']));
Exemple #23
0
 case "post":
     $nohtml_db = 1;
     if ($xoopsUser) {
         $uid = $xoopsUser->getVar('uid');
         if ($xoopsUser->isAdmin($xoopsModule->mid())) {
             $nohtml_db = empty($nohtml) ? 0 : 1;
         }
     } else {
         if ($xoopsModuleConfig['anonpost'] == 1) {
             $uid = 0;
         } else {
             redirect_header("index.php", 3, _NOPERM);
             exit;
         }
     }
     $story = new NewsStory();
     $story->setTitle($subject);
     $story->setHometext($message);
     $story->setUid($uid);
     $story->setTopicId($topic_id);
     $story->setHostname(xoops_getenv('REMOTE_ADDR'));
     $story->setNohtml($nohtml_db);
     $nosmiley = isset($nosmiley) ? intval($nosmiley) : 0;
     $notifypub = isset($notifypub) ? intval($notifypub) : 0;
     $story->setNosmiley($nosmiley);
     $story->setNotifyPub($notifypub);
     $story->setType('user');
     if ($xoopsModuleConfig['autoapprove'] == 1) {
         $approve = 1;
         $story->setApproved($approve);
         $story->setPublished(time());
Exemple #24
0
function delTopic()
{
    global $xoopsDB, $xoopsConfig, $xoopsModule;
    if (empty($_POST['ok'])) {
        xoops_cp_header();
        echo "<h4>" . _AM_CONFIG . "</h4>";
        xoops_confirm(array('op' => 'delTopic', 'topic_id' => intval($_GET['topic_id']), 'ok' => 1), 'index.php', _AM_WAYSYWTDTTAL);
    } else {
        $xt = new XoopsTopic($xoopsDB->prefix("topics"), $_POST['topic_id']);
        // get all subtopics under the specified topic
        $topic_arr = $xt->getAllChildTopics();
        array_push($topic_arr, $xt);
        foreach ($topic_arr as $eachtopic) {
            // get all stories in each topic
            $story_arr = NewsStory::getByTopic($eachtopic->topic_id());
            foreach ($story_arr as $eachstory) {
                if (false != $eachstory->delete()) {
                    xoops_comment_delete($xoopsModule->getVar('mid'), $eachstory->storyid());
                    xoops_notification_deletebyitem($xoopsModule->getVar('mid'), 'story', $eachstory->storyid());
                }
            }
            // all stories for each topic is deleted, now delete the topic data
            $eachtopic->delete();
            xoops_notification_deletebyitem($xoopsModule->getVar('mid'), 'category', $eachtopic->topic_id);
        }
        redirect_header('index.php?op=topicsmanager', 1, _AM_DBUPDATED);
        exit;
    }
}
Exemple #25
0
 * @page_param 	int		storyid 					Id of news to print
 *
 * @page_title			Story's title - Printer Friendly Page - Topic's title - Site's name
 *
 * @template_name		This page does not use any template
 *
 */
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';
$storyid = isset($_GET['storyid']) ? intval($_GET['storyid']) : 0;
if (empty($storyid)) {
    redirect_header(XOOPS_URL . '/modules/news/index.php', 2, _NW_NOSTORY);
}
// Verify that the article is published
$story = new NewsStory($storyid);
// Not yet published
if ($story->published() == 0 || $story->published() > time()) {
    redirect_header(XOOPS_URL . '/modules/news/index.php', 2, _NW_NOSTORY);
    exit;
}
// Expired
if ($story->expired() != 0 && $story->expired() < time()) {
    redirect_header(XOOPS_URL . '/modules/news/index.php', 2, _NW_NOSTORY);
    exit;
}
// Verify permissions
$gperm_handler =& xoops_gethandler('groupperm');
if (is_object($xoopsUser)) {
    $groups = $xoopsUser->getGroups();
} else {
Exemple #26
0
    }
    $story['mail_link'] = 'mailto:?subject=' . sprintf(_NW_INTARTICLE, $xoopsConfig['sitename']) . '&amp;body=' . sprintf(_NW_INTARTFOUND, $xoopsConfig['sitename']) . ':  ' . XOOPS_URL . '/modules/news/article.php?storyid=' . $sarray[$i]->storyid();
    $story['imglink'] = '';
    $story['align'] = '';
    if ($sarray[$i]->topicdisplay()) {
        $story['imglink'] = $sarray[$i]->imglink();
        $story['align'] = $sarray[$i]->topicalign();
    }
    $story['title'] = $sarray[$i]->textlink() . '&nbsp;:&nbsp;' . "<a href='" . XOOPS_URL . "/modules/news/article.php?storyid=" . $sarray[$i]->storyid() . "'>" . $sarray[$i]->title() . "</a>";
    $story['hits'] = $sarray[$i]->counter();
    // The line below can be used to display a Permanent Link image
    // $story['title'] .= "&nbsp;&nbsp;<a href='".XOOPS_URL."/modules/news/article.php?storyid=".$sarray[$i]->storyid()."'><img src='".XOOPS_URL."/modules/news/images/x.gif' alt='Permanent Link' /></a>";
    $xoopsTpl->append('stories', $story);
    unset($story);
}
$totalcount = NewsStory::countPublishedByTopic($xoopsOption['storytopic']);
if ($totalcount > $scount) {
    include_once XOOPS_ROOT_PATH . '/class/pagenav.php';
    $pagenav = new XoopsPageNav($totalcount, $xoopsOption['storynum'], $start, 'start', 'storytopic=' . $xoopsOption['storytopic']);
    $xoopsTpl->assign('pagenav', $pagenav->renderNav());
    //$xoopsTpl->assign('pagenav', $pagenav->renderImageNav());
} else {
    $xoopsTpl->assign('pagenav', '');
}
$xoopsTpl->assign('lang_go', _GO);
$xoopsTpl->assign('lang_on', _ON);
$xoopsTpl->assign('lang_printerpage', _NW_PRINTERFRIENDLY);
$xoopsTpl->assign('lang_sendstory', _NW_SENDSTORY);
$xoopsTpl->assign('lang_postedby', _POSTEDBY);
$xoopsTpl->assign('lang_reads', _READS);
include_once XOOPS_ROOT_PATH . '/footer.php';
Exemple #27
0
/**
 * Function used to edit the block
 */
function b_news_top_edit($options)
{
    global $xoopsDB;
    $tmpstory = new NewsStory();
    $form = _MB_NEWS_ORDER . "&nbsp;<select name='options[]'>";
    $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>';
    $form .= "<option value='rating'";
    if ($options[0] == 'rating') {
        $form .= " selected='selected'";
    }
    $form .= '>' . _MB_NEWS_RATE . '</option>';
    $form .= "</select>\n";
    $form .= '&nbsp;' . _MB_NEWS_DISP . "&nbsp;<input type='text' name='options[]' value='" . $options[1] . "'/>&nbsp;" . _MB_NEWS_ARTCLS;
    $form .= "&nbsp;<br /><br />" . _MB_NEWS_CHARS . "&nbsp;<input type='text' name='options[]' value='" . $options[2] . "'/>&nbsp;" . _MB_NEWS_LENGTH . '<br /><br />';
    $form .= _MB_NEWS_TEASER . " <input type='text' name='options[]' value='" . $options[3] . "' />" . _MB_NEWS_LENGTH;
    $form .= '<br /><br />';
    $form .= _MB_NEWS_SPOTLIGHT . " <input type='radio' name='options[]' value='1'";
    if ($options[4] == 1) {
        $form .= " checked='checked'";
    }
    $form .= ' />' . _YES;
    $form .= "<input type='radio' name='options[]' value='0'";
    if ($options[4] == 0) {
        $form .= " checked='checked'";
    }
    $form .= ' />' . _NO . '<br /><br />';
    $form .= _MB_NEWS_WHAT_PUBLISH . " <select name='options[]'><option value='1'";
    if ($options[5] == 1) {
        $form .= ' selected';
    }
    $form .= ' />' . _MB_NEWS_RECENT_NEWS;
    $form .= "</option><option value='0'";
    if ($options[5] == 0) {
        $form .= ' selected';
    }
    $form .= ' />' . _MB_NEWS_RECENT_SPECIFIC . '</option></select>';
    $form .= '<br /><br />' . _MB_NEWS_SPOTLIGHT_ARTICLE . '<br />';
    $articles = $tmpstory->getAllPublished(200, 0, false, 0, 0, false);
    // I have limited the listbox to the last 200 articles
    $form .= "<select name ='options[]'>";
    $form .= "<option value='0'>" . _MB_NEWS_FIRST . '</option>';
    foreach ($articles as $storyid => $storytitle) {
        $sel = '';
        if ($options[6] == $storyid) {
            $sel = " selected='selected'";
        }
        $form .= "<option value='{$storyid}'{$sel}>" . $storytitle . '</option>';
    }
    $form .= '</select><br /><br />';
    $form .= _MB_NEWS_IMAGE . "&nbsp;<input type='text' id='spotlightimage' name='options[]' value='" . $options[7] . "' size='50'/>";
    $form .= "&nbsp;<img align='middle' onmouseover='style.cursor=\"hand\"' onclick='javascript:openWithSelfMain(\"" . XOOPS_URL . "/imagemanager.php?target=spotlightimage\",\"imgmanager\",400,430);' src='" . XOOPS_URL . "/images/image.gif' alt='image' title='image' />";
    $form .= '<br /><br />' . _MB_NEWS_DISP . "&nbsp;<select name='options[]'><option value='1' ";
    if ($options[8] == 1) {
        $form .= 'selected';
    }
    $form .= '>' . _MB_NEWS_VIEW_TYPE1 . "</option><option value='2' ";
    if ($options[8] == 2) {
        $form .= 'selected';
    }
    $form .= '>' . _MB_NEWS_VIEW_TYPE2 . '</option></select><br /><br />';
    $form .= "<table border=0>\n";
    $form .= "<tr><td colspan='2' align='center'><u>" . _MB_NEWS_DEFAULT_COLORS . "</u></td></tr>";
    $form .= "<tr><td>" . _MB_NEWS_TAB_COLOR1 . "</td><td><input type='text' name='options[]' value='" . $options[9] . "' size=7></td></tr>";
    $form .= "<tr><td>" . _MB_NEWS_TAB_COLOR2 . "</td><td><input type='text' name='options[]' value='" . $options[10] . "' size=7></td></tr>";
    $form .= "<tr><td>" . _MB_NEWS_TAB_COLOR3 . "</td><td><input type='text' name='options[]' value='" . $options[11] . "' size=7></td></tr>";
    $form .= "<tr><td>" . _MB_NEWS_TAB_COLOR4 . "</td><td><input type='text' name='options[]' value='" . $options[12] . "' size=7></td></tr>";
    $form .= "<tr><td>" . _MB_NEWS_TAB_COLOR5 . "</td><td><input type='text' name='options[]' value='" . $options[13] . "' size=7></td></tr>";
    $form .= "</table>\n";
    $form .= '<br /><br />' . _MB_SPOTLIGHT_TOPIC . "<br /><select name='options[]' multiple='multiple'>";
    include_once XOOPS_ROOT_PATH . '/modules/news/class/class.newstopic.php';
    $topics_arr = array();
    include_once XOOPS_ROOT_PATH . '/class/xoopstree.php';
    $xt = new XoopsTree($xoopsDB->prefix('topics'), 'topic_id', 'topic_pid');
    $topics_arr = $xt->getChildTreeArray(0, 'topic_title');
    $size = count($options);
    foreach ($topics_arr as $onetopic) {
        $sel = '';
        if ($onetopic['topic_pid'] != 0) {
            $onetopic['prefix'] = str_replace('.', '-', $onetopic['prefix']) . '&nbsp;';
        } else {
            $onetopic['prefix'] = str_replace('.', '', $onetopic['prefix']);
        }
        for ($i = 14; $i < $size; $i++) {
            if ($options[$i] == $onetopic['topic_id']) {
                $sel = " selected='selected'";
            }
        }
        $form .= "<option value='" . $onetopic['topic_id'] . "'{$sel}>" . $onetopic['prefix'] . $onetopic['topic_title'] . '</option>';
    }
    $form .= '</select><br />';
    return $form;
}
Exemple #28
0
 $xoopsOption['template_main'] = 'news_by_topic.html';
 include_once XOOPS_ROOT_PATH . '/header.php';
 $xoopsTpl->assign('columnwidth', intval(1 / $column_count * 100));
 if ($xoopsModuleConfig['ratenews']) {
     $xoopsTpl->assign('rates', true);
     $xoopsTpl->assign('lang_ratingc', _NW_RATINGC);
     $xoopsTpl->assign('lang_ratethisnews', _NW_RATETHISNEWS);
 } else {
     $xoopsTpl->assign('rates', false);
 }
 $xt = new NewsTopic();
 $alltopics =& $xt->getTopicsList(true, $xoopsModuleConfig['restrictindex']);
 $smarty_topics = array();
 $topicstories = array();
 foreach ($alltopics as $topicid => $topic) {
     $allstories = NewsStory::getAllPublished($xoopsModuleConfig['storyhome'], 0, $xoopsModuleConfig['restrictindex'], $topicid);
     foreach ($allstories as $thisstory) {
         $topicstories[$topicid][] = $thisstory->prepare2show($sfiles);
     }
     if (isset($topicstories[$topicid])) {
         $smarty_topics[$topicstories[$topicid][0]['posttimestamp']] = array('title' => $topic['title'], 'stories' => $topicstories[$topicid], 'id' => $topicid, 'topic_color' => $topic['color']);
     }
 }
 krsort($smarty_topics);
 $columns = array();
 $i = 0;
 foreach ($smarty_topics as $thistopictimestamp => $thistopic) {
     $columns[$i][] = $thistopic;
     $i++;
     if ($i == $column_count) {
         $i = 0;
 function &getRecentPosts($respond = true)
 {
     if (!$this->_checkUser($this->params[1], $this->params[2])) {
         $this->response->add(new XoopsXmlRpcFault(104));
     } else {
         include_once XOOPS_ROOT_PATH . '/modules/news/class/class.newsstory.php';
         if (isset($this->params[4]) && intval($this->params[4]) > 0) {
             $stories =& NewsStory::getAllPublished(intval($this->params[3]), 0, $this->params[4]);
         } else {
             $stories =& NewsStory::getAllPublished(intval($this->params[3]));
         }
         $scount = count($stories);
         $ret = array();
         for ($i = 0; $i < $scount; $i++) {
             $ret[] = array('uid' => $stories[$i]->uid(), 'published' => $stories[$i]->published(), 'storyid' => $stories[$i]->storyId(), 'title' => $stories[$i]->title('Edit'), 'hometext' => $stories[$i]->hometext('Edit'), 'moretext' => $stories[$i]->bodytext('Edit'));
         }
         if (!$respond) {
             return $ret;
         } else {
             if (count($ret) == 0) {
                 $this->response->add(new XoopsXmlRpcFault(106, 'Found 0 Entries'));
             } else {
                 $arr = new XoopsXmlRpcArray();
                 $count = count($ret);
                 for ($i = 0; $i < $count; $i++) {
                     $struct = new XoopsXmlRpcStruct();
                     $content = '';
                     foreach ($ret[$i] as $key => $value) {
                         switch ($key) {
                             case 'uid':
                                 $struct->add('userid', new XoopsXmlRpcString($value));
                                 break;
                             case 'published':
                                 $struct->add('dateCreated', new XoopsXmlRpcDatetime($value));
                                 break;
                             case 'storyid':
                                 $struct->add('postid', new XoopsXmlRpcString($value));
                                 $struct->add('link', new XoopsXmlRpcString(XOOPS_URL . '/modules/news/article.php?item_id=' . $value));
                                 $struct->add('permaLink', new XoopsXmlRpcString(XOOPS_URL . '/modules/news/article.php?item_id=' . $value));
                                 break;
                             case 'title':
                                 $struct->add('title', new XoopsXmlRpcString($value));
                                 break;
                             default:
                                 $content .= '<' . $key . '>' . trim($value) . '</' . $key . '>';
                                 break;
                         }
                     }
                     $struct->add('description', new XoopsXmlRpcString($content));
                     $arr->add($struct);
                     unset($struct);
                 }
                 $this->response->add($arr);
             }
         }
     }
 }
Exemple #30
0
<?php

global $cgi;
loader_import('news.Story');
loader_import('news.Functions');
$story = new NewsStory();
if (!empty($parameters['story'])) {
    // view story
    $obj = $story->get($parameters['story']);
    if (!$obj) {
        echo template_simple('not_found.spt', array('error' => $story->error));
        return;
    }
    if (!empty($parameters['highlight'])) {
        loader_import('saf.Misc.Search');
        $obj->body = search_bar($parameters['highlight'], '/index/news-search-action') . search_highlight($obj->body, $parameters['highlight']);
        $obj->highlight = $parameters['highlight'];
    }
    $pages = news_page_split($obj->body);
    if (!$cgi->pagenum) {
        $cgi->pagenum = 1;
    }
    $obj->body = news_page_nav($pages, $cgi->pagenum, $obj->id, $parameters['highlight']);
    $obj->pagenum = $cgi->pagenum;
    if (appconf('comments')) {
        $obj->comments = true;
        loader_import('news.Comment');
        $c = new NewsComment();
        $c->orderBy('ts asc');
        $obj->commentList = $c->find($obj->id);
        if (!$obj->commentList) {