aboutsummaryrefslogtreecommitdiff
path: root/app/class/controllerart.php
diff options
context:
space:
mode:
authorvincent-peugnet <v.peugnet@free.fr>2019-01-22 02:04:53 +0100
committervincent-peugnet <v.peugnet@free.fr>2019-01-22 02:04:53 +0100
commit695908c7ab2a5d5f011f616d2af3368da7131a6f (patch)
treecbd6c2a43495e77863d3611e2f6b12985b1111d8 /app/class/controllerart.php
parenta8ed9070e7773f3147a33dbee7d45ce24bd8959d (diff)
downloadwcms-695908c7ab2a5d5f011f616d2af3368da7131a6f.tar.gz
wcms-695908c7ab2a5d5f011f616d2af3368da7131a6f.zip
home columns and download function added
Diffstat (limited to 'app/class/controllerart.php')
-rw-r--r--app/class/controllerart.php22
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');