source: temp/test-xoops.ec-cube.net/html/modules/news/article.php @ 405

Revision 405, 5.2 KB checked in by root, 20 years ago (diff)
Line 
1<?php
2// $Id: article.php,v 1.4 2005/08/03 12:39:14 onokazu Exp $
3//  ------------------------------------------------------------------------ //
4//                XOOPS - PHP Content Management System                      //
5//                    Copyright (c) 2000 XOOPS.org                           //
6//                       <http://www.xoops.org/>                             //
7//  ------------------------------------------------------------------------ //
8//  This program is free software; you can redistribute it and/or modify     //
9//  it under the terms of the GNU General Public License as published by     //
10//  the Free Software Foundation; either version 2 of the License, or        //
11//  (at your option) any later version.                                      //
12//                                                                           //
13//  You may not change or alter any portion of this comment or credits       //
14//  of supporting developers from this source code or any supporting         //
15//  source code which is considered copyrighted (c) material of the          //
16//  original comment or credit authors.                                      //
17//                                                                           //
18//  This program is distributed in the hope that it will be useful,          //
19//  but WITHOUT ANY WARRANTY; without even the implied warranty of           //
20//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            //
21//  GNU General Public License for more details.                             //
22//                                                                           //
23//  You should have received a copy of the GNU General Public License        //
24//  along with this program; if not, write to the Free Software              //
25//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA //
26//  ------------------------------------------------------------------------ //
27
28include "../../mainfile.php";
29include_once "class/class.newsstory.php";
30
31$storyid = (isset($_GET['storyid'])) ? intval($_GET['storyid']) : 0;
32if (empty($storyid)) {
33    redirect_header("index.php",2,_NW_NOSTORY);
34    exit();
35}
36
37$xoopsOption['template_main'] = 'news_article.html';
38
39include_once XOOPS_ROOT_PATH.'/header.php';
40$myts =& MyTextSanitizer::getInstance();
41// set comment mode if not set
42
43
44$article = new NewsStory($storyid);
45if ( $article->published() == 0 || $article->published() > time() ) {
46    redirect_header('index.php', 2, _NW_NOSTORY);
47    exit();
48}
49$storypage = isset($_GET['page']) ? intval($_GET['page']) : 0;
50// update counter only when viewing top page
51if (empty($_GET['com_id']) && $storypage == 0) {
52    $article->updateCounter();
53}
54$story['id'] = $storyid;
55$story['posttime'] = formatTimestamp($article->published());
56$story['title'] = $article->textlink()."&nbsp;:&nbsp;".$article->title();
57$story['text'] = $article->hometext();
58$bodytext = $article->bodytext();
59
60if ( trim($bodytext) != '' ) {
61    $articletext = explode("[pagebreak]", $bodytext);
62    $story_pages = count($articletext);
63
64    if ($story_pages > 1) {
65        include_once XOOPS_ROOT_PATH.'/class/pagenav.php';
66        $pagenav = new XoopsPageNav($story_pages, 1, $storypage, 'page', 'storyid='.$storyid);
67        $xoopsTpl->assign('pagenav', $pagenav->renderNav());
68        //$xoopsTpl->assign('pagenav', $pagenav->renderImageNav());
69
70        if ($storypage == 0) {
71            $story['text'] = $story['text'].'<br /><br />'.$articletext[$storypage];
72        } else {
73            $story['text'] = $articletext[$storypage];
74        }
75    } else {
76        $story['text'] = $story['text'].'<br /><br />'.$bodytext;
77    }
78}
79
80$story['poster'] = $article->uname();
81if ( $story['poster'] ) {
82    $story['posterid'] = $article->uid();
83    $story['poster'] = '<a href="'.XOOPS_URL.'/userinfo.php?uid='.$story['posterid'].'">'.$story['poster'].'</a>';
84} else {
85    $story['poster'] = '';
86    $story['posterid'] = 0;
87    $story['poster'] = $xoopsConfig['anonymous'];
88}
89$story['morelink'] = '';
90$story['adminlink'] = '';
91unset($isadmin);
92if ( $xoopsUser && $xoopsUser->isAdmin($xoopsModule->getVar('mid')) ) {
93    $isadmin = true;
94    $story['adminlink'] = $article->adminlink();
95}
96$story['topicid'] = $article->topicid();
97$story['imglink'] = '';
98$story['align'] = '';
99if ( $article->topicdisplay() ) {
100    $story['imglink'] = $article->imglink();
101    $story['align'] = $article->topicalign();
102}
103$story['hits'] = $article->counter();
104$story['mail_link'] = 'mailto:?subject='.sprintf(_NW_INTARTICLE,$xoopsConfig['sitename']).'&amp;body='.sprintf(_NW_INTARTFOUND, $xoopsConfig['sitename']).':  '.XOOPS_URL.'/modules/news/article.php?storyid='.$article->storyid();
105$xoopsTpl->assign('story', $story);
106$xoopsTpl->assign('lang_printerpage', _NW_PRINTERFRIENDLY);
107$xoopsTpl->assign('lang_sendstory', _NW_SENDSTORY);
108$xoopsTpl->assign('lang_on', _ON);
109$xoopsTpl->assign('lang_postedby', _POSTEDBY);
110$xoopsTpl->assign('lang_reads', _READS);
111$xoopsTpl->assign('mail_link', 'mailto:?subject='.sprintf(_NW_INTARTICLE,$xoopsConfig['sitename']).'&amp;body='.sprintf(_NW_INTARTFOUND, $xoopsConfig['sitename']).':  '.XOOPS_URL.'/modules/news/article.php?storyid='.$article->storyid());
112
113include XOOPS_ROOT_PATH.'/include/comment_view.php';
114
115include XOOPS_ROOT_PATH.'/footer.php';
116?>
Note: See TracBrowser for help on using the repository browser.