/** * Dispatches to the correct SimpleID function based on the request path. The * request path usually comes from the q parameter in the query string (which may * be inserted by mod_rewrite), but can come from other functions as well. * * @param string $q the request path */ function simpleid_route($q) { $routes = array('continue' => 'simpleid_continue', 'login' => 'user_login', 'logout' => 'user_logout', 'my/dashboard' => 'page_dashboard', 'my/sites' => 'page_sites', 'my/profile' => 'page_profile', 'openid/consent' => 'simpleid_openid_consent', 'ppid/(.*)' => 'user_ppid_page', 'user' => 'user_public_page', 'user/(.+)' => 'user_public_page', 'xrds/(.*)' => 'user_xrds', 'xrds' => 'simpleid_xrds'); $routes = array_merge($routes, extension_invoke_all('routes'), array('.*' => 'simpleid_index')); simpleweb_run($routes, $q); }
/** * Entry point for SimpleID upgrade script. * * @see user_init() */ function upgrade_start() { global $xtpl, $GETPOST; $xtpl = new XTemplate('html/template.xtpl'); $xtpl->assign('version', SIMPLEID_VERSION); $xtpl->assign('base_path', get_base_path()); $xtpl->assign('css', '@import url(' . get_base_path() . 'html/upgrade.css);'); // Check if the configuration file has been defined if (!defined('SIMPLEID_BASE_URL')) { indirect_fatal_error('No configuration file found. See the <a href="http://simpleid.koinic.net/documentation/getting-started">manual</a> for instructions on how to set up a configuration file.'); } if (!is_dir(SIMPLEID_IDENTITIES_DIR)) { indirect_fatal_error('Identities directory not found. See the <a href="http://simpleid.koinic.net/documentation/getting-started">manual</a> for instructions on how to set up SimpleID.'); } if (!is_dir(SIMPLEID_CACHE_DIR) || !is_writeable(SIMPLEID_CACHE_DIR)) { indirect_fatal_error('Cache directory not found or not writeable. See the <a href="http://simpleid.koinic.net/documentation/getting-started">manual</a> for instructions on how to set up SimpleID.'); } if (!is_dir(SIMPLEID_STORE_DIR) || !is_writeable(SIMPLEID_STORE_DIR)) { indirect_fatal_error('Store directory not found or not writeable. See the <a href="http://simpleid.koinic.net/documentation/getting-started">manual</a> for instructions on how to set up SimpleID.'); } if (@ini_get('register_globals') === 1 || @ini_get('register_globals') === '1' || strtolower(@ini_get('register_globals')) == 'on') { indirect_fatal_error('register_globals is enabled in PHP configuration, which is not supported by SimpleID. See the <a href="http://simpleid.koinic.net/documentation/getting-started/system-requirements">manual</a> for further information.'); } if (!bignum_loaded()) { log_fatal('gmp/bcmath PHP extension not loaded.'); indirect_fatal_error('One or more required PHP extensions (gmp/bcmath) is not loaded. See the <a href="http://simpleid.koinic.net/documentation/getting-started/system-requirements">manual</a> for further information on system requirements.'); } if (!function_exists('preg_match')) { log_fatal('pcre PHP extension not loaded.'); indirect_fatal_error('One or more required PHP extensions (pcre) is not loaded. See the <a href="http://simpleid.koinic.net/documentation/getting-started/system-requirements">manual</a> for further information on system requirements.'); } if (!function_exists('session_start')) { log_fatal('session PHP extension not loaded.'); indirect_fatal_error('One or more required PHP extensions (session) is not loaded. See the <a href="http://simpleid.koinic.net/documentation/getting-started/system-requirements">manual</a> for further information on system requirements.'); } if (@ini_get('suhosin.get.max_value_length') !== false && @ini_get('suhosin.get.max_value_length') < 1024) { log_fatal('suhosin.get.max_value_length < 1024'); indirect_fatal_error('suhosin.get.max_value_length is less than 1024, which will lead to problems. See the <a href="http://simpleid.koinic.net/documentation/getting-started/system-requirements">manual</a> for further information on system requirements.'); } $q = isset($GETPOST['q']) ? $GETPOST['q'] : ''; $q = explode('/', $q); extension_init(); user_init(NULL); upgrade_user_init(); $routes = array('upgrade-selection' => 'upgrade_selection', 'upgrade-apply' => 'upgrade_apply', '.*' => 'upgrade_info'); simpleweb_run($routes, implode('/', $q)); }