@@ -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 | } |
@@ -325,10 +337,11 @@ discard block |
||
| 325 | 337 | } |
| 326 | 338 | |
| 327 | 339 | // Override the language 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']; |
|
| 340 | + if (isset($_GET['lang_file'])) { |
|
| 341 | + $_SESSION['installer_temp_lang'] = $_GET['lang_file']; |
|
| 342 | + } elseif (isset($GLOBALS['HTTP_GET_VARS']['lang_file'])) { |
|
| 343 | + $_SESSION['installer_temp_lang'] = $GLOBALS['HTTP_GET_VARS']['lang_file']; |
|
| 344 | + } |
|
| 332 | 345 | |
| 333 | 346 | // Make sure it exists, if it doesn't reset it. |
| 334 | 347 | 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'])) |
@@ -337,8 +350,9 @@ discard block |
||
| 337 | 350 | list ($_SESSION['installer_temp_lang']) = array_keys($incontext['detected_languages']); |
| 338 | 351 | |
| 339 | 352 | // If we have english and some other language, use the other language. We Americans hate english :P. |
| 340 | - if ($_SESSION['installer_temp_lang'] == 'Install.english.php' && count($incontext['detected_languages']) > 1) |
|
| 341 | - list (, $_SESSION['installer_temp_lang']) = array_keys($incontext['detected_languages']); |
|
| 353 | + if ($_SESSION['installer_temp_lang'] == 'Install.english.php' && count($incontext['detected_languages']) > 1) { |
|
| 354 | + list (, $_SESSION['installer_temp_lang']) = array_keys($incontext['detected_languages']); |
|
| 355 | + } |
|
| 342 | 356 | } |
| 343 | 357 | |
| 344 | 358 | // And now include the actual language file itself. |
@@ -355,15 +369,18 @@ discard block |
||
| 355 | 369 | global $db_prefix, $db_connection, $sourcedir, $smcFunc, $modSettings, $db_port; |
| 356 | 370 | global $db_server, $db_passwd, $db_type, $db_name, $db_user, $db_persist, $db_mb4; |
| 357 | 371 | |
| 358 | - if (empty($sourcedir)) |
|
| 359 | - $sourcedir = dirname(__FILE__) . '/Sources'; |
|
| 372 | + if (empty($sourcedir)) { |
|
| 373 | + $sourcedir = dirname(__FILE__) . '/Sources'; |
|
| 374 | + } |
|
| 360 | 375 | |
| 361 | 376 | // Need this to check whether we need the database password. |
| 362 | 377 | require(dirname(__FILE__) . '/Settings.php'); |
| 363 | - if (!defined('SMF')) |
|
| 364 | - define('SMF', 1); |
|
| 365 | - if (empty($smcFunc)) |
|
| 366 | - $smcFunc = array(); |
|
| 378 | + if (!defined('SMF')) { |
|
| 379 | + define('SMF', 1); |
|
| 380 | + } |
|
| 381 | + if (empty($smcFunc)) { |
|
| 382 | + $smcFunc = array(); |
|
| 383 | + } |
|
| 367 | 384 | |
| 368 | 385 | $modSettings['disableQueryCheck'] = true; |
| 369 | 386 | |
@@ -371,19 +388,23 @@ discard block |
||
| 371 | 388 | if (!$db_connection) |
| 372 | 389 | { |
| 373 | 390 | require_once($sourcedir . '/Subs-Db-' . $db_type . '.php'); |
| 374 | - if (version_compare(PHP_VERSION, '5', '<')) |
|
| 375 | - require_once($sourcedir . '/Subs-Compat.php'); |
|
| 391 | + if (version_compare(PHP_VERSION, '5', '<')) { |
|
| 392 | + require_once($sourcedir . '/Subs-Compat.php'); |
|
| 393 | + } |
|
| 376 | 394 | |
| 377 | 395 | $options = array('persist' => $db_persist); |
| 378 | 396 | |
| 379 | - if (!empty($db_port)) |
|
| 380 | - $options['port'] = $db_port; |
|
| 397 | + if (!empty($db_port)) { |
|
| 398 | + $options['port'] = $db_port; |
|
| 399 | + } |
|
| 381 | 400 | |
| 382 | - if (!empty($db_mb4)) |
|
| 383 | - $options['db_mb4'] = $db_mb4; |
|
| 401 | + if (!empty($db_mb4)) { |
|
| 402 | + $options['db_mb4'] = $db_mb4; |
|
| 403 | + } |
|
| 384 | 404 | |
| 385 | - if (!$db_connection) |
|
| 386 | - $db_connection = smf_db_initiate($db_server, $db_name, $db_user, $db_passwd, $db_prefix, $options); |
|
| 405 | + if (!$db_connection) { |
|
| 406 | + $db_connection = smf_db_initiate($db_server, $db_name, $db_user, $db_passwd, $db_prefix, $options); |
|
| 407 | + } |
|
| 387 | 408 | } |
| 388 | 409 | } |
| 389 | 410 | |
@@ -411,8 +432,9 @@ discard block |
||
| 411 | 432 | // @todo REMOVE THIS!! |
| 412 | 433 | else |
| 413 | 434 | { |
| 414 | - if (function_exists('doStep' . $_GET['step'])) |
|
| 415 | - call_user_func('doStep' . $_GET['step']); |
|
| 435 | + if (function_exists('doStep' . $_GET['step'])) { |
|
| 436 | + call_user_func('doStep' . $_GET['step']); |
|
| 437 | + } |
|
| 416 | 438 | } |
| 417 | 439 | // Show the footer. |
| 418 | 440 | template_install_below(); |
@@ -430,8 +452,9 @@ discard block |
||
| 430 | 452 | $incontext['sub_template'] = 'welcome_message'; |
| 431 | 453 | |
| 432 | 454 | // Done the submission? |
| 433 | - if (isset($_POST['contbutt'])) |
|
| 434 | - return true; |
|
| 455 | + if (isset($_POST['contbutt'])) { |
|
| 456 | + return true; |
|
| 457 | + } |
|
| 435 | 458 | |
| 436 | 459 | // See if we think they have already installed it? |
| 437 | 460 | if (is_readable(dirname(__FILE__) . '/Settings.php')) |
@@ -439,14 +462,17 @@ discard block |
||
| 439 | 462 | $probably_installed = 0; |
| 440 | 463 | foreach (file(dirname(__FILE__) . '/Settings.php') as $line) |
| 441 | 464 | { |
| 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++; |
|
| 465 | + if (preg_match('~^\$db_passwd\s=\s\'([^\']+)\';$~', $line)) { |
|
| 466 | + $probably_installed++; |
|
| 467 | + } |
|
| 468 | + if (preg_match('~^\$boardurl\s=\s\'([^\']+)\';~', $line) && !preg_match('~^\$boardurl\s=\s\'http://127\.0\.0\.1/smf\';~', $line)) { |
|
| 469 | + $probably_installed++; |
|
| 470 | + } |
|
| 446 | 471 | } |
| 447 | 472 | |
| 448 | - if ($probably_installed == 2) |
|
| 449 | - $incontext['warning'] = $txt['error_already_installed']; |
|
| 473 | + if ($probably_installed == 2) { |
|
| 474 | + $incontext['warning'] = $txt['error_already_installed']; |
|
| 475 | + } |
|
| 450 | 476 | } |
| 451 | 477 | |
| 452 | 478 | // Is some database support even compiled in? |
@@ -461,45 +487,54 @@ discard block |
||
| 461 | 487 | $databases[$key]['supported'] = false; |
| 462 | 488 | $notFoundSQLFile = true; |
| 463 | 489 | $txt['error_db_script_missing'] = sprintf($txt['error_db_script_missing'], 'install_' . $GLOBALS['db_script_version'] . '_' . $type . '.sql'); |
| 490 | + } else { |
|
| 491 | + $incontext['supported_databases'][] = $db; |
|
| 464 | 492 | } |
| 465 | - else |
|
| 466 | - $incontext['supported_databases'][] = $db; |
|
| 467 | 493 | } |
| 468 | 494 | } |
| 469 | 495 | |
| 470 | 496 | // Check the PHP version. |
| 471 | - if ((!function_exists('version_compare') || version_compare($GLOBALS['required_php_version'], PHP_VERSION, '>='))) |
|
| 472 | - $error = 'error_php_too_low'; |
|
| 497 | + if ((!function_exists('version_compare') || version_compare($GLOBALS['required_php_version'], PHP_VERSION, '>='))) { |
|
| 498 | + $error = 'error_php_too_low'; |
|
| 499 | + } |
|
| 473 | 500 | // Make sure we have a supported database |
| 474 | - elseif (empty($incontext['supported_databases'])) |
|
| 475 | - $error = empty($notFoundSQLFile) ? 'error_db_missing' : 'error_db_script_missing'; |
|
| 501 | + elseif (empty($incontext['supported_databases'])) { |
|
| 502 | + $error = empty($notFoundSQLFile) ? 'error_db_missing' : 'error_db_script_missing'; |
|
| 503 | + } |
|
| 476 | 504 | // How about session support? Some crazy sysadmin remove it? |
| 477 | - elseif (!function_exists('session_start')) |
|
| 478 | - $error = 'error_session_missing'; |
|
| 505 | + elseif (!function_exists('session_start')) { |
|
| 506 | + $error = 'error_session_missing'; |
|
| 507 | + } |
|
| 479 | 508 | // Make sure they uploaded all the files. |
| 480 | - elseif (!file_exists(dirname(__FILE__) . '/index.php')) |
|
| 481 | - $error = 'error_missing_files'; |
|
| 509 | + elseif (!file_exists(dirname(__FILE__) . '/index.php')) { |
|
| 510 | + $error = 'error_missing_files'; |
|
| 511 | + } |
|
| 482 | 512 | // Very simple check on the session.save_path for Windows. |
| 483 | 513 | // @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'; |
|
| 514 | + elseif (@ini_get('session.save_path') == '/tmp' && substr(__FILE__, 1, 2) == ':\\') { |
|
| 515 | + $error = 'error_session_save_path'; |
|
| 516 | + } |
|
| 486 | 517 | |
| 487 | 518 | // Since each of the three messages would look the same, anyway... |
| 488 | - if (isset($error)) |
|
| 489 | - $incontext['error'] = $txt[$error]; |
|
| 519 | + if (isset($error)) { |
|
| 520 | + $incontext['error'] = $txt[$error]; |
|
| 521 | + } |
|
| 490 | 522 | |
| 491 | 523 | // 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']; |
|
| 524 | + if (!fixModSecurity() && !isset($_GET['overmodsecurity'])) { |
|
| 525 | + $incontext['error'] = $txt['error_mod_security'] . '<br><br><a href="' . $installurl . '?overmodsecurity=true">' . $txt['error_message_click'] . '</a> ' . $txt['error_message_bad_try_again']; |
|
| 526 | + } |
|
| 494 | 527 | |
| 495 | 528 | // Confirm mbstring is loaded... |
| 496 | - if (!extension_loaded('mbstring')) |
|
| 497 | - $incontext['error'] = $txt['install_no_mbstring']; |
|
| 529 | + if (!extension_loaded('mbstring')) { |
|
| 530 | + $incontext['error'] = $txt['install_no_mbstring']; |
|
| 531 | + } |
|
| 498 | 532 | |
| 499 | 533 | // Check for https stream support. |
| 500 | 534 | $supported_streams = stream_get_wrappers(); |
| 501 | - if (!in_array('https', $supported_streams)) |
|
| 502 | - $incontext['warning'] = $txt['install_no_https']; |
|
| 535 | + if (!in_array('https', $supported_streams)) { |
|
| 536 | + $incontext['warning'] = $txt['install_no_https']; |
|
| 537 | + } |
|
| 503 | 538 | |
| 504 | 539 | return false; |
| 505 | 540 | } |
@@ -524,12 +559,14 @@ discard block |
||
| 524 | 559 | 'Settings_bak.php', |
| 525 | 560 | ); |
| 526 | 561 | |
| 527 | - foreach ($incontext['detected_languages'] as $lang => $temp) |
|
| 528 | - $extra_files[] = 'Themes/default/languages/' . $lang; |
|
| 562 | + foreach ($incontext['detected_languages'] as $lang => $temp) { |
|
| 563 | + $extra_files[] = 'Themes/default/languages/' . $lang; |
|
| 564 | + } |
|
| 529 | 565 | |
| 530 | 566 | // With mod_security installed, we could attempt to fix it with .htaccess. |
| 531 | - if (function_exists('apache_get_modules') && in_array('mod_security', apache_get_modules())) |
|
| 532 | - $writable_files[] = file_exists(dirname(__FILE__) . '/.htaccess') ? '.htaccess' : '.'; |
|
| 567 | + if (function_exists('apache_get_modules') && in_array('mod_security', apache_get_modules())) { |
|
| 568 | + $writable_files[] = file_exists(dirname(__FILE__) . '/.htaccess') ? '.htaccess' : '.'; |
|
| 569 | + } |
|
| 533 | 570 | |
| 534 | 571 | $failed_files = array(); |
| 535 | 572 | |
@@ -541,20 +578,23 @@ discard block |
||
| 541 | 578 | foreach ($writable_files as $file) |
| 542 | 579 | { |
| 543 | 580 | // Some files won't exist, try to address up front |
| 544 | - if (!file_exists(dirname(__FILE__) . '/' . $file)) |
|
| 545 | - @touch(dirname(__FILE__) . '/' . $file); |
|
| 581 | + if (!file_exists(dirname(__FILE__) . '/' . $file)) { |
|
| 582 | + @touch(dirname(__FILE__) . '/' . $file); |
|
| 583 | + } |
|
| 546 | 584 | // NOW do the writable check... |
| 547 | 585 | if (!is_writable(dirname(__FILE__) . '/' . $file)) |
| 548 | 586 | { |
| 549 | 587 | @chmod(dirname(__FILE__) . '/' . $file, 0755); |
| 550 | 588 | |
| 551 | 589 | // Well, 755 hopefully worked... if not, try 777. |
| 552 | - if (!is_writable(dirname(__FILE__) . '/' . $file) && !@chmod(dirname(__FILE__) . '/' . $file, 0777)) |
|
| 553 | - $failed_files[] = $file; |
|
| 590 | + if (!is_writable(dirname(__FILE__) . '/' . $file) && !@chmod(dirname(__FILE__) . '/' . $file, 0777)) { |
|
| 591 | + $failed_files[] = $file; |
|
| 592 | + } |
|
| 554 | 593 | } |
| 555 | 594 | } |
| 556 | - foreach ($extra_files as $file) |
|
| 557 | - @chmod(dirname(__FILE__) . (empty($file) ? '' : '/' . $file), 0777); |
|
| 595 | + foreach ($extra_files as $file) { |
|
| 596 | + @chmod(dirname(__FILE__) . (empty($file) ? '' : '/' . $file), 0777); |
|
| 597 | + } |
|
| 558 | 598 | } |
| 559 | 599 | // Windows is trickier. Let's try opening for r+... |
| 560 | 600 | else |
@@ -564,30 +604,35 @@ discard block |
||
| 564 | 604 | foreach ($writable_files as $file) |
| 565 | 605 | { |
| 566 | 606 | // Folders can't be opened for write... but the index.php in them can ;) |
| 567 | - if (is_dir(dirname(__FILE__) . '/' . $file)) |
|
| 568 | - $file .= '/index.php'; |
|
| 607 | + if (is_dir(dirname(__FILE__) . '/' . $file)) { |
|
| 608 | + $file .= '/index.php'; |
|
| 609 | + } |
|
| 569 | 610 | |
| 570 | 611 | // Funny enough, chmod actually does do something on windows - it removes the read only attribute. |
| 571 | 612 | @chmod(dirname(__FILE__) . '/' . $file, 0777); |
| 572 | 613 | $fp = @fopen(dirname(__FILE__) . '/' . $file, 'r+'); |
| 573 | 614 | |
| 574 | 615 | // Hmm, okay, try just for write in that case... |
| 575 | - if (!is_resource($fp)) |
|
| 576 | - $fp = @fopen(dirname(__FILE__) . '/' . $file, 'w'); |
|
| 616 | + if (!is_resource($fp)) { |
|
| 617 | + $fp = @fopen(dirname(__FILE__) . '/' . $file, 'w'); |
|
| 618 | + } |
|
| 577 | 619 | |
| 578 | - if (!is_resource($fp)) |
|
| 579 | - $failed_files[] = $file; |
|
| 620 | + if (!is_resource($fp)) { |
|
| 621 | + $failed_files[] = $file; |
|
| 622 | + } |
|
| 580 | 623 | |
| 581 | 624 | @fclose($fp); |
| 582 | 625 | } |
| 583 | - foreach ($extra_files as $file) |
|
| 584 | - @chmod(dirname(__FILE__) . (empty($file) ? '' : '/' . $file), 0777); |
|
| 626 | + foreach ($extra_files as $file) { |
|
| 627 | + @chmod(dirname(__FILE__) . (empty($file) ? '' : '/' . $file), 0777); |
|
| 628 | + } |
|
| 585 | 629 | } |
| 586 | 630 | |
| 587 | 631 | $failure = count($failed_files) >= 1; |
| 588 | 632 | |
| 589 | - if (!isset($_SERVER)) |
|
| 590 | - return !$failure; |
|
| 633 | + if (!isset($_SERVER)) { |
|
| 634 | + return !$failure; |
|
| 635 | + } |
|
| 591 | 636 | |
| 592 | 637 | // Put the list into context. |
| 593 | 638 | $incontext['failed_files'] = $failed_files; |
@@ -635,19 +680,23 @@ discard block |
||
| 635 | 680 | |
| 636 | 681 | if (!isset($ftp) || $ftp->error !== false) |
| 637 | 682 | { |
| 638 | - if (!isset($ftp)) |
|
| 639 | - $ftp = new ftp_connection(null); |
|
| 683 | + if (!isset($ftp)) { |
|
| 684 | + $ftp = new ftp_connection(null); |
|
| 685 | + } |
|
| 640 | 686 | // Save the error so we can mess with listing... |
| 641 | - elseif ($ftp->error !== false && empty($incontext['ftp_errors']) && !empty($ftp->last_message)) |
|
| 642 | - $incontext['ftp_errors'][] = $ftp->last_message; |
|
| 687 | + elseif ($ftp->error !== false && empty($incontext['ftp_errors']) && !empty($ftp->last_message)) { |
|
| 688 | + $incontext['ftp_errors'][] = $ftp->last_message; |
|
| 689 | + } |
|
| 643 | 690 | |
| 644 | 691 | list ($username, $detect_path, $found_path) = $ftp->detect_path(dirname(__FILE__)); |
| 645 | 692 | |
| 646 | - if (empty($_POST['ftp_path']) && $found_path) |
|
| 647 | - $_POST['ftp_path'] = $detect_path; |
|
| 693 | + if (empty($_POST['ftp_path']) && $found_path) { |
|
| 694 | + $_POST['ftp_path'] = $detect_path; |
|
| 695 | + } |
|
| 648 | 696 | |
| 649 | - if (!isset($_POST['ftp_username'])) |
|
| 650 | - $_POST['ftp_username'] = $username; |
|
| 697 | + if (!isset($_POST['ftp_username'])) { |
|
| 698 | + $_POST['ftp_username'] = $username; |
|
| 699 | + } |
|
| 651 | 700 | |
| 652 | 701 | // Set the username etc, into context. |
| 653 | 702 | $incontext['ftp'] = array( |
@@ -659,8 +708,7 @@ discard block |
||
| 659 | 708 | ); |
| 660 | 709 | |
| 661 | 710 | return false; |
| 662 | - } |
|
| 663 | - else |
|
| 711 | + } else |
|
| 664 | 712 | { |
| 665 | 713 | $_SESSION['installer_temp_ftp'] = array( |
| 666 | 714 | 'server' => $_POST['ftp_server'], |
@@ -674,10 +722,12 @@ discard block |
||
| 674 | 722 | |
| 675 | 723 | foreach ($failed_files as $file) |
| 676 | 724 | { |
| 677 | - if (!is_writable(dirname(__FILE__) . '/' . $file)) |
|
| 678 | - $ftp->chmod($file, 0755); |
|
| 679 | - if (!is_writable(dirname(__FILE__) . '/' . $file)) |
|
| 680 | - $ftp->chmod($file, 0777); |
|
| 725 | + if (!is_writable(dirname(__FILE__) . '/' . $file)) { |
|
| 726 | + $ftp->chmod($file, 0755); |
|
| 727 | + } |
|
| 728 | + if (!is_writable(dirname(__FILE__) . '/' . $file)) { |
|
| 729 | + $ftp->chmod($file, 0777); |
|
| 730 | + } |
|
| 681 | 731 | if (!is_writable(dirname(__FILE__) . '/' . $file)) |
| 682 | 732 | { |
| 683 | 733 | $failed_files_updated[] = $file; |
@@ -733,15 +783,17 @@ discard block |
||
| 733 | 783 | |
| 734 | 784 | if (!$foundOne) |
| 735 | 785 | { |
| 736 | - if (isset($db['default_host'])) |
|
| 737 | - $incontext['db']['server'] = ini_get($db['default_host']) or $incontext['db']['server'] = 'localhost'; |
|
| 786 | + if (isset($db['default_host'])) { |
|
| 787 | + $incontext['db']['server'] = ini_get($db['default_host']) or $incontext['db']['server'] = 'localhost'; |
|
| 788 | + } |
|
| 738 | 789 | if (isset($db['default_user'])) |
| 739 | 790 | { |
| 740 | 791 | $incontext['db']['user'] = ini_get($db['default_user']); |
| 741 | 792 | $incontext['db']['name'] = ini_get($db['default_user']); |
| 742 | 793 | } |
| 743 | - if (isset($db['default_password'])) |
|
| 744 | - $incontext['db']['pass'] = ini_get($db['default_password']); |
|
| 794 | + if (isset($db['default_password'])) { |
|
| 795 | + $incontext['db']['pass'] = ini_get($db['default_password']); |
|
| 796 | + } |
|
| 745 | 797 | |
| 746 | 798 | // For simplicity and less confusion, leave the port blank by default |
| 747 | 799 | $incontext['db']['port'] = ''; |
@@ -760,10 +812,10 @@ discard block |
||
| 760 | 812 | $incontext['db']['server'] = $_POST['db_server']; |
| 761 | 813 | $incontext['db']['prefix'] = $_POST['db_prefix']; |
| 762 | 814 | |
| 763 | - if (!empty($_POST['db_port'])) |
|
| 764 | - $incontext['db']['port'] = $_POST['db_port']; |
|
| 765 | - } |
|
| 766 | - else |
|
| 815 | + if (!empty($_POST['db_port'])) { |
|
| 816 | + $incontext['db']['port'] = $_POST['db_port']; |
|
| 817 | + } |
|
| 818 | + } else |
|
| 767 | 819 | { |
| 768 | 820 | $incontext['db']['prefix'] = 'smf_'; |
| 769 | 821 | } |
@@ -799,10 +851,11 @@ discard block |
||
| 799 | 851 | if (!empty($_POST['db_port'])) |
| 800 | 852 | { |
| 801 | 853 | // For MySQL, we can get the "default port" from PHP. PostgreSQL has no such option though. |
| 802 | - if (($db_type == 'mysql' || $db_type == 'mysqli') && $_POST['db_port'] != ini_get($db_type . '.default_port')) |
|
| 803 | - $vars['db_port'] = (int) $_POST['db_port']; |
|
| 804 | - elseif ($db_type == 'postgresql' && $_POST['db_port'] != 5432) |
|
| 805 | - $vars['db_port'] = (int) $_POST['db_port']; |
|
| 854 | + if (($db_type == 'mysql' || $db_type == 'mysqli') && $_POST['db_port'] != ini_get($db_type . '.default_port')) { |
|
| 855 | + $vars['db_port'] = (int) $_POST['db_port']; |
|
| 856 | + } elseif ($db_type == 'postgresql' && $_POST['db_port'] != 5432) { |
|
| 857 | + $vars['db_port'] = (int) $_POST['db_port']; |
|
| 858 | + } |
|
| 806 | 859 | } |
| 807 | 860 | |
| 808 | 861 | // God I hope it saved! |
@@ -815,8 +868,9 @@ discard block |
||
| 815 | 868 | // Make sure it works. |
| 816 | 869 | require(dirname(__FILE__) . '/Settings.php'); |
| 817 | 870 | |
| 818 | - if (empty($sourcedir)) |
|
| 819 | - $sourcedir = dirname(__FILE__) . '/Sources'; |
|
| 871 | + if (empty($sourcedir)) { |
|
| 872 | + $sourcedir = dirname(__FILE__) . '/Sources'; |
|
| 873 | + } |
|
| 820 | 874 | |
| 821 | 875 | // Better find the database file! |
| 822 | 876 | if (!file_exists($sourcedir . '/Subs-Db-' . $db_type . '.php')) |
@@ -826,29 +880,34 @@ discard block |
||
| 826 | 880 | } |
| 827 | 881 | |
| 828 | 882 | // Now include it for database functions! |
| 829 | - if (!defined('SMF')) |
|
| 830 | - define('SMF', 1); |
|
| 883 | + if (!defined('SMF')) { |
|
| 884 | + define('SMF', 1); |
|
| 885 | + } |
|
| 831 | 886 | |
| 832 | 887 | $modSettings['disableQueryCheck'] = true; |
| 833 | - if (empty($smcFunc)) |
|
| 834 | - $smcFunc = array(); |
|
| 888 | + if (empty($smcFunc)) { |
|
| 889 | + $smcFunc = array(); |
|
| 890 | + } |
|
| 835 | 891 | |
| 836 | 892 | require_once($sourcedir . '/Subs-Db-' . $db_type . '.php'); |
| 837 | 893 | |
| 838 | 894 | // What - running PHP4? The shame! |
| 839 | - if (version_compare(PHP_VERSION, '5', '<')) |
|
| 840 | - require_once($sourcedir . '/Subs-Compat.php'); |
|
| 895 | + if (version_compare(PHP_VERSION, '5', '<')) { |
|
| 896 | + require_once($sourcedir . '/Subs-Compat.php'); |
|
| 897 | + } |
|
| 841 | 898 | |
| 842 | 899 | // Attempt a connection. |
| 843 | 900 | $needsDB = !empty($databases[$db_type]['always_has_db']); |
| 844 | 901 | |
| 845 | 902 | $options = array('non_fatal' => true, 'dont_select_db' => !$needsDB); |
| 846 | 903 | // Add in the port if needed |
| 847 | - if (!empty($db_port)) |
|
| 848 | - $options['port'] = $db_port; |
|
| 904 | + if (!empty($db_port)) { |
|
| 905 | + $options['port'] = $db_port; |
|
| 906 | + } |
|
| 849 | 907 | |
| 850 | - if (!empty($db_mb4)) |
|
| 851 | - $options['db_mb4'] = $db_mb4; |
|
| 908 | + if (!empty($db_mb4)) { |
|
| 909 | + $options['db_mb4'] = $db_mb4; |
|
| 910 | + } |
|
| 852 | 911 | |
| 853 | 912 | $db_connection = smf_db_initiate($db_server, $db_name, $db_user, $db_passwd, $db_prefix, $options); |
| 854 | 913 | |
@@ -934,12 +993,14 @@ discard block |
||
| 934 | 993 | $incontext['page_title'] = $txt['install_settings']; |
| 935 | 994 | |
| 936 | 995 | // Let's see if we got the database type correct. |
| 937 | - if (isset($_POST['db_type'], $databases[$_POST['db_type']])) |
|
| 938 | - $db_type = $_POST['db_type']; |
|
| 996 | + if (isset($_POST['db_type'], $databases[$_POST['db_type']])) { |
|
| 997 | + $db_type = $_POST['db_type']; |
|
| 998 | + } |
|
| 939 | 999 | |
| 940 | 1000 | // Else we'd better be able to get the connection. |
| 941 | - else |
|
| 942 | - load_database(); |
|
| 1001 | + else { |
|
| 1002 | + load_database(); |
|
| 1003 | + } |
|
| 943 | 1004 | |
| 944 | 1005 | $db_type = isset($_POST['db_type']) ? $_POST['db_type'] : $db_type; |
| 945 | 1006 | |
@@ -948,10 +1009,11 @@ discard block |
||
| 948 | 1009 | |
| 949 | 1010 | $secure = false; |
| 950 | 1011 | |
| 951 | - if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') |
|
| 952 | - $secure = true; |
|
| 953 | - 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') |
|
| 954 | - $secure = true; |
|
| 1012 | + if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') { |
|
| 1013 | + $secure = true; |
|
| 1014 | + } 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') { |
|
| 1015 | + $secure = true; |
|
| 1016 | + } |
|
| 955 | 1017 | |
| 956 | 1018 | // Now, to put what we've learned together... and add a path. |
| 957 | 1019 | $incontext['detected_url'] = 'http' . ($secure ? 's' : '') . '://' . $host . substr($_SERVER['PHP_SELF'], 0, strrpos($_SERVER['PHP_SELF'], '/')); |
@@ -983,18 +1045,21 @@ discard block |
||
| 983 | 1045 | // Submitting? |
| 984 | 1046 | if (isset($_POST['boardurl'])) |
| 985 | 1047 | { |
| 986 | - if (substr($_POST['boardurl'], -10) == '/index.php') |
|
| 987 | - $_POST['boardurl'] = substr($_POST['boardurl'], 0, -10); |
|
| 988 | - elseif (substr($_POST['boardurl'], -1) == '/') |
|
| 989 | - $_POST['boardurl'] = substr($_POST['boardurl'], 0, -1); |
|
| 990 | - if (substr($_POST['boardurl'], 0, 7) != 'http://' && substr($_POST['boardurl'], 0, 7) != 'file://' && substr($_POST['boardurl'], 0, 8) != 'https://') |
|
| 991 | - $_POST['boardurl'] = 'http://' . $_POST['boardurl']; |
|
| 1048 | + if (substr($_POST['boardurl'], -10) == '/index.php') { |
|
| 1049 | + $_POST['boardurl'] = substr($_POST['boardurl'], 0, -10); |
|
| 1050 | + } elseif (substr($_POST['boardurl'], -1) == '/') { |
|
| 1051 | + $_POST['boardurl'] = substr($_POST['boardurl'], 0, -1); |
|
| 1052 | + } |
|
| 1053 | + if (substr($_POST['boardurl'], 0, 7) != 'http://' && substr($_POST['boardurl'], 0, 7) != 'file://' && substr($_POST['boardurl'], 0, 8) != 'https://') { |
|
| 1054 | + $_POST['boardurl'] = 'http://' . $_POST['boardurl']; |
|
| 1055 | + } |
|
| 992 | 1056 | |
| 993 | 1057 | //Make sure boardurl is aligned with ssl setting |
| 994 | - if (empty($_POST['force_ssl'])) |
|
| 995 | - $_POST['boardurl'] = strtr($_POST['boardurl'], array('https://' => 'http://')); |
|
| 996 | - else |
|
| 997 | - $_POST['boardurl'] = strtr($_POST['boardurl'], array('http://' => 'https://')); |
|
| 1058 | + if (empty($_POST['force_ssl'])) { |
|
| 1059 | + $_POST['boardurl'] = strtr($_POST['boardurl'], array('https://' => 'http://')); |
|
| 1060 | + } else { |
|
| 1061 | + $_POST['boardurl'] = strtr($_POST['boardurl'], array('http://' => 'https://')); |
|
| 1062 | + } |
|
| 998 | 1063 | |
| 999 | 1064 | // Save these variables. |
| 1000 | 1065 | $vars = array( |
@@ -1033,10 +1098,10 @@ discard block |
||
| 1033 | 1098 | { |
| 1034 | 1099 | $incontext['error'] = sprintf($txt['error_utf8_version'], $databases[$db_type]['utf8_version']); |
| 1035 | 1100 | return false; |
| 1036 | - } |
|
| 1037 | - else |
|
| 1038 | - // Set the character set here. |
|
| 1101 | + } else { |
|
| 1102 | + // Set the character set here. |
|
| 1039 | 1103 | updateSettingsFile(array('db_character_set' => 'utf8')); |
| 1104 | + } |
|
| 1040 | 1105 | } |
| 1041 | 1106 | |
| 1042 | 1107 | // Good, skip on. |
@@ -1056,8 +1121,9 @@ discard block |
||
| 1056 | 1121 | $incontext['continue'] = 1; |
| 1057 | 1122 | |
| 1058 | 1123 | // Already done? |
| 1059 | - if (isset($_POST['pop_done'])) |
|
| 1060 | - return true; |
|
| 1124 | + if (isset($_POST['pop_done'])) { |
|
| 1125 | + return true; |
|
| 1126 | + } |
|
| 1061 | 1127 | |
| 1062 | 1128 | // Reload settings. |
| 1063 | 1129 | require(dirname(__FILE__) . '/Settings.php'); |
@@ -1075,8 +1141,9 @@ discard block |
||
| 1075 | 1141 | $modSettings = array(); |
| 1076 | 1142 | if ($result !== false) |
| 1077 | 1143 | { |
| 1078 | - while ($row = $smcFunc['db_fetch_assoc']($result)) |
|
| 1079 | - $modSettings[$row['variable']] = $row['value']; |
|
| 1144 | + while ($row = $smcFunc['db_fetch_assoc']($result)) { |
|
| 1145 | + $modSettings[$row['variable']] = $row['value']; |
|
| 1146 | + } |
|
| 1080 | 1147 | $smcFunc['db_free_result']($result); |
| 1081 | 1148 | |
| 1082 | 1149 | // Do they match? If so, this is just a refresh so charge on! |
@@ -1089,20 +1156,22 @@ discard block |
||
| 1089 | 1156 | $modSettings['disableQueryCheck'] = true; |
| 1090 | 1157 | |
| 1091 | 1158 | // If doing UTF8, select it. PostgreSQL requires passing it as a string... |
| 1092 | - if (!empty($db_character_set) && $db_character_set == 'utf8' && !empty($databases[$db_type]['utf8_support'])) |
|
| 1093 | - $smcFunc['db_query']('', ' |
|
| 1159 | + if (!empty($db_character_set) && $db_character_set == 'utf8' && !empty($databases[$db_type]['utf8_support'])) { |
|
| 1160 | + $smcFunc['db_query']('', ' |
|
| 1094 | 1161 | SET NAMES {string:utf8}', |
| 1095 | 1162 | array( |
| 1096 | 1163 | 'db_error_skip' => true, |
| 1097 | 1164 | 'utf8' => 'utf8', |
| 1098 | 1165 | ) |
| 1099 | 1166 | ); |
| 1167 | + } |
|
| 1100 | 1168 | |
| 1101 | 1169 | // Windows likes to leave the trailing slash, which yields to C:\path\to\SMF\/attachments... |
| 1102 | - if (substr(__DIR__, -1) == '\\') |
|
| 1103 | - $attachdir = __DIR__ . 'attachments'; |
|
| 1104 | - else |
|
| 1105 | - $attachdir = __DIR__ . '/attachments'; |
|
| 1170 | + if (substr(__DIR__, -1) == '\\') { |
|
| 1171 | + $attachdir = __DIR__ . 'attachments'; |
|
| 1172 | + } else { |
|
| 1173 | + $attachdir = __DIR__ . '/attachments'; |
|
| 1174 | + } |
|
| 1106 | 1175 | |
| 1107 | 1176 | $replaces = array( |
| 1108 | 1177 | '{$db_prefix}' => $db_prefix, |
@@ -1119,8 +1188,9 @@ discard block |
||
| 1119 | 1188 | |
| 1120 | 1189 | foreach ($txt as $key => $value) |
| 1121 | 1190 | { |
| 1122 | - if (substr($key, 0, 8) == 'default_') |
|
| 1123 | - $replaces['{$' . $key . '}'] = $smcFunc['db_escape_string']($value); |
|
| 1191 | + if (substr($key, 0, 8) == 'default_') { |
|
| 1192 | + $replaces['{$' . $key . '}'] = $smcFunc['db_escape_string']($value); |
|
| 1193 | + } |
|
| 1124 | 1194 | } |
| 1125 | 1195 | $replaces['{$default_reserved_names}'] = strtr($replaces['{$default_reserved_names}'], array('\\\\n' => '\\n')); |
| 1126 | 1196 | |
@@ -1135,8 +1205,9 @@ discard block |
||
| 1135 | 1205 | |
| 1136 | 1206 | while ($row = $smcFunc['db_fetch_assoc']($get_engines)) |
| 1137 | 1207 | { |
| 1138 | - if ($row['Support'] == 'YES' || $row['Support'] == 'DEFAULT') |
|
| 1139 | - $engines[] = $row['Engine']; |
|
| 1208 | + if ($row['Support'] == 'YES' || $row['Support'] == 'DEFAULT') { |
|
| 1209 | + $engines[] = $row['Engine']; |
|
| 1210 | + } |
|
| 1140 | 1211 | } |
| 1141 | 1212 | |
| 1142 | 1213 | // Done with this now |
@@ -1160,8 +1231,7 @@ discard block |
||
| 1160 | 1231 | $replaces['START TRANSACTION;'] = ''; |
| 1161 | 1232 | $replaces['COMMIT;'] = ''; |
| 1162 | 1233 | } |
| 1163 | - } |
|
| 1164 | - else |
|
| 1234 | + } else |
|
| 1165 | 1235 | { |
| 1166 | 1236 | $has_innodb = false; |
| 1167 | 1237 | } |
@@ -1183,21 +1253,24 @@ discard block |
||
| 1183 | 1253 | foreach ($sql_lines as $count => $line) |
| 1184 | 1254 | { |
| 1185 | 1255 | // No comments allowed! |
| 1186 | - if (substr(trim($line), 0, 1) != '#') |
|
| 1187 | - $current_statement .= "\n" . rtrim($line); |
|
| 1256 | + if (substr(trim($line), 0, 1) != '#') { |
|
| 1257 | + $current_statement .= "\n" . rtrim($line); |
|
| 1258 | + } |
|
| 1188 | 1259 | |
| 1189 | 1260 | // Is this the end of the query string? |
| 1190 | - if (empty($current_statement) || (preg_match('~;[\s]*$~s', $line) == 0 && $count != count($sql_lines))) |
|
| 1191 | - continue; |
|
| 1261 | + if (empty($current_statement) || (preg_match('~;[\s]*$~s', $line) == 0 && $count != count($sql_lines))) { |
|
| 1262 | + continue; |
|
| 1263 | + } |
|
| 1192 | 1264 | |
| 1193 | 1265 | // Does this table already exist? If so, don't insert more data into it! |
| 1194 | 1266 | if (preg_match('~^\s*INSERT INTO ([^\s\n\r]+?)~', $current_statement, $match) != 0 && in_array($match[1], $exists)) |
| 1195 | 1267 | { |
| 1196 | 1268 | preg_match_all('~\)[,;]~', $current_statement, $matches); |
| 1197 | - if (!empty($matches[0])) |
|
| 1198 | - $incontext['sql_results']['insert_dups'] += count($matches[0]); |
|
| 1199 | - else |
|
| 1200 | - $incontext['sql_results']['insert_dups']++; |
|
| 1269 | + if (!empty($matches[0])) { |
|
| 1270 | + $incontext['sql_results']['insert_dups'] += count($matches[0]); |
|
| 1271 | + } else { |
|
| 1272 | + $incontext['sql_results']['insert_dups']++; |
|
| 1273 | + } |
|
| 1201 | 1274 | |
| 1202 | 1275 | $current_statement = ''; |
| 1203 | 1276 | continue; |
@@ -1206,8 +1279,9 @@ discard block |
||
| 1206 | 1279 | if ($smcFunc['db_query']('', $current_statement, array('security_override' => true, 'db_error_skip' => true), $db_connection) === false) |
| 1207 | 1280 | { |
| 1208 | 1281 | // Use the appropriate function based on the DB type |
| 1209 | - if ($db_type == 'mysql' || $db_type == 'mysqli') |
|
| 1210 | - $db_errorno = $db_type . '_errno'; |
|
| 1282 | + if ($db_type == 'mysql' || $db_type == 'mysqli') { |
|
| 1283 | + $db_errorno = $db_type . '_errno'; |
|
| 1284 | + } |
|
| 1211 | 1285 | |
| 1212 | 1286 | // Error 1050: Table already exists! |
| 1213 | 1287 | // @todo Needs to be made better! |
@@ -1222,18 +1296,18 @@ discard block |
||
| 1222 | 1296 | // MySQLi requires a connection object. It's optional with MySQL and Postgres |
| 1223 | 1297 | $incontext['failures'][$count] = $smcFunc['db_error']($db_connection); |
| 1224 | 1298 | } |
| 1225 | - } |
|
| 1226 | - else |
|
| 1299 | + } else |
|
| 1227 | 1300 | { |
| 1228 | - if (preg_match('~^\s*CREATE TABLE ([^\s\n\r]+?)~', $current_statement, $match) == 1) |
|
| 1229 | - $incontext['sql_results']['tables']++; |
|
| 1230 | - elseif (preg_match('~^\s*INSERT INTO ([^\s\n\r]+?)~', $current_statement, $match) == 1) |
|
| 1301 | + if (preg_match('~^\s*CREATE TABLE ([^\s\n\r]+?)~', $current_statement, $match) == 1) { |
|
| 1302 | + $incontext['sql_results']['tables']++; |
|
| 1303 | + } elseif (preg_match('~^\s*INSERT INTO ([^\s\n\r]+?)~', $current_statement, $match) == 1) |
|
| 1231 | 1304 | { |
| 1232 | 1305 | preg_match_all('~\)[,;]~', $current_statement, $matches); |
| 1233 | - if (!empty($matches[0])) |
|
| 1234 | - $incontext['sql_results']['inserts'] += count($matches[0]); |
|
| 1235 | - else |
|
| 1236 | - $incontext['sql_results']['inserts']++; |
|
| 1306 | + if (!empty($matches[0])) { |
|
| 1307 | + $incontext['sql_results']['inserts'] += count($matches[0]); |
|
| 1308 | + } else { |
|
| 1309 | + $incontext['sql_results']['inserts']++; |
|
| 1310 | + } |
|
| 1237 | 1311 | } |
| 1238 | 1312 | } |
| 1239 | 1313 | |
@@ -1246,15 +1320,17 @@ discard block |
||
| 1246 | 1320 | // Sort out the context for the SQL. |
| 1247 | 1321 | foreach ($incontext['sql_results'] as $key => $number) |
| 1248 | 1322 | { |
| 1249 | - if ($number == 0) |
|
| 1250 | - unset($incontext['sql_results'][$key]); |
|
| 1251 | - else |
|
| 1252 | - $incontext['sql_results'][$key] = sprintf($txt['db_populate_' . $key], $number); |
|
| 1323 | + if ($number == 0) { |
|
| 1324 | + unset($incontext['sql_results'][$key]); |
|
| 1325 | + } else { |
|
| 1326 | + $incontext['sql_results'][$key] = sprintf($txt['db_populate_' . $key], $number); |
|
| 1327 | + } |
|
| 1253 | 1328 | } |
| 1254 | 1329 | |
| 1255 | 1330 | // Make sure UTF will be used globally. |
| 1256 | - 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']))) |
|
| 1257 | - $newSettings[] = array('global_character_set', 'UTF-8'); |
|
| 1331 | + 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']))) { |
|
| 1332 | + $newSettings[] = array('global_character_set', 'UTF-8'); |
|
| 1333 | + } |
|
| 1258 | 1334 | |
| 1259 | 1335 | // Auto-detect local & global cookie settings |
| 1260 | 1336 | $url_parts = parse_url($boardurl); |
@@ -1283,15 +1359,19 @@ discard block |
||
| 1283 | 1359 | |
| 1284 | 1360 | // Look for subfolder, if found, set localCookie |
| 1285 | 1361 | // Checking for len > 1 ensures you don't have just a slash... |
| 1286 | - if (!empty($url_parts['path']) && strlen($url_parts['path']) > 1) |
|
| 1287 | - $localCookies = '1'; |
|
| 1362 | + if (!empty($url_parts['path']) && strlen($url_parts['path']) > 1) { |
|
| 1363 | + $localCookies = '1'; |
|
| 1364 | + } |
|
| 1288 | 1365 | |
| 1289 | - if (isset($globalCookies)) |
|
| 1290 | - $newSettings[] = array('globalCookies', $globalCookies); |
|
| 1291 | - if (isset($globalCookiesDomain)) |
|
| 1292 | - $newSettings[] = array('globalCookiesDomain', $globalCookiesDomain); |
|
| 1293 | - if (isset($localCookies)) |
|
| 1294 | - $newSettings[] = array('localCookies', $localCookies); |
|
| 1366 | + if (isset($globalCookies)) { |
|
| 1367 | + $newSettings[] = array('globalCookies', $globalCookies); |
|
| 1368 | + } |
|
| 1369 | + if (isset($globalCookiesDomain)) { |
|
| 1370 | + $newSettings[] = array('globalCookiesDomain', $globalCookiesDomain); |
|
| 1371 | + } |
|
| 1372 | + if (isset($localCookies)) { |
|
| 1373 | + $newSettings[] = array('localCookies', $localCookies); |
|
| 1374 | + } |
|
| 1295 | 1375 | } |
| 1296 | 1376 | |
| 1297 | 1377 | // Are we allowing stat collection? |
@@ -1309,16 +1389,17 @@ discard block |
||
| 1309 | 1389 | fwrite($fp, $out); |
| 1310 | 1390 | |
| 1311 | 1391 | $return_data = ''; |
| 1312 | - while (!feof($fp)) |
|
| 1313 | - $return_data .= fgets($fp, 128); |
|
| 1392 | + while (!feof($fp)) { |
|
| 1393 | + $return_data .= fgets($fp, 128); |
|
| 1394 | + } |
|
| 1314 | 1395 | |
| 1315 | 1396 | fclose($fp); |
| 1316 | 1397 | |
| 1317 | 1398 | // Get the unique site ID. |
| 1318 | 1399 | preg_match('~SITE-ID:\s(\w{10})~', $return_data, $ID); |
| 1319 | 1400 | |
| 1320 | - if (!empty($ID[1])) |
|
| 1321 | - $smcFunc['db_insert']('replace', |
|
| 1401 | + if (!empty($ID[1])) { |
|
| 1402 | + $smcFunc['db_insert']('replace', |
|
| 1322 | 1403 | $db_prefix . 'settings', |
| 1323 | 1404 | array('variable' => 'string', 'value' => 'string'), |
| 1324 | 1405 | array( |
@@ -1327,11 +1408,12 @@ discard block |
||
| 1327 | 1408 | ), |
| 1328 | 1409 | array('variable') |
| 1329 | 1410 | ); |
| 1411 | + } |
|
| 1330 | 1412 | } |
| 1331 | 1413 | } |
| 1332 | 1414 | // Don't remove stat collection unless we unchecked the box for real, not from the loop. |
| 1333 | - elseif (empty($_POST['stats']) && empty($upcontext['allow_sm_stats'])) |
|
| 1334 | - $smcFunc['db_query']('', ' |
|
| 1415 | + elseif (empty($_POST['stats']) && empty($upcontext['allow_sm_stats'])) { |
|
| 1416 | + $smcFunc['db_query']('', ' |
|
| 1335 | 1417 | DELETE FROM {db_prefix}settings |
| 1336 | 1418 | WHERE variable = {string:enable_sm_stats}', |
| 1337 | 1419 | array( |
@@ -1339,20 +1421,23 @@ discard block |
||
| 1339 | 1421 | 'db_error_skip' => true, |
| 1340 | 1422 | ) |
| 1341 | 1423 | ); |
| 1424 | + } |
|
| 1342 | 1425 | |
| 1343 | 1426 | // Are we enabling SSL? |
| 1344 | - if (!empty($_POST['force_ssl'])) |
|
| 1345 | - $newSettings[] = array('force_ssl', 1); |
|
| 1427 | + if (!empty($_POST['force_ssl'])) { |
|
| 1428 | + $newSettings[] = array('force_ssl', 1); |
|
| 1429 | + } |
|
| 1346 | 1430 | |
| 1347 | 1431 | // Setting a timezone is required. |
| 1348 | 1432 | if (!isset($modSettings['default_timezone']) && function_exists('date_default_timezone_set')) |
| 1349 | 1433 | { |
| 1350 | 1434 | // Get PHP's default timezone, if set |
| 1351 | 1435 | $ini_tz = ini_get('date.timezone'); |
| 1352 | - if (!empty($ini_tz)) |
|
| 1353 | - $timezone_id = $ini_tz; |
|
| 1354 | - else |
|
| 1355 | - $timezone_id = ''; |
|
| 1436 | + if (!empty($ini_tz)) { |
|
| 1437 | + $timezone_id = $ini_tz; |
|
| 1438 | + } else { |
|
| 1439 | + $timezone_id = ''; |
|
| 1440 | + } |
|
| 1356 | 1441 | |
| 1357 | 1442 | // If date.timezone is unset, invalid, or just plain weird, make a best guess |
| 1358 | 1443 | if (!in_array($timezone_id, timezone_identifiers_list())) |
@@ -1361,8 +1446,9 @@ discard block |
||
| 1361 | 1446 | $timezone_id = timezone_name_from_abbr('', $server_offset, 0); |
| 1362 | 1447 | } |
| 1363 | 1448 | |
| 1364 | - if (date_default_timezone_set($timezone_id)) |
|
| 1365 | - $newSettings[] = array('default_timezone', $timezone_id); |
|
| 1449 | + if (date_default_timezone_set($timezone_id)) { |
|
| 1450 | + $newSettings[] = array('default_timezone', $timezone_id); |
|
| 1451 | + } |
|
| 1366 | 1452 | } |
| 1367 | 1453 | |
| 1368 | 1454 | if (!empty($newSettings)) |
@@ -1393,16 +1479,18 @@ discard block |
||
| 1393 | 1479 | } |
| 1394 | 1480 | |
| 1395 | 1481 | // MySQL specific stuff |
| 1396 | - if (substr($db_type, 0, 5) != 'mysql') |
|
| 1397 | - return false; |
|
| 1482 | + if (substr($db_type, 0, 5) != 'mysql') { |
|
| 1483 | + return false; |
|
| 1484 | + } |
|
| 1398 | 1485 | |
| 1399 | 1486 | // Find database user privileges. |
| 1400 | 1487 | $privs = array(); |
| 1401 | 1488 | $get_privs = $smcFunc['db_query']('', 'SHOW PRIVILEGES', array()); |
| 1402 | 1489 | while ($row = $smcFunc['db_fetch_assoc']($get_privs)) |
| 1403 | 1490 | { |
| 1404 | - if ($row['Privilege'] == 'Alter') |
|
| 1405 | - $privs[] = $row['Privilege']; |
|
| 1491 | + if ($row['Privilege'] == 'Alter') { |
|
| 1492 | + $privs[] = $row['Privilege']; |
|
| 1493 | + } |
|
| 1406 | 1494 | } |
| 1407 | 1495 | $smcFunc['db_free_result']($get_privs); |
| 1408 | 1496 | |
@@ -1432,8 +1520,9 @@ discard block |
||
| 1432 | 1520 | $incontext['continue'] = 1; |
| 1433 | 1521 | |
| 1434 | 1522 | // Skipping? |
| 1435 | - if (!empty($_POST['skip'])) |
|
| 1436 | - return true; |
|
| 1523 | + if (!empty($_POST['skip'])) { |
|
| 1524 | + return true; |
|
| 1525 | + } |
|
| 1437 | 1526 | |
| 1438 | 1527 | // Need this to check whether we need the database password. |
| 1439 | 1528 | require(dirname(__FILE__) . '/Settings.php'); |
@@ -1450,18 +1539,22 @@ discard block |
||
| 1450 | 1539 | // We need this to properly hash the password for Admin |
| 1451 | 1540 | $smcFunc['strtolower'] = $db_character_set != 'utf8' && $txt['lang_character_set'] != 'UTF-8' ? 'strtolower' : function($string) { |
| 1452 | 1541 | global $sourcedir; |
| 1453 | - if (function_exists('mb_strtolower')) |
|
| 1454 | - return mb_strtolower($string, 'UTF-8'); |
|
| 1542 | + if (function_exists('mb_strtolower')) { |
|
| 1543 | + return mb_strtolower($string, 'UTF-8'); |
|
| 1544 | + } |
|
| 1455 | 1545 | require_once($sourcedir . '/Subs-Charset.php'); |
| 1456 | 1546 | return utf8_strtolower($string); |
| 1457 | 1547 | }; |
| 1458 | 1548 | |
| 1459 | - if (!isset($_POST['username'])) |
|
| 1460 | - $_POST['username'] = ''; |
|
| 1461 | - if (!isset($_POST['email'])) |
|
| 1462 | - $_POST['email'] = ''; |
|
| 1463 | - if (!isset($_POST['server_email'])) |
|
| 1464 | - $_POST['server_email'] = ''; |
|
| 1549 | + if (!isset($_POST['username'])) { |
|
| 1550 | + $_POST['username'] = ''; |
|
| 1551 | + } |
|
| 1552 | + if (!isset($_POST['email'])) { |
|
| 1553 | + $_POST['email'] = ''; |
|
| 1554 | + } |
|
| 1555 | + if (!isset($_POST['server_email'])) { |
|
| 1556 | + $_POST['server_email'] = ''; |
|
| 1557 | + } |
|
| 1465 | 1558 | |
| 1466 | 1559 | $incontext['username'] = htmlspecialchars(stripslashes($_POST['username'])); |
| 1467 | 1560 | $incontext['email'] = htmlspecialchars(stripslashes($_POST['email'])); |
@@ -1480,8 +1573,9 @@ discard block |
||
| 1480 | 1573 | 'admin_group' => 1, |
| 1481 | 1574 | ) |
| 1482 | 1575 | ); |
| 1483 | - if ($smcFunc['db_num_rows']($request) != 0) |
|
| 1484 | - $incontext['skip'] = 1; |
|
| 1576 | + if ($smcFunc['db_num_rows']($request) != 0) { |
|
| 1577 | + $incontext['skip'] = 1; |
|
| 1578 | + } |
|
| 1485 | 1579 | $smcFunc['db_free_result']($request); |
| 1486 | 1580 | |
| 1487 | 1581 | // Trying to create an account? |
@@ -1512,8 +1606,9 @@ discard block |
||
| 1512 | 1606 | } |
| 1513 | 1607 | |
| 1514 | 1608 | // Update the webmaster's email? |
| 1515 | - if (!empty($_POST['server_email']) && (empty($webmaster_email) || $webmaster_email == '[email protected]')) |
|
| 1516 | - updateSettingsFile(array('webmaster_email' => $_POST['server_email'])); |
|
| 1609 | + if (!empty($_POST['server_email']) && (empty($webmaster_email) || $webmaster_email == '[email protected]')) { |
|
| 1610 | + updateSettingsFile(array('webmaster_email' => $_POST['server_email'])); |
|
| 1611 | + } |
|
| 1517 | 1612 | |
| 1518 | 1613 | // Work out whether we're going to have dodgy characters and remove them. |
| 1519 | 1614 | $invalid_characters = preg_match('~[<>&"\'=\\\]~', $_POST['username']) != 0; |
@@ -1536,32 +1631,27 @@ discard block |
||
| 1536 | 1631 | $smcFunc['db_free_result']($result); |
| 1537 | 1632 | |
| 1538 | 1633 | $incontext['account_existed'] = $txt['error_user_settings_taken']; |
| 1539 | - } |
|
| 1540 | - elseif ($_POST['username'] == '' || strlen($_POST['username']) > 25) |
|
| 1634 | + } elseif ($_POST['username'] == '' || strlen($_POST['username']) > 25) |
|
| 1541 | 1635 | { |
| 1542 | 1636 | // Try the previous step again. |
| 1543 | 1637 | $incontext['error'] = $_POST['username'] == '' ? $txt['error_username_left_empty'] : $txt['error_username_too_long']; |
| 1544 | 1638 | return false; |
| 1545 | - } |
|
| 1546 | - elseif ($invalid_characters || $_POST['username'] == '_' || $_POST['username'] == '|' || strpos($_POST['username'], '[code') !== false || strpos($_POST['username'], '[/code') !== false) |
|
| 1639 | + } elseif ($invalid_characters || $_POST['username'] == '_' || $_POST['username'] == '|' || strpos($_POST['username'], '[code') !== false || strpos($_POST['username'], '[/code') !== false) |
|
| 1547 | 1640 | { |
| 1548 | 1641 | // Try the previous step again. |
| 1549 | 1642 | $incontext['error'] = $txt['error_invalid_characters_username']; |
| 1550 | 1643 | return false; |
| 1551 | - } |
|
| 1552 | - elseif (empty($_POST['email']) || !filter_var(stripslashes($_POST['email']), FILTER_VALIDATE_EMAIL) || strlen(stripslashes($_POST['email'])) > 255) |
|
| 1644 | + } elseif (empty($_POST['email']) || !filter_var(stripslashes($_POST['email']), FILTER_VALIDATE_EMAIL) || strlen(stripslashes($_POST['email'])) > 255) |
|
| 1553 | 1645 | { |
| 1554 | 1646 | // One step back, this time fill out a proper admin email address. |
| 1555 | 1647 | $incontext['error'] = sprintf($txt['error_valid_admin_email_needed'], $_POST['username']); |
| 1556 | 1648 | return false; |
| 1557 | - } |
|
| 1558 | - elseif (empty($_POST['server_email']) || !filter_var(stripslashes($_POST['server_email']), FILTER_VALIDATE_EMAIL) || strlen(stripslashes($_POST['server_email'])) > 255) |
|
| 1649 | + } elseif (empty($_POST['server_email']) || !filter_var(stripslashes($_POST['server_email']), FILTER_VALIDATE_EMAIL) || strlen(stripslashes($_POST['server_email'])) > 255) |
|
| 1559 | 1650 | { |
| 1560 | 1651 | // One step back, this time fill out a proper admin email address. |
| 1561 | 1652 | $incontext['error'] = $txt['error_valid_server_email_needed']; |
| 1562 | 1653 | return false; |
| 1563 | - } |
|
| 1564 | - elseif ($_POST['username'] != '') |
|
| 1654 | + } elseif ($_POST['username'] != '') |
|
| 1565 | 1655 | { |
| 1566 | 1656 | $incontext['member_salt'] = substr(md5(mt_rand()), 0, 4); |
| 1567 | 1657 | |
@@ -1629,17 +1719,19 @@ discard block |
||
| 1629 | 1719 | reloadSettings(); |
| 1630 | 1720 | |
| 1631 | 1721 | // Bring a warning over. |
| 1632 | - if (!empty($incontext['account_existed'])) |
|
| 1633 | - $incontext['warning'] = $incontext['account_existed']; |
|
| 1722 | + if (!empty($incontext['account_existed'])) { |
|
| 1723 | + $incontext['warning'] = $incontext['account_existed']; |
|
| 1724 | + } |
|
| 1634 | 1725 | |
| 1635 | - if (!empty($db_character_set) && !empty($databases[$db_type]['utf8_support'])) |
|
| 1636 | - $smcFunc['db_query']('', ' |
|
| 1726 | + if (!empty($db_character_set) && !empty($databases[$db_type]['utf8_support'])) { |
|
| 1727 | + $smcFunc['db_query']('', ' |
|
| 1637 | 1728 | SET NAMES {string:db_character_set}', |
| 1638 | 1729 | array( |
| 1639 | 1730 | 'db_character_set' => $db_character_set, |
| 1640 | 1731 | 'db_error_skip' => true, |
| 1641 | 1732 | ) |
| 1642 | 1733 | ); |
| 1734 | + } |
|
| 1643 | 1735 | |
| 1644 | 1736 | // As track stats is by default enabled let's add some activity. |
| 1645 | 1737 | $smcFunc['db_insert']('ignore', |
@@ -1660,14 +1752,16 @@ discard block |
||
| 1660 | 1752 | // Only proceed if we can load the data. |
| 1661 | 1753 | if ($request) |
| 1662 | 1754 | { |
| 1663 | - while ($row = $smcFunc['db_fetch_row']($request)) |
|
| 1664 | - $modSettings[$row[0]] = $row[1]; |
|
| 1755 | + while ($row = $smcFunc['db_fetch_row']($request)) { |
|
| 1756 | + $modSettings[$row[0]] = $row[1]; |
|
| 1757 | + } |
|
| 1665 | 1758 | $smcFunc['db_free_result']($request); |
| 1666 | 1759 | } |
| 1667 | 1760 | |
| 1668 | 1761 | // Automatically log them in ;) |
| 1669 | - if (isset($incontext['member_id']) && isset($incontext['member_salt'])) |
|
| 1670 | - setLoginCookie(3153600 * 60, $incontext['member_id'], hash_salt($_POST['password1'], $incontext['member_salt'])); |
|
| 1762 | + if (isset($incontext['member_id']) && isset($incontext['member_salt'])) { |
|
| 1763 | + setLoginCookie(3153600 * 60, $incontext['member_id'], hash_salt($_POST['password1'], $incontext['member_salt'])); |
|
| 1764 | + } |
|
| 1671 | 1765 | |
| 1672 | 1766 | $result = $smcFunc['db_query']('', ' |
| 1673 | 1767 | SELECT value |
@@ -1678,13 +1772,14 @@ discard block |
||
| 1678 | 1772 | 'db_error_skip' => true, |
| 1679 | 1773 | ) |
| 1680 | 1774 | ); |
| 1681 | - if ($smcFunc['db_num_rows']($result) != 0) |
|
| 1682 | - list ($db_sessions) = $smcFunc['db_fetch_row']($result); |
|
| 1775 | + if ($smcFunc['db_num_rows']($result) != 0) { |
|
| 1776 | + list ($db_sessions) = $smcFunc['db_fetch_row']($result); |
|
| 1777 | + } |
|
| 1683 | 1778 | $smcFunc['db_free_result']($result); |
| 1684 | 1779 | |
| 1685 | - if (empty($db_sessions)) |
|
| 1686 | - $_SESSION['admin_time'] = time(); |
|
| 1687 | - else |
|
| 1780 | + if (empty($db_sessions)) { |
|
| 1781 | + $_SESSION['admin_time'] = time(); |
|
| 1782 | + } else |
|
| 1688 | 1783 | { |
| 1689 | 1784 | $_SERVER['HTTP_USER_AGENT'] = substr($_SERVER['HTTP_USER_AGENT'], 0, 211); |
| 1690 | 1785 | |
@@ -1708,8 +1803,9 @@ discard block |
||
| 1708 | 1803 | $smcFunc['strtolower'] = $db_character_set != 'utf8' && $txt['lang_character_set'] != 'UTF-8' ? 'strtolower' : |
| 1709 | 1804 | function($string){ |
| 1710 | 1805 | global $sourcedir; |
| 1711 | - if (function_exists('mb_strtolower')) |
|
| 1712 | - return mb_strtolower($string, 'UTF-8'); |
|
| 1806 | + if (function_exists('mb_strtolower')) { |
|
| 1807 | + return mb_strtolower($string, 'UTF-8'); |
|
| 1808 | + } |
|
| 1713 | 1809 | require_once($sourcedir . '/Subs-Charset.php'); |
| 1714 | 1810 | return utf8_strtolower($string); |
| 1715 | 1811 | }; |
@@ -1725,8 +1821,9 @@ discard block |
||
| 1725 | 1821 | ) |
| 1726 | 1822 | ); |
| 1727 | 1823 | $context['utf8'] = $db_character_set === 'utf8' || $txt['lang_character_set'] === 'UTF-8'; |
| 1728 | - if ($smcFunc['db_num_rows']($request) > 0) |
|
| 1729 | - updateStats('subject', 1, htmlspecialchars($txt['default_topic_subject'])); |
|
| 1824 | + if ($smcFunc['db_num_rows']($request) > 0) { |
|
| 1825 | + updateStats('subject', 1, htmlspecialchars($txt['default_topic_subject'])); |
|
| 1826 | + } |
|
| 1730 | 1827 | $smcFunc['db_free_result']($request); |
| 1731 | 1828 | |
| 1732 | 1829 | // Now is the perfect time to fetch the SM files. |
@@ -1745,8 +1842,9 @@ discard block |
||
| 1745 | 1842 | |
| 1746 | 1843 | // Check if we need some stupid MySQL fix. |
| 1747 | 1844 | $server_version = $smcFunc['db_server_info'](); |
| 1748 | - if (($db_type == 'mysql' || $db_type == 'mysqli') && in_array(substr($server_version, 0, 6), array('5.0.50', '5.0.51'))) |
|
| 1749 | - updateSettings(array('db_mysql_group_by_fix' => '1')); |
|
| 1845 | + if (($db_type == 'mysql' || $db_type == 'mysqli') && in_array(substr($server_version, 0, 6), array('5.0.50', '5.0.51'))) { |
|
| 1846 | + updateSettings(array('db_mysql_group_by_fix' => '1')); |
|
| 1847 | + } |
|
| 1750 | 1848 | |
| 1751 | 1849 | // Some final context for the template. |
| 1752 | 1850 | $incontext['dir_still_writable'] = is_writable(dirname(__FILE__)) && substr(__FILE__, 1, 2) != ':\\'; |
@@ -1766,8 +1864,9 @@ discard block |
||
| 1766 | 1864 | $settingsArray = file(dirname(__FILE__) . '/Settings.php'); |
| 1767 | 1865 | |
| 1768 | 1866 | // @todo Do we just want to read the file in clean, and split it this way always? |
| 1769 | - if (count($settingsArray) == 1) |
|
| 1770 | - $settingsArray = preg_split('~[\r\n]~', $settingsArray[0]); |
|
| 1867 | + if (count($settingsArray) == 1) { |
|
| 1868 | + $settingsArray = preg_split('~[\r\n]~', $settingsArray[0]); |
|
| 1869 | + } |
|
| 1771 | 1870 | |
| 1772 | 1871 | for ($i = 0, $n = count($settingsArray); $i < $n; $i++) |
| 1773 | 1872 | { |
@@ -1775,25 +1874,29 @@ discard block |
||
| 1775 | 1874 | if (trim($settingsArray[$i]) == 'if (file_exists(dirname(__FILE__) . \'/install.php\'))' && trim($settingsArray[$i + 1]) == '{' && trim($settingsArray[$i + 9]) == '}') |
| 1776 | 1875 | { |
| 1777 | 1876 | // Set the ten lines to nothing. |
| 1778 | - for ($j=0; $j < 10; $j++) |
|
| 1779 | - $settingsArray[$i++] = ''; |
|
| 1877 | + for ($j=0; $j < 10; $j++) { |
|
| 1878 | + $settingsArray[$i++] = ''; |
|
| 1879 | + } |
|
| 1780 | 1880 | |
| 1781 | 1881 | continue; |
| 1782 | 1882 | } |
| 1783 | 1883 | |
| 1784 | - if (trim($settingsArray[$i]) == '?' . '>') |
|
| 1785 | - $settingsArray[$i] = ''; |
|
| 1884 | + if (trim($settingsArray[$i]) == '?' . '>') { |
|
| 1885 | + $settingsArray[$i] = ''; |
|
| 1886 | + } |
|
| 1786 | 1887 | |
| 1787 | 1888 | // Don't trim or bother with it if it's not a variable. |
| 1788 | - if (substr($settingsArray[$i], 0, 1) != '$') |
|
| 1789 | - continue; |
|
| 1889 | + if (substr($settingsArray[$i], 0, 1) != '$') { |
|
| 1890 | + continue; |
|
| 1891 | + } |
|
| 1790 | 1892 | |
| 1791 | 1893 | $settingsArray[$i] = rtrim($settingsArray[$i]) . "\n"; |
| 1792 | 1894 | |
| 1793 | - foreach ($vars as $var => $val) |
|
| 1794 | - if (strncasecmp($settingsArray[$i], '$' . $var, 1 + strlen($var)) == 0) |
|
| 1895 | + foreach ($vars as $var => $val) { |
|
| 1896 | + if (strncasecmp($settingsArray[$i], '$' . $var, 1 + strlen($var)) == 0) |
|
| 1795 | 1897 | { |
| 1796 | 1898 | $comment = strstr($settingsArray[$i], '#'); |
| 1899 | + } |
|
| 1797 | 1900 | $settingsArray[$i] = '$' . $var . ' = \'' . $val . '\';' . ($comment != '' ? "\t\t" . $comment : "\n"); |
| 1798 | 1901 | unset($vars[$var]); |
| 1799 | 1902 | } |
@@ -1803,36 +1906,41 @@ discard block |
||
| 1803 | 1906 | if (!empty($vars)) |
| 1804 | 1907 | { |
| 1805 | 1908 | $settingsArray[$i++] = ''; |
| 1806 | - foreach ($vars as $var => $val) |
|
| 1807 | - $settingsArray[$i++] = '$' . $var . ' = \'' . $val . '\';' . "\n"; |
|
| 1909 | + foreach ($vars as $var => $val) { |
|
| 1910 | + $settingsArray[$i++] = '$' . $var . ' = \'' . $val . '\';' . "\n"; |
|
| 1911 | + } |
|
| 1808 | 1912 | } |
| 1809 | 1913 | |
| 1810 | 1914 | // Blank out the file - done to fix a oddity with some servers. |
| 1811 | 1915 | $fp = @fopen(dirname(__FILE__) . '/Settings.php', 'w'); |
| 1812 | - if (!$fp) |
|
| 1813 | - return false; |
|
| 1916 | + if (!$fp) { |
|
| 1917 | + return false; |
|
| 1918 | + } |
|
| 1814 | 1919 | fclose($fp); |
| 1815 | 1920 | |
| 1816 | 1921 | $fp = fopen(dirname(__FILE__) . '/Settings.php', 'r+'); |
| 1817 | 1922 | |
| 1818 | 1923 | // Gotta have one of these ;) |
| 1819 | - if (trim($settingsArray[0]) != '<?php') |
|
| 1820 | - fwrite($fp, "<?php\n"); |
|
| 1924 | + if (trim($settingsArray[0]) != '<?php') { |
|
| 1925 | + fwrite($fp, "<?php\n"); |
|
| 1926 | + } |
|
| 1821 | 1927 | |
| 1822 | 1928 | $lines = count($settingsArray); |
| 1823 | 1929 | for ($i = 0; $i < $lines - 1; $i++) |
| 1824 | 1930 | { |
| 1825 | 1931 | // Don't just write a bunch of blank lines. |
| 1826 | - if ($settingsArray[$i] != '' || @$settingsArray[$i - 1] != '') |
|
| 1827 | - fwrite($fp, strtr($settingsArray[$i], "\r", '')); |
|
| 1932 | + if ($settingsArray[$i] != '' || @$settingsArray[$i - 1] != '') { |
|
| 1933 | + fwrite($fp, strtr($settingsArray[$i], "\r", '')); |
|
| 1934 | + } |
|
| 1828 | 1935 | } |
| 1829 | 1936 | fwrite($fp, $settingsArray[$i] . '?' . '>'); |
| 1830 | 1937 | fclose($fp); |
| 1831 | 1938 | |
| 1832 | 1939 | // Even though on normal installations the filemtime should prevent this being used by the installer incorrectly |
| 1833 | 1940 | // it seems that there are times it might not. So let's MAKE it dump the cache. |
| 1834 | - if (function_exists('opcache_invalidate')) |
|
| 1835 | - opcache_invalidate(dirname(__FILE__) . '/Settings.php', true); |
|
| 1941 | + if (function_exists('opcache_invalidate')) { |
|
| 1942 | + opcache_invalidate(dirname(__FILE__) . '/Settings.php', true); |
|
| 1943 | + } |
|
| 1836 | 1944 | |
| 1837 | 1945 | return true; |
| 1838 | 1946 | } |
@@ -1842,10 +1950,11 @@ discard block |
||
| 1842 | 1950 | global $cachedir; |
| 1843 | 1951 | |
| 1844 | 1952 | // Write out the db_last_error file with the error timestamp |
| 1845 | - if (!empty($cachedir) && is_writable($cachedir)) |
|
| 1846 | - file_put_contents($cachedir . '/db_last_error.php', '<' . '?' . "php\n" . '$db_last_error = 0;' . "\n" . '?' . '>'); |
|
| 1847 | - else |
|
| 1848 | - file_put_contents(dirname(__FILE__) . '/cache/db_last_error.php', '<' . '?' . "php\n" . '$db_last_error = 0;' . "\n" . '?' . '>'); |
|
| 1953 | + if (!empty($cachedir) && is_writable($cachedir)) { |
|
| 1954 | + file_put_contents($cachedir . '/db_last_error.php', '<' . '?' . "php\n" . '$db_last_error = 0;' . "\n" . '?' . '>'); |
|
| 1955 | + } else { |
|
| 1956 | + file_put_contents(dirname(__FILE__) . '/cache/db_last_error.php', '<' . '?' . "php\n" . '$db_last_error = 0;' . "\n" . '?' . '>'); |
|
| 1957 | + } |
|
| 1849 | 1958 | |
| 1850 | 1959 | return true; |
| 1851 | 1960 | } |
@@ -1862,9 +1971,9 @@ discard block |
||
| 1862 | 1971 | SecFilterScanPOST Off |
| 1863 | 1972 | </IfModule>'; |
| 1864 | 1973 | |
| 1865 | - if (!function_exists('apache_get_modules') || !in_array('mod_security', apache_get_modules())) |
|
| 1866 | - return true; |
|
| 1867 | - elseif (file_exists(dirname(__FILE__) . '/.htaccess') && is_writable(dirname(__FILE__) . '/.htaccess')) |
|
| 1974 | + if (!function_exists('apache_get_modules') || !in_array('mod_security', apache_get_modules())) { |
|
| 1975 | + return true; |
|
| 1976 | + } elseif (file_exists(dirname(__FILE__) . '/.htaccess') && is_writable(dirname(__FILE__) . '/.htaccess')) |
|
| 1868 | 1977 | { |
| 1869 | 1978 | $current_htaccess = implode('', file(dirname(__FILE__) . '/.htaccess')); |
| 1870 | 1979 | |
@@ -1876,29 +1985,28 @@ discard block |
||
| 1876 | 1985 | fwrite($ht_handle, $htaccess_addition); |
| 1877 | 1986 | fclose($ht_handle); |
| 1878 | 1987 | return true; |
| 1988 | + } else { |
|
| 1989 | + return false; |
|
| 1879 | 1990 | } |
| 1880 | - else |
|
| 1881 | - return false; |
|
| 1991 | + } else { |
|
| 1992 | + return true; |
|
| 1882 | 1993 | } |
| 1883 | - else |
|
| 1884 | - return true; |
|
| 1885 | - } |
|
| 1886 | - elseif (file_exists(dirname(__FILE__) . '/.htaccess')) |
|
| 1887 | - return strpos(implode('', file(dirname(__FILE__) . '/.htaccess')), '<IfModule mod_security.c>') !== false; |
|
| 1888 | - elseif (is_writable(dirname(__FILE__))) |
|
| 1994 | + } elseif (file_exists(dirname(__FILE__) . '/.htaccess')) { |
|
| 1995 | + return strpos(implode('', file(dirname(__FILE__) . '/.htaccess')), '<IfModule mod_security.c>') !== false; |
|
| 1996 | + } elseif (is_writable(dirname(__FILE__))) |
|
| 1889 | 1997 | { |
| 1890 | 1998 | if ($ht_handle = fopen(dirname(__FILE__) . '/.htaccess', 'w')) |
| 1891 | 1999 | { |
| 1892 | 2000 | fwrite($ht_handle, $htaccess_addition); |
| 1893 | 2001 | fclose($ht_handle); |
| 1894 | 2002 | return true; |
| 2003 | + } else { |
|
| 2004 | + return false; |
|
| 1895 | 2005 | } |
| 1896 | - else |
|
| 2006 | + } else { |
|
| 1897 | 2007 | return false; |
| 1898 | 2008 | } |
| 1899 | - else |
|
| 1900 | - return false; |
|
| 1901 | -} |
|
| 2009 | + } |
|
| 1902 | 2010 | |
| 1903 | 2011 | function template_install_above() |
| 1904 | 2012 | { |
@@ -1937,9 +2045,10 @@ discard block |
||
| 1937 | 2045 | <label for="installer_language">', $txt['installer_language'], ':</label> |
| 1938 | 2046 | <select id="installer_language" name="lang_file" onchange="location.href = \'', $installurl, '?lang_file=\' + this.options[this.selectedIndex].value;">'; |
| 1939 | 2047 | |
| 1940 | - foreach ($incontext['detected_languages'] as $lang => $name) |
|
| 1941 | - echo ' |
|
| 2048 | + foreach ($incontext['detected_languages'] as $lang => $name) { |
|
| 2049 | + echo ' |
|
| 1942 | 2050 | <option', isset($_SESSION['installer_temp_lang']) && $_SESSION['installer_temp_lang'] == $lang ? ' selected' : '', ' value="', $lang, '">', $name, '</option>'; |
| 2051 | + } |
|
| 1943 | 2052 | |
| 1944 | 2053 | echo ' |
| 1945 | 2054 | </select> |
@@ -1959,9 +2068,10 @@ discard block |
||
| 1959 | 2068 | <h2>', $txt['upgrade_progress'], '</h2> |
| 1960 | 2069 | <ul>'; |
| 1961 | 2070 | |
| 1962 | - foreach ($incontext['steps'] as $num => $step) |
|
| 1963 | - echo ' |
|
| 2071 | + foreach ($incontext['steps'] as $num => $step) { |
|
| 2072 | + echo ' |
|
| 1964 | 2073 | <li class="', $num < $incontext['current_step'] ? 'stepdone' : ($num == $incontext['current_step'] ? 'stepcurrent' : 'stepwaiting'), '">', $txt['upgrade_step'], ' ', $step[0], ': ', $step[1], '</li>'; |
| 2074 | + } |
|
| 1965 | 2075 | |
| 1966 | 2076 | echo ' |
| 1967 | 2077 | </ul> |
@@ -1987,20 +2097,23 @@ discard block |
||
| 1987 | 2097 | echo ' |
| 1988 | 2098 | <div class="floatright">'; |
| 1989 | 2099 | |
| 1990 | - if (!empty($incontext['continue'])) |
|
| 1991 | - echo ' |
|
| 2100 | + if (!empty($incontext['continue'])) { |
|
| 2101 | + echo ' |
|
| 1992 | 2102 | <input type="submit" id="contbutt" name="contbutt" value="', $txt['upgrade_continue'], '" onclick="return submitThisOnce(this);" class="button">'; |
| 1993 | - if (!empty($incontext['skip'])) |
|
| 1994 | - echo ' |
|
| 2103 | + } |
|
| 2104 | + if (!empty($incontext['skip'])) { |
|
| 2105 | + echo ' |
|
| 1995 | 2106 | <input type="submit" id="skip" name="skip" value="', $txt['upgrade_skip'], '" onclick="return submitThisOnce(this);" class="button">'; |
| 2107 | + } |
|
| 1996 | 2108 | echo ' |
| 1997 | 2109 | </div>'; |
| 1998 | 2110 | } |
| 1999 | 2111 | |
| 2000 | 2112 | // Show the closing form tag and other data only if not in the last step |
| 2001 | - if (count($incontext['steps']) - 1 !== (int) $incontext['current_step']) |
|
| 2002 | - echo ' |
|
| 2113 | + if (count($incontext['steps']) - 1 !== (int) $incontext['current_step']) { |
|
| 2114 | + echo ' |
|
| 2003 | 2115 | </form>'; |
| 2116 | + } |
|
| 2004 | 2117 | |
| 2005 | 2118 | echo ' |
| 2006 | 2119 | </div><!-- .panel --> |
@@ -2033,13 +2146,15 @@ discard block |
||
| 2033 | 2146 | </div>'; |
| 2034 | 2147 | |
| 2035 | 2148 | // Show the warnings, or not. |
| 2036 | - if (template_warning_divs()) |
|
| 2037 | - echo ' |
|
| 2149 | + if (template_warning_divs()) { |
|
| 2150 | + echo ' |
|
| 2038 | 2151 | <h3>', $txt['install_all_lovely'], '</h3>'; |
| 2152 | + } |
|
| 2039 | 2153 | |
| 2040 | 2154 | // Say we want the continue button! |
| 2041 | - if (empty($incontext['error'])) |
|
| 2042 | - $incontext['continue'] = 1; |
|
| 2155 | + if (empty($incontext['error'])) { |
|
| 2156 | + $incontext['continue'] = 1; |
|
| 2157 | + } |
|
| 2043 | 2158 | |
| 2044 | 2159 | // For the latest version stuff. |
| 2045 | 2160 | echo ' |
@@ -2073,19 +2188,21 @@ discard block |
||
| 2073 | 2188 | global $txt, $incontext; |
| 2074 | 2189 | |
| 2075 | 2190 | // Errors are very serious.. |
| 2076 | - if (!empty($incontext['error'])) |
|
| 2077 | - echo ' |
|
| 2191 | + if (!empty($incontext['error'])) { |
|
| 2192 | + echo ' |
|
| 2078 | 2193 | <div class="errorbox"> |
| 2079 | 2194 | <h3>', $txt['upgrade_critical_error'], '</h3> |
| 2080 | 2195 | ', $incontext['error'], ' |
| 2081 | 2196 | </div>'; |
| 2197 | + } |
|
| 2082 | 2198 | // A warning message? |
| 2083 | - elseif (!empty($incontext['warning'])) |
|
| 2084 | - echo ' |
|
| 2199 | + elseif (!empty($incontext['warning'])) { |
|
| 2200 | + echo ' |
|
| 2085 | 2201 | <div class="errorbox"> |
| 2086 | 2202 | <h3>', $txt['upgrade_warning'], '</h3> |
| 2087 | 2203 | ', $incontext['warning'], ' |
| 2088 | 2204 | </div>'; |
| 2205 | + } |
|
| 2089 | 2206 | |
| 2090 | 2207 | return empty($incontext['error']) && empty($incontext['warning']); |
| 2091 | 2208 | } |
@@ -2101,26 +2218,29 @@ discard block |
||
| 2101 | 2218 | <li>', $incontext['failed_files']), '</li> |
| 2102 | 2219 | </ul>'; |
| 2103 | 2220 | |
| 2104 | - if (isset($incontext['systemos'], $incontext['detected_path']) && $incontext['systemos'] == 'linux') |
|
| 2105 | - echo ' |
|
| 2221 | + if (isset($incontext['systemos'], $incontext['detected_path']) && $incontext['systemos'] == 'linux') { |
|
| 2222 | + echo ' |
|
| 2106 | 2223 | <hr> |
| 2107 | 2224 | <p>', $txt['chmod_linux_info'], '</p> |
| 2108 | 2225 | <samp># chmod a+w ', implode(' ' . $incontext['detected_path'] . '/', $incontext['failed_files']), '</samp>'; |
| 2226 | + } |
|
| 2109 | 2227 | |
| 2110 | 2228 | // This is serious! |
| 2111 | - if (!template_warning_divs()) |
|
| 2112 | - return; |
|
| 2229 | + if (!template_warning_divs()) { |
|
| 2230 | + return; |
|
| 2231 | + } |
|
| 2113 | 2232 | |
| 2114 | 2233 | echo ' |
| 2115 | 2234 | <hr> |
| 2116 | 2235 | <p>', $txt['ftp_setup_info'], '</p>'; |
| 2117 | 2236 | |
| 2118 | - if (!empty($incontext['ftp_errors'])) |
|
| 2119 | - echo ' |
|
| 2237 | + if (!empty($incontext['ftp_errors'])) { |
|
| 2238 | + echo ' |
|
| 2120 | 2239 | <div class="error_message"> |
| 2121 | 2240 | ', $txt['error_ftp_no_connect'], '<br><br> |
| 2122 | 2241 | <code>', implode('<br>', $incontext['ftp_errors']), '</code> |
| 2123 | 2242 | </div>'; |
| 2243 | + } |
|
| 2124 | 2244 | |
| 2125 | 2245 | echo ' |
| 2126 | 2246 | <form action="', $incontext['form_url'], '" method="post"> |
@@ -2189,16 +2309,16 @@ discard block |
||
| 2189 | 2309 | <dd> |
| 2190 | 2310 | <select name="db_type" id="db_type_input" onchange="toggleDBInput();">'; |
| 2191 | 2311 | |
| 2192 | - foreach ($incontext['supported_databases'] as $key => $db) |
|
| 2193 | - echo ' |
|
| 2312 | + foreach ($incontext['supported_databases'] as $key => $db) { |
|
| 2313 | + echo ' |
|
| 2194 | 2314 | <option value="', $key, '"', isset($_POST['db_type']) && $_POST['db_type'] == $key ? ' selected' : '', '>', $db['name'], '</option>'; |
| 2315 | + } |
|
| 2195 | 2316 | |
| 2196 | 2317 | echo ' |
| 2197 | 2318 | </select> |
| 2198 | 2319 | <div class="smalltext">', $txt['db_settings_type_info'], '</div> |
| 2199 | 2320 | </dd>'; |
| 2200 | - } |
|
| 2201 | - else |
|
| 2321 | + } else |
|
| 2202 | 2322 | { |
| 2203 | 2323 | echo ' |
| 2204 | 2324 | <dd> |
@@ -2366,9 +2486,10 @@ discard block |
||
| 2366 | 2486 | <div class="red">', $txt['error_db_queries'], '</div> |
| 2367 | 2487 | <ul>'; |
| 2368 | 2488 | |
| 2369 | - foreach ($incontext['failures'] as $line => $fail) |
|
| 2370 | - echo ' |
|
| 2489 | + foreach ($incontext['failures'] as $line => $fail) { |
|
| 2490 | + echo ' |
|
| 2371 | 2491 | <li><strong>', $txt['error_db_queries_line'], $line + 1, ':</strong> ', nl2br(htmlspecialchars($fail)), '</li>'; |
| 2492 | + } |
|
| 2372 | 2493 | |
| 2373 | 2494 | echo ' |
| 2374 | 2495 | </ul>'; |
@@ -2433,15 +2554,16 @@ discard block |
||
| 2433 | 2554 | </dd> |
| 2434 | 2555 | </dl>'; |
| 2435 | 2556 | |
| 2436 | - if ($incontext['require_db_confirm']) |
|
| 2437 | - echo ' |
|
| 2557 | + if ($incontext['require_db_confirm']) { |
|
| 2558 | + echo ' |
|
| 2438 | 2559 | <h2>', $txt['user_settings_database'], '</h2> |
| 2439 | 2560 | <p>', $txt['user_settings_database_info'], '</p> |
| 2440 | 2561 | |
| 2441 | 2562 | <div class="lefttext"> |
| 2442 | 2563 | <input type="password" name="password3" size="30"> |
| 2443 | 2564 | </div>'; |
| 2444 | -} |
|
| 2565 | + } |
|
| 2566 | + } |
|
| 2445 | 2567 | |
| 2446 | 2568 | // Tell them it's done, and to delete. |
| 2447 | 2569 | function template_delete_install() |
@@ -2454,13 +2576,14 @@ discard block |
||
| 2454 | 2576 | template_warning_divs(); |
| 2455 | 2577 | |
| 2456 | 2578 | // Install directory still writable? |
| 2457 | - if ($incontext['dir_still_writable']) |
|
| 2458 | - echo ' |
|
| 2579 | + if ($incontext['dir_still_writable']) { |
|
| 2580 | + echo ' |
|
| 2459 | 2581 | <p><em>', $txt['still_writable'], '</em></p>'; |
| 2582 | + } |
|
| 2460 | 2583 | |
| 2461 | 2584 | // Don't show the box if it's like 99% sure it won't work :P. |
| 2462 | - if ($incontext['probably_delete_install']) |
|
| 2463 | - echo ' |
|
| 2585 | + if ($incontext['probably_delete_install']) { |
|
| 2586 | + echo ' |
|
| 2464 | 2587 | <label> |
| 2465 | 2588 | <input type="checkbox" id="delete_self" onclick="doTheDelete();"> |
| 2466 | 2589 | <strong>', $txt['delete_installer'], !isset($_SESSION['installer_temp_ftp']) ? ' ' . $txt['delete_installer_maybe'] : '', '</strong> |
@@ -2476,6 +2599,7 @@ discard block |
||
| 2476 | 2599 | theCheck.disabled = true; |
| 2477 | 2600 | } |
| 2478 | 2601 | </script>'; |
| 2602 | + } |
|
| 2479 | 2603 | |
| 2480 | 2604 | echo ' |
| 2481 | 2605 | <p>', sprintf($txt['go_to_your_forum'], $boardurl . '/index.php'), '</p> |