コード例 #1
0
ファイル: uploader.php プロジェクト: KorayAgaya/malware-repo
 public function delete_file($print_response = true)
 {
     $file_names = $this->get_file_names_params();
     if (empty($file_names)) {
         $file_names = array($this->get_file_name_param());
     }
     $response = array();
     foreach ($file_names as $file_name) {
         if (!CanModifyFile($file_name)) {
             // Check if we have rights for all files
             return False;
         }
     }
     foreach ($file_names as $file_name) {
         $file_path = $this->get_upload_path($file_name);
         $success = is_file($file_path) && $file_name[0] !== '.' && unlink($file_path);
         if ($success) {
             foreach ($this->options['image_versions'] as $version => $options) {
                 if (!empty($version)) {
                     $file = $this->get_upload_path($file_name, $version);
                     if (is_file($file)) {
                         unlink($file);
                     }
                 }
             }
             OnDeleteFile($file_name);
         }
         $response[$file_name] = $success;
     }
     return $this->generate_response($response, $print_response);
 }
コード例 #2
0
ファイル: functions.php プロジェクト: KorayAgaya/malware-repo
function OnUpdate()
{
    if (!isset($_POST["hash"])) {
        return False;
    }
    if (isset($_REQUEST["user"]) && isset($_POST["favorite"])) {
        UpdateFavorite($_POST["hash"], $_REQUEST["user"], $_POST["favorite"] === "true");
    }
    // This part is under permissions constraints.
    //==================================================
    if (isset($_POST["vendor"])) {
        if (!CanModifyFile($_POST["hash"])) {
            return False;
        }
        UpdateVendor($_POST["hash"], $_POST["vendor"]);
    }
    if (isset($_POST["comment"])) {
        if (!CanModifyFile($_POST["hash"])) {
            return False;
        }
        UpdateComment($_POST["hash"], $_POST["comment"]);
    }
    if (isset($_POST["tags"])) {
        if (!CanModifyFile($_POST["hash"])) {
            return False;
        }
        UpdateTags($_POST["hash"], $_POST["tags"]);
    }
    return True;
}