@@ -1697,8 +1697,7 @@ discard block |
||
| 1697 | 1697 | updateStats('topic'); |
| 1698 | 1698 | |
| 1699 | 1699 | // This function is needed to do the updateStats('subject') call. |
| 1700 | - $smcFunc['strtolower'] = $db_character_set != 'utf8' && $txt['lang_character_set'] != 'UTF-8' ? 'strtolower' : |
|
| 1701 | - function($string){ |
|
| 1700 | + $smcFunc['strtolower'] = $db_character_set != 'utf8' && $txt['lang_character_set'] != 'UTF-8' ? 'strtolower' : function($string) { |
|
| 1702 | 1701 | global $sourcedir; |
| 1703 | 1702 | if (function_exists('mb_strtolower')) |
| 1704 | 1703 | return mb_strtolower($string, 'UTF-8'); |
@@ -1767,7 +1766,7 @@ discard block |
||
| 1767 | 1766 | if (trim($settingsArray[$i]) == 'if (file_exists(dirname(__FILE__) . \'/install.php\'))' && trim($settingsArray[$i + 1]) == '{' && trim($settingsArray[$i + 9]) == '}') |
| 1768 | 1767 | { |
| 1769 | 1768 | // Set the ten lines to nothing. |
| 1770 | - for ($j=0; $j < 10; $j++) |
|
| 1769 | + for ($j = 0; $j < 10; $j++) |
|
| 1771 | 1770 | $settingsArray[$i++] = ''; |
| 1772 | 1771 | |
| 1773 | 1772 | continue; |
@@ -20,8 +20,9 @@ discard block |
||
| 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 | |
@@ -63,10 +64,11 @@ discard block |
||
| 63 | 64 | |
| 64 | 65 | list ($charcode) = pg_fetch_row($request); |
| 65 | 66 | |
| 66 | - if ($charcode == 'UTF8') |
|
| 67 | - return true; |
|
| 68 | - else |
|
| 69 | - return false; |
|
| 67 | + if ($charcode == 'UTF8') { |
|
| 68 | + return true; |
|
| 69 | + } else { |
|
| 70 | + return false; |
|
| 71 | + } |
|
| 70 | 72 | }, |
| 71 | 73 | 'utf8_version' => '8.0', |
| 72 | 74 | 'utf8_version_check' => '$request = pg_query(\'SELECT version()\'); list ($version) = pg_fetch_row($request); list($pgl, $version) = explode(" ", $version); return $version;', |
@@ -76,12 +78,14 @@ discard block |
||
| 76 | 78 | $value = preg_replace('~[^A-Za-z0-9_\$]~', '', $value); |
| 77 | 79 | |
| 78 | 80 | // Is it reserved? |
| 79 | - if ($value == 'pg_') |
|
| 80 | - return $txt['error_db_prefix_reserved']; |
|
| 81 | + if ($value == 'pg_') { |
|
| 82 | + return $txt['error_db_prefix_reserved']; |
|
| 83 | + } |
|
| 81 | 84 | |
| 82 | 85 | // Is the prefix numeric? |
| 83 | - if (preg_match('~^\d~', $value)) |
|
| 84 | - return $txt['error_db_prefix_numeric']; |
|
| 86 | + if (preg_match('~^\d~', $value)) { |
|
| 87 | + return $txt['error_db_prefix_numeric']; |
|
| 88 | + } |
|
| 85 | 89 | |
| 86 | 90 | return true; |
| 87 | 91 | }, |
@@ -128,10 +132,11 @@ discard block |
||
| 128 | 132 | $incontext['skip'] = false; |
| 129 | 133 | |
| 130 | 134 | // Call the step and if it returns false that means pause! |
| 131 | - if (function_exists($step[2]) && $step[2]() === false) |
|
| 132 | - break; |
|
| 133 | - elseif (function_exists($step[2])) |
|
| 134 | - $incontext['current_step']++; |
|
| 135 | + if (function_exists($step[2]) && $step[2]() === false) { |
|
| 136 | + break; |
|
| 137 | + } elseif (function_exists($step[2])) { |
|
| 138 | + $incontext['current_step']++; |
|
| 139 | + } |
|
| 135 | 140 | |
| 136 | 141 | // No warnings pass on. |
| 137 | 142 | $incontext['warning'] = ''; |
@@ -147,8 +152,9 @@ discard block |
||
| 147 | 152 | global $databases; |
| 148 | 153 | |
| 149 | 154 | // Just so people using older versions of PHP aren't left in the cold. |
| 150 | - if (!isset($_SERVER['PHP_SELF'])) |
|
| 151 | - $_SERVER['PHP_SELF'] = isset($GLOBALS['HTTP_SERVER_VARS']['PHP_SELF']) ? $GLOBALS['HTTP_SERVER_VARS']['PHP_SELF'] : 'install.php'; |
|
| 155 | + if (!isset($_SERVER['PHP_SELF'])) { |
|
| 156 | + $_SERVER['PHP_SELF'] = isset($GLOBALS['HTTP_SERVER_VARS']['PHP_SELF']) ? $GLOBALS['HTTP_SERVER_VARS']['PHP_SELF'] : 'install.php'; |
|
| 157 | + } |
|
| 152 | 158 | |
| 153 | 159 | // Enable error reporting for fatal errors. |
| 154 | 160 | error_reporting(E_ERROR | E_PARSE); |
@@ -164,21 +170,23 @@ discard block |
||
| 164 | 170 | { |
| 165 | 171 | ob_start(); |
| 166 | 172 | |
| 167 | - if (ini_get('session.save_handler') == 'user') |
|
| 168 | - @ini_set('session.save_handler', 'files'); |
|
| 169 | - if (function_exists('session_start')) |
|
| 170 | - @session_start(); |
|
| 171 | - } |
|
| 172 | - else |
|
| 173 | + if (ini_get('session.save_handler') == 'user') { |
|
| 174 | + @ini_set('session.save_handler', 'files'); |
|
| 175 | + } |
|
| 176 | + if (function_exists('session_start')) { |
|
| 177 | + @session_start(); |
|
| 178 | + } |
|
| 179 | + } else |
|
| 173 | 180 | { |
| 174 | 181 | ob_start('ob_gzhandler'); |
| 175 | 182 | |
| 176 | - if (ini_get('session.save_handler') == 'user') |
|
| 177 | - @ini_set('session.save_handler', 'files'); |
|
| 183 | + if (ini_get('session.save_handler') == 'user') { |
|
| 184 | + @ini_set('session.save_handler', 'files'); |
|
| 185 | + } |
|
| 178 | 186 | session_start(); |
| 179 | 187 | |
| 180 | - if (!headers_sent()) |
|
| 181 | - echo '<!DOCTYPE html> |
|
| 188 | + if (!headers_sent()) { |
|
| 189 | + echo '<!DOCTYPE html> |
|
| 182 | 190 | <html> |
| 183 | 191 | <head> |
| 184 | 192 | <title>', htmlspecialchars($_GET['pass_string']), '</title> |
@@ -187,14 +195,16 @@ discard block |
||
| 187 | 195 | <strong>', htmlspecialchars($_GET['pass_string']), '</strong> |
| 188 | 196 | </body> |
| 189 | 197 | </html>'; |
| 198 | + } |
|
| 190 | 199 | exit; |
| 191 | 200 | } |
| 192 | 201 | |
| 193 | 202 | // Add slashes, as long as they aren't already being added. |
| 194 | - if (!function_exists('get_magic_quotes_gpc') || @get_magic_quotes_gpc() == 0) |
|
| 195 | - foreach ($_POST as $k => $v) |
|
| 203 | + if (!function_exists('get_magic_quotes_gpc') || @get_magic_quotes_gpc() == 0) { |
|
| 204 | + foreach ($_POST as $k => $v) |
|
| 196 | 205 | if (strpos($k, 'password') === false && strpos($k, 'db_passwd') === false) |
| 197 | 206 | $_POST[$k] = addslashes($v); |
| 207 | + } |
|
| 198 | 208 | |
| 199 | 209 | // This is really quite simple; if ?delete is on the URL, delete the installer... |
| 200 | 210 | if (isset($_GET['delete'])) |
@@ -215,8 +225,7 @@ discard block |
||
| 215 | 225 | $ftp->close(); |
| 216 | 226 | |
| 217 | 227 | unset($_SESSION['installer_temp_ftp']); |
| 218 | - } |
|
| 219 | - else |
|
| 228 | + } else |
|
| 220 | 229 | { |
| 221 | 230 | @unlink(__FILE__); |
| 222 | 231 | |
@@ -230,10 +239,11 @@ discard block |
||
| 230 | 239 | // Now just redirect to a blank.png... |
| 231 | 240 | $secure = false; |
| 232 | 241 | |
| 233 | - if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') |
|
| 234 | - $secure = true; |
|
| 235 | - elseif (!empty($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https' || !empty($_SERVER['HTTP_X_FORWARDED_SSL']) && $_SERVER['HTTP_X_FORWARDED_SSL'] == 'on') |
|
| 236 | - $secure = true; |
|
| 242 | + if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') { |
|
| 243 | + $secure = true; |
|
| 244 | + } elseif (!empty($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https' || !empty($_SERVER['HTTP_X_FORWARDED_SSL']) && $_SERVER['HTTP_X_FORWARDED_SSL'] == 'on') { |
|
| 245 | + $secure = true; |
|
| 246 | + } |
|
| 237 | 247 | |
| 238 | 248 | header('Location: http' . ($secure ? 's' : '') . '://' . (isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : $_SERVER['SERVER_NAME'] . ':' . $_SERVER['SERVER_PORT']) . dirname($_SERVER['PHP_SELF']) . '/Themes/default/images/blank.png'); |
| 239 | 249 | exit; |
@@ -244,10 +254,11 @@ discard block |
||
| 244 | 254 | { |
| 245 | 255 | // Get PHP's default timezone, if set |
| 246 | 256 | $ini_tz = ini_get('date.timezone'); |
| 247 | - if (!empty($ini_tz)) |
|
| 248 | - $timezone_id = $ini_tz; |
|
| 249 | - else |
|
| 250 | - $timezone_id = ''; |
|
| 257 | + if (!empty($ini_tz)) { |
|
| 258 | + $timezone_id = $ini_tz; |
|
| 259 | + } else { |
|
| 260 | + $timezone_id = ''; |
|
| 261 | + } |
|
| 251 | 262 | |
| 252 | 263 | // If date.timezone is unset, invalid, or just plain weird, make a best guess |
| 253 | 264 | if (!in_array($timezone_id, timezone_identifiers_list())) |
@@ -277,8 +288,9 @@ discard block |
||
| 277 | 288 | $dir = dir(dirname(__FILE__) . '/Themes/default/languages'); |
| 278 | 289 | while ($entry = $dir->read()) |
| 279 | 290 | { |
| 280 | - if (substr($entry, 0, 8) == 'Install.' && substr($entry, -4) == '.php') |
|
| 281 | - $incontext['detected_languages'][$entry] = ucfirst(substr($entry, 8, strlen($entry) - 12)); |
|
| 291 | + if (substr($entry, 0, 8) == 'Install.' && substr($entry, -4) == '.php') { |
|
| 292 | + $incontext['detected_languages'][$entry] = ucfirst(substr($entry, 8, strlen($entry) - 12)); |
|
| 293 | + } |
|
| 282 | 294 | } |
| 283 | 295 | $dir->close(); |
| 284 | 296 | } |
@@ -313,10 +325,11 @@ discard block |
||
| 313 | 325 | } |
| 314 | 326 | |
| 315 | 327 | // Override the language file? |
| 316 | - if (isset($_GET['lang_file'])) |
|
| 317 | - $_SESSION['installer_temp_lang'] = $_GET['lang_file']; |
|
| 318 | - elseif (isset($GLOBALS['HTTP_GET_VARS']['lang_file'])) |
|
| 319 | - $_SESSION['installer_temp_lang'] = $GLOBALS['HTTP_GET_VARS']['lang_file']; |
|
| 328 | + if (isset($_GET['lang_file'])) { |
|
| 329 | + $_SESSION['installer_temp_lang'] = $_GET['lang_file']; |
|
| 330 | + } elseif (isset($GLOBALS['HTTP_GET_VARS']['lang_file'])) { |
|
| 331 | + $_SESSION['installer_temp_lang'] = $GLOBALS['HTTP_GET_VARS']['lang_file']; |
|
| 332 | + } |
|
| 320 | 333 | |
| 321 | 334 | // Make sure it exists, if it doesn't reset it. |
| 322 | 335 | 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'])) |
@@ -325,8 +338,9 @@ discard block |
||
| 325 | 338 | list ($_SESSION['installer_temp_lang']) = array_keys($incontext['detected_languages']); |
| 326 | 339 | |
| 327 | 340 | // If we have english and some other language, use the other language. We Americans hate english :P. |
| 328 | - if ($_SESSION['installer_temp_lang'] == 'Install.english.php' && count($incontext['detected_languages']) > 1) |
|
| 329 | - list (, $_SESSION['installer_temp_lang']) = array_keys($incontext['detected_languages']); |
|
| 341 | + if ($_SESSION['installer_temp_lang'] == 'Install.english.php' && count($incontext['detected_languages']) > 1) { |
|
| 342 | + list (, $_SESSION['installer_temp_lang']) = array_keys($incontext['detected_languages']); |
|
| 343 | + } |
|
| 330 | 344 | } |
| 331 | 345 | |
| 332 | 346 | // And now include the actual language file itself. |
@@ -343,15 +357,18 @@ discard block |
||
| 343 | 357 | global $db_prefix, $db_connection, $sourcedir, $smcFunc, $modSettings; |
| 344 | 358 | global $db_server, $db_passwd, $db_type, $db_name, $db_user, $db_persist; |
| 345 | 359 | |
| 346 | - if (empty($sourcedir)) |
|
| 347 | - $sourcedir = dirname(__FILE__) . '/Sources'; |
|
| 360 | + if (empty($sourcedir)) { |
|
| 361 | + $sourcedir = dirname(__FILE__) . '/Sources'; |
|
| 362 | + } |
|
| 348 | 363 | |
| 349 | 364 | // Need this to check whether we need the database password. |
| 350 | 365 | require(dirname(__FILE__) . '/Settings.php'); |
| 351 | - if (!defined('SMF')) |
|
| 352 | - define('SMF', 1); |
|
| 353 | - if (empty($smcFunc)) |
|
| 354 | - $smcFunc = array(); |
|
| 366 | + if (!defined('SMF')) { |
|
| 367 | + define('SMF', 1); |
|
| 368 | + } |
|
| 369 | + if (empty($smcFunc)) { |
|
| 370 | + $smcFunc = array(); |
|
| 371 | + } |
|
| 355 | 372 | |
| 356 | 373 | $modSettings['disableQueryCheck'] = true; |
| 357 | 374 | |
@@ -359,8 +376,9 @@ discard block |
||
| 359 | 376 | if (!$db_connection) |
| 360 | 377 | { |
| 361 | 378 | require_once($sourcedir . '/Subs-Db-' . $db_type . '.php'); |
| 362 | - if (version_compare(PHP_VERSION, '5', '<')) |
|
| 363 | - require_once($sourcedir . '/Subs-Compat.php'); |
|
| 379 | + if (version_compare(PHP_VERSION, '5', '<')) { |
|
| 380 | + require_once($sourcedir . '/Subs-Compat.php'); |
|
| 381 | + } |
|
| 364 | 382 | |
| 365 | 383 | $db_options = array('persist' => $db_persist); |
| 366 | 384 | $port = ''; |
@@ -371,19 +389,20 @@ discard block |
||
| 371 | 389 | if ($db_type == 'mysql') |
| 372 | 390 | { |
| 373 | 391 | $port = ((int) $_POST['db_port'] == ini_get($db_type . 'default_port')) ? '' : (int) $_POST['db_port']; |
| 374 | - } |
|
| 375 | - elseif ($db_type == 'postgresql') |
|
| 392 | + } elseif ($db_type == 'postgresql') |
|
| 376 | 393 | { |
| 377 | 394 | // PostgreSQL doesn't have a default port setting in php.ini, so just check against the default |
| 378 | 395 | $port = ((int) $_POST['db_port'] == 5432) ? '' : (int) $_POST['db_port']; |
| 379 | 396 | } |
| 380 | 397 | } |
| 381 | 398 | |
| 382 | - if (!empty($port)) |
|
| 383 | - $db_options['port'] = $port; |
|
| 399 | + if (!empty($port)) { |
|
| 400 | + $db_options['port'] = $port; |
|
| 401 | + } |
|
| 384 | 402 | |
| 385 | - if (!$db_connection) |
|
| 386 | - $db_connection = smf_db_initiate($db_server, $db_name, $db_user, $db_passwd, $db_prefix, $db_options); |
|
| 403 | + if (!$db_connection) { |
|
| 404 | + $db_connection = smf_db_initiate($db_server, $db_name, $db_user, $db_passwd, $db_prefix, $db_options); |
|
| 405 | + } |
|
| 387 | 406 | } |
| 388 | 407 | } |
| 389 | 408 | |
@@ -411,8 +430,9 @@ discard block |
||
| 411 | 430 | // @todo REMOVE THIS!! |
| 412 | 431 | else |
| 413 | 432 | { |
| 414 | - if (function_exists('doStep' . $_GET['step'])) |
|
| 415 | - call_user_func('doStep' . $_GET['step']); |
|
| 433 | + if (function_exists('doStep' . $_GET['step'])) { |
|
| 434 | + call_user_func('doStep' . $_GET['step']); |
|
| 435 | + } |
|
| 416 | 436 | } |
| 417 | 437 | // Show the footer. |
| 418 | 438 | template_install_below(); |
@@ -430,8 +450,9 @@ discard block |
||
| 430 | 450 | $incontext['sub_template'] = 'welcome_message'; |
| 431 | 451 | |
| 432 | 452 | // Done the submission? |
| 433 | - if (isset($_POST['contbutt'])) |
|
| 434 | - return true; |
|
| 453 | + if (isset($_POST['contbutt'])) { |
|
| 454 | + return true; |
|
| 455 | + } |
|
| 435 | 456 | |
| 436 | 457 | // See if we think they have already installed it? |
| 437 | 458 | if (is_readable(dirname(__FILE__) . '/Settings.php')) |
@@ -439,14 +460,17 @@ discard block |
||
| 439 | 460 | $probably_installed = 0; |
| 440 | 461 | foreach (file(dirname(__FILE__) . '/Settings.php') as $line) |
| 441 | 462 | { |
| 442 | - if (preg_match('~^\$db_passwd\s=\s\'([^\']+)\';$~', $line)) |
|
| 443 | - $probably_installed++; |
|
| 444 | - if (preg_match('~^\$boardurl\s=\s\'([^\']+)\';~', $line) && !preg_match('~^\$boardurl\s=\s\'http://127\.0\.0\.1/smf\';~', $line)) |
|
| 445 | - $probably_installed++; |
|
| 463 | + if (preg_match('~^\$db_passwd\s=\s\'([^\']+)\';$~', $line)) { |
|
| 464 | + $probably_installed++; |
|
| 465 | + } |
|
| 466 | + if (preg_match('~^\$boardurl\s=\s\'([^\']+)\';~', $line) && !preg_match('~^\$boardurl\s=\s\'http://127\.0\.0\.1/smf\';~', $line)) { |
|
| 467 | + $probably_installed++; |
|
| 468 | + } |
|
| 446 | 469 | } |
| 447 | 470 | |
| 448 | - if ($probably_installed == 2) |
|
| 449 | - $incontext['warning'] = $txt['error_already_installed']; |
|
| 471 | + if ($probably_installed == 2) { |
|
| 472 | + $incontext['warning'] = $txt['error_already_installed']; |
|
| 473 | + } |
|
| 450 | 474 | } |
| 451 | 475 | |
| 452 | 476 | // Is some database support even compiled in? |
@@ -461,45 +485,54 @@ discard block |
||
| 461 | 485 | $databases[$key]['supported'] = false; |
| 462 | 486 | $notFoundSQLFile = true; |
| 463 | 487 | $txt['error_db_script_missing'] = sprintf($txt['error_db_script_missing'], 'install_' . $GLOBALS['db_script_version'] . '_' . $type . '.sql'); |
| 488 | + } else { |
|
| 489 | + $incontext['supported_databases'][] = $db; |
|
| 464 | 490 | } |
| 465 | - else |
|
| 466 | - $incontext['supported_databases'][] = $db; |
|
| 467 | 491 | } |
| 468 | 492 | } |
| 469 | 493 | |
| 470 | 494 | // Check the PHP version. |
| 471 | - if ((!function_exists('version_compare') || version_compare($GLOBALS['required_php_version'], PHP_VERSION, '>='))) |
|
| 472 | - $error = 'error_php_too_low'; |
|
| 495 | + if ((!function_exists('version_compare') || version_compare($GLOBALS['required_php_version'], PHP_VERSION, '>='))) { |
|
| 496 | + $error = 'error_php_too_low'; |
|
| 497 | + } |
|
| 473 | 498 | // Make sure we have a supported database |
| 474 | - elseif (empty($incontext['supported_databases'])) |
|
| 475 | - $error = empty($notFoundSQLFile) ? 'error_db_missing' : 'error_db_script_missing'; |
|
| 499 | + elseif (empty($incontext['supported_databases'])) { |
|
| 500 | + $error = empty($notFoundSQLFile) ? 'error_db_missing' : 'error_db_script_missing'; |
|
| 501 | + } |
|
| 476 | 502 | // How about session support? Some crazy sysadmin remove it? |
| 477 | - elseif (!function_exists('session_start')) |
|
| 478 | - $error = 'error_session_missing'; |
|
| 503 | + elseif (!function_exists('session_start')) { |
|
| 504 | + $error = 'error_session_missing'; |
|
| 505 | + } |
|
| 479 | 506 | // Make sure they uploaded all the files. |
| 480 | - elseif (!file_exists(dirname(__FILE__) . '/index.php')) |
|
| 481 | - $error = 'error_missing_files'; |
|
| 507 | + elseif (!file_exists(dirname(__FILE__) . '/index.php')) { |
|
| 508 | + $error = 'error_missing_files'; |
|
| 509 | + } |
|
| 482 | 510 | // Very simple check on the session.save_path for Windows. |
| 483 | 511 | // @todo Move this down later if they don't use database-driven sessions? |
| 484 | - elseif (@ini_get('session.save_path') == '/tmp' && substr(__FILE__, 1, 2) == ':\\') |
|
| 485 | - $error = 'error_session_save_path'; |
|
| 512 | + elseif (@ini_get('session.save_path') == '/tmp' && substr(__FILE__, 1, 2) == ':\\') { |
|
| 513 | + $error = 'error_session_save_path'; |
|
| 514 | + } |
|
| 486 | 515 | |
| 487 | 516 | // Since each of the three messages would look the same, anyway... |
| 488 | - if (isset($error)) |
|
| 489 | - $incontext['error'] = $txt[$error]; |
|
| 517 | + if (isset($error)) { |
|
| 518 | + $incontext['error'] = $txt[$error]; |
|
| 519 | + } |
|
| 490 | 520 | |
| 491 | 521 | // Mod_security blocks everything that smells funny. Let SMF handle security. |
| 492 | - if (!fixModSecurity() && !isset($_GET['overmodsecurity'])) |
|
| 493 | - $incontext['error'] = $txt['error_mod_security'] . '<br><br><a href="' . $installurl . '?overmodsecurity=true">' . $txt['error_message_click'] . '</a> ' . $txt['error_message_bad_try_again']; |
|
| 522 | + if (!fixModSecurity() && !isset($_GET['overmodsecurity'])) { |
|
| 523 | + $incontext['error'] = $txt['error_mod_security'] . '<br><br><a href="' . $installurl . '?overmodsecurity=true">' . $txt['error_message_click'] . '</a> ' . $txt['error_message_bad_try_again']; |
|
| 524 | + } |
|
| 494 | 525 | |
| 495 | 526 | // Confirm mbstring is loaded... |
| 496 | - if (!extension_loaded('mbstring')) |
|
| 497 | - $incontext['error'] = $txt['install_no_mbstring']; |
|
| 527 | + if (!extension_loaded('mbstring')) { |
|
| 528 | + $incontext['error'] = $txt['install_no_mbstring']; |
|
| 529 | + } |
|
| 498 | 530 | |
| 499 | 531 | // Check for https stream support. |
| 500 | 532 | $supported_streams = stream_get_wrappers(); |
| 501 | - if (!in_array('https', $supported_streams)) |
|
| 502 | - $incontext['warning'] = $txt['install_no_https']; |
|
| 533 | + if (!in_array('https', $supported_streams)) { |
|
| 534 | + $incontext['warning'] = $txt['install_no_https']; |
|
| 535 | + } |
|
| 503 | 536 | |
| 504 | 537 | return false; |
| 505 | 538 | } |
@@ -525,12 +558,14 @@ discard block |
||
| 525 | 558 | 'db_last_error.php', |
| 526 | 559 | ); |
| 527 | 560 | |
| 528 | - foreach ($incontext['detected_languages'] as $lang => $temp) |
|
| 529 | - $extra_files[] = 'Themes/default/languages/' . $lang; |
|
| 561 | + foreach ($incontext['detected_languages'] as $lang => $temp) { |
|
| 562 | + $extra_files[] = 'Themes/default/languages/' . $lang; |
|
| 563 | + } |
|
| 530 | 564 | |
| 531 | 565 | // With mod_security installed, we could attempt to fix it with .htaccess. |
| 532 | - if (function_exists('apache_get_modules') && in_array('mod_security', apache_get_modules())) |
|
| 533 | - $writable_files[] = file_exists(dirname(__FILE__) . '/.htaccess') ? '.htaccess' : '.'; |
|
| 566 | + if (function_exists('apache_get_modules') && in_array('mod_security', apache_get_modules())) { |
|
| 567 | + $writable_files[] = file_exists(dirname(__FILE__) . '/.htaccess') ? '.htaccess' : '.'; |
|
| 568 | + } |
|
| 534 | 569 | |
| 535 | 570 | $failed_files = array(); |
| 536 | 571 | |
@@ -542,20 +577,23 @@ discard block |
||
| 542 | 577 | foreach ($writable_files as $file) |
| 543 | 578 | { |
| 544 | 579 | // Some files won't exist, try to address up front |
| 545 | - if (!file_exists(dirname(__FILE__) . '/' . $file)) |
|
| 546 | - @touch(dirname(__FILE__) . '/' . $file); |
|
| 580 | + if (!file_exists(dirname(__FILE__) . '/' . $file)) { |
|
| 581 | + @touch(dirname(__FILE__) . '/' . $file); |
|
| 582 | + } |
|
| 547 | 583 | // NOW do the writable check... |
| 548 | 584 | if (!is_writable(dirname(__FILE__) . '/' . $file)) |
| 549 | 585 | { |
| 550 | 586 | @chmod(dirname(__FILE__) . '/' . $file, 0755); |
| 551 | 587 | |
| 552 | 588 | // Well, 755 hopefully worked... if not, try 777. |
| 553 | - if (!is_writable(dirname(__FILE__) . '/' . $file) && !@chmod(dirname(__FILE__) . '/' . $file, 0777)) |
|
| 554 | - $failed_files[] = $file; |
|
| 589 | + if (!is_writable(dirname(__FILE__) . '/' . $file) && !@chmod(dirname(__FILE__) . '/' . $file, 0777)) { |
|
| 590 | + $failed_files[] = $file; |
|
| 591 | + } |
|
| 555 | 592 | } |
| 556 | 593 | } |
| 557 | - foreach ($extra_files as $file) |
|
| 558 | - @chmod(dirname(__FILE__) . (empty($file) ? '' : '/' . $file), 0777); |
|
| 594 | + foreach ($extra_files as $file) { |
|
| 595 | + @chmod(dirname(__FILE__) . (empty($file) ? '' : '/' . $file), 0777); |
|
| 596 | + } |
|
| 559 | 597 | } |
| 560 | 598 | // Windows is trickier. Let's try opening for r+... |
| 561 | 599 | else |
@@ -565,30 +603,35 @@ discard block |
||
| 565 | 603 | foreach ($writable_files as $file) |
| 566 | 604 | { |
| 567 | 605 | // Folders can't be opened for write... but the index.php in them can ;) |
| 568 | - if (is_dir(dirname(__FILE__) . '/' . $file)) |
|
| 569 | - $file .= '/index.php'; |
|
| 606 | + if (is_dir(dirname(__FILE__) . '/' . $file)) { |
|
| 607 | + $file .= '/index.php'; |
|
| 608 | + } |
|
| 570 | 609 | |
| 571 | 610 | // Funny enough, chmod actually does do something on windows - it removes the read only attribute. |
| 572 | 611 | @chmod(dirname(__FILE__) . '/' . $file, 0777); |
| 573 | 612 | $fp = @fopen(dirname(__FILE__) . '/' . $file, 'r+'); |
| 574 | 613 | |
| 575 | 614 | // Hmm, okay, try just for write in that case... |
| 576 | - if (!is_resource($fp)) |
|
| 577 | - $fp = @fopen(dirname(__FILE__) . '/' . $file, 'w'); |
|
| 615 | + if (!is_resource($fp)) { |
|
| 616 | + $fp = @fopen(dirname(__FILE__) . '/' . $file, 'w'); |
|
| 617 | + } |
|
| 578 | 618 | |
| 579 | - if (!is_resource($fp)) |
|
| 580 | - $failed_files[] = $file; |
|
| 619 | + if (!is_resource($fp)) { |
|
| 620 | + $failed_files[] = $file; |
|
| 621 | + } |
|
| 581 | 622 | |
| 582 | 623 | @fclose($fp); |
| 583 | 624 | } |
| 584 | - foreach ($extra_files as $file) |
|
| 585 | - @chmod(dirname(__FILE__) . (empty($file) ? '' : '/' . $file), 0777); |
|
| 625 | + foreach ($extra_files as $file) { |
|
| 626 | + @chmod(dirname(__FILE__) . (empty($file) ? '' : '/' . $file), 0777); |
|
| 627 | + } |
|
| 586 | 628 | } |
| 587 | 629 | |
| 588 | 630 | $failure = count($failed_files) >= 1; |
| 589 | 631 | |
| 590 | - if (!isset($_SERVER)) |
|
| 591 | - return !$failure; |
|
| 632 | + if (!isset($_SERVER)) { |
|
| 633 | + return !$failure; |
|
| 634 | + } |
|
| 592 | 635 | |
| 593 | 636 | // Put the list into context. |
| 594 | 637 | $incontext['failed_files'] = $failed_files; |
@@ -636,19 +679,23 @@ discard block |
||
| 636 | 679 | |
| 637 | 680 | if (!isset($ftp) || $ftp->error !== false) |
| 638 | 681 | { |
| 639 | - if (!isset($ftp)) |
|
| 640 | - $ftp = new ftp_connection(null); |
|
| 682 | + if (!isset($ftp)) { |
|
| 683 | + $ftp = new ftp_connection(null); |
|
| 684 | + } |
|
| 641 | 685 | // Save the error so we can mess with listing... |
| 642 | - elseif ($ftp->error !== false && empty($incontext['ftp_errors']) && !empty($ftp->last_message)) |
|
| 643 | - $incontext['ftp_errors'][] = $ftp->last_message; |
|
| 686 | + elseif ($ftp->error !== false && empty($incontext['ftp_errors']) && !empty($ftp->last_message)) { |
|
| 687 | + $incontext['ftp_errors'][] = $ftp->last_message; |
|
| 688 | + } |
|
| 644 | 689 | |
| 645 | 690 | list ($username, $detect_path, $found_path) = $ftp->detect_path(dirname(__FILE__)); |
| 646 | 691 | |
| 647 | - if (empty($_POST['ftp_path']) && $found_path) |
|
| 648 | - $_POST['ftp_path'] = $detect_path; |
|
| 692 | + if (empty($_POST['ftp_path']) && $found_path) { |
|
| 693 | + $_POST['ftp_path'] = $detect_path; |
|
| 694 | + } |
|
| 649 | 695 | |
| 650 | - if (!isset($_POST['ftp_username'])) |
|
| 651 | - $_POST['ftp_username'] = $username; |
|
| 696 | + if (!isset($_POST['ftp_username'])) { |
|
| 697 | + $_POST['ftp_username'] = $username; |
|
| 698 | + } |
|
| 652 | 699 | |
| 653 | 700 | // Set the username etc, into context. |
| 654 | 701 | $incontext['ftp'] = array( |
@@ -660,8 +707,7 @@ discard block |
||
| 660 | 707 | ); |
| 661 | 708 | |
| 662 | 709 | return false; |
| 663 | - } |
|
| 664 | - else |
|
| 710 | + } else |
|
| 665 | 711 | { |
| 666 | 712 | $_SESSION['installer_temp_ftp'] = array( |
| 667 | 713 | 'server' => $_POST['ftp_server'], |
@@ -675,10 +721,12 @@ discard block |
||
| 675 | 721 | |
| 676 | 722 | foreach ($failed_files as $file) |
| 677 | 723 | { |
| 678 | - if (!is_writable(dirname(__FILE__) . '/' . $file)) |
|
| 679 | - $ftp->chmod($file, 0755); |
|
| 680 | - if (!is_writable(dirname(__FILE__) . '/' . $file)) |
|
| 681 | - $ftp->chmod($file, 0777); |
|
| 724 | + if (!is_writable(dirname(__FILE__) . '/' . $file)) { |
|
| 725 | + $ftp->chmod($file, 0755); |
|
| 726 | + } |
|
| 727 | + if (!is_writable(dirname(__FILE__) . '/' . $file)) { |
|
| 728 | + $ftp->chmod($file, 0777); |
|
| 729 | + } |
|
| 682 | 730 | if (!is_writable(dirname(__FILE__) . '/' . $file)) |
| 683 | 731 | { |
| 684 | 732 | $failed_files_updated[] = $file; |
@@ -734,15 +782,17 @@ discard block |
||
| 734 | 782 | |
| 735 | 783 | if (!$foundOne) |
| 736 | 784 | { |
| 737 | - if (isset($db['default_host'])) |
|
| 738 | - $incontext['db']['server'] = ini_get($db['default_host']) or $incontext['db']['server'] = 'localhost'; |
|
| 785 | + if (isset($db['default_host'])) { |
|
| 786 | + $incontext['db']['server'] = ini_get($db['default_host']) or $incontext['db']['server'] = 'localhost'; |
|
| 787 | + } |
|
| 739 | 788 | if (isset($db['default_user'])) |
| 740 | 789 | { |
| 741 | 790 | $incontext['db']['user'] = ini_get($db['default_user']); |
| 742 | 791 | $incontext['db']['name'] = ini_get($db['default_user']); |
| 743 | 792 | } |
| 744 | - if (isset($db['default_password'])) |
|
| 745 | - $incontext['db']['pass'] = ini_get($db['default_password']); |
|
| 793 | + if (isset($db['default_password'])) { |
|
| 794 | + $incontext['db']['pass'] = ini_get($db['default_password']); |
|
| 795 | + } |
|
| 746 | 796 | |
| 747 | 797 | // For simplicity and less confusion, leave the port blank by default |
| 748 | 798 | $incontext['db']['port'] = ''; |
@@ -761,10 +811,10 @@ discard block |
||
| 761 | 811 | $incontext['db']['server'] = $_POST['db_server']; |
| 762 | 812 | $incontext['db']['prefix'] = $_POST['db_prefix']; |
| 763 | 813 | |
| 764 | - if (!empty($_POST['db_port'])) |
|
| 765 | - $incontext['db']['port'] = $_POST['db_port']; |
|
| 766 | - } |
|
| 767 | - else |
|
| 814 | + if (!empty($_POST['db_port'])) { |
|
| 815 | + $incontext['db']['port'] = $_POST['db_port']; |
|
| 816 | + } |
|
| 817 | + } else |
|
| 768 | 818 | { |
| 769 | 819 | $incontext['db']['prefix'] = 'smf_'; |
| 770 | 820 | } |
@@ -800,10 +850,11 @@ discard block |
||
| 800 | 850 | if (!empty($_POST['db_port'])) |
| 801 | 851 | { |
| 802 | 852 | // For MySQL, we can get the "default port" from PHP. PostgreSQL has no such option though. |
| 803 | - if (($db_type == 'mysql' || $db_type == 'mysqli') && $_POST['db_port'] != ini_get($db_type . '.default_port')) |
|
| 804 | - $vars['db_port'] = (int) $_POST['db_port']; |
|
| 805 | - elseif ($db_type == 'postgresql' && $_POST['db_port'] != 5432) |
|
| 806 | - $vars['db_port'] = (int) $_POST['db_port']; |
|
| 853 | + if (($db_type == 'mysql' || $db_type == 'mysqli') && $_POST['db_port'] != ini_get($db_type . '.default_port')) { |
|
| 854 | + $vars['db_port'] = (int) $_POST['db_port']; |
|
| 855 | + } elseif ($db_type == 'postgresql' && $_POST['db_port'] != 5432) { |
|
| 856 | + $vars['db_port'] = (int) $_POST['db_port']; |
|
| 857 | + } |
|
| 807 | 858 | } |
| 808 | 859 | |
| 809 | 860 | // God I hope it saved! |
@@ -816,8 +867,9 @@ discard block |
||
| 816 | 867 | // Make sure it works. |
| 817 | 868 | require(dirname(__FILE__) . '/Settings.php'); |
| 818 | 869 | |
| 819 | - if (empty($sourcedir)) |
|
| 820 | - $sourcedir = dirname(__FILE__) . '/Sources'; |
|
| 870 | + if (empty($sourcedir)) { |
|
| 871 | + $sourcedir = dirname(__FILE__) . '/Sources'; |
|
| 872 | + } |
|
| 821 | 873 | |
| 822 | 874 | // Better find the database file! |
| 823 | 875 | if (!file_exists($sourcedir . '/Subs-Db-' . $db_type . '.php')) |
@@ -827,18 +879,21 @@ discard block |
||
| 827 | 879 | } |
| 828 | 880 | |
| 829 | 881 | // Now include it for database functions! |
| 830 | - if (!defined('SMF')) |
|
| 831 | - define('SMF', 1); |
|
| 882 | + if (!defined('SMF')) { |
|
| 883 | + define('SMF', 1); |
|
| 884 | + } |
|
| 832 | 885 | |
| 833 | 886 | $modSettings['disableQueryCheck'] = true; |
| 834 | - if (empty($smcFunc)) |
|
| 835 | - $smcFunc = array(); |
|
| 887 | + if (empty($smcFunc)) { |
|
| 888 | + $smcFunc = array(); |
|
| 889 | + } |
|
| 836 | 890 | |
| 837 | 891 | require_once($sourcedir . '/Subs-Db-' . $db_type . '.php'); |
| 838 | 892 | |
| 839 | 893 | // What - running PHP4? The shame! |
| 840 | - if (version_compare(PHP_VERSION, '5', '<')) |
|
| 841 | - require_once($sourcedir . '/Subs-Compat.php'); |
|
| 894 | + if (version_compare(PHP_VERSION, '5', '<')) { |
|
| 895 | + require_once($sourcedir . '/Subs-Compat.php'); |
|
| 896 | + } |
|
| 842 | 897 | |
| 843 | 898 | // Attempt a connection. |
| 844 | 899 | $needsDB = !empty($databases[$db_type]['always_has_db']); |
@@ -926,12 +981,14 @@ discard block |
||
| 926 | 981 | $incontext['page_title'] = $txt['install_settings']; |
| 927 | 982 | |
| 928 | 983 | // Let's see if we got the database type correct. |
| 929 | - if (isset($_POST['db_type'], $databases[$_POST['db_type']])) |
|
| 930 | - $db_type = $_POST['db_type']; |
|
| 984 | + if (isset($_POST['db_type'], $databases[$_POST['db_type']])) { |
|
| 985 | + $db_type = $_POST['db_type']; |
|
| 986 | + } |
|
| 931 | 987 | |
| 932 | 988 | // Else we'd better be able to get the connection. |
| 933 | - else |
|
| 934 | - load_database(); |
|
| 989 | + else { |
|
| 990 | + load_database(); |
|
| 991 | + } |
|
| 935 | 992 | |
| 936 | 993 | $db_type = isset($_POST['db_type']) ? $_POST['db_type'] : $db_type; |
| 937 | 994 | |
@@ -940,10 +997,11 @@ discard block |
||
| 940 | 997 | |
| 941 | 998 | $secure = false; |
| 942 | 999 | |
| 943 | - if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') |
|
| 944 | - $secure = true; |
|
| 945 | - elseif (!empty($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https' || !empty($_SERVER['HTTP_X_FORWARDED_SSL']) && $_SERVER['HTTP_X_FORWARDED_SSL'] == 'on') |
|
| 946 | - $secure = true; |
|
| 1000 | + if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') { |
|
| 1001 | + $secure = true; |
|
| 1002 | + } elseif (!empty($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https' || !empty($_SERVER['HTTP_X_FORWARDED_SSL']) && $_SERVER['HTTP_X_FORWARDED_SSL'] == 'on') { |
|
| 1003 | + $secure = true; |
|
| 1004 | + } |
|
| 947 | 1005 | |
| 948 | 1006 | // Now, to put what we've learned together... and add a path. |
| 949 | 1007 | $incontext['detected_url'] = 'http' . ($secure ? 's' : '') . '://' . $host . substr($_SERVER['PHP_SELF'], 0, strrpos($_SERVER['PHP_SELF'], '/')); |
@@ -975,18 +1033,21 @@ discard block |
||
| 975 | 1033 | // Submitting? |
| 976 | 1034 | if (isset($_POST['boardurl'])) |
| 977 | 1035 | { |
| 978 | - if (substr($_POST['boardurl'], -10) == '/index.php') |
|
| 979 | - $_POST['boardurl'] = substr($_POST['boardurl'], 0, -10); |
|
| 980 | - elseif (substr($_POST['boardurl'], -1) == '/') |
|
| 981 | - $_POST['boardurl'] = substr($_POST['boardurl'], 0, -1); |
|
| 982 | - if (substr($_POST['boardurl'], 0, 7) != 'http://' && substr($_POST['boardurl'], 0, 7) != 'file://' && substr($_POST['boardurl'], 0, 8) != 'https://') |
|
| 983 | - $_POST['boardurl'] = 'http://' . $_POST['boardurl']; |
|
| 1036 | + if (substr($_POST['boardurl'], -10) == '/index.php') { |
|
| 1037 | + $_POST['boardurl'] = substr($_POST['boardurl'], 0, -10); |
|
| 1038 | + } elseif (substr($_POST['boardurl'], -1) == '/') { |
|
| 1039 | + $_POST['boardurl'] = substr($_POST['boardurl'], 0, -1); |
|
| 1040 | + } |
|
| 1041 | + if (substr($_POST['boardurl'], 0, 7) != 'http://' && substr($_POST['boardurl'], 0, 7) != 'file://' && substr($_POST['boardurl'], 0, 8) != 'https://') { |
|
| 1042 | + $_POST['boardurl'] = 'http://' . $_POST['boardurl']; |
|
| 1043 | + } |
|
| 984 | 1044 | |
| 985 | 1045 | //Make sure boardurl is aligned with ssl setting |
| 986 | - if (empty($_POST['force_ssl'])) |
|
| 987 | - $_POST['boardurl'] = strtr($_POST['boardurl'], array('https://' => 'http://')); |
|
| 988 | - else |
|
| 989 | - $_POST['boardurl'] = strtr($_POST['boardurl'], array('http://' => 'https://')); |
|
| 1046 | + if (empty($_POST['force_ssl'])) { |
|
| 1047 | + $_POST['boardurl'] = strtr($_POST['boardurl'], array('https://' => 'http://')); |
|
| 1048 | + } else { |
|
| 1049 | + $_POST['boardurl'] = strtr($_POST['boardurl'], array('http://' => 'https://')); |
|
| 1050 | + } |
|
| 990 | 1051 | |
| 991 | 1052 | // Save these variables. |
| 992 | 1053 | $vars = array( |
@@ -1025,10 +1086,10 @@ discard block |
||
| 1025 | 1086 | { |
| 1026 | 1087 | $incontext['error'] = sprintf($txt['error_utf8_version'], $databases[$db_type]['utf8_version']); |
| 1027 | 1088 | return false; |
| 1028 | - } |
|
| 1029 | - else |
|
| 1030 | - // Set the character set here. |
|
| 1089 | + } else { |
|
| 1090 | + // Set the character set here. |
|
| 1031 | 1091 | updateSettingsFile(array('db_character_set' => 'utf8')); |
| 1092 | + } |
|
| 1032 | 1093 | } |
| 1033 | 1094 | |
| 1034 | 1095 | // Good, skip on. |
@@ -1048,8 +1109,9 @@ discard block |
||
| 1048 | 1109 | $incontext['continue'] = 1; |
| 1049 | 1110 | |
| 1050 | 1111 | // Already done? |
| 1051 | - if (isset($_POST['pop_done'])) |
|
| 1052 | - return true; |
|
| 1112 | + if (isset($_POST['pop_done'])) { |
|
| 1113 | + return true; |
|
| 1114 | + } |
|
| 1053 | 1115 | |
| 1054 | 1116 | // Reload settings. |
| 1055 | 1117 | require(dirname(__FILE__) . '/Settings.php'); |
@@ -1067,8 +1129,9 @@ discard block |
||
| 1067 | 1129 | $modSettings = array(); |
| 1068 | 1130 | if ($result !== false) |
| 1069 | 1131 | { |
| 1070 | - while ($row = $smcFunc['db_fetch_assoc']($result)) |
|
| 1071 | - $modSettings[$row['variable']] = $row['value']; |
|
| 1132 | + while ($row = $smcFunc['db_fetch_assoc']($result)) { |
|
| 1133 | + $modSettings[$row['variable']] = $row['value']; |
|
| 1134 | + } |
|
| 1072 | 1135 | $smcFunc['db_free_result']($result); |
| 1073 | 1136 | |
| 1074 | 1137 | // Do they match? If so, this is just a refresh so charge on! |
@@ -1081,20 +1144,22 @@ discard block |
||
| 1081 | 1144 | $modSettings['disableQueryCheck'] = true; |
| 1082 | 1145 | |
| 1083 | 1146 | // If doing UTF8, select it. PostgreSQL requires passing it as a string... |
| 1084 | - if (!empty($db_character_set) && $db_character_set == 'utf8' && !empty($databases[$db_type]['utf8_support'])) |
|
| 1085 | - $smcFunc['db_query']('', ' |
|
| 1147 | + if (!empty($db_character_set) && $db_character_set == 'utf8' && !empty($databases[$db_type]['utf8_support'])) { |
|
| 1148 | + $smcFunc['db_query']('', ' |
|
| 1086 | 1149 | SET NAMES {string:utf8}', |
| 1087 | 1150 | array( |
| 1088 | 1151 | 'db_error_skip' => true, |
| 1089 | 1152 | 'utf8' => 'utf8', |
| 1090 | 1153 | ) |
| 1091 | 1154 | ); |
| 1155 | + } |
|
| 1092 | 1156 | |
| 1093 | 1157 | // Windows likes to leave the trailing slash, which yields to C:\path\to\SMF\/attachments... |
| 1094 | - if (substr(__DIR__, -1) == '\\') |
|
| 1095 | - $attachdir = __DIR__ . 'attachments'; |
|
| 1096 | - else |
|
| 1097 | - $attachdir = __DIR__ . '/attachments'; |
|
| 1158 | + if (substr(__DIR__, -1) == '\\') { |
|
| 1159 | + $attachdir = __DIR__ . 'attachments'; |
|
| 1160 | + } else { |
|
| 1161 | + $attachdir = __DIR__ . '/attachments'; |
|
| 1162 | + } |
|
| 1098 | 1163 | |
| 1099 | 1164 | $replaces = array( |
| 1100 | 1165 | '{$db_prefix}' => $db_prefix, |
@@ -1111,8 +1176,9 @@ discard block |
||
| 1111 | 1176 | |
| 1112 | 1177 | foreach ($txt as $key => $value) |
| 1113 | 1178 | { |
| 1114 | - if (substr($key, 0, 8) == 'default_') |
|
| 1115 | - $replaces['{$' . $key . '}'] = $smcFunc['db_escape_string']($value); |
|
| 1179 | + if (substr($key, 0, 8) == 'default_') { |
|
| 1180 | + $replaces['{$' . $key . '}'] = $smcFunc['db_escape_string']($value); |
|
| 1181 | + } |
|
| 1116 | 1182 | } |
| 1117 | 1183 | $replaces['{$default_reserved_names}'] = strtr($replaces['{$default_reserved_names}'], array('\\\\n' => '\\n')); |
| 1118 | 1184 | |
@@ -1127,8 +1193,9 @@ discard block |
||
| 1127 | 1193 | |
| 1128 | 1194 | while ($row = $smcFunc['db_fetch_assoc']($get_engines)) |
| 1129 | 1195 | { |
| 1130 | - if ($row['Support'] == 'YES' || $row['Support'] == 'DEFAULT') |
|
| 1131 | - $engines[] = $row['Engine']; |
|
| 1196 | + if ($row['Support'] == 'YES' || $row['Support'] == 'DEFAULT') { |
|
| 1197 | + $engines[] = $row['Engine']; |
|
| 1198 | + } |
|
| 1132 | 1199 | } |
| 1133 | 1200 | |
| 1134 | 1201 | // Done with this now |
@@ -1152,8 +1219,7 @@ discard block |
||
| 1152 | 1219 | $replaces['START TRANSACTION;'] = ''; |
| 1153 | 1220 | $replaces['COMMIT;'] = ''; |
| 1154 | 1221 | } |
| 1155 | - } |
|
| 1156 | - else |
|
| 1222 | + } else |
|
| 1157 | 1223 | { |
| 1158 | 1224 | $has_innodb = false; |
| 1159 | 1225 | } |
@@ -1175,21 +1241,24 @@ discard block |
||
| 1175 | 1241 | foreach ($sql_lines as $count => $line) |
| 1176 | 1242 | { |
| 1177 | 1243 | // No comments allowed! |
| 1178 | - if (substr(trim($line), 0, 1) != '#') |
|
| 1179 | - $current_statement .= "\n" . rtrim($line); |
|
| 1244 | + if (substr(trim($line), 0, 1) != '#') { |
|
| 1245 | + $current_statement .= "\n" . rtrim($line); |
|
| 1246 | + } |
|
| 1180 | 1247 | |
| 1181 | 1248 | // Is this the end of the query string? |
| 1182 | - if (empty($current_statement) || (preg_match('~;[\s]*$~s', $line) == 0 && $count != count($sql_lines))) |
|
| 1183 | - continue; |
|
| 1249 | + if (empty($current_statement) || (preg_match('~;[\s]*$~s', $line) == 0 && $count != count($sql_lines))) { |
|
| 1250 | + continue; |
|
| 1251 | + } |
|
| 1184 | 1252 | |
| 1185 | 1253 | // Does this table already exist? If so, don't insert more data into it! |
| 1186 | 1254 | if (preg_match('~^\s*INSERT INTO ([^\s\n\r]+?)~', $current_statement, $match) != 0 && in_array($match[1], $exists)) |
| 1187 | 1255 | { |
| 1188 | 1256 | preg_match_all('~\)[,;]~', $current_statement, $matches); |
| 1189 | - if (!empty($matches[0])) |
|
| 1190 | - $incontext['sql_results']['insert_dups'] += count($matches[0]); |
|
| 1191 | - else |
|
| 1192 | - $incontext['sql_results']['insert_dups']++; |
|
| 1257 | + if (!empty($matches[0])) { |
|
| 1258 | + $incontext['sql_results']['insert_dups'] += count($matches[0]); |
|
| 1259 | + } else { |
|
| 1260 | + $incontext['sql_results']['insert_dups']++; |
|
| 1261 | + } |
|
| 1193 | 1262 | |
| 1194 | 1263 | $current_statement = ''; |
| 1195 | 1264 | continue; |
@@ -1198,8 +1267,9 @@ discard block |
||
| 1198 | 1267 | if ($smcFunc['db_query']('', $current_statement, array('security_override' => true, 'db_error_skip' => true), $db_connection) === false) |
| 1199 | 1268 | { |
| 1200 | 1269 | // Use the appropriate function based on the DB type |
| 1201 | - if ($db_type == 'mysql' || $db_type == 'mysqli') |
|
| 1202 | - $db_errorno = $db_type . '_errno'; |
|
| 1270 | + if ($db_type == 'mysql' || $db_type == 'mysqli') { |
|
| 1271 | + $db_errorno = $db_type . '_errno'; |
|
| 1272 | + } |
|
| 1203 | 1273 | |
| 1204 | 1274 | // Error 1050: Table already exists! |
| 1205 | 1275 | // @todo Needs to be made better! |
@@ -1214,18 +1284,18 @@ discard block |
||
| 1214 | 1284 | // MySQLi requires a connection object. It's optional with MySQL and Postgres |
| 1215 | 1285 | $incontext['failures'][$count] = $smcFunc['db_error']($db_connection); |
| 1216 | 1286 | } |
| 1217 | - } |
|
| 1218 | - else |
|
| 1287 | + } else |
|
| 1219 | 1288 | { |
| 1220 | - if (preg_match('~^\s*CREATE TABLE ([^\s\n\r]+?)~', $current_statement, $match) == 1) |
|
| 1221 | - $incontext['sql_results']['tables']++; |
|
| 1222 | - elseif (preg_match('~^\s*INSERT INTO ([^\s\n\r]+?)~', $current_statement, $match) == 1) |
|
| 1289 | + if (preg_match('~^\s*CREATE TABLE ([^\s\n\r]+?)~', $current_statement, $match) == 1) { |
|
| 1290 | + $incontext['sql_results']['tables']++; |
|
| 1291 | + } elseif (preg_match('~^\s*INSERT INTO ([^\s\n\r]+?)~', $current_statement, $match) == 1) |
|
| 1223 | 1292 | { |
| 1224 | 1293 | preg_match_all('~\)[,;]~', $current_statement, $matches); |
| 1225 | - if (!empty($matches[0])) |
|
| 1226 | - $incontext['sql_results']['inserts'] += count($matches[0]); |
|
| 1227 | - else |
|
| 1228 | - $incontext['sql_results']['inserts']++; |
|
| 1294 | + if (!empty($matches[0])) { |
|
| 1295 | + $incontext['sql_results']['inserts'] += count($matches[0]); |
|
| 1296 | + } else { |
|
| 1297 | + $incontext['sql_results']['inserts']++; |
|
| 1298 | + } |
|
| 1229 | 1299 | } |
| 1230 | 1300 | } |
| 1231 | 1301 | |
@@ -1238,15 +1308,17 @@ discard block |
||
| 1238 | 1308 | // Sort out the context for the SQL. |
| 1239 | 1309 | foreach ($incontext['sql_results'] as $key => $number) |
| 1240 | 1310 | { |
| 1241 | - if ($number == 0) |
|
| 1242 | - unset($incontext['sql_results'][$key]); |
|
| 1243 | - else |
|
| 1244 | - $incontext['sql_results'][$key] = sprintf($txt['db_populate_' . $key], $number); |
|
| 1311 | + if ($number == 0) { |
|
| 1312 | + unset($incontext['sql_results'][$key]); |
|
| 1313 | + } else { |
|
| 1314 | + $incontext['sql_results'][$key] = sprintf($txt['db_populate_' . $key], $number); |
|
| 1315 | + } |
|
| 1245 | 1316 | } |
| 1246 | 1317 | |
| 1247 | 1318 | // Make sure UTF will be used globally. |
| 1248 | - 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']))) |
|
| 1249 | - $newSettings[] = array('global_character_set', 'UTF-8'); |
|
| 1319 | + 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']))) { |
|
| 1320 | + $newSettings[] = array('global_character_set', 'UTF-8'); |
|
| 1321 | + } |
|
| 1250 | 1322 | |
| 1251 | 1323 | // Auto-detect local & global cookie settings |
| 1252 | 1324 | $url_parts = parse_url($boardurl); |
@@ -1275,15 +1347,19 @@ discard block |
||
| 1275 | 1347 | |
| 1276 | 1348 | // Look for subfolder, if found, set localCookie |
| 1277 | 1349 | // Checking for len > 1 ensures you don't have just a slash... |
| 1278 | - if (!empty($url_parts['path']) && strlen($url_parts['path']) > 1) |
|
| 1279 | - $localCookies = '1'; |
|
| 1350 | + if (!empty($url_parts['path']) && strlen($url_parts['path']) > 1) { |
|
| 1351 | + $localCookies = '1'; |
|
| 1352 | + } |
|
| 1280 | 1353 | |
| 1281 | - if (isset($globalCookies)) |
|
| 1282 | - $newSettings[] = array('globalCookies', $globalCookies); |
|
| 1283 | - if (isset($globalCookiesDomain)) |
|
| 1284 | - $newSettings[] = array('globalCookiesDomain', $globalCookiesDomain); |
|
| 1285 | - if (isset($localCookies)) |
|
| 1286 | - $newSettings[] = array('localCookies', $localCookies); |
|
| 1354 | + if (isset($globalCookies)) { |
|
| 1355 | + $newSettings[] = array('globalCookies', $globalCookies); |
|
| 1356 | + } |
|
| 1357 | + if (isset($globalCookiesDomain)) { |
|
| 1358 | + $newSettings[] = array('globalCookiesDomain', $globalCookiesDomain); |
|
| 1359 | + } |
|
| 1360 | + if (isset($localCookies)) { |
|
| 1361 | + $newSettings[] = array('localCookies', $localCookies); |
|
| 1362 | + } |
|
| 1287 | 1363 | } |
| 1288 | 1364 | |
| 1289 | 1365 | // Are we allowing stat collection? |
@@ -1301,16 +1377,17 @@ discard block |
||
| 1301 | 1377 | fwrite($fp, $out); |
| 1302 | 1378 | |
| 1303 | 1379 | $return_data = ''; |
| 1304 | - while (!feof($fp)) |
|
| 1305 | - $return_data .= fgets($fp, 128); |
|
| 1380 | + while (!feof($fp)) { |
|
| 1381 | + $return_data .= fgets($fp, 128); |
|
| 1382 | + } |
|
| 1306 | 1383 | |
| 1307 | 1384 | fclose($fp); |
| 1308 | 1385 | |
| 1309 | 1386 | // Get the unique site ID. |
| 1310 | 1387 | preg_match('~SITE-ID:\s(\w{10})~', $return_data, $ID); |
| 1311 | 1388 | |
| 1312 | - if (!empty($ID[1])) |
|
| 1313 | - $smcFunc['db_insert']('replace', |
|
| 1389 | + if (!empty($ID[1])) { |
|
| 1390 | + $smcFunc['db_insert']('replace', |
|
| 1314 | 1391 | $db_prefix . 'settings', |
| 1315 | 1392 | array('variable' => 'string', 'value' => 'string'), |
| 1316 | 1393 | array( |
@@ -1319,11 +1396,12 @@ discard block |
||
| 1319 | 1396 | ), |
| 1320 | 1397 | array('variable') |
| 1321 | 1398 | ); |
| 1399 | + } |
|
| 1322 | 1400 | } |
| 1323 | 1401 | } |
| 1324 | 1402 | // Don't remove stat collection unless we unchecked the box for real, not from the loop. |
| 1325 | - elseif (empty($_POST['stats']) && empty($upcontext['allow_sm_stats'])) |
|
| 1326 | - $smcFunc['db_query']('', ' |
|
| 1403 | + elseif (empty($_POST['stats']) && empty($upcontext['allow_sm_stats'])) { |
|
| 1404 | + $smcFunc['db_query']('', ' |
|
| 1327 | 1405 | DELETE FROM {db_prefix}settings |
| 1328 | 1406 | WHERE variable = {string:enable_sm_stats}', |
| 1329 | 1407 | array( |
@@ -1331,20 +1409,23 @@ discard block |
||
| 1331 | 1409 | 'db_error_skip' => true, |
| 1332 | 1410 | ) |
| 1333 | 1411 | ); |
| 1412 | + } |
|
| 1334 | 1413 | |
| 1335 | 1414 | // Are we enabling SSL? |
| 1336 | - if (!empty($_POST['force_ssl'])) |
|
| 1337 | - $newSettings[] = array('force_ssl', 2); |
|
| 1415 | + if (!empty($_POST['force_ssl'])) { |
|
| 1416 | + $newSettings[] = array('force_ssl', 2); |
|
| 1417 | + } |
|
| 1338 | 1418 | |
| 1339 | 1419 | // Setting a timezone is required. |
| 1340 | 1420 | if (!isset($modSettings['default_timezone']) && function_exists('date_default_timezone_set')) |
| 1341 | 1421 | { |
| 1342 | 1422 | // Get PHP's default timezone, if set |
| 1343 | 1423 | $ini_tz = ini_get('date.timezone'); |
| 1344 | - if (!empty($ini_tz)) |
|
| 1345 | - $timezone_id = $ini_tz; |
|
| 1346 | - else |
|
| 1347 | - $timezone_id = ''; |
|
| 1424 | + if (!empty($ini_tz)) { |
|
| 1425 | + $timezone_id = $ini_tz; |
|
| 1426 | + } else { |
|
| 1427 | + $timezone_id = ''; |
|
| 1428 | + } |
|
| 1348 | 1429 | |
| 1349 | 1430 | // If date.timezone is unset, invalid, or just plain weird, make a best guess |
| 1350 | 1431 | if (!in_array($timezone_id, timezone_identifiers_list())) |
@@ -1353,8 +1434,9 @@ discard block |
||
| 1353 | 1434 | $timezone_id = timezone_name_from_abbr('', $server_offset, 0); |
| 1354 | 1435 | } |
| 1355 | 1436 | |
| 1356 | - if (date_default_timezone_set($timezone_id)) |
|
| 1357 | - $newSettings[] = array('default_timezone', $timezone_id); |
|
| 1437 | + if (date_default_timezone_set($timezone_id)) { |
|
| 1438 | + $newSettings[] = array('default_timezone', $timezone_id); |
|
| 1439 | + } |
|
| 1358 | 1440 | } |
| 1359 | 1441 | |
| 1360 | 1442 | if (!empty($newSettings)) |
@@ -1385,16 +1467,18 @@ discard block |
||
| 1385 | 1467 | } |
| 1386 | 1468 | |
| 1387 | 1469 | // MySQL specific stuff |
| 1388 | - if (substr($db_type, 0, 5) != 'mysql') |
|
| 1389 | - return false; |
|
| 1470 | + if (substr($db_type, 0, 5) != 'mysql') { |
|
| 1471 | + return false; |
|
| 1472 | + } |
|
| 1390 | 1473 | |
| 1391 | 1474 | // Find database user privileges. |
| 1392 | 1475 | $privs = array(); |
| 1393 | 1476 | $get_privs = $smcFunc['db_query']('', 'SHOW PRIVILEGES', array()); |
| 1394 | 1477 | while ($row = $smcFunc['db_fetch_assoc']($get_privs)) |
| 1395 | 1478 | { |
| 1396 | - if ($row['Privilege'] == 'Alter') |
|
| 1397 | - $privs[] = $row['Privilege']; |
|
| 1479 | + if ($row['Privilege'] == 'Alter') { |
|
| 1480 | + $privs[] = $row['Privilege']; |
|
| 1481 | + } |
|
| 1398 | 1482 | } |
| 1399 | 1483 | $smcFunc['db_free_result']($get_privs); |
| 1400 | 1484 | |
@@ -1424,8 +1508,9 @@ discard block |
||
| 1424 | 1508 | $incontext['continue'] = 1; |
| 1425 | 1509 | |
| 1426 | 1510 | // Skipping? |
| 1427 | - if (!empty($_POST['skip'])) |
|
| 1428 | - return true; |
|
| 1511 | + if (!empty($_POST['skip'])) { |
|
| 1512 | + return true; |
|
| 1513 | + } |
|
| 1429 | 1514 | |
| 1430 | 1515 | // Need this to check whether we need the database password. |
| 1431 | 1516 | require(dirname(__FILE__) . '/Settings.php'); |
@@ -1442,18 +1527,22 @@ discard block |
||
| 1442 | 1527 | // We need this to properly hash the password for Admin |
| 1443 | 1528 | $smcFunc['strtolower'] = $db_character_set != 'utf8' && $txt['lang_character_set'] != 'UTF-8' ? 'strtolower' : function($string) { |
| 1444 | 1529 | global $sourcedir; |
| 1445 | - if (function_exists('mb_strtolower')) |
|
| 1446 | - return mb_strtolower($string, 'UTF-8'); |
|
| 1530 | + if (function_exists('mb_strtolower')) { |
|
| 1531 | + return mb_strtolower($string, 'UTF-8'); |
|
| 1532 | + } |
|
| 1447 | 1533 | require_once($sourcedir . '/Subs-Charset.php'); |
| 1448 | 1534 | return utf8_strtolower($string); |
| 1449 | 1535 | }; |
| 1450 | 1536 | |
| 1451 | - if (!isset($_POST['username'])) |
|
| 1452 | - $_POST['username'] = ''; |
|
| 1453 | - if (!isset($_POST['email'])) |
|
| 1454 | - $_POST['email'] = ''; |
|
| 1455 | - if (!isset($_POST['server_email'])) |
|
| 1456 | - $_POST['server_email'] = ''; |
|
| 1537 | + if (!isset($_POST['username'])) { |
|
| 1538 | + $_POST['username'] = ''; |
|
| 1539 | + } |
|
| 1540 | + if (!isset($_POST['email'])) { |
|
| 1541 | + $_POST['email'] = ''; |
|
| 1542 | + } |
|
| 1543 | + if (!isset($_POST['server_email'])) { |
|
| 1544 | + $_POST['server_email'] = ''; |
|
| 1545 | + } |
|
| 1457 | 1546 | |
| 1458 | 1547 | $incontext['username'] = htmlspecialchars(stripslashes($_POST['username'])); |
| 1459 | 1548 | $incontext['email'] = htmlspecialchars(stripslashes($_POST['email'])); |
@@ -1472,8 +1561,9 @@ discard block |
||
| 1472 | 1561 | 'admin_group' => 1, |
| 1473 | 1562 | ) |
| 1474 | 1563 | ); |
| 1475 | - if ($smcFunc['db_num_rows']($request) != 0) |
|
| 1476 | - $incontext['skip'] = 1; |
|
| 1564 | + if ($smcFunc['db_num_rows']($request) != 0) { |
|
| 1565 | + $incontext['skip'] = 1; |
|
| 1566 | + } |
|
| 1477 | 1567 | $smcFunc['db_free_result']($request); |
| 1478 | 1568 | |
| 1479 | 1569 | // Trying to create an account? |
@@ -1504,8 +1594,9 @@ discard block |
||
| 1504 | 1594 | } |
| 1505 | 1595 | |
| 1506 | 1596 | // Update the webmaster's email? |
| 1507 | - if (!empty($_POST['server_email']) && (empty($webmaster_email) || $webmaster_email == '[email protected]')) |
|
| 1508 | - updateSettingsFile(array('webmaster_email' => $_POST['server_email'])); |
|
| 1597 | + if (!empty($_POST['server_email']) && (empty($webmaster_email) || $webmaster_email == '[email protected]')) { |
|
| 1598 | + updateSettingsFile(array('webmaster_email' => $_POST['server_email'])); |
|
| 1599 | + } |
|
| 1509 | 1600 | |
| 1510 | 1601 | // Work out whether we're going to have dodgy characters and remove them. |
| 1511 | 1602 | $invalid_characters = preg_match('~[<>&"\'=\\\]~', $_POST['username']) != 0; |
@@ -1528,32 +1619,27 @@ discard block |
||
| 1528 | 1619 | $smcFunc['db_free_result']($result); |
| 1529 | 1620 | |
| 1530 | 1621 | $incontext['account_existed'] = $txt['error_user_settings_taken']; |
| 1531 | - } |
|
| 1532 | - elseif ($_POST['username'] == '' || strlen($_POST['username']) > 25) |
|
| 1622 | + } elseif ($_POST['username'] == '' || strlen($_POST['username']) > 25) |
|
| 1533 | 1623 | { |
| 1534 | 1624 | // Try the previous step again. |
| 1535 | 1625 | $incontext['error'] = $_POST['username'] == '' ? $txt['error_username_left_empty'] : $txt['error_username_too_long']; |
| 1536 | 1626 | return false; |
| 1537 | - } |
|
| 1538 | - elseif ($invalid_characters || $_POST['username'] == '_' || $_POST['username'] == '|' || strpos($_POST['username'], '[code') !== false || strpos($_POST['username'], '[/code') !== false) |
|
| 1627 | + } elseif ($invalid_characters || $_POST['username'] == '_' || $_POST['username'] == '|' || strpos($_POST['username'], '[code') !== false || strpos($_POST['username'], '[/code') !== false) |
|
| 1539 | 1628 | { |
| 1540 | 1629 | // Try the previous step again. |
| 1541 | 1630 | $incontext['error'] = $txt['error_invalid_characters_username']; |
| 1542 | 1631 | return false; |
| 1543 | - } |
|
| 1544 | - elseif (empty($_POST['email']) || !filter_var(stripslashes($_POST['email']), FILTER_VALIDATE_EMAIL) || strlen(stripslashes($_POST['email'])) > 255) |
|
| 1632 | + } elseif (empty($_POST['email']) || !filter_var(stripslashes($_POST['email']), FILTER_VALIDATE_EMAIL) || strlen(stripslashes($_POST['email'])) > 255) |
|
| 1545 | 1633 | { |
| 1546 | 1634 | // One step back, this time fill out a proper admin email address. |
| 1547 | 1635 | $incontext['error'] = sprintf($txt['error_valid_admin_email_needed'], $_POST['username']); |
| 1548 | 1636 | return false; |
| 1549 | - } |
|
| 1550 | - elseif (empty($_POST['server_email']) || !filter_var(stripslashes($_POST['server_email']), FILTER_VALIDATE_EMAIL) || strlen(stripslashes($_POST['server_email'])) > 255) |
|
| 1637 | + } elseif (empty($_POST['server_email']) || !filter_var(stripslashes($_POST['server_email']), FILTER_VALIDATE_EMAIL) || strlen(stripslashes($_POST['server_email'])) > 255) |
|
| 1551 | 1638 | { |
| 1552 | 1639 | // One step back, this time fill out a proper admin email address. |
| 1553 | 1640 | $incontext['error'] = $txt['error_valid_server_email_needed']; |
| 1554 | 1641 | return false; |
| 1555 | - } |
|
| 1556 | - elseif ($_POST['username'] != '') |
|
| 1642 | + } elseif ($_POST['username'] != '') |
|
| 1557 | 1643 | { |
| 1558 | 1644 | $incontext['member_salt'] = substr(md5(mt_rand()), 0, 4); |
| 1559 | 1645 | |
@@ -1621,17 +1707,19 @@ discard block |
||
| 1621 | 1707 | reloadSettings(); |
| 1622 | 1708 | |
| 1623 | 1709 | // Bring a warning over. |
| 1624 | - if (!empty($incontext['account_existed'])) |
|
| 1625 | - $incontext['warning'] = $incontext['account_existed']; |
|
| 1710 | + if (!empty($incontext['account_existed'])) { |
|
| 1711 | + $incontext['warning'] = $incontext['account_existed']; |
|
| 1712 | + } |
|
| 1626 | 1713 | |
| 1627 | - if (!empty($db_character_set) && !empty($databases[$db_type]['utf8_support'])) |
|
| 1628 | - $smcFunc['db_query']('', ' |
|
| 1714 | + if (!empty($db_character_set) && !empty($databases[$db_type]['utf8_support'])) { |
|
| 1715 | + $smcFunc['db_query']('', ' |
|
| 1629 | 1716 | SET NAMES {string:db_character_set}', |
| 1630 | 1717 | array( |
| 1631 | 1718 | 'db_character_set' => $db_character_set, |
| 1632 | 1719 | 'db_error_skip' => true, |
| 1633 | 1720 | ) |
| 1634 | 1721 | ); |
| 1722 | + } |
|
| 1635 | 1723 | |
| 1636 | 1724 | // As track stats is by default enabled let's add some activity. |
| 1637 | 1725 | $smcFunc['db_insert']('ignore', |
@@ -1652,14 +1740,16 @@ discard block |
||
| 1652 | 1740 | // Only proceed if we can load the data. |
| 1653 | 1741 | if ($request) |
| 1654 | 1742 | { |
| 1655 | - while ($row = $smcFunc['db_fetch_row']($request)) |
|
| 1656 | - $modSettings[$row[0]] = $row[1]; |
|
| 1743 | + while ($row = $smcFunc['db_fetch_row']($request)) { |
|
| 1744 | + $modSettings[$row[0]] = $row[1]; |
|
| 1745 | + } |
|
| 1657 | 1746 | $smcFunc['db_free_result']($request); |
| 1658 | 1747 | } |
| 1659 | 1748 | |
| 1660 | 1749 | // Automatically log them in ;) |
| 1661 | - if (isset($incontext['member_id']) && isset($incontext['member_salt'])) |
|
| 1662 | - setLoginCookie(3153600 * 60, $incontext['member_id'], hash_salt($_POST['password1'], $incontext['member_salt'])); |
|
| 1750 | + if (isset($incontext['member_id']) && isset($incontext['member_salt'])) { |
|
| 1751 | + setLoginCookie(3153600 * 60, $incontext['member_id'], hash_salt($_POST['password1'], $incontext['member_salt'])); |
|
| 1752 | + } |
|
| 1663 | 1753 | |
| 1664 | 1754 | $result = $smcFunc['db_query']('', ' |
| 1665 | 1755 | SELECT value |
@@ -1670,13 +1760,14 @@ discard block |
||
| 1670 | 1760 | 'db_error_skip' => true, |
| 1671 | 1761 | ) |
| 1672 | 1762 | ); |
| 1673 | - if ($smcFunc['db_num_rows']($result) != 0) |
|
| 1674 | - list ($db_sessions) = $smcFunc['db_fetch_row']($result); |
|
| 1763 | + if ($smcFunc['db_num_rows']($result) != 0) { |
|
| 1764 | + list ($db_sessions) = $smcFunc['db_fetch_row']($result); |
|
| 1765 | + } |
|
| 1675 | 1766 | $smcFunc['db_free_result']($result); |
| 1676 | 1767 | |
| 1677 | - if (empty($db_sessions)) |
|
| 1678 | - $_SESSION['admin_time'] = time(); |
|
| 1679 | - else |
|
| 1768 | + if (empty($db_sessions)) { |
|
| 1769 | + $_SESSION['admin_time'] = time(); |
|
| 1770 | + } else |
|
| 1680 | 1771 | { |
| 1681 | 1772 | $_SERVER['HTTP_USER_AGENT'] = substr($_SERVER['HTTP_USER_AGENT'], 0, 211); |
| 1682 | 1773 | |
@@ -1700,8 +1791,9 @@ discard block |
||
| 1700 | 1791 | $smcFunc['strtolower'] = $db_character_set != 'utf8' && $txt['lang_character_set'] != 'UTF-8' ? 'strtolower' : |
| 1701 | 1792 | function($string){ |
| 1702 | 1793 | global $sourcedir; |
| 1703 | - if (function_exists('mb_strtolower')) |
|
| 1704 | - return mb_strtolower($string, 'UTF-8'); |
|
| 1794 | + if (function_exists('mb_strtolower')) { |
|
| 1795 | + return mb_strtolower($string, 'UTF-8'); |
|
| 1796 | + } |
|
| 1705 | 1797 | require_once($sourcedir . '/Subs-Charset.php'); |
| 1706 | 1798 | return utf8_strtolower($string); |
| 1707 | 1799 | }; |
@@ -1717,8 +1809,9 @@ discard block |
||
| 1717 | 1809 | ) |
| 1718 | 1810 | ); |
| 1719 | 1811 | $context['utf8'] = $db_character_set === 'utf8' || $txt['lang_character_set'] === 'UTF-8'; |
| 1720 | - if ($smcFunc['db_num_rows']($request) > 0) |
|
| 1721 | - updateStats('subject', 1, htmlspecialchars($txt['default_topic_subject'])); |
|
| 1812 | + if ($smcFunc['db_num_rows']($request) > 0) { |
|
| 1813 | + updateStats('subject', 1, htmlspecialchars($txt['default_topic_subject'])); |
|
| 1814 | + } |
|
| 1722 | 1815 | $smcFunc['db_free_result']($request); |
| 1723 | 1816 | |
| 1724 | 1817 | // Now is the perfect time to fetch the SM files. |
@@ -1737,8 +1830,9 @@ discard block |
||
| 1737 | 1830 | |
| 1738 | 1831 | // Check if we need some stupid MySQL fix. |
| 1739 | 1832 | $server_version = $smcFunc['db_server_info'](); |
| 1740 | - if (($db_type == 'mysql' || $db_type == 'mysqli') && in_array(substr($server_version, 0, 6), array('5.0.50', '5.0.51'))) |
|
| 1741 | - updateSettings(array('db_mysql_group_by_fix' => '1')); |
|
| 1833 | + if (($db_type == 'mysql' || $db_type == 'mysqli') && in_array(substr($server_version, 0, 6), array('5.0.50', '5.0.51'))) { |
|
| 1834 | + updateSettings(array('db_mysql_group_by_fix' => '1')); |
|
| 1835 | + } |
|
| 1742 | 1836 | |
| 1743 | 1837 | // Some final context for the template. |
| 1744 | 1838 | $incontext['dir_still_writable'] = is_writable(dirname(__FILE__)) && substr(__FILE__, 1, 2) != ':\\'; |
@@ -1758,8 +1852,9 @@ discard block |
||
| 1758 | 1852 | $settingsArray = file(dirname(__FILE__) . '/Settings.php'); |
| 1759 | 1853 | |
| 1760 | 1854 | // @todo Do we just want to read the file in clean, and split it this way always? |
| 1761 | - if (count($settingsArray) == 1) |
|
| 1762 | - $settingsArray = preg_split('~[\r\n]~', $settingsArray[0]); |
|
| 1855 | + if (count($settingsArray) == 1) { |
|
| 1856 | + $settingsArray = preg_split('~[\r\n]~', $settingsArray[0]); |
|
| 1857 | + } |
|
| 1763 | 1858 | |
| 1764 | 1859 | for ($i = 0, $n = count($settingsArray); $i < $n; $i++) |
| 1765 | 1860 | { |
@@ -1767,25 +1862,29 @@ discard block |
||
| 1767 | 1862 | if (trim($settingsArray[$i]) == 'if (file_exists(dirname(__FILE__) . \'/install.php\'))' && trim($settingsArray[$i + 1]) == '{' && trim($settingsArray[$i + 9]) == '}') |
| 1768 | 1863 | { |
| 1769 | 1864 | // Set the ten lines to nothing. |
| 1770 | - for ($j=0; $j < 10; $j++) |
|
| 1771 | - $settingsArray[$i++] = ''; |
|
| 1865 | + for ($j=0; $j < 10; $j++) { |
|
| 1866 | + $settingsArray[$i++] = ''; |
|
| 1867 | + } |
|
| 1772 | 1868 | |
| 1773 | 1869 | continue; |
| 1774 | 1870 | } |
| 1775 | 1871 | |
| 1776 | - if (trim($settingsArray[$i]) == '?' . '>') |
|
| 1777 | - $settingsArray[$i] = ''; |
|
| 1872 | + if (trim($settingsArray[$i]) == '?' . '>') { |
|
| 1873 | + $settingsArray[$i] = ''; |
|
| 1874 | + } |
|
| 1778 | 1875 | |
| 1779 | 1876 | // Don't trim or bother with it if it's not a variable. |
| 1780 | - if (substr($settingsArray[$i], 0, 1) != '$') |
|
| 1781 | - continue; |
|
| 1877 | + if (substr($settingsArray[$i], 0, 1) != '$') { |
|
| 1878 | + continue; |
|
| 1879 | + } |
|
| 1782 | 1880 | |
| 1783 | 1881 | $settingsArray[$i] = rtrim($settingsArray[$i]) . "\n"; |
| 1784 | 1882 | |
| 1785 | - foreach ($vars as $var => $val) |
|
| 1786 | - if (strncasecmp($settingsArray[$i], '$' . $var, 1 + strlen($var)) == 0) |
|
| 1883 | + foreach ($vars as $var => $val) { |
|
| 1884 | + if (strncasecmp($settingsArray[$i], '$' . $var, 1 + strlen($var)) == 0) |
|
| 1787 | 1885 | { |
| 1788 | 1886 | $comment = strstr($settingsArray[$i], '#'); |
| 1887 | + } |
|
| 1789 | 1888 | $settingsArray[$i] = '$' . $var . ' = \'' . $val . '\';' . ($comment != '' ? "\t\t" . $comment : "\n"); |
| 1790 | 1889 | unset($vars[$var]); |
| 1791 | 1890 | } |
@@ -1795,36 +1894,41 @@ discard block |
||
| 1795 | 1894 | if (!empty($vars)) |
| 1796 | 1895 | { |
| 1797 | 1896 | $settingsArray[$i++] = ''; |
| 1798 | - foreach ($vars as $var => $val) |
|
| 1799 | - $settingsArray[$i++] = '$' . $var . ' = \'' . $val . '\';' . "\n"; |
|
| 1897 | + foreach ($vars as $var => $val) { |
|
| 1898 | + $settingsArray[$i++] = '$' . $var . ' = \'' . $val . '\';' . "\n"; |
|
| 1899 | + } |
|
| 1800 | 1900 | } |
| 1801 | 1901 | |
| 1802 | 1902 | // Blank out the file - done to fix a oddity with some servers. |
| 1803 | 1903 | $fp = @fopen(dirname(__FILE__) . '/Settings.php', 'w'); |
| 1804 | - if (!$fp) |
|
| 1805 | - return false; |
|
| 1904 | + if (!$fp) { |
|
| 1905 | + return false; |
|
| 1906 | + } |
|
| 1806 | 1907 | fclose($fp); |
| 1807 | 1908 | |
| 1808 | 1909 | $fp = fopen(dirname(__FILE__) . '/Settings.php', 'r+'); |
| 1809 | 1910 | |
| 1810 | 1911 | // Gotta have one of these ;) |
| 1811 | - if (trim($settingsArray[0]) != '<?php') |
|
| 1812 | - fwrite($fp, "<?php\n"); |
|
| 1912 | + if (trim($settingsArray[0]) != '<?php') { |
|
| 1913 | + fwrite($fp, "<?php\n"); |
|
| 1914 | + } |
|
| 1813 | 1915 | |
| 1814 | 1916 | $lines = count($settingsArray); |
| 1815 | 1917 | for ($i = 0; $i < $lines - 1; $i++) |
| 1816 | 1918 | { |
| 1817 | 1919 | // Don't just write a bunch of blank lines. |
| 1818 | - if ($settingsArray[$i] != '' || @$settingsArray[$i - 1] != '') |
|
| 1819 | - fwrite($fp, strtr($settingsArray[$i], "\r", '')); |
|
| 1920 | + if ($settingsArray[$i] != '' || @$settingsArray[$i - 1] != '') { |
|
| 1921 | + fwrite($fp, strtr($settingsArray[$i], "\r", '')); |
|
| 1922 | + } |
|
| 1820 | 1923 | } |
| 1821 | 1924 | fwrite($fp, $settingsArray[$i] . '?' . '>'); |
| 1822 | 1925 | fclose($fp); |
| 1823 | 1926 | |
| 1824 | 1927 | // Even though on normal installations the filemtime should prevent this being used by the installer incorrectly |
| 1825 | 1928 | // it seems that there are times it might not. So let's MAKE it dump the cache. |
| 1826 | - if (function_exists('opcache_invalidate')) |
|
| 1827 | - opcache_invalidate(dirname(__FILE__) . '/Settings.php', true); |
|
| 1929 | + if (function_exists('opcache_invalidate')) { |
|
| 1930 | + opcache_invalidate(dirname(__FILE__) . '/Settings.php', true); |
|
| 1931 | + } |
|
| 1828 | 1932 | |
| 1829 | 1933 | return true; |
| 1830 | 1934 | } |
@@ -1849,9 +1953,9 @@ discard block |
||
| 1849 | 1953 | SecFilterScanPOST Off |
| 1850 | 1954 | </IfModule>'; |
| 1851 | 1955 | |
| 1852 | - if (!function_exists('apache_get_modules') || !in_array('mod_security', apache_get_modules())) |
|
| 1853 | - return true; |
|
| 1854 | - elseif (file_exists(dirname(__FILE__) . '/.htaccess') && is_writable(dirname(__FILE__) . '/.htaccess')) |
|
| 1956 | + if (!function_exists('apache_get_modules') || !in_array('mod_security', apache_get_modules())) { |
|
| 1957 | + return true; |
|
| 1958 | + } elseif (file_exists(dirname(__FILE__) . '/.htaccess') && is_writable(dirname(__FILE__) . '/.htaccess')) |
|
| 1855 | 1959 | { |
| 1856 | 1960 | $current_htaccess = implode('', file(dirname(__FILE__) . '/.htaccess')); |
| 1857 | 1961 | |
@@ -1863,29 +1967,28 @@ discard block |
||
| 1863 | 1967 | fwrite($ht_handle, $htaccess_addition); |
| 1864 | 1968 | fclose($ht_handle); |
| 1865 | 1969 | return true; |
| 1970 | + } else { |
|
| 1971 | + return false; |
|
| 1866 | 1972 | } |
| 1867 | - else |
|
| 1868 | - return false; |
|
| 1973 | + } else { |
|
| 1974 | + return true; |
|
| 1869 | 1975 | } |
| 1870 | - else |
|
| 1871 | - return true; |
|
| 1872 | - } |
|
| 1873 | - elseif (file_exists(dirname(__FILE__) . '/.htaccess')) |
|
| 1874 | - return strpos(implode('', file(dirname(__FILE__) . '/.htaccess')), '<IfModule mod_security.c>') !== false; |
|
| 1875 | - elseif (is_writable(dirname(__FILE__))) |
|
| 1976 | + } elseif (file_exists(dirname(__FILE__) . '/.htaccess')) { |
|
| 1977 | + return strpos(implode('', file(dirname(__FILE__) . '/.htaccess')), '<IfModule mod_security.c>') !== false; |
|
| 1978 | + } elseif (is_writable(dirname(__FILE__))) |
|
| 1876 | 1979 | { |
| 1877 | 1980 | if ($ht_handle = fopen(dirname(__FILE__) . '/.htaccess', 'w')) |
| 1878 | 1981 | { |
| 1879 | 1982 | fwrite($ht_handle, $htaccess_addition); |
| 1880 | 1983 | fclose($ht_handle); |
| 1881 | 1984 | return true; |
| 1985 | + } else { |
|
| 1986 | + return false; |
|
| 1882 | 1987 | } |
| 1883 | - else |
|
| 1988 | + } else { |
|
| 1884 | 1989 | return false; |
| 1885 | 1990 | } |
| 1886 | - else |
|
| 1887 | - return false; |
|
| 1888 | -} |
|
| 1991 | + } |
|
| 1889 | 1992 | |
| 1890 | 1993 | function template_install_above() |
| 1891 | 1994 | { |
@@ -1923,9 +2026,10 @@ discard block |
||
| 1923 | 2026 | <label for="installer_language">', $txt['installer_language'], ':</label> |
| 1924 | 2027 | <select id="installer_language" name="lang_file" onchange="location.href = \'', $installurl, '?lang_file=\' + this.options[this.selectedIndex].value;">'; |
| 1925 | 2028 | |
| 1926 | - foreach ($incontext['detected_languages'] as $lang => $name) |
|
| 1927 | - echo ' |
|
| 2029 | + foreach ($incontext['detected_languages'] as $lang => $name) { |
|
| 2030 | + echo ' |
|
| 1928 | 2031 | <option', isset($_SESSION['installer_temp_lang']) && $_SESSION['installer_temp_lang'] == $lang ? ' selected' : '', ' value="', $lang, '">', $name, '</option>'; |
| 2032 | + } |
|
| 1929 | 2033 | |
| 1930 | 2034 | echo ' |
| 1931 | 2035 | </select> |
@@ -1945,9 +2049,10 @@ discard block |
||
| 1945 | 2049 | <h2>', $txt['upgrade_progress'], '</h2> |
| 1946 | 2050 | <ul>'; |
| 1947 | 2051 | |
| 1948 | - foreach ($incontext['steps'] as $num => $step) |
|
| 1949 | - echo ' |
|
| 2052 | + foreach ($incontext['steps'] as $num => $step) { |
|
| 2053 | + echo ' |
|
| 1950 | 2054 | <li class="', $num < $incontext['current_step'] ? 'stepdone' : ($num == $incontext['current_step'] ? 'stepcurrent' : 'stepwaiting'), '">', $txt['upgrade_step'], ' ', $step[0], ': ', $step[1], '</li>'; |
| 2055 | + } |
|
| 1951 | 2056 | |
| 1952 | 2057 | echo ' |
| 1953 | 2058 | </ul> |
@@ -1972,20 +2077,23 @@ discard block |
||
| 1972 | 2077 | echo ' |
| 1973 | 2078 | <div class="floatright">'; |
| 1974 | 2079 | |
| 1975 | - if (!empty($incontext['continue'])) |
|
| 1976 | - echo ' |
|
| 2080 | + if (!empty($incontext['continue'])) { |
|
| 2081 | + echo ' |
|
| 1977 | 2082 | <input type="submit" id="contbutt" name="contbutt" value="', $txt['upgrade_continue'], '" onclick="return submitThisOnce(this);" class="button" />'; |
| 1978 | - if (!empty($incontext['skip'])) |
|
| 1979 | - echo ' |
|
| 2083 | + } |
|
| 2084 | + if (!empty($incontext['skip'])) { |
|
| 2085 | + echo ' |
|
| 1980 | 2086 | <input type="submit" id="skip" name="skip" value="', $txt['upgrade_skip'], '" onclick="return submitThisOnce(this);" class="button" />'; |
| 2087 | + } |
|
| 1981 | 2088 | echo ' |
| 1982 | 2089 | </div>'; |
| 1983 | 2090 | } |
| 1984 | 2091 | |
| 1985 | 2092 | // Show the closing form tag and other data only if not in the last step |
| 1986 | - if (count($incontext['steps']) - 1 !== (int) $incontext['current_step']) |
|
| 1987 | - echo ' |
|
| 2093 | + if (count($incontext['steps']) - 1 !== (int) $incontext['current_step']) { |
|
| 2094 | + echo ' |
|
| 1988 | 2095 | </form>'; |
| 2096 | + } |
|
| 1989 | 2097 | |
| 1990 | 2098 | echo ' |
| 1991 | 2099 | </div> |
@@ -2020,13 +2128,15 @@ discard block |
||
| 2020 | 2128 | </div>'; |
| 2021 | 2129 | |
| 2022 | 2130 | // Show the warnings, or not. |
| 2023 | - if (template_warning_divs()) |
|
| 2024 | - echo ' |
|
| 2131 | + if (template_warning_divs()) { |
|
| 2132 | + echo ' |
|
| 2025 | 2133 | <h3>', $txt['install_all_lovely'], '</h3>'; |
| 2134 | + } |
|
| 2026 | 2135 | |
| 2027 | 2136 | // Say we want the continue button! |
| 2028 | - if (empty($incontext['error'])) |
|
| 2029 | - $incontext['continue'] = 1; |
|
| 2137 | + if (empty($incontext['error'])) { |
|
| 2138 | + $incontext['continue'] = 1; |
|
| 2139 | + } |
|
| 2030 | 2140 | |
| 2031 | 2141 | // For the latest version stuff. |
| 2032 | 2142 | echo ' |
@@ -2060,8 +2170,8 @@ discard block |
||
| 2060 | 2170 | global $txt, $incontext; |
| 2061 | 2171 | |
| 2062 | 2172 | // Errors are very serious.. |
| 2063 | - if (!empty($incontext['error'])) |
|
| 2064 | - echo ' |
|
| 2173 | + if (!empty($incontext['error'])) { |
|
| 2174 | + echo ' |
|
| 2065 | 2175 | <div style="margin: 2ex; padding: 2ex; border: 2px dashed #cc3344; color: black; background-color: #ffe4e9;"> |
| 2066 | 2176 | <div style="float: left; width: 2ex; font-size: 2em; color: red;">!!</div> |
| 2067 | 2177 | <strong style="text-decoration: underline;">', $txt['upgrade_critical_error'], '</strong><br> |
@@ -2069,9 +2179,10 @@ discard block |
||
| 2069 | 2179 | ', $incontext['error'], ' |
| 2070 | 2180 | </div> |
| 2071 | 2181 | </div>'; |
| 2182 | + } |
|
| 2072 | 2183 | // A warning message? |
| 2073 | - elseif (!empty($incontext['warning'])) |
|
| 2074 | - echo ' |
|
| 2184 | + elseif (!empty($incontext['warning'])) { |
|
| 2185 | + echo ' |
|
| 2075 | 2186 | <div style="margin: 2ex; padding: 2ex; border: 2px dashed #cc3344; color: black; background-color: #ffe4e9;"> |
| 2076 | 2187 | <div style="float: left; width: 2ex; font-size: 2em; color: red;">!!</div> |
| 2077 | 2188 | <strong style="text-decoration: underline;">', $txt['upgrade_warning'], '</strong><br> |
@@ -2079,6 +2190,7 @@ discard block |
||
| 2079 | 2190 | ', $incontext['warning'], ' |
| 2080 | 2191 | </div> |
| 2081 | 2192 | </div>'; |
| 2193 | + } |
|
| 2082 | 2194 | |
| 2083 | 2195 | return empty($incontext['error']) && empty($incontext['warning']); |
| 2084 | 2196 | } |
@@ -2094,27 +2206,30 @@ discard block |
||
| 2094 | 2206 | <li>', $incontext['failed_files']), '</li> |
| 2095 | 2207 | </ul>'; |
| 2096 | 2208 | |
| 2097 | - if (isset($incontext['systemos'], $incontext['detected_path']) && $incontext['systemos'] == 'linux') |
|
| 2098 | - echo ' |
|
| 2209 | + if (isset($incontext['systemos'], $incontext['detected_path']) && $incontext['systemos'] == 'linux') { |
|
| 2210 | + echo ' |
|
| 2099 | 2211 | <hr> |
| 2100 | 2212 | <p>', $txt['chmod_linux_info'], '</p> |
| 2101 | 2213 | <tt># chmod a+w ', implode(' ' . $incontext['detected_path'] . '/', $incontext['failed_files']), '</tt>'; |
| 2214 | + } |
|
| 2102 | 2215 | |
| 2103 | 2216 | // This is serious! |
| 2104 | - if (!template_warning_divs()) |
|
| 2105 | - return; |
|
| 2217 | + if (!template_warning_divs()) { |
|
| 2218 | + return; |
|
| 2219 | + } |
|
| 2106 | 2220 | |
| 2107 | 2221 | echo ' |
| 2108 | 2222 | <hr> |
| 2109 | 2223 | <p>', $txt['ftp_setup_info'], '</p>'; |
| 2110 | 2224 | |
| 2111 | - if (!empty($incontext['ftp_errors'])) |
|
| 2112 | - echo ' |
|
| 2225 | + if (!empty($incontext['ftp_errors'])) { |
|
| 2226 | + echo ' |
|
| 2113 | 2227 | <div class="error_message"> |
| 2114 | 2228 | ', $txt['error_ftp_no_connect'], '<br><br> |
| 2115 | 2229 | <code>', implode('<br>', $incontext['ftp_errors']), '</code> |
| 2116 | 2230 | </div> |
| 2117 | 2231 | <br>'; |
| 2232 | + } |
|
| 2118 | 2233 | |
| 2119 | 2234 | echo ' |
| 2120 | 2235 | <form action="', $incontext['form_url'], '" method="post"> |
@@ -2174,17 +2289,17 @@ discard block |
||
| 2174 | 2289 | <td> |
| 2175 | 2290 | <select name="db_type" id="db_type_input" onchange="toggleDBInput();">'; |
| 2176 | 2291 | |
| 2177 | - foreach ($incontext['supported_databases'] as $key => $db) |
|
| 2178 | - echo ' |
|
| 2292 | + foreach ($incontext['supported_databases'] as $key => $db) { |
|
| 2293 | + echo ' |
|
| 2179 | 2294 | <option value="', $key, '"', isset($_POST['db_type']) && $_POST['db_type'] == $key ? ' selected' : '', '>', $db['name'], '</option>'; |
| 2295 | + } |
|
| 2180 | 2296 | |
| 2181 | 2297 | echo ' |
| 2182 | 2298 | </select> |
| 2183 | 2299 | <div class="smalltext block">', $txt['db_settings_type_info'], '</div> |
| 2184 | 2300 | </td> |
| 2185 | 2301 | </tr>'; |
| 2186 | - } |
|
| 2187 | - else |
|
| 2302 | + } else |
|
| 2188 | 2303 | { |
| 2189 | 2304 | echo ' |
| 2190 | 2305 | <tr style="display: none;"> |
@@ -2377,9 +2492,10 @@ discard block |
||
| 2377 | 2492 | <div style="color: red;">', $txt['error_db_queries'], '</div> |
| 2378 | 2493 | <ul>'; |
| 2379 | 2494 | |
| 2380 | - foreach ($incontext['failures'] as $line => $fail) |
|
| 2381 | - echo ' |
|
| 2495 | + foreach ($incontext['failures'] as $line => $fail) { |
|
| 2496 | + echo ' |
|
| 2382 | 2497 | <li><strong>', $txt['error_db_queries_line'], $line + 1, ':</strong> ', nl2br(htmlspecialchars($fail)), '</li>'; |
| 2498 | + } |
|
| 2383 | 2499 | |
| 2384 | 2500 | echo ' |
| 2385 | 2501 | </ul>'; |
@@ -2440,15 +2556,16 @@ discard block |
||
| 2440 | 2556 | </tr> |
| 2441 | 2557 | </table>'; |
| 2442 | 2558 | |
| 2443 | - if ($incontext['require_db_confirm']) |
|
| 2444 | - echo ' |
|
| 2559 | + if ($incontext['require_db_confirm']) { |
|
| 2560 | + echo ' |
|
| 2445 | 2561 | <h2>', $txt['user_settings_database'], '</h2> |
| 2446 | 2562 | <p>', $txt['user_settings_database_info'], '</p> |
| 2447 | 2563 | |
| 2448 | 2564 | <div style="margin-bottom: 2ex; padding-', $txt['lang_rtl'] == false ? 'left' : 'right', ': 50px;"> |
| 2449 | 2565 | <input type="password" name="password3" size="30" /> |
| 2450 | 2566 | </div>'; |
| 2451 | -} |
|
| 2567 | + } |
|
| 2568 | + } |
|
| 2452 | 2569 | |
| 2453 | 2570 | // Tell them it's done, and to delete. |
| 2454 | 2571 | function template_delete_install() |
@@ -2461,14 +2578,15 @@ discard block |
||
| 2461 | 2578 | template_warning_divs(); |
| 2462 | 2579 | |
| 2463 | 2580 | // Install directory still writable? |
| 2464 | - if ($incontext['dir_still_writable']) |
|
| 2465 | - echo ' |
|
| 2581 | + if ($incontext['dir_still_writable']) { |
|
| 2582 | + echo ' |
|
| 2466 | 2583 | <em>', $txt['still_writable'], '</em><br> |
| 2467 | 2584 | <br>'; |
| 2585 | + } |
|
| 2468 | 2586 | |
| 2469 | 2587 | // Don't show the box if it's like 99% sure it won't work :P. |
| 2470 | - if ($incontext['probably_delete_install']) |
|
| 2471 | - echo ' |
|
| 2588 | + if ($incontext['probably_delete_install']) { |
|
| 2589 | + echo ' |
|
| 2472 | 2590 | <div style="margin: 1ex; font-weight: bold;"> |
| 2473 | 2591 | <label for="delete_self"><input type="checkbox" id="delete_self" onclick="doTheDelete();" /> ', $txt['delete_installer'], !isset($_SESSION['installer_temp_ftp']) ? ' ' . $txt['delete_installer_maybe'] : '', '</label> |
| 2474 | 2592 | </div> |
@@ -2484,6 +2602,7 @@ discard block |
||
| 2484 | 2602 | } |
| 2485 | 2603 | </script> |
| 2486 | 2604 | <br>'; |
| 2605 | + } |
|
| 2487 | 2606 | |
| 2488 | 2607 | echo ' |
| 2489 | 2608 | ', sprintf($txt['go_to_your_forum'], $boardurl . '/index.php'), '<br> |