Skip to content
Snippets Groups Projects
Commit 034138e2 authored by Rainer Weinhold's avatar Rainer Weinhold
Browse files

safemode hack fixes #179

darcs-hash:20050712210940-99f23-80c16d578f58f955c9c99f27a1b2a0f3f7eb5d11.gz
parent b8957367
No related branches found
No related tags found
No related merge requests found
......@@ -131,9 +131,6 @@ function io_makeFileDir($file){
global $conf;
$dir = dirname($file);
if($conf['safemodehack']){
$dir = preg_replace('/^'.preg_quote(realpath($conf['ftp']['root']),'/').'/','',$dir);
}
umask($conf['dmask']);
if(!is_dir($dir)){
io_mkdir_p($dir) || msg("Creating directory $dir failed",-1);
......@@ -155,7 +152,8 @@ function io_mkdir_p($target){
//recursion
if (io_mkdir_p(substr($target,0,strrpos($target,'/')))){
if($conf['safemodehack']){
return io_mkdir_ftp($target);
$dir = preg_replace('/^'.preg_quote(realpath($conf['ftp']['root']),'/').'/','', $target);
return io_mkdir_ftp($dir);
}else{
return @mkdir($target,0777); // crawl back up & create dir tree
}
......@@ -189,13 +187,12 @@ function io_mkdir_ftp($dir){
return false;
}
//FIXME silence those commands again!
//create directory
$ok = ftp_mkdir($conn, $dir);
$ok = @ftp_mkdir($conn, $dir);
//set permissions (using the directory umask)
ftp_site($conn,sprintf("CHMOD %04o %s",(0777 - $conf['dmask']),$dir));
@ftp_site($conn,sprintf("CHMOD %04o %s",(0777 - $conf['dmask']),$dir));
ftp_close($conn);
@ftp_close($conn);
return $ok;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment