172900064 FTP class 추가 및 설치시에 FTP정보를 입력/저장하는 루틴 추가. 디렉토리 생성시 safe_mode일 경우 ftp로 디렉토리를 만들도록 처리. 추가 테스트 필요

git-svn-id: http://xe-core.googlecode.com/svn/sandbox@4520 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
zero 2008-09-18 12:32:38 +00:00
parent 28163b1312
commit e581ffc40b
21 changed files with 955 additions and 51 deletions

View file

@ -121,6 +121,22 @@
* 주어진 경로를 단계별로 접근하여 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);
@ -129,8 +145,13 @@
if(!$path_list[$i]) continue;
$path .= $path_list[$i].'/';
if(!is_dir($path)) {
@mkdir($path, 0755);
@chmod($path, 0755);
if(ini_get('safe_mode')) {
$oFtp->ftp_mkdir($path);
$oFtp->ftp_site("CHMOD 777 ".$path);
} else {
@mkdir($path, 0755);
@chmod($path, 0755);
}
}
}