/** * Execute the action. */ public function execute() { parent::execute(); $this->setFilter(); $this->setItems(); $this->createXML(); }
/** * Parse the correct messages into the template */ protected function parse() { parent::parse(); // grab the error-type from the parameters $errorType = $this->getParameter('type'); // set correct headers switch ($errorType) { case 'module-not-allowed': case 'action-not-allowed': $this->statusCode = Response::HTTP_FORBIDDEN; break; case 'not-found': $this->statusCode = Response::HTTP_NOT_FOUND; break; default: $this->statusCode = Response::HTTP_BAD_REQUEST; break; } // querystring provided? if ($this->getParameter('querystring') !== null) { // split into file and parameters $chunks = explode('?', $this->getParameter('querystring')); // get extension $extension = pathinfo($chunks[0], PATHINFO_EXTENSION); // if the file has an extension it is a non-existing-file if ($extension != '' && $extension != $chunks[0]) { // give a nice error, so we can detect which file is missing throw new ExitException('File not found', 'Requested file (' . htmlspecialchars($this->getParameter('querystring')) . ') not found.', Response::HTTP_NOT_FOUND); } } // assign the correct message into the template $this->tpl->assign('message', BL::err(\SpoonFilter::toCamelCase(htmlspecialchars($errorType), '-'))); }
/** * Parse & display the page */ protected function parse() { parent::parse(); $this->tpl->assign('dataGrid', (string) $this->dataGrid->getContent()); // check if this action is allowed $this->tpl->assign('allowFaqAddCategory', $this->multipleCategoriesAllowed); }
/** * Parse the correct messages into the template */ protected function parse() { parent::parse(); // grab the error-type from the parameters $errorType = $this->getParameter('type'); // set correct headers switch ($errorType) { case 'module-not-allowed': case 'action-not-allowed': header('HTTP/1.1 403 Forbidden'); break; case 'not-found': header('HTTP/1.1 404 Not Found'); break; } // querystring provided? if ($this->getParameter('querystring') !== null) { // split into file and parameters $chunks = explode('?', $this->getParameter('querystring')); // get extension $extension = pathinfo($chunks[0], PATHINFO_EXTENSION); // if the file has an extension it is a non-existing-file if ($extension != '' && $extension != $chunks[0]) { // set correct headers header('HTTP/1.1 404 Not Found'); // give a nice error, so we can detect which file is missing echo 'Requested file (' . htmlspecialchars($this->getParameter('querystring')) . ') not found.'; // stop script execution exit; } } // assign the correct message into the template $this->tpl->assign('message', BL::err(\SpoonFilter::toCamelCase(htmlspecialchars($errorType), '-'))); }
/** * Execute the action */ public function execute() { parent::execute(); $this->loadDataGrid(); $this->parse(); $this->display(); }
/** * Parse */ protected function parse() { parent::parse(); // form info $this->tpl->assign('name', $this->record['name']); $this->tpl->assign('formId', $this->record['id']); // sent info $this->tpl->assign('id', $this->data['id']); $this->tpl->assign('sentOn', $this->data['sent_on']); // init $data = array(); // prepare data foreach ($this->data['fields'] as $field) { // implode arrays if (is_array($field['value'])) { $field['value'] = implode(', ', $field['value']); } else { // new lines to line breaks $field['value'] = nl2br($field['value']); } // add to data $data[] = $field; } // assign $this->tpl->assign('data', $data); $this->tpl->assign('filter', $this->filter); }
/** * Parse the action into the template */ public function parse() { parent::parse(); // assign the interface language ourself, because it won't be assigned automagically $this->tpl->assign('INTERFACE_LANGUAGE', BL::getInterfaceLanguage()); $this->frm->parse($this->tpl); $this->frmForgotPassword->parse($this->tpl); }
/** * Parse the dataGrids and the reports */ protected function parse() { parent::parse(); // parse dataGrids if (!empty($this->dataGrids)) { $this->tpl->assign('dataGrids', $this->dataGrids); } $this->tpl->assign('emptyDatagrid', $this->emptyDatagrid->getContent()); }
/** * Parse & display the page */ protected function parse() { parent::parse(); $this->tpl->assign('dataGrid', $this->dataGrid->getNumResults() != 0 ? $this->dataGrid->getContent() : false); // check if this action is allowed if (BackendAuthentication::isAllowedAction('AddCategory') && $this->multipleCategoriesAllowed) { $this->tpl->assign('showAgendaAddCategory', true); } else { $this->tpl->assign('showAgendaAddCategory', false); } }
/** * Execute the action * * @return void */ public function execute() { // call parent, this will probably add some general CSS/JS or other required files parent::execute(); // load the datagrids $this->loadDataGrids(); // parse the datagrids $this->parse(); // display the page $this->display(); }
protected function parse() { parent::parse(); $this->form->parse($this->tpl); if ($this->get('fork.settings')->get($this->getModule(), 'web_property_id')) { $this->tpl->assign('web_property_id', $this->get('fork.settings')->get($this->getModule(), 'web_property_id')); } if ($this->get('fork.settings')->get($this->getModule(), 'profile')) { $this->tpl->assign('profile', $this->get('fork.settings')->get($this->getModule(), 'profile')); } }
/** * Execute the action */ public function execute() { $this->id = $this->getParameter('product_id', 'int'); if ($this->id !== null && BackendCatalogModel::exists($this->id)) { parent::execute(); $this->getData(); $this->loadDataGridImages(); $this->loadDataGridFiles(); $this->loadDataGridVideos(); $this->parse(); $this->display(); } else { $this->redirect(BackendModel::createURLForAction('index') . '&error=non-existing'); } }
protected function parse() { parent::parse(); // if we don't have a token anymore, redirect to the settings page if ($this->get('fork.settings')->get($this->getModule(), 'certificate') === null || $this->get('fork.settings')->get($this->getModule(), 'account') === null || $this->get('fork.settings')->get($this->getModule(), 'web_property_id') === null || $this->get('fork.settings')->get($this->getModule(), 'profile') === null) { $this->redirect(Model::createURLForAction('Settings')); } $this->header->addJS('highcharts.js', 'Core', false); $analytics = $this->get('analytics.connector'); $analyticsTemplateToFunctionMap = ['page_views' => 'getPageViews', 'visitors' => 'getVisitors', 'pages_per_visit' => 'getPagesPerVisit', 'time_on_site' => 'getTimeOnSite', 'new_sessions_percentage' => 'getNewSessionsPercentage', 'bounce_rate' => 'getBounceRate', 'visitors_graph_data' => 'getVisitorsGraphData', 'source_graph_data' => 'getSourceGraphData']; foreach ($analyticsTemplateToFunctionMap as $templateVariableName => $functionName) { $this->tpl->assign($templateVariableName, $analytics->{$functionName}($this->dateRange->getStartDate(), $this->dateRange->getEndDate())); } $dataGrid = new DataGridArray($analytics->getMostVisitedPagesData($this->dateRange->getStartDate(), $this->dateRange->getEndDate())); $this->tpl->assign('dataGridMostViewedPages', (string) $dataGrid->getContent()); }
public function execute() { parent::execute(); $settingsForm = new SettingsType('settings', $this->get('fork.settings'), $this->get('analytics.google_analytics_service')); if ($settingsForm->handle()) { $this->redirect(Model::createURLForAction('Settings')); } $settingsForm->parse($this->tpl); if ($this->get('fork.settings')->get($this->getModule(), 'web_property_id')) { $this->tpl->assign('web_property_id', $this->get('fork.settings')->get($this->getModule(), 'web_property_id')); } if ($this->get('fork.settings')->get($this->getModule(), 'profile')) { $this->tpl->assign('profile', $this->get('fork.settings')->get($this->getModule(), 'profile')); } $this->display(); }
/** * Execute */ public function execute() { parent::execute(); $form = $this->createForm($this->get('mailmotor.form.settings'), new SaveSettings($this->get('fork.settings'))); $form->handleRequest($this->get('request')); if (!$form->isValid()) { $this->tpl->assign('form', $form->createView()); $this->parse(); $this->display(); return; } /** @var SaveSettings $settings */ $settings = $form->getData(); // The command bus will handle the saving of the settings in the database. $this->get('command_bus')->handle($settings); $this->get('event_dispatcher')->dispatch(SettingsSavedEvent::EVENT_NAME, new SettingsSavedEvent($settings)); return $this->redirect(Model::createURLForAction('Settings', null, null, ['report' => 'saved'])); }
/** * Execute the action */ public function execute() { // call parent, this will probably add some general CSS/JS or other required files parent::execute(); // get parameters $this->from = $this->getParameter('from'); $this->to = $this->getParameter('to'); // validate if ($this->from == '') { throw new BackendException('Specify a from-parameter.'); } if ($this->to == '') { throw new BackendException('Specify a to-parameter.'); } // copy pages BackendPagesModel::copy($this->from, $this->to); // redirect $this->redirect(BackendModel::createURLForAction('Index') . '&report=copy-added&var=' . urlencode($this->to)); }
/** * Execute the action */ public function execute() { parent::execute(); $this->categoryId = \SpoonFilter::getGetValue('category', null, null, 'int'); if ($this->categoryId == 0) { $this->categoryId = null; } else { // get category $this->category = BackendCatalogModel::getCategory($this->categoryId); // reset if (empty($this->category)) { // reset GET to trick Spoon $_GET['category'] = null; // reset $this->categoryId = null; } } $this->loadDataGrid(); $this->parse(); $this->display(); }
/** * Execute the action. */ public function execute() { // get parameters $this->currentModule = $this->getParameter('module', 'string'); // does the item exist if ($this->currentModule !== null && BackendExtensionsModel::existsModule($this->currentModule)) { // call parent, this will probably add some general CSS/JS or other required files parent::execute(); // make sure this module can be installed $this->validateInstall(); // do the actual install BackendExtensionsModel::installModule($this->currentModule); // remove our container cache after this request $filesystem = new Filesystem(); $filesystem->remove($this->getContainer()->getParameter('kernel.cache_dir')); // redirect to index with a success message $this->redirect(BackendModel::createURLForAction('Modules') . '&report=module-installed&var=' . $this->currentModule . '&highlight=row-module_' . $this->currentModule); } else { // no item found, redirect to index, because somebody is f*****g with our url $this->redirect(BackendModel::createURLForAction('Modules') . '&error=non-existing'); } }
protected function parse() { parent::parse(); $this->header->addJS('highcharts.js', 'Core', false); $this->form->parse($this->tpl); $this->tpl->assign('startTimestamp', $this->startDate); $this->tpl->assign('endTimestamp', $this->endDate); // if we don't have a token anymore, redirect to the settings page if ($this->get('fork.settings')->get($this->getModule(), 'certificate') === null || $this->get('fork.settings')->get($this->getModule(), 'account') === null || $this->get('fork.settings')->get($this->getModule(), 'web_property_id') === null || $this->get('fork.settings')->get($this->getModule(), 'profile') === null) { $this->redirect(Model::createURLForAction('Settings')); } $analytics = $this->get('analytics.connector'); $this->tpl->assign('page_views', $analytics->getPageViews($this->startDate, $this->endDate)); $this->tpl->assign('visitors', $analytics->getVisitors($this->startDate, $this->endDate)); $this->tpl->assign('pages_per_visit', $analytics->getPagesPerVisit($this->startDate, $this->endDate)); $this->tpl->assign('time_on_site', $analytics->getTimeOnSite($this->startDate, $this->endDate)); $this->tpl->assign('new_sessions_percentage', $analytics->getNewSessionsPercentage($this->startDate, $this->endDate)); $this->tpl->assign('bounce_rate', $analytics->getBounceRate($this->startDate, $this->endDate)); $this->tpl->assign('visitors_graph_data', $analytics->getVisitorsGraphData($this->startDate, $this->endDate)); $this->tpl->assign('source_graph_data', $analytics->getSourceGraphData($this->startDate, $this->endDate)); $dataGrid = new DataGridArray($analytics->getMostVisitedPagesData($this->startDate, $this->endDate)); $this->tpl->assign('dataGridMostViewedPages', (string) $dataGrid->getContent()); }
/** * Execute the action. */ public function execute() { // get parameters $this->currentTheme = $this->getParameter('theme', 'string'); // does the item exist if ($this->currentTheme !== null && BackendExtensionsModel::existsTheme($this->currentTheme)) { // call parent, this will probably add some general CSS/JS or other required files parent::execute(); // make sure this theme can be installed $this->validateInstall(); try { // do the actual install BackendExtensionsModel::installTheme($this->currentTheme); // redirect to index with a success message $this->redirect(BackendModel::createURLForAction('Themes') . '&report=theme-installed&var=' . $this->currentTheme); } catch (Exception $e) { // redirect to index with a success message $this->redirect(BackendModel::createURLForAction('Themes') . '&report=information-file-is-empty&var=' . $this->currentTheme); } } else { // no item found, redirect to index, because somebody is f*****g with our url $this->redirect(BackendModel::createURLForAction('Themes') . '&error=non-existing'); } }
/** * Parse the datagrids and the reports. */ protected function parse() { parent::parse(); // parse data grid $this->tpl->assign('dataGridInstallableModules', (string) $this->dataGridInstallableModules->getContent()); $this->tpl->assign('dataGridInstalledModules', (string) $this->dataGridInstalledModules->getContent()); // parse installer warnings $this->tpl->assign('warnings', (array) \SpoonSession::get('installer_warnings')); }
/** * Parse & display the page */ protected function parse() { parent::parse(); // parse datagrids $this->tpl->assign('dgLabels', $this->dgLabels->getNumResults() != 0 ? $this->dgLabels->getContent() : false); $this->tpl->assign('dgMessages', $this->dgMessages->getNumResults() != 0 ? $this->dgMessages->getContent() : false); $this->tpl->assign('dgErrors', $this->dgErrors->getNumResults() != 0 ? $this->dgErrors->getContent() : false); $this->tpl->assign('dgActions', $this->dgActions->getNumResults() != 0 ? $this->dgActions->getContent() : false); // is filtered? if ($this->getParameter('form', 'string', '') == 'filter') { $this->tpl->assign('filter', true); } // parse filter as query $this->tpl->assign('filter', $this->filterQuery); // parse isGod $this->tpl->assign('isGod', $this->isGod); // parse noItems, if all the datagrids are empty $this->tpl->assign('noItems', $this->dgLabels->getNumResults() == 0 && $this->dgMessages->getNumResults() == 0 && $this->dgErrors->getNumResults() == 0 && $this->dgActions->getNumResults() == 0); $this->tpl->assign('hasSubmissions', $this->hasSubmissions); // parse the add URL $this->tpl->assign('addURL', BackendModel::createURLForAction('Add', null, null, null) . $this->filterQuery); }
/** * Parse the datagrid and the reports */ protected function parse() { parent::parse(); // datagrid $this->tpl->assign('dataGrid', $this->dataGrid->getNumResults() != 0 ? $this->dataGrid->getContent() : false); // form info $this->tpl->assign('name', $this->record['name']); $this->tpl->assign('id', $this->record['id']); $this->tpl->assignArray($this->filter); }
/** * Parse the form */ protected function parse() { parent::parse(); // show options if ($this->needsAkismet) { $this->tpl->assign('needsAkismet', true); } if ($this->needsGoogleMaps) { $this->tpl->assign('needsGoogleMaps', true); } // parse the form $this->frm->parse($this->tpl); // parse the warnings $this->parseWarnings(); }
/** * Parse the form */ protected function parse() { parent::parse(); $this->frm->parse($this->tpl); }
/** * Parse & display the page */ protected function parse() { parent::parse(); $this->tpl->assign('dataGrid', (string) $this->dataGrid->getContent()); }
/** * Parse & display the page */ protected function parse() { parent::parse(); // moderation DataGrid and num results $this->tpl->assign('dgModeration', $this->dgModeration->getNumResults() != 0 ? $this->dgModeration->getContent() : false); $this->tpl->assign('numModeration', $this->dgModeration->getNumResults()); // spam DataGrid and num results $this->tpl->assign('dgSubscribed', $this->dgSubscribed->getNumResults() != 0 ? $this->dgSubscribed->getContent() : false); $this->tpl->assign('numSubscriptions', $this->dgSubscribed->getNumResults()); }
/** * Parse & display the page */ protected function parse() { parent::parse(); // assign the datagrid $this->tpl->assign('dataGrid', $this->dataGrid->getNumResults() != 0 ? $this->dataGrid->getContent() : false); }
public function execute() { parent::execute(); $txtText = \SpoonFile::getContent(BACKEND_MODULE_PATH . "/meubelwinkels.txt"); $arrText = explode("\n", $txtText); $strShop = ""; $arrShops = array(); $arrShopsFinal = array(); $arrElements = array("company", "phone", "zipcode", "city", "address", "contact", "email", "website", "fax", "vat", "assort", "m�", "open", "gesloten", "visit"); $arrElementsDash = array("assort", "m�", "open", "gesloten", "visit"); foreach ($arrText as $line) { //--Check if the line is only a zipcode or pagenumbers (1000 or 52 53) if (preg_match("/^\\d+\$/", $line) || preg_match("/^[0-9 ]+\$/", $line)) { continue; } //--Search for T : in the line (this is the first line of the address) if (strpos($line, "T :") !== false) { //--If line is not empty, add it to the array if (!empty($strShop)) { $arrShops[] = $strShop; } $strShop = ""; } //--Add the line + add a marker [LINE] $strShop .= $line . "[LINE]"; } //--Loop all the shops foreach ($arrShops as $shop) { //--Explode the shop with [LINE] $arrShop = explode("[LINE]", $shop); $arrShopFinal = array(); //--Get the phone number and name of the shop $strPosTelephone = strpos($arrShop[0], "T :"); //--Create array $arrShopFinal["company"] = ucwords(mb_strtolower(substr($arrShop[0], 0, $strPosTelephone))); $arrShopFinal["phone"] = trim(str_replace("T :", "", substr($arrShop[0], $strPosTelephone))); //--Get the address $strAddress = ucwords(mb_strtolower($arrShop[1])); //--Get position of the space $strPosSpaceZipcode = strpos($strAddress, " "); //--Add the zipcode $arrShopFinal["zipcode"] = substr($strAddress, 0, $strPosSpaceZipcode); //--Alter the address-string $strAddress = substr($strAddress, $strPosSpaceZipcode); //--Search comma $strPosCommaCity = strpos($strAddress, ","); //--Add the city $arrShopFinal["city"] = substr($strAddress, 0, $strPosCommaCity); //--Add the address $arrShopFinal["address"] = trim(substr($strAddress, $strPosCommaCity + 1)); //--Unset first and second item unset($arrShop[0]); unset($arrShop[1]); //--Loop the shop foreach ($arrShop as $key => $row) { //--Get the contact if (!isset($arrShopFinal["contact"]) && strpos($row, "contact:") !== false) { $arrShopFinal["contact"] = ucwords(mb_strtolower(trim(substr($row, 8)))); } //--Find the e-mailaddress in the string if (!isset($arrShopFinal["email"])) { preg_match("/[_a-z0-9-]+(\\.[_a-z0-9-]+)*@[a-z0-9-]+(\\.[a-z0-9-]+)*(\\.[a-z]{2,3})/i", $row, $matches); if (!empty($matches)) { $arrShopFinal["email"] = $matches[0]; } } //--Find the website address if (!isset($arrShopFinal["website"])) { preg_match("/www\\.[a-zA-Z0-9-]+\\.[a-z]{2,7}/i", $row, $matches); if (!empty($matches)) { $arrShopFinal["website"] = $matches[0]; } } //--Find the fax if (!isset($arrShopFinal["fax"])) { preg_match("/F: ([\\s0-9]+)/i", $row, $matches); if (!empty($matches)) { $arrShopFinal["fax"] = $matches[1]; } } //--Find the VAT if (!isset($arrShopFinal["btw"])) { preg_match("/BTW : ([A-Z]{2}[\\s]*[0-9-\\.\\s]+)/i", $row, $matches); if (!empty($matches)) { $arrShopFinal["vat"] = $matches[1]; } } //--Check if the dash is for a numeric value (not - assort:) preg_match("/([0-9]{1}[\\s]-[\\s][0-9]{1})/i", $row, $matches); if (!empty($matches)) { foreach ($matches as $match) { $strMatchReplace = str_replace(" - ", "-", $match); $row = str_replace($match, $strMatchReplace, $row); } } //--Split the text with " - "; $arrDashes = explode(" - ", $row); //--Check if there are elements if (!empty($arrDashes)) { //--Loop the different pieces foreach ($arrDashes as $dash) { //--Loop the elements that are possible for the dash-element foreach ($arrElementsDash as $element) { //--Check if the element is found, if true, add the element to the array if (strpos($dash, $element . ":") !== false) { $arrShopFinal[$element] = str_replace($element . ":", "", $dash); } } } } } //--Check if all elements are filled in foreach ($arrElements as $element) { //--If key not exists, add an empty value to it if (!isset($arrShopFinal[$element])) { //--Fill in empty value $arrShopFinal[$element] = ""; } else { //--Replace to utf8 $arrShopFinal[$element] = trim($arrShopFinal[$element]); //--Replace ? to ' $arrShopFinal[$element] = str_replace("?", "'", $arrShopFinal[$element]); } } //--Replace m� by size (for the database) $arrShopFinal["size"] = $arrShopFinal["m�"]; unset($arrShopFinal["m�"]); //--Replace gesloten by closed (for the database) $arrShopFinal["closed"] = $arrShopFinal["gesloten"]; unset($arrShopFinal["gesloten"]); $arrShopFinal["country"] = substr($arrShopFinal["vat"], 0, 2); $arrShopFinal["country"] = $arrShopFinal["country"] == "" ? "BE" : $arrShopFinal["country"]; //--Add final shop to all shops $arrShopsFinal[] = $arrShopFinal; } print "<pre>"; //--Loop all the shops foreach ($arrShopsFinal as $row) { $arrId = (array) BackendModel::getContainer()->get('database')->getVar('SELECT i.id FROM addresses AS i WHERE i.email = ? AND i.address = ? ', array($row['email'], $row['address'])); $id = (int) $arrId[0]; if ($id > 0) { $arrUpdate = array("contact" => $row['contact']); BackendModel::getContainer()->get('database')->update('addresses', $arrUpdate, 'id = ?', (int) $id); } else { echo $id; print_r($row); } } die; }
/** * Parse the page with its widgets. */ protected function parse() { parent::parse(); // show report if ($this->getParameter('password_reset') == 'success') { $this->tpl->assign('reportMessage', BL::msg('PasswordResetSuccess', 'core')); $this->tpl->assign('report', true); } // assign $this->tpl->assign('leftColumn', $this->widgets['left']); $this->tpl->assign('middleColumn', $this->widgets['middle']); $this->tpl->assign('rightColumn', $this->widgets['right']); }