Completed
Push — release-2.1 ( 9ceed4...3a76bf )
by John
57:07 queued 45:14
created
Themes/default/Themes.template.php 1 patch
Braces   +108 added lines, -82 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' : '', ' class="input_check"> ', $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>
@@ -189,11 +192,12 @@  discard block
 block discarded – undo
189 192
 	global $context, $scripturl, $txt;
190 193
 
191 194
 	// Show a nice confirmation message.
192
-	if (isset($_GET['done']))
193
-		echo '
195
+	if (isset($_GET['done'])) {
196
+			echo '
194 197
 	<div class="infobox">
195 198
 		', $txt['theme_confirmed_' . $_GET['done']], '
196 199
 	</div>';
200
+	}
197 201
 
198 202
 	echo '
199 203
 	<div id="admincenter">';
@@ -353,22 +357,24 @@  discard block
 block discarded – undo
353 357
 					<dt ', $context['theme_options_reset'] ? 'style="width:50%"' : '', '>';
354 358
 
355 359
 		// Show the change option box ?
356
-		if ($context['theme_options_reset'])
357
-			echo '
360
+		if ($context['theme_options_reset']) {
361
+					echo '
358 362
 						<span class="floatleft"><select name="', !empty($setting['default']) ? 'default_' : '', 'options_master[', $setting['id'], ']" onchange="this.form.options_', $setting['id'], '.disabled = this.selectedIndex != 1;">
359 363
 							<option value="0" selected>', $txt['themeadmin_reset_options_none'], '</option>
360 364
 							<option value="1">', $txt['themeadmin_reset_options_change'], '</option>
361 365
 							<option value="2">', $txt['themeadmin_reset_options_default'], '</option>
362 366
 						</select>&nbsp;</span>';
367
+		}
363 368
 
364 369
 		// display checkbox options
365 370
 		if ($setting['type'] == 'checkbox')
366 371
 		{
367 372
 			echo '
368 373
 						<label for="options_', $setting['id'], '">', $setting['label'], '</label>';
369
-			if (isset($setting['description']))
370
-				echo '
374
+			if (isset($setting['description'])) {
375
+							echo '
371 376
 						<br><span class="smalltext">', $setting['description'], '</span>';
377
+			}
372 378
 		echo '
373 379
 					</dt>
374 380
 					<dd ', $context['theme_options_reset'] ? 'style="width:40%"' : '', '>
@@ -380,9 +386,10 @@  discard block
 block discarded – undo
380 386
 		{
381 387
 			echo '
382 388
 						<label for="options_', $setting['id'], '">', $setting['label'], '</label>';
383
-			if (isset($setting['description']))
384
-				echo '
389
+			if (isset($setting['description'])) {
390
+							echo '
385 391
 						<br><span class="smalltext">', $setting['description'], '</span>';
392
+			}
386 393
 		echo '
387 394
 					</dt>
388 395
 					<dd ', $context['theme_options_reset'] ? 'style="width:40%"' : '', '>
@@ -402,9 +409,10 @@  discard block
 block discarded – undo
402 409
 		{
403 410
 			echo '
404 411
 						<label for="options_', $setting['id'], '">', $setting['label'], '</label>';
405
-			if (isset($setting['description']))
406
-				echo '
412
+			if (isset($setting['description'])) {
413
+							echo '
407 414
 						<br><span class="smalltext">', $setting['description'], '</span>';
415
+			}
408 416
 		echo '
409 417
 					</dt>
410 418
 					<dd ', $context['theme_options_reset'] ? 'style="width:40%"' : '', '>';
@@ -417,13 +425,11 @@  discard block
 block discarded – undo
417 425
 
418 426
 				echo '
419 427
 						<input type="number"', $min . $max . $step;
420
-			}
421
-			else if (isset($setting['type']) && $setting['type'] == 'url')
428
+			} else if (isset($setting['type']) && $setting['type'] == 'url')
422 429
 			{
423 430
 			echo'
424 431
 			<input type="url"';
425
-			}
426
-			else
432
+			} else
427 433
 			{
428 434
 				echo '
429 435
 						<input type="text"';
@@ -467,8 +473,8 @@  discard block
 block discarded – undo
467 473
 			<br>';
468 474
 
469 475
 	// @todo Why can't I edit the default theme popup.
470
-	if ($context['theme_settings']['theme_id'] != 1)
471
-		echo '
476
+	if ($context['theme_settings']['theme_id'] != 1) {
477
+			echo '
472 478
 			<div class="cat_bar">
473 479
 				<h3 class="catbg config_hd">
474 480
 					', $txt['theme_edit'], '
@@ -484,6 +490,7 @@  discard block
 block discarded – undo
484 490
 					</li>
485 491
 				</ul>
486 492
 			</div>';
493
+	}
487 494
 
488 495
 	echo '
489 496
 			<div class="cat_bar">
@@ -537,9 +544,10 @@  discard block
 block discarded – undo
537 544
 					<dd>
538 545
 						<select id="variant" name="options[default_variant]" onchange="changeVariant(this.value)">';
539 546
 
540
-		foreach ($context['theme_variants'] as $key => $variant)
541
-			echo '
547
+		foreach ($context['theme_variants'] as $key => $variant) {
548
+					echo '
542 549
 							<option value="', $key, '"', $context['default_variant'] == $key ? ' selected' : '', '>', $variant['label'], '</option>';
550
+		}
543 551
 
544 552
 		echo '
545 553
 						</select>
@@ -582,9 +590,10 @@  discard block
 block discarded – undo
582 590
 					<dt>
583 591
 						<label for="', $setting['id'], '">', $setting['label'], '</label>:';
584 592
 
585
-			if (isset($setting['description']))
586
-				echo '<br>
593
+			if (isset($setting['description'])) {
594
+							echo '<br>
587 595
 						<span class="smalltext">', $setting['description'], '</span>';
596
+			}
588 597
 
589 598
 			echo '
590 599
 					</dt>
@@ -600,18 +609,20 @@  discard block
 block discarded – undo
600 609
 					<dt>
601 610
 						<label for="', $setting['id'], '">', $setting['label'], '</label>:';
602 611
 
603
-			if (isset($setting['description']))
604
-				echo '<br>
612
+			if (isset($setting['description'])) {
613
+							echo '<br>
605 614
 						<span class="smalltext">', $setting['description'], '</span>';
615
+			}
606 616
 
607 617
 			echo '
608 618
 					</dt>
609 619
 					<dd>
610 620
 						<select name="', !empty($setting['default']) ? 'default_' : '', 'options[', $setting['id'], ']" id="', $setting['id'], '">';
611 621
 
612
-			foreach ($setting['options'] as $value => $label)
613
-				echo '
622
+			foreach ($setting['options'] as $value => $label) {
623
+							echo '
614 624
 							<option value="', $value, '"', $value == $setting['value'] ? ' selected' : '', '>', $label, '</option>';
625
+			}
615 626
 
616 627
 			echo '
617 628
 						</select>
@@ -624,9 +635,10 @@  discard block
 block discarded – undo
624 635
 					<dt>
625 636
 						<label for="', $setting['id'], '">', $setting['label'], '</label>:';
626 637
 
627
-			if (isset($setting['description']))
628
-				echo '<br>
638
+			if (isset($setting['description'])) {
639
+							echo '<br>
629 640
 						<span class="smalltext">', $setting['description'], '</span>';
641
+			}
630 642
 			echo '
631 643
 					</dt>
632 644
 					<dd>
@@ -641,9 +653,10 @@  discard block
 block discarded – undo
641 653
 					<dt>
642 654
 						<label for="', $setting['id'], '">', $setting['label'], '</label>:';
643 655
 
644
-			if (isset($setting['description']))
645
-				echo '<br>
656
+			if (isset($setting['description'])) {
657
+							echo '<br>
646 658
 						<span class="smalltext">', $setting['description'], '</span>';
659
+			}
647 660
 
648 661
 			echo '
649 662
 					</dt>
@@ -657,13 +670,11 @@  discard block
 block discarded – undo
657 670
 
658 671
 				echo '
659 672
 						<input type="number"', $min . $max . $step;
660
-			}
661
-			else if (isset($setting['type']) && $setting['type'] == 'url')
673
+			} else if (isset($setting['type']) && $setting['type'] == 'url')
662 674
 			{
663 675
 			echo'
664 676
 			<input type="url"';
665
-			}
666
-			else
677
+			} else
667 678
 			{
668 679
 				echo '
669 680
 						<input type="text"';
@@ -816,21 +827,23 @@  discard block
 block discarded – undo
816 827
 		<div class="windowbg">';
817 828
 
818 829
 	// Oops! there was an error :(
819
-	if (!empty($context['error_message']))
820
-		echo '
830
+	if (!empty($context['error_message'])) {
831
+			echo '
821 832
 			<p>
822 833
 				', $context['error_message'], '
823 834
 			</p>';
835
+	}
824 836
 
825 837
 	// Not much to show except a link back...
826
-	else
827
-		echo '
838
+	else {
839
+			echo '
828 840
 			<p>
829 841
 				<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'], '
830 842
 			</p>
831 843
 			<p>
832 844
 				<a href="', $scripturl, '?action=admin;area=theme;sa=admin;', $context['session_var'], '=', $context['session_id'], '">', $txt['back'], '</a>
833 845
 			</p>';
846
+	}
834 847
 
835 848
 	echo '
836 849
 		</div>
@@ -897,10 +910,11 @@  discard block
 block discarded – undo
897 910
 					<span class="floatleft">', $template['filename'], $template['already_exists'] ? ' <span class="error">(' . $txt['themeadmin_edit_exists'] . ')</span>' : '', '</span>
898 911
 					<span class="floatright">';
899 912
 
900
-		if ($template['can_copy'])
901
-			echo '<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>';
902
-		else
903
-			echo $txt['themeadmin_edit_no_copy'];
913
+		if ($template['can_copy']) {
914
+					echo '<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>';
915
+		} else {
916
+					echo $txt['themeadmin_edit_no_copy'];
917
+		}
904 918
 
905 919
 		echo '
906 920
 					</span>
@@ -923,11 +937,12 @@  discard block
 block discarded – undo
923 937
 	echo '
924 938
 	<div id="admincenter">';
925 939
 
926
-	if (!empty($context['browse_title']))
927
-		echo '
940
+	if (!empty($context['browse_title'])) {
941
+			echo '
928 942
 		<div class="cat_bar">
929 943
 			<h3 class="catbg">', $context['browse_title'], '</h3>
930 944
 		</div>';
945
+	}
931 946
 
932 947
 	echo '
933 948
 		<table class="table_grid tborder">
@@ -947,14 +962,13 @@  discard block
 block discarded – undo
947 962
 			<tr class="windowbg">
948 963
 				<td>';
949 964
 
950
-		if ($file['is_editable'])
951
-			echo '<a href="', $file['href'], '"', $file['is_template'] ? ' style="font-weight: bold;"' : '', '>', $file['filename'], '</a>';
952
-
953
-		elseif ($file['is_directory'])
954
-			echo '<a href="', $file['href'], '" class="is_directory"><span class="generic_icons folder"></span>', $file['filename'], '</a>';
955
-
956
-		else
957
-			echo $file['filename'];
965
+		if ($file['is_editable']) {
966
+					echo '<a href="', $file['href'], '"', $file['is_template'] ? ' style="font-weight: bold;"' : '', '>', $file['filename'], '</a>';
967
+		} elseif ($file['is_directory']) {
968
+					echo '<a href="', $file['href'], '" class="is_directory"><span class="generic_icons folder"></span>', $file['filename'], '</a>';
969
+		} else {
970
+					echo $file['filename'];
971
+		}
958 972
 
959 973
 		echo '
960 974
 				</td>
@@ -976,11 +990,12 @@  discard block
 block discarded – undo
976 990
 {
977 991
 	global $context, $settings, $scripturl, $txt;
978 992
 
979
-	if ($context['session_error'])
980
-		echo '
993
+	if ($context['session_error']) {
994
+			echo '
981 995
 	<div class="errorbox">
982 996
 		', $txt['error_session_timeout'], '
983 997
 	</div>';
998
+	}
984 999
 
985 1000
 	// From now on no one can complain that editing css is difficult. If you disagree, go to www.w3schools.com.
986 1001
 	echo '
@@ -1043,17 +1058,18 @@  discard block
 block discarded – undo
1043 1058
 					try
1044 1059
 					{
1045 1060
 					';
1046
-	if (isBrowser('is_ie'))
1047
-		echo '
1061
+	if (isBrowser('is_ie')) {
1062
+			echo '
1048 1063
 						var sheets = frames["css_preview_box"].document.styleSheets;
1049 1064
 						for (var j = 0; j < sheets.length; j++)
1050 1065
 						{
1051 1066
 							if (sheets[j].id == "css_preview_box")
1052 1067
 								sheets[j].cssText = document.forms.stylesheetForm.entire_file.value;
1053 1068
 						}';
1054
-	else
1055
-		echo '
1069
+	} else {
1070
+			echo '
1056 1071
 						setInnerHTML(frames["css_preview_box"].document.getElementById("css_preview_sheet"), document.forms.stylesheetForm.entire_file.value);';
1072
+	}
1057 1073
 	echo '
1058 1074
 					}
1059 1075
 					catch (e)
@@ -1105,9 +1121,10 @@  discard block
 block discarded – undo
1105 1121
 			</div>
1106 1122
 			<div class="windowbg">';
1107 1123
 
1108
-	if (!$context['allow_save'])
1109
-		echo '
1124
+	if (!$context['allow_save']) {
1125
+			echo '
1110 1126
 				', $txt['theme_edit_no_save'], ': ', $context['allow_save_filename'], '<br>';
1127
+	}
1111 1128
 
1112 1129
 	echo '
1113 1130
 				<textarea name="entire_file" cols="80" rows="20" style="width: 96%; font-family: monospace; margin-top: 1ex; white-space: pre;" onkeyup="setPreviewTimeout();" onchange="refreshPreview(true);">', $context['entire_file'], '</textarea><br>
@@ -1120,9 +1137,10 @@  discard block
 block discarded – undo
1120 1137
 			<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">';
1121 1138
 
1122 1139
 	// Hopefully it exists.
1123
-	if (isset($context['admin-te-' . md5($context['theme_id'] . '-' . $context['edit_filename']) . '_token']))
1124
-		echo '
1140
+	if (isset($context['admin-te-' . md5($context['theme_id'] . '-' . $context['edit_filename']) . '_token'])) {
1141
+			echo '
1125 1142
 			<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'], '">';
1143
+	}
1126 1144
 
1127 1145
 	echo '
1128 1146
 		</form>
@@ -1136,18 +1154,20 @@  discard block
 block discarded – undo
1136 1154
 {
1137 1155
 	global $context, $scripturl, $txt;
1138 1156
 
1139
-	if ($context['session_error'])
1140
-		echo '
1157
+	if ($context['session_error']) {
1158
+			echo '
1141 1159
 	<div class="errorbox">
1142 1160
 		', $txt['error_session_timeout'], '
1143 1161
 	</div>';
1162
+	}
1144 1163
 
1145
-	if (isset($context['parse_error']))
1146
-		echo '
1164
+	if (isset($context['parse_error'])) {
1165
+			echo '
1147 1166
 	<div class="errorbox">
1148 1167
 		', $txt['themeadmin_edit_error'], '
1149 1168
 			<div><pre>', $context['parse_error'], '</pre></div>
1150 1169
 	</div>';
1170
+	}
1151 1171
 
1152 1172
 	// Just show a big box.... gray out the Save button if it's not saveable... (ie. not 777.)
1153 1173
 	echo '
@@ -1158,16 +1178,18 @@  discard block
 block discarded – undo
1158 1178
 			</div>
1159 1179
 			<div class="windowbg">';
1160 1180
 
1161
-	if (!$context['allow_save'])
1162
-		echo '
1181
+	if (!$context['allow_save']) {
1182
+			echo '
1163 1183
 				', $txt['theme_edit_no_save'], ': ', $context['allow_save_filename'], '<br>';
1184
+	}
1164 1185
 
1165
-	foreach ($context['file_parts'] as $part)
1166
-		echo '
1186
+	foreach ($context['file_parts'] as $part) {
1187
+			echo '
1167 1188
 				<label for="on_line', $part['line'], '">', $txt['themeadmin_edit_on_line'], ' ', $part['line'], '</label>:<br>
1168 1189
 				<div class="centertext">
1169 1190
 					<textarea id="on_line', $part['line'], '" name="entire_file[]" cols="80" rows="', $part['lines'] > 14 ? '14' : $part['lines'], '" class="edit_file">', $part['data'], '</textarea>
1170 1191
 				</div>';
1192
+	}
1171 1193
 
1172 1194
 	echo '
1173 1195
 				<div class="padding righttext">
@@ -1176,9 +1198,10 @@  discard block
 block discarded – undo
1176 1198
 					<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">';
1177 1199
 
1178 1200
 	// Hopefully it exists.
1179
-	if (isset($context['admin-te-' . md5($context['theme_id'] . '-' . $context['edit_filename']) . '_token']))
1180
-		echo '
1201
+	if (isset($context['admin-te-' . md5($context['theme_id'] . '-' . $context['edit_filename']) . '_token'])) {
1202
+			echo '
1181 1203
 					<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'], '">';
1204
+	}
1182 1205
 
1183 1206
 	echo '
1184 1207
 				</div>
@@ -1194,18 +1217,20 @@  discard block
 block discarded – undo
1194 1217
 {
1195 1218
 	global $context, $scripturl, $txt;
1196 1219
 
1197
-	if ($context['session_error'])
1198
-		echo '
1220
+	if ($context['session_error']) {
1221
+			echo '
1199 1222
 	<div class="errorbox">
1200 1223
 		', $txt['error_session_timeout'], '
1201 1224
 	</div>';
1225
+	}
1202 1226
 
1203 1227
 	//Is this file writeable?
1204
-	if (!$context['allow_save'])
1205
-		echo '
1228
+	if (!$context['allow_save']) {
1229
+			echo '
1206 1230
 	<div class="errorbox">
1207 1231
 		', $txt['theme_edit_no_save'], ': ', $context['allow_save_filename'], '
1208 1232
 	</div>';
1233
+	}
1209 1234
 
1210 1235
 	// Just show a big box.... gray out the Save button if it's not saveable... (ie. not 777.)
1211 1236
 	echo '
@@ -1221,9 +1246,10 @@  discard block
 block discarded – undo
1221 1246
 				<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">';
1222 1247
 
1223 1248
 	// Hopefully it exists.
1224
-	if (isset($context['admin-te-' . md5($context['theme_id'] . '-' . $context['edit_filename']) . '_token']))
1225
-		echo '
1249
+	if (isset($context['admin-te-' . md5($context['theme_id'] . '-' . $context['edit_filename']) . '_token'])) {
1250
+			echo '
1226 1251
 				<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'], '">';
1252
+	}
1227 1253
 
1228 1254
 	echo '
1229 1255
 			</div>
Please login to merge, or discard this patch.