Completed
Pull Request — release-2.1 (#3931)
by Fran
07:05
created
Themes/default/ManageScheduledTasks.template.php 1 patch
Braces   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -20,12 +20,12 @@
 block discarded – undo
20 20
 	// We completed some tasks?
21 21
 	if (!empty($context['tasks_were_run']))
22 22
 	{
23
-		if (empty($context['scheduled_errors']))
24
-			echo '
23
+		if (empty($context['scheduled_errors'])) {
24
+					echo '
25 25
 	<div class="infobox">
26 26
 		', $txt['scheduled_tasks_were_run'], '
27 27
 	</div>';
28
-		else
28
+		} else
29 29
 		{
30 30
 			echo '
31 31
 	<div class="errorbox" id="errors">
Please login to merge, or discard this patch.
Themes/default/Xml.template.php 1 patch
Braces   +50 added lines, -37 removed lines patch added patch discarded remove patch
@@ -74,10 +74,10 @@  discard block
 block discarded – undo
74 74
 		<subject is_first="', $context['message']['first_in_topic'] ? '1' : '0', '"><![CDATA[', cleanXml($context['message']['subject']), ']]></subject>
75 75
 		<body><![CDATA[', $context['message']['body'], ']]></body>
76 76
 		<success><![CDATA[', $txt['quick_modify_message'], ']]></success>';
77
-	}
78
-	else
79
-		echo '
77
+	} else {
78
+			echo '
80 79
 		<error in_subject="', $context['message']['error_in_subject'] ? '1' : '0', '" in_body="', cleanXml($context['message']['error_in_body']) ? '1' : '0', '"><![CDATA[', implode('<br />', $context['message']['errors']), ']]></error>';
80
+	}
81 81
 	echo '
82 82
 	</message>
83 83
 </smf>';
@@ -101,13 +101,14 @@  discard block
 block discarded – undo
101 101
 
102 102
 		echo '
103 103
 		<modified><![CDATA[', empty($modified) ? '' : cleanXml('&#171; <em>' . $modified . '</em>&#187;'), ']]></modified>';
104
-		if (!empty($context['message']['subject']))
105
-			echo '
104
+		if (!empty($context['message']['subject'])) {
105
+					echo '
106 106
 		<subject><![CDATA[', cleanXml($context['message']['subject']), ']]></subject>';
107
-	}
108
-	else
109
-		echo '
107
+		}
108
+	} else {
109
+			echo '
110 110
 		<error in_subject="', $context['message']['error_in_subject'] ? '1' : '0', '"><![CDATA[', cleanXml(implode('<br />', $context['message']['errors'])), ']]></error>';
111
+	}
111 112
 	echo '
112 113
 	</message>
113 114
 </smf>';
@@ -127,10 +128,11 @@  discard block
 block discarded – undo
127 128
 		<body><![CDATA[', $context['preview_message'], ']]></body>
128 129
 	</preview>
129 130
 	<errors serious="', empty($context['error_type']) || $context['error_type'] != 'serious' ? '0' : '1', '" topic_locked="', $context['locked'] ? '1' : '0', '">';
130
-	if (!empty($context['post_error']))
131
-		foreach ($context['post_error'] as $message)
131
+	if (!empty($context['post_error'])) {
132
+			foreach ($context['post_error'] as $message)
132 133
 			echo '
133 134
 		<error><![CDATA[', cleanXml($message), ']]></error>';
135
+	}
134 136
 	echo '
135 137
 		<caption name="guestname" class="', isset($context['post_error']['long_name']) || isset($context['post_error']['no_name']) || isset($context['post_error']['bad_name']) ? 'error' : '', '" />
136 138
 		<caption name="email" class="', isset($context['post_error']['no_email']) || isset($context['post_error']['bad_email']) ? 'error' : '', '" />
@@ -145,14 +147,15 @@  discard block
 block discarded – undo
145 147
 	{
146 148
 		echo '
147 149
 	<new_posts>';
148
-		foreach ($context['previous_posts'] as $post)
149
-			echo '
150
+		foreach ($context['previous_posts'] as $post) {
151
+					echo '
150 152
 		<post id="', $post['id'], '">
151 153
 			<time><![CDATA[', $post['time'], ']]></time>
152 154
 			<poster><![CDATA[', cleanXml($post['poster']), ']]></poster>
153 155
 			<message><![CDATA[', cleanXml($post['message']), ']]></message>
154 156
 			<is_ignored>', $post['is_ignored'] ? '1' : '0', '</is_ignored>
155 157
 		</post>';
158
+		}
156 159
 		echo '
157 160
 	</new_posts>';
158 161
 	}
@@ -176,10 +179,11 @@  discard block
 block discarded – undo
176 179
 		<body><![CDATA[', $context['preview_message'], ']]></body>
177 180
 	</preview>
178 181
 	<errors serious="', empty($context['error_type']) || $context['error_type'] != 'serious' ? '0' : '1', '">';
179
-	if (!empty($context['post_error']['messages']))
180
-		foreach ($context['post_error']['messages'] as $message)
182
+	if (!empty($context['post_error']['messages'])) {
183
+			foreach ($context['post_error']['messages'] as $message)
181 184
 			echo '
182 185
 		<error><![CDATA[', cleanXml($message), ']]></error>';
186
+	}
183 187
 
184 188
 	echo '
185 189
 		<caption name="to" class="', isset($context['post_error']['no_to']) ? 'error' : '', '" />
@@ -208,10 +212,11 @@  discard block
 block discarded – undo
208 212
 		<body><![CDATA[', $context['preview_message'], ']]></body>
209 213
 	</preview>
210 214
 	<errors serious="', empty($context['error_type']) || $context['error_type'] != 'serious' ? '0' : '1', '">';
211
-	if (!empty($context['post_error']['messages']))
212
-		foreach ($context['post_error']['messages'] as $message)
215
+	if (!empty($context['post_error']['messages'])) {
216
+			foreach ($context['post_error']['messages'] as $message)
213 217
 			echo '
214 218
 		<error><![CDATA[', cleanXml($message), ']]></error>';
219
+	}
215 220
 
216 221
 	echo '
217 222
 	</errors>';
@@ -227,19 +232,22 @@  discard block
 block discarded – undo
227 232
 {
228 233
 	global $context, $modSettings;
229 234
 
230
-	if (empty($context['yearly']))
231
-		return;
235
+	if (empty($context['yearly'])) {
236
+			return;
237
+	}
232 238
 
233 239
 	echo '<', '?xml version="1.0" encoding="', $context['character_set'], '"?', '>
234 240
 <smf>';
235
-	foreach ($context['yearly'] as $year)
236
-		foreach ($year['months'] as $month)
241
+	foreach ($context['yearly'] as $year) {
242
+			foreach ($year['months'] as $month)
237 243
 		{
238 244
 			echo '
239 245
 	<month id="', $month['date']['year'], $month['date']['month'], '">';
240
-			foreach ($month['days'] as $day)
241
-				echo '
246
+	}
247
+			foreach ($month['days'] as $day) {
248
+							echo '
242 249
 		<day date="', $day['year'], '-', $day['month'], '-', $day['day'], '" new_topics="', $day['new_topics'], '" new_posts="', $day['new_posts'], '" new_members="', $day['new_members'], '" most_members_online="', $day['most_members_online'], '"', empty($modSettings['hitStats']) ? '' : ' hits="' . $day['hits'] . '"', ' />';
250
+			}
243 251
 			echo '
244 252
 	</month>';
245 253
 		}
@@ -260,17 +268,18 @@  discard block
 block discarded – undo
260 268
 	<pageIndex section="selected" startFrom="', $context['selected']['start'], '"><![CDATA[', $context['selected']['page_index'], ']]></pageIndex>';
261 269
 	foreach ($context['changes'] as $change)
262 270
 	{
263
-		if ($change['type'] == 'remove')
264
-			echo '
271
+		if ($change['type'] == 'remove') {
272
+					echo '
265 273
 	<change id="', $change['id'], '" curAction="remove" section="', $change['section'], '" />';
266
-		else
267
-			echo '
274
+		} else {
275
+					echo '
268 276
 	<change id="', $change['id'], '" curAction="insert" section="', $change['section'], '">
269 277
 		<subject><![CDATA[', cleanXml($change['insert_value']['subject']), ']]></subject>
270 278
 		<time><![CDATA[', cleanXml($change['insert_value']['time']), ']]></time>
271 279
 		<body><![CDATA[', cleanXml($change['insert_value']['body']), ']]></body>
272 280
 		<poster><![CDATA[', cleanXml($change['insert_value']['poster']), ']]></poster>
273 281
 	</change>';
282
+		}
274 283
 	}
275 284
 	echo '
276 285
 </smf>';
@@ -301,10 +310,10 @@  discard block
 block discarded – undo
301 310
 	echo '<', '?xml version="1.0" encoding="', $context['character_set'], '"?', '>
302 311
 <smf>';
303 312
 
304
-	if (empty($context['topics']))
305
-		echo '
313
+	if (empty($context['topics'])) {
314
+			echo '
306 315
 		<noresults>', $txt['search_no_results'], '</noresults>';
307
-	else
316
+	} else
308 317
 	{
309 318
 		echo '
310 319
 		<results>';
@@ -370,9 +379,10 @@  discard block
 block discarded – undo
370 379
 	{
371 380
 		echo '
372 381
 	<item type="category" id="', $category['id'], '"><![CDATA[', cleanXml($category['name']), ']]></item>';
373
-		foreach ($category['boards'] as $board)
374
-			echo '
382
+		foreach ($category['boards'] as $board) {
383
+					echo '
375 384
 	<item type="board" id="', $board['id'], '" childlevel="', $board['child_level'], '"><![CDATA[', cleanXml($board['name']), ']]></item>';
385
+		}
376 386
 	}
377 387
 	echo '
378 388
 </smf>';
@@ -387,9 +397,10 @@  discard block
 block discarded – undo
387 397
 
388 398
 	echo '<', '?xml version="1.0" encoding="', $context['character_set'], '"?', '>
389 399
 <smf>';
390
-	foreach ($context['icons'] as $icon)
391
-		echo '
400
+	foreach ($context['icons'] as $icon) {
401
+			echo '
392 402
 	<icon value="', $icon['value'], '" url="', $icon['url'], '"><![CDATA[', cleanXml($icon['name']), ']]></icon>';
403
+	}
393 404
 	echo '
394 405
 </smf>';
395 406
 }
@@ -438,16 +449,18 @@  discard block
 block discarded – undo
438 449
 	foreach ($xml_data as $key => $data)
439 450
 	{
440 451
 		// A group?
441
-		if (is_array($data) && isset($data['identifier']))
442
-			template_generic_xml_recursive($data['children'], $key, $data['identifier'], $level);
452
+		if (is_array($data) && isset($data['identifier'])) {
453
+					template_generic_xml_recursive($data['children'], $key, $data['identifier'], $level);
454
+		}
443 455
 		// An item...
444 456
 		elseif (is_array($data) && isset($data['value']))
445 457
 		{
446 458
 			echo "\n", str_repeat("\t", $level), '<', $child_ident;
447 459
 
448
-			if (!empty($data['attributes']))
449
-				foreach ($data['attributes'] as $k => $v)
460
+			if (!empty($data['attributes'])) {
461
+							foreach ($data['attributes'] as $k => $v)
450 462
 					echo ' ' . $k . '="' . $v . '"';
463
+			}
451 464
 			echo '><![CDATA[', cleanXml($data['value']), ']]></', $child_ident, '>';
452 465
 		}
453 466
 
Please login to merge, or discard this patch.
Themes/default/Who.template.php 1 patch
Braces   +39 added lines, -27 removed lines patch added patch discarded remove patch
@@ -31,9 +31,10 @@  discard block
 block discarded – undo
31 31
 					<div class="selectbox floatright" id="upper_show">', $txt['who_show1'], '
32 32
 						<select name="show_top" onchange="document.forms.whoFilter.show.value = this.value; document.forms.whoFilter.submit();">';
33 33
 
34
-	foreach ($context['show_methods'] as $value => $label)
35
-		echo '
34
+	foreach ($context['show_methods'] as $value => $label) {
35
+			echo '
36 36
 							<option value="', $value, '" ', $value == $context['show_by'] ? ' selected' : '', '>', $label, '</option>';
37
+	}
37 38
 	echo '
38 39
 						</select>
39 40
 						<noscript>
@@ -71,9 +72,10 @@  discard block
 block discarded – undo
71 72
 									', $member['is_guest'] ? $member['name'] : '<a href="' . $member['href'] . '" title="' . $txt['profile_of'] . ' ' . $member['name'] . '"' . (empty($member['color']) ? '' : ' style="color: ' . $member['color'] . '"') . '>' . $member['name'] . '</a>', '
72 73
 								</span>';
73 74
 
74
-		if (!empty($member['ip']))
75
-			echo '
75
+		if (!empty($member['ip'])) {
76
+					echo '
76 77
 								(<a href="' . $scripturl . '?action=', ($member['is_guest'] ? 'trackip' : 'profile;area=tracking;sa=ip;u=' . $member['id']), ';searchip=' . $member['ip'] . '">' . $member['ip'] . '</a>)';
78
+		}
77 79
 
78 80
 		echo '
79 81
 							</td>
@@ -103,9 +105,10 @@  discard block
 block discarded – undo
103 105
 					<div class="selectbox floatright">', $txt['who_show1'], '
104 106
 						<select name="show" onchange="document.forms.whoFilter.submit();">';
105 107
 
106
-	foreach ($context['show_methods'] as $value => $label)
107
-		echo '
108
+	foreach ($context['show_methods'] as $value => $label) {
109
+			echo '
108 110
 							<option value="', $value, '" ', $value == $context['show_by'] ? ' selected' : '', '>', $label, '</option>';
111
+	}
109 112
 	echo '
110 113
 						</select>
111 114
 						<noscript>
@@ -134,17 +137,19 @@  discard block
 block discarded – undo
134 137
 
135 138
 	foreach ($context['credits'] as $section)
136 139
 	{
137
-		if (isset($section['pretext']))
138
-		echo '
140
+		if (isset($section['pretext'])) {
141
+				echo '
139 142
 		<div class="windowbg noup">
140 143
 			<p>', $section['pretext'], '</p>
141 144
 		</div>';
145
+		}
142 146
 
143
-		if (isset($section['title']))
144
-		echo '
147
+		if (isset($section['title'])) {
148
+				echo '
145 149
 		<div class="cat_bar">
146 150
 			<h3 class="catbg">', $section['title'], '</h3>
147 151
 		</div>';
152
+		}
148 153
 
149 154
 		echo '
150 155
 		<div class="windowbg2 noup">
@@ -152,17 +157,18 @@  discard block
 block discarded – undo
152 157
 
153 158
 		foreach ($section['groups'] as $group)
154 159
 		{
155
-			if (isset($group['title']))
156
-				echo '
160
+			if (isset($group['title'])) {
161
+							echo '
157 162
 				<dt>
158 163
 					<strong>', $group['title'], '</strong>
159 164
 				</dt>
160 165
 				<dd>';
166
+			}
161 167
 
162 168
 			// Try to make this read nicely.
163
-			if (count($group['members']) <= 2)
164
-				echo implode(' ' . $txt['credits_and'] . ' ', $group['members']);
165
-			else
169
+			if (count($group['members']) <= 2) {
170
+							echo implode(' ' . $txt['credits_and'] . ' ', $group['members']);
171
+			} else
166 172
 			{
167 173
 				$last_peep = array_pop($group['members']);
168 174
 				echo implode(', ', $group['members']), ' ', $txt['credits_and'], ' ', $last_peep;
@@ -175,9 +181,10 @@  discard block
 block discarded – undo
175 181
 		echo '
176 182
 			</dl>';
177 183
 
178
-		if (isset($section['posttext']))
179
-			echo '
184
+		if (isset($section['posttext'])) {
185
+					echo '
180 186
 				<p class="posttext">', $section['posttext'], '</p>';
187
+		}
181 188
 
182 189
 		echo '
183 190
 		</div>';
@@ -192,26 +199,29 @@  discard block
 block discarded – undo
192 199
 		</div>
193 200
 		<div class="windowbg noup">';
194 201
 
195
-		if (!empty($context['credits_software_graphics']['graphics']))
196
-			echo '
202
+		if (!empty($context['credits_software_graphics']['graphics'])) {
203
+					echo '
197 204
 			<dl>
198 205
 				<dt><strong>', $txt['credits_graphics'], '</strong></dt>
199 206
 				<dd>', implode('</dd><dd>', $context['credits_software_graphics']['graphics']), '</dd>
200 207
 			</dl>';
208
+		}
201 209
 
202
-		if (!empty($context['credits_software_graphics']['software']))
203
-			echo '
210
+		if (!empty($context['credits_software_graphics']['software'])) {
211
+					echo '
204 212
 			<dl>
205 213
 				<dt><strong>', $txt['credits_software'], '</strong></dt>
206 214
 				<dd>', implode('</dd><dd>', $context['credits_software_graphics']['software']), '</dd>
207 215
 			</dl>';
216
+		}
208 217
 
209
-		if (!empty($context['credits_software_graphics']['fonts']))
210
-			echo '
218
+		if (!empty($context['credits_software_graphics']['fonts'])) {
219
+					echo '
211 220
 			<dl>
212 221
 				<dt><strong>', $txt['credits_fonts'], '</strong></dt>
213 222
 				<dd>', implode('</dd><dd>', $context['credits_software_graphics']['fonts']), '</dd>
214 223
 			</dl>';
224
+		}
215 225
 		echo '
216 226
 		</div>';
217 227
 	}
@@ -226,16 +236,18 @@  discard block
 block discarded – undo
226 236
 		<div class="windowbg noup">';
227 237
 
228 238
 		// Display the credits.
229
-		if (!empty($context['credits_modifications']))
230
-			echo '
239
+		if (!empty($context['credits_modifications'])) {
240
+					echo '
231 241
 			', implode('
232 242
 			<br>', $context['credits_modifications']);
243
+		}
233 244
 
234 245
 		// Legacy.
235
-		if (!empty($context['copyrights']['mods']))
236
-			echo (empty($context['credits_modifications']) ? '<br>' : ''),
246
+		if (!empty($context['copyrights']['mods'])) {
247
+					echo (empty($context['credits_modifications']) ? '<br>' : ''),
237 248
 			implode('
238 249
 			<br>', $context['copyrights']['mods']);
250
+		}
239 251
 
240 252
 		echo '
241 253
 		</div>';
Please login to merge, or discard this patch.
Themes/default/Stats.template.php 1 patch
Braces   +26 added lines, -18 removed lines patch added patch discarded remove patch
@@ -44,10 +44,11 @@  discard block
 block discarded – undo
44 44
 				<dt>', $txt['users_online_today'], ':</dt>
45 45
 				<dd>', $context['online_today'], '</dd>';
46 46
 
47
-	if (!empty($modSettings['hitStats']))
48
-		echo '
47
+	if (!empty($modSettings['hitStats'])) {
48
+			echo '
49 49
 				<dt>', $txt['num_hits'], ':</dt>
50 50
 				<dd>', $context['num_hits'], '</dd>';
51
+	}
51 52
 
52 53
 	echo '
53 54
 			</dl>
@@ -71,17 +72,19 @@  discard block
 block discarded – undo
71 72
 				<dt>', $txt['gender_stats'], ':</dt>
72 73
 				<dd>';
73 74
 
74
-		foreach ($context['gender'] as $g => $n)
75
-			echo $g, ': ', $n, '<br>';
75
+		foreach ($context['gender'] as $g => $n) {
76
+					echo $g, ': ', $n, '<br>';
77
+		}
76 78
 
77 79
 		echo '
78 80
 				</dd>';
79 81
 	}
80 82
 
81
-	if (!empty($modSettings['hitStats']))
82
-		echo '
83
+	if (!empty($modSettings['hitStats'])) {
84
+			echo '
83 85
 				<dt>', $txt['average_hits'], ':</dt>
84 86
 				<dd>', $context['average_hits'], '</dd>';
87
+	}
85 88
 
86 89
 	echo '
87 90
 			</dl>';
@@ -105,14 +108,15 @@  discard block
 block discarded – undo
105 108
 						</dt>
106 109
 						<dd class="statsbar">';
107 110
 
108
-			if (!empty($item['percent']))
109
-				echo '
111
+			if (!empty($item['percent'])) {
112
+							echo '
110 113
 							<div class="bar" style="width: ', $item['percent'], '%;">
111 114
 								<span class="righttext">', $item['num'], '</span>
112 115
 							</div>';
113
-			else
114
-				echo '
116
+			} else {
117
+							echo '
115 118
 							<div class="bar empty"><span class="righttext">', $item['num'], '</span></div>';
119
+			}
116 120
 
117 121
 			echo '
118 122
 						</dd>';
@@ -144,9 +148,10 @@  discard block
 block discarded – undo
144 148
 					<th>', $txt['stats_new_members'], '</th>
145 149
 					<th>', $txt['most_online'], '</th>';
146 150
 
147
-		if (!empty($modSettings['hitStats']))
148
-			echo '
151
+		if (!empty($modSettings['hitStats'])) {
152
+					echo '
149 153
 					<th>', $txt['page_views'], '</th>';
154
+		}
150 155
 
151 156
 		echo '
152 157
 				</tr>
@@ -165,9 +170,10 @@  discard block
 block discarded – undo
165 170
 					<th>', $year['new_members'], '</th>
166 171
 					<th>', $year['most_members_online'], '</th>';
167 172
 
168
-			if (!empty($modSettings['hitStats']))
169
-				echo '
173
+			if (!empty($modSettings['hitStats'])) {
174
+							echo '
170 175
 					<th>', $year['hits'], '</th>';
176
+			}
171 177
 
172 178
 			echo '
173 179
 				</tr>';
@@ -184,9 +190,10 @@  discard block
 block discarded – undo
184 190
 					<th>', $month['new_members'], '</th>
185 191
 					<th>', $month['most_members_online'], '</th>';
186 192
 
187
-				if (!empty($modSettings['hitStats']))
188
-					echo '
193
+				if (!empty($modSettings['hitStats'])) {
194
+									echo '
189 195
 					<th>', $month['hits'], '</th>';
196
+				}
190 197
 
191 198
 				echo '
192 199
 				</tr>';
@@ -203,9 +210,10 @@  discard block
 block discarded – undo
203 210
 					<td>', $day['new_members'], '</td>
204 211
 					<td>', $day['most_members_online'], '</td>';
205 212
 
206
-						if (!empty($modSettings['hitStats']))
207
-							echo '
213
+						if (!empty($modSettings['hitStats'])) {
214
+													echo '
208 215
 					<td>', $day['hits'], '</td>';
216
+						}
209 217
 
210 218
 						echo '
211 219
 				</tr>';
Please login to merge, or discard this patch.
cron.php 1 patch
Braces   +36 added lines, -28 removed lines patch added patch discarded remove patch
@@ -41,37 +41,43 @@  discard block
 block discarded – undo
41 41
 define('TIME_START', microtime(true));
42 42
 
43 43
 // Just being safe...
44
-foreach (array('db_character_set', 'cachedir') as $variable)
44
+foreach (array('db_character_set', 'cachedir') as $variable) {
45 45
 	if (isset($GLOBALS[$variable]))
46 46
 		unset($GLOBALS[$variable]);
47
+}
47 48
 
48 49
 // Get the forum's settings for database and file paths.
49 50
 require_once(dirname(__FILE__) . '/Settings.php');
50 51
 
51 52
 // Make absolutely sure the cache directory is defined.
52
-if ((empty($cachedir) || !file_exists($cachedir)) && file_exists($boarddir . '/cache'))
53
+if ((empty($cachedir) || !file_exists($cachedir)) && file_exists($boarddir . '/cache')) {
53 54
 	$cachedir = $boarddir . '/cache';
55
+}
54 56
 
55 57
 // Don't do john didley if the forum's been shut down competely.
56
-if ($maintenance == 2)
58
+if ($maintenance == 2) {
57 59
 	die($mmessage);
60
+}
58 61
 
59 62
 // Fix for using the current directory as a path.
60
-if (substr($sourcedir, 0, 1) == '.' && substr($sourcedir, 1, 1) != '.')
63
+if (substr($sourcedir, 0, 1) == '.' && substr($sourcedir, 1, 1) != '.') {
61 64
 	$sourcedir = dirname(__FILE__) . substr($sourcedir, 1);
65
+}
62 66
 
63 67
 // Have we already turned this off? If so, exist gracefully.
64
-if (file_exists($cachedir . '/cron.lock'))
68
+if (file_exists($cachedir . '/cron.lock')) {
65 69
 	obExit_cron();
70
+}
66 71
 
67 72
 // Before we go any further, if this is not a CLI request, we need to do some checking.
68 73
 if (!FROM_CLI)
69 74
 {
70 75
 	// We will clean up $_GET shortly. But we want to this ASAP.
71 76
 	$ts = isset($_GET['ts']) ? (int) $_GET['ts'] : 0;
72
-	if ($ts <= 0 || $ts % 15 != 0 || time() - $ts < 0 || time() - $ts > 20)
73
-		obExit_cron();
74
-}
77
+	if ($ts <= 0 || $ts % 15 != 0 || time() - $ts < 0 || time() - $ts > 20) {
78
+			obExit_cron();
79
+	}
80
+	}
75 81
 
76 82
 // Load the most important includes. In general, a background should be loading its own dependencies.
77 83
 require_once($sourcedir . '/Errors.php');
@@ -123,8 +129,9 @@  discard block
 block discarded – undo
123 129
 	global $smcFunc;
124 130
 
125 131
 	// Check we haven't run over our time limit.
126
-	if (microtime(true) - TIME_START > MAX_CRON_TIME)
127
-		return false;
132
+	if (microtime(true) - TIME_START > MAX_CRON_TIME) {
133
+			return false;
134
+	}
128 135
 
129 136
 	// Try to find a task. Specifically, try to find one that hasn't been claimed previously, or failing that,
130 137
 	// a task that was claimed but failed for whatever reason and failed long enough ago. We should not care
@@ -159,14 +166,12 @@  discard block
 block discarded – undo
159 166
 			// Update the time and go back.
160 167
 			$row['claimed_time'] = time();
161 168
 			return $row;
162
-		}
163
-		else
169
+		} else
164 170
 		{
165 171
 			// Uh oh, we just missed it. Try to claim another one, and let it fall through if there aren't any.
166 172
 			return fetch_task();
167 173
 		}
168
-	}
169
-	else
174
+	} else
170 175
 	{
171 176
 		// No dice. Clean up and go home.
172 177
 		$smcFunc['db_free_result']($request);
@@ -187,8 +192,9 @@  discard block
 block discarded – undo
187 192
 	if (!empty($task_details['task_file']))
188 193
 	{
189 194
 		$include = strtr(trim($task_details['task_file']), array('$boarddir' => $boarddir, '$sourcedir' => $sourcedir));
190
-		if (file_exists($include))
191
-			require_once($include);
195
+		if (file_exists($include)) {
196
+					require_once($include);
197
+		}
192 198
 	}
193 199
 
194 200
 	if (empty($task_details['task_class']))
@@ -204,8 +210,7 @@  discard block
 block discarded – undo
204 210
 		$details = empty($task_details['task_data']) ? array() : json_decode($task_details['task_data'], true);
205 211
 		$bgtask = new $task_details['task_class']($details);
206 212
 		return $bgtask->execute();
207
-	}
208
-	else
213
+	} else
209 214
 	{
210 215
 		log_error('Invalid background task specified: (class: ' . $task_details['task_class'] . ', ' . (empty($task_details['task_file']) ? ' no file' : ' to load ' . $task_details['task_file']) . ')');
211 216
 		return true; // So we clear it from the queue.
@@ -224,8 +229,9 @@  discard block
 block discarded – undo
224 229
 	$scripturl = $boardurl . '/index.php';
225 230
 
226 231
 	// These keys shouldn't be set...ever.
227
-	if (isset($_REQUEST['GLOBALS']) || isset($_COOKIE['GLOBALS']))
228
-		die('Invalid request variable.');
232
+	if (isset($_REQUEST['GLOBALS']) || isset($_COOKIE['GLOBALS'])) {
233
+			die('Invalid request variable.');
234
+	}
229 235
 
230 236
 	// Save some memory.. (since we don't use these anyway.)
231 237
 	unset($GLOBALS['HTTP_POST_VARS'], $GLOBALS['HTTP_POST_VARS']);
@@ -246,26 +252,28 @@  discard block
 block discarded – undo
246 252
 	global $modSettings;
247 253
 
248 254
 	// Ignore errors if we're ignoring them or they are strict notices from PHP 5 (which cannot be solved without breaking PHP 4.)
249
-	if (error_reporting() == 0 || (defined('E_STRICT') && $error_level == E_STRICT && !empty($modSettings['enableErrorLogging'])))
250
-		return;
255
+	if (error_reporting() == 0 || (defined('E_STRICT') && $error_level == E_STRICT && !empty($modSettings['enableErrorLogging']))) {
256
+			return;
257
+	}
251 258
 
252 259
 	$error_type = 'cron';
253 260
 
254 261
 	log_error($error_level . ': ' . $error_string, $error_type, $file, $line);
255 262
 
256 263
 	// If this is an E_ERROR or E_USER_ERROR.... die.  Violently so.
257
-	if ($error_level % 255 == E_ERROR)
258
-		die('No direct access...');
259
-}
264
+	if ($error_level % 255 == E_ERROR) {
265
+			die('No direct access...');
266
+	}
267
+	}
260 268
 
261 269
 /**
262 270
  * The exit function
263 271
  */
264 272
 function obExit_cron()
265 273
 {
266
-	if (FROM_CLI)
267
-		die(0);
268
-	else
274
+	if (FROM_CLI) {
275
+			die(0);
276
+	} else
269 277
 	{
270 278
 		header('Content-Type: image/gif');
271 279
 		die("\x47\x49\x46\x38\x39\x61\x01\x00\x01\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x21\xF9\x04\x01\x00\x00\x00\x00\x2C\x00\x00\x00\x00\x01\x00\x01\x00\x00\x02\x02\x44\x01\x00\x3B");
Please login to merge, or discard this patch.
subscriptions.php 1 patch
Braces   +38 added lines, -28 removed lines patch added patch discarded remove patch
@@ -16,8 +16,9 @@  discard block
 block discarded – undo
16 16
 
17 17
 // Start things rolling by getting SMF alive...
18 18
 $ssi_guest_access = true;
19
-if (!file_exists(dirname(__FILE__) . '/SSI.php'))
19
+if (!file_exists(dirname(__FILE__) . '/SSI.php')) {
20 20
 	die('Cannot find SSI.php');
21
+}
21 22
 
22 23
 require_once(dirname(__FILE__) . '/SSI.php');
23 24
 require_once($sourcedir . '/ManagePaid.php');
@@ -35,20 +36,22 @@  discard block
 block discarded – undo
35 36
 }
36 37
 
37 38
 // I assume we're even active?
38
-if (empty($modSettings['paid_enabled']))
39
+if (empty($modSettings['paid_enabled'])) {
39 40
 	exit;
41
+}
40 42
 
41 43
 // If we have some custom people who find out about problems load them here.
42 44
 $notify_users = array();
43 45
 if (!empty($modSettings['paid_email_to']))
44 46
 {
45
-	foreach (explode(',', $modSettings['paid_email_to']) as $email)
46
-		$notify_users[] = array(
47
+	foreach (explode(',', $modSettings['paid_email_to']) as $email) {
48
+			$notify_users[] = array(
47 49
 			'email' => $email,
48 50
 			'name' => $txt['who_member'],
49 51
 			'id' => 0,
50 52
 		);
51
-}
53
+	}
54
+	}
52 55
 
53 56
 // We need to see whether we can find the correct payment gateway,
54 57
 // we'll going to go through all our gateway scripts and find out
@@ -65,8 +68,9 @@  discard block
 block discarded – undo
65 68
 	}
66 69
 }
67 70
 
68
-if (empty($txnType))
71
+if (empty($txnType)) {
69 72
 	generateSubscriptionError($txt['paid_unknown_transaction_type']);
73
+}
70 74
 
71 75
 // Get the subscription and member ID amoungst others...
72 76
 @list($subscription_id, $member_id) = $gatewayClass->precheck();
@@ -76,8 +80,9 @@  discard block
 block discarded – undo
76 80
 $member_id = (int) $member_id;
77 81
 
78 82
 // This would be bad...
79
-if (empty($member_id))
83
+if (empty($member_id)) {
80 84
 	generateSubscriptionError($txt['paid_empty_member']);
85
+}
81 86
 
82 87
 // Verify the member.
83 88
 $request = $smcFunc['db_query']('', '
@@ -89,8 +94,9 @@  discard block
 block discarded – undo
89 94
 	)
90 95
 );
91 96
 // Didn't find them?
92
-if ($smcFunc['db_num_rows']($request) === 0)
97
+if ($smcFunc['db_num_rows']($request) === 0) {
93 98
 	generateSubscriptionError(sprintf($txt['paid_could_not_find_member'], $member_id));
99
+}
94 100
 $member_info = $smcFunc['db_fetch_assoc']($request);
95 101
 $smcFunc['db_free_result']($request);
96 102
 
@@ -105,8 +111,9 @@  discard block
 block discarded – undo
105 111
 );
106 112
 
107 113
 // Didn't find it?
108
-if ($smcFunc['db_num_rows']($request) === 0)
114
+if ($smcFunc['db_num_rows']($request) === 0) {
109 115
 	generateSubscriptionError(sprintf($txt['paid_count_not_find_subscription'], $member_id, $subscription_id));
116
+}
110 117
 
111 118
 $subscription_info = $smcFunc['db_fetch_assoc']($request);
112 119
 $smcFunc['db_free_result']($request);
@@ -123,8 +130,9 @@  discard block
 block discarded – undo
123 130
 		'current_member' => $member_id,
124 131
 	)
125 132
 );
126
-if ($smcFunc['db_num_rows']($request) === 0)
133
+if ($smcFunc['db_num_rows']($request) === 0) {
127 134
 	generateSubscriptionError(sprintf($txt['paid_count_not_find_subscription_log'], $member_id, $subscription_id));
135
+}
128 136
 $subscription_info += $smcFunc['db_fetch_assoc']($request);
129 137
 $smcFunc['db_free_result']($request);
130 138
 
@@ -139,8 +147,7 @@  discard block
 block discarded – undo
139 147
 		removeSubscription($subscription_id, $member_id);
140 148
 		$subscription_act = time();
141 149
 		$status = 0;
142
-	}
143
-	else
150
+	} else
144 151
 	{
145 152
 		loadSubscriptions();
146 153
 		$subscription_act = $subscription_info['end_time'] - $context['subscriptions'][$subscription_id]['num_length'];
@@ -188,16 +195,18 @@  discard block
 block discarded – undo
188 195
 	if (!$gatewayClass->isSubscription())
189 196
 	{
190 197
 		$real_details = json_decode($subscription_info['pending_details'], true);
191
-		if (empty($real_details))
192
-			generateSubscriptionError(sprintf($txt['paid_count_not_find_outstanding_payment'], $member_id, $subscription_id));
198
+		if (empty($real_details)) {
199
+					generateSubscriptionError(sprintf($txt['paid_count_not_find_outstanding_payment'], $member_id, $subscription_id));
200
+		}
193 201
 
194 202
 		// Now we just try to find anything pending.
195 203
 		// We don't really care which it is as security happens later.
196 204
 		foreach ($real_details as $id => $detail)
197 205
 		{
198 206
 			unset($real_details[$id]);
199
-			if ($detail[3] == 'payback' && $subscription_info['payments_pending'])
200
-				$subscription_info['payments_pending']--;
207
+			if ($detail[3] == 'payback' && $subscription_info['payments_pending']) {
208
+							$subscription_info['payments_pending']--;
209
+			}
201 210
 			break;
202 211
 		}
203 212
 
@@ -223,10 +232,11 @@  discard block
 block discarded – undo
223 232
 		// This is a little harder, can we find the right duration?
224 233
 		foreach ($cost as $duration => $value)
225 234
 		{
226
-			if ($duration == 'fixed')
227
-				continue;
228
-			elseif ((float) $value == (float) $total_cost)
229
-				$found_duration = strtoupper(substr($duration, 0, 1));
235
+			if ($duration == 'fixed') {
236
+							continue;
237
+			} elseif ((float) $value == (float) $total_cost) {
238
+							$found_duration = strtoupper(substr($duration, 0, 1));
239
+			}
230 240
 		}
231 241
 
232 242
 		// If we have the duration then we're done.
@@ -235,8 +245,7 @@  discard block
 block discarded – undo
235 245
 			$notify = true;
236 246
 			addSubscription($subscription_id, $member_id, $found_duration);
237 247
 		}
238
-	}
239
-	else
248
+	} else
240 249
 	{
241 250
 		$actual_cost = $cost['fixed'];
242 251
 
@@ -268,10 +277,10 @@  discard block
 block discarded – undo
268 277
 // Maybe they're cancelling. Some subscriptions may require actively doing something, but PayPal doesn't, for example.
269 278
 elseif ($gatewayClass->isCancellation())
270 279
 {
271
-	if (method_exists($gatewayClass, 'performCancel'))
272
-		$gatewayClass->performCancel($subscription_id, $member_id, $subscription_info);
273
-}
274
-else
280
+	if (method_exists($gatewayClass, 'performCancel')) {
281
+			$gatewayClass->performCancel($subscription_id, $member_id, $subscription_info);
282
+	}
283
+	} else
275 284
 {
276 285
 	// Some other "valid" transaction such as:
277 286
 	//
@@ -308,8 +317,9 @@  discard block
 block discarded – undo
308 317
 	// Maybe we can try to give them the post data?
309 318
 	if (!empty($_POST))
310 319
 	{
311
-		foreach ($_POST as $key => $val)
312
-			$text .= '<br>' . $smcFunc['htmlspecialchars']($key) . ': ' . $smcFunc['htmlspecialchars']($val);
320
+		foreach ($_POST as $key => $val) {
321
+					$text .= '<br>' . $smcFunc['htmlspecialchars']($key) . ': ' . $smcFunc['htmlspecialchars']($val);
322
+		}
313 323
 	}
314 324
 
315 325
 	// Then just log and die.
Please login to merge, or discard this patch.
Sources/Subs-Categories.php 1 patch
Braces   +44 added lines, -29 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
  * Edit the position and properties of a category.
@@ -42,8 +43,9 @@  discard block
 block discarded – undo
42 43
 		$cat_order = array();
43 44
 
44 45
 		// Setting 'move_after' to '0' moves the category to the top.
45
-		if ($catOptions['move_after'] == 0)
46
-			$cats[] = $category_id;
46
+		if ($catOptions['move_after'] == 0) {
47
+					$cats[] = $category_id;
48
+		}
47 49
 
48 50
 		// Grab the categories sorted by cat_order.
49 51
 		$request = $smcFunc['db_query']('', '
@@ -55,17 +57,19 @@  discard block
 block discarded – undo
55 57
 		);
56 58
 		while ($row = $smcFunc['db_fetch_assoc']($request))
57 59
 		{
58
-			if ($row['id_cat'] != $category_id)
59
-				$cats[] = $row['id_cat'];
60
-			if ($row['id_cat'] == $catOptions['move_after'])
61
-				$cats[] = $category_id;
60
+			if ($row['id_cat'] != $category_id) {
61
+							$cats[] = $row['id_cat'];
62
+			}
63
+			if ($row['id_cat'] == $catOptions['move_after']) {
64
+							$cats[] = $category_id;
65
+			}
62 66
 			$cat_order[$row['id_cat']] = $row['cat_order'];
63 67
 		}
64 68
 		$smcFunc['db_free_result']($request);
65 69
 
66 70
 		// Set the new order for the categories.
67
-		foreach ($cats as $index => $cat)
68
-			if ($index != $cat_order[$cat])
71
+		foreach ($cats as $index => $cat) {
72
+					if ($index != $cat_order[$cat])
69 73
 				$smcFunc['db_query']('', '
70 74
 					UPDATE {db_prefix}categories
71 75
 					SET cat_order = {int:new_order}
@@ -75,6 +79,7 @@  discard block
 block discarded – undo
75 79
 						'current_category' => $cat,
76 80
 					)
77 81
 				);
82
+		}
78 83
 
79 84
 		// If the category order changed, so did the board order.
80 85
 		require_once($sourcedir . '/Subs-Boards.php');
@@ -117,8 +122,9 @@  discard block
 block discarded – undo
117 122
 			))
118 123
 		);
119 124
 
120
-		if (empty($catOptions['dont_log']))
121
-			logAction('edit_cat', array('catname' => isset($catOptions['cat_name']) ? $catOptions['cat_name'] : $category_id), 'admin');
125
+		if (empty($catOptions['dont_log'])) {
126
+					logAction('edit_cat', array('catname' => isset($catOptions['cat_name']) ? $catOptions['cat_name'] : $category_id), 'admin');
127
+		}
122 128
 	}
123 129
 }
124 130
 
@@ -135,16 +141,20 @@  discard block
 block discarded – undo
135 141
 	global $smcFunc;
136 142
 
137 143
 	// Check required values.
138
-	if (!isset($catOptions['cat_name']) || trim($catOptions['cat_name']) == '')
139
-		trigger_error('createCategory(): A category name is required', E_USER_ERROR);
144
+	if (!isset($catOptions['cat_name']) || trim($catOptions['cat_name']) == '') {
145
+			trigger_error('createCategory(): A category name is required', E_USER_ERROR);
146
+	}
140 147
 
141 148
 	// Set default values.
142
-	if (!isset($catOptions['cat_desc']))
143
-		$catOptions['cat_desc'] = '';
144
-	if (!isset($catOptions['move_after']))
145
-		$catOptions['move_after'] = 0;
146
-	if (!isset($catOptions['is_collapsible']))
147
-		$catOptions['is_collapsible'] = true;
149
+	if (!isset($catOptions['cat_desc'])) {
150
+			$catOptions['cat_desc'] = '';
151
+	}
152
+	if (!isset($catOptions['move_after'])) {
153
+			$catOptions['move_after'] = 0;
154
+	}
155
+	if (!isset($catOptions['is_collapsible'])) {
156
+			$catOptions['is_collapsible'] = true;
157
+	}
148 158
 	// Don't log an edit right after.
149 159
 	$catOptions['dont_log'] = true;
150 160
 
@@ -212,21 +222,24 @@  discard block
 block discarded – undo
212 222
 			)
213 223
 		);
214 224
 		$boards_inside = array();
215
-		while ($row = $smcFunc['db_fetch_assoc']($request))
216
-			$boards_inside[] = $row['id_board'];
225
+		while ($row = $smcFunc['db_fetch_assoc']($request)) {
226
+					$boards_inside[] = $row['id_board'];
227
+		}
217 228
 		$smcFunc['db_free_result']($request);
218 229
 
219
-		if (!empty($boards_inside))
220
-			deleteBoards($boards_inside, null);
230
+		if (!empty($boards_inside)) {
231
+					deleteBoards($boards_inside, null);
232
+		}
221 233
 	}
222 234
 
223 235
 	// Make sure the safe category is really safe.
224
-	elseif (in_array($moveBoardsTo, $categories))
225
-		trigger_error('deleteCategories(): You cannot move the boards to a category that\'s being deleted', E_USER_ERROR);
236
+	elseif (in_array($moveBoardsTo, $categories)) {
237
+			trigger_error('deleteCategories(): You cannot move the boards to a category that\'s being deleted', E_USER_ERROR);
238
+	}
226 239
 
227 240
 	// Move the boards inside the categories to a safe category.
228
-	else
229
-		$smcFunc['db_query']('', '
241
+	else {
242
+			$smcFunc['db_query']('', '
230 243
 			UPDATE {db_prefix}boards
231 244
 			SET id_cat = {int:new_parent_cat}
232 245
 			WHERE id_cat IN ({array_int:category_list})',
@@ -235,6 +248,7 @@  discard block
 block discarded – undo
235 248
 				'new_parent_cat' => $moveBoardsTo,
236 249
 			)
237 250
 		);
251
+	}
238 252
 
239 253
 	// Do the deletion of the category itself
240 254
 	$smcFunc['db_query']('', '
@@ -246,8 +260,9 @@  discard block
 block discarded – undo
246 260
 	);
247 261
 
248 262
 	// Log what we've done.
249
-	foreach ($categories as $category)
250
-		logAction('delete_cat', array('catname' => $cat_tree[$category]['node']['name']), 'admin');
263
+	foreach ($categories as $category) {
264
+			logAction('delete_cat', array('catname' => $cat_tree[$category]['node']['name']), 'admin');
265
+	}
251 266
 
252 267
 	// Get all boards back into the right order.
253 268
 	reorderBoards();
Please login to merge, or discard this patch.
Sources/Who.php 3 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -590,7 +590,7 @@  discard block
 block discarded – undo
590 590
 						'Shitiz &quot;Dragooon&quot; Garg',
591 591
 						'Karl &quot;RegularExpression&quot; Benson',
592 592
 						'Matthew &quot;Labradoodle-360&quot; Kerle',
593
-						$user_info['is_admin'] ? 'Matt &quot;Grudge&quot; Wolf': 'Grudge',
593
+						$user_info['is_admin'] ? 'Matt &quot;Grudge&quot; Wolf' : 'Grudge',
594 594
 						'Michael &quot;Thantos&quot; Miller',
595 595
 						'Norv',
596 596
 						'Peter "Arantor" Spicer',
@@ -813,13 +813,13 @@  discard block
 block discarded – undo
813 813
 			$credit_info = smf_json_decode($row['credits'], true);
814 814
 
815 815
 			$copyright = empty($credit_info['copyright']) ? '' : $txt['credits_copyright'] . ' &copy; ' . $smcFunc['htmlspecialchars']($credit_info['copyright']);
816
-			$license = empty($credit_info['license']) ? '' : $txt['credits_license'] . ': ' . (!empty($credit_info['licenseurl']) ? '<a href="'. $smcFunc['htmlspecialchars']($credit_info['licenseurl']) .'">'. $smcFunc['htmlspecialchars']($credit_info['license']) .'</a>' : $smcFunc['htmlspecialchars']($credit_info['license']));
816
+			$license = empty($credit_info['license']) ? '' : $txt['credits_license'] . ': ' . (!empty($credit_info['licenseurl']) ? '<a href="' . $smcFunc['htmlspecialchars']($credit_info['licenseurl']) . '">' . $smcFunc['htmlspecialchars']($credit_info['license']) . '</a>' : $smcFunc['htmlspecialchars']($credit_info['license']));
817 817
 			$version = $txt['credits_version'] . ' ' . $row['version'];
818 818
 			$title = (empty($credit_info['title']) ? $row['name'] : $smcFunc['htmlspecialchars']($credit_info['title'])) . ': ' . $version;
819 819
 
820 820
 			// build this one out and stash it away
821 821
 			$mod_name = empty($credit_info['url']) ? $title : '<a href="' . $credit_info['url'] . '">' . $title . '</a>';
822
-			$mods[] = $mod_name . (!empty($license) ? ' | ' . $license  : '') . (!empty($copyright) ? ' | ' . $copyright  : '');
822
+			$mods[] = $mod_name . (!empty($license) ? ' | ' . $license : '') . (!empty($copyright) ? ' | ' . $copyright : '');
823 823
 		}
824 824
 		cache_put_data('mods_credits', $mods, 86400);
825 825
 	}
Please login to merge, or discard this patch.
Braces   +126 added lines, -95 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
  * Who's online, and what are they doing?
@@ -35,8 +36,9 @@  discard block
 block discarded – undo
35 36
 	isAllowedTo('who_view');
36 37
 
37 38
 	// You can't do anything if this is off.
38
-	if (empty($modSettings['who_enabled']))
39
-		fatal_lang_error('who_off', false);
39
+	if (empty($modSettings['who_enabled'])) {
40
+			fatal_lang_error('who_off', false);
41
+	}
40 42
 
41 43
 	// Load the 'Who' template.
42 44
 	loadTemplate('Who');
@@ -71,9 +73,9 @@  discard block
 block discarded – undo
71 73
 		$show_methods['spiders'] = '(lo.id_member = 0 AND lo.id_spider > 0)';
72 74
 		$show_methods['guests'] = '(lo.id_member = 0 AND lo.id_spider = 0)';
73 75
 		$context['show_methods']['spiders'] = $txt['who_show_spiders_only'];
76
+	} elseif (empty($modSettings['show_spider_online']) && isset($_SESSION['who_online_filter']) && $_SESSION['who_online_filter'] == 'spiders') {
77
+			unset($_SESSION['who_online_filter']);
74 78
 	}
75
-	elseif (empty($modSettings['show_spider_online']) && isset($_SESSION['who_online_filter']) && $_SESSION['who_online_filter'] == 'spiders')
76
-		unset($_SESSION['who_online_filter']);
77 79
 
78 80
 	// Does the user prefer a different sort direction?
79 81
 	if (isset($_REQUEST['sort']) && isset($sort_methods[$_REQUEST['sort']]))
@@ -97,20 +99,24 @@  discard block
 block discarded – undo
97 99
 	$context['sort_direction'] = isset($_REQUEST['asc']) || (isset($_REQUEST['sort_dir']) && $_REQUEST['sort_dir'] == 'asc') ? 'up' : 'down';
98 100
 
99 101
 	$conditions = array();
100
-	if (!allowedTo('moderate_forum'))
101
-		$conditions[] = '(COALESCE(mem.show_online, 1) = 1)';
102
+	if (!allowedTo('moderate_forum')) {
103
+			$conditions[] = '(COALESCE(mem.show_online, 1) = 1)';
104
+	}
102 105
 
103 106
 	// Fallback to top filter?
104
-	if (isset($_REQUEST['submit_top']) && isset($_REQUEST['show_top']))
105
-		$_REQUEST['show'] = $_REQUEST['show_top'];
107
+	if (isset($_REQUEST['submit_top']) && isset($_REQUEST['show_top'])) {
108
+			$_REQUEST['show'] = $_REQUEST['show_top'];
109
+	}
106 110
 	// Does the user wish to apply a filter?
107
-	if (isset($_REQUEST['show']) && isset($show_methods[$_REQUEST['show']]))
108
-		$context['show_by'] = $_SESSION['who_online_filter'] = $_REQUEST['show'];
111
+	if (isset($_REQUEST['show']) && isset($show_methods[$_REQUEST['show']])) {
112
+			$context['show_by'] = $_SESSION['who_online_filter'] = $_REQUEST['show'];
113
+	}
109 114
 	// Perhaps we saved a filter earlier in the session?
110
-	elseif (isset($_SESSION['who_online_filter']))
111
-		$context['show_by'] = $_SESSION['who_online_filter'];
112
-	else
113
-		$context['show_by'] = 'members';
115
+	elseif (isset($_SESSION['who_online_filter'])) {
116
+			$context['show_by'] = $_SESSION['who_online_filter'];
117
+	} else {
118
+			$context['show_by'] = 'members';
119
+	}
114 120
 
115 121
 	$conditions[] = $show_methods[$context['show_by']];
116 122
 
@@ -156,8 +162,9 @@  discard block
 block discarded – undo
156 162
 	while ($row = $smcFunc['db_fetch_assoc']($request))
157 163
 	{
158 164
 		$actions = smf_json_decode($row['url'], true);
159
-		if ($actions === false)
160
-			continue;
165
+		if ($actions === false) {
166
+					continue;
167
+		}
161 168
 
162 169
 		// Send the information to the template.
163 170
 		$context['members'][$row['session']] = array(
@@ -195,8 +202,8 @@  discard block
 block discarded – undo
195 202
 	$spiderContext = array();
196 203
 	if (!empty($modSettings['show_spider_online']) && ($modSettings['show_spider_online'] == 2 || allowedTo('admin_forum')) && !empty($modSettings['spider_name_cache']))
197 204
 	{
198
-		foreach (smf_json_decode($modSettings['spider_name_cache'], true) as $id => $name)
199
-			$spiderContext[$id] = array(
205
+		foreach (smf_json_decode($modSettings['spider_name_cache'], true) as $id => $name) {
206
+					$spiderContext[$id] = array(
200 207
 				'id' => 0,
201 208
 				'name' => $name,
202 209
 				'group' => $txt['spiders'],
@@ -205,6 +212,7 @@  discard block
 block discarded – undo
205 212
 				'email' => $name,
206 213
 				'is_guest' => true
207 214
 			);
215
+		}
208 216
 	}
209 217
 
210 218
 	$url_data = determineActions($url_data);
@@ -219,16 +227,18 @@  discard block
 block discarded – undo
219 227
 	// Put it in the context variables.
220 228
 	foreach ($context['members'] as $i => $member)
221 229
 	{
222
-		if ($member['id'] != 0)
223
-			$member['id'] = loadMemberContext($member['id']) ? $member['id'] : 0;
230
+		if ($member['id'] != 0) {
231
+					$member['id'] = loadMemberContext($member['id']) ? $member['id'] : 0;
232
+		}
224 233
 
225 234
 		// Keep the IP that came from the database.
226 235
 		$memberContext[$member['id']]['ip'] = $member['ip'];
227 236
 		$context['members'][$i]['action'] = isset($url_data[$i]) ? $url_data[$i] : $txt['who_hidden'];
228
-		if ($member['id'] == 0 && isset($spiderContext[$member['id_spider']]))
229
-			$context['members'][$i] += $spiderContext[$member['id_spider']];
230
-		else
231
-			$context['members'][$i] += $memberContext[$member['id']];
237
+		if ($member['id'] == 0 && isset($spiderContext[$member['id_spider']])) {
238
+					$context['members'][$i] += $spiderContext[$member['id_spider']];
239
+		} else {
240
+					$context['members'][$i] += $memberContext[$member['id']];
241
+		}
232 242
 	}
233 243
 
234 244
 	// Some people can't send personal messages...
@@ -263,8 +273,9 @@  discard block
 block discarded – undo
263 273
 {
264 274
 	global $txt, $user_info, $modSettings, $smcFunc;
265 275
 
266
-	if (!allowedTo('who_view'))
267
-		return array();
276
+	if (!allowedTo('who_view')) {
277
+			return array();
278
+	}
268 279
 	loadLanguage('Who');
269 280
 
270 281
 	// Actions that require a specific permission level.
@@ -292,10 +303,11 @@  discard block
 block discarded – undo
292 303
 	);
293 304
 	call_integration_hook('who_allowed', array(&$allowedActions));
294 305
 
295
-	if (!is_array($urls))
296
-		$url_list = array(array($urls, $user_info['id']));
297
-	else
298
-		$url_list = $urls;
306
+	if (!is_array($urls)) {
307
+			$url_list = array(array($urls, $user_info['id']));
308
+	} else {
309
+			$url_list = $urls;
310
+	}
299 311
 
300 312
 	// These are done to later query these in large chunks. (instead of one by one.)
301 313
 	$topic_ids = array();
@@ -307,12 +319,14 @@  discard block
 block discarded – undo
307 319
 	{
308 320
 		// Get the request parameters..
309 321
 		$actions = smf_json_decode($url[0], true);
310
-		if ($actions === false)
311
-			continue;
322
+		if ($actions === false) {
323
+					continue;
324
+		}
312 325
 
313 326
 		// If it's the admin or moderation center, and there is an area set, use that instead.
314
-		if (isset($actions['action']) && ($actions['action'] == 'admin' || $actions['action'] == 'moderate') && isset($actions['area']))
315
-			$actions['action'] = $actions['area'];
327
+		if (isset($actions['action']) && ($actions['action'] == 'admin' || $actions['action'] == 'moderate') && isset($actions['area'])) {
328
+					$actions['action'] = $actions['area'];
329
+		}
316 330
 
317 331
 		// Check if there was no action or the action is display.
318 332
 		if (!isset($actions['action']) || $actions['action'] == 'display')
@@ -332,12 +346,14 @@  discard block
 block discarded – undo
332 346
 				$board_ids[$actions['board']][$k] = $txt['who_board'];
333 347
 			}
334 348
 			// It's the board index!!  It must be!
335
-			else
336
-				$data[$k] = $txt['who_index'];
349
+			else {
350
+							$data[$k] = $txt['who_index'];
351
+			}
337 352
 		}
338 353
 		// Probably an error or some goon?
339
-		elseif ($actions['action'] == '')
340
-			$data[$k] = $txt['who_index'];
354
+		elseif ($actions['action'] == '') {
355
+					$data[$k] = $txt['who_index'];
356
+		}
341 357
 		// Some other normal action...?
342 358
 		else
343 359
 		{
@@ -345,23 +361,25 @@  discard block
 block discarded – undo
345 361
 			if ($actions['action'] == 'profile')
346 362
 			{
347 363
 				// Whose?  Their own?
348
-				if (empty($actions['u']))
349
-					$actions['u'] = $url[1];
364
+				if (empty($actions['u'])) {
365
+									$actions['u'] = $url[1];
366
+				}
350 367
 
351 368
 				$data[$k] = $txt['who_hidden'];
352 369
 				$profile_ids[(int) $actions['u']][$k] = $actions['u'] == $url[1] ? $txt['who_viewownprofile'] : $txt['who_viewprofile'];
353
-			}
354
-			elseif (($actions['action'] == 'post' || $actions['action'] == 'post2') && empty($actions['topic']) && isset($actions['board']))
370
+			} elseif (($actions['action'] == 'post' || $actions['action'] == 'post2') && empty($actions['topic']) && isset($actions['board']))
355 371
 			{
356 372
 				$data[$k] = $txt['who_hidden'];
357 373
 				$board_ids[(int) $actions['board']][$k] = isset($actions['poll']) ? $txt['who_poll'] : $txt['who_post'];
358 374
 			}
359 375
 			// A subaction anyone can view... if the language string is there, show it.
360
-			elseif (isset($actions['sa']) && isset($txt['whoall_' . $actions['action'] . '_' . $actions['sa']]))
361
-				$data[$k] = $preferred_prefix && isset($txt[$preferred_prefix . $actions['action'] . '_' . $actions['sa']]) ? $txt[$preferred_prefix . $actions['action'] . '_' . $actions['sa']] : $txt['whoall_' . $actions['action'] . '_' . $actions['sa']];
376
+			elseif (isset($actions['sa']) && isset($txt['whoall_' . $actions['action'] . '_' . $actions['sa']])) {
377
+							$data[$k] = $preferred_prefix && isset($txt[$preferred_prefix . $actions['action'] . '_' . $actions['sa']]) ? $txt[$preferred_prefix . $actions['action'] . '_' . $actions['sa']] : $txt['whoall_' . $actions['action'] . '_' . $actions['sa']];
378
+			}
362 379
 			// An action any old fellow can look at. (if ['whoall_' . $action] exists, we know everyone can see it.)
363
-			elseif (isset($txt['whoall_' . $actions['action']]))
364
-				$data[$k] = $preferred_prefix && isset($txt[$preferred_prefix . $actions['action']]) ? $txt[$preferred_prefix . $actions['action']] : $txt['whoall_' . $actions['action']];
380
+			elseif (isset($txt['whoall_' . $actions['action']])) {
381
+							$data[$k] = $preferred_prefix && isset($txt[$preferred_prefix . $actions['action']]) ? $txt[$preferred_prefix . $actions['action']] : $txt['whoall_' . $actions['action']];
382
+			}
365 383
 			// Viewable if and only if they can see the board...
366 384
 			elseif (isset($txt['whotopic_' . $actions['action']]))
367 385
 			{
@@ -370,8 +388,7 @@  discard block
 block discarded – undo
370 388
 
371 389
 				$data[$k] = $txt['who_hidden'];
372 390
 				$topic_ids[$topic][$k] = $txt['whotopic_' . $actions['action']];
373
-			}
374
-			elseif (isset($txt['whopost_' . $actions['action']]))
391
+			} elseif (isset($txt['whopost_' . $actions['action']]))
375 392
 			{
376 393
 				// Find out what message they are accessing.
377 394
 				$msgid = (int) (isset($actions['msg']) ? $actions['msg'] : (isset($actions['quote']) ? $actions['quote'] : 0));
@@ -394,41 +411,46 @@  discard block
 block discarded – undo
394 411
 				$data[$k] = sprintf($txt['whopost_' . $actions['action']], $id_topic, $subject);
395 412
 				$smcFunc['db_free_result']($result);
396 413
 
397
-				if (empty($id_topic))
398
-					$data[$k] = $txt['who_hidden'];
414
+				if (empty($id_topic)) {
415
+									$data[$k] = $txt['who_hidden'];
416
+				}
399 417
 			}
400 418
 			// Viewable only by administrators.. (if it starts with whoadmin, it's admin only!)
401
-			elseif (allowedTo('moderate_forum') && isset($txt['whoadmin_' . $actions['action']]))
402
-				$data[$k] = $txt['whoadmin_' . $actions['action']];
419
+			elseif (allowedTo('moderate_forum') && isset($txt['whoadmin_' . $actions['action']])) {
420
+							$data[$k] = $txt['whoadmin_' . $actions['action']];
421
+			}
403 422
 			// Viewable by permission level.
404 423
 			elseif (isset($allowedActions[$actions['action']]))
405 424
 			{
406
-				if (allowedTo($allowedActions[$actions['action']]))
407
-					$data[$k] = $txt['whoallow_' . $actions['action']];
408
-				elseif (in_array('moderate_forum', $allowedActions[$actions['action']]))
409
-					$data[$k] = $txt['who_moderate'];
410
-				elseif (in_array('admin_forum', $allowedActions[$actions['action']]))
411
-					$data[$k] = $txt['who_admin'];
412
-				else
413
-					$data[$k] = $txt['who_hidden'];
425
+				if (allowedTo($allowedActions[$actions['action']])) {
426
+									$data[$k] = $txt['whoallow_' . $actions['action']];
427
+				} elseif (in_array('moderate_forum', $allowedActions[$actions['action']])) {
428
+									$data[$k] = $txt['who_moderate'];
429
+				} elseif (in_array('admin_forum', $allowedActions[$actions['action']])) {
430
+									$data[$k] = $txt['who_admin'];
431
+				} else {
432
+									$data[$k] = $txt['who_hidden'];
433
+				}
434
+			} elseif (!empty($actions['action'])) {
435
+							$data[$k] = $txt['who_generic'] . ' ' . $actions['action'];
436
+			} else {
437
+							$data[$k] = $txt['who_unknown'];
414 438
 			}
415
-			elseif (!empty($actions['action']))
416
-				$data[$k] = $txt['who_generic'] . ' ' . $actions['action'];
417
-			else
418
-				$data[$k] = $txt['who_unknown'];
419 439
 		}
420 440
 
421 441
 		if (isset($actions['error']))
422 442
 		{
423
-			if (isset($txt[$actions['error']]))
424
-				$error_message = str_replace('"', '&quot;', empty($actions['who_error_params']) ? $txt[$actions['error']] : vsprintf($txt[$actions['error']], $actions['who_error_params']));
425
-			elseif ($actions['error'] == 'guest_login')
426
-				$error_message = str_replace('"', '&quot;', $txt['who_guest_login']);
427
-			else
428
-				$error_message = str_replace('"', '&quot;', $actions['error']);
429
-
430
-			if (!empty($error_message))
431
-				$data[$k] .= ' <span class="generic_icons error" title="' . $error_message . '"></span>';
443
+			if (isset($txt[$actions['error']])) {
444
+							$error_message = str_replace('"', '&quot;', empty($actions['who_error_params']) ? $txt[$actions['error']] : vsprintf($txt[$actions['error']], $actions['who_error_params']));
445
+			} elseif ($actions['error'] == 'guest_login') {
446
+							$error_message = str_replace('"', '&quot;', $txt['who_guest_login']);
447
+			} else {
448
+							$error_message = str_replace('"', '&quot;', $actions['error']);
449
+			}
450
+
451
+			if (!empty($error_message)) {
452
+							$data[$k] .= ' <span class="generic_icons error" title="' . $error_message . '"></span>';
453
+			}
432 454
 		}
433 455
 
434 456
 		// Maybe the action is integrated into another system?
@@ -439,12 +461,15 @@  discard block
 block discarded – undo
439 461
 				if (!empty($integrate_action))
440 462
 				{
441 463
 					$data[$k] = $integrate_action;
442
-					if (isset($actions['topic']) && isset($topic_ids[(int) $actions['topic']][$k]))
443
-						$topic_ids[(int) $actions['topic']][$k] = $integrate_action;
444
-					if (isset($actions['board']) && isset($board_ids[(int) $actions['board']][$k]))
445
-						$board_ids[(int) $actions['board']][$k] = $integrate_action;
446
-					if (isset($actions['u']) && isset($profile_ids[(int) $actions['u']][$k]))
447
-						$profile_ids[(int) $actions['u']][$k] = $integrate_action;
464
+					if (isset($actions['topic']) && isset($topic_ids[(int) $actions['topic']][$k])) {
465
+											$topic_ids[(int) $actions['topic']][$k] = $integrate_action;
466
+					}
467
+					if (isset($actions['board']) && isset($board_ids[(int) $actions['board']][$k])) {
468
+											$board_ids[(int) $actions['board']][$k] = $integrate_action;
469
+					}
470
+					if (isset($actions['u']) && isset($profile_ids[(int) $actions['u']][$k])) {
471
+											$profile_ids[(int) $actions['u']][$k] = $integrate_action;
472
+					}
448 473
 					break;
449 474
 				}
450 475
 			}
@@ -472,8 +497,9 @@  discard block
 block discarded – undo
472 497
 		while ($row = $smcFunc['db_fetch_assoc']($result))
473 498
 		{
474 499
 			// Show the topic's subject for each of the actions.
475
-			foreach ($topic_ids[$row['id_topic']] as $k => $session_text)
476
-				$data[$k] = sprintf($session_text, $row['id_topic'], censorText($row['subject']));
500
+			foreach ($topic_ids[$row['id_topic']] as $k => $session_text) {
501
+							$data[$k] = sprintf($session_text, $row['id_topic'], censorText($row['subject']));
502
+			}
477 503
 		}
478 504
 		$smcFunc['db_free_result']($result);
479 505
 	}
@@ -495,8 +521,9 @@  discard block
 block discarded – undo
495 521
 		while ($row = $smcFunc['db_fetch_assoc']($result))
496 522
 		{
497 523
 			// Put the board name into the string for each member...
498
-			foreach ($board_ids[$row['id_board']] as $k => $session_text)
499
-				$data[$k] = sprintf($session_text, $row['id_board'], $row['name']);
524
+			foreach ($board_ids[$row['id_board']] as $k => $session_text) {
525
+							$data[$k] = sprintf($session_text, $row['id_board'], $row['name']);
526
+			}
500 527
 		}
501 528
 		$smcFunc['db_free_result']($result);
502 529
 	}
@@ -518,23 +545,26 @@  discard block
 block discarded – undo
518 545
 		while ($row = $smcFunc['db_fetch_assoc']($result))
519 546
 		{
520 547
 			// If they aren't allowed to view this person's profile, skip it.
521
-			if (!$allow_view_any && ($user_info['id'] != $row['id_member']))
522
-				continue;
548
+			if (!$allow_view_any && ($user_info['id'] != $row['id_member'])) {
549
+							continue;
550
+			}
523 551
 
524 552
 			// Set their action on each - session/text to sprintf.
525
-			foreach ($profile_ids[$row['id_member']] as $k => $session_text)
526
-				$data[$k] = sprintf($session_text, $row['id_member'], $row['real_name']);
553
+			foreach ($profile_ids[$row['id_member']] as $k => $session_text) {
554
+							$data[$k] = sprintf($session_text, $row['id_member'], $row['real_name']);
555
+			}
527 556
 		}
528 557
 		$smcFunc['db_free_result']($result);
529 558
 	}
530 559
 
531 560
 	call_integration_hook('whos_online_after', array(&$urls, &$data));
532 561
 
533
-	if (!is_array($urls))
534
-		return isset($data[0]) ? $data[0] : false;
535
-	else
536
-		return $data;
537
-}
562
+	if (!is_array($urls)) {
563
+			return isset($data[0]) ? $data[0] : false;
564
+	} else {
565
+			return $data;
566
+	}
567
+	}
538 568
 
539 569
 /**
540 570
  * It prepares credit and copyright information for the credits page or the admin page
@@ -709,8 +739,8 @@  discard block
 block discarded – undo
709 739
 	);
710 740
 
711 741
 	// Give the translators some credit for their hard work.
712
-	if (!empty($txt['translation_credits']))
713
-		$context['credits'][] = array(
742
+	if (!empty($txt['translation_credits'])) {
743
+			$context['credits'][] = array(
714 744
 			'title' => $txt['credits_groups_translation'],
715 745
 			'groups' => array(
716 746
 				array(
@@ -719,6 +749,7 @@  discard block
 block discarded – undo
719 749
 				),
720 750
 			),
721 751
 		);
752
+	}
722 753
 
723 754
 	$context['credits'][] = array(
724 755
 		'title' => $txt['credits_special'],
Please login to merge, or discard this patch.
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -673,7 +673,7 @@
 block discarded – undo
673 673
 						'Nikola &quot;Dzonny&quot; Novakovi&cacute;',
674 674
 						// Localizers
675 675
 						'Dr. Deejay',
676
-                        			'd3vcho',
676
+									'd3vcho',
677 677
 						// Former Localizers
678 678
 						'Relyana',
679 679
 					),
Please login to merge, or discard this patch.
Sources/Subs-Recent.php 1 patch
Braces   +5 added lines, -3 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
  * Get the latest posts of a forum.
@@ -59,8 +60,9 @@  discard block
 block discarded – undo
59 60
 		censorText($row['body']);
60 61
 
61 62
 		$row['body'] = strip_tags(strtr(parse_bbc($row['body'], $row['smileys_enabled'], $row['id_msg']), array('<br>' => '&#10;')));
62
-		if ($smcFunc['strlen']($row['body']) > 128)
63
-			$row['body'] = $smcFunc['substr']($row['body'], 0, 128) . '...';
63
+		if ($smcFunc['strlen']($row['body']) > 128) {
64
+					$row['body'] = $smcFunc['substr']($row['body'], 0, 128) . '...';
65
+		}
64 66
 
65 67
 		// Build the array.
66 68
 		$posts[] = array(
Please login to merge, or discard this patch.