/** * @brief Choose a DB */ function dispInstallSelectDB() { // Display check_env if it is not installable if (!$this->install_enable) { return $this->dispInstallCheckEnv(); } // Enter ftp information if (ini_get('safe_mode') && !Context::isFTPRegisted()) { Context::set('progressMenu', '3'); $this->setTemplateFile('ftp'); } else { $defaultDatabase = 'mysqli'; $disableList = DB::getDisableList(); if (is_array($disableList)) { foreach ($disableList as $key => $value) { if ($value->db_type == $defaultDatabase) { $defaultDatabase = 'mysql'; break; } } } Context::set('defaultDatabase', $defaultDatabase); Context::set('progressMenu', '4'); $this->setTemplateFile('select_db'); } }
/** * @brief DB 선택 화면 **/ function dispInstallSelectDB() { // 설치 불가능하다면 check_env를 출력 if (!$this->install_enable) { return $this->dispInstallCheckEnv(); } // ftp 정보 입력 if (!Context::isFTPRegisted()) { $this->setTemplateFile('ftp'); } else { $this->setTemplateFile('select_db'); } }
/** * @brief Choose a DB **/ function dispInstallSelectDB() { // Display check_env if it is not installable if (!$this->install_enable) { return $this->dispInstallCheckEnv(); } // Enter ftp information if (ini_get('safe_mode') && !Context::isFTPRegisted()) { Context::set('progressMenu', '3'); $this->setTemplateFile('ftp'); } else { Context::set('progressMenu', '4'); $this->setTemplateFile('select_db'); } }
/** * @brief 디렉토리 생성 * * 주어진 경로를 단계별로 접근하여 recursive하게 디렉토리 생성 **/ function makeDir($path_string) { static $oFtp = null; // safe_mode 일 경우 ftp 정보를 이용해서 디렉토리 생성 if (ini_get('safe_mode') && $oFtp == null) { if (!Context::isFTPRegisted()) { return; } require_once _XE_PATH_ . 'libs/ftp.class.php'; $ftp_info = Context::getFTPInfo(); $oFtp = new ftp(); if (!$oFtp->ftp_connect('localhost')) { return; } if (!$oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password)) { $oFtp->ftp_quit(); return; } } $path_string = str_replace(_XE_PATH_, '', $path_string); $path_list = explode('/', $path_string); $path = _XE_PATH_; for ($i = 0; $i < count($path_list); $i++) { if (!$path_list[$i]) { continue; } $path .= $path_list[$i] . '/'; if (!is_dir($path)) { if (ini_get('safe_mode')) { $oFtp->ftp_mkdir($path); $oFtp->ftp_site("CHMOD 777 " . $path); } else { @mkdir($path, 0755); @chmod($path, 0755); } } } return is_dir($path_string); }
/** * @brief Choose a DB */ function dispInstallSelectDB() { // Display check_env if it is not installable if (!$this->install_enable) { return $this->dispInstallCheckEnv(); } // Delete mod_rewrite check file FileHandler::removeFile(_XE_PATH_ . self::$rewriteCheckFilePath); // Save mod_rewrite check status if (Context::get('rewrite') === 'Y') { Context::set('use_rewrite', $_SESSION['use_rewrite'] = 'Y'); } // Enter ftp information if (ini_get('safe_mode') && !Context::isFTPRegisted()) { Context::set('progressMenu', '3'); Context::set('server_ip_address', $_SERVER['SERVER_ADDR']); Context::set('server_ftp_user', get_current_user()); $this->setTemplateFile('ftp'); } else { $defaultDatabase = 'mysqli_innodb'; $disableList = DB::getDisableList(); if (is_array($disableList)) { foreach ($disableList as $key => $value) { if ($value->db_type == $defaultDatabase) { $defaultDatabase = 'mysql'; break; } } } Context::set('defaultDatabase', $defaultDatabase); Context::set('progressMenu', '4'); $error_return_url = getNotEncodedUrl('', 'act', Context::get('act'), 'db_type', Context::get('db_type')); if ($_SERVER['HTTPS'] == 'on') { // Error occured when using https protocol at "ModuleHandler::init() ' $parsedUrl = parse_url($error_return_url); $error_return_url = ''; if (isset($parsedUrl['path'])) { $error_return_url .= $parsedUrl['path']; } if (isset($parsedUrl['query'])) { $error_return_url .= '?' . $parsedUrl['query']; } if (isset($parsedUrl['fragment'])) { $error_return_url .= '?' . $parsedUrl['fragment']; } } Context::set('error_return_url', $error_return_url); $this->setTemplateFile('select_db'); } }
/** * Creates a directory * * This function creates directories recursively, which means that if ancestors of the target directory does not exist, they will be created too. * * @param string $path_string Path of target directory * @return bool TRUE if success. It might return nothing when ftp is used and connection to the ftp address failed. */ public static function makeDir($path_string) { if (self::exists($path_string) !== FALSE) { return TRUE; } if (!ini_get('safe_mode')) { @mkdir($path_string, 0755, TRUE); @chmod($path_string, 0755); } else { static $oFtp = NULL; $ftp_info = Context::getFTPInfo(); if ($oFtp == NULL) { if (!Context::isFTPRegisted()) { return; } $oFtp = new ftp(); if (!$ftp_info->ftp_host) { $ftp_info->ftp_host = "127.0.0.1"; } if (!$ftp_info->ftp_port) { $ftp_info->ftp_port = 21; } if (!$oFtp->ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port)) { return; } if (!$oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password)) { $oFtp->ftp_quit(); return; } } if (!($ftp_path = $ftp_info->ftp_root_path)) { $ftp_path = DIRECTORY_SEPARATOR; } $path_string = str_replace(_XE_PATH_, '', $path_string); $path_list = explode(DIRECTORY_SEPARATOR, $path_string); $path = _XE_PATH_; for ($i = 0, $c = count($path_list); $i < $c; $i++) { if (!$path_list[$i]) { continue; } $path .= $path_list[$i] . DIRECTORY_SEPARATOR; $ftp_path .= $path_list[$i] . DIRECTORY_SEPARATOR; if (!is_dir($path)) { $oFtp->ftp_mkdir($ftp_path); $oFtp->ftp_site("CHMOD 777 " . $ftp_path); } } } return is_dir($path_string); }
/** * Creates a directory * * This function creates directories recursively, which means that if ancestors of the target directory does not exist, they will be created too. * * @param string $path_string Path of target directory * @return bool true if success. It might return nothing when ftp is used and connection to the ftp address failed. **/ function makeDir($path_string) { static $oFtp = null; // if safe_mode is on, use FTP if (ini_get('safe_mode')) { $ftp_info = Context::getFTPInfo(); if ($oFtp == null) { if (!Context::isFTPRegisted()) { return; } require_once _XE_PATH_ . 'libs/ftp.class.php'; $oFtp = new ftp(); if (!$ftp_info->ftp_host) { $ftp_info->ftp_host = "127.0.0.1"; } if (!$ftp_info->ftp_port) { $ftp_info->ftp_port = 21; } if (!$oFtp->ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port)) { return; } if (!$oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password)) { $oFtp->ftp_quit(); return; } } $ftp_path = $ftp_info->ftp_root_path; if (!$ftp_path) { $ftp_path = "/"; } } $path_string = str_replace(_XE_PATH_, '', $path_string); $path_list = explode('/', $path_string); $path = _XE_PATH_; for ($i = 0; $i < count($path_list); $i++) { if (!$path_list[$i]) { continue; } $path .= $path_list[$i] . '/'; $ftp_path .= $path_list[$i] . '/'; if (!is_dir($path)) { if (ini_get('safe_mode')) { $oFtp->ftp_mkdir($ftp_path); $oFtp->ftp_site("CHMOD 777 " . $ftp_path); } else { @mkdir($path, 0755); @chmod($path, 0755); } } } return is_dir($path_string); }