Completed
Branch release-2.1 (e49a83)
by Michael
08:59
created
Themes/default/MoveTopic.template.php 4 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -83,6 +83,7 @@
 block discarded – undo
83 83
  * Redirection topic options
84 84
  *
85 85
  * @var string $type What type of topic this is for - currently 'merge' or 'move'. Used to display appropriate text strings...
86
+ * @param string $type
86 87
  */
87 88
 function template_redirect_options($type)
88 89
 {
Please login to merge, or discard this patch.
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 	// Stick our "create a redirection topic" template in here...
64 64
 	template_redirect_options('move');
65 65
 
66
-    echo '
66
+	echo '
67 67
 					<input type="submit" value="', $txt['move_topic'], '" onclick="return submitThisOnce(this);" accesskey="s" class="button_submit">
68 68
 				</div>
69 69
 			</div>';
@@ -86,9 +86,9 @@  discard block
 block discarded – undo
86 86
  */
87 87
 function template_redirect_options($type)
88 88
 {
89
-    global $txt, $context, $modSettings;
89
+	global $txt, $context, $modSettings;
90 90
 
91
-    echo '
91
+	echo '
92 92
 					<label for="postRedirect"><input type="checkbox" name="postRedirect" id="postRedirect"', $context['is_approved'] ? ' checked' : '', ' onclick="', $context['is_approved'] ? '' : 'if (this.checked && !confirm(\'' . $txt[$type . '_topic_unapproved_js'] . '\')) return false; ', 'document.getElementById(\'reasonArea\').style.display = this.checked ? \'block\' : \'none\';" class="input_check"> ', $txt['post_redirection'], '.</label>
93 93
 					<fieldset id="reasonArea" style="margin-top: 1ex;', $context['is_approved'] ? '' : 'display: none;', '">
94 94
 						<dl class="settings">
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@
 block discarded – undo
39 39
 
40 40
 		foreach ($category['boards'] as $board)
41 41
 			echo '
42
-									<option value="', $board['id'], '"', $board['selected'] ? ' selected' : '', $board['id'] == $context['current_board'] ? ' disabled' : '', '>', $board['child_level'] > 0 ? str_repeat('==', $board['child_level']-1) . '=&gt; ' : '', $board['name'], '</option>';
42
+									<option value="', $board['id'], '"', $board['selected'] ? ' selected' : '', $board['id'] == $context['current_board'] ? ' disabled' : '', '>', $board['child_level'] > 0 ? str_repeat('==', $board['child_level'] - 1) . '=&gt; ' : '', $board['name'], '</option>';
43 43
 		echo '
44 44
 								</optgroup>';
45 45
 	}
Please login to merge, or discard this patch.
Braces   +25 added lines, -20 removed lines patch added patch discarded remove patch
@@ -37,9 +37,10 @@  discard block
 block discarded – undo
37 37
 		echo '
38 38
 								<optgroup label="', $category['name'], '">';
39 39
 
40
-		foreach ($category['boards'] as $board)
41
-			echo '
40
+		foreach ($category['boards'] as $board) {
41
+					echo '
42 42
 									<option value="', $board['id'], '"', $board['selected'] ? ' selected' : '', $board['id'] == $context['current_board'] ? ' disabled' : '', '>', $board['child_level'] > 0 ? str_repeat('==', $board['child_level']-1) . '=&gt; ' : '', $board['name'], '</option>';
43
+		}
43 44
 		echo '
44 45
 								</optgroup>';
45 46
 	}
@@ -68,9 +69,10 @@  discard block
 block discarded – undo
68 69
 				</div>
69 70
 			</div>';
70 71
 
71
-	if ($context['back_to_topic'])
72
-		echo '
72
+	if ($context['back_to_topic']) {
73
+			echo '
73 74
 			<input type="hidden" name="goback" value="1">';
75
+	}
74 76
 
75 77
 	echo '
76 78
 			<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
@@ -120,8 +122,7 @@  discard block
 block discarded – undo
120 122
 									<option value="86400">', $txt['two_months'], '</option>
121 123
 								</select>
122 124
 							</dd>';
123
-	}
124
-	else
125
+	} else
125 126
 	{
126 127
 		echo '
127 128
 							<input type="hidden" name="redirect_expires" value="0">';
@@ -217,9 +218,9 @@  discard block
 block discarded – undo
217 218
 						<input type="submit" value="', $txt['go'], '" class="button_submit">
218 219
 					</form>';
219 220
 
221
+	} else {
222
+			echo $txt['target_below'];
220 223
 	}
221
-	else
222
-		echo $txt['target_below'];
223 224
 
224 225
 	echo '				</h4>
225 226
 			</div>';
@@ -237,12 +238,13 @@  discard block
 block discarded – undo
237 238
 
238 239
 		$merge_button = create_button('merge', 'merge', '');
239 240
 
240
-		foreach ($context['topics'] as $topic)
241
-			echo '
241
+		foreach ($context['topics'] as $topic) {
242
+					echo '
242 243
 						<li>
243 244
 							<a href="', $scripturl, '?action=mergetopics;sa=options;board=', $context['current_board'], '.0;from=', $context['origin_topic'], ';to=', $topic['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $merge_button, '</a>&nbsp;
244 245
 							<a href="', $scripturl, '?topic=', $topic['id'], '.0" target="_blank" class="new_win">', $topic['subject'], '</a> ', $txt['started_by'], ' ', $topic['poster']['link'], '
245 246
 						</li>';
247
+		}
246 248
 
247 249
 		echo '
248 250
 					</ul>
@@ -251,8 +253,7 @@  discard block
 block discarded – undo
251 253
 				<div class="pagesection">
252 254
 					', $context['page_index'], '
253 255
 				</div>';
254
-	}
255
-	else
256
+	} else
256 257
 	{
257 258
 		// Just a nice "There aren't any topics" message
258 259
 		echo '
@@ -306,8 +307,8 @@  discard block
 block discarded – undo
306 307
 					</tr>
307 308
 				</thead>
308 309
 				<tbody>';
309
-		foreach ($context['topics'] as $topic)
310
-			echo '
310
+		foreach ($context['topics'] as $topic) {
311
+					echo '
311 312
 					<tr class="windowbg">
312 313
 						<td>
313 314
 							<input type="checkbox" class="input_check" name="topics[]" value="' . $topic['id'] . '" checked>
@@ -327,6 +328,7 @@  discard block
 block discarded – undo
327 328
 							<input type="checkbox" class="input_check" name="notifications[]" value="' . $topic['id'] . '" checked>
328 329
 						</td>
329 330
 					</tr>';
331
+		}
330 332
 		echo '
331 333
 				</tbody>
332 334
 			</table>
@@ -337,9 +339,10 @@  discard block
 block discarded – undo
337 339
 				<fieldset id="merge_subject" class="merge_options">
338 340
 					<legend>', $txt['merge_select_subject'], '</legend>
339 341
 					<select name="subject" onchange="this.form.custom_subject.style.display = (this.options[this.selectedIndex].value != 0) ? \'none\': \'\' ;">';
340
-	foreach ($context['topics'] as $topic)
341
-		echo '
342
+	foreach ($context['topics'] as $topic) {
343
+			echo '
342 344
 						<option value="', $topic['id'], '"' . ($topic['selected'] ? ' selected' : '') . '>', $topic['subject'], '</option>';
345
+	}
343 346
 	echo '
344 347
 						<option value="0">', $txt['merge_custom_subject'], ':</option>
345 348
 					</select>
@@ -357,11 +360,12 @@  discard block
 block discarded – undo
357 360
 				<fieldset id="merge_board" class="merge_options">
358 361
 					<legend>', $txt['merge_select_target_board'], '</legend>
359 362
 					<ul>';
360
-		foreach ($context['boards'] as $board)
361
-			echo '
363
+		foreach ($context['boards'] as $board) {
364
+					echo '
362 365
 						<li>
363 366
 							<input type="radio" name="board" value="' . $board['id'] . '"' . ($board['selected'] ? ' checked' : '') . ' class="input_radio"> ' . $board['name'] . '
364 367
 						</li>';
368
+		}
365 369
 		echo '
366 370
 					</ul>
367 371
 				</fieldset>';
@@ -372,11 +376,12 @@  discard block
 block discarded – undo
372 376
 				<fieldset id="merge_poll" class="merge_options">
373 377
 					<legend>' . $txt['merge_select_poll'] . '</legend>
374 378
 					<ul>';
375
-		foreach ($context['polls'] as $poll)
376
-			echo '
379
+		foreach ($context['polls'] as $poll) {
380
+					echo '
377 381
 						<li>
378 382
 							<input type="radio" name="poll" value="' . $poll['id'] . '"' . ($poll['selected'] ? ' checked' : '') . ' class="input_radio"> ' . $poll['question'] . ' (' . $txt['topic'] . ': <a href="' . $scripturl . '?topic=' . $poll['topic']['id'] . '.0" target="_blank" class="new_win">' . $poll['topic']['subject'] . '</a>)
379 383
 						</li>';
384
+		}
380 385
 		echo '
381 386
 						<li>
382 387
 							<input type="radio" name="poll" value="-1" class="input_radio"> (' . $txt['merge_no_poll'] . ')
Please login to merge, or discard this patch.
Themes/default/Packages.template.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1096,7 +1096,7 @@
 block discarded – undo
1096 1096
 /**
1097 1097
  * CHMOD control form
1098 1098
  *
1099
- * @return bool False if nothing to do.
1099
+ * @return false|null False if nothing to do.
1100 1100
  */
1101 1101
 function template_control_chmod()
1102 1102
 {
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -912,7 +912,7 @@  discard block
 block discarded – undo
912 912
 				{
913 913
 					// 1. Some mod [ Download ].
914 914
 					echo '
915
-						<strong><span id="ps_img_', $i, '_pkg_', $id, '" class="toggle_up" alt="*" style="display: none;"></span> ', $package['can_install'] || !empty($package['can_emulate_install']) ? '<strong>' . $package['name'] . '</strong> <a href="' . $package['download']['href'] . '">[ ' . $txt['download'] . ' ]</a>': $package['name'], '</strong>
915
+						<strong><span id="ps_img_', $i, '_pkg_', $id, '" class="toggle_up" alt="*" style="display: none;"></span> ', $package['can_install'] || !empty($package['can_emulate_install']) ? '<strong>' . $package['name'] . '</strong> <a href="' . $package['download']['href'] . '">[ ' . $txt['download'] . ' ]</a>' : $package['name'], '</strong>
916 916
 						<ul id="package_section_', $i, '_pkg_', $id, '" class="package_section">';
917 917
 
918 918
 					// Show the mod type?
@@ -1284,10 +1284,10 @@  discard block
 block discarded – undo
1284 1284
 	<head>
1285 1285
 		<meta charset="', $context['character_set'], '">
1286 1286
 		<title>', $txt['operation_title'], '</title>
1287
-		<link rel="stylesheet" href="', $settings['theme_url'], '/css/index', $context['theme_variant'], '.css', $modSettings['browser_cache'] ,'">
1288
-		<link rel="stylesheet" href="', $settings['theme_url'], '/css/admin.css', $modSettings['browser_cache'] ,'">
1289
-		<script src="', $settings['default_theme_url'], '/scripts/script.js', $modSettings['browser_cache'] ,'"></script>
1290
-		<script src="', $settings['default_theme_url'], '/scripts/theme.js', $modSettings['browser_cache'] ,'"></script>
1287
+		<link rel="stylesheet" href="', $settings['theme_url'], '/css/index', $context['theme_variant'], '.css', $modSettings['browser_cache'], '">
1288
+		<link rel="stylesheet" href="', $settings['theme_url'], '/css/admin.css', $modSettings['browser_cache'], '">
1289
+		<script src="', $settings['default_theme_url'], '/scripts/script.js', $modSettings['browser_cache'], '"></script>
1290
+		<script src="', $settings['default_theme_url'], '/scripts/theme.js', $modSettings['browser_cache'], '"></script>
1291 1291
 	</head>
1292 1292
 	<body>
1293 1293
 		<div class="padding windowbg">
Please login to merge, or discard this patch.
Braces   +144 added lines, -104 removed lines patch added patch discarded remove patch
@@ -31,12 +31,13 @@  discard block
 block discarded – undo
31 31
 		</div>
32 32
 		<div class="information">';
33 33
 
34
-	if ($context['is_installed'])
35
-		echo '
34
+	if ($context['is_installed']) {
35
+			echo '
36 36
 			<strong>', $txt['package_installed_warning1'], '</strong><br>
37 37
 			<br>
38 38
 			', $txt['package_installed_warning2'], '<br>
39 39
 			<br>';
40
+	}
40 41
 
41 42
 	echo $txt['package_installed_warning3'], '
42 43
 		</div><br>';
@@ -63,8 +64,9 @@  discard block
 block discarded – undo
63 64
 				', $context['package_readme'], '
64 65
 				<span class="floatright">', $txt['package_available_readme_language'], '
65 66
 					<select name="readme_language" id="readme_language" onchange="if (this.options[this.selectedIndex].value) window.location.href = smf_prepareScriptUrl(smf_scripturl + \'', '?action=admin;area=packages;sa=', $context['uninstalling'] ? 'uninstall' : 'install', ';package=', $context['filename'], ';readme=\' + this.options[this.selectedIndex].value + \';license=\' + get_selected(\'license_language\'));">';
66
-						foreach ($context['readmes'] as $a => $b)
67
-							echo '<option value="', $b, '"', $a === 'selected' ? ' selected' : '', '>', $b == 'default' ? $txt['package_readme_default'] : ucfirst($b), '</option>';
67
+						foreach ($context['readmes'] as $a => $b) {
68
+													echo '<option value="', $b, '"', $a === 'selected' ? ' selected' : '', '>', $b == 'default' ? $txt['package_readme_default'] : ucfirst($b), '</option>';
69
+						}
68 70
 			echo '
69 71
 					</select>
70 72
 				</span>
@@ -83,8 +85,9 @@  discard block
 block discarded – undo
83 85
 				', $context['package_license'], '
84 86
 				<span class="floatright">', $txt['package_available_license_language'], '
85 87
 					<select name="license_language" id="license_language" onchange="if (this.options[this.selectedIndex].value) window.location.href = smf_prepareScriptUrl(smf_scripturl + \'', '?action=admin;area=packages;sa=install', ';package=', $context['filename'], ';license=\' + this.options[this.selectedIndex].value + \';readme=\' + get_selected(\'readme_language\'));">';
86
-						foreach ($context['licenses'] as $a => $b)
87
-							echo '<option value="', $b, '"', $a === 'selected' ? ' selected' : '', '>', $b == 'default' ? $txt['package_license_default'] : ucfirst($b), '</option>';
88
+						foreach ($context['licenses'] as $a => $b) {
89
+													echo '<option value="', $b, '"', $a === 'selected' ? ' selected' : '', '>', $b == 'default' ? $txt['package_license_default'] : ucfirst($b), '</option>';
90
+						}
88 91
 			echo '
89 92
 					</select>
90 93
 				</span>
@@ -110,9 +113,10 @@  discard block
 block discarded – undo
110 113
 					', $txt['package_db_uninstall_actions'], ':
111 114
 					<ul>';
112 115
 
113
-		foreach ($context['database_changes'] as $change)
114
-			echo '
116
+		foreach ($context['database_changes'] as $change) {
117
+					echo '
115 118
 						<li>', $change, '</li>';
119
+		}
116 120
 		echo '
117 121
 					</ul>
118 122
 				</div>
@@ -122,14 +126,14 @@  discard block
 block discarded – undo
122 126
 	echo '
123 127
 			<div class="information">';
124 128
 
125
-	if (empty($context['actions']) && empty($context['database_changes']))
126
-		echo '
129
+	if (empty($context['actions']) && empty($context['database_changes'])) {
130
+			echo '
127 131
 				<br>
128 132
 				<div class="errorbox">
129 133
 					', $txt['corrupt_compatible'], '
130 134
 				</div>
131 135
 			</div>';
132
-	else
136
+	} else
133 137
 	{
134 138
 		echo '
135 139
 					', $txt['perform_actions'], '
@@ -229,9 +233,10 @@  discard block
 block discarded – undo
229 233
 					<tr class="title_bar">
230 234
 						<td></td>
231 235
 						<td>';
232
-				if (!empty($context['themes_locked']))
233
-					echo '
236
+				if (!empty($context['themes_locked'])) {
237
+									echo '
234 238
 							<input type="hidden" name="custom_theme[]" value="', $id, '">';
239
+				}
235 240
 				echo '
236 241
 							<input type="checkbox" name="custom_theme[]" id="custom_theme_', $id, '" value="', $id, '" class="input_check" onclick="', (!empty($theme['has_failure']) ? 'if (this.form.custom_theme_' . $id . '.checked && !confirm(\'' . $txt['package_theme_failure_warning'] . '\')) return false;' : ''), 'invertAll(this, this.form, \'dummy_theme_', $id, '\', true);"', !empty($context['themes_locked']) ? ' disabled checked' : '', '>
237 242
 						</td>
@@ -372,14 +377,15 @@  discard block
 block discarded – undo
372 377
 	</script>';
373 378
 
374 379
 	// And a bit more for database changes.
375
-	if (!empty($context['database_changes']))
376
-		echo '
380
+	if (!empty($context['database_changes'])) {
381
+			echo '
377 382
 	<script>
378 383
 		var database_changes_area = document.getElementById(\'db_changes_div\');
379 384
 		var db_vis = false;
380 385
 		database_changes_area.style.display = "none";
381 386
 	</script>';
382
-}
387
+	}
388
+	}
383 389
 
384 390
 /**
385 391
  * Extract package contents
@@ -411,12 +417,12 @@  discard block
 block discarded – undo
411 417
 				<h3 class="catbg">', $context['uninstalling'] ? $txt['uninstall'] : $txt['extracting'], '</h3>
412 418
 			</div>
413 419
 			<div class="information">', $txt['package_installed_extract'], '</div>';
414
-	}
415
-	else
416
-		echo '
420
+	} else {
421
+			echo '
417 422
 			<div class="cat_bar">
418 423
 				<h3 class="catbg">', $txt['package_installed_redirecting'], '</h3>
419 424
 			</div>';
425
+	}
420 426
 
421 427
 	echo '
422 428
 		<div class="windowbg">';
@@ -427,25 +433,25 @@  discard block
 block discarded – undo
427 433
 		echo '
428 434
 			', $context['redirect_text'], '<br><br>
429 435
 			<a href="', $context['redirect_url'], '">', $txt['package_installed_redirect_go_now'], '</a> | <a href="', $scripturl, '?action=admin;area=packages;sa=browse">', $txt['package_installed_redirect_cancel'], '</a>';
430
-	}
431
-	elseif ($context['uninstalling'])
432
-		echo '
436
+	} elseif ($context['uninstalling']) {
437
+			echo '
433 438
 			', $txt['package_uninstall_done'];
434
-	elseif ($context['install_finished'])
439
+	} elseif ($context['install_finished'])
435 440
 	{
436
-		if ($context['extract_type'] == 'avatar')
437
-			echo '
441
+		if ($context['extract_type'] == 'avatar') {
442
+					echo '
438 443
 				', $txt['avatars_extracted'];
439
-		elseif ($context['extract_type'] == 'language')
440
-			echo '
444
+		} elseif ($context['extract_type'] == 'language') {
445
+					echo '
441 446
 				', $txt['language_extracted'];
442
-		else
443
-			echo '
447
+		} else {
448
+					echo '
444 449
 				', $txt['package_installed_done'];
445
-	}
446
-	else
447
-		echo '
450
+		}
451
+	} else {
452
+			echo '
448 453
 			', $txt['corrupt_compatible'];
454
+	}
449 455
 
450 456
 	echo '
451 457
 		</div>';
@@ -479,9 +485,10 @@  discard block
 block discarded – undo
479 485
 		<div class="windowbg">
480 486
 			<ol>';
481 487
 
482
-	foreach ($context['files'] as $fileinfo)
483
-		echo '
488
+	foreach ($context['files'] as $fileinfo) {
489
+			echo '
484 490
 				<li><a href="', $scripturl, '?action=admin;area=packages;sa=examine;package=', $context['filename'], ';file=', $fileinfo['filename'], '" title="', $txt['view'], '">', $fileinfo['filename'], '</a> (', $fileinfo['size'], ' ', $txt['package_bytes'], ')</li>';
491
+	}
485 492
 
486 493
 	echo '
487 494
 			</ol>
@@ -545,9 +552,10 @@  discard block
 block discarded – undo
545 552
 			</script>
546 553
 			<div id="yourVersion" style="display:none">', $context['forum_version'], '</div>';
547 554
 
548
-	if (empty($modSettings['disable_smf_js']))
549
-		echo '
555
+	if (empty($modSettings['disable_smf_js'])) {
556
+			echo '
550 557
 			<script src="', $scripturl, '?action=viewsmfile;filename=latest-news.js"></script>';
558
+	}
551 559
 
552 560
 	// This sets the announcements and current versions themselves ;).
553 561
 	echo '
@@ -586,12 +594,13 @@  discard block
 block discarded – undo
586 594
 		}
587 595
 	}
588 596
 
589
-	if (!$mods_available)
590
-		echo '
597
+	if (!$mods_available) {
598
+			echo '
591 599
 		<div class="noticebox">', $txt['no_packages'], '</div>';
592
-	else
593
-		echo '
600
+	} else {
601
+			echo '
594 602
 		<br>';
603
+	}
595 604
 
596 605
 	// the advanced (emulation) box, collapsed by default
597 606
 	echo '
@@ -680,11 +689,12 @@  discard block
 block discarded – undo
680 689
 {
681 690
 	global $context, $txt, $scripturl;
682 691
 
683
-	if (!empty($context['package_ftp']['error']))
684
-			echo '
692
+	if (!empty($context['package_ftp']['error'])) {
693
+				echo '
685 694
 					<div class="errorbox">
686 695
 						<pre>', $context['package_ftp']['error'], '</pre>
687 696
 					</div>';
697
+	}
688 698
 
689 699
 	echo '
690 700
 	<div id="admin_form_wrapper">
@@ -765,13 +775,14 @@  discard block
 block discarded – undo
765 775
 				<fieldset>
766 776
 					<legend>' . $txt['package_servers'] . '</legend>
767 777
 					<ul class="package_servers">';
768
-	foreach ($context['servers'] as $server)
769
-		echo '
778
+	foreach ($context['servers'] as $server) {
779
+			echo '
770 780
 						<li class="flow_auto">
771 781
 							<span class="floatleft">' . $server['name'] . '</span>
772 782
 							<span class="package_server floatright"><a href="' . $scripturl . '?action=admin;area=packages;get;sa=remove;server=' . $server['id'] . ';', $context['session_var'], '=', $context['session_id'], '">[ ' . $txt['delete'] . ' ]</a></span>
773 783
 							<span class="package_server floatright"><a href="' . $scripturl . '?action=admin;area=packages;get;sa=browse;server=' . $server['id'] . '">[ ' . $txt['package_browse'] . ' ]</a></span>
774 784
 						</li>';
785
+	}
775 786
 	echo '
776 787
 					</ul>
777 788
 				</fieldset>
@@ -858,11 +869,12 @@  discard block
 block discarded – undo
858 869
 		<div class="windowbg2">';
859 870
 
860 871
 	// No packages, as yet.
861
-	if (empty($context['package_list']))
862
-		echo '
872
+	if (empty($context['package_list'])) {
873
+			echo '
863 874
 			<ul>
864 875
 				<li>', $txt['no_packages'], '</li>
865 876
 			</ul>';
877
+	}
866 878
 	// List out the packages...
867 879
 	else
868 880
 	{
@@ -874,11 +886,12 @@  discard block
 block discarded – undo
874 886
 				<li>
875 887
 					<strong><span id="ps_img_', $i, '" class="toggle_up" alt="*" style="display: none;"></span> ', $packageSection['title'], '</strong>';
876 888
 
877
-			if (!empty($packageSection['text']))
878
-				echo '
889
+			if (!empty($packageSection['text'])) {
890
+							echo '
879 891
 					<div class="sub_bar">
880 892
 						<h3 class="subbg">', $packageSection['text'], '</h3>
881 893
 					</div>';
894
+			}
882 895
 
883 896
 			echo '
884 897
 					<', $context['list_type'], ' id="package_section_', $i, '" class="packages">';
@@ -888,13 +901,15 @@  discard block
 block discarded – undo
888 901
 				echo '
889 902
 						<li>';
890 903
 				// Textual message. Could be empty just for a blank line...
891
-				if ($package['is_text'])
892
-					echo '
904
+				if ($package['is_text']) {
905
+									echo '
893 906
 							', empty($package['name']) ? '&nbsp;' : $package['name'];
907
+				}
894 908
 				// This is supposed to be a rule..
895
-				elseif ($package['is_line'])
896
-					echo '
909
+				elseif ($package['is_line']) {
910
+									echo '
897 911
 						<hr>';
912
+				}
898 913
 				// A remote link.
899 914
 				elseif ($package['is_remote'])
900 915
 				{
@@ -916,21 +931,25 @@  discard block
 block discarded – undo
916 931
 						<ul id="package_section_', $i, '_pkg_', $id, '" class="package_section">';
917 932
 
918 933
 					// Show the mod type?
919
-					if ($package['type'] != '')
920
-						echo '
934
+					if ($package['type'] != '') {
935
+											echo '
921 936
 							<li class="package_section">', $txt['package_type'], ':&nbsp; ', $smcFunc['ucwords']($smcFunc['strtolower']($package['type'])), '</li>';
937
+					}
922 938
 					// Show the version number?
923
-					if ($package['version'] != '')
924
-						echo '
939
+					if ($package['version'] != '') {
940
+											echo '
925 941
 							<li class="package_section">', $txt['mod_version'], ':&nbsp; ', $package['version'], '</li>';
942
+					}
926 943
 					// How 'bout the author?
927
-					if (!empty($package['author']) && $package['author']['name'] != '' && isset($package['author']['link']))
928
-						echo '
944
+					if (!empty($package['author']) && $package['author']['name'] != '' && isset($package['author']['link'])) {
945
+											echo '
929 946
 							<li class="package_section">', $txt['mod_author'], ':&nbsp; ', $package['author']['link'], '</li>';
947
+					}
930 948
 					// The homepage....
931
-					if ($package['author']['website']['link'] != '')
932
-						echo '
949
+					if ($package['author']['website']['link'] != '') {
950
+											echo '
933 951
 							<li class="package_section">', $txt['author_website'], ':&nbsp; ', $package['author']['website']['link'], '</li>';
952
+					}
934 953
 
935 954
 					// Desciption: bleh bleh!
936 955
 					// Location of file: http://someplace/.
@@ -983,8 +1002,8 @@  discard block
 block discarded – undo
983 1002
 
984 1003
 				foreach ($ps['items'] as $id => $package)
985 1004
 				{
986
-					if (!$package['is_text'] && !$package['is_line'] && !$package['is_remote'])
987
-						echo '
1005
+					if (!$package['is_text'] && !$package['is_line'] && !$package['is_remote']) {
1006
+											echo '
988 1007
 				var oPackageToggle_', $section, '_pkg_', $id, ' = new smc_Toggle({
989 1008
 					bToggleEnabled: true,
990 1009
 					bCurrentlyCollapsed: true,
@@ -999,6 +1018,7 @@  discard block
 block discarded – undo
999 1018
 						}
1000 1019
 					]
1001 1020
 				});';
1021
+					}
1002 1022
 				}
1003 1023
 			}
1004 1024
 			echo '
@@ -1039,9 +1059,10 @@  discard block
 block discarded – undo
1039 1059
 {
1040 1060
 	global $context, $txt, $scripturl;
1041 1061
 
1042
-	if (!empty($context['saved_successful']))
1043
-		echo '
1062
+	if (!empty($context['saved_successful'])) {
1063
+			echo '
1044 1064
 	<div class="infobox">', $txt['settings_saved'], '</div>';
1065
+	}
1045 1066
 
1046 1067
 	echo '
1047 1068
 	<div id="admincenter">
@@ -1103,8 +1124,9 @@  discard block
 block discarded – undo
1103 1124
 	global $context, $txt;
1104 1125
 
1105 1126
 	// Nothing to do? Brilliant!
1106
-	if (empty($context['package_ftp']))
1107
-		return false;
1127
+	if (empty($context['package_ftp'])) {
1128
+			return false;
1129
+	}
1108 1130
 
1109 1131
 	if (empty($context['package_ftp']['form_elements_only']))
1110 1132
 	{
@@ -1113,19 +1135,21 @@  discard block
 block discarded – undo
1113 1135
 				<div id="need_writable_list" class="smalltext">
1114 1136
 					', $txt['package_ftp_why_file_list'], '
1115 1137
 					<ul style="display: inline;">';
1116
-		if (!empty($context['notwritable_files']))
1117
-			foreach ($context['notwritable_files'] as $file)
1138
+		if (!empty($context['notwritable_files'])) {
1139
+					foreach ($context['notwritable_files'] as $file)
1118 1140
 				echo '
1119 1141
 						<li>', $file, '</li>';
1142
+		}
1120 1143
 
1121 1144
 		echo '
1122 1145
 					</ul>';
1123 1146
 
1124
-		if (!$context['server']['is_windows'])
1125
-			echo '
1147
+		if (!$context['server']['is_windows']) {
1148
+					echo '
1126 1149
 				<hr>
1127 1150
 				', $txt['package_chmod_linux'], '<br />
1128 1151
 				<tt># chmod a+w ', implode(' ', $context['notwritable_files']), '</tt>';
1152
+		}
1129 1153
 
1130 1154
 		echo '
1131 1155
 				</div>';
@@ -1136,9 +1160,10 @@  discard block
 block discarded – undo
1136 1160
 					<tt id="ftp_error_message">', !empty($context['package_ftp']['error']) ? $context['package_ftp']['error'] : '', '</tt>
1137 1161
 				</div></div>';
1138 1162
 
1139
-	if (!empty($context['package_ftp']['destination']))
1140
-		echo '
1163
+	if (!empty($context['package_ftp']['destination'])) {
1164
+			echo '
1141 1165
 				<form action="', $context['package_ftp']['destination'], '" method="post" accept-charset="', $context['character_set'], '" style="margin: 0;">';
1166
+	}
1142 1167
 
1143 1168
 	echo '
1144 1169
 					<fieldset>
@@ -1171,25 +1196,28 @@  discard block
 block discarded – undo
1171 1196
 					</dl>
1172 1197
 					</fieldset>';
1173 1198
 
1174
-	if (empty($context['package_ftp']['form_elements_only']))
1175
-		echo '
1199
+	if (empty($context['package_ftp']['form_elements_only'])) {
1200
+			echo '
1176 1201
 
1177 1202
 					<div class="righttext" style="margin: 1ex;">
1178 1203
 						<span id="test_ftp_placeholder_full"></span>
1179 1204
 						<input type="submit" value="', $txt['package_proceed'], '" class="button_submit">
1180 1205
 					</div>';
1206
+	}
1181 1207
 
1182
-	if (!empty($context['package_ftp']['destination']))
1183
-		echo '
1208
+	if (!empty($context['package_ftp']['destination'])) {
1209
+			echo '
1184 1210
 					<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
1185 1211
 				</form>';
1212
+	}
1186 1213
 
1187 1214
 	// Hide the details of the list.
1188
-	if (empty($context['package_ftp']['form_elements_only']))
1189
-		echo '
1215
+	if (empty($context['package_ftp']['form_elements_only'])) {
1216
+			echo '
1190 1217
 		<script>
1191 1218
 			document.getElementById(\'need_writable_list\').style.display = \'none\';
1192 1219
 		</script>';
1220
+	}
1193 1221
 
1194 1222
 	// Quick generate the test button.
1195 1223
 	echo '
@@ -1545,9 +1573,10 @@  discard block
 block discarded – undo
1545 1573
 				<tr class="windowbg">
1546 1574
 					<td width="30%"><strong>';
1547 1575
 
1548
-				if (!empty($dir['type']) && ($dir['type'] == 'dir' || $dir['type'] == 'dir_recursive'))
1549
-					echo '
1576
+				if (!empty($dir['type']) && ($dir['type'] == 'dir' || $dir['type'] == 'dir_recursive')) {
1577
+									echo '
1550 1578
 						<span class="generic_icons folder"></span>';
1579
+				}
1551 1580
 
1552 1581
 				echo '
1553 1582
 						', $name, '
@@ -1564,8 +1593,9 @@  discard block
 block discarded – undo
1564 1593
 				</tr>
1565 1594
 			';
1566 1595
 
1567
-		if (!empty($dir['contents']))
1568
-			template_permission_show_contents($name, $dir['contents'], 1);
1596
+		if (!empty($dir['contents'])) {
1597
+					template_permission_show_contents($name, $dir['contents'], 1);
1598
+		}
1569 1599
 	}
1570 1600
 
1571 1601
 	echo '
@@ -1601,13 +1631,14 @@  discard block
 block discarded – undo
1601 1631
 			</fieldset>';
1602 1632
 
1603 1633
 	// Likely to need FTP?
1604
-	if (empty($context['ftp_connected']))
1605
-		echo '
1634
+	if (empty($context['ftp_connected'])) {
1635
+			echo '
1606 1636
 			<p>
1607 1637
 				', $txt['package_file_perms_ftp_details'], ':
1608 1638
 			</p>
1609 1639
 			', template_control_chmod(), '
1610 1640
 			<div class="noticebox">', $txt['package_file_perms_ftp_retain'], '</div>';
1641
+	}
1611 1642
 
1612 1643
 	echo '
1613 1644
 			<span id="test_ftp_placeholder_full"></span>
@@ -1616,9 +1647,10 @@  discard block
 block discarded – undo
1616 1647
 		</div>';
1617 1648
 
1618 1649
 	// Any looks fors we've already done?
1619
-	foreach ($context['look_for'] as $path)
1620
-		echo '
1650
+	foreach ($context['look_for'] as $path) {
1651
+			echo '
1621 1652
 			<input type="hidden" name="back_look[]" value="', $path, '">';
1653
+	}
1622 1654
 	echo '
1623 1655
 	</form><br>';
1624 1656
 }
@@ -1657,9 +1689,10 @@  discard block
 block discarded – undo
1657 1689
 				<td class="smalltext" width="30%">' . str_repeat('&nbsp;', $level * 5), '
1658 1690
 					', (!empty($dir['type']) && $dir['type'] == 'dir_recursive') || !empty($dir['list_contents']) ? '<a id="link_' . $cur_ident . '" href="' . $scripturl . '?action=admin;area=packages;sa=perms;find=' . base64_encode($ident . '/' . $name) . ';back_look=' . $context['back_look_data'] . ';' . $context['session_var'] . '=' . $context['session_id'] . '#fol_' . $cur_ident . '" onclick="return expandFolder(\'' . $cur_ident . '\', \'' . addcslashes($ident . '/' . $name, "'\\") . '\');">' : '';
1659 1691
 
1660
-			if (!empty($dir['type']) && ($dir['type'] == 'dir' || $dir['type'] == 'dir_recursive'))
1661
-				echo '
1692
+			if (!empty($dir['type']) && ($dir['type'] == 'dir' || $dir['type'] == 'dir_recursive')) {
1693
+							echo '
1662 1694
 						<span class="generic_icons folder"></span>';
1695
+			}
1663 1696
 
1664 1697
 			echo '
1665 1698
 					', $name, '
@@ -1685,14 +1718,15 @@  discard block
 block discarded – undo
1685 1718
 	}
1686 1719
 
1687 1720
 	// We have more files to show?
1688
-	if ($has_more)
1689
-		echo '
1721
+	if ($has_more) {
1722
+			echo '
1690 1723
 	<tr class="windowbg" id="content_', $js_ident, '_more">
1691 1724
 		<td class="smalltext" width="40%">' . str_repeat('&nbsp;', $level * 5), '
1692 1725
 			&#171; <a href="' . $scripturl . '?action=admin;area=packages;sa=perms;find=' . base64_encode($ident) . ';fileoffset=', ($context['file_offset'] + $context['file_limit']), ';' . $context['session_var'] . '=' . $context['session_id'] . '#fol_' . preg_replace('~[^A-Za-z0-9_\-=:]~', ':-:', $ident) . '">', $txt['package_file_perms_more_files'], '</a> &#187;
1693 1726
 		</td>
1694 1727
 		<td colspan="6"></td>
1695 1728
 	</tr>';
1729
+	}
1696 1730
 
1697 1731
 	if ($drawn_div)
1698 1732
 	{
@@ -1700,15 +1734,17 @@  discard block
 block discarded – undo
1700 1734
 		$isFound = false;
1701 1735
 		foreach ($context['look_for'] as $tree)
1702 1736
 		{
1703
-			if (substr($tree, 0, strlen($ident)) == $ident)
1704
-				$isFound = true;
1737
+			if (substr($tree, 0, strlen($ident)) == $ident) {
1738
+							$isFound = true;
1739
+			}
1705 1740
 		}
1706 1741
 
1707
-		if ($level > 1 && !$isFound)
1708
-			echo '
1742
+		if ($level > 1 && !$isFound) {
1743
+					echo '
1709 1744
 		<script>
1710 1745
 			expandFolder(\'', $js_ident, '\', \'\');
1711 1746
 		</script>';
1747
+		}
1712 1748
 	}
1713 1749
 }
1714 1750
 
@@ -1728,11 +1764,12 @@  discard block
 block discarded – undo
1728 1764
 				<h3 class="catbg">', $txt['package_file_perms_applying'], '</h3>
1729 1765
 			</div>';
1730 1766
 
1731
-	if (!empty($context['skip_ftp']))
1732
-		echo '
1767
+	if (!empty($context['skip_ftp'])) {
1768
+			echo '
1733 1769
 			<div class="errorbox">
1734 1770
 				', $txt['package_file_perms_skipping_ftp'], '
1735 1771
 			</div>';
1772
+	}
1736 1773
 
1737 1774
 	// How many have we done?
1738 1775
 	$remaining_items = count($context['method'] == 'individual' ? $context['to_process'] : $context['directory_list']);
@@ -1770,28 +1807,31 @@  discard block
 block discarded – undo
1770 1807
 				<br>';
1771 1808
 
1772 1809
 	// Put out the right hidden data.
1773
-	if ($context['method'] == 'individual')
1774
-		echo '
1810
+	if ($context['method'] == 'individual') {
1811
+			echo '
1775 1812
 				<input type="hidden" name="custom_value" value="', $context['custom_value'], '">
1776 1813
 				<input type="hidden" name="totalItems" value="', $context['total_items'], '">
1777 1814
 				<input type="hidden" name="toProcess" value="', base64_encode(json_encode($context['to_process'])), '">';
1778
-	else
1779
-		echo '
1815
+	} else {
1816
+			echo '
1780 1817
 				<input type="hidden" name="predefined" value="', $context['predefined_type'], '">
1781 1818
 				<input type="hidden" name="fileOffset" value="', $context['file_offset'], '">
1782 1819
 				<input type="hidden" name="totalItems" value="', $context['total_items'], '">
1783 1820
 				<input type="hidden" name="dirList" value="', base64_encode(json_encode($context['directory_list'])), '">
1784 1821
 				<input type="hidden" name="specialFiles" value="', base64_encode(json_encode($context['special_files'])), '">';
1822
+	}
1785 1823
 
1786 1824
 	// Are we not using FTP for whatever reason.
1787
-	if (!empty($context['skip_ftp']))
1788
-		echo '
1825
+	if (!empty($context['skip_ftp'])) {
1826
+			echo '
1789 1827
 				<input type="hidden" name="skip_ftp" value="1">';
1828
+	}
1790 1829
 
1791 1830
 	// Retain state.
1792
-	foreach ($context['back_look_data'] as $path)
1793
-		echo '
1831
+	foreach ($context['back_look_data'] as $path) {
1832
+			echo '
1794 1833
 				<input type="hidden" name="back_look[]" value="', $path, '">';
1834
+	}
1795 1835
 
1796 1836
 	echo '
1797 1837
 				<input type="hidden" name="method" value="', $context['method'], '">
Please login to merge, or discard this patch.
proxy.php 1 patch
Braces   +32 added lines, -21 removed lines patch added patch discarded remove patch
@@ -66,26 +66,31 @@  discard block
 block discarded – undo
66 66
 	 */
67 67
 	public function checkRequest()
68 68
 	{
69
-		if (!$this->enabled)
70
-			return false;
69
+		if (!$this->enabled) {
70
+					return false;
71
+		}
71 72
 
72 73
 		// Try to create the image cache directory if it doesn't exist
73
-		if (!file_exists($this->cache))
74
-			if (!mkdir($this->cache) || !copy(dirname($this->cache) . '/index.php', $this->cache . '/index.php'))
74
+		if (!file_exists($this->cache)) {
75
+					if (!mkdir($this->cache) || !copy(dirname($this->cache) . '/index.php', $this->cache . '/index.php'))
75 76
 				return false;
77
+		}
76 78
 
77
-		if (empty($_GET['hash']) || empty($_GET['request']))
78
-			return false;
79
+		if (empty($_GET['hash']) || empty($_GET['request'])) {
80
+					return false;
81
+		}
79 82
 
80 83
 		$hash = $_GET['hash'];
81 84
 		$request = $_GET['request'];
82 85
 
83
-		if (md5($request . $this->secret) != $hash)
84
-			return false;
86
+		if (md5($request . $this->secret) != $hash) {
87
+					return false;
88
+		}
85 89
 
86 90
 		// Attempt to cache the request if it doesn't exist
87
-		if (!$this->isCached($request))
88
-			return $this->cacheImage($request);
91
+		if (!$this->isCached($request)) {
92
+					return $this->cacheImage($request);
93
+		}
89 94
 
90 95
 		return true;
91 96
 	}
@@ -106,15 +111,17 @@  discard block
 block discarded – undo
106 111
 		if (!$cached || time() - $cached['time'] > (5 * 86400))
107 112
 		{
108 113
 			@unlink($cached_file);
109
-			if ($this->checkRequest())
110
-				$this->serve();
114
+			if ($this->checkRequest()) {
115
+							$this->serve();
116
+			}
111 117
 			exit;
112 118
 		}
113 119
 
114 120
 		// Make sure we're serving an image
115 121
 		$contentParts = explode('/', !empty($cached['content_type']) ? $cached['content_type'] : '');
116
-		if ($contentParts[0] != 'image')
117
-			exit;
122
+		if ($contentParts[0] != 'image') {
123
+					exit;
124
+		}
118 125
 
119 126
 		header('Content-type: ' . $cached['content_type']);
120 127
 		header('Content-length: ' . $cached['size']);
@@ -160,19 +167,22 @@  discard block
 block discarded – undo
160 167
 		$request = $curl->get_url_data($request);
161 168
 		$response = $request->result();
162 169
 
163
-		if (empty($response))
164
-			return false;
170
+		if (empty($response)) {
171
+					return false;
172
+		}
165 173
 
166 174
 		$headers = $response['headers'];
167 175
 
168 176
 		// Make sure the url is returning an image
169 177
 		$contentParts = explode('/', !empty($headers['content-type']) ? $headers['content-type'] : '');
170
-		if ($contentParts[0] != 'image')
171
-			return false;
178
+		if ($contentParts[0] != 'image') {
179
+					return false;
180
+		}
172 181
 
173 182
 		// Validate the filesize
174
-		if ($response['size'] > ($this->maxSize * 1024))
175
-			return false;
183
+		if ($response['size'] > ($this->maxSize * 1024)) {
184
+					return false;
185
+		}
176 186
 
177 187
 		return file_put_contents($dest, json_encode(array(
178 188
 			'content_type' => $headers['content-type'],
@@ -184,7 +194,8 @@  discard block
 block discarded – undo
184 194
 }
185 195
 
186 196
 $proxy = new ProxyServer();
187
-if ($proxy->checkRequest())
197
+if ($proxy->checkRequest()) {
188 198
 	$proxy->serve();
199
+}
189 200
 
190 201
 exit;
Please login to merge, or discard this patch.
Packages/index.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,7 +12,8 @@
 block discarded – undo
12 12
 	header('Location: ' . $boardurl);
13 13
 }
14 14
 // Can't find it... just forget it.
15
-else
15
+else {
16 16
 	exit;
17
+}
17 18
 
18 19
 ?>
19 20
\ No newline at end of file
Please login to merge, or discard this patch.
Packages/backups/index.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,9 +1,10 @@
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 // Try to handle it with the upper level index.php. (it should know what to do.)
4
-if (file_exists(dirname(dirname(__FILE__)) . '/index.php'))
4
+if (file_exists(dirname(dirname(__FILE__)) . '/index.php')) {
5 5
 	include (dirname(dirname(__FILE__)) . '/index.php');
6
-else
6
+} else {
7 7
 	exit;
8
+}
8 9
 
9 10
 ?>
10 11
\ No newline at end of file
Please login to merge, or discard this patch.
ssi_examples.php 1 patch
Braces   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -583,8 +583,7 @@  discard block
 block discarded – undo
583 583
 	{
584 584
 		$header = '<?php require("' . ($user_info['is_admin'] ? addslashes(realpath($boarddir . '/SSI.php')) : 'SSI.php') . '"); ?>' . "\n" . $header;
585 585
 		return $header . template_homepage_sample1_html() . $footer;
586
-	}
587
-	else
586
+	} else
588 587
 	{
589 588
 		echo $header;
590 589
 		template_homepage_sample1_php();
@@ -599,9 +598,10 @@  discard block
 block discarded – undo
599 598
 
600 599
 	$topics = ssi_recentTopics(8, null, null, 'array');
601 600
 
602
-	foreach ($topics as $topic)
603
-		echo '
601
+	foreach ($topics as $topic) {
602
+			echo '
604 603
 			<li><a href="', $topic['href'], '">', $topic['subject'], '</a> ', $txt['by'], ' ', $topic['poster']['link'], '</li>';
604
+	}
605 605
 
606 606
 	unset($topics);
607 607
 
Please login to merge, or discard this patch.
other/Settings.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -182,7 +182,7 @@
 block discarded – undo
182 182
  * Path to the tasks directory.
183 183
  * @var string
184 184
  */
185
-$tasksdir = $sourcedir .'/tasks';
185
+$tasksdir = $sourcedir . '/tasks';
186 186
 
187 187
 ########## Error-Catching ##########
188 188
 # Note: You shouldn't touch these settings.
Please login to merge, or discard this patch.
Braces   +8 added lines, -4 removed lines patch added patch discarded remove patch
@@ -186,8 +186,9 @@  discard block
 block discarded – undo
186 186
 
187 187
 ########## Error-Catching ##########
188 188
 # Note: You shouldn't touch these settings.
189
-if (file_exists(dirname(__FILE__) . '/db_last_error.php'))
189
+if (file_exists(dirname(__FILE__) . '/db_last_error.php')) {
190 190
 	include(dirname(__FILE__) . '/db_last_error.php');
191
+}
191 192
 
192 193
 if (!isset($db_last_error))
193 194
 {
@@ -202,11 +203,14 @@  discard block
 block discarded – undo
202 203
 }
203 204
 
204 205
 # Make sure the paths are correct... at least try to fix them.
205
-if (!file_exists($boarddir) && file_exists(dirname(__FILE__) . '/agreement.txt'))
206
+if (!file_exists($boarddir) && file_exists(dirname(__FILE__) . '/agreement.txt')) {
206 207
 	$boarddir = dirname(__FILE__);
207
-if (!file_exists($sourcedir) && file_exists($boarddir . '/Sources'))
208
+}
209
+if (!file_exists($sourcedir) && file_exists($boarddir . '/Sources')) {
208 210
 	$sourcedir = $boarddir . '/Sources';
209
-if (!file_exists($cachedir) && file_exists($boarddir . '/cache'))
211
+}
212
+if (!file_exists($cachedir) && file_exists($boarddir . '/cache')) {
210 213
 	$cachedir = $boarddir . '/cache';
214
+}
211 215
 
212 216
 ?>
213 217
\ No newline at end of file
Please login to merge, or discard this patch.
other/install.php 2 patches
Spacing   +8 added lines, -10 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 		'utf8_default' => true,
63 63
 		'utf8_required' => true,
64 64
 		'alter_support' => true,
65
-		'validate_prefix' => function(&$value){
65
+		'validate_prefix' => function(&$value) {
66 66
 			$value = preg_replace('~[^A-Za-z0-9_\$]~', '', $value);
67 67
 			return true;
68 68
 		},
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 		'utf8_support' => true,
80 80
 		'utf8_version' => '8.0',
81 81
 		'utf8_version_check' => '$request = pg_query(\'SELECT version()\'); list ($version) = pg_fetch_row($request); list($pgl, $version) = explode(" ", $version); return $version;',
82
-		'validate_prefix' => function(&$value){
82
+		'validate_prefix' => function(&$value) {
83 83
 			$value = preg_replace('~[^A-Za-z0-9_\$]~', '', $value);
84 84
 
85 85
 			// Is it reserved?
@@ -741,7 +741,7 @@  discard block
 block discarded – undo
741 741
 	if (isset($_POST['db_user']))
742 742
 	{
743 743
 		$incontext['db']['user'] = $_POST['db_user'];
744
-		$incontext['db']['name'] =  $_POST['db_name'];
744
+		$incontext['db']['name'] = $_POST['db_name'];
745 745
 		$incontext['db']['server'] = $_POST['db_server'];
746 746
 		$incontext['db']['prefix'] = $_POST['db_prefix'];
747 747
 
@@ -1144,7 +1144,7 @@  discard block
 block discarded – undo
1144 1144
 		if ($smcFunc['db_query']('', $current_statement, array('security_override' => true, 'db_error_skip' => true), $db_connection) === false)
1145 1145
 		{
1146 1146
 			// Use the appropriate function based on the DB type
1147
-			if ($db_type == 'mysql' || $db_type =='mysqli')
1147
+			if ($db_type == 'mysql' || $db_type == 'mysqli')
1148 1148
 				$db_errorno = $db_type . '_errno';
1149 1149
 
1150 1150
 			// Error 1050: Table already exists!
@@ -1333,8 +1333,7 @@  discard block
 block discarded – undo
1333 1333
 	require_once($sourcedir . '/Subs.php');
1334 1334
 
1335 1335
 	// We need this to properly hash the password for Admin
1336
-	$smcFunc['strtolower'] = $db_character_set != 'utf8' && $txt['lang_character_set'] != 'UTF-8' ? 'strtolower' :
1337
-		function($string){
1336
+	$smcFunc['strtolower'] = $db_character_set != 'utf8' && $txt['lang_character_set'] != 'UTF-8' ? 'strtolower' : function($string) {
1338 1337
 			global $sourcedir;
1339 1338
 			if (function_exists('mb_strtolower'))
1340 1339
 				return mb_strtolower($string, 'UTF-8');
@@ -1598,8 +1597,7 @@  discard block
 block discarded – undo
1598 1597
 	updateStats('topic');
1599 1598
 
1600 1599
 	// This function is needed to do the updateStats('subject') call.
1601
-	$smcFunc['strtolower'] = $db_character_set != 'utf8' && $txt['lang_character_set'] != 'UTF-8' ? 'strtolower' :
1602
-		function($string){
1600
+	$smcFunc['strtolower'] = $db_character_set != 'utf8' && $txt['lang_character_set'] != 'UTF-8' ? 'strtolower' : function($string) {
1603 1601
 			global $sourcedir;
1604 1602
 			if (function_exists('mb_strtolower'))
1605 1603
 				return mb_strtolower($string, 'UTF-8');
@@ -1627,7 +1625,7 @@  discard block
 block discarded – undo
1627 1625
 	// Sanity check that they loaded earlier!
1628 1626
 	if (isset($modSettings['recycle_board']))
1629 1627
 	{
1630
-		$forum_version = $current_smf_version;  // The variable is usually defined in index.php so lets just use our variable to do it for us.
1628
+		$forum_version = $current_smf_version; // The variable is usually defined in index.php so lets just use our variable to do it for us.
1631 1629
 		scheduled_fetchSMfiles(); // Now go get those files!
1632 1630
 
1633 1631
 		// We've just installed!
@@ -1801,7 +1799,7 @@  discard block
 block discarded – undo
1801 1799
 		<title>', $txt['smf_installer'], '</title>
1802 1800
 		<link rel="stylesheet" href="Themes/default/css/index.css?alp21">
1803 1801
 		<link rel="stylesheet" href="Themes/default/css/install.css?alp21">
1804
-		', $txt['lang_rtl'] == true ? '<link rel="stylesheet" href="Themes/default/css/rtl.css?alp21">' : '' , '
1802
+		', $txt['lang_rtl'] == true ? '<link rel="stylesheet" href="Themes/default/css/rtl.css?alp21">' : '', '
1805 1803
 
1806 1804
 		<script src="Themes/default/scripts/jquery-2.1.4.min.js"></script>
1807 1805
 		<script src="Themes/default/scripts/script.js"></script>
Please login to merge, or discard this patch.
Braces   +428 added lines, -318 removed lines patch added patch discarded remove patch
@@ -20,8 +20,9 @@  discard block
 block discarded – undo
20 20
 // ><html dir="ltr"><head><title>Error!</title></head><body>Sorry, this installer requires PHP!<div style="display: none;">
21 21
 
22 22
 // Let's pull in useful classes
23
-if (!defined('SMF'))
23
+if (!defined('SMF')) {
24 24
 	define('SMF', 1);
25
+}
25 26
 
26 27
 require_once('Sources/Class-Package.php');
27 28
 
@@ -83,12 +84,14 @@  discard block
 block discarded – undo
83 84
 			$value = preg_replace('~[^A-Za-z0-9_\$]~', '', $value);
84 85
 
85 86
 			// Is it reserved?
86
-			if ($value == 'pg_')
87
-				return $txt['error_db_prefix_reserved'];
87
+			if ($value == 'pg_') {
88
+							return $txt['error_db_prefix_reserved'];
89
+			}
88 90
 
89 91
 			// Is the prefix numeric?
90
-			if (preg_match('~^\d~', $value))
91
-				return $txt['error_db_prefix_numeric'];
92
+			if (preg_match('~^\d~', $value)) {
93
+							return $txt['error_db_prefix_numeric'];
94
+			}
92 95
 
93 96
 			return true;
94 97
 		},
@@ -135,10 +138,11 @@  discard block
 block discarded – undo
135 138
 		$incontext['skip'] = false;
136 139
 
137 140
 		// Call the step and if it returns false that means pause!
138
-		if (function_exists($step[2]) && $step[2]() === false)
139
-			break;
140
-		elseif (function_exists($step[2]))
141
-			$incontext['current_step']++;
141
+		if (function_exists($step[2]) && $step[2]() === false) {
142
+					break;
143
+		} elseif (function_exists($step[2])) {
144
+					$incontext['current_step']++;
145
+		}
142 146
 
143 147
 		// No warnings pass on.
144 148
 		$incontext['warning'] = '';
@@ -154,12 +158,14 @@  discard block
 block discarded – undo
154 158
 	global $databases, $incontext;
155 159
 
156 160
 	// Just so people using older versions of PHP aren't left in the cold.
157
-	if (!isset($_SERVER['PHP_SELF']))
158
-		$_SERVER['PHP_SELF'] = isset($GLOBALS['HTTP_SERVER_VARS']['PHP_SELF']) ? $GLOBALS['HTTP_SERVER_VARS']['PHP_SELF'] : 'install.php';
161
+	if (!isset($_SERVER['PHP_SELF'])) {
162
+			$_SERVER['PHP_SELF'] = isset($GLOBALS['HTTP_SERVER_VARS']['PHP_SELF']) ? $GLOBALS['HTTP_SERVER_VARS']['PHP_SELF'] : 'install.php';
163
+	}
159 164
 
160 165
 	// Turn off magic quotes runtime and enable error reporting.
161
-	if (function_exists('set_magic_quotes_runtime'))
162
-		@set_magic_quotes_runtime(0);
166
+	if (function_exists('set_magic_quotes_runtime')) {
167
+			@set_magic_quotes_runtime(0);
168
+	}
163 169
 	error_reporting(E_ALL);
164 170
 
165 171
 	// Fun.  Low PHP version...
@@ -173,21 +179,23 @@  discard block
 block discarded – undo
173 179
 	{
174 180
 		ob_start();
175 181
 
176
-		if (ini_get('session.save_handler') == 'user')
177
-			@ini_set('session.save_handler', 'files');
178
-		if (function_exists('session_start'))
179
-			@session_start();
180
-	}
181
-	else
182
+		if (ini_get('session.save_handler') == 'user') {
183
+					@ini_set('session.save_handler', 'files');
184
+		}
185
+		if (function_exists('session_start')) {
186
+					@session_start();
187
+		}
188
+	} else
182 189
 	{
183 190
 		ob_start('ob_gzhandler');
184 191
 
185
-		if (ini_get('session.save_handler') == 'user')
186
-			@ini_set('session.save_handler', 'files');
192
+		if (ini_get('session.save_handler') == 'user') {
193
+					@ini_set('session.save_handler', 'files');
194
+		}
187 195
 		session_start();
188 196
 
189
-		if (!headers_sent())
190
-			echo '<!DOCTYPE html>
197
+		if (!headers_sent()) {
198
+					echo '<!DOCTYPE html>
191 199
 <html>
192 200
 	<head>
193 201
 		<title>', htmlspecialchars($_GET['pass_string']), '</title>
@@ -196,6 +204,7 @@  discard block
 block discarded – undo
196 204
 		<strong>', htmlspecialchars($_GET['pass_string']), '</strong>
197 205
 	</body>
198 206
 </html>';
207
+		}
199 208
 		exit;
200 209
 	}
201 210
 
@@ -204,16 +213,18 @@  discard block
 block discarded – undo
204 213
 	{
205 214
 		$incontext['remote_files_available'] = false;
206 215
 		$test = @fsockopen('www.simplemachines.org', 80, $errno, $errstr, 1);
207
-		if ($test)
208
-			$incontext['remote_files_available'] = true;
216
+		if ($test) {
217
+					$incontext['remote_files_available'] = true;
218
+		}
209 219
 		@fclose($test);
210 220
 	}
211 221
 
212 222
 	// Add slashes, as long as they aren't already being added.
213
-	if (!function_exists('get_magic_quotes_gpc') || @get_magic_quotes_gpc() == 0)
214
-		foreach ($_POST as $k => $v)
223
+	if (!function_exists('get_magic_quotes_gpc') || @get_magic_quotes_gpc() == 0) {
224
+			foreach ($_POST as $k => $v)
215 225
 			if (strpos($k, 'password') === false && strpos($k, 'db_passwd') === false)
216 226
 				$_POST[$k] = addslashes($v);
227
+	}
217 228
 
218 229
 	// This is really quite simple; if ?delete is on the URL, delete the installer...
219 230
 	if (isset($_GET['delete']))
@@ -234,8 +245,7 @@  discard block
 block discarded – undo
234 245
 			$ftp->close();
235 246
 
236 247
 			unset($_SESSION['installer_temp_ftp']);
237
-		}
238
-		else
248
+		} else
239 249
 		{
240 250
 			@unlink(__FILE__);
241 251
 
@@ -276,8 +286,9 @@  discard block
 block discarded – undo
276 286
 		$dir = dir(dirname(__FILE__) . '/Themes/default/languages');
277 287
 		while ($entry = $dir->read())
278 288
 		{
279
-			if (substr($entry, 0, 8) == 'Install.' && substr($entry, -4) == '.php')
280
-				$incontext['detected_languages'][$entry] = ucfirst(substr($entry, 8, strlen($entry) - 12));
289
+			if (substr($entry, 0, 8) == 'Install.' && substr($entry, -4) == '.php') {
290
+							$incontext['detected_languages'][$entry] = ucfirst(substr($entry, 8, strlen($entry) - 12));
291
+			}
281 292
 		}
282 293
 		$dir->close();
283 294
 	}
@@ -312,10 +323,11 @@  discard block
 block discarded – undo
312 323
 	}
313 324
 
314 325
 	// Override the language file?
315
-	if (isset($_GET['lang_file']))
316
-		$_SESSION['installer_temp_lang'] = $_GET['lang_file'];
317
-	elseif (isset($GLOBALS['HTTP_GET_VARS']['lang_file']))
318
-		$_SESSION['installer_temp_lang'] = $GLOBALS['HTTP_GET_VARS']['lang_file'];
326
+	if (isset($_GET['lang_file'])) {
327
+			$_SESSION['installer_temp_lang'] = $_GET['lang_file'];
328
+	} elseif (isset($GLOBALS['HTTP_GET_VARS']['lang_file'])) {
329
+			$_SESSION['installer_temp_lang'] = $GLOBALS['HTTP_GET_VARS']['lang_file'];
330
+	}
319 331
 
320 332
 	// Make sure it exists, if it doesn't reset it.
321 333
 	if (!isset($_SESSION['installer_temp_lang']) || preg_match('~[^\\w_\\-.]~', $_SESSION['installer_temp_lang']) === 1 || !file_exists(dirname(__FILE__) . '/Themes/default/languages/' . $_SESSION['installer_temp_lang']))
@@ -324,8 +336,9 @@  discard block
 block discarded – undo
324 336
 		list ($_SESSION['installer_temp_lang']) = array_keys($incontext['detected_languages']);
325 337
 
326 338
 		// If we have english and some other language, use the other language.  We Americans hate english :P.
327
-		if ($_SESSION['installer_temp_lang'] == 'Install.english.php' && count($incontext['detected_languages']) > 1)
328
-			list (, $_SESSION['installer_temp_lang']) = array_keys($incontext['detected_languages']);
339
+		if ($_SESSION['installer_temp_lang'] == 'Install.english.php' && count($incontext['detected_languages']) > 1) {
340
+					list (, $_SESSION['installer_temp_lang']) = array_keys($incontext['detected_languages']);
341
+		}
329 342
 	}
330 343
 
331 344
 	// And now include the actual language file itself.
@@ -338,15 +351,18 @@  discard block
 block discarded – undo
338 351
 	global $db_prefix, $db_connection, $sourcedir;
339 352
 	global $smcFunc, $modSettings, $db_type, $db_name, $db_user, $db_persist;
340 353
 
341
-	if (empty($sourcedir))
342
-		$sourcedir = dirname(__FILE__) . '/Sources';
354
+	if (empty($sourcedir)) {
355
+			$sourcedir = dirname(__FILE__) . '/Sources';
356
+	}
343 357
 
344 358
 	// Need this to check whether we need the database password.
345 359
 	require(dirname(__FILE__) . '/Settings.php');
346
-	if (!defined('SMF'))
347
-		define('SMF', 1);
348
-	if (empty($smcFunc))
349
-		$smcFunc = array();
360
+	if (!defined('SMF')) {
361
+			define('SMF', 1);
362
+	}
363
+	if (empty($smcFunc)) {
364
+			$smcFunc = array();
365
+	}
350 366
 
351 367
 	$modSettings['disableQueryCheck'] = true;
352 368
 
@@ -354,8 +370,9 @@  discard block
 block discarded – undo
354 370
 	if (!$db_connection)
355 371
 	{
356 372
 		require_once($sourcedir . '/Subs-Db-' . $db_type . '.php');
357
-		if (version_compare(PHP_VERSION, '5', '<'))
358
-			require_once($sourcedir . '/Subs-Compat.php');
373
+		if (version_compare(PHP_VERSION, '5', '<')) {
374
+					require_once($sourcedir . '/Subs-Compat.php');
375
+		}
359 376
 
360 377
 		$db_options = array('persist' => $db_persist);
361 378
 		$port = '';
@@ -366,19 +383,20 @@  discard block
 block discarded – undo
366 383
 			if ($db_type == 'mysql' || $db_type == 'mysqli')
367 384
 			{
368 385
 				$port = ((int) $_POST['db_port'] == ini_get($db_type . 'default_port')) ? '' : (int) $_POST['db_port'];
369
-			}
370
-			elseif ($db_type == 'postgresql')
386
+			} elseif ($db_type == 'postgresql')
371 387
 			{
372 388
 				// PostgreSQL doesn't have a default port setting in php.ini, so just check against the default
373 389
 				$port = ((int) $_POST['db_port'] == 5432) ? '' : (int) $_POST['db_port'];
374 390
 			}
375 391
 		}
376 392
 
377
-		if (!empty($port))
378
-			$db_options['port'] = $port;
393
+		if (!empty($port)) {
394
+					$db_options['port'] = $port;
395
+		}
379 396
 
380
-		if (!$db_connection)
381
-			$db_connection = smf_db_initiate($db_server, $db_name, $db_user, $db_passwd, $db_prefix, $db_options);
397
+		if (!$db_connection) {
398
+					$db_connection = smf_db_initiate($db_server, $db_name, $db_user, $db_passwd, $db_prefix, $db_options);
399
+		}
382 400
 	}
383 401
 }
384 402
 
@@ -406,8 +424,9 @@  discard block
 block discarded – undo
406 424
 		// @todo REMOVE THIS!!
407 425
 		else
408 426
 		{
409
-			if (function_exists('doStep' . $_GET['step']))
410
-				call_user_func('doStep' . $_GET['step']);
427
+			if (function_exists('doStep' . $_GET['step'])) {
428
+							call_user_func('doStep' . $_GET['step']);
429
+			}
411 430
 		}
412 431
 		// Show the footer.
413 432
 		template_install_below();
@@ -425,8 +444,9 @@  discard block
 block discarded – undo
425 444
 	$incontext['sub_template'] = 'welcome_message';
426 445
 
427 446
 	// Done the submission?
428
-	if (isset($_POST['contbutt']))
429
-		return true;
447
+	if (isset($_POST['contbutt'])) {
448
+			return true;
449
+	}
430 450
 
431 451
 	// See if we think they have already installed it?
432 452
 	if (is_readable(dirname(__FILE__) . '/Settings.php'))
@@ -434,14 +454,17 @@  discard block
 block discarded – undo
434 454
 		$probably_installed = 0;
435 455
 		foreach (file(dirname(__FILE__) . '/Settings.php') as $line)
436 456
 		{
437
-			if (preg_match('~^\$db_passwd\s=\s\'([^\']+)\';$~', $line))
438
-				$probably_installed++;
439
-			if (preg_match('~^\$boardurl\s=\s\'([^\']+)\';~', $line) && !preg_match('~^\$boardurl\s=\s\'http://127\.0\.0\.1/smf\';~', $line))
440
-				$probably_installed++;
457
+			if (preg_match('~^\$db_passwd\s=\s\'([^\']+)\';$~', $line)) {
458
+							$probably_installed++;
459
+			}
460
+			if (preg_match('~^\$boardurl\s=\s\'([^\']+)\';~', $line) && !preg_match('~^\$boardurl\s=\s\'http://127\.0\.0\.1/smf\';~', $line)) {
461
+							$probably_installed++;
462
+			}
441 463
 		}
442 464
 
443
-		if ($probably_installed == 2)
444
-			$incontext['warning'] = $txt['error_already_installed'];
465
+		if ($probably_installed == 2) {
466
+					$incontext['warning'] = $txt['error_already_installed'];
467
+		}
445 468
 	}
446 469
 
447 470
 	// Is some database support even compiled in?
@@ -456,8 +479,7 @@  discard block
 block discarded – undo
456 479
 				$databases[$key]['supported'] = false;
457 480
 				$notFoundSQLFile = true;
458 481
 				$txt['error_db_script_missing'] = sprintf($txt['error_db_script_missing'], 'install_' . $GLOBALS['db_script_version'] . '_' . $type . '.sql');
459
-			}
460
-			else
482
+			} else
461 483
 			{
462 484
 				$db_type = $key;
463 485
 				$incontext['supported_databases'][] = $db;
@@ -466,29 +488,36 @@  discard block
 block discarded – undo
466 488
 	}
467 489
 
468 490
 	// Check the PHP version.
469
-	if ((!function_exists('version_compare') || version_compare($GLOBALS['required_php_version'], PHP_VERSION, '>')))
470
-		$error = 'error_php_too_low';
491
+	if ((!function_exists('version_compare') || version_compare($GLOBALS['required_php_version'], PHP_VERSION, '>'))) {
492
+			$error = 'error_php_too_low';
493
+	}
471 494
 	// Make sure we have a supported database
472
-	elseif (empty($incontext['supported_databases']))
473
-		$error = empty($notFoundSQLFile) ? 'error_db_missing' : 'error_db_script_missing';
495
+	elseif (empty($incontext['supported_databases'])) {
496
+			$error = empty($notFoundSQLFile) ? 'error_db_missing' : 'error_db_script_missing';
497
+	}
474 498
 	// How about session support?  Some crazy sysadmin remove it?
475
-	elseif (!function_exists('session_start'))
476
-		$error = 'error_session_missing';
499
+	elseif (!function_exists('session_start')) {
500
+			$error = 'error_session_missing';
501
+	}
477 502
 	// Make sure they uploaded all the files.
478
-	elseif (!file_exists(dirname(__FILE__) . '/index.php'))
479
-		$error = 'error_missing_files';
503
+	elseif (!file_exists(dirname(__FILE__) . '/index.php')) {
504
+			$error = 'error_missing_files';
505
+	}
480 506
 	// Very simple check on the session.save_path for Windows.
481 507
 	// @todo Move this down later if they don't use database-driven sessions?
482
-	elseif (@ini_get('session.save_path') == '/tmp' && substr(__FILE__, 1, 2) == ':\\')
483
-		$error = 'error_session_save_path';
508
+	elseif (@ini_get('session.save_path') == '/tmp' && substr(__FILE__, 1, 2) == ':\\') {
509
+			$error = 'error_session_save_path';
510
+	}
484 511
 
485 512
 	// Since each of the three messages would look the same, anyway...
486
-	if (isset($error))
487
-		$incontext['error'] = $txt[$error];
513
+	if (isset($error)) {
514
+			$incontext['error'] = $txt[$error];
515
+	}
488 516
 
489 517
 	// Mod_security blocks everything that smells funny. Let SMF handle security.
490
-	if (!fixModSecurity() && !isset($_GET['overmodsecurity']))
491
-		$incontext['error'] = $txt['error_mod_security'] . '<br><br><a href="' . $installurl . '?overmodsecurity=true">' . $txt['error_message_click'] . '</a> ' . $txt['error_message_bad_try_again'];
518
+	if (!fixModSecurity() && !isset($_GET['overmodsecurity'])) {
519
+			$incontext['error'] = $txt['error_mod_security'] . '<br><br><a href="' . $installurl . '?overmodsecurity=true">' . $txt['error_message_click'] . '</a> ' . $txt['error_message_bad_try_again'];
520
+	}
492 521
 
493 522
 	return false;
494 523
 }
@@ -511,15 +540,18 @@  discard block
 block discarded – undo
511 540
 		'agreement.txt',
512 541
 		'Settings.php'
513 542
 	);
514
-	if (file_exists(dirname(__FILE__) . '/Settings_bak.php'))
515
-		$writable_files[] = 'Settings_bak.php';
543
+	if (file_exists(dirname(__FILE__) . '/Settings_bak.php')) {
544
+			$writable_files[] = 'Settings_bak.php';
545
+	}
516 546
 
517
-	foreach ($incontext['detected_languages'] as $lang => $temp)
518
-		$extra_files[] = 'Themes/default/languages/' . $lang;
547
+	foreach ($incontext['detected_languages'] as $lang => $temp) {
548
+			$extra_files[] = 'Themes/default/languages/' . $lang;
549
+	}
519 550
 
520 551
 	// With mod_security installed, we could attempt to fix it with .htaccess.
521
-	if (function_exists('apache_get_modules') && in_array('mod_security', apache_get_modules()))
522
-		$writable_files[] = file_exists(dirname(__FILE__) . '/.htaccess') ? '.htaccess' : '.';
552
+	if (function_exists('apache_get_modules') && in_array('mod_security', apache_get_modules())) {
553
+			$writable_files[] = file_exists(dirname(__FILE__) . '/.htaccess') ? '.htaccess' : '.';
554
+	}
523 555
 
524 556
 	$failed_files = array();
525 557
 
@@ -535,12 +567,14 @@  discard block
 block discarded – undo
535 567
 				@chmod(dirname(__FILE__) . '/' . $file, 0755);
536 568
 
537 569
 				// Well, 755 hopefully worked... if not, try 777.
538
-				if (!is_writable(dirname(__FILE__) . '/' . $file) && !@chmod(dirname(__FILE__) . '/' . $file, 0777))
539
-					$failed_files[] = $file;
570
+				if (!is_writable(dirname(__FILE__) . '/' . $file) && !@chmod(dirname(__FILE__) . '/' . $file, 0777)) {
571
+									$failed_files[] = $file;
572
+				}
540 573
 			}
541 574
 		}
542
-		foreach ($extra_files as $file)
543
-			@chmod(dirname(__FILE__) . (empty($file) ? '' : '/' . $file), 0777);
575
+		foreach ($extra_files as $file) {
576
+					@chmod(dirname(__FILE__) . (empty($file) ? '' : '/' . $file), 0777);
577
+		}
544 578
 	}
545 579
 	// Windows is trickier.  Let's try opening for r+...
546 580
 	else
@@ -550,30 +584,35 @@  discard block
 block discarded – undo
550 584
 		foreach ($writable_files as $file)
551 585
 		{
552 586
 			// Folders can't be opened for write... but the index.php in them can ;)
553
-			if (is_dir(dirname(__FILE__) . '/' . $file))
554
-				$file .= '/index.php';
587
+			if (is_dir(dirname(__FILE__) . '/' . $file)) {
588
+							$file .= '/index.php';
589
+			}
555 590
 
556 591
 			// Funny enough, chmod actually does do something on windows - it removes the read only attribute.
557 592
 			@chmod(dirname(__FILE__) . '/' . $file, 0777);
558 593
 			$fp = @fopen(dirname(__FILE__) . '/' . $file, 'r+');
559 594
 
560 595
 			// Hmm, okay, try just for write in that case...
561
-			if (!is_resource($fp))
562
-				$fp = @fopen(dirname(__FILE__) . '/' . $file, 'w');
596
+			if (!is_resource($fp)) {
597
+							$fp = @fopen(dirname(__FILE__) . '/' . $file, 'w');
598
+			}
563 599
 
564
-			if (!is_resource($fp))
565
-				$failed_files[] = $file;
600
+			if (!is_resource($fp)) {
601
+							$failed_files[] = $file;
602
+			}
566 603
 
567 604
 			@fclose($fp);
568 605
 		}
569
-		foreach ($extra_files as $file)
570
-			@chmod(dirname(__FILE__) . (empty($file) ? '' : '/' . $file), 0777);
606
+		foreach ($extra_files as $file) {
607
+					@chmod(dirname(__FILE__) . (empty($file) ? '' : '/' . $file), 0777);
608
+		}
571 609
 	}
572 610
 
573 611
 	$failure = count($failed_files) >= 1;
574 612
 
575
-	if (!isset($_SERVER))
576
-		return !$failure;
613
+	if (!isset($_SERVER)) {
614
+			return !$failure;
615
+	}
577 616
 
578 617
 	// Put the list into context.
579 618
 	$incontext['failed_files'] = $failed_files;
@@ -621,19 +660,23 @@  discard block
 block discarded – undo
621 660
 
622 661
 		if (!isset($ftp) || $ftp->error !== false)
623 662
 		{
624
-			if (!isset($ftp))
625
-				$ftp = new ftp_connection(null);
663
+			if (!isset($ftp)) {
664
+							$ftp = new ftp_connection(null);
665
+			}
626 666
 			// Save the error so we can mess with listing...
627
-			elseif ($ftp->error !== false && empty($incontext['ftp_errors']) && !empty($ftp->last_message))
628
-				$incontext['ftp_errors'][] = $ftp->last_message;
667
+			elseif ($ftp->error !== false && empty($incontext['ftp_errors']) && !empty($ftp->last_message)) {
668
+							$incontext['ftp_errors'][] = $ftp->last_message;
669
+			}
629 670
 
630 671
 			list ($username, $detect_path, $found_path) = $ftp->detect_path(dirname(__FILE__));
631 672
 
632
-			if (empty($_POST['ftp_path']) && $found_path)
633
-				$_POST['ftp_path'] = $detect_path;
673
+			if (empty($_POST['ftp_path']) && $found_path) {
674
+							$_POST['ftp_path'] = $detect_path;
675
+			}
634 676
 
635
-			if (!isset($_POST['ftp_username']))
636
-				$_POST['ftp_username'] = $username;
677
+			if (!isset($_POST['ftp_username'])) {
678
+							$_POST['ftp_username'] = $username;
679
+			}
637 680
 
638 681
 			// Set the username etc, into context.
639 682
 			$incontext['ftp'] = array(
@@ -645,8 +688,7 @@  discard block
 block discarded – undo
645 688
 			);
646 689
 
647 690
 			return false;
648
-		}
649
-		else
691
+		} else
650 692
 		{
651 693
 			$_SESSION['installer_temp_ftp'] = array(
652 694
 				'server' => $_POST['ftp_server'],
@@ -660,10 +702,12 @@  discard block
 block discarded – undo
660 702
 
661 703
 			foreach ($failed_files as $file)
662 704
 			{
663
-				if (!is_writable(dirname(__FILE__) . '/' . $file))
664
-					$ftp->chmod($file, 0755);
665
-				if (!is_writable(dirname(__FILE__) . '/' . $file))
666
-					$ftp->chmod($file, 0777);
705
+				if (!is_writable(dirname(__FILE__) . '/' . $file)) {
706
+									$ftp->chmod($file, 0755);
707
+				}
708
+				if (!is_writable(dirname(__FILE__) . '/' . $file)) {
709
+									$ftp->chmod($file, 0777);
710
+				}
667 711
 				if (!is_writable(dirname(__FILE__) . '/' . $file))
668 712
 				{
669 713
 					$failed_files_updated[] = $file;
@@ -718,15 +762,17 @@  discard block
 block discarded – undo
718 762
 
719 763
 			if (!$foundOne)
720 764
 			{
721
-				if (isset($db['default_host']))
722
-					$incontext['db']['server'] = ini_get($db['default_host']) or $incontext['db']['server'] = 'localhost';
765
+				if (isset($db['default_host'])) {
766
+									$incontext['db']['server'] = ini_get($db['default_host']) or $incontext['db']['server'] = 'localhost';
767
+				}
723 768
 				if (isset($db['default_user']))
724 769
 				{
725 770
 					$incontext['db']['user'] = ini_get($db['default_user']);
726 771
 					$incontext['db']['name'] = ini_get($db['default_user']);
727 772
 				}
728
-				if (isset($db['default_password']))
729
-					$incontext['db']['pass'] = ini_get($db['default_password']);
773
+				if (isset($db['default_password'])) {
774
+									$incontext['db']['pass'] = ini_get($db['default_password']);
775
+				}
730 776
 
731 777
 				// For simplicity and less confusion, leave the port blank by default
732 778
 				$incontext['db']['port'] = '';
@@ -745,10 +791,10 @@  discard block
 block discarded – undo
745 791
 		$incontext['db']['server'] = $_POST['db_server'];
746 792
 		$incontext['db']['prefix'] = $_POST['db_prefix'];
747 793
 
748
-		if (!empty($_POST['db_port']))
749
-			$incontext['db']['port'] = $_POST['db_port'];
750
-	}
751
-	else
794
+		if (!empty($_POST['db_port'])) {
795
+					$incontext['db']['port'] = $_POST['db_port'];
796
+		}
797
+	} else
752 798
 	{
753 799
 		$incontext['db']['prefix'] = 'smf_';
754 800
 	}
@@ -784,10 +830,11 @@  discard block
 block discarded – undo
784 830
 		if (!empty($_POST['db_port']))
785 831
 		{
786 832
 			// For MySQL, we can get the "default port" from PHP. PostgreSQL has no such option though.
787
-			if (($db_type == 'mysql' || $db_type == 'mysqli') && $_POST['db_port'] != ini_get($db_type . '.default_port'))
788
-				$vars['db_port'] = (int) $_POST['db_port'];
789
-			elseif ($db_type == 'postgresql' && $_POST['db_port'] != 5432)
790
-				$vars['db_port'] = (int) $_POST['db_port'];
833
+			if (($db_type == 'mysql' || $db_type == 'mysqli') && $_POST['db_port'] != ini_get($db_type . '.default_port')) {
834
+							$vars['db_port'] = (int) $_POST['db_port'];
835
+			} elseif ($db_type == 'postgresql' && $_POST['db_port'] != 5432) {
836
+							$vars['db_port'] = (int) $_POST['db_port'];
837
+			}
791 838
 		}
792 839
 
793 840
 		// God I hope it saved!
@@ -800,8 +847,9 @@  discard block
 block discarded – undo
800 847
 		// Make sure it works.
801 848
 		require(dirname(__FILE__) . '/Settings.php');
802 849
 
803
-		if (empty($sourcedir))
804
-			$sourcedir = dirname(__FILE__) . '/Sources';
850
+		if (empty($sourcedir)) {
851
+					$sourcedir = dirname(__FILE__) . '/Sources';
852
+		}
805 853
 
806 854
 		// Better find the database file!
807 855
 		if (!file_exists($sourcedir . '/Subs-Db-' . $db_type . '.php'))
@@ -811,18 +859,21 @@  discard block
 block discarded – undo
811 859
 		}
812 860
 
813 861
 		// Now include it for database functions!
814
-		if (!defined('SMF'))
815
-			define('SMF', 1);
862
+		if (!defined('SMF')) {
863
+					define('SMF', 1);
864
+		}
816 865
 
817 866
 		$modSettings['disableQueryCheck'] = true;
818
-		if (empty($smcFunc))
819
-			$smcFunc = array();
867
+		if (empty($smcFunc)) {
868
+					$smcFunc = array();
869
+		}
820 870
 
821 871
 			require_once($sourcedir . '/Subs-Db-' . $db_type . '.php');
822 872
 
823 873
 		// What - running PHP4? The shame!
824
-		if (version_compare(PHP_VERSION, '5', '<'))
825
-			require_once($sourcedir . '/Subs-Compat.php');
874
+		if (version_compare(PHP_VERSION, '5', '<')) {
875
+					require_once($sourcedir . '/Subs-Compat.php');
876
+		}
826 877
 
827 878
 		// Attempt a connection.
828 879
 		$needsDB = !empty($databases[$db_type]['always_has_db']);
@@ -910,12 +961,14 @@  discard block
 block discarded – undo
910 961
 	$incontext['page_title'] = $txt['install_settings'];
911 962
 
912 963
 	// Let's see if we got the database type correct.
913
-	if (isset($_POST['db_type'], $databases[$_POST['db_type']]))
914
-		$db_type = $_POST['db_type'];
964
+	if (isset($_POST['db_type'], $databases[$_POST['db_type']])) {
965
+			$db_type = $_POST['db_type'];
966
+	}
915 967
 
916 968
 	// Else we'd better be able to get the connection.
917
-	else
918
-		load_database();
969
+	else {
970
+			load_database();
971
+	}
919 972
 
920 973
 	$db_type = isset($_POST['db_type']) ? $_POST['db_type'] : $db_type;
921 974
 
@@ -935,12 +988,14 @@  discard block
 block discarded – undo
935 988
 	// Submitting?
936 989
 	if (isset($_POST['boardurl']))
937 990
 	{
938
-		if (substr($_POST['boardurl'], -10) == '/index.php')
939
-			$_POST['boardurl'] = substr($_POST['boardurl'], 0, -10);
940
-		elseif (substr($_POST['boardurl'], -1) == '/')
941
-			$_POST['boardurl'] = substr($_POST['boardurl'], 0, -1);
942
-		if (substr($_POST['boardurl'], 0, 7) != 'http://' && substr($_POST['boardurl'], 0, 7) != 'file://' && substr($_POST['boardurl'], 0, 8) != 'https://')
943
-			$_POST['boardurl'] = 'http://' . $_POST['boardurl'];
991
+		if (substr($_POST['boardurl'], -10) == '/index.php') {
992
+					$_POST['boardurl'] = substr($_POST['boardurl'], 0, -10);
993
+		} elseif (substr($_POST['boardurl'], -1) == '/') {
994
+					$_POST['boardurl'] = substr($_POST['boardurl'], 0, -1);
995
+		}
996
+		if (substr($_POST['boardurl'], 0, 7) != 'http://' && substr($_POST['boardurl'], 0, 7) != 'file://' && substr($_POST['boardurl'], 0, 8) != 'https://') {
997
+					$_POST['boardurl'] = 'http://' . $_POST['boardurl'];
998
+		}
944 999
 
945 1000
 		// Save these variables.
946 1001
 		$vars = array(
@@ -971,10 +1026,10 @@  discard block
 block discarded – undo
971 1026
 			{
972 1027
 				$incontext['error'] = sprintf($txt['error_utf8_version'], $databases[$db_type]['utf8_version']);
973 1028
 				return false;
974
-			}
975
-			else
976
-				// Set the character set here.
1029
+			} else {
1030
+							// Set the character set here.
977 1031
 				updateSettingsFile(array('db_character_set' => 'utf8'));
1032
+			}
978 1033
 		}
979 1034
 
980 1035
 		// Good, skip on.
@@ -994,8 +1049,9 @@  discard block
 block discarded – undo
994 1049
 	$incontext['continue'] = 1;
995 1050
 
996 1051
 	// Already done?
997
-	if (isset($_POST['pop_done']))
998
-		return true;
1052
+	if (isset($_POST['pop_done'])) {
1053
+			return true;
1054
+	}
999 1055
 
1000 1056
 	// Reload settings.
1001 1057
 	require(dirname(__FILE__) . '/Settings.php');
@@ -1013,8 +1069,9 @@  discard block
 block discarded – undo
1013 1069
 	$modSettings = array();
1014 1070
 	if ($result !== false)
1015 1071
 	{
1016
-		while ($row = $smcFunc['db_fetch_assoc']($result))
1017
-			$modSettings[$row['variable']] = $row['value'];
1072
+		while ($row = $smcFunc['db_fetch_assoc']($result)) {
1073
+					$modSettings[$row['variable']] = $row['value'];
1074
+		}
1018 1075
 		$smcFunc['db_free_result']($result);
1019 1076
 
1020 1077
 		// Do they match?  If so, this is just a refresh so charge on!
@@ -1027,20 +1084,22 @@  discard block
 block discarded – undo
1027 1084
 	$modSettings['disableQueryCheck'] = true;
1028 1085
 
1029 1086
 	// If doing UTF8, select it. PostgreSQL requires passing it as a string...
1030
-	if (!empty($db_character_set) && $db_character_set == 'utf8' && !empty($databases[$db_type]['utf8_support']))
1031
-		$smcFunc['db_query']('', '
1087
+	if (!empty($db_character_set) && $db_character_set == 'utf8' && !empty($databases[$db_type]['utf8_support'])) {
1088
+			$smcFunc['db_query']('', '
1032 1089
 			SET NAMES {string:utf8}',
1033 1090
 			array(
1034 1091
 				'db_error_skip' => true,
1035 1092
 				'utf8' => 'utf8',
1036 1093
 			)
1037 1094
 		);
1095
+	}
1038 1096
 
1039 1097
 	// Windows likes to leave the trailing slash, which yields to C:\path\to\SMF\/attachments...
1040
-	if (substr(__DIR__, -1) == '\\')
1041
-		$attachdir = __DIR__ . 'attachments';
1042
-	else
1043
-		$attachdir = __DIR__ . '/attachments';
1098
+	if (substr(__DIR__, -1) == '\\') {
1099
+			$attachdir = __DIR__ . 'attachments';
1100
+	} else {
1101
+			$attachdir = __DIR__ . '/attachments';
1102
+	}
1044 1103
 
1045 1104
 	$replaces = array(
1046 1105
 		'{$db_prefix}' => $db_prefix,
@@ -1057,8 +1116,9 @@  discard block
 block discarded – undo
1057 1116
 
1058 1117
 	foreach ($txt as $key => $value)
1059 1118
 	{
1060
-		if (substr($key, 0, 8) == 'default_')
1061
-			$replaces['{$' . $key . '}'] = $smcFunc['db_escape_string']($value);
1119
+		if (substr($key, 0, 8) == 'default_') {
1120
+					$replaces['{$' . $key . '}'] = $smcFunc['db_escape_string']($value);
1121
+		}
1062 1122
 	}
1063 1123
 	$replaces['{$default_reserved_names}'] = strtr($replaces['{$default_reserved_names}'], array('\\\\n' => '\\n'));
1064 1124
 
@@ -1073,8 +1133,9 @@  discard block
 block discarded – undo
1073 1133
 
1074 1134
 		while ($row = $smcFunc['db_fetch_assoc']($get_engines))
1075 1135
 		{
1076
-			if ($row['Support'] == 'YES' || $row['Support'] == 'DEFAULT')
1077
-				$engines[] = $row['Engine'];
1136
+			if ($row['Support'] == 'YES' || $row['Support'] == 'DEFAULT') {
1137
+							$engines[] = $row['Engine'];
1138
+			}
1078 1139
 		}
1079 1140
 
1080 1141
 		// Done with this now
@@ -1098,8 +1159,7 @@  discard block
 block discarded – undo
1098 1159
 			$replaces['START TRANSACTION;'] = '';
1099 1160
 			$replaces['COMMIT;'] = '';
1100 1161
 		}
1101
-	}
1102
-	else
1162
+	} else
1103 1163
 	{
1104 1164
 		$has_innodb = false;
1105 1165
 	}
@@ -1121,21 +1181,24 @@  discard block
 block discarded – undo
1121 1181
 	foreach ($sql_lines as $count => $line)
1122 1182
 	{
1123 1183
 		// No comments allowed!
1124
-		if (substr(trim($line), 0, 1) != '#')
1125
-			$current_statement .= "\n" . rtrim($line);
1184
+		if (substr(trim($line), 0, 1) != '#') {
1185
+					$current_statement .= "\n" . rtrim($line);
1186
+		}
1126 1187
 
1127 1188
 		// Is this the end of the query string?
1128
-		if (empty($current_statement) || (preg_match('~;[\s]*$~s', $line) == 0 && $count != count($sql_lines)))
1129
-			continue;
1189
+		if (empty($current_statement) || (preg_match('~;[\s]*$~s', $line) == 0 && $count != count($sql_lines))) {
1190
+					continue;
1191
+		}
1130 1192
 
1131 1193
 		// Does this table already exist?  If so, don't insert more data into it!
1132 1194
 		if (preg_match('~^\s*INSERT INTO ([^\s\n\r]+?)~', $current_statement, $match) != 0 && in_array($match[1], $exists))
1133 1195
 		{
1134 1196
 			preg_match_all('~\)[,;]~', $current_statement, $matches);
1135
-			if (!empty($matches[0]))
1136
-				$incontext['sql_results']['insert_dups'] += count($matches[0]);
1137
-			else
1138
-				$incontext['sql_results']['insert_dups']++;
1197
+			if (!empty($matches[0])) {
1198
+							$incontext['sql_results']['insert_dups'] += count($matches[0]);
1199
+			} else {
1200
+							$incontext['sql_results']['insert_dups']++;
1201
+			}
1139 1202
 
1140 1203
 			$current_statement = '';
1141 1204
 			continue;
@@ -1144,8 +1207,9 @@  discard block
 block discarded – undo
1144 1207
 		if ($smcFunc['db_query']('', $current_statement, array('security_override' => true, 'db_error_skip' => true), $db_connection) === false)
1145 1208
 		{
1146 1209
 			// Use the appropriate function based on the DB type
1147
-			if ($db_type == 'mysql' || $db_type =='mysqli')
1148
-				$db_errorno = $db_type . '_errno';
1210
+			if ($db_type == 'mysql' || $db_type =='mysqli') {
1211
+							$db_errorno = $db_type . '_errno';
1212
+			}
1149 1213
 
1150 1214
 			// Error 1050: Table already exists!
1151 1215
 			// @todo Needs to be made better!
@@ -1160,18 +1224,18 @@  discard block
 block discarded – undo
1160 1224
 				// MySQLi requires a connection object. It's optional with MySQL and Postgres
1161 1225
 				$incontext['failures'][$count] = $smcFunc['db_error']($db_connection);
1162 1226
 			}
1163
-		}
1164
-		else
1227
+		} else
1165 1228
 		{
1166
-			if (preg_match('~^\s*CREATE TABLE ([^\s\n\r]+?)~', $current_statement, $match) == 1)
1167
-				$incontext['sql_results']['tables']++;
1168
-			elseif (preg_match('~^\s*INSERT INTO ([^\s\n\r]+?)~', $current_statement, $match) == 1)
1229
+			if (preg_match('~^\s*CREATE TABLE ([^\s\n\r]+?)~', $current_statement, $match) == 1) {
1230
+							$incontext['sql_results']['tables']++;
1231
+			} elseif (preg_match('~^\s*INSERT INTO ([^\s\n\r]+?)~', $current_statement, $match) == 1)
1169 1232
 			{
1170 1233
 				preg_match_all('~\)[,;]~', $current_statement, $matches);
1171
-				if (!empty($matches[0]))
1172
-					$incontext['sql_results']['inserts'] += count($matches[0]);
1173
-				else
1174
-					$incontext['sql_results']['inserts']++;
1234
+				if (!empty($matches[0])) {
1235
+									$incontext['sql_results']['inserts'] += count($matches[0]);
1236
+				} else {
1237
+									$incontext['sql_results']['inserts']++;
1238
+				}
1175 1239
 			}
1176 1240
 		}
1177 1241
 
@@ -1184,15 +1248,17 @@  discard block
 block discarded – undo
1184 1248
 	// Sort out the context for the SQL.
1185 1249
 	foreach ($incontext['sql_results'] as $key => $number)
1186 1250
 	{
1187
-		if ($number == 0)
1188
-			unset($incontext['sql_results'][$key]);
1189
-		else
1190
-			$incontext['sql_results'][$key] = sprintf($txt['db_populate_' . $key], $number);
1251
+		if ($number == 0) {
1252
+					unset($incontext['sql_results'][$key]);
1253
+		} else {
1254
+					$incontext['sql_results'][$key] = sprintf($txt['db_populate_' . $key], $number);
1255
+		}
1191 1256
 	}
1192 1257
 
1193 1258
 	// Make sure UTF will be used globally.
1194
-	if ((!empty($databases[$db_type]['utf8_support']) && !empty($databases[$db_type]['utf8_required'])) || (empty($databases[$db_type]['utf8_required']) && !empty($databases[$db_type]['utf8_support']) && isset($_POST['utf8'])))
1195
-		$newSettings[] = array('global_character_set', 'UTF-8');
1259
+	if ((!empty($databases[$db_type]['utf8_support']) && !empty($databases[$db_type]['utf8_required'])) || (empty($databases[$db_type]['utf8_required']) && !empty($databases[$db_type]['utf8_support']) && isset($_POST['utf8']))) {
1260
+			$newSettings[] = array('global_character_set', 'UTF-8');
1261
+	}
1196 1262
 
1197 1263
 	// Maybe we can auto-detect better cookie settings?
1198 1264
 	preg_match('~^http[s]?://([^\.]+?)([^/]*?)(/.*)?$~', $boardurl, $matches);
@@ -1203,16 +1269,20 @@  discard block
 block discarded – undo
1203 1269
 		$globalCookies = false;
1204 1270
 
1205 1271
 		// Okay... let's see.  Using a subdomain other than www.? (not a perfect check.)
1206
-		if ($matches[2] != '' && (strpos(substr($matches[2], 1), '.') === false || in_array($matches[1], array('forum', 'board', 'community', 'forums', 'support', 'chat', 'help', 'talk', 'boards', 'www'))))
1207
-			$globalCookies = true;
1272
+		if ($matches[2] != '' && (strpos(substr($matches[2], 1), '.') === false || in_array($matches[1], array('forum', 'board', 'community', 'forums', 'support', 'chat', 'help', 'talk', 'boards', 'www')))) {
1273
+					$globalCookies = true;
1274
+		}
1208 1275
 		// If there's a / in the middle of the path, or it starts with ~... we want local.
1209
-		if (isset($matches[3]) && strlen($matches[3]) > 3 && (substr($matches[3], 0, 2) == '/~' || strpos(substr($matches[3], 1), '/') !== false))
1210
-			$localCookies = true;
1276
+		if (isset($matches[3]) && strlen($matches[3]) > 3 && (substr($matches[3], 0, 2) == '/~' || strpos(substr($matches[3], 1), '/') !== false)) {
1277
+					$localCookies = true;
1278
+		}
1211 1279
 
1212
-		if ($globalCookies)
1213
-			$newSettings[] = array('globalCookies', '1');
1214
-		if ($localCookies)
1215
-			$newSettings[] = array('localCookies', '1');
1280
+		if ($globalCookies) {
1281
+					$newSettings[] = array('globalCookies', '1');
1282
+		}
1283
+		if ($localCookies) {
1284
+					$newSettings[] = array('localCookies', '1');
1285
+		}
1216 1286
 	}
1217 1287
 
1218 1288
 	// Are we allowing stat collection?
@@ -1228,30 +1298,34 @@  discard block
 block discarded – undo
1228 1298
 			fwrite($fp, $out);
1229 1299
 
1230 1300
 			$return_data = '';
1231
-			while (!feof($fp))
1232
-				$return_data .= fgets($fp, 128);
1301
+			while (!feof($fp)) {
1302
+							$return_data .= fgets($fp, 128);
1303
+			}
1233 1304
 
1234 1305
 			fclose($fp);
1235 1306
 
1236 1307
 			// Get the unique site ID.
1237 1308
 			preg_match('~SITE-ID:\s(\w{10})~', $return_data, $ID);
1238 1309
 
1239
-			if (!empty($ID[1]))
1240
-				$newSettings[] = array('allow_sm_stats', $ID[1]);
1310
+			if (!empty($ID[1])) {
1311
+							$newSettings[] = array('allow_sm_stats', $ID[1]);
1312
+			}
1241 1313
 		}
1242 1314
 	}
1243 1315
 
1244 1316
 	// Are we enabling SSL?
1245
-	if (!empty($_POST['force_ssl']))
1246
-		$newSettings[] = array('force_ssl', 2);
1317
+	if (!empty($_POST['force_ssl'])) {
1318
+			$newSettings[] = array('force_ssl', 2);
1319
+	}
1247 1320
 
1248 1321
 	// As of PHP 5.1, setting a timezone is required.
1249 1322
 	if (!isset($modSettings['default_timezone']) && function_exists('date_default_timezone_set'))
1250 1323
 	{
1251 1324
 		$server_offset = mktime(0, 0, 0, 1, 1, 1970);
1252 1325
 		$timezone_id = 'Etc/GMT' . ($server_offset > 0 ? '+' : '') . ($server_offset / 3600);
1253
-		if (date_default_timezone_set($timezone_id))
1254
-			$newSettings[] = array('default_timezone', $timezone_id);
1326
+		if (date_default_timezone_set($timezone_id)) {
1327
+					$newSettings[] = array('default_timezone', $timezone_id);
1328
+		}
1255 1329
 	}
1256 1330
 
1257 1331
 	if (!empty($newSettings))
@@ -1282,16 +1356,18 @@  discard block
 block discarded – undo
1282 1356
 	}
1283 1357
 
1284 1358
 	// MySQL specific stuff
1285
-	if (substr($db_type, 0, 5) != 'mysql')
1286
-		return false;
1359
+	if (substr($db_type, 0, 5) != 'mysql') {
1360
+			return false;
1361
+	}
1287 1362
 
1288 1363
 	// Find database user privileges.
1289 1364
 	$privs = array();
1290 1365
 	$get_privs = $smcFunc['db_query']('', 'SHOW PRIVILEGES', array());
1291 1366
 	while ($row = $smcFunc['db_fetch_assoc']($get_privs))
1292 1367
 	{
1293
-		if ($row['Privilege'] == 'Alter')
1294
-			$privs[] = $row['Privilege'];
1368
+		if ($row['Privilege'] == 'Alter') {
1369
+					$privs[] = $row['Privilege'];
1370
+		}
1295 1371
 	}
1296 1372
 	$smcFunc['db_free_result']($get_privs);
1297 1373
 
@@ -1321,8 +1397,9 @@  discard block
 block discarded – undo
1321 1397
 	$incontext['continue'] = 1;
1322 1398
 
1323 1399
 	// Skipping?
1324
-	if (!empty($_POST['skip']))
1325
-		return true;
1400
+	if (!empty($_POST['skip'])) {
1401
+			return true;
1402
+	}
1326 1403
 
1327 1404
 	// Need this to check whether we need the database password.
1328 1405
 	require(dirname(__FILE__) . '/Settings.php');
@@ -1336,18 +1413,22 @@  discard block
 block discarded – undo
1336 1413
 	$smcFunc['strtolower'] = $db_character_set != 'utf8' && $txt['lang_character_set'] != 'UTF-8' ? 'strtolower' :
1337 1414
 		function($string){
1338 1415
 			global $sourcedir;
1339
-			if (function_exists('mb_strtolower'))
1340
-				return mb_strtolower($string, 'UTF-8');
1416
+			if (function_exists('mb_strtolower')) {
1417
+							return mb_strtolower($string, 'UTF-8');
1418
+			}
1341 1419
 			require_once($sourcedir . '/Subs-Charset.php');
1342 1420
 			return utf8_strtolower($string);
1343 1421
 		};
1344 1422
 
1345
-	if (!isset($_POST['username']))
1346
-		$_POST['username'] = '';
1347
-	if (!isset($_POST['email']))
1348
-		$_POST['email'] = '';
1349
-	if (!isset($_POST['server_email']))
1350
-		$_POST['server_email'] = '';
1423
+	if (!isset($_POST['username'])) {
1424
+			$_POST['username'] = '';
1425
+	}
1426
+	if (!isset($_POST['email'])) {
1427
+			$_POST['email'] = '';
1428
+	}
1429
+	if (!isset($_POST['server_email'])) {
1430
+			$_POST['server_email'] = '';
1431
+	}
1351 1432
 
1352 1433
 	$incontext['username'] = htmlspecialchars(stripslashes($_POST['username']));
1353 1434
 	$incontext['email'] = htmlspecialchars(stripslashes($_POST['email']));
@@ -1366,8 +1447,9 @@  discard block
 block discarded – undo
1366 1447
 			'admin_group' => 1,
1367 1448
 		)
1368 1449
 	);
1369
-	if ($smcFunc['db_num_rows']($request) != 0)
1370
-		$incontext['skip'] = 1;
1450
+	if ($smcFunc['db_num_rows']($request) != 0) {
1451
+			$incontext['skip'] = 1;
1452
+	}
1371 1453
 	$smcFunc['db_free_result']($request);
1372 1454
 
1373 1455
 	// Trying to create an account?
@@ -1398,8 +1480,9 @@  discard block
 block discarded – undo
1398 1480
 		}
1399 1481
 
1400 1482
 		// Update the webmaster's email?
1401
-		if (!empty($_POST['server_email']) && (empty($webmaster_email) || $webmaster_email == '[email protected]'))
1402
-			updateSettingsFile(array('webmaster_email' => $_POST['server_email']));
1483
+		if (!empty($_POST['server_email']) && (empty($webmaster_email) || $webmaster_email == '[email protected]')) {
1484
+					updateSettingsFile(array('webmaster_email' => $_POST['server_email']));
1485
+		}
1403 1486
 
1404 1487
 		// Work out whether we're going to have dodgy characters and remove them.
1405 1488
 		$invalid_characters = preg_match('~[<>&"\'=\\\]~', $_POST['username']) != 0;
@@ -1422,32 +1505,27 @@  discard block
 block discarded – undo
1422 1505
 			$smcFunc['db_free_result']($result);
1423 1506
 
1424 1507
 			$incontext['account_existed'] = $txt['error_user_settings_taken'];
1425
-		}
1426
-		elseif ($_POST['username'] == '' || strlen($_POST['username']) > 25)
1508
+		} elseif ($_POST['username'] == '' || strlen($_POST['username']) > 25)
1427 1509
 		{
1428 1510
 			// Try the previous step again.
1429 1511
 			$incontext['error'] = $_POST['username'] == '' ? $txt['error_username_left_empty'] : $txt['error_username_too_long'];
1430 1512
 			return false;
1431
-		}
1432
-		elseif ($invalid_characters || $_POST['username'] == '_' || $_POST['username'] == '|' || strpos($_POST['username'], '[code') !== false || strpos($_POST['username'], '[/code') !== false)
1513
+		} elseif ($invalid_characters || $_POST['username'] == '_' || $_POST['username'] == '|' || strpos($_POST['username'], '[code') !== false || strpos($_POST['username'], '[/code') !== false)
1433 1514
 		{
1434 1515
 			// Try the previous step again.
1435 1516
 			$incontext['error'] = $txt['error_invalid_characters_username'];
1436 1517
 			return false;
1437
-		}
1438
-		elseif (empty($_POST['email']) || !filter_var(stripslashes($_POST['email']), FILTER_VALIDATE_EMAIL) || strlen(stripslashes($_POST['email'])) > 255)
1518
+		} elseif (empty($_POST['email']) || !filter_var(stripslashes($_POST['email']), FILTER_VALIDATE_EMAIL) || strlen(stripslashes($_POST['email'])) > 255)
1439 1519
 		{
1440 1520
 			// One step back, this time fill out a proper admin email address.
1441 1521
 			$incontext['error'] = sprintf($txt['error_valid_admin_email_needed'], $_POST['username']);
1442 1522
 			return false;
1443
-		}
1444
-		elseif (empty($_POST['server_email']) || !filter_var(stripslashes($_POST['server_email']), FILTER_VALIDATE_EMAIL) || strlen(stripslashes($_POST['server_email'])) > 255)
1523
+		} elseif (empty($_POST['server_email']) || !filter_var(stripslashes($_POST['server_email']), FILTER_VALIDATE_EMAIL) || strlen(stripslashes($_POST['server_email'])) > 255)
1445 1524
 		{
1446 1525
 			// One step back, this time fill out a proper admin email address.
1447 1526
 			$incontext['error'] = $txt['error_valid_server_email_needed'];
1448 1527
 			return false;
1449
-		}
1450
-		elseif ($_POST['username'] != '')
1528
+		} elseif ($_POST['username'] != '')
1451 1529
 		{
1452 1530
 			$incontext['member_salt'] = substr(md5(mt_rand()), 0, 4);
1453 1531
 
@@ -1522,17 +1600,19 @@  discard block
 block discarded – undo
1522 1600
 	require_once($sourcedir . '/Subs-Auth.php');
1523 1601
 
1524 1602
 	// Bring a warning over.
1525
-	if (!empty($incontext['account_existed']))
1526
-		$incontext['warning'] = $incontext['account_existed'];
1603
+	if (!empty($incontext['account_existed'])) {
1604
+			$incontext['warning'] = $incontext['account_existed'];
1605
+	}
1527 1606
 
1528
-	if (!empty($db_character_set) && !empty($databases[$db_type]['utf8_support']))
1529
-		$smcFunc['db_query']('', '
1607
+	if (!empty($db_character_set) && !empty($databases[$db_type]['utf8_support'])) {
1608
+			$smcFunc['db_query']('', '
1530 1609
 			SET NAMES {string:db_character_set}',
1531 1610
 			array(
1532 1611
 				'db_character_set' => $db_character_set,
1533 1612
 				'db_error_skip' => true,
1534 1613
 			)
1535 1614
 		);
1615
+	}
1536 1616
 
1537 1617
 	// As track stats is by default enabled let's add some activity.
1538 1618
 	$smcFunc['db_insert']('ignore',
@@ -1553,14 +1633,16 @@  discard block
 block discarded – undo
1553 1633
 	// Only proceed if we can load the data.
1554 1634
 	if ($request)
1555 1635
 	{
1556
-		while ($row = $smcFunc['db_fetch_row']($request))
1557
-			$modSettings[$row[0]] = $row[1];
1636
+		while ($row = $smcFunc['db_fetch_row']($request)) {
1637
+					$modSettings[$row[0]] = $row[1];
1638
+		}
1558 1639
 		$smcFunc['db_free_result']($request);
1559 1640
 	}
1560 1641
 
1561 1642
 	// Automatically log them in ;)
1562
-	if (isset($incontext['member_id']) && isset($incontext['member_salt']))
1563
-		setLoginCookie(3153600 * 60, $incontext['member_id'], hash_salt($_POST['password1'], $incontext['member_salt']));
1643
+	if (isset($incontext['member_id']) && isset($incontext['member_salt'])) {
1644
+			setLoginCookie(3153600 * 60, $incontext['member_id'], hash_salt($_POST['password1'], $incontext['member_salt']));
1645
+	}
1564 1646
 
1565 1647
 	$result = $smcFunc['db_query']('', '
1566 1648
 		SELECT value
@@ -1571,13 +1653,14 @@  discard block
 block discarded – undo
1571 1653
 			'db_error_skip' => true,
1572 1654
 		)
1573 1655
 	);
1574
-	if ($smcFunc['db_num_rows']($result) != 0)
1575
-		list ($db_sessions) = $smcFunc['db_fetch_row']($result);
1656
+	if ($smcFunc['db_num_rows']($result) != 0) {
1657
+			list ($db_sessions) = $smcFunc['db_fetch_row']($result);
1658
+	}
1576 1659
 	$smcFunc['db_free_result']($result);
1577 1660
 
1578
-	if (empty($db_sessions))
1579
-		$_SESSION['admin_time'] = time();
1580
-	else
1661
+	if (empty($db_sessions)) {
1662
+			$_SESSION['admin_time'] = time();
1663
+	} else
1581 1664
 	{
1582 1665
 		$_SERVER['HTTP_USER_AGENT'] = substr($_SERVER['HTTP_USER_AGENT'], 0, 211);
1583 1666
 
@@ -1601,8 +1684,9 @@  discard block
 block discarded – undo
1601 1684
 	$smcFunc['strtolower'] = $db_character_set != 'utf8' && $txt['lang_character_set'] != 'UTF-8' ? 'strtolower' :
1602 1685
 		function($string){
1603 1686
 			global $sourcedir;
1604
-			if (function_exists('mb_strtolower'))
1605
-				return mb_strtolower($string, 'UTF-8');
1687
+			if (function_exists('mb_strtolower')) {
1688
+							return mb_strtolower($string, 'UTF-8');
1689
+			}
1606 1690
 			require_once($sourcedir . '/Subs-Charset.php');
1607 1691
 			return utf8_strtolower($string);
1608 1692
 		};
@@ -1618,8 +1702,9 @@  discard block
 block discarded – undo
1618 1702
 		)
1619 1703
 	);
1620 1704
 	$context['utf8'] = $db_character_set === 'utf8' || $txt['lang_character_set'] === 'UTF-8';
1621
-	if ($smcFunc['db_num_rows']($request) > 0)
1622
-		updateStats('subject', 1, htmlspecialchars($txt['default_topic_subject']));
1705
+	if ($smcFunc['db_num_rows']($request) > 0) {
1706
+			updateStats('subject', 1, htmlspecialchars($txt['default_topic_subject']));
1707
+	}
1623 1708
 	$smcFunc['db_free_result']($request);
1624 1709
 
1625 1710
 	// Now is the perfect time to fetch the SM files.
@@ -1638,8 +1723,9 @@  discard block
 block discarded – undo
1638 1723
 
1639 1724
 	// Check if we need some stupid MySQL fix.
1640 1725
 	$server_version = $smcFunc['db_server_info']();
1641
-	if (($db_type == 'mysql' || $db_type == 'mysqli') && in_array(substr($server_version, 0, 6), array('5.0.50', '5.0.51')))
1642
-		updateSettings(array('db_mysql_group_by_fix' => '1'));
1726
+	if (($db_type == 'mysql' || $db_type == 'mysqli') && in_array(substr($server_version, 0, 6), array('5.0.50', '5.0.51'))) {
1727
+			updateSettings(array('db_mysql_group_by_fix' => '1'));
1728
+	}
1643 1729
 
1644 1730
 	// Some final context for the template.
1645 1731
 	$incontext['dir_still_writable'] = is_writable(dirname(__FILE__)) && substr(__FILE__, 1, 2) != ':\\';
@@ -1659,8 +1745,9 @@  discard block
 block discarded – undo
1659 1745
 	$settingsArray = file(dirname(__FILE__) . '/Settings.php');
1660 1746
 
1661 1747
 	// @todo Do we just want to read the file in clean, and split it this way always?
1662
-	if (count($settingsArray) == 1)
1663
-		$settingsArray = preg_split('~[\r\n]~', $settingsArray[0]);
1748
+	if (count($settingsArray) == 1) {
1749
+			$settingsArray = preg_split('~[\r\n]~', $settingsArray[0]);
1750
+	}
1664 1751
 
1665 1752
 	for ($i = 0, $n = count($settingsArray); $i < $n; $i++)
1666 1753
 	{
@@ -1675,19 +1762,22 @@  discard block
 block discarded – undo
1675 1762
 			continue;
1676 1763
 		}
1677 1764
 
1678
-		if (trim($settingsArray[$i]) == '?' . '>')
1679
-			$settingsArray[$i] = '';
1765
+		if (trim($settingsArray[$i]) == '?' . '>') {
1766
+					$settingsArray[$i] = '';
1767
+		}
1680 1768
 
1681 1769
 		// Don't trim or bother with it if it's not a variable.
1682
-		if (substr($settingsArray[$i], 0, 1) != '$')
1683
-			continue;
1770
+		if (substr($settingsArray[$i], 0, 1) != '$') {
1771
+					continue;
1772
+		}
1684 1773
 
1685 1774
 		$settingsArray[$i] = rtrim($settingsArray[$i]) . "\n";
1686 1775
 
1687
-		foreach ($vars as $var => $val)
1688
-			if (strncasecmp($settingsArray[$i], '$' . $var, 1 + strlen($var)) == 0)
1776
+		foreach ($vars as $var => $val) {
1777
+					if (strncasecmp($settingsArray[$i], '$' . $var, 1 + strlen($var)) == 0)
1689 1778
 			{
1690 1779
 				$comment = strstr($settingsArray[$i], '#');
1780
+		}
1691 1781
 				$settingsArray[$i] = '$' . $var . ' = \'' . $val . '\';' . ($comment != '' ? "\t\t" . $comment : "\n");
1692 1782
 				unset($vars[$var]);
1693 1783
 			}
@@ -1697,36 +1787,41 @@  discard block
 block discarded – undo
1697 1787
 	if (!empty($vars))
1698 1788
 	{
1699 1789
 		$settingsArray[$i++] = '';
1700
-		foreach ($vars as $var => $val)
1701
-			$settingsArray[$i++] = '$' . $var . ' = \'' . $val . '\';' . "\n";
1790
+		foreach ($vars as $var => $val) {
1791
+					$settingsArray[$i++] = '$' . $var . ' = \'' . $val . '\';' . "\n";
1792
+		}
1702 1793
 	}
1703 1794
 
1704 1795
 	// Blank out the file - done to fix a oddity with some servers.
1705 1796
 	$fp = @fopen(dirname(__FILE__) . '/Settings.php', 'w');
1706
-	if (!$fp)
1707
-		return false;
1797
+	if (!$fp) {
1798
+			return false;
1799
+	}
1708 1800
 	fclose($fp);
1709 1801
 
1710 1802
 	$fp = fopen(dirname(__FILE__) . '/Settings.php', 'r+');
1711 1803
 
1712 1804
 	// Gotta have one of these ;)
1713
-	if (trim($settingsArray[0]) != '<?php')
1714
-		fwrite($fp, "<?php\n");
1805
+	if (trim($settingsArray[0]) != '<?php') {
1806
+			fwrite($fp, "<?php\n");
1807
+	}
1715 1808
 
1716 1809
 	$lines = count($settingsArray);
1717 1810
 	for ($i = 0; $i < $lines - 1; $i++)
1718 1811
 	{
1719 1812
 		// Don't just write a bunch of blank lines.
1720
-		if ($settingsArray[$i] != '' || @$settingsArray[$i - 1] != '')
1721
-			fwrite($fp, strtr($settingsArray[$i], "\r", ''));
1813
+		if ($settingsArray[$i] != '' || @$settingsArray[$i - 1] != '') {
1814
+					fwrite($fp, strtr($settingsArray[$i], "\r", ''));
1815
+		}
1722 1816
 	}
1723 1817
 	fwrite($fp, $settingsArray[$i] . '?' . '>');
1724 1818
 	fclose($fp);
1725 1819
 
1726 1820
 	// Even though on normal installations the filemtime should prevent this being used by the installer incorrectly
1727 1821
 	// it seems that there are times it might not. So let's MAKE it dump the cache.
1728
-	if (function_exists('opcache_invalidate'))
1729
-		opcache_invalidate(dirname(__FILE__) . '/Settings.php', true);
1822
+	if (function_exists('opcache_invalidate')) {
1823
+			opcache_invalidate(dirname(__FILE__) . '/Settings.php', true);
1824
+	}
1730 1825
 
1731 1826
 	return true;
1732 1827
 }
@@ -1751,9 +1846,9 @@  discard block
 block discarded – undo
1751 1846
 	SecFilterScanPOST Off
1752 1847
 </IfModule>';
1753 1848
 
1754
-	if (!function_exists('apache_get_modules') || !in_array('mod_security', apache_get_modules()))
1755
-		return true;
1756
-	elseif (file_exists(dirname(__FILE__) . '/.htaccess') && is_writable(dirname(__FILE__) . '/.htaccess'))
1849
+	if (!function_exists('apache_get_modules') || !in_array('mod_security', apache_get_modules())) {
1850
+			return true;
1851
+	} elseif (file_exists(dirname(__FILE__) . '/.htaccess') && is_writable(dirname(__FILE__) . '/.htaccess'))
1757 1852
 	{
1758 1853
 		$current_htaccess = implode('', file(dirname(__FILE__) . '/.htaccess'));
1759 1854
 
@@ -1765,29 +1860,28 @@  discard block
 block discarded – undo
1765 1860
 				fwrite($ht_handle, $htaccess_addition);
1766 1861
 				fclose($ht_handle);
1767 1862
 				return true;
1863
+			} else {
1864
+							return false;
1768 1865
 			}
1769
-			else
1770
-				return false;
1866
+		} else {
1867
+					return true;
1771 1868
 		}
1772
-		else
1773
-			return true;
1774
-	}
1775
-	elseif (file_exists(dirname(__FILE__) . '/.htaccess'))
1776
-		return strpos(implode('', file(dirname(__FILE__) . '/.htaccess')), '<IfModule mod_security.c>') !== false;
1777
-	elseif (is_writable(dirname(__FILE__)))
1869
+	} elseif (file_exists(dirname(__FILE__) . '/.htaccess')) {
1870
+			return strpos(implode('', file(dirname(__FILE__) . '/.htaccess')), '<IfModule mod_security.c>') !== false;
1871
+	} elseif (is_writable(dirname(__FILE__)))
1778 1872
 	{
1779 1873
 		if ($ht_handle = fopen(dirname(__FILE__) . '/.htaccess', 'w'))
1780 1874
 		{
1781 1875
 			fwrite($ht_handle, $htaccess_addition);
1782 1876
 			fclose($ht_handle);
1783 1877
 			return true;
1878
+		} else {
1879
+					return false;
1784 1880
 		}
1785
-		else
1881
+	} else {
1786 1882
 			return false;
1787 1883
 	}
1788
-	else
1789
-		return false;
1790
-}
1884
+	}
1791 1885
 
1792 1886
 function template_install_above()
1793 1887
 {
@@ -1825,9 +1919,10 @@  discard block
 block discarded – undo
1825 1919
 								<label for="installer_language">', $txt['installer_language'], ':</label>
1826 1920
 								<select id="installer_language" name="lang_file" onchange="location.href = \'', $installurl, '?lang_file=\' + this.options[this.selectedIndex].value;">';
1827 1921
 
1828
-		foreach ($incontext['detected_languages'] as $lang => $name)
1829
-			echo '
1922
+		foreach ($incontext['detected_languages'] as $lang => $name) {
1923
+					echo '
1830 1924
 									<option', isset($_SESSION['installer_temp_lang']) && $_SESSION['installer_temp_lang'] == $lang ? ' selected' : '', ' value="', $lang, '">', $name, '</option>';
1925
+		}
1831 1926
 
1832 1927
 		echo '
1833 1928
 								</select>
@@ -1847,9 +1942,10 @@  discard block
 block discarded – undo
1847 1942
 						<h2>', $txt['upgrade_progress'], '</h2>
1848 1943
 						<ul>';
1849 1944
 
1850
-	foreach ($incontext['steps'] as $num => $step)
1851
-		echo '
1945
+	foreach ($incontext['steps'] as $num => $step) {
1946
+			echo '
1852 1947
 							<li class="', $num < $incontext['current_step'] ? 'stepdone' : ($num == $incontext['current_step'] ? 'stepcurrent' : 'stepwaiting'), '">', $txt['upgrade_step'], ' ', $step[0], ': ', $step[1], '</li>';
1948
+	}
1853 1949
 
1854 1950
 	echo '
1855 1951
 						</ul>
@@ -1874,20 +1970,23 @@  discard block
 block discarded – undo
1874 1970
 		echo '
1875 1971
 								<div>';
1876 1972
 
1877
-		if (!empty($incontext['continue']))
1878
-			echo '
1973
+		if (!empty($incontext['continue'])) {
1974
+					echo '
1879 1975
 									<input type="submit" id="contbutt" name="contbutt" value="', $txt['upgrade_continue'], '" onclick="return submitThisOnce(this);" class="button_submit" />';
1880
-		if (!empty($incontext['skip']))
1881
-			echo '
1976
+		}
1977
+		if (!empty($incontext['skip'])) {
1978
+					echo '
1882 1979
 									<input type="submit" id="skip" name="skip" value="', $txt['upgrade_skip'], '" onclick="return submitThisOnce(this);" class="button_submit" />';
1980
+		}
1883 1981
 		echo '
1884 1982
 								</div>';
1885 1983
 	}
1886 1984
 
1887 1985
 	// Show the closing form tag and other data only if not in the last step
1888
-	if (count($incontext['steps']) - 1 !== (int) $incontext['current_step'])
1889
-		echo '
1986
+	if (count($incontext['steps']) - 1 !== (int) $incontext['current_step']) {
1987
+			echo '
1890 1988
 							</form>';
1989
+	}
1891 1990
 
1892 1991
 	echo '
1893 1992
 						</div>
@@ -1922,13 +2021,15 @@  discard block
 block discarded – undo
1922 2021
 		</div>';
1923 2022
 
1924 2023
 	// Show the warnings, or not.
1925
-	if (template_warning_divs())
1926
-		echo '
2024
+	if (template_warning_divs()) {
2025
+			echo '
1927 2026
 		<h3>', $txt['install_all_lovely'], '</h3>';
2027
+	}
1928 2028
 
1929 2029
 	// Say we want the continue button!
1930
-	if (empty($incontext['error']))
1931
-		$incontext['continue'] = 1;
2030
+	if (empty($incontext['error'])) {
2031
+			$incontext['continue'] = 1;
2032
+	}
1932 2033
 
1933 2034
 	// For the latest version stuff.
1934 2035
 	echo '
@@ -1962,8 +2063,8 @@  discard block
 block discarded – undo
1962 2063
 	global $txt, $incontext;
1963 2064
 
1964 2065
 	// Errors are very serious..
1965
-	if (!empty($incontext['error']))
1966
-		echo '
2066
+	if (!empty($incontext['error'])) {
2067
+			echo '
1967 2068
 		<div style="margin: 2ex; padding: 2ex; border: 2px dashed #cc3344; color: black; background-color: #ffe4e9;">
1968 2069
 			<div style="float: left; width: 2ex; font-size: 2em; color: red;">!!</div>
1969 2070
 			<strong style="text-decoration: underline;">', $txt['upgrade_critical_error'], '</strong><br>
@@ -1971,9 +2072,10 @@  discard block
 block discarded – undo
1971 2072
 				', $incontext['error'], '
1972 2073
 			</div>
1973 2074
 		</div>';
2075
+	}
1974 2076
 	// A warning message?
1975
-	elseif (!empty($incontext['warning']))
1976
-		echo '
2077
+	elseif (!empty($incontext['warning'])) {
2078
+			echo '
1977 2079
 		<div style="margin: 2ex; padding: 2ex; border: 2px dashed #cc3344; color: black; background-color: #ffe4e9;">
1978 2080
 			<div style="float: left; width: 2ex; font-size: 2em; color: red;">!!</div>
1979 2081
 			<strong style="text-decoration: underline;">', $txt['upgrade_warning'], '</strong><br>
@@ -1981,6 +2083,7 @@  discard block
 block discarded – undo
1981 2083
 				', $incontext['warning'], '
1982 2084
 			</div>
1983 2085
 		</div>';
2086
+	}
1984 2087
 
1985 2088
 	return empty($incontext['error']) && empty($incontext['warning']);
1986 2089
 }
@@ -1996,27 +2099,30 @@  discard block
 block discarded – undo
1996 2099
 			<li>', $incontext['failed_files']), '</li>
1997 2100
 		</ul>';
1998 2101
 
1999
-	if (isset($incontext['systemos'], $incontext['detected_path']) && $incontext['systemos'] == 'linux')
2000
-		echo '
2102
+	if (isset($incontext['systemos'], $incontext['detected_path']) && $incontext['systemos'] == 'linux') {
2103
+			echo '
2001 2104
 		<hr>
2002 2105
 		<p>', $txt['chmod_linux_info'], '</p>
2003 2106
 		<tt># chmod a+w ', implode(' ' . $incontext['detected_path'] . '/', $incontext['failed_files']), '</tt>';
2107
+	}
2004 2108
 
2005 2109
 	// This is serious!
2006
-	if (!template_warning_divs())
2007
-		return;
2110
+	if (!template_warning_divs()) {
2111
+			return;
2112
+	}
2008 2113
 
2009 2114
 	echo '
2010 2115
 		<hr>
2011 2116
 		<p>', $txt['ftp_setup_info'], '</p>';
2012 2117
 
2013
-	if (!empty($incontext['ftp_errors']))
2014
-		echo '
2118
+	if (!empty($incontext['ftp_errors'])) {
2119
+			echo '
2015 2120
 		<div class="error_message">
2016 2121
 			', $txt['error_ftp_no_connect'], '<br><br>
2017 2122
 			<code>', implode('<br>', $incontext['ftp_errors']), '</code>
2018 2123
 		</div>
2019 2124
 		<br>';
2125
+	}
2020 2126
 
2021 2127
 	echo '
2022 2128
 		<form action="', $incontext['form_url'], '" method="post">
@@ -2076,17 +2182,17 @@  discard block
 block discarded – undo
2076 2182
 				<td>
2077 2183
 					<select name="db_type" id="db_type_input" onchange="toggleDBInput();">';
2078 2184
 
2079
-	foreach ($incontext['supported_databases'] as $key => $db)
2080
-			echo '
2185
+	foreach ($incontext['supported_databases'] as $key => $db) {
2186
+				echo '
2081 2187
 						<option value="', $key, '"', isset($_POST['db_type']) && $_POST['db_type'] == $key ? ' selected' : '', '>', $db['name'], '</option>';
2188
+	}
2082 2189
 
2083 2190
 	echo '
2084 2191
 					</select>
2085 2192
 					<div class="smalltext block">', $txt['db_settings_type_info'], '</div>
2086 2193
 				</td>
2087 2194
 			</tr>';
2088
-	}
2089
-	else
2195
+	} else
2090 2196
 	{
2091 2197
 		echo '
2092 2198
 			<tr style="display: none;">
@@ -2278,9 +2384,10 @@  discard block
 block discarded – undo
2278 2384
 				<div style="color: red;">', $txt['error_db_queries'], '</div>
2279 2385
 				<ul>';
2280 2386
 
2281
-		foreach ($incontext['failures'] as $line => $fail)
2282
-			echo '
2387
+		foreach ($incontext['failures'] as $line => $fail) {
2388
+					echo '
2283 2389
 						<li><strong>', $txt['error_db_queries_line'], $line + 1, ':</strong> ', nl2br(htmlspecialchars($fail)), '</li>';
2390
+		}
2284 2391
 
2285 2392
 		echo '
2286 2393
 				</ul>';
@@ -2341,15 +2448,16 @@  discard block
 block discarded – undo
2341 2448
 			</tr>
2342 2449
 		</table>';
2343 2450
 
2344
-	if ($incontext['require_db_confirm'])
2345
-		echo '
2451
+	if ($incontext['require_db_confirm']) {
2452
+			echo '
2346 2453
 		<h2>', $txt['user_settings_database'], '</h2>
2347 2454
 		<p>', $txt['user_settings_database_info'], '</p>
2348 2455
 
2349 2456
 		<div style="margin-bottom: 2ex; padding-', $txt['lang_rtl'] == false ? 'left' : 'right', ': 50px;">
2350 2457
 			<input type="password" name="password3" size="30" class="input_password" />
2351 2458
 		</div>';
2352
-}
2459
+	}
2460
+	}
2353 2461
 
2354 2462
 // Tell them it's done, and to delete.
2355 2463
 function template_delete_install()
@@ -2362,14 +2470,15 @@  discard block
 block discarded – undo
2362 2470
 	template_warning_divs();
2363 2471
 
2364 2472
 	// Install directory still writable?
2365
-	if ($incontext['dir_still_writable'])
2366
-		echo '
2473
+	if ($incontext['dir_still_writable']) {
2474
+			echo '
2367 2475
 		<em>', $txt['still_writable'], '</em><br>
2368 2476
 		<br>';
2477
+	}
2369 2478
 
2370 2479
 	// Don't show the box if it's like 99% sure it won't work :P.
2371
-	if ($incontext['probably_delete_install'])
2372
-		echo '
2480
+	if ($incontext['probably_delete_install']) {
2481
+			echo '
2373 2482
 		<div style="margin: 1ex; font-weight: bold;">
2374 2483
 			<label for="delete_self"><input type="checkbox" id="delete_self" onclick="doTheDelete();" class="input_check" /> ', $txt['delete_installer'], !isset($_SESSION['installer_temp_ftp']) ? ' ' . $txt['delete_installer_maybe'] : '', '</label>
2375 2484
 		</div>
@@ -2385,6 +2494,7 @@  discard block
 block discarded – undo
2385 2494
 			}
2386 2495
 		</script>
2387 2496
 		<br>';
2497
+	}
2388 2498
 
2389 2499
 	echo '
2390 2500
 		', sprintf($txt['go_to_your_forum'], $boardurl . '/index.php'), '<br>
Please login to merge, or discard this patch.
index.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 
26 26
 // Get everything started up...
27 27
 define('SMF', 1);
28
-if (function_exists('set_magic_quotes_runtime') && strnatcmp(phpversion(),'5.3.0') < 0)
28
+if (function_exists('set_magic_quotes_runtime') && strnatcmp(phpversion(), '5.3.0') < 0)
29 29
 	@set_magic_quotes_runtime(0);
30 30
 error_reporting(defined('E_STRICT') ? E_ALL | E_STRICT : E_ALL);
31 31
 $time_start = microtime();
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 if (!empty($modSettings['enableCompressedOutput']) && !headers_sent())
91 91
 {
92 92
 	// If zlib is being used, turn off output compression.
93
-	if (ini_get('zlib.output_compression') >=  1 || ini_get('output_handler') == 'ob_gzhandler')
93
+	if (ini_get('zlib.output_compression') >= 1 || ini_get('output_handler') == 'ob_gzhandler')
94 94
 		$modSettings['enableCompressedOutput'] = '0';
95 95
 	else
96 96
 	{
Please login to merge, or discard this patch.
Braces   +37 added lines, -25 removed lines patch added patch discarded remove patch
@@ -25,8 +25,9 @@  discard block
 block discarded – undo
25 25
 
26 26
 // Get everything started up...
27 27
 define('SMF', 1);
28
-if (function_exists('set_magic_quotes_runtime') && strnatcmp(phpversion(),'5.3.0') < 0)
28
+if (function_exists('set_magic_quotes_runtime') && strnatcmp(phpversion(),'5.3.0') < 0) {
29 29
 	@set_magic_quotes_runtime(0);
30
+}
30 31
 error_reporting(defined('E_STRICT') ? E_ALL | E_STRICT : E_ALL);
31 32
 $time_start = microtime();
32 33
 
@@ -34,16 +35,18 @@  discard block
 block discarded – undo
34 35
 ob_start();
35 36
 
36 37
 // Do some cleaning, just in case.
37
-foreach (array('db_character_set', 'cachedir') as $variable)
38
+foreach (array('db_character_set', 'cachedir') as $variable) {
38 39
 	if (isset($GLOBALS[$variable]))
39 40
 		unset($GLOBALS[$variable], $GLOBALS[$variable]);
41
+}
40 42
 
41 43
 // Load the settings...
42 44
 require_once(dirname(__FILE__) . '/Settings.php');
43 45
 
44 46
 // Make absolutely sure the cache directory is defined.
45
-if ((empty($cachedir) || !file_exists($cachedir)) && file_exists($boarddir . '/cache'))
47
+if ((empty($cachedir) || !file_exists($cachedir)) && file_exists($boarddir . '/cache')) {
46 48
 	$cachedir = $boarddir . '/cache';
49
+}
47 50
 
48 51
 // Without those we can't go anywhere
49 52
 require_once($sourcedir . '/QueryString.php');
@@ -53,8 +56,9 @@  discard block
 block discarded – undo
53 56
 require_once($sourcedir . '/Load.php');
54 57
 
55 58
 // If $maintenance is set specifically to 2, then we're upgrading or something.
56
-if (!empty($maintenance) && $maintenance == 2)
59
+if (!empty($maintenance) && $maintenance == 2) {
57 60
 	display_maintenance_message();
61
+}
58 62
 
59 63
 // Create a variable to store some SMF specific functions in.
60 64
 $smcFunc = array();
@@ -69,8 +73,9 @@  discard block
 block discarded – undo
69 73
 cleanRequest();
70 74
 
71 75
 // Seed the random generator.
72
-if (empty($modSettings['rand_seed']) || mt_rand(1, 250) == 69)
76
+if (empty($modSettings['rand_seed']) || mt_rand(1, 250) == 69) {
73 77
 	smf_seed_generator();
78
+}
74 79
 
75 80
 // Before we get carried away, are we doing a scheduled task? If so save CPU cycles by jumping out!
76 81
 if (isset($_GET['scheduled']))
@@ -90,9 +95,9 @@  discard block
 block discarded – undo
90 95
 if (!empty($modSettings['enableCompressedOutput']) && !headers_sent())
91 96
 {
92 97
 	// If zlib is being used, turn off output compression.
93
-	if (ini_get('zlib.output_compression') >=  1 || ini_get('output_handler') == 'ob_gzhandler')
94
-		$modSettings['enableCompressedOutput'] = '0';
95
-	else
98
+	if (ini_get('zlib.output_compression') >=  1 || ini_get('output_handler') == 'ob_gzhandler') {
99
+			$modSettings['enableCompressedOutput'] = '0';
100
+	} else
96 101
 	{
97 102
 		ob_end_clean();
98 103
 		ob_start('ob_gzhandler');
@@ -141,18 +146,21 @@  discard block
 block discarded – undo
141 146
 	loadPermissions();
142 147
 
143 148
 	// Attachments don't require the entire theme to be loaded.
144
-	if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'dlattach')
145
-		detectBrowser();
149
+	if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'dlattach') {
150
+			detectBrowser();
151
+	}
146 152
 	// Load the current theme.  (note that ?theme=1 will also work, may be used for guest theming.)
147
-	else
148
-		loadTheme();
153
+	else {
154
+			loadTheme();
155
+	}
149 156
 
150 157
 	// Check if the user should be disallowed access.
151 158
 	is_not_banned();
152 159
 
153 160
 	// If we are in a topic and don't have permission to approve it then duck out now.
154
-	if (!empty($topic) && empty($board_info['cur_topic_approved']) && !allowedTo('approve_posts') && ($user_info['id'] != $board_info['cur_topic_starter'] || $user_info['is_guest']))
155
-		fatal_lang_error('not_a_topic', false);
161
+	if (!empty($topic) && empty($board_info['cur_topic_approved']) && !allowedTo('approve_posts') && ($user_info['id'] != $board_info['cur_topic_starter'] || $user_info['is_guest'])) {
162
+			fatal_lang_error('not_a_topic', false);
163
+	}
156 164
 
157 165
 	$no_stat_actions = array('clock', 'dlattach', 'findmember', 'jsoption', 'likes', 'loadeditorlocale', 'modifycat', 'requestmembers', 'smstats', 'suggest', 'about:unknown', '.xml', 'xmlhttp', 'verificationcode', 'viewquery', 'viewsmfile');
158 166
 	call_integration_hook('integrate_pre_log_stats', array(&$no_stat_actions));
@@ -163,8 +171,9 @@  discard block
 block discarded – undo
163 171
 		writeLog();
164 172
 
165 173
 		// Track forum statistics and hits...?
166
-		if (!empty($modSettings['hitStats']))
167
-			trackStats(array('hits' => '+'));
174
+		if (!empty($modSettings['hitStats'])) {
175
+					trackStats(array('hits' => '+'));
176
+		}
168 177
 	}
169 178
 	unset($no_stat_actions);
170 179
 
@@ -178,13 +187,14 @@  discard block
 block discarded – undo
178 187
 			return ($_REQUEST['action'] == 'login2' ? 'Login2' : ($_REQUEST['action'] == 'logintfa' ? 'LoginTFA' : 'Logout'));
179 188
 		}
180 189
 		// Don't even try it, sonny.
181
-		else
182
-			return 'InMaintenance';
190
+		else {
191
+					return 'InMaintenance';
192
+		}
183 193
 	}
184 194
 	// If guest access is off, a guest can only do one of the very few following actions.
185
-	elseif (empty($modSettings['allow_guestAccess']) && $user_info['is_guest'] && (!isset($_REQUEST['action']) || !in_array($_REQUEST['action'], array('coppa', 'login', 'login2', 'logintfa', 'reminder', 'activate', 'help', 'helpadmin', 'smstats', 'verificationcode', 'signup', 'signup2'))))
186
-		return 'KickGuest';
187
-	elseif (empty($_REQUEST['action']))
195
+	elseif (empty($modSettings['allow_guestAccess']) && $user_info['is_guest'] && (!isset($_REQUEST['action']) || !in_array($_REQUEST['action'], array('coppa', 'login', 'login2', 'logintfa', 'reminder', 'activate', 'help', 'helpadmin', 'smstats', 'verificationcode', 'signup', 'signup2')))) {
196
+			return 'KickGuest';
197
+	} elseif (empty($_REQUEST['action']))
188 198
 	{
189 199
 		// Action and board are both empty... BoardIndex! Unless someone else wants to do something different.
190 200
 		if (empty($board) && empty($topic))
@@ -200,8 +210,9 @@  discard block
 block discarded – undo
200 210
 
201 211
 				$call = call_helper($defaultAction, true);
202 212
 
203
-				if (!empty($call))
204
-					return $call;
213
+				if (!empty($call)) {
214
+									return $call;
215
+				}
205 216
 			}
206 217
 
207 218
 			// No default action huh? then go to our good old BoardIndex.
@@ -331,8 +342,9 @@  discard block
 block discarded – undo
331 342
 
332 343
 			$call = call_helper($fallbackAction, true);
333 344
 
334
-			if (!empty($call))
335
-				return $call;
345
+			if (!empty($call)) {
346
+							return $call;
347
+			}
336 348
 		}
337 349
 
338 350
 		// No fallback action, huh?
Please login to merge, or discard this patch.