Completed
Pull Request — release-2.1 (#4908)
by Rick
07:52
created
Themes/default/Register.template.php 1 patch
Braces   +90 added lines, -65 removed lines patch added patch discarded remove patch
@@ -28,14 +28,15 @@  discard block
 block discarded – undo
28 28
 			<div id="confirm_buttons">';
29 29
 
30 30
 	// Age restriction in effect?
31
-	if ($context['show_coppa'])
32
-		echo '
31
+	if ($context['show_coppa']) {
32
+			echo '
33 33
 				<input type="submit" name="accept_agreement" value="', $context['coppa_agree_above'], '" class="button"><br>
34 34
 				<br>
35 35
 				<input type="submit" name="accept_agreement_coppa" value="', $context['coppa_agree_below'], '" class="button">';
36
-	else
37
-		echo '
36
+	} else {
37
+			echo '
38 38
 				<input type="submit" name="accept_agreement" value="', $txt['agreement_agree'], '" class="button">';
39
+	}
39 40
 
40 41
 	echo '
41 42
 				<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
@@ -78,9 +79,10 @@  discard block
 block discarded – undo
78 79
 			<ul>';
79 80
 
80 81
 		// Cycle through each error and display an error message.
81
-		foreach ($context['registration_errors'] as $error)
82
-			echo '
82
+		foreach ($context['registration_errors'] as $error) {
83
+					echo '
83 84
 				<li>', $error, '</li>';
85
+		}
84 86
 
85 87
 		echo '
86 88
 			</ul>
@@ -149,14 +151,15 @@  discard block
 block discarded – undo
149 151
 		echo '
150 152
 					<dl class="register_form">';
151 153
 
152
-		foreach ($context['custom_fields'] as $field)
153
-			if ($field['show_reg'] > 1)
154
+		foreach ($context['custom_fields'] as $field) {
155
+					if ($field['show_reg'] > 1)
154 156
 				echo '
155 157
 						<dt>
156 158
 							<strong', !empty($field['is_error']) ? ' class="red"' : '', '>', $field['name'], ':</strong>
157 159
 							<span class="smalltext">', $field['desc'], '</span>
158 160
 						</dt>
159 161
 						<dd>', str_replace('name="', 'tabindex="' . $context['tabindex']++ . '" name="', $field['input_html']), '</dd>';
162
+		}
160 163
 
161 164
 		echo '
162 165
 					</dl>';
@@ -167,14 +170,15 @@  discard block
 block discarded – undo
167 170
 			</div><!-- .roundframe -->';
168 171
 
169 172
 	// If we have either of these, show the extra group.
170
-	if (!empty($context['profile_fields']) || !empty($context['custom_fields']))
171
-		echo '
173
+	if (!empty($context['profile_fields']) || !empty($context['custom_fields'])) {
174
+			echo '
172 175
 			<div class="title_bar">
173 176
 				<h3 class="titlebg">', $txt['additional_information'], '</h3>
174 177
 			</div>
175 178
 			<div class="roundframe noup">
176 179
 				<fieldset>
177 180
 					<dl class="register_form" id="custom_group">';
181
+	}
178 182
 
179 183
 	if (!empty($context['profile_fields']))
180 184
 	{
@@ -188,41 +192,45 @@  discard block
 block discarded – undo
188 192
 					$callback_func = 'template_profile_' . $field['callback_func'];
189 193
 					$callback_func();
190 194
 				}
191
-			}
192
-			else
195
+			} else
193 196
 			{
194 197
 				echo '
195 198
 						<dt>
196 199
 							<strong', !empty($field['is_error']) ? ' class="red"' : '', '>', $field['label'], ':</strong>';
197 200
 
198 201
 				// Does it have any subtext to show?
199
-				if (!empty($field['subtext']))
200
-					echo '
202
+				if (!empty($field['subtext'])) {
203
+									echo '
201 204
 							<span class="smalltext">', $field['subtext'], '</span>';
205
+				}
202 206
 
203 207
 				echo '
204 208
 						</dt>
205 209
 						<dd>';
206 210
 
207 211
 				// Want to put something infront of the box?
208
-				if (!empty($field['preinput']))
209
-					echo '
212
+				if (!empty($field['preinput'])) {
213
+									echo '
210 214
 							', $field['preinput'];
215
+				}
211 216
 
212 217
 				// What type of data are we showing?
213
-				if ($field['type'] == 'label')
214
-					echo '
218
+				if ($field['type'] == 'label') {
219
+									echo '
215 220
 							', $field['value'];
221
+				}
216 222
 
217 223
 				// Maybe it's a text box - very likely!
218
-				elseif (in_array($field['type'], array('int', 'float', 'text', 'password', 'url')))
219
-					echo '
224
+				elseif (in_array($field['type'], array('int', 'float', 'text', 'password', 'url'))) {
225
+									echo '
220 226
 							<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'], '>';
227
+				}
221 228
 
222 229
 				// You "checking" me out? ;)
223
-				elseif ($field['type'] == 'check')
224
-					echo '
230
+				elseif ($field['type'] == 'check') {
231
+									echo '
225 232
 							<input type="hidden" name="', $key, '" value="0"><input type="checkbox" name="', $key, '" id="', $key, '"', !empty($field['value']) ? ' checked' : '', ' value="1" tabindex="', $context['tabindex']++, '" ', $field['input_attr'], '>';
233
+				}
226 234
 
227 235
 				// Always fun - select boxes!
228 236
 				elseif ($field['type'] == 'select')
@@ -233,14 +241,16 @@  discard block
 block discarded – undo
233 241
 					if (isset($field['options']))
234 242
 					{
235 243
 						// Is this some code to generate the options?
236
-						if (!is_array($field['options']))
237
-							$field['options'] = eval($field['options']);
244
+						if (!is_array($field['options'])) {
245
+													$field['options'] = eval($field['options']);
246
+						}
238 247
 
239 248
 						// Assuming we now have some!
240
-						if (is_array($field['options']))
241
-							foreach ($field['options'] as $value => $name)
249
+						if (is_array($field['options'])) {
250
+													foreach ($field['options'] as $value => $name)
242 251
 								echo '
243 252
 								<option', is_numeric($value) ? ' value="" disabled' : ' value="' . $value . '"', $value === $field['value'] ? ' selected' : '', '>', $name, '</option>';
253
+						}
244 254
 					}
245 255
 
246 256
 					echo '
@@ -248,9 +258,10 @@  discard block
 block discarded – undo
248 258
 				}
249 259
 
250 260
 				// Something to end with?
251
-				if (!empty($field['postinput']))
252
-					echo '
261
+				if (!empty($field['postinput'])) {
262
+									echo '
253 263
 							', $field['postinput'];
264
+				}
254 265
 
255 266
 				echo '
256 267
 						</dd>';
@@ -261,25 +272,27 @@  discard block
 block discarded – undo
261 272
 	// Are there any custom fields?
262 273
 	if (!empty($context['custom_fields']))
263 274
 	{
264
-		foreach ($context['custom_fields'] as $field)
265
-			if ($field['show_reg'] < 2)
275
+		foreach ($context['custom_fields'] as $field) {
276
+					if ($field['show_reg'] < 2)
266 277
 				echo '
267 278
 						<dt>
268 279
 							<strong', !empty($field['is_error']) ? ' class="red"' : '', '>', $field['name'], ':</strong>
269 280
 							<span class="smalltext">', $field['desc'], '</span>
270 281
 						</dt>
271 282
 						<dd>', $field['input_html'], '</dd>';
283
+		}
272 284
 	}
273 285
 
274 286
 	// If we have either of these, close the list like a proper gent.
275
-	if (!empty($context['profile_fields']) || !empty($context['custom_fields']))
276
-		echo '
287
+	if (!empty($context['profile_fields']) || !empty($context['custom_fields'])) {
288
+			echo '
277 289
 					</dl>
278 290
 				</fieldset>
279 291
 			</div><!-- .roundframe -->';
292
+	}
280 293
 
281
-	if ($context['visual_verification'])
282
-		echo '
294
+	if ($context['visual_verification']) {
295
+			echo '
283 296
 			<div class="title_bar">
284 297
 				<h3 class="titlebg">', $txt['verification'], '</h3>
285 298
 			</div>
@@ -288,19 +301,21 @@  discard block
 block discarded – undo
288 301
 					', template_control_verification($context['visual_verification_id'], 'all'), '
289 302
 				</fieldset>
290 303
 			</div>';
304
+	}
291 305
 
292 306
 	echo '
293 307
 			<div id="confirm_buttons" class="flow_auto">';
294 308
 
295 309
 	// Age restriction in effect?
296
-	if (!$context['require_agreement'] && $context['show_coppa'])
297
-		echo '
310
+	if (!$context['require_agreement'] && $context['show_coppa']) {
311
+			echo '
298 312
 				<input type="submit" name="accept_agreement" value="', $context['coppa_agree_above'], '" class="button"><br>
299 313
 				<br>
300 314
 				<input type="submit" name="accept_agreement_coppa" value="', $context['coppa_agree_below'], '" class="button">';
301
-	else
302
-		echo '
315
+	} else {
316
+			echo '
303 317
 				<input type="submit" name="regSubmit" value="', $txt['register'], '" tabindex="', $context['tabindex']++, '" class="button">';
318
+	}
304 319
 
305 320
 	echo '
306 321
 			</div>
@@ -362,25 +377,28 @@  discard block
 block discarded – undo
362 377
 				<p>', $context['coppa']['many_options'] ? $txt['coppa_send_to_two_options'] : $txt['coppa_send_to_one_option'], '</p>';
363 378
 
364 379
 	// Can they send by post?
365
-	if (!empty($context['coppa']['post']))
366
-		echo '
380
+	if (!empty($context['coppa']['post'])) {
381
+			echo '
367 382
 				<h4>1) ', $txt['coppa_send_by_post'], '</h4>
368 383
 				<div class="coppa_contact">
369 384
 					', $context['coppa']['post'], '
370 385
 				</div>';
386
+	}
371 387
 
372 388
 	// Can they send by fax??
373
-	if (!empty($context['coppa']['fax']))
374
-		echo '
389
+	if (!empty($context['coppa']['fax'])) {
390
+			echo '
375 391
 				<h4>', !empty($context['coppa']['post']) ? '2' : '1', ') ', $txt['coppa_send_by_fax'], '</h4>
376 392
 				<div class="coppa_contact">
377 393
 					', $context['coppa']['fax'], '
378 394
 				</div>';
395
+	}
379 396
 
380 397
 	// Offer an alternative Phone Number?
381
-	if ($context['coppa']['phone'])
382
-		echo '
398
+	if ($context['coppa']['phone']) {
399
+			echo '
383 400
 				<p>', $context['coppa']['phone'], '</p>';
401
+	}
384 402
 
385 403
 	echo '
386 404
 			</div><!-- #coppa -->';
@@ -445,19 +463,20 @@  discard block
 block discarded – undo
445 463
 	<body style="margin: 1ex;">
446 464
 		<div class="windowbg description" style="text-align: center;">';
447 465
 
448
-	if (isBrowser('is_ie') || isBrowser('is_ie11'))
449
-		echo '
466
+	if (isBrowser('is_ie') || isBrowser('is_ie11')) {
467
+			echo '
450 468
 			<object classid="clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95" type="audio/x-wav">
451 469
 				<param name="AutoStart" value="1">
452 470
 				<param name="FileName" value="', $context['verification_sound_href'], '">
453 471
 			</object>';
454
-	else
455
-		echo '
472
+	} else {
473
+			echo '
456 474
 			<audio src="', $context['verification_sound_href'], '" controls>
457 475
 				<object type="audio/x-wav" data="', $context['verification_sound_href'], '">
458 476
 					<a href="', $context['verification_sound_href'], '" rel="nofollow">', $context['verification_sound_href'], '</a>
459 477
 				</object>
460 478
 			</audio>';
479
+	}
461 480
 
462 481
 	echo '
463 482
 			<br>
@@ -485,11 +504,12 @@  discard block
 block discarded – undo
485 504
 				</div>
486 505
 				<div id="register_screen" class="windowbg">';
487 506
 
488
-	if (!empty($context['registration_done']))
489
-		echo '
507
+	if (!empty($context['registration_done'])) {
508
+			echo '
490 509
 					<div class="infobox">
491 510
 						', $context['registration_done'], '
492 511
 					</div>';
512
+	}
493 513
 
494 514
 	echo '
495 515
 					<dl class="register_form" id="admin_register_form">
@@ -525,9 +545,10 @@  discard block
 block discarded – undo
525 545
 						<dd>
526 546
 							<select name="group" id="group_select" tabindex="', $context['tabindex']++, '">';
527 547
 
528
-		foreach ($context['member_groups'] as $id => $name)
529
-			echo '
548
+		foreach ($context['member_groups'] as $id => $name) {
549
+					echo '
530 550
 								<option value="', $id, '">', $name, '</option>';
551
+		}
531 552
 
532 553
 		echo '
533 554
 							</select>
@@ -535,8 +556,8 @@  discard block
 block discarded – undo
535 556
 	}
536 557
 
537 558
 	// If there is any field marked as required, show it here!
538
-	if (!empty($context['custom_fields_required']) && !empty($context['custom_fields']))
539
-		foreach ($context['custom_fields'] as $field)
559
+	if (!empty($context['custom_fields_required']) && !empty($context['custom_fields'])) {
560
+			foreach ($context['custom_fields'] as $field)
540 561
 			if ($field['show_reg'] > 1)
541 562
 				echo '
542 563
 						<dt>
@@ -546,6 +567,7 @@  discard block
 block discarded – undo
546 567
 						<dd>
547 568
 							', str_replace('name="', 'tabindex="' . $context['tabindex']++ . '" name="', $field['input_html']), '
548 569
 						</dd>';
570
+	}
549 571
 
550 572
 	echo '
551 573
 						<dt>
@@ -582,18 +604,19 @@  discard block
 block discarded – undo
582 604
 {
583 605
 	global $context, $scripturl, $txt;
584 606
 
585
-	if (!empty($context['saved_successful']))
586
-		echo '
607
+	if (!empty($context['saved_successful'])) {
608
+			echo '
587 609
 		<div class="infobox">', $txt['settings_saved'], '</div>';
588
-
589
-	elseif (!empty($context['could_not_save']))
590
-		echo '
610
+	} elseif (!empty($context['could_not_save'])) {
611
+			echo '
591 612
 		<div class="errorbox">', $txt['admin_agreement_not_saved'], '</div>';
613
+	}
592 614
 
593 615
 	// Warning for if the file isn't writable.
594
-	if (!empty($context['warning']))
595
-		echo '
616
+	if (!empty($context['warning'])) {
617
+			echo '
596 618
 		<div class="errorbox">', $context['warning'], '</div>';
619
+	}
597 620
 
598 621
 	// Just a big box to edit the text file ;)
599 622
 	echo '
@@ -615,9 +638,10 @@  discard block
 block discarded – undo
615 638
 						<strong>', $txt['admin_agreement_select_language'], ':</strong>
616 639
 						<select name="agree_lang" onchange="document.getElementById(\'change_reg\').submit();" tabindex="', $context['tabindex']++, '">';
617 640
 
618
-		foreach ($context['editable_agreements'] as $file => $name)
619
-			echo '
641
+		foreach ($context['editable_agreements'] as $file => $name) {
642
+					echo '
620 643
 							<option value="', $file, '"', $context['current_agreement'] == $file ? ' selected' : '', '>', $name, '</option>';
644
+		}
621 645
 
622 646
 		echo '
623 647
 						</select>
@@ -657,9 +681,10 @@  discard block
 block discarded – undo
657 681
 {
658 682
 	global $context, $scripturl, $txt;
659 683
 
660
-	if (!empty($context['saved_successful']))
661
-		echo '
684
+	if (!empty($context['saved_successful'])) {
685
+			echo '
662 686
 	<div class="infobox">', $txt['settings_saved'], '</div>';
687
+	}
663 688
 
664 689
 	echo '
665 690
 	<form id="admin_form_wrapper" action="', $scripturl, '?action=admin;area=regcenter" method="post" accept-charset="', $context['character_set'], '">
Please login to merge, or discard this patch.
Themes/default/ManageBans.template.php 1 patch
Braces   +24 added lines, -16 removed lines patch added patch discarded remove patch
@@ -29,9 +29,10 @@  discard block
 block discarded – undo
29 29
 				<strong>', $txt['ban_errors_detected'], '</strong>
30 30
 				<ul>';
31 31
 
32
-		foreach ($context['error_messages'] as $error)
33
-			echo '
32
+		foreach ($context['error_messages'] as $error) {
33
+					echo '
34 34
 					<li class="error">', $error, '</li>';
35
+		}
35 36
 
36 37
 		echo '
37 38
 				</ul>
@@ -45,9 +46,10 @@  discard block
 block discarded – undo
45 46
 				</h3>
46 47
 			</div>';
47 48
 
48
-	if ($context['ban']['is_new'])
49
-		echo '
49
+	if ($context['ban']['is_new']) {
50
+			echo '
50 51
 			<div class="information noup">', $txt['ban_add_notes'], '</div>';
52
+	}
51 53
 
52 54
 	echo '
53 55
 			<div class="windowbg noup">
@@ -59,8 +61,8 @@  discard block
 block discarded – undo
59 61
 						<input type="text" id="ban_name" name="ban_name" value="', $context['ban']['name'], '" size="45" maxlength="60">
60 62
 					</dd>';
61 63
 
62
-	if (isset($context['ban']['reason']))
63
-		echo '
64
+	if (isset($context['ban']['reason'])) {
65
+			echo '
64 66
 					<dt>
65 67
 						<strong><label for="reason">', $txt['ban_reason'], ':</label></strong><br>
66 68
 						<span class="smalltext">', $txt['ban_reason_desc'], '</span>
@@ -68,9 +70,10 @@  discard block
 block discarded – undo
68 70
 					<dd>
69 71
 						<textarea name="reason" id="reason" cols="40" rows="3">', $context['ban']['reason'], '</textarea>
70 72
 					</dd>';
73
+	}
71 74
 
72
-	if (isset($context['ban']['notes']))
73
-		echo '
75
+	if (isset($context['ban']['notes'])) {
76
+			echo '
74 77
 					<dt>
75 78
 						<strong><label for="ban_notes">', $txt['ban_notes'], ':</label></strong><br>
76 79
 						<span class="smalltext">', $txt['ban_notes_desc'], '</span>
@@ -78,6 +81,7 @@  discard block
 block discarded – undo
78 81
 					<dd>
79 82
 						<textarea name="notes" id="ban_notes" cols="40" rows="3">', $context['ban']['notes'], '</textarea>
80 83
 					</dd>';
84
+	}
81 85
 
82 86
 	echo '
83 87
 				</dl>
@@ -117,8 +121,8 @@  discard block
 block discarded – undo
117 121
 							<input type="text" name="main_ip" value="', $context['ban_suggestions']['main_ip'], '" size="44" onfocus="document.getElementById(\'main_ip_check\').checked = true;">
118 122
 						</dd>';
119 123
 
120
-		if (empty($modSettings['disableHostnameLookup']))
121
-			echo '
124
+		if (empty($modSettings['disableHostnameLookup'])) {
125
+					echo '
122 126
 						<dt>
123 127
 							<input type="checkbox" name="ban_suggestions[]" id="hostname_check" value="hostname"', !empty($context['ban_suggestions']['hostname']) ? ' checked' : '', '>
124 128
 							<label for="hostname_check">', $txt['ban_on_hostname'], '</label>
@@ -126,6 +130,7 @@  discard block
 block discarded – undo
126 130
 						<dd>
127 131
 							<input type="text" name="hostname" value="', $context['ban_suggestions']['hostname'], '" size="44" onfocus="document.getElementById(\'hostname_check\').checked = true;">
128 132
 						</dd>';
133
+		}
129 134
 
130 135
 		echo '
131 136
 						<dt>
@@ -155,14 +160,15 @@  discard block
 block discarded – undo
155 160
 					<dl class="settings">';
156 161
 
157 162
 					$count = 0;
158
-					foreach ($ban_ips as $ip)
159
-						echo '
163
+					foreach ($ban_ips as $ip) {
164
+											echo '
160 165
 						<dt>
161 166
 							<input type="checkbox" id="suggestions_', $key, '_', $count, '" name="ban_suggestions[', $key, '][]"', !empty($context['ban_suggestions']['saved_triggers'][$key]) && in_array($ip, $context['ban_suggestions']['saved_triggers'][$key]) ? ' checked' : '', ' value="', $ip, '">
162 167
 						</dt>
163 168
 						<dd>
164 169
 							<label for="suggestions_', $key, '_', $count++, '">', $ip, '</label>
165 170
 						</dd>';
171
+					}
166 172
 
167 173
 					echo '
168 174
 					</dl>';
@@ -204,8 +210,8 @@  discard block
 block discarded – undo
204 210
 		addLoadEvent(fUpdateStatus);';
205 211
 
206 212
 	// Auto suggest only needed for adding new bans, not editing
207
-	if ($context['ban']['is_new'] && empty($_REQUEST['u']))
208
-		echo '
213
+	if ($context['ban']['is_new'] && empty($_REQUEST['u'])) {
214
+			echo '
209 215
 		var oAddMemberSuggest = new smc_AutoSuggest({
210 216
 			sSelf: \'oAddMemberSuggest\',
211 217
 			sSessionId: smf_session_id,
@@ -223,6 +229,7 @@  discard block
 block discarded – undo
223 229
 			return true;
224 230
 		}
225 231
 		oAddMemberSuggest.registerCallback(\'onBeforeUpdate\', \'onUpdateName\');';
232
+	}
226 233
 
227 234
 	echo '
228 235
 		function confirmBan(aForm)
@@ -271,8 +278,8 @@  discard block
 block discarded – undo
271 278
 							<input type="text" name="main_ip" value="', $context['ban_trigger']['ip']['value'], '" size="44" onfocus="document.getElementById(\'main_ip_check\').checked = true;">
272 279
 						</dd>';
273 280
 
274
-	if (empty($modSettings['disableHostnameLookup']))
275
-		echo '
281
+	if (empty($modSettings['disableHostnameLookup'])) {
282
+			echo '
276 283
 						<dt>
277 284
 							<input type="checkbox" name="ban_suggestions[]" id="hostname_check" value="hostname"', $context['ban_trigger']['hostname']['selected'] ? ' checked' : '', '>
278 285
 							<label for="hostname_check">', $txt['ban_on_hostname'], '</label>
@@ -280,6 +287,7 @@  discard block
 block discarded – undo
280 287
 						<dd>
281 288
 							<input type="text" name="hostname" value="', $context['ban_trigger']['hostname']['value'], '" size="44" onfocus="document.getElementById(\'hostname_check\').checked = true;">
282 289
 						</dd>';
290
+	}
283 291
 
284 292
 	echo '
285 293
 						<dt>
Please login to merge, or discard this patch.
Themes/default/ManageSearch.template.php 1 patch
Braces   +23 added lines, -20 removed lines patch added patch discarded remove patch
@@ -127,8 +127,8 @@  discard block
 block discarded – undo
127 127
 			<div class="windowbg">
128 128
 				<dl class="settings">';
129 129
 
130
-	if (!empty($context['table_info']))
131
-		echo '
130
+	if (!empty($context['table_info'])) {
131
+			echo '
132 132
 					<dt>
133 133
 						<strong>', $txt['search_method_messages_table_space'], ':</strong>
134 134
 					</dt>
@@ -141,6 +141,7 @@  discard block
 block discarded – undo
141 141
 					<dd>
142 142
 						', $context['table_info']['index_length'], '
143 143
 					</dd>';
144
+	}
144 145
 	echo '
145 146
 				</dl>
146 147
 				', $context['double_index'] ? '<div class="noticebox">
@@ -163,17 +164,17 @@  discard block
 block discarded – undo
163 164
 						<dd>
164 165
 							<span class="smalltext">';
165 166
 
166
-		if (empty($context['fulltext_index']) && empty($context['cannot_create_fulltext']))
167
-			echo '
167
+		if (empty($context['fulltext_index']) && empty($context['cannot_create_fulltext'])) {
168
+					echo '
168 169
 								<strong>', $txt['search_index_label'], ':</strong> ', $txt['search_method_no_index_exists'], ' [<a href="', $scripturl, '?action=admin;area=managesearch;sa=createfulltext;', $context['session_var'], '=', $context['session_id'], ';', $context['admin-msm_token_var'], '=', $context['admin-msm_token'], '">', $txt['search_method_fulltext_create'], '</a>]';
169
-
170
-		elseif (empty($context['fulltext_index']) && !empty($context['cannot_create_fulltext']))
171
-			echo '
170
+		} elseif (empty($context['fulltext_index']) && !empty($context['cannot_create_fulltext'])) {
171
+					echo '
172 172
 								<strong>', $txt['search_index_label'], ':</strong> ', $txt['search_method_fulltext_cannot_create'];
173
-		else
174
-			echo '
173
+		} else {
174
+					echo '
175 175
 								<strong>', $txt['search_index_label'], ':</strong> ', $txt['search_method_index_already_exists'], ' [<a href="', $scripturl, '?action=admin;area=managesearch;sa=removefulltext;', $context['session_var'], '=', $context['session_id'], ';', $context['admin-msm_token_var'], '=', $context['admin-msm_token'], '">', $txt['search_method_fulltext_remove'], '</a>]<br>
176 176
 								<strong>', $txt['search_index_size'], ':</strong> ', $context['table_info']['fulltext_length'];
177
+		}
177 178
 		echo '
178 179
 							</span>
179 180
 						</dd>';
@@ -187,26 +188,27 @@  discard block
 block discarded – undo
187 188
 						<dd>
188 189
 							<span class="smalltext">';
189 190
 
190
-	if ($context['custom_index'])
191
-		echo '
191
+	if ($context['custom_index']) {
192
+			echo '
192 193
 								<strong>', $txt['search_index_label'], ':</strong> ', $txt['search_method_index_already_exists'], ' [<a href="', $scripturl, '?action=admin;area=managesearch;sa=removecustom;', $context['session_var'], '=', $context['session_id'], ';', $context['admin-msm_token_var'], '=', $context['admin-msm_token'], '">', $txt['search_index_custom_remove'], '</a>]<br>
193 194
 								<strong>', $txt['search_index_size'], ':</strong> ', $context['table_info']['custom_index_length'];
194
-
195
-	elseif ($context['partial_custom_index'])
196
-		echo '
195
+	} elseif ($context['partial_custom_index']) {
196
+			echo '
197 197
 								<strong>', $txt['search_index_label'], ':</strong> ', $txt['search_method_index_partial'], ' [<a href="', $scripturl, '?action=admin;area=managesearch;sa=removecustom;', $context['session_var'], '=', $context['session_id'], ';', $context['admin-msm_token_var'], '=', $context['admin-msm_token'], '">', $txt['search_index_custom_remove'], '</a>] [<a href="', $scripturl, '?action=admin;area=managesearch;sa=createmsgindex;resume;', $context['session_var'], '=', $context['session_id'], ';', $context['admin-msm_token_var'], '=', $context['admin-msm_token'], '">', $txt['search_index_custom_resume'], '</a>]<br>
198 198
 								<strong>', $txt['search_index_size'], ':</strong> ', $context['table_info']['custom_index_length'];
199
-	else
200
-		echo '
199
+	} else {
200
+			echo '
201 201
 								<strong>', $txt['search_index_label'], ':</strong> ', $txt['search_method_no_index_exists'], ' [<a href="', $scripturl, '?action=admin;area=managesearch;sa=createmsgindex">', $txt['search_index_create_custom'], '</a>]';
202
+	}
202 203
 	echo '
203 204
 							</span>
204 205
 						</dd>';
205 206
 
206 207
 	foreach ($context['search_apis'] as $api)
207 208
 	{
208
-		if (empty($api['label']) || $api['has_template'])
209
-			continue;
209
+		if (empty($api['label']) || $api['has_template']) {
210
+					continue;
211
+		}
210 212
 
211 213
 		echo '
212 214
 						<dt>
@@ -214,11 +216,12 @@  discard block
 block discarded – undo
214 216
 							', $api['label'], '
215 217
 						</dt>';
216 218
 
217
-		if ($api['desc'])
218
-			echo '
219
+		if ($api['desc']) {
220
+					echo '
219 221
 						<dd>
220 222
 							<span class="smalltext">', $api['desc'], '</span>
221 223
 						</dd>';
224
+		}
222 225
 	}
223 226
 
224 227
 	echo '
Please login to merge, or discard this patch.
Themes/default/ManageAttachments.template.php 1 patch
Braces   +29 added lines, -20 removed lines patch added patch discarded remove patch
@@ -116,9 +116,10 @@  discard block
 block discarded – undo
116 116
 		</div><!-- .windowbg -->
117 117
 	</div><!-- #manage_attachments -->';
118 118
 
119
-	if (!empty($context['results']))
120
-		echo '
119
+	if (!empty($context['results'])) {
120
+			echo '
121 121
 	<div class="noticebox">', $context['results'], '</div>';
122
+	}
122 123
 
123 124
 	echo '
124 125
 	<div id="transfer" class="cat_bar">
@@ -133,9 +134,10 @@  discard block
 block discarded – undo
133 134
 					<select name="from">
134 135
 						<option value="0">', $txt['attachment_transfer_select'], '</option>';
135 136
 
136
-	foreach ($context['attach_dirs'] as $id => $dir)
137
-		echo '
137
+	foreach ($context['attach_dirs'] as $id => $dir) {
138
+			echo '
138 139
 						<option value="', $id, '">', $dir, '</option>';
140
+	}
139 141
 
140 142
 	echo '
141 143
 					</select>
@@ -146,13 +148,14 @@  discard block
 block discarded – undo
146 148
 						<option value="0">', $txt['attachment_transfer_auto_select'], '</option>
147 149
 						<option value="-1">', $txt['attachment_transfer_forum_root'], '</option>';
148 150
 
149
-	if (!empty($context['base_dirs']))
150
-		foreach ($context['base_dirs'] as $id => $dir)
151
+	if (!empty($context['base_dirs'])) {
152
+			foreach ($context['base_dirs'] as $id => $dir)
151 153
 			echo '
152 154
 						<option value="', $id, '">', $dir, '</option>';
153
-	else
154
-			echo '
155
+	} else {
156
+				echo '
155 157
 						<option value="0" disabled>', $txt['attachment_transfer_no_base'], '</option>';
158
+	}
156 159
 
157 160
 	echo '
158 161
 					</select>
@@ -162,18 +165,20 @@  discard block
 block discarded – undo
162 165
 					<select name="to">
163 166
 						<option value="0">', $txt['attachment_transfer_select'], '</option>';
164 167
 
165
-	foreach ($context['attach_dirs'] as $id => $dir)
166
-		echo '
168
+	foreach ($context['attach_dirs'] as $id => $dir) {
169
+			echo '
167 170
 						<option value="', $id, '">', $dir, '</option>';
171
+	}
168 172
 
169 173
 	echo '
170 174
 					</select>
171 175
 				</dd>';
172 176
 
173
-	if (!empty($modSettings['attachmentDirFileLimit']))
174
-		echo '
177
+	if (!empty($modSettings['attachmentDirFileLimit'])) {
178
+			echo '
175 179
 				<dt>', $txt['attachment_transfer_empty'], '</dt>
176 180
 				<dd><input type="checkbox" name="empty_it"', $context['checked'] ? ' checked' : '', '></dd>';
181
+	}
177 182
 
178 183
 	echo '
179 184
 			</dl>
@@ -209,8 +214,8 @@  discard block
 block discarded – undo
209 214
 	global $context, $txt, $scripturl;
210 215
 
211 216
 	// If we've completed just let them know!
212
-	if ($context['completed'])
213
-		echo '
217
+	if ($context['completed']) {
218
+			echo '
214 219
 	<div id="manage_attachments">
215 220
 		<div class="cat_bar">
216 221
 			<h3 class="catbg">', $txt['repair_attachments_complete'], '</h3>
@@ -219,10 +224,11 @@  discard block
 block discarded – undo
219 224
 			', $txt['repair_attachments_complete_desc'], '
220 225
 		</div>
221 226
 	</div>';
227
+	}
222 228
 
223 229
 	// What about if no errors were even found?
224
-	elseif (!$context['errors_found'])
225
-		echo '
230
+	elseif (!$context['errors_found']) {
231
+			echo '
226 232
 	<div id="manage_attachments">
227 233
 		<div class="cat_bar">
228 234
 			<h3 class="catbg">', $txt['repair_attachments_complete'], '</h3>
@@ -231,6 +237,7 @@  discard block
 block discarded – undo
231 237
 			', $txt['repair_attachments_no_errors'], '
232 238
 		</div>
233 239
 	</div>';
240
+	}
234 241
 
235 242
 	// Otherwise, I'm sad to say, we have a problem!
236 243
 	else
@@ -245,11 +252,12 @@  discard block
 block discarded – undo
245 252
 				<p>', $txt['repair_attachments_error_desc'], '</p>';
246 253
 
247 254
 		// Loop through each error reporting the status
248
-		foreach ($context['repair_errors'] as $error => $number)
249
-			if (!empty($number))
255
+		foreach ($context['repair_errors'] as $error => $number) {
256
+					if (!empty($number))
250 257
 				echo '
251 258
 				<input type="checkbox" name="to_fix[]" id="', $error, '" value="', $error, '">
252 259
 				<label for="', $error, '">', sprintf($txt['attach_repair_' . $error], $number), '</label><br>';
260
+		}
253 261
 
254 262
 		echo '
255 263
 				<br>
@@ -268,8 +276,9 @@  discard block
 block discarded – undo
268 276
 {
269 277
 	global $modSettings;
270 278
 
271
-	if (!empty($modSettings['attachment_basedirectories']))
272
-		template_show_list('base_paths');
279
+	if (!empty($modSettings['attachment_basedirectories'])) {
280
+			template_show_list('base_paths');
281
+	}
273 282
 
274 283
 	template_show_list('attach_paths');
275 284
 }
Please login to merge, or discard this patch.
Themes/default/Who.template.php 1 patch
Braces   +45 added lines, -31 removed lines patch added patch discarded remove patch
@@ -31,9 +31,10 @@  discard block
 block discarded – undo
31 31
 						', $txt['who_show1'], '
32 32
 						<select name="show_top" onchange="document.forms.whoFilter.show.value = this.value; document.forms.whoFilter.submit();">';
33 33
 
34
-	foreach ($context['show_methods'] as $value => $label)
35
-		echo '
34
+	foreach ($context['show_methods'] as $value => $label) {
35
+			echo '
36 36
 							<option value="', $value, '" ', $value == $context['show_by'] ? ' selected' : '', '>', $label, '</option>';
37
+	}
37 38
 	echo '
38 39
 						</select>
39 40
 						<noscript>
@@ -58,20 +59,22 @@  discard block
 block discarded – undo
58 59
 							<td>';
59 60
 
60 61
 		// Guests can't be messaged.
61
-		if (!$member['is_guest'])
62
-			echo '
62
+		if (!$member['is_guest']) {
63
+					echo '
63 64
 								<span class="contact_info floatright">
64 65
 									', $context['can_send_pm'] ? '<a href="' . $member['online']['href'] . '" title="' . $member['online']['text'] . '">' : '', $settings['use_image_buttons'] ? '<span class="' . ($member['online']['is_online'] == 1 ? 'on' : 'off') . '" title="' . $member['online']['text'] . '"></span>' : $member['online']['label'], $context['can_send_pm'] ? '</a>' : '', '
65 66
 								</span>';
67
+		}
66 68
 
67 69
 		echo '
68 70
 								<span class="member', $member['is_hidden'] ? ' hidden' : '', '">
69 71
 									', $member['is_guest'] ? $member['name'] : '<a href="' . $member['href'] . '" title="' . $txt['profile_of'] . ' ' . $member['name'] . '"' . (empty($member['color']) ? '' : ' style="color: ' . $member['color'] . '"') . '>' . $member['name'] . '</a>', '
70 72
 								</span>';
71 73
 
72
-		if (!empty($member['ip']))
73
-			echo '
74
+		if (!empty($member['ip'])) {
75
+					echo '
74 76
 								(<a href="' . $scripturl . '?action=', ($member['is_guest'] ? 'trackip' : 'profile;area=tracking;sa=ip;u=' . $member['id']), ';searchip=' . $member['ip'] . '">' . $member['ip'] . '</a>)';
77
+		}
75 78
 
76 79
 		echo '
77 80
 							</td>
@@ -81,13 +84,14 @@  discard block
 block discarded – undo
81 84
 	}
82 85
 
83 86
 	// No members?
84
-	if (empty($context['members']))
85
-		echo '
87
+	if (empty($context['members'])) {
88
+			echo '
86 89
 						<tr class="windowbg">
87 90
 							<td colspan="3">
88 91
 							', $txt['who_no_online_' . ($context['show_by'] == 'guests' || $context['show_by'] == 'spiders' ? $context['show_by'] : 'members')], '
89 92
 							</td>
90 93
 						</tr>';
94
+	}
91 95
 
92 96
 	echo '
93 97
 					</tbody>
@@ -98,9 +102,10 @@  discard block
 block discarded – undo
98 102
 						', $txt['who_show1'], '
99 103
 						<select name="show" onchange="document.forms.whoFilter.submit();">';
100 104
 
101
-	foreach ($context['show_methods'] as $value => $label)
102
-		echo '
105
+	foreach ($context['show_methods'] as $value => $label) {
106
+			echo '
103 107
 							<option value="', $value, '" ', $value == $context['show_by'] ? ' selected' : '', '>', $label, '</option>';
108
+	}
104 109
 	echo '
105 110
 						</select>
106 111
 						<noscript>
@@ -129,17 +134,19 @@  discard block
 block discarded – undo
129 134
 
130 135
 	foreach ($context['credits'] as $section)
131 136
 	{
132
-		if (isset($section['pretext']))
133
-			echo '
137
+		if (isset($section['pretext'])) {
138
+					echo '
134 139
 		<div class="windowbg">
135 140
 			<p>', $section['pretext'], '</p>
136 141
 		</div>';
142
+		}
137 143
 
138
-		if (isset($section['title']))
139
-			echo '
144
+		if (isset($section['title'])) {
145
+					echo '
140 146
 		<div class="cat_bar">
141 147
 			<h3 class="catbg">', $section['title'], '</h3>
142 148
 		</div>';
149
+		}
143 150
 
144 151
 		echo '
145 152
 		<div class="windowbg">
@@ -147,17 +154,18 @@  discard block
 block discarded – undo
147 154
 
148 155
 		foreach ($section['groups'] as $group)
149 156
 		{
150
-			if (isset($group['title']))
151
-				echo '
157
+			if (isset($group['title'])) {
158
+							echo '
152 159
 				<dt>
153 160
 					<strong>', $group['title'], '</strong>
154 161
 				</dt>
155 162
 				<dd>';
163
+			}
156 164
 
157 165
 			// Try to make this read nicely.
158
-			if (count($group['members']) <= 2)
159
-				echo implode(' ' . $txt['credits_and'] . ' ', $group['members']);
160
-			else
166
+			if (count($group['members']) <= 2) {
167
+							echo implode(' ' . $txt['credits_and'] . ' ', $group['members']);
168
+			} else
161 169
 			{
162 170
 				$last_peep = array_pop($group['members']);
163 171
 				echo implode(', ', $group['members']), ' ', $txt['credits_and'], ' ', $last_peep;
@@ -170,9 +178,10 @@  discard block
 block discarded – undo
170 178
 		echo '
171 179
 			</dl>';
172 180
 
173
-		if (isset($section['posttext']))
174
-			echo '
181
+		if (isset($section['posttext'])) {
182
+					echo '
175 183
 				<p class="posttext">', $section['posttext'], '</p>';
184
+		}
176 185
 
177 186
 		echo '
178 187
 		</div>';
@@ -187,26 +196,29 @@  discard block
 block discarded – undo
187 196
 		</div>
188 197
 		<div class="windowbg">';
189 198
 
190
-		if (!empty($context['credits_software_graphics']['graphics']))
191
-			echo '
199
+		if (!empty($context['credits_software_graphics']['graphics'])) {
200
+					echo '
192 201
 			<dl>
193 202
 				<dt><strong>', $txt['credits_graphics'], '</strong></dt>
194 203
 				<dd>', implode('</dd><dd>', $context['credits_software_graphics']['graphics']), '</dd>
195 204
 			</dl>';
205
+		}
196 206
 
197
-		if (!empty($context['credits_software_graphics']['software']))
198
-			echo '
207
+		if (!empty($context['credits_software_graphics']['software'])) {
208
+					echo '
199 209
 			<dl>
200 210
 				<dt><strong>', $txt['credits_software'], '</strong></dt>
201 211
 				<dd>', implode('</dd><dd>', $context['credits_software_graphics']['software']), '</dd>
202 212
 			</dl>';
213
+		}
203 214
 
204
-		if (!empty($context['credits_software_graphics']['fonts']))
205
-			echo '
215
+		if (!empty($context['credits_software_graphics']['fonts'])) {
216
+					echo '
206 217
 			<dl>
207 218
 				<dt><strong>', $txt['credits_fonts'], '</strong></dt>
208 219
 				<dd>', implode('</dd><dd>', $context['credits_software_graphics']['fonts']), '</dd>
209 220
 			</dl>';
221
+		}
210 222
 		echo '
211 223
 		</div>';
212 224
 	}
@@ -222,14 +234,16 @@  discard block
 block discarded – undo
222 234
 			<ul>';
223 235
 
224 236
 		// Display the credits.
225
-		if (!empty($context['credits_modifications']))
226
-			echo '
237
+		if (!empty($context['credits_modifications'])) {
238
+					echo '
227 239
 				<li>', implode('</li><li>', $context['credits_modifications']), '</li>';
240
+		}
228 241
 
229 242
 		// Legacy.
230
-		if (!empty($context['copyrights']['mods']))
231
-			echo '
243
+		if (!empty($context['copyrights']['mods'])) {
244
+					echo '
232 245
 				<li>', implode('</li><li>', $context['copyrights']['mods']), '</li>';
246
+		}
233 247
 
234 248
 		echo '
235 249
 			</ul>
Please login to merge, or discard this patch.
Themes/default/ModerationCenter.template.php 1 patch
Braces   +59 added lines, -41 removed lines patch added patch discarded remove patch
@@ -54,18 +54,20 @@  discard block
 block discarded – undo
54 54
 		<div class="windowbg" id="group_requests_panel">
55 55
 			<ul>';
56 56
 
57
-	foreach ($context['group_requests'] as $request)
58
-		echo '
57
+	foreach ($context['group_requests'] as $request) {
58
+			echo '
59 59
 				<li class="smalltext">
60 60
 					<a href="', $request['request_href'], '">', $request['group']['name'], '</a> ', $txt['mc_groupr_by'], ' ', $request['member']['link'], '
61 61
 				</li>';
62
+	}
62 63
 
63 64
 	// Don't have any watched users right now?
64
-	if (empty($context['group_requests']))
65
-		echo '
65
+	if (empty($context['group_requests'])) {
66
+			echo '
66 67
 				<li>
67 68
 					<strong class="smalltext">', $txt['mc_group_requests_none'], '</strong>
68 69
 				</li>';
70
+	}
69 71
 
70 72
 	echo '
71 73
 			</ul>
@@ -121,18 +123,20 @@  discard block
 block discarded – undo
121 123
 		<div class="windowbg" id="watched_users_panel">
122 124
 			<ul>';
123 125
 
124
-	foreach ($context['watched_users'] as $user)
125
-		echo '
126
+	foreach ($context['watched_users'] as $user) {
127
+			echo '
126 128
 				<li>
127 129
 					<span class="smalltext">', sprintf(!empty($user['last_login']) ? $txt['mc_seen'] : $txt['mc_seen_never'], $user['link'], $user['last_login']), '</span>
128 130
 				</li>';
131
+	}
129 132
 
130 133
 	// Don't have any watched users right now?
131
-	if (empty($context['watched_users']))
132
-		echo '
134
+	if (empty($context['watched_users'])) {
135
+			echo '
133 136
 				<li>
134 137
 					<strong class="smalltext">', $txt['mc_watched_users_none'], '</strong>
135 138
 				</li>';
139
+	}
136 140
 
137 141
 	echo '
138 142
 			</ul>
@@ -188,18 +192,20 @@  discard block
 block discarded – undo
188 192
 		<div class="windowbg" id="reported_posts_panel">
189 193
 			<ul>';
190 194
 
191
-	foreach ($context['reported_posts'] as $post)
192
-		echo '
195
+	foreach ($context['reported_posts'] as $post) {
196
+			echo '
193 197
 				<li>
194 198
 					<span class="smalltext">', sprintf($txt['mc_post_report'], $post['report_link'], $post['author']['link']), '</span>
195 199
 				</li>';
200
+	}
196 201
 
197 202
 	// Don't have any watched users right now?
198
-	if (empty($context['reported_posts']))
199
-		echo '
203
+	if (empty($context['reported_posts'])) {
204
+			echo '
200 205
 				<li>
201 206
 					<strong class="smalltext">', $txt['mc_recent_reports_none'], '</strong>
202 207
 				</li>';
208
+	}
203 209
 
204 210
 	echo '
205 211
 			</ul>
@@ -255,18 +261,20 @@  discard block
 block discarded – undo
255 261
 		<div class="windowbg" id="reported_users_panel">
256 262
 			<ul>';
257 263
 
258
-	foreach ($context['reported_users'] as $user)
259
-		echo '
264
+	foreach ($context['reported_users'] as $user) {
265
+			echo '
260 266
 				<li>
261 267
 					<span class="smalltext">', $user['user']['link'], '</span>
262 268
 				</li>';
269
+	}
263 270
 
264 271
 	// Don't have any watched users right now?
265
-	if (empty($context['reported_users']))
266
-		echo '
272
+	if (empty($context['reported_users'])) {
273
+			echo '
267 274
 				<li>
268 275
 					<strong class="smalltext">', $txt['mc_reported_users_none'], '</strong>
269 276
 				</li>';
277
+	}
270 278
 
271 279
 	echo '
272 280
 			</ul>
@@ -313,11 +321,12 @@  discard block
 block discarded – undo
313 321
 	global $context, $txt, $scripturl;
314 322
 
315 323
 	// Let them know the action was a success.
316
-	if (!empty($context['report_post_action']))
317
-		echo '
324
+	if (!empty($context['report_post_action'])) {
325
+			echo '
318 326
 		<div class="infobox">
319 327
 			', $txt['report_action_' . $context['report_post_action']], '
320 328
 		</div>';
329
+	}
321 330
 
322 331
 	echo '
323 332
 		<div id="modnotes">
@@ -333,11 +342,12 @@  discard block
 block discarded – undo
333 342
 					<ul class="moderation_notes">';
334 343
 
335 344
 		// Cycle through the notes.
336
-		foreach ($context['notes'] as $note)
337
-			echo '
345
+		foreach ($context['notes'] as $note) {
346
+					echo '
338 347
 						<li class="smalltext">
339 348
 							', ($note['can_delete'] ? '<a href="' . $note['delete_href'] . ';' . $context['mod-modnote-del_token_var'] . '=' . $context['mod-modnote-del_token'] . '" data-confirm="' . $txt['mc_reportedp_delete_confirm'] . '" class="you_sure"><span class="generic_icons delete"></span></a>' : ''), $note['time'], ' <strong>', $note['author']['link'], ':</strong> ', $note['text'], '
340 349
 						</li>';
350
+		}
341 351
 
342 352
 		echo '
343 353
 					</ul>
@@ -378,18 +388,19 @@  discard block
 block discarded – undo
378 388
 	$remove_button = create_button('delete', 'remove_message', 'remove');
379 389
 
380 390
 	// No posts?
381
-	if (empty($context['unapproved_items']))
382
-		echo '
391
+	if (empty($context['unapproved_items'])) {
392
+			echo '
383 393
 			<div class="windowbg">
384 394
 				<p class="centertext">
385 395
 					', $txt['mc_unapproved_' . $context['current_view'] . '_none_found'], '
386 396
 				</p>
387 397
 			</div>';
388
-	else
389
-		echo '
398
+	} else {
399
+			echo '
390 400
 			<div class="pagesection floatleft">
391 401
 				', $context['page_index'], '
392 402
 			</div>';
403
+	}
393 404
 
394 405
 	foreach ($context['unapproved_items'] as $item)
395 406
 	{
@@ -408,14 +419,16 @@  discard block
 block discarded – undo
408 419
 				<span class="floatright">
409 420
 					<a href="', $scripturl, '?action=moderate;area=postmod;sa=', $context['current_view'], ';start=', $context['start'], ';', $context['session_var'], '=', $context['session_id'], ';approve=', $item['id'], '">', $approve_button, '</a>';
410 421
 
411
-		if ($item['can_delete'])
412
-			echo '
422
+		if ($item['can_delete']) {
423
+					echo '
413 424
 					', $context['menu_separator'], '
414 425
 					<a href="', $scripturl, '?action=moderate;area=postmod;sa=', $context['current_view'], ';start=', $context['start'], ';', $context['session_var'], '=', $context['session_id'], ';delete=', $item['id'], '">', $remove_button, '</a>';
426
+		}
415 427
 
416
-		if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1)
417
-			echo '
428
+		if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1) {
429
+					echo '
418 430
 					<input type="checkbox" name="item[]" value="', $item['id'], '" checked> ';
431
+		}
419 432
 
420 433
 		echo '
421 434
 				</span>
@@ -425,8 +438,8 @@  discard block
 block discarded – undo
425 438
 	echo '
426 439
 			<div class="pagesection">';
427 440
 
428
-	if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1)
429
-		echo '
441
+	if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1) {
442
+			echo '
430 443
 				<div class="floatright">
431 444
 					<select name="do" onchange="if (this.value != 0 &amp;&amp; confirm(\'', $txt['mc_unapproved_sure'], '\')) submit();">
432 445
 						<option value="0">', $txt['with_selected'], ':</option>
@@ -438,12 +451,14 @@  discard block
 block discarded – undo
438 451
 						<input type="submit" name="mc_go" value="', $txt['go'], '" class="button">
439 452
 					</noscript>
440 453
 				</div>';
454
+	}
441 455
 
442
-	if (!empty($context['unapproved_items']))
443
-		echo '
456
+	if (!empty($context['unapproved_items'])) {
457
+			echo '
444 458
 				<div class="floatleft">
445 459
 					<div class="pagelinks">', $context['page_index'], '</div>
446 460
 				</div>';
461
+	}
447 462
 
448 463
 	echo '
449 464
 			</div><!-- .pagesection -->
@@ -464,8 +479,9 @@  discard block
 block discarded – undo
464 479
 
465 480
 	// We'll have a delete please bob.
466 481
 	// @todo Discuss this with the team and rewrite if required.
467
-	if (empty($delete_button))
468
-		$delete_button = create_button('delete', 'remove_message', 'remove', 'class="centericon"');
482
+	if (empty($delete_button)) {
483
+			$delete_button = create_button('delete', 'remove_message', 'remove', 'class="centericon"');
484
+	}
469 485
 
470 486
 	$output_html = '
471 487
 					<div>
@@ -474,10 +490,11 @@  discard block
 block discarded – undo
474 490
 						</div>
475 491
 						<div class="floatright">';
476 492
 
477
-	if ($post['can_delete'])
478
-		$output_html .= '
493
+	if ($post['can_delete']) {
494
+			$output_html .= '
479 495
 							<a href="' . $scripturl . '?action=moderate;area=userwatch;sa=post;delete=' . $post['id'] . ';start=' . $context['start'] . ';' . $context['session_var'] . '=' . $context['session_id'] . '" data-confirm="' . $txt['mc_watched_users_delete_post'] . '" class="you_sure">' . $delete_button . '</a>
480 496
 							<input type="checkbox" name="delete[]" value="' . $post['id'] . '">';
497
+	}
481 498
 
482 499
 	$output_html .= '
483 500
 						</div>
@@ -521,12 +538,12 @@  discard block
 block discarded – undo
521 538
 				<input type="submit" name="save" value="', $txt['save'], '" class="button">
522 539
 			</div>
523 540
 		</form>';
524
-	}
525
-	else
526
-		echo '
541
+	} else {
542
+			echo '
527 543
 		<div class="windowbg">
528 544
 			<div class="centertext">', $txt['mc_no_settings'], '</div>
529 545
 		</div>';
546
+	}
530 547
 
531 548
 	echo '
532 549
 	</div><!-- #modcenter -->';
@@ -622,13 +639,14 @@  discard block
 block discarded – undo
622 639
 					</dd>
623 640
 				</dl>';
624 641
 
625
-	if ($context['template_data']['can_edit_personal'])
626
-		echo '
642
+	if ($context['template_data']['can_edit_personal']) {
643
+			echo '
627 644
 				<input type="checkbox" name="make_personal" id="make_personal"', $context['template_data']['personal'] ? ' checked' : '', '>
628 645
 					<label for="make_personal">
629 646
 						<strong>', $txt['mc_warning_template_personal'], '</strong>
630 647
 					</label>
631 648
 					<p class="smalltext">', $txt['mc_warning_template_personal_desc'], '</p>';
649
+	}
632 650
 
633 651
 	echo '
634 652
 				<input type="submit" name="preview" id="preview_button" value="', $txt['preview'], '" class="button">
Please login to merge, or discard this patch.
Themes/default/Search.template.php 1 patch
Braces   +78 added lines, -57 removed lines patch added patch discarded remove patch
@@ -20,17 +20,19 @@  discard block
 block discarded – undo
20 20
 	echo '
21 21
 	<form action="', $scripturl, '?action=search2" method="post" accept-charset="', $context['character_set'], '" name="searchform" id="searchform">';
22 22
 
23
-	if (!empty($context['search_errors']))
24
-		echo '
23
+	if (!empty($context['search_errors'])) {
24
+			echo '
25 25
 		<div class="errorbox">
26 26
 			', implode('<br>', $context['search_errors']['messages']), '
27 27
 		</div>';
28
+	}
28 29
 
29
-	if (!empty($context['search_ignored']))
30
-		echo '
30
+	if (!empty($context['search_ignored'])) {
31
+			echo '
31 32
 		<div class="noticebox">
32 33
 			', $txt['search_warning_ignored_word' . (count($context['search_ignored']) == 1 ? '' : 's')], ': ', implode(', ', $context['search_ignored']), '
33 34
 		</div>';
35
+	}
34 36
 
35 37
 	echo '
36 38
 		<div class="cat_bar">
@@ -48,9 +50,10 @@  discard block
 block discarded – undo
48 50
 				<dd>
49 51
 					<input type="search" name="search" id="searchfor" ', !empty($context['search_params']['search']) ? ' value="' . $context['search_params']['search'] . '"' : '', ' maxlength="', $context['search_string_limit'], '" size="40">';
50 52
 
51
-	if (empty($modSettings['search_simple_fulltext']))
52
-		echo '
53
+	if (empty($modSettings['search_simple_fulltext'])) {
54
+			echo '
53 55
 					<br><em class="smalltext">', $txt['search_example'], '</em>';
56
+	}
54 57
 
55 58
 	echo '
56 59
 				</dd>
@@ -114,21 +117,23 @@  discard block
 block discarded – undo
114 117
 			<input type="hidden" name="advanced" value="1">';
115 118
 
116 119
 	// Require an image to be typed to save spamming?
117
-	if ($context['require_verification'])
118
-		echo '
120
+	if ($context['require_verification']) {
121
+			echo '
119 122
 			<p>
120 123
 				<strong>', $txt['verification'], ':</strong>
121 124
 				', template_control_verification($context['visual_verification_id'], 'all'), '
122 125
 			</p>';
126
+	}
123 127
 
124 128
 	// If $context['search_params']['topic'] is set, that means we're searching just one topic.
125
-	if (!empty($context['search_params']['topic']))
126
-		echo '
129
+	if (!empty($context['search_params']['topic'])) {
130
+			echo '
127 131
 			<p>
128 132
 				', $txt['search_specific_topic'], ' &quot;', $context['search_topic']['link'], '&quot;.
129 133
 			</p>
130 134
 			<input type="hidden" name="topic" value="', $context['search_topic']['id'], '">
131 135
 			<input type="submit" name="b_search" value="', $txt['search'], '" class="button">';
136
+	}
132 137
 
133 138
 	echo '
134 139
 		</div>';
@@ -158,14 +163,15 @@  discard block
 block discarded – undo
158 163
 
159 164
 			foreach ($category['boards'] as $board)
160 165
 			{
161
-				if ($i == $limit)
162
-					echo '
166
+				if ($i == $limit) {
167
+									echo '
163 168
 							</ul>
164 169
 						</li>
165 170
 					</ul>
166 171
 					<ul class="ignoreboards floatright">
167 172
 						<li class="category">
168 173
 							<ul>';
174
+				}
169 175
 
170 176
 				echo '
171 177
 								<li class="board">
@@ -253,17 +259,19 @@  discard block
 block discarded – undo
253 259
 		<div class="roundframe">';
254 260
 
255 261
 		// Did they make any typos or mistakes, perhaps?
256
-		if (isset($context['did_you_mean']))
257
-			echo '
262
+		if (isset($context['did_you_mean'])) {
263
+					echo '
258 264
 			<p>
259 265
 				', $txt['search_did_you_mean'], ' <a href="', $scripturl, '?action=search2;params=', $context['did_you_mean_params'], '">', $context['did_you_mean'], '</a>.
260 266
 			</p>';
267
+		}
261 268
 
262
-		if (!empty($context['search_ignored']))
263
-			echo '
269
+		if (!empty($context['search_ignored'])) {
270
+					echo '
264 271
 			<p>
265 272
 				', $txt['search_warning_ignored_word' . (count($context['search_ignored']) == 1 ? '' : 's')], ': ', implode(', ', $context['search_ignored']), '
266 273
 			</p>';
274
+		}
267 275
 
268 276
 		echo '
269 277
 			<form action="', $scripturl, '?action=search2" method="post" accept-charset="', $context['character_set'], '">
@@ -286,10 +294,11 @@  discard block
 block discarded – undo
286 294
 					<input type="hidden" name="sort" value="', !empty($context['search_params']['sort']) ? $context['search_params']['sort'] : 'relevance', '">
287 295
 				</div>';
288 296
 
289
-		if (!empty($context['search_params']['brd']))
290
-			foreach ($context['search_params']['brd'] as $board_id)
297
+		if (!empty($context['search_params']['brd'])) {
298
+					foreach ($context['search_params']['brd'] as $board_id)
291 299
 				echo '
292 300
 				<input type="hidden" name="brd[', $board_id, ']" value="', $board_id, '">';
301
+		}
293 302
 
294 303
 		echo '
295 304
 			</form>
@@ -300,18 +309,20 @@  discard block
 block discarded – undo
300 309
 	if ($context['compact'])
301 310
 	{
302 311
 		// Quick moderation set to checkboxes? Oh, how fun :/
303
-		if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1)
304
-			echo '
312
+		if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1) {
313
+					echo '
305 314
 	<form action="', $scripturl, '?action=quickmod" method="post" accept-charset="', $context['character_set'], '" name="topicForm">';
315
+		}
306 316
 
307 317
 		echo '
308 318
 		<div class="cat_bar">
309 319
 			<h3 class="catbg">
310 320
 				<span class="floatright">';
311 321
 
312
-		if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1)
313
-			echo '
322
+		if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1) {
323
+					echo '
314 324
 					<input type="checkbox" onclick="invertAll(this, this.form, \'topics[]\');">';
325
+		}
315 326
 		echo '
316 327
 				</span>
317 328
 				<span class="generic_icons filter"></span> ', $txt['mlist_search_results'], ': ', $context['search_params']['search'], '
@@ -319,15 +330,15 @@  discard block
 block discarded – undo
319 330
 		</div>';
320 331
 
321 332
 		// Was anything even found?
322
-		if (!empty($context['topics']))
323
-			echo '
333
+		if (!empty($context['topics'])) {
334
+					echo '
324 335
 		<div class="pagesection">
325 336
 			<span>', $context['page_index'], '</span>
326 337
 		</div>';
327
-
328
-		else
329
-			echo '
338
+		} else {
339
+					echo '
330 340
 		<div class="roundframe noup">', $txt['find_no_results'], '</div>';
341
+		}
331 342
 
332 343
 		// While we have results to show ...
333 344
 		while ($topic = $context['get_topics']())
@@ -350,31 +361,35 @@  discard block
 block discarded – undo
350 361
 					echo '
351 362
 				<span class="floatright">';
352 363
 
353
-					if ($options['display_quick_mod'] == 1)
354
-						echo '
364
+					if ($options['display_quick_mod'] == 1) {
365
+											echo '
355 366
 					<input type="checkbox" name="topics[]" value="', $topic['id'], '">';
356
-
357
-					else
367
+					} else
358 368
 					{
359
-						if ($topic['quick_mod']['remove'])
360
-							echo '
369
+						if ($topic['quick_mod']['remove']) {
370
+													echo '
361 371
 					<a href="', $scripturl, '?action=quickmod;board=' . $topic['board']['id'] . '.0;actions%5B', $topic['id'], '%5D=remove;', $context['session_var'], '=', $context['session_id'], '" class="you_sure"><span class="generic_icons delete" title="', $txt['remove_topic'], '"></span></a>';
372
+						}
362 373
 
363
-						if ($topic['quick_mod']['lock'])
364
-							echo '
374
+						if ($topic['quick_mod']['lock']) {
375
+													echo '
365 376
 					<a href="', $scripturl, '?action=quickmod;board=' . $topic['board']['id'] . '.0;actions%5B', $topic['id'], '%5D=lock;', $context['session_var'], '=', $context['session_id'], '" class="you_sure"><span class="generic_icons lock" title="', $topic['is_locked'] ? $txt['set_unlock'] : $txt['set_lock'], '"></span></a>';
377
+						}
366 378
 
367
-						if ($topic['quick_mod']['lock'] || $topic['quick_mod']['remove'])
368
-							echo '
379
+						if ($topic['quick_mod']['lock'] || $topic['quick_mod']['remove']) {
380
+													echo '
369 381
 					<br>';
382
+						}
370 383
 
371
-						if ($topic['quick_mod']['sticky'])
372
-							echo '
384
+						if ($topic['quick_mod']['sticky']) {
385
+													echo '
373 386
 					<a href="', $scripturl, '?action=quickmod;board=' . $topic['board']['id'] . '.0;actions%5B', $topic['id'], '%5D=sticky;', $context['session_var'], '=', $context['session_id'], '" class="you_sure"><span class="generic_icons sticky" title="', $topic['is_sticky'] ? $txt['set_nonsticky'] : $txt['set_sticky'], '"></span></a>';
387
+						}
374 388
 
375
-						if ($topic['quick_mod']['move'])
376
-							echo '
389
+						if ($topic['quick_mod']['move']) {
390
+													echo '
377 391
 					<a href="', $scripturl, '?action=movetopic;topic=', $topic['id'], '.0"><span class="generic_icons move" title="', $txt['move_topic'], '"></span></a>';
392
+						}
378 393
 					}
379 394
 
380 395
 					echo '
@@ -384,20 +399,22 @@  discard block
 block discarded – undo
384 399
 			echo '
385 400
 			</div><!-- .block -->';
386 401
 
387
-				if ($message['body_highlighted'] != '')
388
-					echo '
402
+				if ($message['body_highlighted'] != '') {
403
+									echo '
389 404
 				<div class="list_posts double_height">', $message['body_highlighted'], '</div>';
405
+				}
390 406
 			}
391 407
 
392 408
 			echo '
393 409
 		</div><!-- $topic[css_class] -->';
394 410
 		}
395 411
 
396
-		if (!empty($context['topics']))
397
-			echo '
412
+		if (!empty($context['topics'])) {
413
+					echo '
398 414
 		<div class="pagesection">
399 415
 			<span>', $context['page_index'], '</span>
400 416
 		</div>';
417
+		}
401 418
 
402 419
 		if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1 && !empty($context['topics']))
403 420
 		{
@@ -406,17 +423,19 @@  discard block
 block discarded – undo
406 423
 			<select class="qaction" name="qaction"', $context['can_move'] ? ' onchange="this.form.move_to.disabled = (this.options[this.selectedIndex].value != \'move\');"' : '', '>
407 424
 				<option value="">--------</option>';
408 425
 
409
-			foreach ($context['qmod_actions'] as $qmod_action)
410
-				if ($context['can_' . $qmod_action])
426
+			foreach ($context['qmod_actions'] as $qmod_action) {
427
+							if ($context['can_' . $qmod_action])
411 428
 					echo '
412 429
 				<option value="' . $qmod_action . '">' . $txt['quick_mod_' . $qmod_action] . '</option>';
430
+			}
413 431
 
414 432
 			echo '
415 433
 			</select>';
416 434
 
417
-			if ($context['can_move'])
418
-				echo '
435
+			if ($context['can_move']) {
436
+							echo '
419 437
 			<span id="quick_mod_jump_to"></span>';
438
+			}
420 439
 
421 440
 			echo '
422 441
 			<input type="hidden" name="redirect_url" value="', $scripturl . '?action=search2;params=' . $context['params'], '">
@@ -425,12 +444,12 @@  discard block
 block discarded – undo
425 444
 		}
426 445
 
427 446
 
428
-		if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1 && !empty($context['topics']))
429
-			echo '
447
+		if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1 && !empty($context['topics'])) {
448
+					echo '
430 449
 		<input type="hidden" name="' . $context['session_var'] . '" value="' . $context['session_id'] . '">
431 450
 	</form>';
432
-	}
433
-	else
451
+		}
452
+	} else
434 453
 	{
435 454
 		echo '
436 455
 	<div class="cat_bar">
@@ -442,9 +461,10 @@  discard block
 block discarded – undo
442 461
 		<span>', $context['page_index'], '</span>
443 462
 	</div>';
444 463
 
445
-		if (empty($context['topics']))
446
-			echo '
464
+		if (empty($context['topics'])) {
465
+					echo '
447 466
 	<div class="information">(', $txt['search_no_results'], ')</div>';
467
+		}
448 468
 
449 469
 		while ($topic = $context['get_topics']())
450 470
 		{
@@ -479,8 +499,8 @@  discard block
 block discarded – undo
479 499
 	<div class="smalltext righttext" id="search_jump_to"></div>
480 500
 	<script>';
481 501
 
482
-	if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1 && !empty($context['topics']) && $context['can_move'])
483
-		echo '
502
+	if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1 && !empty($context['topics']) && $context['can_move']) {
503
+			echo '
484 504
 		if (typeof(window.XMLHttpRequest) != "undefined")
485 505
 			aJumpTo[aJumpTo.length] = new JumpTo({
486 506
 				sContainerId: "quick_mod_jump_to",
@@ -495,6 +515,7 @@  discard block
 block discarded – undo
495 515
 				bDisabled: true,
496 516
 				sCustomName: "move_to"
497 517
 			});';
518
+	}
498 519
 
499 520
 	echo '
500 521
 		if (typeof(window.XMLHttpRequest) != "undefined")
Please login to merge, or discard this patch.
Themes/default/Login.template.php 1 patch
Braces   +44 added lines, -30 removed lines patch added patch discarded remove patch
@@ -28,15 +28,17 @@  discard block
 block discarded – undo
28 28
 				<form class="login" action="', $context['login_url'], '" name="frmLogin" id="frmLogin" method="post" accept-charset="', $context['character_set'], '">';
29 29
 
30 30
 	// Did they make a mistake last time?
31
-	if (!empty($context['login_errors']))
32
-		echo '
31
+	if (!empty($context['login_errors'])) {
32
+			echo '
33 33
 					<div class="errorbox">', implode('<br>', $context['login_errors']), '</div>
34 34
 					<br>';
35
+	}
35 36
 
36 37
 	// Or perhaps there's some special description for this time?
37
-	if (isset($context['description']))
38
-		echo '
38
+	if (isset($context['description'])) {
39
+			echo '
39 40
 					<div class="information">', $context['description'], '</div>';
41
+	}
40 42
 
41 43
 	// Now just get the basic information - username, password, etc.
42 44
 	echo '
@@ -55,19 +57,21 @@  discard block
 block discarded – undo
55 57
 						<dd>
56 58
 							<select name="cookielength" id="cookielength">';
57 59
 
58
-	foreach ($context['login_cookie_times'] as $cookie_time => $cookie_txt)
59
-		echo '
60
+	foreach ($context['login_cookie_times'] as $cookie_time => $cookie_txt) {
61
+			echo '
60 62
 								<option value="', $cookie_time, '"', $modSettings['cookieTime'] == $cookie_time ? ' selected' : '', '>', $txt[$cookie_txt], '</option>';
63
+	}
61 64
 
62 65
 	echo '
63 66
 							</select>
64 67
 						</dd>';
65 68
 
66 69
 	// If they have deleted their account, give them a chance to change their mind.
67
-	if (isset($context['login_show_undelete']))
68
-		echo '
70
+	if (isset($context['login_show_undelete'])) {
71
+			echo '
69 72
 						<dt class="alert">', $txt['undelete_account'], ':</dt>
70 73
 						<dd><input type="checkbox" name="undelete"></dd>';
74
+	}
71 75
 
72 76
 	echo '
73 77
 					</dl>
@@ -85,8 +89,8 @@  discard block
 block discarded – undo
85 89
 							document.getElementById("', !empty($context['from_ajax']) ? 'ajax_' : '', isset($context['default_username']) && $context['default_username'] != '' ? 'loginpass' : 'loginuser', '").focus();
86 90
 						}, 150);';
87 91
 
88
-	if (!empty($context['from_ajax']))
89
-		echo '
92
+	if (!empty($context['from_ajax'])) {
93
+			echo '
90 94
 						form = $("#frmLogin");
91 95
 						form.submit(function(e) {
92 96
 							e.preventDefault();
@@ -119,16 +123,18 @@  discard block
 block discarded – undo
119 123
 
120 124
 							return false;
121 125
 						});';
126
+	}
122 127
 
123 128
 	echo '
124 129
 					</script>
125 130
 				</form>';
126 131
 
127 132
 	// It is a long story as to why we have this when we're clearly not going to use it.
128
-	if (!empty($context['from_ajax']))
129
-		echo '
133
+	if (!empty($context['from_ajax'])) {
134
+			echo '
130 135
 				<br>
131 136
 				<a href="javascript:self.close();"></a>';
137
+	}
132 138
 
133 139
 	echo '
134 140
 			</div><!-- .roundframe -->
@@ -151,11 +157,12 @@  discard block
 block discarded – undo
151 157
 			</div>
152 158
 			<div class="roundframe">';
153 159
 
154
-	if (!empty($context['tfa_error']) || !empty($context['tfa_backup_error']))
155
-		echo '
160
+	if (!empty($context['tfa_error']) || !empty($context['tfa_backup_error'])) {
161
+			echo '
156 162
 				<div class="error">
157 163
 					', $txt['tfa_' . (!empty($context['tfa_error']) ? 'code_' : 'backup_') . 'invalid'], '
158 164
 				</div>';
165
+	}
159 166
 
160 167
 	echo '
161 168
 				<form action="', $context['tfa_url'], '" method="post" id="frmTfa">
@@ -183,8 +190,8 @@  discard block
 block discarded – undo
183 190
 				<script>
184 191
 					form = $("#frmTfa");';
185 192
 
186
-	if (!empty($context['from_ajax']))
187
-		echo '
193
+	if (!empty($context['from_ajax'])) {
194
+			echo '
188 195
 					form.submit(function(e) {
189 196
 						// If we are submitting backup code, let normal workflow follow since it redirects a couple times into a different page
190 197
 						if (form.find("input[name=tfa_backup]:first").val().length > 0)
@@ -203,6 +210,7 @@  discard block
 block discarded – undo
203 210
 
204 211
 						return false;
205 212
 					});';
213
+	}
206 214
 
207 215
 	echo '
208 216
 					form.find("input[name=backup]").click(function(e) {
@@ -234,10 +242,11 @@  discard block
 block discarded – undo
234 242
 			<p class="information centertext">
235 243
 				', empty($context['kick_message']) ? $txt['only_members_can_access'] : $context['kick_message'], '<br>';
236 244
 
237
-	if ($context['can_register'])
238
-		echo sprintf($txt['login_below_or_register'], $scripturl . '?action=signup', $context['forum_name_html_safe']);
239
-	else
240
-		echo $txt['login_below'];
245
+	if ($context['can_register']) {
246
+			echo sprintf($txt['login_below_or_register'], $scripturl . '?action=signup', $context['forum_name_html_safe']);
247
+	} else {
248
+			echo $txt['login_below'];
249
+	}
241 250
 
242 251
 	// And now the login information.
243 252
 	echo '
@@ -256,9 +265,10 @@  discard block
 block discarded – undo
256 265
 					<dd>
257 266
 							<select name="cookielength" id="cookielength">';
258 267
 
259
-	foreach ($context['login_cookie_times'] as $cookie_time => $cookie_txt)
260
-		echo '
268
+	foreach ($context['login_cookie_times'] as $cookie_time => $cookie_txt) {
269
+			echo '
261 270
 								<option value="', $cookie_time, '"', $modSettings['cookieTime'] == $cookie_time ? ' selected' : '', '>', $txt[$cookie_txt], '</option>';
271
+	}
262 272
 
263 273
 	echo '
264 274
 							</select>
@@ -315,9 +325,10 @@  discard block
 block discarded – undo
315 325
 					<dd>
316 326
 							<select name="cookielength" id="cookielength">';
317 327
 
318
-	foreach ($context['login_cookie_times'] as $cookie_time => $cookie_txt)
319
-		echo '
328
+	foreach ($context['login_cookie_times'] as $cookie_time => $cookie_txt) {
329
+			echo '
320 330
 								<option value="', $cookie_time, '"', $modSettings['cookieTime'] == $cookie_time ? ' selected' : '', '>', $txt[$cookie_txt], '</option>';
331
+	}
321 332
 
322 333
 	echo '
323 334
 							</select>
@@ -351,9 +362,10 @@  discard block
 block discarded – undo
351 362
 			</div>
352 363
 			<div class="roundframe centertext">';
353 364
 
354
-	if (!empty($context['incorrect_password']))
355
-		echo '
365
+	if (!empty($context['incorrect_password'])) {
366
+			echo '
356 367
 				<div class="error">', $txt['admin_incorrect_password'], '</div>';
368
+	}
357 369
 
358 370
 	echo '
359 371
 				<strong>', $txt['password'], ':</strong>
@@ -394,10 +406,11 @@  discard block
 block discarded – undo
394 406
 				<dl>';
395 407
 
396 408
 	// You didn't even have an ID?
397
-	if (empty($context['member_id']))
398
-		echo '
409
+	if (empty($context['member_id'])) {
410
+			echo '
399 411
 					<dt>', $txt['invalid_activation_username'], ':</dt>
400 412
 					<dd><input type="text" name="user" size="30"></dd>';
413
+	}
401 414
 
402 415
 	echo '
403 416
 					<dt>', $txt['invalid_activation_retry'], ':</dt>
@@ -434,13 +447,14 @@  discard block
 block discarded – undo
434 447
 					<dd><input type="password" name="passwd" size="30"></dd>
435 448
 				</dl>';
436 449
 
437
-	if ($context['can_activate'])
438
-		echo '
450
+	if ($context['can_activate']) {
451
+			echo '
439 452
 				<p>', $txt['invalid_activation_known'], '</p>
440 453
 				<dl>
441 454
 					<dt>', $txt['invalid_activation_retry'], ':</dt>
442 455
 					<dd><input type="text" name="code" size="30"></dd>
443 456
 				</dl>';
457
+	}
444 458
 
445 459
 	echo '
446 460
 				<p><input type="submit" value="', $txt['invalid_activation_resend'], '" class="button"></p>
Please login to merge, or discard this patch.
Sources/LogInOut.php 1 patch
Braces   +154 added lines, -121 removed lines patch added patch discarded remove patch
@@ -14,8 +14,9 @@  discard block
 block discarded – undo
14 14
  * @version 2.1 Beta 4
15 15
  */
16 16
 
17
-if (!defined('SMF'))
17
+if (!defined('SMF')) {
18 18
 	die('No direct access...');
19
+}
19 20
 
20 21
 /**
21 22
  * Ask them for their login information. (shows a page for the user to type
@@ -29,8 +30,9 @@  discard block
 block discarded – undo
29 30
 	global $txt, $context, $scripturl, $user_info;
30 31
 
31 32
 	// You are already logged in, go take a tour of the boards
32
-	if (!empty($user_info['id']))
33
-		redirectexit();
33
+	if (!empty($user_info['id'])) {
34
+			redirectexit();
35
+	}
34 36
 
35 37
 	// We need to load the Login template/language file.
36 38
 	loadLanguage('Login');
@@ -57,10 +59,11 @@  discard block
 block discarded – undo
57 59
 	);
58 60
 
59 61
 	// Set the login URL - will be used when the login process is done (but careful not to send us to an attachment).
60
-	if (isset($_SESSION['old_url']) && strpos($_SESSION['old_url'], 'dlattach') === false && preg_match('~(board|topic)[=,]~', $_SESSION['old_url']) != 0)
61
-		$_SESSION['login_url'] = $_SESSION['old_url'];
62
-	elseif (isset($_SESSION['login_url']) && strpos($_SESSION['login_url'], 'dlattach') !== false)
63
-		unset($_SESSION['login_url']);
62
+	if (isset($_SESSION['old_url']) && strpos($_SESSION['old_url'], 'dlattach') === false && preg_match('~(board|topic)[=,]~', $_SESSION['old_url']) != 0) {
63
+			$_SESSION['login_url'] = $_SESSION['old_url'];
64
+	} elseif (isset($_SESSION['login_url']) && strpos($_SESSION['login_url'], 'dlattach') !== false) {
65
+			unset($_SESSION['login_url']);
66
+	}
64 67
 
65 68
 	// Create a one time token.
66 69
 	createToken('login');
@@ -92,8 +95,9 @@  discard block
 block discarded – undo
92 95
 	global $cookiename, $modSettings, $context, $sourcedir, $maintenance;
93 96
 
94 97
 	// Check to ensure we're forcing SSL for authentication
95
-	if (!empty($modSettings['force_ssl']) && empty($maintenance) && !httpsOn())
96
-		fatal_lang_error('login_ssl_required');
98
+	if (!empty($modSettings['force_ssl']) && empty($maintenance) && !httpsOn()) {
99
+			fatal_lang_error('login_ssl_required');
100
+	}
97 101
 
98 102
 	// Load cookie authentication stuff.
99 103
 	require_once($sourcedir . '/Subs-Auth.php');
@@ -107,23 +111,26 @@  discard block
 block discarded – undo
107 111
 	if (isset($_GET['sa']) && $_GET['sa'] == 'salt' && !$user_info['is_guest'])
108 112
 	{
109 113
 		// First check for 2.1 json-format cookie in $_COOKIE
110
-		if (isset($_COOKIE[$cookiename]) && preg_match('~^{"0":\d+,"1":"[0-9a-f]*","2":\d+~', $_COOKIE[$cookiename]) === 1)
111
-			list (,, $timeout) = $smcFunc['json_decode']($_COOKIE[$cookiename], true);
114
+		if (isset($_COOKIE[$cookiename]) && preg_match('~^{"0":\d+,"1":"[0-9a-f]*","2":\d+~', $_COOKIE[$cookiename]) === 1) {
115
+					list (,, $timeout) = $smcFunc['json_decode']($_COOKIE[$cookiename], true);
116
+		}
112 117
 
113 118
 		// Try checking for 2.1 json-format cookie in $_SESSION
114
-		elseif (isset($_SESSION['login_' . $cookiename]) && preg_match('~^{"0":\d+,"1":"[0-9a-f]*","2":\d+~', $_SESSION['login_' . $cookiename]) === 1)
115
-			list (,, $timeout) = $smcFunc['json_decode']($_SESSION['login_' . $cookiename]);
119
+		elseif (isset($_SESSION['login_' . $cookiename]) && preg_match('~^{"0":\d+,"1":"[0-9a-f]*","2":\d+~', $_SESSION['login_' . $cookiename]) === 1) {
120
+					list (,, $timeout) = $smcFunc['json_decode']($_SESSION['login_' . $cookiename]);
121
+		}
116 122
 
117 123
 		// Next, try checking for 2.0 serialized string cookie in $_COOKIE
118
-		elseif (isset($_COOKIE[$cookiename]) && preg_match('~^a:[34]:\{i:0;i:\d+;i:1;s:(0|128):"([a-fA-F0-9]{128})?";i:2;[id]:\d+;~', $_COOKIE[$cookiename]) === 1)
119
-			list (,, $timeout) = safe_unserialize($_COOKIE[$cookiename]);
124
+		elseif (isset($_COOKIE[$cookiename]) && preg_match('~^a:[34]:\{i:0;i:\d+;i:1;s:(0|128):"([a-fA-F0-9]{128})?";i:2;[id]:\d+;~', $_COOKIE[$cookiename]) === 1) {
125
+					list (,, $timeout) = safe_unserialize($_COOKIE[$cookiename]);
126
+		}
120 127
 
121 128
 		// Last, see if you need to fall back on checking for 2.0 serialized string cookie in $_SESSION
122
-		elseif (isset($_SESSION['login_' . $cookiename]) && preg_match('~^a:[34]:\{i:0;i:\d+;i:1;s:(0|128):"([a-fA-F0-9]{128})?";i:2;[id]:\d+;~', $_SESSION['login_' . $cookiename]) === 1)
123
-			list (,, $timeout) = safe_unserialize($_SESSION['login_' . $cookiename]);
124
-
125
-		else
126
-			trigger_error('Login2(): Cannot be logged in without a session or cookie', E_USER_ERROR);
129
+		elseif (isset($_SESSION['login_' . $cookiename]) && preg_match('~^a:[34]:\{i:0;i:\d+;i:1;s:(0|128):"([a-fA-F0-9]{128})?";i:2;[id]:\d+;~', $_SESSION['login_' . $cookiename]) === 1) {
130
+					list (,, $timeout) = safe_unserialize($_SESSION['login_' . $cookiename]);
131
+		} else {
132
+					trigger_error('Login2(): Cannot be logged in without a session or cookie', E_USER_ERROR);
133
+		}
127 134
 
128 135
 		$user_settings['password_salt'] = substr(md5(mt_rand()), 0, 4);
129 136
 		updateMemberData($user_info['id'], array('password_salt' => $user_settings['password_salt']));
@@ -143,24 +150,23 @@  discard block
 block discarded – undo
143 150
 	elseif (isset($_GET['sa']) && $_GET['sa'] == 'check')
144 151
 	{
145 152
 		// Strike!  You're outta there!
146
-		if ($_GET['member'] != $user_info['id'])
147
-			fatal_lang_error('login_cookie_error', false);
153
+		if ($_GET['member'] != $user_info['id']) {
154
+					fatal_lang_error('login_cookie_error', false);
155
+		}
148 156
 
149 157
 		$user_info['can_mod'] = allowedTo('access_mod_center') || (!$user_info['is_guest'] && ($user_info['mod_cache']['gq'] != '0=1' || $user_info['mod_cache']['bq'] != '0=1' || ($modSettings['postmod_active'] && !empty($user_info['mod_cache']['ap']))));
150 158
 
151 159
 		// Some whitelisting for login_url...
152
-		if (empty($_SESSION['login_url']))
153
-			redirectexit(empty($user_settings['tfa_secret']) ? '' : 'action=logintfa');
154
-		elseif (!empty($_SESSION['login_url']) && (strpos($_SESSION['login_url'], 'http://') === false && strpos($_SESSION['login_url'], 'https://') === false))
160
+		if (empty($_SESSION['login_url'])) {
161
+					redirectexit(empty($user_settings['tfa_secret']) ? '' : 'action=logintfa');
162
+		} elseif (!empty($_SESSION['login_url']) && (strpos($_SESSION['login_url'], 'http://') === false && strpos($_SESSION['login_url'], 'https://') === false))
155 163
 		{
156 164
 			unset ($_SESSION['login_url']);
157 165
 			redirectexit(empty($user_settings['tfa_secret']) ? '' : 'action=logintfa');
158
-		}
159
-		elseif (!empty($user_settings['tfa_secret']))
166
+		} elseif (!empty($user_settings['tfa_secret']))
160 167
 		{
161 168
 			redirectexit('action=logintfa');
162
-		}
163
-		else
169
+		} else
164 170
 		{
165 171
 			// Best not to clutter the session data too much...
166 172
 			$temp = $_SESSION['login_url'];
@@ -171,8 +177,9 @@  discard block
 block discarded – undo
171 177
 	}
172 178
 
173 179
 	// Beyond this point you are assumed to be a guest trying to login.
174
-	if (!$user_info['is_guest'])
175
-		redirectexit();
180
+	if (!$user_info['is_guest']) {
181
+			redirectexit();
182
+	}
176 183
 
177 184
 	// Are you guessing with a script?
178 185
 	checkSession();
@@ -180,18 +187,21 @@  discard block
 block discarded – undo
180 187
 	spamProtection('login');
181 188
 
182 189
 	// Set the login_url if it's not already set (but careful not to send us to an attachment).
183
-	if ((empty($_SESSION['login_url']) && isset($_SESSION['old_url']) && strpos($_SESSION['old_url'], 'dlattach') === false && preg_match('~(board|topic)[=,]~', $_SESSION['old_url']) != 0) || (isset($_GET['quicklogin']) && isset($_SESSION['old_url']) && strpos($_SESSION['old_url'], 'login') === false))
184
-		$_SESSION['login_url'] = $_SESSION['old_url'];
190
+	if ((empty($_SESSION['login_url']) && isset($_SESSION['old_url']) && strpos($_SESSION['old_url'], 'dlattach') === false && preg_match('~(board|topic)[=,]~', $_SESSION['old_url']) != 0) || (isset($_GET['quicklogin']) && isset($_SESSION['old_url']) && strpos($_SESSION['old_url'], 'login') === false)) {
191
+			$_SESSION['login_url'] = $_SESSION['old_url'];
192
+	}
185 193
 
186 194
 	// Been guessing a lot, haven't we?
187
-	if (isset($_SESSION['failed_login']) && $_SESSION['failed_login'] >= $modSettings['failed_login_threshold'] * 3)
188
-		fatal_lang_error('login_threshold_fail', 'login');
195
+	if (isset($_SESSION['failed_login']) && $_SESSION['failed_login'] >= $modSettings['failed_login_threshold'] * 3) {
196
+			fatal_lang_error('login_threshold_fail', 'login');
197
+	}
189 198
 
190 199
 	// Set up the cookie length.  (if it's invalid, just fall through and use the default.)
191
-	if (isset($_POST['cookieneverexp']) || (!empty($_POST['cookielength']) && $_POST['cookielength'] == -1))
192
-		$modSettings['cookieTime'] = 3153600;
193
-	elseif (!empty($_POST['cookielength']) && ($_POST['cookielength'] >= 1 && $_POST['cookielength'] <= 3153600))
194
-		$modSettings['cookieTime'] = (int) $_POST['cookielength'];
200
+	if (isset($_POST['cookieneverexp']) || (!empty($_POST['cookielength']) && $_POST['cookielength'] == -1)) {
201
+			$modSettings['cookieTime'] = 3153600;
202
+	} elseif (!empty($_POST['cookielength']) && ($_POST['cookielength'] >= 1 && $_POST['cookielength'] <= 3153600)) {
203
+			$modSettings['cookieTime'] = (int) $_POST['cookielength'];
204
+	}
195 205
 
196 206
 	// Login Cookie times. Format: time => txt
197 207
 	$context['login_cookie_times'] = array(
@@ -320,8 +330,9 @@  discard block
 block discarded – undo
320 330
 			$other_passwords[] = crypt(md5($_POST['passwrd']), md5($_POST['passwrd']));
321 331
 
322 332
 			// Snitz style - SHA-256.  Technically, this is a downgrade, but most PHP configurations don't support sha256 anyway.
323
-			if (strlen($user_settings['passwd']) == 64 && function_exists('mhash') && defined('MHASH_SHA256'))
324
-				$other_passwords[] = bin2hex(mhash(MHASH_SHA256, $_POST['passwrd']));
333
+			if (strlen($user_settings['passwd']) == 64 && function_exists('mhash') && defined('MHASH_SHA256')) {
334
+							$other_passwords[] = bin2hex(mhash(MHASH_SHA256, $_POST['passwrd']));
335
+			}
325 336
 
326 337
 			// phpBB3 users new hashing.  We now support it as well ;).
327 338
 			$other_passwords[] = phpBB3_password_check($_POST['passwrd'], $user_settings['passwd']);
@@ -341,27 +352,29 @@  discard block
 block discarded – undo
341 352
 			// Some common md5 ones.
342 353
 			$other_passwords[] = md5($user_settings['password_salt'] . $_POST['passwrd']);
343 354
 			$other_passwords[] = md5($_POST['passwrd'] . $user_settings['password_salt']);
344
-		}
345
-		elseif (strlen($user_settings['passwd']) == 40)
355
+		} elseif (strlen($user_settings['passwd']) == 40)
346 356
 		{
347 357
 			// Maybe they are using a hash from before the password fix.
348 358
 			// This is also valid for SMF 1.1 to 2.0 style of hashing, changed to bcrypt in SMF 2.1
349 359
 			$other_passwords[] = sha1(strtolower($user_settings['member_name']) . un_htmlspecialchars($_POST['passwrd']));
350 360
 
351 361
 			// BurningBoard3 style of hashing.
352
-			if (!empty($modSettings['enable_password_conversion']))
353
-				$other_passwords[] = sha1($user_settings['password_salt'] . sha1($user_settings['password_salt'] . sha1($_POST['passwrd'])));
362
+			if (!empty($modSettings['enable_password_conversion'])) {
363
+							$other_passwords[] = sha1($user_settings['password_salt'] . sha1($user_settings['password_salt'] . sha1($_POST['passwrd'])));
364
+			}
354 365
 
355 366
 			// Perhaps we converted to UTF-8 and have a valid password being hashed differently.
356 367
 			if ($context['character_set'] == 'UTF-8' && !empty($modSettings['previousCharacterSet']) && $modSettings['previousCharacterSet'] != 'utf8')
357 368
 			{
358 369
 				// Try iconv first, for no particular reason.
359
-				if (function_exists('iconv'))
360
-					$other_passwords['iconv'] = sha1(strtolower(iconv('UTF-8', $modSettings['previousCharacterSet'], $user_settings['member_name'])) . un_htmlspecialchars(iconv('UTF-8', $modSettings['previousCharacterSet'], $_POST['passwrd'])));
370
+				if (function_exists('iconv')) {
371
+									$other_passwords['iconv'] = sha1(strtolower(iconv('UTF-8', $modSettings['previousCharacterSet'], $user_settings['member_name'])) . un_htmlspecialchars(iconv('UTF-8', $modSettings['previousCharacterSet'], $_POST['passwrd'])));
372
+				}
361 373
 
362 374
 				// Say it aint so, iconv failed!
363
-				if (empty($other_passwords['iconv']) && function_exists('mb_convert_encoding'))
364
-					$other_passwords[] = sha1(strtolower(mb_convert_encoding($user_settings['member_name'], 'UTF-8', $modSettings['previousCharacterSet'])) . un_htmlspecialchars(mb_convert_encoding($_POST['passwrd'], 'UTF-8', $modSettings['previousCharacterSet'])));
375
+				if (empty($other_passwords['iconv']) && function_exists('mb_convert_encoding')) {
376
+									$other_passwords[] = sha1(strtolower(mb_convert_encoding($user_settings['member_name'], 'UTF-8', $modSettings['previousCharacterSet'])) . un_htmlspecialchars(mb_convert_encoding($_POST['passwrd'], 'UTF-8', $modSettings['previousCharacterSet'])));
377
+				}
365 378
 			}
366 379
 		}
367 380
 
@@ -391,8 +404,9 @@  discard block
 block discarded – undo
391 404
 			$_SESSION['failed_login'] = isset($_SESSION['failed_login']) ? ($_SESSION['failed_login'] + 1) : 1;
392 405
 
393 406
 			// Hmm... don't remember it, do you?  Here, try the password reminder ;).
394
-			if ($_SESSION['failed_login'] >= $modSettings['failed_login_threshold'])
395
-				redirectexit('action=reminder');
407
+			if ($_SESSION['failed_login'] >= $modSettings['failed_login_threshold']) {
408
+							redirectexit('action=reminder');
409
+			}
396 410
 			// We'll give you another chance...
397 411
 			else
398 412
 			{
@@ -403,8 +417,7 @@  discard block
 block discarded – undo
403 417
 				return;
404 418
 			}
405 419
 		}
406
-	}
407
-	elseif (!empty($user_settings['passwd_flood']))
420
+	} elseif (!empty($user_settings['passwd_flood']))
408 421
 	{
409 422
 		// Let's be sure they weren't a little hacker.
410 423
 		validatePasswordFlood($user_settings['id_member'], $user_settings['member_name'], $user_settings['passwd_flood'], true);
@@ -421,8 +434,9 @@  discard block
 block discarded – undo
421 434
 	}
422 435
 
423 436
 	// Check their activation status.
424
-	if (!checkActivation())
425
-		return;
437
+	if (!checkActivation()) {
438
+			return;
439
+	}
426 440
 
427 441
 	DoLogin();
428 442
 }
@@ -434,8 +448,9 @@  discard block
 block discarded – undo
434 448
 {
435 449
 	global $sourcedir, $txt, $context, $user_info, $modSettings, $scripturl;
436 450
 
437
-	if (!$user_info['is_guest'] || empty($context['tfa_member']) || empty($modSettings['tfa_mode']))
438
-		fatal_lang_error('no_access', false);
451
+	if (!$user_info['is_guest'] || empty($context['tfa_member']) || empty($modSettings['tfa_mode'])) {
452
+			fatal_lang_error('no_access', false);
453
+	}
439 454
 
440 455
 	loadLanguage('Profile');
441 456
 	require_once($sourcedir . '/Class-TOTP.php');
@@ -443,8 +458,9 @@  discard block
 block discarded – undo
443 458
 	$member = $context['tfa_member'];
444 459
 
445 460
 	// Prevent replay attacks by limiting at least 2 minutes before they can log in again via 2FA
446
-	if (time() - $member['last_login'] < 120)
447
-		fatal_lang_error('tfa_wait', false);
461
+	if (time() - $member['last_login'] < 120) {
462
+			fatal_lang_error('tfa_wait', false);
463
+	}
448 464
 
449 465
 	$totp = new \TOTP\Auth($member['tfa_secret']);
450 466
 	$totp->setRange(1);
@@ -458,8 +474,9 @@  discard block
 block discarded – undo
458 474
 	if (!empty($_POST['tfa_code']) && empty($_POST['tfa_backup']))
459 475
 	{
460 476
 		// Check to ensure we're forcing SSL for authentication
461
-		if (!empty($modSettings['force_ssl']) && empty($maintenance) && !httpsOn())
462
-			fatal_lang_error('login_ssl_required');
477
+		if (!empty($modSettings['force_ssl']) && empty($maintenance) && !httpsOn()) {
478
+					fatal_lang_error('login_ssl_required');
479
+		}
463 480
 
464 481
 		$code = $_POST['tfa_code'];
465 482
 
@@ -469,20 +486,19 @@  discard block
 block discarded – undo
469 486
 
470 487
 			setTFACookie(3153600, $member['id_member'], hash_salt($member['tfa_backup'], $member['password_salt']));
471 488
 			redirectexit();
472
-		}
473
-		else
489
+		} else
474 490
 		{
475 491
 			validatePasswordFlood($member['id_member'], $member['member_name'], $member['passwd_flood'], false, true);
476 492
 
477 493
 			$context['tfa_error'] = true;
478 494
 			$context['tfa_value'] = $_POST['tfa_code'];
479 495
 		}
480
-	}
481
-	elseif (!empty($_POST['tfa_backup']))
496
+	} elseif (!empty($_POST['tfa_backup']))
482 497
 	{
483 498
 		// Check to ensure we're forcing SSL for authentication
484
-		if (!empty($modSettings['force_ssl']) && empty($maintenance) && !httpsOn())
485
-			fatal_lang_error('login_ssl_required');
499
+		if (!empty($modSettings['force_ssl']) && empty($maintenance) && !httpsOn()) {
500
+					fatal_lang_error('login_ssl_required');
501
+		}
486 502
 
487 503
 		$backup = $_POST['tfa_backup'];
488 504
 
@@ -496,8 +512,7 @@  discard block
 block discarded – undo
496 512
 			));
497 513
 			setTFACookie(3153600, $member['id_member'], hash_salt($member['tfa_backup'], $member['password_salt']));
498 514
 			redirectexit('action=profile;area=tfasetup;backup');
499
-		}
500
-		else
515
+		} else
501 516
 		{
502 517
 			validatePasswordFlood($member['id_member'], $member['member_name'], $member['passwd_flood'], false, true);
503 518
 
@@ -520,8 +535,9 @@  discard block
 block discarded – undo
520 535
 {
521 536
 	global $context, $txt, $scripturl, $user_settings, $modSettings;
522 537
 
523
-	if (!isset($context['login_errors']))
524
-		$context['login_errors'] = array();
538
+	if (!isset($context['login_errors'])) {
539
+			$context['login_errors'] = array();
540
+	}
525 541
 
526 542
 	// What is the true activation status of this account?
527 543
 	$activation_status = $user_settings['is_activated'] > 10 ? $user_settings['is_activated'] - 10 : $user_settings['is_activated'];
@@ -533,8 +549,9 @@  discard block
 block discarded – undo
533 549
 		return false;
534 550
 	}
535 551
 	// Awaiting approval still?
536
-	elseif ($activation_status == 3)
537
-		fatal_lang_error('still_awaiting_approval', 'user');
552
+	elseif ($activation_status == 3) {
553
+			fatal_lang_error('still_awaiting_approval', 'user');
554
+	}
538 555
 	// Awaiting deletion, changed their mind?
539 556
 	elseif ($activation_status == 4)
540 557
 	{
@@ -542,8 +559,7 @@  discard block
 block discarded – undo
542 559
 		{
543 560
 			updateMemberData($user_settings['id_member'], array('is_activated' => 1));
544 561
 			updateSettings(array('unapprovedMembers' => ($modSettings['unapprovedMembers'] > 0 ? $modSettings['unapprovedMembers'] - 1 : 0)));
545
-		}
546
-		else
562
+		} else
547 563
 		{
548 564
 			$context['disable_login_hashing'] = true;
549 565
 			$context['login_errors'][] = $txt['awaiting_delete_account'];
@@ -583,8 +599,9 @@  discard block
 block discarded – undo
583 599
 	setLoginCookie(60 * $modSettings['cookieTime'], $user_settings['id_member'], hash_salt($user_settings['passwd'], $user_settings['password_salt']));
584 600
 
585 601
 	// Reset the login threshold.
586
-	if (isset($_SESSION['failed_login']))
587
-		unset($_SESSION['failed_login']);
602
+	if (isset($_SESSION['failed_login'])) {
603
+			unset($_SESSION['failed_login']);
604
+	}
588 605
 
589 606
 	$user_info['is_guest'] = false;
590 607
 	$user_settings['additional_groups'] = explode(',', $user_settings['additional_groups']);
@@ -606,16 +623,18 @@  discard block
 block discarded – undo
606 623
 			'id_member' => $user_info['id'],
607 624
 		)
608 625
 	);
609
-	if ($smcFunc['db_num_rows']($request) == 1)
610
-		$_SESSION['first_login'] = true;
611
-	else
612
-		unset($_SESSION['first_login']);
626
+	if ($smcFunc['db_num_rows']($request) == 1) {
627
+			$_SESSION['first_login'] = true;
628
+	} else {
629
+			unset($_SESSION['first_login']);
630
+	}
613 631
 	$smcFunc['db_free_result']($request);
614 632
 
615 633
 	// You've logged in, haven't you?
616 634
 	$update = array('member_ip' => $user_info['ip'], 'member_ip2' => $_SERVER['BAN_CHECK_IP']);
617
-	if (empty($user_settings['tfa_secret']))
618
-		$update['last_login'] = time();
635
+	if (empty($user_settings['tfa_secret'])) {
636
+			$update['last_login'] = time();
637
+	}
619 638
 	updateMemberData($user_info['id'], $update);
620 639
 
621 640
 	// Get rid of the online entry for that old guest....
@@ -629,8 +648,8 @@  discard block
 block discarded – undo
629 648
 	$_SESSION['log_time'] = 0;
630 649
 
631 650
 	// Log this entry, only if we have it enabled.
632
-	if (!empty($modSettings['loginHistoryDays']))
633
-		$smcFunc['db_insert']('insert',
651
+	if (!empty($modSettings['loginHistoryDays'])) {
652
+			$smcFunc['db_insert']('insert',
634 653
 			'{db_prefix}member_logins',
635 654
 			array(
636 655
 				'id_member' => 'int', 'time' => 'int', 'ip' => 'inet', 'ip2' => 'inet',
@@ -642,13 +661,15 @@  discard block
 block discarded – undo
642 661
 				'id_member', 'time'
643 662
 			)
644 663
 		);
664
+	}
645 665
 
646 666
 	// Just log you back out if it's in maintenance mode and you AREN'T an admin.
647
-	if (empty($maintenance) || allowedTo('admin_forum'))
648
-		redirectexit('action=login2;sa=check;member=' . $user_info['id'], $context['server']['needs_login_fix']);
649
-	else
650
-		redirectexit('action=logout;' . $context['session_var'] . '=' . $context['session_id'], $context['server']['needs_login_fix']);
651
-}
667
+	if (empty($maintenance) || allowedTo('admin_forum')) {
668
+			redirectexit('action=login2;sa=check;member=' . $user_info['id'], $context['server']['needs_login_fix']);
669
+	} else {
670
+			redirectexit('action=logout;' . $context['session_var'] . '=' . $context['session_id'], $context['server']['needs_login_fix']);
671
+	}
672
+	}
652 673
 
653 674
 /**
654 675
  * Logs the current user out of their account.
@@ -664,13 +685,15 @@  discard block
 block discarded – undo
664 685
 	global $sourcedir, $user_info, $user_settings, $context, $smcFunc, $cookiename, $modSettings;
665 686
 
666 687
 	// Make sure they aren't being auto-logged out.
667
-	if (!$internal)
668
-		checkSession('get');
688
+	if (!$internal) {
689
+			checkSession('get');
690
+	}
669 691
 
670 692
 	require_once($sourcedir . '/Subs-Auth.php');
671 693
 
672
-	if (isset($_SESSION['pack_ftp']))
673
-		$_SESSION['pack_ftp'] = null;
694
+	if (isset($_SESSION['pack_ftp'])) {
695
+			$_SESSION['pack_ftp'] = null;
696
+	}
674 697
 
675 698
 	// It won't be first login anymore.
676 699
 	unset($_SESSION['first_login']);
@@ -698,8 +721,9 @@  discard block
 block discarded – undo
698 721
 
699 722
 	// And some other housekeeping while we're at it.
700 723
 	$salt = substr(md5(mt_rand()), 0, 4);
701
-	if (!empty($user_info['id']))
702
-		updateMemberData($user_info['id'], array('password_salt' => $salt));
724
+	if (!empty($user_info['id'])) {
725
+			updateMemberData($user_info['id'], array('password_salt' => $salt));
726
+	}
703 727
 
704 728
 	if (!empty($modSettings['tfa_mode']) && !empty($user_info['id']) && !empty($_COOKIE[$cookiename . '_tfa']))
705 729
 	{
@@ -712,14 +736,13 @@  discard block
 block discarded – undo
712 736
 	// Off to the merry board index we go!
713 737
 	if ($redirect)
714 738
 	{
715
-		if (empty($_SESSION['logout_url']))
716
-			redirectexit('', $context['server']['needs_login_fix']);
717
-		elseif (!empty($_SESSION['logout_url']) && (strpos($_SESSION['logout_url'], 'http://') === false && strpos($_SESSION['logout_url'], 'https://') === false))
739
+		if (empty($_SESSION['logout_url'])) {
740
+					redirectexit('', $context['server']['needs_login_fix']);
741
+		} elseif (!empty($_SESSION['logout_url']) && (strpos($_SESSION['logout_url'], 'http://') === false && strpos($_SESSION['logout_url'], 'https://') === false))
718 742
 		{
719 743
 			unset ($_SESSION['logout_url']);
720 744
 			redirectexit();
721
-		}
722
-		else
745
+		} else
723 746
 		{
724 747
 			$temp = $_SESSION['logout_url'];
725 748
 			unset($_SESSION['logout_url']);
@@ -752,8 +775,9 @@  discard block
 block discarded – undo
752 775
 function phpBB3_password_check($passwd, $passwd_hash)
753 776
 {
754 777
 	// Too long or too short?
755
-	if (strlen($passwd_hash) != 34)
756
-		return;
778
+	if (strlen($passwd_hash) != 34) {
779
+			return;
780
+	}
757 781
 
758 782
 	// Range of characters allowed.
759 783
 	$range = './0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
@@ -764,8 +788,9 @@  discard block
 block discarded – undo
764 788
 	$salt = substr($passwd_hash, 4, 8);
765 789
 
766 790
 	$hash = md5($salt . $passwd, true);
767
-	for (; $count != 0; --$count)
768
-		$hash = md5($hash . $passwd, true);
791
+	for (; $count != 0; --$count) {
792
+			$hash = md5($hash . $passwd, true);
793
+	}
769 794
 
770 795
 	$output = substr($passwd_hash, 0, 12);
771 796
 	$i = 0;
@@ -774,21 +799,25 @@  discard block
 block discarded – undo
774 799
 		$value = ord($hash[$i++]);
775 800
 		$output .= $range[$value & 0x3f];
776 801
 
777
-		if ($i < 16)
778
-			$value |= ord($hash[$i]) << 8;
802
+		if ($i < 16) {
803
+					$value |= ord($hash[$i]) << 8;
804
+		}
779 805
 
780 806
 		$output .= $range[($value >> 6) & 0x3f];
781 807
 
782
-		if ($i++ >= 16)
783
-			break;
808
+		if ($i++ >= 16) {
809
+					break;
810
+		}
784 811
 
785
-		if ($i < 16)
786
-			$value |= ord($hash[$i]) << 16;
812
+		if ($i < 16) {
813
+					$value |= ord($hash[$i]) << 16;
814
+		}
787 815
 
788 816
 		$output .= $range[($value >> 12) & 0x3f];
789 817
 
790
-		if ($i++ >= 16)
791
-			break;
818
+		if ($i++ >= 16) {
819
+					break;
820
+		}
792 821
 
793 822
 		$output .= $range[($value >> 18) & 0x3f];
794 823
 	}
@@ -820,8 +849,9 @@  discard block
 block discarded – undo
820 849
 		require_once($sourcedir . '/Subs-Auth.php');
821 850
 		setLoginCookie(-3600, 0);
822 851
 
823
-		if (isset($_SESSION['login_' . $cookiename]))
824
-			unset($_SESSION['login_' . $cookiename]);
852
+		if (isset($_SESSION['login_' . $cookiename])) {
853
+					unset($_SESSION['login_' . $cookiename]);
854
+		}
825 855
 	}
826 856
 
827 857
 	// We need a member!
@@ -835,8 +865,9 @@  discard block
 block discarded – undo
835 865
 	}
836 866
 
837 867
 	// Right, have we got a flood value?
838
-	if ($password_flood_value !== false)
839
-		@list ($time_stamp, $number_tries) = explode('|', $password_flood_value);
868
+	if ($password_flood_value !== false) {
869
+			@list ($time_stamp, $number_tries) = explode('|', $password_flood_value);
870
+	}
840 871
 
841 872
 	// Timestamp or number of tries invalid?
842 873
 	if (empty($number_tries) || empty($time_stamp))
@@ -852,15 +883,17 @@  discard block
 block discarded – undo
852 883
 		$number_tries = $time_stamp < time() - 20 ? 2 : $number_tries;
853 884
 
854 885
 		// They are trying too fast, make them wait longer
855
-		if ($time_stamp < time() - 10)
856
-			$time_stamp = time();
886
+		if ($time_stamp < time() - 10) {
887
+					$time_stamp = time();
888
+		}
857 889
 	}
858 890
 
859 891
 	$number_tries++;
860 892
 
861 893
 	// Broken the law?
862
-	if ($number_tries > 5)
863
-		fatal_lang_error('login_threshold_brute_fail', 'login', [$member_name]);
894
+	if ($number_tries > 5) {
895
+			fatal_lang_error('login_threshold_brute_fail', 'login', [$member_name]);
896
+	}
864 897
 
865 898
 	// Otherwise set the members data. If they correct on their first attempt then we actually clear it, otherwise we set it!
866 899
 	updateMemberData($id_member, array('passwd_flood' => $was_correct && $number_tries == 1 ? '' : $time_stamp . '|' . $number_tries));
Please login to merge, or discard this patch.