Exemplo n.º 1
0
 /**
  * Get the data
  * If a revision-id was specified in the URL we load the revision and not the actual data.
  */
 private function getData()
 {
     $this->record = (array) BackendBlogModel::get($this->id);
     $this->imageIsAllowed = BackendModel::getModuleSetting($this->URL->getModule(), 'show_image_form', true);
     // is there a revision specified?
     $revisionToLoad = $this->getParameter('revision', 'int');
     // if this is a valid revision
     if ($revisionToLoad !== null) {
         // overwrite the current record
         $this->record = (array) BackendBlogModel::getRevision($this->id, $revisionToLoad);
         // show warning
         $this->tpl->assign('usingRevision', true);
     }
     // is there a revision specified?
     $draftToLoad = $this->getParameter('draft', 'int');
     // if this is a valid revision
     if ($draftToLoad !== null) {
         // overwrite the current record
         $this->record = (array) BackendBlogModel::getRevision($this->id, $draftToLoad);
         // show warning
         $this->tpl->assign('usingDraft', true);
         // assign draft
         $this->tpl->assign('draftId', $draftToLoad);
     }
     // no item found, throw an exceptions, because somebody is f*****g with our URL
     if (empty($this->record)) {
         $this->redirect(BackendModel::createURLForAction('index') . '&error=non-existing');
     }
 }