/** * Load the data, don't forget to validate the incoming data */ private function getData() { // validate incoming parameters if ($this->URL->getParameter(1) === null) { $this->redirect(FrontendNavigation::getURL(404)); } // load revision if ($this->URL->getParameter('revision', 'int') != 0) { // get data $this->record = FrontendBlogModel::getRevision($this->URL->getParameter(1), $this->URL->getParameter('revision', 'int')); // add no-index, so the draft won't get accidentally indexed $this->header->addMetaData(array('name' => 'robots', 'content' => 'noindex, nofollow'), true); } else { $this->record = FrontendBlogModel::get($this->URL->getParameter(1)); } // anything found? if (empty($this->record)) { $this->redirect(FrontendNavigation::getURL(404)); } // get comments $this->comments = FrontendBlogModel::getComments($this->record['id']); // get tags $this->record['tags'] = FrontendTagsModel::getForItem('blog', $this->record['id']); // get settings $this->settings = FrontendModel::getModuleSettings('blog'); // overwrite URLs $this->record['category_full_url'] = FrontendNavigation::getURLForBlock('blog', 'category') . '/' . $this->record['category_url']; $this->record['full_url'] = FrontendNavigation::getURLForBlock('blog', 'detail') . '/' . $this->record['url']; $this->record['allow_comments'] = $this->record['allow_comments'] == 'Y'; $this->record['comments_count'] = count($this->comments); // reset allow comments if (!$this->settings['allow_comments']) { $this->record['allow_comments'] = false; } }
/** * Load the data, don't forget to validate the incoming data */ private function getData() { // validate incoming parameters if ($this->URL->getParameter(1) === null) { $this->redirect(FrontendNavigation::getURL(404)); } // get record $this->record = FrontendBlogModel::get($this->URL->getParameter(1)); // anything found? if (empty($this->record)) { $this->redirect(FrontendNavigation::getURL(404)); } // get articles $this->items = FrontendBlogModel::getComments($this->record['id']); }