Skip to content

Commit baab49b

Browse files
committed
suspend user
1 parent f91f23a commit baab49b

File tree

6 files changed

+170
-0
lines changed

6 files changed

+170
-0
lines changed

web/suspend/user/index.php

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<?php
2+
// Init
3+
//error_reporting(NULL);
4+
ob_start();
5+
session_start();
6+
$TAB = 'USER';
7+
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
8+
9+
// Header
10+
include($_SERVER['DOCUMENT_ROOT'].'/templates/header.html');
11+
12+
// Panel
13+
top_panel($user,$TAB);
14+
15+
// Are you admin?
16+
if ($_SESSION['user'] == 'admin') {
17+
18+
// Cancel
19+
if (!empty($_POST['back'])) {
20+
header("Location: /list/user/");
21+
}
22+
23+
// Ok
24+
if (!empty($_GET['user'])) {
25+
$v_username = escapeshellarg($_GET['user']);
26+
exec (VESTA_CMD."v_suspend_user ".$v_username, $output, $return_var);
27+
if ($return_var != 0) {
28+
$error = implode('<br>', $output);
29+
if (empty($error)) $error = 'Error: vesta did not return any output.';
30+
$_SESSION['error_msg'] = $error;
31+
} else {
32+
$_SESSION['ok_msg'] = "OK: user <b>".$_GET[user]."</b> has been suspended.";
33+
unset($v_lname);
34+
}
35+
unset($output);
36+
37+
include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/menu_suspend_user.html');
38+
include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/suspend_user.html');
39+
unset($_SESSION['error_msg']);
40+
unset($_SESSION['ok_msg']);
41+
42+
} else {
43+
header("Location: /list/user/");
44+
}
45+
46+
}
47+
48+
// Footer
49+
include($_SERVER['DOCUMENT_ROOT'].'/templates/footer.html');
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<table class="sub-menu">
2+
<tr>
3+
<td style="padding: 10px 2px 28px 0;" ><a class="add-name"><i>Suspending User </i></a>
4+
<?php
5+
if (!empty($_SESSION['error_msg'])) {
6+
echo "<a class=\"add-error\"><i> → ".$_SESSION['error_msg']."</i></a>";
7+
} else {
8+
if (!empty($_SESSION['ok_msg'])) {
9+
echo "<a class=\"add-ok\"><i> → ".$_SESSION['ok_msg']."</i></a>";
10+
}
11+
}
12+
?>
13+
</td>
14+
</tr>
15+
</table>
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<table class="sub-menu">
2+
<tr>
3+
<td style="padding: 10px 2px 28px 0;" ><a class="add-name"><i>Unsuspending User </i></a>
4+
<?php
5+
if (!empty($_SESSION['error_msg'])) {
6+
echo "<a class=\"add-error\"><i> → ".$_SESSION['error_msg']."</i></a>";
7+
} else {
8+
if (!empty($_SESSION['ok_msg'])) {
9+
echo "<a class=\"add-ok\"><i> → ".$_SESSION['ok_msg']."</i></a>";
10+
}
11+
}
12+
?>
13+
</td>
14+
</tr>
15+
</table>
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<table class='data'>
2+
<tr class="data-add">
3+
<td class="data-dotted" style="padding: 0px 10px 0px 0px" width="150">
4+
<table class="data-col1">
5+
<tr><td style="padding: 18 0 4 18;"></td></tr>
6+
</table>
7+
</td>
8+
<td class="data-dotted" width="830px" style="vertical-align:top;">
9+
<table width="830px"><tr>
10+
<td></td>
11+
</tr></table>
12+
<form method="post" name="v_suspend_user">
13+
<table class="data-col2" width="830px">
14+
<tr><td style="padding: 24px 0 0 0;">
15+
<input type="submit" class="add-button" name="back" value="Back to users">
16+
</td></tr>
17+
</form>
18+
</table>
19+
</td>
20+
</tr>
21+
</table>
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<table class='data'>
2+
<tr class="data-add">
3+
<td class="data-dotted" style="padding: 0px 10px 0px 0px" width="150">
4+
<table class="data-col1">
5+
<tr><td style="padding: 18 0 4 18;"></td></tr>
6+
</table>
7+
</td>
8+
<td class="data-dotted" width="830px" style="vertical-align:top;">
9+
<table width="830px"><tr>
10+
<td></td>
11+
</tr></table>
12+
<form method="post" name="v_suspend_user">
13+
<table class="data-col2" width="830px">
14+
<tr><td style="padding: 24px 0 0 0;">
15+
<input type="submit" class="add-button" name="back" value="Back to users">
16+
</td></tr>
17+
</form>
18+
</table>
19+
</td>
20+
</tr>
21+
</table>

web/unsuspend/user/index.php

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<?php
2+
// Init
3+
//error_reporting(NULL);
4+
ob_start();
5+
session_start();
6+
$TAB = 'USER';
7+
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
8+
9+
// Header
10+
include($_SERVER['DOCUMENT_ROOT'].'/templates/header.html');
11+
12+
// Panel
13+
top_panel($user,$TAB);
14+
15+
// Are you admin?
16+
if ($_SESSION['user'] == 'admin') {
17+
18+
// Cancel
19+
if (!empty($_POST['back'])) {
20+
header("Location: /list/user/");
21+
}
22+
23+
// Ok
24+
if (!empty($_GET['user'])) {
25+
$v_username = escapeshellarg($_GET['user']);
26+
exec (VESTA_CMD."v_unsuspend_user ".$v_username, $output, $return_var);
27+
if ($return_var != 0) {
28+
$error = implode('<br>', $output);
29+
if (empty($error)) $error = 'Error: vesta did not return any output.';
30+
$_SESSION['error_msg'] = $error;
31+
} else {
32+
$_SESSION['ok_msg'] = "OK: user <b>".$_GET[user]."</b> has been unsuspended.";
33+
unset($v_lname);
34+
}
35+
unset($output);
36+
37+
include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/menu_suspend_user.html');
38+
include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/suspend_user.html');
39+
unset($_SESSION['error_msg']);
40+
unset($_SESSION['ok_msg']);
41+
42+
} else {
43+
header("Location: /list/user/");
44+
}
45+
46+
}
47+
48+
// Footer
49+
include($_SERVER['DOCUMENT_ROOT'].'/templates/footer.html');

0 commit comments

Comments
 (0)