/** * 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 by URL $this->record = FrontendFaqModel::get($this->URL->getParameter(1)); // anything found? if (empty($this->record)) { $this->redirect(FrontendNavigation::getURL(404)); } // overwrite URLs $this->record['category_full_url'] = FrontendNavigation::getURLForBlock('faq', 'category') . '/' . $this->record['category_url']; $this->record['full_url'] = FrontendNavigation::getURLForBlock('faq', 'detail') . '/' . $this->record['url']; // get tags $this->record['tags'] = FrontendTagsModel::getForItem('faq', $this->record['id']); // get settings $this->settings = FrontendModel::getModuleSettings('faq'); // reset allow comments if (!$this->settings['allow_feedback']) { $this->record['allow_feedback'] = false; } // ge status $this->status = $this->URL->getParameter(2); if ($this->status == FL::getAction('Success')) { $this->status = 'success'; } if ($this->status == FL::getAction('Spam')) { $this->status = 'spam'; } }
/** * Get tags for current "page" */ private function getTags() { // get page id $pageId = FrontendPage::getCurrentPageId(); // array of excluded records $this->exclude[] = array('module' => 'pages', 'other_id' => $pageId); // get tags for page $tags = (array) FrontendTagsModel::getForItem('pages', $pageId); foreach ($tags as $tag) { $this->tags = array_merge((array) $this->tags, (array) $tag['name']); } // get page record $record = (array) FrontendNavigation::getPageInfo($pageId); // loop blocks foreach ((array) $record['extra_blocks'] as $block) { // set module class $class = 'Frontend' . SpoonFilter::toCamelCase($block['module']) . 'Model'; // get record for module $record = FrontendTagsModel::callFromInterface($block['module'], $class, 'getIdForTags', $this->URL); // check if record exists if (!$record) { continue; } // add to excluded records $this->exclude[] = array('module' => $block['module'], 'other_id' => $record['id']); // get record's tags $tags = (array) FrontendTagsModel::getForItem($block['module'], $record['id']); foreach ($tags as $tag) { $this->tags = array_merge((array) $this->tags, (array) $tag['name']); } } }