Add suspend/unsuspend page

feature/node-rewrite
Sven Slootweg 13 years ago
parent 12cb092b75
commit 7676814eb9

@ -0,0 +1,66 @@
<?php
/*
* CVM is more free software. It is licensed under the WTFPL, which
* allows you to do pretty much anything with it, without having to
* ask permission. Commercial use is allowed, and no attribution is
* required. We do politely request that you share your modifications
* to benefit other developers, but you are under no enforced
* obligation to do so :)
*
* Please read the accompanying LICENSE document for the full WTFPL
* licensing text.
*/
if(!isset($_CVM)) { die("Unauthorized."); }
try
{
$sUser->RequireAccessLevel(20);
$sContainer = new Container($router->uParameters[1]);
$sSuspended = ($sContainer->sStatus == CVM_STATUS_SUSPENDED) ? true : false;
if(isset($_POST['submit']))
{
if($_POST['action'] == "suspend")
{
$sContainer->Suspend();
$err = new CPHPErrorHandler(CPHP_ERRORHANDLER_TYPE_SUCCES, "Container suspended", "The container has been suspended and can no longer be used by the owner.");
$sMainContents .= $err->Render();
}
elseif($_POST['action'] == "unsuspend")
{
$sContainer->Unsuspend();
$err = new CPHPErrorHandler(CPHP_ERRORHANDLER_TYPE_SUCCES, "Container unsuspended", "The container has been unsuspended and can now be used by the owner again.");
$sMainContents .= $err->Render();
}
}
$sPageContents = Templater::InlineRender("admin.container.suspend", $locale->strings, array(
'id' => $sContainer->sId,
'suspended' => $sSuspended
));
}
catch (InsufficientAccessLevelException $e)
{
$err = new CPHPErrorHandler(CPHP_ERRORHANDLER_TYPE_ERROR, "You are not authorized to view this page", "Your access level is not sufficient.");
$sMainContents .= $err->Render();
}
catch (NotFoundException $e)
{
$err = new CPHPErrorHandler(CPHP_ERRORHANDLER_TYPE_ERROR, "Container not found", "The container you selected was not found.");
$sMainContents .= $err->Render();
}
catch (ContainerSuspendException $e)
{
$err = new CPHPErrorHandler(CPHP_ERRORHANDLER_TYPE_ERROR, "Failed to suspend container", "The container could not be suspended.");
$sMainContents .= $err->Render();
}
catch (ContainerUnsuspendException $e)
{
$err = new CPHPErrorHandler(CPHP_ERRORHANDLER_TYPE_ERROR, "Failed to unsuspend container", "The container could not be unsuspended.");
$sMainContents .= $err->Render();
}

@ -0,0 +1,16 @@
<?php
/*
* CVM is more free software. It is licensed under the WTFPL, which
* allows you to do pretty much anything with it, without having to
* ask permission. Commercial use is allowed, and no attribution is
* required. We do politely request that you share your modifications
* to benefit other developers, but you are under no enforced
* obligation to do so :)
*
* Please read the accompanying LICENSE document for the full WTFPL
* licensing text.
*/
if(!isset($_CVM)) { die("Unauthorized."); }
$sPageContents = Templater::InlineRender("admin.overview", $locale->strings, array());

@ -0,0 +1,14 @@
<form method="post" action="/admin/container/<%?id>/suspend/">
<%if suspended == false>
<h2><%!title-admin-vps-suspend></h2>
<p><%!vps-admin-suspend-text></p>
<input type="hidden" name="action" value="suspend">
<button type="submit" name="submit" class="padded"><%!button-admin-vps-suspend></button>
<%/if><%if suspended == true>
<h2><%!title-admin-vps-unsuspend></h2>
<p><%!vps-admin-unsuspend-text></p>
<input type="hidden" name="action" value="unsuspend">
<button type="submit" name="submit" class="padded"><%!button-admin-vps-unsuspend></button>
<%/if>
</form>

@ -0,0 +1,3 @@
<h2><%!title-admin-overview></h2>
<p><%!admin-overview-message></p>
Loading…
Cancel
Save