/** * This method exists because the service container needs to be set before * the page's functionality gets loaded. */ public function initialize() { $url = new Url($this->getKernel()); new TwigTemplate(); new Navigation($this->getKernel()); new Header($this->getKernel()); $this->action = new Action($this->getKernel()); $this->action->setModule($url->getModule()); $this->action->setAction($url->getAction()); }
/** * Execute the action */ public function execute() { parent::execute(); // action to execute $action = \SpoonFilter::getGetValue('action', array('delete', 'export'), ''); $this->groupId = \SpoonFilter::getGetValue('group_id', null, ''); // no id's provided if (!$action) { $this->redirect(BackendModel::createURLForAction('Addresses') . '&error=no-action-selected'); } if (!isset($_GET['emails'])) { $this->redirect(BackendModel::createURLForAction('Addresses') . '&error=no-items-selected'); } else { // redefine id's $this->emails = (array) $_GET['emails']; // evaluate $action, see what action was triggered switch ($action) { case 'delete': $this->deleteAddresses(); break; case 'export': $this->exportAddresses(); break; } } }
/** * Execute the action */ public function execute() { parent::execute(); // action to execute $action = SpoonFilter::getGetValue('action', array('deleteImages', 'deleteFiles', 'deleteVideos'), 'delete'); if (!isset($_GET['id'])) { $this->redirect(BackendModel::createURLForAction('index') . '&error=no-selection'); } else { // redefine id's $aIds = (array) $_GET['id']; $agendaID = (int) $_GET['agenda_id']; // delete media if ($action == 'deleteImages') { BackendAgendaModel::deleteImage($aIds); } else { if ($action == 'deleteFiles') { BackendAgendaModel::deleteFile($aIds); } else { if ($action == 'deleteVideos') { BackendAgendaModel::deleteVideo($aIds); } } } } $this->redirect(BackendModel::createURLForAction('media') . '&agenda_id=' . $agendaID . '&report=deleted'); }
/** * Execute the action */ public function execute() { // If step 1 isn't entered, redirect back to the first step of the wizard $this->record = \SpoonSession::get('module'); if (!$this->record || !array_key_exists('title', $this->record)) { $this->redirect(Model::createURLForAction('Add')); } // If there are no fields added, redirect back to the second step of the wizard if (!array_key_exists('fields', $this->record) || empty($this->record['fields'])) { $this->redirect(Model::createURLForAction('AddStep2')); } parent::execute(); // initialize some variables $this->backendPath = BACKEND_MODULES_PATH . '/' . $this->record['camel_case_name'] . '/'; $this->frontendPath = FRONTEND_MODULES_PATH . '/' . $this->record['camel_case_name'] . '/'; $this->variables = (array) $this->record; unset($this->variables['fields']); $this->generateFolders(); $this->generateBaseFiles(); $this->generateInstallerFiles(); // Backend $this->generateBackendFiles(); $this->generateBackendModel(); $this->generateBackendActions(); $this->generateBackendCategoryActions(); // Frontend $this->generateFrontendFiles(); $this->generateFrontendModel(); $this->generateFrontendActions(); $this->generateFrontendCategoryActions(); $this->generateFrontendCategoryWidget(); $this->parse(); $this->display(); }
/** * Execute the action */ public function execute() { // call parent, this will probably add some general CSS/JS or other required files parent::execute(); // action to execute $id = \SpoonFilter::getGetValue('id', null, 0); // no id's provided if (empty($id) || !BackendMailmotorModel::existsMailing($id)) { $this->redirect(BackendModel::createURLForAction('Index') . '&error=mailing-does-not-exist'); } else { // get the mailing and reset some fields $mailing = BackendMailmotorModel::getMailing($id); $mailing['status'] = 'concept'; $mailing['send_on'] = null; $mailing['created_on'] = BackendModel::getUTCDate('Y-m-d H:i:s'); $mailing['edited_on'] = $mailing['created_on']; unset($mailing['recipients'], $mailing['id'], $mailing['cm_id'], $mailing['send_on_raw']); // set groups $groups = $mailing['groups']; unset($mailing['groups']); // create a new mailing based on the old one $newId = BackendMailmotorModel::insertMailing($mailing); // update groups for this mailing BackendMailmotorModel::updateGroupsForMailing($newId, $groups); // trigger event BackendModel::triggerEvent($this->getModule(), 'after_copy_mailing', array('item' => $mailing)); } // redirect $this->redirect(BackendModel::createURLForAction('Index') . '&report=mailing-copied&var=' . $mailing['name']); }
/** * Execute the action */ public function execute() { parent::execute(); // action to execute $action = \SpoonFilter::getGetValue('action', array('delete'), ''); // get passed group ID $id = \SpoonFilter::getGetValue('group_id', null, 0, 'int'); // fetch group record $this->group = BackendMailmotorModel::getGroup($id); // set redirect URL $redirectURL = BackendModel::createURLForAction('CustomFields') . '&group_id=' . $this->group['id']; // no id's provided if (!$action) { $this->redirect($redirectURL . '&error=no-action-selected'); } if (!isset($_GET['fields'])) { $this->redirect($redirectURL . '&error=no-items-selected'); } if (empty($this->group)) { $this->redirect(BackendModel::createURLForAction('Groups') . '&error=non-existing'); } else { // redefine id's $this->fields = (array) $_GET['fields']; // evaluate $action, see what action was triggered switch ($action) { case 'delete': $this->deleteCustomFields(); break; } } }
/** * Execute the action */ public function execute() { parent::execute(); // current status $from = \SpoonFilter::getGetValue('from', array('subscribed', 'moderation'), 'subscribed'); // action to execute $action = \SpoonFilter::getGetValue('action', array('subscribed', 'moderation', 'delete'), 'moderation'); // no id's provided if (!isset($_GET['id'])) { $this->redirect(BackendModel::createURLForAction('subscriptions') . '&error=no-subscriptions-selected'); } // redefine id's $ids = (array) $_GET['id']; // delete comment(s) if ($action == 'delete') { BackendAgendaModel::deleteSubscriptions($ids); } else { // set new status BackendAgendaModel::updateSubscriptionStatuses($ids, $action); } // define report $report = count($ids) > 1 ? 'subscriptions-' : 'subscription-'; // init var if ($action == 'subscribed') { $report .= 'moved-subscribed'; } if ($action == 'moderation') { $report .= 'moved-moderation'; } if ($action == 'delete') { $report .= 'deleted'; } // redirect $this->redirect(BackendModel::createURLForAction('subscriptions') . '&report=' . $report . '#tab' . \SpoonFilter::ucfirst($from)); }
/** * Execute the action */ public function execute() { parent::execute(); // action to execute $action = \SpoonFilter::getGetValue('action', array('delete'), ''); // form id $formId = \SpoonFilter::getGetValue('form_id', null, '', 'int'); // no id's provided if (!isset($_GET['id'])) { $this->redirect(BackendModel::createURLForAction('Index') . '&error=no-items-selected'); } elseif ($action == '') { // no action provided $this->redirect(BackendModel::createURLForAction('Index') . '&error=no-action-selected'); } elseif (!BackendFormBuilderModel::exists($formId)) { // valid form id $this->redirect(BackendModel::createURLForAction('Index') . '&error=non-existing'); } else { // redefine id's $ids = (array) $_GET['id']; // delete comment(s) if ($action == 'delete') { BackendFormBuilderModel::deleteData($ids); } // define report $report = count($ids) > 1 ? 'items-' : 'item-'; // init var if ($action == 'delete') { $report .= 'deleted'; } // redirect $this->redirect(BackendModel::createURLForAction('Data') . '&id=' . $formId . '&report=' . $report); } }
/** * Parse the form */ protected function parse() { parent::parse(); if ($this->frm) { $this->frm->parse($this->tpl); } }
/** * Execute the action */ public function execute() { parent::execute(); $this->loadDataGrid(); $this->parse(); $this->display(); }
/** * Execute the action */ public function execute() { parent::execute(); BackendAuthentication::logout(); // redirect to login-screen $this->redirect(BackendModel::createURLForAction('Index', $this->getModule())); }
/** * Execute the action */ public function execute() { parent::execute(); $this->loadForm(); $this->validateForm(); $this->parse(); $this->display(); }
/** * Execute the action */ public function execute() { parent::execute(); //--Get the id $id = \SpoonFilter::getGetValue('id', null, 0); //--Export users BackendMailengineModel::exportUsers($id); }
/** * 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 datagrids $this->loadDataGrid(); // parse page $this->parse(); // display the page $this->display(); }
/** * Execute the action. */ public function execute() { $this->id = $this->getParameter('id', 'int'); // does the item exist if ($this->id !== null && BackendFormBuilderModel::exists($this->id)) { parent::execute(); $this->setFilter(); $this->setItems(); BackendCSV::outputCSV(date('Ymd_His') . '.csv', $this->rows, $this->columnHeaders); } else { // no item found, redirect to index, because somebody is f*****g with our url $this->redirect(BackendModel::createURLForAction('Index') . '&error=non-existing'); } }
/** * Execute the action */ public function execute() { parent::execute(); // action to execute $id = \SpoonFilter::getGetValue('id', null, 0); // no id's provided if (!BackendMailmotorModel::existsCampaign($id)) { $this->redirect(BackendModel::createURLForAction('Campaigns') . '&error=campaign-does-not-exist'); } else { // at least one id BackendMailmotorModel::exportStatisticsByCampaignID($id); } // redirect $this->redirect(BackendModel::createURLForAction('Groups') . '&report=export-failed'); }
/** * Execute the action. */ public function execute() { // call parent, this will probably add some general CSS/JS or other required files parent::execute(); // action to execute $action = \SpoonFilter::getGetValue('action', array('addToGroup', 'delete'), ''); $ids = isset($_GET['id']) ? (array) $_GET['id'] : array(); $newGroupId = \SpoonFilter::getGetValue('newGroup', array_keys(BackendProfilesModel::getGroups()), ''); // no ids provided if (empty($ids)) { $this->redirect(BackendModel::createURLForAction('Index') . '&error=no-profiles-selected'); } // delete the given profiles if ($action === 'delete') { BackendProfilesModel::delete($ids); $report = 'deleted'; } elseif ($action === 'addToGroup') { // add the profiles to the given group // no group id provided if ($newGroupId == '') { $this->redirect(BackendModel::createURLForAction('Index') . '&error=no-group-selected'); } // set new status foreach ($ids as $id) { // profile must exist if (BackendProfilesModel::exists($id)) { // make sure the user is not already part of this group without an expiration date foreach (BackendProfilesModel::getProfileGroups($id) as $existingGroup) { // if he is, skip to the next user if ($existingGroup['group_id'] === $newGroupId) { continue 2; } } // OK, it's safe to add the user to this group BackendProfilesModel::insertProfileGroup(array('profile_id' => $id, 'group_id' => $newGroupId, 'starts_on' => BackendModel::getUTCDate())); } } // report $report = 'added-to-group'; } else { // unknown action $this->redirect(BackendModel::createURLForAction('Index') . '&error=unknown-action'); } // report $report = (count($ids) > 1 ? 'profiles-' : 'profile-') . $report; // redirect $this->redirect(BackendModel::createURLForAction('Index', null, null, array('offset' => \SpoonFilter::getGetValue('offset', null, ''), 'order' => \SpoonFilter::getGetValue('order', null, ''), 'sort' => \SpoonFilter::getGetValue('sort', null, ''), 'email' => \SpoonFilter::getGetValue('email', null, ''), 'status' => \SpoonFilter::getGetValue('status', null, ''), 'group' => \SpoonFilter::getGetValue('group', null, ''))) . '&report=' . $report); }
/** * Execute the action */ public function execute() { parent::execute(); // action to execute $action = \SpoonFilter::getGetValue('action', array('delete'), 'delete'); // no id's provided if (!isset($_GET['id'])) { $this->redirect(BackendModel::createURLForAction('Index') . '&error=no-selection'); } else { // at least one id // redefine id's $aIds = (array) $_GET['id']; // delete comment(s) if ($action == 'delete') { BackendTagsModel::delete($aIds); } } // redirect $this->redirect(BackendModel::createURLForAction('Index') . '&report=deleted'); }
/** * Execute the action */ public function execute() { parent::execute(); // Get the redirect code if there is one (if you are redirected here from the Instagram authentication) $oAuthCode = $this->getParameter('code', 'string', ''); // Get settings $settingsService = $this->get('fork.settings'); $client_id = $settingsService->get($this->URL->getModule(), 'client_id'); $client_secret = $settingsService->get($this->URL->getModule(), 'client_secret'); // If no settings configured, redirect if (empty($client_id) || empty($client_secret)) { $this->redirect(BackendModel::createURLForAction('Settings') . '&error=non-existing'); } // First visit? (otherwise instagram would have added a parameter) if ($oAuthCode == '') { // Get Instagram api token $instagram_login_url = Helper::getLoginUrl($client_id, SITE_URL . BackendModel::createURLForAction('Oauth')); $this->redirect($instagram_login_url); } else { // Exchanging the instagram login code for an access token $authenticationData = Helper::getOAuthToken($client_id, $client_secret, $oAuthCode, SITE_URL . BackendModel::createURLForAction('Oauth'), false); // Define variables $userId = $authenticationData->user->id; $userName = $authenticationData->user->username; $accessToken = $authenticationData->access_token; if (isset($accessToken)) { $instagramUser = array('user_id' => $userId, 'username' => $userName, 'locked' => 'Y'); $instagramUser['id'] = BackendInstagramModel::insert($instagramUser); // Save access_token to settings $this->get('fork.settings')->set($this->URL->getModule(), 'access_token', $accessToken); // Save access_token to settings $this->get('fork.settings')->set($this->URL->getModule(), 'default_instagram_user_id', $instagramUser['id']); // Trigger event BackendModel::triggerEvent($this->getModule(), 'after_oauth'); // Successfully authenticated $this->redirect(BackendModel::createURLForAction('Settings') . '&report=authentication_success'); } else { $this->redirect(BackendModel::createURLForAction('Settings') . '&error=authentication_failed'); } } }
/** * Execute the action */ public function execute() { parent::execute(); // action to execute $action = \SpoonFilter::getGetValue('action', array('delete'), 'delete'); // no id's provided if (!isset($_GET['id'])) { $this->redirect(BackendModel::createURLForAction('Groups') . '&error=no-selection'); } else { // redefine id's $ids = (array) $_GET['id']; // delete comment(s) if ($action == 'delete') { BackendMailmotorCMHelper::deleteGroups($ids); // trigger event BackendModel::triggerEvent($this->getModule(), 'after_delete_groups', array('ids' => $ids)); } } // redirect $this->redirect(BackendModel::createURLForAction('Groups') . '&report=delete-groups'); }
/** * Execute the action */ public function execute() { parent::execute(); $this->groupId = \SpoonFilter::getGetValue('group', null, null, 'int'); if ($this->groupId == 0) { $this->groupId = null; } else { // get category $this->group = BackendAddressesModel::getGroup($this->groupId); // reset if (empty($this->group)) { // reset GET to trick Spoon $_GET['group'] = null; // reset $this->groupId = null; } } $this->loadDataGrid(); $this->loadFilterForm(); $this->parse(); $this->display(); }
/** * Execute the action */ public function execute() { parent::execute(); // current status $from = \SpoonFilter::getGetValue('from', array('moderation', 'completed'), 'moderation'); // action to execute $action = \SpoonFilter::getGetValue('action', array('moderation', 'completed', 'delete'), 'completed'); // no id's provided if (!isset($_GET['id'])) { $this->redirect(BackendModel::createURLForAction('orders') . '&error=no-orders-selected'); } // redefine id's $ids = (array) $_GET['id']; // delete comment(s) if ($action == 'delete') { BackendCatalogModel::deleteOrders($ids); } if ($action == 'completed') { BackendCatalogModel::updateOrderStatuses($ids, $action); } if ($action == 'moderation') { BackendCatalogModel::updateOrderStatuses($ids, $action); } // define report $report = count($ids) > 1 ? 'orders-' : 'order-'; // init var if ($action == 'moderation') { $report .= 'moved-moderation'; } if ($action == 'completed') { $report .= 'moved-completed'; } if ($action == 'delete') { $report .= 'deleted'; } // redirect $this->redirect(BackendModel::createURLForAction('orders') . '&report=' . $report . '#tab' . ucfirst($from)); }
/** * Execute the action */ public function execute() { $email = $this->getParameter('email', 'string'); // does the user exist if ($email !== null) { parent::execute(); // delete item if (BackendUsersModel::undoDelete($email)) { // get user $user = new BackendUser(null, $email); // trigger event $item = array('id' => $user->getUserId(), 'email' => $email); BackendModel::triggerEvent($this->getModule(), 'after_undelete', array('item' => $item)); // item was deleted, so redirect $this->redirect(BackendModel::createURLForAction('edit') . '&id=' . $user->getUserId() . '&report=restored&var=' . $user->getSetting('nickname') . '&highlight=row-' . $user->getUserId()); } else { // invalid user $this->redirect(BackendModel::createURLForAction('index') . '&error=non-existing'); } } else { $this->redirect(BackendModel::createURLForAction('index') . '&error=non-existing'); } }
/** * Execute the action */ public function execute() { parent::execute(); // action to execute $id = \SpoonFilter::getGetValue('id', null, 0); // no id's provided if (empty($id)) { $this->redirect(BackendModel::createURLForAction('Groups') . '&error=no-items-selected'); } else { // at least one id // export all addresses if ($id == 'all') { // fetch records $records = BackendMailmotorModel::getAddresses(); // export records BackendMailmotorModel::exportAddresses($records); } else { // export addresses by group ID BackendMailmotorModel::exportAddressesByGroupID($id); } } // redirect $this->redirect(BackendModel::createURLForAction('Groups') . '&report=export-failed'); }
/** * Execute the actions */ public function execute() { parent::execute(); //--Get all the addresses $addresses = BackendAddressesModel::getAllAddresses(1); foreach ($addresses as &$address) { $address = BackendAddressesModel::get($address['id']); foreach ($address as &$row) { $row = $row == "" ? "-" : $row; } } foreach ($addresses as $address) { set_time_limit(10); if (filter_var($address['email'], FILTER_VALIDATE_EMAIL) && $address['send_mail'] == 0) { //--Send mail for the address BackendMailer::addEmail("Nieuwe website Namev.be met uw eigen bedrijfs-pagina", BACKEND_MODULE_PATH . '/layout/templates/mails/send_email.tpl', $address, '*****@*****.**', $address['company']); // BackendMailer::addEmail("Nieuwe website Namev.be met uw eigen bedrijfs-pagina", BACKEND_MODULE_PATH . '/layout/templates/mails/send_email.tpl', $address, '*****@*****.**', $address['company']); // BackendMailer::addEmail("Nieuwe website Namev.be met uw eigen bedrijfs-pagina", BACKEND_MODULE_PATH . '/layout/templates/mails/send_email.tpl', $address, $address['email'], $address['company']); BackendModel::getContainer()->get('database')->update('addresses', array("send_mail" => 1), 'id = ?', (int) $address['id']); die; } } //--Update the address row when e-mail is send }
/** * Execute the current action * This method will be overwritten in most of the actions, but still be called to add general stuff */ public function execute() { parent::execute(); }
/** * Execute the action */ public function execute() { parent::execute(); //--Export users BackendMailengineModel::exportDemo(); }
/** * Execute the action */ public function execute() { parent::execute(); // current status $from = \SpoonFilter::getGetValue('from', array('published', 'moderation', 'spam'), 'published'); // action to execute $action = \SpoonFilter::getGetValue('action', array('published', 'moderation', 'spam', 'delete'), 'spam'); // no id's provided if (!isset($_GET['id'])) { $this->redirect(BackendModel::createURLForAction('Comments') . '&error=no-comments-selected'); } // redefine id's $ids = (array) $_GET['id']; // delete comment(s) if ($action == 'delete') { BackendBlogModel::deleteComments($ids); } elseif ($action == 'spam') { // is the spamfilter active? if ($this->get('fork.settings')->get($this->URL->getModule(), 'spamfilter', false)) { // get data $comments = BackendBlogModel::getComments($ids); // loop comments foreach ($comments as $row) { // unserialize data $row['data'] = unserialize($row['data']); // check if needed data is available if (!isset($row['data']['server']['REMOTE_ADDR'])) { continue; } if (!isset($row['data']['server']['HTTP_USER_AGENT'])) { continue; } // build vars $userIp = $row['data']['server']['REMOTE_ADDR']; $userAgent = $row['data']['server']['HTTP_USER_AGENT']; $content = $row['text']; $author = $row['author']; $email = $row['email']; $url = isset($row['website']) && $row['website'] != '' ? $row['website'] : null; $referrer = isset($row['data']['server']['HTTP_REFERER']) ? $row['data']['server']['HTTP_REFERER'] : null; $others = $row['data']['server']; // submit as spam BackendModel::submitSpam($userIp, $userAgent, $content, $author, $email, $url, null, 'comment', $referrer, $others); } } // set new status BackendBlogModel::updateCommentStatuses($ids, $action); } else { // published? if ($action == 'published') { // is the spamfilter active? if ($this->get('fork.settings')->get($this->URL->getModule(), 'spamfilter', false)) { // get data $comments = BackendBlogModel::getComments($ids); // loop comments foreach ($comments as $row) { // previous status is spam if ($row['status'] == 'spam') { // unserialize data $row['data'] = unserialize($row['data']); // check if needed data is available if (!isset($row['data']['server']['REMOTE_ADDR'])) { continue; } if (!isset($row['data']['server']['HTTP_USER_AGENT'])) { continue; } // build vars $userIp = $row['data']['server']['REMOTE_ADDR']; $userAgent = $row['data']['server']['HTTP_USER_AGENT']; $content = $row['text']; $author = $row['author']; $email = $row['email']; $url = isset($row['website']) && $row['website'] != '' ? $row['website'] : null; $referrer = isset($row['data']['server']['HTTP_REFERER']) ? $row['data']['server']['HTTP_REFERER'] : null; $others = $row['data']['server']; // submit as spam BackendModel::submitHam($userIp, $userAgent, $content, $author, $email, $url, null, 'comment', $referrer, $others); } } } } // set new status BackendBlogModel::updateCommentStatuses($ids, $action); } // define report $report = count($ids) > 1 ? 'comments-' : 'comment-'; // init var if ($action == 'published') { $report .= 'moved-published'; } elseif ($action == 'moderation') { $report .= 'moved-moderation'; } elseif ($action == 'spam') { $report .= 'moved-spam'; } elseif ($action == 'delete') { $report .= 'deleted'; } // redirect $this->redirect(BackendModel::createURLForAction('Comments') . '&report=' . $report . '#tab' . \SpoonFilter::ucfirst($from)); }
/** * Parse to template */ protected function parse() { parent::parse(); }
/** * Parse the page */ protected function parse() { parent::parse(); $this->tpl->assign("item", $this->record); }