Completed
Push — release-2.1 ( 506664...8b5e1a )
by Colin
23:54 queued 15:34
created
Themes/default/ManageScheduledTasks.template.php 1 patch
Braces   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -20,13 +20,12 @@  discard block
 block discarded – undo
20 20
 	// We completed some tasks?
21 21
 	if (!empty($context['tasks_were_run']))
22 22
 	{
23
-		if (empty($context['scheduled_errors']))
24
-			echo '
23
+		if (empty($context['scheduled_errors'])) {
24
+					echo '
25 25
 	<div class="infobox">
26 26
 		', $txt['scheduled_tasks_were_run'], '
27 27
 	</div>';
28
-
29
-		else
28
+		} else
30 29
 		{
31 30
 			echo '
32 31
 	<div class="errorbox" id="errors">
@@ -35,14 +34,15 @@  discard block
 block discarded – undo
35 34
 				<strong id="error_serious">', $txt['scheduled_tasks_were_run_errors'], '</strong>
36 35
 			</dt>';
37 36
 
38
-			foreach ($context['scheduled_errors'] as $task => $errors)
39
-				echo '
37
+			foreach ($context['scheduled_errors'] as $task => $errors) {
38
+							echo '
40 39
 			<dd class="error">
41 40
 				<strong>', isset($txt['scheduled_task_' . $task]) ? $txt['scheduled_task_' . $task] : $task, '</strong>
42 41
 				<ul>
43 42
 					<li>', implode('</li><li>', $errors), '</li>
44 43
 				</ul>
45 44
 			</dd>';
45
+			}
46 46
 
47 47
 			echo '
48 48
 		</dl>
Please login to merge, or discard this patch.
Themes/default/ReportToMod.template.php 1 patch
Braces   +6 added lines, -5 removed lines patch added patch discarded remove patch
@@ -62,16 +62,17 @@
 block discarded – undo
62 62
 				<div id="error_box" class="errorbox">
63 63
 					<ul id="error_list">';
64 64
 
65
-		foreach ($context['post_errors'] as $key => $error)
66
-			echo '
65
+		foreach ($context['post_errors'] as $key => $error) {
66
+					echo '
67 67
 						<li id="error_', $key, '" class="error">', $error, '</li>';
68
+		}
68 69
 
69 70
 		echo '
70 71
 					</ul>';
71
-	}
72
-	else
73
-		echo '
72
+	} else {
73
+			echo '
74 74
 				<div style="display:none" id="error_box" class="errorbox">';
75
+	}
75 76
 
76 77
 	echo '
77 78
 				</div>';
Please login to merge, or discard this patch.
Themes/default/ManageMaintenance.template.php 1 patch
Braces   +45 added lines, -31 removed lines patch added patch discarded remove patch
@@ -18,11 +18,12 @@  discard block
 block discarded – undo
18 18
 	global $context, $txt, $scripturl, $modSettings;
19 19
 
20 20
 	// If maintenance has finished tell the user.
21
-	if (!empty($context['maintenance_finished']))
22
-		echo '
21
+	if (!empty($context['maintenance_finished'])) {
22
+			echo '
23 23
 	<div class="infobox">
24 24
 		', sprintf($txt['maintain_done'], $context['maintenance_finished']), '
25 25
 	</div>';
26
+	}
26 27
 
27 28
 	echo '
28 29
 	<div id="manage_maintenance">
@@ -39,8 +40,8 @@  discard block
 block discarded – undo
39 40
 		</div>';
40 41
 
41 42
 	// Show an option to convert the body column of the post table to MEDIUMTEXT or TEXT
42
-	if (isset($context['convert_to']))
43
-		echo '
43
+	if (isset($context['convert_to'])) {
44
+			echo '
44 45
 		<div class="cat_bar">
45 46
 			<h3 class="catbg">', $txt[$context['convert_to'] . '_title'], '</h3>
46 47
 		</div>
@@ -53,10 +54,11 @@  discard block
 block discarded – undo
53 54
 				<input type="hidden" name="', $context['admin-maint_token_var'], '" value="', $context['admin-maint_token'], '">
54 55
 			</form>
55 56
 		</div>';
57
+	}
56 58
 
57 59
 	// Show an option to convert to UTF-8 if we're not on UTF-8 yet.
58
-	if ($context['convert_utf8'])
59
-		echo '
60
+	if ($context['convert_utf8']) {
61
+			echo '
60 62
 		<div class="cat_bar">
61 63
 			<h3 class="catbg">', $txt['utf8_title'], '</h3>
62 64
 		</div>
@@ -69,10 +71,11 @@  discard block
 block discarded – undo
69 71
 				<input type="hidden" name="', $context['admin-maint_token_var'], '" value="', $context['admin-maint_token'], '">
70 72
 			</form>
71 73
 		</div>';
74
+	}
72 75
 
73 76
 	// We might want to convert entities if we're on UTF-8.
74
-	if ($context['convert_entities'])
75
-		echo '
77
+	if ($context['convert_entities']) {
78
+			echo '
76 79
 		<div class="cat_bar">
77 80
 			<h3 class="catbg">', $txt['entity_convert_title'], '</h3>
78 81
 		</div>
@@ -84,6 +87,7 @@  discard block
 block discarded – undo
84 87
 				<input type="hidden" name="', $context['admin-maint_token_var'], '" value="', $context['admin-maint_token'], '">
85 88
 			</form>
86 89
 		</div>';
90
+	}
87 91
 
88 92
 	echo '
89 93
 	</div><!-- #manage_maintenance -->';
@@ -101,11 +105,12 @@  discard block
 block discarded – undo
101 105
 	<div id="manage_maintenance">';
102 106
 
103 107
 	// If maintenance has finished tell the user.
104
-	if (!empty($context['maintenance_finished']))
105
-		echo '
108
+	if (!empty($context['maintenance_finished'])) {
109
+			echo '
106 110
 		<div class="infobox">
107 111
 			', sprintf($txt['maintain_done'], $context['maintenance_finished']), '
108 112
 		</div>';
113
+	}
109 114
 
110 115
 	echo '
111 116
 		<div class="cat_bar">
@@ -237,11 +242,12 @@  discard block
 block discarded – undo
237 242
 	<div id="manage_maintenance">';
238 243
 
239 244
 	// If maintenance has finished, tell the user.
240
-	if (!empty($context['maintenance_finished']))
241
-		echo '
245
+	if (!empty($context['maintenance_finished'])) {
246
+			echo '
242 247
 		<div class="infobox">
243 248
 			', sprintf($txt['maintain_done'], $context['maintenance_finished']), '
244 249
 		</div>';
250
+	}
245 251
 
246 252
 	echo '
247 253
 		<div class="cat_bar">
@@ -303,9 +309,10 @@  discard block
 block discarded – undo
303 309
 				</p>
304 310
 				<div style="display: none;" id="membersPanel">';
305 311
 
306
-	foreach ($context['membergroups'] as $group)
307
-		echo '
312
+	foreach ($context['membergroups'] as $group) {
313
+			echo '
308 314
 					<label for="groups', $group['id'], '"><input type="checkbox" name="groups[', $group['id'], ']" id="groups', $group['id'], '" checked> ', $group['name'], '</label><br>';
315
+	}
309 316
 
310 317
 	echo '
311 318
 				</div>
@@ -349,11 +356,12 @@  discard block
 block discarded – undo
349 356
 	global $scripturl, $txt, $context, $settings, $modSettings;
350 357
 
351 358
 	// If maintenance has finished tell the user.
352
-	if (!empty($context['maintenance_finished']))
353
-		echo '
359
+	if (!empty($context['maintenance_finished'])) {
360
+			echo '
354 361
 	<div class="infobox">
355 362
 		', sprintf($txt['maintain_done'], $context['maintenance_finished']), '
356 363
 	</div>';
364
+	}
357 365
 
358 366
 	// Bit of javascript for showing which boards to prune in an otherwise hidden list.
359 367
 	echo '
@@ -421,21 +429,23 @@  discard block
 block discarded – undo
421 429
 								<ul>';
422 430
 
423 431
 		// Display a checkbox with every board.
424
-		foreach ($category['boards'] as $board)
425
-			echo '
432
+		foreach ($category['boards'] as $board) {
433
+					echo '
426 434
 									<li style="margin-', $context['right_to_left'] ? 'right' : 'left', ': ', $board['child_level'] * 1.5, 'em;">
427 435
 										<label for="boards_', $board['id'], '"><input type="checkbox" name="boards[', $board['id'], ']" id="boards_', $board['id'], '" checked>', $board['name'], '</label>
428 436
 									</li>';
437
+		}
429 438
 
430 439
 		echo '
431 440
 								</ul>
432 441
 							</fieldset>';
433 442
 
434 443
 		// Increase $i, and check if we're at the middle yet.
435
-		if (++$i == $middle)
436
-			echo '
444
+		if (++$i == $middle) {
445
+					echo '
437 446
 						</div><!-- .floatleft -->
438 447
 						<div class="floatright" style="width: 49%;">';
448
+		}
439 449
 	}
440 450
 
441 451
 	echo '
@@ -477,9 +487,10 @@  discard block
 block discarded – undo
477 487
 		echo '
478 488
 						<optgroup label="', $category['name'], '">';
479 489
 
480
-		foreach ($category['boards'] as $board)
481
-			echo '
490
+		foreach ($category['boards'] as $board) {
491
+					echo '
482 492
 							<option value="', $board['id'], '"> ', str_repeat('==', $board['child_level']), '=&gt;&nbsp;', $board['name'], '</option>';
493
+		}
483 494
 
484 495
 		echo '
485 496
 						</optgroup>';
@@ -497,9 +508,10 @@  discard block
 block discarded – undo
497 508
 		echo '
498 509
 						<optgroup label="', $category['name'], '">';
499 510
 
500
-		foreach ($category['boards'] as $board)
501
-			echo '
511
+		foreach ($category['boards'] as $board) {
512
+					echo '
502 513
 							<option value="', $board['id'], '"> ', str_repeat('==', $board['child_level']), '=&gt;&nbsp;', $board['name'], '</option>';
514
+		}
503 515
 
504 516
 		echo '
505 517
 						</optgroup>';
@@ -540,9 +552,10 @@  discard block
 block discarded – undo
540 552
 				', $txt['database_optimize_attempt'], '<br>';
541 553
 
542 554
 	// List each table being optimized...
543
-	foreach ($context['optimized_tables'] as $table)
544
-		echo '
555
+	foreach ($context['optimized_tables'] as $table) {
556
+			echo '
545 557
 				', sprintf($txt['database_optimizing'], $table['name'], $table['data_freed']), '<br>';
558
+	}
546 559
 
547 560
 	// How did we go?
548 561
 	echo '
@@ -602,13 +615,14 @@  discard block
 block discarded – undo
602 615
 				</li>
603 616
 			</ul>';
604 617
 
605
-		if (!empty($context['exceeding_messages_morethan']))
606
-			echo '
618
+		if (!empty($context['exceeding_messages_morethan'])) {
619
+					echo '
607 620
 			<p>', $context['exceeding_messages_morethan'], '</p>';
608
-	}
609
-	else
610
-		echo '
621
+		}
622
+	} else {
623
+			echo '
611 624
 			<p class="infobox">', $txt['convert_to_text'], '</p>';
625
+	}
612 626
 
613 627
 	echo '
614 628
 			<form action="', $scripturl, '?action=admin;area=maintain;sa=database;activity=convertmsgbody" method="post" accept-charset="', $context['character_set'], '">
Please login to merge, or discard this patch.
Themes/default/Themes.template.php 1 patch
Braces   +121 added lines, -92 removed lines patch added patch discarded remove patch
@@ -54,9 +54,10 @@  discard block
 block discarded – undo
54 54
 					<dd>
55 55
 						<div id="known_themes_list">';
56 56
 
57
-	foreach ($context['themes'] as $theme)
58
-		echo '
57
+	foreach ($context['themes'] as $theme) {
58
+			echo '
59 59
 							<label for="options-known_themes_', $theme['id'], '"><input type="checkbox" name="options[known_themes][]" id="options-known_themes_', $theme['id'], '" value="', $theme['id'], '"', $theme['known'] ? ' checked' : '', '> ', $theme['name'], '</label><br>';
60
+	}
60 61
 
61 62
 	echo '
62 63
 						</div>
@@ -73,9 +74,10 @@  discard block
 block discarded – undo
73 74
 						<select name="options[theme_guests]" id="theme_guests">';
74 75
 
75 76
 	// Put an option for each theme in the select box.
76
-	foreach ($context['themes'] as $theme)
77
-		echo '
77
+	foreach ($context['themes'] as $theme) {
78
+			echo '
78 79
 							<option value="', $theme['id'], '"', $modSettings['theme_guests'] == $theme['id'] ? ' selected' : '', '>', $theme['name'], '</option>';
80
+	}
79 81
 
80 82
 	echo '
81 83
 						</select>
@@ -90,9 +92,10 @@  discard block
 block discarded – undo
90 92
 							<option value="0">', $txt['theme_forum_default'], '</option>';
91 93
 
92 94
 	// Same thing, this time for changing the theme of everyone.
93
-	foreach ($context['themes'] as $theme)
94
-		echo '
95
+	foreach ($context['themes'] as $theme) {
96
+			echo '
95 97
 							<option value="', $theme['id'], '">', $theme['name'], '</option>';
98
+	}
96 99
 
97 100
 	echo '
98 101
 						</select>
@@ -187,11 +190,12 @@  discard block
 block discarded – undo
187 190
 	global $context, $scripturl, $txt;
188 191
 
189 192
 	// Show a nice confirmation message.
190
-	if (isset($_GET['done']))
191
-		echo '
193
+	if (isset($_GET['done'])) {
194
+			echo '
192 195
 	<div class="infobox">
193 196
 		', $txt['theme_confirmed_' . $_GET['done']], '
194 197
 	</div>';
198
+	}
195 199
 
196 200
 	echo '
197 201
 	<div id="admincenter">
@@ -354,11 +358,12 @@  discard block
 block discarded – undo
354 358
 		if (empty($setting) || !is_array($setting))
355 359
 		{
356 360
 			// Insert a separator (unless this is the first item in the list)
357
-			if ($i !== $first_option_key)
358
-				echo '
361
+			if ($i !== $first_option_key) {
362
+							echo '
359 363
 				</dl>
360 364
 				<hr>
361 365
 				<dl class="settings">';
366
+			}
362 367
 
363 368
 			// Should we give a name to this section?
364 369
 			if (is_string($setting) && !empty($setting))
@@ -367,9 +372,9 @@  discard block
 block discarded – undo
367 372
 				echo '
368 373
 					<dt><strong>' . $setting . '</strong></dt>
369 374
 					<dd></dd>';
375
+			} else {
376
+							$titled_section = false;
370 377
 			}
371
-			else
372
-				$titled_section = false;
373 378
 
374 379
 			continue;
375 380
 		}
@@ -378,8 +383,8 @@  discard block
 block discarded – undo
378 383
 					<dt>';
379 384
 
380 385
 		// Show the change option box?
381
-		if ($context['theme_options_reset'])
382
-			echo '
386
+		if ($context['theme_options_reset']) {
387
+					echo '
383 388
 						<span class="floatleft">
384 389
 							<select name="', !empty($setting['default']) ? 'default_' : '', 'options_master[', $setting['id'], ']" onchange="this.form.options_', $setting['id'], '.disabled = this.selectedIndex != 1;">
385 390
 								<option value="0" selected>', $txt['themeadmin_reset_options_none'], '</option>
@@ -387,23 +392,26 @@  discard block
 block discarded – undo
387 392
 								<option value="2">', $txt['themeadmin_reset_options_default'], '</option>
388 393
 							</select>
389 394
 						</span>';
395
+		}
390 396
 
391 397
 		echo '
392 398
 						<label for="options_', $setting['id'], '">', !$titled_section ? '<strong>' : '', $setting['label'], !$titled_section ? '</strong>' : '', '</label>';
393 399
 
394
-		if (isset($setting['description']))
395
-			echo '
400
+		if (isset($setting['description'])) {
401
+					echo '
396 402
 						<br>
397 403
 						<span class="smalltext">', $setting['description'], '</span>';
404
+		}
398 405
 		echo '
399 406
 					</dt>';
400 407
 
401 408
 		// Display checkbox options
402
-		if ($setting['type'] == 'checkbox')
403
-			echo '
409
+		if ($setting['type'] == 'checkbox') {
410
+					echo '
404 411
 					<dd>
405 412
 						<input type="hidden" name="' . (!empty($setting['default']) ? 'default_' : '') . 'options[' . $setting['id'] . ']" value="0">
406 413
 						<input type="checkbox" name="', !empty($setting['default']) ? 'default_' : '', 'options[', $setting['id'], ']" id="options_', $setting['id'], '"', !empty($setting['value']) ? ' checked' : '', $context['theme_options_reset'] ? ' disabled' : '', ' value="1" class="floatleft">';
414
+		}
407 415
 
408 416
 		// How about selection lists, we all love them
409 417
 		elseif ($setting['type'] == 'list')
@@ -412,9 +420,10 @@  discard block
 block discarded – undo
412 420
 					<dd>
413 421
 						<select class="floatleft" name="', !empty($setting['default']) ? 'default_' : '', 'options[', $setting['id'], ']" id="options_', $setting['id'], '"', $context['theme_options_reset'] ? ' disabled' : '', '>';
414 422
 
415
-			foreach ($setting['options'] as $value => $label)
416
-				echo '
423
+			foreach ($setting['options'] as $value => $label) {
424
+							echo '
417 425
 							<option value="', $value, '"', $value == $setting['value'] ? ' selected' : '', '>', $label, '</option>';
426
+			}
418 427
 
419 428
 			echo '
420 429
 						</select>';
@@ -433,14 +442,13 @@  discard block
 block discarded – undo
433 442
 
434 443
 				echo '
435 444
 						<input type="number"', $min . $max . $step;
436
-			}
437
-			elseif (isset($setting['type']) && $setting['type'] == 'url')
438
-				echo'
445
+			} elseif (isset($setting['type']) && $setting['type'] == 'url') {
446
+							echo'
439 447
 						<input type="url"';
440
-
441
-			else
442
-				echo '
448
+			} else {
449
+							echo '
443 450
 						<input type="text"';
451
+			}
444 452
 
445 453
 			echo ' name="', !empty($setting['default']) ? 'default_' : '', 'options[', $setting['id'], ']" id="options_', $setting['id'], '" value="', $setting['value'], '"', $setting['type'] == 'number' ? ' size="5"' : '', $context['theme_options_reset'] ? ' disabled' : '', '>';
446 454
 		}
@@ -479,8 +487,8 @@  discard block
 block discarded – undo
479 487
 			<br>';
480 488
 
481 489
 	// @todo Why can't I edit the default theme popup.
482
-	if ($context['theme_settings']['theme_id'] != 1)
483
-		echo '
490
+	if ($context['theme_settings']['theme_id'] != 1) {
491
+			echo '
484 492
 			<div class="cat_bar">
485 493
 				<h3 class="catbg config_hd">
486 494
 					', $txt['theme_edit'], '
@@ -496,6 +504,7 @@  discard block
 block discarded – undo
496 504
 					</li>
497 505
 				</ul>
498 506
 			</div>';
507
+	}
499 508
 
500 509
 	echo '
501 510
 			<div class="cat_bar">
@@ -549,9 +558,10 @@  discard block
 block discarded – undo
549 558
 					<dd>
550 559
 						<select id="variant" name="options[default_variant]" onchange="changeVariant(this.value)">';
551 560
 
552
-		foreach ($context['theme_variants'] as $key => $variant)
553
-			echo '
561
+		foreach ($context['theme_variants'] as $key => $variant) {
562
+					echo '
554 563
 							<option value="', $key, '"', $context['default_variant'] == $key ? ' selected' : '', '>', $variant['label'], '</option>';
564
+		}
555 565
 
556 566
 		echo '
557 567
 						</select>
@@ -587,11 +597,12 @@  discard block
 block discarded – undo
587 597
 		if (empty($setting) || !is_array($setting))
588 598
 		{
589 599
 			// We don't need a separator before the first list element
590
-			if ($i !== $first_setting_key)
591
-				echo '
600
+			if ($i !== $first_setting_key) {
601
+							echo '
592 602
 				</dl>
593 603
 				<hr>
594 604
 				<dl class="settings">';
605
+			}
595 606
 
596 607
 			// Add a fake heading?
597 608
 			if (is_string($setting) && !empty($setting))
@@ -600,9 +611,9 @@  discard block
 block discarded – undo
600 611
 				echo '
601 612
 					<dt><strong>' . $setting . '</strong></dt>
602 613
 					<dd></dd>';
614
+			} else {
615
+							$titled_section = false;
603 616
 			}
604
-			else
605
-				$titled_section = false;
606 617
 
607 618
 			continue;
608 619
 		}
@@ -611,20 +622,22 @@  discard block
 block discarded – undo
611 622
 					<dt>
612 623
 						<label for="', $setting['id'], '">', !$titled_section ? '<strong>' : '', $setting['label'], !$titled_section ? '</strong>' : '', '</label>:';
613 624
 
614
-		if (isset($setting['description']))
615
-			echo '<br>
625
+		if (isset($setting['description'])) {
626
+					echo '<br>
616 627
 						<span class="smalltext">', $setting['description'], '</span>';
628
+		}
617 629
 
618 630
 		echo '
619 631
 					</dt>';
620 632
 
621 633
 		// A checkbox?
622
-		if ($setting['type'] == 'checkbox')
623
-			echo '
634
+		if ($setting['type'] == 'checkbox') {
635
+					echo '
624 636
 					<dd>
625 637
 						<input type="hidden" name="', !empty($setting['default']) ? 'default_' : '', 'options[', $setting['id'], ']" value="0">
626 638
 						<input type="checkbox" name="', !empty($setting['default']) ? 'default_' : '', 'options[', $setting['id'], ']" id="', $setting['id'], '"', !empty($setting['value']) ? ' checked' : '', ' value="1">
627 639
 					</dd>';
640
+		}
628 641
 
629 642
 		// A list with options?
630 643
 		elseif ($setting['type'] == 'list')
@@ -633,9 +646,10 @@  discard block
 block discarded – undo
633 646
 					<dd>
634 647
 						<select name="', !empty($setting['default']) ? 'default_' : '', 'options[', $setting['id'], ']" id="', $setting['id'], '">';
635 648
 
636
-			foreach ($setting['options'] as $value => $label)
637
-				echo '
649
+			foreach ($setting['options'] as $value => $label) {
650
+							echo '
638 651
 							<option value="', $value, '"', $value == $setting['value'] ? ' selected' : '', '>', $label, '</option>';
652
+			}
639 653
 
640 654
 			echo '
641 655
 						</select>
@@ -663,14 +677,13 @@  discard block
 block discarded – undo
663 677
 
664 678
 				echo '
665 679
 						<input type="number"', $min . $max . $step;
666
-			}
667
-			elseif (isset($setting['type']) && $setting['type'] == 'url')
668
-				echo'
680
+			} elseif (isset($setting['type']) && $setting['type'] == 'url') {
681
+							echo'
669 682
 						<input type="url"';
670
-
671
-			else
672
-				echo '
683
+			} else {
684
+							echo '
673 685
 						<input type="text"';
686
+			}
674 687
 
675 688
 			echo ' name="', !empty($setting['default']) ? 'default_' : '', 'options[', $setting['id'], ']" id="options_', $setting['id'], '" value="', $setting['value'], '"', $setting['type'] == 'number' ? ' size="5"' : (empty($settings['size']) ? ' size="40"' : ' size="' . $setting['size'] . '"'), '>
676 689
 					</dd>';
@@ -742,9 +755,10 @@  discard block
 block discarded – undo
742 755
 					<label for="variant', $theme['id'], '"><strong>', $theme['pick_label'], '</strong></label>:
743 756
 					<select id="variant', $theme['id'], '" name="vrt[', $theme['id'], ']" onchange="changeVariant', $theme['id'], '(this.value);">';
744 757
 
745
-			foreach ($theme['variants'] as $key => $variant)
746
-				echo '
758
+			foreach ($theme['variants'] as $key => $variant) {
759
+							echo '
747 760
 						<option value="', $key, '"', $theme['selected_variant'] == $key ? ' selected' : '', '>', $variant['label'], '</option>';
761
+			}
748 762
 
749 763
 			echo '
750 764
 					</select>
@@ -822,21 +836,23 @@  discard block
 block discarded – undo
822 836
 		<div class="windowbg">';
823 837
 
824 838
 	// Oops! there was an error :(
825
-	if (!empty($context['error_message']))
826
-		echo '
839
+	if (!empty($context['error_message'])) {
840
+			echo '
827 841
 			<p>
828 842
 				', $context['error_message'], '
829 843
 			</p>';
844
+	}
830 845
 
831 846
 	// Not much to show except a link back...
832
-	else
833
-		echo '
847
+	else {
848
+			echo '
834 849
 			<p>
835 850
 				<a href="', $scripturl, '?action=admin;area=theme;sa=list;th=', $context['installed_theme']['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $context['installed_theme']['name'], '</a> ', $txt['theme_' . (isset($context['installed_theme']['updated']) ? 'updated' : 'installed') . '_message'], '
836 851
 			</p>
837 852
 			<p>
838 853
 				<a href="', $scripturl, '?action=admin;area=theme;sa=admin;', $context['session_var'], '=', $context['session_id'], '">', $txt['back'], '</a>
839 854
 			</p>';
855
+	}
840 856
 
841 857
 	echo '
842 858
 		</div><!-- .windowbg -->
@@ -903,11 +919,12 @@  discard block
 block discarded – undo
903 919
 					<span class="floatleft">', $template['filename'], $template['already_exists'] ? ' <span class="error">(' . $txt['themeadmin_edit_exists'] . ')</span>' : '', '</span>
904 920
 					<span class="floatright">';
905 921
 
906
-		if ($template['can_copy'])
907
-			echo '
922
+		if ($template['can_copy']) {
923
+					echo '
908 924
 						<a href="', $scripturl, '?action=admin;area=theme;th=', $context['theme_id'], ';', $context['session_var'], '=', $context['session_id'], ';sa=copy;template=', $template['value'], '" data-confirm="', $template['already_exists'] ? $txt['themeadmin_edit_overwrite_confirm'] : $txt['themeadmin_edit_copy_confirm'], '" class="you_sure">', $txt['themeadmin_edit_do_copy'], '</a>';
909
-		else
910
-			echo $txt['themeadmin_edit_no_copy'];
925
+		} else {
926
+					echo $txt['themeadmin_edit_no_copy'];
927
+		}
911 928
 
912 929
 		echo '
913 930
 					</span>
@@ -930,11 +947,12 @@  discard block
 block discarded – undo
930 947
 	echo '
931 948
 	<div id="admincenter">';
932 949
 
933
-	if (!empty($context['browse_title']))
934
-		echo '
950
+	if (!empty($context['browse_title'])) {
951
+			echo '
935 952
 		<div class="cat_bar">
936 953
 			<h3 class="catbg">', $context['browse_title'], '</h3>
937 954
 		</div>';
955
+	}
938 956
 
939 957
 	echo '
940 958
 		<table class="table_grid tborder">
@@ -954,16 +972,15 @@  discard block
 block discarded – undo
954 972
 				<tr class="windowbg">
955 973
 					<td>';
956 974
 
957
-		if ($file['is_editable'])
958
-			echo '
975
+		if ($file['is_editable']) {
976
+					echo '
959 977
 						<a href="', $file['href'], '"', $file['is_template'] ? ' style="font-weight: bold;"' : '', '>', $file['filename'], '</a>';
960
-
961
-		elseif ($file['is_directory'])
962
-			echo '
978
+		} elseif ($file['is_directory']) {
979
+					echo '
963 980
 						<a href="', $file['href'], '" class="is_directory"><span class="generic_icons folder"></span>', $file['filename'], '</a>';
964
-
965
-		else
966
-			echo $file['filename'];
981
+		} else {
982
+					echo $file['filename'];
983
+		}
967 984
 
968 985
 		echo '
969 986
 					</td>
@@ -985,11 +1002,12 @@  discard block
 block discarded – undo
985 1002
 {
986 1003
 	global $context, $settings, $scripturl, $txt;
987 1004
 
988
-	if ($context['session_error'])
989
-		echo '
1005
+	if ($context['session_error']) {
1006
+			echo '
990 1007
 	<div class="errorbox">
991 1008
 		', $txt['error_session_timeout'], '
992 1009
 	</div>';
1010
+	}
993 1011
 
994 1012
 	// From now on no one can complain that editing css is difficult. If you disagree, go to www.w3schools.com.
995 1013
 	echo '
@@ -1053,17 +1071,18 @@  discard block
 block discarded – undo
1053 1071
 					{
1054 1072
 					';
1055 1073
 
1056
-	if (isBrowser('is_ie'))
1057
-		echo '
1074
+	if (isBrowser('is_ie')) {
1075
+			echo '
1058 1076
 						var sheets = frames["css_preview_box"].document.styleSheets;
1059 1077
 						for (var j = 0; j < sheets.length; j++)
1060 1078
 						{
1061 1079
 							if (sheets[j].id == "css_preview_box")
1062 1080
 								sheets[j].cssText = document.forms.stylesheetForm.entire_file.value;
1063 1081
 						}';
1064
-	else
1065
-		echo '
1082
+	} else {
1083
+			echo '
1066 1084
 						setInnerHTML(frames["css_preview_box"].document.getElementById("css_preview_sheet"), document.forms.stylesheetForm.entire_file.value);';
1085
+	}
1067 1086
 	echo '
1068 1087
 					}
1069 1088
 					catch (e)
@@ -1115,9 +1134,10 @@  discard block
 block discarded – undo
1115 1134
 			</div>
1116 1135
 			<div class="windowbg">';
1117 1136
 
1118
-	if (!$context['allow_save'])
1119
-		echo '
1137
+	if (!$context['allow_save']) {
1138
+			echo '
1120 1139
 				', $txt['theme_edit_no_save'], ': ', $context['allow_save_filename'], '<br>';
1140
+	}
1121 1141
 
1122 1142
 	echo '
1123 1143
 				<textarea class="edit_file" name="entire_file" cols="80" rows="20" onkeyup="setPreviewTimeout();" onchange="refreshPreview(true);">', $context['entire_file'], '</textarea>
@@ -1131,9 +1151,10 @@  discard block
 block discarded – undo
1131 1151
 			<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">';
1132 1152
 
1133 1153
 	// Hopefully it exists.
1134
-	if (isset($context['admin-te-' . md5($context['theme_id'] . '-' . $context['edit_filename']) . '_token']))
1135
-		echo '
1154
+	if (isset($context['admin-te-' . md5($context['theme_id'] . '-' . $context['edit_filename']) . '_token'])) {
1155
+			echo '
1136 1156
 			<input type="hidden" name="', $context['admin-te-' . md5($context['theme_id'] . '-' . $context['edit_filename']) . '_token_var'], '" value="', $context['admin-te-' . md5($context['theme_id'] . '-' . $context['edit_filename']) . '_token'], '">';
1157
+	}
1137 1158
 
1138 1159
 	echo '
1139 1160
 		</form>
@@ -1147,18 +1168,20 @@  discard block
 block discarded – undo
1147 1168
 {
1148 1169
 	global $context, $scripturl, $txt;
1149 1170
 
1150
-	if ($context['session_error'])
1151
-		echo '
1171
+	if ($context['session_error']) {
1172
+			echo '
1152 1173
 	<div class="errorbox">
1153 1174
 		', $txt['error_session_timeout'], '
1154 1175
 	</div>';
1176
+	}
1155 1177
 
1156
-	if (isset($context['parse_error']))
1157
-		echo '
1178
+	if (isset($context['parse_error'])) {
1179
+			echo '
1158 1180
 	<div class="errorbox">
1159 1181
 		', $txt['themeadmin_edit_error'], '
1160 1182
 		<div><pre>', $context['parse_error'], '</pre></div>
1161 1183
 	</div>';
1184
+	}
1162 1185
 
1163 1186
 	// Just show a big box.... gray out the Save button if it's not saveable... (ie. not 777.)
1164 1187
 	echo '
@@ -1169,16 +1192,18 @@  discard block
 block discarded – undo
1169 1192
 			</div>
1170 1193
 			<div class="windowbg">';
1171 1194
 
1172
-	if (!$context['allow_save'])
1173
-		echo '
1195
+	if (!$context['allow_save']) {
1196
+			echo '
1174 1197
 				', $txt['theme_edit_no_save'], ': ', $context['allow_save_filename'], '<br>';
1198
+	}
1175 1199
 
1176
-	foreach ($context['file_parts'] as $part)
1177
-		echo '
1200
+	foreach ($context['file_parts'] as $part) {
1201
+			echo '
1178 1202
 				<label for="on_line', $part['line'], '">', $txt['themeadmin_edit_on_line'], ' ', $part['line'], '</label>:<br>
1179 1203
 				<div class="centertext">
1180 1204
 					<textarea id="on_line', $part['line'], '" name="entire_file[]" cols="80" rows="', $part['lines'] > 14 ? '14' : $part['lines'], '" class="edit_file">', $part['data'], '</textarea>
1181 1205
 				</div>';
1206
+	}
1182 1207
 
1183 1208
 	echo '
1184 1209
 				<div class="padding righttext">
@@ -1187,9 +1212,10 @@  discard block
 block discarded – undo
1187 1212
 					<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">';
1188 1213
 
1189 1214
 	// Hopefully it exists.
1190
-	if (isset($context['admin-te-' . md5($context['theme_id'] . '-' . $context['edit_filename']) . '_token']))
1191
-		echo '
1215
+	if (isset($context['admin-te-' . md5($context['theme_id'] . '-' . $context['edit_filename']) . '_token'])) {
1216
+			echo '
1192 1217
 					<input type="hidden" name="', $context['admin-te-' . md5($context['theme_id'] . '-' . $context['edit_filename']) . '_token_var'], '" value="', $context['admin-te-' . md5($context['theme_id'] . '-' . $context['edit_filename']) . '_token'], '">';
1218
+	}
1193 1219
 
1194 1220
 	echo '
1195 1221
 				</div><!-- .righttext -->
@@ -1205,18 +1231,20 @@  discard block
 block discarded – undo
1205 1231
 {
1206 1232
 	global $context, $scripturl, $txt;
1207 1233
 
1208
-	if ($context['session_error'])
1209
-		echo '
1234
+	if ($context['session_error']) {
1235
+			echo '
1210 1236
 	<div class="errorbox">
1211 1237
 		', $txt['error_session_timeout'], '
1212 1238
 	</div>';
1239
+	}
1213 1240
 
1214 1241
 	// Is this file writeable?
1215
-	if (!$context['allow_save'])
1216
-		echo '
1242
+	if (!$context['allow_save']) {
1243
+			echo '
1217 1244
 	<div class="errorbox">
1218 1245
 		', $txt['theme_edit_no_save'], ': ', $context['allow_save_filename'], '
1219 1246
 	</div>';
1247
+	}
1220 1248
 
1221 1249
 	// Just show a big box.... gray out the Save button if it's not saveable... (ie. not 777.)
1222 1250
 	echo '
@@ -1232,9 +1260,10 @@  discard block
 block discarded – undo
1232 1260
 				<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">';
1233 1261
 
1234 1262
 	// Hopefully it exists.
1235
-	if (isset($context['admin-te-' . md5($context['theme_id'] . '-' . $context['edit_filename']) . '_token']))
1236
-		echo '
1263
+	if (isset($context['admin-te-' . md5($context['theme_id'] . '-' . $context['edit_filename']) . '_token'])) {
1264
+			echo '
1237 1265
 				<input type="hidden" name="', $context['admin-te-' . md5($context['theme_id'] . '-' . $context['edit_filename']) . '_token_var'], '" value="', $context['admin-te-' . md5($context['theme_id'] . '-' . $context['edit_filename']) . '_token'], '">';
1266
+	}
1238 1267
 
1239 1268
 	echo '
1240 1269
 			</div><!-- .windowbg -->
Please login to merge, or discard this patch.
Themes/default/GenericMenu.template.php 1 patch
Braces   +54 added lines, -39 removed lines patch added patch discarded remove patch
@@ -89,16 +89,18 @@  discard block
 block discarded – undo
89 89
 		foreach ($section['areas'] as $i => $area)
90 90
 		{
91 91
 			// Not supposed to be printed?
92
-			if (empty($area['label']))
93
-				continue;
92
+			if (empty($area['label'])) {
93
+							continue;
94
+			}
94 95
 
95 96
 			echo '
96 97
 								<li', !empty($area['subsections']) ? ' class="subsections"' : '', '>
97 98
 									<a class="', $area['icon_class'], !empty($area['selected']) ? ' chosen ' : '', '" href="', (isset($area['url']) ? $area['url'] : $menu_context['base_url'] . ';area=' . $i), $menu_context['extra_parameters'], '">', $area['icon'], $area['label'], '</a>';
98 99
 
99 100
 			// Is this the current area, or just some area?
100
-			if (!empty($area['selected']) && empty($context['tabs']))
101
-					$context['tabs'] = isset($area['subsections']) ? $area['subsections'] : array();
101
+			if (!empty($area['selected']) && empty($context['tabs'])) {
102
+								$context['tabs'] = isset($area['subsections']) ? $area['subsections'] : array();
103
+			}
102 104
 
103 105
 			// Are there any subsections?
104 106
 			if (!empty($area['subsections']))
@@ -108,8 +110,9 @@  discard block
 block discarded – undo
108 110
 
109 111
 				foreach ($area['subsections'] as $sa => $sub)
110 112
 				{
111
-					if (!empty($sub['disabled']))
112
-						continue;
113
+					if (!empty($sub['disabled'])) {
114
+											continue;
115
+					}
113 116
 
114 117
 					$url = isset($sub['url']) ? $sub['url'] : (isset($area['url']) ? $area['url'] : $menu_context['base_url'] . ';area=' . $i) . ';sa=' . $sa;
115 118
 
@@ -156,8 +159,9 @@  discard block
 block discarded – undo
156 159
 							<h3 class="catbg">';
157 160
 
158 161
 		// The function is in Admin.template.php, but since this template is used elsewhere too better check if the function is available
159
-		if (function_exists('template_admin_quick_search'))
160
-			template_admin_quick_search();
162
+		if (function_exists('template_admin_quick_search')) {
163
+					template_admin_quick_search();
164
+		}
161 165
 
162 166
 		// Exactly how many tabs do we have?
163 167
 		if (!empty($context['tabs']))
@@ -172,30 +176,36 @@  discard block
 block discarded – undo
172 176
 				}
173 177
 
174 178
 				// Did this not even exist - or do we not have a label?
175
-				if (!isset($tab_context['tabs'][$id]))
176
-					$tab_context['tabs'][$id] = array('label' => $tab['label']);
177
-				elseif (!isset($tab_context['tabs'][$id]['label']))
178
-					$tab_context['tabs'][$id]['label'] = $tab['label'];
179
+				if (!isset($tab_context['tabs'][$id])) {
180
+									$tab_context['tabs'][$id] = array('label' => $tab['label']);
181
+				} elseif (!isset($tab_context['tabs'][$id]['label'])) {
182
+									$tab_context['tabs'][$id]['label'] = $tab['label'];
183
+				}
179 184
 
180 185
 				// Has a custom URL defined in the main admin structure?
181
-				if (isset($tab['url']) && !isset($tab_context['tabs'][$id]['url']))
182
-					$tab_context['tabs'][$id]['url'] = $tab['url'];
186
+				if (isset($tab['url']) && !isset($tab_context['tabs'][$id]['url'])) {
187
+									$tab_context['tabs'][$id]['url'] = $tab['url'];
188
+				}
183 189
 
184 190
 				// Any additional paramaters for the url?
185
-				if (isset($tab['add_params']) && !isset($tab_context['tabs'][$id]['add_params']))
186
-					$tab_context['tabs'][$id]['add_params'] = $tab['add_params'];
191
+				if (isset($tab['add_params']) && !isset($tab_context['tabs'][$id]['add_params'])) {
192
+									$tab_context['tabs'][$id]['add_params'] = $tab['add_params'];
193
+				}
187 194
 
188 195
 				// Has it been deemed selected?
189
-				if (!empty($tab['is_selected']))
190
-					$tab_context['tabs'][$id]['is_selected'] = true;
196
+				if (!empty($tab['is_selected'])) {
197
+									$tab_context['tabs'][$id]['is_selected'] = true;
198
+				}
191 199
 
192 200
 				// Does it have its own help?
193
-				if (!empty($tab['help']))
194
-					$tab_context['tabs'][$id]['help'] = $tab['help'];
201
+				if (!empty($tab['help'])) {
202
+									$tab_context['tabs'][$id]['help'] = $tab['help'];
203
+				}
195 204
 
196 205
 				// Is this the last one?
197
-				if (!empty($tab['is_last']) && !isset($tab_context['override_last']))
198
-					$tab_context['tabs'][$id]['is_last'] = true;
206
+				if (!empty($tab['is_last']) && !isset($tab_context['override_last'])) {
207
+									$tab_context['tabs'][$id]['is_last'] = true;
208
+				}
199 209
 			}
200 210
 
201 211
 			// Find the selected tab
@@ -212,22 +222,24 @@  discard block
 block discarded – undo
212 222
 		// Show an icon and/or a help item?
213 223
 		if (!empty($selected_tab['icon_class']) || !empty($tab_context['icon_class']) || !empty($selected_tab['icon']) || !empty($tab_context['icon']) || !empty($selected_tab['help']) || !empty($tab_context['help']))
214 224
 		{
215
-			if (!empty($selected_tab['icon_class']) || !empty($tab_context['icon_class']))
216
-				echo '
225
+			if (!empty($selected_tab['icon_class']) || !empty($tab_context['icon_class'])) {
226
+							echo '
217 227
 								<span class="', !empty($selected_tab['icon_class']) ? $selected_tab['icon_class'] : $tab_context['icon_class'], ' icon"></span>';
218
-			elseif (!empty($selected_tab['icon']) || !empty($tab_context['icon']))
219
-				echo '
228
+			} elseif (!empty($selected_tab['icon']) || !empty($tab_context['icon'])) {
229
+							echo '
220 230
 								<img src="', $settings['images_url'], '/icons/', !empty($selected_tab['icon']) ? $selected_tab['icon'] : $tab_context['icon'], '" alt="" class="icon">';
231
+			}
221 232
 
222
-			if (!empty($selected_tab['help']) || !empty($tab_context['help']))
223
-				echo '
233
+			if (!empty($selected_tab['help']) || !empty($tab_context['help'])) {
234
+							echo '
224 235
 								<a href="', $scripturl, '?action=helpadmin;help=', !empty($selected_tab['help']) ? $selected_tab['help'] : $tab_context['help'], '" onclick="return reqOverlayDiv(this.href);" class="help"><span class="generic_icons help" title="', $txt['help'], '"></span></a>';
236
+			}
225 237
 
226 238
 			echo $tab_context['title'];
227
-		}
228
-		else
229
-			echo '
239
+		} else {
240
+					echo '
230 241
 								', $tab_context['title'];
242
+		}
231 243
 
232 244
 		echo '
233 245
 							</h3>', (function_exists('template_admin_quick_search') ? '
@@ -236,11 +248,12 @@  discard block
 block discarded – undo
236 248
 	}
237 249
 
238 250
 	// Shall we use the tabs? Yes, it's the only known way!
239
-	if (!empty($selected_tab['description']) || !empty($tab_context['description']))
240
-		echo '
251
+	if (!empty($selected_tab['description']) || !empty($tab_context['description'])) {
252
+			echo '
241 253
 					<p class="information">
242 254
 						', !empty($selected_tab['description']) ? $selected_tab['description'] : $tab_context['description'], '
243 255
 					</p>';
256
+	}
244 257
 
245 258
 	// Print out all the items in this tab (if any).
246 259
 	if (!empty($context['tabs']))
@@ -252,19 +265,21 @@  discard block
 block discarded – undo
252 265
 
253 266
 		foreach ($tab_context['tabs'] as $sa => $tab)
254 267
 		{
255
-			if (!empty($tab['disabled']))
256
-				continue;
268
+			if (!empty($tab['disabled'])) {
269
+							continue;
270
+			}
257 271
 
258
-			if (!empty($tab['is_selected']))
259
-				echo '
272
+			if (!empty($tab['is_selected'])) {
273
+							echo '
260 274
 							<li>
261 275
 								<a class="active" href="', isset($tab['url']) ? $tab['url'] : $menu_context['base_url'] . ';area=' . $menu_context['current_area'] . ';sa=' . $sa, $menu_context['extra_parameters'], isset($tab['add_params']) ? $tab['add_params'] : '', '">', $tab['label'], '</a>
262 276
 							</li>';
263
-			else
264
-				echo '
277
+			} else {
278
+							echo '
265 279
 							<li>
266 280
 								<a href="', isset($tab['url']) ? $tab['url'] : $menu_context['base_url'] . ';area=' . $menu_context['current_area'] . ';sa=' . $sa, $menu_context['extra_parameters'], isset($tab['add_params']) ? $tab['add_params'] : '', '">', $tab['label'], '</a>
267 281
 							</li>';
282
+			}
268 283
 		}
269 284
 
270 285
 		// The end of tabs
Please login to merge, or discard this patch.
Themes/default/Reports.template.php 1 patch
Braces   +32 added lines, -24 removed lines patch added patch discarded remove patch
@@ -29,9 +29,10 @@  discard block
 block discarded – undo
29 29
 	// Go through each type of report they can run.
30 30
 	foreach ($context['report_types'] as $type)
31 31
 	{
32
-		if (isset($type['description']))
33
-			echo '
32
+		if (isset($type['description'])) {
33
+					echo '
34 34
 					<dt>', $type['description'], '</dt>';
35
+		}
35 36
 
36 37
 		echo '
37 38
 					<dd>
@@ -62,8 +63,9 @@  discard block
 block discarded – undo
62 63
 		</div>
63 64
 		<div id="report_buttons">';
64 65
 
65
-	if (!empty($context['report_buttons']))
66
-		template_button_strip($context['report_buttons'], 'right');
66
+	if (!empty($context['report_buttons'])) {
67
+			template_button_strip($context['report_buttons'], 'right');
68
+	}
67 69
 
68 70
 	echo '
69 71
 		</div>';
@@ -74,25 +76,27 @@  discard block
 block discarded – undo
74 76
 		echo '
75 77
 		<table class="table_grid report_results">';
76 78
 
77
-		if (!empty($table['title']))
78
-			echo '
79
+		if (!empty($table['title'])) {
80
+					echo '
79 81
 			<thead>
80 82
 				<tr class="title_bar">
81 83
 					<th scope="col" colspan="', $table['column_count'], '">', $table['title'], '</th>
82 84
 				</tr>
83 85
 			</thead>
84 86
 			<tbody>';
87
+		}
85 88
 
86 89
 		// Now do each row!
87 90
 		$row_number = 0;
88 91
 		foreach ($table['data'] as $row)
89 92
 		{
90
-			if ($row_number == 0 && !empty($table['shading']['top']))
91
-				echo '
93
+			if ($row_number == 0 && !empty($table['shading']['top'])) {
94
+							echo '
92 95
 				<tr class="windowbg table_caption">';
93
-			else
94
-				echo '
96
+			} else {
97
+							echo '
95 98
 				<tr class="', !empty($row[0]['separator']) ? 'title_bar' : 'windowbg', '">';
99
+			}
96 100
 
97 101
 			// Now do each column.
98 102
 			$column_number = 0;
@@ -110,16 +114,17 @@  discard block
 block discarded – undo
110 114
 				}
111 115
 
112 116
 				// Shaded?
113
-				if ($column_number == 0 && !empty($table['shading']['left']))
114
-					echo '
117
+				if ($column_number == 0 && !empty($table['shading']['left'])) {
118
+									echo '
115 119
 					<td class="table_caption ', $table['align']['shaded'], 'text"', $table['width']['shaded'] != 'auto' ? ' width="' . $table['width']['shaded'] . '"' : '', '>
116 120
 						', $data['v'] == $table['default_value'] ? '' : ($data['v'] . (empty($data['v']) ? '' : ':')), '
117 121
 					</td>';
118
-				else
119
-					echo '
122
+				} else {
123
+									echo '
120 124
 					<td class="smalltext centertext" ', $table['width']['normal'] != 'auto' ? ' width="' . $table['width']['normal'] . '"' : '', !empty($data['style']) ? ' style="' . $data['style'] . '"' : '', '>
121 125
 						', $data['v'], '
122 126
 					</td>';
127
+				}
123 128
 
124 129
 				$column_number++;
125 130
 			}
@@ -168,24 +173,26 @@  discard block
 block discarded – undo
168 173
 		<div style="overflow: visible;', $table['max_width'] != 'auto' ? ' width: ' . $table['max_width'] . 'px;' : '', '">
169 174
 			<table class="bordercolor">';
170 175
 
171
-		if (!empty($table['title']))
172
-			echo '
176
+		if (!empty($table['title'])) {
177
+					echo '
173 178
 				<tr class="title_bar">
174 179
 					<td colspan="', $table['column_count'], '">
175 180
 						', $table['title'], '
176 181
 					</td>
177 182
 				</tr>';
183
+		}
178 184
 
179 185
 		// Now do each row!
180 186
 		$row_number = 0;
181 187
 		foreach ($table['data'] as $row)
182 188
 		{
183
-			if ($row_number == 0 && !empty($table['shading']['top']))
184
-				echo '
189
+			if ($row_number == 0 && !empty($table['shading']['top'])) {
190
+							echo '
185 191
 				<tr class="titlebg">';
186
-			else
187
-				echo '
192
+			} else {
193
+							echo '
188 194
 				<tr class="windowbg">';
195
+			}
189 196
 
190 197
 			// Now do each column!!
191 198
 			$column_number = 0;
@@ -202,16 +209,17 @@  discard block
 block discarded – undo
202 209
 				}
203 210
 
204 211
 				// Shaded?
205
-				if ($column_number == 0 && !empty($table['shading']['left']))
206
-					echo '
212
+				if ($column_number == 0 && !empty($table['shading']['left'])) {
213
+									echo '
207 214
 					<td class="titlebg ', $table['align']['shaded'], 'text"', $table['width']['shaded'] != 'auto' ? ' width="' . $table['width']['shaded'] . '"' : '', '>
208 215
 						', $data['v'] == $table['default_value'] ? '' : ($data['v'] . (empty($data['v']) ? '' : ':')), '
209 216
 					</td>';
210
-				else
211
-					echo '
217
+				} else {
218
+									echo '
212 219
 					<td class="centertext" ', $table['width']['normal'] != 'auto' ? ' width="' . $table['width']['normal'] . '"' : '', !empty($data['style']) ? ' style="' . $data['style'] . '"' : '', '>
213 220
 						', $data['v'], '
214 221
 					</td>';
222
+				}
215 223
 
216 224
 				$column_number++;
217 225
 			}
Please login to merge, or discard this patch.
Themes/default/ManagePermissions.template.php 1 patch
Braces   +170 added lines, -128 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,26 +74,28 @@  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'] . '">', '<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;"' : '', '>
89 93
 							', $group['num_permissions']['allowed'], '
90 94
 						</td>
91 95
 						<td ', $group['id'] == 1 || $group['id'] == -1 ? ' style="font-style: italic;"' : (!empty($group['num_permissions']['denied']) ? ' class="red"' : ''), '>
92 96
 							', $group['num_permissions']['denied'], '
93 97
 						</td>';
98
+		}
94 99
 
95 100
 		echo '
96 101
 						<td>
@@ -141,10 +146,11 @@  discard block
 block discarded – undo
141 146
 							<select name="copy_from">
142 147
 								<option value="empty">(', $txt['permissions_select_membergroup'], ')</option>';
143 148
 
144
-		foreach ($context['groups'] as $group)
145
-			if ($group['id'] != 1)
149
+		foreach ($context['groups'] as $group) {
150
+					if ($group['id'] != 1)
146 151
 				echo '
147 152
 								<option value="', $group['id'], '">', $group['name'], '</option>';
153
+		}
148 154
 
149 155
 		echo '
150 156
 							</select>
@@ -154,9 +160,10 @@  discard block
 block discarded – undo
154 160
 								<option value="add">', $txt['permissions_add'], '...</option>
155 161
 								<option value="clear">', $txt['permissions_remove'], '...</option>';
156 162
 
157
-		if (!empty($modSettings['permission_enable_deny']))
158
-			echo '
163
+		if (!empty($modSettings['permission_enable_deny'])) {
164
+					echo '
159 165
 								<option value="deny">', $txt['permissions_deny'], '...</option>';
166
+		}
160 167
 
161 168
 		echo '
162 169
 							</select>
@@ -167,31 +174,35 @@  discard block
 block discarded – undo
167 174
 
168 175
 		foreach ($context['permissions'] as $permissionType)
169 176
 		{
170
-			if ($permissionType['id'] == 'membergroup' && !empty($context['profile']))
171
-				continue;
177
+			if ($permissionType['id'] == 'membergroup' && !empty($context['profile'])) {
178
+							continue;
179
+			}
172 180
 
173 181
 			foreach ($permissionType['columns'] as $column)
174 182
 			{
175 183
 				foreach ($column as $permissionGroup)
176 184
 				{
177
-					if ($permissionGroup['hidden'])
178
-						continue;
185
+					if ($permissionGroup['hidden']) {
186
+											continue;
187
+					}
179 188
 
180 189
 					echo '
181 190
 								<option value="" disabled>[', $permissionGroup['name'], ']</option>';
182 191
 
183 192
 					foreach ($permissionGroup['permissions'] as $perm)
184 193
 					{
185
-						if ($perm['hidden'])
186
-							continue;
194
+						if ($perm['hidden']) {
195
+													continue;
196
+						}
187 197
 
188
-						if ($perm['has_own_any'])
189
-							echo '
198
+						if ($perm['has_own_any']) {
199
+													echo '
190 200
 								<option value="', $permissionType['id'], '/', $perm['own']['id'], '">&nbsp;&nbsp;&nbsp;', $perm['name'], ' (', $perm['own']['name'], ')</option>
191 201
 								<option value="', $permissionType['id'], '/', $perm['any']['id'], '">&nbsp;&nbsp;&nbsp;', $perm['name'], ' (', $perm['any']['name'], ')</option>';
192
-						else
193
-							echo '
202
+						} else {
203
+													echo '
194 204
 								<option value="', $permissionType['id'], '/', $perm['id'], '">&nbsp;&nbsp;&nbsp;', $perm['name'], '</option>';
205
+						}
195 206
 					}
196 207
 				}
197 208
 			}
@@ -256,9 +267,10 @@  discard block
 block discarded – undo
256 267
 				}
257 268
 			</script>';
258 269
 
259
-		if (!empty($context['profile']))
260
-			echo '
270
+		if (!empty($context['profile'])) {
271
+					echo '
261 272
 			<input type="hidden" name="pid" value="', $context['profile']['id'], '">';
273
+		}
262 274
 
263 275
 		echo '
264 276
 			<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
@@ -303,9 +315,10 @@  discard block
 block discarded – undo
303 315
 					<h3 class="subbg">', $category['name'], '</h3>
304 316
 				</div>';
305 317
 
306
-		if (!empty($category['boards']))
307
-			echo '
318
+		if (!empty($category['boards'])) {
319
+					echo '
308 320
 				<ul class="perm_boards flow_hidden">';
321
+		}
309 322
 
310 323
 		foreach ($category['boards'] as $board)
311 324
 		{
@@ -321,33 +334,36 @@  discard block
 block discarded – undo
321 334
 				echo '
322 335
 							<select name="boardprofile[', $board['id'], ']">';
323 336
 
324
-				foreach ($context['profiles'] as $id => $profile)
325
-					echo '
337
+				foreach ($context['profiles'] as $id => $profile) {
338
+									echo '
326 339
 								<option value="', $id, '"', $id == $board['profile'] ? ' selected' : '', '>', $profile['name'], '</option>';
340
+				}
327 341
 
328 342
 				echo '
329 343
 							</select>';
330
-			}
331
-			else
332
-				echo '
344
+			} else {
345
+							echo '
333 346
 							<a href="', $scripturl, '?action=admin;area=permissions;sa=index;pid=', $board['profile'], ';', $context['session_var'], '=', $context['session_id'], '">', $board['profile_name'], '</a>';
347
+			}
334 348
 
335 349
 			echo '
336 350
 						</span>
337 351
 					</li>';
338 352
 		}
339 353
 
340
-		if (!empty($category['boards']))
341
-			echo '
354
+		if (!empty($category['boards'])) {
355
+					echo '
342 356
 				</ul>';
357
+		}
343 358
 	}
344 359
 
345
-	if ($context['edit_all'])
346
-		echo '
360
+	if ($context['edit_all']) {
361
+			echo '
347 362
 				<input type="submit" name="save_changes" value="', $txt['save'], '" class="button">';
348
-	else
349
-		echo '
363
+	} else {
364
+			echo '
350 365
 				<a class="button" href="', $scripturl, '?action=admin;area=permissions;sa=board;edit;', $context['session_var'], '=', $context['session_id'], '">', $txt['permissions_board_all'], '</a>';
366
+	}
351 367
 
352 368
 	echo '
353 369
 				<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
@@ -387,12 +403,13 @@  discard block
 block discarded – undo
387 403
 					<tr class="windowbg">
388 404
 						<td>';
389 405
 
390
-		if (!empty($context['show_rename_boxes']) && $profile['can_edit'])
391
-			echo '
406
+		if (!empty($context['show_rename_boxes']) && $profile['can_edit']) {
407
+					echo '
392 408
 							<input type="text" name="rename_profile[', $profile['id'], ']" value="', $profile['name'], '">';
393
-		else
394
-			echo '
409
+		} else {
410
+					echo '
395 411
 							<a href="', $scripturl, '?action=admin;area=permissions;sa=index;pid=', $profile['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $profile['name'], '</a>';
412
+		}
396 413
 
397 414
 		echo '
398 415
 						</td>
@@ -412,9 +429,10 @@  discard block
 block discarded – undo
412 429
 				<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
413 430
 				<input type="hidden" name="', $context['admin-mpp_token_var'], '" value="', $context['admin-mpp_token'], '">';
414 431
 
415
-	if ($context['can_edit_something'])
416
-		echo '
432
+	if ($context['can_edit_something']) {
433
+			echo '
417 434
 				<input type="submit" name="rename" value="', empty($context['show_rename_boxes']) ? $txt['permissions_profile_rename'] : $txt['permissions_commit'], '" class="button">';
435
+	}
418 436
 
419 437
 	echo '
420 438
 				<input type="submit" name="delete" value="', $txt['quickmod_delete_selected'], '" class="button" ', !empty($context['show_rename_boxes']) ? ' style="display:none"' : '', '>
@@ -439,9 +457,10 @@  discard block
 block discarded – undo
439 457
 					<dd>
440 458
 						<select name="copy_from">';
441 459
 
442
-	foreach ($context['profiles'] as $id => $profile)
443
-		echo '
460
+	foreach ($context['profiles'] as $id => $profile) {
461
+			echo '
444 462
 							<option value="', $id, '">', $profile['name'], '</option>';
463
+	}
445 464
 
446 465
 	echo '
447 466
 						</select>
@@ -463,13 +482,13 @@  discard block
 block discarded – undo
463 482
 	global $context, $scripturl, $txt, $modSettings;
464 483
 
465 484
 	// Cannot be edited?
466
-	if (!$context['profile']['can_modify'])
467
-		echo '
485
+	if (!$context['profile']['can_modify']) {
486
+			echo '
468 487
 	<div class="errorbox">
469 488
 		', sprintf($txt['permission_cannot_edit'], $scripturl . '?action=admin;area=permissions;sa=profiles'), '
470 489
 	</div>';
471
-	else
472
-		echo '
490
+	} else {
491
+			echo '
473 492
 	<script>
474 493
 		window.smf_usedDeny = false;
475 494
 
@@ -481,27 +500,30 @@  discard block
 block discarded – undo
481 500
 				return true;
482 501
 		}
483 502
 	</script>';
503
+	}
484 504
 
485 505
 	echo '
486 506
 	<div id="admincenter">
487 507
 		<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();">';
488 508
 
489
-	if (!empty($modSettings['permission_enable_deny']) && $context['group']['id'] != -1)
490
-		echo '
509
+	if (!empty($modSettings['permission_enable_deny']) && $context['group']['id'] != -1) {
510
+			echo '
491 511
 			<div class="information">
492 512
 				', $txt['permissions_option_desc'], '
493 513
 			</div>';
514
+	}
494 515
 
495 516
 	echo '
496 517
 			<div class="cat_bar">
497 518
 				<h3 class="catbg">';
498 519
 
499
-	if ($context['permission_type'] == 'board')
500
-		echo '
520
+	if ($context['permission_type'] == 'board') {
521
+			echo '
501 522
 				', $txt['permissions_local_for'], ' &quot;', $context['group']['name'], '&quot; ', $txt['permissions_on'], ' &quot;', $context['profile']['name'], '&quot;';
502
-	else
503
-		echo '
523
+	} else {
524
+			echo '
504 525
 				', $context['permission_type'] == 'membergroup' ? $txt['permissions_general'] : $txt['permissions_board'], ' - &quot;', $context['group']['name'], '&quot;';
526
+	}
505 527
 	echo '
506 528
 				</h3>
507 529
 			</div>';
@@ -524,15 +546,17 @@  discard block
 block discarded – undo
524 546
 		template_modify_group_display('board');
525 547
 	}
526 548
 
527
-	if ($context['profile']['can_modify'])
528
-		echo '
549
+	if ($context['profile']['can_modify']) {
550
+			echo '
529 551
 			<div class="padding">
530 552
 				<input type="submit" value="', $txt['permissions_commit'], '" class="button">
531 553
 			</div>';
554
+	}
532 555
 
533
-	foreach ($context['hidden_perms'] as $hidden_perm)
534
-		echo '
556
+	foreach ($context['hidden_perms'] as $hidden_perm) {
557
+			echo '
535 558
 			<input type="hidden" name="perm[', $hidden_perm[0], '][', $hidden_perm[1], ']" value="', $hidden_perm[2], '">';
559
+	}
536 560
 
537 561
 	echo '
538 562
 			<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
@@ -560,17 +584,19 @@  discard block
 block discarded – undo
560 584
 
561 585
 		foreach ($column as $permissionGroup)
562 586
 		{
563
-			if (empty($permissionGroup['permissions']))
564
-				continue;
587
+			if (empty($permissionGroup['permissions'])) {
588
+							continue;
589
+			}
565 590
 
566 591
 			// Are we likely to have something in this group to display or is it all hidden?
567 592
 			$has_display_content = false;
568 593
 			if (!$permissionGroup['hidden'])
569 594
 			{
570 595
 				// Before we go any further check we are going to have some data to print otherwise we just have a silly heading.
571
-				foreach ($permissionGroup['permissions'] as $permission)
572
-					if (!$permission['hidden'])
596
+				foreach ($permissionGroup['permissions'] as $permission) {
597
+									if (!$permission['hidden'])
573 598
 						$has_display_content = true;
599
+				}
574 600
 
575 601
 				if ($has_display_content)
576 602
 				{
@@ -579,10 +605,11 @@  discard block
 block discarded – undo
579 605
 							<th></th>
580 606
 							<th', $context['group']['id'] == -1 ? ' colspan="2"' : '', ' class="smalltext">', $permissionGroup['name'], '</th>';
581 607
 
582
-					if ($context['group']['id'] != -1)
583
-						echo '
608
+					if ($context['group']['id'] != -1) {
609
+											echo '
584 610
 							<th>', $txt['permissions_option_own'], '</th>
585 611
 							<th>', $txt['permissions_option_any'], '</th>';
612
+					}
586 613
 
587 614
 					echo '
588 615
 						</tr>';
@@ -605,17 +632,18 @@  discard block
 block discarded – undo
605 632
 						// Guests can't do their own thing.
606 633
 						if ($context['group']['id'] != -1)
607 634
 						{
608
-							if (empty($modSettings['permission_enable_deny']))
609
-								echo '
635
+							if (empty($modSettings['permission_enable_deny'])) {
636
+															echo '
610 637
 								<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, '>';
611
-							else
638
+							} else
612 639
 							{
613 640
 								echo '
614 641
 								<select name="perm[', $permission_type['id'], '][', $permission['own']['id'], ']" ', $disable_field, '>';
615 642
 
616
-								foreach (array('on', 'off', 'deny') as $c)
617
-									echo '
643
+								foreach (array('on', 'off', 'deny') as $c) {
644
+																	echo '
618 645
 									<option ', $permission['own']['select'] == $c ? ' selected' : '', ' value="', $c, '">', $txt['permissions_option_' . $c], '</option>';
646
+								}
619 647
 								echo '
620 648
 								</select>';
621 649
 							}
@@ -625,39 +653,41 @@  discard block
 block discarded – undo
625 653
 							<td>';
626 654
 						}
627 655
 
628
-						if (empty($modSettings['permission_enable_deny']) || $context['group']['id'] == -1)
629
-							echo '
656
+						if (empty($modSettings['permission_enable_deny']) || $context['group']['id'] == -1) {
657
+													echo '
630 658
 								<input type="checkbox" name="perm[', $permission_type['id'], '][', $permission['any']['id'], ']"', $permission['any']['select'] == 'on' ? ' checked="checked"' : '', ' value="on" ', $disable_field, '>';
631
-						else
659
+						} else
632 660
 						{
633 661
 							echo '
634 662
 								<select name="perm[', $permission_type['id'], '][', $permission['any']['id'], ']" ', $disable_field, '>';
635 663
 
636
-							foreach (array('on', 'off', 'deny') as $c)
637
-								echo '
664
+							foreach (array('on', 'off', 'deny') as $c) {
665
+															echo '
638 666
 									<option ', $permission['any']['select'] == $c ? ' selected' : '', ' value="', $c, '">', $txt['permissions_option_' . $c], '</option>';
667
+							}
639 668
 							echo '
640 669
 								</select>';
641 670
 						}
642
-					}
643
-					else
671
+					} else
644 672
 					{
645
-						if ($context['group']['id'] != -1)
646
-							echo '
673
+						if ($context['group']['id'] != -1) {
674
+													echo '
647 675
 							</td>
648 676
 							<td>';
677
+						}
649 678
 
650
-						if (empty($modSettings['permission_enable_deny']) || $context['group']['id'] == -1)
651
-							echo '
679
+						if (empty($modSettings['permission_enable_deny']) || $context['group']['id'] == -1) {
680
+													echo '
652 681
 								<input type="checkbox" name="perm[', $permission_type['id'], '][', $permission['id'], ']"', $permission['select'] == 'on' ? ' checked="checked"' : '', ' value="on" ', $disable_field, '>';
653
-						else
682
+						} else
654 683
 						{
655 684
 							echo '
656 685
 								<select name="perm[', $permission_type['id'], '][', $permission['id'], ']" ', $disable_field, '>';
657 686
 
658
-							foreach (array('on', 'off', 'deny') as $c)
659
-								echo '
687
+							foreach (array('on', 'off', 'deny') as $c) {
688
+															echo '
660 689
 									<option ', $permission['select'] == $c ? ' selected' : '', ' value="', $c, '">', $txt['permissions_option_' . $c], '</option>';
690
+							}
661 691
 							echo '
662 692
 								</select>';
663 693
 						}
@@ -689,11 +719,11 @@  discard block
 block discarded – undo
689 719
 											<fieldset id="', $context['current_permission'], '">
690 720
 												<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>';
691 721
 
692
-	if (empty($modSettings['permission_enable_deny']))
693
-		echo '
722
+	if (empty($modSettings['permission_enable_deny'])) {
723
+			echo '
694 724
 												<ul>';
695
-	else
696
-		echo '
725
+	} else {
726
+			echo '
697 727
 												<div class="information">', $txt['permissions_option_desc'], '</div>
698 728
 												<dl class="settings">
699 729
 													<dt>
@@ -703,47 +733,52 @@  discard block
 block discarded – undo
703 733
 													</dt>
704 734
 													<dd>
705 735
 													</dd>';
736
+	}
706 737
 
707 738
 	foreach ($context['member_groups'] as $group)
708 739
 	{
709
-		if (!empty($modSettings['permission_enable_deny']))
710
-			echo '
740
+		if (!empty($modSettings['permission_enable_deny'])) {
741
+					echo '
711 742
 													<dt>';
712
-		else
713
-			echo '
743
+		} else {
744
+					echo '
714 745
 													<li>';
746
+		}
715 747
 
716
-		if (empty($modSettings['permission_enable_deny']))
717
-			echo '
748
+		if (empty($modSettings['permission_enable_deny'])) {
749
+					echo '
718 750
 														<input type="checkbox" name="', $context['current_permission'], '[', $group['id'], ']" value="on"', $group['status'] == 'on' ? ' checked' : '', '>';
719
-		else
720
-			echo '
751
+		} else {
752
+					echo '
721 753
 														<span class="perms"><input type="radio" name="', $context['current_permission'], '[', $group['id'], ']" value="on"', $group['status'] == 'on' ? ' checked' : '', '></span>
722 754
 														<span class="perms"><input type="radio" name="', $context['current_permission'], '[', $group['id'], ']" value="off"', $group['status'] == 'off' ? ' checked' : '', '></span>
723 755
 														<span class="perms"><input type="radio" name="', $context['current_permission'], '[', $group['id'], ']" value="deny"', $group['status'] == 'deny' ? ' checked' : '', '></span>';
756
+		}
724 757
 
725
-		if (!empty($modSettings['permission_enable_deny']))
726
-			echo '
758
+		if (!empty($modSettings['permission_enable_deny'])) {
759
+					echo '
727 760
 													</dt>
728 761
 													<dd>
729 762
 														<span', $group['is_postgroup'] ? ' style="font-style: italic;"' : '', '>', $group['name'], '</span>
730 763
 													</dd>';
731
-		else
732
-			echo '
764
+		} else {
765
+					echo '
733 766
 														<span', $group['is_postgroup'] ? ' style="font-style: italic;"' : '', '>', $group['name'], '</span>
734 767
 													</li>';
768
+		}
735 769
 	}
736 770
 
737
-	if (empty($modSettings['permission_enable_deny']))
738
-		echo '
771
+	if (empty($modSettings['permission_enable_deny'])) {
772
+			echo '
739 773
 													<li>
740 774
 														<input type="checkbox" onclick="invertAll(this, this.form, \''. $context['current_permission'] . '[\');">
741 775
 														<span>', $txt['check_all'], '</span>
742 776
 													</li>
743 777
 												</ul>';
744
-	else
745
-		echo '
778
+	} else {
779
+			echo '
746 780
 												</dl>';
781
+	}
747 782
 
748 783
 	echo '
749 784
 											</fieldset>
@@ -783,9 +818,10 @@  discard block
 block discarded – undo
783 818
 	if (!empty($modSettings['postmod_active']))
784 819
 	{
785 820
 		// Got advanced permissions - if so warn!
786
-		if (!empty($modSettings['permission_enable_deny']))
787
-			echo '
821
+		if (!empty($modSettings['permission_enable_deny'])) {
822
+					echo '
788 823
 							<div class="information">', $txt['permissions_post_moderation_deny_note'], '</div>';
824
+		}
789 825
 
790 826
 		echo '
791 827
 							<div class="padding">
@@ -800,10 +836,11 @@  discard block
 block discarded – undo
800 836
 									', $txt['permissions_post_moderation_select'], ':
801 837
 									<select name="pid" onchange="document.forms.postmodForm.submit();">';
802 838
 
803
-		foreach ($context['profiles'] as $profile)
804
-			if ($profile['can_modify'])
839
+		foreach ($context['profiles'] as $profile) {
840
+					if ($profile['can_modify'])
805 841
 				echo '
806 842
 										<option value="', $profile['id'], '"', $profile['id'] == $context['current_profile'] ? ' selected' : '', '>', $profile['name'], '</option>';
843
+		}
807 844
 
808 845
 		echo '
809 846
 									</select>
@@ -824,11 +861,12 @@  discard block
 block discarded – undo
824 861
 											', $txt['permissions_post_moderation_replies_any'], '
825 862
 										</th>';
826 863
 
827
-		if ($modSettings['attachmentEnable'] == 1)
828
-			echo '
864
+		if ($modSettings['attachmentEnable'] == 1) {
865
+					echo '
829 866
 										<th class="centercol" colspan="3">
830 867
 											', $txt['permissions_post_moderation_attachments'], '
831 868
 										</th>';
869
+		}
832 870
 
833 871
 		echo '
834 872
 									</tr>
@@ -846,11 +884,12 @@  discard block
 block discarded – undo
846 884
 										<th><span class="generic_icons post_moderation_moderate"></span></th>
847 885
 										<th><span class="generic_icons post_moderation_deny"></span></th>';
848 886
 
849
-		if ($modSettings['attachmentEnable'] == 1)
850
-			echo '
887
+		if ($modSettings['attachmentEnable'] == 1) {
888
+					echo '
851 889
 										<th><span class="generic_icons post_moderation_allow"></span></th>
852 890
 										<th><span class="generic_icons post_moderation_moderate"></span></th>
853 891
 										<th><span class="generic_icons post_moderation_deny"></span></th>';
892
+		}
854 893
 
855 894
 		echo '
856 895
 									</tr>
@@ -864,10 +903,11 @@  discard block
 block discarded – undo
864 903
 										<td class="half_table">
865 904
 											<span ', ($group['color'] ? 'style="color: ' . $group['color'] . '"' : ''), '>', $group['name'], '</span>';
866 905
 
867
-				if (!empty($group['children']))
868
-					echo '
906
+				if (!empty($group['children'])) {
907
+									echo '
869 908
 											<br>
870 909
 											<span class="smalltext">', $txt['permissions_includes_inherited'], ': &quot;', implode('&quot;, &quot;', $group['children']), '&quot;</span>';
910
+				}
871 911
 
872 912
 				echo '
873 913
 										</td>
@@ -882,11 +922,11 @@  discard block
 block discarded – undo
882 922
 										</td>';
883 923
 
884 924
 				// Guests can't have "own" permissions
885
-				if ($group['id'] == '-1')
886
-					echo '
925
+				if ($group['id'] == '-1') {
926
+									echo '
887 927
 										<td colspan="3"></td>';
888
-				else
889
-					echo '
928
+				} else {
929
+									echo '
890 930
 										<td class="centercol">
891 931
 											<input type="radio" name="replies_own[', $group['id'], ']" value="allow"', $group['replies_own'] == 'allow' ? ' checked' : '', '>
892 932
 										</td>
@@ -896,6 +936,7 @@  discard block
 block discarded – undo
896 936
 										<td class="centercol">
897 937
 											<input type="radio" name="replies_own[', $group['id'], ']" value="disallow"', $group['replies_own'] == 'disallow' ? ' checked' : '', '>
898 938
 										</td>';
939
+				}
899 940
 
900 941
 				echo '
901 942
 										<td class="centercol">
@@ -908,8 +949,8 @@  discard block
 block discarded – undo
908 949
 											<input type="radio" name="replies_any[', $group['id'], ']" value="disallow"', $group['replies_any'] == 'disallow' ? ' checked' : '', '>
909 950
 										</td>';
910 951
 
911
-				if ($modSettings['attachmentEnable'] == 1)
912
-					echo '
952
+				if ($modSettings['attachmentEnable'] == 1) {
953
+									echo '
913 954
 										<td class="centercol">
914 955
 											<input type="radio" name="attachment[', $group['id'], ']" value="allow"', $group['attachment'] == 'allow' ? ' checked' : '', '>
915 956
 										</td>
@@ -919,6 +960,7 @@  discard block
 block discarded – undo
919 960
 										<td class="centercol">
920 961
 											<input type="radio" name="attachment[', $group['id'], ']" value="disallow"', $group['attachment'] == 'disallow' ? ' checked' : '', '>
921 962
 										</td>';
963
+				}
922 964
 
923 965
 				echo '
924 966
 									</tr>';
Please login to merge, or discard this patch.
Sources/ManageSearch.php 1 patch
Braces   +109 added lines, -90 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
  * Main entry point for the admin search settings screen.
@@ -107,11 +108,13 @@  discard block
 block discarded – undo
107 108
 	// Perhaps the search method wants to add some settings?
108 109
 	require_once($sourcedir . '/Search.php');
109 110
 	$searchAPI = findSearchAPI();
110
-	if (is_callable(array($searchAPI, 'searchSettings')))
111
-		call_user_func_array(array($searchAPI, 'searchSettings'), array(&$config_vars));
111
+	if (is_callable(array($searchAPI, 'searchSettings'))) {
112
+			call_user_func_array(array($searchAPI, 'searchSettings'), array(&$config_vars));
113
+	}
112 114
 
113
-	if ($return_config)
114
-		return $config_vars;
115
+	if ($return_config) {
116
+			return $config_vars;
117
+	}
115 118
 
116 119
 	$context['page_title'] = $txt['search_settings_title'];
117 120
 	$context['sub_template'] = 'show_settings';
@@ -126,8 +129,9 @@  discard block
 block discarded – undo
126 129
 
127 130
 		call_integration_hook('integrate_save_search_settings');
128 131
 
129
-		if (empty($_POST['search_results_per_page']))
130
-			$_POST['search_results_per_page'] = !empty($modSettings['search_results_per_page']) ? $modSettings['search_results_per_page'] : $modSettings['defaultMaxMessages'];
132
+		if (empty($_POST['search_results_per_page'])) {
133
+					$_POST['search_results_per_page'] = !empty($modSettings['search_results_per_page']) ? $modSettings['search_results_per_page'] : $modSettings['defaultMaxMessages'];
134
+		}
131 135
 		saveDBSettings($config_vars);
132 136
 		$_SESSION['adm-save'] = true;
133 137
 		redirectexit('action=admin;area=managesearch;sa=settings;' . $context['session_var'] . '=' . $context['session_id']);
@@ -177,17 +181,20 @@  discard block
 block discarded – undo
177 181
 		call_integration_hook('integrate_save_search_weights');
178 182
 
179 183
 		$changes = array();
180
-		foreach ($factors as $factor)
181
-			$changes[$factor] = (int) $_POST[$factor];
184
+		foreach ($factors as $factor) {
185
+					$changes[$factor] = (int) $_POST[$factor];
186
+		}
182 187
 		updateSettings($changes);
183 188
 	}
184 189
 
185 190
 	$context['relative_weights'] = array('total' => 0);
186
-	foreach ($factors as $factor)
187
-		$context['relative_weights']['total'] += isset($modSettings[$factor]) ? $modSettings[$factor] : 0;
191
+	foreach ($factors as $factor) {
192
+			$context['relative_weights']['total'] += isset($modSettings[$factor]) ? $modSettings[$factor] : 0;
193
+	}
188 194
 
189
-	foreach ($factors as $factor)
190
-		$context['relative_weights'][$factor] = round(100 * (isset($modSettings[$factor]) ? $modSettings[$factor] : 0) / $context['relative_weights']['total'], 1);
195
+	foreach ($factors as $factor) {
196
+			$context['relative_weights'][$factor] = round(100 * (isset($modSettings[$factor]) ? $modSettings[$factor] : 0) / $context['relative_weights']['total'], 1);
197
+	}
191 198
 
192 199
 	createToken('admin-msw');
193 200
 }
@@ -215,8 +222,9 @@  discard block
 block discarded – undo
215 222
 	$context['search_apis'] = loadSearchAPIs();
216 223
 
217 224
 	// Detect whether a fulltext index is set.
218
-	if ($context['supports_fulltext'])
219
-		detectFulltextIndex();
225
+	if ($context['supports_fulltext']) {
226
+			detectFulltextIndex();
227
+	}
220 228
 
221 229
 	if (!empty($_REQUEST['sa']) && $_REQUEST['sa'] == 'createfulltext')
222 230
 	{
@@ -240,8 +248,7 @@  discard block
 block discarded – undo
240 248
 					'language' => $language_ftx
241 249
 				)
242 250
 			);
243
-		}
244
-		else
251
+		} else
245 252
 		{
246 253
 			// Make sure it's gone before creating it.
247 254
 			$smcFunc['db_query']('', '
@@ -259,8 +266,7 @@  discard block
 block discarded – undo
259 266
 				)
260 267
 			);
261 268
 		}
262
-	}
263
-	elseif (!empty($_REQUEST['sa']) && $_REQUEST['sa'] == 'removefulltext' && !empty($context['fulltext_index']))
269
+	} elseif (!empty($_REQUEST['sa']) && $_REQUEST['sa'] == 'removefulltext' && !empty($context['fulltext_index']))
264 270
 	{
265 271
 		checkSession('get');
266 272
 		validateToken('admin-msm', 'get');
@@ -277,12 +283,12 @@  discard block
 block discarded – undo
277 283
 		$context['fulltext_index'] = array();
278 284
 
279 285
 		// Go back to the default search method.
280
-		if (!empty($modSettings['search_index']) && $modSettings['search_index'] == 'fulltext')
281
-			updateSettings(array(
286
+		if (!empty($modSettings['search_index']) && $modSettings['search_index'] == 'fulltext') {
287
+					updateSettings(array(
282 288
 				'search_index' => '',
283 289
 			));
284
-	}
285
-	elseif (!empty($_REQUEST['sa']) && $_REQUEST['sa'] == 'removecustom')
290
+		}
291
+	} elseif (!empty($_REQUEST['sa']) && $_REQUEST['sa'] == 'removecustom')
286 292
 	{
287 293
 		checkSession('get');
288 294
 		validateToken('admin-msm', 'get');
@@ -304,12 +310,12 @@  discard block
 block discarded – undo
304 310
 		));
305 311
 
306 312
 		// Go back to the default search method.
307
-		if (!empty($modSettings['search_index']) && $modSettings['search_index'] == 'custom')
308
-			updateSettings(array(
313
+		if (!empty($modSettings['search_index']) && $modSettings['search_index'] == 'custom') {
314
+					updateSettings(array(
309 315
 				'search_index' => '',
310 316
 			));
311
-	}
312
-	elseif (isset($_POST['save']))
317
+		}
318
+	} elseif (isset($_POST['save']))
313 319
 	{
314 320
 		checkSession();
315 321
 		validateToken('admin-msmpost');
@@ -331,8 +337,8 @@  discard block
 block discarded – undo
331 337
 	// Get some info about the messages table, to show its size and index size.
332 338
 	if ($db_type == 'mysql')
333 339
 	{
334
-		if (preg_match('~^`(.+?)`\.(.+?)$~', $db_prefix, $match) !== 0)
335
-			$request = $smcFunc['db_query']('', '
340
+		if (preg_match('~^`(.+?)`\.(.+?)$~', $db_prefix, $match) !== 0) {
341
+					$request = $smcFunc['db_query']('', '
336 342
 				SHOW TABLE STATUS
337 343
 				FROM {string:database_name}
338 344
 				LIKE {string:table_name}',
@@ -341,14 +347,15 @@  discard block
 block discarded – undo
341 347
 					'table_name' => str_replace('_', '\_', $match[2]) . 'messages',
342 348
 				)
343 349
 			);
344
-		else
345
-			$request = $smcFunc['db_query']('', '
350
+		} else {
351
+					$request = $smcFunc['db_query']('', '
346 352
 				SHOW TABLE STATUS
347 353
 				LIKE {string:table_name}',
348 354
 				array(
349 355
 					'table_name' => str_replace('_', '\_', $db_prefix) . 'messages',
350 356
 				)
351 357
 			);
358
+		}
352 359
 		if ($request !== false && $smcFunc['db_num_rows']($request) == 1)
353 360
 		{
354 361
 			// Only do this if the user has permission to execute this query.
@@ -360,8 +367,8 @@  discard block
 block discarded – undo
360 367
 		}
361 368
 
362 369
 		// Now check the custom index table, if it exists at all.
363
-		if (preg_match('~^`(.+?)`\.(.+?)$~', $db_prefix, $match) !== 0)
364
-			$request = $smcFunc['db_query']('', '
370
+		if (preg_match('~^`(.+?)`\.(.+?)$~', $db_prefix, $match) !== 0) {
371
+					$request = $smcFunc['db_query']('', '
365 372
 				SHOW TABLE STATUS
366 373
 				FROM {string:database_name}
367 374
 				LIKE {string:table_name}',
@@ -370,14 +377,15 @@  discard block
 block discarded – undo
370 377
 					'table_name' => str_replace('_', '\_', $match[2]) . 'log_search_words',
371 378
 				)
372 379
 			);
373
-		else
374
-			$request = $smcFunc['db_query']('', '
380
+		} else {
381
+					$request = $smcFunc['db_query']('', '
375 382
 				SHOW TABLE STATUS
376 383
 				LIKE {string:table_name}',
377 384
 				array(
378 385
 					'table_name' => str_replace('_', '\_', $db_prefix) . 'log_search_words',
379 386
 				)
380 387
 			);
388
+		}
381 389
 		if ($request !== false && $smcFunc['db_num_rows']($request) == 1)
382 390
 		{
383 391
 			// Only do this if the user has permission to execute this query.
@@ -386,8 +394,7 @@  discard block
 block discarded – undo
386 394
 			$context['table_info']['custom_index_length'] = $row['Data_length'] + $row['Index_length'];
387 395
 			$smcFunc['db_free_result']($request);
388 396
 		}
389
-	}
390
-	elseif ($db_type == 'postgresql')
397
+	} elseif ($db_type == 'postgresql')
391 398
 	{
392 399
 		// In order to report the sizes correctly we need to perform vacuum (optimize) on the tables we will be using.
393 400
 		//db_extend();
@@ -429,38 +436,38 @@  discard block
 block discarded – undo
429 436
 					$context['table_info']['data_length'] = (int) $row['table_size'];
430 437
 					$context['table_info']['index_length'] = (int) $row['index_size'];
431 438
 					$context['table_info']['fulltext_length'] = (int) $row['index_size'];
432
-				}
433
-				elseif ($row['indexname'] == $db_prefix . 'log_search_words')
439
+				} elseif ($row['indexname'] == $db_prefix . 'log_search_words')
434 440
 				{
435 441
 					$context['table_info']['index_length'] = (int) $row['index_size'];
436 442
 					$context['table_info']['custom_index_length'] = (int) $row['index_size'];
437 443
 				}
438 444
 			}
439 445
 			$smcFunc['db_free_result']($request);
440
-		}
441
-		else
442
-			// Didn't work for some reason...
446
+		} else {
447
+					// Didn't work for some reason...
443 448
 			$context['table_info'] = array(
444 449
 				'data_length' => $txt['not_applicable'],
445 450
 				'index_length' => $txt['not_applicable'],
446 451
 				'fulltext_length' => $txt['not_applicable'],
447 452
 				'custom_index_length' => $txt['not_applicable'],
448 453
 			);
449
-	}
450
-	else
451
-		$context['table_info'] = array(
454
+		}
455
+	} else {
456
+			$context['table_info'] = array(
452 457
 			'data_length' => $txt['not_applicable'],
453 458
 			'index_length' => $txt['not_applicable'],
454 459
 			'fulltext_length' => $txt['not_applicable'],
455 460
 			'custom_index_length' => $txt['not_applicable'],
456 461
 		);
462
+	}
457 463
 
458 464
 	// Format the data and index length in kilobytes.
459 465
 	foreach ($context['table_info'] as $type => $size)
460 466
 	{
461 467
 		// If it's not numeric then just break.  This database engine doesn't support size.
462
-		if (!is_numeric($size))
463
-			break;
468
+		if (!is_numeric($size)) {
469
+					break;
470
+		}
464 471
 
465 472
 		$context['table_info'][$type] = comma_format($context['table_info'][$type] / 1024) . ' ' . $txt['search_method_kilobytes'];
466 473
 	}
@@ -489,8 +496,9 @@  discard block
 block discarded – undo
489 496
 
490 497
 	// Scotty, we need more time...
491 498
 	@set_time_limit(600);
492
-	if (function_exists('apache_reset_timeout'))
493
-		@apache_reset_timeout();
499
+	if (function_exists('apache_reset_timeout')) {
500
+			@apache_reset_timeout();
501
+	}
494 502
 
495 503
 	$context[$context['admin_menu_name']]['current_subsection'] = 'method';
496 504
 	$context['page_title'] = $txt['search_index_custom'];
@@ -520,8 +528,7 @@  discard block
 block discarded – undo
520 528
 		$context['start'] = (int) $context['index_settings']['resume_at'];
521 529
 		unset($context['index_settings']['resume_at']);
522 530
 		$context['step'] = 1;
523
-	}
524
-	else
531
+	} else
525 532
 	{
526 533
 		$context['index_settings'] = array(
527 534
 			'bytes_per_word' => isset($_REQUEST['bytes_per_word']) && isset($index_properties[$_REQUEST['bytes_per_word']]) ? (int) $_REQUEST['bytes_per_word'] : 2,
@@ -530,12 +537,14 @@  discard block
 block discarded – undo
530 537
 		$context['step'] = isset($_REQUEST['step']) ? (int) $_REQUEST['step'] : 0;
531 538
 
532 539
 		// admin timeouts are painful when building these long indexes - but only if we actually have such things enabled
533
-		if (empty($modSettings['securityDisable']) && $_SESSION['admin_time'] + 3300 < time() && $context['step'] >= 1)
534
-			$_SESSION['admin_time'] = time();
540
+		if (empty($modSettings['securityDisable']) && $_SESSION['admin_time'] + 3300 < time() && $context['step'] >= 1) {
541
+					$_SESSION['admin_time'] = time();
542
+		}
535 543
 	}
536 544
 
537
-	if ($context['step'] !== 0)
538
-		checkSession('request');
545
+	if ($context['step'] !== 0) {
546
+			checkSession('request');
547
+	}
539 548
 
540 549
 	// Step 0: let the user determine how they like their index.
541 550
 	if ($context['step'] === 0)
@@ -564,12 +573,14 @@  discard block
 block discarded – undo
564 573
 			$smcFunc['db_create_word_search']($index_properties[$context['index_settings']['bytes_per_word']]['column_definition']);
565 574
 
566 575
 			// Temporarily switch back to not using a search index.
567
-			if (!empty($modSettings['search_index']) && $modSettings['search_index'] == 'custom')
568
-				updateSettings(array('search_index' => ''));
576
+			if (!empty($modSettings['search_index']) && $modSettings['search_index'] == 'custom') {
577
+							updateSettings(array('search_index' => ''));
578
+			}
569 579
 
570 580
 			// Don't let simultanious processes be updating the search index.
571
-			if (!empty($modSettings['search_custom_index_config']))
572
-				updateSettings(array('search_custom_index_config' => ''));
581
+			if (!empty($modSettings['search_custom_index_config'])) {
582
+							updateSettings(array('search_custom_index_config' => ''));
583
+			}
573 584
 		}
574 585
 
575 586
 		$num_messages = array(
@@ -585,16 +596,16 @@  discard block
 block discarded – undo
585 596
 				'starting_id' => $context['start'],
586 597
 			)
587 598
 		);
588
-		while ($row = $smcFunc['db_fetch_assoc']($request))
589
-			$num_messages[empty($row['todo']) ? 'done' : 'todo'] = $row['num_messages'];
599
+		while ($row = $smcFunc['db_fetch_assoc']($request)) {
600
+					$num_messages[empty($row['todo']) ? 'done' : 'todo'] = $row['num_messages'];
601
+		}
590 602
 
591 603
 		if (empty($num_messages['todo']))
592 604
 		{
593 605
 			$context['step'] = 2;
594 606
 			$context['percentage'] = 80;
595 607
 			$context['start'] = 0;
596
-		}
597
-		else
608
+		} else
598 609
 		{
599 610
 			// Number of seconds before the next step.
600 611
 			$stop = time() + 3;
@@ -635,21 +646,22 @@  discard block
 block discarded – undo
635 646
 
636 647
 				$context['start'] += $forced_break ? $number_processed : $messages_per_batch;
637 648
 
638
-				if (!empty($inserts))
639
-					$smcFunc['db_insert']('ignore',
649
+				if (!empty($inserts)) {
650
+									$smcFunc['db_insert']('ignore',
640 651
 						'{db_prefix}log_search_words',
641 652
 						array('id_word' => 'int', 'id_msg' => 'int'),
642 653
 						$inserts,
643 654
 						array('id_word', 'id_msg')
644 655
 					);
656
+				}
645 657
 				if ($num_messages['todo'] === 0)
646 658
 				{
647 659
 					$context['step'] = 2;
648 660
 					$context['start'] = 0;
649 661
 					break;
662
+				} else {
663
+									updateSettings(array('search_custom_index_resume' => $smcFunc['json_encode'](array_merge($context['index_settings'], array('resume_at' => $context['start'])))));
650 664
 				}
651
-				else
652
-					updateSettings(array('search_custom_index_resume' => $smcFunc['json_encode'](array_merge($context['index_settings'], array('resume_at' => $context['start'])))));
653 665
 			}
654 666
 
655 667
 			// Since there are still two steps to go, 80% is the maximum here.
@@ -660,9 +672,9 @@  discard block
 block discarded – undo
660 672
 	// Step 2: removing the words that occur too often and are of no use.
661 673
 	elseif ($context['step'] === 2)
662 674
 	{
663
-		if ($context['index_settings']['bytes_per_word'] < 4)
664
-			$context['step'] = 3;
665
-		else
675
+		if ($context['index_settings']['bytes_per_word'] < 4) {
676
+					$context['step'] = 3;
677
+		} else
666 678
 		{
667 679
 			$stop_words = $context['start'] === 0 || empty($modSettings['search_stopwords']) ? array() : explode(',', $modSettings['search_stopwords']);
668 680
 			$stop = time() + 3;
@@ -683,20 +695,22 @@  discard block
 block discarded – undo
683 695
 						'minimum_messages' => $max_messages,
684 696
 					)
685 697
 				);
686
-				while ($row = $smcFunc['db_fetch_assoc']($request))
687
-					$stop_words[] = $row['id_word'];
698
+				while ($row = $smcFunc['db_fetch_assoc']($request)) {
699
+									$stop_words[] = $row['id_word'];
700
+				}
688 701
 				$smcFunc['db_free_result']($request);
689 702
 
690 703
 				updateSettings(array('search_stopwords' => implode(',', $stop_words)));
691 704
 
692
-				if (!empty($stop_words))
693
-					$smcFunc['db_query']('', '
705
+				if (!empty($stop_words)) {
706
+									$smcFunc['db_query']('', '
694 707
 						DELETE FROM {db_prefix}log_search_words
695 708
 						WHERE id_word in ({array_int:stop_words})',
696 709
 						array(
697 710
 							'stop_words' => $stop_words,
698 711
 						)
699 712
 					);
713
+				}
700 714
 
701 715
 				$context['start'] += $index_properties[$context['index_settings']['bytes_per_word']]['step_size'];
702 716
 				if ($context['start'] > $index_properties[$context['index_settings']['bytes_per_word']]['max_size'])
@@ -757,8 +771,9 @@  discard block
 block discarded – undo
757 771
 					$searchAPI = new $search_class_name();
758 772
 
759 773
 					// No Support?  NEXT!
760
-					if (!$searchAPI->is_supported)
761
-						continue;
774
+					if (!$searchAPI->is_supported) {
775
+											continue;
776
+					}
762 777
 
763 778
 					$apis[$index_name] = array(
764 779
 						'filename' => $file,
@@ -805,10 +820,10 @@  discard block
 block discarded – undo
805 820
 				'messages_ftx' => $db_prefix . 'messages_ftx',
806 821
 			)
807 822
 		);
808
-		while ($row = $smcFunc['db_fetch_assoc']($request))
809
-			$context['fulltext_index'][] = $row['indexname'];
810
-	}
811
-	else
823
+		while ($row = $smcFunc['db_fetch_assoc']($request)) {
824
+					$context['fulltext_index'][] = $row['indexname'];
825
+		}
826
+	} else
812 827
 	{
813 828
 		$request = $smcFunc['db_query']('', '
814 829
 			SHOW INDEX
@@ -819,17 +834,19 @@  discard block
 block discarded – undo
819 834
 		$context['fulltext_index'] = array();
820 835
 		if ($request !== false || $smcFunc['db_num_rows']($request) != 0)
821 836
 		{
822
-			while ($row = $smcFunc['db_fetch_assoc']($request))
823
-			if ($row['Column_name'] == 'body' && (isset($row['Index_type']) && $row['Index_type'] == 'FULLTEXT' || isset($row['Comment']) && $row['Comment'] == 'FULLTEXT'))
837
+			while ($row = $smcFunc['db_fetch_assoc']($request)) {
838
+						if ($row['Column_name'] == 'body' && (isset($row['Index_type']) && $row['Index_type'] == 'FULLTEXT' || isset($row['Comment']) && $row['Comment'] == 'FULLTEXT'))
824 839
 				$context['fulltext_index'][] = $row['Key_name'];
840
+			}
825 841
 			$smcFunc['db_free_result']($request);
826 842
 
827
-			if (is_array($context['fulltext_index']))
828
-				$context['fulltext_index'] = array_unique($context['fulltext_index']);
843
+			if (is_array($context['fulltext_index'])) {
844
+							$context['fulltext_index'] = array_unique($context['fulltext_index']);
845
+			}
829 846
 		}
830 847
 
831
-		if (preg_match('~^`(.+?)`\.(.+?)$~', $db_prefix, $match) !== 0)
832
-			$request = $smcFunc['db_query']('', '
848
+		if (preg_match('~^`(.+?)`\.(.+?)$~', $db_prefix, $match) !== 0) {
849
+					$request = $smcFunc['db_query']('', '
833 850
 			SHOW TABLE STATUS
834 851
 			FROM {string:database_name}
835 852
 			LIKE {string:table_name}',
@@ -838,20 +855,22 @@  discard block
 block discarded – undo
838 855
 				'table_name' => str_replace('_', '\_', $match[2]) . 'messages',
839 856
 			)
840 857
 			);
841
-		else
842
-			$request = $smcFunc['db_query']('', '
858
+		} else {
859
+					$request = $smcFunc['db_query']('', '
843 860
 			SHOW TABLE STATUS
844 861
 			LIKE {string:table_name}',
845 862
 			array(
846 863
 				'table_name' => str_replace('_', '\_', $db_prefix) . 'messages',
847 864
 			)
848 865
 			);
866
+		}
849 867
 
850 868
 		if ($request !== false)
851 869
 		{
852
-			while ($row = $smcFunc['db_fetch_assoc']($request))
853
-			if (isset($row['Engine']) && strtolower($row['Engine']) != 'myisam' && !(strtolower($row['Engine']) == 'innodb' && version_compare($smcFunc['db_get_version'](), '5.6.4', '>=')))
870
+			while ($row = $smcFunc['db_fetch_assoc']($request)) {
871
+						if (isset($row['Engine']) && strtolower($row['Engine']) != 'myisam' && !(strtolower($row['Engine']) == 'innodb' && version_compare($smcFunc['db_get_version'](), '5.6.4', '>=')))
854 872
 				$context['cannot_create_fulltext'] = true;
873
+			}
855 874
 			$smcFunc['db_free_result']($request);
856 875
 		}
857 876
 	}
Please login to merge, or discard this patch.
Sources/ManageNews.php 1 patch
Braces   +140 added lines, -102 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 news dispatcher; doesn't do anything, just delegates.
@@ -67,8 +68,9 @@  discard block
 block discarded – undo
67 68
 	);
68 69
 
69 70
 	// Force the right area...
70
-	if (substr($_REQUEST['sa'], 0, 7) == 'mailing')
71
-		$context[$context['admin_menu_name']]['current_subsection'] = 'mailingmembers';
71
+	if (substr($_REQUEST['sa'], 0, 7) == 'mailing') {
72
+			$context[$context['admin_menu_name']]['current_subsection'] = 'mailingmembers';
73
+	}
72 74
 
73 75
 	call_helper($subActions[$_REQUEST['sa']][0]);
74 76
 }
@@ -99,9 +101,10 @@  discard block
 block discarded – undo
99 101
 		$temp_news = explode("\n", $modSettings['news']);
100 102
 
101 103
 		// Remove the items that were selected.
102
-		foreach ($temp_news as $i => $news)
103
-			if (in_array($i, $_POST['remove']))
104
+		foreach ($temp_news as $i => $news) {
105
+					if (in_array($i, $_POST['remove']))
104 106
 				unset($temp_news[$i]);
107
+		}
105 108
 
106 109
 		// Update the database.
107 110
 		updateSettings(array('news' => implode("\n", $temp_news)));
@@ -117,9 +120,9 @@  discard block
 block discarded – undo
117 120
 
118 121
 		foreach ($_POST['news'] as $i => $news)
119 122
 		{
120
-			if (trim($news) == '')
121
-				unset($_POST['news'][$i]);
122
-			else
123
+			if (trim($news) == '') {
124
+							unset($_POST['news'][$i]);
125
+			} else
123 126
 			{
124 127
 				$_POST['news'][$i] = $smcFunc['htmlspecialchars']($_POST['news'][$i], ENT_QUOTES);
125 128
 				preparsecode($_POST['news'][$i]);
@@ -155,12 +158,13 @@  discard block
 block discarded – undo
155 158
 				'data' => array(
156 159
 					'function' => function($news)
157 160
 					{
158
-						if (is_numeric($news['id']))
159
-							return '
161
+						if (is_numeric($news['id'])) {
162
+													return '
160 163
 								<textarea id="data_' . $news['id'] . '" rows="3" cols="50" name="news[]" class="padding block">' . $news['unparsed'] . '</textarea>
161 164
 								<div class="floatleft" id="preview_' . $news['id'] . '"></div>';
162
-						else
163
-							return $news['unparsed'];
165
+						} else {
166
+													return $news['unparsed'];
167
+						}
164 168
 					},
165 169
 					'class' => 'half_table',
166 170
 				),
@@ -186,10 +190,11 @@  discard block
 block discarded – undo
186 190
 				'data' => array(
187 191
 					'function' => function($news)
188 192
 					{
189
-						if (is_numeric($news['id']))
190
-							return '<input type="checkbox" name="remove[]" value="' . $news['id'] . '">';
191
-						else
192
-							return '';
193
+						if (is_numeric($news['id'])) {
194
+													return '<input type="checkbox" name="remove[]" value="' . $news['id'] . '">';
195
+						} else {
196
+													return '';
197
+						}
193 198
 					},
194 199
 					'class' => 'centercol icon',
195 200
 				),
@@ -283,12 +288,13 @@  discard block
 block discarded – undo
283 288
 
284 289
 	$admin_current_news = array();
285 290
 	// Ready the current news.
286
-	foreach (explode("\n", $modSettings['news']) as $id => $line)
287
-		$admin_current_news[$id] = array(
291
+	foreach (explode("\n", $modSettings['news']) as $id => $line) {
292
+			$admin_current_news[$id] = array(
288 293
 			'id' => $id,
289 294
 			'unparsed' => un_preparsecode($line),
290 295
 			'parsed' => preg_replace('~<([/]?)form[^>]*?[>]*>~i', '<em class="smalltext">&lt;$1form&gt;</em>', parse_bbc($line)),
291 296
 		);
297
+	}
292 298
 
293 299
 	$admin_current_news['last'] = array(
294 300
 		'id' => 'last',
@@ -355,10 +361,11 @@  discard block
 block discarded – undo
355 361
 			'member_count' => 0,
356 362
 		);
357 363
 
358
-		if ($row['min_posts'] == -1)
359
-			$normalGroups[$row['id_group']] = $row['id_group'];
360
-		else
361
-			$postGroups[$row['id_group']] = $row['id_group'];
364
+		if ($row['min_posts'] == -1) {
365
+					$normalGroups[$row['id_group']] = $row['id_group'];
366
+		} else {
367
+					$postGroups[$row['id_group']] = $row['id_group'];
368
+		}
362 369
 	}
363 370
 	$smcFunc['db_free_result']($request);
364 371
 
@@ -374,8 +381,9 @@  discard block
 block discarded – undo
374 381
 				'post_group_list' => $postGroups,
375 382
 			)
376 383
 		);
377
-		while ($row = $smcFunc['db_fetch_assoc']($query))
378
-			$context['groups'][$row['id_group']]['member_count'] += $row['member_count'];
384
+		while ($row = $smcFunc['db_fetch_assoc']($query)) {
385
+					$context['groups'][$row['id_group']]['member_count'] += $row['member_count'];
386
+		}
379 387
 		$smcFunc['db_free_result']($query);
380 388
 	}
381 389
 
@@ -391,8 +399,9 @@  discard block
 block discarded – undo
391 399
 				'normal_group_list' => $normalGroups,
392 400
 			)
393 401
 		);
394
-		while ($row = $smcFunc['db_fetch_assoc']($query))
395
-			$context['groups'][$row['id_group']]['member_count'] += $row['member_count'];
402
+		while ($row = $smcFunc['db_fetch_assoc']($query)) {
403
+					$context['groups'][$row['id_group']]['member_count'] += $row['member_count'];
404
+		}
396 405
 		$smcFunc['db_free_result']($query);
397 406
 
398 407
 		// Also do those who have it as an additional membergroup - this ones more yucky...
@@ -409,8 +418,9 @@  discard block
 block discarded – undo
409 418
 				'blank_string' => '',
410 419
 			)
411 420
 		);
412
-		while ($row = $smcFunc['db_fetch_assoc']($query))
413
-			$context['groups'][$row['id_group']]['member_count'] += $row['member_count'];
421
+		while ($row = $smcFunc['db_fetch_assoc']($query)) {
422
+					$context['groups'][$row['id_group']]['member_count'] += $row['member_count'];
423
+		}
414 424
 		$smcFunc['db_free_result']($query);
415 425
 	}
416 426
 
@@ -461,10 +471,11 @@  discard block
 block discarded – undo
461 471
 	{
462 472
 		$context[$key] = !empty($_REQUEST[$post]) ? $_REQUEST[$post] : '';
463 473
 
464
-		if (empty($context[$key]) && empty($_REQUEST['xml']))
465
-			$context['post_error']['messages'][] = $txt['error_no_' . $post];
466
-		elseif (!empty($_REQUEST['xml']))
467
-			continue;
474
+		if (empty($context[$key]) && empty($_REQUEST['xml'])) {
475
+					$context['post_error']['messages'][] = $txt['error_no_' . $post];
476
+		} elseif (!empty($_REQUEST['xml'])) {
477
+					continue;
478
+		}
468 479
 
469 480
 		preparsecode($context[$key]);
470 481
 		if ($html)
@@ -543,10 +554,12 @@  discard block
 block discarded – undo
543 554
 
544 555
 	// Start by finding any members!
545 556
 	$toClean = array();
546
-	if (!empty($_POST['members']))
547
-		$toClean[] = 'members';
548
-	if (!empty($_POST['exclude_members']))
549
-		$toClean[] = 'exclude_members';
557
+	if (!empty($_POST['members'])) {
558
+			$toClean[] = 'members';
559
+	}
560
+	if (!empty($_POST['exclude_members'])) {
561
+			$toClean[] = 'exclude_members';
562
+	}
550 563
 	if (!empty($toClean))
551 564
 	{
552 565
 		require_once($sourcedir . '/Subs-Auth.php');
@@ -558,11 +571,13 @@  discard block
 block discarded – undo
558 571
 			preg_match_all('~"([^"]+)"~', $_POST[$type], $matches);
559 572
 			$_POST[$type] = array_unique(array_merge($matches[1], explode(',', preg_replace('~"[^"]+"~', '', $_POST[$type]))));
560 573
 
561
-			foreach ($_POST[$type] as $index => $member)
562
-				if (strlen(trim($member)) > 0)
574
+			foreach ($_POST[$type] as $index => $member) {
575
+							if (strlen(trim($member)) > 0)
563 576
 					$_POST[$type][$index] = $smcFunc['htmlspecialchars']($smcFunc['strtolower'](trim($member)));
564
-				else
565
-					unset($_POST[$type][$index]);
577
+			}
578
+				else {
579
+									unset($_POST[$type][$index]);
580
+				}
566 581
 
567 582
 			// Find the members
568 583
 			$_POST[$type] = implode(',', array_keys(findMembers($_POST[$type])));
@@ -572,16 +587,18 @@  discard block
 block discarded – undo
572 587
 	if (isset($_POST['member_list']) && is_array($_POST['member_list']))
573 588
 	{
574 589
 		$members = array();
575
-		foreach ($_POST['member_list'] as $member_id)
576
-			$members[] = (int) $member_id;
590
+		foreach ($_POST['member_list'] as $member_id) {
591
+					$members[] = (int) $member_id;
592
+		}
577 593
 		$_POST['members'] = implode(',', $members);
578 594
 	}
579 595
 
580 596
 	if (isset($_POST['exclude_member_list']) && is_array($_POST['exclude_member_list']))
581 597
 	{
582 598
 		$members = array();
583
-		foreach ($_POST['exclude_member_list'] as $member_id)
584
-			$members[] = (int) $member_id;
599
+		foreach ($_POST['exclude_member_list'] as $member_id) {
600
+					$members[] = (int) $member_id;
601
+		}
585 602
 		$_POST['exclude_members'] = implode(',', $members);
586 603
 	}
587 604
 
@@ -605,8 +622,9 @@  discard block
 block discarded – undo
605 622
 			'current_time' => time(),
606 623
 		)
607 624
 	);
608
-	while ($row = $smcFunc['db_fetch_assoc']($request))
609
-		$context['recipients']['exclude_members'][] = $row['id_member'];
625
+	while ($row = $smcFunc['db_fetch_assoc']($request)) {
626
+			$context['recipients']['exclude_members'][] = $row['id_member'];
627
+	}
610 628
 	$smcFunc['db_free_result']($request);
611 629
 
612 630
 	$request = $smcFunc['db_query']('', '
@@ -641,8 +659,9 @@  discard block
 block discarded – undo
641 659
 			WHERE email_address IN(' . implode(', ', $condition_array) . ')',
642 660
 			$condition_array_params
643 661
 		);
644
-		while ($row = $smcFunc['db_fetch_assoc']($request))
645
-			$context['recipients']['exclude_members'][] = $row['id_member'];
662
+		while ($row = $smcFunc['db_fetch_assoc']($request)) {
663
+					$context['recipients']['exclude_members'][] = $row['id_member'];
664
+		}
646 665
 		$smcFunc['db_free_result']($request);
647 666
 	}
648 667
 
@@ -660,10 +679,11 @@  discard block
 block discarded – undo
660 679
 		);
661 680
 		while ($row = $smcFunc['db_fetch_assoc']($request))
662 681
 		{
663
-			if (in_array(3, $context['recipients']))
664
-				$context['recipients']['exclude_members'][] = $row['identifier'];
665
-			else
666
-				$context['recipients']['members'][] = $row['identifier'];
682
+			if (in_array(3, $context['recipients'])) {
683
+							$context['recipients']['exclude_members'][] = $row['identifier'];
684
+			} else {
685
+							$context['recipients']['members'][] = $row['identifier'];
686
+			}
667 687
 		}
668 688
 		$smcFunc['db_free_result']($request);
669 689
 	}
@@ -710,8 +730,9 @@  discard block
 block discarded – undo
710 730
 	$num_at_once = 1000;
711 731
 
712 732
 	// If by PM's I suggest we half the above number.
713
-	if (!empty($_POST['send_pm']))
714
-		$num_at_once /= 2;
733
+	if (!empty($_POST['send_pm'])) {
734
+			$num_at_once /= 2;
735
+	}
715 736
 
716 737
 	checkSession();
717 738
 
@@ -734,8 +755,7 @@  discard block
 block discarded – undo
734 755
 		);
735 756
 		list ($context['total_members']) = $smcFunc['db_fetch_row']($request);
736 757
 		$smcFunc['db_free_result']($request);
737
-	}
738
-	else
758
+	} else
739 759
 	{
740 760
 		$context['total_members'] = (int) $_REQUEST['total_members'];
741 761
 	}
@@ -753,32 +773,35 @@  discard block
 block discarded – undo
753 773
 	if (!empty($_POST['exclude_members']))
754 774
 	{
755 775
 		$members = explode(',', $_POST['exclude_members']);
756
-		foreach ($members as $member)
757
-			if ($member >= $context['start'])
776
+		foreach ($members as $member) {
777
+					if ($member >= $context['start'])
758 778
 				$context['recipients']['exclude_members'][] = (int) $member;
779
+		}
759 780
 	}
760 781
 
761 782
 	// What about members we *must* do?
762 783
 	if (!empty($_POST['members']))
763 784
 	{
764 785
 		$members = explode(',', $_POST['members']);
765
-		foreach ($members as $member)
766
-			if ($member >= $context['start'])
786
+		foreach ($members as $member) {
787
+					if ($member >= $context['start'])
767 788
 				$context['recipients']['members'][] = (int) $member;
789
+		}
768 790
 	}
769 791
 	// Cleaning groups is simple - although deal with both checkbox and commas.
770 792
 	if (isset($_POST['groups']))
771 793
 	{
772 794
 		if (is_array($_POST['groups']))
773 795
 		{
774
-			foreach ($_POST['groups'] as $group => $dummy)
775
-				$context['recipients']['groups'][] = (int) $group;
776
-		}
777
-		else
796
+			foreach ($_POST['groups'] as $group => $dummy) {
797
+							$context['recipients']['groups'][] = (int) $group;
798
+			}
799
+		} else
778 800
 		{
779 801
 			$groups = explode(',', $_POST['groups']);
780
-			foreach ($groups as $group)
781
-				$context['recipients']['groups'][] = (int) $group;
802
+			foreach ($groups as $group) {
803
+							$context['recipients']['groups'][] = (int) $group;
804
+			}
782 805
 		}
783 806
 	}
784 807
 	// Same for excluded groups
@@ -786,15 +809,17 @@  discard block
 block discarded – undo
786 809
 	{
787 810
 		if (is_array($_POST['exclude_groups']))
788 811
 		{
789
-			foreach ($_POST['exclude_groups'] as $group => $dummy)
790
-				$context['recipients']['exclude_groups'][] = (int) $group;
812
+			foreach ($_POST['exclude_groups'] as $group => $dummy) {
813
+							$context['recipients']['exclude_groups'][] = (int) $group;
814
+			}
791 815
 		}
792 816
 		// Ignore an empty string - we don't want to exclude "Regular Members" unless it's specifically selected
793 817
 		elseif ($_POST['exclude_groups'] != '')
794 818
 		{
795 819
 			$groups = explode(',', $_POST['exclude_groups']);
796
-			foreach ($groups as $group)
797
-				$context['recipients']['exclude_groups'][] = (int) $group;
820
+			foreach ($groups as $group) {
821
+							$context['recipients']['exclude_groups'][] = (int) $group;
822
+			}
798 823
 		}
799 824
 	}
800 825
 	// Finally - emails!
@@ -804,14 +829,16 @@  discard block
 block discarded – undo
804 829
 		foreach ($addressed as $curmem)
805 830
 		{
806 831
 			$curmem = trim($curmem);
807
-			if ($curmem != '' && filter_var($curmem, FILTER_VALIDATE_EMAIL))
808
-				$context['recipients']['emails'][$curmem] = $curmem;
832
+			if ($curmem != '' && filter_var($curmem, FILTER_VALIDATE_EMAIL)) {
833
+							$context['recipients']['emails'][$curmem] = $curmem;
834
+			}
809 835
 		}
810 836
 	}
811 837
 
812 838
 	// If we're only cleaning drop out here.
813
-	if ($clean_only)
814
-		return;
839
+	if ($clean_only) {
840
+			return;
841
+	}
815 842
 
816 843
 	require_once($sourcedir . '/Subs-Post.php');
817 844
 
@@ -827,16 +854,18 @@  discard block
 block discarded – undo
827 854
 	if (!$context['send_pm'] && !empty($_POST['send_html']))
828 855
 	{
829 856
 		// Prepare the message for HTML.
830
-		if (!empty($_POST['parse_html']))
831
-			$_POST['message'] = str_replace(array("\n", '  '), array('<br>' . "\n", '&nbsp; '), $_POST['message']);
857
+		if (!empty($_POST['parse_html'])) {
858
+					$_POST['message'] = str_replace(array("\n", '  '), array('<br>' . "\n", '&nbsp; '), $_POST['message']);
859
+		}
832 860
 
833 861
 		// This is here to prevent spam filters from tagging this as spam.
834 862
 		if (preg_match('~\<html~i', $_POST['message']) == 0)
835 863
 		{
836
-			if (preg_match('~\<body~i', $_POST['message']) == 0)
837
-				$_POST['message'] = '<html><head><title>' . $_POST['subject'] . '</title></head>' . "\n" . '<body>' . $_POST['message'] . '</body></html>';
838
-			else
839
-				$_POST['message'] = '<html>' . $_POST['message'] . '</html>';
864
+			if (preg_match('~\<body~i', $_POST['message']) == 0) {
865
+							$_POST['message'] = '<html><head><title>' . $_POST['subject'] . '</title></head>' . "\n" . '<body>' . $_POST['message'] . '</body></html>';
866
+			} else {
867
+							$_POST['message'] = '<html>' . $_POST['message'] . '</html>';
868
+			}
840 869
 		}
841 870
 	}
842 871
 
@@ -890,15 +919,17 @@  discard block
 block discarded – undo
890 919
 	foreach ($context['recipients']['emails'] as $k => $email)
891 920
 	{
892 921
 		// Done as many as we can?
893
-		if ($i >= $num_at_once)
894
-			break;
922
+		if ($i >= $num_at_once) {
923
+					break;
924
+		}
895 925
 
896 926
 		// Don't sent it twice!
897 927
 		unset($context['recipients']['emails'][$k]);
898 928
 
899 929
 		// Dammit - can't PM emails!
900
-		if ($context['send_pm'])
901
-			continue;
930
+		if ($context['send_pm']) {
931
+					continue;
932
+		}
902 933
 
903 934
 		$to_member = array(
904 935
 			$email,
@@ -932,8 +963,9 @@  discard block
 block discarded – undo
932 963
 					$queryBuild[] = 'mem.id_post_group = {int:group_' . $group . '}';
933 964
 				}
934 965
 			}
935
-			if (!empty($queryBuild))
936
-			$sendQuery .= implode(' OR ', $queryBuild);
966
+			if (!empty($queryBuild)) {
967
+						$sendQuery .= implode(' OR ', $queryBuild);
968
+			}
937 969
 		}
938 970
 		if (!empty($context['recipients']['members']))
939 971
 		{
@@ -952,8 +984,9 @@  discard block
 block discarded – undo
952 984
 		}
953 985
 
954 986
 		// Anything to exclude?
955
-		if (!empty($context['recipients']['exclude_groups']) && in_array(0, $context['recipients']['exclude_groups']))
956
-			$sendQuery .= ' AND mem.id_group != {int:regular_group}';
987
+		if (!empty($context['recipients']['exclude_groups']) && in_array(0, $context['recipients']['exclude_groups'])) {
988
+					$sendQuery .= ' AND mem.id_group != {int:regular_group}';
989
+		}
957 990
 		if (!empty($context['recipients']['exclude_members']))
958 991
 		{
959 992
 			$sendQuery .= ' AND mem.id_member NOT IN ({array_int:exclude_members})';
@@ -989,21 +1022,24 @@  discard block
 block discarded – undo
989 1022
 		foreach ($rows as $row)
990 1023
 		{
991 1024
 			// Force them to have it?
992
-			if (empty($context['email_force']) && empty($prefs[$row['id_member']]['announcements']))
993
-				continue;
1025
+			if (empty($context['email_force']) && empty($prefs[$row['id_member']]['announcements'])) {
1026
+							continue;
1027
+			}
994 1028
 
995 1029
 			// What groups are we looking at here?
996
-			if (empty($row['additional_groups']))
997
-				$groups = array($row['id_group'], $row['id_post_group']);
998
-			else
999
-				$groups = array_merge(
1030
+			if (empty($row['additional_groups'])) {
1031
+							$groups = array($row['id_group'], $row['id_post_group']);
1032
+			} else {
1033
+							$groups = array_merge(
1000 1034
 					array($row['id_group'], $row['id_post_group']),
1001 1035
 					explode(',', $row['additional_groups'])
1002 1036
 				);
1037
+			}
1003 1038
 
1004 1039
 			// Excluded groups?
1005
-			if (array_intersect($groups, $context['recipients']['exclude_groups']))
1006
-				continue;
1040
+			if (array_intersect($groups, $context['recipients']['exclude_groups'])) {
1041
+							continue;
1042
+			}
1007 1043
 
1008 1044
 			// We might need this
1009 1045
 			$cleanMemberName = empty($_POST['send_html']) || $context['send_pm'] ? un_htmlspecialchars($row['real_name']) : $row['real_name'];
@@ -1026,10 +1062,11 @@  discard block
 block discarded – undo
1026 1062
 				), $_POST['subject']);
1027 1063
 
1028 1064
 			// Send the actual email - or a PM!
1029
-			if (!$context['send_pm'])
1030
-				sendmail($row['email_address'], $subject, $message, null, 'news', !empty($_POST['send_html']), 5);
1031
-			else
1032
-				sendpm(array('to' => array($row['id_member']), 'bcc' => array()), $subject, $message);
1065
+			if (!$context['send_pm']) {
1066
+							sendmail($row['email_address'], $subject, $message, null, 'news', !empty($_POST['send_html']), 5);
1067
+			} else {
1068
+							sendpm(array('to' => array($row['id_member']), 'bcc' => array()), $subject, $message);
1069
+			}
1033 1070
 		}
1034 1071
 	}
1035 1072
 
@@ -1079,8 +1116,9 @@  discard block
 block discarded – undo
1079 1116
 
1080 1117
 	call_integration_hook('integrate_modify_news_settings', array(&$config_vars));
1081 1118
 
1082
-	if ($return_config)
1083
-		return $config_vars;
1119
+	if ($return_config) {
1120
+			return $config_vars;
1121
+	}
1084 1122
 
1085 1123
 	$context['page_title'] = $txt['admin_edit_news'] . ' - ' . $txt['settings'];
1086 1124
 	$context['sub_template'] = 'show_settings';
Please login to merge, or discard this patch.