@@ -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 | |
@@ -374,14 +391,17 @@ discard block |
||
| 374 | 391 | |
| 375 | 392 | $options = array('persist' => $db_persist); |
| 376 | 393 | |
| 377 | - if (!empty($db_port)) |
|
| 378 | - $options['port'] = $db_port; |
|
| 394 | + if (!empty($db_port)) { |
|
| 395 | + $options['port'] = $db_port; |
|
| 396 | + } |
|
| 379 | 397 | |
| 380 | - if (!empty($db_mb4)) |
|
| 381 | - $options['db_mb4'] = $db_mb4; |
|
| 398 | + if (!empty($db_mb4)) { |
|
| 399 | + $options['db_mb4'] = $db_mb4; |
|
| 400 | + } |
|
| 382 | 401 | |
| 383 | - if (!$db_connection) |
|
| 384 | - $db_connection = smf_db_initiate($db_server, $db_name, $db_user, $db_passwd, $db_prefix, $options); |
|
| 402 | + if (!$db_connection) { |
|
| 403 | + $db_connection = smf_db_initiate($db_server, $db_name, $db_user, $db_passwd, $db_prefix, $options); |
|
| 404 | + } |
|
| 385 | 405 | } |
| 386 | 406 | } |
| 387 | 407 | |
@@ -409,8 +429,9 @@ discard block |
||
| 409 | 429 | // @todo REMOVE THIS!! |
| 410 | 430 | else |
| 411 | 431 | { |
| 412 | - if (function_exists('doStep' . $_GET['step'])) |
|
| 413 | - call_user_func('doStep' . $_GET['step']); |
|
| 432 | + if (function_exists('doStep' . $_GET['step'])) { |
|
| 433 | + call_user_func('doStep' . $_GET['step']); |
|
| 434 | + } |
|
| 414 | 435 | } |
| 415 | 436 | // Show the footer. |
| 416 | 437 | template_install_below(); |
@@ -428,8 +449,9 @@ discard block |
||
| 428 | 449 | $incontext['sub_template'] = 'welcome_message'; |
| 429 | 450 | |
| 430 | 451 | // Done the submission? |
| 431 | - if (isset($_POST['contbutt'])) |
|
| 432 | - return true; |
|
| 452 | + if (isset($_POST['contbutt'])) { |
|
| 453 | + return true; |
|
| 454 | + } |
|
| 433 | 455 | |
| 434 | 456 | // See if we think they have already installed it? |
| 435 | 457 | if (is_readable(dirname(__FILE__) . '/Settings.php')) |
@@ -437,14 +459,17 @@ discard block |
||
| 437 | 459 | $probably_installed = 0; |
| 438 | 460 | foreach (file(dirname(__FILE__) . '/Settings.php') as $line) |
| 439 | 461 | { |
| 440 | - if (preg_match('~^\$db_passwd\s=\s\'([^\']+)\';$~', $line)) |
|
| 441 | - $probably_installed++; |
|
| 442 | - if (preg_match('~^\$boardurl\s=\s\'([^\']+)\';~', $line) && !preg_match('~^\$boardurl\s=\s\'http://127\.0\.0\.1/smf\';~', $line)) |
|
| 443 | - $probably_installed++; |
|
| 462 | + if (preg_match('~^\$db_passwd\s=\s\'([^\']+)\';$~', $line)) { |
|
| 463 | + $probably_installed++; |
|
| 464 | + } |
|
| 465 | + if (preg_match('~^\$boardurl\s=\s\'([^\']+)\';~', $line) && !preg_match('~^\$boardurl\s=\s\'http://127\.0\.0\.1/smf\';~', $line)) { |
|
| 466 | + $probably_installed++; |
|
| 467 | + } |
|
| 444 | 468 | } |
| 445 | 469 | |
| 446 | - if ($probably_installed == 2) |
|
| 447 | - $incontext['warning'] = $txt['error_already_installed']; |
|
| 470 | + if ($probably_installed == 2) { |
|
| 471 | + $incontext['warning'] = $txt['error_already_installed']; |
|
| 472 | + } |
|
| 448 | 473 | } |
| 449 | 474 | |
| 450 | 475 | // Is some database support even compiled in? |
@@ -459,45 +484,54 @@ discard block |
||
| 459 | 484 | $databases[$key]['supported'] = false; |
| 460 | 485 | $notFoundSQLFile = true; |
| 461 | 486 | $txt['error_db_script_missing'] = sprintf($txt['error_db_script_missing'], 'install_' . $GLOBALS['db_script_version'] . '_' . $type . '.sql'); |
| 487 | + } else { |
|
| 488 | + $incontext['supported_databases'][] = $db; |
|
| 462 | 489 | } |
| 463 | - else |
|
| 464 | - $incontext['supported_databases'][] = $db; |
|
| 465 | 490 | } |
| 466 | 491 | } |
| 467 | 492 | |
| 468 | 493 | // Check the PHP version. |
| 469 | - if ((!function_exists('version_compare') || version_compare($GLOBALS['required_php_version'], PHP_VERSION, '>='))) |
|
| 470 | - $error = 'error_php_too_low'; |
|
| 494 | + if ((!function_exists('version_compare') || version_compare($GLOBALS['required_php_version'], PHP_VERSION, '>='))) { |
|
| 495 | + $error = 'error_php_too_low'; |
|
| 496 | + } |
|
| 471 | 497 | // Make sure we have a supported database |
| 472 | - elseif (empty($incontext['supported_databases'])) |
|
| 473 | - $error = empty($notFoundSQLFile) ? 'error_db_missing' : 'error_db_script_missing'; |
|
| 498 | + elseif (empty($incontext['supported_databases'])) { |
|
| 499 | + $error = empty($notFoundSQLFile) ? 'error_db_missing' : 'error_db_script_missing'; |
|
| 500 | + } |
|
| 474 | 501 | // How about session support? Some crazy sysadmin remove it? |
| 475 | - elseif (!function_exists('session_start')) |
|
| 476 | - $error = 'error_session_missing'; |
|
| 502 | + elseif (!function_exists('session_start')) { |
|
| 503 | + $error = 'error_session_missing'; |
|
| 504 | + } |
|
| 477 | 505 | // Make sure they uploaded all the files. |
| 478 | - elseif (!file_exists(dirname(__FILE__) . '/index.php')) |
|
| 479 | - $error = 'error_missing_files'; |
|
| 506 | + elseif (!file_exists(dirname(__FILE__) . '/index.php')) { |
|
| 507 | + $error = 'error_missing_files'; |
|
| 508 | + } |
|
| 480 | 509 | // Very simple check on the session.save_path for Windows. |
| 481 | 510 | // @todo Move this down later if they don't use database-driven sessions? |
| 482 | - elseif (@ini_get('session.save_path') == '/tmp' && substr(__FILE__, 1, 2) == ':\\') |
|
| 483 | - $error = 'error_session_save_path'; |
|
| 511 | + elseif (@ini_get('session.save_path') == '/tmp' && substr(__FILE__, 1, 2) == ':\\') { |
|
| 512 | + $error = 'error_session_save_path'; |
|
| 513 | + } |
|
| 484 | 514 | |
| 485 | 515 | // Since each of the three messages would look the same, anyway... |
| 486 | - if (isset($error)) |
|
| 487 | - $incontext['error'] = $txt[$error]; |
|
| 516 | + if (isset($error)) { |
|
| 517 | + $incontext['error'] = $txt[$error]; |
|
| 518 | + } |
|
| 488 | 519 | |
| 489 | 520 | // Mod_security blocks everything that smells funny. Let SMF handle security. |
| 490 | - if (!fixModSecurity() && !isset($_GET['overmodsecurity'])) |
|
| 491 | - $incontext['error'] = $txt['error_mod_security'] . '<br><br><a href="' . $installurl . '?overmodsecurity=true">' . $txt['error_message_click'] . '</a> ' . $txt['error_message_bad_try_again']; |
|
| 521 | + if (!fixModSecurity() && !isset($_GET['overmodsecurity'])) { |
|
| 522 | + $incontext['error'] = $txt['error_mod_security'] . '<br><br><a href="' . $installurl . '?overmodsecurity=true">' . $txt['error_message_click'] . '</a> ' . $txt['error_message_bad_try_again']; |
|
| 523 | + } |
|
| 492 | 524 | |
| 493 | 525 | // Confirm mbstring is loaded... |
| 494 | - if (!extension_loaded('mbstring')) |
|
| 495 | - $incontext['error'] = $txt['install_no_mbstring']; |
|
| 526 | + if (!extension_loaded('mbstring')) { |
|
| 527 | + $incontext['error'] = $txt['install_no_mbstring']; |
|
| 528 | + } |
|
| 496 | 529 | |
| 497 | 530 | // Check for https stream support. |
| 498 | 531 | $supported_streams = stream_get_wrappers(); |
| 499 | - if (!in_array('https', $supported_streams)) |
|
| 500 | - $incontext['warning'] = $txt['install_no_https']; |
|
| 532 | + if (!in_array('https', $supported_streams)) { |
|
| 533 | + $incontext['warning'] = $txt['install_no_https']; |
|
| 534 | + } |
|
| 501 | 535 | |
| 502 | 536 | return false; |
| 503 | 537 | } |
@@ -522,12 +556,14 @@ discard block |
||
| 522 | 556 | 'Settings_bak.php', |
| 523 | 557 | ); |
| 524 | 558 | |
| 525 | - foreach ($incontext['detected_languages'] as $lang => $temp) |
|
| 526 | - $extra_files[] = 'Themes/default/languages/' . $lang; |
|
| 559 | + foreach ($incontext['detected_languages'] as $lang => $temp) { |
|
| 560 | + $extra_files[] = 'Themes/default/languages/' . $lang; |
|
| 561 | + } |
|
| 527 | 562 | |
| 528 | 563 | // With mod_security installed, we could attempt to fix it with .htaccess. |
| 529 | - if (function_exists('apache_get_modules') && in_array('mod_security', apache_get_modules())) |
|
| 530 | - $writable_files[] = file_exists(dirname(__FILE__) . '/.htaccess') ? '.htaccess' : '.'; |
|
| 564 | + if (function_exists('apache_get_modules') && in_array('mod_security', apache_get_modules())) { |
|
| 565 | + $writable_files[] = file_exists(dirname(__FILE__) . '/.htaccess') ? '.htaccess' : '.'; |
|
| 566 | + } |
|
| 531 | 567 | |
| 532 | 568 | $failed_files = array(); |
| 533 | 569 | |
@@ -539,20 +575,23 @@ discard block |
||
| 539 | 575 | foreach ($writable_files as $file) |
| 540 | 576 | { |
| 541 | 577 | // Some files won't exist, try to address up front |
| 542 | - if (!file_exists(dirname(__FILE__) . '/' . $file)) |
|
| 543 | - @touch(dirname(__FILE__) . '/' . $file); |
|
| 578 | + if (!file_exists(dirname(__FILE__) . '/' . $file)) { |
|
| 579 | + @touch(dirname(__FILE__) . '/' . $file); |
|
| 580 | + } |
|
| 544 | 581 | // NOW do the writable check... |
| 545 | 582 | if (!is_writable(dirname(__FILE__) . '/' . $file)) |
| 546 | 583 | { |
| 547 | 584 | @chmod(dirname(__FILE__) . '/' . $file, 0755); |
| 548 | 585 | |
| 549 | 586 | // Well, 755 hopefully worked... if not, try 777. |
| 550 | - if (!is_writable(dirname(__FILE__) . '/' . $file) && !@chmod(dirname(__FILE__) . '/' . $file, 0777)) |
|
| 551 | - $failed_files[] = $file; |
|
| 587 | + if (!is_writable(dirname(__FILE__) . '/' . $file) && !@chmod(dirname(__FILE__) . '/' . $file, 0777)) { |
|
| 588 | + $failed_files[] = $file; |
|
| 589 | + } |
|
| 552 | 590 | } |
| 553 | 591 | } |
| 554 | - foreach ($extra_files as $file) |
|
| 555 | - @chmod(dirname(__FILE__) . (empty($file) ? '' : '/' . $file), 0777); |
|
| 592 | + foreach ($extra_files as $file) { |
|
| 593 | + @chmod(dirname(__FILE__) . (empty($file) ? '' : '/' . $file), 0777); |
|
| 594 | + } |
|
| 556 | 595 | } |
| 557 | 596 | // Windows is trickier. Let's try opening for r+... |
| 558 | 597 | else |
@@ -562,30 +601,35 @@ discard block |
||
| 562 | 601 | foreach ($writable_files as $file) |
| 563 | 602 | { |
| 564 | 603 | // Folders can't be opened for write... but the index.php in them can ;) |
| 565 | - if (is_dir(dirname(__FILE__) . '/' . $file)) |
|
| 566 | - $file .= '/index.php'; |
|
| 604 | + if (is_dir(dirname(__FILE__) . '/' . $file)) { |
|
| 605 | + $file .= '/index.php'; |
|
| 606 | + } |
|
| 567 | 607 | |
| 568 | 608 | // Funny enough, chmod actually does do something on windows - it removes the read only attribute. |
| 569 | 609 | @chmod(dirname(__FILE__) . '/' . $file, 0777); |
| 570 | 610 | $fp = @fopen(dirname(__FILE__) . '/' . $file, 'r+'); |
| 571 | 611 | |
| 572 | 612 | // Hmm, okay, try just for write in that case... |
| 573 | - if (!is_resource($fp)) |
|
| 574 | - $fp = @fopen(dirname(__FILE__) . '/' . $file, 'w'); |
|
| 613 | + if (!is_resource($fp)) { |
|
| 614 | + $fp = @fopen(dirname(__FILE__) . '/' . $file, 'w'); |
|
| 615 | + } |
|
| 575 | 616 | |
| 576 | - if (!is_resource($fp)) |
|
| 577 | - $failed_files[] = $file; |
|
| 617 | + if (!is_resource($fp)) { |
|
| 618 | + $failed_files[] = $file; |
|
| 619 | + } |
|
| 578 | 620 | |
| 579 | 621 | @fclose($fp); |
| 580 | 622 | } |
| 581 | - foreach ($extra_files as $file) |
|
| 582 | - @chmod(dirname(__FILE__) . (empty($file) ? '' : '/' . $file), 0777); |
|
| 623 | + foreach ($extra_files as $file) { |
|
| 624 | + @chmod(dirname(__FILE__) . (empty($file) ? '' : '/' . $file), 0777); |
|
| 625 | + } |
|
| 583 | 626 | } |
| 584 | 627 | |
| 585 | 628 | $failure = count($failed_files) >= 1; |
| 586 | 629 | |
| 587 | - if (!isset($_SERVER)) |
|
| 588 | - return !$failure; |
|
| 630 | + if (!isset($_SERVER)) { |
|
| 631 | + return !$failure; |
|
| 632 | + } |
|
| 589 | 633 | |
| 590 | 634 | // Put the list into context. |
| 591 | 635 | $incontext['failed_files'] = $failed_files; |
@@ -633,19 +677,23 @@ discard block |
||
| 633 | 677 | |
| 634 | 678 | if (!isset($ftp) || $ftp->error !== false) |
| 635 | 679 | { |
| 636 | - if (!isset($ftp)) |
|
| 637 | - $ftp = new ftp_connection(null); |
|
| 680 | + if (!isset($ftp)) { |
|
| 681 | + $ftp = new ftp_connection(null); |
|
| 682 | + } |
|
| 638 | 683 | // Save the error so we can mess with listing... |
| 639 | - elseif ($ftp->error !== false && empty($incontext['ftp_errors']) && !empty($ftp->last_message)) |
|
| 640 | - $incontext['ftp_errors'][] = $ftp->last_message; |
|
| 684 | + elseif ($ftp->error !== false && empty($incontext['ftp_errors']) && !empty($ftp->last_message)) { |
|
| 685 | + $incontext['ftp_errors'][] = $ftp->last_message; |
|
| 686 | + } |
|
| 641 | 687 | |
| 642 | 688 | list ($username, $detect_path, $found_path) = $ftp->detect_path(dirname(__FILE__)); |
| 643 | 689 | |
| 644 | - if (empty($_POST['ftp_path']) && $found_path) |
|
| 645 | - $_POST['ftp_path'] = $detect_path; |
|
| 690 | + if (empty($_POST['ftp_path']) && $found_path) { |
|
| 691 | + $_POST['ftp_path'] = $detect_path; |
|
| 692 | + } |
|
| 646 | 693 | |
| 647 | - if (!isset($_POST['ftp_username'])) |
|
| 648 | - $_POST['ftp_username'] = $username; |
|
| 694 | + if (!isset($_POST['ftp_username'])) { |
|
| 695 | + $_POST['ftp_username'] = $username; |
|
| 696 | + } |
|
| 649 | 697 | |
| 650 | 698 | // Set the username etc, into context. |
| 651 | 699 | $incontext['ftp'] = array( |
@@ -657,8 +705,7 @@ discard block |
||
| 657 | 705 | ); |
| 658 | 706 | |
| 659 | 707 | return false; |
| 660 | - } |
|
| 661 | - else |
|
| 708 | + } else |
|
| 662 | 709 | { |
| 663 | 710 | $_SESSION['installer_temp_ftp'] = array( |
| 664 | 711 | 'server' => $_POST['ftp_server'], |
@@ -672,10 +719,12 @@ discard block |
||
| 672 | 719 | |
| 673 | 720 | foreach ($failed_files as $file) |
| 674 | 721 | { |
| 675 | - if (!is_writable(dirname(__FILE__) . '/' . $file)) |
|
| 676 | - $ftp->chmod($file, 0755); |
|
| 677 | - if (!is_writable(dirname(__FILE__) . '/' . $file)) |
|
| 678 | - $ftp->chmod($file, 0777); |
|
| 722 | + if (!is_writable(dirname(__FILE__) . '/' . $file)) { |
|
| 723 | + $ftp->chmod($file, 0755); |
|
| 724 | + } |
|
| 725 | + if (!is_writable(dirname(__FILE__) . '/' . $file)) { |
|
| 726 | + $ftp->chmod($file, 0777); |
|
| 727 | + } |
|
| 679 | 728 | if (!is_writable(dirname(__FILE__) . '/' . $file)) |
| 680 | 729 | { |
| 681 | 730 | $failed_files_updated[] = $file; |
@@ -731,15 +780,17 @@ discard block |
||
| 731 | 780 | |
| 732 | 781 | if (!$foundOne) |
| 733 | 782 | { |
| 734 | - if (isset($db['default_host'])) |
|
| 735 | - $incontext['db']['server'] = ini_get($db['default_host']) or $incontext['db']['server'] = 'localhost'; |
|
| 783 | + if (isset($db['default_host'])) { |
|
| 784 | + $incontext['db']['server'] = ini_get($db['default_host']) or $incontext['db']['server'] = 'localhost'; |
|
| 785 | + } |
|
| 736 | 786 | if (isset($db['default_user'])) |
| 737 | 787 | { |
| 738 | 788 | $incontext['db']['user'] = ini_get($db['default_user']); |
| 739 | 789 | $incontext['db']['name'] = ini_get($db['default_user']); |
| 740 | 790 | } |
| 741 | - if (isset($db['default_password'])) |
|
| 742 | - $incontext['db']['pass'] = ini_get($db['default_password']); |
|
| 791 | + if (isset($db['default_password'])) { |
|
| 792 | + $incontext['db']['pass'] = ini_get($db['default_password']); |
|
| 793 | + } |
|
| 743 | 794 | |
| 744 | 795 | // For simplicity and less confusion, leave the port blank by default |
| 745 | 796 | $incontext['db']['port'] = ''; |
@@ -758,10 +809,10 @@ discard block |
||
| 758 | 809 | $incontext['db']['server'] = $_POST['db_server']; |
| 759 | 810 | $incontext['db']['prefix'] = $_POST['db_prefix']; |
| 760 | 811 | |
| 761 | - if (!empty($_POST['db_port'])) |
|
| 762 | - $incontext['db']['port'] = $_POST['db_port']; |
|
| 763 | - } |
|
| 764 | - else |
|
| 812 | + if (!empty($_POST['db_port'])) { |
|
| 813 | + $incontext['db']['port'] = $_POST['db_port']; |
|
| 814 | + } |
|
| 815 | + } else |
|
| 765 | 816 | { |
| 766 | 817 | $incontext['db']['prefix'] = 'smf_'; |
| 767 | 818 | } |
@@ -797,10 +848,11 @@ discard block |
||
| 797 | 848 | if (!empty($_POST['db_port'])) |
| 798 | 849 | { |
| 799 | 850 | // For MySQL, we can get the "default port" from PHP. PostgreSQL has no such option though. |
| 800 | - if (($db_type == 'mysql' || $db_type == 'mysqli') && $_POST['db_port'] != ini_get($db_type . '.default_port')) |
|
| 801 | - $vars['db_port'] = (int) $_POST['db_port']; |
|
| 802 | - elseif ($db_type == 'postgresql' && $_POST['db_port'] != 5432) |
|
| 803 | - $vars['db_port'] = (int) $_POST['db_port']; |
|
| 851 | + if (($db_type == 'mysql' || $db_type == 'mysqli') && $_POST['db_port'] != ini_get($db_type . '.default_port')) { |
|
| 852 | + $vars['db_port'] = (int) $_POST['db_port']; |
|
| 853 | + } elseif ($db_type == 'postgresql' && $_POST['db_port'] != 5432) { |
|
| 854 | + $vars['db_port'] = (int) $_POST['db_port']; |
|
| 855 | + } |
|
| 804 | 856 | } |
| 805 | 857 | |
| 806 | 858 | // God I hope it saved! |
@@ -813,8 +865,9 @@ discard block |
||
| 813 | 865 | // Make sure it works. |
| 814 | 866 | require(dirname(__FILE__) . '/Settings.php'); |
| 815 | 867 | |
| 816 | - if (empty($sourcedir)) |
|
| 817 | - $sourcedir = dirname(__FILE__) . '/Sources'; |
|
| 868 | + if (empty($sourcedir)) { |
|
| 869 | + $sourcedir = dirname(__FILE__) . '/Sources'; |
|
| 870 | + } |
|
| 818 | 871 | |
| 819 | 872 | // Better find the database file! |
| 820 | 873 | if (!file_exists($sourcedir . '/Subs-Db-' . $db_type . '.php')) |
@@ -824,12 +877,14 @@ discard block |
||
| 824 | 877 | } |
| 825 | 878 | |
| 826 | 879 | // Now include it for database functions! |
| 827 | - if (!defined('SMF')) |
|
| 828 | - define('SMF', 1); |
|
| 880 | + if (!defined('SMF')) { |
|
| 881 | + define('SMF', 1); |
|
| 882 | + } |
|
| 829 | 883 | |
| 830 | 884 | $modSettings['disableQueryCheck'] = true; |
| 831 | - if (empty($smcFunc)) |
|
| 832 | - $smcFunc = array(); |
|
| 885 | + if (empty($smcFunc)) { |
|
| 886 | + $smcFunc = array(); |
|
| 887 | + } |
|
| 833 | 888 | |
| 834 | 889 | require_once($sourcedir . '/Subs-Db-' . $db_type . '.php'); |
| 835 | 890 | |
@@ -838,11 +893,13 @@ discard block |
||
| 838 | 893 | |
| 839 | 894 | $options = array('non_fatal' => true, 'dont_select_db' => !$needsDB); |
| 840 | 895 | // Add in the port if needed |
| 841 | - if (!empty($db_port)) |
|
| 842 | - $options['port'] = $db_port; |
|
| 896 | + if (!empty($db_port)) { |
|
| 897 | + $options['port'] = $db_port; |
|
| 898 | + } |
|
| 843 | 899 | |
| 844 | - if (!empty($db_mb4)) |
|
| 845 | - $options['db_mb4'] = $db_mb4; |
|
| 900 | + if (!empty($db_mb4)) { |
|
| 901 | + $options['db_mb4'] = $db_mb4; |
|
| 902 | + } |
|
| 846 | 903 | |
| 847 | 904 | $db_connection = smf_db_initiate($db_server, $db_name, $db_user, $db_passwd, $db_prefix, $options); |
| 848 | 905 | |
@@ -928,12 +985,14 @@ discard block |
||
| 928 | 985 | $incontext['page_title'] = $txt['install_settings']; |
| 929 | 986 | |
| 930 | 987 | // Let's see if we got the database type correct. |
| 931 | - if (isset($_POST['db_type'], $databases[$_POST['db_type']])) |
|
| 932 | - $db_type = $_POST['db_type']; |
|
| 988 | + if (isset($_POST['db_type'], $databases[$_POST['db_type']])) { |
|
| 989 | + $db_type = $_POST['db_type']; |
|
| 990 | + } |
|
| 933 | 991 | |
| 934 | 992 | // Else we'd better be able to get the connection. |
| 935 | - else |
|
| 936 | - load_database(); |
|
| 993 | + else { |
|
| 994 | + load_database(); |
|
| 995 | + } |
|
| 937 | 996 | |
| 938 | 997 | $db_type = isset($_POST['db_type']) ? $_POST['db_type'] : $db_type; |
| 939 | 998 | |
@@ -942,10 +1001,11 @@ discard block |
||
| 942 | 1001 | |
| 943 | 1002 | $secure = false; |
| 944 | 1003 | |
| 945 | - if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') |
|
| 946 | - $secure = true; |
|
| 947 | - 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') |
|
| 948 | - $secure = true; |
|
| 1004 | + if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') { |
|
| 1005 | + $secure = true; |
|
| 1006 | + } 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') { |
|
| 1007 | + $secure = true; |
|
| 1008 | + } |
|
| 949 | 1009 | |
| 950 | 1010 | // Now, to put what we've learned together... and add a path. |
| 951 | 1011 | $incontext['detected_url'] = 'http' . ($secure ? 's' : '') . '://' . $host . substr($_SERVER['PHP_SELF'], 0, strrpos($_SERVER['PHP_SELF'], '/')); |
@@ -977,18 +1037,21 @@ discard block |
||
| 977 | 1037 | // Submitting? |
| 978 | 1038 | if (isset($_POST['boardurl'])) |
| 979 | 1039 | { |
| 980 | - if (substr($_POST['boardurl'], -10) == '/index.php') |
|
| 981 | - $_POST['boardurl'] = substr($_POST['boardurl'], 0, -10); |
|
| 982 | - elseif (substr($_POST['boardurl'], -1) == '/') |
|
| 983 | - $_POST['boardurl'] = substr($_POST['boardurl'], 0, -1); |
|
| 984 | - if (substr($_POST['boardurl'], 0, 7) != 'http://' && substr($_POST['boardurl'], 0, 7) != 'file://' && substr($_POST['boardurl'], 0, 8) != 'https://') |
|
| 985 | - $_POST['boardurl'] = 'http://' . $_POST['boardurl']; |
|
| 1040 | + if (substr($_POST['boardurl'], -10) == '/index.php') { |
|
| 1041 | + $_POST['boardurl'] = substr($_POST['boardurl'], 0, -10); |
|
| 1042 | + } elseif (substr($_POST['boardurl'], -1) == '/') { |
|
| 1043 | + $_POST['boardurl'] = substr($_POST['boardurl'], 0, -1); |
|
| 1044 | + } |
|
| 1045 | + if (substr($_POST['boardurl'], 0, 7) != 'http://' && substr($_POST['boardurl'], 0, 7) != 'file://' && substr($_POST['boardurl'], 0, 8) != 'https://') { |
|
| 1046 | + $_POST['boardurl'] = 'http://' . $_POST['boardurl']; |
|
| 1047 | + } |
|
| 986 | 1048 | |
| 987 | 1049 | //Make sure boardurl is aligned with ssl setting |
| 988 | - if (empty($_POST['force_ssl'])) |
|
| 989 | - $_POST['boardurl'] = strtr($_POST['boardurl'], array('https://' => 'http://')); |
|
| 990 | - else |
|
| 991 | - $_POST['boardurl'] = strtr($_POST['boardurl'], array('http://' => 'https://')); |
|
| 1050 | + if (empty($_POST['force_ssl'])) { |
|
| 1051 | + $_POST['boardurl'] = strtr($_POST['boardurl'], array('https://' => 'http://')); |
|
| 1052 | + } else { |
|
| 1053 | + $_POST['boardurl'] = strtr($_POST['boardurl'], array('http://' => 'https://')); |
|
| 1054 | + } |
|
| 992 | 1055 | |
| 993 | 1056 | // Save these variables. |
| 994 | 1057 | $vars = array( |
@@ -1027,10 +1090,10 @@ discard block |
||
| 1027 | 1090 | { |
| 1028 | 1091 | $incontext['error'] = sprintf($txt['error_utf8_version'], $databases[$db_type]['utf8_version']); |
| 1029 | 1092 | return false; |
| 1030 | - } |
|
| 1031 | - else |
|
| 1032 | - // Set the character set here. |
|
| 1093 | + } else { |
|
| 1094 | + // Set the character set here. |
|
| 1033 | 1095 | updateSettingsFile(array('db_character_set' => 'utf8')); |
| 1096 | + } |
|
| 1034 | 1097 | } |
| 1035 | 1098 | |
| 1036 | 1099 | // Good, skip on. |
@@ -1050,8 +1113,9 @@ discard block |
||
| 1050 | 1113 | $incontext['continue'] = 1; |
| 1051 | 1114 | |
| 1052 | 1115 | // Already done? |
| 1053 | - if (isset($_POST['pop_done'])) |
|
| 1054 | - return true; |
|
| 1116 | + if (isset($_POST['pop_done'])) { |
|
| 1117 | + return true; |
|
| 1118 | + } |
|
| 1055 | 1119 | |
| 1056 | 1120 | // Reload settings. |
| 1057 | 1121 | require(dirname(__FILE__) . '/Settings.php'); |
@@ -1069,8 +1133,9 @@ discard block |
||
| 1069 | 1133 | $modSettings = array(); |
| 1070 | 1134 | if ($result !== false) |
| 1071 | 1135 | { |
| 1072 | - while ($row = $smcFunc['db_fetch_assoc']($result)) |
|
| 1073 | - $modSettings[$row['variable']] = $row['value']; |
|
| 1136 | + while ($row = $smcFunc['db_fetch_assoc']($result)) { |
|
| 1137 | + $modSettings[$row['variable']] = $row['value']; |
|
| 1138 | + } |
|
| 1074 | 1139 | $smcFunc['db_free_result']($result); |
| 1075 | 1140 | |
| 1076 | 1141 | // Do they match? If so, this is just a refresh so charge on! |
@@ -1083,20 +1148,22 @@ discard block |
||
| 1083 | 1148 | $modSettings['disableQueryCheck'] = true; |
| 1084 | 1149 | |
| 1085 | 1150 | // If doing UTF8, select it. PostgreSQL requires passing it as a string... |
| 1086 | - if (!empty($db_character_set) && $db_character_set == 'utf8' && !empty($databases[$db_type]['utf8_support'])) |
|
| 1087 | - $smcFunc['db_query']('', ' |
|
| 1151 | + if (!empty($db_character_set) && $db_character_set == 'utf8' && !empty($databases[$db_type]['utf8_support'])) { |
|
| 1152 | + $smcFunc['db_query']('', ' |
|
| 1088 | 1153 | SET NAMES {string:utf8}', |
| 1089 | 1154 | array( |
| 1090 | 1155 | 'db_error_skip' => true, |
| 1091 | 1156 | 'utf8' => 'utf8', |
| 1092 | 1157 | ) |
| 1093 | 1158 | ); |
| 1159 | + } |
|
| 1094 | 1160 | |
| 1095 | 1161 | // Windows likes to leave the trailing slash, which yields to C:\path\to\SMF\/attachments... |
| 1096 | - if (substr(__DIR__, -1) == '\\') |
|
| 1097 | - $attachdir = __DIR__ . 'attachments'; |
|
| 1098 | - else |
|
| 1099 | - $attachdir = __DIR__ . '/attachments'; |
|
| 1162 | + if (substr(__DIR__, -1) == '\\') { |
|
| 1163 | + $attachdir = __DIR__ . 'attachments'; |
|
| 1164 | + } else { |
|
| 1165 | + $attachdir = __DIR__ . '/attachments'; |
|
| 1166 | + } |
|
| 1100 | 1167 | |
| 1101 | 1168 | $replaces = array( |
| 1102 | 1169 | '{$db_prefix}' => $db_prefix, |
@@ -1113,8 +1180,9 @@ discard block |
||
| 1113 | 1180 | |
| 1114 | 1181 | foreach ($txt as $key => $value) |
| 1115 | 1182 | { |
| 1116 | - if (substr($key, 0, 8) == 'default_') |
|
| 1117 | - $replaces['{$' . $key . '}'] = $smcFunc['db_escape_string']($value); |
|
| 1183 | + if (substr($key, 0, 8) == 'default_') { |
|
| 1184 | + $replaces['{$' . $key . '}'] = $smcFunc['db_escape_string']($value); |
|
| 1185 | + } |
|
| 1118 | 1186 | } |
| 1119 | 1187 | $replaces['{$default_reserved_names}'] = strtr($replaces['{$default_reserved_names}'], array('\\\\n' => '\\n')); |
| 1120 | 1188 | |
@@ -1129,8 +1197,9 @@ discard block |
||
| 1129 | 1197 | |
| 1130 | 1198 | while ($row = $smcFunc['db_fetch_assoc']($get_engines)) |
| 1131 | 1199 | { |
| 1132 | - if ($row['Support'] == 'YES' || $row['Support'] == 'DEFAULT') |
|
| 1133 | - $engines[] = $row['Engine']; |
|
| 1200 | + if ($row['Support'] == 'YES' || $row['Support'] == 'DEFAULT') { |
|
| 1201 | + $engines[] = $row['Engine']; |
|
| 1202 | + } |
|
| 1134 | 1203 | } |
| 1135 | 1204 | |
| 1136 | 1205 | // Done with this now |
@@ -1154,8 +1223,7 @@ discard block |
||
| 1154 | 1223 | $replaces['START TRANSACTION;'] = ''; |
| 1155 | 1224 | $replaces['COMMIT;'] = ''; |
| 1156 | 1225 | } |
| 1157 | - } |
|
| 1158 | - else |
|
| 1226 | + } else |
|
| 1159 | 1227 | { |
| 1160 | 1228 | $has_innodb = false; |
| 1161 | 1229 | } |
@@ -1177,21 +1245,24 @@ discard block |
||
| 1177 | 1245 | foreach ($sql_lines as $count => $line) |
| 1178 | 1246 | { |
| 1179 | 1247 | // No comments allowed! |
| 1180 | - if (substr(trim($line), 0, 1) != '#') |
|
| 1181 | - $current_statement .= "\n" . rtrim($line); |
|
| 1248 | + if (substr(trim($line), 0, 1) != '#') { |
|
| 1249 | + $current_statement .= "\n" . rtrim($line); |
|
| 1250 | + } |
|
| 1182 | 1251 | |
| 1183 | 1252 | // Is this the end of the query string? |
| 1184 | - if (empty($current_statement) || (preg_match('~;[\s]*$~s', $line) == 0 && $count != count($sql_lines))) |
|
| 1185 | - continue; |
|
| 1253 | + if (empty($current_statement) || (preg_match('~;[\s]*$~s', $line) == 0 && $count != count($sql_lines))) { |
|
| 1254 | + continue; |
|
| 1255 | + } |
|
| 1186 | 1256 | |
| 1187 | 1257 | // Does this table already exist? If so, don't insert more data into it! |
| 1188 | 1258 | if (preg_match('~^\s*INSERT INTO ([^\s\n\r]+?)~', $current_statement, $match) != 0 && in_array($match[1], $exists)) |
| 1189 | 1259 | { |
| 1190 | 1260 | preg_match_all('~\)[,;]~', $current_statement, $matches); |
| 1191 | - if (!empty($matches[0])) |
|
| 1192 | - $incontext['sql_results']['insert_dups'] += count($matches[0]); |
|
| 1193 | - else |
|
| 1194 | - $incontext['sql_results']['insert_dups']++; |
|
| 1261 | + if (!empty($matches[0])) { |
|
| 1262 | + $incontext['sql_results']['insert_dups'] += count($matches[0]); |
|
| 1263 | + } else { |
|
| 1264 | + $incontext['sql_results']['insert_dups']++; |
|
| 1265 | + } |
|
| 1195 | 1266 | |
| 1196 | 1267 | $current_statement = ''; |
| 1197 | 1268 | continue; |
@@ -1212,18 +1283,18 @@ discard block |
||
| 1212 | 1283 | // MySQLi requires a connection object. It's optional with MySQL and Postgres |
| 1213 | 1284 | $incontext['failures'][$count] = $smcFunc['db_error']($db_connection); |
| 1214 | 1285 | } |
| 1215 | - } |
|
| 1216 | - else |
|
| 1286 | + } else |
|
| 1217 | 1287 | { |
| 1218 | - if (preg_match('~^\s*CREATE TABLE ([^\s\n\r]+?)~', $current_statement, $match) == 1) |
|
| 1219 | - $incontext['sql_results']['tables']++; |
|
| 1220 | - elseif (preg_match('~^\s*INSERT INTO ([^\s\n\r]+?)~', $current_statement, $match) == 1) |
|
| 1288 | + if (preg_match('~^\s*CREATE TABLE ([^\s\n\r]+?)~', $current_statement, $match) == 1) { |
|
| 1289 | + $incontext['sql_results']['tables']++; |
|
| 1290 | + } elseif (preg_match('~^\s*INSERT INTO ([^\s\n\r]+?)~', $current_statement, $match) == 1) |
|
| 1221 | 1291 | { |
| 1222 | 1292 | preg_match_all('~\)[,;]~', $current_statement, $matches); |
| 1223 | - if (!empty($matches[0])) |
|
| 1224 | - $incontext['sql_results']['inserts'] += count($matches[0]); |
|
| 1225 | - else |
|
| 1226 | - $incontext['sql_results']['inserts']++; |
|
| 1293 | + if (!empty($matches[0])) { |
|
| 1294 | + $incontext['sql_results']['inserts'] += count($matches[0]); |
|
| 1295 | + } else { |
|
| 1296 | + $incontext['sql_results']['inserts']++; |
|
| 1297 | + } |
|
| 1227 | 1298 | } |
| 1228 | 1299 | } |
| 1229 | 1300 | |
@@ -1236,15 +1307,17 @@ discard block |
||
| 1236 | 1307 | // Sort out the context for the SQL. |
| 1237 | 1308 | foreach ($incontext['sql_results'] as $key => $number) |
| 1238 | 1309 | { |
| 1239 | - if ($number == 0) |
|
| 1240 | - unset($incontext['sql_results'][$key]); |
|
| 1241 | - else |
|
| 1242 | - $incontext['sql_results'][$key] = sprintf($txt['db_populate_' . $key], $number); |
|
| 1310 | + if ($number == 0) { |
|
| 1311 | + unset($incontext['sql_results'][$key]); |
|
| 1312 | + } else { |
|
| 1313 | + $incontext['sql_results'][$key] = sprintf($txt['db_populate_' . $key], $number); |
|
| 1314 | + } |
|
| 1243 | 1315 | } |
| 1244 | 1316 | |
| 1245 | 1317 | // Make sure UTF will be used globally. |
| 1246 | - 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']))) |
|
| 1247 | - $newSettings[] = array('global_character_set', 'UTF-8'); |
|
| 1318 | + 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']))) { |
|
| 1319 | + $newSettings[] = array('global_character_set', 'UTF-8'); |
|
| 1320 | + } |
|
| 1248 | 1321 | |
| 1249 | 1322 | // Auto-detect local & global cookie settings |
| 1250 | 1323 | $url_parts = parse_url($boardurl); |
@@ -1273,15 +1346,19 @@ discard block |
||
| 1273 | 1346 | |
| 1274 | 1347 | // Look for subfolder, if found, set localCookie |
| 1275 | 1348 | // Checking for len > 1 ensures you don't have just a slash... |
| 1276 | - if (!empty($url_parts['path']) && strlen($url_parts['path']) > 1) |
|
| 1277 | - $localCookies = '1'; |
|
| 1349 | + if (!empty($url_parts['path']) && strlen($url_parts['path']) > 1) { |
|
| 1350 | + $localCookies = '1'; |
|
| 1351 | + } |
|
| 1278 | 1352 | |
| 1279 | - if (isset($globalCookies)) |
|
| 1280 | - $newSettings[] = array('globalCookies', $globalCookies); |
|
| 1281 | - if (isset($globalCookiesDomain)) |
|
| 1282 | - $newSettings[] = array('globalCookiesDomain', $globalCookiesDomain); |
|
| 1283 | - if (isset($localCookies)) |
|
| 1284 | - $newSettings[] = array('localCookies', $localCookies); |
|
| 1353 | + if (isset($globalCookies)) { |
|
| 1354 | + $newSettings[] = array('globalCookies', $globalCookies); |
|
| 1355 | + } |
|
| 1356 | + if (isset($globalCookiesDomain)) { |
|
| 1357 | + $newSettings[] = array('globalCookiesDomain', $globalCookiesDomain); |
|
| 1358 | + } |
|
| 1359 | + if (isset($localCookies)) { |
|
| 1360 | + $newSettings[] = array('localCookies', $localCookies); |
|
| 1361 | + } |
|
| 1285 | 1362 | } |
| 1286 | 1363 | |
| 1287 | 1364 | // Are we allowing stat collection? |
@@ -1299,16 +1376,17 @@ discard block |
||
| 1299 | 1376 | fwrite($fp, $out); |
| 1300 | 1377 | |
| 1301 | 1378 | $return_data = ''; |
| 1302 | - while (!feof($fp)) |
|
| 1303 | - $return_data .= fgets($fp, 128); |
|
| 1379 | + while (!feof($fp)) { |
|
| 1380 | + $return_data .= fgets($fp, 128); |
|
| 1381 | + } |
|
| 1304 | 1382 | |
| 1305 | 1383 | fclose($fp); |
| 1306 | 1384 | |
| 1307 | 1385 | // Get the unique site ID. |
| 1308 | 1386 | preg_match('~SITE-ID:\s(\w{10})~', $return_data, $ID); |
| 1309 | 1387 | |
| 1310 | - if (!empty($ID[1])) |
|
| 1311 | - $smcFunc['db_insert']('replace', |
|
| 1388 | + if (!empty($ID[1])) { |
|
| 1389 | + $smcFunc['db_insert']('replace', |
|
| 1312 | 1390 | $db_prefix . 'settings', |
| 1313 | 1391 | array('variable' => 'string', 'value' => 'string'), |
| 1314 | 1392 | array( |
@@ -1317,11 +1395,12 @@ discard block |
||
| 1317 | 1395 | ), |
| 1318 | 1396 | array('variable') |
| 1319 | 1397 | ); |
| 1398 | + } |
|
| 1320 | 1399 | } |
| 1321 | 1400 | } |
| 1322 | 1401 | // Don't remove stat collection unless we unchecked the box for real, not from the loop. |
| 1323 | - elseif (empty($_POST['stats']) && empty($upcontext['allow_sm_stats'])) |
|
| 1324 | - $smcFunc['db_query']('', ' |
|
| 1402 | + elseif (empty($_POST['stats']) && empty($upcontext['allow_sm_stats'])) { |
|
| 1403 | + $smcFunc['db_query']('', ' |
|
| 1325 | 1404 | DELETE FROM {db_prefix}settings |
| 1326 | 1405 | WHERE variable = {string:enable_sm_stats}', |
| 1327 | 1406 | array( |
@@ -1329,20 +1408,23 @@ discard block |
||
| 1329 | 1408 | 'db_error_skip' => true, |
| 1330 | 1409 | ) |
| 1331 | 1410 | ); |
| 1411 | + } |
|
| 1332 | 1412 | |
| 1333 | 1413 | // Are we enabling SSL? |
| 1334 | - if (!empty($_POST['force_ssl'])) |
|
| 1335 | - $newSettings[] = array('force_ssl', 1); |
|
| 1414 | + if (!empty($_POST['force_ssl'])) { |
|
| 1415 | + $newSettings[] = array('force_ssl', 1); |
|
| 1416 | + } |
|
| 1336 | 1417 | |
| 1337 | 1418 | // Setting a timezone is required. |
| 1338 | 1419 | if (!isset($modSettings['default_timezone']) && function_exists('date_default_timezone_set')) |
| 1339 | 1420 | { |
| 1340 | 1421 | // Get PHP's default timezone, if set |
| 1341 | 1422 | $ini_tz = ini_get('date.timezone'); |
| 1342 | - if (!empty($ini_tz)) |
|
| 1343 | - $timezone_id = $ini_tz; |
|
| 1344 | - else |
|
| 1345 | - $timezone_id = ''; |
|
| 1423 | + if (!empty($ini_tz)) { |
|
| 1424 | + $timezone_id = $ini_tz; |
|
| 1425 | + } else { |
|
| 1426 | + $timezone_id = ''; |
|
| 1427 | + } |
|
| 1346 | 1428 | |
| 1347 | 1429 | // If date.timezone is unset, invalid, or just plain weird, make a best guess |
| 1348 | 1430 | if (!in_array($timezone_id, timezone_identifiers_list())) |
@@ -1351,8 +1433,9 @@ discard block |
||
| 1351 | 1433 | $timezone_id = timezone_name_from_abbr('', $server_offset, 0); |
| 1352 | 1434 | } |
| 1353 | 1435 | |
| 1354 | - if (date_default_timezone_set($timezone_id)) |
|
| 1355 | - $newSettings[] = array('default_timezone', $timezone_id); |
|
| 1436 | + if (date_default_timezone_set($timezone_id)) { |
|
| 1437 | + $newSettings[] = array('default_timezone', $timezone_id); |
|
| 1438 | + } |
|
| 1356 | 1439 | } |
| 1357 | 1440 | |
| 1358 | 1441 | if (!empty($newSettings)) |
@@ -1383,16 +1466,18 @@ discard block |
||
| 1383 | 1466 | } |
| 1384 | 1467 | |
| 1385 | 1468 | // MySQL specific stuff |
| 1386 | - if (substr($db_type, 0, 5) != 'mysql') |
|
| 1387 | - return false; |
|
| 1469 | + if (substr($db_type, 0, 5) != 'mysql') { |
|
| 1470 | + return false; |
|
| 1471 | + } |
|
| 1388 | 1472 | |
| 1389 | 1473 | // Find database user privileges. |
| 1390 | 1474 | $privs = array(); |
| 1391 | 1475 | $get_privs = $smcFunc['db_query']('', 'SHOW PRIVILEGES', array()); |
| 1392 | 1476 | while ($row = $smcFunc['db_fetch_assoc']($get_privs)) |
| 1393 | 1477 | { |
| 1394 | - if ($row['Privilege'] == 'Alter') |
|
| 1395 | - $privs[] = $row['Privilege']; |
|
| 1478 | + if ($row['Privilege'] == 'Alter') { |
|
| 1479 | + $privs[] = $row['Privilege']; |
|
| 1480 | + } |
|
| 1396 | 1481 | } |
| 1397 | 1482 | $smcFunc['db_free_result']($get_privs); |
| 1398 | 1483 | |
@@ -1422,8 +1507,9 @@ discard block |
||
| 1422 | 1507 | $incontext['continue'] = 1; |
| 1423 | 1508 | |
| 1424 | 1509 | // Skipping? |
| 1425 | - if (!empty($_POST['skip'])) |
|
| 1426 | - return true; |
|
| 1510 | + if (!empty($_POST['skip'])) { |
|
| 1511 | + return true; |
|
| 1512 | + } |
|
| 1427 | 1513 | |
| 1428 | 1514 | // Need this to check whether we need the database password. |
| 1429 | 1515 | require(dirname(__FILE__) . '/Settings.php'); |
@@ -1440,18 +1526,22 @@ discard block |
||
| 1440 | 1526 | // We need this to properly hash the password for Admin |
| 1441 | 1527 | $smcFunc['strtolower'] = $db_character_set != 'utf8' && $txt['lang_character_set'] != 'UTF-8' ? 'strtolower' : function($string) { |
| 1442 | 1528 | global $sourcedir; |
| 1443 | - if (function_exists('mb_strtolower')) |
|
| 1444 | - return mb_strtolower($string, 'UTF-8'); |
|
| 1529 | + if (function_exists('mb_strtolower')) { |
|
| 1530 | + return mb_strtolower($string, 'UTF-8'); |
|
| 1531 | + } |
|
| 1445 | 1532 | require_once($sourcedir . '/Subs-Charset.php'); |
| 1446 | 1533 | return utf8_strtolower($string); |
| 1447 | 1534 | }; |
| 1448 | 1535 | |
| 1449 | - if (!isset($_POST['username'])) |
|
| 1450 | - $_POST['username'] = ''; |
|
| 1451 | - if (!isset($_POST['email'])) |
|
| 1452 | - $_POST['email'] = ''; |
|
| 1453 | - if (!isset($_POST['server_email'])) |
|
| 1454 | - $_POST['server_email'] = ''; |
|
| 1536 | + if (!isset($_POST['username'])) { |
|
| 1537 | + $_POST['username'] = ''; |
|
| 1538 | + } |
|
| 1539 | + if (!isset($_POST['email'])) { |
|
| 1540 | + $_POST['email'] = ''; |
|
| 1541 | + } |
|
| 1542 | + if (!isset($_POST['server_email'])) { |
|
| 1543 | + $_POST['server_email'] = ''; |
|
| 1544 | + } |
|
| 1455 | 1545 | |
| 1456 | 1546 | $incontext['username'] = htmlspecialchars(stripslashes($_POST['username'])); |
| 1457 | 1547 | $incontext['email'] = htmlspecialchars(stripslashes($_POST['email'])); |
@@ -1470,8 +1560,9 @@ discard block |
||
| 1470 | 1560 | 'admin_group' => 1, |
| 1471 | 1561 | ) |
| 1472 | 1562 | ); |
| 1473 | - if ($smcFunc['db_num_rows']($request) != 0) |
|
| 1474 | - $incontext['skip'] = 1; |
|
| 1563 | + if ($smcFunc['db_num_rows']($request) != 0) { |
|
| 1564 | + $incontext['skip'] = 1; |
|
| 1565 | + } |
|
| 1475 | 1566 | $smcFunc['db_free_result']($request); |
| 1476 | 1567 | |
| 1477 | 1568 | // Trying to create an account? |
@@ -1502,8 +1593,9 @@ discard block |
||
| 1502 | 1593 | } |
| 1503 | 1594 | |
| 1504 | 1595 | // Update the webmaster's email? |
| 1505 | - if (!empty($_POST['server_email']) && (empty($webmaster_email) || $webmaster_email == '[email protected]')) |
|
| 1506 | - updateSettingsFile(array('webmaster_email' => $_POST['server_email'])); |
|
| 1596 | + if (!empty($_POST['server_email']) && (empty($webmaster_email) || $webmaster_email == '[email protected]')) { |
|
| 1597 | + updateSettingsFile(array('webmaster_email' => $_POST['server_email'])); |
|
| 1598 | + } |
|
| 1507 | 1599 | |
| 1508 | 1600 | // Work out whether we're going to have dodgy characters and remove them. |
| 1509 | 1601 | $invalid_characters = preg_match('~[<>&"\'=\\\]~', $_POST['username']) != 0; |
@@ -1526,32 +1618,27 @@ discard block |
||
| 1526 | 1618 | $smcFunc['db_free_result']($result); |
| 1527 | 1619 | |
| 1528 | 1620 | $incontext['account_existed'] = $txt['error_user_settings_taken']; |
| 1529 | - } |
|
| 1530 | - elseif ($_POST['username'] == '' || strlen($_POST['username']) > 25) |
|
| 1621 | + } elseif ($_POST['username'] == '' || strlen($_POST['username']) > 25) |
|
| 1531 | 1622 | { |
| 1532 | 1623 | // Try the previous step again. |
| 1533 | 1624 | $incontext['error'] = $_POST['username'] == '' ? $txt['error_username_left_empty'] : $txt['error_username_too_long']; |
| 1534 | 1625 | return false; |
| 1535 | - } |
|
| 1536 | - elseif ($invalid_characters || $_POST['username'] == '_' || $_POST['username'] == '|' || strpos($_POST['username'], '[code') !== false || strpos($_POST['username'], '[/code') !== false) |
|
| 1626 | + } elseif ($invalid_characters || $_POST['username'] == '_' || $_POST['username'] == '|' || strpos($_POST['username'], '[code') !== false || strpos($_POST['username'], '[/code') !== false) |
|
| 1537 | 1627 | { |
| 1538 | 1628 | // Try the previous step again. |
| 1539 | 1629 | $incontext['error'] = $txt['error_invalid_characters_username']; |
| 1540 | 1630 | return false; |
| 1541 | - } |
|
| 1542 | - elseif (empty($_POST['email']) || !filter_var(stripslashes($_POST['email']), FILTER_VALIDATE_EMAIL) || strlen(stripslashes($_POST['email'])) > 255) |
|
| 1631 | + } elseif (empty($_POST['email']) || !filter_var(stripslashes($_POST['email']), FILTER_VALIDATE_EMAIL) || strlen(stripslashes($_POST['email'])) > 255) |
|
| 1543 | 1632 | { |
| 1544 | 1633 | // One step back, this time fill out a proper admin email address. |
| 1545 | 1634 | $incontext['error'] = sprintf($txt['error_valid_admin_email_needed'], $_POST['username']); |
| 1546 | 1635 | return false; |
| 1547 | - } |
|
| 1548 | - elseif (empty($_POST['server_email']) || !filter_var(stripslashes($_POST['server_email']), FILTER_VALIDATE_EMAIL) || strlen(stripslashes($_POST['server_email'])) > 255) |
|
| 1636 | + } elseif (empty($_POST['server_email']) || !filter_var(stripslashes($_POST['server_email']), FILTER_VALIDATE_EMAIL) || strlen(stripslashes($_POST['server_email'])) > 255) |
|
| 1549 | 1637 | { |
| 1550 | 1638 | // One step back, this time fill out a proper admin email address. |
| 1551 | 1639 | $incontext['error'] = $txt['error_valid_server_email_needed']; |
| 1552 | 1640 | return false; |
| 1553 | - } |
|
| 1554 | - elseif ($_POST['username'] != '') |
|
| 1641 | + } elseif ($_POST['username'] != '') |
|
| 1555 | 1642 | { |
| 1556 | 1643 | $incontext['member_salt'] = substr(md5(mt_rand()), 0, 4); |
| 1557 | 1644 | |
@@ -1619,17 +1706,19 @@ discard block |
||
| 1619 | 1706 | reloadSettings(); |
| 1620 | 1707 | |
| 1621 | 1708 | // Bring a warning over. |
| 1622 | - if (!empty($incontext['account_existed'])) |
|
| 1623 | - $incontext['warning'] = $incontext['account_existed']; |
|
| 1709 | + if (!empty($incontext['account_existed'])) { |
|
| 1710 | + $incontext['warning'] = $incontext['account_existed']; |
|
| 1711 | + } |
|
| 1624 | 1712 | |
| 1625 | - if (!empty($db_character_set) && !empty($databases[$db_type]['utf8_support'])) |
|
| 1626 | - $smcFunc['db_query']('', ' |
|
| 1713 | + if (!empty($db_character_set) && !empty($databases[$db_type]['utf8_support'])) { |
|
| 1714 | + $smcFunc['db_query']('', ' |
|
| 1627 | 1715 | SET NAMES {string:db_character_set}', |
| 1628 | 1716 | array( |
| 1629 | 1717 | 'db_character_set' => $db_character_set, |
| 1630 | 1718 | 'db_error_skip' => true, |
| 1631 | 1719 | ) |
| 1632 | 1720 | ); |
| 1721 | + } |
|
| 1633 | 1722 | |
| 1634 | 1723 | // As track stats is by default enabled let's add some activity. |
| 1635 | 1724 | $smcFunc['db_insert']('ignore', |
@@ -1650,14 +1739,16 @@ discard block |
||
| 1650 | 1739 | // Only proceed if we can load the data. |
| 1651 | 1740 | if ($request) |
| 1652 | 1741 | { |
| 1653 | - while ($row = $smcFunc['db_fetch_row']($request)) |
|
| 1654 | - $modSettings[$row[0]] = $row[1]; |
|
| 1742 | + while ($row = $smcFunc['db_fetch_row']($request)) { |
|
| 1743 | + $modSettings[$row[0]] = $row[1]; |
|
| 1744 | + } |
|
| 1655 | 1745 | $smcFunc['db_free_result']($request); |
| 1656 | 1746 | } |
| 1657 | 1747 | |
| 1658 | 1748 | // Automatically log them in ;) |
| 1659 | - if (isset($incontext['member_id']) && isset($incontext['member_salt'])) |
|
| 1660 | - setLoginCookie(3153600 * 60, $incontext['member_id'], hash_salt($_POST['password1'], $incontext['member_salt'])); |
|
| 1749 | + if (isset($incontext['member_id']) && isset($incontext['member_salt'])) { |
|
| 1750 | + setLoginCookie(3153600 * 60, $incontext['member_id'], hash_salt($_POST['password1'], $incontext['member_salt'])); |
|
| 1751 | + } |
|
| 1661 | 1752 | |
| 1662 | 1753 | $result = $smcFunc['db_query']('', ' |
| 1663 | 1754 | SELECT value |
@@ -1668,13 +1759,14 @@ discard block |
||
| 1668 | 1759 | 'db_error_skip' => true, |
| 1669 | 1760 | ) |
| 1670 | 1761 | ); |
| 1671 | - if ($smcFunc['db_num_rows']($result) != 0) |
|
| 1672 | - list ($db_sessions) = $smcFunc['db_fetch_row']($result); |
|
| 1762 | + if ($smcFunc['db_num_rows']($result) != 0) { |
|
| 1763 | + list ($db_sessions) = $smcFunc['db_fetch_row']($result); |
|
| 1764 | + } |
|
| 1673 | 1765 | $smcFunc['db_free_result']($result); |
| 1674 | 1766 | |
| 1675 | - if (empty($db_sessions)) |
|
| 1676 | - $_SESSION['admin_time'] = time(); |
|
| 1677 | - else |
|
| 1767 | + if (empty($db_sessions)) { |
|
| 1768 | + $_SESSION['admin_time'] = time(); |
|
| 1769 | + } else |
|
| 1678 | 1770 | { |
| 1679 | 1771 | $_SERVER['HTTP_USER_AGENT'] = substr($_SERVER['HTTP_USER_AGENT'], 0, 211); |
| 1680 | 1772 | |
@@ -1698,8 +1790,9 @@ discard block |
||
| 1698 | 1790 | $smcFunc['strtolower'] = $db_character_set != 'utf8' && $txt['lang_character_set'] != 'UTF-8' ? 'strtolower' : |
| 1699 | 1791 | function($string){ |
| 1700 | 1792 | global $sourcedir; |
| 1701 | - if (function_exists('mb_strtolower')) |
|
| 1702 | - return mb_strtolower($string, 'UTF-8'); |
|
| 1793 | + if (function_exists('mb_strtolower')) { |
|
| 1794 | + return mb_strtolower($string, 'UTF-8'); |
|
| 1795 | + } |
|
| 1703 | 1796 | require_once($sourcedir . '/Subs-Charset.php'); |
| 1704 | 1797 | return utf8_strtolower($string); |
| 1705 | 1798 | }; |
@@ -1715,8 +1808,9 @@ discard block |
||
| 1715 | 1808 | ) |
| 1716 | 1809 | ); |
| 1717 | 1810 | $context['utf8'] = $db_character_set === 'utf8' || $txt['lang_character_set'] === 'UTF-8'; |
| 1718 | - if ($smcFunc['db_num_rows']($request) > 0) |
|
| 1719 | - updateStats('subject', 1, htmlspecialchars($txt['default_topic_subject'])); |
|
| 1811 | + if ($smcFunc['db_num_rows']($request) > 0) { |
|
| 1812 | + updateStats('subject', 1, htmlspecialchars($txt['default_topic_subject'])); |
|
| 1813 | + } |
|
| 1720 | 1814 | $smcFunc['db_free_result']($request); |
| 1721 | 1815 | |
| 1722 | 1816 | // Now is the perfect time to fetch the SM files. |
@@ -1735,8 +1829,9 @@ discard block |
||
| 1735 | 1829 | |
| 1736 | 1830 | // Check if we need some stupid MySQL fix. |
| 1737 | 1831 | $server_version = $smcFunc['db_server_info'](); |
| 1738 | - if (($db_type == 'mysql' || $db_type == 'mysqli') && in_array(substr($server_version, 0, 6), array('5.0.50', '5.0.51'))) |
|
| 1739 | - updateSettings(array('db_mysql_group_by_fix' => '1')); |
|
| 1832 | + if (($db_type == 'mysql' || $db_type == 'mysqli') && in_array(substr($server_version, 0, 6), array('5.0.50', '5.0.51'))) { |
|
| 1833 | + updateSettings(array('db_mysql_group_by_fix' => '1')); |
|
| 1834 | + } |
|
| 1740 | 1835 | |
| 1741 | 1836 | // Some final context for the template. |
| 1742 | 1837 | $incontext['dir_still_writable'] = is_writable(dirname(__FILE__)) && substr(__FILE__, 1, 2) != ':\\'; |
@@ -1756,8 +1851,9 @@ discard block |
||
| 1756 | 1851 | $settingsArray = file(dirname(__FILE__) . '/Settings.php'); |
| 1757 | 1852 | |
| 1758 | 1853 | // @todo Do we just want to read the file in clean, and split it this way always? |
| 1759 | - if (count($settingsArray) == 1) |
|
| 1760 | - $settingsArray = preg_split('~[\r\n]~', $settingsArray[0]); |
|
| 1854 | + if (count($settingsArray) == 1) { |
|
| 1855 | + $settingsArray = preg_split('~[\r\n]~', $settingsArray[0]); |
|
| 1856 | + } |
|
| 1761 | 1857 | |
| 1762 | 1858 | for ($i = 0, $n = count($settingsArray); $i < $n; $i++) |
| 1763 | 1859 | { |
@@ -1765,25 +1861,29 @@ discard block |
||
| 1765 | 1861 | if (trim($settingsArray[$i]) == 'if (file_exists(dirname(__FILE__) . \'/install.php\'))' && trim($settingsArray[$i + 1]) == '{' && trim($settingsArray[$i + 9]) == '}') |
| 1766 | 1862 | { |
| 1767 | 1863 | // Set the ten lines to nothing. |
| 1768 | - for ($j=0; $j < 10; $j++) |
|
| 1769 | - $settingsArray[$i++] = ''; |
|
| 1864 | + for ($j=0; $j < 10; $j++) { |
|
| 1865 | + $settingsArray[$i++] = ''; |
|
| 1866 | + } |
|
| 1770 | 1867 | |
| 1771 | 1868 | continue; |
| 1772 | 1869 | } |
| 1773 | 1870 | |
| 1774 | - if (trim($settingsArray[$i]) == '?' . '>') |
|
| 1775 | - $settingsArray[$i] = ''; |
|
| 1871 | + if (trim($settingsArray[$i]) == '?' . '>') { |
|
| 1872 | + $settingsArray[$i] = ''; |
|
| 1873 | + } |
|
| 1776 | 1874 | |
| 1777 | 1875 | // Don't trim or bother with it if it's not a variable. |
| 1778 | - if (substr($settingsArray[$i], 0, 1) != '$') |
|
| 1779 | - continue; |
|
| 1876 | + if (substr($settingsArray[$i], 0, 1) != '$') { |
|
| 1877 | + continue; |
|
| 1878 | + } |
|
| 1780 | 1879 | |
| 1781 | 1880 | $settingsArray[$i] = rtrim($settingsArray[$i]) . "\n"; |
| 1782 | 1881 | |
| 1783 | - foreach ($vars as $var => $val) |
|
| 1784 | - if (strncasecmp($settingsArray[$i], '$' . $var, 1 + strlen($var)) == 0) |
|
| 1882 | + foreach ($vars as $var => $val) { |
|
| 1883 | + if (strncasecmp($settingsArray[$i], '$' . $var, 1 + strlen($var)) == 0) |
|
| 1785 | 1884 | { |
| 1786 | 1885 | $comment = strstr($settingsArray[$i], '#'); |
| 1886 | + } |
|
| 1787 | 1887 | $settingsArray[$i] = '$' . $var . ' = \'' . $val . '\';' . ($comment != '' ? "\t\t" . $comment : "\n"); |
| 1788 | 1888 | unset($vars[$var]); |
| 1789 | 1889 | } |
@@ -1793,36 +1893,41 @@ discard block |
||
| 1793 | 1893 | if (!empty($vars)) |
| 1794 | 1894 | { |
| 1795 | 1895 | $settingsArray[$i++] = ''; |
| 1796 | - foreach ($vars as $var => $val) |
|
| 1797 | - $settingsArray[$i++] = '$' . $var . ' = \'' . $val . '\';' . "\n"; |
|
| 1896 | + foreach ($vars as $var => $val) { |
|
| 1897 | + $settingsArray[$i++] = '$' . $var . ' = \'' . $val . '\';' . "\n"; |
|
| 1898 | + } |
|
| 1798 | 1899 | } |
| 1799 | 1900 | |
| 1800 | 1901 | // Blank out the file - done to fix a oddity with some servers. |
| 1801 | 1902 | $fp = @fopen(dirname(__FILE__) . '/Settings.php', 'w'); |
| 1802 | - if (!$fp) |
|
| 1803 | - return false; |
|
| 1903 | + if (!$fp) { |
|
| 1904 | + return false; |
|
| 1905 | + } |
|
| 1804 | 1906 | fclose($fp); |
| 1805 | 1907 | |
| 1806 | 1908 | $fp = fopen(dirname(__FILE__) . '/Settings.php', 'r+'); |
| 1807 | 1909 | |
| 1808 | 1910 | // Gotta have one of these ;) |
| 1809 | - if (trim($settingsArray[0]) != '<?php') |
|
| 1810 | - fwrite($fp, "<?php\n"); |
|
| 1911 | + if (trim($settingsArray[0]) != '<?php') { |
|
| 1912 | + fwrite($fp, "<?php\n"); |
|
| 1913 | + } |
|
| 1811 | 1914 | |
| 1812 | 1915 | $lines = count($settingsArray); |
| 1813 | 1916 | for ($i = 0; $i < $lines - 1; $i++) |
| 1814 | 1917 | { |
| 1815 | 1918 | // Don't just write a bunch of blank lines. |
| 1816 | - if ($settingsArray[$i] != '' || @$settingsArray[$i - 1] != '') |
|
| 1817 | - fwrite($fp, strtr($settingsArray[$i], "\r", '')); |
|
| 1919 | + if ($settingsArray[$i] != '' || @$settingsArray[$i - 1] != '') { |
|
| 1920 | + fwrite($fp, strtr($settingsArray[$i], "\r", '')); |
|
| 1921 | + } |
|
| 1818 | 1922 | } |
| 1819 | 1923 | fwrite($fp, $settingsArray[$i] . '?' . '>'); |
| 1820 | 1924 | fclose($fp); |
| 1821 | 1925 | |
| 1822 | 1926 | // Even though on normal installations the filemtime should prevent this being used by the installer incorrectly |
| 1823 | 1927 | // it seems that there are times it might not. So let's MAKE it dump the cache. |
| 1824 | - if (function_exists('opcache_invalidate')) |
|
| 1825 | - opcache_invalidate(dirname(__FILE__) . '/Settings.php', true); |
|
| 1928 | + if (function_exists('opcache_invalidate')) { |
|
| 1929 | + opcache_invalidate(dirname(__FILE__) . '/Settings.php', true); |
|
| 1930 | + } |
|
| 1826 | 1931 | |
| 1827 | 1932 | return true; |
| 1828 | 1933 | } |
@@ -1832,10 +1937,11 @@ discard block |
||
| 1832 | 1937 | global $cachedir; |
| 1833 | 1938 | |
| 1834 | 1939 | // Write out the db_last_error file with the error timestamp |
| 1835 | - if (!empty($cachedir) && is_writable($cachedir)) |
|
| 1836 | - file_put_contents($cachedir . '/db_last_error.php', '<' . '?' . "php\n" . '$db_last_error = 0;' . "\n" . '?' . '>'); |
|
| 1837 | - else |
|
| 1838 | - file_put_contents(dirname(__FILE__) . '/cache/db_last_error.php', '<' . '?' . "php\n" . '$db_last_error = 0;' . "\n" . '?' . '>'); |
|
| 1940 | + if (!empty($cachedir) && is_writable($cachedir)) { |
|
| 1941 | + file_put_contents($cachedir . '/db_last_error.php', '<' . '?' . "php\n" . '$db_last_error = 0;' . "\n" . '?' . '>'); |
|
| 1942 | + } else { |
|
| 1943 | + file_put_contents(dirname(__FILE__) . '/cache/db_last_error.php', '<' . '?' . "php\n" . '$db_last_error = 0;' . "\n" . '?' . '>'); |
|
| 1944 | + } |
|
| 1839 | 1945 | |
| 1840 | 1946 | return true; |
| 1841 | 1947 | } |
@@ -1852,9 +1958,9 @@ discard block |
||
| 1852 | 1958 | SecFilterScanPOST Off |
| 1853 | 1959 | </IfModule>'; |
| 1854 | 1960 | |
| 1855 | - if (!function_exists('apache_get_modules') || !in_array('mod_security', apache_get_modules())) |
|
| 1856 | - return true; |
|
| 1857 | - elseif (file_exists(dirname(__FILE__) . '/.htaccess') && is_writable(dirname(__FILE__) . '/.htaccess')) |
|
| 1961 | + if (!function_exists('apache_get_modules') || !in_array('mod_security', apache_get_modules())) { |
|
| 1962 | + return true; |
|
| 1963 | + } elseif (file_exists(dirname(__FILE__) . '/.htaccess') && is_writable(dirname(__FILE__) . '/.htaccess')) |
|
| 1858 | 1964 | { |
| 1859 | 1965 | $current_htaccess = implode('', file(dirname(__FILE__) . '/.htaccess')); |
| 1860 | 1966 | |
@@ -1866,29 +1972,28 @@ discard block |
||
| 1866 | 1972 | fwrite($ht_handle, $htaccess_addition); |
| 1867 | 1973 | fclose($ht_handle); |
| 1868 | 1974 | return true; |
| 1975 | + } else { |
|
| 1976 | + return false; |
|
| 1869 | 1977 | } |
| 1870 | - else |
|
| 1871 | - return false; |
|
| 1978 | + } else { |
|
| 1979 | + return true; |
|
| 1872 | 1980 | } |
| 1873 | - else |
|
| 1874 | - return true; |
|
| 1875 | - } |
|
| 1876 | - elseif (file_exists(dirname(__FILE__) . '/.htaccess')) |
|
| 1877 | - return strpos(implode('', file(dirname(__FILE__) . '/.htaccess')), '<IfModule mod_security.c>') !== false; |
|
| 1878 | - elseif (is_writable(dirname(__FILE__))) |
|
| 1981 | + } elseif (file_exists(dirname(__FILE__) . '/.htaccess')) { |
|
| 1982 | + return strpos(implode('', file(dirname(__FILE__) . '/.htaccess')), '<IfModule mod_security.c>') !== false; |
|
| 1983 | + } elseif (is_writable(dirname(__FILE__))) |
|
| 1879 | 1984 | { |
| 1880 | 1985 | if ($ht_handle = fopen(dirname(__FILE__) . '/.htaccess', 'w')) |
| 1881 | 1986 | { |
| 1882 | 1987 | fwrite($ht_handle, $htaccess_addition); |
| 1883 | 1988 | fclose($ht_handle); |
| 1884 | 1989 | return true; |
| 1990 | + } else { |
|
| 1991 | + return false; |
|
| 1885 | 1992 | } |
| 1886 | - else |
|
| 1993 | + } else { |
|
| 1887 | 1994 | return false; |
| 1888 | 1995 | } |
| 1889 | - else |
|
| 1890 | - return false; |
|
| 1891 | -} |
|
| 1996 | + } |
|
| 1892 | 1997 | |
| 1893 | 1998 | function template_install_above() |
| 1894 | 1999 | { |
@@ -1927,9 +2032,10 @@ discard block |
||
| 1927 | 2032 | <label for="installer_language">', $txt['installer_language'], ':</label> |
| 1928 | 2033 | <select id="installer_language" name="lang_file" onchange="location.href = \'', $installurl, '?lang_file=\' + this.options[this.selectedIndex].value;">'; |
| 1929 | 2034 | |
| 1930 | - foreach ($incontext['detected_languages'] as $lang => $name) |
|
| 1931 | - echo ' |
|
| 2035 | + foreach ($incontext['detected_languages'] as $lang => $name) { |
|
| 2036 | + echo ' |
|
| 1932 | 2037 | <option', isset($_SESSION['installer_temp_lang']) && $_SESSION['installer_temp_lang'] == $lang ? ' selected' : '', ' value="', $lang, '">', $name, '</option>'; |
| 2038 | + } |
|
| 1933 | 2039 | |
| 1934 | 2040 | echo ' |
| 1935 | 2041 | </select> |
@@ -1949,9 +2055,10 @@ discard block |
||
| 1949 | 2055 | <h2>', $txt['upgrade_progress'], '</h2> |
| 1950 | 2056 | <ul>'; |
| 1951 | 2057 | |
| 1952 | - foreach ($incontext['steps'] as $num => $step) |
|
| 1953 | - echo ' |
|
| 2058 | + foreach ($incontext['steps'] as $num => $step) { |
|
| 2059 | + echo ' |
|
| 1954 | 2060 | <li class="', $num < $incontext['current_step'] ? 'stepdone' : ($num == $incontext['current_step'] ? 'stepcurrent' : 'stepwaiting'), '">', $txt['upgrade_step'], ' ', $step[0], ': ', $step[1], '</li>'; |
| 2061 | + } |
|
| 1955 | 2062 | |
| 1956 | 2063 | echo ' |
| 1957 | 2064 | </ul> |
@@ -1977,20 +2084,23 @@ discard block |
||
| 1977 | 2084 | echo ' |
| 1978 | 2085 | <div class="floatright">'; |
| 1979 | 2086 | |
| 1980 | - if (!empty($incontext['continue'])) |
|
| 1981 | - echo ' |
|
| 2087 | + if (!empty($incontext['continue'])) { |
|
| 2088 | + echo ' |
|
| 1982 | 2089 | <input type="submit" id="contbutt" name="contbutt" value="', $txt['upgrade_continue'], '" onclick="return submitThisOnce(this);" class="button">'; |
| 1983 | - if (!empty($incontext['skip'])) |
|
| 1984 | - echo ' |
|
| 2090 | + } |
|
| 2091 | + if (!empty($incontext['skip'])) { |
|
| 2092 | + echo ' |
|
| 1985 | 2093 | <input type="submit" id="skip" name="skip" value="', $txt['upgrade_skip'], '" onclick="return submitThisOnce(this);" class="button">'; |
| 2094 | + } |
|
| 1986 | 2095 | echo ' |
| 1987 | 2096 | </div>'; |
| 1988 | 2097 | } |
| 1989 | 2098 | |
| 1990 | 2099 | // Show the closing form tag and other data only if not in the last step |
| 1991 | - if (count($incontext['steps']) - 1 !== (int) $incontext['current_step']) |
|
| 1992 | - echo ' |
|
| 2100 | + if (count($incontext['steps']) - 1 !== (int) $incontext['current_step']) { |
|
| 2101 | + echo ' |
|
| 1993 | 2102 | </form>'; |
| 2103 | + } |
|
| 1994 | 2104 | |
| 1995 | 2105 | echo ' |
| 1996 | 2106 | </div><!-- .panel --> |
@@ -2023,13 +2133,15 @@ discard block |
||
| 2023 | 2133 | </div>'; |
| 2024 | 2134 | |
| 2025 | 2135 | // Show the warnings, or not. |
| 2026 | - if (template_warning_divs()) |
|
| 2027 | - echo ' |
|
| 2136 | + if (template_warning_divs()) { |
|
| 2137 | + echo ' |
|
| 2028 | 2138 | <h3>', $txt['install_all_lovely'], '</h3>'; |
| 2139 | + } |
|
| 2029 | 2140 | |
| 2030 | 2141 | // Say we want the continue button! |
| 2031 | - if (empty($incontext['error'])) |
|
| 2032 | - $incontext['continue'] = 1; |
|
| 2142 | + if (empty($incontext['error'])) { |
|
| 2143 | + $incontext['continue'] = 1; |
|
| 2144 | + } |
|
| 2033 | 2145 | |
| 2034 | 2146 | // For the latest version stuff. |
| 2035 | 2147 | echo ' |
@@ -2063,19 +2175,21 @@ discard block |
||
| 2063 | 2175 | global $txt, $incontext; |
| 2064 | 2176 | |
| 2065 | 2177 | // Errors are very serious.. |
| 2066 | - if (!empty($incontext['error'])) |
|
| 2067 | - echo ' |
|
| 2178 | + if (!empty($incontext['error'])) { |
|
| 2179 | + echo ' |
|
| 2068 | 2180 | <div class="errorbox"> |
| 2069 | 2181 | <h3>', $txt['upgrade_critical_error'], '</h3> |
| 2070 | 2182 | ', $incontext['error'], ' |
| 2071 | 2183 | </div>'; |
| 2184 | + } |
|
| 2072 | 2185 | // A warning message? |
| 2073 | - elseif (!empty($incontext['warning'])) |
|
| 2074 | - echo ' |
|
| 2186 | + elseif (!empty($incontext['warning'])) { |
|
| 2187 | + echo ' |
|
| 2075 | 2188 | <div class="errorbox"> |
| 2076 | 2189 | <h3>', $txt['upgrade_warning'], '</h3> |
| 2077 | 2190 | ', $incontext['warning'], ' |
| 2078 | 2191 | </div>'; |
| 2192 | + } |
|
| 2079 | 2193 | |
| 2080 | 2194 | return empty($incontext['error']) && empty($incontext['warning']); |
| 2081 | 2195 | } |
@@ -2091,26 +2205,29 @@ discard block |
||
| 2091 | 2205 | <li>', $incontext['failed_files']), '</li> |
| 2092 | 2206 | </ul>'; |
| 2093 | 2207 | |
| 2094 | - if (isset($incontext['systemos'], $incontext['detected_path']) && $incontext['systemos'] == 'linux') |
|
| 2095 | - echo ' |
|
| 2208 | + if (isset($incontext['systemos'], $incontext['detected_path']) && $incontext['systemos'] == 'linux') { |
|
| 2209 | + echo ' |
|
| 2096 | 2210 | <hr> |
| 2097 | 2211 | <p>', $txt['chmod_linux_info'], '</p> |
| 2098 | 2212 | <samp># chmod a+w ', implode(' ' . $incontext['detected_path'] . '/', $incontext['failed_files']), '</samp>'; |
| 2213 | + } |
|
| 2099 | 2214 | |
| 2100 | 2215 | // This is serious! |
| 2101 | - if (!template_warning_divs()) |
|
| 2102 | - return; |
|
| 2216 | + if (!template_warning_divs()) { |
|
| 2217 | + return; |
|
| 2218 | + } |
|
| 2103 | 2219 | |
| 2104 | 2220 | echo ' |
| 2105 | 2221 | <hr> |
| 2106 | 2222 | <p>', $txt['ftp_setup_info'], '</p>'; |
| 2107 | 2223 | |
| 2108 | - if (!empty($incontext['ftp_errors'])) |
|
| 2109 | - echo ' |
|
| 2224 | + if (!empty($incontext['ftp_errors'])) { |
|
| 2225 | + echo ' |
|
| 2110 | 2226 | <div class="error_message"> |
| 2111 | 2227 | ', $txt['error_ftp_no_connect'], '<br><br> |
| 2112 | 2228 | <code>', implode('<br>', $incontext['ftp_errors']), '</code> |
| 2113 | 2229 | </div>'; |
| 2230 | + } |
|
| 2114 | 2231 | |
| 2115 | 2232 | echo ' |
| 2116 | 2233 | <form action="', $incontext['form_url'], '" method="post"> |
@@ -2179,16 +2296,16 @@ discard block |
||
| 2179 | 2296 | <dd> |
| 2180 | 2297 | <select name="db_type" id="db_type_input" onchange="toggleDBInput();">'; |
| 2181 | 2298 | |
| 2182 | - foreach ($incontext['supported_databases'] as $key => $db) |
|
| 2183 | - echo ' |
|
| 2299 | + foreach ($incontext['supported_databases'] as $key => $db) { |
|
| 2300 | + echo ' |
|
| 2184 | 2301 | <option value="', $key, '"', isset($_POST['db_type']) && $_POST['db_type'] == $key ? ' selected' : '', '>', $db['name'], '</option>'; |
| 2302 | + } |
|
| 2185 | 2303 | |
| 2186 | 2304 | echo ' |
| 2187 | 2305 | </select> |
| 2188 | 2306 | <div class="smalltext">', $txt['db_settings_type_info'], '</div> |
| 2189 | 2307 | </dd>'; |
| 2190 | - } |
|
| 2191 | - else |
|
| 2308 | + } else |
|
| 2192 | 2309 | { |
| 2193 | 2310 | echo ' |
| 2194 | 2311 | <dd> |
@@ -2356,9 +2473,10 @@ discard block |
||
| 2356 | 2473 | <div class="red">', $txt['error_db_queries'], '</div> |
| 2357 | 2474 | <ul>'; |
| 2358 | 2475 | |
| 2359 | - foreach ($incontext['failures'] as $line => $fail) |
|
| 2360 | - echo ' |
|
| 2476 | + foreach ($incontext['failures'] as $line => $fail) { |
|
| 2477 | + echo ' |
|
| 2361 | 2478 | <li><strong>', $txt['error_db_queries_line'], $line + 1, ':</strong> ', nl2br(htmlspecialchars($fail)), '</li>'; |
| 2479 | + } |
|
| 2362 | 2480 | |
| 2363 | 2481 | echo ' |
| 2364 | 2482 | </ul>'; |
@@ -2423,15 +2541,16 @@ discard block |
||
| 2423 | 2541 | </dd> |
| 2424 | 2542 | </dl>'; |
| 2425 | 2543 | |
| 2426 | - if ($incontext['require_db_confirm']) |
|
| 2427 | - echo ' |
|
| 2544 | + if ($incontext['require_db_confirm']) { |
|
| 2545 | + echo ' |
|
| 2428 | 2546 | <h2>', $txt['user_settings_database'], '</h2> |
| 2429 | 2547 | <p>', $txt['user_settings_database_info'], '</p> |
| 2430 | 2548 | |
| 2431 | 2549 | <div class="lefttext"> |
| 2432 | 2550 | <input type="password" name="password3" size="30"> |
| 2433 | 2551 | </div>'; |
| 2434 | -} |
|
| 2552 | + } |
|
| 2553 | + } |
|
| 2435 | 2554 | |
| 2436 | 2555 | // Tell them it's done, and to delete. |
| 2437 | 2556 | function template_delete_install() |
@@ -2444,13 +2563,14 @@ discard block |
||
| 2444 | 2563 | template_warning_divs(); |
| 2445 | 2564 | |
| 2446 | 2565 | // Install directory still writable? |
| 2447 | - if ($incontext['dir_still_writable']) |
|
| 2448 | - echo ' |
|
| 2566 | + if ($incontext['dir_still_writable']) { |
|
| 2567 | + echo ' |
|
| 2449 | 2568 | <p><em>', $txt['still_writable'], '</em></p>'; |
| 2569 | + } |
|
| 2450 | 2570 | |
| 2451 | 2571 | // Don't show the box if it's like 99% sure it won't work :P. |
| 2452 | - if ($incontext['probably_delete_install']) |
|
| 2453 | - echo ' |
|
| 2572 | + if ($incontext['probably_delete_install']) { |
|
| 2573 | + echo ' |
|
| 2454 | 2574 | <label> |
| 2455 | 2575 | <input type="checkbox" id="delete_self" onclick="doTheDelete();"> |
| 2456 | 2576 | <strong>', $txt['delete_installer'], !isset($_SESSION['installer_temp_ftp']) ? ' ' . $txt['delete_installer_maybe'] : '', '</strong> |
@@ -2466,6 +2586,7 @@ discard block |
||
| 2466 | 2586 | theCheck.disabled = true; |
| 2467 | 2587 | } |
| 2468 | 2588 | </script>'; |
| 2589 | + } |
|
| 2469 | 2590 | |
| 2470 | 2591 | echo ' |
| 2471 | 2592 | <p>', sprintf($txt['go_to_your_forum'], $boardurl . '/index.php'), '</p> |