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 | use XoopsModules\News\Files; |
||||||
115 | use XoopsModules\News\Helper; |
||||||
116 | use XoopsModules\News\Keyhighlighter; |
||||||
117 | use XoopsModules\News\NewsStory; |
||||||
118 | |||||||
119 | require_once \dirname(__DIR__, 2) . '/mainfile.php'; |
||||||
120 | //require_once XOOPS_ROOT_PATH . '/modules/news/class/class.newsstory.php'; |
||||||
121 | //require_once XOOPS_ROOT_PATH . '/modules/news/class/class.sfiles.php'; |
||||||
122 | //require_once XOOPS_ROOT_PATH . '/modules/news/class/tree.php'; |
||||||
123 | //; |
||||||
124 | //require_once XOOPS_ROOT_PATH . '/modules/news/class/class.newstopic.php'; |
||||||
125 | //require_once XOOPS_ROOT_PATH . '/modules/news/class/Keyhighlighter.php'; |
||||||
126 | require_once XOOPS_ROOT_PATH . '/modules/news/config.php'; |
||||||
127 | |||||||
128 | /** @var Helper $helper */ |
||||||
129 | $helper = Helper::getInstance(); |
||||||
130 | |||||||
131 | $storyid = Request::getInt('storyid', 0, 'GET'); |
||||||
132 | |||||||
133 | if (empty($storyid)) { |
||||||
134 | redirect_header(XOOPS_URL . '/modules/news/index.php', 2, _NW_NOSTORY); |
||||||
135 | } |
||||||
136 | |||||||
137 | $myts = \MyTextSanitizer::getInstance(); |
||||||
138 | |||||||
139 | // Not yet published |
||||||
140 | $article = new NewsStory($storyid); |
||||||
141 | if (0 == $article->published() || $article->published() > time()) { |
||||||
142 | redirect_header(XOOPS_URL . '/modules/news/index.php', 2, _NW_NOTYETSTORY); |
||||||
143 | } |
||||||
144 | // Expired |
||||||
145 | if (0 != $article->expired() && $article->expired() < time()) { |
||||||
146 | redirect_header(XOOPS_URL . '/modules/news/index.php', 2, _NW_NOSTORY); |
||||||
147 | } |
||||||
148 | |||||||
149 | /** @var \XoopsGroupPermHandler $grouppermHandler */ |
||||||
150 | $grouppermHandler = xoops_getHandler('groupperm'); |
||||||
151 | if (is_object($xoopsUser)) { |
||||||
152 | $groups = $xoopsUser->getGroups(); |
||||||
153 | } else { |
||||||
154 | $groups = XOOPS_GROUP_ANONYMOUS; |
||||||
155 | } |
||||||
156 | if (!$grouppermHandler->checkRight('news_view', $article->topicid(), $groups, $xoopsModule->getVar('mid'))) { |
||||||
157 | redirect_header(XOOPS_URL . '/modules/news/index.php', 3, _NOPERM); |
||||||
158 | } |
||||||
159 | |||||||
160 | $storypage = Request::getInt('page', 0, 'GET'); |
||||||
161 | $dateformat = News\Utility::getModuleOption('dateformat'); |
||||||
162 | $hcontent = ''; |
||||||
163 | |||||||
164 | /** |
||||||
165 | * update counter only when viewing top page and when you are not the author or an admin |
||||||
166 | */ |
||||||
167 | if (empty($_GET['com_id']) && 0 == $storypage) { |
||||||
168 | if (is_object($xoopsUser)) { |
||||||
169 | if (($xoopsUser->getVar('uid') == $article->uid()) || News\Utility::isAdminGroup()) { |
||||||
170 | // nothing ! ;-) |
||||||
171 | } else { |
||||||
172 | $article->updateCounter(); |
||||||
173 | } |
||||||
174 | } else { |
||||||
175 | $article->updateCounter(); |
||||||
176 | } |
||||||
177 | } |
||||||
178 | $GLOBALS['xoopsOption']['template_main'] = 'news_article.tpl'; |
||||||
179 | require_once XOOPS_ROOT_PATH . '/header.php'; |
||||||
180 | |||||||
181 | $story['id'] = $storyid; |
||||||
182 | $story['posttime'] = formatTimestamp($article->published(), $dateformat); |
||||||
183 | $story['news_title'] = $article->title(); |
||||||
184 | $story['title'] = $article->textlink() . ' : ' . $article->title(); |
||||||
185 | $story['subtitle'] = $article->subtitle(); |
||||||
186 | $story['topic_title'] = $article->textlink(); |
||||||
187 | |||||||
188 | $story['text'] = $article->hometext(); |
||||||
189 | $bodytext = $article->bodytext(); |
||||||
190 | |||||||
191 | if ('' !== xoops_trim($bodytext)) { |
||||||
192 | $articletext = []; |
||||||
193 | if (News\Utility::getModuleOption('enhanced_pagenav')) { |
||||||
194 | $articletext = preg_split('/(\[pagebreak:|\[pagebreak)(.*)(\])/iU', $bodytext); |
||||||
195 | $arr_titles = []; |
||||||
196 | $auto_summary = $article->auto_summary($bodytext, $arr_titles); |
||||||
197 | $bodytext = str_replace('[summary]', $auto_summary, $bodytext); |
||||||
198 | $articletext[$storypage] = str_replace('[summary]', $auto_summary, $articletext[$storypage]); |
||||||
199 | $story['text'] = str_replace('[summary]', $auto_summary, $story['text']); |
||||||
200 | } else { |
||||||
201 | $articletext = explode('[pagebreak]', $bodytext); |
||||||
202 | } |
||||||
203 | |||||||
204 | $story_pages = count($articletext); |
||||||
205 | |||||||
206 | if ($story_pages > 1) { |
||||||
207 | require_once XOOPS_ROOT_PATH . '/modules/news/include/pagenav.php'; |
||||||
208 | $pagenav = new \XoopsPageNav($story_pages, 1, $storypage, 'page', 'storyid=' . $storyid); |
||||||
209 | if (News\Utility::isBot()) { // A bot is reading the articles, we are going to show him all the links to the pages |
||||||
210 | $xoopsTpl->assign('pagenav', $pagenav->renderNav($story_pages)); |
||||||
211 | } elseif (News\Utility::getModuleOption('enhanced_pagenav')) { |
||||||
212 | $xoopsTpl->assign('pagenav', $pagenav->renderEnhancedSelect(true, $arr_titles)); |
||||||
0 ignored issues
–
show
|
|||||||
213 | } else { |
||||||
214 | $xoopsTpl->assign('pagenav', $pagenav->renderNav()); |
||||||
215 | } |
||||||
216 | |||||||
217 | if (0 == $storypage) { |
||||||
218 | $story['text'] .= '<br>' . News\Utility::getModuleOption('advertisement') . '<br>' . $articletext[$storypage]; |
||||||
219 | } else { |
||||||
220 | $story['text'] = $articletext[$storypage]; |
||||||
221 | } |
||||||
222 | } else { |
||||||
223 | $story['text'] .= '<br>' . News\Utility::getModuleOption('advertisement') . '<br>' . $bodytext; |
||||||
224 | } |
||||||
225 | } |
||||||
226 | // Publicit� |
||||||
227 | $xoopsTpl->assign('advertisement', News\Utility::getModuleOption('advertisement')); |
||||||
228 | |||||||
229 | // **************************************************************************************************************** |
||||||
230 | /** |
||||||
231 | * @param $matches |
||||||
232 | * |
||||||
233 | * @return string |
||||||
234 | */ |
||||||
235 | function my_highlighter($matches) |
||||||
236 | { |
||||||
237 | $color = News\Utility::getModuleOption('highlightcolor'); |
||||||
238 | if (0 !== mb_strpos($color, '#')) { |
||||||
239 | $color = '#' . $color; |
||||||
240 | } |
||||||
241 | |||||||
242 | return '<span style="font-weight: bolder; background-color: ' . $color . ';">' . $matches[0] . '</span>'; |
||||||
243 | } |
||||||
244 | |||||||
245 | $highlight = false; |
||||||
246 | $highlight = News\Utility::getModuleOption('keywordshighlight'); |
||||||
247 | |||||||
248 | if ($highlight && isset($_GET['keywords'])) { |
||||||
249 | $keywords = htmlspecialchars(trim(urldecode($_GET['keywords'])), ENT_QUOTES | ENT_HTML5); |
||||||
250 | $h = new Keyhighlighter($keywords, true, 'my_highlighter'); |
||||||
251 | $story['text'] = $h->highlight($story['text']); |
||||||
252 | } |
||||||
253 | // **************************************************************************************************************** |
||||||
254 | |||||||
255 | $story['poster'] = $article->uname(); |
||||||
256 | if ($story['poster']) { |
||||||
257 | $story['posterid'] = $article->uid(); |
||||||
258 | $story['poster'] = '<a href="' . XOOPS_URL . '/userinfo.php?uid=' . $story['posterid'] . '">' . $story['poster'] . '</a>'; |
||||||
259 | $tmp_user = new \XoopsUser($article->uid()); |
||||||
260 | $story['poster_avatar'] = XOOPS_UPLOAD_URL . '/' . $tmp_user->getVar('user_avatar'); |
||||||
261 | $story['poster_signature'] = $tmp_user->getVar('user_sig'); |
||||||
262 | $story['poster_email'] = $tmp_user->getVar('email'); |
||||||
263 | $story['poster_url'] = $tmp_user->getVar('url'); |
||||||
264 | $story['poster_from'] = $tmp_user->getVar('user_from'); |
||||||
265 | unset($tmp_user); |
||||||
266 | } else { |
||||||
267 | $story['poster'] = ''; |
||||||
268 | $story['posterid'] = 0; |
||||||
269 | $story['poster_avatar'] = ''; |
||||||
270 | $story['poster_signature'] = ''; |
||||||
271 | $story['poster_email'] = ''; |
||||||
272 | $story['poster_url'] = ''; |
||||||
273 | $story['poster_from'] = ''; |
||||||
274 | if (3 != News\Utility::getModuleOption('displayname')) { |
||||||
275 | $story['poster'] = $xoopsConfig['anonymous']; |
||||||
276 | } |
||||||
277 | } |
||||||
278 | $story['morelink'] = ''; |
||||||
279 | $story['adminlink'] = ''; |
||||||
280 | unset($isadmin); |
||||||
281 | |||||||
282 | if (is_object($xoopsUser)) { |
||||||
283 | if ($xoopsUser->isAdmin($xoopsModule->getVar('mid')) |
||||||
284 | || (News\Utility::getModuleOption('authoredit') |
||||||
285 | && $article->uid() == $xoopsUser->getVar('uid'))) { |
||||||
286 | $isadmin = true; |
||||||
287 | // $story['adminlink'] = $article->adminlink(); |
||||||
288 | } |
||||||
289 | } |
||||||
290 | $story['topicid'] = $article->topicid(); |
||||||
291 | $story['topic_color'] = '#' . $myts->displayTarea($article->topic_color); |
||||||
0 ignored issues
–
show
|
|||||||
292 | |||||||
293 | $story['imglink'] = ''; |
||||||
294 | $story['align'] = ''; |
||||||
295 | if ($article->topicdisplay()) { |
||||||
296 | $story['imglink'] = $article->imglink(); |
||||||
297 | $story['align'] = $article->topicalign(); |
||||||
298 | } |
||||||
299 | $story['hits'] = $article->counter(); |
||||||
300 | $story['mail_link'] = 'mailto:?subject=' . sprintf(_NW_INTARTICLE, $xoopsConfig['sitename']) . '&body=' . sprintf(_NW_INTARTFOUND, $xoopsConfig['sitename']) . ': ' . XOOPS_URL . '/modules/news/article.php?storyid=' . $article->storyid(); |
||||||
301 | $xoopsTpl->assign('lang_printerpage', _NW_PRINTERFRIENDLY); |
||||||
302 | $xoopsTpl->assign('lang_sendstory', _NW_SENDSTORY); |
||||||
303 | $xoopsTpl->assign('lang_pdfstory', _NW_MAKEPDF); |
||||||
304 | $xoopsTpl->assign('lang_on', _ON); |
||||||
305 | $xoopsTpl->assign('lang_postedby', _POSTEDBY); |
||||||
306 | $xoopsTpl->assign('lang_reads', _READS); |
||||||
307 | $xoopsTpl->assign('mail_link', 'mailto:?subject=' . sprintf(_NW_INTARTICLE, $xoopsConfig['sitename']) . '&body=' . sprintf(_NW_INTARTFOUND, $xoopsConfig['sitename']) . ': ' . XOOPS_URL . '/modules/news/article.php?storyid=' . $article->storyid()); |
||||||
308 | |||||||
309 | if ('' !== xoops_trim($article->picture())) { |
||||||
310 | $story['picture'] = XOOPS_URL . '/uploads/news/image/' . $article->picture(); |
||||||
311 | $story['pictureinfo'] = $article->pictureinfo(); |
||||||
312 | } else { |
||||||
313 | $story['picture'] = ''; |
||||||
314 | $story['pictureinfo'] = ''; |
||||||
315 | } |
||||||
316 | |||||||
317 | $xoopsTpl->assign('lang_attached_files', _NW_ATTACHEDFILES); |
||||||
318 | $sfiles = new Files(); |
||||||
319 | $filesarr = $newsfiles = []; |
||||||
320 | $filesarr = $sfiles->getAllbyStory($storyid); |
||||||
321 | $filescount = count($filesarr); |
||||||
322 | $xoopsTpl->assign('attached_files_count', $filescount); |
||||||
323 | if ($filescount > 0) { |
||||||
324 | foreach ($filesarr as $onefile) { |
||||||
325 | $newsfiles[] = [ |
||||||
326 | 'file_id' => $onefile->getFileid(), |
||||||
327 | 'visitlink' => XOOPS_URL . '/modules/news/visit.php?fileid=' . $onefile->getFileid(), |
||||||
328 | 'file_realname' => $onefile->getFileRealName(), |
||||||
329 | 'file_attacheddate' => formatTimestamp($onefile->getDate(), $dateformat), |
||||||
330 | 'file_mimetype' => $onefile->getMimetype(), |
||||||
331 | 'file_downloadname' => XOOPS_UPLOAD_URL . '/' . $onefile->getDownloadname(), |
||||||
332 | ]; |
||||||
333 | } |
||||||
334 | $xoopsTpl->assign('attached_files', $newsfiles); |
||||||
335 | } |
||||||
336 | |||||||
337 | /** |
||||||
338 | * Create page's title |
||||||
339 | */ |
||||||
340 | $complement = ''; |
||||||
341 | if (News\Utility::getModuleOption('enhanced_pagenav') |
||||||
342 | && (isset($arr_titles) && is_array($arr_titles) |
||||||
343 | && isset($arr_titles, $storypage) |
||||||
344 | && $storypage > 0)) { |
||||||
345 | $complement = ' - ' . $arr_titles[$storypage]; |
||||||
346 | } |
||||||
347 | $xoopsTpl->assign('xoops_pagetitle', $article->title() . $complement . ' - ' . $article->topic_title() . ' - ' . $xoopsModule->name('s')); |
||||||
348 | |||||||
349 | if (News\Utility::getModuleOption('newsbythisauthor')) { |
||||||
350 | $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)); |
||||||
351 | } |
||||||
352 | |||||||
353 | /** |
||||||
354 | * Create a clickable path from the root to the current topic (if we are viewing a topic) |
||||||
355 | * Actually this is not used in the default's templates but you can use it as you want |
||||||
356 | * Uncomment the code to be able to use it |
||||||
357 | */ |
||||||
358 | if ($cfg['create_clickable_path']) { |
||||||
359 | $mytree = new \XoopsModules\News\ObjectTree($xoopsDB->prefix('news_topics'), 'topic_id', 'topic_pid'); |
||||||
360 | $topicpath = $mytree->getNicePathFromId($article->topicid(), 'topic_title', 'index.php?op=1'); |
||||||
0 ignored issues
–
show
The method
getNicePathFromId() does not exist on XoopsModules\News\ObjectTree .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. ![]() |
|||||||
361 | $xoopsTpl->assign('topic_path', $topicpath); |
||||||
362 | unset($mytree); |
||||||
363 | } |
||||||
364 | |||||||
365 | /** |
||||||
366 | * Summary table |
||||||
367 | * |
||||||
368 | * When you are viewing an article, you can see a summary table containing |
||||||
369 | * the first n links to the last published news. |
||||||
370 | * This summary table is visible according to a module's option (showsummarytable) |
||||||
371 | * The number of items is equal to the module's option "storyhome" ("Select the number |
||||||
372 | * of news items to display on top page") |
||||||
373 | * We also use the module's option "restrictindex" ("Restrict Topics on Index Page"), like |
||||||
374 | * this you (the webmaster) select if users can see restricted stories or not. |
||||||
375 | */ |
||||||
376 | if (News\Utility::getModuleOption('showsummarytable')) { |
||||||
377 | $xoopsTpl->assign('showsummary', true); |
||||||
378 | $xoopsTpl->assign('lang_other_story', _NW_OTHER_ARTICLES); |
||||||
379 | $count = 0; |
||||||
380 | $tmparticle = new NewsStory(); |
||||||
381 | $infotips = News\Utility::getModuleOption('infotips'); |
||||||
382 | $sarray = NewsStory::getAllPublished($cfg['article_summary_items_count'], 0, $helper->getConfig('restrictindex')); |
||||||
383 | if (count($sarray) > 0) { |
||||||
384 | foreach ($sarray as $onearticle) { |
||||||
385 | ++$count; |
||||||
386 | $htmltitle = ''; |
||||||
387 | $tooltips = ''; |
||||||
388 | $htmltitle = ''; |
||||||
389 | if ($infotips > 0) { |
||||||
390 | $tooltips = News\Utility::makeInfotips($onearticle->hometext()); |
||||||
391 | $htmltitle = ' title="' . $tooltips . '"'; |
||||||
392 | } |
||||||
393 | $xoopsTpl->append( |
||||||
394 | 'summary', |
||||||
395 | [ |
||||||
396 | 'story_id' => $onearticle->storyid(), |
||||||
397 | 'htmltitle' => $htmltitle, |
||||||
398 | 'infotips' => $tooltips, |
||||||
399 | 'story_title' => $onearticle->title(), |
||||||
400 | 'story_hits' => $onearticle->counter(), |
||||||
401 | 'story_published' => formatTimestamp($onearticle->published, $dateformat), |
||||||
402 | ] |
||||||
403 | ); |
||||||
404 | } |
||||||
405 | } |
||||||
406 | $xoopsTpl->assign('summary_count', $count); |
||||||
407 | unset($tmparticle); |
||||||
408 | } else { |
||||||
409 | $xoopsTpl->assign('showsummary', false); |
||||||
410 | } |
||||||
411 | |||||||
412 | /** |
||||||
413 | * Show a link to go to the previous article and to the next article |
||||||
414 | * |
||||||
415 | * According to a module's option "showprevnextlink" ("Show Previous and Next link?") |
||||||
416 | * you can display, at the bottom of each article, two links used to navigate thru stories. |
||||||
417 | * This feature uses the module's option "restrictindex" so that we can, or can't see |
||||||
418 | * restricted stories |
||||||
419 | */ |
||||||
420 | if (News\Utility::getModuleOption('showprevnextlink')) { |
||||||
421 | $xoopsTpl->assign('nav_links', true); |
||||||
422 | $tmparticle = new NewsStory(); |
||||||
423 | $nextId = $previousId = -1; |
||||||
424 | $next = $previous = []; |
||||||
425 | $previousTitle = $nextTitle = ''; |
||||||
426 | |||||||
427 | $next = $tmparticle->getNextArticle($storyid, $helper->getConfig('restrictindex')); |
||||||
428 | if (count($next) > 0) { |
||||||
429 | $nextId = $next['storyid']; |
||||||
430 | $nextTitle = $next['title']; |
||||||
431 | } |
||||||
432 | |||||||
433 | $previous = $tmparticle->getPreviousArticle($storyid, $helper->getConfig('restrictindex')); |
||||||
434 | if (count($previous) > 0) { |
||||||
435 | $previousId = $previous['storyid']; |
||||||
436 | $previousTitle = $previous['title']; |
||||||
437 | } |
||||||
438 | |||||||
439 | $xoopsTpl->assign('previous_story_id', $previousId); |
||||||
440 | $xoopsTpl->assign('next_story_id', $nextId); |
||||||
441 | if ($previousId > 0) { |
||||||
442 | $xoopsTpl->assign('previous_story_title', $previousTitle); |
||||||
443 | $hcontent .= sprintf("<link rel=\"Prev\" title=\"%s\" href=\"%s/\">\n", $previousTitle, XOOPS_URL . '/modules/news/article.php?storyid=' . $previousId); |
||||||
444 | } |
||||||
445 | |||||||
446 | if ($nextId > 0) { |
||||||
447 | $xoopsTpl->assign('next_story_title', $nextTitle); |
||||||
448 | $hcontent .= sprintf("<link rel=\"Next\" title=\"%s\" href=\"%s/\">\n", $nextTitle, XOOPS_URL . '/modules/news/article.php?storyid=' . $nextId); |
||||||
449 | } |
||||||
450 | $xoopsTpl->assign('lang_previous_story', _NW_PREVIOUS_ARTICLE); |
||||||
451 | $xoopsTpl->assign('lang_next_story', _NW_NEXT_ARTICLE); |
||||||
452 | unset($tmparticle); |
||||||
453 | } else { |
||||||
454 | $xoopsTpl->assign('nav_links', false); |
||||||
455 | } |
||||||
456 | |||||||
457 | /** |
||||||
458 | * Manage all the meta datas |
||||||
459 | */ |
||||||
460 | News\Utility::createMetaDatas($article); |
||||||
461 | |||||||
462 | /** |
||||||
463 | * Show a "Bookmark this article at these sites" block ? |
||||||
464 | */ |
||||||
465 | if (News\Utility::getModuleOption('bookmarkme')) { |
||||||
466 | $xoopsTpl->assign('bookmarkme', true); |
||||||
467 | $xoopsTpl->assign('encoded_title', rawurlencode($article->title())); |
||||||
468 | } else { |
||||||
469 | $xoopsTpl->assign('bookmarkme', false); |
||||||
470 | } |
||||||
471 | |||||||
472 | /** |
||||||
473 | * Use Facebook Comments Box? |
||||||
474 | */ |
||||||
475 | if (News\Utility::getModuleOption('fbcomments')) { |
||||||
476 | $xoopsTpl->assign('fbcomments', true); |
||||||
477 | } else { |
||||||
478 | $xoopsTpl->assign('fbcomments', false); |
||||||
479 | } |
||||||
480 | |||||||
481 | /** |
||||||
482 | * Enable users to vote |
||||||
483 | * |
||||||
484 | * According to a module's option, "ratenews", you can display a link to rate the current news |
||||||
485 | * The actual rate in showed (and the number of votes) |
||||||
486 | * Possible modification, restrict votes to registred users |
||||||
487 | */ |
||||||
488 | $other_test = true; |
||||||
489 | if ($cfg['config_rating_registred_only']) { |
||||||
490 | if (isset($xoopsUser) && is_object($xoopsUser)) { |
||||||
491 | $other_test = true; |
||||||
492 | } else { |
||||||
493 | $other_test = false; |
||||||
494 | } |
||||||
495 | } |
||||||
496 | |||||||
497 | if (News\Utility::getModuleOption('ratenews') && $other_test) { |
||||||
498 | $xoopsTpl->assign('rates', true); |
||||||
499 | $xoopsTpl->assign('lang_ratingc', _NW_RATINGC); |
||||||
500 | $xoopsTpl->assign('lang_ratethisnews', _NW_RATETHISNEWS); |
||||||
501 | $story['rating'] = number_format($article->rating(), 2); |
||||||
502 | if (1 == $article->votes) { |
||||||
503 | $story['votes'] = _NW_ONEVOTE; |
||||||
504 | } else { |
||||||
505 | $story['votes'] = sprintf(_NW_NUMVOTES, $article->votes); |
||||||
506 | } |
||||||
507 | } else { |
||||||
508 | $xoopsTpl->assign('rates', false); |
||||||
509 | } |
||||||
510 | |||||||
511 | $xoopsTpl->assign('story', $story); |
||||||
512 | |||||||
513 | // Added in version 1.63, TAGS |
||||||
514 | $helper = Helper::getInstance(); |
||||||
515 | $xoopsTpl->assign('tags', false); |
||||||
516 | if (1 == $helper->getConfig('tags') && \class_exists(\XoopsModules\Tag\Tagbar::class) && \xoops_isActiveModule('tag')) { |
||||||
517 | $xoopsTpl->assign('tags', true); |
||||||
518 | $tagbarObj = new \XoopsModules\Tag\Tagbar(); |
||||||
519 | $xoopsTpl->assign('tagbar', $tagbarObj->getTagbar($storyid, 0)); |
||||||
520 | } |
||||||
521 | |||||||
522 | $xoopsTpl->assign('share', $helper->getConfig('share')); |
||||||
523 | $xoopsTpl->assign('showicons', $helper->getConfig('showicons')); |
||||||
524 | |||||||
525 | $canPdf = 1; |
||||||
526 | if (!is_object($GLOBALS['xoopsUser']) && 0 == $helper->getConfig('show_pdficon')) { |
||||||
527 | $canPdf = 0; |
||||||
528 | } |
||||||
529 | $xoopsTpl->assign('showPdfIcon', $canPdf); |
||||||
530 | |||||||
531 | if (1 == News\Utility::getModuleOption('displaytopictitle')) { |
||||||
532 | $xoopsTpl->assign('displaytopictitle', true); |
||||||
533 | } else { |
||||||
534 | $xoopsTpl->assign('displaytopictitle', false); |
||||||
535 | } |
||||||
536 | |||||||
537 | //Add style css |
||||||
538 | $xoTheme->addStylesheet('modules/news/assets/css/style.css'); |
||||||
539 | |||||||
540 | require XOOPS_ROOT_PATH . '/include/comment_view.php'; |
||||||
541 | require_once XOOPS_ROOT_PATH . '/footer.php'; |
||||||
542 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.