post_id = $this->swiffer_post( "post_id", "int" ); if( $this->post_id < 1 ) RomhackPlazaFS::invalid_parameter_stop( "post_id", "POST" ); $this->custom_post_type = $this->swiffer_post( "post_type", "string" ); if( $this->custom_post_type === "" ) RomhackPlazaFS::invalid_parameter_stop( "post_type", "POST" ); $this->file_name = $this->swiffer_post( "filename", "filename" ); if( $this->file_name === "" ) RomhackPlazaFS::invalid_parameter_stop( "filename", "POST" ); } protected function process(): void { $data = Data::setup( $this->custom_post_type, $this->post_id, $this->file_name ); if( !$data->file_exists() ) RomhackPlazaFS::fatal_stop( 404, "File not found." ); $new_data = Data::setup( $this->custom_post_type, $this->post_id, $this->file_name, Data::F_PRIVATE_FILE ); if( $new_data->file_exists() ) RomhackPlazaFS::fatal_stop( 500, "File already exists. Can't replace. Please delete private file before." ); if( $data->change_data_location( $new_data ) ) RomhackPlazaFS::success_response( [ 'status' => Data::STATUS_PRIVATE ] ); RomhackPlazaFS::fatal_stop( 500, "Error during file marking" ); } }