/** !! * Export the selected modules so that they will be displayed by default * @param array $request_data form contain the modules */ private function handlePOST_exportModuleSettings($request_data) { $page_templates = $this->page_templates; $form_data = $request_data['form_data']; $page_template = $page_templates[$form_data['page_template']]; $left = null; $middle = null; $right = null; $new_settings = array(); foreach (array('left', 'middle', 'right') as $column) { if (isset($form_data[$column])) { foreach ($form_data[$column] as $module_data) { if (!empty($module_data['name'])) { if ($module_data['column'] == 'left') { $left[] = $module_data; } elseif ($module_data['column'] == 'middle') { $middle[] = $module_data; } elseif ($module_data['column'] == 'right') { $right[] = $module_data; } else { } } } } } if ($left) { usort($left, "sortByPosition"); foreach ($left as $key => $lmodule) { if (isset($lmodule['name'])) { $left[$key] = $lmodule['name']; } } } if ($middle) { usort($middle, "sortByPosition"); foreach ($middle as $key => $mmodule) { if (isset($mmodule['name'])) { $middle[$key] = $mmodule['name']; } } } if ($right) { usort($right, "sortByPosition"); foreach ($right as $key => $rmodule) { if (isset($rmodule['name'])) { $right[$key] = $rmodule['name']; } } } $new_settings['left'] = $left; $new_settings['middle'] = $middle; $new_settings['right'] = $right; $new_settings['page_template'] = $page_template; $dynamic_page = new DynamicPage($this->pid); $dynamic_page->save_page = false; $dynamic_page->initialize($new_settings); $page_settings = $dynamic_page->saveXML(); unset($request_data['form_data']); $file = pathinfo($dynamic_page->xml_file, PATHINFO_BASENAME); /* $content_length = strlen($page_settings); header("Content-Type: application/XML; charset: UTF-8"); header("Cache-Control: no-cache, no-store, max-age=0, must-revalidate"); header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); header("Pragma: no-cache"); header("Content-Length: " . (int)$content_length); flush(); print($page_settings); */ // exit; $header_file = strstr($_SERVER['HTTP_USER_AGENT'], 'MSIE') ? preg_replace('/\\./', '%2e', $file, substr_count($file, '.') - 1) : $file; header("Pragma: public"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Cache-Control: public", false); header("Content-Description: File Transfer"); header("Content-Type: application/XML; charset: UTF-8"); header("Accept-Ranges: bytes"); header("Content-Disposition: attachment; filename=\"" . $header_file . "\";"); header("Content-Transfer-Encoding: binary"); header("Content-Length: " . strlen($page_settings)); flush(); print $page_settings; $this->setupCustomizeModuleSettings($request_data); }
/** !! * After submitting page changes fill out the array * { @link $new_page_settings } with the different pages elements: * left, right, middle, javascripts and css. Afterwards call * { @link set_inner_template() } and { @link generate_inner_html() } to * update the page html. * @param array $request_data data from the server to configure the page with */ function handlePOSTPageSubmit($request_data) { global $error_msg; if (isset($request_data['form_data'])) { $new_page_settings = $request_data['form_data']; $new_page_settings['left'] = array(); $new_page_settings['middle'] = array(); $new_page_settings['right'] = array(); $new_page_settings['javascripts'] = array(); $new_page_settings['page_css'] = array(); if (!empty($request_data['form_data']['left'])) { $new_page_settings['left'] = explode(',', $request_data['form_data']['left']); } if (!empty($request_data['form_data']['middle'])) { $new_page_settings['middle'] = explode(',', $request_data['form_data']['middle']); } if (!empty($request_data['form_data']['right'])) { $new_page_settings['right'] = explode(',', $request_data['form_data']['right']); } if (!empty($request_data['form_data']['javascripts'])) { $new_page_settings['javascripts'] = explode(',', $request_data['form_data']['javascripts']); } if (!empty($request_data['form_data']['page_css'])) { $new_page_settings['page_css'] = explode(',', $request_data['form_data']['page_css']); } if (!empty($request_data['form_data']['navigation_code'])) { $code = trim($request_data['form_data']['navigation_code']); $new_page_settings['navigation_code'] = $code; } if (!empty($request_data['form_data']['boot_code'])) { $bcode = trim($request_data['form_data']['boot_code']); $new_page_settings['boot_code'] = $bcode; } $page_settings = array(); try { $dyn = new DynamicPage($new_page_settings['page_id']); $dyn->initialize(); $save_page = isset($request_data['save_page']) ? true : false; $page_settings = $dyn->buildPageSettings($new_page_settings); $serialized_settings = serialize($page_settings); $this->set_inner_template('submit_success_inner.tpl'); $this->inner_HTML = $this->generate_inner_html(array('page_id' => $this->page_id, 'page_settings' => $page_settings, 'serialized_settings' => $serialized_settings, 'save_page' => $save_page, 'adm_permissions' => $this->adm_permissions)); } catch (DynamicPageException $e) { $error_msg = $e->getMessage(); } } }
if (method_exists($obj, $handler_function)) { $obj->{$handler_function}($app->request_method, $app->getRequestData()); } } } global $use_theme; // Theme name defined in page XML config file try { $save_page = $app->getRequestParam('save'); $new_page_settings = $app->getRequestParam('page_settings') ? unserialize(urldecode($app->getRequestParam('page_settings'))) : null; $cache_id = "dyn_page_{$req_page}"; if (FileCache::is_cached($cache_id)) { $dynamic_page = FileCache::fetch($cache_id); $page_settings = $dynamic_page->buildPageSettings($new_page_settings); } else { $dynamic_page = new DynamicPage($req_page); $dynamic_page->initialize(); $dynamic_page->save_page = $save_page; $page_settings = $dynamic_page->buildPageSettings($new_page_settings); FileCache::store($cache_id, $dynamic_page, 1200); } // Force login if we're on a private network, unless we're on login.php, register.php or dologin.php. $login_required = $page_settings['page_mode'] != 'public' ? true : false; if (!$login_required && PA::$network_info->is_private() && !@$login_never_required) { $login_required = TRUE; } // Check user session / login status, and redirect to login page (or // request page, for private networks) if required. if (!check_session($login_required, @$page_redirect_function)) { if ($login_required) { exit;