mirror of
https://github.com/serghey-rodin/vesta.git
synced 2025-03-12 04:36:25 -07:00
suspend user
This commit is contained in:
parent
f91f23a727
commit
baab49bcc2
web
suspend/user
templates/admin
unsuspend/user
49
web/suspend/user/index.php
Normal file
49
web/suspend/user/index.php
Normal file
@ -0,0 +1,49 @@
|
||||
<?php
|
||||
// Init
|
||||
//error_reporting(NULL);
|
||||
ob_start();
|
||||
session_start();
|
||||
$TAB = 'USER';
|
||||
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/user/");
|
||||
}
|
||||
|
||||
// Ok
|
||||
if (!empty($_GET['user'])) {
|
||||
$v_username = escapeshellarg($_GET['user']);
|
||||
exec (VESTA_CMD."v_suspend_user ".$v_username, $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: user <b>".$_GET[user]."</b> has been suspended.";
|
||||
unset($v_lname);
|
||||
}
|
||||
unset($output);
|
||||
|
||||
include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/menu_suspend_user.html');
|
||||
include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/suspend_user.html');
|
||||
unset($_SESSION['error_msg']);
|
||||
unset($_SESSION['ok_msg']);
|
||||
|
||||
} else {
|
||||
header("Location: /list/user/");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Footer
|
||||
include($_SERVER['DOCUMENT_ROOT'].'/templates/footer.html');
|
15
web/templates/admin/menu_suspend_user.html
Normal file
15
web/templates/admin/menu_suspend_user.html
Normal file
@ -0,0 +1,15 @@
|
||||
<table class="sub-menu">
|
||||
<tr>
|
||||
<td style="padding: 10px 2px 28px 0;" ><a class="add-name"><i>Suspending User </i></a>
|
||||
<?php
|
||||
if (!empty($_SESSION['error_msg'])) {
|
||||
echo "<a class=\"add-error\"><i> → ".$_SESSION['error_msg']."</i></a>";
|
||||
} else {
|
||||
if (!empty($_SESSION['ok_msg'])) {
|
||||
echo "<a class=\"add-ok\"><i> → ".$_SESSION['ok_msg']."</i></a>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
15
web/templates/admin/menu_unsuspend_user.html
Normal file
15
web/templates/admin/menu_unsuspend_user.html
Normal file
@ -0,0 +1,15 @@
|
||||
<table class="sub-menu">
|
||||
<tr>
|
||||
<td style="padding: 10px 2px 28px 0;" ><a class="add-name"><i>Unsuspending User </i></a>
|
||||
<?php
|
||||
if (!empty($_SESSION['error_msg'])) {
|
||||
echo "<a class=\"add-error\"><i> → ".$_SESSION['error_msg']."</i></a>";
|
||||
} else {
|
||||
if (!empty($_SESSION['ok_msg'])) {
|
||||
echo "<a class=\"add-ok\"><i> → ".$_SESSION['ok_msg']."</i></a>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
21
web/templates/admin/suspend_user.html
Normal file
21
web/templates/admin/suspend_user.html
Normal file
@ -0,0 +1,21 @@
|
||||
<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>
|
||||
<form method="post" name="v_suspend_user">
|
||||
<table class="data-col2" width="830px">
|
||||
<tr><td style="padding: 24px 0 0 0;">
|
||||
<input type="submit" class="add-button" name="back" value="Back to users">
|
||||
</td></tr>
|
||||
</form>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
21
web/templates/admin/unsuspend_user.html
Normal file
21
web/templates/admin/unsuspend_user.html
Normal file
@ -0,0 +1,21 @@
|
||||
<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>
|
||||
<form method="post" name="v_suspend_user">
|
||||
<table class="data-col2" width="830px">
|
||||
<tr><td style="padding: 24px 0 0 0;">
|
||||
<input type="submit" class="add-button" name="back" value="Back to users">
|
||||
</td></tr>
|
||||
</form>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
49
web/unsuspend/user/index.php
Normal file
49
web/unsuspend/user/index.php
Normal file
@ -0,0 +1,49 @@
|
||||
<?php
|
||||
// Init
|
||||
//error_reporting(NULL);
|
||||
ob_start();
|
||||
session_start();
|
||||
$TAB = 'USER';
|
||||
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/user/");
|
||||
}
|
||||
|
||||
// Ok
|
||||
if (!empty($_GET['user'])) {
|
||||
$v_username = escapeshellarg($_GET['user']);
|
||||
exec (VESTA_CMD."v_unsuspend_user ".$v_username, $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: user <b>".$_GET[user]."</b> has been unsuspended.";
|
||||
unset($v_lname);
|
||||
}
|
||||
unset($output);
|
||||
|
||||
include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/menu_suspend_user.html');
|
||||
include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/suspend_user.html');
|
||||
unset($_SESSION['error_msg']);
|
||||
unset($_SESSION['ok_msg']);
|
||||
|
||||
} else {
|
||||
header("Location: /list/user/");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Footer
|
||||
include($_SERVER['DOCUMENT_ROOT'].'/templates/footer.html');
|
Loading…
x
Reference in New Issue
Block a user