mirror of
https://github.com/serghey-rodin/vesta.git
synced 2025-08-19 13:01:51 -07:00
web suspend/unsuspend
This commit is contained in:
parent
ef1a5d748d
commit
320e50fb7b
10 changed files with 154 additions and 13 deletions
|
@ -3,7 +3,7 @@
|
||||||
//error_reporting(NULL);
|
//error_reporting(NULL);
|
||||||
ob_start();
|
ob_start();
|
||||||
session_start();
|
session_start();
|
||||||
$TAB = 'USER';
|
$TAB = 'WEB';
|
||||||
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
|
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
|
||||||
|
|
||||||
// Header
|
// Header
|
||||||
|
@ -21,26 +21,27 @@ if ($_SESSION['user'] == 'admin') {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ok
|
// Ok
|
||||||
if (!empty($_GET['user'])) {
|
if (!empty($_GET['domain'])) {
|
||||||
$v_username = escapeshellarg($_GET['user']);
|
$v_username = escapeshellarg($user);
|
||||||
exec (VESTA_CMD."v_suspend_web_domain ".$v_username, $output, $return_var);
|
$v_domain = escapeshellarg($_GET['domain']);
|
||||||
|
exec (VESTA_CMD."v_suspend_web_domain ".$v_username." ".$v_domain, $output, $return_var);
|
||||||
if ($return_var != 0) {
|
if ($return_var != 0) {
|
||||||
$error = implode('<br>', $output);
|
$error = implode('<br>', $output);
|
||||||
if (empty($error)) $error = 'Error: vesta did not return any output.';
|
if (empty($error)) $error = 'Error: vesta did not return any output.';
|
||||||
$_SESSION['error_msg'] = $error;
|
$_SESSION['error_msg'] = $error;
|
||||||
} else {
|
} else {
|
||||||
$_SESSION['ok_msg'] = "OK: user <b>".$_GET[user]."</b> has been suspended.";
|
$_SESSION['ok_msg'] = "OK: web domain <b>".$_GET['domain']."</b> has been suspended.";
|
||||||
unset($v_lname);
|
unset($v_lname);
|
||||||
}
|
}
|
||||||
unset($output);
|
unset($output);
|
||||||
|
|
||||||
include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/menu_suspend_user.html');
|
include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/menu_suspend_web.html');
|
||||||
include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/suspend_user.html');
|
include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/suspend_web.html');
|
||||||
unset($_SESSION['error_msg']);
|
unset($_SESSION['error_msg']);
|
||||||
unset($_SESSION['ok_msg']);
|
unset($_SESSION['ok_msg']);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
header("Location: /list/user/");
|
header("Location: /list/web/");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
<tr>
|
<tr>
|
||||||
<td style="padding: 24px 0 0 0;">
|
<td style="padding: 24px 0 0 0;">
|
||||||
<form method="post">
|
<form method="post">
|
||||||
<input type="submit" class="add-button" name="back" value="Back to users">
|
<input type="button" class="add-button" value="Back to users" onClick="location.href='/list/user/'">
|
||||||
</form>
|
</form>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
|
@ -5,7 +5,7 @@ foreach ($data as $key => $value) {
|
||||||
++$i;
|
++$i;
|
||||||
if ($data[$key]['SUSPENDED'] == 'yes') {
|
if ($data[$key]['SUSPENDED'] == 'yes') {
|
||||||
$status = 'suspended';
|
$status = 'suspended';
|
||||||
$spnd_action = 'ususpend' ;
|
$spnd_action = 'unsuspend' ;
|
||||||
} else {
|
} else {
|
||||||
$status = 'active';
|
$status = 'active';
|
||||||
$spnd_action = 'suspend' ;
|
$spnd_action = 'suspend' ;
|
||||||
|
|
15
web/templates/admin/menu_suspend_web.html
Normal file
15
web/templates/admin/menu_suspend_web.html
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
<table class="sub-menu">
|
||||||
|
<tr>
|
||||||
|
<td style="padding: 50px 2px 38px 153px;" >
|
||||||
|
<?php
|
||||||
|
if (!empty($_SESSION['error_msg'])) {
|
||||||
|
echo "<a class=\"add-error\">".$_SESSION['error_msg']."</a>";
|
||||||
|
} else {
|
||||||
|
if (!empty($_SESSION['ok_msg'])) {
|
||||||
|
echo "<a class=\"add-ok\"> ".$_SESSION['ok_msg']."</a>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
15
web/templates/admin/menu_unsuspend_web.html
Normal file
15
web/templates/admin/menu_unsuspend_web.html
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
<table class="sub-menu">
|
||||||
|
<tr>
|
||||||
|
<td style="padding: 50px 2px 38px 153px;" >
|
||||||
|
<?php
|
||||||
|
if (!empty($_SESSION['error_msg'])) {
|
||||||
|
echo "<a class=\"add-error\">".$_SESSION['error_msg']."</a>";
|
||||||
|
} else {
|
||||||
|
if (!empty($_SESSION['ok_msg'])) {
|
||||||
|
echo "<a class=\"add-ok\"> ".$_SESSION['ok_msg']."</a>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
|
@ -13,8 +13,8 @@
|
||||||
<table class="data-col2" width="830px">
|
<table class="data-col2" width="830px">
|
||||||
<tr>
|
<tr>
|
||||||
<td style="padding: 24px 0 0 0;" width="100px">
|
<td style="padding: 24px 0 0 0;" width="100px">
|
||||||
<form method="post">
|
<form method="get">
|
||||||
<input type="submit" class="add-button" name="back" value="Back to users">
|
<input type="button" class="add-button" value="Back to users" onClick="location.href='/list/user/'">
|
||||||
</form>
|
</form>
|
||||||
</td>
|
</td>
|
||||||
<td style="padding: 24px 0 0 0;">
|
<td style="padding: 24px 0 0 0;">
|
||||||
|
|
30
web/templates/admin/suspend_web.html
Normal file
30
web/templates/admin/suspend_web.html
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
<table class='data'>
|
||||||
|
<tr class="data-add">
|
||||||
|
<td class="data-dotted" style="padding: 0px 10px 0px 0px" width="150">
|
||||||
|
<table class="data-col1">
|
||||||
|
<tr><td style="padding: 18 0 4 18;"></td></tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
<td class="data-dotted" width="830px" style="vertical-align:top;">
|
||||||
|
<table width="830px"><tr>
|
||||||
|
<td></td>
|
||||||
|
</tr></table>
|
||||||
|
|
||||||
|
<table class="data-col2" width="830px">
|
||||||
|
<tr>
|
||||||
|
<td style="padding: 24px 0 0 0;" width="100px">
|
||||||
|
<form method="get">
|
||||||
|
<input type="button" class="add-button" value="Back to domains" onClick="location.href='/list/web/'">
|
||||||
|
</form>
|
||||||
|
</td>
|
||||||
|
<td style="padding: 24px 0 0 0;">
|
||||||
|
<form action="/unsuspend/web/" method="get">
|
||||||
|
<input type="hidden" name="domain" value="<?php echo $_GET['domain']?>">
|
||||||
|
<input type="submit" class="add-button" name="unsuspend" value="Unsuspend <?php echo $_GET['domain']?>">
|
||||||
|
</form>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
|
@ -14,7 +14,7 @@
|
||||||
<tr>
|
<tr>
|
||||||
<td style="padding: 24px 0 0 0;" width="100px">
|
<td style="padding: 24px 0 0 0;" width="100px">
|
||||||
<form method="post">
|
<form method="post">
|
||||||
<input type="submit" class="add-button" name="back" value="Back to users">
|
<input type="button" class="add-button" value="Back to users" onClick="location.href='/list/user/'">
|
||||||
</form>
|
</form>
|
||||||
</td>
|
</td>
|
||||||
<td style="padding: 24px 0 0 0;">
|
<td style="padding: 24px 0 0 0;">
|
||||||
|
|
30
web/templates/admin/unsuspend_web.html
Normal file
30
web/templates/admin/unsuspend_web.html
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
<table class='data'>
|
||||||
|
<tr class="data-add">
|
||||||
|
<td class="data-dotted" style="padding: 0px 10px 0px 0px" width="150">
|
||||||
|
<table class="data-col1">
|
||||||
|
<tr><td style="padding: 18 0 4 18;"></td></tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
<td class="data-dotted" width="830px" style="vertical-align:top;">
|
||||||
|
<table width="830px"><tr>
|
||||||
|
<td></td>
|
||||||
|
</tr></table>
|
||||||
|
|
||||||
|
<table class="data-col2" width="830px">
|
||||||
|
<tr>
|
||||||
|
<td style="padding: 24px 0 0 0;" width="100px">
|
||||||
|
<form method="get">
|
||||||
|
<input type="button" class="add-button" value="Back to domains" onClick="location.href='/list/web/'">
|
||||||
|
</form>
|
||||||
|
</td>
|
||||||
|
<td style="padding: 24px 0 0 0;">
|
||||||
|
<form action="/suspend/web/" method="get">
|
||||||
|
<input type="hidden" name="domain" value="<?php echo $_GET['domain']?>">
|
||||||
|
<input type="submit" class="add-button" name="unsuspend" value="Suspend <?php echo $_GET['domain']?>">
|
||||||
|
</form>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
50
web/unsuspend/web/index.php
Normal file
50
web/unsuspend/web/index.php
Normal file
|
@ -0,0 +1,50 @@
|
||||||
|
<?php
|
||||||
|
// Init
|
||||||
|
//error_reporting(NULL);
|
||||||
|
ob_start();
|
||||||
|
session_start();
|
||||||
|
$TAB = 'WEB';
|
||||||
|
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
|
||||||
|
|
||||||
|
// Header
|
||||||
|
include($_SERVER['DOCUMENT_ROOT'].'/templates/header.html');
|
||||||
|
|
||||||
|
// Panel
|
||||||
|
top_panel($user,$TAB);
|
||||||
|
|
||||||
|
// Are you admin?
|
||||||
|
if ($_SESSION['user'] == 'admin') {
|
||||||
|
|
||||||
|
// Cancel
|
||||||
|
if (!empty($_POST['back'])) {
|
||||||
|
header("Location: /list/web/");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ok
|
||||||
|
if (!empty($_GET['domain'])) {
|
||||||
|
$v_username = escapeshellarg($user);
|
||||||
|
$v_domain = escapeshellarg($_GET['domain']);
|
||||||
|
exec (VESTA_CMD."v_unsuspend_web_domain ".$v_username." ".$v_domain, $output, $return_var);
|
||||||
|
if ($return_var != 0) {
|
||||||
|
$error = implode('<br>', $output);
|
||||||
|
if (empty($error)) $error = 'Error: vesta did not return any output.';
|
||||||
|
$_SESSION['error_msg'] = $error;
|
||||||
|
} else {
|
||||||
|
$_SESSION['ok_msg'] = "OK: web domain <b>".$_GET['domain']."</b> has been unsuspended.";
|
||||||
|
unset($v_lname);
|
||||||
|
}
|
||||||
|
unset($output);
|
||||||
|
|
||||||
|
include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/menu_unsuspend_web.html');
|
||||||
|
include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/unsuspend_web.html');
|
||||||
|
unset($_SESSION['error_msg']);
|
||||||
|
unset($_SESSION['ok_msg']);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
header("Location: /list/web/");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Footer
|
||||||
|
include($_SERVER['DOCUMENT_ROOT'].'/templates/footer.html');
|
Loading…
Add table
Add a link
Reference in a new issue