From ac3d2bd7531252b154f897775635fd5e58720a73 Mon Sep 17 00:00:00 2001 From: Sven Slootweg Date: Fri, 11 May 2012 02:30:50 +0200 Subject: [PATCH] Add user lookup page --- frontend/classes/class.user.php | 25 +++++++++++++++++++++++++ frontend/css/cvm.css | 7 ++++++- frontend/locales/english.lng | 2 ++ frontend/module.admin.php | 3 ++- 4 files changed, 35 insertions(+), 2 deletions(-) diff --git a/frontend/classes/class.user.php b/frontend/classes/class.user.php index f45b106..1220549 100644 --- a/frontend/classes/class.user.php +++ b/frontend/classes/class.user.php @@ -37,6 +37,31 @@ class User extends CPHPDatabaseRecordClass 'AccessLevel' ); + public function __get($name) + { + switch($name) + { + case "sContainerCount": + return $this->GetContainerCount(); + break; + default: + return null; + break; + } + } + + public function GetContainerCount() + { + if($result = mysql_query_cached("SELECT * FROM containers WHERE `UserId` = '{$this->sId}'")) + { + return count($result->data); + } + else + { + return 0; + } + } + public function GenerateSalt() { $this->uSalt = random_string(10); diff --git a/frontend/css/cvm.css b/frontend/css/cvm.css index 5f85ed6..e15ac33 100644 --- a/frontend/css/cvm.css +++ b/frontend/css/cvm.css @@ -66,7 +66,7 @@ table.vpsinfo, table.console border: 2px solid #31305E; } -table.vpsinfo td, table.console td +table.vertical td { padding: 2px 13px; } @@ -86,6 +86,11 @@ table.console th width: 120px; } +table.userinfo th +{ + width: 180px; +} + table.userlist td { padding-bottom: 4px; diff --git a/frontend/locales/english.lng b/frontend/locales/english.lng index b0babf5..8112341 100644 --- a/frontend/locales/english.lng +++ b/frontend/locales/english.lng @@ -106,9 +106,11 @@ console-title-port; Port console-title-username; Username console-title-password; Password +admin-title-id; User ID admin-title-username; Username admin-title-email; Email address admin-title-accesslevel; Access level +admin-title-containers; Container count admin-level-enduser; End user admin-level-reseller; Reseller admin-level-nodeadmin; Node administrator diff --git a/frontend/module.admin.php b/frontend/module.admin.php index e57972c..2c4d46d 100644 --- a/frontend/module.admin.php +++ b/frontend/module.admin.php @@ -29,7 +29,8 @@ try $router->routes = array( 0 => array( '^/admin/?$' => "module.admin.overview.php", - '^/admin/users/?$' => "module.admin.users.php" + '^/admin/users/?$' => "module.admin.users.php", + '^/admin/user/([0-9]+)/?$' => "module.admin.user.php" ) );