@@ -46,9 +46,10 @@ discard block |
||
| 46 | 46 | |
| 47 | 47 | foreach ($prefs as $member => $pref_option) |
| 48 | 48 | { |
| 49 | - foreach ($alert_bits as $type => $bitvalue) |
|
| 50 | - if ($pref_option['member_report'] & $bitvalue) |
|
| 49 | + foreach ($alert_bits as $type => $bitvalue) { |
|
| 50 | + if ($pref_option['member_report'] & $bitvalue) |
|
| 51 | 51 | $notifies[$type][] = $member; |
| 52 | + } |
|
| 52 | 53 | } |
| 53 | 54 | |
| 54 | 55 | // Firstly, anyone who wants alerts. |
@@ -109,8 +110,9 @@ discard block |
||
| 109 | 110 | ); |
| 110 | 111 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
| 111 | 112 | { |
| 112 | - if (empty($row['lngfile'])) |
|
| 113 | - $row['lngfile'] = $language; |
|
| 113 | + if (empty($row['lngfile'])) { |
|
| 114 | + $row['lngfile'] = $language; |
|
| 115 | + } |
|
| 114 | 116 | $emails[$row['lngfile']][$row['id_member']] = $row['email_address']; |
| 115 | 117 | } |
| 116 | 118 | $smcFunc['db_free_result']($request); |
@@ -129,8 +131,9 @@ discard block |
||
| 129 | 131 | $emaildata = loadEmailTemplate('report_member_profile', $replacements, empty($modSettings['userLanguage']) ? $language : $this_lang); |
| 130 | 132 | |
| 131 | 133 | // And do the actual sending... |
| 132 | - foreach ($recipients as $id_member => $email_address) |
|
| 133 | - sendmail($email_address, $emaildata['subject'], $emaildata['body'], null, 'ureport' . $this->_details['report_id'], $emaildata['is_html'], 2); |
|
| 134 | + foreach ($recipients as $id_member => $email_address) { |
|
| 135 | + sendmail($email_address, $emaildata['subject'], $emaildata['body'], null, 'ureport' . $this->_details['report_id'], $emaildata['is_html'], 2); |
|
| 136 | + } |
|
| 134 | 137 | } |
| 135 | 138 | } |
| 136 | 139 | |
@@ -54,8 +54,9 @@ discard block |
||
| 54 | 54 | } |
| 55 | 55 | $smcFunc['db_free_result']($request); |
| 56 | 56 | |
| 57 | - if (empty($members)) |
|
| 58 | - return true; |
|
| 57 | + if (empty($members)) { |
|
| 58 | + return true; |
|
| 59 | + } |
|
| 59 | 60 | |
| 60 | 61 | require_once($sourcedir . '/Subs-Notify.php'); |
| 61 | 62 | $members = array_unique($members); |
@@ -103,14 +104,15 @@ discard block |
||
| 103 | 104 | } |
| 104 | 105 | |
| 105 | 106 | // Insert the alerts if any |
| 106 | - if (!empty($alert_rows)) |
|
| 107 | - $smcFunc['db_insert']('', |
|
| 107 | + if (!empty($alert_rows)) { |
|
| 108 | + $smcFunc['db_insert']('', |
|
| 108 | 109 | '{db_prefix}user_alerts', |
| 109 | 110 | array('alert_time' => 'int', 'id_member' => 'int', 'id_member_started' => 'int', 'member_name' => 'string', |
| 110 | 111 | 'content_type' => 'string', 'content_id' => 'int', 'content_action' => 'string', 'is_read' => 'int', 'extra' => 'string'), |
| 111 | 112 | $alert_rows, |
| 112 | 113 | array() |
| 113 | 114 | ); |
| 115 | + } |
|
| 114 | 116 | |
| 115 | 117 | return true; |
| 116 | 118 | } |
@@ -43,9 +43,10 @@ discard block |
||
| 43 | 43 | |
| 44 | 44 | foreach ($prefs as $member => $pref_option) |
| 45 | 45 | { |
| 46 | - foreach ($alert_bits as $type => $bitvalue) |
|
| 47 | - if ($pref_option['member_register'] & $bitvalue) |
|
| 46 | + foreach ($alert_bits as $type => $bitvalue) { |
|
| 47 | + if ($pref_option['member_register'] & $bitvalue) |
|
| 48 | 48 | $notifies[$type][] = $member; |
| 49 | + } |
|
| 49 | 50 | } |
| 50 | 51 | |
| 51 | 52 | // Firstly, anyone who wants alerts. |
@@ -101,8 +102,9 @@ discard block |
||
| 101 | 102 | ); |
| 102 | 103 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
| 103 | 104 | { |
| 104 | - if (empty($row['lngfile'])) |
|
| 105 | - $row['lngfile'] = $language; |
|
| 105 | + if (empty($row['lngfile'])) { |
|
| 106 | + $row['lngfile'] = $language; |
|
| 107 | + } |
|
| 106 | 108 | $emails[$row['lngfile']][$row['id_member']] = $row['email_address']; |
| 107 | 109 | } |
| 108 | 110 | $smcFunc['db_free_result']($request); |
@@ -126,8 +128,9 @@ discard block |
||
| 126 | 128 | $emaildata = loadEmailTemplate($emailtype, $replacements, empty($modSettings['userLanguage']) ? $language : $this_lang); |
| 127 | 129 | |
| 128 | 130 | // And do the actual sending... |
| 129 | - foreach ($recipients as $id_member => $email_address) |
|
| 130 | - sendmail($email_address, $emaildata['subject'], $emaildata['body'], null, 'newmember' . $this->_details['new_member_id'], $emaildata['is_html'], 0); |
|
| 131 | + foreach ($recipients as $id_member => $email_address) { |
|
| 132 | + sendmail($email_address, $emaildata['subject'], $emaildata['body'], null, 'newmember' . $this->_details['new_member_id'], $emaildata['is_html'], 0); |
|
| 133 | + } |
|
| 131 | 134 | } |
| 132 | 135 | } |
| 133 | 136 | |
@@ -40,8 +40,9 @@ discard block |
||
| 40 | 40 | 'current_board' => $this->_details['board_id'], |
| 41 | 41 | ) |
| 42 | 42 | ); |
| 43 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 44 | - $members[] = $row['id_member']; |
|
| 43 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 44 | + $members[] = $row['id_member']; |
|
| 45 | + } |
|
| 45 | 46 | $smcFunc['db_free_result']($request); |
| 46 | 47 | |
| 47 | 48 | // Thirdly, anyone assigned to be a moderator of this group as a group->board moderator. |
@@ -58,8 +59,9 @@ discard block |
||
| 58 | 59 | ) |
| 59 | 60 | ); |
| 60 | 61 | |
| 61 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 62 | - $members[] = $row['id_member']; |
|
| 62 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 63 | + $members[] = $row['id_member']; |
|
| 64 | + } |
|
| 63 | 65 | $smcFunc['db_free_result']($request); |
| 64 | 66 | |
| 65 | 67 | // And now weed out the duplicates. |
@@ -81,9 +83,10 @@ discard block |
||
| 81 | 83 | |
| 82 | 84 | foreach ($prefs as $member => $pref_option) |
| 83 | 85 | { |
| 84 | - foreach ($alert_bits as $type => $bitvalue) |
|
| 85 | - if ($pref_option['msg_report'] & $bitvalue) |
|
| 86 | + foreach ($alert_bits as $type => $bitvalue) { |
|
| 87 | + if ($pref_option['msg_report'] & $bitvalue) |
|
| 86 | 88 | $notifies[$type][] = $member; |
| 89 | + } |
|
| 87 | 90 | } |
| 88 | 91 | |
| 89 | 92 | // Firstly, anyone who wants alerts. |
@@ -143,8 +146,9 @@ discard block |
||
| 143 | 146 | ); |
| 144 | 147 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
| 145 | 148 | { |
| 146 | - if (empty($row['lngfile'])) |
|
| 147 | - $row['lngfile'] = $language; |
|
| 149 | + if (empty($row['lngfile'])) { |
|
| 150 | + $row['lngfile'] = $language; |
|
| 151 | + } |
|
| 148 | 152 | $emails[$row['lngfile']][$row['id_member']] = $row['email_address']; |
| 149 | 153 | } |
| 150 | 154 | $smcFunc['db_free_result']($request); |
@@ -177,8 +181,9 @@ discard block |
||
| 177 | 181 | $emaildata = loadEmailTemplate('report_to_moderator', $replacements, empty($modSettings['userLanguage']) ? $language : $this_lang); |
| 178 | 182 | |
| 179 | 183 | // And do the actual sending... |
| 180 | - foreach ($recipients as $id_member => $email_address) |
|
| 181 | - sendmail($email_address, $emaildata['subject'], $emaildata['body'], null, 'report' . $this->_details['report_id'], $emaildata['is_html'], 2); |
|
| 184 | + foreach ($recipients as $id_member => $email_address) { |
|
| 185 | + sendmail($email_address, $emaildata['subject'], $emaildata['body'], null, 'report' . $this->_details['report_id'], $emaildata['is_html'], 2); |
|
| 186 | + } |
|
| 182 | 187 | } |
| 183 | 188 | } |
| 184 | 189 | |
@@ -40,8 +40,9 @@ discard block |
||
| 40 | 40 | 'last_comment' => $this->_details['comment_id'], |
| 41 | 41 | ) |
| 42 | 42 | ); |
| 43 | - while ($row = $smcFunc['db_fetch_row']($request)) |
|
| 44 | - $possible_members[] = $row[0]; |
|
| 43 | + while ($row = $smcFunc['db_fetch_row']($request)) { |
|
| 44 | + $possible_members[] = $row[0]; |
|
| 45 | + } |
|
| 45 | 46 | $smcFunc['db_free_result']($request); |
| 46 | 47 | |
| 47 | 48 | // Presumably, there are some people? |
@@ -50,8 +51,9 @@ discard block |
||
| 50 | 51 | $possible_members = array_flip(array_flip($possible_members)); |
| 51 | 52 | $possible_members = array_diff($possible_members, array($this->_details['sender_id'])); |
| 52 | 53 | } |
| 53 | - if (empty($possible_members)) |
|
| 54 | - return true; |
|
| 54 | + if (empty($possible_members)) { |
|
| 55 | + return true; |
|
| 56 | + } |
|
| 55 | 57 | |
| 56 | 58 | // We need to know who can moderate this board - and therefore who can see this report. |
| 57 | 59 | // First up, people who have moderate_board in the board this topic was in. |
@@ -73,8 +75,9 @@ discard block |
||
| 73 | 75 | { |
| 74 | 76 | foreach ($alert_bits as $type => $bitvalue) |
| 75 | 77 | { |
| 76 | - if ($pref_option['member_report_reply'] & $bitvalue) |
|
| 77 | - $notifies[$type][] = $member; |
|
| 78 | + if ($pref_option['member_report_reply'] & $bitvalue) { |
|
| 79 | + $notifies[$type][] = $member; |
|
| 80 | + } |
|
| 78 | 81 | } |
| 79 | 82 | } |
| 80 | 83 | |
@@ -136,8 +139,9 @@ discard block |
||
| 136 | 139 | ); |
| 137 | 140 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
| 138 | 141 | { |
| 139 | - if (empty($row['lngfile'])) |
|
| 140 | - $row['lngfile'] = $language; |
|
| 142 | + if (empty($row['lngfile'])) { |
|
| 143 | + $row['lngfile'] = $language; |
|
| 144 | + } |
|
| 141 | 145 | $emails[$row['lngfile']][$row['id_member']] = $row['email_address']; |
| 142 | 146 | } |
| 143 | 147 | $smcFunc['db_free_result']($request); |
@@ -155,8 +159,9 @@ discard block |
||
| 155 | 159 | $emaildata = loadEmailTemplate('reply_to_user_reports', $replacements, empty($modSettings['userLanguage']) ? $language : $this_lang); |
| 156 | 160 | |
| 157 | 161 | // And do the actual sending... |
| 158 | - foreach ($recipients as $id_member => $email_address) |
|
| 159 | - sendmail($email_address, $emaildata['subject'], $emaildata['body'], null, 'urptrpy' . $this->_details['comment_id'], $emaildata['is_html'], 3); |
|
| 162 | + foreach ($recipients as $id_member => $email_address) { |
|
| 163 | + sendmail($email_address, $emaildata['subject'], $emaildata['body'], null, 'urptrpy' . $this->_details['comment_id'], $emaildata['is_html'], 3); |
|
| 164 | + } |
|
| 160 | 165 | } |
| 161 | 166 | } |
| 162 | 167 | |
@@ -96,14 +96,15 @@ |
||
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | // Insert the alerts if any |
| 99 | - if (!empty($alert_rows)) |
|
| 100 | - $smcFunc['db_insert']('', |
|
| 99 | + if (!empty($alert_rows)) { |
|
| 100 | + $smcFunc['db_insert']('', |
|
| 101 | 101 | '{db_prefix}user_alerts', |
| 102 | 102 | array('alert_time' => 'int', 'id_member' => 'int', 'id_member_started' => 'int', 'member_name' => 'string', |
| 103 | 103 | 'content_type' => 'string', 'content_id' => 'int', 'content_action' => 'string', 'is_read' => 'int', 'extra' => 'string'), |
| 104 | 104 | $alert_rows, |
| 105 | 105 | array() |
| 106 | 106 | ); |
| 107 | + } |
|
| 107 | 108 | |
| 108 | 109 | return true; |
| 109 | 110 | } |
@@ -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 | |
@@ -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 |
@@ -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 | } |