Completed
Pull Request — master (#4)
by Michael
03:05
created

article.php (3 issues)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
0 ignored issues
show
Coding Style Compatibility introduced by
For compatibility and reusability of your code, PSR1 recommends that a file should introduce either new symbols (like classes, functions, etc.) or have side-effects (like outputting something, or including other files), but not both at the same time. The first symbol is defined on line 239 and the first side effect is on line 121.

The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.

The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.

To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.

Loading history...
2
// $Id: article.php 9767 2012-07-02 06:02:52Z beckmi $
3
//  ------------------------------------------------------------------------ //
4
//                XOOPS - PHP Content Management System                      //
5
//                    Copyright (c) 2000 XOOPS.org                           //
6
//                       <http://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
/**
28
 * Article's page
29
 *
30
 * This page is used to see an article (or story) and is mainly called from
31
 * the module's index page.
32
 *
33
 * If no story Id has been placed on the URL or if the story is not yet published
34
 * then the page will redirect user to the module's index.
35
 * If the user does not have the permissions to see the article, he is also redirected
36
 * to the module's index page but with a error message saying :
37
 *     "Sorry, you don't have the permission to access this area"
38
 *
39
 * Each time a page is seen, and only if we are on the first page, its counter of hits is
40
 * updated
41
 *
42
 * Each file(s) attached to the article is visible at the bottom of the article and can
43
 * be downloaded
44
 *
45
 * Notes :
46
 * - To create more than one page in your story, use the tag [pagebreak]
47
 * - If you are a module's admin, you have the possibility to see two links at the bottom
48
 *   of the article, "Edit & Delete"
49
 *
50
 * @package                         News
51
 * @author                          Xoops Modules Dev Team
52
 * @copyright (c)                   XOOPS Project (http://xoops.org)
53
 *
54
 * Parameters received by this page :
55
 *
56
 * @param int storyid    Id of the story we want to see
57
 * @param int page        page's number (in the case where there are more than one page)
58
 *
59
 * @page_title                      Article's title - Topic's title - Module's name
60
 *
61
 * @template_name                   news_article.html wich will call news_item.html
62
 *
63
 * Template's variables :
64
 * @template_var                    string    pagenav    some links to navigate thru pages
65
 * @template_var                    array    story    Contains all the information about the story
66
 *                                    Structure :
67
 * @template_var                    int        id            Story's ID
68
 * @template_var                    string    posttime    Story's date of publication
69
 * @template_var                    string    title        A link to go and see all the articles in the same topic and the story's title
70
 * @template_var                    string    news_title    Just the news title
71
 * @template_var                    string    topic_title    Just the topic's title
72
 * @template_var                    string    text        Defined as "The scoop"
73
 * @template_var                    string    poster        A link to see the author's profil and his name or "Anonymous"
74
 * @template_var                    int        posterid    Author's uid (or 0 if it's an anonymous or a user wich does not exist any more)
75
 * @template_var                    string    morelink    Never used ???? May be it could be deleted
76
 * @template_var                    string    adminlink    A link to Edit or Delete the story or a blank string if you are not the module's admin
77
 * @template_var                    string    topicid        News topic's Id
78
 * @template_var                    string    topic_color    Topic's color
79
 * @template_var                    string    imglink        A link to go and see the topic of the story with the topic's picture (if it exists)
80
 * @template_var                    string    align        Topic's image alignement
81
 * @template_var                    int        hits        Story's counter of visits
82
 * @template_var                    string    mail_link    A link (with a mailto) to email the story's URL to someone
83
 * @template_var                    string    lang_printerpage    Used in the link and picture to have a "printable version" (fixed text)
84
 * @template_var                    string    lang_on        Fixed text "On" ("published on")
85
 * @template_var                    string    lang_postedby    Fixed text "Posted by"
86
 * @template_var                    string    lang_reads    Fixed text "Reads"
87
 * @template_var                    string    news_by_the_same_author_link    According the the module's option named "newsbythisauthor", it contains a link to see all the article's stories
88
 * @template_var                    int        summary_count    Number of stories really visibles in the summary table
89
 * @template_var                    boolean    showsummary    According to the module's option named "showsummarytable", this contains "True" of "False"
90
 * @template_var                    array    summary    Contains the required information to create a summary table at the bottom of the article. Note, we use the module's option "storyhome" to determine the maximum number of stories visibles in this summary table
91
 *                                    Structure :
92
 * @template_var                    int        story_id        Story's ID
93
 * @template_var                    string    story_title        Story's title
94
 * @template_var                    int        story_hits        Counter of hits
95
 * @template_var                    string    story_published    Story's date of creation
96
 * @template_var                    string    lang_attached_files    Fixed text "Attached Files:"
97
 * @template_var                    int        attached_files_count    Number of files attached to the story
98
 * @template_var                    array    attached_files    Contains the list of all the files attached to the story
99
 *                                    Structure :
100
 * @template_var                    int        file_id                File's ID
101
 * @template_var                    string    visitlink            Link to download the file
102
 * @template_var                    string    file_realname        Original filename (not the real one use to store the file but the one it have when it was on the user hard disk)
103
 * @template_var                    string    file_attacheddate    Date to wich the file was attached to the story (in general that's equal to the article's creation date)
104
 * @template_var                    string    file_mimetype        File's mime type
105
 * @template_var                    string    file_downloadname    Real name of the file on the webserver's disk (changed by the module)
106
 * @template_var                    boolean    nav_links    According to the module's option named "showprevnextlink" it contains "True" or "False" to know if we have to show two links to go to the previous and next article
107
 * @template_var                    int        previous_story_id    Id of the previous story (according to the published date and to the perms)
108
 * @template_var                    int        next_story_id        Id of the next story (according to the published date and to the perms)
109
 * @template_var                    string    previous_story_title    Title of the previous story
110
 * @template_var                    string    next_story_title        Title of the next story
111
 * @template_var                    string    lang_previous_story        Fixed text "Previous article"
112
 * @template_var                    string    lang_next_story            Fixed text "Next article"
113
 * @template_var                    string    lang_other_story        Fixed text "Other articles"
114
 * @template_var                    boolean    rates    To know if rating is enable or not
115
 * @template_var                    string    lang_ratingc    Fixed text "Rating: "
116
 * @template_var                    string    lang_ratethisnews    Fixed text "Rate this News"
117
 * @template_var                    float    rating    Article's rating
118
 * @template_var                    string    votes    "1 vote" or "X votes"
119
 * @template_var                    string    topic_path    A path from the root to the current topic (of the current news)
120
 */
121
include dirname(dirname(__DIR__)) . '/mainfile.php';
122
include_once XOOPS_ROOT_PATH . '/modules/news/class/class.newsstory.php';
123
include_once XOOPS_ROOT_PATH . '/modules/news/class/class.sfiles.php';
124
include_once XOOPS_ROOT_PATH . '/modules/news/class/tree.php';
125
include_once XOOPS_ROOT_PATH . '/modules/news/include/functions.php';
126
include_once XOOPS_ROOT_PATH . '/modules/news/class/class.newstopic.php';
127
include_once XOOPS_ROOT_PATH . '/modules/news/class/keyhighlighter.class.php';
128
include_once XOOPS_ROOT_PATH . '/modules/news/config.php';
129
130
$storyid = (isset($_GET['storyid'])) ? (int)($_GET['storyid']) : 0;
131
132
if (empty($storyid)) {
133
    redirect_header(XOOPS_URL . '/modules/news/index.php', 2, _NW_NOSTORY);
134
135
}
136
137
$myts =& MyTextSanitizer::getInstance();
138
139
// Not yet published
140
$article = new NewsStory($storyid);
141
if ($article->published() == 0 || $article->published() > time()) {
142
    redirect_header(XOOPS_URL . '/modules/news/index.php', 2, _NW_NOTYETSTORY);
143
144
}
145
// Expired
146
if ($article->expired() != 0 && $article->expired() < time()) {
147
    redirect_header(XOOPS_URL . '/modules/news/index.php', 2, _NW_NOSTORY);
148
149
}
150
151
$gperm_handler =& xoops_gethandler('groupperm');
152
if (is_object($xoopsUser)) {
153
    $groups = $xoopsUser->getGroups();
154
} else {
155
    $groups = XOOPS_GROUP_ANONYMOUS;
156
}
157
if (!$gperm_handler->checkRight('news_view', $article->topicid(), $groups, $xoopsModule->getVar('mid'))) {
158
    redirect_header(XOOPS_URL . '/modules/news/index.php', 3, _NOPERM);
159
160
}
161
162
$storypage  = isset($_GET['page']) ? (int)($_GET['page']) : 0;
163
$dateformat = news_getmoduleoption('dateformat');
164
$hcontent   = '';
165
166
/**
167
 * update counter only when viewing top page and when you are not the author or an admin
168
 */
169
if (empty($_GET['com_id']) && $storypage == 0) {
170
    if (is_object($xoopsUser)) {
171
        if (($xoopsUser->getVar('uid') == $article->uid()) || news_is_admin_group()) {
172
            // nothing ! ;-)
0 ignored issues
show
Unused Code Comprehensibility introduced by
38% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
173
        } else {
174
            $article->updateCounter();
175
        }
176
    } else {
177
        $article->updateCounter();
178
    }
179
}
180
$xoopsOption['template_main'] = 'news_article.tpl';
181
include_once XOOPS_ROOT_PATH . '/header.php';
182
183
$story['id']          = $storyid;
184
$story['posttime']    = formatTimestamp($article->published(), $dateformat);
185
$story['news_title']  = $article->title();
186
$story['title']       = $article->textlink() . '&nbsp;:&nbsp;' . $article->title();
187
$story['subtitle']    = $article->subtitle();
188
$story['topic_title'] = $article->textlink();
189
190
$story['text'] = $article->hometext();
191
$bodytext      = $article->bodytext();
192
193
if (xoops_trim($bodytext) != '') {
194
    $articletext = array();
195
    if (news_getmoduleoption('enhanced_pagenav')) {
196
        $articletext             = preg_split('/(\[pagebreak:|\[pagebreak)(.*)(\])/iU', $bodytext);
197
        $arr_titles              = array();
198
        $auto_summary            = $article->auto_summary($bodytext, $arr_titles);
199
        $bodytext                = str_replace('[summary]', $auto_summary, $bodytext);
200
        $articletext[$storypage] = str_replace('[summary]', $auto_summary, $articletext[$storypage]);
201
        $story['text']           = str_replace('[summary]', $auto_summary, $story['text']);
202
    } else {
203
        $articletext = explode('[pagebreak]', $bodytext);
204
    }
205
206
    $story_pages = count($articletext);
207
208
    if ($story_pages > 1) {
209
        include_once XOOPS_ROOT_PATH . '/modules/news/include/pagenav.php';
210
        $pagenav = new XoopsPageNav($story_pages, 1, $storypage, 'page', 'storyid=' . $storyid);
211
        if (news_isbot()) { // A bot is reading the articles, we are going to show him all the links to the pages
212
            $xoopsTpl->assign('pagenav', $pagenav->renderNav($story_pages));
213
        } else {
214
            if (news_getmoduleoption('enhanced_pagenav')) {
215
                $xoopsTpl->assign('pagenav', $pagenav->renderEnhancedSelect(true, $arr_titles));
216
            } else {
217
                $xoopsTpl->assign('pagenav', $pagenav->renderNav());
218
            }
219
        }
220
221
        if ($storypage == 0) {
222
            $story['text'] = $story['text'] . '<br />' . news_getmoduleoption('advertisement') . '<br />' . $articletext[$storypage];
223
        } else {
224
            $story['text'] = $articletext[$storypage];
225
        }
226
    } else {
227
        $story['text'] = $story['text'] . '<br />' . news_getmoduleoption('advertisement') . '<br />' . $bodytext;
228
    }
229
}
230
// Publicit�
231
$xoopsTpl->assign('advertisement', news_getmoduleoption('advertisement'));
232
233
// ****************************************************************************************************************
234
/**
235
 * @param $matches
236
 *
237
 * @return string
238
 */
239
function my_highlighter($matches)
240
{
241
    $color = news_getmoduleoption('highlightcolor');
242
    if (substr($color, 0, 1) != '#') {
243
        $color = '#' . $color;
244
    }
245
246
    return '<span style="font-weight: bolder; background-color: ' . $color . ';">' . $matches[0] . '</span>';
247
}
248
249
$highlight = false;
250
$highlight = news_getmoduleoption('keywordshighlight');
251
252
if ($highlight && isset($_GET['keywords'])) {
253
    $keywords      = $myts->htmlSpecialChars(trim(urldecode($_GET['keywords'])));
254
    $h             = new keyhighlighter ($keywords, true, 'my_highlighter');
255
    $story['text'] = $h->highlight($story['text']);
256
}
257
// ****************************************************************************************************************
258
259
$story['poster'] = $article->uname();
260
if ($story['poster']) {
261
    $story['posterid']         = $article->uid();
262
    $story['poster']           = '<a href="' . XOOPS_URL . '/userinfo.php?uid=' . $story['posterid'] . '">' . $story['poster'] . '</a>';
263
    $tmp_user                  = new XoopsUser($article->uid());
264
    $story['poster_avatar']    = XOOPS_UPLOAD_URL . '/' . $tmp_user->getVar('user_avatar');
265
    $story['poster_signature'] = $tmp_user->getVar('user_sig');
266
    $story['poster_email']     = $tmp_user->getVar('email');
267
    $story['poster_url']       = $tmp_user->getVar('url');
268
    $story['poster_from']      = $tmp_user->getVar('user_from');
269
    unset($tmp_user);
270
} else {
271
    $story['poster']           = '';
272
    $story['posterid']         = 0;
273
    $story['poster_avatar']    = '';
274
    $story['poster_signature'] = '';
275
    $story['poster_email']     = '';
276
    $story['poster_url']       = '';
277
    $story['poster_from']      = '';
278
    if (news_getmoduleoption('displayname') != 3) {
279
        $story['poster'] = $xoopsConfig['anonymous'];
280
    }
281
}
282
$story['morelink']  = '';
283
$story['adminlink'] = '';
284
unset($isadmin);
285
286
if (is_object($xoopsUser)) {
287
    if ($xoopsUser->isAdmin($xoopsModule->getVar('mid')) || (news_getmoduleoption('authoredit') && $article->uid() == $xoopsUser->getVar('uid'))) {
288
        $isadmin = true;
289
//    	$story['adminlink'] = $article->adminlink();
0 ignored issues
show
Unused Code Comprehensibility introduced by
65% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
290
    }
291
}
292
$story['topicid']     = $article->topicid();
293
$story['topic_color'] = '#' . $myts->displayTarea($article->topic_color);
294
295
$story['imglink'] = '';
296
$story['align']   = '';
297
if ($article->topicdisplay()) {
298
    $story['imglink'] = $article->imglink();
299
    $story['align']   = $article->topicalign();
300
}
301
$story['hits']      = $article->counter();
302
$story['mail_link'] = 'mailto:?subject=' . sprintf(_NW_INTARTICLE, $xoopsConfig['sitename']) . '&amp;body=' . sprintf(_NW_INTARTFOUND, $xoopsConfig['sitename']) . ':  ' . XOOPS_URL
303
    . '/modules/news/article.php?storyid=' . $article->storyid();
304
$xoopsTpl->assign('lang_printerpage', _NW_PRINTERFRIENDLY);
305
$xoopsTpl->assign('lang_sendstory', _NW_SENDSTORY);
306
$xoopsTpl->assign('lang_pdfstory', _NW_MAKEPDF);
307
$xoopsTpl->assign('lang_on', _ON);
308
$xoopsTpl->assign('lang_postedby', _POSTEDBY);
309
$xoopsTpl->assign('lang_reads', _READS);
310
$xoopsTpl->assign(
311
    'mail_link',
312
    'mailto:?subject=' . sprintf(_NW_INTARTICLE, $xoopsConfig['sitename']) . '&amp;body=' . sprintf(_NW_INTARTFOUND, $xoopsConfig['sitename']) . ':  ' . XOOPS_URL
313
    . '/modules/news/article.php?storyid=' . $article->storyid()
314
);
315
316
if (xoops_trim($article->picture()) != '') {
317
    $story['picture']     = XOOPS_URL . '/uploads/news/image/' . $article->picture();
318
    $story['pictureinfo'] = $article->pictureinfo();
319
} else {
320
    $story['picture']     = '';
321
    $story['pictureinfo'] = '';
322
}
323
324
$xoopsTpl->assign('lang_attached_files', _NW_ATTACHEDFILES);
325
$sfiles     = new sFiles();
326
$filesarr   = $newsfiles = array();
327
$filesarr   = $sfiles->getAllbyStory($storyid);
328
$filescount = count($filesarr);
329
$xoopsTpl->assign('attached_files_count', $filescount);
330
if ($filescount > 0) {
331
    foreach ($filesarr as $onefile) {
332
        $newsfiles[] = Array(
333
            'file_id'           => $onefile->getFileid(),
334
            'visitlink'         => XOOPS_URL . '/modules/news/visit.php?fileid=' . $onefile->getFileid(),
335
            'file_realname'     => $onefile->getFileRealName(),
336
            'file_attacheddate' => formatTimestamp($onefile->getDate(), $dateformat),
337
            'file_mimetype'     => $onefile->getMimetype(),
338
            'file_downloadname' => XOOPS_UPLOAD_URL . '/' . $onefile->getDownloadname()
339
        );
340
    }
341
    $xoopsTpl->assign('attached_files', $newsfiles);
342
}
343
344
/**
345
 * Create page's title
346
 */
347
$complement = '';
348
if (news_getmoduleoption('enhanced_pagenav') && (isset($arr_titles) && is_array($arr_titles) && isset($arr_titles, $storypage) && $storypage > 0)) {
349
    $complement = ' - ' . $arr_titles[$storypage];
350
}
351
$xoopsTpl->assign('xoops_pagetitle', $article->title() . $complement . ' - ' . $article->topic_title() . ' - ' . $xoopsModule->name('s'));
352
353
if (news_getmoduleoption('newsbythisauthor')) {
354
    $xoopsTpl->assign('news_by_the_same_author_link', sprintf("<a href='%s?uid=%d'>%s</a>", XOOPS_URL . '/modules/news/newsbythisauthor.php', $article->uid(), _NW_NEWSSAMEAUTHORLINK));
355
}
356
357
/**
358
 * Create a clickable path from the root to the current topic (if we are viewing a topic)
359
 * Actually this is not used in the default's templates but you can use it as you want
360
 * Uncomment the code to be able to use it
361
 */
362
if ($cfg['create_clickable_path']) {
363
    $mytree    = new MyXoopsObjectTree($xoopsDB->prefix('news_topics'), 'topic_id', 'topic_pid');
364
    $topicpath = $mytree->getNicePathFromId($article->topicid(), 'topic_title', 'index.php?op=1');
365
    $xoopsTpl->assign('topic_path', $topicpath);
366
    unset($mytree);
367
}
368
369
/**
370
 * Summary table
371
 *
372
 * When you are viewing an article, you can see a summary table containing
373
 * the first n links to the last published news.
374
 * This summary table is visible according to a module's option (showsummarytable)
375
 * The number of items is equal to the module's option "storyhome" ("Select the number
376
 * of news items to display on top page")
377
 * We also use the module's option "restrictindex" ("Restrict Topics on Index Page"), like
378
 * this you (the webmaster) select if users can see restricted stories or not.
379
 */
380
if (news_getmoduleoption('showsummarytable')) {
381
    $xoopsTpl->assign('showsummary', true);
382
    $xoopsTpl->assign('lang_other_story', _NW_OTHER_ARTICLES);
383
    $count      = 0;
384
    $tmparticle = new NewsStory();
385
    $infotips   = news_getmoduleoption('infotips');
386
    $sarray     = $tmparticle->getAllPublished($cfg['article_summary_items_count'], 0, $xoopsModuleConfig['restrictindex']);
387
    if (count($sarray) > 0) {
388
        foreach ($sarray as $onearticle) {
389
            ++$count;
390
            $htmltitle = '';
391
            $tooltips  = '';
392
            $htmltitle = '';
393
            if ($infotips > 0) {
394
                $tooltips  = news_make_infotips($onearticle->hometext());
395
                $htmltitle = ' title="' . $tooltips . '"';
396
            }
397
            $xoopsTpl->append(
398
                'summary',
399
                array(
400
                    'story_id'        => $onearticle->storyid(),
401
                    'htmltitle'       => $htmltitle,
402
                    'infotips'        => $tooltips,
403
                    'story_title'     => $onearticle->title(),
404
                    'story_hits'      => $onearticle->counter(),
405
                    'story_published' => formatTimestamp($onearticle->published, $dateformat)
406
                )
407
            );
408
        }
409
    }
410
    $xoopsTpl->assign('summary_count', $count);
411
    unset($tmparticle);
412
} else {
413
    $xoopsTpl->assign('showsummary', false);
414
}
415
416
/**
417
 * Show a link to go to the previous article and to the next article
418
 *
419
 * According to a module's option "showprevnextlink" ("Show Previous and Next link?")
420
 * you can display, at the bottom of each article, two links used to navigate thru stories.
421
 * This feature uses the module's option "restrictindex" so that we can, or can't see
422
 * restricted stories
423
 */
424
if (news_getmoduleoption('showprevnextlink')) {
425
    $xoopsTpl->assign('nav_links', true);
426
    $tmparticle    = new NewsStory();
427
    $nextId        = $previousId = -1;
428
    $next          = $previous = array();
429
    $previousTitle = $nextTitle = '';
430
431
    $next = $tmparticle->getNextArticle($storyid, $xoopsModuleConfig['restrictindex']);
432
    if (count($next) > 0) {
433
        $nextId    = $next['storyid'];
434
        $nextTitle = $next['title'];
435
    }
436
437
    $previous = $tmparticle->getPreviousArticle($storyid, $xoopsModuleConfig['restrictindex']);
438
    if (count($previous) > 0) {
439
        $previousId    = $previous['storyid'];
440
        $previousTitle = $previous['title'];
441
    }
442
443
    $xoopsTpl->assign('previous_story_id', $previousId);
444
    $xoopsTpl->assign('next_story_id', $nextId);
445
    if ($previousId > 0) {
446
        $xoopsTpl->assign('previous_story_title', $previousTitle);
447
        $hcontent .= sprintf("<link rel=\"Prev\" title=\"%s\" href=\"%s/\" />\n", $previousTitle, XOOPS_URL . '/modules/news/article.php?storyid=' . $previousId);
448
    }
449
450
    if ($nextId > 0) {
451
        $xoopsTpl->assign('next_story_title', $nextTitle);
452
        $hcontent .= sprintf("<link rel=\"Next\" title=\"%s\" href=\"%s/\" />\n", $nextTitle, XOOPS_URL . '/modules/news/article.php?storyid=' . $nextId);
453
    }
454
    $xoopsTpl->assign('lang_previous_story', _NW_PREVIOUS_ARTICLE);
455
    $xoopsTpl->assign('lang_next_story', _NW_NEXT_ARTICLE);
456
    unset($tmparticle);
457
} else {
458
    $xoopsTpl->assign('nav_links', false);
459
}
460
461
/**
462
 * Manage all the meta datas
463
 */
464
news_CreateMetaDatas($article);
465
466
/**
467
 * Show a "Bookmark this article at these sites" block ?
468
 */
469
if (news_getmoduleoption('bookmarkme')) {
470
    $xoopsTpl->assign('bookmarkme', true);
471
    $xoopsTpl->assign('encoded_title', rawurlencode($article->title()));
472
} else {
473
    $xoopsTpl->assign('bookmarkme', false);
474
}
475
476
/**
477
 * Use Facebook Comments Box?
478
 */
479
if (news_getmoduleoption('fbcomments')) {
480
    $xoopsTpl->assign('fbcomments', true);
481
} else {
482
    $xoopsTpl->assign('fbcomments', false);
483
}
484
485
/**
486
 * Enable users to vote
487
 *
488
 * According to a module's option, "ratenews", you can display a link to rate the current news
489
 * The actual rate in showed (and the number of votes)
490
 * Possible modification, restrict votes to registred users
491
 */
492
$other_test = true;
493
if ($cfg['config_rating_registred_only']) {
494
    if (isset($xoopsUser) && is_object($xoopsUser)) {
495
        $other_test = true;
496
    } else {
497
        $other_test = false;
498
    }
499
}
500
501
if (news_getmoduleoption('ratenews') && $other_test) {
502
    $xoopsTpl->assign('rates', true);
503
    $xoopsTpl->assign('lang_ratingc', _NW_RATINGC);
504
    $xoopsTpl->assign('lang_ratethisnews', _NW_RATETHISNEWS);
505
    $story['rating'] = number_format($article->rating(), 2);
506
    if ($article->votes == 1) {
507
        $story['votes'] = _NW_ONEVOTE;
508
    } else {
509
        $story['votes'] = sprintf(_NW_NUMVOTES, $article->votes);
510
    }
511
} else {
512
    $xoopsTpl->assign('rates', false);
513
}
514
515
$xoopsTpl->assign('story', $story);
516
517
// Added in version 1.63, TAGS
518
if (news_getmoduleoption('tags')) {
519
    require_once XOOPS_ROOT_PATH . '/modules/tag/include/tagbar.php';
520
    $xoopsTpl->assign('tags', true);
521
    $xoopsTpl->assign('tagbar', tagBar($storyid, 0));
522
} else {
523
    $xoopsTpl->assign('tags', false);
524
}
525
526
$xoopsTpl->assign('share', $xoopsModuleConfig['share']);
527
$xoopsTpl->assign('showicons', $xoopsModuleConfig['showicons']);
528
529
$canPdf = 1;
530
if (!is_object($GLOBALS["xoopsUser"]) && $xoopsModuleConfig['show_pdficon'] == 0) {
531
    $canPdf = 0;
532
}
533
$xoopsTpl->assign('showPdfIcon', $canPdf);
534
535
//Add style css
536
$xoTheme->addStylesheet('modules/news/assets/css/style.css');
537
538
include_once XOOPS_ROOT_PATH . '/include/comment_view.php';
539
include_once XOOPS_ROOT_PATH . '/footer.php';
540