} else { $status .= "&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) { if ($fix_utf8 == "") { $delfile = utf8_decode(urldecode($myFiles[0])); } else { $delfile = iconv("UTF-8", $fix_utf8, urlencode($file)); } // we have to remove the ** before checking $delfile = substr($delfile, 0, strpos($delfile, "**")); if (is_tfu_deletable($dir . "/" . $delfile)) { $status .= "&file_delete=true"; } else { $status .= "&file_delete=false"; } } // we check if we have an error in the upload! if (isset($_SESSION["upload_memory_limit"]) && isset($_GET['check_upload'])) { $mem_errors = "&upload_mem_errors=" . $_SESSION["upload_memory_limit"]; unset($_SESSION["upload_memory_limit"]); } else { $mem_errors = ""; } if (isset($_SESSION["TFU_LAST_UPLOADS"])) { $upload_ok = "&upload_ok=" . count($_SESSION["TFU_LAST_UPLOADS"]); } else {
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; }
if ($result) { echo "&result=true"; } else { echo "&result=false"; } } else { echo "&result=perm"; } } else { if ($action == "xdelete") { // delete several files! $deleted = 0; $perm = 0; $notdel = 0; foreach ($file as $ff) { if (is_tfu_deletable($ff)) { set_error_handler("on_error_no_output"); @chmod($ff, 0777); set_error_handler("on_error"); $result = @unlink($ff); if ($result) { $deleted++; } else { $notdel++; } } else { $perm++; } } echo "&result=multiple&nr_del=" . $deleted . "&nr_perm=" . $perm . "&nr_not_del=" . $notdel; } else {