Completed
Pull Request — release-2.1 (#3835)
by Martyn
09:20
created
Sources/ViewQuery.php 1 patch
Braces   +34 added lines, -26 removed lines patch added patch discarded remove patch
@@ -13,8 +13,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
124 130
 				', nl2br(str_replace("\t", '&nbsp;&nbsp;&nbsp;', $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>';
Please login to merge, or discard this patch.
Sources/Printpage.php 1 patch
Braces   +30 added lines, -23 removed lines patch added patch discarded remove patch
@@ -14,8 +14,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 					{
Please login to merge, or discard this patch.
Sources/CacheAPI-memcache.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@
 block discarded – undo
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
 			{
Please login to merge, or discard this patch.
Braces   +19 added lines, -14 removed lines patch added patch discarded remove patch
@@ -11,8 +11,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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) {
Please login to merge, or discard this patch.
Sources/Topic.php 1 patch
Braces   +31 added lines, -21 removed lines patch added patch discarded remove patch
@@ -14,8 +14,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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');
Please login to merge, or discard this patch.
Sources/Subs-BoardIndex.php 1 patch
Braces   +60 added lines, -47 removed lines patch added patch discarded remove patch
@@ -14,8 +14,9 @@  discard block
 block discarded – undo
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
  * Fetches a list of boards and (optional) categories including
@@ -37,11 +38,12 @@  discard block
 block discarded – undo
37 38
 	require_once($sourcedir . '/Subs-Boards.php');
38 39
 
39 40
 	// For performance, track the latest post while going through the boards.
40
-	if (!empty($boardIndexOptions['set_latest_post']))
41
-		$latest_post = array(
41
+	if (!empty($boardIndexOptions['set_latest_post'])) {
42
+			$latest_post = array(
42 43
 			'timestamp' => 0,
43 44
 			'ref' => 0,
44 45
 		);
46
+	}
45 47
 
46 48
 	// Find all boards and categories, as well as related information.  This will be sorted by the natural order of boards and categories, which we control.
47 49
 	$result_boards = $smcFunc['db_query']('boardindex_fetch_boards', '
@@ -74,10 +76,11 @@  discard block
 block discarded – undo
74 76
 	);
75 77
 
76 78
 	// Start with an empty array.
77
-	if ($boardIndexOptions['include_categories'])
78
-		$categories = array();
79
-	else
80
-		$this_category = array();
79
+	if ($boardIndexOptions['include_categories']) {
80
+			$categories = array();
81
+	} else {
82
+			$this_category = array();
83
+	}
81 84
 	$boards = array();
82 85
 
83 86
 	// Run through the categories and boards (or only boards)....
@@ -88,8 +91,9 @@  discard block
 block discarded – undo
88 91
 		$row_board['is_read'] = !empty($row_board['is_read']) || $ignoreThisBoard ? '1' : '0';
89 92
 
90 93
 		// Add parent boards to the $boards list later used to fetch moderators
91
-		if ($row_board['id_parent'] == $boardIndexOptions['parent_id'])
92
-			$boards[] = $row_board['id_board'];
94
+		if ($row_board['id_parent'] == $boardIndexOptions['parent_id']) {
95
+					$boards[] = $row_board['id_board'];
96
+		}
93 97
 
94 98
 		if ($boardIndexOptions['include_categories'])
95 99
 		{
@@ -111,8 +115,9 @@  discard block
 block discarded – undo
111 115
 			}
112 116
 
113 117
 			// If this board has new posts in it (and isn't the recycle bin!) then the category is new.
114
-			if (empty($modSettings['recycle_enable']) || $modSettings['recycle_board'] != $row_board['id_board'])
115
-				$categories[$row_board['id_cat']]['new'] |= empty($row_board['is_read']) && $row_board['poster_name'] != '';
118
+			if (empty($modSettings['recycle_enable']) || $modSettings['recycle_board'] != $row_board['id_board']) {
119
+							$categories[$row_board['id_cat']]['new'] |= empty($row_board['is_read']) && $row_board['poster_name'] != '';
120
+			}
116 121
 
117 122
 			// Avoid showing category unread link where it only has redirection boards.
118 123
 			$categories[$row_board['id_cat']]['show_unread'] = !empty($categories[$row_board['id_cat']]['show_unread']) ? 1 : !$row_board['is_redirect'];
@@ -160,14 +165,12 @@  discard block
 block discarded – undo
160 165
 				{
161 166
 					$this_category[$row_board['id_board']]['board_class'] = 'redirect';
162 167
 					$this_category[$row_board['id_board']]['board_tooltip'] = $txt['redirect_board'];
163
-				}
164
-				elseif ($this_category[$row_board['id_board']]['new'] || $context['user']['is_guest'])
168
+				} elseif ($this_category[$row_board['id_board']]['new'] || $context['user']['is_guest'])
165 169
 				{
166 170
 					// If we're showing to guests, we want to give them the idea that something interesting is going on!
167 171
 					$this_category[$row_board['id_board']]['board_class'] = 'on';
168 172
 					$this_category[$row_board['id_board']]['board_tooltip'] = $txt['new_posts'];
169
-				}
170
-				else
173
+				} else
171 174
 				{
172 175
 					$this_category[$row_board['id_board']]['board_tooltip'] = $txt['old_posts'];
173 176
 				}
@@ -218,14 +221,16 @@  discard block
 block discarded – undo
218 221
 		// Child of a child... just add it on...
219 222
 		elseif (!empty($boardIndexOptions['countChildPosts']))
220 223
 		{
221
-			if (!isset($parent_map))
222
-				$parent_map = array();
224
+			if (!isset($parent_map)) {
225
+							$parent_map = array();
226
+			}
223 227
 
224
-			if (!isset($parent_map[$row_board['id_parent']]))
225
-				foreach ($this_category as $id => $board)
228
+			if (!isset($parent_map[$row_board['id_parent']])) {
229
+							foreach ($this_category as $id => $board)
226 230
 				{
227 231
 					if (!isset($board['children'][$row_board['id_parent']]))
228 232
 						continue;
233
+			}
229 234
 
230 235
 					$parent_map[$row_board['id_parent']] = array(&$this_category[$id], &$this_category[$id]['children'][$row_board['id_parent']]);
231 236
 					$parent_map[$row_board['id_board']] = array(&$this_category[$id], &$this_category[$id]['children'][$row_board['id_parent']]);
@@ -246,8 +251,9 @@  discard block
 block discarded – undo
246 251
 			continue;
247 252
 		}
248 253
 		// Found a child of a child - skip.
249
-		else
250
-			continue;
254
+		else {
255
+					continue;
256
+		}
251 257
 
252 258
 		// Prepare the subject, and make sure it's not too long.
253 259
 		censorText($row_board['subject']);
@@ -268,12 +274,13 @@  discard block
 block discarded – undo
268 274
 			'topic' => $row_board['id_topic']
269 275
 		);
270 276
 
271
-		if (!empty($settings['avatars_on_boardIndex']))
272
-			$this_last_post['member']['avatar'] = set_avatar_data(array(
277
+		if (!empty($settings['avatars_on_boardIndex'])) {
278
+					$this_last_post['member']['avatar'] = set_avatar_data(array(
273 279
 				'avatar' => $row_board['avatar'],
274 280
 				'email' => $row_board['email_address'],
275 281
 				'filename' => !empty($row['member_filename']) ? $row_board['member_filename'] : '',
276 282
 			));
283
+		}
277 284
 
278 285
 		// Provide the href and link.
279 286
 		if ($row_board['subject'] != '')
@@ -285,8 +292,7 @@  discard block
 block discarded – undo
285 292
 			link, href, subject, start (where they should go for the first unread post.),
286 293
 			and member. (which has id, name, link, href, username in it.) */
287 294
 			$this_last_post['last_post_message'] = sprintf($txt['last_post_message'], $this_last_post['member']['link'], $this_last_post['link'], $this_last_post['time']);
288
-		}
289
-		else
295
+		} else
290 296
 		{
291 297
 			$this_last_post['href'] = '';
292 298
 			$this_last_post['link'] = $txt['not_applicable'];
@@ -294,8 +300,9 @@  discard block
 block discarded – undo
294 300
 		}
295 301
 
296 302
 		// Set the last post in the parent board.
297
-		if ($row_board['id_parent'] == $boardIndexOptions['parent_id'] || ($isChild && !empty($row_board['poster_time']) && $this_category[$row_board['id_parent']]['last_post']['timestamp'] < forum_time(true, $row_board['poster_time'])))
298
-			$this_category[$isChild ? $row_board['id_parent'] : $row_board['id_board']]['last_post'] = $this_last_post;
303
+		if ($row_board['id_parent'] == $boardIndexOptions['parent_id'] || ($isChild && !empty($row_board['poster_time']) && $this_category[$row_board['id_parent']]['last_post']['timestamp'] < forum_time(true, $row_board['poster_time']))) {
304
+					$this_category[$isChild ? $row_board['id_parent'] : $row_board['id_board']]['last_post'] = $this_last_post;
305
+		}
299 306
 		// Just in the child...?
300 307
 		if ($isChild)
301 308
 		{
@@ -305,15 +312,17 @@  discard block
 block discarded – undo
305 312
 			$this_category[$row_board['id_parent']]['children'][$row_board['id_board']]['new'] &= $row_board['poster_name'] != '';
306 313
 		}
307 314
 		// No last post for this board?  It's not new then, is it..?
308
-		elseif ($row_board['poster_name'] == '')
309
-			$this_category[$row_board['id_board']]['new'] = false;
315
+		elseif ($row_board['poster_name'] == '') {
316
+					$this_category[$row_board['id_board']]['new'] = false;
317
+		}
310 318
 
311 319
 		// Determine a global most recent topic.
312
-		if (!empty($boardIndexOptions['set_latest_post']) && !empty($row_board['poster_time']) && $row_board['poster_time'] > $latest_post['timestamp'] && !$ignoreThisBoard)
313
-			$latest_post = array(
320
+		if (!empty($boardIndexOptions['set_latest_post']) && !empty($row_board['poster_time']) && $row_board['poster_time'] > $latest_post['timestamp'] && !$ignoreThisBoard) {
321
+					$latest_post = array(
314 322
 				'timestamp' => $row_board['poster_time'],
315 323
 				'ref' => &$this_category[$isChild ? $row_board['id_parent'] : $row_board['id_board']]['last_post'],
316 324
 			);
325
+		}
317 326
 	}
318 327
 	$smcFunc['db_free_result']($result_boards);
319 328
 
@@ -330,8 +339,9 @@  discard block
 block discarded – undo
330 339
 				if (!empty($moderators[$board['id']]))
331 340
 				{
332 341
 					$categories[$k]['boards'][$j]['moderators'] = $moderators[$board['id']];
333
-					foreach ($moderators[$board['id']] as $moderator)
334
-						$categories[$k]['boards'][$j]['link_moderators'][] = $moderator['link'];
342
+					foreach ($moderators[$board['id']] as $moderator) {
343
+											$categories[$k]['boards'][$j]['link_moderators'][] = $moderator['link'];
344
+					}
335 345
 				}
336 346
 				if (!empty($groups[$board['id']]))
337 347
 				{
@@ -344,16 +354,16 @@  discard block
 block discarded – undo
344 354
 				}
345 355
 			}
346 356
 		}
347
-	}
348
-	else
357
+	} else
349 358
 	{
350 359
 		foreach ($this_category as $k => $board)
351 360
 		{
352 361
 			if (!empty($moderators[$board['id']]))
353 362
 			{
354 363
 				$this_category[$k]['moderators'] = $moderators[$board['id']];
355
-				foreach ($moderators[$board['id']] as $moderator)
356
-					$this_category[$k]['link_moderators'][] = $moderator['link'];
364
+				foreach ($moderators[$board['id']] as $moderator) {
365
+									$this_category[$k]['link_moderators'][] = $moderator['link'];
366
+				}
357 367
 			}
358 368
 			if (!empty($groups[$board['id']]))
359 369
 			{
@@ -367,20 +377,23 @@  discard block
 block discarded – undo
367 377
 		}
368 378
 	}
369 379
 
370
-	if ($boardIndexOptions['include_categories'])
371
-		sortCategories($categories);
372
-	else
373
-		sortBoards($this_category);
380
+	if ($boardIndexOptions['include_categories']) {
381
+			sortCategories($categories);
382
+	} else {
383
+			sortBoards($this_category);
384
+	}
374 385
 
375 386
 	// By now we should know the most recent post...if we wanna know it that is.
376
-	if (!empty($boardIndexOptions['set_latest_post']) && !empty($latest_post['ref']))
377
-		$context['latest_post'] = $latest_post['ref'];
387
+	if (!empty($boardIndexOptions['set_latest_post']) && !empty($latest_post['ref'])) {
388
+			$context['latest_post'] = $latest_post['ref'];
389
+	}
378 390
 
379 391
 	// I can't remember why but trying to make a ternary to get this all in one line is actually a Very Bad Idea.
380
-	if ($boardIndexOptions['include_categories'])
381
-		call_integration_hook('integrate_getboardtree', array($boardIndexOptions, &$categories));
382
-	else
383
-		call_integration_hook('integrate_getboardtree', array($boardIndexOptions, &$this_category));
392
+	if ($boardIndexOptions['include_categories']) {
393
+			call_integration_hook('integrate_getboardtree', array($boardIndexOptions, &$categories));
394
+	} else {
395
+			call_integration_hook('integrate_getboardtree', array($boardIndexOptions, &$this_category));
396
+	}
384 397
 
385 398
 	return $boardIndexOptions['include_categories'] ? $categories : $this_category;
386 399
 }
Please login to merge, or discard this patch.
Sources/tasks/GroupAct-Notify.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -19,10 +19,10 @@
 block discarded – undo
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;
Please login to merge, or discard this patch.
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -132,8 +132,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
152 153
 					$alert_rows,
153 154
 					array()
154 155
 				);
156
+			}
155 157
 		}
156 158
 
157 159
 		return true;
Please login to merge, or discard this patch.
Sources/tasks/MsgReportReply-Notify.php 2 patches
Braces   +21 added lines, -14 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.
@@ -67,8 +69,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
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/Buddy-Notify.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@
 block discarded – undo
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()
Please login to merge, or discard this patch.
Sources/tasks/Birthday-Notify.php 2 patches
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 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;
Please login to merge, or discard this patch.
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -51,8 +51,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
127 128
 					$alert_rows,
128 129
 					array()
129 130
 				);
131
+			}
130 132
 		}
131 133
 
132 134
 		return true;
Please login to merge, or discard this patch.