Passed
Push — patch_1-1-9 ( d927f0...e2616d )
by Spuds
01:06 queued 27s
created
sources/ext/bad-behavior/bad-behavior/banned.inc.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 	bb2_db_query($query);
15 15
 
16 16
 	// Waste a bunch more of the spammer's time, sometimes.
17
-	if (rand(1,1000) == 1) {
17
+	if (rand(1, 1000) == 1) {
18 18
 		$query = "OPTIMIZE TABLE `" . $settings['log_table'] . "`";
19 19
 		bb2_db_query($query);
20 20
 	}
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 
23 23
 function bb2_display_denial($settings, $package, $key, $previous_key = false)
24 24
 {
25
-	define('DONOTCACHEPAGE', true);	// WP Super Cache
25
+	define('DONOTCACHEPAGE', true); // WP Super Cache
26 26
 	if (!$previous_key) $previous_key = $key;
27 27
 	if ($key == "e87553e1") {
28 28
 		// FIXME: lookup the real key
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 	header("HTTP/1.1 " . $response['response'] . " Bad Behavior");
41 41
 	header("Status: " . $response['response'] . " Bad Behavior");
42 42
 	$request_uri = $_SERVER["REQUEST_URI"];
43
-	if (!$request_uri) $request_uri = $_SERVER['SCRIPT_NAME'];	# IIS
43
+	if (!$request_uri) $request_uri = $_SERVER['SCRIPT_NAME']; # IIS
44 44
 ?>
45 45
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
46 46
 <!--< html xmlns="http://www.w3.org/1999/xhtml">-->
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 <?php
59 59
 }
60 60
 
61
-function bb2_log_denial($settings, $package, $key, $previous_key=false)
61
+function bb2_log_denial($settings, $package, $key, $previous_key = false)
62 62
 {
63 63
 	if (!$settings['logging']) return;
64 64
 	bb2_db_query(bb2_insert($settings, $package, $key));
Please login to merge, or discard this patch.
Braces   +27 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,4 +1,7 @@  discard block
 block discarded – undo
1
-<?php if (!defined('BB2_CORE')) die('I said no cheating!');
1
+<?php if (!defined('BB2_CORE'))
2
+{
3
+	die('I said no cheating!');
4
+}
2 5
 
3 6
 // Functions called when a request has been denied
4 7
 // This part can be gawd-awful slow, doesn't matter :)
@@ -7,14 +10,18 @@  discard block
 block discarded – undo
7 10
 
8 11
 function bb2_housekeeping($settings, $package)
9 12
 {
10
-	if (!$settings['logging']) return;
13
+	if (!$settings['logging'])
14
+	{
15
+		return;
16
+	}
11 17
 
12 18
 	// FIXME Yes, the interval's hard coded (again) for now.
13 19
 	$query = 'DELETE FROM `' . $settings['log_table'] . '` WHERE `date` < DATE_SUB("' . bb2_db_date() . '", INTERVAL 7 DAY)';
14 20
 	bb2_db_query($query);
15 21
 
16 22
 	// Waste a bunch more of the spammer's time, sometimes.
17
-	if (rand(1,1000) == 1) {
23
+	if (rand(1,1000) == 1)
24
+	{
18 25
 		$query = "OPTIMIZE TABLE `" . $settings['log_table'] . "`";
19 26
 		bb2_db_query($query);
20 27
 	}
@@ -23,14 +30,19 @@  discard block
 block discarded – undo
23 30
 function bb2_display_denial($settings, $package, $key, $previous_key = false)
24 31
 {
25 32
 	define('DONOTCACHEPAGE', true);	// WP Super Cache
26
-	if (!$previous_key) $previous_key = $key;
27
-	if ($key == "e87553e1") {
33
+	if (!$previous_key)
34
+	{
35
+		$previous_key = $key;
36
+	}
37
+	if ($key == "e87553e1")
38
+	{
28 39
 		// FIXME: lookup the real key
29 40
 	}
30 41
 	// Create support key
31 42
 	$ip = explode(".", $package['ip']);
32 43
 	$ip_hex = "";
33
-	foreach ($ip as $octet) {
44
+	foreach ($ip as $octet)
45
+	{
34 46
 		$ip_hex .= str_pad(dechex($octet), 2, 0, STR_PAD_LEFT);
35 47
 	}
36 48
 	$support_key = implode("-", str_split("$ip_hex$key", 4));
@@ -40,7 +52,11 @@  discard block
 block discarded – undo
40 52
 	header("HTTP/1.1 " . $response['response'] . " Bad Behavior");
41 53
 	header("Status: " . $response['response'] . " Bad Behavior");
42 54
 	$request_uri = $_SERVER["REQUEST_URI"];
43
-	if (!$request_uri) $request_uri = $_SERVER['SCRIPT_NAME'];	# IIS
55
+	if (!$request_uri)
56
+	{
57
+		$request_uri = $_SERVER['SCRIPT_NAME'];
58
+	}
59
+	# IIS
44 60
 ?>
45 61
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
46 62
 <!--< html xmlns="http://www.w3.org/1999/xhtml">-->
@@ -60,6 +76,9 @@  discard block
 block discarded – undo
60 76
 
61 77
 function bb2_log_denial($settings, $package, $key, $previous_key=false)
62 78
 {
63
-	if (!$settings['logging']) return;
79
+	if (!$settings['logging'])
80
+	{
81
+		return;
82
+	}
64 83
 	bb2_db_query(bb2_insert($settings, $package, $key));
65 84
 }
Please login to merge, or discard this patch.
themes/default/Display.template.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -190,7 +190,7 @@
 block discarded – undo
190 190
 
191 191
 		// Show the post itself, finally!
192 192
 		echo '
193
-						<section id="msg_', $message['id'], '" data-msgid="',$message['id'], '" class="messageContent', $ignoring ? ' hide"' : '"', '>',
193
+						<section id="msg_', $message['id'], '" data-msgid="', $message['id'], '" class="messageContent', $ignoring ? ' hide"' : '"', '>',
194 194
 							$message['body'], '
195 195
 						</section>';
196 196
 
Please login to merge, or discard this patch.
Braces   +159 added lines, -57 removed lines patch added patch discarded remove patch
@@ -67,10 +67,13 @@  discard block
 block discarded – undo
67 67
 
68 68
 			// Show just numbers...?
69 69
 			if ($settings['display_who_viewing'] == 1)
70
-				echo count($context['view_members']), ' ', count($context['view_members']) === 1 ? $txt['who_member'] : $txt['members'];
70
+			{
71
+							echo count($context['view_members']), ' ', count($context['view_members']) === 1 ? $txt['who_member'] : $txt['members'];
72
+			}
71 73
 			// Or show the actual people viewing the topic?
72
-			else
73
-				echo empty($context['view_members_list']) ? '0 ' . $txt['members'] : implode(', ', $context['view_members_list']) . (empty($context['view_num_hidden']) || $context['can_moderate_forum'] ? '' : ' (+ ' . $context['view_num_hidden'] . ' ' . $txt['hidden'] . ')');
74
+			else {
75
+							echo empty($context['view_members_list']) ? '0 ' . $txt['members'] : implode(', ', $context['view_members_list']) . (empty($context['view_num_hidden']) || $context['can_moderate_forum'] ? '' : ' (+ ' . $context['view_num_hidden'] . ' ' . $txt['hidden'] . ')');
76
+			}
74 77
 
75 78
 			// Now show how many guests are here too.
76 79
 			echo $txt['who_and'], $context['view_num_guests'], ' ', $context['view_num_guests'] == 1 ? $txt['guest'] : $txt['guests'], $txt['who_viewing_topic'], '
@@ -79,10 +82,12 @@  discard block
 block discarded – undo
79 82
 
80 83
 		// Is this topic a redirect?
81 84
 		if (!empty($context['topic_redirected_from']))
82
-			echo '
85
+		{
86
+					echo '
83 87
 				<span id="redirectfrom">
84 88
 					' . sprintf($txt['no_redir'], '<a href="' . $context['topic_redirected_from']['redir_href'] . '">' . $context['topic_redirected_from']['subject'] . '</a>'), '
85 89
 				</span>';
90
+		}
86 91
 		echo '
87 92
 			</div>';
88 93
 	}
@@ -109,7 +114,9 @@  discard block
 block discarded – undo
109 114
 	while ($message = $controller->{$context['get_message'][1]}())
110 115
 	{
111 116
 		if ($message['can_remove'])
112
-			$removableMessageIDs[] = $message['id'];
117
+		{
118
+					$removableMessageIDs[] = $message['id'];
119
+		}
113 120
 
114 121
 		// Are we ignoring this message?
115 122
 		if (!empty($message['is_ignored']))
@@ -117,14 +124,17 @@  discard block
 block discarded – undo
117 124
 			$ignoring = true;
118 125
 			$ignoredMsgs[] = $message['id'];
119 126
 		}
120
-		else
121
-			$ignoring = false;
127
+		else {
128
+					$ignoring = false;
129
+		}
122 130
 
123 131
 		// Show the message anchor and a "new" anchor if this message is new.
124 132
 		if ($message['id'] != $context['first_message'] && ($message['first_new']))
125
-			echo '
133
+		{
134
+					echo '
126 135
 				<a id="new">&nbsp;</a>	
127 136
 				<hr class="new_post_separator" />';
137
+		}
128 138
 
129 139
 		echo '
130 140
 				<article class="post_wrapper forumposts', $message['classes'], $message['approved'] ? '' : ' approvebg', '">', $message['id'] != $context['first_message'] ? '
@@ -132,10 +142,12 @@  discard block
 block discarded – undo
132 142
 
133 143
 		// Showing the sidebar posting area?
134 144
 		if (empty($options['hide_poster_area']))
135
-			echo '
145
+		{
146
+					echo '
136 147
 					<aside>
137 148
 						<ul class="poster">', template_build_poster_div($message, $ignoring), '</ul>
138 149
 					</aside>';
150
+		}
139 151
 
140 152
 		echo '
141 153
 					<div class="postarea', empty($options['hide_poster_area']) ? '' : '2', '">
@@ -151,10 +163,12 @@  discard block
 block discarded – undo
151 163
 									<ul class="menulevel2">';
152 164
 
153 165
 			foreach ($context['follow_ups'][$message['id']] as $follow_up)
154
-				echo '
166
+			{
167
+							echo '
155 168
 										<li class="listlevel2">
156 169
 											<a class="linklevel2" href="', $scripturl, '?topic=', $follow_up['follow_up'], '.0">', $follow_up['subject'], '</a>
157 170
 										</li>';
171
+			}
158 172
 
159 173
 			echo '
160 174
 									</ul>
@@ -175,18 +189,22 @@  discard block
 block discarded – undo
175 189
 
176 190
 		// Ignoring this user? Hide the post.
177 191
 		if ($ignoring)
178
-			echo '
192
+		{
193
+					echo '
179 194
 						<details id="msg_', $message['id'], '_ignored_prompt">
180 195
 							', $txt['ignoring_user'], '
181 196
 							<a href="#" id="msg_', $message['id'], '_ignored_link" class="hide">', $txt['show_ignore_user_post'], '</a>
182 197
 						</details>';
198
+		}
183 199
 
184 200
 		// Awaiting moderation?
185 201
 		if (!$message['approved'] && $message['member']['id'] != 0 && $message['member']['id'] == $context['user']['id'])
186
-			echo '
202
+		{
203
+					echo '
187 204
 						<div class="approve_post">
188 205
 							', $txt['post_awaiting_approval'], '
189 206
 						</div>';
207
+		}
190 208
 
191 209
 		// Show the post itself, finally!
192 210
 		echo '
@@ -200,7 +218,9 @@  discard block
 block discarded – undo
200 218
 
201 219
 		// Assuming there are attachments...
202 220
 		if (!empty($message['attachment']))
203
-			template_display_attachments($message, $ignoring);
221
+		{
222
+					template_display_attachments($message, $ignoring);
223
+		}
204 224
 
205 225
 		// Show the quickbuttons, for various operations on posts.
206 226
 		echo '
@@ -209,22 +229,28 @@  discard block
 block discarded – undo
209 229
 
210 230
 		// Show a checkbox for quick moderation?
211 231
 		if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1 && $message['can_remove'])
212
-			echo '
232
+		{
233
+					echo '
213 234
 							<li class="listlevel1 inline_mod_check hide" id="in_topic_mod_check_', $message['id'], '"></li>';
235
+		}
214 236
 
215 237
 		// Show "Last Edit: Time by Person" if this post was edited.
216 238
 		if ($settings['show_modify'])
217
-			echo '
239
+		{
240
+					echo '
218 241
 							<li id="modified_', $message['id'], '" class="listlevel1 modified', !empty($message['modified']['name']) ? '"' : ' hide"', '>
219 242
 								', !empty($message['modified']['name']) ? $message['modified']['last_edit_text'] : '', '
220 243
 							</li>';
244
+		}
221 245
 
222 246
 		// Maybe they can modify the post (this is the more button)
223 247
 		if ($message['can_modify'] || ($context['can_report_moderator']))
224
-			echo '
248
+		{
249
+					echo '
225 250
 							<li class="listlevel1 subsections" aria-haspopup="true">
226 251
 								<a href="#" ', !empty($options['use_click_menu']) ? '' : 'onclick="event.stopPropagation();return false;" ', 'class="linklevel1 post_options">', $txt['post_options'], '
227 252
 							</a>';
253
+		}
228 254
 
229 255
 		if ($message['can_modify'] || $message['can_remove'] || !empty($context['can_follow_up']) || ($context['can_split'] && !empty($context['real_num_replies'])) || $context['can_restore_msg'] || $message['can_approve'] || $message['can_unapprove'] || $context['can_report_moderator'])
230 256
 		{
@@ -234,67 +260,85 @@  discard block
 block discarded – undo
234 260
 
235 261
 			// Can the user modify the contents of this post?
236 262
 			if ($message['can_modify'])
237
-				echo '
263
+			{
264
+							echo '
238 265
 									<li class="listlevel2">
239 266
 										<a href="', $scripturl, '?action=post;msg=', $message['id'], ';topic=', $context['current_topic'], '.', $context['start'], '" class="linklevel2 modify_button">', $txt['modify'], '</a>
240 267
 									</li>';
268
+			}
241 269
 
242 270
 			// How about... even... remove it entirely?!
243 271
 			if ($message['can_remove'])
244
-				echo '
272
+			{
273
+							echo '
245 274
 									<li class="listlevel2">
246 275
 										<a href="', $scripturl, '?action=deletemsg;topic=', $context['current_topic'], '.', $context['start'], ';msg=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '" onclick="return confirm(\'', $txt['remove_message'], '?\');" class="linklevel2 remove_button">', $txt['remove'], '</a>
247 276
 									</li>';
277
+			}
248 278
 
249 279
 			// Can they quote to a new topic? @todo - This needs rethinking for GUI layout.
250 280
 			if (!empty($context['can_follow_up']))
251
-				echo '
281
+			{
282
+							echo '
252 283
 									<li class="listlevel2">
253 284
 										<a href="', $scripturl, '?action=post;board=', $context['current_board'], ';quote=', $message['id'], ';followup=', $message['id'], '" class="linklevel2 quotetonew_button">', $txt['quote_new'], '</a>
254 285
 									</li>';
286
+			}
255 287
 
256 288
 			// What about splitting it off the rest of the topic?
257 289
 			if ($context['can_split'] && !empty($context['real_num_replies']) && $context['topic_first_message'] !== $message['id'])
258
-				echo '
290
+			{
291
+							echo '
259 292
 									<li class="listlevel2">
260 293
 										<a href="', $scripturl, '?action=splittopics;topic=', $context['current_topic'], '.0;at=', $message['id'], '" class="linklevel2 split_button">', $txt['split_topic'], '</a>
261 294
 									</li>';
295
+			}
262 296
 
263 297
 			// Can we restore topics?
264 298
 			if ($context['can_restore_msg'])
265
-				echo '
299
+			{
300
+							echo '
266 301
 									<li class="listlevel2">
267 302
 										<a href="', $scripturl, '?action=restoretopic;msgs=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '" class="linklevel2 restore_button">', $txt['restore_message'], '</a>
268 303
 									</li>';
304
+			}
269 305
 
270 306
 			// Maybe we can approve it, maybe we should?
271 307
 			if ($message['can_approve'])
272
-				echo '
308
+			{
309
+							echo '
273 310
 									<li class="listlevel2">
274 311
 										<a href="', $scripturl, '?action=moderate;area=postmod;sa=approve;topic=', $context['current_topic'], '.', $context['start'], ';msg=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '"  class="linklevel2 approve_button">', $txt['approve'], '</a>
275 312
 									</li>';
313
+			}
276 314
 
277 315
 			// Maybe we can unapprove it?
278 316
 			if ($message['can_unapprove'])
279
-				echo '
317
+			{
318
+							echo '
280 319
 									<li class="listlevel2">
281 320
 										<a href="', $scripturl, '?action=moderate;area=postmod;sa=approve;topic=', $context['current_topic'], '.', $context['start'], ';msg=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '"  class="linklevel2 unapprove_button">', $txt['unapprove'], '</a>
282 321
 									</li>';
322
+			}
283 323
 
284 324
 			// Maybe they want to report this post to the moderator(s)?
285 325
 			if ($context['can_report_moderator'])
286
-				echo '
326
+			{
327
+							echo '
287 328
 									<li class="listlevel2">
288 329
 										<a href="' . $scripturl . '?action=reporttm;topic=' . $context['current_topic'] . '.' . $message['counter'] . ';msg=' . $message['id'] . '" class="linklevel2 warn_button">' . $txt['report_to_mod'] . '</a>
289 330
 									</li>';
331
+			}
290 332
 
291 333
 			// Anything else added by mods for example?
292 334
 			if (!empty($context['additional_drop_buttons']))
293
-				foreach ($context['additional_drop_buttons'] as $key => $button)
335
+			{
336
+							foreach ($context['additional_drop_buttons'] as $key => $button)
294 337
 					echo '
295 338
 									<li class="listlevel2">
296 339
 										<a href="' . $button['href'] . '" class="linklevel2 ', $key, '">' . $button['text'] . '</a>
297 340
 									</li>';
341
+			}
298 342
 
299 343
 			echo '
300 344
 								</ul>
@@ -306,50 +350,61 @@  discard block
 block discarded – undo
306 350
 		{
307 351
 			// Can they like/unlike this post?
308 352
 			if ($message['can_like'] || $message['can_unlike'])
309
-				echo '
353
+			{
354
+							echo '
310 355
 							<li class="listlevel1', !empty($message['like_counter']) ? ' liked"' : '"', '>
311 356
 								<a class="linklevel1 ', $message['can_unlike'] ? 'unreact_button' : 'react_button', '" href="javascript:void(0)"', !empty($message['like_counter']) ? ' title="' . $txt['liked_by'] . ' ' . implode(', ', $context['likes'][$message['id']]['member']) . '"' : '', ' onclick="likePosts.prototype.likeUnlikePosts(event,', $message['id'], ', ', $context['current_topic'], '); return false;">',
312 357
 									!empty($message['like_counter']) ? '<span class="likes_indicator">' . $message['like_counter'] . '</span>&nbsp;' . $txt['likes'] : $txt['like_post'], '
313 358
 								</a>
314 359
 							</li>';
360
+			}
315 361
 
316 362
 			// Or just view the count
317
-			else
318
-				echo '
363
+			else {
364
+							echo '
319 365
 							<li class="listlevel1', !empty($message['like_counter']) ? ' liked"' : '"', '>
320 366
 								<a href="javascript:void(0)" role="button" title="', !empty($message['like_counter']) ? $txt['liked_by'] . ' ' . implode(', ', $context['likes'][$message['id']]['member']) : '', '" class="linklevel1 reacts_button">',
321 367
 									!empty($message['like_counter']) ? '<span class="likes_indicator">' . $message['like_counter'] . '</span>&nbsp;' . $txt['likes'] : '&nbsp;', '
322 368
 								</a>
323 369
 							</li>';
370
+			}
324 371
 		}
325 372
 
326 373
 		// Can the user quick modify the contents of this post?  Show the quick (inline) modify button.
327 374
 		if ($message['can_modify'])
328
-			echo '
375
+		{
376
+					echo '
329 377
 							<li id="modify_button_', $message['id'], '" class="listlevel1 quick_edit hide">
330 378
 								<a class="linklevel1 quick_edit" role="button" onclick="oQuickModify.modifyMsg(\'', $message['id'], '\')">', $txt['quick_edit'], '</a>
331 379
 							</li>';
380
+		}
332 381
 
333 382
 		// Can they reply? Have they turned on quick reply?
334 383
 		if ($context['can_quote'] && !empty($options['display_quick_reply']))
335
-			echo '
384
+		{
385
+					echo '
336 386
 							<li class="listlevel1">
337 387
 								<a href="', $scripturl, '?action=post;quote=', $message['id'], ';topic=', $context['current_topic'], '.', $context['start'], ';last_msg=', $context['topic_last_message'], '" onclick="return oQuickReply.quote(', $message['id'], ');" class="linklevel1 quote_button">', $txt['quote'], '</a>
338 388
 							</li>';
389
+		}
339 390
 		// So... quick reply is off, but they *can* reply?
340 391
 		elseif ($context['can_quote'])
341
-			echo '
392
+		{
393
+					echo '
342 394
 							<li class="listlevel1">
343 395
 								<a href="', $scripturl, '?action=post;quote=', $message['id'], ';topic=', $context['current_topic'], '.', $context['start'], ';last_msg=', $context['topic_last_message'], '" class="linklevel1 quote_button">', $txt['quote'], '</a>
344 396
 							</li>';
397
+		}
345 398
 
346 399
 		// Anything else added by mods for example?
347 400
 		if (!empty($context['additional_quick_buttons']))
348
-			foreach ($context['additional_quick_buttons'] as $key => $button)
401
+		{
402
+					foreach ($context['additional_quick_buttons'] as $key => $button)
349 403
 				echo '
350 404
 								<li class="listlevel1">
351 405
 									<a href="' . $button['href'] . '" class="linklevel1 ', $key, '">' . $button['text'] . '</a>
352 406
 								</li>';
407
+		}
353 408
 
354 409
 		echo '
355 410
 						</ul>
@@ -364,7 +419,9 @@  discard block
 block discarded – undo
364 419
 			foreach ($message['member']['custom_fields'] as $custom)
365 420
 			{
366 421
 				if ($custom['placement'] != 2 || empty($custom['value']))
367
-					continue;
422
+				{
423
+									continue;
424
+				}
368 425
 
369 426
 				if (empty($shown))
370 427
 				{
@@ -379,15 +436,19 @@  discard block
 block discarded – undo
379 436
 			}
380 437
 
381 438
 			if ($shown)
382
-				echo '
439
+			{
440
+							echo '
383 441
 								</ul>
384 442
 							</div>';
443
+			}
385 444
 		}
386 445
 
387 446
 		// Show the member's signature?
388 447
 		if (!empty($message['member']['signature']) && empty($options['show_no_signatures']) && $context['signature_enabled'])
389
-			echo '
448
+		{
449
+					echo '
390 450
 							<div id="msg_', $message['id'], '_signature" class="signature', $ignoring ? ' hide"' : '"', '>', $message['member']['signature'], '</div>';
451
+		}
391 452
 
392 453
 		echo '
393 454
 						</footer>
@@ -452,7 +513,8 @@  discard block
 block discarded – undo
452 513
 
453 514
 		// Guests just need more.
454 515
 		if ($context['user']['is_guest'])
455
-			echo '
516
+		{
517
+					echo '
456 518
 							<dl>
457 519
 								<dt>
458 520
 									<label for="guestname">', $txt['name'], ':</label> <input type="text" name="guestname" id="guestname" value="', $context['name'], '" size="25" class="input_text" tabindex="', $context['tabindex']++, '" />
@@ -461,11 +523,14 @@  discard block
 block discarded – undo
461 523
 									<label for="email">', $txt['email'], ':</label> <input type="text" name="email" id="email" value="', $context['email'], '" size="25" class="input_text" tabindex="', $context['tabindex']++, '" />
462 524
 								</dd>
463 525
 							</dl>';
526
+		}
464 527
 
465 528
 		// Is visual verification enabled?
466 529
 		if (!empty($context['require_verification']))
467
-			template_verification_controls($context['visual_verification_id'], '
530
+		{
531
+					template_verification_controls($context['visual_verification_id'], '
468 532
 							<strong>' . $txt['verification'] . ':</strong>', '<br />');
533
+		}
469 534
 
470 535
 		// Using the full editor or a plain text box?
471 536
 		if (empty($options['use_editor_quick_reply']))
@@ -479,22 +544,28 @@  discard block
 block discarded – undo
479 544
 
480 545
 			// Spellcheck button?
481 546
 			if ($context['show_spellchecking'])
482
-				echo '
547
+			{
548
+							echo '
483 549
 								<input type="button" value="', $txt['spell_check'], '" onclick="spellCheck(\'postmodify\', \'message\', ', (empty($options['use_editor_quick_reply']) ? 'false' : 'true'), ')" tabindex="', $context['tabindex']++, '" />';
550
+			}
484 551
 
485 552
 			// Draft save button?
486 553
 			if (!empty($context['drafts_save']))
487
-				echo '
554
+			{
555
+							echo '
488 556
 								<input type="button" name="save_draft" value="', $txt['draft_save'], '" onclick="return confirm(' . JavaScriptEscape($txt['draft_save_note']) . ') && submitThisOnce(this);" accesskey="d" tabindex="', $context['tabindex']++, '" />
489 557
 								<input type="hidden" id="id_draft" name="id_draft" value="', empty($context['id_draft']) ? 0 : $context['id_draft'], '" />';
558
+			}
490 559
 
491 560
 			// Show the draft last saved on area
492 561
 			if (!empty($context['drafts_autosave']) && !empty($options['drafts_autosave_enabled']))
493
-				echo '
562
+			{
563
+							echo '
494 564
 							<div class="draftautosave">
495 565
 								<span id="throbber" class="hide"><i class="icon icon-spin i-spinner"></i>&nbsp;</span>
496 566
 								<span id="draft_lastautosave"></span>
497 567
 							</div>';
568
+			}
498 569
 			echo '
499 570
 						</div>
500 571
 					</div>';
@@ -525,8 +596,10 @@  discard block
 block discarded – undo
525 596
 
526 597
 			// Mentions enabled
527 598
 			if (!empty($modSettings['mentions_enabled']))
528
-				echo '
599
+			{
600
+							echo '
529 601
 				add_elk_mention(\'#message\');';
602
+			}
530 603
 
531 604
 			echo '
532 605
 			</script>';
@@ -567,18 +640,21 @@  discard block
 block discarded – undo
567 640
 
568 641
 	// Spell check for quick modify and quick reply (w/o the editor)
569 642
 	if ($context['show_spellchecking'] && empty($options['use_editor_quick_reply']))
570
-		echo '
643
+	{
644
+			echo '
571 645
 			<form name="spell_form" id="spell_form" method="post" accept-charset="UTF-8" target="spellWindow" action="', $scripturl, '?action=spellcheck">
572 646
 				<input type="hidden" id="spellstring" name="spellstring" value="" />
573 647
 				<input type="hidden" id="fulleditor" name="fulleditor" value="" />
574 648
 			</form>';
649
+	}
575 650
 
576 651
 	// Quick moderation options
577 652
 	echo '
578 653
 			<script>';
579 654
 
580 655
 	if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1 && $context['can_remove_post'])
581
-		echo '
656
+	{
657
+			echo '
582 658
 				var oInTopicModeration = new InTopicModeration({
583 659
 					sSelf: \'oInTopicModeration\',
584 660
 					sCheckboxContainerMask: \'in_topic_mod_check_\',
@@ -603,6 +679,7 @@  discard block
 block discarded – undo
603 679
 					sSplitButtonConfirm: \'', $txt['quickmod_confirm'], '\',
604 680
 					sFormId: \'quickModForm\'
605 681
 				});';
682
+	}
606 683
 
607 684
 	// Quick modify can be used
608 685
 	echo '
@@ -665,8 +742,10 @@  discard block
 block discarded – undo
665 742
 				});';
666 743
 
667 744
 	if (!empty($ignoredMsgs))
668
-		echo '
745
+	{
746
+			echo '
669 747
 				ignore_toggles([', implode(', ', $ignoredMsgs), '], ', JavaScriptEscape($txt['show_ignore_user_post']), ');';
748
+	}
670 749
 
671 750
 	echo '
672 751
 			</script>';
@@ -703,9 +782,11 @@  discard block
 block discarded – undo
703 782
 						<dd class="statsbar">';
704 783
 
705 784
 			if ($context['allow_poll_view'])
706
-				echo '
785
+			{
786
+							echo '
707 787
 							', $option['bar_ndt'], '
708 788
 							<span class="righttext poll-percent">[ ', $option['votes'], ' ] (', $option['percent'], '%)</span>';
789
+			}
709 790
 
710 791
 			echo '
711 792
 						</dd>';
@@ -715,10 +796,12 @@  discard block
 block discarded – undo
715 796
 					</dl>';
716 797
 
717 798
 		if ($context['allow_poll_view'])
718
-			echo '
799
+		{
800
+					echo '
719 801
 					<p>
720 802
 						<strong>', $txt['poll_total_voters'], ':</strong> ', $context['poll']['total_votes'], '
721 803
 					</p>';
804
+		}
722 805
 	}
723 806
 	// They are allowed to vote! Go to it!
724 807
 	else
@@ -728,16 +811,20 @@  discard block
 block discarded – undo
728 811
 
729 812
 		// Show a warning if they are allowed more than one option.
730 813
 		if ($context['poll']['allowed_warning'])
731
-			echo '
814
+		{
815
+					echo '
732 816
 						<p>', $context['poll']['allowed_warning'], '</p>';
817
+		}
733 818
 
734 819
 		echo '
735 820
 						<ul class="options">';
736 821
 
737 822
 		// Show each option with its button - a radio likely.
738 823
 		foreach ($context['poll']['options'] as $option)
739
-			echo '
824
+		{
825
+					echo '
740 826
 							<li>', $option['vote_button'], ' <label for="', $option['id'], '">', $option['option'], '</label></li>';
827
+		}
741 828
 
742 829
 		echo '
743 830
 						</ul>
@@ -750,10 +837,12 @@  discard block
 block discarded – undo
750 837
 
751 838
 	// Is the clock ticking?
752 839
 	if (!empty($context['poll']['expire_time']))
753
-		echo '
840
+	{
841
+			echo '
754 842
 					<p>
755 843
 						<strong>', ($context['poll']['is_expired'] ? $txt['poll_expired_on'] : $txt['poll_expires_on']), ':</strong> ', $context['poll']['expire_time'], '
756 844
 					</p>';
845
+	}
757 846
 
758 847
 	echo '
759 848
 				</div>
@@ -780,10 +869,12 @@  discard block
 block discarded – undo
780 869
 					<ul>';
781 870
 
782 871
 	foreach ($context['linked_calendar_events'] as $event)
783
-		echo '
872
+	{
873
+			echo '
784 874
 						<li>
785 875
 							', ($event['can_edit'] ? '<a href="' . $event['modify_href'] . '"><i class="icon i-modify" title="' . $txt['modify'] . '"></i></a> ' : ''), '<strong>', $event['title'], '</strong>: ', $event['start_date'], ($event['start_date'] != $event['end_date'] ? ' - ' . $event['end_date'] : ''), '
786 876
 						</li>';
877
+	}
787 878
 
788 879
 	echo '
789 880
 					</ul>
@@ -873,8 +964,10 @@  discard block
 block discarded – undo
873 964
 									<legend>', $txt['attach_awaiting_approve'];
874 965
 
875 966
 			if ($context['can_approve'])
876
-				echo '
967
+			{
968
+							echo '
877 969
 										&nbsp;<a class="linkbutton" href="', $scripturl, '?action=attachapprove;sa=all;mid=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $txt['approve_all'], '</a>';
970
+			}
878 971
 
879 972
 			echo '
880 973
 									</legend>';
@@ -886,16 +979,21 @@  discard block
 block discarded – undo
886 979
 		if ($attachment['is_image'])
887 980
 		{
888 981
 			if ($attachment['thumbnail']['has_thumb'])
889
-				echo '
982
+			{
983
+							echo '
890 984
 											<a href="', $attachment['href'], ';image" id="link_', $attachment['id'], '" ', $attachment['thumbnail']['lightbox'], '>
891 985
 												<img class="attachment_image" src="', $attachment['thumbnail']['href'], '" alt="" id="thumb_', $attachment['id'], '" loading="lazy" />
892 986
 											</a>';
893
-			else
894
-				echo '
987
+			}
988
+			else {
989
+							echo '
895 990
 											<img class="attachment_image" src="', $attachment['href'], ';image" alt="" style="max-width:100%; max-height:' . $attachment['height'] . 'px;" loading="lazy" />';
991
+			}
896 992
 		}
897 993
 		elseif (!empty($modSettings['attachmentShowImages']))
898
-			echo '							<img class="attachment_image" src="', $attachment['href'], ';thumb" alt="" style="max-width:' . $modSettings['attachmentThumbWidth'] . 'px; max-height:' . $modSettings['attachmentThumbHeight'] . 'px;" loading="lazy" />';
994
+		{
995
+					echo '							<img class="attachment_image" src="', $attachment['href'], ';thumb" alt="" style="max-width:' . $modSettings['attachmentThumbWidth'] . 'px; max-height:' . $modSettings['attachmentThumbHeight'] . 'px;" loading="lazy" />';
996
+		}
899 997
 
900 998
 		echo '
901 999
 											<a href="', $attachment['href'], '" class="attachment_name">
@@ -904,8 +1002,10 @@  discard block
 block discarded – undo
904 1002
 											<span class="attachment_details">', $attachment['size'], ($attachment['is_image'] ? ', ' . $attachment['real_width'] . 'x' . $attachment['real_height'] . ' - ' . sprintf($txt['attach_viewed'], $attachment['downloads']) : ' ' . sprintf($txt['attach_downloaded'], $attachment['downloads'])) . '</span>';
905 1003
 
906 1004
 		if (!$attachment['is_approved'] && $context['can_approve'])
907
-			echo '
1005
+		{
1006
+					echo '
908 1007
 											<a class="linkbutton" href="', $scripturl, '?action=attachapprove;sa=approve;aid=', $attachment['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $txt['approve'], '</a>&nbsp;|&nbsp;<a class="linkbutton" href="', $scripturl, '?action=attachapprove;sa=reject;aid=', $attachment['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $txt['delete'], '</a>';
1008
+		}
909 1009
 
910 1010
 			echo '
911 1011
 										</div>';
@@ -913,8 +1013,10 @@  discard block
 block discarded – undo
913 1013
 
914 1014
 	// If we had unapproved attachments clean up.
915 1015
 	if ($last_approved_state == 0)
916
-		echo '
1016
+	{
1017
+			echo '
917 1018
 								</fieldset>';
1019
+	}
918 1020
 
919 1021
 	echo '
920 1022
 							</footer>';
Please login to merge, or discard this patch.
themes/default/Register.template.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -265,7 +265,7 @@
 block discarded – undo
265 265
 							<label ', !empty($field['is_error']) ? ' class="error"' : '', ' for="', $field['colname'], '">', $field['name'], ':</label>
266 266
 							<span class="smalltext">', $field['desc'], '</span>
267 267
 						</dt>
268
-						<dd>', preg_replace_callback('~<(input|select|textarea) ~', function ($matches) {
268
+						<dd>', preg_replace_callback('~<(input|select|textarea) ~', function($matches) {
269 269
 							global $context;
270 270
 
271 271
 							return '<' . $matches[1] . ' tabindex="' . ($context['tabindex']++) . '"';
Please login to merge, or discard this patch.
Braces   +66 added lines, -24 removed lines patch added patch discarded remove patch
@@ -73,20 +73,25 @@  discard block
 block discarded – undo
73 73
 
74 74
 	// Age restriction in effect?
75 75
 	if ($context['show_coppa'])
76
-		echo '
76
+	{
77
+			echo '
77 78
 				<input type="submit" name="accept_agreement" value="', $context['coppa_agree_above'], '" />
78 79
 				<br /><br />
79 80
 				<input type="submit" name="accept_agreement_coppa" value="', $context['coppa_agree_below'], '" />';
80
-	else
81
-		echo '
81
+	}
82
+	else {
83
+			echo '
82 84
 				<input type="submit" name="accept_agreement" value="', $txt['agreement_agree'], '" />';
85
+	}
83 86
 	echo '
84 87
 				<input type="submit" name="no_accept" value="', $txt['agreement_no_agree'], '" />';
85 88
 
86 89
 	if ($context['show_contact_button'])
87
-		echo '
90
+	{
91
+			echo '
88 92
 				<br /><br />
89 93
 				<input type="submit" name="show_contact" value="', $txt['contact'], '" />';
94
+	}
90 95
 
91 96
 	if (!empty($context['register_subaction']))
92 97
 	{
@@ -135,8 +140,10 @@  discard block
 block discarded – undo
135 140
 
136 141
 		// Cycle through each error and display an error message.
137 142
 		foreach ($context['registration_errors'] as $error)
138
-			echo '
143
+		{
144
+					echo '
139 145
 				<li>', $error, '</li>';
146
+		}
140 147
 
141 148
 		echo '
142 149
 			</ul>
@@ -258,7 +265,8 @@  discard block
 block discarded – undo
258 265
 					<dl class="settings">';
259 266
 
260 267
 		foreach ($context['custom_fields'] as $key => $field)
261
-			if ($field['show_reg'] > 1)
268
+		{
269
+					if ($field['show_reg'] > 1)
262 270
 			{
263 271
 				echo '
264 272
 						<dt>
@@ -267,6 +275,7 @@  discard block
 block discarded – undo
267 275
 						</dt>
268 276
 						<dd>', preg_replace_callback('~<(input|select|textarea) ~', function ($matches) {
269 277
 							global $context;
278
+		}
270 279
 
271 280
 							return '<' . $matches[1] . ' tabindex="' . ($context['tabindex']++) . '"';
272 281
 						}, $field['input_html']), '</dd>';
@@ -313,8 +322,10 @@  discard block
 block discarded – undo
313 322
 
314 323
 				// Does it have any subtext to show?
315 324
 				if (!empty($field['subtext']))
316
-					echo '
325
+				{
326
+									echo '
317 327
 						<span class="smalltext">', $field['subtext'], '</span>';
328
+				}
318 329
 
319 330
 				echo '
320 331
 					</dt>
@@ -322,28 +333,38 @@  discard block
 block discarded – undo
322 333
 
323 334
 				// Want to put something in front of the box?
324 335
 				if (!empty($field['preinput']))
325
-					echo '
336
+				{
337
+									echo '
326 338
 						', $field['preinput'];
339
+				}
327 340
 
328 341
 				// What type of data are we showing?
329 342
 				if ($field['type'] == 'label')
330
-					echo '
343
+				{
344
+									echo '
331 345
 						', $field['value'];
346
+				}
332 347
 
333 348
 				// Maybe it's a text box - very likely!
334 349
 				elseif (in_array($field['type'], array('int', 'float', 'text', 'password')))
335
-					echo '
350
+				{
351
+									echo '
336 352
 						<input type="', $field['type'] == 'password' ? 'password' : 'text', '" name="', $key, '" id="', $key, '" size="', empty($field['size']) ? 30 : $field['size'], '" value="', $field['value'], '" tabindex="', $context['tabindex']++, '" ', $field['input_attr'], ' class="input_', $field['type'] == 'password' ? 'password' : 'text', '" />';
353
+				}
337 354
 
338 355
 				// Maybe it's an html5 input
339 356
 				elseif (in_array($field['type'], array('url', 'search', 'date', 'email', 'color')))
340
-					echo '
357
+				{
358
+									echo '
341 359
 						<input type="', $field['type'], '" name="', $key, '" id="', $key, '" size="', empty($field['size']) ? 30 : $field['size'], '" value="', $field['value'], '" ', $field['input_attr'], ' class="input_', $field['type'] == 'password' ? 'password' : 'text', '" />';
360
+				}
342 361
 
343 362
 				// You "checking" me out? ;)
344 363
 				elseif ($field['type'] == 'check')
345
-					echo '
364
+				{
365
+									echo '
346 366
 						<input type="hidden" name="', $key, '" value="0" /><input type="checkbox" name="', $key, '" id="', $key, '" ', !empty($field['value']) ? ' checked="checked"' : '', ' value="1" tabindex="', $context['tabindex']++, '" ', $field['input_attr'], ' />';
367
+				}
347 368
 
348 369
 				// Always fun - select boxes!
349 370
 				elseif ($field['type'] == 'select')
@@ -383,8 +404,10 @@  discard block
 block discarded – undo
383 404
 
384 405
 				// Something to end with?
385 406
 				if (!empty($field['postinput']))
386
-					echo '
407
+				{
408
+									echo '
387 409
 							', $field['postinput'];
410
+				}
388 411
 
389 412
 				echo '
390 413
 					</dd>';
@@ -398,12 +421,14 @@  discard block
 block discarded – undo
398 421
 		foreach ($context['custom_fields'] as $field)
399 422
 		{
400 423
 			if ($field['show_reg'] < 2)
401
-				echo '
424
+			{
425
+							echo '
402 426
 					<dt>
403 427
 						<label', !empty($field['is_error']) ? ' class="error"' : '', '>', $field['name'], ':</label>
404 428
 						<span class="smalltext">', $field['desc'], '</span>
405 429
 					</dt>
406 430
 					<dd>', $field['input_html'], '</dd>';
431
+			}
407 432
 		}
408 433
 	}
409 434
 
@@ -430,7 +455,8 @@  discard block
 block discarded – undo
430 455
 			<fieldset class="content">';
431 456
 
432 457
 		if ($context['require_agreement'])
433
-			echo '
458
+		{
459
+					echo '
434 460
 				<h2 class="category_header">', $txt['registration_agreement'], '</h2>
435 461
 				<div id="agreement_box">
436 462
 					', $context['agreement'], '
@@ -439,9 +465,11 @@  discard block
 block discarded – undo
439 465
 					<input type="checkbox" name="checkbox_agreement" id="checkbox_agreement" value="1"', ($context['registration_passed_agreement'] ? ' checked="checked"' : ''), ' tabindex="', $context['tabindex']++, '" />
440 466
 					', $txt['checkbox_agreement'], '
441 467
 				</label>';
468
+		}
442 469
 
443 470
 		if ($context['require_privacypol'])
444
-			echo '
471
+		{
472
+					echo '
445 473
 				<h2 class="category_header">', $txt['registration_privacy_policy'], '</h2>
446 474
 				<div id="privacypol_box">
447 475
 					', $context['privacy_policy'], '
@@ -450,6 +478,7 @@  discard block
 block discarded – undo
450 478
 					<input type="checkbox" name="checkbox_privacypol" id="checkbox_privacypol" value="1"', ($context['registration_passed_privacypol'] ? ' checked="checked"' : ''), ' tabindex="', $context['tabindex']++, '" />
451 479
 					', $txt['checkbox_privacypol'], '
452 480
 				</label>';
481
+		}
453 482
 
454 483
 		if (!empty($context['languages']))
455 484
 		{
@@ -651,16 +680,19 @@  discard block
 block discarded – undo
651 680
 			<div>';
652 681
 
653 682
 	if (isBrowser('is_ie'))
654
-		echo '
683
+	{
684
+			echo '
655 685
 			<object classid="clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95" type="audio/x-wav">
656 686
 				<param name="AutoStart" value="1" />
657 687
 				<param name="FileName" value="', $context['verification_sound_href'], '" />
658 688
 			</object>';
659
-	else
660
-		echo '
689
+	}
690
+	else {
691
+			echo '
661 692
 			<audio controls="controls" autoplay="autoplay">
662 693
 				<source src="', $context['verification_sound_href'], '" type="audio/x-wav">
663 694
 			</audio>';
695
+	}
664 696
 
665 697
 	echo '
666 698
 			</div>
@@ -687,10 +719,12 @@  discard block
 block discarded – undo
687 719
 				<div id="register_screen" class="content">';
688 720
 
689 721
 	if (!empty($context['registration_done']))
690
-		echo '
722
+	{
723
+			echo '
691 724
 					<div class="successbox">
692 725
 						', $context['registration_done'], '
693 726
 					</div>';
727
+	}
694 728
 
695 729
 	echo '
696 730
 					<input type="password" name="autofill_honey_pot" class="hide" />
@@ -730,8 +764,10 @@  discard block
 block discarded – undo
730 764
 							<select name="group" id="group_select" tabindex="', $context['tabindex']++, '">';
731 765
 
732 766
 		foreach ($context['member_groups'] as $id => $name)
733
-			echo '
767
+		{
768
+					echo '
734 769
 								<option value="', $id, '">', $name, '</option>';
770
+		}
735 771
 
736 772
 		echo '
737 773
 							</select>
@@ -780,8 +816,10 @@  discard block
 block discarded – undo
780 816
 
781 817
 	// Warning for if the file isn't writable.
782 818
 	if (!empty($context['warning']))
783
-		echo '
819
+	{
820
+			echo '
784 821
 			<p class="error">', $context['warning'], '</p>';
822
+	}
785 823
 
786 824
 	echo '
787 825
 			<div id="registration_agreement">
@@ -798,8 +836,10 @@  discard block
 block discarded – undo
798 836
 						<select name="agree_lang" onchange="document.getElementById(\'admin_form_wrapper\').submit();" tabindex="', $context['tabindex']++, '">';
799 837
 
800 838
 		foreach ($context['editable_agreements'] as $file => $name)
801
-			echo '
839
+		{
840
+					echo '
802 841
 							<option value="', $file, '" ', $context['current_agreement'] == $file ? 'selected="selected"' : '', '>', $name, '</option>';
842
+		}
803 843
 
804 844
 		echo '
805 845
 						</select>
@@ -905,8 +945,10 @@  discard block
 block discarded – undo
905 945
 			<div class="content">';
906 946
 
907 947
 	if (!empty($context['errors']))
908
-		echo '
948
+	{
949
+			echo '
909 950
 				<div class="errorbox">', $txt['errors_contact_form'], ': <ul><li>', implode('</li><li>', $context['errors']), '</li></ul></div>';
951
+	}
910 952
 
911 953
 	echo '
912 954
 				<dl class="settings">
Please login to merge, or discard this patch.
sources/subs/Graphics.subs.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -421,7 +421,7 @@  discard block
 block discarded – undo
421 421
 
422 422
 			// The behavior of bestfit changed in Imagick 3.0.0 and it will now scale up, we prevent that
423 423
 			$dest_width = empty($max_width) ? $src_width : ($force_resize ? $max_width : min($max_width, $src_width));
424
-			$dest_height = empty($max_height) ? $src_height : ($force_resize ? $max_height :  min($max_height, $src_height));
424
+			$dest_height = empty($max_height) ? $src_height : ($force_resize ? $max_height : min($max_height, $src_height));
425 425
 
426 426
 			// Set jpeg image quality to 80
427 427
 			if ($default_formats[$preferred_format] === 'jpeg')
@@ -673,7 +673,7 @@  discard block
 block discarded – undo
673 673
 	// Landscape
674 674
 	if ($width > $height)
675 675
 	{
676
-		$thumb_h = max (1, $height * ($limit / $width));
676
+		$thumb_h = max(1, $height * ($limit / $width));
677 677
 	}
678 678
 	// Portrait
679 679
 	elseif ($width < $height)
Please login to merge, or discard this patch.
Braces   +230 added lines, -93 removed lines patch added patch discarded remove patch
@@ -43,7 +43,9 @@  discard block
 block discarded – undo
43 43
 	$destName = substr($destName, 0, -4);
44 44
 
45 45
 	if ($success && @rename($destName . '.tmp', $destName))
46
-		return true;
46
+	{
47
+			return true;
48
+	}
47 49
 	else
48 50
 	{
49 51
 		@unlink($destName . '.tmp');
@@ -79,13 +81,17 @@  discard block
 block discarded – undo
79 81
 	if (!resizeImageFile($fileName, $fileName . '.tmp', null, null, $preferred_format, true))
80 82
 	{
81 83
 		if (file_exists($fileName . '.tmp'))
82
-			unlink($fileName . '.tmp');
84
+		{
85
+					unlink($fileName . '.tmp');
86
+		}
83 87
 
84 88
 		return false;
85 89
 	}
86 90
 
87 91
 	if (!unlink($fileName))
88
-		return false;
92
+	{
93
+			return false;
94
+	}
89 95
 
90 96
 	return rename($fileName . '.tmp', $fileName);
91 97
 }
@@ -162,7 +168,9 @@  discard block
 block discarded – undo
162 168
 
163 169
 	// Check to see if GD is installed and what version.
164 170
 	if (($extensionFunctions = get_extension_funcs('gd')) === false)
165
-		return false;
171
+	{
172
+			return false;
173
+	}
166 174
 
167 175
 	// Also determine if GD2 is installed and store it in a global.
168 176
 	$gd2 = in_array('imagecreatetruecolor', $extensionFunctions) && function_exists('imagecreatetruecolor');
@@ -267,7 +275,9 @@  discard block
 block discarded – undo
267 275
 
268 276
 	// Nothing to do without GD or IM
269 277
 	if (!checkGD() && !checkImagick())
270
-		return false;
278
+	{
279
+			return false;
280
+	}
271 281
 
272 282
 	if (!file_exists($source) && substr($source, 0, 7) !== 'http://' && substr($source, 0, 8) !== 'https://')
273 283
 	{
@@ -310,25 +320,33 @@  discard block
 block discarded – undo
310 320
 			}
311 321
 			fclose($fp_source);
312 322
 		}
313
-		else
314
-			$sizes = array(-1, -1, -1);
323
+		else {
324
+					$sizes = array(-1, -1, -1);
325
+		}
315 326
 
316 327
 		fclose($fp_destination);
317 328
 	}
318 329
 	// We can't get to the file.
319
-	else
320
-		$sizes = array(-1, -1, -1);
330
+	else {
331
+			$sizes = array(-1, -1, -1);
332
+	}
321 333
 
322 334
 	if ($sizes[0] === -1)
323
-		return false;
335
+	{
336
+			return false;
337
+	}
324 338
 
325 339
 	// See if we have -or- can get the needed memory for this operation
326 340
 	if (checkGD() && !imageMemoryCheck($sizes))
327
-		return false;
341
+	{
342
+			return false;
343
+	}
328 344
 
329 345
 	// Not allowed to save webp or can't support webp input
330 346
 	if ((empty($modSettings['attachment_webp_enable']) && $preferred_format == 18) || ($sizes[2] == 18 && !hasWebpSupport()))
331
-		return false;
347
+	{
348
+			return false;
349
+	}
332 350
 
333 351
 	// A known and supported format?
334 352
 	if (checkImagick() && isset($default_formats[$sizes[2]]))
@@ -404,7 +422,9 @@  discard block
 block discarded – undo
404 422
 
405 423
 		// Just to be sure, if the admin does not want webp
406 424
 		if (empty($modSettings['attachment_webp_enable']))
407
-			unset($default_formats[18]);
425
+		{
426
+					unset($default_formats[18]);
427
+		}
408 428
 
409 429
 		$preferred_format = empty($preferred_format) || !isset($default_formats[$preferred_format]) ? 2 : $preferred_format;
410 430
 
@@ -447,9 +467,12 @@  discard block
 block discarded – undo
447 467
 			// Create a new image in our preferred format and resize it if needed
448 468
 			$imagick->setImageFormat($default_formats[$preferred_format]);
449 469
 			if (substr($destName, -6) === '_thumb')
450
-				$imagick->thumbnailImage($dest_width, $dest_height, true);
451
-			else
452
-				$imagick->resizeImage($dest_width, $dest_height, imagick::FILTER_LANCZOS, 1, true);
470
+			{
471
+							$imagick->thumbnailImage($dest_width, $dest_height, true);
472
+			}
473
+			else {
474
+							$imagick->resizeImage($dest_width, $dest_height, imagick::FILTER_LANCZOS, 1, true);
475
+			}
453 476
 
454 477
 			// Remove EXIF / ICC data?
455 478
 			if ($strip)
@@ -459,9 +482,12 @@  discard block
 block discarded – undo
459 482
 
460 483
 			// Save the new image in the destination location
461 484
 			if ($preferred_format === IMAGETYPE_GIF && $imagick->getNumberImages() !== 0)
462
-				$success = $imagick->writeImages($destName, true);
463
-			else
464
-				$success = $imagick->writeImage($destName);
485
+			{
486
+							$success = $imagick->writeImages($destName, true);
487
+			}
488
+			else {
489
+							$success = $imagick->writeImage($destName);
490
+			}
465 491
 
466 492
 			// Free resources associated with the Imagick object
467 493
 			$imagick->clear();
@@ -513,33 +539,46 @@  discard block
 block discarded – undo
513 539
 					imagecopyresamplebicubic($dst_img, $src_img, 0, 0, 0, 0, $dst_width, $dst_height, $src_width, $src_height);
514 540
 				}
515 541
 			}
516
-			else
517
-				$dst_img = $src_img;
542
+			else {
543
+							$dst_img = $src_img;
544
+			}
545
+		}
546
+		else {
547
+					$dst_img = $src_img;
518 548
 		}
519
-		else
520
-			$dst_img = $src_img;
521 549
 
522 550
 		// Save the image as ...
523 551
 		if (!empty($preferred_format) && ($preferred_format == 3) && function_exists('imagepng'))
524
-			$success = imagepng($dst_img, $destName, 9, PNG_ALL_FILTERS);
552
+		{
553
+					$success = imagepng($dst_img, $destName, 9, PNG_ALL_FILTERS);
554
+		}
525 555
 		elseif (!empty($preferred_format) && ($preferred_format == 1) && function_exists('imagegif'))
526
-			$success = imagegif($dst_img, $destName);
556
+		{
557
+					$success = imagegif($dst_img, $destName);
558
+		}
527 559
 		elseif (!empty($preferred_format) && $preferred_format == 18 && function_exists('imagewebp'))
528
-			$success = imagewebp($dst_img, $destName, 80);
560
+		{
561
+					$success = imagewebp($dst_img, $destName, 80);
562
+		}
529 563
 		elseif (function_exists('imagejpeg'))
530
-			$success = imagejpeg($dst_img, $destName, 80);
564
+		{
565
+					$success = imagejpeg($dst_img, $destName, 80);
566
+		}
531 567
 
532 568
 		// Free the memory.
533 569
 		imagedestroy($src_img);
534 570
 		if ($dst_img != $src_img)
535
-			imagedestroy($dst_img);
571
+		{
572
+					imagedestroy($dst_img);
573
+		}
536 574
 
537 575
 		return $success;
538 576
 	}
539 577
 	// Without Imagick or GD, no image resizing at all.
540
-	else
541
-		return false;
542
-}
578
+	else {
579
+			return false;
580
+	}
581
+	}
543 582
 
544 583
 /*
545 584
  * Determines if an image has any alpha pixels
@@ -550,13 +589,17 @@  discard block
 block discarded – undo
550 589
 function hasTransparency($fileName, $png = true)
551 590
 {
552 591
 	if (empty($fileName) || !file_exists($fileName))
553
-		return false;
592
+	{
593
+			return false;
594
+	}
554 595
 
555 596
 	$header = file_get_contents($fileName, false, null, 0, 26);
556 597
 
557 598
 	// Does it even claim to have been saved with transparency
558 599
 	if ($png && !ord($header[25]) & 4)
559
-		return false;
600
+	{
601
+			return false;
602
+	}
560 603
 
561 604
 	// Webp has its own
562 605
 	if (!$png)
@@ -616,11 +659,16 @@  discard block
 block discarded – undo
616 659
 		list ($width, $height, $type) = elk_getimagesize($fileName);
617 660
 
618 661
 		if ($type === 18 && hasWebpSupport())
619
-			$image = imagecreatefromwebp($fileName);
662
+		{
663
+					$image = imagecreatefromwebp($fileName);
664
+		}
620 665
 		elseif ($type === 3)
621
-			$image = imagecreatefrompng($fileName);
622
-		else
623
-			return false;
666
+		{
667
+					$image = imagecreatefrompng($fileName);
668
+		}
669
+		else {
670
+					return false;
671
+		}
624 672
 
625 673
 		// Large image, scale down to reduce processing time
626 674
 		if ($width > 1024 || $height > 1024)
@@ -1089,7 +1137,9 @@  discard block
 block discarded – undo
1089 1137
 			if ($color == -1)
1090 1138
 			{
1091 1139
 				if ($palsize++ < 256)
1092
-					imagecolorallocate($dst_img, $red, $green, $blue);
1140
+				{
1141
+									imagecolorallocate($dst_img, $red, $green, $blue);
1142
+				}
1093 1143
 				$color = imagecolorclosest($dst_img, $red, $green, $blue);
1094 1144
 			}
1095 1145
 
@@ -1130,13 +1180,18 @@  discard block
 block discarded – undo
1130 1180
 
1131 1181
 		// Not a standard bitmap, bail out
1132 1182
 		if ($header['type'] != 0x4D42)
1133
-			return false;
1183
+		{
1184
+					return false;
1185
+		}
1134 1186
 
1135 1187
 		// Create our image canvas with the given WxH
1136 1188
 		if ($gd2)
1137
-			$dst_img = imagecreatetruecolor($info['width'], $info['height']);
1138
-		else
1139
-			$dst_img = imagecreate($info['width'], $info['height']);
1189
+		{
1190
+					$dst_img = imagecreatetruecolor($info['width'], $info['height']);
1191
+		}
1192
+		else {
1193
+					$dst_img = imagecreate($info['width'], $info['height']);
1194
+		}
1140 1195
 
1141 1196
 		// Color bitCounts 1,4,8 have palette information we use
1142 1197
 		$palette = array();
@@ -1168,7 +1223,9 @@  discard block
 block discarded – undo
1168 1223
 			$scan_line = fread($fp, $scan_line_size);
1169 1224
 
1170 1225
 			if (strlen($scan_line) < $scan_line_size)
1171
-				continue;
1226
+			{
1227
+							continue;
1228
+			}
1172 1229
 
1173 1230
 			// 32 bits per pixel
1174 1231
 			if ($info['bits'] == 32)
@@ -1188,7 +1245,9 @@  discard block
 block discarded – undo
1188 1245
 
1189 1246
 						// Gah!  Out of colors?  Stupid GD 1... try anyhow.
1190 1247
 						if ($color == -1)
1191
-							$color = imagecolorclosest($dst_img, $r, $g, $b);
1248
+						{
1249
+													$color = imagecolorclosest($dst_img, $r, $g, $b);
1250
+						}
1192 1251
 					}
1193 1252
 
1194 1253
 					imagesetpixel($dst_img, $x, $y, $color);
@@ -1211,7 +1270,9 @@  discard block
 block discarded – undo
1211 1270
 
1212 1271
 						// Gah!  Out of colors?  Stupid GD 1... try anyhow.
1213 1272
 						if ($color == -1)
1214
-							$color = imagecolorclosest($dst_img, $r, $g, $b);
1273
+						{
1274
+													$color = imagecolorclosest($dst_img, $r, $g, $b);
1275
+						}
1215 1276
 					}
1216 1277
 
1217 1278
 					imagesetpixel($dst_img, $x, $y, $color);
@@ -1240,7 +1301,9 @@  discard block
 block discarded – undo
1240 1301
 
1241 1302
 						// Gah!  Out of colors?  Stupid GD 1... try anyhow.
1242 1303
 						if ($color == -1)
1243
-							$color = imagecolorclosest($dst_img, $r, $g, $b);
1304
+						{
1305
+													$color = imagecolorclosest($dst_img, $r, $g, $b);
1306
+						}
1244 1307
 					}
1245 1308
 
1246 1309
 					imagesetpixel($dst_img, $x, $y, $color);
@@ -1251,7 +1314,9 @@  discard block
 block discarded – undo
1251 1314
 			{
1252 1315
 				$x = 0;
1253 1316
 				for ($j = 0; $j < $scan_line_size; $x++)
1254
-					imagesetpixel($dst_img, $x, $y, $palette[ord($scan_line[$j++])]);
1317
+				{
1318
+									imagesetpixel($dst_img, $x, $y, $palette[ord($scan_line[$j++])]);
1319
+				}
1255 1320
 			}
1256 1321
 			// 4 bits per pixel
1257 1322
 			elseif ($info['bits'] == 4)
@@ -1263,7 +1328,9 @@  discard block
 block discarded – undo
1263 1328
 
1264 1329
 					imagesetpixel($dst_img, $x, $y, $palette[(int) ($byte / 16)]);
1265 1330
 					if (++$x < $info['width'])
1266
-						imagesetpixel($dst_img, $x, $y, $palette[$byte & 15]);
1331
+					{
1332
+											imagesetpixel($dst_img, $x, $y, $palette[$byte & 15]);
1333
+					}
1267 1334
 				}
1268 1335
 			}
1269 1336
 			// 1 bit
@@ -1278,7 +1345,9 @@  discard block
 block discarded – undo
1278 1345
 					for ($shift = 1; $shift < 8; $shift++)
1279 1346
 					{
1280 1347
 						if (++$x < $info['width'])
1281
-							imagesetpixel($dst_img, $x, $y, $palette[(($byte << $shift) & 128) != 0]);
1348
+						{
1349
+													imagesetpixel($dst_img, $x, $y, $palette[(($byte << $shift) & 128) != 0]);
1350
+						}
1282 1351
 					}
1283 1352
 				}
1284 1353
 			}
@@ -1311,7 +1380,9 @@  discard block
 block discarded – undo
1311 1380
 	global $gd2, $settings, $user_info, $modSettings;
1312 1381
 
1313 1382
 	if (!checkGD())
1314
-		return false;
1383
+	{
1384
+			return false;
1385
+	}
1315 1386
 
1316 1387
 	// What type are we going to be doing?
1317 1388
 	// Note: The higher the value of visual_verification_type the harder the verification is
@@ -1320,7 +1391,9 @@  discard block
 block discarded – undo
1320 1391
 
1321 1392
 	// Special case to allow the admin center to show samples.
1322 1393
 	if ($user_info['is_admin'] && isset($_GET['type']))
1323
-		$imageType = (int) $_GET['type'];
1394
+	{
1395
+			$imageType = (int) $_GET['type'];
1396
+	}
1324 1397
 
1325 1398
 	// Some quick references for what we do.
1326 1399
 	// Do we show no, low or high noise?
@@ -1355,24 +1428,33 @@  discard block
 block discarded – undo
1355 1428
 
1356 1429
 	// What color is the background - generally white unless we're on "hard".
1357 1430
 	if ($simpleBGColor)
1358
-		$background_color = array(255, 255, 255);
1359
-	else
1360
-		$background_color = isset($settings['verification_background']) ? $settings['verification_background'] : array(236, 237, 243);
1431
+	{
1432
+			$background_color = array(255, 255, 255);
1433
+	}
1434
+	else {
1435
+			$background_color = isset($settings['verification_background']) ? $settings['verification_background'] : array(236, 237, 243);
1436
+	}
1361 1437
 
1362 1438
 	// The color of the characters shown (red, green, blue).
1363 1439
 	if ($simpleFGColor)
1364
-		$foreground_color = array(0, 0, 0);
1440
+	{
1441
+			$foreground_color = array(0, 0, 0);
1442
+	}
1365 1443
 	else
1366 1444
 	{
1367 1445
 		$foreground_color = array(64, 101, 136);
1368 1446
 
1369 1447
 		// Has the theme author requested a custom color?
1370 1448
 		if (isset($settings['verification_foreground']))
1371
-			$foreground_color = $settings['verification_foreground'];
1449
+		{
1450
+					$foreground_color = $settings['verification_foreground'];
1451
+		}
1372 1452
 	}
1373 1453
 
1374 1454
 	if (!is_dir($settings['default_theme_dir'] . '/fonts'))
1375
-		return false;
1455
+	{
1456
+			return false;
1457
+	}
1376 1458
 
1377 1459
 	// Can we use true type fonts?
1378 1460
 	$can_do_ttf = function_exists('imagettftext');
@@ -1384,13 +1466,19 @@  discard block
 block discarded – undo
1384 1466
 	while ($entry = $font_dir->read())
1385 1467
 	{
1386 1468
 		if (preg_match('~^(.+)\.gdf$~', $entry, $matches) === 1)
1387
-			$font_list[] = $entry;
1469
+		{
1470
+					$font_list[] = $entry;
1471
+		}
1388 1472
 		elseif (preg_match('~^(.+)\.ttf$~', $entry, $matches) === 1)
1389
-			$ttfont_list[] = $entry;
1473
+		{
1474
+					$ttfont_list[] = $entry;
1475
+		}
1390 1476
 	}
1391 1477
 
1392 1478
 	if (empty($font_list) && ($can_do_ttf && empty($ttfont_list)))
1393
-		return false;
1479
+	{
1480
+			return false;
1481
+	}
1394 1482
 
1395 1483
 	// For non-hard things don't even change fonts.
1396 1484
 	if (!$varyFonts)
@@ -1399,9 +1487,12 @@  discard block
 block discarded – undo
1399 1487
 
1400 1488
 		// Try use OpenSans if we can - it looks good!
1401 1489
 		if (in_array('OpenSans.ttf', $ttfont_list))
1402
-			$ttfont_list = array('OpenSans.ttf');
1403
-		else
1404
-			$ttfont_list = empty($ttfont_list) ? array() : array($ttfont_list[0]);
1490
+		{
1491
+					$ttfont_list = array('OpenSans.ttf');
1492
+		}
1493
+		else {
1494
+					$ttfont_list = empty($ttfont_list) ? array() : array($ttfont_list[0]);
1495
+		}
1405 1496
 	}
1406 1497
 
1407 1498
 	// Create a list of characters to be shown.
@@ -1420,8 +1511,10 @@  discard block
 block discarded – undo
1420 1511
 
1421 1512
 	// Load all fonts and determine the maximum font height.
1422 1513
 	if (!$can_do_ttf)
1423
-		foreach ($loaded_fonts as $font_index => $dummy)
1514
+	{
1515
+			foreach ($loaded_fonts as $font_index => $dummy)
1424 1516
 			$loaded_fonts[$font_index] = imageloadfont($settings['default_theme_dir'] . '/fonts/' . $font_list[$font_index]);
1517
+	}
1425 1518
 
1426 1519
 	// Determine the dimensions of each character.
1427 1520
 	$extra = ($imageType == 4 || $imageType == 5) ? 80 : 45;
@@ -1433,9 +1526,12 @@  discard block
 block discarded – undo
1433 1526
 		{
1434 1527
 			// GD2 handles font size differently.
1435 1528
 			if ($fontSizeRandom)
1436
-				$font_size = $gd2 ? mt_rand(17, 19) : mt_rand(25, 27);
1437
-			else
1438
-				$font_size = $gd2 ? 17 : 27;
1529
+			{
1530
+							$font_size = $gd2 ? mt_rand(17, 19) : mt_rand(25, 27);
1531
+			}
1532
+			else {
1533
+							$font_size = $gd2 ? 17 : 27;
1534
+			}
1439 1535
 
1440 1536
 			$img_box = imagettfbbox($font_size, 0, $settings['default_theme_dir'] . '/fonts/' . $ttfont_list[$character['font']], $character['id']);
1441 1537
 
@@ -1461,13 +1557,17 @@  discard block
 block discarded – undo
1461 1557
 
1462 1558
 	// Randomize the foreground color a little.
1463 1559
 	for ($i = 0; $i < 3; $i++)
1464
-		$foreground_color[$i] = mt_rand(max($foreground_color[$i] - 3, 0), min($foreground_color[$i] + 3, 255));
1560
+	{
1561
+			$foreground_color[$i] = mt_rand(max($foreground_color[$i] - 3, 0), min($foreground_color[$i] + 3, 255));
1562
+	}
1465 1563
 	$fg_color = imagecolorallocate($code_image, $foreground_color[0], $foreground_color[1], $foreground_color[2]);
1466 1564
 
1467 1565
 	// Color for the noise dots.
1468 1566
 	$dotbgcolor = array();
1469 1567
 	for ($i = 0; $i < 3; $i++)
1470
-		$dotbgcolor[$i] = $background_color[$i] < $foreground_color[$i] ? mt_rand(0, max($foreground_color[$i] - 20, 0)) : mt_rand(min($foreground_color[$i] + 20, 255), 255);
1568
+	{
1569
+			$dotbgcolor[$i] = $background_color[$i] < $foreground_color[$i] ? mt_rand(0, max($foreground_color[$i] - 20, 0)) : mt_rand(min($foreground_color[$i] + 20, 255), 255);
1570
+	}
1471 1571
 	$randomness_color = imagecolorallocate($code_image, $dotbgcolor[0], $dotbgcolor[1], $dotbgcolor[2]);
1472 1572
 
1473 1573
 	// Some squares/rectangles for new extreme level
@@ -1494,9 +1594,12 @@  discard block
 block discarded – undo
1494 1594
 		{
1495 1595
 			// How much rotation will we give?
1496 1596
 			if ($rotationType == 'none')
1497
-				$angle = 0;
1498
-			else
1499
-				$angle = mt_rand(-100, 100) / ($rotationType == 'high' ? 6 : 10);
1597
+			{
1598
+							$angle = 0;
1599
+			}
1600
+			else {
1601
+							$angle = mt_rand(-100, 100) / ($rotationType == 'high' ? 6 : 10);
1602
+			}
1500 1603
 
1501 1604
 			// What color shall we do it?
1502 1605
 			if ($fontColorType == 'cyclic')
@@ -1514,22 +1617,30 @@  discard block
 block discarded – undo
1514 1617
 				// Pick a color, but not the same one twice in a row
1515 1618
 				$new_index = $last_index;
1516 1619
 				while ($last_index == $new_index)
1517
-					$new_index = mt_rand(0, count($colors) - 1);
1620
+				{
1621
+									$new_index = mt_rand(0, count($colors) - 1);
1622
+				}
1518 1623
 				$char_fg_color = $colors[$new_index];
1519 1624
 				$last_index = $new_index;
1520 1625
 			}
1521 1626
 			elseif ($fontColorType == 'random')
1522
-				$char_fg_color = array(mt_rand(max($foreground_color[0] - 2, 0), $foreground_color[0]), mt_rand(max($foreground_color[1] - 2, 0), $foreground_color[1]), mt_rand(max($foreground_color[2] - 2, 0), $foreground_color[2]));
1523
-			else
1524
-				$char_fg_color = array($foreground_color[0], $foreground_color[1], $foreground_color[2]);
1627
+			{
1628
+							$char_fg_color = array(mt_rand(max($foreground_color[0] - 2, 0), $foreground_color[0]), mt_rand(max($foreground_color[1] - 2, 0), $foreground_color[1]), mt_rand(max($foreground_color[2] - 2, 0), $foreground_color[2]));
1629
+			}
1630
+			else {
1631
+							$char_fg_color = array($foreground_color[0], $foreground_color[1], $foreground_color[2]);
1632
+			}
1525 1633
 
1526 1634
 			if (!empty($can_do_ttf))
1527 1635
 			{
1528 1636
 				// GD2 handles font size differently.
1529 1637
 				if ($fontSizeRandom)
1530
-					$font_size = $gd2 ? mt_rand(17, 19) : mt_rand(18, 25);
1531
-				else
1532
-					$font_size = $gd2 ? 18 : 24;
1638
+				{
1639
+									$font_size = $gd2 ? mt_rand(17, 19) : mt_rand(18, 25);
1640
+				}
1641
+				else {
1642
+									$font_size = $gd2 ? 18 : 24;
1643
+				}
1533 1644
 
1534 1645
 				// Work out the sizes - also fix the character width cause TTF not quite so wide!
1535 1646
 				$font_x = $fontHorSpace === 'minus' && $cur_x > 0 ? $cur_x - 3 : $cur_x + 5;
@@ -1537,7 +1648,9 @@  discard block
 block discarded – undo
1537 1648
 
1538 1649
 				// What font face?
1539 1650
 				if (!empty($ttfont_list))
1540
-					$fontface = $settings['default_theme_dir'] . '/fonts/' . $ttfont_list[mt_rand(0, count($ttfont_list) - 1)];
1651
+				{
1652
+									$fontface = $settings['default_theme_dir'] . '/fonts/' . $ttfont_list[mt_rand(0, count($ttfont_list) - 1)];
1653
+				}
1541 1654
 
1542 1655
 				// What color are we to do it in?
1543 1656
 				$is_reverse = $showReverseChars ? mt_rand(0, 1) : false;
@@ -1545,20 +1658,27 @@  discard block
 block discarded – undo
1545 1658
 
1546 1659
 				$fontcord = @imagettftext($code_image, $font_size, $angle, $font_x, $font_y, $char_color, $fontface, $character['id']);
1547 1660
 				if (empty($fontcord))
1548
-					$can_do_ttf = false;
1661
+				{
1662
+									$can_do_ttf = false;
1663
+				}
1549 1664
 				elseif ($is_reverse !== false)
1550 1665
 				{
1551 1666
 					if (version_compare(PHP_VERSION, '8.1.0') === -1)
1552
-						imagefilledpolygon($code_image, $fontcord, 4, $fg_color);
1553
-					else
1554
-						imagefilledpolygon($code_image, $fontcord, $fg_color);
1667
+					{
1668
+											imagefilledpolygon($code_image, $fontcord, 4, $fg_color);
1669
+					}
1670
+					else {
1671
+											imagefilledpolygon($code_image, $fontcord, $fg_color);
1672
+					}
1555 1673
 
1556 1674
 					// Put the character back!
1557 1675
 					imagettftext($code_image, $font_size, $angle, $font_x, $font_y, $randomness_color, $fontface, $character['id']);
1558 1676
 				}
1559 1677
 
1560 1678
 				if ($can_do_ttf)
1561
-					$cur_x = max($fontcord[2], $fontcord[4]) + ($angle == 0 ? 0 : 3);
1679
+				{
1680
+									$cur_x = max($fontcord[2], $fontcord[4]) + ($angle == 0 ? 0 : 3);
1681
+				}
1562 1682
 			}
1563 1683
 
1564 1684
 			if (!$can_do_ttf)
@@ -1585,17 +1705,26 @@  discard block
 block discarded – undo
1585 1705
 
1586 1706
 	// Make the background color transparent on the hard image.
1587 1707
 	if (!$simpleBGColor)
1588
-		imagecolortransparent($code_image, $bg_color);
1708
+	{
1709
+			imagecolortransparent($code_image, $bg_color);
1710
+	}
1589 1711
 
1590 1712
 	if ($hasBorder)
1591
-		imagerectangle($code_image, 0, 0, $total_width - 1, $max_height - 1, $fg_color);
1713
+	{
1714
+			imagerectangle($code_image, 0, 0, $total_width - 1, $max_height - 1, $fg_color);
1715
+	}
1592 1716
 
1593 1717
 	// Add some noise to the background?
1594 1718
 	if ($noiseType != 'none')
1595 1719
 	{
1596 1720
 		for ($i = mt_rand(0, 2); $i < $max_height; $i += mt_rand(1, 2))
1597
-			for ($j = mt_rand(0, 10); $j < $total_width; $j += mt_rand(1, 10))
1598
-				imagesetpixel($code_image, $j, $i, mt_rand(0, 1) ? $fg_color : $randomness_color);
1721
+		{
1722
+					for ($j = mt_rand(0, 10);
1723
+		}
1724
+		$j < $total_width; $j += mt_rand(1, 10))
1725
+			{
1726
+							imagesetpixel($code_image, $j, $i, mt_rand(0, 1) ? $fg_color : $randomness_color);
1727
+			}
1599 1728
 
1600 1729
 		// Put in some lines too?
1601 1730
 		if ($noiseType != 'extreme')
@@ -1674,24 +1803,32 @@  discard block
 block discarded – undo
1674 1803
 	global $settings;
1675 1804
 
1676 1805
 	if (!is_dir($settings['default_theme_dir'] . '/fonts'))
1677
-		return false;
1806
+	{
1807
+			return false;
1808
+	}
1678 1809
 
1679 1810
 	// Get a list of the available font directories.
1680 1811
 	$font_dir = dir($settings['default_theme_dir'] . '/fonts');
1681 1812
 	$font_list = array();
1682 1813
 	while ($entry = $font_dir->read())
1683
-		if ($entry[0] !== '.' && is_dir($settings['default_theme_dir'] . '/fonts/' . $entry) && file_exists($settings['default_theme_dir'] . '/fonts/' . $entry . '.gdf'))
1814
+	{
1815
+			if ($entry[0] !== '.' && is_dir($settings['default_theme_dir'] . '/fonts/' . $entry) && file_exists($settings['default_theme_dir'] . '/fonts/' . $entry . '.gdf'))
1684 1816
 			$font_list[] = $entry;
1817
+	}
1685 1818
 
1686 1819
 	if (empty($font_list))
1687
-		return false;
1820
+	{
1821
+			return false;
1822
+	}
1688 1823
 
1689 1824
 	// Pick a random font.
1690 1825
 	$random_font = $font_list[array_rand($font_list)];
1691 1826
 
1692 1827
 	// Check if the given letter exists.
1693 1828
 	if (!file_exists($settings['default_theme_dir'] . '/fonts/' . $random_font . '/' . $letter . '.gif'))
1694
-		return false;
1829
+	{
1830
+			return false;
1831
+	}
1695 1832
 
1696 1833
 	// Include it!
1697 1834
 	header('Content-type: image/gif');
Please login to merge, or discard this patch.
sources/ext/bad-behavior/badbehavior-plugin.php 1 patch
Braces   +60 added lines, -21 removed lines patch added patch discarded remove patch
@@ -92,27 +92,42 @@  discard block
 block discarded – undo
92 92
 	if (strpos($query, 'DATE_SUB') !== false)
93 93
 	{
94 94
 		if (!empty($modSettings['badbehavior_logging']))
95
-			$query = 'DELETE FROM {db_prefix}log_badbehavior WHERE date < ' . (bb2_db_date() - 7 * 86400);
96
-		else
97
-			return true;
95
+		{
96
+					$query = 'DELETE FROM {db_prefix}log_badbehavior WHERE date < ' . (bb2_db_date() - 7 * 86400);
97
+		}
98
+		else {
99
+					return true;
100
+		}
98 101
 	}
99 102
 
100 103
 	if (strpos($query, 'OPTIMIZE TABLE') !== false)
101
-		return true;
104
+	{
105
+			return true;
106
+	}
102 107
 	elseif (strpos($query, '@@session.wait_timeout') !== false)
103
-		return true;
108
+	{
109
+			return true;
110
+	}
104 111
 	elseif (empty($query))
105
-		return true;
112
+	{
113
+			return true;
114
+	}
106 115
 
107 116
 	// Run the query, return success, failure or the actual results
108 117
 	$result = $db->query('', $query, array());
109 118
 
110 119
 	if (!$result)
111
-		return false;
120
+	{
121
+			return false;
122
+	}
112 123
 	elseif ($result === true)
113
-		return (bb2_db_affected_rows() !== 0);
124
+	{
125
+			return (bb2_db_affected_rows() !== 0);
126
+	}
114 127
 	elseif (bb2_db_num_rows($result) === 0)
115
-		return false;
128
+	{
129
+			return false;
130
+	}
116 131
 
117 132
 	return bb2_db_rows($result);
118 133
 }
@@ -131,7 +146,9 @@  discard block
 block discarded – undo
131 146
 
132 147
 	$temp = array();
133 148
 	while ($row = $db->fetch_assoc($result))
134
-		$temp[] = $row;
149
+	{
150
+			$temp[] = $row;
151
+	}
135 152
 	$db->free_result($result);
136 153
 
137 154
 	return $temp;
@@ -164,7 +181,9 @@  discard block
 block discarded – undo
164 181
 
165 182
 	// Logging not enabled
166 183
 	if (!$settings['logging'])
167
-		return '';
184
+	{
185
+			return '';
186
+	}
168 187
 
169 188
 	// Clean the data that bb sent us
170 189
 	$ip = bb2_db_escape(substr($package['ip'], 0, 19));
@@ -204,11 +223,15 @@  discard block
 block discarded – undo
204 223
 		foreach ($package['request_entity'] as $h => $v)
205 224
 		{
206 225
 			if (is_array($v))
207
-				$v = bb2_multi_implode($v, ' | ', true);
226
+			{
227
+							$v = bb2_multi_implode($v, ' | ', true);
228
+			}
208 229
 
209 230
 			$v = trim($v);
210 231
 			if ($v !== '')
211
-				$request_entity .= bb2_db_escape("$h: $v\n");
232
+			{
233
+							$request_entity .= bb2_db_escape("$h: $v\n");
234
+			}
212 235
 		}
213 236
 
214 237
 		// Only such much space in this column, so brutally cut it
@@ -221,7 +244,9 @@  discard block
 block discarded – undo
221 244
 	{
222 245
 		$$id = trim($$id);
223 246
 		while (preg_match('~[\'\\\\]$~', substr($$id, -1)) === 1)
224
-			$$id = trim(substr($$id, 0, -1));
247
+		{
248
+					$$id = trim(substr($$id, 0, -1));
249
+		}
225 250
 
226 251
 		$$id = str_replace("'", '_', $$id);
227 252
 	}
@@ -247,16 +272,22 @@  discard block
 block discarded – undo
247 272
 function bb2_multi_implode($array, $glue = ',', $trim_all = false)
248 273
 {
249 274
 	if (!is_array($array))
250
-		$array = array($array);
275
+	{
276
+			$array = array($array);
277
+	}
251 278
 
252 279
 	foreach ($array as $key => $value)
253 280
 	{
254 281
 		if (is_array($value))
255
-			$array[$key] = bb2_multi_implode($value, $glue, $trim_all);
282
+		{
283
+					$array[$key] = bb2_multi_implode($value, $glue, $trim_all);
284
+		}
256 285
 	}
257 286
 
258 287
 	if ($trim_all)
259
-		$array = array_map('trim', $array);
288
+	{
289
+			$array = array_map('trim', $array);
290
+	}
260 291
 
261 292
 	return implode($glue, $array);
262 293
 }
@@ -285,7 +316,9 @@  discard block
 block discarded – undo
285 316
 
286 317
 	// Nothing in the whitelist
287 318
 	if (empty($whitelist['badbehavior_ip_wl']) && empty($whitelist['badbehavior_useragent_wl']) && empty($whitelist['badbehavior_url_wl']))
288
-		return false;
319
+	{
320
+			return false;
321
+	}
289 322
 
290 323
 	// Build up the whitelist array so badbehavior can use it
291 324
 	return array_merge(
@@ -309,7 +342,9 @@  discard block
 block discarded – undo
309 342
 
310 343
 	// Make sure that the proxy addresses are split into an array, and if it's empty - make sure reverse proxy is disabled
311 344
 	if (!empty($modSettings['badbehavior_reverse_proxy_addresses']))
312
-		$badbehavior_reverse_proxy_addresses = explode('|', trim($modSettings['badbehavior_reverse_proxy_addresses']));
345
+	{
346
+			$badbehavior_reverse_proxy_addresses = explode('|', trim($modSettings['badbehavior_reverse_proxy_addresses']));
347
+	}
313 348
 	else
314 349
 	{
315 350
 		$badbehavior_reverse_proxy_addresses = array();
@@ -346,7 +381,9 @@  discard block
 block discarded – undo
346 381
 	global $bb2_javascript;
347 382
 
348 383
 	if (empty($bb2_javascript))
349
-		return '';
384
+	{
385
+			return '';
386
+	}
350 387
 
351 388
 	// Prepare it so we can use addInlineJavascript by removing the script tags hats its pre wrapped in
352 389
 	$temp = str_replace('<script type="text/javascript">' . "\n" . '<!--' . "\n", '', $bb2_javascript);
@@ -380,7 +417,9 @@  discard block
 block discarded – undo
380 417
 		}
381 418
 
382 419
 		if ($bb2_blocked !== false)
383
-			return sprintf($txt['badbehavior_blocked'], $bb2_blocked[0]['COUNT(*)']);
420
+		{
421
+					return sprintf($txt['badbehavior_blocked'], $bb2_blocked[0]['COUNT(*)']);
422
+		}
384 423
 	}
385 424
 }
386 425
 
Please login to merge, or discard this patch.
sources/subs/ScheduledTask/DailyDigest.php 1 patch
Braces   +51 added lines, -18 removed lines patch added patch discarded remove patch
@@ -60,7 +60,9 @@  discard block
 block discarded – undo
60 60
 		// If the maillist function is on then so is the enhanced digest
61 61
 		$maillist = !empty($modSettings['maillist_enabled']) && !empty($modSettings['maillist_digest_enabled']);
62 62
 		if ($maillist)
63
-			require_once(SUBSDIR . '/Emailpost.subs.php');
63
+		{
64
+					require_once(SUBSDIR . '/Emailpost.subs.php');
65
+		}
64 66
 
65 67
 		$is_weekly = !empty($is_weekly) ? 1 : 0;
66 68
 
@@ -101,21 +103,28 @@  discard block
 block discarded – undo
101 103
 			// Store this useful data!
102 104
 			$boards[$row['id_board']] = $row['id_board'];
103 105
 			if ($row['id_topic'])
104
-				$notify['topics'][$row['id_topic']][] = $row['id_member'];
105
-			else
106
-				$notify['boards'][$row['id_board']][] = $row['id_member'];
106
+			{
107
+							$notify['topics'][$row['id_topic']][] = $row['id_member'];
108
+			}
109
+			else {
110
+							$notify['boards'][$row['id_board']][] = $row['id_member'];
111
+			}
107 112
 		}
108 113
 		$db->free_result($request);
109 114
 
110 115
 		if (empty($boards))
111
-			return true;
116
+		{
117
+					return true;
118
+		}
112 119
 
113 120
 		// Just get the board names.
114 121
 		require_once(SUBSDIR . '/Boards.subs.php');
115 122
 		$boards = fetchBoardsInfo(array('boards' => $boards), array('override_permissions' => true));
116 123
 
117 124
 		if (empty($boards))
118
-			return true;
125
+		{
126
+					return true;
127
+		}
119 128
 
120 129
 		// Get the actual topics...
121 130
 		$request = $db->query('', '
@@ -141,11 +150,13 @@  discard block
 block discarded – undo
141 150
 		while ($row = $db->fetch_assoc($request))
142 151
 		{
143 152
 			if (!isset($types[$row['note_type']][$row['id_board']]))
144
-				$types[$row['note_type']][$row['id_board']] = array(
153
+			{
154
+							$types[$row['note_type']][$row['id_board']] = array(
145 155
 					'lines' => array(),
146 156
 					'name' => un_htmlspecialchars($row['board_name']),
147 157
 					'id' => $row['id_board'],
148 158
 				);
159
+			}
149 160
 
150 161
 			// A reply has been made
151 162
 			if ($row['note_type'] === 'reply')
@@ -188,12 +199,14 @@  discard block
 block discarded – undo
188 199
 
189 200
 				// Topics are simple since we are only concerned with the first post
190 201
 				if (!isset($types[$row['note_type']][$row['id_board']]['lines'][$row['id_topic']]))
191
-					$types[$row['note_type']][$row['id_board']]['lines'][$row['id_topic']] = array(
202
+				{
203
+									$types[$row['note_type']][$row['id_board']]['lines'][$row['id_topic']] = array(
192 204
 						'id' => $row['id_topic'],
193 205
 						'link' => $scripturl . '?topic=' . $row['id_topic'] . '.new;topicseen#new',
194 206
 						'subject' => un_htmlspecialchars($row['subject']),
195 207
 						'body' => $row['body'],
196 208
 					);
209
+				}
197 210
 			}
198 211
 			elseif ($maillist && empty($modSettings['pbe_no_mod_notices']))
199 212
 			{
@@ -210,15 +223,21 @@  discard block
 block discarded – undo
210 223
 			$types[$row['note_type']][$row['id_board']]['lines'][$row['id_topic']]['members'] = array();
211 224
 
212 225
 			if (!empty($notify['topics'][$row['id_topic']]))
213
-				$types[$row['note_type']][$row['id_board']]['lines'][$row['id_topic']]['members'] = array_merge($types[$row['note_type']][$row['id_board']]['lines'][$row['id_topic']]['members'], $notify['topics'][$row['id_topic']]);
226
+			{
227
+							$types[$row['note_type']][$row['id_board']]['lines'][$row['id_topic']]['members'] = array_merge($types[$row['note_type']][$row['id_board']]['lines'][$row['id_topic']]['members'], $notify['topics'][$row['id_topic']]);
228
+			}
214 229
 
215 230
 			if (!empty($notify['boards'][$row['id_board']]))
216
-				$types[$row['note_type']][$row['id_board']]['lines'][$row['id_topic']]['members'] = array_merge($types[$row['note_type']][$row['id_board']]['lines'][$row['id_topic']]['members'], $notify['boards'][$row['id_board']]);
231
+			{
232
+							$types[$row['note_type']][$row['id_board']]['lines'][$row['id_topic']]['members'] = array_merge($types[$row['note_type']][$row['id_board']]['lines'][$row['id_topic']]['members'], $notify['boards'][$row['id_board']]);
233
+			}
217 234
 		}
218 235
 		$db->free_result($request);
219 236
 
220 237
 		if (empty($types))
221
-			return true;
238
+		{
239
+					return true;
240
+		}
222 241
 
223 242
 		// Fix the last reply message so its suitable for previewing
224 243
 		if ($maillist && !empty($types['reply']))
@@ -305,13 +324,17 @@  discard block
 block discarded – undo
305 324
 
306 325
 							$email['body'] .= "\n" . sprintf($langtxt[$lang]['topic_lines'], $topic['subject'], $board['name']);
307 326
 							if ($maillist)
308
-								$email['body'] .= $langtxt[$lang]['preview'] . $topic['body'] . $langtxt[$lang]['see_full'] . $topic['link'] . "\n";
327
+							{
328
+															$email['body'] .= $langtxt[$lang]['preview'] . $topic['body'] . $langtxt[$lang]['see_full'] . $topic['link'] . "\n";
329
+							}
309 330
 						}
310 331
 					}
311 332
 				}
312 333
 
313 334
 				if ($titled)
314
-					$email['body'] .= "\n";
335
+				{
336
+									$email['body'] .= "\n";
337
+				}
315 338
 			}
316 339
 
317 340
 			// What about replies?
@@ -336,13 +359,17 @@  discard block
 block discarded – undo
336 359
 
337 360
 							$email['body'] .= "\n" . ($topic['count'] === 1 ? sprintf($langtxt[$lang]['replies_one'], $topic['subject']) : sprintf($langtxt[$lang]['replies_many'], $topic['count'], $topic['subject']));
338 361
 							if ($maillist)
339
-								$email['body'] .= $langtxt[$lang]['reply_preview'] . $topic['body'] . $langtxt[$lang]['unread_reply_link'] . $topic['link'] . "\n";
362
+							{
363
+															$email['body'] .= $langtxt[$lang]['reply_preview'] . $topic['body'] . $langtxt[$lang]['unread_reply_link'] . $topic['link'] . "\n";
364
+							}
340 365
 						}
341 366
 					}
342 367
 				}
343 368
 
344 369
 				if ($titled)
345
-					$email['body'] .= "\n";
370
+				{
371
+									$email['body'] .= "\n";
372
+				}
346 373
 			}
347 374
 
348 375
 			// Finally, moderation actions!
@@ -350,7 +377,9 @@  discard block
 block discarded – undo
350 377
 			foreach ($types as $note_type => $type)
351 378
 			{
352 379
 				if ($note_type === 'topic' || $note_type === 'reply')
353
-					continue;
380
+				{
381
+									continue;
382
+				}
354 383
 
355 384
 				foreach ($type as $id => $board)
356 385
 				{
@@ -371,7 +400,9 @@  discard block
 block discarded – undo
371 400
 			}
372 401
 
373 402
 			if ($titled)
374
-				$email['body'] .= "\n";
403
+			{
404
+							$email['body'] .= "\n";
405
+			}
375 406
 
376 407
 			// Then just say our goodbyes!
377 408
 			$email['body'] .= "\n\n" . $langtxt[$lang]['bye'];
@@ -382,7 +413,9 @@  discard block
 block discarded – undo
382 413
 
383 414
 		// Using the queue, do a final flush before we say that's all folks
384 415
 		if (!empty($modSettings['mail_queue']))
385
-			AddMailQueue(true);
416
+		{
417
+					AddMailQueue(true);
418
+		}
386 419
 
387 420
 		// Clean up...
388 421
 		if ($is_weekly)
Please login to merge, or discard this patch.
sources/subs/Html2BBC.class.php 1 patch
Braces   +180 added lines, -72 removed lines patch added patch discarded remove patch
@@ -127,10 +127,14 @@  discard block
 block discarded – undo
127 127
 	{
128 128
 		// If its not an array, make it one
129 129
 		if (!is_array($tags))
130
-			$tags = array($tags);
130
+		{
131
+					$tags = array($tags);
132
+		}
131 133
 
132 134
 		if (!empty($tags))
133
-			$this->_skip_tags = $tags;
135
+		{
136
+					$this->_skip_tags = $tags;
137
+		}
134 138
 	}
135 139
 
136 140
 	/**
@@ -142,10 +146,14 @@  discard block
 block discarded – undo
142 146
 	{
143 147
 		// If its not an array, make it one
144 148
 		if (!is_array($styles))
145
-			$styles = array($styles);
149
+		{
150
+					$styles = array($styles);
151
+		}
146 152
 
147 153
 		if (!empty($styles))
148
-			$this->_skip_style = $styles;
154
+		{
155
+					$this->_skip_style = $styles;
156
+		}
149 157
 	}
150 158
 
151 159
 	/**
@@ -168,7 +176,9 @@  discard block
 block discarded – undo
168 176
 		{
169 177
 			// Using the internal DOM methods we need to do a little extra work
170 178
 			if (preg_match('~<body.*?>(.*)</body>~s', $bbc, $body))
171
-				$bbc = $body[1];
179
+			{
180
+							$bbc = $body[1];
181
+			}
172 182
 		}
173 183
 
174 184
 		// Remove comment blocks
@@ -198,9 +208,12 @@  discard block
 block discarded – undo
198 208
 
199 209
 					// Strip can return nothing due to an error
200 210
 					if (empty($working))
201
-						$parts[$i] = $part;
202
-					else
203
-						$parts[$i] = htmlspecialchars_decode($working);
211
+					{
212
+											$parts[$i] = $part;
213
+					}
214
+					else {
215
+											$parts[$i] = htmlspecialchars_decode($working);
216
+					}
204 217
 				}
205 218
 			}
206 219
 			$bbc = implode('', $parts);
@@ -222,12 +235,16 @@  discard block
 block discarded – undo
222 235
 		while ($parent)
223 236
 		{
224 237
 			if (is_null($parent))
225
-				return false;
238
+			{
239
+							return false;
240
+			}
226 241
 
227 242
 			// Anywhere nested inside a code block we don't render tags
228 243
 			$tag = $parser ? $parent->nodeName : $parent->nodeName();
229 244
 			if ($tag === 'code')
230
-				return true;
245
+			{
246
+							return true;
247
+			}
231 248
 
232 249
 			// Back out another level, until we are done
233 250
 			$parent = $parser ? $parent->parentNode : $parent->parentNode();
@@ -244,7 +261,9 @@  discard block
 block discarded – undo
244 261
 	private function _convert_childNodes($node)
245 262
 	{
246 263
 		if (empty($node) || self::_has_parent_code($node, $this->_parser))
247
-			return;
264
+		{
265
+					return;
266
+		}
248 267
 
249 268
 		// Keep traversing till we are at the base of this node
250 269
 		if ($node->hasChildNodes())
@@ -467,9 +486,12 @@  discard block
 block discarded – undo
467 486
 		$value = $this->_get_value($node);
468 487
 
469 488
 		if (!empty($title))
470
-			$bbc = '[abbr=' . $title . ']' . $value . '[/abbr]';
471
-		else
472
-			$bbc = '';
489
+		{
490
+					$bbc = '[abbr=' . $title . ']' . $value . '[/abbr]';
491
+		}
492
+		else {
493
+					$bbc = '';
494
+		}
473 495
 
474 496
 		return $bbc;
475 497
 	}
@@ -492,29 +514,42 @@  discard block
 block discarded – undo
492 514
 
493 515
 		// An anchor link
494 516
 		if (empty($href) && !empty($id))
495
-			$bbc = '[anchor=' . $id . ']' . $value . '[/anchor]';
517
+		{
518
+					$bbc = '[anchor=' . $id . ']' . $value . '[/anchor]';
519
+		}
496 520
 		elseif (!empty($href) && $href[0] === '#')
497
-			$bbc = '[url=' . $href . ']' . $value . '[/url]';
521
+		{
522
+					$bbc = '[url=' . $href . ']' . $value . '[/url]';
523
+		}
498 524
 		// Maybe an email link
499 525
 		elseif (substr($href, 0, 7) === 'mailto:')
500 526
 		{
501 527
 			if ($href != 'mailto:' . (isset($modSettings['maillist_sitename_address']) ? $modSettings['maillist_sitename_address'] : ''))
502
-				$href = substr($href, 7);
503
-			else
504
-				$href = '';
528
+			{
529
+							$href = substr($href, 7);
530
+			}
531
+			else {
532
+							$href = '';
533
+			}
505 534
 
506 535
 			if (!empty($value))
507
-				$bbc = '[email=' . $href . ']' . $value . '[/email]';
508
-			else
509
-				$bbc = '[email]' . $href . '[/email]';
536
+			{
537
+							$bbc = '[email=' . $href . ']' . $value . '[/email]';
538
+			}
539
+			else {
540
+							$bbc = '[email]' . $href . '[/email]';
541
+			}
510 542
 		}
511 543
 		// FTP
512 544
 		elseif (substr($href, 0, 6) === 'ftp://')
513 545
 		{
514 546
 			if (!empty($value))
515
-				$bbc = '[ftp=' . $href . ']' . $value . '[/ftp]';
516
-			else
517
-				$bbc = '[ftp]' . $href . '[/ftp]';
547
+			{
548
+							$bbc = '[ftp=' . $href . ']' . $value . '[/ftp]';
549
+			}
550
+			else {
551
+							$bbc = '[ftp]' . $href . '[/ftp]';
552
+			}
518 553
 		}
519 554
 		// Oh a link then
520 555
 		else
@@ -525,15 +560,21 @@  discard block
 block discarded – undo
525 560
 				$baseURL = (isset($parsedURL['scheme']) ? $parsedURL['scheme'] : 'http') . '://' . $parsedURL['host'] . (empty($parsedURL['port']) ? '' : ':' . $parsedURL['port']);
526 561
 
527 562
 				if (substr($href, 0, 1) === '/')
528
-					$href = $baseURL . $href;
529
-				else
530
-					$href = $baseURL . (empty($parsedURL['path']) ? '/' : preg_replace('~/(?:index\\.php)?$~', '', $parsedURL['path'])) . '/' . $href;
563
+				{
564
+									$href = $baseURL . $href;
565
+				}
566
+				else {
567
+									$href = $baseURL . (empty($parsedURL['path']) ? '/' : preg_replace('~/(?:index\\.php)?$~', '', $parsedURL['path'])) . '/' . $href;
568
+				}
531 569
 			}
532 570
 
533 571
 			if (!empty($value))
534
-				$bbc = '[url=' . $href . ']' . $value . '[/url]';
535
-			else
536
-				$bbc = '[url]' . $href . '[/url]';
572
+			{
573
+							$bbc = '[url=' . $href . ']' . $value . '[/url]';
574
+			}
575
+			else {
576
+							$bbc = '[url]' . $href . '[/url]';
577
+			}
537 578
 		}
538 579
 
539 580
 		return $bbc;
@@ -555,7 +596,9 @@  discard block
 block discarded – undo
555 596
 		$value = $this->_get_value($node);
556 597
 
557 598
 		if ($dir == 'rtl' || $dir == 'ltr')
558
-			$bbc = '[bdo=' . $dir . ']' . $value . '[/bdo]';
599
+		{
600
+					$bbc = '[bdo=' . $dir . ']' . $value . '[/bdo]';
601
+		}
559 602
 
560 603
 		return $bbc;
561 604
 	}
@@ -583,13 +626,19 @@  discard block
 block discarded – undo
583 626
 
584 627
 			// Remove any leading and trailing blank lines
585 628
 			if (empty($first_line))
586
-				array_shift($lines);
629
+			{
630
+							array_shift($lines);
631
+			}
587 632
 			if (empty($last_line))
588
-				array_pop($lines);
633
+			{
634
+							array_pop($lines);
635
+			}
589 636
 
590 637
 			// Convert what remains
591 638
 			foreach ($lines as $line)
592
-				$bbc .= $line . $this->line_end;
639
+			{
640
+							$bbc .= $line . $this->line_end;
641
+			}
593 642
 
594 643
 			$bbc = rtrim($bbc, $this->line_end);
595 644
 		}
@@ -627,9 +676,13 @@  discard block
 block discarded – undo
627 676
 			$blocks[0] = '[size=' . $size . ']' . $blocks[0] . '[/size]';
628 677
 		}
629 678
 		if (!empty($face))
630
-			$blocks[0]  = '[font=' . strtolower($face) . ']' . $blocks[0] . '[/font]';
679
+		{
680
+					$blocks[0]  = '[font=' . strtolower($face) . ']' . $blocks[0] . '[/font]';
681
+		}
631 682
 		if (!empty($color))
632
-			$blocks[0]  = '[color=' . strtolower($color) . ']' . $blocks[0] . '[/color]';
683
+		{
684
+					$blocks[0]  = '[color=' . strtolower($color) . ']' . $blocks[0] . '[/color]';
685
+		}
633 686
 
634 687
 		return implode('', $blocks);
635 688
 	}
@@ -680,11 +733,16 @@  discard block
 block discarded – undo
680 733
 
681 734
 		// Do the basic things first, title/alt
682 735
 		if (!empty($title) && empty($alt))
683
-			$bbc = '[img alt=' . $title . ']' . $src . '[/img]';
736
+		{
737
+					$bbc = '[img alt=' . $title . ']' . $src . '[/img]';
738
+		}
684 739
 		elseif (!empty($alt))
685
-			$bbc = '[img alt=' . $alt . ']' . $src . '[/img]';
686
-		else
687
-			$bbc = '[img]' . $src . '[/img]';
740
+		{
741
+					$bbc = '[img alt=' . $alt . ']' . $src . '[/img]';
742
+		}
743
+		else {
744
+					$bbc = '[img]' . $src . '[/img]';
745
+		}
688 746
 
689 747
 		// If the tag has a style attribute
690 748
 		if (!empty($style))
@@ -709,14 +767,20 @@  discard block
 block discarded – undo
709 767
 		if (empty($size))
710 768
 		{
711 769
 			if (!empty($width))
712
-				$size .= 'width=' . $width . ' ';
770
+			{
771
+							$size .= 'width=' . $width . ' ';
772
+			}
713 773
 
714 774
 			if (!empty($height))
715
-				$size .= 'height=' . $height;
775
+			{
776
+							$size .= 'height=' . $height;
777
+			}
716 778
 		}
717 779
 
718 780
 		if (!empty($size))
719
-			$bbc = str_replace('[img', '[img ' . trim($size), $bbc);
781
+		{
782
+					$bbc = str_replace('[img', '[img ' . trim($size), $bbc);
783
+		}
720 784
 
721 785
 		return $bbc;
722 786
 	}
@@ -752,7 +816,9 @@  discard block
 block discarded – undo
752 816
 			{
753 817
 				// Skip any inline styles as needed
754 818
 				if (in_array($tag, $this->_skip_style))
755
-					continue;
819
+				{
820
+									continue;
821
+				}
756 822
 
757 823
 				// Well this can be as long, complete and exhaustive as we want :P
758 824
 				switch ($tag)
@@ -760,27 +826,39 @@  discard block
 block discarded – undo
760 826
 					case 'font-family':
761 827
 						// Only get the first font if there's a list
762 828
 						if (strpos($value, ',') !== false)
763
-							$value = substr($value, 0, strpos($value, ','));
829
+						{
830
+													$value = substr($value, 0, strpos($value, ','));
831
+						}
764 832
 						$bbc = '[font=' . strtr($value, array("'" => '')) . ']' . $bbc . '[/font]';
765 833
 						break;
766 834
 					case 'font-weight':
767 835
 						if ($value === 'bold' || $value === 'bolder' || $value == '700' || $value == '600')
768
-							$bbc = '[b]' . $bbc . '[/b]';
836
+						{
837
+													$bbc = '[b]' . $bbc . '[/b]';
838
+						}
769 839
 						break;
770 840
 					case 'font-style':
771 841
 						if ($value == 'italic')
772
-							$bbc = '[i]' . $bbc . '[/i]';
842
+						{
843
+													$bbc = '[i]' . $bbc . '[/i]';
844
+						}
773 845
 						break;
774 846
 					case 'text-decoration':
775 847
 						if ($value == 'underline')
776
-							$bbc = '[u]' . $bbc . '[/u]';
848
+						{
849
+													$bbc = '[u]' . $bbc . '[/u]';
850
+						}
777 851
 						elseif ($value == 'line-through')
778
-							$bbc = '[s]' . $bbc . '[/s]';
852
+						{
853
+													$bbc = '[s]' . $bbc . '[/s]';
854
+						}
779 855
 						break;
780 856
 					case 'font-size':
781 857
 						// Account for formatting issues, decimal in the wrong spot
782 858
 						if (preg_match('~(\d+)\.\d+(p[xt])~i', $value, $dec_matches) === 1)
783
-							$value = $dec_matches[1] . $dec_matches[2];
859
+						{
860
+													$value = $dec_matches[1] . $dec_matches[2];
861
+						}
784 862
 						$bbc = '[size=' . $value . ']' . $bbc . '[/size]';
785 863
 						break;
786 864
 					case 'color':
@@ -791,11 +869,17 @@  discard block
 block discarded – undo
791 869
 					case 'text-align':
792 870
 					case 'align':
793 871
 						if ($value === 'right')
794
-							$bbc = '[right]' . $value . '[/right]';
872
+						{
873
+													$bbc = '[right]' . $value . '[/right]';
874
+						}
795 875
 						elseif ($value === 'left')
796
-							$bbc = '[left]' . $value . '[/left]';
876
+						{
877
+													$bbc = '[left]' . $value . '[/left]';
878
+						}
797 879
 						elseif ($value === 'center')
798
-							$bbc = '[center]' . $value . '[/center]';
880
+						{
881
+													$bbc = '[center]' . $value . '[/center]';
882
+						}
799 883
 						break;
800 884
 				}
801 885
 			}
@@ -824,11 +908,17 @@  discard block
 block discarded – undo
824 908
 		{
825 909
 			$align = trim($align, '"');
826 910
 			if ($align === 'right')
827
-				$value = '[right]' . $value . '[/right]';
911
+			{
912
+							$value = '[right]' . $value . '[/right]';
913
+			}
828 914
 			elseif ($align === 'left')
829
-				$value = '[left]' . $value . '[/left]';
915
+			{
916
+							$value = '[left]' . $value . '[/left]';
917
+			}
830 918
 			elseif ($align === 'center')
831
-				$value = '[center]' . $value . '[/center]';
919
+			{
920
+							$value = '[center]' . $value . '[/center]';
921
+			}
832 922
 		}
833 923
 
834 924
 		// And are we spanning more than one col here?
@@ -848,12 +938,17 @@  discard block
 block discarded – undo
848 938
 	private function _get_value($node)
849 939
 	{
850 940
 		if ($node === null)
851
-			return '';
941
+		{
942
+					return '';
943
+		}
852 944
 
853 945
 		if ($this->_parser)
854
-			return $node->nodeValue;
855
-		else
856
-			return $node->innertext;
946
+		{
947
+					return $node->nodeValue;
948
+		}
949
+		else {
950
+					return $node->innertext;
951
+		}
857 952
 	}
858 953
 
859 954
 	/**
@@ -864,12 +959,17 @@  discard block
 block discarded – undo
864 959
 	private function _get_name($node)
865 960
 	{
866 961
 		if ($node === null)
867
-			return '';
962
+		{
963
+					return '';
964
+		}
868 965
 
869 966
 		if ($this->_parser)
870
-			return $node->nodeName;
871
-		else
872
-			return $node->nodeName();
967
+		{
968
+					return $node->nodeName;
969
+		}
970
+		else {
971
+					return $node->nodeName();
972
+		}
873 973
 	}
874 974
 
875 975
 	/**
@@ -889,8 +989,9 @@  discard block
 block discarded – undo
889 989
 
890 990
 			return preg_replace('@^<' . $tag . '[^>]*>|</' . $tag . '>$@', '', $html);
891 991
 		}
892
-		else
893
-			return $node->innertext;
992
+		else {
993
+					return $node->innertext;
994
+		}
894 995
 	}
895 996
 
896 997
 	/**
@@ -903,7 +1004,9 @@  discard block
 block discarded – undo
903 1004
 		if ($this->_parser)
904 1005
 		{
905 1006
 			if (version_compare(PHP_VERSION, '5.3.6') >= 0)
906
-				return $this->doc->saveHTML($node);
1007
+			{
1008
+							return $this->doc->saveHTML($node);
1009
+			}
907 1010
 			else
908 1011
 			{
909 1012
 				// @todo remove when 5.3.6 min
@@ -913,16 +1016,21 @@  discard block
 block discarded – undo
913 1016
 
914 1017
 				// We just want the html of the inserted node, it *may* be wrapped
915 1018
 				if (preg_match('~<body>(.*)</body>~s', $html, $body))
916
-					$html = $body[1];
1019
+				{
1020
+									$html = $body[1];
1021
+				}
917 1022
 				elseif (preg_match('~<html>(.*)</html>~s', $html, $body))
918
-					$html = $body[1];
1023
+				{
1024
+									$html = $body[1];
1025
+				}
919 1026
 
920 1027
 				// Clean it up
921 1028
 				return rtrim($html, "\n");
922 1029
 			}
923 1030
 		}
924
-		else
925
-			return $node->outertext;
1031
+		else {
1032
+					return $node->outertext;
1033
+		}
926 1034
 	}
927 1035
 
928 1036
 	/**
Please login to merge, or discard this patch.