Passed
Pull Request — master (#41)
by Michael
13:46
created

article.php (1 issue)

Labels
Severity
1
<?php declare(strict_types=1);
2
/*
3
 * You may not change or alter any portion of this comment or credits
4
 * of supporting developers from this source code or any supporting source code
5
 * which is considered copyrighted (c) material of the original comment or credit authors.
6
 *
7
 * This program is distributed in the hope that it will be useful,
8
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10
 */
11
12
/**
13
 * @copyright      {@link https://xoops.org/ XOOPS Project}
14
 * @license        {@link https://www.gnu.org/licenses/gpl-2.0.html GNU GPL 2 or later}
15
 * @author         XOOPS Development Team
16
 */
17
18
/**
19
 * Article's page
20
 *
21
 * This page is used to see an article (or story) and is mainly called from
22
 * the module's index page.
23
 *
24
 * If no story Id has been placed on the URL or if the story is not yet published
25
 * then the page will redirect user to the module's index.
26
 * If the user does not have the permissions to see the article, they are also redirected
27
 * to the module's index page but with an error message saying :
28
 *     "Sorry, you don't have the permission to access this area"
29
 *
30
 * Each time a page is seen, and only if we are on the first page, its counter of hits is
31
 * updated
32
 *
33
 * Each file(s) attached to the article is visible at the bottom of the article and can
34
 * be downloaded
35
 *
36
 * Notes :
37
 * - To create more than one page in your story, use the tag [pagebreak]
38
 * - If you are a module's admin, you have the possibility to see two links at the bottom
39
 *   of the article, "Edit & Delete"
40
 *
41
 * @param int $matches storyid    Id of the story we want to see
42
 * @param int $page        page's number (in the case where there are more than one page)
43
 *
44
 * @page_title                      Article's title - Topic's title - Module's name
45
 *
46
 * @template_name                   news_article.html wich will call news_item.html
47
 *
48
 * Template's variables :
49
 * @template_var                    string    pagenav    some links to navigate thru pages
50
 * @template_var                    array    story    Contains all the information about the story
51
 *                                    Structure :
52
 * @template_var                    int        id            Story's ID
53
 * @template_var                    string    posttime    Story's date of publication
54
 * @template_var                    string    title        A link to go and see all the articles in the same topic and the story's title
55
 * @template_var                    string    news_title    Just the news title
56
 * @template_var                    string    topic_title    Just the topic's title
57
 * @template_var                    string    text        Defined as "The scoop"
58
 * @template_var                    string    poster        A link to see the author's profile and their name or "Anonymous"
59
 * @template_var                    int        posterid    Author's uid (or 0 if it's an anonymous or a user wich does not exist any more)
60
 * @template_var                    string    morelink    Never used ???? May be it could be deleted
61
 * @template_var                    string    adminlink    A link to Edit or Delete the story or a blank string if you are not the module's admin
62
 * @template_var                    string    topicid        News topic's Id
63
 * @template_var                    string    topic_color    Topic's color
64
 * @template_var                    string    imglink        A link to go and see the topic of the story with the topic's picture (if it exists)
65
 * @template_var                    string    align        Topic's image alignement
66
 * @template_var                    int        hits        Story's counter of visits
67
 * @template_var                    string    mail_link    A link (with a mailto) to email the story's URL to someone
68
 * @template_var                    string    lang_printerpage    Used in the link and picture to have a "printable version" (fixed text)
69
 * @template_var                    string    lang_on        Fixed text "On" ("published on")
70
 * @template_var                    string    lang_postedby    Fixed text "Posted by"
71
 * @template_var                    string    lang_reads    Fixed text "Reads"
72
 * @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
73
 * @template_var                    int        summary_count    Number of stories really visibles in the summary table
74
 * @template_var                    boolean    showsummary    According to the module's option named "showsummarytable", this contains "True" of "False"
75
 * @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
76
 *                                    Structure :
77
 * @template_var                    int        story_id        Story's ID
78
 * @template_var                    string    story_title        Story's title
79
 * @template_var                    int        story_hits        Counter of hits
80
 * @template_var                    string    story_published    Story's date of creation
81
 * @template_var                    string    lang_attached_files    Fixed text "Attached Files:"
82
 * @template_var                    int        attached_files_count    Number of files attached to the story
83
 * @template_var                    array    attached_files    Contains the list of all the files attached to the story
84
 *                                    Structure :
85
 * @template_var                    int        file_id                File's ID
86
 * @template_var                    string    visitlink            Link to download the file
87
 * @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)
88
 * @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)
89
 * @template_var                    string    file_mimetype        File's mime type
90
 * @template_var                    string    file_downloadname    Real name of the file on the webserver's disk (changed by the module)
91
 * @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
92
 * @template_var                    int        previous_story_id    Id of the previous story (according to the published date and to the perms)
93
 * @template_var                    int        next_story_id        Id of the next story (according to the published date and to the perms)
94
 * @template_var                    string    previous_story_title    Title of the previous story
95
 * @template_var                    string    next_story_title        Title of the next story
96
 * @template_var                    string    lang_previous_story        Fixed text "Previous article"
97
 * @template_var                    string    lang_next_story            Fixed text "Next article"
98
 * @template_var                    string    lang_other_story        Fixed text "Other articles"
99
 * @template_var                    boolean    rates    To know if rating is enable or not
100
 * @template_var                    string    lang_ratingc    Fixed text "Rating: "
101
 * @template_var                    string    lang_ratethisnews    Fixed text "Rate this News"
102
 * @template_var                    float    rating    Article's rating
103
 * @template_var                    string    votes    "1 vote" or "X votes"
104
 * @template_var                    string    topic_path    A path from the root to the current topic (of the current news)
105
 * @copyright (c)                   XOOPS Project (https://xoops.org)
106
 *
107
 * Parameters received by this page :
108
 *
109
 * @author                          Xoops Modules Dev Team
110
 */
111
112
use Xmf\Request;
113
use XoopsModules\News\{
114
    Files,
115
    Helper,
116
    Keyhighlighter,
117
    NewsStory,
118
    XoopsTree,
119
    PageNav,
120
    Utility
121
};
122
123
124
require_once \dirname(__DIR__, 2) . '/mainfile.php';
125
//require_once XOOPS_ROOT_PATH . '/modules/news/class/class.newsstory.php';
126
//require_once XOOPS_ROOT_PATH . '/modules/news/class/class.sfiles.php';
127
//require_once XOOPS_ROOT_PATH . '/modules/news/class/tree.php';
128
//;
129
//require_once XOOPS_ROOT_PATH . '/modules/news/class/class.newstopic.php';
130
//require_once XOOPS_ROOT_PATH . '/modules/news/class/Keyhighlighter.php';
131
require_once XOOPS_ROOT_PATH . '/modules/news/config.php';
132
133
/** @var Helper $helper */
134
$helper = Helper::getInstance();
135
136
$storyid = Request::getInt('storyid', 0, 'GET');
137
138
if (empty($storyid)) {
139
    redirect_header(XOOPS_URL . '/modules/news/index.php', 2, _NW_NOSTORY);
140
}
141
142
$myts = \MyTextSanitizer::getInstance();
143
144
// Not yet published
145
$article = new NewsStory($storyid);
146
if (0 == $article->published() || $article->published() > time()) {
147
    redirect_header(XOOPS_URL . '/modules/news/index.php', 2, _NW_NOTYETSTORY);
148
}
149
// Expired
150
if (0 != $article->expired() && $article->expired() < time()) {
151
    redirect_header(XOOPS_URL . '/modules/news/index.php', 2, _NW_NOSTORY);
152
}
153
154
/** @var \XoopsGroupPermHandler $grouppermHandler */
155
$grouppermHandler = xoops_getHandler('groupperm');
156
if (is_object($xoopsUser)) {
157
    $groups = $xoopsUser->getGroups();
158
} else {
159
    $groups = XOOPS_GROUP_ANONYMOUS;
160
}
161
if (!$grouppermHandler->checkRight('news_view', $article->topicid(), $groups, $xoopsModule->getVar('mid'))) {
162
    redirect_header(XOOPS_URL . '/modules/news/index.php', 3, _NOPERM);
163
}
164
165
/** @var int $storypage */
166
$storypage  = Request::getInt('page', 0, 'GET');
167
$dateformat = Utility::getModuleOption('dateformat');
168
$hcontent   = '';
169
170
/**
171
 * update counter only when viewing top page and when you are not the author or an admin
172
 */
173
if (empty($_GET['com_id']) && 0 == $storypage) {
174
    if (is_object($xoopsUser)) {
175
        if (($xoopsUser->getVar('uid') == $article->uid()) || Utility::isAdminGroup()) {
176
            // nothing ! ;-)
177
        } else {
178
            $article->updateCounter();
179
        }
180
    } else {
181
        $article->updateCounter();
182
    }
183
}
184
$GLOBALS['xoopsOption']['template_main'] = 'news_article.tpl';
185
require_once XOOPS_ROOT_PATH . '/header.php';
186
187
$story['id']          = $storyid;
188
$story['posttime']    = formatTimestamp($article->published(), $dateformat);
189
$story['news_title']  = $article->title();
190
$story['title']       = $article->textlink() . '&nbsp;:&nbsp;' . $article->title();
191
$story['subtitle']    = $article->subtitle();
192
$story['topic_title'] = $article->textlink();
193
194
$story['text'] = $article->hometext();
195
$bodytext      = $article->bodytext();
196
197
if ('' !== xoops_trim($bodytext)) {
198
    $articletext = [];
199
    if (Utility::getModuleOption('enhanced_pagenav')) {
200
        $articletext             = preg_split('/(\[pagebreak:|\[pagebreak)(.*)(\])/iU', $bodytext);
201
        $arr_titles              = [];
202
        $auto_summary            = $article->auto_summary($bodytext, $arr_titles);
203
        $bodytext                = str_replace('[summary]', $auto_summary, $bodytext);
204
        $articletext[$storypage] = str_replace('[summary]', $auto_summary, $articletext[$storypage]);
205
        $story['text']           = str_replace('[summary]', $auto_summary, $story['text']);
206
    } else {
207
        $articletext = explode('[pagebreak]', $bodytext);
208
    }
209
210
    $story_pages = count($articletext);
211
212
    if ($story_pages > 1) {
213
//        require_once XOOPS_ROOT_PATH . '/modules/news/include/pagenav.php';
214
        $pagenav = new PageNav($story_pages, 1, $storypage, 'page', 'storyid=' . $storyid);
215
        if (Utility::isBot()) { // A bot is reading the articles, we are going to show him all the links to the pages
216
            $xoopsTpl->assign('pagenav', $pagenav->renderNav($story_pages));
217
        } elseif (Utility::getModuleOption('enhanced_pagenav')) {
218
            $xoopsTpl->assign('pagenav', $pagenav->renderEnhancedSelect(true, $arr_titles));
219
        } else {
220
            $xoopsTpl->assign('pagenav', $pagenav->renderNav());
221
        }
222
223
        if (0 == $storypage) {
224
            $story['text'] .= '<br>' . Utility::getModuleOption('advertisement') . '<br>' . $articletext[$storypage];
225
        } else {
226
            $story['text'] = $articletext[$storypage];
227
        }
228
    } else {
229
        $story['text'] .= '<br>' . Utility::getModuleOption('advertisement') . '<br>' . $bodytext;
230
    }
231
}
232
// Publicit�
233
$xoopsTpl->assign('advertisement', Utility::getModuleOption('advertisement'));
234
235
// ****************************************************************************************************************
236
/**
237
 * @param $matches
238
 *
239
 * @return string
240
 */
241
function my_highlighter($matches): string
242
{
243
    $color = Utility::getModuleOption('highlightcolor');
244
    if (0 !== mb_strpos($color, '#')) {
245
        $color = '#' . $color;
246
    }
247
248
    return '<span style="font-weight: bolder; background-color: ' . $color . ';">' . $matches[0] . '</span>';
249
}
250
251
$highlight = false;
252
$highlight = Utility::getModuleOption('keywordshighlight');
253
254
if ($highlight && isset($_GET['keywords'])) {
255
    $keywords      = htmlspecialchars(trim(urldecode($_GET['keywords'])), ENT_QUOTES | ENT_HTML5);
256
    $h             = new Keyhighlighter($keywords, true, 'my_highlighter');
257
    $story['text'] = $h->highlight($story['text']);
258
}
259
// ****************************************************************************************************************
260
261
$story['poster'] = $article->uname();
262
if ($story['poster']) {
263
    $story['posterid']         = $article->uid();
264
    $story['poster']           = '<a href="' . XOOPS_URL . '/userinfo.php?uid=' . $story['posterid'] . '">' . $story['poster'] . '</a>';
265
    $tmp_user                  = new \XoopsUser($article->uid());
0 ignored issues
show
$article->uid() of type integer is incompatible with the type array|null expected by parameter $id of XoopsUser::__construct(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

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