/** * Function used to find a page by name * * This function will attempt to retrieve a valid page from the page list. * * @param string $name The name of the page (index by default) */ private static function HandlePage($name = 'index') { self::SetError(404, 'ERROR_PAGE_NOT_FOUND'); // Set 404 incase anything goes wrong if (preg_match(LWC::REGEX_PATH, $name) && !preg_match(LWC::REGEX_PATH_BREAKOUT, $name)) { if (is_array(self::$pages)) { foreach (self::$pages as $page) { $key = $name; // Take a local copy of the name so we can modify it if ($page['type'] == 'handler') { $page['parameter'] = basename($name); // Page is a handler page, set real parameter... $key = dirname($name); // ...and key. } if ($page['key'] == $key) { if (session('rank') >= $page['minrank'] && session('rank') <= $page['maxrank']) { $page['title'] = tt($page['title']); // Translate page title self::$page = $page; // Set the active page } else { self::SetError(403, 'ERROR_PAGE_FORBIDDEN'); } // User is not allowed to access this page } } } } }