Completed
Pull Request — release-2.1 (#4272)
by Mert
08:21
created
Themes/default/ManagePaid.template.php 1 patch
Braces   +61 added lines, -44 removed lines patch added patch discarded remove patch
@@ -24,11 +24,12 @@  discard block
 block discarded – undo
24 24
 				<h3 class="catbg">', $txt['paid_' . $context['action_type'] . '_subscription'], '</h3>
25 25
 			</div>';
26 26
 
27
-	if (!empty($context['disable_groups']))
28
-		echo '
27
+	if (!empty($context['disable_groups'])) {
28
+			echo '
29 29
 			<div class="information">
30 30
 				<span class="alert">', $txt['paid_mod_edit_note'], '</span>
31 31
 			</div>';
32
+	}
32 33
 
33 34
 	echo '
34 35
 			<div class="windowbg2">
@@ -68,9 +69,10 @@  discard block
 block discarded – undo
68 69
 							<option value="0"', $context['sub']['prim_group'] == 0 ? ' selected' : '', '>', $txt['paid_mod_no_group'], '</option>';
69 70
 
70 71
 	// Put each group into the box.
71
-	foreach ($context['groups'] as $id => $name)
72
-		echo '
72
+	foreach ($context['groups'] as $id => $name) {
73
+			echo '
73 74
 							<option value="', $id, '"', $context['sub']['prim_group'] == $id ? ' selected' : '', '>', $name, '</option>';
75
+	}
74 76
 
75 77
 	echo '
76 78
 						</select>
@@ -81,9 +83,10 @@  discard block
 block discarded – undo
81 83
 					<dd>';
82 84
 
83 85
 	// Put a checkbox in for each group
84
-	foreach ($context['groups'] as $id => $name)
85
-		echo '
86
+	foreach ($context['groups'] as $id => $name) {
87
+			echo '
86 88
 						<label for="addgroup_', $id, '"><input type="checkbox" id="addgroup_', $id, '" name="addgroup[', $id, ']"', in_array($id, $context['sub']['add_groups']) ? ' checked' : '', !empty($context['disable_groups']) ? ' disabled' : '', '>&nbsp;<span class="smalltext">', $name, '</span></label><br>';
89
+	}
87 90
 
88 91
 	echo '
89 92
 					</dd>
@@ -135,8 +138,8 @@  discard block
 block discarded – undo
135 138
 					<fieldset>';
136 139
 
137 140
 	//!! Removed until implemented
138
-	if (!empty($sdflsdhglsdjgs))
139
-		echo '
141
+	if (!empty($sdflsdhglsdjgs)) {
142
+			echo '
140 143
 						<dl class="settings">
141 144
 							<dt>
142 145
 								<label for="allow_partial_check">', $txt['paid_mod_allow_partial'], '</label>:<br><span class="smalltext">', $txt['paid_mod_allow_partial_desc'], '</span>
@@ -145,6 +148,7 @@  discard block
 block discarded – undo
145 148
 								<input type="checkbox" name="allow_partial" id="allow_partial_check"', empty($context['sub']['allow_partial']) ? '' : ' checked', '>
146 149
 							</dd>
147 150
 						</dl>';
151
+	}
148 152
 
149 153
 	echo '
150 154
 						<div class="information">
@@ -245,8 +249,8 @@  discard block
 block discarded – undo
245 249
 				<dl class="settings">';
246 250
 
247 251
 	// Do we need a username?
248
-	if ($context['action_type'] == 'add')
249
-		echo '
252
+	if ($context['action_type'] == 'add') {
253
+			echo '
250 254
 
251 255
 					<dt>
252 256
 						<strong>', $txt['paid_username'], ':</strong><br>
@@ -255,6 +259,7 @@  discard block
 block discarded – undo
255 259
 					<dd>
256 260
 						<input type="text" name="name" id="name_control" value="', $context['sub']['username'], '" size="30">
257 261
 					</dd>';
262
+	}
258 263
 
259 264
 	echo '
260 265
 					<dt>
@@ -272,9 +277,10 @@  discard block
 block discarded – undo
272 277
 					<select name="year" id="year" onchange="generateDays();">';
273 278
 
274 279
 	// Show a list of all the years we allow...
275
-	for ($year = 2005; $year <= 2030; $year++)
276
-		echo '
280
+	for ($year = 2005; $year <= 2030; $year++) {
281
+			echo '
277 282
 						<option value="', $year, '"', $year == $context['sub']['start']['year'] ? ' selected' : '', '>', $year, '</option>';
283
+	}
278 284
 
279 285
 	echo '
280 286
 					</select>&nbsp;
@@ -282,9 +288,10 @@  discard block
 block discarded – undo
282 288
 					<select name="month" id="month" onchange="generateDays();">';
283 289
 
284 290
 	// There are 12 months per year - ensure that they all get listed.
285
-	for ($month = 1; $month <= 12; $month++)
286
-		echo '
291
+	for ($month = 1; $month <= 12; $month++) {
292
+			echo '
287 293
 						<option value="', $month, '"', $month == $context['sub']['start']['month'] ? ' selected' : '', '>', $txt['months'][$month], '</option>';
294
+	}
288 295
 
289 296
 	echo '
290 297
 					</select>&nbsp;
@@ -292,9 +299,10 @@  discard block
 block discarded – undo
292 299
 					<select name="day" id="day">';
293 300
 
294 301
 	// This prints out all the days in the current month - this changes dynamically as we switch months.
295
-	for ($day = 1; $day <= $context['sub']['start']['last_day']; $day++)
296
-		echo '
302
+	for ($day = 1; $day <= $context['sub']['start']['last_day']; $day++) {
303
+			echo '
297 304
 						<option value="', $day, '"', $day == $context['sub']['start']['day'] ? ' selected' : '', '>', $day, '</option>';
305
+	}
298 306
 
299 307
 	echo '
300 308
 					</select>
@@ -306,9 +314,10 @@  discard block
 block discarded – undo
306 314
 					<select name="yearend" id="yearend" onchange="generateDays(\'end\');">';
307 315
 
308 316
 	// Show a list of all the years we allow...
309
-	for ($year = 2005; $year <= 2030; $year++)
310
-		echo '
317
+	for ($year = 2005; $year <= 2030; $year++) {
318
+			echo '
311 319
 						<option value="', $year, '"', $year == $context['sub']['end']['year'] ? ' selected' : '', '>', $year, '</option>';
320
+	}
312 321
 
313 322
 	echo '
314 323
 					</select>&nbsp;
@@ -316,9 +325,10 @@  discard block
 block discarded – undo
316 325
 					<select name="monthend" id="monthend" onchange="generateDays(\'end\');">';
317 326
 
318 327
 	// There are 12 months per year - ensure that they all get listed.
319
-	for ($month = 1; $month <= 12; $month++)
320
-		echo '
328
+	for ($month = 1; $month <= 12; $month++) {
329
+			echo '
321 330
 						<option value="', $month, '"', $month == $context['sub']['end']['month'] ? ' selected' : '', '>', $txt['months'][$month], '</option>';
331
+	}
322 332
 
323 333
 	echo '
324 334
 					</select>&nbsp;
@@ -326,9 +336,10 @@  discard block
 block discarded – undo
326 336
 					<select name="dayend" id="dayend">';
327 337
 
328 338
 	// This prints out all the days in the current month - this changes dynamically as we switch months.
329
-	for ($day = 1; $day <= $context['sub']['end']['last_day']; $day++)
330
-		echo '
339
+	for ($day = 1; $day <= $context['sub']['end']['last_day']; $day++) {
340
+			echo '
331 341
 						<option value="', $day, '"', $day == $context['sub']['end']['day'] ? ' selected' : '', '>', $day, '</option>';
342
+	}
332 343
 
333 344
 	echo '
334 345
 					</select>
@@ -410,8 +421,7 @@  discard block
 block discarded – undo
410 421
 			<div class="information">
411 422
 				', $txt['paid_subs_none'], '
412 423
 			</div>';
413
-	}
414
-	else
424
+	} else
415 425
 	{
416 426
 		echo '
417 427
 			<div class="information">
@@ -423,8 +433,9 @@  discard block
 block discarded – undo
423 433
 		{
424 434
 
425 435
 			// Ignore the inactive ones...
426
-			if (empty($subscription['active']))
427
-				continue;
436
+			if (empty($subscription['active'])) {
437
+							continue;
438
+			}
428 439
 
429 440
 			echo '
430 441
 			<div class="cat_bar">
@@ -434,9 +445,10 @@  discard block
 block discarded – undo
434 445
 				<p><strong>', $subscription['name'], '</strong></p>
435 446
 				<p class="smalltext">', $subscription['desc'], '</p>';
436 447
 
437
-			if (!$subscription['flexible'])
438
-				echo '
448
+			if (!$subscription['flexible']) {
449
+							echo '
439 450
 					<div><strong>', $txt['paid_duration'], ':</strong> ', $subscription['length'], '</div>';
451
+			}
440 452
 
441 453
 			if ($context['user']['is_owner'])
442 454
 			{
@@ -449,24 +461,25 @@  discard block
 block discarded – undo
449 461
 					<select name="cur[', $subscription['id'], ']">';
450 462
 
451 463
 					// Print out the costs for this one.
452
-					foreach ($subscription['costs'] as $duration => $value)
453
-						echo '
464
+					foreach ($subscription['costs'] as $duration => $value) {
465
+											echo '
454 466
 						<option value="', $duration, '">', sprintf($modSettings['paid_currency_symbol'], $value), '/', $txt[$duration], '</option>';
467
+					}
455 468
 
456 469
 					echo '
457 470
 					</select>';
458
-				}
459
-				else
460
-					echo '
471
+				} else {
472
+									echo '
461 473
 					', sprintf($modSettings['paid_currency_symbol'], $subscription['costs']['fixed']);
474
+				}
462 475
 
463 476
 				echo '
464 477
 					<hr>
465 478
 					<input type="submit" name="sub_id[', $subscription['id'], ']" value="', $txt['paid_order'], '" class="button">';
466
-			}
467
-			else
468
-				echo '
479
+			} else {
480
+							echo '
469 481
 					<a href="', $scripturl, '?action=admin;area=paidsubscribe;sa=modifyuser;sid=', $subscription['id'], ';uid=', $context['member']['id'], (empty($context['current'][$subscription['id']]) ? '' : ';lid=' . $context['current'][$subscription['id']]['id']), '">', empty($context['current'][$subscription['id']]) ? $txt['paid_admin_add'] : $txt['paid_edit_subscription'], '</a>';
482
+			}
470 483
 
471 484
 			echo '
472 485
 			</div>';
@@ -493,19 +506,20 @@  discard block
 block discarded – undo
493 506
 			</thead>
494 507
 			<tbody>';
495 508
 
496
-	if (empty($context['current']))
497
-		echo '
509
+	if (empty($context['current'])) {
510
+			echo '
498 511
 				<tr class="windowbg">
499 512
 					<td colspan="4">
500 513
 						', $txt['paid_none_yet'], '
501 514
 					</td>
502 515
 				</tr>';
516
+	}
503 517
 
504 518
 	foreach ($context['current'] as $sub)
505 519
 	{
506 520
 
507
-		if (!$sub['hide'])
508
-			echo '
521
+		if (!$sub['hide']) {
522
+					echo '
509 523
 				<tr class="windowbg">
510 524
 					<td>
511 525
 						', (allowedTo('admin_forum') ? '<a href="' . $scripturl . '?action=admin;area=paidsubscribe;sa=modifyuser;lid=' . $sub['id'] . '">' . $sub['name'] . '</a>' : $sub['name']), '
@@ -517,6 +531,7 @@  discard block
 block discarded – undo
517 531
 						', $sub['end'], '
518 532
 					</td>
519 533
 				</tr>';
534
+		}
520 535
 	}
521 536
 	echo '
522 537
 			</tbody>
@@ -567,15 +582,17 @@  discard block
 block discarded – undo
567 582
 			', $gateway['desc'], '<br>
568 583
 				<form action="', $gateway['form'], '" method="post">';
569 584
 
570
-		if (!empty($gateway['javascript']))
571
-			echo '
585
+		if (!empty($gateway['javascript'])) {
586
+					echo '
572 587
 					<script>
573 588
 						', $gateway['javascript'], '
574 589
 					</script>';
590
+		}
575 591
 
576
-		foreach ($gateway['hidden'] as $name => $value)
577
-			echo '
592
+		foreach ($gateway['hidden'] as $name => $value) {
593
+					echo '
578 594
 					<input type="hidden" id="', $gateway['id'], '_', $name, '" name="', $name, '" value="', $value, '">';
595
+		}
579 596
 
580 597
 		echo '
581 598
 					<br><input type="submit" value="', $gateway['submit'], '" class="button">
Please login to merge, or discard this patch.
Themes/default/Login.template.php 1 patch
Braces   +35 added lines, -24 removed lines patch added patch discarded remove patch
@@ -28,14 +28,16 @@  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><br>';
34
+	}
34 35
 
35 36
 	// Or perhaps there's some special description for this time?
36
-	if (isset($context['description']))
37
-		echo '
37
+	if (isset($context['description'])) {
38
+			echo '
38 39
 					<div class="information">', $context['description'], '</div>';
40
+	}
39 41
 
40 42
 	// Now just get the basic information - username, password, etc.
41 43
 	echo '
@@ -51,10 +53,11 @@  discard block
 block discarded – undo
51 53
 						<dt>', $txt['always_logged_in'], ':</dt>
52 54
 						<dd><input type="checkbox" name="cookieneverexp"', $context['never_expire'] ? ' checked' : '', ' onclick="this.form.cookielength.disabled = this.checked;"></dd>';
53 55
 	// If they have deleted their account, give them a chance to change their mind.
54
-	if (isset($context['login_show_undelete']))
55
-		echo '
56
+	if (isset($context['login_show_undelete'])) {
57
+			echo '
56 58
 						<dt class="alert">', $txt['undelete_account'], ':</dt>
57 59
 						<dd><input type="checkbox" name="undelete"></dd>';
60
+	}
58 61
 	echo '
59 62
 					</dl>
60 63
 					<p><input type="submit" value="', $txt['login'], '" class="button"></p>
@@ -66,8 +69,8 @@  discard block
 block discarded – undo
66 69
 						setTimeout(function() {
67 70
 							document.getElementById("', !empty($context['from_ajax']) ? 'ajax_' : '', isset($context['default_username']) && $context['default_username'] != '' ? 'loginpass' : 'loginuser', '").focus();
68 71
 						}, 150);';
69
-	if (!empty($context['from_ajax']) && (empty($modSettings['force_ssl']) || $modSettings['force_ssl'] == 2))
70
-		echo '
72
+	if (!empty($context['from_ajax']) && (empty($modSettings['force_ssl']) || $modSettings['force_ssl'] == 2)) {
73
+			echo '
71 74
 						form = $("#frmLogin");
72 75
 						form.submit(function(e) {
73 76
 							e.preventDefault();
@@ -100,16 +103,18 @@  discard block
 block discarded – undo
100 103
 
101 104
 							return false;
102 105
 						});';
106
+	}
103 107
 
104 108
 	echo '
105 109
 					</script>
106 110
 				</form>';
107 111
 
108 112
 	// It is a long story as to why we have this when we're clearly not going to use it.
109
-	if (!empty($context['from_ajax']))
110
-		echo '
113
+	if (!empty($context['from_ajax'])) {
114
+			echo '
111 115
 					<br>
112 116
 					<a href="javascript:self.close();"></a>';
117
+	}
113 118
 	echo '
114 119
 			</div>
115 120
 		</div>';
@@ -130,9 +135,10 @@  discard block
 block discarded – undo
130 135
 				</h3>
131 136
 			</div>
132 137
 			<div class="roundframe noup">';
133
-	if (!empty($context['tfa_error']) || !empty($context['tfa_backup_error']))
134
-		echo '
138
+	if (!empty($context['tfa_error']) || !empty($context['tfa_backup_error'])) {
139
+			echo '
135 140
 				<div class="error">', $txt['tfa_' . (!empty($context['tfa_error']) ? 'code_' : 'backup_') . 'invalid'], '</div>';
141
+	}
136 142
 	echo '
137 143
 				<form action="', $context['tfa_url'], '" method="post" id="frmTfa">
138 144
 					<div id="tfaCode">
@@ -155,8 +161,8 @@  discard block
 block discarded – undo
155 161
 				</form>
156 162
 				<script>
157 163
 						form = $("#frmTfa");';
158
-	if (!empty($context['from_ajax']))
159
-		echo '
164
+	if (!empty($context['from_ajax'])) {
165
+			echo '
160 166
 						form.submit(function(e) {
161 167
 							// If we are submitting backup code, let normal workflow follow since it redirects a couple times into a different page
162 168
 							if (form.find("input[name=tfa_backup]:first").val().length > 0)
@@ -175,6 +181,7 @@  discard block
 block discarded – undo
175 181
 
176 182
 							return false;
177 183
 						});';
184
+	}
178 185
 	echo '
179 186
 						form.find("input[name=backup]").click(function(e) {
180 187
 							$("#tfaBackup").show();
@@ -206,10 +213,11 @@  discard block
 block discarded – undo
206 213
 				', empty($context['kick_message']) ? $txt['only_members_can_access'] : $context['kick_message'], '<br>';
207 214
 
208 215
 
209
-	if ($context['can_register'])
210
-		echo sprintf($txt['login_below_or_register'], $scripturl . '?action=signup', $context['forum_name_html_safe']);
211
-	else
212
-		echo $txt['login_below'];
216
+	if ($context['can_register']) {
217
+			echo sprintf($txt['login_below_or_register'], $scripturl . '?action=signup', $context['forum_name_html_safe']);
218
+	} else {
219
+			echo $txt['login_below'];
220
+	}
213 221
 
214 222
 	// And now the login information.
215 223
 	echo '
@@ -305,9 +313,10 @@  discard block
 block discarded – undo
305 313
 		</div>
306 314
 		<div class="roundframe centertext noup">';
307 315
 
308
-	if (!empty($context['incorrect_password']))
309
-		echo '
316
+	if (!empty($context['incorrect_password'])) {
317
+			echo '
310 318
 			<div class="error">', $txt['admin_incorrect_password'], '</div>';
319
+	}
311 320
 
312 321
 	echo '
313 322
 			<strong>', $txt['password'], ':</strong>
@@ -347,11 +356,12 @@  discard block
 block discarded – undo
347 356
 			<div class="roundframe">';
348 357
 
349 358
 	// You didn't even have an ID?
350
-	if (empty($context['member_id']))
351
-		echo '
359
+	if (empty($context['member_id'])) {
360
+			echo '
352 361
 				<dl>
353 362
 					<dt>', $txt['invalid_activation_username'], ':</dt>
354 363
 					<dd><input type="text" name="user" size="30"></dd>';
364
+	}
355 365
 
356 366
 	echo '
357 367
 					<dt>', $txt['invalid_activation_retry'], ':</dt>
@@ -388,13 +398,14 @@  discard block
 block discarded – undo
388 398
 					<dd><input type="password" name="passwd" size="30"></dd>
389 399
 				</dl>';
390 400
 
391
-	if ($context['can_activate'])
392
-		echo '
401
+	if ($context['can_activate']) {
402
+			echo '
393 403
 				<p>', $txt['invalid_activation_known'], '</p>
394 404
 				<dl>
395 405
 					<dt>', $txt['invalid_activation_retry'], ':</dt>
396 406
 					<dd><input type="text" name="code" size="30"></dd>
397 407
 				</dl>';
408
+	}
398 409
 
399 410
 	echo '
400 411
 				<p><input type="submit" value="', $txt['invalid_activation_resend'], '" class="button"></p>
Please login to merge, or discard this patch.
Themes/default/Admin.template.php 1 patch
Braces   +173 added lines, -125 removed lines patch added patch discarded remove patch
@@ -64,9 +64,10 @@  discard block
 block discarded – undo
64 64
 										<strong>', $txt['administrators'], ':</strong>
65 65
 										', implode(', ', $context['administrators']);
66 66
 	// If we have lots of admins... don't show them all.
67
-	if (!empty($context['more_admins_link']))
68
-		echo '
67
+	if (!empty($context['more_admins_link'])) {
68
+			echo '
69 69
 							(', $context['more_admins_link'], ')';
70
+	}
70 71
 
71 72
 	echo '
72 73
 									</div>
@@ -83,16 +84,18 @@  discard block
 block discarded – undo
83 84
 		foreach ($area['areas'] as $item_id => $item)
84 85
 		{
85 86
 			// No point showing the 'home' page here, we're already on it!
86
-			if ($area_id == 'forum' && $item_id == 'index')
87
-				continue;
87
+			if ($area_id == 'forum' && $item_id == 'index') {
88
+							continue;
89
+			}
88 90
 
89 91
 			$url = isset($item['url']) ? $item['url'] : $scripturl . '?action=admin;area=' . $item_id . (!empty($context[$context['admin_menu_name']]['extra_parameters']) ? $context[$context['admin_menu_name']]['extra_parameters'] : '');
90
-			if (!empty($item['icon_file']))
91
-				echo '
92
+			if (!empty($item['icon_file'])) {
93
+							echo '
92 94
 							<a href="', $url, '" class="admin_group', !empty($item['inactive']) ? ' inactive' : '', '"><img class="large_admin_menu_icon_file" src="', $item['icon_file'], '" alt="">', $item['label'], '</a>';
93
-			else
94
-				echo '
95
+			} else {
96
+							echo '
95 97
 							<a href="', $url, '"><span class="large_', $item['icon_class'], !empty($item['inactive']) ? ' inactive' : '', '"></span>', $item['label'], '</a>';
98
+			}
96 99
 		}
97 100
 
98 101
 		echo '
@@ -103,10 +106,11 @@  discard block
 block discarded – undo
103 106
 					</div>';
104 107
 
105 108
 	// The below functions include all the scripts needed from the simplemachines.org site. The language and format are passed for internationalization.
106
-	if (empty($modSettings['disable_smf_js']))
107
-		echo '
109
+	if (empty($modSettings['disable_smf_js'])) {
110
+			echo '
108 111
 					<script src="', $scripturl, '?action=viewsmfile;filename=current-version.js"></script>
109 112
 					<script src="', $scripturl, '?action=viewsmfile;filename=latest-news.js"></script>';
113
+	}
110 114
 
111 115
 	// This sets the announcements and current versions themselves ;).
112 116
 	echo '
@@ -185,9 +189,10 @@  discard block
 block discarded – undo
185 189
 								<em>', $version['version'], '</em>';
186 190
 
187 191
 		// more details for this item, show them a link
188
-		if ($context['can_admin'] && isset($version['more']))
189
-			echo
192
+		if ($context['can_admin'] && isset($version['more'])) {
193
+					echo
190 194
 								' <a href="', $scripturl, $version['more'], ';', $context['session_var'], '=', $context['session_id'], '">', $txt['version_check_more'], '</a>';
195
+		}
191 196
 		echo '
192 197
 								<br>';
193 198
 	}
@@ -218,20 +223,22 @@  discard block
 block discarded – undo
218 223
 
219 224
 	foreach ($context['credits'] as $section)
220 225
 	{
221
-		if (isset($section['pretext']))
222
-			echo '
226
+		if (isset($section['pretext'])) {
227
+					echo '
223 228
 								<p>', $section['pretext'], '</p><hr>';
229
+		}
224 230
 
225 231
 		echo '
226 232
 								<dl>';
227 233
 
228 234
 		foreach ($section['groups'] as $group)
229 235
 		{
230
-			if (isset($group['title']))
231
-				echo '
236
+			if (isset($group['title'])) {
237
+							echo '
232 238
 									<dt>
233 239
 										<strong>', $group['title'], ':</strong>
234 240
 									</dt>';
241
+			}
235 242
 
236 243
 			echo '
237 244
 									<dd>', implode(', ', $group['members']), '</dd>';
@@ -240,10 +247,11 @@  discard block
 block discarded – undo
240 247
 		echo '
241 248
 								</dl>';
242 249
 
243
-		if (isset($section['posttext']))
244
-			echo '
250
+		if (isset($section['posttext'])) {
251
+					echo '
245 252
 								<hr>
246 253
 								<p>', $section['posttext'], '</p>';
254
+		}
247 255
 	}
248 256
 
249 257
 	echo '
@@ -259,9 +267,10 @@  discard block
 block discarded – undo
259 267
 							smfSupportVersions.forum = "', $context['forum_version'], '";';
260 268
 
261 269
 	// Don't worry, none of this is logged, it's just used to give information that might be of use.
262
-	foreach ($context['current_versions'] as $variable => $version)
263
-		echo '
270
+	foreach ($context['current_versions'] as $variable => $version) {
271
+			echo '
264 272
 							smfSupportVersions.', $variable, ' = "', $version['version'], '";';
273
+	}
265 274
 
266 275
 	// Now we just have to include the script and wait ;).
267 276
 	echo '
@@ -358,8 +367,8 @@  discard block
 block discarded – undo
358 367
 							<tbody>';
359 368
 
360 369
 	// Loop through every source file displaying its version - using javascript.
361
-	foreach ($context['file_versions'] as $filename => $version)
362
-		echo '
370
+	foreach ($context['file_versions'] as $filename => $version) {
371
+			echo '
363 372
 								<tr class="windowbg">
364 373
 									<td class="half_table">
365 374
 										', $filename, '
@@ -371,6 +380,7 @@  discard block
 block discarded – undo
371 380
 										<em id="currentSources', $filename, '">??</em>
372 381
 									</td>
373 382
 								</tr>';
383
+	}
374 384
 
375 385
 	// Default template files.
376 386
 	echo '
@@ -396,8 +406,8 @@  discard block
 block discarded – undo
396 406
 							<table id="Default" class="table_grid">
397 407
 								<tbody>';
398 408
 
399
-	foreach ($context['default_template_versions'] as $filename => $version)
400
-		echo '
409
+	foreach ($context['default_template_versions'] as $filename => $version) {
410
+			echo '
401 411
 									<tr class="windowbg">
402 412
 										<td class="half_table">
403 413
 											', $filename, '
@@ -409,6 +419,7 @@  discard block
 block discarded – undo
409 419
 											<em id="currentDefault', $filename, '">??</em>
410 420
 										</td>
411 421
 									</tr>';
422
+	}
412 423
 
413 424
 	// Now the language files...
414 425
 	echo '
@@ -436,8 +447,8 @@  discard block
 block discarded – undo
436 447
 
437 448
 	foreach ($context['default_language_versions'] as $language => $files)
438 449
 	{
439
-		foreach ($files as $filename => $version)
440
-			echo '
450
+		foreach ($files as $filename => $version) {
451
+					echo '
441 452
 									<tr class="windowbg">
442 453
 										<td class="half_table">
443 454
 											', $filename, '.<em>', $language, '</em>.php
@@ -449,6 +460,7 @@  discard block
 block discarded – undo
449 460
 											<em id="current', $filename, '.', $language, '">??</em>
450 461
 										</td>
451 462
 									</tr>';
463
+		}
452 464
 	}
453 465
 
454 466
 	echo '
@@ -478,8 +490,8 @@  discard block
 block discarded – undo
478 490
 							<table id="Templates" class="table_grid">
479 491
 								<tbody>';
480 492
 
481
-		foreach ($context['template_versions'] as $filename => $version)
482
-			echo '
493
+		foreach ($context['template_versions'] as $filename => $version) {
494
+					echo '
483 495
 									<tr class="windowbg">
484 496
 										<td class="half_table">
485 497
 											', $filename, '
@@ -491,6 +503,7 @@  discard block
 block discarded – undo
491 503
 											<em id="currentTemplates', $filename, '">??</em>
492 504
 										</td>
493 505
 									</tr>';
506
+		}
494 507
 
495 508
 		echo '
496 509
 								</tbody>
@@ -520,8 +533,8 @@  discard block
 block discarded – undo
520 533
 							<table id="Tasks" class="table_grid">
521 534
 								<tbody>';
522 535
 
523
-		foreach ($context['tasks_versions'] as $filename => $version)
524
-			echo '
536
+		foreach ($context['tasks_versions'] as $filename => $version) {
537
+					echo '
525 538
 									<tr class="windowbg">
526 539
 										<td class="half_table">
527 540
 											', $filename, '
@@ -533,6 +546,7 @@  discard block
 block discarded – undo
533 546
 											<em id="currentTasks', $filename, '">??</em>
534 547
 										</td>
535 548
 									</tr>';
549
+		}
536 550
 
537 551
 		echo '
538 552
 								</tbody>
@@ -574,9 +588,10 @@  discard block
 block discarded – undo
574 588
 {
575 589
 	global $context, $scripturl, $txt, $modSettings;
576 590
 
577
-	if (!empty($context['saved_successful']))
578
-		echo '
591
+	if (!empty($context['saved_successful'])) {
592
+			echo '
579 593
 					<div class="infobox">', $txt['settings_saved'], '</div>';
594
+	}
580 595
 
581 596
 	// First section is for adding/removing words from the censored list.
582 597
 	echo '
@@ -591,11 +606,12 @@  discard block
 block discarded – undo
591 606
 								<p>', $txt['admin_censored_where'], '</p>';
592 607
 
593 608
 	// Show text boxes for censoring [bad   ] => [good  ].
594
-	foreach ($context['censored_words'] as $vulgar => $proper)
595
-		echo '
609
+	foreach ($context['censored_words'] as $vulgar => $proper) {
610
+			echo '
596 611
 								<div class="block">
597 612
 									<input type="text" name="censor_vulgar[]" value="', $vulgar, '" size="30"> =&gt; <input type="text" name="censor_proper[]" value="', $proper, '" size="30">
598 613
 								</div>';
614
+	}
599 615
 
600 616
 	// Now provide a way to censor more words.
601 617
 	echo '
@@ -669,19 +685,21 @@  discard block
 block discarded – undo
669 685
 						<div class="windowbg2 noup">
670 686
 							', $txt['not_done_reason'];
671 687
 
672
-	if (!empty($context['continue_percent']))
673
-		echo '
688
+	if (!empty($context['continue_percent'])) {
689
+			echo '
674 690
 							<div class="progress_bar">
675 691
 								<div class="full_bar">', $context['continue_percent'], '%</div>
676 692
 								<div class="green_percent" style="width: ', $context['continue_percent'], '%;">&nbsp;</div>
677 693
 							</div>';
694
+	}
678 695
 
679
-	if (!empty($context['substep_enabled']))
680
-		echo '
696
+	if (!empty($context['substep_enabled'])) {
697
+			echo '
681 698
 							<div class="progress_bar">
682 699
 								<div class="full_bar">', $context['substep_title'], ' (', $context['substep_continue_percent'], '%)</div>
683 700
 								<div class="blue_percent" style="width: ', $context['substep_continue_percent'], '%;">&nbsp;</div>
684 701
 							</div>';
702
+	}
685 703
 
686 704
 	echo '
687 705
 							<form action="', $scripturl, $context['continue_get_data'], '" method="post" accept-charset="', $context['character_set'], '" name="autoSubmit" id="autoSubmit">
@@ -716,35 +734,40 @@  discard block
 block discarded – undo
716 734
 {
717 735
 	global $context, $txt, $scripturl;
718 736
 
719
-	if (!empty($context['saved_successful']))
720
-		echo '
737
+	if (!empty($context['saved_successful'])) {
738
+			echo '
721 739
 					<div class="infobox">', $txt['settings_saved'], '</div>';
722
-	elseif (!empty($context['saved_failed']))
723
-		echo '
740
+	} elseif (!empty($context['saved_failed'])) {
741
+			echo '
724 742
 					<div class="errorbox">', sprintf($txt['settings_not_saved'], $context['saved_failed']), '</div>';
743
+	}
725 744
 
726
-	if (!empty($context['settings_pre_javascript']))
727
-		echo '
745
+	if (!empty($context['settings_pre_javascript'])) {
746
+			echo '
728 747
 					<script>', $context['settings_pre_javascript'], '</script>';
748
+	}
729 749
 
730
-	if (!empty($context['settings_insert_above']))
731
-		echo $context['settings_insert_above'];
750
+	if (!empty($context['settings_insert_above'])) {
751
+			echo $context['settings_insert_above'];
752
+	}
732 753
 
733 754
 	echo '
734 755
 					<div id="admincenter">
735 756
 						<form id="admin_form_wrapper" action="', $context['post_url'], '" method="post" accept-charset="', $context['character_set'], '"', !empty($context['force_form_onsubmit']) ? ' onsubmit="' . $context['force_form_onsubmit'] . '"' : '', '>';
736 757
 
737 758
 	// Is there a custom title?
738
-	if (isset($context['settings_title']))
739
-		echo '
759
+	if (isset($context['settings_title'])) {
760
+			echo '
740 761
 							<div class="cat_bar">
741 762
 								<h3 class="catbg">', $context['settings_title'], '</h3>
742 763
 							</div>';
764
+	}
743 765
 
744 766
 	// Have we got a message to display?
745
-	if (!empty($context['settings_message']))
746
-		echo '
767
+	if (!empty($context['settings_message'])) {
768
+			echo '
747 769
 							<div class="information">', $context['settings_message'], '</div>';
770
+	}
748 771
 
749 772
 	// Now actually loop through all the variables.
750 773
 	$is_open = false;
@@ -797,8 +820,9 @@  discard block
 block discarded – undo
797 820
 		// Hang about? Are you pulling my leg - a callback?!
798 821
 		if (is_array($config_var) && $config_var['type'] == 'callback')
799 822
 		{
800
-			if (function_exists('template_callback_' . $config_var['name']))
801
-				call_user_func('template_callback_' . $config_var['name']);
823
+			if (function_exists('template_callback_' . $config_var['name'])) {
824
+							call_user_func('template_callback_' . $config_var['name']);
825
+			}
802 826
 
803 827
 			continue;
804 828
 		}
@@ -828,9 +852,10 @@  discard block
 block discarded – undo
828 852
 				$text_types = array('color', 'date', 'datetime', 'datetime-local', 'email', 'month', 'time');
829 853
 
830 854
 				// Show the [?] button.
831
-				if ($config_var['help'])
832
-					echo '
855
+				if ($config_var['help']) {
856
+									echo '
833 857
 							<a id="setting_', $config_var['name'], '_help" href="', $scripturl, '?action=helpadmin;help=', $config_var['help'], '" onclick="return reqOverlayDiv(this.href);"><span class="generic_icons help" title="', $txt['help'], '"></span></a> ';
858
+				}
834 859
 
835 860
 				echo '
836 861
 										<a id="setting_', $config_var['name'], '"></a> <span', ($config_var['disabled'] ? ' style="color: #777777;"' : ($config_var['invalid'] ? ' class="error"' : '')), '><label for="', $config_var['name'], '">', $config_var['label'], '</label>', $subtext, ($config_var['type'] == 'password' ? '<br><em>' . $txt['admin_confirm_password'] . '</em>' : ''), '</span>
@@ -839,22 +864,25 @@  discard block
 block discarded – undo
839 864
 										$config_var['preinput'];
840 865
 
841 866
 				// Show a check box.
842
-				if ($config_var['type'] == 'check')
843
-					echo '
867
+				if ($config_var['type'] == 'check') {
868
+									echo '
844 869
 										<input type="checkbox"', $javascript, $disabled, ' name="', $config_var['name'], '" id="', $config_var['name'], '"', ($config_var['value'] ? ' checked' : ''), ' value="1">';
870
+				}
845 871
 				// Escape (via htmlspecialchars.) the text box.
846
-				elseif ($config_var['type'] == 'password')
847
-					echo '
872
+				elseif ($config_var['type'] == 'password') {
873
+									echo '
848 874
 										<input type="password"', $disabled, $javascript, ' name="', $config_var['name'], '[0]"', ($config_var['size'] ? ' size="' . $config_var['size'] . '"' : ''), ' value="*#fakepass#*" onfocus="this.value = \'\'; this.form.', $config_var['name'], '.disabled = false;"><br>
849 875
 										<input type="password" disabled id="', $config_var['name'], '" name="', $config_var['name'], '[1]"', ($config_var['size'] ? ' size="' . $config_var['size'] . '"' : ''), '>';
876
+				}
850 877
 				// Show a selection box.
851 878
 				elseif ($config_var['type'] == 'select')
852 879
 				{
853 880
 					echo '
854 881
 										<select name="', $config_var['name'], '" id="', $config_var['name'], '" ', $javascript, $disabled, (!empty($config_var['multiple']) ? ' multiple="multiple"' : ''), (!empty($config_var['multiple']) && !empty($config_var['size']) ? ' size="' . $config_var['size'] . '"' : ''), '>';
855
-					foreach ($config_var['data'] as $option)
856
-						echo '
882
+					foreach ($config_var['data'] as $option) {
883
+											echo '
857 884
 											<option value="', $option[0], '"', (!empty($config_var['value']) && ($option[0] == $config_var['value'] || (!empty($config_var['multiple']) && in_array($option[0], $config_var['value']))) ? ' selected' : ''), '>', $option[1], '</option>';
885
+					}
858 886
 					echo '
859 887
 										</select>';
860 888
 				}
@@ -868,15 +896,17 @@  discard block
 block discarded – undo
868 896
 												<legend class="board_selector"><a href="#">', $txt['select_boards_from_list'], '</a></legend>';
869 897
 					foreach ($context['board_list'] as $id_cat => $cat)
870 898
 					{
871
-						if (!$first)
872
-							echo '
899
+						if (!$first) {
900
+													echo '
873 901
 											<hr>';
902
+						}
874 903
 						echo '
875 904
 											<strong>', $cat['name'], '</strong>
876 905
 											<ul>';
877
-						foreach ($cat['boards'] as $id_board => $brd)
878
-							echo '
906
+						foreach ($cat['boards'] as $id_board => $brd) {
907
+													echo '
879 908
 												<li><label><input type="checkbox" name="', $config_var['name'], '[', $brd['id'], ']" value="1"', in_array($brd['id'], $config_var['value']) ? ' checked' : '', '> ', $brd['child_level'] > 0 ? str_repeat('&nbsp; &nbsp;', $brd['child_level']) : '', $brd['name'], '</label></li>';
909
+						}
880 910
 
881 911
 						echo '
882 912
 											</ul>';
@@ -886,12 +916,14 @@  discard block
 block discarded – undo
886 916
 											</fieldset>';
887 917
 				}
888 918
 				// Text area?
889
-				elseif ($config_var['type'] == 'large_text')
890
-					echo '
919
+				elseif ($config_var['type'] == 'large_text') {
920
+									echo '
891 921
 											<textarea rows="', (!empty($config_var['size']) ? $config_var['size'] : (!empty($config_var['rows']) ? $config_var['rows'] : 4)), '" cols="', (!empty($config_var['cols']) ? $config_var['cols'] : 30), '" ', $javascript, $disabled, ' name="', $config_var['name'], '" id="', $config_var['name'], '">', $config_var['value'], '</textarea>';
922
+				}
892 923
 				// Permission group?
893
-				elseif ($config_var['type'] == 'permissions')
894
-					theme_inline_permissions($config_var['name']);
924
+				elseif ($config_var['type'] == 'permissions') {
925
+									theme_inline_permissions($config_var['name']);
926
+				}
895 927
 				// BBC selection?
896 928
 				elseif ($config_var['type'] == 'bbc')
897 929
 				{
@@ -902,20 +934,22 @@  discard block
 block discarded – undo
902 934
 
903 935
 					foreach ($context['bbc_columns'] as $bbcColumn)
904 936
 					{
905
-						foreach ($bbcColumn as $bbcTag)
906
-							echo '
937
+						foreach ($bbcColumn as $bbcTag) {
938
+													echo '
907 939
 														<li class="list_bbc floatleft">
908 940
 															<input type="checkbox" name="', $config_var['name'], '_enabledTags[]" id="tag_', $config_var['name'], '_', $bbcTag['tag'], '" value="', $bbcTag['tag'], '"', !in_array($bbcTag['tag'], $context['bbc_sections'][$config_var['name']]['disabled']) ? ' checked' : '', '> <label for="tag_', $config_var['name'], '_', $bbcTag['tag'], '">', $bbcTag['tag'], '</label>', $bbcTag['show_help'] ? ' (<a href="' . $scripturl . '?action=helpadmin;help=tag_' . $bbcTag['tag'] . '" onclick="return reqOverlayDiv(this.href);">?</a>)' : '', '
909 941
 														</li>';
942
+						}
910 943
 					}
911 944
 					echo '							</ul>
912 945
 												<input type="checkbox" id="bbc_', $config_var['name'], '_select_all" onclick="invertAll(this, this.form, \'', $config_var['name'], '_enabledTags\');"', $context['bbc_sections'][$config_var['name']]['all_selected'] ? ' checked' : '', '> <label for="bbc_', $config_var['name'], '_select_all"><em>', $txt['bbcTagsToUse_select_all'], '</em></label>
913 946
 											</fieldset>';
914 947
 				}
915 948
 				// A simple message?
916
-				elseif ($config_var['type'] == 'var_message')
917
-					echo '
949
+				elseif ($config_var['type'] == 'var_message') {
950
+									echo '
918 951
 											<div', !empty($config_var['name']) ? ' id="' . $config_var['name'] . '"' : '', '>', $config_var['var_message'], '</div>';
952
+				}
919 953
 				// Assume it must be a text box
920 954
 				else
921 955
 				{
@@ -940,63 +974,70 @@  discard block
 block discarded – undo
940 974
 											' . $config_var['postinput'] : '',
941 975
 										'</dd>';
942 976
 			}
943
-		}
944
-
945
-		else
977
+		} else
946 978
 		{
947 979
 			// Just show a separator.
948
-			if ($config_var == '')
949
-				echo '
980
+			if ($config_var == '') {
981
+							echo '
950 982
 								</dl>
951 983
 								<hr>
952 984
 								<dl class="settings">';
953
-			else
954
-				echo '
985
+			} else {
986
+							echo '
955 987
 									<dd>
956 988
 										<strong>' . $config_var . '</strong>
957 989
 									</dd>';
990
+			}
958 991
 		}
959 992
 	}
960 993
 
961
-	if ($is_open)
962
-		echo '
994
+	if ($is_open) {
995
+			echo '
963 996
 								</dl>';
997
+	}
964 998
 
965
-	if (empty($context['settings_save_dont_show']))
966
-		echo '
999
+	if (empty($context['settings_save_dont_show'])) {
1000
+			echo '
967 1001
 								<input type="submit" value="', $txt['save'], '"', (!empty($context['save_disabled']) ? ' disabled' : ''), (!empty($context['settings_save_onclick']) ? ' onclick="' . $context['settings_save_onclick'] . '"' : ''), ' class="button">';
1002
+	}
968 1003
 
969
-	if ($is_open)
970
-		echo '
1004
+	if ($is_open) {
1005
+			echo '
971 1006
 							</div>';
1007
+	}
972 1008
 
973 1009
 
974 1010
 	// At least one token has to be used!
975
-	if (isset($context['admin-ssc_token']))
976
-		echo '
1011
+	if (isset($context['admin-ssc_token'])) {
1012
+			echo '
977 1013
 							<input type="hidden" name="', $context['admin-ssc_token_var'], '" value="', $context['admin-ssc_token'], '">';
1014
+	}
978 1015
 
979
-	if (isset($context['admin-dbsc_token']))
980
-		echo '
1016
+	if (isset($context['admin-dbsc_token'])) {
1017
+			echo '
981 1018
 							<input type="hidden" name="', $context['admin-dbsc_token_var'], '" value="', $context['admin-dbsc_token'], '">';
1019
+	}
982 1020
 
983
-	if (isset($context['admin-mp_token']))
984
-		echo '
1021
+	if (isset($context['admin-mp_token'])) {
1022
+			echo '
985 1023
 							<input type="hidden" name="', $context['admin-mp_token_var'], '" value="', $context['admin-mp_token'], '">';
1024
+	}
986 1025
 
987 1026
 	echo '
988 1027
 							<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
989 1028
 						</form>
990 1029
 					</div>';
991 1030
 
992
-	if (!empty($context['settings_post_javascript']))
993
-		echo '
1031
+	if (!empty($context['settings_post_javascript'])) {
1032
+			echo '
994 1033
 					<script>
995 1034
 					', $context['settings_post_javascript'], '
996 1035
 					</script>';
1036
+	}
997 1037
 
998
-	if (!empty($context['settings_insert_below']))
999
-		echo $context['settings_insert_below'];
1038
+	if (!empty($context['settings_insert_below'])) {
1039
+			echo $context['settings_insert_below'];
1040
+	}
1000 1041
 
1001 1042
 	// We may have added a board listing. If we did, we need to make it work.
1002 1043
 	addInlineJavascript('
@@ -1019,9 +1060,10 @@  discard block
 block discarded – undo
1019 1060
 {
1020 1061
 	global $context, $txt;
1021 1062
 
1022
-	if (!empty($context['saved_successful']))
1023
-		echo '
1063
+	if (!empty($context['saved_successful'])) {
1064
+			echo '
1024 1065
 					<div class="infobox">', $txt['settings_saved'], '</div>';
1066
+	}
1025 1067
 
1026 1068
 	// Standard fields.
1027 1069
 	template_show_list('standard_profile_fields');
@@ -1053,11 +1095,12 @@  discard block
 block discarded – undo
1053 1095
 	if (isset($_GET['msg']))
1054 1096
 	{
1055 1097
 		loadLanguage('Errors');
1056
-		if (isset($txt['custom_option_' . $_GET['msg']]))
1057
-			echo '
1098
+		if (isset($txt['custom_option_' . $_GET['msg']])) {
1099
+					echo '
1058 1100
 					<div class="errorbox">',
1059 1101
 						$txt['custom_option_' . $_GET['msg']], '
1060 1102
 					</div>';
1103
+		}
1061 1104
 	}
1062 1105
 
1063 1106
 	echo '
@@ -1123,9 +1166,10 @@  discard block
 block discarded – undo
1123 1166
 										<dd>
1124 1167
 											<select name="placement" id="placement">';
1125 1168
 
1126
-	foreach ($context['cust_profile_fields_placement'] as $order => $name)
1127
-		echo '
1169
+	foreach ($context['cust_profile_fields_placement'] as $order => $name) {
1170
+			echo '
1128 1171
 												<option value="', $order, '"', $context['field']['placement'] == $order ? ' selected' : '', '>', $txt['custom_profile_placement_' . $name], '</option>';
1172
+	}
1129 1173
 
1130 1174
 	echo '
1131 1175
 											</select>
@@ -1148,9 +1192,10 @@  discard block
 block discarded – undo
1148 1192
 										</dt>
1149 1193
 										<dd>
1150 1194
 											<select name="field_type" id="field_type" onchange="updateInputBoxes();">';
1151
-	foreach (array('text', 'textarea', 'select', 'radio', 'check') as $field_type)
1152
-		echo '
1195
+	foreach (array('text', 'textarea', 'select', 'radio', 'check') as $field_type) {
1196
+			echo '
1153 1197
 												<option value="', $field_type, '"', $context['field']['type'] == $field_type ? ' selected' : '', '>', $txt['custom_profile_type_' . $field_type], '</option>';
1198
+	}
1154 1199
 
1155 1200
 	echo '
1156 1201
 											</select>
@@ -1251,9 +1296,10 @@  discard block
 block discarded – undo
1251 1296
 								</fieldset>
1252 1297
 									<input type="submit" name="save" value="', $txt['save'], '" class="button">';
1253 1298
 
1254
-	if ($context['fid'])
1255
-		echo '
1299
+	if ($context['fid']) {
1300
+			echo '
1256 1301
 									<input type="submit" name="delete" value="', $txt['delete'], '" data-confirm="', $txt['custom_edit_delete_sure'], '" class="button you_sure">';
1302
+	}
1257 1303
 
1258 1304
 	echo '
1259 1305
 							</div>
@@ -1296,8 +1342,7 @@  discard block
 block discarded – undo
1296 1342
 	{
1297 1343
 		echo '
1298 1344
 						<p class="centertext"><strong>', $txt['admin_search_results_none'], '</strong></p>';
1299
-	}
1300
-	else
1345
+	} else
1301 1346
 	{
1302 1347
 		echo '
1303 1348
 						<ol class="search_results">';
@@ -1323,9 +1368,10 @@  discard block
 block discarded – undo
1323 1368
 							<li>
1324 1369
 								<a href="', $result['url'], '"><strong>', $result['name'], '</strong></a> [', isset($txt['admin_search_section_' . $result['type']]) ? $txt['admin_search_section_' . $result['type']] : $result['type'], ']';
1325 1370
 
1326
-				if ($result['help'])
1327
-					echo '
1371
+				if ($result['help']) {
1372
+									echo '
1328 1373
 								<p class="double_height">', $result['help'], '</p>';
1374
+				}
1329 1375
 
1330 1376
 				echo '
1331 1377
 							</li>';
@@ -1365,18 +1411,20 @@  discard block
 block discarded – undo
1365 1411
 									<strong>', $txt['setup_verification_answer'], '</strong>
1366 1412
 								</dd>';
1367 1413
 
1368
-		if (!empty($context['qa_by_lang'][$lang_id]))
1369
-			foreach ($context['qa_by_lang'][$lang_id] as $q_id)
1414
+		if (!empty($context['qa_by_lang'][$lang_id])) {
1415
+					foreach ($context['qa_by_lang'][$lang_id] as $q_id)
1370 1416
 			{
1371 1417
 				$question = $context['question_answers'][$q_id];
1418
+		}
1372 1419
 				echo '
1373 1420
 								<dt>
1374 1421
 									<input type="text" name="question[', $lang_id, '][', $q_id, ']" value="', $question['question'], '" size="50" class="verification_question">
1375 1422
 								</dt>
1376 1423
 								<dd>';
1377
-				foreach ($question['answers'] as $answer)
1378
-					echo '
1424
+				foreach ($question['answers'] as $answer) {
1425
+									echo '
1379 1426
 									<input type="text" name="answer[', $lang_id, '][', $q_id, '][]" value="', $answer, '" size="50" class="verification_answer">';
1427
+				}
1380 1428
 
1381 1429
 				echo '
1382 1430
 									<div class="qa_add_answer"><a href="javascript:void(0);" onclick="return addAnswer(this);">[ ', $txt['setup_verification_add_answer'], ' ]</a></div>
@@ -1415,11 +1463,12 @@  discard block
 block discarded – undo
1415 1463
 							', $txt['errors_found'], ':
1416 1464
 							<ul>';
1417 1465
 
1418
-			foreach ($context['repair_errors'] as $error)
1419
-				echo '
1466
+			foreach ($context['repair_errors'] as $error) {
1467
+							echo '
1420 1468
 								<li>
1421 1469
 									', $error, '
1422 1470
 								</li>';
1471
+			}
1423 1472
 
1424 1473
 			echo '
1425 1474
 							</ul>
@@ -1429,16 +1478,15 @@  discard block
 block discarded – undo
1429 1478
 							<p class="padding">
1430 1479
 								<strong><a href="', $scripturl, '?action=admin;area=repairboards;fixErrors;', $context['session_var'], '=', $context['session_id'], '">', $txt['yes'], '</a> - <a href="', $scripturl, '?action=admin;area=maintain">', $txt['no'], '</a></strong>
1431 1480
 							</p>';
1432
-		}
1433
-		else
1434
-			echo '
1481
+		} else {
1482
+					echo '
1435 1483
 							<p>', $txt['maintain_no_errors'], '</p>
1436 1484
 							<p class="padding">
1437 1485
 								<a href="', $scripturl, '?action=admin;area=maintain;sa=routine">', $txt['maintain_return'], '</a>
1438 1486
 							</p>';
1487
+		}
1439 1488
 
1440
-	}
1441
-	else
1489
+	} else
1442 1490
 	{
1443 1491
 		if (!empty($context['redirect_to_recount']))
1444 1492
 		{
@@ -1450,8 +1498,7 @@  discard block
 block discarded – undo
1450 1498
 								<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
1451 1499
 								<input type="submit" name="recount" id="recount_now" value="', $txt['errors_recount_now'], '">
1452 1500
 							</form>';
1453
-		}
1454
-		else
1501
+		} else
1455 1502
 		{
1456 1503
 			echo '
1457 1504
 							<p>', $txt['errors_fixed'], '</p>
@@ -1603,8 +1650,8 @@  discard block
 block discarded – undo
1603 1650
 function template_admin_quick_search()
1604 1651
 {
1605 1652
 	global $context, $txt;
1606
-	if ($context['user']['is_admin'])
1607
-		echo '
1653
+	if ($context['user']['is_admin']) {
1654
+			echo '
1608 1655
 								<span class="floatright admin_search">
1609 1656
 									<span class="generic_icons filter centericon"></span>
1610 1657
 									<input type="search" name="search_term" value="', $txt['admin_search'], '" onclick="if (this.value == \'', $txt['admin_search'], '\') this.value = \'\';">
@@ -1615,6 +1662,7 @@  discard block
 block discarded – undo
1615 1662
 									</select>
1616 1663
 									<input type="submit" name="search_go" id="search_go" value="', $txt['admin_search_go'], '" class="button">
1617 1664
 								</span>';
1618
-}
1665
+	}
1666
+	}
1619 1667
 
1620 1668
 ?>
1621 1669
\ No newline at end of file
Please login to merge, or discard this patch.
Themes/default/ManagePermissions.template.php 1 patch
Braces   +162 added lines, -125 removed lines patch added patch discarded remove patch
@@ -19,26 +19,28 @@  discard block
 block discarded – undo
19 19
 	global $context, $settings, $scripturl, $txt, $modSettings;
20 20
 
21 21
 	// Not allowed to edit?
22
-	if (!$context['can_modify'])
23
-		echo '
22
+	if (!$context['can_modify']) {
23
+			echo '
24 24
 	<div class="errorbox">
25 25
 		', sprintf($txt['permission_cannot_edit'], $scripturl . '?action=admin;area=permissions;sa=profiles'), '
26 26
 	</div>';
27
+	}
27 28
 
28 29
 	echo '
29 30
 	<div id="admin_form_wrapper">
30 31
 		<form action="', $scripturl, '?action=admin;area=permissions;sa=quick" method="post" accept-charset="', $context['character_set'], '" name="permissionForm" id="permissionForm">';
31 32
 
32
-		if (!empty($context['profile']))
33
-			echo '
33
+		if (!empty($context['profile'])) {
34
+					echo '
34 35
 			<div class="cat_bar">
35 36
 				<h3 class="catbg">', $txt['permissions_for_profile'], ': &quot;', $context['profile']['name'], '&quot;</h3>
36 37
 			</div>';
37
-		else
38
-			echo '
38
+		} else {
39
+					echo '
39 40
 			<div class="cat_bar">
40 41
 				<h3 class="catbg">', $txt['permissions_title'], '</h3>
41 42
 			</div>';
43
+		}
42 44
 
43 45
 		echo '
44 46
 			<table class="table_grid">
@@ -47,13 +49,14 @@  discard block
 block discarded – undo
47 49
 						<th>', $txt['membergroups_name'], '</th>
48 50
 						<th class="small_table">', $txt['membergroups_members_top'], '</th>';
49 51
 
50
-			if (empty($modSettings['permission_enable_deny']))
51
-				echo '
52
+			if (empty($modSettings['permission_enable_deny'])) {
53
+							echo '
52 54
 						<th class="small_table">', $txt['membergroups_permissions'], '</th>';
53
-			else
54
-				echo '
55
+			} else {
56
+							echo '
55 57
 						<th class="small_table">', $txt['permissions_allowed'], '</th>
56 58
 						<th class="small_table">', $txt['permissions_denied'], '</th>';
59
+			}
57 60
 
58 61
 			echo '
59 62
 						<th class="small_table">', $context['can_modify'] ? $txt['permissions_modify'] : $txt['permissions_view'], '</th>
@@ -71,22 +74,24 @@  discard block
 block discarded – undo
71 74
 						<td>
72 75
 							', !empty($group['help']) ? ' <a class="help" href="' . $scripturl . '?action=helpadmin;help=' . $group['help'] . '" onclick="return reqOverlayDiv(this.href);"><span class="generic_icons help" title="' . $txt['help'] . '"></span></a>' : '<img class="icon" src="' . $settings['images_url'] . '/blank.png" alt="' . $txt['help'] . '">', '&nbsp;<span>', $group['name'], '</span>';
73 76
 
74
-		if (!empty($group['children']))
75
-			echo '
77
+		if (!empty($group['children'])) {
78
+					echo '
76 79
 							<br>
77 80
 							<span class="smalltext">', $txt['permissions_includes_inherited'], ': &quot;', implode('&quot;, &quot;', $group['children']), '&quot;</span>';
81
+		}
78 82
 
79 83
 		echo '
80 84
 						</td>
81 85
 						<td>', $group['can_search'] ? $group['link'] : $group['num_members'], '</td>';
82 86
 
83
-		if (empty($modSettings['permission_enable_deny']))
84
-			echo '
87
+		if (empty($modSettings['permission_enable_deny'])) {
88
+					echo '
85 89
 						<td>', $group['num_permissions']['allowed'], '</td>';
86
-		else
87
-			echo '
90
+		} else {
91
+					echo '
88 92
 						<td ', $group['id'] == 1 ? ' style="font-style: italic;"' : '', '>', $group['num_permissions']['allowed'], '</td>
89 93
 						<td ', $group['id'] == 1 || $group['id'] == -1 ? ' style="font-style: italic;"' : (!empty($group['num_permissions']['denied']) ? ' class="red"' : ''), '>', $group['num_permissions']['denied'], '</td>';
94
+		}
90 95
 
91 96
 		echo '
92 97
 						<td>', $group['allow_modify'] ? '<a href="' . $scripturl . '?action=admin;area=permissions;sa=modify;group=' . $group['id'] . (empty($context['profile']) ? '' : ';pid=' . $context['profile']['id']) . '">' . ($context['can_modify'] ? $txt['permissions_modify'] : $txt['permissions_view']) . '</a>' : '', '</td>
@@ -133,9 +138,10 @@  discard block
 block discarded – undo
133 138
 								<option value="empty">(', $txt['permissions_select_membergroup'], ')</option>';
134 139
 		foreach ($context['groups'] as $group)
135 140
 		{
136
-			if ($group['id'] != 1)
137
-				echo '
141
+			if ($group['id'] != 1) {
142
+							echo '
138 143
 								<option value="', $group['id'], '">', $group['name'], '</option>';
144
+			}
139 145
 		}
140 146
 
141 147
 		echo '
@@ -145,9 +151,10 @@  discard block
 block discarded – undo
145 151
 							<select name="add_remove">
146 152
 								<option value="add">', $txt['permissions_add'], '...</option>
147 153
 								<option value="clear">', $txt['permissions_remove'], '...</option>';
148
-		if (!empty($modSettings['permission_enable_deny']))
149
-			echo '
154
+		if (!empty($modSettings['permission_enable_deny'])) {
155
+					echo '
150 156
 								<option value="deny">', $txt['permissions_deny'], '...</option>';
157
+		}
151 158
 		echo '
152 159
 							</select>
153 160
 						</dt>
@@ -156,30 +163,34 @@  discard block
 block discarded – undo
156 163
 								<option value="">(', $txt['permissions_select_permission'], ')</option>';
157 164
 		foreach ($context['permissions'] as $permissionType)
158 165
 		{
159
-			if ($permissionType['id'] == 'membergroup' && !empty($context['profile']))
160
-				continue;
166
+			if ($permissionType['id'] == 'membergroup' && !empty($context['profile'])) {
167
+							continue;
168
+			}
161 169
 
162 170
 			foreach ($permissionType['columns'] as $column)
163 171
 			{
164 172
 				foreach ($column as $permissionGroup)
165 173
 				{
166
-					if ($permissionGroup['hidden'])
167
-						continue;
174
+					if ($permissionGroup['hidden']) {
175
+											continue;
176
+					}
168 177
 
169 178
 					echo '
170 179
 								<option value="" disabled>[', $permissionGroup['name'], ']</option>';
171 180
 					foreach ($permissionGroup['permissions'] as $perm)
172 181
 					{
173
-						if ($perm['hidden'])
174
-							continue;
182
+						if ($perm['hidden']) {
183
+													continue;
184
+						}
175 185
 
176
-						if ($perm['has_own_any'])
177
-							echo '
186
+						if ($perm['has_own_any']) {
187
+													echo '
178 188
 								<option value="', $permissionType['id'], '/', $perm['own']['id'], '">&nbsp;&nbsp;&nbsp;', $perm['name'], ' (', $perm['own']['name'], ')</option>
179 189
 								<option value="', $permissionType['id'], '/', $perm['any']['id'], '">&nbsp;&nbsp;&nbsp;', $perm['name'], ' (', $perm['any']['name'], ')</option>';
180
-						else
181
-							echo '
190
+						} else {
191
+													echo '
182 192
 								<option value="', $permissionType['id'], '/', $perm['id'], '">&nbsp;&nbsp;&nbsp;', $perm['name'], '</option>';
193
+						}
183 194
 					}
184 195
 				}
185 196
 			}
@@ -246,17 +257,18 @@  discard block
 block discarded – undo
246 257
 		}
247 258
 	</script>';
248 259
 
249
-		if (!empty($context['profile']))
250
-			echo '
260
+		if (!empty($context['profile'])) {
261
+					echo '
251 262
 			<input type="hidden" name="pid" value="', $context['profile']['id'], '">';
263
+		}
252 264
 
253 265
 		echo '
254 266
 			<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
255 267
 			<input type="hidden" name="', $context['admin-mpq_token_var'], '" value="', $context['admin-mpq_token'], '">';
256
-	}
257
-	else
258
-		echo '
268
+	} else {
269
+			echo '
259 270
 			</table>';
271
+	}
260 272
 
261 273
 	echo '
262 274
 		</form>
@@ -296,9 +308,10 @@  discard block
 block discarded – undo
296 308
 				<h3 class="subbg">', $category['name'], '</h3>
297 309
 			</div>';
298 310
 
299
-		if (!empty($category['boards']))
300
-			echo '
311
+		if (!empty($category['boards'])) {
312
+					echo '
301 313
 				<ul class="perm_boards flow_hidden">';
314
+		}
302 315
 
303 316
 		foreach ($category['boards'] as $board)
304 317
 		{
@@ -315,33 +328,36 @@  discard block
 block discarded – undo
315 328
 				echo '
316 329
 							<select name="boardprofile[', $board['id'], ']">';
317 330
 
318
-				foreach ($context['profiles'] as $id => $profile)
319
-					echo '
331
+				foreach ($context['profiles'] as $id => $profile) {
332
+									echo '
320 333
 								<option value="', $id, '"', $id == $board['profile'] ? ' selected' : '', '>', $profile['name'], '</option>';
334
+				}
321 335
 
322 336
 				echo '
323 337
 							</select>';
324
-			}
325
-			else
326
-				echo '
338
+			} else {
339
+							echo '
327 340
 							<a href="', $scripturl, '?action=admin;area=permissions;sa=index;pid=', $board['profile'], ';', $context['session_var'], '=', $context['session_id'], '">', $board['profile_name'], '</a>';
341
+			}
328 342
 
329 343
 			echo '
330 344
 						</span>
331 345
 					</li>';
332 346
 		}
333 347
 
334
-		if (!empty($category['boards']))
335
-			echo '
348
+		if (!empty($category['boards'])) {
349
+					echo '
336 350
 				</ul>';
351
+		}
337 352
 	}
338 353
 
339
-	if ($context['edit_all'])
340
-		echo '
354
+	if ($context['edit_all']) {
355
+			echo '
341 356
 			<input type="submit" name="save_changes" value="', $txt['save'], '" class="button">';
342
-	else
343
-		echo '
357
+	} else {
358
+			echo '
344 359
 			<a class="button" href="', $scripturl, '?action=admin;area=permissions;sa=board;edit;', $context['session_var'], '=', $context['session_id'], '">', $txt['permissions_board_all'], '</a>';
360
+	}
345 361
 
346 362
 	echo '
347 363
 			<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
@@ -381,12 +397,13 @@  discard block
 block discarded – undo
381 397
 					<tr class="windowbg">
382 398
 						<td>';
383 399
 
384
-		if (!empty($context['show_rename_boxes']) && $profile['can_edit'])
385
-			echo '
400
+		if (!empty($context['show_rename_boxes']) && $profile['can_edit']) {
401
+					echo '
386 402
 							<input type="text" name="rename_profile[', $profile['id'], ']" value="', $profile['name'], '">';
387
-		else
388
-			echo '
403
+		} else {
404
+					echo '
389 405
 							<a href="', $scripturl, '?action=admin;area=permissions;sa=index;pid=', $profile['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $profile['name'], '</a>';
406
+		}
390 407
 
391 408
 		echo '
392 409
 						</td>
@@ -406,9 +423,10 @@  discard block
 block discarded – undo
406 423
 				<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
407 424
 				<input type="hidden" name="', $context['admin-mpp_token_var'], '" value="', $context['admin-mpp_token'], '">';
408 425
 
409
-	if ($context['can_edit_something'])
410
-		echo '
426
+	if ($context['can_edit_something']) {
427
+			echo '
411 428
 				<input type="submit" name="rename" value="', empty($context['show_rename_boxes']) ? $txt['permissions_profile_rename'] : $txt['permissions_commit'], '" class="button">';
429
+	}
412 430
 
413 431
 	echo '
414 432
 				<input type="submit" name="delete" value="', $txt['quickmod_delete_selected'], '" class="button" ', !empty($context['show_rename_boxes']) ? ' style="display:none"' : '', '/>
@@ -433,9 +451,10 @@  discard block
 block discarded – undo
433 451
 					<dd>
434 452
 						<select name="copy_from">';
435 453
 
436
-	foreach ($context['profiles'] as $id => $profile)
437
-		echo '
454
+	foreach ($context['profiles'] as $id => $profile) {
455
+			echo '
438 456
 							<option value="', $id, '">', $profile['name'], '</option>';
457
+	}
439 458
 
440 459
 	echo '
441 460
 						</select>
@@ -463,8 +482,7 @@  discard block
 block discarded – undo
463 482
 		<div class="errorbox">
464 483
 			', sprintf($txt['permission_cannot_edit'], $scripturl . '?action=admin;area=permissions;sa=profiles'), '
465 484
 		</div>';
466
-	}
467
-	else
485
+	} else
468 486
 	{
469 487
 		echo '
470 488
 		<script>
@@ -484,21 +502,23 @@  discard block
 block discarded – undo
484 502
 	<div id="admincenter">
485 503
 		<form id="permissions" action="', $scripturl, '?action=admin;area=permissions;sa=modify2;group=', $context['group']['id'], ';pid=', $context['profile']['id'], '" method="post" accept-charset="', $context['character_set'], '" name="permissionForm" onsubmit="return warnAboutDeny();">';
486 504
 
487
-	if (!empty($modSettings['permission_enable_deny']) && $context['group']['id'] != -1)
488
-		echo '
505
+	if (!empty($modSettings['permission_enable_deny']) && $context['group']['id'] != -1) {
506
+			echo '
489 507
 			<div class="information">
490 508
 				', $txt['permissions_option_desc'], '
491 509
 			</div>';
510
+	}
492 511
 
493 512
 	echo '
494 513
 			<div class="cat_bar">
495 514
 				<h3 class="catbg">';
496
-	if ($context['permission_type'] == 'board')
497
-		echo '
515
+	if ($context['permission_type'] == 'board') {
516
+			echo '
498 517
 				', $txt['permissions_local_for'], ' &quot;', $context['group']['name'], '&quot; ', $txt['permissions_on'], ' &quot;', $context['profile']['name'], '&quot;';
499
-	else
500
-		echo '
518
+	} else {
519
+			echo '
501 520
 				', $context['permission_type'] == 'membergroup' ? $txt['permissions_general'] : $txt['permissions_board'], ' - &quot;', $context['group']['name'], '&quot;';
521
+	}
502 522
 	echo '
503 523
 				</h3>
504 524
 			</div>';
@@ -521,15 +541,17 @@  discard block
 block discarded – undo
521 541
 		template_modify_group_display('board');
522 542
 	}
523 543
 
524
-	if ($context['profile']['can_modify'])
525
-		echo '
544
+	if ($context['profile']['can_modify']) {
545
+			echo '
526 546
 			<div class="padding">
527 547
 				<input type="submit" value="', $txt['permissions_commit'], '" class="button">
528 548
 			</div>';
549
+	}
529 550
 
530
-	foreach ($context['hidden_perms'] as $hidden_perm)
531
-		echo '
551
+	foreach ($context['hidden_perms'] as $hidden_perm) {
552
+			echo '
532 553
 			<input type="hidden" name="perm[', $hidden_perm[0], '][', $hidden_perm[1], ']" value="', $hidden_perm[2], '">';
554
+	}
533 555
 
534 556
 	echo '
535 557
 			<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
@@ -557,17 +579,19 @@  discard block
 block discarded – undo
557 579
 
558 580
 		foreach ($column as $permissionGroup)
559 581
 		{
560
-			if (empty($permissionGroup['permissions']))
561
-				continue;
582
+			if (empty($permissionGroup['permissions'])) {
583
+							continue;
584
+			}
562 585
 
563 586
 			// Are we likely to have something in this group to display or is it all hidden?
564 587
 			$has_display_content = false;
565 588
 			if (!$permissionGroup['hidden'])
566 589
 			{
567 590
 				// Before we go any further check we are going to have some data to print otherwise we just have a silly heading.
568
-				foreach ($permissionGroup['permissions'] as $permission)
569
-					if (!$permission['hidden'])
591
+				foreach ($permissionGroup['permissions'] as $permission) {
592
+									if (!$permission['hidden'])
570 593
 						$has_display_content = true;
594
+				}
571 595
 
572 596
 				if ($has_display_content)
573 597
 				{
@@ -576,10 +600,11 @@  discard block
 block discarded – undo
576 600
 							<th></th>
577 601
 							<th', $context['group']['id'] == -1 ? ' colspan="2"' : '', ' class="smalltext">', $permissionGroup['name'], '</th>';
578 602
 
579
-					if ($context['group']['id'] != -1)
580
-						echo '
603
+					if ($context['group']['id'] != -1) {
604
+											echo '
581 605
 							<th>', $txt['permissions_option_own'], '</th>
582 606
 							<th>', $txt['permissions_option_any'], '</th>';
607
+					}
583 608
 
584 609
 						echo '
585 610
 						</tr>';
@@ -602,17 +627,18 @@  discard block
 block discarded – undo
602 627
 						// Guests can't do their own thing.
603 628
 						if ($context['group']['id'] != -1)
604 629
 						{
605
-							if (empty($modSettings['permission_enable_deny']))
606
-								echo '
630
+							if (empty($modSettings['permission_enable_deny'])) {
631
+															echo '
607 632
 								<input type="checkbox" name="perm[', $permission_type['id'], '][', $permission['own']['id'], ']"', $permission['own']['select'] == 'on' ? ' checked="checked"' : '', ' value="on" id="', $permission['own']['id'], '_on" ', $disable_field, '/>';
608
-							else
633
+							} else
609 634
 							{
610 635
 								echo '
611 636
 								<select name="perm[', $permission_type['id'], '][', $permission['own']['id'], ']" ', $disable_field, '>';
612 637
 
613
-								foreach (array('on', 'off', 'deny') as $c)
614
-									echo '
638
+								foreach (array('on', 'off', 'deny') as $c) {
639
+																	echo '
615 640
 									<option ', $permission['own']['select'] == $c ? ' selected' : '', ' value="', $c, '">', $txt['permissions_option_' . $c], '</option>';
641
+								}
616 642
 							echo '
617 643
 								</select>';
618 644
 							}
@@ -622,39 +648,41 @@  discard block
 block discarded – undo
622 648
 							<td>';
623 649
 						}
624 650
 
625
-						if (empty($modSettings['permission_enable_deny']) || $context['group']['id'] == -1)
626
-							echo '
651
+						if (empty($modSettings['permission_enable_deny']) || $context['group']['id'] == -1) {
652
+													echo '
627 653
 								<input type="checkbox" name="perm[', $permission_type['id'], '][', $permission['any']['id'], ']"', $permission['any']['select'] == 'on' ? ' checked="checked"' : '', ' value="on" ', $disable_field, '/>';
628
-						else
654
+						} else
629 655
 						{
630 656
 							echo '
631 657
 								<select name="perm[', $permission_type['id'], '][', $permission['any']['id'], ']" ', $disable_field, '>';
632 658
 
633
-							foreach (array('on', 'off', 'deny') as $c)
634
-								echo '
659
+							foreach (array('on', 'off', 'deny') as $c) {
660
+															echo '
635 661
 									<option ', $permission['any']['select'] == $c ? ' selected' : '', ' value="', $c, '">', $txt['permissions_option_' . $c], '</option>';
662
+							}
636 663
 							echo '
637 664
 								</select>';
638 665
 						}
639
-					}
640
-					else
666
+					} else
641 667
 					{
642
-						if ($context['group']['id'] != -1)
643
-							echo '
668
+						if ($context['group']['id'] != -1) {
669
+													echo '
644 670
 							</td>
645 671
 							<td>';
672
+						}
646 673
 
647
-						if (empty($modSettings['permission_enable_deny']) || $context['group']['id'] == -1)
648
-							echo '
674
+						if (empty($modSettings['permission_enable_deny']) || $context['group']['id'] == -1) {
675
+													echo '
649 676
 								<input type="checkbox" name="perm[', $permission_type['id'], '][', $permission['id'], ']"', $permission['select'] == 'on' ? ' checked="checked"' : '', ' value="on" ', $disable_field, '/>';
650
-						else
677
+						} else
651 678
 						{
652 679
 							echo '
653 680
 								<select name="perm[', $permission_type['id'], '][', $permission['id'], ']" ', $disable_field, '>';
654 681
 
655
-							foreach (array('on', 'off', 'deny') as $c)
656
-								echo '
682
+							foreach (array('on', 'off', 'deny') as $c) {
683
+															echo '
657 684
 									<option ', $permission['select'] == $c ? ' selected' : '', ' value="', $c, '">', $txt['permissions_option_' . $c], '</option>';
685
+							}
658 686
 							echo '
659 687
 								</select>';
660 688
 						}
@@ -684,11 +712,11 @@  discard block
 block discarded – undo
684 712
 	echo '
685 713
 											<fieldset id="', $context['current_permission'], '">
686 714
 												<legend><a href="javascript:void(0);" onclick="document.getElementById(\'', $context['current_permission'], '\').style.display = \'none\';document.getElementById(\'', $context['current_permission'], '_groups_link\').style.display = \'block\'; return false;" class="toggle_up"> ', $txt['avatar_select_permission'], '</a></legend>';
687
-	if (empty($modSettings['permission_enable_deny']))
688
-		echo '
715
+	if (empty($modSettings['permission_enable_deny'])) {
716
+			echo '
689 717
 												<ul>';
690
-	else
691
-		echo '
718
+	} else {
719
+			echo '
692 720
 												<div class="information">', $txt['permissions_option_desc'], '</div>
693 721
 												<dl class="settings">
694 722
 													<dt>
@@ -698,46 +726,51 @@  discard block
 block discarded – undo
698 726
 													</dt>
699 727
 													<dd>
700 728
 													</dd>';
729
+	}
701 730
 	foreach ($context['member_groups'] as $group)
702 731
 	{
703
-		if (!empty($modSettings['permission_enable_deny']))
704
-			echo '
732
+		if (!empty($modSettings['permission_enable_deny'])) {
733
+					echo '
705 734
 													<dt>';
706
-		else
707
-			echo '
735
+		} else {
736
+					echo '
708 737
 													<li>';
738
+		}
709 739
 
710
-		if (empty($modSettings['permission_enable_deny']))
711
-			echo '
740
+		if (empty($modSettings['permission_enable_deny'])) {
741
+					echo '
712 742
 														<input type="checkbox" name="', $context['current_permission'], '[', $group['id'], ']" value="on"', $group['status'] == 'on' ? ' checked' : '', '>';
713
-		else
714
-			echo '
743
+		} else {
744
+					echo '
715 745
 														<span class="perms"><input type="radio" name="', $context['current_permission'], '[', $group['id'], ']" value="on"', $group['status'] == 'on' ? ' checked' : '', '></span>
716 746
 														<span class="perms"><input type="radio" name="', $context['current_permission'], '[', $group['id'], ']" value="off"', $group['status'] == 'off' ? ' checked' : '', '></span>
717 747
 														<span class="perms"><input type="radio" name="', $context['current_permission'], '[', $group['id'], ']" value="deny"', $group['status'] == 'deny' ? ' checked' : '', '></span>';
748
+		}
718 749
 
719
-		if (!empty($modSettings['permission_enable_deny']))
720
-			echo '
750
+		if (!empty($modSettings['permission_enable_deny'])) {
751
+					echo '
721 752
 													</dt>
722 753
 													<dd>
723 754
 														<span', $group['is_postgroup'] ? ' style="font-style: italic;"' : '', '>', $group['name'], '</span>
724 755
 													</dd>';
725
-		else
726
-			echo '
756
+		} else {
757
+					echo '
727 758
 														<span', $group['is_postgroup'] ? ' style="font-style: italic;"' : '', '>', $group['name'], '</span>
728 759
 													</li>';
760
+		}
729 761
 	}
730 762
 
731
-	if (empty($modSettings['permission_enable_deny']))
732
-		echo '
763
+	if (empty($modSettings['permission_enable_deny'])) {
764
+			echo '
733 765
 													<li>
734 766
 														<input type="checkbox" onclick="invertAll(this, this.form, \''. $context['current_permission'] . '[\');">
735 767
 														<span>', $txt['check_all'], '</span>
736 768
 													</li>
737 769
 												</ul>';
738
-	else
739
-		echo '
770
+	} else {
771
+			echo '
740 772
 												</dl>';
773
+	}
741 774
 
742 775
 	echo '
743 776
 											</fieldset>
@@ -777,9 +810,10 @@  discard block
 block discarded – undo
777 810
 	if (!empty($modSettings['postmod_active']))
778 811
 	{
779 812
 		// Got advanced permissions - if so warn!
780
-		if (!empty($modSettings['permission_enable_deny']))
781
-			echo '
813
+		if (!empty($modSettings['permission_enable_deny'])) {
814
+					echo '
782 815
 							<div class="information">', $txt['permissions_post_moderation_deny_note'], '</div>';
816
+		}
783 817
 
784 818
 		echo '
785 819
 							<div class="padding">
@@ -794,10 +828,11 @@  discard block
 block discarded – undo
794 828
 									', $txt['permissions_post_moderation_select'], ':
795 829
 									<select name="pid" onchange="document.forms.postmodForm.submit();">';
796 830
 
797
-		foreach ($context['profiles'] as $profile)
798
-			if ($profile['can_modify'])
831
+		foreach ($context['profiles'] as $profile) {
832
+					if ($profile['can_modify'])
799 833
 				echo '
800 834
 										<option value="', $profile['id'], '"', $profile['id'] == $context['current_profile'] ? ' selected' : '', '>', $profile['name'], '</option>';
835
+		}
801 836
 
802 837
 		echo '
803 838
 									</select>
@@ -818,11 +853,12 @@  discard block
 block discarded – undo
818 853
 											', $txt['permissions_post_moderation_replies_any'], '
819 854
 										</th>';
820 855
 
821
-		if ($modSettings['attachmentEnable'] == 1)
822
-			echo '
856
+		if ($modSettings['attachmentEnable'] == 1) {
857
+					echo '
823 858
 										<th class="centercol" colspan="3">
824 859
 											', $txt['permissions_post_moderation_attachments'], '
825 860
 										</th>';
861
+		}
826 862
 
827 863
 		echo '
828 864
 									</tr>
@@ -840,11 +876,12 @@  discard block
 block discarded – undo
840 876
 										<th><span class="generic_icons post_moderation_moderate"></span></th>
841 877
 										<th><span class="generic_icons post_moderation_deny"></span></th>';
842 878
 
843
-		if ($modSettings['attachmentEnable'] == 1)
844
-			echo '
879
+		if ($modSettings['attachmentEnable'] == 1) {
880
+					echo '
845 881
 										<th><span class="generic_icons post_moderation_allow"></span></th>
846 882
 										<th><span class="generic_icons post_moderation_moderate"></span></th>
847 883
 										<th><span class="generic_icons post_moderation_deny"></span></th>';
884
+		}
848 885
 
849 886
 		echo '
850 887
 									</tr>
@@ -857,9 +894,10 @@  discard block
 block discarded – undo
857 894
 									<tr class="windowbg">
858 895
 										<td class="half_table">
859 896
 											<span ', ($group['color'] ? 'style="color: ' . $group['color'] . '"' : ''), '>', $group['name'], '</span>';
860
-				if (!empty($group['children']))
861
-					echo '
897
+				if (!empty($group['children'])) {
898
+									echo '
862 899
 											<br><span class="smalltext">', $txt['permissions_includes_inherited'], ': &quot;', implode('&quot;, &quot;', $group['children']), '&quot;</span>';
900
+				}
863 901
 
864 902
 				echo '
865 903
 										</td>
@@ -872,8 +910,7 @@  discard block
 block discarded – undo
872 910
 				{
873 911
 				echo '
874 912
 										<td colspan="3"></td>';
875
-				}
876
-				else
913
+				} else
877 914
 				{
878 915
 					echo '
879 916
 										<td class="centercol"><input type="radio" name="replies_own[', $group['id'], ']" value="allow"', $group['replies_own'] == 'allow' ? ' checked' : '', '></td>
Please login to merge, or discard this patch.
Sources/ManageMembers.php 1 patch
Braces   +158 added lines, -116 removed lines patch added patch discarded remove patch
@@ -13,8 +13,9 @@  discard block
 block discarded – undo
13 13
  * @version 2.1 Beta 4
14 14
  */
15 15
 
16
-if (!defined('SMF'))
16
+if (!defined('SMF')) {
17 17
 	die('No direct access...');
18
+}
18 19
 
19 20
 /**
20 21
  * The main entrance point for the Manage Members screen.
@@ -62,16 +63,18 @@  discard block
 block discarded – undo
62 63
 	$context['activation_numbers'] = array();
63 64
 	$context['awaiting_activation'] = 0;
64 65
 	$context['awaiting_approval'] = 0;
65
-	while ($row = $smcFunc['db_fetch_assoc']($request))
66
-		$context['activation_numbers'][$row['is_activated']] = $row['total_members'];
66
+	while ($row = $smcFunc['db_fetch_assoc']($request)) {
67
+			$context['activation_numbers'][$row['is_activated']] = $row['total_members'];
68
+	}
67 69
 	$smcFunc['db_free_result']($request);
68 70
 
69 71
 	foreach ($context['activation_numbers'] as $activation_type => $total_members)
70 72
 	{
71
-		if (in_array($activation_type, array(0, 2)))
72
-			$context['awaiting_activation'] += $total_members;
73
-		elseif (in_array($activation_type, array(3, 4, 5)))
74
-			$context['awaiting_approval'] += $total_members;
73
+		if (in_array($activation_type, array(0, 2))) {
74
+					$context['awaiting_activation'] += $total_members;
75
+		} elseif (in_array($activation_type, array(3, 4, 5))) {
76
+					$context['awaiting_approval'] += $total_members;
77
+		}
75 78
 	}
76 79
 
77 80
 	// For the page header... do we show activation?
@@ -124,8 +127,9 @@  discard block
 block discarded – undo
124 127
 	}
125 128
 	if (!$context['show_approve'] && ($_REQUEST['sa'] != 'browse' || $_REQUEST['type'] != 'approve'))
126 129
 	{
127
-		if (!$context['show_activate'] && ($_REQUEST['sa'] != 'browse' || $_REQUEST['type'] != 'activate'))
128
-			$context['tabs']['search']['is_last'] = true;
130
+		if (!$context['show_activate'] && ($_REQUEST['sa'] != 'browse' || $_REQUEST['type'] != 'activate')) {
131
+					$context['tabs']['search']['is_last'] = true;
132
+		}
129 133
 		unset($context['tabs']['approve']);
130 134
 	}
131 135
 
@@ -157,8 +161,9 @@  discard block
 block discarded – undo
157 161
 		foreach ($_POST['delete'] as $key => $value)
158 162
 		{
159 163
 			// Don't delete yourself, idiot.
160
-			if ($value != $user_info['id'])
161
-				$delete[$key] = (int) $value;
164
+			if ($value != $user_info['id']) {
165
+							$delete[$key] = (int) $value;
166
+			}
162 167
 		}
163 168
 
164 169
 		if (!empty($delete))
@@ -194,17 +199,18 @@  discard block
 block discarded – undo
194 199
 		);
195 200
 		while ($row = $smcFunc['db_fetch_assoc']($request))
196 201
 		{
197
-			if ($row['min_posts'] == -1)
198
-				$context['membergroups'][] = array(
202
+			if ($row['min_posts'] == -1) {
203
+							$context['membergroups'][] = array(
199 204
 					'id' => $row['id_group'],
200 205
 					'name' => $row['group_name'],
201 206
 					'can_be_additional' => true
202 207
 				);
203
-			else
204
-				$context['postgroups'][] = array(
208
+			} else {
209
+							$context['postgroups'][] = array(
205 210
 					'id' => $row['id_group'],
206 211
 					'name' => $row['group_name']
207 212
 				);
213
+			}
208 214
 		}
209 215
 		$smcFunc['db_free_result']($request);
210 216
 
@@ -268,14 +274,15 @@  discard block
 block discarded – undo
268 274
 		call_integration_hook('integrate_view_members_params', array(&$params));
269 275
 
270 276
 		$search_params = array();
271
-		if ($context['sub_action'] == 'query' && !empty($_REQUEST['params']) && empty($_POST['types']))
272
-			$search_params = $smcFunc['json_decode'](base64_decode($_REQUEST['params']), true);
273
-		elseif (!empty($_POST))
277
+		if ($context['sub_action'] == 'query' && !empty($_REQUEST['params']) && empty($_POST['types'])) {
278
+					$search_params = $smcFunc['json_decode'](base64_decode($_REQUEST['params']), true);
279
+		} elseif (!empty($_POST))
274 280
 		{
275 281
 			$search_params['types'] = $_POST['types'];
276
-			foreach ($params as $param_name => $param_info)
277
-				if (isset($_POST[$param_name]))
282
+			foreach ($params as $param_name => $param_info) {
283
+							if (isset($_POST[$param_name]))
278 284
 					$search_params[$param_name] = $_POST[$param_name];
285
+			}
279 286
 		}
280 287
 
281 288
 		$search_url_params = isset($search_params) ? base64_encode($smcFunc['json_encode']($search_params)) : null;
@@ -288,18 +295,21 @@  discard block
 block discarded – undo
288 295
 		foreach ($params as $param_name => $param_info)
289 296
 		{
290 297
 			// Not filled in?
291
-			if (!isset($search_params[$param_name]) || $search_params[$param_name] === '')
292
-				continue;
298
+			if (!isset($search_params[$param_name]) || $search_params[$param_name] === '') {
299
+							continue;
300
+			}
293 301
 
294 302
 			// Make sure numeric values are really numeric.
295
-			if (in_array($param_info['type'], array('int', 'age')))
296
-				$search_params[$param_name] = (int) $search_params[$param_name];
303
+			if (in_array($param_info['type'], array('int', 'age'))) {
304
+							$search_params[$param_name] = (int) $search_params[$param_name];
305
+			}
297 306
 			// Date values have to match the specified format.
298 307
 			elseif ($param_info['type'] == 'date')
299 308
 			{
300 309
 				// Check if this date format is valid.
301
-				if (preg_match('/^\d{4}-\d{1,2}-\d{1,2}$/', $search_params[$param_name]) == 0)
302
-					continue;
310
+				if (preg_match('/^\d{4}-\d{1,2}-\d{1,2}$/', $search_params[$param_name]) == 0) {
311
+									continue;
312
+				}
303 313
 
304 314
 				$search_params[$param_name] = strtotime($search_params[$param_name]);
305 315
 			}
@@ -308,8 +318,9 @@  discard block
 block discarded – undo
308 318
 			if (!empty($param_info['range']))
309 319
 			{
310 320
 				// Default to '=', just in case...
311
-				if (empty($range_trans[$search_params['types'][$param_name]]))
312
-					$search_params['types'][$param_name] = '=';
321
+				if (empty($range_trans[$search_params['types'][$param_name]])) {
322
+									$search_params['types'][$param_name] = '=';
323
+				}
313 324
 
314 325
 				// Handle special case 'age'.
315 326
 				if ($param_info['type'] == 'age')
@@ -337,29 +348,30 @@  discard block
 block discarded – undo
337 348
 				elseif ($param_info['type'] == 'date' && $search_params['types'][$param_name] == '=')
338 349
 				{
339 350
 					$query_parts[] = $param_info['db_fields'][0] . ' > ' . $search_params[$param_name] . ' AND ' . $param_info['db_fields'][0] . ' < ' . ($search_params[$param_name] + 86400);
351
+				} else {
352
+									$query_parts[] = $param_info['db_fields'][0] . ' ' . $range_trans[$search_params['types'][$param_name]] . ' ' . $search_params[$param_name];
340 353
 				}
341
-				else
342
-					$query_parts[] = $param_info['db_fields'][0] . ' ' . $range_trans[$search_params['types'][$param_name]] . ' ' . $search_params[$param_name];
343 354
 			}
344 355
 			// Checkboxes.
345 356
 			elseif ($param_info['type'] == 'checkbox')
346 357
 			{
347 358
 				// Each checkbox or no checkbox at all is checked -> ignore.
348
-				if (!is_array($search_params[$param_name]) || count($search_params[$param_name]) == 0 || count($search_params[$param_name]) == count($param_info['values']))
349
-					continue;
359
+				if (!is_array($search_params[$param_name]) || count($search_params[$param_name]) == 0 || count($search_params[$param_name]) == count($param_info['values'])) {
360
+									continue;
361
+				}
350 362
 
351 363
 				$query_parts[] = ($param_info['db_fields'][0]) . ' IN ({array_string:' . $param_name . '_check})';
352 364
 				$where_params[$param_name . '_check'] = $search_params[$param_name];
353
-			}
354
-			else
365
+			} else
355 366
 			{
356 367
 				// Replace the wildcard characters ('*' and '?') into MySQL ones.
357 368
 				$parameter = strtolower(strtr($smcFunc['htmlspecialchars']($search_params[$param_name], ENT_QUOTES), array('%' => '\%', '_' => '\_', '*' => '%', '?' => '_')));
358 369
 
359
-				if ($smcFunc['db_case_sensitive'])
360
-					$query_parts[] = '(LOWER(' . implode(') LIKE {string:' . $param_name . '_normal} OR LOWER(', $param_info['db_fields']) . ') LIKE {string:' . $param_name . '_normal})';
361
-				else
362
-					$query_parts[] = '(' . implode(' LIKE {string:' . $param_name . '_normal} OR ', $param_info['db_fields']) . ' LIKE {string:' . $param_name . '_normal})';
370
+				if ($smcFunc['db_case_sensitive']) {
371
+									$query_parts[] = '(LOWER(' . implode(') LIKE {string:' . $param_name . '_normal} OR LOWER(', $param_info['db_fields']) . ') LIKE {string:' . $param_name . '_normal})';
372
+				} else {
373
+									$query_parts[] = '(' . implode(' LIKE {string:' . $param_name . '_normal} OR ', $param_info['db_fields']) . ' LIKE {string:' . $param_name . '_normal})';
374
+				}
363 375
 				$where_params[$param_name . '_normal'] = '%' . $parameter . '%';
364 376
 			}
365 377
 		}
@@ -375,16 +387,18 @@  discard block
 block discarded – undo
375 387
 		}
376 388
 
377 389
 		// Additional membergroups (these are only relevant if not all primary groups where selected!).
378
-		if (!empty($search_params['membergroups'][2]) && (empty($search_params['membergroups'][1]) || count($context['membergroups']) != count($search_params['membergroups'][1])))
379
-			foreach ($search_params['membergroups'][2] as $mg)
390
+		if (!empty($search_params['membergroups'][2]) && (empty($search_params['membergroups'][1]) || count($context['membergroups']) != count($search_params['membergroups'][1]))) {
391
+					foreach ($search_params['membergroups'][2] as $mg)
380 392
 			{
381 393
 				$mg_query_parts[] = 'FIND_IN_SET({int:add_group_' . $mg . '}, mem.additional_groups) != 0';
394
+		}
382 395
 				$where_params['add_group_' . $mg] = $mg;
383 396
 			}
384 397
 
385 398
 		// Combine the one or two membergroup parts into one query part linked with an OR.
386
-		if (!empty($mg_query_parts))
387
-			$query_parts[] = '(' . implode(' OR ', $mg_query_parts) . ')';
399
+		if (!empty($mg_query_parts)) {
400
+					$query_parts[] = '(' . implode(' OR ', $mg_query_parts) . ')';
401
+		}
388 402
 
389 403
 		// Get all selected post count related membergroups.
390 404
 		if (!empty($search_params['postgroups']) && count($search_params['postgroups']) != count($context['postgroups']))
@@ -396,9 +410,9 @@  discard block
 block discarded – undo
396 410
 		// Construct the where part of the query.
397 411
 		$where = empty($query_parts) ? '1=1' : implode('
398 412
 			AND ', $query_parts);
413
+	} else {
414
+			$search_url_params = null;
399 415
 	}
400
-	else
401
-		$search_url_params = null;
402 416
 
403 417
 	// Construct the additional URL part with the query info in it.
404 418
 	$context['params_url'] = $context['sub_action'] == 'query' ? ';sa=query;params=' . $search_url_params : '';
@@ -521,28 +535,32 @@  discard block
 block discarded – undo
521 535
 					'function' => function($rowData) use ($txt)
522 536
 					{
523 537
 						// Calculate number of days since last online.
524
-						if (empty($rowData['last_login']))
525
-							$difference = $txt['never'];
526
-						else
538
+						if (empty($rowData['last_login'])) {
539
+													$difference = $txt['never'];
540
+						} else
527 541
 						{
528 542
 							$num_days_difference = jeffsdatediff($rowData['last_login']);
529 543
 
530 544
 							// Today.
531
-							if (empty($num_days_difference))
532
-								$difference = $txt['viewmembers_today'];
545
+							if (empty($num_days_difference)) {
546
+															$difference = $txt['viewmembers_today'];
547
+							}
533 548
 
534 549
 							// Yesterday.
535
-							elseif ($num_days_difference == 1)
536
-								$difference = sprintf('1 %1$s', $txt['viewmembers_day_ago']);
550
+							elseif ($num_days_difference == 1) {
551
+															$difference = sprintf('1 %1$s', $txt['viewmembers_day_ago']);
552
+							}
537 553
 
538 554
 							// X days ago.
539
-							else
540
-								$difference = sprintf('%1$d %2$s', $num_days_difference, $txt['viewmembers_days_ago']);
555
+							else {
556
+															$difference = sprintf('%1$d %2$s', $num_days_difference, $txt['viewmembers_days_ago']);
557
+							}
541 558
 						}
542 559
 
543 560
 						// Show it in italics if they're not activated...
544
-						if ($rowData['is_activated'] % 10 != 1)
545
-							$difference = sprintf('<em title="%1$s">%2$s</em>', $txt['not_activated'], $difference);
561
+						if ($rowData['is_activated'] % 10 != 1) {
562
+													$difference = sprintf('<em title="%1$s">%2$s</em>', $txt['not_activated'], $difference);
563
+						}
546 564
 
547 565
 						return $difference;
548 566
 					},
@@ -594,8 +612,9 @@  discard block
 block discarded – undo
594 612
 	);
595 613
 
596 614
 	// Without enough permissions, don't show 'delete members' checkboxes.
597
-	if (!allowedTo('profile_remove_any'))
598
-		unset($listOptions['cols']['check'], $listOptions['form'], $listOptions['additional_rows']);
615
+	if (!allowedTo('profile_remove_any')) {
616
+			unset($listOptions['cols']['check'], $listOptions['form'], $listOptions['additional_rows']);
617
+	}
599 618
 
600 619
 	require_once($sourcedir . '/Subs-List.php');
601 620
 	createList($listOptions);
@@ -638,17 +657,18 @@  discard block
 block discarded – undo
638 657
 	);
639 658
 	while ($row = $smcFunc['db_fetch_assoc']($request))
640 659
 	{
641
-		if ($row['min_posts'] == -1)
642
-			$context['membergroups'][] = array(
660
+		if ($row['min_posts'] == -1) {
661
+					$context['membergroups'][] = array(
643 662
 				'id' => $row['id_group'],
644 663
 				'name' => $row['group_name'],
645 664
 				'can_be_additional' => true
646 665
 			);
647
-		else
648
-			$context['postgroups'][] = array(
666
+		} else {
667
+					$context['postgroups'][] = array(
649 668
 				'id' => $row['id_group'],
650 669
 				'name' => $row['group_name']
651 670
 			);
671
+		}
652 672
 	}
653 673
 	$smcFunc['db_free_result']($request);
654 674
 
@@ -675,8 +695,9 @@  discard block
 block discarded – undo
675 695
 	$context['page_title'] = $txt['admin_members'];
676 696
 	$context['sub_template'] = 'admin_browse';
677 697
 	$context['browse_type'] = isset($_REQUEST['type']) ? $_REQUEST['type'] : (!empty($modSettings['registration_method']) && $modSettings['registration_method'] == 1 ? 'activate' : 'approve');
678
-	if (isset($context['tabs'][$context['browse_type']]))
679
-		$context['tabs'][$context['browse_type']]['is_selected'] = true;
698
+	if (isset($context['tabs'][$context['browse_type']])) {
699
+			$context['tabs'][$context['browse_type']]['is_selected'] = true;
700
+	}
680 701
 
681 702
 	// Allowed filters are those we can have, in theory.
682 703
 	$context['allowed_filters'] = $context['browse_type'] == 'approve' ? array(3, 4, 5) : array(0, 2);
@@ -687,18 +708,20 @@  discard block
 block discarded – undo
687 708
 	foreach ($context['activation_numbers'] as $type => $amount)
688 709
 	{
689 710
 		// We have some of these...
690
-		if (in_array($type, $context['allowed_filters']) && $amount > 0)
691
-			$context['available_filters'][] = array(
711
+		if (in_array($type, $context['allowed_filters']) && $amount > 0) {
712
+					$context['available_filters'][] = array(
692 713
 				'type' => $type,
693 714
 				'amount' => $amount,
694 715
 				'desc' => isset($txt['admin_browse_filter_type_' . $type]) ? $txt['admin_browse_filter_type_' . $type] : '?',
695 716
 				'selected' => $type == $context['current_filter']
696 717
 			);
718
+		}
697 719
 	}
698 720
 
699 721
 	// If the filter was not sent, set it to whatever has people in it!
700
-	if ($context['current_filter'] == -1 && !empty($context['available_filters'][0]['amount']))
701
-		$context['current_filter'] = $context['available_filters'][0]['type'];
722
+	if ($context['current_filter'] == -1 && !empty($context['available_filters'][0]['amount'])) {
723
+			$context['current_filter'] = $context['available_filters'][0]['type'];
724
+	}
702 725
 
703 726
 	// This little variable is used to determine if we should flag where we are looking.
704 727
 	$context['show_filter'] = ($context['current_filter'] != 0 && $context['current_filter'] != 3) || count($context['available_filters']) > 1;
@@ -713,44 +736,47 @@  discard block
 block discarded – undo
713 736
 	);
714 737
 
715 738
 	// Are we showing duplicate information?
716
-	if (isset($_GET['showdupes']))
717
-		$_SESSION['showdupes'] = (int) $_GET['showdupes'];
739
+	if (isset($_GET['showdupes'])) {
740
+			$_SESSION['showdupes'] = (int) $_GET['showdupes'];
741
+	}
718 742
 	$context['show_duplicates'] = !empty($_SESSION['showdupes']);
719 743
 
720 744
 	// Determine which actions we should allow on this page.
721 745
 	if ($context['browse_type'] == 'approve')
722 746
 	{
723 747
 		// If we are approving deleted accounts we have a slightly different list... actually a mirror ;)
724
-		if ($context['current_filter'] == 4)
725
-			$context['allowed_actions'] = array(
748
+		if ($context['current_filter'] == 4) {
749
+					$context['allowed_actions'] = array(
726 750
 				'reject' => $txt['admin_browse_w_approve_deletion'],
727 751
 				'ok' => $txt['admin_browse_w_reject'],
728 752
 			);
729
-		else
730
-			$context['allowed_actions'] = array(
753
+		} else {
754
+					$context['allowed_actions'] = array(
731 755
 				'ok' => $txt['admin_browse_w_approve'],
732 756
 				'okemail' => $txt['admin_browse_w_approve'] . ' ' . $txt['admin_browse_w_email'],
733 757
 				'require_activation' => $txt['admin_browse_w_approve_require_activate'],
734 758
 				'reject' => $txt['admin_browse_w_reject'],
735 759
 				'rejectemail' => $txt['admin_browse_w_reject'] . ' ' . $txt['admin_browse_w_email'],
736 760
 			);
737
-	}
738
-	elseif ($context['browse_type'] == 'activate')
739
-		$context['allowed_actions'] = array(
761
+		}
762
+	} elseif ($context['browse_type'] == 'activate') {
763
+			$context['allowed_actions'] = array(
740 764
 			'ok' => $txt['admin_browse_w_activate'],
741 765
 			'okemail' => $txt['admin_browse_w_activate'] . ' ' . $txt['admin_browse_w_email'],
742 766
 			'delete' => $txt['admin_browse_w_delete'],
743 767
 			'deleteemail' => $txt['admin_browse_w_delete'] . ' ' . $txt['admin_browse_w_email'],
744 768
 			'remind' => $txt['admin_browse_w_remind'] . ' ' . $txt['admin_browse_w_email'],
745 769
 		);
770
+	}
746 771
 
747 772
 	// Create an option list for actions allowed to be done with selected members.
748 773
 	$allowed_actions = '
749 774
 			<option selected value="">' . $txt['admin_browse_with_selected'] . ':</option>
750 775
 			<option value="" disabled>-----------------------------</option>';
751
-	foreach ($context['allowed_actions'] as $key => $desc)
752
-		$allowed_actions .= '
776
+	foreach ($context['allowed_actions'] as $key => $desc) {
777
+			$allowed_actions .= '
753 778
 			<option value="' . $key . '">' . $desc . '</option>';
779
+	}
754 780
 
755 781
 	// Setup the Javascript function for selecting an action for the list.
756 782
 	$javascript = '
@@ -762,15 +788,16 @@  discard block
 block discarded – undo
762 788
 			var message = "";';
763 789
 
764 790
 	// We have special messages for approving deletion of accounts - it's surprisingly logical - honest.
765
-	if ($context['current_filter'] == 4)
766
-		$javascript .= '
791
+	if ($context['current_filter'] == 4) {
792
+			$javascript .= '
767 793
 			if (document.forms.postForm.todo.value.indexOf("reject") != -1)
768 794
 				message = "' . $txt['admin_browse_w_delete'] . '";
769 795
 			else
770 796
 				message = "' . $txt['admin_browse_w_reject'] . '";';
797
+	}
771 798
 	// Otherwise a nice standard message.
772
-	else
773
-		$javascript .= '
799
+	else {
800
+			$javascript .= '
774 801
 			if (document.forms.postForm.todo.value.indexOf("delete") != -1)
775 802
 				message = "' . $txt['admin_browse_w_delete'] . '";
776 803
 			else if (document.forms.postForm.todo.value.indexOf("reject") != -1)
@@ -779,6 +806,7 @@  discard block
 block discarded – undo
779 806
 				message = "' . $txt['admin_browse_w_remind'] . '";
780 807
 			else
781 808
 				message = "' . ($context['browse_type'] == 'approve' ? $txt['admin_browse_w_approve'] : $txt['admin_browse_w_activate']) . '";';
809
+	}
782 810
 	$javascript .= '
783 811
 			if (confirm(message + " ' . $txt['admin_browse_warn'] . '"))
784 812
 				document.forms.postForm.submit();
@@ -911,10 +939,11 @@  discard block
 block discarded – undo
911 939
 						$member_links = array();
912 940
 						foreach ($rowData['duplicate_members'] as $member)
913 941
 						{
914
-							if ($member['id'])
915
-								$member_links[] = '<a href="' . $scripturl . '?action=profile;u=' . $member['id'] . '" ' . (!empty($member['is_banned']) ? 'class="red"' : '') . '>' . $member['name'] . '</a>';
916
-							else
917
-								$member_links[] = $member['name'] . ' (' . $txt['guest'] . ')';
942
+							if ($member['id']) {
943
+															$member_links[] = '<a href="' . $scripturl . '?action=profile;u=' . $member['id'] . '" ' . (!empty($member['is_banned']) ? 'class="red"' : '') . '>' . $member['name'] . '</a>';
944
+							} else {
945
+															$member_links[] = $member['name'] . ' (' . $txt['guest'] . ')';
946
+							}
918 947
 						}
919 948
 						return implode(', ', $member_links);
920 949
 					},
@@ -963,14 +992,16 @@  discard block
 block discarded – undo
963 992
 	);
964 993
 
965 994
 	// Pick what column to actually include if we're showing duplicates.
966
-	if ($context['show_duplicates'])
967
-		unset($listOptions['columns']['email']);
968
-	else
969
-		unset($listOptions['columns']['duplicates']);
995
+	if ($context['show_duplicates']) {
996
+			unset($listOptions['columns']['email']);
997
+	} else {
998
+			unset($listOptions['columns']['duplicates']);
999
+	}
970 1000
 
971 1001
 	// Only show hostname on duplicates as it takes a lot of time.
972
-	if (!$context['show_duplicates'] || !empty($modSettings['disableHostnameLookup']))
973
-		unset($listOptions['columns']['hostname']);
1002
+	if (!$context['show_duplicates'] || !empty($modSettings['disableHostnameLookup'])) {
1003
+			unset($listOptions['columns']['hostname']);
1004
+	}
974 1005
 
975 1006
 	// Is there any need to show filters?
976 1007
 	if (isset($context['available_filters']) && count($context['available_filters']) > 1)
@@ -978,9 +1009,10 @@  discard block
 block discarded – undo
978 1009
 		$filterOptions = '
979 1010
 			<strong>' . $txt['admin_browse_filter_by'] . ':</strong>
980 1011
 			<select name="filter" onchange="this.form.submit();">';
981
-		foreach ($context['available_filters'] as $filter)
982
-			$filterOptions .= '
1012
+		foreach ($context['available_filters'] as $filter) {
1013
+					$filterOptions .= '
983 1014
 				<option value="' . $filter['type'] . '"' . ($filter['selected'] ? ' selected' : '') . '>' . $filter['desc'] . ' - ' . $filter['amount'] . ' ' . ($filter['amount'] == 1 ? $txt['user'] : $txt['users']) . '</option>';
1015
+		}
984 1016
 		$filterOptions .= '
985 1017
 			</select>
986 1018
 			<noscript><input type="submit" value="' . $txt['go'] . '" name="filter" class="button"></noscript>';
@@ -992,12 +1024,13 @@  discard block
 block discarded – undo
992 1024
 	}
993 1025
 
994 1026
 	// What about if we only have one filter, but it's not the "standard" filter - show them what they are looking at.
995
-	if (!empty($context['show_filter']) && !empty($context['available_filters']))
996
-		$listOptions['additional_rows'][] = array(
1027
+	if (!empty($context['show_filter']) && !empty($context['available_filters'])) {
1028
+			$listOptions['additional_rows'][] = array(
997 1029
 			'position' => 'above_column_headers',
998 1030
 			'value' => '<strong>' . $txt['admin_browse_filter_show'] . ':</strong> ' . $context['available_filters'][0]['desc'],
999 1031
 			'class' => 'smalltext floatright',
1000 1032
 		);
1033
+	}
1001 1034
 
1002 1035
 	// Now that we have all the options, create the list.
1003 1036
 	require_once($sourcedir . '/Subs-List.php');
@@ -1027,12 +1060,14 @@  discard block
 block discarded – undo
1027 1060
 	$current_filter = (int) $_REQUEST['orig_filter'];
1028 1061
 
1029 1062
 	// If we are applying a filter do just that - then redirect.
1030
-	if (isset($_REQUEST['filter']) && $_REQUEST['filter'] != $_REQUEST['orig_filter'])
1031
-		redirectexit('action=admin;area=viewmembers;sa=browse;type=' . $_REQUEST['type'] . ';sort=' . $_REQUEST['sort'] . ';filter=' . $_REQUEST['filter'] . ';start=' . $_REQUEST['start']);
1063
+	if (isset($_REQUEST['filter']) && $_REQUEST['filter'] != $_REQUEST['orig_filter']) {
1064
+			redirectexit('action=admin;area=viewmembers;sa=browse;type=' . $_REQUEST['type'] . ';sort=' . $_REQUEST['sort'] . ';filter=' . $_REQUEST['filter'] . ';start=' . $_REQUEST['start']);
1065
+	}
1032 1066
 
1033 1067
 	// Nothing to do?
1034
-	if (!isset($_POST['todoAction']) && !isset($_POST['time_passed']))
1035
-		redirectexit('action=admin;area=viewmembers;sa=browse;type=' . $_REQUEST['type'] . ';sort=' . $_REQUEST['sort'] . ';filter=' . $current_filter . ';start=' . $_REQUEST['start']);
1068
+	if (!isset($_POST['todoAction']) && !isset($_POST['time_passed'])) {
1069
+			redirectexit('action=admin;area=viewmembers;sa=browse;type=' . $_REQUEST['type'] . ';sort=' . $_REQUEST['sort'] . ';filter=' . $current_filter . ';start=' . $_REQUEST['start']);
1070
+	}
1036 1071
 
1037 1072
 	// Are we dealing with members who have been waiting for > set amount of time?
1038 1073
 	if (isset($_POST['time_passed']))
@@ -1045,8 +1080,9 @@  discard block
 block discarded – undo
1045 1080
 	else
1046 1081
 	{
1047 1082
 		$members = array();
1048
-		foreach ($_POST['todoAction'] as $id)
1049
-			$members[] = (int) $id;
1083
+		foreach ($_POST['todoAction'] as $id) {
1084
+					$members[] = (int) $id;
1085
+		}
1050 1086
 		$condition = '
1051 1087
 			AND id_member IN ({array_int:members})';
1052 1088
 	}
@@ -1067,8 +1103,9 @@  discard block
 block discarded – undo
1067 1103
 	$member_count = $smcFunc['db_num_rows']($request);
1068 1104
 
1069 1105
 	// If no results then just return!
1070
-	if ($member_count == 0)
1071
-		redirectexit('action=admin;area=viewmembers;sa=browse;type=' . $_REQUEST['type'] . ';sort=' . $_REQUEST['sort'] . ';filter=' . $current_filter . ';start=' . $_REQUEST['start']);
1106
+	if ($member_count == 0) {
1107
+			redirectexit('action=admin;area=viewmembers;sa=browse;type=' . $_REQUEST['type'] . ';sort=' . $_REQUEST['sort'] . ';filter=' . $current_filter . ';start=' . $_REQUEST['start']);
1108
+	}
1072 1109
 
1073 1110
 	$member_info = array();
1074 1111
 	$members = array();
@@ -1107,8 +1144,9 @@  discard block
 block discarded – undo
1107 1144
 		// Do we have to let the integration code know about the activations?
1108 1145
 		if (!empty($modSettings['integrate_activate']))
1109 1146
 		{
1110
-			foreach ($member_info as $member)
1111
-				call_integration_hook('integrate_activate', array($member['username']));
1147
+			foreach ($member_info as $member) {
1148
+							call_integration_hook('integrate_activate', array($member['username']));
1149
+			}
1112 1150
 		}
1113 1151
 
1114 1152
 		// Check for email.
@@ -1238,20 +1276,23 @@  discard block
 block discarded – undo
1238 1276
 		$log_action = $_POST['todo'] == 'remind' ? 'remind_member' : 'approve_member';
1239 1277
 
1240 1278
 		require_once($sourcedir . '/Logging.php');
1241
-		foreach ($member_info as $member)
1242
-			logAction($log_action, array('member' => $member['id']), 'admin');
1279
+		foreach ($member_info as $member) {
1280
+					logAction($log_action, array('member' => $member['id']), 'admin');
1281
+		}
1243 1282
 	}
1244 1283
 
1245 1284
 	// Although updateStats *may* catch this, best to do it manually just in case (Doesn't always sort out unapprovedMembers).
1246
-	if (in_array($current_filter, array(3, 4, 5)))
1247
-		updateSettings(array('unapprovedMembers' => ($modSettings['unapprovedMembers'] > $member_count ? $modSettings['unapprovedMembers'] - $member_count : 0)));
1285
+	if (in_array($current_filter, array(3, 4, 5))) {
1286
+			updateSettings(array('unapprovedMembers' => ($modSettings['unapprovedMembers'] > $member_count ? $modSettings['unapprovedMembers'] - $member_count : 0)));
1287
+	}
1248 1288
 
1249 1289
 	// Update the member's stats. (but, we know the member didn't change their name.)
1250 1290
 	updateStats('member', false);
1251 1291
 
1252 1292
 	// If they haven't been deleted, update the post group statistics on them...
1253
-	if (!in_array($_POST['todo'], array('delete', 'deleteemail', 'reject', 'rejectemail', 'remind')))
1254
-		updateStats('postgroups', $members);
1293
+	if (!in_array($_POST['todo'], array('delete', 'deleteemail', 'reject', 'rejectemail', 'remind'))) {
1294
+			updateStats('postgroups', $members);
1295
+	}
1255 1296
 
1256 1297
 	redirectexit('action=admin;area=viewmembers;sa=browse;type=' . $_REQUEST['type'] . ';sort=' . $_REQUEST['sort'] . ';filter=' . $current_filter . ';start=' . $_REQUEST['start']);
1257 1298
 }
@@ -1276,10 +1317,11 @@  discard block
 block discarded – undo
1276 1317
 	$dis = time() - $old;
1277 1318
 
1278 1319
 	// Before midnight?
1279
-	if ($dis < $sinceMidnight)
1280
-		return 0;
1281
-	else
1282
-		$dis -= $sinceMidnight;
1320
+	if ($dis < $sinceMidnight) {
1321
+			return 0;
1322
+	} else {
1323
+			$dis -= $sinceMidnight;
1324
+	}
1283 1325
 
1284 1326
 	// Divide out the seconds in a day to get the number of days.
1285 1327
 	return ceil($dis / (24 * 60 * 60));
Please login to merge, or discard this patch.