Completed
Pull Request — release-2.1 (#4447)
by Martyn
19:41
created
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.
avatars/Oxygen/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.
avatars/index.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,7 +12,8 @@
 block discarded – undo
12 12
 	header('Location: ' . $boardurl);
13 13
 }
14 14
 // Can't find it... just forget it.
15
-else
15
+else {
16 16
 	exit;
17
+}
17 18
 
18 19
 ?>
19 20
\ No newline at end of file
Please login to merge, or discard this patch.
Sources/tasks/CreatePost-Notify.php 1 patch
Braces   +62 added lines, -46 removed lines patch added patch discarded remove patch
@@ -73,8 +73,9 @@  discard block
 block discarded – undo
73 73
 		while ($row = $smcFunc['db_fetch_assoc']($request))
74 74
 		{
75 75
 			$groups = array_merge(array($row['id_group'], $row['id_post_group']), (empty($row['additional_groups']) ? array() : explode(',', $row['additional_groups'])));
76
-			if (!in_array(1, $groups) && count(array_intersect($groups, explode(',', $row['member_groups']))) == 0)
77
-				continue;
76
+			if (!in_array(1, $groups) && count(array_intersect($groups, explode(',', $row['member_groups']))) == 0) {
77
+							continue;
78
+			}
78 79
 
79 80
 			$members[] = $row['id_member'];
80 81
 			$watched[$row['id_member']] = $row;
@@ -82,8 +83,9 @@  discard block
 block discarded – undo
82 83
 
83 84
 		$smcFunc['db_free_result']($request);
84 85
 
85
-		if (empty($members))
86
-			return true;
86
+		if (empty($members)) {
87
+					return true;
88
+		}
87 89
 
88 90
 		$members = array_unique($members);
89 91
 		$prefs = getNotifyPrefs($members, '', true);
@@ -105,20 +107,23 @@  discard block
 block discarded – undo
105 107
 			$notify_types = !empty($prefs[$member]['msg_notify_type']) ? $prefs[$member]['msg_notify_type'] : 1;
106 108
 
107 109
 			// Don't send a notification if the watching member ignored the member who made the action.
108
-			if (!empty($data['pm_ignore_list']) && in_array($data['id_member_updated'], explode(',', $data['pm_ignore_list'])))
109
-			    continue;
110
-			if (!in_array($type, array('reply', 'topic')) && $notify_types == 2 && $member != $data['id_member_started'])
111
-				continue;
112
-			elseif (in_array($type, array('reply', 'topic')) && $member == $posterOptions['id'])
113
-				continue;
114
-			elseif (!in_array($type, array('reply', 'topic')) && $notify_types == 3)
115
-				continue;
116
-			elseif ($notify_types == 4)
117
-				continue;
110
+			if (!empty($data['pm_ignore_list']) && in_array($data['id_member_updated'], explode(',', $data['pm_ignore_list']))) {
111
+						    continue;
112
+			}
113
+			if (!in_array($type, array('reply', 'topic')) && $notify_types == 2 && $member != $data['id_member_started']) {
114
+							continue;
115
+			} elseif (in_array($type, array('reply', 'topic')) && $member == $posterOptions['id']) {
116
+							continue;
117
+			} elseif (!in_array($type, array('reply', 'topic')) && $notify_types == 3) {
118
+							continue;
119
+			} elseif ($notify_types == 4) {
120
+							continue;
121
+			}
118 122
 
119 123
 			if ($frequency > 2 || (!empty($frequency) && $data['sent']) || in_array($member, $done_members)
120
-				|| (!empty($this->_details['members_only']) && !in_array($member, $this->_details['members_only'])))
121
-				continue;
124
+				|| (!empty($this->_details['members_only']) && !in_array($member, $this->_details['members_only']))) {
125
+							continue;
126
+			}
122 127
 
123 128
 			// Watched topic?
124 129
 			if (!empty($data['id_topic']) && $type != 'topic' && !empty($prefs[$member]))
@@ -128,10 +133,12 @@  discard block
 block discarded – undo
128 133
 
129 134
 				if ($type == 'reply')
130 135
 				{
131
-					if (!empty($prefs[$member]['msg_receive_body']))
132
-						$message_type .= '_body';
133
-					if (!empty($frequency))
134
-						$message_type .= '_once';
136
+					if (!empty($prefs[$member]['msg_receive_body'])) {
137
+											$message_type .= '_body';
138
+					}
139
+					if (!empty($frequency)) {
140
+											$message_type .= '_once';
141
+					}
135 142
 				}
136 143
 
137 144
 				$content_type = 'topic';
@@ -144,12 +151,14 @@  discard block
 block discarded – undo
144 151
 				$content_type = 'board';
145 152
 
146 153
 				$message_type = !empty($frequency) ? 'notify_boards_once' : 'notify_boards';
147
-				if (!empty($prefs[$member]['msg_receive_body']))
148
-					$message_type .= '_body';
154
+				if (!empty($prefs[$member]['msg_receive_body'])) {
155
+									$message_type .= '_body';
156
+				}
149 157
 			}
150 158
 			// If neither of the above, this might be a redundent row due to the OR clause in our SQL query, skip
151
-			else
152
-				continue;
159
+			else {
160
+							continue;
161
+			}
153 162
 
154 163
 			if ($pref & 0x02)
155 164
 			{
@@ -212,14 +221,15 @@  discard block
 block discarded – undo
212 221
 		);
213 222
 
214 223
 		// Insert the alerts if any
215
-		if (!empty($alert_rows))
216
-			$smcFunc['db_insert']('',
224
+		if (!empty($alert_rows)) {
225
+					$smcFunc['db_insert']('',
217 226
 				'{db_prefix}user_alerts',
218 227
 				array('alert_time' => 'int', 'id_member' => 'int', 'id_member_started' => 'int', 'member_name' => 'string',
219 228
 					'content_type' => 'string', 'content_id' => 'int', 'content_action' => 'string', 'is_read' => 'int', 'extra' => 'string'),
220 229
 				$alert_rows,
221 230
 				array()
222 231
 			);
232
+		}
223 233
 
224 234
 		return true;
225 235
 	}
@@ -230,8 +240,9 @@  discard block
 block discarded – undo
230 240
 
231 241
 		foreach ($quotedMembers as $id => $member)
232 242
 		{
233
-			if (!isset($prefs[$id]) || $id == $posterOptions['id'] || empty($prefs[$id]['msg_quote']))
234
-				continue;
243
+			if (!isset($prefs[$id]) || $id == $posterOptions['id'] || empty($prefs[$id]['msg_quote'])) {
244
+							continue;
245
+			}
235 246
 
236 247
 			$done_members[] = $id;
237 248
 
@@ -283,32 +294,35 @@  discard block
 block discarded – undo
283 294
 		{
284 295
 			if (preg_match('/\[quote(.*)?\]/i', $block, $matches))
285 296
 			{
286
-				if ($quote_level == 0)
287
-					$message .= '[quote' . $matches[1] . ']';
297
+				if ($quote_level == 0) {
298
+									$message .= '[quote' . $matches[1] . ']';
299
+				}
288 300
 				$quote_level++;
289
-			}
290
-			elseif (preg_match('/\[\/quote\]/i', $block))
301
+			} elseif (preg_match('/\[\/quote\]/i', $block))
291 302
 			{
292
-				if ($quote_level <= 1)
293
-					$message .= '[/quote]';
303
+				if ($quote_level <= 1) {
304
+									$message .= '[/quote]';
305
+				}
294 306
 				if ($quote_level >= 1)
295 307
 				{
296 308
 					$quote_level--;
297 309
 					$message .= "\n";
298 310
 				}
311
+			} elseif ($quote_level <= 1) {
312
+							$message .= $block;
299 313
 			}
300
-			elseif ($quote_level <= 1)
301
-				$message .= $block;
302 314
 		}
303 315
 
304 316
 		preg_match_all('/\[quote.*?link=msg=([0-9]+).*?\]/i', $message, $matches);
305 317
 
306 318
 		$id_msgs = $matches[1];
307
-		foreach ($id_msgs as $k => $id_msg)
308
-			$id_msgs[$k] = (int) $id_msg;
319
+		foreach ($id_msgs as $k => $id_msg) {
320
+					$id_msgs[$k] = (int) $id_msg;
321
+		}
309 322
 
310
-		if (empty($id_msgs))
311
-			return array();
323
+		if (empty($id_msgs)) {
324
+					return array();
325
+		}
312 326
 
313 327
 		// Get the messages
314 328
 		$request = $smcFunc['db_query']('', '
@@ -326,8 +340,9 @@  discard block
 block discarded – undo
326 340
 		$members = array();
327 341
 		while ($row = $smcFunc['db_fetch_assoc']($request))
328 342
 		{
329
-			if ($posterOptions['id'] == $row['id_member'])
330
-				continue;
343
+			if ($posterOptions['id'] == $row['id_member']) {
344
+							continue;
345
+			}
331 346
 
332 347
 			$members[$row['id_member']] = $row;
333 348
 		}
@@ -341,10 +356,11 @@  discard block
 block discarded – undo
341 356
 
342 357
 		foreach ($members as $id => $member)
343 358
 		{
344
-			if (!empty($prefs[$id]['msg_mention']))
345
-				$done_members[] = $id;
346
-			else
347
-				continue;
359
+			if (!empty($prefs[$id]['msg_mention'])) {
360
+							$done_members[] = $id;
361
+			} else {
362
+							continue;
363
+			}
348 364
 
349 365
 			// Alerts' emails are always instant
350 366
 			if ($prefs[$id]['msg_mention'] & 0x02)
Please login to merge, or discard this patch.
Sources/tasks/Likes-Notify.php 1 patch
Braces   +19 added lines, -14 removed lines patch added patch discarded remove patch
@@ -51,30 +51,33 @@  discard block
 block discarded – undo
51 51
 				$ignored_members = explode(',', $row['pm_ignore_list']);
52 52
 
53 53
 				// If the user is in group 1 anywhere, they can see everything anyway.
54
-				if (in_array(1, $groups) || count(array_intersect($allowed, $groups)) != 0)
55
-					$author = $row['id_member'];
54
+				if (in_array(1, $groups) || count(array_intersect($allowed, $groups)) != 0) {
55
+									$author = $row['id_member'];
56
+				}
56 57
 			}
57 58
 			$smcFunc['db_free_result']($request);
58
-		}
59
-		else
59
+		} else
60 60
 		{
61 61
 			// 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.
62 62
 			$hook_results = call_integration_hook('integrate_find_like_author', array($this->_details['content_type'], $this->_details['content_id']));
63
-			foreach ($hook_results as $result)
64
-				if (!empty($result))
63
+			foreach ($hook_results as $result) {
64
+							if (!empty($result))
65 65
 				{
66 66
 					$author = $result;
67
+			}
67 68
 					break;
68 69
 				}
69 70
 		}
70 71
 
71 72
 		// If we didn't have a member... leave.
72
-		if (empty($author))
73
-			return true;
73
+		if (empty($author)) {
74
+					return true;
75
+		}
74 76
 
75 77
 		// If the person who sent the notification is the person whose content it is, do nothing.
76
-		if ($author == $this->_details['sender_id'])
77
-			return true;
78
+		if ($author == $this->_details['sender_id']) {
79
+					return true;
80
+		}
78 81
 
79 82
 		// If the person who sent the notification is on this person's ignore list, do nothing.
80 83
 		if (!empty($ignored_members) && in_array($this->_details['sender_id'], $ignored_members)) {
@@ -88,8 +91,9 @@  discard block
 block discarded – undo
88 91
 		// As a result, the value should really just be non empty.
89 92
 
90 93
 		// Check the value. If no value or it's empty, they didn't want alerts, oh well.
91
-		if (empty($prefs[$author][$this->_details['content_type'] . '_like']))
92
-			return true;
94
+		if (empty($prefs[$author][$this->_details['content_type'] . '_like'])) {
95
+					return true;
96
+		}
93 97
 
94 98
 		// Don't spam the alerts: if there is an existing unread alert of the
95 99
 		// requested type for the target user from the sender, don't make a new one.
@@ -109,8 +113,9 @@  discard block
 block discarded – undo
109 113
 			)
110 114
 		);
111 115
 
112
-		if ($smcFunc['db_num_rows']($request) > 0)
113
-			return true;
116
+		if ($smcFunc['db_num_rows']($request) > 0) {
117
+					return true;
118
+		}
114 119
 		$smcFunc['db_free_result']($request);
115 120
 
116 121
 		// Issue, update, move on.
Please login to merge, or discard this patch.
Sources/CacheAPI-zend.php 1 patch
Braces   +15 added lines, -11 removed lines patch added patch discarded remove patch
@@ -11,8 +11,9 @@  discard block
 block discarded – undo
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
@@ -27,8 +28,9 @@  discard block
 block discarded – undo
27 28
 	{
28 29
 		$supported = function_exists('zend_shm_cache_fetch') || function_exists('output_cache_get');
29 30
 
30
-		if ($test)
31
-			return $supported;
31
+		if ($test) {
32
+					return $supported;
33
+		}
32 34
 		return parent::isSupported() && $supported;
33 35
 	}
34 36
 
@@ -40,10 +42,11 @@  discard block
 block discarded – undo
40 42
 		$key = $this->prefix . strtr($key, ':/', '-_');
41 43
 
42 44
 		// Zend's pricey stuff.
43
-		if (function_exists('zend_shm_cache_fetch'))
44
-			return zend_shm_cache_fetch('SMF::' . $key);
45
-		elseif (function_exists('output_cache_get'))
46
-			return output_cache_get($key, $ttl);
45
+		if (function_exists('zend_shm_cache_fetch')) {
46
+					return zend_shm_cache_fetch('SMF::' . $key);
47
+		} elseif (function_exists('output_cache_get')) {
48
+					return output_cache_get($key, $ttl);
49
+		}
47 50
 	}
48 51
 
49 52
 	/**
@@ -53,10 +56,11 @@  discard block
 block discarded – undo
53 56
 	{
54 57
 		$key = $this->prefix . strtr($key, ':/', '-_');
55 58
 
56
-		if (function_exists('zend_shm_cache_store'))
57
-			return zend_shm_cache_store('SMF::' . $key, $value, $ttl);
58
-		elseif (function_exists('output_cache_put'))
59
-			return output_cache_put($key, $value);
59
+		if (function_exists('zend_shm_cache_store')) {
60
+					return zend_shm_cache_store('SMF::' . $key, $value, $ttl);
61
+		} elseif (function_exists('output_cache_put')) {
62
+					return output_cache_put($key, $value);
63
+		}
60 64
 	}
61 65
 
62 66
 	/**
Please login to merge, or discard this patch.
Sources/CacheAPI-apc.php 1 patch
Braces   +12 added lines, -9 removed lines patch added patch discarded remove patch
@@ -11,8 +11,9 @@  discard block
 block discarded – undo
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
@@ -27,8 +28,9 @@  discard block
 block discarded – undo
27 28
 	{
28 29
 		$supported = function_exists('apc_fetch') && function_exists('apc_store');
29 30
 
30
-		if ($test)
31
-			return $supported;
31
+		if ($test) {
32
+					return $supported;
33
+		}
32 34
 		return parent::isSupported() && $supported;
33 35
 	}
34 36
 
@@ -50,10 +52,11 @@  discard block
 block discarded – undo
50 52
 		$key = $this->prefix . strtr($key, ':/', '-_');
51 53
 
52 54
 		// An extended key is needed to counteract a bug in APC.
53
-		if ($value === null)
54
-			return apc_delete($key . 'smf');
55
-		else
56
-			return apc_store($key . 'smf', $value, $ttl);
55
+		if ($value === null) {
56
+					return apc_delete($key . 'smf');
57
+		} else {
58
+					return apc_store($key . 'smf', $value, $ttl);
59
+		}
57 60
 	}
58 61
 
59 62
 	/**
@@ -67,9 +70,9 @@  discard block
 block discarded – undo
67 70
 			// Always returns true.
68 71
 			apc_clear_cache('user');
69 72
 			apc_clear_cache('system');
73
+		} elseif ($type === 'user') {
74
+					apc_clear_cache('user');
70 75
 		}
71
-		elseif ($type === 'user')
72
-			apc_clear_cache('user');
73 76
 
74 77
 		$this->invalidateCache();
75 78
 		return true;
Please login to merge, or discard this patch.
Sources/PostModeration.php 1 patch
Braces   +100 added lines, -79 removed lines patch added patch discarded remove patch
@@ -13,8 +13,9 @@  discard block
 block discarded – undo
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
  * This is a handling function for all things post moderation.
@@ -39,8 +40,9 @@  discard block
 block discarded – undo
39 40
 	);
40 41
 
41 42
 	// Pick something valid...
42
-	if (!isset($_REQUEST['sa']) || !isset($subActions[$_REQUEST['sa']]))
43
-		$_REQUEST['sa'] = 'replies';
43
+	if (!isset($_REQUEST['sa']) || !isset($subActions[$_REQUEST['sa']])) {
44
+			$_REQUEST['sa'] = 'replies';
45
+	}
44 46
 
45 47
 	call_integration_hook('integrate_post_moderation', array(&$subActions));
46 48
 
@@ -68,13 +70,15 @@  discard block
 block discarded – undo
68 70
 		$approve_boards = $approve_boards == array(0) ? $filter_board : array_intersect($approve_boards, $filter_board);
69 71
 	}
70 72
 
71
-	if ($approve_boards == array(0))
72
-		$approve_query = '';
73
-	elseif (!empty($approve_boards))
74
-		$approve_query = ' AND m.id_board IN (' . implode(',', $approve_boards) . ')';
73
+	if ($approve_boards == array(0)) {
74
+			$approve_query = '';
75
+	} elseif (!empty($approve_boards)) {
76
+			$approve_query = ' AND m.id_board IN (' . implode(',', $approve_boards) . ')';
77
+	}
75 78
 	// Nada, zip, etc...
76
-	else
77
-		$approve_query = ' AND 1=0';
79
+	else {
80
+			$approve_query = ' AND 1=0';
81
+	}
78 82
 
79 83
 	// We also need to know where we can delete topics and/or replies to.
80 84
 	if ($context['current_view'] == 'topics')
@@ -82,8 +86,7 @@  discard block
 block discarded – undo
82 86
 		$delete_own_boards = boardsAllowedTo('remove_own');
83 87
 		$delete_any_boards = boardsAllowedTo('remove_any');
84 88
 		$delete_own_replies = array();
85
-	}
86
-	else
89
+	} else
87 90
 	{
88 91
 		$delete_own_boards = boardsAllowedTo('delete_own');
89 92
 		$delete_any_boards = boardsAllowedTo('delete_any');
@@ -92,21 +95,25 @@  discard block
 block discarded – undo
92 95
 
93 96
 	$toAction = array();
94 97
 	// Check if we have something to do?
95
-	if (isset($_GET['approve']))
96
-		$toAction[] = (int) $_GET['approve'];
98
+	if (isset($_GET['approve'])) {
99
+			$toAction[] = (int) $_GET['approve'];
100
+	}
97 101
 	// Just a deletion?
98
-	elseif (isset($_GET['delete']))
99
-		$toAction[] = (int) $_GET['delete'];
102
+	elseif (isset($_GET['delete'])) {
103
+			$toAction[] = (int) $_GET['delete'];
104
+	}
100 105
 	// Lots of approvals?
101
-	elseif (isset($_POST['item']))
102
-		foreach ($_POST['item'] as $item)
106
+	elseif (isset($_POST['item'])) {
107
+			foreach ($_POST['item'] as $item)
103 108
 			$toAction[] = (int) $item;
109
+	}
104 110
 
105 111
 	// What are we actually doing.
106
-	if (isset($_GET['approve']) || (isset($_POST['do']) && $_POST['do'] == 'approve'))
107
-		$curAction = 'approve';
108
-	elseif (isset($_GET['delete']) || (isset($_POST['do']) && $_POST['do'] == 'delete'))
109
-		$curAction = 'delete';
112
+	if (isset($_GET['approve']) || (isset($_POST['do']) && $_POST['do'] == 'approve')) {
113
+			$curAction = 'approve';
114
+	} elseif (isset($_GET['delete']) || (isset($_POST['do']) && $_POST['do'] == 'delete')) {
115
+			$curAction = 'delete';
116
+	}
110 117
 
111 118
 	// Right, so we have something to do?
112 119
 	if (!empty($toAction) && isset($curAction))
@@ -135,8 +142,9 @@  discard block
 block discarded – undo
135 142
 		while ($row = $smcFunc['db_fetch_assoc']($request))
136 143
 		{
137 144
 			// If it's not within what our view is ignore it...
138
-			if (($row['id_msg'] == $row['id_first_msg'] && $context['current_view'] != 'topics') || ($row['id_msg'] != $row['id_first_msg'] && $context['current_view'] != 'replies'))
139
-				continue;
145
+			if (($row['id_msg'] == $row['id_first_msg'] && $context['current_view'] != 'topics') || ($row['id_msg'] != $row['id_first_msg'] && $context['current_view'] != 'replies')) {
146
+							continue;
147
+			}
140 148
 
141 149
 			$can_add = false;
142 150
 			// If we're approving this is simple.
@@ -148,18 +156,22 @@  discard block
 block discarded – undo
148 156
 			elseif ($curAction == 'delete')
149 157
 			{
150 158
 				// Own post is easy!
151
-				if ($row['id_member'] == $user_info['id'] && ($delete_own_boards == array(0) || in_array($row['id_board'], $delete_own_boards)))
152
-					$can_add = true;
159
+				if ($row['id_member'] == $user_info['id'] && ($delete_own_boards == array(0) || in_array($row['id_board'], $delete_own_boards))) {
160
+									$can_add = true;
161
+				}
153 162
 				// Is it a reply to their own topic?
154
-				elseif ($row['id_member'] == $row['id_member_started'] && $row['id_msg'] != $row['id_first_msg'] && ($delete_own_replies == array(0) || in_array($row['id_board'], $delete_own_replies)))
155
-					$can_add = true;
163
+				elseif ($row['id_member'] == $row['id_member_started'] && $row['id_msg'] != $row['id_first_msg'] && ($delete_own_replies == array(0) || in_array($row['id_board'], $delete_own_replies))) {
164
+									$can_add = true;
165
+				}
156 166
 				// Someone elses?
157
-				elseif ($row['id_member'] != $user_info['id'] && ($delete_any_boards == array(0) || in_array($row['id_board'], $delete_any_boards)))
158
-					$can_add = true;
167
+				elseif ($row['id_member'] != $user_info['id'] && ($delete_any_boards == array(0) || in_array($row['id_board'], $delete_any_boards))) {
168
+									$can_add = true;
169
+				}
159 170
 			}
160 171
 
161
-			if ($can_add)
162
-				$anItem = $context['current_view'] == 'topics' ? $row['id_topic'] : $row['id_msg'];
172
+			if ($can_add) {
173
+							$anItem = $context['current_view'] == 'topics' ? $row['id_topic'] : $row['id_msg'];
174
+			}
163 175
 			$toAction[] = $anItem;
164 176
 
165 177
 			// All clear. What have we got now, what, what?
@@ -177,8 +189,7 @@  discard block
 block discarded – undo
177 189
 			if ($curAction == 'approve')
178 190
 			{
179 191
 				approveMessages($toAction, $details, $context['current_view']);
180
-			}
181
-			else
192
+			} else
182 193
 			{
183 194
 				removeMessages($toAction, $details, $context['current_view']);
184 195
 			}
@@ -265,16 +276,19 @@  discard block
 block discarded – undo
265 276
 	for ($i = 1; $row = $smcFunc['db_fetch_assoc']($request); $i++)
266 277
 	{
267 278
 		// Can delete is complicated, let's solve it first... is it their own post?
268
-		if ($row['id_member'] == $user_info['id'] && ($delete_own_boards == array(0) || in_array($row['id_board'], $delete_own_boards)))
269
-			$can_delete = true;
279
+		if ($row['id_member'] == $user_info['id'] && ($delete_own_boards == array(0) || in_array($row['id_board'], $delete_own_boards))) {
280
+					$can_delete = true;
281
+		}
270 282
 		// Is it a reply to their own topic?
271
-		elseif ($row['id_member'] == $row['id_member_started'] && $row['id_msg'] != $row['id_first_msg'] && ($delete_own_replies == array(0) || in_array($row['id_board'], $delete_own_replies)))
272
-			$can_delete = true;
283
+		elseif ($row['id_member'] == $row['id_member_started'] && $row['id_msg'] != $row['id_first_msg'] && ($delete_own_replies == array(0) || in_array($row['id_board'], $delete_own_replies))) {
284
+					$can_delete = true;
285
+		}
273 286
 		// Someone elses?
274
-		elseif ($row['id_member'] != $user_info['id'] && ($delete_any_boards == array(0) || in_array($row['id_board'], $delete_any_boards)))
275
-			$can_delete = true;
276
-		else
277
-			$can_delete = false;
287
+		elseif ($row['id_member'] != $user_info['id'] && ($delete_any_boards == array(0) || in_array($row['id_board'], $delete_any_boards))) {
288
+					$can_delete = true;
289
+		} else {
290
+					$can_delete = false;
291
+		}
278 292
 
279 293
 		$context['unapproved_items'][] = array(
280 294
 			'id' => $row['id_msg'],
@@ -323,28 +337,31 @@  discard block
 block discarded – undo
323 337
 	// Once again, permissions are king!
324 338
 	$approve_boards = boardsAllowedTo('approve_posts');
325 339
 
326
-	if ($approve_boards == array(0))
327
-		$approve_query = '';
328
-	elseif (!empty($approve_boards))
329
-		$approve_query = ' AND m.id_board IN (' . implode(',', $approve_boards) . ')';
330
-	else
331
-		$approve_query = ' AND 1=0';
340
+	if ($approve_boards == array(0)) {
341
+			$approve_query = '';
342
+	} elseif (!empty($approve_boards)) {
343
+			$approve_query = ' AND m.id_board IN (' . implode(',', $approve_boards) . ')';
344
+	} else {
345
+			$approve_query = ' AND 1=0';
346
+	}
332 347
 
333 348
 	// Get together the array of things to act on, if any.
334 349
 	$attachments = array();
335
-	if (isset($_GET['approve']))
336
-		$attachments[] = (int) $_GET['approve'];
337
-	elseif (isset($_GET['delete']))
338
-		$attachments[] = (int) $_GET['delete'];
339
-	elseif (isset($_POST['item']))
340
-		foreach ($_POST['item'] as $item)
350
+	if (isset($_GET['approve'])) {
351
+			$attachments[] = (int) $_GET['approve'];
352
+	} elseif (isset($_GET['delete'])) {
353
+			$attachments[] = (int) $_GET['delete'];
354
+	} elseif (isset($_POST['item'])) {
355
+			foreach ($_POST['item'] as $item)
341 356
 			$attachments[] = (int) $item;
357
+	}
342 358
 
343 359
 	// Are we approving or deleting?
344
-	if (isset($_GET['approve']) || (isset($_POST['do']) && $_POST['do'] == 'approve'))
345
-		$curAction = 'approve';
346
-	elseif (isset($_GET['delete']) || (isset($_POST['do']) && $_POST['do'] == 'delete'))
347
-		$curAction = 'delete';
360
+	if (isset($_GET['approve']) || (isset($_POST['do']) && $_POST['do'] == 'approve')) {
361
+			$curAction = 'approve';
362
+	} elseif (isset($_GET['delete']) || (isset($_POST['do']) && $_POST['do'] == 'delete')) {
363
+			$curAction = 'delete';
364
+	}
348 365
 
349 366
 	// Something to do, let's do it!
350 367
 	if (!empty($attachments) && isset($curAction))
@@ -372,17 +389,19 @@  discard block
 block discarded – undo
372 389
 			)
373 390
 		);
374 391
 		$attachments = array();
375
-		while ($row = $smcFunc['db_fetch_assoc']($request))
376
-			$attachments[] = $row['id_attach'];
392
+		while ($row = $smcFunc['db_fetch_assoc']($request)) {
393
+					$attachments[] = $row['id_attach'];
394
+		}
377 395
 		$smcFunc['db_free_result']($request);
378 396
 
379 397
 		// Assuming it wasn't all like, proper illegal, we can do the approving.
380 398
 		if (!empty($attachments))
381 399
 		{
382
-			if ($curAction == 'approve')
383
-				ApproveAttachments($attachments);
384
-			else
385
-				removeAttachments(array('id_attach' => $attachments, 'do_logging' => true));
400
+			if ($curAction == 'approve') {
401
+							ApproveAttachments($attachments);
402
+			} else {
403
+							removeAttachments(array('id_attach' => $attachments, 'do_logging' => true));
404
+			}
386 405
 		}
387 406
 	}
388 407
 
@@ -682,15 +701,16 @@  discard block
 block discarded – undo
682 701
 	{
683 702
 		approveTopics($topic, !$approved);
684 703
 
685
-		if ($starter != $user_info['id'])
686
-			logAction(($approved ? 'un' : '') . 'approve_topic', array('topic' => $topic, 'subject' => $subject, 'member' => $starter, 'board' => $board));
687
-	}
688
-	else
704
+		if ($starter != $user_info['id']) {
705
+					logAction(($approved ? 'un' : '') . 'approve_topic', array('topic' => $topic, 'subject' => $subject, 'member' => $starter, 'board' => $board));
706
+		}
707
+	} else
689 708
 	{
690 709
 		approvePosts($_REQUEST['msg'], !$approved);
691 710
 
692
-		if ($poster != $user_info['id'])
693
-			logAction(($approved ? 'un' : '') . 'approve', array('topic' => $topic, 'subject' => $subject, 'member' => $poster, 'board' => $board));
711
+		if ($poster != $user_info['id']) {
712
+					logAction(($approved ? 'un' : '') . 'approve', array('topic' => $topic, 'subject' => $subject, 'member' => $poster, 'board' => $board));
713
+		}
694 714
 	}
695 715
 
696 716
 	redirectexit('topic=' . $topic . '.msg' . $_REQUEST['msg'] . '#msg' . $_REQUEST['msg']);
@@ -716,8 +736,7 @@  discard block
 block discarded – undo
716 736
 		{
717 737
 			logAction('approve_topic', array('topic' => $topic, 'subject' => $messageDetails[$topic]['subject'], 'member' => $messageDetails[$topic]['member'], 'board' => $messageDetails[$topic]['board']));
718 738
 		}
719
-	}
720
-	else
739
+	} else
721 740
 	{
722 741
 		approvePosts($messages);
723 742
 		// and tell the world about it again
@@ -745,8 +764,9 @@  discard block
 block discarded – undo
745 764
 		)
746 765
 	);
747 766
 	$msgs = array();
748
-	while ($row = $smcFunc['db_fetch_row']($request))
749
-		$msgs[] = $row[0];
767
+	while ($row = $smcFunc['db_fetch_row']($request)) {
768
+			$msgs[] = $row[0];
769
+	}
750 770
 	$smcFunc['db_free_result']($request);
751 771
 
752 772
 	if (!empty($msgs))
@@ -765,8 +785,9 @@  discard block
 block discarded – undo
765 785
 		)
766 786
 	);
767 787
 	$attaches = array();
768
-	while ($row = $smcFunc['db_fetch_row']($request))
769
-		$attaches[] = $row[0];
788
+	while ($row = $smcFunc['db_fetch_row']($request)) {
789
+			$attaches[] = $row[0];
790
+	}
770 791
 	$smcFunc['db_free_result']($request);
771 792
 
772 793
 	if (!empty($attaches))
@@ -794,12 +815,12 @@  discard block
 block discarded – undo
794 815
 	{
795 816
 		removeTopics($messages);
796 817
 		// and tell the world about it
797
-		foreach ($messages as $topic)
798
-			// Note, only log topic ID in native form if it's not gone forever.
818
+		foreach ($messages as $topic) {
819
+					// Note, only log topic ID in native form if it's not gone forever.
799 820
 			logAction('remove', array(
800 821
 				(empty($modSettings['recycle_enable']) || $modSettings['recycle_board'] != $messageDetails[$topic]['board'] ? 'topic' : 'old_topic_id') => $topic, 'subject' => $messageDetails[$topic]['subject'], 'member' => $messageDetails[$topic]['member'], 'board' => $messageDetails[$topic]['board']));
801
-	}
802
-	else
822
+		}
823
+	} else
803 824
 	{
804 825
 		foreach ($messages as $post)
805 826
 		{
Please login to merge, or discard this patch.
Sources/BoardIndex.php 1 patch
Braces   +20 added lines, -13 removed lines patch added patch discarded remove patch
@@ -14,8 +14,9 @@  discard block
 block discarded – undo
14 14
  * @version 2.1 Beta 4
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
  * This function shows the board index.
@@ -34,8 +35,9 @@  discard block
 block discarded – undo
34 35
 	$context['canonical_url'] = $scripturl;
35 36
 
36 37
 	// Do not let search engines index anything if there is a random thing in $_GET.
37
-	if (!empty($_GET))
38
-		$context['robot_no_index'] = true;
38
+	if (!empty($_GET)) {
39
+			$context['robot_no_index'] = true;
40
+	}
39 41
 
40 42
 	// Retrieve the categories and boards.
41 43
 	require_once($sourcedir . '/Subs-BoardIndex.php');
@@ -62,11 +64,12 @@  discard block
 block discarded – undo
62 64
 			$context['latest_posts'] = cache_quick_get('boardindex-latest_posts:' . md5($user_info['query_wanna_see_board'] . $user_info['language']), 'Subs-Recent.php', 'cache_getLastPosts', array($latestPostOptions));
63 65
 		}
64 66
 
65
-		if (!empty($context['latest_posts']) || !empty($context['latest_post']))
66
-			$context['info_center'][] = array(
67
+		if (!empty($context['latest_posts']) || !empty($context['latest_post'])) {
68
+					$context['info_center'][] = array(
67 69
 				'tpl' => 'recent',
68 70
 				'txt' => 'recent_posts',
69 71
 			);
72
+		}
70 73
 	}
71 74
 
72 75
 	// Load the calendar?
@@ -87,20 +90,22 @@  discard block
 block discarded – undo
87 90
 		// This is used to show the "how-do-I-edit" help.
88 91
 		$context['calendar_can_edit'] = allowedTo('calendar_edit_any');
89 92
 
90
-		if ($context['show_calendar'])
91
-			$context['info_center'][] = array(
93
+		if ($context['show_calendar']) {
94
+					$context['info_center'][] = array(
92 95
 				'tpl' => 'calendar',
93 96
 				'txt' => $context['calendar_only_today'] ? 'calendar_today' : 'calendar_upcoming',
94 97
 			);
98
+		}
95 99
 	}
96 100
 
97 101
 	// And stats.
98 102
 	$context['show_stats'] = allowedTo('view_stats') && !empty($modSettings['trackStats']);
99
-	if ($settings['show_stats_index'])
100
-		$context['info_center'][] = array(
103
+	if ($settings['show_stats_index']) {
104
+			$context['info_center'][] = array(
101 105
 				'tpl' => 'stats',
102 106
 				'txt' => 'forum_stats',
103 107
 			);
108
+	}
104 109
 
105 110
 	// Now the online stuff
106 111
 	require_once($sourcedir . '/Subs-MembersOnline.php');
@@ -118,12 +123,14 @@  discard block
 block discarded – undo
118 123
 			);
119 124
 
120 125
 	// Track most online statistics? (Subs-MembersOnline.php)
121
-	if (!empty($modSettings['trackStats']))
122
-		trackStatsUsersOnline($context['num_guests'] + $context['num_spiders'] + $context['num_users_online']);
126
+	if (!empty($modSettings['trackStats'])) {
127
+			trackStatsUsersOnline($context['num_guests'] + $context['num_spiders'] + $context['num_users_online']);
128
+	}
123 129
 
124 130
 	// Are we showing all membergroups on the board index?
125
-	if (!empty($settings['show_group_key']))
126
-		$context['membergroups'] = cache_quick_get('membergroup_list', 'Subs-Membergroups.php', 'cache_getMembergroupList', array());
131
+	if (!empty($settings['show_group_key'])) {
132
+			$context['membergroups'] = cache_quick_get('membergroup_list', 'Subs-Membergroups.php', 'cache_getMembergroupList', array());
133
+	}
127 134
 
128 135
 	// And back to normality.
129 136
 	$context['page_title'] = sprintf($txt['forum_index'], $context['forum_name']);
Please login to merge, or discard this patch.