" . $_lang['preinstall_validation'] . "
"; echo "" . $_lang['summary_setup_check'] . "
"; $errors = 0; // check PHP version echo "" . $_lang['checking_php_version']; $php_ver_comp = version_compare(phpversion(), "4.1.0"); $php_ver_comp2 = version_compare(phpversion(), "4.3.8"); // -1 if left is less, 0 if equal, +1 if left is higher if ($php_ver_comp < 0) { echo "" . $_lang['failed'] . "".$_lang['you_running_php'] . phpversion() . $_lang["modx_requires_php"]."
"; $errors += 1; } else { echo "" . $_lang['ok'] . ""; if ($php_ver_comp2 < 0) { echo ""; } } // check php register globals off echo "" . $_lang['checking_registerglobals']; $register_globals = (int) ini_get('register_globals'); if ($register_globals == '1'){ echo "" . $_lang['failed']. "
".$_lang['checking_registerglobals_note']."
"; // $errors += 1; // comment out for now so we still allow installs if folks are simply stubborn } else { echo "" . $_lang['ok'] . ""; } // check sessions echo "" . $_lang['checking_sessions']; if ($_SESSION['session_test'] != 1) { echo "" . $_lang['failed']. "
"; $errors += 1; } else { echo "" . $_lang['ok'] . ""; } // check directories // cache exists? echo "" . $_lang['checking_if_cache_exist']; if (!file_exists("../assets/cache")) { echo "" . $_lang['failed'] . "
"; $errors += 1; } else { echo "" . $_lang['ok'] . ""; } // cache writable? echo "" . $_lang['checking_if_cache_writable']; if (!is_writable("../assets/cache")) { echo "" . $_lang['failed'] . "
"; $errors += 1; } else { echo "" . $_lang['ok'] . ""; } // cache files writable? echo "" . $_lang['checking_if_cache_file_writable']; if (!is_writable("../assets/cache/siteCache.idx.php")) { echo "" . $_lang['failed'] . "
"; $errors += 1; } else { echo "".$_lang['ok'].""; } echo "".$_lang['checking_if_cache_file2_writable']; if (!is_writable("../assets/cache/sitePublishing.idx.php")) { echo "".$_lang['failed']."
"; $errors += 1; } else { echo "".$_lang['ok'].""; } // images exists? echo "".$_lang['checking_if_images_exist']; if (!file_exists("../assets/images")) { echo "".$_lang['failed']."
"; $errors += 1; } else { echo "".$_lang['ok'].""; } // images writable? echo "".$_lang['checking_if_images_writable']; if (!is_writable("../assets/images")) { echo "".$_lang['failed']."
"; $errors += 1; } else { echo "".$_lang['ok'].""; } // export exists? echo "".$_lang['checking_if_export_exists']; if (!file_exists("../assets/export")) { echo "".$_lang['failed']."
"; $errors += 1; } else { echo "".$_lang['ok'].""; } // export writable? echo "".$_lang['checking_if_export_writable']; if (!is_writable("../assets/export")) { echo "".$_lang['failed']."
"; $errors += 1; } else { echo "".$_lang['ok'].""; } // config.inc.php writable? echo "".$_lang['checking_if_config_exist_and_writable']; if (!file_exists("../manager/includes/config.inc.php")) { // make an attempt to create the file @ $hnd = fopen("../manager/includes/config.inc.php", 'w'); @ fwrite($hnd, ""); @ fclose($hnd); } $isWriteable = is_writable("../manager/includes/config.inc.php"); if (!$isWriteable) { echo "".$_lang['failed']."
".$_lang['config_permissions_note']."
"; $errors += 1; } else { echo "".$_lang['ok'].""; } // connect to the database if ($installMode == 1) { include "../manager/includes/config.inc.php"; } else { // get db info from post $database_server = $_POST['databasehost']; $database_user = $_POST['databaseloginname']; $database_password = $_POST['databaseloginpassword']; $database_collation = $_POST['database_collation']; $database_charset = substr($database_collation, 0, strpos($database_collation, '_') - 1); $database_connection_charset = $_POST['database_connection_charset']; $dbase = $_POST['database_name']; $table_prefix = $_POST['tableprefix']; } echo "".$_lang['creating_database_connection']; if (!@ $conn = mysql_connect($database_server, $database_user, $database_password)) { $errors += 1; echo "".$_lang['database_connection_failed']."
".$_lang['database_connection_failed_note'].""; } else { echo "".$_lang['ok'].""; } // make sure we can use the database if ($installMode > 0 && !@ mysql_query("USE {$dbase}")) { $errors += 1; echo "".$_lang['database_use_failed']."".$_lang["database_use_failed_note"].""; } // check the database collation if not specified in the configuration if (!isset ($database_connection_charset) || empty ($database_connection_charset)) { if (!$rs = @ mysql_query("show session variables like 'collation_database'")) { $rs = @ mysql_query("show session variables like 'collation_server'"); } if ($rs && $collation = mysql_fetch_row($rs)) { $database_collation = $collation[1]; } if (empty ($database_collation)) { $database_collation = 'utf8_unicode_ci'; } $database_charset = substr($database_collation, 0, strpos($database_collation, '_') - 1); $database_connection_charset = $database_charset; } // check table prefix if ($conn && $installMode == 0) { echo "" . $_lang['checking_table_prefix'] . $table_prefix . "`: "; if ($rs= @ mysql_query("SELECT COUNT(*) FROM $dbase.`" . $table_prefix . "site_content`")) { echo "" . $_lang['failed'] . "" . $_lang['table_prefix_already_inuse'] . "
"; $errors += 1; echo "" . $_lang['table_prefix_already_inuse_note'] . "
"; } else { echo "" . $_lang['ok'] . ""; } } elseif ($conn && $installMode == 2) { echo "" . $_lang['checking_table_prefix'] . $table_prefix . "`: "; if (!$rs = @ mysql_query("SELECT COUNT(*) FROM $dbase.`" . $table_prefix . "site_content`")) { echo "" . $_lang['failed'] . "" . $_lang['table_prefix_not_exist'] . "
"; $errors += 1; echo "" . $_lang['table_prefix_not_exist_note'] . "
"; } else { echo "" . $_lang['ok'] . ""; } } // check mysql version if ($conn) { echo "" . $_lang['checking_mysql_version']; if ( version_compare(mysql_get_server_info(), '5.0.51', '=') ) { echo "" . $_lang['ok'] . " ". $_lang['mysql_5051'] . "
"; echo "" . $_lang['mysql_5051_warning'] . "
"; } else { echo "" . $_lang['ok'] . " " . $_lang['mysql_version_is'] . mysql_get_server_info() . ""; } } // check for strict mode if ($conn) { echo "". $_lang['checking_mysql_strict_mode']; $mysqlmode = @ mysql_query("SELECT @@global.sql_mode"); if (mysql_num_rows($mysqlmode) > 0){ $modes = mysql_fetch_array($mysqlmode, MYSQL_NUM); //$modes = array("STRICT_TRANS_TABLES"); // for testing // print_r($modes); foreach ($modes as $mode) { if (strtoupper($mode) == "STRICT_TRANS_TABLES") { echo "" . $_lang['failed'] . " " . $_lang['strict_mode'] . "
"; $errors += 1; echo "" . $_lang['strict_mode_error'] . "
"; } else { echo "" . $_lang['ok'] . ""; } } } else { echo "" . $_lang['ok'] . ""; } } // Version and strict mode check end // andrazk 20070416 - add install flag and disable manager login // assets/cache writable? if (is_writable("../assets/cache")) { if (file_exists('../assets/cache/installProc.inc.php')) { @chmod('../assets/cache/installProc.inc.php', 0755); unlink('../assets/cache/installProc.inc.php'); } // make an attempt to create the file @ $hnd = fopen("../assets/cache/installProc.inc.php", 'w'); @ fwrite($hnd, ''); @ fclose($hnd); } if ($errors > 0) { ?>1 ? $errors." " : ""; if ($errors > 1) echo $_lang['errors']; else echo $_lang['error']; if ($errors > 1) echo $_lang['please_correct_errors']; else echo $_lang['please_correct_error']; if ($errors > 1) echo $_lang['and_try_again_plural']; else echo $_lang['and_try_again']; echo $_lang['visit_forum']; ?>
"; $nextAction= $errors > 0 ? 'summary' : 'install'; $nextButton= $errors > 0 ? $_lang['retry'] : $_lang['install']; ?>