@@ -20,7 +20,7 @@ |
||
20 | 20 | class GroupReq_Notify_Background extends SMF_BackgroundTask |
21 | 21 | { |
22 | 22 | /** |
23 | - * This executes the task - loads up the information, puts the email in the queue and inserts any alerts as needed. |
|
23 | + * This executes the task - loads up the information, puts the email in the queue and inserts any alerts as needed. |
|
24 | 24 | * @return bool Always returns true. |
25 | 25 | */ |
26 | 26 | public function execute() |
@@ -37,8 +37,9 @@ discard block |
||
37 | 37 | ) |
38 | 38 | ); |
39 | 39 | $moderators = array(); |
40 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
41 | - $moderators[] = $row['id_member']; |
|
40 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
41 | + $moderators[] = $row['id_member']; |
|
42 | + } |
|
42 | 43 | $smcFunc['db_free_result']($request); |
43 | 44 | |
44 | 45 | require_once($sourcedir . '/Subs-Members.php'); |
@@ -59,11 +60,13 @@ discard block |
||
59 | 60 | { |
60 | 61 | if (!empty($prefs[$mod]['request_group'])) |
61 | 62 | { |
62 | - if ($prefs[$mod]['request_group'] & 0x01) |
|
63 | - $data['alert'][] = $mod; |
|
63 | + if ($prefs[$mod]['request_group'] & 0x01) { |
|
64 | + $data['alert'][] = $mod; |
|
65 | + } |
|
64 | 66 | |
65 | - if ($prefs[$mod]['request_group'] & 0x02) |
|
66 | - $data['email'][] = $mod; |
|
67 | + if ($prefs[$mod]['request_group'] & 0x02) { |
|
68 | + $data['email'][] = $mod; |
|
69 | + } |
|
67 | 70 | } |
68 | 71 | } |
69 | 72 |
@@ -15,8 +15,9 @@ discard block |
||
15 | 15 | * @version 2.1 Beta 3 |
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 | * The main designating function for modifying profiles. Loads up info, determins what to do, etc. |
@@ -30,18 +31,21 @@ discard block |
||
30 | 31 | global $db_show_debug, $smcFunc; |
31 | 32 | |
32 | 33 | // Don't reload this as we may have processed error strings. |
33 | - if (empty($post_errors)) |
|
34 | - loadLanguage('Profile+Drafts'); |
|
34 | + if (empty($post_errors)) { |
|
35 | + loadLanguage('Profile+Drafts'); |
|
36 | + } |
|
35 | 37 | loadTemplate('Profile'); |
36 | 38 | |
37 | 39 | require_once($sourcedir . '/Subs-Menu.php'); |
38 | 40 | |
39 | 41 | // Did we get the user by name... |
40 | - if (isset($_REQUEST['user'])) |
|
41 | - $memberResult = loadMemberData($_REQUEST['user'], true, 'profile'); |
|
42 | + if (isset($_REQUEST['user'])) { |
|
43 | + $memberResult = loadMemberData($_REQUEST['user'], true, 'profile'); |
|
44 | + } |
|
42 | 45 | // ... or by id_member? |
43 | - elseif (!empty($_REQUEST['u'])) |
|
44 | - $memberResult = loadMemberData((int) $_REQUEST['u'], false, 'profile'); |
|
46 | + elseif (!empty($_REQUEST['u'])) { |
|
47 | + $memberResult = loadMemberData((int) $_REQUEST['u'], false, 'profile'); |
|
48 | + } |
|
45 | 49 | // If it was just ?action=profile, edit your own profile, but only if you're not a guest. |
46 | 50 | else |
47 | 51 | { |
@@ -51,8 +55,9 @@ discard block |
||
51 | 55 | } |
52 | 56 | |
53 | 57 | // Check if loadMemberData() has returned a valid result. |
54 | - if (!$memberResult) |
|
55 | - fatal_lang_error('not_a_user', false, 404); |
|
58 | + if (!$memberResult) { |
|
59 | + fatal_lang_error('not_a_user', false, 404); |
|
60 | + } |
|
56 | 61 | |
57 | 62 | // If all went well, we have a valid member ID! |
58 | 63 | list ($memID) = $memberResult; |
@@ -68,8 +73,9 @@ discard block |
||
68 | 73 | |
69 | 74 | // Group management isn't actually a permission. But we need it to be for this, so we need a phantom permission. |
70 | 75 | // And we care about what the current user can do, not what the user whose profile it is. |
71 | - if ($user_info['mod_cache']['gq'] != '0=1') |
|
72 | - $user_info['permissions'][] = 'approve_group_requests'; |
|
76 | + if ($user_info['mod_cache']['gq'] != '0=1') { |
|
77 | + $user_info['permissions'][] = 'approve_group_requests'; |
|
78 | + } |
|
73 | 79 | |
74 | 80 | // If paid subscriptions are enabled, make sure we actually have at least one subscription available... |
75 | 81 | $context['subs_available'] = false; |
@@ -437,21 +443,25 @@ discard block |
||
437 | 443 | foreach ($section['areas'] as $area_id => $area) |
438 | 444 | { |
439 | 445 | // If it said no permissions that meant it wasn't valid! |
440 | - if (empty($area['permission'][$context['user']['is_owner'] ? 'own' : 'any'])) |
|
441 | - $profile_areas[$section_id]['areas'][$area_id]['enabled'] = false; |
|
446 | + if (empty($area['permission'][$context['user']['is_owner'] ? 'own' : 'any'])) { |
|
447 | + $profile_areas[$section_id]['areas'][$area_id]['enabled'] = false; |
|
448 | + } |
|
442 | 449 | // Otherwise pick the right set. |
443 | - else |
|
444 | - $profile_areas[$section_id]['areas'][$area_id]['permission'] = $area['permission'][$context['user']['is_owner'] ? 'own' : 'any']; |
|
450 | + else { |
|
451 | + $profile_areas[$section_id]['areas'][$area_id]['permission'] = $area['permission'][$context['user']['is_owner'] ? 'own' : 'any']; |
|
452 | + } |
|
445 | 453 | |
446 | 454 | // Password required in most cases |
447 | - if (!empty($area['password'])) |
|
448 | - $context['password_areas'][] = $area_id; |
|
455 | + if (!empty($area['password'])) { |
|
456 | + $context['password_areas'][] = $area_id; |
|
457 | + } |
|
449 | 458 | } |
450 | 459 | } |
451 | 460 | |
452 | 461 | // Is there an updated message to show? |
453 | - if (isset($_GET['updated'])) |
|
454 | - $context['profile_updated'] = $txt['profile_updated_own']; |
|
462 | + if (isset($_GET['updated'])) { |
|
463 | + $context['profile_updated'] = $txt['profile_updated_own']; |
|
464 | + } |
|
455 | 465 | |
456 | 466 | // Set a few options for the menu. |
457 | 467 | $menuOptions = array( |
@@ -466,8 +476,9 @@ discard block |
||
466 | 476 | $profile_include_data = createMenu($profile_areas, $menuOptions); |
467 | 477 | |
468 | 478 | // No menu means no access. |
469 | - if (!$profile_include_data && (!$user_info['is_guest'] || validateSession())) |
|
470 | - fatal_lang_error('no_access', false); |
|
479 | + if (!$profile_include_data && (!$user_info['is_guest'] || validateSession())) { |
|
480 | + fatal_lang_error('no_access', false); |
|
481 | + } |
|
471 | 482 | |
472 | 483 | // Make a note of the Unique ID for this menu. |
473 | 484 | $context['profile_menu_id'] = $context['max_menu_id']; |
@@ -493,8 +504,9 @@ discard block |
||
493 | 504 | if ($current_area == $area_id) |
494 | 505 | { |
495 | 506 | // This can't happen - but is a security check. |
496 | - if ((isset($section['enabled']) && $section['enabled'] == false) || (isset($area['enabled']) && $area['enabled'] == false)) |
|
497 | - fatal_lang_error('no_access', false); |
|
507 | + if ((isset($section['enabled']) && $section['enabled'] == false) || (isset($area['enabled']) && $area['enabled'] == false)) { |
|
508 | + fatal_lang_error('no_access', false); |
|
509 | + } |
|
498 | 510 | |
499 | 511 | // Are we saving data in a valid area? |
500 | 512 | if (isset($area['sc']) && (isset($_REQUEST['save']) || $context['do_preview'])) |
@@ -513,12 +525,14 @@ discard block |
||
513 | 525 | } |
514 | 526 | |
515 | 527 | // Does this require session validating? |
516 | - if (!empty($area['validate']) || (isset($_REQUEST['save']) && !$context['user']['is_owner'])) |
|
517 | - $security_checks['validate'] = true; |
|
528 | + if (!empty($area['validate']) || (isset($_REQUEST['save']) && !$context['user']['is_owner'])) { |
|
529 | + $security_checks['validate'] = true; |
|
530 | + } |
|
518 | 531 | |
519 | 532 | // Permissions for good measure. |
520 | - if (!empty($profile_include_data['permission'])) |
|
521 | - $security_checks['permission'] = $profile_include_data['permission']; |
|
533 | + if (!empty($profile_include_data['permission'])) { |
|
534 | + $security_checks['permission'] = $profile_include_data['permission']; |
|
535 | + } |
|
522 | 536 | |
523 | 537 | // Either way got something. |
524 | 538 | $found_area = true; |
@@ -527,21 +541,26 @@ discard block |
||
527 | 541 | } |
528 | 542 | |
529 | 543 | // Oh dear, some serious security lapse is going on here... we'll put a stop to that! |
530 | - if (!$found_area) |
|
531 | - fatal_lang_error('no_access', false); |
|
544 | + if (!$found_area) { |
|
545 | + fatal_lang_error('no_access', false); |
|
546 | + } |
|
532 | 547 | |
533 | 548 | // Release this now. |
534 | 549 | unset($profile_areas); |
535 | 550 | |
536 | 551 | // Now the context is setup have we got any security checks to carry out additional to that above? |
537 | - if (isset($security_checks['session'])) |
|
538 | - checkSession($security_checks['session']); |
|
539 | - if (isset($security_checks['validate'])) |
|
540 | - validateSession(); |
|
541 | - if (isset($security_checks['validateToken'])) |
|
542 | - validateToken($token_name, $token_type); |
|
543 | - if (isset($security_checks['permission'])) |
|
544 | - isAllowedTo($security_checks['permission']); |
|
552 | + if (isset($security_checks['session'])) { |
|
553 | + checkSession($security_checks['session']); |
|
554 | + } |
|
555 | + if (isset($security_checks['validate'])) { |
|
556 | + validateSession(); |
|
557 | + } |
|
558 | + if (isset($security_checks['validateToken'])) { |
|
559 | + validateToken($token_name, $token_type); |
|
560 | + } |
|
561 | + if (isset($security_checks['permission'])) { |
|
562 | + isAllowedTo($security_checks['permission']); |
|
563 | + } |
|
545 | 564 | |
546 | 565 | // Create a token if needed. |
547 | 566 | if (isset($security_checks['needsToken']) || isset($security_checks['validateToken'])) |
@@ -551,8 +570,9 @@ discard block |
||
551 | 570 | } |
552 | 571 | |
553 | 572 | // File to include? |
554 | - if (isset($profile_include_data['file'])) |
|
555 | - require_once($sourcedir . '/' . $profile_include_data['file']); |
|
573 | + if (isset($profile_include_data['file'])) { |
|
574 | + require_once($sourcedir . '/' . $profile_include_data['file']); |
|
575 | + } |
|
556 | 576 | |
557 | 577 | // Build the link tree. |
558 | 578 | $context['linktree'][] = array( |
@@ -560,17 +580,19 @@ discard block |
||
560 | 580 | 'name' => sprintf($txt['profile_of_username'], $context['member']['name']), |
561 | 581 | ); |
562 | 582 | |
563 | - if (!empty($profile_include_data['label'])) |
|
564 | - $context['linktree'][] = array( |
|
583 | + if (!empty($profile_include_data['label'])) { |
|
584 | + $context['linktree'][] = array( |
|
565 | 585 | 'url' => $scripturl . '?action=profile' . ($memID != $user_info['id'] ? ';u=' . $memID : '') . ';area=' . $profile_include_data['current_area'], |
566 | 586 | 'name' => $profile_include_data['label'], |
567 | 587 | ); |
588 | + } |
|
568 | 589 | |
569 | - if (!empty($profile_include_data['current_subsection']) && $profile_include_data['subsections'][$profile_include_data['current_subsection']][0] != $profile_include_data['label']) |
|
570 | - $context['linktree'][] = array( |
|
590 | + if (!empty($profile_include_data['current_subsection']) && $profile_include_data['subsections'][$profile_include_data['current_subsection']][0] != $profile_include_data['label']) { |
|
591 | + $context['linktree'][] = array( |
|
571 | 592 | 'url' => $scripturl . '?action=profile' . ($memID != $user_info['id'] ? ';u=' . $memID : '') . ';area=' . $profile_include_data['current_area'] . ';sa=' . $profile_include_data['current_subsection'], |
572 | 593 | 'name' => $profile_include_data['subsections'][$profile_include_data['current_subsection']][0], |
573 | 594 | ); |
595 | + } |
|
574 | 596 | |
575 | 597 | // Set the template for this area and add the profile layer. |
576 | 598 | $context['sub_template'] = $profile_include_data['function']; |
@@ -596,12 +618,14 @@ discard block |
||
596 | 618 | if ($check_password) |
597 | 619 | { |
598 | 620 | // Check to ensure we're forcing SSL for authentication |
599 | - if (!empty($modSettings['force_ssl']) && empty($maintenance) && (!isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] != 'on')) |
|
600 | - fatal_lang_error('login_ssl_required'); |
|
621 | + if (!empty($modSettings['force_ssl']) && empty($maintenance) && (!isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] != 'on')) { |
|
622 | + fatal_lang_error('login_ssl_required'); |
|
623 | + } |
|
601 | 624 | |
602 | 625 | // You didn't even enter a password! |
603 | - if (trim($_POST['oldpasswrd']) == '') |
|
604 | - $post_errors[] = 'no_password'; |
|
626 | + if (trim($_POST['oldpasswrd']) == '') { |
|
627 | + $post_errors[] = 'no_password'; |
|
628 | + } |
|
605 | 629 | |
606 | 630 | // Since the password got modified due to all the $_POST cleaning, lets undo it so we can get the correct password |
607 | 631 | $_POST['oldpasswrd'] = un_htmlspecialchars($_POST['oldpasswrd']); |
@@ -610,33 +634,35 @@ discard block |
||
610 | 634 | $good_password = in_array(true, call_integration_hook('integrate_verify_password', array($cur_profile['member_name'], $_POST['oldpasswrd'], false)), true); |
611 | 635 | |
612 | 636 | // Bad password!!! |
613 | - if (!$good_password && !hash_verify_password($user_profile[$memID]['member_name'], un_htmlspecialchars(stripslashes($_POST['oldpasswrd'])), $user_info['passwd'])) |
|
614 | - $post_errors[] = 'bad_password'; |
|
637 | + if (!$good_password && !hash_verify_password($user_profile[$memID]['member_name'], un_htmlspecialchars(stripslashes($_POST['oldpasswrd'])), $user_info['passwd'])) { |
|
638 | + $post_errors[] = 'bad_password'; |
|
639 | + } |
|
615 | 640 | |
616 | 641 | // Warn other elements not to jump the gun and do custom changes! |
617 | - if (in_array('bad_password', $post_errors)) |
|
618 | - $context['password_auth_failed'] = true; |
|
642 | + if (in_array('bad_password', $post_errors)) { |
|
643 | + $context['password_auth_failed'] = true; |
|
644 | + } |
|
619 | 645 | } |
620 | 646 | |
621 | 647 | // Change the IP address in the database. |
622 | - if ($context['user']['is_owner']) |
|
623 | - $profile_vars['member_ip'] = $user_info['ip']; |
|
648 | + if ($context['user']['is_owner']) { |
|
649 | + $profile_vars['member_ip'] = $user_info['ip']; |
|
650 | + } |
|
624 | 651 | |
625 | 652 | // Now call the sub-action function... |
626 | 653 | if ($current_area == 'activateaccount') |
627 | 654 | { |
628 | - if (empty($post_errors)) |
|
629 | - activateAccount($memID); |
|
630 | - } |
|
631 | - elseif ($current_area == 'deleteaccount') |
|
655 | + if (empty($post_errors)) { |
|
656 | + activateAccount($memID); |
|
657 | + } |
|
658 | + } elseif ($current_area == 'deleteaccount') |
|
632 | 659 | { |
633 | 660 | if (empty($post_errors)) |
634 | 661 | { |
635 | 662 | deleteAccount2($memID); |
636 | 663 | redirectexit(); |
637 | 664 | } |
638 | - } |
|
639 | - elseif ($current_area == 'groupmembership' && empty($post_errors)) |
|
665 | + } elseif ($current_area == 'groupmembership' && empty($post_errors)) |
|
640 | 666 | { |
641 | 667 | $msg = groupMembership2($profile_vars, $post_errors, $memID); |
642 | 668 | |
@@ -647,10 +673,9 @@ discard block |
||
647 | 673 | elseif ($current_area == 'authentication') |
648 | 674 | { |
649 | 675 | authentication($memID, true); |
650 | - } |
|
651 | - elseif (in_array($current_area, array('account', 'forumprofile', 'theme'))) |
|
652 | - saveProfileFields(); |
|
653 | - else |
|
676 | + } elseif (in_array($current_area, array('account', 'forumprofile', 'theme'))) { |
|
677 | + saveProfileFields(); |
|
678 | + } else |
|
654 | 679 | { |
655 | 680 | $force_redirect = true; |
656 | 681 | // Ensure we include this. |
@@ -666,34 +691,36 @@ discard block |
||
666 | 691 | // Load the language file so we can give a nice explanation of the errors. |
667 | 692 | loadLanguage('Errors'); |
668 | 693 | $context['post_errors'] = $post_errors; |
669 | - } |
|
670 | - elseif (!empty($profile_vars)) |
|
694 | + } elseif (!empty($profile_vars)) |
|
671 | 695 | { |
672 | 696 | // If we've changed the password, notify any integration that may be listening in. |
673 | - if (isset($profile_vars['passwd'])) |
|
674 | - call_integration_hook('integrate_reset_pass', array($cur_profile['member_name'], $cur_profile['member_name'], $_POST['passwrd2'])); |
|
697 | + if (isset($profile_vars['passwd'])) { |
|
698 | + call_integration_hook('integrate_reset_pass', array($cur_profile['member_name'], $cur_profile['member_name'], $_POST['passwrd2'])); |
|
699 | + } |
|
675 | 700 | |
676 | 701 | updateMemberData($memID, $profile_vars); |
677 | 702 | |
678 | 703 | // What if this is the newest member? |
679 | - if ($modSettings['latestMember'] == $memID) |
|
680 | - updateStats('member'); |
|
681 | - elseif (isset($profile_vars['real_name'])) |
|
682 | - updateSettings(array('memberlist_updated' => time())); |
|
704 | + if ($modSettings['latestMember'] == $memID) { |
|
705 | + updateStats('member'); |
|
706 | + } elseif (isset($profile_vars['real_name'])) { |
|
707 | + updateSettings(array('memberlist_updated' => time())); |
|
708 | + } |
|
683 | 709 | |
684 | 710 | // If the member changed his/her birthdate, update calendar statistics. |
685 | - if (isset($profile_vars['birthdate']) || isset($profile_vars['real_name'])) |
|
686 | - updateSettings(array( |
|
711 | + if (isset($profile_vars['birthdate']) || isset($profile_vars['real_name'])) { |
|
712 | + updateSettings(array( |
|
687 | 713 | 'calendar_updated' => time(), |
688 | 714 | )); |
715 | + } |
|
689 | 716 | |
690 | 717 | // Anything worth logging? |
691 | 718 | if (!empty($context['log_changes']) && !empty($modSettings['modlog_enabled'])) |
692 | 719 | { |
693 | 720 | $log_changes = array(); |
694 | 721 | require_once($sourcedir . '/Logging.php'); |
695 | - foreach ($context['log_changes'] as $k => $v) |
|
696 | - $log_changes[] = array( |
|
722 | + foreach ($context['log_changes'] as $k => $v) { |
|
723 | + $log_changes[] = array( |
|
697 | 724 | 'action' => $k, |
698 | 725 | 'log_type' => 'user', |
699 | 726 | 'extra' => array_merge($v, array( |
@@ -701,14 +728,16 @@ discard block |
||
701 | 728 | 'member_affected' => $memID, |
702 | 729 | )), |
703 | 730 | ); |
731 | + } |
|
704 | 732 | |
705 | 733 | logActions($log_changes); |
706 | 734 | } |
707 | 735 | |
708 | 736 | // Have we got any post save functions to execute? |
709 | - if (!empty($context['profile_execute_on_save'])) |
|
710 | - foreach ($context['profile_execute_on_save'] as $saveFunc) |
|
737 | + if (!empty($context['profile_execute_on_save'])) { |
|
738 | + foreach ($context['profile_execute_on_save'] as $saveFunc) |
|
711 | 739 | $saveFunc(); |
740 | + } |
|
712 | 741 | |
713 | 742 | // Let them know it worked! |
714 | 743 | $context['profile_updated'] = $context['user']['is_owner'] ? $txt['profile_updated_own'] : sprintf($txt['profile_updated_else'], $cur_profile['member_name']); |
@@ -722,27 +751,31 @@ discard block |
||
722 | 751 | if (!empty($post_errors)) |
723 | 752 | { |
724 | 753 | // Set all the errors so the template knows what went wrong. |
725 | - foreach ($post_errors as $error_type) |
|
726 | - $context['modify_error'][$error_type] = true; |
|
754 | + foreach ($post_errors as $error_type) { |
|
755 | + $context['modify_error'][$error_type] = true; |
|
756 | + } |
|
727 | 757 | } |
728 | 758 | // If it's you then we should redirect upon save. |
729 | - elseif (!empty($profile_vars) && $context['user']['is_owner'] && !$context['do_preview']) |
|
730 | - redirectexit('action=profile;area=' . $current_area . (!empty($current_sa) ? ';sa=' . $current_sa : '') . ';updated'); |
|
731 | - elseif (!empty($force_redirect)) |
|
732 | - redirectexit('action=profile' . ($context['user']['is_owner'] ? '' : ';u=' . $memID) . ';area=' . $current_area); |
|
759 | + elseif (!empty($profile_vars) && $context['user']['is_owner'] && !$context['do_preview']) { |
|
760 | + redirectexit('action=profile;area=' . $current_area . (!empty($current_sa) ? ';sa=' . $current_sa : '') . ';updated'); |
|
761 | + } elseif (!empty($force_redirect)) { |
|
762 | + redirectexit('action=profile' . ($context['user']['is_owner'] ? '' : ';u=' . $memID) . ';area=' . $current_area); |
|
763 | + } |
|
733 | 764 | |
734 | 765 | |
735 | 766 | // Get the right callable. |
736 | 767 | $call = call_helper($profile_include_data['function'], true); |
737 | 768 | |
738 | 769 | // Is it valid? |
739 | - if (!empty($call)) |
|
740 | - call_user_func($call, $memID); |
|
770 | + if (!empty($call)) { |
|
771 | + call_user_func($call, $memID); |
|
772 | + } |
|
741 | 773 | |
742 | 774 | // Set the page title if it's not already set... |
743 | - if (!isset($context['page_title'])) |
|
744 | - $context['page_title'] = $txt['profile'] . (isset($txt[$current_area]) ? ' - ' . $txt[$current_area] : ''); |
|
745 | -} |
|
775 | + if (!isset($context['page_title'])) { |
|
776 | + $context['page_title'] = $txt['profile'] . (isset($txt[$current_area]) ? ' - ' . $txt[$current_area] : ''); |
|
777 | + } |
|
778 | + } |
|
746 | 779 | |
747 | 780 | /** |
748 | 781 | * Set up the requirements for the profile popup - the area that is shown as the popup menu for the current user. |
@@ -865,16 +898,18 @@ discard block |
||
865 | 898 | if (!allowedTo('admin_forum') && $area != 'register') |
866 | 899 | { |
867 | 900 | // If it's the owner they can see two types of private fields, regardless. |
868 | - if ($memID == $user_info['id']) |
|
869 | - $where .= $area == 'summary' ? ' AND private < 3' : ' AND (private = 0 OR private = 2)'; |
|
870 | - else |
|
871 | - $where .= $area == 'summary' ? ' AND private < 2' : ' AND private = 0'; |
|
901 | + if ($memID == $user_info['id']) { |
|
902 | + $where .= $area == 'summary' ? ' AND private < 3' : ' AND (private = 0 OR private = 2)'; |
|
903 | + } else { |
|
904 | + $where .= $area == 'summary' ? ' AND private < 2' : ' AND private = 0'; |
|
905 | + } |
|
872 | 906 | } |
873 | 907 | |
874 | - if ($area == 'register') |
|
875 | - $where .= ' AND show_reg != 0'; |
|
876 | - elseif ($area != 'summary') |
|
877 | - $where .= ' AND show_profile = {string:area}'; |
|
908 | + if ($area == 'register') { |
|
909 | + $where .= ' AND show_reg != 0'; |
|
910 | + } elseif ($area != 'summary') { |
|
911 | + $where .= ' AND show_profile = {string:area}'; |
|
912 | + } |
|
878 | 913 | |
879 | 914 | // Load all the relevant fields - and data. |
880 | 915 | $request = $smcFunc['db_query']('', ' |
@@ -900,13 +935,15 @@ discard block |
||
900 | 935 | if (isset($_POST['customfield']) && isset($_POST['customfield'][$row['col_name']])) |
901 | 936 | { |
902 | 937 | $value = $smcFunc['htmlspecialchars']($_POST['customfield'][$row['col_name']]); |
903 | - if (in_array($row['field_type'], array('select', 'radio'))) |
|
904 | - $value = ($options = explode(',', $row['field_options'])) && isset($options[$value]) ? $options[$value] : ''; |
|
938 | + if (in_array($row['field_type'], array('select', 'radio'))) { |
|
939 | + $value = ($options = explode(',', $row['field_options'])) && isset($options[$value]) ? $options[$value] : ''; |
|
940 | + } |
|
905 | 941 | } |
906 | 942 | |
907 | 943 | // Don't show the "disabled" option for the "gender" field if we are on the "summary" area. |
908 | - if ($area == 'summary' && $row['col_name'] == 'cust_gender' && $value == 'Disabled') |
|
909 | - continue; |
|
944 | + if ($area == 'summary' && $row['col_name'] == 'cust_gender' && $value == 'Disabled') { |
|
945 | + continue; |
|
946 | + } |
|
910 | 947 | |
911 | 948 | // HTML for the input form. |
912 | 949 | $output_html = $value; |
@@ -915,8 +952,7 @@ discard block |
||
915 | 952 | $true = (!$exists && $row['default_value']) || $value; |
916 | 953 | $input_html = '<input type="checkbox" name="customfield[' . $row['col_name'] . ']" id="customfield[' . $row['col_name'] . ']"' . ($true ? ' checked' : '') . ' class="input_check">'; |
917 | 954 | $output_html = $true ? $txt['yes'] : $txt['no']; |
918 | - } |
|
919 | - elseif ($row['field_type'] == 'select') |
|
955 | + } elseif ($row['field_type'] == 'select') |
|
920 | 956 | { |
921 | 957 | $input_html = '<select name="customfield[' . $row['col_name'] . ']" id="customfield[' . $row['col_name'] . ']"><option value="-1"></option>'; |
922 | 958 | $options = explode(',', $row['field_options']); |
@@ -924,13 +960,13 @@ discard block |
||
924 | 960 | { |
925 | 961 | $true = (!$exists && $row['default_value'] == $v) || $value == $v; |
926 | 962 | $input_html .= '<option value="' . $k . '"' . ($true ? ' selected' : '') . '>' . $v . '</option>'; |
927 | - if ($true) |
|
928 | - $output_html = $v; |
|
963 | + if ($true) { |
|
964 | + $output_html = $v; |
|
965 | + } |
|
929 | 966 | } |
930 | 967 | |
931 | 968 | $input_html .= '</select>'; |
932 | - } |
|
933 | - elseif ($row['field_type'] == 'radio') |
|
969 | + } elseif ($row['field_type'] == 'radio') |
|
934 | 970 | { |
935 | 971 | $input_html = '<fieldset>'; |
936 | 972 | $options = explode(',', $row['field_options']); |
@@ -938,36 +974,37 @@ discard block |
||
938 | 974 | { |
939 | 975 | $true = (!$exists && $row['default_value'] == $v) || $value == $v; |
940 | 976 | $input_html .= '<label for="customfield_' . $row['col_name'] . '_' . $k . '"><input type="radio" name="customfield[' . $row['col_name'] . ']" class="input_radio" id="customfield_' . $row['col_name'] . '_' . $k . '" value="' . $k . '"' . ($true ? ' checked' : '') . '>' . $v . '</label><br>'; |
941 | - if ($true) |
|
942 | - $output_html = $v; |
|
977 | + if ($true) { |
|
978 | + $output_html = $v; |
|
979 | + } |
|
943 | 980 | } |
944 | 981 | $input_html .= '</fieldset>'; |
945 | - } |
|
946 | - elseif ($row['field_type'] == 'text') |
|
982 | + } elseif ($row['field_type'] == 'text') |
|
947 | 983 | { |
948 | 984 | $input_html = '<input type="text" name="customfield[' . $row['col_name'] . ']" id="customfield[' . $row['col_name'] . ']"' . ($row['field_length'] != 0 ? ' maxlength="' . $row['field_length'] . '"' : '') . ' size="' . ($row['field_length'] == 0 || $row['field_length'] >= 50 ? 50 : ($row['field_length'] > 30 ? 30 : ($row['field_length'] > 10 ? 20 : 10))) . '" value="' . un_htmlspecialchars($value) . '" class="input_text"' . ($row['show_reg'] == 2 ? ' required' : '') . '>'; |
949 | - } |
|
950 | - else |
|
985 | + } else |
|
951 | 986 | { |
952 | 987 | @list ($rows, $cols) = @explode(',', $row['default_value']); |
953 | 988 | $input_html = '<textarea name="customfield[' . $row['col_name'] . ']" id="customfield[' . $row['col_name'] . ']"' . (!empty($rows) ? ' rows="' . $rows . '"' : '') . (!empty($cols) ? ' cols="' . $cols . '"' : '') . ($row['show_reg'] == 2 ? ' required' : '' ). '>' . un_htmlspecialchars($value) . '</textarea>'; |
954 | 989 | } |
955 | 990 | |
956 | 991 | // Parse BBCode |
957 | - if ($row['bbc']) |
|
958 | - $output_html = parse_bbc($output_html); |
|
959 | - elseif ($row['field_type'] == 'textarea') |
|
960 | - // Allow for newlines at least |
|
992 | + if ($row['bbc']) { |
|
993 | + $output_html = parse_bbc($output_html); |
|
994 | + } elseif ($row['field_type'] == 'textarea') { |
|
995 | + // Allow for newlines at least |
|
961 | 996 | $output_html = strtr($output_html, array("\n" => '<br>')); |
997 | + } |
|
962 | 998 | |
963 | 999 | // Enclosing the user input within some other text? |
964 | - if (!empty($row['enclose']) && !empty($output_html)) |
|
965 | - $output_html = strtr($row['enclose'], array( |
|
1000 | + if (!empty($row['enclose']) && !empty($output_html)) { |
|
1001 | + $output_html = strtr($row['enclose'], array( |
|
966 | 1002 | '{SCRIPTURL}' => $scripturl, |
967 | 1003 | '{IMAGES_URL}' => $settings['images_url'], |
968 | 1004 | '{DEFAULT_IMAGES_URL}' => $settings['default_images_url'], |
969 | 1005 | '{INPUT}' => un_htmlspecialchars($output_html), |
970 | 1006 | )); |
1007 | + } |
|
971 | 1008 | |
972 | 1009 | $context['custom_fields'][] = array( |
973 | 1010 | 'name' => $row['field_name'], |
@@ -14,8 +14,9 @@ discard block |
||
14 | 14 | * @version 2.1 Beta 3 |
15 | 15 | */ |
16 | 16 | |
17 | -if (!defined('SMF')) |
|
17 | +if (!defined('SMF')) { |
|
18 | 18 | die('No direct access...'); |
19 | +} |
|
19 | 20 | |
20 | 21 | /** |
21 | 22 | * Mark a board or multiple boards read. |
@@ -28,14 +29,16 @@ discard block |
||
28 | 29 | global $user_info, $modSettings, $smcFunc; |
29 | 30 | |
30 | 31 | // Force $boards to be an array. |
31 | - if (!is_array($boards)) |
|
32 | - $boards = array($boards); |
|
33 | - else |
|
34 | - $boards = array_unique($boards); |
|
32 | + if (!is_array($boards)) { |
|
33 | + $boards = array($boards); |
|
34 | + } else { |
|
35 | + $boards = array_unique($boards); |
|
36 | + } |
|
35 | 37 | |
36 | 38 | // No boards, nothing to mark as read. |
37 | - if (empty($boards)) |
|
38 | - return; |
|
39 | + if (empty($boards)) { |
|
40 | + return; |
|
41 | + } |
|
39 | 42 | |
40 | 43 | // Allow the user to mark a board as unread. |
41 | 44 | if ($unread) |
@@ -65,8 +68,9 @@ discard block |
||
65 | 68 | else |
66 | 69 | { |
67 | 70 | $markRead = array(); |
68 | - foreach ($boards as $board) |
|
69 | - $markRead[] = array($modSettings['maxMsgID'], $user_info['id'], $board); |
|
71 | + foreach ($boards as $board) { |
|
72 | + $markRead[] = array($modSettings['maxMsgID'], $user_info['id'], $board); |
|
73 | + } |
|
70 | 74 | |
71 | 75 | // Update log_mark_read and log_boards. |
72 | 76 | $smcFunc['db_insert']('replace', |
@@ -99,8 +103,9 @@ discard block |
||
99 | 103 | list ($lowest_topic) = $smcFunc['db_fetch_row']($result); |
100 | 104 | $smcFunc['db_free_result']($result); |
101 | 105 | |
102 | - if (empty($lowest_topic)) |
|
103 | - return; |
|
106 | + if (empty($lowest_topic)) { |
|
107 | + return; |
|
108 | + } |
|
104 | 109 | |
105 | 110 | // @todo SLOW This query seems to eat it sometimes. |
106 | 111 | $result = $smcFunc['db_query']('', ' |
@@ -118,12 +123,13 @@ discard block |
||
118 | 123 | ) |
119 | 124 | ); |
120 | 125 | $topics = array(); |
121 | - while ($row = $smcFunc['db_fetch_assoc']($result)) |
|
122 | - $topics[] = $row['id_topic']; |
|
126 | + while ($row = $smcFunc['db_fetch_assoc']($result)) { |
|
127 | + $topics[] = $row['id_topic']; |
|
128 | + } |
|
123 | 129 | $smcFunc['db_free_result']($result); |
124 | 130 | |
125 | - if (!empty($topics)) |
|
126 | - $smcFunc['db_query']('', ' |
|
131 | + if (!empty($topics)) { |
|
132 | + $smcFunc['db_query']('', ' |
|
127 | 133 | DELETE FROM {db_prefix}log_topics |
128 | 134 | WHERE id_member = {int:current_member} |
129 | 135 | AND id_topic IN ({array_int:topic_list})', |
@@ -132,7 +138,8 @@ discard block |
||
132 | 138 | 'topic_list' => $topics, |
133 | 139 | ) |
134 | 140 | ); |
135 | -} |
|
141 | + } |
|
142 | + } |
|
136 | 143 | |
137 | 144 | /** |
138 | 145 | * Mark one or more boards as read. |
@@ -157,23 +164,26 @@ discard block |
||
157 | 164 | ) |
158 | 165 | ); |
159 | 166 | $boards = array(); |
160 | - while ($row = $smcFunc['db_fetch_assoc']($result)) |
|
161 | - $boards[] = $row['id_board']; |
|
167 | + while ($row = $smcFunc['db_fetch_assoc']($result)) { |
|
168 | + $boards[] = $row['id_board']; |
|
169 | + } |
|
162 | 170 | $smcFunc['db_free_result']($result); |
163 | 171 | |
164 | - if (!empty($boards)) |
|
165 | - markBoardsRead($boards, isset($_REQUEST['unread'])); |
|
172 | + if (!empty($boards)) { |
|
173 | + markBoardsRead($boards, isset($_REQUEST['unread'])); |
|
174 | + } |
|
166 | 175 | |
167 | 176 | $_SESSION['id_msg_last_visit'] = $modSettings['maxMsgID']; |
168 | - if (!empty($_SESSION['old_url']) && strpos($_SESSION['old_url'], 'action=unread') !== false) |
|
169 | - redirectexit('action=unread'); |
|
177 | + if (!empty($_SESSION['old_url']) && strpos($_SESSION['old_url'], 'action=unread') !== false) { |
|
178 | + redirectexit('action=unread'); |
|
179 | + } |
|
170 | 180 | |
171 | - if (isset($_SESSION['topicseen_cache'])) |
|
172 | - $_SESSION['topicseen_cache'] = array(); |
|
181 | + if (isset($_SESSION['topicseen_cache'])) { |
|
182 | + $_SESSION['topicseen_cache'] = array(); |
|
183 | + } |
|
173 | 184 | |
174 | 185 | redirectexit(); |
175 | - } |
|
176 | - elseif (isset($_REQUEST['sa']) && $_REQUEST['sa'] == 'unreadreplies') |
|
186 | + } elseif (isset($_REQUEST['sa']) && $_REQUEST['sa'] == 'unreadreplies') |
|
177 | 187 | { |
178 | 188 | // Make sure all the topics are integers! |
179 | 189 | $topics = array_map('intval', explode('-', $_REQUEST['topics'])); |
@@ -189,13 +199,15 @@ discard block |
||
189 | 199 | ) |
190 | 200 | ); |
191 | 201 | $logged_topics = array(); |
192 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
193 | - $logged_topics[$row['id_topic']] = $row['unwatched']; |
|
202 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
203 | + $logged_topics[$row['id_topic']] = $row['unwatched']; |
|
204 | + } |
|
194 | 205 | $smcFunc['db_free_result']($request); |
195 | 206 | |
196 | 207 | $markRead = array(); |
197 | - foreach ($topics as $id_topic) |
|
198 | - $markRead[] = array($modSettings['maxMsgID'], $user_info['id'], $id_topic, (isset($logged_topics[$topic]) ? $logged_topics[$topic] : 0)); |
|
208 | + foreach ($topics as $id_topic) { |
|
209 | + $markRead[] = array($modSettings['maxMsgID'], $user_info['id'], $id_topic, (isset($logged_topics[$topic]) ? $logged_topics[$topic] : 0)); |
|
210 | + } |
|
199 | 211 | |
200 | 212 | $smcFunc['db_insert']('replace', |
201 | 213 | '{db_prefix}log_topics', |
@@ -204,8 +216,9 @@ discard block |
||
204 | 216 | array('id_member', 'id_topic') |
205 | 217 | ); |
206 | 218 | |
207 | - if (isset($_SESSION['topicseen_cache'])) |
|
208 | - $_SESSION['topicseen_cache'] = array(); |
|
219 | + if (isset($_SESSION['topicseen_cache'])) { |
|
220 | + $_SESSION['topicseen_cache'] = array(); |
|
221 | + } |
|
209 | 222 | |
210 | 223 | redirectexit('action=unreadreplies'); |
211 | 224 | } |
@@ -230,11 +243,13 @@ discard block |
||
230 | 243 | if (!empty($_GET['t'])) |
231 | 244 | { |
232 | 245 | // If they read the whole topic, go back to the beginning. |
233 | - if ($_GET['t'] >= $topicinfo['id_last_msg']) |
|
234 | - $earlyMsg = 0; |
|
246 | + if ($_GET['t'] >= $topicinfo['id_last_msg']) { |
|
247 | + $earlyMsg = 0; |
|
248 | + } |
|
235 | 249 | // If they want to mark the whole thing read, same. |
236 | - elseif ($_GET['t'] <= $topicinfo['id_first_msg']) |
|
237 | - $earlyMsg = 0; |
|
250 | + elseif ($_GET['t'] <= $topicinfo['id_first_msg']) { |
|
251 | + $earlyMsg = 0; |
|
252 | + } |
|
238 | 253 | // Otherwise, get the latest message before the named one. |
239 | 254 | else |
240 | 255 | { |
@@ -255,9 +270,9 @@ discard block |
||
255 | 270 | } |
256 | 271 | } |
257 | 272 | // Marking read from first page? That's the whole topic. |
258 | - elseif ($_REQUEST['start'] == 0) |
|
259 | - $earlyMsg = 0; |
|
260 | - else |
|
273 | + elseif ($_REQUEST['start'] == 0) { |
|
274 | + $earlyMsg = 0; |
|
275 | + } else |
|
261 | 276 | { |
262 | 277 | $result = $smcFunc['db_query']('', ' |
263 | 278 | SELECT id_msg |
@@ -285,8 +300,7 @@ discard block |
||
285 | 300 | ); |
286 | 301 | |
287 | 302 | redirectexit('board=' . $board . '.0'); |
288 | - } |
|
289 | - else |
|
303 | + } else |
|
290 | 304 | { |
291 | 305 | $categories = array(); |
292 | 306 | $boards = array(); |
@@ -294,17 +308,20 @@ discard block |
||
294 | 308 | if (isset($_REQUEST['c'])) |
295 | 309 | { |
296 | 310 | $_REQUEST['c'] = explode(',', $_REQUEST['c']); |
297 | - foreach ($_REQUEST['c'] as $c) |
|
298 | - $categories[] = (int) $c; |
|
311 | + foreach ($_REQUEST['c'] as $c) { |
|
312 | + $categories[] = (int) $c; |
|
313 | + } |
|
299 | 314 | } |
300 | 315 | if (isset($_REQUEST['boards'])) |
301 | 316 | { |
302 | 317 | $_REQUEST['boards'] = explode(',', $_REQUEST['boards']); |
303 | - foreach ($_REQUEST['boards'] as $b) |
|
304 | - $boards[] = (int) $b; |
|
318 | + foreach ($_REQUEST['boards'] as $b) { |
|
319 | + $boards[] = (int) $b; |
|
320 | + } |
|
321 | + } |
|
322 | + if (!empty($board)) { |
|
323 | + $boards[] = (int) $board; |
|
305 | 324 | } |
306 | - if (!empty($board)) |
|
307 | - $boards[] = (int) $board; |
|
308 | 325 | |
309 | 326 | if (isset($_REQUEST['children']) && !empty($boards)) |
310 | 327 | { |
@@ -324,9 +341,10 @@ discard block |
||
324 | 341 | 'board_list' => $boards, |
325 | 342 | ) |
326 | 343 | ); |
327 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
328 | - if (in_array($row['id_parent'], $boards)) |
|
344 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
345 | + if (in_array($row['id_parent'], $boards)) |
|
329 | 346 | $boards[] = $row['id_board']; |
347 | + } |
|
330 | 348 | $smcFunc['db_free_result']($request); |
331 | 349 | } |
332 | 350 | |
@@ -343,8 +361,9 @@ discard block |
||
343 | 361 | $clauseParameters['board_list'] = $boards; |
344 | 362 | } |
345 | 363 | |
346 | - if (empty($clauses)) |
|
347 | - redirectexit(); |
|
364 | + if (empty($clauses)) { |
|
365 | + redirectexit(); |
|
366 | + } |
|
348 | 367 | |
349 | 368 | $request = $smcFunc['db_query']('', ' |
350 | 369 | SELECT b.id_board |
@@ -355,19 +374,22 @@ discard block |
||
355 | 374 | )) |
356 | 375 | ); |
357 | 376 | $boards = array(); |
358 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
359 | - $boards[] = $row['id_board']; |
|
377 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
378 | + $boards[] = $row['id_board']; |
|
379 | + } |
|
360 | 380 | $smcFunc['db_free_result']($request); |
361 | 381 | |
362 | - if (empty($boards)) |
|
363 | - redirectexit(); |
|
382 | + if (empty($boards)) { |
|
383 | + redirectexit(); |
|
384 | + } |
|
364 | 385 | |
365 | 386 | markBoardsRead($boards, isset($_REQUEST['unread'])); |
366 | 387 | |
367 | 388 | foreach ($boards as $b) |
368 | 389 | { |
369 | - if (isset($_SESSION['topicseen_cache'][$b])) |
|
370 | - $_SESSION['topicseen_cache'][$b] = array(); |
|
390 | + if (isset($_SESSION['topicseen_cache'][$b])) { |
|
391 | + $_SESSION['topicseen_cache'][$b] = array(); |
|
392 | + } |
|
371 | 393 | } |
372 | 394 | |
373 | 395 | if (!isset($_REQUEST['unread'])) |
@@ -385,8 +407,9 @@ discard block |
||
385 | 407 | if ($smcFunc['db_num_rows']($result) > 0) |
386 | 408 | { |
387 | 409 | $logBoardInserts = ''; |
388 | - while ($row = $smcFunc['db_fetch_assoc']($result)) |
|
389 | - $logBoardInserts[] = array($modSettings['maxMsgID'], $user_info['id'], $row['id_board']); |
|
410 | + while ($row = $smcFunc['db_fetch_assoc']($result)) { |
|
411 | + $logBoardInserts[] = array($modSettings['maxMsgID'], $user_info['id'], $row['id_board']); |
|
412 | + } |
|
390 | 413 | |
391 | 414 | $smcFunc['db_insert']('replace', |
392 | 415 | '{db_prefix}log_boards', |
@@ -397,17 +420,18 @@ discard block |
||
397 | 420 | } |
398 | 421 | $smcFunc['db_free_result']($result); |
399 | 422 | |
400 | - if (empty($board)) |
|
401 | - redirectexit(); |
|
402 | - else |
|
403 | - redirectexit('board=' . $board . '.0'); |
|
404 | - } |
|
405 | - else |
|
423 | + if (empty($board)) { |
|
424 | + redirectexit(); |
|
425 | + } else { |
|
426 | + redirectexit('board=' . $board . '.0'); |
|
427 | + } |
|
428 | + } else |
|
406 | 429 | { |
407 | - if (empty($board_info['parent'])) |
|
408 | - redirectexit(); |
|
409 | - else |
|
410 | - redirectexit('board=' . $board_info['parent'] . '.0'); |
|
430 | + if (empty($board_info['parent'])) { |
|
431 | + redirectexit(); |
|
432 | + } else { |
|
433 | + redirectexit('board=' . $board_info['parent'] . '.0'); |
|
434 | + } |
|
411 | 435 | } |
412 | 436 | } |
413 | 437 | } |
@@ -432,11 +456,13 @@ discard block |
||
432 | 456 | 'selected_message' => (int) $messageID, |
433 | 457 | ) |
434 | 458 | ); |
435 | - if ($smcFunc['db_num_rows']($result) > 0) |
|
436 | - list ($memberID) = $smcFunc['db_fetch_row']($result); |
|
459 | + if ($smcFunc['db_num_rows']($result) > 0) { |
|
460 | + list ($memberID) = $smcFunc['db_fetch_row']($result); |
|
461 | + } |
|
437 | 462 | // The message doesn't even exist. |
438 | - else |
|
439 | - $memberID = 0; |
|
463 | + else { |
|
464 | + $memberID = 0; |
|
465 | + } |
|
440 | 466 | $smcFunc['db_free_result']($result); |
441 | 467 | |
442 | 468 | return (int) $memberID; |
@@ -457,8 +483,9 @@ discard block |
||
457 | 483 | getBoardTree(); |
458 | 484 | |
459 | 485 | // Make sure given boards and categories exist. |
460 | - if (!isset($boards[$board_id]) || (isset($boardOptions['target_board']) && !isset($boards[$boardOptions['target_board']])) || (isset($boardOptions['target_category']) && !isset($cat_tree[$boardOptions['target_category']]))) |
|
461 | - fatal_lang_error('no_board'); |
|
486 | + if (!isset($boards[$board_id]) || (isset($boardOptions['target_board']) && !isset($boards[$boardOptions['target_board']])) || (isset($boardOptions['target_category']) && !isset($cat_tree[$boardOptions['target_category']]))) { |
|
487 | + fatal_lang_error('no_board'); |
|
488 | + } |
|
462 | 489 | |
463 | 490 | $id = $board_id; |
464 | 491 | call_integration_hook('integrate_pre_modify_board', array($id, &$boardOptions)); |
@@ -486,8 +513,9 @@ discard block |
||
486 | 513 | $child_level = 0; |
487 | 514 | $id_parent = 0; |
488 | 515 | $after = 0; |
489 | - foreach ($cat_tree[$id_cat]['children'] as $id_board => $dummy) |
|
490 | - $after = max($after, $boards[$id_board]['order']); |
|
516 | + foreach ($cat_tree[$id_cat]['children'] as $id_board => $dummy) { |
|
517 | + $after = max($after, $boards[$id_board]['order']); |
|
518 | + } |
|
491 | 519 | } |
492 | 520 | |
493 | 521 | // Make the board a child of a given board. |
@@ -498,17 +526,19 @@ discard block |
||
498 | 526 | $id_parent = $boardOptions['target_board']; |
499 | 527 | |
500 | 528 | // People can be creative, in many ways... |
501 | - if (isChildOf($id_parent, $board_id)) |
|
502 | - fatal_lang_error('mboards_parent_own_child_error', false); |
|
503 | - elseif ($id_parent == $board_id) |
|
504 | - fatal_lang_error('mboards_board_own_child_error', false); |
|
529 | + if (isChildOf($id_parent, $board_id)) { |
|
530 | + fatal_lang_error('mboards_parent_own_child_error', false); |
|
531 | + } elseif ($id_parent == $board_id) { |
|
532 | + fatal_lang_error('mboards_board_own_child_error', false); |
|
533 | + } |
|
505 | 534 | |
506 | 535 | $after = $boards[$boardOptions['target_board']]['order']; |
507 | 536 | |
508 | 537 | // Check if there are already children and (if so) get the max board order. |
509 | - if (!empty($boards[$id_parent]['tree']['children']) && empty($boardOptions['move_first_child'])) |
|
510 | - foreach ($boards[$id_parent]['tree']['children'] as $childBoard_id => $dummy) |
|
538 | + if (!empty($boards[$id_parent]['tree']['children']) && empty($boardOptions['move_first_child'])) { |
|
539 | + foreach ($boards[$id_parent]['tree']['children'] as $childBoard_id => $dummy) |
|
511 | 540 | $after = max($after, $boards[$childBoard_id]['order']); |
541 | + } |
|
512 | 542 | } |
513 | 543 | |
514 | 544 | // Place a board before or after another board, on the same child level. |
@@ -521,8 +551,9 @@ discard block |
||
521 | 551 | } |
522 | 552 | |
523 | 553 | // Oops...? |
524 | - else |
|
525 | - trigger_error('modifyBoard(): The move_to value \'' . $boardOptions['move_to'] . '\' is incorrect', E_USER_ERROR); |
|
554 | + else { |
|
555 | + trigger_error('modifyBoard(): The move_to value \'' . $boardOptions['move_to'] . '\' is incorrect', E_USER_ERROR); |
|
556 | + } |
|
526 | 557 | |
527 | 558 | // Get a list of children of this board. |
528 | 559 | $childList = array(); |
@@ -531,14 +562,16 @@ discard block |
||
531 | 562 | // See if there are changes that affect children. |
532 | 563 | $childUpdates = array(); |
533 | 564 | $levelDiff = $child_level - $boards[$board_id]['level']; |
534 | - if ($levelDiff != 0) |
|
535 | - $childUpdates[] = 'child_level = child_level ' . ($levelDiff > 0 ? '+ ' : '') . '{int:level_diff}'; |
|
536 | - if ($id_cat != $boards[$board_id]['category']) |
|
537 | - $childUpdates[] = 'id_cat = {int:category}'; |
|
565 | + if ($levelDiff != 0) { |
|
566 | + $childUpdates[] = 'child_level = child_level ' . ($levelDiff > 0 ? '+ ' : '') . '{int:level_diff}'; |
|
567 | + } |
|
568 | + if ($id_cat != $boards[$board_id]['category']) { |
|
569 | + $childUpdates[] = 'id_cat = {int:category}'; |
|
570 | + } |
|
538 | 571 | |
539 | 572 | // Fix the children of this board. |
540 | - if (!empty($childList) && !empty($childUpdates)) |
|
541 | - $smcFunc['db_query']('', ' |
|
573 | + if (!empty($childList) && !empty($childUpdates)) { |
|
574 | + $smcFunc['db_query']('', ' |
|
542 | 575 | UPDATE {db_prefix}boards |
543 | 576 | SET ' . implode(', |
544 | 577 | ', $childUpdates) . ' |
@@ -549,6 +582,7 @@ discard block |
||
549 | 582 | 'level_diff' => $levelDiff, |
550 | 583 | ) |
551 | 584 | ); |
585 | + } |
|
552 | 586 | |
553 | 587 | // Make some room for this spot. |
554 | 588 | $smcFunc['db_query']('', ' |
@@ -644,8 +678,8 @@ discard block |
||
644 | 678 | call_integration_hook('integrate_modify_board', array($id, &$boardUpdates, &$boardUpdateParameters)); |
645 | 679 | |
646 | 680 | // Do the updates (if any). |
647 | - if (!empty($boardUpdates)) |
|
648 | - $request = $smcFunc['db_query']('', ' |
|
681 | + if (!empty($boardUpdates)) { |
|
682 | + $request = $smcFunc['db_query']('', ' |
|
649 | 683 | UPDATE {db_prefix}boards |
650 | 684 | SET |
651 | 685 | ' . implode(', |
@@ -655,6 +689,7 @@ discard block |
||
655 | 689 | 'selected_board' => $board_id, |
656 | 690 | )) |
657 | 691 | ); |
692 | + } |
|
658 | 693 | |
659 | 694 | // Set moderators of this board. |
660 | 695 | if (isset($boardOptions['moderators']) || isset($boardOptions['moderator_string']) || isset($boardOptions['moderator_groups']) || isset($boardOptions['moderator_group_string'])) |
@@ -679,13 +714,15 @@ discard block |
||
679 | 714 | { |
680 | 715 | $moderators[$k] = trim($moderators[$k]); |
681 | 716 | |
682 | - if (strlen($moderators[$k]) == 0) |
|
683 | - unset($moderators[$k]); |
|
717 | + if (strlen($moderators[$k]) == 0) { |
|
718 | + unset($moderators[$k]); |
|
719 | + } |
|
684 | 720 | } |
685 | 721 | |
686 | 722 | // Find all the id_member's for the member_name's in the list. |
687 | - if (empty($boardOptions['moderators'])) |
|
688 | - $boardOptions['moderators'] = array(); |
|
723 | + if (empty($boardOptions['moderators'])) { |
|
724 | + $boardOptions['moderators'] = array(); |
|
725 | + } |
|
689 | 726 | if (!empty($moderators)) |
690 | 727 | { |
691 | 728 | $request = $smcFunc['db_query']('', ' |
@@ -698,8 +735,9 @@ discard block |
||
698 | 735 | 'limit' => count($moderators), |
699 | 736 | ) |
700 | 737 | ); |
701 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
702 | - $boardOptions['moderators'][] = $row['id_member']; |
|
738 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
739 | + $boardOptions['moderators'][] = $row['id_member']; |
|
740 | + } |
|
703 | 741 | $smcFunc['db_free_result']($request); |
704 | 742 | } |
705 | 743 | } |
@@ -708,8 +746,9 @@ discard block |
||
708 | 746 | if (!empty($boardOptions['moderators'])) |
709 | 747 | { |
710 | 748 | $inserts = array(); |
711 | - foreach ($boardOptions['moderators'] as $moderator) |
|
712 | - $inserts[] = array($board_id, $moderator); |
|
749 | + foreach ($boardOptions['moderators'] as $moderator) { |
|
750 | + $inserts[] = array($board_id, $moderator); |
|
751 | + } |
|
713 | 752 | |
714 | 753 | $smcFunc['db_insert']('insert', |
715 | 754 | '{db_prefix}moderators', |
@@ -739,14 +778,16 @@ discard block |
||
739 | 778 | { |
740 | 779 | $moderator_groups[$k] = trim($moderator_groups[$k]); |
741 | 780 | |
742 | - if (strlen($moderator_groups[$k]) == 0) |
|
743 | - unset($moderator_groups[$k]); |
|
781 | + if (strlen($moderator_groups[$k]) == 0) { |
|
782 | + unset($moderator_groups[$k]); |
|
783 | + } |
|
744 | 784 | } |
745 | 785 | |
746 | 786 | /* Find all the id_group's for all the group names in the list |
747 | 787 | But skip any invalid ones (invisible/post groups/Administrator/Moderator) */ |
748 | - if (empty($boardOptions['moderator_groups'])) |
|
749 | - $boardOptions['moderator_groups'] = array(); |
|
788 | + if (empty($boardOptions['moderator_groups'])) { |
|
789 | + $boardOptions['moderator_groups'] = array(); |
|
790 | + } |
|
750 | 791 | if (!empty($moderator_groups)) |
751 | 792 | { |
752 | 793 | $request = $smcFunc['db_query']('', ' |
@@ -777,8 +818,9 @@ discard block |
||
777 | 818 | if (!empty($boardOptions['moderator_groups'])) |
778 | 819 | { |
779 | 820 | $inserts = array(); |
780 | - foreach ($boardOptions['moderator_groups'] as $moderator_group) |
|
781 | - $inserts[] = array($board_id, $moderator_group); |
|
821 | + foreach ($boardOptions['moderator_groups'] as $moderator_group) { |
|
822 | + $inserts[] = array($board_id, $moderator_group); |
|
823 | + } |
|
782 | 824 | |
783 | 825 | $smcFunc['db_insert']('insert', |
784 | 826 | '{db_prefix}moderator_groups', |
@@ -792,14 +834,16 @@ discard block |
||
792 | 834 | updateSettings(array('settings_updated' => time())); |
793 | 835 | } |
794 | 836 | |
795 | - if (isset($boardOptions['move_to'])) |
|
796 | - reorderBoards(); |
|
837 | + if (isset($boardOptions['move_to'])) { |
|
838 | + reorderBoards(); |
|
839 | + } |
|
797 | 840 | |
798 | 841 | clean_cache('data'); |
799 | 842 | |
800 | - if (empty($boardOptions['dont_log'])) |
|
801 | - logAction('edit_board', array('board' => $board_id), 'admin'); |
|
802 | -} |
|
843 | + if (empty($boardOptions['dont_log'])) { |
|
844 | + logAction('edit_board', array('board' => $board_id), 'admin'); |
|
845 | + } |
|
846 | + } |
|
803 | 847 | |
804 | 848 | /** |
805 | 849 | * Create a new board and set its properties and position. |
@@ -815,11 +859,13 @@ discard block |
||
815 | 859 | global $boards, $smcFunc; |
816 | 860 | |
817 | 861 | // Trigger an error if one of the required values is not set. |
818 | - if (!isset($boardOptions['board_name']) || trim($boardOptions['board_name']) == '' || !isset($boardOptions['move_to']) || !isset($boardOptions['target_category'])) |
|
819 | - trigger_error('createBoard(): One or more of the required options is not set', E_USER_ERROR); |
|
862 | + if (!isset($boardOptions['board_name']) || trim($boardOptions['board_name']) == '' || !isset($boardOptions['move_to']) || !isset($boardOptions['target_category'])) { |
|
863 | + trigger_error('createBoard(): One or more of the required options is not set', E_USER_ERROR); |
|
864 | + } |
|
820 | 865 | |
821 | - if (in_array($boardOptions['move_to'], array('child', 'before', 'after')) && !isset($boardOptions['target_board'])) |
|
822 | - trigger_error('createBoard(): Target board is not set', E_USER_ERROR); |
|
866 | + if (in_array($boardOptions['move_to'], array('child', 'before', 'after')) && !isset($boardOptions['target_board'])) { |
|
867 | + trigger_error('createBoard(): Target board is not set', E_USER_ERROR); |
|
868 | + } |
|
823 | 869 | |
824 | 870 | // Set every optional value to its default value. |
825 | 871 | $boardOptions += array( |
@@ -853,8 +899,9 @@ discard block |
||
853 | 899 | ); |
854 | 900 | $board_id = $smcFunc['db_insert_id']('{db_prefix}boards', 'id_board'); |
855 | 901 | |
856 | - if (empty($board_id)) |
|
857 | - return 0; |
|
902 | + if (empty($board_id)) { |
|
903 | + return 0; |
|
904 | + } |
|
858 | 905 | |
859 | 906 | // Change the board according to the given specifications. |
860 | 907 | modifyBoard($board_id, $boardOptions); |
@@ -917,8 +964,9 @@ discard block |
||
917 | 964 | global $sourcedir, $boards, $smcFunc; |
918 | 965 | |
919 | 966 | // No boards to delete? Return! |
920 | - if (empty($boards_to_remove)) |
|
921 | - return; |
|
967 | + if (empty($boards_to_remove)) { |
|
968 | + return; |
|
969 | + } |
|
922 | 970 | |
923 | 971 | getBoardTree(); |
924 | 972 | |
@@ -929,12 +977,14 @@ discard block |
||
929 | 977 | { |
930 | 978 | // Get a list of the child boards that will also be removed. |
931 | 979 | $child_boards_to_remove = array(); |
932 | - foreach ($boards_to_remove as $board_to_remove) |
|
933 | - recursiveBoards($child_boards_to_remove, $boards[$board_to_remove]['tree']); |
|
980 | + foreach ($boards_to_remove as $board_to_remove) { |
|
981 | + recursiveBoards($child_boards_to_remove, $boards[$board_to_remove]['tree']); |
|
982 | + } |
|
934 | 983 | |
935 | 984 | // Merge the children with their parents. |
936 | - if (!empty($child_boards_to_remove)) |
|
937 | - $boards_to_remove = array_unique(array_merge($boards_to_remove, $child_boards_to_remove)); |
|
985 | + if (!empty($child_boards_to_remove)) { |
|
986 | + $boards_to_remove = array_unique(array_merge($boards_to_remove, $child_boards_to_remove)); |
|
987 | + } |
|
938 | 988 | } |
939 | 989 | // Move the children to a safe home. |
940 | 990 | else |
@@ -942,10 +992,11 @@ discard block |
||
942 | 992 | foreach ($boards_to_remove as $id_board) |
943 | 993 | { |
944 | 994 | // @todo Separate category? |
945 | - if ($moveChildrenTo === 0) |
|
946 | - fixChildren($id_board, 0, 0); |
|
947 | - else |
|
948 | - fixChildren($id_board, $boards[$moveChildrenTo]['level'] + 1, $moveChildrenTo); |
|
995 | + if ($moveChildrenTo === 0) { |
|
996 | + fixChildren($id_board, 0, 0); |
|
997 | + } else { |
|
998 | + fixChildren($id_board, $boards[$moveChildrenTo]['level'] + 1, $moveChildrenTo); |
|
999 | + } |
|
949 | 1000 | } |
950 | 1001 | } |
951 | 1002 | |
@@ -959,8 +1010,9 @@ discard block |
||
959 | 1010 | ) |
960 | 1011 | ); |
961 | 1012 | $topics = array(); |
962 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
963 | - $topics[] = $row['id_topic']; |
|
1013 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
1014 | + $topics[] = $row['id_topic']; |
|
1015 | + } |
|
964 | 1016 | $smcFunc['db_free_result']($request); |
965 | 1017 | |
966 | 1018 | require_once($sourcedir . '/RemoveTopic.php'); |
@@ -1048,8 +1100,9 @@ discard block |
||
1048 | 1100 | clean_cache('data'); |
1049 | 1101 | |
1050 | 1102 | // Let's do some serious logging. |
1051 | - foreach ($boards_to_remove as $id_board) |
|
1052 | - logAction('delete_board', array('boardname' => $boards[$id_board]['name']), 'admin'); |
|
1103 | + foreach ($boards_to_remove as $id_board) { |
|
1104 | + logAction('delete_board', array('boardname' => $boards[$id_board]['name']), 'admin'); |
|
1105 | + } |
|
1053 | 1106 | |
1054 | 1107 | reorderBoards(); |
1055 | 1108 | } |
@@ -1068,8 +1121,8 @@ discard block |
||
1068 | 1121 | $board_order = 0; |
1069 | 1122 | foreach ($cat_tree as $catID => $dummy) |
1070 | 1123 | { |
1071 | - foreach ($boardList[$catID] as $boardID) |
|
1072 | - if ($boards[$boardID]['order'] != ++$board_order) |
|
1124 | + foreach ($boardList[$catID] as $boardID) { |
|
1125 | + if ($boards[$boardID]['order'] != ++$board_order) |
|
1073 | 1126 | $smcFunc['db_query']('', ' |
1074 | 1127 | UPDATE {db_prefix}boards |
1075 | 1128 | SET board_order = {int:new_order} |
@@ -1079,6 +1132,7 @@ discard block |
||
1079 | 1132 | 'selected_board' => $boardID, |
1080 | 1133 | ) |
1081 | 1134 | ); |
1135 | + } |
|
1082 | 1136 | } |
1083 | 1137 | |
1084 | 1138 | // Empty the board order cache |
@@ -1107,8 +1161,9 @@ discard block |
||
1107 | 1161 | ) |
1108 | 1162 | ); |
1109 | 1163 | $children = array(); |
1110 | - while ($row = $smcFunc['db_fetch_assoc']($result)) |
|
1111 | - $children[] = $row['id_board']; |
|
1164 | + while ($row = $smcFunc['db_fetch_assoc']($result)) { |
|
1165 | + $children[] = $row['id_board']; |
|
1166 | + } |
|
1112 | 1167 | $smcFunc['db_free_result']($result); |
1113 | 1168 | |
1114 | 1169 | // ...and set it to a new parent and child_level. |
@@ -1124,9 +1179,10 @@ discard block |
||
1124 | 1179 | ); |
1125 | 1180 | |
1126 | 1181 | // Recursively fix the children of the children. |
1127 | - foreach ($children as $child) |
|
1128 | - fixChildren($child, $newLevel + 1, $child); |
|
1129 | -} |
|
1182 | + foreach ($children as $child) { |
|
1183 | + fixChildren($child, $newLevel + 1, $child); |
|
1184 | + } |
|
1185 | + } |
|
1130 | 1186 | |
1131 | 1187 | /** |
1132 | 1188 | * Tries to load up the entire board order and category very very quickly |
@@ -1143,8 +1199,9 @@ discard block |
||
1143 | 1199 | 'boards' => array(), |
1144 | 1200 | ); |
1145 | 1201 | |
1146 | - if (!empty($tree_order['boards'])) |
|
1147 | - return $tree_order; |
|
1202 | + if (!empty($tree_order['boards'])) { |
|
1203 | + return $tree_order; |
|
1204 | + } |
|
1148 | 1205 | |
1149 | 1206 | if (($cached = cache_get_data('board_order', 86400)) !== null) |
1150 | 1207 | { |
@@ -1160,8 +1217,9 @@ discard block |
||
1160 | 1217 | ); |
1161 | 1218 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
1162 | 1219 | { |
1163 | - if (!in_array($row['id_cat'], $tree_order['cats'])) |
|
1164 | - $tree_order['cats'][] = $row['id_cat']; |
|
1220 | + if (!in_array($row['id_cat'], $tree_order['cats'])) { |
|
1221 | + $tree_order['cats'][] = $row['id_cat']; |
|
1222 | + } |
|
1165 | 1223 | $tree_order['boards'][] = $row['id_board']; |
1166 | 1224 | } |
1167 | 1225 | $smcFunc['db_free_result']($request); |
@@ -1181,16 +1239,19 @@ discard block |
||
1181 | 1239 | $tree = getTreeOrder(); |
1182 | 1240 | |
1183 | 1241 | $ordered = array(); |
1184 | - foreach ($tree['boards'] as $board) |
|
1185 | - if (!empty($boards[$board])) |
|
1242 | + foreach ($tree['boards'] as $board) { |
|
1243 | + if (!empty($boards[$board])) |
|
1186 | 1244 | { |
1187 | 1245 | $ordered[$board] = $boards[$board]; |
1246 | + } |
|
1188 | 1247 | |
1189 | - if (is_array($ordered[$board]) && !empty($ordered[$board]['boards'])) |
|
1190 | - sortBoards($ordered[$board]['boards']); |
|
1248 | + if (is_array($ordered[$board]) && !empty($ordered[$board]['boards'])) { |
|
1249 | + sortBoards($ordered[$board]['boards']); |
|
1250 | + } |
|
1191 | 1251 | |
1192 | - if (is_array($ordered[$board]) && !empty($ordered[$board]['children'])) |
|
1193 | - sortBoards($ordered[$board]['children']); |
|
1252 | + if (is_array($ordered[$board]) && !empty($ordered[$board]['children'])) { |
|
1253 | + sortBoards($ordered[$board]['children']); |
|
1254 | + } |
|
1194 | 1255 | } |
1195 | 1256 | |
1196 | 1257 | $boards = $ordered; |
@@ -1206,12 +1267,14 @@ discard block |
||
1206 | 1267 | $tree = getTreeOrder(); |
1207 | 1268 | |
1208 | 1269 | $ordered = array(); |
1209 | - foreach ($tree['cats'] as $cat) |
|
1210 | - if (!empty($categories[$cat])) |
|
1270 | + foreach ($tree['cats'] as $cat) { |
|
1271 | + if (!empty($categories[$cat])) |
|
1211 | 1272 | { |
1212 | 1273 | $ordered[$cat] = $categories[$cat]; |
1213 | - if (!empty($ordered[$cat]['boards'])) |
|
1214 | - sortBoards($ordered[$cat]['boards']); |
|
1274 | + } |
|
1275 | + if (!empty($ordered[$cat]['boards'])) { |
|
1276 | + sortBoards($ordered[$cat]['boards']); |
|
1277 | + } |
|
1215 | 1278 | } |
1216 | 1279 | |
1217 | 1280 | $categories = $ordered; |
@@ -1227,8 +1290,9 @@ discard block |
||
1227 | 1290 | { |
1228 | 1291 | global $smcFunc, $scripturl, $txt; |
1229 | 1292 | |
1230 | - if (empty($boards)) |
|
1231 | - return array(); |
|
1293 | + if (empty($boards)) { |
|
1294 | + return array(); |
|
1295 | + } |
|
1232 | 1296 | |
1233 | 1297 | $request = $smcFunc['db_query']('', ' |
1234 | 1298 | SELECT mem.id_member, mem.real_name, mo.id_board |
@@ -1242,8 +1306,9 @@ discard block |
||
1242 | 1306 | $moderators = array(); |
1243 | 1307 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
1244 | 1308 | { |
1245 | - if (empty($moderators[$row['id_board']])) |
|
1246 | - $moderators[$row['id_board']] = array(); |
|
1309 | + if (empty($moderators[$row['id_board']])) { |
|
1310 | + $moderators[$row['id_board']] = array(); |
|
1311 | + } |
|
1247 | 1312 | |
1248 | 1313 | $moderators[$row['id_board']][] = array( |
1249 | 1314 | 'id' => $row['id_member'], |
@@ -1267,8 +1332,9 @@ discard block |
||
1267 | 1332 | { |
1268 | 1333 | global $smcFunc, $scripturl, $txt; |
1269 | 1334 | |
1270 | - if (empty($boards)) |
|
1271 | - return array(); |
|
1335 | + if (empty($boards)) { |
|
1336 | + return array(); |
|
1337 | + } |
|
1272 | 1338 | |
1273 | 1339 | $request = $smcFunc['db_query']('', ' |
1274 | 1340 | SELECT mg.id_group, mg.group_name, bg.id_board |
@@ -1282,8 +1348,9 @@ discard block |
||
1282 | 1348 | $groups = array(); |
1283 | 1349 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
1284 | 1350 | { |
1285 | - if (empty($groups[$row['id_board']])) |
|
1286 | - $groups[$row['id_board']] = array(); |
|
1351 | + if (empty($groups[$row['id_board']])) { |
|
1352 | + $groups[$row['id_board']] = array(); |
|
1353 | + } |
|
1287 | 1354 | |
1288 | 1355 | $groups[$row['id_board']][] = array( |
1289 | 1356 | 'id' => $row['id_group'], |
@@ -1345,8 +1412,9 @@ discard block |
||
1345 | 1412 | |
1346 | 1413 | if (!empty($row['id_board'])) |
1347 | 1414 | { |
1348 | - if ($row['child_level'] != $curLevel) |
|
1349 | - $prevBoard = 0; |
|
1415 | + if ($row['child_level'] != $curLevel) { |
|
1416 | + $prevBoard = 0; |
|
1417 | + } |
|
1350 | 1418 | |
1351 | 1419 | $boards[$row['id_board']] = array( |
1352 | 1420 | 'id' => $row['id_board'], |
@@ -1378,16 +1446,16 @@ discard block |
||
1378 | 1446 | 'children' => array() |
1379 | 1447 | ); |
1380 | 1448 | $boards[$row['id_board']]['tree'] = &$cat_tree[$row['id_cat']]['children'][$row['id_board']]; |
1381 | - } |
|
1382 | - else |
|
1449 | + } else |
|
1383 | 1450 | { |
1384 | 1451 | // Parent doesn't exist! |
1385 | - if (!isset($boards[$row['id_parent']]['tree'])) |
|
1386 | - fatal_lang_error('no_valid_parent', false, array($row['board_name'])); |
|
1452 | + if (!isset($boards[$row['id_parent']]['tree'])) { |
|
1453 | + fatal_lang_error('no_valid_parent', false, array($row['board_name'])); |
|
1454 | + } |
|
1387 | 1455 | |
1388 | 1456 | // Wrong childlevel...we can silently fix this... |
1389 | - if ($boards[$row['id_parent']]['tree']['node']['level'] != $row['child_level'] - 1) |
|
1390 | - $smcFunc['db_query']('', ' |
|
1457 | + if ($boards[$row['id_parent']]['tree']['node']['level'] != $row['child_level'] - 1) { |
|
1458 | + $smcFunc['db_query']('', ' |
|
1391 | 1459 | UPDATE {db_prefix}boards |
1392 | 1460 | SET child_level = {int:new_child_level} |
1393 | 1461 | WHERE id_board = {int:selected_board}', |
@@ -1396,6 +1464,7 @@ discard block |
||
1396 | 1464 | 'selected_board' => $row['id_board'], |
1397 | 1465 | ) |
1398 | 1466 | ); |
1467 | + } |
|
1399 | 1468 | |
1400 | 1469 | $boards[$row['id_parent']]['tree']['children'][$row['id_board']] = array( |
1401 | 1470 | 'node' => &$boards[$row['id_board']], |
@@ -1426,8 +1495,9 @@ discard block |
||
1426 | 1495 | */ |
1427 | 1496 | function recursiveBoards(&$_boardList, &$_tree) |
1428 | 1497 | { |
1429 | - if (empty($_tree['children'])) |
|
1430 | - return; |
|
1498 | + if (empty($_tree['children'])) { |
|
1499 | + return; |
|
1500 | + } |
|
1431 | 1501 | |
1432 | 1502 | foreach ($_tree['children'] as $id => $node) |
1433 | 1503 | { |
@@ -1446,11 +1516,13 @@ discard block |
||
1446 | 1516 | { |
1447 | 1517 | global $boards; |
1448 | 1518 | |
1449 | - if (empty($boards[$child]['parent'])) |
|
1450 | - return false; |
|
1519 | + if (empty($boards[$child]['parent'])) { |
|
1520 | + return false; |
|
1521 | + } |
|
1451 | 1522 | |
1452 | - if ($boards[$child]['parent'] == $parent) |
|
1453 | - return true; |
|
1523 | + if ($boards[$child]['parent'] == $parent) { |
|
1524 | + return true; |
|
1525 | + } |
|
1454 | 1526 | |
1455 | 1527 | return isChildOf($boards[$child]['parent'], $parent); |
1456 | 1528 | } |
@@ -11,8 +11,9 @@ discard block |
||
11 | 11 | * @version 2.1 Beta 3 |
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 |
@@ -46,8 +47,9 @@ discard block |
||
46 | 47 | |
47 | 48 | $supported = function_exists('xcache_get') && function_exists('xcache_set') && ini_get('xcache.var_size') > 0; |
48 | 49 | |
49 | - if ($test) |
|
50 | - return $supported; |
|
50 | + if ($test) { |
|
51 | + return $supported; |
|
52 | + } |
|
51 | 53 | return parent::isSupported() && $supported; |
52 | 54 | } |
53 | 55 | |
@@ -68,10 +70,11 @@ discard block |
||
68 | 70 | { |
69 | 71 | $key = $this->prefix . strtr($key, ':/', '-_'); |
70 | 72 | |
71 | - if ($value === null) |
|
72 | - return xcache_unset($key); |
|
73 | - else |
|
74 | - return xcache_set($key, $value, $ttl); |
|
73 | + if ($value === null) { |
|
74 | + return xcache_unset($key); |
|
75 | + } else { |
|
76 | + return xcache_set($key, $value, $ttl); |
|
77 | + } |
|
75 | 78 | } |
76 | 79 | |
77 | 80 | /** |
@@ -90,10 +93,12 @@ discard block |
||
90 | 93 | } |
91 | 94 | |
92 | 95 | // if passed a type, clear that type out |
93 | - if ($type === '' || $type === 'user') |
|
94 | - xcache_clear_cache(XC_TYPE_VAR, 0); |
|
95 | - if ($type === '' || $type === 'data') |
|
96 | - xcache_clear_cache(XC_TYPE_PHP, 0); |
|
96 | + if ($type === '' || $type === 'user') { |
|
97 | + xcache_clear_cache(XC_TYPE_VAR, 0); |
|
98 | + } |
|
99 | + if ($type === '' || $type === 'data') { |
|
100 | + xcache_clear_cache(XC_TYPE_PHP, 0); |
|
101 | + } |
|
97 | 102 | |
98 | 103 | $this->invalidateCache(); |
99 | 104 | return true; |
@@ -112,8 +117,9 @@ discard block |
||
112 | 117 | // While we could md5 this when saving, this could be tricky to be sure it doesn't get corrupted on additional saves. |
113 | 118 | $config_vars[] = array('xcache_adminpass', $txt['cache_xcache_adminpass'], 'db', 'text', 0); |
114 | 119 | |
115 | - if (!isset($context['settings_post_javascript'])) |
|
116 | - $context['settings_post_javascript'] = ''; |
|
120 | + if (!isset($context['settings_post_javascript'])) { |
|
121 | + $context['settings_post_javascript'] = ''; |
|
122 | + } |
|
117 | 123 | |
118 | 124 | $context['settings_post_javascript'] .= ' |
119 | 125 | $("#cache_accelerator").change(function (e) { |
@@ -13,8 +13,9 @@ discard block |
||
13 | 13 | * @version 2.1 Beta 3 |
14 | 14 | */ |
15 | 15 | |
16 | -if (!defined('SMF')) |
|
16 | +if (!defined('SMF')) { |
|
17 | 17 | die('No direct access...'); |
18 | +} |
|
18 | 19 | |
19 | 20 | /** |
20 | 21 | * Activate an account. |
@@ -48,8 +49,9 @@ discard block |
||
48 | 49 | logAction('approve_member', array('member' => $memID), 'admin'); |
49 | 50 | |
50 | 51 | // If we are doing approval, update the stats for the member just in case. |
51 | - if (in_array($user_profile[$memID]['is_activated'], array(3, 4, 5, 13, 14, 15))) |
|
52 | - updateSettings(array('unapprovedMembers' => ($modSettings['unapprovedMembers'] > 1 ? $modSettings['unapprovedMembers'] - 1 : 0))); |
|
52 | + if (in_array($user_profile[$memID]['is_activated'], array(3, 4, 5, 13, 14, 15))) { |
|
53 | + updateSettings(array('unapprovedMembers' => ($modSettings['unapprovedMembers'] > 1 ? $modSettings['unapprovedMembers'] - 1 : 0))); |
|
54 | + } |
|
53 | 55 | |
54 | 56 | // Make sure we update the stats too. |
55 | 57 | updateStats('member', false); |
@@ -76,8 +78,9 @@ discard block |
||
76 | 78 | $issueErrors = array(); |
77 | 79 | |
78 | 80 | // Doesn't hurt to be overly cautious. |
79 | - if (empty($modSettings['warning_enable']) || ($context['user']['is_owner'] && !$cur_profile['warning']) || !allowedTo('issue_warning')) |
|
80 | - fatal_lang_error('no_access', false); |
|
81 | + if (empty($modSettings['warning_enable']) || ($context['user']['is_owner'] && !$cur_profile['warning']) || !allowedTo('issue_warning')) { |
|
82 | + fatal_lang_error('no_access', false); |
|
83 | + } |
|
81 | 84 | |
82 | 85 | // Get the base (errors related) stuff done. |
83 | 86 | loadLanguage('Errors'); |
@@ -135,16 +138,18 @@ discard block |
||
135 | 138 | |
136 | 139 | // This cannot be empty! |
137 | 140 | $_POST['warn_reason'] = isset($_POST['warn_reason']) ? trim($_POST['warn_reason']) : ''; |
138 | - if ($_POST['warn_reason'] == '' && !$context['user']['is_owner']) |
|
139 | - $issueErrors[] = 'warning_no_reason'; |
|
141 | + if ($_POST['warn_reason'] == '' && !$context['user']['is_owner']) { |
|
142 | + $issueErrors[] = 'warning_no_reason'; |
|
143 | + } |
|
140 | 144 | $_POST['warn_reason'] = $smcFunc['htmlspecialchars']($_POST['warn_reason']); |
141 | 145 | |
142 | 146 | $_POST['warning_level'] = (int) $_POST['warning_level']; |
143 | 147 | $_POST['warning_level'] = max(0, min(100, $_POST['warning_level'])); |
144 | - if ($_POST['warning_level'] < $context['min_allowed']) |
|
145 | - $_POST['warning_level'] = $context['min_allowed']; |
|
146 | - elseif ($_POST['warning_level'] > $context['max_allowed']) |
|
147 | - $_POST['warning_level'] = $context['max_allowed']; |
|
148 | + if ($_POST['warning_level'] < $context['min_allowed']) { |
|
149 | + $_POST['warning_level'] = $context['min_allowed']; |
|
150 | + } elseif ($_POST['warning_level'] > $context['max_allowed']) { |
|
151 | + $_POST['warning_level'] = $context['max_allowed']; |
|
152 | + } |
|
148 | 153 | |
149 | 154 | // Do we actually have to issue them with a PM? |
150 | 155 | $id_notice = 0; |
@@ -152,8 +157,9 @@ discard block |
||
152 | 157 | { |
153 | 158 | $_POST['warn_sub'] = trim($_POST['warn_sub']); |
154 | 159 | $_POST['warn_body'] = trim($_POST['warn_body']); |
155 | - if (empty($_POST['warn_sub']) || empty($_POST['warn_body'])) |
|
156 | - $issueErrors[] = 'warning_notify_blank'; |
|
160 | + if (empty($_POST['warn_sub']) || empty($_POST['warn_body'])) { |
|
161 | + $issueErrors[] = 'warning_notify_blank'; |
|
162 | + } |
|
157 | 163 | // Send the PM? |
158 | 164 | else |
159 | 165 | { |
@@ -190,8 +196,8 @@ discard block |
||
190 | 196 | if (empty($issueErrors)) |
191 | 197 | { |
192 | 198 | // Log what we've done! |
193 | - if (!$context['user']['is_owner']) |
|
194 | - $smcFunc['db_insert']('', |
|
199 | + if (!$context['user']['is_owner']) { |
|
200 | + $smcFunc['db_insert']('', |
|
195 | 201 | '{db_prefix}log_comments', |
196 | 202 | array( |
197 | 203 | 'id_member' => 'int', 'member_name' => 'string', 'comment_type' => 'string', 'id_recipient' => 'int', 'recipient_name' => 'string-255', |
@@ -203,14 +209,14 @@ discard block |
||
203 | 209 | ), |
204 | 210 | array('id_comment') |
205 | 211 | ); |
212 | + } |
|
206 | 213 | |
207 | 214 | // Make the change. |
208 | 215 | updateMemberData($memID, array('warning' => $_POST['warning_level'])); |
209 | 216 | |
210 | 217 | // Leave a lovely message. |
211 | 218 | $context['profile_updated'] = $context['user']['is_owner'] ? $txt['profile_updated_own'] : $txt['profile_warning_success']; |
212 | - } |
|
213 | - else |
|
219 | + } else |
|
214 | 220 | { |
215 | 221 | // Try to remember some bits. |
216 | 222 | $context['warning_data'] = array( |
@@ -229,8 +235,9 @@ discard block |
||
229 | 235 | { |
230 | 236 | $warning_body = !empty($_POST['warn_body']) ? trim(censorText($_POST['warn_body'])) : ''; |
231 | 237 | $context['preview_subject'] = !empty($_POST['warn_sub']) ? trim($smcFunc['htmlspecialchars']($_POST['warn_sub'])) : ''; |
232 | - if (empty($_POST['warn_sub']) || empty($_POST['warn_body'])) |
|
233 | - $issueErrors[] = 'warning_notify_blank'; |
|
238 | + if (empty($_POST['warn_sub']) || empty($_POST['warn_body'])) { |
|
239 | + $issueErrors[] = 'warning_notify_blank'; |
|
240 | + } |
|
234 | 241 | |
235 | 242 | if (!empty($_POST['warn_body'])) |
236 | 243 | { |
@@ -254,8 +261,9 @@ discard block |
||
254 | 261 | { |
255 | 262 | // Fill in the suite of errors. |
256 | 263 | $context['post_errors'] = array(); |
257 | - foreach ($issueErrors as $error) |
|
258 | - $context['post_errors'][] = $txt[$error]; |
|
264 | + foreach ($issueErrors as $error) { |
|
265 | + $context['post_errors'][] = $txt[$error]; |
|
266 | + } |
|
259 | 267 | } |
260 | 268 | |
261 | 269 | |
@@ -272,9 +280,10 @@ discard block |
||
272 | 280 | $modSettings['warning_mute'] => $txt['profile_warning_effect_mute'], |
273 | 281 | ); |
274 | 282 | $context['current_level'] = 0; |
275 | - foreach ($context['level_effects'] as $limit => $dummy) |
|
276 | - if ($context['member']['warning'] >= $limit) |
|
283 | + foreach ($context['level_effects'] as $limit => $dummy) { |
|
284 | + if ($context['member']['warning'] >= $limit) |
|
277 | 285 | $context['current_level'] = $limit; |
286 | + } |
|
278 | 287 | |
279 | 288 | $listOptions = array( |
280 | 289 | 'id' => 'view_warnings', |
@@ -337,11 +346,12 @@ discard block |
||
337 | 346 | ' . $warning['reason'] . ' |
338 | 347 | </div>'; |
339 | 348 | |
340 | - if (!empty($warning['id_notice'])) |
|
341 | - $ret .= ' |
|
349 | + if (!empty($warning['id_notice'])) { |
|
350 | + $ret .= ' |
|
342 | 351 | <div class="floatright"> |
343 | 352 | <a href="' . $scripturl . '?action=moderate;area=notice;nid=' . $warning['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> |
344 | 353 | </div>'; |
354 | + } |
|
345 | 355 | |
346 | 356 | return $ret; |
347 | 357 | }, |
@@ -413,8 +423,9 @@ discard block |
||
413 | 423 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
414 | 424 | { |
415 | 425 | // If we're not warning for a message skip any that are. |
416 | - if (!$context['warning_for_message'] && strpos($row['body'], '{MESSAGE}') !== false) |
|
417 | - continue; |
|
426 | + if (!$context['warning_for_message'] && strpos($row['body'], '{MESSAGE}') !== false) { |
|
427 | + continue; |
|
428 | + } |
|
418 | 429 | |
419 | 430 | $context['notification_templates'][] = array( |
420 | 431 | 'title' => $row['template_title'], |
@@ -424,16 +435,18 @@ discard block |
||
424 | 435 | $smcFunc['db_free_result']($request); |
425 | 436 | |
426 | 437 | // Setup the "default" templates. |
427 | - foreach (array('spamming', 'offence', 'insulting') as $type) |
|
428 | - $context['notification_templates'][] = array( |
|
438 | + foreach (array('spamming', 'offence', 'insulting') as $type) { |
|
439 | + $context['notification_templates'][] = array( |
|
429 | 440 | 'title' => $txt['profile_warning_notify_title_' . $type], |
430 | 441 | 'body' => sprintf($txt['profile_warning_notify_template_outline' . (!empty($context['warning_for_message']) ? '_post' : '')], $txt['profile_warning_notify_for_' . $type]), |
431 | 442 | ); |
443 | + } |
|
432 | 444 | |
433 | 445 | // Replace all the common variables in the templates. |
434 | - foreach ($context['notification_templates'] as $k => $name) |
|
435 | - $context['notification_templates'][$k]['body'] = strtr($name['body'], array('{MEMBER}' => un_htmlspecialchars($context['member']['name']), '{MESSAGE}' => '[url=' . $scripturl . '?msg=' . $context['warning_for_message'] . ']' . un_htmlspecialchars($context['warned_message_subject']) . '[/url]', '{SCRIPTURL}' => $scripturl, '{FORUMNAME}' => $mbname, '{REGARDS}' => $txt['regards_team'])); |
|
436 | -} |
|
446 | + foreach ($context['notification_templates'] as $k => $name) { |
|
447 | + $context['notification_templates'][$k]['body'] = strtr($name['body'], array('{MEMBER}' => un_htmlspecialchars($context['member']['name']), '{MESSAGE}' => '[url=' . $scripturl . '?msg=' . $context['warning_for_message'] . ']' . un_htmlspecialchars($context['warned_message_subject']) . '[/url]', '{SCRIPTURL}' => $scripturl, '{FORUMNAME}' => $mbname, '{REGARDS}' => $txt['regards_team'])); |
|
448 | + } |
|
449 | + } |
|
437 | 450 | |
438 | 451 | /** |
439 | 452 | * Get the number of warnings a user has. Callback for $listOptions['get_count'] in issueWarning() |
@@ -517,10 +530,11 @@ discard block |
||
517 | 530 | { |
518 | 531 | global $txt, $context, $modSettings, $cur_profile; |
519 | 532 | |
520 | - if (!$context['user']['is_owner']) |
|
521 | - isAllowedTo('profile_remove_any'); |
|
522 | - elseif (!allowedTo('profile_remove_any')) |
|
523 | - isAllowedTo('profile_remove_own'); |
|
533 | + if (!$context['user']['is_owner']) { |
|
534 | + isAllowedTo('profile_remove_any'); |
|
535 | + } elseif (!allowedTo('profile_remove_any')) { |
|
536 | + isAllowedTo('profile_remove_own'); |
|
537 | + } |
|
524 | 538 | |
525 | 539 | // Permissions for removing stuff... |
526 | 540 | $context['can_delete_posts'] = !$context['user']['is_owner'] && allowedTo('moderate_forum'); |
@@ -547,10 +561,11 @@ discard block |
||
547 | 561 | |
548 | 562 | // @todo Add a way to delete pms as well? |
549 | 563 | |
550 | - if (!$context['user']['is_owner']) |
|
551 | - isAllowedTo('profile_remove_any'); |
|
552 | - elseif (!allowedTo('profile_remove_any')) |
|
553 | - isAllowedTo('profile_remove_own'); |
|
564 | + if (!$context['user']['is_owner']) { |
|
565 | + isAllowedTo('profile_remove_any'); |
|
566 | + } elseif (!allowedTo('profile_remove_any')) { |
|
567 | + isAllowedTo('profile_remove_own'); |
|
568 | + } |
|
554 | 569 | |
555 | 570 | checkSession(); |
556 | 571 | |
@@ -576,8 +591,9 @@ discard block |
||
576 | 591 | list ($another) = $smcFunc['db_fetch_row']($request); |
577 | 592 | $smcFunc['db_free_result']($request); |
578 | 593 | |
579 | - if (empty($another)) |
|
580 | - fatal_lang_error('at_least_one_admin', 'critical'); |
|
594 | + if (empty($another)) { |
|
595 | + fatal_lang_error('at_least_one_admin', 'critical'); |
|
596 | + } |
|
581 | 597 | } |
582 | 598 | |
583 | 599 | // This file is needed for the deleteMembers function. |
@@ -656,8 +672,9 @@ discard block |
||
656 | 672 | ) |
657 | 673 | ); |
658 | 674 | $topicIDs = array(); |
659 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
660 | - $topicIDs[] = $row['id_topic']; |
|
675 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
676 | + $topicIDs[] = $row['id_topic']; |
|
677 | + } |
|
661 | 678 | $smcFunc['db_free_result']($request); |
662 | 679 | |
663 | 680 | // Actually remove the topics. Ignore recycling if we want to perma-delete things... |
@@ -680,8 +697,9 @@ discard block |
||
680 | 697 | // This could take a while... but ya know it's gonna be worth it in the end. |
681 | 698 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
682 | 699 | { |
683 | - if (function_exists('apache_reset_timeout')) |
|
684 | - @apache_reset_timeout(); |
|
700 | + if (function_exists('apache_reset_timeout')) { |
|
701 | + @apache_reset_timeout(); |
|
702 | + } |
|
685 | 703 | |
686 | 704 | removeMessage($row['id_msg']); |
687 | 705 | } |
@@ -689,8 +707,9 @@ discard block |
||
689 | 707 | } |
690 | 708 | |
691 | 709 | // Only delete this poor members account if they are actually being booted out of camp. |
692 | - if (isset($_POST['deleteAccount'])) |
|
693 | - deleteMembers($memID); |
|
710 | + if (isset($_POST['deleteAccount'])) { |
|
711 | + deleteMembers($memID); |
|
712 | + } |
|
694 | 713 | } |
695 | 714 | // Do they need approval to delete? |
696 | 715 | elseif (!empty($modSettings['approveAccountDeletion']) && !allowedTo('moderate_forum')) |
@@ -741,18 +760,18 @@ discard block |
||
741 | 760 | { |
742 | 761 | foreach ($costs as $duration => $cost) |
743 | 762 | { |
744 | - if ($cost != 0) |
|
745 | - $cost_array[$duration] = $cost; |
|
763 | + if ($cost != 0) { |
|
764 | + $cost_array[$duration] = $cost; |
|
765 | + } |
|
746 | 766 | } |
747 | - } |
|
748 | - else |
|
767 | + } else |
|
749 | 768 | { |
750 | 769 | $cost_array['fixed'] = $costs['fixed']; |
751 | 770 | } |
752 | 771 | |
753 | - if (empty($cost_array)) |
|
754 | - unset($context['subscriptions'][$id]); |
|
755 | - else |
|
772 | + if (empty($cost_array)) { |
|
773 | + unset($context['subscriptions'][$id]); |
|
774 | + } else |
|
756 | 775 | { |
757 | 776 | $context['subscriptions'][$id]['member'] = 0; |
758 | 777 | $context['subscriptions'][$id]['subscribed'] = false; |
@@ -765,13 +784,15 @@ discard block |
||
765 | 784 | foreach ($gateways as $id => $gateway) |
766 | 785 | { |
767 | 786 | $gateways[$id] = new $gateway['display_class'](); |
768 | - if (!$gateways[$id]->gatewayEnabled()) |
|
769 | - unset($gateways[$id]); |
|
787 | + if (!$gateways[$id]->gatewayEnabled()) { |
|
788 | + unset($gateways[$id]); |
|
789 | + } |
|
770 | 790 | } |
771 | 791 | |
772 | 792 | // No gateways yet? |
773 | - if (empty($gateways)) |
|
774 | - fatal_error($txt['paid_admin_not_setup_gateway']); |
|
793 | + if (empty($gateways)) { |
|
794 | + fatal_error($txt['paid_admin_not_setup_gateway']); |
|
795 | + } |
|
775 | 796 | |
776 | 797 | // Get the current subscriptions. |
777 | 798 | $request = $smcFunc['db_query']('', ' |
@@ -786,8 +807,9 @@ discard block |
||
786 | 807 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
787 | 808 | { |
788 | 809 | // The subscription must exist! |
789 | - if (!isset($context['subscriptions'][$row['id_subscribe']])) |
|
790 | - continue; |
|
810 | + if (!isset($context['subscriptions'][$row['id_subscribe']])) { |
|
811 | + continue; |
|
812 | + } |
|
791 | 813 | |
792 | 814 | $context['current'][$row['id_subscribe']] = array( |
793 | 815 | 'id' => $row['id_sublog'], |
@@ -801,8 +823,9 @@ discard block |
||
801 | 823 | 'status_text' => $row['status'] == 0 ? ($row['payments_pending'] ? $txt['paid_pending'] : $txt['paid_finished']) : $txt['paid_active'], |
802 | 824 | ); |
803 | 825 | |
804 | - if ($row['status'] == 1) |
|
805 | - $context['subscriptions'][$row['id_subscribe']]['subscribed'] = true; |
|
826 | + if ($row['status'] == 1) { |
|
827 | + $context['subscriptions'][$row['id_subscribe']]['subscribed'] = true; |
|
828 | + } |
|
806 | 829 | } |
807 | 830 | $smcFunc['db_free_result']($request); |
808 | 831 | |
@@ -853,21 +876,25 @@ discard block |
||
853 | 876 | if (isset($_GET['confirm']) && isset($_POST['sub_id']) && is_array($_POST['sub_id'])) |
854 | 877 | { |
855 | 878 | // Hopefully just one. |
856 | - foreach ($_POST['sub_id'] as $k => $v) |
|
857 | - $ID_SUB = (int) $k; |
|
879 | + foreach ($_POST['sub_id'] as $k => $v) { |
|
880 | + $ID_SUB = (int) $k; |
|
881 | + } |
|
858 | 882 | |
859 | - if (!isset($context['subscriptions'][$ID_SUB]) || $context['subscriptions'][$ID_SUB]['active'] == 0) |
|
860 | - fatal_lang_error('paid_sub_not_active'); |
|
883 | + if (!isset($context['subscriptions'][$ID_SUB]) || $context['subscriptions'][$ID_SUB]['active'] == 0) { |
|
884 | + fatal_lang_error('paid_sub_not_active'); |
|
885 | + } |
|
861 | 886 | |
862 | 887 | // Simplify... |
863 | 888 | $context['sub'] = $context['subscriptions'][$ID_SUB]; |
864 | 889 | $period = 'xx'; |
865 | - if ($context['sub']['flexible']) |
|
866 | - $period = isset($_POST['cur'][$ID_SUB]) && isset($context['sub']['costs'][$_POST['cur'][$ID_SUB]]) ? $_POST['cur'][$ID_SUB] : 'xx'; |
|
890 | + if ($context['sub']['flexible']) { |
|
891 | + $period = isset($_POST['cur'][$ID_SUB]) && isset($context['sub']['costs'][$_POST['cur'][$ID_SUB]]) ? $_POST['cur'][$ID_SUB] : 'xx'; |
|
892 | + } |
|
867 | 893 | |
868 | 894 | // Check we have a valid cost. |
869 | - if ($context['sub']['flexible'] && $period == 'xx') |
|
870 | - fatal_lang_error('paid_sub_not_active'); |
|
895 | + if ($context['sub']['flexible'] && $period == 'xx') { |
|
896 | + fatal_lang_error('paid_sub_not_active'); |
|
897 | + } |
|
871 | 898 | |
872 | 899 | // Sort out the cost/currency. |
873 | 900 | $context['currency'] = $modSettings['paid_currency_code']; |
@@ -880,8 +907,7 @@ discard block |
||
880 | 907 | $context['cost'] = sprintf($modSettings['paid_currency_symbol'], $context['value']) . '/' . $txt[$_POST['cur'][$ID_SUB]]; |
881 | 908 | // The period value for paypal. |
882 | 909 | $context['paypal_period'] = strtoupper(substr($_POST['cur'][$ID_SUB], 0, 1)); |
883 | - } |
|
884 | - else |
|
910 | + } else |
|
885 | 911 | { |
886 | 912 | // Real cost... |
887 | 913 | $context['value'] = $context['sub']['costs']['fixed']; |
@@ -898,13 +924,15 @@ discard block |
||
898 | 924 | foreach ($gateways as $id => $gateway) |
899 | 925 | { |
900 | 926 | $fields = $gateways[$id]->fetchGatewayFields($context['sub']['id'] . '+' . $memID, $context['sub'], $context['value'], $period, $scripturl . '?action=profile;u=' . $memID . ';area=subscriptions;sub_id=' . $context['sub']['id'] . ';done'); |
901 | - if (!empty($fields['form'])) |
|
902 | - $context['gateways'][] = $fields; |
|
927 | + if (!empty($fields['form'])) { |
|
928 | + $context['gateways'][] = $fields; |
|
929 | + } |
|
903 | 930 | } |
904 | 931 | |
905 | 932 | // Bugger?! |
906 | - if (empty($context['gateways'])) |
|
907 | - fatal_error($txt['paid_admin_not_setup_gateway']); |
|
933 | + if (empty($context['gateways'])) { |
|
934 | + fatal_error($txt['paid_admin_not_setup_gateway']); |
|
935 | + } |
|
908 | 936 | |
909 | 937 | // Now we are going to assume they want to take this out ;) |
910 | 938 | $new_data = array($context['sub']['id'], $context['value'], $period, 'prepay'); |
@@ -912,16 +940,19 @@ discard block |
||
912 | 940 | { |
913 | 941 | // What are the details like? |
914 | 942 | $current_pending = array(); |
915 | - if ($context['current'][$context['sub']['id']]['pending_details'] != '') |
|
916 | - $current_pending = smf_json_decode($context['current'][$context['sub']['id']]['pending_details'], true); |
|
943 | + if ($context['current'][$context['sub']['id']]['pending_details'] != '') { |
|
944 | + $current_pending = smf_json_decode($context['current'][$context['sub']['id']]['pending_details'], true); |
|
945 | + } |
|
917 | 946 | // Don't get silly. |
918 | - if (count($current_pending) > 9) |
|
919 | - $current_pending = array(); |
|
947 | + if (count($current_pending) > 9) { |
|
948 | + $current_pending = array(); |
|
949 | + } |
|
920 | 950 | $pending_count = 0; |
921 | 951 | // Only record real pending payments as will otherwise confuse the admin! |
922 | - foreach ($current_pending as $pending) |
|
923 | - if ($pending[3] == 'payback') |
|
952 | + foreach ($current_pending as $pending) { |
|
953 | + if ($pending[3] == 'payback') |
|
924 | 954 | $pending_count++; |
955 | + } |
|
925 | 956 | |
926 | 957 | if (!in_array($new_data, $current_pending)) |
927 | 958 | { |
@@ -966,9 +997,9 @@ discard block |
||
966 | 997 | |
967 | 998 | // Quit. |
968 | 999 | return; |
1000 | + } else { |
|
1001 | + $context['sub_template'] = 'user_subscription'; |
|
1002 | + } |
|
969 | 1003 | } |
970 | - else |
|
971 | - $context['sub_template'] = 'user_subscription'; |
|
972 | -} |
|
973 | 1004 | |
974 | 1005 | ?> |
975 | 1006 | \ No newline at end of file |
@@ -13,8 +13,9 @@ discard block |
||
13 | 13 | * @version 2.1 Beta 3 |
14 | 14 | */ |
15 | 15 | |
16 | -if (!defined('SMF')) |
|
16 | +if (!defined('SMF')) { |
|
17 | 17 | die('No direct access...'); |
18 | +} |
|
18 | 19 | |
19 | 20 | /** |
20 | 21 | * The main admin handling function.<br> |
@@ -444,8 +445,9 @@ discard block |
||
444 | 445 | foreach ($admin_includes as $include) |
445 | 446 | { |
446 | 447 | $include = strtr(trim($include), array('$boarddir' => $boarddir, '$sourcedir' => $sourcedir, '$themedir' => $settings['theme_dir'])); |
447 | - if (file_exists($include)) |
|
448 | - require_once($include); |
|
448 | + if (file_exists($include)) { |
|
449 | + require_once($include); |
|
450 | + } |
|
449 | 451 | } |
450 | 452 | } |
451 | 453 | |
@@ -457,24 +459,27 @@ discard block |
||
457 | 459 | unset($admin_areas); |
458 | 460 | |
459 | 461 | // Nothing valid? |
460 | - if ($admin_include_data == false) |
|
461 | - fatal_lang_error('no_access', false); |
|
462 | + if ($admin_include_data == false) { |
|
463 | + fatal_lang_error('no_access', false); |
|
464 | + } |
|
462 | 465 | |
463 | 466 | // Build the link tree. |
464 | 467 | $context['linktree'][] = array( |
465 | 468 | 'url' => $scripturl . '?action=admin', |
466 | 469 | 'name' => $txt['admin_center'], |
467 | 470 | ); |
468 | - if (isset($admin_include_data['current_area']) && $admin_include_data['current_area'] != 'index') |
|
469 | - $context['linktree'][] = array( |
|
471 | + if (isset($admin_include_data['current_area']) && $admin_include_data['current_area'] != 'index') { |
|
472 | + $context['linktree'][] = array( |
|
470 | 473 | 'url' => $scripturl . '?action=admin;area=' . $admin_include_data['current_area'] . ';' . $context['session_var'] . '=' . $context['session_id'], |
471 | 474 | 'name' => $admin_include_data['label'], |
472 | 475 | ); |
473 | - if (!empty($admin_include_data['current_subsection']) && $admin_include_data['subsections'][$admin_include_data['current_subsection']][0] != $admin_include_data['label']) |
|
474 | - $context['linktree'][] = array( |
|
476 | + } |
|
477 | + if (!empty($admin_include_data['current_subsection']) && $admin_include_data['subsections'][$admin_include_data['current_subsection']][0] != $admin_include_data['label']) { |
|
478 | + $context['linktree'][] = array( |
|
475 | 479 | 'url' => $scripturl . '?action=admin;area=' . $admin_include_data['current_area'] . ';sa=' . $admin_include_data['current_subsection'] . ';' . $context['session_var'] . '=' . $context['session_id'], |
476 | 480 | 'name' => $admin_include_data['subsections'][$admin_include_data['current_subsection']][0], |
477 | 481 | ); |
482 | + } |
|
478 | 483 | |
479 | 484 | // Make a note of the Unique ID for this menu. |
480 | 485 | $context['admin_menu_id'] = $context['max_menu_id']; |
@@ -484,16 +489,18 @@ discard block |
||
484 | 489 | $context['admin_area'] = $admin_include_data['current_area']; |
485 | 490 | |
486 | 491 | // Now - finally - call the right place! |
487 | - if (isset($admin_include_data['file'])) |
|
488 | - require_once($sourcedir . '/' . $admin_include_data['file']); |
|
492 | + if (isset($admin_include_data['file'])) { |
|
493 | + require_once($sourcedir . '/' . $admin_include_data['file']); |
|
494 | + } |
|
489 | 495 | |
490 | 496 | // Get the right callable. |
491 | 497 | $call = call_helper($admin_include_data['function'], true); |
492 | 498 | |
493 | 499 | // Is it valid? |
494 | - if (!empty($call)) |
|
495 | - call_user_func($call); |
|
496 | -} |
|
500 | + if (!empty($call)) { |
|
501 | + call_user_func($call); |
|
502 | + } |
|
503 | + } |
|
497 | 504 | |
498 | 505 | /** |
499 | 506 | * The main administration section. |
@@ -547,13 +554,14 @@ discard block |
||
547 | 554 | |
548 | 555 | $context['sub_template'] = $context['admin_area'] == 'credits' ? 'credits' : 'admin'; |
549 | 556 | $context['page_title'] = $context['admin_area'] == 'credits' ? $txt['support_credits_title'] : $txt['admin_center']; |
550 | - if ($context['admin_area'] != 'credits') |
|
551 | - $context[$context['admin_menu_name']]['tab_data'] = array( |
|
557 | + if ($context['admin_area'] != 'credits') { |
|
558 | + $context[$context['admin_menu_name']]['tab_data'] = array( |
|
552 | 559 | 'title' => $txt['admin_center'], |
553 | 560 | 'help' => '', |
554 | 561 | 'description' => '<strong>' . $txt['hello_guest'] . ' ' . $context['user']['name'] . '!</strong> |
555 | 562 | ' . sprintf($txt['admin_main_welcome'], $txt['admin_center'], $txt['help'], $txt['help']), |
556 | 563 | ); |
564 | + } |
|
557 | 565 | |
558 | 566 | // Lastly, fill in the blanks in the support resources paragraphs. |
559 | 567 | $txt['support_resources_p1'] = sprintf($txt['support_resources_p1'], |
@@ -571,9 +579,10 @@ discard block |
||
571 | 579 | 'http://www.simplemachines.org/redirect/customize_support' |
572 | 580 | ); |
573 | 581 | |
574 | - if ($context['admin_area'] == 'admin') |
|
575 | - loadJavaScriptFile('admin.js', array('defer' => false), 'smf_admin'); |
|
576 | -} |
|
582 | + if ($context['admin_area'] == 'admin') { |
|
583 | + loadJavaScriptFile('admin.js', array('defer' => false), 'smf_admin'); |
|
584 | + } |
|
585 | + } |
|
577 | 586 | |
578 | 587 | /** |
579 | 588 | * Get one of the admin information files from Simple Machines. |
@@ -584,8 +593,9 @@ discard block |
||
584 | 593 | |
585 | 594 | setMemoryLimit('32M'); |
586 | 595 | |
587 | - if (empty($_REQUEST['filename']) || !is_string($_REQUEST['filename'])) |
|
588 | - fatal_lang_error('no_access', false); |
|
596 | + if (empty($_REQUEST['filename']) || !is_string($_REQUEST['filename'])) { |
|
597 | + fatal_lang_error('no_access', false); |
|
598 | + } |
|
589 | 599 | |
590 | 600 | // Strip off the forum cache part or we won't find it... |
591 | 601 | $_REQUEST['filename'] = str_replace($modSettings['browser_cache'], '', $_REQUEST['filename']); |
@@ -600,27 +610,30 @@ discard block |
||
600 | 610 | ) |
601 | 611 | ); |
602 | 612 | |
603 | - if ($smcFunc['db_num_rows']($request) == 0) |
|
604 | - fatal_lang_error('admin_file_not_found', true, array($_REQUEST['filename']), 404); |
|
613 | + if ($smcFunc['db_num_rows']($request) == 0) { |
|
614 | + fatal_lang_error('admin_file_not_found', true, array($_REQUEST['filename']), 404); |
|
615 | + } |
|
605 | 616 | |
606 | 617 | list ($file_data, $filetype) = $smcFunc['db_fetch_row']($request); |
607 | 618 | $smcFunc['db_free_result']($request); |
608 | 619 | |
609 | 620 | // @todo Temp |
610 | 621 | // Figure out if sesc is still being used. |
611 | - if (strpos($file_data, ';sesc=') !== false && $filetype == 'text/javascript') |
|
612 | - $file_data = ' |
|
622 | + if (strpos($file_data, ';sesc=') !== false && $filetype == 'text/javascript') { |
|
623 | + $file_data = ' |
|
613 | 624 | if (!(\'smfForum_sessionvar\' in window)) |
614 | 625 | window.smfForum_sessionvar = \'sesc\'; |
615 | 626 | ' . strtr($file_data, array(';sesc=' => ';\' + window.smfForum_sessionvar + \'=')); |
627 | + } |
|
616 | 628 | |
617 | 629 | $context['template_layers'] = array(); |
618 | 630 | // Lets make sure we aren't going to output anything nasty. |
619 | 631 | @ob_end_clean(); |
620 | - if (!empty($modSettings['enableCompressedOutput'])) |
|
621 | - @ob_start('ob_gzhandler'); |
|
622 | - else |
|
623 | - @ob_start(); |
|
632 | + if (!empty($modSettings['enableCompressedOutput'])) { |
|
633 | + @ob_start('ob_gzhandler'); |
|
634 | + } else { |
|
635 | + @ob_start(); |
|
636 | + } |
|
624 | 637 | |
625 | 638 | // Make sure they know what type of file we are. |
626 | 639 | header('Content-Type: ' . $filetype); |
@@ -660,11 +673,12 @@ discard block |
||
660 | 673 | updateAdminPreferences(); |
661 | 674 | } |
662 | 675 | |
663 | - if (trim($context['search_term']) == '') |
|
664 | - $context['search_results'] = array(); |
|
665 | - else |
|
666 | - call_helper($subActions[$context['search_type']]); |
|
667 | -} |
|
676 | + if (trim($context['search_term']) == '') { |
|
677 | + $context['search_results'] = array(); |
|
678 | + } else { |
|
679 | + call_helper($subActions[$context['search_type']]); |
|
680 | + } |
|
681 | + } |
|
668 | 682 | |
669 | 683 | /** |
670 | 684 | * A complicated but relatively quick internal search. |
@@ -728,8 +742,9 @@ discard block |
||
728 | 742 | |
729 | 743 | loadLanguage(implode('+', $language_files)); |
730 | 744 | |
731 | - foreach ($include_files as $file) |
|
732 | - require_once($sourcedir . '/' . $file . '.php'); |
|
745 | + foreach ($include_files as $file) { |
|
746 | + require_once($sourcedir . '/' . $file . '.php'); |
|
747 | + } |
|
733 | 748 | |
734 | 749 | /* This is the huge array that defines everything... it's a huge array of items formatted as follows: |
735 | 750 | 0 = Language index (Can be array of indexes) to search through for this setting. |
@@ -753,11 +768,12 @@ discard block |
||
753 | 768 | foreach ($section['areas'] as $menu_key => $menu_item) |
754 | 769 | { |
755 | 770 | $search_data['sections'][] = array($menu_item['label'], 'area=' . $menu_key); |
756 | - if (!empty($menu_item['subsections'])) |
|
757 | - foreach ($menu_item['subsections'] as $key => $sublabel) |
|
771 | + if (!empty($menu_item['subsections'])) { |
|
772 | + foreach ($menu_item['subsections'] as $key => $sublabel) |
|
758 | 773 | { |
759 | 774 | if (isset($sublabel['label'])) |
760 | 775 | $search_data['sections'][] = array($sublabel['label'], 'area=' . $menu_key . ';sa=' . $key); |
776 | + } |
|
761 | 777 | } |
762 | 778 | } |
763 | 779 | } |
@@ -767,9 +783,10 @@ discard block |
||
767 | 783 | // Get a list of their variables. |
768 | 784 | $config_vars = $setting_area[0](true); |
769 | 785 | |
770 | - foreach ($config_vars as $var) |
|
771 | - if (!empty($var[1]) && !in_array($var[0], array('permissions', 'switch', 'desc'))) |
|
786 | + foreach ($config_vars as $var) { |
|
787 | + if (!empty($var[1]) && !in_array($var[0], array('permissions', 'switch', 'desc'))) |
|
772 | 788 | $search_data['settings'][] = array($var[(isset($var[2]) && in_array($var[2], array('file', 'db'))) ? 0 : 1], $setting_area[1]); |
789 | + } |
|
773 | 790 | } |
774 | 791 | |
775 | 792 | $context['page_title'] = $txt['admin_search_results']; |
@@ -782,8 +799,9 @@ discard block |
||
782 | 799 | foreach ($data as $item) |
783 | 800 | { |
784 | 801 | $found = false; |
785 | - if (!is_array($item[0])) |
|
786 | - $item[0] = array($item[0]); |
|
802 | + if (!is_array($item[0])) { |
|
803 | + $item[0] = array($item[0]); |
|
804 | + } |
|
787 | 805 | foreach ($item[0] as $term) |
788 | 806 | { |
789 | 807 | if (stripos($term, $search_term) !== false || (isset($txt[$term]) && stripos($txt[$term], $search_term) !== false) || (isset($txt['setting_' . $term]) && stripos($txt['setting_' . $term], $search_term) !== false)) |
@@ -841,8 +859,9 @@ discard block |
||
841 | 859 | $postVars = explode(' ', $context['search_term']); |
842 | 860 | |
843 | 861 | // Encode the search data. |
844 | - foreach ($postVars as $k => $v) |
|
845 | - $postVars[$k] = urlencode($v); |
|
862 | + foreach ($postVars as $k => $v) { |
|
863 | + $postVars[$k] = urlencode($v); |
|
864 | + } |
|
846 | 865 | |
847 | 866 | // This is what we will send. |
848 | 867 | $postVars = implode('+', $postVars); |
@@ -854,8 +873,9 @@ discard block |
||
854 | 873 | $search_results = fetch_web_data($context['doc_apiurl'] . '?action=query&list=search&srprop=timestamp|snippet&format=xml&srwhat=text&srsearch=' . $postVars); |
855 | 874 | |
856 | 875 | // If we didn't get any xml back we are in trouble - perhaps the doc site is overloaded? |
857 | - if (!$search_results || preg_match('~<' . '\?xml\sversion="\d+\.\d+"\?' . '>\s*(<api>.+?</api>)~is', $search_results, $matches) != true) |
|
858 | - fatal_lang_error('cannot_connect_doc_site'); |
|
876 | + if (!$search_results || preg_match('~<' . '\?xml\sversion="\d+\.\d+"\?' . '>\s*(<api>.+?</api>)~is', $search_results, $matches) != true) { |
|
877 | + fatal_lang_error('cannot_connect_doc_site'); |
|
878 | + } |
|
859 | 879 | |
860 | 880 | $search_results = $matches[1]; |
861 | 881 | |
@@ -867,8 +887,9 @@ discard block |
||
867 | 887 | $results = new xmlArray($search_results, false); |
868 | 888 | |
869 | 889 | // Move through the api layer. |
870 | - if (!$results->exists('api')) |
|
871 | - fatal_lang_error('cannot_connect_doc_site'); |
|
890 | + if (!$results->exists('api')) { |
|
891 | + fatal_lang_error('cannot_connect_doc_site'); |
|
892 | + } |
|
872 | 893 | |
873 | 894 | // Are there actually some results? |
874 | 895 | if ($results->exists('api/query/search/p')) |
@@ -904,8 +925,9 @@ discard block |
||
904 | 925 | ); |
905 | 926 | |
906 | 927 | // If it's not got a sa set it must have come here for first time, pretend error log should be reversed. |
907 | - if (!isset($_REQUEST['sa'])) |
|
908 | - $_REQUEST['desc'] = true; |
|
928 | + if (!isset($_REQUEST['sa'])) { |
|
929 | + $_REQUEST['desc'] = true; |
|
930 | + } |
|
909 | 931 | |
910 | 932 | // Setup some tab stuff. |
911 | 933 | $context[$context['admin_menu_name']]['tab_data'] = array( |
@@ -955,9 +977,10 @@ discard block |
||
955 | 977 | unset($_SESSION['admin_time']); |
956 | 978 | |
957 | 979 | // Clean any admin tokens as well. |
958 | - foreach ($_SESSION['token'] as $key => $token) |
|
959 | - if (strpos($key, '-admin') !== false) |
|
980 | + foreach ($_SESSION['token'] as $key => $token) { |
|
981 | + if (strpos($key, '-admin') !== false) |
|
960 | 982 | unset($_SESSION['token'][$key]); |
983 | + } |
|
961 | 984 | |
962 | 985 | redirectexit(); |
963 | 986 | } |
@@ -16,8 +16,9 @@ discard block |
||
16 | 16 | * @version 2.1 Beta 3 |
17 | 17 | */ |
18 | 18 | |
19 | -if (!defined('SMF')) |
|
19 | +if (!defined('SMF')) { |
|
20 | 20 | die('No direct access...'); |
21 | +} |
|
21 | 22 | |
22 | 23 | |
23 | 24 | /** |
@@ -28,14 +29,16 @@ discard block |
||
28 | 29 | function sha1_smf($str) |
29 | 30 | { |
30 | 31 | // If we have mhash loaded in, use it instead! |
31 | - if (function_exists('mhash') && defined('MHASH_SHA1')) |
|
32 | - return bin2hex(mhash(MHASH_SHA1, $str)); |
|
32 | + if (function_exists('mhash') && defined('MHASH_SHA1')) { |
|
33 | + return bin2hex(mhash(MHASH_SHA1, $str)); |
|
34 | + } |
|
33 | 35 | |
34 | 36 | $nblk = (strlen($str) + 8 >> 6) + 1; |
35 | 37 | $blks = array_pad(array(), $nblk * 16, 0); |
36 | 38 | |
37 | - for ($i = 0; $i < strlen($str); $i++) |
|
38 | - $blks[$i >> 2] |= ord($str{$i}) << (24 - ($i % 4) * 8); |
|
39 | + for ($i = 0; $i < strlen($str); $i++) { |
|
40 | + $blks[$i >> 2] |= ord($str{$i}) << (24 - ($i % 4) * 8); |
|
41 | + } |
|
39 | 42 | |
40 | 43 | $blks[$i >> 2] |= 0x80 << (24 - ($i % 4) * 8); |
41 | 44 | |
@@ -70,10 +73,11 @@ discard block |
||
70 | 73 | |
71 | 74 | for ($j = 0; $j < 80; $j++) |
72 | 75 | { |
73 | - if ($j < 16) |
|
74 | - $w[$j] = isset($x[$i + $j]) ? $x[$i + $j] : 0; |
|
75 | - else |
|
76 | - $w[$j] = sha1_rol($w[$j - 3] ^ $w[$j - 8] ^ $w[$j - 14] ^ $w[$j - 16], 1); |
|
76 | + if ($j < 16) { |
|
77 | + $w[$j] = isset($x[$i + $j]) ? $x[$i + $j] : 0; |
|
78 | + } else { |
|
79 | + $w[$j] = sha1_rol($w[$j - 3] ^ $w[$j - 8] ^ $w[$j - 14] ^ $w[$j - 16], 1); |
|
80 | + } |
|
77 | 81 | |
78 | 82 | $t = sha1_rol($a, 5) + sha1_ft($j, $b, $c, $d) + $e + $w[$j] + sha1_kt($j); |
79 | 83 | $e = $d; |
@@ -103,12 +107,15 @@ discard block |
||
103 | 107 | */ |
104 | 108 | function sha1_ft($t, $b, $c, $d) |
105 | 109 | { |
106 | - if ($t < 20) |
|
107 | - return ($b & $c) | ((~$b) & $d); |
|
108 | - if ($t < 40) |
|
109 | - return $b ^ $c ^ $d; |
|
110 | - if ($t < 60) |
|
111 | - return ($b & $c) | ($b & $d) | ($c & $d); |
|
110 | + if ($t < 20) { |
|
111 | + return ($b & $c) | ((~$b) & $d); |
|
112 | + } |
|
113 | + if ($t < 40) { |
|
114 | + return $b ^ $c ^ $d; |
|
115 | + } |
|
116 | + if ($t < 60) { |
|
117 | + return ($b & $c) | ($b & $d) | ($c & $d); |
|
118 | + } |
|
112 | 119 | |
113 | 120 | return $b ^ $c ^ $d; |
114 | 121 | } |
@@ -132,10 +139,11 @@ discard block |
||
132 | 139 | function sha1_rol($num, $cnt) |
133 | 140 | { |
134 | 141 | // Unfortunately, PHP uses unsigned 32-bit longs only. So we have to kludge it a bit. |
135 | - if ($num & 0x80000000) |
|
136 | - $a = ($num >> 1 & 0x7fffffff) >> (31 - $cnt); |
|
137 | - else |
|
138 | - $a = $num >> (32 - $cnt); |
|
142 | + if ($num & 0x80000000) { |
|
143 | + $a = ($num >> 1 & 0x7fffffff) >> (31 - $cnt); |
|
144 | + } else { |
|
145 | + $a = $num >> (32 - $cnt); |
|
146 | + } |
|
139 | 147 | |
140 | 148 | return ($num << $cnt) | $a; |
141 | 149 | } |
@@ -518,7 +518,7 @@ |
||
518 | 518 | * @param array $parameters Not used? |
519 | 519 | * @param string $if_exists What to do if the index exists. If 'update', the definition will be updated. |
520 | 520 | * @param string $error |
521 | - * @return boolean Whether or not the operation was successful |
|
521 | + * @return false|null Whether or not the operation was successful |
|
522 | 522 | */ |
523 | 523 | function smf_db_add_index($table_name, $index_info, $parameters = array(), $if_exists = 'update', $error = 'fatal') |
524 | 524 | { |
@@ -13,8 +13,9 @@ discard block |
||
13 | 13 | * @version 2.1 Beta 3 |
14 | 14 | */ |
15 | 15 | |
16 | -if (!defined('SMF')) |
|
16 | +if (!defined('SMF')) { |
|
17 | 17 | die('No direct access...'); |
18 | +} |
|
18 | 19 | |
19 | 20 | /** |
20 | 21 | * Add the file functions to the $smcFunc array. |
@@ -52,8 +53,9 @@ discard block |
||
52 | 53 | 'messages', 'moderators', 'package_servers', 'permission_profiles', 'permissions', 'personal_messages', |
53 | 54 | 'pm_recipients', 'poll_choices', 'polls', 'scheduled_tasks', 'sessions', 'settings', 'smileys', |
54 | 55 | 'themes', 'topics'); |
55 | - foreach ($reservedTables as $k => $table_name) |
|
56 | - $reservedTables[$k] = strtolower($db_prefix . $table_name); |
|
56 | + foreach ($reservedTables as $k => $table_name) { |
|
57 | + $reservedTables[$k] = strtolower($db_prefix . $table_name); |
|
58 | + } |
|
57 | 59 | |
58 | 60 | // We in turn may need the extra stuff. |
59 | 61 | db_extend('extra'); |
@@ -105,8 +107,9 @@ discard block |
||
105 | 107 | $table_name = str_replace('{db_prefix}', $db_prefix, $table_name); |
106 | 108 | |
107 | 109 | // First - no way do we touch SMF tables. |
108 | - if (in_array(strtolower($table_name), $reservedTables)) |
|
109 | - return false; |
|
110 | + if (in_array(strtolower($table_name), $reservedTables)) { |
|
111 | + return false; |
|
112 | + } |
|
110 | 113 | |
111 | 114 | // Log that we'll want to remove this on uninstall. |
112 | 115 | $db_package_log[] = array('remove_table', $table_name); |
@@ -116,16 +119,18 @@ discard block |
||
116 | 119 | if (in_array($full_table_name, $tables)) |
117 | 120 | { |
118 | 121 | // This is a sad day... drop the table? If not, return false (error) by default. |
119 | - if ($if_exists == 'overwrite') |
|
120 | - $smcFunc['db_drop_table']($table_name); |
|
121 | - else |
|
122 | - return $if_exists == 'ignore'; |
|
122 | + if ($if_exists == 'overwrite') { |
|
123 | + $smcFunc['db_drop_table']($table_name); |
|
124 | + } else { |
|
125 | + return $if_exists == 'ignore'; |
|
126 | + } |
|
123 | 127 | } |
124 | 128 | |
125 | 129 | // Righty - let's do the damn thing! |
126 | 130 | $table_query = 'CREATE TABLE ' . $table_name . "\n" . '('; |
127 | - foreach ($columns as $column) |
|
128 | - $table_query .= "\n\t" . smf_db_create_query_column($column) . ','; |
|
131 | + foreach ($columns as $column) { |
|
132 | + $table_query .= "\n\t" . smf_db_create_query_column($column) . ','; |
|
133 | + } |
|
129 | 134 | |
130 | 135 | // Loop through the indexes next... |
131 | 136 | foreach ($indexes as $index) |
@@ -133,19 +138,21 @@ discard block |
||
133 | 138 | $columns = implode(',', $index['columns']); |
134 | 139 | |
135 | 140 | // Is it the primary? |
136 | - if (isset($index['type']) && $index['type'] == 'primary') |
|
137 | - $table_query .= "\n\t" . 'PRIMARY KEY (' . implode(',', $index['columns']) . '),'; |
|
138 | - else |
|
141 | + if (isset($index['type']) && $index['type'] == 'primary') { |
|
142 | + $table_query .= "\n\t" . 'PRIMARY KEY (' . implode(',', $index['columns']) . '),'; |
|
143 | + } else |
|
139 | 144 | { |
140 | - if (empty($index['name'])) |
|
141 | - $index['name'] = implode('_', $index['columns']); |
|
145 | + if (empty($index['name'])) { |
|
146 | + $index['name'] = implode('_', $index['columns']); |
|
147 | + } |
|
142 | 148 | $table_query .= "\n\t" . (isset($index['type']) && $index['type'] == 'unique' ? 'UNIQUE' : 'KEY') . ' ' . $index['name'] . ' (' . $columns . '),'; |
143 | 149 | } |
144 | 150 | } |
145 | 151 | |
146 | 152 | // No trailing commas! |
147 | - if (substr($table_query, -1) == ',') |
|
148 | - $table_query = substr($table_query, 0, -1); |
|
153 | + if (substr($table_query, -1) == ',') { |
|
154 | + $table_query = substr($table_query, 0, -1); |
|
155 | + } |
|
149 | 156 | |
150 | 157 | // Which engine do we want here? |
151 | 158 | if (empty($engines)) |
@@ -155,8 +162,9 @@ discard block |
||
155 | 162 | |
156 | 163 | while ($row = $smcFunc['db_fetch_assoc']($get_engines)) |
157 | 164 | { |
158 | - if ($row['Support'] == 'YES' || $row['Support'] == 'DEFAULT') |
|
159 | - $engines[] = $row['Engine']; |
|
165 | + if ($row['Support'] == 'YES' || $row['Support'] == 'DEFAULT') { |
|
166 | + $engines[] = $row['Engine']; |
|
167 | + } |
|
160 | 168 | } |
161 | 169 | |
162 | 170 | $smcFunc['db_free_result']($get_engines); |
@@ -170,8 +178,9 @@ discard block |
||
170 | 178 | } |
171 | 179 | |
172 | 180 | $table_query .= ') ENGINE=' . $parameters['engine']; |
173 | - if (!empty($db_character_set) && $db_character_set == 'utf8') |
|
174 | - $table_query .= ' DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci'; |
|
181 | + if (!empty($db_character_set) && $db_character_set == 'utf8') { |
|
182 | + $table_query .= ' DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci'; |
|
183 | + } |
|
175 | 184 | |
176 | 185 | // Create the table! |
177 | 186 | $smcFunc['db_query']('', $table_query, |
@@ -203,8 +212,9 @@ discard block |
||
203 | 212 | $table_name = str_replace('{db_prefix}', $db_prefix, $table_name); |
204 | 213 | |
205 | 214 | // God no - dropping one of these = bad. |
206 | - if (in_array(strtolower($table_name), $reservedTables)) |
|
207 | - return false; |
|
215 | + if (in_array(strtolower($table_name), $reservedTables)) { |
|
216 | + return false; |
|
217 | + } |
|
208 | 218 | |
209 | 219 | // Does it exist? |
210 | 220 | if (in_array($full_table_name, $smcFunc['db_list_tables']())) |
@@ -245,14 +255,16 @@ discard block |
||
245 | 255 | |
246 | 256 | // Does it exist - if so don't add it again! |
247 | 257 | $columns = $smcFunc['db_list_columns']($table_name, false); |
248 | - foreach ($columns as $column) |
|
249 | - if ($column == $column_info['name']) |
|
258 | + foreach ($columns as $column) { |
|
259 | + if ($column == $column_info['name']) |
|
250 | 260 | { |
251 | 261 | // If we're going to overwrite then use change column. |
252 | 262 | if ($if_exists == 'update') |
253 | 263 | return $smcFunc['db_change_column']($table_name, $column_info['name'], $column_info); |
254 | - else |
|
255 | - return false; |
|
264 | + } |
|
265 | + else { |
|
266 | + return false; |
|
267 | + } |
|
256 | 268 | } |
257 | 269 | |
258 | 270 | // Get the specifics... |
@@ -262,8 +274,9 @@ discard block |
||
262 | 274 | // Allow unsigned integers (mysql only) |
263 | 275 | $unsigned = in_array($type, array('int', 'tinyint', 'smallint', 'mediumint', 'bigint')) && !empty($column_info['unsigned']) ? 'unsigned ' : ''; |
264 | 276 | |
265 | - if ($size !== null) |
|
266 | - $type = $type . '(' . $size . ')'; |
|
277 | + if ($size !== null) { |
|
278 | + $type = $type . '(' . $size . ')'; |
|
279 | + } |
|
267 | 280 | |
268 | 281 | // Now add the thing! |
269 | 282 | $query = ' |
@@ -295,8 +308,8 @@ discard block |
||
295 | 308 | |
296 | 309 | // Does it exist? |
297 | 310 | $columns = $smcFunc['db_list_columns']($table_name, true); |
298 | - foreach ($columns as $column) |
|
299 | - if ($column['name'] == $column_name) |
|
311 | + foreach ($columns as $column) { |
|
312 | + if ($column['name'] == $column_name) |
|
300 | 313 | { |
301 | 314 | $smcFunc['db_query']('', ' |
302 | 315 | ALTER TABLE ' . $table_name . ' |
@@ -305,6 +318,7 @@ discard block |
||
305 | 318 | 'security_override' => true, |
306 | 319 | ) |
307 | 320 | ); |
321 | + } |
|
308 | 322 | |
309 | 323 | return true; |
310 | 324 | } |
@@ -331,37 +345,47 @@ discard block |
||
331 | 345 | // Check it does exist! |
332 | 346 | $columns = $smcFunc['db_list_columns']($table_name, true); |
333 | 347 | $old_info = null; |
334 | - foreach ($columns as $column) |
|
335 | - if ($column['name'] == $old_column) |
|
348 | + foreach ($columns as $column) { |
|
349 | + if ($column['name'] == $old_column) |
|
336 | 350 | $old_info = $column; |
351 | + } |
|
337 | 352 | |
338 | 353 | // Nothing? |
339 | - if ($old_info == null) |
|
340 | - return false; |
|
354 | + if ($old_info == null) { |
|
355 | + return false; |
|
356 | + } |
|
341 | 357 | |
342 | 358 | // Get the right bits. |
343 | - if (!isset($column_info['name'])) |
|
344 | - $column_info['name'] = $old_column; |
|
345 | - if (!isset($column_info['default'])) |
|
346 | - $column_info['default'] = $old_info['default']; |
|
347 | - if (!isset($column_info['null'])) |
|
348 | - $column_info['null'] = $old_info['null']; |
|
349 | - if (!isset($column_info['auto'])) |
|
350 | - $column_info['auto'] = $old_info['auto']; |
|
351 | - if (!isset($column_info['type'])) |
|
352 | - $column_info['type'] = $old_info['type']; |
|
353 | - if (!isset($column_info['size']) || !is_numeric($column_info['size'])) |
|
354 | - $column_info['size'] = $old_info['size']; |
|
355 | - if (!isset($column_info['unsigned']) || !in_array($column_info['type'], array('int', 'tinyint', 'smallint', 'mediumint', 'bigint'))) |
|
356 | - $column_info['unsigned'] = ''; |
|
359 | + if (!isset($column_info['name'])) { |
|
360 | + $column_info['name'] = $old_column; |
|
361 | + } |
|
362 | + if (!isset($column_info['default'])) { |
|
363 | + $column_info['default'] = $old_info['default']; |
|
364 | + } |
|
365 | + if (!isset($column_info['null'])) { |
|
366 | + $column_info['null'] = $old_info['null']; |
|
367 | + } |
|
368 | + if (!isset($column_info['auto'])) { |
|
369 | + $column_info['auto'] = $old_info['auto']; |
|
370 | + } |
|
371 | + if (!isset($column_info['type'])) { |
|
372 | + $column_info['type'] = $old_info['type']; |
|
373 | + } |
|
374 | + if (!isset($column_info['size']) || !is_numeric($column_info['size'])) { |
|
375 | + $column_info['size'] = $old_info['size']; |
|
376 | + } |
|
377 | + if (!isset($column_info['unsigned']) || !in_array($column_info['type'], array('int', 'tinyint', 'smallint', 'mediumint', 'bigint'))) { |
|
378 | + $column_info['unsigned'] = ''; |
|
379 | + } |
|
357 | 380 | |
358 | 381 | list ($type, $size) = $smcFunc['db_calculate_type']($column_info['type'], $column_info['size']); |
359 | 382 | |
360 | 383 | // Allow for unsigned integers (mysql only) |
361 | 384 | $unsigned = in_array($type, array('int', 'tinyint', 'smallint', 'mediumint', 'bigint')) && !empty($column_info['unsigned']) ? 'unsigned ' : ''; |
362 | 385 | |
363 | - if ($size !== null) |
|
364 | - $type = $type . '(' . $size . ')'; |
|
386 | + if ($size !== null) { |
|
387 | + $type = $type . '(' . $size . ')'; |
|
388 | + } |
|
365 | 389 | |
366 | 390 | $smcFunc['db_query']('', ' |
367 | 391 | ALTER TABLE ' . $table_name . ' |
@@ -391,21 +415,23 @@ discard block |
||
391 | 415 | $table_name = str_replace('{db_prefix}', $db_prefix, $table_name); |
392 | 416 | |
393 | 417 | // No columns = no index. |
394 | - if (empty($index_info['columns'])) |
|
395 | - return false; |
|
418 | + if (empty($index_info['columns'])) { |
|
419 | + return false; |
|
420 | + } |
|
396 | 421 | $columns = implode(',', $index_info['columns']); |
397 | 422 | |
398 | 423 | // No name - make it up! |
399 | 424 | if (empty($index_info['name'])) |
400 | 425 | { |
401 | 426 | // No need for primary. |
402 | - if (isset($index_info['type']) && $index_info['type'] == 'primary') |
|
403 | - $index_info['name'] = ''; |
|
404 | - else |
|
405 | - $index_info['name'] = implode('_', $index_info['columns']); |
|
427 | + if (isset($index_info['type']) && $index_info['type'] == 'primary') { |
|
428 | + $index_info['name'] = ''; |
|
429 | + } else { |
|
430 | + $index_info['name'] = implode('_', $index_info['columns']); |
|
431 | + } |
|
432 | + } else { |
|
433 | + $index_info['name'] = $index_info['name']; |
|
406 | 434 | } |
407 | - else |
|
408 | - $index_info['name'] = $index_info['name']; |
|
409 | 435 | |
410 | 436 | // Log that we are going to want to remove this! |
411 | 437 | $db_package_log[] = array('remove_index', $table_name, $index_info['name']); |
@@ -418,10 +444,11 @@ discard block |
||
418 | 444 | if ($index['name'] == $index_info['name'] || ($index['type'] == 'primary' && isset($index_info['type']) && $index_info['type'] == 'primary')) |
419 | 445 | { |
420 | 446 | // If we want to overwrite simply remove the current one then continue. |
421 | - if ($if_exists != 'update' || $index['type'] == 'primary') |
|
422 | - return false; |
|
423 | - else |
|
424 | - $smcFunc['db_remove_index']($table_name, $index_info['name']); |
|
447 | + if ($if_exists != 'update' || $index['type'] == 'primary') { |
|
448 | + return false; |
|
449 | + } else { |
|
450 | + $smcFunc['db_remove_index']($table_name, $index_info['name']); |
|
451 | + } |
|
425 | 452 | } |
426 | 453 | } |
427 | 454 | |
@@ -435,8 +462,7 @@ discard block |
||
435 | 462 | 'security_override' => true, |
436 | 463 | ) |
437 | 464 | ); |
438 | - } |
|
439 | - else |
|
465 | + } else |
|
440 | 466 | { |
441 | 467 | $smcFunc['db_query']('', ' |
442 | 468 | ALTER TABLE ' . $table_name . ' |
@@ -520,8 +546,7 @@ discard block |
||
520 | 546 | $types = array( |
521 | 547 | 'inet' => 'varbinary', |
522 | 548 | ); |
523 | - } |
|
524 | - else |
|
549 | + } else |
|
525 | 550 | { |
526 | 551 | $types = array( |
527 | 552 | 'varbinary' => 'inet', |
@@ -535,16 +560,15 @@ discard block |
||
535 | 560 | { |
536 | 561 | $type_size = 16; |
537 | 562 | $type_name = 'varbinary'; |
538 | - } |
|
539 | - elseif ($type_name == 'varbinary' && $reverse && $type_size == 16) |
|
563 | + } elseif ($type_name == 'varbinary' && $reverse && $type_size == 16) |
|
540 | 564 | { |
541 | 565 | $type_name = 'inet'; |
542 | 566 | $type_size = null; |
567 | + } elseif ($type_name == 'varbinary') { |
|
568 | + $type_name = 'varbinary'; |
|
569 | + } else { |
|
570 | + $type_name = $types[$type_name]; |
|
543 | 571 | } |
544 | - elseif ($type_name == 'varbinary') |
|
545 | - $type_name = 'varbinary'; |
|
546 | - else |
|
547 | - $type_name = $types[$type_name]; |
|
548 | 572 | } |
549 | 573 | |
550 | 574 | return array($type_name, $type_size); |
@@ -612,8 +636,7 @@ discard block |
||
612 | 636 | if (!$detail) |
613 | 637 | { |
614 | 638 | $columns[] = $row['Field']; |
615 | - } |
|
616 | - else |
|
639 | + } else |
|
617 | 640 | { |
618 | 641 | // Is there an auto_increment? |
619 | 642 | $auto = strpos($row['Extra'], 'auto_increment') !== false ? true : false; |
@@ -623,10 +646,10 @@ discard block |
||
623 | 646 | { |
624 | 647 | $type = $matches[1]; |
625 | 648 | $size = $matches[2]; |
626 | - if (!empty($matches[3]) && $matches[3] == 'unsigned') |
|
627 | - $unsigned = true; |
|
628 | - } |
|
629 | - else |
|
649 | + if (!empty($matches[3]) && $matches[3] == 'unsigned') { |
|
650 | + $unsigned = true; |
|
651 | + } |
|
652 | + } else |
|
630 | 653 | { |
631 | 654 | $type = $row['Type']; |
632 | 655 | $size = null; |
@@ -677,19 +700,20 @@ discard block |
||
677 | 700 | $indexes = array(); |
678 | 701 | while ($row = $smcFunc['db_fetch_assoc']($result)) |
679 | 702 | { |
680 | - if (!$detail) |
|
681 | - $indexes[] = $row['Key_name']; |
|
682 | - else |
|
703 | + if (!$detail) { |
|
704 | + $indexes[] = $row['Key_name']; |
|
705 | + } else |
|
683 | 706 | { |
684 | 707 | // What is the type? |
685 | - if ($row['Key_name'] == 'PRIMARY') |
|
686 | - $type = 'primary'; |
|
687 | - elseif (empty($row['Non_unique'])) |
|
688 | - $type = 'unique'; |
|
689 | - elseif (isset($row['Index_type']) && $row['Index_type'] == 'FULLTEXT') |
|
690 | - $type = 'fulltext'; |
|
691 | - else |
|
692 | - $type = 'index'; |
|
708 | + if ($row['Key_name'] == 'PRIMARY') { |
|
709 | + $type = 'primary'; |
|
710 | + } elseif (empty($row['Non_unique'])) { |
|
711 | + $type = 'unique'; |
|
712 | + } elseif (isset($row['Index_type']) && $row['Index_type'] == 'FULLTEXT') { |
|
713 | + $type = 'fulltext'; |
|
714 | + } else { |
|
715 | + $type = 'index'; |
|
716 | + } |
|
693 | 717 | |
694 | 718 | // This is the first column we've seen? |
695 | 719 | if (empty($indexes[$row['Key_name']])) |
@@ -702,10 +726,11 @@ discard block |
||
702 | 726 | } |
703 | 727 | |
704 | 728 | // Is it a partial index? |
705 | - if (!empty($row['Sub_part'])) |
|
706 | - $indexes[$row['Key_name']]['columns'][] = $row['Column_name'] . '(' . $row['Sub_part'] . ')'; |
|
707 | - else |
|
708 | - $indexes[$row['Key_name']]['columns'][] = $row['Column_name']; |
|
729 | + if (!empty($row['Sub_part'])) { |
|
730 | + $indexes[$row['Key_name']]['columns'][] = $row['Column_name'] . '(' . $row['Sub_part'] . ')'; |
|
731 | + } else { |
|
732 | + $indexes[$row['Key_name']]['columns'][] = $row['Column_name']; |
|
733 | + } |
|
709 | 734 | } |
710 | 735 | } |
711 | 736 | $smcFunc['db_free_result']($result); |
@@ -727,11 +752,11 @@ discard block |
||
727 | 752 | if (!empty($column['auto'])) |
728 | 753 | { |
729 | 754 | $default = 'auto_increment'; |
755 | + } elseif (isset($column['default']) && $column['default'] !== null) { |
|
756 | + $default = 'default \'' . $smcFunc['db_escape_string']($column['default']) . '\''; |
|
757 | + } else { |
|
758 | + $default = ''; |
|
730 | 759 | } |
731 | - elseif (isset($column['default']) && $column['default'] !== null) |
|
732 | - $default = 'default \'' . $smcFunc['db_escape_string']($column['default']) . '\''; |
|
733 | - else |
|
734 | - $default = ''; |
|
735 | 760 | |
736 | 761 | // Sort out the size... and stuff... |
737 | 762 | $column['size'] = isset($column['size']) && is_numeric($column['size']) ? $column['size'] : null; |
@@ -740,8 +765,9 @@ discard block |
||
740 | 765 | // Allow unsigned integers (mysql only) |
741 | 766 | $unsigned = in_array($type, array('int', 'tinyint', 'smallint', 'mediumint', 'bigint')) && !empty($column['unsigned']) ? 'unsigned ' : ''; |
742 | 767 | |
743 | - if ($size !== null) |
|
744 | - $type = $type . '(' . $size . ')'; |
|
768 | + if ($size !== null) { |
|
769 | + $type = $type . '(' . $size . ')'; |
|
770 | + } |
|
745 | 771 | |
746 | 772 | // Now just put it together! |
747 | 773 | return '`' . $column['name'] . '` ' . $type . ' ' . (!empty($unsigned) ? $unsigned : '') . (!empty($column['null']) ? '' : 'NOT NULL') . ' ' . $default; |
@@ -12,7 +12,8 @@ |
||
12 | 12 | header('Location: ' . $boardurl); |
13 | 13 | } |
14 | 14 | // Can't find it... just forget it. |
15 | -else |
|
15 | +else { |
|
16 | 16 | exit; |
17 | +} |
|
17 | 18 | |
18 | 19 | ?> |
19 | 20 | \ No newline at end of file |