@@ -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 | * Show the database queries for debugging |
@@ -30,8 +31,9 @@ discard block |
||
30 | 31 | global $scripturl, $settings, $context, $db_connection, $boarddir, $smcFunc, $txt, $db_show_debug; |
31 | 32 | |
32 | 33 | // We should have debug mode enabled, as well as something to display! |
33 | - if (!isset($db_show_debug) || $db_show_debug !== true || !isset($_SESSION['debug'])) |
|
34 | - fatal_lang_error('no_access', false); |
|
34 | + if (!isset($db_show_debug) || $db_show_debug !== true || !isset($_SESSION['debug'])) { |
|
35 | + fatal_lang_error('no_access', false); |
|
36 | + } |
|
35 | 37 | |
36 | 38 | // Don't allow except for administrators. |
37 | 39 | isAllowedTo('admin_forum'); |
@@ -41,10 +43,11 @@ discard block |
||
41 | 43 | { |
42 | 44 | $_SESSION['view_queries'] = $_SESSION['view_queries'] == 1 ? 0 : 1; |
43 | 45 | |
44 | - if (strpos($_SESSION['old_url'], 'action=viewquery') !== false) |
|
45 | - redirectexit(); |
|
46 | - else |
|
47 | - redirectexit($_SESSION['old_url']); |
|
46 | + if (strpos($_SESSION['old_url'], 'action=viewquery') !== false) { |
|
47 | + redirectexit(); |
|
48 | + } else { |
|
49 | + redirectexit($_SESSION['old_url']); |
|
50 | + } |
|
48 | 51 | } |
49 | 52 | |
50 | 53 | call_integration_hook('integrate_egg_nog'); |
@@ -83,26 +86,28 @@ discard block |
||
83 | 86 | foreach ($query as $line) |
84 | 87 | { |
85 | 88 | preg_match('/^(\t*)/', $line, $temp); |
86 | - if (strlen($temp[0]) < $min_indent || $min_indent == 0) |
|
87 | - $min_indent = strlen($temp[0]); |
|
89 | + if (strlen($temp[0]) < $min_indent || $min_indent == 0) { |
|
90 | + $min_indent = strlen($temp[0]); |
|
91 | + } |
|
92 | + } |
|
93 | + foreach ($query as $l => $dummy) { |
|
94 | + $query[$l] = substr($dummy, $min_indent); |
|
88 | 95 | } |
89 | - foreach ($query as $l => $dummy) |
|
90 | - $query[$l] = substr($dummy, $min_indent); |
|
91 | 96 | $query_data['q'] = implode("\n", $query); |
92 | 97 | |
93 | 98 | // Make the filenames look a bit better. |
94 | - if (isset($query_data['f'])) |
|
95 | - $query_data['f'] = preg_replace('~^' . preg_quote($boarddir, '~') . '~', '...', $query_data['f']); |
|
99 | + if (isset($query_data['f'])) { |
|
100 | + $query_data['f'] = preg_replace('~^' . preg_quote($boarddir, '~') . '~', '...', $query_data['f']); |
|
101 | + } |
|
96 | 102 | |
97 | 103 | $is_select_query = substr(trim($query_data['q']), 0, 6) == 'SELECT'; |
98 | - if ($is_select_query) |
|
99 | - $select = $query_data['q']; |
|
100 | - elseif (preg_match('~^INSERT(?: IGNORE)? INTO \w+(?:\s+\([^)]+\))?\s+(SELECT .+)$~s', trim($query_data['q']), $matches) != 0) |
|
104 | + if ($is_select_query) { |
|
105 | + $select = $query_data['q']; |
|
106 | + } elseif (preg_match('~^INSERT(?: IGNORE)? INTO \w+(?:\s+\([^)]+\))?\s+(SELECT .+)$~s', trim($query_data['q']), $matches) != 0) |
|
101 | 107 | { |
102 | 108 | $is_select_query = true; |
103 | 109 | $select = $matches[1]; |
104 | - } |
|
105 | - elseif (preg_match('~^CREATE TEMPORARY TABLE .+?(SELECT .+)$~s', trim($query_data['q']), $matches) != 0) |
|
110 | + } elseif (preg_match('~^CREATE TEMPORARY TABLE .+?(SELECT .+)$~s', trim($query_data['q']), $matches) != 0) |
|
106 | 111 | { |
107 | 112 | $is_select_query = true; |
108 | 113 | $select = $matches[1]; |
@@ -110,10 +115,11 @@ discard block |
||
110 | 115 | // Temporary tables created in earlier queries are not explainable. |
111 | 116 | if ($is_select_query) |
112 | 117 | { |
113 | - foreach (array('log_topics_unread', 'topics_posted_in', 'tmp_log_search_topics', 'tmp_log_search_messages') as $tmp) |
|
114 | - if (strpos($select, $tmp) !== false) |
|
118 | + foreach (array('log_topics_unread', 'topics_posted_in', 'tmp_log_search_topics', 'tmp_log_search_messages') as $tmp) { |
|
119 | + if (strpos($select, $tmp) !== false) |
|
115 | 120 | { |
116 | 121 | $is_select_query = false; |
122 | + } |
|
117 | 123 | break; |
118 | 124 | } |
119 | 125 | } |
@@ -124,13 +130,15 @@ discard block |
||
124 | 130 | ', nl2br(str_replace("\t", ' ', $smcFunc['htmlspecialchars']($query_data['q']))), ' |
125 | 131 | </a><br>'; |
126 | 132 | |
127 | - if (!empty($query_data['f']) && !empty($query_data['l'])) |
|
128 | - echo sprintf($txt['debug_query_in_line'], $query_data['f'], $query_data['l']); |
|
133 | + if (!empty($query_data['f']) && !empty($query_data['l'])) { |
|
134 | + echo sprintf($txt['debug_query_in_line'], $query_data['f'], $query_data['l']); |
|
135 | + } |
|
129 | 136 | |
130 | - if (isset($query_data['s'], $query_data['t']) && isset($txt['debug_query_which_took_at'])) |
|
131 | - echo sprintf($txt['debug_query_which_took_at'], round($query_data['t'], 8), round($query_data['s'], 8)); |
|
132 | - else |
|
133 | - echo sprintf($txt['debug_query_which_took'], round($query_data['t'], 8)); |
|
137 | + if (isset($query_data['s'], $query_data['t']) && isset($txt['debug_query_which_took_at'])) { |
|
138 | + echo sprintf($txt['debug_query_which_took_at'], round($query_data['t'], 8), round($query_data['s'], 8)); |
|
139 | + } else { |
|
140 | + echo sprintf($txt['debug_query_which_took'], round($query_data['t'], 8)); |
|
141 | + } |
|
134 | 142 | |
135 | 143 | echo ' |
136 | 144 | </div>'; |
@@ -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 | * Format a topic to be printer friendly. |
@@ -32,8 +33,9 @@ discard block |
||
32 | 33 | global $board_info, $smcFunc, $modSettings; |
33 | 34 | |
34 | 35 | // Redirect to the boardindex if no valid topic id is provided. |
35 | - if (empty($topic)) |
|
36 | - redirectexit(); |
|
36 | + if (empty($topic)) { |
|
37 | + redirectexit(); |
|
38 | + } |
|
37 | 39 | |
38 | 40 | if (!empty($modSettings['disable_print_topic'])) |
39 | 41 | { |
@@ -59,8 +61,9 @@ discard block |
||
59 | 61 | ) |
60 | 62 | ); |
61 | 63 | // Redirect to the boardindex if no valid topic id is provided. |
62 | - if ($smcFunc['db_num_rows']($request) == 0) |
|
63 | - redirectexit(); |
|
64 | + if ($smcFunc['db_num_rows']($request) == 0) { |
|
65 | + redirectexit(); |
|
66 | + } |
|
64 | 67 | $row = $smcFunc['db_fetch_assoc']($request); |
65 | 68 | $smcFunc['db_free_result']($request); |
66 | 69 | |
@@ -134,20 +137,21 @@ discard block |
||
134 | 137 | foreach ($guestinfo as $i => $guestvoted) |
135 | 138 | { |
136 | 139 | $guestvoted = explode(',', $guestvoted); |
137 | - if ($guestvoted[0] == $row['id_poll']) |
|
138 | - break; |
|
140 | + if ($guestvoted[0] == $row['id_poll']) { |
|
141 | + break; |
|
142 | + } |
|
139 | 143 | } |
140 | 144 | // Has the poll been reset since guest voted? |
141 | 145 | if ($pollinfo['reset_poll'] > $guestvoted[1]) |
142 | 146 | { |
143 | 147 | // Remove the poll info from the cookie to allow guest to vote again |
144 | 148 | unset($guestinfo[$i]); |
145 | - if (!empty($guestinfo)) |
|
146 | - $_COOKIE['guest_poll_vote'] = ';' . implode(';', $guestinfo); |
|
147 | - else |
|
148 | - unset($_COOKIE['guest_poll_vote']); |
|
149 | - } |
|
150 | - else |
|
149 | + if (!empty($guestinfo)) { |
|
150 | + $_COOKIE['guest_poll_vote'] = ';' . implode(';', $guestinfo); |
|
151 | + } else { |
|
152 | + unset($_COOKIE['guest_poll_vote']); |
|
153 | + } |
|
154 | + } else |
|
151 | 155 | { |
152 | 156 | // What did they vote for? |
153 | 157 | unset($guestvoted[0], $guestvoted[1]); |
@@ -233,8 +237,9 @@ discard block |
||
233 | 237 | $context['poster_name'] = $row['poster_name']; |
234 | 238 | $context['post_time'] = timeformat($row['poster_time'], false); |
235 | 239 | $context['parent_boards'] = array(); |
236 | - foreach ($board_info['parent_boards'] as $parent) |
|
237 | - $context['parent_boards'][] = $parent['name']; |
|
240 | + foreach ($board_info['parent_boards'] as $parent) { |
|
241 | + $context['parent_boards'][] = $parent['name']; |
|
242 | + } |
|
238 | 243 | |
239 | 244 | // Split the topics up so we can print them. |
240 | 245 | $request = $smcFunc['db_query']('', ' |
@@ -266,8 +271,9 @@ discard block |
||
266 | 271 | 'id_msg' => $row['id_msg'], |
267 | 272 | ); |
268 | 273 | |
269 | - if (!isset($context['topic_subject'])) |
|
270 | - $context['topic_subject'] = $row['subject']; |
|
274 | + if (!isset($context['topic_subject'])) { |
|
275 | + $context['topic_subject'] = $row['subject']; |
|
276 | + } |
|
271 | 277 | } |
272 | 278 | $smcFunc['db_free_result']($request); |
273 | 279 | |
@@ -275,8 +281,9 @@ discard block |
||
275 | 281 | if (isset($_REQUEST['images']) && !empty($modSettings['attachmentEnable']) && allowedTo('view_attachments')) |
276 | 282 | { |
277 | 283 | $messages = array(); |
278 | - foreach ($context['posts'] as $temp) |
|
279 | - $messages[] = $temp['id_msg']; |
|
284 | + foreach ($context['posts'] as $temp) { |
|
285 | + $messages[] = $temp['id_msg']; |
|
286 | + } |
|
280 | 287 | |
281 | 288 | // build the request |
282 | 289 | $request = $smcFunc['db_query']('', ' |
@@ -295,8 +302,9 @@ discard block |
||
295 | 302 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
296 | 303 | { |
297 | 304 | $temp[$row['id_attach']] = $row; |
298 | - if (!isset($context['printattach'][$row['id_msg']])) |
|
299 | - $context['printattach'][$row['id_msg']] = array(); |
|
305 | + if (!isset($context['printattach'][$row['id_msg']])) { |
|
306 | + $context['printattach'][$row['id_msg']] = array(); |
|
307 | + } |
|
300 | 308 | } |
301 | 309 | $smcFunc['db_free_result']($request); |
302 | 310 | ksort($temp); |
@@ -313,8 +321,7 @@ discard block |
||
313 | 321 | $row['height'] = floor($row['height'] * ($modSettings['max_image_width'] / $row['width'])); |
314 | 322 | $row['width'] = $modSettings['max_image_width']; |
315 | 323 | } |
316 | - } |
|
317 | - elseif (!empty($modSettings['max_image_width'])) |
|
324 | + } elseif (!empty($modSettings['max_image_width'])) |
|
318 | 325 | { |
319 | 326 | if ($row['height'] > $modSettings['max_image_height']) |
320 | 327 | { |
@@ -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 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 |
@@ -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) { |
@@ -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 | * Locks a topic... either by way of a moderator or the topic starter. |
@@ -32,8 +33,9 @@ discard block |
||
32 | 33 | global $topic, $user_info, $sourcedir, $board, $smcFunc; |
33 | 34 | |
34 | 35 | // Just quit if there's no topic to lock. |
35 | - if (empty($topic)) |
|
36 | - fatal_lang_error('not_a_topic', false); |
|
36 | + if (empty($topic)) { |
|
37 | + fatal_lang_error('not_a_topic', false); |
|
38 | + } |
|
37 | 39 | |
38 | 40 | checkSession('get'); |
39 | 41 | |
@@ -55,23 +57,28 @@ discard block |
||
55 | 57 | |
56 | 58 | // Can you lock topics here, mister? |
57 | 59 | $user_lock = !allowedTo('lock_any'); |
58 | - if ($user_lock && $starter == $user_info['id']) |
|
59 | - isAllowedTo('lock_own'); |
|
60 | - else |
|
61 | - isAllowedTo('lock_any'); |
|
60 | + if ($user_lock && $starter == $user_info['id']) { |
|
61 | + isAllowedTo('lock_own'); |
|
62 | + } else { |
|
63 | + isAllowedTo('lock_any'); |
|
64 | + } |
|
62 | 65 | |
63 | 66 | // Locking with high privileges. |
64 | - if ($locked == '0' && !$user_lock) |
|
65 | - $locked = '1'; |
|
67 | + if ($locked == '0' && !$user_lock) { |
|
68 | + $locked = '1'; |
|
69 | + } |
|
66 | 70 | // Locking with low privileges. |
67 | - elseif ($locked == '0') |
|
68 | - $locked = '2'; |
|
71 | + elseif ($locked == '0') { |
|
72 | + $locked = '2'; |
|
73 | + } |
|
69 | 74 | // Unlocking - make sure you don't unlock what you can't. |
70 | - elseif ($locked == '2' || ($locked == '1' && !$user_lock)) |
|
71 | - $locked = '0'; |
|
75 | + elseif ($locked == '2' || ($locked == '1' && !$user_lock)) { |
|
76 | + $locked = '0'; |
|
77 | + } |
|
72 | 78 | // You cannot unlock this! |
73 | - else |
|
74 | - fatal_lang_error('locked_by_admin', 'user'); |
|
79 | + else { |
|
80 | + fatal_lang_error('locked_by_admin', 'user'); |
|
81 | + } |
|
75 | 82 | |
76 | 83 | // Actually lock the topic in the database with the new value. |
77 | 84 | $smcFunc['db_query']('', ' |
@@ -85,8 +92,9 @@ discard block |
||
85 | 92 | ); |
86 | 93 | |
87 | 94 | // If they are allowed a "moderator" permission, log it in the moderator log. |
88 | - if (!$user_lock) |
|
89 | - logAction($locked ? 'lock' : 'unlock', array('topic' => $topic, 'board' => $board)); |
|
95 | + if (!$user_lock) { |
|
96 | + logAction($locked ? 'lock' : 'unlock', array('topic' => $topic, 'board' => $board)); |
|
97 | + } |
|
90 | 98 | // Notify people that this topic has been locked? |
91 | 99 | sendNotifications($topic, empty($locked) ? 'unlock' : 'lock'); |
92 | 100 | |
@@ -112,8 +120,9 @@ discard block |
||
112 | 120 | isAllowedTo('make_sticky'); |
113 | 121 | |
114 | 122 | // You can't sticky a board or something! |
115 | - if (empty($topic)) |
|
116 | - fatal_lang_error('not_a_topic', false); |
|
123 | + if (empty($topic)) { |
|
124 | + fatal_lang_error('not_a_topic', false); |
|
125 | + } |
|
117 | 126 | |
118 | 127 | checkSession('get'); |
119 | 128 | |
@@ -147,8 +156,9 @@ discard block |
||
147 | 156 | // Log this sticky action - always a moderator thing. |
148 | 157 | logAction(empty($is_sticky) ? 'sticky' : 'unsticky', array('topic' => $topic, 'board' => $board)); |
149 | 158 | // Notify people that this topic has been stickied? |
150 | - if (empty($is_sticky)) |
|
151 | - sendNotifications($topic, 'sticky'); |
|
159 | + if (empty($is_sticky)) { |
|
160 | + sendNotifications($topic, 'sticky'); |
|
161 | + } |
|
152 | 162 | |
153 | 163 | // Take them back to the now stickied topic. |
154 | 164 | redirectexit('topic=' . $topic . '.' . $_REQUEST['start'] . ';moderate'); |
@@ -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() |
@@ -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, $language, $modSettings, $sourcedir; |
@@ -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; |
@@ -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 |