@@ -13,8 +13,9 @@ discard block |
||
| 13 | 13 | * @version 2.1 Beta 4 |
| 14 | 14 | */ |
| 15 | 15 | |
| 16 | -if (!defined('SMF')) |
|
| 16 | +if (!defined('SMF')) { |
|
| 17 | 17 | die('No direct access...'); |
| 18 | +} |
|
| 18 | 19 | |
| 19 | 20 | /** |
| 20 | 21 | * Entry point for the moderation center. |
@@ -26,8 +27,9 @@ discard block |
||
| 26 | 27 | global $smcFunc, $txt, $context, $scripturl, $modSettings, $user_info, $sourcedir, $options; |
| 27 | 28 | |
| 28 | 29 | // Don't run this twice... and don't conflict with the admin bar. |
| 29 | - if (isset($context['admin_area'])) |
|
| 30 | - return; |
|
| 30 | + if (isset($context['admin_area'])) { |
|
| 31 | + return; |
|
| 32 | + } |
|
| 31 | 33 | |
| 32 | 34 | $context['can_moderate_boards'] = $user_info['mod_cache']['bq'] != '0=1'; |
| 33 | 35 | $context['can_moderate_groups'] = $user_info['mod_cache']['gq'] != '0=1'; |
@@ -35,8 +37,9 @@ discard block |
||
| 35 | 37 | $context['can_moderate_users'] = allowedTo('moderate_forum'); |
| 36 | 38 | |
| 37 | 39 | // Everyone using this area must be allowed here! |
| 38 | - if (!$context['can_moderate_boards'] && !$context['can_moderate_groups'] && !$context['can_moderate_approvals'] && !$context['can_moderate_users']) |
|
| 39 | - isAllowedTo('access_mod_center'); |
|
| 40 | + if (!$context['can_moderate_boards'] && !$context['can_moderate_groups'] && !$context['can_moderate_approvals'] && !$context['can_moderate_users']) { |
|
| 41 | + isAllowedTo('access_mod_center'); |
|
| 42 | + } |
|
| 40 | 43 | |
| 41 | 44 | // We're gonna want a menu of some kind. |
| 42 | 45 | require_once($sourcedir . '/Subs-Menu.php'); |
@@ -195,8 +198,9 @@ discard block |
||
| 195 | 198 | unset($moderation_areas); |
| 196 | 199 | |
| 197 | 200 | // We got something - didn't we? DIDN'T WE! |
| 198 | - if ($mod_include_data == false) |
|
| 199 | - fatal_lang_error('no_access', false); |
|
| 201 | + if ($mod_include_data == false) { |
|
| 202 | + fatal_lang_error('no_access', false); |
|
| 203 | + } |
|
| 200 | 204 | |
| 201 | 205 | // Retain the ID information in case required by a subaction. |
| 202 | 206 | $context['moderation_menu_id'] = $context['max_menu_id']; |
@@ -219,22 +223,25 @@ discard block |
||
| 219 | 223 | 'url' => $scripturl . '?action=moderate', |
| 220 | 224 | 'name' => $txt['moderation_center'], |
| 221 | 225 | ); |
| 222 | - if (isset($mod_include_data['current_area']) && $mod_include_data['current_area'] != 'index') |
|
| 223 | - $context['linktree'][] = array( |
|
| 226 | + if (isset($mod_include_data['current_area']) && $mod_include_data['current_area'] != 'index') { |
|
| 227 | + $context['linktree'][] = array( |
|
| 224 | 228 | 'url' => $scripturl . '?action=moderate;area=' . $mod_include_data['current_area'], |
| 225 | 229 | 'name' => $mod_include_data['label'], |
| 226 | 230 | ); |
| 227 | - if (!empty($mod_include_data['current_subsection']) && $mod_include_data['subsections'][$mod_include_data['current_subsection']][0] != $mod_include_data['label']) |
|
| 228 | - $context['linktree'][] = array( |
|
| 231 | + } |
|
| 232 | + if (!empty($mod_include_data['current_subsection']) && $mod_include_data['subsections'][$mod_include_data['current_subsection']][0] != $mod_include_data['label']) { |
|
| 233 | + $context['linktree'][] = array( |
|
| 229 | 234 | 'url' => $scripturl . '?action=moderate;area=' . $mod_include_data['current_area'] . ';sa=' . $mod_include_data['current_subsection'], |
| 230 | 235 | 'name' => $mod_include_data['subsections'][$mod_include_data['current_subsection']][0], |
| 231 | 236 | ); |
| 237 | + } |
|
| 232 | 238 | |
| 233 | 239 | // Now - finally - the bit before the encore - the main performance of course! |
| 234 | 240 | if (!$dont_call) |
| 235 | 241 | { |
| 236 | - if (isset($mod_include_data['file'])) |
|
| 237 | - require_once($sourcedir . '/' . $mod_include_data['file']); |
|
| 242 | + if (isset($mod_include_data['file'])) { |
|
| 243 | + require_once($sourcedir . '/' . $mod_include_data['file']); |
|
| 244 | + } |
|
| 238 | 245 | |
| 239 | 246 | call_helper($mod_include_data['function']); |
| 240 | 247 | } |
@@ -259,8 +266,9 @@ discard block |
||
| 259 | 266 | // Load what blocks the user actually can see... |
| 260 | 267 | $valid_blocks = array(); |
| 261 | 268 | |
| 262 | - if ($context['can_moderate_groups']) |
|
| 263 | - $valid_blocks['g'] = 'GroupRequests'; |
|
| 269 | + if ($context['can_moderate_groups']) { |
|
| 270 | + $valid_blocks['g'] = 'GroupRequests'; |
|
| 271 | + } |
|
| 264 | 272 | if ($context['can_moderate_boards']) |
| 265 | 273 | { |
| 266 | 274 | $valid_blocks['r'] = 'ReportedPosts'; |
@@ -269,8 +277,9 @@ discard block |
||
| 269 | 277 | if ($context['can_moderate_users']) |
| 270 | 278 | { |
| 271 | 279 | // This falls under the category of moderating users as well... |
| 272 | - if (!$context['can_moderate_boards']) |
|
| 273 | - $valid_blocks['w'] = 'WatchedUsers'; |
|
| 280 | + if (!$context['can_moderate_boards']) { |
|
| 281 | + $valid_blocks['w'] = 'WatchedUsers'; |
|
| 282 | + } |
|
| 274 | 283 | |
| 275 | 284 | $valid_blocks['rm'] = 'ReportedMembers'; |
| 276 | 285 | } |
@@ -281,8 +290,9 @@ discard block |
||
| 281 | 290 | foreach ($valid_blocks as $k => $block) |
| 282 | 291 | { |
| 283 | 292 | $block = 'ModBlock' . $block; |
| 284 | - if (function_exists($block)) |
|
| 285 | - $context['mod_blocks'][] = $block(); |
|
| 293 | + if (function_exists($block)) { |
|
| 294 | + $context['mod_blocks'][] = $block(); |
|
| 295 | + } |
|
| 286 | 296 | } |
| 287 | 297 | |
| 288 | 298 | $context['admin_prefs'] = !empty($options['admin_preferences']) ? $smcFunc['json_decode']($options['admin_preferences'], true) : array(); |
@@ -309,8 +319,9 @@ discard block |
||
| 309 | 319 | ) |
| 310 | 320 | ); |
| 311 | 321 | $watched_users = array(); |
| 312 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 313 | - $watched_users[] = $row; |
|
| 322 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 323 | + $watched_users[] = $row; |
|
| 324 | + } |
|
| 314 | 325 | $smcFunc['db_free_result']($request); |
| 315 | 326 | |
| 316 | 327 | cache_put_data('recent_user_watches', $watched_users, 240); |
@@ -402,8 +413,9 @@ discard block |
||
| 402 | 413 | $note_owner = $smcFunc['db_num_rows']($get_owner); |
| 403 | 414 | $smcFunc['db_free_result']($get_owner); |
| 404 | 415 | |
| 405 | - if (empty($note_owner)) |
|
| 406 | - fatal_lang_error('mc_notes_delete_own', false); |
|
| 416 | + if (empty($note_owner)) { |
|
| 417 | + fatal_lang_error('mc_notes_delete_own', false); |
|
| 418 | + } |
|
| 407 | 419 | } |
| 408 | 420 | |
| 409 | 421 | // Lets delete it. |
@@ -460,12 +472,14 @@ discard block |
||
| 460 | 472 | ) |
| 461 | 473 | ); |
| 462 | 474 | $moderator_notes = array(); |
| 463 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 464 | - $moderator_notes[] = $row; |
|
| 475 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 476 | + $moderator_notes[] = $row; |
|
| 477 | + } |
|
| 465 | 478 | $smcFunc['db_free_result']($request); |
| 466 | 479 | |
| 467 | - if ($offset == 0) |
|
| 468 | - cache_put_data('moderator_notes', $moderator_notes, 240); |
|
| 480 | + if ($offset == 0) { |
|
| 481 | + cache_put_data('moderator_notes', $moderator_notes, 240); |
|
| 482 | + } |
|
| 469 | 483 | } |
| 470 | 484 | |
| 471 | 485 | // Lets construct a page index. |
@@ -504,8 +518,9 @@ discard block |
||
| 504 | 518 | // Got the info already? |
| 505 | 519 | $cachekey = md5($smcFunc['json_encode']($user_info['mod_cache']['bq'])); |
| 506 | 520 | $context['reported_posts'] = array(); |
| 507 | - if ($user_info['mod_cache']['bq'] == '0=1') |
|
| 508 | - return 'reported_posts_block'; |
|
| 521 | + if ($user_info['mod_cache']['bq'] == '0=1') { |
|
| 522 | + return 'reported_posts_block'; |
|
| 523 | + } |
|
| 509 | 524 | |
| 510 | 525 | if (($reported_posts = cache_get_data('reported_posts_' . $cachekey, 90)) === null) |
| 511 | 526 | { |
@@ -529,8 +544,9 @@ discard block |
||
| 529 | 544 | ) |
| 530 | 545 | ); |
| 531 | 546 | $reported_posts = array(); |
| 532 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 533 | - $reported_posts[] = $row; |
|
| 547 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 548 | + $reported_posts[] = $row; |
|
| 549 | + } |
|
| 534 | 550 | $smcFunc['db_free_result']($request); |
| 535 | 551 | |
| 536 | 552 | // Cache it. |
@@ -568,8 +584,9 @@ discard block |
||
| 568 | 584 | |
| 569 | 585 | $context['group_requests'] = array(); |
| 570 | 586 | // Make sure they can even moderate someone! |
| 571 | - if ($user_info['mod_cache']['gq'] == '0=1') |
|
| 572 | - return 'group_requests_block'; |
|
| 587 | + if ($user_info['mod_cache']['gq'] == '0=1') { |
|
| 588 | + return 'group_requests_block'; |
|
| 589 | + } |
|
| 573 | 590 | |
| 574 | 591 | // What requests are outstanding? |
| 575 | 592 | $request = $smcFunc['db_query']('', ' |
@@ -618,8 +635,9 @@ discard block |
||
| 618 | 635 | // Got the info already? |
| 619 | 636 | $cachekey = md5($smcFunc['json_encode']((int) allowedTo('moderate_forum'))); |
| 620 | 637 | $context['reported_users'] = array(); |
| 621 | - if (!allowedTo('moderate_forum')) |
|
| 622 | - return 'reported_users_block'; |
|
| 638 | + if (!allowedTo('moderate_forum')) { |
|
| 639 | + return 'reported_users_block'; |
|
| 640 | + } |
|
| 623 | 641 | |
| 624 | 642 | if (($reported_users = cache_get_data('reported_users_' . $cachekey, 90)) === null) |
| 625 | 643 | { |
@@ -642,8 +660,9 @@ discard block |
||
| 642 | 660 | ) |
| 643 | 661 | ); |
| 644 | 662 | $reported_users = array(); |
| 645 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 646 | - $reported_users[] = $row; |
|
| 663 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 664 | + $reported_users[] = $row; |
|
| 665 | + } |
|
| 647 | 666 | $smcFunc['db_free_result']($request); |
| 648 | 667 | |
| 649 | 668 | // Cache it. |
@@ -742,15 +761,15 @@ discard block |
||
| 742 | 761 | // Time to update. |
| 743 | 762 | updateSettings(array('last_mod_report_action' => time())); |
| 744 | 763 | recountOpenReports('members'); |
| 745 | - } |
|
| 746 | - elseif (isset($_POST['close']) && isset($_POST['close_selected'])) |
|
| 764 | + } elseif (isset($_POST['close']) && isset($_POST['close_selected'])) |
|
| 747 | 765 | { |
| 748 | 766 | checkSession(); |
| 749 | 767 | |
| 750 | 768 | // All the ones to update... |
| 751 | 769 | $toClose = array(); |
| 752 | - foreach ($_POST['close'] as $rid) |
|
| 753 | - $toClose[] = (int) $rid; |
|
| 770 | + foreach ($_POST['close'] as $rid) { |
|
| 771 | + $toClose[] = (int) $rid; |
|
| 772 | + } |
|
| 754 | 773 | |
| 755 | 774 | if (!empty($toClose)) |
| 756 | 775 | { |
@@ -903,8 +922,9 @@ discard block |
||
| 903 | 922 | global $context, $user_info; |
| 904 | 923 | |
| 905 | 924 | // You need to be allowed to moderate groups... |
| 906 | - if ($user_info['mod_cache']['gq'] == '0=1') |
|
| 907 | - isAllowedTo('manage_membergroups'); |
|
| 925 | + if ($user_info['mod_cache']['gq'] == '0=1') { |
|
| 926 | + isAllowedTo('manage_membergroups'); |
|
| 927 | + } |
|
| 908 | 928 | |
| 909 | 929 | // Load the group templates. |
| 910 | 930 | loadTemplate('ModerationCenter'); |
@@ -915,8 +935,9 @@ discard block |
||
| 915 | 935 | 'view' => 'ViewGroups', |
| 916 | 936 | ); |
| 917 | 937 | |
| 918 | - if (!isset($_GET['sa']) || !isset($subActions[$_GET['sa']])) |
|
| 919 | - $_GET['sa'] = 'view'; |
|
| 938 | + if (!isset($_GET['sa']) || !isset($subActions[$_GET['sa']])) { |
|
| 939 | + $_GET['sa'] = 'view'; |
|
| 940 | + } |
|
| 920 | 941 | $context['sub_action'] = $_GET['sa']; |
| 921 | 942 | |
| 922 | 943 | // Call the relevant function. |
@@ -946,8 +967,9 @@ discard block |
||
| 946 | 967 | 'id_notice' => $id_notice, |
| 947 | 968 | ) |
| 948 | 969 | ); |
| 949 | - if ($smcFunc['db_num_rows']($request) == 0) |
|
| 950 | - fatal_lang_error('no_access', false); |
|
| 970 | + if ($smcFunc['db_num_rows']($request) == 0) { |
|
| 971 | + fatal_lang_error('no_access', false); |
|
| 972 | + } |
|
| 951 | 973 | list ($context['notice_body'], $context['notice_subject']) = $smcFunc['db_fetch_row']($request); |
| 952 | 974 | $smcFunc['db_free_result']($request); |
| 953 | 975 | |
@@ -984,18 +1006,20 @@ discard block |
||
| 984 | 1006 | checkSession(!is_array($_REQUEST['delete']) ? 'get' : 'post'); |
| 985 | 1007 | |
| 986 | 1008 | $toDelete = array(); |
| 987 | - if (!is_array($_REQUEST['delete'])) |
|
| 988 | - $toDelete[] = (int) $_REQUEST['delete']; |
|
| 989 | - else |
|
| 990 | - foreach ($_REQUEST['delete'] as $did) |
|
| 1009 | + if (!is_array($_REQUEST['delete'])) { |
|
| 1010 | + $toDelete[] = (int) $_REQUEST['delete']; |
|
| 1011 | + } else { |
|
| 1012 | + foreach ($_REQUEST['delete'] as $did) |
|
| 991 | 1013 | $toDelete[] = (int) $did; |
| 1014 | + } |
|
| 992 | 1015 | |
| 993 | 1016 | if (!empty($toDelete)) |
| 994 | 1017 | { |
| 995 | 1018 | require_once($sourcedir . '/RemoveTopic.php'); |
| 996 | 1019 | // If they don't have permission we'll let it error - either way no chance of a security slip here! |
| 997 | - foreach ($toDelete as $did) |
|
| 998 | - removeMessage($did); |
|
| 1020 | + foreach ($toDelete as $did) { |
|
| 1021 | + removeMessage($did); |
|
| 1022 | + } |
|
| 999 | 1023 | } |
| 1000 | 1024 | } |
| 1001 | 1025 | |
@@ -1004,20 +1028,21 @@ discard block |
||
| 1004 | 1028 | { |
| 1005 | 1029 | $approve_query = ''; |
| 1006 | 1030 | $delete_boards = array(); |
| 1007 | - } |
|
| 1008 | - else |
|
| 1031 | + } else |
|
| 1009 | 1032 | { |
| 1010 | 1033 | // Still obey permissions! |
| 1011 | 1034 | $approve_boards = boardsAllowedTo('approve_posts'); |
| 1012 | 1035 | $delete_boards = boardsAllowedTo('delete_any'); |
| 1013 | 1036 | |
| 1014 | - if ($approve_boards == array(0)) |
|
| 1015 | - $approve_query = ''; |
|
| 1016 | - elseif (!empty($approve_boards)) |
|
| 1017 | - $approve_query = ' AND m.id_board IN (' . implode(',', $approve_boards) . ')'; |
|
| 1037 | + if ($approve_boards == array(0)) { |
|
| 1038 | + $approve_query = ''; |
|
| 1039 | + } elseif (!empty($approve_boards)) { |
|
| 1040 | + $approve_query = ' AND m.id_board IN (' . implode(',', $approve_boards) . ')'; |
|
| 1041 | + } |
|
| 1018 | 1042 | // Nada, zip, etc... |
| 1019 | - else |
|
| 1020 | - $approve_query = ' AND 1=0'; |
|
| 1043 | + else { |
|
| 1044 | + $approve_query = ' AND 1=0'; |
|
| 1045 | + } |
|
| 1021 | 1046 | } |
| 1022 | 1047 | |
| 1023 | 1048 | require_once($sourcedir . '/Subs-List.php'); |
@@ -1116,10 +1141,11 @@ discard block |
||
| 1116 | 1141 | 'data' => array( |
| 1117 | 1142 | 'function' => function($member) use ($scripturl) |
| 1118 | 1143 | { |
| 1119 | - if ($member['last_post_id']) |
|
| 1120 | - return '<a href="' . $scripturl . '?msg=' . $member['last_post_id'] . '">' . $member['last_post'] . '</a>'; |
|
| 1121 | - else |
|
| 1122 | - return $member['last_post']; |
|
| 1144 | + if ($member['last_post_id']) { |
|
| 1145 | + return '<a href="' . $scripturl . '?msg=' . $member['last_post_id'] . '">' . $member['last_post'] . '</a>'; |
|
| 1146 | + } else { |
|
| 1147 | + return $member['last_post']; |
|
| 1148 | + } |
|
| 1123 | 1149 | }, |
| 1124 | 1150 | ), |
| 1125 | 1151 | ), |
@@ -1247,8 +1273,9 @@ discard block |
||
| 1247 | 1273 | ) |
| 1248 | 1274 | ); |
| 1249 | 1275 | $latest_posts = array(); |
| 1250 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 1251 | - $latest_posts[$row['id_member']] = $row['last_post_id']; |
|
| 1276 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 1277 | + $latest_posts[$row['id_member']] = $row['last_post_id']; |
|
| 1278 | + } |
|
| 1252 | 1279 | |
| 1253 | 1280 | if (!empty($latest_posts)) |
| 1254 | 1281 | { |
@@ -1439,15 +1466,17 @@ discard block |
||
| 1439 | 1466 | // Setup the direction stuff... |
| 1440 | 1467 | $context['order'] = isset($_REQUEST['sort']) && isset($sort_types[$_REQUEST['sort']]) ? $_REQUEST['sort'] : 'member'; |
| 1441 | 1468 | |
| 1442 | - if (!isset($search_params['string']) || (!empty($_REQUEST['search']) && $search_params['string'] != $_REQUEST['search'])) |
|
| 1443 | - $search_params_string = empty($_REQUEST['search']) ? '' : $_REQUEST['search']; |
|
| 1444 | - else |
|
| 1445 | - $search_params_string = $search_params['string']; |
|
| 1469 | + if (!isset($search_params['string']) || (!empty($_REQUEST['search']) && $search_params['string'] != $_REQUEST['search'])) { |
|
| 1470 | + $search_params_string = empty($_REQUEST['search']) ? '' : $_REQUEST['search']; |
|
| 1471 | + } else { |
|
| 1472 | + $search_params_string = $search_params['string']; |
|
| 1473 | + } |
|
| 1446 | 1474 | |
| 1447 | - if (isset($_REQUEST['search_type']) || empty($search_params['type']) || !isset($searchTypes[$search_params['type']])) |
|
| 1448 | - $search_params_type = isset($_REQUEST['search_type']) && isset($searchTypes[$_REQUEST['search_type']]) ? $_REQUEST['search_type'] : (isset($searchTypes[$context['order']]) ? $context['order'] : 'member'); |
|
| 1449 | - else |
|
| 1450 | - $search_params_type = $search_params['type']; |
|
| 1475 | + if (isset($_REQUEST['search_type']) || empty($search_params['type']) || !isset($searchTypes[$search_params['type']])) { |
|
| 1476 | + $search_params_type = isset($_REQUEST['search_type']) && isset($searchTypes[$_REQUEST['search_type']]) ? $_REQUEST['search_type'] : (isset($searchTypes[$context['order']]) ? $context['order'] : 'member'); |
|
| 1477 | + } else { |
|
| 1478 | + $search_params_type = $search_params['type']; |
|
| 1479 | + } |
|
| 1451 | 1480 | |
| 1452 | 1481 | $search_params = array( |
| 1453 | 1482 | 'string' => $search_params_string, |
@@ -1530,9 +1559,10 @@ discard block |
||
| 1530 | 1559 | ' . $rowData['reason'] . ' |
| 1531 | 1560 | </div>'; |
| 1532 | 1561 | |
| 1533 | - if (!empty($rowData['id_notice'])) |
|
| 1534 | - $output .= ' |
|
| 1562 | + if (!empty($rowData['id_notice'])) { |
|
| 1563 | + $output .= ' |
|
| 1535 | 1564 | <a href="' . $scripturl . '?action=moderate;area=notice;nid=' . $rowData['id_notice'] . '" onclick="window.open(this.href, \'\', \'scrollbars=yes,resizable=yes,width=400,height=250\');return false;" target="_blank" class="new_win" title="' . $txt['profile_warning_previous_notice'] . '"><span class="generic_icons filter centericon"></span></a>'; |
| 1565 | + } |
|
| 1536 | 1566 | return $output; |
| 1537 | 1567 | }, |
| 1538 | 1568 | ), |
@@ -1650,9 +1680,9 @@ discard block |
||
| 1650 | 1680 | global $smcFunc, $modSettings, $context, $txt, $scripturl, $sourcedir, $user_info; |
| 1651 | 1681 | |
| 1652 | 1682 | // Submitting a new one? |
| 1653 | - if (isset($_POST['add'])) |
|
| 1654 | - return ModifyWarningTemplate(); |
|
| 1655 | - elseif (isset($_POST['delete']) && !empty($_POST['deltpl'])) |
|
| 1683 | + if (isset($_POST['add'])) { |
|
| 1684 | + return ModifyWarningTemplate(); |
|
| 1685 | + } elseif (isset($_POST['delete']) && !empty($_POST['deltpl'])) |
|
| 1656 | 1686 | { |
| 1657 | 1687 | checkSession(); |
| 1658 | 1688 | validateToken('mod-wt'); |
@@ -1671,8 +1701,9 @@ discard block |
||
| 1671 | 1701 | 'current_member' => $user_info['id'], |
| 1672 | 1702 | ) |
| 1673 | 1703 | ); |
| 1674 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 1675 | - logAction('delete_warn_template', array('template' => $row['recipient_name'])); |
|
| 1704 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 1705 | + logAction('delete_warn_template', array('template' => $row['recipient_name'])); |
|
| 1706 | + } |
|
| 1676 | 1707 | $smcFunc['db_free_result']($request); |
| 1677 | 1708 | |
| 1678 | 1709 | // Do the deletes. |
@@ -1963,16 +1994,18 @@ discard block |
||
| 1963 | 1994 | ); |
| 1964 | 1995 | |
| 1965 | 1996 | // If it wasn't visible and now is they've effectively added it. |
| 1966 | - if ($context['template_data']['personal'] && !$recipient_id) |
|
| 1967 | - logAction('add_warn_template', array('template' => $_POST['template_title'])); |
|
| 1997 | + if ($context['template_data']['personal'] && !$recipient_id) { |
|
| 1998 | + logAction('add_warn_template', array('template' => $_POST['template_title'])); |
|
| 1999 | + } |
|
| 1968 | 2000 | // Conversely if they made it personal it's a delete. |
| 1969 | - elseif (!$context['template_data']['personal'] && $recipient_id) |
|
| 1970 | - logAction('delete_warn_template', array('template' => $_POST['template_title'])); |
|
| 2001 | + elseif (!$context['template_data']['personal'] && $recipient_id) { |
|
| 2002 | + logAction('delete_warn_template', array('template' => $_POST['template_title'])); |
|
| 2003 | + } |
|
| 1971 | 2004 | // Otherwise just an edit. |
| 1972 | - else |
|
| 1973 | - logAction('modify_warn_template', array('template' => $_POST['template_title'])); |
|
| 1974 | - } |
|
| 1975 | - else |
|
| 2005 | + else { |
|
| 2006 | + logAction('modify_warn_template', array('template' => $_POST['template_title'])); |
|
| 2007 | + } |
|
| 2008 | + } else |
|
| 1976 | 2009 | { |
| 1977 | 2010 | $smcFunc['db_insert']('', |
| 1978 | 2011 | '{db_prefix}log_comments', |
@@ -1992,17 +2025,18 @@ discard block |
||
| 1992 | 2025 | |
| 1993 | 2026 | // Get out of town... |
| 1994 | 2027 | redirectexit('action=moderate;area=warnings;sa=templates'); |
| 1995 | - } |
|
| 1996 | - else |
|
| 2028 | + } else |
|
| 1997 | 2029 | { |
| 1998 | 2030 | $context['warning_errors'] = array(); |
| 1999 | 2031 | $context['template_data']['title'] = !empty($_POST['template_title']) ? $_POST['template_title'] : ''; |
| 2000 | 2032 | $context['template_data']['body'] = !empty($_POST['template_body']) ? $_POST['template_body'] : $txt['mc_warning_template_body_default']; |
| 2001 | 2033 | $context['template_data']['personal'] = !empty($_POST['make_personal']); |
| 2002 | - if (empty($_POST['template_title'])) |
|
| 2003 | - $context['warning_errors'][] = $txt['mc_warning_template_error_no_title']; |
|
| 2004 | - if (empty($_POST['template_body'])) |
|
| 2005 | - $context['warning_errors'][] = $txt['mc_warning_template_error_no_body']; |
|
| 2034 | + if (empty($_POST['template_title'])) { |
|
| 2035 | + $context['warning_errors'][] = $txt['mc_warning_template_error_no_title']; |
|
| 2036 | + } |
|
| 2037 | + if (empty($_POST['template_body'])) { |
|
| 2038 | + $context['warning_errors'][] = $txt['mc_warning_template_error_no_body']; |
|
| 2039 | + } |
|
| 2006 | 2040 | } |
| 2007 | 2041 | } |
| 2008 | 2042 | |
@@ -2047,8 +2081,9 @@ discard block |
||
| 2047 | 2081 | // Now check other options! |
| 2048 | 2082 | $pref_binary = 0; |
| 2049 | 2083 | |
| 2050 | - if ($context['can_moderate_approvals'] && !empty($_POST['mod_notify_approval'])) |
|
| 2051 | - $pref_binary |= 4; |
|
| 2084 | + if ($context['can_moderate_approvals'] && !empty($_POST['mod_notify_approval'])) { |
|
| 2085 | + $pref_binary |= 4; |
|
| 2086 | + } |
|
| 2052 | 2087 | |
| 2053 | 2088 | // Put it all together. |
| 2054 | 2089 | $mod_prefs = '0||' . $pref_binary; |
@@ -2072,9 +2107,10 @@ discard block |
||
| 2072 | 2107 | unset($_SESSION['moderate_time']); |
| 2073 | 2108 | |
| 2074 | 2109 | // Clean any moderator tokens as well. |
| 2075 | - foreach ($_SESSION['token'] as $key => $token) |
|
| 2076 | - if (strpos($key, '-mod') !== false) |
|
| 2110 | + foreach ($_SESSION['token'] as $key => $token) { |
|
| 2111 | + if (strpos($key, '-mod') !== false) |
|
| 2077 | 2112 | unset($_SESSION['token'][$key]); |
| 2113 | + } |
|
| 2078 | 2114 | |
| 2079 | 2115 | redirectexit(); |
| 2080 | 2116 | } |