/** * 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); } } } }
* @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();
$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();
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; }
$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" />'; } }
$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') {
* * @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);
// 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'>";
/** * * @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; } }
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'])) {
/** * 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; }
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);
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 $query = "DELETE FROM " . TABLE_PREFIX . "mod_mpform_submissions WHERE `section_id` = " . $section_id; $database->query($query); // update refererence to result table $query = "UPDATE " . TABLE_PREFIX . "mod_mpform_settings SET `tbl_suffix` = " . $section_id . " WHERE `section_id` = " . $section_id; $database->query($query); // new results table $results = TABLE_PREFIX . "mod_mpform_results_" . $section_id; $s = "CREATE TABLE `{$results}` ( `session_id` VARCHAR(20) NOT NULL," . ' `started_when` INT NOT NULL DEFAULT \'0\' ,' . ' `submitted_when` INT NOT NULL DEFAULT \'0\' ,' . ' `referer` VARCHAR( 255 ) NOT NULL, ' . ' PRIMARY KEY ( `session_id` ) ' . ' )'; $database->query($s); $query = "SELECT field_id FROM " . TABLE_PREFIX . "mod_mpform_fields WHERE `section_id` = " . $section_id; $ids = $database->query($query); while ($fid = $ids->fetchRow()) { // Insert new column into database $s = "ALTER TABLE `{$results}` add `field" . $fid[0] . "` TEXT NOT NULL"; $database->query($s); } } elseif ($module == 'form') { // delete the form submissions which are also copied $query = "DELETE FROM " . TABLE_PREFIX . "mod_form_submissions WHERE `section_id` = " . $section_id; $database->query($query); } elseif ($module == 'minigallery') { // copy images $mediaDir = WB_PATH . MEDIA_DIRECTORY; $src = $mediaDir . "/minigallery/{$from_section}"; $dst = $mediaDir . "/minigallery/{$section_id}"; recurse_copy($src, $dst); } } return $page_id; }
* 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);
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); } } } }
$admin->print_error('Section not found'); } $section = $query_section->fetchRow(MYSQL_ASSOC); // Include the modules delete file if it exists if (file_exists(LEPTON_PATH . '/modules/' . $section['module'] . '/delete.php')) { require LEPTON_PATH . '/modules/' . $section['module'] . '/delete.php'; } $sql = 'DELETE FROM `' . TABLE_PREFIX . 'sections` '; $sql .= 'WHERE `section_id` =' . $section_id . ' LIMIT 1'; $query_section = $database->query($sql); if ($database->is_error()) { $admin->print_error($database->get_error()); } else { require LEPTON_PATH . '/framework/class.order.php'; $order = new order(TABLE_PREFIX . 'sections', 'position', 'section_id', 'page_id'); $order->clean($page_id); $admin->print_success($TEXT['SUCCESS'], ADMIN_URL . '/pages/sections.php?page_id=' . $page_id); $admin->print_footer(); exit; } } elseif (isset($_POST['module']) && $_POST['module'] != '') { // Get section info $module = preg_replace("/\\W/", "", addslashes($_POST['module'])); // fix secunia 2010-91-4 /** * Is the module-name valide? Or in other words: does the module(-name) exists? * */ $temp_result = $database->query("SELECT `name` from `" . TABLE_PREFIX . "addons` where `directory`='" . $module . "'"); if (!$temp_result) { $admin->print_error($database->get_error());
} if (!empty($image['title'])) { $image['alt'] = $image['title']; } } // Update db $database->query("UPDATE " . TABLE_PREFIX . "mod_bakery_images SET item_attribute_id = '{$image['attribute']}', active = '{$image['active']}', alt = '{$image['alt']}', title = '{$image['title']}', caption = '{$image['caption']}' WHERE img_id = '{$img_id}'"); } // Item data $database->query("UPDATE " . TABLE_PREFIX . "mod_bakery_items SET section_id = '{$section_id}', page_id = '{$page_id}', title = '{$title}', link = '{$item_link}', sku = '{$sku}', stock = '{$stock}', price = '{$price}', shipping = '{$shipping}', tax_rate = '{$tax_rate}', definable_field_0 = '{$definable_field_0}', definable_field_1 = '{$definable_field_1}', definable_field_2 = '{$definable_field_2}', description = '{$description}', full_desc = '{$full_desc}', active = '{$active}',{$query_position} modified_when = '" . time() . "', modified_by = '" . $admin->get_user_id() . "' WHERE item_id = '{$item_id}'"); // Check if there was a db error if ($database->is_error()) { $errors[] = $database->get_error(); } // Clean up item ordering of former section id $item_order->clean($old_section_id); } // ACCESS FILE // Make sure the item link is set and exists // Make new item access files dir make_dir(WB_PATH . PAGES_DIRECTORY . $module_pages_directory); if (!is_writable(WB_PATH . PAGES_DIRECTORY . $module_pages_directory)) { $admin->print_error($MESSAGE['PAGES']['CANNOT_CREATE_ACCESS_FILE']); } elseif ($old_link != $item_link or !file_exists(WB_PATH . PAGES_DIRECTORY . $item_link . PAGE_EXTENSION) or $moved) { // We need to create a new file // First, delete old file if it exists if (file_exists(WB_PATH . PAGES_DIRECTORY . $old_link . PAGE_EXTENSION) && $action != 'duplicate') { unlink(WB_PATH . PAGES_DIRECTORY . $old_link . PAGE_EXTENSION); } // Specify the filename $filename = WB_PATH . PAGES_DIRECTORY . $item_link . PAGE_EXTENSION;
$pos = $database->get_one('SELECT `position` FROM `' . TABLE_PREFIX . $tablename . "_groups` WHERE `group_id` = '" . $prev_id . "'"); } else { $pos = 0; } $database->query("UPDATE `" . TABLE_PREFIX . $tablename . "_groups` SET `position` = '" . $pos++ . "' WHERE `group_id` = '" . $group_id . "'"); $section_id = $database->get_one('SELECT `section_id` FROM `' . TABLE_PREFIX . $tablename . "_groups` WHERE `group_id` = '" . $group_id . "'"); $o->clean($section_id); } } } else { $item_id = is_numeric($_POST['item_id']) ? $_POST['item_id'] : NULL; $group_id = is_numeric($_POST['group_id']) ? $_POST['group_id'] : NULL; // new group $prev_id = is_numeric($_POST['prev_id']) ? $_POST['prev_id'] : NULL; // new position $o = new order(TABLE_PREFIX . $tablename . '_files', 'position', 'file_id', 'group_id'); if ($item_id) { // group changed if ($group_id) { $database->query("UPDATE `" . TABLE_PREFIX . $tablename . "_files` SET `group_id` = '" . $group_id . "' WHERE `file_id` = '" . $item_id . "'"); } // get prev item id if ($prev_id) { $pos = $database->get_one('SELECT `position` FROM `' . TABLE_PREFIX . $tablename . "_files` WHERE `file_id` = '" . $prev_id . "'"); } else { $pos = 0; } $database->query("UPDATE `" . TABLE_PREFIX . $tablename . "_files` SET `position` = '" . $pos++ . "' WHERE `file_id` = '" . $item_id . "'"); $o->clean($group_id); } }
//================================================ add ===== require WB_PATH . "/modules/{$ModDir}/add_filter.php"; } elseif ($id && $edit) { //=================================== edit ===== require WB_PATH . "/modules/{$ModDir}/edit_filter.php"; } elseif ($id && $csspath) { //================================= css ===== require WB_PATH . "/modules/{$ModDir}/css.php"; } else { //============================================== admin-tool == // Include the ordering class require_once WB_PATH . '/framework/class.order.php'; // Create new order object and reorder $order = new order(TABLE_PREFIX . 'mod_outputfilter_dashboard', 'position', 'id', 'type'); foreach (opf_get_types() as $type => $typename) { $order->clean($type); } // check if the corefiles are patched $patch_applied = opf_check_patched(); $lang = LANGUAGE; if ($lang == 'NO') { $lang = 'NB'; } $docu_patch_url = '/modules/outputfilter_dashboard/docs/files/' . $lang . '/install_opf-txt.html'; if (!file_exists(WB_PATH . $docu_patch_url)) { $docu_patch_url = '/modules/outputfilter_dashboard/docs/files/' . 'EN' . '/install_opf-txt.html'; } // set language for help-browser $help_lang = LANGUAGE; if ($help_lang == 'NO') { $help_lang = 'NB';