@@ -13,8 +13,9 @@ discard block |
||
| 13 | 13 | * @version 2.1 Beta 3 |
| 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 | * Sets and call a function based on the given subaction. Acts as a dispatcher function. |
@@ -54,8 +55,9 @@ discard block |
||
| 54 | 55 | ); |
| 55 | 56 | |
| 56 | 57 | // This comes under the umbrella of moderating posts. |
| 57 | - if ($context['report_type'] == 'members' || $user_info['mod_cache']['bq'] == '0=1') |
|
| 58 | - isAllowedTo('moderate_forum'); |
|
| 58 | + if ($context['report_type'] == 'members' || $user_info['mod_cache']['bq'] == '0=1') { |
|
| 59 | + isAllowedTo('moderate_forum'); |
|
| 60 | + } |
|
| 59 | 61 | |
| 60 | 62 | $subActions = array( |
| 61 | 63 | 'show' => 'ShowReports', |
@@ -70,11 +72,11 @@ discard block |
||
| 70 | 72 | call_integration_hook('integrate_reported_' . $context['report_type'], array(&$subActions)); |
| 71 | 73 | |
| 72 | 74 | // By default we call the open sub-action. |
| 73 | - if (isset($_REQUEST['sa']) && isset($subActions[$_REQUEST['sa']])) |
|
| 74 | - $context['sub_action'] = $smcFunc['htmltrim']($smcFunc['htmlspecialchars']($_REQUEST['sa']), ENT_QUOTES); |
|
| 75 | - |
|
| 76 | - else |
|
| 77 | - $context['sub_action'] = 'show'; |
|
| 75 | + if (isset($_REQUEST['sa']) && isset($subActions[$_REQUEST['sa']])) { |
|
| 76 | + $context['sub_action'] = $smcFunc['htmltrim']($smcFunc['htmlspecialchars']($_REQUEST['sa']), ENT_QUOTES); |
|
| 77 | + } else { |
|
| 78 | + $context['sub_action'] = 'show'; |
|
| 79 | + } |
|
| 78 | 80 | |
| 79 | 81 | // Hi Ho Silver Away! |
| 80 | 82 | call_helper($subActions[$context['sub_action']]); |
@@ -116,11 +118,13 @@ discard block |
||
| 116 | 118 | |
| 117 | 119 | // All the ones to update... |
| 118 | 120 | $toClose = array(); |
| 119 | - foreach ($_POST['close'] as $rid) |
|
| 120 | - $toClose[] = (int) $rid; |
|
| 121 | + foreach ($_POST['close'] as $rid) { |
|
| 122 | + $toClose[] = (int) $rid; |
|
| 123 | + } |
|
| 121 | 124 | |
| 122 | - if (!empty($toClose)) |
|
| 123 | - updateReport('closed', 1, $toClose); |
|
| 125 | + if (!empty($toClose)) { |
|
| 126 | + updateReport('closed', 1, $toClose); |
|
| 127 | + } |
|
| 124 | 128 | |
| 125 | 129 | // Set the confirmation message. |
| 126 | 130 | $_SESSION['rc_confirmation'] = 'close_all'; |
@@ -178,8 +182,9 @@ discard block |
||
| 178 | 182 | $reportComments = array(); |
| 179 | 183 | |
| 180 | 184 | // Have to at least give us something to work with. |
| 181 | - if (empty($_REQUEST['rid'])) |
|
| 182 | - fatal_lang_error('mc_reportedp_none_found'); |
|
| 185 | + if (empty($_REQUEST['rid'])) { |
|
| 186 | + fatal_lang_error('mc_reportedp_none_found'); |
|
| 187 | + } |
|
| 183 | 188 | |
| 184 | 189 | // Integers only please |
| 185 | 190 | $report_id = (int) $_REQUEST['rid']; |
@@ -187,8 +192,9 @@ discard block |
||
| 187 | 192 | // Get the report details. |
| 188 | 193 | $report = getReportDetails($report_id); |
| 189 | 194 | |
| 190 | - if(!$report) |
|
| 191 | - fatal_lang_error('mc_no_modreport_found'); |
|
| 195 | + if(!$report) { |
|
| 196 | + fatal_lang_error('mc_no_modreport_found'); |
|
| 197 | + } |
|
| 192 | 198 | |
| 193 | 199 | // Build the report data - basic details first, then extra stuff based on the type |
| 194 | 200 | $context['report'] = array( |
@@ -214,8 +220,7 @@ discard block |
||
| 214 | 220 | 'href' => $scripturl . '?action=profile;u=' . $report['id_user'], |
| 215 | 221 | ), |
| 216 | 222 | ); |
| 217 | - } |
|
| 218 | - else |
|
| 223 | + } else |
|
| 219 | 224 | { |
| 220 | 225 | $extraDetails = array( |
| 221 | 226 | 'topic_id' => $report['id_topic'], |
@@ -238,8 +243,9 @@ discard block |
||
| 238 | 243 | |
| 239 | 244 | $reportComments = getReportComments($report_id); |
| 240 | 245 | |
| 241 | - if (!empty($reportComments)) |
|
| 242 | - $context['report'] = array_merge($context['report'], $reportComments); |
|
| 246 | + if (!empty($reportComments)) { |
|
| 247 | + $context['report'] = array_merge($context['report'], $reportComments); |
|
| 248 | + } |
|
| 243 | 249 | |
| 244 | 250 | // What have the other moderators done to this message? |
| 245 | 251 | require_once($sourcedir . '/Modlog.php'); |
@@ -260,8 +266,7 @@ discard block |
||
| 260 | 266 | 1, |
| 261 | 267 | true, |
| 262 | 268 | ); |
| 263 | - } |
|
| 264 | - else |
|
| 269 | + } else |
|
| 265 | 270 | { |
| 266 | 271 | $params = array( |
| 267 | 272 | 'lm.id_topic = {int:id_topic} |
@@ -361,16 +366,16 @@ discard block |
||
| 361 | 366 | createList($listOptions); |
| 362 | 367 | |
| 363 | 368 | // Make sure to get the correct tab selected. |
| 364 | - if ($context['report']['closed']) |
|
| 365 | - $context[$context['moderation_menu_name']]['current_subsection'] = 'closed'; |
|
| 369 | + if ($context['report']['closed']) { |
|
| 370 | + $context[$context['moderation_menu_name']]['current_subsection'] = 'closed'; |
|
| 371 | + } |
|
| 366 | 372 | |
| 367 | 373 | // Finally we are done :P |
| 368 | 374 | if ($context['report_type'] == 'members') |
| 369 | 375 | { |
| 370 | 376 | $context['page_title'] = sprintf($txt['mc_viewmemberreport'], $context['report']['user']['name']); |
| 371 | 377 | $context['sub_template'] = 'viewmemberreport'; |
| 372 | - } |
|
| 373 | - else |
|
| 378 | + } else |
|
| 374 | 379 | { |
| 375 | 380 | $context['page_title'] = sprintf($txt['mc_viewmodreport'], $context['report']['subject'], $context['report']['author']['name']); |
| 376 | 381 | $context['sub_template'] = 'viewmodreport'; |
@@ -395,8 +400,9 @@ discard block |
||
| 395 | 400 | $comment = array(); |
| 396 | 401 | |
| 397 | 402 | // The report ID is a must. |
| 398 | - if (empty($_REQUEST['rid'])) |
|
| 399 | - fatal_lang_error('mc_reportedp_none_found'); |
|
| 403 | + if (empty($_REQUEST['rid'])) { |
|
| 404 | + fatal_lang_error('mc_reportedp_none_found'); |
|
| 405 | + } |
|
| 400 | 406 | |
| 401 | 407 | // Integers only please. |
| 402 | 408 | $report_id = (int) $_REQUEST['rid']; |
@@ -421,8 +427,9 @@ discard block |
||
| 421 | 427 | checkSession('get'); |
| 422 | 428 | validateToken('mod-reportC-delete', 'get'); |
| 423 | 429 | |
| 424 | - if (empty($_REQUEST['mid'])) |
|
| 425 | - fatal_lang_error('mc_reportedp_comment_none_found'); |
|
| 430 | + if (empty($_REQUEST['mid'])) { |
|
| 431 | + fatal_lang_error('mc_reportedp_comment_none_found'); |
|
| 432 | + } |
|
| 426 | 433 | |
| 427 | 434 | $comment_id = (int) $_REQUEST['mid']; |
| 428 | 435 | |
@@ -430,15 +437,17 @@ discard block |
||
| 430 | 437 | $comment = getCommentModDetails($comment_id); |
| 431 | 438 | |
| 432 | 439 | // Perhaps somebody else already deleted this fine gem... |
| 433 | - if (empty($comment)) |
|
| 434 | - fatal_lang_error('report_action_message_delete_issue'); |
|
| 440 | + if (empty($comment)) { |
|
| 441 | + fatal_lang_error('report_action_message_delete_issue'); |
|
| 442 | + } |
|
| 435 | 443 | |
| 436 | 444 | // Can you actually do this? |
| 437 | 445 | $comment_owner = $user_info['id'] == $comment['id_member']; |
| 438 | 446 | |
| 439 | 447 | // Nope! sorry. |
| 440 | - if (!allowedTo('admin_forum') && !$comment_owner) |
|
| 441 | - fatal_lang_error('report_action_message_delete_cannot'); |
|
| 448 | + if (!allowedTo('admin_forum') && !$comment_owner) { |
|
| 449 | + fatal_lang_error('report_action_message_delete_cannot'); |
|
| 450 | + } |
|
| 442 | 451 | |
| 443 | 452 | // All good! |
| 444 | 453 | deleteModComment($comment_id); |
@@ -465,11 +474,13 @@ discard block |
||
| 465 | 474 | checkSession(isset($_REQUEST['save']) ? 'post' : 'get'); |
| 466 | 475 | |
| 467 | 476 | // The report ID is a must. |
| 468 | - if (empty($_REQUEST['rid'])) |
|
| 469 | - fatal_lang_error('mc_reportedp_none_found'); |
|
| 477 | + if (empty($_REQUEST['rid'])) { |
|
| 478 | + fatal_lang_error('mc_reportedp_none_found'); |
|
| 479 | + } |
|
| 470 | 480 | |
| 471 | - if (empty($_REQUEST['mid'])) |
|
| 472 | - fatal_lang_error('mc_reportedp_comment_none_found'); |
|
| 481 | + if (empty($_REQUEST['mid'])) { |
|
| 482 | + fatal_lang_error('mc_reportedp_comment_none_found'); |
|
| 483 | + } |
|
| 473 | 484 | |
| 474 | 485 | // Integers only please. |
| 475 | 486 | $context['report_id'] = (int) $_REQUEST['rid']; |
@@ -477,8 +488,9 @@ discard block |
||
| 477 | 488 | |
| 478 | 489 | $context['comment'] = getCommentModDetails($context['comment_id']); |
| 479 | 490 | |
| 480 | - if (empty($context['comment'])) |
|
| 481 | - fatal_lang_error('mc_reportedp_comment_none_found'); |
|
| 491 | + if (empty($context['comment'])) { |
|
| 492 | + fatal_lang_error('mc_reportedp_comment_none_found'); |
|
| 493 | + } |
|
| 482 | 494 | |
| 483 | 495 | // Set up the comforting bits... |
| 484 | 496 | $context['page_title'] = $txt['mc_reported_posts']; |
@@ -489,15 +501,17 @@ discard block |
||
| 489 | 501 | validateToken('mod-reportC-edit'); |
| 490 | 502 | |
| 491 | 503 | // Make sure there is some data to edit on the DB. |
| 492 | - if (empty($context['comment'])) |
|
| 493 | - fatal_lang_error('report_action_message_edit_issue'); |
|
| 504 | + if (empty($context['comment'])) { |
|
| 505 | + fatal_lang_error('report_action_message_edit_issue'); |
|
| 506 | + } |
|
| 494 | 507 | |
| 495 | 508 | // Still there, good, now lets see if you can actually edit it... |
| 496 | 509 | $comment_owner = $user_info['id'] == $context['comment']['id_member']; |
| 497 | 510 | |
| 498 | 511 | // So, you aren't neither an admin or the comment owner huh? that's too bad. |
| 499 | - if (!allowedTo('admin_forum') && !$comment_owner) |
|
| 500 | - fatal_lang_error('report_action_message_edit_cannot'); |
|
| 512 | + if (!allowedTo('admin_forum') && !$comment_owner) { |
|
| 513 | + fatal_lang_error('report_action_message_edit_cannot'); |
|
| 514 | + } |
|
| 501 | 515 | |
| 502 | 516 | // All good! |
| 503 | 517 | $edited_comment = trim($smcFunc['htmlspecialchars']($_POST['mod_comment'])); |
@@ -523,8 +537,9 @@ discard block |
||
| 523 | 537 | checkSession('get'); |
| 524 | 538 | |
| 525 | 539 | // We need to do something! |
| 526 | - if (empty($_GET['rid']) && (!isset($_GET['ignore']) || !isset($_GET['closed']))) |
|
| 527 | - fatal_lang_error('mc_reportedp_none_found'); |
|
| 540 | + if (empty($_GET['rid']) && (!isset($_GET['ignore']) || !isset($_GET['closed']))) { |
|
| 541 | + fatal_lang_error('mc_reportedp_none_found'); |
|
| 542 | + } |
|
| 528 | 543 | |
| 529 | 544 | // What are we gonna do? |
| 530 | 545 | $action = isset($_GET['ignore']) ? 'ignore' : 'closed'; |
@@ -13,8 +13,9 @@ discard block |
||
| 13 | 13 | * @version 2.1 Beta 3 |
| 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 | * Delete one of more membergroups. |
@@ -31,15 +32,16 @@ discard block |
||
| 31 | 32 | global $smcFunc, $modSettings, $txt; |
| 32 | 33 | |
| 33 | 34 | // Make sure it's an array. |
| 34 | - if (!is_array($groups)) |
|
| 35 | - $groups = array((int) $groups); |
|
| 36 | - else |
|
| 35 | + if (!is_array($groups)) { |
|
| 36 | + $groups = array((int) $groups); |
|
| 37 | + } else |
|
| 37 | 38 | { |
| 38 | 39 | $groups = array_unique($groups); |
| 39 | 40 | |
| 40 | 41 | // Make sure all groups are integer. |
| 41 | - foreach ($groups as $key => $value) |
|
| 42 | - $groups[$key] = (int) $value; |
|
| 42 | + foreach ($groups as $key => $value) { |
|
| 43 | + $groups[$key] = (int) $value; |
|
| 44 | + } |
|
| 43 | 45 | } |
| 44 | 46 | |
| 45 | 47 | // Some groups are protected (guests, administrators, moderators, newbies). |
@@ -56,15 +58,17 @@ discard block |
||
| 56 | 58 | 'is_protected' => 1, |
| 57 | 59 | ) |
| 58 | 60 | ); |
| 59 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 60 | - $protected_groups[] = $row['id_group']; |
|
| 61 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 62 | + $protected_groups[] = $row['id_group']; |
|
| 63 | + } |
|
| 61 | 64 | $smcFunc['db_free_result']($request); |
| 62 | 65 | } |
| 63 | 66 | |
| 64 | 67 | // Make sure they don't delete protected groups! |
| 65 | 68 | $groups = array_diff($groups, array_unique($protected_groups)); |
| 66 | - if (empty($groups)) |
|
| 67 | - return 'no_group_found'; |
|
| 69 | + if (empty($groups)) { |
|
| 70 | + return 'no_group_found'; |
|
| 71 | + } |
|
| 68 | 72 | |
| 69 | 73 | // Make sure they don't try to delete a group attached to a paid subscription. |
| 70 | 74 | $subscriptions = array(); |
@@ -74,13 +78,14 @@ discard block |
||
| 74 | 78 | ORDER BY name'); |
| 75 | 79 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
| 76 | 80 | { |
| 77 | - if (in_array($row['id_group'], $groups)) |
|
| 78 | - $subscriptions[] = $row['name']; |
|
| 79 | - else |
|
| 81 | + if (in_array($row['id_group'], $groups)) { |
|
| 82 | + $subscriptions[] = $row['name']; |
|
| 83 | + } else |
|
| 80 | 84 | { |
| 81 | 85 | $add_groups = explode(',', $row['add_groups']); |
| 82 | - if (count(array_intersect($add_groups, $groups)) != 0) |
|
| 83 | - $subscriptions[] = $row['name']; |
|
| 86 | + if (count(array_intersect($add_groups, $groups)) != 0) { |
|
| 87 | + $subscriptions[] = $row['name']; |
|
| 88 | + } |
|
| 84 | 89 | } |
| 85 | 90 | } |
| 86 | 91 | $smcFunc['db_free_result']($request); |
@@ -101,8 +106,9 @@ discard block |
||
| 101 | 106 | 'group_list' => $groups, |
| 102 | 107 | ) |
| 103 | 108 | ); |
| 104 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 105 | - logAction('delete_group', array('group' => $row['group_name']), 'admin'); |
|
| 109 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 110 | + logAction('delete_group', array('group' => $row['group_name']), 'admin'); |
|
| 111 | + } |
|
| 106 | 112 | $smcFunc['db_free_result']($request); |
| 107 | 113 | |
| 108 | 114 | call_integration_hook('integrate_delete_membergroups', array($groups)); |
@@ -187,12 +193,14 @@ discard block |
||
| 187 | 193 | ) |
| 188 | 194 | ); |
| 189 | 195 | $updates = array(); |
| 190 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 191 | - $updates[$row['additional_groups']][] = $row['id_member']; |
|
| 196 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 197 | + $updates[$row['additional_groups']][] = $row['id_member']; |
|
| 198 | + } |
|
| 192 | 199 | $smcFunc['db_free_result']($request); |
| 193 | 200 | |
| 194 | - foreach ($updates as $additional_groups => $memberArray) |
|
| 195 | - updateMemberData($memberArray, array('additional_groups' => implode(',', array_diff(explode(',', $additional_groups), $groups)))); |
|
| 201 | + foreach ($updates as $additional_groups => $memberArray) { |
|
| 202 | + updateMemberData($memberArray, array('additional_groups' => implode(',', array_diff(explode(',', $additional_groups), $groups)))); |
|
| 203 | + } |
|
| 196 | 204 | |
| 197 | 205 | // No boards can provide access to these membergroups anymore. |
| 198 | 206 | $request = $smcFunc['db_query']('', ' |
@@ -204,12 +212,13 @@ discard block |
||
| 204 | 212 | ) |
| 205 | 213 | ); |
| 206 | 214 | $updates = array(); |
| 207 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 208 | - $updates[$row['member_groups']][] = $row['id_board']; |
|
| 215 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 216 | + $updates[$row['member_groups']][] = $row['id_board']; |
|
| 217 | + } |
|
| 209 | 218 | $smcFunc['db_free_result']($request); |
| 210 | 219 | |
| 211 | - foreach ($updates as $member_groups => $boardArray) |
|
| 212 | - $smcFunc['db_query']('', ' |
|
| 220 | + foreach ($updates as $member_groups => $boardArray) { |
|
| 221 | + $smcFunc['db_query']('', ' |
|
| 213 | 222 | UPDATE {db_prefix}boards |
| 214 | 223 | SET member_groups = {string:member_groups} |
| 215 | 224 | WHERE id_board IN ({array_int:board_lists})', |
@@ -218,6 +227,7 @@ discard block |
||
| 218 | 227 | 'member_groups' => implode(',', array_diff(explode(',', $member_groups), $groups)), |
| 219 | 228 | ) |
| 220 | 229 | ); |
| 230 | + } |
|
| 221 | 231 | |
| 222 | 232 | // Recalculate the post groups, as they likely changed. |
| 223 | 233 | updateStats('postgroups'); |
@@ -225,8 +235,9 @@ discard block |
||
| 225 | 235 | // Make a note of the fact that the cache may be wrong. |
| 226 | 236 | $settings_update = array('settings_updated' => time()); |
| 227 | 237 | // Have we deleted the spider group? |
| 228 | - if (isset($modSettings['spider_group']) && in_array($modSettings['spider_group'], $groups)) |
|
| 229 | - $settings_update['spider_group'] = 0; |
|
| 238 | + if (isset($modSettings['spider_group']) && in_array($modSettings['spider_group'], $groups)) { |
|
| 239 | + $settings_update['spider_group'] = 0; |
|
| 240 | + } |
|
| 230 | 241 | |
| 231 | 242 | updateSettings($settings_update); |
| 232 | 243 | |
@@ -250,22 +261,24 @@ discard block |
||
| 250 | 261 | global $smcFunc, $modSettings, $sourcedir; |
| 251 | 262 | |
| 252 | 263 | // You're getting nowhere without this permission, unless of course you are the group's moderator. |
| 253 | - if (!$permissionCheckDone) |
|
| 254 | - isAllowedTo('manage_membergroups'); |
|
| 264 | + if (!$permissionCheckDone) { |
|
| 265 | + isAllowedTo('manage_membergroups'); |
|
| 266 | + } |
|
| 255 | 267 | |
| 256 | 268 | // Assume something will happen. |
| 257 | 269 | updateSettings(array('settings_updated' => time())); |
| 258 | 270 | |
| 259 | 271 | // Cleaning the input. |
| 260 | - if (!is_array($members)) |
|
| 261 | - $members = array((int) $members); |
|
| 262 | - else |
|
| 272 | + if (!is_array($members)) { |
|
| 273 | + $members = array((int) $members); |
|
| 274 | + } else |
|
| 263 | 275 | { |
| 264 | 276 | $members = array_unique($members); |
| 265 | 277 | |
| 266 | 278 | // Cast the members to integer. |
| 267 | - foreach ($members as $key => $value) |
|
| 268 | - $members[$key] = (int) $value; |
|
| 279 | + foreach ($members as $key => $value) { |
|
| 280 | + $members[$key] = (int) $value; |
|
| 281 | + } |
|
| 269 | 282 | } |
| 270 | 283 | |
| 271 | 284 | // Before we get started, let's check we won't leave the admin group empty! |
@@ -277,14 +290,15 @@ discard block |
||
| 277 | 290 | // Remove any admins if there are too many. |
| 278 | 291 | $non_changing_admins = array_diff(array_keys($admins), $members); |
| 279 | 292 | |
| 280 | - if (empty($non_changing_admins)) |
|
| 281 | - $members = array_diff($members, array_keys($admins)); |
|
| 293 | + if (empty($non_changing_admins)) { |
|
| 294 | + $members = array_diff($members, array_keys($admins)); |
|
| 295 | + } |
|
| 282 | 296 | } |
| 283 | 297 | |
| 284 | 298 | // Just in case. |
| 285 | - if (empty($members)) |
|
| 286 | - return false; |
|
| 287 | - elseif ($groups === null) |
|
| 299 | + if (empty($members)) { |
|
| 300 | + return false; |
|
| 301 | + } elseif ($groups === null) |
|
| 288 | 302 | { |
| 289 | 303 | // Wanna remove all groups from these members? That's easy. |
| 290 | 304 | $smcFunc['db_query']('', ' |
@@ -306,20 +320,21 @@ discard block |
||
| 306 | 320 | updateStats('postgroups', $members); |
| 307 | 321 | |
| 308 | 322 | // Log what just happened. |
| 309 | - foreach ($members as $member) |
|
| 310 | - logAction('removed_all_groups', array('member' => $member), 'admin'); |
|
| 323 | + foreach ($members as $member) { |
|
| 324 | + logAction('removed_all_groups', array('member' => $member), 'admin'); |
|
| 325 | + } |
|
| 311 | 326 | |
| 312 | 327 | return true; |
| 313 | - } |
|
| 314 | - elseif (!is_array($groups)) |
|
| 315 | - $groups = array((int) $groups); |
|
| 316 | - else |
|
| 328 | + } elseif (!is_array($groups)) { |
|
| 329 | + $groups = array((int) $groups); |
|
| 330 | + } else |
|
| 317 | 331 | { |
| 318 | 332 | $groups = array_unique($groups); |
| 319 | 333 | |
| 320 | 334 | // Make sure all groups are integer. |
| 321 | - foreach ($groups as $key => $value) |
|
| 322 | - $groups[$key] = (int) $value; |
|
| 335 | + foreach ($groups as $key => $value) { |
|
| 336 | + $groups[$key] = (int) $value; |
|
| 337 | + } |
|
| 323 | 338 | } |
| 324 | 339 | |
| 325 | 340 | // Fetch a list of groups members cannot be assigned to explicitly, and the group names of the ones we want. |
@@ -335,10 +350,11 @@ discard block |
||
| 335 | 350 | $group_names = array(); |
| 336 | 351 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
| 337 | 352 | { |
| 338 | - if ($row['min_posts'] != -1) |
|
| 339 | - $implicitGroups[] = $row['id_group']; |
|
| 340 | - else |
|
| 341 | - $group_names[$row['id_group']] = $row['group_name']; |
|
| 353 | + if ($row['min_posts'] != -1) { |
|
| 354 | + $implicitGroups[] = $row['id_group']; |
|
| 355 | + } else { |
|
| 356 | + $group_names[$row['id_group']] = $row['group_name']; |
|
| 357 | + } |
|
| 342 | 358 | } |
| 343 | 359 | $smcFunc['db_free_result']($request); |
| 344 | 360 | |
@@ -357,8 +373,9 @@ discard block |
||
| 357 | 373 | ) |
| 358 | 374 | ); |
| 359 | 375 | $protected_groups = array(1); |
| 360 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 361 | - $protected_groups[] = $row['id_group']; |
|
| 376 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 377 | + $protected_groups[] = $row['id_group']; |
|
| 378 | + } |
|
| 362 | 379 | $smcFunc['db_free_result']($request); |
| 363 | 380 | |
| 364 | 381 | // If you're not an admin yourself, you can't touch protected groups! |
@@ -366,8 +383,9 @@ discard block |
||
| 366 | 383 | } |
| 367 | 384 | |
| 368 | 385 | // Only continue if there are still groups and members left. |
| 369 | - if (empty($groups) || empty($members)) |
|
| 370 | - return false; |
|
| 386 | + if (empty($groups) || empty($members)) { |
|
| 387 | + return false; |
|
| 388 | + } |
|
| 371 | 389 | |
| 372 | 390 | // First, reset those who have this as their primary group - this is the easy one. |
| 373 | 391 | $log_inserts = array(); |
@@ -381,8 +399,9 @@ discard block |
||
| 381 | 399 | 'member_list' => $members, |
| 382 | 400 | ) |
| 383 | 401 | ); |
| 384 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 385 | - $log_inserts[] = array('group' => $group_names[$row['id_group']], 'member' => $row['id_member']); |
|
| 402 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 403 | + $log_inserts[] = array('group' => $group_names[$row['id_group']], 'member' => $row['id_member']); |
|
| 404 | + } |
|
| 386 | 405 | $smcFunc['db_free_result']($request); |
| 387 | 406 | |
| 388 | 407 | $smcFunc['db_query']('', ' |
@@ -414,16 +433,17 @@ discard block |
||
| 414 | 433 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
| 415 | 434 | { |
| 416 | 435 | // What log entries must we make for this one, eh? |
| 417 | - foreach (explode(',', $row['additional_groups']) as $group) |
|
| 418 | - if (in_array($group, $groups)) |
|
| 436 | + foreach (explode(',', $row['additional_groups']) as $group) { |
|
| 437 | + if (in_array($group, $groups)) |
|
| 419 | 438 | $log_inserts[] = array('group' => $group_names[$group], 'member' => $row['id_member']); |
| 439 | + } |
|
| 420 | 440 | |
| 421 | 441 | $updates[$row['additional_groups']][] = $row['id_member']; |
| 422 | 442 | } |
| 423 | 443 | $smcFunc['db_free_result']($request); |
| 424 | 444 | |
| 425 | - foreach ($updates as $additional_groups => $memberArray) |
|
| 426 | - $smcFunc['db_query']('', ' |
|
| 445 | + foreach ($updates as $additional_groups => $memberArray) { |
|
| 446 | + $smcFunc['db_query']('', ' |
|
| 427 | 447 | UPDATE {db_prefix}members |
| 428 | 448 | SET additional_groups = {string:additional_groups} |
| 429 | 449 | WHERE id_member IN ({array_int:member_list})', |
@@ -432,6 +452,7 @@ discard block |
||
| 432 | 452 | 'additional_groups' => implode(',', array_diff(explode(',', $additional_groups), $groups)), |
| 433 | 453 | ) |
| 434 | 454 | ); |
| 455 | + } |
|
| 435 | 456 | |
| 436 | 457 | // Their post groups may have changed now... |
| 437 | 458 | updateStats('postgroups', $members); |
@@ -440,8 +461,9 @@ discard block |
||
| 440 | 461 | if (!empty($log_inserts) && !empty($modSettings['modlog_enabled'])) |
| 441 | 462 | { |
| 442 | 463 | require_once($sourcedir . '/Logging.php'); |
| 443 | - foreach ($log_inserts as $extra) |
|
| 444 | - logAction('removed_from_group', $extra, 'admin'); |
|
| 464 | + foreach ($log_inserts as $extra) { |
|
| 465 | + logAction('removed_from_group', $extra, 'admin'); |
|
| 466 | + } |
|
| 445 | 467 | } |
| 446 | 468 | |
| 447 | 469 | // Mission successful. |
@@ -477,21 +499,23 @@ discard block |
||
| 477 | 499 | global $smcFunc, $sourcedir; |
| 478 | 500 | |
| 479 | 501 | // Show your licence, but only if it hasn't been done yet. |
| 480 | - if (!$permissionCheckDone) |
|
| 481 | - isAllowedTo('manage_membergroups'); |
|
| 502 | + if (!$permissionCheckDone) { |
|
| 503 | + isAllowedTo('manage_membergroups'); |
|
| 504 | + } |
|
| 482 | 505 | |
| 483 | 506 | // Make sure we don't keep old stuff cached. |
| 484 | 507 | updateSettings(array('settings_updated' => time())); |
| 485 | 508 | |
| 486 | - if (!is_array($members)) |
|
| 487 | - $members = array((int) $members); |
|
| 488 | - else |
|
| 509 | + if (!is_array($members)) { |
|
| 510 | + $members = array((int) $members); |
|
| 511 | + } else |
|
| 489 | 512 | { |
| 490 | 513 | $members = array_unique($members); |
| 491 | 514 | |
| 492 | 515 | // Make sure all members are integer. |
| 493 | - foreach ($members as $key => $value) |
|
| 494 | - $members[$key] = (int) $value; |
|
| 516 | + foreach ($members as $key => $value) { |
|
| 517 | + $members[$key] = (int) $value; |
|
| 518 | + } |
|
| 495 | 519 | } |
| 496 | 520 | $group = (int) $group; |
| 497 | 521 | |
@@ -508,20 +532,23 @@ discard block |
||
| 508 | 532 | $group_names = array(); |
| 509 | 533 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
| 510 | 534 | { |
| 511 | - if ($row['min_posts'] != -1) |
|
| 512 | - $implicitGroups[] = $row['id_group']; |
|
| 513 | - else |
|
| 514 | - $group_names[$row['id_group']] = $row['group_name']; |
|
| 535 | + if ($row['min_posts'] != -1) { |
|
| 536 | + $implicitGroups[] = $row['id_group']; |
|
| 537 | + } else { |
|
| 538 | + $group_names[$row['id_group']] = $row['group_name']; |
|
| 539 | + } |
|
| 515 | 540 | } |
| 516 | 541 | $smcFunc['db_free_result']($request); |
| 517 | 542 | |
| 518 | 543 | // Sorry, you can't join an implicit group. |
| 519 | - if (in_array($group, $implicitGroups) || empty($members)) |
|
| 520 | - return false; |
|
| 544 | + if (in_array($group, $implicitGroups) || empty($members)) { |
|
| 545 | + return false; |
|
| 546 | + } |
|
| 521 | 547 | |
| 522 | 548 | // Only admins can add admins... |
| 523 | - if (!allowedTo('admin_forum') && $group == 1) |
|
| 524 | - return false; |
|
| 549 | + if (!allowedTo('admin_forum') && $group == 1) { |
|
| 550 | + return false; |
|
| 551 | + } |
|
| 525 | 552 | // ... and assign protected groups! |
| 526 | 553 | elseif (!allowedTo('admin_forum') && !$ignoreProtected) |
| 527 | 554 | { |
@@ -539,13 +566,14 @@ discard block |
||
| 539 | 566 | $smcFunc['db_free_result']($request); |
| 540 | 567 | |
| 541 | 568 | // Is it protected? |
| 542 | - if ($is_protected == 1) |
|
| 543 | - return false; |
|
| 569 | + if ($is_protected == 1) { |
|
| 570 | + return false; |
|
| 571 | + } |
|
| 544 | 572 | } |
| 545 | 573 | |
| 546 | 574 | // Do the actual updates. |
| 547 | - if ($type == 'only_additional') |
|
| 548 | - $smcFunc['db_query']('', ' |
|
| 575 | + if ($type == 'only_additional') { |
|
| 576 | + $smcFunc['db_query']('', ' |
|
| 549 | 577 | UPDATE {db_prefix}members |
| 550 | 578 | SET additional_groups = CASE WHEN additional_groups = {string:blank_string} THEN {string:id_group_string} ELSE CONCAT(additional_groups, {string:id_group_string_extend}) END |
| 551 | 579 | WHERE id_member IN ({array_int:member_list}) |
@@ -559,8 +587,8 @@ discard block |
||
| 559 | 587 | 'blank_string' => '', |
| 560 | 588 | ) |
| 561 | 589 | ); |
| 562 | - elseif ($type == 'only_primary' || $type == 'force_primary') |
|
| 563 | - $smcFunc['db_query']('', ' |
|
| 590 | + } elseif ($type == 'only_primary' || $type == 'force_primary') { |
|
| 591 | + $smcFunc['db_query']('', ' |
|
| 564 | 592 | UPDATE {db_prefix}members |
| 565 | 593 | SET id_group = {int:id_group} |
| 566 | 594 | WHERE id_member IN ({array_int:member_list})' . ($type == 'force_primary' ? '' : ' |
@@ -572,8 +600,8 @@ discard block |
||
| 572 | 600 | 'regular_group' => 0, |
| 573 | 601 | ) |
| 574 | 602 | ); |
| 575 | - elseif ($type == 'auto') |
|
| 576 | - $smcFunc['db_query']('', ' |
|
| 603 | + } elseif ($type == 'auto') { |
|
| 604 | + $smcFunc['db_query']('', ' |
|
| 577 | 605 | UPDATE {db_prefix}members |
| 578 | 606 | SET |
| 579 | 607 | id_group = CASE WHEN id_group = {int:regular_group} THEN {int:id_group} ELSE id_group END, |
@@ -592,9 +620,11 @@ discard block |
||
| 592 | 620 | 'id_group_string_extend' => ',' . $group, |
| 593 | 621 | ) |
| 594 | 622 | ); |
| 623 | + } |
|
| 595 | 624 | // Ack!!? What happened? |
| 596 | - else |
|
| 597 | - trigger_error('addMembersToGroup(): Unknown type \'' . $type . '\'', E_USER_WARNING); |
|
| 625 | + else { |
|
| 626 | + trigger_error('addMembersToGroup(): Unknown type \'' . $type . '\'', E_USER_WARNING); |
|
| 627 | + } |
|
| 598 | 628 | |
| 599 | 629 | call_integration_hook('integrate_add_members_to_group', array($members, $group, &$group_names)); |
| 600 | 630 | |
@@ -603,8 +633,9 @@ discard block |
||
| 603 | 633 | |
| 604 | 634 | // Log the data. |
| 605 | 635 | require_once($sourcedir . '/Logging.php'); |
| 606 | - foreach ($members as $member) |
|
| 607 | - logAction('added_to_group', array('group' => $group_names[$group], 'member' => $member), 'admin'); |
|
| 636 | + foreach ($members as $member) { |
|
| 637 | + logAction('added_to_group', array('group' => $group_names[$group], 'member' => $member), 'admin'); |
|
| 638 | + } |
|
| 608 | 639 | |
| 609 | 640 | return true; |
| 610 | 641 | } |
@@ -632,8 +663,9 @@ discard block |
||
| 632 | 663 | ) |
| 633 | 664 | ); |
| 634 | 665 | $members = array(); |
| 635 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 636 | - $members[$row['id_member']] = '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '">' . $row['real_name'] . '</a>'; |
|
| 666 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 667 | + $members[$row['id_member']] = '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '">' . $row['real_name'] . '</a>'; |
|
| 668 | + } |
|
| 637 | 669 | $smcFunc['db_free_result']($request); |
| 638 | 670 | |
| 639 | 671 | // If there are more than $limit members, add a 'more' link. |
@@ -641,10 +673,10 @@ discard block |
||
| 641 | 673 | { |
| 642 | 674 | array_pop($members); |
| 643 | 675 | return true; |
| 676 | + } else { |
|
| 677 | + return false; |
|
| 678 | + } |
|
| 644 | 679 | } |
| 645 | - else |
|
| 646 | - return false; |
|
| 647 | -} |
|
| 648 | 680 | |
| 649 | 681 | /** |
| 650 | 682 | * Retrieve a list of (visible) membergroups used by the cache. |
@@ -669,8 +701,9 @@ discard block |
||
| 669 | 701 | ) |
| 670 | 702 | ); |
| 671 | 703 | $groupCache = array(); |
| 672 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 673 | - $groupCache[] = '<a href="' . $scripturl . '?action=groups;sa=members;group=' . $row['id_group'] . '" ' . ($row['online_color'] ? 'style="color: ' . $row['online_color'] . '"' : '') . '>' . $row['group_name'] . '</a>'; |
|
| 704 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 705 | + $groupCache[] = '<a href="' . $scripturl . '?action=groups;sa=members;group=' . $row['id_group'] . '" ' . ($row['online_color'] ? 'style="color: ' . $row['online_color'] . '"' : '') . '>' . $row['group_name'] . '</a>'; |
|
| 706 | + } |
|
| 674 | 707 | $smcFunc['db_free_result']($request); |
| 675 | 708 | |
| 676 | 709 | return array( |
@@ -718,8 +751,9 @@ discard block |
||
| 718 | 751 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
| 719 | 752 | { |
| 720 | 753 | // We only list the groups they can see. |
| 721 | - if ($row['hidden'] && !$row['can_moderate'] && !allowedTo('manage_membergroups')) |
|
| 722 | - continue; |
|
| 754 | + if ($row['hidden'] && !$row['can_moderate'] && !allowedTo('manage_membergroups')) { |
|
| 755 | + continue; |
|
| 756 | + } |
|
| 723 | 757 | |
| 724 | 758 | $row['icons'] = explode('#', $row['icons']); |
| 725 | 759 | |
@@ -754,12 +788,11 @@ discard block |
||
| 754 | 788 | 'group_list' => $group_ids, |
| 755 | 789 | ) |
| 756 | 790 | ); |
| 757 | - while ($row = $smcFunc['db_fetch_assoc']($query)) |
|
| 758 | - $groups[$row['id_group']]['num_members'] += $row['num_members']; |
|
| 791 | + while ($row = $smcFunc['db_fetch_assoc']($query)) { |
|
| 792 | + $groups[$row['id_group']]['num_members'] += $row['num_members']; |
|
| 793 | + } |
|
| 759 | 794 | $smcFunc['db_free_result']($query); |
| 760 | - } |
|
| 761 | - |
|
| 762 | - else |
|
| 795 | + } else |
|
| 763 | 796 | { |
| 764 | 797 | $query = $smcFunc['db_query']('', ' |
| 765 | 798 | SELECT id_group, COUNT(*) AS num_members |
@@ -770,8 +803,9 @@ discard block |
||
| 770 | 803 | 'group_list' => $group_ids, |
| 771 | 804 | ) |
| 772 | 805 | ); |
| 773 | - while ($row = $smcFunc['db_fetch_assoc']($query)) |
|
| 774 | - $groups[$row['id_group']]['num_members'] += $row['num_members']; |
|
| 806 | + while ($row = $smcFunc['db_fetch_assoc']($query)) { |
|
| 807 | + $groups[$row['id_group']]['num_members'] += $row['num_members']; |
|
| 808 | + } |
|
| 775 | 809 | $smcFunc['db_free_result']($query); |
| 776 | 810 | |
| 777 | 811 | // Only do additional groups if we can moderate... |
@@ -790,8 +824,9 @@ discard block |
||
| 790 | 824 | 'blank_string' => '', |
| 791 | 825 | ) |
| 792 | 826 | ); |
| 793 | - while ($row = $smcFunc['db_fetch_assoc']($query)) |
|
| 794 | - $groups[$row['id_group']]['num_members'] += $row['num_members']; |
|
| 827 | + while ($row = $smcFunc['db_fetch_assoc']($query)) { |
|
| 828 | + $groups[$row['id_group']]['num_members'] += $row['num_members']; |
|
| 829 | + } |
|
| 795 | 830 | $smcFunc['db_free_result']($query); |
| 796 | 831 | } |
| 797 | 832 | } |
@@ -805,8 +840,9 @@ discard block |
||
| 805 | 840 | 'group_list' => $group_ids, |
| 806 | 841 | ) |
| 807 | 842 | ); |
| 808 | - while ($row = $smcFunc['db_fetch_assoc']($query)) |
|
| 809 | - $groups[$row['id_group']]['moderators'][] = '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '">' . $row['real_name'] . '</a>'; |
|
| 843 | + while ($row = $smcFunc['db_fetch_assoc']($query)) { |
|
| 844 | + $groups[$row['id_group']]['moderators'][] = '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '">' . $row['real_name'] . '</a>'; |
|
| 845 | + } |
|
| 810 | 846 | $smcFunc['db_free_result']($query); |
| 811 | 847 | } |
| 812 | 848 | |
@@ -815,8 +851,9 @@ discard block |
||
| 815 | 851 | { |
| 816 | 852 | $sort_ascending = strpos($sort, 'DESC') === false; |
| 817 | 853 | |
| 818 | - foreach ($groups as $group) |
|
| 819 | - $sort_array[] = $group['id_group'] != 3 ? (int) $group['num_members'] : -1; |
|
| 854 | + foreach ($groups as $group) { |
|
| 855 | + $sort_array[] = $group['id_group'] != 3 ? (int) $group['num_members'] : -1; |
|
| 856 | + } |
|
| 820 | 857 | |
| 821 | 858 | array_multisort($sort_array, $sort_ascending ? SORT_ASC : SORT_DESC, SORT_REGULAR, $groups); |
| 822 | 859 | } |
@@ -13,8 +13,9 @@ discard block |
||
| 13 | 13 | * @version 2.1 Beta 3 |
| 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 | * Redirect to the user help ;). |
@@ -95,12 +96,13 @@ discard block |
||
| 95 | 96 | ); |
| 96 | 97 | |
| 97 | 98 | // Have we got a localized one? |
| 98 | - if (file_exists($boarddir . '/agreement.' . $user_info['language'] . '.txt')) |
|
| 99 | - $context['agreement'] = parse_bbc(file_get_contents($boarddir . '/agreement.' . $user_info['language'] . '.txt'), true, 'agreement_' . $user_info['language']); |
|
| 100 | - elseif (file_exists($boarddir . '/agreement.txt')) |
|
| 101 | - $context['agreement'] = parse_bbc(file_get_contents($boarddir . '/agreement.txt'), true, 'agreement'); |
|
| 102 | - else |
|
| 103 | - $context['agreement'] = ''; |
|
| 99 | + if (file_exists($boarddir . '/agreement.' . $user_info['language'] . '.txt')) { |
|
| 100 | + $context['agreement'] = parse_bbc(file_get_contents($boarddir . '/agreement.' . $user_info['language'] . '.txt'), true, 'agreement_' . $user_info['language']); |
|
| 101 | + } elseif (file_exists($boarddir . '/agreement.txt')) { |
|
| 102 | + $context['agreement'] = parse_bbc(file_get_contents($boarddir . '/agreement.txt'), true, 'agreement'); |
|
| 103 | + } else { |
|
| 104 | + $context['agreement'] = ''; |
|
| 105 | + } |
|
| 104 | 106 | |
| 105 | 107 | // Nothing to show, so let's get out of here |
| 106 | 108 | if (empty($context['agreement'])) |
@@ -128,18 +130,21 @@ discard block |
||
| 128 | 130 | { |
| 129 | 131 | global $txt, $helptxt, $context, $scripturl; |
| 130 | 132 | |
| 131 | - if (!isset($_GET['help']) || !is_string($_GET['help'])) |
|
| 132 | - fatal_lang_error('no_access', false); |
|
| 133 | + if (!isset($_GET['help']) || !is_string($_GET['help'])) { |
|
| 134 | + fatal_lang_error('no_access', false); |
|
| 135 | + } |
|
| 133 | 136 | |
| 134 | - if (!isset($helptxt)) |
|
| 135 | - $helptxt = array(); |
|
| 137 | + if (!isset($helptxt)) { |
|
| 138 | + $helptxt = array(); |
|
| 139 | + } |
|
| 136 | 140 | |
| 137 | 141 | // Load the admin help language file and template. |
| 138 | 142 | loadLanguage('Help'); |
| 139 | 143 | |
| 140 | 144 | // Permission specific help? |
| 141 | - if (isset($_GET['help']) && substr($_GET['help'], 0, 14) == 'permissionhelp') |
|
| 142 | - loadLanguage('ManagePermissions'); |
|
| 145 | + if (isset($_GET['help']) && substr($_GET['help'], 0, 14) == 'permissionhelp') { |
|
| 146 | + loadLanguage('ManagePermissions'); |
|
| 147 | + } |
|
| 143 | 148 | |
| 144 | 149 | loadTemplate('Help'); |
| 145 | 150 | |
@@ -154,16 +159,18 @@ discard block |
||
| 154 | 159 | $context['sub_template'] = 'popup'; |
| 155 | 160 | |
| 156 | 161 | // What help string should be used? |
| 157 | - if (isset($helptxt[$_GET['help']])) |
|
| 158 | - $context['help_text'] = $helptxt[$_GET['help']]; |
|
| 159 | - elseif (isset($txt[$_GET['help']])) |
|
| 160 | - $context['help_text'] = $txt[$_GET['help']]; |
|
| 161 | - else |
|
| 162 | - $context['help_text'] = $_GET['help']; |
|
| 162 | + if (isset($helptxt[$_GET['help']])) { |
|
| 163 | + $context['help_text'] = $helptxt[$_GET['help']]; |
|
| 164 | + } elseif (isset($txt[$_GET['help']])) { |
|
| 165 | + $context['help_text'] = $txt[$_GET['help']]; |
|
| 166 | + } else { |
|
| 167 | + $context['help_text'] = $_GET['help']; |
|
| 168 | + } |
|
| 163 | 169 | |
| 164 | 170 | // Does this text contain a link that we should fill in? |
| 165 | - if (preg_match('~%([0-9]+\$)?s\?~', $context['help_text'], $match)) |
|
| 166 | - $context['help_text'] = sprintf($context['help_text'], $scripturl, $context['session_id'], $context['session_var']); |
|
| 167 | -} |
|
| 171 | + if (preg_match('~%([0-9]+\$)?s\?~', $context['help_text'], $match)) { |
|
| 172 | + $context['help_text'] = sprintf($context['help_text'], $scripturl, $context['session_id'], $context['session_var']); |
|
| 173 | + } |
|
| 174 | + } |
|
| 168 | 175 | |
| 169 | 176 | ?> |
| 170 | 177 | \ No newline at end of file |
@@ -13,8 +13,9 @@ discard block |
||
| 13 | 13 | * @version 2.1 Beta 3 |
| 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 | * Create a menu. |
@@ -64,22 +65,26 @@ discard block |
||
| 64 | 65 | $menu_context['current_action'] = isset($menuOptions['action']) ? $menuOptions['action'] : $context['current_action']; |
| 65 | 66 | |
| 66 | 67 | // Allow extend *any* menu with a single hook |
| 67 | - if (!empty($menu_context['current_action'])) |
|
| 68 | - call_integration_hook('integrate_' . $menu_context['current_action'] . '_areas', array(&$menuData)); |
|
| 68 | + if (!empty($menu_context['current_action'])) { |
|
| 69 | + call_integration_hook('integrate_' . $menu_context['current_action'] . '_areas', array(&$menuData)); |
|
| 70 | + } |
|
| 69 | 71 | |
| 70 | 72 | // What is the current area selected? |
| 71 | - if (isset($menuOptions['current_area']) || isset($_GET['area'])) |
|
| 72 | - $menu_context['current_area'] = isset($menuOptions['current_area']) ? $menuOptions['current_area'] : $_GET['area']; |
|
| 73 | + if (isset($menuOptions['current_area']) || isset($_GET['area'])) { |
|
| 74 | + $menu_context['current_area'] = isset($menuOptions['current_area']) ? $menuOptions['current_area'] : $_GET['area']; |
|
| 75 | + } |
|
| 73 | 76 | |
| 74 | 77 | // Build a list of additional parameters that should go in the URL. |
| 75 | 78 | $menu_context['extra_parameters'] = ''; |
| 76 | - if (!empty($menuOptions['extra_url_parameters'])) |
|
| 77 | - foreach ($menuOptions['extra_url_parameters'] as $key => $value) |
|
| 79 | + if (!empty($menuOptions['extra_url_parameters'])) { |
|
| 80 | + foreach ($menuOptions['extra_url_parameters'] as $key => $value) |
|
| 78 | 81 | $menu_context['extra_parameters'] .= ';' . $key . '=' . $value; |
| 82 | + } |
|
| 79 | 83 | |
| 80 | 84 | // Only include the session ID in the URL if it's strictly necessary. |
| 81 | - if (empty($menuOptions['disable_url_session_check'])) |
|
| 82 | - $menu_context['extra_parameters'] .= ';' . $context['session_var'] . '=' . $context['session_id']; |
|
| 85 | + if (empty($menuOptions['disable_url_session_check'])) { |
|
| 86 | + $menu_context['extra_parameters'] .= ';' . $context['session_var'] . '=' . $context['session_id']; |
|
| 87 | + } |
|
| 83 | 88 | |
| 84 | 89 | $include_data = array(); |
| 85 | 90 | |
@@ -87,8 +92,9 @@ discard block |
||
| 87 | 92 | foreach ($menuData as $section_id => $section) |
| 88 | 93 | { |
| 89 | 94 | // Is this enabled - or has as permission check - which fails? |
| 90 | - if ((isset($section['enabled']) && $section['enabled'] == false) || (isset($section['permission']) && !allowedTo($section['permission']))) |
|
| 91 | - continue; |
|
| 95 | + if ((isset($section['enabled']) && $section['enabled'] == false) || (isset($section['permission']) && !allowedTo($section['permission']))) { |
|
| 96 | + continue; |
|
| 97 | + } |
|
| 92 | 98 | |
| 93 | 99 | // Now we cycle through the sections to pick the right area. |
| 94 | 100 | foreach ($section['areas'] as $area_id => $area) |
@@ -110,41 +116,45 @@ discard block |
||
| 110 | 116 | if (empty($area['hidden'])) |
| 111 | 117 | { |
| 112 | 118 | // First time this section? |
| 113 | - if (!isset($menu_context['sections'][$section_id])) |
|
| 114 | - $menu_context['sections'][$section_id]['title'] = $section['title']; |
|
| 119 | + if (!isset($menu_context['sections'][$section_id])) { |
|
| 120 | + $menu_context['sections'][$section_id]['title'] = $section['title']; |
|
| 121 | + } |
|
| 115 | 122 | |
| 116 | 123 | $menu_context['sections'][$section_id]['areas'][$area_id] = array('label' => isset($area['label']) ? $area['label'] : $txt[$area_id]); |
| 117 | 124 | // We'll need the ID as well... |
| 118 | 125 | $menu_context['sections'][$section_id]['id'] = $section_id; |
| 119 | 126 | // Does it have a custom URL? |
| 120 | - if (isset($area['custom_url'])) |
|
| 121 | - $menu_context['sections'][$section_id]['areas'][$area_id]['url'] = $area['custom_url']; |
|
| 127 | + if (isset($area['custom_url'])) { |
|
| 128 | + $menu_context['sections'][$section_id]['areas'][$area_id]['url'] = $area['custom_url']; |
|
| 129 | + } |
|
| 122 | 130 | |
| 123 | 131 | // Does this area have its own icon? |
| 124 | - if (!isset($area['force_menu_into_arms_of_another_menu']) && $user_info['name'] == 'iamanoompaloompa') |
|
| 125 | - $menu_context['sections'][$section_id]['areas'][$area_id] = safe_unserialize(base64_decode('YTozOntzOjU6ImxhYmVsIjtzOjEyOiJPb21wYSBMb29tcGEiO3M6MzoidXJsIjtzOjQzOiJodHRwOi8vZW4ud2lraXBlZGlhLm9yZy93aWtpL09vbXBhX0xvb21wYXM/IjtzOjQ6Imljb24iO3M6ODY6IjxpbWcgc3JjPSJodHRwOi8vd3d3LnNpbXBsZW1hY2hpbmVzLm9yZy9pbWFnZXMvb29tcGEuZ2lmIiBhbHQ9IkknbSBhbiBPb21wYSBMb29tcGEiIC8+Ijt9')); |
|
| 126 | - elseif (isset($area['icon']) && file_exists($settings['theme_dir'] . '/images/admin/' . $area['icon'])) |
|
| 127 | - $menu_context['sections'][$section_id]['areas'][$area_id]['icon'] = '<img src="' . $settings['images_url'] . '/admin/' . $area['icon'] . '" alt="">'; |
|
| 128 | - elseif (isset($area['icon']) && file_exists($settings['default_theme_dir'] . '/images/admin/' . $area['icon'])) |
|
| 129 | - $menu_context['sections'][$section_id]['areas'][$area_id]['icon'] = '<img src="' . $settings['default_images_url'] . '/admin/' . $area['icon'] . '" alt="">'; |
|
| 130 | - elseif (isset($area['icon'])) |
|
| 131 | - $menu_context['sections'][$section_id]['areas'][$area_id]['icon'] = '<span class="generic_icons ' . $area['icon'] . '"></span>'; |
|
| 132 | - else |
|
| 133 | - $menu_context['sections'][$section_id]['areas'][$area_id]['icon'] = '<span class="generic_icons ' . $area_id . '"></span>'; |
|
| 134 | - |
|
| 135 | - if (isset($area['icon_class']) && empty($menu_context['sections'][$section_id]['areas'][$area_id]['icon'])) |
|
| 136 | - $menu_context['sections'][$section_id]['areas'][$area_id]['icon_class'] = $menu_context['current_action'] . '_menu_icon ' . $area['icon_class']; |
|
| 137 | - elseif (isset($area['icon'])) |
|
| 132 | + if (!isset($area['force_menu_into_arms_of_another_menu']) && $user_info['name'] == 'iamanoompaloompa') { |
|
| 133 | + $menu_context['sections'][$section_id]['areas'][$area_id] = safe_unserialize(base64_decode('YTozOntzOjU6ImxhYmVsIjtzOjEyOiJPb21wYSBMb29tcGEiO3M6MzoidXJsIjtzOjQzOiJodHRwOi8vZW4ud2lraXBlZGlhLm9yZy93aWtpL09vbXBhX0xvb21wYXM/IjtzOjQ6Imljb24iO3M6ODY6IjxpbWcgc3JjPSJodHRwOi8vd3d3LnNpbXBsZW1hY2hpbmVzLm9yZy9pbWFnZXMvb29tcGEuZ2lmIiBhbHQ9IkknbSBhbiBPb21wYSBMb29tcGEiIC8+Ijt9')); |
|
| 134 | + } elseif (isset($area['icon']) && file_exists($settings['theme_dir'] . '/images/admin/' . $area['icon'])) { |
|
| 135 | + $menu_context['sections'][$section_id]['areas'][$area_id]['icon'] = '<img src="' . $settings['images_url'] . '/admin/' . $area['icon'] . '" alt="">'; |
|
| 136 | + } elseif (isset($area['icon']) && file_exists($settings['default_theme_dir'] . '/images/admin/' . $area['icon'])) { |
|
| 137 | + $menu_context['sections'][$section_id]['areas'][$area_id]['icon'] = '<img src="' . $settings['default_images_url'] . '/admin/' . $area['icon'] . '" alt="">'; |
|
| 138 | + } elseif (isset($area['icon'])) { |
|
| 139 | + $menu_context['sections'][$section_id]['areas'][$area_id]['icon'] = '<span class="generic_icons ' . $area['icon'] . '"></span>'; |
|
| 140 | + } else { |
|
| 141 | + $menu_context['sections'][$section_id]['areas'][$area_id]['icon'] = '<span class="generic_icons ' . $area_id . '"></span>'; |
|
| 142 | + } |
|
| 143 | + |
|
| 144 | + if (isset($area['icon_class']) && empty($menu_context['sections'][$section_id]['areas'][$area_id]['icon'])) { |
|
| 145 | + $menu_context['sections'][$section_id]['areas'][$area_id]['icon_class'] = $menu_context['current_action'] . '_menu_icon ' . $area['icon_class']; |
|
| 146 | + } elseif (isset($area['icon'])) |
|
| 138 | 147 | { |
| 139 | - if ((substr($area['icon'], -4) === '.png' || substr($area['icon'], -4) === '.gif') && file_exists($settings['theme_dir'] . '/images/admin/big/' . $area['icon'])) |
|
| 140 | - $menu_context['sections'][$section_id]['areas'][$area_id]['icon_file'] = $settings['theme_url'] . '/images/admin/big/' . $area['icon']; |
|
| 141 | - elseif ((substr($area['icon'], -4) === '.png' || substr($area['icon'], -4) === '.gif') && file_exists($settings['default_theme_dir'] . '/images/admin/big/' . $area['icon'])) |
|
| 142 | - $menu_context['sections'][$section_id]['areas'][$area_id]['icon_file'] = $settings['default_theme_url'] . '/images/admin/big/' . $area['icon']; |
|
| 148 | + if ((substr($area['icon'], -4) === '.png' || substr($area['icon'], -4) === '.gif') && file_exists($settings['theme_dir'] . '/images/admin/big/' . $area['icon'])) { |
|
| 149 | + $menu_context['sections'][$section_id]['areas'][$area_id]['icon_file'] = $settings['theme_url'] . '/images/admin/big/' . $area['icon']; |
|
| 150 | + } elseif ((substr($area['icon'], -4) === '.png' || substr($area['icon'], -4) === '.gif') && file_exists($settings['default_theme_dir'] . '/images/admin/big/' . $area['icon'])) { |
|
| 151 | + $menu_context['sections'][$section_id]['areas'][$area_id]['icon_file'] = $settings['default_theme_url'] . '/images/admin/big/' . $area['icon']; |
|
| 152 | + } |
|
| 143 | 153 | |
| 144 | 154 | $menu_context['sections'][$section_id]['areas'][$area_id]['icon_class'] = $menu_context['current_action'] . '_menu_icon ' . str_replace(array('.png', '.gif'), '', $area['icon']); |
| 155 | + } else { |
|
| 156 | + $menu_context['sections'][$section_id]['areas'][$area_id]['icon_class'] = $menu_context['current_action'] . '_menu_icon ' . str_replace(array('.png', '.gif'), '', $area_id); |
|
| 145 | 157 | } |
| 146 | - else |
|
| 147 | - $menu_context['sections'][$section_id]['areas'][$area_id]['icon_class'] = $menu_context['current_action'] . '_menu_icon ' . str_replace(array('.png', '.gif'), '', $area_id); |
|
| 148 | 158 | |
| 149 | 159 | // Some areas may be listed but not active, which we show as greyed out. |
| 150 | 160 | $menu_context['sections'][$section_id]['areas'][$area_id]['inactive'] = !empty($area['inactive']); |
@@ -158,35 +168,41 @@ discard block |
||
| 158 | 168 | { |
| 159 | 169 | if ((empty($sub[1]) || allowedTo($sub[1])) && (!isset($sub['enabled']) || !empty($sub['enabled']))) |
| 160 | 170 | { |
| 161 | - if ($first_sa == null) |
|
| 162 | - $first_sa = $sa; |
|
| 171 | + if ($first_sa == null) { |
|
| 172 | + $first_sa = $sa; |
|
| 173 | + } |
|
| 163 | 174 | |
| 164 | 175 | $menu_context['sections'][$section_id]['areas'][$area_id]['subsections'][$sa] = array('label' => $sub[0]); |
| 165 | 176 | // Custom URL? |
| 166 | - if (isset($sub['url'])) |
|
| 167 | - $menu_context['sections'][$section_id]['areas'][$area_id]['subsections'][$sa]['url'] = $sub['url']; |
|
| 177 | + if (isset($sub['url'])) { |
|
| 178 | + $menu_context['sections'][$section_id]['areas'][$area_id]['subsections'][$sa]['url'] = $sub['url']; |
|
| 179 | + } |
|
| 168 | 180 | |
| 169 | 181 | // A bit complicated - but is this set? |
| 170 | 182 | if ($menu_context['current_area'] == $area_id) |
| 171 | 183 | { |
| 172 | 184 | // Save which is the first... |
| 173 | - if (empty($first_sa)) |
|
| 174 | - $first_sa = $sa; |
|
| 185 | + if (empty($first_sa)) { |
|
| 186 | + $first_sa = $sa; |
|
| 187 | + } |
|
| 175 | 188 | |
| 176 | 189 | // Is this the current subsection? |
| 177 | - if (isset($_REQUEST['sa']) && $_REQUEST['sa'] == $sa) |
|
| 178 | - $menu_context['current_subsection'] = $sa; |
|
| 190 | + if (isset($_REQUEST['sa']) && $_REQUEST['sa'] == $sa) { |
|
| 191 | + $menu_context['current_subsection'] = $sa; |
|
| 192 | + } |
|
| 179 | 193 | // Otherwise is it the default? |
| 180 | - elseif (!isset($menu_context['current_subsection']) && !empty($sub[2])) |
|
| 181 | - $menu_context['current_subsection'] = $sa; |
|
| 194 | + elseif (!isset($menu_context['current_subsection']) && !empty($sub[2])) { |
|
| 195 | + $menu_context['current_subsection'] = $sa; |
|
| 196 | + } |
|
| 182 | 197 | } |
| 183 | 198 | |
| 184 | 199 | // Let's assume this is the last, for now. |
| 185 | 200 | $last_sa = $sa; |
| 186 | 201 | } |
| 187 | 202 | // Mark it as disabled... |
| 188 | - else |
|
| 189 | - $menu_context['sections'][$section_id]['areas'][$area_id]['subsections'][$sa]['disabled'] = true; |
|
| 203 | + else { |
|
| 204 | + $menu_context['sections'][$section_id]['areas'][$area_id]['subsections'][$sa]['disabled'] = true; |
|
| 205 | + } |
|
| 190 | 206 | } |
| 191 | 207 | |
| 192 | 208 | // Set which one is first, last and selected in the group. |
@@ -195,8 +211,9 @@ discard block |
||
| 195 | 211 | $menu_context['sections'][$section_id]['areas'][$area_id]['subsections'][$context['right_to_left'] ? $last_sa : $first_sa]['is_first'] = true; |
| 196 | 212 | $menu_context['sections'][$section_id]['areas'][$area_id]['subsections'][$context['right_to_left'] ? $first_sa : $last_sa]['is_last'] = true; |
| 197 | 213 | |
| 198 | - if ($menu_context['current_area'] == $area_id && !isset($menu_context['current_subsection'])) |
|
| 199 | - $menu_context['current_subsection'] = $first_sa; |
|
| 214 | + if ($menu_context['current_area'] == $area_id && !isset($menu_context['current_subsection'])) { |
|
| 215 | + $menu_context['current_subsection'] = $first_sa; |
|
| 216 | + } |
|
| 200 | 217 | } |
| 201 | 218 | } |
| 202 | 219 | } |
@@ -230,23 +247,26 @@ discard block |
||
| 230 | 247 | $menu_context['base_url'] = isset($menuOptions['base_url']) ? $menuOptions['base_url'] : $scripturl . '?action=' . $menu_context['current_action']; |
| 231 | 248 | |
| 232 | 249 | // If we didn't find the area we were looking for go to a default one. |
| 233 | - if (isset($backup_area) && empty($found_section)) |
|
| 234 | - $menu_context['current_area'] = $backup_area; |
|
| 250 | + if (isset($backup_area) && empty($found_section)) { |
|
| 251 | + $menu_context['current_area'] = $backup_area; |
|
| 252 | + } |
|
| 235 | 253 | |
| 236 | 254 | // If there are sections quickly goes through all the sections to check if the base menu has an url |
| 237 | 255 | if (!empty($menu_context['current_section'])) |
| 238 | 256 | { |
| 239 | 257 | $menu_context['sections'][$menu_context['current_section']]['selected'] = true; |
| 240 | 258 | $menu_context['sections'][$menu_context['current_section']]['areas'][$menu_context['current_area']]['selected'] = true; |
| 241 | - if (!empty($menu_context['sections'][$menu_context['current_section']]['areas'][$menu_context['current_area']]['subsections'][$context['current_subaction']])) |
|
| 242 | - $menu_context['sections'][$menu_context['current_section']]['areas'][$menu_context['current_area']]['subsections'][$context['current_subaction']]['selected'] = true; |
|
| 259 | + if (!empty($menu_context['sections'][$menu_context['current_section']]['areas'][$menu_context['current_area']]['subsections'][$context['current_subaction']])) { |
|
| 260 | + $menu_context['sections'][$menu_context['current_section']]['areas'][$menu_context['current_area']]['subsections'][$context['current_subaction']]['selected'] = true; |
|
| 261 | + } |
|
| 243 | 262 | |
| 244 | - foreach ($menu_context['sections'] as $section_id => $section) |
|
| 245 | - foreach ($section['areas'] as $area_id => $area) |
|
| 263 | + foreach ($menu_context['sections'] as $section_id => $section) { |
|
| 264 | + foreach ($section['areas'] as $area_id => $area) |
|
| 246 | 265 | { |
| 247 | 266 | if (!isset($menu_context['sections'][$section_id]['url'])) |
| 248 | 267 | { |
| 249 | 268 | $menu_context['sections'][$section_id]['url'] = isset($area['url']) ? $area['url'] : $menu_context['base_url'] . ';area=' . $area_id; |
| 269 | + } |
|
| 250 | 270 | break; |
| 251 | 271 | } |
| 252 | 272 | } |
@@ -257,8 +277,9 @@ discard block |
||
| 257 | 277 | { |
| 258 | 278 | // Never happened! |
| 259 | 279 | $context['max_menu_id']--; |
| 260 | - if ($context['max_menu_id'] == 0) |
|
| 261 | - unset($context['max_menu_id']); |
|
| 280 | + if ($context['max_menu_id'] == 0) { |
|
| 281 | + unset($context['max_menu_id']); |
|
| 282 | + } |
|
| 262 | 283 | |
| 263 | 284 | return false; |
| 264 | 285 | } |
@@ -269,8 +290,9 @@ discard block |
||
| 269 | 290 | $context['template_layers'][] = $menu_context['layer_name']; |
| 270 | 291 | |
| 271 | 292 | // Check we had something - for sanity sake. |
| 272 | - if (empty($include_data)) |
|
| 273 | - return false; |
|
| 293 | + if (empty($include_data)) { |
|
| 294 | + return false; |
|
| 295 | + } |
|
| 274 | 296 | |
| 275 | 297 | // Finally - return information on the selected item. |
| 276 | 298 | $include_data += array( |
@@ -293,12 +315,14 @@ discard block |
||
| 293 | 315 | global $context; |
| 294 | 316 | |
| 295 | 317 | $menu_name = $menu_id == 'last' && isset($context['max_menu_id']) && isset($context['menu_data_' . $context['max_menu_id']]) ? 'menu_data_' . $context['max_menu_id'] : 'menu_data_' . $menu_id; |
| 296 | - if (!isset($context[$menu_name])) |
|
| 297 | - return false; |
|
| 318 | + if (!isset($context[$menu_name])) { |
|
| 319 | + return false; |
|
| 320 | + } |
|
| 298 | 321 | |
| 299 | 322 | $layer_index = array_search($context[$menu_name]['layer_name'], $context['template_layers']); |
| 300 | - if ($layer_index !== false) |
|
| 301 | - unset($context['template_layers'][$layer_index]); |
|
| 323 | + if ($layer_index !== false) { |
|
| 324 | + unset($context['template_layers'][$layer_index]); |
|
| 325 | + } |
|
| 302 | 326 | |
| 303 | 327 | unset($context[$menu_name]); |
| 304 | 328 | } |
@@ -13,8 +13,9 @@ discard block |
||
| 13 | 13 | * @version 2.1 Beta 3 |
| 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 entrance point for the Manage Members screen. |
@@ -62,16 +63,18 @@ discard block |
||
| 62 | 63 | $context['activation_numbers'] = array(); |
| 63 | 64 | $context['awaiting_activation'] = 0; |
| 64 | 65 | $context['awaiting_approval'] = 0; |
| 65 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 66 | - $context['activation_numbers'][$row['is_activated']] = $row['total_members']; |
|
| 66 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 67 | + $context['activation_numbers'][$row['is_activated']] = $row['total_members']; |
|
| 68 | + } |
|
| 67 | 69 | $smcFunc['db_free_result']($request); |
| 68 | 70 | |
| 69 | 71 | foreach ($context['activation_numbers'] as $activation_type => $total_members) |
| 70 | 72 | { |
| 71 | - if (in_array($activation_type, array(0, 2))) |
|
| 72 | - $context['awaiting_activation'] += $total_members; |
|
| 73 | - elseif (in_array($activation_type, array(3, 4, 5))) |
|
| 74 | - $context['awaiting_approval'] += $total_members; |
|
| 73 | + if (in_array($activation_type, array(0, 2))) { |
|
| 74 | + $context['awaiting_activation'] += $total_members; |
|
| 75 | + } elseif (in_array($activation_type, array(3, 4, 5))) { |
|
| 76 | + $context['awaiting_approval'] += $total_members; |
|
| 77 | + } |
|
| 75 | 78 | } |
| 76 | 79 | |
| 77 | 80 | // For the page header... do we show activation? |
@@ -124,8 +127,9 @@ discard block |
||
| 124 | 127 | } |
| 125 | 128 | if (!$context['show_approve'] && ($_REQUEST['sa'] != 'browse' || $_REQUEST['type'] != 'approve')) |
| 126 | 129 | { |
| 127 | - if (!$context['show_activate'] && ($_REQUEST['sa'] != 'browse' || $_REQUEST['type'] != 'activate')) |
|
| 128 | - $context['tabs']['search']['is_last'] = true; |
|
| 130 | + if (!$context['show_activate'] && ($_REQUEST['sa'] != 'browse' || $_REQUEST['type'] != 'activate')) { |
|
| 131 | + $context['tabs']['search']['is_last'] = true; |
|
| 132 | + } |
|
| 129 | 133 | unset($context['tabs']['approve']); |
| 130 | 134 | } |
| 131 | 135 | |
@@ -157,8 +161,9 @@ discard block |
||
| 157 | 161 | foreach ($_POST['delete'] as $key => $value) |
| 158 | 162 | { |
| 159 | 163 | // Don't delete yourself, idiot. |
| 160 | - if ($value != $user_info['id']) |
|
| 161 | - $delete[$key] = (int) $value; |
|
| 164 | + if ($value != $user_info['id']) { |
|
| 165 | + $delete[$key] = (int) $value; |
|
| 166 | + } |
|
| 162 | 167 | } |
| 163 | 168 | |
| 164 | 169 | if (!empty($delete)) |
@@ -194,17 +199,18 @@ discard block |
||
| 194 | 199 | ); |
| 195 | 200 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
| 196 | 201 | { |
| 197 | - if ($row['min_posts'] == -1) |
|
| 198 | - $context['membergroups'][] = array( |
|
| 202 | + if ($row['min_posts'] == -1) { |
|
| 203 | + $context['membergroups'][] = array( |
|
| 199 | 204 | 'id' => $row['id_group'], |
| 200 | 205 | 'name' => $row['group_name'], |
| 201 | 206 | 'can_be_additional' => true |
| 202 | 207 | ); |
| 203 | - else |
|
| 204 | - $context['postgroups'][] = array( |
|
| 208 | + } else { |
|
| 209 | + $context['postgroups'][] = array( |
|
| 205 | 210 | 'id' => $row['id_group'], |
| 206 | 211 | 'name' => $row['group_name'] |
| 207 | 212 | ); |
| 213 | + } |
|
| 208 | 214 | } |
| 209 | 215 | $smcFunc['db_free_result']($request); |
| 210 | 216 | |
@@ -268,14 +274,15 @@ discard block |
||
| 268 | 274 | call_integration_hook('integrate_view_members_params', array(&$params)); |
| 269 | 275 | |
| 270 | 276 | $search_params = array(); |
| 271 | - if ($context['sub_action'] == 'query' && !empty($_REQUEST['params']) && empty($_POST['types'])) |
|
| 272 | - $search_params = smf_json_decode(base64_decode($_REQUEST['params']), true); |
|
| 273 | - elseif (!empty($_POST)) |
|
| 277 | + if ($context['sub_action'] == 'query' && !empty($_REQUEST['params']) && empty($_POST['types'])) { |
|
| 278 | + $search_params = smf_json_decode(base64_decode($_REQUEST['params']), true); |
|
| 279 | + } elseif (!empty($_POST)) |
|
| 274 | 280 | { |
| 275 | 281 | $search_params['types'] = $_POST['types']; |
| 276 | - foreach ($params as $param_name => $param_info) |
|
| 277 | - if (isset($_POST[$param_name])) |
|
| 282 | + foreach ($params as $param_name => $param_info) { |
|
| 283 | + if (isset($_POST[$param_name])) |
|
| 278 | 284 | $search_params[$param_name] = $_POST[$param_name]; |
| 285 | + } |
|
| 279 | 286 | } |
| 280 | 287 | |
| 281 | 288 | $search_url_params = isset($search_params) ? base64_encode(json_encode($search_params)) : null; |
@@ -288,18 +295,21 @@ discard block |
||
| 288 | 295 | foreach ($params as $param_name => $param_info) |
| 289 | 296 | { |
| 290 | 297 | // Not filled in? |
| 291 | - if (!isset($search_params[$param_name]) || $search_params[$param_name] === '') |
|
| 292 | - continue; |
|
| 298 | + if (!isset($search_params[$param_name]) || $search_params[$param_name] === '') { |
|
| 299 | + continue; |
|
| 300 | + } |
|
| 293 | 301 | |
| 294 | 302 | // Make sure numeric values are really numeric. |
| 295 | - if (in_array($param_info['type'], array('int', 'age'))) |
|
| 296 | - $search_params[$param_name] = (int) $search_params[$param_name]; |
|
| 303 | + if (in_array($param_info['type'], array('int', 'age'))) { |
|
| 304 | + $search_params[$param_name] = (int) $search_params[$param_name]; |
|
| 305 | + } |
|
| 297 | 306 | // Date values have to match the specified format. |
| 298 | 307 | elseif ($param_info['type'] == 'date') |
| 299 | 308 | { |
| 300 | 309 | // Check if this date format is valid. |
| 301 | - if (preg_match('/^\d{4}-\d{1,2}-\d{1,2}$/', $search_params[$param_name]) == 0) |
|
| 302 | - continue; |
|
| 310 | + if (preg_match('/^\d{4}-\d{1,2}-\d{1,2}$/', $search_params[$param_name]) == 0) { |
|
| 311 | + continue; |
|
| 312 | + } |
|
| 303 | 313 | |
| 304 | 314 | $search_params[$param_name] = strtotime($search_params[$param_name]); |
| 305 | 315 | } |
@@ -308,8 +318,9 @@ discard block |
||
| 308 | 318 | if (!empty($param_info['range'])) |
| 309 | 319 | { |
| 310 | 320 | // Default to '=', just in case... |
| 311 | - if (empty($range_trans[$search_params['types'][$param_name]])) |
|
| 312 | - $search_params['types'][$param_name] = '='; |
|
| 321 | + if (empty($range_trans[$search_params['types'][$param_name]])) { |
|
| 322 | + $search_params['types'][$param_name] = '='; |
|
| 323 | + } |
|
| 313 | 324 | |
| 314 | 325 | // Handle special case 'age'. |
| 315 | 326 | if ($param_info['type'] == 'age') |
@@ -337,29 +348,30 @@ discard block |
||
| 337 | 348 | elseif ($param_info['type'] == 'date' && $search_params['types'][$param_name] == '=') |
| 338 | 349 | { |
| 339 | 350 | $query_parts[] = $param_info['db_fields'][0] . ' > ' . $search_params[$param_name] . ' AND ' . $param_info['db_fields'][0] . ' < ' . ($search_params[$param_name] + 86400); |
| 351 | + } else { |
|
| 352 | + $query_parts[] = $param_info['db_fields'][0] . ' ' . $range_trans[$search_params['types'][$param_name]] . ' ' . $search_params[$param_name]; |
|
| 340 | 353 | } |
| 341 | - else |
|
| 342 | - $query_parts[] = $param_info['db_fields'][0] . ' ' . $range_trans[$search_params['types'][$param_name]] . ' ' . $search_params[$param_name]; |
|
| 343 | 354 | } |
| 344 | 355 | // Checkboxes. |
| 345 | 356 | elseif ($param_info['type'] == 'checkbox') |
| 346 | 357 | { |
| 347 | 358 | // Each checkbox or no checkbox at all is checked -> ignore. |
| 348 | - if (!is_array($search_params[$param_name]) || count($search_params[$param_name]) == 0 || count($search_params[$param_name]) == count($param_info['values'])) |
|
| 349 | - continue; |
|
| 359 | + if (!is_array($search_params[$param_name]) || count($search_params[$param_name]) == 0 || count($search_params[$param_name]) == count($param_info['values'])) { |
|
| 360 | + continue; |
|
| 361 | + } |
|
| 350 | 362 | |
| 351 | 363 | $query_parts[] = ($param_info['db_fields'][0]) . ' IN ({array_string:' . $param_name . '_check})'; |
| 352 | 364 | $where_params[$param_name . '_check'] = $search_params[$param_name]; |
| 353 | - } |
|
| 354 | - else |
|
| 365 | + } else |
|
| 355 | 366 | { |
| 356 | 367 | // Replace the wildcard characters ('*' and '?') into MySQL ones. |
| 357 | 368 | $parameter = strtolower(strtr($smcFunc['htmlspecialchars']($search_params[$param_name], ENT_QUOTES), array('%' => '\%', '_' => '\_', '*' => '%', '?' => '_'))); |
| 358 | 369 | |
| 359 | - if ($smcFunc['db_case_sensitive']) |
|
| 360 | - $query_parts[] = '(LOWER(' . implode( ') LIKE {string:' . $param_name . '_normal} OR LOWER(', $param_info['db_fields']) . ') LIKE {string:' . $param_name . '_normal})'; |
|
| 361 | - else |
|
| 362 | - $query_parts[] = '(' . implode( ' LIKE {string:' . $param_name . '_normal} OR ', $param_info['db_fields']) . ' LIKE {string:' . $param_name . '_normal})'; |
|
| 370 | + if ($smcFunc['db_case_sensitive']) { |
|
| 371 | + $query_parts[] = '(LOWER(' . implode( ') LIKE {string:' . $param_name . '_normal} OR LOWER(', $param_info['db_fields']) . ') LIKE {string:' . $param_name . '_normal})'; |
|
| 372 | + } else { |
|
| 373 | + $query_parts[] = '(' . implode( ' LIKE {string:' . $param_name . '_normal} OR ', $param_info['db_fields']) . ' LIKE {string:' . $param_name . '_normal})'; |
|
| 374 | + } |
|
| 363 | 375 | $where_params[$param_name . '_normal'] = '%' . $parameter . '%'; |
| 364 | 376 | } |
| 365 | 377 | } |
@@ -375,16 +387,18 @@ discard block |
||
| 375 | 387 | } |
| 376 | 388 | |
| 377 | 389 | // Additional membergroups (these are only relevant if not all primary groups where selected!). |
| 378 | - if (!empty($search_params['membergroups'][2]) && (empty($search_params['membergroups'][1]) || count($context['membergroups']) != count($search_params['membergroups'][1]))) |
|
| 379 | - foreach ($search_params['membergroups'][2] as $mg) |
|
| 390 | + if (!empty($search_params['membergroups'][2]) && (empty($search_params['membergroups'][1]) || count($context['membergroups']) != count($search_params['membergroups'][1]))) { |
|
| 391 | + foreach ($search_params['membergroups'][2] as $mg) |
|
| 380 | 392 | { |
| 381 | 393 | $mg_query_parts[] = 'FIND_IN_SET({int:add_group_' . $mg . '}, mem.additional_groups) != 0'; |
| 394 | + } |
|
| 382 | 395 | $where_params['add_group_' . $mg] = $mg; |
| 383 | 396 | } |
| 384 | 397 | |
| 385 | 398 | // Combine the one or two membergroup parts into one query part linked with an OR. |
| 386 | - if (!empty($mg_query_parts)) |
|
| 387 | - $query_parts[] = '(' . implode(' OR ', $mg_query_parts) . ')'; |
|
| 399 | + if (!empty($mg_query_parts)) { |
|
| 400 | + $query_parts[] = '(' . implode(' OR ', $mg_query_parts) . ')'; |
|
| 401 | + } |
|
| 388 | 402 | |
| 389 | 403 | // Get all selected post count related membergroups. |
| 390 | 404 | if (!empty($search_params['postgroups']) && count($search_params['postgroups']) != count($context['postgroups'])) |
@@ -396,9 +410,9 @@ discard block |
||
| 396 | 410 | // Construct the where part of the query. |
| 397 | 411 | $where = empty($query_parts) ? '1=1' : implode(' |
| 398 | 412 | AND ', $query_parts); |
| 413 | + } else { |
|
| 414 | + $search_url_params = null; |
|
| 399 | 415 | } |
| 400 | - else |
|
| 401 | - $search_url_params = null; |
|
| 402 | 416 | |
| 403 | 417 | // Construct the additional URL part with the query info in it. |
| 404 | 418 | $context['params_url'] = $context['sub_action'] == 'query' ? ';sa=query;params=' . $search_url_params : ''; |
@@ -521,28 +535,32 @@ discard block |
||
| 521 | 535 | 'function' => function ($rowData) use ($txt) |
| 522 | 536 | { |
| 523 | 537 | // Calculate number of days since last online. |
| 524 | - if (empty($rowData['last_login'])) |
|
| 525 | - $difference = $txt['never']; |
|
| 526 | - else |
|
| 538 | + if (empty($rowData['last_login'])) { |
|
| 539 | + $difference = $txt['never']; |
|
| 540 | + } else |
|
| 527 | 541 | { |
| 528 | 542 | $num_days_difference = jeffsdatediff($rowData['last_login']); |
| 529 | 543 | |
| 530 | 544 | // Today. |
| 531 | - if (empty($num_days_difference)) |
|
| 532 | - $difference = $txt['viewmembers_today']; |
|
| 545 | + if (empty($num_days_difference)) { |
|
| 546 | + $difference = $txt['viewmembers_today']; |
|
| 547 | + } |
|
| 533 | 548 | |
| 534 | 549 | // Yesterday. |
| 535 | - elseif ($num_days_difference == 1) |
|
| 536 | - $difference = sprintf('1 %1$s', $txt['viewmembers_day_ago']); |
|
| 550 | + elseif ($num_days_difference == 1) { |
|
| 551 | + $difference = sprintf('1 %1$s', $txt['viewmembers_day_ago']); |
|
| 552 | + } |
|
| 537 | 553 | |
| 538 | 554 | // X days ago. |
| 539 | - else |
|
| 540 | - $difference = sprintf('%1$d %2$s', $num_days_difference, $txt['viewmembers_days_ago']); |
|
| 555 | + else { |
|
| 556 | + $difference = sprintf('%1$d %2$s', $num_days_difference, $txt['viewmembers_days_ago']); |
|
| 557 | + } |
|
| 541 | 558 | } |
| 542 | 559 | |
| 543 | 560 | // Show it in italics if they're not activated... |
| 544 | - if ($rowData['is_activated'] % 10 != 1) |
|
| 545 | - $difference = sprintf('<em title="%1$s">%2$s</em>', $txt['not_activated'], $difference); |
|
| 561 | + if ($rowData['is_activated'] % 10 != 1) { |
|
| 562 | + $difference = sprintf('<em title="%1$s">%2$s</em>', $txt['not_activated'], $difference); |
|
| 563 | + } |
|
| 546 | 564 | |
| 547 | 565 | return $difference; |
| 548 | 566 | }, |
@@ -594,8 +612,9 @@ discard block |
||
| 594 | 612 | ); |
| 595 | 613 | |
| 596 | 614 | // Without enough permissions, don't show 'delete members' checkboxes. |
| 597 | - if (!allowedTo('profile_remove_any')) |
|
| 598 | - unset($listOptions['cols']['check'], $listOptions['form'], $listOptions['additional_rows']); |
|
| 615 | + if (!allowedTo('profile_remove_any')) { |
|
| 616 | + unset($listOptions['cols']['check'], $listOptions['form'], $listOptions['additional_rows']); |
|
| 617 | + } |
|
| 599 | 618 | |
| 600 | 619 | require_once($sourcedir . '/Subs-List.php'); |
| 601 | 620 | createList($listOptions); |
@@ -638,17 +657,18 @@ discard block |
||
| 638 | 657 | ); |
| 639 | 658 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
| 640 | 659 | { |
| 641 | - if ($row['min_posts'] == -1) |
|
| 642 | - $context['membergroups'][] = array( |
|
| 660 | + if ($row['min_posts'] == -1) { |
|
| 661 | + $context['membergroups'][] = array( |
|
| 643 | 662 | 'id' => $row['id_group'], |
| 644 | 663 | 'name' => $row['group_name'], |
| 645 | 664 | 'can_be_additional' => true |
| 646 | 665 | ); |
| 647 | - else |
|
| 648 | - $context['postgroups'][] = array( |
|
| 666 | + } else { |
|
| 667 | + $context['postgroups'][] = array( |
|
| 649 | 668 | 'id' => $row['id_group'], |
| 650 | 669 | 'name' => $row['group_name'] |
| 651 | 670 | ); |
| 671 | + } |
|
| 652 | 672 | } |
| 653 | 673 | $smcFunc['db_free_result']($request); |
| 654 | 674 | |
@@ -675,8 +695,9 @@ discard block |
||
| 675 | 695 | $context['page_title'] = $txt['admin_members']; |
| 676 | 696 | $context['sub_template'] = 'admin_browse'; |
| 677 | 697 | $context['browse_type'] = isset($_REQUEST['type']) ? $_REQUEST['type'] : (!empty($modSettings['registration_method']) && $modSettings['registration_method'] == 1 ? 'activate' : 'approve'); |
| 678 | - if (isset($context['tabs'][$context['browse_type']])) |
|
| 679 | - $context['tabs'][$context['browse_type']]['is_selected'] = true; |
|
| 698 | + if (isset($context['tabs'][$context['browse_type']])) { |
|
| 699 | + $context['tabs'][$context['browse_type']]['is_selected'] = true; |
|
| 700 | + } |
|
| 680 | 701 | |
| 681 | 702 | // Allowed filters are those we can have, in theory. |
| 682 | 703 | $context['allowed_filters'] = $context['browse_type'] == 'approve' ? array(3, 4, 5) : array(0, 2); |
@@ -687,18 +708,20 @@ discard block |
||
| 687 | 708 | foreach ($context['activation_numbers'] as $type => $amount) |
| 688 | 709 | { |
| 689 | 710 | // We have some of these... |
| 690 | - if (in_array($type, $context['allowed_filters']) && $amount > 0) |
|
| 691 | - $context['available_filters'][] = array( |
|
| 711 | + if (in_array($type, $context['allowed_filters']) && $amount > 0) { |
|
| 712 | + $context['available_filters'][] = array( |
|
| 692 | 713 | 'type' => $type, |
| 693 | 714 | 'amount' => $amount, |
| 694 | 715 | 'desc' => isset($txt['admin_browse_filter_type_' . $type]) ? $txt['admin_browse_filter_type_' . $type] : '?', |
| 695 | 716 | 'selected' => $type == $context['current_filter'] |
| 696 | 717 | ); |
| 718 | + } |
|
| 697 | 719 | } |
| 698 | 720 | |
| 699 | 721 | // If the filter was not sent, set it to whatever has people in it! |
| 700 | - if ($context['current_filter'] == -1 && !empty($context['available_filters'][0]['amount'])) |
|
| 701 | - $context['current_filter'] = $context['available_filters'][0]['type']; |
|
| 722 | + if ($context['current_filter'] == -1 && !empty($context['available_filters'][0]['amount'])) { |
|
| 723 | + $context['current_filter'] = $context['available_filters'][0]['type']; |
|
| 724 | + } |
|
| 702 | 725 | |
| 703 | 726 | // This little variable is used to determine if we should flag where we are looking. |
| 704 | 727 | $context['show_filter'] = ($context['current_filter'] != 0 && $context['current_filter'] != 3) || count($context['available_filters']) > 1; |
@@ -713,44 +736,47 @@ discard block |
||
| 713 | 736 | ); |
| 714 | 737 | |
| 715 | 738 | // Are we showing duplicate information? |
| 716 | - if (isset($_GET['showdupes'])) |
|
| 717 | - $_SESSION['showdupes'] = (int) $_GET['showdupes']; |
|
| 739 | + if (isset($_GET['showdupes'])) { |
|
| 740 | + $_SESSION['showdupes'] = (int) $_GET['showdupes']; |
|
| 741 | + } |
|
| 718 | 742 | $context['show_duplicates'] = !empty($_SESSION['showdupes']); |
| 719 | 743 | |
| 720 | 744 | // Determine which actions we should allow on this page. |
| 721 | 745 | if ($context['browse_type'] == 'approve') |
| 722 | 746 | { |
| 723 | 747 | // If we are approving deleted accounts we have a slightly different list... actually a mirror ;) |
| 724 | - if ($context['current_filter'] == 4) |
|
| 725 | - $context['allowed_actions'] = array( |
|
| 748 | + if ($context['current_filter'] == 4) { |
|
| 749 | + $context['allowed_actions'] = array( |
|
| 726 | 750 | 'reject' => $txt['admin_browse_w_approve_deletion'], |
| 727 | 751 | 'ok' => $txt['admin_browse_w_reject'], |
| 728 | 752 | ); |
| 729 | - else |
|
| 730 | - $context['allowed_actions'] = array( |
|
| 753 | + } else { |
|
| 754 | + $context['allowed_actions'] = array( |
|
| 731 | 755 | 'ok' => $txt['admin_browse_w_approve'], |
| 732 | 756 | 'okemail' => $txt['admin_browse_w_approve'] . ' ' . $txt['admin_browse_w_email'], |
| 733 | 757 | 'require_activation' => $txt['admin_browse_w_approve_require_activate'], |
| 734 | 758 | 'reject' => $txt['admin_browse_w_reject'], |
| 735 | 759 | 'rejectemail' => $txt['admin_browse_w_reject'] . ' ' . $txt['admin_browse_w_email'], |
| 736 | 760 | ); |
| 737 | - } |
|
| 738 | - elseif ($context['browse_type'] == 'activate') |
|
| 739 | - $context['allowed_actions'] = array( |
|
| 761 | + } |
|
| 762 | + } elseif ($context['browse_type'] == 'activate') { |
|
| 763 | + $context['allowed_actions'] = array( |
|
| 740 | 764 | 'ok' => $txt['admin_browse_w_activate'], |
| 741 | 765 | 'okemail' => $txt['admin_browse_w_activate'] . ' ' . $txt['admin_browse_w_email'], |
| 742 | 766 | 'delete' => $txt['admin_browse_w_delete'], |
| 743 | 767 | 'deleteemail' => $txt['admin_browse_w_delete'] . ' ' . $txt['admin_browse_w_email'], |
| 744 | 768 | 'remind' => $txt['admin_browse_w_remind'] . ' ' . $txt['admin_browse_w_email'], |
| 745 | 769 | ); |
| 770 | + } |
|
| 746 | 771 | |
| 747 | 772 | // Create an option list for actions allowed to be done with selected members. |
| 748 | 773 | $allowed_actions = ' |
| 749 | 774 | <option selected value="">' . $txt['admin_browse_with_selected'] . ':</option> |
| 750 | 775 | <option value="" disabled>-----------------------------</option>'; |
| 751 | - foreach ($context['allowed_actions'] as $key => $desc) |
|
| 752 | - $allowed_actions .= ' |
|
| 776 | + foreach ($context['allowed_actions'] as $key => $desc) { |
|
| 777 | + $allowed_actions .= ' |
|
| 753 | 778 | <option value="' . $key . '">' . $desc . '</option>'; |
| 779 | + } |
|
| 754 | 780 | |
| 755 | 781 | // Setup the Javascript function for selecting an action for the list. |
| 756 | 782 | $javascript = ' |
@@ -762,15 +788,16 @@ discard block |
||
| 762 | 788 | var message = "";'; |
| 763 | 789 | |
| 764 | 790 | // We have special messages for approving deletion of accounts - it's surprisingly logical - honest. |
| 765 | - if ($context['current_filter'] == 4) |
|
| 766 | - $javascript .= ' |
|
| 791 | + if ($context['current_filter'] == 4) { |
|
| 792 | + $javascript .= ' |
|
| 767 | 793 | if (document.forms.postForm.todo.value.indexOf("reject") != -1) |
| 768 | 794 | message = "' . $txt['admin_browse_w_delete'] . '"; |
| 769 | 795 | else |
| 770 | 796 | message = "' . $txt['admin_browse_w_reject'] . '";'; |
| 797 | + } |
|
| 771 | 798 | // Otherwise a nice standard message. |
| 772 | - else |
|
| 773 | - $javascript .= ' |
|
| 799 | + else { |
|
| 800 | + $javascript .= ' |
|
| 774 | 801 | if (document.forms.postForm.todo.value.indexOf("delete") != -1) |
| 775 | 802 | message = "' . $txt['admin_browse_w_delete'] . '"; |
| 776 | 803 | else if (document.forms.postForm.todo.value.indexOf("reject") != -1) |
@@ -779,6 +806,7 @@ discard block |
||
| 779 | 806 | message = "' . $txt['admin_browse_w_remind'] . '"; |
| 780 | 807 | else |
| 781 | 808 | message = "' . ($context['browse_type'] == 'approve' ? $txt['admin_browse_w_approve'] : $txt['admin_browse_w_activate']) . '";'; |
| 809 | + } |
|
| 782 | 810 | $javascript .= ' |
| 783 | 811 | if (confirm(message + " ' . $txt['admin_browse_warn'] . '")) |
| 784 | 812 | document.forms.postForm.submit(); |
@@ -911,10 +939,11 @@ discard block |
||
| 911 | 939 | $member_links = array(); |
| 912 | 940 | foreach ($rowData['duplicate_members'] as $member) |
| 913 | 941 | { |
| 914 | - if ($member['id']) |
|
| 915 | - $member_links[] = '<a href="' . $scripturl . '?action=profile;u=' . $member['id'] . '" ' . (!empty($member['is_banned']) ? 'class="red"' : '') . '>' . $member['name'] . '</a>'; |
|
| 916 | - else |
|
| 917 | - $member_links[] = $member['name'] . ' (' . $txt['guest'] . ')'; |
|
| 942 | + if ($member['id']) { |
|
| 943 | + $member_links[] = '<a href="' . $scripturl . '?action=profile;u=' . $member['id'] . '" ' . (!empty($member['is_banned']) ? 'class="red"' : '') . '>' . $member['name'] . '</a>'; |
|
| 944 | + } else { |
|
| 945 | + $member_links[] = $member['name'] . ' (' . $txt['guest'] . ')'; |
|
| 946 | + } |
|
| 918 | 947 | } |
| 919 | 948 | return implode (', ', $member_links); |
| 920 | 949 | }, |
@@ -963,14 +992,16 @@ discard block |
||
| 963 | 992 | ); |
| 964 | 993 | |
| 965 | 994 | // Pick what column to actually include if we're showing duplicates. |
| 966 | - if ($context['show_duplicates']) |
|
| 967 | - unset($listOptions['columns']['email']); |
|
| 968 | - else |
|
| 969 | - unset($listOptions['columns']['duplicates']); |
|
| 995 | + if ($context['show_duplicates']) { |
|
| 996 | + unset($listOptions['columns']['email']); |
|
| 997 | + } else { |
|
| 998 | + unset($listOptions['columns']['duplicates']); |
|
| 999 | + } |
|
| 970 | 1000 | |
| 971 | 1001 | // Only show hostname on duplicates as it takes a lot of time. |
| 972 | - if (!$context['show_duplicates'] || !empty($modSettings['disableHostnameLookup'])) |
|
| 973 | - unset($listOptions['columns']['hostname']); |
|
| 1002 | + if (!$context['show_duplicates'] || !empty($modSettings['disableHostnameLookup'])) { |
|
| 1003 | + unset($listOptions['columns']['hostname']); |
|
| 1004 | + } |
|
| 974 | 1005 | |
| 975 | 1006 | // Is there any need to show filters? |
| 976 | 1007 | if (isset($context['available_filters']) && count($context['available_filters']) > 1) |
@@ -978,9 +1009,10 @@ discard block |
||
| 978 | 1009 | $filterOptions = ' |
| 979 | 1010 | <strong>' . $txt['admin_browse_filter_by'] . ':</strong> |
| 980 | 1011 | <select name="filter" onchange="this.form.submit();">'; |
| 981 | - foreach ($context['available_filters'] as $filter) |
|
| 982 | - $filterOptions .= ' |
|
| 1012 | + foreach ($context['available_filters'] as $filter) { |
|
| 1013 | + $filterOptions .= ' |
|
| 983 | 1014 | <option value="' . $filter['type'] . '"' . ($filter['selected'] ? ' selected' : '') . '>' . $filter['desc'] . ' - ' . $filter['amount'] . ' ' . ($filter['amount'] == 1 ? $txt['user'] : $txt['users']) . '</option>'; |
| 1015 | + } |
|
| 984 | 1016 | $filterOptions .= ' |
| 985 | 1017 | </select> |
| 986 | 1018 | <noscript><input type="submit" value="' . $txt['go'] . '" name="filter" class="button_submit"></noscript>'; |
@@ -992,12 +1024,13 @@ discard block |
||
| 992 | 1024 | } |
| 993 | 1025 | |
| 994 | 1026 | // What about if we only have one filter, but it's not the "standard" filter - show them what they are looking at. |
| 995 | - if (!empty($context['show_filter']) && !empty($context['available_filters'])) |
|
| 996 | - $listOptions['additional_rows'][] = array( |
|
| 1027 | + if (!empty($context['show_filter']) && !empty($context['available_filters'])) { |
|
| 1028 | + $listOptions['additional_rows'][] = array( |
|
| 997 | 1029 | 'position' => 'above_column_headers', |
| 998 | 1030 | 'value' => '<strong>' . $txt['admin_browse_filter_show'] . ':</strong> ' . $context['available_filters'][0]['desc'], |
| 999 | 1031 | 'class' => 'smalltext floatright', |
| 1000 | 1032 | ); |
| 1033 | + } |
|
| 1001 | 1034 | |
| 1002 | 1035 | // Now that we have all the options, create the list. |
| 1003 | 1036 | require_once($sourcedir . '/Subs-List.php'); |
@@ -1028,12 +1061,14 @@ discard block |
||
| 1028 | 1061 | $current_filter = (int) $_REQUEST['orig_filter']; |
| 1029 | 1062 | |
| 1030 | 1063 | // If we are applying a filter do just that - then redirect. |
| 1031 | - if (isset($_REQUEST['filter']) && $_REQUEST['filter'] != $_REQUEST['orig_filter']) |
|
| 1032 | - redirectexit('action=admin;area=viewmembers;sa=browse;type=' . $_REQUEST['type'] . ';sort=' . $_REQUEST['sort'] . ';filter=' . $_REQUEST['filter'] . ';start=' . $_REQUEST['start']); |
|
| 1064 | + if (isset($_REQUEST['filter']) && $_REQUEST['filter'] != $_REQUEST['orig_filter']) { |
|
| 1065 | + redirectexit('action=admin;area=viewmembers;sa=browse;type=' . $_REQUEST['type'] . ';sort=' . $_REQUEST['sort'] . ';filter=' . $_REQUEST['filter'] . ';start=' . $_REQUEST['start']); |
|
| 1066 | + } |
|
| 1033 | 1067 | |
| 1034 | 1068 | // Nothing to do? |
| 1035 | - if (!isset($_POST['todoAction']) && !isset($_POST['time_passed'])) |
|
| 1036 | - redirectexit('action=admin;area=viewmembers;sa=browse;type=' . $_REQUEST['type'] . ';sort=' . $_REQUEST['sort'] . ';filter=' . $current_filter . ';start=' . $_REQUEST['start']); |
|
| 1069 | + if (!isset($_POST['todoAction']) && !isset($_POST['time_passed'])) { |
|
| 1070 | + redirectexit('action=admin;area=viewmembers;sa=browse;type=' . $_REQUEST['type'] . ';sort=' . $_REQUEST['sort'] . ';filter=' . $current_filter . ';start=' . $_REQUEST['start']); |
|
| 1071 | + } |
|
| 1037 | 1072 | |
| 1038 | 1073 | // Are we dealing with members who have been waiting for > set amount of time? |
| 1039 | 1074 | if (isset($_POST['time_passed'])) |
@@ -1046,8 +1081,9 @@ discard block |
||
| 1046 | 1081 | else |
| 1047 | 1082 | { |
| 1048 | 1083 | $members = array(); |
| 1049 | - foreach ($_POST['todoAction'] as $id) |
|
| 1050 | - $members[] = (int) $id; |
|
| 1084 | + foreach ($_POST['todoAction'] as $id) { |
|
| 1085 | + $members[] = (int) $id; |
|
| 1086 | + } |
|
| 1051 | 1087 | $condition = ' |
| 1052 | 1088 | AND id_member IN ({array_int:members})'; |
| 1053 | 1089 | } |
@@ -1068,8 +1104,9 @@ discard block |
||
| 1068 | 1104 | $member_count = $smcFunc['db_num_rows']($request); |
| 1069 | 1105 | |
| 1070 | 1106 | // If no results then just return! |
| 1071 | - if ($member_count == 0) |
|
| 1072 | - redirectexit('action=admin;area=viewmembers;sa=browse;type=' . $_REQUEST['type'] . ';sort=' . $_REQUEST['sort'] . ';filter=' . $current_filter . ';start=' . $_REQUEST['start']); |
|
| 1107 | + if ($member_count == 0) { |
|
| 1108 | + redirectexit('action=admin;area=viewmembers;sa=browse;type=' . $_REQUEST['type'] . ';sort=' . $_REQUEST['sort'] . ';filter=' . $current_filter . ';start=' . $_REQUEST['start']); |
|
| 1109 | + } |
|
| 1073 | 1110 | |
| 1074 | 1111 | $member_info = array(); |
| 1075 | 1112 | $members = array(); |
@@ -1108,8 +1145,9 @@ discard block |
||
| 1108 | 1145 | // Do we have to let the integration code know about the activations? |
| 1109 | 1146 | if (!empty($modSettings['integrate_activate'])) |
| 1110 | 1147 | { |
| 1111 | - foreach ($member_info as $member) |
|
| 1112 | - call_integration_hook('integrate_activate', array($member['username'])); |
|
| 1148 | + foreach ($member_info as $member) { |
|
| 1149 | + call_integration_hook('integrate_activate', array($member['username'])); |
|
| 1150 | + } |
|
| 1113 | 1151 | } |
| 1114 | 1152 | |
| 1115 | 1153 | // Check for email. |
@@ -1240,20 +1278,23 @@ discard block |
||
| 1240 | 1278 | $log_inserts = array(); |
| 1241 | 1279 | |
| 1242 | 1280 | require_once($sourcedir . '/Logging.php'); |
| 1243 | - foreach ($member_info as $member) |
|
| 1244 | - logAction($log_action, array('member' => $member['id']), 'admin'); |
|
| 1281 | + foreach ($member_info as $member) { |
|
| 1282 | + logAction($log_action, array('member' => $member['id']), 'admin'); |
|
| 1283 | + } |
|
| 1245 | 1284 | } |
| 1246 | 1285 | |
| 1247 | 1286 | // Although updateStats *may* catch this, best to do it manually just in case (Doesn't always sort out unapprovedMembers). |
| 1248 | - if (in_array($current_filter, array(3, 4, 5))) |
|
| 1249 | - updateSettings(array('unapprovedMembers' => ($modSettings['unapprovedMembers'] > $member_count ? $modSettings['unapprovedMembers'] - $member_count : 0))); |
|
| 1287 | + if (in_array($current_filter, array(3, 4, 5))) { |
|
| 1288 | + updateSettings(array('unapprovedMembers' => ($modSettings['unapprovedMembers'] > $member_count ? $modSettings['unapprovedMembers'] - $member_count : 0))); |
|
| 1289 | + } |
|
| 1250 | 1290 | |
| 1251 | 1291 | // Update the member's stats. (but, we know the member didn't change their name.) |
| 1252 | 1292 | updateStats('member', false); |
| 1253 | 1293 | |
| 1254 | 1294 | // If they haven't been deleted, update the post group statistics on them... |
| 1255 | - if (!in_array($_POST['todo'], array('delete', 'deleteemail', 'reject', 'rejectemail', 'remind'))) |
|
| 1256 | - updateStats('postgroups', $members); |
|
| 1295 | + if (!in_array($_POST['todo'], array('delete', 'deleteemail', 'reject', 'rejectemail', 'remind'))) { |
|
| 1296 | + updateStats('postgroups', $members); |
|
| 1297 | + } |
|
| 1257 | 1298 | |
| 1258 | 1299 | redirectexit('action=admin;area=viewmembers;sa=browse;type=' . $_REQUEST['type'] . ';sort=' . $_REQUEST['sort'] . ';filter=' . $current_filter . ';start=' . $_REQUEST['start']); |
| 1259 | 1300 | } |
@@ -1278,10 +1319,11 @@ discard block |
||
| 1278 | 1319 | $dis = time() - $old; |
| 1279 | 1320 | |
| 1280 | 1321 | // Before midnight? |
| 1281 | - if ($dis < $sinceMidnight) |
|
| 1282 | - return 0; |
|
| 1283 | - else |
|
| 1284 | - $dis -= $sinceMidnight; |
|
| 1322 | + if ($dis < $sinceMidnight) { |
|
| 1323 | + return 0; |
|
| 1324 | + } else { |
|
| 1325 | + $dis -= $sinceMidnight; |
|
| 1326 | + } |
|
| 1285 | 1327 | |
| 1286 | 1328 | // Divide out the seconds in a day to get the number of days. |
| 1287 | 1329 | return ceil($dis / (24 * 60 * 60)); |
@@ -14,8 +14,9 @@ discard block |
||
| 14 | 14 | * @version 2.1 Beta 3 |
| 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 | * This function shows the board index. |
@@ -34,8 +35,9 @@ discard block |
||
| 34 | 35 | $context['canonical_url'] = $scripturl; |
| 35 | 36 | |
| 36 | 37 | // Do not let search engines index anything if there is a random thing in $_GET. |
| 37 | - if (!empty($_GET)) |
|
| 38 | - $context['robot_no_index'] = true; |
|
| 38 | + if (!empty($_GET)) { |
|
| 39 | + $context['robot_no_index'] = true; |
|
| 40 | + } |
|
| 39 | 41 | |
| 40 | 42 | // Retrieve the categories and boards. |
| 41 | 43 | require_once($sourcedir . '/Subs-BoardIndex.php'); |
@@ -62,11 +64,12 @@ discard block |
||
| 62 | 64 | $context['latest_posts'] = cache_quick_get('boardindex-latest_posts:' . md5($user_info['query_wanna_see_board'] . $user_info['language']), 'Subs-Recent.php', 'cache_getLastPosts', array($latestPostOptions)); |
| 63 | 65 | } |
| 64 | 66 | |
| 65 | - if (!empty($context['latest_posts']) || !empty($context['latest_post'])) |
|
| 66 | - $context['info_center'][] = array( |
|
| 67 | + if (!empty($context['latest_posts']) || !empty($context['latest_post'])) { |
|
| 68 | + $context['info_center'][] = array( |
|
| 67 | 69 | 'tpl' => 'recent', |
| 68 | 70 | 'txt' => 'recent_posts', |
| 69 | 71 | ); |
| 72 | + } |
|
| 70 | 73 | } |
| 71 | 74 | |
| 72 | 75 | // Load the calendar? |
@@ -87,20 +90,22 @@ discard block |
||
| 87 | 90 | // This is used to show the "how-do-I-edit" help. |
| 88 | 91 | $context['calendar_can_edit'] = allowedTo('calendar_edit_any'); |
| 89 | 92 | |
| 90 | - if ($context['show_calendar']) |
|
| 91 | - $context['info_center'][] = array( |
|
| 93 | + if ($context['show_calendar']) { |
|
| 94 | + $context['info_center'][] = array( |
|
| 92 | 95 | 'tpl' => 'calendar', |
| 93 | 96 | 'txt' => $context['calendar_only_today'] ? 'calendar_today' : 'calendar_upcoming', |
| 94 | 97 | ); |
| 98 | + } |
|
| 95 | 99 | } |
| 96 | 100 | |
| 97 | 101 | // And stats. |
| 98 | 102 | $context['show_stats'] = allowedTo('view_stats') && !empty($modSettings['trackStats']); |
| 99 | - if ($settings['show_stats_index']) |
|
| 100 | - $context['info_center'][] = array( |
|
| 103 | + if ($settings['show_stats_index']) { |
|
| 104 | + $context['info_center'][] = array( |
|
| 101 | 105 | 'tpl' => 'stats', |
| 102 | 106 | 'txt' => 'forum_stats', |
| 103 | 107 | ); |
| 108 | + } |
|
| 104 | 109 | |
| 105 | 110 | // Now the online stuff |
| 106 | 111 | require_once($sourcedir . '/Subs-MembersOnline.php'); |
@@ -118,12 +123,14 @@ discard block |
||
| 118 | 123 | ); |
| 119 | 124 | |
| 120 | 125 | // Track most online statistics? (Subs-MembersOnline.php) |
| 121 | - if (!empty($modSettings['trackStats'])) |
|
| 122 | - trackStatsUsersOnline($context['num_guests'] + $context['num_spiders'] + $context['num_users_online']); |
|
| 126 | + if (!empty($modSettings['trackStats'])) { |
|
| 127 | + trackStatsUsersOnline($context['num_guests'] + $context['num_spiders'] + $context['num_users_online']); |
|
| 128 | + } |
|
| 123 | 129 | |
| 124 | 130 | // Are we showing all membergroups on the board index? |
| 125 | - if (!empty($settings['show_group_key'])) |
|
| 126 | - $context['membergroups'] = cache_quick_get('membergroup_list', 'Subs-Membergroups.php', 'cache_getMembergroupList', array()); |
|
| 131 | + if (!empty($settings['show_group_key'])) { |
|
| 132 | + $context['membergroups'] = cache_quick_get('membergroup_list', 'Subs-Membergroups.php', 'cache_getMembergroupList', array()); |
|
| 133 | + } |
|
| 127 | 134 | |
| 128 | 135 | // And back to normality. |
| 129 | 136 | $context['page_title'] = sprintf($txt['forum_index'], $context['forum_name']); |
@@ -13,8 +13,9 @@ discard block |
||
| 13 | 13 | * @version 2.1 Beta 3 |
| 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 | * Get a list of versions that are currently installed on the server. |
@@ -45,8 +46,7 @@ discard block |
||
| 45 | 46 | $temp2 = $temp->getVersion(); |
| 46 | 47 | $im_version = $temp2['versionString']; |
| 47 | 48 | $extension_version = 'Imagick ' . phpversion('Imagick'); |
| 48 | - } |
|
| 49 | - else |
|
| 49 | + } else |
|
| 50 | 50 | { |
| 51 | 51 | $im_version = MagickGetVersionString(); |
| 52 | 52 | $extension_version = 'MagickWand ' . phpversion('MagickWand'); |
@@ -61,9 +61,9 @@ discard block |
||
| 61 | 61 | if (in_array('db_server', $checkFor)) |
| 62 | 62 | { |
| 63 | 63 | db_extend(); |
| 64 | - if (!isset($db_connection) || $db_connection === false) |
|
| 65 | - trigger_error('getServerVersions(): you need to be connected to the database in order to get its server version', E_USER_NOTICE); |
|
| 66 | - else |
|
| 64 | + if (!isset($db_connection) || $db_connection === false) { |
|
| 65 | + trigger_error('getServerVersions(): you need to be connected to the database in order to get its server version', E_USER_NOTICE); |
|
| 66 | + } else |
|
| 67 | 67 | { |
| 68 | 68 | $versions['db_engine'] = array('title' => sprintf($txt['support_versions_db_engine'], $smcFunc['db_title']), 'version' => ''); |
| 69 | 69 | $versions['db_engine']['version'] = $smcFunc['db_get_engine'](); |
@@ -74,24 +74,31 @@ discard block |
||
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | // If we're using memcache we need the server info. |
| 77 | - if (empty($memcached) && function_exists('memcache_get') && isset($modSettings['cache_memcached']) && trim($modSettings['cache_memcached']) != '') |
|
| 78 | - get_memcached_server(); |
|
| 77 | + if (empty($memcached) && function_exists('memcache_get') && isset($modSettings['cache_memcached']) && trim($modSettings['cache_memcached']) != '') { |
|
| 78 | + get_memcached_server(); |
|
| 79 | + } |
|
| 79 | 80 | |
| 80 | 81 | // Check to see if we have any accelerators installed... |
| 81 | - if (in_array('phpa', $checkFor) && isset($_PHPA)) |
|
| 82 | - $versions['phpa'] = array('title' => 'ionCube PHP-Accelerator', 'version' => $_PHPA['VERSION']); |
|
| 83 | - if (in_array('apc', $checkFor) && extension_loaded('apc')) |
|
| 84 | - $versions['apc'] = array('title' => 'Alternative PHP Cache', 'version' => phpversion('apc')); |
|
| 85 | - if (in_array('memcache', $checkFor) && function_exists('memcache_set')) |
|
| 86 | - $versions['memcache'] = array('title' => 'Memcached', 'version' => empty($memcached) ? '???' : memcache_get_version($memcached)); |
|
| 87 | - if (in_array('xcache', $checkFor) && function_exists('xcache_set')) |
|
| 88 | - $versions['xcache'] = array('title' => 'XCache', 'version' => XCACHE_VERSION); |
|
| 82 | + if (in_array('phpa', $checkFor) && isset($_PHPA)) { |
|
| 83 | + $versions['phpa'] = array('title' => 'ionCube PHP-Accelerator', 'version' => $_PHPA['VERSION']); |
|
| 84 | + } |
|
| 85 | + if (in_array('apc', $checkFor) && extension_loaded('apc')) { |
|
| 86 | + $versions['apc'] = array('title' => 'Alternative PHP Cache', 'version' => phpversion('apc')); |
|
| 87 | + } |
|
| 88 | + if (in_array('memcache', $checkFor) && function_exists('memcache_set')) { |
|
| 89 | + $versions['memcache'] = array('title' => 'Memcached', 'version' => empty($memcached) ? '???' : memcache_get_version($memcached)); |
|
| 90 | + } |
|
| 91 | + if (in_array('xcache', $checkFor) && function_exists('xcache_set')) { |
|
| 92 | + $versions['xcache'] = array('title' => 'XCache', 'version' => XCACHE_VERSION); |
|
| 93 | + } |
|
| 89 | 94 | |
| 90 | - if (in_array('php', $checkFor)) |
|
| 91 | - $versions['php'] = array('title' => 'PHP', 'version' => PHP_VERSION, 'more' => '?action=admin;area=serversettings;sa=phpinfo'); |
|
| 95 | + if (in_array('php', $checkFor)) { |
|
| 96 | + $versions['php'] = array('title' => 'PHP', 'version' => PHP_VERSION, 'more' => '?action=admin;area=serversettings;sa=phpinfo'); |
|
| 97 | + } |
|
| 92 | 98 | |
| 93 | - if (in_array('server', $checkFor)) |
|
| 94 | - $versions['server'] = array('title' => $txt['support_versions_server'], 'version' => $_SERVER['SERVER_SOFTWARE']); |
|
| 99 | + if (in_array('server', $checkFor)) { |
|
| 100 | + $versions['server'] = array('title' => $txt['support_versions_server'], 'version' => $_SERVER['SERVER_SOFTWARE']); |
|
| 101 | + } |
|
| 95 | 102 | |
| 96 | 103 | return $versions; |
| 97 | 104 | } |
@@ -131,11 +138,13 @@ discard block |
||
| 131 | 138 | fclose($fp); |
| 132 | 139 | |
| 133 | 140 | // The comment looks rougly like... that. |
| 134 | - if (preg_match('~\*\s@version\s+(.+)[\s]{2}~i', $header, $match) == 1) |
|
| 135 | - $version_info['file_versions']['SSI.php'] = $match[1]; |
|
| 141 | + if (preg_match('~\*\s@version\s+(.+)[\s]{2}~i', $header, $match) == 1) { |
|
| 142 | + $version_info['file_versions']['SSI.php'] = $match[1]; |
|
| 143 | + } |
|
| 136 | 144 | // Not found! This is bad. |
| 137 | - else |
|
| 138 | - $version_info['file_versions']['SSI.php'] = '??'; |
|
| 145 | + else { |
|
| 146 | + $version_info['file_versions']['SSI.php'] = '??'; |
|
| 147 | + } |
|
| 139 | 148 | } |
| 140 | 149 | |
| 141 | 150 | // Do the paid subscriptions handler? |
@@ -146,11 +155,13 @@ discard block |
||
| 146 | 155 | fclose($fp); |
| 147 | 156 | |
| 148 | 157 | // Found it? |
| 149 | - if (preg_match('~\*\s@version\s+(.+)[\s]{2}~i', $header, $match) == 1) |
|
| 150 | - $version_info['file_versions']['subscriptions.php'] = $match[1]; |
|
| 158 | + if (preg_match('~\*\s@version\s+(.+)[\s]{2}~i', $header, $match) == 1) { |
|
| 159 | + $version_info['file_versions']['subscriptions.php'] = $match[1]; |
|
| 160 | + } |
|
| 151 | 161 | // If we haven't how do we all get paid? |
| 152 | - else |
|
| 153 | - $version_info['file_versions']['subscriptions.php'] = '??'; |
|
| 162 | + else { |
|
| 163 | + $version_info['file_versions']['subscriptions.php'] = '??'; |
|
| 164 | + } |
|
| 154 | 165 | } |
| 155 | 166 | |
| 156 | 167 | // Load all the files in the Sources directory, except this file and the redirect. |
@@ -165,11 +176,13 @@ discard block |
||
| 165 | 176 | fclose($fp); |
| 166 | 177 | |
| 167 | 178 | // Look for the version comment in the file header. |
| 168 | - if (preg_match('~\*\s@version\s+(.+)[\s]{2}~i', $header, $match) == 1) |
|
| 169 | - $version_info['file_versions'][$entry] = $match[1]; |
|
| 179 | + if (preg_match('~\*\s@version\s+(.+)[\s]{2}~i', $header, $match) == 1) { |
|
| 180 | + $version_info['file_versions'][$entry] = $match[1]; |
|
| 181 | + } |
|
| 170 | 182 | // It wasn't found, but the file was... show a '??'. |
| 171 | - else |
|
| 172 | - $version_info['file_versions'][$entry] = '??'; |
|
| 183 | + else { |
|
| 184 | + $version_info['file_versions'][$entry] = '??'; |
|
| 185 | + } |
|
| 173 | 186 | } |
| 174 | 187 | } |
| 175 | 188 | $sources_dir->close(); |
@@ -188,11 +201,13 @@ discard block |
||
| 188 | 201 | fclose($fp); |
| 189 | 202 | |
| 190 | 203 | // Look for the version comment in the file header. |
| 191 | - if (preg_match('~\*\s@version\s+(.+)[\s]{2}~i', $header, $match) == 1) |
|
| 192 | - $version_info['tasks_versions'][$entry] = $match[1]; |
|
| 204 | + if (preg_match('~\*\s@version\s+(.+)[\s]{2}~i', $header, $match) == 1) { |
|
| 205 | + $version_info['tasks_versions'][$entry] = $match[1]; |
|
| 206 | + } |
|
| 193 | 207 | // It wasn't found, but the file was... show a '??'. |
| 194 | - else |
|
| 195 | - $version_info['tasks_versions'][$entry] = '??'; |
|
| 208 | + else { |
|
| 209 | + $version_info['tasks_versions'][$entry] = '??'; |
|
| 210 | + } |
|
| 196 | 211 | } |
| 197 | 212 | } |
| 198 | 213 | $tasks_dir->close(); |
@@ -200,8 +215,9 @@ discard block |
||
| 200 | 215 | |
| 201 | 216 | // Load all the files in the default template directory - and the current theme if applicable. |
| 202 | 217 | $directories = array('default_template_versions' => $settings['default_theme_dir']); |
| 203 | - if ($settings['theme_id'] != 1) |
|
| 204 | - $directories += array('template_versions' => $settings['theme_dir']); |
|
| 218 | + if ($settings['theme_id'] != 1) { |
|
| 219 | + $directories += array('template_versions' => $settings['theme_dir']); |
|
| 220 | + } |
|
| 205 | 221 | |
| 206 | 222 | foreach ($directories as $type => $dirname) |
| 207 | 223 | { |
@@ -216,11 +232,13 @@ discard block |
||
| 216 | 232 | fclose($fp); |
| 217 | 233 | |
| 218 | 234 | // Look for the version comment in the file header. |
| 219 | - if (preg_match('~\*\s@version\s+(.+)[\s]{2}~i', $header, $match) == 1) |
|
| 220 | - $version_info[$type][$entry] = $match[1]; |
|
| 235 | + if (preg_match('~\*\s@version\s+(.+)[\s]{2}~i', $header, $match) == 1) { |
|
| 236 | + $version_info[$type][$entry] = $match[1]; |
|
| 237 | + } |
|
| 221 | 238 | // It wasn't found, but the file was... show a '??'. |
| 222 | - else |
|
| 223 | - $version_info[$type][$entry] = '??'; |
|
| 239 | + else { |
|
| 240 | + $version_info[$type][$entry] = '??'; |
|
| 241 | + } |
|
| 224 | 242 | } |
| 225 | 243 | } |
| 226 | 244 | $this_dir->close(); |
@@ -241,11 +259,13 @@ discard block |
||
| 241 | 259 | list ($name, $language) = explode('.', $entry); |
| 242 | 260 | |
| 243 | 261 | // Look for the version comment in the file header. |
| 244 | - if (preg_match('~(?://|/\*)\s*Version:\s+(.+?);\s*' . preg_quote($name, '~') . '(?:[\s]{2}|\*/)~i', $header, $match) == 1) |
|
| 245 | - $version_info['default_language_versions'][$language][$name] = $match[1]; |
|
| 262 | + if (preg_match('~(?://|/\*)\s*Version:\s+(.+?);\s*' . preg_quote($name, '~') . '(?:[\s]{2}|\*/)~i', $header, $match) == 1) { |
|
| 263 | + $version_info['default_language_versions'][$language][$name] = $match[1]; |
|
| 264 | + } |
|
| 246 | 265 | // It wasn't found, but the file was... show a '??'. |
| 247 | - else |
|
| 248 | - $version_info['default_language_versions'][$language][$name] = '??'; |
|
| 266 | + else { |
|
| 267 | + $version_info['default_language_versions'][$language][$name] = '??'; |
|
| 268 | + } |
|
| 249 | 269 | } |
| 250 | 270 | } |
| 251 | 271 | $this_dir->close(); |
@@ -260,8 +280,9 @@ discard block |
||
| 260 | 280 | ksort($version_info['tasks_versions']); |
| 261 | 281 | |
| 262 | 282 | // For languages sort each language too. |
| 263 | - foreach ($version_info['default_language_versions'] as $language => $dummy) |
|
| 264 | - ksort($version_info['default_language_versions'][$language]); |
|
| 283 | + foreach ($version_info['default_language_versions'] as $language => $dummy) { |
|
| 284 | + ksort($version_info['default_language_versions'][$language]); |
|
| 285 | + } |
|
| 265 | 286 | } |
| 266 | 287 | return $version_info; |
| 267 | 288 | } |
@@ -303,27 +324,31 @@ discard block |
||
| 303 | 324 | $settingsArray = trim(file_get_contents($boarddir . '/Settings.php')); |
| 304 | 325 | |
| 305 | 326 | // Break it up based on \r or \n, and then clean out extra characters. |
| 306 | - if (strpos($settingsArray, "\n") !== false) |
|
| 307 | - $settingsArray = explode("\n", $settingsArray); |
|
| 308 | - elseif (strpos($settingsArray, "\r") !== false) |
|
| 309 | - $settingsArray = explode("\r", $settingsArray); |
|
| 310 | - else |
|
| 311 | - return; |
|
| 327 | + if (strpos($settingsArray, "\n") !== false) { |
|
| 328 | + $settingsArray = explode("\n", $settingsArray); |
|
| 329 | + } elseif (strpos($settingsArray, "\r") !== false) { |
|
| 330 | + $settingsArray = explode("\r", $settingsArray); |
|
| 331 | + } else { |
|
| 332 | + return; |
|
| 333 | + } |
|
| 312 | 334 | |
| 313 | 335 | // Presumably, the file has to have stuff in it for this function to be called :P. |
| 314 | - if (count($settingsArray) < 10) |
|
| 315 | - return; |
|
| 336 | + if (count($settingsArray) < 10) { |
|
| 337 | + return; |
|
| 338 | + } |
|
| 316 | 339 | |
| 317 | 340 | // remove any /r's that made there way in here |
| 318 | - foreach ($settingsArray as $k => $dummy) |
|
| 319 | - $settingsArray[$k] = strtr($dummy, array("\r" => '')) . "\n"; |
|
| 341 | + foreach ($settingsArray as $k => $dummy) { |
|
| 342 | + $settingsArray[$k] = strtr($dummy, array("\r" => '')) . "\n"; |
|
| 343 | + } |
|
| 320 | 344 | |
| 321 | 345 | // go line by line and see whats changing |
| 322 | 346 | for ($i = 0, $n = count($settingsArray); $i < $n; $i++) |
| 323 | 347 | { |
| 324 | 348 | // Don't trim or bother with it if it's not a variable. |
| 325 | - if (substr($settingsArray[$i], 0, 1) != '$') |
|
| 326 | - continue; |
|
| 349 | + if (substr($settingsArray[$i], 0, 1) != '$') { |
|
| 350 | + continue; |
|
| 351 | + } |
|
| 327 | 352 | |
| 328 | 353 | $settingsArray[$i] = trim($settingsArray[$i]) . "\n"; |
| 329 | 354 | |
@@ -335,8 +360,7 @@ discard block |
||
| 335 | 360 | { |
| 336 | 361 | updateDbLastError($val); |
| 337 | 362 | unset($config_vars[$var]); |
| 338 | - } |
|
| 339 | - elseif (strncasecmp($settingsArray[$i], '$' . $var, 1 + strlen($var)) == 0) |
|
| 363 | + } elseif (strncasecmp($settingsArray[$i], '$' . $var, 1 + strlen($var)) == 0) |
|
| 340 | 364 | { |
| 341 | 365 | $comment = strstr(substr($settingsArray[$i], strpos($settingsArray[$i], ';')), '#'); |
| 342 | 366 | $settingsArray[$i] = '$' . $var . ' = ' . $val . ';' . ($comment == '' ? '' : "\t\t" . rtrim($comment)) . "\n"; |
@@ -347,34 +371,39 @@ discard block |
||
| 347 | 371 | } |
| 348 | 372 | |
| 349 | 373 | // End of the file ... maybe |
| 350 | - if (substr(trim($settingsArray[$i]), 0, 2) == '?' . '>') |
|
| 351 | - $end = $i; |
|
| 374 | + if (substr(trim($settingsArray[$i]), 0, 2) == '?' . '>') { |
|
| 375 | + $end = $i; |
|
| 376 | + } |
|
| 352 | 377 | } |
| 353 | 378 | |
| 354 | 379 | // This should never happen, but apparently it is happening. |
| 355 | - if (empty($end) || $end < 10) |
|
| 356 | - $end = count($settingsArray) - 1; |
|
| 380 | + if (empty($end) || $end < 10) { |
|
| 381 | + $end = count($settingsArray) - 1; |
|
| 382 | + } |
|
| 357 | 383 | |
| 358 | 384 | // Still more variables to go? Then lets add them at the end. |
| 359 | 385 | if (!empty($config_vars)) |
| 360 | 386 | { |
| 361 | - if (trim($settingsArray[$end]) == '?' . '>') |
|
| 362 | - $settingsArray[$end++] = ''; |
|
| 363 | - else |
|
| 364 | - $end++; |
|
| 387 | + if (trim($settingsArray[$end]) == '?' . '>') { |
|
| 388 | + $settingsArray[$end++] = ''; |
|
| 389 | + } else { |
|
| 390 | + $end++; |
|
| 391 | + } |
|
| 365 | 392 | |
| 366 | 393 | // Add in any newly defined vars that were passed |
| 367 | - foreach ($config_vars as $var => $val) |
|
| 368 | - $settingsArray[$end++] = '$' . $var . ' = ' . $val . ';' . "\n"; |
|
| 394 | + foreach ($config_vars as $var => $val) { |
|
| 395 | + $settingsArray[$end++] = '$' . $var . ' = ' . $val . ';' . "\n"; |
|
| 396 | + } |
|
| 369 | 397 | |
| 370 | 398 | $settingsArray[$end] = '?' . '>'; |
| 399 | + } else { |
|
| 400 | + $settingsArray[$end] = trim($settingsArray[$end]); |
|
| 371 | 401 | } |
| 372 | - else |
|
| 373 | - $settingsArray[$end] = trim($settingsArray[$end]); |
|
| 374 | 402 | |
| 375 | 403 | // Sanity error checking: the file needs to be at least 12 lines. |
| 376 | - if (count($settingsArray) < 12) |
|
| 377 | - return; |
|
| 404 | + if (count($settingsArray) < 12) { |
|
| 405 | + return; |
|
| 406 | + } |
|
| 378 | 407 | |
| 379 | 408 | // Try to avoid a few pitfalls: |
| 380 | 409 | // - like a possible race condition, |
@@ -382,8 +411,9 @@ discard block |
||
| 382 | 411 | // |
| 383 | 412 | // Check before you act: if cache is enabled, we can do a simple write test |
| 384 | 413 | // to validate that we even write things on this filesystem. |
| 385 | - if ((empty($cachedir) || !file_exists($cachedir)) && file_exists($boarddir . '/cache')) |
|
| 386 | - $cachedir = $boarddir . '/cache'; |
|
| 414 | + if ((empty($cachedir) || !file_exists($cachedir)) && file_exists($boarddir . '/cache')) { |
|
| 415 | + $cachedir = $boarddir . '/cache'; |
|
| 416 | + } |
|
| 387 | 417 | |
| 388 | 418 | $test_fp = @fopen($cachedir . '/settings_update.tmp', "w+"); |
| 389 | 419 | if ($test_fp) |
@@ -419,16 +449,18 @@ discard block |
||
| 419 | 449 | // Well this is not good at all, lets see if we can save this |
| 420 | 450 | $context['settings_message'] = 'settings_error'; |
| 421 | 451 | |
| 422 | - if (file_exists($boarddir . '/Settings_bak.php')) |
|
| 423 | - @copy($boarddir . '/Settings_bak.php', $boarddir . '/Settings.php'); |
|
| 452 | + if (file_exists($boarddir . '/Settings_bak.php')) { |
|
| 453 | + @copy($boarddir . '/Settings_bak.php', $boarddir . '/Settings.php'); |
|
| 454 | + } |
|
| 424 | 455 | } |
| 425 | 456 | } |
| 426 | 457 | |
| 427 | 458 | // Even though on normal installations the filemtime should prevent this being used by the installer incorrectly |
| 428 | 459 | // it seems that there are times it might not. So let's MAKE it dump the cache. |
| 429 | - if (function_exists('opcache_invalidate')) |
|
| 430 | - opcache_invalidate($boarddir . '/Settings.php', true); |
|
| 431 | -} |
|
| 460 | + if (function_exists('opcache_invalidate')) { |
|
| 461 | + opcache_invalidate($boarddir . '/Settings.php', true); |
|
| 462 | + } |
|
| 463 | + } |
|
| 432 | 464 | |
| 433 | 465 | /** |
| 434 | 466 | * Saves the time of the last db error for the error log |
@@ -454,8 +486,9 @@ discard block |
||
| 454 | 486 | global $options, $context, $smcFunc, $settings, $user_info; |
| 455 | 487 | |
| 456 | 488 | // This must exist! |
| 457 | - if (!isset($context['admin_preferences'])) |
|
| 458 | - return false; |
|
| 489 | + if (!isset($context['admin_preferences'])) { |
|
| 490 | + return false; |
|
| 491 | + } |
|
| 459 | 492 | |
| 460 | 493 | // This is what we'll be saving. |
| 461 | 494 | $options['admin_preferences'] = json_encode($context['admin_preferences']); |
@@ -519,8 +552,9 @@ discard block |
||
| 519 | 552 | $emails_sent = array(); |
| 520 | 553 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
| 521 | 554 | { |
| 522 | - if (empty($prefs[$row['id_member']]['announcements'])) |
|
| 523 | - continue; |
|
| 555 | + if (empty($prefs[$row['id_member']]['announcements'])) { |
|
| 556 | + continue; |
|
| 557 | + } |
|
| 524 | 558 | |
| 525 | 559 | // Stick their particulars in the replacement data. |
| 526 | 560 | $replacements['IDMEMBER'] = $row['id_member']; |
@@ -539,11 +573,12 @@ discard block |
||
| 539 | 573 | $smcFunc['db_free_result']($request); |
| 540 | 574 | |
| 541 | 575 | // Any additional users we must email this to? |
| 542 | - if (!empty($additional_recipients)) |
|
| 543 | - foreach ($additional_recipients as $recipient) |
|
| 576 | + if (!empty($additional_recipients)) { |
|
| 577 | + foreach ($additional_recipients as $recipient) |
|
| 544 | 578 | { |
| 545 | 579 | if (in_array($recipient['email'], $emails_sent)) |
| 546 | 580 | continue; |
| 581 | + } |
|
| 547 | 582 | |
| 548 | 583 | $replacements['IDMEMBER'] = $recipient['id']; |
| 549 | 584 | $replacements['REALNAME'] = $recipient['name']; |
@@ -13,8 +13,9 @@ discard block |
||
| 13 | 13 | * @version 2.1 Beta 3 |
| 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 | * Show the database queries for debugging |
@@ -30,8 +31,9 @@ discard block |
||
| 30 | 31 | global $scripturl, $settings, $context, $db_connection, $boarddir, $smcFunc, $txt, $db_show_debug; |
| 31 | 32 | |
| 32 | 33 | // We should have debug mode enabled, as well as something to display! |
| 33 | - if (!isset($db_show_debug) || $db_show_debug !== true || !isset($_SESSION['debug'])) |
|
| 34 | - fatal_lang_error('no_access', false); |
|
| 34 | + if (!isset($db_show_debug) || $db_show_debug !== true || !isset($_SESSION['debug'])) { |
|
| 35 | + fatal_lang_error('no_access', false); |
|
| 36 | + } |
|
| 35 | 37 | |
| 36 | 38 | // Don't allow except for administrators. |
| 37 | 39 | isAllowedTo('admin_forum'); |
@@ -41,10 +43,11 @@ discard block |
||
| 41 | 43 | { |
| 42 | 44 | $_SESSION['view_queries'] = $_SESSION['view_queries'] == 1 ? 0 : 1; |
| 43 | 45 | |
| 44 | - if (strpos($_SESSION['old_url'], 'action=viewquery') !== false) |
|
| 45 | - redirectexit(); |
|
| 46 | - else |
|
| 47 | - redirectexit($_SESSION['old_url']); |
|
| 46 | + if (strpos($_SESSION['old_url'], 'action=viewquery') !== false) { |
|
| 47 | + redirectexit(); |
|
| 48 | + } else { |
|
| 49 | + redirectexit($_SESSION['old_url']); |
|
| 50 | + } |
|
| 48 | 51 | } |
| 49 | 52 | |
| 50 | 53 | call_integration_hook('integrate_egg_nog'); |
@@ -83,26 +86,28 @@ discard block |
||
| 83 | 86 | foreach ($query as $line) |
| 84 | 87 | { |
| 85 | 88 | preg_match('/^(\t*)/', $line, $temp); |
| 86 | - if (strlen($temp[0]) < $min_indent || $min_indent == 0) |
|
| 87 | - $min_indent = strlen($temp[0]); |
|
| 89 | + if (strlen($temp[0]) < $min_indent || $min_indent == 0) { |
|
| 90 | + $min_indent = strlen($temp[0]); |
|
| 91 | + } |
|
| 92 | + } |
|
| 93 | + foreach ($query as $l => $dummy) { |
|
| 94 | + $query[$l] = substr($dummy, $min_indent); |
|
| 88 | 95 | } |
| 89 | - foreach ($query as $l => $dummy) |
|
| 90 | - $query[$l] = substr($dummy, $min_indent); |
|
| 91 | 96 | $query_data['q'] = implode("\n", $query); |
| 92 | 97 | |
| 93 | 98 | // Make the filenames look a bit better. |
| 94 | - if (isset($query_data['f'])) |
|
| 95 | - $query_data['f'] = preg_replace('~^' . preg_quote($boarddir, '~') . '~', '...', $query_data['f']); |
|
| 99 | + if (isset($query_data['f'])) { |
|
| 100 | + $query_data['f'] = preg_replace('~^' . preg_quote($boarddir, '~') . '~', '...', $query_data['f']); |
|
| 101 | + } |
|
| 96 | 102 | |
| 97 | 103 | $is_select_query = substr(trim($query_data['q']), 0, 6) == 'SELECT'; |
| 98 | - if ($is_select_query) |
|
| 99 | - $select = $query_data['q']; |
|
| 100 | - elseif (preg_match('~^INSERT(?: IGNORE)? INTO \w+(?:\s+\([^)]+\))?\s+(SELECT .+)$~s', trim($query_data['q']), $matches) != 0) |
|
| 104 | + if ($is_select_query) { |
|
| 105 | + $select = $query_data['q']; |
|
| 106 | + } elseif (preg_match('~^INSERT(?: IGNORE)? INTO \w+(?:\s+\([^)]+\))?\s+(SELECT .+)$~s', trim($query_data['q']), $matches) != 0) |
|
| 101 | 107 | { |
| 102 | 108 | $is_select_query = true; |
| 103 | 109 | $select = $matches[1]; |
| 104 | - } |
|
| 105 | - elseif (preg_match('~^CREATE TEMPORARY TABLE .+?(SELECT .+)$~s', trim($query_data['q']), $matches) != 0) |
|
| 110 | + } elseif (preg_match('~^CREATE TEMPORARY TABLE .+?(SELECT .+)$~s', trim($query_data['q']), $matches) != 0) |
|
| 106 | 111 | { |
| 107 | 112 | $is_select_query = true; |
| 108 | 113 | $select = $matches[1]; |
@@ -110,10 +115,11 @@ discard block |
||
| 110 | 115 | // Temporary tables created in earlier queries are not explainable. |
| 111 | 116 | if ($is_select_query) |
| 112 | 117 | { |
| 113 | - foreach (array('log_topics_unread', 'topics_posted_in', 'tmp_log_search_topics', 'tmp_log_search_messages') as $tmp) |
|
| 114 | - if (strpos($select, $tmp) !== false) |
|
| 118 | + foreach (array('log_topics_unread', 'topics_posted_in', 'tmp_log_search_topics', 'tmp_log_search_messages') as $tmp) { |
|
| 119 | + if (strpos($select, $tmp) !== false) |
|
| 115 | 120 | { |
| 116 | 121 | $is_select_query = false; |
| 122 | + } |
|
| 117 | 123 | break; |
| 118 | 124 | } |
| 119 | 125 | } |
@@ -124,13 +130,15 @@ discard block |
||
| 124 | 130 | ', nl2br(str_replace("\t", ' ', $smcFunc['htmlspecialchars']($query_data['q']))), ' |
| 125 | 131 | </a><br>'; |
| 126 | 132 | |
| 127 | - if (!empty($query_data['f']) && !empty($query_data['l'])) |
|
| 128 | - echo sprintf($txt['debug_query_in_line'], $query_data['f'], $query_data['l']); |
|
| 133 | + if (!empty($query_data['f']) && !empty($query_data['l'])) { |
|
| 134 | + echo sprintf($txt['debug_query_in_line'], $query_data['f'], $query_data['l']); |
|
| 135 | + } |
|
| 129 | 136 | |
| 130 | - if (isset($query_data['s'], $query_data['t']) && isset($txt['debug_query_which_took_at'])) |
|
| 131 | - echo sprintf($txt['debug_query_which_took_at'], round($query_data['t'], 8), round($query_data['s'], 8)); |
|
| 132 | - else |
|
| 133 | - echo sprintf($txt['debug_query_which_took'], round($query_data['t'], 8)); |
|
| 137 | + if (isset($query_data['s'], $query_data['t']) && isset($txt['debug_query_which_took_at'])) { |
|
| 138 | + echo sprintf($txt['debug_query_which_took_at'], round($query_data['t'], 8), round($query_data['s'], 8)); |
|
| 139 | + } else { |
|
| 140 | + echo sprintf($txt['debug_query_which_took'], round($query_data['t'], 8)); |
|
| 141 | + } |
|
| 134 | 142 | |
| 135 | 143 | echo ' |
| 136 | 144 | </div>'; |
@@ -14,8 +14,9 @@ discard block |
||
| 14 | 14 | * @version 2.1 Beta 3 |
| 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 | * Entrance point for the registration center, it checks permissions and forwards |
@@ -31,8 +32,9 @@ discard block |
||
| 31 | 32 | global $context, $txt; |
| 32 | 33 | |
| 33 | 34 | // Old templates might still request this. |
| 34 | - if (isset($_REQUEST['sa']) && $_REQUEST['sa'] == 'browse') |
|
| 35 | - redirectexit('action=admin;area=viewmembers;sa=browse' . (isset($_REQUEST['type']) ? ';type=' . $_REQUEST['type'] : '')); |
|
| 35 | + if (isset($_REQUEST['sa']) && $_REQUEST['sa'] == 'browse') { |
|
| 36 | + redirectexit('action=admin;area=viewmembers;sa=browse' . (isset($_REQUEST['type']) ? ';type=' . $_REQUEST['type'] : '')); |
|
| 37 | + } |
|
| 36 | 38 | |
| 37 | 39 | $subActions = array( |
| 38 | 40 | 'register' => array('AdminRegister', 'moderate_forum'), |
@@ -99,9 +101,10 @@ discard block |
||
| 99 | 101 | checkSession(); |
| 100 | 102 | validateToken('admin-regc'); |
| 101 | 103 | |
| 102 | - foreach ($_POST as $key => $value) |
|
| 103 | - if (!is_array($_POST[$key])) |
|
| 104 | + foreach ($_POST as $key => $value) { |
|
| 105 | + if (!is_array($_POST[$key])) |
|
| 104 | 106 | $_POST[$key] = htmltrim__recursive(str_replace(array("\n", "\r"), '', $_POST[$key])); |
| 107 | + } |
|
| 105 | 108 | |
| 106 | 109 | $regOptions = array( |
| 107 | 110 | 'interface' => 'admin', |
@@ -161,12 +164,13 @@ discard block |
||
| 161 | 164 | ) |
| 162 | 165 | ); |
| 163 | 166 | $context['member_groups'] = array(0 => $txt['admin_register_group_none']); |
| 164 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 165 | - $context['member_groups'][$row['id_group']] = $row['group_name']; |
|
| 167 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 168 | + $context['member_groups'][$row['id_group']] = $row['group_name']; |
|
| 169 | + } |
|
| 166 | 170 | $smcFunc['db_free_result']($request); |
| 171 | + } else { |
|
| 172 | + $context['member_groups'] = array(); |
|
| 167 | 173 | } |
| 168 | - else |
|
| 169 | - $context['member_groups'] = array(); |
|
| 170 | 174 | |
| 171 | 175 | // Basic stuff. |
| 172 | 176 | $context['sub_template'] = 'admin_register'; |
@@ -207,8 +211,9 @@ discard block |
||
| 207 | 211 | { |
| 208 | 212 | $context['editable_agreements']['.' . $lang['filename']] = $lang['name']; |
| 209 | 213 | // Are we editing this? |
| 210 | - if (isset($_POST['agree_lang']) && $_POST['agree_lang'] == '.' . $lang['filename']) |
|
| 211 | - $context['current_agreement'] = '.' . $lang['filename']; |
|
| 214 | + if (isset($_POST['agree_lang']) && $_POST['agree_lang'] == '.' . $lang['filename']) { |
|
| 215 | + $context['current_agreement'] = '.' . $lang['filename']; |
|
| 216 | + } |
|
| 212 | 217 | } |
| 213 | 218 | } |
| 214 | 219 | |
@@ -223,10 +228,11 @@ discard block |
||
| 223 | 228 | |
| 224 | 229 | updateSettings(array('requireAgreement' => !empty($_POST['requireAgreement']))); |
| 225 | 230 | |
| 226 | - if ($bytes == strlen($to_write)) |
|
| 227 | - $context['saved_successful'] = true; |
|
| 228 | - else |
|
| 229 | - $context['could_not_save'] = true; |
|
| 231 | + if ($bytes == strlen($to_write)) { |
|
| 232 | + $context['saved_successful'] = true; |
|
| 233 | + } else { |
|
| 234 | + $context['could_not_save'] = true; |
|
| 235 | + } |
|
| 230 | 236 | } |
| 231 | 237 | |
| 232 | 238 | $context['agreement'] = file_exists($boarddir . '/agreement' . $context['current_agreement'] . '.txt') ? $smcFunc['htmlspecialchars'](file_get_contents($boarddir . '/agreement' . $context['current_agreement'] . '.txt')) : ''; |
@@ -310,8 +316,9 @@ discard block |
||
| 310 | 316 | |
| 311 | 317 | call_integration_hook('integrate_modify_registration_settings', array(&$config_vars)); |
| 312 | 318 | |
| 313 | - if ($return_config) |
|
| 314 | - return $config_vars; |
|
| 319 | + if ($return_config) { |
|
| 320 | + return $config_vars; |
|
| 321 | + } |
|
| 315 | 322 | |
| 316 | 323 | // Setup the template |
| 317 | 324 | $context['sub_template'] = 'show_settings'; |
@@ -322,8 +329,9 @@ discard block |
||
| 322 | 329 | checkSession(); |
| 323 | 330 | |
| 324 | 331 | // Are there some contacts missing? |
| 325 | - if (!empty($_POST['coppaAge']) && !empty($_POST['coppaType']) && empty($_POST['coppaPost']) && empty($_POST['coppaFax'])) |
|
| 326 | - fatal_lang_error('admin_setting_coppa_require_contact'); |
|
| 332 | + if (!empty($_POST['coppaAge']) && !empty($_POST['coppaType']) && empty($_POST['coppaPost']) && empty($_POST['coppaFax'])) { |
|
| 333 | + fatal_lang_error('admin_setting_coppa_require_contact'); |
|
| 334 | + } |
|
| 327 | 335 | |
| 328 | 336 | // Post needs to take into account line breaks. |
| 329 | 337 | $_POST['coppaPost'] = str_replace("\n", '<br>', empty($_POST['coppaPost']) ? '' : $_POST['coppaPost']); |