本文整理汇总了PHP中order::clean方法的典型用法代码示例。如果您正苦于以下问题:PHP order::clean方法的具体用法?PHP order::clean怎么用?PHP order::clean使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类order
的用法示例。
在下文中一共展示了order::clean方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: delete_page
/**
* delete a page
*
* @access public
* @param integer $page_id
* @return void
*
**/
function delete_page($page_id)
{
global $admin, $database, $MESSAGE;
// Find out more about the page
$page_info = array();
$database->execute_query('SELECT `link`, `parent` FROM `' . TABLE_PREFIX . 'pages` WHERE `page_id` = ' . $page_id, true, $page_info, false);
if ($database->is_error()) {
$admin->print_error($database->get_error());
}
if (count($page_info) == 0) {
$admin->print_error($MESSAGE['PAGES_NOT_FOUND']);
}
// Get the sections that belong to the page
$all_sections = array();
$database->execute_query('SELECT `section_id`, `module` FROM `' . TABLE_PREFIX . 'sections` WHERE `page_id` = ' . $page_id, true, $all_sections);
foreach ($all_sections as &$section) {
// Set section id
$section_id = $section['section_id'];
// Include the modules delete file if it exists
if (file_exists(LEPTON_PATH . '/modules/' . $section['module'] . '/delete.php')) {
include LEPTON_PATH . '/modules/' . $section['module'] . '/delete.php';
}
}
// Update the pages table
$sql = 'DELETE FROM `' . TABLE_PREFIX . 'pages` WHERE `page_id` = ' . $page_id;
$database->query($sql);
if ($database->is_error()) {
$admin->print_error($database->get_error());
}
// Update the sections table
$sql = 'DELETE FROM `' . TABLE_PREFIX . 'sections` WHERE `page_id` = ' . $page_id;
$database->query($sql);
if ($database->is_error()) {
$admin->print_error($database->get_error());
}
// Include the ordering class or clean-up ordering
include_once LEPTON_PATH . '/framework/class.order.php';
$order = new order(TABLE_PREFIX . 'pages', 'position', 'page_id', 'parent');
$order->clean($page_info['parent']);
// Unlink the page access file and directory
$directory = LEPTON_PATH . PAGES_DIRECTORY . $page_info['link'];
$filename = $directory . PAGE_EXTENSION;
$directory .= '/';
if (file_exists($filename)) {
if (!is_writable(LEPTON_PATH . PAGES_DIRECTORY . '/')) {
$admin->print_error($MESSAGE['PAGES_CANNOT_DELETE_ACCESS_FILE']);
} else {
unlink($filename);
if (file_exists($directory) && rtrim($directory, '/') != LEPTON_PATH . PAGES_DIRECTORY && $page_info['link'][0] != '.') {
rm_full_dir($directory);
}
}
}
}
示例2: intval
* @platform WebsiteBaker 2.8.x
* @requirements PHP 5.2.2 and higher
* @version $Id: delete_field.php 1553 2011-12-31 15:03:03Z Luisehahne $
* @filesource $HeadURL: svn://isteam.dynxs.de/wb_svn/wb280/tags/2.8.3/wb/modules/form/delete_field.php $
* @lastmodified $Date: 2011-12-31 16:03:03 +0100 (Sa, 31. Dez 2011) $
* @description
*/
require '../../config.php';
// Include WB admin wrapper script
$update_when_modified = true;
// Tells script to update when this page was last updated
require WB_PATH . '/modules/admin.php';
// Get id
$field_id = intval($admin->checkIDKEY('field_id', false, 'GET'));
if (!$field_id) {
$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'], ADMIN_URL . '/pages/modify.php?page_id=' . $page_id);
}
$sec_anchor = defined('SEC_ANCHOR') && SEC_ANCHOR != '' ? '#' . SEC_ANCHOR . $section['section_id'] : '';
// Delete row
$database->query("DELETE FROM " . TABLE_PREFIX . "mod_form_fields WHERE field_id = '{$field_id}'");
// Include the ordering class
require WB_PATH . '/framework/class.order.php';
// Create new order object an reorder
$order = new order(TABLE_PREFIX . 'mod_form_fields', 'position', 'field_id', 'section_id');
if (!$order->clean($section_id)) {
$admin->print_error($database->get_error(), ADMIN_URL . '/pages/modify.php?page_id=' . $page_id . $sec_anchor);
} else {
$admin->print_success($TEXT['SUCCESS'], ADMIN_URL . '/pages/modify.php?page_id=' . $page_id . $sec_anchor);
}
// Print admin footer
$admin->print_footer();
示例3: array
$post_id = $_GET['post_id'];
}
// Include admin wrapper script
$update_when_modified = true;
// Tells script to update when this page was last updated
require LEPTON_PATH . '/modules/admin.php';
// Get post details
$get_details = array();
$database->execute_query("SELECT * FROM `" . TABLE_PREFIX . "mod_news_posts` WHERE `post_id` = '" . $post_id . "'", true, $get_details, false);
if (count($get_details) == 0) {
$admin->print_error($TEXT['NOT_FOUND'], ADMIN_URL . '/pages/modify.php?page_id=' . $page_id);
}
// Unlink post access file
if (is_writable(LEPTON_PATH . PAGES_DIRECTORY . $get_details['link'] . PAGE_EXTENSION)) {
unlink(LEPTON_PATH . PAGES_DIRECTORY . $get_details['link'] . PAGE_EXTENSION);
}
// Delete post and comments.
$database->execute_query("DELETE FROM `" . TABLE_PREFIX . "mod_news_posts` WHERE `post_id` = '" . $post_id . "' LIMIT 1");
$database->execute_query("DELETE FROM `" . TABLE_PREFIX . "mod_news_comments` WHERE `post_id` = '" . $post_id . "'");
// Clean up ordering
require LEPTON_PATH . '/framework/class.order.php';
$order = new order(TABLE_PREFIX . 'mod_news_posts', 'position', 'post_id', 'section_id');
$order->clean($section_id);
// Check if there is a db error, otherwise say successful
if ($database->is_error()) {
$admin->print_error($database->get_error(), LEPTON_URL . '/modules/news/modify_post.php?page_id=' . $page_id . '&post_id=' . $post_id);
} else {
$admin->print_success($TEXT['SUCCESS'], ADMIN_URL . '/pages/modify.php?page_id=' . $page_id);
}
// Print admin footer
$admin->print_footer();
示例4: deletePage
private function deletePage($page_id)
{
global $database;
$dbPages = new db_wb_pages();
$where = array();
$where[db_wb_pages::field_page_id] = $page_id;
$pages = array();
if (!$dbPages->sqlSelectRecord($where, $pages)) {
$this->setError(sprintf('[%s - %s] %s', __METHOD__, __LINE__, $dbPages->getError()));
return false;
}
if (sizeof($pages) == 0) {
$this->setError(sprintf('[%s - %s] %s', __METHOD__, __LINE__, sprintf(kit_error_page_not_found, $page_id)));
return false;
}
$parent = $pages[0][db_wb_pages::field_parent];
$link = $pages[0][db_wb_pages::field_link];
$dbSections = new db_wb_sections();
$where = array();
$where[db_wb_sections::field_page_id] = $page_id;
$sections = array();
if (!$dbSections->sqlSelectRecord($where, $sections)) {
$this->setError(sprintf('[%s - %s] %s', __METHOD__, __LINE__, $dbSections->getError()));
return false;
}
foreach ($sections as $section) {
$section_id = $section[db_wb_sections::field_section_id];
// Include the modules delete file if it exists
if (file_exists(WB_PATH . '/modules/' . $section[db_wb_sections::field_module] . '/delete.php')) {
require WB_PATH . '/modules/' . $section[db_wb_sections::field_module] . '/delete.php';
}
}
$where = array();
$where[db_wb_pages::field_page_id] = $page_id;
if (!$dbPages->sqlDeleteRecord($where)) {
$this->setError(sprintf('[%s - %s] %s', __METHOD__, __LINE__, $dbPages->getError()));
return false;
}
$where = array();
$where[db_wb_sections::field_page_id] = $page_id;
if (!$dbSections->sqlDeleteRecord($where)) {
$this->setError(sprintf('[%s - %s] %s', __METHOD__, __LINE__, $dbSections->getError()));
return false;
}
// Include the ordering class or clean-up ordering
$order = new order(TABLE_PREFIX . 'pages', 'position', 'page_id', 'parent');
$order->clean($parent);
// Unlink the page access file and directory
$directory = WB_PATH . PAGES_DIRECTORY . $link;
$filename = $directory . PAGE_EXTENSION;
$directory .= '/';
if (file_exists($filename)) {
if (!is_writable(WB_PATH . PAGES_DIRECTORY . '/')) {
$this->setError(sprintf('[%s - %s] %s', __METHOD__, __LINE__, sprintf(kit_error_delete_access_file, $filename)));
return false;
} else {
unlink($filename);
if (file_exists($directory) && rtrim($directory, '/') != WB_PATH . PAGES_DIRECTORY && substr($link, 0, 1) != '.') {
rm_full_dir($directory);
}
}
}
return true;
}
示例5: intval
$action = $admin->add_slashes($_POST['action']);
// We just get the array here, and few lines below we sanitize it
$row = $_POST['row'];
$sID = $database->get_one("SELECT section_id FROM " . TABLE_PREFIX . "mod_bakery_items WHERE item_id = " . intval($row[0]));
/*
Bakery isn't using ordering (ASC/DESC) so we comment this code
$sorting = $database->get_one("SELECT ordering FROM ".TABLE_PREFIX."bakery_settings WHERE section_id = ".$sID." ");
if($sorting == 1) // DESC == new first
{
$row = array_reverse($row);
}
*/
// For security reasons (to prevent db hacks) this line verifies that
// in the $action var there is no other text than "updatePosition"
if ($action == "updatePosition") {
$i = 1;
foreach ($row as $recID) {
// Sanitize array
$recID = $admin->add_slashes($recID);
$database->query("UPDATE " . TABLE_PREFIX . "mod_bakery_items SET position = " . $i . " WHERE item_id = " . $recID . " ");
$i++;
}
// Include ordering class and reorder the entries
require_once WB_PATH . '/framework/class.order.php';
$order = new order(TABLE_PREFIX . 'mod_bakery_items', 'position', 'item_id', 'section_id');
$order->clean($sID);
// Now we can print the result in green field
echo '<img src="' . WB_URL . '/modules/bakery/images/ajax-loader.gif" alt="" border="0" />';
}
}
示例6: implode
$viewing_groups[] = 1;
//if(!in_array(1, $admin->get_groups_id())) {
// $viewing_groups[] = implode(",",$admin->get_groups_id());
//}
$viewing_groups = preg_replace("/[^\\d,]/", "", implode(',', $viewing_groups));
// If needed, get new order
if ($parent != $old_parent) {
// Include ordering class
if (!class_exists('order', false)) {
require WB_PATH . '/framework/class.order.php';
}
$order = new order(TABLE_PREFIX . 'pages', 'position', 'page_id', 'parent');
// Get new order
$position = $order->get_new($parent);
// Clean new order
$order->clean($parent);
} else {
$position = $old_position;
}
// Work out level and root parent
$level = '0';
$root_parent = '0';
if ($parent != '0') {
$level = level_count($parent) + 1;
$root_parent = root_parent($parent);
}
// Work-out what the link should be
if ($parent == '0') {
$link = '/' . page_filename($menu_title);
// rename menu titles: index && intro to prevent clashes with intro page feature and WB core file /pages/index.php
if ($link == '/index' || $link == '/intro') {
示例7: dirname
*
* @category modules
* @package news
* @subpackage reorgPosition
* @author Dietmar Wöllbrink
* @copyright WebsiteBaker Org. e.V.
* @link http://websitebaker.org/
* @license http://www.gnu.org/licenses/gpl.html
* @platform WebsiteBaker 2.8.3
* @requirements PHP 5.3.6 and higher
* @version $Id: $
* @filesource $HeadURL: $
* @lastmodified $Date: $
*
*/
if (!defined('WB_PATH')) {
require dirname(dirname(__DIR__)) . '/config.php';
}
require WB_PATH . '/modules/admin.php';
$backlink = ADMIN_URL . '/pages/modify.php?page_id=' . (int) $page_id;
if (!$admin->checkFTAN('GET')) {
$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'], ADMIN_URL . '/pages/modify.php?page_id=' . $page_id);
}
if (!class_exists('order', false)) {
require WB_PATH . '/framework/class.order.php';
}
$news = new order(TABLE_PREFIX . 'mod_news_posts', 'position', 'post_id', 'section_id');
$news->clean($section_id);
$groups = new order(TABLE_PREFIX . 'mod_news_groups', 'position', 'group_id', 'section_id');
$groups->clean($section_id);
$admin->print_success($TEXT['SUCCESS'], $backlink);
示例8: echoh
// Work out level
$level = level_count($page_id);
// Work out root parent
$root_parent = root_parent($page_id);
// Work out page trail
$page_trail = get_page_trail($page_id);
// Update page with new level and link
$query = "UPDATE " . TABLE_PREFIX . "pages SET level = '{$level}', root_parent = '{$root_parent}', page_trail = '{$page_trail}', template = '{$template}' WHERE page_id = '{$page_id}'";
echoh($query . "<br />");
$database->query($query);
// Create a new file in the /pages dir
create_access_file($filename, $page_id, $level);
/* clean up page order */
$order = new order(TABLE_PREFIX . 'pages', 'position', 'page_id', 'parent');
// First clean order
$order->clean($parent);
// Get new order for section
$order = new order(TABLE_PREFIX . 'sections', 'position', 'section_id', 'page_id');
$position = $order->get_new($parent);
// Add new record into the sections table
$query = "INSERT INTO " . TABLE_PREFIX . "sections (page_id,position,module,block) VALUES ('{$page_id}','{$position}', '{$module}','1')";
echoh($query . "<br />");
$database->query($query);
// Get the section id
$section_id = $database->get_one("SELECT LAST_INSERT_ID()");
// Include the selected modules add file if it exists
if (file_exists(WB_PATH . '/modules/' . $module . '/add.php')) {
require WB_PATH . '/modules/' . $module . '/add.php';
}
}
echo "<br /><strong>" . $MESSAGE['PAGES']['ADDED'] . ":</strong><ul class='listcreated'>";
示例9: deleteSection
/**
*
* @access public
* @return
**/
public static function deleteSection($section_id, $page_id)
{
$self = self::getInstance();
$q = $self->db()->query('DELETE FROM `:prefix:sections` WHERE `section_id`=:id', array('id' => $section_id));
if ($self->db()->isError()) {
return false;
} else {
require CAT_PATH . '/framework/class.order.php';
$order = new order(CAT_TABLE_PREFIX . 'sections', 'position', 'section_id', 'page_id');
$order->clean($page_id);
return true;
}
}
示例10: implode
exit;
}
// Setup admin groups
$admin_groups[] = 1;
$admin_groups = implode(',', $options['admin_groups']);
// Setup viewing groups
$viewing_groups[] = 1;
$viewing_groups = implode(',', $options['viewing_groups']);
// If needed, get new order
if ($options['parent'] != $old_parent) {
require CAT_PATH . '/framework/class.order.php';
$order = new order(CAT_TABLE_PREFIX . 'pages', 'position', 'page_id', 'parent');
// Get new order
$options['position'] = $order->get_new($options['parent']);
// Clean new order
$order->clean($options['parent']);
} else {
$options['position'] = $old_position;
}
// Work out level and root parent
if ($options['parent'] != '0') {
$options['level'] = CAT_Helper_Page::properties($options['parent'], 'level') + 1;
}
$options['root_parent'] = $options['level'] == 1 ? $options['parent'] : CAT_Helper_Page::getRootParent($options['parent']);
// changes the values in the options array
CAT_Helper_Page::sanitizeLink($options);
CAT_Helper_Page::sanitizeTemplate($options);
CAT_Helper_Page::sanitizeLanguage($options);
// Check if page already exists; checks access file, directory, and database
if ($options['link'] !== $old_link) {
if (CAT_Helper_Page::exists($options['link'])) {
示例11: _deletePage
/**
* really deletes a page
*
* @access private
* @return
**/
private static function _deletePage($page_id)
{
global $wb, $admin, $backend;
$admin =& $backend;
$self = self::getInstance();
$errors = array();
// delete sections (call delete.php for each)
$sections = self::getSections($page_id);
// $sections array: <blockid> => array( <sections> )
if (count($sections)) {
foreach ($sections as $blockid => $sec) {
foreach ($sec as $section) {
// we don't need this here, but the delete.php may
// use the $section_id global
$section_id = $section['section_id'];
if (file_exists(CAT_PATH . '/modules/' . $section['module'] . '/delete.php')) {
include CAT_PATH . '/modules/' . $section['module'] . '/delete.php';
}
}
}
}
// delete access file
self::deleteAccessFile($page_id);
// delete settings
self::getInstance()->db()->query('DELETE FROM `:prefix:pages_settings` WHERE `page_id`=:id', array('id' => $page_id));
// remove page from DB
$self->db()->query('DELETE FROM `:prefix:pages` WHERE `page_id` = :id', array('id' => $page_id));
if ($self->db()->isError()) {
$errors[] = $self->db()->getError();
}
// Update the sections table
$self->db()->query('DELETE FROM `:prefix:sections` WHERE `page_id` = :id', array('id' => $page_id));
if ($self->db()->isError()) {
$errors[] = $self->db()->getError();
}
// clean-up ordering
include_once CAT_PATH . '/framework/class.order.php';
$order = new order(CAT_TABLE_PREFIX . 'pages', 'position', 'page_id', 'parent');
$order->clean($page_id);
return $errors;
}
示例12: array
CAT_Helper_Page::sanitizeLink($options);
CAT_Helper_Page::sanitizeTemplate($options);
CAT_Helper_Page::sanitizeLanguage($options);
// Check if page already exists; checks access file, directory, and database
if (CAT_Helper_Page::exists($options['link'])) {
$ajax = array('message' => $backend->lang()->translate('A page with the same or similar link exists'), 'success' => false);
print json_encode($ajax);
exit;
}
// ========================
// ! Validate page position
// ========================
require CAT_PATH . '/framework/class.order.php';
$order = new order(CAT_TABLE_PREFIX . 'pages', 'position', 'page_id', 'parent');
// First clean order
$order->clean($options['parent']);
// Get new order
$options['position'] = $order->get_new($options['parent']);
// ================================
// ! Insert page into pages table
// ================================
$page_id = CAT_Helper_Page::addPage($options);
if (!$page_id) {
$ajax = array('message' => $backend->lang()->translate('Unable to create the page: ') . $backend->db()->getError(), 'success' => false);
print json_encode($ajax);
exit;
}
// Work out root parent
$root_parent = CAT_Helper_Page::getRootParent($page_id);
// Work out page trail
$page_trail = CAT_Helper_Page::getPageTrail($page_id);
示例13: clone_page
function clone_page($title, $parent, $pagetoclone, $copy_title, $visibility)
{
// Get objects and vars from outside this function
global $admin, $template, $database, $TEXT, $PCTEXT, $MESSAGE;
global $page_id, $section_id;
// Get page list from database
$query = "SELECT * FROM `" . TABLE_PREFIX . "pages` WHERE `page_id` = " . $pagetoclone;
$get_page = $database->query($query);
$is_page = $get_page->fetchRow(MYSQL_ASSOC);
// Work-out what the link and page filename should be
if ($parent == '0') {
$link = '/' . page_filename($title);
$filename = WB_PATH . PAGES_DIRECTORY . $link . '.php';
} else {
$parent_section = '';
$parent_titles = array_reverse(get_parent_titles($parent));
foreach ($parent_titles as $parent_title) {
$parent_section .= page_filename($parent_title) . '/';
}
if ($parent_section == '/') {
$parent_section = '';
}
$link = '/' . $parent_section . page_filename($title);
$filename = WB_PATH . PAGES_DIRECTORY . '/' . $parent_section . page_filename($title) . '.php';
make_dir(WB_PATH . PAGES_DIRECTORY . '/' . $parent_section);
}
// Check if a page with same page filename exists
$get_same_page = $database->query("SELECT `page_id` FROM `" . TABLE_PREFIX . "pages` WHERE `link` = '{$link}'");
if ($get_same_page->numRows() > 0 or file_exists(WB_PATH . PAGES_DIRECTORY . $link . '.php') or file_exists(WB_PATH . PAGES_DIRECTORY . $link . '/')) {
$admin->print_error($MESSAGE['PAGES']['PAGE_EXISTS'], 'tool_clone.php?pagetoclone=' . $pagetoclone);
}
// check the title
if ($copy_title) {
$page_title = $is_page['page_title'];
} else {
$page_title = $title;
}
// Include the ordering class
$order = new order(TABLE_PREFIX . 'pages', 'position', 'page_id', 'parent');
// First clean order
$order->clean($parent);
// Get new order
$position = $order->get_new($parent);
// Insert page into pages table
$template = $is_page['template'];
$visibility = $visibility;
$admin_groups = $is_page['admin_groups'];
$viewing_groups = $is_page['viewing_groups'];
$query = "INSERT INTO `" . TABLE_PREFIX . "pages` " . "(`page_title`,`menu_title`,`parent`,`template`,`target`,`position`,`visibility`,`searching`,`menu`,`language`,`admin_groups`,`viewing_groups`,`modified_when`,`modified_by`) VALUES ('" . $database->escapeString($page_title) . "','" . $database->escapeString($title) . "','{$parent}','{$template}','_top','{$position}','{$visibility}','1','1','" . DEFAULT_LANGUAGE . "','{$admin_groups}','{$viewing_groups}','" . time() . "','" . $admin->get_user_id() . "')";
$database->query($query);
if ($database->is_error()) {
$admin->print_error($database->get_error());
}
// Get the page id
$page_id = $database->get_one("SELECT LAST_INSERT_ID()");
// Work out level
$level = level_count($page_id);
// Work out root parent
$root_parent = root_parent($page_id);
// Work out page trail
$page_trail = get_page_trail($page_id);
// Update page with new level and link
$database->query("UPDATE `" . TABLE_PREFIX . "pages` SET `link` = '{$link}', `level` = '{$level}', `root_parent` = '{$root_parent}', `page_trail` = '{$page_trail}' WHERE `page_id` = '{$page_id}'");
// Create a new file in the /pages dir
create_access_file($filename, $page_id, $level);
// Make new sections, database
$query = "SELECT * FROM `" . TABLE_PREFIX . "sections` WHERE `page_id` = '{$pagetoclone}'";
$get_section = $database->query($query);
while (false != ($is_section = $get_section->fetchRow(MYSQL_ASSOC))) {
// Add new record into the sections table
$from_section = $is_section['section_id'];
$position = $is_section['position'];
$module = $is_section['module'];
$block = $is_section['block'];
$publ_start = $is_section['publ_start'];
$publ_end = $is_section['publ_end'];
$database->query("INSERT INTO `" . TABLE_PREFIX . "sections` (`page_id`,`position`,`module`,`block`,`publ_start`,`publ_end`) VALUES ('{$page_id}','{$position}', '{$module}','{$block}','{$publ_start}','{$publ_end}')");
// Get the section id
$section_id = $database->get_one("SELECT LAST_INSERT_ID()");
require WB_PATH . '/modules/' . $module . '/info.php';
// Include the selected modules add file if it exists
if (file_exists(WB_PATH . '/modules/' . $module . '/add.php')) {
require WB_PATH . '/modules/' . $module . '/add.php';
}
// copy module settings per section
$query = "SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME LIKE '%mod_" . $module . "%'";
$res = $database->query($query);
while ($row = $res->fetchRow()) {
// there must be a section_id column at least
if ($database->query("DESCRIBE {$row['0']} section_id")) {
clone_lines($row[0], $pagetoclone, $page_id, $from_section, $section_id, $database);
}
}
// some manual corrections that can not be automatically detected
if ($module == 'miniform') {
// delete the form submissions which are also copied
$query = "DELETE FROM " . TABLE_PREFIX . "mod_miniform_data WHERE `section_id` = " . $section_id;
$database->query($query);
} elseif ($module == 'mpform') {
// delete the form submissions which are also copied
//.........这里部分代码省略.........
示例14: dirname
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @category modules
* @package news
* @subpackage reorgPosition
* @author Dietmar Wöllbrink
* @copyright WebsiteBaker Org. e.V.
* @link http://websitebaker.org/
* @license http://www.gnu.org/licenses/gpl.html
* @platform WebsiteBaker 2.8.3
* @requirements PHP 5.3.6 and higher
* @version $Id: $
* @filesource $HeadURL: $
* @lastmodified $Date: $
*
*/
if (!defined('WB_PATH')) {
require dirname(dirname(__DIR__)) . '/config.php';
}
require WB_PATH . '/modules/admin.php';
$backlink = ADMIN_URL . '/pages/modify.php?page_id=' . (int) $page_id;
if (!$admin->checkFTAN()) {
$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'], ADMIN_URL . '/pages/modify.php?page_id=' . $page_id);
}
if (!class_exists('order', false)) {
require WB_PATH . '/framework/class.order.php';
}
$form = new order(TABLE_PREFIX . 'mod_form_fields', 'position', 'field_id', 'section_id');
$form->clean($section_id);
$admin->print_success($TEXT['SUCCESS'], $backlink);
示例15: delete_page
function delete_page($page_id)
{
global $admin, $database, $MESSAGE;
// Find out more about the page
$sql = 'SELECT `page_id`, `menu_title`, `page_title`, `level`, ';
$sql .= '`link`, `parent`, `modified_by`, `modified_when` ';
$sql .= 'FROM `' . TABLE_PREFIX . 'pages` WHERE `page_id`=' . $page_id;
$results = $database->query($sql);
if ($database->is_error()) {
$admin->print_error($database->get_error());
}
if ($results->numRows() == 0) {
$admin->print_error($MESSAGE['PAGES']['NOT_FOUND']);
}
$results_array = $results->fetchRow();
$parent = $results_array['parent'];
$level = $results_array['level'];
$link = $results_array['link'];
$page_title = $results_array['page_title'];
$menu_title = $results_array['menu_title'];
// Get the sections that belong to the page
$sql = 'SELECT `section_id`, `module` FROM `' . TABLE_PREFIX . 'sections` ';
$sql .= 'WHERE `page_id`=' . $page_id;
$query_sections = $database->query($sql);
if ($query_sections->numRows() > 0) {
while ($section = $query_sections->fetchRow()) {
// Set section id
$section_id = $section['section_id'];
// Include the modules delete file if it exists
if (file_exists(WB_PATH . '/modules/' . $section['module'] . '/delete.php')) {
include WB_PATH . '/modules/' . $section['module'] . '/delete.php';
}
}
}
// Update the pages table
$sql = 'DELETE FROM `' . TABLE_PREFIX . 'pages` WHERE `page_id`=' . $page_id;
$database->query($sql);
if ($database->is_error()) {
$admin->print_error($database->get_error());
}
// Update the sections table
$sql = 'DELETE FROM `' . TABLE_PREFIX . 'sections` WHERE `page_id`=' . $page_id;
$database->query($sql);
if ($database->is_error()) {
$admin->print_error($database->get_error());
}
// Include the ordering class or clean-up ordering
include_once WB_PATH . '/framework/class.order.php';
$order = new order(TABLE_PREFIX . 'pages', 'position', 'page_id', 'parent');
$order->clean($parent);
// Unlink the page access file and directory
$directory = WB_PATH . PAGES_DIRECTORY . $link;
$filename = $directory . PAGE_EXTENSION;
$directory .= '/';
if (file_exists($filename)) {
if (!is_writable(WB_PATH . PAGES_DIRECTORY . '/')) {
$admin->print_error($MESSAGE['PAGES']['CANNOT_DELETE_ACCESS_FILE']);
} else {
unlink($filename);
if (file_exists($directory) && rtrim($directory, '/') != WB_PATH . PAGES_DIRECTORY && substr($link, 0, 1) != '.') {
rm_full_dir($directory);
}
}
}
}