예제 #1
0
 /**
  * Execute the action
  *
  * @return	void
  */
 public function execute()
 {
     // call parent
     parent::execute();
     // get parameters
     $id = SpoonFilter::getPostValue('id', null, 0, 'int');
     $droppedOn = SpoonFilter::getPostValue('dropped_on', null, -1, 'int');
     $typeOfDrop = SpoonFilter::getPostValue('type', null, '');
     // validate
     if ($id === 0) {
         $this->output(self::BAD_REQUEST, null, 'no id provided');
     }
     if ($droppedOn === -1) {
         $this->output(self::BAD_REQUEST, null, 'no id provided');
     }
     if ($typeOfDrop == '') {
         $this->output(self::BAD_REQUEST, null, 'no type provided');
     }
     // get page
     $success = BackendPagesModel::move($id, $droppedOn, $typeOfDrop);
     // build cache
     BackendPagesModel::buildCache(BL::getWorkingLanguage());
     // output
     if ($success) {
         $this->output(self::OK, BackendPagesModel::get($id), 'page moved');
     } else {
         $this->output(self::ERROR, null, 'page not moved');
     }
 }
예제 #2
0
 /**
  * Execute the action
  *
  * @return	void
  */
 public function execute()
 {
     // get parameters
     $this->id = $this->getParameter('id', 'int');
     // does the item exist
     if ($this->id !== null && BackendPagesModel::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 = BackendPagesModel::getTemplate($this->id);
         // valid template?
         if (!empty($item)) {
             // delete the page
             $success = BackendPagesModel::deleteTemplate($this->id);
             // trigger event
             BackendModel::triggerEvent($this->getModule(), 'after_delete_template', array('id' => $this->id));
             // build cache
             BackendPagesModel::buildCache(BL::getWorkingLanguage());
         }
         // page is deleted, so redirect to the overview
         if ($success) {
             $this->redirect(BackendModel::createURLForAction('templates') . '&theme=' . $item['theme'] . '&report=deleted-template&var=' . urlencode($item['label']));
         } else {
             $this->redirect(BackendModel::createURLForAction('templates') . '&error=non-existing');
         }
     } else {
         $this->redirect(BackendModel::createURLForAction('templates') . '&error=non-existing');
     }
 }
예제 #3
0
 /**
  * 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');
     }
 }
예제 #4
0
 /**
  * Execute the action
  */
 public function execute()
 {
     parent::execute();
     // add js
     $this->header->addJS('jstree/jquery.tree.js', null, false, false, false);
     $this->header->addJS('jstree/lib/jquery.cookie.js', null, false, false, false);
     $this->header->addJS('jstree/plugins/jquery.tree.cookie.js', null, false, false, false);
     // add css
     $this->header->addCSS('/backend/modules/pages/js/jstree/themes/fork/style.css', null, true);
     // check if the cached files exists
     if (!SpoonFile::exists(PATH_WWW . '/frontend/cache/navigation/keys_' . BackendLanguage::getWorkingLanguage() . '.php')) {
         BackendPagesModel::buildCache(BL::getWorkingLanguage());
     }
     if (!SpoonFile::exists(PATH_WWW . '/frontend/cache/navigation/navigation_' . BackendLanguage::getWorkingLanguage() . '.php')) {
         BackendPagesModel::buildCache(BL::getWorkingLanguage());
     }
     // load the dgRecentlyEdited
     $this->loadDataGrids();
     // parse
     $this->parse();
     // display the page
     $this->display();
 }
예제 #5
0
    /**
     * 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);
    }
예제 #6
0
 /**
  * Validate the form
  */
 private function validateForm()
 {
     // is the form submitted?
     if ($this->frm->isSubmitted()) {
         // get the status
         $status = SpoonFilter::getPostValue('status', array('active', 'draft'), 'active');
         // validate redirect
         $redirectValue = $this->frm->getField('redirect')->getValue();
         if ($redirectValue == 'internal') {
             $this->frm->getField('internal_redirect')->isFilled(BL::err('FieldIsRequired'));
         }
         if ($redirectValue == 'external') {
             $this->frm->getField('external_redirect')->isURL(BL::err('InvalidURL'));
         }
         // set callback for generating an unique URL
         $this->meta->setURLCallback('BackendPagesModel', 'getURL', array($this->record['id'], $this->record['parent_id'], $this->frm->getField('is_action')->getChecked()));
         // cleanup the submitted fields, ignore fields that were added by hackers
         $this->frm->cleanupFields();
         // validate fields
         $this->frm->getField('title')->isFilled(BL::err('TitleIsRequired'));
         // validate meta
         $this->meta->validate();
         // no errors?
         if ($this->frm->isCorrect()) {
             // init var
             $data = null;
             // build data
             if ($this->frm->getField('is_action')->isChecked()) {
                 $data['is_action'] = true;
             }
             if ($redirectValue == 'internal') {
                 $data['internal_redirect'] = array('page_id' => $this->frm->getField('internal_redirect')->getValue(), 'code' => '301');
             }
             if ($redirectValue == 'external') {
                 $data['external_redirect'] = array('url' => $this->frm->getField('external_redirect')->getValue(), 'code' => '301');
             }
             // build page record
             $page['id'] = $this->record['id'];
             $page['user_id'] = BackendAuthentication::getUser()->getUserId();
             $page['parent_id'] = $this->record['parent_id'];
             $page['template_id'] = (int) $this->frm->getField('template_id')->getValue();
             $page['meta_id'] = (int) $this->meta->save();
             $page['language'] = BackendLanguage::getWorkingLanguage();
             $page['type'] = $this->record['type'];
             $page['title'] = $this->frm->getField('title')->getValue();
             $page['navigation_title'] = $this->frm->getField('navigation_title')->getValue() != '' ? $this->frm->getField('navigation_title')->getValue() : $this->frm->getField('title')->getValue();
             $page['navigation_title_overwrite'] = $this->frm->getField('navigation_title_overwrite')->isChecked() ? 'Y' : 'N';
             $page['hidden'] = $this->frm->getField('hidden')->getValue();
             $page['status'] = $status;
             $page['publish_on'] = BackendModel::getUTCDate(null, $this->record['publish_on']);
             $page['created_on'] = BackendModel::getUTCDate(null, $this->record['created_on']);
             $page['edited_on'] = BackendModel::getUTCDate();
             $page['allow_move'] = $this->record['allow_move'];
             $page['allow_children'] = $this->record['allow_children'];
             $page['allow_edit'] = $this->record['allow_edit'];
             $page['allow_delete'] = $this->record['allow_delete'];
             $page['sequence'] = $this->record['sequence'];
             $page['data'] = $data !== null ? serialize($data) : null;
             if ($this->isGod) {
                 $page['allow_move'] = in_array('move', (array) $this->frm->getField('allow')->getValue()) ? 'Y' : 'N';
                 $page['allow_children'] = in_array('children', (array) $this->frm->getField('allow')->getValue()) ? 'Y' : 'N';
                 $page['allow_edit'] = in_array('edit', (array) $this->frm->getField('allow')->getValue()) ? 'Y' : 'N';
                 $page['allow_delete'] = in_array('delete', (array) $this->frm->getField('allow')->getValue()) ? 'Y' : 'N';
             }
             // set navigation title
             if ($page['navigation_title'] == '') {
                 $page['navigation_title'] = $page['title'];
             }
             // insert page, store the id, we need it when building the blocks
             $page['revision_id'] = BackendPagesModel::update($page);
             // loop blocks
             foreach ($this->blocksContent as $i => $block) {
                 // add page revision id to blocks
                 $this->blocksContent[$i]['revision_id'] = $page['revision_id'];
                 // validate blocks, only save blocks for valid positions
                 if (!in_array($block['position'], $this->templates[$this->frm->getField('template_id')->getValue()]['data']['names'])) {
                     unset($this->blocksContent[$i]);
                 }
             }
             // insert the blocks
             BackendPagesModel::insertBlocks($this->blocksContent);
             // trigger an event
             BackendModel::triggerEvent($this->getModule(), 'after_edit', array('item' => $page));
             // save tags
             BackendTagsModel::saveTags($page['id'], $this->frm->getField('tags')->getValue(), $this->URL->getModule());
             // build cache
             BackendPagesModel::buildCache(BL::getWorkingLanguage());
             // active
             if ($page['status'] == 'active') {
                 // init var
                 $text = '';
                 // build search-text
                 foreach ($this->blocksContent as $block) {
                     $text .= ' ' . $block['html'];
                 }
                 // add to search index
                 BackendSearchModel::saveIndex($this->getModule(), $page['id'], array('title' => $page['title'], 'text' => $text));
                 // everything is saved, so redirect to the overview
                 $this->redirect(BackendModel::createURLForAction('edit') . '&id=' . $page['id'] . '&report=edited&var=' . urlencode($page['title']) . '&highlight=row-' . $page['id']);
             } elseif ($page['status'] == 'draft') {
                 // everything is saved, so redirect to the edit action
                 $this->redirect(BackendModel::createURLForAction('edit') . '&id=' . $page['id'] . '&report=saved-as-draft&var=' . urlencode($page['title']) . '&highlight=row-' . $page['id'] . '&draft=' . $page['revision_id']);
             }
         }
     }
 }
예제 #7
0
 /**
  * Get the page-keys
  *
  * @return	array
  * @param	string[optional] $language	The language wherefor the navigation should be loaded, if not provided we will load the language that was provided in the URL.
  */
 public static function getKeys($language = null)
 {
     // redefine
     $language = $language !== null ? (string) $language : FRONTEND_LANGUAGE;
     // does the keys exists in the cache?
     if (!isset(self::$keys[$language]) || empty(self::$keys[$language])) {
         // validate file
         if (!SpoonFile::exists(FRONTEND_CACHE_PATH . '/navigation/keys_' . $language . '.php')) {
             // require BackendPagesModel
             require_once PATH_WWW . '/backend/core/engine/model.php';
             require_once PATH_WWW . '/backend/modules/pages/engine/model.php';
             // generate the cache
             BackendPagesModel::buildCache($language);
             // recall
             return self::getKeys($language);
         }
         // init var
         $keys = array();
         // require file
         require FRONTEND_CACHE_PATH . '/navigation/keys_' . $language . '.php';
         // validate keys
         if (empty($keys)) {
             throw new FrontendException('No pages for ' . $language . '.');
         }
         // store
         self::$keys[$language] = $keys;
     }
     // return from cache
     return self::$keys[$language];
 }
예제 #8
0
 /**
  * Get the navigation-items
  *
  * @return	array
  * @param	string[optional] $language		The language to use, if not provided we will use the working language.
  */
 public static function getNavigation($language = null)
 {
     // redefine
     $language = $language !== null ? (string) $language : FRONTEND_LANGUAGE;
     // does the keys exists in the cache?
     if (!isset(self::$navigation[$language]) || empty(self::$navigation[$language])) {
         // validate file
         if (!SpoonFile::exists(FRONTEND_CACHE_PATH . '/navigation/navigation_' . $language . '.php')) {
             // regenerate cache
             BackendPagesModel::buildCache($language);
         }
         // init var
         $navigation = array();
         // require file
         require FRONTEND_CACHE_PATH . '/navigation/navigation_' . $language . '.php';
         // store
         self::$navigation[$language] = $navigation;
     }
     // return
     return self::$navigation[$language];
 }
예제 #9
0
 /**
  * Validate the form
  *
  * @return	void
  */
 private function validateForm()
 {
     // is the form submitted?
     if ($this->frm->isSubmitted()) {
         // get the status
         $status = SpoonFilter::getPostValue('status', array('active', 'draft'), 'active');
         // validate redirect
         $redirectValue = $this->frm->getField('redirect')->getValue();
         if ($redirectValue == 'internal') {
             $this->frm->getField('internal_redirect')->isFilled(BL::err('FieldIsRequired'));
         }
         if ($redirectValue == 'external') {
             $this->frm->getField('external_redirect')->isURL(BL::err('InvalidURL'));
         }
         // init var
         $templateId = (int) $this->frm->getField('template_id')->getValue();
         // loop blocks in template
         for ($i = 0; $i < $this->templates[$templateId]['num_blocks']; $i++) {
             // get the extra id
             $extraId = (int) $this->frm->getField('block_extra_id_' . $i)->getValue();
             // reset some stuff
             if ($extraId > 0) {
                 // type of block
                 if (isset($this->extras[$extraId]['type']) && $this->extras[$extraId]['type'] == 'block') {
                     // home can't have blocks
                     if ($this->record['id'] == 1) {
                         $this->frm->getField('block_html_' . $i)->addError(BL::err('HomeCantHaveBlocks'));
                         $this->frm->addError(BL::err('HomeCantHaveBlocks'));
                     }
                 }
             }
         }
         // set callback for generating an unique URL
         $this->meta->setURLCallback('BackendPagesModel', 'getURL', array($this->record['id'], $this->record['parent_id'], $this->frm->getField('is_action')->getChecked()));
         // cleanup the submitted fields, ignore fields that were edited by hackers
         $this->frm->cleanupFields();
         // validate fields
         $this->frm->getField('title')->isFilled(BL::err('TitleIsRequired'));
         // validate meta
         $this->meta->validate();
         // no errors?
         if ($this->frm->isCorrect()) {
             // init var
             $data = null;
             // build data
             if ($this->frm->getField('is_action')->isChecked()) {
                 $data['is_action'] = true;
             }
             if ($redirectValue == 'internal') {
                 $data['internal_redirect'] = array('page_id' => $this->frm->getField('internal_redirect')->getValue(), 'code' => '301');
             }
             if ($redirectValue == 'external') {
                 $data['external_redirect'] = array('url' => $this->frm->getField('external_redirect')->getValue(), 'code' => '301');
             }
             // build page record
             $page['id'] = $this->record['id'];
             $page['user_id'] = BackendAuthentication::getUser()->getUserId();
             $page['parent_id'] = $this->record['parent_id'];
             $page['template_id'] = (int) $this->frm->getField('template_id')->getValue();
             $page['meta_id'] = (int) $this->meta->save();
             $page['language'] = BackendLanguage::getWorkingLanguage();
             $page['type'] = $this->record['type'];
             $page['title'] = $this->frm->getField('title')->getValue();
             $page['navigation_title'] = $this->frm->getField('navigation_title')->getValue() != '' ? $this->frm->getField('navigation_title')->getValue() : $this->frm->getField('title')->getValue();
             $page['navigation_title_overwrite'] = $this->frm->getField('navigation_title_overwrite')->isChecked() ? 'Y' : 'N';
             $page['hidden'] = $this->frm->getField('hidden')->getValue();
             $page['status'] = $status;
             $page['publish_on'] = BackendModel::getUTCDate(null, $this->record['publish_on']);
             $page['created_on'] = BackendModel::getUTCDate(null, $this->record['created_on']);
             $page['edited_on'] = BackendModel::getUTCDate();
             $page['allow_move'] = $this->record['allow_move'];
             $page['allow_children'] = $this->record['allow_children'];
             $page['allow_edit'] = $this->record['allow_edit'];
             $page['allow_delete'] = $this->record['allow_delete'];
             $page['sequence'] = $this->record['sequence'];
             $page['data'] = $data !== null ? serialize($data) : null;
             // set navigation title
             if ($page['navigation_title'] == '') {
                 $page['navigation_title'] = $page['title'];
             }
             // insert page, store the id, we need it when building the blocks
             $page['revision_id'] = BackendPagesModel::update($page);
             // init var
             $hasBlock = false;
             // build blocks
             $blocks = array();
             // no blocks should go to waste; even if the new template has fewer blocks, retain existing content
             $maxNumBlocks = max(count($this->blocksContent), $this->templates[$page['template_id']]['num_blocks']);
             // loop blocks in template
             for ($i = 0; $i < $maxNumBlocks; $i++) {
                 // check if this block has been submitted
                 if (isset($_POST['block_extra_id_' . $i])) {
                     // get the extra id
                     $extraId = (int) $this->frm->getField('block_extra_id_' . $i)->getValue();
                     // reset some stuff
                     if ($extraId <= 0) {
                         $extraId = null;
                     }
                     // init var
                     $html = null;
                     // extra-type is HTML
                     if ($extraId === null) {
                         // reset vars
                         $extraId = null;
                         $html = (string) $this->frm->getField('block_html_' . $i)->getValue();
                     } else {
                         // type of block
                         if (isset($this->extras[$extraId]['type']) && $this->extras[$extraId]['type'] == 'block') {
                             // home can't have blocks
                             if ($this->record['id'] == 1) {
                                 throw new BackendException('Home can\'t have any blocks.');
                             }
                             // set error
                             if ($hasBlock) {
                                 throw new BackendException('Can\'t add 2 blocks');
                             }
                             // reset var
                             $hasBlock = true;
                         }
                     }
                     // build block
                     $block = array();
                     $block['id'] = isset($this->blocksContent[$i]['id']) ? $this->blocksContent[$i]['id'] : BackendPagesModel::getMaximumBlockId() + ($i + 1);
                     $block['revision_id'] = $page['revision_id'];
                     $block['extra_id'] = $extraId;
                     $block['html'] = $html;
                     $block['status'] = 'active';
                     $block['created_on'] = isset($this->blocksContent[$i]['created_on']) ? BackendModel::getUTCDate(null, $this->blocksContent[$i]['created_on']) : BackendModel::getUTCDate();
                     $block['edited_on'] = BackendModel::getUTCDate();
                 } else {
                     $block = $this->blocksContent[$i];
                     $block['revision_id'] = $page['revision_id'];
                 }
                 // add block
                 $blocks[] = $block;
             }
             // update the blocks
             BackendPagesModel::updateBlocks($blocks, $hasBlock);
             // trigger an event
             BackendModel::triggerEvent($this->getModule(), 'after_edit', array('item' => $page));
             // save tags
             BackendTagsModel::saveTags($page['id'], $this->frm->getField('tags')->getValue(), $this->URL->getModule());
             // build cache
             BackendPagesModel::buildCache(BL::getWorkingLanguage());
             // active
             if ($page['status'] == 'active') {
                 // edit search index
                 if (is_callable(array('BackendSearchModel', 'editIndex'))) {
                     // init var
                     $text = '';
                     // build search-text
                     foreach ($blocks as $block) {
                         $text .= ' ' . $block['html'];
                     }
                     // add
                     BackendSearchModel::editIndex($this->getModule(), $page['id'], array('title' => $page['title'], 'text' => $text));
                 }
                 // build URL
                 $redirectUrl = BackendModel::createURLForAction('edit') . '&id=' . $page['id'] . '&report=edited&var=' . urlencode($page['title']) . '&highlight=row-' . $page['id'];
             } elseif ($page['status'] == 'draft') {
                 // everything is saved, so redirect to the edit action
                 $redirectUrl = BackendModel::createURLForAction('edit') . '&id=' . $page['id'] . '&report=saved-as-draft&var=' . urlencode($page['title']) . '&highlight=row-' . $page['id'] . '&draft=' . $page['revision_id'];
             }
             // everything is saved, so redirect to the overview
             $this->redirect($redirectUrl);
         }
     }
 }