edit($args); if($key) { $dbPages->regenerateCli(); // Re index categories //reIndexCategoriesPages(); // Call the plugins after page created. Theme::plugins('afterPageModify'); // Alert the user Alert::set($Language->g('The changes have been saved')); Redirect::page('admin', 'edit-page/'.$args['slug']); } else { Log::set(__METHOD__.LOG_SEP.'Error occurred when trying to edit the page.'); } } function deletePage($key) { global $dbPages; global $Language; if( $dbPages->delete($key) ) { // Call the plugins after post created. Theme::plugins('afterPageDelete'); Alert::set($Language->g('The page has been deleted successfully')); Redirect::page('admin', 'manage-pages'); } else { Log::set(__METHOD__.LOG_SEP.'Error occurred when trying to delete the page.'); } } // ============================================================================ // Main before POST // ============================================================================ // ============================================================================ // POST Method // ============================================================================ if( $_SERVER['REQUEST_METHOD'] == 'POST' ) { if( isset($_POST['delete-page']) ) { deletePage($_POST['key']); } else { editPage($_POST); } } // ============================================================================ // Main after POST // ============================================================================ if( !$dbPages->exists($layout['parameters']) ) { Log::set(__METHOD__.LOG_SEP.'Error occurred when trying to get the page: '.$layout['parameters']); Redirect::page('pages'); } $page = $pagesKey[$layout['parameters']];