diff --git a/action.post.php b/action.post.php index 27f56667..53bb56f6 100644 --- a/action.post.php +++ b/action.post.php @@ -15,7 +15,7 @@ $uid = XoopsRequest::getInt('uid', 0, 'GET'); $op = XoopsRequest::getCmd('op', XoopsRequest::getCmd('op', '', 'POST'), 'GET'); -$op = in_array($op, array('approve', 'delete', 'restore', 'split'), true) ? $op : ''; +$op = in_array($op, ['approve', 'delete', 'restore', 'split'], true) ? $op : ''; $mode = XoopsRequest::getInt('mode', 1, 'GET'); if (0 === count($post_id) || 0 === count($op)) { @@ -43,8 +43,8 @@ case 'restore': $post_id = array_values($post_id); sort($post_id); - $topics = array(); - $forums = array(); + $topics = []; + $forums = []; foreach ($post_id as $post) { $post_obj = $postHandler->get($post); if ($post_obj->getVar('topic_id') < 1) { @@ -65,8 +65,8 @@ case 'approve': $post_id = array_values($post_id); sort($post_id); - $topics = array(); - $forums = array(); + $topics = []; + $forums = []; $criteria = new Criteria('post_id', '(' . implode(',', $post_id) . ')', 'IN'); $posts_obj = $postHandler->getObjects($criteria, true); foreach ($post_id as $post) { @@ -98,7 +98,7 @@ include_once __DIR__ . '/include/notification.inc.php'; $notificationHandler = xoops_getHandler('notification'); foreach ($post_id as $post) { - $tags = array(); + $tags = []; $tags['THREAD_NAME'] = $topic_list[$posts_obj[$post]->getVar('topic_id')]; $tags['THREAD_URL'] = XOOPS_URL . '/modules/' @@ -122,8 +122,8 @@ case 'delete': $post_id = array_values($post_id); rsort($post_id); - $topics = array(); - $forums = array(); + $topics = []; + $forums = []; foreach ($post_id as $post) { $post_obj = $postHandler->get($post); if (!empty($topic_id) && $topic_id !== $post_obj->getVar('topic_id')) { @@ -165,12 +165,12 @@ $postHandler->insert($post_obj); /* split a single post */ - if ($mode === 1) { + if (1 === $mode) { $criteria = new CriteriaCompo(new Criteria('topic_id', $topic_id)); $criteria->add(new Criteria('pid', $post_id)); $postHandler->updateAll('pid', $pid, $criteria, true); /* split a post and its children posts */ - } elseif ($mode === 2) { + } elseif (2 === $mode) { include_once $GLOBALS['xoops']->path('class/xoopstree.php'); $mytree = new XoopsTree($GLOBALS['xoopsDB']->prefix('bb_posts'), 'post_id', 'pid'); $posts = $mytree->getAllChildId($post_id); @@ -179,7 +179,7 @@ $postHandler->updateAll('topic_id', $new_topic_id, $criteria, true); } /* split a post and all posts coming after */ - } elseif ($mode === 3) { + } elseif (3 === $mode) { $criteria = new CriteriaCompo(new Criteria('topic_id', $topic_id)); $criteria->add(new Criteria('post_id', $post_id, '>')); $postHandler->updateAll('topic_id', $new_topic_id, $criteria, true); @@ -191,7 +191,7 @@ $posts = $postHandler->getList($criteria); unset($criteria); - $post_update = array(); + $post_update = []; foreach ($posts as $postid => $pid) { // if (!in_array($pid, array_keys($posts))) { if (!array_key_exists($pid, $posts)) { diff --git a/action.topic.php b/action.topic.php index d1f98e04..86fc3f6c 100644 --- a/action.topic.php +++ b/action.topic.php @@ -14,7 +14,7 @@ $topic_id = XoopsRequest::getArray('topic_id', null, 'POST'); $op = XoopsRequest::getCmd('op', '', 'POST'); -$op = in_array($op, array('approve', 'delete', 'restore', 'move'), true) ? $op : ''; +$op = in_array($op, ['approve', 'delete', 'restore', 'move'], true) ? $op : ''; if (0 === count($topic_id) || 0 === count($op)) { // irmtfan - issue with javascript:history.go(-1) @@ -32,7 +32,7 @@ } switch ($op) { case 'restore': - $forums = array(); + $forums = []; $topics_obj = $topicHandler->getAll(new Criteria('topic_id', '(' . implode(',', $topic_id) . ')', 'IN')); foreach (array_keys($topics_obj) as $id) { $topic_obj =& $topics_obj[$id]; @@ -48,7 +48,7 @@ unset($topics_obj, $forums_obj); break; case 'approve': - $forums = array(); + $forums = []; $topics_obj = $topicHandler->getAll(new Criteria('topic_id', '(' . implode(',', $topic_id) . ')', 'IN')); foreach (array_keys($topics_obj) as $id) { $topic_obj =& $topics_obj[$id]; @@ -71,7 +71,7 @@ $notificationHandler = xoops_getHandler('notification'); foreach (array_keys($topics_obj) as $id) { $topic_obj =& $topics_obj[$id]; - $tags = array(); + $tags = []; $tags['THREAD_NAME'] = $topic_obj->getVar('topic_title'); $tags['THREAD_URL'] = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/viewtopic.php?topic_id=' . $id . '&forum=' . $topic_obj->getVar('forum_id'); $tags['FORUM_NAME'] = $forums_obj[$topic_obj->getVar('forum_id')]->getVar('forum_name'); @@ -92,7 +92,7 @@ unset($topics_obj, $forums_obj); break; case 'delete': - $forums = array(); + $forums = []; $topics_obj = $topicHandler->getAll(new Criteria('topic_id', '(' . implode(',', $topic_id) . ')', 'IN')); foreach (array_keys($topics_obj) as $id) { $topic_obj =& $topics_obj[$id]; diff --git a/admin/admin_cat_manager.php b/admin/admin_cat_manager.php index 829ccc07..1cd3e047 100644 --- a/admin/admin_cat_manager.php +++ b/admin/admin_cat_manager.php @@ -123,7 +123,7 @@ function editCategory(XoopsObject $category_obj = null) case 'del': if (!XoopsRequest::getBool('confirm', '', 'POST')) { - xoops_confirm(array('op' => 'del', 'cat_id' => XoopsRequest::getInt('cat_id', 0, 'GET'), 'confirm' => 1), 'admin_cat_manager.php', _AM_NEWBB_WAYSYWTDTTAL); + xoops_confirm(['op' => 'del', 'cat_id' => XoopsRequest::getInt('cat_id', 0, 'GET'), 'confirm' => 1], 'admin_cat_manager.php', _AM_NEWBB_WAYSYWTDTTAL); break; } else { $category_obj = $categoryHandler->create(false); @@ -184,9 +184,9 @@ function editCategory(XoopsObject $category_obj = null) echo ''; foreach ($categories as $key => $onecat) { - $cat_edit_link = "getVar('cat_id') . "\">" . newbbDisplayImage('admin_edit', _EDIT) . ''; - $cat_del_link = "getVar('cat_id') . "\">" . newbbDisplayImage('admin_delete', _DELETE) . ''; - $cat_title_link = "getVar('dirname') . '/index.php?cat=' . $onecat->getVar('cat_id') . "\">" . $onecat->getVar('cat_title') . ''; + $cat_edit_link = '' . newbbDisplayImage('admin_edit', _EDIT) . ''; + $cat_del_link = '' . newbbDisplayImage('admin_delete', _DELETE) . ''; + $cat_title_link = '' . $onecat->getVar('cat_title') . ''; echo ""; echo '' . $cat_title_link . ''; diff --git a/admin/admin_digest.php b/admin/admin_digest.php index 70df3184..d55910d9 100644 --- a/admin/admin_digest.php +++ b/admin/admin_digest.php @@ -43,7 +43,7 @@ case 'delete': $digest_ids = XoopsRequest::getArray('digest_id', '', 'POST'); $digestHandler = xoops_getModuleHandler('digest', 'newbb'); - if ($digest_ids !== '') { + if ('' !== $digest_ids) { foreach ($digest_ids as $did => $value) { $digestHandler->delete($did); } @@ -66,7 +66,7 @@ echo "" . _DELETE . ''; echo ''; - $digests = array(); + $digests = []; $digestHandler = xoops_getModuleHandler('digest', 'newbb'); $digests = $digestHandler->getAllDigests($start, $limit); foreach ($digests as $digest) { diff --git a/admin/admin_forum_manager.php b/admin/admin_forum_manager.php index 6105bdcb..fd4cb348 100644 --- a/admin/admin_forum_manager.php +++ b/admin/admin_forum_manager.php @@ -48,12 +48,12 @@ if (XoopsRequest::getInt('dest_forum', 0, 'POST')) { $dest = XoopsRequest::getInt('dest_forum', 0, 'POST'); if ($dest > 0) { - $pid = (int)$dest; + $pid = $dest; $forum_dest = $forumHandler->get($pid); $cid = $forum_dest->getVar('cat_id'); unset($forum_dest); } else { - $cid = abs((int)$dest); + $cid = abs($dest); $pid = 0; } $forum_obj = $forumHandler->get($forum_id); @@ -152,13 +152,13 @@ $forum_obj->setVar('forum_name', XoopsRequest::getString('forum_name', '', 'POST')); $forum_obj->setVar('forum_desc', XoopsRequest::getString('forum_desc', '', 'POST')); $forum_obj->setVar('forum_order', XoopsRequest::getInt('forum_order', 0, 'POST')); - $forum_obj->setVar('forum_moderator', XoopsRequest::getArray('forum_moderator', array(), 'POST')); + $forum_obj->setVar('forum_moderator', XoopsRequest::getArray('forum_moderator', [], 'POST')); $forum_obj->setVar('parent_forum', XoopsRequest::getInt('parent_forum', 0, 'POST')); $forum_obj->setVar('attach_maxkb', XoopsRequest::getInt('attach_maxkb', 0, 'POST')); $forum_obj->setVar('attach_ext', XoopsRequest::getString('attach_ext', '', 'POST')); $forum_obj->setVar('hot_threshold', XoopsRequest::getInt('hot_threshold', 0, 'POST')); if (XoopsRequest::getInt('parent_forum', 0, 'POST')) { - $parent_obj = $forumHandler->get(XoopsRequest::getInt('parent_forum', 0, 'POST'), array('cat_id')); + $parent_obj = $forumHandler->get(XoopsRequest::getInt('parent_forum', 0, 'POST'), ['cat_id']); $_POST['cat_id'] = $parent_obj->getVar('cat_id'); } $forum_obj->setVar('cat_id', XoopsRequest::getInt('cat_id', 0, 'POST')); @@ -202,7 +202,7 @@ case 'del': if (1 !== XoopsRequest::getInt('confirm', 0, 'POST')) { - xoops_confirm(array('op' => 'del', 'forum' => XoopsRequest::getInt('forum', 0, 'GET'), 'confirm' => 1), 'admin_forum_manager.php', _AM_NEWBB_TWDAFAP); + xoops_confirm(['op' => 'del', 'forum' => XoopsRequest::getInt('forum', 0, 'GET'), 'confirm' => 1], 'admin_forum_manager.php', _AM_NEWBB_TWDAFAP); break; } else { $forum_obj = $forumHandler->get(XoopsRequest::getInt('forum', 0, 'POST')); @@ -261,10 +261,10 @@ foreach (array_keys($categories) as $c) { $category = $categories[$c]; $cat_id = $c; - $cat_link = "getVar('dirname', 'n') . '/index.php?viewcat=' . $cat_id . "\">" . $category . ''; - $cat_edit_link = "" . newbbDisplayImage('admin_edit', _EDIT) . ''; - $cat_del_link = "" . newbbDisplayImage('admin_delete', _DELETE) . ''; - $forum_add_link = "" . newbbDisplayImage('new_forum') . ''; + $cat_link = '' . $category . ''; + $cat_edit_link = '' . newbbDisplayImage('admin_edit', _EDIT) . ''; + $cat_del_link = '' . newbbDisplayImage('admin_delete', _DELETE) . ''; + $forum_add_link = '' . newbbDisplayImage('new_forum') . ''; $echo .= ""; $echo .= "" . $cat_link . ''; $echo .= "" . $cat_edit_link . ''; @@ -279,12 +279,12 @@ $i = 0; foreach (array_keys($forums[$c]) as $f) { $forum = $forums[$c][$f]; - $f_link = $forum['prefix'] . "getVar('dirname', 'n') . '/viewforum.php?forum=' . $f . "\">" . $forum['forum_name'] . ''; - $f_edit_link = "" . newbbDisplayImage('admin_edit', _AM_NEWBB_EDIT) . ''; - $f_del_link = "" . newbbDisplayImage('admin_delete', _AM_NEWBB_DELETE) . ''; - $sf_add_link = "'; - $f_move_link = "" . newbbDisplayImage('admin_move', _AM_NEWBB_MOVE) . ''; - $f_merge_link = "" . newbbDisplayImage('admin_merge', _AM_NEWBB_MERGE) . ''; + $f_link = $forum['prefix'] . '' . $forum['forum_name'] . ''; + $f_edit_link = '' . newbbDisplayImage('admin_edit', _AM_NEWBB_EDIT) . ''; + $f_del_link = '' . newbbDisplayImage('admin_delete', _AM_NEWBB_DELETE) . ''; + $sf_add_link = '' . newbbDisplayImage('new_forum', _AM_NEWBB_CREATEFORUM) . ''; + $f_move_link = '' . newbbDisplayImage('admin_move', _AM_NEWBB_MOVE) . ''; + $f_merge_link = '' . newbbDisplayImage('admin_merge', _AM_NEWBB_MERGE) . ''; $class = (($i++) % 2) ? 'odd' : 'even'; $echo .= ""; diff --git a/admin/admin_forum_prune.php b/admin/admin_forum_prune.php index 74c1cffb..5dd6761b 100644 --- a/admin/admin_forum_prune.php +++ b/admin/admin_forum_prune.php @@ -77,18 +77,18 @@ if ($lock) { $sql .= ' AND t.topic_status <> 1 '; } - if ($hot !== 0) { + if (0 !== $hot) { $sql .= ' AND t.topic_replies < ' . $hot . ' '; } $sql .= ' AND p.post_time<= ' . $prune_ddays . ' '; // Ok now we have the sql query completed, go for topic_id's and posts_id's - $topics = array(); + $topics = []; if (!$result = $GLOBALS['xoopsDB']->query($sql)) { return _MD_ERROR; } // Dave_L code - while ($row = $GLOBALS['xoopsDB']->fetchArray($result)) { + while (false !== ($row = $GLOBALS['xoopsDB']->fetchArray($result))) { $topics[] = $row['topic_id']; } $topics_number = count($topics); @@ -98,12 +98,12 @@ if ('' !== $topic_list) { $sql = 'SELECT post_id FROM ' . $GLOBALS['xoopsDB']->prefix('bb_posts') . ' WHERE topic_id IN (' . $topic_list . ')'; - $posts = array(); + $posts = []; if (!$result = $GLOBALS['xoopsDB']->query($sql)) { return _MD_ERROR; } // Dave_L code - while ($row = $GLOBALS['xoopsDB']->fetchArray($result)) { + while (false !== ($row = $GLOBALS['xoopsDB']->fetchArray($result))) { $posts[] = $row['post_id']; } $posts_number = count($posts); @@ -124,7 +124,7 @@ } } else { // ARCHIVING POSTS - if ($archive == 1) { + if (1 == $archive) { $result = $GLOBALS['xoopsDB']->query('SELECT p.topic_id, p.post_id, t.post_text FROM ' . $GLOBALS['xoopsDB']->prefix('bb_posts') . ' p, ' @@ -172,7 +172,7 @@ // $result = $GLOBALS['xoopsDB']->query(); // Days selected by selbox (better error control :lol:) $days = new XoopsFormSelect(_AM_NEWBB_PRUNE_DAYS, 'days', null, 1, false); - $days->addOptionArray(array( + $days->addOptionArray([ 604800 => _AM_NEWBB_PRUNE_WEEK, 1209600 => _AM_NEWBB_PRUNE_2WEEKS, 2592000 => _AM_NEWBB_PRUNE_MONTH, @@ -180,7 +180,7 @@ 10368000 => _AM_NEWBB_PRUNE_4MONTH, 31536000 => _AM_NEWBB_PRUNE_YEAR, 63072000 => _AM_NEWBB_PRUNE_2YEARS - )); + ]); $sform->addElement($days); // START irmtfan remove hardcode db access include_once $GLOBALS['xoops']->path('modules/' . $xoopsModule->getVar('dirname') . '/footer.php'); // to include js files @@ -202,7 +202,7 @@ do { $checkbox->addOption($myrow['forum_id'], $myrow['forum_name']); $radiobox->addOption($myrow['forum_id'], $myrow['forum_name']); - } while ($myrow = $GLOBALS['xoopsDB']->fetchArray($result)); + } while (false !== ($myrow = $GLOBALS['xoopsDB']->fetchArray($result); } else { echo "NO FORUMS"; } @@ -231,7 +231,7 @@ $sform->addElement($lock_confirmation); $hot_confirmation = new XoopsFormSelect(_AM_NEWBB_PRUNE_HOT, 'hot', null, 1, false); - $hot_confirmation->addOptionArray(array( + $hot_confirmation->addOptionArray([ '0' => 0, '5' => 5, '10' => 10, @@ -239,7 +239,7 @@ '20' => 20, '25' => 25, '30' => 30 - )); + ]); $sform->addElement($hot_confirmation); $sform->addElement(/*$radiobox*/ diff --git a/admin/admin_forum_reorder.php b/admin/admin_forum_reorder.php index 02a9a34e..7c6c06b6 100644 --- a/admin/admin_forum_reorder.php +++ b/admin/admin_forum_reorder.php @@ -53,10 +53,10 @@ redirect_header('admin_forum_reorder.php', 1, _AM_NEWBB_BOARDREORDER); } else { include_once $GLOBALS['xoops']->path('modules/' . $xoopsModule->getVar('dirname') . '/class/xoopsformloader.php'); - $orders = array(); - $cat_orders = array(); - $forum = array(); - $cat = array(); + $orders = []; + $cat_orders = []; + $forum = []; + $cat = []; xoops_cp_header(); echo '
'; @@ -77,7 +77,7 @@ $categoryHandler = xoops_getModuleHandler('category', 'newbb'); $criteriaCategory = new CriteriaCompo(new criteria('1', 1)); $criteriaCategory->setSort('cat_order'); - $categories = $categoryHandler->getAll($criteriaCategory, array('cat_id', 'cat_order', 'cat_title')); + $categories = $categoryHandler->getAll($criteriaCategory, ['cat_id', 'cat_order', 'cat_title']); $forums = $forumHandler->getTree(array_keys($categories), 0, 'all', '    '); foreach (array_keys($categories) as $c) { echo ''; diff --git a/admin/admin_groupmod.php b/admin/admin_groupmod.php index a185ef13..1013d2fa 100644 --- a/admin/admin_groupmod.php +++ b/admin/admin_groupmod.php @@ -38,10 +38,10 @@ if (XoopsRequest::getString('submit', '', 'POST')) { $fgroups = XoopsRequest::getArray('group', '', 'POST');// !empty($_POST['group']) ? $_POST['group'] : ''; $fforum = XoopsRequest::getInt('forenid', 0, 'POST');// (int)($_POST['forenid']); - $fuser = array(); - if ($fforum !== 0) { - if ($fgroups !== '') { - $gg = array(); + $fuser = []; + if (0 !== $fforum) { + if ('' !== $fgroups) { + $gg = []; foreach ($fgroups as $k) { $gg = $memberHandler->getUsersByGroup($k, false); foreach ($gg as $f) { @@ -51,7 +51,7 @@ } } } - if ($fforum == -1) { // alle Foren + if (-1 == $fforum) { // alle Foren $sql = 'UPDATE ' . $GLOBALS['xoopsDB']->prefix('bb_forums') . " SET forum_moderator='" . serialize($fuser) . "'"; } else { $sql = 'UPDATE ' . $GLOBALS['xoopsDB']->prefix('bb_forums') . " SET forum_moderator='" . serialize($fuser) . "' WHERE forum_id =" . $fforum; @@ -72,7 +72,7 @@ $categoryHandler = xoops_getModuleHandler('category', 'newbb'); $criteriaCategory = new CriteriaCompo(new criteria('1', 1)); $criteriaCategory->setSort('cat_order'); -$categories = $categoryHandler->getAll($criteriaCategory, array('cat_id', 'cat_order', 'cat_title')); +$categories = $categoryHandler->getAll($criteriaCategory, ['cat_id', 'cat_order', 'cat_title']); $forums = $forumHandler->getTree(array_keys($categories), 0, 'all', '    '); echo '
\n"; } else { - $tree .= $prefix . $option['name'] . "getName() . '[groups][' . $this->_groupId . '][' . $option['id'] . "]\" />
\n"; + $tree .= $prefix . $option['name'] . '
\n"; } if (isset($option['children'])) { foreach ($option['children'] as $child) { @@ -232,29 +232,29 @@ public function _renderOptionTree(&$tree, $option, $prefix, $parentIds = array() $opform = new XoopsSimpleForm(_AM_NEWBB_PERM_ACTION, 'actionform', 'admin_permissions.php', 'get'); $op_select = new XoopsFormSelect('', 'action'); $op_select->setExtra('onchange="document.forms.actionform.submit()"'); - $op_select->addOptionArray(array( + $op_select->addOptionArray([ 'no' => _SELECT, 'template' => _AM_NEWBB_PERM_TEMPLATE, 'apply' => _AM_NEWBB_PERM_TEMPLATEAPP, 'default' => _AM_NEWBB_PERM_SETBYGROUP - )); + ]); $opform->addElement($op_select); $opform->display(); $memberHandler = xoops_getHandler('member'); $glist = $memberHandler->getGroupList(); - $elements = array(); + $elements = []; $perm_template = $newbbpermHandler->getTemplate(); foreach (array_keys($glist) as $i) { - $selected = !empty($perm_template[$i]) ? array_keys($perm_template[$i]) : array(); + $selected = !empty($perm_template[$i]) ? array_keys($perm_template[$i]) : []; $ret_ele = '' . $glist[$i] . ''; $ret_ele .= ''; $ret_ele .= '
'; $ii = 0; - $option_ids = array(); + $option_ids = []; foreach ($perms as $perm) { ++$ii; - if ($ii % 5 == 0) { + if (0 == $ii % 5) { $ret_ele .= ''; } $checked = in_array('forum_' . $perm, $selected) ? ' checked' : ''; @@ -315,7 +315,7 @@ public function _renderOptionTree(&$tree, $option, $prefix, $parentIds = array() case 'apply': $perm_template = $newbbpermHandler->getTemplate(); - if ($perm_template === null) { + if (null === $perm_template) { redirect_header('admin_permissions.php?action=template', 2, _AM_NEWBB_PERM_TEMPLATE); } xoops_cp_header(); @@ -324,11 +324,11 @@ public function _renderOptionTree(&$tree, $option, $prefix, $parentIds = array() $opform = new XoopsSimpleForm(_AM_NEWBB_PERM_ACTION, 'actionform', 'admin_permissions.php', 'get'); $op_select = new XoopsFormSelect('', 'action'); $op_select->setExtra('onchange="document.forms.actionform.submit()"'); - $op_select->addOptionArray(array( + $op_select->addOptionArray([ 'no' => _SELECT, 'template' => _AM_NEWBB_PERM_TEMPLATE, 'apply' => _AM_NEWBB_PERM_TEMPLATEAPP - )); + ]); $opform->addElement($op_select); $opform->display(); @@ -399,32 +399,32 @@ public function _renderOptionTree(&$tree, $option, $prefix, $parentIds = array() $opform = new XoopsSimpleForm(_AM_NEWBB_PERM_ACTION, 'actionform', 'admin_permissions.php', 'get'); $op_select = new XoopsFormSelect('', 'action'); $op_select->setExtra('onchange="document.forms.actionform.submit()"'); - $op_select->addOptionArray(array( + $op_select->addOptionArray([ 'no' => _SELECT, 'template' => _AM_NEWBB_PERM_TEMPLATE, 'apply' => _AM_NEWBB_PERM_TEMPLATEAPP, 'default' => _AM_NEWBB_PERM_SETBYGROUP - )); + ]); $opform->addElement($op_select); $opform->display(); - $op_options = array('category' => _AM_NEWBB_CAT_ACCESS); - $fm_options = array( - 'category' => array( + $op_options = ['category' => _AM_NEWBB_CAT_ACCESS]; + $fm_options = [ + 'category' => [ 'title' => _AM_NEWBB_CAT_ACCESS, 'item' => 'category_access', 'desc' => '', 'anonymous' => true - ) - ); + ] + ]; foreach ($perms as $perm) { $op_options[$perm] = constant('_AM_NEWBB_CAN_' . strtoupper($perm)); - $fm_options[$perm] = array( + $fm_options[$perm] = [ 'title' => constant('_AM_NEWBB_CAN_' . strtoupper($perm)), 'item' => 'forum_' . $perm, 'desc' => '', 'anonymous' => true - ); + ]; } $op_keys = array_keys($op_options); @@ -451,7 +451,7 @@ public function _renderOptionTree(&$tree, $option, $prefix, $parentIds = array() $criteriaCategory = new CriteriaCompo(new criteria('1', 1)); $criteriaCategory->setSort('cat_order'); $categories = $categoryHandler->getList($criteriaCategory); - if ($op === 'category') { + if ('category' === $op) { foreach (array_keys($categories) as $key) { $form->addItem($key, $categories[$key]); } diff --git a/admin/admin_report.php b/admin/admin_report.php index 176eeeeb..ba393d15 100644 --- a/admin/admin_report.php +++ b/admin/admin_report.php @@ -47,7 +47,7 @@ if (0 === count($report_ids)) { redirect_header("admin_report.php?item={$item}" . (empty($start) ? '' : "&start={$start}"), 1, _AM_NEWBB_REPORTNOTSELECT); } - $report_memos = XoopsRequest::getArray('report_memo', array(), 'POST'); // isset($_POST['report_memo']) ? $_POST['report_memo'] : array(); + $report_memos = XoopsRequest::getArray('report_memo', [], 'POST'); // isset($_POST['report_memo']) ? $_POST['report_memo'] : array(); foreach ($report_ids as $rid => $value) { if (!$value) { continue; @@ -63,7 +63,7 @@ break; case 'delete': - $report_ids = XoopsRequest::getArray('report_id', array(), 'POST');// $_POST['report_id']; + $report_ids = XoopsRequest::getArray('report_id', [], 'POST');// $_POST['report_id']; // irmtfan add error redirect header if (0 === count($report_ids)) { redirect_header("admin_report.php?item={$item}" . (empty($start) ? '' : "&start={$start}"), 1, _AM_NEWBB_REPORTNOTSELECT); @@ -86,7 +86,7 @@ include_once $GLOBALS['xoops']->path('modules/' . $xoopsModule->getVar('dirname', 'n') . '/class/xoopsformloader.php'); mod_loadFunctions('user', 'newbb'); - if ($item !== 'processed') { + if ('processed' !== $item) { $process_result = 0; $item_other = 'processed'; $title_other = _AM_NEWBB_PROCESSEDREPORT; @@ -118,7 +118,7 @@ $reports = $reportHandler->getAllReports(0, 'ASC', $limit, $start, $process_result); foreach ($reports as $report) { - $post_link = "getVar('dirname') @@ -128,11 +128,11 @@ . $report['topic_id'] . '&forum=' . $report['forum_id'] - . "&viewmode=thread\" target=\"checkreport\">" + . '&viewmode=thread" target="checkreport">' . $myts->htmlSpecialChars($report['subject']) . ''; $checkbox = ''; - if ($item !== 'processed') { + if ('processed' !== $item) { $memo = ''; } else { $memo = $myts->htmlSpecialChars($report['report_memo']); @@ -146,7 +146,7 @@ echo ''; $uid = (int)$report['reporter_uid']; $reporter_name = newbb_getUnameFromId($uid, $GLOBALS['xoopsModuleConfig']['show_realname']); - $reporter = (!empty($uid)) ? "" . $reporter_name . '
' : ''; + $reporter = !empty($uid) ? "" . $reporter_name . '
' : ''; echo "'; echo ''; @@ -157,7 +157,7 @@ echo ""; } $buttons = ''; - if ($item !== 'processed') { + if ('processed' !== $item) { $submit = new XoopsFormButton('', 'submit', _SUBMIT, 'submit'); $buttons .= $submit->render() . ' '; } diff --git a/admin/admin_synchronization.php b/admin/admin_synchronization.php index 8c353c5b..a43c222a 100644 --- a/admin/admin_synchronization.php +++ b/admin/admin_synchronization.php @@ -36,7 +36,7 @@ } $criteria->setStart($start); $criteria->setLimit($limit); - $topicObjs = array(); + $topicObjs = []; $topicObjs = $topicHandler->getAll($criteria); foreach ($topicObjs as $tObj) { $topicHandler->synchronization($tObj); @@ -87,7 +87,7 @@ break; // START irmtfan add read sync case 'read': - $result = newbb_synchronization(array('readtopic', 'readforum')); + $result = newbb_synchronization(['readtopic', 'readforum']); if (!empty($result)) { redirect_header('admin_synchronization.php', 2, _AM_NEWBB_SYNC_TYPE_READ . '
' . _AM_NEWBB_DATABASEUPDATED); } diff --git a/admin/admin_type_manager.php b/admin/admin_type_manager.php index 79b5f47b..31d757fe 100644 --- a/admin/admin_type_manager.php +++ b/admin/admin_type_manager.php @@ -30,7 +30,7 @@ * */ $op = XoopsRequest::getCmd('op', XoopsRequest::getCmd('op', '', 'POST'), 'GET');// !empty($_GET['op'])? $_GET['op'] : ( !empty($_POST['op']) ? $_POST['op'] : "" ); -if (!in_array($op, array( +if (!in_array($op, [ 'save_type', 'delete', 'template', @@ -41,7 +41,7 @@ 'edit_forum', 'save_forum', 'add' -), true) +], true) ) { $op = ''; } @@ -52,7 +52,7 @@ case 'save_type': $type_names0 = $_POST['type_name']; $type_names = XoopsRequest::getArray('type_name', null, 'POST');// $_POST['type_name']; - $type_del = array(); + $type_del = []; foreach (array_keys($type_names) as $key) { if (XoopsRequest::getBool('isnew', '', 'POST')) { $type_obj = $typeHandler->create(); @@ -66,7 +66,7 @@ $type_del[] = $key; continue; } else { - foreach (array('type_name', 'type_color', 'type_description') as $var) { + foreach (['type_name', 'type_color', 'type_description'] as $var) { // if ($type_obj->getVar($var) != @$_POST[$var][$key]) { // $type_obj->setVar($var, @$_POST[$var][$key]); // } @@ -83,7 +83,7 @@ } if (count($type_del) > 0) { $type_list = $typeHandler->getList(new Criteria('type_id', '(' . implode(', ', $type_del) . ')', 'IN')); - xoops_confirm(array('op' => 'delete', 'type_del' => serialize($type_del)), xoops_getenv('PHP_SELF'), sprintf(_AM_NEWBB_TODEL_TYPE, implode(', ', array_values($type_list))), '', false); + xoops_confirm(['op' => 'delete', 'type_del' => serialize($type_del)], xoops_getenv('PHP_SELF'), sprintf(_AM_NEWBB_TODEL_TYPE, implode(', ', array_values($type_list))), '', false); } else { redirect_header(xoops_getenv('PHP_SELF'), 2, _MD_DBUPDATED); } @@ -103,7 +103,7 @@ case 'template': $types_obj = $typeHandler->getAll(); - if (count($types_obj) === 0) { + if (0 === count($types_obj)) { redirect_header(xoops_getenv('PHP_SELF'), 2, _AM_NEWBB_TYPE_ADD); } @@ -173,7 +173,7 @@ break; case 'save_template': - $templates = array_flip(array_filter(XoopsRequest::getArray('type_order', array(), 'POST'))); + $templates = array_flip(array_filter(XoopsRequest::getArray('type_order', [], 'POST'))); mod_createCacheFile($templates, 'type_template'); redirect_header(xoops_getenv('PHP_SELF') . '?op=template', 2, _MD_DBUPDATED); break; @@ -263,7 +263,7 @@ if (!$templates = mod_loadCacheFile('type_template')) { redirect_header(xoops_getenv('PHP_SELF') . '?op=template', 2, _AM_NEWBB_TYPE_TEMPLATE); } - foreach (XoopsRequest::getArray('forums', array(), 'POST') as $forum) { + foreach (XoopsRequest::getArray('forums', [], 'POST') as $forum) { if ($forum < 1) { continue; } @@ -339,7 +339,7 @@ } $types_obj = $typeHandler->getAll(); - if (count($types_obj) === 0) { + if (0 === count($types_obj)) { redirect_header(xoops_getenv('PHP_SELF'), 2, _AM_NEWBB_TYPE_ADD); } @@ -373,7 +373,7 @@ echo ''; $types = $typeHandler->getByForum(XoopsRequest::getInt('forum', 0, 'POST')); - $types_order = array(); + $types_order = []; foreach ($types as $key => $type) { $types_order[] = $type['type_order']; } @@ -422,14 +422,14 @@ case 'add': default: $types_obj = $typeHandler->getAll(); - if (count($types_obj) === 0) { + if (0 === count($types_obj)) { $op = 'add'; $title = _AM_NEWBB_TYPE_ADD; } else { $title = _AM_NEWBB_TYPE_LIST; } - if ($op !== 'add') { + if ('add' !== $op) { echo "
" . _AM_NEWBB_ACTION . ''; echo '
'; echo ""; echo "
' . _AM_NEWBB_REPORTTEXT . ': ' . $myts->htmlSpecialChars($report['report_text']) . '" . $reporter . long2ip($report['reporter_ip']) . '
"; echo ""; - if ($op !== 'add') { + if ('add' !== $op) { echo "'; } echo "'; @@ -465,7 +465,7 @@ $isColorpicker = require_once $GLOBALS['xoops']->path('class/xoopsform/formcolorpicker.php'); - if ($op !== 'add') { + if ('add' !== $op) { foreach ($types_obj as $key => $type_obj) { echo ""; echo ""; diff --git a/admin/admin_votedata.php b/admin/admin_votedata.php index 29cfc6b3..c9a55568 100644 --- a/admin/admin_votedata.php +++ b/admin/admin_votedata.php @@ -102,7 +102,7 @@ \n \n"; - if ($votes == 0) { + if (0 == $votes) { echo "'; } while (list($ratingid, $topic_id, $ratinguser, $rating, $ratinghostname, $ratingtimestamp) = $GLOBALS['xoopsDB']->fetchRow($results)) { diff --git a/admin/index.php b/admin/index.php index 5a59e4cf..0c30ced7 100644 --- a/admin/index.php +++ b/admin/index.php @@ -34,7 +34,7 @@ $attach_path = $GLOBALS['xoops']->path($GLOBALS['xoopsModuleConfig']['dir_attachments'] . '/'); $thumb_path = $attach_path . 'thumbs/'; -$folder = array($attach_path, $thumb_path); +$folder = [$attach_path, $thumb_path]; /** * @param $path @@ -86,9 +86,9 @@ function newbb_admin_chmod($target, $mode = 0777) */ function newbb_getImageLibs() { - $imageLibs = array(); + $imageLibs = []; unset($output, $status); - if ($GLOBALS['xoopsModuleConfig']['image_lib'] == 1 || $GLOBALS['xoopsModuleConfig']['image_lib'] == 0) { + if (1 == $GLOBALS['xoopsModuleConfig']['image_lib'] || 0 == $GLOBALS['xoopsModuleConfig']['image_lib']) { $path = empty($GLOBALS['xoopsModuleConfig']['path_magick']) ? '' : $GLOBALS['xoopsModuleConfig']['path_magick'] . '/'; @exec($path . 'convert -version', $output, $status); if (empty($status) && !empty($output) && preg_match("/imagemagick[ \t]+([0-9\.]+)/i", $output[0], $matches)) { @@ -97,7 +97,7 @@ function newbb_getImageLibs() unset($output, $status); } - if ($GLOBALS['xoopsModuleConfig']['image_lib'] == 2 || $GLOBALS['xoopsModuleConfig']['image_lib'] == 0) { + if (2 == $GLOBALS['xoopsModuleConfig']['image_lib'] || 0 == $GLOBALS['xoopsModuleConfig']['image_lib']) { $path = empty($GLOBALS['xoopsModuleConfig']['path_netpbm']) ? '' : $GLOBALS['xoopsModuleConfig']['path_netpbm'] . '/'; @exec($path . 'jpegtopnm -version 2>&1', $output, $status); if (empty($status) && !empty($output) && preg_match("/netpbm[ \t]+([0-9\.]+)/i", $output[0], $matches)) { @@ -191,9 +191,9 @@ function newbb_getImageLibs() // START irmtfan better poll module display link and version - check if xoops poll module is available if ($isOK) { $pollLink = _AM_NEWBB_AVAILABLE . ': '; - $pollLink .= "getVar('dirname') . "/admin/index.php\""; - $pollLink .= " alt=\"" . $xoopspoll->getVar('name') . ' ' . _VERSION . ' (' . $xoopspoll->getInfo('version') . ") \""; - $pollLink .= " title=\"" . $xoopspoll->getVar('name') . ' ' . _VERSION . ' (' . $xoopspoll->getInfo('version') . ") \""; + $pollLink .= 'getVar('name') . ' ' . _VERSION . ' (' . $xoopspoll->getInfo('version') . ') "'; + $pollLink .= ' title="' . $xoopspoll->getVar('name') . ' ' . _VERSION . ' (' . $xoopspoll->getInfo('version') . ') "'; $pollLink .= '>' . '(' . $xoopspoll->getVar('name') . ')'; } else { $pollLink = _AM_NEWBB_NOTAVAILABLE; @@ -252,7 +252,7 @@ function newbb_getImageLibs() */ function returnBytes($sizeAsString, $b = false) { - if ($b === false) { + if (false === $b) { switch (substr($sizeAsString, -1)) { case 'M': case 'm': @@ -268,7 +268,7 @@ function returnBytes($sizeAsString, $b = false) } } else { $base = log($sizeAsString) / log(1024); - $suffix = array('', 'KB', 'MB', 'GB', 'TB'); + $suffix = ['', 'KB', 'MB', 'GB', 'TB']; return round(pow(1024, $base - floor($base))) . ' ' . $suffix[(int)floor($base)]; } diff --git a/admin/menu.php b/admin/menu.php index 4771d6b7..67bf386f 100644 --- a/admin/menu.php +++ b/admin/menu.php @@ -44,80 +44,80 @@ // 'icon' => $pathIcon32 . '/home.png' //); -$adminmenu[] = array( +$adminmenu[] = [ 'title' => _MI_NEWBB_ADMENU_INDEX, 'link' => 'admin/index.php', 'icon' => $pathIcon32 . '/home.png' -); +]; -$adminmenu[] = array( +$adminmenu[] = [ 'title' => _MI_NEWBB_ADMENU_CATEGORY, 'link' => 'admin/admin_cat_manager.php', 'icon' => $pathIcon32 . '/category.png' -); +]; -$adminmenu[] = array( +$adminmenu[] = [ 'title' => _MI_NEWBB_ADMENU_FORUM, 'link' => 'admin/admin_forum_manager.php', 'icon' => $pathIcon32 . '/forums.png' -); +]; -$adminmenu[] = array( +$adminmenu[] = [ 'title' => _MI_NEWBB_ADMENU_PERMISSION, 'link' => 'admin/admin_permissions.php', 'icon' => $pathIcon32 . '/permissions.png' -); +]; -$adminmenu[] = array( +$adminmenu[] = [ 'title' => _MI_NEWBB_ADMENU_ORDER, 'link' => 'admin/admin_forum_reorder.php', 'icon' => $pathIcon32 . '/compfile.png' -); +]; -$adminmenu[] = array( +$adminmenu[] = [ 'title' => _MI_NEWBB_ADMENU_PRUNE, 'link' => 'admin/admin_forum_prune.php', 'icon' => $pathIcon32 . '/update.png' -); +]; -$adminmenu[] = array( +$adminmenu[] = [ 'title' => _MI_NEWBB_ADMENU_REPORT, 'link' => 'admin/admin_report.php', 'icon' => $pathIcon32 . '/content.png' -); +]; -$adminmenu[] = array( +$adminmenu[] = [ 'title' => _MI_NEWBB_ADMENU_DIGEST, 'link' => 'admin/admin_digest.php', 'icon' => $pathIcon32 . '/digest.png' -); +]; -$adminmenu[] = array( +$adminmenu[] = [ 'title' => _MI_NEWBB_ADMENU_VOTE, 'link' => 'admin/admin_votedata.php', 'icon' => $pathIcon32 . '/button_ok.png' -); +]; -$adminmenu[] = array( +$adminmenu[] = [ 'title' => _MI_NEWBB_ADMENU_TYPE, 'link' => 'admin/admin_type_manager.php', 'icon' => $pathIcon32 . '/type.png' -); +]; -$adminmenu[] = array( +$adminmenu[] = [ 'title' => _MI_NEWBB_ADMENU_GROUPMOD, 'link' => 'admin/admin_groupmod.php', 'icon' => $pathIcon32 . '/groupmod.png' -); +]; -$adminmenu[] = array( +$adminmenu[] = [ 'title' => _MI_NEWBB_ADMENU_SYNC, 'link' => 'admin/admin_synchronization.php', 'icon' => $pathIcon32 . '/synchronized.png' -); +]; -$adminmenu[] = array( +$adminmenu[] = [ 'title' => _MI_NEWBB_ADMENU_ABOUT, 'link' => 'admin/about.php', 'icon' => $pathIcon32 . '/about.png' -); +]; diff --git a/blocks/list_topic.php b/blocks/list_topic.php index bed0d883..6b6e1121 100644 --- a/blocks/list_topic.php +++ b/blocks/list_topic.php @@ -68,7 +68,7 @@ function newbb_list_topic_show($options) // set and parse values: // forum: parse positive values to forum IDs and negative values to category IDs. value=0 => all valid forums - $topicRenderer->setVars(array( + $topicRenderer->setVars([ 'status' => $optionsStatus, 'uid' => $options[1], 'lastposter' => $options[2], @@ -77,8 +77,8 @@ function newbb_list_topic_show($options) 'order' => $options[5], 'since' => $options[7], 'forum' => $optionsForum - )); - $block = array(); + ]); + $block = []; // headers to display in block $block['headers'] = $topicRenderer->getHeader($options[8]); @@ -116,7 +116,7 @@ function newbb_list_topic_edit($options) // topic_poster element $topicPosterRadioEle = new XoopsFormRadio(_MB_NEWBB_AUTHOR, 'options[1]', $options[1]); $topicPosterRadioEle->addOption(-1, _MD_TOTALUSER); - $topicPosterRadioEle->addOption(($options[1] !== -1) ? $options[1] : 0, _SELECT); // if no user in selection box it select uid=0 anon users + $topicPosterRadioEle->addOption((-1 !== $options[1]) ? $options[1] : 0, _SELECT); // if no user in selection box it select uid=0 anon users $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" $topicPosterSelectEle = new XoopsFormSelectUser(_MB_NEWBB_AUTHOR, 'options[1]', true, explode(',', $options[1]), 5, true);// show $limit = 200 users when no user is selected; $topicPosterEle = new XoopsFormLabel(_MB_NEWBB_AUTHOR, $topicPosterRadioEle->render() . $topicPosterSelectEle->render()); @@ -124,7 +124,7 @@ function newbb_list_topic_edit($options) // lastposter element $lastPosterRadioEle = new XoopsFormRadio(_MD_POSTER, 'options[2]', $options[2]); $lastPosterRadioEle->addOption(-1, _MD_TOTALUSER); - $lastPosterRadioEle->addOption(($options[2] !== -1) ? $options[2] : 0, _SELECT); // if no user in selection box it select uid=1 + $lastPosterRadioEle->addOption((-1 !== $options[2]) ? $options[2] : 0, _SELECT); // if no user in selection box it select uid=1 $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" $lastPosterSelectEle = new XoopsFormSelectUser(_MD_POSTER, 'options[2]', true, explode(',', $options[2]), 5, true);// show $limit = 200 users when no user is selected; $lastPosterEle = new XoopsFormLabel(_MD_POSTER, $lastPosterRadioEle->render() . $lastPosterSelectEle->render()); @@ -182,9 +182,9 @@ function newbb_list_topic_edit($options) //get forum Ids by values. parse positive values to forum IDs and negative values to category IDs. value=0 => all valid forums // Get accessible forums $accessForums = $forumHandler->getIdsByValues(array_map('intval', $optionsForum)); - $isAll = (count($optionsForum) === 0 || empty($optionsForum[0])); + $isAll = (0 === count($optionsForum) || empty($optionsForum[0])); $forumSel = ""; $form .= " - <{foreachq item=topic from=$block.topics}> + <{foreach item=topic from=$block.topics}> "> @@ -25,7 +25,7 @@ - <{foreachq item=topic from=$block.topics}> + <{foreach item=topic from=$block.topics}> "> @@ -37,7 +37,7 @@ <{elseif $block.disp_mode == 2}> - <{foreachq item=topic from=$block.topics}> + <{foreach item=topic from=$block.topics}> "> diff --git a/templates/blocks/newbb_block_author.tpl b/templates/blocks/newbb_block_author.tpl index e3b8d10a..06e27d1e 100644 --- a/templates/blocks/newbb_block_author.tpl +++ b/templates/blocks/newbb_block_author.tpl @@ -5,7 +5,7 @@ - <{foreachq item=author key=uid from=$block.authors}> + <{foreach item=author key=uid from=$block.authors}> "> @@ -14,7 +14,7 @@ <{elseif $block.disp_mode == 1}> - <{foreachq item=author key=uid from=$block.authors}> + <{foreach item=author key=uid from=$block.authors}> "> diff --git a/templates/blocks/newbb_block_list_topic.tpl b/templates/blocks/newbb_block_list_topic.tpl index 77b099c4..a73bc305 100644 --- a/templates/blocks/newbb_block_list_topic.tpl +++ b/templates/blocks/newbb_block_list_topic.tpl @@ -40,7 +40,7 @@
- <{foreachq name=loop item=topic from=$block.topics}> + <{foreach name=loop item=topic from=$block.topics}>
border">
<{if $block.headers.approve}> diff --git a/templates/blocks/newbb_block_post.tpl b/templates/blocks/newbb_block_post.tpl index ae40de16..98b7544e 100644 --- a/templates/blocks/newbb_block_post.tpl +++ b/templates/blocks/newbb_block_post.tpl @@ -5,7 +5,7 @@
- <{foreachq item=topic from=$block.topics}> + <{foreach item=topic from=$block.topics}> "> @@ -20,7 +20,7 @@ - <{foreachq item=topic from=$block.topics}> + <{foreach item=topic from=$block.topics}> "> @@ -31,7 +31,7 @@ <{elseif $block.disp_mode == 2}> - <{foreachq item=topic from=$block.topics}> + <{foreach item=topic from=$block.topics}> "> @@ -41,7 +41,7 @@ <{else}> - <{foreachq item=topic from=$block.topics}> + <{foreach item=topic from=$block.topics}> "> @@ -25,7 +25,7 @@ - <{foreachq item=topic from=$block.topics}> + <{foreach item=topic from=$block.topics}> "> @@ -36,7 +36,7 @@ <{elseif $block.disp_mode == 2}> - <{foreachq item=topic from=$block.topics}> + <{foreach item=topic from=$block.topics}> "> diff --git a/templates/newbb_edit_post.tpl b/templates/newbb_edit_post.tpl index a0382468..71e641b5 100644 --- a/templates/newbb_edit_post.tpl +++ b/templates/newbb_edit_post.tpl @@ -7,7 +7,7 @@ »<{$category.title}> <{if $parentforum}> - <{foreachq item=forum from=$parentforum}> + <{foreach item=forum from=$parentforum}> »   <{$forum.forum_name}> @@ -52,7 +52,7 @@ >
" . _DELETE . '" . _AM_NEWBB_TYPE_NAME . '
" . _AM_NEWBB_VOTE_DATE . "" . _AM_NEWBB_ACTION . "
" . _AM_NEWBB_VOTE_NOVOTES . '
<{$smarty.const._MB_NEWBB_VIEWS}> <{$smarty.const._MB_NEWBB_LPOST}>
<{$topic.forum_name}><{$smarty.const._MB_NEWBB_RPLS}> <{$smarty.const._MB_NEWBB_LPOST}>
<{$topic.title}>
<{$topic.title}><{$smarty.const._MB_NEWBB_AUTHOR}> <{$smarty.const._MB_NEWBB_COUNT}>
<{$author.name}> <{$author.count}>
<{$author.name}> <{$author.count}>
<{$smarty.const._MB_NEWBB_TITLE}> <{$smarty.const._MB_NEWBB_AUTHOR}>
<{$topic.forum_name}><{$smarty.const._MB_NEWBB_TOPIC}> <{$smarty.const._MB_NEWBB_AUTHOR}>
<{$topic.title}>
<{$topic.title}>
- <{foreachq item=topic from=$block.topics}> + <{foreach item=topic from=$block.topics}>
<{$topic.forum_name}> | diff --git a/templates/blocks/newbb_block_text.tpl b/templates/blocks/newbb_block_text.tpl index 0e108933..fbaf1fd3 100644 --- a/templates/blocks/newbb_block_text.tpl +++ b/templates/blocks/newbb_block_text.tpl @@ -1,4 +1,4 @@ -<{foreachq item=topic from=$block.topics}> +<{foreach item=topic from=$block.topics}> diff --git a/templates/blocks/newbb_block_topic.tpl b/templates/blocks/newbb_block_topic.tpl index 87df3f64..a666d53a 100644 --- a/templates/blocks/newbb_block_topic.tpl +++ b/templates/blocks/newbb_block_topic.tpl @@ -8,7 +8,7 @@
<{$smarty.const._MB_NEWBB_VIEWS}> <{$smarty.const._MB_NEWBB_AUTHOR}>
<{$topic.forum_name}><{$smarty.const._MB_NEWBB_TOPIC}> <{$smarty.const._MB_NEWBB_AUTHOR}>
<{$topic.title}>
<{$topic.title}>
- <{foreachq item=element from=$form_post.elements}> + <{foreach item=element from=$form_post.elements}> <{if $element.hidden != true}>
@@ -68,7 +68,7 @@ <{/if}> <{/foreach}>
- <{foreachq item=element from=$form_post.elements}> + <{foreach item=element from=$form_post.elements}> <{if $element.hidden == true}> <{$element.body}> <{/if}> @@ -80,7 +80,7 @@ <{if $posts_context}> - <{foreachq item=post from=$posts_context}> + <{foreach item=post from=$posts_context}> diff --git a/templates/newbb_index.tpl b/templates/newbb_index.tpl index 2a2ef9d8..852065f9 100644 --- a/templates/newbb_index.tpl +++ b/templates/newbb_index.tpl @@ -56,7 +56,7 @@
- <{foreachq item=category from=$categories}> + <{foreach item=category from=$categories}>
<{$post.subject}>
- <{foreachq item=subforum from=$forum.subforum}> + <{foreach item=subforum from=$forum.subforum}> @@ -223,7 +223,7 @@ <{elseif $subforum_display == "collapse"}> - <{foreachq item=forum from=$category.forums}> + <{foreach item=forum from=$category.forums}> <{if $forum.subforum}> @@ -285,7 +285,7 @@ - <{foreachq item=option from=$poll.options}> + <{foreach item=option from=$poll.options}> <{*-- irmtfan hardcode removed align="left" --*}> diff --git a/templates/newbb_poll_view.tpl b/templates/newbb_poll_view.tpl index db2759de..1f7cb8ea 100644 --- a/templates/newbb_poll_view.tpl +++ b/templates/newbb_poll_view.tpl @@ -9,7 +9,7 @@ - <{foreachq item=option from=$poll.options}> + <{foreach item=option from=$poll.options}> <{*-- irmtfan hardcode removed align="left" --*}> diff --git a/templates/newbb_rss.tpl b/templates/newbb_rss.tpl index f563f75d..966db046 100644 --- a/templates/newbb_rss.tpl +++ b/templates/newbb_rss.tpl @@ -20,7 +20,7 @@ <{$rss.image_height}> <{/if}> - <{foreachq item=item from=$rss.items}> + <{foreach item=item from=$rss.items}> <{$item.title}> <{$item.link}> diff --git a/templates/newbb_thread.tpl b/templates/newbb_thread.tpl index 19719a65..5c412fd1 100644 --- a/templates/newbb_thread.tpl +++ b/templates/newbb_thread.tpl @@ -72,7 +72,7 @@ <{/if}> <{if $topic_post.poster.groups}>
<{$smarty.const._MD_GROUP}> - <{foreachq item=group from=$topic_post.poster.groups}>
<{$group}><{/foreach}> + <{foreach item=group from=$topic_post.poster.groups}>
<{$group}><{/foreach}>
<{/if}>
@@ -158,7 +158,7 @@
- <{foreachq name=loop item=topic from=$topics}> + <{foreach name=loop item=topic from=$topics}> "> @@ -293,7 +293,7 @@
- <{foreachq item=perm from=$permission_table}> + <{foreach item=perm from=$permission_table}>
<{$perm}>
<{/foreach}>
diff --git a/templates/newbb_viewforum_menu.tpl b/templates/newbb_viewforum_menu.tpl index ce90709d..939e2548 100644 --- a/templates/newbb_viewforum_menu.tpl +++ b/templates/newbb_viewforum_menu.tpl @@ -21,7 +21,7 @@ onchange="if(this.options[this.selectedIndex].value.length >0 ) { window.location=this.options[this.selectedIndex].value;}" > - <{foreachq item=opt from=$typeOptions}> + <{foreach item=opt from=$typeOptions}> <{/foreach}> diff --git a/templates/newbb_viewforum_subforum.tpl b/templates/newbb_viewforum_subforum.tpl index 3b5bcd78..39202750 100644 --- a/templates/newbb_viewforum_subforum.tpl +++ b/templates/newbb_viewforum_subforum.tpl @@ -7,7 +7,7 @@
- <{foreachq item=sforum from=$subforum}> + <{foreach item=sforum from=$subforum}> "; echo "'; - if ($mode === 'move') { + if ('move' === $mode) { echo ''; } - if ($mode === 'merge') { + if ('merge' === $mode) { echo ''; diff --git a/update_type.php b/update_type.php index ac262fca..5966e000 100644 --- a/update_type.php +++ b/update_type.php @@ -58,7 +58,7 @@ $typeHandler = xoops_getModuleHandler('type', 'newbb'); $subjectpres = array_filter(array_map('trim', explode(',', $GLOBALS['xoopsModuleConfig']['subject_prefix']))); -$types = array(); +$types = []; $order = 1; foreach ($subjectpres as $subjectpre) { if (preg_match("/<[^#]*color=[\"'](#[^'\"\s]*)[^>]>[\[]?([^<\]]*)[\]]?/is", $subjectpre, $matches)) { @@ -84,13 +84,13 @@ $forumHandler = xoops_getModuleHandler('forum', 'newbb'); if ($forums_type = $forumHandler->getIds(new Criteria('allow_subject_prefix', 1))) { foreach ($forums_type as $forum_id) { - $type_query = array(); + $type_query = []; foreach ($types as $key => $order) { $type_query[] = "({$key}, {$forum_id}, {$order})"; } $sql = 'INSERT INTO ' . $GLOBALS['xoopsDB']->prefix('bb_type_forum_tmp') . ' (type_id, forum_id, type_order) ' . ' VALUES ' . implode(', ', $type_query); - if (($result = $GLOBALS['xoopsDB']->queryF($sql)) === false) { + if (false === ($result = $GLOBALS['xoopsDB']->queryF($sql))) { xoops_error($GLOBALS['xoopsDB']->error()); } } diff --git a/viewforum.php b/viewforum.php index 8a5c1def..561d9d14 100644 --- a/viewforum.php +++ b/viewforum.php @@ -19,8 +19,8 @@ /* * Build the page query */ -$query_vars = array('forum', 'type', 'status', 'sort', 'order', 'start', 'since'); -$query_array = array(); +$query_vars = ['forum', 'type', 'status', 'sort', 'order', 'start', 'since']; +$query_array = []; foreach ($query_vars as $var) { if (XoopsRequest::getString($var, '', 'GET')) { $query_array[$var] = "{$var}=" . XoopsRequest::getString($var, '', 'GET'); @@ -44,23 +44,23 @@ $forum_id = XoopsRequest::getInt('forum', 0, 'GET'); $type = XoopsRequest::getInt('type', 0, 'GET'); $status = (XoopsRequest::getString('status', '', 'GET') - && in_array(XoopsRequest::getString('status', '', 'GET'), array( + && in_array(XoopsRequest::getString('status', '', 'GET'), [ 'active', 'pending', 'deleted', 'digest', 'unreplied', 'unread' - ), true)) ? XoopsRequest::getString('status', '', + ], true)) ? XoopsRequest::getString('status', '', 'GET') : ''; // (!empty($_GET['status']) && in_array($_GET['status'], array("active", "pending", "deleted", "digest", "unreplied", "unread"))) ? $_GET['status'] : ''; // irmtfan add mode $mode = (XoopsRequest::getString('status', '', 'GET') - && in_array(XoopsRequest::getString('status', '', 'GET'), array( + && in_array(XoopsRequest::getString('status', '', 'GET'), [ 'active', 'pending', 'deleted' - ), true)) ? 2 : XoopsRequest::getInt('mode', 0, 'GET'); // (!empty($status) && in_array($status, array("active", "pending", "deleted"))) ? 2 : (!empty($_GET['mode']) ? (int)($_GET['mode']) : 0); + ], true)) ? 2 : XoopsRequest::getInt('mode', 0, 'GET'); // (!empty($status) && in_array($status, array("active", "pending", "deleted"))) ? 2 : (!empty($_GET['mode']) ? (int)($_GET['mode']) : 0); $forumHandler = xoops_getModuleHandler('forum', 'newbb'); $forum_obj = $forumHandler->get($forum_id); @@ -108,7 +108,7 @@ $xoopsTpl->assign('viewer_level', $isadmin ? 2 : is_object($GLOBALS['xoopsUser'])); /* Only admin has access to admin mode */ if (!$isadmin) { - $status = (!empty($status) && in_array($status, array('active', 'pending', 'deleted'), true)) ? '' : $status; + $status = (!empty($status) && in_array($status, ['active', 'pending', 'deleted'], true)) ? '' : $status; // irmtfan add mode $mode = 0; } @@ -116,7 +116,7 @@ $xoopsTpl->assign('mode', $mode); $xoopsTpl->assign('status', $status); if ($isadmin) { - $xoopsTpl->assign('forum_index_cpanel', array('link' => 'admin/index.php', 'name' => _MD_ADMINCP)); + $xoopsTpl->assign('forum_index_cpanel', ['link' => 'admin/index.php', 'name' => _MD_ADMINCP]); } if ($GLOBALS['xoopsModuleConfig']['wol_enabled']) { @@ -128,10 +128,10 @@ if ($forumHandler->getPermission($forum_obj, 'post')) { // irmtfan full URL $xoopsTpl->assign('forum_post_or_register', - "getVar('dirname') . "/newtopic.php?forum={$forum_id}\">" . newbbDisplayImage('t_new', _MD_POSTNEW) . ''); + '" . newbbDisplayImage('t_new', _MD_POSTNEW) . ''); if ($pollmodules && $forumHandler->getPermission($forum_obj, 'addpoll')) { $t_poll = newbbDisplayImage('t_poll', _MD_ADDPOLL); - $xoopsTpl->assign('forum_addpoll', "getVar('dirname') . "/polls.php?op=add&forum={$forum_id}\">{$t_poll}"); + $xoopsTpl->assign('forum_addpoll', '{$t_poll}"); } } else { if (!is_object($GLOBALS['xoopsUser']) && !empty($GLOBALS['xoopsModuleConfig']['show_reg'])) { @@ -158,15 +158,15 @@ } $categoryHandler = xoops_getModuleHandler('category'); -$category_obj = $categoryHandler->get($forum_obj->getVar('cat_id'), array('cat_title')); -$xoopsTpl->assign('category', array('id' => $forum_obj->getVar('cat_id'), 'title' => $category_obj->getVar('cat_title'))); +$category_obj = $categoryHandler->get($forum_obj->getVar('cat_id'), ['cat_title']); +$xoopsTpl->assign('category', ['id' => $forum_obj->getVar('cat_id'), 'title' => $category_obj->getVar('cat_title')]); $xoopsTpl->assign('forum_index_title', sprintf(_MD_FORUMINDEX, htmlspecialchars($GLOBALS['xoopsConfig']['sitename'], ENT_QUOTES))); $xoopsTpl->assign('forum_name', $forum_obj->getVar('forum_name')); $xoopsTpl->assign('forum_moderators', $forum_obj->dispForumModerators()); // irmtfan - add and edit: u.uname => t.topic_poster | t.topic_time => t.topic_id | "t.rating"=>_MD_RATINGS, | p.post_time => t.topic_last_post_id -$sel_sort_array = array( +$sel_sort_array = [ 't.topic_title' => _MD_TOPICTITLE, 't.topic_poster' => _MD_TOPICPOSTER, 't.topic_id' => _MD_TOPICTIME, @@ -174,7 +174,7 @@ 't.topic_views' => _MD_VIEWS, 't.rating' => _MD_RATINGS, 't.topic_last_post_id' => _MD_LASTPOSTTIME -); +]; if (!XoopsRequest::getString('sort', '', 'GET') || !array_key_exists(XoopsRequest::getString('sort', '', 'GET'), $sel_sort_array) ) { @@ -192,10 +192,10 @@ $xoopsTpl->assign_by_ref('forum_selection_sort', $forum_selection_sort); $order = (!XoopsRequest::getString('order', '', 'GET') - || XoopsRequest::getString('order', '', 'GET') !== 'ASC') ? 'DESC' : 'ASC'; + || 'ASC' !== XoopsRequest::getString('order', '', 'GET')) ? 'DESC' : 'ASC'; $forum_selection_order = ''; $xoopsTpl->assign_by_ref('forum_selection_order', $forum_selection_order); @@ -211,20 +211,20 @@ unset($query_sort); // irmtfan - edit: u.uname => t.topic_poster | t.topic_time => t.topic_id | p.post_time => t.topic_last_post_id $xoopsTpl->assign('h_topic_link', - XOOPS_URL . "/modules/newbb/viewforum.php?{$page_query_sort}&sort=t.topic_title&order=" . (($sort === 't.topic_title' && $order === 'DESC') ? 'ASC' : 'DESC')); + XOOPS_URL . "/modules/newbb/viewforum.php?{$page_query_sort}&sort=t.topic_title&order=" . (('t.topic_title' === $sort && 'DESC' === $order) ? 'ASC' : 'DESC')); $xoopsTpl->assign('h_reply_link', - XOOPS_URL . "/modules/newbb/viewforum.php?{$page_query_sort}&sort=t.topic_replies&order=" . (($sort === 't.topic_replies' && $order === 'DESC') ? 'ASC' : 'DESC')); + XOOPS_URL . "/modules/newbb/viewforum.php?{$page_query_sort}&sort=t.topic_replies&order=" . (('t.topic_replies' === $sort && 'DESC' === $order) ? 'ASC' : 'DESC')); $xoopsTpl->assign('h_poster_link', - XOOPS_URL . "/modules/newbb/viewforum.php?{$page_query_sort}&sort=t.topic_poster&order=" . (($sort === 't.topic_poster' && $order === 'DESC') ? 'ASC' : 'DESC')); + XOOPS_URL . "/modules/newbb/viewforum.php?{$page_query_sort}&sort=t.topic_poster&order=" . (('t.topic_poster' === $sort && 'DESC' === $order) ? 'ASC' : 'DESC')); $xoopsTpl->assign('h_views_link', - XOOPS_URL . "/modules/newbb/viewforum.php?{$page_query_sort}&sort=t.topic_views&order=" . (($sort === 't.topic_views' && $order === 'DESC') ? 'ASC' : 'DESC')); -$xoopsTpl->assign('h_rating_link', XOOPS_URL . "/modules/newbb/viewforum.php?{$page_query_sort}&sort=t.rating&order=" . (($sort === 't.rating' - && $order - === 'DESC') ? 'ASC' : 'DESC')); // irmtfan t.topic_ratings to t.rating + XOOPS_URL . "/modules/newbb/viewforum.php?{$page_query_sort}&sort=t.topic_views&order=" . (('t.topic_views' === $sort && 'DESC' === $order) ? 'ASC' : 'DESC')); +$xoopsTpl->assign('h_rating_link', XOOPS_URL . "/modules/newbb/viewforum.php?{$page_query_sort}&sort=t.rating&order=" . (('t.rating' === $sort + && 'DESC' + === $order) ? 'ASC' : 'DESC')); // irmtfan t.topic_ratings to t.rating $xoopsTpl->assign('h_date_link', - XOOPS_URL . "/modules/newbb/viewforum.php?{$page_query_sort}&sort=t.topic_last_post_id&order=" . (($sort === 't.topic_last_post_id' && $order === 'DESC') ? 'ASC' : 'DESC')); -$xoopsTpl->assign('h_publish_link', XOOPS_URL . "/modules/newbb/viewforum.php?{$page_query_sort}&sort=t.topic_id&order=" . (($sort === 't.topic_id' - && $order === 'DESC') ? 'ASC' : 'DESC')); + XOOPS_URL . "/modules/newbb/viewforum.php?{$page_query_sort}&sort=t.topic_last_post_id&order=" . (('t.topic_last_post_id' === $sort && 'DESC' === $order) ? 'ASC' : 'DESC')); +$xoopsTpl->assign('h_publish_link', XOOPS_URL . "/modules/newbb/viewforum.php?{$page_query_sort}&sort=t.topic_id&order=" . (('t.topic_id' === $sort + && 'DESC' === $order) ? 'ASC' : 'DESC')); $xoopsTpl->assign('forum_since', $since); // For $since in search.php // irmtfan - if no since it should be 0 @@ -232,7 +232,7 @@ $startdate = empty($since) ? 0 : (time() - newbb_getSinceTime($since)); $start = XoopsRequest::getInt('start', 0, 'GET'); -$criteria_vars = array('startdate', 'start', 'sort', 'order', 'type', 'status', 'excerpt'); +$criteria_vars = ['startdate', 'start', 'sort', 'order', 'type', 'status', 'excerpt']; foreach ($criteria_vars as $var) { $criteria_topic[$var] = @${$var}; } @@ -265,14 +265,14 @@ unset($query_type); $typeHandler = xoops_getModuleHandler('type', 'newbb'); $typeOptions = null; -$types = array(); +$types = []; if ($types = $typeHandler->getByForum($forum_id)) { - $typeOptions[] = array('title' => _ALL, 'link' => XOOPS_URL . "/modules/newbb/viewforum.php?{$page_query_type}"); + $typeOptions[] = ['title' => _ALL, 'link' => XOOPS_URL . "/modules/newbb/viewforum.php?{$page_query_type}"]; foreach ($types as $key => $item) { - $typeOptions[] = array( + $typeOptions[] = [ 'title' => $item['type_name'], 'link' => XOOPS_URL . "/modules/newbb/viewforum.php?{$page_query_type}&type={$key}" - ); + ]; } } if ($type > 0) { @@ -323,9 +323,9 @@ $page_query_nav = implode('&', array_values($query_nav)); unset($query_nav); $nav = new XoopsPageNav($all_topics, $GLOBALS['xoopsModuleConfig']['topics_per_page'], $start, 'start', $page_query_nav); - if ($GLOBALS['xoopsModuleConfig']['pagenav_display'] === 'select') { + if ('select' === $GLOBALS['xoopsModuleConfig']['pagenav_display']) { $navi = $nav->renderSelect(); - } elseif ($GLOBALS['xoopsModuleConfig']['pagenav_display'] === 'image') { + } elseif ('image' === $GLOBALS['xoopsModuleConfig']['pagenav_display']) { $navi = $nav->renderImageNav(4); } else { $navi = $nav->renderNav(4); @@ -348,7 +348,7 @@ unset($permission_table); } -if ($GLOBALS['xoopsModuleConfig']['rss_enable'] == 1) { +if (1 == $GLOBALS['xoopsModuleConfig']['rss_enable']) { $xoopsTpl->assign('rss_button', "
get($forum_id); $forums[$forum_id] = $forum_obj; - $accessForums = array($forum_id); + $accessForums = [$forum_id]; $isadmin = newbb_isAdmin($forum_obj); } /* Only admin has access to admin mode */ -if (!$isadmin && $mode === 2) { - $status = in_array($status, array('active', 'pending', 'deleted'), true) ? '' : $status; +if (!$isadmin && 2 === $mode) { + $status = in_array($status, ['active', 'pending', 'deleted'], true) ? '' : $status; $mode = 0; } if ($mode) { @@ -96,7 +96,7 @@ if (empty($GLOBALS['xoopsModuleConfig']['read_mode'])) { //$criteria_status_count->add(new Criteria('approved', 1));// irmtfan commented and removed //$criteria_status_post->add(new Criteria('p.approved', 1));// irmtfan commented and removed - } elseif ($GLOBALS['xoopsModuleConfig']['read_mode'] == 2) { + } elseif (2 == $GLOBALS['xoopsModuleConfig']['read_mode']) { // START irmtfan use read_uid to find the unread posts when the user is logged in $read_uid = is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->getVar('uid') : 0; if (!empty($read_uid)) { @@ -111,11 +111,11 @@ // END irmtfan use read_uid to find the unread posts when the user is logged in //$criteria_status_post->add(new Criteria("p.approved", 1)); // irmtfan commented and removed //$criteria_status_count =& $criteria_status_post; - } elseif ($GLOBALS['xoopsModuleConfig']['read_mode'] == 1) { + } elseif (1 == $GLOBALS['xoopsModuleConfig']['read_mode']) { $criteria_count->add(new Criteria('post_time', (int)$last_visit, '>')); // irmtfan add new criteria $criteria_post->add(new Criteria('p.post_time', (int)$last_visit, '>')); // irmtfan add new criteria // START irmtfan fix read_mode = 1 bugs - for all users (member and anon) - $topics = array(); + $topics = []; $topic_lastread = newbb_getcookie('LT', true); if (count($topic_lastread) > 0) { foreach ($topic_lastread as $id => $time) { @@ -144,7 +144,7 @@ $karmaHandler = xoops_getModuleHandler('karma', 'newbb'); $user_karma = $karmaHandler->getUserKarma(); -$valid_modes = array('flat', 'compact'); +$valid_modes = ['flat', 'compact']; $viewmode_cookie = newbb_getcookie('V'); if ('compact' === XoopsRequest::getString('viewmode', '', 'GET')) { @@ -157,7 +157,7 @@ $postCount = $postHandler->getPostCount($criteria_count, $join);// irmtfan add join for read_mode = 2 $posts = $postHandler->getPostsByLimit($criteria_post, $post_perpage, $start, $join);// irmtfan add join for read_mode = 2 -$poster_array = array(); +$poster_array = []; if (count($posts) > 0) { foreach (array_keys($posts) as $id) { $poster_array[$posts[$id]->getVar('uid')] = 1; @@ -183,11 +183,11 @@ redirect_header(XOOPS_URL . '/index.php', 2, _MD_NORIGHTTOACCESS); } if ($forum_obj->getVar('parent_forum')) { - $parent_forum_obj = $forumHandler->get($forum_obj->getVar('parent_forum'), array('forum_name')); - $parentforum = array( + $parent_forum_obj = $forumHandler->get($forum_obj->getVar('parent_forum'), ['forum_name']); + $parentforum = [ 'id' => $forum_obj->getVar('parent_forum'), 'name' => $parent_forum_obj->getVar('forum_name') - ); + ]; unset($parent_forum_obj); $xoopsTpl->assign_by_ref('parentforum', $parentforum); } @@ -223,7 +223,7 @@ $xoopsTpl->assign('xoops_pagetitle', $xoops_pagetitle); // irmtfan - remove icon_path and use newbbDisplayImage $xoopsTpl->assign('anonym_avatar', newbbDisplayImage('anonym')); -$userid_array = array(); +$userid_array = []; if (count($poster_array) > 0) { $memberHandler = xoops_getHandler('member'); $userid_array = array_keys($poster_array); @@ -234,7 +234,7 @@ $users = null; } -$online = array(); +$online = []; if ($GLOBALS['xoopsModuleConfig']['wol_enabled']) { if (!empty($user_criteria)) { @@ -243,7 +243,7 @@ } } -$viewtopic_users = array(); +$viewtopic_users = []; if (count($userid_array) > 0) { require $GLOBALS['xoops']->path('modules/' . $xoopsModule->getVar('dirname', 'n') . '/class/user.php'); @@ -255,7 +255,7 @@ $pn = 0; $topicHandler = xoops_getModuleHandler('topic', 'newbb'); -static $suspension = array(); +static $suspension = []; foreach (array_keys($posts) as $id) { ++$pn; @@ -267,11 +267,11 @@ } else { $post_image = ''; } - $poster = array( + $poster = [ 'uid' => 0, 'name' => $post->getVar('poster_name') ?: $myts->htmlSpecialChars($GLOBALS['xoopsConfig']['anonymous']), 'link' => $post->getVar('poster_name') ?: $myts->htmlSpecialChars($GLOBALS['xoopsConfig']['anonymous']) - ); + ]; if ($post->getVar('uid') > 0 && isset($viewtopic_users[$post->getVar('uid')])) { $poster = $viewtopic_users[$post->getVar('uid')]; } @@ -289,7 +289,7 @@ $post_attachment = $post->displayAttachment(); } - $thread_buttons = array(); + $thread_buttons = []; if ($GLOBALS['xoopsModuleConfig']['enable_permcheck']) { if (!isset($suspension[$post->getVar('forum_id')])) { @@ -376,9 +376,9 @@ . $post->getVar('topic_id'); $thread_buttons['report']['name'] = _MD_REPORT; } - $thread_action = array(); + $thread_action = []; - $xoopsTpl->append('posts', array( + $xoopsTpl->append('posts', [ 'post_id' => $post->getVar('post_id'), 'topic_id' => $post->getVar('topic_id'), 'forum_id' => $post->getVar('forum_id'), @@ -395,7 +395,7 @@ 'thread_action' => $thread_action, 'thread_buttons' => $thread_buttons, 'poster' => $poster - )); + ]); unset($thread_buttons, $poster); } @@ -411,9 +411,9 @@ $nav = new XoopsPageNav($postCount, $post_perpage, $start, 'start', 'forum=' . $forum_id . '&viewmode=' . $viewmode . '&status=' . $status . '&uid=' . $uid . '&order=' . $order . '&mode=' . $mode); //if (isset($GLOBALS['xoopsModuleConfig']['do_rewrite'])) $nav->url = formatURL($_SERVER['SERVER_NAME']) . $nav->url; - if ($GLOBALS['xoopsModuleConfig']['pagenav_display'] === 'select') { + if ('select' === $GLOBALS['xoopsModuleConfig']['pagenav_display']) { $navi = $nav->renderSelect(); - } elseif ($GLOBALS['xoopsModuleConfig']['pagenav_display'] === 'image') { + } elseif ('image' === $GLOBALS['xoopsModuleConfig']['pagenav_display']) { $navi = $nav->renderImageNav(4); } else { $navi = $nav->renderNav(4); @@ -467,17 +467,17 @@ $xoopsTpl->assign('unreplied_link', $unreplied_link); $xoopsTpl->assign('unread_link', $unread_link); -$viewmode_options = array(); -if ($order === 'DESC') { - $viewmode_options[] = array( +$viewmode_options = []; +if ('DESC' === $order) { + $viewmode_options[] = [ 'link' => XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/viewpost.php?viewmode=flat&order=ASC&forum=' . $forum_id, 'title' => _OLDESTFIRST - ); + ]; } else { - $viewmode_options[] = array( + $viewmode_options[] = [ 'link' => XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/viewpost.php?viewmode=flat&order=DESC&forum=' . $forum_id, 'title' => _NEWESTFIRST - ); + ]; } //$xoopsTpl->assign('viewmode_compact', ($viewmode=="compact")?1:0); diff --git a/viewtopic.php b/viewtopic.php index b1adff7a..98c5a677 100644 --- a/viewtopic.php +++ b/viewtopic.php @@ -36,8 +36,8 @@ xoops_loadLanguage('user'); // irmtfan add last_login /*Build the page query*/ -$query_vars = array('post_id', 'topic_id', 'status', 'order', 'start', 'move', 'mode'); -$query_array = array(); +$query_vars = ['post_id', 'topic_id', 'status', 'order', 'start', 'move', 'mode']; +$query_array = []; foreach ($query_vars as $var) { if (XoopsRequest::getString($var, '', 'GET')) { $query_array[$var] = "{$var}=" . XoopsRequest::getString($var, '', 'GET'); @@ -48,22 +48,22 @@ $forum_id = XoopsRequest::getInt('forum', 0, 'GET'); $read = (XoopsRequest::getString('read', '', 'GET') - && in_array(XoopsRequest::getString('read', '', 'GET'), array('new'), true)) ? XoopsRequest::getString('read', '', 'GET') : ''; + && in_array(XoopsRequest::getString('read', '', 'GET'), ['new'], true)) ? XoopsRequest::getString('read', '', 'GET') : ''; $topic_id = XoopsRequest::getInt('topic_id', 0, 'GET'); // isset($_GET['topic_id']) ? (int)($_GET['topic_id']) : 0; $post_id = XoopsRequest::getInt('post_id', 0, 'GET'); // !empty($_GET['post_id']) ? (int)($_GET['post_id']) : 0; $move = strtolower(XoopsRequest::getString('move', '', 'GET')); // isset($_GET['move']) ? strtolower($_GET['move']) : ''; $start = XoopsRequest::getInt('start', 0, 'GET'); // !empty($_GET['start']) ? (int)($_GET['start']) : 0; $status = (XoopsRequest::getString('status', '', 'GET') - && in_array(XoopsRequest::getString('status', '', 'GET'), array('active', 'pending', 'deleted'), true)) ? XoopsRequest::getString('status', '', 'GET') : ''; + && in_array(XoopsRequest::getString('status', '', 'GET'), ['active', 'pending', 'deleted'], true)) ? XoopsRequest::getString('status', '', 'GET') : ''; $mode = XoopsRequest::getInt('mode', (!empty($status) ? 2 : 0), 'GET'); // !empty($_GET['mode']) ? (int)($_GET['mode']) : (!empty($status) ? 2 : 0); $order = (XoopsRequest::getString('order', '', 'GET') - && in_array(XoopsRequest::getString('order', '', 'GET'), array('ASC', 'DESC'), true)) ? XoopsRequest::getString('order', '', 'GET') : ''; + && in_array(XoopsRequest::getString('order', '', 'GET'), ['ASC', 'DESC'], true)) ? XoopsRequest::getString('order', '', 'GET') : ''; -if ($order === '') { +if ('' === $order) { if (is_object($GLOBALS['xoopsUser']) && $GLOBALS['xoopsUser']->isActive()) { - $order = ($GLOBALS['xoopsUser']->getVar('uorder') == 1) ? 'DESC' : 'ASC'; + $order = (1 == $GLOBALS['xoopsUser']->getVar('uorder')) ? 'DESC' : 'ASC'; } else { - $order = ($GLOBALS['xoopsConfig']['com_order'] == 1) ? 'DESC' : 'ASC'; + $order = (1 == $GLOBALS['xoopsConfig']['com_order']) ? 'DESC' : 'ASC'; } } @@ -80,7 +80,7 @@ $topic_obj = $topicHandler->getByPost($post_id); $topic_id = $topic_obj->getVar('topic_id'); } elseif (!empty($move)) { - $topic_obj = $topicHandler->getByMove($topic_id, ($move === 'prev') ? -1 : 1, $forum_id); + $topic_obj = $topicHandler->getByMove($topic_id, ('prev' === $move) ? -1 : 1, $forum_id); $topic_id = $topic_obj->getVar('topic_id'); } else { $topic_obj = $topicHandler->get($topic_id); @@ -118,12 +118,12 @@ */ $topic_last_post_time_or_id_read = newbb_getRead('topic', $topic_id); if (!empty($topic_last_post_time_or_id_read)) { - if ($GLOBALS['xoopsModuleConfig']['read_mode'] == 1) { + if (1 == $GLOBALS['xoopsModuleConfig']['read_mode']) { $postHandler = xoops_getModuleHandler('post', 'newbb'); $post_obj = $postHandler->get($topic_obj->getVar('topic_last_post_id')); $topic_is_unread = ($topic_last_post_time_or_id_read < $post_obj->getVar('post_time')); } - if ($GLOBALS['xoopsModuleConfig']['read_mode'] == 2) { + if (2 == $GLOBALS['xoopsModuleConfig']['read_mode']) { $topic_is_unread = ($topic_last_post_time_or_id_read < $topic_obj->getVar('topic_last_post_id')); // hack jump to last post read if post_id is empty - is there any better way? if (empty($post_id) && $topic_is_unread @@ -149,7 +149,7 @@ //$viewmode = "flat"; $total_posts = $topicHandler->getPostCount($topic_obj, $status); -$postsArray = array(); +$postsArray = []; $postsArray = $topicHandler->getAllPosts($topic_obj, $order, $GLOBALS['xoopsModuleConfig']['posts_per_page'], $start, $post_id, $status); //irmtfan - increment topic_views only if the topic is unread @@ -192,7 +192,7 @@ $xoopsTpl->assign('anonym_avatar', newbbDisplayImage('anonym')); // START irmtfan improve infobox -$infobox = array(); +$infobox = []; $infobox['show'] = (int)$GLOBALS['xoopsModuleConfig']['show_infobox']; //4.05 // irmtfan removed then define after array //$xoopsTpl->assign('infobox', $infobox); //4.05 @@ -200,11 +200,11 @@ if ($infobox['show'] > 0) { // irmtfan - remove icon_path and use newbbDisplayImage - $infobox['icon'] = array( + $infobox['icon'] = [ 'expand' => $iconHandler->getImageSource('less'), 'collapse' => $iconHandler->getImageSource('more') - ); - if ($infobox['show'] == 1) { + ]; + if (1 == $infobox['show']) { $infobox['style'] = 'none'; //irmtfan move semicolon $infobox['alt'] = _MD_NEWBB_SEEUSERDATA; $infobox['src'] = 'more'; @@ -218,7 +218,7 @@ $xoopsTpl->assign('infobox', $infobox); // END irmtfan improve infobox -$xoopsTpl->assign(array( +$xoopsTpl->assign([ 'topic_title' => 'getVar('dirname', 'n') . '/reply.php?topic_id=' . $topic_id . '"> ' . $t_reply . ''); } -$poster_array = array(); +$poster_array = []; $require_reply = false; foreach ($postsArray as $eachpost) { if ($eachpost->getVar('uid') > 0) { @@ -276,19 +276,19 @@ } } -$userid_array = array(); -$online = array(); -if (count($poster_array) > 0) { +$userid_array = []; +$online = []; +if (is_array($poster_array) && count($poster_array) > 0) { $memberHandler = xoops_getHandler('member'); $userid_array = array_keys($poster_array); $user_criteria = '(' . implode(',', $userid_array) . ')'; $users = $memberHandler->getUsers(new Criteria('uid', $user_criteria, 'IN'), true); } else { - $users = array(); + $users = []; } -$viewtopic_users = array(); -if (count($userid_array) > 0) { +$viewtopic_users = []; +if (is_array($userid_array) && count($userid_array) > 0) { require $GLOBALS['xoops']->path('modules/' . $xoopsModule->getVar('dirname', 'n') . '/class/user.php'); $userHandler = new NewbbUserHandler($GLOBALS['xoopsModuleConfig']['groupbar_enabled'], $GLOBALS['xoopsModuleConfig']['wol_enabled']); $userHandler->users = $users; @@ -300,7 +300,7 @@ if ($GLOBALS['xoopsModuleConfig']['allow_require_reply'] && $require_reply) { if (!empty($GLOBALS['xoopsModuleConfig']['cache_enabled'])) { $viewtopic_posters = newbb_getsession('t' . $topic_id, true); - if (!is_array($viewtopic_posters) || count($viewtopic_posters) === 0) { + if (!(is_array($viewtopic_posters) && count($viewtopic_posters) > 1)) { $viewtopic_posters = $topicHandler->getAllPosters($topic_obj); newbb_setsession('t' . $topic_id, $viewtopic_posters); } @@ -308,11 +308,11 @@ $viewtopic_posters = $topicHandler->getAllPosters($topic_obj); } } else { - $viewtopic_posters = array(); + $viewtopic_posters = []; } if ($GLOBALS['xoopsModuleConfig']['show_advertising']) { - $post_werbung = array( + $post_werbung = [ 'post_id' => 0, 'post_parent_id' => 0, 'post_date' => 0, @@ -327,17 +327,17 @@ 'thread_action' => '', 'thread_buttons' => '', 'mod_buttons' => '', - 'poster' => array( + 'poster' => [ 'uid' => -1, 'link' => _MD_ADVERTISING_USER, 'avatar' => 'avatars/blank.gif', 'regdate' => 0, 'last_login' => 0, - 'rank' => array('title' => '') - ), + 'rank' => ['title' => ''] + ], // irmtfan add last_login 'post_permalink' => '' - ); + ]; } $i = 0; @@ -352,14 +352,15 @@ } if ($total_posts > $GLOBALS['xoopsModuleConfig']['posts_per_page']) { - include $GLOBALS['xoops']->path('class/pagenav.php'); +// include $GLOBALS['xoops']->path('class/pagenav.php'); + xoops_load('pagenav'); $nav = new XoopsPageNav($total_posts, $GLOBALS['xoopsModuleConfig']['posts_per_page'], $start, 'start', 'topic_id=' . $topic_id . '&order=' . $order . '&status=' . $status . '&mode=' . $mode); //if (isset($GLOBALS['xoopsModuleConfig']['do_rewrite']) && $GLOBALS['xoopsModuleConfig']['do_rewrite'] === 1) $nav->url = XOOPS_URL . $nav->url; - if ($GLOBALS['xoopsModuleConfig']['pagenav_display'] === 'select') { + if ('select' === $GLOBALS['xoopsModuleConfig']['pagenav_display']) { $navi = $nav->renderSelect(); - } elseif ($GLOBALS['xoopsModuleConfig']['pagenav_display'] === 'image') { + } elseif ('image' === $GLOBALS['xoopsModuleConfig']['pagenav_display']) { $navi = $nav->renderImageNav(4); } else { $navi = $nav->renderNav(4); @@ -371,7 +372,7 @@ if (empty($post_id)) { $first = array_keys($postsArray); - $post_id = (!empty($first[0])) ? $first[0] : 0; + $post_id = !empty($first[0]) ? $first[0] : 0; } if (!empty($postsArray[$post_id])) { $xoops_pagetitle = $postsArray[$post_id]->getVar('subject') . ' [' . $forum_obj->getVar('forum_name') . ']'; @@ -394,7 +395,7 @@ $xoopsTpl->assign('topic_print_link', "print.php?form=1&{$page_query}"); -$admin_actions = array(); +$admin_actions = []; $ad_merge = ''; $ad_move = ''; $ad_delete = ''; @@ -410,67 +411,67 @@ // START irmtfan add restore to viewtopic // if the topic is active if ($topic_obj->getVar('approved') > 0) { - $admin_actions['merge'] = array( + $admin_actions['merge'] = [ 'link' => XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname', 'n') . '/topicmanager.php?mode=merge&topic_id=' . $topic_id, 'name' => _MD_MERGETOPIC, 'image' => $ad_merge - ); - $admin_actions['move'] = array( + ]; + $admin_actions['move'] = [ 'link' => XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname', 'n') . '/topicmanager.php?mode=move&topic_id=' . $topic_id, 'name' => _MD_MOVETOPIC, 'image' => $ad_move - ); - $admin_actions['delete'] = array( + ]; + $admin_actions['delete'] = [ 'link' => XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname', 'n') . '/topicmanager.php?mode=delete&topic_id=' . $topic_id, 'name' => _MD_DELETETOPIC, 'image' => $ad_delete - ); + ]; if (!$topic_obj->getVar('topic_status')) { - $admin_actions['lock'] = array( + $admin_actions['lock'] = [ 'link' => XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname', 'n') . '/topicmanager.php?mode=lock&topic_id=' . $topic_id, 'image' => $ad_lock, 'name' => _MD_LOCKTOPIC - ); + ]; } else { - $admin_actions['unlock'] = array( + $admin_actions['unlock'] = [ 'link' => XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname', 'n') . '/topicmanager.php?mode=unlock&topic_id=' . $topic_id, 'image' => $ad_unlock, 'name' => _MD_UNLOCKTOPIC - ); + ]; } if (!$topic_obj->getVar('topic_sticky')) { - $admin_actions['sticky'] = array( + $admin_actions['sticky'] = [ 'link' => XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname', 'n') . '/topicmanager.php?mode=sticky&topic_id=' . $topic_id, 'image' => $ad_sticky, 'name' => _MD_STICKYTOPIC - ); + ]; } else { - $admin_actions['unsticky'] = array( + $admin_actions['unsticky'] = [ 'link' => XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname', 'n') . '/topicmanager.php?mode=unsticky&topic_id=' . $topic_id, 'image' => $ad_unsticky, 'name' => _MD_UNSTICKYTOPIC - ); + ]; } if (!$topic_obj->getVar('topic_digest')) { - $admin_actions['digest'] = array( + $admin_actions['digest'] = [ 'link' => XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname', 'n') . '/topicmanager.php?mode=digest&topic_id=' . $topic_id, 'image' => $ad_digest, 'name' => _MD_DIGESTTOPIC - ); + ]; } else { - $admin_actions['undigest'] = array( + $admin_actions['undigest'] = [ 'link' => XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname', 'n') . '/topicmanager.php?mode=undigest&topic_id=' . $topic_id, 'image' => $ad_undigest, 'name' => _MD_UNDIGESTTOPIC - ); + ]; } // if the topic is pending/deleted then restore/approve } else { - $admin_actions['restore'] = array( + $admin_actions['restore'] = [ 'link' => XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname', 'n') . '/topicmanager.php?mode=restore&topic_id=' . $topic_id, 'name' => _MD_RESTORETOPIC, 'image' => $ad_restore - ); + ]; } // END irmtfan add restore to viewtopic @@ -541,14 +542,14 @@ $configHandler = xoops_getHandler('config'); $xp_config = $configHandler->getConfigsByCat(0, $pollModuleHandler->getVar('mid')); - $GLOBALS['xoopsTpl']->assign(array( + $GLOBALS['xoopsTpl']->assign([ 'is_visible' => $isVisible, 'visible_message' => $visibleMsg, 'disp_votes' => $xp_config['disp_vote_nums'], 'lang_vote' => constant('_MD_' . strtoupper($GLOBALS['xoopsModuleConfig']['poll_module']) . '_VOTE'), 'lang_results' => constant('_MD_' . strtoupper($GLOBALS['xoopsModuleConfig']['poll_module']) . '_RESULTS'), 'back_link' => '' - )); + ]); $classRenderer = ucfirst($GLOBALS['xoopsModuleConfig']['poll_module']) . 'Renderer'; $renderer = new $classRenderer($poll_obj); // check to see if user has voted, show form if not, otherwise get results for form @@ -641,18 +642,18 @@ $poll_restart = ''; $poll_log = ''; - $adminpoll_actions = array(); - $adminpoll_actions['editpoll'] = array( + $adminpoll_actions = []; + $adminpoll_actions['editpoll'] = [ 'link' => XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname', 'n') . '/polls.php?op=edit&poll_id=' . $topic_obj->getVar('poll_id') . '&topic_id=' . $topic_id, 'image' => $poll_edit, 'name' => _MD_EDITPOLL - ); - $adminpoll_actions['deletepoll'] = array( + ]; + $adminpoll_actions['deletepoll'] = [ 'link' => XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname', 'n') . '/polls.php?op=delete&poll_id=' . $topic_obj->getVar('poll_id') . '&topic_id=' . $topic_id, 'image' => $poll_delete, 'name' => _MD_DELETEPOLL - ); - $adminpoll_actions['restartpoll'] = array( + ]; + $adminpoll_actions['restartpoll'] = [ 'link' => XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname', 'n') @@ -664,8 +665,8 @@ . $forum_id, 'image' => $poll_restart, 'name' => _MD_RESTARTPOLL - ); - $adminpoll_actions['logpoll'] = array( + ]; + $adminpoll_actions['logpoll'] = [ 'link' => XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname', 'n') @@ -677,7 +678,7 @@ . $forum_id, 'image' => $poll_log, 'name' => _MD_POLL_VIEWLOG - ); + ]; $xoopsTpl->assign_by_ref('adminpoll_actions', $adminpoll_actions); } @@ -722,7 +723,7 @@ $xoopsTpl->assign('forum_jumpbox', newbb_make_jumpbox($forum_id)); } -$xoopsTpl->assign(array( +$xoopsTpl->assign([ 'lang_forum_index' => sprintf(_MD_FORUMINDEX, htmlspecialchars($GLOBALS['xoopsConfig']['sitename'], ENT_QUOTES)), 'lang_from' => _MD_FROM, 'lang_joined' => _MD_JOINED, @@ -734,19 +735,19 @@ 'lang_reply' => _REPLY, 'lang_postedon' => _MD_NEWBB_POSTEDON, 'lang_groups' => _MD_GROUPS - )); + ]); -$viewmode_options = array(); -if ($order === 'DESC') { - $viewmode_options[] = array( +$viewmode_options = []; +if ('DESC' === $order) { + $viewmode_options[] = [ 'link' => XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname', 'n') . '/viewtopic.php?order=ASC&status=$status&topic_id=' . $topic_id, 'title' => _OLDESTFIRST - ); + ]; } else { - $viewmode_options[] = array( + $viewmode_options[] = [ 'link' => XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname', 'n') . '/viewtopic.php?order=DESC&status=$status&topic_id=' . $topic_id, 'title' => _NEWESTFIRST - ); + ]; } switch ($status) { @@ -797,8 +798,8 @@ } //$quickform = ( !empty($GLOBALS['xoopsModuleConfig']["editor_default"]) ) ? $GLOBALS['xoopsModuleConfig']["editor_default"] : "textarea"; - $quickform = (!empty($GLOBALS['xoopsModuleConfig']['editor_quick_default'])) ? $GLOBALS['xoopsModuleConfig']['editor_quick_default'] : 'textarea'; - $editor_configs = array(); + $quickform = !empty($GLOBALS['xoopsModuleConfig']['editor_quick_default']) ? $GLOBALS['xoopsModuleConfig']['editor_quick_default'] : 'textarea'; + $editor_configs = []; $editor_configs ['name'] = 'message'; //$editor_configs [ "value" ] = $message ; $editor_configs ['rows'] = empty($GLOBALS['xoopsModuleConfig'] ['editor_rows']) ? 10 : $GLOBALS['xoopsModuleConfig'] ['editor_rows']; @@ -835,15 +836,15 @@ $toggles = newbb_getcookie('G', true); // START irmtfan improve quickreply smarty variable - add alt key to quick reply button - change $display to $style for more comprehension - add toggle $quickreply['expand'] - $quickreply = array(); + $quickreply = []; $qr_collapse = 't_qr'; $qr_expand = 't_qr_expand'; // change this - $quickreply['icon'] = array( + $quickreply['icon'] = [ 'expand' => $iconHandler->getImageSource($qr_expand), 'collapse' => $iconHandler->getImageSource($qr_collapse) - ); + ]; $quickreply['show'] = 1; // = !empty($GLOBALS['xoopsModuleConfig']['quickreply_enabled'] - $quickreply['expand'] = (count($toggles) > 0) ? (in_array('qr', $toggles, true) ? false : true) : true; + $quickreply['expand'] = (is_array($toggles) && count($toggles) > 0) ? (in_array('qr', $toggles, true) ? false : true) : true; if ($quickreply['expand']) { $quickreply['style'] = 'block'; //irmtfan move semicolon $quickreply_icon_display = $qr_expand; @@ -859,7 +860,7 @@ // END irmtfan improve quickreply smarty variable unset($forum_form); } else { - $xoopsTpl->assign('quickreply', array('show' => 0)); + $xoopsTpl->assign('quickreply', ['show' => 0]); } if ($GLOBALS['xoopsModuleConfig']['do_tag'] diff --git a/votepolls.php b/votepolls.php index 448ad676..193bfbb9 100644 --- a/votepolls.php +++ b/votepolls.php @@ -69,7 +69,7 @@ if (is_object($poll_obj)) { if ($poll_obj->getVar('multiple')) { $optionId = XoopsRequest::getArray('option_id', 0, 'POST'); - $optionId = (array)$optionId; // type cast to make sure it's an array + $optionId = $optionId; // type cast to make sure it's an array $optionId = array_map('intval', $optionId); // make sure values are integers } else { $optionId = XoopsRequest::getInt('option_id', 0, 'POST'); @@ -92,7 +92,7 @@ $msg = constant('_MD_' . strtoupper($GLOBALS['xoopsModuleConfig']['poll_module']) . '_THANKSFORVOTE'); } else { /* there was a problem registering the vote */ - redirect_header($GLOBALS['xoops']->buildUrl('index.php', array('poll_id' => $poll_id)), $classConstants::REDIRECT_DELAY_MEDIUM, + redirect_header($GLOBALS['xoops']->buildUrl('index.php', ['poll_id' => $poll_id]), $classConstants::REDIRECT_DELAY_MEDIUM, constant('_MD_' . strtoupper($GLOBALS['xoopsModuleConfig']['poll_module']) . '_VOTE_ERROR')); } } else { @@ -117,7 +117,7 @@ if (null !== $url) { redirect_header($url, $classConstants::REDIRECT_DELAY_MEDIUM, $msg); } else { - redirect_header($GLOBALS['xoops']->buildUrl('viewtopic.php', array('topic_id' => $topic_id)), $classConstants::REDIRECT_DELAY_MEDIUM, $msg); + redirect_header($GLOBALS['xoops']->buildUrl('viewtopic.php', ['topic_id' => $topic_id]), $classConstants::REDIRECT_DELAY_MEDIUM, $msg); } // old xoopspoll or umfrage or any clone from them } else { diff --git a/xoops_version.php b/xoops_version.php index 51e89e08..2be55ec4 100644 --- a/xoops_version.php +++ b/xoops_version.php @@ -11,7 +11,7 @@ $modversion['version'] = 4.33; $modversion['module_status'] = 'Final'; -$modversion['release_date'] = '2016/11/27'; +$modversion['release_date'] = '2018/03/24'; $modversion['name'] = _MI_NEWBB_NAME; $modversion['description'] = _MI_NEWBB_DESC; $modversion['credits'] = 'NewBB 2 developed by Marko Schmuck (predator) / D.J. (phppp) / Alfred(dhcst)'; @@ -28,7 +28,7 @@ $modversion['min_php'] = '5.5'; $modversion['min_xoops'] = '2.5.8'; $modversion['min_admin'] = '1.2'; -$modversion['min_db'] = array('mysql' => '5.1'); +$modversion['min_db'] = ['mysql' => '5.1']; $modversion['system_menu'] = 1; $modversion['dirmoduleadmin'] = 'Frameworks/moduleclasses/moduleadmin'; $modversion['sysicons16'] = 'Frameworks/moduleclasses/icons/16'; @@ -51,7 +51,7 @@ $modversion['sqlfile']['mysql'] = 'sql/mysql.sql'; // Tables created by sql file (without prefix!) -$modversion['tables'] = array( +$modversion['tables'] = [ 'bb_archive', 'bb_categories', 'bb_votedata', @@ -70,7 +70,7 @@ 'bb_type_forum', 'bb_stats', 'bb_user_stats' -); +]; // Admin things $modversion['hasAdmin'] = 1; @@ -87,26 +87,26 @@ $modversion['onUpdate'] = 'include/module.php'; // Templates -$modversion['templates'] = array( - - array('file' => 'newbb_index_menu.tpl', 'description' => ''), - array('file' => 'newbb_index.tpl', 'description' => ''), - array('file' => 'newbb_viewforum_subforum.tpl', 'description' => ''), - array('file' => 'newbb_viewforum_menu.tpl', 'description' => ''), - array('file' => 'newbb_viewforum.tpl', 'description' => ''), - array('file' => 'newbb_viewtopic.tpl', 'description' => ''), - array('file' => 'newbb_thread.tpl', 'description' => ''), - array('file' => 'newbb_edit_post.tpl', 'description' => ''), - array('file' => 'newbb_poll_results.tpl', 'description' => ''), - array('file' => 'newbb_poll_view.tpl', 'description' => ''), - array('file' => 'newbb_searchresults.tpl', 'description' => ''), - array('file' => 'newbb_search.tpl', 'description' => ''), - array('file' => 'newbb_viewall.tpl', 'description' => ''), - array('file' => 'newbb_viewpost.tpl', 'description' => ''), - array('file' => 'newbb_online.tpl', 'description' => ''), - array('file' => 'newbb_rss.tpl', 'description' => ''), - array('file' => 'newbb_notification_select.tpl', 'description' => '') -); +$modversion['templates'] = [ + + ['file' => 'newbb_index_menu.tpl', 'description' => ''], + ['file' => 'newbb_index.tpl', 'description' => ''], + ['file' => 'newbb_viewforum_subforum.tpl', 'description' => ''], + ['file' => 'newbb_viewforum_menu.tpl', 'description' => ''], + ['file' => 'newbb_viewforum.tpl', 'description' => ''], + ['file' => 'newbb_viewtopic.tpl', 'description' => ''], + ['file' => 'newbb_thread.tpl', 'description' => ''], + ['file' => 'newbb_edit_post.tpl', 'description' => ''], + ['file' => 'newbb_poll_results.tpl', 'description' => ''], + ['file' => 'newbb_poll_view.tpl', 'description' => ''], + ['file' => 'newbb_searchresults.tpl', 'description' => ''], + ['file' => 'newbb_search.tpl', 'description' => ''], + ['file' => 'newbb_viewall.tpl', 'description' => ''], + ['file' => 'newbb_viewpost.tpl', 'description' => ''], + ['file' => 'newbb_online.tpl', 'description' => ''], + ['file' => 'newbb_rss.tpl', 'description' => ''], + ['file' => 'newbb_notification_select.tpl', 'description' => ''] +]; // Blocks @@ -117,7 +117,7 @@ // options[4] - Display Navigator: 1 (by default), 0 (No) // options[5] - SelectedForumIDs: null for all -$modversion['blocks'][1] = array( +$modversion['blocks'][1] = [ 'file' => 'newbb_block.php', 'name' => _MI_NEWBB_BLOCK_TOPIC_POST, 'description' => 'It Will drop (use advance topic renderer block)', // irmtfan @@ -125,7 +125,7 @@ 'options' => 'time|5|360|0|1|0', 'edit_func' => 'b_newbb_edit', 'template' => 'newbb_block.tpl' -); +]; // options[0] - Citeria valid: time(by default), views, replies, digest, sticky // options[1] - NumberToDisplay: any positive integer @@ -135,7 +135,7 @@ // options[5] - Title Length : 0 - no limit // options[6] - SelectedForumIDs: null for all -$modversion['blocks'][] = array( +$modversion['blocks'][] = [ 'file' => 'newbb_block.php', 'name' => _MI_NEWBB_BLOCK_TOPIC, 'description' => 'It Will drop (use advance topic renderer block)', // irmtfan @@ -143,7 +143,7 @@ 'options' => 'time|5|0|0|1|0|0', 'edit_func' => 'b_newbb_topic_edit', 'template' => 'newbb_block_topic.tpl' -); +]; // options[0] - Citeria valid: title(by default), text // options[1] - NumberToDisplay: any positive integer @@ -153,7 +153,7 @@ // options[5] - Title/Text Length : 0 - no limit // options[6] - SelectedForumIDs: null for all -$modversion['blocks'][] = array( +$modversion['blocks'][] = [ 'file' => 'newbb_block.php', 'name' => _MI_NEWBB_BLOCK_POST, 'description' => 'Shows recent posts in the forums', @@ -161,7 +161,7 @@ 'options' => 'title|10|0|0|1|0|0', 'edit_func' => 'b_newbb_post_edit', 'template' => 'newbb_block_post.tpl' -); +]; // options[0] - Citeria valid: post(by default), topic, digest, sticky // options[1] - NumberToDisplay: any positive integer @@ -170,7 +170,7 @@ // options[4] - Display Navigator: 1 (by default), 0 (No) // options[5] - SelectedForumIDs: null for all -$modversion['blocks'][] = array( +$modversion['blocks'][] = [ 'file' => 'newbb_block.php', 'name' => _MI_NEWBB_BLOCK_AUTHOR, 'description' => 'Shows authors stats', @@ -178,7 +178,7 @@ 'options' => 'topic|5|0|0|1|0', 'edit_func' => 'b_newbb_author_edit', 'template' => 'newbb_block_author.tpl' -); +]; /* * $options: @@ -187,7 +187,7 @@ * $options[2] - max font size (px or %) * $options[3] - min font size (px or %) */ -$modversion['blocks'][] = array( +$modversion['blocks'][] = [ 'file' => 'newbb_block_tag.php', 'name' => _MI_NEWBB_BLOCK_TAG_CLOUD, 'description' => 'Show tag cloud', @@ -195,7 +195,7 @@ 'edit_func' => 'newbb_tag_block_cloud_edit', 'options' => '100|0|150|80', 'template' => 'newbb_tag_block_cloud.tpl' -); +]; /* * $options: @@ -203,7 +203,7 @@ * $options[1] - time duration, in days, 0 for all the time * $options[2] - sort: a - alphabet; c - count; t - time */ -$modversion['blocks'][] = array( +$modversion['blocks'][] = [ 'file' => 'newbb_block_tag.php', 'name' => _MI_NEWBB_BLOCK_TAG_TOP, 'description' => 'Show top tags', @@ -211,7 +211,7 @@ 'edit_func' => 'newbb_tag_block_top_edit', 'options' => '50|0|c', 'template' => 'newbb_tag_block_top.tpl' -); +]; // irmtfan START add list topic block // options[0] - Status in WHERE claus: all(by default), sticky, digest,lock, poll, voted, viewed, replied, read, (UN_) , active, pending, deleted (admin) (It is multi-select) // options[1] - Uid in WHERE claus: uid of the topic poster : -1 - all users (by default) @@ -227,7 +227,7 @@ // options[11] - Post text Length: 0 - dont show post text - 200 by default // options[12] - SelectedForumIDs: multi-select ngative values for categories and positive values for forums: null for all(by default) -$modversion['blocks'][] = array( +$modversion['blocks'][] = [ 'file' => 'list_topic.php', 'name' => _MI_NEWBB_BLOCK_LIST_TOPIC, 'description' => 'Shows a list of topics (advance renderer)', @@ -235,7 +235,7 @@ 'options' => 'all|-1|-1|0|lastpost|0|5|360|topic,forum,replies,lastpost,lastposttime,lastposter,lastpostmsgicon,publish|1|0|200|0', 'edit_func' => 'newbb_list_topic_edit', 'template' => 'newbb_block_list_topic.tpl' -); +]; // irmtfan END add list topic block // Search @@ -247,520 +247,520 @@ $modversion['use_smarty'] = 1; // Configs -$modversion['config'] = array(); +$modversion['config'] = []; -$modversion['config'][] = array( +$modversion['config'][] = [ 'name' => 'do_rewrite', 'title' => '_MI_DO_REWRITE', 'description' => '_MI_DO_REWRITE_DESC', 'formtype' => 'yesno', 'valuetype' => 'int', 'default' => 0 -); +]; -$modversion['config'][] = array( +$modversion['config'][] = [ 'name' => 'pngforie_enabled', 'title' => '_MI_PNGFORIE_ENABLE', 'description' => '_MI_PNGFORIE_ENABLE_DESC', 'formtype' => 'yesno', 'valuetype' => 'int', 'default' => 0 -); +]; -$modversion['config'][] = array( +$modversion['config'][] = [ 'name' => 'subforum_display', 'title' => '_MI_SUBFORUM_DISPLAY', 'description' => '_MI_SUBFORUM_DISPLAY_DESC', 'formtype' => 'select', 'valuetype' => 'text', - 'options' => array( + 'options' => [ _MI_SUBFORUM_EXPAND => 'expand', _MI_SUBFORUM_COLLAPSE => 'collapse', _MI_SUBFORUM_HIDDEN => 'hidden' - ), + ], 'default' => 'collapse' -); +]; -$modversion['config'][] = array( +$modversion['config'][] = [ 'name' => 'post_excerpt', 'title' => '_MI_POST_EXCERPT', 'description' => '_MI_POST_EXCERPT_DESC', 'formtype' => 'textbox', 'valuetype' => 'int', 'default' => 100 -); +]; -$modversion['config'][] = array( +$modversion['config'][] = [ 'name' => 'topics_per_page', 'title' => '_MI_TOPICSPERPAGE', 'description' => '_MI_TOPICSPERPAGE_DESC', 'formtype' => 'textbox', 'valuetype' => 'int', 'default' => 20 -); +]; -$modversion['config'][] = array( +$modversion['config'][] = [ 'name' => 'posts_per_page', 'title' => '_MI_POSTSPERPAGE', 'description' => '_MI_POSTSPERPAGE_DESC', 'formtype' => 'textbox', 'valuetype' => 'int', 'default' => 10 -); +]; -$modversion['config'][] = array( +$modversion['config'][] = [ 'name' => 'pagenav_display', 'title' => '_MI_PAGENAV_DISPLAY', 'description' => '_MI_PAGENAV_DISPLAY_DESC', 'formtype' => 'select', 'valuetype' => 'text', - 'options' => array( + 'options' => [ _MI_PAGENAV_NUMBER => 'number', _MI_PAGENAV_IMAGE => 'image', _MI_PAGENAV_SELECT => 'select' - ), + ], 'default' => 'number' -); +]; -$modversion['config'][] = array( +$modversion['config'][] = [ 'name' => 'cache_enabled', 'title' => '_MI_CACHE_ENABLE', 'description' => '_MI_CACHE_ENABLE_DESC', 'formtype' => 'yesno', 'valuetype' => 'int', 'default' => 0 -); +]; -$modversion['config'][] = array( +$modversion['config'][] = [ 'name' => 'statistik_enabled', 'title' => '_MI_STATISTIK_ENABLE', 'description' => '_MI_STATISTIK_ENABLE_DESC', 'formtype' => 'yesno', 'valuetype' => 'int', 'default' => 1 -); +]; -$modversion['config'][] = array( +$modversion['config'][] = [ 'name' => 'dir_attachments', 'title' => '_MI_DIR_ATTACHMENT', 'description' => '_MI_DIR_ATTACHMENT_DESC', 'formtype' => 'textbox', 'valuetype' => 'text', 'default' => 'uploads/newbb' -); +]; -$modversion['config'][] = array( +$modversion['config'][] = [ 'name' => 'media_allowed', 'title' => '_MI_MEDIA_ENABLE', 'description' => '_MI_MEDIA_ENABLE_DESC', 'formtype' => 'yesno', 'valuetype' => 'int', 'default' => 1 -); +]; -$modversion['config'][] = array( +$modversion['config'][] = [ 'name' => 'path_magick', 'title' => '_MI_PATH_MAGICK', 'description' => '_MI_PATH_MAGICK_DESC', 'formtype' => 'textbox', 'valuetype' => 'text', 'default' => '/usr/bin/X11' -); +]; -$modversion['config'][] = array( +$modversion['config'][] = [ 'name' => 'path_netpbm', 'title' => '_MI_PATH_NETPBM', 'description' => '_MI_PATH_NETPBM_DESC', 'formtype' => 'textbox', 'valuetype' => 'text', 'default' => '/usr/bin' -); +]; -$modversion['config'][] = array( +$modversion['config'][] = [ 'name' => 'image_lib', 'title' => '_MI_IMAGELIB', 'description' => '_MI_IMAGELIB_DESC', 'formtype' => 'select', 'valuetype' => 'int', 'default' => 0, - 'options' => array( + 'options' => [ _MI_AUTO => 0, _MI_MAGICK => 1, _MI_NETPBM => 2, _MI_GD1 => 3, _MI_GD2 => 4 - ) -); + ] +]; -$modversion['config'][] = array( +$modversion['config'][] = [ 'name' => 'show_userattach', 'title' => '_MI_USERATTACH_ENABLE', 'description' => '_MI_USERATTACH_DESC', 'formtype' => 'yesno', 'valuetype' => 'int', 'default' => 1 -); +]; -$modversion['config'][] = array( +$modversion['config'][] = [ 'name' => 'max_img_width', 'title' => '_MI_MAX_IMG_WIDTH', 'description' => '_MI_MAX_IMG_WIDTH_DESC', 'formtype' => 'textbox', 'valuetype' => 'int', 'default' => 800 -); +]; -$modversion['config'][] = array( +$modversion['config'][] = [ 'name' => 'max_img_height', 'title' => '_MI_MAX_IMG_HEIGHT', 'description' => '_MI_MAX_IMG_HEIGHT_DESC', 'formtype' => 'textbox', 'valuetype' => 'int', 'default' => 640 -); +]; -$modversion['config'][] = array( +$modversion['config'][] = [ 'name' => 'max_image_width', 'title' => '_MI_MAX_IMAGE_WIDTH', 'description' => '_MI_MAX_IMAGE_WIDTH_DESC', 'formtype' => 'textbox', 'valuetype' => 'int', 'default' => 150 -); +]; -$modversion['config'][] = array( +$modversion['config'][] = [ 'name' => 'max_image_height', 'title' => '_MI_MAX_IMAGE_HEIGHT', 'description' => '_MI_MAX_IMAGE_HEIGHT_DESC', 'formtype' => 'textbox', 'valuetype' => 'int', 'default' => 150 -); +]; -$modversion['config'][] = array( +$modversion['config'][] = [ 'name' => 'wol_enabled', 'title' => '_MI_WOL_ENABLE', 'description' => '_MI_WOL_ENABLE_DESC', 'formtype' => 'yesno', 'valuetype' => 'int', 'default' => 1 -); +]; -$modversion['config'][] = array( +$modversion['config'][] = [ 'name' => 'user_level', 'title' => '_MI_USERLEVEL', 'description' => '_MI_USERLEVEL_DESC', 'formtype' => 'select', 'valuetype' => 'int', 'default' => 2, - 'options' => array( + 'options' => [ _MI_NULL => 0, _MI_TEXT => 1, _MI_GRAPHIC => 2 - ) -); + ] +]; -$modversion['config'][] = array( +$modversion['config'][] = [ 'name' => 'show_realname', 'title' => '_MI_SHOW_REALNAME', 'description' => '_MI_SHOW_REALNAME_DESC', 'formtype' => 'yesno', 'valuetype' => 'int', 'default' => 0 -); +]; -$modversion['config'][] = array( +$modversion['config'][] = [ 'name' => 'groupbar_enabled', 'title' => '_MI_GROUPBAR_ENABLE', 'description' => '_MI_GROUPBAR_ENABLE_DESC', 'formtype' => 'yesno', 'valuetype' => 'int', 'default' => 1 -); +]; -$modversion['config'][] = array( +$modversion['config'][] = [ 'name' => 'rating_enabled', 'title' => '_MI_RATING_ENABLE', 'description' => '_MI_RATING_ENABLE_DESC', 'formtype' => 'yesno', 'valuetype' => 'int', 'default' => 0 -); +]; -$modversion['config'][] = array( +$modversion['config'][] = [ 'name' => 'reportmod_enabled', 'title' => '_MI_REPORTMOD_ENABLE', 'description' => '_MI_REPORTMOD_ENABLE_DESC', 'formtype' => 'yesno', 'valuetype' => 'int', 'default' => 0 -); +]; -$modversion['config'][] = array( +$modversion['config'][] = [ 'name' => 'quickreply_enabled', 'title' => '_MI_QUICKREPLY_ENABLE', 'description' => '_MI_QUICKREPLY_ENABLE_DESC', 'formtype' => 'yesno', 'valuetype' => 'int', 'default' => 1 -); +]; -$modversion['config'][] = array( +$modversion['config'][] = [ 'name' => 'rss_enable', 'title' => '_MI_RSS_ENABLE', 'description' => '_MI_RSS_ENABLE_DESC', 'formtype' => 'yesno', 'valuetype' => 'int', 'default' => 1 -); +]; -$modversion['config'][] = array( +$modversion['config'][] = [ 'name' => 'rss_maxitems', 'title' => '_MI_RSS_MAX_ITEMS', 'description' => '', 'formtype' => 'textbox', 'valuetype' => 'int', 'default' => 10 -); +]; -$modversion['config'][] = array( +$modversion['config'][] = [ 'name' => 'rss_maxdescription', 'title' => '_MI_RSS_MAX_DESCRIPTION', 'description' => '', 'formtype' => 'textbox', 'valuetype' => 'int', 'default' => 0 -); +]; -$modversion['config'][] = array( +$modversion['config'][] = [ 'name' => 'rss_cachetime', 'title' => '_MI_RSS_CACHETIME', 'description' => '_MI_RSS_CACHETIME_DESCRIPTION', 'formtype' => 'textbox', 'valuetype' => 'int', 'default' => 30 -); +]; // 4.05 -$modversion['config'][] = array( +$modversion['config'][] = [ 'name' => 'show_infobox', 'title' => '_MI_SHOW_INFOBOX', 'description' => '_MI_SHOW_INFOBOX_DESC', 'formtype' => 'select', 'valuetype' => 'int', 'default' => 1, - 'options' => array( + 'options' => [ _MI_NEWBB_INFOBOX_NONE => 0, _MI_NEWBB_INFOBOX_HIDDEN => 1, _MI_NEWBB_INFOBOX_SHOW => 2 - ) -); + ] +]; -$modversion['config'][] = array( +$modversion['config'][] = [ 'name' => 'show_sociallinks', 'title' => '_MI_SHOW_SOCIALLINKS', 'description' => '_MI_SHOW_SOCIALLINKS_DESC', 'formtype' => 'yesno', 'valuetype' => 'int', 'default' => 1 -); +]; -$modversion['config'][] = array( +$modversion['config'][] = [ 'name' => 'show_advertising', 'title' => '_MI_ADVERTISING', 'description' => '_MI_ADVERTISING_DESC', 'formtype' => 'yesno', 'valuetype' => 'int', 'default' => 0 -); +]; -$modversion['config'][] = array( +$modversion['config'][] = [ 'name' => 'show_jump', 'title' => '_MI_SHOW_JUMPBOX', 'description' => '_MI_JUMPBOXDESC', 'formtype' => 'yesno', 'valuetype' => 'int', 'default' => 1 -); +]; -$modversion['config'][] = array( +$modversion['config'][] = [ 'name' => 'show_permissiontable', 'title' => '_MI_SHOW_PERMISSIONTABLE', 'description' => '_MI_SHOW_PERMISSIONTABLE_DESC', 'formtype' => 'yesno', 'valuetype' => 'int', 'default' => 1 -); +]; -$modversion['config'][] = array( +$modversion['config'][] = [ 'name' => 'email_digest', 'title' => '_MI_EMAIL_DIGEST', 'description' => '_MI_EMAIL_DIGEST_DESC', 'formtype' => 'select', 'valuetype' => 'int', 'default' => 0, - 'options' => array( + 'options' => [ _MI_NEWBB_EMAIL_NONE => 0, _MI_NEWBB_EMAIL_DAILY => 1, _MI_NEWBB_EMAIL_WEEKLY => 2 - ) -); + ] +]; -$modversion['config'][] = array( +$modversion['config'][] = [ 'name' => 'show_ip', 'title' => '_MI_SHOW_IP', 'description' => '_MI_SHOW_IP_DESC', 'formtype' => 'yesno', 'valuetype' => 'int', 'default' => 1 -); +]; -$modversion['config'][] = array( +$modversion['config'][] = [ 'name' => 'enable_karma', 'title' => '_MI_ENABLE_KARMA', 'description' => '_MI_ENABLE_KARMA_DESC', 'formtype' => 'yesno', 'valuetype' => 'int', 'default' => 1 -); +]; -$modversion['config'][] = array( +$modversion['config'][] = [ 'name' => 'karma_options', 'title' => '_MI_KARMA_OPTIONS', 'description' => '_MI_KARMA_OPTIONS_DESC', 'formtype' => 'textbox', 'valuetype' => 'text', 'default' => '0, 10, 50, 100, 500, 1000, 5000, 10000' -); +]; // irmtfan - add 365 = one year -$modversion['config'][] = array( +$modversion['config'][] = [ 'name' => 'since_options', 'title' => '_MI_SINCE_OPTIONS', 'description' => '_MI_SINCE_OPTIONS_DESC', 'formtype' => 'textbox', 'valuetype' => 'text', 'default' => '-1, -2, -6, -12, 0, 1, 2, 5, 10, 20, 30, 60, 100, 365' -); +]; -$modversion['config'][] = array( +$modversion['config'][] = [ 'name' => 'since_default', 'title' => '_MI_SINCE_DEFAULT', 'description' => '_MI_SINCE_DEFAULT_DESC', 'formtype' => 'textbox', 'valuetype' => 'int', 'default' => 0 -); +]; -$modversion['config'][] = array( +$modversion['config'][] = [ 'name' => 'allow_user_anonymous', 'title' => '_MI_USER_ANONYMOUS', 'description' => '_MI_USER_ANONYMOUS_DESC', 'formtype' => 'yesno', 'valuetype' => 'int', 'default' => 0 -); +]; -$modversion['config'][] = array( +$modversion['config'][] = [ 'name' => 'anonymous_prefix', 'title' => '_MI_ANONYMOUS_PRE', 'description' => '_MI_ANONYMOUS_PRE_DESC', 'formtype' => 'textbox', 'valuetype' => 'text', 'default' => $GLOBALS['xoopsConfig']['anonymous'] . '-' -); +]; -$modversion['config'][] = array( +$modversion['config'][] = [ 'name' => 'allow_require_reply', 'title' => '_MI_REQUIRE_REPLY', 'description' => '_MI_REQUIRE_REPLY_DESC', 'formtype' => 'yesno', 'valuetype' => 'int', 'default' => 0 -); +]; -$modversion['config'][] = array( +$modversion['config'][] = [ 'name' => 'edit_timelimit', 'title' => '_MI_EDIT_TIMELIMIT', 'description' => '_MI_EDIT_TIMELIMIT_DESC', 'formtype' => 'textbox', 'valuetype' => 'int', 'default' => 60 -); +]; -$modversion['config'][] = array( +$modversion['config'][] = [ 'name' => 'recordedit_timelimit', 'title' => '_MI_RECORDEDIT_TIMELIMIT', 'description' => '_MI_RECORDEDIT_TIMELIMIT_DESC', 'formtype' => 'textbox', 'valuetype' => 'int', 'default' => 15 -); +]; -$modversion['config'][] = array( +$modversion['config'][] = [ 'name' => 'delete_timelimit', 'title' => '_MI_DELETE_TIMELIMIT', 'description' => '_MI_DELETE_TIMELIMIT_DESC', 'formtype' => 'textbox', 'valuetype' => 'int', 'default' => 60 -); +]; -$modversion['config'][] = array( +$modversion['config'][] = [ 'name' => 'post_timelimit', 'title' => '_MI_POST_TIMELIMIT', 'description' => '_MI_POST_TIMELIMIT_DESC', 'formtype' => 'textbox', 'valuetype' => 'int', 'default' => 30 -); +]; -$modversion['config'][] = array( +$modversion['config'][] = [ 'name' => 'enable_permcheck', 'title' => '_MI_PERMCHECK_ONDISPLAY', 'description' => '_MI_PERMCHECK_ONDISPLAY_DESC', 'formtype' => 'yesno', 'valuetype' => 'int', 'default' => 1 -); +]; -$modversion['config'][] = array( +$modversion['config'][] = [ 'name' => 'enable_usermoderate', 'title' => '_MI_USERMODERATE', 'description' => '_MI_USERMODERATE_DESC', 'formtype' => 'yesno', 'valuetype' => 'int', 'default' => 0 -); +]; -$modversion['config'][] = array( +$modversion['config'][] = [ 'name' => 'disc_show', 'title' => '_MI_SHOW_DIS', 'description' => '_MI_SHOW_DIS_DESC', 'formtype' => 'select', 'valuetype' => 'int', 'default' => 0, - 'options' => array( + 'options' => [ _NONE => 0, _MI_POST => 1, _MI_REPLY => 2, _MI_OP_BOTH => 3 - ) -); + ] +]; -$modversion['config'][] = array( +$modversion['config'][] = [ 'name' => 'disclaimer', 'title' => '_MI_DISCLAIMER', 'description' => '_MI_DISCLAIMER_DESC', 'formtype' => 'textarea', 'valuetype' => 'text', 'default' => _MI_DISCLAIMER_TEXT -); +]; xoops_load('XoopsRequest'); -$forum_options = array(_NONE => 0); +$forum_options = [_NONE => 0]; if ($isModuleAction && 'update_ok' === XoopsRequest::getCmd('op', '', 'POST')) { $forumHandler = xoops_getModuleHandler('forum', 'newbb', true); - if ($forums = $forumHandler->getForumsByCategory(0, 'access', false, array('parent_forum', 'cat_id', 'forum_name'))) { + if ($forums = $forumHandler->getForumsByCategory(0, 'access', false, ['parent_forum', 'cat_id', 'forum_name'])) { foreach (array_keys($forums) as $c) { foreach (array_keys($forums[$c]) as $f) { $forum_options[$forums[$c][$f]['title']] = $f; @@ -775,7 +775,7 @@ unset($forums); } } -$modversion['config'][] = array( +$modversion['config'][] = [ 'name' => 'welcome_forum', 'title' => '_MI_WELCOMEFORUM', 'description' => '_MI_WELCOMEFORUM_DESC', @@ -783,9 +783,9 @@ 'valuetype' => 'int', 'default' => 0, 'options' => $forum_options -); +]; // START irmtfan add a poll_module config -$pollDirs = array(); +$pollDirs = []; $dir_def = 0; $formtype = 'select'; // if in install, update @@ -812,7 +812,7 @@ is_object($GLOBALS['xoopsModule']) && 'system' === $GLOBALS['xoopsModule']->getVar('dirname', 'n') && // current action !empty($_REQUEST['fct']) - && $_REQUEST['fct'] === 'preferences'); + && 'preferences' === $_REQUEST['fct']); xoops_loadLanguage('admin', $modversion['dirname']); // if in pref AND click on save AND 'poll_module' !== 0 if ($isPref && XoopsRequest::getInt('poll_module', 0, 'POST')) { @@ -820,10 +820,10 @@ $criteria = new CriteriaCompo(); $criteria->add(new Criteria('conf_name', 'poll_module', '='), 'AND'); $criteria->add(new Criteria('conf_formtype', 'select', '='), 'AND'); // not hidden - $criteria->add(new Criteria('conf_id', '(' . implode(', ', XoopsRequest::getArray('conf_ids', array(), 'POST')) . ')', 'IN'), 'AND'); + $criteria->add(new Criteria('conf_id', '(' . implode(', ', XoopsRequest::getArray('conf_ids', [], 'POST')) . ')', 'IN'), 'AND'); $pollOptions = $hModConfig->getConfigs($criteria); $pollOptions = end($pollOptions); - if (is_object($pollOptions) && $pollOptions->getVar('conf_value') !== '0') { + if (is_object($pollOptions) && '0' !== $pollOptions->getVar('conf_value')) { $topicHandler = xoops_getModuleHandler('topic', $modversion['dirname']); $topicPolls = $topicHandler->getCount(new Criteria('topic_haspoll', 1)); if ($topicPolls > 0) { @@ -853,7 +853,7 @@ // END irmtfan add a poll_module config // Notification -$modversion['notification'] = array(); +$modversion['notification'] = []; $modversion['hasNotification'] = 1; $modversion['notification']['lookup_file'] = 'include/notification.inc.php'; $modversion['notification']['lookup_func'] = 'newbb_notify_iteminfo';
@@ -104,7 +104,7 @@ <{if $subforum_display == "expand"}> - <{foreachq item=forum from=$category.forums}> + <{foreach item=forum from=$category.forums}>
   
 
<{$smarty.const._MD_SUBFORUMS}>  <{$img_subforum}>  - <{foreachq item=subforum from=$forum.subforum}> + <{foreach item=subforum from=$forum.subforum}>  [<{$subforum.forum_name}>] <{/foreach}> @@ -296,7 +296,7 @@ <{else}> - <{foreachq item=forum from=$category.forums}> + <{foreach item=forum from=$category.forums}>

<{$online.num_user}> <{$smarty.const._MD_REGISTERED_USERS}> - <{foreachq item=user from=$online.users}> + <{foreach item=user from=$online.users}> <{if $user.level eq 2}> <{$user.uname}> diff --git a/templates/newbb_poll_results.tpl b/templates/newbb_poll_results.tpl index cb17772b..aef211c9 100644 --- a/templates/newbb_poll_results.tpl +++ b/templates/newbb_poll_results.tpl @@ -13,7 +13,7 @@ <{*-- irmtfan hardcode removed align="right" --*}>
<{$poll.end_text}>
<{$option.text}> <{$poll.question}>
<{$option.input}> <{if $topic_post.thread_action}> - <{foreachq item=btn from=$topic_post.thread_action}> + <{foreach item=btn from=$topic_post.thread_action}> <{else}> <{if $topic_post.thread_buttons}> - <{foreachq item=btn from=$topic_post.thread_buttons}> + <{foreach item=btn from=$topic_post.thread_buttons}> <{$btn.image}> diff --git a/templates/newbb_viewall.tpl b/templates/newbb_viewall.tpl index 66faa04a..f72b3480 100644 --- a/templates/newbb_viewall.tpl +++ b/templates/newbb_viewall.tpl @@ -194,7 +194,7 @@
diff --git a/templates/newbb_viewforum.tpl b/templates/newbb_viewforum.tpl index 6c67e3cc..3e13f5c1 100644 --- a/templates/newbb_viewforum.tpl +++ b/templates/newbb_viewforum.tpl @@ -7,7 +7,7 @@ » <{$category.title}> <{if $parentforum}> - <{foreachq item=forum from=$parentforum}> + <{foreach item=forum from=$parentforum}> » <{$forum.forum_name}> <{/foreach}> @@ -145,7 +145,7 @@ - <{foreachq name=loop item=topic from=$topics}> + <{foreach name=loop item=topic from=$topics}> <{if $topic.stick AND $smarty.foreach.loop.iteration == $sticky+1}>
<{$smarty.const._MD_LASTPOST}>
<{$sforum.forum_folder}> diff --git a/templates/newbb_viewpost.tpl b/templates/newbb_viewpost.tpl index b7b6c84b..26df4abc 100644 --- a/templates/newbb_viewpost.tpl +++ b/templates/newbb_viewpost.tpl @@ -84,7 +84,7 @@ onchange="if(this.options[this.selectedIndex].value.length >0 ) { window.document.location=this.options[this.selectedIndex].value;}" > - <{foreachq item=act from=$viewmode_options}> + <{foreach item=act from=$viewmode_options}> <{/foreach}> @@ -99,7 +99,7 @@

-<{foreachq item=post from=$posts}> +<{foreach item=post from=$posts}> <{includeq file="db:newbb_thread.tpl" topic_post=$post}>
" . $action[$mode]['desc'] . '
' . _MD_MOVETOPICTO . ''; $box = '
' . _MD_MERGETOPICTO . ''; echo _MD_TOPIC . "ID-$topic_id -> ID: "; echo '