mambax7 /
newbb5
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <?php |
||
| 2 | /** |
||
| 3 | * NewBB 5.0x, the forum module for XOOPS project |
||
| 4 | * |
||
| 5 | * @copyright XOOPS Project (https://xoops.org) |
||
| 6 | * @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html) |
||
| 7 | * @author Taiwen Jiang (phppp or D.J.) <[email protected]> |
||
| 8 | * @since 4.00 |
||
| 9 | * @package module::newbb |
||
| 10 | */ |
||
| 11 | |||
| 12 | use Xmf\Request; |
||
| 13 | |||
| 14 | include_once __DIR__ . '/header.php'; |
||
| 15 | |||
| 16 | View Code Duplication | if (!Request::getInt('forum', 0, 'GET')) { |
|
|
0 ignored issues
–
show
|
|||
| 17 | redirect_header(XOOPS_URL . '/index.php', 2, _MD_NEWBB_ERRORFORUM); |
||
| 18 | } |
||
| 19 | include_once __DIR__ . '/include/functions.read.php'; |
||
| 20 | |||
| 21 | /* |
||
| 22 | * Build the page query |
||
| 23 | */ |
||
| 24 | $query_vars = ['forum', 'type', 'status', 'sort', 'order', 'start', 'since']; |
||
| 25 | $query_array = []; |
||
| 26 | foreach ($query_vars as $var) { |
||
| 27 | if (Request::getString($var, '', 'GET')) { |
||
| 28 | $query_array[$var] = "{$var}=" . Request::getString($var, '', 'GET'); |
||
| 29 | } |
||
| 30 | } |
||
| 31 | $page_query = implode('&', array_values($query_array)); |
||
| 32 | |||
| 33 | if (Request::getInt('mark', 0, 'GET')) { |
||
| 34 | View Code Duplication | if (1 === Request::getInt('mark', 0, 'GET')) { // marked as read |
|
| 35 | $markvalue = 1; |
||
| 36 | $markresult = _MD_NEWBB_MARK_READ; |
||
| 37 | } else { // marked as unread |
||
| 38 | $markvalue = 0; |
||
| 39 | $markresult = _MD_NEWBB_MARK_UNREAD; |
||
| 40 | } |
||
| 41 | newbbSetReadTopic($markvalue, Request::getInt('forum', 0, 'GET')); |
||
| 42 | $url = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/viewforum.php?' . $page_query; |
||
| 43 | redirect_header($url, 2, _MD_NEWBB_ALL_TOPIC_MARKED . ' ' . $markresult); |
||
| 44 | } |
||
| 45 | |||
| 46 | $forum_id = Request::getInt('forum', 0, 'GET'); |
||
| 47 | $type = Request::getInt('type', 0, 'GET'); |
||
| 48 | $status = (Request::getString('status', '', 'GET') |
||
| 49 | && in_array(Request::getString('status', '', 'GET'), [ |
||
| 50 | 'active', |
||
| 51 | 'pending', |
||
| 52 | 'deleted', |
||
| 53 | 'digest', |
||
| 54 | 'unreplied', |
||
| 55 | 'unread' |
||
| 56 | ], true)) ? Request::getString('status', '', 'GET') : ''; |
||
| 57 | |||
| 58 | $mode = (Request::getString('status', '', 'GET') |
||
| 59 | && in_array(Request::getString('status', '', 'GET'), [ |
||
| 60 | 'active', |
||
| 61 | 'pending', |
||
| 62 | 'deleted' |
||
| 63 | ], true)) ? 2 : Request::getInt('mode', 0, 'GET'); |
||
| 64 | |||
| 65 | ///** @var Newbb\ForumHandler $forumHandler */ |
||
| 66 | //$forumHandler = Newbb\Helper::getInstance()->getHandler('Forum'); |
||
| 67 | $forumObject = $forumHandler->get($forum_id); |
||
| 68 | |||
| 69 | if (!$forumObject) { |
||
| 70 | redirect_header(XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/index.php', 2, _MD_NEWBB_ERRORFORUM); |
||
| 71 | } |
||
| 72 | |||
| 73 | if (!$forumHandler->getPermission($forumObject)) { |
||
| 74 | redirect_header(XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/index.php', 2, _NOPERM); |
||
| 75 | } |
||
| 76 | newbbSetRead('forum', $forum_id, $forumObject->getVar('forum_last_post_id')); |
||
| 77 | |||
| 78 | $xoops_pagetitle = $forumObject->getVar('forum_name') . ' [' . $xoopsModule->getVar('name') . ']'; |
||
| 79 | |||
| 80 | $xoopsOption['template_main'] = 'newbb_viewforum.tpl'; |
||
| 81 | $xoopsOption['xoops_pagetitle'] = $xoops_pagetitle; |
||
| 82 | |||
| 83 | include_once $GLOBALS['xoops']->path('header.php'); |
||
| 84 | include_once __DIR__ . '/include/functions.render.php'; |
||
| 85 | |||
| 86 | View Code Duplication | if (!empty($GLOBALS['xoopsModuleConfig']['rss_enable'])) { |
|
| 87 | $xoopsTpl->assign('xoops_module_header', ' |
||
| 88 | <link rel="alternate" type="application/xml+rss" title="' . $xoopsModule->getVar('name') . '-' . $forumObject->getVar('forum_name') . '" href="' . XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/rss.php?f=' . $forum_id . '" /> |
||
| 89 | ' . @$xoopsTpl->get_template_vars('xoops_module_header')); |
||
| 90 | } |
||
| 91 | $forumDescription = $forumObject->getVar('forum_desc'); |
||
| 92 | $xoopsTpl->assign('forumDescription', $forumDescription); |
||
| 93 | |||
| 94 | //$xoopsTpl->assign('xoops_module_header', $xoops_module_header); |
||
| 95 | $xoopsTpl->assign('forum_id', $forum_id); |
||
| 96 | $xoopsTpl->assign('version', $xoopsModule->getVar('version')); |
||
| 97 | |||
| 98 | $isAdmin = newbbIsAdmin($forumObject); |
||
| 99 | $xoopsTpl->assign('viewer_level', $isAdmin ? 2 : 0); |
||
| 100 | /* Only admin has access to admin mode */ |
||
| 101 | View Code Duplication | if (!$isAdmin) { |
|
| 102 | $status = (!empty($status) && in_array($status, ['active', 'pending', 'deleted'], true)) ? '' : $status; |
||
| 103 | // irmtfan add mode |
||
| 104 | $mode = 0; |
||
| 105 | } |
||
| 106 | // irmtfan add mode |
||
| 107 | $xoopsTpl->assign('mode', $mode); |
||
| 108 | $xoopsTpl->assign('status', $status); |
||
| 109 | if ($isAdmin) { |
||
| 110 | $xoopsTpl->assign('forum_index_cpanel', ['link' => 'admin/index.php', 'name' => _MD_NEWBB_ADMINCP]); |
||
| 111 | } |
||
| 112 | |||
| 113 | if ($GLOBALS['xoopsModuleConfig']['wol_enabled']) { |
||
| 114 | // /** @var Newbb\OnlineHandler $onlineHandler */ |
||
| 115 | // $onlineHandler = Newbb\Helper::getInstance()->getHandler('Online'); |
||
| 116 | $onlineHandler->init($forumObject); |
||
| 117 | $xoopsTpl->assign('online', $onlineHandler->showOnline()); |
||
| 118 | } |
||
| 119 | |||
| 120 | if ($forumHandler->getPermission($forumObject, 'post')) { |
||
| 121 | $xoopsTpl->assign('viewer_level', $isAdmin ? 2 : 1); |
||
| 122 | $xoopsTpl->assign('forum_post_or_register', '<a href="' . XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . "/newtopic.php?forum={$forum_id}\">" . newbbDisplayImage('t_new', _MD_NEWBB_POSTNEW) . '</a>'); |
||
| 123 | if ($pollmodules && $forumHandler->getPermission($forumObject, 'addpoll')) { |
||
| 124 | $t_poll = newbbDisplayImage('t_poll', _MD_NEWBB_ADDPOLL); |
||
| 125 | $xoopsTpl->assign('forum_addpoll', '<a href="' . XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . "/polls.php?op=add&forum={$forum_id}\">{$t_poll}</a>"); |
||
| 126 | } |
||
| 127 | } else { |
||
| 128 | $xoopsTpl->assign('viewer_level', 0); |
||
| 129 | if (!is_object($GLOBALS['xoopsUser']) && !empty($GLOBALS['xoopsModuleConfig']['show_reg'])) { |
||
| 130 | $redirect = preg_replace("|(.*)\/modules\/Newbb\/(.*)|", "\\1/modules/newbb/newtopic.php?forum=" . $forum_id, htmlspecialchars($xoopsRequestUri)); |
||
| 131 | $xoopsTpl->assign('forum_post_or_register', "<a href='" . XOOPS_URL . "/user.php?xoops_redirect={$redirect}'>" . _MD_NEWBB_REGTOPOST . '</a>'); |
||
| 132 | $xoopsTpl->assign('forum_addpoll', ''); |
||
| 133 | } else { |
||
| 134 | $xoopsTpl->assign('forum_post_or_register', ''); |
||
| 135 | $xoopsTpl->assign('forum_addpoll', ''); |
||
| 136 | } |
||
| 137 | } |
||
| 138 | $parentforum = $forumHandler->getParents($forumObject); |
||
| 139 | $xoopsTpl->assign_by_ref('parentforum', $parentforum); |
||
| 140 | |||
| 141 | $criteria = new \CriteriaCompo(new \Criteria('parent_forum', $forum_id)); |
||
| 142 | $criteria->add(new \Criteria('forum_id', '(' . implode(', ', $forumHandler->getIdsByPermission('access')) . ')', 'IN')); |
||
| 143 | $criteria->setSort('forum_order'); |
||
| 144 | |||
| 145 | if ($forums = $forumHandler->getAll($criteria, null, false)) { |
||
| 146 | $subforum_array = $forumHandler->display($forums, $GLOBALS['xoopsModuleConfig']['length_title_index'], $GLOBALS['xoopsModuleConfig']['count_subforum']); |
||
| 147 | $subforum = array_values($subforum_array[$forum_id]); |
||
| 148 | unset($subforum_array); |
||
| 149 | $xoopsTpl->assign_by_ref('subforum', $subforum); |
||
| 150 | } |
||
| 151 | |||
| 152 | //$categoryHandler = Newbb\Helper::getInstance()->getHandler('Category'); |
||
| 153 | $categoryObject = $categoryHandler->get($forumObject->getVar('cat_id'), ['cat_title']); |
||
| 154 | $xoopsTpl->assign('category', ['id' => $forumObject->getVar('cat_id'), 'title' => $categoryObject->getVar('cat_title')]); |
||
| 155 | |||
| 156 | $xoopsTpl->assign('forum_index_title', sprintf(_MD_NEWBB_FORUMINDEX, htmlspecialchars($GLOBALS['xoopsConfig']['sitename'], ENT_QUOTES))); |
||
| 157 | $xoopsTpl->assign('forum_name', $forumObject->getVar('forum_name')); |
||
| 158 | $xoopsTpl->assign('forum_moderators', $forumObject->dispForumModerators()); |
||
| 159 | |||
| 160 | // irmtfan - add and edit: u.uname => t.topic_poster | t.topic_time => t.topic_id | "t.rating"=>_MD_NEWBB_RATINGS, | p.post_time => t.topic_last_post_id |
||
| 161 | $sel_sort_array = [ |
||
| 162 | 't.topic_title' => _MD_NEWBB_TOPICTITLE, |
||
| 163 | 't.topic_poster' => _MD_NEWBB_TOPICPOSTER, |
||
| 164 | 't.topic_id' => _MD_NEWBB_TOPICTIME, |
||
| 165 | 't.topic_replies' => _MD_NEWBB_NUMBERREPLIES, |
||
| 166 | 't.topic_views' => _MD_NEWBB_VIEWS, |
||
| 167 | 't.rating' => _MD_NEWBB_RATINGS, |
||
| 168 | 't.topic_last_post_id' => _MD_NEWBB_LASTPOSTTIME |
||
| 169 | ]; |
||
| 170 | if (!Request::getString('sort', '', 'GET') || !array_key_exists(Request::getString('sort', '', 'GET'), $sel_sort_array)) { |
||
| 171 | $sort = 't.topic_last_post_id'; |
||
| 172 | } else { |
||
| 173 | $sort = Request::getString('sort', '', 'GET'); |
||
| 174 | } |
||
| 175 | |||
| 176 | $forum_selection_sort = '<select name="sort">'; |
||
| 177 | foreach ($sel_sort_array as $sort_k => $sort_v) { |
||
| 178 | $forum_selection_sort .= '<option value="' . $sort_k . '"' . (($sort == $sort_k) ? ' selected="selected"' : '') . '>' . $sort_v . '</option>'; |
||
| 179 | } |
||
| 180 | $forum_selection_sort .= '</select>'; |
||
| 181 | |||
| 182 | $xoopsTpl->assign_by_ref('forum_selection_sort', $forum_selection_sort); |
||
| 183 | |||
| 184 | $order = (!Request::getString('order', '', 'GET') |
||
| 185 | || 'ASC' !== Request::getString('order', '', 'GET')) ? 'DESC' : 'ASC'; |
||
| 186 | $forum_selection_order = '<select name="order">'; |
||
| 187 | $forum_selection_order .= '<option value="ASC"' . (('ASC' === $order) ? ' selected' : '') . '>' . _MD_NEWBB_ASCENDING . '</option>'; |
||
| 188 | $forum_selection_order .= '<option value="DESC"' . (('DESC' === $order) ? ' selected' : '') . '>' . _MD_NEWBB_DESCENDING . '</option>'; |
||
| 189 | $forum_selection_order .= '</select>'; |
||
| 190 | |||
| 191 | $xoopsTpl->assign_by_ref('forum_selection_order', $forum_selection_order); |
||
| 192 | |||
| 193 | $since = Request::getInt('since', $GLOBALS['xoopsModuleConfig']['since_default'], 'GET'); |
||
| 194 | include_once __DIR__ . '/include/functions.time.php'; |
||
| 195 | $forum_selection_since = newbbSinceSelectBox($since); |
||
| 196 | $xoopsTpl->assign_by_ref('forum_selection_since', $forum_selection_since); |
||
| 197 | |||
| 198 | $query_sort = $query_array; |
||
| 199 | unset($query_sort['sort'], $query_sort['order']); |
||
| 200 | $page_query_sort = implode('&', array_values($query_sort)); |
||
| 201 | unset($query_sort); |
||
| 202 | // irmtfan - edit: u.uname => t.topic_poster | t.topic_time => t.topic_id | p.post_time => t.topic_last_post_id |
||
| 203 | $xoopsTpl->assign('h_topic_link', XOOPS_URL . "/modules/newbb/viewforum.php?{$page_query_sort}&sort=t.topic_title&order=" . (('t.topic_title' === $sort && 'DESC' === $order) ? 'ASC' : 'DESC')); |
||
| 204 | $xoopsTpl->assign('h_reply_link', XOOPS_URL . "/modules/newbb/viewforum.php?{$page_query_sort}&sort=t.topic_replies&order=" . (('t.topic_replies' === $sort && 'DESC' === $order) ? 'ASC' : 'DESC')); |
||
| 205 | $xoopsTpl->assign('h_poster_link', XOOPS_URL . "/modules/newbb/viewforum.php?{$page_query_sort}&sort=t.topic_poster&order=" . (('t.topic_poster' === $sort && 'DESC' === $order) ? 'ASC' : 'DESC')); |
||
| 206 | $xoopsTpl->assign('h_views_link', XOOPS_URL . "/modules/newbb/viewforum.php?{$page_query_sort}&sort=t.topic_views&order=" . (('t.topic_views' === $sort && 'DESC' === $order) ? 'ASC' : 'DESC')); |
||
| 207 | $xoopsTpl->assign('h_rating_link', XOOPS_URL . "/modules/newbb/viewforum.php?{$page_query_sort}&sort=t.rating&order=" . (('t.rating' === $sort |
||
| 208 | && 'DESC' === $order) ? 'ASC' : 'DESC')); // irmtfan t.topic_ratings to t.rating |
||
| 209 | $xoopsTpl->assign('h_date_link', XOOPS_URL . "/modules/newbb/viewforum.php?{$page_query_sort}&sort=t.topic_last_post_id&order=" . (('t.topic_last_post_id' === $sort && 'DESC' === $order) ? 'ASC' : 'DESC')); |
||
| 210 | $xoopsTpl->assign('h_publish_link', XOOPS_URL . "/modules/newbb/viewforum.php?{$page_query_sort}&sort=t.topic_id&order=" . (('t.topic_id' === $sort |
||
| 211 | && 'DESC' === $order) ? 'ASC' : 'DESC')); |
||
| 212 | $xoopsTpl->assign('forum_since', $since); // For $since in search.php |
||
| 213 | |||
| 214 | // irmtfan - if no since it should be 0 |
||
| 215 | $since = Request::getInt('since', 0, 'GET'); |
||
| 216 | $startdate = empty($since) ? 0 : (time() - newbbGetSinceTime($since)); |
||
| 217 | $start = Request::getInt('start', 0, 'GET'); |
||
| 218 | |||
| 219 | $criteria_vars = ['startdate', 'start', 'sort', 'order', 'type', 'status', 'excerpt']; |
||
| 220 | foreach ($criteria_vars as $var) { |
||
| 221 | $criteria_topic[$var] = @${$var}; |
||
| 222 | } |
||
| 223 | $criteria_topic['excerpt'] = $GLOBALS['xoopsModuleConfig']['post_excerpt']; |
||
| 224 | |||
| 225 | list($allTopics, $sticky) = $forumHandler->getAllTopics($forumObject, $criteria_topic); |
||
| 226 | |||
| 227 | $xoopsTpl->assign_by_ref('topics', $allTopics); |
||
| 228 | $xoopsTpl->assign('sticky', $sticky); |
||
| 229 | $xoopsTpl->assign('rating_enable', $GLOBALS['xoopsModuleConfig']['rating_enabled']); |
||
| 230 | $xoopsTpl->assign('img_newposts', newbbDisplayImage('topic_new', _MD_NEWBB_NEWPOSTS)); |
||
| 231 | $xoopsTpl->assign('img_hotnewposts', newbbDisplayImage('topic_hot_new', _MD_NEWBB_MORETHAN)); |
||
| 232 | $xoopsTpl->assign('img_folder', newbbDisplayImage('topic', _MD_NEWBB_NONEWPOSTS)); |
||
| 233 | $xoopsTpl->assign('img_hotfolder', newbbDisplayImage('topic_hot', _MD_NEWBB_MORETHAN2)); |
||
| 234 | $xoopsTpl->assign('img_locked', newbbDisplayImage('topic_locked', _MD_NEWBB_TOPICLOCKED)); |
||
| 235 | |||
| 236 | $xoopsTpl->assign('img_sticky', newbbDisplayImage('topic_sticky', _MD_NEWBB_TOPICSTICKY)); |
||
| 237 | $xoopsTpl->assign('img_digest', newbbDisplayImage('topic_digest', _MD_NEWBB_TOPICDIGEST)); |
||
| 238 | $xoopsTpl->assign('img_poll', newbbDisplayImage('poll', _MD_NEWBB_TOPICHASPOLL)); |
||
| 239 | |||
| 240 | $xoopsTpl->assign('mark_read', XOOPS_URL . "/modules/newbb/viewforum.php?mark=1&{$page_query}"); |
||
| 241 | $xoopsTpl->assign('mark_unread', XOOPS_URL . "/modules/newbb/viewforum.php?mark=2&{$page_query}"); |
||
| 242 | |||
| 243 | $xoopsTpl->assign('post_link', XOOPS_URL . '/modules/newbb/viewpost.php?forum=' . $forum_id); |
||
| 244 | $xoopsTpl->assign('newpost_link', XOOPS_URL . '/modules/newbb/viewpost.php?status=new&forum=' . $forum_id); |
||
| 245 | |||
| 246 | $query_type = $query_array; |
||
| 247 | unset($query_type['type']); |
||
| 248 | $page_query_type = implode('&', array_values($query_type)); |
||
| 249 | unset($query_type); |
||
| 250 | ///** @var Newbb\TypeHandler $typeHandler */ |
||
| 251 | //$typeHandler = Newbb\Helper::getInstance()->getHandler('Type'); |
||
| 252 | $typeOptions = null; |
||
| 253 | $types = []; |
||
| 254 | if ($types = $typeHandler->getByForum($forum_id)) { |
||
| 255 | $typeOptions[] = ['title' => _ALL, 'link' => XOOPS_URL . "/modules/newbb/viewforum.php?{$page_query_type}"]; |
||
| 256 | foreach ($types as $key => $item) { |
||
| 257 | $typeOptions[] = [ |
||
| 258 | 'title' => $item['type_name'], |
||
| 259 | 'link' => XOOPS_URL . "/modules/newbb/viewforum.php?{$page_query_type}&type={$key}" |
||
| 260 | ]; |
||
| 261 | } |
||
| 262 | } |
||
| 263 | if ($type > 0) { |
||
| 264 | include_once __DIR__ . '/include/functions.topic.php'; |
||
| 265 | $xoopsTpl->assign('forum_topictype', getTopicTitle('', $types[$type]['type_name'], $types[$type]['type_color'])); |
||
| 266 | } |
||
| 267 | $xoopsTpl->assign_by_ref('typeOptions', $typeOptions); |
||
| 268 | |||
| 269 | $query_status = $query_array; |
||
| 270 | unset($query_status['status']); |
||
| 271 | $page_query_status = implode('&', array_values($query_status)); |
||
| 272 | unset($query_status); |
||
| 273 | $xoopsTpl->assign('newpost_link', XOOPS_URL . '/modules/newbb/viewpost.php?status=new&forum=' . $forumObject->getVar('forum_id')); |
||
| 274 | $xoopsTpl->assign('all_link', XOOPS_URL . "/modules/newbb/viewforum.php?{$page_query_status}"); |
||
| 275 | $xoopsTpl->assign('digest_link', XOOPS_URL . "/modules/newbb/viewforum.php?{$page_query_status}&status=digest"); |
||
| 276 | $xoopsTpl->assign('unreplied_link', XOOPS_URL . "/modules/newbb/viewforum.php?{$page_query_status}&status=unreplied"); |
||
| 277 | $xoopsTpl->assign('unread_link', XOOPS_URL . "/modules/newbb/viewforum.php?{$page_query_status}&status=unread"); |
||
| 278 | switch ($status) { |
||
| 279 | case 'digest': |
||
| 280 | $current_status = _MD_NEWBB_DIGEST; |
||
| 281 | break; |
||
| 282 | case 'unreplied': |
||
| 283 | $current_status = _MD_NEWBB_UNREPLIED; |
||
| 284 | break; |
||
| 285 | case 'unread': |
||
| 286 | $current_status = _MD_NEWBB_UNREAD; |
||
| 287 | break; |
||
| 288 | case 'active': |
||
| 289 | $current_status = _MD_NEWBB_TYPE_ADMIN; |
||
| 290 | break; |
||
| 291 | case 'pending': |
||
| 292 | $current_status = _MD_NEWBB_TYPE_PENDING; |
||
| 293 | break; |
||
| 294 | case 'deleted': |
||
| 295 | $current_status = _MD_NEWBB_TYPE_DELETED; |
||
| 296 | break; |
||
| 297 | default: |
||
| 298 | $current_status = ''; |
||
| 299 | break; |
||
| 300 | } |
||
| 301 | $xoopsTpl->assign('forum_topicstatus', $current_status); |
||
| 302 | |||
| 303 | $all_topics = $forumHandler->getTopicCount($forumObject, $startdate, $status); |
||
| 304 | if ($all_topics > $GLOBALS['xoopsModuleConfig']['topics_per_page']) { |
||
| 305 | include_once $GLOBALS['xoops']->path('class/pagenav.php'); |
||
| 306 | $query_nav = $query_array; |
||
| 307 | unset($query_nav['start']); |
||
| 308 | $page_query_nav = implode('&', array_values($query_nav)); |
||
| 309 | unset($query_nav); |
||
| 310 | $nav = new \XoopsPageNav($all_topics, $GLOBALS['xoopsModuleConfig']['topics_per_page'], $start, 'start', $page_query_nav); |
||
| 311 | View Code Duplication | if ('select' === $GLOBALS['xoopsModuleConfig']['pagenav_display']) { |
|
| 312 | $navi = $nav->renderSelect(); |
||
| 313 | } elseif ('image' === $GLOBALS['xoopsModuleConfig']['pagenav_display']) { |
||
| 314 | $navi = $nav->renderImageNav(4); |
||
| 315 | } else { |
||
| 316 | $navi = $nav->renderNav(4); |
||
| 317 | } |
||
| 318 | |||
| 319 | $xoopsTpl->assign('forum_pagenav', $navi); |
||
| 320 | } else { |
||
| 321 | $xoopsTpl->assign('forum_pagenav', ''); |
||
| 322 | } |
||
| 323 | |||
| 324 | View Code Duplication | if (!empty($GLOBALS['xoopsModuleConfig']['show_jump'])) { |
|
| 325 | include_once __DIR__ . '/include/functions.forum.php'; |
||
| 326 | $xoopsTpl->assign('forum_jumpbox', newbbMakeJumpbox($forum_id)); |
||
| 327 | } |
||
| 328 | |||
| 329 | View Code Duplication | if ($GLOBALS['xoopsModuleConfig']['show_permissiontable']) { |
|
| 330 | // /** var Newbb\PermissionHandler $permHandler */ |
||
| 331 | // $permHandler = Newbb\Helper::getInstance()->getHandler('Permission'); |
||
| 332 | $permission_table = $permHandler->getPermissionTable($forum_id, false, $isAdmin); |
||
| 333 | $xoopsTpl->assign_by_ref('permission_table', $permission_table); |
||
| 334 | unset($permission_table); |
||
| 335 | } |
||
| 336 | |||
| 337 | if (1 == $GLOBALS['xoopsModuleConfig']['rss_enable']) { |
||
| 338 | $xoopsTpl->assign('rss_button', "<div align='right'><a href='" . XOOPS_URL . '/modules/' . $xoopsModule->dirname() . '/rss.php?f=' . $forum_id . "' title='RSS feed' target='_blank'>" . newbbDisplayImage('rss', 'RSS feed') . '</a></div>'); |
||
| 339 | } |
||
| 340 | // irmtfan move to footer.php |
||
| 341 | include_once __DIR__ . '/footer.php'; |
||
| 342 | include $GLOBALS['xoops']->path('footer.php'); |
||
| 343 |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.