/** * handle user request * * @author Michael Hamann <*****@*****.**> * @author Gary Owen <*****@*****.**> */ function handle() { global $ID; global $ACT; global $INFO; // populate options with default values $this->opts['ns'] = getNS($ID); $this->opts['name'] = noNS($ID); $this->opts['ns_for_page'] = $INFO['namespace']; $this->opts['newns'] = ''; $this->opts['newname'] = noNS($ID); $this->opts['targetns'] = getNS($ID); $this->opts['newnsname'] = ''; $this->opts['move_type'] = 'page'; $this->opts['contenttomove'] = 'pages'; $this->helper = $this->loadHelper('move', true); if (!$this->helper) return; $this->ns_opts = $this->helper->get_namespace_move_opts(); // Only continue when the form was submitted if ($_SERVER['REQUEST_METHOD'] != 'POST') { return; } if (isset($_POST['continue_namespace_move']) || isset($_POST['skip_continue_namespace_move'])) { if (isset($_POST['skip_continue_namespace_move'])) { $this->helper->skip_namespace_move_item(); } $this->ns_opts['remaining'] = $this->helper->continue_namespace_move(); $this->ns_move_state = ($this->ns_opts['remaining'] === false ? 'error': 'continued'); if ($this->ns_opts['remaining'] === 0) { $ID = $this->helper->getNewID($INFO['id'], $this->opts['ns'], $this->opts['newns']); $ACT = 'show'; } return; } elseif (isset($_POST['abort_namespace_move'])) { $this->helper->abort_namespace_move(); $this->ns_opts = false; return; } // Store the form data in the options and clean the submitted data. if (isset($_POST['ns_for_page'])) $this->opts['ns_for_page'] = cleanID((string)$_POST['ns_for_page']); if (isset($_POST['newns'])) $this->opts['newns'] = cleanID((string)$_POST['newns']); if (isset($_POST['newname'])) $this->opts['newname'] = cleanID((string)$_POST['newname']); if (isset($_POST['targetns'])) $this->opts['targetns'] = cleanID((string)$_POST['targetns']); if (isset($_POST['newnsname'])) $this->opts['newnsname'] = cleanID((string)$_POST['newnsname']); if (isset($_POST['move_type'])) $this->opts['move_type'] = (string)$_POST['move_type']; if (isset($_POST['contenttomove']) && in_array($_POST['contenttomove'], array('pages', 'media', 'both'), true)) $this->opts['contenttomove'] = $_POST['contenttomove']; // check the input for completeness if( $this->opts['move_type'] == 'namespace' ) { if ($this->opts['targetns'] == '') { $this->opts['newns'] = $this->opts['newnsname']; } else { $this->opts['newns'] = $this->opts['targetns'].':'.$this->opts['newnsname']; } $started = $this->helper->start_namespace_move($this->opts); if ($started !== false) { $this->ns_opts = $this->helper->get_namespace_move_opts(); $this->ns_move_state = 'started'; } } else { // check that the pagename is valid if ($this->opts['newname'] == '' ) { msg($this->getLang('badname'), -1); return; } if ($this->opts['newns'] === '') { $this->opts['newns'] = $this->opts['ns_for_page']; } if ($this->helper->move_page($this->opts)) { // Set things up to display the new page. $ID = $this->opts['new_id']; $ACT = 'show'; // this triggers a redirect to the page } } }