/** * Execute the extra. */ public function execute() { // get activation key $key = $this->URL->getParameter(0); // load template $this->loadTemplate(); // do we have an activation key? if (isset($key)) { // get profile id $profileId = FrontendProfilesModel::getIdBySetting('activation_key', $key); // have id? if ($profileId != null) { // update status FrontendProfilesModel::update($profileId, array('status' => 'active')); // delete activation key FrontendProfilesModel::deleteSetting($profileId, 'activation_key'); // login profile FrontendProfilesAuthentication::login($profileId); // trigger event FrontendModel::triggerEvent('Profiles', 'after_activate', array('id' => $profileId)); // show success message $this->tpl->assign('activationSuccess', true); } else { // failure $this->redirect(FrontendNavigation::getURL(404)); } } else { $this->redirect(FrontendNavigation::getURL(404)); } }
/** * Execute the action */ public function execute() { parent::execute(); //--Get the id $id = $this->URL->getParameter(1); //--check if the id is not empty if (empty($id)) { $this->redirect(FrontendNavigation::getURL(404)); } //--Explode the id $ids = explode("-", $id); //--check if the id contains 2 elements if (count($ids) != 2) { $this->redirect(FrontendNavigation::getURL(404)); } //--Get the ids and decrypt $send_id = (int) FrontendMailengineModel::decryptId($ids[0]); $user_id = (int) FrontendMailengineModel::decryptId($ids[1]); //--check if the ids are integers if ($send_id <= 0) { $this->redirect(FrontendNavigation::getURL(404)); } if ($user_id > 0) { $data = array(); $data["send_id"] = $send_id; $data["user_id"] = $user_id; //--Add open-mail to the database FrontendMailengineModel::insertMailOpen($data); } //--Create an empty image $this->createImage(); //--Stop the script die; }
/** * Load the data, don't forget to validate the incoming data */ private function getData() { // requested page $requestedPage = $this->URL->getParameter('page', 'int', 1); $this->firstName = Cookie::get('fname'); $this->catalogUrl = FrontendNavigation::getURLForBlock('Catalog'); }
/** * Load the data */ private function loadData() { // get the current page id $pageId = $this->getContainer()->get('page')->getId(); $navigation = FrontendNavigation::getNavigation(); $pageInfo = FrontendNavigation::getPageInfo($pageId); $this->navigation = array(); if (isset($navigation['page'][$pageInfo['parent_id']])) { $pages = $navigation['page'][$pageInfo['parent_id']]; // store $pagesPrev = $pages; $pagesNext = $pages; // check for current id foreach ($pagesNext as $key => $value) { if ((int) $key != (int) $pageId) { // go to next pointer in array next($pagesNext); next($pagesPrev); } else { break; } } // get previous page $this->navigation['previous'] = prev($pagesPrev); // get next page $this->navigation['next'] = next($pagesNext); // get parent page $this->navigation['parent'] = FrontendNavigation::getPageInfo($pageInfo['parent_id']); } }
/** * 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 = $this->get('fork.settings')->getForModule('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'; } }
/** * 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)); } // fetch record $this->record = FrontendTagsModel::get($this->URL->getParameter(1)); // validate record if (empty($this->record)) { $this->redirect(FrontendNavigation::getURL(404)); } // fetch modules $this->modules = FrontendTagsModel::getModulesForTag($this->record['id']); // loop modules foreach ($this->modules as $module) { // get the ids of the items linked to the tag $otherIds = (array) $this->get('database')->getColumn('SELECT other_id FROM modules_tags WHERE module = ? AND tag_id = ?', array($module, $this->record['id'])); // set module class $class = 'Frontend\\Modules\\' . $module . '\\Engine\\Model'; // get the items that are linked to the tags $items = (array) FrontendTagsModel::callFromInterface($module, $class, 'getForTags', $otherIds); // add into results array if (!empty($items)) { $this->results[] = array('name' => $module, 'label' => FL::lbl(\SpoonFilter::ucfirst($module)), 'items' => $items); } } }
/** * Parse */ private function parse() { // get categories $categories = FrontendCatalogModel::getAllCategories(); $count = 0; // any categories? if (!empty($categories)) { // build link $link = FrontendNavigation::getURLForBlock('Catalog', 'Category'); // loop and reset url foreach ($categories as $key => &$row) { if ($row['parent_id'] > 0 || $count >= 4) { unset($categories[$key]); continue; } //--Create url $row['url'] = $link . '/' . $row['url']; //--Get image $row['image'] = FrontendMediaHelper::getFromModule('Catalog', $row['id'], 0, 1, 'category'); //--add count $count++; } } // assign comments $this->tpl->assign('categories', $categories); }
/** * Execute the action */ public function execute() { // call parent, this will probably add some general CSS/JS or other required files parent::execute(); // get parameters $charset = $this->getContainer()->getParameter('kernel.charset'); $searchTerm = \SpoonFilter::getPostValue('term', null, ''); $term = $charset == 'utf-8' ? \SpoonFilter::htmlspecialchars($searchTerm) : \SpoonFilter::htmlentities($searchTerm); $limit = (int) $this->get('fork.settings')->get('Search', 'autocomplete_num_items', 10); // validate if ($term == '') { $this->output(self::BAD_REQUEST, null, 'term-parameter is missing.'); } else { // get matches $matches = FrontendSearchModel::getStartsWith($term, FRONTEND_LANGUAGE, $limit); // get search url $url = FrontendNavigation::getURLForBlock('Search'); // loop items and set search url foreach ($matches as &$match) { $match['url'] = $url . '?form=search&q=' . $match['term']; } // output $this->output(self::OK, $matches); } }
public static function getAlbumsForOverview() { $return = (array) FrontendModel::getContainer()->get('database')->getRecords(' SELECT i.*, m.url, m.data AS meta_data FROM gallery_albums AS i INNER JOIN meta AS m ON m.id = i.meta_id WHERE i.language = ? AND show_in_overview = ? ORDER BY sequence ASC', array(FRONTEND_LANGUAGE, 'Y')); if (!empty($return)) { //--Get link for the categories $albumLink = FrontendNavigation::getURLForBlock('Gallery', 'Detail'); foreach ($return as &$row) { //--Create url $row['full_url'] = $albumLink . '/' . $row['url']; //-- Unserialize if (isset($row['meta_data'])) { $row['meta_data'] = @unserialize($row['meta_data']); } $image = self::getImagesForAlbum($row['id'], 1); if (!empty($image)) { foreach ($image as $rowImage) { $row['image'] = $rowImage; } } } } return $return; }
/** * Load the data, don't forget to validate the incoming data */ private function getData() { // requested page $requestedPage = $this->URL->getParameter('page', 'int', 1); // set URL and limit $this->pagination['url'] = FrontendNavigation::getURLForBlock('catalog'); $this->pagination['limit'] = FrontendModel::getModuleSetting('catalog', 'overview_num_items', 10); // populate count fields in pagination $this->pagination['num_items'] = FrontendCatalogModel::getAllCount(); $this->pagination['num_pages'] = (int) ceil($this->pagination['num_items'] / $this->pagination['limit']); // num pages is always equal to at least 1 if ($this->pagination['num_pages'] == 0) { $this->pagination['num_pages'] = 1; } // redirect if the request page doesn't exist if ($requestedPage > $this->pagination['num_pages'] || $requestedPage < 1) { $this->redirect(FrontendNavigation::getURL(404)); } // populate calculated fields in pagination $this->pagination['requested_page'] = $requestedPage; $this->pagination['offset'] = $this->pagination['requested_page'] * $this->pagination['limit'] - $this->pagination['limit']; // get all categories $this->categories = FrontendCatalogModel::getAllCategories(); // get tree of all categories $this->categoriesTree = FrontendCatalogModel::getCategoriesTree(); // get all products $this->products = FrontendCatalogModel::getAll($this->pagination['limit'], $this->pagination['offset']); }
/** * Execute the extra * * @return void */ public function execute() { parent::execute(); // Define email from the subscribe widget $email = $this->getEmail(); // Create the form $form = $this->createForm($this->get('mailmotor.form.subscription'), new Subscription($email, FRONTEND_LANGUAGE)); $form->handleRequest($this->get('request')); if (!$form->isValid()) { $this->tpl->assign('form', $form->createView()); if ($form->isSubmitted()) { $this->tpl->assign('mailmotorSubscribeHasFormError', true); } $this->loadTemplate(); $this->parse(); return; } $redirectLink = FrontendNavigation::getURLForBlock('Mailmotor', 'Subscribe') . '?subscribed=true'; /** @var Subscription $subscription */ $subscription = $form->getData(); try { // The command bus will handle the unsubscription $this->get('command_bus')->handle($subscription); } catch (NotImplementedException $e) { // fallback for when no mail-engine is chosen in the Backend $this->get('event_dispatcher')->dispatch(NotImplementedSubscribedEvent::EVENT_NAME, new NotImplementedSubscribedEvent($subscription)); $redirectLink .= '&double-opt-in=false'; } $redirectLink .= '#mailmotorSubscribeForm'; return $this->redirect($redirectLink); }
/** * Validate the form */ protected function validateForm() { if ($this->frm->isSubmitted()) { $fields = $this->frm->getFields(); if ($fields['email']->isEmail(FL::err('EmailIsInvalid'))) { } if (FrontendMailengineModel::isSubscribed($fields['email']->getValue())) { $fields['email']->addError(FL::err('AlreadySubscribed')); } if ($this->frm->isCorrect()) { //--Subscribe $id = FrontendMailengineModel::subscribe($fields['email']->getValue()); //--Get the default group $defaultGroup = FrontendModel::getModuleSetting($this->module, 'default_group'); if ($defaultGroup > 0) { $data = array(); $data['user_id'] = $id; $data['group_id'] = $defaultGroup; //--Add user to group FrontendMailengineModel::insertUserToGroup($data); } // redirect $this->redirect(FrontendNavigation::getURLForBlock('Mailengine', 'MailengineSubscribe') . '?sent=true#subscribe'); } } $this->frm->parse($this->tpl); }
/** * Parse the data into the template */ private function parse() { // get vars $title = \SpoonFilter::ucfirst(FL::msg('BlogAllComments')); $link = SITE_URL . FrontendNavigation::getURLForBlock('Blog'); $detailLink = SITE_URL . FrontendNavigation::getURLForBlock('Blog', 'Detail'); $description = null; // create new rss instance $rss = new FrontendRSS($title, $link, $description); // loop articles foreach ($this->items as $item) { // init vars $title = $item['author'] . ' ' . FL::lbl('On') . ' ' . $item['post_title']; $link = $detailLink . '/' . $item['post_url'] . '/#comment-' . $item['id']; $description = $item['text']; // create new instance $rssItem = new FrontendRSSItem($title, $link, $description); // set item properties $rssItem->setPublicationDate($item['created_on']); $rssItem->setAuthor($item['author']); // add item $rss->addItem($rssItem); } $rss->parse(); }
/** * Get the data * * @return void */ private function getData() { // get all galleries $this->items = FrontendSlideshowModel::getGalleries(); // full url assets $this->full_url = FrontendNavigation::getURLForBlock('Slideshow', 'Detail'); $this->full_url_category = FrontendNavigation::getURLForBlock('Slideshow', 'Category'); }
/** * Load the form */ private function loadForm() { $this->frm = new FrontendForm('subscribe', null, null, 'subscribeForm'); $this->frm->setAction(FrontendNavigation::getURLForBlock('Mailmotor', 'Subscribe')); $this->frm->addText('email')->setAttributes(array('required' => null, 'type' => 'email')); $this->frm->parse($this->tpl); $this->tpl->assign('formToken', $this->frm->getToken()); }
/** * Load the data */ protected function loadData() { //--Get the send mailing $this->record = FrontendMailengineModel::getSend($this->id); //--Create iframe $iframe = FrontendNavigation::getURLForBlock('Mailengine', 'MailenginePreview') . "?id=" . $this->id; $this->tpl->assign('iframe', $iframe); }
/** * Execute the extra */ public function execute() { parent::execute(); $this->loadTemplate(); // Check if we're logged in, else redirect to the login form. if (!FrontendProfilesAuthentication::isLoggedIn()) { $queryString = $this->URL->getQueryString(); throw new RedirectException('Redirect', new RedirectResponse(Navigation::getURLForBlock('Profiles', 'Login') . '?queryString=' . $queryString)); } }
/** * Parse */ private function parse() { // get RSS-link $rssTitle = $this->get('fork.settings')->get('Blog', 'rss_title_' . FRONTEND_LANGUAGE); $rssLink = FrontendNavigation::getURLForBlock('Blog', 'Rss'); // add RSS-feed into the metaCustom $this->header->addRssLink($rssTitle, $rssLink); // assign comments $this->tpl->assign('widgetBlogRecentArticlesList', FrontendBlogModel::getAll($this->get('fork.settings')->get('Blog', 'recent_articles_list_num_items', 5))); $this->tpl->assign('widgetBlogRecentArticlesFullRssLink', $rssLink); }
/** * Parse the data into the template */ private function parse() { // get RSS-link $rssLink = FrontendNavigation::getURLForBlock('Blog', 'Rss'); // add RSS-feed $this->header->addLink(array('rel' => 'alternate', 'type' => 'application/rss+xml', 'title' => $this->get('fork.settings')->get('Blog', 'rss_title_' . FRONTEND_LANGUAGE), 'href' => $rssLink), true); // assign articles $this->tpl->assign('items', $this->items); // parse the pagination $this->parsePagination(); }
/** * Parse the data into the template */ private function parse() { // get vars $title = isset($this->settings['rss_title_' . LANGUAGE]) ? $this->settings['rss_title_' . LANGUAGE] : $this->get('fork.settings')->get('Blog', 'rss_title_' . LANGUAGE, SITE_DEFAULT_TITLE); $link = SITE_URL . FrontendNavigation::getURLForBlock('Blog'); $description = isset($this->settings['rss_description_' . LANGUAGE]) ? $this->settings['rss_description_' . LANGUAGE] : null; // create new rss instance $rss = new FrontendRSS($title, $link, $description); // loop articles foreach ($this->items as $item) { // init vars $title = $item['title']; $link = $item['full_url']; $description = $item['introduction'] != '' ? $item['introduction'] : $item['text']; // meta is wanted if ($this->get('fork.settings')->get('Blog', 'rss_meta_' . LANGUAGE, true)) { // append meta $description .= '<div class="meta">' . "\n"; $description .= ' <p><a href="' . $link . '" title="' . $title . '">' . $title . '</a> ' . sprintf(FL::msg('WrittenBy'), FrontendUser::getBackendUser($item['user_id'])->getSetting('nickname')); $description .= ' ' . FL::lbl('In') . ' <a href="' . $item['category_full_url'] . '" title="' . $item['category_title'] . '">' . $item['category_title'] . '</a>.</p>' . "\n"; // any tags if (isset($item['tags'])) { // append tags-paragraph $description .= ' <p>' . \SpoonFilter::ucfirst(FL::lbl('Tags')) . ': '; $first = true; // loop tags foreach ($item['tags'] as $tag) { // prepend separator if (!$first) { $description .= ', '; } // add $description .= '<a href="' . $tag['full_url'] . '" rel="tag" title="' . $tag['name'] . '">' . $tag['name'] . '</a>'; // reset $first = false; } // end $description .= '.</p>' . "\n"; } // end HTML $description .= '</div>' . "\n"; } // create new instance $rssItem = new FrontendRSSItem($title, $link, $description); // set item properties $rssItem->setPublicationDate($item['publish_on']); $rssItem->addCategory($item['category_title']); $rssItem->setAuthor(FrontendUser::getBackendUser($item['user_id'])->getSetting('nickname')); // add item $rss->addItem($rssItem); } // output $rss->parse(); }
protected function redirectLink($link_id) { //--Get the link $link = FrontendMailengineModel::getLink($link_id); //--Check if the link is empty -> redirect 404 if (empty($link)) { $this->redirect(FrontendNavigation::getURL(404)); } //--Redirect $this->redirect($link["url"]); }
/** * Load the data */ protected function loadData() { //--Check the params if ($this->URL->getParameter(0) === null) { $this->redirect(FrontendNavigation::getURL(404), 404); } //--Get record $this->record = FrontendAddressesModel::get($this->URL->getParameter(1)); if (empty($this->record)) { $this->redirect(FrontendNavigation::getURL(404), 307); } }
/** * Execute the extra */ public function execute() { $this->id = $this->URL->getParameter(1); // validate incoming parameters if ($this->id === null) { $this->redirect(FrontendNavigation::getURL(404)); } parent::execute(); $this->loadTemplate(); $this->getData(); $this->parse(); }
/** * Load the form */ private function loadForm() { // don't show the form if someone is logged in if (FrontendProfilesAuthentication::isLoggedIn()) { return; } $this->frm = new FrontendForm('login', FrontendNavigation::getURLForBlock('Profiles', 'Login')); $this->frm->addText('email')->setAttributes(array('required' => null, 'type' => 'email')); $this->frm->addPassword('password')->setAttributes(array('required' => null)); $this->frm->addCheckbox('remember', true); // parse the form $this->frm->parse($this->tpl); }
/** * Execute the action */ public function execute() { parent::execute(); //--Get the id $this->id = \SpoonFilter::getGetValue('id', null, 0, 'int'); //--Check if mailing exist if (!FrontendMailengineModel::extistSend($this->id)) { $this->redirect(FrontendNavigation::getURL(404)); } $this->loadTemplate(); $this->loadData(); $this->parse(); }
/** * 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::getCategory($this->URL->getParameter(1)); // anything found? if (empty($this->record)) { $this->redirect(FrontendNavigation::getURL(404)); } $this->record['full_url'] = FrontendNavigation::getURLForBlock('Faq', 'Category') . '/' . $this->record['url']; $this->questions = FrontendFaqModel::getAllForCategory($this->record['id']); }
/** * Parse */ private function parse() { // get categories $categories = FrontendAgendaModel::getAllCategories(); // any categories? if (!empty($categories)) { // build link $link = FrontendNavigation::getURLForBlock('Agenda', 'Category'); // loop and reset url foreach ($categories as &$row) { $row['url'] = $link . '/' . $row['url']; } } // assign comments $this->tpl->assign('widgetAgendaCategories', $categories); }
/** * Get the data * * @return void */ private function getData() { // check for errors if ($this->URL->getParameter(1) === null) { $this->redirect(FrontendNavigation::getURL(404)); } // get the gallery $this->record = FrontendSlideshowModel::getGalleryByURL($this->URL->getParameter(1)); if (empty($this->record)) { $this->redirect(FrontendNavigation::getURL(404)); } // get image data $this->slides = FrontendSlideshowModel::getImages($this->record['gallery_id']); // get gallery data $this->gallery = FrontendSlideshowModel::getGallery($this->record['gallery_id']); }
/** * Get the data * * @return void */ private function getData() { // check for errors if ($this->URL->getParameter(1) === null) { $this->redirect(FrontendNavigation::getURL(404)); } // get the gallery meta based on the url $this->record = FrontendSlideshowModel::getGalleriesByURL($this->URL->getParameter(1)); // redirect if nothing is found if (empty($this->record)) { $this->redirect(FrontendNavigation::getURL(404)); } // full url asset $this->full_url = FrontendNavigation::getURLForBlock('Slideshow', 'detail'); $this->full_url_category = FrontendNavigation::getURLForBlock('Slideshow', 'category'); }
/** * Execute the extra. */ public function execute() { // only logged in profiles can seer their dashboard if (FrontendProfilesAuthentication::isLoggedIn()) { // call the parent parent::execute(); /* * You could use this as some kind of dashboard where you can show an activity * stream, some statistics, ... */ $this->loadTemplate(); } else { // profile not logged in $this->redirect(FrontendNavigation::getURLForBlock('Profiles', 'Login') . '?queryString=' . FrontendNavigation::getURLForBlock('Profiles'), 307); } }