aboutsummaryrefslogtreecommitdiff
path: root/app/class/controllerart.php
diff options
context:
space:
mode:
authorvincent-peugnet <v.peugnet@free.fr>2019-03-30 20:44:55 +0100
committervincent-peugnet <v.peugnet@free.fr>2019-03-30 20:44:55 +0100
commit20c44426207b8f58fd8ef1145b509913371b2901 (patch)
tree0ce6c9f06e8cca59f5159f2dfaeccf99b896712f /app/class/controllerart.php
parent60e065fd24d7cd03fa2ebc6cea55d463bc735120 (diff)
downloadwcms-20c44426207b8f58fd8ef1145b509913371b2901.tar.gz
wcms-20c44426207b8f58fd8ef1145b509913371b2901.zip
new feature : upload json as page
Diffstat (limited to 'app/class/controllerart.php')
-rw-r--r--app/class/controllerart.php23
1 files changed, 23 insertions, 0 deletions
diff --git a/app/class/controllerart.php b/app/class/controllerart.php
index 4d7b1be..ce742a1 100644
--- a/app/class/controllerart.php
+++ b/app/class/controllerart.php
@@ -241,6 +241,29 @@ class Controllerart extends Controller
}
}
+ /**
+ * Import page and save it into the database
+ */
+ public function upload()
+ {
+ $art = $this->artmanager->getfromfile();
+
+ if(!empty($_POST['id'])) {
+ $art->setid(idclean($_POST['id']));
+ }
+
+ if($_POST['datecreation']) {
+ $art->setdatecreation($this->now);
+ }
+
+ if($art !== false) {
+ if($_POST['erase'] || $this->artmanager->get($art) === false) {
+ $this->artmanager->add($art);
+ }
+ }
+ $this->routedirect('home');
+ }
+
public function delete($id)
{
$this->setart($id, 'artdelete');