From 4e6549cbc9aa0198614c6930fdc9adb6ceef4406 Mon Sep 17 00:00:00 2001 From: Sven Slootweg Date: Mon, 17 Dec 2012 17:45:07 +0100 Subject: [PATCH] Specify the VPS action (start, stop, restart) as a custom variable instead of grabbing it from the URL --- frontend/modules/client/vps/lookup.php | 8 ++++---- frontend/rewrite.php | 15 +++++++++------ 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/frontend/modules/client/vps/lookup.php b/frontend/modules/client/vps/lookup.php index 147f119..8edd62e 100644 --- a/frontend/modules/client/vps/lookup.php +++ b/frontend/modules/client/vps/lookup.php @@ -13,17 +13,17 @@ if(!isset($_CVM)) { die("Unauthorized."); } -if(!empty($router->uParameters[2])) +if(!empty($router->uVariables['action'])) { - if($router->uParameters[2] == "start") + if($router->uVariables['action'] == "start") { require("modules/client/vps/action/start.php"); } - elseif($router->uParameters[2] == "stop") + elseif($router->uVariables['action'] == "stop") { require("modules/client/vps/action/stop.php"); } - elseif($router->uParameters[2] == "restart") + elseif($router->uVariables['action'] == "restart") { require("modules/client/vps/action/restart.php"); } diff --git a/frontend/rewrite.php b/frontend/rewrite.php index 56f4187..3451bc2 100644 --- a/frontend/rewrite.php +++ b/frontend/rewrite.php @@ -69,25 +69,28 @@ try ), /* TODO: Use action variable instead of relying on the path. */ /* VPS - Start */ - '^/([0-9]+)/(start)/?$' => array( + '^/([0-9]+)/start/?$' => array( 'target' => "modules/client/vps/lookup.php", 'authenticator' => "authenticators/vps.php", 'auth_error' => "modules/error/access.php", - '_menu' => "vps" + '_menu' => "vps", + '_action' => "start" ), /* VPS - Stop */ - '^/([0-9]+)/(stop)/?$' => array( + '^/([0-9]+)/stop/?$' => array( 'target' => "modules/client/vps/lookup.php", 'authenticator' => "authenticators/vps.php", 'auth_error' => "modules/error/access.php", - '_menu' => "vps" + '_menu' => "vps", + '_action' => "stop" ), /* VPS - Restart */ - '^/([0-9]+)/(restart)/?$' => array( + '^/([0-9]+)/restart/?$' => array( 'target' => "modules/client/vps/lookup.php", 'authenticator' => "authenticators/vps.php", 'auth_error' => "modules/error/access.php", - '_menu' => "vps" + '_menu' => "vps", + '_action' => "restart" ), /* VPS - Reinstall */ '^/([0-9]+)/reinstall/?$' => array(