diff options
Diffstat (limited to 'app/class/controllerart.php')
-rw-r--r-- | app/class/controllerart.php | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/app/class/controllerart.php b/app/class/controllerart.php index 20ef634..ace7e82 100644 --- a/app/class/controllerart.php +++ b/app/class/controllerart.php @@ -201,6 +201,28 @@ class Controllerart extends Controller } } + public function download($id) + { + if($this->user->isadmin()) { + + $file = Model::DATABASE_DIR . Config::arttable() . DIRECTORY_SEPARATOR . $id . '.json'; + + if (file_exists($file)) { + header('Content-Description: File Transfer'); + header('Content-Type: application/json; charset=utf-8'); + header('Content-Disposition: attachment; filename="'.basename($file).'"'); + header('Expires: 0'); + header('Cache-Control: must-revalidate'); + header('Pragma: public'); + header('Content-Length: ' . filesize($file)); + readfile($file); + exit; + } + } else { + $this->routedirect('artread/', ['art' => $id]); + } + } + public function delete($id) { $this->setart($id, 'artdelete'); |