@@ -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 function, permission checks, admin bars, etc. |
@@ -99,27 +100,27 @@ discard block |
||
| 99 | 100 | 'function' => function($rowData) use ($scripturl) |
| 100 | 101 | { |
| 101 | 102 | // Since the moderator group has no explicit members, no link is needed. |
| 102 | - if ($rowData['id_group'] == 3) |
|
| 103 | - $group_name = $rowData['group_name']; |
|
| 104 | - else |
|
| 103 | + if ($rowData['id_group'] == 3) { |
|
| 104 | + $group_name = $rowData['group_name']; |
|
| 105 | + } else |
|
| 105 | 106 | { |
| 106 | 107 | $color_style = empty($rowData['online_color']) ? '' : sprintf(' style="color: %1$s;"', $rowData['online_color']); |
| 107 | 108 | |
| 108 | 109 | if (allowedTo('manage_membergroups')) |
| 109 | 110 | { |
| 110 | 111 | $group_name = sprintf('<a href="%1$s?action=admin;area=membergroups;sa=members;group=%2$d"%3$s>%4$s</a>', $scripturl, $rowData['id_group'], $color_style, $rowData['group_name']); |
| 111 | - } |
|
| 112 | - else |
|
| 112 | + } else |
|
| 113 | 113 | { |
| 114 | 114 | $group_name = sprintf('<a href="%1$s?action=groups;sa=members;group=%2$d"%3$s>%4$s</a>', $scripturl, $rowData['id_group'], $color_style, $rowData['group_name']); |
| 115 | 115 | } |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | // Add a help option for moderator and administrator. |
| 119 | - if ($rowData['id_group'] == 1) |
|
| 120 | - $group_name .= sprintf(' (<a href="%1$s?action=helpadmin;help=membergroup_administrator" onclick="return reqOverlayDiv(this.href);">?</a>)', $scripturl); |
|
| 121 | - elseif ($rowData['id_group'] == 3) |
|
| 122 | - $group_name .= sprintf(' (<a href="%1$s?action=helpadmin;help=membergroup_moderator" onclick="return reqOverlayDiv(this.href);">?</a>)', $scripturl); |
|
| 119 | + if ($rowData['id_group'] == 1) { |
|
| 120 | + $group_name .= sprintf(' (<a href="%1$s?action=helpadmin;help=membergroup_administrator" onclick="return reqOverlayDiv(this.href);">?</a>)', $scripturl); |
|
| 121 | + } elseif ($rowData['id_group'] == 3) { |
|
| 122 | + $group_name .= sprintf(' (<a href="%1$s?action=helpadmin;help=membergroup_moderator" onclick="return reqOverlayDiv(this.href);">?</a>)', $scripturl); |
|
| 123 | + } |
|
| 123 | 124 | |
| 124 | 125 | return $group_name; |
| 125 | 126 | }, |
@@ -198,8 +199,9 @@ discard block |
||
| 198 | 199 | $_REQUEST['group'] = isset($_REQUEST['group']) ? (int) $_REQUEST['group'] : 0; |
| 199 | 200 | |
| 200 | 201 | // No browsing of guests, membergroup 0 or moderators. |
| 201 | - if (in_array($_REQUEST['group'], array(-1, 0, 3))) |
|
| 202 | - fatal_lang_error('membergroup_does_not_exist', false); |
|
| 202 | + if (in_array($_REQUEST['group'], array(-1, 0, 3))) { |
|
| 203 | + fatal_lang_error('membergroup_does_not_exist', false); |
|
| 204 | + } |
|
| 203 | 205 | |
| 204 | 206 | // Load up the group details. |
| 205 | 207 | $request = $smcFunc['db_query']('', ' |
@@ -214,8 +216,9 @@ discard block |
||
| 214 | 216 | ) |
| 215 | 217 | ); |
| 216 | 218 | // Doesn't exist? |
| 217 | - if ($smcFunc['db_num_rows']($request) == 0) |
|
| 218 | - fatal_lang_error('membergroup_does_not_exist', false); |
|
| 219 | + if ($smcFunc['db_num_rows']($request) == 0) { |
|
| 220 | + fatal_lang_error('membergroup_does_not_exist', false); |
|
| 221 | + } |
|
| 219 | 222 | $context['group'] = $smcFunc['db_fetch_assoc']($request); |
| 220 | 223 | $smcFunc['db_free_result']($request); |
| 221 | 224 | |
@@ -248,21 +251,25 @@ discard block |
||
| 248 | 251 | 'name' => $row['real_name'] |
| 249 | 252 | ); |
| 250 | 253 | |
| 251 | - if ($user_info['id'] == $row['id_member'] && $context['group']['group_type'] != 1) |
|
| 252 | - $context['group']['can_moderate'] = true; |
|
| 254 | + if ($user_info['id'] == $row['id_member'] && $context['group']['group_type'] != 1) { |
|
| 255 | + $context['group']['can_moderate'] = true; |
|
| 256 | + } |
|
| 253 | 257 | } |
| 254 | 258 | $smcFunc['db_free_result']($request); |
| 255 | 259 | |
| 256 | 260 | // If this group is hidden then it can only "exists" if the user can moderate it! |
| 257 | - if ($context['group']['hidden'] && !$context['group']['can_moderate']) |
|
| 258 | - fatal_lang_error('membergroup_does_not_exist', false); |
|
| 261 | + if ($context['group']['hidden'] && !$context['group']['can_moderate']) { |
|
| 262 | + fatal_lang_error('membergroup_does_not_exist', false); |
|
| 263 | + } |
|
| 259 | 264 | |
| 260 | 265 | // You can only assign membership if you are the moderator and/or can manage groups! |
| 261 | - if (!$context['group']['can_moderate']) |
|
| 262 | - $context['group']['assignable'] = 0; |
|
| 266 | + if (!$context['group']['can_moderate']) { |
|
| 267 | + $context['group']['assignable'] = 0; |
|
| 268 | + } |
|
| 263 | 269 | // Non-admins cannot assign admins. |
| 264 | - elseif ($context['group']['id'] == 1 && !allowedTo('admin_forum')) |
|
| 265 | - $context['group']['assignable'] = 0; |
|
| 270 | + elseif ($context['group']['id'] == 1 && !allowedTo('admin_forum')) { |
|
| 271 | + $context['group']['assignable'] = 0; |
|
| 272 | + } |
|
| 266 | 273 | |
| 267 | 274 | // Removing member from group? |
| 268 | 275 | if (isset($_POST['remove']) && !empty($_REQUEST['rem']) && is_array($_REQUEST['rem']) && $context['group']['assignable']) |
@@ -271,8 +278,9 @@ discard block |
||
| 271 | 278 | validateToken('mod-mgm'); |
| 272 | 279 | |
| 273 | 280 | // Make sure we're dealing with integers only. |
| 274 | - foreach ($_REQUEST['rem'] as $key => $group) |
|
| 275 | - $_REQUEST['rem'][$key] = (int) $group; |
|
| 281 | + foreach ($_REQUEST['rem'] as $key => $group) { |
|
| 282 | + $_REQUEST['rem'][$key] = (int) $group; |
|
| 283 | + } |
|
| 276 | 284 | |
| 277 | 285 | require_once($sourcedir . '/Subs-Membergroups.php'); |
| 278 | 286 | removeMembersFromGroups($_REQUEST['rem'], $_REQUEST['group'], true); |
@@ -295,16 +303,18 @@ discard block |
||
| 295 | 303 | { |
| 296 | 304 | $member_names[$index] = trim($smcFunc['strtolower']($member_names[$index])); |
| 297 | 305 | |
| 298 | - if (strlen($member_names[$index]) == 0) |
|
| 299 | - unset($member_names[$index]); |
|
| 306 | + if (strlen($member_names[$index]) == 0) { |
|
| 307 | + unset($member_names[$index]); |
|
| 308 | + } |
|
| 300 | 309 | } |
| 301 | 310 | |
| 302 | 311 | // Any passed by ID? |
| 303 | 312 | $member_ids = array(); |
| 304 | - if (!empty($_REQUEST['member_add'])) |
|
| 305 | - foreach ($_REQUEST['member_add'] as $id) |
|
| 313 | + if (!empty($_REQUEST['member_add'])) { |
|
| 314 | + foreach ($_REQUEST['member_add'] as $id) |
|
| 306 | 315 | if ($id > 0) |
| 307 | 316 | $member_ids[] = (int) $id; |
| 317 | + } |
|
| 308 | 318 | |
| 309 | 319 | // Construct the query pelements. |
| 310 | 320 | if (!empty($member_ids)) |
@@ -332,8 +342,9 @@ discard block |
||
| 332 | 342 | 'id_group' => $_REQUEST['group'], |
| 333 | 343 | )) |
| 334 | 344 | ); |
| 335 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 336 | - $members[] = $row['id_member']; |
|
| 345 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 346 | + $members[] = $row['id_member']; |
|
| 347 | + } |
|
| 337 | 348 | $smcFunc['db_free_result']($request); |
| 338 | 349 | } |
| 339 | 350 | |
@@ -372,10 +383,11 @@ discard block |
||
| 372 | 383 | $context['sort_direction'] = isset($_REQUEST['desc']) ? 'down' : 'up'; |
| 373 | 384 | |
| 374 | 385 | // The where on the query is interesting. Non-moderators should only see people who are in this group as primary. |
| 375 | - if ($context['group']['can_moderate']) |
|
| 376 | - $where = $context['group']['is_post_group'] ? 'id_post_group = {int:group}' : 'id_group = {int:group} OR FIND_IN_SET({int:group}, additional_groups) != 0'; |
|
| 377 | - else |
|
| 378 | - $where = $context['group']['is_post_group'] ? 'id_post_group = {int:group}' : 'id_group = {int:group}'; |
|
| 386 | + if ($context['group']['can_moderate']) { |
|
| 387 | + $where = $context['group']['is_post_group'] ? 'id_post_group = {int:group}' : 'id_group = {int:group} OR FIND_IN_SET({int:group}, additional_groups) != 0'; |
|
| 388 | + } else { |
|
| 389 | + $where = $context['group']['is_post_group'] ? 'id_post_group = {int:group}' : 'id_group = {int:group}'; |
|
| 390 | + } |
|
| 379 | 391 | |
| 380 | 392 | // Count members of the group. |
| 381 | 393 | $request = $smcFunc['db_query']('', ' |
@@ -416,8 +428,9 @@ discard block |
||
| 416 | 428 | $last_online = empty($row['last_login']) ? $txt['never'] : timeformat($row['last_login']); |
| 417 | 429 | |
| 418 | 430 | // Italicize the online note if they aren't activated. |
| 419 | - if ($row['is_activated'] % 10 != 1) |
|
| 420 | - $last_online = '<em title="' . $txt['not_activated'] . '">' . $last_online . '</em>'; |
|
| 431 | + if ($row['is_activated'] % 10 != 1) { |
|
| 432 | + $last_online = '<em title="' . $txt['not_activated'] . '">' . $last_online . '</em>'; |
|
| 433 | + } |
|
| 421 | 434 | |
| 422 | 435 | $context['members'][] = array( |
| 423 | 436 | 'id' => $row['id_member'], |
@@ -437,9 +450,10 @@ discard block |
||
| 437 | 450 | $context['page_title'] = $txt['membergroups_members_title'] . ': ' . $context['group']['name']; |
| 438 | 451 | createToken('mod-mgm'); |
| 439 | 452 | |
| 440 | - if ($context['group']['assignable']) |
|
| 441 | - loadJavaScriptFile('suggest.js', array('defer' => false), 'smf_suggest'); |
|
| 442 | -} |
|
| 453 | + if ($context['group']['assignable']) { |
|
| 454 | + loadJavaScriptFile('suggest.js', array('defer' => false), 'smf_suggest'); |
|
| 455 | + } |
|
| 456 | + } |
|
| 443 | 457 | |
| 444 | 458 | /** |
| 445 | 459 | * Show and manage all group requests. |
@@ -453,16 +467,18 @@ discard block |
||
| 453 | 467 | $context['sub_template'] = 'show_list'; |
| 454 | 468 | |
| 455 | 469 | // Verify we can be here. |
| 456 | - if ($user_info['mod_cache']['gq'] == '0=1') |
|
| 457 | - isAllowedTo('manage_membergroups'); |
|
| 470 | + if ($user_info['mod_cache']['gq'] == '0=1') { |
|
| 471 | + isAllowedTo('manage_membergroups'); |
|
| 472 | + } |
|
| 458 | 473 | |
| 459 | 474 | // Normally, we act normally... |
| 460 | 475 | $where = ($user_info['mod_cache']['gq'] == '1=1' || $user_info['mod_cache']['gq'] == '0=1' ? $user_info['mod_cache']['gq'] : 'lgr.' . $user_info['mod_cache']['gq']); |
| 461 | 476 | |
| 462 | - if (isset($_GET['closed'])) |
|
| 463 | - $where .= ' AND lgr.status != {int:status_open}'; |
|
| 464 | - else |
|
| 465 | - $where .= ' AND lgr.status = {int:status_open}'; |
|
| 477 | + if (isset($_GET['closed'])) { |
|
| 478 | + $where .= ' AND lgr.status != {int:status_open}'; |
|
| 479 | + } else { |
|
| 480 | + $where .= ' AND lgr.status = {int:status_open}'; |
|
| 481 | + } |
|
| 466 | 482 | |
| 467 | 483 | $where_parameters = array( |
| 468 | 484 | 'status_open' => 0, |
@@ -475,8 +491,9 @@ discard block |
||
| 475 | 491 | validateToken('mod-gr'); |
| 476 | 492 | |
| 477 | 493 | // Clean the values. |
| 478 | - foreach ($_POST['groupr'] as $k => $request) |
|
| 479 | - $_POST['groupr'][$k] = (int) $request; |
|
| 494 | + foreach ($_POST['groupr'] as $k => $request) { |
|
| 495 | + $_POST['groupr'][$k] = (int) $request; |
|
| 496 | + } |
|
| 480 | 497 | |
| 481 | 498 | $log_changes = array(); |
| 482 | 499 | |
@@ -513,8 +530,8 @@ discard block |
||
| 513 | 530 | $request_list = array(); |
| 514 | 531 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
| 515 | 532 | { |
| 516 | - if (!isset($log_changes[$row['id_request']])) |
|
| 517 | - $log_changes[$row['id_request']] = array( |
|
| 533 | + if (!isset($log_changes[$row['id_request']])) { |
|
| 534 | + $log_changes[$row['id_request']] = array( |
|
| 518 | 535 | 'id_request' => $row['id_request'], |
| 519 | 536 | 'status' => $_POST['req_action'] == 'approve' ? 1 : 2, // 1 = approved, 2 = rejected |
| 520 | 537 | 'id_member_acted' => $user_info['id'], |
@@ -522,6 +539,7 @@ discard block |
||
| 522 | 539 | 'time_acted' => time(), |
| 523 | 540 | 'act_reason' => $_POST['req_action'] != 'approve' && !empty($_POST['groupreason']) && !empty($_POST['groupreason'][$row['id_request']]) ? $smcFunc['htmlspecialchars']($_POST['groupreason'][$row['id_request']], ENT_QUOTES) : '', |
| 524 | 541 | ); |
| 542 | + } |
|
| 525 | 543 | $request_list[] = $row['id_request']; |
| 526 | 544 | } |
| 527 | 545 | $smcFunc['db_free_result']($request); |
@@ -744,21 +762,24 @@ discard block |
||
| 744 | 762 | $group_requests = array(); |
| 745 | 763 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
| 746 | 764 | { |
| 747 | - if (empty($row['reason'])) |
|
| 748 | - $reason = '<em>(' . $txt['mc_groupr_no_reason'] . ')</em>'; |
|
| 749 | - else |
|
| 750 | - $reason = censorText($row['reason']); |
|
| 765 | + if (empty($row['reason'])) { |
|
| 766 | + $reason = '<em>(' . $txt['mc_groupr_no_reason'] . ')</em>'; |
|
| 767 | + } else { |
|
| 768 | + $reason = censorText($row['reason']); |
|
| 769 | + } |
|
| 751 | 770 | |
| 752 | 771 | if (isset($_GET['closed'])) |
| 753 | 772 | { |
| 754 | - if ($row['status'] == 1) |
|
| 755 | - $reason .= '<br><br><strong>' . $txt['mc_groupr_approved'] . '</strong>'; |
|
| 756 | - elseif ($row['status'] == 2) |
|
| 757 | - $reason .= '<br><br><strong>' . $txt['mc_groupr_rejected'] . '</strong>'; |
|
| 773 | + if ($row['status'] == 1) { |
|
| 774 | + $reason .= '<br><br><strong>' . $txt['mc_groupr_approved'] . '</strong>'; |
|
| 775 | + } elseif ($row['status'] == 2) { |
|
| 776 | + $reason .= '<br><br><strong>' . $txt['mc_groupr_rejected'] . '</strong>'; |
|
| 777 | + } |
|
| 758 | 778 | |
| 759 | 779 | $reason .= ' (' . timeformat($row['time_acted']) . ')'; |
| 760 | - if (!empty($row['act_reason'])) |
|
| 761 | - $reason .= '<br><br>' . censorText($row['act_reason']); |
|
| 780 | + if (!empty($row['act_reason'])) { |
|
| 781 | + $reason .= '<br><br>' . censorText($row['act_reason']); |
|
| 782 | + } |
|
| 762 | 783 | } |
| 763 | 784 | |
| 764 | 785 | $group_requests[] = array( |
@@ -13,8 +13,9 @@ discard block |
||
| 13 | 13 | * @version 2.1 Beta 4 |
| 14 | 14 | */ |
| 15 | 15 | |
| 16 | -if (!defined('SMF')) |
|
| 16 | +if (!defined('SMF')) { |
|
| 17 | 17 | die('No direct access...'); |
| 18 | +} |
|
| 18 | 19 | |
| 19 | 20 | /** |
| 20 | 21 | * The news dispatcher; doesn't do anything, just delegates. |
@@ -67,8 +68,9 @@ discard block |
||
| 67 | 68 | ); |
| 68 | 69 | |
| 69 | 70 | // Force the right area... |
| 70 | - if (substr($_REQUEST['sa'], 0, 7) == 'mailing') |
|
| 71 | - $context[$context['admin_menu_name']]['current_subsection'] = 'mailingmembers'; |
|
| 71 | + if (substr($_REQUEST['sa'], 0, 7) == 'mailing') { |
|
| 72 | + $context[$context['admin_menu_name']]['current_subsection'] = 'mailingmembers'; |
|
| 73 | + } |
|
| 72 | 74 | |
| 73 | 75 | call_helper($subActions[$_REQUEST['sa']][0]); |
| 74 | 76 | } |
@@ -99,9 +101,10 @@ discard block |
||
| 99 | 101 | $temp_news = explode("\n", $modSettings['news']); |
| 100 | 102 | |
| 101 | 103 | // Remove the items that were selected. |
| 102 | - foreach ($temp_news as $i => $news) |
|
| 103 | - if (in_array($i, $_POST['remove'])) |
|
| 104 | + foreach ($temp_news as $i => $news) { |
|
| 105 | + if (in_array($i, $_POST['remove'])) |
|
| 104 | 106 | unset($temp_news[$i]); |
| 107 | + } |
|
| 105 | 108 | |
| 106 | 109 | // Update the database. |
| 107 | 110 | updateSettings(array('news' => implode("\n", $temp_news))); |
@@ -117,9 +120,9 @@ discard block |
||
| 117 | 120 | |
| 118 | 121 | foreach ($_POST['news'] as $i => $news) |
| 119 | 122 | { |
| 120 | - if (trim($news) == '') |
|
| 121 | - unset($_POST['news'][$i]); |
|
| 122 | - else |
|
| 123 | + if (trim($news) == '') { |
|
| 124 | + unset($_POST['news'][$i]); |
|
| 125 | + } else |
|
| 123 | 126 | { |
| 124 | 127 | $_POST['news'][$i] = $smcFunc['htmlspecialchars']($_POST['news'][$i], ENT_QUOTES); |
| 125 | 128 | preparsecode($_POST['news'][$i]); |
@@ -154,11 +157,12 @@ discard block |
||
| 154 | 157 | 'data' => array( |
| 155 | 158 | 'function' => function($news) |
| 156 | 159 | { |
| 157 | - if (is_numeric($news['id'])) |
|
| 158 | - return '<textarea id="data_' . $news['id'] . '" rows="3" cols="50" name="news[]" class="padding block">' . $news['unparsed'] . '</textarea> |
|
| 160 | + if (is_numeric($news['id'])) { |
|
| 161 | + return '<textarea id="data_' . $news['id'] . '" rows="3" cols="50" name="news[]" class="padding block">' . $news['unparsed'] . '</textarea> |
|
| 159 | 162 | <div class="floatleft" id="preview_' . $news['id'] . '"></div>'; |
| 160 | - else |
|
| 161 | - return $news['unparsed']; |
|
| 163 | + } else { |
|
| 164 | + return $news['unparsed']; |
|
| 165 | + } |
|
| 162 | 166 | }, |
| 163 | 167 | 'style' => 'width: 50%;', |
| 164 | 168 | ), |
@@ -183,10 +187,11 @@ discard block |
||
| 183 | 187 | 'data' => array( |
| 184 | 188 | 'function' => function($news) |
| 185 | 189 | { |
| 186 | - if (is_numeric($news['id'])) |
|
| 187 | - return '<input type="checkbox" name="remove[]" value="' . $news['id'] . '" class="input_check">'; |
|
| 188 | - else |
|
| 189 | - return ''; |
|
| 190 | + if (is_numeric($news['id'])) { |
|
| 191 | + return '<input type="checkbox" name="remove[]" value="' . $news['id'] . '" class="input_check">'; |
|
| 192 | + } else { |
|
| 193 | + return ''; |
|
| 194 | + } |
|
| 190 | 195 | }, |
| 191 | 196 | 'class' => 'centercol', |
| 192 | 197 | ), |
@@ -280,12 +285,13 @@ discard block |
||
| 280 | 285 | |
| 281 | 286 | $admin_current_news = array(); |
| 282 | 287 | // Ready the current news. |
| 283 | - foreach (explode("\n", $modSettings['news']) as $id => $line) |
|
| 284 | - $admin_current_news[$id] = array( |
|
| 288 | + foreach (explode("\n", $modSettings['news']) as $id => $line) { |
|
| 289 | + $admin_current_news[$id] = array( |
|
| 285 | 290 | 'id' => $id, |
| 286 | 291 | 'unparsed' => un_preparsecode($line), |
| 287 | 292 | 'parsed' => preg_replace('~<([/]?)form[^>]*?[>]*>~i', '<em class="smalltext"><$1form></em>', parse_bbc($line)), |
| 288 | 293 | ); |
| 294 | + } |
|
| 289 | 295 | |
| 290 | 296 | $admin_current_news['last'] = array( |
| 291 | 297 | 'id' => 'last', |
@@ -352,10 +358,11 @@ discard block |
||
| 352 | 358 | 'member_count' => 0, |
| 353 | 359 | ); |
| 354 | 360 | |
| 355 | - if ($row['min_posts'] == -1) |
|
| 356 | - $normalGroups[$row['id_group']] = $row['id_group']; |
|
| 357 | - else |
|
| 358 | - $postGroups[$row['id_group']] = $row['id_group']; |
|
| 361 | + if ($row['min_posts'] == -1) { |
|
| 362 | + $normalGroups[$row['id_group']] = $row['id_group']; |
|
| 363 | + } else { |
|
| 364 | + $postGroups[$row['id_group']] = $row['id_group']; |
|
| 365 | + } |
|
| 359 | 366 | } |
| 360 | 367 | $smcFunc['db_free_result']($request); |
| 361 | 368 | |
@@ -371,8 +378,9 @@ discard block |
||
| 371 | 378 | 'post_group_list' => $postGroups, |
| 372 | 379 | ) |
| 373 | 380 | ); |
| 374 | - while ($row = $smcFunc['db_fetch_assoc']($query)) |
|
| 375 | - $context['groups'][$row['id_group']]['member_count'] += $row['member_count']; |
|
| 381 | + while ($row = $smcFunc['db_fetch_assoc']($query)) { |
|
| 382 | + $context['groups'][$row['id_group']]['member_count'] += $row['member_count']; |
|
| 383 | + } |
|
| 376 | 384 | $smcFunc['db_free_result']($query); |
| 377 | 385 | } |
| 378 | 386 | |
@@ -388,8 +396,9 @@ discard block |
||
| 388 | 396 | 'normal_group_list' => $normalGroups, |
| 389 | 397 | ) |
| 390 | 398 | ); |
| 391 | - while ($row = $smcFunc['db_fetch_assoc']($query)) |
|
| 392 | - $context['groups'][$row['id_group']]['member_count'] += $row['member_count']; |
|
| 399 | + while ($row = $smcFunc['db_fetch_assoc']($query)) { |
|
| 400 | + $context['groups'][$row['id_group']]['member_count'] += $row['member_count']; |
|
| 401 | + } |
|
| 393 | 402 | $smcFunc['db_free_result']($query); |
| 394 | 403 | |
| 395 | 404 | // Also do those who have it as an additional membergroup - this ones more yucky... |
@@ -406,8 +415,9 @@ discard block |
||
| 406 | 415 | 'blank_string' => '', |
| 407 | 416 | ) |
| 408 | 417 | ); |
| 409 | - while ($row = $smcFunc['db_fetch_assoc']($query)) |
|
| 410 | - $context['groups'][$row['id_group']]['member_count'] += $row['member_count']; |
|
| 418 | + while ($row = $smcFunc['db_fetch_assoc']($query)) { |
|
| 419 | + $context['groups'][$row['id_group']]['member_count'] += $row['member_count']; |
|
| 420 | + } |
|
| 411 | 421 | $smcFunc['db_free_result']($query); |
| 412 | 422 | } |
| 413 | 423 | |
@@ -458,10 +468,11 @@ discard block |
||
| 458 | 468 | { |
| 459 | 469 | $context[$key] = !empty($_REQUEST[$post]) ? $_REQUEST[$post] : ''; |
| 460 | 470 | |
| 461 | - if (empty($context[$key]) && empty($_REQUEST['xml'])) |
|
| 462 | - $context['post_error']['messages'][] = $txt['error_no_' . $post]; |
|
| 463 | - elseif (!empty($_REQUEST['xml'])) |
|
| 464 | - continue; |
|
| 471 | + if (empty($context[$key]) && empty($_REQUEST['xml'])) { |
|
| 472 | + $context['post_error']['messages'][] = $txt['error_no_' . $post]; |
|
| 473 | + } elseif (!empty($_REQUEST['xml'])) { |
|
| 474 | + continue; |
|
| 475 | + } |
|
| 465 | 476 | |
| 466 | 477 | preparsecode($context[$key]); |
| 467 | 478 | if ($html) |
@@ -540,10 +551,12 @@ discard block |
||
| 540 | 551 | |
| 541 | 552 | // Start by finding any members! |
| 542 | 553 | $toClean = array(); |
| 543 | - if (!empty($_POST['members'])) |
|
| 544 | - $toClean[] = 'members'; |
|
| 545 | - if (!empty($_POST['exclude_members'])) |
|
| 546 | - $toClean[] = 'exclude_members'; |
|
| 554 | + if (!empty($_POST['members'])) { |
|
| 555 | + $toClean[] = 'members'; |
|
| 556 | + } |
|
| 557 | + if (!empty($_POST['exclude_members'])) { |
|
| 558 | + $toClean[] = 'exclude_members'; |
|
| 559 | + } |
|
| 547 | 560 | if (!empty($toClean)) |
| 548 | 561 | { |
| 549 | 562 | require_once($sourcedir . '/Subs-Auth.php'); |
@@ -555,11 +568,13 @@ discard block |
||
| 555 | 568 | preg_match_all('~"([^"]+)"~', $_POST[$type], $matches); |
| 556 | 569 | $_POST[$type] = array_unique(array_merge($matches[1], explode(',', preg_replace('~"[^"]+"~', '', $_POST[$type])))); |
| 557 | 570 | |
| 558 | - foreach ($_POST[$type] as $index => $member) |
|
| 559 | - if (strlen(trim($member)) > 0) |
|
| 571 | + foreach ($_POST[$type] as $index => $member) { |
|
| 572 | + if (strlen(trim($member)) > 0) |
|
| 560 | 573 | $_POST[$type][$index] = $smcFunc['htmlspecialchars']($smcFunc['strtolower'](trim($member))); |
| 561 | - else |
|
| 562 | - unset($_POST[$type][$index]); |
|
| 574 | + } |
|
| 575 | + else { |
|
| 576 | + unset($_POST[$type][$index]); |
|
| 577 | + } |
|
| 563 | 578 | |
| 564 | 579 | // Find the members |
| 565 | 580 | $_POST[$type] = implode(',', array_keys(findMembers($_POST[$type]))); |
@@ -569,16 +584,18 @@ discard block |
||
| 569 | 584 | if (isset($_POST['member_list']) && is_array($_POST['member_list'])) |
| 570 | 585 | { |
| 571 | 586 | $members = array(); |
| 572 | - foreach ($_POST['member_list'] as $member_id) |
|
| 573 | - $members[] = (int) $member_id; |
|
| 587 | + foreach ($_POST['member_list'] as $member_id) { |
|
| 588 | + $members[] = (int) $member_id; |
|
| 589 | + } |
|
| 574 | 590 | $_POST['members'] = implode(',', $members); |
| 575 | 591 | } |
| 576 | 592 | |
| 577 | 593 | if (isset($_POST['exclude_member_list']) && is_array($_POST['exclude_member_list'])) |
| 578 | 594 | { |
| 579 | 595 | $members = array(); |
| 580 | - foreach ($_POST['exclude_member_list'] as $member_id) |
|
| 581 | - $members[] = (int) $member_id; |
|
| 596 | + foreach ($_POST['exclude_member_list'] as $member_id) { |
|
| 597 | + $members[] = (int) $member_id; |
|
| 598 | + } |
|
| 582 | 599 | $_POST['exclude_members'] = implode(',', $members); |
| 583 | 600 | } |
| 584 | 601 | |
@@ -602,8 +619,9 @@ discard block |
||
| 602 | 619 | 'current_time' => time(), |
| 603 | 620 | ) |
| 604 | 621 | ); |
| 605 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 606 | - $context['recipients']['exclude_members'][] = $row['id_member']; |
|
| 622 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 623 | + $context['recipients']['exclude_members'][] = $row['id_member']; |
|
| 624 | + } |
|
| 607 | 625 | $smcFunc['db_free_result']($request); |
| 608 | 626 | |
| 609 | 627 | $request = $smcFunc['db_query']('', ' |
@@ -638,8 +656,9 @@ discard block |
||
| 638 | 656 | WHERE email_address IN(' . implode(', ', $condition_array) . ')', |
| 639 | 657 | $condition_array_params |
| 640 | 658 | ); |
| 641 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 642 | - $context['recipients']['exclude_members'][] = $row['id_member']; |
|
| 659 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 660 | + $context['recipients']['exclude_members'][] = $row['id_member']; |
|
| 661 | + } |
|
| 643 | 662 | $smcFunc['db_free_result']($request); |
| 644 | 663 | } |
| 645 | 664 | |
@@ -657,10 +676,11 @@ discard block |
||
| 657 | 676 | ); |
| 658 | 677 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
| 659 | 678 | { |
| 660 | - if (in_array(3, $context['recipients'])) |
|
| 661 | - $context['recipients']['exclude_members'][] = $row['identifier']; |
|
| 662 | - else |
|
| 663 | - $context['recipients']['members'][] = $row['identifier']; |
|
| 679 | + if (in_array(3, $context['recipients'])) { |
|
| 680 | + $context['recipients']['exclude_members'][] = $row['identifier']; |
|
| 681 | + } else { |
|
| 682 | + $context['recipients']['members'][] = $row['identifier']; |
|
| 683 | + } |
|
| 664 | 684 | } |
| 665 | 685 | $smcFunc['db_free_result']($request); |
| 666 | 686 | } |
@@ -707,8 +727,9 @@ discard block |
||
| 707 | 727 | $num_at_once = 1000; |
| 708 | 728 | |
| 709 | 729 | // If by PM's I suggest we half the above number. |
| 710 | - if (!empty($_POST['send_pm'])) |
|
| 711 | - $num_at_once /= 2; |
|
| 730 | + if (!empty($_POST['send_pm'])) { |
|
| 731 | + $num_at_once /= 2; |
|
| 732 | + } |
|
| 712 | 733 | |
| 713 | 734 | checkSession(); |
| 714 | 735 | |
@@ -731,8 +752,7 @@ discard block |
||
| 731 | 752 | ); |
| 732 | 753 | list ($context['total_members']) = $smcFunc['db_fetch_row']($request); |
| 733 | 754 | $smcFunc['db_free_result']($request); |
| 734 | - } |
|
| 735 | - else |
|
| 755 | + } else |
|
| 736 | 756 | { |
| 737 | 757 | $context['total_members'] = (int) $_REQUEST['total_members']; |
| 738 | 758 | } |
@@ -750,32 +770,35 @@ discard block |
||
| 750 | 770 | if (!empty($_POST['exclude_members'])) |
| 751 | 771 | { |
| 752 | 772 | $members = explode(',', $_POST['exclude_members']); |
| 753 | - foreach ($members as $member) |
|
| 754 | - if ($member >= $context['start']) |
|
| 773 | + foreach ($members as $member) { |
|
| 774 | + if ($member >= $context['start']) |
|
| 755 | 775 | $context['recipients']['exclude_members'][] = (int) $member; |
| 776 | + } |
|
| 756 | 777 | } |
| 757 | 778 | |
| 758 | 779 | // What about members we *must* do? |
| 759 | 780 | if (!empty($_POST['members'])) |
| 760 | 781 | { |
| 761 | 782 | $members = explode(',', $_POST['members']); |
| 762 | - foreach ($members as $member) |
|
| 763 | - if ($member >= $context['start']) |
|
| 783 | + foreach ($members as $member) { |
|
| 784 | + if ($member >= $context['start']) |
|
| 764 | 785 | $context['recipients']['members'][] = (int) $member; |
| 786 | + } |
|
| 765 | 787 | } |
| 766 | 788 | // Cleaning groups is simple - although deal with both checkbox and commas. |
| 767 | 789 | if (isset($_POST['groups'])) |
| 768 | 790 | { |
| 769 | 791 | if (is_array($_POST['groups'])) |
| 770 | 792 | { |
| 771 | - foreach ($_POST['groups'] as $group => $dummy) |
|
| 772 | - $context['recipients']['groups'][] = (int) $group; |
|
| 773 | - } |
|
| 774 | - else |
|
| 793 | + foreach ($_POST['groups'] as $group => $dummy) { |
|
| 794 | + $context['recipients']['groups'][] = (int) $group; |
|
| 795 | + } |
|
| 796 | + } else |
|
| 775 | 797 | { |
| 776 | 798 | $groups = explode(',', $_POST['groups']); |
| 777 | - foreach ($groups as $group) |
|
| 778 | - $context['recipients']['groups'][] = (int) $group; |
|
| 799 | + foreach ($groups as $group) { |
|
| 800 | + $context['recipients']['groups'][] = (int) $group; |
|
| 801 | + } |
|
| 779 | 802 | } |
| 780 | 803 | } |
| 781 | 804 | // Same for excluded groups |
@@ -783,15 +806,17 @@ discard block |
||
| 783 | 806 | { |
| 784 | 807 | if (is_array($_POST['exclude_groups'])) |
| 785 | 808 | { |
| 786 | - foreach ($_POST['exclude_groups'] as $group => $dummy) |
|
| 787 | - $context['recipients']['exclude_groups'][] = (int) $group; |
|
| 809 | + foreach ($_POST['exclude_groups'] as $group => $dummy) { |
|
| 810 | + $context['recipients']['exclude_groups'][] = (int) $group; |
|
| 811 | + } |
|
| 788 | 812 | } |
| 789 | 813 | // Ignore an empty string - we don't want to exclude "Regular Members" unless it's specifically selected |
| 790 | 814 | elseif ($_POST['exclude_groups'] != '') |
| 791 | 815 | { |
| 792 | 816 | $groups = explode(',', $_POST['exclude_groups']); |
| 793 | - foreach ($groups as $group) |
|
| 794 | - $context['recipients']['exclude_groups'][] = (int) $group; |
|
| 817 | + foreach ($groups as $group) { |
|
| 818 | + $context['recipients']['exclude_groups'][] = (int) $group; |
|
| 819 | + } |
|
| 795 | 820 | } |
| 796 | 821 | } |
| 797 | 822 | // Finally - emails! |
@@ -801,14 +826,16 @@ discard block |
||
| 801 | 826 | foreach ($addressed as $curmem) |
| 802 | 827 | { |
| 803 | 828 | $curmem = trim($curmem); |
| 804 | - if ($curmem != '' && filter_var($curmem, FILTER_VALIDATE_EMAIL)) |
|
| 805 | - $context['recipients']['emails'][$curmem] = $curmem; |
|
| 829 | + if ($curmem != '' && filter_var($curmem, FILTER_VALIDATE_EMAIL)) { |
|
| 830 | + $context['recipients']['emails'][$curmem] = $curmem; |
|
| 831 | + } |
|
| 806 | 832 | } |
| 807 | 833 | } |
| 808 | 834 | |
| 809 | 835 | // If we're only cleaning drop out here. |
| 810 | - if ($clean_only) |
|
| 811 | - return; |
|
| 836 | + if ($clean_only) { |
|
| 837 | + return; |
|
| 838 | + } |
|
| 812 | 839 | |
| 813 | 840 | require_once($sourcedir . '/Subs-Post.php'); |
| 814 | 841 | |
@@ -824,16 +851,18 @@ discard block |
||
| 824 | 851 | if (!$context['send_pm'] && !empty($_POST['send_html'])) |
| 825 | 852 | { |
| 826 | 853 | // Prepare the message for HTML. |
| 827 | - if (!empty($_POST['parse_html'])) |
|
| 828 | - $_POST['message'] = str_replace(array("\n", ' '), array('<br>' . "\n", ' '), $_POST['message']); |
|
| 854 | + if (!empty($_POST['parse_html'])) { |
|
| 855 | + $_POST['message'] = str_replace(array("\n", ' '), array('<br>' . "\n", ' '), $_POST['message']); |
|
| 856 | + } |
|
| 829 | 857 | |
| 830 | 858 | // This is here to prevent spam filters from tagging this as spam. |
| 831 | 859 | if (preg_match('~\<html~i', $_POST['message']) == 0) |
| 832 | 860 | { |
| 833 | - if (preg_match('~\<body~i', $_POST['message']) == 0) |
|
| 834 | - $_POST['message'] = '<html><head><title>' . $_POST['subject'] . '</title></head>' . "\n" . '<body>' . $_POST['message'] . '</body></html>'; |
|
| 835 | - else |
|
| 836 | - $_POST['message'] = '<html>' . $_POST['message'] . '</html>'; |
|
| 861 | + if (preg_match('~\<body~i', $_POST['message']) == 0) { |
|
| 862 | + $_POST['message'] = '<html><head><title>' . $_POST['subject'] . '</title></head>' . "\n" . '<body>' . $_POST['message'] . '</body></html>'; |
|
| 863 | + } else { |
|
| 864 | + $_POST['message'] = '<html>' . $_POST['message'] . '</html>'; |
|
| 865 | + } |
|
| 837 | 866 | } |
| 838 | 867 | } |
| 839 | 868 | |
@@ -887,15 +916,17 @@ discard block |
||
| 887 | 916 | foreach ($context['recipients']['emails'] as $k => $email) |
| 888 | 917 | { |
| 889 | 918 | // Done as many as we can? |
| 890 | - if ($i >= $num_at_once) |
|
| 891 | - break; |
|
| 919 | + if ($i >= $num_at_once) { |
|
| 920 | + break; |
|
| 921 | + } |
|
| 892 | 922 | |
| 893 | 923 | // Don't sent it twice! |
| 894 | 924 | unset($context['recipients']['emails'][$k]); |
| 895 | 925 | |
| 896 | 926 | // Dammit - can't PM emails! |
| 897 | - if ($context['send_pm']) |
|
| 898 | - continue; |
|
| 927 | + if ($context['send_pm']) { |
|
| 928 | + continue; |
|
| 929 | + } |
|
| 899 | 930 | |
| 900 | 931 | $to_member = array( |
| 901 | 932 | $email, |
@@ -929,8 +960,9 @@ discard block |
||
| 929 | 960 | $queryBuild[] = 'mem.id_post_group = {int:group_' . $group . '}'; |
| 930 | 961 | } |
| 931 | 962 | } |
| 932 | - if (!empty($queryBuild)) |
|
| 933 | - $sendQuery .= implode(' OR ', $queryBuild); |
|
| 963 | + if (!empty($queryBuild)) { |
|
| 964 | + $sendQuery .= implode(' OR ', $queryBuild); |
|
| 965 | + } |
|
| 934 | 966 | } |
| 935 | 967 | if (!empty($context['recipients']['members'])) |
| 936 | 968 | { |
@@ -949,8 +981,9 @@ discard block |
||
| 949 | 981 | } |
| 950 | 982 | |
| 951 | 983 | // Anything to exclude? |
| 952 | - if (!empty($context['recipients']['exclude_groups']) && in_array(0, $context['recipients']['exclude_groups'])) |
|
| 953 | - $sendQuery .= ' AND mem.id_group != {int:regular_group}'; |
|
| 984 | + if (!empty($context['recipients']['exclude_groups']) && in_array(0, $context['recipients']['exclude_groups'])) { |
|
| 985 | + $sendQuery .= ' AND mem.id_group != {int:regular_group}'; |
|
| 986 | + } |
|
| 954 | 987 | if (!empty($context['recipients']['exclude_members'])) |
| 955 | 988 | { |
| 956 | 989 | $sendQuery .= ' AND mem.id_member NOT IN ({array_int:exclude_members})'; |
@@ -986,21 +1019,24 @@ discard block |
||
| 986 | 1019 | foreach ($rows as $row) |
| 987 | 1020 | { |
| 988 | 1021 | // Force them to have it? |
| 989 | - if (empty($context['email_force']) && empty($prefs[$row['id_member']]['announcements'])) |
|
| 990 | - continue; |
|
| 1022 | + if (empty($context['email_force']) && empty($prefs[$row['id_member']]['announcements'])) { |
|
| 1023 | + continue; |
|
| 1024 | + } |
|
| 991 | 1025 | |
| 992 | 1026 | // What groups are we looking at here? |
| 993 | - if (empty($row['additional_groups'])) |
|
| 994 | - $groups = array($row['id_group'], $row['id_post_group']); |
|
| 995 | - else |
|
| 996 | - $groups = array_merge( |
|
| 1027 | + if (empty($row['additional_groups'])) { |
|
| 1028 | + $groups = array($row['id_group'], $row['id_post_group']); |
|
| 1029 | + } else { |
|
| 1030 | + $groups = array_merge( |
|
| 997 | 1031 | array($row['id_group'], $row['id_post_group']), |
| 998 | 1032 | explode(',', $row['additional_groups']) |
| 999 | 1033 | ); |
| 1034 | + } |
|
| 1000 | 1035 | |
| 1001 | 1036 | // Excluded groups? |
| 1002 | - if (array_intersect($groups, $context['recipients']['exclude_groups'])) |
|
| 1003 | - continue; |
|
| 1037 | + if (array_intersect($groups, $context['recipients']['exclude_groups'])) { |
|
| 1038 | + continue; |
|
| 1039 | + } |
|
| 1004 | 1040 | |
| 1005 | 1041 | // We might need this |
| 1006 | 1042 | $cleanMemberName = empty($_POST['send_html']) || $context['send_pm'] ? un_htmlspecialchars($row['real_name']) : $row['real_name']; |
@@ -1023,10 +1059,11 @@ discard block |
||
| 1023 | 1059 | ), $_POST['subject']); |
| 1024 | 1060 | |
| 1025 | 1061 | // Send the actual email - or a PM! |
| 1026 | - if (!$context['send_pm']) |
|
| 1027 | - sendmail($row['email_address'], $subject, $message, null, 'news', !empty($_POST['send_html']), 5); |
|
| 1028 | - else |
|
| 1029 | - sendpm(array('to' => array($row['id_member']), 'bcc' => array()), $subject, $message); |
|
| 1062 | + if (!$context['send_pm']) { |
|
| 1063 | + sendmail($row['email_address'], $subject, $message, null, 'news', !empty($_POST['send_html']), 5); |
|
| 1064 | + } else { |
|
| 1065 | + sendpm(array('to' => array($row['id_member']), 'bcc' => array()), $subject, $message); |
|
| 1066 | + } |
|
| 1030 | 1067 | } |
| 1031 | 1068 | } |
| 1032 | 1069 | |
@@ -1076,8 +1113,9 @@ discard block |
||
| 1076 | 1113 | |
| 1077 | 1114 | call_integration_hook('integrate_modify_news_settings', array(&$config_vars)); |
| 1078 | 1115 | |
| 1079 | - if ($return_config) |
|
| 1080 | - return $config_vars; |
|
| 1116 | + if ($return_config) { |
|
| 1117 | + return $config_vars; |
|
| 1118 | + } |
|
| 1081 | 1119 | |
| 1082 | 1120 | $context['page_title'] = $txt['admin_edit_news'] . ' - ' . $txt['settings']; |
| 1083 | 1121 | $context['sub_template'] = 'show_settings'; |
@@ -11,8 +11,9 @@ discard block |
||
| 11 | 11 | * @version 2.1 Beta 4 |
| 12 | 12 | */ |
| 13 | 13 | |
| 14 | -if (!defined('SMF')) |
|
| 14 | +if (!defined('SMF')) { |
|
| 15 | 15 | die('No direct access...'); |
| 16 | +} |
|
| 16 | 17 | |
| 17 | 18 | /** |
| 18 | 19 | * Generates the query to determine the list of available boards for a user |
@@ -25,8 +26,9 @@ discard block |
||
| 25 | 26 | { |
| 26 | 27 | global $smcFunc, $sourcedir; |
| 27 | 28 | |
| 28 | - if (isset($boardListOptions['excluded_boards']) && isset($boardListOptions['included_boards'])) |
|
| 29 | - trigger_error('getBoardList(): Setting both excluded_boards and included_boards is not allowed.', E_USER_ERROR); |
|
| 29 | + if (isset($boardListOptions['excluded_boards']) && isset($boardListOptions['included_boards'])) { |
|
| 30 | + trigger_error('getBoardList(): Setting both excluded_boards and included_boards is not allowed.', E_USER_ERROR); |
|
| 31 | + } |
|
| 30 | 32 | |
| 31 | 33 | $where = array(); |
| 32 | 34 | $where_parameters = array(); |
@@ -42,11 +44,11 @@ discard block |
||
| 42 | 44 | $where_parameters['included_boards'] = $boardListOptions['included_boards']; |
| 43 | 45 | } |
| 44 | 46 | |
| 45 | - if (!empty($boardListOptions['ignore_boards'])) |
|
| 46 | - $where[] = '{query_wanna_see_board}'; |
|
| 47 | - |
|
| 48 | - elseif (!empty($boardListOptions['use_permissions'])) |
|
| 49 | - $where[] = '{query_see_board}'; |
|
| 47 | + if (!empty($boardListOptions['ignore_boards'])) { |
|
| 48 | + $where[] = '{query_wanna_see_board}'; |
|
| 49 | + } elseif (!empty($boardListOptions['use_permissions'])) { |
|
| 50 | + $where[] = '{query_see_board}'; |
|
| 51 | + } |
|
| 50 | 52 | |
| 51 | 53 | if (!empty($boardListOptions['not_redirection'])) |
| 52 | 54 | { |
@@ -68,12 +70,13 @@ discard block |
||
| 68 | 70 | { |
| 69 | 71 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
| 70 | 72 | { |
| 71 | - if (!isset($return_value[$row['id_cat']])) |
|
| 72 | - $return_value[$row['id_cat']] = array( |
|
| 73 | + if (!isset($return_value[$row['id_cat']])) { |
|
| 74 | + $return_value[$row['id_cat']] = array( |
|
| 73 | 75 | 'id' => $row['id_cat'], |
| 74 | 76 | 'name' => $row['cat_name'], |
| 75 | 77 | 'boards' => array(), |
| 76 | 78 | ); |
| 79 | + } |
|
| 77 | 80 | |
| 78 | 81 | $return_value[$row['id_cat']]['boards'][$row['id_board']] = array( |
| 79 | 82 | 'id' => $row['id_board'], |
@@ -11,8 +11,9 @@ discard block |
||
| 11 | 11 | * @version 2.1 Beta 4 |
| 12 | 12 | */ |
| 13 | 13 | |
| 14 | -if (!defined('SMF')) |
|
| 14 | +if (!defined('SMF')) { |
|
| 15 | 15 | die('Hacking attempt...'); |
| 16 | +} |
|
| 16 | 17 | |
| 17 | 18 | /** |
| 18 | 19 | * Interface cache_api_interface |
@@ -183,8 +184,9 @@ discard block |
||
| 183 | 184 | { |
| 184 | 185 | global $cache_enable; |
| 185 | 186 | |
| 186 | - if ($test) |
|
| 187 | - return true; |
|
| 187 | + if ($test) { |
|
| 188 | + return true; |
|
| 189 | + } |
|
| 188 | 190 | return !empty($cache_enable); |
| 189 | 191 | } |
| 190 | 192 | |
@@ -203,10 +205,11 @@ discard block |
||
| 203 | 205 | global $boardurl, $cachedir; |
| 204 | 206 | |
| 205 | 207 | // Set the default if no prefix was specified. |
| 206 | - if (empty($prefix)) |
|
| 207 | - $this->prefix = md5($boardurl . filemtime($cachedir . '/' . 'index.php')) . '-SMF-'; |
|
| 208 | - else |
|
| 209 | - $this->prefix = $prefix; |
|
| 208 | + if (empty($prefix)) { |
|
| 209 | + $this->prefix = md5($boardurl . filemtime($cachedir . '/' . 'index.php')) . '-SMF-'; |
|
| 210 | + } else { |
|
| 211 | + $this->prefix = $prefix; |
|
| 212 | + } |
|
| 210 | 213 | |
| 211 | 214 | return true; |
| 212 | 215 | } |
@@ -269,8 +272,9 @@ discard block |
||
| 269 | 272 | |
| 270 | 273 | // Invalidate cache, to be sure! |
| 271 | 274 | // ... as long as index.php can be modified, anyway. |
| 272 | - if (is_writable($cachedir . '/' . 'index.php')) |
|
| 273 | - @touch($cachedir . '/' . 'index.php'); |
|
| 275 | + if (is_writable($cachedir . '/' . 'index.php')) { |
|
| 276 | + @touch($cachedir . '/' . 'index.php'); |
|
| 277 | + } |
|
| 274 | 278 | |
| 275 | 279 | return true; |
| 276 | 280 | } |
@@ -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 this section. |
@@ -38,8 +39,7 @@ discard block |
||
| 38 | 39 | 'stats' => 'SpiderStats', |
| 39 | 40 | ); |
| 40 | 41 | $default = 'stats'; |
| 41 | - } |
|
| 42 | - else |
|
| 42 | + } else |
|
| 43 | 43 | { |
| 44 | 44 | $subActions = array( |
| 45 | 45 | 'settings' => 'ManageSearchEngineSettings', |
@@ -90,11 +90,12 @@ discard block |
||
| 90 | 90 | { |
| 91 | 91 | disabledState = document.getElementById(\'spider_mode\').value == 0;'; |
| 92 | 92 | |
| 93 | - foreach ($config_vars as $variable) |
|
| 94 | - if ($variable[1] != 'spider_mode') |
|
| 93 | + foreach ($config_vars as $variable) { |
|
| 94 | + if ($variable[1] != 'spider_mode') |
|
| 95 | 95 | $javascript_function .= ' |
| 96 | 96 | if (document.getElementById(\'' . $variable[1] . '\')) |
| 97 | 97 | document.getElementById(\'' . $variable[1] . '\').disabled = disabledState;'; |
| 98 | + } |
|
| 98 | 99 | |
| 99 | 100 | $javascript_function .= ' |
| 100 | 101 | } |
@@ -102,8 +103,9 @@ discard block |
||
| 102 | 103 | |
| 103 | 104 | call_integration_hook('integrate_modify_search_engine_settings', array(&$config_vars)); |
| 104 | 105 | |
| 105 | - if ($return_config) |
|
| 106 | - return $config_vars; |
|
| 106 | + if ($return_config) { |
|
| 107 | + return $config_vars; |
|
| 108 | + } |
|
| 107 | 109 | |
| 108 | 110 | // We need to load the groups for the spider group thingy. |
| 109 | 111 | $request = $smcFunc['db_query']('', ' |
@@ -116,13 +118,15 @@ discard block |
||
| 116 | 118 | 'moderator_group' => 3, |
| 117 | 119 | ) |
| 118 | 120 | ); |
| 119 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 120 | - $config_vars['spider_group'][2][$row['id_group']] = $row['group_name']; |
|
| 121 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 122 | + $config_vars['spider_group'][2][$row['id_group']] = $row['group_name']; |
|
| 123 | + } |
|
| 121 | 124 | $smcFunc['db_free_result']($request); |
| 122 | 125 | |
| 123 | 126 | // Make sure it's valid - note that regular members are given id_group = 1 which is reversed in Load.php - no admins here! |
| 124 | - if (isset($_POST['spider_group']) && !isset($config_vars['spider_group'][2][$_POST['spider_group']])) |
|
| 125 | - $_POST['spider_group'] = 0; |
|
| 127 | + if (isset($_POST['spider_group']) && !isset($config_vars['spider_group'][2][$_POST['spider_group']])) { |
|
| 128 | + $_POST['spider_group'] = 0; |
|
| 129 | + } |
|
| 126 | 130 | |
| 127 | 131 | // We'll want this for our easy save. |
| 128 | 132 | require_once($sourcedir . '/ManageServer.php'); |
@@ -166,8 +170,9 @@ discard block |
||
| 166 | 170 | } |
| 167 | 171 | |
| 168 | 172 | // Are we adding a new one? |
| 169 | - if (!empty($_POST['addSpider'])) |
|
| 170 | - return EditSpider(); |
|
| 173 | + if (!empty($_POST['addSpider'])) { |
|
| 174 | + return EditSpider(); |
|
| 175 | + } |
|
| 171 | 176 | // User pressed the 'remove selection button'. |
| 172 | 177 | elseif (!empty($_POST['removeSpiders']) && !empty($_POST['remove']) && is_array($_POST['remove'])) |
| 173 | 178 | { |
@@ -175,8 +180,9 @@ discard block |
||
| 175 | 180 | validateToken('admin-ser'); |
| 176 | 181 | |
| 177 | 182 | // Make sure every entry is a proper integer. |
| 178 | - foreach ($_POST['remove'] as $index => $spider_id) |
|
| 179 | - $_POST['remove'][(int) $index] = (int) $spider_id; |
|
| 183 | + foreach ($_POST['remove'] as $index => $spider_id) { |
|
| 184 | + $_POST['remove'][(int) $index] = (int) $spider_id; |
|
| 185 | + } |
|
| 180 | 186 | |
| 181 | 187 | // Delete them all! |
| 182 | 188 | $smcFunc['db_query']('', ' |
@@ -215,8 +221,9 @@ discard block |
||
| 215 | 221 | ); |
| 216 | 222 | |
| 217 | 223 | $context['spider_last_seen'] = array(); |
| 218 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 219 | - $context['spider_last_seen'][$row['id_spider']] = $row['last_seen_time']; |
|
| 224 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 225 | + $context['spider_last_seen'][$row['id_spider']] = $row['last_seen_time']; |
|
| 226 | + } |
|
| 220 | 227 | $smcFunc['db_free_result']($request); |
| 221 | 228 | |
| 222 | 229 | createToken('admin-ser'); |
@@ -346,8 +353,9 @@ discard block |
||
| 346 | 353 | ) |
| 347 | 354 | ); |
| 348 | 355 | $spiders = array(); |
| 349 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 350 | - $spiders[$row['id_spider']] = $row; |
|
| 356 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 357 | + $spiders[$row['id_spider']] = $row; |
|
| 358 | + } |
|
| 351 | 359 | $smcFunc['db_free_result']($request); |
| 352 | 360 | |
| 353 | 361 | return $spiders; |
@@ -397,14 +405,15 @@ discard block |
||
| 397 | 405 | foreach ($ip_sets as $set) |
| 398 | 406 | { |
| 399 | 407 | $test = ip2range(trim($set)); |
| 400 | - if (!empty($test)) |
|
| 401 | - $ips[] = $set; |
|
| 408 | + if (!empty($test)) { |
|
| 409 | + $ips[] = $set; |
|
| 410 | + } |
|
| 402 | 411 | } |
| 403 | 412 | $ips = implode(',', $ips); |
| 404 | 413 | |
| 405 | 414 | // Goes in as it is... |
| 406 | - if ($context['id_spider']) |
|
| 407 | - $smcFunc['db_query']('', ' |
|
| 415 | + if ($context['id_spider']) { |
|
| 416 | + $smcFunc['db_query']('', ' |
|
| 408 | 417 | UPDATE {db_prefix}spiders |
| 409 | 418 | SET spider_name = {string:spider_name}, user_agent = {string:spider_agent}, |
| 410 | 419 | ip_info = {string:ip_info} |
@@ -416,8 +425,8 @@ discard block |
||
| 416 | 425 | 'ip_info' => $ips, |
| 417 | 426 | ) |
| 418 | 427 | ); |
| 419 | - else |
|
| 420 | - $smcFunc['db_insert']('insert', |
|
| 428 | + } else { |
|
| 429 | + $smcFunc['db_insert']('insert', |
|
| 421 | 430 | '{db_prefix}spiders', |
| 422 | 431 | array( |
| 423 | 432 | 'spider_name' => 'string', 'user_agent' => 'string', 'ip_info' => 'string', |
@@ -427,6 +436,7 @@ discard block |
||
| 427 | 436 | ), |
| 428 | 437 | array('id_spider') |
| 429 | 438 | ); |
| 439 | + } |
|
| 430 | 440 | |
| 431 | 441 | |
| 432 | 442 | cache_put_data('spider_search', null); |
@@ -454,13 +464,14 @@ discard block |
||
| 454 | 464 | 'current_spider' => $context['id_spider'], |
| 455 | 465 | ) |
| 456 | 466 | ); |
| 457 | - if ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 458 | - $context['spider'] = array( |
|
| 467 | + if ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 468 | + $context['spider'] = array( |
|
| 459 | 469 | 'id' => $row['id_spider'], |
| 460 | 470 | 'name' => $row['spider_name'], |
| 461 | 471 | 'agent' => $row['user_agent'], |
| 462 | 472 | 'ip_info' => $row['ip_info'], |
| 463 | 473 | ); |
| 474 | + } |
|
| 464 | 475 | $smcFunc['db_free_result']($request); |
| 465 | 476 | } |
| 466 | 477 | |
@@ -477,8 +488,9 @@ discard block |
||
| 477 | 488 | { |
| 478 | 489 | global $modSettings, $smcFunc; |
| 479 | 490 | |
| 480 | - if (isset($_SESSION['id_robot'])) |
|
| 481 | - unset($_SESSION['id_robot']); |
|
| 491 | + if (isset($_SESSION['id_robot'])) { |
|
| 492 | + unset($_SESSION['id_robot']); |
|
| 493 | + } |
|
| 482 | 494 | $_SESSION['robot_check'] = time(); |
| 483 | 495 | |
| 484 | 496 | // We cache the spider data for ten minutes if we can. |
@@ -492,15 +504,17 @@ discard block |
||
| 492 | 504 | ) |
| 493 | 505 | ); |
| 494 | 506 | $spider_data = array(); |
| 495 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 496 | - $spider_data[] = $row; |
|
| 507 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 508 | + $spider_data[] = $row; |
|
| 509 | + } |
|
| 497 | 510 | $smcFunc['db_free_result']($request); |
| 498 | 511 | |
| 499 | 512 | cache_put_data('spider_search', $spider_data, 600); |
| 500 | 513 | } |
| 501 | 514 | |
| 502 | - if (empty($spider_data)) |
|
| 503 | - return false; |
|
| 515 | + if (empty($spider_data)) { |
|
| 516 | + return false; |
|
| 517 | + } |
|
| 504 | 518 | |
| 505 | 519 | // Only do these bits once. |
| 506 | 520 | $ci_user_agent = strtolower($_SERVER['HTTP_USER_AGENT']); |
@@ -508,33 +522,38 @@ discard block |
||
| 508 | 522 | foreach ($spider_data as $spider) |
| 509 | 523 | { |
| 510 | 524 | // User agent is easy. |
| 511 | - if (!empty($spider['user_agent']) && strpos($ci_user_agent, strtolower($spider['user_agent'])) !== false) |
|
| 512 | - $_SESSION['id_robot'] = $spider['id_spider']; |
|
| 525 | + if (!empty($spider['user_agent']) && strpos($ci_user_agent, strtolower($spider['user_agent'])) !== false) { |
|
| 526 | + $_SESSION['id_robot'] = $spider['id_spider']; |
|
| 527 | + } |
|
| 513 | 528 | // IP stuff is harder. |
| 514 | 529 | elseif ($_SERVER['REMOTE_ADDR']) |
| 515 | 530 | { |
| 516 | 531 | $ips = explode(',', $spider['ip_info']); |
| 517 | 532 | foreach ($ips as $ip) |
| 518 | 533 | { |
| 519 | - if ($ip === '') |
|
| 520 | - continue; |
|
| 534 | + if ($ip === '') { |
|
| 535 | + continue; |
|
| 536 | + } |
|
| 521 | 537 | |
| 522 | 538 | $ip = ip2range($ip); |
| 523 | 539 | if (!empty($ip)) |
| 524 | 540 | { |
| 525 | - if (inet_ptod($ip['low']) <= inet_ptod($_SERVER['REMOTE_ADDR']) && inet_ptod($ip['high']) >= inet_ptod($_SERVER['REMOTE_ADDR'])) |
|
| 526 | - $_SESSION['id_robot'] = $spider['id_spider']; |
|
| 541 | + if (inet_ptod($ip['low']) <= inet_ptod($_SERVER['REMOTE_ADDR']) && inet_ptod($ip['high']) >= inet_ptod($_SERVER['REMOTE_ADDR'])) { |
|
| 542 | + $_SESSION['id_robot'] = $spider['id_spider']; |
|
| 543 | + } |
|
| 527 | 544 | } |
| 528 | 545 | } |
| 529 | 546 | } |
| 530 | 547 | |
| 531 | - if (isset($_SESSION['id_robot'])) |
|
| 532 | - break; |
|
| 548 | + if (isset($_SESSION['id_robot'])) { |
|
| 549 | + break; |
|
| 550 | + } |
|
| 533 | 551 | } |
| 534 | 552 | |
| 535 | 553 | // If this is low server tracking then log the spider here as opposed to the main logging function. |
| 536 | - if (!empty($modSettings['spider_mode']) && $modSettings['spider_mode'] == 1 && !empty($_SESSION['id_robot'])) |
|
| 537 | - logSpider(); |
|
| 554 | + if (!empty($modSettings['spider_mode']) && $modSettings['spider_mode'] == 1 && !empty($_SESSION['id_robot'])) { |
|
| 555 | + logSpider(); |
|
| 556 | + } |
|
| 538 | 557 | |
| 539 | 558 | return !empty($_SESSION['id_robot']) ? $_SESSION['id_robot'] : 0; |
| 540 | 559 | } |
@@ -548,8 +567,9 @@ discard block |
||
| 548 | 567 | { |
| 549 | 568 | global $smcFunc, $modSettings, $context; |
| 550 | 569 | |
| 551 | - if (empty($modSettings['spider_mode']) || empty($_SESSION['id_robot'])) |
|
| 552 | - return; |
|
| 570 | + if (empty($modSettings['spider_mode']) || empty($_SESSION['id_robot'])) { |
|
| 571 | + return; |
|
| 572 | + } |
|
| 553 | 573 | |
| 554 | 574 | // Attempt to update today's entry. |
| 555 | 575 | if ($modSettings['spider_mode'] == 1) |
@@ -590,9 +610,9 @@ discard block |
||
| 590 | 610 | $url = $_GET + array('USER_AGENT' => $_SERVER['HTTP_USER_AGENT']); |
| 591 | 611 | unset($url['sesc'], $url[$context['session_var']]); |
| 592 | 612 | $url = json_encode($url); |
| 613 | + } else { |
|
| 614 | + $url = ''; |
|
| 593 | 615 | } |
| 594 | - else |
|
| 595 | - $url = ''; |
|
| 596 | 616 | |
| 597 | 617 | $smcFunc['db_insert']('insert', |
| 598 | 618 | '{db_prefix}log_spider_hits', |
@@ -620,12 +640,14 @@ discard block |
||
| 620 | 640 | ) |
| 621 | 641 | ); |
| 622 | 642 | $spider_hits = array(); |
| 623 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 624 | - $spider_hits[] = $row; |
|
| 643 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 644 | + $spider_hits[] = $row; |
|
| 645 | + } |
|
| 625 | 646 | $smcFunc['db_free_result']($request); |
| 626 | 647 | |
| 627 | - if (empty($spider_hits)) |
|
| 628 | - return; |
|
| 648 | + if (empty($spider_hits)) { |
|
| 649 | + return; |
|
| 650 | + } |
|
| 629 | 651 | |
| 630 | 652 | // Attempt to update the master data. |
| 631 | 653 | $stat_inserts = array(); |
@@ -646,18 +668,20 @@ discard block |
||
| 646 | 668 | 'hits' => $stat['num_hits'], |
| 647 | 669 | ) |
| 648 | 670 | ); |
| 649 | - if ($smcFunc['db_affected_rows']() == 0) |
|
| 650 | - $stat_inserts[] = array($date, $stat['id_spider'], $stat['num_hits'], $stat['last_seen']); |
|
| 671 | + if ($smcFunc['db_affected_rows']() == 0) { |
|
| 672 | + $stat_inserts[] = array($date, $stat['id_spider'], $stat['num_hits'], $stat['last_seen']); |
|
| 673 | + } |
|
| 651 | 674 | } |
| 652 | 675 | |
| 653 | 676 | // New stats? |
| 654 | - if (!empty($stat_inserts)) |
|
| 655 | - $smcFunc['db_insert']('ignore', |
|
| 677 | + if (!empty($stat_inserts)) { |
|
| 678 | + $smcFunc['db_insert']('ignore', |
|
| 656 | 679 | '{db_prefix}log_spider_stats', |
| 657 | 680 | array('stat_date' => 'date', 'id_spider' => 'int', 'page_hits' => 'int', 'last_seen' => 'int'), |
| 658 | 681 | $stat_inserts, |
| 659 | 682 | array('stat_date', 'id_spider') |
| 660 | 683 | ); |
| 684 | + } |
|
| 661 | 685 | |
| 662 | 686 | // All processed. |
| 663 | 687 | $smcFunc['db_query']('', ' |
@@ -700,8 +724,7 @@ discard block |
||
| 700 | 724 | 'delete_period' => $deleteTime, |
| 701 | 725 | ) |
| 702 | 726 | ); |
| 703 | - } |
|
| 704 | - else |
|
| 727 | + } else |
|
| 705 | 728 | { |
| 706 | 729 | // Deleting all of them |
| 707 | 730 | $smcFunc['db_query']('', ' |
@@ -791,10 +814,11 @@ discard block |
||
| 791 | 814 | foreach ($context['spider_logs']['rows'] as $k => $row) |
| 792 | 815 | { |
| 793 | 816 | // Feature disabled? |
| 794 | - if (empty($row['data']['viewing']['value']) && isset($modSettings['spider_mode']) && $modSettings['spider_mode'] < 3) |
|
| 795 | - $context['spider_logs']['rows'][$k]['viewing']['value'] = '<em>' . $txt['spider_disabled'] . '</em>'; |
|
| 796 | - else |
|
| 797 | - $urls[$k] = array($row['data']['viewing']['value'], -1); |
|
| 817 | + if (empty($row['data']['viewing']['value']) && isset($modSettings['spider_mode']) && $modSettings['spider_mode'] < 3) { |
|
| 818 | + $context['spider_logs']['rows'][$k]['viewing']['value'] = '<em>' . $txt['spider_disabled'] . '</em>'; |
|
| 819 | + } else { |
|
| 820 | + $urls[$k] = array($row['data']['viewing']['value'], -1); |
|
| 821 | + } |
|
| 798 | 822 | } |
| 799 | 823 | |
| 800 | 824 | // Now stick in the new URLs. |
@@ -836,8 +860,9 @@ discard block |
||
| 836 | 860 | ) |
| 837 | 861 | ); |
| 838 | 862 | $spider_logs = array(); |
| 839 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 840 | - $spider_logs[] = $row; |
|
| 863 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 864 | + $spider_logs[] = $row; |
|
| 865 | + } |
|
| 841 | 866 | $smcFunc['db_free_result']($request); |
| 842 | 867 | |
| 843 | 868 | return $spider_logs; |
@@ -913,14 +938,18 @@ discard block |
||
| 913 | 938 | |
| 914 | 939 | // Prepare the dates for the drop down. |
| 915 | 940 | $date_choices = array(); |
| 916 | - for ($y = $min_year; $y <= $max_year; $y++) |
|
| 917 | - for ($m = 1; $m <= 12; $m++) |
|
| 941 | + for ($y = $min_year; $y <= $max_year; $y++) { |
|
| 942 | + for ($m = 1; |
|
| 943 | + } |
|
| 944 | + $m <= 12; $m++) |
|
| 918 | 945 | { |
| 919 | 946 | // This doesn't count? |
| 920 | - if ($y == $min_year && $m < $min_month) |
|
| 921 | - continue; |
|
| 922 | - if ($y == $max_year && $m > $max_month) |
|
| 923 | - break; |
|
| 947 | + if ($y == $min_year && $m < $min_month) { |
|
| 948 | + continue; |
|
| 949 | + } |
|
| 950 | + if ($y == $max_year && $m > $max_month) { |
|
| 951 | + break; |
|
| 952 | + } |
|
| 924 | 953 | |
| 925 | 954 | $date_choices[$y . $m] = $txt['months_short'][$m] . ' ' . $y; |
| 926 | 955 | } |
@@ -933,13 +962,14 @@ discard block |
||
| 933 | 962 | ' . $txt['spider_stats_select_month'] . ': |
| 934 | 963 | <select name="new_date" onchange="document.spider_stat_list.submit();">'; |
| 935 | 964 | |
| 936 | - if (empty($date_choices)) |
|
| 937 | - $date_select .= ' |
|
| 965 | + if (empty($date_choices)) { |
|
| 966 | + $date_select .= ' |
|
| 938 | 967 | <option></option>'; |
| 939 | - else |
|
| 940 | - foreach ($date_choices as $id => $text) |
|
| 968 | + } else { |
|
| 969 | + foreach ($date_choices as $id => $text) |
|
| 941 | 970 | $date_select .= ' |
| 942 | 971 | <option value="' . $id . '"' . ($current_date == $id ? ' selected' : '') . '>' . $text . '</option>'; |
| 972 | + } |
|
| 943 | 973 | |
| 944 | 974 | $date_select .= ' |
| 945 | 975 | </select> |
@@ -1063,8 +1093,9 @@ discard block |
||
| 1063 | 1093 | ) |
| 1064 | 1094 | ); |
| 1065 | 1095 | $spider_stats = array(); |
| 1066 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 1067 | - $spider_stats[] = $row; |
|
| 1096 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 1097 | + $spider_stats[] = $row; |
|
| 1098 | + } |
|
| 1068 | 1099 | $smcFunc['db_free_result']($request); |
| 1069 | 1100 | |
| 1070 | 1101 | return $spider_stats; |
@@ -1105,8 +1136,9 @@ discard block |
||
| 1105 | 1136 | array() |
| 1106 | 1137 | ); |
| 1107 | 1138 | $spiders = array(); |
| 1108 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 1109 | - $spiders[$row['id_spider']] = $row['spider_name']; |
|
| 1139 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 1140 | + $spiders[$row['id_spider']] = $row['spider_name']; |
|
| 1141 | + } |
|
| 1110 | 1142 | $smcFunc['db_free_result']($request); |
| 1111 | 1143 | |
| 1112 | 1144 | updateSettings(array('spider_name_cache' => json_encode($spiders))); |
@@ -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 | * Add the file functions to the $smcFunc array. |
@@ -23,14 +24,15 @@ discard block |
||
| 23 | 24 | { |
| 24 | 25 | global $smcFunc; |
| 25 | 26 | |
| 26 | - if (!isset($smcFunc['db_search_query']) || $smcFunc['db_search_query'] != 'smf_db_query') |
|
| 27 | - $smcFunc += array( |
|
| 27 | + if (!isset($smcFunc['db_search_query']) || $smcFunc['db_search_query'] != 'smf_db_query') { |
|
| 28 | + $smcFunc += array( |
|
| 28 | 29 | 'db_search_query' => 'smf_db_query', |
| 29 | 30 | 'db_search_support' => 'smf_db_search_support', |
| 30 | 31 | 'db_create_word_search' => 'smf_db_create_word_search', |
| 31 | 32 | 'db_support_ignore' => true, |
| 32 | 33 | ); |
| 33 | -} |
|
| 34 | + } |
|
| 35 | + } |
|
| 34 | 36 | |
| 35 | 37 | /** |
| 36 | 38 | * This function will tell you whether this database type supports this search type. |
@@ -54,12 +56,13 @@ discard block |
||
| 54 | 56 | { |
| 55 | 57 | global $smcFunc; |
| 56 | 58 | |
| 57 | - if ($size == 'small') |
|
| 58 | - $size = 'smallint(5)'; |
|
| 59 | - elseif ($size == 'medium') |
|
| 60 | - $size = 'mediumint(8)'; |
|
| 61 | - else |
|
| 62 | - $size = 'int(10)'; |
|
| 59 | + if ($size == 'small') { |
|
| 60 | + $size = 'smallint(5)'; |
|
| 61 | + } elseif ($size == 'medium') { |
|
| 62 | + $size = 'mediumint(8)'; |
|
| 63 | + } else { |
|
| 64 | + $size = 'int(10)'; |
|
| 65 | + } |
|
| 63 | 66 | |
| 64 | 67 | $smcFunc['db_query']('', ' |
| 65 | 68 | CREATE TABLE {db_prefix}log_search_words ( |
@@ -15,8 +15,9 @@ discard block |
||
| 15 | 15 | * @version 2.1 Beta 4 |
| 16 | 16 | */ |
| 17 | 17 | |
| 18 | -if (!defined('SMF')) |
|
| 18 | +if (!defined('SMF')) { |
|
| 19 | 19 | die('No direct access...'); |
| 20 | +} |
|
| 20 | 21 | |
| 21 | 22 | /** |
| 22 | 23 | * Main dispatcher. This function checks permissions and passes control through to the relevant section. |
@@ -245,8 +246,9 @@ discard block |
||
| 245 | 246 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
| 246 | 247 | { |
| 247 | 248 | // Private PM/email subjects and similar shouldn't be shown in the mailbox area. |
| 248 | - if (!empty($row['private'])) |
|
| 249 | - $row['subject'] = $txt['personal_message']; |
|
| 249 | + if (!empty($row['private'])) { |
|
| 250 | + $row['subject'] = $txt['personal_message']; |
|
| 251 | + } |
|
| 250 | 252 | |
| 251 | 253 | $mails[] = $row; |
| 252 | 254 | } |
@@ -300,8 +302,9 @@ discard block |
||
| 300 | 302 | $element = substr($key, strrpos($key, '_') + 1); |
| 301 | 303 | $processedBirthdayEmails[$index][$element] = $value; |
| 302 | 304 | } |
| 303 | - foreach ($processedBirthdayEmails as $index => $dummy) |
|
| 304 | - $emails[$index] = $index; |
|
| 305 | + foreach ($processedBirthdayEmails as $index => $dummy) { |
|
| 306 | + $emails[$index] = $index; |
|
| 307 | + } |
|
| 305 | 308 | |
| 306 | 309 | $config_vars = array( |
| 307 | 310 | // Mail queue stuff, this rocks ;) |
@@ -322,8 +325,9 @@ discard block |
||
| 322 | 325 | |
| 323 | 326 | call_integration_hook('integrate_modify_mail_settings', array(&$config_vars)); |
| 324 | 327 | |
| 325 | - if ($return_config) |
|
| 326 | - return $config_vars; |
|
| 328 | + if ($return_config) { |
|
| 329 | + return $config_vars; |
|
| 330 | + } |
|
| 327 | 331 | |
| 328 | 332 | // Saving? |
| 329 | 333 | if (isset($_GET['save'])) |
@@ -398,9 +402,9 @@ discard block |
||
| 398 | 402 | ); |
| 399 | 403 | list ($_GET['te']) = $smcFunc['db_fetch_row']($request); |
| 400 | 404 | $smcFunc['db_free_result']($request); |
| 405 | + } else { |
|
| 406 | + $_GET['te'] = (int) $_GET['te']; |
|
| 401 | 407 | } |
| 402 | - else |
|
| 403 | - $_GET['te'] = (int) $_GET['te']; |
|
| 404 | 408 | |
| 405 | 409 | $_GET['sent'] = isset($_GET['sent']) ? (int) $_GET['sent'] : 0; |
| 406 | 410 | |
@@ -424,12 +428,14 @@ discard block |
||
| 424 | 428 | |
| 425 | 429 | // Try get more time... |
| 426 | 430 | @set_time_limit(600); |
| 427 | - if (function_exists('apache_reset_timeout')) |
|
| 428 | - @apache_reset_timeout(); |
|
| 431 | + if (function_exists('apache_reset_timeout')) { |
|
| 432 | + @apache_reset_timeout(); |
|
| 433 | + } |
|
| 429 | 434 | |
| 430 | 435 | // Have we already used our maximum time? |
| 431 | - if (time() - array_sum(explode(' ', $time_start)) < 5) |
|
| 432 | - return; |
|
| 436 | + if (time() - array_sum(explode(' ', $time_start)) < 5) { |
|
| 437 | + return; |
|
| 438 | + } |
|
| 433 | 439 | |
| 434 | 440 | $context['continue_get_data'] = '?action=admin;area=mailqueue;sa=clear;te=' . $_GET['te'] . ';sent=' . $_GET['sent'] . ';' . $context['session_var'] . '=' . $context['session_id']; |
| 435 | 441 | $context['page_title'] = $txt['not_done_title']; |
@@ -459,8 +465,9 @@ discard block |
||
| 459 | 465 | { |
| 460 | 466 | global $txt; |
| 461 | 467 | |
| 462 | - if ($time_diff < 0) |
|
| 463 | - $time_diff = 0; |
|
| 468 | + if ($time_diff < 0) { |
|
| 469 | + $time_diff = 0; |
|
| 470 | + } |
|
| 464 | 471 | |
| 465 | 472 | // Just do a bit of an if fest... |
| 466 | 473 | if ($time_diff > 86400) |
@@ -481,8 +488,9 @@ discard block |
||
| 481 | 488 | return sprintf($minutes == 1 ? $txt['mq_minute'] : $txt['mq_minutes'], $minutes); |
| 482 | 489 | } |
| 483 | 490 | // Otherwise must be second |
| 484 | - else |
|
| 485 | - return sprintf($time_diff == 1 ? $txt['mq_second'] : $txt['mq_seconds'], $time_diff); |
|
| 486 | -} |
|
| 491 | + else { |
|
| 492 | + return sprintf($time_diff == 1 ? $txt['mq_second'] : $txt['mq_seconds'], $time_diff); |
|
| 493 | + } |
|
| 494 | + } |
|
| 487 | 495 | |
| 488 | 496 | ?> |
| 489 | 497 | \ No newline at end of file |
@@ -11,8 +11,9 @@ discard block |
||
| 11 | 11 | * @version 2.1 Beta 4 |
| 12 | 12 | */ |
| 13 | 13 | |
| 14 | -if (!defined('SMF')) |
|
| 14 | +if (!defined('SMF')) { |
|
| 15 | 15 | die('Hacking attempt...'); |
| 16 | +} |
|
| 16 | 17 | |
| 17 | 18 | /** |
| 18 | 19 | * Our Cache API class |
@@ -44,8 +45,9 @@ discard block |
||
| 44 | 45 | { |
| 45 | 46 | $supported = function_exists('xcache_get') && function_exists('xcache_set') && ini_get('xcache.var_size') > 0; |
| 46 | 47 | |
| 47 | - if ($test) |
|
| 48 | - return $supported; |
|
| 48 | + if ($test) { |
|
| 49 | + return $supported; |
|
| 50 | + } |
|
| 49 | 51 | return parent::isSupported() && $supported; |
| 50 | 52 | } |
| 51 | 53 | |
@@ -66,10 +68,11 @@ discard block |
||
| 66 | 68 | { |
| 67 | 69 | $key = $this->prefix . strtr($key, ':/', '-_'); |
| 68 | 70 | |
| 69 | - if ($value === null) |
|
| 70 | - return xcache_unset($key); |
|
| 71 | - else |
|
| 72 | - return xcache_set($key, $value, $ttl); |
|
| 71 | + if ($value === null) { |
|
| 72 | + return xcache_unset($key); |
|
| 73 | + } else { |
|
| 74 | + return xcache_set($key, $value, $ttl); |
|
| 75 | + } |
|
| 73 | 76 | } |
| 74 | 77 | |
| 75 | 78 | /** |
@@ -88,10 +91,12 @@ discard block |
||
| 88 | 91 | } |
| 89 | 92 | |
| 90 | 93 | // if passed a type, clear that type out |
| 91 | - if ($type === '' || $type === 'user') |
|
| 92 | - xcache_clear_cache(XC_TYPE_VAR, 0); |
|
| 93 | - if ($type === '' || $type === 'data') |
|
| 94 | - xcache_clear_cache(XC_TYPE_PHP, 0); |
|
| 94 | + if ($type === '' || $type === 'user') { |
|
| 95 | + xcache_clear_cache(XC_TYPE_VAR, 0); |
|
| 96 | + } |
|
| 97 | + if ($type === '' || $type === 'data') { |
|
| 98 | + xcache_clear_cache(XC_TYPE_PHP, 0); |
|
| 99 | + } |
|
| 95 | 100 | |
| 96 | 101 | $this->invalidateCache(); |
| 97 | 102 | return true; |
@@ -110,8 +115,9 @@ discard block |
||
| 110 | 115 | // While we could md5 this when saving, this could be tricky to be sure it doesn't get corrupted on additional saves. |
| 111 | 116 | $config_vars[] = array('xcache_adminpass', $txt['cache_xcache_adminpass'], 'db', 'text', 0); |
| 112 | 117 | |
| 113 | - if (!isset($context['settings_post_javascript'])) |
|
| 114 | - $context['settings_post_javascript'] = ''; |
|
| 118 | + if (!isset($context['settings_post_javascript'])) { |
|
| 119 | + $context['settings_post_javascript'] = ''; |
|
| 120 | + } |
|
| 115 | 121 | |
| 116 | 122 | $context['settings_post_javascript'] .= ' |
| 117 | 123 | $("#cache_accelerator").change(function (e) { |
@@ -12,8 +12,9 @@ discard block |
||
| 12 | 12 | * @version 2.1 Beta 4 |
| 13 | 13 | */ |
| 14 | 14 | |
| 15 | -if (!defined('SMF')) |
|
| 15 | +if (!defined('SMF')) { |
|
| 16 | 16 | die('No direct access...'); |
| 17 | +} |
|
| 17 | 18 | |
| 18 | 19 | /** |
| 19 | 20 | * This is the controlling delegator |
@@ -38,13 +39,15 @@ discard block |
||
| 38 | 39 | ); |
| 39 | 40 | |
| 40 | 41 | // Any subaction? If none, fall through to the main template, which will ask for one. |
| 41 | - if (isset($_REQUEST['sa']) && isset($subActions[$_REQUEST['sa']])) |
|
| 42 | - call_helper($subActions[$_REQUEST['sa']]); |
|
| 42 | + if (isset($_REQUEST['sa']) && isset($subActions[$_REQUEST['sa']])) { |
|
| 43 | + call_helper($subActions[$_REQUEST['sa']]); |
|
| 44 | + } |
|
| 43 | 45 | |
| 44 | 46 | // Creating a one time token. |
| 45 | - else |
|
| 46 | - createToken('remind'); |
|
| 47 | -} |
|
| 47 | + else { |
|
| 48 | + createToken('remind'); |
|
| 49 | + } |
|
| 50 | + } |
|
| 48 | 51 | |
| 49 | 52 | /** |
| 50 | 53 | * Allows the user to pick how they wish to be reminded |
@@ -62,8 +65,7 @@ discard block |
||
| 62 | 65 | { |
| 63 | 66 | $where = 'id_member = {int:id_member}'; |
| 64 | 67 | $where_params['id_member'] = (int) $_REQUEST['uid']; |
| 65 | - } |
|
| 66 | - elseif (isset($_POST['user']) && $_POST['user'] != '') |
|
| 68 | + } elseif (isset($_POST['user']) && $_POST['user'] != '') |
|
| 67 | 69 | { |
| 68 | 70 | $where = 'member_name = {string:member_name}'; |
| 69 | 71 | $where_params['member_name'] = $_POST['user']; |
@@ -71,8 +73,9 @@ discard block |
||
| 71 | 73 | } |
| 72 | 74 | |
| 73 | 75 | // You must enter a username/email address. |
| 74 | - if (empty($where)) |
|
| 75 | - fatal_lang_error('username_no_exist', false); |
|
| 76 | + if (empty($where)) { |
|
| 77 | + fatal_lang_error('username_no_exist', false); |
|
| 78 | + } |
|
| 76 | 79 | |
| 77 | 80 | // Make sure we are not being slammed |
| 78 | 81 | // Don't call this if you're coming from the "Choose a reminder type" page - otherwise you'll likely get an error |
@@ -101,8 +104,9 @@ discard block |
||
| 101 | 104 | LIMIT 1', |
| 102 | 105 | $where_params |
| 103 | 106 | ); |
| 104 | - if ($smcFunc['db_num_rows']($request) == 0) |
|
| 105 | - fatal_lang_error('no_user_with_email', false); |
|
| 107 | + if ($smcFunc['db_num_rows']($request) == 0) { |
|
| 108 | + fatal_lang_error('no_user_with_email', false); |
|
| 109 | + } |
|
| 106 | 110 | } |
| 107 | 111 | |
| 108 | 112 | $row = $smcFunc['db_fetch_assoc']($request); |
@@ -112,16 +116,18 @@ discard block |
||
| 112 | 116 | if ($row['is_activated'] != 1) |
| 113 | 117 | { |
| 114 | 118 | // Awaiting approval... |
| 115 | - if (trim($row['validation_code']) == '') |
|
| 116 | - fatal_error(sprintf($txt['registration_not_approved'], $scripturl . '?action=activate;user=' . $_POST['user']), false); |
|
| 117 | - else |
|
| 118 | - fatal_error(sprintf($txt['registration_not_activated'], $scripturl . '?action=activate;user=' . $_POST['user']), false); |
|
| 119 | + if (trim($row['validation_code']) == '') { |
|
| 120 | + fatal_error(sprintf($txt['registration_not_approved'], $scripturl . '?action=activate;user=' . $_POST['user']), false); |
|
| 121 | + } else { |
|
| 122 | + fatal_error(sprintf($txt['registration_not_activated'], $scripturl . '?action=activate;user=' . $_POST['user']), false); |
|
| 123 | + } |
|
| 119 | 124 | } |
| 120 | 125 | |
| 121 | 126 | // You can't get emailed if you have no email address. |
| 122 | 127 | $row['email_address'] = trim($row['email_address']); |
| 123 | - if ($row['email_address'] == '') |
|
| 124 | - fatal_error($txt['no_reminder_email'] . '<br>' . $txt['send_email'] . ' <a href="mailto:' . $webmaster_email . '">webmaster</a> ' . $txt['to_ask_password'] . '.'); |
|
| 128 | + if ($row['email_address'] == '') { |
|
| 129 | + fatal_error($txt['no_reminder_email'] . '<br>' . $txt['send_email'] . ' <a href="mailto:' . $webmaster_email . '">webmaster</a> ' . $txt['to_ask_password'] . '.'); |
|
| 130 | + } |
|
| 125 | 131 | |
| 126 | 132 | // If they have no secret question then they can only get emailed the item, or they are requesting the email, send them an email. |
| 127 | 133 | if (empty($row['secret_question']) || (isset($_POST['reminder_type']) && $_POST['reminder_type'] == 'email')) |
@@ -176,8 +182,9 @@ discard block |
||
| 176 | 182 | loadLanguage('Login'); |
| 177 | 183 | |
| 178 | 184 | // You need a code! |
| 179 | - if (!isset($_REQUEST['code'])) |
|
| 180 | - fatal_lang_error('no_access', false); |
|
| 185 | + if (!isset($_REQUEST['code'])) { |
|
| 186 | + fatal_lang_error('no_access', false); |
|
| 187 | + } |
|
| 181 | 188 | |
| 182 | 189 | // Fill the context array. |
| 183 | 190 | $context += array( |
@@ -203,16 +210,19 @@ discard block |
||
| 203 | 210 | checkSession(); |
| 204 | 211 | validateToken('remind-sp'); |
| 205 | 212 | |
| 206 | - if (empty($_POST['u']) || !isset($_POST['passwrd1']) || !isset($_POST['passwrd2'])) |
|
| 207 | - fatal_lang_error('no_access', false); |
|
| 213 | + if (empty($_POST['u']) || !isset($_POST['passwrd1']) || !isset($_POST['passwrd2'])) { |
|
| 214 | + fatal_lang_error('no_access', false); |
|
| 215 | + } |
|
| 208 | 216 | |
| 209 | 217 | $_POST['u'] = (int) $_POST['u']; |
| 210 | 218 | |
| 211 | - if ($_POST['passwrd1'] != $_POST['passwrd2']) |
|
| 212 | - fatal_lang_error('passwords_dont_match', false); |
|
| 219 | + if ($_POST['passwrd1'] != $_POST['passwrd2']) { |
|
| 220 | + fatal_lang_error('passwords_dont_match', false); |
|
| 221 | + } |
|
| 213 | 222 | |
| 214 | - if ($_POST['passwrd1'] == '') |
|
| 215 | - fatal_lang_error('no_password', false); |
|
| 223 | + if ($_POST['passwrd1'] == '') { |
|
| 224 | + fatal_lang_error('no_password', false); |
|
| 225 | + } |
|
| 216 | 226 | |
| 217 | 227 | loadLanguage('Login'); |
| 218 | 228 | |
@@ -232,8 +242,9 @@ discard block |
||
| 232 | 242 | ); |
| 233 | 243 | |
| 234 | 244 | // Does this user exist at all? |
| 235 | - if ($smcFunc['db_num_rows']($request) == 0) |
|
| 236 | - fatal_lang_error('invalid_userid', false); |
|
| 245 | + if ($smcFunc['db_num_rows']($request) == 0) { |
|
| 246 | + fatal_lang_error('invalid_userid', false); |
|
| 247 | + } |
|
| 237 | 248 | |
| 238 | 249 | list ($realCode, $username, $email, $flood_value) = $smcFunc['db_fetch_row']($request); |
| 239 | 250 | $smcFunc['db_free_result']($request); |
@@ -243,8 +254,9 @@ discard block |
||
| 243 | 254 | $passwordError = validatePassword($_POST['passwrd1'], $username, array($email)); |
| 244 | 255 | |
| 245 | 256 | // What - it's not? |
| 246 | - if ($passwordError != null) |
|
| 247 | - fatal_lang_error('profile_error_password_' . $passwordError, false); |
|
| 257 | + if ($passwordError != null) { |
|
| 258 | + fatal_lang_error('profile_error_password_' . $passwordError, false); |
|
| 259 | + } |
|
| 248 | 260 | |
| 249 | 261 | require_once($sourcedir . '/LogInOut.php'); |
| 250 | 262 | |
@@ -291,8 +303,9 @@ discard block |
||
| 291 | 303 | loadLanguage('Login'); |
| 292 | 304 | |
| 293 | 305 | // Check they entered something... |
| 294 | - if (empty($_REQUEST['uid'])) |
|
| 295 | - fatal_lang_error('username_no_exist', false); |
|
| 306 | + if (empty($_REQUEST['uid'])) { |
|
| 307 | + fatal_lang_error('username_no_exist', false); |
|
| 308 | + } |
|
| 296 | 309 | |
| 297 | 310 | // Get the stuff.... |
| 298 | 311 | $request = $smcFunc['db_query']('', ' |
@@ -304,15 +317,17 @@ discard block |
||
| 304 | 317 | 'id_member' => (int) $_REQUEST['uid'], |
| 305 | 318 | ) |
| 306 | 319 | ); |
| 307 | - if ($smcFunc['db_num_rows']($request) == 0) |
|
| 308 | - fatal_lang_error('username_no_exist', false); |
|
| 320 | + if ($smcFunc['db_num_rows']($request) == 0) { |
|
| 321 | + fatal_lang_error('username_no_exist', false); |
|
| 322 | + } |
|
| 309 | 323 | |
| 310 | 324 | $row = $smcFunc['db_fetch_assoc']($request); |
| 311 | 325 | $smcFunc['db_free_result']($request); |
| 312 | 326 | |
| 313 | 327 | // If there is NO secret question - then throw an error. |
| 314 | - if (trim($row['secret_question']) == '') |
|
| 315 | - fatal_lang_error('registration_no_secret_question', false); |
|
| 328 | + if (trim($row['secret_question']) == '') { |
|
| 329 | + fatal_lang_error('registration_no_secret_question', false); |
|
| 330 | + } |
|
| 316 | 331 | |
| 317 | 332 | // Ask for the answer... |
| 318 | 333 | $context['remind_user'] = $row['id_member']; |
@@ -335,8 +350,9 @@ discard block |
||
| 335 | 350 | validateToken('remind-sai'); |
| 336 | 351 | |
| 337 | 352 | // Hacker? How did you get this far without an email or username? |
| 338 | - if (empty($_REQUEST['uid'])) |
|
| 339 | - fatal_lang_error('username_no_exist', false); |
|
| 353 | + if (empty($_REQUEST['uid'])) { |
|
| 354 | + fatal_lang_error('username_no_exist', false); |
|
| 355 | + } |
|
| 340 | 356 | |
| 341 | 357 | loadLanguage('Login'); |
| 342 | 358 | |
@@ -350,8 +366,9 @@ discard block |
||
| 350 | 366 | 'id_member' => $_REQUEST['uid'], |
| 351 | 367 | ) |
| 352 | 368 | ); |
| 353 | - if ($smcFunc['db_num_rows']($request) == 0) |
|
| 354 | - fatal_lang_error('username_no_exist', false); |
|
| 369 | + if ($smcFunc['db_num_rows']($request) == 0) { |
|
| 370 | + fatal_lang_error('username_no_exist', false); |
|
| 371 | + } |
|
| 355 | 372 | |
| 356 | 373 | $row = $smcFunc['db_fetch_assoc']($request); |
| 357 | 374 | $smcFunc['db_free_result']($request); |
@@ -364,20 +381,23 @@ discard block |
||
| 364 | 381 | } |
| 365 | 382 | |
| 366 | 383 | // You can't use a blank one! |
| 367 | - if (strlen(trim($_POST['passwrd1'])) === 0) |
|
| 368 | - fatal_lang_error('no_password', false); |
|
| 384 | + if (strlen(trim($_POST['passwrd1'])) === 0) { |
|
| 385 | + fatal_lang_error('no_password', false); |
|
| 386 | + } |
|
| 369 | 387 | |
| 370 | 388 | // They have to be the same too. |
| 371 | - if ($_POST['passwrd1'] != $_POST['passwrd2']) |
|
| 372 | - fatal_lang_error('passwords_dont_match', false); |
|
| 389 | + if ($_POST['passwrd1'] != $_POST['passwrd2']) { |
|
| 390 | + fatal_lang_error('passwords_dont_match', false); |
|
| 391 | + } |
|
| 373 | 392 | |
| 374 | 393 | // Make sure they have a strong enough password. |
| 375 | 394 | require_once($sourcedir . '/Subs-Auth.php'); |
| 376 | 395 | $passwordError = validatePassword($_POST['passwrd1'], $row['member_name'], array($row['email_address'])); |
| 377 | 396 | |
| 378 | 397 | // Invalid? |
| 379 | - if ($passwordError != null) |
|
| 380 | - fatal_lang_error('profile_error_password_' . $passwordError, false); |
|
| 398 | + if ($passwordError != null) { |
|
| 399 | + fatal_lang_error('profile_error_password_' . $passwordError, false); |
|
| 400 | + } |
|
| 381 | 401 | |
| 382 | 402 | // Alright, so long as 'yer sure. |
| 383 | 403 | updateMemberData($row['id_member'], array('passwd' => hash_password($row['member_name'], $_POST['passwrd1']))); |