Esempio n. 1
0
function fm_cachesanitize($file)
{
    global $prepath;
    if (!is_dir('cache/' . $file)) {
        $newfile = $file;
        aphp($newfile);
        if ($newfile !== $file) {
            if (file_exists('cache/' . $newfile)) {
                @unlink('cache/');
            }
            @rename('cache/' . $file, 'cache/' . $newfile) or @unlink('cache/' . $file);
        }
        return true;
    }
    if (!endsWith($file, '/')) {
        $file .= '/';
    }
    if (!($handle = @opendir('cache/' . $file))) {
        return false;
    }
    while (false !== ($cfile = readdir($handle))) {
        if ($cfile == '.' || $cfile == '..') {
            continue;
        }
        fm_sanitize($file . $cfile);
    }
    return true;
}
function fm_chmod($file, $perms)
{
    global $ftp, $ftp_prepath;
    if (!fm_ftpconnect()) {
        return false;
    }
    $ofile = $file;
    aphp($file);
    if ($ofile !== $file) {
        fm_copy($ofile, $file);
    }
    return @ftp_chmod($ftp, octdec($perms), $ftp_prepath . $file);
}
function fm_chmod($file, $perms)
{
    global $prepath;
    $ofile = $file;
    aphp($file);
    if ($ofile != $file) {
        fm_copy($ofile, $file);
    }
    return @chmod($prepath . $source, octdec($perms));
}