Skip to content

Commit 320e50f

Browse files
committed
web suspend/unsuspend
1 parent ef1a5d7 commit 320e50f

File tree

10 files changed

+154
-13
lines changed

10 files changed

+154
-13
lines changed

web/suspend/web/index.php

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
//error_reporting(NULL);
44
ob_start();
55
session_start();
6-
$TAB = 'USER';
6+
$TAB = 'WEB';
77
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
88

99
// Header
@@ -21,26 +21,27 @@
2121
}
2222

2323
// Ok
24-
if (!empty($_GET['user'])) {
25-
$v_username = escapeshellarg($_GET['user']);
26-
exec (VESTA_CMD."v_suspend_web_domain ".$v_username, $output, $return_var);
24+
if (!empty($_GET['domain'])) {
25+
$v_username = escapeshellarg($user);
26+
$v_domain = escapeshellarg($_GET['domain']);
27+
exec (VESTA_CMD."v_suspend_web_domain ".$v_username." ".$v_domain, $output, $return_var);
2728
if ($return_var != 0) {
2829
$error = implode('<br>', $output);
2930
if (empty($error)) $error = 'Error: vesta did not return any output.';
3031
$_SESSION['error_msg'] = $error;
3132
} else {
32-
$_SESSION['ok_msg'] = "OK: user <b>".$_GET[user]."</b> has been suspended.";
33+
$_SESSION['ok_msg'] = "OK: web domain <b>".$_GET['domain']."</b> has been suspended.";
3334
unset($v_lname);
3435
}
3536
unset($output);
3637

37-
include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/menu_suspend_user.html');
38-
include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/suspend_user.html');
38+
include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/menu_suspend_web.html');
39+
include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/suspend_web.html');
3940
unset($_SESSION['error_msg']);
4041
unset($_SESSION['ok_msg']);
4142

4243
} else {
43-
header("Location: /list/user/");
44+
header("Location: /list/web/");
4445
}
4546

4647
}

web/templates/admin/delete_user.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<tr>
1515
<td style="padding: 24px 0 0 0;">
1616
<form method="post">
17-
<input type="submit" class="add-button" name="back" value="Back to users">
17+
<input type="button" class="add-button" value="Back to users" onClick="location.href='/list/user/'">
1818
</form>
1919
</td>
2020
</tr>

web/templates/admin/list_web.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
++$i;
66
if ($data[$key]['SUSPENDED'] == 'yes') {
77
$status = 'suspended';
8-
$spnd_action = 'ususpend' ;
8+
$spnd_action = 'unsuspend' ;
99
} else {
1010
$status = 'active';
1111
$spnd_action = 'suspend' ;
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: 50px 2px 38px 153px;" >
4+
<?php
5+
if (!empty($_SESSION['error_msg'])) {
6+
echo "<a class=\"add-error\">".$_SESSION['error_msg']."</a>";
7+
} else {
8+
if (!empty($_SESSION['ok_msg'])) {
9+
echo "<a class=\"add-ok\"> ".$_SESSION['ok_msg']."</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: 50px 2px 38px 153px;" >
4+
<?php
5+
if (!empty($_SESSION['error_msg'])) {
6+
echo "<a class=\"add-error\">".$_SESSION['error_msg']."</a>";
7+
} else {
8+
if (!empty($_SESSION['ok_msg'])) {
9+
echo "<a class=\"add-ok\"> ".$_SESSION['ok_msg']."</a>";
10+
}
11+
}
12+
?>
13+
</td>
14+
</tr>
15+
</table>

web/templates/admin/suspend_user.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
<table class="data-col2" width="830px">
1414
<tr>
1515
<td style="padding: 24px 0 0 0;" width="100px">
16-
<form method="post">
17-
<input type="submit" class="add-button" name="back" value="Back to users">
16+
<form method="get">
17+
<input type="button" class="add-button" value="Back to users" onClick="location.href='/list/user/'">
1818
</form>
1919
</td>
2020
<td style="padding: 24px 0 0 0;">
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
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+
13+
<table class="data-col2" width="830px">
14+
<tr>
15+
<td style="padding: 24px 0 0 0;" width="100px">
16+
<form method="get">
17+
<input type="button" class="add-button" value="Back to domains" onClick="location.href='/list/web/'">
18+
</form>
19+
</td>
20+
<td style="padding: 24px 0 0 0;">
21+
<form action="/unsuspend/web/" method="get">
22+
<input type="hidden" name="domain" value="<?php echo $_GET['domain']?>">
23+
<input type="submit" class="add-button" name="unsuspend" value="Unsuspend <?php echo $_GET['domain']?>">
24+
</form>
25+
</td>
26+
</tr>
27+
</table>
28+
</td>
29+
</tr>
30+
</table>

web/templates/admin/unsuspend_user.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<tr>
1515
<td style="padding: 24px 0 0 0;" width="100px">
1616
<form method="post">
17-
<input type="submit" class="add-button" name="back" value="Back to users">
17+
<input type="button" class="add-button" value="Back to users" onClick="location.href='/list/user/'">
1818
</form>
1919
</td>
2020
<td style="padding: 24px 0 0 0;">
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
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+
13+
<table class="data-col2" width="830px">
14+
<tr>
15+
<td style="padding: 24px 0 0 0;" width="100px">
16+
<form method="get">
17+
<input type="button" class="add-button" value="Back to domains" onClick="location.href='/list/web/'">
18+
</form>
19+
</td>
20+
<td style="padding: 24px 0 0 0;">
21+
<form action="/suspend/web/" method="get">
22+
<input type="hidden" name="domain" value="<?php echo $_GET['domain']?>">
23+
<input type="submit" class="add-button" name="unsuspend" value="Suspend <?php echo $_GET['domain']?>">
24+
</form>
25+
</td>
26+
</tr>
27+
</table>
28+
</td>
29+
</tr>
30+
</table>

web/unsuspend/web/index.php

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
<?php
2+
// Init
3+
//error_reporting(NULL);
4+
ob_start();
5+
session_start();
6+
$TAB = 'WEB';
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/web/");
21+
}
22+
23+
// Ok
24+
if (!empty($_GET['domain'])) {
25+
$v_username = escapeshellarg($user);
26+
$v_domain = escapeshellarg($_GET['domain']);
27+
exec (VESTA_CMD."v_unsuspend_web_domain ".$v_username." ".$v_domain, $output, $return_var);
28+
if ($return_var != 0) {
29+
$error = implode('<br>', $output);
30+
if (empty($error)) $error = 'Error: vesta did not return any output.';
31+
$_SESSION['error_msg'] = $error;
32+
} else {
33+
$_SESSION['ok_msg'] = "OK: web domain <b>".$_GET['domain']."</b> has been unsuspended.";
34+
unset($v_lname);
35+
}
36+
unset($output);
37+
38+
include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/menu_unsuspend_web.html');
39+
include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/unsuspend_web.html');
40+
unset($_SESSION['error_msg']);
41+
unset($_SESSION['ok_msg']);
42+
43+
} else {
44+
header("Location: /list/web/");
45+
}
46+
47+
}
48+
49+
// Footer
50+
include($_SERVER['DOCUMENT_ROOT'].'/templates/footer.html');

0 commit comments

Comments
 (0)