@@ -86,7 +86,7 @@ |
||
| 86 | 86 | $smcFunc['db_free_result']($result_boards); |
| 87 | 87 | |
| 88 | 88 | // Run through the categories and boards (or only boards).... |
| 89 | - for (reset($row_boards); key($row_boards)!==null; next($row_boards)) |
|
| 89 | + for (reset($row_boards); key($row_boards) !== null; next($row_boards)) |
|
| 90 | 90 | { |
| 91 | 91 | $row_board = current($row_boards); |
| 92 | 92 | |
@@ -14,8 +14,9 @@ discard block |
||
| 14 | 14 | * @version 2.1 Beta 4 |
| 15 | 15 | */ |
| 16 | 16 | |
| 17 | -if (!defined('SMF')) |
|
| 17 | +if (!defined('SMF')) { |
|
| 18 | 18 | die('No direct access...'); |
| 19 | +} |
|
| 19 | 20 | |
| 20 | 21 | /** |
| 21 | 22 | * Fetches a list of boards and (optional) categories including |
@@ -37,15 +38,17 @@ discard block |
||
| 37 | 38 | require_once($sourcedir . '/Subs-Boards.php'); |
| 38 | 39 | |
| 39 | 40 | // For performance, track the latest post while going through the boards. |
| 40 | - if (!empty($boardIndexOptions['set_latest_post'])) |
|
| 41 | - $latest_post = array( |
|
| 41 | + if (!empty($boardIndexOptions['set_latest_post'])) { |
|
| 42 | + $latest_post = array( |
|
| 42 | 43 | 'timestamp' => 0, |
| 43 | 44 | 'ref' => 0, |
| 44 | 45 | ); |
| 46 | + } |
|
| 45 | 47 | |
| 46 | 48 | // This setting is not allowed to be empty |
| 47 | - if (empty($modSettings['boardindex_max_depth'])) |
|
| 48 | - $modSettings['boardindex_max_depth'] = 1; |
|
| 49 | + if (empty($modSettings['boardindex_max_depth'])) { |
|
| 50 | + $modSettings['boardindex_max_depth'] = 1; |
|
| 51 | + } |
|
| 49 | 52 | |
| 50 | 53 | // Find all boards and categories, as well as related information. This will be sorted by the natural order of boards and categories, which we control. |
| 51 | 54 | $result_boards = $smcFunc['db_query']('', ' |
@@ -78,16 +81,18 @@ discard block |
||
| 78 | 81 | ); |
| 79 | 82 | |
| 80 | 83 | // Start with an empty array. |
| 81 | - if ($boardIndexOptions['include_categories']) |
|
| 82 | - $categories = array(); |
|
| 83 | - else |
|
| 84 | - $this_category = array(); |
|
| 84 | + if ($boardIndexOptions['include_categories']) { |
|
| 85 | + $categories = array(); |
|
| 86 | + } else { |
|
| 87 | + $this_category = array(); |
|
| 88 | + } |
|
| 85 | 89 | $boards = array(); |
| 86 | 90 | |
| 87 | 91 | // Children can affect parents, so we need to gather all the boards first and then process them after. |
| 88 | 92 | $row_boards = array(); |
| 89 | - while ($row_board = $smcFunc['db_fetch_assoc']($result_boards)) |
|
| 90 | - $row_boards[$row_board['id_board']] = $row_board; |
|
| 93 | + while ($row_board = $smcFunc['db_fetch_assoc']($result_boards)) { |
|
| 94 | + $row_boards[$row_board['id_board']] = $row_board; |
|
| 95 | + } |
|
| 91 | 96 | $smcFunc['db_free_result']($result_boards); |
| 92 | 97 | |
| 93 | 98 | // Run through the categories and boards (or only boards).... |
@@ -100,8 +105,9 @@ discard block |
||
| 100 | 105 | $row_board['is_read'] = !empty($row_board['is_read']) || $ignoreThisBoard ? '1' : '0'; |
| 101 | 106 | |
| 102 | 107 | // Add parent boards to the $boards list later used to fetch moderators |
| 103 | - if ($row_board['id_parent'] == $boardIndexOptions['parent_id']) |
|
| 104 | - $boards[] = $row_board['id_board']; |
|
| 108 | + if ($row_board['id_parent'] == $boardIndexOptions['parent_id']) { |
|
| 109 | + $boards[] = $row_board['id_board']; |
|
| 110 | + } |
|
| 105 | 111 | |
| 106 | 112 | if ($boardIndexOptions['include_categories']) |
| 107 | 113 | { |
@@ -123,8 +129,9 @@ discard block |
||
| 123 | 129 | } |
| 124 | 130 | |
| 125 | 131 | // If this board has new posts in it (and isn't the recycle bin!) then the category is new. |
| 126 | - if (empty($modSettings['recycle_enable']) || $modSettings['recycle_board'] != $row_board['id_board']) |
|
| 127 | - $categories[$row_board['id_cat']]['new'] |= empty($row_board['is_read']); |
|
| 132 | + if (empty($modSettings['recycle_enable']) || $modSettings['recycle_board'] != $row_board['id_board']) { |
|
| 133 | + $categories[$row_board['id_cat']]['new'] |= empty($row_board['is_read']); |
|
| 134 | + } |
|
| 128 | 135 | |
| 129 | 136 | // Avoid showing category unread link where it only has redirection boards. |
| 130 | 137 | $categories[$row_board['id_cat']]['show_unread'] = !empty($categories[$row_board['id_cat']]['show_unread']) ? 1 : !$row_board['is_redirect']; |
@@ -143,8 +150,9 @@ discard block |
||
| 143 | 150 | $isChild = false; |
| 144 | 151 | |
| 145 | 152 | // We might or might not have already added this board, so... |
| 146 | - if (!isset($this_category[$row_board['id_board']])) |
|
| 147 | - $this_category[$row_board['id_board']] = array(); |
|
| 153 | + if (!isset($this_category[$row_board['id_board']])) { |
|
| 154 | + $this_category[$row_board['id_board']] = array(); |
|
| 155 | + } |
|
| 148 | 156 | |
| 149 | 157 | $this_category[$row_board['id_board']] += array( |
| 150 | 158 | 'new' => empty($row_board['is_read']), |
@@ -177,14 +185,12 @@ discard block |
||
| 177 | 185 | { |
| 178 | 186 | $this_category[$row_board['id_board']]['board_class'] = 'redirect'; |
| 179 | 187 | $this_category[$row_board['id_board']]['board_tooltip'] = $txt['redirect_board']; |
| 180 | - } |
|
| 181 | - elseif ($this_category[$row_board['id_board']]['new'] || $context['user']['is_guest']) |
|
| 188 | + } elseif ($this_category[$row_board['id_board']]['new'] || $context['user']['is_guest']) |
|
| 182 | 189 | { |
| 183 | 190 | // If we're showing to guests, we want to give them the idea that something interesting is going on! |
| 184 | 191 | $this_category[$row_board['id_board']]['board_class'] = 'on'; |
| 185 | 192 | $this_category[$row_board['id_board']]['board_tooltip'] = $txt['new_posts']; |
| 186 | - } |
|
| 187 | - else |
|
| 193 | + } else |
|
| 188 | 194 | { |
| 189 | 195 | $this_category[$row_board['id_board']]['board_tooltip'] = $txt['old_posts']; |
| 190 | 196 | } |
@@ -196,12 +202,13 @@ discard block |
||
| 196 | 202 | $isChild = true; |
| 197 | 203 | |
| 198 | 204 | // Ensure the parent has at least the most important info defined |
| 199 | - if (!isset($this_category[$row_board['id_parent']])) |
|
| 200 | - $this_category[$row_board['id_parent']] = array( |
|
| 205 | + if (!isset($this_category[$row_board['id_parent']])) { |
|
| 206 | + $this_category[$row_board['id_parent']] = array( |
|
| 201 | 207 | 'children' => array(), |
| 202 | 208 | 'children_new' => false, |
| 203 | 209 | 'board_class' => 'off', |
| 204 | 210 | ); |
| 211 | + } |
|
| 205 | 212 | |
| 206 | 213 | $this_category[$row_board['id_parent']]['children'][$row_board['id_board']] = array( |
| 207 | 214 | 'id' => $row_board['id_board'], |
@@ -245,8 +252,9 @@ discard block |
||
| 245 | 252 | // Propagate some values to the parent board |
| 246 | 253 | if (isset($row_boards[$row_board['id_parent']])) |
| 247 | 254 | { |
| 248 | - if (empty($row_board['is_read'])) |
|
| 249 | - $row_boards[$row_board['id_parent']]['is_read'] = $row_board['is_read']; |
|
| 255 | + if (empty($row_board['is_read'])) { |
|
| 256 | + $row_boards[$row_board['id_parent']]['is_read'] = $row_board['is_read']; |
|
| 257 | + } |
|
| 250 | 258 | |
| 251 | 259 | if (!empty($boardIndexOptions['countChildPosts']) && !$row_board['is_redirect']) |
| 252 | 260 | { |
@@ -277,12 +285,13 @@ discard block |
||
| 277 | 285 | 'topic' => $row_board['id_topic'] |
| 278 | 286 | ); |
| 279 | 287 | |
| 280 | - if (!empty($settings['avatars_on_boardIndex'])) |
|
| 281 | - $this_last_post['member']['avatar'] = set_avatar_data(array( |
|
| 288 | + if (!empty($settings['avatars_on_boardIndex'])) { |
|
| 289 | + $this_last_post['member']['avatar'] = set_avatar_data(array( |
|
| 282 | 290 | 'avatar' => $row_board['avatar'], |
| 283 | 291 | 'email' => $row_board['email_address'], |
| 284 | 292 | 'filename' => !empty($row_board['member_filename']) ? $row_board['member_filename'] : '', |
| 285 | 293 | )); |
| 294 | + } |
|
| 286 | 295 | |
| 287 | 296 | // Provide the href and link. |
| 288 | 297 | if ($row_board['subject'] != '') |
@@ -294,8 +303,7 @@ discard block |
||
| 294 | 303 | link, href, subject, start (where they should go for the first unread post.), |
| 295 | 304 | and member. (which has id, name, link, href, username in it.) */ |
| 296 | 305 | $this_last_post['last_post_message'] = sprintf($txt['last_post_message'], $this_last_post['member']['link'], $this_last_post['link'], $this_last_post['time']); |
| 297 | - } |
|
| 298 | - else |
|
| 306 | + } else |
|
| 299 | 307 | { |
| 300 | 308 | $this_last_post['href'] = ''; |
| 301 | 309 | $this_last_post['link'] = $txt['not_applicable']; |
@@ -303,18 +311,21 @@ discard block |
||
| 303 | 311 | } |
| 304 | 312 | |
| 305 | 313 | // Set the last post in the parent board. |
| 306 | - if ($row_board['id_parent'] == $boardIndexOptions['parent_id'] || ($isChild && !empty($row_board['poster_time']) && forum_time(true, $row_boards[$row_board['id_parent']]['poster_time']) < forum_time(true, $row_board['poster_time']))) |
|
| 307 | - $this_category[$isChild ? $row_board['id_parent'] : $row_board['id_board']]['last_post'] = $this_last_post; |
|
| 314 | + if ($row_board['id_parent'] == $boardIndexOptions['parent_id'] || ($isChild && !empty($row_board['poster_time']) && forum_time(true, $row_boards[$row_board['id_parent']]['poster_time']) < forum_time(true, $row_board['poster_time']))) { |
|
| 315 | + $this_category[$isChild ? $row_board['id_parent'] : $row_board['id_board']]['last_post'] = $this_last_post; |
|
| 316 | + } |
|
| 308 | 317 | // Just in the child...? |
| 309 | - if ($isChild) |
|
| 310 | - $this_category[$row_board['id_parent']]['children'][$row_board['id_board']]['last_post'] = $this_last_post; |
|
| 318 | + if ($isChild) { |
|
| 319 | + $this_category[$row_board['id_parent']]['children'][$row_board['id_board']]['last_post'] = $this_last_post; |
|
| 320 | + } |
|
| 311 | 321 | |
| 312 | 322 | // Determine a global most recent topic. |
| 313 | - if (!empty($boardIndexOptions['set_latest_post']) && !empty($row_board['poster_time']) && $row_board['poster_time'] > $latest_post['timestamp'] && !$ignoreThisBoard) |
|
| 314 | - $latest_post = array( |
|
| 323 | + if (!empty($boardIndexOptions['set_latest_post']) && !empty($row_board['poster_time']) && $row_board['poster_time'] > $latest_post['timestamp'] && !$ignoreThisBoard) { |
|
| 324 | + $latest_post = array( |
|
| 315 | 325 | 'timestamp' => $row_board['poster_time'], |
| 316 | 326 | 'ref' => &$this_category[$isChild ? $row_board['id_parent'] : $row_board['id_board']]['last_post'], |
| 317 | 327 | ); |
| 328 | + } |
|
| 318 | 329 | } |
| 319 | 330 | |
| 320 | 331 | // Fetch the board's moderators and moderator groups |
@@ -330,8 +341,9 @@ discard block |
||
| 330 | 341 | if (!empty($moderators[$board['id']])) |
| 331 | 342 | { |
| 332 | 343 | $categories[$k]['boards'][$j]['moderators'] = $moderators[$board['id']]; |
| 333 | - foreach ($moderators[$board['id']] as $moderator) |
|
| 334 | - $categories[$k]['boards'][$j]['link_moderators'][] = $moderator['link']; |
|
| 344 | + foreach ($moderators[$board['id']] as $moderator) { |
|
| 345 | + $categories[$k]['boards'][$j]['link_moderators'][] = $moderator['link']; |
|
| 346 | + } |
|
| 335 | 347 | } |
| 336 | 348 | if (!empty($groups[$board['id']])) |
| 337 | 349 | { |
@@ -344,16 +356,16 @@ discard block |
||
| 344 | 356 | } |
| 345 | 357 | } |
| 346 | 358 | } |
| 347 | - } |
|
| 348 | - else |
|
| 359 | + } else |
|
| 349 | 360 | { |
| 350 | 361 | foreach ($this_category as $k => $board) |
| 351 | 362 | { |
| 352 | 363 | if (!empty($moderators[$board['id']])) |
| 353 | 364 | { |
| 354 | 365 | $this_category[$k]['moderators'] = $moderators[$board['id']]; |
| 355 | - foreach ($moderators[$board['id']] as $moderator) |
|
| 356 | - $this_category[$k]['link_moderators'][] = $moderator['link']; |
|
| 366 | + foreach ($moderators[$board['id']] as $moderator) { |
|
| 367 | + $this_category[$k]['link_moderators'][] = $moderator['link']; |
|
| 368 | + } |
|
| 357 | 369 | } |
| 358 | 370 | if (!empty($groups[$board['id']])) |
| 359 | 371 | { |
@@ -367,20 +379,23 @@ discard block |
||
| 367 | 379 | } |
| 368 | 380 | } |
| 369 | 381 | |
| 370 | - if ($boardIndexOptions['include_categories']) |
|
| 371 | - sortCategories($categories); |
|
| 372 | - else |
|
| 373 | - sortBoards($this_category); |
|
| 382 | + if ($boardIndexOptions['include_categories']) { |
|
| 383 | + sortCategories($categories); |
|
| 384 | + } else { |
|
| 385 | + sortBoards($this_category); |
|
| 386 | + } |
|
| 374 | 387 | |
| 375 | 388 | // By now we should know the most recent post...if we wanna know it that is. |
| 376 | - if (!empty($boardIndexOptions['set_latest_post']) && !empty($latest_post['ref'])) |
|
| 377 | - $context['latest_post'] = $latest_post['ref']; |
|
| 389 | + if (!empty($boardIndexOptions['set_latest_post']) && !empty($latest_post['ref'])) { |
|
| 390 | + $context['latest_post'] = $latest_post['ref']; |
|
| 391 | + } |
|
| 378 | 392 | |
| 379 | 393 | // I can't remember why but trying to make a ternary to get this all in one line is actually a Very Bad Idea. |
| 380 | - if ($boardIndexOptions['include_categories']) |
|
| 381 | - call_integration_hook('integrate_getboardtree', array($boardIndexOptions, &$categories)); |
|
| 382 | - else |
|
| 383 | - call_integration_hook('integrate_getboardtree', array($boardIndexOptions, &$this_category)); |
|
| 394 | + if ($boardIndexOptions['include_categories']) { |
|
| 395 | + call_integration_hook('integrate_getboardtree', array($boardIndexOptions, &$categories)); |
|
| 396 | + } else { |
|
| 397 | + call_integration_hook('integrate_getboardtree', array($boardIndexOptions, &$this_category)); |
|
| 398 | + } |
|
| 384 | 399 | |
| 385 | 400 | return $boardIndexOptions['include_categories'] ? $categories : $this_category; |
| 386 | 401 | } |
@@ -13,8 +13,9 @@ discard block |
||
| 13 | 13 | * @version 2.1 Beta 4 |
| 14 | 14 | */ |
| 15 | 15 | |
| 16 | -if (!defined('SMF')) |
|
| 16 | +if (!defined('SMF')) { |
|
| 17 | 17 | die('No direct access...'); |
| 18 | +} |
|
| 18 | 19 | |
| 19 | 20 | /** |
| 20 | 21 | * The main dispatcher; doesn't do anything, just delegates. |
@@ -92,18 +93,19 @@ discard block |
||
| 92 | 93 | checkSession('get'); |
| 93 | 94 | validateToken('admin-bm-' . (int) $_REQUEST['src_board'], 'request'); |
| 94 | 95 | |
| 95 | - if ($_REQUEST['move_to'] === 'top') |
|
| 96 | - $boardOptions = array( |
|
| 96 | + if ($_REQUEST['move_to'] === 'top') { |
|
| 97 | + $boardOptions = array( |
|
| 97 | 98 | 'move_to' => $_REQUEST['move_to'], |
| 98 | 99 | 'target_category' => (int) $_REQUEST['target_cat'], |
| 99 | 100 | 'move_first_child' => true, |
| 100 | 101 | ); |
| 101 | - else |
|
| 102 | - $boardOptions = array( |
|
| 102 | + } else { |
|
| 103 | + $boardOptions = array( |
|
| 103 | 104 | 'move_to' => $_REQUEST['move_to'], |
| 104 | 105 | 'target_board' => (int) $_REQUEST['target_board'], |
| 105 | 106 | 'move_first_child' => true, |
| 106 | 107 | ); |
| 108 | + } |
|
| 107 | 109 | modifyBoard((int) $_REQUEST['src_board'], $boardOptions); |
| 108 | 110 | } |
| 109 | 111 | |
@@ -148,15 +150,16 @@ discard block |
||
| 148 | 150 | $security = $context['session_var'] . '=' . $context['session_id'] . ';' . $context['admin-bm-' . $context['move_board'] . '_token_var'] . '=' . $context['admin-bm-' . $context['move_board'] . '_token']; |
| 149 | 151 | foreach ($boardList[$catid] as $boardid) |
| 150 | 152 | { |
| 151 | - if (!isset($context['categories'][$catid]['move_link'])) |
|
| 152 | - $context['categories'][$catid]['move_link'] = array( |
|
| 153 | + if (!isset($context['categories'][$catid]['move_link'])) { |
|
| 154 | + $context['categories'][$catid]['move_link'] = array( |
|
| 153 | 155 | 'child_level' => 0, |
| 154 | 156 | 'label' => $txt['mboards_order_before'] . ' \'' . $smcFunc['htmlspecialchars']($boards[$boardid]['name']) . '\'', |
| 155 | 157 | 'href' => $scripturl . '?action=admin;area=manageboards;sa=move;src_board=' . $context['move_board'] . ';target_board=' . $boardid . ';move_to=before;' . $security, |
| 156 | 158 | ); |
| 159 | + } |
|
| 157 | 160 | |
| 158 | - if (!$context['categories'][$catid]['boards'][$boardid]['move']) |
|
| 159 | - $context['categories'][$catid]['boards'][$boardid]['move_links'] = array( |
|
| 161 | + if (!$context['categories'][$catid]['boards'][$boardid]['move']) { |
|
| 162 | + $context['categories'][$catid]['boards'][$boardid]['move_links'] = array( |
|
| 160 | 163 | array( |
| 161 | 164 | 'child_level' => $boards[$boardid]['level'], |
| 162 | 165 | 'label' => $txt['mboards_order_after'] . '\'' . $smcFunc['htmlspecialchars']($boards[$boardid]['name']) . '\'', |
@@ -170,33 +173,38 @@ discard block |
||
| 170 | 173 | 'class' => 'here', |
| 171 | 174 | ), |
| 172 | 175 | ); |
| 176 | + } |
|
| 173 | 177 | |
| 174 | 178 | $difference = $boards[$boardid]['level'] - $prev_child_level; |
| 175 | - if ($difference == 1) |
|
| 176 | - array_push($stack, !empty($context['categories'][$catid]['boards'][$prev_board]['move_links']) ? array_shift($context['categories'][$catid]['boards'][$prev_board]['move_links']) : null); |
|
| 177 | - elseif ($difference < 0) |
|
| 179 | + if ($difference == 1) { |
|
| 180 | + array_push($stack, !empty($context['categories'][$catid]['boards'][$prev_board]['move_links']) ? array_shift($context['categories'][$catid]['boards'][$prev_board]['move_links']) : null); |
|
| 181 | + } elseif ($difference < 0) |
|
| 178 | 182 | { |
| 179 | - if (empty($context['categories'][$catid]['boards'][$prev_board]['move_links'])) |
|
| 180 | - $context['categories'][$catid]['boards'][$prev_board]['move_links'] = array(); |
|
| 181 | - for ($i = 0; $i < -$difference; $i++) |
|
| 182 | - if (($temp = array_pop($stack)) != null) |
|
| 183 | + if (empty($context['categories'][$catid]['boards'][$prev_board]['move_links'])) { |
|
| 184 | + $context['categories'][$catid]['boards'][$prev_board]['move_links'] = array(); |
|
| 185 | + } |
|
| 186 | + for ($i = 0; $i < -$difference; $i++) { |
|
| 187 | + if (($temp = array_pop($stack)) != null) |
|
| 183 | 188 | array_unshift($context['categories'][$catid]['boards'][$prev_board]['move_links'], $temp); |
| 189 | + } |
|
| 184 | 190 | } |
| 185 | 191 | |
| 186 | 192 | $prev_board = $boardid; |
| 187 | 193 | $prev_child_level = $boards[$boardid]['level']; |
| 188 | 194 | } |
| 189 | - if (!empty($stack) && !empty($context['categories'][$catid]['boards'][$prev_board]['move_links'])) |
|
| 190 | - $context['categories'][$catid]['boards'][$prev_board]['move_links'] = array_merge($stack, $context['categories'][$catid]['boards'][$prev_board]['move_links']); |
|
| 191 | - elseif (!empty($stack)) |
|
| 192 | - $context['categories'][$catid]['boards'][$prev_board]['move_links'] = $stack; |
|
| 195 | + if (!empty($stack) && !empty($context['categories'][$catid]['boards'][$prev_board]['move_links'])) { |
|
| 196 | + $context['categories'][$catid]['boards'][$prev_board]['move_links'] = array_merge($stack, $context['categories'][$catid]['boards'][$prev_board]['move_links']); |
|
| 197 | + } elseif (!empty($stack)) { |
|
| 198 | + $context['categories'][$catid]['boards'][$prev_board]['move_links'] = $stack; |
|
| 199 | + } |
|
| 193 | 200 | |
| 194 | - if (empty($boardList[$catid])) |
|
| 195 | - $context['categories'][$catid]['move_link'] = array( |
|
| 201 | + if (empty($boardList[$catid])) { |
|
| 202 | + $context['categories'][$catid]['move_link'] = array( |
|
| 196 | 203 | 'child_level' => 0, |
| 197 | 204 | 'label' => $txt['mboards_order_before'] . ' \'' . $smcFunc['htmlspecialchars']($tree['node']['name']) . '\'', |
| 198 | 205 | 'href' => $scripturl . '?action=admin;area=manageboards;sa=move;src_board=' . $context['move_board'] . ';target_cat=' . $catid . ';move_to=top;' . $security, |
| 199 | 206 | ); |
| 207 | + } |
|
| 200 | 208 | } |
| 201 | 209 | } |
| 202 | 210 | |
@@ -252,9 +260,9 @@ discard block |
||
| 252 | 260 | ); |
| 253 | 261 | } |
| 254 | 262 | // Category doesn't exist, man... sorry. |
| 255 | - elseif (!isset($cat_tree[$_REQUEST['cat']])) |
|
| 256 | - redirectexit('action=admin;area=manageboards'); |
|
| 257 | - else |
|
| 263 | + elseif (!isset($cat_tree[$_REQUEST['cat']])) { |
|
| 264 | + redirectexit('action=admin;area=manageboards'); |
|
| 265 | + } else |
|
| 258 | 266 | { |
| 259 | 267 | $context['category'] = array( |
| 260 | 268 | 'id' => $_REQUEST['cat'], |
@@ -266,30 +274,31 @@ discard block |
||
| 266 | 274 | 'is_empty' => empty($cat_tree[$_REQUEST['cat']]['children']) |
| 267 | 275 | ); |
| 268 | 276 | |
| 269 | - foreach ($boardList[$_REQUEST['cat']] as $child_board) |
|
| 270 | - $context['category']['children'][] = str_repeat('-', $boards[$child_board]['level']) . ' ' . $boards[$child_board]['name']; |
|
| 277 | + foreach ($boardList[$_REQUEST['cat']] as $child_board) { |
|
| 278 | + $context['category']['children'][] = str_repeat('-', $boards[$child_board]['level']) . ' ' . $boards[$child_board]['name']; |
|
| 279 | + } |
|
| 271 | 280 | } |
| 272 | 281 | |
| 273 | 282 | $prevCat = 0; |
| 274 | 283 | foreach ($cat_tree as $catid => $tree) |
| 275 | 284 | { |
| 276 | - if ($catid == $_REQUEST['cat'] && $prevCat > 0) |
|
| 277 | - $context['category_order'][$prevCat]['selected'] = true; |
|
| 278 | - elseif ($catid != $_REQUEST['cat']) |
|
| 279 | - $context['category_order'][$catid] = array( |
|
| 285 | + if ($catid == $_REQUEST['cat'] && $prevCat > 0) { |
|
| 286 | + $context['category_order'][$prevCat]['selected'] = true; |
|
| 287 | + } elseif ($catid != $_REQUEST['cat']) { |
|
| 288 | + $context['category_order'][$catid] = array( |
|
| 280 | 289 | 'id' => $catid, |
| 281 | 290 | 'name' => $txt['mboards_order_after'] . $tree['node']['name'], |
| 282 | 291 | 'selected' => false, |
| 283 | 292 | 'true_name' => $tree['node']['name'] |
| 284 | 293 | ); |
| 294 | + } |
|
| 285 | 295 | $prevCat = $catid; |
| 286 | 296 | } |
| 287 | 297 | if (!isset($_REQUEST['delete'])) |
| 288 | 298 | { |
| 289 | 299 | $context['sub_template'] = 'modify_category'; |
| 290 | 300 | $context['page_title'] = $_REQUEST['sa'] == 'newcat' ? $txt['mboards_new_cat_name'] : $txt['catEdit']; |
| 291 | - } |
|
| 292 | - else |
|
| 301 | + } else |
|
| 293 | 302 | { |
| 294 | 303 | $context['sub_template'] = 'confirm_category_delete'; |
| 295 | 304 | $context['page_title'] = $txt['mboards_delete_cat']; |
@@ -326,8 +335,9 @@ discard block |
||
| 326 | 335 | { |
| 327 | 336 | $catOptions = array(); |
| 328 | 337 | |
| 329 | - if (isset($_POST['cat_order'])) |
|
| 330 | - $catOptions['move_after'] = (int) $_POST['cat_order']; |
|
| 338 | + if (isset($_POST['cat_order'])) { |
|
| 339 | + $catOptions['move_after'] = (int) $_POST['cat_order']; |
|
| 340 | + } |
|
| 331 | 341 | |
| 332 | 342 | // Change "This & That" to "This & That" but don't change "¢" to "&cent;"... |
| 333 | 343 | $catOptions['cat_name'] = parse_bbc($smcFunc['htmlspecialchars']($_POST['cat_name']), false, '', $context['description_allowed_tags']); |
@@ -335,10 +345,11 @@ discard block |
||
| 335 | 345 | |
| 336 | 346 | $catOptions['is_collapsible'] = isset($_POST['collapse']); |
| 337 | 347 | |
| 338 | - if (isset($_POST['add'])) |
|
| 339 | - createCategory($catOptions); |
|
| 340 | - else |
|
| 341 | - modifyCategory($_POST['cat'], $catOptions); |
|
| 348 | + if (isset($_POST['add'])) { |
|
| 349 | + createCategory($catOptions); |
|
| 350 | + } else { |
|
| 351 | + modifyCategory($_POST['cat'], $catOptions); |
|
| 352 | + } |
|
| 342 | 353 | } |
| 343 | 354 | // If they want to delete - first give them confirmation. |
| 344 | 355 | elseif (isset($_POST['delete']) && !isset($_POST['confirmation']) && !isset($_POST['empty'])) |
@@ -352,13 +363,14 @@ discard block |
||
| 352 | 363 | // First off - check if we are moving all the current boards first - before we start deleting! |
| 353 | 364 | if (isset($_POST['delete_action']) && $_POST['delete_action'] == 1) |
| 354 | 365 | { |
| 355 | - if (empty($_POST['cat_to'])) |
|
| 356 | - fatal_lang_error('mboards_delete_error'); |
|
| 366 | + if (empty($_POST['cat_to'])) { |
|
| 367 | + fatal_lang_error('mboards_delete_error'); |
|
| 368 | + } |
|
| 357 | 369 | |
| 358 | 370 | deleteCategories(array($_POST['cat']), (int) $_POST['cat_to']); |
| 371 | + } else { |
|
| 372 | + deleteCategories(array($_POST['cat'])); |
|
| 359 | 373 | } |
| 360 | - else |
|
| 361 | - deleteCategories(array($_POST['cat'])); |
|
| 362 | 374 | } |
| 363 | 375 | |
| 364 | 376 | redirectexit('action=admin;area=manageboards'); |
@@ -403,8 +415,9 @@ discard block |
||
| 403 | 415 | if ($_REQUEST['sa'] == 'newboard') |
| 404 | 416 | { |
| 405 | 417 | // Category doesn't exist, man... sorry. |
| 406 | - if (empty($_REQUEST['cat'])) |
|
| 407 | - redirectexit('action=admin;area=manageboards'); |
|
| 418 | + if (empty($_REQUEST['cat'])) { |
|
| 419 | + redirectexit('action=admin;area=manageboards'); |
|
| 420 | + } |
|
| 408 | 421 | |
| 409 | 422 | // Some things that need to be setup for a new board. |
| 410 | 423 | $curBoard = array( |
@@ -428,8 +441,7 @@ discard block |
||
| 428 | 441 | 'category' => (int) $_REQUEST['cat'], |
| 429 | 442 | 'no_children' => true, |
| 430 | 443 | ); |
| 431 | - } |
|
| 432 | - else |
|
| 444 | + } else |
|
| 433 | 445 | { |
| 434 | 446 | // Just some easy shortcuts. |
| 435 | 447 | $curBoard = &$boards[$_REQUEST['boardid']]; |
@@ -477,8 +489,9 @@ discard block |
||
| 477 | 489 | ); |
| 478 | 490 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
| 479 | 491 | { |
| 480 | - if ($_REQUEST['sa'] == 'newboard' && $row['min_posts'] == -1) |
|
| 481 | - $curBoard['member_groups'][] = $row['id_group']; |
|
| 492 | + if ($_REQUEST['sa'] == 'newboard' && $row['min_posts'] == -1) { |
|
| 493 | + $curBoard['member_groups'][] = $row['id_group']; |
|
| 494 | + } |
|
| 482 | 495 | |
| 483 | 496 | $context['groups'][(int) $row['id_group']] = array( |
| 484 | 497 | 'id' => $row['id_group'], |
@@ -491,8 +504,9 @@ discard block |
||
| 491 | 504 | $smcFunc['db_free_result']($request); |
| 492 | 505 | |
| 493 | 506 | // Category doesn't exist, man... sorry. |
| 494 | - if (!isset($boardList[$curBoard['category']])) |
|
| 495 | - redirectexit('action=admin;area=manageboards'); |
|
| 507 | + if (!isset($boardList[$curBoard['category']])) { |
|
| 508 | + redirectexit('action=admin;area=manageboards'); |
|
| 509 | + } |
|
| 496 | 510 | |
| 497 | 511 | foreach ($boardList[$curBoard['category']] as $boardid) |
| 498 | 512 | { |
@@ -506,8 +520,7 @@ discard block |
||
| 506 | 520 | 'is_child' => false, |
| 507 | 521 | 'selected' => true |
| 508 | 522 | ); |
| 509 | - } |
|
| 510 | - else |
|
| 523 | + } else |
|
| 511 | 524 | { |
| 512 | 525 | $context['board_order'][] = array( |
| 513 | 526 | 'id' => $boardid, |
@@ -524,19 +537,21 @@ discard block |
||
| 524 | 537 | $context['can_move_children'] = false; |
| 525 | 538 | $context['children'] = $boards[$_REQUEST['boardid']]['tree']['children']; |
| 526 | 539 | |
| 527 | - foreach ($context['board_order'] as $lBoard) |
|
| 528 | - if ($lBoard['is_child'] == false && $lBoard['selected'] == false) |
|
| 540 | + foreach ($context['board_order'] as $lBoard) { |
|
| 541 | + if ($lBoard['is_child'] == false && $lBoard['selected'] == false) |
|
| 529 | 542 | $context['can_move_children'] = true; |
| 543 | + } |
|
| 530 | 544 | } |
| 531 | 545 | |
| 532 | 546 | // Get other available categories. |
| 533 | 547 | $context['categories'] = array(); |
| 534 | - foreach ($cat_tree as $catID => $tree) |
|
| 535 | - $context['categories'][] = array( |
|
| 548 | + foreach ($cat_tree as $catID => $tree) { |
|
| 549 | + $context['categories'][] = array( |
|
| 536 | 550 | 'id' => $catID == $curBoard['category'] ? 0 : $catID, |
| 537 | 551 | 'name' => $tree['node']['name'], |
| 538 | 552 | 'selected' => $catID == $curBoard['category'] |
| 539 | 553 | ); |
| 554 | + } |
|
| 540 | 555 | |
| 541 | 556 | $request = $smcFunc['db_query']('', ' |
| 542 | 557 | SELECT mem.id_member, mem.real_name |
@@ -548,14 +563,16 @@ discard block |
||
| 548 | 563 | ) |
| 549 | 564 | ); |
| 550 | 565 | $context['board']['moderators'] = array(); |
| 551 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 552 | - $context['board']['moderators'][$row['id_member']] = $row['real_name']; |
|
| 566 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 567 | + $context['board']['moderators'][$row['id_member']] = $row['real_name']; |
|
| 568 | + } |
|
| 553 | 569 | $smcFunc['db_free_result']($request); |
| 554 | 570 | |
| 555 | 571 | $context['board']['moderator_list'] = empty($context['board']['moderators']) ? '' : '"' . implode('", "', $context['board']['moderators']) . '"'; |
| 556 | 572 | |
| 557 | - if (!empty($context['board']['moderators'])) |
|
| 558 | - list ($context['board']['last_moderator_id']) = array_slice(array_keys($context['board']['moderators']), -1); |
|
| 573 | + if (!empty($context['board']['moderators'])) { |
|
| 574 | + list ($context['board']['last_moderator_id']) = array_slice(array_keys($context['board']['moderators']), -1); |
|
| 575 | + } |
|
| 559 | 576 | |
| 560 | 577 | // Get all the groups assigned as moderators |
| 561 | 578 | $request = $smcFunc['db_query']('', ' |
@@ -567,14 +584,16 @@ discard block |
||
| 567 | 584 | ) |
| 568 | 585 | ); |
| 569 | 586 | $context['board']['moderator_groups'] = array(); |
| 570 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 571 | - $context['board']['moderator_groups'][$row['id_group']] = $context['groups'][$row['id_group']]['name']; |
|
| 587 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 588 | + $context['board']['moderator_groups'][$row['id_group']] = $context['groups'][$row['id_group']]['name']; |
|
| 589 | + } |
|
| 572 | 590 | $smcFunc['db_free_result']($request); |
| 573 | 591 | |
| 574 | 592 | $context['board']['moderator_groups_list'] = empty($context['board']['moderator_groups']) ? '' : '"' . implode('", &qout;', $context['board']['moderator_groups']) . '"'; |
| 575 | 593 | |
| 576 | - if (!empty($context['board']['moderator_groups'])) |
|
| 577 | - list ($context['board']['last_moderator_group_id']) = array_slice(array_keys($context['board']['moderator_groups']), -1); |
|
| 594 | + if (!empty($context['board']['moderator_groups'])) { |
|
| 595 | + list ($context['board']['last_moderator_group_id']) = array_slice(array_keys($context['board']['moderator_groups']), -1); |
|
| 596 | + } |
|
| 578 | 597 | |
| 579 | 598 | // Get all the themes... |
| 580 | 599 | $request = $smcFunc['db_query']('', ' |
@@ -586,8 +605,9 @@ discard block |
||
| 586 | 605 | ) |
| 587 | 606 | ); |
| 588 | 607 | $context['themes'] = array(); |
| 589 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 590 | - $context['themes'][] = $row; |
|
| 608 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 609 | + $context['themes'][] = $row; |
|
| 610 | + } |
|
| 591 | 611 | $smcFunc['db_free_result']($request); |
| 592 | 612 | |
| 593 | 613 | if (!isset($_REQUEST['delete'])) |
@@ -595,8 +615,7 @@ discard block |
||
| 595 | 615 | $context['sub_template'] = 'modify_board'; |
| 596 | 616 | $context['page_title'] = $txt['boardsEdit']; |
| 597 | 617 | loadJavaScriptFile('suggest.js', array('defer' => false, 'minimize' => true), 'smf_suggest'); |
| 598 | - } |
|
| 599 | - else |
|
| 618 | + } else |
|
| 600 | 619 | { |
| 601 | 620 | $context['sub_template'] = 'confirm_board_delete'; |
| 602 | 621 | $context['page_title'] = $txt['mboards_delete_board']; |
@@ -640,8 +659,9 @@ discard block |
||
| 640 | 659 | // Change the boardorder of this board? |
| 641 | 660 | elseif (!empty($_POST['placement']) && !empty($_POST['board_order'])) |
| 642 | 661 | { |
| 643 | - if (!in_array($_POST['placement'], array('before', 'after', 'child'))) |
|
| 644 | - fatal_lang_error('mangled_post', false); |
|
| 662 | + if (!in_array($_POST['placement'], array('before', 'after', 'child'))) { |
|
| 663 | + fatal_lang_error('mangled_post', false); |
|
| 664 | + } |
|
| 645 | 665 | |
| 646 | 666 | $boardOptions['move_to'] = $_POST['placement']; |
| 647 | 667 | $boardOptions['target_board'] = (int) $_POST['board_order']; |
@@ -654,13 +674,14 @@ discard block |
||
| 654 | 674 | $boardOptions['access_groups'] = array(); |
| 655 | 675 | $boardOptions['deny_groups'] = array(); |
| 656 | 676 | |
| 657 | - if (!empty($_POST['groups'])) |
|
| 658 | - foreach ($_POST['groups'] as $group => $action) |
|
| 677 | + if (!empty($_POST['groups'])) { |
|
| 678 | + foreach ($_POST['groups'] as $group => $action) |
|
| 659 | 679 | { |
| 660 | 680 | if ($action == 'allow') |
| 661 | 681 | $boardOptions['access_groups'][] = (int) $group; |
| 662 | - elseif ($action == 'deny') |
|
| 663 | - $boardOptions['deny_groups'][] = (int) $group; |
|
| 682 | + } elseif ($action == 'deny') { |
|
| 683 | + $boardOptions['deny_groups'][] = (int) $group; |
|
| 684 | + } |
|
| 664 | 685 | } |
| 665 | 686 | |
| 666 | 687 | // People with manage-boards are special. |
@@ -672,8 +693,9 @@ discard block |
||
| 672 | 693 | // Secondly, make sure those with super cow powers (like apt-get, or in this case manage boards) are upgraded. |
| 673 | 694 | $boardOptions['access_groups'] = array_unique(array_merge($boardOptions['access_groups'], $board_managers)); |
| 674 | 695 | |
| 675 | - if (strlen(implode(',', $boardOptions['access_groups'])) > 255 || strlen(implode(',', $boardOptions['deny_groups'])) > 255) |
|
| 676 | - fatal_lang_error('too_many_groups', false); |
|
| 696 | + if (strlen(implode(',', $boardOptions['access_groups'])) > 255 || strlen(implode(',', $boardOptions['deny_groups'])) > 255) { |
|
| 697 | + fatal_lang_error('too_many_groups', false); |
|
| 698 | + } |
|
| 677 | 699 | |
| 678 | 700 | // Do not allow HTML tags. Parse the string. |
| 679 | 701 | $boardOptions['board_name'] = parse_bbc($smcFunc['htmlspecialchars']($_POST['board_name']), false, '', $context['description_allowed_tags']); |
@@ -684,8 +706,9 @@ discard block |
||
| 684 | 706 | if (isset($_POST['moderator_list']) && is_array($_POST['moderator_list'])) |
| 685 | 707 | { |
| 686 | 708 | $moderators = array(); |
| 687 | - foreach ($_POST['moderator_list'] as $moderator) |
|
| 688 | - $moderators[(int) $moderator] = (int) $moderator; |
|
| 709 | + foreach ($_POST['moderator_list'] as $moderator) { |
|
| 710 | + $moderators[(int) $moderator] = (int) $moderator; |
|
| 711 | + } |
|
| 689 | 712 | $boardOptions['moderators'] = $moderators; |
| 690 | 713 | } |
| 691 | 714 | |
@@ -694,8 +717,9 @@ discard block |
||
| 694 | 717 | if (isset($_POST['moderator_group_list']) && is_array($_POST['moderator_group_list'])) |
| 695 | 718 | { |
| 696 | 719 | $moderator_groups = array(); |
| 697 | - foreach ($_POST['moderator_group_list'] as $moderator_group) |
|
| 698 | - $moderator_groups[(int) $moderator_group] = (int) $moderator_group; |
|
| 720 | + foreach ($_POST['moderator_group_list'] as $moderator_group) { |
|
| 721 | + $moderator_groups[(int) $moderator_group] = (int) $moderator_group; |
|
| 722 | + } |
|
| 699 | 723 | $boardOptions['moderator_groups'] = $moderator_groups; |
| 700 | 724 | } |
| 701 | 725 | |
@@ -721,56 +745,62 @@ discard block |
||
| 721 | 745 | $smcFunc['db_free_result']($request); |
| 722 | 746 | |
| 723 | 747 | // If we're turning redirection on check the board doesn't have posts in it - if it does don't make it a redirection board. |
| 724 | - if ($boardOptions['redirect'] && empty($oldRedirect) && $numPosts) |
|
| 725 | - unset($boardOptions['redirect']); |
|
| 748 | + if ($boardOptions['redirect'] && empty($oldRedirect) && $numPosts) { |
|
| 749 | + unset($boardOptions['redirect']); |
|
| 750 | + } |
|
| 726 | 751 | // Reset the redirection count when switching on/off. |
| 727 | - elseif (empty($boardOptions['redirect']) != empty($oldRedirect)) |
|
| 728 | - $boardOptions['num_posts'] = 0; |
|
| 752 | + elseif (empty($boardOptions['redirect']) != empty($oldRedirect)) { |
|
| 753 | + $boardOptions['num_posts'] = 0; |
|
| 754 | + } |
|
| 729 | 755 | // Resetting the count? |
| 730 | - elseif ($boardOptions['redirect'] && !empty($_POST['reset_redirect'])) |
|
| 731 | - $boardOptions['num_posts'] = 0; |
|
| 756 | + elseif ($boardOptions['redirect'] && !empty($_POST['reset_redirect'])) { |
|
| 757 | + $boardOptions['num_posts'] = 0; |
|
| 758 | + } |
|
| 732 | 759 | } |
| 733 | 760 | |
| 734 | 761 | // Create a new board... |
| 735 | 762 | if (isset($_POST['add'])) |
| 736 | 763 | { |
| 737 | 764 | // New boards by default go to the bottom of the category. |
| 738 | - if (empty($_POST['new_cat'])) |
|
| 739 | - $boardOptions['target_category'] = (int) $_POST['cur_cat']; |
|
| 740 | - if (!isset($boardOptions['move_to'])) |
|
| 741 | - $boardOptions['move_to'] = 'bottom'; |
|
| 765 | + if (empty($_POST['new_cat'])) { |
|
| 766 | + $boardOptions['target_category'] = (int) $_POST['cur_cat']; |
|
| 767 | + } |
|
| 768 | + if (!isset($boardOptions['move_to'])) { |
|
| 769 | + $boardOptions['move_to'] = 'bottom'; |
|
| 770 | + } |
|
| 742 | 771 | |
| 743 | 772 | createBoard($boardOptions); |
| 744 | 773 | } |
| 745 | 774 | |
| 746 | 775 | // ...or update an existing board. |
| 747 | - else |
|
| 748 | - modifyBoard($_POST['boardid'], $boardOptions); |
|
| 749 | - } |
|
| 750 | - elseif (isset($_POST['delete']) && !isset($_POST['confirmation']) && !isset($_POST['no_children'])) |
|
| 776 | + else { |
|
| 777 | + modifyBoard($_POST['boardid'], $boardOptions); |
|
| 778 | + } |
|
| 779 | + } elseif (isset($_POST['delete']) && !isset($_POST['confirmation']) && !isset($_POST['no_children'])) |
|
| 751 | 780 | { |
| 752 | 781 | EditBoard(); |
| 753 | 782 | return; |
| 754 | - } |
|
| 755 | - elseif (isset($_POST['delete'])) |
|
| 783 | + } elseif (isset($_POST['delete'])) |
|
| 756 | 784 | { |
| 757 | 785 | // First off - check if we are moving all the current child boards first - before we start deleting! |
| 758 | 786 | if (isset($_POST['delete_action']) && $_POST['delete_action'] == 1) |
| 759 | 787 | { |
| 760 | - if (empty($_POST['board_to'])) |
|
| 761 | - fatal_lang_error('mboards_delete_board_error'); |
|
| 788 | + if (empty($_POST['board_to'])) { |
|
| 789 | + fatal_lang_error('mboards_delete_board_error'); |
|
| 790 | + } |
|
| 762 | 791 | |
| 763 | 792 | deleteBoards(array($_POST['boardid']), (int) $_POST['board_to']); |
| 793 | + } else { |
|
| 794 | + deleteBoards(array($_POST['boardid']), 0); |
|
| 764 | 795 | } |
| 765 | - else |
|
| 766 | - deleteBoards(array($_POST['boardid']), 0); |
|
| 767 | 796 | } |
| 768 | 797 | |
| 769 | - if (isset($_REQUEST['rid']) && $_REQUEST['rid'] == 'permissions') |
|
| 770 | - redirectexit('action=admin;area=permissions;sa=board;' . $context['session_var'] . '=' . $context['session_id']); |
|
| 771 | - else |
|
| 772 | - redirectexit('action=admin;area=manageboards'); |
|
| 773 | -} |
|
| 798 | + if (isset($_REQUEST['rid']) && $_REQUEST['rid'] == 'permissions') { |
|
| 799 | + redirectexit('action=admin;area=permissions;sa=board;' . $context['session_var'] . '=' . $context['session_id']); |
|
| 800 | + } else { |
|
| 801 | + redirectexit('action=admin;area=manageboards'); |
|
| 802 | + } |
|
| 803 | + } |
|
| 774 | 804 | |
| 775 | 805 | /** |
| 776 | 806 | * Used to retrieve data for modifying a board category |
@@ -807,8 +837,9 @@ discard block |
||
| 807 | 837 | $smcFunc['db_free_result']($request); |
| 808 | 838 | |
| 809 | 839 | // This would probably never happen, but just to be sure. |
| 810 | - if ($cat .= $allowed_sa[1]) |
|
| 811 | - die(str_replace(',', ' to', $cat)); |
|
| 840 | + if ($cat .= $allowed_sa[1]) { |
|
| 841 | + die(str_replace(',', ' to', $cat)); |
|
| 842 | + } |
|
| 812 | 843 | |
| 813 | 844 | redirectexit(); |
| 814 | 845 | } |
@@ -834,8 +865,9 @@ discard block |
||
| 834 | 865 | 'empty_string' => '', |
| 835 | 866 | ) |
| 836 | 867 | ); |
| 837 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 838 | - $recycle_boards[$row['id_board']] = $row['cat_name'] . ' - ' . $row['board_name']; |
|
| 868 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 869 | + $recycle_boards[$row['id_board']] = $row['cat_name'] . ' - ' . $row['board_name']; |
|
| 870 | + } |
|
| 839 | 871 | $smcFunc['db_free_result']($request); |
| 840 | 872 | |
| 841 | 873 | if (!empty($recycle_boards)) |
@@ -843,13 +875,14 @@ discard block |
||
| 843 | 875 | require_once($sourcedir . '/Subs-Boards.php'); |
| 844 | 876 | sortBoards($recycle_boards); |
| 845 | 877 | $recycle_boards = array('') + $recycle_boards; |
| 878 | + } else { |
|
| 879 | + $recycle_boards = array(''); |
|
| 846 | 880 | } |
| 847 | - else |
|
| 848 | - $recycle_boards = array(''); |
|
| 849 | 881 | |
| 850 | 882 | // If this setting is missing, set it to 1 |
| 851 | - if (empty($modSettings['boardindex_max_depth'])) |
|
| 852 | - $modSettings['boardindex_max_depth'] = 1; |
|
| 883 | + if (empty($modSettings['boardindex_max_depth'])) { |
|
| 884 | + $modSettings['boardindex_max_depth'] = 1; |
|
| 885 | + } |
|
| 853 | 886 | |
| 854 | 887 | // Here and the board settings... |
| 855 | 888 | $config_vars = array( |
@@ -868,8 +901,9 @@ discard block |
||
| 868 | 901 | |
| 869 | 902 | call_integration_hook('integrate_modify_board_settings', array(&$config_vars)); |
| 870 | 903 | |
| 871 | - if ($return_config) |
|
| 872 | - return $config_vars; |
|
| 904 | + if ($return_config) { |
|
| 905 | + return $config_vars; |
|
| 906 | + } |
|
| 873 | 907 | |
| 874 | 908 | // Needed for the settings template. |
| 875 | 909 | require_once($sourcedir . '/ManageServer.php'); |