@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | require_once $GLOBALS['xoops']->path('modules/newbb/include/functions.ini.php'); |
| 27 | 27 | |
| 28 | 28 | if (defined('NEWBB_BLOCK_DEFINED')) { |
| 29 | - return; |
|
| 29 | + return; |
|
| 30 | 30 | } |
| 31 | 31 | define('NEWBB_BLOCK_DEFINED', true); |
| 32 | 32 | |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | */ |
| 37 | 37 | function b_newbb_array_filter($var) |
| 38 | 38 | { |
| 39 | - return $var > 0; |
|
| 39 | + return $var > 0; |
|
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | // options[0] - Citeria valid: time(by default) |
@@ -53,166 +53,166 @@ discard block |
||
| 53 | 53 | */ |
| 54 | 54 | function b_newbb_show($options) |
| 55 | 55 | { |
| 56 | - global $accessForums; |
|
| 57 | - global $xoopsLogger; |
|
| 58 | - |
|
| 59 | - require_once dirname(__DIR__) . '/include/functions.config.php'; |
|
| 60 | - require_once dirname(__DIR__) . '/include/functions.time.php'; |
|
| 61 | - |
|
| 62 | - $myts = \MyTextSanitizer::getInstance(); |
|
| 63 | - $block = []; |
|
| 64 | - $i = 0; |
|
| 65 | - $order = ''; |
|
| 66 | - $extraCriteria = ''; |
|
| 67 | - if (!empty($options[2])) { |
|
| 68 | - //require_once dirname(__DIR__) . '/include/functions.time.php'; |
|
| 69 | - $extraCriteria .= ' AND p.post_time>' . (time() - newbbGetSinceTime($options[2])); |
|
| 70 | - } |
|
| 71 | - switch ($options[0]) { |
|
| 72 | - case 'time': |
|
| 73 | - default: |
|
| 74 | - $order = 't.topic_last_post_id'; |
|
| 75 | - break; |
|
| 76 | - } |
|
| 77 | - |
|
| 78 | - if (!isset($accessForums)) { |
|
| 79 | - /** var Newbb\PermissionHandler $permHandler */ |
|
| 80 | - $permHandler = Newbb\Helper::getInstance()->getHandler('Permission'); |
|
| 81 | - if (!$accessForums = $permHandler->getForums()) { |
|
| 82 | - return $block; |
|
| 83 | - } |
|
| 84 | - } |
|
| 85 | - if (!empty($options[6])) { |
|
| 86 | - $myallowedForums = array_filter(array_slice($options, 6), 'b_newbb_array_filter'); // get allowed forums |
|
| 87 | - $allowedForums = array_intersect($myallowedForums, $accessForums); |
|
| 88 | - } else { |
|
| 89 | - $allowedForums = $accessForums; |
|
| 90 | - } |
|
| 91 | - if (empty($allowedForums)) { |
|
| 92 | - return $block; |
|
| 93 | - } |
|
| 94 | - |
|
| 95 | - $forumCriteria = ' AND t.forum_id IN (' . implode(',', $allowedForums) . ')'; |
|
| 96 | - $approveCriteria = ' AND t.approved = 1'; |
|
| 97 | - |
|
| 98 | - $newbbConfig = newbbLoadConfig(); |
|
| 99 | - if (!empty($newbbConfig['do_rewrite'])) { |
|
| 100 | - require_once $GLOBALS['xoops']->path('modules/newbb/seo_url.php'); |
|
| 101 | - } else { |
|
| 102 | - if (!defined('SEO_MODULE_NAME')) { |
|
| 103 | - define('SEO_MODULE_NAME', 'modules/newbb'); |
|
| 104 | - } |
|
| 105 | - } |
|
| 106 | - |
|
| 107 | - $query = 'SELECT' |
|
| 108 | - . ' t.topic_id, t.topic_replies, t.forum_id, t.topic_title, t.topic_views, t.type_id,' |
|
| 109 | - . ' f.forum_name,t.topic_status,' |
|
| 110 | - . ' p.post_id, p.post_time, p.icon, p.uid, p.poster_name' |
|
| 111 | - . ' FROM ' |
|
| 112 | - . $GLOBALS['xoopsDB']->prefix('newbb_topics') |
|
| 113 | - . ' AS t ' |
|
| 114 | - . ' LEFT JOIN ' |
|
| 115 | - . $GLOBALS['xoopsDB']->prefix('newbb_posts') |
|
| 116 | - . ' AS p ON t.topic_last_post_id=p.post_id' |
|
| 117 | - . ' LEFT JOIN ' |
|
| 118 | - . $GLOBALS['xoopsDB']->prefix('newbb_forums') |
|
| 119 | - . ' AS f ON f.forum_id=t.forum_id' |
|
| 120 | - . ' WHERE 1=1 ' |
|
| 121 | - . $forumCriteria |
|
| 122 | - . $approveCriteria |
|
| 123 | - . $extraCriteria |
|
| 124 | - . ' ORDER BY ' |
|
| 125 | - . $order |
|
| 126 | - . ' DESC'; |
|
| 127 | - |
|
| 128 | - $result = $GLOBALS['xoopsDB']->query($query, $options[1], 0); |
|
| 129 | - |
|
| 130 | - if (!$result) { |
|
| 131 | - //xoops_error($GLOBALS['xoopsDB']->error()); |
|
| 132 | - return false; |
|
| 133 | - } |
|
| 134 | - $block['disp_mode'] = $options[3]; // 0 - full view; 1 - compact view; 2 - lite view; |
|
| 135 | - $rows = []; |
|
| 136 | - $author = []; |
|
| 137 | - $types = []; |
|
| 138 | - |
|
| 139 | - while (false !== ($row = $GLOBALS['xoopsDB']->fetchArray($result))) { |
|
| 140 | - $rows[] = $row; |
|
| 141 | - $author[$row['uid']] = 1; |
|
| 142 | - if ($row['type_id'] > 0) { |
|
| 143 | - $types[$row['type_id']] = 1; |
|
| 144 | - } |
|
| 145 | - } |
|
| 146 | - |
|
| 147 | - if (count($rows) < 1) { |
|
| 148 | - return $block; |
|
| 149 | - } |
|
| 150 | - |
|
| 151 | - require_once dirname(__DIR__) . '/include/functions.user.php'; |
|
| 152 | - $author_name = newbbGetUnameFromIds(array_keys($author), $newbbConfig['show_realname'], true); |
|
| 153 | - |
|
| 154 | - if (count($types) > 0) { |
|
| 155 | - /** @var Newbb\TypeHandler $typeHandler */ |
|
| 156 | - $typeHandler = Newbb\Helper::getInstance()->getHandler('Type'); |
|
| 157 | - $type_list = $typeHandler->getList(new \Criteria('type_id', '(' . implode(', ', array_keys($types)) . ')', 'IN')); |
|
| 158 | - } |
|
| 159 | - |
|
| 160 | - foreach ($rows as $arr) { |
|
| 161 | - // irmtfan add lastposticon - load main lang |
|
| 162 | - xoops_loadLanguage('main', 'newbb'); |
|
| 163 | - $topic = []; |
|
| 164 | - $topic_page_jump = newbbDisplayImage('lastposticon', _MD_NEWBB_GOTOLASTPOST); |
|
| 165 | - $topic['topic_subject'] = empty($type_list[$arr['type_id']]) ? '' : '[' . $type_list[$arr['type_id']] . ']'; |
|
| 166 | - |
|
| 167 | - $topic['post_id'] = $arr['post_id']; |
|
| 168 | - $topic['topic_status'] = $arr['topic_status']; |
|
| 169 | - $topic['forum_id'] = $arr['forum_id']; |
|
| 170 | - $topic['forum_name'] = $myts->htmlSpecialChars($arr['forum_name']); |
|
| 171 | - $topic['id'] = $arr['topic_id']; |
|
| 172 | - |
|
| 173 | - $title = $myts->htmlSpecialChars($arr['topic_title']); |
|
| 174 | - if (!empty($options[5])) { |
|
| 175 | - $title = xoops_substr($title, 0, $options[5]); |
|
| 176 | - } |
|
| 177 | - $topic['title'] = $topic['topic_subject'] . ' ' . $title; |
|
| 178 | - $topic['replies'] = $arr['topic_replies']; |
|
| 179 | - $topic['views'] = $arr['topic_views']; |
|
| 180 | - $topic['time'] = newbbFormatTimestamp($arr['post_time']); |
|
| 181 | - if (!empty($author_name[$arr['uid']])) { |
|
| 182 | - $topic_poster = $author_name[$arr['uid']]; |
|
| 183 | - } else { |
|
| 184 | - $topic_poster = $myts->htmlSpecialChars($arr['poster_name'] ?: $GLOBALS['xoopsConfig']['anonymous']); |
|
| 185 | - } |
|
| 186 | - $topic['topic_poster'] = $topic_poster; |
|
| 187 | - $topic['topic_page_jump'] = $topic_page_jump; |
|
| 188 | - // START irmtfan remove hardcoded html in URLs - add $seo_topic_url |
|
| 189 | - $seo_url = XOOPS_URL . '/' . SEO_MODULE_NAME . '/viewtopic.php?post_id=' . $topic['post_id']; |
|
| 190 | - $seo_topic_url = XOOPS_URL . '/' . SEO_MODULE_NAME . '/viewtopic.php?topic_id=' . $topic['id']; |
|
| 191 | - $seo_forum_url = XOOPS_URL . '/' . SEO_MODULE_NAME . '/viewforum.php?forum=' . $topic['forum_id']; |
|
| 192 | - if (!empty($newbbConfig['do_rewrite'])) { |
|
| 193 | - $topic['seo_url'] = seo_urls($seo_url); |
|
| 194 | - $topic['seo_topic_url'] = seo_urls($seo_topic_url); |
|
| 195 | - $topic['seo_forum_url'] = seo_urls($seo_forum_url); |
|
| 196 | - } else { |
|
| 197 | - $topic['seo_url'] = $seo_url; |
|
| 198 | - $topic['seo_topic_url'] = $seo_topic_url; |
|
| 199 | - $topic['seo_forum_url'] = $seo_forum_url; |
|
| 200 | - } |
|
| 201 | - // END irmtfan remove hardcoded html in URLs - add $seo_topic_url |
|
| 202 | - $block['topics'][] = $topic; |
|
| 203 | - unset($topic); |
|
| 204 | - } |
|
| 205 | - // START irmtfan remove hardcoded html in URLs |
|
| 206 | - $seo_top_allforums = XOOPS_URL . '/' . SEO_MODULE_NAME; |
|
| 207 | - $block['seo_top_allforums'] = !empty($newbbConfig['do_rewrite']) ? seo_urls($seo_top_allforums) : $seo_top_allforums; |
|
| 208 | - $seo_top_allforums = XOOPS_URL . '/' . SEO_MODULE_NAME . '/list.topic.php'; |
|
| 209 | - $block['seo_top_alltopics'] = !empty($newbbConfig['do_rewrite']) ? seo_urls($seo_top_allforums) : $seo_top_allforums; |
|
| 210 | - $seo_top_allforums = XOOPS_URL . '/' . SEO_MODULE_NAME . '/viewpost.php'; |
|
| 211 | - $block['seo_top_allposts'] = !empty($newbbConfig['do_rewrite']) ? seo_urls($seo_top_allforums) : $seo_top_allforums; |
|
| 212 | - // END irmtfan remove hardcoded html in URLs |
|
| 213 | - $block['indexNav'] = (int)$options[4]; |
|
| 214 | - |
|
| 215 | - return $block; |
|
| 56 | + global $accessForums; |
|
| 57 | + global $xoopsLogger; |
|
| 58 | + |
|
| 59 | + require_once dirname(__DIR__) . '/include/functions.config.php'; |
|
| 60 | + require_once dirname(__DIR__) . '/include/functions.time.php'; |
|
| 61 | + |
|
| 62 | + $myts = \MyTextSanitizer::getInstance(); |
|
| 63 | + $block = []; |
|
| 64 | + $i = 0; |
|
| 65 | + $order = ''; |
|
| 66 | + $extraCriteria = ''; |
|
| 67 | + if (!empty($options[2])) { |
|
| 68 | + //require_once dirname(__DIR__) . '/include/functions.time.php'; |
|
| 69 | + $extraCriteria .= ' AND p.post_time>' . (time() - newbbGetSinceTime($options[2])); |
|
| 70 | + } |
|
| 71 | + switch ($options[0]) { |
|
| 72 | + case 'time': |
|
| 73 | + default: |
|
| 74 | + $order = 't.topic_last_post_id'; |
|
| 75 | + break; |
|
| 76 | + } |
|
| 77 | + |
|
| 78 | + if (!isset($accessForums)) { |
|
| 79 | + /** var Newbb\PermissionHandler $permHandler */ |
|
| 80 | + $permHandler = Newbb\Helper::getInstance()->getHandler('Permission'); |
|
| 81 | + if (!$accessForums = $permHandler->getForums()) { |
|
| 82 | + return $block; |
|
| 83 | + } |
|
| 84 | + } |
|
| 85 | + if (!empty($options[6])) { |
|
| 86 | + $myallowedForums = array_filter(array_slice($options, 6), 'b_newbb_array_filter'); // get allowed forums |
|
| 87 | + $allowedForums = array_intersect($myallowedForums, $accessForums); |
|
| 88 | + } else { |
|
| 89 | + $allowedForums = $accessForums; |
|
| 90 | + } |
|
| 91 | + if (empty($allowedForums)) { |
|
| 92 | + return $block; |
|
| 93 | + } |
|
| 94 | + |
|
| 95 | + $forumCriteria = ' AND t.forum_id IN (' . implode(',', $allowedForums) . ')'; |
|
| 96 | + $approveCriteria = ' AND t.approved = 1'; |
|
| 97 | + |
|
| 98 | + $newbbConfig = newbbLoadConfig(); |
|
| 99 | + if (!empty($newbbConfig['do_rewrite'])) { |
|
| 100 | + require_once $GLOBALS['xoops']->path('modules/newbb/seo_url.php'); |
|
| 101 | + } else { |
|
| 102 | + if (!defined('SEO_MODULE_NAME')) { |
|
| 103 | + define('SEO_MODULE_NAME', 'modules/newbb'); |
|
| 104 | + } |
|
| 105 | + } |
|
| 106 | + |
|
| 107 | + $query = 'SELECT' |
|
| 108 | + . ' t.topic_id, t.topic_replies, t.forum_id, t.topic_title, t.topic_views, t.type_id,' |
|
| 109 | + . ' f.forum_name,t.topic_status,' |
|
| 110 | + . ' p.post_id, p.post_time, p.icon, p.uid, p.poster_name' |
|
| 111 | + . ' FROM ' |
|
| 112 | + . $GLOBALS['xoopsDB']->prefix('newbb_topics') |
|
| 113 | + . ' AS t ' |
|
| 114 | + . ' LEFT JOIN ' |
|
| 115 | + . $GLOBALS['xoopsDB']->prefix('newbb_posts') |
|
| 116 | + . ' AS p ON t.topic_last_post_id=p.post_id' |
|
| 117 | + . ' LEFT JOIN ' |
|
| 118 | + . $GLOBALS['xoopsDB']->prefix('newbb_forums') |
|
| 119 | + . ' AS f ON f.forum_id=t.forum_id' |
|
| 120 | + . ' WHERE 1=1 ' |
|
| 121 | + . $forumCriteria |
|
| 122 | + . $approveCriteria |
|
| 123 | + . $extraCriteria |
|
| 124 | + . ' ORDER BY ' |
|
| 125 | + . $order |
|
| 126 | + . ' DESC'; |
|
| 127 | + |
|
| 128 | + $result = $GLOBALS['xoopsDB']->query($query, $options[1], 0); |
|
| 129 | + |
|
| 130 | + if (!$result) { |
|
| 131 | + //xoops_error($GLOBALS['xoopsDB']->error()); |
|
| 132 | + return false; |
|
| 133 | + } |
|
| 134 | + $block['disp_mode'] = $options[3]; // 0 - full view; 1 - compact view; 2 - lite view; |
|
| 135 | + $rows = []; |
|
| 136 | + $author = []; |
|
| 137 | + $types = []; |
|
| 138 | + |
|
| 139 | + while (false !== ($row = $GLOBALS['xoopsDB']->fetchArray($result))) { |
|
| 140 | + $rows[] = $row; |
|
| 141 | + $author[$row['uid']] = 1; |
|
| 142 | + if ($row['type_id'] > 0) { |
|
| 143 | + $types[$row['type_id']] = 1; |
|
| 144 | + } |
|
| 145 | + } |
|
| 146 | + |
|
| 147 | + if (count($rows) < 1) { |
|
| 148 | + return $block; |
|
| 149 | + } |
|
| 150 | + |
|
| 151 | + require_once dirname(__DIR__) . '/include/functions.user.php'; |
|
| 152 | + $author_name = newbbGetUnameFromIds(array_keys($author), $newbbConfig['show_realname'], true); |
|
| 153 | + |
|
| 154 | + if (count($types) > 0) { |
|
| 155 | + /** @var Newbb\TypeHandler $typeHandler */ |
|
| 156 | + $typeHandler = Newbb\Helper::getInstance()->getHandler('Type'); |
|
| 157 | + $type_list = $typeHandler->getList(new \Criteria('type_id', '(' . implode(', ', array_keys($types)) . ')', 'IN')); |
|
| 158 | + } |
|
| 159 | + |
|
| 160 | + foreach ($rows as $arr) { |
|
| 161 | + // irmtfan add lastposticon - load main lang |
|
| 162 | + xoops_loadLanguage('main', 'newbb'); |
|
| 163 | + $topic = []; |
|
| 164 | + $topic_page_jump = newbbDisplayImage('lastposticon', _MD_NEWBB_GOTOLASTPOST); |
|
| 165 | + $topic['topic_subject'] = empty($type_list[$arr['type_id']]) ? '' : '[' . $type_list[$arr['type_id']] . ']'; |
|
| 166 | + |
|
| 167 | + $topic['post_id'] = $arr['post_id']; |
|
| 168 | + $topic['topic_status'] = $arr['topic_status']; |
|
| 169 | + $topic['forum_id'] = $arr['forum_id']; |
|
| 170 | + $topic['forum_name'] = $myts->htmlSpecialChars($arr['forum_name']); |
|
| 171 | + $topic['id'] = $arr['topic_id']; |
|
| 172 | + |
|
| 173 | + $title = $myts->htmlSpecialChars($arr['topic_title']); |
|
| 174 | + if (!empty($options[5])) { |
|
| 175 | + $title = xoops_substr($title, 0, $options[5]); |
|
| 176 | + } |
|
| 177 | + $topic['title'] = $topic['topic_subject'] . ' ' . $title; |
|
| 178 | + $topic['replies'] = $arr['topic_replies']; |
|
| 179 | + $topic['views'] = $arr['topic_views']; |
|
| 180 | + $topic['time'] = newbbFormatTimestamp($arr['post_time']); |
|
| 181 | + if (!empty($author_name[$arr['uid']])) { |
|
| 182 | + $topic_poster = $author_name[$arr['uid']]; |
|
| 183 | + } else { |
|
| 184 | + $topic_poster = $myts->htmlSpecialChars($arr['poster_name'] ?: $GLOBALS['xoopsConfig']['anonymous']); |
|
| 185 | + } |
|
| 186 | + $topic['topic_poster'] = $topic_poster; |
|
| 187 | + $topic['topic_page_jump'] = $topic_page_jump; |
|
| 188 | + // START irmtfan remove hardcoded html in URLs - add $seo_topic_url |
|
| 189 | + $seo_url = XOOPS_URL . '/' . SEO_MODULE_NAME . '/viewtopic.php?post_id=' . $topic['post_id']; |
|
| 190 | + $seo_topic_url = XOOPS_URL . '/' . SEO_MODULE_NAME . '/viewtopic.php?topic_id=' . $topic['id']; |
|
| 191 | + $seo_forum_url = XOOPS_URL . '/' . SEO_MODULE_NAME . '/viewforum.php?forum=' . $topic['forum_id']; |
|
| 192 | + if (!empty($newbbConfig['do_rewrite'])) { |
|
| 193 | + $topic['seo_url'] = seo_urls($seo_url); |
|
| 194 | + $topic['seo_topic_url'] = seo_urls($seo_topic_url); |
|
| 195 | + $topic['seo_forum_url'] = seo_urls($seo_forum_url); |
|
| 196 | + } else { |
|
| 197 | + $topic['seo_url'] = $seo_url; |
|
| 198 | + $topic['seo_topic_url'] = $seo_topic_url; |
|
| 199 | + $topic['seo_forum_url'] = $seo_forum_url; |
|
| 200 | + } |
|
| 201 | + // END irmtfan remove hardcoded html in URLs - add $seo_topic_url |
|
| 202 | + $block['topics'][] = $topic; |
|
| 203 | + unset($topic); |
|
| 204 | + } |
|
| 205 | + // START irmtfan remove hardcoded html in URLs |
|
| 206 | + $seo_top_allforums = XOOPS_URL . '/' . SEO_MODULE_NAME; |
|
| 207 | + $block['seo_top_allforums'] = !empty($newbbConfig['do_rewrite']) ? seo_urls($seo_top_allforums) : $seo_top_allforums; |
|
| 208 | + $seo_top_allforums = XOOPS_URL . '/' . SEO_MODULE_NAME . '/list.topic.php'; |
|
| 209 | + $block['seo_top_alltopics'] = !empty($newbbConfig['do_rewrite']) ? seo_urls($seo_top_allforums) : $seo_top_allforums; |
|
| 210 | + $seo_top_allforums = XOOPS_URL . '/' . SEO_MODULE_NAME . '/viewpost.php'; |
|
| 211 | + $block['seo_top_allposts'] = !empty($newbbConfig['do_rewrite']) ? seo_urls($seo_top_allforums) : $seo_top_allforums; |
|
| 212 | + // END irmtfan remove hardcoded html in URLs |
|
| 213 | + $block['indexNav'] = (int)$options[4]; |
|
| 214 | + |
|
| 215 | + return $block; |
|
| 216 | 216 | } |
| 217 | 217 | |
| 218 | 218 | // options[0] - Citeria valid: time(by default), views, replies, digest, sticky |
@@ -229,168 +229,168 @@ discard block |
||
| 229 | 229 | */ |
| 230 | 230 | function b_newbb_topic_show($options) |
| 231 | 231 | { |
| 232 | - global $accessForums; |
|
| 233 | - require_once dirname(__DIR__) . '/include/functions.time.php'; |
|
| 234 | - $myts = \MyTextSanitizer::getInstance(); |
|
| 235 | - $block = []; |
|
| 236 | - $i = 0; |
|
| 237 | - $order = ''; |
|
| 238 | - $extraCriteria = ''; |
|
| 239 | - $time_criteria = null; |
|
| 240 | - if (!empty($options[2])) { |
|
| 241 | - $time_criteria = time() - newbbGetSinceTime($options[2]); |
|
| 242 | - $extraCriteria = ' AND t.topic_time>' . $time_criteria; |
|
| 243 | - } |
|
| 244 | - switch ($options[0]) { |
|
| 245 | - case 'views': |
|
| 246 | - $order = 't.topic_views'; |
|
| 247 | - break; |
|
| 248 | - case 'replies': |
|
| 249 | - $order = 't.topic_replies'; |
|
| 250 | - break; |
|
| 251 | - case 'digest': |
|
| 252 | - $order = 't.digest_time'; |
|
| 253 | - $extraCriteria = ' AND t.topic_digest=1'; |
|
| 254 | - if (null !== $time_criteria) { |
|
| 255 | - $extraCriteria .= ' AND t.digest_time>' . $time_criteria; |
|
| 256 | - } |
|
| 257 | - break; |
|
| 258 | - case 'sticky': |
|
| 259 | - $order = 't.topic_id'; |
|
| 260 | - $extraCriteria .= ' AND t.topic_sticky=1'; |
|
| 261 | - break; |
|
| 262 | - case 'time': |
|
| 263 | - default: |
|
| 264 | - $order = 't.topic_id'; |
|
| 265 | - break; |
|
| 266 | - } |
|
| 267 | - |
|
| 268 | - $newbbConfig = newbbLoadConfig(); |
|
| 269 | - if (!empty($newbbConfig['do_rewrite'])) { |
|
| 270 | - require_once $GLOBALS['xoops']->path('modules/newbb/seo_url.php'); |
|
| 271 | - } else { |
|
| 272 | - if (!defined('SEO_MODULE_NAME')) { |
|
| 273 | - define('SEO_MODULE_NAME', 'modules/newbb'); |
|
| 274 | - } |
|
| 275 | - } |
|
| 276 | - |
|
| 277 | - if (!isset($accessForums)) { |
|
| 278 | - /** var Newbb\PermissionHandler $permHandler */ |
|
| 279 | - $permHandler = Newbb\Helper::getInstance()->getHandler('Permission'); |
|
| 280 | - if (!$accessForums = $permHandler->getForums()) { |
|
| 281 | - return $block; |
|
| 282 | - } |
|
| 283 | - } |
|
| 284 | - |
|
| 285 | - if (!empty($options[6])) { |
|
| 286 | - $myallowedForums = array_filter(array_slice($options, 6), 'b_newbb_array_filter'); // get allowed forums |
|
| 287 | - $allowedForums = array_intersect($myallowedForums, $accessForums); |
|
| 288 | - } else { |
|
| 289 | - $allowedForums = $accessForums; |
|
| 290 | - } |
|
| 291 | - if (empty($allowedForums)) { |
|
| 292 | - return false; |
|
| 293 | - } |
|
| 294 | - |
|
| 295 | - $forumCriteria = ' AND t.forum_id IN (' . implode(',', $allowedForums) . ')'; |
|
| 296 | - $approveCriteria = ' AND t.approved = 1'; |
|
| 297 | - |
|
| 298 | - $query = 'SELECT' |
|
| 299 | - . ' t.topic_id, t.topic_replies, t.forum_id, t.topic_title, t.topic_views, t.type_id, t.topic_time, t.topic_poster, t.poster_name,' |
|
| 300 | - . ' f.forum_name' |
|
| 301 | - . ' FROM ' |
|
| 302 | - . $GLOBALS['xoopsDB']->prefix('newbb_topics') |
|
| 303 | - . ' AS t ' |
|
| 304 | - . ' LEFT JOIN ' |
|
| 305 | - . $GLOBALS['xoopsDB']->prefix('newbb_forums') |
|
| 306 | - . ' AS f ON f.forum_id=t.forum_id' |
|
| 307 | - . ' WHERE 1=1 ' |
|
| 308 | - . $forumCriteria |
|
| 309 | - . $approveCriteria |
|
| 310 | - . $extraCriteria |
|
| 311 | - . ' ORDER BY ' |
|
| 312 | - . $order |
|
| 313 | - . ' DESC'; |
|
| 314 | - |
|
| 315 | - $result = $GLOBALS['xoopsDB']->query($query, $options[1], 0); |
|
| 316 | - |
|
| 317 | - if (!$result) { |
|
| 318 | - //xoops_error($GLOBALS['xoopsDB']->error()); |
|
| 319 | - return $block; |
|
| 320 | - } |
|
| 321 | - $block['disp_mode'] = $options[3]; // 0 - full view; 1 - compact view; 2 - lite view; |
|
| 322 | - $rows = []; |
|
| 323 | - $author = []; |
|
| 324 | - $types = []; |
|
| 325 | - while (false !== ($row = $GLOBALS['xoopsDB']->fetchArray($result))) { |
|
| 326 | - $rows[] = $row; |
|
| 327 | - $author[$row['topic_poster']] = 1; |
|
| 328 | - if ($row['type_id'] > 0) { |
|
| 329 | - $types[$row['type_id']] = 1; |
|
| 330 | - } |
|
| 331 | - } |
|
| 332 | - if (count($rows) < 1) { |
|
| 333 | - return $block; |
|
| 334 | - } |
|
| 335 | - require_once dirname(__DIR__) . '/include/functions.user.php'; |
|
| 336 | - $author_name = newbbGetUnameFromIds(array_keys($author), $newbbConfig['show_realname'], true); |
|
| 337 | - if (count($types) > 0) { |
|
| 338 | - /** @var Newbb\TypeHandler $typeHandler */ |
|
| 339 | - $typeHandler = Newbb\Helper::getInstance()->getHandler('Type'); |
|
| 340 | - $type_list = $typeHandler->getList(new \Criteria('type_id', '(' . implode(', ', array_keys($types)) . ')', 'IN')); |
|
| 341 | - } |
|
| 342 | - |
|
| 343 | - foreach ($rows as $arr) { |
|
| 344 | - // irmtfan remove $topic_page_jump because there is no last post |
|
| 345 | - //$topic_page_jump = ''; |
|
| 346 | - $topic = []; |
|
| 347 | - $topic['topic_subject'] = empty($type_list[$arr['type_id']]) ? '' : '[' . $type_list[$arr['type_id']] . '] '; |
|
| 348 | - $topic['forum_id'] = $arr['forum_id']; |
|
| 349 | - $topic['forum_name'] = $myts->htmlSpecialChars($arr['forum_name']); |
|
| 350 | - $topic['id'] = $arr['topic_id']; |
|
| 351 | - |
|
| 352 | - $title = $myts->htmlSpecialChars($arr['topic_title']); |
|
| 353 | - if (!empty($options[5])) { |
|
| 354 | - $title = xoops_substr($title, 0, $options[5]); |
|
| 355 | - } |
|
| 356 | - $topic['title'] = $topic['topic_subject'] . $title; |
|
| 357 | - $topic['replies'] = $arr['topic_replies']; |
|
| 358 | - $topic['views'] = $arr['topic_views']; |
|
| 359 | - $topic['time'] = newbbFormatTimestamp($arr['topic_time']); |
|
| 360 | - if (!empty($author_name[$arr['topic_poster']])) { |
|
| 361 | - $topic_poster = $author_name[$arr['topic_poster']]; |
|
| 362 | - } else { |
|
| 363 | - $topic_poster = $myts->htmlSpecialChars($arr['poster_name'] ?: $GLOBALS['xoopsConfig']['anonymous']); |
|
| 364 | - } |
|
| 365 | - $topic['topic_poster'] = $topic_poster; |
|
| 366 | - // irmtfan remove $topic_page_jump because there is no last post |
|
| 367 | - //$topic['topic_page_jump'] = $topic_page_jump; |
|
| 368 | - // START irmtfan remove hardcoded html in URLs - add $seo_topic_url |
|
| 369 | - $seo_topic_url = XOOPS_URL . '/' . SEO_MODULE_NAME . '/viewtopic.php?topic_id=' . $topic['id']; |
|
| 370 | - $seo_forum_url = XOOPS_URL . '/' . SEO_MODULE_NAME . '/viewforum.php?forum=' . $topic['forum_id']; |
|
| 371 | - |
|
| 372 | - if (!empty($newbbConfig['do_rewrite'])) { |
|
| 373 | - $topic['seo_topic_url'] = seo_urls($seo_topic_url); |
|
| 374 | - $topic['seo_forum_url'] = seo_urls($seo_forum_url); |
|
| 375 | - } else { |
|
| 376 | - $topic['seo_topic_url'] = $seo_topic_url; |
|
| 377 | - $topic['seo_forum_url'] = $seo_forum_url; |
|
| 378 | - } |
|
| 379 | - // END irmtfan remove hardcoded html in URLs - add $seo_topic_url |
|
| 380 | - $block['topics'][] = $topic; |
|
| 381 | - unset($topic); |
|
| 382 | - } |
|
| 383 | - // START irmtfan remove hardcoded html in URLs |
|
| 384 | - $seo_top_allforums = XOOPS_URL . '/' . SEO_MODULE_NAME; |
|
| 385 | - $block['seo_top_allforums'] = !empty($newbbConfig['do_rewrite']) ? seo_urls($seo_top_allforums) : $seo_top_allforums; |
|
| 386 | - $seo_top_allforums = XOOPS_URL . '/' . SEO_MODULE_NAME . '/list.topic.php'; |
|
| 387 | - $block['seo_top_alltopics'] = !empty($newbbConfig['do_rewrite']) ? seo_urls($seo_top_allforums) : $seo_top_allforums; |
|
| 388 | - $seo_top_allforums = XOOPS_URL . '/' . SEO_MODULE_NAME . '/viewpost.php'; |
|
| 389 | - $block['seo_top_allposts'] = !empty($newbbConfig['do_rewrite']) ? seo_urls($seo_top_allforums) : $seo_top_allforums; |
|
| 390 | - // END irmtfan remove hardcoded html in URLs |
|
| 391 | - $block['indexNav'] = (int)$options[4]; |
|
| 392 | - |
|
| 393 | - return $block; |
|
| 232 | + global $accessForums; |
|
| 233 | + require_once dirname(__DIR__) . '/include/functions.time.php'; |
|
| 234 | + $myts = \MyTextSanitizer::getInstance(); |
|
| 235 | + $block = []; |
|
| 236 | + $i = 0; |
|
| 237 | + $order = ''; |
|
| 238 | + $extraCriteria = ''; |
|
| 239 | + $time_criteria = null; |
|
| 240 | + if (!empty($options[2])) { |
|
| 241 | + $time_criteria = time() - newbbGetSinceTime($options[2]); |
|
| 242 | + $extraCriteria = ' AND t.topic_time>' . $time_criteria; |
|
| 243 | + } |
|
| 244 | + switch ($options[0]) { |
|
| 245 | + case 'views': |
|
| 246 | + $order = 't.topic_views'; |
|
| 247 | + break; |
|
| 248 | + case 'replies': |
|
| 249 | + $order = 't.topic_replies'; |
|
| 250 | + break; |
|
| 251 | + case 'digest': |
|
| 252 | + $order = 't.digest_time'; |
|
| 253 | + $extraCriteria = ' AND t.topic_digest=1'; |
|
| 254 | + if (null !== $time_criteria) { |
|
| 255 | + $extraCriteria .= ' AND t.digest_time>' . $time_criteria; |
|
| 256 | + } |
|
| 257 | + break; |
|
| 258 | + case 'sticky': |
|
| 259 | + $order = 't.topic_id'; |
|
| 260 | + $extraCriteria .= ' AND t.topic_sticky=1'; |
|
| 261 | + break; |
|
| 262 | + case 'time': |
|
| 263 | + default: |
|
| 264 | + $order = 't.topic_id'; |
|
| 265 | + break; |
|
| 266 | + } |
|
| 267 | + |
|
| 268 | + $newbbConfig = newbbLoadConfig(); |
|
| 269 | + if (!empty($newbbConfig['do_rewrite'])) { |
|
| 270 | + require_once $GLOBALS['xoops']->path('modules/newbb/seo_url.php'); |
|
| 271 | + } else { |
|
| 272 | + if (!defined('SEO_MODULE_NAME')) { |
|
| 273 | + define('SEO_MODULE_NAME', 'modules/newbb'); |
|
| 274 | + } |
|
| 275 | + } |
|
| 276 | + |
|
| 277 | + if (!isset($accessForums)) { |
|
| 278 | + /** var Newbb\PermissionHandler $permHandler */ |
|
| 279 | + $permHandler = Newbb\Helper::getInstance()->getHandler('Permission'); |
|
| 280 | + if (!$accessForums = $permHandler->getForums()) { |
|
| 281 | + return $block; |
|
| 282 | + } |
|
| 283 | + } |
|
| 284 | + |
|
| 285 | + if (!empty($options[6])) { |
|
| 286 | + $myallowedForums = array_filter(array_slice($options, 6), 'b_newbb_array_filter'); // get allowed forums |
|
| 287 | + $allowedForums = array_intersect($myallowedForums, $accessForums); |
|
| 288 | + } else { |
|
| 289 | + $allowedForums = $accessForums; |
|
| 290 | + } |
|
| 291 | + if (empty($allowedForums)) { |
|
| 292 | + return false; |
|
| 293 | + } |
|
| 294 | + |
|
| 295 | + $forumCriteria = ' AND t.forum_id IN (' . implode(',', $allowedForums) . ')'; |
|
| 296 | + $approveCriteria = ' AND t.approved = 1'; |
|
| 297 | + |
|
| 298 | + $query = 'SELECT' |
|
| 299 | + . ' t.topic_id, t.topic_replies, t.forum_id, t.topic_title, t.topic_views, t.type_id, t.topic_time, t.topic_poster, t.poster_name,' |
|
| 300 | + . ' f.forum_name' |
|
| 301 | + . ' FROM ' |
|
| 302 | + . $GLOBALS['xoopsDB']->prefix('newbb_topics') |
|
| 303 | + . ' AS t ' |
|
| 304 | + . ' LEFT JOIN ' |
|
| 305 | + . $GLOBALS['xoopsDB']->prefix('newbb_forums') |
|
| 306 | + . ' AS f ON f.forum_id=t.forum_id' |
|
| 307 | + . ' WHERE 1=1 ' |
|
| 308 | + . $forumCriteria |
|
| 309 | + . $approveCriteria |
|
| 310 | + . $extraCriteria |
|
| 311 | + . ' ORDER BY ' |
|
| 312 | + . $order |
|
| 313 | + . ' DESC'; |
|
| 314 | + |
|
| 315 | + $result = $GLOBALS['xoopsDB']->query($query, $options[1], 0); |
|
| 316 | + |
|
| 317 | + if (!$result) { |
|
| 318 | + //xoops_error($GLOBALS['xoopsDB']->error()); |
|
| 319 | + return $block; |
|
| 320 | + } |
|
| 321 | + $block['disp_mode'] = $options[3]; // 0 - full view; 1 - compact view; 2 - lite view; |
|
| 322 | + $rows = []; |
|
| 323 | + $author = []; |
|
| 324 | + $types = []; |
|
| 325 | + while (false !== ($row = $GLOBALS['xoopsDB']->fetchArray($result))) { |
|
| 326 | + $rows[] = $row; |
|
| 327 | + $author[$row['topic_poster']] = 1; |
|
| 328 | + if ($row['type_id'] > 0) { |
|
| 329 | + $types[$row['type_id']] = 1; |
|
| 330 | + } |
|
| 331 | + } |
|
| 332 | + if (count($rows) < 1) { |
|
| 333 | + return $block; |
|
| 334 | + } |
|
| 335 | + require_once dirname(__DIR__) . '/include/functions.user.php'; |
|
| 336 | + $author_name = newbbGetUnameFromIds(array_keys($author), $newbbConfig['show_realname'], true); |
|
| 337 | + if (count($types) > 0) { |
|
| 338 | + /** @var Newbb\TypeHandler $typeHandler */ |
|
| 339 | + $typeHandler = Newbb\Helper::getInstance()->getHandler('Type'); |
|
| 340 | + $type_list = $typeHandler->getList(new \Criteria('type_id', '(' . implode(', ', array_keys($types)) . ')', 'IN')); |
|
| 341 | + } |
|
| 342 | + |
|
| 343 | + foreach ($rows as $arr) { |
|
| 344 | + // irmtfan remove $topic_page_jump because there is no last post |
|
| 345 | + //$topic_page_jump = ''; |
|
| 346 | + $topic = []; |
|
| 347 | + $topic['topic_subject'] = empty($type_list[$arr['type_id']]) ? '' : '[' . $type_list[$arr['type_id']] . '] '; |
|
| 348 | + $topic['forum_id'] = $arr['forum_id']; |
|
| 349 | + $topic['forum_name'] = $myts->htmlSpecialChars($arr['forum_name']); |
|
| 350 | + $topic['id'] = $arr['topic_id']; |
|
| 351 | + |
|
| 352 | + $title = $myts->htmlSpecialChars($arr['topic_title']); |
|
| 353 | + if (!empty($options[5])) { |
|
| 354 | + $title = xoops_substr($title, 0, $options[5]); |
|
| 355 | + } |
|
| 356 | + $topic['title'] = $topic['topic_subject'] . $title; |
|
| 357 | + $topic['replies'] = $arr['topic_replies']; |
|
| 358 | + $topic['views'] = $arr['topic_views']; |
|
| 359 | + $topic['time'] = newbbFormatTimestamp($arr['topic_time']); |
|
| 360 | + if (!empty($author_name[$arr['topic_poster']])) { |
|
| 361 | + $topic_poster = $author_name[$arr['topic_poster']]; |
|
| 362 | + } else { |
|
| 363 | + $topic_poster = $myts->htmlSpecialChars($arr['poster_name'] ?: $GLOBALS['xoopsConfig']['anonymous']); |
|
| 364 | + } |
|
| 365 | + $topic['topic_poster'] = $topic_poster; |
|
| 366 | + // irmtfan remove $topic_page_jump because there is no last post |
|
| 367 | + //$topic['topic_page_jump'] = $topic_page_jump; |
|
| 368 | + // START irmtfan remove hardcoded html in URLs - add $seo_topic_url |
|
| 369 | + $seo_topic_url = XOOPS_URL . '/' . SEO_MODULE_NAME . '/viewtopic.php?topic_id=' . $topic['id']; |
|
| 370 | + $seo_forum_url = XOOPS_URL . '/' . SEO_MODULE_NAME . '/viewforum.php?forum=' . $topic['forum_id']; |
|
| 371 | + |
|
| 372 | + if (!empty($newbbConfig['do_rewrite'])) { |
|
| 373 | + $topic['seo_topic_url'] = seo_urls($seo_topic_url); |
|
| 374 | + $topic['seo_forum_url'] = seo_urls($seo_forum_url); |
|
| 375 | + } else { |
|
| 376 | + $topic['seo_topic_url'] = $seo_topic_url; |
|
| 377 | + $topic['seo_forum_url'] = $seo_forum_url; |
|
| 378 | + } |
|
| 379 | + // END irmtfan remove hardcoded html in URLs - add $seo_topic_url |
|
| 380 | + $block['topics'][] = $topic; |
|
| 381 | + unset($topic); |
|
| 382 | + } |
|
| 383 | + // START irmtfan remove hardcoded html in URLs |
|
| 384 | + $seo_top_allforums = XOOPS_URL . '/' . SEO_MODULE_NAME; |
|
| 385 | + $block['seo_top_allforums'] = !empty($newbbConfig['do_rewrite']) ? seo_urls($seo_top_allforums) : $seo_top_allforums; |
|
| 386 | + $seo_top_allforums = XOOPS_URL . '/' . SEO_MODULE_NAME . '/list.topic.php'; |
|
| 387 | + $block['seo_top_alltopics'] = !empty($newbbConfig['do_rewrite']) ? seo_urls($seo_top_allforums) : $seo_top_allforums; |
|
| 388 | + $seo_top_allforums = XOOPS_URL . '/' . SEO_MODULE_NAME . '/viewpost.php'; |
|
| 389 | + $block['seo_top_allposts'] = !empty($newbbConfig['do_rewrite']) ? seo_urls($seo_top_allforums) : $seo_top_allforums; |
|
| 390 | + // END irmtfan remove hardcoded html in URLs |
|
| 391 | + $block['indexNav'] = (int)$options[4]; |
|
| 392 | + |
|
| 393 | + return $block; |
|
| 394 | 394 | } |
| 395 | 395 | |
| 396 | 396 | // options[0] - Citeria valid: title(by default), text |
@@ -407,155 +407,155 @@ discard block |
||
| 407 | 407 | */ |
| 408 | 408 | function b_newbb_post_show($options) |
| 409 | 409 | { |
| 410 | - global $accessForums; |
|
| 411 | - global $newbbConfig; |
|
| 412 | - |
|
| 413 | - require_once dirname(__DIR__) . '/include/functions.time.php'; |
|
| 414 | - $myts = \MyTextSanitizer::getInstance(); |
|
| 415 | - $block = []; |
|
| 416 | - $i = 0; |
|
| 417 | - $order = ''; |
|
| 418 | - $extraCriteria = ''; |
|
| 419 | - $time_criteria = null; |
|
| 420 | - if (!empty($options[2])) { |
|
| 421 | - $time_criteria = time() - newbbGetSinceTime($options[2]); |
|
| 422 | - $extraCriteria = ' AND p.post_time>' . $time_criteria; |
|
| 423 | - } |
|
| 424 | - |
|
| 425 | - switch ($options[0]) { |
|
| 426 | - case 'text': |
|
| 427 | - if (!empty($newbbConfig['enable_karma'])) { |
|
| 428 | - $extraCriteria .= ' AND p.post_karma = 0'; |
|
| 429 | - } |
|
| 430 | - if (!empty($newbbConfig['allow_require_reply'])) { |
|
| 431 | - $extraCriteria .= ' AND p.require_reply = 0'; |
|
| 432 | - } |
|
| 433 | - // no break |
|
| 434 | - default: |
|
| 435 | - $order = 'p.post_id'; |
|
| 436 | - break; |
|
| 437 | - } |
|
| 438 | - |
|
| 439 | - if (!isset($accessForums)) { |
|
| 440 | - /** var Newbb\PermissionHandler $permHandler */ |
|
| 441 | - $permHandler = Newbb\Helper::getInstance()->getHandler('Permission'); |
|
| 442 | - if (!$accessForums = $permHandler->getForums()) { |
|
| 443 | - return $block; |
|
| 444 | - } |
|
| 445 | - } |
|
| 446 | - |
|
| 447 | - $newbbConfig = newbbLoadConfig(); |
|
| 448 | - if (!empty($newbbConfig['do_rewrite'])) { |
|
| 449 | - require_once $GLOBALS['xoops']->path('modules/newbb/seo_url.php'); |
|
| 450 | - } else { |
|
| 451 | - if (!defined('SEO_MODULE_NAME')) { |
|
| 452 | - define('SEO_MODULE_NAME', 'modules/newbb'); |
|
| 453 | - } |
|
| 454 | - } |
|
| 455 | - |
|
| 456 | - if (!empty($options[6])) { |
|
| 457 | - $myallowedForums = array_filter(array_slice($options, 6), 'b_newbb_array_filter'); // get allowed forums |
|
| 458 | - $allowedForums = array_intersect($myallowedForums, $accessForums); |
|
| 459 | - } else { |
|
| 460 | - $allowedForums = $accessForums; |
|
| 461 | - } |
|
| 462 | - if (empty($allowedForums)) { |
|
| 463 | - return $block; |
|
| 464 | - } |
|
| 465 | - |
|
| 466 | - $forumCriteria = ' AND p.forum_id IN (' . implode(',', $allowedForums) . ')'; |
|
| 467 | - $approveCriteria = ' AND p.approved = 1'; |
|
| 468 | - |
|
| 469 | - $query = 'SELECT'; |
|
| 470 | - $query .= ' p.post_id, p.subject, p.post_time, p.icon, p.uid, p.poster_name,'; |
|
| 471 | - if ('text' === $options[0]) { |
|
| 472 | - $query .= ' pt.dohtml, pt.dosmiley, pt.doxcode, pt.dobr, pt.post_text,'; |
|
| 473 | - } |
|
| 474 | - $query .= ' f.forum_id, f.forum_name' . ' FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_posts') . ' AS p ' . ' LEFT JOIN ' . $GLOBALS['xoopsDB']->prefix('newbb_forums') . ' AS f ON f.forum_id=p.forum_id'; |
|
| 475 | - if ('text' === $options[0]) { |
|
| 476 | - $query .= ' LEFT JOIN ' . $GLOBALS['xoopsDB']->prefix('newbb_posts_text') . ' AS pt ON pt.post_id=p.post_id'; |
|
| 477 | - } |
|
| 478 | - $query .= ' WHERE 1=1 ' . $forumCriteria . $approveCriteria . $extraCriteria . ' ORDER BY ' . $order . ' DESC'; |
|
| 479 | - |
|
| 480 | - $result = $GLOBALS['xoopsDB']->query($query, $options[1], 0); |
|
| 481 | - if (!$result) { |
|
| 482 | - //xoops_error($GLOBALS['xoopsDB']->error()); |
|
| 483 | - return $block; |
|
| 484 | - } |
|
| 485 | - $block['disp_mode'] = ('text' === $options[0]) ? 3 : $options[3]; // 0 - full view; 1 - compact view; 2 - lite view; |
|
| 486 | - $rows = []; |
|
| 487 | - $author = []; |
|
| 488 | - while (false !== ($row = $GLOBALS['xoopsDB']->fetchArray($result))) { |
|
| 489 | - $rows[] = $row; |
|
| 490 | - $author[$row['uid']] = 1; |
|
| 491 | - } |
|
| 492 | - if (count($rows) < 1) { |
|
| 493 | - return $block; |
|
| 494 | - } |
|
| 495 | - require_once dirname(__DIR__) . '/include/functions.user.php'; |
|
| 496 | - $author_name = newbbGetUnameFromIds(array_keys($author), $newbbConfig['show_realname'], true); |
|
| 497 | - |
|
| 498 | - foreach ($rows as $arr) { |
|
| 499 | - //if ($arr['icon'] && is_file($GLOBALS['xoops']->path('images/subject/' . $arr['icon']))) { |
|
| 500 | - if (!empty($arr['icon'])) { |
|
| 501 | - $last_post_icon = '<img src="' . XOOPS_URL . '/images/subject/' . htmlspecialchars($arr['icon'], ENT_QUOTES | ENT_HTML5) . '" alt="" />'; |
|
| 502 | - } else { |
|
| 503 | - $last_post_icon = '<img src="' . XOOPS_URL . '/images/subject/icon1.gif" alt="" />'; |
|
| 504 | - } |
|
| 505 | - //$topic['jump_post'] = "<a href='" . XOOPS_URL . "/modules/newbb/viewtopic.php?post_id=" . $arr['post_id'] ."#forumpost" . $arr['post_id'] . "'>" . $last_post_icon . '</a>'; |
|
| 506 | - $topic = []; |
|
| 507 | - $topic['forum_id'] = $arr['forum_id']; |
|
| 508 | - $topic['forum_name'] = $myts->htmlSpecialChars($arr['forum_name']); |
|
| 509 | - //$topic['id'] = $arr['topic_id']; |
|
| 510 | - |
|
| 511 | - $title = $myts->htmlSpecialChars($arr['subject']); |
|
| 512 | - if ('text' !== $options[0] && !empty($options[5])) { |
|
| 513 | - $title = xoops_substr($title, 0, $options[5]); |
|
| 514 | - } |
|
| 515 | - $topic['title'] = $title; |
|
| 516 | - $topic['post_id'] = $arr['post_id']; |
|
| 517 | - $topic['time'] = newbbFormatTimestamp($arr['post_time']); |
|
| 518 | - if (!empty($author_name[$arr['uid']])) { |
|
| 519 | - $topic_poster = $author_name[$arr['uid']]; |
|
| 520 | - } else { |
|
| 521 | - $topic_poster = $myts->htmlSpecialChars($arr['poster_name'] ?: $GLOBALS['xoopsConfig']['anonymous']); |
|
| 522 | - } |
|
| 523 | - $topic['topic_poster'] = $topic_poster; |
|
| 524 | - |
|
| 525 | - if ('text' === $options[0]) { |
|
| 526 | - $post_text = $myts->displayTarea($arr['post_text'], $arr['dohtml'], $arr['dosmiley'], $arr['doxcode'], 1, $arr['dobr']); |
|
| 527 | - if (!empty($options[5])) { |
|
| 528 | - $post_text = xoops_substr(strip_tags($post_text), 0, $options[5]); |
|
| 529 | - } |
|
| 530 | - $topic['post_text'] = $post_text; |
|
| 531 | - } |
|
| 532 | - // START irmtfan remove hardcoded html in URLs |
|
| 533 | - $seo_url = XOOPS_URL . '/' . SEO_MODULE_NAME . '/viewtopic.php?post_id=' . $topic['post_id']; |
|
| 534 | - $seo_forum_url = XOOPS_URL . '/' . SEO_MODULE_NAME . '/viewforum.php?forum=' . $topic['forum_id']; |
|
| 535 | - // END irmtfan remove hardcoded html in URLs |
|
| 536 | - if (!empty($newbbConfig['do_rewrite'])) { |
|
| 537 | - $topic['seo_url'] = seo_urls($seo_url); |
|
| 538 | - $topic['seo_forum_url'] = seo_urls($seo_forum_url); |
|
| 539 | - } else { |
|
| 540 | - $topic['seo_url'] = $seo_url; |
|
| 541 | - $topic['seo_forum_url'] = $seo_forum_url; |
|
| 542 | - } |
|
| 543 | - |
|
| 544 | - $block['topics'][] = $topic; |
|
| 545 | - unset($topic); |
|
| 546 | - } |
|
| 547 | - // START irmtfan remove hardcoded html in URLs |
|
| 548 | - $seo_top_allforums = XOOPS_URL . '/' . SEO_MODULE_NAME; |
|
| 549 | - $block['seo_top_allforums'] = !empty($newbbConfig['do_rewrite']) ? seo_urls($seo_top_allforums) : $seo_top_allforums; |
|
| 550 | - $seo_top_allforums = XOOPS_URL . '/' . SEO_MODULE_NAME . '/list.topic.php'; |
|
| 551 | - $block['seo_top_alltopics'] = !empty($newbbConfig['do_rewrite']) ? seo_urls($seo_top_allforums) : $seo_top_allforums; |
|
| 552 | - $seo_top_allforums = XOOPS_URL . '/' . SEO_MODULE_NAME . '/viewpost.php'; |
|
| 553 | - $block['seo_top_allposts'] = !empty($newbbConfig['do_rewrite']) ? seo_urls($seo_top_allforums) : $seo_top_allforums; |
|
| 554 | - // END irmtfan remove hardcoded html in URLs |
|
| 555 | - |
|
| 556 | - $block['indexNav'] = (int)$options[4]; |
|
| 557 | - |
|
| 558 | - return $block; |
|
| 410 | + global $accessForums; |
|
| 411 | + global $newbbConfig; |
|
| 412 | + |
|
| 413 | + require_once dirname(__DIR__) . '/include/functions.time.php'; |
|
| 414 | + $myts = \MyTextSanitizer::getInstance(); |
|
| 415 | + $block = []; |
|
| 416 | + $i = 0; |
|
| 417 | + $order = ''; |
|
| 418 | + $extraCriteria = ''; |
|
| 419 | + $time_criteria = null; |
|
| 420 | + if (!empty($options[2])) { |
|
| 421 | + $time_criteria = time() - newbbGetSinceTime($options[2]); |
|
| 422 | + $extraCriteria = ' AND p.post_time>' . $time_criteria; |
|
| 423 | + } |
|
| 424 | + |
|
| 425 | + switch ($options[0]) { |
|
| 426 | + case 'text': |
|
| 427 | + if (!empty($newbbConfig['enable_karma'])) { |
|
| 428 | + $extraCriteria .= ' AND p.post_karma = 0'; |
|
| 429 | + } |
|
| 430 | + if (!empty($newbbConfig['allow_require_reply'])) { |
|
| 431 | + $extraCriteria .= ' AND p.require_reply = 0'; |
|
| 432 | + } |
|
| 433 | + // no break |
|
| 434 | + default: |
|
| 435 | + $order = 'p.post_id'; |
|
| 436 | + break; |
|
| 437 | + } |
|
| 438 | + |
|
| 439 | + if (!isset($accessForums)) { |
|
| 440 | + /** var Newbb\PermissionHandler $permHandler */ |
|
| 441 | + $permHandler = Newbb\Helper::getInstance()->getHandler('Permission'); |
|
| 442 | + if (!$accessForums = $permHandler->getForums()) { |
|
| 443 | + return $block; |
|
| 444 | + } |
|
| 445 | + } |
|
| 446 | + |
|
| 447 | + $newbbConfig = newbbLoadConfig(); |
|
| 448 | + if (!empty($newbbConfig['do_rewrite'])) { |
|
| 449 | + require_once $GLOBALS['xoops']->path('modules/newbb/seo_url.php'); |
|
| 450 | + } else { |
|
| 451 | + if (!defined('SEO_MODULE_NAME')) { |
|
| 452 | + define('SEO_MODULE_NAME', 'modules/newbb'); |
|
| 453 | + } |
|
| 454 | + } |
|
| 455 | + |
|
| 456 | + if (!empty($options[6])) { |
|
| 457 | + $myallowedForums = array_filter(array_slice($options, 6), 'b_newbb_array_filter'); // get allowed forums |
|
| 458 | + $allowedForums = array_intersect($myallowedForums, $accessForums); |
|
| 459 | + } else { |
|
| 460 | + $allowedForums = $accessForums; |
|
| 461 | + } |
|
| 462 | + if (empty($allowedForums)) { |
|
| 463 | + return $block; |
|
| 464 | + } |
|
| 465 | + |
|
| 466 | + $forumCriteria = ' AND p.forum_id IN (' . implode(',', $allowedForums) . ')'; |
|
| 467 | + $approveCriteria = ' AND p.approved = 1'; |
|
| 468 | + |
|
| 469 | + $query = 'SELECT'; |
|
| 470 | + $query .= ' p.post_id, p.subject, p.post_time, p.icon, p.uid, p.poster_name,'; |
|
| 471 | + if ('text' === $options[0]) { |
|
| 472 | + $query .= ' pt.dohtml, pt.dosmiley, pt.doxcode, pt.dobr, pt.post_text,'; |
|
| 473 | + } |
|
| 474 | + $query .= ' f.forum_id, f.forum_name' . ' FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_posts') . ' AS p ' . ' LEFT JOIN ' . $GLOBALS['xoopsDB']->prefix('newbb_forums') . ' AS f ON f.forum_id=p.forum_id'; |
|
| 475 | + if ('text' === $options[0]) { |
|
| 476 | + $query .= ' LEFT JOIN ' . $GLOBALS['xoopsDB']->prefix('newbb_posts_text') . ' AS pt ON pt.post_id=p.post_id'; |
|
| 477 | + } |
|
| 478 | + $query .= ' WHERE 1=1 ' . $forumCriteria . $approveCriteria . $extraCriteria . ' ORDER BY ' . $order . ' DESC'; |
|
| 479 | + |
|
| 480 | + $result = $GLOBALS['xoopsDB']->query($query, $options[1], 0); |
|
| 481 | + if (!$result) { |
|
| 482 | + //xoops_error($GLOBALS['xoopsDB']->error()); |
|
| 483 | + return $block; |
|
| 484 | + } |
|
| 485 | + $block['disp_mode'] = ('text' === $options[0]) ? 3 : $options[3]; // 0 - full view; 1 - compact view; 2 - lite view; |
|
| 486 | + $rows = []; |
|
| 487 | + $author = []; |
|
| 488 | + while (false !== ($row = $GLOBALS['xoopsDB']->fetchArray($result))) { |
|
| 489 | + $rows[] = $row; |
|
| 490 | + $author[$row['uid']] = 1; |
|
| 491 | + } |
|
| 492 | + if (count($rows) < 1) { |
|
| 493 | + return $block; |
|
| 494 | + } |
|
| 495 | + require_once dirname(__DIR__) . '/include/functions.user.php'; |
|
| 496 | + $author_name = newbbGetUnameFromIds(array_keys($author), $newbbConfig['show_realname'], true); |
|
| 497 | + |
|
| 498 | + foreach ($rows as $arr) { |
|
| 499 | + //if ($arr['icon'] && is_file($GLOBALS['xoops']->path('images/subject/' . $arr['icon']))) { |
|
| 500 | + if (!empty($arr['icon'])) { |
|
| 501 | + $last_post_icon = '<img src="' . XOOPS_URL . '/images/subject/' . htmlspecialchars($arr['icon'], ENT_QUOTES | ENT_HTML5) . '" alt="" />'; |
|
| 502 | + } else { |
|
| 503 | + $last_post_icon = '<img src="' . XOOPS_URL . '/images/subject/icon1.gif" alt="" />'; |
|
| 504 | + } |
|
| 505 | + //$topic['jump_post'] = "<a href='" . XOOPS_URL . "/modules/newbb/viewtopic.php?post_id=" . $arr['post_id'] ."#forumpost" . $arr['post_id'] . "'>" . $last_post_icon . '</a>'; |
|
| 506 | + $topic = []; |
|
| 507 | + $topic['forum_id'] = $arr['forum_id']; |
|
| 508 | + $topic['forum_name'] = $myts->htmlSpecialChars($arr['forum_name']); |
|
| 509 | + //$topic['id'] = $arr['topic_id']; |
|
| 510 | + |
|
| 511 | + $title = $myts->htmlSpecialChars($arr['subject']); |
|
| 512 | + if ('text' !== $options[0] && !empty($options[5])) { |
|
| 513 | + $title = xoops_substr($title, 0, $options[5]); |
|
| 514 | + } |
|
| 515 | + $topic['title'] = $title; |
|
| 516 | + $topic['post_id'] = $arr['post_id']; |
|
| 517 | + $topic['time'] = newbbFormatTimestamp($arr['post_time']); |
|
| 518 | + if (!empty($author_name[$arr['uid']])) { |
|
| 519 | + $topic_poster = $author_name[$arr['uid']]; |
|
| 520 | + } else { |
|
| 521 | + $topic_poster = $myts->htmlSpecialChars($arr['poster_name'] ?: $GLOBALS['xoopsConfig']['anonymous']); |
|
| 522 | + } |
|
| 523 | + $topic['topic_poster'] = $topic_poster; |
|
| 524 | + |
|
| 525 | + if ('text' === $options[0]) { |
|
| 526 | + $post_text = $myts->displayTarea($arr['post_text'], $arr['dohtml'], $arr['dosmiley'], $arr['doxcode'], 1, $arr['dobr']); |
|
| 527 | + if (!empty($options[5])) { |
|
| 528 | + $post_text = xoops_substr(strip_tags($post_text), 0, $options[5]); |
|
| 529 | + } |
|
| 530 | + $topic['post_text'] = $post_text; |
|
| 531 | + } |
|
| 532 | + // START irmtfan remove hardcoded html in URLs |
|
| 533 | + $seo_url = XOOPS_URL . '/' . SEO_MODULE_NAME . '/viewtopic.php?post_id=' . $topic['post_id']; |
|
| 534 | + $seo_forum_url = XOOPS_URL . '/' . SEO_MODULE_NAME . '/viewforum.php?forum=' . $topic['forum_id']; |
|
| 535 | + // END irmtfan remove hardcoded html in URLs |
|
| 536 | + if (!empty($newbbConfig['do_rewrite'])) { |
|
| 537 | + $topic['seo_url'] = seo_urls($seo_url); |
|
| 538 | + $topic['seo_forum_url'] = seo_urls($seo_forum_url); |
|
| 539 | + } else { |
|
| 540 | + $topic['seo_url'] = $seo_url; |
|
| 541 | + $topic['seo_forum_url'] = $seo_forum_url; |
|
| 542 | + } |
|
| 543 | + |
|
| 544 | + $block['topics'][] = $topic; |
|
| 545 | + unset($topic); |
|
| 546 | + } |
|
| 547 | + // START irmtfan remove hardcoded html in URLs |
|
| 548 | + $seo_top_allforums = XOOPS_URL . '/' . SEO_MODULE_NAME; |
|
| 549 | + $block['seo_top_allforums'] = !empty($newbbConfig['do_rewrite']) ? seo_urls($seo_top_allforums) : $seo_top_allforums; |
|
| 550 | + $seo_top_allforums = XOOPS_URL . '/' . SEO_MODULE_NAME . '/list.topic.php'; |
|
| 551 | + $block['seo_top_alltopics'] = !empty($newbbConfig['do_rewrite']) ? seo_urls($seo_top_allforums) : $seo_top_allforums; |
|
| 552 | + $seo_top_allforums = XOOPS_URL . '/' . SEO_MODULE_NAME . '/viewpost.php'; |
|
| 553 | + $block['seo_top_allposts'] = !empty($newbbConfig['do_rewrite']) ? seo_urls($seo_top_allforums) : $seo_top_allforums; |
|
| 554 | + // END irmtfan remove hardcoded html in URLs |
|
| 555 | + |
|
| 556 | + $block['indexNav'] = (int)$options[4]; |
|
| 557 | + |
|
| 558 | + return $block; |
|
| 559 | 559 | } |
| 560 | 560 | |
| 561 | 561 | // options[0] - Citeria valid: post(by default), topic, digest, sticky |
@@ -572,95 +572,95 @@ discard block |
||
| 572 | 572 | */ |
| 573 | 573 | function b_newbb_author_show($options) |
| 574 | 574 | { |
| 575 | - global $accessForums; |
|
| 576 | - global $newbbConfig; |
|
| 577 | - $myts = \MyTextSanitizer::getInstance(); |
|
| 578 | - $block = []; |
|
| 579 | - // $i = 0; |
|
| 580 | - $type = 'topic'; |
|
| 581 | - $order = 'count'; |
|
| 582 | - $extraCriteria = ''; |
|
| 583 | - $time_criteria = null; |
|
| 584 | - if (!empty($options[2])) { |
|
| 585 | - require_once dirname(__DIR__) . '/include/functions.time.php'; |
|
| 586 | - $time_criteria = time() - newbbGetSinceTime($options[2]); |
|
| 587 | - $extraCriteria = ' AND topic_time > ' . $time_criteria; |
|
| 588 | - } |
|
| 589 | - switch ($options[0]) { |
|
| 590 | - case 'topic': |
|
| 591 | - break; |
|
| 592 | - case 'digest': |
|
| 593 | - $extraCriteria = ' AND topic_digest = 1'; |
|
| 594 | - if (null !== $time_criteria) { |
|
| 595 | - $extraCriteria .= ' AND digest_time > ' . $time_criteria; |
|
| 596 | - } |
|
| 597 | - break; |
|
| 598 | - case 'sticky': |
|
| 599 | - $extraCriteria .= ' AND topic_sticky = 1'; |
|
| 600 | - break; |
|
| 601 | - case 'post': |
|
| 602 | - default: |
|
| 603 | - $type = 'post'; |
|
| 604 | - if (null !== $time_criteria) { |
|
| 605 | - $extraCriteria = ' AND post_time > ' . $time_criteria; |
|
| 606 | - } |
|
| 607 | - break; |
|
| 608 | - } |
|
| 609 | - |
|
| 610 | - if (!isset($accessForums)) { |
|
| 611 | - /** var Newbb\PermissionHandler $permHandler */ |
|
| 612 | - $permHandler = Newbb\Helper::getInstance()->getHandler('Permission'); |
|
| 613 | - if (!$accessForums = $permHandler->getForums()) { |
|
| 614 | - return $block; |
|
| 615 | - } |
|
| 616 | - } |
|
| 617 | - |
|
| 618 | - if (!empty($options[5])) { |
|
| 619 | - $myallowedForums = array_filter(array_slice($options, 5), 'b_newbb_array_filter'); // get allowed forums |
|
| 620 | - $allowedForums = array_intersect($myallowedForums, $accessForums); |
|
| 621 | - } else { |
|
| 622 | - $allowedForums = $accessForums; |
|
| 623 | - } |
|
| 624 | - if (empty($allowedForums)) { |
|
| 625 | - return false; |
|
| 626 | - } |
|
| 627 | - |
|
| 628 | - if ('topic' === $type) { |
|
| 629 | - $forumCriteria = ' AND forum_id IN (' . implode(',', $allowedForums) . ')'; |
|
| 630 | - $approveCriteria = ' AND approved = 1'; |
|
| 631 | - $query = 'SELECT DISTINCT topic_poster AS author, COUNT(*) AS count |
|
| 575 | + global $accessForums; |
|
| 576 | + global $newbbConfig; |
|
| 577 | + $myts = \MyTextSanitizer::getInstance(); |
|
| 578 | + $block = []; |
|
| 579 | + // $i = 0; |
|
| 580 | + $type = 'topic'; |
|
| 581 | + $order = 'count'; |
|
| 582 | + $extraCriteria = ''; |
|
| 583 | + $time_criteria = null; |
|
| 584 | + if (!empty($options[2])) { |
|
| 585 | + require_once dirname(__DIR__) . '/include/functions.time.php'; |
|
| 586 | + $time_criteria = time() - newbbGetSinceTime($options[2]); |
|
| 587 | + $extraCriteria = ' AND topic_time > ' . $time_criteria; |
|
| 588 | + } |
|
| 589 | + switch ($options[0]) { |
|
| 590 | + case 'topic': |
|
| 591 | + break; |
|
| 592 | + case 'digest': |
|
| 593 | + $extraCriteria = ' AND topic_digest = 1'; |
|
| 594 | + if (null !== $time_criteria) { |
|
| 595 | + $extraCriteria .= ' AND digest_time > ' . $time_criteria; |
|
| 596 | + } |
|
| 597 | + break; |
|
| 598 | + case 'sticky': |
|
| 599 | + $extraCriteria .= ' AND topic_sticky = 1'; |
|
| 600 | + break; |
|
| 601 | + case 'post': |
|
| 602 | + default: |
|
| 603 | + $type = 'post'; |
|
| 604 | + if (null !== $time_criteria) { |
|
| 605 | + $extraCriteria = ' AND post_time > ' . $time_criteria; |
|
| 606 | + } |
|
| 607 | + break; |
|
| 608 | + } |
|
| 609 | + |
|
| 610 | + if (!isset($accessForums)) { |
|
| 611 | + /** var Newbb\PermissionHandler $permHandler */ |
|
| 612 | + $permHandler = Newbb\Helper::getInstance()->getHandler('Permission'); |
|
| 613 | + if (!$accessForums = $permHandler->getForums()) { |
|
| 614 | + return $block; |
|
| 615 | + } |
|
| 616 | + } |
|
| 617 | + |
|
| 618 | + if (!empty($options[5])) { |
|
| 619 | + $myallowedForums = array_filter(array_slice($options, 5), 'b_newbb_array_filter'); // get allowed forums |
|
| 620 | + $allowedForums = array_intersect($myallowedForums, $accessForums); |
|
| 621 | + } else { |
|
| 622 | + $allowedForums = $accessForums; |
|
| 623 | + } |
|
| 624 | + if (empty($allowedForums)) { |
|
| 625 | + return false; |
|
| 626 | + } |
|
| 627 | + |
|
| 628 | + if ('topic' === $type) { |
|
| 629 | + $forumCriteria = ' AND forum_id IN (' . implode(',', $allowedForums) . ')'; |
|
| 630 | + $approveCriteria = ' AND approved = 1'; |
|
| 631 | + $query = 'SELECT DISTINCT topic_poster AS author, COUNT(*) AS count |
|
| 632 | 632 | FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_topics') . ' |
| 633 | 633 | WHERE topic_poster>0 ' . $forumCriteria . $approveCriteria . $extraCriteria . ' GROUP BY topic_poster ORDER BY ' . $order . ' DESC'; |
| 634 | - } else { |
|
| 635 | - $forumCriteria = ' AND forum_id IN (' . implode(',', $allowedForums) . ')'; |
|
| 636 | - $approveCriteria = ' AND approved = 1'; |
|
| 637 | - $query = 'SELECT DISTINCT uid AS author, COUNT(*) AS count |
|
| 634 | + } else { |
|
| 635 | + $forumCriteria = ' AND forum_id IN (' . implode(',', $allowedForums) . ')'; |
|
| 636 | + $approveCriteria = ' AND approved = 1'; |
|
| 637 | + $query = 'SELECT DISTINCT uid AS author, COUNT(*) AS count |
|
| 638 | 638 | FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_posts') . ' |
| 639 | 639 | WHERE uid > 0 ' . $forumCriteria . $approveCriteria . $extraCriteria . ' GROUP BY uid ORDER BY ' . $order . ' DESC'; |
| 640 | - } |
|
| 641 | - |
|
| 642 | - $result = $GLOBALS['xoopsDB']->query($query, $options[1], 0); |
|
| 643 | - if (!$result) { |
|
| 644 | - //xoops_error($GLOBALS['xoopsDB']->error()); |
|
| 645 | - return $block; |
|
| 646 | - } |
|
| 647 | - $author = []; |
|
| 648 | - while (false !== ($row = $GLOBALS['xoopsDB']->fetchArray($result))) { |
|
| 649 | - $author[$row['author']]['count'] = $row['count']; |
|
| 650 | - } |
|
| 651 | - if (count($author) < 1) { |
|
| 652 | - return $block; |
|
| 653 | - } |
|
| 654 | - require_once dirname(__DIR__) . '/include/functions.user.php'; |
|
| 655 | - $author_name = newbbGetUnameFromIds(array_keys($author), $newbbConfig['show_realname']); |
|
| 656 | - foreach (array_keys($author) as $uid) { |
|
| 657 | - $author[$uid]['name'] = $myts->htmlSpecialChars($author_name[$uid]); |
|
| 658 | - } |
|
| 659 | - $block['authors'] =& $author; |
|
| 660 | - $block['disp_mode'] = $options[3]; // 0 - full view; 1 - lite view; |
|
| 661 | - $block['indexNav'] = (int)$options[4]; |
|
| 662 | - |
|
| 663 | - return $block; |
|
| 640 | + } |
|
| 641 | + |
|
| 642 | + $result = $GLOBALS['xoopsDB']->query($query, $options[1], 0); |
|
| 643 | + if (!$result) { |
|
| 644 | + //xoops_error($GLOBALS['xoopsDB']->error()); |
|
| 645 | + return $block; |
|
| 646 | + } |
|
| 647 | + $author = []; |
|
| 648 | + while (false !== ($row = $GLOBALS['xoopsDB']->fetchArray($result))) { |
|
| 649 | + $author[$row['author']]['count'] = $row['count']; |
|
| 650 | + } |
|
| 651 | + if (count($author) < 1) { |
|
| 652 | + return $block; |
|
| 653 | + } |
|
| 654 | + require_once dirname(__DIR__) . '/include/functions.user.php'; |
|
| 655 | + $author_name = newbbGetUnameFromIds(array_keys($author), $newbbConfig['show_realname']); |
|
| 656 | + foreach (array_keys($author) as $uid) { |
|
| 657 | + $author[$uid]['name'] = $myts->htmlSpecialChars($author_name[$uid]); |
|
| 658 | + } |
|
| 659 | + $block['authors'] =& $author; |
|
| 660 | + $block['disp_mode'] = $options[3]; // 0 - full view; 1 - lite view; |
|
| 661 | + $block['indexNav'] = (int)$options[4]; |
|
| 662 | + |
|
| 663 | + return $block; |
|
| 664 | 664 | } |
| 665 | 665 | |
| 666 | 666 | /** |
@@ -669,58 +669,58 @@ discard block |
||
| 669 | 669 | */ |
| 670 | 670 | function b_newbb_edit($options) |
| 671 | 671 | { |
| 672 | - require_once dirname(__DIR__) . '/include/functions.forum.php'; |
|
| 673 | - |
|
| 674 | - $form = _MB_NEWBB_CRITERIA . "<select name='options[0]'>"; |
|
| 675 | - $form .= "<option value='time'"; |
|
| 676 | - if ('time' === $options[0]) { |
|
| 677 | - $form .= " selected='selected' "; |
|
| 678 | - } |
|
| 679 | - $form .= '>' . _MB_NEWBB_CRITERIA_TIME . '</option>'; |
|
| 680 | - $form .= '</select>'; |
|
| 681 | - $form .= '<br>' . _MB_NEWBB_DISPLAY . "<input type='text' name='options[1]' value='" . $options[1] . "' />"; |
|
| 682 | - $form .= '<br>' . _MB_NEWBB_TIME . "<input type='text' name='options[2]' value='" . $options[2] . "' />"; |
|
| 683 | - $form .= '<br> <small>' . _MB_NEWBB_TIME_DESC . '</small>'; |
|
| 684 | - $form .= '<br>' . _MB_NEWBB_DISPLAYMODE . "<input type='radio' name='options[3]' value='0'"; |
|
| 685 | - if (0 == $options[3]) { |
|
| 686 | - $form .= ' checked'; |
|
| 687 | - } |
|
| 688 | - $form .= ' /> ' . _MB_NEWBB_DISPLAYMODE_FULL . "<input type='radio' name='options[3]' value='1'"; |
|
| 689 | - if (1 == $options[3]) { |
|
| 690 | - $form .= ' checked'; |
|
| 691 | - } |
|
| 692 | - $form .= ' /> ' . _MB_NEWBB_DISPLAYMODE_COMPACT . "<input type='radio' name='options[3]' value='2'"; |
|
| 693 | - if (2 == $options[3]) { |
|
| 694 | - $form .= ' checked'; |
|
| 695 | - } |
|
| 696 | - $form .= ' /> ' . _MB_NEWBB_DISPLAYMODE_LITE; |
|
| 697 | - |
|
| 698 | - $form .= '<br>' . _MB_NEWBB_INDEXNAV . '<input type="radio" name="options[4]" value="1"'; |
|
| 699 | - if (1 == $options[4]) { |
|
| 700 | - $form .= ' checked'; |
|
| 701 | - } |
|
| 702 | - $form .= ' />' . _YES . '<input type="radio" name="options[4]" value="0"'; |
|
| 703 | - if (0 == $options[4]) { |
|
| 704 | - $form .= ' checked'; |
|
| 705 | - } |
|
| 706 | - $form .= ' />' . _NO; |
|
| 707 | - |
|
| 708 | - $form .= '<br>' . _MB_NEWBB_TITLE_LENGTH . "<input type='text' name='options[5]' value='" . $options[5] . "' />"; |
|
| 709 | - |
|
| 710 | - $form .= '<br><br>' . _MB_NEWBB_FORUMLIST; |
|
| 711 | - |
|
| 712 | - $optionsForum = array_filter(array_slice($options, 6), 'b_newbb_array_filter'); // get allowed forums |
|
| 713 | - $isAll = (0 === count($optionsForum) || empty($optionsForum[0])); |
|
| 714 | - $form .= '<br> <select name="options[]" multiple="multiple">'; |
|
| 715 | - $form .= '<option value="0" '; |
|
| 716 | - if ($isAll) { |
|
| 717 | - $form .= ' selected'; |
|
| 718 | - } |
|
| 719 | - $form .= '>' . _ALL . '</option>'; |
|
| 720 | - $form .= newbbForumSelectBox($optionsForum); |
|
| 721 | - $form .= '</select><br>'; |
|
| 722 | - |
|
| 723 | - return $form; |
|
| 672 | + require_once dirname(__DIR__) . '/include/functions.forum.php'; |
|
| 673 | + |
|
| 674 | + $form = _MB_NEWBB_CRITERIA . "<select name='options[0]'>"; |
|
| 675 | + $form .= "<option value='time'"; |
|
| 676 | + if ('time' === $options[0]) { |
|
| 677 | + $form .= " selected='selected' "; |
|
| 678 | + } |
|
| 679 | + $form .= '>' . _MB_NEWBB_CRITERIA_TIME . '</option>'; |
|
| 680 | + $form .= '</select>'; |
|
| 681 | + $form .= '<br>' . _MB_NEWBB_DISPLAY . "<input type='text' name='options[1]' value='" . $options[1] . "' />"; |
|
| 682 | + $form .= '<br>' . _MB_NEWBB_TIME . "<input type='text' name='options[2]' value='" . $options[2] . "' />"; |
|
| 683 | + $form .= '<br> <small>' . _MB_NEWBB_TIME_DESC . '</small>'; |
|
| 684 | + $form .= '<br>' . _MB_NEWBB_DISPLAYMODE . "<input type='radio' name='options[3]' value='0'"; |
|
| 685 | + if (0 == $options[3]) { |
|
| 686 | + $form .= ' checked'; |
|
| 687 | + } |
|
| 688 | + $form .= ' /> ' . _MB_NEWBB_DISPLAYMODE_FULL . "<input type='radio' name='options[3]' value='1'"; |
|
| 689 | + if (1 == $options[3]) { |
|
| 690 | + $form .= ' checked'; |
|
| 691 | + } |
|
| 692 | + $form .= ' /> ' . _MB_NEWBB_DISPLAYMODE_COMPACT . "<input type='radio' name='options[3]' value='2'"; |
|
| 693 | + if (2 == $options[3]) { |
|
| 694 | + $form .= ' checked'; |
|
| 695 | + } |
|
| 696 | + $form .= ' /> ' . _MB_NEWBB_DISPLAYMODE_LITE; |
|
| 697 | + |
|
| 698 | + $form .= '<br>' . _MB_NEWBB_INDEXNAV . '<input type="radio" name="options[4]" value="1"'; |
|
| 699 | + if (1 == $options[4]) { |
|
| 700 | + $form .= ' checked'; |
|
| 701 | + } |
|
| 702 | + $form .= ' />' . _YES . '<input type="radio" name="options[4]" value="0"'; |
|
| 703 | + if (0 == $options[4]) { |
|
| 704 | + $form .= ' checked'; |
|
| 705 | + } |
|
| 706 | + $form .= ' />' . _NO; |
|
| 707 | + |
|
| 708 | + $form .= '<br>' . _MB_NEWBB_TITLE_LENGTH . "<input type='text' name='options[5]' value='" . $options[5] . "' />"; |
|
| 709 | + |
|
| 710 | + $form .= '<br><br>' . _MB_NEWBB_FORUMLIST; |
|
| 711 | + |
|
| 712 | + $optionsForum = array_filter(array_slice($options, 6), 'b_newbb_array_filter'); // get allowed forums |
|
| 713 | + $isAll = (0 === count($optionsForum) || empty($optionsForum[0])); |
|
| 714 | + $form .= '<br> <select name="options[]" multiple="multiple">'; |
|
| 715 | + $form .= '<option value="0" '; |
|
| 716 | + if ($isAll) { |
|
| 717 | + $form .= ' selected'; |
|
| 718 | + } |
|
| 719 | + $form .= '>' . _ALL . '</option>'; |
|
| 720 | + $form .= newbbForumSelectBox($optionsForum); |
|
| 721 | + $form .= '</select><br>'; |
|
| 722 | + |
|
| 723 | + return $form; |
|
| 724 | 724 | } |
| 725 | 725 | |
| 726 | 726 | /** |
@@ -729,78 +729,78 @@ discard block |
||
| 729 | 729 | */ |
| 730 | 730 | function b_newbb_topic_edit($options) |
| 731 | 731 | { |
| 732 | - require_once dirname(__DIR__) . '/include/functions.forum.php'; |
|
| 733 | - $form = _MB_NEWBB_CRITERIA . "<select name='options[0]'>"; |
|
| 734 | - $form .= "<option value='time'"; |
|
| 735 | - if ('time' === $options[0]) { |
|
| 736 | - $form .= " selected='selected' "; |
|
| 737 | - } |
|
| 738 | - $form .= '>' . _MB_NEWBB_CRITERIA_TIME . '</option>'; |
|
| 739 | - $form .= "<option value='views'"; |
|
| 740 | - if ('views' === $options[0]) { |
|
| 741 | - $form .= " selected='selected' "; |
|
| 742 | - } |
|
| 743 | - $form .= '>' . _MB_NEWBB_CRITERIA_VIEWS . '</option>'; |
|
| 744 | - $form .= "<option value='replies'"; |
|
| 745 | - if ('replies' === $options[0]) { |
|
| 746 | - $form .= " selected='selected' "; |
|
| 747 | - } |
|
| 748 | - $form .= '>' . _MB_NEWBB_CRITERIA_REPLIES . '</option>'; |
|
| 749 | - $form .= "<option value='digest'"; |
|
| 750 | - if ('digest' === $options[0]) { |
|
| 751 | - $form .= " selected='selected' "; |
|
| 752 | - } |
|
| 753 | - $form .= '>' . _MB_NEWBB_CRITERIA_DIGEST . '</option>'; |
|
| 754 | - $form .= "<option value='sticky'"; |
|
| 755 | - if ('sticky' === $options[0]) { |
|
| 756 | - $form .= " selected='selected' "; |
|
| 757 | - } |
|
| 758 | - $form .= '>' . _MB_NEWBB_CRITERIA_STICKY . '</option>'; |
|
| 759 | - $form .= '</select>'; |
|
| 760 | - $form .= '<br>' . _MB_NEWBB_DISPLAY . "<input type='text' name='options[1]' value='" . $options[1] . "' />"; |
|
| 761 | - $form .= '<br>' . _MB_NEWBB_TIME . "<input type='text' name='options[2]' value='" . $options[2] . "' />"; |
|
| 762 | - $form .= '<br> <small>' . _MB_NEWBB_TIME_DESC . '</small>'; |
|
| 763 | - $form .= '<br>' . _MB_NEWBB_DISPLAYMODE . "<input type='radio' name='options[3]' value='0'"; |
|
| 764 | - if (0 == $options[3]) { |
|
| 765 | - $form .= ' checked'; |
|
| 766 | - } |
|
| 767 | - $form .= ' /> ' . _MB_NEWBB_DISPLAYMODE_FULL . "<input type='radio' name='options[3]' value='1'"; |
|
| 768 | - if (1 == $options[3]) { |
|
| 769 | - $form .= ' checked'; |
|
| 770 | - } |
|
| 771 | - $form .= ' /> ' . _MB_NEWBB_DISPLAYMODE_COMPACT . "<input type='radio' name='options[3]' value='2'"; |
|
| 772 | - if (2 == $options[3]) { |
|
| 773 | - $form .= ' checked'; |
|
| 774 | - } |
|
| 775 | - $form .= ' /> ' . _MB_NEWBB_DISPLAYMODE_LITE; |
|
| 776 | - |
|
| 777 | - $form .= '<br>' . _MB_NEWBB_INDEXNAV . '<input type="radio" name="options[4]" value="1"'; |
|
| 778 | - if (1 == $options[4]) { |
|
| 779 | - $form .= ' checked'; |
|
| 780 | - } |
|
| 781 | - $form .= ' />' . _YES . '<input type="radio" name="options[4]" value="0"'; |
|
| 782 | - if (0 == $options[4]) { |
|
| 783 | - $form .= ' checked'; |
|
| 784 | - } |
|
| 785 | - $form .= ' />' . _NO; |
|
| 786 | - |
|
| 787 | - $form .= '<br>' . _MB_NEWBB_TITLE_LENGTH . "<input type='text' name='options[5]' value='" . $options[5] . "' />"; |
|
| 788 | - |
|
| 789 | - $form .= '<br><br>' . _MB_NEWBB_FORUMLIST; |
|
| 790 | - |
|
| 791 | - $optionsForum = array_filter(array_slice($options, 6), 'b_newbb_array_filter'); // get allowed forums |
|
| 792 | - |
|
| 793 | - $isAll = (0 === count($optionsForum) || empty($optionsForum[0])); |
|
| 794 | - $form .= '<br> <select name="options[]" multiple="multiple">'; |
|
| 795 | - $form .= '<option value="0" '; |
|
| 796 | - if ($isAll) { |
|
| 797 | - $form .= ' selected="selected"'; |
|
| 798 | - } |
|
| 799 | - $form .= '>' . _ALL . '</option>'; |
|
| 800 | - $form .= newbbForumSelectBox($optionsForum); |
|
| 801 | - $form .= '</select><br>'; |
|
| 802 | - |
|
| 803 | - return $form; |
|
| 732 | + require_once dirname(__DIR__) . '/include/functions.forum.php'; |
|
| 733 | + $form = _MB_NEWBB_CRITERIA . "<select name='options[0]'>"; |
|
| 734 | + $form .= "<option value='time'"; |
|
| 735 | + if ('time' === $options[0]) { |
|
| 736 | + $form .= " selected='selected' "; |
|
| 737 | + } |
|
| 738 | + $form .= '>' . _MB_NEWBB_CRITERIA_TIME . '</option>'; |
|
| 739 | + $form .= "<option value='views'"; |
|
| 740 | + if ('views' === $options[0]) { |
|
| 741 | + $form .= " selected='selected' "; |
|
| 742 | + } |
|
| 743 | + $form .= '>' . _MB_NEWBB_CRITERIA_VIEWS . '</option>'; |
|
| 744 | + $form .= "<option value='replies'"; |
|
| 745 | + if ('replies' === $options[0]) { |
|
| 746 | + $form .= " selected='selected' "; |
|
| 747 | + } |
|
| 748 | + $form .= '>' . _MB_NEWBB_CRITERIA_REPLIES . '</option>'; |
|
| 749 | + $form .= "<option value='digest'"; |
|
| 750 | + if ('digest' === $options[0]) { |
|
| 751 | + $form .= " selected='selected' "; |
|
| 752 | + } |
|
| 753 | + $form .= '>' . _MB_NEWBB_CRITERIA_DIGEST . '</option>'; |
|
| 754 | + $form .= "<option value='sticky'"; |
|
| 755 | + if ('sticky' === $options[0]) { |
|
| 756 | + $form .= " selected='selected' "; |
|
| 757 | + } |
|
| 758 | + $form .= '>' . _MB_NEWBB_CRITERIA_STICKY . '</option>'; |
|
| 759 | + $form .= '</select>'; |
|
| 760 | + $form .= '<br>' . _MB_NEWBB_DISPLAY . "<input type='text' name='options[1]' value='" . $options[1] . "' />"; |
|
| 761 | + $form .= '<br>' . _MB_NEWBB_TIME . "<input type='text' name='options[2]' value='" . $options[2] . "' />"; |
|
| 762 | + $form .= '<br> <small>' . _MB_NEWBB_TIME_DESC . '</small>'; |
|
| 763 | + $form .= '<br>' . _MB_NEWBB_DISPLAYMODE . "<input type='radio' name='options[3]' value='0'"; |
|
| 764 | + if (0 == $options[3]) { |
|
| 765 | + $form .= ' checked'; |
|
| 766 | + } |
|
| 767 | + $form .= ' /> ' . _MB_NEWBB_DISPLAYMODE_FULL . "<input type='radio' name='options[3]' value='1'"; |
|
| 768 | + if (1 == $options[3]) { |
|
| 769 | + $form .= ' checked'; |
|
| 770 | + } |
|
| 771 | + $form .= ' /> ' . _MB_NEWBB_DISPLAYMODE_COMPACT . "<input type='radio' name='options[3]' value='2'"; |
|
| 772 | + if (2 == $options[3]) { |
|
| 773 | + $form .= ' checked'; |
|
| 774 | + } |
|
| 775 | + $form .= ' /> ' . _MB_NEWBB_DISPLAYMODE_LITE; |
|
| 776 | + |
|
| 777 | + $form .= '<br>' . _MB_NEWBB_INDEXNAV . '<input type="radio" name="options[4]" value="1"'; |
|
| 778 | + if (1 == $options[4]) { |
|
| 779 | + $form .= ' checked'; |
|
| 780 | + } |
|
| 781 | + $form .= ' />' . _YES . '<input type="radio" name="options[4]" value="0"'; |
|
| 782 | + if (0 == $options[4]) { |
|
| 783 | + $form .= ' checked'; |
|
| 784 | + } |
|
| 785 | + $form .= ' />' . _NO; |
|
| 786 | + |
|
| 787 | + $form .= '<br>' . _MB_NEWBB_TITLE_LENGTH . "<input type='text' name='options[5]' value='" . $options[5] . "' />"; |
|
| 788 | + |
|
| 789 | + $form .= '<br><br>' . _MB_NEWBB_FORUMLIST; |
|
| 790 | + |
|
| 791 | + $optionsForum = array_filter(array_slice($options, 6), 'b_newbb_array_filter'); // get allowed forums |
|
| 792 | + |
|
| 793 | + $isAll = (0 === count($optionsForum) || empty($optionsForum[0])); |
|
| 794 | + $form .= '<br> <select name="options[]" multiple="multiple">'; |
|
| 795 | + $form .= '<option value="0" '; |
|
| 796 | + if ($isAll) { |
|
| 797 | + $form .= ' selected="selected"'; |
|
| 798 | + } |
|
| 799 | + $form .= '>' . _ALL . '</option>'; |
|
| 800 | + $form .= newbbForumSelectBox($optionsForum); |
|
| 801 | + $form .= '</select><br>'; |
|
| 802 | + |
|
| 803 | + return $form; |
|
| 804 | 804 | } |
| 805 | 805 | |
| 806 | 806 | /** |
@@ -809,62 +809,62 @@ discard block |
||
| 809 | 809 | */ |
| 810 | 810 | function b_newbb_post_edit($options) |
| 811 | 811 | { |
| 812 | - require_once dirname(__DIR__) . '/include/functions.forum.php'; |
|
| 813 | - $form = _MB_NEWBB_CRITERIA . "<select name='options[0]'>"; |
|
| 814 | - $form .= "<option value='title'"; |
|
| 815 | - if ('title' === $options[0]) { |
|
| 816 | - $form .= " selected='selected' "; |
|
| 817 | - } |
|
| 818 | - $form .= '>' . _MB_NEWBB_CRITERIA_TITLE . '</option>'; |
|
| 819 | - $form .= "<option value='text'"; |
|
| 820 | - if ('text' === $options[0]) { |
|
| 821 | - $form .= " selected='selected' "; |
|
| 822 | - } |
|
| 823 | - $form .= '>' . _MB_NEWBB_CRITERIA_TEXT . '</option>'; |
|
| 824 | - $form .= '</select>'; |
|
| 825 | - $form .= '<br>' . _MB_NEWBB_DISPLAY . "<input type='text' name='options[1]' value='" . $options[1] . "' />"; |
|
| 826 | - $form .= '<br>' . _MB_NEWBB_TIME . "<input type='text' name='options[2]' value='" . $options[2] . "' />"; |
|
| 827 | - $form .= '<br> <small>' . _MB_NEWBB_TIME_DESC . '</small>'; |
|
| 828 | - $form .= '<br>' . _MB_NEWBB_DISPLAYMODE . "<input type='radio' name='options[3]' value='0'"; |
|
| 829 | - if (0 == $options[3]) { |
|
| 830 | - $form .= ' checked'; |
|
| 831 | - } |
|
| 832 | - $form .= ' /> ' . _MB_NEWBB_DISPLAYMODE_FULL . "<input type='radio' name='options[3]' value='1'"; |
|
| 833 | - if (1 == $options[3]) { |
|
| 834 | - $form .= ' checked'; |
|
| 835 | - } |
|
| 836 | - $form .= ' /> ' . _MB_NEWBB_DISPLAYMODE_COMPACT . "<input type='radio' name='options[3]' value='2'"; |
|
| 837 | - if (2 == $options[3]) { |
|
| 838 | - $form .= ' checked'; |
|
| 839 | - } |
|
| 840 | - $form .= ' /> ' . _MB_NEWBB_DISPLAYMODE_LITE; |
|
| 841 | - |
|
| 842 | - $form .= '<br>' . _MB_NEWBB_INDEXNAV . '<input type="radio" name="options[4]" value="1"'; |
|
| 843 | - if (1 == $options[4]) { |
|
| 844 | - $form .= ' checked'; |
|
| 845 | - } |
|
| 846 | - $form .= ' />' . _YES . '<input type="radio" name="options[4]" value="0"'; |
|
| 847 | - if (0 == $options[4]) { |
|
| 848 | - $form .= ' checked'; |
|
| 849 | - } |
|
| 850 | - $form .= ' />' . _NO; |
|
| 851 | - |
|
| 852 | - $form .= '<br>' . _MB_NEWBB_TITLE_LENGTH . "<input type='text' name='options[5]' value='" . $options[5] . "' />"; |
|
| 853 | - |
|
| 854 | - $form .= '<br><br>' . _MB_NEWBB_FORUMLIST; |
|
| 855 | - |
|
| 856 | - $optionsForum = array_filter(array_slice($options, 6), 'b_newbb_array_filter'); // get allowed forums |
|
| 857 | - $isAll = (0 === count($optionsForum) || empty($optionsForum[0])); |
|
| 858 | - $form .= '<br> <select name="options[]" multiple="multiple">'; |
|
| 859 | - $form .= '<option value="0" '; |
|
| 860 | - if ($isAll) { |
|
| 861 | - $form .= ' selected="selected"'; |
|
| 862 | - } |
|
| 863 | - $form .= '>' . _ALL . '</option>'; |
|
| 864 | - $form .= newbbForumSelectBox($optionsForum); |
|
| 865 | - $form .= '</select><br>'; |
|
| 866 | - |
|
| 867 | - return $form; |
|
| 812 | + require_once dirname(__DIR__) . '/include/functions.forum.php'; |
|
| 813 | + $form = _MB_NEWBB_CRITERIA . "<select name='options[0]'>"; |
|
| 814 | + $form .= "<option value='title'"; |
|
| 815 | + if ('title' === $options[0]) { |
|
| 816 | + $form .= " selected='selected' "; |
|
| 817 | + } |
|
| 818 | + $form .= '>' . _MB_NEWBB_CRITERIA_TITLE . '</option>'; |
|
| 819 | + $form .= "<option value='text'"; |
|
| 820 | + if ('text' === $options[0]) { |
|
| 821 | + $form .= " selected='selected' "; |
|
| 822 | + } |
|
| 823 | + $form .= '>' . _MB_NEWBB_CRITERIA_TEXT . '</option>'; |
|
| 824 | + $form .= '</select>'; |
|
| 825 | + $form .= '<br>' . _MB_NEWBB_DISPLAY . "<input type='text' name='options[1]' value='" . $options[1] . "' />"; |
|
| 826 | + $form .= '<br>' . _MB_NEWBB_TIME . "<input type='text' name='options[2]' value='" . $options[2] . "' />"; |
|
| 827 | + $form .= '<br> <small>' . _MB_NEWBB_TIME_DESC . '</small>'; |
|
| 828 | + $form .= '<br>' . _MB_NEWBB_DISPLAYMODE . "<input type='radio' name='options[3]' value='0'"; |
|
| 829 | + if (0 == $options[3]) { |
|
| 830 | + $form .= ' checked'; |
|
| 831 | + } |
|
| 832 | + $form .= ' /> ' . _MB_NEWBB_DISPLAYMODE_FULL . "<input type='radio' name='options[3]' value='1'"; |
|
| 833 | + if (1 == $options[3]) { |
|
| 834 | + $form .= ' checked'; |
|
| 835 | + } |
|
| 836 | + $form .= ' /> ' . _MB_NEWBB_DISPLAYMODE_COMPACT . "<input type='radio' name='options[3]' value='2'"; |
|
| 837 | + if (2 == $options[3]) { |
|
| 838 | + $form .= ' checked'; |
|
| 839 | + } |
|
| 840 | + $form .= ' /> ' . _MB_NEWBB_DISPLAYMODE_LITE; |
|
| 841 | + |
|
| 842 | + $form .= '<br>' . _MB_NEWBB_INDEXNAV . '<input type="radio" name="options[4]" value="1"'; |
|
| 843 | + if (1 == $options[4]) { |
|
| 844 | + $form .= ' checked'; |
|
| 845 | + } |
|
| 846 | + $form .= ' />' . _YES . '<input type="radio" name="options[4]" value="0"'; |
|
| 847 | + if (0 == $options[4]) { |
|
| 848 | + $form .= ' checked'; |
|
| 849 | + } |
|
| 850 | + $form .= ' />' . _NO; |
|
| 851 | + |
|
| 852 | + $form .= '<br>' . _MB_NEWBB_TITLE_LENGTH . "<input type='text' name='options[5]' value='" . $options[5] . "' />"; |
|
| 853 | + |
|
| 854 | + $form .= '<br><br>' . _MB_NEWBB_FORUMLIST; |
|
| 855 | + |
|
| 856 | + $optionsForum = array_filter(array_slice($options, 6), 'b_newbb_array_filter'); // get allowed forums |
|
| 857 | + $isAll = (0 === count($optionsForum) || empty($optionsForum[0])); |
|
| 858 | + $form .= '<br> <select name="options[]" multiple="multiple">'; |
|
| 859 | + $form .= '<option value="0" '; |
|
| 860 | + if ($isAll) { |
|
| 861 | + $form .= ' selected="selected"'; |
|
| 862 | + } |
|
| 863 | + $form .= '>' . _ALL . '</option>'; |
|
| 864 | + $form .= newbbForumSelectBox($optionsForum); |
|
| 865 | + $form .= '</select><br>'; |
|
| 866 | + |
|
| 867 | + return $form; |
|
| 868 | 868 | } |
| 869 | 869 | |
| 870 | 870 | /** |
@@ -873,66 +873,66 @@ discard block |
||
| 873 | 873 | */ |
| 874 | 874 | function b_newbb_author_edit($options) |
| 875 | 875 | { |
| 876 | - require_once dirname(__DIR__) . '/include/functions.forum.php'; |
|
| 877 | - $form = _MB_NEWBB_CRITERIA . "<select name='options[0]'>"; |
|
| 878 | - $form .= "<option value='post'"; |
|
| 879 | - if ('post' === $options[0]) { |
|
| 880 | - $form .= " selected='selected' "; |
|
| 881 | - } |
|
| 882 | - $form .= '>' . _MB_NEWBB_CRITERIA_POST . '</option>'; |
|
| 883 | - $form .= "<option value='topic'"; |
|
| 884 | - if ('topic' === $options[0]) { |
|
| 885 | - $form .= " selected='selected' "; |
|
| 886 | - } |
|
| 887 | - $form .= '>' . _MB_NEWBB_CRITERIA_TOPIC . '</option>'; |
|
| 888 | - $form .= "<option value='digest'"; |
|
| 889 | - if ('digest' === $options[0]) { |
|
| 890 | - $form .= " selected='selected' "; |
|
| 891 | - } |
|
| 892 | - $form .= '>' . _MB_NEWBB_CRITERIA_DIGESTS . '</option>'; |
|
| 893 | - $form .= "<option value='sticky'"; |
|
| 894 | - if ('sticky' === $options[0]) { |
|
| 895 | - $form .= " selected='selected' "; |
|
| 896 | - } |
|
| 897 | - $form .= '>' . _MB_NEWBB_CRITERIA_STICKYS . '</option>'; |
|
| 898 | - $form .= '</select>'; |
|
| 899 | - $form .= '<br>' . _MB_NEWBB_DISPLAY . "<input type='text' name='options[1]' value='" . $options[1] . "' />"; |
|
| 900 | - $form .= '<br>' . _MB_NEWBB_TIME . "<input type='text' name='options[2]' value='" . $options[2] . "' />"; |
|
| 901 | - $form .= '<br> <small>' . _MB_NEWBB_TIME_DESC . '</small>'; |
|
| 902 | - $form .= '<br>' . _MB_NEWBB_DISPLAYMODE . "<input type='radio' name='options[3]' value='0'"; |
|
| 903 | - if (0 == $options[3]) { |
|
| 904 | - $form .= ' checked'; |
|
| 905 | - } |
|
| 906 | - $form .= ' /> ' . _MB_NEWBB_DISPLAYMODE_COMPACT . "<input type='radio' name='options[3]' value='1'"; |
|
| 907 | - if (1 == $options[3]) { |
|
| 908 | - $form .= ' checked'; |
|
| 909 | - } |
|
| 910 | - $form .= ' /> ' . _MB_NEWBB_DISPLAYMODE_LITE; |
|
| 911 | - |
|
| 912 | - $form .= '<br>' . _MB_NEWBB_INDEXNAV . '<input type="radio" name="options[4]" value="1"'; |
|
| 913 | - if (1 == $options[4]) { |
|
| 914 | - $form .= ' checked'; |
|
| 915 | - } |
|
| 916 | - $form .= ' />' . _YES . '<input type="radio" name="options[4]" value="0"'; |
|
| 917 | - if (0 == $options[4]) { |
|
| 918 | - $form .= ' checked'; |
|
| 919 | - } |
|
| 920 | - $form .= ' />' . _NO; |
|
| 921 | - |
|
| 922 | - $form .= '<br><br>' . _MB_NEWBB_FORUMLIST; |
|
| 923 | - |
|
| 924 | - $optionsForum = array_filter(array_slice($options, 5), 'b_newbb_array_filter'); // get allowed forums |
|
| 925 | - $isAll = (0 === count($optionsForum) || empty($optionsForum[0])); |
|
| 926 | - $form .= '<br> <select name="options[]" multiple="multiple">'; |
|
| 927 | - $form .= '<option value="0" '; |
|
| 928 | - if ($isAll) { |
|
| 929 | - $form .= ' selected="selected"'; |
|
| 930 | - } |
|
| 931 | - $form .= '>' . _ALL . '</option>'; |
|
| 932 | - $form .= newbbForumSelectBox($optionsForum); |
|
| 933 | - $form .= '</select><br>'; |
|
| 934 | - |
|
| 935 | - return $form; |
|
| 876 | + require_once dirname(__DIR__) . '/include/functions.forum.php'; |
|
| 877 | + $form = _MB_NEWBB_CRITERIA . "<select name='options[0]'>"; |
|
| 878 | + $form .= "<option value='post'"; |
|
| 879 | + if ('post' === $options[0]) { |
|
| 880 | + $form .= " selected='selected' "; |
|
| 881 | + } |
|
| 882 | + $form .= '>' . _MB_NEWBB_CRITERIA_POST . '</option>'; |
|
| 883 | + $form .= "<option value='topic'"; |
|
| 884 | + if ('topic' === $options[0]) { |
|
| 885 | + $form .= " selected='selected' "; |
|
| 886 | + } |
|
| 887 | + $form .= '>' . _MB_NEWBB_CRITERIA_TOPIC . '</option>'; |
|
| 888 | + $form .= "<option value='digest'"; |
|
| 889 | + if ('digest' === $options[0]) { |
|
| 890 | + $form .= " selected='selected' "; |
|
| 891 | + } |
|
| 892 | + $form .= '>' . _MB_NEWBB_CRITERIA_DIGESTS . '</option>'; |
|
| 893 | + $form .= "<option value='sticky'"; |
|
| 894 | + if ('sticky' === $options[0]) { |
|
| 895 | + $form .= " selected='selected' "; |
|
| 896 | + } |
|
| 897 | + $form .= '>' . _MB_NEWBB_CRITERIA_STICKYS . '</option>'; |
|
| 898 | + $form .= '</select>'; |
|
| 899 | + $form .= '<br>' . _MB_NEWBB_DISPLAY . "<input type='text' name='options[1]' value='" . $options[1] . "' />"; |
|
| 900 | + $form .= '<br>' . _MB_NEWBB_TIME . "<input type='text' name='options[2]' value='" . $options[2] . "' />"; |
|
| 901 | + $form .= '<br> <small>' . _MB_NEWBB_TIME_DESC . '</small>'; |
|
| 902 | + $form .= '<br>' . _MB_NEWBB_DISPLAYMODE . "<input type='radio' name='options[3]' value='0'"; |
|
| 903 | + if (0 == $options[3]) { |
|
| 904 | + $form .= ' checked'; |
|
| 905 | + } |
|
| 906 | + $form .= ' /> ' . _MB_NEWBB_DISPLAYMODE_COMPACT . "<input type='radio' name='options[3]' value='1'"; |
|
| 907 | + if (1 == $options[3]) { |
|
| 908 | + $form .= ' checked'; |
|
| 909 | + } |
|
| 910 | + $form .= ' /> ' . _MB_NEWBB_DISPLAYMODE_LITE; |
|
| 911 | + |
|
| 912 | + $form .= '<br>' . _MB_NEWBB_INDEXNAV . '<input type="radio" name="options[4]" value="1"'; |
|
| 913 | + if (1 == $options[4]) { |
|
| 914 | + $form .= ' checked'; |
|
| 915 | + } |
|
| 916 | + $form .= ' />' . _YES . '<input type="radio" name="options[4]" value="0"'; |
|
| 917 | + if (0 == $options[4]) { |
|
| 918 | + $form .= ' checked'; |
|
| 919 | + } |
|
| 920 | + $form .= ' />' . _NO; |
|
| 921 | + |
|
| 922 | + $form .= '<br><br>' . _MB_NEWBB_FORUMLIST; |
|
| 923 | + |
|
| 924 | + $optionsForum = array_filter(array_slice($options, 5), 'b_newbb_array_filter'); // get allowed forums |
|
| 925 | + $isAll = (0 === count($optionsForum) || empty($optionsForum[0])); |
|
| 926 | + $form .= '<br> <select name="options[]" multiple="multiple">'; |
|
| 927 | + $form .= '<option value="0" '; |
|
| 928 | + if ($isAll) { |
|
| 929 | + $form .= ' selected="selected"'; |
|
| 930 | + } |
|
| 931 | + $form .= '>' . _ALL . '</option>'; |
|
| 932 | + $form .= newbbForumSelectBox($optionsForum); |
|
| 933 | + $form .= '</select><br>'; |
|
| 934 | + |
|
| 935 | + return $form; |
|
| 936 | 936 | } |
| 937 | 937 | |
| 938 | 938 | /** |
@@ -941,22 +941,22 @@ discard block |
||
| 941 | 941 | */ |
| 942 | 942 | function b_newbb_custom($options) |
| 943 | 943 | { |
| 944 | - // if no newbb module block set, we have to include the language file |
|
| 945 | - if (is_readable($GLOBALS['xoops']->path('modules/newbb/language/' . $GLOBALS['xoopsConfig']['language'] . '/blocks.php'))) { |
|
| 946 | - require_once $GLOBALS['xoops']->path('modules/newbb/language/' . $GLOBALS['xoopsConfig']['language'] . '/blocks.php'); |
|
| 947 | - } else { |
|
| 948 | - require_once $GLOBALS['xoops']->path('modules/newbb/language/english/blocks.php'); |
|
| 949 | - } |
|
| 950 | - |
|
| 951 | - $options = explode('|', $options); |
|
| 952 | - $block = b_newbb_show($options); |
|
| 953 | - if (count($block['topics']) < 1) { |
|
| 954 | - return false; |
|
| 955 | - } |
|
| 956 | - |
|
| 957 | - $tpl = new \XoopsTpl(); |
|
| 958 | - $tpl->assign('block', $block); |
|
| 959 | - $tpl->display('db:newbb_block.tpl'); |
|
| 944 | + // if no newbb module block set, we have to include the language file |
|
| 945 | + if (is_readable($GLOBALS['xoops']->path('modules/newbb/language/' . $GLOBALS['xoopsConfig']['language'] . '/blocks.php'))) { |
|
| 946 | + require_once $GLOBALS['xoops']->path('modules/newbb/language/' . $GLOBALS['xoopsConfig']['language'] . '/blocks.php'); |
|
| 947 | + } else { |
|
| 948 | + require_once $GLOBALS['xoops']->path('modules/newbb/language/english/blocks.php'); |
|
| 949 | + } |
|
| 950 | + |
|
| 951 | + $options = explode('|', $options); |
|
| 952 | + $block = b_newbb_show($options); |
|
| 953 | + if (count($block['topics']) < 1) { |
|
| 954 | + return false; |
|
| 955 | + } |
|
| 956 | + |
|
| 957 | + $tpl = new \XoopsTpl(); |
|
| 958 | + $tpl->assign('block', $block); |
|
| 959 | + $tpl->display('db:newbb_block.tpl'); |
|
| 960 | 960 | } |
| 961 | 961 | |
| 962 | 962 | /** |
@@ -965,20 +965,20 @@ discard block |
||
| 965 | 965 | */ |
| 966 | 966 | function b_newbb_custom_topic($options) |
| 967 | 967 | { |
| 968 | - /** @var \XoopsModules\Newbb\Helper $helper */ |
|
| 969 | - $helper = \XoopsModules\Newbb\Helper::getInstance(); |
|
| 970 | - // if no newbb module block set, we have to include the language file |
|
| 971 | - $helper->loadLanguage('blocks'); |
|
| 972 | - |
|
| 973 | - $options = explode('|', $options); |
|
| 974 | - $block = b_newbb_topic_show($options); |
|
| 975 | - if (count($block['topics']) < 1) { |
|
| 976 | - return false; |
|
| 977 | - } |
|
| 978 | - |
|
| 979 | - $tpl = new \XoopsTpl(); |
|
| 980 | - $tpl->assign('block', $block); |
|
| 981 | - $tpl->display('db:newbb_block_topic.tpl'); |
|
| 968 | + /** @var \XoopsModules\Newbb\Helper $helper */ |
|
| 969 | + $helper = \XoopsModules\Newbb\Helper::getInstance(); |
|
| 970 | + // if no newbb module block set, we have to include the language file |
|
| 971 | + $helper->loadLanguage('blocks'); |
|
| 972 | + |
|
| 973 | + $options = explode('|', $options); |
|
| 974 | + $block = b_newbb_topic_show($options); |
|
| 975 | + if (count($block['topics']) < 1) { |
|
| 976 | + return false; |
|
| 977 | + } |
|
| 978 | + |
|
| 979 | + $tpl = new \XoopsTpl(); |
|
| 980 | + $tpl->assign('block', $block); |
|
| 981 | + $tpl->display('db:newbb_block_topic.tpl'); |
|
| 982 | 982 | } |
| 983 | 983 | |
| 984 | 984 | /** |
@@ -987,20 +987,20 @@ discard block |
||
| 987 | 987 | */ |
| 988 | 988 | function b_newbb_custom_post($options) |
| 989 | 989 | { |
| 990 | - /** @var \XoopsModules\Newbb\Helper $helper */ |
|
| 991 | - $helper = \XoopsModules\Newbb\Helper::getInstance(); |
|
| 992 | - // if no newbb module block set, we have to include the language file |
|
| 993 | - $helper->loadLanguage('blocks'); |
|
| 994 | - |
|
| 995 | - $options = explode('|', $options); |
|
| 996 | - $block = b_newbb_post_show($options); |
|
| 997 | - if (count($block['topics']) < 1) { |
|
| 998 | - return false; |
|
| 999 | - } |
|
| 1000 | - |
|
| 1001 | - $tpl = new \XoopsTpl(); |
|
| 1002 | - $tpl->assign('block', $block); |
|
| 1003 | - $tpl->display('db:newbb_block_post.tpl'); |
|
| 990 | + /** @var \XoopsModules\Newbb\Helper $helper */ |
|
| 991 | + $helper = \XoopsModules\Newbb\Helper::getInstance(); |
|
| 992 | + // if no newbb module block set, we have to include the language file |
|
| 993 | + $helper->loadLanguage('blocks'); |
|
| 994 | + |
|
| 995 | + $options = explode('|', $options); |
|
| 996 | + $block = b_newbb_post_show($options); |
|
| 997 | + if (count($block['topics']) < 1) { |
|
| 998 | + return false; |
|
| 999 | + } |
|
| 1000 | + |
|
| 1001 | + $tpl = new \XoopsTpl(); |
|
| 1002 | + $tpl->assign('block', $block); |
|
| 1003 | + $tpl->display('db:newbb_block_post.tpl'); |
|
| 1004 | 1004 | } |
| 1005 | 1005 | |
| 1006 | 1006 | /** |
@@ -1009,20 +1009,20 @@ discard block |
||
| 1009 | 1009 | */ |
| 1010 | 1010 | function b_newbb_custom_author($options) |
| 1011 | 1011 | { |
| 1012 | - /** @var \XoopsModules\Newbb\Helper $helper */ |
|
| 1013 | - $helper = \XoopsModules\Newbb\Helper::getInstance(); |
|
| 1014 | - // if no newbb module block set, we have to include the language file |
|
| 1015 | - $helper->loadLanguage('blocks'); |
|
| 1016 | - |
|
| 1017 | - $options = explode('|', $options); |
|
| 1018 | - $block = b_newbb_author_show($options); |
|
| 1019 | - if (count($block['authors']) < 1) { |
|
| 1020 | - return false; |
|
| 1021 | - } |
|
| 1022 | - |
|
| 1023 | - $tpl = new \XoopsTpl(); |
|
| 1024 | - $tpl->assign('block', $block); |
|
| 1025 | - $tpl->display('db:newbb_block_author.tpl'); |
|
| 1012 | + /** @var \XoopsModules\Newbb\Helper $helper */ |
|
| 1013 | + $helper = \XoopsModules\Newbb\Helper::getInstance(); |
|
| 1014 | + // if no newbb module block set, we have to include the language file |
|
| 1015 | + $helper->loadLanguage('blocks'); |
|
| 1016 | + |
|
| 1017 | + $options = explode('|', $options); |
|
| 1018 | + $block = b_newbb_author_show($options); |
|
| 1019 | + if (count($block['authors']) < 1) { |
|
| 1020 | + return false; |
|
| 1021 | + } |
|
| 1022 | + |
|
| 1023 | + $tpl = new \XoopsTpl(); |
|
| 1024 | + $tpl->assign('block', $block); |
|
| 1025 | + $tpl->display('db:newbb_block_author.tpl'); |
|
| 1026 | 1026 | } |
| 1027 | 1027 | |
| 1028 | 1028 | // irmtfan add local stylesheet and js footer.php |
@@ -56,8 +56,8 @@ discard block |
||
| 56 | 56 | global $accessForums; |
| 57 | 57 | global $xoopsLogger; |
| 58 | 58 | |
| 59 | - require_once dirname(__DIR__) . '/include/functions.config.php'; |
|
| 60 | - require_once dirname(__DIR__) . '/include/functions.time.php'; |
|
| 59 | + require_once dirname(__DIR__).'/include/functions.config.php'; |
|
| 60 | + require_once dirname(__DIR__).'/include/functions.time.php'; |
|
| 61 | 61 | |
| 62 | 62 | $myts = \MyTextSanitizer::getInstance(); |
| 63 | 63 | $block = []; |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | $extraCriteria = ''; |
| 67 | 67 | if (!empty($options[2])) { |
| 68 | 68 | //require_once dirname(__DIR__) . '/include/functions.time.php'; |
| 69 | - $extraCriteria .= ' AND p.post_time>' . (time() - newbbGetSinceTime($options[2])); |
|
| 69 | + $extraCriteria .= ' AND p.post_time>'.(time() - newbbGetSinceTime($options[2])); |
|
| 70 | 70 | } |
| 71 | 71 | switch ($options[0]) { |
| 72 | 72 | case 'time': |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | return $block; |
| 93 | 93 | } |
| 94 | 94 | |
| 95 | - $forumCriteria = ' AND t.forum_id IN (' . implode(',', $allowedForums) . ')'; |
|
| 95 | + $forumCriteria = ' AND t.forum_id IN ('.implode(',', $allowedForums).')'; |
|
| 96 | 96 | $approveCriteria = ' AND t.approved = 1'; |
| 97 | 97 | |
| 98 | 98 | $newbbConfig = newbbLoadConfig(); |
@@ -148,13 +148,13 @@ discard block |
||
| 148 | 148 | return $block; |
| 149 | 149 | } |
| 150 | 150 | |
| 151 | - require_once dirname(__DIR__) . '/include/functions.user.php'; |
|
| 151 | + require_once dirname(__DIR__).'/include/functions.user.php'; |
|
| 152 | 152 | $author_name = newbbGetUnameFromIds(array_keys($author), $newbbConfig['show_realname'], true); |
| 153 | 153 | |
| 154 | 154 | if (count($types) > 0) { |
| 155 | 155 | /** @var Newbb\TypeHandler $typeHandler */ |
| 156 | 156 | $typeHandler = Newbb\Helper::getInstance()->getHandler('Type'); |
| 157 | - $type_list = $typeHandler->getList(new \Criteria('type_id', '(' . implode(', ', array_keys($types)) . ')', 'IN')); |
|
| 157 | + $type_list = $typeHandler->getList(new \Criteria('type_id', '('.implode(', ', array_keys($types)).')', 'IN')); |
|
| 158 | 158 | } |
| 159 | 159 | |
| 160 | 160 | foreach ($rows as $arr) { |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | xoops_loadLanguage('main', 'newbb'); |
| 163 | 163 | $topic = []; |
| 164 | 164 | $topic_page_jump = newbbDisplayImage('lastposticon', _MD_NEWBB_GOTOLASTPOST); |
| 165 | - $topic['topic_subject'] = empty($type_list[$arr['type_id']]) ? '' : '[' . $type_list[$arr['type_id']] . ']'; |
|
| 165 | + $topic['topic_subject'] = empty($type_list[$arr['type_id']]) ? '' : '['.$type_list[$arr['type_id']].']'; |
|
| 166 | 166 | |
| 167 | 167 | $topic['post_id'] = $arr['post_id']; |
| 168 | 168 | $topic['topic_status'] = $arr['topic_status']; |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | if (!empty($options[5])) { |
| 175 | 175 | $title = xoops_substr($title, 0, $options[5]); |
| 176 | 176 | } |
| 177 | - $topic['title'] = $topic['topic_subject'] . ' ' . $title; |
|
| 177 | + $topic['title'] = $topic['topic_subject'].' '.$title; |
|
| 178 | 178 | $topic['replies'] = $arr['topic_replies']; |
| 179 | 179 | $topic['views'] = $arr['topic_views']; |
| 180 | 180 | $topic['time'] = newbbFormatTimestamp($arr['post_time']); |
@@ -186,9 +186,9 @@ discard block |
||
| 186 | 186 | $topic['topic_poster'] = $topic_poster; |
| 187 | 187 | $topic['topic_page_jump'] = $topic_page_jump; |
| 188 | 188 | // START irmtfan remove hardcoded html in URLs - add $seo_topic_url |
| 189 | - $seo_url = XOOPS_URL . '/' . SEO_MODULE_NAME . '/viewtopic.php?post_id=' . $topic['post_id']; |
|
| 190 | - $seo_topic_url = XOOPS_URL . '/' . SEO_MODULE_NAME . '/viewtopic.php?topic_id=' . $topic['id']; |
|
| 191 | - $seo_forum_url = XOOPS_URL . '/' . SEO_MODULE_NAME . '/viewforum.php?forum=' . $topic['forum_id']; |
|
| 189 | + $seo_url = XOOPS_URL.'/'.SEO_MODULE_NAME.'/viewtopic.php?post_id='.$topic['post_id']; |
|
| 190 | + $seo_topic_url = XOOPS_URL.'/'.SEO_MODULE_NAME.'/viewtopic.php?topic_id='.$topic['id']; |
|
| 191 | + $seo_forum_url = XOOPS_URL.'/'.SEO_MODULE_NAME.'/viewforum.php?forum='.$topic['forum_id']; |
|
| 192 | 192 | if (!empty($newbbConfig['do_rewrite'])) { |
| 193 | 193 | $topic['seo_url'] = seo_urls($seo_url); |
| 194 | 194 | $topic['seo_topic_url'] = seo_urls($seo_topic_url); |
@@ -203,11 +203,11 @@ discard block |
||
| 203 | 203 | unset($topic); |
| 204 | 204 | } |
| 205 | 205 | // START irmtfan remove hardcoded html in URLs |
| 206 | - $seo_top_allforums = XOOPS_URL . '/' . SEO_MODULE_NAME; |
|
| 206 | + $seo_top_allforums = XOOPS_URL.'/'.SEO_MODULE_NAME; |
|
| 207 | 207 | $block['seo_top_allforums'] = !empty($newbbConfig['do_rewrite']) ? seo_urls($seo_top_allforums) : $seo_top_allforums; |
| 208 | - $seo_top_allforums = XOOPS_URL . '/' . SEO_MODULE_NAME . '/list.topic.php'; |
|
| 208 | + $seo_top_allforums = XOOPS_URL.'/'.SEO_MODULE_NAME.'/list.topic.php'; |
|
| 209 | 209 | $block['seo_top_alltopics'] = !empty($newbbConfig['do_rewrite']) ? seo_urls($seo_top_allforums) : $seo_top_allforums; |
| 210 | - $seo_top_allforums = XOOPS_URL . '/' . SEO_MODULE_NAME . '/viewpost.php'; |
|
| 210 | + $seo_top_allforums = XOOPS_URL.'/'.SEO_MODULE_NAME.'/viewpost.php'; |
|
| 211 | 211 | $block['seo_top_allposts'] = !empty($newbbConfig['do_rewrite']) ? seo_urls($seo_top_allforums) : $seo_top_allforums; |
| 212 | 212 | // END irmtfan remove hardcoded html in URLs |
| 213 | 213 | $block['indexNav'] = (int)$options[4]; |
@@ -230,7 +230,7 @@ discard block |
||
| 230 | 230 | function b_newbb_topic_show($options) |
| 231 | 231 | { |
| 232 | 232 | global $accessForums; |
| 233 | - require_once dirname(__DIR__) . '/include/functions.time.php'; |
|
| 233 | + require_once dirname(__DIR__).'/include/functions.time.php'; |
|
| 234 | 234 | $myts = \MyTextSanitizer::getInstance(); |
| 235 | 235 | $block = []; |
| 236 | 236 | $i = 0; |
@@ -239,7 +239,7 @@ discard block |
||
| 239 | 239 | $time_criteria = null; |
| 240 | 240 | if (!empty($options[2])) { |
| 241 | 241 | $time_criteria = time() - newbbGetSinceTime($options[2]); |
| 242 | - $extraCriteria = ' AND t.topic_time>' . $time_criteria; |
|
| 242 | + $extraCriteria = ' AND t.topic_time>'.$time_criteria; |
|
| 243 | 243 | } |
| 244 | 244 | switch ($options[0]) { |
| 245 | 245 | case 'views': |
@@ -252,11 +252,11 @@ discard block |
||
| 252 | 252 | $order = 't.digest_time'; |
| 253 | 253 | $extraCriteria = ' AND t.topic_digest=1'; |
| 254 | 254 | if (null !== $time_criteria) { |
| 255 | - $extraCriteria .= ' AND t.digest_time>' . $time_criteria; |
|
| 255 | + $extraCriteria .= ' AND t.digest_time>'.$time_criteria; |
|
| 256 | 256 | } |
| 257 | 257 | break; |
| 258 | 258 | case 'sticky': |
| 259 | - $order = 't.topic_id'; |
|
| 259 | + $order = 't.topic_id'; |
|
| 260 | 260 | $extraCriteria .= ' AND t.topic_sticky=1'; |
| 261 | 261 | break; |
| 262 | 262 | case 'time': |
@@ -292,7 +292,7 @@ discard block |
||
| 292 | 292 | return false; |
| 293 | 293 | } |
| 294 | 294 | |
| 295 | - $forumCriteria = ' AND t.forum_id IN (' . implode(',', $allowedForums) . ')'; |
|
| 295 | + $forumCriteria = ' AND t.forum_id IN ('.implode(',', $allowedForums).')'; |
|
| 296 | 296 | $approveCriteria = ' AND t.approved = 1'; |
| 297 | 297 | |
| 298 | 298 | $query = 'SELECT' |
@@ -332,19 +332,19 @@ discard block |
||
| 332 | 332 | if (count($rows) < 1) { |
| 333 | 333 | return $block; |
| 334 | 334 | } |
| 335 | - require_once dirname(__DIR__) . '/include/functions.user.php'; |
|
| 335 | + require_once dirname(__DIR__).'/include/functions.user.php'; |
|
| 336 | 336 | $author_name = newbbGetUnameFromIds(array_keys($author), $newbbConfig['show_realname'], true); |
| 337 | 337 | if (count($types) > 0) { |
| 338 | 338 | /** @var Newbb\TypeHandler $typeHandler */ |
| 339 | 339 | $typeHandler = Newbb\Helper::getInstance()->getHandler('Type'); |
| 340 | - $type_list = $typeHandler->getList(new \Criteria('type_id', '(' . implode(', ', array_keys($types)) . ')', 'IN')); |
|
| 340 | + $type_list = $typeHandler->getList(new \Criteria('type_id', '('.implode(', ', array_keys($types)).')', 'IN')); |
|
| 341 | 341 | } |
| 342 | 342 | |
| 343 | 343 | foreach ($rows as $arr) { |
| 344 | 344 | // irmtfan remove $topic_page_jump because there is no last post |
| 345 | 345 | //$topic_page_jump = ''; |
| 346 | 346 | $topic = []; |
| 347 | - $topic['topic_subject'] = empty($type_list[$arr['type_id']]) ? '' : '[' . $type_list[$arr['type_id']] . '] '; |
|
| 347 | + $topic['topic_subject'] = empty($type_list[$arr['type_id']]) ? '' : '['.$type_list[$arr['type_id']].'] '; |
|
| 348 | 348 | $topic['forum_id'] = $arr['forum_id']; |
| 349 | 349 | $topic['forum_name'] = $myts->htmlSpecialChars($arr['forum_name']); |
| 350 | 350 | $topic['id'] = $arr['topic_id']; |
@@ -353,7 +353,7 @@ discard block |
||
| 353 | 353 | if (!empty($options[5])) { |
| 354 | 354 | $title = xoops_substr($title, 0, $options[5]); |
| 355 | 355 | } |
| 356 | - $topic['title'] = $topic['topic_subject'] . $title; |
|
| 356 | + $topic['title'] = $topic['topic_subject'].$title; |
|
| 357 | 357 | $topic['replies'] = $arr['topic_replies']; |
| 358 | 358 | $topic['views'] = $arr['topic_views']; |
| 359 | 359 | $topic['time'] = newbbFormatTimestamp($arr['topic_time']); |
@@ -366,8 +366,8 @@ discard block |
||
| 366 | 366 | // irmtfan remove $topic_page_jump because there is no last post |
| 367 | 367 | //$topic['topic_page_jump'] = $topic_page_jump; |
| 368 | 368 | // START irmtfan remove hardcoded html in URLs - add $seo_topic_url |
| 369 | - $seo_topic_url = XOOPS_URL . '/' . SEO_MODULE_NAME . '/viewtopic.php?topic_id=' . $topic['id']; |
|
| 370 | - $seo_forum_url = XOOPS_URL . '/' . SEO_MODULE_NAME . '/viewforum.php?forum=' . $topic['forum_id']; |
|
| 369 | + $seo_topic_url = XOOPS_URL.'/'.SEO_MODULE_NAME.'/viewtopic.php?topic_id='.$topic['id']; |
|
| 370 | + $seo_forum_url = XOOPS_URL.'/'.SEO_MODULE_NAME.'/viewforum.php?forum='.$topic['forum_id']; |
|
| 371 | 371 | |
| 372 | 372 | if (!empty($newbbConfig['do_rewrite'])) { |
| 373 | 373 | $topic['seo_topic_url'] = seo_urls($seo_topic_url); |
@@ -381,11 +381,11 @@ discard block |
||
| 381 | 381 | unset($topic); |
| 382 | 382 | } |
| 383 | 383 | // START irmtfan remove hardcoded html in URLs |
| 384 | - $seo_top_allforums = XOOPS_URL . '/' . SEO_MODULE_NAME; |
|
| 384 | + $seo_top_allforums = XOOPS_URL.'/'.SEO_MODULE_NAME; |
|
| 385 | 385 | $block['seo_top_allforums'] = !empty($newbbConfig['do_rewrite']) ? seo_urls($seo_top_allforums) : $seo_top_allforums; |
| 386 | - $seo_top_allforums = XOOPS_URL . '/' . SEO_MODULE_NAME . '/list.topic.php'; |
|
| 386 | + $seo_top_allforums = XOOPS_URL.'/'.SEO_MODULE_NAME.'/list.topic.php'; |
|
| 387 | 387 | $block['seo_top_alltopics'] = !empty($newbbConfig['do_rewrite']) ? seo_urls($seo_top_allforums) : $seo_top_allforums; |
| 388 | - $seo_top_allforums = XOOPS_URL . '/' . SEO_MODULE_NAME . '/viewpost.php'; |
|
| 388 | + $seo_top_allforums = XOOPS_URL.'/'.SEO_MODULE_NAME.'/viewpost.php'; |
|
| 389 | 389 | $block['seo_top_allposts'] = !empty($newbbConfig['do_rewrite']) ? seo_urls($seo_top_allforums) : $seo_top_allforums; |
| 390 | 390 | // END irmtfan remove hardcoded html in URLs |
| 391 | 391 | $block['indexNav'] = (int)$options[4]; |
@@ -410,7 +410,7 @@ discard block |
||
| 410 | 410 | global $accessForums; |
| 411 | 411 | global $newbbConfig; |
| 412 | 412 | |
| 413 | - require_once dirname(__DIR__) . '/include/functions.time.php'; |
|
| 413 | + require_once dirname(__DIR__).'/include/functions.time.php'; |
|
| 414 | 414 | $myts = \MyTextSanitizer::getInstance(); |
| 415 | 415 | $block = []; |
| 416 | 416 | $i = 0; |
@@ -419,7 +419,7 @@ discard block |
||
| 419 | 419 | $time_criteria = null; |
| 420 | 420 | if (!empty($options[2])) { |
| 421 | 421 | $time_criteria = time() - newbbGetSinceTime($options[2]); |
| 422 | - $extraCriteria = ' AND p.post_time>' . $time_criteria; |
|
| 422 | + $extraCriteria = ' AND p.post_time>'.$time_criteria; |
|
| 423 | 423 | } |
| 424 | 424 | |
| 425 | 425 | switch ($options[0]) { |
@@ -463,7 +463,7 @@ discard block |
||
| 463 | 463 | return $block; |
| 464 | 464 | } |
| 465 | 465 | |
| 466 | - $forumCriteria = ' AND p.forum_id IN (' . implode(',', $allowedForums) . ')'; |
|
| 466 | + $forumCriteria = ' AND p.forum_id IN ('.implode(',', $allowedForums).')'; |
|
| 467 | 467 | $approveCriteria = ' AND p.approved = 1'; |
| 468 | 468 | |
| 469 | 469 | $query = 'SELECT'; |
@@ -471,11 +471,11 @@ discard block |
||
| 471 | 471 | if ('text' === $options[0]) { |
| 472 | 472 | $query .= ' pt.dohtml, pt.dosmiley, pt.doxcode, pt.dobr, pt.post_text,'; |
| 473 | 473 | } |
| 474 | - $query .= ' f.forum_id, f.forum_name' . ' FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_posts') . ' AS p ' . ' LEFT JOIN ' . $GLOBALS['xoopsDB']->prefix('newbb_forums') . ' AS f ON f.forum_id=p.forum_id'; |
|
| 474 | + $query .= ' f.forum_id, f.forum_name'.' FROM '.$GLOBALS['xoopsDB']->prefix('newbb_posts').' AS p '.' LEFT JOIN '.$GLOBALS['xoopsDB']->prefix('newbb_forums').' AS f ON f.forum_id=p.forum_id'; |
|
| 475 | 475 | if ('text' === $options[0]) { |
| 476 | - $query .= ' LEFT JOIN ' . $GLOBALS['xoopsDB']->prefix('newbb_posts_text') . ' AS pt ON pt.post_id=p.post_id'; |
|
| 476 | + $query .= ' LEFT JOIN '.$GLOBALS['xoopsDB']->prefix('newbb_posts_text').' AS pt ON pt.post_id=p.post_id'; |
|
| 477 | 477 | } |
| 478 | - $query .= ' WHERE 1=1 ' . $forumCriteria . $approveCriteria . $extraCriteria . ' ORDER BY ' . $order . ' DESC'; |
|
| 478 | + $query .= ' WHERE 1=1 '.$forumCriteria.$approveCriteria.$extraCriteria.' ORDER BY '.$order.' DESC'; |
|
| 479 | 479 | |
| 480 | 480 | $result = $GLOBALS['xoopsDB']->query($query, $options[1], 0); |
| 481 | 481 | if (!$result) { |
@@ -492,15 +492,15 @@ discard block |
||
| 492 | 492 | if (count($rows) < 1) { |
| 493 | 493 | return $block; |
| 494 | 494 | } |
| 495 | - require_once dirname(__DIR__) . '/include/functions.user.php'; |
|
| 495 | + require_once dirname(__DIR__).'/include/functions.user.php'; |
|
| 496 | 496 | $author_name = newbbGetUnameFromIds(array_keys($author), $newbbConfig['show_realname'], true); |
| 497 | 497 | |
| 498 | 498 | foreach ($rows as $arr) { |
| 499 | 499 | //if ($arr['icon'] && is_file($GLOBALS['xoops']->path('images/subject/' . $arr['icon']))) { |
| 500 | 500 | if (!empty($arr['icon'])) { |
| 501 | - $last_post_icon = '<img src="' . XOOPS_URL . '/images/subject/' . htmlspecialchars($arr['icon'], ENT_QUOTES | ENT_HTML5) . '" alt="" />'; |
|
| 501 | + $last_post_icon = '<img src="'.XOOPS_URL.'/images/subject/'.htmlspecialchars($arr['icon'], ENT_QUOTES | ENT_HTML5).'" alt="" />'; |
|
| 502 | 502 | } else { |
| 503 | - $last_post_icon = '<img src="' . XOOPS_URL . '/images/subject/icon1.gif" alt="" />'; |
|
| 503 | + $last_post_icon = '<img src="'.XOOPS_URL.'/images/subject/icon1.gif" alt="" />'; |
|
| 504 | 504 | } |
| 505 | 505 | //$topic['jump_post'] = "<a href='" . XOOPS_URL . "/modules/newbb/viewtopic.php?post_id=" . $arr['post_id'] ."#forumpost" . $arr['post_id'] . "'>" . $last_post_icon . '</a>'; |
| 506 | 506 | $topic = []; |
@@ -530,8 +530,8 @@ discard block |
||
| 530 | 530 | $topic['post_text'] = $post_text; |
| 531 | 531 | } |
| 532 | 532 | // START irmtfan remove hardcoded html in URLs |
| 533 | - $seo_url = XOOPS_URL . '/' . SEO_MODULE_NAME . '/viewtopic.php?post_id=' . $topic['post_id']; |
|
| 534 | - $seo_forum_url = XOOPS_URL . '/' . SEO_MODULE_NAME . '/viewforum.php?forum=' . $topic['forum_id']; |
|
| 533 | + $seo_url = XOOPS_URL.'/'.SEO_MODULE_NAME.'/viewtopic.php?post_id='.$topic['post_id']; |
|
| 534 | + $seo_forum_url = XOOPS_URL.'/'.SEO_MODULE_NAME.'/viewforum.php?forum='.$topic['forum_id']; |
|
| 535 | 535 | // END irmtfan remove hardcoded html in URLs |
| 536 | 536 | if (!empty($newbbConfig['do_rewrite'])) { |
| 537 | 537 | $topic['seo_url'] = seo_urls($seo_url); |
@@ -545,11 +545,11 @@ discard block |
||
| 545 | 545 | unset($topic); |
| 546 | 546 | } |
| 547 | 547 | // START irmtfan remove hardcoded html in URLs |
| 548 | - $seo_top_allforums = XOOPS_URL . '/' . SEO_MODULE_NAME; |
|
| 548 | + $seo_top_allforums = XOOPS_URL.'/'.SEO_MODULE_NAME; |
|
| 549 | 549 | $block['seo_top_allforums'] = !empty($newbbConfig['do_rewrite']) ? seo_urls($seo_top_allforums) : $seo_top_allforums; |
| 550 | - $seo_top_allforums = XOOPS_URL . '/' . SEO_MODULE_NAME . '/list.topic.php'; |
|
| 550 | + $seo_top_allforums = XOOPS_URL.'/'.SEO_MODULE_NAME.'/list.topic.php'; |
|
| 551 | 551 | $block['seo_top_alltopics'] = !empty($newbbConfig['do_rewrite']) ? seo_urls($seo_top_allforums) : $seo_top_allforums; |
| 552 | - $seo_top_allforums = XOOPS_URL . '/' . SEO_MODULE_NAME . '/viewpost.php'; |
|
| 552 | + $seo_top_allforums = XOOPS_URL.'/'.SEO_MODULE_NAME.'/viewpost.php'; |
|
| 553 | 553 | $block['seo_top_allposts'] = !empty($newbbConfig['do_rewrite']) ? seo_urls($seo_top_allforums) : $seo_top_allforums; |
| 554 | 554 | // END irmtfan remove hardcoded html in URLs |
| 555 | 555 | |
@@ -582,9 +582,9 @@ discard block |
||
| 582 | 582 | $extraCriteria = ''; |
| 583 | 583 | $time_criteria = null; |
| 584 | 584 | if (!empty($options[2])) { |
| 585 | - require_once dirname(__DIR__) . '/include/functions.time.php'; |
|
| 585 | + require_once dirname(__DIR__).'/include/functions.time.php'; |
|
| 586 | 586 | $time_criteria = time() - newbbGetSinceTime($options[2]); |
| 587 | - $extraCriteria = ' AND topic_time > ' . $time_criteria; |
|
| 587 | + $extraCriteria = ' AND topic_time > '.$time_criteria; |
|
| 588 | 588 | } |
| 589 | 589 | switch ($options[0]) { |
| 590 | 590 | case 'topic': |
@@ -592,7 +592,7 @@ discard block |
||
| 592 | 592 | case 'digest': |
| 593 | 593 | $extraCriteria = ' AND topic_digest = 1'; |
| 594 | 594 | if (null !== $time_criteria) { |
| 595 | - $extraCriteria .= ' AND digest_time > ' . $time_criteria; |
|
| 595 | + $extraCriteria .= ' AND digest_time > '.$time_criteria; |
|
| 596 | 596 | } |
| 597 | 597 | break; |
| 598 | 598 | case 'sticky': |
@@ -602,7 +602,7 @@ discard block |
||
| 602 | 602 | default: |
| 603 | 603 | $type = 'post'; |
| 604 | 604 | if (null !== $time_criteria) { |
| 605 | - $extraCriteria = ' AND post_time > ' . $time_criteria; |
|
| 605 | + $extraCriteria = ' AND post_time > '.$time_criteria; |
|
| 606 | 606 | } |
| 607 | 607 | break; |
| 608 | 608 | } |
@@ -626,17 +626,17 @@ discard block |
||
| 626 | 626 | } |
| 627 | 627 | |
| 628 | 628 | if ('topic' === $type) { |
| 629 | - $forumCriteria = ' AND forum_id IN (' . implode(',', $allowedForums) . ')'; |
|
| 629 | + $forumCriteria = ' AND forum_id IN ('.implode(',', $allowedForums).')'; |
|
| 630 | 630 | $approveCriteria = ' AND approved = 1'; |
| 631 | 631 | $query = 'SELECT DISTINCT topic_poster AS author, COUNT(*) AS count |
| 632 | - FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_topics') . ' |
|
| 633 | - WHERE topic_poster>0 ' . $forumCriteria . $approveCriteria . $extraCriteria . ' GROUP BY topic_poster ORDER BY ' . $order . ' DESC'; |
|
| 632 | + FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_topics').' |
|
| 633 | + WHERE topic_poster>0 ' . $forumCriteria.$approveCriteria.$extraCriteria.' GROUP BY topic_poster ORDER BY '.$order.' DESC'; |
|
| 634 | 634 | } else { |
| 635 | - $forumCriteria = ' AND forum_id IN (' . implode(',', $allowedForums) . ')'; |
|
| 635 | + $forumCriteria = ' AND forum_id IN ('.implode(',', $allowedForums).')'; |
|
| 636 | 636 | $approveCriteria = ' AND approved = 1'; |
| 637 | 637 | $query = 'SELECT DISTINCT uid AS author, COUNT(*) AS count |
| 638 | - FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_posts') . ' |
|
| 639 | - WHERE uid > 0 ' . $forumCriteria . $approveCriteria . $extraCriteria . ' GROUP BY uid ORDER BY ' . $order . ' DESC'; |
|
| 638 | + FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_posts').' |
|
| 639 | + WHERE uid > 0 ' . $forumCriteria.$approveCriteria.$extraCriteria.' GROUP BY uid ORDER BY '.$order.' DESC'; |
|
| 640 | 640 | } |
| 641 | 641 | |
| 642 | 642 | $result = $GLOBALS['xoopsDB']->query($query, $options[1], 0); |
@@ -651,12 +651,12 @@ discard block |
||
| 651 | 651 | if (count($author) < 1) { |
| 652 | 652 | return $block; |
| 653 | 653 | } |
| 654 | - require_once dirname(__DIR__) . '/include/functions.user.php'; |
|
| 654 | + require_once dirname(__DIR__).'/include/functions.user.php'; |
|
| 655 | 655 | $author_name = newbbGetUnameFromIds(array_keys($author), $newbbConfig['show_realname']); |
| 656 | 656 | foreach (array_keys($author) as $uid) { |
| 657 | 657 | $author[$uid]['name'] = $myts->htmlSpecialChars($author_name[$uid]); |
| 658 | 658 | } |
| 659 | - $block['authors'] =& $author; |
|
| 659 | + $block['authors'] = & $author; |
|
| 660 | 660 | $block['disp_mode'] = $options[3]; // 0 - full view; 1 - lite view; |
| 661 | 661 | $block['indexNav'] = (int)$options[4]; |
| 662 | 662 | |
@@ -669,45 +669,45 @@ discard block |
||
| 669 | 669 | */ |
| 670 | 670 | function b_newbb_edit($options) |
| 671 | 671 | { |
| 672 | - require_once dirname(__DIR__) . '/include/functions.forum.php'; |
|
| 672 | + require_once dirname(__DIR__).'/include/functions.forum.php'; |
|
| 673 | 673 | |
| 674 | - $form = _MB_NEWBB_CRITERIA . "<select name='options[0]'>"; |
|
| 674 | + $form = _MB_NEWBB_CRITERIA."<select name='options[0]'>"; |
|
| 675 | 675 | $form .= "<option value='time'"; |
| 676 | 676 | if ('time' === $options[0]) { |
| 677 | 677 | $form .= " selected='selected' "; |
| 678 | 678 | } |
| 679 | - $form .= '>' . _MB_NEWBB_CRITERIA_TIME . '</option>'; |
|
| 679 | + $form .= '>'._MB_NEWBB_CRITERIA_TIME.'</option>'; |
|
| 680 | 680 | $form .= '</select>'; |
| 681 | - $form .= '<br>' . _MB_NEWBB_DISPLAY . "<input type='text' name='options[1]' value='" . $options[1] . "' />"; |
|
| 682 | - $form .= '<br>' . _MB_NEWBB_TIME . "<input type='text' name='options[2]' value='" . $options[2] . "' />"; |
|
| 683 | - $form .= '<br> <small>' . _MB_NEWBB_TIME_DESC . '</small>'; |
|
| 684 | - $form .= '<br>' . _MB_NEWBB_DISPLAYMODE . "<input type='radio' name='options[3]' value='0'"; |
|
| 681 | + $form .= '<br>'._MB_NEWBB_DISPLAY."<input type='text' name='options[1]' value='".$options[1]."' />"; |
|
| 682 | + $form .= '<br>'._MB_NEWBB_TIME."<input type='text' name='options[2]' value='".$options[2]."' />"; |
|
| 683 | + $form .= '<br> <small>'._MB_NEWBB_TIME_DESC.'</small>'; |
|
| 684 | + $form .= '<br>'._MB_NEWBB_DISPLAYMODE."<input type='radio' name='options[3]' value='0'"; |
|
| 685 | 685 | if (0 == $options[3]) { |
| 686 | 686 | $form .= ' checked'; |
| 687 | 687 | } |
| 688 | - $form .= ' /> ' . _MB_NEWBB_DISPLAYMODE_FULL . "<input type='radio' name='options[3]' value='1'"; |
|
| 688 | + $form .= ' /> '._MB_NEWBB_DISPLAYMODE_FULL."<input type='radio' name='options[3]' value='1'"; |
|
| 689 | 689 | if (1 == $options[3]) { |
| 690 | 690 | $form .= ' checked'; |
| 691 | 691 | } |
| 692 | - $form .= ' /> ' . _MB_NEWBB_DISPLAYMODE_COMPACT . "<input type='radio' name='options[3]' value='2'"; |
|
| 692 | + $form .= ' /> '._MB_NEWBB_DISPLAYMODE_COMPACT."<input type='radio' name='options[3]' value='2'"; |
|
| 693 | 693 | if (2 == $options[3]) { |
| 694 | 694 | $form .= ' checked'; |
| 695 | 695 | } |
| 696 | - $form .= ' /> ' . _MB_NEWBB_DISPLAYMODE_LITE; |
|
| 696 | + $form .= ' /> '._MB_NEWBB_DISPLAYMODE_LITE; |
|
| 697 | 697 | |
| 698 | - $form .= '<br>' . _MB_NEWBB_INDEXNAV . '<input type="radio" name="options[4]" value="1"'; |
|
| 698 | + $form .= '<br>'._MB_NEWBB_INDEXNAV.'<input type="radio" name="options[4]" value="1"'; |
|
| 699 | 699 | if (1 == $options[4]) { |
| 700 | 700 | $form .= ' checked'; |
| 701 | 701 | } |
| 702 | - $form .= ' />' . _YES . '<input type="radio" name="options[4]" value="0"'; |
|
| 702 | + $form .= ' />'._YES.'<input type="radio" name="options[4]" value="0"'; |
|
| 703 | 703 | if (0 == $options[4]) { |
| 704 | 704 | $form .= ' checked'; |
| 705 | 705 | } |
| 706 | - $form .= ' />' . _NO; |
|
| 706 | + $form .= ' />'._NO; |
|
| 707 | 707 | |
| 708 | - $form .= '<br>' . _MB_NEWBB_TITLE_LENGTH . "<input type='text' name='options[5]' value='" . $options[5] . "' />"; |
|
| 708 | + $form .= '<br>'._MB_NEWBB_TITLE_LENGTH."<input type='text' name='options[5]' value='".$options[5]."' />"; |
|
| 709 | 709 | |
| 710 | - $form .= '<br><br>' . _MB_NEWBB_FORUMLIST; |
|
| 710 | + $form .= '<br><br>'._MB_NEWBB_FORUMLIST; |
|
| 711 | 711 | |
| 712 | 712 | $optionsForum = array_filter(array_slice($options, 6), 'b_newbb_array_filter'); // get allowed forums |
| 713 | 713 | $isAll = (0 === count($optionsForum) || empty($optionsForum[0])); |
@@ -716,7 +716,7 @@ discard block |
||
| 716 | 716 | if ($isAll) { |
| 717 | 717 | $form .= ' selected'; |
| 718 | 718 | } |
| 719 | - $form .= '>' . _ALL . '</option>'; |
|
| 719 | + $form .= '>'._ALL.'</option>'; |
|
| 720 | 720 | $form .= newbbForumSelectBox($optionsForum); |
| 721 | 721 | $form .= '</select><br>'; |
| 722 | 722 | |
@@ -729,64 +729,64 @@ discard block |
||
| 729 | 729 | */ |
| 730 | 730 | function b_newbb_topic_edit($options) |
| 731 | 731 | { |
| 732 | - require_once dirname(__DIR__) . '/include/functions.forum.php'; |
|
| 733 | - $form = _MB_NEWBB_CRITERIA . "<select name='options[0]'>"; |
|
| 732 | + require_once dirname(__DIR__).'/include/functions.forum.php'; |
|
| 733 | + $form = _MB_NEWBB_CRITERIA."<select name='options[0]'>"; |
|
| 734 | 734 | $form .= "<option value='time'"; |
| 735 | 735 | if ('time' === $options[0]) { |
| 736 | 736 | $form .= " selected='selected' "; |
| 737 | 737 | } |
| 738 | - $form .= '>' . _MB_NEWBB_CRITERIA_TIME . '</option>'; |
|
| 738 | + $form .= '>'._MB_NEWBB_CRITERIA_TIME.'</option>'; |
|
| 739 | 739 | $form .= "<option value='views'"; |
| 740 | 740 | if ('views' === $options[0]) { |
| 741 | 741 | $form .= " selected='selected' "; |
| 742 | 742 | } |
| 743 | - $form .= '>' . _MB_NEWBB_CRITERIA_VIEWS . '</option>'; |
|
| 743 | + $form .= '>'._MB_NEWBB_CRITERIA_VIEWS.'</option>'; |
|
| 744 | 744 | $form .= "<option value='replies'"; |
| 745 | 745 | if ('replies' === $options[0]) { |
| 746 | 746 | $form .= " selected='selected' "; |
| 747 | 747 | } |
| 748 | - $form .= '>' . _MB_NEWBB_CRITERIA_REPLIES . '</option>'; |
|
| 748 | + $form .= '>'._MB_NEWBB_CRITERIA_REPLIES.'</option>'; |
|
| 749 | 749 | $form .= "<option value='digest'"; |
| 750 | 750 | if ('digest' === $options[0]) { |
| 751 | 751 | $form .= " selected='selected' "; |
| 752 | 752 | } |
| 753 | - $form .= '>' . _MB_NEWBB_CRITERIA_DIGEST . '</option>'; |
|
| 753 | + $form .= '>'._MB_NEWBB_CRITERIA_DIGEST.'</option>'; |
|
| 754 | 754 | $form .= "<option value='sticky'"; |
| 755 | 755 | if ('sticky' === $options[0]) { |
| 756 | 756 | $form .= " selected='selected' "; |
| 757 | 757 | } |
| 758 | - $form .= '>' . _MB_NEWBB_CRITERIA_STICKY . '</option>'; |
|
| 758 | + $form .= '>'._MB_NEWBB_CRITERIA_STICKY.'</option>'; |
|
| 759 | 759 | $form .= '</select>'; |
| 760 | - $form .= '<br>' . _MB_NEWBB_DISPLAY . "<input type='text' name='options[1]' value='" . $options[1] . "' />"; |
|
| 761 | - $form .= '<br>' . _MB_NEWBB_TIME . "<input type='text' name='options[2]' value='" . $options[2] . "' />"; |
|
| 762 | - $form .= '<br> <small>' . _MB_NEWBB_TIME_DESC . '</small>'; |
|
| 763 | - $form .= '<br>' . _MB_NEWBB_DISPLAYMODE . "<input type='radio' name='options[3]' value='0'"; |
|
| 760 | + $form .= '<br>'._MB_NEWBB_DISPLAY."<input type='text' name='options[1]' value='".$options[1]."' />"; |
|
| 761 | + $form .= '<br>'._MB_NEWBB_TIME."<input type='text' name='options[2]' value='".$options[2]."' />"; |
|
| 762 | + $form .= '<br> <small>'._MB_NEWBB_TIME_DESC.'</small>'; |
|
| 763 | + $form .= '<br>'._MB_NEWBB_DISPLAYMODE."<input type='radio' name='options[3]' value='0'"; |
|
| 764 | 764 | if (0 == $options[3]) { |
| 765 | 765 | $form .= ' checked'; |
| 766 | 766 | } |
| 767 | - $form .= ' /> ' . _MB_NEWBB_DISPLAYMODE_FULL . "<input type='radio' name='options[3]' value='1'"; |
|
| 767 | + $form .= ' /> '._MB_NEWBB_DISPLAYMODE_FULL."<input type='radio' name='options[3]' value='1'"; |
|
| 768 | 768 | if (1 == $options[3]) { |
| 769 | 769 | $form .= ' checked'; |
| 770 | 770 | } |
| 771 | - $form .= ' /> ' . _MB_NEWBB_DISPLAYMODE_COMPACT . "<input type='radio' name='options[3]' value='2'"; |
|
| 771 | + $form .= ' /> '._MB_NEWBB_DISPLAYMODE_COMPACT."<input type='radio' name='options[3]' value='2'"; |
|
| 772 | 772 | if (2 == $options[3]) { |
| 773 | 773 | $form .= ' checked'; |
| 774 | 774 | } |
| 775 | - $form .= ' /> ' . _MB_NEWBB_DISPLAYMODE_LITE; |
|
| 775 | + $form .= ' /> '._MB_NEWBB_DISPLAYMODE_LITE; |
|
| 776 | 776 | |
| 777 | - $form .= '<br>' . _MB_NEWBB_INDEXNAV . '<input type="radio" name="options[4]" value="1"'; |
|
| 777 | + $form .= '<br>'._MB_NEWBB_INDEXNAV.'<input type="radio" name="options[4]" value="1"'; |
|
| 778 | 778 | if (1 == $options[4]) { |
| 779 | 779 | $form .= ' checked'; |
| 780 | 780 | } |
| 781 | - $form .= ' />' . _YES . '<input type="radio" name="options[4]" value="0"'; |
|
| 781 | + $form .= ' />'._YES.'<input type="radio" name="options[4]" value="0"'; |
|
| 782 | 782 | if (0 == $options[4]) { |
| 783 | 783 | $form .= ' checked'; |
| 784 | 784 | } |
| 785 | - $form .= ' />' . _NO; |
|
| 785 | + $form .= ' />'._NO; |
|
| 786 | 786 | |
| 787 | - $form .= '<br>' . _MB_NEWBB_TITLE_LENGTH . "<input type='text' name='options[5]' value='" . $options[5] . "' />"; |
|
| 787 | + $form .= '<br>'._MB_NEWBB_TITLE_LENGTH."<input type='text' name='options[5]' value='".$options[5]."' />"; |
|
| 788 | 788 | |
| 789 | - $form .= '<br><br>' . _MB_NEWBB_FORUMLIST; |
|
| 789 | + $form .= '<br><br>'._MB_NEWBB_FORUMLIST; |
|
| 790 | 790 | |
| 791 | 791 | $optionsForum = array_filter(array_slice($options, 6), 'b_newbb_array_filter'); // get allowed forums |
| 792 | 792 | |
@@ -796,7 +796,7 @@ discard block |
||
| 796 | 796 | if ($isAll) { |
| 797 | 797 | $form .= ' selected="selected"'; |
| 798 | 798 | } |
| 799 | - $form .= '>' . _ALL . '</option>'; |
|
| 799 | + $form .= '>'._ALL.'</option>'; |
|
| 800 | 800 | $form .= newbbForumSelectBox($optionsForum); |
| 801 | 801 | $form .= '</select><br>'; |
| 802 | 802 | |
@@ -809,49 +809,49 @@ discard block |
||
| 809 | 809 | */ |
| 810 | 810 | function b_newbb_post_edit($options) |
| 811 | 811 | { |
| 812 | - require_once dirname(__DIR__) . '/include/functions.forum.php'; |
|
| 813 | - $form = _MB_NEWBB_CRITERIA . "<select name='options[0]'>"; |
|
| 812 | + require_once dirname(__DIR__).'/include/functions.forum.php'; |
|
| 813 | + $form = _MB_NEWBB_CRITERIA."<select name='options[0]'>"; |
|
| 814 | 814 | $form .= "<option value='title'"; |
| 815 | 815 | if ('title' === $options[0]) { |
| 816 | 816 | $form .= " selected='selected' "; |
| 817 | 817 | } |
| 818 | - $form .= '>' . _MB_NEWBB_CRITERIA_TITLE . '</option>'; |
|
| 818 | + $form .= '>'._MB_NEWBB_CRITERIA_TITLE.'</option>'; |
|
| 819 | 819 | $form .= "<option value='text'"; |
| 820 | 820 | if ('text' === $options[0]) { |
| 821 | 821 | $form .= " selected='selected' "; |
| 822 | 822 | } |
| 823 | - $form .= '>' . _MB_NEWBB_CRITERIA_TEXT . '</option>'; |
|
| 823 | + $form .= '>'._MB_NEWBB_CRITERIA_TEXT.'</option>'; |
|
| 824 | 824 | $form .= '</select>'; |
| 825 | - $form .= '<br>' . _MB_NEWBB_DISPLAY . "<input type='text' name='options[1]' value='" . $options[1] . "' />"; |
|
| 826 | - $form .= '<br>' . _MB_NEWBB_TIME . "<input type='text' name='options[2]' value='" . $options[2] . "' />"; |
|
| 827 | - $form .= '<br> <small>' . _MB_NEWBB_TIME_DESC . '</small>'; |
|
| 828 | - $form .= '<br>' . _MB_NEWBB_DISPLAYMODE . "<input type='radio' name='options[3]' value='0'"; |
|
| 825 | + $form .= '<br>'._MB_NEWBB_DISPLAY."<input type='text' name='options[1]' value='".$options[1]."' />"; |
|
| 826 | + $form .= '<br>'._MB_NEWBB_TIME."<input type='text' name='options[2]' value='".$options[2]."' />"; |
|
| 827 | + $form .= '<br> <small>'._MB_NEWBB_TIME_DESC.'</small>'; |
|
| 828 | + $form .= '<br>'._MB_NEWBB_DISPLAYMODE."<input type='radio' name='options[3]' value='0'"; |
|
| 829 | 829 | if (0 == $options[3]) { |
| 830 | 830 | $form .= ' checked'; |
| 831 | 831 | } |
| 832 | - $form .= ' /> ' . _MB_NEWBB_DISPLAYMODE_FULL . "<input type='radio' name='options[3]' value='1'"; |
|
| 832 | + $form .= ' /> '._MB_NEWBB_DISPLAYMODE_FULL."<input type='radio' name='options[3]' value='1'"; |
|
| 833 | 833 | if (1 == $options[3]) { |
| 834 | 834 | $form .= ' checked'; |
| 835 | 835 | } |
| 836 | - $form .= ' /> ' . _MB_NEWBB_DISPLAYMODE_COMPACT . "<input type='radio' name='options[3]' value='2'"; |
|
| 836 | + $form .= ' /> '._MB_NEWBB_DISPLAYMODE_COMPACT."<input type='radio' name='options[3]' value='2'"; |
|
| 837 | 837 | if (2 == $options[3]) { |
| 838 | 838 | $form .= ' checked'; |
| 839 | 839 | } |
| 840 | - $form .= ' /> ' . _MB_NEWBB_DISPLAYMODE_LITE; |
|
| 840 | + $form .= ' /> '._MB_NEWBB_DISPLAYMODE_LITE; |
|
| 841 | 841 | |
| 842 | - $form .= '<br>' . _MB_NEWBB_INDEXNAV . '<input type="radio" name="options[4]" value="1"'; |
|
| 842 | + $form .= '<br>'._MB_NEWBB_INDEXNAV.'<input type="radio" name="options[4]" value="1"'; |
|
| 843 | 843 | if (1 == $options[4]) { |
| 844 | 844 | $form .= ' checked'; |
| 845 | 845 | } |
| 846 | - $form .= ' />' . _YES . '<input type="radio" name="options[4]" value="0"'; |
|
| 846 | + $form .= ' />'._YES.'<input type="radio" name="options[4]" value="0"'; |
|
| 847 | 847 | if (0 == $options[4]) { |
| 848 | 848 | $form .= ' checked'; |
| 849 | 849 | } |
| 850 | - $form .= ' />' . _NO; |
|
| 850 | + $form .= ' />'._NO; |
|
| 851 | 851 | |
| 852 | - $form .= '<br>' . _MB_NEWBB_TITLE_LENGTH . "<input type='text' name='options[5]' value='" . $options[5] . "' />"; |
|
| 852 | + $form .= '<br>'._MB_NEWBB_TITLE_LENGTH."<input type='text' name='options[5]' value='".$options[5]."' />"; |
|
| 853 | 853 | |
| 854 | - $form .= '<br><br>' . _MB_NEWBB_FORUMLIST; |
|
| 854 | + $form .= '<br><br>'._MB_NEWBB_FORUMLIST; |
|
| 855 | 855 | |
| 856 | 856 | $optionsForum = array_filter(array_slice($options, 6), 'b_newbb_array_filter'); // get allowed forums |
| 857 | 857 | $isAll = (0 === count($optionsForum) || empty($optionsForum[0])); |
@@ -860,7 +860,7 @@ discard block |
||
| 860 | 860 | if ($isAll) { |
| 861 | 861 | $form .= ' selected="selected"'; |
| 862 | 862 | } |
| 863 | - $form .= '>' . _ALL . '</option>'; |
|
| 863 | + $form .= '>'._ALL.'</option>'; |
|
| 864 | 864 | $form .= newbbForumSelectBox($optionsForum); |
| 865 | 865 | $form .= '</select><br>'; |
| 866 | 866 | |
@@ -873,53 +873,53 @@ discard block |
||
| 873 | 873 | */ |
| 874 | 874 | function b_newbb_author_edit($options) |
| 875 | 875 | { |
| 876 | - require_once dirname(__DIR__) . '/include/functions.forum.php'; |
|
| 877 | - $form = _MB_NEWBB_CRITERIA . "<select name='options[0]'>"; |
|
| 876 | + require_once dirname(__DIR__).'/include/functions.forum.php'; |
|
| 877 | + $form = _MB_NEWBB_CRITERIA."<select name='options[0]'>"; |
|
| 878 | 878 | $form .= "<option value='post'"; |
| 879 | 879 | if ('post' === $options[0]) { |
| 880 | 880 | $form .= " selected='selected' "; |
| 881 | 881 | } |
| 882 | - $form .= '>' . _MB_NEWBB_CRITERIA_POST . '</option>'; |
|
| 882 | + $form .= '>'._MB_NEWBB_CRITERIA_POST.'</option>'; |
|
| 883 | 883 | $form .= "<option value='topic'"; |
| 884 | 884 | if ('topic' === $options[0]) { |
| 885 | 885 | $form .= " selected='selected' "; |
| 886 | 886 | } |
| 887 | - $form .= '>' . _MB_NEWBB_CRITERIA_TOPIC . '</option>'; |
|
| 887 | + $form .= '>'._MB_NEWBB_CRITERIA_TOPIC.'</option>'; |
|
| 888 | 888 | $form .= "<option value='digest'"; |
| 889 | 889 | if ('digest' === $options[0]) { |
| 890 | 890 | $form .= " selected='selected' "; |
| 891 | 891 | } |
| 892 | - $form .= '>' . _MB_NEWBB_CRITERIA_DIGESTS . '</option>'; |
|
| 892 | + $form .= '>'._MB_NEWBB_CRITERIA_DIGESTS.'</option>'; |
|
| 893 | 893 | $form .= "<option value='sticky'"; |
| 894 | 894 | if ('sticky' === $options[0]) { |
| 895 | 895 | $form .= " selected='selected' "; |
| 896 | 896 | } |
| 897 | - $form .= '>' . _MB_NEWBB_CRITERIA_STICKYS . '</option>'; |
|
| 897 | + $form .= '>'._MB_NEWBB_CRITERIA_STICKYS.'</option>'; |
|
| 898 | 898 | $form .= '</select>'; |
| 899 | - $form .= '<br>' . _MB_NEWBB_DISPLAY . "<input type='text' name='options[1]' value='" . $options[1] . "' />"; |
|
| 900 | - $form .= '<br>' . _MB_NEWBB_TIME . "<input type='text' name='options[2]' value='" . $options[2] . "' />"; |
|
| 901 | - $form .= '<br> <small>' . _MB_NEWBB_TIME_DESC . '</small>'; |
|
| 902 | - $form .= '<br>' . _MB_NEWBB_DISPLAYMODE . "<input type='radio' name='options[3]' value='0'"; |
|
| 899 | + $form .= '<br>'._MB_NEWBB_DISPLAY."<input type='text' name='options[1]' value='".$options[1]."' />"; |
|
| 900 | + $form .= '<br>'._MB_NEWBB_TIME."<input type='text' name='options[2]' value='".$options[2]."' />"; |
|
| 901 | + $form .= '<br> <small>'._MB_NEWBB_TIME_DESC.'</small>'; |
|
| 902 | + $form .= '<br>'._MB_NEWBB_DISPLAYMODE."<input type='radio' name='options[3]' value='0'"; |
|
| 903 | 903 | if (0 == $options[3]) { |
| 904 | 904 | $form .= ' checked'; |
| 905 | 905 | } |
| 906 | - $form .= ' /> ' . _MB_NEWBB_DISPLAYMODE_COMPACT . "<input type='radio' name='options[3]' value='1'"; |
|
| 906 | + $form .= ' /> '._MB_NEWBB_DISPLAYMODE_COMPACT."<input type='radio' name='options[3]' value='1'"; |
|
| 907 | 907 | if (1 == $options[3]) { |
| 908 | 908 | $form .= ' checked'; |
| 909 | 909 | } |
| 910 | - $form .= ' /> ' . _MB_NEWBB_DISPLAYMODE_LITE; |
|
| 910 | + $form .= ' /> '._MB_NEWBB_DISPLAYMODE_LITE; |
|
| 911 | 911 | |
| 912 | - $form .= '<br>' . _MB_NEWBB_INDEXNAV . '<input type="radio" name="options[4]" value="1"'; |
|
| 912 | + $form .= '<br>'._MB_NEWBB_INDEXNAV.'<input type="radio" name="options[4]" value="1"'; |
|
| 913 | 913 | if (1 == $options[4]) { |
| 914 | 914 | $form .= ' checked'; |
| 915 | 915 | } |
| 916 | - $form .= ' />' . _YES . '<input type="radio" name="options[4]" value="0"'; |
|
| 916 | + $form .= ' />'._YES.'<input type="radio" name="options[4]" value="0"'; |
|
| 917 | 917 | if (0 == $options[4]) { |
| 918 | 918 | $form .= ' checked'; |
| 919 | 919 | } |
| 920 | - $form .= ' />' . _NO; |
|
| 920 | + $form .= ' />'._NO; |
|
| 921 | 921 | |
| 922 | - $form .= '<br><br>' . _MB_NEWBB_FORUMLIST; |
|
| 922 | + $form .= '<br><br>'._MB_NEWBB_FORUMLIST; |
|
| 923 | 923 | |
| 924 | 924 | $optionsForum = array_filter(array_slice($options, 5), 'b_newbb_array_filter'); // get allowed forums |
| 925 | 925 | $isAll = (0 === count($optionsForum) || empty($optionsForum[0])); |
@@ -928,7 +928,7 @@ discard block |
||
| 928 | 928 | if ($isAll) { |
| 929 | 929 | $form .= ' selected="selected"'; |
| 930 | 930 | } |
| 931 | - $form .= '>' . _ALL . '</option>'; |
|
| 931 | + $form .= '>'._ALL.'</option>'; |
|
| 932 | 932 | $form .= newbbForumSelectBox($optionsForum); |
| 933 | 933 | $form .= '</select><br>'; |
| 934 | 934 | |
@@ -942,8 +942,8 @@ discard block |
||
| 942 | 942 | function b_newbb_custom($options) |
| 943 | 943 | { |
| 944 | 944 | // if no newbb module block set, we have to include the language file |
| 945 | - if (is_readable($GLOBALS['xoops']->path('modules/newbb/language/' . $GLOBALS['xoopsConfig']['language'] . '/blocks.php'))) { |
|
| 946 | - require_once $GLOBALS['xoops']->path('modules/newbb/language/' . $GLOBALS['xoopsConfig']['language'] . '/blocks.php'); |
|
| 945 | + if (is_readable($GLOBALS['xoops']->path('modules/newbb/language/'.$GLOBALS['xoopsConfig']['language'].'/blocks.php'))) { |
|
| 946 | + require_once $GLOBALS['xoops']->path('modules/newbb/language/'.$GLOBALS['xoopsConfig']['language'].'/blocks.php'); |
|
| 947 | 947 | } else { |
| 948 | 948 | require_once $GLOBALS['xoops']->path('modules/newbb/language/english/blocks.php'); |
| 949 | 949 | } |
@@ -35,22 +35,22 @@ discard block |
||
| 35 | 35 | |
| 36 | 36 | $GPC = '_GET'; |
| 37 | 37 | if (Request::getString('submit', '', 'POST')) { |
| 38 | - $GPC = '_POST'; |
|
| 38 | + $GPC = '_POST'; |
|
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | foreach (['post_id', 'order', 'forum', 'topic_id'] as $getint) { |
| 42 | - ${$getint} = (int)(@${$GPC}[$getint]); |
|
| 42 | + ${$getint} = (int)(@${$GPC}[$getint]); |
|
| 43 | 43 | } |
| 44 | 44 | $viewmode = (isset(${$GPC}['viewmode']) && 'flat' !== ${$GPC}['viewmode']) ? 'thread' : 'flat'; |
| 45 | 45 | |
| 46 | 46 | if (empty($post_id)) { |
| 47 | - redirect_header(XOOPS_URL . '/index.php', 2, _MD_NEWBB_ERRORPOST); |
|
| 47 | + redirect_header(XOOPS_URL . '/index.php', 2, _MD_NEWBB_ERRORPOST); |
|
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | if ($GLOBALS['xoopsModuleConfig']['wol_enabled']) { |
| 51 | - // /** @var Newbb\OnlineHandler $onlineHandler */ |
|
| 52 | - // $onlineHandler = Newbb\Helper::getInstance()->getHandler('Online'); |
|
| 53 | - $onlineHandler->init($forum); |
|
| 51 | + // /** @var Newbb\OnlineHandler $onlineHandler */ |
|
| 52 | + // $onlineHandler = Newbb\Helper::getInstance()->getHandler('Online'); |
|
| 53 | + $onlineHandler->init($forum); |
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | $myts = \MyTextSanitizer::getInstance(); |
@@ -60,68 +60,68 @@ discard block |
||
| 60 | 60 | require_once $GLOBALS['xoops']->path('class/xoopsformloader.php'); |
| 61 | 61 | |
| 62 | 62 | if (Request::hasVar('submit', 'POST')) { |
| 63 | - $error_message = ''; |
|
| 64 | - if (!is_object($GLOBALS['xoopsUser'])) { |
|
| 65 | - xoops_load('xoopscaptcha'); |
|
| 66 | - $xoopsCaptcha = \XoopsCaptcha::getInstance(); |
|
| 67 | - if (!$xoopsCaptcha->verify()) { |
|
| 68 | - $captcha_invalid = true; |
|
| 69 | - $error_message = $xoopsCaptcha->getMessage(); |
|
| 70 | - } |
|
| 71 | - } |
|
| 72 | - if ('' !== $error_message) { |
|
| 73 | - xoops_error($error_message); |
|
| 74 | - } else { |
|
| 75 | - // $reportHandler = Newbb\Helper::getInstance()->getHandler('Report'); |
|
| 76 | - $report = $reportHandler->create(); |
|
| 77 | - $report->setVar('report_text', Request::getString('report_text', '', 'POST')); |
|
| 78 | - $report->setVar('post_id', Request::getInt('post_id', 0, 'POST')); |
|
| 79 | - $report->setVar('report_time', time()); |
|
| 80 | - $report->setVar('reporter_uid', is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->getVar('uid') : 0); |
|
| 81 | - $report->setVar('reporter_ip', \Xmf\IPAddress::fromRequest()->asReadable()); |
|
| 82 | - $report->setVar('report_result', 0); |
|
| 83 | - $report->setVar('report_memo', ''); |
|
| 84 | - |
|
| 85 | - if ($report_id = $reportHandler->insert($report)) { |
|
| 86 | - // $forumHandler = Newbb\Helper::getInstance()->getHandler('Forum'); |
|
| 87 | - if (empty($forum)) { |
|
| 88 | - } |
|
| 89 | - $forumObject = $forumHandler->get($forum); |
|
| 90 | - |
|
| 91 | - if (is_object($forumObject)) { |
|
| 92 | - $mods = $forumObject->getVar('forum_moderator'); |
|
| 93 | - $emails = []; |
|
| 94 | - /** @var \XoopsMemberHandler $memberHandler */ |
|
| 95 | - $memberHandler = xoops_getHandler('member'); |
|
| 96 | - foreach ($mods as $mod) { |
|
| 97 | - $thisUser = $memberHandler->getUser($mod); |
|
| 98 | - if (is_object($thisUser)) { |
|
| 99 | - $emails[] = $thisUser->getVar('email'); |
|
| 100 | - unset($thisUser); |
|
| 101 | - } |
|
| 102 | - } |
|
| 103 | - $xoopsMailer = xoops_getMailer(); |
|
| 104 | - $xoopsMailer->reset(); |
|
| 105 | - $xoopsMailer->setTemplateDir(); |
|
| 106 | - $xoopsMailer->useMail(); |
|
| 107 | - $xoopsMailer->setTemplate('forum_report.tpl'); |
|
| 108 | - $xoopsMailer->setToEmails($emails); |
|
| 109 | - $xoopsMailer->assign('MESSAGE', Request::getString('report_text', '', 'POST')); |
|
| 110 | - $xoopsMailer->setSubject(_MD_NEWBB_REPORTSUBJECT); |
|
| 111 | - $xoopsMailer->send(); |
|
| 112 | - } |
|
| 113 | - $message = _MD_NEWBB_REPORTED; |
|
| 114 | - } else { |
|
| 115 | - $message = _MD_NEWBB_REPORT_ERROR; |
|
| 116 | - } |
|
| 117 | - redirect_header("viewtopic.php?forum=$forum&topic_id=$topic_id&post_id=$post_id&order=$order&viewmode=$viewmode", 2, $message); |
|
| 118 | - } |
|
| 63 | + $error_message = ''; |
|
| 64 | + if (!is_object($GLOBALS['xoopsUser'])) { |
|
| 65 | + xoops_load('xoopscaptcha'); |
|
| 66 | + $xoopsCaptcha = \XoopsCaptcha::getInstance(); |
|
| 67 | + if (!$xoopsCaptcha->verify()) { |
|
| 68 | + $captcha_invalid = true; |
|
| 69 | + $error_message = $xoopsCaptcha->getMessage(); |
|
| 70 | + } |
|
| 71 | + } |
|
| 72 | + if ('' !== $error_message) { |
|
| 73 | + xoops_error($error_message); |
|
| 74 | + } else { |
|
| 75 | + // $reportHandler = Newbb\Helper::getInstance()->getHandler('Report'); |
|
| 76 | + $report = $reportHandler->create(); |
|
| 77 | + $report->setVar('report_text', Request::getString('report_text', '', 'POST')); |
|
| 78 | + $report->setVar('post_id', Request::getInt('post_id', 0, 'POST')); |
|
| 79 | + $report->setVar('report_time', time()); |
|
| 80 | + $report->setVar('reporter_uid', is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->getVar('uid') : 0); |
|
| 81 | + $report->setVar('reporter_ip', \Xmf\IPAddress::fromRequest()->asReadable()); |
|
| 82 | + $report->setVar('report_result', 0); |
|
| 83 | + $report->setVar('report_memo', ''); |
|
| 84 | + |
|
| 85 | + if ($report_id = $reportHandler->insert($report)) { |
|
| 86 | + // $forumHandler = Newbb\Helper::getInstance()->getHandler('Forum'); |
|
| 87 | + if (empty($forum)) { |
|
| 88 | + } |
|
| 89 | + $forumObject = $forumHandler->get($forum); |
|
| 90 | + |
|
| 91 | + if (is_object($forumObject)) { |
|
| 92 | + $mods = $forumObject->getVar('forum_moderator'); |
|
| 93 | + $emails = []; |
|
| 94 | + /** @var \XoopsMemberHandler $memberHandler */ |
|
| 95 | + $memberHandler = xoops_getHandler('member'); |
|
| 96 | + foreach ($mods as $mod) { |
|
| 97 | + $thisUser = $memberHandler->getUser($mod); |
|
| 98 | + if (is_object($thisUser)) { |
|
| 99 | + $emails[] = $thisUser->getVar('email'); |
|
| 100 | + unset($thisUser); |
|
| 101 | + } |
|
| 102 | + } |
|
| 103 | + $xoopsMailer = xoops_getMailer(); |
|
| 104 | + $xoopsMailer->reset(); |
|
| 105 | + $xoopsMailer->setTemplateDir(); |
|
| 106 | + $xoopsMailer->useMail(); |
|
| 107 | + $xoopsMailer->setTemplate('forum_report.tpl'); |
|
| 108 | + $xoopsMailer->setToEmails($emails); |
|
| 109 | + $xoopsMailer->assign('MESSAGE', Request::getString('report_text', '', 'POST')); |
|
| 110 | + $xoopsMailer->setSubject(_MD_NEWBB_REPORTSUBJECT); |
|
| 111 | + $xoopsMailer->send(); |
|
| 112 | + } |
|
| 113 | + $message = _MD_NEWBB_REPORTED; |
|
| 114 | + } else { |
|
| 115 | + $message = _MD_NEWBB_REPORT_ERROR; |
|
| 116 | + } |
|
| 117 | + redirect_header("viewtopic.php?forum=$forum&topic_id=$topic_id&post_id=$post_id&order=$order&viewmode=$viewmode", 2, $message); |
|
| 118 | + } |
|
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | $report_form = new \XoopsThemeForm('', 'reportform', 'report.php'); |
| 122 | 122 | $report_form->addElement(new \XoopsFormText(_MD_NEWBB_REPORT_TEXT, 'report_text', 80, 255, Request::getString('report_text', '', 'POST')), true); |
| 123 | 123 | if (!is_object($GLOBALS['xoopsUser'])) { |
| 124 | - $report_form->addElement(new \XoopsFormCaptcha()); |
|
| 124 | + $report_form->addElement(new \XoopsFormCaptcha()); |
|
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | //$postHandler = Newbb\Helper::getInstance()->getHandler('Post'); |
@@ -147,19 +147,19 @@ discard block |
||
| 147 | 147 | |
| 148 | 148 | $r_subject = $postObject->getVar('subject', 'E'); |
| 149 | 149 | if ($GLOBALS['xoopsModuleConfig']['enable_karma'] && $postObject->getVar('post_karma') > 0) { |
| 150 | - $r_message = sprintf(_MD_NEWBB_KARMA_REQUIREMENT, '***', $postObject->getVar('post_karma')) . '</div>'; |
|
| 150 | + $r_message = sprintf(_MD_NEWBB_KARMA_REQUIREMENT, '***', $postObject->getVar('post_karma')) . '</div>'; |
|
| 151 | 151 | } elseif ($GLOBALS['xoopsModuleConfig']['allow_require_reply'] && $postObject->getVar('require_reply')) { |
| 152 | - $r_message = _MD_NEWBB_REPLY_REQUIREMENT; |
|
| 152 | + $r_message = _MD_NEWBB_REPLY_REQUIREMENT; |
|
| 153 | 153 | } else { |
| 154 | - $r_message = $postObject->getVar('post_text'); |
|
| 154 | + $r_message = $postObject->getVar('post_text'); |
|
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | $r_date = formatTimestamp($postObject->getVar('post_time')); |
| 158 | 158 | if ($postObject->getVar('uid')) { |
| 159 | - $r_name = newbbGetUnameFromId($postObject->getVar('uid'), $GLOBALS['xoopsModuleConfig']['show_realname']); |
|
| 159 | + $r_name = newbbGetUnameFromId($postObject->getVar('uid'), $GLOBALS['xoopsModuleConfig']['show_realname']); |
|
| 160 | 160 | } else { |
| 161 | - $poster_name = $postObject->getVar('poster_name'); |
|
| 162 | - $r_name = empty($poster_name) ? $GLOBALS['xoopsConfig']['anonymous'] : $myts->htmlSpecialChars($poster_name); |
|
| 161 | + $poster_name = $postObject->getVar('poster_name'); |
|
| 162 | + $r_name = empty($poster_name) ? $GLOBALS['xoopsConfig']['anonymous'] : $myts->htmlSpecialChars($poster_name); |
|
| 163 | 163 | } |
| 164 | 164 | $r_content = _MD_NEWBB_SUBJECTC . ' ' . $r_subject . '<br>'; |
| 165 | 165 | $r_content .= _MD_NEWBB_BY . ' ' . $r_name . ' ' . _MD_NEWBB_ON . ' ' . $r_date . '<br><br>'; |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | |
| 32 | 32 | use Xmf\Request; |
| 33 | 33 | |
| 34 | -require_once __DIR__ . '/header.php'; |
|
| 34 | +require_once __DIR__.'/header.php'; |
|
| 35 | 35 | |
| 36 | 36 | $GPC = '_GET'; |
| 37 | 37 | if (Request::getString('submit', '', 'POST')) { |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | $viewmode = (isset(${$GPC}['viewmode']) && 'flat' !== ${$GPC}['viewmode']) ? 'thread' : 'flat'; |
| 45 | 45 | |
| 46 | 46 | if (empty($post_id)) { |
| 47 | - redirect_header(XOOPS_URL . '/index.php', 2, _MD_NEWBB_ERRORPOST); |
|
| 47 | + redirect_header(XOOPS_URL.'/index.php', 2, _MD_NEWBB_ERRORPOST); |
|
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | if ($GLOBALS['xoopsModuleConfig']['wol_enabled']) { |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | $submit_button = new \XoopsFormButton('', 'submit', _SUBMIT, 'submit'); |
| 140 | 140 | $cancel_button = new \XoopsFormButton('', 'cancel', _MD_NEWBB_CANCELPOST, 'button'); |
| 141 | 141 | $extra = "viewtopic.php?forum=$forum&topic_id=$topic_id&post_id=$post_id&order=$order&viewmode=$viewmode"; |
| 142 | -$cancel_button->setExtra("onclick='location=\"" . $extra . "\"'"); |
|
| 142 | +$cancel_button->setExtra("onclick='location=\"".$extra."\"'"); |
|
| 143 | 143 | $button_tray->addElement($submit_button); |
| 144 | 144 | $button_tray->addElement($cancel_button); |
| 145 | 145 | $report_form->addElement($button_tray); |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | |
| 148 | 148 | $r_subject = $postObject->getVar('subject', 'E'); |
| 149 | 149 | if ($GLOBALS['xoopsModuleConfig']['enable_karma'] && $postObject->getVar('post_karma') > 0) { |
| 150 | - $r_message = sprintf(_MD_NEWBB_KARMA_REQUIREMENT, '***', $postObject->getVar('post_karma')) . '</div>'; |
|
| 150 | + $r_message = sprintf(_MD_NEWBB_KARMA_REQUIREMENT, '***', $postObject->getVar('post_karma')).'</div>'; |
|
| 151 | 151 | } elseif ($GLOBALS['xoopsModuleConfig']['allow_require_reply'] && $postObject->getVar('require_reply')) { |
| 152 | 152 | $r_message = _MD_NEWBB_REPLY_REQUIREMENT; |
| 153 | 153 | } else { |
@@ -161,11 +161,11 @@ discard block |
||
| 161 | 161 | $poster_name = $postObject->getVar('poster_name'); |
| 162 | 162 | $r_name = empty($poster_name) ? $GLOBALS['xoopsConfig']['anonymous'] : $myts->htmlSpecialChars($poster_name); |
| 163 | 163 | } |
| 164 | -$r_content = _MD_NEWBB_SUBJECTC . ' ' . $r_subject . '<br>'; |
|
| 165 | -$r_content .= _MD_NEWBB_BY . ' ' . $r_name . ' ' . _MD_NEWBB_ON . ' ' . $r_date . '<br><br>'; |
|
| 164 | +$r_content = _MD_NEWBB_SUBJECTC.' '.$r_subject.'<br>'; |
|
| 165 | +$r_content .= _MD_NEWBB_BY.' '.$r_name.' '._MD_NEWBB_ON.' '.$r_date.'<br><br>'; |
|
| 166 | 166 | $r_content .= $r_message; |
| 167 | 167 | |
| 168 | -echo "<br><table cellpadding='4' cellspacing='1' width='98%' class='outer'><tr><td class='head'>" . $r_subject . '</td></tr>'; |
|
| 169 | -echo '<tr><td><br>' . $r_content . '<br></td></tr></table>'; |
|
| 168 | +echo "<br><table cellpadding='4' cellspacing='1' width='98%' class='outer'><tr><td class='head'>".$r_subject.'</td></tr>'; |
|
| 169 | +echo '<tr><td><br>'.$r_content.'<br></td></tr></table>'; |
|
| 170 | 170 | |
| 171 | 171 | require_once $GLOBALS['xoops']->path('footer.php'); |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | require_once $GLOBALS['xoops']->path('header.php'); |
| 21 | 21 | // irmtfan new method |
| 22 | 22 | if (!empty($GLOBALS['xoopsModuleConfig']['rss_enable'])) { |
| 23 | - $xoopsTpl->assign('xoops_module_header', ' |
|
| 23 | + $xoopsTpl->assign('xoops_module_header', ' |
|
| 24 | 24 | <link rel="alternate" type="application/xml+rss" title="' . $xoopsModule->getVar('name') . '" href="' . XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname', 'n') . '/rss.php" /> |
| 25 | 25 | ' . @$xoopsTpl->get_template_vars('xoops_module_header')); |
| 26 | 26 | } |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | $topic_renderer->userlevel = $GLOBALS['xoopsUserIsAdmin'] ? 2 : is_object($GLOBALS['xoopsUser']); |
| 36 | 36 | // irmtfan if list topic block is in the page then force to parse |
| 37 | 37 | if (defined('LIST_TOPIC_DEFINED')) { |
| 38 | - $topic_renderer->force = true; // force against static vars |
|
| 38 | + $topic_renderer->force = true; // force against static vars |
|
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | $topic_renderer->is_multiple = true; |
@@ -52,14 +52,14 @@ discard block |
||
| 52 | 52 | //$isAdmin = $GLOBALS["xoopsUserIsAdmin"]; |
| 53 | 53 | /* Only admin has access to admin mode */ |
| 54 | 54 | if ($topic_renderer->userlevel < 2) { // irmtfan use userlevel |
| 55 | - $mode = 0; |
|
| 55 | + $mode = 0; |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | if ($GLOBALS['xoopsModuleConfig']['wol_enabled']) { |
| 59 | - // /** @var Newbb\OnlineHandler $onlineHandler */ |
|
| 60 | - // $onlineHandler = Newbb\Helper::getInstance()->getHandler('Online'); |
|
| 61 | - $onlineHandler->init(); |
|
| 62 | - $onlineHandler->render($xoopsTpl); |
|
| 59 | + // /** @var Newbb\OnlineHandler $onlineHandler */ |
|
| 60 | + // $onlineHandler = Newbb\Helper::getInstance()->getHandler('Online'); |
|
| 61 | + $onlineHandler->init(); |
|
| 62 | + $onlineHandler->render($xoopsTpl); |
|
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | $topic_renderer->buildHeaders($xoopsTpl); |
@@ -87,8 +87,8 @@ discard block |
||
| 87 | 87 | $xoopsTpl->assign('newpost_link', 'viewpost.php?status=new'); |
| 88 | 88 | |
| 89 | 89 | if (!empty($GLOBALS['xoopsModuleConfig']['show_jump'])) { |
| 90 | - require_once __DIR__ . '/include/functions.forum.php'; |
|
| 91 | - $xoopsTpl->assign('forum_jumpbox', newbbMakeJumpbox()); |
|
| 90 | + require_once __DIR__ . '/include/functions.forum.php'; |
|
| 91 | + $xoopsTpl->assign('forum_jumpbox', newbbMakeJumpbox()); |
|
| 92 | 92 | } |
| 93 | 93 | $xoopsTpl->assign('menumode', $menumode); |
| 94 | 94 | $xoopsTpl->assign('menumode_other', $menumode_other); |
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | use Xmf\Request; |
| 13 | 13 | use XoopsModules\Newbb; |
| 14 | 14 | |
| 15 | -require_once __DIR__ . '/header.php'; |
|
| 15 | +require_once __DIR__.'/header.php'; |
|
| 16 | 16 | |
| 17 | 17 | //$xoopsOption['xoops_module_header']= $xoops_module_header; |
| 18 | 18 | $GLOBALS['xoopsOption']['template_main'] = 'newbb_viewall.tpl'; |
@@ -21,13 +21,13 @@ discard block |
||
| 21 | 21 | // irmtfan new method |
| 22 | 22 | if (!empty($GLOBALS['xoopsModuleConfig']['rss_enable'])) { |
| 23 | 23 | $xoopsTpl->assign('xoops_module_header', ' |
| 24 | - <link rel="alternate" type="application/xml+rss" title="' . $xoopsModule->getVar('name') . '" href="' . XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname', 'n') . '/rss.php" /> |
|
| 24 | + <link rel="alternate" type="application/xml+rss" title="' . $xoopsModule->getVar('name').'" href="'.XOOPS_URL.'/modules/'.$xoopsModule->getVar('dirname', 'n').'/rss.php" /> |
|
| 25 | 25 | ' . @$xoopsTpl->get_template_vars('xoops_module_header')); |
| 26 | 26 | } |
| 27 | 27 | //$xoopsTpl->assign('xoops_module_header', $xoops_module_header); |
| 28 | 28 | |
| 29 | -require_once __DIR__ . '/include/functions.time.php'; |
|
| 30 | -require_once __DIR__ . '/include/functions.render.php'; |
|
| 29 | +require_once __DIR__.'/include/functions.time.php'; |
|
| 30 | +require_once __DIR__.'/include/functions.render.php'; |
|
| 31 | 31 | |
| 32 | 32 | // irmtfan use require_once because it will redeclared in newbb/blocks/list_topic.php |
| 33 | 33 | //require_once __DIR__ . '/./class/TopicRenderer.php'; |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | $xoopsTpl->assign('newpost_link', 'viewpost.php?status=new'); |
| 88 | 88 | |
| 89 | 89 | if (!empty($GLOBALS['xoopsModuleConfig']['show_jump'])) { |
| 90 | - require_once __DIR__ . '/include/functions.forum.php'; |
|
| 90 | + require_once __DIR__.'/include/functions.forum.php'; |
|
| 91 | 91 | $xoopsTpl->assign('forum_jumpbox', newbbMakeJumpbox()); |
| 92 | 92 | } |
| 93 | 93 | $xoopsTpl->assign('menumode', $menumode); |
@@ -95,12 +95,12 @@ discard block |
||
| 95 | 95 | |
| 96 | 96 | $xoopsTpl->assign('mode', $mode); |
| 97 | 97 | $xoopsTpl->assign('status', $status); |
| 98 | -$xoopsTpl->assign('viewer_level', $topic_renderer->userlevel);// irmtfan use userlevel |
|
| 98 | +$xoopsTpl->assign('viewer_level', $topic_renderer->userlevel); // irmtfan use userlevel |
|
| 99 | 99 | |
| 100 | 100 | $pagetitle = sprintf(_MD_NEWBB_FORUMINDEX, htmlspecialchars($GLOBALS['xoopsConfig']['sitename'], ENT_QUOTES)); |
| 101 | 101 | $xoopsTpl->assign('forum_index_title', $pagetitle); |
| 102 | 102 | $xoopsTpl->assign('xoops_pagetitle', $pagetitle); |
| 103 | 103 | |
| 104 | 104 | // irmtfan move to footer.php |
| 105 | -require_once __DIR__ . '/footer.php'; |
|
| 105 | +require_once __DIR__.'/footer.php'; |
|
| 106 | 106 | require_once $GLOBALS['xoops']->path('footer.php'); |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | $uid = Request::getInt('uid', 0, 'GET'); |
| 42 | 42 | |
| 43 | 43 | $status = (Request::getString('status', '', 'GET') |
| 44 | - && in_array(Request::getString('status', '', 'GET'), ['active', 'pending', 'deleted', 'new', 'all', 'digest'], true)) ? Request::getString('status', '', 'GET') : ''; |
|
| 44 | + && in_array(Request::getString('status', '', 'GET'), ['active', 'pending', 'deleted', 'new', 'all', 'digest'], true)) ? Request::getString('status', '', 'GET') : ''; |
|
| 45 | 45 | $mode = Request::getInt('mode', 0, 'GET'); |
| 46 | 46 | $mode = (!empty($status) && in_array($status, ['active', 'pending', 'deleted'], true)) ? 2 : $mode; |
| 47 | 47 | |
@@ -51,23 +51,23 @@ discard block |
||
| 51 | 51 | //$postHandler = Newbb\Helper::getInstance()->getHandler('Post'); |
| 52 | 52 | |
| 53 | 53 | if (empty($forum_id)) { |
| 54 | - $forums = $forumHandler->getByPermission(0, 'view'); |
|
| 55 | - $accessForums = array_keys($forums); |
|
| 56 | - $isAdmin = $GLOBALS['xoopsUserIsAdmin']; |
|
| 54 | + $forums = $forumHandler->getByPermission(0, 'view'); |
|
| 55 | + $accessForums = array_keys($forums); |
|
| 56 | + $isAdmin = $GLOBALS['xoopsUserIsAdmin']; |
|
| 57 | 57 | } else { |
| 58 | - $forumObject = $forumHandler->get($forum_id); |
|
| 59 | - $forums[$forum_id] = $forumObject; |
|
| 60 | - $accessForums = [$forum_id]; |
|
| 61 | - $isAdmin = newbbIsAdmin($forumObject); |
|
| 58 | + $forumObject = $forumHandler->get($forum_id); |
|
| 59 | + $forums[$forum_id] = $forumObject; |
|
| 60 | + $accessForums = [$forum_id]; |
|
| 61 | + $isAdmin = newbbIsAdmin($forumObject); |
|
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | /* Only admin has access to admin mode */ |
| 65 | 65 | if (!$isAdmin && 2 === $mode) { |
| 66 | - $status = in_array($status, ['active', 'pending', 'deleted'], true) ? '' : $status; |
|
| 67 | - $mode = 0; |
|
| 66 | + $status = in_array($status, ['active', 'pending', 'deleted'], true) ? '' : $status; |
|
| 67 | + $mode = 0; |
|
| 68 | 68 | } |
| 69 | 69 | if ($mode) { |
| 70 | - $_GET['viewmode'] = 'flat'; |
|
| 70 | + $_GET['viewmode'] = 'flat'; |
|
| 71 | 71 | } |
| 72 | 72 | //echo $mode.' - '.$status; |
| 73 | 73 | $post_perpage = $GLOBALS['xoopsModuleConfig']['posts_per_page']; |
@@ -78,71 +78,71 @@ discard block |
||
| 78 | 78 | $criteria_post->setOrder($order); |
| 79 | 79 | |
| 80 | 80 | if (!empty($uid)) { |
| 81 | - $criteria_count->add(new \Criteria('uid', $uid)); |
|
| 82 | - $criteria_post->add(new \Criteria('p.uid', $uid)); |
|
| 81 | + $criteria_count->add(new \Criteria('uid', $uid)); |
|
| 82 | + $criteria_post->add(new \Criteria('p.uid', $uid)); |
|
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | $join = null; |
| 86 | 86 | // START irmtfan solve the status issues and specially status = new issue |
| 87 | 87 | switch ($status) { |
| 88 | - case 'pending': |
|
| 89 | - $criteria_count->add(new \Criteria('approved', 0)); // irmtfan add new \Criteria |
|
| 90 | - $criteria_post->add(new \Criteria('p.approved', 0)); // irmtfan add new \Criteria |
|
| 91 | - break; |
|
| 92 | - case 'deleted': |
|
| 93 | - $criteria_count->add(new \Criteria('approved', -1)); // irmtfan add new \Criteria |
|
| 94 | - $criteria_post->add(new \Criteria('p.approved', -1)); // irmtfan add new \Criteria |
|
| 95 | - break; |
|
| 96 | - case 'new': |
|
| 97 | - //$criteria_status_count = new \CriteriaCompo(new \Criteria("post_time", (int)($last_visit), ">"));// irmtfan commented and removed |
|
| 98 | - //$criteria_status_post = new \CriteriaCompo(new \Criteria("p.post_time", (int)($last_visit), ">"));// irmtfan commented and removed |
|
| 99 | - $criteria_count->add(new \Criteria('approved', 1)); // irmtfan uncomment |
|
| 100 | - $criteria_post->add(new \Criteria('p.approved', 1)); // irmtfan uncomment |
|
| 101 | - // following is for 'unread' -- not finished -- irmtfan Now it is finished! |
|
| 102 | - if (empty($GLOBALS['xoopsModuleConfig']['read_mode'])) { |
|
| 103 | - //$criteria_status_count->add(new \Criteria('approved', 1));// irmtfan commented and removed |
|
| 104 | - //$criteria_status_post->add(new \Criteria('p.approved', 1));// irmtfan commented and removed |
|
| 105 | - } elseif (2 == $GLOBALS['xoopsModuleConfig']['read_mode']) { |
|
| 106 | - // START irmtfan use read_uid to find the unread posts when the user is logged in |
|
| 107 | - $read_uid = is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->getVar('uid') : 0; |
|
| 108 | - if (!empty($read_uid)) { |
|
| 109 | - $join = ' LEFT JOIN ' . $GLOBALS['xoopsDB']->prefix('newbb_reads_topic') . ' AS r ON r.read_item = p.topic_id AND r.uid = ' . $read_uid . ' '; // irmtfan corrected add AS |
|
| 110 | - $criteria_status_post = new \CriteriaCompo();// irmtfan new \Criteria |
|
| 111 | - $criteria_status_post->add(new \Criteria('p.post_id', 'r.`post_id`', '>')); // irmtfan corrected - should use $value='r.``' to render in XOOPS/class/criteria.php |
|
| 112 | - $criteria_status_post->add(new \Criteria('r.read_id', null, 'IS NULL'), 'OR');// irmtfan corrected - should use "IS NULL" to render in XOOPS/class/criteria.php |
|
| 113 | - $criteria_post->add($criteria_status_post); // irmtfan add the status criteria to post criteria - move here |
|
| 114 | - $criteria_count = $criteria_post;// irmtfan criteria count is equal to criteria post - move here |
|
| 115 | - } else { |
|
| 116 | - } |
|
| 117 | - // END irmtfan use read_uid to find the unread posts when the user is logged in |
|
| 118 | - //$criteria_status_post->add(new \Criteria("p.approved", 1)); // irmtfan commented and removed |
|
| 119 | - //$criteria_status_count =& $criteria_status_post; |
|
| 120 | - } elseif (1 == $GLOBALS['xoopsModuleConfig']['read_mode']) { |
|
| 121 | - $criteria_count->add(new \Criteria('post_time', (int)$last_visit, '>')); // irmtfan add new \Criteria |
|
| 122 | - $criteria_post->add(new \Criteria('p.post_time', (int)$last_visit, '>')); // irmtfan add new \Criteria |
|
| 123 | - // START irmtfan fix read_mode = 1 bugs - for all users (member and anon) |
|
| 124 | - $topics = []; |
|
| 125 | - $topic_lastread = newbbGetCookie('LT', true); |
|
| 126 | - if (count($topic_lastread) > 0) { |
|
| 127 | - foreach ($topic_lastread as $id => $time) { |
|
| 128 | - if ($time > (int)$last_visit) { |
|
| 129 | - $topics[] = $id; |
|
| 130 | - } |
|
| 131 | - } |
|
| 132 | - } |
|
| 133 | - if (count($topics) > 0) { |
|
| 134 | - $criteria_count->add(new \Criteria('topic_id', '(' . implode(',', $topics) . ')', 'NOT IN')); |
|
| 135 | - $criteria_post->add(new \Criteria('p.topic_id', '(' . implode(',', $topics) . ')', 'NOT IN')); |
|
| 136 | - } |
|
| 137 | - // END irmtfan fix read_mode = 1 bugs - for all users (member and anon) |
|
| 138 | - //$criteria_status_count->add(new \Criteria("approved", 1));// irmtfan commented and removed |
|
| 139 | - //$criteria_status_post->add(new \Criteria("p.approved", 1));// irmtfan commented and removed |
|
| 140 | - } |
|
| 141 | - break; |
|
| 142 | - default: |
|
| 143 | - $criteria_count->add(new \Criteria('approved', 1)); // irmtfan add new \Criteria |
|
| 144 | - $criteria_post->add(new \Criteria('p.approved', 1)); // irmtfan add new \Criteria |
|
| 145 | - break; |
|
| 88 | + case 'pending': |
|
| 89 | + $criteria_count->add(new \Criteria('approved', 0)); // irmtfan add new \Criteria |
|
| 90 | + $criteria_post->add(new \Criteria('p.approved', 0)); // irmtfan add new \Criteria |
|
| 91 | + break; |
|
| 92 | + case 'deleted': |
|
| 93 | + $criteria_count->add(new \Criteria('approved', -1)); // irmtfan add new \Criteria |
|
| 94 | + $criteria_post->add(new \Criteria('p.approved', -1)); // irmtfan add new \Criteria |
|
| 95 | + break; |
|
| 96 | + case 'new': |
|
| 97 | + //$criteria_status_count = new \CriteriaCompo(new \Criteria("post_time", (int)($last_visit), ">"));// irmtfan commented and removed |
|
| 98 | + //$criteria_status_post = new \CriteriaCompo(new \Criteria("p.post_time", (int)($last_visit), ">"));// irmtfan commented and removed |
|
| 99 | + $criteria_count->add(new \Criteria('approved', 1)); // irmtfan uncomment |
|
| 100 | + $criteria_post->add(new \Criteria('p.approved', 1)); // irmtfan uncomment |
|
| 101 | + // following is for 'unread' -- not finished -- irmtfan Now it is finished! |
|
| 102 | + if (empty($GLOBALS['xoopsModuleConfig']['read_mode'])) { |
|
| 103 | + //$criteria_status_count->add(new \Criteria('approved', 1));// irmtfan commented and removed |
|
| 104 | + //$criteria_status_post->add(new \Criteria('p.approved', 1));// irmtfan commented and removed |
|
| 105 | + } elseif (2 == $GLOBALS['xoopsModuleConfig']['read_mode']) { |
|
| 106 | + // START irmtfan use read_uid to find the unread posts when the user is logged in |
|
| 107 | + $read_uid = is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->getVar('uid') : 0; |
|
| 108 | + if (!empty($read_uid)) { |
|
| 109 | + $join = ' LEFT JOIN ' . $GLOBALS['xoopsDB']->prefix('newbb_reads_topic') . ' AS r ON r.read_item = p.topic_id AND r.uid = ' . $read_uid . ' '; // irmtfan corrected add AS |
|
| 110 | + $criteria_status_post = new \CriteriaCompo();// irmtfan new \Criteria |
|
| 111 | + $criteria_status_post->add(new \Criteria('p.post_id', 'r.`post_id`', '>')); // irmtfan corrected - should use $value='r.``' to render in XOOPS/class/criteria.php |
|
| 112 | + $criteria_status_post->add(new \Criteria('r.read_id', null, 'IS NULL'), 'OR');// irmtfan corrected - should use "IS NULL" to render in XOOPS/class/criteria.php |
|
| 113 | + $criteria_post->add($criteria_status_post); // irmtfan add the status criteria to post criteria - move here |
|
| 114 | + $criteria_count = $criteria_post;// irmtfan criteria count is equal to criteria post - move here |
|
| 115 | + } else { |
|
| 116 | + } |
|
| 117 | + // END irmtfan use read_uid to find the unread posts when the user is logged in |
|
| 118 | + //$criteria_status_post->add(new \Criteria("p.approved", 1)); // irmtfan commented and removed |
|
| 119 | + //$criteria_status_count =& $criteria_status_post; |
|
| 120 | + } elseif (1 == $GLOBALS['xoopsModuleConfig']['read_mode']) { |
|
| 121 | + $criteria_count->add(new \Criteria('post_time', (int)$last_visit, '>')); // irmtfan add new \Criteria |
|
| 122 | + $criteria_post->add(new \Criteria('p.post_time', (int)$last_visit, '>')); // irmtfan add new \Criteria |
|
| 123 | + // START irmtfan fix read_mode = 1 bugs - for all users (member and anon) |
|
| 124 | + $topics = []; |
|
| 125 | + $topic_lastread = newbbGetCookie('LT', true); |
|
| 126 | + if (count($topic_lastread) > 0) { |
|
| 127 | + foreach ($topic_lastread as $id => $time) { |
|
| 128 | + if ($time > (int)$last_visit) { |
|
| 129 | + $topics[] = $id; |
|
| 130 | + } |
|
| 131 | + } |
|
| 132 | + } |
|
| 133 | + if (count($topics) > 0) { |
|
| 134 | + $criteria_count->add(new \Criteria('topic_id', '(' . implode(',', $topics) . ')', 'NOT IN')); |
|
| 135 | + $criteria_post->add(new \Criteria('p.topic_id', '(' . implode(',', $topics) . ')', 'NOT IN')); |
|
| 136 | + } |
|
| 137 | + // END irmtfan fix read_mode = 1 bugs - for all users (member and anon) |
|
| 138 | + //$criteria_status_count->add(new \Criteria("approved", 1));// irmtfan commented and removed |
|
| 139 | + //$criteria_status_post->add(new \Criteria("p.approved", 1));// irmtfan commented and removed |
|
| 140 | + } |
|
| 141 | + break; |
|
| 142 | + default: |
|
| 143 | + $criteria_count->add(new \Criteria('approved', 1)); // irmtfan add new \Criteria |
|
| 144 | + $criteria_post->add(new \Criteria('p.approved', 1)); // irmtfan add new \Criteria |
|
| 145 | + break; |
|
| 146 | 146 | } |
| 147 | 147 | //$criteria_count->add($criteria_status_count); // irmtfan commented and removed |
| 148 | 148 | //$criteria_post->add($criteria_status_post); // irmtfan commented and removed |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | $viewmode_cookie = newbbGetCookie('V'); |
| 156 | 156 | |
| 157 | 157 | if ('compact' === Request::getString('viewmode', '', 'GET')) { |
| 158 | - newbbSetCookie('V', 'compact', $forumCookie['expire']); |
|
| 158 | + newbbSetCookie('V', 'compact', $forumCookie['expire']); |
|
| 159 | 159 | } |
| 160 | 160 | |
| 161 | 161 | $viewmode = Request::getString('viewmode', (!empty($viewmode_cookie) ? $viewmode_cookie : (@$valid_modes[$GLOBALS['xoopsModuleConfig']['view_mode'] - 1])), 'GET'); |
@@ -166,10 +166,10 @@ discard block |
||
| 166 | 166 | |
| 167 | 167 | $poster_array = []; |
| 168 | 168 | if (count($posts) > 0) { |
| 169 | - foreach (array_keys($posts) as $id) { |
|
| 170 | - /** @var Newbb\Post[] $posts */ |
|
| 171 | - $poster_array[$posts[$id]->getVar('uid')] = 1; |
|
| 172 | - } |
|
| 169 | + foreach (array_keys($posts) as $id) { |
|
| 170 | + /** @var Newbb\Post[] $posts */ |
|
| 171 | + $poster_array[$posts[$id]->getVar('uid')] = 1; |
|
| 172 | + } |
|
| 173 | 173 | } |
| 174 | 174 | |
| 175 | 175 | $xoops_pagetitle = $xoopsModule->getVar('name') . ' - ' . _MD_NEWBB_VIEWALLPOSTS; |
@@ -184,31 +184,31 @@ discard block |
||
| 184 | 184 | //$xoTheme->addScript('/Frameworks/textsanitizer/xoops.js'); |
| 185 | 185 | |
| 186 | 186 | if (!empty($forum_id)) { |
| 187 | - if (!$forumHandler->getPermission($forumObject, 'view')) { |
|
| 188 | - redirect_header(XOOPS_URL . '/index.php', 2, _MD_NEWBB_NORIGHTTOACCESS); |
|
| 189 | - } |
|
| 190 | - if ($forumObject->getVar('parent_forum')) { |
|
| 191 | - $parent_forumObject = $forumHandler->get($forumObject->getVar('parent_forum'), ['forum_name']); |
|
| 192 | - $parentforum = [ |
|
| 193 | - 'id' => $forumObject->getVar('parent_forum'), |
|
| 194 | - 'name' => $parent_forumObject->getVar('forum_name') |
|
| 195 | - ]; |
|
| 196 | - unset($parent_forumObject); |
|
| 197 | - $xoopsTpl->assign_by_ref('parentforum', $parentforum); |
|
| 198 | - } |
|
| 199 | - $xoopsTpl->assign('forum_name', $forumObject->getVar('forum_name')); |
|
| 200 | - $xoopsTpl->assign('forum_moderators', $forumObject->dispForumModerators()); |
|
| 201 | - |
|
| 202 | - $xoops_pagetitle = $forumObject->getVar('forum_name') . ' - ' . _MD_NEWBB_VIEWALLPOSTS . ' [' . $xoopsModule->getVar('name') . ']'; |
|
| 203 | - $xoopsTpl->assign('forum_id', $forumObject->getVar('forum_id')); |
|
| 204 | - // irmtfan new method |
|
| 205 | - if (!empty($GLOBALS['xoopsModuleConfig']['rss_enable'])) { |
|
| 206 | - $xoopsTpl->assign('xoops_module_header', ' |
|
| 187 | + if (!$forumHandler->getPermission($forumObject, 'view')) { |
|
| 188 | + redirect_header(XOOPS_URL . '/index.php', 2, _MD_NEWBB_NORIGHTTOACCESS); |
|
| 189 | + } |
|
| 190 | + if ($forumObject->getVar('parent_forum')) { |
|
| 191 | + $parent_forumObject = $forumHandler->get($forumObject->getVar('parent_forum'), ['forum_name']); |
|
| 192 | + $parentforum = [ |
|
| 193 | + 'id' => $forumObject->getVar('parent_forum'), |
|
| 194 | + 'name' => $parent_forumObject->getVar('forum_name') |
|
| 195 | + ]; |
|
| 196 | + unset($parent_forumObject); |
|
| 197 | + $xoopsTpl->assign_by_ref('parentforum', $parentforum); |
|
| 198 | + } |
|
| 199 | + $xoopsTpl->assign('forum_name', $forumObject->getVar('forum_name')); |
|
| 200 | + $xoopsTpl->assign('forum_moderators', $forumObject->dispForumModerators()); |
|
| 201 | + |
|
| 202 | + $xoops_pagetitle = $forumObject->getVar('forum_name') . ' - ' . _MD_NEWBB_VIEWALLPOSTS . ' [' . $xoopsModule->getVar('name') . ']'; |
|
| 203 | + $xoopsTpl->assign('forum_id', $forumObject->getVar('forum_id')); |
|
| 204 | + // irmtfan new method |
|
| 205 | + if (!empty($GLOBALS['xoopsModuleConfig']['rss_enable'])) { |
|
| 206 | + $xoopsTpl->assign('xoops_module_header', ' |
|
| 207 | 207 | <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 . '" /> |
| 208 | 208 | ' . @$xoopsTpl->get_template_vars('xoops_module_header')); |
| 209 | - } |
|
| 209 | + } |
|
| 210 | 210 | } elseif (!empty($GLOBALS['xoopsModuleConfig']['rss_enable'])) { |
| 211 | - $xoopsTpl->assign('xoops_module_header', ' |
|
| 211 | + $xoopsTpl->assign('xoops_module_header', ' |
|
| 212 | 212 | <link rel="alternate" type="application/xml+rss" title="' . $xoopsModule->getVar('name') . '" href="' . XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/rss.php" /> |
| 213 | 213 | ' . @$xoopsTpl->get_template_vars('xoops_module_header')); |
| 214 | 214 | } |
@@ -219,190 +219,190 @@ discard block |
||
| 219 | 219 | $xoopsTpl->assign('anonym_avatar', newbbDisplayImage('anonym')); |
| 220 | 220 | $userid_array = []; |
| 221 | 221 | if (count($poster_array) > 0) { |
| 222 | - /** @var \XoopsMembershipHandler $memberHandler */ |
|
| 223 | - $memberHandler = xoops_getHandler('member'); |
|
| 224 | - $userid_array = array_keys($poster_array); |
|
| 225 | - $user_criteria = '(' . implode(',', $userid_array) . ')'; |
|
| 226 | - $users = $memberHandler->getUsers(new \Criteria('uid', $user_criteria, 'IN'), true); |
|
| 222 | + /** @var \XoopsMembershipHandler $memberHandler */ |
|
| 223 | + $memberHandler = xoops_getHandler('member'); |
|
| 224 | + $userid_array = array_keys($poster_array); |
|
| 225 | + $user_criteria = '(' . implode(',', $userid_array) . ')'; |
|
| 226 | + $users = $memberHandler->getUsers(new \Criteria('uid', $user_criteria, 'IN'), true); |
|
| 227 | 227 | } else { |
| 228 | - $user_criteria = ''; |
|
| 229 | - $users = null; |
|
| 228 | + $user_criteria = ''; |
|
| 229 | + $users = null; |
|
| 230 | 230 | } |
| 231 | 231 | |
| 232 | 232 | $online = []; |
| 233 | 233 | |
| 234 | 234 | if ($GLOBALS['xoopsModuleConfig']['wol_enabled']) { |
| 235 | - if (!empty($user_criteria)) { |
|
| 236 | - // /** @var Newbb\OnlineHandler $onlineHandler */ |
|
| 237 | - // $onlineHandler = Newbb\Helper::getInstance()->getHandler('Online'); |
|
| 238 | - $onlineHandler->init($forum_id); |
|
| 239 | - } |
|
| 235 | + if (!empty($user_criteria)) { |
|
| 236 | + // /** @var Newbb\OnlineHandler $onlineHandler */ |
|
| 237 | + // $onlineHandler = Newbb\Helper::getInstance()->getHandler('Online'); |
|
| 238 | + $onlineHandler->init($forum_id); |
|
| 239 | + } |
|
| 240 | 240 | } |
| 241 | 241 | |
| 242 | 242 | $viewtopic_users = []; |
| 243 | 243 | |
| 244 | 244 | if (count($userid_array) > 0) { |
| 245 | 245 | // require_once $GLOBALS['xoops']->path('modules/' . $xoopsModule->getVar('dirname', 'n') . '/class/user.php'); |
| 246 | - $userHandler = new Newbb\UserHandler($GLOBALS['xoopsModuleConfig']['groupbar_enabled'], $GLOBALS['xoopsModuleConfig']['wol_enabled']); |
|
| 247 | - $userHandler->users = $users; |
|
| 248 | - $userHandler->online = $online; |
|
| 249 | - $viewtopic_users = $userHandler->getUsers(); |
|
| 246 | + $userHandler = new Newbb\UserHandler($GLOBALS['xoopsModuleConfig']['groupbar_enabled'], $GLOBALS['xoopsModuleConfig']['wol_enabled']); |
|
| 247 | + $userHandler->users = $users; |
|
| 248 | + $userHandler->online = $online; |
|
| 249 | + $viewtopic_users = $userHandler->getUsers(); |
|
| 250 | 250 | } |
| 251 | 251 | |
| 252 | 252 | $pn = 0; |
| 253 | 253 | //$topicHandler = Newbb\Helper::getInstance()->getHandler('Topic'); |
| 254 | 254 | static $suspension = []; |
| 255 | 255 | foreach (array_keys($posts) as $id) { |
| 256 | - ++$pn; |
|
| 257 | - |
|
| 258 | - /** @var Newbb\Post $post */ |
|
| 259 | - $post = $posts[$id]; |
|
| 260 | - $post_title = $post->getVar('subject'); |
|
| 261 | - |
|
| 262 | - if ($posticon = $post->getVar('icon')) { |
|
| 263 | - $post_image = '<a name="' . $post->getVar('post_id') . '"><img src="' . XOOPS_URL . '/images/subject/' . htmlspecialchars($posticon, ENT_QUOTES | ENT_HTML5) . '" alt="" /></a>'; |
|
| 264 | - } else { |
|
| 265 | - $post_image = '<a name="' . $post->getVar('post_id') . '"><img src="' . XOOPS_URL . '/images/icons/no_posticon.gif" alt="" /></a>'; |
|
| 266 | - } |
|
| 267 | - $poster = [ |
|
| 268 | - 'uid' => 0, |
|
| 269 | - 'name' => $post->getVar('poster_name') ?: $myts->htmlSpecialChars($GLOBALS['xoopsConfig']['anonymous']), |
|
| 270 | - 'link' => $post->getVar('poster_name') ?: $myts->htmlSpecialChars($GLOBALS['xoopsConfig']['anonymous']) |
|
| 271 | - ]; |
|
| 272 | - if ($post->getVar('uid') > 0 && isset($viewtopic_users[$post->getVar('uid')])) { |
|
| 273 | - $poster = $viewtopic_users[$post->getVar('uid')]; |
|
| 274 | - } |
|
| 275 | - if ($isAdmin || $post->checkIdentity()) { |
|
| 276 | - $post_text = $post->getVar('post_text'); |
|
| 277 | - $post_attachment = $post->displayAttachment(); |
|
| 278 | - } elseif ($GLOBALS['xoopsModuleConfig']['enable_karma'] && $post->getVar('post_karma') > $user_karma) { |
|
| 279 | - $post_text = "<div class='karma'>" . sprintf(_MD_NEWBB_KARMA_REQUIREMENT, $user_karma, $post->getVar('post_karma')) . '</div>'; |
|
| 280 | - $post_attachment = ''; |
|
| 281 | - } elseif ($GLOBALS['xoopsModuleConfig']['allow_require_reply'] && $post->getVar('require_reply')) { |
|
| 282 | - $post_text = "<div class='karma'>" . _MD_NEWBB_REPLY_REQUIREMENT . '</div>'; |
|
| 283 | - $post_attachment = ''; |
|
| 284 | - } else { |
|
| 285 | - $post_text = $post->getVar('post_text'); |
|
| 286 | - $post_attachment = $post->displayAttachment(); |
|
| 287 | - } |
|
| 288 | - |
|
| 289 | - $thread_buttons = []; |
|
| 290 | - |
|
| 291 | - if ($GLOBALS['xoopsModuleConfig']['enable_permcheck']) { |
|
| 292 | - if (!isset($suspension[$post->getVar('forum_id')])) { |
|
| 293 | - // /** @var Newbb\ModerateHandler $moderateHandler */ |
|
| 294 | - // $moderateHandler = Newbb\Helper::getInstance()->getHandler('Moderate'); |
|
| 295 | - $suspension[$post->getVar('forum_id')] = !$moderateHandler->verifyUser(-1, '', $post->getVar('forum_id')); |
|
| 296 | - } |
|
| 297 | - |
|
| 298 | - if ($isAdmin |
|
| 299 | - || (!$suspension[$post->getVar('forum_id')] && $post->checkIdentity() |
|
| 300 | - && $post->checkTimelimit('delete_timelimit'))) { |
|
| 301 | - $thread_buttons['delete']['image'] = newbbDisplayImage('p_delete', _DELETE); |
|
| 302 | - $thread_buttons['delete']['link'] = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/delete.php?forum=' . $post->getVar('forum_id') . '&topic_id=' . $post->getVar('topic_id'); |
|
| 303 | - $thread_buttons['delete']['name'] = _DELETE; |
|
| 304 | - } |
|
| 305 | - if ($isAdmin |
|
| 306 | - || !$suspension[$post->getVar('forum_id')] && $post->checkIdentity() |
|
| 307 | - && $post->checkTimelimit('edit_timelimit')) { |
|
| 308 | - $thread_buttons['edit']['image'] = newbbDisplayImage('p_edit', _EDIT); |
|
| 309 | - $thread_buttons['edit']['link'] = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/edit.php?forum=' . $post->getVar('forum_id') . '&topic_id=' . $post->getVar('topic_id'); |
|
| 310 | - $thread_buttons['edit']['name'] = _EDIT; |
|
| 311 | - } |
|
| 312 | - if (is_object($GLOBALS['xoopsUser']) && !$suspension[$post->getVar('forum_id')]) { |
|
| 313 | - $thread_buttons['reply']['image'] = newbbDisplayImage('p_reply', _MD_NEWBB_REPLY); |
|
| 314 | - $thread_buttons['reply']['link'] = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/reply.php?forum=' . $post->getVar('forum_id') . '&topic_id=' . $post->getVar('topic_id'); |
|
| 315 | - $thread_buttons['reply']['name'] = _MD_NEWBB_REPLY; |
|
| 316 | - |
|
| 317 | - $thread_buttons['quote']['image'] = newbbDisplayImage('p_quote', _MD_NEWBB_QUOTE); |
|
| 318 | - $thread_buttons['quote']['link'] = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/reply.php?forum=' . $post->getVar('forum_id') . '&topic_id=' . $post->getVar('topic_id') . '&quotedac=1'; |
|
| 319 | - $thread_buttons['quote']['name'] = _MD_NEWBB_QUOTE; |
|
| 320 | - } |
|
| 321 | - } else { |
|
| 322 | - $thread_buttons['delete']['image'] = newbbDisplayImage('p_delete', _DELETE); |
|
| 323 | - $thread_buttons['delete']['link'] = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/delete.php?forum=' . $post->getVar('forum_id') . '&topic_id=' . $post->getVar('topic_id'); |
|
| 324 | - $thread_buttons['delete']['name'] = _DELETE; |
|
| 325 | - $thread_buttons['edit']['image'] = newbbDisplayImage('p_edit', _EDIT); |
|
| 326 | - $thread_buttons['edit']['link'] = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/edit.php?forum=' . $post->getVar('forum_id') . '&topic_id=' . $post->getVar('topic_id'); |
|
| 327 | - $thread_buttons['edit']['name'] = _EDIT; |
|
| 328 | - $thread_buttons['reply']['image'] = newbbDisplayImage('p_reply', _MD_NEWBB_REPLY); |
|
| 329 | - $thread_buttons['reply']['link'] = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/reply.php?forum=' . $post->getVar('forum_id') . '&topic_id=' . $post->getVar('topic_id'); |
|
| 330 | - $thread_buttons['reply']['name'] = _MD_NEWBB_REPLY; |
|
| 331 | - } |
|
| 332 | - |
|
| 333 | - if (!$isAdmin && $GLOBALS['xoopsModuleConfig']['reportmod_enabled']) { |
|
| 334 | - $thread_buttons['report']['image'] = newbbDisplayImage('p_report', _MD_NEWBB_REPORT); |
|
| 335 | - $thread_buttons['report']['link'] = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/report.php?forum=' . $post->getVar('forum_id') . '&topic_id=' . $post->getVar('topic_id'); |
|
| 336 | - $thread_buttons['report']['name'] = _MD_NEWBB_REPORT; |
|
| 337 | - } |
|
| 338 | - $thread_action = []; |
|
| 339 | - |
|
| 340 | - $xoopsTpl->append('posts', [ |
|
| 341 | - 'post_id' => $post->getVar('post_id'), |
|
| 342 | - 'topic_id' => $post->getVar('topic_id'), |
|
| 343 | - 'forum_id' => $post->getVar('forum_id'), |
|
| 344 | - 'post_date' => newbbFormatTimestamp($post->getVar('post_time')), |
|
| 345 | - 'post_image' => $post_image, |
|
| 346 | - 'post_title' => $post_title, |
|
| 347 | - 'post_text' => $post_text, |
|
| 348 | - 'post_attachment' => $post_attachment, |
|
| 349 | - 'post_edit' => $post->displayPostEdit(), |
|
| 350 | - 'post_no' => $start + $pn, |
|
| 351 | - 'post_signature' => $post->getVar('attachsig') ? @$poster['signature'] : '', |
|
| 352 | - // 'poster_ip' => ($isAdmin && $GLOBALS['xoopsModuleConfig']['show_ip']) ? long2ip($post->getVar('poster_ip')) : '', |
|
| 353 | - 'poster_ip' => ($isAdmin && $GLOBALS['xoopsModuleConfig']['show_ip']) ? $post->getVar('poster_ip') : '', |
|
| 354 | - 'thread_action' => $thread_action, |
|
| 355 | - 'thread_buttons' => $thread_buttons, |
|
| 356 | - 'poster' => $poster |
|
| 357 | - ]); |
|
| 358 | - |
|
| 359 | - unset($thread_buttons, $poster); |
|
| 256 | + ++$pn; |
|
| 257 | + |
|
| 258 | + /** @var Newbb\Post $post */ |
|
| 259 | + $post = $posts[$id]; |
|
| 260 | + $post_title = $post->getVar('subject'); |
|
| 261 | + |
|
| 262 | + if ($posticon = $post->getVar('icon')) { |
|
| 263 | + $post_image = '<a name="' . $post->getVar('post_id') . '"><img src="' . XOOPS_URL . '/images/subject/' . htmlspecialchars($posticon, ENT_QUOTES | ENT_HTML5) . '" alt="" /></a>'; |
|
| 264 | + } else { |
|
| 265 | + $post_image = '<a name="' . $post->getVar('post_id') . '"><img src="' . XOOPS_URL . '/images/icons/no_posticon.gif" alt="" /></a>'; |
|
| 266 | + } |
|
| 267 | + $poster = [ |
|
| 268 | + 'uid' => 0, |
|
| 269 | + 'name' => $post->getVar('poster_name') ?: $myts->htmlSpecialChars($GLOBALS['xoopsConfig']['anonymous']), |
|
| 270 | + 'link' => $post->getVar('poster_name') ?: $myts->htmlSpecialChars($GLOBALS['xoopsConfig']['anonymous']) |
|
| 271 | + ]; |
|
| 272 | + if ($post->getVar('uid') > 0 && isset($viewtopic_users[$post->getVar('uid')])) { |
|
| 273 | + $poster = $viewtopic_users[$post->getVar('uid')]; |
|
| 274 | + } |
|
| 275 | + if ($isAdmin || $post->checkIdentity()) { |
|
| 276 | + $post_text = $post->getVar('post_text'); |
|
| 277 | + $post_attachment = $post->displayAttachment(); |
|
| 278 | + } elseif ($GLOBALS['xoopsModuleConfig']['enable_karma'] && $post->getVar('post_karma') > $user_karma) { |
|
| 279 | + $post_text = "<div class='karma'>" . sprintf(_MD_NEWBB_KARMA_REQUIREMENT, $user_karma, $post->getVar('post_karma')) . '</div>'; |
|
| 280 | + $post_attachment = ''; |
|
| 281 | + } elseif ($GLOBALS['xoopsModuleConfig']['allow_require_reply'] && $post->getVar('require_reply')) { |
|
| 282 | + $post_text = "<div class='karma'>" . _MD_NEWBB_REPLY_REQUIREMENT . '</div>'; |
|
| 283 | + $post_attachment = ''; |
|
| 284 | + } else { |
|
| 285 | + $post_text = $post->getVar('post_text'); |
|
| 286 | + $post_attachment = $post->displayAttachment(); |
|
| 287 | + } |
|
| 288 | + |
|
| 289 | + $thread_buttons = []; |
|
| 290 | + |
|
| 291 | + if ($GLOBALS['xoopsModuleConfig']['enable_permcheck']) { |
|
| 292 | + if (!isset($suspension[$post->getVar('forum_id')])) { |
|
| 293 | + // /** @var Newbb\ModerateHandler $moderateHandler */ |
|
| 294 | + // $moderateHandler = Newbb\Helper::getInstance()->getHandler('Moderate'); |
|
| 295 | + $suspension[$post->getVar('forum_id')] = !$moderateHandler->verifyUser(-1, '', $post->getVar('forum_id')); |
|
| 296 | + } |
|
| 297 | + |
|
| 298 | + if ($isAdmin |
|
| 299 | + || (!$suspension[$post->getVar('forum_id')] && $post->checkIdentity() |
|
| 300 | + && $post->checkTimelimit('delete_timelimit'))) { |
|
| 301 | + $thread_buttons['delete']['image'] = newbbDisplayImage('p_delete', _DELETE); |
|
| 302 | + $thread_buttons['delete']['link'] = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/delete.php?forum=' . $post->getVar('forum_id') . '&topic_id=' . $post->getVar('topic_id'); |
|
| 303 | + $thread_buttons['delete']['name'] = _DELETE; |
|
| 304 | + } |
|
| 305 | + if ($isAdmin |
|
| 306 | + || !$suspension[$post->getVar('forum_id')] && $post->checkIdentity() |
|
| 307 | + && $post->checkTimelimit('edit_timelimit')) { |
|
| 308 | + $thread_buttons['edit']['image'] = newbbDisplayImage('p_edit', _EDIT); |
|
| 309 | + $thread_buttons['edit']['link'] = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/edit.php?forum=' . $post->getVar('forum_id') . '&topic_id=' . $post->getVar('topic_id'); |
|
| 310 | + $thread_buttons['edit']['name'] = _EDIT; |
|
| 311 | + } |
|
| 312 | + if (is_object($GLOBALS['xoopsUser']) && !$suspension[$post->getVar('forum_id')]) { |
|
| 313 | + $thread_buttons['reply']['image'] = newbbDisplayImage('p_reply', _MD_NEWBB_REPLY); |
|
| 314 | + $thread_buttons['reply']['link'] = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/reply.php?forum=' . $post->getVar('forum_id') . '&topic_id=' . $post->getVar('topic_id'); |
|
| 315 | + $thread_buttons['reply']['name'] = _MD_NEWBB_REPLY; |
|
| 316 | + |
|
| 317 | + $thread_buttons['quote']['image'] = newbbDisplayImage('p_quote', _MD_NEWBB_QUOTE); |
|
| 318 | + $thread_buttons['quote']['link'] = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/reply.php?forum=' . $post->getVar('forum_id') . '&topic_id=' . $post->getVar('topic_id') . '&quotedac=1'; |
|
| 319 | + $thread_buttons['quote']['name'] = _MD_NEWBB_QUOTE; |
|
| 320 | + } |
|
| 321 | + } else { |
|
| 322 | + $thread_buttons['delete']['image'] = newbbDisplayImage('p_delete', _DELETE); |
|
| 323 | + $thread_buttons['delete']['link'] = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/delete.php?forum=' . $post->getVar('forum_id') . '&topic_id=' . $post->getVar('topic_id'); |
|
| 324 | + $thread_buttons['delete']['name'] = _DELETE; |
|
| 325 | + $thread_buttons['edit']['image'] = newbbDisplayImage('p_edit', _EDIT); |
|
| 326 | + $thread_buttons['edit']['link'] = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/edit.php?forum=' . $post->getVar('forum_id') . '&topic_id=' . $post->getVar('topic_id'); |
|
| 327 | + $thread_buttons['edit']['name'] = _EDIT; |
|
| 328 | + $thread_buttons['reply']['image'] = newbbDisplayImage('p_reply', _MD_NEWBB_REPLY); |
|
| 329 | + $thread_buttons['reply']['link'] = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/reply.php?forum=' . $post->getVar('forum_id') . '&topic_id=' . $post->getVar('topic_id'); |
|
| 330 | + $thread_buttons['reply']['name'] = _MD_NEWBB_REPLY; |
|
| 331 | + } |
|
| 332 | + |
|
| 333 | + if (!$isAdmin && $GLOBALS['xoopsModuleConfig']['reportmod_enabled']) { |
|
| 334 | + $thread_buttons['report']['image'] = newbbDisplayImage('p_report', _MD_NEWBB_REPORT); |
|
| 335 | + $thread_buttons['report']['link'] = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/report.php?forum=' . $post->getVar('forum_id') . '&topic_id=' . $post->getVar('topic_id'); |
|
| 336 | + $thread_buttons['report']['name'] = _MD_NEWBB_REPORT; |
|
| 337 | + } |
|
| 338 | + $thread_action = []; |
|
| 339 | + |
|
| 340 | + $xoopsTpl->append('posts', [ |
|
| 341 | + 'post_id' => $post->getVar('post_id'), |
|
| 342 | + 'topic_id' => $post->getVar('topic_id'), |
|
| 343 | + 'forum_id' => $post->getVar('forum_id'), |
|
| 344 | + 'post_date' => newbbFormatTimestamp($post->getVar('post_time')), |
|
| 345 | + 'post_image' => $post_image, |
|
| 346 | + 'post_title' => $post_title, |
|
| 347 | + 'post_text' => $post_text, |
|
| 348 | + 'post_attachment' => $post_attachment, |
|
| 349 | + 'post_edit' => $post->displayPostEdit(), |
|
| 350 | + 'post_no' => $start + $pn, |
|
| 351 | + 'post_signature' => $post->getVar('attachsig') ? @$poster['signature'] : '', |
|
| 352 | + // 'poster_ip' => ($isAdmin && $GLOBALS['xoopsModuleConfig']['show_ip']) ? long2ip($post->getVar('poster_ip')) : '', |
|
| 353 | + 'poster_ip' => ($isAdmin && $GLOBALS['xoopsModuleConfig']['show_ip']) ? $post->getVar('poster_ip') : '', |
|
| 354 | + 'thread_action' => $thread_action, |
|
| 355 | + 'thread_buttons' => $thread_buttons, |
|
| 356 | + 'poster' => $poster |
|
| 357 | + ]); |
|
| 358 | + |
|
| 359 | + unset($thread_buttons, $poster); |
|
| 360 | 360 | } |
| 361 | 361 | unset($viewtopic_users, $forums); |
| 362 | 362 | |
| 363 | 363 | if (!empty($GLOBALS['xoopsModuleConfig']['show_jump'])) { |
| 364 | - require_once __DIR__ . '/include/functions.forum.php'; |
|
| 365 | - $xoopsTpl->assign('forum_jumpbox', newbbMakeJumpbox($forum_id)); |
|
| 364 | + require_once __DIR__ . '/include/functions.forum.php'; |
|
| 365 | + $xoopsTpl->assign('forum_jumpbox', newbbMakeJumpbox($forum_id)); |
|
| 366 | 366 | } |
| 367 | 367 | |
| 368 | 368 | if ($postCount > $post_perpage) { |
| 369 | - require_once $GLOBALS['xoops']->path('class/pagenav.php'); |
|
| 370 | - $nav = new \XoopsPageNav($postCount, $post_perpage, $start, 'start', 'forum=' . $forum_id . '&viewmode=' . $viewmode . '&status=' . $status . '&uid=' . $uid . '&order=' . $order . '&mode=' . $mode); |
|
| 371 | - //if (isset($GLOBALS['xoopsModuleConfig']['do_rewrite'])) $nav->url = formatURL(Request::getString('SERVER_NAME', '', 'SERVER')) . $nav->url; |
|
| 372 | - if ('select' === $GLOBALS['xoopsModuleConfig']['pagenav_display']) { |
|
| 373 | - $navi = $nav->renderSelect(); |
|
| 374 | - } elseif ('image' === $GLOBALS['xoopsModuleConfig']['pagenav_display']) { |
|
| 375 | - $navi = $nav->renderImageNav(4); |
|
| 376 | - } else { |
|
| 377 | - $navi = $nav->renderNav(4); |
|
| 378 | - } |
|
| 379 | - |
|
| 380 | - $xoopsTpl->assign('pagenav', $navi); |
|
| 369 | + require_once $GLOBALS['xoops']->path('class/pagenav.php'); |
|
| 370 | + $nav = new \XoopsPageNav($postCount, $post_perpage, $start, 'start', 'forum=' . $forum_id . '&viewmode=' . $viewmode . '&status=' . $status . '&uid=' . $uid . '&order=' . $order . '&mode=' . $mode); |
|
| 371 | + //if (isset($GLOBALS['xoopsModuleConfig']['do_rewrite'])) $nav->url = formatURL(Request::getString('SERVER_NAME', '', 'SERVER')) . $nav->url; |
|
| 372 | + if ('select' === $GLOBALS['xoopsModuleConfig']['pagenav_display']) { |
|
| 373 | + $navi = $nav->renderSelect(); |
|
| 374 | + } elseif ('image' === $GLOBALS['xoopsModuleConfig']['pagenav_display']) { |
|
| 375 | + $navi = $nav->renderImageNav(4); |
|
| 376 | + } else { |
|
| 377 | + $navi = $nav->renderNav(4); |
|
| 378 | + } |
|
| 379 | + |
|
| 380 | + $xoopsTpl->assign('pagenav', $navi); |
|
| 381 | 381 | } else { |
| 382 | - $xoopsTpl->assign('pagenav', ''); |
|
| 382 | + $xoopsTpl->assign('pagenav', ''); |
|
| 383 | 383 | } |
| 384 | 384 | |
| 385 | 385 | $xoopsTpl->assign('lang_forum_index', sprintf(_MD_NEWBB_FORUMINDEX, htmlspecialchars($GLOBALS['xoopsConfig']['sitename'], ENT_QUOTES))); |
| 386 | 386 | |
| 387 | 387 | switch ($status) { |
| 388 | - case 'active': |
|
| 389 | - $lang_title = _MD_NEWBB_VIEWALLPOSTS . ' [' . _MD_NEWBB_TYPE_ADMIN . ']'; |
|
| 390 | - break; |
|
| 391 | - case 'pending': |
|
| 392 | - $lang_title = _MD_NEWBB_VIEWALLPOSTS . ' [' . _MD_NEWBB_TYPE_PENDING . ']'; |
|
| 393 | - break; |
|
| 394 | - case 'deleted': |
|
| 395 | - $lang_title = _MD_NEWBB_VIEWALLPOSTS . ' [' . _MD_NEWBB_TYPE_DELETED . ']'; |
|
| 396 | - break; |
|
| 397 | - case 'new': |
|
| 398 | - $lang_title = _MD_NEWBB_NEWPOSTS; |
|
| 399 | - break; |
|
| 400 | - default: |
|
| 401 | - $lang_title = _MD_NEWBB_VIEWALLPOSTS; |
|
| 402 | - break; |
|
| 388 | + case 'active': |
|
| 389 | + $lang_title = _MD_NEWBB_VIEWALLPOSTS . ' [' . _MD_NEWBB_TYPE_ADMIN . ']'; |
|
| 390 | + break; |
|
| 391 | + case 'pending': |
|
| 392 | + $lang_title = _MD_NEWBB_VIEWALLPOSTS . ' [' . _MD_NEWBB_TYPE_PENDING . ']'; |
|
| 393 | + break; |
|
| 394 | + case 'deleted': |
|
| 395 | + $lang_title = _MD_NEWBB_VIEWALLPOSTS . ' [' . _MD_NEWBB_TYPE_DELETED . ']'; |
|
| 396 | + break; |
|
| 397 | + case 'new': |
|
| 398 | + $lang_title = _MD_NEWBB_NEWPOSTS; |
|
| 399 | + break; |
|
| 400 | + default: |
|
| 401 | + $lang_title = _MD_NEWBB_VIEWALLPOSTS; |
|
| 402 | + break; |
|
| 403 | 403 | } |
| 404 | 404 | if ($uid > 0) { |
| 405 | - $lang_title .= ' (' . \XoopsUser::getUnameFromId($uid) . ')'; |
|
| 405 | + $lang_title .= ' (' . \XoopsUser::getUnameFromId($uid) . ')'; |
|
| 406 | 406 | } |
| 407 | 407 | $xoopsTpl->assign('lang_title', $lang_title); |
| 408 | 408 | // irmtfan up to p_up |
@@ -427,15 +427,15 @@ discard block |
||
| 427 | 427 | |
| 428 | 428 | $viewmode_options = []; |
| 429 | 429 | if ('DESC' === $order) { |
| 430 | - $viewmode_options[] = [ |
|
| 431 | - 'link' => XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/viewpost.php?viewmode=flat&order=ASC&forum=' . $forum_id, |
|
| 432 | - 'title' => _OLDESTFIRST |
|
| 433 | - ]; |
|
| 430 | + $viewmode_options[] = [ |
|
| 431 | + 'link' => XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/viewpost.php?viewmode=flat&order=ASC&forum=' . $forum_id, |
|
| 432 | + 'title' => _OLDESTFIRST |
|
| 433 | + ]; |
|
| 434 | 434 | } else { |
| 435 | - $viewmode_options[] = [ |
|
| 436 | - 'link' => XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/viewpost.php?viewmode=flat&order=DESC&forum=' . $forum_id, |
|
| 437 | - 'title' => _NEWESTFIRST |
|
| 438 | - ]; |
|
| 435 | + $viewmode_options[] = [ |
|
| 436 | + 'link' => XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/viewpost.php?viewmode=flat&order=DESC&forum=' . $forum_id, |
|
| 437 | + 'title' => _NEWESTFIRST |
|
| 438 | + ]; |
|
| 439 | 439 | } |
| 440 | 440 | |
| 441 | 441 | //$xoopsTpl->assign('viewmode_compact', ($viewmode=="compact")?1:0); |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | use Xmf\Request; |
| 33 | 33 | use XoopsModules\Newbb; |
| 34 | 34 | |
| 35 | -require_once __DIR__ . '/header.php'; |
|
| 35 | +require_once __DIR__.'/header.php'; |
|
| 36 | 36 | |
| 37 | 37 | $start = Request::getInt('start', 0, 'GET'); |
| 38 | 38 | $forum_id = Request::getInt('forum', 0, 'GET'); |
@@ -72,8 +72,8 @@ discard block |
||
| 72 | 72 | //echo $mode.' - '.$status; |
| 73 | 73 | $post_perpage = $GLOBALS['xoopsModuleConfig']['posts_per_page']; |
| 74 | 74 | |
| 75 | -$criteria_count = new \CriteriaCompo(new \Criteria('forum_id', '(' . implode(',', $accessForums) . ')', 'IN')); |
|
| 76 | -$criteria_post = new \CriteriaCompo(new \Criteria('p.forum_id', '(' . implode(',', $accessForums) . ')', 'IN')); |
|
| 75 | +$criteria_count = new \CriteriaCompo(new \Criteria('forum_id', '('.implode(',', $accessForums).')', 'IN')); |
|
| 76 | +$criteria_post = new \CriteriaCompo(new \Criteria('p.forum_id', '('.implode(',', $accessForums).')', 'IN')); |
|
| 77 | 77 | $criteria_post->setSort('p.post_id'); |
| 78 | 78 | $criteria_post->setOrder($order); |
| 79 | 79 | |
@@ -106,12 +106,12 @@ discard block |
||
| 106 | 106 | // START irmtfan use read_uid to find the unread posts when the user is logged in |
| 107 | 107 | $read_uid = is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->getVar('uid') : 0; |
| 108 | 108 | if (!empty($read_uid)) { |
| 109 | - $join = ' LEFT JOIN ' . $GLOBALS['xoopsDB']->prefix('newbb_reads_topic') . ' AS r ON r.read_item = p.topic_id AND r.uid = ' . $read_uid . ' '; // irmtfan corrected add AS |
|
| 110 | - $criteria_status_post = new \CriteriaCompo();// irmtfan new \Criteria |
|
| 109 | + $join = ' LEFT JOIN '.$GLOBALS['xoopsDB']->prefix('newbb_reads_topic').' AS r ON r.read_item = p.topic_id AND r.uid = '.$read_uid.' '; // irmtfan corrected add AS |
|
| 110 | + $criteria_status_post = new \CriteriaCompo(); // irmtfan new \Criteria |
|
| 111 | 111 | $criteria_status_post->add(new \Criteria('p.post_id', 'r.`post_id`', '>')); // irmtfan corrected - should use $value='r.``' to render in XOOPS/class/criteria.php |
| 112 | - $criteria_status_post->add(new \Criteria('r.read_id', null, 'IS NULL'), 'OR');// irmtfan corrected - should use "IS NULL" to render in XOOPS/class/criteria.php |
|
| 112 | + $criteria_status_post->add(new \Criteria('r.read_id', null, 'IS NULL'), 'OR'); // irmtfan corrected - should use "IS NULL" to render in XOOPS/class/criteria.php |
|
| 113 | 113 | $criteria_post->add($criteria_status_post); // irmtfan add the status criteria to post criteria - move here |
| 114 | - $criteria_count = $criteria_post;// irmtfan criteria count is equal to criteria post - move here |
|
| 114 | + $criteria_count = $criteria_post; // irmtfan criteria count is equal to criteria post - move here |
|
| 115 | 115 | } else { |
| 116 | 116 | } |
| 117 | 117 | // END irmtfan use read_uid to find the unread posts when the user is logged in |
@@ -131,8 +131,8 @@ discard block |
||
| 131 | 131 | } |
| 132 | 132 | } |
| 133 | 133 | if (count($topics) > 0) { |
| 134 | - $criteria_count->add(new \Criteria('topic_id', '(' . implode(',', $topics) . ')', 'NOT IN')); |
|
| 135 | - $criteria_post->add(new \Criteria('p.topic_id', '(' . implode(',', $topics) . ')', 'NOT IN')); |
|
| 134 | + $criteria_count->add(new \Criteria('topic_id', '('.implode(',', $topics).')', 'NOT IN')); |
|
| 135 | + $criteria_post->add(new \Criteria('p.topic_id', '('.implode(',', $topics).')', 'NOT IN')); |
|
| 136 | 136 | } |
| 137 | 137 | // END irmtfan fix read_mode = 1 bugs - for all users (member and anon) |
| 138 | 138 | //$criteria_status_count->add(new \Criteria("approved", 1));// irmtfan commented and removed |
@@ -161,8 +161,8 @@ discard block |
||
| 161 | 161 | $viewmode = Request::getString('viewmode', (!empty($viewmode_cookie) ? $viewmode_cookie : (@$valid_modes[$GLOBALS['xoopsModuleConfig']['view_mode'] - 1])), 'GET'); |
| 162 | 162 | $viewmode = in_array($viewmode, $valid_modes) ? $viewmode : $valid_modes[0]; |
| 163 | 163 | |
| 164 | -$postCount = $postHandler->getPostCount($criteria_count, $join);// irmtfan add join for read_mode = 2 |
|
| 165 | -$posts = $postHandler->getPostsByLimit($criteria_post, $post_perpage, $start, $join);// irmtfan add join for read_mode = 2 |
|
| 164 | +$postCount = $postHandler->getPostCount($criteria_count, $join); // irmtfan add join for read_mode = 2 |
|
| 165 | +$posts = $postHandler->getPostsByLimit($criteria_post, $post_perpage, $start, $join); // irmtfan add join for read_mode = 2 |
|
| 166 | 166 | |
| 167 | 167 | $poster_array = []; |
| 168 | 168 | if (count($posts) > 0) { |
@@ -172,20 +172,20 @@ discard block |
||
| 172 | 172 | } |
| 173 | 173 | } |
| 174 | 174 | |
| 175 | -$xoops_pagetitle = $xoopsModule->getVar('name') . ' - ' . _MD_NEWBB_VIEWALLPOSTS; |
|
| 175 | +$xoops_pagetitle = $xoopsModule->getVar('name').' - '._MD_NEWBB_VIEWALLPOSTS; |
|
| 176 | 176 | $xoopsOption['xoops_pagetitle'] = $xoops_pagetitle; |
| 177 | 177 | $xoopsOption['template_main'] = 'newbb_viewpost.tpl'; |
| 178 | 178 | |
| 179 | 179 | require_once $GLOBALS['xoops']->path('header.php'); |
| 180 | -require_once __DIR__ . '/include/functions.time.php'; |
|
| 181 | -require_once __DIR__ . '/include/functions.render.php'; |
|
| 180 | +require_once __DIR__.'/include/functions.time.php'; |
|
| 181 | +require_once __DIR__.'/include/functions.render.php'; |
|
| 182 | 182 | |
| 183 | 183 | //global $xoTheme; |
| 184 | 184 | //$xoTheme->addScript('/Frameworks/textsanitizer/xoops.js'); |
| 185 | 185 | |
| 186 | 186 | if (!empty($forum_id)) { |
| 187 | 187 | if (!$forumHandler->getPermission($forumObject, 'view')) { |
| 188 | - redirect_header(XOOPS_URL . '/index.php', 2, _MD_NEWBB_NORIGHTTOACCESS); |
|
| 188 | + redirect_header(XOOPS_URL.'/index.php', 2, _MD_NEWBB_NORIGHTTOACCESS); |
|
| 189 | 189 | } |
| 190 | 190 | if ($forumObject->getVar('parent_forum')) { |
| 191 | 191 | $parent_forumObject = $forumHandler->get($forumObject->getVar('parent_forum'), ['forum_name']); |
@@ -199,17 +199,17 @@ discard block |
||
| 199 | 199 | $xoopsTpl->assign('forum_name', $forumObject->getVar('forum_name')); |
| 200 | 200 | $xoopsTpl->assign('forum_moderators', $forumObject->dispForumModerators()); |
| 201 | 201 | |
| 202 | - $xoops_pagetitle = $forumObject->getVar('forum_name') . ' - ' . _MD_NEWBB_VIEWALLPOSTS . ' [' . $xoopsModule->getVar('name') . ']'; |
|
| 202 | + $xoops_pagetitle = $forumObject->getVar('forum_name').' - '._MD_NEWBB_VIEWALLPOSTS.' ['.$xoopsModule->getVar('name').']'; |
|
| 203 | 203 | $xoopsTpl->assign('forum_id', $forumObject->getVar('forum_id')); |
| 204 | 204 | // irmtfan new method |
| 205 | 205 | if (!empty($GLOBALS['xoopsModuleConfig']['rss_enable'])) { |
| 206 | 206 | $xoopsTpl->assign('xoops_module_header', ' |
| 207 | - <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 . '" /> |
|
| 207 | + <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.'" /> |
|
| 208 | 208 | ' . @$xoopsTpl->get_template_vars('xoops_module_header')); |
| 209 | 209 | } |
| 210 | 210 | } elseif (!empty($GLOBALS['xoopsModuleConfig']['rss_enable'])) { |
| 211 | 211 | $xoopsTpl->assign('xoops_module_header', ' |
| 212 | - <link rel="alternate" type="application/xml+rss" title="' . $xoopsModule->getVar('name') . '" href="' . XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/rss.php" /> |
|
| 212 | + <link rel="alternate" type="application/xml+rss" title="' . $xoopsModule->getVar('name').'" href="'.XOOPS_URL.'/modules/'.$xoopsModule->getVar('dirname').'/rss.php" /> |
|
| 213 | 213 | ' . @$xoopsTpl->get_template_vars('xoops_module_header')); |
| 214 | 214 | } |
| 215 | 215 | // irmtfan remove and move to footer.php |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | /** @var \XoopsMembershipHandler $memberHandler */ |
| 223 | 223 | $memberHandler = xoops_getHandler('member'); |
| 224 | 224 | $userid_array = array_keys($poster_array); |
| 225 | - $user_criteria = '(' . implode(',', $userid_array) . ')'; |
|
| 225 | + $user_criteria = '('.implode(',', $userid_array).')'; |
|
| 226 | 226 | $users = $memberHandler->getUsers(new \Criteria('uid', $user_criteria, 'IN'), true); |
| 227 | 227 | } else { |
| 228 | 228 | $user_criteria = ''; |
@@ -260,9 +260,9 @@ discard block |
||
| 260 | 260 | $post_title = $post->getVar('subject'); |
| 261 | 261 | |
| 262 | 262 | if ($posticon = $post->getVar('icon')) { |
| 263 | - $post_image = '<a name="' . $post->getVar('post_id') . '"><img src="' . XOOPS_URL . '/images/subject/' . htmlspecialchars($posticon, ENT_QUOTES | ENT_HTML5) . '" alt="" /></a>'; |
|
| 263 | + $post_image = '<a name="'.$post->getVar('post_id').'"><img src="'.XOOPS_URL.'/images/subject/'.htmlspecialchars($posticon, ENT_QUOTES | ENT_HTML5).'" alt="" /></a>'; |
|
| 264 | 264 | } else { |
| 265 | - $post_image = '<a name="' . $post->getVar('post_id') . '"><img src="' . XOOPS_URL . '/images/icons/no_posticon.gif" alt="" /></a>'; |
|
| 265 | + $post_image = '<a name="'.$post->getVar('post_id').'"><img src="'.XOOPS_URL.'/images/icons/no_posticon.gif" alt="" /></a>'; |
|
| 266 | 266 | } |
| 267 | 267 | $poster = [ |
| 268 | 268 | 'uid' => 0, |
@@ -276,10 +276,10 @@ discard block |
||
| 276 | 276 | $post_text = $post->getVar('post_text'); |
| 277 | 277 | $post_attachment = $post->displayAttachment(); |
| 278 | 278 | } elseif ($GLOBALS['xoopsModuleConfig']['enable_karma'] && $post->getVar('post_karma') > $user_karma) { |
| 279 | - $post_text = "<div class='karma'>" . sprintf(_MD_NEWBB_KARMA_REQUIREMENT, $user_karma, $post->getVar('post_karma')) . '</div>'; |
|
| 279 | + $post_text = "<div class='karma'>".sprintf(_MD_NEWBB_KARMA_REQUIREMENT, $user_karma, $post->getVar('post_karma')).'</div>'; |
|
| 280 | 280 | $post_attachment = ''; |
| 281 | 281 | } elseif ($GLOBALS['xoopsModuleConfig']['allow_require_reply'] && $post->getVar('require_reply')) { |
| 282 | - $post_text = "<div class='karma'>" . _MD_NEWBB_REPLY_REQUIREMENT . '</div>'; |
|
| 282 | + $post_text = "<div class='karma'>"._MD_NEWBB_REPLY_REQUIREMENT.'</div>'; |
|
| 283 | 283 | $post_attachment = ''; |
| 284 | 284 | } else { |
| 285 | 285 | $post_text = $post->getVar('post_text'); |
@@ -299,40 +299,40 @@ discard block |
||
| 299 | 299 | || (!$suspension[$post->getVar('forum_id')] && $post->checkIdentity() |
| 300 | 300 | && $post->checkTimelimit('delete_timelimit'))) { |
| 301 | 301 | $thread_buttons['delete']['image'] = newbbDisplayImage('p_delete', _DELETE); |
| 302 | - $thread_buttons['delete']['link'] = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/delete.php?forum=' . $post->getVar('forum_id') . '&topic_id=' . $post->getVar('topic_id'); |
|
| 302 | + $thread_buttons['delete']['link'] = XOOPS_URL.'/modules/'.$xoopsModule->getVar('dirname').'/delete.php?forum='.$post->getVar('forum_id').'&topic_id='.$post->getVar('topic_id'); |
|
| 303 | 303 | $thread_buttons['delete']['name'] = _DELETE; |
| 304 | 304 | } |
| 305 | 305 | if ($isAdmin |
| 306 | 306 | || !$suspension[$post->getVar('forum_id')] && $post->checkIdentity() |
| 307 | 307 | && $post->checkTimelimit('edit_timelimit')) { |
| 308 | 308 | $thread_buttons['edit']['image'] = newbbDisplayImage('p_edit', _EDIT); |
| 309 | - $thread_buttons['edit']['link'] = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/edit.php?forum=' . $post->getVar('forum_id') . '&topic_id=' . $post->getVar('topic_id'); |
|
| 309 | + $thread_buttons['edit']['link'] = XOOPS_URL.'/modules/'.$xoopsModule->getVar('dirname').'/edit.php?forum='.$post->getVar('forum_id').'&topic_id='.$post->getVar('topic_id'); |
|
| 310 | 310 | $thread_buttons['edit']['name'] = _EDIT; |
| 311 | 311 | } |
| 312 | 312 | if (is_object($GLOBALS['xoopsUser']) && !$suspension[$post->getVar('forum_id')]) { |
| 313 | 313 | $thread_buttons['reply']['image'] = newbbDisplayImage('p_reply', _MD_NEWBB_REPLY); |
| 314 | - $thread_buttons['reply']['link'] = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/reply.php?forum=' . $post->getVar('forum_id') . '&topic_id=' . $post->getVar('topic_id'); |
|
| 314 | + $thread_buttons['reply']['link'] = XOOPS_URL.'/modules/'.$xoopsModule->getVar('dirname').'/reply.php?forum='.$post->getVar('forum_id').'&topic_id='.$post->getVar('topic_id'); |
|
| 315 | 315 | $thread_buttons['reply']['name'] = _MD_NEWBB_REPLY; |
| 316 | 316 | |
| 317 | 317 | $thread_buttons['quote']['image'] = newbbDisplayImage('p_quote', _MD_NEWBB_QUOTE); |
| 318 | - $thread_buttons['quote']['link'] = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/reply.php?forum=' . $post->getVar('forum_id') . '&topic_id=' . $post->getVar('topic_id') . '&quotedac=1'; |
|
| 318 | + $thread_buttons['quote']['link'] = XOOPS_URL.'/modules/'.$xoopsModule->getVar('dirname').'/reply.php?forum='.$post->getVar('forum_id').'&topic_id='.$post->getVar('topic_id').'&quotedac=1'; |
|
| 319 | 319 | $thread_buttons['quote']['name'] = _MD_NEWBB_QUOTE; |
| 320 | 320 | } |
| 321 | 321 | } else { |
| 322 | 322 | $thread_buttons['delete']['image'] = newbbDisplayImage('p_delete', _DELETE); |
| 323 | - $thread_buttons['delete']['link'] = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/delete.php?forum=' . $post->getVar('forum_id') . '&topic_id=' . $post->getVar('topic_id'); |
|
| 323 | + $thread_buttons['delete']['link'] = XOOPS_URL.'/modules/'.$xoopsModule->getVar('dirname').'/delete.php?forum='.$post->getVar('forum_id').'&topic_id='.$post->getVar('topic_id'); |
|
| 324 | 324 | $thread_buttons['delete']['name'] = _DELETE; |
| 325 | 325 | $thread_buttons['edit']['image'] = newbbDisplayImage('p_edit', _EDIT); |
| 326 | - $thread_buttons['edit']['link'] = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/edit.php?forum=' . $post->getVar('forum_id') . '&topic_id=' . $post->getVar('topic_id'); |
|
| 326 | + $thread_buttons['edit']['link'] = XOOPS_URL.'/modules/'.$xoopsModule->getVar('dirname').'/edit.php?forum='.$post->getVar('forum_id').'&topic_id='.$post->getVar('topic_id'); |
|
| 327 | 327 | $thread_buttons['edit']['name'] = _EDIT; |
| 328 | 328 | $thread_buttons['reply']['image'] = newbbDisplayImage('p_reply', _MD_NEWBB_REPLY); |
| 329 | - $thread_buttons['reply']['link'] = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/reply.php?forum=' . $post->getVar('forum_id') . '&topic_id=' . $post->getVar('topic_id'); |
|
| 329 | + $thread_buttons['reply']['link'] = XOOPS_URL.'/modules/'.$xoopsModule->getVar('dirname').'/reply.php?forum='.$post->getVar('forum_id').'&topic_id='.$post->getVar('topic_id'); |
|
| 330 | 330 | $thread_buttons['reply']['name'] = _MD_NEWBB_REPLY; |
| 331 | 331 | } |
| 332 | 332 | |
| 333 | 333 | if (!$isAdmin && $GLOBALS['xoopsModuleConfig']['reportmod_enabled']) { |
| 334 | 334 | $thread_buttons['report']['image'] = newbbDisplayImage('p_report', _MD_NEWBB_REPORT); |
| 335 | - $thread_buttons['report']['link'] = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/report.php?forum=' . $post->getVar('forum_id') . '&topic_id=' . $post->getVar('topic_id'); |
|
| 335 | + $thread_buttons['report']['link'] = XOOPS_URL.'/modules/'.$xoopsModule->getVar('dirname').'/report.php?forum='.$post->getVar('forum_id').'&topic_id='.$post->getVar('topic_id'); |
|
| 336 | 336 | $thread_buttons['report']['name'] = _MD_NEWBB_REPORT; |
| 337 | 337 | } |
| 338 | 338 | $thread_action = []; |
@@ -361,13 +361,13 @@ discard block |
||
| 361 | 361 | unset($viewtopic_users, $forums); |
| 362 | 362 | |
| 363 | 363 | if (!empty($GLOBALS['xoopsModuleConfig']['show_jump'])) { |
| 364 | - require_once __DIR__ . '/include/functions.forum.php'; |
|
| 364 | + require_once __DIR__.'/include/functions.forum.php'; |
|
| 365 | 365 | $xoopsTpl->assign('forum_jumpbox', newbbMakeJumpbox($forum_id)); |
| 366 | 366 | } |
| 367 | 367 | |
| 368 | 368 | if ($postCount > $post_perpage) { |
| 369 | 369 | require_once $GLOBALS['xoops']->path('class/pagenav.php'); |
| 370 | - $nav = new \XoopsPageNav($postCount, $post_perpage, $start, 'start', 'forum=' . $forum_id . '&viewmode=' . $viewmode . '&status=' . $status . '&uid=' . $uid . '&order=' . $order . '&mode=' . $mode); |
|
| 370 | + $nav = new \XoopsPageNav($postCount, $post_perpage, $start, 'start', 'forum='.$forum_id.'&viewmode='.$viewmode.'&status='.$status.'&uid='.$uid.'&order='.$order.'&mode='.$mode); |
|
| 371 | 371 | //if (isset($GLOBALS['xoopsModuleConfig']['do_rewrite'])) $nav->url = formatURL(Request::getString('SERVER_NAME', '', 'SERVER')) . $nav->url; |
| 372 | 372 | if ('select' === $GLOBALS['xoopsModuleConfig']['pagenav_display']) { |
| 373 | 373 | $navi = $nav->renderSelect(); |
@@ -386,13 +386,13 @@ discard block |
||
| 386 | 386 | |
| 387 | 387 | switch ($status) { |
| 388 | 388 | case 'active': |
| 389 | - $lang_title = _MD_NEWBB_VIEWALLPOSTS . ' [' . _MD_NEWBB_TYPE_ADMIN . ']'; |
|
| 389 | + $lang_title = _MD_NEWBB_VIEWALLPOSTS.' ['._MD_NEWBB_TYPE_ADMIN.']'; |
|
| 390 | 390 | break; |
| 391 | 391 | case 'pending': |
| 392 | - $lang_title = _MD_NEWBB_VIEWALLPOSTS . ' [' . _MD_NEWBB_TYPE_PENDING . ']'; |
|
| 392 | + $lang_title = _MD_NEWBB_VIEWALLPOSTS.' ['._MD_NEWBB_TYPE_PENDING.']'; |
|
| 393 | 393 | break; |
| 394 | 394 | case 'deleted': |
| 395 | - $lang_title = _MD_NEWBB_VIEWALLPOSTS . ' [' . _MD_NEWBB_TYPE_DELETED . ']'; |
|
| 395 | + $lang_title = _MD_NEWBB_VIEWALLPOSTS.' ['._MD_NEWBB_TYPE_DELETED.']'; |
|
| 396 | 396 | break; |
| 397 | 397 | case 'new': |
| 398 | 398 | $lang_title = _MD_NEWBB_NEWPOSTS; |
@@ -402,7 +402,7 @@ discard block |
||
| 402 | 402 | break; |
| 403 | 403 | } |
| 404 | 404 | if ($uid > 0) { |
| 405 | - $lang_title .= ' (' . \XoopsUser::getUnameFromId($uid) . ')'; |
|
| 405 | + $lang_title .= ' ('.\XoopsUser::getUnameFromId($uid).')'; |
|
| 406 | 406 | } |
| 407 | 407 | $xoopsTpl->assign('lang_title', $lang_title); |
| 408 | 408 | // irmtfan up to p_up |
@@ -411,12 +411,12 @@ discard block |
||
| 411 | 411 | $xoopsTpl->assign('anonymous_prefix', $GLOBALS['xoopsModuleConfig']['anonymous_prefix']); |
| 412 | 412 | $xoopsTpl->assign('down', newbbDisplayImage('down', _MD_NEWBB_BOTTOM)); |
| 413 | 413 | |
| 414 | -$all_link = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/viewpost.php?forum=' . $forum_id . "&start=$start"; |
|
| 415 | -$post_link = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/viewpost.php?forum=' . $forum_id; |
|
| 416 | -$newpost_link = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/viewpost.php?forum=' . $forum_id . '&status=new'; |
|
| 417 | -$digest_link = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/viewpost.php?forum=' . $forum_id . "&start=$start&status=digest"; |
|
| 418 | -$unreplied_link = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/viewpost.php?forum=' . $forum_id . "&start=$start&status=unreplied"; |
|
| 419 | -$unread_link = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/viewpost.php?forum=' . $forum_id . "&start=$start&status=unread"; |
|
| 414 | +$all_link = XOOPS_URL.'/modules/'.$xoopsModule->getVar('dirname').'/viewpost.php?forum='.$forum_id."&start=$start"; |
|
| 415 | +$post_link = XOOPS_URL.'/modules/'.$xoopsModule->getVar('dirname').'/viewpost.php?forum='.$forum_id; |
|
| 416 | +$newpost_link = XOOPS_URL.'/modules/'.$xoopsModule->getVar('dirname').'/viewpost.php?forum='.$forum_id.'&status=new'; |
|
| 417 | +$digest_link = XOOPS_URL.'/modules/'.$xoopsModule->getVar('dirname').'/viewpost.php?forum='.$forum_id."&start=$start&status=digest"; |
|
| 418 | +$unreplied_link = XOOPS_URL.'/modules/'.$xoopsModule->getVar('dirname').'/viewpost.php?forum='.$forum_id."&start=$start&status=unreplied"; |
|
| 419 | +$unread_link = XOOPS_URL.'/modules/'.$xoopsModule->getVar('dirname').'/viewpost.php?forum='.$forum_id."&start=$start&status=unread"; |
|
| 420 | 420 | |
| 421 | 421 | $xoopsTpl->assign('all_link', $all_link); |
| 422 | 422 | $xoopsTpl->assign('post_link', $post_link); |
@@ -428,12 +428,12 @@ discard block |
||
| 428 | 428 | $viewmode_options = []; |
| 429 | 429 | if ('DESC' === $order) { |
| 430 | 430 | $viewmode_options[] = [ |
| 431 | - 'link' => XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/viewpost.php?viewmode=flat&order=ASC&forum=' . $forum_id, |
|
| 431 | + 'link' => XOOPS_URL.'/modules/'.$xoopsModule->getVar('dirname').'/viewpost.php?viewmode=flat&order=ASC&forum='.$forum_id, |
|
| 432 | 432 | 'title' => _OLDESTFIRST |
| 433 | 433 | ]; |
| 434 | 434 | } else { |
| 435 | 435 | $viewmode_options[] = [ |
| 436 | - 'link' => XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/viewpost.php?viewmode=flat&order=DESC&forum=' . $forum_id, |
|
| 436 | + 'link' => XOOPS_URL.'/modules/'.$xoopsModule->getVar('dirname').'/viewpost.php?viewmode=flat&order=DESC&forum='.$forum_id, |
|
| 437 | 437 | 'title' => _NEWESTFIRST |
| 438 | 438 | ]; |
| 439 | 439 | } |
@@ -448,5 +448,5 @@ discard block |
||
| 448 | 448 | $xoopsTpl->assign('mode', $mode); |
| 449 | 449 | $xoopsTpl->assign('status', $status); |
| 450 | 450 | // irmtfan move to footer.php |
| 451 | -require_once __DIR__ . '/footer.php'; |
|
| 451 | +require_once __DIR__.'/footer.php'; |
|
| 452 | 452 | require_once $GLOBALS['xoops']->path('footer.php'); |
@@ -37,48 +37,48 @@ discard block |
||
| 37 | 37 | $anonwaitdays = 1; |
| 38 | 38 | $ip = \Xmf\IPAddress::fromRequest()->asReadable(); |
| 39 | 39 | foreach (['topic_id', 'rate', 'forum'] as $var) { |
| 40 | - // ${$var} = isset($_POST[$var]) ? (int)($_POST[$var]) : (isset($_GET[$var])?(int)($_GET[$var]):0); |
|
| 41 | - ${$var} = Request::getInt($var, Request::getInt($var, 0, 'POST'), 'GET'); |
|
| 40 | + // ${$var} = isset($_POST[$var]) ? (int)($_POST[$var]) : (isset($_GET[$var])?(int)($_GET[$var]):0); |
|
| 41 | + ${$var} = Request::getInt($var, Request::getInt($var, 0, 'POST'), 'GET'); |
|
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | ///** @var Newbb\TopicHandler $topicHandler */ |
| 45 | 45 | //$topicHandler = Newbb\Helper::getInstance()->getHandler('Topic'); |
| 46 | 46 | $topicObject = $topicHandler->get($topic_id); |
| 47 | 47 | if (!$topicHandler->getPermission($topicObject->getVar('forum_id'), $topicObject->getVar('topic_status'), 'post') |
| 48 | - && !$topicHandler->getPermission($topicObject->getVar('forum_id'), $topicObject->getVar('topic_status'), 'reply')) { |
|
| 49 | - // irmtfan - issue with javascript:history.go(-1) |
|
| 50 | - redirect_header(Request::getString('HTTP_REFERER', '', 'SERVER'), 2, _NOPERM); |
|
| 48 | + && !$topicHandler->getPermission($topicObject->getVar('forum_id'), $topicObject->getVar('topic_status'), 'reply')) { |
|
| 49 | + // irmtfan - issue with javascript:history.go(-1) |
|
| 50 | + redirect_header(Request::getString('HTTP_REFERER', '', 'SERVER'), 2, _NOPERM); |
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | if (empty($rate)) { |
| 54 | - redirect_header('viewtopic.php?topic_id=' . $topic_id . '&forum=' . $forum . '', 4, _MD_NEWBB_NOVOTERATE); |
|
| 54 | + redirect_header('viewtopic.php?topic_id=' . $topic_id . '&forum=' . $forum . '', 4, _MD_NEWBB_NOVOTERATE); |
|
| 55 | 55 | } |
| 56 | 56 | ///** @var Newbb\RateHandler $rateHandler */ |
| 57 | 57 | //$rateHandler = Newbb\Helper::getInstance()->getHandler('Rate'); |
| 58 | 58 | if (0 !== $ratinguser) { |
| 59 | - // Check if Topic POSTER is voting (UNLESS Anonymous users allowed to post) |
|
| 60 | - $crit_post = new \CriteriaCompo(new \Criteria('topic_id', $topic_id)); |
|
| 61 | - $crit_post->add(new \Criteria('uid', $ratinguser)); |
|
| 62 | - // /** @var Newbb\PostHandler $postHandler */ |
|
| 63 | - // $postHandler = Newbb\Helper::getInstance()->getHandler('Post'); |
|
| 64 | - if ($postHandler->getCount($crit_post)) { |
|
| 65 | - redirect_header('viewtopic.php?topic_id=' . $topic_id . '&forum=' . $forum . '', 4, _MD_NEWBB_CANTVOTEOWN); |
|
| 66 | - } |
|
| 67 | - // Check if REG user is trying to vote twice. |
|
| 68 | - $crit_rate = new \CriteriaCompo(new \Criteria('topic_id', $topic_id)); |
|
| 69 | - $crit_rate->add(new \Criteria('ratinguser', $ratinguser)); |
|
| 70 | - if ($rateHandler->getCount($crit_rate)) { |
|
| 71 | - redirect_header('viewtopic.php?topic_id=' . $topic_id . '&forum=' . $forum . '', 4, _MD_NEWBB_VOTEONCE); |
|
| 72 | - } |
|
| 59 | + // Check if Topic POSTER is voting (UNLESS Anonymous users allowed to post) |
|
| 60 | + $crit_post = new \CriteriaCompo(new \Criteria('topic_id', $topic_id)); |
|
| 61 | + $crit_post->add(new \Criteria('uid', $ratinguser)); |
|
| 62 | + // /** @var Newbb\PostHandler $postHandler */ |
|
| 63 | + // $postHandler = Newbb\Helper::getInstance()->getHandler('Post'); |
|
| 64 | + if ($postHandler->getCount($crit_post)) { |
|
| 65 | + redirect_header('viewtopic.php?topic_id=' . $topic_id . '&forum=' . $forum . '', 4, _MD_NEWBB_CANTVOTEOWN); |
|
| 66 | + } |
|
| 67 | + // Check if REG user is trying to vote twice. |
|
| 68 | + $crit_rate = new \CriteriaCompo(new \Criteria('topic_id', $topic_id)); |
|
| 69 | + $crit_rate->add(new \Criteria('ratinguser', $ratinguser)); |
|
| 70 | + if ($rateHandler->getCount($crit_rate)) { |
|
| 71 | + redirect_header('viewtopic.php?topic_id=' . $topic_id . '&forum=' . $forum . '', 4, _MD_NEWBB_VOTEONCE); |
|
| 72 | + } |
|
| 73 | 73 | } else { |
| 74 | - // Check if ANONYMOUS user is trying to vote more than once per day. |
|
| 75 | - $crit_rate = new \CriteriaCompo(new \Criteria('topic_id', $topic_id)); |
|
| 76 | - $crit_rate->add(new \Criteria('ratinguser', $ratinguser)); |
|
| 77 | - $crit_rate->add(new \Criteria('ratinghostname', $ip)); |
|
| 78 | - $crit_rate->add(new \Criteria('ratingtimestamp', time() - (86400 * $anonwaitdays), '>')); |
|
| 79 | - if ($rateHandler->getCount($crit_rate)) { |
|
| 80 | - redirect_header('viewtopic.php?topic_id=' . $topic_id . '&forum=' . $forum . '', 4, _MD_NEWBB_VOTEONCE); |
|
| 81 | - } |
|
| 74 | + // Check if ANONYMOUS user is trying to vote more than once per day. |
|
| 75 | + $crit_rate = new \CriteriaCompo(new \Criteria('topic_id', $topic_id)); |
|
| 76 | + $crit_rate->add(new \Criteria('ratinguser', $ratinguser)); |
|
| 77 | + $crit_rate->add(new \Criteria('ratinghostname', $ip)); |
|
| 78 | + $crit_rate->add(new \Criteria('ratingtimestamp', time() - (86400 * $anonwaitdays), '>')); |
|
| 79 | + if ($rateHandler->getCount($crit_rate)) { |
|
| 80 | + redirect_header('viewtopic.php?topic_id=' . $topic_id . '&forum=' . $forum . '', 4, _MD_NEWBB_VOTEONCE); |
|
| 81 | + } |
|
| 82 | 82 | } |
| 83 | 83 | $rateObject = $rateHandler->create(); |
| 84 | 84 | $rateObject->setVar('rating', $rate * 2); |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | $votesDB = $GLOBALS['xoopsDB']->getRowsNum($voteresult); |
| 95 | 95 | $totalrating = 0; |
| 96 | 96 | while (false !== (list($rating) = $GLOBALS['xoopsDB']->fetchRow($voteresult))) { |
| 97 | - $totalrating += $rating; |
|
| 97 | + $totalrating += $rating; |
|
| 98 | 98 | } |
| 99 | 99 | $finalrating = $totalrating / $votesDB; |
| 100 | 100 | $finalrating = number_format($finalrating, 4); |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | |
| 32 | 32 | use Xmf\Request; |
| 33 | 33 | |
| 34 | -require_once __DIR__ . '/header.php'; |
|
| 34 | +require_once __DIR__.'/header.php'; |
|
| 35 | 35 | |
| 36 | 36 | $ratinguser = is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->getVar('uid') : 0; |
| 37 | 37 | $anonwaitdays = 1; |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | if (empty($rate)) { |
| 54 | - redirect_header('viewtopic.php?topic_id=' . $topic_id . '&forum=' . $forum . '', 4, _MD_NEWBB_NOVOTERATE); |
|
| 54 | + redirect_header('viewtopic.php?topic_id='.$topic_id.'&forum='.$forum.'', 4, _MD_NEWBB_NOVOTERATE); |
|
| 55 | 55 | } |
| 56 | 56 | ///** @var Newbb\RateHandler $rateHandler */ |
| 57 | 57 | //$rateHandler = Newbb\Helper::getInstance()->getHandler('Rate'); |
@@ -62,13 +62,13 @@ discard block |
||
| 62 | 62 | // /** @var Newbb\PostHandler $postHandler */ |
| 63 | 63 | // $postHandler = Newbb\Helper::getInstance()->getHandler('Post'); |
| 64 | 64 | if ($postHandler->getCount($crit_post)) { |
| 65 | - redirect_header('viewtopic.php?topic_id=' . $topic_id . '&forum=' . $forum . '', 4, _MD_NEWBB_CANTVOTEOWN); |
|
| 65 | + redirect_header('viewtopic.php?topic_id='.$topic_id.'&forum='.$forum.'', 4, _MD_NEWBB_CANTVOTEOWN); |
|
| 66 | 66 | } |
| 67 | 67 | // Check if REG user is trying to vote twice. |
| 68 | 68 | $crit_rate = new \CriteriaCompo(new \Criteria('topic_id', $topic_id)); |
| 69 | 69 | $crit_rate->add(new \Criteria('ratinguser', $ratinguser)); |
| 70 | 70 | if ($rateHandler->getCount($crit_rate)) { |
| 71 | - redirect_header('viewtopic.php?topic_id=' . $topic_id . '&forum=' . $forum . '', 4, _MD_NEWBB_VOTEONCE); |
|
| 71 | + redirect_header('viewtopic.php?topic_id='.$topic_id.'&forum='.$forum.'', 4, _MD_NEWBB_VOTEONCE); |
|
| 72 | 72 | } |
| 73 | 73 | } else { |
| 74 | 74 | // Check if ANONYMOUS user is trying to vote more than once per day. |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | $crit_rate->add(new \Criteria('ratinghostname', $ip)); |
| 78 | 78 | $crit_rate->add(new \Criteria('ratingtimestamp', time() - (86400 * $anonwaitdays), '>')); |
| 79 | 79 | if ($rateHandler->getCount($crit_rate)) { |
| 80 | - redirect_header('viewtopic.php?topic_id=' . $topic_id . '&forum=' . $forum . '', 4, _MD_NEWBB_VOTEONCE); |
|
| 80 | + redirect_header('viewtopic.php?topic_id='.$topic_id.'&forum='.$forum.'', 4, _MD_NEWBB_VOTEONCE); |
|
| 81 | 81 | } |
| 82 | 82 | } |
| 83 | 83 | $rateObject = $rateHandler->create(); |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | |
| 90 | 90 | $ratingid = $rateHandler->insert($rateObject); |
| 91 | 91 | |
| 92 | -$query = 'SELECT rating FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_votedata') . ' WHERE topic_id = ' . $topic_id . ' '; |
|
| 92 | +$query = 'SELECT rating FROM '.$GLOBALS['xoopsDB']->prefix('newbb_votedata').' WHERE topic_id = '.$topic_id.' '; |
|
| 93 | 93 | $voteresult = $GLOBALS['xoopsDB']->query($query); |
| 94 | 94 | $votesDB = $GLOBALS['xoopsDB']->getRowsNum($voteresult); |
| 95 | 95 | $totalrating = 0; |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | $sql = sprintf('UPDATE "%s" SET rating = "%u", votes = "%u" WHERE topic_id = "%u"', $GLOBALS['xoopsDB']->prefix('newbb_topics'), $finalrating, $votesDB, $topic_id); |
| 102 | 102 | $GLOBALS['xoopsDB']->queryF($sql); |
| 103 | 103 | |
| 104 | -$ratemessage = _MD_NEWBB_VOTEAPPRE . '<br>' . sprintf(_MD_NEWBB_THANKYOU, $GLOBALS['xoopsConfig']['sitename']); |
|
| 105 | -redirect_header('viewtopic.php?topic_id=' . $topic_id . '&forum=' . $forum . '', 2, $ratemessage); |
|
| 104 | +$ratemessage = _MD_NEWBB_VOTEAPPRE.'<br>'.sprintf(_MD_NEWBB_THANKYOU, $GLOBALS['xoopsConfig']['sitename']); |
|
| 105 | +redirect_header('viewtopic.php?topic_id='.$topic_id.'&forum='.$forum.'', 2, $ratemessage); |
|
| 106 | 106 | // irmtfan enhance include footer.php |
| 107 | 107 | require_once $GLOBALS['xoops']->path('footer.php'); |
@@ -23,42 +23,42 @@ discard block |
||
| 23 | 23 | //require_once $GLOBALS['xoops']->path('header.php'); |
| 24 | 24 | |
| 25 | 25 | if (!empty($GLOBALS['xoopsModuleConfig']['do_rewrite'])) { |
| 26 | - require_once __DIR__ . '/seo_url.php'; |
|
| 27 | - /* for seo */ |
|
| 28 | - $toseo_url = ['index.php', 'viewforum.php', 'viewtopic.php', 'rss.php']; |
|
| 26 | + require_once __DIR__ . '/seo_url.php'; |
|
| 27 | + /* for seo */ |
|
| 28 | + $toseo_url = ['index.php', 'viewforum.php', 'viewtopic.php', 'rss.php']; |
|
| 29 | 29 | |
| 30 | - if (!empty($GLOBALS['xoopsModuleConfig']['do_rewrite']) && (!isset($_POST) || count($_POST) <= 0) |
|
| 31 | - && (false === strpos(getenv('REQUEST_URI'), '.html'))) { |
|
| 32 | - $redir = false; |
|
| 33 | - if (true === strpos(getenv('REQUEST_URI'), 'mark_read=') || true === strpos(getenv('REQUEST_URI'), 'mark=')) { |
|
| 34 | - // Mark Forums |
|
| 35 | - } else { |
|
| 36 | - if (in_array(basename(getenv('SCRIPT_NAME')), $toseo_url)) { |
|
| 37 | - //rewrite only for files |
|
| 30 | + if (!empty($GLOBALS['xoopsModuleConfig']['do_rewrite']) && (!isset($_POST) || count($_POST) <= 0) |
|
| 31 | + && (false === strpos(getenv('REQUEST_URI'), '.html'))) { |
|
| 32 | + $redir = false; |
|
| 33 | + if (true === strpos(getenv('REQUEST_URI'), 'mark_read=') || true === strpos(getenv('REQUEST_URI'), 'mark=')) { |
|
| 34 | + // Mark Forums |
|
| 35 | + } else { |
|
| 36 | + if (in_array(basename(getenv('SCRIPT_NAME')), $toseo_url)) { |
|
| 37 | + //rewrite only for files |
|
| 38 | 38 | |
| 39 | - if ('' !== trim(getenv('SCRIPT_NAME'))) { |
|
| 40 | - if (false === strpos(getenv('REQUEST_URI'), '/' . SEO_MODULE_NAME . '/')) { |
|
| 41 | - $redir = true; |
|
| 42 | - } elseif (getenv('QUERY_STRING')) { |
|
| 43 | - $redir = true; |
|
| 44 | - } |
|
| 45 | - } |
|
| 46 | - } |
|
| 47 | - } |
|
| 39 | + if ('' !== trim(getenv('SCRIPT_NAME'))) { |
|
| 40 | + if (false === strpos(getenv('REQUEST_URI'), '/' . SEO_MODULE_NAME . '/')) { |
|
| 41 | + $redir = true; |
|
| 42 | + } elseif (getenv('QUERY_STRING')) { |
|
| 43 | + $redir = true; |
|
| 44 | + } |
|
| 45 | + } |
|
| 46 | + } |
|
| 47 | + } |
|
| 48 | 48 | |
| 49 | - if (true === $redir) { |
|
| 50 | - $s = 'http://' . getenv('HTTP_HOST') . getenv('REQUEST_URI'); |
|
| 51 | - $s = str_replace('/' . REAL_MODULE_NAME . '/', '/' . SEO_MODULE_NAME . '/', $s); |
|
| 52 | - $newurl = seo_urls('<a href="' . $s . '"></a>'); |
|
| 53 | - $newurl = str_replace('<a href="', '', $newurl); |
|
| 54 | - $newurl = str_replace('"></a>', '', $newurl); |
|
| 55 | - if (!headers_sent()) { |
|
| 56 | - header('HTTP/1.1 301 Moved Permanently'); |
|
| 57 | - header("Location: $newurl"); |
|
| 58 | - exit(); |
|
| 59 | - } |
|
| 60 | - } |
|
| 61 | - } |
|
| 49 | + if (true === $redir) { |
|
| 50 | + $s = 'http://' . getenv('HTTP_HOST') . getenv('REQUEST_URI'); |
|
| 51 | + $s = str_replace('/' . REAL_MODULE_NAME . '/', '/' . SEO_MODULE_NAME . '/', $s); |
|
| 52 | + $newurl = seo_urls('<a href="' . $s . '"></a>'); |
|
| 53 | + $newurl = str_replace('<a href="', '', $newurl); |
|
| 54 | + $newurl = str_replace('"></a>', '', $newurl); |
|
| 55 | + if (!headers_sent()) { |
|
| 56 | + header('HTTP/1.1 301 Moved Permanently'); |
|
| 57 | + header("Location: $newurl"); |
|
| 58 | + exit(); |
|
| 59 | + } |
|
| 60 | + } |
|
| 61 | + } |
|
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | require_once $GLOBALS['xoops']->path('modules/' . $moduleDirName . '/include/vars.php'); |
@@ -81,8 +81,8 @@ discard block |
||
| 81 | 81 | //} |
| 82 | 82 | |
| 83 | 83 | if (is_object($GLOBALS['xoopsUser']) && !empty($GLOBALS['xoopsModuleConfig']['welcome_forum']) |
| 84 | - && !$GLOBALS['xoopsUser']->getVar('posts')) { |
|
| 85 | - require_once __DIR__ . '/include/functions.welcome.php'; |
|
| 84 | + && !$GLOBALS['xoopsUser']->getVar('posts')) { |
|
| 85 | + require_once __DIR__ . '/include/functions.welcome.php'; |
|
| 86 | 86 | } |
| 87 | 87 | // irmtfan for backward compatibility |
| 88 | 88 | $pollmodules = $GLOBALS['xoopsModuleConfig']['poll_module']; |
@@ -11,8 +11,8 @@ discard block |
||
| 11 | 11 | |
| 12 | 12 | use Xmf\Request; |
| 13 | 13 | |
| 14 | -require_once dirname(dirname(__DIR__)) . '/mainfile.php'; |
|
| 15 | -require_once __DIR__ . '/include/common.php'; |
|
| 14 | +require_once dirname(dirname(__DIR__)).'/mainfile.php'; |
|
| 15 | +require_once __DIR__.'/include/common.php'; |
|
| 16 | 16 | |
| 17 | 17 | // defined('XOOPS_ROOT_PATH') || die('Restricted access'); |
| 18 | 18 | /** @var \XoopsLogger $xoopsLogger */ |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | //require_once $GLOBALS['xoops']->path('header.php'); |
| 24 | 24 | |
| 25 | 25 | if (!empty($GLOBALS['xoopsModuleConfig']['do_rewrite'])) { |
| 26 | - require_once __DIR__ . '/seo_url.php'; |
|
| 26 | + require_once __DIR__.'/seo_url.php'; |
|
| 27 | 27 | /* for seo */ |
| 28 | 28 | $toseo_url = ['index.php', 'viewforum.php', 'viewtopic.php', 'rss.php']; |
| 29 | 29 | |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | //rewrite only for files |
| 38 | 38 | |
| 39 | 39 | if ('' !== trim(getenv('SCRIPT_NAME'))) { |
| 40 | - if (false === strpos(getenv('REQUEST_URI'), '/' . SEO_MODULE_NAME . '/')) { |
|
| 40 | + if (false === strpos(getenv('REQUEST_URI'), '/'.SEO_MODULE_NAME.'/')) { |
|
| 41 | 41 | $redir = true; |
| 42 | 42 | } elseif (getenv('QUERY_STRING')) { |
| 43 | 43 | $redir = true; |
@@ -47,9 +47,9 @@ discard block |
||
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | if (true === $redir) { |
| 50 | - $s = 'http://' . getenv('HTTP_HOST') . getenv('REQUEST_URI'); |
|
| 51 | - $s = str_replace('/' . REAL_MODULE_NAME . '/', '/' . SEO_MODULE_NAME . '/', $s); |
|
| 52 | - $newurl = seo_urls('<a href="' . $s . '"></a>'); |
|
| 50 | + $s = 'http://'.getenv('HTTP_HOST').getenv('REQUEST_URI'); |
|
| 51 | + $s = str_replace('/'.REAL_MODULE_NAME.'/', '/'.SEO_MODULE_NAME.'/', $s); |
|
| 52 | + $newurl = seo_urls('<a href="'.$s.'"></a>'); |
|
| 53 | 53 | $newurl = str_replace('<a href="', '', $newurl); |
| 54 | 54 | $newurl = str_replace('"></a>', '', $newurl); |
| 55 | 55 | if (!headers_sent()) { |
@@ -61,10 +61,10 @@ discard block |
||
| 61 | 61 | } |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | -require_once $GLOBALS['xoops']->path('modules/' . $moduleDirName . '/include/vars.php'); |
|
| 64 | +require_once $GLOBALS['xoops']->path('modules/'.$moduleDirName.'/include/vars.php'); |
|
| 65 | 65 | |
| 66 | -require_once __DIR__ . '/include/functions.user.php'; |
|
| 67 | -require_once __DIR__ . '/include/functions.topic.php'; |
|
| 66 | +require_once __DIR__.'/include/functions.user.php'; |
|
| 67 | +require_once __DIR__.'/include/functions.topic.php'; |
|
| 68 | 68 | |
| 69 | 69 | require_once $GLOBALS['xoops']->path('class/xoopsformloader.php'); |
| 70 | 70 | require_once $GLOBALS['xoops']->path('class/module.textsanitizer.php'); |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | $menumode = 0; |
| 74 | 74 | $menumode_other = []; |
| 75 | 75 | $menu_url = htmlspecialchars(preg_replace('/&menumode=[^&]/', '', Request::getString('REQUEST_URI', '', 'SERVER')), ENT_QUOTES | ENT_HTML5); |
| 76 | -$menu_url .= (false === strpos($menu_url, '?')) ? '?menumode=' : '&menumode='; |
|
| 76 | +$menu_url .= (false === strpos($menu_url, '?')) ? '?menumode=' : '&menumode='; |
|
| 77 | 77 | //foreach ($GLOBALS['xoopsModuleConfig']['valid_menumodes'] as $key => $val) { |
| 78 | 78 | // if ($key !== $menumode) { |
| 79 | 79 | // $menumode_other[] = array('title' => $val, 'link' => $menu_url . $key); |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | |
| 83 | 83 | if (is_object($GLOBALS['xoopsUser']) && !empty($GLOBALS['xoopsModuleConfig']['welcome_forum']) |
| 84 | 84 | && !$GLOBALS['xoopsUser']->getVar('posts')) { |
| 85 | - require_once __DIR__ . '/include/functions.welcome.php'; |
|
| 85 | + require_once __DIR__.'/include/functions.welcome.php'; |
|
| 86 | 86 | } |
| 87 | 87 | // irmtfan for backward compatibility |
| 88 | 88 | $pollmodules = $GLOBALS['xoopsModuleConfig']['poll_module']; |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | $postId = Request::getInt('post_id', 0, 'GET'); |
| 21 | 21 | |
| 22 | 22 | if (!$postId || !$attachId) { |
| 23 | - exit(_MD_NEWBB_NO_SUCH_FILE . ': post_id:' . $postId . '; attachid' . $attachId); |
|
| 23 | + exit(_MD_NEWBB_NO_SUCH_FILE . ': post_id:' . $postId . '; attachid' . $attachId); |
|
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | ///** @var Newbb\PostHandler $postHandler */ |
@@ -29,36 +29,36 @@ discard block |
||
| 29 | 29 | /** @var Newbb\Post $forumpost */ |
| 30 | 30 | $forumpost = $postHandler->get($postId); |
| 31 | 31 | if (!$approved = $forumpost->getVar('approved')) { |
| 32 | - exit(_MD_NEWBB_NORIGHTTOVIEW); |
|
| 32 | + exit(_MD_NEWBB_NORIGHTTOVIEW); |
|
| 33 | 33 | } |
| 34 | 34 | ///** @var TopicHandler $topicHandler */ |
| 35 | 35 | //$topicHandler = Newbb\Helper::getInstance()->getHandler('Topic'); |
| 36 | 36 | $topicObject = $topicHandler->getByPost($postId); |
| 37 | 37 | $topic_id = $topicObject->getVar('topic_id'); |
| 38 | 38 | if (!$approved = $topicObject->getVar('approved')) { |
| 39 | - exit(_MD_NEWBB_NORIGHTTOVIEW); |
|
| 39 | + exit(_MD_NEWBB_NORIGHTTOVIEW); |
|
| 40 | 40 | } |
| 41 | 41 | ///** @var NewbbForumHandler $forumHandler */ |
| 42 | 42 | //$forumHandler = Newbb\Helper::getInstance()->getHandler('Forum'); |
| 43 | 43 | $forumObject = $forumHandler->get($topicObject->getVar('forum_id')); |
| 44 | 44 | if (!$forumHandler->getPermission($forumObject)) { |
| 45 | - exit(_MD_NEWBB_NORIGHTTOACCESS); |
|
| 45 | + exit(_MD_NEWBB_NORIGHTTOACCESS); |
|
| 46 | 46 | } |
| 47 | 47 | if (!$topicHandler->getPermission($forumObject, $topicObject->getVar('topic_status'), 'view')) { |
| 48 | - exit(_MD_NEWBB_NORIGHTTOVIEW); |
|
| 48 | + exit(_MD_NEWBB_NORIGHTTOVIEW); |
|
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | $attachments = $forumpost->getAttachment(); |
| 52 | 52 | $attach = $attachments[$attachId]; |
| 53 | 53 | if (!$attach) { |
| 54 | - exit(_MD_NEWBB_NO_SUCH_FILE); |
|
| 54 | + exit(_MD_NEWBB_NO_SUCH_FILE); |
|
| 55 | 55 | } |
| 56 | 56 | $file_saved = $GLOBALS['xoops']->path($GLOBALS['xoopsModuleConfig']['dir_attachments'] . '/' . $attach['name_saved']); |
| 57 | 57 | if (!file_exists($file_saved)) { |
| 58 | - exit(_MD_NEWBB_NO_SUCH_FILE); |
|
| 58 | + exit(_MD_NEWBB_NO_SUCH_FILE); |
|
| 59 | 59 | } |
| 60 | 60 | if ($down = $forumpost->incrementDownload($attachId)) { |
| 61 | - $forumpost->saveAttachment(); |
|
| 61 | + $forumpost->saveAttachment(); |
|
| 62 | 62 | } |
| 63 | 63 | unset($forumpost); |
| 64 | 64 | $msg = ob_get_contents(); |
@@ -66,41 +66,41 @@ discard block |
||
| 66 | 66 | |
| 67 | 67 | $xoopsLogger->activated = false; |
| 68 | 68 | if (!empty($GLOBALS['xoopsModuleConfig']['download_direct'])) { |
| 69 | - header('Cache-Control: no-store, no-cache, must-revalidate'); |
|
| 70 | - header('Cache-Control: post-check=0, pre-check=0', false); |
|
| 71 | - header('Pragma: no-cache'); |
|
| 72 | - header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); |
|
| 73 | - header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); |
|
| 74 | - header('location: ' . XOOPS_URL . '/' . $GLOBALS['xoopsModuleConfig']['dir_attachments'] . '/' . $attach['name_saved']); |
|
| 69 | + header('Cache-Control: no-store, no-cache, must-revalidate'); |
|
| 70 | + header('Cache-Control: post-check=0, pre-check=0', false); |
|
| 71 | + header('Pragma: no-cache'); |
|
| 72 | + header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); |
|
| 73 | + header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); |
|
| 74 | + header('location: ' . XOOPS_URL . '/' . $GLOBALS['xoopsModuleConfig']['dir_attachments'] . '/' . $attach['name_saved']); |
|
| 75 | 75 | } else { |
| 76 | - $file_display = $attach['nameDisplay']; |
|
| 77 | - //$mimetype = $attach['mimetype']; |
|
| 76 | + $file_display = $attach['nameDisplay']; |
|
| 77 | + //$mimetype = $attach['mimetype']; |
|
| 78 | 78 | |
| 79 | - if (ini_get('zlib.output_compression')) { |
|
| 80 | - @ini_set('zlib.output_compression', 'Off'); |
|
| 81 | - } |
|
| 79 | + if (ini_get('zlib.output_compression')) { |
|
| 80 | + @ini_set('zlib.output_compression', 'Off'); |
|
| 81 | + } |
|
| 82 | 82 | |
| 83 | - if (function_exists('mb_http_output')) { |
|
| 84 | - mb_http_output('pass'); |
|
| 85 | - } |
|
| 86 | - header('Expires: 0'); |
|
| 87 | - //header('Content-Type: '.$mimetype); |
|
| 88 | - header('Content-Type: application/octet-stream'); |
|
| 89 | - if (preg_match("/MSIE (\d\.\d{1,2})/", Request::getString('HTTP_USER_AGENT', '', 'SERVER'))) { |
|
| 90 | - header('Content-Disposition: attachment; filename="' . $file_display . '"'); |
|
| 91 | - header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); |
|
| 92 | - header('Pragma: public'); |
|
| 93 | - } else { |
|
| 94 | - header('Content-Disposition: attachment; filename="' . $file_display . '"'); |
|
| 95 | - header('Pragma: no-cache'); |
|
| 96 | - } |
|
| 97 | - header('Content-Type: application/force-download'); |
|
| 98 | - header('Content-Transfer-Encoding: binary'); |
|
| 83 | + if (function_exists('mb_http_output')) { |
|
| 84 | + mb_http_output('pass'); |
|
| 85 | + } |
|
| 86 | + header('Expires: 0'); |
|
| 87 | + //header('Content-Type: '.$mimetype); |
|
| 88 | + header('Content-Type: application/octet-stream'); |
|
| 89 | + if (preg_match("/MSIE (\d\.\d{1,2})/", Request::getString('HTTP_USER_AGENT', '', 'SERVER'))) { |
|
| 90 | + header('Content-Disposition: attachment; filename="' . $file_display . '"'); |
|
| 91 | + header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); |
|
| 92 | + header('Pragma: public'); |
|
| 93 | + } else { |
|
| 94 | + header('Content-Disposition: attachment; filename="' . $file_display . '"'); |
|
| 95 | + header('Pragma: no-cache'); |
|
| 96 | + } |
|
| 97 | + header('Content-Type: application/force-download'); |
|
| 98 | + header('Content-Transfer-Encoding: binary'); |
|
| 99 | 99 | |
| 100 | - $handle = fopen($file_saved, 'rb'); |
|
| 101 | - while (!feof($handle)) { |
|
| 102 | - $buffer = fread($handle, 4096); |
|
| 103 | - echo $buffer; |
|
| 104 | - } |
|
| 105 | - fclose($handle); |
|
| 100 | + $handle = fopen($file_saved, 'rb'); |
|
| 101 | + while (!feof($handle)) { |
|
| 102 | + $buffer = fread($handle, 4096); |
|
| 103 | + echo $buffer; |
|
| 104 | + } |
|
| 105 | + fclose($handle); |
|
| 106 | 106 | } |
@@ -13,14 +13,14 @@ discard block |
||
| 13 | 13 | use XoopsModules\Newbb; |
| 14 | 14 | |
| 15 | 15 | ob_start(); |
| 16 | -require_once __DIR__ . '/header.php'; |
|
| 16 | +require_once __DIR__.'/header.php'; |
|
| 17 | 17 | require_once $GLOBALS['xoops']->path('header.php'); |
| 18 | 18 | |
| 19 | 19 | $attachId = Request::getInt('attachid', 0, 'GET'); |
| 20 | 20 | $postId = Request::getInt('post_id', 0, 'GET'); |
| 21 | 21 | |
| 22 | 22 | if (!$postId || !$attachId) { |
| 23 | - exit(_MD_NEWBB_NO_SUCH_FILE . ': post_id:' . $postId . '; attachid' . $attachId); |
|
| 23 | + exit(_MD_NEWBB_NO_SUCH_FILE.': post_id:'.$postId.'; attachid'.$attachId); |
|
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | ///** @var Newbb\PostHandler $postHandler */ |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | if (!$attach) { |
| 54 | 54 | exit(_MD_NEWBB_NO_SUCH_FILE); |
| 55 | 55 | } |
| 56 | -$file_saved = $GLOBALS['xoops']->path($GLOBALS['xoopsModuleConfig']['dir_attachments'] . '/' . $attach['name_saved']); |
|
| 56 | +$file_saved = $GLOBALS['xoops']->path($GLOBALS['xoopsModuleConfig']['dir_attachments'].'/'.$attach['name_saved']); |
|
| 57 | 57 | if (!file_exists($file_saved)) { |
| 58 | 58 | exit(_MD_NEWBB_NO_SUCH_FILE); |
| 59 | 59 | } |
@@ -70,8 +70,8 @@ discard block |
||
| 70 | 70 | header('Cache-Control: post-check=0, pre-check=0', false); |
| 71 | 71 | header('Pragma: no-cache'); |
| 72 | 72 | header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); |
| 73 | - header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); |
|
| 74 | - header('location: ' . XOOPS_URL . '/' . $GLOBALS['xoopsModuleConfig']['dir_attachments'] . '/' . $attach['name_saved']); |
|
| 73 | + header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); |
|
| 74 | + header('location: '.XOOPS_URL.'/'.$GLOBALS['xoopsModuleConfig']['dir_attachments'].'/'.$attach['name_saved']); |
|
| 75 | 75 | } else { |
| 76 | 76 | $file_display = $attach['nameDisplay']; |
| 77 | 77 | //$mimetype = $attach['mimetype']; |
@@ -87,11 +87,11 @@ discard block |
||
| 87 | 87 | //header('Content-Type: '.$mimetype); |
| 88 | 88 | header('Content-Type: application/octet-stream'); |
| 89 | 89 | if (preg_match("/MSIE (\d\.\d{1,2})/", Request::getString('HTTP_USER_AGENT', '', 'SERVER'))) { |
| 90 | - header('Content-Disposition: attachment; filename="' . $file_display . '"'); |
|
| 90 | + header('Content-Disposition: attachment; filename="'.$file_display.'"'); |
|
| 91 | 91 | header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); |
| 92 | 92 | header('Pragma: public'); |
| 93 | 93 | } else { |
| 94 | - header('Content-Disposition: attachment; filename="' . $file_display . '"'); |
|
| 94 | + header('Content-Disposition: attachment; filename="'.$file_display.'"'); |
|
| 95 | 95 | header('Pragma: no-cache'); |
| 96 | 96 | } |
| 97 | 97 | header('Content-Type: application/force-download'); |
@@ -8,5 +8,5 @@ |
||
| 8 | 8 | * @since 4.00 |
| 9 | 9 | * @package module::newbb |
| 10 | 10 | */ |
| 11 | -require_once __DIR__ . '/header.php'; |
|
| 11 | +require_once __DIR__.'/header.php'; |
|
| 12 | 12 | require_once $GLOBALS['xoops']->path('modules/tag/list.tag.php'); |
@@ -15,12 +15,12 @@ discard block |
||
| 15 | 15 | require_once __DIR__ . '/header.php'; |
| 16 | 16 | |
| 17 | 17 | foreach (['forum', 'topic_id', 'post_id', 'order'] as $getint) { |
| 18 | - ${$getint} = Request::getInt($getint, 0, 'GET'); |
|
| 18 | + ${$getint} = Request::getInt($getint, 0, 'GET'); |
|
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | if (!$topic_id && !$post_id) { |
| 22 | - $redirect = empty($forum) ? 'index.php' : "viewforum.php?forum={$forum}"; |
|
| 23 | - redirect_header($redirect, 2, _MD_NEWBB_ERRORTOPIC); |
|
| 22 | + $redirect = empty($forum) ? 'index.php' : "viewforum.php?forum={$forum}"; |
|
| 23 | + redirect_header($redirect, 2, _MD_NEWBB_ERRORTOPIC); |
|
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | ///** @var Newbb\ForumHandler $forumHandler */ |
@@ -35,13 +35,13 @@ discard block |
||
| 35 | 35 | $topicObject = $topicHandler->get($postObject->getVar('topic_id')); |
| 36 | 36 | $forumObject = $forumHandler->get($postObject->getVar('forum_id')); |
| 37 | 37 | if (!$forumHandler->getPermission($forumObject)) { |
| 38 | - redirect_header('index.php', 2, _MD_NEWBB_NORIGHTTOACCESS); |
|
| 38 | + redirect_header('index.php', 2, _MD_NEWBB_NORIGHTTOACCESS); |
|
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | if ($GLOBALS['xoopsModuleConfig']['wol_enabled']) { |
| 42 | - // /** @var Newbb\OnlineHandler $onlineHandler */ |
|
| 43 | - // $onlineHandler = Newbb\Helper::getInstance()->getHandler('Online'); |
|
| 44 | - $onlineHandler->init($forumObject); |
|
| 42 | + // /** @var Newbb\OnlineHandler $onlineHandler */ |
|
| 43 | + // $onlineHandler = Newbb\Helper::getInstance()->getHandler('Online'); |
|
| 44 | + $onlineHandler->init($forumObject); |
|
| 45 | 45 | } |
| 46 | 46 | $isAdmin = newbbIsAdmin($forumObject); |
| 47 | 47 | $uid = is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->getVar('uid') : 0; |
@@ -51,30 +51,30 @@ discard block |
||
| 51 | 51 | $error_msg = null; |
| 52 | 52 | |
| 53 | 53 | if (!$topicHandler->getPermission($forumObject, $topic_status, 'edit') || (!$isAdmin && !$postObject->checkIdentity())) { |
| 54 | - $error_msg = _MD_NEWBB_NORIGHTTOEDIT; |
|
| 54 | + $error_msg = _MD_NEWBB_NORIGHTTOEDIT; |
|
| 55 | 55 | } elseif (!$isAdmin && !$postObject->checkTimelimit('edit_timelimit')) { |
| 56 | - $error_msg = _MD_NEWBB_TIMEISUP; |
|
| 56 | + $error_msg = _MD_NEWBB_TIMEISUP; |
|
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | if (!empty($error_msg)) { |
| 60 | - /* |
|
| 60 | + /* |
|
| 61 | 61 | * Build the page query |
| 62 | 62 | */ |
| 63 | - $query_vars = ['topic_id', 'post_id', 'forum', 'status', 'order', 'mode', 'viewmode']; |
|
| 64 | - $query_array = []; |
|
| 65 | - foreach ($query_vars as $var) { |
|
| 66 | - if (Request::getString($var, '', 'GET')) { |
|
| 67 | - $query_array[$var] = "{$var}=" . Request::getString($var, '', 'GET'); |
|
| 68 | - } |
|
| 69 | - } |
|
| 70 | - $page_query = htmlspecialchars(implode('&', array_values($query_array)), ENT_QUOTES | ENT_HTML5); |
|
| 71 | - unset($query_array); |
|
| 72 | - redirect_header("viewtopic.php?{$page_query}", 2, $error_msg); |
|
| 63 | + $query_vars = ['topic_id', 'post_id', 'forum', 'status', 'order', 'mode', 'viewmode']; |
|
| 64 | + $query_array = []; |
|
| 65 | + foreach ($query_vars as $var) { |
|
| 66 | + if (Request::getString($var, '', 'GET')) { |
|
| 67 | + $query_array[$var] = "{$var}=" . Request::getString($var, '', 'GET'); |
|
| 68 | + } |
|
| 69 | + } |
|
| 70 | + $page_query = htmlspecialchars(implode('&', array_values($query_array)), ENT_QUOTES | ENT_HTML5); |
|
| 71 | + unset($query_array); |
|
| 72 | + redirect_header("viewtopic.php?{$page_query}", 2, $error_msg); |
|
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | if ($GLOBALS['xoopsModuleConfig']['wol_enabled']) { |
| 76 | - // $onlineHandler = Newbb\Helper::getInstance()->getHandler('Online'); |
|
| 77 | - $onlineHandler->init($forumObject); |
|
| 76 | + // $onlineHandler = Newbb\Helper::getInstance()->getHandler('Online'); |
|
| 77 | + $onlineHandler->init($forumObject); |
|
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | $xoopsOption['template_main'] = 'newbb_edit_post.tpl'; |
@@ -125,28 +125,28 @@ discard block |
||
| 125 | 125 | $posts_context = []; |
| 126 | 126 | $posts_contextObject = $istopic ? [] : [$postHandler->get($postObject->getVar('pid'))]; |
| 127 | 127 | foreach ($posts_contextObject as $post_contextObject) { |
| 128 | - if ($GLOBALS['xoopsModuleConfig']['enable_karma'] && $post_contextObject->getVar('post_karma') > 0) { |
|
| 129 | - $p_message = sprintf(_MD_NEWBB_KARMA_REQUIREMENT, '***', $post_contextObject->getVar('post_karma')) . '</div>'; |
|
| 130 | - } elseif ($GLOBALS['xoopsModuleConfig']['allow_require_reply'] && $post_contextObject->getVar('require_reply')) { |
|
| 131 | - $p_message = _MD_NEWBB_REPLY_REQUIREMENT; |
|
| 132 | - } else { |
|
| 133 | - $p_message = $post_contextObject->getVar('post_text'); |
|
| 134 | - } |
|
| 135 | - |
|
| 136 | - if ($post_contextObject->getVar('uid')) { |
|
| 137 | - $p_name = newbbGetUnameFromId($post_contextObject->getVar('uid'), $GLOBALS['xoopsModuleConfig']['show_realname']); |
|
| 138 | - } else { |
|
| 139 | - $poster_name = $post_contextObject->getVar('poster_name'); |
|
| 140 | - $p_name = empty($poster_name) ? htmlspecialchars($GLOBALS['xoopsConfig']['anonymous'], ENT_QUOTES | ENT_HTML5) : $poster_name; |
|
| 141 | - } |
|
| 142 | - $p_date = formatTimestamp($post_contextObject->getVar('post_time')); |
|
| 143 | - $p_subject = $post_contextObject->getVar('subject'); |
|
| 144 | - |
|
| 145 | - $posts_context[] = [ |
|
| 146 | - 'subject' => $p_subject, |
|
| 147 | - 'meta' => _MD_NEWBB_BY . ' ' . $p_name . ' ' . _MD_NEWBB_ON . ' ' . $p_date, |
|
| 148 | - 'content' => $p_message |
|
| 149 | - ]; |
|
| 128 | + if ($GLOBALS['xoopsModuleConfig']['enable_karma'] && $post_contextObject->getVar('post_karma') > 0) { |
|
| 129 | + $p_message = sprintf(_MD_NEWBB_KARMA_REQUIREMENT, '***', $post_contextObject->getVar('post_karma')) . '</div>'; |
|
| 130 | + } elseif ($GLOBALS['xoopsModuleConfig']['allow_require_reply'] && $post_contextObject->getVar('require_reply')) { |
|
| 131 | + $p_message = _MD_NEWBB_REPLY_REQUIREMENT; |
|
| 132 | + } else { |
|
| 133 | + $p_message = $post_contextObject->getVar('post_text'); |
|
| 134 | + } |
|
| 135 | + |
|
| 136 | + if ($post_contextObject->getVar('uid')) { |
|
| 137 | + $p_name = newbbGetUnameFromId($post_contextObject->getVar('uid'), $GLOBALS['xoopsModuleConfig']['show_realname']); |
|
| 138 | + } else { |
|
| 139 | + $poster_name = $post_contextObject->getVar('poster_name'); |
|
| 140 | + $p_name = empty($poster_name) ? htmlspecialchars($GLOBALS['xoopsConfig']['anonymous'], ENT_QUOTES | ENT_HTML5) : $poster_name; |
|
| 141 | + } |
|
| 142 | + $p_date = formatTimestamp($post_contextObject->getVar('post_time')); |
|
| 143 | + $p_subject = $post_contextObject->getVar('subject'); |
|
| 144 | + |
|
| 145 | + $posts_context[] = [ |
|
| 146 | + 'subject' => $p_subject, |
|
| 147 | + 'meta' => _MD_NEWBB_BY . ' ' . $p_name . ' ' . _MD_NEWBB_ON . ' ' . $p_date, |
|
| 148 | + 'content' => $p_message |
|
| 149 | + ]; |
|
| 150 | 150 | } |
| 151 | 151 | $xoopsTpl->assign_by_ref('posts_context', $posts_context); |
| 152 | 152 | // irmtfan move to footer.php |
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | use Xmf\Request; |
| 13 | 13 | use XoopsModules\Newbb; |
| 14 | 14 | |
| 15 | -require_once __DIR__ . '/header.php'; |
|
| 15 | +require_once __DIR__.'/header.php'; |
|
| 16 | 16 | |
| 17 | 17 | foreach (['forum', 'topic_id', 'post_id', 'order'] as $getint) { |
| 18 | 18 | ${$getint} = Request::getInt($getint, 0, 'GET'); |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | $query_array = []; |
| 65 | 65 | foreach ($query_vars as $var) { |
| 66 | 66 | if (Request::getString($var, '', 'GET')) { |
| 67 | - $query_array[$var] = "{$var}=" . Request::getString($var, '', 'GET'); |
|
| 67 | + $query_array[$var] = "{$var}=".Request::getString($var, '', 'GET'); |
|
| 68 | 68 | } |
| 69 | 69 | } |
| 70 | 70 | $page_query = htmlspecialchars(implode('&', array_values($query_array)), ENT_QUOTES | ENT_HTML5); |
@@ -115,8 +115,8 @@ discard block |
||
| 115 | 115 | $post_karma = $postObject->getVar('post_karma'); |
| 116 | 116 | $require_reply = $postObject->getVar('require_reply'); |
| 117 | 117 | |
| 118 | -$xoopsTpl->assign('error_message', _MD_NEWBB_EDITEDBY . ' ' . $GLOBALS['xoopsUser']->uname()); |
|
| 119 | -require_once __DIR__ . '/include/form.post.php'; |
|
| 118 | +$xoopsTpl->assign('error_message', _MD_NEWBB_EDITEDBY.' '.$GLOBALS['xoopsUser']->uname()); |
|
| 119 | +require_once __DIR__.'/include/form.post.php'; |
|
| 120 | 120 | |
| 121 | 121 | ///** @var Newbb\KarmaHandler $karmaHandler */ |
| 122 | 122 | //$karmaHandler = Newbb\Helper::getInstance()->getHandler('Karma'); |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | $posts_contextObject = $istopic ? [] : [$postHandler->get($postObject->getVar('pid'))]; |
| 127 | 127 | foreach ($posts_contextObject as $post_contextObject) { |
| 128 | 128 | if ($GLOBALS['xoopsModuleConfig']['enable_karma'] && $post_contextObject->getVar('post_karma') > 0) { |
| 129 | - $p_message = sprintf(_MD_NEWBB_KARMA_REQUIREMENT, '***', $post_contextObject->getVar('post_karma')) . '</div>'; |
|
| 129 | + $p_message = sprintf(_MD_NEWBB_KARMA_REQUIREMENT, '***', $post_contextObject->getVar('post_karma')).'</div>'; |
|
| 130 | 130 | } elseif ($GLOBALS['xoopsModuleConfig']['allow_require_reply'] && $post_contextObject->getVar('require_reply')) { |
| 131 | 131 | $p_message = _MD_NEWBB_REPLY_REQUIREMENT; |
| 132 | 132 | } else { |
@@ -144,11 +144,11 @@ discard block |
||
| 144 | 144 | |
| 145 | 145 | $posts_context[] = [ |
| 146 | 146 | 'subject' => $p_subject, |
| 147 | - 'meta' => _MD_NEWBB_BY . ' ' . $p_name . ' ' . _MD_NEWBB_ON . ' ' . $p_date, |
|
| 147 | + 'meta' => _MD_NEWBB_BY.' '.$p_name.' '._MD_NEWBB_ON.' '.$p_date, |
|
| 148 | 148 | 'content' => $p_message |
| 149 | 149 | ]; |
| 150 | 150 | } |
| 151 | 151 | $xoopsTpl->assign_by_ref('posts_context', $posts_context); |
| 152 | 152 | // irmtfan move to footer.php |
| 153 | -require_once __DIR__ . '/footer.php'; |
|
| 153 | +require_once __DIR__.'/footer.php'; |
|
| 154 | 154 | require_once $GLOBALS['xoops']->path('footer.php'); |