function SpCreateDir($spath,$siterefer='',$sitepath='')
{
	if($spath=="") return true;
	global $cfg_dir_purview,$cfg_basedir,$cfg_ftp_mkdir;
	$flink = false;
	if($siterefer==1) $truepath = ereg_replace("/{1,}","/",$cfg_basedir."/".$sitepath);
	else if($siterefer==2){
		$truepath = $sitepath;
		if($cfg_isSafeMode||$cfg_ftp_mkdir=='Y'){ echo "Not Suppot Safemode !"; exit(); }
	}
	else $truepath = $cfg_basedir;
	$spaths = explode("/",$spath);
	$spath = "";
	foreach($spaths as $spath){
		if($spath=="") continue;
		$spath = trim($spath);
		$truepath .= "/".$spath;
		$truepath = str_replace("\\","/",$truepath);
		$truepath = ereg_replace("/{1,}","/",$truepath);
		if(!is_dir($truepath) || !is_writeable($truepath)){ 
			 if(!is_dir($truepath)) $isok = MkdirAll($truepath,$GLOBALS['cfg_dir_purview']);
			 else $isok = ChmodAll($truepath,$GLOBALS['cfg_dir_purview']);
			 if(!$isok){ echo "Create dir ".$truepath." False!<br>"; CloseFtp(); return false; }
		}
	}
	CloseFtp();
	return true;
}
Exemplo n.º 2
0
function SpCreateDir($spath)
{
    global $cfg_dir_purview, $cfg_basedir, $cfg_ftp_mkdir, $isSafeMode;
    if ($spath == '') {
        return true;
    }
    $flink = false;
    $truepath = $cfg_basedir;
    $truepath = str_replace("\\", "/", $truepath);
    $spaths = explode("/", $spath);
    $spath = "";
    foreach ($spaths as $spath) {
        if ($spath == "") {
            continue;
        }
        $spath = trim($spath);
        $truepath .= "/" . $spath;
        if (!is_dir($truepath) || !is_writeable($truepath)) {
            if (!is_dir($truepath)) {
                $isok = MkdirAll($truepath, $cfg_dir_purview);
            } else {
                $isok = ChmodAll($truepath, $cfg_dir_purview);
            }
            if (!$isok) {
                echo "创建或修改目录:" . $truepath . " 失败!<br>";
                CloseFtp();
                return false;
            }
        }
    }
    CloseFtp();
    return true;
}