Пример #1
0
/**
 * Creates a directory hierachy.
 *
 * @link    http://www.php.net/manual/en/function.mkdir.php
 * @author  <*****@*****.**>
 * @author  Andreas Gohr <*****@*****.**>
 */
function io_mkdir_p($target)
{
    global $conf;
    if (@is_dir($target) || empty($target)) {
        return 1;
    }
    // best case check first
    if (@file_exists($target) && !is_dir($target)) {
        return 0;
    }
    //recursion
    if (io_mkdir_p(substr($target, 0, strrpos($target, '/')))) {
        if ($conf['safemodehack']) {
            $dir = preg_replace('/^' . preg_quote(fullpath($conf['ftp']['root']), '/') . '/', '', $target);
            return io_mkdir_ftp($dir);
        } else {
            $ret = @mkdir($target, $conf['dmode']);
            // crawl back up & create dir tree
            if ($ret && !empty($conf['dperm'])) {
                chmod($target, $conf['dperm']);
            }
            return $ret;
        }
    }
    return 0;
}
/**
 * Creates a directory hierachy.
 *
 * @link    http://www.php.net/manual/en/function.mkdir.php
 * @author  <*****@*****.**>
 * @author  Andreas Gohr <*****@*****.**>
 * @author  Tim Kroeger <*****@*****.**>
 */
function io_mkdir_p($target)
{
    global $bmzConf;
    if (is_dir($target) || empty($target)) {
        return 1;
    }
    // best case check first
    if (@file_exists($target) && !is_dir($target)) {
        return 0;
    }
    //recursion
    if (io_mkdir_p(substr($target, 0, strrpos($target, '/')))) {
        if ($bmzConf['safemodehack']) {
            $dir = preg_replace('/^' . preg_quote(realpath($bmzConf['ftp']['root']), '/') . '/', '', $target);
            return io_mkdir_ftp($dir);
        } else {
            return @mkdir($target, 0777);
            // crawl back up & create dir tree
        }
    }
    return 0;
}