/** * Load all module sets and include required modules.php files * @param string $page page id * @return void */ public function load_module_sets($page) { $this->load_modules('Hm_Handler_Modules', $this->handlers, $page); $this->load_modules('Hm_Output_Modules', $this->outputs, $page); $active_mods = array_unique(array_merge($this->get_active_mods(Hm_Output_Modules::get_for_page($page)), $this->get_active_mods(Hm_Handler_Modules::get_for_page($page)))); if (!count($active_mods)) { Hm_Functions::cease('No module assignments found'); } $mods = explode(',', $this->site_config->get('modules', '')); $this->load_module_set_files($mods, $active_mods); }
/** * Perform an HTTP redirect * @param string $url url to redirect to * @param int $status current HTTP status * @return void */ public static function page_redirect($url, $status = false) { if (DEBUG_MODE) { Hm_Debug::add(sprintf('Redirecting to %s', $url)); Hm_Debug::load_page_stats(); Hm_Debug::show('log'); } if ($status == 303) { Hm_Debug::add('Redirect loop found'); Hm_Functions::cease('Redirect loop discovered'); } Hm_Functions::header('HTTP/1.1 303 Found'); Hm_Functions::header('Location: ' . $url); return Hm_Functions::cease(); }
/** * Validate a form key. If this is a non-empty POST form from an * HTTP request or AJAX update, it will take the user to the home * page if the page_key value is either not present or not valid * @return void */ public function process_key() { if (empty($this->request->post)) { return false; } $key = array_key_exists('hm_page_key', $this->request->post) ? $this->request->post['hm_page_key'] : false; $valid = Hm_Request_Key::validate($key); if (!$valid) { if ($this->request->type == 'AJAX') { if (DEBUG_MODE) { Hm_Debug::add('REQUEST KEY check failed'); Hm_Debug::load_page_stats(); Hm_Debug::show('log'); } Hm_Functions::cease(json_encode(array('status' => 'not callable'))); return 'exit'; } else { if ($this->session->loaded) { $this->session->destroy($this->request); } Hm_Debug::add('REQUEST KEY check failed'); Hm_Dispatch::page_redirect('?page=home'); return 'redirect'; } } return false; }