Index: branches/5.0.x/core/install.php =================================================================== diff -u -r12198 -r12199 --- branches/5.0.x/core/install.php (.../install.php) (revision 12198) +++ branches/5.0.x/core/install.php (.../install.php) (revision 12199) @@ -1,6 +1,6 @@ Array ('check_paths', 'db_config', 'select_license', 'download_license', 'select_domain', 'root_password', 'choose_modules', 'post_config', 'select_theme', 'finish'), - 'clean_reinstall' => Array ('check_paths', 'clean_db', 'db_config', 'select_license', 'download_license', 'select_domain', 'root_password', 'choose_modules', 'post_config', 'select_theme', 'finish'), + 'fresh_install' => Array ('check_paths', 'db_config', 'select_license', 'download_license', 'select_domain', 'root_password', 'choose_modules', 'post_config', 'select_theme', 'security', 'finish'), + 'clean_reinstall' => Array ('check_paths', 'clean_db', 'db_config', 'select_license', 'download_license', 'select_domain', 'root_password', 'choose_modules', 'post_config', 'select_theme', 'security', 'finish'), 'already_installed' => Array ('check_paths', 'install_setup'), - 'upgrade' => Array ('check_paths', 'install_setup', 'upgrade_modules', 'finish'), - 'update_license' => Array ('check_paths', 'install_setup', 'select_license', 'download_license', 'select_domain', 'finish'), - 'db_reconfig' => Array ('check_paths', 'install_setup', 'db_reconfig', 'finish'), - 'fix_paths' => Array ('check_paths', 'install_setup', 'fix_paths', 'finish'), + 'upgrade' => Array ('check_paths', 'install_setup', 'upgrade_modules', 'security', 'finish'), + 'update_license' => Array ('check_paths', 'install_setup', 'select_license', 'download_license', 'select_domain', 'security', 'finish'), + 'db_reconfig' => Array ('check_paths', 'install_setup', 'db_reconfig', 'security', 'finish'), + 'fix_paths' => Array ('check_paths', 'install_setup', 'fix_paths', 'security', 'finish'), ); /** * Steps, that doesn't required admin to be logged-in to proceed * * @var Array */ - var $skipLoginSteps = Array ('check_paths', 'select_license', 'download_license', 'select_domain', 'root_password', 'choose_modules', 'post_config', 'select_theme', 'finish', -1); + var $skipLoginSteps = Array ('check_paths', 'select_license', 'download_license', 'select_domain', 'root_password', 'choose_modules', 'post_config', 'select_theme', 'security', 'finish', -1); /** * Steps, on which kApplication should not be initialized, because of missing correct db table structure @@ -389,6 +389,46 @@ $this->errorMessage = 'Please select action to perform'; } break; + + case 'security': + // perform write check + if ($this->Application->GetVar('skip_security_check')) { + // administrator intensionally skips security checks + break; + } + + $write_check = true; + $check_paths = Array ('/', '/index.php', '/config.php', ADMIN_DIRECTORY . '/index.php'); + foreach ($check_paths as $check_path) { + if ($this->toolkit->checkWritePermissions(FULL_PATH . $check_path)) { + $write_check = false; + break; + } + } + + // script execute check + if (file_exists(WRITEABLE . '/install_check.php')) { + unlink(WRITEABLE . '/install_check.php'); + } + + $fp = fopen(WRITEABLE . '/install_check.php', 'w'); + fwrite($fp, "Application->recallObject('CurlHelper'); + /* @var $curl_helper kCurlHelper */ + + $output = $curl_helper->Send($this->Application->BaseURL(WRITEBALE_BASE) . 'install_check.php'); + unlink(WRITEABLE . '/install_check.php'); + $execute_check = ($output !== 'OK'); + + if (!$write_check || !$execute_check) { + $this->errorMessage = true; + } + else { + $this->currentStep = $this->GetNextStep(); + } + break; } $this->PerformValidation(); // returns validation status (just in case)