mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-08 03:01:43 +09:00
Remove safe_mode condition from FileHandler
This commit is contained in:
parent
16a2f2c94a
commit
313e7048d5
1 changed files with 2 additions and 66 deletions
|
|
@ -184,75 +184,11 @@ class FileHandler
|
||||||
* @return bool TRUE if success. It might return nothing when ftp is used and connection to the ftp address failed.
|
* @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)
|
public static function makeDir($path_string)
|
||||||
{
|
|
||||||
if (!ini_get('safe_mode'))
|
|
||||||
{
|
{
|
||||||
$path = self::getRealPath($path_string);
|
$path = self::getRealPath($path_string);
|
||||||
return Rhymix\Framework\Storage::isDirectory($path) || Rhymix\Framework\Storage::createDirectory($path);
|
return Rhymix\Framework\Storage::isDirectory($path) || Rhymix\Framework\Storage::createDirectory($path);
|
||||||
}
|
}
|
||||||
|
|
||||||
// if safe_mode is on, use FTP
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove all files under the path
|
* Remove all files under the path
|
||||||
*
|
*
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue