@@ -273,7 +273,6 @@ |
||
273 | 273 | * Modify any setting related to topics. |
274 | 274 | * Requires the admin_forum permission. |
275 | 275 | * Accessed from ?action=admin;area=postsettings;sa=topics. |
276 | - |
|
277 | 276 | * @param bool $return_config Whether or not to return the config_vars array (used for admin search) |
278 | 277 | * @return void|array Returns nothing or returns $config_vars if $return_config is true |
279 | 278 | * @uses Admin template, edit_topic_settings sub-template. |
@@ -13,8 +13,9 @@ discard block |
||
13 | 13 | * @version 2.1 Beta 4 |
14 | 14 | */ |
15 | 15 | |
16 | -if (!defined('SMF')) |
|
16 | +if (!defined('SMF')) { |
|
17 | 17 | die('No direct access...'); |
18 | +} |
|
18 | 19 | |
19 | 20 | /** |
20 | 21 | * The main entrance point for the 'Posts and topics' screen. |
@@ -98,23 +99,23 @@ discard block |
||
98 | 99 | { |
99 | 100 | $_POST['censortext'] = explode("\n", strtr($_POST['censortext'], array("\r" => ''))); |
100 | 101 | |
101 | - foreach ($_POST['censortext'] as $c) |
|
102 | - list ($censored_vulgar[], $censored_proper[]) = array_pad(explode('=', trim($c)), 2, ''); |
|
103 | - } |
|
104 | - elseif (isset($_POST['censor_vulgar'], $_POST['censor_proper'])) |
|
102 | + foreach ($_POST['censortext'] as $c) { |
|
103 | + list ($censored_vulgar[], $censored_proper[]) = array_pad(explode('=', trim($c)), 2, ''); |
|
104 | + } |
|
105 | + } elseif (isset($_POST['censor_vulgar'], $_POST['censor_proper'])) |
|
105 | 106 | { |
106 | 107 | if (is_array($_POST['censor_vulgar'])) |
107 | 108 | { |
108 | 109 | foreach ($_POST['censor_vulgar'] as $i => $value) |
109 | 110 | { |
110 | - if (trim(strtr($value, '*', ' ')) == '') |
|
111 | - unset($_POST['censor_vulgar'][$i], $_POST['censor_proper'][$i]); |
|
111 | + if (trim(strtr($value, '*', ' ')) == '') { |
|
112 | + unset($_POST['censor_vulgar'][$i], $_POST['censor_proper'][$i]); |
|
113 | + } |
|
112 | 114 | } |
113 | 115 | |
114 | 116 | $censored_vulgar = $_POST['censor_vulgar']; |
115 | 117 | $censored_proper = $_POST['censor_proper']; |
116 | - } |
|
117 | - else |
|
118 | + } else |
|
118 | 119 | { |
119 | 120 | $censored_vulgar = explode("\n", strtr($_POST['censor_vulgar'], array("\r" => ''))); |
120 | 121 | $censored_proper = explode("\n", strtr($_POST['censor_proper'], array("\r" => ''))); |
@@ -151,12 +152,14 @@ discard block |
||
151 | 152 | $context['censored_words'] = array(); |
152 | 153 | for ($i = 0, $n = count($censor_vulgar); $i < $n; $i++) |
153 | 154 | { |
154 | - if (empty($censor_vulgar[$i])) |
|
155 | - continue; |
|
155 | + if (empty($censor_vulgar[$i])) { |
|
156 | + continue; |
|
157 | + } |
|
156 | 158 | |
157 | 159 | // Skip it, it's either spaces or stars only. |
158 | - if (trim(strtr($censor_vulgar[$i], '*', ' ')) == '') |
|
159 | - continue; |
|
160 | + if (trim(strtr($censor_vulgar[$i], '*', ' ')) == '') { |
|
161 | + continue; |
|
162 | + } |
|
160 | 163 | |
161 | 164 | $context['censored_words'][$smcFunc['htmlspecialchars'](trim($censor_vulgar[$i]))] = isset($censor_proper[$i]) ? $smcFunc['htmlspecialchars']($censor_proper[$i]) : ''; |
162 | 165 | } |
@@ -187,10 +190,11 @@ discard block |
||
187 | 190 | |
188 | 191 | // Make an inline conditional a little shorter... |
189 | 192 | $can_spell_check = false; |
190 | - if (function_exists('pspell_new')) |
|
191 | - $can_spell_check = true; |
|
192 | - elseif (function_exists('enchant_broker_init') && ($txt['lang_charset'] == 'UTF-8' || function_exists('iconv'))) |
|
193 | - $can_spell_check = true; |
|
193 | + if (function_exists('pspell_new')) { |
|
194 | + $can_spell_check = true; |
|
195 | + } elseif (function_exists('enchant_broker_init') && ($txt['lang_charset'] == 'UTF-8' || function_exists('iconv'))) { |
|
196 | + $can_spell_check = true; |
|
197 | + } |
|
194 | 198 | |
195 | 199 | // All the settings... |
196 | 200 | $config_vars = array( |
@@ -221,8 +225,9 @@ discard block |
||
221 | 225 | |
222 | 226 | call_integration_hook('integrate_modify_post_settings', array(&$config_vars)); |
223 | 227 | |
224 | - if ($return_config) |
|
225 | - return $config_vars; |
|
228 | + if ($return_config) { |
|
229 | + return $config_vars; |
|
230 | + } |
|
226 | 231 | |
227 | 232 | // We'll want this for our easy save. |
228 | 233 | require_once($sourcedir . '/ManageServer.php'); |
@@ -242,17 +247,20 @@ discard block |
||
242 | 247 | db_extend('packages'); |
243 | 248 | |
244 | 249 | $colData = $smcFunc['db_list_columns']('{db_prefix}messages', true); |
245 | - foreach ($colData as $column) |
|
246 | - if ($column['name'] == 'body') |
|
250 | + foreach ($colData as $column) { |
|
251 | + if ($column['name'] == 'body') |
|
247 | 252 | $body_type = $column['type']; |
253 | + } |
|
248 | 254 | |
249 | - if (isset($body_type) && ($_POST['max_messageLength'] > 65535 || $_POST['max_messageLength'] == 0) && $body_type == 'text') |
|
250 | - fatal_lang_error('convert_to_mediumtext', false, array($scripturl . '?action=admin;area=maintain;sa=database')); |
|
255 | + if (isset($body_type) && ($_POST['max_messageLength'] > 65535 || $_POST['max_messageLength'] == 0) && $body_type == 'text') { |
|
256 | + fatal_lang_error('convert_to_mediumtext', false, array($scripturl . '?action=admin;area=maintain;sa=database')); |
|
257 | + } |
|
251 | 258 | } |
252 | 259 | |
253 | 260 | // If we're changing the post preview length let's check its valid |
254 | - if (!empty($_POST['preview_characters'])) |
|
255 | - $_POST['preview_characters'] = (int) min(max(0, $_POST['preview_characters']), 512); |
|
261 | + if (!empty($_POST['preview_characters'])) { |
|
262 | + $_POST['preview_characters'] = (int) min(max(0, $_POST['preview_characters']), 512); |
|
263 | + } |
|
256 | 264 | |
257 | 265 | call_integration_hook('integrate_save_post_settings'); |
258 | 266 | |
@@ -313,8 +321,9 @@ discard block |
||
313 | 321 | |
314 | 322 | call_integration_hook('integrate_modify_topic_settings', array(&$config_vars)); |
315 | 323 | |
316 | - if ($return_config) |
|
317 | - return $config_vars; |
|
324 | + if ($return_config) { |
|
325 | + return $config_vars; |
|
326 | + } |
|
318 | 327 | |
319 | 328 | // Get the settings template ready. |
320 | 329 | require_once($sourcedir . '/ManageServer.php'); |
@@ -367,8 +376,9 @@ discard block |
||
367 | 376 | array('int', 'drafts_autosave_frequency', 'postinput' => $txt['manageposts_seconds'], 'subtext' => $txt['drafts_autosave_frequency_subnote']), |
368 | 377 | ); |
369 | 378 | |
370 | - if ($return_config) |
|
371 | - return $config_vars; |
|
379 | + if ($return_config) { |
|
380 | + return $config_vars; |
|
381 | + } |
|
372 | 382 | |
373 | 383 | // Get the settings template ready. |
374 | 384 | require_once($sourcedir . '/ManageServer.php'); |
@@ -61,7 +61,7 @@ |
||
61 | 61 | $server = trim($servers[array_rand($servers)]); |
62 | 62 | |
63 | 63 | // Normal host names do not contain slashes, while e.g. unix sockets do. Assume alternative transport pipe with port 0. |
64 | - if (strpos($server,'/') !== false) |
|
64 | + if (strpos($server, '/') !== false) |
|
65 | 65 | $host = $server; |
66 | 66 | else |
67 | 67 | { |
@@ -11,8 +11,9 @@ discard block |
||
11 | 11 | * @version 2.1 Beta 4 |
12 | 12 | */ |
13 | 13 | |
14 | -if (!defined('SMF')) |
|
14 | +if (!defined('SMF')) { |
|
15 | 15 | die('Hacking attempt...'); |
16 | +} |
|
16 | 17 | |
17 | 18 | /** |
18 | 19 | * Our Cache API class |
@@ -34,8 +35,9 @@ discard block |
||
34 | 35 | |
35 | 36 | $supported = class_exists('memcache'); |
36 | 37 | |
37 | - if ($test) |
|
38 | - return $supported; |
|
38 | + if ($test) { |
|
39 | + return $supported; |
|
40 | + } |
|
39 | 41 | return parent::isSupported() && $supported && !empty($cache_memcached); |
40 | 42 | } |
41 | 43 | |
@@ -61,9 +63,9 @@ discard block |
||
61 | 63 | $server = trim($servers[array_rand($servers)]); |
62 | 64 | |
63 | 65 | // Normal host names do not contain slashes, while e.g. unix sockets do. Assume alternative transport pipe with port 0. |
64 | - if (strpos($server,'/') !== false) |
|
65 | - $host = $server; |
|
66 | - else |
|
66 | + if (strpos($server,'/') !== false) { |
|
67 | + $host = $server; |
|
68 | + } else |
|
67 | 69 | { |
68 | 70 | $server = explode(':', $server); |
69 | 71 | $host = $server[0]; |
@@ -71,10 +73,11 @@ discard block |
||
71 | 73 | } |
72 | 74 | |
73 | 75 | // Don't wait too long: yes, we want the server, but we might be able to run the query faster! |
74 | - if (empty($db_persist)) |
|
75 | - $connected = $this->memcache->connect($host, $port); |
|
76 | - else |
|
77 | - $connected = $this->memcache->pconnect($host, $port); |
|
76 | + if (empty($db_persist)) { |
|
77 | + $connected = $this->memcache->connect($host, $port); |
|
78 | + } else { |
|
79 | + $connected = $this->memcache->pconnect($host, $port); |
|
80 | + } |
|
78 | 81 | } |
79 | 82 | |
80 | 83 | return $connected; |
@@ -90,8 +93,9 @@ discard block |
||
90 | 93 | $value = $this->memcache->get($key); |
91 | 94 | |
92 | 95 | // $value should return either data or false (from failure, key not found or empty array). |
93 | - if ($value === false) |
|
94 | - return null; |
|
96 | + if ($value === false) { |
|
97 | + return null; |
|
98 | + } |
|
95 | 99 | return $value; |
96 | 100 | } |
97 | 101 | |
@@ -132,8 +136,9 @@ discard block |
||
132 | 136 | $config_vars[] = $txt['cache_memcache_settings']; |
133 | 137 | $config_vars[] = array('cache_memcached', $txt['cache_memcache_servers'], 'file', 'text', 0, 'cache_memcached', 'postinput' => '<br><div class="smalltext"><em>' . $txt['cache_memcache_servers_subtext'] . '</em></div>'); |
134 | 138 | |
135 | - if (!isset($context['settings_post_javascript'])) |
|
136 | - $context['settings_post_javascript'] = ''; |
|
139 | + if (!isset($context['settings_post_javascript'])) { |
|
140 | + $context['settings_post_javascript'] = ''; |
|
141 | + } |
|
137 | 142 | |
138 | 143 | $context['settings_post_javascript'] .= ' |
139 | 144 | $("#cache_accelerator").change(function (e) { |
@@ -19,10 +19,10 @@ |
||
19 | 19 | */ |
20 | 20 | class GroupAct_Notify_Background extends SMF_BackgroundTask |
21 | 21 | { |
22 | - /** |
|
23 | - * This executes the task - loads up the information, puts the email in the queue and inserts alerts as needed. |
|
24 | - * @return bool Always returns true |
|
25 | - */ |
|
22 | + /** |
|
23 | + * This executes the task - loads up the information, puts the email in the queue and inserts alerts as needed. |
|
24 | + * @return bool Always returns true |
|
25 | + */ |
|
26 | 26 | public function execute() |
27 | 27 | { |
28 | 28 | global $sourcedir, $smcFunc, $language, $modSettings; |
@@ -132,8 +132,9 @@ discard block |
||
132 | 132 | 'GROUPNAME' => $user['group_name'], |
133 | 133 | ); |
134 | 134 | |
135 | - if (!empty($custom_reason)) |
|
136 | - $replacements['REASON'] = $custom_reason; |
|
135 | + if (!empty($custom_reason)) { |
|
136 | + $replacements['REASON'] = $custom_reason; |
|
137 | + } |
|
137 | 138 | |
138 | 139 | $emaildata = loadEmailTemplate($email_template_name, $replacements, $user['language']); |
139 | 140 | |
@@ -142,8 +143,8 @@ discard block |
||
142 | 143 | } |
143 | 144 | |
144 | 145 | // Insert the alerts if any |
145 | - if (!empty($alert_rows)) |
|
146 | - $smcFunc['db_insert']('', |
|
146 | + if (!empty($alert_rows)) { |
|
147 | + $smcFunc['db_insert']('', |
|
147 | 148 | '{db_prefix}user_alerts', |
148 | 149 | array( |
149 | 150 | 'alert_time' => 'int', 'id_member' => 'int', 'content_type' => 'string', |
@@ -152,6 +153,7 @@ discard block |
||
152 | 153 | $alert_rows, |
153 | 154 | array() |
154 | 155 | ); |
156 | + } |
|
155 | 157 | } |
156 | 158 | |
157 | 159 | return true; |
@@ -20,7 +20,7 @@ |
||
20 | 20 | class MsgReportReply_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 alerts as needed. |
|
23 | + * This executes the task - loads up the information, puts the email in the queue and inserts alerts as needed. |
|
24 | 24 | * @return bool Always returns true. |
25 | 25 | */ |
26 | 26 | public function execute() |
@@ -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. |
@@ -67,8 +69,9 @@ discard block |
||
67 | 69 | 'current_board' => $this->_details['board_id'], |
68 | 70 | ) |
69 | 71 | ); |
70 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
71 | - $members[] = $row['id_member']; |
|
72 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
73 | + $members[] = $row['id_member']; |
|
74 | + } |
|
72 | 75 | $smcFunc['db_free_result']($request); |
73 | 76 | |
74 | 77 | // Thirdly, anyone assigned to be a moderator of this group as a group->board moderator. |
@@ -85,8 +88,9 @@ discard block |
||
85 | 88 | ) |
86 | 89 | ); |
87 | 90 | |
88 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
89 | - $members[] = $row['id_member']; |
|
91 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
92 | + $members[] = $row['id_member']; |
|
93 | + } |
|
90 | 94 | $smcFunc['db_free_result']($request); |
91 | 95 | |
92 | 96 | // So now we have two lists: the people who replied to a report in the past, |
@@ -108,8 +112,9 @@ discard block |
||
108 | 112 | { |
109 | 113 | foreach ($alert_bits as $type => $bitvalue) |
110 | 114 | { |
111 | - if ($pref_option['msg_report_reply'] & $bitvalue) |
|
112 | - $notifies[$type][] = $member; |
|
115 | + if ($pref_option['msg_report_reply'] & $bitvalue) { |
|
116 | + $notifies[$type][] = $member; |
|
117 | + } |
|
113 | 118 | } |
114 | 119 | } |
115 | 120 | |
@@ -170,8 +175,9 @@ discard block |
||
170 | 175 | ); |
171 | 176 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
172 | 177 | { |
173 | - if (empty($row['lngfile'])) |
|
174 | - $row['lngfile'] = $language; |
|
178 | + if (empty($row['lngfile'])) { |
|
179 | + $row['lngfile'] = $language; |
|
180 | + } |
|
175 | 181 | $emails[$row['lngfile']][$row['id_member']] = $row['email_address']; |
176 | 182 | } |
177 | 183 | $smcFunc['db_free_result']($request); |
@@ -203,8 +209,9 @@ discard block |
||
203 | 209 | $emaildata = loadEmailTemplate('reply_to_moderator', $replacements, empty($modSettings['userLanguage']) ? $language : $this_lang); |
204 | 210 | |
205 | 211 | // And do the actual sending... |
206 | - foreach ($recipients as $id_member => $email_address) |
|
207 | - sendmail($email_address, $emaildata['subject'], $emaildata['body'], null, 'rptrpy' . $this->_details['comment_id'], $emaildata['is_html'], 3); |
|
212 | + foreach ($recipients as $id_member => $email_address) { |
|
213 | + sendmail($email_address, $emaildata['subject'], $emaildata['body'], null, 'rptrpy' . $this->_details['comment_id'], $emaildata['is_html'], 3); |
|
214 | + } |
|
208 | 215 | } |
209 | 216 | } |
210 | 217 |
@@ -19,7 +19,7 @@ |
||
19 | 19 | class Buddy_Notify_Background extends SMF_BackgroundTask |
20 | 20 | { |
21 | 21 | /** |
22 | - * This executes the task - loads up the info, sets the alerts and loads up the email queue. |
|
22 | + * This executes the task - loads up the info, sets the alerts and loads up the email queue. |
|
23 | 23 | * @return bool Always returns true |
24 | 24 | */ |
25 | 25 | public function execute() |
@@ -51,8 +51,9 @@ discard block |
||
51 | 51 | $birthdays = array(); |
52 | 52 | while ($row = $smcFunc['db_fetch_assoc']($result)) |
53 | 53 | { |
54 | - if (!isset($birthdays[$row['lngfile']])) |
|
55 | - $birthdays[$row['lngfile']] = array(); |
|
54 | + if (!isset($birthdays[$row['lngfile']])) { |
|
55 | + $birthdays[$row['lngfile']] = array(); |
|
56 | + } |
|
56 | 57 | $birthdays[$row['lngfile']][$row['id_member']] = array( |
57 | 58 | 'name' => $row['real_name'], |
58 | 59 | 'email' => $row['email_address'] |
@@ -117,8 +118,8 @@ discard block |
||
117 | 118 | AddMailQueue(true); |
118 | 119 | |
119 | 120 | // Insert the alerts if any |
120 | - if (!empty($alert_rows)) |
|
121 | - $smcFunc['db_insert']('', |
|
121 | + if (!empty($alert_rows)) { |
|
122 | + $smcFunc['db_insert']('', |
|
122 | 123 | '{db_prefix}user_alerts', |
123 | 124 | array( |
124 | 125 | 'alert_time' => 'int', 'id_member' => 'int', 'content_type' => 'string', |
@@ -127,6 +128,7 @@ discard block |
||
127 | 128 | $alert_rows, |
128 | 129 | array() |
129 | 130 | ); |
131 | + } |
|
130 | 132 | } |
131 | 133 | |
132 | 134 | return true; |
@@ -18,10 +18,10 @@ |
||
18 | 18 | */ |
19 | 19 | class Birthday_Notify_Background extends SMF_BackgroundTask |
20 | 20 | { |
21 | - /** |
|
22 | - * This executes the task. It loads up the birthdays, figures out the greeting, etc. |
|
23 | - * @return bool Always returns true |
|
24 | - */ |
|
21 | + /** |
|
22 | + * This executes the task. It loads up the birthdays, figures out the greeting, etc. |
|
23 | + * @return bool Always returns true |
|
24 | + */ |
|
25 | 25 | public function execute() |
26 | 26 | { |
27 | 27 | global $txt, $smcFunc, $txtBirthdayEmails, $modSettings, $sourcedir; |
@@ -19,7 +19,7 @@ |
||
19 | 19 | class MemberReport_Notify_Background extends SMF_BackgroundTask |
20 | 20 | { |
21 | 21 | /** |
22 | - * This executes the task - loads up the information, puts the email in the queue and inserts alerts as needed. |
|
22 | + * This executes the task - loads up the information, puts the email in the queue and inserts alerts as needed. |
|
23 | 23 | * @return bool Always returns true. |
24 | 24 | */ |
25 | 25 | public function execute() |
@@ -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 |
@@ -18,7 +18,7 @@ |
||
18 | 18 | class ApprovePost_Notify_Background extends SMF_BackgroundTask |
19 | 19 | { |
20 | 20 | /** |
21 | - * This executes the task - loads up the info, puts the email in the queue and inserts any alerts as needed. |
|
21 | + * This executes the task - loads up the info, puts the email in the queue and inserts any alerts as needed. |
|
22 | 22 | * @return bool Always returns true |
23 | 23 | */ |
24 | 24 | public function execute() |
@@ -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 | } |
@@ -19,7 +19,7 @@ |
||
19 | 19 | class Register_Notify_Background extends SMF_BackgroundTask |
20 | 20 | { |
21 | 21 | /** |
22 | - * This executes the task - loads up the information, puts the email in the queue and inserts alerts as needed. |
|
22 | + * This executes the task - loads up the information, puts the email in the queue and inserts alerts as needed. |
|
23 | 23 | * @return bool Always returns true. |
24 | 24 | */ |
25 | 25 | public function execute() |
@@ -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 |