XoopsModules25x /
xoopspoll
This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include, or for example
via PHP's auto-loading mechanism.
| 1 | <?php declare(strict_types=1); |
||||||
| 2 | /*------------------------------------------------------------------------ |
||||||
| 3 | XOOPS - PHP Content Management System |
||||||
| 4 | Copyright (c) 2000-2020 XOOPS.org |
||||||
| 5 | <https://xoops.org> |
||||||
| 6 | ------------------------------------------------------------------------ |
||||||
| 7 | This program is free software; you can redistribute it and/or modify |
||||||
| 8 | it under the terms of the GNU General Public License as published by |
||||||
| 9 | the Free Software Foundation; either version 2 of the License, or |
||||||
| 10 | (at your option) any later version. |
||||||
| 11 | |||||||
| 12 | You may not change or alter any portion of this comment or credits |
||||||
| 13 | of supporting developers from this source code or any supporting |
||||||
| 14 | source code which is considered copyrighted (c) material of the |
||||||
| 15 | original comment or credit authors. |
||||||
| 16 | |||||||
| 17 | This program is distributed in the hope that it will be useful, |
||||||
| 18 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
| 19 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||||
| 20 | GNU General Public License for more details. |
||||||
| 21 | |||||||
| 22 | You should have received a copy of the GNU General Public License |
||||||
| 23 | along with this program; if not, write to the Free Software |
||||||
| 24 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
||||||
| 25 | ------------------------------------------------------------------------ |
||||||
| 26 | Author: phppp (D.J., [email protected]) |
||||||
| 27 | URL: https://xoopsforge.com, https://xoops.org.cn |
||||||
| 28 | Project: Article Project |
||||||
| 29 | ------------------------------------------------------------------------ |
||||||
| 30 | */ |
||||||
| 31 | |||||||
| 32 | /** |
||||||
| 33 | * View Forum Topic with poll support |
||||||
| 34 | * |
||||||
| 35 | * @copyright:: {@link https://xoops.org/ XOOPS Project} |
||||||
| 36 | * @license :: {@link https://www.gnu.org/licenses/gpl-2.0.html GNU GPL 2.0 or later} |
||||||
| 37 | * @author :: phppp (D.J.) <[email protected]> |
||||||
| 38 | */ |
||||||
| 39 | |||||||
| 40 | use Xmf\Request; |
||||||
| 41 | use XoopsModules\Newbb; |
||||||
| 42 | use XoopsModules\Xoopspoll; |
||||||
| 43 | |||||||
| 44 | // irmtfan enhance include |
||||||
| 45 | require_once __DIR__ . '/header.php'; |
||||||
| 46 | $xoopsLogger->startTime('newbb_viewtopic'); |
||||||
| 47 | //mod_loadFunctions('read', 'newbb'); |
||||||
| 48 | //mod_loadFunctions('render', 'newbb'); |
||||||
| 49 | require_once dirname(__DIR__) . '/include/functions.read.php'; |
||||||
| 50 | require_once dirname(__DIR__) . '/include/functions.render.php'; |
||||||
| 51 | xoops_loadLanguage('user'); // irmtfan add last_login |
||||||
| 52 | |||||||
| 53 | /*Build the page query*/ |
||||||
| 54 | $query_vars = ['post_id', 'topic_id', 'status', 'order', 'start', 'move', 'mode']; |
||||||
| 55 | $query_array = []; |
||||||
| 56 | foreach ($query_vars as $var) { |
||||||
| 57 | if (!empty($_GET[$var])) { |
||||||
| 58 | $query_array[$var] = "{$var}={$_GET[$var]}"; |
||||||
| 59 | } |
||||||
| 60 | } |
||||||
| 61 | $page_query = htmlspecialchars(implode('&', $query_array), ENT_QUOTES | ENT_HTML5); |
||||||
| 62 | unset($query_array); |
||||||
| 63 | |||||||
| 64 | $forum_id = Request::getInt('forum', 0, 'GET'); |
||||||
| 65 | $read = (!empty($_GET['read']) && 'new' === $_GET['read']) ? $_GET['read'] : ''; |
||||||
| 66 | $topic_id = Request::getInt('topic_id', 0, 'GET'); |
||||||
| 67 | $post_id = Request::getInt('post_id', 0, 'GET'); |
||||||
| 68 | $move = isset($_GET['move']) ? mb_strtolower($_GET['move']) : ''; |
||||||
| 69 | $start = Request::getInt('start', 0, 'GET'); |
||||||
| 70 | $status = (!empty($_GET['status']) |
||||||
| 71 | && in_array($_GET['status'], ['active', 'pending', 'deleted'], true)) ? $_GET['status'] : ''; |
||||||
| 72 | $mode = Request::getInt('mode', (!empty($status) ? 2 : 0), 'GET'); |
||||||
| 73 | $order = (!empty($_GET['order']) && in_array($_GET['order'], ['ASC', 'DESC'], true)) ? $_GET['order'] : ''; |
||||||
| 74 | |||||||
| 75 | if ('' === $order) { |
||||||
| 76 | if (($xoopsUser instanceof \XoopsUser) && $xoopsUser->isActive()) { |
||||||
| 77 | $order = (1 === $xoopsUser->getVar('uorder')) ? 'DESC' : 'ASC'; |
||||||
| 78 | } else { |
||||||
| 79 | $order = (1 === $xoopsConfig['com_order']) ? 'DESC' : 'ASC'; |
||||||
| 80 | } |
||||||
| 81 | } |
||||||
| 82 | |||||||
| 83 | if (!$topic_id && !$post_id) { |
||||||
| 84 | $redirect = empty($forum_id) ? XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/index.php' : XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . "/viewforum.php?forum={$forum_id}"; |
||||||
| 85 | redirect_header($redirect, 2, _MD_ERRORTOPIC); |
||||||
| 86 | } |
||||||
| 87 | /** @var Newbb\TopicHandler $topicHandler */ |
||||||
| 88 | $topicHandler = Newbb\Helper::getInstance()->getHandler('Topic'); |
||||||
| 89 | if (!empty($post_id)) { |
||||||
| 90 | $topic_obj = $topicHandler->getByPost($post_id); |
||||||
| 91 | $topic_id = $topic_obj->getVar('topic_id'); |
||||||
| 92 | } elseif (!empty($move)) { |
||||||
| 93 | $topic_obj = $topicHandler->getByMove($topic_id, ('prev' === $move) ? -1 : 1, $forum_id); |
||||||
| 94 | $topic_id = $topic_obj->getVar('topic_id'); |
||||||
| 95 | } else { |
||||||
| 96 | $topic_obj = $topicHandler->get($topic_id); |
||||||
| 97 | } |
||||||
| 98 | |||||||
| 99 | if ((!$topic_obj instanceof Newbb\Topic) || !$topic_id = $topic_obj->getVar('topic_id')) { |
||||||
| 100 | $redirect = empty($forum_id) ? XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/index.php' : XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . "/viewforum.php?forum={$forum_id}"; |
||||||
| 101 | redirect_header($redirect, 2, _MD_ERRORTOPIC); |
||||||
| 102 | } |
||||||
| 103 | $forum_id = $topic_obj->getVar('forum_id'); |
||||||
| 104 | /** @var Newbb\ForumHandler $forumHandler */ |
||||||
| 105 | $forumHandler = Newbb\Helper::getInstance()->getHandler('Forum'); |
||||||
| 106 | /** @var Newbb\Forum $forum_obj */ |
||||||
| 107 | $forum_obj = $forumHandler->get($forum_id); |
||||||
| 108 | |||||||
| 109 | $isadmin = newbb_isAdmin($forum_obj); |
||||||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||||||
| 110 | |||||||
| 111 | if ((!$isadmin && $topic_obj->getVar('approved') < 0) || (!$forumHandler->getPermission($forum_obj)) |
||||||
| 112 | || (!$topicHandler->getPermission($forum_obj, $topic_obj->getVar('topic_status'), 'view'))) { |
||||||
| 113 | redirect_header(XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/viewforum.php?forum=' . $forum_id, 2, _MD_NORIGHTTOVIEW); |
||||||
| 114 | } |
||||||
| 115 | |||||||
| 116 | // START irmtfan - find if topic is read or unread - for all users (member and anon) |
||||||
| 117 | $topic_is_unread = true; |
||||||
| 118 | /* if $GLOBALS['xoopsModuleConfig']["read_mode"] == 0 || |
||||||
| 119 | * never read && $GLOBALS['xoopsModuleConfig']["read_mode"] == 1 || |
||||||
| 120 | * never read && $GLOBALS['xoopsModuleConfig']["read_mode"] == 2 || |
||||||
| 121 | * => $topic_last_post_time_or_id_read = NULL |
||||||
| 122 | * if !$xoopsUser && $GLOBALS['xoopsModuleConfig']["read_mode"] == 2 |
||||||
| 123 | * => $topic_last_post_time_or_id_read = false |
||||||
| 124 | * if !$xoopsUser && $GLOBALS['xoopsModuleConfig']["read_mode"] == 1 |
||||||
| 125 | * => $topic_last_post_time_or_id_read = lastview(newbb_IP{ip}LT) |
||||||
| 126 | */ |
||||||
| 127 | $topic_last_post_time_or_id_read = newbb_getRead('topic', $topic_id); |
||||||
|
0 ignored issues
–
show
The function
newbb_getRead was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 128 | if (!empty($topic_last_post_time_or_id_read)) { |
||||||
| 129 | if (1 === $GLOBALS['xoopsModuleConfig']['read_mode']) { |
||||||
| 130 | $postHandler = Newbb\Helper::getInstance()->getHandler('Post'); |
||||||
| 131 | $post_obj = $postHandler->get($topic_obj->getVar('topic_last_post_id')); |
||||||
| 132 | $topic_is_unread = ($topic_last_post_time_or_id_read < $post_obj->getVar('post_time')); |
||||||
| 133 | } |
||||||
| 134 | if (2 === $GLOBALS['xoopsModuleConfig']['read_mode']) { |
||||||
| 135 | $topic_is_unread = ($topic_last_post_time_or_id_read < $topic_obj->getVar('topic_last_post_id')); |
||||||
| 136 | // hack jump to last post read if post_id is empty - is there any better way? |
||||||
| 137 | if ($topic_is_unread |
||||||
| 138 | && empty($post_id) |
||||||
| 139 | && !empty($GLOBALS['xoopsModuleConfig']['jump_to_topic_last_post_read_enabled'])) { |
||||||
| 140 | header('Location: ' . $_SERVER['REQUEST_URI'] . '&post_id=' . $topic_last_post_time_or_id_read); |
||||||
| 141 | } |
||||||
| 142 | } |
||||||
| 143 | } |
||||||
| 144 | // END irmtfan - find if topic is read or unread - for all users (member and anon) |
||||||
| 145 | |||||||
| 146 | /* Only admin has access to admin mode */ |
||||||
| 147 | if (!$isadmin) { |
||||||
| 148 | $status = ''; |
||||||
| 149 | $mode = 0; |
||||||
| 150 | } |
||||||
| 151 | |||||||
| 152 | if (!empty($GLOBALS['xoopsModuleConfig']['enable_karma'])) { |
||||||
| 153 | /** @var Newbb\KarmaHandler $karmaHandler */ |
||||||
| 154 | $karmaHandler = Newbb\Helper::getInstance()->getHandler('Karma'); |
||||||
| 155 | $user_karma = $karmaHandler->getUserKarma(); |
||||||
| 156 | } |
||||||
| 157 | |||||||
| 158 | //$viewmode = "flat"; |
||||||
| 159 | |||||||
| 160 | $total_posts = $topicHandler->getPostCount($topic_obj, $status); |
||||||
| 161 | $postsArray = &$topicHandler->getAllPosts($topic_obj, $order, $GLOBALS['xoopsModuleConfig']['posts_per_page'], $start, $post_id, $status); |
||||||
| 162 | |||||||
| 163 | //irmtfan - increment topic_views only if the topic is unread |
||||||
| 164 | if ($topic_is_unread) { |
||||||
| 165 | $topic_obj->incrementCounter(); |
||||||
| 166 | } |
||||||
| 167 | newbb_setRead('topic', $topic_id, $topic_obj->getVar('topic_last_post_id')); |
||||||
|
0 ignored issues
–
show
The function
newbb_setRead was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 168 | |||||||
| 169 | $GLOBALS['xoopsOption']['template_main'] = 'newbb_viewtopic.tpl'; |
||||||
| 170 | // irmtfan remove and move to footer.php |
||||||
| 171 | //$xoopsOption['xoops_module_header']= $xoops_module_header; |
||||||
| 172 | // irmtfan include header.php after defining $xoopsOption['template_main'] |
||||||
| 173 | require_once $GLOBALS['xoops']->path('header.php'); |
||||||
| 174 | //$xoopsTpl->assign('xoops_module_header', $xoops_module_header); |
||||||
| 175 | // irmtfan new method |
||||||
| 176 | if (!empty($GLOBALS['xoopsModuleConfig']['rss_enable'])) { |
||||||
| 177 | $xoopsTpl->assign( |
||||||
| 178 | 'xoops_module_header', |
||||||
| 179 | ' |
||||||
| 180 | <link rel="alternate" type="application/rss+xml" title="' . $xoopsModule->getVar('name') . '-' . $forum_obj->getVar('forum_name') . '" href="' . XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/rss.php?f=' . $forum_obj->getVar('forum_id') . '"> |
||||||
| 181 | ' . @$xoopsTpl->getTemplateVars('xoops_module_header') |
||||||
| 182 | ); |
||||||
| 183 | } |
||||||
| 184 | |||||||
| 185 | if ($GLOBALS['xoopsModuleConfig']['wol_enabled']) { |
||||||
| 186 | /** @var Newbb\OnlineHandler $onlineHandler */ |
||||||
| 187 | $onlineHandler = Newbb\Helper::getInstance()->getHandler('Online'); |
||||||
| 188 | $onlineHandler->init($forum_obj, $topic_obj); |
||||||
| 189 | $xoopsTpl->assign('online', $onlineHandler->showOnline()); |
||||||
| 190 | } |
||||||
| 191 | $xoopsTpl->assign('parentforum', $forumHandler->getParents($forum_obj)); |
||||||
| 192 | // irmtfan - remove icon_path and use newbb_displayImage |
||||||
| 193 | $xoopsTpl->assign('anonym_avatar', newbb_displayImage('anonym')); |
||||||
|
0 ignored issues
–
show
The function
newbb_displayImage was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 194 | |||||||
| 195 | // START irmtfan improve infobox |
||||||
| 196 | $infobox = []; |
||||||
| 197 | $infobox['show'] = (int)$GLOBALS['xoopsModuleConfig']['show_infobox']; //4.05 |
||||||
| 198 | // irmtfan removed then define after array |
||||||
| 199 | //$xoopsTpl->assign('infobox', $infobox); //4.05 |
||||||
| 200 | $iconHandler = newbb_getIconHandler(); // can be use in the follwing codes in this file |
||||||
|
0 ignored issues
–
show
The function
newbb_getIconHandler was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 201 | |||||||
| 202 | if ($infobox['show'] > 0) { |
||||||
| 203 | // irmtfan - remove icon_path and use newbb_displayImage |
||||||
| 204 | $infobox['icon'] = [ |
||||||
| 205 | 'expand' => $iconHandler->getImageSource('less'), |
||||||
| 206 | 'collapse' => $iconHandler->getImageSource('more'), |
||||||
| 207 | ]; |
||||||
| 208 | if (1 === $infobox['show']) { |
||||||
| 209 | $infobox['style'] = 'none'; //irmtfan move semicolon |
||||||
| 210 | $infobox['alt'] = _MD_NEWBB_SEEUSERDATA; |
||||||
| 211 | $infobox['src'] = 'more'; |
||||||
| 212 | } else { |
||||||
| 213 | $infobox['style'] = 'block'; //irmtfan move semicolon |
||||||
| 214 | $infobox['alt'] = _MD_NEWBB_HIDEUSERDATA; |
||||||
| 215 | $infobox['src'] = 'less'; |
||||||
| 216 | } |
||||||
| 217 | $infobox['displayImage'] = newbb_displayImage($infobox['src'], $infobox['alt']); |
||||||
| 218 | } |
||||||
| 219 | $xoopsTpl->assign('infobox', $infobox); |
||||||
| 220 | // END irmtfan improve infobox |
||||||
| 221 | |||||||
| 222 | $categoryHandler = Newbb\Helper::getInstance()->getHandler('Category'); |
||||||
| 223 | $category_obj = $categoryHandler->get($forum_obj->getVar('cat_id'), ['cat_title']); |
||||||
| 224 | |||||||
| 225 | $xoopsTpl->assign( |
||||||
| 226 | [ |
||||||
| 227 | 'topic_title' => '<a href="' . XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname', 'n') . '/viewtopic.php?topic_id=' . $topic_id . '">' . $topic_obj->getFullTitle() . '</a>', |
||||||
| 228 | 'forum_name' => $forum_obj->getVar('forum_name'), |
||||||
| 229 | 'lang_nexttopic' => _MD_NEXTTOPIC, |
||||||
| 230 | 'lang_prevtopic' => _MD_PREVTOPIC, |
||||||
| 231 | 'topic_status' => $topic_obj->getVar('topic_status'), |
||||||
| 232 | 'category' => [ |
||||||
| 233 | 'id' => $forum_obj->getVar('cat_id'), |
||||||
| 234 | 'title' => $category_obj->getVar('cat_title'), |
||||||
| 235 | ], |
||||||
| 236 | 'post_id' => $post_id, |
||||||
| 237 | 'topic_id' => $topic_id, |
||||||
| 238 | 'forum_id' => $forum_id, |
||||||
| 239 | 'order_current' => ('DESC' === $order) ? 'DESC' : 'ASC', |
||||||
| 240 | ] |
||||||
| 241 | ); |
||||||
| 242 | |||||||
| 243 | $t_new = newbb_displayImage('t_new', _MD_POSTNEW); |
||||||
| 244 | $t_reply = newbb_displayImage('t_reply', _MD_REPLY); |
||||||
| 245 | // irmtfan show topic status if show reg is 0 and revise forum_post_or_register |
||||||
| 246 | if ($topicHandler->getPermission($forum_obj, $topic_obj->getVar('topic_status'), 'post')) { |
||||||
| 247 | $xoopsTpl->assign('forum_post', '<a href="' . XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname', 'n') . '/newtopic.php?forum=' . $forum_id . '">' . $t_new . '</a>'); |
||||||
| 248 | } else { |
||||||
| 249 | if ($topic_obj->getVar('topic_status')) { |
||||||
| 250 | $xoopsTpl->assign('topic_lock', _MD_TOPICLOCKED); |
||||||
| 251 | } |
||||||
| 252 | if (!is_object($xoopsUser) && !empty($GLOBALS['xoopsModuleConfig']['show_reg'])) { |
||||||
| 253 | $xoopsTpl->assign('forum_register', '<a href="' . XOOPS_URL . '/user.php?xoops_redirect=' . htmlspecialchars($xoopsRequestUri, ENT_QUOTES | ENT_HTML5) . '">' . _MD_REGTOPOST . '</a>'); |
||||||
| 254 | } |
||||||
| 255 | } |
||||||
| 256 | // irmtfan for backward compatibility assign forum_post_or_register smarty again. |
||||||
| 257 | $xoopsTpl->assign('forum_post_or_register', @$xoopsTpl->getTemplateVars('forum_post') . @$xoopsTpl->getTemplateVars('forum_register') . @$xoopsTpl->getTemplateVars('topic_lock')); |
||||||
| 258 | |||||||
| 259 | if ($topicHandler->getPermission($forum_obj, $topic_obj->getVar('topic_status'), 'reply')) { |
||||||
| 260 | $xoopsTpl->assign('forum_reply', '<a href="' . XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname', 'n') . '/reply.php?topic_id=' . $topic_id . '">' . $t_reply . '</a>'); |
||||||
| 261 | } |
||||||
| 262 | |||||||
| 263 | $poster_array = []; |
||||||
| 264 | $require_reply = false; |
||||||
| 265 | foreach ($postsArray as $eachpost) { |
||||||
| 266 | if ($eachpost->getVar('uid') > 0) { |
||||||
| 267 | $poster_array[$eachpost->getVar('uid')] = 1; |
||||||
| 268 | } |
||||||
| 269 | if ($eachpost->getVar('require_reply') > 0) { |
||||||
| 270 | $require_reply = true; |
||||||
| 271 | } |
||||||
| 272 | } |
||||||
| 273 | |||||||
| 274 | $userid_array = []; |
||||||
| 275 | $online = []; |
||||||
| 276 | if (count($poster_array) > 0) { |
||||||
| 277 | /** @var \XoopsMemberHandler $memberHandler */ |
||||||
| 278 | $memberHandler = xoops_getHandler('member'); |
||||||
| 279 | $userid_array = array_keys($poster_array); |
||||||
| 280 | $user_criteria = '(' . implode(',', $userid_array) . ')'; |
||||||
| 281 | $users = $memberHandler->getUsers(new \Criteria('uid', $user_criteria, 'IN'), true); |
||||||
| 282 | } else { |
||||||
| 283 | $users = []; |
||||||
| 284 | } |
||||||
| 285 | |||||||
| 286 | $viewtopic_users = []; |
||||||
| 287 | if (count($userid_array) > 0) { |
||||||
| 288 | require_once $GLOBALS['xoops']->path('modules/' . $xoopsModule->getVar('dirname', 'n') . '/class/user.php'); |
||||||
| 289 | $userHandler = new Newbb\UserHandler($GLOBALS['xoopsModuleConfig']['groupbar_enabled'], $GLOBALS['xoopsModuleConfig']['wol_enabled']); |
||||||
| 290 | $userHandler->users = $users; |
||||||
| 291 | $userHandler->online = $online; |
||||||
| 292 | $viewtopic_users = $userHandler->getUsers(); |
||||||
| 293 | } |
||||||
| 294 | unset($users); |
||||||
| 295 | |||||||
| 296 | if ($require_reply && $GLOBALS['xoopsModuleConfig']['allow_require_reply']) { |
||||||
| 297 | if (!empty($GLOBALS['xoopsModuleConfig']['cache_enabled'])) { |
||||||
| 298 | $viewtopic_posters = newbb_getsession('t' . $topic_id, true); |
||||||
|
0 ignored issues
–
show
The function
newbb_getsession was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 299 | if (!is_array($viewtopic_posters) || 0 === count($viewtopic_posters)) { |
||||||
| 300 | $viewtopic_posters = $topicHandler->getAllPosters($topic_obj); |
||||||
| 301 | newbb_setsession('t' . $topic_id, $viewtopic_posters); |
||||||
|
0 ignored issues
–
show
The function
newbb_setsession was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 302 | } |
||||||
| 303 | } else { |
||||||
| 304 | $viewtopic_posters = $topicHandler->getAllPosters($topic_obj); |
||||||
| 305 | } |
||||||
| 306 | } else { |
||||||
| 307 | $viewtopic_posters = []; |
||||||
| 308 | } |
||||||
| 309 | |||||||
| 310 | if ($GLOBALS['xoopsModuleConfig']['show_advertising']) { |
||||||
| 311 | $post_werbung = [ |
||||||
| 312 | 'post_id' => 0, |
||||||
| 313 | 'post_parent_id' => 0, |
||||||
| 314 | 'post_date' => 0, |
||||||
| 315 | 'post_image' => '', |
||||||
| 316 | 'post_title' => '', |
||||||
| 317 | 'post_text' => '<div style="text-align: center;vertical-align: middle;"><br>' . xoops_getbanner() . '</div>', |
||||||
| 318 | 'post_attachment' => '', |
||||||
| 319 | 'post_edit' => 0, |
||||||
| 320 | 'post_no' => 0, |
||||||
| 321 | 'post_signature' => _MD_ADVERTISING_BLOCK, |
||||||
| 322 | 'poster_ip' => '', |
||||||
| 323 | 'thread_action' => '', |
||||||
| 324 | 'thread_buttons' => '', |
||||||
| 325 | 'mod_buttons' => '', |
||||||
| 326 | 'poster' => [ |
||||||
| 327 | 'uid' => -1, |
||||||
| 328 | 'link' => _MD_ADVERTISING_USER, |
||||||
| 329 | 'avatar' => 'avatars/blank.gif', |
||||||
| 330 | 'regdate' => 0, |
||||||
| 331 | 'last_login' => 0, |
||||||
| 332 | 'rank' => ['title' => ''], |
||||||
| 333 | ], |
||||||
| 334 | // irmtfan add last_login |
||||||
| 335 | 'post_permalink' => '', |
||||||
| 336 | ]; |
||||||
| 337 | } |
||||||
| 338 | |||||||
| 339 | $i = 0; |
||||||
| 340 | foreach ($postsArray as $eachpost) { |
||||||
| 341 | if ($GLOBALS['xoopsModuleConfig']['show_advertising']) { |
||||||
| 342 | if (2 === $i) { |
||||||
| 343 | $xoopsTpl->append('topic_posts', $post_werbung); |
||||||
| 344 | } |
||||||
| 345 | ++$i; |
||||||
| 346 | } |
||||||
| 347 | $xoopsTpl->append('topic_posts', $eachpost->showPost($isadmin)); |
||||||
| 348 | } |
||||||
| 349 | |||||||
| 350 | if ($total_posts > $GLOBALS['xoopsModuleConfig']['posts_per_page']) { |
||||||
| 351 | require $GLOBALS['xoops']->path('class/pagenav.php'); |
||||||
| 352 | $nav = new \XoopsPageNav($total_posts, $GLOBALS['xoopsModuleConfig']['posts_per_page'], $start, 'start', 'topic_id=' . $topic_id . '&order=' . $order . '&status=' . $status . '&mode=' . $mode); |
||||||
| 353 | // if (isset($GLOBALS['xoopsModuleConfig']['do_rewrite']) && $GLOBALS['xoopsModuleConfig']['do_rewrite'] == 1) $nav->url = XOOPS_URL . $nav->url; |
||||||
| 354 | if ('select' === $GLOBALS['xoopsModuleConfig']['pagenav_display']) { |
||||||
| 355 | $navi = $nav->renderSelect(); |
||||||
| 356 | } elseif ('bild' === $GLOBALS['xoopsModuleConfig']['pagenav_display']) { |
||||||
| 357 | $navi = $nav->renderImageNav(4); |
||||||
| 358 | } else { |
||||||
| 359 | $navi = $nav->renderNav(4); |
||||||
| 360 | } |
||||||
| 361 | $xoopsTpl->assign('forum_page_nav', $navi); |
||||||
| 362 | } else { |
||||||
| 363 | $xoopsTpl->assign('forum_page_nav', ''); |
||||||
| 364 | } |
||||||
| 365 | |||||||
| 366 | if (empty($post_id)) { |
||||||
| 367 | $first = array_keys($postsArray); |
||||||
| 368 | $post_id = !empty($first[0]) ? $first[0] : 0; |
||||||
| 369 | } |
||||||
| 370 | if (!empty($postsArray[$post_id])) { |
||||||
| 371 | $xoops_pagetitle = $postsArray[$post_id]->getVar('subject') . ' [' . $forum_obj->getVar('forum_name') . ']'; |
||||||
| 372 | $xoopsTpl->assign('xoops_pagetitle', $xoops_pagetitle); |
||||||
| 373 | $xoopsOption['xoops_pagetitle'] = $xoops_pagetitle; |
||||||
| 374 | $kw = array_unique(explode(' ', strip_tags($postsArray[$post_id]->getVar('post_text')), 150)); |
||||||
| 375 | asort($kw); |
||||||
| 376 | $kwort = ''; |
||||||
| 377 | $z = 0; |
||||||
| 378 | foreach ($kw as $k) { |
||||||
| 379 | if ($z < 30 && mb_strlen(trim($k)) > 5) { |
||||||
| 380 | $kwort .= trim($k) . ' '; |
||||||
| 381 | ++$z; |
||||||
| 382 | } |
||||||
| 383 | } |
||||||
| 384 | $xoTheme->addMeta('meta', 'keywords', $kwort); |
||||||
| 385 | $xoTheme->addMeta('meta', 'description', mb_substr(strip_tags($postsArray[$post_id]->getVar('post_text')), 0, 120)); |
||||||
| 386 | } |
||||||
| 387 | unset($postsArray); |
||||||
| 388 | |||||||
| 389 | $xoopsTpl->assign('topic_print_link', "print.php?form=1&{$page_query}"); |
||||||
| 390 | |||||||
| 391 | $admin_actions = []; |
||||||
| 392 | $ad_merge = ''; |
||||||
| 393 | $ad_move = ''; |
||||||
| 394 | $ad_delete = ''; |
||||||
| 395 | // irmtfan add restore to viewtopic |
||||||
| 396 | $ad_restore = ''; |
||||||
| 397 | $ad_lock = ''; |
||||||
| 398 | $ad_unlock = ''; |
||||||
| 399 | $ad_sticky = ''; |
||||||
| 400 | $ad_unsticky = ''; |
||||||
| 401 | $ad_digest = ''; |
||||||
| 402 | $ad_undigest = ''; |
||||||
| 403 | |||||||
| 404 | // START irmtfan add restore to viewtopic |
||||||
| 405 | if ($topic_obj->getVar('approved') > 0) { // if the topic is active |
||||||
| 406 | $admin_actions['merge'] = [ |
||||||
| 407 | 'link' => XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname', 'n') . '/topicmanager.php?mode=merge&topic_id=' . $topic_id, |
||||||
| 408 | 'name' => _MD_MERGETOPIC, |
||||||
| 409 | 'image' => $ad_merge, |
||||||
| 410 | ]; |
||||||
| 411 | $admin_actions['move'] = [ |
||||||
| 412 | 'link' => XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname', 'n') . '/topicmanager.php?mode=move&topic_id=' . $topic_id, |
||||||
| 413 | 'name' => _MD_MOVETOPIC, |
||||||
| 414 | 'image' => $ad_move, |
||||||
| 415 | ]; |
||||||
| 416 | $admin_actions['delete'] = [ |
||||||
| 417 | 'link' => XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname', 'n') . '/topicmanager.php?mode=delete&topic_id=' . $topic_id, |
||||||
| 418 | 'name' => _MD_DELETETOPIC, |
||||||
| 419 | 'image' => $ad_delete, |
||||||
| 420 | ]; |
||||||
| 421 | if (!$topic_obj->getVar('topic_status')) { |
||||||
| 422 | $admin_actions['lock'] = [ |
||||||
| 423 | 'link' => XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname', 'n') . '/topicmanager.php?mode=lock&topic_id=' . $topic_id, |
||||||
| 424 | 'image' => $ad_lock, |
||||||
| 425 | 'name' => _MD_LOCKTOPIC, |
||||||
| 426 | ]; |
||||||
| 427 | } else { |
||||||
| 428 | $admin_actions['unlock'] = [ |
||||||
| 429 | 'link' => XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname', 'n') . '/topicmanager.php?mode=unlock&topic_id=' . $topic_id, |
||||||
| 430 | 'image' => $ad_unlock, |
||||||
| 431 | 'name' => _MD_UNLOCKTOPIC, |
||||||
| 432 | ]; |
||||||
| 433 | } |
||||||
| 434 | if (!$topic_obj->getVar('topic_sticky')) { |
||||||
| 435 | $admin_actions['sticky'] = [ |
||||||
| 436 | 'link' => XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname', 'n') . '/topicmanager.php?mode=sticky&topic_id=' . $topic_id, |
||||||
| 437 | 'image' => $ad_sticky, |
||||||
| 438 | 'name' => _MD_STICKYTOPIC, |
||||||
| 439 | ]; |
||||||
| 440 | } else { |
||||||
| 441 | $admin_actions['unsticky'] = [ |
||||||
| 442 | 'link' => XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname', 'n') . '/topicmanager.php?mode=unsticky&topic_id=' . $topic_id, |
||||||
| 443 | 'image' => $ad_unsticky, |
||||||
| 444 | 'name' => _MD_UNSTICKYTOPIC, |
||||||
| 445 | ]; |
||||||
| 446 | } |
||||||
| 447 | if (!$topic_obj->getVar('topic_digest')) { |
||||||
| 448 | $admin_actions['digest'] = [ |
||||||
| 449 | 'link' => XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname', 'n') . '/topicmanager.php?mode=digest&topic_id=' . $topic_id, |
||||||
| 450 | 'image' => $ad_digest, |
||||||
| 451 | 'name' => _MD_DIGESTTOPIC, |
||||||
| 452 | ]; |
||||||
| 453 | } else { |
||||||
| 454 | $admin_actions['undigest'] = [ |
||||||
| 455 | 'link' => XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname', 'n') . '/topicmanager.php?mode=undigest&topic_id=' . $topic_id, |
||||||
| 456 | 'image' => $ad_undigest, |
||||||
| 457 | 'name' => _MD_UNDIGESTTOPIC, |
||||||
| 458 | ]; |
||||||
| 459 | } |
||||||
| 460 | } else { // if the topic is pending/deleted then restore/approve |
||||||
| 461 | $admin_actions['restore'] = [ |
||||||
| 462 | 'link' => XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname', 'n') . '/topicmanager.php?mode=restore&topic_id=' . $topic_id, |
||||||
| 463 | 'name' => _MD_RESTORETOPIC, |
||||||
| 464 | 'image' => $ad_restore, |
||||||
| 465 | ]; |
||||||
| 466 | } |
||||||
| 467 | // END irmtfan add restore to viewtopic |
||||||
| 468 | |||||||
| 469 | $xoopsTpl->assignByRef('admin_actions', $admin_actions); |
||||||
| 470 | $xoopsTpl->assign('viewer_level', (int)($isadmin ? 2 : is_object($xoopsUser))); |
||||||
| 471 | |||||||
| 472 | if ($GLOBALS['xoopsModuleConfig']['show_permissiontable']) { |
||||||
| 473 | /** @var Newbb\PermissionHandler $permHandler */ |
||||||
| 474 | $permissionHandler = Newbb\Helper::getInstance()->getHandler('Permission'); |
||||||
| 475 | $permission_table = $permissionHandler->getPermissionTable($forum_obj, $topic_obj->getVar('topic_status'), $isadmin); |
||||||
| 476 | $xoopsTpl->assignByRef('permission_table', $permission_table); |
||||||
| 477 | } |
||||||
| 478 | |||||||
| 479 | // Show poll |
||||||
| 480 | if ($pollmodules) { |
||||||
| 481 | /** {@internal pollmodules set in header.php} */ |
||||||
| 482 | if ($topicHandler->getPermission($forum_obj, $topic_obj->getVar('topic_status'), 'addpoll') |
||||||
| 483 | || ($topic_obj->getVar('topic_haspoll') |
||||||
| 484 | && $topicHandler->getPermission($forum_obj, $topic_obj->getVar('topic_status'), 'vote'))) { |
||||||
| 485 | if ('xoopspoll' === $pollmodules) { |
||||||
| 486 | xoops_loadLanguage('main', 'xoopspoll'); |
||||||
| 487 | } else { |
||||||
| 488 | @require $GLOBALS['xoops']->path('modules/umfrage/class/umfrage.php'); |
||||||
| 489 | @require $GLOBALS['xoops']->path('modules/umfrage/class/umfrageoption.php'); |
||||||
| 490 | @require $GLOBALS['xoops']->path('modules/umfrage/class/umfragelog.php'); |
||||||
| 491 | @require $GLOBALS['xoops']->path('modules/umfrage/class/umfragerenderer.php'); |
||||||
| 492 | } |
||||||
| 493 | } |
||||||
| 494 | |||||||
| 495 | if ($topic_obj->getVar('topic_haspoll') && (0 !== $topic_obj->getVar('poll_id')) |
||||||
| 496 | // double check to make sure it's a non-zero poll |
||||||
| 497 | && $topicHandler->getPermission($forum_obj, $topic_obj->getVar('topic_status'), 'vote')) { |
||||||
| 498 | $GLOBALS['xoopsTpl']->assign('topic_poll', 1); |
||||||
| 499 | $GLOBALS['xoopsTpl']->assign('pollmodules', $pollmodules); |
||||||
| 500 | $uid = ($GLOBALS['xoopsUser'] instanceof \XoopsUser) ? $GLOBALS['xoopsUser']->getVar('uid') : 0; |
||||||
| 501 | if ('xoopspoll' === $pollmodules) { |
||||||
| 502 | $xpollHandler = Xoopspoll\Helper::getInstance()->getHandler('Poll'); |
||||||
| 503 | $poll_obj = $xpollHandler->get($topic_obj->getVar('poll_id')); |
||||||
| 504 | if (!empty($poll_obj) && $poll_obj instanceof Xoopspoll\Poll) { |
||||||
| 505 | /* check to see if user has rights to view the results */ |
||||||
| 506 | $vis_return = $poll_obj->isResultVisible(); |
||||||
| 507 | $isVisible = true === $vis_return; |
||||||
| 508 | $visibleMsg = $isVisible ? '' : $vis_return; |
||||||
| 509 | |||||||
| 510 | /* setup the module config handler */ |
||||||
| 511 | /** @var \XoopsConfigHandler $configHandler */ |
||||||
| 512 | $configHandler = xoops_getHandler('config'); |
||||||
| 513 | $xp_config = $configHandler->getConfigsByCat(0, $xoopspoll->getVar('mid')); |
||||||
| 514 | |||||||
| 515 | $GLOBALS['xoopsTpl']->assign( |
||||||
| 516 | [ |
||||||
| 517 | 'is_visible' => $isVisible, |
||||||
| 518 | 'visible_message' => $visibleMsg, |
||||||
| 519 | 'disp_votes' => $xp_config['disp_vote_nums'], |
||||||
| 520 | 'lang_vote' => _MD_XOOPSPOLL_VOTE, |
||||||
| 521 | 'lang_results' => _MD_XOOPSPOLL_RESULTS, |
||||||
| 522 | 'back_link' => '', |
||||||
| 523 | ] |
||||||
| 524 | ); |
||||||
| 525 | $renderer = new Xoopspoll\Renderer($poll_obj); |
||||||
| 526 | // $renderer->assignResults($GLOBALS['xoopsTpl']); |
||||||
| 527 | // check to see if user has voted, show form if not, otherwise get results for form |
||||||
| 528 | |||||||
| 529 | $logHandler = Xoopspoll\Helper::getInstance()->getHandler('Log'); |
||||||
| 530 | if ($poll_obj->isAllowedToVote() |
||||||
| 531 | && (!$logHandler->hasVoted($poll_obj->getVar('poll_id'), xoops_getenv('REMOTE_ADDR'), $uid))) { |
||||||
| 532 | /* |
||||||
| 533 | $renderer->assignForm($GLOBALS['xoopsTpl']); |
||||||
| 534 | $GLOBALS['xoopsTpl']->assign('topic_pollresult', null); |
||||||
| 535 | */ |
||||||
| 536 | // $GLOBALS['xoopsTpl']->assign('can_vote', true); |
||||||
| 537 | // $GLOBALS['xoopsTpl']->assign('topic_pollform', $renderer->renderForm()); |
||||||
| 538 | $myTpl = new \XoopsTpl(); |
||||||
| 539 | $renderer->assignForm($myTpl); |
||||||
| 540 | $myTpl->assign('action', $GLOBALS['xoops']->url("modules/newbb/votepolls.php?topic_id={$topic_id}&poll_id={$poll_id}")); |
||||||
| 541 | $topic_pollform = $myTpl->fetch($GLOBALS['xoops']->path('modules/xoopspoll/templates/xoopspoll_view.tpl')); |
||||||
| 542 | $GLOBALS['xoopsTpl']->assign('topic_pollform', $topic_pollform); |
||||||
| 543 | } else { |
||||||
| 544 | // $renderer->assignResults($GLOBALS['xoopsTpl']); |
||||||
| 545 | $GLOBALS['xoopsTpl']->assign('can_vote', false); |
||||||
| 546 | $GLOBALS['xoopsTpl']->assign('topic_pollresult', $renderer->renderResults()); |
||||||
| 547 | } |
||||||
| 548 | } |
||||||
| 549 | } else { //Umfrage |
||||||
| 550 | $poll_obj = new \Umfrage($topic_obj->getVar('poll_id')); |
||||||
|
0 ignored issues
–
show
The type
Umfrage was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||||||
| 551 | $hasEnded = $poll_obj->getVar('end_time') < time(); |
||||||
| 552 | $renderer = new \UmfrageRenderer($poll); |
||||||
|
0 ignored issues
–
show
The type
UmfrageRenderer was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||||||
| 553 | $xoopsTpl->assign('lang_alreadyvoted2', _MD_XOOPSPOLL_ALREADYVOTED); |
||||||
| 554 | $xoopsTpl->assign('has_ended', $hasEnded); |
||||||
| 555 | $xoopsTpl->assign('polltype', $poll_obj->getVar('polltype')); |
||||||
| 556 | switch ($poll_obj->getVar('polltype')) { |
||||||
| 557 | case 1: //always visible |
||||||
| 558 | $visibleMsg = ''; |
||||||
| 559 | $isVisible = true; |
||||||
| 560 | break; |
||||||
| 561 | case 2: //not visible |
||||||
| 562 | $visibleMsg = _PL_FULLBLIND; |
||||||
| 563 | $isVisible = false; |
||||||
| 564 | break; |
||||||
| 565 | case 3: //visible after end of poll |
||||||
| 566 | $visibleMsg = _PL_HALFBLIND; |
||||||
| 567 | $isVisible = $hasEnded; |
||||||
| 568 | break; |
||||||
| 569 | } |
||||||
| 570 | |||||||
| 571 | $hasvoted = 0; |
||||||
| 572 | if ($uid > 0) { |
||||||
| 573 | if ((new UmfrageLog())->hasVoted($topic_obj->getVar('poll_id'), xoops_getenv('REMOTE_ADDR'), $uid)) { |
||||||
|
0 ignored issues
–
show
The type
UmfrageLog was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||||||
| 574 | $hasvoted = 1; |
||||||
| 575 | } |
||||||
| 576 | } else { |
||||||
| 577 | $hasvoted = 1; //does not allow anon voting |
||||||
| 578 | } |
||||||
| 579 | |||||||
| 580 | $xoopsTpl->assign( |
||||||
| 581 | [ |
||||||
| 582 | 'is_visible' => $isVisible, |
||||||
| 583 | 'visible_message' => $visibleMsg, |
||||||
| 584 | 'hasVoted' => $hasvoted, |
||||||
| 585 | 'lang_vote' => _PL_VOTE, |
||||||
| 586 | 'lang_results' => ($poll_obj->getVar('end_time') < time()) ? _PL_RESULTS : _PL_STANDINGS, |
||||||
| 587 | ] |
||||||
| 588 | ); |
||||||
| 589 | |||||||
| 590 | if ((new UmfrageLog())->hasVoted($topic_obj->getVar('poll_id'), $_SERVER['REMOTE_ADDR'], $uid) |
||||||
| 591 | || $poll_obj->getVar('end_time') < time()) { |
||||||
| 592 | $renderer->assignResults($xoopsTpl); |
||||||
| 593 | //pollresults($forumtopic->getVar('poll_id')); |
||||||
| 594 | $xoopsTpl->assign('topic_pollresult', 1); |
||||||
| 595 | setcookie('bb_polls[' . $topic_obj->getVar('poll_id') . ']', 1); |
||||||
| 596 | } else { |
||||||
| 597 | $renderer->assignForm($xoopsTpl); |
||||||
| 598 | //pollview($forumtopic->getVar('poll_id')); |
||||||
| 599 | setcookie('bb_polls[' . $topic_obj->getVar('poll_id') . ']', 1); |
||||||
| 600 | } |
||||||
| 601 | } |
||||||
| 602 | } |
||||||
| 603 | |||||||
| 604 | if ($topicHandler->getPermission($forum_obj, $topic_obj->getVar('topic_status'), 'addpoll')) { |
||||||
| 605 | if (!$topic_obj->getVar('topic_haspoll')) { |
||||||
| 606 | if (($xoopsUser instanceof \XoopsUser) && $xoopsUser->getVar('uid') === $topic_obj->getVar('topic_poster')) { |
||||||
| 607 | $t_poll = newbb_displayImage('t_poll', _MD_ADDPOLL); |
||||||
| 608 | $xoopsTpl->assign('forum_addpoll', '<a href="' . XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname', 'n') . "/polls.php?op=add&topic_id={$topic_id}\">{$t_poll}</a>"); |
||||||
| 609 | } |
||||||
| 610 | } elseif ($isadmin |
||||||
| 611 | || (is_object($poll) && ($xoopsUser instanceof \XoopsUser) |
||||||
| 612 | && $xoopsUser->getVar('uid') === $poll_obj->getVar('user_id'))) { |
||||||
| 613 | $poll_edit = ''; |
||||||
| 614 | $poll_delete = ''; |
||||||
| 615 | $poll_restart = ''; |
||||||
| 616 | |||||||
| 617 | $adminpoll_actions = []; |
||||||
| 618 | $adminpoll_actions['editpoll'] = [ |
||||||
| 619 | 'link' => XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname', 'n') . '/polls.php?op=edit&poll_id=' . $topic_obj->getVar('poll_id') . '&topic_id=' . $topic_id, |
||||||
| 620 | 'image' => $poll_edit, |
||||||
| 621 | 'name' => _MD_EDITPOLL, |
||||||
| 622 | ]; |
||||||
| 623 | $adminpoll_actions['deletepoll'] = [ |
||||||
| 624 | 'link' => XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname', 'n') . '/polls.php?op=delete&poll_id=' . $topic_obj->getVar('poll_id') . '&topic_id=' . $topic_id, |
||||||
| 625 | 'image' => $poll_delete, |
||||||
| 626 | 'name' => _MD_DELETEPOLL, |
||||||
| 627 | ]; |
||||||
| 628 | $adminpoll_actions['restartpoll'] = [ |
||||||
| 629 | 'link' => XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname', 'n') . '/polls.php?op=restart&poll_id=' . $topic_obj->getVar('poll_id') . '&topic_id=' . $topic_id . '&forum=' . $forum_id, |
||||||
| 630 | 'image' => $poll_restart, |
||||||
| 631 | 'name' => _MD_RESTARTPOLL, |
||||||
| 632 | ]; |
||||||
| 633 | |||||||
| 634 | $xoopsTpl->assignByRef('adminpoll_actions', $adminpoll_actions); |
||||||
| 635 | } |
||||||
| 636 | } |
||||||
| 637 | if (isset($poll_obj)) { |
||||||
| 638 | unset($poll_obj); |
||||||
| 639 | } |
||||||
| 640 | } |
||||||
| 641 | $xoopsTpl->assign( |
||||||
| 642 | [ |
||||||
| 643 | 'p_up' => newbb_displayImage('up', _MD_TOP), |
||||||
| 644 | 'rating_enable' => $GLOBALS['xoopsModuleConfig']['rating_enabled'], |
||||||
| 645 | 'groupbar_enable' => $GLOBALS['xoopsModuleConfig']['groupbar_enabled'], |
||||||
| 646 | 'anonymous_prefix' => $GLOBALS['xoopsModuleConfig']['anonymous_prefix'], |
||||||
| 647 | // irmtfan add alt for prev next and down icons. |
||||||
| 648 | 'previous' => newbb_displayImage('previous', _MD_PREVTOPIC), |
||||||
| 649 | 'next' => newbb_displayImage('next', _MD_NEXTTOPIC), |
||||||
| 650 | 'down' => newbb_displayImage('down', _MD_BOTTOM), |
||||||
| 651 | 'post_content' => newbb_displayImage('post'), |
||||||
| 652 | ] |
||||||
| 653 | ); |
||||||
| 654 | |||||||
| 655 | if (!empty($GLOBALS['xoopsModuleConfig']['rating_enabled'])) { |
||||||
| 656 | $xoopsTpl->assign('votes', $topic_obj->getVar('votes')); |
||||||
| 657 | $rating = number_format($topic_obj->getVar('rating') / 2, 0); |
||||||
| 658 | if ($rating < 1) { |
||||||
| 659 | $rating_img = newbb_displayImage('blank'); |
||||||
| 660 | } else { |
||||||
| 661 | // irmtfan - add alt key for rating |
||||||
| 662 | $rating_img = newbb_displayImage('rate' . $rating, constant('_MD_RATE' . $rating)); |
||||||
| 663 | } |
||||||
| 664 | $xoopsTpl->assign( |
||||||
| 665 | [ |
||||||
| 666 | 'rating_img' => $rating_img, |
||||||
| 667 | 'rate1' => newbb_displayImage('rate1', _MD_RATE1), |
||||||
| 668 | 'rate2' => newbb_displayImage('rate2', _MD_RATE2), |
||||||
| 669 | 'rate3' => newbb_displayImage('rate3', _MD_RATE3), |
||||||
| 670 | 'rate4' => newbb_displayImage('rate4', _MD_RATE4), |
||||||
| 671 | 'rate5' => newbb_displayImage('rate5', _MD_RATE5), |
||||||
| 672 | ] |
||||||
| 673 | ); |
||||||
| 674 | } |
||||||
| 675 | |||||||
| 676 | // create jump box |
||||||
| 677 | if (!empty($GLOBALS['xoopsModuleConfig']['show_jump'])) { |
||||||
| 678 | // mod_loadFunctions('forum', 'newbb'); |
||||||
| 679 | require_once dirname(__DIR__) . '/include/functions.forum.php'; |
||||||
| 680 | $xoopsTpl->assign('forum_jumpbox', newbb_make_jumpbox($forum_id)); |
||||||
|
0 ignored issues
–
show
The function
newbb_make_jumpbox was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 681 | } |
||||||
| 682 | |||||||
| 683 | $xoopsTpl->assign( |
||||||
| 684 | [ |
||||||
| 685 | 'lang_forum_index' => sprintf(_MD_FORUMINDEX, htmlspecialchars($xoopsConfig['sitename'], ENT_QUOTES)), |
||||||
| 686 | 'lang_from' => _MD_FROM, |
||||||
| 687 | 'lang_joined' => _MD_JOINED, |
||||||
| 688 | 'lang_posts' => _MD_POSTS, |
||||||
| 689 | 'lang_poster' => _MD_POSTER, |
||||||
| 690 | 'lang_thread' => _MD_THREAD, |
||||||
| 691 | 'lang_edit' => _EDIT, |
||||||
| 692 | 'lang_delete' => _DELETE, |
||||||
| 693 | 'lang_reply' => _REPLY, |
||||||
| 694 | 'lang_postedon' => _MD_POSTEDON, |
||||||
| 695 | 'lang_groups' => _MD_GROUPS, |
||||||
| 696 | ] |
||||||
| 697 | ); |
||||||
| 698 | |||||||
| 699 | $viewmode_options = []; |
||||||
| 700 | if ('DESC' === $order) { |
||||||
| 701 | $viewmode_options[] = [ |
||||||
| 702 | 'link' => $GLOBALS['xoops']->url('modules/' . $xoopsModule->getVar('dirname', 'n') . "/viewtopic.php?order=ASC&status={$status}&topic_id={$topic_id}"), |
||||||
| 703 | 'title' => _OLDESTFIRST, |
||||||
| 704 | ]; |
||||||
| 705 | } else { |
||||||
| 706 | $viewmode_options[] = [ |
||||||
| 707 | 'link' => $GLOBALS['xoops']->url('modules/' . $xoopsModule->getVar('dirname', 'n') . "/viewtopic.php?order=DESC&status=$status&topic_id={$topic_id}"), |
||||||
| 708 | 'title' => _NEWESTFIRST, |
||||||
| 709 | ]; |
||||||
| 710 | } |
||||||
| 711 | |||||||
| 712 | switch ($status) { |
||||||
| 713 | case 'active': |
||||||
| 714 | $current_status = '[' . _MD_TYPE_ADMIN . ']'; |
||||||
| 715 | break; |
||||||
| 716 | case 'pending': |
||||||
| 717 | $current_status = '[' . _MD_TYPE_PENDING . ']'; |
||||||
| 718 | break; |
||||||
| 719 | case 'deleted': |
||||||
| 720 | $current_status = '[' . _MD_TYPE_DELETED . ']'; |
||||||
| 721 | break; |
||||||
| 722 | default: |
||||||
| 723 | $current_status = ''; |
||||||
| 724 | break; |
||||||
| 725 | } |
||||||
| 726 | $xoopsTpl->assign( |
||||||
| 727 | [ |
||||||
| 728 | 'topicstatus' => $current_status, |
||||||
| 729 | 'mode' => $mode, |
||||||
| 730 | 'status' => $status, |
||||||
| 731 | 'viewmode_options' => $viewmode_options, |
||||||
| 732 | 'menumode' => $menumode, |
||||||
| 733 | 'menumode_other' => $menumode_other, |
||||||
| 734 | ] |
||||||
| 735 | ); |
||||||
| 736 | //$xoopsTpl->assign('viewmode_compact', ($viewmode=="compact")?1:0); |
||||||
| 737 | // changed to assign, assign_by_ref not supported under PHP 5.x |
||||||
| 738 | //$xoopsTpl->assignByRef('viewmode_options', $viewmode_options); |
||||||
| 739 | //unset($viewmode_options); |
||||||
| 740 | |||||||
| 741 | // START irmtfan add verifyUser to quick reply |
||||||
| 742 | //check banning |
||||||
| 743 | $moderateHandler = Newbb\Helper::getInstance()->getHandler('Moderate'); |
||||||
| 744 | if (!empty($GLOBALS['xoopsModuleConfig']['quickreply_enabled']) |
||||||
| 745 | && $topicHandler->getPermission($forum_obj, $topic_obj->getVar('topic_status'), 'reply') |
||||||
| 746 | && !$moderateHandler->verifyUser(-1, '', $forum_obj->getVar('forum_id'))) { |
||||||
| 747 | // END irmtfan add verifyUser to quick reply |
||||||
| 748 | $forum_form = new \XoopsThemeForm(_MD_POSTREPLY, 'quick_reply', $GLOBALS['xoops']->url('modules/' . $xoopsModule->getVar('dirname', 'n') . '/post.php'), 'post', true); |
||||||
| 749 | if (!$xoopsUser instanceof \XoopsUser) { |
||||||
| 750 | ///** @var \XoopsConfigHandler $configHandler */ |
||||||
| 751 | $configHandler = xoops_getHandler('config'); |
||||||
| 752 | $user_tray = new \XoopsFormElementTray(_MD_ACCOUNT); |
||||||
| 753 | $user_tray->addElement(new \XoopsFormText(_MD_NAME, 'uname', 26, 255)); |
||||||
| 754 | $user_tray->addElement(new \XoopsFormPassword(_MD_PASSWORD, 'pass', 10, 32)); |
||||||
| 755 | $login_checkbox = new \XoopsFormCheckBox('', 'login', 1); |
||||||
| 756 | $login_checkbox->addOption(1, _MD_LOGIN); |
||||||
| 757 | $user_tray->addElement($login_checkbox); |
||||||
| 758 | $forum_form->addElement($user_tray); |
||||||
| 759 | $captcha = new \XoopsFormCaptcha('', "topic_{$topic_id}_{$start}"); |
||||||
| 760 | $captcha->setConfig('mode', 'text'); |
||||||
| 761 | $forum_form->addElement($captcha); |
||||||
| 762 | } |
||||||
| 763 | |||||||
| 764 | // $quickform = ( !empty($GLOBALS['xoopsModuleConfig']["editor_default"]) ) ? $GLOBALS['xoopsModuleConfig']["editor_default"] : "textarea"; |
||||||
| 765 | $quickform = !empty($GLOBALS['xoopsModuleConfig']['editor_quick_default']) ? $GLOBALS['xoopsModuleConfig']['editor_quick_default'] : 'textarea'; |
||||||
| 766 | $editor_configs = []; |
||||||
| 767 | // $editor_configs ["value"] = $message; |
||||||
| 768 | $editor_configs ['name'] = 'message'; |
||||||
| 769 | $editor_configs ['rows'] = empty($GLOBALS['xoopsModuleConfig']['editor_rows']) ? 10 : $GLOBALS['xoopsModuleConfig']['editor_rows']; |
||||||
| 770 | $editor_configs ['cols'] = empty($GLOBALS['xoopsModuleConfig']['editor_cols']) ? 30 : $GLOBALS['xoopsModuleConfig']['editor_cols']; |
||||||
| 771 | $editor_configs ['width'] = empty($GLOBALS['xoopsModuleConfig']['editor_width']) ? '100%' : $GLOBALS['xoopsModuleConfig']['editor_width']; |
||||||
| 772 | $editor_configs ['height'] = empty($GLOBALS['xoopsModuleConfig']['editor_height']) ? '400px' : $GLOBALS['xoopsModuleConfig']['editor_height']; |
||||||
| 773 | $_editor = new \XoopsFormEditor(_MD_MESSAGEC, $quickform, $editor_configs, true); |
||||||
| 774 | $forum_form->addElement($_editor, true); |
||||||
| 775 | |||||||
| 776 | $forum_form->addElement(new \XoopsFormHidden('dohtml', 0)); |
||||||
| 777 | $forum_form->addElement(new \XoopsFormHidden('dosmiley', 1)); |
||||||
| 778 | $forum_form->addElement(new \XoopsFormHidden('doxcode', 1)); |
||||||
| 779 | $forum_form->addElement(new \XoopsFormHidden('dobr', 1)); |
||||||
| 780 | $forum_form->addElement(new \XoopsFormHidden('attachsig', 1)); |
||||||
| 781 | |||||||
| 782 | $forum_form->addElement(new \XoopsFormHidden('isreply', 1)); |
||||||
| 783 | |||||||
| 784 | $forum_form->addElement(new \XoopsFormHidden('subject', _MD_RE . ': ' . $topic_obj->getVar('topic_title', 'e'))); |
||||||
| 785 | $forum_form->addElement(new \XoopsFormHidden('pid', empty($post_id) ? $topicHandler->getTopPostId($topic_id) : $post_id)); |
||||||
| 786 | $forum_form->addElement(new \XoopsFormHidden('topic_id', $topic_id)); |
||||||
| 787 | $forum_form->addElement(new \XoopsFormHidden('forum', $forum_id)); |
||||||
|
0 ignored issues
–
show
It seems like
$forum_id can also be of type array and array; however, parameter $value of XoopsFormHidden::__construct() does only seem to accept string, maybe add an additional type check?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 788 | // $forum_form->addElement(new \XoopsFormHidden('viewmode', $viewmode)); |
||||||
| 789 | $forum_form->addElement(new \XoopsFormHidden('order', $order)); |
||||||
| 790 | $forum_form->addElement(new \XoopsFormHidden('start', $start)); |
||||||
| 791 | |||||||
| 792 | $forum_form->addElement(new \XoopsFormHidden('notify', -1)); |
||||||
| 793 | $forum_form->addElement(new \XoopsFormHidden('contents_submit', 1)); |
||||||
| 794 | |||||||
| 795 | $submit_button = new \XoopsFormButton('', 'quick_submit', _SUBMIT, 'submit'); |
||||||
| 796 | $submit_button->setExtra('onclick="if (document.forms.quick_reply.message.value == \'RE\' || document.forms.quick_reply.message.value == \'\') { alert(\'' . _MD_QUICKREPLY_EMPTY . '\'); return false;} else { return true;}"'); |
||||||
| 797 | $forum_form->addElement($submit_button); |
||||||
| 798 | |||||||
| 799 | $toggles = newbb_getcookie('G', true); |
||||||
|
0 ignored issues
–
show
The function
newbb_getcookie was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 800 | // START irmtfan improve quickreply smarty variable - add alt key to quick reply button - change $display to $style for more comprehension - add toggle $quickreply['expand'] |
||||||
| 801 | $quickreply = []; |
||||||
| 802 | $qr_collapse = 't_qr'; |
||||||
| 803 | $qr_expand = 't_qr_expand'; // change this |
||||||
| 804 | $quickreply['icon'] = [ |
||||||
| 805 | 'expand' => $iconHandler->getImageSource($qr_expand), |
||||||
| 806 | 'collapse' => $iconHandler->getImageSource($qr_collapse), |
||||||
| 807 | ]; |
||||||
| 808 | $quickreply['show'] = 1; // = !empty($GLOBALS['xoopsModuleConfig']['quickreply_enabled'] |
||||||
| 809 | $quickreply['expand'] = (count($toggles) > 0) ? (in_array('qr', $toggles, true) ? false : true) : true; |
||||||
| 810 | if ($quickreply['expand']) { |
||||||
| 811 | $quickreply['style'] = 'block'; //irmtfan move semicolon |
||||||
| 812 | $quickreply_icon_display = $qr_expand; |
||||||
| 813 | $quickreply_alt = _MD_NEWBB_HIDE . ' ' . _MD_QUICKREPLY; |
||||||
| 814 | } else { |
||||||
| 815 | $quickreply['style'] = 'none'; //irmtfan move semicolon |
||||||
| 816 | $quickreply_icon_display = $qr_collapse; |
||||||
| 817 | $quickreply_alt = _MD_NEWBB_SEE . ' ' . _MD_QUICKREPLY; |
||||||
| 818 | } |
||||||
| 819 | $quickreply['displayImage'] = newbb_displayImage($quickreply_icon_display, $quickreply_alt); |
||||||
| 820 | $quickreply['form'] = $forum_form->render(); |
||||||
| 821 | $xoopsTpl->assign('quickreply', $quickreply); |
||||||
| 822 | // END irmtfan improve quickreply smarty variable |
||||||
| 823 | unset($forum_form); |
||||||
| 824 | } else { |
||||||
| 825 | $xoopsTpl->assign('quickreply', ['show' => 0]); |
||||||
| 826 | } |
||||||
| 827 | |||||||
| 828 | $xoopsTpl->assign('tagbar', ''); |
||||||
| 829 | $helper = Helper::getInstance(); |
||||||
|
0 ignored issues
–
show
The type
Helper was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||||||
| 830 | if (1 == $helper->getConfig('do_tag') && \class_exists(\XoopsModules\Tag\Tagbar::class) && \xoops_isActiveModule('tag')) { |
||||||
| 831 | $tagbarObj = new \XoopsModules\Tag\Tagbar(); |
||||||
| 832 | $xoopsTpl->assign('tagbar', $tagbarObj->getTagbar($topic_obj->getVar('topic_tags', 'n'))); |
||||||
| 833 | } |
||||||
| 834 | // irmtfan move to footer.php |
||||||
| 835 | require_once __DIR__ . '/footer.php'; |
||||||
| 836 | require $GLOBALS['xoops']->path('footer.php'); |
||||||
| 837 | $xoopsLogger->stopTime('newbb_viewtopic'); |
||||||
| 838 |