public static function loadEngineTasks() { CodonRewrite::ProcessRewrite(); Vars::setParameters(); self::$activeModule = strtoupper(CodonRewrite::$current_module); Config::loadSettings(); self::loadModules(); }
/** * Process the rewrite rules, store the results * into self::$get */ public static function ProcessRewrite() { $URL = $_SERVER['REQUEST_URI']; # Get everything after the .php/ and before the ? $params = explode('.php/', $URL); $preg_match = $params[1]; $params = explode('?', $preg_match); $split_parameters = $params[0]; # Now check if there's anything there (we didn't just have # index.php?query_string=... # If that's all, then we grab a configuration setting that # specifies the default rewrite, ie: news/showall # Which would eq. passing index.php/news/showall if ($split_parameters == '') { $split_parameters = CODON_DEFAULT_MODULE; } # Now we split it all out, and store the peices self::$peices = explode('/', $split_parameters); $module_name = strtolower(self::$peices[0]); if ($module_name == '') { $module_name = $_GET['module']; } self::$current_module = $module_name; self::$current_action = strtolower(self::$peices[1]); unset(self::$peices[0]); unset(self::$peices[1]); # Restored, some addons are relying on this $_GET['module'] = $module_name; self::$controller = new stdClass(); self::$controller->module = $module_name; self::$controller->controller = $module_name; self::$controller->function = self::$current_action; self::$controller->action = self::$current_action; self::$controller->page = self::$current_action; self::$params = array(); foreach (self::$peices as $peice) { self::$params[] = $peice; } # Create the object to hold all of our stuff self::$get = new stdClass(); //self::$get->action = self::$current_action; # If we haven't specified specific rules for a module, # Then we use the rules we made for "default" if (!array_key_exists($module_name, self::$rewrite_rules)) { $module_name = 'default'; } # This parses now the rules for a specific module //self::ProcessModuleRewrite($module_name); # And this tacks on our $_GET rules parse_str($_SERVER['QUERY_STRING'], $get_extra); $_GET = array_merge($_GET, $get_extra); # Add the $_GET to our object foreach ($_GET as $key => $value) { self::$get->{$key} = $value; } self::$run = true; }