diff --git a/frontend/api.local.php b/frontend/api.local.php index 5917f0b..7a7e128 100644 --- a/frontend/api.local.php +++ b/frontend/api.local.php @@ -68,20 +68,20 @@ if(isset($_GET['key']) && $_GET['key'] == $settings['local_api_key']) if($result = mysql_query_cached($query)) { - $sContainers = array(); + $sVpses = array(); foreach($result->data as $row) { - $sContainer = new Container($row); - $sContainers[] = array( - 'hostname' => $sContainer->sHostname, - 'internal_id' => $sContainer->sInternalId, - 'node_id' => $sContainer->sNodeId, - 'status' => $sContainer->sStatus + $sVps = new Vps($row); + $sVpses[] = array( + 'hostname' => $sVps->sHostname, + 'internal_id' => $sVps->sInternalId, + 'node_id' => $sVps->sNodeId, + 'status' => $sVps->sStatus ); } - $return_object = $sContainers; + $return_object = $sVpses; $return_success = true; } break; diff --git a/frontend/authenticator.vps.php b/frontend/authenticator.vps.php index 0989c2c..4ccb193 100644 --- a/frontend/authenticator.vps.php +++ b/frontend/authenticator.vps.php @@ -17,9 +17,9 @@ $router->uVariables['display_menu'] = true; try { - $sContainer = new Container($router->uParameters[1]); + $sVps = new Vps($router->uParameters[1]); - if($sContainer->sUserId != $sUser->sId && $sUser->sAccessLevel < 20) + if($sVps->sUserId != $sUser->sId && $sUser->sAccessLevel < 20) { throw new UnauthorizedException("You are not authorized to control this VPS."); } @@ -28,16 +28,16 @@ try try { - $sContainer->CheckAllowed(); + $sVps->CheckAllowed(); } - catch (ContainerSuspendedException $e) + catch (VpsSuspendedException $e) { $sMainContents .= NewTemplater::Render("{$sTheme}/shared/error/warning", $locale->strings, array( 'title' => $locale->strings['warning-suspended-title'], 'message' => $locale->strings['warning-suspended-text'] )); } - catch (ContainerTerminatedException $e) + catch (VpsTerminatedException $e) { $sMainContents .= NewTemplater::Render("{$sTheme}/shared/error/warning", $locale->strings, array( 'title' => $locale->strings['warning-terminated-title'], diff --git a/frontend/classes/class.container.php b/frontend/classes/class.container.php index 2097a82..e97c423 100644 --- a/frontend/classes/class.container.php +++ b/frontend/classes/class.container.php @@ -13,7 +13,7 @@ if(!isset($_CVM)) { die("Unauthorized."); } -class Container extends CPHPDatabaseRecordClass +class Vps extends CPHPDatabaseRecordClass { public $table_name = "containers"; public $fill_query = "SELECT * FROM containers WHERE `Id` = '%d'"; @@ -260,11 +260,11 @@ class Container extends CPHPDatabaseRecordClass { if($this->sStatus == CVM_STATUS_SUSPENDED) { - throw new ContainerSuspendedException("No operations can be performed on this VPS beacuse it is suspended.", 1, $this->sInternalId); + throw new VpsSuspendedException("No operations can be performed on this VPS beacuse it is suspended.", 1, $this->sInternalId); } elseif($this->sStatus == CVM_STATUS_TERMINATED) { - throw new ContainerSuspendedException("No operations can be performed on this VPS beacuse it is terminated.", 1, $this->sInternalId); + throw new VpsSuspendedException("No operations can be performed on this VPS beacuse it is terminated.", 1, $this->sInternalId); } else { @@ -290,7 +290,7 @@ class Container extends CPHPDatabaseRecordClass } else { - throw new InvalidArgumentException("The option argument to Container::SetOptions should be an array."); + throw new InvalidArgumentException("The option argument to Vps::SetOptions should be an array."); } } @@ -425,12 +425,12 @@ class Container extends CPHPDatabaseRecordClass } else { - throw new ContainerConfigureException($result->stderr, $result->returncode, $this->sInternalId); + throw new VpsConfigureException($result->stderr, $result->returncode, $this->sInternalId); } } else { - throw new ContainerCreateException($result->stderr, $result->returncode, $this->sInternalId); + throw new VpsCreateException($result->stderr, $result->returncode, $this->sInternalId); } } @@ -450,7 +450,7 @@ class Container extends CPHPDatabaseRecordClass } else { - throw new ContainerDestroyException("Destroying VPS failed: {$result->stderr}", $result->returncode, $this->sInternalId); + throw new VpsDestroyException("Destroying VPS failed: {$result->stderr}", $result->returncode, $this->sInternalId); } } @@ -461,17 +461,17 @@ class Container extends CPHPDatabaseRecordClass $this->Destroy(); $this->Deploy(); } - catch (ContainerDestroyException $e) + catch (VpsDestroyException $e) { - throw new ContainerReinstallException("Reinstalling VPS failed during destroying: " . $e->getMessage(), $e->getCode(), $this->sInternalId, $e); + throw new VpsReinstallException("Reinstalling VPS failed during destroying: " . $e->getMessage(), $e->getCode(), $this->sInternalId, $e); } - catch (ContainerCreateException $e) + catch (VpsCreateException $e) { - throw new ContainerReinstallException("Reinstalling VPS failed during creation: " . $e->getMessage(), $e->getCode(), $this->sInternalId, $e); + throw new VpsReinstallException("Reinstalling VPS failed during creation: " . $e->getMessage(), $e->getCode(), $this->sInternalId, $e); } - catch (ContainerConfigureException $e) + catch (VpsConfigureException $e) { - throw new ContainerReinstallException("Reinstalling VPS failed during configuration: " . $e->getMessage(), $e->getCode(), $this->sInternalId, $e); + throw new VpsReinstallException("Reinstalling VPS failed during configuration: " . $e->getMessage(), $e->getCode(), $this->sInternalId, $e); } } @@ -479,11 +479,11 @@ class Container extends CPHPDatabaseRecordClass { if($this->sStatus == CVM_STATUS_SUSPENDED && $forced == false) { - throw new ContainerSuspendedException("The VPS cannot be started as it is suspended.", 1, $this->sInternalId); + throw new VpsSuspendedException("The VPS cannot be started as it is suspended.", 1, $this->sInternalId); } elseif($this->sStatus == CVM_STATUS_TERMINATED && $forced == false) { - throw new ContainerTerminatedException("The VPS cannot be started as it is terminated.", 1, $this->sInternalId); + throw new VpsTerminatedException("The VPS cannot be started as it is terminated.", 1, $this->sInternalId); } else { @@ -498,7 +498,7 @@ class Container extends CPHPDatabaseRecordClass } else { - throw new ContainerStartException($result->stderr, $result->returncode, $this->sInternalId); + throw new VpsStartException($result->stderr, $result->returncode, $this->sInternalId); } } } @@ -507,18 +507,19 @@ class Container extends CPHPDatabaseRecordClass { if($this->sStatus == CVM_STATUS_SUSPENDED) { - throw new ContainerSuspendedException("The VPS cannot be stopped as it is suspended.", 1, $this->sInternalId); + throw new VpsSuspendedException("The VPS cannot be stopped as it is suspended.", 1, $this->sInternalId); } elseif($this->sStatus == CVM_STATUS_TERMINATED) { - throw new ContainerTerminatedException("The VPS cannot be stopped as it is terminated.", 1, $this->sInternalId); + throw new VpsTerminatedException("The VPS cannot be stopped as it is terminated.", 1, $this->sInternalId); } else { $command = array("vzctl", "stop", $this->sInternalId); $result = $this->sNode->ssh->RunCommand($command, false); - // vzctl is retarded enough to return exit status 0 when the command fails because the container isn't running, so we'll have to check the stderr for specific error string(s) as well. come on guys, it's 2012. + /* vzctl is retarded enough to return code 0 when the command fails because the container isn't running, + * so we'll have to check stderr for specific error strings as well. Come on guys, it's 2012. */ if($result->returncode == 0 && strpos($result->stderr, "Unable to stop") === false) { $this->uStatus = CVM_STATUS_STOPPED; @@ -527,7 +528,7 @@ class Container extends CPHPDatabaseRecordClass } else { - throw new ContainerStopException($result->stderr, $result->returncode, $this->sInternalId); + throw new VpsStopException($result->stderr, $result->returncode, $this->sInternalId); } } } @@ -542,14 +543,14 @@ class Container extends CPHPDatabaseRecordClass $this->uStatus = CVM_STATUS_SUSPENDED; $this->InsertIntoDatabase(); } - catch (ContainerStopException $e) + catch (VpsStopException $e) { - throw new ContainerSuspendException("Suspension failed as the VPS could not be stopped.", 1, $this->sInternalId, $e); + throw new VpsSuspendException("Suspension failed as the VPS could not be stopped.", 1, $this->sInternalId, $e); } } else { - throw new ContainerSuspendException("The VPS is already suspended.", 1, $this->sInternalId); + throw new VpsSuspendException("The VPS is already suspended.", 1, $this->sInternalId); } } @@ -563,14 +564,14 @@ class Container extends CPHPDatabaseRecordClass $this->uStatus = CVM_STATUS_STARTED; $this->InsertIntoDatabase(); } - catch (ContainerStartException $e) + catch (VpsStartException $e) { - throw new ContainerUnsuspendException("Unsuspension failed as the VPS could not be started.", 1, $this->sInternalId, $e); + throw new VpsUnsuspendException("Unsuspension failed as the VPS could not be started.", 1, $this->sInternalId, $e); } } else { - throw new ContainerUnsuspendException("The VPS is not suspended.", 1, $this->sInternalId); + throw new VpsUnsuspendException("The VPS is not suspended.", 1, $this->sInternalId); } } @@ -586,7 +587,7 @@ class Container extends CPHPDatabaseRecordClass } else { - throw new ContainerIpAddException($result->stderr, $result->returncode, $this->sInternalId); + throw new VpsIpAddException($result->stderr, $result->returncode, $this->sInternalId); } } @@ -602,7 +603,7 @@ class Container extends CPHPDatabaseRecordClass } else { - throw new ContainerIpRemoveException($result->stderr, $result->returncode, $this->sInternalId); + throw new VpsIpRemoveException($result->stderr, $result->returncode, $this->sInternalId); } } @@ -642,7 +643,7 @@ class Container extends CPHPDatabaseRecordClass } else { - throw new ContainerTrafficRetrieveException($result->stderr, $result->returncode, $this->sInternalId); + throw new VpsTrafficRetrieveException($result->stderr, $result->returncode, $this->sInternalId); } } @@ -650,11 +651,11 @@ class Container extends CPHPDatabaseRecordClass { if($this->sStatus == CVM_STATUS_SUSPENDED) { - throw new ContainerSuspendedException("The root password cannot be changed, because the VPS is suspended.", 1, $this->sInternalId); + throw new VpsSuspendedException("The root password cannot be changed, because the VPS is suspended.", 1, $this->sInternalId); } elseif($this->sStatus == CVM_STATUS_TERMINATED) { - throw new ContainerTerminatedException("The root password cannot be changed, because the VPS is terminated.", 1, $this->sInternalId); + throw new VpsTerminatedException("The root password cannot be changed, because the VPS is terminated.", 1, $this->sInternalId); } else { diff --git a/frontend/classes/class.user.php b/frontend/classes/class.user.php index 8d38792..d5c4f48 100644 --- a/frontend/classes/class.user.php +++ b/frontend/classes/class.user.php @@ -41,8 +41,8 @@ class User extends CPHPDatabaseRecordClass { switch($name) { - case "sContainerCount": - return $this->GetContainerCount(); + case "sVpsCount": + return $this->GetVpsCount(); break; default: return parent::__get($name); @@ -50,7 +50,7 @@ class User extends CPHPDatabaseRecordClass } } - public function GetContainerCount() + public function GetVpsCount() { if($result = mysql_query_cached("SELECT * FROM containers WHERE `UserId` = '{$this->sId}'")) { diff --git a/frontend/cron.15.php b/frontend/cron.15.php index 6fc87ba..0c88dbd 100644 --- a/frontend/cron.15.php +++ b/frontend/cron.15.php @@ -18,15 +18,15 @@ if($result = mysql_query_cached("SELECT * FROM containers")) { foreach($result->data as $row) { - $sContainer = new Container($row); + $sVps = new Vps($row); try { - $sContainer->UpdateTraffic(); + $sVps->UpdateTraffic(); } - catch (ContainerTrafficRetrieveException $e) + catch (VpsTrafficRetrieveException $e) { - if($sContainer->sCurrentStatus == CVM_STATUS_STARTED) + if($sVps->sCurrentStatus == CVM_STATUS_STARTED) { // This is not supposed to fail, as the VPS is running. // Something shady going on. diff --git a/frontend/includes/include.base.php b/frontend/includes/include.base.php index ff682b8..0721097 100644 --- a/frontend/includes/include.base.php +++ b/frontend/includes/include.base.php @@ -21,6 +21,8 @@ require("include.exceptions.php"); require("include.constants.php"); require("include.parsing.php"); require("include.misc.php"); + +/* TODO: Reorganize and autoloading. */ require("classes/class.user.php"); require("classes/class.controller.php"); require("classes/class.container.php"); diff --git a/frontend/includes/include.exceptions.php b/frontend/includes/include.exceptions.php index 47f5703..db934a6 100644 --- a/frontend/includes/include.exceptions.php +++ b/frontend/includes/include.exceptions.php @@ -20,8 +20,8 @@ class SshAuthException extends SshException {} class SshCommandException extends SshException {} class SshExitException extends SshException {} -// Container-related exceptions -class ContainerException extends Exception +// VPS-related exceptions +class VpsException extends Exception { private $id = ""; @@ -38,20 +38,20 @@ class ContainerException extends Exception } } -class ContainerCreateException extends ContainerException {} -class ContainerConfigureException extends ContainerException {} -class ContainerStartException extends ContainerException {} -class ContainerStopException extends ContainerException {} -class ContainerSuspendException extends ContainerException {} -class ContainerUnsuspendException extends ContainerException {} -class ContainerSuspendedException extends ContainerException {} -class ContainerTerminatedException extends ContainerException {} -class ContainerDestroyException extends ContainerException {} -class ContainerReinstallException extends ContainerException {} -class ContainerDeployException extends ContainerException {} -class ContainerIpAddException extends ContainerException {} -class ContainerIpRemoveException extends ContainerException {} -class ContainerTrafficRetrieveException extends ContainerException {} +class VpsCreateException extends VpsException {} +class VpsConfigureException extends VpsException {} +class VpsStartException extends VpsException {} +class VpsStopException extends VpsException {} +class VpsSuspendException extends VpsException {} +class VpsUnsuspendException extends VpsException {} +class VpsSuspendedException extends VpsException {} +class VpsTerminatedException extends VpsException {} +class VpsDestroyException extends VpsException {} +class VpsReinstallException extends VpsException {} +class VpsDeployException extends VpsException {} +class VpsIpAddException extends VpsException {} +class VpsIpRemoveException extends VpsException {} +class VpsTrafficRetrieveException extends VpsException {} class UnauthorizedException extends Exception {} class InsufficientAccessLevelException extends Exception {} diff --git a/frontend/locales/english.lng b/frontend/locales/english.lng index aa3211a..71411f6 100644 --- a/frontend/locales/english.lng +++ b/frontend/locales/english.lng @@ -68,7 +68,7 @@ menu-password; Root Password ## Administration panel menu items menu-admin-overview; Overview menu-admin-users; Users -menu-admin-containers; VPSes +menu-admin-vpses; VPSes menu-admin-nodes; Nodes ## Global warnings and errors @@ -237,12 +237,12 @@ admin-title-id; User ID admin-title-username; Username admin-title-email; Email address admin-title-accesslevel; Access level -admin-title-containers; VPS count +admin-title-vpses; VPS count admin-level-enduser; End user admin-level-reseller; Reseller admin-level-nodeadmin; Node administrator admin-level-masteradmin; Master administrator -header-admin-user-containers; VPSes owned by this user +header-admin-user-vpses; VPSes owned by this user ## VPS list title-admin-vpslist; VPS overview @@ -267,7 +267,7 @@ toolbar-addnode; Add node title-admin-nodeinfo; Node lookup toolbar-createvps; Create VPS toolbar-editnode; Edit node details -header-admin-node-containers; VPSes on this node +header-admin-node-vpses; VPSes on this node ## Add node title-admin-addnode; Add node @@ -286,7 +286,7 @@ addnode-privatekey; Private key button-admin-addnode; Add node ## Create VPS -title-admin-addcontainer; Create VPS +title-admin-addvps; Create VPS error-admin-vpses-add-node; You did not select a valid node. error-admin-vpses-add-user; You did not select a valid user. error-admin-vpses-add-template; You did not select a valid template. @@ -296,16 +296,16 @@ error-admin-vpses-add-burstable; You did not enter a valid burstable RAM spe error-admin-vpses-add-cpucount; You did not enter a valid amount of CPUs. error-admin-vpses-add-traffic; You did not enter a valid traffic allocation specification. error-admin-vpses-add-hostname; You entered an invalid hostname. -addcontainer-node; Node -addcontainer-user; User -addcontainer-diskspace; Disk space -addcontainer-guaranteed; Guaranteed RAM -addcontainer-burstable; Burstable RAM -addcontainer-cpucount; CPUs -addcontainer-traffic; Traffic allocation -addcontainer-hostname; Hostname (optional) -addcontainer-template; Template -button-admin-addcontainer; Create VPS +addvps-node; Node +addvps-user; User +addvps-diskspace; Disk space +addvps-guaranteed; Guaranteed RAM +addvps-burstable; Burstable RAM +addvps-cpucount; CPUs +addvps-traffic; Traffic allocation +addvps-hostname; Hostname (optional) +addvps-template; Template +button-admin-addvps; Create VPS ## Administrative overview title-admin-overview; Administrative overview diff --git a/frontend/module.admin.container.suspend.php b/frontend/module.admin.container.suspend.php index 11dc260..c4e35b4 100644 --- a/frontend/module.admin.container.suspend.php +++ b/frontend/module.admin.container.suspend.php @@ -17,13 +17,13 @@ try { $sUser->RequireAccessLevel(20); - $sContainer = new Container($router->uParameters[1]); + $sVps = new Vps($router->uParameters[1]); if(isset($_POST['submit'])) { if($_POST['action'] == "suspend") { - $sContainer->Suspend(); + $sVps->Suspend(); $sMainContents .= NewTemplater::Render("{$sTheme}/shared/error/success", $locale->strings, array( 'title' => $locale->strings['error-suspend-success-title'], @@ -32,7 +32,7 @@ try } elseif($_POST['action'] == "unsuspend") { - $sContainer->Unsuspend(); + $sVps->Unsuspend(); $sMainContents .= NewTemplater::Render("{$sTheme}/shared/error/success", $locale->strings, array( 'title' => $locale->strings['error-unsuspend-success-title'], @@ -40,15 +40,15 @@ try )); } - $sContainer->RefreshData(); + $sVps->RefreshData(); /* TODO: Flash message and redirect to VPS lookup page. */ } - $sSuspended = ($sContainer->sStatus == CVM_STATUS_SUSPENDED) ? true : false; + $sSuspended = ($sVps->sStatus == CVM_STATUS_SUSPENDED) ? true : false; $sPageContents = Templater::AdvancedParse("{$sTheme}/admin/vps/suspend", $locale->strings, array( - 'id' => $sContainer->sId, + 'id' => $sVps->sId, 'suspended' => $sSuspended )); } @@ -59,14 +59,14 @@ catch (NotFoundException $e) 'message' => $locale->strings['error-notfound-text'] )); } -catch (ContainerSuspendException $e) +catch (VpsSuspendException $e) { $sMainContents .= NewTemplater::Render("{$sTheme}/shared/error/error", $locale->strings, array( 'title' => $locale->strings['error-suspend-error-title'], 'message' => $locale->strings['error-suspend-error-text'] )); } -catch (ContainerUnsuspendException $e) +catch (VpsUnsuspendException $e) { $sMainContents .= NewTemplater::Render("{$sTheme}/shared/error/error", $locale->strings, array( 'title' => $locale->strings['error-unsuspend-error-title'], diff --git a/frontend/module.admin.containers.create.php b/frontend/module.admin.containers.create.php index 2c259cc..dff7679 100644 --- a/frontend/module.admin.containers.create.php +++ b/frontend/module.admin.containers.create.php @@ -118,23 +118,23 @@ if(isset($_POST['submit'])) if(empty($sErrors)) { - $sContainer = new Container(0); - $sContainer->uHostname = $hostname; - $sContainer->uInternalId = first_unused_ctid(); - $sContainer->uNodeId = $node->sId; - $sContainer->uTemplateId = $template->sId; - $sContainer->uUserId = $user->sId; - $sContainer->uVirtualizationType = CVM_VIRTUALIZATION_OPENVZ; - $sContainer->uGuaranteedRam = ($guaranteed_ram / 1024 / 1024); /* MB */ - $sContainer->uBurstableRam = ($burstable_ram / 1024 / 1024); /* MB */ - $sContainer->uDiskSpace = ($disk_space / 1024 / 1024); /* MB */ - $sContainer->uCpuCount = $cpu_count; - $sContainer->uStatus = CVM_STATUS_BLANK; - $sContainer->uIncomingTrafficLimit = $traffic; - $sContainer->uOutgoingTrafficLimit = $traffic; - $sContainer->uTotalTrafficLimit = $traffic; - $sContainer->InsertIntoDatabase(); - $sContainer->Deploy(); + $sVps = new Vps(0); + $sVps->uHostname = $hostname; + $sVps->uInternalId = first_unused_ctid(); + $sVps->uNodeId = $node->sId; + $sVps->uTemplateId = $template->sId; + $sVps->uUserId = $user->sId; + $sVps->uVirtualizationType = CVM_VIRTUALIZATION_OPENVZ; + $sVps->uGuaranteedRam = ($guaranteed_ram / 1024 / 1024); /* MB */ + $sVps->uBurstableRam = ($burstable_ram / 1024 / 1024); /* MB */ + $sVps->uDiskSpace = ($disk_space / 1024 / 1024); /* MB */ + $sVps->uCpuCount = $cpu_count; + $sVps->uStatus = CVM_STATUS_BLANK; + $sVps->uIncomingTrafficLimit = $traffic; + $sVps->uOutgoingTrafficLimit = $traffic; + $sVps->uTotalTrafficLimit = $traffic; + $sVps->InsertIntoDatabase(); + $sVps->Deploy(); /* TODO: Flash message. */ diff --git a/frontend/module.admin.containers.php b/frontend/module.admin.containers.php index e647749..e80d793 100644 --- a/frontend/module.admin.containers.php +++ b/frontend/module.admin.containers.php @@ -13,13 +13,13 @@ if(!isset($_CVM)) { die("Unauthorized."); } -$sContainerList = array(); +$sVpsList = array(); if($result = mysql_query_cached("SELECT * FROM containers")) { foreach($result->data as $row) { - $sVps = new Container($row); + $sVps = new Vps($row); try { diff --git a/frontend/module.admin.node.php b/frontend/module.admin.node.php index 59e64fa..1a3c127 100644 --- a/frontend/module.admin.node.php +++ b/frontend/module.admin.node.php @@ -21,29 +21,29 @@ try { foreach($result->data as $row) { - $sContainer = new Container($row); + $sVps = new Vps($row); try { - $sStatus = $sContainer->sStatusText; + $sStatus = $sVps->sStatusText; } catch (SshException $e) { $sStatus = "unknown"; } - $sContainerList[] = array( - 'id' => $sContainer->sId, - 'hostname' => $sContainer->sHostname, - 'node' => $sContainer->sNode->sName, - 'node-hostname' => $sContainer->sNode->sHostname, - 'template' => $sContainer->sTemplate->sName, - 'diskspace' => number_format($sContainer->sDiskSpace / 1024), + $sVpsList[] = array( + 'id' => $sVps->sId, + 'hostname' => $sVps->sHostname, + 'node' => $sVps->sNode->sName, + 'node-hostname' => $sVps->sNode->sHostname, + 'template' => $sVps->sTemplate->sName, + 'diskspace' => number_format($sVps->sDiskSpace / 1024), 'diskspace-unit' => "GB", - 'guaranteed-ram' => $sContainer->sGuaranteedRam, + 'guaranteed-ram' => $sVps->sGuaranteedRam, 'guaranteed-ram-unit' => "MB", 'status' => $sStatus, - 'virtualization-type' => $sContainer->sVirtualizationType + 'virtualization-type' => $sVps->sVirtualizationType ); } } @@ -52,7 +52,7 @@ try 'id' => $sNode->sId, 'hostname' => $sNode->sHostname, 'location' => $sNode->sPhysicalLocation, - 'containers' => $sContainerList + 'vpses' => $sVpsList )); } catch (NotFoundException $e) diff --git a/frontend/module.admin.user.php b/frontend/module.admin.user.php index 535a4e7..4a56656 100644 --- a/frontend/module.admin.user.php +++ b/frontend/module.admin.user.php @@ -19,35 +19,35 @@ try { $sUserEntry = new User($router->uParameters[1]); - $sContainerList = array(); + $sVpsList = array(); if($result = mysql_query_cached("SELECT * FROM containers WHERE `UserId` = '{$sUserEntry->sId}'")) { foreach($result->data as $row) { - $sContainer = new Container($row); + $sVps = new Vps($row); try { - $sStatus = $sContainer->sStatusText; + $sStatus = $sVps->sStatusText; } catch (SshException $e) { $sStatus = "unknown"; } - $sContainerList[] = array( - 'id' => $sContainer->sId, - 'hostname' => $sContainer->sHostname, - 'node' => $sContainer->sNode->sName, - 'node-hostname' => $sContainer->sNode->sHostname, - 'template' => $sContainer->sTemplate->sName, - 'diskspace' => number_format($sContainer->sDiskSpace / 1024), + $sVpsList[] = array( + 'id' => $sVps->sId, + 'hostname' => $sVps->sHostname, + 'node' => $sVps->sNode->sName, + 'node-hostname' => $sVps->sNode->sHostname, + 'template' => $sVps->sTemplate->sName, + 'diskspace' => number_format($sVps->sDiskSpace / 1024), 'diskspace-unit' => "GB", - 'guaranteed-ram' => $sContainer->sGuaranteedRam, + 'guaranteed-ram' => $sVps->sGuaranteedRam, 'guaranteed-ram-unit' => "MB", 'status' => $sStatus, - 'virtualization-type' => $sContainer->sVirtualizationType + 'virtualization-type' => $sVps->sVirtualizationType ); } } @@ -57,8 +57,8 @@ try 'username' => $sUserEntry->sUsername, 'email' => $sUserEntry->sEmailAddress, 'accesslevel' => $sUserEntry->sAccessLevel, - 'containercount' => $sUserEntry->sContainerCount, - 'containers' => $sContainerList + 'vpscount' => $sUserEntry->sVpsCount, + 'vpses' => $sVpsList )); } catch (NotFoundException $e) diff --git a/frontend/module.list.php b/frontend/module.list.php index ed938fc..0653d2b 100644 --- a/frontend/module.list.php +++ b/frontend/module.list.php @@ -17,38 +17,38 @@ if($sLoggedIn === true) { $result = mysql_query_cached("SELECT * FROM containers WHERE `UserId` = '{$sUser->sId}'"); - $sContainerList = array(); + $sVpsList = array(); foreach($result->data as $row) { - $sContainer = new Container($row); + $sVps = new Vps($row); try { - $sStatus = $sContainer->sStatusText; + $sStatus = $sVps->sStatusText; } catch (SshException $e) { $sStatus = "unknown"; } - $sContainerList[] = array( - 'id' => $sContainer->sId, - 'hostname' => $sContainer->sHostname, - 'node' => $sContainer->sNode->sName, - 'node-hostname' => $sContainer->sNode->sHostname, - 'template' => $sContainer->sTemplate->sName, - 'diskspace' => number_format($sContainer->sDiskSpace / 1024), + $sVpsList[] = array( + 'id' => $sVps->sId, + 'hostname' => $sVps->sHostname, + 'node' => $sVps->sNode->sName, + 'node-hostname' => $sVps->sNode->sHostname, + 'template' => $sVps->sTemplate->sName, + 'diskspace' => number_format($sVps->sDiskSpace / 1024), 'diskspace-unit' => "GB", - 'guaranteed-ram' => $sContainer->sGuaranteedRam, + 'guaranteed-ram' => $sVps->sGuaranteedRam, 'guaranteed-ram-unit' => "MB", 'status' => $sStatus, - 'virtualization-type' => $sContainer->sVirtualizationType + 'virtualization-type' => $sVps->sVirtualizationType ); } $sMainContents = Templater::AdvancedParse("{$sTheme}/client/vps/list", $locale->strings, array( - 'containers' => $sContainerList + 'vpses' => $sVpsList )); } else diff --git a/frontend/module.test.php b/frontend/module.test.php index e15eac6..5ab46f4 100644 --- a/frontend/module.test.php +++ b/frontend/module.test.php @@ -41,24 +41,24 @@ test_iprange("192.168.1.0/27", "192.168.1.0", "192.168.1.31", 27, 4); test_iprange("192.168.1.0/32", "192.168.1.0", "192.168.1.0", 32, 4); test_iprange("192.168.1.0", "192.168.1.0", "192.168.1.0", 0, 4); -$sContainer = new Container(0); -$sContainer->uHostname = "test6.cryto.net"; -$sContainer->uInternalId = "110"; -$sContainer->uNodeId = 2; -$sContainer->uTemplateId = 1; -$sContainer->uUserId = 1; -$sContainer->uVirtualizationType = CVM_VIRTUALIZATION_OPENVZ; -$sContainer->uGuaranteedRam = 256; -$sContainer->uBurstableRam = 384; -$sContainer->uDiskSpace = 6000; -$sContainer->uCpuCount = 1; -$sContainer->uStatus = CVM_STATUS_BLANK; -$sContainer->uIncomingTrafficLimit = 500000000000; -$sContainer->uOutgoingTrafficLimit = 500000000000; -$sContainer->uTotalTrafficLimit = 1000000000000; -$sContainer->InsertIntoDatabase(); +$sVps = new Vps(0); +$sVps->uHostname = "test6.cryto.net"; +$sVps->uInternalId = "110"; +$sVps->uNodeId = 2; +$sVps->uTemplateId = 1; +$sVps->uUserId = 1; +$sVps->uVirtualizationType = CVM_VIRTUALIZATION_OPENVZ; +$sVps->uGuaranteedRam = 256; +$sVps->uBurstableRam = 384; +$sVps->uDiskSpace = 6000; +$sVps->uCpuCount = 1; +$sVps->uStatus = CVM_STATUS_BLANK; +$sVps->uIncomingTrafficLimit = 500000000000; +$sVps->uOutgoingTrafficLimit = 500000000000; +$sVps->uTotalTrafficLimit = 1000000000000; +$sVps->InsertIntoDatabase(); -$sContainer->Deploy(); +$sVps->Deploy(); */ /* var_dump( diff --git a/frontend/module.vps.overview.php b/frontend/module.vps.overview.php index 34b1a87..79667a4 100644 --- a/frontend/module.vps.overview.php +++ b/frontend/module.vps.overview.php @@ -29,39 +29,39 @@ if(!empty($router->uParameters[2])) } } -if($sContainer->sTotalTrafficLimit != 0) +if($sVps->sTotalTrafficLimit != 0) { - $sTrafficLimit = $sContainer->sTotalTrafficLimit; + $sTrafficLimit = $sVps->sTotalTrafficLimit; } else { - $sTrafficLimit = $sContainer->sIncomingTrafficLimit + $sContainer->sOutgoingTrafficLimit; + $sTrafficLimit = $sVps->sIncomingTrafficLimit + $sVps->sOutgoingTrafficLimit; } $sVariables = array( - 'id' => $sContainer->sId, - 'server-location' => $sContainer->sNode->sPhysicalLocation, - 'operating-system' => $sContainer->sTemplate->sName, - 'guaranteed-ram' => "{$sContainer->sGuaranteedRam}MB", - 'burstable-ram' => "{$sContainer->sBurstableRam}MB", - 'disk-space' => "{$sContainer->sDiskSpace}MB", - 'total-traffic-limit' => format_size($sContainer->sTotalTrafficLimit, 1024, true, 0) . "B", - 'incoming-traffic-limit'=> format_size($sContainer->sIncomingTrafficLimit, 1024, true, 0) . "B", - 'outgoing-traffic-limit'=> format_size($sContainer->sOutgoingTrafficLimit, 1024, true, 0) . "B", + 'id' => $sVps->sId, + 'server-location' => $sVps->sNode->sPhysicalLocation, + 'operating-system' => $sVps->sTemplate->sName, + 'guaranteed-ram' => "{$sVps->sGuaranteedRam}MB", + 'burstable-ram' => "{$sVps->sBurstableRam}MB", + 'disk-space' => "{$sVps->sDiskSpace}MB", + 'total-traffic-limit' => format_size($sVps->sTotalTrafficLimit, 1024, true, 0) . "B", + 'incoming-traffic-limit'=> format_size($sVps->sIncomingTrafficLimit, 1024, true, 0) . "B", + 'outgoing-traffic-limit'=> format_size($sVps->sOutgoingTrafficLimit, 1024, true, 0) . "B", 'bandwidth-limit' => "100mbit", - 'status' => $sContainer->sStatusText, - 'traffic-used' => number_format(($sContainer->sIncomingTrafficUsed + $sContainer->sOutgoingTrafficUsed) / 1024 / 1024 / 1024, 2), + 'status' => $sVps->sStatusText, + 'traffic-used' => number_format(($sVps->sIncomingTrafficUsed + $sVps->sOutgoingTrafficUsed) / 1024 / 1024 / 1024, 2), 'traffic-total' => number_format($sTrafficLimit / 1024 / 1024 / 1024, 0), - 'traffic-percentage' => number_format(($sContainer->sIncomingTrafficUsed + $sContainer->sOutgoingTrafficUsed) / $sTrafficLimit, 2), + 'traffic-percentage' => number_format(($sVps->sIncomingTrafficUsed + $sVps->sOutgoingTrafficUsed) / $sTrafficLimit, 2), 'traffic-unit' => "GB" ); try { $sVariables = array_merge($sVariables, array( - 'disk-used' => number_format($sContainer->sDiskUsed / 1024, 2), - 'disk-total' => number_format($sContainer->sDiskTotal / 1024, 2), - 'disk-percentage' => ($sContainer->sDiskTotal == 0) ? 0 : number_format(($sContainer->sDiskUsed / $sContainer->sDiskTotal) * 100, 2), + 'disk-used' => number_format($sVps->sDiskUsed / 1024, 2), + 'disk-total' => number_format($sVps->sDiskTotal / 1024, 2), + 'disk-percentage' => ($sVps->sDiskTotal == 0) ? 0 : number_format(($sVps->sDiskUsed / $sVps->sDiskTotal) * 100, 2), 'disk-unit' => "GB" )); } @@ -78,9 +78,9 @@ catch (SshExitException $e) try { $sVariables = array_merge($sVariables, array( - 'ram-used' => $sContainer->sRamUsed, - 'ram-total' => $sContainer->sRamTotal, - 'ram-percentage' => ($sContainer->sRamTotal == 0) ? 0 : number_format(($sContainer->sRamUsed / $sContainer->sRamTotal) * 100, 2), + 'ram-used' => $sVps->sRamUsed, + 'ram-total' => $sVps->sRamTotal, + 'ram-percentage' => ($sVps->sRamTotal == 0) ? 0 : number_format(($sVps->sRamUsed / $sVps->sRamTotal) * 100, 2), 'ram-unit' => "MB" )); } diff --git a/frontend/module.vps.password.php b/frontend/module.vps.password.php index f52292e..9c07e2a 100644 --- a/frontend/module.vps.password.php +++ b/frontend/module.vps.password.php @@ -23,7 +23,7 @@ if(isset($_POST['submit'])) { if($_POST['password'] == $_POST['confirm']) { - $sContainer->SetRootPassword($_POST['password']); + $sVps->SetRootPassword($_POST['password']); $sPageContents .= NewTemplater::Render("{$sTheme}/shared/error/success", $locale->strings, array( 'title' => $locale->strings['error-password-success-title'], @@ -46,14 +46,14 @@ if(isset($_POST['submit'])) )); } } - catch (ContainerSuspendedException $e) + catch (VpsSuspendedException $e) { $sPageContents .= NewTemplater::Render("{$sTheme}/shared/error/error", $locale->strings, array( 'title' => $locale->strings['error-password-suspended-title'], 'message' => $locale->strings['error-password-suspended-text'] )); } - catch (ContainerTerminatedException $e) + catch (VpsTerminatedException $e) { $sPageContents .= NewTemplater::Render("{$sTheme}/shared/error/error", $locale->strings, array( 'title' => $locale->strings['error-password-terminated-title'], @@ -77,6 +77,6 @@ if($display_form === true) )); $sPageContents .= Templater::AdvancedParse("{$sTheme}/client/vps/password", $locale->strings, array( - 'id' => $sContainer->sId + 'id' => $sVps->sId )); } diff --git a/frontend/module.vps.reinstall.php b/frontend/module.vps.reinstall.php index 6d37ecd..e976960 100644 --- a/frontend/module.vps.reinstall.php +++ b/frontend/module.vps.reinstall.php @@ -21,16 +21,16 @@ if(isset($_POST['submit'])) { try { - $sContainer->CheckAllowed(); + $sVps->CheckAllowed(); $sTemplate = new Template($_POST['template']); $sTemplate->CheckAvailable(); if(isset($_POST['confirm'])) { - $sContainer->uTemplateId = $sTemplate->sId; - $sContainer->InsertIntoDatabase(); - $sContainer->Reinstall(); - $sContainer->Start(); + $sVps->uTemplateId = $sTemplate->sId; + $sVps->InsertIntoDatabase(); + $sVps->Reinstall(); + $sVps->Start(); $sPageContents .= NewTemplater::Render("{$sTheme}/shared/error/success", $locale->strings, array( 'title' => $locale->strings['error-reinstall-success-title'], @@ -59,28 +59,28 @@ if(isset($_POST['submit'])) 'message' => $locale->strings['error-reinstall-unavailable-text'] )); } - catch (ContainerReinstallException $e) + catch (VpsReinstallException $e) { $sPageContents .= NewTemplater::Render("{$sTheme}/shared/error/error", $locale->strings, array( 'title' => $locale->strings['error-reinstall-failed-title'], 'message' => $locale->strings['error-reinstall-failed-text'] )); } - catch (ContainerStartException $e) + catch (VpsStartException $e) { $sPageContents .= NewTemplater::Render("{$sTheme}/shared/error/error", $locale->strings, array( 'title' => $locale->strings['error-reinstall-start-title'], 'message' => $locale->strings['error-reinstall-start-text'] )); } - catch (ContainerSuspendedException $e) + catch (VpsSuspendedException $e) { $sPageContents .= NewTemplater::Render("{$sTheme}/shared/error/error", $locale->strings, array( 'title' => $locale->strings['error-reinstall-suspended-title'], 'message' => $locale->strings['error-reinstall-suspended-text'] )); } - catch (ContainerTerminatedException $e) + catch (VpsTerminatedException $e) { $sPageContents .= NewTemplater::Render("{$sTheme}/shared/error/error", $locale->strings, array( 'title' => $locale->strings['error-reinstall-terminated-title'], diff --git a/frontend/rewrite.php b/frontend/rewrite.php index d628c9d..c3fa453 100644 --- a/frontend/rewrite.php +++ b/frontend/rewrite.php @@ -42,7 +42,7 @@ $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; +$sVps = null; $sPageContents = ""; $router = null; $sError = null; @@ -138,35 +138,35 @@ try '_prefilled_user' => true ), /* Admin - VPSes - Overview */ - '^/admin/containers/?$' => array( + '^/admin/vpses/?$' => array( 'target' => "module.admin.containers.php", 'authenticator' => "authenticator.admin.php", 'auth_error' => "error.access.php", '_menu' => "admin" ), /* Admin - VPSes - Create VPS */ - '^/admin/containers/add/?$' => array( + '^/admin/vpses/add/?$' => array( 'target' => "module.admin.containers.create.php", 'authenticator' => "authenticator.admin.php", 'auth_error' => "error.access.php", '_menu' => "admin" ), /* Admin - VPSes - Suspend */ - '^/admin/container/([0-9]+)/suspend/?$' => array( + '^/admin/vps/([0-9]+)/suspend/?$' => array( 'target' => "module.admin.container.suspend.php", 'authenticator' => "authenticator.admin.php", 'auth_error' => "error.access.php", '_menu' => "admin" ), /* Admin - VPSes - Transfer */ - '^/admin/container/([0-9]+)/transfer/?$' => array( + '^/admin/vps/([0-9]+)/transfer/?$' => array( 'target' => "module.admin.container.transfer.php", 'authenticator' => "authenticator.admin.php", 'auth_error' => "error.access.php", '_menu' => "admin" ), /* Admin - VPSes - Terminate */ - '^/admin/container/([0-9]+)/terminate/?$' => array( + '^/admin/vps/([0-9]+)/terminate/?$' => array( 'target' => "module.admin.container.terminate.php", 'authenticator' => "authenticator.admin.php", 'auth_error' => "error.access.php", @@ -209,14 +209,14 @@ try { $router->RouteRequest(); } - catch (ContainerSuspendedException $e) + catch (VpsSuspendedException $e) { $sError .= NewTemplater::Render("{$sTheme}/shared/error/error", $locale->strings, array( 'title' => $locale->strings['error-suspended-title'], 'message' => $e->getMessage() )); } - catch (ContainerTerminatedException $e) + catch (VpsTerminatedException $e) { $sError .= NewTemplater::Render("{$sTheme}/shared/error/error", $locale->strings, array( 'title' => $locale->strings['error-terminated-title'], @@ -229,7 +229,7 @@ try $sMainContents .= Templater::AdvancedParse("{$sTheme}/client/vps/main", $locale->strings, array( 'error' => $sError, 'contents' => $sPageContents, - 'id' => $sContainer->sId + 'id' => $sVps->sId )); } elseif($router->uVariables['menu'] == "admin" && $router->uVariables['display_menu'] === true) diff --git a/frontend/submodule.restart.php b/frontend/submodule.restart.php index 13d9925..c62ba4f 100644 --- a/frontend/submodule.restart.php +++ b/frontend/submodule.restart.php @@ -17,36 +17,36 @@ try { try { - $sContainer->Stop(); + $sVps->Stop(); } - catch(ContainerStopException $e) + catch(VpsStopException $e) { // we can make this silently fail, as the only important thing is that it starts again } - $sContainer->Start(); - $sContainer->sCurrentStatus = CVM_STATUS_STARTED; + $sVps->Start(); + $sVps->sCurrentStatus = CVM_STATUS_STARTED; $sError .= NewTemplater::Render("{$sTheme}/shared/error/success", $locale->strings, array( 'title' => $locale->strings['error-stop-restart-success'], 'message' => $locale->strings['error-stop-restart-success'] )); } -catch (ContainerSuspendedException $e) +catch (VpsSuspendedException $e) { $sError .= NewTemplater::Render("{$sTheme}/shared/error/error", $locale->strings, array( 'title' => $locale->strings['error-restart-suspended-title'], 'message' => $locale->strings['error-restart-suspended-text'] )); } -catch (ContainerTerminatedException $e) +catch (VpsTerminatedException $e) { $sError .= NewTemplater::Render("{$sTheme}/shared/error/error", $locale->strings, array( 'title' => $locale->strings['error-restart-terminated-title'], 'message' => $locale->strings['error-restart-terminated-text'] )); } -catch(ContainerStartException $e) +catch(VpsStartException $e) { $sError .= NewTemplater::Render("{$sTheme}/shared/error/error", $locale->strings, array( 'title' => $locale->strings['error-restart-start-title'], diff --git a/frontend/submodule.start.php b/frontend/submodule.start.php index 03ce7e0..0ffe1bd 100644 --- a/frontend/submodule.start.php +++ b/frontend/submodule.start.php @@ -13,33 +13,33 @@ if(!isset($_CVM)) { die("Unauthorized."); } -if($sContainer->sCurrentStatus != CVM_STATUS_STARTED) +if($sVps->sCurrentStatus != CVM_STATUS_STARTED) { try { - $sContainer->Start(); - $sContainer->sCurrentStatus = CVM_STATUS_STARTED; + $sVps->Start(); + $sVps->sCurrentStatus = CVM_STATUS_STARTED; $sError .= NewTemplater::Render("{$sTheme}/shared/error/success", $locale->strings, array( 'title' => $locale->strings['error-start-success-title'], 'message' => $locale->strings['error-start-success-text'] )); } - catch (ContainerSuspendedException $e) + catch (VpsSuspendedException $e) { $sError .= NewTemplater::Render("{$sTheme}/shared/error/error", $locale->strings, array( 'title' => $locale->strings['error-start-suspended-title'], 'message' => $locale->strings['error-start-suspended-text'] )); } - catch (ContainerTerminatedException $e) + catch (VpsTerminatedException $e) { $sError .= NewTemplater::Render("{$sTheme}/shared/error/error", $locale->strings, array( 'title' => $locale->strings['error-start-terminated-title'], 'message' => $locale->strings['error-start-terminated-text'] )); } - catch (ContainerStartException $e) + catch (VpsStartException $e) { $sError .= NewTemplater::Render("{$sTheme}/shared/error/error", $locale->strings, array( 'title' => $locale->strings['error-start-failed-title'], diff --git a/frontend/submodule.stop.php b/frontend/submodule.stop.php index aacefd8..1e41fb4 100644 --- a/frontend/submodule.stop.php +++ b/frontend/submodule.stop.php @@ -13,33 +13,33 @@ if(!isset($_CVM)) { die("Unauthorized."); } -if($sContainer->sCurrentStatus != CVM_STATUS_STOPPED) +if($sVps->sCurrentStatus != CVM_STATUS_STOPPED) { try { - $sContainer->Stop(); - $sContainer->sCurrentStatus = CVM_STATUS_STOPPED; + $sVps->Stop(); + $sVps->sCurrentStatus = CVM_STATUS_STOPPED; $sError .= NewTemplater::Render("{$sTheme}/shared/error/success", $locale->strings, array( 'title' => $locale->strings['error-stop-success-title'], 'message' => $locale->strings['error-stop-success-text'] )); } - catch (ContainerSuspendedException $e) + catch (VpsSuspendedException $e) { $sError .= NewTemplater::Render("{$sTheme}/shared/error/error", $locale->strings, array( 'title' => $locale->strings['error-stop-suspended-title'], 'message' => $locale->strings['error-stop-suspended-text'] )); } - catch (ContainerTerminatedException $e) + catch (VpsTerminatedException $e) { $sError .= NewTemplater::Render("{$sTheme}/shared/error/error", $locale->strings, array( 'title' => $locale->strings['error-stop-terminated-title'], 'message' => $locale->strings['error-stop-terminated-text'] )); } - catch(ContainerStopException $e) + catch(VpsStopException $e) { $sError .= NewTemplater::Render("{$sTheme}/shared/error/error", $locale->strings, array( 'title' => $locale->strings['error-stop-failed-title'], diff --git a/frontend/templates/default/admin/main.tpl b/frontend/templates/default/admin/main.tpl index 1d40a26..c7307d7 100644 --- a/frontend/templates/default/admin/main.tpl +++ b/frontend/templates/default/admin/main.tpl @@ -2,7 +2,7 @@ {%!menu-admin-overview} {%!menu-admin-nodes} {%!menu-admin-users} - {%!menu-admin-containers} + {%!menu-admin-vpses} {%?contents} diff --git a/frontend/templates/default/admin/node/lookup.tpl b/frontend/templates/default/admin/node/lookup.tpl index cd46301..fb7e811 100644 --- a/frontend/templates/default/admin/node/lookup.tpl +++ b/frontend/templates/default/admin/node/lookup.tpl @@ -21,7 +21,7 @@ -

{%!header-admin-node-containers}

+

{%!header-admin-node-vpses}

@@ -31,47 +31,47 @@ - {%if isset|containers == true} - {%foreach container in containers} - - + - + {%/foreach} {%/if} diff --git a/frontend/templates/default/admin/user/lookup.tpl b/frontend/templates/default/admin/user/lookup.tpl index 347425f..0a4d217 100644 --- a/frontend/templates/default/admin/user/lookup.tpl +++ b/frontend/templates/default/admin/user/lookup.tpl @@ -34,12 +34,12 @@ - - + +
{%!list-column-ram} {%!list-column-template}
- {%if container[status] == running} + {%if isset|vpses == true} + {%foreach vps in vpses} +
+ {%if vps[status] == running} {%!list-status-running} - {%elseif container[status] == stopped} + {%elseif vps[status] == stopped} {%!list-status-stopped} - {%elseif container[status] == suspended} + {%elseif vps[status] == suspended} {%!list-status-suspended} {%else} {%!list-status-unknown} {%/if} - - {%?container[hostname]} + + {%?vps[hostname]} - - {%if container[virtualization-type] == 1} + + {%if vps[virtualization-type] == 1} OpenVZ - {%/if}{%if container[virtualization-type] == 2} + {%/if}{%if vps[virtualization-type] == 2} Xen PV - {%/if}{%if container[virtualization-type] == 3} + {%/if}{%if vps[virtualization-type] == 3} Xen HVM - {%/if}{%if container[virtualization-type] == 4} + {%/if}{%if vps[virtualization-type] == 4} KVM {%/if} - {%?container[diskspace]} - {%?container[diskspace-unit]} + {%?vps[diskspace]} + {%?vps[diskspace-unit]} - {%?container[guaranteed-ram]} - {%?container[guaranteed-ram-unit]} + {%?vps[guaranteed-ram]} + {%?vps[guaranteed-ram-unit]} {%?container[template]}{%?vps[template]}
{%!admin-title-containers}{%?containercount}{%!admin-title-vpses}{%?vpscount}
-

{%!header-admin-user-containers}

+

{%!header-admin-user-vpses}

@@ -49,45 +49,45 @@ - {%foreach container in containers} - - + - + {%/foreach}
{%!list-column-ram} {%!list-column-template}
- {%if container[status] == running} + {%foreach vps in vpses} +
+ {%if vps[status] == running} {%!list-status-running} - {%elseif container[status] == stopped} + {%elseif vps[status] == stopped} {%!list-status-stopped} - {%elseif container[status] == suspended} + {%elseif vps[status] == suspended} {%!list-status-suspended} {%else} {%!list-status-unknown} {%/if} - - {%?container[hostname]} + + {%?vps[hostname]} - - {%if container[virtualization-type] == 1} + + {%if vps[virtualization-type] == 1} OpenVZ - {%/if}{%if container[virtualization-type] == 2} + {%/if}{%if vps[virtualization-type] == 2} Xen PV - {%/if}{%if container[virtualization-type] == 3} + {%/if}{%if vps[virtualization-type] == 3} Xen HVM - {%/if}{%if container[virtualization-type] == 4} + {%/if}{%if vps[virtualization-type] == 4} KVM {%/if} - {%?container[diskspace]} - {%?container[diskspace-unit]} + {%?vps[diskspace]} + {%?vps[diskspace-unit]} - {%?container[guaranteed-ram]} - {%?container[guaranteed-ram-unit]} + {%?vps[guaranteed-ram]} + {%?vps[guaranteed-ram-unit]} {%?container[template]}{%?vps[template]}
diff --git a/frontend/templates/default/admin/vps/add.tpl b/frontend/templates/default/admin/vps/add.tpl index 5edfe5a..fc0db22 100644 --- a/frontend/templates/default/admin/vps/add.tpl +++ b/frontend/templates/default/admin/vps/add.tpl @@ -1,4 +1,4 @@ -

{%!title-admin-addcontainer}

+

{%!title-admin-addvps}

{%if isempty|errors == false}
@@ -13,10 +13,10 @@
{%/if} -
+
- - {%select group="addcontainer" name="node"} + + {%select group="addvps" name="node"} {%foreach node in nodes} {%option value="(?node[id])" text="(?node[name]) ((?node[location]))"} {%/foreach} @@ -25,8 +25,8 @@
- - {%select group="addcontainer" name="template"} + + {%select group="addvps" name="template"} {%foreach template in templates} {%option value="(?template[id])" text="(?template[name])"} {%/foreach} @@ -35,8 +35,8 @@
- - {%select group="addcontainer" name="user"} + + {%select group="addvps" name="user"} {%foreach user in users} {%option value="(?user[id])" text="(?user[username]) (#(?user[id]))"} {%/foreach} @@ -45,44 +45,44 @@
- - {%input type="text" group="addcontainer" name="diskspace"} + + {%input type="text" group="addvps" name="diskspace"}
- - {%input type="text" group="addcontainer" name="guaranteed"} + + {%input type="text" group="addvps" name="guaranteed"}
- - {%input type="text" group="addcontainer" name="burstable"} + + {%input type="text" group="addvps" name="burstable"}
- - {%input type="text" group="addcontainer" name="cpucount"} + + {%input type="text" group="addvps" name="cpucount"}
- - {%input type="text" group="addcontainer" name="traffic"} + + {%input type="text" group="addvps" name="traffic"}
- - {%input type="text" group="addcontainer" name="hostname"} + + {%input type="text" group="addvps" name="hostname"}
- +
diff --git a/frontend/templates/default/admin/vps/list.tpl b/frontend/templates/default/admin/vps/list.tpl index df4889e..031ff96 100644 --- a/frontend/templates/default/admin/vps/list.tpl +++ b/frontend/templates/default/admin/vps/list.tpl @@ -11,7 +11,7 @@ {%foreach vps in vpses} - + {%if vps[status] == running} {%!list-status-running} {%elseif vps[status] == stopped} diff --git a/frontend/templates/default/admin/vps/suspend.tpl b/frontend/templates/default/admin/vps/suspend.tpl index 9a58f79..974d940 100644 --- a/frontend/templates/default/admin/vps/suspend.tpl +++ b/frontend/templates/default/admin/vps/suspend.tpl @@ -1,4 +1,4 @@ -
+ {%if suspended == false}

{%!title-admin-vps-suspend}

{%!vps-admin-suspend-text}

diff --git a/frontend/templates/default/client/vps/list.tpl b/frontend/templates/default/client/vps/list.tpl index 3f48054..c9a465e 100644 --- a/frontend/templates/default/client/vps/list.tpl +++ b/frontend/templates/default/client/vps/list.tpl @@ -8,52 +8,52 @@ {%!list-column-ram} {%!list-column-template} - {%foreach container in containers} - - - {%if container[status] == running} + {%foreach vps in vpses} + + + {%if vps[status] == running} {%!list-status-running} - {%elseif container[status] == stopped} + {%elseif vps[status] == stopped} {%!list-status-stopped} - {%elseif container[status] == suspended} + {%elseif vps[status] == suspended} {%!list-status-suspended} {%else} {%!list-status-unknown} {%/if} - - {%?container[hostname]} + + {%?vps[hostname]} - - {%if container[virtualization-type] == 1} + + {%if vps[virtualization-type] == 1} OpenVZ - {%/if}{%if container[virtualization-type] == 2} + {%/if}{%if vps[virtualization-type] == 2} Xen PV - {%/if}{%if container[virtualization-type] == 3} + {%/if}{%if vps[virtualization-type] == 3} Xen HVM - {%/if}{%if container[virtualization-type] == 4} + {%/if}{%if vps[virtualization-type] == 4} KVM {%/if} - - {%?container[node]} - ({%?container[node-hostname]}) + + {%?vps[node]} + ({%?vps[node-hostname]}) - {%?container[diskspace]} - {%?container[diskspace-unit]} + {%?vps[diskspace]} + {%?vps[diskspace-unit]} - {%?container[guaranteed-ram]} - {%?container[guaranteed-ram-unit]} + {%?vps[guaranteed-ram]} + {%?vps[guaranteed-ram-unit]} - {%?container[template]} + {%?vps[template]} {%/foreach} diff --git a/frontend/templates/default/client/vps/lookup.tpl b/frontend/templates/default/client/vps/lookup.tpl index 218e71b..dad1683 100644 --- a/frontend/templates/default/client/vps/lookup.tpl +++ b/frontend/templates/default/client/vps/lookup.tpl @@ -99,9 +99,9 @@ {%if accesslevel = 20}

{%!header-vps-admin}

- {%!vps-admin-suspend} - {%!vps-admin-transfer} - {%!vps-admin-terminate} + {%!vps-admin-suspend} + {%!vps-admin-transfer} + {%!vps-admin-terminate}
{%/if} diff --git a/frontend/templates/default/static/css/cvm.css b/frontend/templates/default/static/css/cvm.css index aa100e3..84b7c07 100644 --- a/frontend/templates/default/static/css/cvm.css +++ b/frontend/templates/default/static/css/cvm.css @@ -58,7 +58,7 @@ table.vertical th padding: 3px 7px; } -td.container-status img +td.vps-status img { margin-top: 3px; }