mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-04-02 01:52:10 +09:00
Remove safe_mode condition from admin and install modules
This commit is contained in:
parent
313e7048d5
commit
9aa4e244c2
27 changed files with 2 additions and 170 deletions
|
|
@ -264,102 +264,6 @@ class installController extends install
|
|||
return new Object();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set FTP Information
|
||||
*/
|
||||
function procInstallFTP()
|
||||
{
|
||||
if(Context::isInstalled()) return new Object(-1, 'msg_already_installed');
|
||||
$ftp_info = Context::gets('ftp_host', 'ftp_user','ftp_password','ftp_port','ftp_root_path');
|
||||
$ftp_info->ftp_port = (int)$ftp_info->ftp_port;
|
||||
if(!$ftp_info->ftp_port) $ftp_info->ftp_port = 21;
|
||||
if(!$ftp_info->ftp_host) $ftp_info->ftp_host = '127.0.0.1';
|
||||
if(!$ftp_info->ftp_root_path) $ftp_info->ftp_root_path = '/';
|
||||
|
||||
$buff = array('<?php if(!defined("__XE__")) exit();');
|
||||
$buff[] = "\$ftp_info = new stdClass();";
|
||||
foreach($ftp_info as $key => $val)
|
||||
{
|
||||
$buff[] = sprintf("\$ftp_info->%s='%s';", $key, str_replace("'","\\'",$val));
|
||||
}
|
||||
|
||||
// If safe_mode
|
||||
if(ini_get('safe_mode'))
|
||||
{
|
||||
if(!$ftp_info->ftp_user || !$ftp_info->ftp_password) return new Object(-1,'msg_safe_mode_ftp_needed');
|
||||
|
||||
$oFtp = new ftp();
|
||||
if(!$oFtp->ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port)) return new Object(-1, sprintf(lang('msg_ftp_not_connected'), $ftp_info->ftp_host));
|
||||
|
||||
if(!$oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password))
|
||||
{
|
||||
$oFtp->ftp_quit();
|
||||
return new Object(-1,'msg_ftp_invalid_auth_info');
|
||||
}
|
||||
|
||||
if(!is_dir(_XE_PATH_.'files') && !$oFtp->ftp_mkdir($ftp_info->ftp_root_path.'files'))
|
||||
{
|
||||
$oFtp->ftp_quit();
|
||||
return new Object(-1,'msg_ftp_mkdir_fail');
|
||||
}
|
||||
|
||||
if(!$oFtp->ftp_site("CHMOD 777 ".$ftp_info->ftp_root_path.'files'))
|
||||
{
|
||||
$oFtp->ftp_quit();
|
||||
return new Object(-1,'msg_ftp_chmod_fail');
|
||||
}
|
||||
|
||||
if(!is_dir(_XE_PATH_.'files/config') && !$oFtp->ftp_mkdir($ftp_info->ftp_root_path.'files/config'))
|
||||
{
|
||||
$oFtp->ftp_quit();
|
||||
return new Object(-1,'msg_ftp_mkdir_fail');
|
||||
}
|
||||
|
||||
if(!$oFtp->ftp_site("CHMOD 777 ".$ftp_info->ftp_root_path.'files/config'))
|
||||
{
|
||||
$oFtp->ftp_quit();
|
||||
return new Object(-1,'msg_ftp_chmod_fail');
|
||||
}
|
||||
|
||||
$oFtp->ftp_quit();
|
||||
}
|
||||
|
||||
FileHandler::WriteFile(Context::getFTPConfigFile(), join(PHP_EOL, $buff));
|
||||
}
|
||||
|
||||
function procInstallCheckFtp()
|
||||
{
|
||||
$ftp_info = Context::gets('ftp_user','ftp_password','ftp_port','sftp');
|
||||
$ftp_info->ftp_port = (int)$ftp_info->ftp_port;
|
||||
if(!$ftp_info->ftp_port) $ftp_info->ftp_port = 21;
|
||||
if(!$ftp_info->sftp) $ftp_info->sftp = 'N';
|
||||
|
||||
if(!$ftp_info->ftp_user || !$ftp_info->ftp_password) return new Object(-1,'msg_safe_mode_ftp_needed');
|
||||
|
||||
if($ftp_info->sftp == 'Y')
|
||||
{
|
||||
$connection = ssh2_connect('localhost', $ftp_info->ftp_port);
|
||||
if(!ssh2_auth_password($connection, $ftp_info->ftp_user, $ftp_info->ftp_password))
|
||||
{
|
||||
return new Object(-1,'msg_ftp_invalid_auth_info');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$oFtp = new ftp();
|
||||
if(!$oFtp->ftp_connect('127.0.0.1', $ftp_info->ftp_port)) return new Object(-1, sprintf(lang('msg_ftp_not_connected'), 'localhost'));
|
||||
|
||||
if(!$oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password))
|
||||
{
|
||||
$oFtp->ftp_quit();
|
||||
return new Object(-1,'msg_ftp_invalid_auth_info');
|
||||
}
|
||||
$oFtp->ftp_quit();
|
||||
}
|
||||
|
||||
$this->setMessage('msg_ftp_connect_success');
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Result returned after checking the installation environment
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue