Пример #1
0
function check_restrictions($dir, $show_root, &$myFiles, $fix_utf8, $status)
{
    global $enable_dir_create_detection;
    // this is a check if the dir exists - this is a configuration error!
    if (file_exists($dir)) {
        $status .= "&dir_exists=true";
    } else {
        $status .= "&dir_exists=false";
        // no other checks are made because the directory is not available!
        return $status;
    }
    // now we check if we can delete the current folder - root folder cannot be deleted!
    $status .= is_tfu_deletable($dir) && $show_root ? "&dir_delete=true" : "&dir_delete=false";
    // new we check if we can create folders - we have to check safemode too!
    set_error_handler("on_error_no_output");
    $sm_prob = has_safemode_problem_global() && runsNotAsCgi();
    if (is_writeable($dir)) {
        if ($enable_dir_create_detection) {
            // the detection of the safemode does not work on all systems - therefore it can be disabled.
            $status .= $sm_prob ? "&dir_create=subdir" : "&dir_create=true";
        } else {
            $status .= "&dir_create=true";
        }
    } else {
        $status .= $sm_prob ? "&dir_create=safemode" : "&dir_create=false";
    }
    set_error_handler("on_error");
    $nrFiles = count($myFiles);
    // now we check if can delete files - we only check the 1st file!
    if ($nrFiles > 0) {
        $delfile = fix_decoding($myFiles[0], $fix_utf8);
        // we have to remove the ** before checking
        $delfile = substr($delfile, 0, strpos($delfile, "**"));
        $status .= is_tfu_deletable($dir . "/" . $delfile) ? "&file_delete=true" : "&file_delete=false";
    }
    return $status;
}
Пример #2
0
    $no_cgi = runsNotAsCgi();
    if (function_exists("posix_getpwuid") && function_exists("posix_getpwuid")) {
        $userid = posix_geteuid();
        $userinfo = posix_getpwuid($userid);
        $def_user = array("apache", "nobody", "www");
        if (in_array($userinfo["name"], $def_user)) {
            $no_cgi = true;
        }
    }
    if (ini_get('safe_mode') == 1 && $no_cgi && !$isWindows) {
        return true;
    }
    return false;
}
// set a umask that makes the files deletable again!
if (has_safemode_problem_global() || runsNotAsCgi()) {
    umask(00);
    // otherwise you cannot delete files anymore with ftp if you are no the owner!
} else {
    umask(022);
    // Added to make created files/dirs group writable
}
function gd_version()
{
    static $gd_version_number = null;
    if ($gd_version_number === null) {
        if (function_exists("gd_info")) {
            $info = gd_info();
            $module_info = $info["GD Version"];
            if (preg_match("/[^\\d\n\r]*?([\\d\\.]+)/i", $module_info, $matches)) {
                $gd_version_number = $matches[1];
Пример #3
0
     usort($myFiles, "cmp_dec");
 }
 reset($myFiles);
 usort($myDirs, "cmp_dir_dec");
 if ($show_root) {
     array_unshift($myDirs, "..");
 }
 // now we check if we can delete the current folder - root folder cannot be deleted!
 if (is_tfu_deletable($dir) && $show_root) {
     $status .= "&dir_delete=true";
 } else {
     $status .= "&dir_delete=false";
 }
 // new we check if we can create folders - we have to check safemode too!
 set_error_handler("on_error_no_output");
 $sm_prob = has_safemode_problem_global() && runsNotAsCgi();
 if (is_writeable($dir)) {
     if ($sm_prob) {
         $status .= "&dir_create=subdir";
     } else {
         $status .= "&dir_create=true";
     }
 } else {
     if ($sm_prob) {
         $status .= "&dir_create=safemode";
     } else {
         $status .= "&dir_create=false";
     }
 }
 set_error_handler("on_error");
 $nrFiles = count($myFiles);