@@ -21,75 +21,75 @@ discard block |
||
| 21 | 21 | $forum_id = Request::getInt('forum', 0); |
| 22 | 22 | $isAdmin = newbbIsAdmin($forum_id); |
| 23 | 23 | if (!$isAdmin) { |
| 24 | - redirect_header(XOOPS_URL . '/index.php', 2, _MD_NEWBB_NORIGHTTOACCESS); |
|
| 24 | + redirect_header(XOOPS_URL . '/index.php', 2, _MD_NEWBB_NORIGHTTOACCESS); |
|
| 25 | 25 | } |
| 26 | 26 | $is_administrator = $GLOBALS['xoopsUserIsAdmin']; |
| 27 | 27 | ///** @var Newbb\ModerateHandler $moderateHandler */ |
| 28 | 28 | //$moderateHandler = Newbb\Helper::getInstance()->getHandler('Moderate'); |
| 29 | 29 | |
| 30 | 30 | if (Request::hasVar('submit', 'POST') && Request::getInt('expire', 0, 'POST')) { |
| 31 | - $ipWithMask = ''; |
|
| 32 | - if (0 == $forum_userid) { |
|
| 33 | - $ipWithMask = Request::getString('ip', null, 'POST'); |
|
| 34 | - $mask = ''; |
|
| 35 | - $ipParts = explode('/', $ipWithMask); |
|
| 36 | - $ip = new \Xmf\IPAddress($ipParts[0]); |
|
| 37 | - if (false === $ip->asReadable()) { |
|
| 38 | - $ipWithMask = ''; |
|
| 39 | - } else { |
|
| 40 | - $ipWithMask = $ip->asReadable(); |
|
| 41 | - $mask = empty($ipParts[1]) ? 0 : (int)$ipParts[1]; |
|
| 42 | - $mask = ($mask > ((4 === $ip->ipVersion()) ? 32 : 128) || $mask < 8) ? '' : $mask; |
|
| 43 | - $ipWithMask .= empty($mask) ? '' : '/' . $mask; |
|
| 44 | - } |
|
| 45 | - } |
|
| 46 | - |
|
| 47 | - $mod_end = time() + Request::getInt('expire', 0, 'POST') * 3600 * 24; |
|
| 48 | - $mod_desc = Request::getString('desc', '', 'POST'); |
|
| 49 | - |
|
| 50 | - $moderateObject = $moderateHandler->create(); |
|
| 51 | - $moderateObject->setVar('uid', $forum_userid); |
|
| 52 | - $moderateObject->setVar('ip', $ipWithMask); |
|
| 53 | - $moderateObject->setVar('forum_id', $forum_id); |
|
| 54 | - $moderateObject->setVar('mod_start', time()); |
|
| 55 | - $moderateObject->setVar('mod_end', $mod_end); |
|
| 56 | - $moderateObject->setVar('mod_desc', $mod_desc); |
|
| 57 | - $res = $moderateHandler->insert($moderateObject); |
|
| 58 | - |
|
| 59 | - redirect_header("moderate.php?forum={$forum_id}", 2, _MD_NEWBB_DBUPDATED); |
|
| 31 | + $ipWithMask = ''; |
|
| 32 | + if (0 == $forum_userid) { |
|
| 33 | + $ipWithMask = Request::getString('ip', null, 'POST'); |
|
| 34 | + $mask = ''; |
|
| 35 | + $ipParts = explode('/', $ipWithMask); |
|
| 36 | + $ip = new \Xmf\IPAddress($ipParts[0]); |
|
| 37 | + if (false === $ip->asReadable()) { |
|
| 38 | + $ipWithMask = ''; |
|
| 39 | + } else { |
|
| 40 | + $ipWithMask = $ip->asReadable(); |
|
| 41 | + $mask = empty($ipParts[1]) ? 0 : (int)$ipParts[1]; |
|
| 42 | + $mask = ($mask > ((4 === $ip->ipVersion()) ? 32 : 128) || $mask < 8) ? '' : $mask; |
|
| 43 | + $ipWithMask .= empty($mask) ? '' : '/' . $mask; |
|
| 44 | + } |
|
| 45 | + } |
|
| 46 | + |
|
| 47 | + $mod_end = time() + Request::getInt('expire', 0, 'POST') * 3600 * 24; |
|
| 48 | + $mod_desc = Request::getString('desc', '', 'POST'); |
|
| 49 | + |
|
| 50 | + $moderateObject = $moderateHandler->create(); |
|
| 51 | + $moderateObject->setVar('uid', $forum_userid); |
|
| 52 | + $moderateObject->setVar('ip', $ipWithMask); |
|
| 53 | + $moderateObject->setVar('forum_id', $forum_id); |
|
| 54 | + $moderateObject->setVar('mod_start', time()); |
|
| 55 | + $moderateObject->setVar('mod_end', $mod_end); |
|
| 56 | + $moderateObject->setVar('mod_desc', $mod_desc); |
|
| 57 | + $res = $moderateHandler->insert($moderateObject); |
|
| 58 | + |
|
| 59 | + redirect_header("moderate.php?forum={$forum_id}", 2, _MD_NEWBB_DBUPDATED); |
|
| 60 | 60 | } elseif (Request::hasVar('del')) { |
| 61 | - $moderateObject = $moderateHandler->get(Request::getInt('del', 0, 'GET')); |
|
| 62 | - if ($is_administrator || $moderateObject->getVar('forum_id') == $forum_id) { |
|
| 63 | - $moderateHandler->delete($moderateObject, true); |
|
| 64 | - redirect_header("moderate.php?forum={$forum_id}", 2, _MD_NEWBB_DBUPDATED); |
|
| 65 | - } |
|
| 61 | + $moderateObject = $moderateHandler->get(Request::getInt('del', 0, 'GET')); |
|
| 62 | + if ($is_administrator || $moderateObject->getVar('forum_id') == $forum_id) { |
|
| 63 | + $moderateHandler->delete($moderateObject, true); |
|
| 64 | + redirect_header("moderate.php?forum={$forum_id}", 2, _MD_NEWBB_DBUPDATED); |
|
| 65 | + } |
|
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | $start = Request::getInt('start', 0, 'GET'); |
| 69 | 69 | $sortname = Request::getString('sort', '', 'GET'); |
| 70 | 70 | |
| 71 | 71 | switch ($sortname) { |
| 72 | - case 'uid': |
|
| 73 | - $sort = 'uid ASC, ip'; |
|
| 74 | - $order = 'ASC'; |
|
| 75 | - break; |
|
| 76 | - case 'start': |
|
| 77 | - $sort = 'mod_start'; |
|
| 78 | - $order = 'ASC'; |
|
| 79 | - break; |
|
| 80 | - case 'expire': |
|
| 81 | - $sort = 'mod_end'; |
|
| 82 | - $order = 'DESC'; |
|
| 83 | - break; |
|
| 84 | - default: |
|
| 85 | - $sort = 'forum_id ASC, uid ASC, ip'; |
|
| 86 | - $order = 'ASC'; |
|
| 87 | - break; |
|
| 72 | + case 'uid': |
|
| 73 | + $sort = 'uid ASC, ip'; |
|
| 74 | + $order = 'ASC'; |
|
| 75 | + break; |
|
| 76 | + case 'start': |
|
| 77 | + $sort = 'mod_start'; |
|
| 78 | + $order = 'ASC'; |
|
| 79 | + break; |
|
| 80 | + case 'expire': |
|
| 81 | + $sort = 'mod_end'; |
|
| 82 | + $order = 'DESC'; |
|
| 83 | + break; |
|
| 84 | + default: |
|
| 85 | + $sort = 'forum_id ASC, uid ASC, ip'; |
|
| 86 | + $order = 'ASC'; |
|
| 87 | + break; |
|
| 88 | 88 | } |
| 89 | 89 | // show all bans for module admin - for moderator just show its forum_id bans |
| 90 | 90 | $criteria = new \CriteriaCompo(); |
| 91 | 91 | if (!$is_administrator) { |
| 92 | - $criteria->add(new \Criteria('forum_id', $forum_id, '=')); |
|
| 92 | + $criteria->add(new \Criteria('forum_id', $forum_id, '=')); |
|
| 93 | 93 | } |
| 94 | 94 | $criteria->setLimit($GLOBALS['xoopsModuleConfig']['topics_per_page']); |
| 95 | 95 | $criteria->setStart($start); |
@@ -100,75 +100,75 @@ discard block |
||
| 100 | 100 | |
| 101 | 101 | $url = 'moderate.php'; |
| 102 | 102 | if ($forum_id) { |
| 103 | - $url .= '?forum=' . $forum_id; |
|
| 103 | + $url .= '?forum=' . $forum_id; |
|
| 104 | 104 | } |
| 105 | 105 | $xoopsTpl->assign('moderate_url', $url); |
| 106 | 106 | |
| 107 | 107 | if (!empty($moderate_count)) { |
| 108 | - $_users = []; |
|
| 109 | - foreach (array_keys($moderateObjects) as $id) { |
|
| 110 | - $_users[$moderateObjects[$id]->getVar('uid')] = 1; |
|
| 111 | - } |
|
| 112 | - $users = newbbGetUnameFromIds(array_keys($_users), $GLOBALS['xoopsModuleConfig']['show_realname'], true); |
|
| 113 | - |
|
| 114 | - $columnHeaders ['uid'] = [ |
|
| 115 | - 'url' => 'moderate.php?forum=' . $forum_id . '&start=' . $start . '&sort=uid', |
|
| 116 | - 'header' => _MD_NEWBB_SUSPEND_UID, |
|
| 117 | - 'title' => _MD_NEWBB_SUSPEND_UID, |
|
| 118 | - ]; |
|
| 119 | - $columnHeaders ['start'] = [ |
|
| 120 | - 'url' => 'moderate.php?forum=' . $forum_id . '&start=' . $start . '&sort=start', |
|
| 121 | - 'header' => _MD_NEWBB_SUSPEND_START, |
|
| 122 | - 'title' => _MD_NEWBB_SUSPEND_START, |
|
| 123 | - ]; |
|
| 124 | - $columnHeaders['expire'] = [ |
|
| 125 | - 'url' => 'moderate.php?forum=' . $forum_id . '&start=' . $start . '&sort=expire', |
|
| 126 | - 'header' => _MD_NEWBB_SUSPEND_EXPIRE, |
|
| 127 | - 'title' => _MD_NEWBB_SUSPEND_EXPIRE, |
|
| 128 | - ]; |
|
| 129 | - $columnHeaders['forum'] = [ |
|
| 130 | - 'url' => 'moderate.php?forum=' . $forum_id . '&start=' . $start . '&sort=forum', |
|
| 131 | - 'header' => _MD_NEWBB_SUSPEND_SCOPE, |
|
| 132 | - 'title' => _MD_NEWBB_SUSPEND_SCOPE, |
|
| 133 | - ]; |
|
| 134 | - $columnHeaders['desc'] = [ |
|
| 135 | - 'url' => false, |
|
| 136 | - 'header' => _MD_NEWBB_SUSPEND_DESC, |
|
| 137 | - 'title' => _MD_NEWBB_SUSPEND_DESC, |
|
| 138 | - ]; |
|
| 139 | - $columnHeaders['options'] = [ |
|
| 140 | - 'url' => false, |
|
| 141 | - 'header' => _DELETE, |
|
| 142 | - 'title' => _DELETE, |
|
| 143 | - ]; |
|
| 144 | - $xoopsTpl->assign('columnHeaders', $columnHeaders); |
|
| 145 | - |
|
| 146 | - // /** @var Newbb\ForumHandler $forumHandler */ |
|
| 147 | - // $forumHandler = Newbb\Helper::getInstance()->getHandler('Forum'); |
|
| 148 | - $forum_list = $forumHandler->getAll(null, ['forum_name'], false); |
|
| 149 | - |
|
| 150 | - $columnRows = []; |
|
| 151 | - foreach (array_keys($moderateObjects) as $id) { |
|
| 152 | - // for anon, show ip instead |
|
| 153 | - $row['uid'] = ($moderateObjects[$id]->getVar('uid') ? (isset($users[$moderateObjects[$id]->getVar('uid')]) ? $users[$moderateObjects[$id]->getVar('uid')] : $moderateObjects[$id]->getVar('uid')) : $moderateObjects[$id]->getVar('ip')); |
|
| 154 | - $row['start'] = formatTimestamp($moderateObjects[$id]->getVar('mod_start')); |
|
| 155 | - $row['expire'] = formatTimestamp($moderateObjects[$id]->getVar('mod_end')); |
|
| 156 | - $row['forum'] = ($moderateObjects[$id]->getVar('forum_id') ? $forum_list[$moderateObjects[$id]->getVar('forum_id')]['forum_name'] : _ALL); |
|
| 157 | - $row['desc'] = ($moderateObjects[$id]->getVar('mod_desc') ?: _NONE); |
|
| 158 | - $row['options'] = (($is_administrator |
|
| 159 | - || $moderateObjects[$id]->getVar('forum_id') == $forum_id) ? '<a href="moderate.php?forum=' . $forum_id . '&del=' . $moderateObjects[$id]->getVar('mod_id') . '">' . _DELETE . '</a>' : ''); |
|
| 160 | - $columnRows[] = $row; |
|
| 161 | - } |
|
| 162 | - $xoopsTpl->assign('columnRows', $columnRows); |
|
| 163 | - |
|
| 164 | - if ($moderate_count > $GLOBALS['xoopsModuleConfig']['topics_per_page']) { |
|
| 165 | - require_once $GLOBALS['xoops']->path('class/pagenav.php'); |
|
| 166 | - $nav = new \XoopsPageNav($moderate_count, $GLOBALS['xoopsModuleConfig']['topics_per_page'], $start, 'start', 'forum=' . $forum_id . '&sort=' . $sortname); |
|
| 167 | - //if (isset($GLOBALS['xoopsModuleConfig']['do_rewrite'])) { |
|
| 168 | - // $nav->url = formatURL(Request::getString('SERVER_NAME', '', 'SERVER')) . ' /' . $nav->url; |
|
| 169 | - //} |
|
| 170 | - $xoopsTpl->assign('moderate_page_nav', $nav->renderNav()); |
|
| 171 | - } |
|
| 108 | + $_users = []; |
|
| 109 | + foreach (array_keys($moderateObjects) as $id) { |
|
| 110 | + $_users[$moderateObjects[$id]->getVar('uid')] = 1; |
|
| 111 | + } |
|
| 112 | + $users = newbbGetUnameFromIds(array_keys($_users), $GLOBALS['xoopsModuleConfig']['show_realname'], true); |
|
| 113 | + |
|
| 114 | + $columnHeaders ['uid'] = [ |
|
| 115 | + 'url' => 'moderate.php?forum=' . $forum_id . '&start=' . $start . '&sort=uid', |
|
| 116 | + 'header' => _MD_NEWBB_SUSPEND_UID, |
|
| 117 | + 'title' => _MD_NEWBB_SUSPEND_UID, |
|
| 118 | + ]; |
|
| 119 | + $columnHeaders ['start'] = [ |
|
| 120 | + 'url' => 'moderate.php?forum=' . $forum_id . '&start=' . $start . '&sort=start', |
|
| 121 | + 'header' => _MD_NEWBB_SUSPEND_START, |
|
| 122 | + 'title' => _MD_NEWBB_SUSPEND_START, |
|
| 123 | + ]; |
|
| 124 | + $columnHeaders['expire'] = [ |
|
| 125 | + 'url' => 'moderate.php?forum=' . $forum_id . '&start=' . $start . '&sort=expire', |
|
| 126 | + 'header' => _MD_NEWBB_SUSPEND_EXPIRE, |
|
| 127 | + 'title' => _MD_NEWBB_SUSPEND_EXPIRE, |
|
| 128 | + ]; |
|
| 129 | + $columnHeaders['forum'] = [ |
|
| 130 | + 'url' => 'moderate.php?forum=' . $forum_id . '&start=' . $start . '&sort=forum', |
|
| 131 | + 'header' => _MD_NEWBB_SUSPEND_SCOPE, |
|
| 132 | + 'title' => _MD_NEWBB_SUSPEND_SCOPE, |
|
| 133 | + ]; |
|
| 134 | + $columnHeaders['desc'] = [ |
|
| 135 | + 'url' => false, |
|
| 136 | + 'header' => _MD_NEWBB_SUSPEND_DESC, |
|
| 137 | + 'title' => _MD_NEWBB_SUSPEND_DESC, |
|
| 138 | + ]; |
|
| 139 | + $columnHeaders['options'] = [ |
|
| 140 | + 'url' => false, |
|
| 141 | + 'header' => _DELETE, |
|
| 142 | + 'title' => _DELETE, |
|
| 143 | + ]; |
|
| 144 | + $xoopsTpl->assign('columnHeaders', $columnHeaders); |
|
| 145 | + |
|
| 146 | + // /** @var Newbb\ForumHandler $forumHandler */ |
|
| 147 | + // $forumHandler = Newbb\Helper::getInstance()->getHandler('Forum'); |
|
| 148 | + $forum_list = $forumHandler->getAll(null, ['forum_name'], false); |
|
| 149 | + |
|
| 150 | + $columnRows = []; |
|
| 151 | + foreach (array_keys($moderateObjects) as $id) { |
|
| 152 | + // for anon, show ip instead |
|
| 153 | + $row['uid'] = ($moderateObjects[$id]->getVar('uid') ? (isset($users[$moderateObjects[$id]->getVar('uid')]) ? $users[$moderateObjects[$id]->getVar('uid')] : $moderateObjects[$id]->getVar('uid')) : $moderateObjects[$id]->getVar('ip')); |
|
| 154 | + $row['start'] = formatTimestamp($moderateObjects[$id]->getVar('mod_start')); |
|
| 155 | + $row['expire'] = formatTimestamp($moderateObjects[$id]->getVar('mod_end')); |
|
| 156 | + $row['forum'] = ($moderateObjects[$id]->getVar('forum_id') ? $forum_list[$moderateObjects[$id]->getVar('forum_id')]['forum_name'] : _ALL); |
|
| 157 | + $row['desc'] = ($moderateObjects[$id]->getVar('mod_desc') ?: _NONE); |
|
| 158 | + $row['options'] = (($is_administrator |
|
| 159 | + || $moderateObjects[$id]->getVar('forum_id') == $forum_id) ? '<a href="moderate.php?forum=' . $forum_id . '&del=' . $moderateObjects[$id]->getVar('mod_id') . '">' . _DELETE . '</a>' : ''); |
|
| 160 | + $columnRows[] = $row; |
|
| 161 | + } |
|
| 162 | + $xoopsTpl->assign('columnRows', $columnRows); |
|
| 163 | + |
|
| 164 | + if ($moderate_count > $GLOBALS['xoopsModuleConfig']['topics_per_page']) { |
|
| 165 | + require_once $GLOBALS['xoops']->path('class/pagenav.php'); |
|
| 166 | + $nav = new \XoopsPageNav($moderate_count, $GLOBALS['xoopsModuleConfig']['topics_per_page'], $start, 'start', 'forum=' . $forum_id . '&sort=' . $sortname); |
|
| 167 | + //if (isset($GLOBALS['xoopsModuleConfig']['do_rewrite'])) { |
|
| 168 | + // $nav->url = formatURL(Request::getString('SERVER_NAME', '', 'SERVER')) . ' /' . $nav->url; |
|
| 169 | + //} |
|
| 170 | + $xoopsTpl->assign('moderate_page_nav', $nav->renderNav()); |
|
| 171 | + } |
|
| 172 | 172 | } |
| 173 | 173 | |
| 174 | 174 | require_once $GLOBALS['xoops']->path('class/xoopsformloader.php'); |
@@ -179,19 +179,19 @@ discard block |
||
| 179 | 179 | $forum_form->addElement(new \XoopsFormText(_MD_NEWBB_SUSPEND_DESC, 'desc', 50, 255)); |
| 180 | 180 | require_once __DIR__ . '/include/functions.forum.php'; |
| 181 | 181 | if (newbbIsAdmin()) { |
| 182 | - $forumSel = '<select name="forum">';// if user doesn't select, default is "0" all forums |
|
| 183 | - $forumSel .= '<option value="0"'; |
|
| 184 | - if (0 == $forum_id) { |
|
| 185 | - $forumSel .= ' selected'; |
|
| 186 | - } |
|
| 187 | - $forumSel .= '>' . _ALL . '</option>'; |
|
| 188 | - $forumSel .= newbbForumSelectBox($forum_id, 'access', false); //$accessForums, $permission = "access", $delimitorCategory = true |
|
| 189 | - $forumSel .= '</select>'; |
|
| 190 | - $forumEle = new \XoopsFormLabel(_MD_NEWBB_SELFORUM, $forumSel); |
|
| 191 | - $forumEle->customValidationCode[] = 'if (document.suspend.forum.value < 0) {return false;} '; |
|
| 192 | - $forum_form->addElement($forumEle); |
|
| 182 | + $forumSel = '<select name="forum">';// if user doesn't select, default is "0" all forums |
|
| 183 | + $forumSel .= '<option value="0"'; |
|
| 184 | + if (0 == $forum_id) { |
|
| 185 | + $forumSel .= ' selected'; |
|
| 186 | + } |
|
| 187 | + $forumSel .= '>' . _ALL . '</option>'; |
|
| 188 | + $forumSel .= newbbForumSelectBox($forum_id, 'access', false); //$accessForums, $permission = "access", $delimitorCategory = true |
|
| 189 | + $forumSel .= '</select>'; |
|
| 190 | + $forumEle = new \XoopsFormLabel(_MD_NEWBB_SELFORUM, $forumSel); |
|
| 191 | + $forumEle->customValidationCode[] = 'if (document.suspend.forum.value < 0) {return false;} '; |
|
| 192 | + $forum_form->addElement($forumEle); |
|
| 193 | 193 | } else { |
| 194 | - $forum_form->addElement(new \XoopsFormHidden('forum', $forum_id)); |
|
| 194 | + $forum_form->addElement(new \XoopsFormHidden('forum', $forum_id)); |
|
| 195 | 195 | } |
| 196 | 196 | $forum_form->addElement(new \XoopsFormButton('', 'submit', _SUBMIT, 'submit')); |
| 197 | 197 | $forum_form->assign($xoopsTpl); |
@@ -31,19 +31,19 @@ discard block |
||
| 31 | 31 | $post_id = Request::getInt('post_id', 0, 'GET'); |
| 32 | 32 | |
| 33 | 33 | if (!is_file(XOOPS_ROOT_PATH . '/class/libraries/vendor/tecnickcom/tcpdf/tcpdf.php')) { |
| 34 | - redirect_header(XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/viewtopic.php?topic_id=' . $topic_id, 3, 'TCPDF for Xoops not installed'); |
|
| 34 | + redirect_header(XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/viewtopic.php?topic_id=' . $topic_id, 3, 'TCPDF for Xoops not installed'); |
|
| 35 | 35 | } else { |
| 36 | - require_once XOOPS_ROOT_PATH . '/class/libraries/vendor/tecnickcom/tcpdf/tcpdf.php'; |
|
| 36 | + require_once XOOPS_ROOT_PATH . '/class/libraries/vendor/tecnickcom/tcpdf/tcpdf.php'; |
|
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | if (empty($post_id)) { |
| 40 | - exit(_MD_NEWBB_ERRORTOPIC); |
|
| 40 | + exit(_MD_NEWBB_ERRORTOPIC); |
|
| 41 | 41 | } |
| 42 | 42 | ///** @var Newbb\PostHandler $postHandler */ |
| 43 | 43 | //$postHandler = Newbb\Helper::getInstance()->getHandler('Post'); |
| 44 | 44 | $post = $postHandler->get($post_id); |
| 45 | 45 | if (!$approved = $post->getVar('approved')) { |
| 46 | - exit(_MD_NEWBB_NORIGHTTOVIEW); |
|
| 46 | + exit(_MD_NEWBB_NORIGHTTOVIEW); |
|
| 47 | 47 | } |
| 48 | 48 | $post_data = $postHandler->getPostForPDF($post); |
| 49 | 49 | //$post_edit = $post->displayPostEdit(); //reserve for future versions to display edit records |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | $forumtopic = $topicHandler->getByPost($post_id); |
| 53 | 53 | $topic_id = $forumtopic->getVar('topic_id'); |
| 54 | 54 | if (!$approved = $forumtopic->getVar('approved')) { |
| 55 | - exit(_MD_NEWBB_NORIGHTTOVIEW); |
|
| 55 | + exit(_MD_NEWBB_NORIGHTTOVIEW); |
|
| 56 | 56 | } |
| 57 | 57 | ///** @var Newbb\ForumHandler $forumHandler */ |
| 58 | 58 | //$forumHandler = Newbb\Helper::getInstance()->getHandler('Forum'); |
@@ -62,19 +62,19 @@ discard block |
||
| 62 | 62 | $parent_forums = $forumHandler->getParents($viewtopic_forum); |
| 63 | 63 | $pf_title = ''; |
| 64 | 64 | if ($parent_forums) { |
| 65 | - foreach ($parent_forums as $p_f) { |
|
| 66 | - $pf_title .= $p_f['forum_name'] . ' - '; |
|
| 67 | - } |
|
| 65 | + foreach ($parent_forums as $p_f) { |
|
| 66 | + $pf_title .= $p_f['forum_name'] . ' - '; |
|
| 67 | + } |
|
| 68 | 68 | } |
| 69 | 69 | if (!$forumHandler->getPermission($viewtopic_forum)) { |
| 70 | - exit(_MD_NEWBB_NORIGHTTOACCESS); |
|
| 70 | + exit(_MD_NEWBB_NORIGHTTOACCESS); |
|
| 71 | 71 | } |
| 72 | 72 | if (!$topicHandler->getPermission($viewtopic_forum, $forumtopic->getVar('topic_status'), 'view')) { |
| 73 | - exit(_MD_NEWBB_NORIGHTTOVIEW); |
|
| 73 | + exit(_MD_NEWBB_NORIGHTTOVIEW); |
|
| 74 | 74 | } |
| 75 | 75 | // irmtfan add pdf permission |
| 76 | 76 | if (!$topicHandler->getPermission($viewtopic_forum, $forumtopic->getVar('topic_status'), 'pdf')) { |
| 77 | - exit(_MD_NEWBB_NORIGHTTOPDF); |
|
| 77 | + exit(_MD_NEWBB_NORIGHTTOPDF); |
|
| 78 | 78 | } |
| 79 | 79 | //$categoryHandler = Newbb\Helper::getInstance()->getHandler('Category'); |
| 80 | 80 | $cat = $viewtopic_forum->getVar('cat_id'); |
@@ -98,11 +98,11 @@ discard block |
||
| 98 | 98 | $pdf_data['HeadSecondLine'] = _MD_NEWBB_FORUMHOME . ' - ' . $pdf_data['cat_title'] . ' - ' . $pdf_data['forum_title'] . ' - ' . $pdf_data['topic_title']; |
| 99 | 99 | // START irmtfan to implement EMLH by GIJ |
| 100 | 100 | if (function_exists('easiestml')) { |
| 101 | - $pdf_data = easiestml($pdf_data); |
|
| 101 | + $pdf_data = easiestml($pdf_data); |
|
| 102 | 102 | // END irmtfan to implement EMLH by GIJ |
| 103 | - // START irmtfan to implement Xlanguage by phppp(DJ) |
|
| 103 | + // START irmtfan to implement Xlanguage by phppp(DJ) |
|
| 104 | 104 | } elseif (function_exists('xlanguage_ml')) { |
| 105 | - $pdf_data = xlanguage_ml($pdf_data); |
|
| 105 | + $pdf_data = xlanguage_ml($pdf_data); |
|
| 106 | 106 | } |
| 107 | 107 | // END irmtfan to implement Xlanguage by phppp(DJ) |
| 108 | 108 | |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | // START irmtfan hack to add RTL-LTR local |
| 130 | 130 | // until _RTL added to core 2.6.0 |
| 131 | 131 | if (!defined('_RTL')) { |
| 132 | - define('_RTL', false); |
|
| 132 | + define('_RTL', false); |
|
| 133 | 133 | } |
| 134 | 134 | $pdf->setRTL(_RTL); |
| 135 | 135 | // END irmtfan hack to add RTL-LTR local |
@@ -13,14 +13,14 @@ |
||
| 13 | 13 | |
| 14 | 14 | // Why the skip-DB-security check defined only for XMLRPC? We also need it!!! ~_* |
| 15 | 15 | if (!defined('XOOPS_XMLRPC')) { |
| 16 | - define('XOOPS_XMLRPC', 1); |
|
| 16 | + define('XOOPS_XMLRPC', 1); |
|
| 17 | 17 | } |
| 18 | 18 | ob_start(); |
| 19 | 19 | require_once __DIR__ . '/header.php'; |
| 20 | 20 | if (0 == $GLOBALS['xoopsModuleConfig']['email_digest']) { |
| 21 | - echo '<br>Not set'; |
|
| 21 | + echo '<br>Not set'; |
|
| 22 | 22 | |
| 23 | - return false; |
|
| 23 | + return false; |
|
| 24 | 24 | } |
| 25 | 25 | /** @var Newbb\DigestHandler $digestHandler */ |
| 26 | 26 | $digestHandler = Newbb\Helper::getInstance()->getHandler('Digest'); |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | // defined('XOOPS_ROOT_PATH') || die('Restricted access'); |
| 16 | 16 | |
| 17 | 17 | if (defined('LIST_TOPIC_DEFINED')) { |
| 18 | - return; |
|
| 18 | + return; |
|
| 19 | 19 | } |
| 20 | 20 | define('LIST_TOPIC_DEFINED', true); |
| 21 | 21 | |
@@ -51,47 +51,47 @@ discard block |
||
| 51 | 51 | */ |
| 52 | 52 | function newbb_list_topic_show($options) |
| 53 | 53 | { |
| 54 | - $newbbConfig = newbbLoadConfig(); // load all newbb configs |
|
| 55 | - |
|
| 56 | - $topicRenderer = new Newbb\TopicRenderer(); |
|
| 57 | - $topicRenderer->userlevel = $GLOBALS['xoopsUserIsAdmin'] ? 2 : is_object($GLOBALS['xoopsUser']); // Vistitor's level: 0 - anonymous; 1 - user; 2 - moderator or admin |
|
| 58 | - |
|
| 59 | - $topicRenderer->force = true; // force against static vars for parse |
|
| 60 | - |
|
| 61 | - $topicRenderer->is_multiple = true; // is it for multiple forums |
|
| 62 | - $topicRenderer->config =& $newbbConfig; // get all configs |
|
| 63 | - if (!empty($options[6])) { |
|
| 64 | - $topicRenderer->config['topics_per_page'] = (int)$options[6]; // number of topics (items) to display |
|
| 65 | - } |
|
| 66 | - $topicRenderer->config['topic_title_excerpt'] = (int)$options[10]; // topic title length 0 = dont excerpt |
|
| 67 | - $topicRenderer->config['post_excerpt'] = (int)$options[11]; // post text excerpt 0 = no post text |
|
| 68 | - |
|
| 69 | - $optionsStatus = explode(',', $options[0]); // status in where claus |
|
| 70 | - $optionsForum = explode(',', $options[12]); |
|
| 71 | - |
|
| 72 | - // set and parse values: |
|
| 73 | - // forum: parse positive values to forum IDs and negative values to category IDs. value=0 => all valid forums |
|
| 74 | - $topicRenderer->setVars([ |
|
| 75 | - 'status' => $optionsStatus, |
|
| 76 | - 'uid' => $options[1], |
|
| 77 | - 'lastposter' => $options[2], |
|
| 78 | - 'type' => $options[3], |
|
| 79 | - 'sort' => $options[4], |
|
| 80 | - 'order' => $options[5], |
|
| 81 | - 'since' => $options[7], |
|
| 82 | - 'forum' => $optionsForum |
|
| 83 | - ]); |
|
| 84 | - $block = []; |
|
| 85 | - // headers to display in block |
|
| 86 | - $block['headers'] = $topicRenderer->getHeader($options[8]); |
|
| 87 | - |
|
| 88 | - // render a list of topics using all above criterias |
|
| 89 | - list($block['topics'], $block['sticky']) = $topicRenderer->renderTopics(); |
|
| 90 | - |
|
| 91 | - // show index navigation |
|
| 92 | - $block['indexNav'] = !empty($options[9]); |
|
| 93 | - |
|
| 94 | - return $block; |
|
| 54 | + $newbbConfig = newbbLoadConfig(); // load all newbb configs |
|
| 55 | + |
|
| 56 | + $topicRenderer = new Newbb\TopicRenderer(); |
|
| 57 | + $topicRenderer->userlevel = $GLOBALS['xoopsUserIsAdmin'] ? 2 : is_object($GLOBALS['xoopsUser']); // Vistitor's level: 0 - anonymous; 1 - user; 2 - moderator or admin |
|
| 58 | + |
|
| 59 | + $topicRenderer->force = true; // force against static vars for parse |
|
| 60 | + |
|
| 61 | + $topicRenderer->is_multiple = true; // is it for multiple forums |
|
| 62 | + $topicRenderer->config =& $newbbConfig; // get all configs |
|
| 63 | + if (!empty($options[6])) { |
|
| 64 | + $topicRenderer->config['topics_per_page'] = (int)$options[6]; // number of topics (items) to display |
|
| 65 | + } |
|
| 66 | + $topicRenderer->config['topic_title_excerpt'] = (int)$options[10]; // topic title length 0 = dont excerpt |
|
| 67 | + $topicRenderer->config['post_excerpt'] = (int)$options[11]; // post text excerpt 0 = no post text |
|
| 68 | + |
|
| 69 | + $optionsStatus = explode(',', $options[0]); // status in where claus |
|
| 70 | + $optionsForum = explode(',', $options[12]); |
|
| 71 | + |
|
| 72 | + // set and parse values: |
|
| 73 | + // forum: parse positive values to forum IDs and negative values to category IDs. value=0 => all valid forums |
|
| 74 | + $topicRenderer->setVars([ |
|
| 75 | + 'status' => $optionsStatus, |
|
| 76 | + 'uid' => $options[1], |
|
| 77 | + 'lastposter' => $options[2], |
|
| 78 | + 'type' => $options[3], |
|
| 79 | + 'sort' => $options[4], |
|
| 80 | + 'order' => $options[5], |
|
| 81 | + 'since' => $options[7], |
|
| 82 | + 'forum' => $optionsForum |
|
| 83 | + ]); |
|
| 84 | + $block = []; |
|
| 85 | + // headers to display in block |
|
| 86 | + $block['headers'] = $topicRenderer->getHeader($options[8]); |
|
| 87 | + |
|
| 88 | + // render a list of topics using all above criterias |
|
| 89 | + list($block['topics'], $block['sticky']) = $topicRenderer->renderTopics(); |
|
| 90 | + |
|
| 91 | + // show index navigation |
|
| 92 | + $block['indexNav'] = !empty($options[9]); |
|
| 93 | + |
|
| 94 | + return $block; |
|
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | /** |
@@ -100,118 +100,118 @@ discard block |
||
| 100 | 100 | */ |
| 101 | 101 | function newbb_list_topic_edit($options) |
| 102 | 102 | { |
| 103 | - // require_once $GLOBALS['xoops']->path('class/blockform.php'); //reserve for 2.6 |
|
| 104 | - xoops_load('XoopsFormLoader'); |
|
| 105 | - // $form = new \XoopsBlockForm(); //reserve for 2.6 |
|
| 106 | - $form = new \XoopsThemeForm(_MB_NEWBB_DISPLAYMODE_DESC, 'list_topic', ''); |
|
| 107 | - |
|
| 108 | - $topicRenderer = new Newbb\TopicRenderer(); |
|
| 109 | - $topicRenderer->userlevel = 2; // 2 - moderator or admin |
|
| 110 | - |
|
| 111 | - // status element |
|
| 112 | - $optionsStatus = explode(',', $options[0]); |
|
| 113 | - $statusEle = new \XoopsFormSelect(_MB_NEWBB_CRITERIA, 'options[0]', $optionsStatus, 5, true); |
|
| 114 | - $status = $topicRenderer->getStatus($topicRenderer->userlevel); // get all public status + admin status (admin mode, pending deleted) |
|
| 115 | - $statusEle->addOptionArray($status); |
|
| 116 | - $statusEle->setExtra("onchange = \"validate('options[0][]','select', true)\""); // if user dont select any option it select "all" |
|
| 117 | - $statusEle->setDescription(_MB_NEWBB_CRITERIA_DESC); |
|
| 118 | - |
|
| 119 | - // topic_poster element |
|
| 120 | - $topicPosterRadioEle = new \XoopsFormRadio(_MB_NEWBB_AUTHOR, 'options[1]', $options[1]); |
|
| 121 | - $topicPosterRadioEle->addOption(-1, _MD_NEWBB_TOTALUSER); |
|
| 122 | - $topicPosterRadioEle->addOption((-1 !== $options[1]) ? $options[1] : 0, _SELECT); // if no user in selection box it select uid=0 anon users |
|
| 123 | - $topicPosterRadioEle->setExtra("onchange=\"var el=document.getElementById('options[1]'); el.disabled=(this.id == 'options[1]1'); if (!el.value) {el.value= this.value}\""); // if user dont select any option it select "all" |
|
| 124 | - $topicPosterSelectEle = new \XoopsFormSelectUser(_MB_NEWBB_AUTHOR, 'options[1]', true, explode(',', $options[1]), 5, true);// show $limit = 200 users when no user is selected; |
|
| 125 | - $topicPosterEle = new \XoopsFormLabel(_MB_NEWBB_AUTHOR, $topicPosterRadioEle->render() . $topicPosterSelectEle->render()); |
|
| 126 | - |
|
| 127 | - // lastposter element |
|
| 128 | - $lastPosterRadioEle = new \XoopsFormRadio(_MD_NEWBB_POSTER, 'options[2]', $options[2]); |
|
| 129 | - $lastPosterRadioEle->addOption(-1, _MD_NEWBB_TOTALUSER); |
|
| 130 | - $lastPosterRadioEle->addOption((-1 !== $options[2]) ? $options[2] : 0, _SELECT); // if no user in selection box it select uid=1 |
|
| 131 | - $lastPosterRadioEle->setExtra("onchange=\"var el=document.getElementById('options[2]'); el.disabled=(this.id == 'options[2]1'); if (!el.value) {el.value= this.value}\""); // if user dont select any option it select "all" |
|
| 132 | - $lastPosterSelectEle = new \XoopsFormSelectUser(_MD_NEWBB_POSTER, 'options[2]', true, explode(',', $options[2]), 5, true);// show $limit = 200 users when no user is selected; |
|
| 133 | - $lastPosterEle = new \XoopsFormLabel(_MD_NEWBB_POSTER, $lastPosterRadioEle->render() . $lastPosterSelectEle->render()); |
|
| 134 | - |
|
| 135 | - // type element |
|
| 136 | - $types = $topicRenderer->getTypes(); // get all available types in all forums |
|
| 137 | - $typeEle = new \XoopsFormSelect(_MD_NEWBB_TYPE, 'options[3]', $options[3]); |
|
| 138 | - $typeEle->addOption(0, _NONE); |
|
| 139 | - if (!empty($types)) { |
|
| 140 | - foreach ($types as $type_id => $type) { |
|
| 141 | - $typeEle->addOption($type_id, $type['type_name']); |
|
| 142 | - } |
|
| 143 | - } |
|
| 144 | - |
|
| 145 | - // sort element |
|
| 146 | - $sortEle = new \XoopsFormSelect(_MD_NEWBB_SORTBY, 'options[4]', $options[4]); |
|
| 147 | - $sortEle->setDescription(_MB_NEWBB_CRITERIA_SORT_DESC); |
|
| 148 | - $sorts = $topicRenderer->getSort('', 'title'); |
|
| 149 | - $sortEle->addOptionArray($sorts); |
|
| 150 | - |
|
| 151 | - // order element |
|
| 152 | - $orderEle = new \XoopsFormSelect(_MB_NEWBB_CRITERIA_ORDER, 'options[5]', $options[5]); |
|
| 153 | - $orderEle->addOption(0, _DESCENDING); |
|
| 154 | - $orderEle->addOption(1, _ASCENDING); |
|
| 155 | - |
|
| 156 | - // number of topics to display element |
|
| 157 | - $numdispEle = new \XoopsFormText(_MB_NEWBB_DISPLAY, 'options[6]', 10, 255, (int)$options[6]); |
|
| 158 | - |
|
| 159 | - $timeEle = new \XoopsFormText(_MB_NEWBB_TIME, 'options[7]', 10, 255, $options[7]); |
|
| 160 | - $timeEle->setDescription(_MB_NEWBB_TIME_DESC); |
|
| 161 | - |
|
| 162 | - // mode disp element |
|
| 163 | - $options_headers = explode(',', $options[8]); |
|
| 164 | - $modeEle = new \XoopsFormCheckBox(_MB_NEWBB_DISPLAYMODE, 'options[8][]', $options_headers); |
|
| 165 | - $modeEle->setDescription(_MB_NEWBB_DISPLAYMODE_DESC); |
|
| 166 | - $modeEle->columns = 4; |
|
| 167 | - $disps = $topicRenderer->getHeader(); |
|
| 168 | - $modeEle->addOptionArray($disps); |
|
| 169 | - $modeEle->setExtra("onchange = \"validate('options[8][]','checkbox', true)\""); // prevent user select no option |
|
| 170 | - // Index navigation element |
|
| 171 | - $navEle = new \XoopsFormRadioYN(_MB_NEWBB_INDEXNAV, 'options[9]', !empty($options[9])); |
|
| 172 | - |
|
| 173 | - // Topic title element |
|
| 174 | - $lengthEle = new \XoopsFormText(_MB_NEWBB_TITLE_LENGTH, 'options[10]', 10, 255, (int)$options[10]); |
|
| 175 | - $lengthEle->setDescription(_MB_NEWBB_TITLE_LENGTH_DESC); |
|
| 176 | - |
|
| 177 | - // Post text element |
|
| 178 | - $postExcerptEle = new \XoopsFormText(_MB_NEWBB_POST_EXCERPT, 'options[11]', 10, 255, (int)$options[11]); |
|
| 179 | - $postExcerptEle->setDescription(_MB_NEWBB_POST_EXCERPT_DESC); |
|
| 180 | - |
|
| 181 | - // forum element |
|
| 182 | - $optionsForum = explode(',', $options[12]); |
|
| 183 | - require_once dirname(__DIR__) . '/include/functions.forum.php'; |
|
| 184 | - /** @var Newbb\ForumHandler $forumHandler */ |
|
| 185 | - $forumHandler = Newbb\Helper::getInstance()->getHandler('Forum'); |
|
| 186 | - //get forum Ids by values. parse positive values to forum IDs and negative values to category IDs. value=0 => all valid forums |
|
| 187 | - // Get accessible forums |
|
| 188 | - $accessForums = $forumHandler->getIdsByValues(array_map('intval', $optionsForum)); |
|
| 189 | - $isAll = (0 === count($optionsForum) || empty($optionsForum[0])); |
|
| 190 | - $forumSel = "<select name=\"options[12][]\" multiple=\"multiple\" onchange = \"validate('options[12][]','select', true)\">";// if user dont select any it select "0" |
|
| 191 | - $forumSel .= '<option value="0" '; |
|
| 192 | - if ($isAll) { |
|
| 193 | - $forumSel .= ' selected'; |
|
| 194 | - $accessForums = null; // just select _ALL option |
|
| 195 | - } |
|
| 196 | - $forumSel .= '>' . _ALL . '</option>'; |
|
| 197 | - $forumSel .= newbbForumSelectBox($accessForums, 'access', false); //$accessForums, $permission = "access", $delimitorCategory = false |
|
| 198 | - $forumSel .= '</select>'; |
|
| 199 | - $forumEle = new \XoopsFormLabel(_MB_NEWBB_FORUMLIST, $forumSel); |
|
| 200 | - |
|
| 201 | - // add all elements to form |
|
| 202 | - $form->addElement($statusEle); |
|
| 203 | - $form->addElement($topicPosterEle); |
|
| 204 | - $form->addElement($lastPosterEle); |
|
| 205 | - $form->addElement($typeEle); |
|
| 206 | - $form->addElement($sortEle); |
|
| 207 | - $form->addElement($orderEle); |
|
| 208 | - $form->addElement($numdispEle); |
|
| 209 | - $form->addElement($timeEle); |
|
| 210 | - $form->addElement($modeEle, true); // required: user should select at least one otherwise it will select the first one |
|
| 211 | - $form->addElement($navEle); |
|
| 212 | - $form->addElement($lengthEle); |
|
| 213 | - $form->addElement($postExcerptEle); |
|
| 214 | - $form->addElement($forumEle); |
|
| 215 | - |
|
| 216 | - return $form->render(); |
|
| 103 | + // require_once $GLOBALS['xoops']->path('class/blockform.php'); //reserve for 2.6 |
|
| 104 | + xoops_load('XoopsFormLoader'); |
|
| 105 | + // $form = new \XoopsBlockForm(); //reserve for 2.6 |
|
| 106 | + $form = new \XoopsThemeForm(_MB_NEWBB_DISPLAYMODE_DESC, 'list_topic', ''); |
|
| 107 | + |
|
| 108 | + $topicRenderer = new Newbb\TopicRenderer(); |
|
| 109 | + $topicRenderer->userlevel = 2; // 2 - moderator or admin |
|
| 110 | + |
|
| 111 | + // status element |
|
| 112 | + $optionsStatus = explode(',', $options[0]); |
|
| 113 | + $statusEle = new \XoopsFormSelect(_MB_NEWBB_CRITERIA, 'options[0]', $optionsStatus, 5, true); |
|
| 114 | + $status = $topicRenderer->getStatus($topicRenderer->userlevel); // get all public status + admin status (admin mode, pending deleted) |
|
| 115 | + $statusEle->addOptionArray($status); |
|
| 116 | + $statusEle->setExtra("onchange = \"validate('options[0][]','select', true)\""); // if user dont select any option it select "all" |
|
| 117 | + $statusEle->setDescription(_MB_NEWBB_CRITERIA_DESC); |
|
| 118 | + |
|
| 119 | + // topic_poster element |
|
| 120 | + $topicPosterRadioEle = new \XoopsFormRadio(_MB_NEWBB_AUTHOR, 'options[1]', $options[1]); |
|
| 121 | + $topicPosterRadioEle->addOption(-1, _MD_NEWBB_TOTALUSER); |
|
| 122 | + $topicPosterRadioEle->addOption((-1 !== $options[1]) ? $options[1] : 0, _SELECT); // if no user in selection box it select uid=0 anon users |
|
| 123 | + $topicPosterRadioEle->setExtra("onchange=\"var el=document.getElementById('options[1]'); el.disabled=(this.id == 'options[1]1'); if (!el.value) {el.value= this.value}\""); // if user dont select any option it select "all" |
|
| 124 | + $topicPosterSelectEle = new \XoopsFormSelectUser(_MB_NEWBB_AUTHOR, 'options[1]', true, explode(',', $options[1]), 5, true);// show $limit = 200 users when no user is selected; |
|
| 125 | + $topicPosterEle = new \XoopsFormLabel(_MB_NEWBB_AUTHOR, $topicPosterRadioEle->render() . $topicPosterSelectEle->render()); |
|
| 126 | + |
|
| 127 | + // lastposter element |
|
| 128 | + $lastPosterRadioEle = new \XoopsFormRadio(_MD_NEWBB_POSTER, 'options[2]', $options[2]); |
|
| 129 | + $lastPosterRadioEle->addOption(-1, _MD_NEWBB_TOTALUSER); |
|
| 130 | + $lastPosterRadioEle->addOption((-1 !== $options[2]) ? $options[2] : 0, _SELECT); // if no user in selection box it select uid=1 |
|
| 131 | + $lastPosterRadioEle->setExtra("onchange=\"var el=document.getElementById('options[2]'); el.disabled=(this.id == 'options[2]1'); if (!el.value) {el.value= this.value}\""); // if user dont select any option it select "all" |
|
| 132 | + $lastPosterSelectEle = new \XoopsFormSelectUser(_MD_NEWBB_POSTER, 'options[2]', true, explode(',', $options[2]), 5, true);// show $limit = 200 users when no user is selected; |
|
| 133 | + $lastPosterEle = new \XoopsFormLabel(_MD_NEWBB_POSTER, $lastPosterRadioEle->render() . $lastPosterSelectEle->render()); |
|
| 134 | + |
|
| 135 | + // type element |
|
| 136 | + $types = $topicRenderer->getTypes(); // get all available types in all forums |
|
| 137 | + $typeEle = new \XoopsFormSelect(_MD_NEWBB_TYPE, 'options[3]', $options[3]); |
|
| 138 | + $typeEle->addOption(0, _NONE); |
|
| 139 | + if (!empty($types)) { |
|
| 140 | + foreach ($types as $type_id => $type) { |
|
| 141 | + $typeEle->addOption($type_id, $type['type_name']); |
|
| 142 | + } |
|
| 143 | + } |
|
| 144 | + |
|
| 145 | + // sort element |
|
| 146 | + $sortEle = new \XoopsFormSelect(_MD_NEWBB_SORTBY, 'options[4]', $options[4]); |
|
| 147 | + $sortEle->setDescription(_MB_NEWBB_CRITERIA_SORT_DESC); |
|
| 148 | + $sorts = $topicRenderer->getSort('', 'title'); |
|
| 149 | + $sortEle->addOptionArray($sorts); |
|
| 150 | + |
|
| 151 | + // order element |
|
| 152 | + $orderEle = new \XoopsFormSelect(_MB_NEWBB_CRITERIA_ORDER, 'options[5]', $options[5]); |
|
| 153 | + $orderEle->addOption(0, _DESCENDING); |
|
| 154 | + $orderEle->addOption(1, _ASCENDING); |
|
| 155 | + |
|
| 156 | + // number of topics to display element |
|
| 157 | + $numdispEle = new \XoopsFormText(_MB_NEWBB_DISPLAY, 'options[6]', 10, 255, (int)$options[6]); |
|
| 158 | + |
|
| 159 | + $timeEle = new \XoopsFormText(_MB_NEWBB_TIME, 'options[7]', 10, 255, $options[7]); |
|
| 160 | + $timeEle->setDescription(_MB_NEWBB_TIME_DESC); |
|
| 161 | + |
|
| 162 | + // mode disp element |
|
| 163 | + $options_headers = explode(',', $options[8]); |
|
| 164 | + $modeEle = new \XoopsFormCheckBox(_MB_NEWBB_DISPLAYMODE, 'options[8][]', $options_headers); |
|
| 165 | + $modeEle->setDescription(_MB_NEWBB_DISPLAYMODE_DESC); |
|
| 166 | + $modeEle->columns = 4; |
|
| 167 | + $disps = $topicRenderer->getHeader(); |
|
| 168 | + $modeEle->addOptionArray($disps); |
|
| 169 | + $modeEle->setExtra("onchange = \"validate('options[8][]','checkbox', true)\""); // prevent user select no option |
|
| 170 | + // Index navigation element |
|
| 171 | + $navEle = new \XoopsFormRadioYN(_MB_NEWBB_INDEXNAV, 'options[9]', !empty($options[9])); |
|
| 172 | + |
|
| 173 | + // Topic title element |
|
| 174 | + $lengthEle = new \XoopsFormText(_MB_NEWBB_TITLE_LENGTH, 'options[10]', 10, 255, (int)$options[10]); |
|
| 175 | + $lengthEle->setDescription(_MB_NEWBB_TITLE_LENGTH_DESC); |
|
| 176 | + |
|
| 177 | + // Post text element |
|
| 178 | + $postExcerptEle = new \XoopsFormText(_MB_NEWBB_POST_EXCERPT, 'options[11]', 10, 255, (int)$options[11]); |
|
| 179 | + $postExcerptEle->setDescription(_MB_NEWBB_POST_EXCERPT_DESC); |
|
| 180 | + |
|
| 181 | + // forum element |
|
| 182 | + $optionsForum = explode(',', $options[12]); |
|
| 183 | + require_once dirname(__DIR__) . '/include/functions.forum.php'; |
|
| 184 | + /** @var Newbb\ForumHandler $forumHandler */ |
|
| 185 | + $forumHandler = Newbb\Helper::getInstance()->getHandler('Forum'); |
|
| 186 | + //get forum Ids by values. parse positive values to forum IDs and negative values to category IDs. value=0 => all valid forums |
|
| 187 | + // Get accessible forums |
|
| 188 | + $accessForums = $forumHandler->getIdsByValues(array_map('intval', $optionsForum)); |
|
| 189 | + $isAll = (0 === count($optionsForum) || empty($optionsForum[0])); |
|
| 190 | + $forumSel = "<select name=\"options[12][]\" multiple=\"multiple\" onchange = \"validate('options[12][]','select', true)\">";// if user dont select any it select "0" |
|
| 191 | + $forumSel .= '<option value="0" '; |
|
| 192 | + if ($isAll) { |
|
| 193 | + $forumSel .= ' selected'; |
|
| 194 | + $accessForums = null; // just select _ALL option |
|
| 195 | + } |
|
| 196 | + $forumSel .= '>' . _ALL . '</option>'; |
|
| 197 | + $forumSel .= newbbForumSelectBox($accessForums, 'access', false); //$accessForums, $permission = "access", $delimitorCategory = false |
|
| 198 | + $forumSel .= '</select>'; |
|
| 199 | + $forumEle = new \XoopsFormLabel(_MB_NEWBB_FORUMLIST, $forumSel); |
|
| 200 | + |
|
| 201 | + // add all elements to form |
|
| 202 | + $form->addElement($statusEle); |
|
| 203 | + $form->addElement($topicPosterEle); |
|
| 204 | + $form->addElement($lastPosterEle); |
|
| 205 | + $form->addElement($typeEle); |
|
| 206 | + $form->addElement($sortEle); |
|
| 207 | + $form->addElement($orderEle); |
|
| 208 | + $form->addElement($numdispEle); |
|
| 209 | + $form->addElement($timeEle); |
|
| 210 | + $form->addElement($modeEle, true); // required: user should select at least one otherwise it will select the first one |
|
| 211 | + $form->addElement($navEle); |
|
| 212 | + $form->addElement($lengthEle); |
|
| 213 | + $form->addElement($postExcerptEle); |
|
| 214 | + $form->addElement($forumEle); |
|
| 215 | + |
|
| 216 | + return $form->render(); |
|
| 217 | 217 | } |
@@ -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 |
@@ -20,12 +20,12 @@ discard block |
||
| 20 | 20 | */ |
| 21 | 21 | function newbb_tag_block_cloud_show($options) |
| 22 | 22 | { |
| 23 | - if (!@require_once $GLOBALS['xoops']->path('modules/tag/blocks/block.php')) { |
|
| 24 | - return null; |
|
| 25 | - } |
|
| 26 | - $block_content = tag_block_cloud_show($options, 'newbb'); |
|
| 23 | + if (!@require_once $GLOBALS['xoops']->path('modules/tag/blocks/block.php')) { |
|
| 24 | + return null; |
|
| 25 | + } |
|
| 26 | + $block_content = tag_block_cloud_show($options, 'newbb'); |
|
| 27 | 27 | |
| 28 | - return $block_content; |
|
| 28 | + return $block_content; |
|
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | /** |
@@ -34,12 +34,12 @@ discard block |
||
| 34 | 34 | */ |
| 35 | 35 | function newbb_tag_block_cloud_edit($options) |
| 36 | 36 | { |
| 37 | - if (!@require_once $GLOBALS['xoops']->path('modules/tag/blocks/block.php')) { |
|
| 38 | - return null; |
|
| 39 | - } |
|
| 40 | - $form = tag_block_cloud_edit($options); |
|
| 37 | + if (!@require_once $GLOBALS['xoops']->path('modules/tag/blocks/block.php')) { |
|
| 38 | + return null; |
|
| 39 | + } |
|
| 40 | + $form = tag_block_cloud_edit($options); |
|
| 41 | 41 | |
| 42 | - return $form; |
|
| 42 | + return $form; |
|
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | /**#@+ |
@@ -49,12 +49,12 @@ discard block |
||
| 49 | 49 | */ |
| 50 | 50 | function newbb_tag_block_top_show($options) |
| 51 | 51 | { |
| 52 | - if (!@require_once $GLOBALS['xoops']->path('modules/tag/blocks/block.php')) { |
|
| 53 | - return null; |
|
| 54 | - } |
|
| 55 | - $block_content = tag_block_top_show($options, 'newbb'); |
|
| 52 | + if (!@require_once $GLOBALS['xoops']->path('modules/tag/blocks/block.php')) { |
|
| 53 | + return null; |
|
| 54 | + } |
|
| 55 | + $block_content = tag_block_top_show($options, 'newbb'); |
|
| 56 | 56 | |
| 57 | - return $block_content; |
|
| 57 | + return $block_content; |
|
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | /** |
@@ -63,10 +63,10 @@ discard block |
||
| 63 | 63 | */ |
| 64 | 64 | function newbb_tag_block_top_edit($options) |
| 65 | 65 | { |
| 66 | - if (!@require_once $GLOBALS['xoops']->path('modules/tag/blocks/block.php')) { |
|
| 67 | - return null; |
|
| 68 | - } |
|
| 69 | - $form = tag_block_top_edit($options); |
|
| 66 | + if (!@require_once $GLOBALS['xoops']->path('modules/tag/blocks/block.php')) { |
|
| 67 | + return null; |
|
| 68 | + } |
|
| 69 | + $form = tag_block_top_edit($options); |
|
| 70 | 70 | |
| 71 | - return $form; |
|
| 71 | + return $form; |
|
| 72 | 72 | } |
@@ -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>'; |
@@ -11,15 +11,15 @@ discard block |
||
| 11 | 11 | require_once __DIR__ . '/header.php'; |
| 12 | 12 | |
| 13 | 13 | if (!is_object($GLOBALS['xoopsUser']) || !$GLOBALS['xoopsUser']->isAdmin()) { |
| 14 | - exit(_NOPERM); |
|
| 14 | + exit(_NOPERM); |
|
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | if ($xoopsModule->getVar('version') >= 401) { |
| 18 | - exit('Version not valid'); |
|
| 18 | + exit('Version not valid'); |
|
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | if (empty($GLOBALS['xoopsModuleConfig']['subject_prefix'])) { |
| 22 | - exit('No need for update'); |
|
| 22 | + exit('No need for update'); |
|
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | $GLOBALS['xoopsDB']->queryF('DROP TABLE ' . $GLOBALS['xoopsDB']->prefix('newbb_type_tmp')); |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | PRIMARY KEY (`type_id`) |
| 36 | 36 | ) ENGINE=MyISAM; |
| 37 | 37 | ")) { |
| 38 | - exit('Can not create tmp table for `bb_type_tmp`'); |
|
| 38 | + exit('Can not create tmp table for `bb_type_tmp`'); |
|
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | if (!$GLOBALS['xoopsDB']->queryF(' |
@@ -50,8 +50,8 @@ discard block |
||
| 50 | 50 | KEY `type_order` (`type_order`) |
| 51 | 51 | ) ENGINE=MyISAM; |
| 52 | 52 | ")) { |
| 53 | - $GLOBALS['xoopsDB']->queryF('DROP TABLE ' . $GLOBALS['xoopsDB']->prefix('newbb_type_tmp')); |
|
| 54 | - exit('Can not create tmp table for `bb_type_forum_tmp`'); |
|
| 53 | + $GLOBALS['xoopsDB']->queryF('DROP TABLE ' . $GLOBALS['xoopsDB']->prefix('newbb_type_tmp')); |
|
| 54 | + exit('Can not create tmp table for `bb_type_forum_tmp`'); |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | //$typeHandler = Newbb\Helper::getInstance()->getHandler('Type'); |
@@ -59,43 +59,43 @@ discard block |
||
| 59 | 59 | $types = []; |
| 60 | 60 | $order = 1; |
| 61 | 61 | foreach ($subjectpres as $subjectpre) { |
| 62 | - if (preg_match("/<[^#]*color=[\"'](#[^'\"\s]*)[^>]>[\[]?([^<\]]*)[\]]?/is", $subjectpre, $matches)) { |
|
| 63 | - if (!$GLOBALS['xoopsDB']->queryF(' |
|
| 62 | + if (preg_match("/<[^#]*color=[\"'](#[^'\"\s]*)[^>]>[\[]?([^<\]]*)[\]]?/is", $subjectpre, $matches)) { |
|
| 63 | + if (!$GLOBALS['xoopsDB']->queryF(' |
|
| 64 | 64 | INSERT INTO ' . $GLOBALS['xoopsDB']->prefix('newbb_type_tmp') . ' |
| 65 | 65 | (`type_name`, `type_color`) |
| 66 | 66 | VALUES |
| 67 | 67 | (' . $GLOBALS['xoopsDB']->quoteString($matches[2]) . ', ' . $GLOBALS['xoopsDB']->quoteString($matches[1]) . ') |
| 68 | 68 | ')) { |
| 69 | - xoops_error("Can not add type of `{$matches[2]}`"); |
|
| 70 | - continue; |
|
| 71 | - } |
|
| 72 | - $types[$GLOBALS['xoopsDB']->getInsertId()] = $order++; |
|
| 73 | - } |
|
| 69 | + xoops_error("Can not add type of `{$matches[2]}`"); |
|
| 70 | + continue; |
|
| 71 | + } |
|
| 72 | + $types[$GLOBALS['xoopsDB']->getInsertId()] = $order++; |
|
| 73 | + } |
|
| 74 | 74 | } |
| 75 | 75 | if (0 === count($types)) { |
| 76 | - $GLOBALS['xoopsDB']->queryF('DROP TABLE ' . $GLOBALS['xoopsDB']->prefix('newbb_type_tmp')); |
|
| 77 | - $GLOBALS['xoopsDB']->queryF('DROP TABLE ' . $GLOBALS['xoopsDB']->prefix('newbb_type_forum_tmp')); |
|
| 78 | - exit('No type item created'); |
|
| 76 | + $GLOBALS['xoopsDB']->queryF('DROP TABLE ' . $GLOBALS['xoopsDB']->prefix('newbb_type_tmp')); |
|
| 77 | + $GLOBALS['xoopsDB']->queryF('DROP TABLE ' . $GLOBALS['xoopsDB']->prefix('newbb_type_forum_tmp')); |
|
| 78 | + exit('No type item created'); |
|
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | ///** @var Newbb\ForumHandler $forumHandler */ |
| 82 | 82 | //$forumHandler = Newbb\Helper::getInstance()->getHandler('Forum'); |
| 83 | 83 | if ($forums_type = $forumHandler->getIds(new \Criteria('allow_subject_prefix', 1))) { |
| 84 | - foreach ($forums_type as $forum_id) { |
|
| 85 | - $type_query = []; |
|
| 86 | - foreach ($types as $key => $order) { |
|
| 87 | - $type_query[] = "({$key}, {$forum_id}, {$order})"; |
|
| 88 | - } |
|
| 84 | + foreach ($forums_type as $forum_id) { |
|
| 85 | + $type_query = []; |
|
| 86 | + foreach ($types as $key => $order) { |
|
| 87 | + $type_query[] = "({$key}, {$forum_id}, {$order})"; |
|
| 88 | + } |
|
| 89 | 89 | |
| 90 | - $sql = 'INSERT INTO ' . $GLOBALS['xoopsDB']->prefix('newbb_type_forum_tmp') . ' (type_id, forum_id, type_order) ' . ' VALUES ' . implode(', ', $type_query); |
|
| 91 | - if (false === ($result = $GLOBALS['xoopsDB']->queryF($sql))) { |
|
| 92 | - xoops_error($GLOBALS['xoopsDB']->error()); |
|
| 93 | - } |
|
| 94 | - } |
|
| 90 | + $sql = 'INSERT INTO ' . $GLOBALS['xoopsDB']->prefix('newbb_type_forum_tmp') . ' (type_id, forum_id, type_order) ' . ' VALUES ' . implode(', ', $type_query); |
|
| 91 | + if (false === ($result = $GLOBALS['xoopsDB']->queryF($sql))) { |
|
| 92 | + xoops_error($GLOBALS['xoopsDB']->error()); |
|
| 93 | + } |
|
| 94 | + } |
|
| 95 | 95 | } else { |
| 96 | - $GLOBALS['xoopsDB']->queryF('DROP TABLE ' . $GLOBALS['xoopsDB']->prefix('newbb_type_tmp')); |
|
| 97 | - $GLOBALS['xoopsDB']->queryF('DROP TABLE ' . $GLOBALS['xoopsDB']->prefix('newbb_type_forum_tmp')); |
|
| 98 | - exit('No type item to update'); |
|
| 96 | + $GLOBALS['xoopsDB']->queryF('DROP TABLE ' . $GLOBALS['xoopsDB']->prefix('newbb_type_tmp')); |
|
| 97 | + $GLOBALS['xoopsDB']->queryF('DROP TABLE ' . $GLOBALS['xoopsDB']->prefix('newbb_type_forum_tmp')); |
|
| 98 | + exit('No type item to update'); |
|
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | die('update succeeded'); |
@@ -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); |