From 0a04180e1b35e69cd02c75fadf7ac2576f01a6f7 Mon Sep 17 00:00:00 2001 From: Sven Slootweg Date: Sun, 16 Dec 2012 20:02:45 +0100 Subject: [PATCH] Reorganize modules --- .../admin.php} | 0 .../vps.php} | 0 .../admin/node/add.php} | 0 .../admin/node/list.php} | 0 .../admin/node/lookup.php} | 0 .../admin/overview/index.php} | 0 .../admin/user/list.php} | 0 .../admin/user/lookup.php} | 0 .../admin/vps/create.php} | 0 .../admin/vps/list.php} | 0 .../admin/vps/suspend.php} | 0 .../client/vps/action/restart.php} | 0 .../client/vps/action/start.php} | 0 .../client/vps/action/stop.php} | 0 .../client/vps/console.php} | 0 .../client/vps/list.php} | 0 .../client/vps/lookup.php} | 6 +- .../client/vps/password.php} | 0 .../client/vps/reinstall.php} | 0 .../error/access.php} | 0 .../shared/login.php} | 0 .../shared/logout.php} | 0 .../{module.test.php => modules/test.php} | 0 frontend/rewrite.php | 140 +++++++++--------- 24 files changed, 74 insertions(+), 72 deletions(-) rename frontend/{authenticator.admin.php => authenticators/admin.php} (100%) rename frontend/{authenticator.vps.php => authenticators/vps.php} (100%) rename frontend/{module.admin.nodes.add.php => modules/admin/node/add.php} (100%) rename frontend/{module.admin.nodes.php => modules/admin/node/list.php} (100%) rename frontend/{module.admin.node.php => modules/admin/node/lookup.php} (100%) rename frontend/{module.admin.overview.php => modules/admin/overview/index.php} (100%) rename frontend/{module.admin.users.php => modules/admin/user/list.php} (100%) rename frontend/{module.admin.user.php => modules/admin/user/lookup.php} (100%) rename frontend/{module.admin.containers.create.php => modules/admin/vps/create.php} (100%) rename frontend/{module.admin.containers.php => modules/admin/vps/list.php} (100%) rename frontend/{module.admin.container.suspend.php => modules/admin/vps/suspend.php} (100%) rename frontend/{submodule.restart.php => modules/client/vps/action/restart.php} (100%) rename frontend/{submodule.start.php => modules/client/vps/action/start.php} (100%) rename frontend/{submodule.stop.php => modules/client/vps/action/stop.php} (100%) rename frontend/{module.vps.console.php => modules/client/vps/console.php} (100%) rename frontend/{module.list.php => modules/client/vps/list.php} (100%) rename frontend/{module.vps.overview.php => modules/client/vps/lookup.php} (95%) rename frontend/{module.vps.password.php => modules/client/vps/password.php} (100%) rename frontend/{module.vps.reinstall.php => modules/client/vps/reinstall.php} (100%) rename frontend/{error.access.php => modules/error/access.php} (100%) rename frontend/{module.login.php => modules/shared/login.php} (100%) rename frontend/{module.logout.php => modules/shared/logout.php} (100%) rename frontend/{module.test.php => modules/test.php} (100%) diff --git a/frontend/authenticator.admin.php b/frontend/authenticators/admin.php similarity index 100% rename from frontend/authenticator.admin.php rename to frontend/authenticators/admin.php diff --git a/frontend/authenticator.vps.php b/frontend/authenticators/vps.php similarity index 100% rename from frontend/authenticator.vps.php rename to frontend/authenticators/vps.php diff --git a/frontend/module.admin.nodes.add.php b/frontend/modules/admin/node/add.php similarity index 100% rename from frontend/module.admin.nodes.add.php rename to frontend/modules/admin/node/add.php diff --git a/frontend/module.admin.nodes.php b/frontend/modules/admin/node/list.php similarity index 100% rename from frontend/module.admin.nodes.php rename to frontend/modules/admin/node/list.php diff --git a/frontend/module.admin.node.php b/frontend/modules/admin/node/lookup.php similarity index 100% rename from frontend/module.admin.node.php rename to frontend/modules/admin/node/lookup.php diff --git a/frontend/module.admin.overview.php b/frontend/modules/admin/overview/index.php similarity index 100% rename from frontend/module.admin.overview.php rename to frontend/modules/admin/overview/index.php diff --git a/frontend/module.admin.users.php b/frontend/modules/admin/user/list.php similarity index 100% rename from frontend/module.admin.users.php rename to frontend/modules/admin/user/list.php diff --git a/frontend/module.admin.user.php b/frontend/modules/admin/user/lookup.php similarity index 100% rename from frontend/module.admin.user.php rename to frontend/modules/admin/user/lookup.php diff --git a/frontend/module.admin.containers.create.php b/frontend/modules/admin/vps/create.php similarity index 100% rename from frontend/module.admin.containers.create.php rename to frontend/modules/admin/vps/create.php diff --git a/frontend/module.admin.containers.php b/frontend/modules/admin/vps/list.php similarity index 100% rename from frontend/module.admin.containers.php rename to frontend/modules/admin/vps/list.php diff --git a/frontend/module.admin.container.suspend.php b/frontend/modules/admin/vps/suspend.php similarity index 100% rename from frontend/module.admin.container.suspend.php rename to frontend/modules/admin/vps/suspend.php diff --git a/frontend/submodule.restart.php b/frontend/modules/client/vps/action/restart.php similarity index 100% rename from frontend/submodule.restart.php rename to frontend/modules/client/vps/action/restart.php diff --git a/frontend/submodule.start.php b/frontend/modules/client/vps/action/start.php similarity index 100% rename from frontend/submodule.start.php rename to frontend/modules/client/vps/action/start.php diff --git a/frontend/submodule.stop.php b/frontend/modules/client/vps/action/stop.php similarity index 100% rename from frontend/submodule.stop.php rename to frontend/modules/client/vps/action/stop.php diff --git a/frontend/module.vps.console.php b/frontend/modules/client/vps/console.php similarity index 100% rename from frontend/module.vps.console.php rename to frontend/modules/client/vps/console.php diff --git a/frontend/module.list.php b/frontend/modules/client/vps/list.php similarity index 100% rename from frontend/module.list.php rename to frontend/modules/client/vps/list.php diff --git a/frontend/module.vps.overview.php b/frontend/modules/client/vps/lookup.php similarity index 95% rename from frontend/module.vps.overview.php rename to frontend/modules/client/vps/lookup.php index 79667a4..c6adfc0 100644 --- a/frontend/module.vps.overview.php +++ b/frontend/modules/client/vps/lookup.php @@ -17,15 +17,15 @@ if(!empty($router->uParameters[2])) { if($router->uParameters[2] == "start") { - require("submodule.start.php"); + require("modules/client/vps/action/start.php"); } elseif($router->uParameters[2] == "stop") { - require("submodule.stop.php"); + require("modules/client/vps/action/stop.php"); } elseif($router->uParameters[2] == "restart") { - require("submodule.restart.php"); + require("modules/client/vps/action/restart.php"); } } diff --git a/frontend/module.vps.password.php b/frontend/modules/client/vps/password.php similarity index 100% rename from frontend/module.vps.password.php rename to frontend/modules/client/vps/password.php diff --git a/frontend/module.vps.reinstall.php b/frontend/modules/client/vps/reinstall.php similarity index 100% rename from frontend/module.vps.reinstall.php rename to frontend/modules/client/vps/reinstall.php diff --git a/frontend/error.access.php b/frontend/modules/error/access.php similarity index 100% rename from frontend/error.access.php rename to frontend/modules/error/access.php diff --git a/frontend/module.login.php b/frontend/modules/shared/login.php similarity index 100% rename from frontend/module.login.php rename to frontend/modules/shared/login.php diff --git a/frontend/module.logout.php b/frontend/modules/shared/logout.php similarity index 100% rename from frontend/module.logout.php rename to frontend/modules/shared/logout.php diff --git a/frontend/module.test.php b/frontend/modules/test.php similarity index 100% rename from frontend/module.test.php rename to frontend/modules/test.php diff --git a/frontend/rewrite.php b/frontend/rewrite.php index c3fa453..52865b7 100644 --- a/frontend/rewrite.php +++ b/frontend/rewrite.php @@ -55,153 +55,154 @@ try $router->routes = array( 0 => array( - '^/?$' => "module.list.php", - '^/account/?$' => "module.account.php", - '^/login/?$' => "module.login.php", - '^/logout/?$' => "module.logout.php", + '^/?$' => "modules/client/vps/list.php", + '^/account/?$' => "modules/client/account/index.php", + '^/login/?$' => "modules/shared/login.php", + '^/logout/?$' => "modules/shared/logout.php", /* Frontpage/overview */ '^/([0-9]+)/?$' => array( - 'target' => "module.vps.overview.php", - 'authenticator' => "authenticator.vps.php", - 'auth_error' => "error.access.php", + 'target' => "modules/client/vps/lookup.php", + 'authenticator' => "authenticators/vps.php", + 'auth_error' => "modules/error/access.php", '_menu' => "vps" ), + /* TODO: Use action variable instead of relying on the path. */ /* VPS - Start */ '^/([0-9]+)/(start)/?$' => array( - 'target' => "module.vps.overview.php", - 'authenticator' => "authenticator.vps.php", - 'auth_error' => "error.access.php", + 'target' => "modules/client/vps/lookup.php", + 'authenticator' => "authenticators/vps.php", + 'auth_error' => "modules/error/access.php", '_menu' => "vps" ), /* VPS - Stop */ '^/([0-9]+)/(stop)/?$' => array( - 'target' => "module.vps.overview.php", - 'authenticator' => "authenticator.vps.php", - 'auth_error' => "error.access.php", + 'target' => "modules/client/vps/lookup.php", + 'authenticator' => "authenticators/vps.php", + 'auth_error' => "modules/error/access.php", '_menu' => "vps" ), /* VPS - Restart */ '^/([0-9]+)/(restart)/?$' => array( - 'target' => "module.vps.overview.php", - 'authenticator' => "authenticator.vps.php", - 'auth_error' => "error.access.php", + 'target' => "modules/client/vps/lookup.php", + 'authenticator' => "authenticators/vps.php", + 'auth_error' => "modules/error/access.php", '_menu' => "vps" ), /* VPS - Reinstall */ '^/([0-9]+)/reinstall/?$' => array( - 'target' => "module.vps.reinstall.php", - 'authenticator' => "authenticator.vps.php", - 'auth_error' => "error.access.php", + 'target' => "modules/client/vps/reinstall.php", + 'authenticator' => "authenticators/vps.php", + 'auth_error' => "modules/error/access.php", '_menu' => "vps" ), /* VPS - Change password */ '^/([0-9]+)/password/?$' => array( - 'target' => "module.vps.password.php", - 'authenticator' => "authenticator.vps.php", - 'auth_error' => "error.access.php", + 'target' => "modules/client/vps/password.php", + 'authenticator' => "authenticators/vps.php", + 'auth_error' => "modules/error/access.php", '_menu' => "vps" ), /* VPS - Console */ '^/([0-9]+)/console/?$' => array( - 'target' => "module.vps.console.php", - 'authenticator' => "authenticator.vps.php", - 'auth_error' => "error.access.php", + 'target' => "modules/client/vps/console.php", + 'authenticator' => "authenticators/vps.php", + 'auth_error' => "modules/error/access.php", '_menu' => "vps" ), /* Admin - Overview */ '^/admin/?$' => array( - 'target' => "module.admin.overview.php", - 'authenticator' => "authenticator.admin.php", - 'auth_error' => "error.access.php", + 'target' => "modules/admin/overview/index.php", + 'authenticator' => "authenticators/admin.php", + 'auth_error' => "modules/error/access.php", '_menu' => "admin" ), /* Admin - Users - Overview */ '^/admin/users/?$' => array( - 'target' => "module.admin.users.php", - 'authenticator' => "authenticator.admin.php", - 'auth_error' => "error.access.php", + 'target' => "modules/admin/user/list.php", + 'authenticator' => "authenticators/admin.php", + 'auth_error' => "modules/error/access.php", '_menu' => "admin" ), /* Admin - Users - Lookup */ '^/admin/user/([0-9]+)/?$' => array( - 'target' => "module.admin.user.php", - 'authenticator' => "authenticator.admin.php", - 'auth_error' => "error.access.php", + 'target' => "modules/admin/user/lookup.php", + 'authenticator' => "authenticators/admin.php", + 'auth_error' => "modules/error/access.php", '_menu' => "admin" ), /* Admin - Users - Create VPS */ '^/admin/user/([0-9]+)/add/?$' => array( - 'target' => "module.admin.containers.create.php", - 'authenticator' => "authenticator.admin.php", - 'auth_error' => "error.access.php", + 'target' => "modules/admin/vps/create.php", + 'authenticator' => "authenticators/admin.php", + 'auth_error' => "modules/error/access.php", '_menu' => "admin", '_prefilled_user' => true ), /* Admin - VPSes - Overview */ '^/admin/vpses/?$' => array( - 'target' => "module.admin.containers.php", - 'authenticator' => "authenticator.admin.php", - 'auth_error' => "error.access.php", + 'target' => "modules/admin/vps/list.php", + 'authenticator' => "authenticators/admin.php", + 'auth_error' => "modules/error/access.php", '_menu' => "admin" ), /* Admin - VPSes - Create VPS */ '^/admin/vpses/add/?$' => array( - 'target' => "module.admin.containers.create.php", - 'authenticator' => "authenticator.admin.php", - 'auth_error' => "error.access.php", + 'target' => "modules/admin/vps/create.php", + 'authenticator' => "authenticators/admin.php", + 'auth_error' => "modules/error/access.php", '_menu' => "admin" ), /* Admin - VPSes - Suspend */ - '^/admin/vps/([0-9]+)/suspend/?$' => array( - 'target' => "module.admin.container.suspend.php", - 'authenticator' => "authenticator.admin.php", - 'auth_error' => "error.access.php", - '_menu' => "admin" + '^/admin/vps/([0-9]+)/suspend/?$' => array( + 'target' => "modules/admin/vps/suspend.php", + 'authenticator' => "authenticators/admin.php", + 'auth_error' => "modules/error/access.php", + '_menu' => "admin" ), /* Admin - VPSes - Transfer */ '^/admin/vps/([0-9]+)/transfer/?$' => array( - 'target' => "module.admin.container.transfer.php", - 'authenticator' => "authenticator.admin.php", - 'auth_error' => "error.access.php", - '_menu' => "admin" + 'target' => "modules/admin/vps/transfer.php", + 'authenticator' => "authenticators/admin.php", + 'auth_error' => "modules/error/access.php", + '_menu' => "admin" ), /* Admin - VPSes - Terminate */ '^/admin/vps/([0-9]+)/terminate/?$' => array( - 'target' => "module.admin.container.terminate.php", - 'authenticator' => "authenticator.admin.php", - 'auth_error' => "error.access.php", - '_menu' => "admin" + 'target' => "modules/admin/vps/terminate.php", + 'authenticator' => "authenticators/admin.php", + 'auth_error' => "modules/error/access.php", + '_menu' => "admin" ), /* Admin - Nodes - Overview */ '^/admin/nodes/?$' => array( - 'target' => "module.admin.nodes.php", - 'authenticator' => "authenticator.admin.php", - 'auth_error' => "error.access.php", + 'target' => "modules/admin/node/list.php", + 'authenticator' => "authenticators/admin.php", + 'auth_error' => "modules/error/access.php", '_menu' => "admin" ), /* Admin - Nodes - Lookup */ '^/admin/node/([0-9]+)/?$' => array( - 'target' => "module.admin.node.php", - 'authenticator' => "authenticator.admin.php", - 'auth_error' => "error.access.php", + 'target' => "modules/admin/node/lookup.php", + 'authenticator' => "authenticators/admin.php", + 'auth_error' => "modules/error/access.php", '_menu' => "admin" ), /* Admin - Nodes - Add */ '^/admin/nodes/add/?$' => array( - 'target' => "module.admin.nodes.add.php", - 'authenticator' => "authenticator.admin.php", - 'auth_error' => "error.access.php", + 'target' => "modules/admin/node/add.php", + 'authenticator' => "authenticators/admin.php", + 'auth_error' => "modules/error/access.php", '_menu' => "admin" ), /* Admin - Nodes - Create VPS */ '^/admin/node/([0-9]+)/add/?$' => array( - 'target' => "module.admin.containers.create.php", - 'authenticator' => "authenticator.admin.php", - 'auth_error' => "error.access.php", + 'target' => "modules/admin/vps/create.php", + 'authenticator' => "authenticators/admin.php", + 'auth_error' => "modules/error/access.php", '_menu' => "admin", '_prefilled_node' => true ), - '^/test/?$' => "module.test.php" + '^/test/?$' => "modules/test.php" ) ); @@ -254,6 +255,7 @@ $sTemplateParameters = array_merge($sTemplateParameters, array( 'logged-in' => $sLoggedIn, 'title' => $sPageTitle, 'main' => $sMainContents, + /* TODO: Return a boolean instead and use this in the template. */ 'main-class' => (isset($router->uVariables['menu']) && $router->sAuthenticated === true) ? "shift" : "", 'generation' => "" ));