sAccessLevel; $sTemplateParameters = array_merge($sTemplateParameters, array( 'username' => $sUser->sUsername )); } else { $sUser = new User(0); $sLoggedIn = false; $template_global_vars['accesslevel'] = 0; } $sMainContents = ""; $sMainClass = ""; $sPageTitle = ""; // Initialize some variables to ensure they are available through the application. // This works around the inability of CPHP to retain variables set in the first rewrite. $sContainer = null; $sPageContents = null; $router = null; $sError = null; try { $router = new CPHPRouter(); $router->ignore_query = true; $router->routes = array( 0 => array( '^/?$' => "module.list.php", '^/account/?$' => "module.account.php", '^/login/?$' => "module.login.php", '^/logout/?$' => "module.logout.php", '^/([0-9]+)/?$' => array( 'target' => "module.vps.overview.php", 'authenticator' => "authenticator.vps.php", 'auth_error' => "error.access.php", '_menu' => "vps" ), '^/([0-9]+)/(start)/?$' => array( 'target' => "module.vps.overview.php", 'authenticator' => "authenticator.vps.php", 'auth_error' => "error.access.php", '_menu' => "vps" ), '^/([0-9]+)/(stop)/?$' => array( 'target' => "module.vps.overview.php", 'authenticator' => "authenticator.vps.php", 'auth_error' => "error.access.php", '_menu' => "vps" ), '^/([0-9]+)/(restart)/?$' => array( 'target' => "module.vps.overview.php", 'authenticator' => "authenticator.vps.php", 'auth_error' => "error.access.php", '_menu' => "vps" ), '^/([0-9]+)/reinstall/?$' => array( 'target' => "module.vps.reinstall.php", 'authenticator' => "authenticator.vps.php", 'auth_error' => "error.access.php", '_menu' => "vps" ), '^/([0-9]+)/password/?$' => array( 'target' => "module.vps.password.php", 'authenticator' => "authenticator.vps.php", 'auth_error' => "error.access.php", '_menu' => "vps" ), '^/([0-9]+)/console/?$' => array( 'target' => "module.vps.console.php", 'authenticator' => "authenticator.vps.php", 'auth_error' => "error.access.php", '_menu' => "vps" ), '^/admin/?$' => array( 'target' => "module.admin.overview.php", 'authenticator' => "authenticator.admin.php", 'auth_error' => "error.access.php", '_menu' => "admin" ), '^/admin/users/?$' => array( 'target' => "module.admin.users.php", 'authenticator' => "authenticator.admin.php", 'auth_error' => "error.access.php", '_menu' => "admin" ), '^/admin/containers/?$' => array( 'target' => "module.admin.containers.php", 'authenticator' => "authenticator.admin.php", 'auth_error' => "error.access.php", '_menu' => "admin" ), '^/admin/user/([0-9]+)/?$' => array( 'target' => "module.admin.user.php", 'authenticator' => "authenticator.admin.php", 'auth_error' => "error.access.php", '_menu' => "admin" ), '^/admin/container/([0-9]+)/suspend/?$' => array( 'target' => "module.admin.container.suspend.php", 'authenticator' => "authenticator.admin.php", 'auth_error' => "error.access.php", '_menu' => "admin" ), '^/admin/container/([0-9]+)/transfer/?$' => array( 'target' => "module.admin.container.transfer.php", 'authenticator' => "authenticator.admin.php", 'auth_error' => "error.access.php", '_menu' => "admin" ), '^/admin/container/([0-9]+)/terminate/?$' => array( 'target' => "module.admin.container.terminate.php", 'authenticator' => "authenticator.admin.php", 'auth_error' => "error.access.php", '_menu' => "admin" ), '^/test/?$' => "module.test.php" ) ); $router->RouteRequest(); if($router->uVariables['menu'] == "vps" && $router->uVariables['display_menu'] === true) { $sMainContents .= Templater::AdvancedParse("main.vps", $locale->strings, array( 'error' => $sError, 'contents' => $sPageContents, 'id' => $sContainer->sId )); } elseif($router->uVariables['menu'] == "admin" && $router->uVariables['display_menu'] === true) { $sMainContents .= Templater::AdvancedParse("main.admin", $locale->strings, array( 'error' => $sError, 'contents' => $sPageContents )); } } catch (UnauthorizedException $e) { $sPageTitle = "Unauthorized"; $sMainContents = "You are not authorized to view this page."; } $sTemplateParameters = array_merge($sTemplateParameters, array( 'logged-in' => $sLoggedIn, 'title' => $sPageTitle, 'main' => $sMainContents, 'main-class' => (isset($router->uVariables['menu']) && $router->sAuthenticated === true) ? "shift" : "", 'generation' => "" )); echo(Templater::AdvancedParse("main", $locale->strings, $sTemplateParameters));