Skip to content

Commit c0603bc

Browse files
authored
Merge pull request #55 from mambax7/master
4.33 Final
2 parents b6319e8 + 680272f commit c0603bc

File tree

131 files changed

+1358
-1347
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

131 files changed

+1358
-1347
lines changed

action.post.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
$uid = XoopsRequest::getInt('uid', 0, 'GET');
1616

1717
$op = XoopsRequest::getCmd('op', XoopsRequest::getCmd('op', '', 'POST'), 'GET');
18-
$op = in_array($op, array('approve', 'delete', 'restore', 'split'), true) ? $op : '';
18+
$op = in_array($op, ['approve', 'delete', 'restore', 'split'], true) ? $op : '';
1919
$mode = XoopsRequest::getInt('mode', 1, 'GET');
2020

2121
if (0 === count($post_id) || 0 === count($op)) {
@@ -43,8 +43,8 @@
4343
case 'restore':
4444
$post_id = array_values($post_id);
4545
sort($post_id);
46-
$topics = array();
47-
$forums = array();
46+
$topics = [];
47+
$forums = [];
4848
foreach ($post_id as $post) {
4949
$post_obj = $postHandler->get($post);
5050
if ($post_obj->getVar('topic_id') < 1) {
@@ -65,8 +65,8 @@
6565
case 'approve':
6666
$post_id = array_values($post_id);
6767
sort($post_id);
68-
$topics = array();
69-
$forums = array();
68+
$topics = [];
69+
$forums = [];
7070
$criteria = new Criteria('post_id', '(' . implode(',', $post_id) . ')', 'IN');
7171
$posts_obj = $postHandler->getObjects($criteria, true);
7272
foreach ($post_id as $post) {
@@ -98,7 +98,7 @@
9898
include_once __DIR__ . '/include/notification.inc.php';
9999
$notificationHandler = xoops_getHandler('notification');
100100
foreach ($post_id as $post) {
101-
$tags = array();
101+
$tags = [];
102102
$tags['THREAD_NAME'] = $topic_list[$posts_obj[$post]->getVar('topic_id')];
103103
$tags['THREAD_URL'] = XOOPS_URL
104104
. '/modules/'
@@ -122,8 +122,8 @@
122122
case 'delete':
123123
$post_id = array_values($post_id);
124124
rsort($post_id);
125-
$topics = array();
126-
$forums = array();
125+
$topics = [];
126+
$forums = [];
127127
foreach ($post_id as $post) {
128128
$post_obj = $postHandler->get($post);
129129
if (!empty($topic_id) && $topic_id !== $post_obj->getVar('topic_id')) {
@@ -165,12 +165,12 @@
165165
$postHandler->insert($post_obj);
166166

167167
/* split a single post */
168-
if ($mode === 1) {
168+
if (1 === $mode) {
169169
$criteria = new CriteriaCompo(new Criteria('topic_id', $topic_id));
170170
$criteria->add(new Criteria('pid', $post_id));
171171
$postHandler->updateAll('pid', $pid, $criteria, true);
172172
/* split a post and its children posts */
173-
} elseif ($mode === 2) {
173+
} elseif (2 === $mode) {
174174
include_once $GLOBALS['xoops']->path('class/xoopstree.php');
175175
$mytree = new XoopsTree($GLOBALS['xoopsDB']->prefix('bb_posts'), 'post_id', 'pid');
176176
$posts = $mytree->getAllChildId($post_id);
@@ -179,7 +179,7 @@
179179
$postHandler->updateAll('topic_id', $new_topic_id, $criteria, true);
180180
}
181181
/* split a post and all posts coming after */
182-
} elseif ($mode === 3) {
182+
} elseif (3 === $mode) {
183183
$criteria = new CriteriaCompo(new Criteria('topic_id', $topic_id));
184184
$criteria->add(new Criteria('post_id', $post_id, '>'));
185185
$postHandler->updateAll('topic_id', $new_topic_id, $criteria, true);
@@ -191,7 +191,7 @@
191191
$posts = $postHandler->getList($criteria);
192192

193193
unset($criteria);
194-
$post_update = array();
194+
$post_update = [];
195195
foreach ($posts as $postid => $pid) {
196196
// if (!in_array($pid, array_keys($posts))) {
197197
if (!array_key_exists($pid, $posts)) {

action.topic.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
$topic_id = XoopsRequest::getArray('topic_id', null, 'POST');
1515

1616
$op = XoopsRequest::getCmd('op', '', 'POST');
17-
$op = in_array($op, array('approve', 'delete', 'restore', 'move'), true) ? $op : '';
17+
$op = in_array($op, ['approve', 'delete', 'restore', 'move'], true) ? $op : '';
1818

1919
if (0 === count($topic_id) || 0 === count($op)) {
2020
// irmtfan - issue with javascript:history.go(-1)
@@ -32,7 +32,7 @@
3232
}
3333
switch ($op) {
3434
case 'restore':
35-
$forums = array();
35+
$forums = [];
3636
$topics_obj = $topicHandler->getAll(new Criteria('topic_id', '(' . implode(',', $topic_id) . ')', 'IN'));
3737
foreach (array_keys($topics_obj) as $id) {
3838
$topic_obj =& $topics_obj[$id];
@@ -48,7 +48,7 @@
4848
unset($topics_obj, $forums_obj);
4949
break;
5050
case 'approve':
51-
$forums = array();
51+
$forums = [];
5252
$topics_obj = $topicHandler->getAll(new Criteria('topic_id', '(' . implode(',', $topic_id) . ')', 'IN'));
5353
foreach (array_keys($topics_obj) as $id) {
5454
$topic_obj =& $topics_obj[$id];
@@ -71,7 +71,7 @@
7171
$notificationHandler = xoops_getHandler('notification');
7272
foreach (array_keys($topics_obj) as $id) {
7373
$topic_obj =& $topics_obj[$id];
74-
$tags = array();
74+
$tags = [];
7575
$tags['THREAD_NAME'] = $topic_obj->getVar('topic_title');
7676
$tags['THREAD_URL'] = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/viewtopic.php?topic_id=' . $id . '&amp;forum=' . $topic_obj->getVar('forum_id');
7777
$tags['FORUM_NAME'] = $forums_obj[$topic_obj->getVar('forum_id')]->getVar('forum_name');
@@ -92,7 +92,7 @@
9292
unset($topics_obj, $forums_obj);
9393
break;
9494
case 'delete':
95-
$forums = array();
95+
$forums = [];
9696
$topics_obj = $topicHandler->getAll(new Criteria('topic_id', '(' . implode(',', $topic_id) . ')', 'IN'));
9797
foreach (array_keys($topics_obj) as $id) {
9898
$topic_obj =& $topics_obj[$id];

admin/admin_cat_manager.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ function editCategory(XoopsObject $category_obj = null)
123123

124124
case 'del':
125125
if (!XoopsRequest::getBool('confirm', '', 'POST')) {
126-
xoops_confirm(array('op' => 'del', 'cat_id' => XoopsRequest::getInt('cat_id', 0, 'GET'), 'confirm' => 1), 'admin_cat_manager.php', _AM_NEWBB_WAYSYWTDTTAL);
126+
xoops_confirm(['op' => 'del', 'cat_id' => XoopsRequest::getInt('cat_id', 0, 'GET'), 'confirm' => 1], 'admin_cat_manager.php', _AM_NEWBB_WAYSYWTDTTAL);
127127
break;
128128
} else {
129129
$category_obj = $categoryHandler->create(false);
@@ -184,9 +184,9 @@ function editCategory(XoopsObject $category_obj = null)
184184
echo '</tr>';
185185

186186
foreach ($categories as $key => $onecat) {
187-
$cat_edit_link = "<a href=\"admin_cat_manager.php?op=mod&cat_id=" . $onecat->getVar('cat_id') . "\">" . newbbDisplayImage('admin_edit', _EDIT) . '</a>';
188-
$cat_del_link = "<a href=\"admin_cat_manager.php?op=del&cat_id=" . $onecat->getVar('cat_id') . "\">" . newbbDisplayImage('admin_delete', _DELETE) . '</a>';
189-
$cat_title_link = "<a href=\"" . XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/index.php?cat=' . $onecat->getVar('cat_id') . "\">" . $onecat->getVar('cat_title') . '</a>';
187+
$cat_edit_link = '<a href="admin_cat_manager.php?op=mod&cat_id=' . $onecat->getVar('cat_id') . '">' . newbbDisplayImage('admin_edit', _EDIT) . '</a>';
188+
$cat_del_link = '<a href="admin_cat_manager.php?op=del&cat_id=' . $onecat->getVar('cat_id') . '">' . newbbDisplayImage('admin_delete', _DELETE) . '</a>';
189+
$cat_title_link = '<a href="' . XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/index.php?cat=' . $onecat->getVar('cat_id') . '">' . $onecat->getVar('cat_title') . '</a>';
190190

191191
echo "<tr class='odd' align='left'>";
192192
echo '<td>' . $cat_title_link . '</td>';

admin/admin_digest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
case 'delete':
4444
$digest_ids = XoopsRequest::getArray('digest_id', '', 'POST');
4545
$digestHandler = xoops_getModuleHandler('digest', 'newbb');
46-
if ($digest_ids !== '') {
46+
if ('' !== $digest_ids) {
4747
foreach ($digest_ids as $did => $value) {
4848
$digestHandler->delete($did);
4949
}
@@ -66,7 +66,7 @@
6666
echo "<td class='bg3' width='2%'>" . _DELETE . '</td>';
6767
echo '</tr>';
6868

69-
$digests = array();
69+
$digests = [];
7070
$digestHandler = xoops_getModuleHandler('digest', 'newbb');
7171
$digests = $digestHandler->getAllDigests($start, $limit);
7272
foreach ($digests as $digest) {

admin/admin_forum_manager.php

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,12 @@
4848
if (XoopsRequest::getInt('dest_forum', 0, 'POST')) {
4949
$dest = XoopsRequest::getInt('dest_forum', 0, 'POST');
5050
if ($dest > 0) {
51-
$pid = (int)$dest;
51+
$pid = $dest;
5252
$forum_dest = $forumHandler->get($pid);
5353
$cid = $forum_dest->getVar('cat_id');
5454
unset($forum_dest);
5555
} else {
56-
$cid = abs((int)$dest);
56+
$cid = abs($dest);
5757
$pid = 0;
5858
}
5959
$forum_obj = $forumHandler->get($forum_id);
@@ -152,13 +152,13 @@
152152
$forum_obj->setVar('forum_name', XoopsRequest::getString('forum_name', '', 'POST'));
153153
$forum_obj->setVar('forum_desc', XoopsRequest::getString('forum_desc', '', 'POST'));
154154
$forum_obj->setVar('forum_order', XoopsRequest::getInt('forum_order', 0, 'POST'));
155-
$forum_obj->setVar('forum_moderator', XoopsRequest::getArray('forum_moderator', array(), 'POST'));
155+
$forum_obj->setVar('forum_moderator', XoopsRequest::getArray('forum_moderator', [], 'POST'));
156156
$forum_obj->setVar('parent_forum', XoopsRequest::getInt('parent_forum', 0, 'POST'));
157157
$forum_obj->setVar('attach_maxkb', XoopsRequest::getInt('attach_maxkb', 0, 'POST'));
158158
$forum_obj->setVar('attach_ext', XoopsRequest::getString('attach_ext', '', 'POST'));
159159
$forum_obj->setVar('hot_threshold', XoopsRequest::getInt('hot_threshold', 0, 'POST'));
160160
if (XoopsRequest::getInt('parent_forum', 0, 'POST')) {
161-
$parent_obj = $forumHandler->get(XoopsRequest::getInt('parent_forum', 0, 'POST'), array('cat_id'));
161+
$parent_obj = $forumHandler->get(XoopsRequest::getInt('parent_forum', 0, 'POST'), ['cat_id']);
162162
$_POST['cat_id'] = $parent_obj->getVar('cat_id');
163163
}
164164
$forum_obj->setVar('cat_id', XoopsRequest::getInt('cat_id', 0, 'POST'));
@@ -202,7 +202,7 @@
202202

203203
case 'del':
204204
if (1 !== XoopsRequest::getInt('confirm', 0, 'POST')) {
205-
xoops_confirm(array('op' => 'del', 'forum' => XoopsRequest::getInt('forum', 0, 'GET'), 'confirm' => 1), 'admin_forum_manager.php', _AM_NEWBB_TWDAFAP);
205+
xoops_confirm(['op' => 'del', 'forum' => XoopsRequest::getInt('forum', 0, 'GET'), 'confirm' => 1], 'admin_forum_manager.php', _AM_NEWBB_TWDAFAP);
206206
break;
207207
} else {
208208
$forum_obj = $forumHandler->get(XoopsRequest::getInt('forum', 0, 'POST'));
@@ -261,10 +261,10 @@
261261
foreach (array_keys($categories) as $c) {
262262
$category = $categories[$c];
263263
$cat_id = $c;
264-
$cat_link = "<a href=\"" . XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname', 'n') . '/index.php?viewcat=' . $cat_id . "\">" . $category . '</a>';
265-
$cat_edit_link = "<a href=\"admin_cat_manager.php?op=mod&amp;cat_id=" . $cat_id . "\">" . newbbDisplayImage('admin_edit', _EDIT) . '</a>';
266-
$cat_del_link = "<a href=\"admin_cat_manager.php?op=del&amp;cat_id=" . $cat_id . "\">" . newbbDisplayImage('admin_delete', _DELETE) . '</a>';
267-
$forum_add_link = "<a href=\"admin_forum_manager.php?op=addforum&amp;cat_id=" . $cat_id . "\">" . newbbDisplayImage('new_forum') . '</a>';
264+
$cat_link = '<a href="' . XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname', 'n') . '/index.php?viewcat=' . $cat_id . '">' . $category . '</a>';
265+
$cat_edit_link = '<a href="admin_cat_manager.php?op=mod&amp;cat_id=' . $cat_id . '">' . newbbDisplayImage('admin_edit', _EDIT) . '</a>';
266+
$cat_del_link = '<a href="admin_cat_manager.php?op=del&amp;cat_id=' . $cat_id . '">' . newbbDisplayImage('admin_delete', _DELETE) . '</a>';
267+
$forum_add_link = '<a href="admin_forum_manager.php?op=addforum&amp;cat_id=' . $cat_id . '">' . newbbDisplayImage('new_forum') . '</a>';
268268
$echo .= "<tr class='even' align='left'>";
269269
$echo .= "<td width='100%' colspan='2'><strong>" . $cat_link . '</strong></td>';
270270
$echo .= "<td align='center'>" . $cat_edit_link . '</td>';
@@ -279,12 +279,12 @@
279279
$i = 0;
280280
foreach (array_keys($forums[$c]) as $f) {
281281
$forum = $forums[$c][$f];
282-
$f_link = $forum['prefix'] . "<a href=\"" . XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname', 'n') . '/viewforum.php?forum=' . $f . "\">" . $forum['forum_name'] . '</a>';
283-
$f_edit_link = "<a href=\"admin_forum_manager.php?op=mod&amp;forum=" . $f . "\">" . newbbDisplayImage('admin_edit', _AM_NEWBB_EDIT) . '</a>';
284-
$f_del_link = "<a href=\"admin_forum_manager.php?op=del&amp;forum=" . $f . "\">" . newbbDisplayImage('admin_delete', _AM_NEWBB_DELETE) . '</a>';
285-
$sf_add_link = "<a href=\"admin_forum_manager.php?op=addforum&amp;cat_id=" . $c . '&forum=' . $f . "\">" . newbbDisplayImage('new_forum', _AM_NEWBB_CREATEFORUM) . '</a>';
286-
$f_move_link = "<a href=\"admin_forum_manager.php?op=moveforum&amp;forum=" . $f . "\">" . newbbDisplayImage('admin_move', _AM_NEWBB_MOVE) . '</a>';
287-
$f_merge_link = "<a href=\"admin_forum_manager.php?op=mergeforum&amp;forum=" . $f . "\">" . newbbDisplayImage('admin_merge', _AM_NEWBB_MERGE) . '</a>';
282+
$f_link = $forum['prefix'] . '<a href="' . XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname', 'n') . '/viewforum.php?forum=' . $f . '">' . $forum['forum_name'] . '</a>';
283+
$f_edit_link = '<a href="admin_forum_manager.php?op=mod&amp;forum=' . $f . '">' . newbbDisplayImage('admin_edit', _AM_NEWBB_EDIT) . '</a>';
284+
$f_del_link = '<a href="admin_forum_manager.php?op=del&amp;forum=' . $f . '">' . newbbDisplayImage('admin_delete', _AM_NEWBB_DELETE) . '</a>';
285+
$sf_add_link = '<a href="admin_forum_manager.php?op=addforum&amp;cat_id=' . $c . '&forum=' . $f . '">' . newbbDisplayImage('new_forum', _AM_NEWBB_CREATEFORUM) . '</a>';
286+
$f_move_link = '<a href="admin_forum_manager.php?op=moveforum&amp;forum=' . $f . '">' . newbbDisplayImage('admin_move', _AM_NEWBB_MOVE) . '</a>';
287+
$f_merge_link = '<a href="admin_forum_manager.php?op=mergeforum&amp;forum=' . $f . '">' . newbbDisplayImage('admin_merge', _AM_NEWBB_MERGE) . '</a>';
288288

289289
$class = (($i++) % 2) ? 'odd' : 'even';
290290
$echo .= "<tr class='" . $class . "' align='left'><td></td>";

admin/admin_forum_prune.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -77,18 +77,18 @@
7777
if ($lock) {
7878
$sql .= ' AND t.topic_status <> 1 ';
7979
}
80-
if ($hot !== 0) {
80+
if (0 !== $hot) {
8181
$sql .= ' AND t.topic_replies < ' . $hot . ' ';
8282
}
8383

8484
$sql .= ' AND p.post_time<= ' . $prune_ddays . ' ';
8585
// Ok now we have the sql query completed, go for topic_id's and posts_id's
86-
$topics = array();
86+
$topics = [];
8787
if (!$result = $GLOBALS['xoopsDB']->query($sql)) {
8888
return _MD_ERROR;
8989
}
9090
// Dave_L code
91-
while ($row = $GLOBALS['xoopsDB']->fetchArray($result)) {
91+
while (false !== ($row = $GLOBALS['xoopsDB']->fetchArray($result))) {
9292
$topics[] = $row['topic_id'];
9393
}
9494
$topics_number = count($topics);
@@ -98,12 +98,12 @@
9898
if ('' !== $topic_list) {
9999
$sql = 'SELECT post_id FROM ' . $GLOBALS['xoopsDB']->prefix('bb_posts') . ' WHERE topic_id IN (' . $topic_list . ')';
100100

101-
$posts = array();
101+
$posts = [];
102102
if (!$result = $GLOBALS['xoopsDB']->query($sql)) {
103103
return _MD_ERROR;
104104
}
105105
// Dave_L code
106-
while ($row = $GLOBALS['xoopsDB']->fetchArray($result)) {
106+
while (false !== ($row = $GLOBALS['xoopsDB']->fetchArray($result))) {
107107
$posts[] = $row['post_id'];
108108
}
109109
$posts_number = count($posts);
@@ -124,7 +124,7 @@
124124
}
125125
} else {
126126
// ARCHIVING POSTS
127-
if ($archive == 1) {
127+
if (1 == $archive) {
128128
$result = $GLOBALS['xoopsDB']->query('SELECT p.topic_id, p.post_id, t.post_text FROM '
129129
. $GLOBALS['xoopsDB']->prefix('bb_posts')
130130
. ' p, '
@@ -172,15 +172,15 @@
172172
// $result = $GLOBALS['xoopsDB']->query();
173173
// Days selected by selbox (better error control :lol:)
174174
$days = new XoopsFormSelect(_AM_NEWBB_PRUNE_DAYS, 'days', null, 1, false);
175-
$days->addOptionArray(array(
175+
$days->addOptionArray([
176176
604800 => _AM_NEWBB_PRUNE_WEEK,
177177
1209600 => _AM_NEWBB_PRUNE_2WEEKS,
178178
2592000 => _AM_NEWBB_PRUNE_MONTH,
179179
5184000 => _AM_NEWBB_PRUNE_2MONTH,
180180
10368000 => _AM_NEWBB_PRUNE_4MONTH,
181181
31536000 => _AM_NEWBB_PRUNE_YEAR,
182182
63072000 => _AM_NEWBB_PRUNE_2YEARS
183-
));
183+
]);
184184
$sform->addElement($days);
185185
// START irmtfan remove hardcode db access
186186
include_once $GLOBALS['xoops']->path('modules/' . $xoopsModule->getVar('dirname') . '/footer.php'); // to include js files
@@ -202,7 +202,7 @@
202202
do {
203203
$checkbox->addOption($myrow['forum_id'], $myrow['forum_name']);
204204
$radiobox->addOption($myrow['forum_id'], $myrow['forum_name']);
205-
} while ($myrow = $GLOBALS['xoopsDB']->fetchArray($result));
205+
} while (false !== ($myrow = $GLOBALS['xoopsDB']->fetchArray($result);
206206
} else {
207207
echo "NO FORUMS";
208208
}
@@ -231,15 +231,15 @@
231231
$sform->addElement($lock_confirmation);
232232

233233
$hot_confirmation = new XoopsFormSelect(_AM_NEWBB_PRUNE_HOT, 'hot', null, 1, false);
234-
$hot_confirmation->addOptionArray(array(
234+
$hot_confirmation->addOptionArray([
235235
'0' => 0,
236236
'5' => 5,
237237
'10' => 10,
238238
'15' => 15,
239239
'20' => 20,
240240
'25' => 25,
241241
'30' => 30
242-
));
242+
]);
243243
$sform->addElement($hot_confirmation);
244244

245245
$sform->addElement(/*$radiobox*/

admin/admin_forum_reorder.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,10 @@
5353
redirect_header('admin_forum_reorder.php', 1, _AM_NEWBB_BOARDREORDER);
5454
} else {
5555
include_once $GLOBALS['xoops']->path('modules/' . $xoopsModule->getVar('dirname') . '/class/xoopsformloader.php');
56-
$orders = array();
57-
$cat_orders = array();
58-
$forum = array();
59-
$cat = array();
56+
$orders = [];
57+
$cat_orders = [];
58+
$forum = [];
59+
$cat = [];
6060

6161
xoops_cp_header();
6262
echo '<fieldset>';
@@ -77,7 +77,7 @@
7777
$categoryHandler = xoops_getModuleHandler('category', 'newbb');
7878
$criteriaCategory = new CriteriaCompo(new criteria('1', 1));
7979
$criteriaCategory->setSort('cat_order');
80-
$categories = $categoryHandler->getAll($criteriaCategory, array('cat_id', 'cat_order', 'cat_title'));
80+
$categories = $categoryHandler->getAll($criteriaCategory, ['cat_id', 'cat_order', 'cat_title']);
8181
$forums = $forumHandler->getTree(array_keys($categories), 0, 'all', '&nbsp;&nbsp;&nbsp;&nbsp;');
8282
foreach (array_keys($categories) as $c) {
8383
echo '<tr>';

0 commit comments

Comments
 (0)