@@ -17,45 +17,45 @@ |
||
| 17 | 17 | define('NEWBB_FUNCTIONS_RECON_LOADED', true); |
| 18 | 18 | |
| 19 | 19 | if (!defined('NEWBB_FUNCTIONS_RECON')) { |
| 20 | - define('NEWBB_FUNCTIONS_RECON', 1); |
|
| 20 | + define('NEWBB_FUNCTIONS_RECON', 1); |
|
| 21 | 21 | |
| 22 | - /** |
|
| 23 | - * @param null $type |
|
| 24 | - * @return bool |
|
| 25 | - */ |
|
| 26 | - function newbbSynchronization($type = null) |
|
| 27 | - { |
|
| 28 | - $allTypes = [ |
|
| 29 | - 'category', |
|
| 30 | - 'forum', |
|
| 31 | - 'topic', |
|
| 32 | - 'post', |
|
| 33 | - 'report', |
|
| 34 | - 'rate', |
|
| 35 | - 'moderate', |
|
| 36 | - 'readtopic', |
|
| 37 | - 'readforum', |
|
| 38 | - 'stats' |
|
| 39 | - ]; |
|
| 40 | - $type = []; |
|
| 41 | - $type = empty($type) ? $allTypes : (is_array($type) ? $type : [$type]); |
|
| 42 | - foreach ($type as $item) { |
|
| 43 | - $handler = Newbb\Helper::getInstance()->getHandler($item); |
|
| 44 | - if ('stats' !== $item) { |
|
| 45 | - $handler->synchronization(); |
|
| 46 | - } else { |
|
| 47 | - $handler->reset(); |
|
| 48 | - } |
|
| 22 | + /** |
|
| 23 | + * @param null $type |
|
| 24 | + * @return bool |
|
| 25 | + */ |
|
| 26 | + function newbbSynchronization($type = null) |
|
| 27 | + { |
|
| 28 | + $allTypes = [ |
|
| 29 | + 'category', |
|
| 30 | + 'forum', |
|
| 31 | + 'topic', |
|
| 32 | + 'post', |
|
| 33 | + 'report', |
|
| 34 | + 'rate', |
|
| 35 | + 'moderate', |
|
| 36 | + 'readtopic', |
|
| 37 | + 'readforum', |
|
| 38 | + 'stats' |
|
| 39 | + ]; |
|
| 40 | + $type = []; |
|
| 41 | + $type = empty($type) ? $allTypes : (is_array($type) ? $type : [$type]); |
|
| 42 | + foreach ($type as $item) { |
|
| 43 | + $handler = Newbb\Helper::getInstance()->getHandler($item); |
|
| 44 | + if ('stats' !== $item) { |
|
| 45 | + $handler->synchronization(); |
|
| 46 | + } else { |
|
| 47 | + $handler->reset(); |
|
| 48 | + } |
|
| 49 | 49 | |
| 50 | - if (method_exists($handler, 'cleanExpires')) { |
|
| 51 | - $handler->cleanExpires(); |
|
| 52 | - } |
|
| 53 | - if (method_exists($handler, 'clearGarbage')) { |
|
| 54 | - $handler->clearGarbage(); |
|
| 55 | - } |
|
| 56 | - unset($handler); |
|
| 57 | - } |
|
| 50 | + if (method_exists($handler, 'cleanExpires')) { |
|
| 51 | + $handler->cleanExpires(); |
|
| 52 | + } |
|
| 53 | + if (method_exists($handler, 'clearGarbage')) { |
|
| 54 | + $handler->clearGarbage(); |
|
| 55 | + } |
|
| 56 | + unset($handler); |
|
| 57 | + } |
|
| 58 | 58 | |
| 59 | - return true; |
|
| 60 | - } |
|
| 59 | + return true; |
|
| 60 | + } |
|
| 61 | 61 | } |
@@ -74,9 +74,9 @@ |
||
| 74 | 74 | // MENU handler |
| 75 | 75 | /* You could remove anyone by commenting out in order to disable it */ |
| 76 | 76 | $customConfig['valid_menumodes'] = [ |
| 77 | - 0 => _MD_NEWBB_MENU_SELECT, // for selectbox |
|
| 78 | - //1 => _MD_NEWBB_MENU_CLICK, // for "click to expand" |
|
| 79 | - //2 => _MD_NEWBB_MENU_HOVER // for "mouse hover to expand" |
|
| 77 | + 0 => _MD_NEWBB_MENU_SELECT, // for selectbox |
|
| 78 | + //1 => _MD_NEWBB_MENU_CLICK, // for "click to expand" |
|
| 79 | + //2 => _MD_NEWBB_MENU_HOVER // for "mouse hover to expand" |
|
| 80 | 80 | ]; |
| 81 | 81 | |
| 82 | 82 | // view latest edit |
@@ -13,89 +13,89 @@ |
||
| 13 | 13 | */ |
| 14 | 14 | function b_sitemap_newbb() |
| 15 | 15 | { |
| 16 | - global $sitemap_configs; |
|
| 17 | - $sitemap = []; |
|
| 16 | + global $sitemap_configs; |
|
| 17 | + $sitemap = []; |
|
| 18 | 18 | |
| 19 | - /** @var Newbb\ForumHandler $forumHandler */ |
|
| 20 | - $forumHandler = Newbb\Helper::getInstance()->getHandler('Forum'); |
|
| 21 | - /* Allowed forums */ |
|
| 22 | - $forums_allowed = $forumHandler->getIdsByPermission(); |
|
| 19 | + /** @var Newbb\ForumHandler $forumHandler */ |
|
| 20 | + $forumHandler = Newbb\Helper::getInstance()->getHandler('Forum'); |
|
| 21 | + /* Allowed forums */ |
|
| 22 | + $forums_allowed = $forumHandler->getIdsByPermission(); |
|
| 23 | 23 | |
| 24 | - /* fetch top forums */ |
|
| 25 | - $forums_top_id = []; |
|
| 26 | - if (!empty($forums_allowed)) { |
|
| 27 | - $crit_top = new \CriteriaCompo(new \Criteria('parent_forum', 0)); |
|
| 28 | - //$crit_top->add(new \Criteria("cat_id", "(".implode(", ", array_keys($categories)).")", "IN")); |
|
| 29 | - $crit_top->add(new \Criteria('forum_id', '(' . implode(', ', $forums_allowed) . ')', 'IN')); |
|
| 30 | - $forums_top_id = $forumHandler->getIds($crit_top); |
|
| 31 | - } |
|
| 24 | + /* fetch top forums */ |
|
| 25 | + $forums_top_id = []; |
|
| 26 | + if (!empty($forums_allowed)) { |
|
| 27 | + $crit_top = new \CriteriaCompo(new \Criteria('parent_forum', 0)); |
|
| 28 | + //$crit_top->add(new \Criteria("cat_id", "(".implode(", ", array_keys($categories)).")", "IN")); |
|
| 29 | + $crit_top->add(new \Criteria('forum_id', '(' . implode(', ', $forums_allowed) . ')', 'IN')); |
|
| 30 | + $forums_top_id = $forumHandler->getIds($crit_top); |
|
| 31 | + } |
|
| 32 | 32 | |
| 33 | - $forums_sub_id = []; |
|
| 34 | - if ((bool)$forums_top_id && $sitemap_configs['show_subcategoris']) { |
|
| 35 | - $crit_sub = new \CriteriaCompo(new \Criteria('parent_forum', '(' . implode(', ', $forums_top_id) . ')', 'IN')); |
|
| 36 | - $crit_sub->add(new \Criteria('forum_id', '(' . implode(', ', $forums_allowed) . ')', 'IN')); |
|
| 37 | - $forums_sub_id = $forumHandler->getIds($crit_sub); |
|
| 38 | - } |
|
| 33 | + $forums_sub_id = []; |
|
| 34 | + if ((bool)$forums_top_id && $sitemap_configs['show_subcategoris']) { |
|
| 35 | + $crit_sub = new \CriteriaCompo(new \Criteria('parent_forum', '(' . implode(', ', $forums_top_id) . ')', 'IN')); |
|
| 36 | + $crit_sub->add(new \Criteria('forum_id', '(' . implode(', ', $forums_allowed) . ')', 'IN')); |
|
| 37 | + $forums_sub_id = $forumHandler->getIds($crit_sub); |
|
| 38 | + } |
|
| 39 | 39 | |
| 40 | - /* Fetch forum data */ |
|
| 41 | - $forums_available = array_merge($forums_top_id, $forums_sub_id); |
|
| 42 | - $forums_array = []; |
|
| 43 | - if ((bool)$forums_available) { |
|
| 44 | - $crit_forum = new \Criteria('forum_id', '(' . implode(', ', $forums_available) . ')', 'IN'); |
|
| 45 | - $crit_forum->setSort('cat_id ASC, parent_forum ASC, forum_order'); |
|
| 46 | - $crit_forum->setOrder('ASC'); |
|
| 47 | - $forums_array = $forumHandler->getAll($crit_forum, ['forum_name', 'parent_forum', 'cat_id'], false); |
|
| 48 | - } |
|
| 40 | + /* Fetch forum data */ |
|
| 41 | + $forums_available = array_merge($forums_top_id, $forums_sub_id); |
|
| 42 | + $forums_array = []; |
|
| 43 | + if ((bool)$forums_available) { |
|
| 44 | + $crit_forum = new \Criteria('forum_id', '(' . implode(', ', $forums_available) . ')', 'IN'); |
|
| 45 | + $crit_forum->setSort('cat_id ASC, parent_forum ASC, forum_order'); |
|
| 46 | + $crit_forum->setOrder('ASC'); |
|
| 47 | + $forums_array = $forumHandler->getAll($crit_forum, ['forum_name', 'parent_forum', 'cat_id'], false); |
|
| 48 | + } |
|
| 49 | 49 | |
| 50 | - $forums = []; |
|
| 51 | - foreach ($forums_array as $forumid => $forum) { |
|
| 52 | - if ((bool)$forum['parent_forum']) { |
|
| 53 | - $forums[$forum['parent_forum']]['fchild'][$forumid] = [ |
|
| 54 | - 'id' => $forumid, |
|
| 55 | - 'url' => 'viewforum.php?forum=' . $forumid, |
|
| 56 | - 'title' => $forum['forum_name'] |
|
| 57 | - ]; |
|
| 58 | - } else { |
|
| 59 | - $forums[$forumid] = [ |
|
| 60 | - 'id' => $forumid, |
|
| 61 | - 'cid' => $forum['cat_id'], |
|
| 62 | - 'url' => 'viewforum.php?forum=' . $forumid, |
|
| 63 | - 'title' => $forum['forum_name'] |
|
| 64 | - ]; |
|
| 65 | - } |
|
| 66 | - } |
|
| 50 | + $forums = []; |
|
| 51 | + foreach ($forums_array as $forumid => $forum) { |
|
| 52 | + if ((bool)$forum['parent_forum']) { |
|
| 53 | + $forums[$forum['parent_forum']]['fchild'][$forumid] = [ |
|
| 54 | + 'id' => $forumid, |
|
| 55 | + 'url' => 'viewforum.php?forum=' . $forumid, |
|
| 56 | + 'title' => $forum['forum_name'] |
|
| 57 | + ]; |
|
| 58 | + } else { |
|
| 59 | + $forums[$forumid] = [ |
|
| 60 | + 'id' => $forumid, |
|
| 61 | + 'cid' => $forum['cat_id'], |
|
| 62 | + 'url' => 'viewforum.php?forum=' . $forumid, |
|
| 63 | + 'title' => $forum['forum_name'] |
|
| 64 | + ]; |
|
| 65 | + } |
|
| 66 | + } |
|
| 67 | 67 | |
| 68 | - if ($sitemap_configs['show_subcategoris']) { |
|
| 69 | - /** @var Newbb\CategoryHandler $categoryHandler */ |
|
| 70 | - $categoryHandler = Newbb\Helper::getInstance()->getHandler('Category'); |
|
| 71 | - $categories = []; |
|
| 72 | - $categories = $categoryHandler->getByPermission('access', ['cat_id', 'cat_title'], false); |
|
| 68 | + if ($sitemap_configs['show_subcategoris']) { |
|
| 69 | + /** @var Newbb\CategoryHandler $categoryHandler */ |
|
| 70 | + $categoryHandler = Newbb\Helper::getInstance()->getHandler('Category'); |
|
| 71 | + $categories = []; |
|
| 72 | + $categories = $categoryHandler->getByPermission('access', ['cat_id', 'cat_title'], false); |
|
| 73 | 73 | |
| 74 | - foreach ($categories as $key => $category) { |
|
| 75 | - $cat_id = $category['cat_id']; |
|
| 76 | - $i = $cat_id; |
|
| 77 | - $sitemap['parent'][$i]['id'] = $cat_id; |
|
| 78 | - $sitemap['parent'][$i]['title'] = $category['cat_title']; |
|
| 79 | - $sitemap['parent'][$i]['url'] = XOOPS_URL . '/modules/newbb/index.php?cat=' . $cat_id; |
|
| 80 | - } |
|
| 81 | - foreach ($forums as $id => $forum) { |
|
| 82 | - $cid = $forum['cid']; |
|
| 83 | - $sitemap['parent'][$cid]['child'][$id] = $forum; |
|
| 84 | - $sitemap['parent'][$cid]['child'][$id]['image'] = 2; |
|
| 85 | - if (empty($forum['fchild'])) { |
|
| 86 | - continue; |
|
| 87 | - } |
|
| 74 | + foreach ($categories as $key => $category) { |
|
| 75 | + $cat_id = $category['cat_id']; |
|
| 76 | + $i = $cat_id; |
|
| 77 | + $sitemap['parent'][$i]['id'] = $cat_id; |
|
| 78 | + $sitemap['parent'][$i]['title'] = $category['cat_title']; |
|
| 79 | + $sitemap['parent'][$i]['url'] = XOOPS_URL . '/modules/newbb/index.php?cat=' . $cat_id; |
|
| 80 | + } |
|
| 81 | + foreach ($forums as $id => $forum) { |
|
| 82 | + $cid = $forum['cid']; |
|
| 83 | + $sitemap['parent'][$cid]['child'][$id] = $forum; |
|
| 84 | + $sitemap['parent'][$cid]['child'][$id]['image'] = 2; |
|
| 85 | + if (empty($forum['fchild'])) { |
|
| 86 | + continue; |
|
| 87 | + } |
|
| 88 | 88 | |
| 89 | - foreach ($forum['fchild'] as $_id => $_forum) { |
|
| 90 | - $sitemap['parent'][$cid]['child'][$_id] = $_forum; |
|
| 91 | - $sitemap['parent'][$cid]['child'][$_id]['image'] = 3; |
|
| 92 | - } |
|
| 93 | - } |
|
| 94 | - } else { |
|
| 95 | - foreach ($forums as $id => $forum) { |
|
| 96 | - $sitemap['parent'][$id] = $forum; |
|
| 97 | - } |
|
| 98 | - } |
|
| 89 | + foreach ($forum['fchild'] as $_id => $_forum) { |
|
| 90 | + $sitemap['parent'][$cid]['child'][$_id] = $_forum; |
|
| 91 | + $sitemap['parent'][$cid]['child'][$_id]['image'] = 3; |
|
| 92 | + } |
|
| 93 | + } |
|
| 94 | + } else { |
|
| 95 | + foreach ($forums as $id => $forum) { |
|
| 96 | + $sitemap['parent'][$id] = $forum; |
|
| 97 | + } |
|
| 98 | + } |
|
| 99 | 99 | |
| 100 | - return $sitemap; |
|
| 100 | + return $sitemap; |
|
| 101 | 101 | } |
@@ -15,36 +15,36 @@ |
||
| 15 | 15 | define('NEWBB_FUNCTIONS_RPC_LOADED', true); |
| 16 | 16 | |
| 17 | 17 | if (!defined('NEWBB_FUNCTIONS_RPC')) { |
| 18 | - define('NEWBB_FUNCTIONS_RPC', 1); |
|
| 18 | + define('NEWBB_FUNCTIONS_RPC', 1); |
|
| 19 | 19 | |
| 20 | - /** |
|
| 21 | - * Function to respond to a trackback |
|
| 22 | - * @param int $error |
|
| 23 | - * @param string $error_message |
|
| 24 | - */ |
|
| 25 | - function newbbTrackbackResponse($error = 0, $error_message = '') |
|
| 26 | - { |
|
| 27 | - $moduleConfig = newbbLoadConfig(); |
|
| 20 | + /** |
|
| 21 | + * Function to respond to a trackback |
|
| 22 | + * @param int $error |
|
| 23 | + * @param string $error_message |
|
| 24 | + */ |
|
| 25 | + function newbbTrackbackResponse($error = 0, $error_message = '') |
|
| 26 | + { |
|
| 27 | + $moduleConfig = newbbLoadConfig(); |
|
| 28 | 28 | |
| 29 | - if (!empty($moduleConfig['rss_utf8'])) { |
|
| 30 | - $charset = 'utf-8'; |
|
| 31 | - $error_message = xoops_utf8_encode($error_message); |
|
| 32 | - } else { |
|
| 33 | - $charset = _CHARSET; |
|
| 34 | - } |
|
| 35 | - header('Content-Type: text/xml; charset="' . $charset . '"'); |
|
| 36 | - if ($error) { |
|
| 37 | - echo '<?xml version="1.0" encoding="' . $charset . '"?' . ">\n"; |
|
| 38 | - echo '<response>\n'; |
|
| 39 | - echo '<error>1</error>\n'; |
|
| 40 | - echo '<message>$error_message</message>\n'; |
|
| 41 | - echo '</response>'; |
|
| 42 | - exit(); |
|
| 43 | - } else { |
|
| 44 | - echo '<?xml version="1.0" encoding="' . $charset . '"?' . ">\n"; |
|
| 45 | - echo '<response>\n'; |
|
| 46 | - echo '<error>0</error>\n'; |
|
| 47 | - echo '</response>'; |
|
| 48 | - } |
|
| 49 | - } |
|
| 29 | + if (!empty($moduleConfig['rss_utf8'])) { |
|
| 30 | + $charset = 'utf-8'; |
|
| 31 | + $error_message = xoops_utf8_encode($error_message); |
|
| 32 | + } else { |
|
| 33 | + $charset = _CHARSET; |
|
| 34 | + } |
|
| 35 | + header('Content-Type: text/xml; charset="' . $charset . '"'); |
|
| 36 | + if ($error) { |
|
| 37 | + echo '<?xml version="1.0" encoding="' . $charset . '"?' . ">\n"; |
|
| 38 | + echo '<response>\n'; |
|
| 39 | + echo '<error>1</error>\n'; |
|
| 40 | + echo '<message>$error_message</message>\n'; |
|
| 41 | + echo '</response>'; |
|
| 42 | + exit(); |
|
| 43 | + } else { |
|
| 44 | + echo '<?xml version="1.0" encoding="' . $charset . '"?' . ">\n"; |
|
| 45 | + echo '<response>\n'; |
|
| 46 | + echo '<error>0</error>\n'; |
|
| 47 | + echo '</response>'; |
|
| 48 | + } |
|
| 49 | + } |
|
| 50 | 50 | } |
@@ -47,5 +47,5 @@ |
||
| 47 | 47 | |
| 48 | 48 | // include customized variables |
| 49 | 49 | if (is_object($GLOBALS['xoopsModule']) && 'newbb' === $GLOBALS['xoopsModule']->getVar('dirname', 'n')) { |
| 50 | - $GLOBALS['xoopsModuleConfig'] = newbbLoadConfig(); |
|
| 50 | + $GLOBALS['xoopsModuleConfig'] = newbbLoadConfig(); |
|
| 51 | 51 | } |
@@ -14,8 +14,8 @@ discard block |
||
| 14 | 14 | global $xoopsModule, $myts, $xoopsUser, $forumObject; |
| 15 | 15 | |
| 16 | 16 | if (!defined('XOOPS_ROOT_PATH') || !is_object($forumObject) || !is_object($GLOBALS['xoopsUser']) |
| 17 | - || !is_object($xoopsModule)) { |
|
| 18 | - return; |
|
| 17 | + || !is_object($xoopsModule)) { |
|
| 18 | + return; |
|
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | $forum_id = $forumObject->getVar('forum_id'); |
@@ -41,67 +41,67 @@ discard block |
||
| 41 | 41 | /** @var \XoopsModuleHandler $moduleHandler */ |
| 42 | 42 | $moduleHandler = xoops_getHandler('module'); |
| 43 | 43 | if ($mod = @$moduleHandler->getByDirname('profile', true)) { |
| 44 | - $grouppermHandler = xoops_getHandler('groupperm'); |
|
| 45 | - $groups = [XOOPS_GROUP_ANONYMOUS, XOOPS_GROUP_USERS]; |
|
| 44 | + $grouppermHandler = xoops_getHandler('groupperm'); |
|
| 45 | + $groups = [XOOPS_GROUP_ANONYMOUS, XOOPS_GROUP_USERS]; |
|
| 46 | 46 | |
| 47 | - if (!defined('_PROFILE_MA_ALLABOUT')) { |
|
| 48 | - $mod->loadLanguage(); |
|
| 49 | - } |
|
| 50 | - /** var Newbb\PermissionHandler $permHandler */ |
|
| 51 | - $permHandler = Newbb\Helper::getInstance()->getHandler('Permission'); |
|
| 52 | - $show_ids = $permHandler->getItemIds('profile_show', $groups, $mod->getVar('mid')); |
|
| 53 | - $visible_ids = $permHandler->getItemIds('profile_visible', $groups, $mod->getVar('mid')); |
|
| 54 | - unset($mod); |
|
| 55 | - $fieldids = array_intersect($show_ids, $visible_ids); |
|
| 56 | - /** @var \ProfileProfileHandler $profileHandler */ |
|
| 57 | - $profileHandler = xoops_getModuleHandler('profile', 'profile'); |
|
| 58 | - $fields = $profileHandler->loadFields(); |
|
| 59 | - /** @var \ProfileCategoryHandler $catHandler */ |
|
| 60 | - $catHandler = xoops_getModuleHandler('category', 'profile'); |
|
| 61 | - $categories = $catHandler->getObjects(null, true, false); |
|
| 62 | - /** @var \ProfileFieldHandler $fieldcatHandler */ |
|
| 63 | - $fieldcatHandler = xoops_getModuleHandler('category', 'profile'); |
|
| 64 | - $fieldcats = $fieldcatHandler->getObjects(null, true, false); |
|
| 47 | + if (!defined('_PROFILE_MA_ALLABOUT')) { |
|
| 48 | + $mod->loadLanguage(); |
|
| 49 | + } |
|
| 50 | + /** var Newbb\PermissionHandler $permHandler */ |
|
| 51 | + $permHandler = Newbb\Helper::getInstance()->getHandler('Permission'); |
|
| 52 | + $show_ids = $permHandler->getItemIds('profile_show', $groups, $mod->getVar('mid')); |
|
| 53 | + $visible_ids = $permHandler->getItemIds('profile_visible', $groups, $mod->getVar('mid')); |
|
| 54 | + unset($mod); |
|
| 55 | + $fieldids = array_intersect($show_ids, $visible_ids); |
|
| 56 | + /** @var \ProfileProfileHandler $profileHandler */ |
|
| 57 | + $profileHandler = xoops_getModuleHandler('profile', 'profile'); |
|
| 58 | + $fields = $profileHandler->loadFields(); |
|
| 59 | + /** @var \ProfileCategoryHandler $catHandler */ |
|
| 60 | + $catHandler = xoops_getModuleHandler('category', 'profile'); |
|
| 61 | + $categories = $catHandler->getObjects(null, true, false); |
|
| 62 | + /** @var \ProfileFieldHandler $fieldcatHandler */ |
|
| 63 | + $fieldcatHandler = xoops_getModuleHandler('category', 'profile'); |
|
| 64 | + $fieldcats = $fieldcatHandler->getObjects(null, true, false); |
|
| 65 | 65 | |
| 66 | - // Add core fields |
|
| 67 | - $categories[0]['cat_title'] = sprintf(_MD_NEWBB_AUTO_CREATE_ABOUT, $GLOBALS['xoopsUser']->getVar('uname')); |
|
| 68 | - $avatar = trim($GLOBALS['xoopsUser']->getVar('user_avatar')); |
|
| 69 | - if (!empty($avatar) && 'blank.gif' !== $avatar) { |
|
| 70 | - $categories[0]['fields'][] = [ |
|
| 71 | - 'title' => _MD_NEWBB_AUTO_CREATE_AVATARS, |
|
| 72 | - 'value' => "<img src='" . XOOPS_UPLOAD_URL . '/' . $GLOBALS['xoopsUser']->getVar('user_avatar') . "' alt='" . $GLOBALS['xoopsUser']->getVar('uname') . "' />" |
|
| 73 | - ]; |
|
| 74 | - $weights[0][] = 0; |
|
| 75 | - } |
|
| 76 | - if (1 == $GLOBALS['xoopsUser']->getVar('user_viewemail')) { |
|
| 77 | - $email = $GLOBALS['xoopsUser']->getVar('email', 'E'); |
|
| 78 | - $categories[0]['fields'][] = ['title' => _MD_NEWBB_AUTO_CREATE_EMAIL, 'value' => $email]; |
|
| 79 | - $weights[0][] = 0; |
|
| 80 | - } |
|
| 66 | + // Add core fields |
|
| 67 | + $categories[0]['cat_title'] = sprintf(_MD_NEWBB_AUTO_CREATE_ABOUT, $GLOBALS['xoopsUser']->getVar('uname')); |
|
| 68 | + $avatar = trim($GLOBALS['xoopsUser']->getVar('user_avatar')); |
|
| 69 | + if (!empty($avatar) && 'blank.gif' !== $avatar) { |
|
| 70 | + $categories[0]['fields'][] = [ |
|
| 71 | + 'title' => _MD_NEWBB_AUTO_CREATE_AVATARS, |
|
| 72 | + 'value' => "<img src='" . XOOPS_UPLOAD_URL . '/' . $GLOBALS['xoopsUser']->getVar('user_avatar') . "' alt='" . $GLOBALS['xoopsUser']->getVar('uname') . "' />" |
|
| 73 | + ]; |
|
| 74 | + $weights[0][] = 0; |
|
| 75 | + } |
|
| 76 | + if (1 == $GLOBALS['xoopsUser']->getVar('user_viewemail')) { |
|
| 77 | + $email = $GLOBALS['xoopsUser']->getVar('email', 'E'); |
|
| 78 | + $categories[0]['fields'][] = ['title' => _MD_NEWBB_AUTO_CREATE_EMAIL, 'value' => $email]; |
|
| 79 | + $weights[0][] = 0; |
|
| 80 | + } |
|
| 81 | 81 | |
| 82 | - // Add dynamic fields |
|
| 83 | - foreach (array_keys($fields) as $i) { |
|
| 84 | - if (in_array($fields[$i]->getVar('fieldid'), $fieldids)) { |
|
| 85 | - $catid = isset($fieldcats[$fields[$i]->getVar('fieldid')]) ? $fieldcats[$fields[$i]->getVar('fieldid')]['catid'] : 0; |
|
| 86 | - $value = $fields[$i]->getOutputValue($GLOBALS['xoopsUser']); |
|
| 87 | - if (is_array($value)) { |
|
| 88 | - $value = implode('<br>', array_values($value)); |
|
| 89 | - } |
|
| 82 | + // Add dynamic fields |
|
| 83 | + foreach (array_keys($fields) as $i) { |
|
| 84 | + if (in_array($fields[$i]->getVar('fieldid'), $fieldids)) { |
|
| 85 | + $catid = isset($fieldcats[$fields[$i]->getVar('fieldid')]) ? $fieldcats[$fields[$i]->getVar('fieldid')]['catid'] : 0; |
|
| 86 | + $value = $fields[$i]->getOutputValue($GLOBALS['xoopsUser']); |
|
| 87 | + if (is_array($value)) { |
|
| 88 | + $value = implode('<br>', array_values($value)); |
|
| 89 | + } |
|
| 90 | 90 | |
| 91 | - if (empty($value)) { |
|
| 92 | - continue; |
|
| 93 | - } |
|
| 94 | - $categories[$catid]['fields'][] = ['title' => $fields[$i]->getVar('field_title'), 'value' => $value]; |
|
| 95 | - $weights[$catid][] = isset($fieldcats[$fields[$i]->getVar('fieldid')]) ? (int)$fieldcats[$fields[$i]->getVar('fieldid')]['field_weight'] : 1; |
|
| 96 | - } |
|
| 97 | - } |
|
| 91 | + if (empty($value)) { |
|
| 92 | + continue; |
|
| 93 | + } |
|
| 94 | + $categories[$catid]['fields'][] = ['title' => $fields[$i]->getVar('field_title'), 'value' => $value]; |
|
| 95 | + $weights[$catid][] = isset($fieldcats[$fields[$i]->getVar('fieldid')]) ? (int)$fieldcats[$fields[$i]->getVar('fieldid')]['field_weight'] : 1; |
|
| 96 | + } |
|
| 97 | + } |
|
| 98 | 98 | |
| 99 | - foreach (array_keys($categories) as $i) { |
|
| 100 | - if (isset($categories[$i]['fields'])) { |
|
| 101 | - array_multisort($weights[$i], SORT_ASC, array_keys($categories[$i]['fields']), SORT_ASC, $categories[$i]['fields']); |
|
| 102 | - } |
|
| 103 | - } |
|
| 104 | - ksort($categories); |
|
| 99 | + foreach (array_keys($categories) as $i) { |
|
| 100 | + if (isset($categories[$i]['fields'])) { |
|
| 101 | + array_multisort($weights[$i], SORT_ASC, array_keys($categories[$i]['fields']), SORT_ASC, $categories[$i]['fields']); |
|
| 102 | + } |
|
| 103 | + } |
|
| 104 | + ksort($categories); |
|
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | $message = sprintf(_MD_NEWBB_WELCOME_MESSAGE, $GLOBALS['xoopsUser']->getVar('uname')) . "\n\n"; |
@@ -123,20 +123,20 @@ discard block |
||
| 123 | 123 | $post_id = $postHandler->insert($postObject); |
| 124 | 124 | |
| 125 | 125 | if (!empty($GLOBALS['xoopsModuleConfig']['notification_enabled'])) { |
| 126 | - $tags = []; |
|
| 127 | - $tags['THREAD_NAME'] = $subject; |
|
| 128 | - $tags['THREAD_URL'] = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/viewtopic.php?post_id=' . $post_id . '&topic_id=' . $postObject->getVar('topic_id') . '&forum=' . $forum_id; |
|
| 129 | - $tags['POST_URL'] = $tags['THREAD_URL'] . '#forumpost' . $post_id; |
|
| 130 | - require_once __DIR__ . '/notification.inc.php'; |
|
| 131 | - $forum_info = newbb_notify_iteminfo('forum', $forum_id); |
|
| 132 | - $tags['FORUM_NAME'] = $forum_info['name']; |
|
| 133 | - $tags['FORUM_URL'] = $forum_info['url']; |
|
| 134 | - /** @var \XoopsNotificationHandler $notificationHandler */ |
|
| 135 | - $notificationHandler = xoops_getHandler('notification'); |
|
| 136 | - $notificationHandler->triggerEvent('forum', $forum_id, 'new_thread', $tags); |
|
| 137 | - $notificationHandler->triggerEvent('global', 0, 'new_post', $tags); |
|
| 138 | - $notificationHandler->triggerEvent('forum', $forum_id, 'new_post', $tags); |
|
| 139 | - $tags['POST_CONTENT'] = $message; |
|
| 140 | - $tags['POST_NAME'] = $subject; |
|
| 141 | - $notificationHandler->triggerEvent('global', 0, 'new_fullpost', $tags); |
|
| 126 | + $tags = []; |
|
| 127 | + $tags['THREAD_NAME'] = $subject; |
|
| 128 | + $tags['THREAD_URL'] = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/viewtopic.php?post_id=' . $post_id . '&topic_id=' . $postObject->getVar('topic_id') . '&forum=' . $forum_id; |
|
| 129 | + $tags['POST_URL'] = $tags['THREAD_URL'] . '#forumpost' . $post_id; |
|
| 130 | + require_once __DIR__ . '/notification.inc.php'; |
|
| 131 | + $forum_info = newbb_notify_iteminfo('forum', $forum_id); |
|
| 132 | + $tags['FORUM_NAME'] = $forum_info['name']; |
|
| 133 | + $tags['FORUM_URL'] = $forum_info['url']; |
|
| 134 | + /** @var \XoopsNotificationHandler $notificationHandler */ |
|
| 135 | + $notificationHandler = xoops_getHandler('notification'); |
|
| 136 | + $notificationHandler->triggerEvent('forum', $forum_id, 'new_thread', $tags); |
|
| 137 | + $notificationHandler->triggerEvent('global', 0, 'new_post', $tags); |
|
| 138 | + $notificationHandler->triggerEvent('forum', $forum_id, 'new_post', $tags); |
|
| 139 | + $tags['POST_CONTENT'] = $message; |
|
| 140 | + $tags['POST_NAME'] = $subject; |
|
| 141 | + $notificationHandler->triggerEvent('global', 0, 'new_fullpost', $tags); |
|
| 142 | 142 | } |
@@ -20,8 +20,8 @@ discard block |
||
| 20 | 20 | use XoopsModules\Newbb; |
| 21 | 21 | |
| 22 | 22 | if ((!defined('XOOPS_ROOT_PATH')) || !($GLOBALS['xoopsUser'] instanceof \XoopsUser) |
| 23 | - || !$GLOBALS['xoopsUser']->IsAdmin()) { |
|
| 24 | - exit('Restricted access' . PHP_EOL); |
|
| 23 | + || !$GLOBALS['xoopsUser']->IsAdmin()) { |
|
| 24 | + exit('Restricted access' . PHP_EOL); |
|
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | /** |
@@ -31,9 +31,9 @@ discard block |
||
| 31 | 31 | */ |
| 32 | 32 | function tableExists($tablename) |
| 33 | 33 | { |
| 34 | - $result = $GLOBALS['xoopsDB']->queryF("SHOW TABLES LIKE '$tablename'"); |
|
| 34 | + $result = $GLOBALS['xoopsDB']->queryF("SHOW TABLES LIKE '$tablename'"); |
|
| 35 | 35 | |
| 36 | - return $GLOBALS['xoopsDB']->getRowsNum($result) > 0; |
|
| 36 | + return $GLOBALS['xoopsDB']->getRowsNum($result) > 0; |
|
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | /** |
@@ -45,15 +45,15 @@ discard block |
||
| 45 | 45 | */ |
| 46 | 46 | function xoops_module_pre_update_newbb(\XoopsModule $module) |
| 47 | 47 | { |
| 48 | - $moduleDirName = basename(dirname(__DIR__)); |
|
| 49 | - /** @var Newbb\Helper $helper */ |
|
| 50 | - /** @var Newbb\Utility $utility */ |
|
| 51 | - $helper = Newbb\Helper::getInstance(); |
|
| 52 | - $utility = new Newbb\Utility(); |
|
| 53 | - |
|
| 54 | - $xoopsSuccess = $utility::checkVerXoops($module); |
|
| 55 | - $phpSuccess = $utility::checkVerPhp($module); |
|
| 56 | - return $xoopsSuccess && $phpSuccess; |
|
| 48 | + $moduleDirName = basename(dirname(__DIR__)); |
|
| 49 | + /** @var Newbb\Helper $helper */ |
|
| 50 | + /** @var Newbb\Utility $utility */ |
|
| 51 | + $helper = Newbb\Helper::getInstance(); |
|
| 52 | + $utility = new Newbb\Utility(); |
|
| 53 | + |
|
| 54 | + $xoopsSuccess = $utility::checkVerXoops($module); |
|
| 55 | + $phpSuccess = $utility::checkVerPhp($module); |
|
| 56 | + return $xoopsSuccess && $phpSuccess; |
|
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | /** |
@@ -67,83 +67,83 @@ discard block |
||
| 67 | 67 | |
| 68 | 68 | function xoops_module_update_newbb(\XoopsModule $module, $previousVersion = null) |
| 69 | 69 | { |
| 70 | - $moduleDirName = basename(dirname(__DIR__)); |
|
| 71 | - $capsDirName = strtoupper($moduleDirName); |
|
| 72 | - |
|
| 73 | - /** @var Newbb\Helper $helper */ |
|
| 74 | - /** @var Newbb\Utility $utility */ |
|
| 75 | - /** @var Newbb\Common\Configurator $configurator */ |
|
| 76 | - $helper = Newbb\Helper::getInstance(); |
|
| 77 | - $utility = new Newbb\Utility(); |
|
| 78 | - $configurator = new Newbb\Common\Configurator(); |
|
| 79 | - |
|
| 80 | - if ($previousVersion < 510) { |
|
| 81 | - |
|
| 82 | - //delete old HTML templates |
|
| 83 | - if (count($configurator->templateFolders) > 0) { |
|
| 84 | - foreach ($configurator->templateFolders as $folder) { |
|
| 85 | - $templateFolder = $GLOBALS['xoops']->path('modules/' . $moduleDirName . $folder); |
|
| 86 | - if (is_dir($templateFolder)) { |
|
| 87 | - $templateList = array_diff(scandir($templateFolder, SCANDIR_SORT_NONE), ['..', '.']); |
|
| 88 | - foreach ($templateList as $k => $v) { |
|
| 89 | - $fileInfo = new \SplFileInfo($templateFolder . $v); |
|
| 90 | - if ('html' === $fileInfo->getExtension() && 'index.html' !== $fileInfo->getFilename()) { |
|
| 91 | - if (file_exists($templateFolder . $v)) { |
|
| 92 | - unlink($templateFolder . $v); |
|
| 93 | - } |
|
| 94 | - } |
|
| 95 | - } |
|
| 96 | - } |
|
| 97 | - } |
|
| 98 | - } |
|
| 99 | - |
|
| 100 | - // --- DELETE OLD FILES --------------- |
|
| 101 | - if (count($configurator->oldFiles) > 0) { |
|
| 102 | - // foreach (array_keys($GLOBALS['uploadFolders']) as $i) { |
|
| 103 | - foreach (array_keys($configurator->oldFiles) as $i) { |
|
| 104 | - $tempFile = $GLOBALS['xoops']->path('modules/' . $moduleDirName . $configurator->oldFiles[$i]); |
|
| 105 | - if (is_file($tempFile)) { |
|
| 106 | - unlink($tempFile); |
|
| 107 | - } |
|
| 108 | - } |
|
| 109 | - } |
|
| 110 | - |
|
| 111 | - // --- DELETE OLD FOLDERS --------------- |
|
| 112 | - xoops_load('XoopsFile'); |
|
| 113 | - if (count($configurator->oldFolders) > 0) { |
|
| 114 | - // foreach (array_keys($GLOBALS['uploadFolders']) as $i) { |
|
| 115 | - foreach (array_keys($configurator->oldFolders) as $i) { |
|
| 116 | - $tempFolder = $GLOBALS['xoops']->path('modules/' . $moduleDirName . $configurator->oldFolders[$i]); |
|
| 117 | - /* @var $folderHandler XoopsObjectHandler */ |
|
| 118 | - $folderHandler = \XoopsFile::getHandler('folder', $tempFolder); |
|
| 119 | - $folderHandler->delete($tempFolder); |
|
| 120 | - } |
|
| 121 | - } |
|
| 122 | - |
|
| 123 | - // --- CREATE FOLDERS --------------- |
|
| 124 | - if (count($configurator->uploadFolders) > 0) { |
|
| 125 | - // foreach (array_keys($GLOBALS['uploadFolders']) as $i) { |
|
| 126 | - foreach (array_keys($configurator->uploadFolders) as $i) { |
|
| 127 | - $utility::createFolder($configurator->uploadFolders[$i]); |
|
| 128 | - } |
|
| 129 | - } |
|
| 130 | - |
|
| 131 | - // --- COPY blank.png FILES --------------- |
|
| 132 | - if (count($configurator->copyBlankFiles) > 0) { |
|
| 133 | - $file = dirname(__DIR__) . '/assets/images/blank.png'; |
|
| 134 | - foreach (array_keys($configurator->copyBlankFiles) as $i) { |
|
| 135 | - $dest = $configurator->copyBlankFiles[$i] . '/blank.png'; |
|
| 136 | - $utility::copyFile($file, $dest); |
|
| 137 | - } |
|
| 138 | - } |
|
| 139 | - |
|
| 140 | - //delete .html entries from the tpl table |
|
| 141 | - $sql = 'DELETE FROM ' . $GLOBALS['xoopsDB']->prefix('tplfile') . " WHERE `tpl_module` = '" . $module->getVar('dirname', 'n') . '\' AND `tpl_file` LIKE \'%.html%\''; |
|
| 142 | - $GLOBALS['xoopsDB']->queryF($sql); |
|
| 143 | - |
|
| 144 | - /** @var XoopsGroupPermHandler $grouppermHandler */ |
|
| 145 | - $grouppermHandler = xoops_getHandler('groupperm'); |
|
| 146 | - return $grouppermHandler->deleteByModule($module->getVar('mid'), 'item_read'); |
|
| 147 | - } |
|
| 148 | - return true; |
|
| 70 | + $moduleDirName = basename(dirname(__DIR__)); |
|
| 71 | + $capsDirName = strtoupper($moduleDirName); |
|
| 72 | + |
|
| 73 | + /** @var Newbb\Helper $helper */ |
|
| 74 | + /** @var Newbb\Utility $utility */ |
|
| 75 | + /** @var Newbb\Common\Configurator $configurator */ |
|
| 76 | + $helper = Newbb\Helper::getInstance(); |
|
| 77 | + $utility = new Newbb\Utility(); |
|
| 78 | + $configurator = new Newbb\Common\Configurator(); |
|
| 79 | + |
|
| 80 | + if ($previousVersion < 510) { |
|
| 81 | + |
|
| 82 | + //delete old HTML templates |
|
| 83 | + if (count($configurator->templateFolders) > 0) { |
|
| 84 | + foreach ($configurator->templateFolders as $folder) { |
|
| 85 | + $templateFolder = $GLOBALS['xoops']->path('modules/' . $moduleDirName . $folder); |
|
| 86 | + if (is_dir($templateFolder)) { |
|
| 87 | + $templateList = array_diff(scandir($templateFolder, SCANDIR_SORT_NONE), ['..', '.']); |
|
| 88 | + foreach ($templateList as $k => $v) { |
|
| 89 | + $fileInfo = new \SplFileInfo($templateFolder . $v); |
|
| 90 | + if ('html' === $fileInfo->getExtension() && 'index.html' !== $fileInfo->getFilename()) { |
|
| 91 | + if (file_exists($templateFolder . $v)) { |
|
| 92 | + unlink($templateFolder . $v); |
|
| 93 | + } |
|
| 94 | + } |
|
| 95 | + } |
|
| 96 | + } |
|
| 97 | + } |
|
| 98 | + } |
|
| 99 | + |
|
| 100 | + // --- DELETE OLD FILES --------------- |
|
| 101 | + if (count($configurator->oldFiles) > 0) { |
|
| 102 | + // foreach (array_keys($GLOBALS['uploadFolders']) as $i) { |
|
| 103 | + foreach (array_keys($configurator->oldFiles) as $i) { |
|
| 104 | + $tempFile = $GLOBALS['xoops']->path('modules/' . $moduleDirName . $configurator->oldFiles[$i]); |
|
| 105 | + if (is_file($tempFile)) { |
|
| 106 | + unlink($tempFile); |
|
| 107 | + } |
|
| 108 | + } |
|
| 109 | + } |
|
| 110 | + |
|
| 111 | + // --- DELETE OLD FOLDERS --------------- |
|
| 112 | + xoops_load('XoopsFile'); |
|
| 113 | + if (count($configurator->oldFolders) > 0) { |
|
| 114 | + // foreach (array_keys($GLOBALS['uploadFolders']) as $i) { |
|
| 115 | + foreach (array_keys($configurator->oldFolders) as $i) { |
|
| 116 | + $tempFolder = $GLOBALS['xoops']->path('modules/' . $moduleDirName . $configurator->oldFolders[$i]); |
|
| 117 | + /* @var $folderHandler XoopsObjectHandler */ |
|
| 118 | + $folderHandler = \XoopsFile::getHandler('folder', $tempFolder); |
|
| 119 | + $folderHandler->delete($tempFolder); |
|
| 120 | + } |
|
| 121 | + } |
|
| 122 | + |
|
| 123 | + // --- CREATE FOLDERS --------------- |
|
| 124 | + if (count($configurator->uploadFolders) > 0) { |
|
| 125 | + // foreach (array_keys($GLOBALS['uploadFolders']) as $i) { |
|
| 126 | + foreach (array_keys($configurator->uploadFolders) as $i) { |
|
| 127 | + $utility::createFolder($configurator->uploadFolders[$i]); |
|
| 128 | + } |
|
| 129 | + } |
|
| 130 | + |
|
| 131 | + // --- COPY blank.png FILES --------------- |
|
| 132 | + if (count($configurator->copyBlankFiles) > 0) { |
|
| 133 | + $file = dirname(__DIR__) . '/assets/images/blank.png'; |
|
| 134 | + foreach (array_keys($configurator->copyBlankFiles) as $i) { |
|
| 135 | + $dest = $configurator->copyBlankFiles[$i] . '/blank.png'; |
|
| 136 | + $utility::copyFile($file, $dest); |
|
| 137 | + } |
|
| 138 | + } |
|
| 139 | + |
|
| 140 | + //delete .html entries from the tpl table |
|
| 141 | + $sql = 'DELETE FROM ' . $GLOBALS['xoopsDB']->prefix('tplfile') . " WHERE `tpl_module` = '" . $module->getVar('dirname', 'n') . '\' AND `tpl_file` LIKE \'%.html%\''; |
|
| 142 | + $GLOBALS['xoopsDB']->queryF($sql); |
|
| 143 | + |
|
| 144 | + /** @var XoopsGroupPermHandler $grouppermHandler */ |
|
| 145 | + $grouppermHandler = xoops_getHandler('groupperm'); |
|
| 146 | + return $grouppermHandler->deleteByModule($module->getVar('mid'), 'item_read'); |
|
| 147 | + } |
|
| 148 | + return true; |
|
| 149 | 149 | } |
@@ -23,8 +23,8 @@ discard block |
||
| 23 | 23 | $mode = Request::getInt('mode', 1, 'GET'); |
| 24 | 24 | |
| 25 | 25 | if (0 === count($post_id) || 0 === count($op)) { |
| 26 | - // irmtfan - issue with javascript:history.go(-1) |
|
| 27 | - redirect_header(Request::getString('HTTP_REFERER', '', 'SERVER'), 2, _MD_NEWBB_NO_SELECTION); |
|
| 26 | + // irmtfan - issue with javascript:history.go(-1) |
|
| 27 | + redirect_header(Request::getString('HTTP_REFERER', '', 'SERVER'), 2, _MD_NEWBB_NO_SELECTION); |
|
| 28 | 28 | } |
| 29 | 29 | ///** @var PostHandler $postHandler */ |
| 30 | 30 | //$postHandler = Newbb\Helper::getInstance()->getHandler('Post'); |
@@ -33,199 +33,199 @@ discard block |
||
| 33 | 33 | ///** @var NewbbForumHandler $forumHandler */ |
| 34 | 34 | //$forumHandler = Newbb\Helper::getInstance()->getHandler('Forum'); |
| 35 | 35 | if (empty($topic_id)) { |
| 36 | - $forumObject = null; |
|
| 36 | + $forumObject = null; |
|
| 37 | 37 | } else { |
| 38 | - $topicObject = $topicHandler->get($topic_id); |
|
| 39 | - $forum_id = $topicObject->getVar('forum_id'); |
|
| 40 | - $forumObject = $forumHandler->get($forum_id); |
|
| 38 | + $topicObject = $topicHandler->get($topic_id); |
|
| 39 | + $forum_id = $topicObject->getVar('forum_id'); |
|
| 40 | + $forumObject = $forumHandler->get($forum_id); |
|
| 41 | 41 | } |
| 42 | 42 | $isAdmin = newbbIsAdmin($forumObject); |
| 43 | 43 | |
| 44 | 44 | if (!$isAdmin) { |
| 45 | - redirect_header(XOOPS_URL . '/index.php', 2, _MD_NEWBB_NORIGHTTOACCESS); |
|
| 45 | + redirect_header(XOOPS_URL . '/index.php', 2, _MD_NEWBB_NORIGHTTOACCESS); |
|
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | switch ($op) { |
| 49 | - case 'restore': |
|
| 50 | - $post_id = array_values($post_id); |
|
| 51 | - sort($post_id); |
|
| 52 | - $topics = []; |
|
| 53 | - $forums = []; |
|
| 54 | - foreach ($post_id as $post) { |
|
| 55 | - $postObject = $postHandler->get($post); |
|
| 56 | - if ($postObject->getVar('topic_id') < 1) { |
|
| 57 | - continue; |
|
| 58 | - } |
|
| 59 | - |
|
| 60 | - $postHandler->approve($postObject, true); |
|
| 61 | - $topics[$postObject->getVar('topic_id')] = 1; |
|
| 62 | - $forums[$postObject->getVar('forum_id')] = 1; |
|
| 63 | - unset($postObject); |
|
| 64 | - } |
|
| 65 | - foreach (array_keys($topics) as $topic) { |
|
| 66 | - $topicHandler->synchronization($topic); |
|
| 67 | - } |
|
| 68 | - foreach (array_keys($forums) as $forum) { |
|
| 69 | - $forumHandler->synchronization($forum); |
|
| 70 | - } |
|
| 71 | - break; |
|
| 72 | - case 'approve': |
|
| 73 | - $post_id = array_values($post_id); |
|
| 74 | - sort($post_id); |
|
| 75 | - $topics = []; |
|
| 76 | - $forums = []; |
|
| 77 | - $criteria = new \Criteria('post_id', '(' . implode(',', $post_id) . ')', 'IN'); |
|
| 78 | - $postsObject = $postHandler->getObjects($criteria, true); |
|
| 79 | - foreach ($post_id as $post) { |
|
| 80 | - /** @var Newbb\Post $postObject */ |
|
| 81 | - $postObject = $postsObject[$post]; |
|
| 82 | - if (!empty($topic_id) && $topic_id !== $postObject->getVar('topic_id')) { |
|
| 83 | - continue; |
|
| 84 | - } |
|
| 85 | - $postHandler->approve($postObject); |
|
| 86 | - $topics[$postObject->getVar('topic_id')] = $post; |
|
| 87 | - $forums[$postObject->getVar('forum_id')] = 1; |
|
| 88 | - } |
|
| 89 | - foreach (array_keys($topics) as $topic) { |
|
| 90 | - $topicHandler->synchronization($topic); |
|
| 91 | - } |
|
| 92 | - foreach (array_keys($forums) as $forum) { |
|
| 93 | - $forumHandler->synchronization($forum); |
|
| 94 | - } |
|
| 95 | - |
|
| 96 | - if (empty($GLOBALS['xoopsModuleConfig']['notification_enabled'])) { |
|
| 97 | - break; |
|
| 98 | - } |
|
| 99 | - |
|
| 100 | - $criteria_topic = new \Criteria('topic_id', '(' . implode(',', array_keys($topics)) . ')', 'IN'); |
|
| 101 | - $topic_list = $topicHandler->getList($criteria_topic, true); |
|
| 102 | - |
|
| 103 | - $criteria_forum = new \Criteria('forum_id', '(' . implode(',', array_keys($forums)) . ')', 'IN'); |
|
| 104 | - $forum_list = $forumHandler->getList($criteria_forum); |
|
| 105 | - |
|
| 106 | - require_once __DIR__ . '/include/notification.inc.php'; |
|
| 107 | - /** @var \XoopsNotificationHandler $notificationHandler */ |
|
| 108 | - $notificationHandler = xoops_getHandler('notification'); |
|
| 109 | - foreach ($post_id as $post) { |
|
| 110 | - $tags = []; |
|
| 111 | - /** @var Newbb\Post[] $postsObject [$post] */ |
|
| 112 | - $tags['THREAD_NAME'] = $topic_list[$postsObject[$post]->getVar('topic_id')]; |
|
| 113 | - $tags['THREAD_URL'] = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/viewtopic.php?topic_id=' . $postsObject[$post]->getVar('topic_id') . '&forum=' . $postsObject[$post]->getVar('forum_id'); |
|
| 114 | - $tags['FORUM_NAME'] = $forum_list[$postsObject[$post]->getVar('forum_id')]; |
|
| 115 | - $tags['FORUM_URL'] = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/viewforum.php?forum=' . $postsObject[$post]->getVar('forum_id'); |
|
| 116 | - $tags['POST_URL'] = $tags['THREAD_URL'] . '#forumpost' . $post; |
|
| 117 | - $notificationHandler->triggerEvent('thread', $postsObject[$post]->getVar('topic_id'), 'new_post', $tags); |
|
| 118 | - $notificationHandler->triggerEvent('forum', $postsObject[$post]->getVar('forum_id'), 'new_post', $tags); |
|
| 119 | - $notificationHandler->triggerEvent('global', 0, 'new_post', $tags); |
|
| 120 | - $tags['POST_CONTENT'] = $postsObject[$post]->getVar('post_text'); |
|
| 121 | - $tags['POST_NAME'] = $postsObject[$post]->getVar('subject'); |
|
| 122 | - $notificationHandler->triggerEvent('global', 0, 'new_fullpost', $tags); |
|
| 123 | - $notificationHandler->triggerEvent('forum', $postsObject[$post]->getVar('forum_id'), 'new_fullpost', $tags); |
|
| 124 | - } |
|
| 125 | - break; |
|
| 126 | - case 'delete': |
|
| 127 | - $post_id = array_values($post_id); |
|
| 128 | - rsort($post_id); |
|
| 129 | - $topics = []; |
|
| 130 | - $forums = []; |
|
| 131 | - foreach ($post_id as $post) { |
|
| 132 | - $postObject = $postHandler->get($post); |
|
| 133 | - if (!empty($topic_id) && $topic_id !== $postObject->getVar('topic_id')) { |
|
| 134 | - continue; |
|
| 135 | - } |
|
| 136 | - $topics[$postObject->getVar('topic_id')] = 1; |
|
| 137 | - $forums[$postObject->getVar('forum_id')] = 1; |
|
| 138 | - $postHandler->delete($postObject, true); |
|
| 139 | - unset($postObject); |
|
| 140 | - } |
|
| 141 | - foreach (array_keys($topics) as $topic) { |
|
| 142 | - $topicHandler->synchronization($topic); |
|
| 143 | - } |
|
| 144 | - foreach (array_keys($forums) as $forum) { |
|
| 145 | - $forumHandler->synchronization($forum); |
|
| 146 | - } |
|
| 147 | - break; |
|
| 148 | - case 'split': |
|
| 149 | - /** @var Newbb\Post $postObject */ |
|
| 150 | - $postObject = $postHandler->get($post_id); |
|
| 151 | - if (0 === count($post_id) || $postObject->isTopic()) { |
|
| 152 | - break; |
|
| 153 | - } |
|
| 154 | - $topic_id = $postObject->getVar('topic_id'); |
|
| 155 | - |
|
| 156 | - $newtopic = $topicHandler->create(); |
|
| 157 | - $newtopic->setVar('topic_title', $postObject->getVar('subject'), true); |
|
| 158 | - $newtopic->setVar('topic_poster', $postObject->getVar('uid'), true); |
|
| 159 | - $newtopic->setVar('forum_id', $postObject->getVar('forum_id'), true); |
|
| 160 | - $newtopic->setVar('topic_time', $postObject->getVar('post_time'), true); |
|
| 161 | - $newtopic->setVar('poster_name', $postObject->getVar('poster_name'), true); |
|
| 162 | - $newtopic->setVar('approved', 1, true); |
|
| 163 | - $topicHandler->insert($newtopic, true); |
|
| 164 | - $new_topic_id = $newtopic->getVar('topic_id'); |
|
| 165 | - |
|
| 166 | - $pid = $postObject->getVar('pid'); |
|
| 167 | - |
|
| 168 | - $postObject->setVar('topic_id', $new_topic_id, true); |
|
| 169 | - $postObject->setVar('pid', 0, true); |
|
| 170 | - $postHandler->insert($postObject); |
|
| 171 | - |
|
| 172 | - /* split a single post */ |
|
| 173 | - if (1 === $mode) { |
|
| 174 | - $criteria = new \CriteriaCompo(new \Criteria('topic_id', $topic_id)); |
|
| 175 | - $criteria->add(new \Criteria('pid', $post_id)); |
|
| 176 | - $postHandler->updateAll('pid', $pid, $criteria, true); |
|
| 177 | - /* split a post and its children posts */ |
|
| 178 | - } elseif (2 === $mode) { |
|
| 179 | - require_once $GLOBALS['xoops']->path('class/xoopstree.php'); |
|
| 180 | - $mytree = new \XoopsTree($GLOBALS['xoopsDB']->prefix('newbb_posts'), 'post_id', 'pid'); |
|
| 181 | - $posts = $mytree->getAllChildId($post_id); |
|
| 182 | - if (count($posts) > 0) { |
|
| 183 | - $criteria = new \Criteria('post_id', '(' . implode(',', $posts) . ')', 'IN'); |
|
| 184 | - $postHandler->updateAll('topic_id', $new_topic_id, $criteria, true); |
|
| 185 | - } |
|
| 186 | - /* split a post and all posts coming after */ |
|
| 187 | - } elseif (3 === $mode) { |
|
| 188 | - $criteria = new \CriteriaCompo(new \Criteria('topic_id', $topic_id)); |
|
| 189 | - $criteria->add(new \Criteria('post_id', $post_id, '>')); |
|
| 190 | - $postHandler->updateAll('topic_id', $new_topic_id, $criteria, true); |
|
| 191 | - |
|
| 192 | - unset($criteria); |
|
| 193 | - $criteria = new \CriteriaCompo(new \Criteria('topic_id', $new_topic_id)); |
|
| 194 | - $criteria->add(new \Criteria('post_id', $post_id, '>')); |
|
| 195 | - $postHandler->identifierName = 'pid'; |
|
| 196 | - $posts = $postHandler->getList($criteria); |
|
| 197 | - |
|
| 198 | - unset($criteria); |
|
| 199 | - $post_update = []; |
|
| 200 | - foreach ($posts as $postid => $pid) { |
|
| 201 | - // if (!in_array($pid, array_keys($posts))) { |
|
| 202 | - if (!array_key_exists($pid, $posts)) { |
|
| 203 | - $post_update[] = $pid; |
|
| 204 | - } |
|
| 205 | - if (!array_key_exists($pid, $posts)) { |
|
| 206 | - $post_update2[] = $pid; |
|
| 207 | - } |
|
| 208 | - } |
|
| 209 | - if (count($post_update)) { |
|
| 210 | - $criteria = new \Criteria('post_id', '(' . implode(',', $post_update) . ')', 'IN'); |
|
| 211 | - $postHandler->updateAll('pid', $post_id, $criteria, true); |
|
| 212 | - } |
|
| 213 | - } |
|
| 214 | - |
|
| 215 | - $forum_id = $postObject->getVar('forum_id'); |
|
| 216 | - $topicHandler->synchronization($topic_id); |
|
| 217 | - $topicHandler->synchronization($new_topic_id); |
|
| 218 | - $sql = sprintf('UPDATE "%s" SET forum_topics = forum_topics+1 WHERE forum_id = "%u"', $GLOBALS['xoopsDB']->prefix('newbb_forums'), $forum_id); |
|
| 219 | - $result = $GLOBALS['xoopsDB']->queryF($sql); |
|
| 220 | - |
|
| 221 | - break; |
|
| 49 | + case 'restore': |
|
| 50 | + $post_id = array_values($post_id); |
|
| 51 | + sort($post_id); |
|
| 52 | + $topics = []; |
|
| 53 | + $forums = []; |
|
| 54 | + foreach ($post_id as $post) { |
|
| 55 | + $postObject = $postHandler->get($post); |
|
| 56 | + if ($postObject->getVar('topic_id') < 1) { |
|
| 57 | + continue; |
|
| 58 | + } |
|
| 59 | + |
|
| 60 | + $postHandler->approve($postObject, true); |
|
| 61 | + $topics[$postObject->getVar('topic_id')] = 1; |
|
| 62 | + $forums[$postObject->getVar('forum_id')] = 1; |
|
| 63 | + unset($postObject); |
|
| 64 | + } |
|
| 65 | + foreach (array_keys($topics) as $topic) { |
|
| 66 | + $topicHandler->synchronization($topic); |
|
| 67 | + } |
|
| 68 | + foreach (array_keys($forums) as $forum) { |
|
| 69 | + $forumHandler->synchronization($forum); |
|
| 70 | + } |
|
| 71 | + break; |
|
| 72 | + case 'approve': |
|
| 73 | + $post_id = array_values($post_id); |
|
| 74 | + sort($post_id); |
|
| 75 | + $topics = []; |
|
| 76 | + $forums = []; |
|
| 77 | + $criteria = new \Criteria('post_id', '(' . implode(',', $post_id) . ')', 'IN'); |
|
| 78 | + $postsObject = $postHandler->getObjects($criteria, true); |
|
| 79 | + foreach ($post_id as $post) { |
|
| 80 | + /** @var Newbb\Post $postObject */ |
|
| 81 | + $postObject = $postsObject[$post]; |
|
| 82 | + if (!empty($topic_id) && $topic_id !== $postObject->getVar('topic_id')) { |
|
| 83 | + continue; |
|
| 84 | + } |
|
| 85 | + $postHandler->approve($postObject); |
|
| 86 | + $topics[$postObject->getVar('topic_id')] = $post; |
|
| 87 | + $forums[$postObject->getVar('forum_id')] = 1; |
|
| 88 | + } |
|
| 89 | + foreach (array_keys($topics) as $topic) { |
|
| 90 | + $topicHandler->synchronization($topic); |
|
| 91 | + } |
|
| 92 | + foreach (array_keys($forums) as $forum) { |
|
| 93 | + $forumHandler->synchronization($forum); |
|
| 94 | + } |
|
| 95 | + |
|
| 96 | + if (empty($GLOBALS['xoopsModuleConfig']['notification_enabled'])) { |
|
| 97 | + break; |
|
| 98 | + } |
|
| 99 | + |
|
| 100 | + $criteria_topic = new \Criteria('topic_id', '(' . implode(',', array_keys($topics)) . ')', 'IN'); |
|
| 101 | + $topic_list = $topicHandler->getList($criteria_topic, true); |
|
| 102 | + |
|
| 103 | + $criteria_forum = new \Criteria('forum_id', '(' . implode(',', array_keys($forums)) . ')', 'IN'); |
|
| 104 | + $forum_list = $forumHandler->getList($criteria_forum); |
|
| 105 | + |
|
| 106 | + require_once __DIR__ . '/include/notification.inc.php'; |
|
| 107 | + /** @var \XoopsNotificationHandler $notificationHandler */ |
|
| 108 | + $notificationHandler = xoops_getHandler('notification'); |
|
| 109 | + foreach ($post_id as $post) { |
|
| 110 | + $tags = []; |
|
| 111 | + /** @var Newbb\Post[] $postsObject [$post] */ |
|
| 112 | + $tags['THREAD_NAME'] = $topic_list[$postsObject[$post]->getVar('topic_id')]; |
|
| 113 | + $tags['THREAD_URL'] = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/viewtopic.php?topic_id=' . $postsObject[$post]->getVar('topic_id') . '&forum=' . $postsObject[$post]->getVar('forum_id'); |
|
| 114 | + $tags['FORUM_NAME'] = $forum_list[$postsObject[$post]->getVar('forum_id')]; |
|
| 115 | + $tags['FORUM_URL'] = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/viewforum.php?forum=' . $postsObject[$post]->getVar('forum_id'); |
|
| 116 | + $tags['POST_URL'] = $tags['THREAD_URL'] . '#forumpost' . $post; |
|
| 117 | + $notificationHandler->triggerEvent('thread', $postsObject[$post]->getVar('topic_id'), 'new_post', $tags); |
|
| 118 | + $notificationHandler->triggerEvent('forum', $postsObject[$post]->getVar('forum_id'), 'new_post', $tags); |
|
| 119 | + $notificationHandler->triggerEvent('global', 0, 'new_post', $tags); |
|
| 120 | + $tags['POST_CONTENT'] = $postsObject[$post]->getVar('post_text'); |
|
| 121 | + $tags['POST_NAME'] = $postsObject[$post]->getVar('subject'); |
|
| 122 | + $notificationHandler->triggerEvent('global', 0, 'new_fullpost', $tags); |
|
| 123 | + $notificationHandler->triggerEvent('forum', $postsObject[$post]->getVar('forum_id'), 'new_fullpost', $tags); |
|
| 124 | + } |
|
| 125 | + break; |
|
| 126 | + case 'delete': |
|
| 127 | + $post_id = array_values($post_id); |
|
| 128 | + rsort($post_id); |
|
| 129 | + $topics = []; |
|
| 130 | + $forums = []; |
|
| 131 | + foreach ($post_id as $post) { |
|
| 132 | + $postObject = $postHandler->get($post); |
|
| 133 | + if (!empty($topic_id) && $topic_id !== $postObject->getVar('topic_id')) { |
|
| 134 | + continue; |
|
| 135 | + } |
|
| 136 | + $topics[$postObject->getVar('topic_id')] = 1; |
|
| 137 | + $forums[$postObject->getVar('forum_id')] = 1; |
|
| 138 | + $postHandler->delete($postObject, true); |
|
| 139 | + unset($postObject); |
|
| 140 | + } |
|
| 141 | + foreach (array_keys($topics) as $topic) { |
|
| 142 | + $topicHandler->synchronization($topic); |
|
| 143 | + } |
|
| 144 | + foreach (array_keys($forums) as $forum) { |
|
| 145 | + $forumHandler->synchronization($forum); |
|
| 146 | + } |
|
| 147 | + break; |
|
| 148 | + case 'split': |
|
| 149 | + /** @var Newbb\Post $postObject */ |
|
| 150 | + $postObject = $postHandler->get($post_id); |
|
| 151 | + if (0 === count($post_id) || $postObject->isTopic()) { |
|
| 152 | + break; |
|
| 153 | + } |
|
| 154 | + $topic_id = $postObject->getVar('topic_id'); |
|
| 155 | + |
|
| 156 | + $newtopic = $topicHandler->create(); |
|
| 157 | + $newtopic->setVar('topic_title', $postObject->getVar('subject'), true); |
|
| 158 | + $newtopic->setVar('topic_poster', $postObject->getVar('uid'), true); |
|
| 159 | + $newtopic->setVar('forum_id', $postObject->getVar('forum_id'), true); |
|
| 160 | + $newtopic->setVar('topic_time', $postObject->getVar('post_time'), true); |
|
| 161 | + $newtopic->setVar('poster_name', $postObject->getVar('poster_name'), true); |
|
| 162 | + $newtopic->setVar('approved', 1, true); |
|
| 163 | + $topicHandler->insert($newtopic, true); |
|
| 164 | + $new_topic_id = $newtopic->getVar('topic_id'); |
|
| 165 | + |
|
| 166 | + $pid = $postObject->getVar('pid'); |
|
| 167 | + |
|
| 168 | + $postObject->setVar('topic_id', $new_topic_id, true); |
|
| 169 | + $postObject->setVar('pid', 0, true); |
|
| 170 | + $postHandler->insert($postObject); |
|
| 171 | + |
|
| 172 | + /* split a single post */ |
|
| 173 | + if (1 === $mode) { |
|
| 174 | + $criteria = new \CriteriaCompo(new \Criteria('topic_id', $topic_id)); |
|
| 175 | + $criteria->add(new \Criteria('pid', $post_id)); |
|
| 176 | + $postHandler->updateAll('pid', $pid, $criteria, true); |
|
| 177 | + /* split a post and its children posts */ |
|
| 178 | + } elseif (2 === $mode) { |
|
| 179 | + require_once $GLOBALS['xoops']->path('class/xoopstree.php'); |
|
| 180 | + $mytree = new \XoopsTree($GLOBALS['xoopsDB']->prefix('newbb_posts'), 'post_id', 'pid'); |
|
| 181 | + $posts = $mytree->getAllChildId($post_id); |
|
| 182 | + if (count($posts) > 0) { |
|
| 183 | + $criteria = new \Criteria('post_id', '(' . implode(',', $posts) . ')', 'IN'); |
|
| 184 | + $postHandler->updateAll('topic_id', $new_topic_id, $criteria, true); |
|
| 185 | + } |
|
| 186 | + /* split a post and all posts coming after */ |
|
| 187 | + } elseif (3 === $mode) { |
|
| 188 | + $criteria = new \CriteriaCompo(new \Criteria('topic_id', $topic_id)); |
|
| 189 | + $criteria->add(new \Criteria('post_id', $post_id, '>')); |
|
| 190 | + $postHandler->updateAll('topic_id', $new_topic_id, $criteria, true); |
|
| 191 | + |
|
| 192 | + unset($criteria); |
|
| 193 | + $criteria = new \CriteriaCompo(new \Criteria('topic_id', $new_topic_id)); |
|
| 194 | + $criteria->add(new \Criteria('post_id', $post_id, '>')); |
|
| 195 | + $postHandler->identifierName = 'pid'; |
|
| 196 | + $posts = $postHandler->getList($criteria); |
|
| 197 | + |
|
| 198 | + unset($criteria); |
|
| 199 | + $post_update = []; |
|
| 200 | + foreach ($posts as $postid => $pid) { |
|
| 201 | + // if (!in_array($pid, array_keys($posts))) { |
|
| 202 | + if (!array_key_exists($pid, $posts)) { |
|
| 203 | + $post_update[] = $pid; |
|
| 204 | + } |
|
| 205 | + if (!array_key_exists($pid, $posts)) { |
|
| 206 | + $post_update2[] = $pid; |
|
| 207 | + } |
|
| 208 | + } |
|
| 209 | + if (count($post_update)) { |
|
| 210 | + $criteria = new \Criteria('post_id', '(' . implode(',', $post_update) . ')', 'IN'); |
|
| 211 | + $postHandler->updateAll('pid', $post_id, $criteria, true); |
|
| 212 | + } |
|
| 213 | + } |
|
| 214 | + |
|
| 215 | + $forum_id = $postObject->getVar('forum_id'); |
|
| 216 | + $topicHandler->synchronization($topic_id); |
|
| 217 | + $topicHandler->synchronization($new_topic_id); |
|
| 218 | + $sql = sprintf('UPDATE "%s" SET forum_topics = forum_topics+1 WHERE forum_id = "%u"', $GLOBALS['xoopsDB']->prefix('newbb_forums'), $forum_id); |
|
| 219 | + $result = $GLOBALS['xoopsDB']->queryF($sql); |
|
| 220 | + |
|
| 221 | + break; |
|
| 222 | 222 | } |
| 223 | 223 | if (!empty($topic_id)) { |
| 224 | - redirect_header(XOOPS_URL . "/modules/newbb/viewtopic.php?topic_id=$topic_id", 2, _MD_NEWBB_DBUPDATED); |
|
| 224 | + redirect_header(XOOPS_URL . "/modules/newbb/viewtopic.php?topic_id=$topic_id", 2, _MD_NEWBB_DBUPDATED); |
|
| 225 | 225 | } elseif (!empty($forum_id)) { |
| 226 | - redirect_header(XOOPS_URL . "/modules/newbb/viewforum.php?forum=$forum_id", 2, _MD_NEWBB_DBUPDATED); |
|
| 226 | + redirect_header(XOOPS_URL . "/modules/newbb/viewforum.php?forum=$forum_id", 2, _MD_NEWBB_DBUPDATED); |
|
| 227 | 227 | } else { |
| 228 | - redirect_header(XOOPS_URL . "/modules/newbb/viewpost.php?uid=$uid", 2, _MD_NEWBB_DBUPDATED); |
|
| 228 | + redirect_header(XOOPS_URL . "/modules/newbb/viewpost.php?uid=$uid", 2, _MD_NEWBB_DBUPDATED); |
|
| 229 | 229 | } |
| 230 | 230 | // irmtfan move to footer.php |
| 231 | 231 | require_once __DIR__ . '/footer.php'; |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | $configHandler = xoops_getHandler('config'); |
| 41 | 41 | $xoopsConfigSearch = $configHandler->getConfigsByCat(XOOPS_CONF_SEARCH); |
| 42 | 42 | if (1 !== $xoopsConfigSearch['enable_search']) { |
| 43 | - redirect_header(XOOPS_URL . '/modules/newbb/index.php', 2, _MD_NEWBB_SEARCHDISABLED); |
|
| 43 | + redirect_header(XOOPS_URL . '/modules/newbb/index.php', 2, _MD_NEWBB_SEARCHDISABLED); |
|
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | $GLOBALS['xoopsConfig']['module_cache'][$xoopsModule->getVar('mid')] = 0; |
@@ -75,195 +75,195 @@ discard block |
||
| 75 | 75 | $search_username = trim($uname); |
| 76 | 76 | |
| 77 | 77 | if ($GLOBALS['xoopsModuleConfig']['wol_enabled']) { |
| 78 | - // /** @var Newbb\OnlineHandler $onlineHandler */ |
|
| 79 | - // $onlineHandler = Newbb\Helper::getInstance()->getHandler('Online'); |
|
| 80 | - $onlineHandler->init(0); |
|
| 78 | + // /** @var Newbb\OnlineHandler $onlineHandler */ |
|
| 79 | + // $onlineHandler = Newbb\Helper::getInstance()->getHandler('Online'); |
|
| 80 | + $onlineHandler->init(0); |
|
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | $xoopsTpl->assign('forumindex', sprintf(_MD_NEWBB_FORUMINDEX, htmlspecialchars($GLOBALS['xoopsConfig']['sitename'], ENT_QUOTES))); |
| 84 | 84 | //$xoopsTpl->assign("img_folder", newbbDisplayImage($forumImage['topic'])); |
| 85 | 85 | |
| 86 | 86 | if (!empty($uname) || Request::getString('submit', '') || !empty($term)) { |
| 87 | - // irmtfan filter positive numbers |
|
| 88 | - $selectlength = !empty($selectlength) ? abs($selectlength) : 200; |
|
| 89 | - // irmtfan add select parameters for next search |
|
| 90 | - $next_search['selectlength'] = $selectlength; |
|
| 87 | + // irmtfan filter positive numbers |
|
| 88 | + $selectlength = !empty($selectlength) ? abs($selectlength) : 200; |
|
| 89 | + // irmtfan add select parameters for next search |
|
| 90 | + $next_search['selectlength'] = $selectlength; |
|
| 91 | 91 | |
| 92 | - $start = Request::getInt('start', 0); |
|
| 93 | - $forum = Request::getInt('forum', null); |
|
| 94 | - if (empty($forum) || 'all' === $forum || (is_array($forum) && in_array('all', $forum, true))) { |
|
| 95 | - $forum = []; |
|
| 96 | - } elseif (!is_array($forum)) { |
|
| 97 | - $forum = array_map('intval', explode('|', $forum)); |
|
| 98 | - } |
|
| 99 | - $next_search['forum'] = implode('|', $forum); |
|
| 100 | - // START irmtfan topic search |
|
| 101 | - $topic = Request::getString('topic', null); |
|
| 102 | - $next_search['topic'] = $topic; |
|
| 103 | - // END irmtfan topic search |
|
| 104 | - // START irmtfan add show search |
|
| 105 | - $show_search = Request::getString('show_search', 'post_text'); |
|
| 106 | - $next_search['show_search'] = $show_search; |
|
| 107 | - // START irmtfan add show search |
|
| 92 | + $start = Request::getInt('start', 0); |
|
| 93 | + $forum = Request::getInt('forum', null); |
|
| 94 | + if (empty($forum) || 'all' === $forum || (is_array($forum) && in_array('all', $forum, true))) { |
|
| 95 | + $forum = []; |
|
| 96 | + } elseif (!is_array($forum)) { |
|
| 97 | + $forum = array_map('intval', explode('|', $forum)); |
|
| 98 | + } |
|
| 99 | + $next_search['forum'] = implode('|', $forum); |
|
| 100 | + // START irmtfan topic search |
|
| 101 | + $topic = Request::getString('topic', null); |
|
| 102 | + $next_search['topic'] = $topic; |
|
| 103 | + // END irmtfan topic search |
|
| 104 | + // START irmtfan add show search |
|
| 105 | + $show_search = Request::getString('show_search', 'post_text'); |
|
| 106 | + $next_search['show_search'] = $show_search; |
|
| 107 | + // START irmtfan add show search |
|
| 108 | 108 | |
| 109 | - $addterms = Request::getString('andor', 'AND'); |
|
| 110 | - $next_search['andor'] = $addterms; |
|
| 111 | - $andor = strtoupper($addterms); |
|
| 112 | - if (!in_array($addterms, ['OR', 'AND'], true)) { |
|
| 113 | - $andor = 'AND'; |
|
| 114 | - } |
|
| 109 | + $addterms = Request::getString('andor', 'AND'); |
|
| 110 | + $next_search['andor'] = $addterms; |
|
| 111 | + $andor = strtoupper($addterms); |
|
| 112 | + if (!in_array($addterms, ['OR', 'AND'], true)) { |
|
| 113 | + $andor = 'AND'; |
|
| 114 | + } |
|
| 115 | 115 | |
| 116 | - $uname_required = false; |
|
| 117 | - $next_search['uname'] = $search_username; |
|
| 118 | - if (!empty($search_username)) { |
|
| 119 | - $uname_required = true; |
|
| 120 | - $search_username = $GLOBALS['xoopsDB']->escape($search_username); |
|
| 121 | - if (!$result = $GLOBALS['xoopsDB']->query('SELECT uid FROM ' . $GLOBALS['xoopsDB']->prefix('users') . " WHERE uname LIKE '%$search_username%'")) { |
|
| 122 | - redirect_header(XOOPS_URL . '/search.php', 1, _MD_NEWBB_ERROROCCURED); |
|
| 123 | - } |
|
| 124 | - $uid = []; |
|
| 125 | - while (false !== ($row = $GLOBALS['xoopsDB']->fetchArray($result))) { |
|
| 126 | - $uid[] = $row['uid']; |
|
| 127 | - } |
|
| 128 | - } else { |
|
| 129 | - $uid = 0; |
|
| 130 | - } |
|
| 116 | + $uname_required = false; |
|
| 117 | + $next_search['uname'] = $search_username; |
|
| 118 | + if (!empty($search_username)) { |
|
| 119 | + $uname_required = true; |
|
| 120 | + $search_username = $GLOBALS['xoopsDB']->escape($search_username); |
|
| 121 | + if (!$result = $GLOBALS['xoopsDB']->query('SELECT uid FROM ' . $GLOBALS['xoopsDB']->prefix('users') . " WHERE uname LIKE '%$search_username%'")) { |
|
| 122 | + redirect_header(XOOPS_URL . '/search.php', 1, _MD_NEWBB_ERROROCCURED); |
|
| 123 | + } |
|
| 124 | + $uid = []; |
|
| 125 | + while (false !== ($row = $GLOBALS['xoopsDB']->fetchArray($result))) { |
|
| 126 | + $uid[] = $row['uid']; |
|
| 127 | + } |
|
| 128 | + } else { |
|
| 129 | + $uid = 0; |
|
| 130 | + } |
|
| 131 | 131 | |
| 132 | - $next_search['term'] = htmlspecialchars($term, ENT_QUOTES); |
|
| 133 | - $query = trim($term); |
|
| 132 | + $next_search['term'] = htmlspecialchars($term, ENT_QUOTES); |
|
| 133 | + $query = trim($term); |
|
| 134 | 134 | |
| 135 | - if ('EXACT' !== $andor) { |
|
| 136 | - $ignored_queries = []; // holds keywords that are shorter than allowed minimum length |
|
| 137 | - $temp_queries = str_getcsv($query, ' ', '"'); |
|
| 138 | - foreach ($temp_queries as $q) { |
|
| 139 | - $q = trim($q); |
|
| 140 | - if (strlen($q) >= $xoopsConfigSearch['keyword_min']) { |
|
| 141 | - $queries[] = $q; |
|
| 142 | - } else { |
|
| 143 | - $ignored_queries[] = $q; |
|
| 144 | - } |
|
| 145 | - } |
|
| 146 | - if (!$uname_required && 0 === count($queries)) { |
|
| 147 | - redirect_header(XOOPS_URL . '/search.php', 2, sprintf(_SR_KEYTOOSHORT, $xoopsConfigSearch['keyword_min'])); |
|
| 148 | - } |
|
| 149 | - } else { |
|
| 150 | - //$query = trim($query); |
|
| 151 | - if (!$uname_required && (strlen($query) < $xoopsConfigSearch['keyword_min'])) { |
|
| 152 | - redirect_header(XOOPS_URL . '/search.php', 2, sprintf(_SR_KEYTOOSHORT, $xoopsConfigSearch['keyword_min'])); |
|
| 153 | - } |
|
| 154 | - $queries = [$query]; |
|
| 155 | - } |
|
| 135 | + if ('EXACT' !== $andor) { |
|
| 136 | + $ignored_queries = []; // holds keywords that are shorter than allowed minimum length |
|
| 137 | + $temp_queries = str_getcsv($query, ' ', '"'); |
|
| 138 | + foreach ($temp_queries as $q) { |
|
| 139 | + $q = trim($q); |
|
| 140 | + if (strlen($q) >= $xoopsConfigSearch['keyword_min']) { |
|
| 141 | + $queries[] = $q; |
|
| 142 | + } else { |
|
| 143 | + $ignored_queries[] = $q; |
|
| 144 | + } |
|
| 145 | + } |
|
| 146 | + if (!$uname_required && 0 === count($queries)) { |
|
| 147 | + redirect_header(XOOPS_URL . '/search.php', 2, sprintf(_SR_KEYTOOSHORT, $xoopsConfigSearch['keyword_min'])); |
|
| 148 | + } |
|
| 149 | + } else { |
|
| 150 | + //$query = trim($query); |
|
| 151 | + if (!$uname_required && (strlen($query) < $xoopsConfigSearch['keyword_min'])) { |
|
| 152 | + redirect_header(XOOPS_URL . '/search.php', 2, sprintf(_SR_KEYTOOSHORT, $xoopsConfigSearch['keyword_min'])); |
|
| 153 | + } |
|
| 154 | + $queries = [$query]; |
|
| 155 | + } |
|
| 156 | 156 | |
| 157 | - // entries must be lowercase |
|
| 158 | - $allowed = ['p.post_time', 'p.subject']; // irmtfan just post time and subject |
|
| 157 | + // entries must be lowercase |
|
| 158 | + $allowed = ['p.post_time', 'p.subject']; // irmtfan just post time and subject |
|
| 159 | 159 | |
| 160 | - $sortby = Request::getString('sortby', 'p.post_time'); |
|
| 161 | - $next_search['sortby'] = $sortby; |
|
| 162 | - //$sortby = (in_array(strtolower($sortby), $allowed)) ? $sortby : 't.topic_last_post_id'; |
|
| 163 | - $sortby = in_array(strtolower($sortby), $allowed) ? $sortby : 'p.post_time'; |
|
| 164 | - $searchin = Request::getString('searchin', 'both'); |
|
| 165 | - $next_search['searchin'] = $searchin; |
|
| 166 | - // START irmtfan use criteria - add since and topic search |
|
| 167 | - if (!empty($since)) { |
|
| 168 | - $criteriaExtra->add(new \Criteria('p.post_time', time() - newbbGetSinceTime($since), '>='), 'OR'); |
|
| 169 | - } |
|
| 170 | - if (is_numeric($topic) && !empty($topic)) { |
|
| 171 | - $criteriaExtra->add(new \Criteria('p.topic_id', $topic), 'OR'); |
|
| 172 | - } |
|
| 173 | - // END irmtfan use criteria - add since and topic search |
|
| 160 | + $sortby = Request::getString('sortby', 'p.post_time'); |
|
| 161 | + $next_search['sortby'] = $sortby; |
|
| 162 | + //$sortby = (in_array(strtolower($sortby), $allowed)) ? $sortby : 't.topic_last_post_id'; |
|
| 163 | + $sortby = in_array(strtolower($sortby), $allowed) ? $sortby : 'p.post_time'; |
|
| 164 | + $searchin = Request::getString('searchin', 'both'); |
|
| 165 | + $next_search['searchin'] = $searchin; |
|
| 166 | + // START irmtfan use criteria - add since and topic search |
|
| 167 | + if (!empty($since)) { |
|
| 168 | + $criteriaExtra->add(new \Criteria('p.post_time', time() - newbbGetSinceTime($since), '>='), 'OR'); |
|
| 169 | + } |
|
| 170 | + if (is_numeric($topic) && !empty($topic)) { |
|
| 171 | + $criteriaExtra->add(new \Criteria('p.topic_id', $topic), 'OR'); |
|
| 172 | + } |
|
| 173 | + // END irmtfan use criteria - add since and topic search |
|
| 174 | 174 | |
| 175 | - if ($uname_required && (!$uid || count($uid) < 1)) { |
|
| 176 | - $results = []; |
|
| 177 | - } // irmtfan bug fix array() |
|
| 178 | - else { |
|
| 179 | - $results = newbb_search($queries, $andor, $limit, $start, $uid, $forum, $sortby, $searchin, $criteriaExtra); |
|
| 180 | - } // irmtfan $criteriaExtra |
|
| 175 | + if ($uname_required && (!$uid || count($uid) < 1)) { |
|
| 176 | + $results = []; |
|
| 177 | + } // irmtfan bug fix array() |
|
| 178 | + else { |
|
| 179 | + $results = newbb_search($queries, $andor, $limit, $start, $uid, $forum, $sortby, $searchin, $criteriaExtra); |
|
| 180 | + } // irmtfan $criteriaExtra |
|
| 181 | 181 | |
| 182 | - $search_info_keywords = Highlighter::apply($myts->htmlSpecialChars($term, ENT_QUOTES), implode(' ', $queries), '<mark>', '</mark>'); |
|
| 183 | - $num_results = count($results); |
|
| 184 | - if ($num_results < 1) { |
|
| 185 | - $xoopsTpl->assign('lang_nomatch', _SR_NOMATCH); |
|
| 186 | - } else { |
|
| 187 | - $skipresults = 0; |
|
| 188 | - foreach ($results as $row) { |
|
| 189 | - $post_text_select = ''; |
|
| 190 | - $post_subject_select = Highlighter::apply($queries, $row['title'], '<mark>', '</mark>'); |
|
| 191 | - if ('post_text' === $show_search) { |
|
| 192 | - $post_text_select = Metagen::getSearchSummary($row['post_text'], $queries, $selectlength); |
|
| 193 | - $post_text_select = Highlighter::apply($queries, $post_text_select, '<mark>', '</mark>'); |
|
| 194 | - } |
|
| 195 | - // if no text remained after select text continue |
|
| 196 | - if (empty($post_text_select) && empty($post_subject_select)) { |
|
| 197 | - ++$skipresults; |
|
| 198 | - continue; |
|
| 199 | - } |
|
| 200 | - $xoopsTpl->append('results', [ |
|
| 201 | - 'forum_name' => $row['forum_name'], |
|
| 202 | - 'forum_link' => $row['forum_link'], |
|
| 203 | - 'link' => $row['link'], |
|
| 204 | - 'title' => $post_subject_select, |
|
| 205 | - 'poster' => $row['poster'], |
|
| 206 | - 'post_time' => formatTimestamp($row['time'], 'm'), |
|
| 207 | - 'post_text' => $post_text_select |
|
| 208 | - ]); |
|
| 209 | - } |
|
| 210 | - unset($results); |
|
| 182 | + $search_info_keywords = Highlighter::apply($myts->htmlSpecialChars($term, ENT_QUOTES), implode(' ', $queries), '<mark>', '</mark>'); |
|
| 183 | + $num_results = count($results); |
|
| 184 | + if ($num_results < 1) { |
|
| 185 | + $xoopsTpl->assign('lang_nomatch', _SR_NOMATCH); |
|
| 186 | + } else { |
|
| 187 | + $skipresults = 0; |
|
| 188 | + foreach ($results as $row) { |
|
| 189 | + $post_text_select = ''; |
|
| 190 | + $post_subject_select = Highlighter::apply($queries, $row['title'], '<mark>', '</mark>'); |
|
| 191 | + if ('post_text' === $show_search) { |
|
| 192 | + $post_text_select = Metagen::getSearchSummary($row['post_text'], $queries, $selectlength); |
|
| 193 | + $post_text_select = Highlighter::apply($queries, $post_text_select, '<mark>', '</mark>'); |
|
| 194 | + } |
|
| 195 | + // if no text remained after select text continue |
|
| 196 | + if (empty($post_text_select) && empty($post_subject_select)) { |
|
| 197 | + ++$skipresults; |
|
| 198 | + continue; |
|
| 199 | + } |
|
| 200 | + $xoopsTpl->append('results', [ |
|
| 201 | + 'forum_name' => $row['forum_name'], |
|
| 202 | + 'forum_link' => $row['forum_link'], |
|
| 203 | + 'link' => $row['link'], |
|
| 204 | + 'title' => $post_subject_select, |
|
| 205 | + 'poster' => $row['poster'], |
|
| 206 | + 'post_time' => formatTimestamp($row['time'], 'm'), |
|
| 207 | + 'post_text' => $post_text_select |
|
| 208 | + ]); |
|
| 209 | + } |
|
| 210 | + unset($results); |
|
| 211 | 211 | |
| 212 | - if (count($next_search) > 0) { |
|
| 213 | - $items = []; |
|
| 214 | - foreach ($next_search as $para => $val) { |
|
| 215 | - $items[] = "{$para}=" . urlencode($val); |
|
| 216 | - } |
|
| 217 | - if (count($items) > 0) { |
|
| 218 | - $paras = implode('&', $items); |
|
| 219 | - } |
|
| 220 | - unset($next_search, $items); |
|
| 221 | - } |
|
| 222 | - $search_url = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/search.php?' . $paras; |
|
| 223 | - // irmtfan remove to have just one query and appropriate next and prev links |
|
| 224 | - //$next_results = newbb_search($queries, $andor, 1, $start + $limit, $uid, $forum, $sortby, $searchin, $subquery); |
|
| 225 | - //$next_count = count($next_results); |
|
| 226 | - //$has_next = false; |
|
| 227 | - //if (is_array($next_results) && $next_count >0) { |
|
| 228 | - //$has_next = true; |
|
| 229 | - //} |
|
| 230 | - // irmtfan if $results < $limit => it is impossible to have next |
|
| 231 | - if ($num_results == $limit) { |
|
| 232 | - $next = $start + $limit; |
|
| 233 | - $queries = implode(',', $queries); |
|
| 234 | - $search_url_next = htmlspecialchars($search_url . "&direction=next&start={$next}", ENT_QUOTES | ENT_HTML5); |
|
| 235 | - $search_next = '<a href="' . $search_url_next . '">' . _SR_NEXT . '</a>'; |
|
| 236 | - $xoopsTpl->assign('search_next', $search_next); |
|
| 237 | - $xoopsTpl->assign('search_next_url', $search_url_next); |
|
| 238 | - } |
|
| 239 | - if ($start > 0) { |
|
| 240 | - $prev = $start - $limit; |
|
| 241 | - $search_url_prev = htmlspecialchars($search_url . "&direction=previous&start={$prev}", ENT_QUOTES | ENT_HTML5); |
|
| 242 | - $search_prev = '<a href="' . $search_url_prev . '">' . _SR_PREVIOUS . '</a>'; |
|
| 243 | - $xoopsTpl->assign('search_prev', $search_prev); |
|
| 244 | - $xoopsTpl->assign('search_prev_url', $search_url_prev); |
|
| 245 | - } |
|
| 246 | - // irmtfan if all results skipped then redirect to the next/previous page |
|
| 247 | - if ($num_results == $skipresults) { |
|
| 248 | - $direction = Request::getString('direction', 'next'); |
|
| 249 | - $search_url_redirect = ('next' === strtolower($direction)) ? $search_url_next : $search_url_prev; |
|
| 250 | - redirect_header($search_url_redirect, 1, constant(strtoupper("_SR_{$direction}"))); |
|
| 251 | - } |
|
| 252 | - } |
|
| 253 | - $search_info = _SR_KEYWORDS . ': ' . $search_info_keywords; |
|
| 254 | - if ($uname_required) { |
|
| 255 | - if ($search_info) { |
|
| 256 | - $search_info .= '<br>'; |
|
| 257 | - } |
|
| 258 | - $search_info .= _MD_NEWBB_USERNAME . ': ' . $myts->htmlSpecialChars($search_username); |
|
| 259 | - } |
|
| 260 | - // add num_results |
|
| 261 | - $search_info .= '<br>' . sprintf(_SR_SHOWING, $start + 1, $start + $num_results); |
|
| 262 | - // if any result skip show the counter |
|
| 263 | - if (!empty($skipresults)) { |
|
| 264 | - $search_info .= ' - ' . sprintf(_SR_FOUND, $num_results - $skipresults); |
|
| 265 | - } |
|
| 266 | - $xoopsTpl->assign('search_info', $search_info); |
|
| 212 | + if (count($next_search) > 0) { |
|
| 213 | + $items = []; |
|
| 214 | + foreach ($next_search as $para => $val) { |
|
| 215 | + $items[] = "{$para}=" . urlencode($val); |
|
| 216 | + } |
|
| 217 | + if (count($items) > 0) { |
|
| 218 | + $paras = implode('&', $items); |
|
| 219 | + } |
|
| 220 | + unset($next_search, $items); |
|
| 221 | + } |
|
| 222 | + $search_url = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/search.php?' . $paras; |
|
| 223 | + // irmtfan remove to have just one query and appropriate next and prev links |
|
| 224 | + //$next_results = newbb_search($queries, $andor, 1, $start + $limit, $uid, $forum, $sortby, $searchin, $subquery); |
|
| 225 | + //$next_count = count($next_results); |
|
| 226 | + //$has_next = false; |
|
| 227 | + //if (is_array($next_results) && $next_count >0) { |
|
| 228 | + //$has_next = true; |
|
| 229 | + //} |
|
| 230 | + // irmtfan if $results < $limit => it is impossible to have next |
|
| 231 | + if ($num_results == $limit) { |
|
| 232 | + $next = $start + $limit; |
|
| 233 | + $queries = implode(',', $queries); |
|
| 234 | + $search_url_next = htmlspecialchars($search_url . "&direction=next&start={$next}", ENT_QUOTES | ENT_HTML5); |
|
| 235 | + $search_next = '<a href="' . $search_url_next . '">' . _SR_NEXT . '</a>'; |
|
| 236 | + $xoopsTpl->assign('search_next', $search_next); |
|
| 237 | + $xoopsTpl->assign('search_next_url', $search_url_next); |
|
| 238 | + } |
|
| 239 | + if ($start > 0) { |
|
| 240 | + $prev = $start - $limit; |
|
| 241 | + $search_url_prev = htmlspecialchars($search_url . "&direction=previous&start={$prev}", ENT_QUOTES | ENT_HTML5); |
|
| 242 | + $search_prev = '<a href="' . $search_url_prev . '">' . _SR_PREVIOUS . '</a>'; |
|
| 243 | + $xoopsTpl->assign('search_prev', $search_prev); |
|
| 244 | + $xoopsTpl->assign('search_prev_url', $search_url_prev); |
|
| 245 | + } |
|
| 246 | + // irmtfan if all results skipped then redirect to the next/previous page |
|
| 247 | + if ($num_results == $skipresults) { |
|
| 248 | + $direction = Request::getString('direction', 'next'); |
|
| 249 | + $search_url_redirect = ('next' === strtolower($direction)) ? $search_url_next : $search_url_prev; |
|
| 250 | + redirect_header($search_url_redirect, 1, constant(strtoupper("_SR_{$direction}"))); |
|
| 251 | + } |
|
| 252 | + } |
|
| 253 | + $search_info = _SR_KEYWORDS . ': ' . $search_info_keywords; |
|
| 254 | + if ($uname_required) { |
|
| 255 | + if ($search_info) { |
|
| 256 | + $search_info .= '<br>'; |
|
| 257 | + } |
|
| 258 | + $search_info .= _MD_NEWBB_USERNAME . ': ' . $myts->htmlSpecialChars($search_username); |
|
| 259 | + } |
|
| 260 | + // add num_results |
|
| 261 | + $search_info .= '<br>' . sprintf(_SR_SHOWING, $start + 1, $start + $num_results); |
|
| 262 | + // if any result skip show the counter |
|
| 263 | + if (!empty($skipresults)) { |
|
| 264 | + $search_info .= ' - ' . sprintf(_SR_FOUND, $num_results - $skipresults); |
|
| 265 | + } |
|
| 266 | + $xoopsTpl->assign('search_info', $search_info); |
|
| 267 | 267 | } |
| 268 | 268 | // assign template vars for search |
| 269 | 269 | /* term */ |
@@ -273,12 +273,12 @@ discard block |
||
| 273 | 273 | $andor_select = '<select name="andor" id="andor" class="form-control">'; |
| 274 | 274 | $andor_select .= '<option value="OR"'; |
| 275 | 275 | if ('OR' === $andor) { |
| 276 | - $andor_select .= ' selected="selected"'; |
|
| 276 | + $andor_select .= ' selected="selected"'; |
|
| 277 | 277 | } |
| 278 | 278 | $andor_select .= '>' . _SR_ANY . '</option>'; |
| 279 | 279 | $andor_select .= '<option value="AND"'; |
| 280 | 280 | if ('AND' === $andor || empty($andor)) { |
| 281 | - $andor_select .= ' selected="selected"'; |
|
| 281 | + $andor_select .= ' selected="selected"'; |
|
| 282 | 282 | } |
| 283 | 283 | $andor_select .= '>' . _SR_ALL . '</option>'; |
| 284 | 284 | $andor_select .= '</select>'; |
@@ -295,17 +295,17 @@ discard block |
||
| 295 | 295 | $searchin_select = ''; |
| 296 | 296 | $searchin_select .= '<label class="radio-inline"><input type="radio" name="searchin" value="title"'; |
| 297 | 297 | if ('title' === $searchin) { |
| 298 | - $searchin_select .= ' checked'; |
|
| 298 | + $searchin_select .= ' checked'; |
|
| 299 | 299 | } |
| 300 | 300 | $searchin_select .= ' />' . _MD_NEWBB_SUBJECT . ' </label>'; |
| 301 | 301 | $searchin_select .= '<label class="radio-inline"><input type="radio" name="searchin" value="text"'; |
| 302 | 302 | if ('text' === $searchin) { |
| 303 | - $searchin_select .= ' checked'; |
|
| 303 | + $searchin_select .= ' checked'; |
|
| 304 | 304 | } |
| 305 | 305 | $searchin_select .= ' />' . _MD_NEWBB_BODY . ' </label>'; |
| 306 | 306 | $searchin_select .= '<label class="radio-inline"><input type="radio" name="searchin" value="both"'; |
| 307 | 307 | if ('both' === $searchin || empty($searchin)) { |
| 308 | - $searchin_select .= ' checked'; |
|
| 308 | + $searchin_select .= ' checked'; |
|
| 309 | 309 | } |
| 310 | 310 | $searchin_select .= ' />' . _MD_NEWBB_SUBJECT . ' & ' . _MD_NEWBB_BODY . ' </label>'; |
| 311 | 311 | $xoopsTpl->assign('searchin_radio', $searchin_select); |
@@ -314,12 +314,12 @@ discard block |
||
| 314 | 314 | $show_search_select = ''; |
| 315 | 315 | $show_search_select .= '<label class="radio-inline"><input type="radio" name="show_search" value="post"'; |
| 316 | 316 | if ('post' === $show_search) { |
| 317 | - $show_search_select .= ' checked'; |
|
| 317 | + $show_search_select .= ' checked'; |
|
| 318 | 318 | } |
| 319 | 319 | $show_search_select .= ' />' . _MD_NEWBB_POSTS . ' </label>'; |
| 320 | 320 | $show_search_select .= '<label class="radio-inline"><input type="radio" name="show_search" value="post_text"'; |
| 321 | 321 | if ('post_text' === $show_search || empty($show_search)) { |
| 322 | - $show_search_select .= ' checked'; |
|
| 322 | + $show_search_select .= ' checked'; |
|
| 323 | 323 | } |
| 324 | 324 | $show_search_select .= ' />' . _MD_NEWBB_SEARCHPOSTTEXT . ' </label>'; |
| 325 | 325 | $xoopsTpl->assign('show_search_radio', $show_search_select); |
@@ -331,12 +331,12 @@ discard block |
||
| 331 | 331 | $sortby_select = '<select name="sortby" id="sortby" class="form-control">'; |
| 332 | 332 | $sortby_select .= '<option value=\'p.post_time\''; |
| 333 | 333 | if ('p.post_time' === $sortby || empty($sortby)) { |
| 334 | - $sortby_select .= ' selected=\'selected\''; |
|
| 334 | + $sortby_select .= ' selected=\'selected\''; |
|
| 335 | 335 | } |
| 336 | 336 | $sortby_select .= '>' . _MD_NEWBB_DATE . '</option>'; |
| 337 | 337 | $sortby_select .= '<option value=\'p.subject\''; |
| 338 | 338 | if ('p.subject' === $sortby) { |
| 339 | - $sortby_select .= ' selected="selected"'; |
|
| 339 | + $sortby_select .= ' selected="selected"'; |
|
| 340 | 340 | } |
| 341 | 341 | $sortby_select .= '>' . _MD_NEWBB_TOPIC . '</option>'; |
| 342 | 342 | $sortby_select .= '</select>'; |
@@ -351,7 +351,7 @@ discard block |
||
| 351 | 351 | $xoopsTpl->assign_by_ref('since_selection_box', $select_since); |
| 352 | 352 | |
| 353 | 353 | if ($xoopsConfigSearch['keyword_min'] > 0) { |
| 354 | - $xoopsTpl->assign('search_rule', sprintf(_SR_KEYIGNORE, $xoopsConfigSearch['keyword_min'])); |
|
| 354 | + $xoopsTpl->assign('search_rule', sprintf(_SR_KEYIGNORE, $xoopsConfigSearch['keyword_min'])); |
|
| 355 | 355 | } |
| 356 | 356 | // irmtfan move to footer.php |
| 357 | 357 | require_once __DIR__ . '/footer.php'; |