diff options
Diffstat (limited to 'app/class/Controllerpage.php')
-rw-r--r-- | app/class/Controllerpage.php | 36 |
1 files changed, 21 insertions, 15 deletions
diff --git a/app/class/Controllerpage.php b/app/class/Controllerpage.php index 909a2c2..990f0b7 100644 --- a/app/class/Controllerpage.php +++ b/app/class/Controllerpage.php @@ -279,25 +279,31 @@ class Controllerpage extends Controller { $page = $this->pagemanager->getfromfile(); + if($page !== false) { - if(!empty($_POST['id'])) { - $page->setid(idclean($_POST['id'])); - } - - if($_POST['datecreation']) { - $page->setdatecreation($this->now); - } - - if($_POST['author']) { - $page->setauthors([$this->user->id()]); - } - - $page->setdaterender($page->datecreation('date')); + if(!empty($_POST['id'])) { + $page->setid(idclean($_POST['id'])); + } + + if($_POST['datecreation']) { + $page->setdatecreation($this->now); + } + + if($_POST['author']) { + $page->setauthors([$this->user->id()]); + } + + $page->setdaterender($page->datecreation('date')); - if($page !== false) { if($_POST['erase'] || $this->pagemanager->get($page) === false) { - $this->pagemanager->add($page); + if($this->pagemanager->add($page)) { + Model::sendflashmessage('Page successfully uploaded', 'success'); + } + } else { + Model::sendflashmessage('Page ID already exist, check remplace if you want to erase it', 'warning'); } + } else { + Model::sendflashmessage('Error while importing page JSON', 'error'); } $this->routedirect('home'); } |