/** * Execute the action * * @return void */ public function execute() { // get parameters $this->id = $this->getParameter('id', 'int'); // does the item exist if ($this->id !== null && BackendBlogModel::existsCategory($this->id)) { // get data $this->record = (array) BackendBlogModel::getCategory($this->id); // allowed to delete the category? if (BackendBlogModel::deleteCategoryAllowed($this->id)) { // call parent, this will probably add some general CSS/JS or other required files parent::execute(); // delete item BackendBlogModel::deleteCategory($this->id); // trigger event BackendModel::triggerEvent($this->getModule(), 'after_delete_category', array('id' => $this->id)); // category was deleted, so redirect $this->redirect(BackendModel::createURLForAction('categories') . '&report=deleted-category&var=' . urlencode($this->record['title'])); } else { $this->redirect(BackendModel::createURLForAction('categories') . '&error=delete-category-not-allowed&var=' . urlencode($this->record['title'])); } } else { $this->redirect(BackendModel::createURLForAction('categories') . '&error=non-existing'); } }
/** * Execute the action. */ public function execute() { // get parameters $this->id = $this->getParameter('id', 'int'); // does the item exist if ($this->id !== null && BackendProfilesModel::exists($this->id)) { // call parent, this will probably add some general CSS/JS or other required files parent::execute(); // get item $profile = BackendProfilesModel::get($this->id); // already blocked? Prolly want to unblock then if ($profile['status'] === 'blocked') { // set profile status to active BackendProfilesModel::update($this->id, array('status' => 'active')); // trigger event BackendModel::triggerEvent($this->getModule(), 'after_unblock', array('id' => $this->id)); // redirect $this->redirect(BackendModel::createURLForAction('index') . '&report=profile-unblocked&var=' . urlencode($profile['email']) . '&highlight=row-' . $this->id); } else { // delete profile session that may be active BackendProfilesModel::deleteSession($this->id); // set profile status to blocked BackendProfilesModel::update($this->id, array('status' => 'blocked')); // trigger event BackendModel::triggerEvent($this->getModule(), 'after_block', array('id' => $this->id)); // redirect $this->redirect(BackendModel::createURLForAction('index') . '&report=profile-blocked&var=' . urlencode($profile['email']) . '&highlight=row-' . $this->id); } } else { $this->redirect(BackendModel::createURLForAction('index') . '&error=non-existing'); } }
/** * Execute the action */ public function execute() { // get parameters $this->id = $this->getParameter('id', 'int'); // does the item exist if ($this->id !== null && BackendExtensionsModel::existsTemplate($this->id)) { // call parent, this will probably add some general CSS/JS or other required files parent::execute(); // init var $success = false; // get template (we need the title) $item = BackendExtensionsModel::getTemplate($this->id); // valid template? if (!empty($item)) { // delete the page $success = BackendExtensionsModel::deleteTemplate($this->id); // trigger event BackendModel::triggerEvent($this->getModule(), 'after_delete_template', array('id' => $this->id)); } // page is deleted, so redirect to the overview if ($success) { $this->redirect(BackendModel::createURLForAction('theme_templates') . '&theme=' . $item['theme'] . '&report=deleted-template&var=' . urlencode($item['label'])); } else { $this->redirect(BackendModel::createURLForAction('theme_templates') . '&error=non-existing'); } } else { $this->redirect(BackendModel::createURLForAction('theme_templates') . '&error=non-existing'); } }
/** * Execute the action * * @return void */ public function execute() { // get parameters $this->id = $this->getParameter('id', 'int'); // does the item exist if ($this->id !== null && BackendBlogModel::exists($this->id)) { // call parent, this will probably add some general CSS/JS or other required files parent::execute(); // set category id $this->categoryId = SpoonFilter::getGetValue('category', null, null, 'int'); if ($this->categoryId == 0) { $this->categoryId = null; } // get data $this->record = (array) BackendBlogModel::get($this->id); // delete item BackendBlogModel::delete($this->id); // trigger event BackendModel::triggerEvent($this->getModule(), 'after_delete', array('id' => $this->id)); // delete search indexes if (is_callable(array('BackendSearchModel', 'removeIndex'))) { BackendSearchModel::removeIndex($this->getModule(), $this->id); } // build redirect URL $redirectUrl = BackendModel::createURLForAction('index') . '&report=deleted&var=' . urlencode($this->record['title']); // append to redirect URL if ($this->categoryId != null) { $redirectUrl .= '&category=' . $this->categoryId; } // item was deleted, so redirect $this->redirect($redirectUrl); } else { $this->redirect(BackendModel::createURLForAction('index') . '&error=non-existing'); } }
/** * Execute the action */ public function execute() { parent::execute(); BackendBlogModel::deleteSpamComments(); // item was deleted, so redirect $this->redirect(BackendModel::createURLForAction('comments') . '&report=deleted-spam#tabSpam'); }
/** * Execute the action */ public function execute() { // get parameters $this->id = $this->getParameter('mailing_id', 'int'); // does the item exist if (BackendMailmotorModel::existsMailing($this->id)) { // call parent, this will probably add some general CSS/JS or other required files parent::execute(); // fetch the mailing $mailing = BackendMailmotorModel::getMailing($this->id); // get all data for the user we want to edit $records = (array) BackendMailmotorCMHelper::getCM()->getCampaignBounces($mailing['cm_id']); // reset some data if (!empty($records)) { // loop the records foreach ($records as $record) { // only remove the hard bounces if ($record['bounce_type'] == 'Hard') { // remove the address BackendMailmotorModel::deleteAddresses($record['email']); } } } // trigger event BackendModel::triggerEvent($this->getModule(), 'after_delete_bounces'); // user was deleted, so redirect $this->redirect(BackendModel::createURLForAction('statistics') . '&id=' . $mailing['id'] . '&report=deleted-bounces'); } else { $this->redirect(BackendModel::createURLForAction('statistics') . '&error=no-bounces'); } }
/** * Execute the action * * @return void */ public function execute() { // call parent, this will probably add some general CSS/JS or other required files parent::execute(); // delete item BackendBlogModel::deleteSpamComments($this->id); // item was deleted, so redirect $this->redirect(BackendModel::createURLForAction('comments') . '&report=deleted-spam#tabSpam'); }
/** * Execute the action */ public function execute() { $this->id = $this->getParameter('id', 'int'); if ($this->id !== null && BackendFaqModel::exists($this->id)) { parent::execute(); $this->record = BackendFaqModel::get($this->id); // delete item BackendFaqModel::delete($this->id); BackendModel::triggerEvent($this->getModule(), 'after_delete', array('item' => $this->record)); $this->redirect(BackendModel::createURLForAction('index') . '&report=deleted&var=' . urlencode($this->record['question'])); } else { $this->redirect(BackendModel::createURLForAction('index') . '&error=non-existing'); } }
/** * Execute the action */ public function execute() { $this->id = $this->getParameter('id', 'int'); // does the item exist if ($this->id !== null && BackendAnalyticsModel::existsLandingPage($this->id)) { parent::execute(); $this->record = (array) BackendAnalyticsModel::getLandingPage($this->id); // delete item BackendAnalyticsModel::deleteLandingPage($this->id); // trigger event BackendModel::triggerEvent($this->getModule(), 'after_delete_landing_page', array('id' => $this->id)); // item was deleted, so redirect $this->redirect(BackendModel::createURLForAction('index') . '&report=deleted&var=' . urlencode($this->record['page_path'])); } else { $this->redirect(BackendModel::createURLForAction('index') . '&error=non-existing'); } }
/** * Execute the action */ public function execute() { $this->id = $this->getParameter('id', 'int'); // group exists and id is not null? if ($this->id !== null && BackendGroupsModel::exists($this->id)) { parent::execute(); // get record $this->record = BackendGroupsModel::get($this->id); // delete group BackendGroupsModel::delete($this->id); // trigger event BackendModel::triggerEvent($this->getModule(), 'after_delete', array('id' => $this->id)); // item was deleted, so redirect $this->redirect(BackendModel::createURLForAction('index') . '&report=deleted&var=' . urlencode($this->record['name'])); } else { $this->redirect(BackendModel::createURLForAction('index') . '&error=non-existing'); } }
/** * Execute the action */ public function execute() { // get parameters $this->id = $this->getParameter('id', 'int'); // does the item exist if ($this->id !== null && BackendContentBlocksModel::exists($this->id)) { parent::execute(); $this->record = (array) BackendContentBlocksModel::get($this->id); // delete item BackendContentBlocksModel::delete($this->id); // trigger event BackendModel::triggerEvent($this->getModule(), 'after_delete', array('id' => $this->id)); // item was deleted, so redirect $this->redirect(BackendModel::createURLForAction('index') . '&report=deleted&var=' . urlencode($this->record['title'])); } else { $this->redirect(BackendModel::createURLForAction('index') . '&error=non-existing'); } }
/** * Execute the action. */ public function execute() { // get parameters $this->id = $this->getParameter('id', 'int'); // does the item exist if ($this->id !== null && BackendProfilesModel::existsProfileGroup($this->id)) { // call parent, this will probably add some general CSS/JS or other required files parent::execute(); // get profile group $profileGroup = BackendProfilesModel::getProfileGroup($this->id); // delete profile group BackendProfilesModel::deleteProfileGroup($this->id); // trigger event BackendModel::triggerEvent($this->getModule(), 'after_profile_delete_from_group', array('id' => $this->id)); // profile group was deleted, so redirect $this->redirect(BackendModel::createURLForAction('edit') . '&id=' . $profileGroup['profile_id'] . '&report=membership-deleted#tabGroups'); } else { $this->redirect(BackendModel::createURLForAction('index') . '&error=non-existing'); } }
/** * Execute the action * * @return void */ public function execute() { // get parameters $this->id = $this->getParameter('id', 'int'); // does the item exist if ($this->id !== null && BackendFormBuilderModel::exists($this->id)) { // call parent, this will probably add some general CSS/JS or other required files parent::execute(); // get all data for the item we want to edit $this->record = (array) BackendFormBuilderModel::get($this->id); // delete item BackendFormBuilderModel::delete($this->id); // trigger event BackendModel::triggerEvent($this->getModule(), 'after_delete', array('id' => $this->id)); // user was deleted, so redirect $this->redirect(BackendModel::createURLForAction('index') . '&report=deleted&var=' . urlencode($this->record['name'])); } else { $this->redirect(BackendModel::createURLForAction('index') . '&error=non-existing'); } }
/** * Execute the action. */ public function execute() { // get parameters $this->id = $this->getParameter('id', 'int'); // does the item exist if ($this->id !== null && BackendProfilesModel::existsGroup($this->id)) { // call parent, this will probably add some general CSS/JS or other required files parent::execute(); // get group $group = BackendProfilesModel::getGroup($this->id); // delete group BackendProfilesModel::deleteGroup($this->id); // trigger event BackendModel::triggerEvent($this->getModule(), 'after_delete_group', array('id' => $this->id)); // group was deleted, so redirect $this->redirect(BackendModel::createURLForAction('groups') . '&report=deleted&var=' . urlencode($group['name'])); } else { $this->redirect(BackendModel::createURLForAction('groups') . '&error=non-existing'); } }
/** * Execute the action * * @return void */ public function execute() { // get parameters $this->id = $this->getParameter('id', 'int'); // does the item exist if ($this->id !== null && BackendSearchModel::existsSynonymById($this->id)) { // call parent, this will probably add some general CSS/JS or other required files parent::execute(); // get data $this->record = (array) BackendSearchModel::getSynonym($this->id); // delete item BackendSearchModel::deleteSynonym($this->id); // trigger event BackendModel::triggerEvent($this->getModule(), 'after_delete_synonym', array('id' => $this->id)); // item was deleted, so redirect $this->redirect(BackendModel::createURLForAction('synonyms') . '&report=deleted-synonym&var=' . urlencode($this->record['term'])); } else { $this->redirect(BackendModel::createURLForAction('synonyms') . '&error=non-existing'); } }
/** * Execute the action */ public function execute() { $this->id = $this->getParameter('id', 'int'); // does the item exist if ($this->id !== null && BackendFaqModel::existsCategory($this->id)) { $this->record = (array) BackendFaqModel::getCategory($this->id); if (BackendFaqModel::deleteCategoryAllowed($this->id)) { parent::execute(); // delete item BackendFaqModel::deleteCategory($this->id); BackendModel::triggerEvent($this->getModule(), 'after_delete_category', array('item' => $this->record)); // category was deleted, so redirect $this->redirect(BackendModel::createURLForAction('categories') . '&report=deleted-category&var=' . urlencode($this->record['title'])); } else { $this->redirect(BackendModel::createURLForAction('categories') . '&error=delete-category-not-allowed&var=' . urlencode($this->record['title'])); } } else { $this->redirect(BackendModel::createURLForAction('categories') . '&error=non-existing'); } }
/** * Execute the action */ public function execute() { // get parameters $this->id = $this->getParameter('id', 'int'); // does the item exist if ($this->id !== null && BackendPagesModel::exists($this->id)) { // call parent, this will probably add some general CSS/JS or other required files parent::execute(); // init var $success = false; // cannot have children if (BackendPagesModel::getFirstChildId($this->id) !== false) { $this->redirect(BackendModel::createURLForAction('edit') . '&error=non-existing'); } $revisionId = $this->getParameter('revision_id', 'int'); if ($revisionId == 0) { $revisionId = null; } // get page (we need the title) $page = BackendPagesModel::get($this->id, $revisionId); // valid page? if (!empty($page)) { // delete the page $success = BackendPagesModel::delete($this->id, null, $revisionId); // trigger event BackendModel::triggerEvent($this->getModule(), 'after_delete', array('id' => $this->id)); // delete search indexes BackendSearchModel::removeIndex($this->getModule(), $this->id); // build cache BackendPagesModel::buildCache(BL::getWorkingLanguage()); } // page is deleted, so redirect to the overview if ($success) { $this->redirect(BackendModel::createURLForAction('index') . '&id=' . $page['parent_id'] . '&report=deleted&var=' . urlencode($page['title'])); } else { $this->redirect(BackendModel::createURLForAction('edit') . '&error=non-existing'); } } else { $this->redirect(BackendModel::createURLForAction('edit') . '&error=non-existing'); } }
/** * Execute the action */ public function execute() { // get parameters $this->id = $this->getParameter('id', 'int'); // does the item exist if ($this->id !== null && BackendLocationModel::exists($this->id)) { parent::execute(); // get all data for the item we want to edit $this->record = (array) BackendLocationModel::get($this->id); // delete item BackendLocationModel::delete($this->id); // delete search indexes // @todo why is this commented out // BackendSearchModel::removeIndex($this->getModule(), $this->id); // trigger event BackendModel::triggerEvent($this->getModule(), 'after_delete', array('id' => $this->id)); // user was deleted, so redirect $this->redirect(BackendModel::createURLForAction('index') . '&report=deleted&var=' . urlencode($this->record['title'])); } else { $this->redirect(BackendModel::createURLForAction('index') . '&error=non-existing'); } }
/** * Execute the action */ public function execute() { $this->id = $this->getParameter('id', 'int'); // does the item exist if ($this->id !== null && BackendLocaleModel::exists($this->id) && BackendAuthentication::getUser()->isGod()) { parent::execute(); // filter options $this->setFilter(); // get data $this->record = (array) BackendLocaleModel::get($this->id); // delete item BackendLocaleModel::delete(array($this->id)); // trigger event BackendModel::triggerEvent($this->getModule(), 'after_delete', array('id' => $this->id)); // build redirect URL $redirectUrl = BackendModel::createURLForAction('index') . '&report=deleted&var=' . urlencode($this->record['name'] . ' (' . strtoupper($this->record['language']) . ')') . $this->filterQuery; // item was deleted, so redirect $this->redirect($redirectUrl); } else { $this->redirect(BackendModel::createURLForAction('index') . '&error=non-existing'); } }
/** * Execute the action */ public function execute() { // get parameters $this->id = $this->getParameter('id', 'int'); // does the user exist if ($this->id !== null && BackendUsersModel::exists($this->id) && BackendAuthentication::getUser()->getUserId() != $this->id) { parent::execute(); // get data $user = new BackendUser($this->id); // God-users can't be deleted if ($user->isGod()) { $this->redirect(BackendModel::createURLForAction('index') . '&error=cant-delete-god'); } // delete item BackendUsersModel::delete($this->id); // trigger event BackendModel::triggerEvent($this->getModule(), 'after_delete', array('id' => $this->id)); // item was deleted, so redirect $this->redirect(BackendModel::createURLForAction('index') . '&report=deleted&var=' . $user->getSetting('nickname')); } else { $this->redirect(BackendModel::createURLForAction('index') . '&error=non-existing'); } }
/** * Execute the action * * @return void */ public function execute() { // call parent, this will probably add some general CSS/JS or other required files parent::execute(); // get parameters $from = $this->getParameter('from'); $to = $this->getParameter('to'); // validate if ($from == '') { throw new BackendException('Specify a from-parameter.'); } if ($to == '') { throw new BackendException('Specify a to-parameter.'); } // get db $db = BackendModel::getDB(true); // get all old pages $ids = $db->getColumn('SELECT id FROM pages AS i WHERE i.language = ? AND i.status = ?', array($to, 'active')); // any old pages if (!empty($ids)) { // delete existing pages foreach ($ids as $id) { // redefine $id = (int) $id; // get revision ids $revisionIDs = (array) $db->getColumn('SELECT i.revision_id FROM pages AS i WHERE i.id = ? AND i.language = ?', array($id, $to)); // get meta ids $metaIDs = (array) $db->getColumn('SELECT i.meta_id FROM pages AS i WHERE i.id = ? AND i.language = ?', array($id, $to)); // delete meta records if (!empty($metaIDs)) { $db->delete('meta', 'id IN (' . implode(',', $metaIDs) . ')'); } // delete blocks and their revisions if (!empty($revisionIDs)) { $db->delete('pages_blocks', 'revision_id IN (' . implode(',', $revisionIDs) . ')'); } // delete page and the revisions if (!empty($revisionIDs)) { $db->delete('pages', 'revision_id IN (' . implode(',', $revisionIDs) . ')'); } } } // delete search indexes $db->delete('search_index', 'module = ? AND language = ?', array('pages', $to)); // get all active pages $ids = BackendModel::getDB()->getColumn('SELECT id FROM pages AS i WHERE i.language = ? AND i.status = ?', array($from, 'active')); // loop foreach ($ids as $id) { // get data $sourceData = BackendPagesModel::get($id, $from); // get and build meta $meta = $db->getRecord('SELECT * FROM meta WHERE id = ?', $sourceData['meta_id']); // remove id unset($meta['id']); // build page record $page = array(); $page['id'] = $sourceData['id']; $page['user_id'] = BackendAuthentication::getUser()->getUserId(); $page['parent_id'] = $sourceData['parent_id']; $page['template_id'] = $sourceData['template_id']; $page['meta_id'] = (int) $db->insert('meta', $meta); $page['language'] = $to; $page['type'] = $sourceData['type']; $page['title'] = $sourceData['title']; $page['navigation_title'] = $sourceData['navigation_title']; $page['navigation_title_overwrite'] = $sourceData['navigation_title_overwrite']; $page['hidden'] = $sourceData['hidden']; $page['status'] = 'active'; $page['publish_on'] = BackendModel::getUTCDate(); $page['created_on'] = BackendModel::getUTCDate(); $page['edited_on'] = BackendModel::getUTCDate(); $page['allow_move'] = $sourceData['allow_move']; $page['allow_children'] = $sourceData['allow_children']; $page['allow_edit'] = $sourceData['allow_edit']; $page['allow_delete'] = $sourceData['allow_delete']; $page['sequence'] = $sourceData['sequence']; $page['data'] = $sourceData['data'] !== null ? serialize($sourceData['data']) : null; // insert page, store the id, we need it when building the blocks $revisionId = BackendPagesModel::insert($page); // init var $blocks = array(); $hasBlock = $sourceData['has_extra'] == 'Y'; // get the blocks $sourceBlocks = BackendPagesModel::getBlocks($id, $from); // loop blocks foreach ($sourceBlocks as $sourceBlock) { // build block $block = array(); $block['id'] = $sourceBlock['id']; $block['revision_id'] = $revisionId; $block['extra_id'] = $sourceBlock['extra_id']; $block['html'] = $sourceBlock['html']; $block['status'] = 'active'; $block['created_on'] = BackendModel::getUTCDate(); $block['edited_on'] = BackendModel::getUTCDate(); // add block $blocks[] = $block; } // insert the blocks BackendPagesModel::insertBlocks($blocks, $hasBlock); // check if the method exists if (method_exists('BackendSearchModel', 'addIndex')) { // init var $text = ''; // build search-text foreach ($blocks as $block) { $text .= ' ' . $block['html']; } // add BackendSearchModel::addIndex('pages', (int) $page['id'], array('title' => $page['title'], 'text' => $text), $to); } // get tags $tags = BackendTagsModel::getTags('pages', $id, 'string', $from); // save tags if ($tags != '') { BackendTagsModel::saveTags($page['id'], $tags, 'pages'); } } // build cache BackendPagesModel::buildCache($to); }