Completed
Pull Request — release-2.1 (#3835)
by Martyn
09:20
created
Sources/tasks/CreatePost-Notify.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@
 block discarded – undo
18 18
 class CreatePost_Notify_Background extends SMF_BackgroundTask
19 19
 {
20 20
 	/**
21
-     * This handles notifications when a new post is created - new topic, reply, quotes and mentions.
21
+	 * This handles notifications when a new post is created - new topic, reply, quotes and mentions.
22 22
 	 * @return bool Always returns true
23 23
 	 */
24 24
 	public function execute()
Please login to merge, or discard this patch.
Braces   +59 added lines, -44 removed lines patch added patch discarded remove patch
@@ -72,8 +72,9 @@  discard block
 block discarded – undo
72 72
 		while ($row = $smcFunc['db_fetch_assoc']($request))
73 73
 		{
74 74
 			$groups = array_merge(array($row['id_group'], $row['id_post_group']), (empty($row['additional_groups']) ? array() : explode(',', $row['additional_groups'])));
75
-			if (!in_array(1, $groups) && count(array_intersect($groups, explode(',', $row['member_groups']))) == 0)
76
-				continue;
75
+			if (!in_array(1, $groups) && count(array_intersect($groups, explode(',', $row['member_groups']))) == 0) {
76
+							continue;
77
+			}
77 78
 
78 79
 			$members[] = $row['id_member'];
79 80
 			$watched[$row['id_member']] = $row;
@@ -81,8 +82,9 @@  discard block
 block discarded – undo
81 82
 
82 83
 		$smcFunc['db_free_result']($request);
83 84
 
84
-		if (empty($members))
85
-			return true;
85
+		if (empty($members)) {
86
+					return true;
87
+		}
86 88
 
87 89
 		$members = array_unique($members);
88 90
 		$prefs = getNotifyPrefs($members, '', true);
@@ -103,18 +105,20 @@  discard block
 block discarded – undo
103 105
 			$frequency = !empty($prefs[$member]['msg_notify_pref']) ? $prefs[$member]['msg_notify_pref'] : 1;
104 106
 			$notify_types = !empty($prefs[$member]['msg_notify_type']) ? $prefs[$member]['msg_notify_type'] : 1;
105 107
 
106
-			if (!in_array($type, array('reply', 'topic')) && $notify_types == 2 && $member != $data['id_member_started'])
107
-				continue;
108
-			elseif (in_array($type, array('reply', 'topic')) && $member == $posterOptions['id'])
109
-				continue;
110
-			elseif (!in_array($type, array('reply', 'topic')) && $notify_types == 3)
111
-				continue;
112
-			elseif ($notify_types == 4)
113
-				continue;
108
+			if (!in_array($type, array('reply', 'topic')) && $notify_types == 2 && $member != $data['id_member_started']) {
109
+							continue;
110
+			} elseif (in_array($type, array('reply', 'topic')) && $member == $posterOptions['id']) {
111
+							continue;
112
+			} elseif (!in_array($type, array('reply', 'topic')) && $notify_types == 3) {
113
+							continue;
114
+			} elseif ($notify_types == 4) {
115
+							continue;
116
+			}
114 117
 
115 118
 			if ($frequency > 2 || (!empty($frequency) && $data['sent']) || in_array($member, $done_members)
116
-				|| (!empty($this->_details['members_only']) && !in_array($member, $this->_details['members_only'])))
117
-				continue;
119
+				|| (!empty($this->_details['members_only']) && !in_array($member, $this->_details['members_only']))) {
120
+							continue;
121
+			}
118 122
 
119 123
 			// Watched topic?
120 124
 			if (!empty($data['id_topic']) && $type != 'topic' && !empty($prefs[$member]))
@@ -124,10 +128,12 @@  discard block
 block discarded – undo
124 128
 
125 129
 				if ($type == 'reply')
126 130
 				{
127
-					if (!empty($prefs[$member]['msg_receive_body']))
128
-						$message_type .= '_body';
129
-					if (!empty($frequency))
130
-						$message_type .= '_once';
131
+					if (!empty($prefs[$member]['msg_receive_body'])) {
132
+											$message_type .= '_body';
133
+					}
134
+					if (!empty($frequency)) {
135
+											$message_type .= '_once';
136
+					}
131 137
 				}
132 138
 
133 139
 				$content_type = 'topic';
@@ -140,12 +146,14 @@  discard block
 block discarded – undo
140 146
 				$content_type = 'board';
141 147
 
142 148
 				$message_type = !empty($frequency) ? 'notify_boards_once' : 'notify_boards';
143
-				if (!empty($prefs[$member]['msg_receive_body']))
144
-					$message_type .= '_body';
149
+				if (!empty($prefs[$member]['msg_receive_body'])) {
150
+									$message_type .= '_body';
151
+				}
145 152
 			}
146 153
 			// If neither of the above, this might be a redundent row due to the OR clause in our SQL query, skip
147
-			else
148
-				continue;
154
+			else {
155
+							continue;
156
+			}
149 157
 
150 158
 			if ($pref & 0x02)
151 159
 			{
@@ -208,14 +216,15 @@  discard block
 block discarded – undo
208 216
 		);
209 217
 
210 218
 		// Insert the alerts if any
211
-		if (!empty($alert_rows))
212
-			$smcFunc['db_insert']('',
219
+		if (!empty($alert_rows)) {
220
+					$smcFunc['db_insert']('',
213 221
 				'{db_prefix}user_alerts',
214 222
 				array('alert_time' => 'int', 'id_member' => 'int', 'id_member_started' => 'int', 'member_name' => 'string',
215 223
 					'content_type' => 'string', 'content_id' => 'int', 'content_action' => 'string', 'is_read' => 'int', 'extra' => 'string'),
216 224
 				$alert_rows,
217 225
 				array()
218 226
 			);
227
+		}
219 228
 
220 229
 		return true;
221 230
 	}
@@ -226,8 +235,9 @@  discard block
 block discarded – undo
226 235
 
227 236
 		foreach ($quotedMembers as $id => $member)
228 237
 		{
229
-			if (!isset($prefs[$id]) || $id == $posterOptions['id'] || empty($prefs[$id]['msg_quote']))
230
-				continue;
238
+			if (!isset($prefs[$id]) || $id == $posterOptions['id'] || empty($prefs[$id]['msg_quote'])) {
239
+							continue;
240
+			}
231 241
 
232 242
 			$done_members[] = $id;
233 243
 
@@ -279,32 +289,35 @@  discard block
 block discarded – undo
279 289
 		{
280 290
 			if (preg_match('/\[quote(.*)?\]/i', $block, $matches))
281 291
 			{
282
-				if ($quote_level == 0)
283
-					$message .= '[quote' . $matches[1] . ']';
292
+				if ($quote_level == 0) {
293
+									$message .= '[quote' . $matches[1] . ']';
294
+				}
284 295
 				$quote_level++;
285
-			}
286
-			elseif (preg_match('/\[\/quote\]/i', $block))
296
+			} elseif (preg_match('/\[\/quote\]/i', $block))
287 297
 			{
288
-				if ($quote_level <= 1)
289
-					$message .= '[/quote]';
298
+				if ($quote_level <= 1) {
299
+									$message .= '[/quote]';
300
+				}
290 301
 				if ($quote_level >= 1)
291 302
 				{
292 303
 					$quote_level--;
293 304
 					$message .= "\n";
294 305
 				}
306
+			} elseif ($quote_level <= 1) {
307
+							$message .= $block;
295 308
 			}
296
-			elseif ($quote_level <= 1)
297
-				$message .= $block;
298 309
 		}
299 310
 
300 311
 		preg_match_all('/\[quote.*?link=msg=([0-9]+).*?\]/i', $message, $matches);
301 312
 
302 313
 		$id_msgs = $matches[1];
303
-		foreach ($id_msgs as $k => $id_msg)
304
-			$id_msgs[$k] = (int) $id_msg;
314
+		foreach ($id_msgs as $k => $id_msg) {
315
+					$id_msgs[$k] = (int) $id_msg;
316
+		}
305 317
 
306
-		if (empty($id_msgs))
307
-			return array();
318
+		if (empty($id_msgs)) {
319
+					return array();
320
+		}
308 321
 
309 322
 		// Get the messages
310 323
 		$request = $smcFunc['db_query']('', '
@@ -322,8 +335,9 @@  discard block
 block discarded – undo
322 335
 		$members = array();
323 336
 		while ($row = $smcFunc['db_fetch_assoc']($request))
324 337
 		{
325
-			if ($posterOptions['id'] == $row['id_member'])
326
-				continue;
338
+			if ($posterOptions['id'] == $row['id_member']) {
339
+							continue;
340
+			}
327 341
 
328 342
 			$members[$row['id_member']] = $row;
329 343
 		}
@@ -337,10 +351,11 @@  discard block
 block discarded – undo
337 351
 
338 352
 		foreach ($members as $id => $member)
339 353
 		{
340
-			if (!empty($prefs[$id]['msg_mention']))
341
-				$done_members[] = $id;
342
-			else
343
-				continue;
354
+			if (!empty($prefs[$id]['msg_mention'])) {
355
+							$done_members[] = $id;
356
+			} else {
357
+							continue;
358
+			}
344 359
 
345 360
 			// Alerts' emails are always instant
346 361
 			if ($prefs[$id]['msg_mention'] & 0x02)
Please login to merge, or discard this patch.
Sources/tasks/ApprovePost-Notify.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@
 block discarded – undo
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()
Please login to merge, or discard this patch.
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -54,8 +54,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 	}
Please login to merge, or discard this patch.
Sources/tasks/index.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,9 +1,10 @@
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 // Try to handle it with the upper level index.php. (it should know what to do.)
4
-if (file_exists(dirname(dirname(__FILE__)) . '/index.php'))
4
+if (file_exists(dirname(dirname(__FILE__)) . '/index.php')) {
5 5
 	include (dirname(dirname(__FILE__)) . '/index.php');
6
-else
6
+} else {
7 7
 	exit;
8
+}
8 9
 
9 10
 ?>
10 11
\ No newline at end of file
Please login to merge, or discard this patch.
Sources/tasks/Register-Notify.php 2 patches
Braces   +9 added lines, -6 removed lines patch added patch discarded remove patch
@@ -43,9 +43,10 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@
 block discarded – undo
19 19
 class Likes_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()
Please login to merge, or discard this patch.
Sources/tasks/MsgReport-Notify.php 2 patches
Braces   +15 added lines, -10 removed lines patch added patch discarded remove patch
@@ -40,8 +40,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@
 block discarded – undo
19 19
 class Likes_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()
Please login to merge, or discard this patch.
Sources/tasks/UpdateTldRegex.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -18,10 +18,10 @@
 block discarded – undo
18 18
  */
19 19
 class Update_TLD_Regex extends SMF_BackgroundTask
20 20
 {
21
-    /**
22
-     * This executes the task. It just calls set_tld_regex() in Subs.php
23
-     * @return bool Always returns true
24
-     */
21
+	/**
22
+	 * This executes the task. It just calls set_tld_regex() in Subs.php
23
+	 * @return bool Always returns true
24
+	 */
25 25
 	public function execute()
26 26
  	{
27 27
 		global $sourcedir;
Please login to merge, or discard this patch.
Sources/tasks/MemberReportReply-Notify.php 2 patches
Braces   +15 added lines, -10 removed lines patch added patch discarded remove patch
@@ -40,8 +40,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@
 block discarded – undo
19 19
 class Likes_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()
Please login to merge, or discard this patch.
Sources/tasks/ApproveReply-Notify.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@
 block discarded – undo
18 18
 class ApproveReply_Notify_Background extends SMF_BackgroundTask
19 19
 {
20 20
 	/**
21
-     * This executes the task - loads up the information, puts the email in the queue and inserts alerts.
21
+	 * This executes the task - loads up the information, puts the email in the queue and inserts alerts.
22 22
 	 * @return bool Always returns true.
23 23
 	 */
24 24
 	public function execute()
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -96,14 +96,15 @@
 block discarded – undo
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
 	}
Please login to merge, or discard this patch.
Sources/tasks/Likes-Notify.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@
 block discarded – undo
19 19
 class Likes_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()
Please login to merge, or discard this patch.
Braces   +19 added lines, -14 removed lines patch added patch discarded remove patch
@@ -49,30 +49,33 @@  discard block
 block discarded – undo
49 49
 				$allowed = explode(',', $row['member_groups']);
50 50
 
51 51
 				// If the user is in group 1 anywhere, they can see everything anyway.
52
-				if (in_array(1, $groups) || count(array_intersect($allowed, $groups)) != 0)
53
-					$author = $row['id_member'];
52
+				if (in_array(1, $groups) || count(array_intersect($allowed, $groups)) != 0) {
53
+									$author = $row['id_member'];
54
+				}
54 55
 			}
55 56
 			$smcFunc['db_free_result']($request);
56
-		}
57
-		else
57
+		} else
58 58
 		{
59 59
 			// This isn't something we know natively how to support. Call the hooks, if they're dealing with it, return false, otherwise return the user id.
60 60
 			$hook_results = call_integration_hook('integrate_find_like_author', array($this->_details['content_type'], $this->_details['content_id']));
61
-			foreach ($hook_results as $result)
62
-				if (!empty($result))
61
+			foreach ($hook_results as $result) {
62
+							if (!empty($result))
63 63
 				{
64 64
 					$author = $result;
65
+			}
65 66
 					break;
66 67
 				}
67 68
 		}
68 69
 
69 70
 		// If we didn't have a member... leave.
70
-		if (empty($author))
71
-			return true;
71
+		if (empty($author)) {
72
+					return true;
73
+		}
72 74
 
73 75
 		// If the person who sent the notification is the person whose content it is, do nothing.
74
-		if ($author == $this->_details['sender_id'])
75
-			return true;
76
+		if ($author == $this->_details['sender_id']) {
77
+					return true;
78
+		}
76 79
 
77 80
 		require_once($sourcedir . '/Subs-Notify.php');
78 81
 		$prefs = getNotifyPrefs($author, $this->_details['content_type'] . '_like', true);
@@ -81,8 +84,9 @@  discard block
 block discarded – undo
81 84
 		// As a result, the value should really just be non empty.
82 85
 
83 86
 		// Check the value. If no value or it's empty, they didn't want alerts, oh well.
84
-		if (empty($prefs[$author][$this->_details['content_type'] . '_like']))
85
-			return true;
87
+		if (empty($prefs[$author][$this->_details['content_type'] . '_like'])) {
88
+					return true;
89
+		}
86 90
 
87 91
 		// Don't spam the alerts: if there is an existing unread alert of the
88 92
 		// requested type for the target user from the sender, don't make a new one.
@@ -102,8 +106,9 @@  discard block
 block discarded – undo
102 106
 			)
103 107
 		);
104 108
 
105
-		if ($smcFunc['db_num_rows']($request) > 0)
106
-			return true;
109
+		if ($smcFunc['db_num_rows']($request) > 0) {
110
+					return true;
111
+		}
107 112
 		$smcFunc['db_free_result']($request);
108 113
 
109 114
 		// Issue, update, move on.
Please login to merge, or discard this patch.