Change usage of the word 'container' to 'vps' everywhere

feature/node-rewrite
Sven Slootweg 12 years ago
parent 39893c940b
commit fe8ff917b2

@ -68,20 +68,20 @@ if(isset($_GET['key']) && $_GET['key'] == $settings['local_api_key'])
if($result = mysql_query_cached($query)) if($result = mysql_query_cached($query))
{ {
$sContainers = array(); $sVpses = array();
foreach($result->data as $row) foreach($result->data as $row)
{ {
$sContainer = new Container($row); $sVps = new Vps($row);
$sContainers[] = array( $sVpses[] = array(
'hostname' => $sContainer->sHostname, 'hostname' => $sVps->sHostname,
'internal_id' => $sContainer->sInternalId, 'internal_id' => $sVps->sInternalId,
'node_id' => $sContainer->sNodeId, 'node_id' => $sVps->sNodeId,
'status' => $sContainer->sStatus 'status' => $sVps->sStatus
); );
} }
$return_object = $sContainers; $return_object = $sVpses;
$return_success = true; $return_success = true;
} }
break; break;

@ -17,9 +17,9 @@ $router->uVariables['display_menu'] = true;
try 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."); throw new UnauthorizedException("You are not authorized to control this VPS.");
} }
@ -28,16 +28,16 @@ try
try try
{ {
$sContainer->CheckAllowed(); $sVps->CheckAllowed();
} }
catch (ContainerSuspendedException $e) catch (VpsSuspendedException $e)
{ {
$sMainContents .= NewTemplater::Render("{$sTheme}/shared/error/warning", $locale->strings, array( $sMainContents .= NewTemplater::Render("{$sTheme}/shared/error/warning", $locale->strings, array(
'title' => $locale->strings['warning-suspended-title'], 'title' => $locale->strings['warning-suspended-title'],
'message' => $locale->strings['warning-suspended-text'] 'message' => $locale->strings['warning-suspended-text']
)); ));
} }
catch (ContainerTerminatedException $e) catch (VpsTerminatedException $e)
{ {
$sMainContents .= NewTemplater::Render("{$sTheme}/shared/error/warning", $locale->strings, array( $sMainContents .= NewTemplater::Render("{$sTheme}/shared/error/warning", $locale->strings, array(
'title' => $locale->strings['warning-terminated-title'], 'title' => $locale->strings['warning-terminated-title'],

@ -13,7 +13,7 @@
if(!isset($_CVM)) { die("Unauthorized."); } if(!isset($_CVM)) { die("Unauthorized."); }
class Container extends CPHPDatabaseRecordClass class Vps extends CPHPDatabaseRecordClass
{ {
public $table_name = "containers"; public $table_name = "containers";
public $fill_query = "SELECT * FROM containers WHERE `Id` = '%d'"; public $fill_query = "SELECT * FROM containers WHERE `Id` = '%d'";
@ -260,11 +260,11 @@ class Container extends CPHPDatabaseRecordClass
{ {
if($this->sStatus == CVM_STATUS_SUSPENDED) 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) 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 else
{ {
@ -290,7 +290,7 @@ class Container extends CPHPDatabaseRecordClass
} }
else 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 else
{ {
throw new ContainerConfigureException($result->stderr, $result->returncode, $this->sInternalId); throw new VpsConfigureException($result->stderr, $result->returncode, $this->sInternalId);
} }
} }
else 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 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->Destroy();
$this->Deploy(); $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) 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) 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 else
{ {
@ -498,7 +498,7 @@ class Container extends CPHPDatabaseRecordClass
} }
else 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) 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) 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 else
{ {
$command = array("vzctl", "stop", $this->sInternalId); $command = array("vzctl", "stop", $this->sInternalId);
$result = $this->sNode->ssh->RunCommand($command, false); $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) if($result->returncode == 0 && strpos($result->stderr, "Unable to stop") === false)
{ {
$this->uStatus = CVM_STATUS_STOPPED; $this->uStatus = CVM_STATUS_STOPPED;
@ -527,7 +528,7 @@ class Container extends CPHPDatabaseRecordClass
} }
else 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->uStatus = CVM_STATUS_SUSPENDED;
$this->InsertIntoDatabase(); $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 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->uStatus = CVM_STATUS_STARTED;
$this->InsertIntoDatabase(); $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 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 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 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 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) 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) 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 else
{ {

@ -41,8 +41,8 @@ class User extends CPHPDatabaseRecordClass
{ {
switch($name) switch($name)
{ {
case "sContainerCount": case "sVpsCount":
return $this->GetContainerCount(); return $this->GetVpsCount();
break; break;
default: default:
return parent::__get($name); 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}'")) if($result = mysql_query_cached("SELECT * FROM containers WHERE `UserId` = '{$this->sId}'"))
{ {

@ -18,15 +18,15 @@ if($result = mysql_query_cached("SELECT * FROM containers"))
{ {
foreach($result->data as $row) foreach($result->data as $row)
{ {
$sContainer = new Container($row); $sVps = new Vps($row);
try 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. // This is not supposed to fail, as the VPS is running.
// Something shady going on. // Something shady going on.

@ -21,6 +21,8 @@ require("include.exceptions.php");
require("include.constants.php"); require("include.constants.php");
require("include.parsing.php"); require("include.parsing.php");
require("include.misc.php"); require("include.misc.php");
/* TODO: Reorganize and autoloading. */
require("classes/class.user.php"); require("classes/class.user.php");
require("classes/class.controller.php"); require("classes/class.controller.php");
require("classes/class.container.php"); require("classes/class.container.php");

@ -20,8 +20,8 @@ class SshAuthException extends SshException {}
class SshCommandException extends SshException {} class SshCommandException extends SshException {}
class SshExitException extends SshException {} class SshExitException extends SshException {}
// Container-related exceptions // VPS-related exceptions
class ContainerException extends Exception class VpsException extends Exception
{ {
private $id = ""; private $id = "";
@ -38,20 +38,20 @@ class ContainerException extends Exception
} }
} }
class ContainerCreateException extends ContainerException {} class VpsCreateException extends VpsException {}
class ContainerConfigureException extends ContainerException {} class VpsConfigureException extends VpsException {}
class ContainerStartException extends ContainerException {} class VpsStartException extends VpsException {}
class ContainerStopException extends ContainerException {} class VpsStopException extends VpsException {}
class ContainerSuspendException extends ContainerException {} class VpsSuspendException extends VpsException {}
class ContainerUnsuspendException extends ContainerException {} class VpsUnsuspendException extends VpsException {}
class ContainerSuspendedException extends ContainerException {} class VpsSuspendedException extends VpsException {}
class ContainerTerminatedException extends ContainerException {} class VpsTerminatedException extends VpsException {}
class ContainerDestroyException extends ContainerException {} class VpsDestroyException extends VpsException {}
class ContainerReinstallException extends ContainerException {} class VpsReinstallException extends VpsException {}
class ContainerDeployException extends ContainerException {} class VpsDeployException extends VpsException {}
class ContainerIpAddException extends ContainerException {} class VpsIpAddException extends VpsException {}
class ContainerIpRemoveException extends ContainerException {} class VpsIpRemoveException extends VpsException {}
class ContainerTrafficRetrieveException extends ContainerException {} class VpsTrafficRetrieveException extends VpsException {}
class UnauthorizedException extends Exception {} class UnauthorizedException extends Exception {}
class InsufficientAccessLevelException extends Exception {} class InsufficientAccessLevelException extends Exception {}

@ -68,7 +68,7 @@ menu-password; Root Password
## Administration panel menu items ## Administration panel menu items
menu-admin-overview; Overview menu-admin-overview; Overview
menu-admin-users; Users menu-admin-users; Users
menu-admin-containers; VPSes menu-admin-vpses; VPSes
menu-admin-nodes; Nodes menu-admin-nodes; Nodes
## Global warnings and errors ## Global warnings and errors
@ -237,12 +237,12 @@ admin-title-id; User ID
admin-title-username; Username admin-title-username; Username
admin-title-email; Email address admin-title-email; Email address
admin-title-accesslevel; Access level admin-title-accesslevel; Access level
admin-title-containers; VPS count admin-title-vpses; VPS count
admin-level-enduser; End user admin-level-enduser; End user
admin-level-reseller; Reseller admin-level-reseller; Reseller
admin-level-nodeadmin; Node administrator admin-level-nodeadmin; Node administrator
admin-level-masteradmin; Master 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 ## VPS list
title-admin-vpslist; VPS overview title-admin-vpslist; VPS overview
@ -267,7 +267,7 @@ toolbar-addnode; Add node
title-admin-nodeinfo; Node lookup title-admin-nodeinfo; Node lookup
toolbar-createvps; Create VPS toolbar-createvps; Create VPS
toolbar-editnode; Edit node details toolbar-editnode; Edit node details
header-admin-node-containers; VPSes on this node header-admin-node-vpses; VPSes on this node
## Add node ## Add node
title-admin-addnode; Add node title-admin-addnode; Add node
@ -286,7 +286,7 @@ addnode-privatekey; Private key
button-admin-addnode; Add node button-admin-addnode; Add node
## Create VPS ## 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-node; You did not select a valid node.
error-admin-vpses-add-user; You did not select a valid user. error-admin-vpses-add-user; You did not select a valid user.
error-admin-vpses-add-template; You did not select a valid template. 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-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-traffic; You did not enter a valid traffic allocation specification.
error-admin-vpses-add-hostname; You entered an invalid hostname. error-admin-vpses-add-hostname; You entered an invalid hostname.
addcontainer-node; Node addvps-node; Node
addcontainer-user; User addvps-user; User
addcontainer-diskspace; Disk space addvps-diskspace; Disk space
addcontainer-guaranteed; Guaranteed RAM addvps-guaranteed; Guaranteed RAM
addcontainer-burstable; Burstable RAM addvps-burstable; Burstable RAM
addcontainer-cpucount; CPUs addvps-cpucount; CPUs
addcontainer-traffic; Traffic allocation addvps-traffic; Traffic allocation
addcontainer-hostname; Hostname (optional) addvps-hostname; Hostname (optional)
addcontainer-template; Template addvps-template; Template
button-admin-addcontainer; Create VPS button-admin-addvps; Create VPS
## Administrative overview ## Administrative overview
title-admin-overview; Administrative overview title-admin-overview; Administrative overview

@ -17,13 +17,13 @@ try
{ {
$sUser->RequireAccessLevel(20); $sUser->RequireAccessLevel(20);
$sContainer = new Container($router->uParameters[1]); $sVps = new Vps($router->uParameters[1]);
if(isset($_POST['submit'])) if(isset($_POST['submit']))
{ {
if($_POST['action'] == "suspend") if($_POST['action'] == "suspend")
{ {
$sContainer->Suspend(); $sVps->Suspend();
$sMainContents .= NewTemplater::Render("{$sTheme}/shared/error/success", $locale->strings, array( $sMainContents .= NewTemplater::Render("{$sTheme}/shared/error/success", $locale->strings, array(
'title' => $locale->strings['error-suspend-success-title'], 'title' => $locale->strings['error-suspend-success-title'],
@ -32,7 +32,7 @@ try
} }
elseif($_POST['action'] == "unsuspend") elseif($_POST['action'] == "unsuspend")
{ {
$sContainer->Unsuspend(); $sVps->Unsuspend();
$sMainContents .= NewTemplater::Render("{$sTheme}/shared/error/success", $locale->strings, array( $sMainContents .= NewTemplater::Render("{$sTheme}/shared/error/success", $locale->strings, array(
'title' => $locale->strings['error-unsuspend-success-title'], '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. */ /* 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( $sPageContents = Templater::AdvancedParse("{$sTheme}/admin/vps/suspend", $locale->strings, array(
'id' => $sContainer->sId, 'id' => $sVps->sId,
'suspended' => $sSuspended 'suspended' => $sSuspended
)); ));
} }
@ -59,14 +59,14 @@ catch (NotFoundException $e)
'message' => $locale->strings['error-notfound-text'] 'message' => $locale->strings['error-notfound-text']
)); ));
} }
catch (ContainerSuspendException $e) catch (VpsSuspendException $e)
{ {
$sMainContents .= NewTemplater::Render("{$sTheme}/shared/error/error", $locale->strings, array( $sMainContents .= NewTemplater::Render("{$sTheme}/shared/error/error", $locale->strings, array(
'title' => $locale->strings['error-suspend-error-title'], 'title' => $locale->strings['error-suspend-error-title'],
'message' => $locale->strings['error-suspend-error-text'] 'message' => $locale->strings['error-suspend-error-text']
)); ));
} }
catch (ContainerUnsuspendException $e) catch (VpsUnsuspendException $e)
{ {
$sMainContents .= NewTemplater::Render("{$sTheme}/shared/error/error", $locale->strings, array( $sMainContents .= NewTemplater::Render("{$sTheme}/shared/error/error", $locale->strings, array(
'title' => $locale->strings['error-unsuspend-error-title'], 'title' => $locale->strings['error-unsuspend-error-title'],

@ -118,23 +118,23 @@ if(isset($_POST['submit']))
if(empty($sErrors)) if(empty($sErrors))
{ {
$sContainer = new Container(0); $sVps = new Vps(0);
$sContainer->uHostname = $hostname; $sVps->uHostname = $hostname;
$sContainer->uInternalId = first_unused_ctid(); $sVps->uInternalId = first_unused_ctid();
$sContainer->uNodeId = $node->sId; $sVps->uNodeId = $node->sId;
$sContainer->uTemplateId = $template->sId; $sVps->uTemplateId = $template->sId;
$sContainer->uUserId = $user->sId; $sVps->uUserId = $user->sId;
$sContainer->uVirtualizationType = CVM_VIRTUALIZATION_OPENVZ; $sVps->uVirtualizationType = CVM_VIRTUALIZATION_OPENVZ;
$sContainer->uGuaranteedRam = ($guaranteed_ram / 1024 / 1024); /* MB */ $sVps->uGuaranteedRam = ($guaranteed_ram / 1024 / 1024); /* MB */
$sContainer->uBurstableRam = ($burstable_ram / 1024 / 1024); /* MB */ $sVps->uBurstableRam = ($burstable_ram / 1024 / 1024); /* MB */
$sContainer->uDiskSpace = ($disk_space / 1024 / 1024); /* MB */ $sVps->uDiskSpace = ($disk_space / 1024 / 1024); /* MB */
$sContainer->uCpuCount = $cpu_count; $sVps->uCpuCount = $cpu_count;
$sContainer->uStatus = CVM_STATUS_BLANK; $sVps->uStatus = CVM_STATUS_BLANK;
$sContainer->uIncomingTrafficLimit = $traffic; $sVps->uIncomingTrafficLimit = $traffic;
$sContainer->uOutgoingTrafficLimit = $traffic; $sVps->uOutgoingTrafficLimit = $traffic;
$sContainer->uTotalTrafficLimit = $traffic; $sVps->uTotalTrafficLimit = $traffic;
$sContainer->InsertIntoDatabase(); $sVps->InsertIntoDatabase();
$sContainer->Deploy(); $sVps->Deploy();
/* TODO: Flash message. */ /* TODO: Flash message. */

@ -13,13 +13,13 @@
if(!isset($_CVM)) { die("Unauthorized."); } if(!isset($_CVM)) { die("Unauthorized."); }
$sContainerList = array(); $sVpsList = array();
if($result = mysql_query_cached("SELECT * FROM containers")) if($result = mysql_query_cached("SELECT * FROM containers"))
{ {
foreach($result->data as $row) foreach($result->data as $row)
{ {
$sVps = new Container($row); $sVps = new Vps($row);
try try
{ {

@ -21,29 +21,29 @@ try
{ {
foreach($result->data as $row) foreach($result->data as $row)
{ {
$sContainer = new Container($row); $sVps = new Vps($row);
try try
{ {
$sStatus = $sContainer->sStatusText; $sStatus = $sVps->sStatusText;
} }
catch (SshException $e) catch (SshException $e)
{ {
$sStatus = "unknown"; $sStatus = "unknown";
} }
$sContainerList[] = array( $sVpsList[] = array(
'id' => $sContainer->sId, 'id' => $sVps->sId,
'hostname' => $sContainer->sHostname, 'hostname' => $sVps->sHostname,
'node' => $sContainer->sNode->sName, 'node' => $sVps->sNode->sName,
'node-hostname' => $sContainer->sNode->sHostname, 'node-hostname' => $sVps->sNode->sHostname,
'template' => $sContainer->sTemplate->sName, 'template' => $sVps->sTemplate->sName,
'diskspace' => number_format($sContainer->sDiskSpace / 1024), 'diskspace' => number_format($sVps->sDiskSpace / 1024),
'diskspace-unit' => "GB", 'diskspace-unit' => "GB",
'guaranteed-ram' => $sContainer->sGuaranteedRam, 'guaranteed-ram' => $sVps->sGuaranteedRam,
'guaranteed-ram-unit' => "MB", 'guaranteed-ram-unit' => "MB",
'status' => $sStatus, 'status' => $sStatus,
'virtualization-type' => $sContainer->sVirtualizationType 'virtualization-type' => $sVps->sVirtualizationType
); );
} }
} }
@ -52,7 +52,7 @@ try
'id' => $sNode->sId, 'id' => $sNode->sId,
'hostname' => $sNode->sHostname, 'hostname' => $sNode->sHostname,
'location' => $sNode->sPhysicalLocation, 'location' => $sNode->sPhysicalLocation,
'containers' => $sContainerList 'vpses' => $sVpsList
)); ));
} }
catch (NotFoundException $e) catch (NotFoundException $e)

@ -19,35 +19,35 @@ try
{ {
$sUserEntry = new User($router->uParameters[1]); $sUserEntry = new User($router->uParameters[1]);
$sContainerList = array(); $sVpsList = array();
if($result = mysql_query_cached("SELECT * FROM containers WHERE `UserId` = '{$sUserEntry->sId}'")) if($result = mysql_query_cached("SELECT * FROM containers WHERE `UserId` = '{$sUserEntry->sId}'"))
{ {
foreach($result->data as $row) foreach($result->data as $row)
{ {
$sContainer = new Container($row); $sVps = new Vps($row);
try try
{ {
$sStatus = $sContainer->sStatusText; $sStatus = $sVps->sStatusText;
} }
catch (SshException $e) catch (SshException $e)
{ {
$sStatus = "unknown"; $sStatus = "unknown";
} }
$sContainerList[] = array( $sVpsList[] = array(
'id' => $sContainer->sId, 'id' => $sVps->sId,
'hostname' => $sContainer->sHostname, 'hostname' => $sVps->sHostname,
'node' => $sContainer->sNode->sName, 'node' => $sVps->sNode->sName,
'node-hostname' => $sContainer->sNode->sHostname, 'node-hostname' => $sVps->sNode->sHostname,
'template' => $sContainer->sTemplate->sName, 'template' => $sVps->sTemplate->sName,
'diskspace' => number_format($sContainer->sDiskSpace / 1024), 'diskspace' => number_format($sVps->sDiskSpace / 1024),
'diskspace-unit' => "GB", 'diskspace-unit' => "GB",
'guaranteed-ram' => $sContainer->sGuaranteedRam, 'guaranteed-ram' => $sVps->sGuaranteedRam,
'guaranteed-ram-unit' => "MB", 'guaranteed-ram-unit' => "MB",
'status' => $sStatus, 'status' => $sStatus,
'virtualization-type' => $sContainer->sVirtualizationType 'virtualization-type' => $sVps->sVirtualizationType
); );
} }
} }
@ -57,8 +57,8 @@ try
'username' => $sUserEntry->sUsername, 'username' => $sUserEntry->sUsername,
'email' => $sUserEntry->sEmailAddress, 'email' => $sUserEntry->sEmailAddress,
'accesslevel' => $sUserEntry->sAccessLevel, 'accesslevel' => $sUserEntry->sAccessLevel,
'containercount' => $sUserEntry->sContainerCount, 'vpscount' => $sUserEntry->sVpsCount,
'containers' => $sContainerList 'vpses' => $sVpsList
)); ));
} }
catch (NotFoundException $e) catch (NotFoundException $e)

@ -17,38 +17,38 @@ if($sLoggedIn === true)
{ {
$result = mysql_query_cached("SELECT * FROM containers WHERE `UserId` = '{$sUser->sId}'"); $result = mysql_query_cached("SELECT * FROM containers WHERE `UserId` = '{$sUser->sId}'");
$sContainerList = array(); $sVpsList = array();
foreach($result->data as $row) foreach($result->data as $row)
{ {
$sContainer = new Container($row); $sVps = new Vps($row);
try try
{ {
$sStatus = $sContainer->sStatusText; $sStatus = $sVps->sStatusText;
} }
catch (SshException $e) catch (SshException $e)
{ {
$sStatus = "unknown"; $sStatus = "unknown";
} }
$sContainerList[] = array( $sVpsList[] = array(
'id' => $sContainer->sId, 'id' => $sVps->sId,
'hostname' => $sContainer->sHostname, 'hostname' => $sVps->sHostname,
'node' => $sContainer->sNode->sName, 'node' => $sVps->sNode->sName,
'node-hostname' => $sContainer->sNode->sHostname, 'node-hostname' => $sVps->sNode->sHostname,
'template' => $sContainer->sTemplate->sName, 'template' => $sVps->sTemplate->sName,
'diskspace' => number_format($sContainer->sDiskSpace / 1024), 'diskspace' => number_format($sVps->sDiskSpace / 1024),
'diskspace-unit' => "GB", 'diskspace-unit' => "GB",
'guaranteed-ram' => $sContainer->sGuaranteedRam, 'guaranteed-ram' => $sVps->sGuaranteedRam,
'guaranteed-ram-unit' => "MB", 'guaranteed-ram-unit' => "MB",
'status' => $sStatus, 'status' => $sStatus,
'virtualization-type' => $sContainer->sVirtualizationType 'virtualization-type' => $sVps->sVirtualizationType
); );
} }
$sMainContents = Templater::AdvancedParse("{$sTheme}/client/vps/list", $locale->strings, array( $sMainContents = Templater::AdvancedParse("{$sTheme}/client/vps/list", $locale->strings, array(
'containers' => $sContainerList 'vpses' => $sVpsList
)); ));
} }
else else

@ -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/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); test_iprange("192.168.1.0", "192.168.1.0", "192.168.1.0", 0, 4);
$sContainer = new Container(0); $sVps = new Vps(0);
$sContainer->uHostname = "test6.cryto.net"; $sVps->uHostname = "test6.cryto.net";
$sContainer->uInternalId = "110"; $sVps->uInternalId = "110";
$sContainer->uNodeId = 2; $sVps->uNodeId = 2;
$sContainer->uTemplateId = 1; $sVps->uTemplateId = 1;
$sContainer->uUserId = 1; $sVps->uUserId = 1;
$sContainer->uVirtualizationType = CVM_VIRTUALIZATION_OPENVZ; $sVps->uVirtualizationType = CVM_VIRTUALIZATION_OPENVZ;
$sContainer->uGuaranteedRam = 256; $sVps->uGuaranteedRam = 256;
$sContainer->uBurstableRam = 384; $sVps->uBurstableRam = 384;
$sContainer->uDiskSpace = 6000; $sVps->uDiskSpace = 6000;
$sContainer->uCpuCount = 1; $sVps->uCpuCount = 1;
$sContainer->uStatus = CVM_STATUS_BLANK; $sVps->uStatus = CVM_STATUS_BLANK;
$sContainer->uIncomingTrafficLimit = 500000000000; $sVps->uIncomingTrafficLimit = 500000000000;
$sContainer->uOutgoingTrafficLimit = 500000000000; $sVps->uOutgoingTrafficLimit = 500000000000;
$sContainer->uTotalTrafficLimit = 1000000000000; $sVps->uTotalTrafficLimit = 1000000000000;
$sContainer->InsertIntoDatabase(); $sVps->InsertIntoDatabase();
$sContainer->Deploy(); $sVps->Deploy();
*/ */
/* /*
var_dump( var_dump(

@ -29,39 +29,39 @@ if(!empty($router->uParameters[2]))
} }
} }
if($sContainer->sTotalTrafficLimit != 0) if($sVps->sTotalTrafficLimit != 0)
{ {
$sTrafficLimit = $sContainer->sTotalTrafficLimit; $sTrafficLimit = $sVps->sTotalTrafficLimit;
} }
else else
{ {
$sTrafficLimit = $sContainer->sIncomingTrafficLimit + $sContainer->sOutgoingTrafficLimit; $sTrafficLimit = $sVps->sIncomingTrafficLimit + $sVps->sOutgoingTrafficLimit;
} }
$sVariables = array( $sVariables = array(
'id' => $sContainer->sId, 'id' => $sVps->sId,
'server-location' => $sContainer->sNode->sPhysicalLocation, 'server-location' => $sVps->sNode->sPhysicalLocation,
'operating-system' => $sContainer->sTemplate->sName, 'operating-system' => $sVps->sTemplate->sName,
'guaranteed-ram' => "{$sContainer->sGuaranteedRam}MB", 'guaranteed-ram' => "{$sVps->sGuaranteedRam}MB",
'burstable-ram' => "{$sContainer->sBurstableRam}MB", 'burstable-ram' => "{$sVps->sBurstableRam}MB",
'disk-space' => "{$sContainer->sDiskSpace}MB", 'disk-space' => "{$sVps->sDiskSpace}MB",
'total-traffic-limit' => format_size($sContainer->sTotalTrafficLimit, 1024, true, 0) . "B", 'total-traffic-limit' => format_size($sVps->sTotalTrafficLimit, 1024, true, 0) . "B",
'incoming-traffic-limit'=> format_size($sContainer->sIncomingTrafficLimit, 1024, true, 0) . "B", 'incoming-traffic-limit'=> format_size($sVps->sIncomingTrafficLimit, 1024, true, 0) . "B",
'outgoing-traffic-limit'=> format_size($sContainer->sOutgoingTrafficLimit, 1024, true, 0) . "B", 'outgoing-traffic-limit'=> format_size($sVps->sOutgoingTrafficLimit, 1024, true, 0) . "B",
'bandwidth-limit' => "100mbit", 'bandwidth-limit' => "100mbit",
'status' => $sContainer->sStatusText, 'status' => $sVps->sStatusText,
'traffic-used' => number_format(($sContainer->sIncomingTrafficUsed + $sContainer->sOutgoingTrafficUsed) / 1024 / 1024 / 1024, 2), 'traffic-used' => number_format(($sVps->sIncomingTrafficUsed + $sVps->sOutgoingTrafficUsed) / 1024 / 1024 / 1024, 2),
'traffic-total' => number_format($sTrafficLimit / 1024 / 1024 / 1024, 0), '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" 'traffic-unit' => "GB"
); );
try try
{ {
$sVariables = array_merge($sVariables, array( $sVariables = array_merge($sVariables, array(
'disk-used' => number_format($sContainer->sDiskUsed / 1024, 2), 'disk-used' => number_format($sVps->sDiskUsed / 1024, 2),
'disk-total' => number_format($sContainer->sDiskTotal / 1024, 2), 'disk-total' => number_format($sVps->sDiskTotal / 1024, 2),
'disk-percentage' => ($sContainer->sDiskTotal == 0) ? 0 : number_format(($sContainer->sDiskUsed / $sContainer->sDiskTotal) * 100, 2), 'disk-percentage' => ($sVps->sDiskTotal == 0) ? 0 : number_format(($sVps->sDiskUsed / $sVps->sDiskTotal) * 100, 2),
'disk-unit' => "GB" 'disk-unit' => "GB"
)); ));
} }
@ -78,9 +78,9 @@ catch (SshExitException $e)
try try
{ {
$sVariables = array_merge($sVariables, array( $sVariables = array_merge($sVariables, array(
'ram-used' => $sContainer->sRamUsed, 'ram-used' => $sVps->sRamUsed,
'ram-total' => $sContainer->sRamTotal, 'ram-total' => $sVps->sRamTotal,
'ram-percentage' => ($sContainer->sRamTotal == 0) ? 0 : number_format(($sContainer->sRamUsed / $sContainer->sRamTotal) * 100, 2), 'ram-percentage' => ($sVps->sRamTotal == 0) ? 0 : number_format(($sVps->sRamUsed / $sVps->sRamTotal) * 100, 2),
'ram-unit' => "MB" 'ram-unit' => "MB"
)); ));
} }

@ -23,7 +23,7 @@ if(isset($_POST['submit']))
{ {
if($_POST['password'] == $_POST['confirm']) if($_POST['password'] == $_POST['confirm'])
{ {
$sContainer->SetRootPassword($_POST['password']); $sVps->SetRootPassword($_POST['password']);
$sPageContents .= NewTemplater::Render("{$sTheme}/shared/error/success", $locale->strings, array( $sPageContents .= NewTemplater::Render("{$sTheme}/shared/error/success", $locale->strings, array(
'title' => $locale->strings['error-password-success-title'], '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( $sPageContents .= NewTemplater::Render("{$sTheme}/shared/error/error", $locale->strings, array(
'title' => $locale->strings['error-password-suspended-title'], 'title' => $locale->strings['error-password-suspended-title'],
'message' => $locale->strings['error-password-suspended-text'] 'message' => $locale->strings['error-password-suspended-text']
)); ));
} }
catch (ContainerTerminatedException $e) catch (VpsTerminatedException $e)
{ {
$sPageContents .= NewTemplater::Render("{$sTheme}/shared/error/error", $locale->strings, array( $sPageContents .= NewTemplater::Render("{$sTheme}/shared/error/error", $locale->strings, array(
'title' => $locale->strings['error-password-terminated-title'], '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( $sPageContents .= Templater::AdvancedParse("{$sTheme}/client/vps/password", $locale->strings, array(
'id' => $sContainer->sId 'id' => $sVps->sId
)); ));
} }

@ -21,16 +21,16 @@ if(isset($_POST['submit']))
{ {
try try
{ {
$sContainer->CheckAllowed(); $sVps->CheckAllowed();
$sTemplate = new Template($_POST['template']); $sTemplate = new Template($_POST['template']);
$sTemplate->CheckAvailable(); $sTemplate->CheckAvailable();
if(isset($_POST['confirm'])) if(isset($_POST['confirm']))
{ {
$sContainer->uTemplateId = $sTemplate->sId; $sVps->uTemplateId = $sTemplate->sId;
$sContainer->InsertIntoDatabase(); $sVps->InsertIntoDatabase();
$sContainer->Reinstall(); $sVps->Reinstall();
$sContainer->Start(); $sVps->Start();
$sPageContents .= NewTemplater::Render("{$sTheme}/shared/error/success", $locale->strings, array( $sPageContents .= NewTemplater::Render("{$sTheme}/shared/error/success", $locale->strings, array(
'title' => $locale->strings['error-reinstall-success-title'], 'title' => $locale->strings['error-reinstall-success-title'],
@ -59,28 +59,28 @@ if(isset($_POST['submit']))
'message' => $locale->strings['error-reinstall-unavailable-text'] 'message' => $locale->strings['error-reinstall-unavailable-text']
)); ));
} }
catch (ContainerReinstallException $e) catch (VpsReinstallException $e)
{ {
$sPageContents .= NewTemplater::Render("{$sTheme}/shared/error/error", $locale->strings, array( $sPageContents .= NewTemplater::Render("{$sTheme}/shared/error/error", $locale->strings, array(
'title' => $locale->strings['error-reinstall-failed-title'], 'title' => $locale->strings['error-reinstall-failed-title'],
'message' => $locale->strings['error-reinstall-failed-text'] 'message' => $locale->strings['error-reinstall-failed-text']
)); ));
} }
catch (ContainerStartException $e) catch (VpsStartException $e)
{ {
$sPageContents .= NewTemplater::Render("{$sTheme}/shared/error/error", $locale->strings, array( $sPageContents .= NewTemplater::Render("{$sTheme}/shared/error/error", $locale->strings, array(
'title' => $locale->strings['error-reinstall-start-title'], 'title' => $locale->strings['error-reinstall-start-title'],
'message' => $locale->strings['error-reinstall-start-text'] 'message' => $locale->strings['error-reinstall-start-text']
)); ));
} }
catch (ContainerSuspendedException $e) catch (VpsSuspendedException $e)
{ {
$sPageContents .= NewTemplater::Render("{$sTheme}/shared/error/error", $locale->strings, array( $sPageContents .= NewTemplater::Render("{$sTheme}/shared/error/error", $locale->strings, array(
'title' => $locale->strings['error-reinstall-suspended-title'], 'title' => $locale->strings['error-reinstall-suspended-title'],
'message' => $locale->strings['error-reinstall-suspended-text'] 'message' => $locale->strings['error-reinstall-suspended-text']
)); ));
} }
catch (ContainerTerminatedException $e) catch (VpsTerminatedException $e)
{ {
$sPageContents .= NewTemplater::Render("{$sTheme}/shared/error/error", $locale->strings, array( $sPageContents .= NewTemplater::Render("{$sTheme}/shared/error/error", $locale->strings, array(
'title' => $locale->strings['error-reinstall-terminated-title'], 'title' => $locale->strings['error-reinstall-terminated-title'],

@ -42,7 +42,7 @@ $sPageTitle = "";
// Initialize some variables to ensure they are available through the application. // 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. // This works around the inability of CPHP to retain variables set in the first rewrite.
$sContainer = null; $sVps = null;
$sPageContents = ""; $sPageContents = "";
$router = null; $router = null;
$sError = null; $sError = null;
@ -138,35 +138,35 @@ try
'_prefilled_user' => true '_prefilled_user' => true
), ),
/* Admin - VPSes - Overview */ /* Admin - VPSes - Overview */
'^/admin/containers/?$' => array( '^/admin/vpses/?$' => array(
'target' => "module.admin.containers.php", 'target' => "module.admin.containers.php",
'authenticator' => "authenticator.admin.php", 'authenticator' => "authenticator.admin.php",
'auth_error' => "error.access.php", 'auth_error' => "error.access.php",
'_menu' => "admin" '_menu' => "admin"
), ),
/* Admin - VPSes - Create VPS */ /* Admin - VPSes - Create VPS */
'^/admin/containers/add/?$' => array( '^/admin/vpses/add/?$' => array(
'target' => "module.admin.containers.create.php", 'target' => "module.admin.containers.create.php",
'authenticator' => "authenticator.admin.php", 'authenticator' => "authenticator.admin.php",
'auth_error' => "error.access.php", 'auth_error' => "error.access.php",
'_menu' => "admin" '_menu' => "admin"
), ),
/* Admin - VPSes - Suspend */ /* Admin - VPSes - Suspend */
'^/admin/container/([0-9]+)/suspend/?$' => array( '^/admin/vps/([0-9]+)/suspend/?$' => array(
'target' => "module.admin.container.suspend.php", 'target' => "module.admin.container.suspend.php",
'authenticator' => "authenticator.admin.php", 'authenticator' => "authenticator.admin.php",
'auth_error' => "error.access.php", 'auth_error' => "error.access.php",
'_menu' => "admin" '_menu' => "admin"
), ),
/* Admin - VPSes - Transfer */ /* Admin - VPSes - Transfer */
'^/admin/container/([0-9]+)/transfer/?$' => array( '^/admin/vps/([0-9]+)/transfer/?$' => array(
'target' => "module.admin.container.transfer.php", 'target' => "module.admin.container.transfer.php",
'authenticator' => "authenticator.admin.php", 'authenticator' => "authenticator.admin.php",
'auth_error' => "error.access.php", 'auth_error' => "error.access.php",
'_menu' => "admin" '_menu' => "admin"
), ),
/* Admin - VPSes - Terminate */ /* Admin - VPSes - Terminate */
'^/admin/container/([0-9]+)/terminate/?$' => array( '^/admin/vps/([0-9]+)/terminate/?$' => array(
'target' => "module.admin.container.terminate.php", 'target' => "module.admin.container.terminate.php",
'authenticator' => "authenticator.admin.php", 'authenticator' => "authenticator.admin.php",
'auth_error' => "error.access.php", 'auth_error' => "error.access.php",
@ -209,14 +209,14 @@ try
{ {
$router->RouteRequest(); $router->RouteRequest();
} }
catch (ContainerSuspendedException $e) catch (VpsSuspendedException $e)
{ {
$sError .= NewTemplater::Render("{$sTheme}/shared/error/error", $locale->strings, array( $sError .= NewTemplater::Render("{$sTheme}/shared/error/error", $locale->strings, array(
'title' => $locale->strings['error-suspended-title'], 'title' => $locale->strings['error-suspended-title'],
'message' => $e->getMessage() 'message' => $e->getMessage()
)); ));
} }
catch (ContainerTerminatedException $e) catch (VpsTerminatedException $e)
{ {
$sError .= NewTemplater::Render("{$sTheme}/shared/error/error", $locale->strings, array( $sError .= NewTemplater::Render("{$sTheme}/shared/error/error", $locale->strings, array(
'title' => $locale->strings['error-terminated-title'], 'title' => $locale->strings['error-terminated-title'],
@ -229,7 +229,7 @@ try
$sMainContents .= Templater::AdvancedParse("{$sTheme}/client/vps/main", $locale->strings, array( $sMainContents .= Templater::AdvancedParse("{$sTheme}/client/vps/main", $locale->strings, array(
'error' => $sError, 'error' => $sError,
'contents' => $sPageContents, 'contents' => $sPageContents,
'id' => $sContainer->sId 'id' => $sVps->sId
)); ));
} }
elseif($router->uVariables['menu'] == "admin" && $router->uVariables['display_menu'] === true) elseif($router->uVariables['menu'] == "admin" && $router->uVariables['display_menu'] === true)

@ -17,36 +17,36 @@ try
{ {
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 // we can make this silently fail, as the only important thing is that it starts again
} }
$sContainer->Start(); $sVps->Start();
$sContainer->sCurrentStatus = CVM_STATUS_STARTED; $sVps->sCurrentStatus = CVM_STATUS_STARTED;
$sError .= NewTemplater::Render("{$sTheme}/shared/error/success", $locale->strings, array( $sError .= NewTemplater::Render("{$sTheme}/shared/error/success", $locale->strings, array(
'title' => $locale->strings['error-stop-restart-success'], 'title' => $locale->strings['error-stop-restart-success'],
'message' => $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( $sError .= NewTemplater::Render("{$sTheme}/shared/error/error", $locale->strings, array(
'title' => $locale->strings['error-restart-suspended-title'], 'title' => $locale->strings['error-restart-suspended-title'],
'message' => $locale->strings['error-restart-suspended-text'] 'message' => $locale->strings['error-restart-suspended-text']
)); ));
} }
catch (ContainerTerminatedException $e) catch (VpsTerminatedException $e)
{ {
$sError .= NewTemplater::Render("{$sTheme}/shared/error/error", $locale->strings, array( $sError .= NewTemplater::Render("{$sTheme}/shared/error/error", $locale->strings, array(
'title' => $locale->strings['error-restart-terminated-title'], 'title' => $locale->strings['error-restart-terminated-title'],
'message' => $locale->strings['error-restart-terminated-text'] 'message' => $locale->strings['error-restart-terminated-text']
)); ));
} }
catch(ContainerStartException $e) catch(VpsStartException $e)
{ {
$sError .= NewTemplater::Render("{$sTheme}/shared/error/error", $locale->strings, array( $sError .= NewTemplater::Render("{$sTheme}/shared/error/error", $locale->strings, array(
'title' => $locale->strings['error-restart-start-title'], 'title' => $locale->strings['error-restart-start-title'],

@ -13,33 +13,33 @@
if(!isset($_CVM)) { die("Unauthorized."); } if(!isset($_CVM)) { die("Unauthorized."); }
if($sContainer->sCurrentStatus != CVM_STATUS_STARTED) if($sVps->sCurrentStatus != CVM_STATUS_STARTED)
{ {
try try
{ {
$sContainer->Start(); $sVps->Start();
$sContainer->sCurrentStatus = CVM_STATUS_STARTED; $sVps->sCurrentStatus = CVM_STATUS_STARTED;
$sError .= NewTemplater::Render("{$sTheme}/shared/error/success", $locale->strings, array( $sError .= NewTemplater::Render("{$sTheme}/shared/error/success", $locale->strings, array(
'title' => $locale->strings['error-start-success-title'], 'title' => $locale->strings['error-start-success-title'],
'message' => $locale->strings['error-start-success-text'] 'message' => $locale->strings['error-start-success-text']
)); ));
} }
catch (ContainerSuspendedException $e) catch (VpsSuspendedException $e)
{ {
$sError .= NewTemplater::Render("{$sTheme}/shared/error/error", $locale->strings, array( $sError .= NewTemplater::Render("{$sTheme}/shared/error/error", $locale->strings, array(
'title' => $locale->strings['error-start-suspended-title'], 'title' => $locale->strings['error-start-suspended-title'],
'message' => $locale->strings['error-start-suspended-text'] 'message' => $locale->strings['error-start-suspended-text']
)); ));
} }
catch (ContainerTerminatedException $e) catch (VpsTerminatedException $e)
{ {
$sError .= NewTemplater::Render("{$sTheme}/shared/error/error", $locale->strings, array( $sError .= NewTemplater::Render("{$sTheme}/shared/error/error", $locale->strings, array(
'title' => $locale->strings['error-start-terminated-title'], 'title' => $locale->strings['error-start-terminated-title'],
'message' => $locale->strings['error-start-terminated-text'] 'message' => $locale->strings['error-start-terminated-text']
)); ));
} }
catch (ContainerStartException $e) catch (VpsStartException $e)
{ {
$sError .= NewTemplater::Render("{$sTheme}/shared/error/error", $locale->strings, array( $sError .= NewTemplater::Render("{$sTheme}/shared/error/error", $locale->strings, array(
'title' => $locale->strings['error-start-failed-title'], 'title' => $locale->strings['error-start-failed-title'],

@ -13,33 +13,33 @@
if(!isset($_CVM)) { die("Unauthorized."); } if(!isset($_CVM)) { die("Unauthorized."); }
if($sContainer->sCurrentStatus != CVM_STATUS_STOPPED) if($sVps->sCurrentStatus != CVM_STATUS_STOPPED)
{ {
try try
{ {
$sContainer->Stop(); $sVps->Stop();
$sContainer->sCurrentStatus = CVM_STATUS_STOPPED; $sVps->sCurrentStatus = CVM_STATUS_STOPPED;
$sError .= NewTemplater::Render("{$sTheme}/shared/error/success", $locale->strings, array( $sError .= NewTemplater::Render("{$sTheme}/shared/error/success", $locale->strings, array(
'title' => $locale->strings['error-stop-success-title'], 'title' => $locale->strings['error-stop-success-title'],
'message' => $locale->strings['error-stop-success-text'] 'message' => $locale->strings['error-stop-success-text']
)); ));
} }
catch (ContainerSuspendedException $e) catch (VpsSuspendedException $e)
{ {
$sError .= NewTemplater::Render("{$sTheme}/shared/error/error", $locale->strings, array( $sError .= NewTemplater::Render("{$sTheme}/shared/error/error", $locale->strings, array(
'title' => $locale->strings['error-stop-suspended-title'], 'title' => $locale->strings['error-stop-suspended-title'],
'message' => $locale->strings['error-stop-suspended-text'] 'message' => $locale->strings['error-stop-suspended-text']
)); ));
} }
catch (ContainerTerminatedException $e) catch (VpsTerminatedException $e)
{ {
$sError .= NewTemplater::Render("{$sTheme}/shared/error/error", $locale->strings, array( $sError .= NewTemplater::Render("{$sTheme}/shared/error/error", $locale->strings, array(
'title' => $locale->strings['error-stop-terminated-title'], 'title' => $locale->strings['error-stop-terminated-title'],
'message' => $locale->strings['error-stop-terminated-text'] 'message' => $locale->strings['error-stop-terminated-text']
)); ));
} }
catch(ContainerStopException $e) catch(VpsStopException $e)
{ {
$sError .= NewTemplater::Render("{$sTheme}/shared/error/error", $locale->strings, array( $sError .= NewTemplater::Render("{$sTheme}/shared/error/error", $locale->strings, array(
'title' => $locale->strings['error-stop-failed-title'], 'title' => $locale->strings['error-stop-failed-title'],

@ -2,7 +2,7 @@
<a class="sidebutton" href="/admin/">{%!menu-admin-overview}</a> <a class="sidebutton" href="/admin/">{%!menu-admin-overview}</a>
<a class="sidebutton" href="/admin/nodes/">{%!menu-admin-nodes}</a> <a class="sidebutton" href="/admin/nodes/">{%!menu-admin-nodes}</a>
<a class="sidebutton" href="/admin/users/">{%!menu-admin-users}</a> <a class="sidebutton" href="/admin/users/">{%!menu-admin-users}</a>
<a class="sidebutton" href="/admin/containers/">{%!menu-admin-containers}</a> <a class="sidebutton" href="/admin/vpses/">{%!menu-admin-vpses}</a>
</div> </div>
{%?contents} {%?contents}

@ -21,7 +21,7 @@
</tr> </tr>
</table> </table>
<h3>{%!header-admin-node-containers}</h3> <h3>{%!header-admin-node-vpses}</h3>
<table class="vpslist"> <table class="vpslist">
<tr> <tr>
<th></th> <th></th>
@ -31,47 +31,47 @@
<th>{%!list-column-ram}</th> <th>{%!list-column-ram}</th>
<th>{%!list-column-template}</th> <th>{%!list-column-template}</th>
</tr> </tr>
{%if isset|containers == true} {%if isset|vpses == true}
{%foreach container in containers} {%foreach vps in vpses}
<tr class="clickable" data-url="/{%?container[id]}/"> <tr class="clickable" data-url="/{%?vps[id]}/">
<td class="container-status"> <td class="vps-status">
{%if container[status] == running} {%if vps[status] == running}
<img src="/templates/default/static/images/status/online.png" alt="{%!list-status-running}"> <img src="/templates/default/static/images/status/online.png" alt="{%!list-status-running}">
{%elseif container[status] == stopped} {%elseif vps[status] == stopped}
<img src="/templates/default/static/images/status/offline.png" alt="{%!list-status-stopped}"> <img src="/templates/default/static/images/status/offline.png" alt="{%!list-status-stopped}">
{%elseif container[status] == suspended} {%elseif vps[status] == suspended}
<img src="/templates/default/static/images/status/suspended.png" alt="{%!list-status-suspended}"> <img src="/templates/default/static/images/status/suspended.png" alt="{%!list-status-suspended}">
{%else} {%else}
<img src="/templates/default/static/images/status/unknown.png" alt="{%!list-status-unknown}"> <img src="/templates/default/static/images/status/unknown.png" alt="{%!list-status-unknown}">
{%/if} {%/if}
</td> </td>
<td> <td>
<a href="/{%?container[id]}/"> <a href="/{%?vps[id]}/">
{%?container[hostname]} {%?vps[hostname]}
</a> </a>
</td> </td>
<td> <td>
<a href="/{%?container[id]}/"> <a href="/{%?vps[id]}/">
{%if container[virtualization-type] == 1} {%if vps[virtualization-type] == 1}
OpenVZ OpenVZ
{%/if}{%if container[virtualization-type] == 2} {%/if}{%if vps[virtualization-type] == 2}
Xen PV Xen PV
{%/if}{%if container[virtualization-type] == 3} {%/if}{%if vps[virtualization-type] == 3}
Xen HVM Xen HVM
{%/if}{%if container[virtualization-type] == 4} {%/if}{%if vps[virtualization-type] == 4}
KVM KVM
{%/if} {%/if}
</a> </a>
</td> </td>
<td> <td>
{%?container[diskspace]} {%?vps[diskspace]}
<span class="unit">{%?container[diskspace-unit]}</span> <span class="unit">{%?vps[diskspace-unit]}</span>
</td> </td>
<td> <td>
{%?container[guaranteed-ram]} {%?vps[guaranteed-ram]}
<span class="unit">{%?container[guaranteed-ram-unit]}</span> <span class="unit">{%?vps[guaranteed-ram-unit]}</span>
</td> </td>
<td>{%?container[template]}</td> <td>{%?vps[template]}</td>
</tr> </tr>
{%/foreach} {%/foreach}
{%/if} {%/if}

@ -34,12 +34,12 @@
</td> </td>
</tr> </tr>
<tr> <tr>
<th>{%!admin-title-containers}</th> <th>{%!admin-title-vpses}</th>
<td>{%?containercount}</td> <td>{%?vpscount}</td>
</tr> </tr>
</table> </table>
<h3>{%!header-admin-user-containers}</h3> <h3>{%!header-admin-user-vpses}</h3>
<table class="vpslist"> <table class="vpslist">
<tr> <tr>
<th></th> <th></th>
@ -49,45 +49,45 @@
<th>{%!list-column-ram}</th> <th>{%!list-column-ram}</th>
<th>{%!list-column-template}</th> <th>{%!list-column-template}</th>
</tr> </tr>
{%foreach container in containers} {%foreach vps in vpses}
<tr class="clickable" data-url="/{%?container[id]}/"> <tr class="clickable" data-url="/{%?vps[id]}/">
<td class="container-status"> <td class="vps-status">
{%if container[status] == running} {%if vps[status] == running}
<img src="/templates/default/static/images/status/online.png" alt="{%!list-status-running}"> <img src="/templates/default/static/images/status/online.png" alt="{%!list-status-running}">
{%elseif container[status] == stopped} {%elseif vps[status] == stopped}
<img src="/templates/default/static/images/status/offline.png" alt="{%!list-status-stopped}"> <img src="/templates/default/static/images/status/offline.png" alt="{%!list-status-stopped}">
{%elseif container[status] == suspended} {%elseif vps[status] == suspended}
<img src="/templates/default/static/images/status/suspended.png" alt="{%!list-status-suspended}"> <img src="/templates/default/static/images/status/suspended.png" alt="{%!list-status-suspended}">
{%else} {%else}
<img src="/templates/default/static/images/status/unknown.png" alt="{%!list-status-unknown}"> <img src="/templates/default/static/images/status/unknown.png" alt="{%!list-status-unknown}">
{%/if} {%/if}
<td> <td>
<a href="/{%?container[id]}/"> <a href="/{%?vps[id]}/">
{%?container[hostname]} {%?vps[hostname]}
</a> </a>
</td> </td>
<td> <td>
<a href="/{%?container[id]}/"> <a href="/{%?vps[id]}/">
{%if container[virtualization-type] == 1} {%if vps[virtualization-type] == 1}
OpenVZ OpenVZ
{%/if}{%if container[virtualization-type] == 2} {%/if}{%if vps[virtualization-type] == 2}
Xen PV Xen PV
{%/if}{%if container[virtualization-type] == 3} {%/if}{%if vps[virtualization-type] == 3}
Xen HVM Xen HVM
{%/if}{%if container[virtualization-type] == 4} {%/if}{%if vps[virtualization-type] == 4}
KVM KVM
{%/if} {%/if}
</a> </a>
</td> </td>
<td> <td>
{%?container[diskspace]} {%?vps[diskspace]}
<span class="unit">{%?container[diskspace-unit]}</span> <span class="unit">{%?vps[diskspace-unit]}</span>
</td> </td>
<td> <td>
{%?container[guaranteed-ram]} {%?vps[guaranteed-ram]}
<span class="unit">{%?container[guaranteed-ram-unit]}</span> <span class="unit">{%?vps[guaranteed-ram-unit]}</span>
</td> </td>
<td>{%?container[template]}</td> <td>{%?vps[template]}</td>
</tr> </tr>
{%/foreach} {%/foreach}
</table> </table>

@ -1,4 +1,4 @@
<h2>{%!title-admin-addcontainer}</h2> <h2>{%!title-admin-addvps}</h2>
{%if isempty|errors == false} {%if isempty|errors == false}
<div class="errorhandler error-error"> <div class="errorhandler error-error">
@ -13,10 +13,10 @@
</div> </div>
{%/if} {%/if}
<form method="post" action="/admin/containers/add/" class="add dark"> <form method="post" action="/admin/vpses/add/" class="add dark">
<div class="field"> <div class="field">
<label for="form_addcontainer_node">{%!addcontainer-node}</label> <label for="form_addvps_node">{%!addvps-node}</label>
{%select group="addcontainer" name="node"} {%select group="addvps" name="node"}
{%foreach node in nodes} {%foreach node in nodes}
{%option value="(?node[id])" text="(?node[name]) ((?node[location]))"} {%option value="(?node[id])" text="(?node[name]) ((?node[location]))"}
{%/foreach} {%/foreach}
@ -25,8 +25,8 @@
</div> </div>
<div class="field"> <div class="field">
<label for="form_addcontainer_template">{%!addcontainer-template}</label> <label for="form_addvps_template">{%!addvps-template}</label>
{%select group="addcontainer" name="template"} {%select group="addvps" name="template"}
{%foreach template in templates} {%foreach template in templates}
{%option value="(?template[id])" text="(?template[name])"} {%option value="(?template[id])" text="(?template[name])"}
{%/foreach} {%/foreach}
@ -35,8 +35,8 @@
</div> </div>
<div class="field"> <div class="field">
<label for="form_addcontainer_user">{%!addcontainer-user}</label> <label for="form_addvps_user">{%!addvps-user}</label>
{%select group="addcontainer" name="user"} {%select group="addvps" name="user"}
{%foreach user in users} {%foreach user in users}
{%option value="(?user[id])" text="(?user[username]) (#(?user[id]))"} {%option value="(?user[id])" text="(?user[username]) (#(?user[id]))"}
{%/foreach} {%/foreach}
@ -45,44 +45,44 @@
</div> </div>
<div class="field"> <div class="field">
<label for="form_addnode_diskspace">{%!addcontainer-diskspace}</label> <label for="form_addnode_diskspace">{%!addvps-diskspace}</label>
{%input type="text" group="addcontainer" name="diskspace"} {%input type="text" group="addvps" name="diskspace"}
<div class="clear"></div> <div class="clear"></div>
</div> </div>
<div class="field"> <div class="field">
<label for="form_addnode_guaranteed">{%!addcontainer-guaranteed}</label> <label for="form_addnode_guaranteed">{%!addvps-guaranteed}</label>
{%input type="text" group="addcontainer" name="guaranteed"} {%input type="text" group="addvps" name="guaranteed"}
<div class="clear"></div> <div class="clear"></div>
</div> </div>
<div class="field"> <div class="field">
<label for="form_addnode_burstable">{%!addcontainer-burstable}</label> <label for="form_addnode_burstable">{%!addvps-burstable}</label>
{%input type="text" group="addcontainer" name="burstable"} {%input type="text" group="addvps" name="burstable"}
<div class="clear"></div> <div class="clear"></div>
</div> </div>
<div class="field"> <div class="field">
<label for="form_addnode_cpucount">{%!addcontainer-cpucount}</label> <label for="form_addnode_cpucount">{%!addvps-cpucount}</label>
{%input type="text" group="addcontainer" name="cpucount"} {%input type="text" group="addvps" name="cpucount"}
<div class="clear"></div> <div class="clear"></div>
</div> </div>
<div class="field"> <div class="field">
<label for="form_addnode_traffic">{%!addcontainer-traffic}</label> <label for="form_addnode_traffic">{%!addvps-traffic}</label>
{%input type="text" group="addcontainer" name="traffic"} {%input type="text" group="addvps" name="traffic"}
<div class="clear"></div> <div class="clear"></div>
</div> </div>
<div class="field"> <div class="field">
<label for="form_addnode_hostname">{%!addcontainer-hostname}</label> <label for="form_addnode_hostname">{%!addvps-hostname}</label>
{%input type="text" group="addcontainer" name="hostname"} {%input type="text" group="addvps" name="hostname"}
<div class="clear"></div> <div class="clear"></div>
</div> </div>
<div class="field"> <div class="field">
<div class="filler"></div> <div class="filler"></div>
<button type="submit" name="submit">{%!button-admin-addcontainer}</button> <button type="submit" name="submit">{%!button-admin-addvps}</button>
<div class="clear"></div> <div class="clear"></div>
</div> </div>
</form> </form>

@ -11,7 +11,7 @@
</tr> </tr>
{%foreach vps in vpses} {%foreach vps in vpses}
<tr class="clickable" data-url="/{%?vps[id]}/"> <tr class="clickable" data-url="/{%?vps[id]}/">
<td class="container-status"> <td class="vps-status">
{%if vps[status] == running} {%if vps[status] == running}
<img src="/templates/default/static/images/status/online.png" alt="{%!list-status-running}"> <img src="/templates/default/static/images/status/online.png" alt="{%!list-status-running}">
{%elseif vps[status] == stopped} {%elseif vps[status] == stopped}

@ -1,4 +1,4 @@
<form method="post" action="/admin/container/{%?id}/suspend/"> <form method="post" action="/admin/vps/{%?id}/suspend/">
{%if suspended == false} {%if suspended == false}
<h2>{%!title-admin-vps-suspend}</h2> <h2>{%!title-admin-vps-suspend}</h2>
<p>{%!vps-admin-suspend-text}</p> <p>{%!vps-admin-suspend-text}</p>

@ -8,52 +8,52 @@
<th>{%!list-column-ram}</th> <th>{%!list-column-ram}</th>
<th>{%!list-column-template}</th> <th>{%!list-column-template}</th>
</tr> </tr>
{%foreach container in containers} {%foreach vps in vpses}
<tr class="clickable" data-url="/{%?container[id]}/"> <tr class="clickable" data-url="/{%?vps[id]}/">
<td class="container-status"> <td class="vps-status">
{%if container[status] == running} {%if vps[status] == running}
<img src="/templates/default/static/images/status/online.png" alt="{%!list-status-running}"> <img src="/templates/default/static/images/status/online.png" alt="{%!list-status-running}">
{%elseif container[status] == stopped} {%elseif vps[status] == stopped}
<img src="/templates/default/static/images/status/offline.png" alt="{%!list-status-stopped}"> <img src="/templates/default/static/images/status/offline.png" alt="{%!list-status-stopped}">
{%elseif container[status] == suspended} {%elseif vps[status] == suspended}
<img src="/templates/default/static/images/status/suspended.png" alt="{%!list-status-suspended}"> <img src="/templates/default/static/images/status/suspended.png" alt="{%!list-status-suspended}">
{%else} {%else}
<img src="/templates/default/static/images/status/unknown.png" alt="{%!list-status-unknown}"> <img src="/templates/default/static/images/status/unknown.png" alt="{%!list-status-unknown}">
{%/if} {%/if}
</td> </td>
<td> <td>
<a href="/{%?container[id]}/"> <a href="/{%?vps[id]}/">
{%?container[hostname]} {%?vps[hostname]}
</a> </a>
</td> </td>
<td> <td>
<a href="/{%?container[id]}/"> <a href="/{%?vps[id]}/">
{%if container[virtualization-type] == 1} {%if vps[virtualization-type] == 1}
OpenVZ OpenVZ
{%/if}{%if container[virtualization-type] == 2} {%/if}{%if vps[virtualization-type] == 2}
Xen PV Xen PV
{%/if}{%if container[virtualization-type] == 3} {%/if}{%if vps[virtualization-type] == 3}
Xen HVM Xen HVM
{%/if}{%if container[virtualization-type] == 4} {%/if}{%if vps[virtualization-type] == 4}
KVM KVM
{%/if} {%/if}
</a> </a>
</td> </td>
<td> <td>
<a href="/{%?container[id]}/"> <a href="/{%?vps[id]}/">
<span class="nodename">{%?container[node]}</span> <span class="nodename">{%?vps[node]}</span>
<span class="hostname">({%?container[node-hostname]})</span> <span class="hostname">({%?vps[node-hostname]})</span>
</a> </a>
</td> </td>
<td> <td>
{%?container[diskspace]} {%?vps[diskspace]}
<span class="unit">{%?container[diskspace-unit]}</span> <span class="unit">{%?vps[diskspace-unit]}</span>
</td> </td>
<td> <td>
{%?container[guaranteed-ram]} {%?vps[guaranteed-ram]}
<span class="unit">{%?container[guaranteed-ram-unit]}</span> <span class="unit">{%?vps[guaranteed-ram-unit]}</span>
</td> </td>
<td>{%?container[template]}</td> <td>{%?vps[template]}</td>
</tr> </tr>
{%/foreach} {%/foreach}
</table> </table>

@ -99,9 +99,9 @@
{%if accesslevel = 20} {%if accesslevel = 20}
<h3>{%!header-vps-admin}</h3> <h3>{%!header-vps-admin}</h3>
<div class="vps-admin"> <div class="vps-admin">
<a href="/admin/container/{%?id}/suspend/">{%!vps-admin-suspend}</a> <a href="/admin/vps/{%?id}/suspend/">{%!vps-admin-suspend}</a>
<a href="/admin/container/{%?id}/transfer/">{%!vps-admin-transfer}</a> <a href="/admin/vps/{%?id}/transfer/">{%!vps-admin-transfer}</a>
<a href="/admin/container/{%?id}/terminate/">{%!vps-admin-terminate}</a> <a href="/admin/vps/{%?id}/terminate/">{%!vps-admin-terminate}</a>
</div> </div>
<div class="clear"></div> <div class="clear"></div>
{%/if} {%/if}

@ -58,7 +58,7 @@ table.vertical th
padding: 3px 7px; padding: 3px 7px;
} }
td.container-status img td.vps-status img
{ {
margin-top: 3px; margin-top: 3px;
} }

Loading…
Cancel
Save