Skip to content

Commit 2b81c9c

Browse files
committed
web delete function
1 parent 320e50f commit 2b81c9c

File tree

8 files changed

+122
-5
lines changed

8 files changed

+122
-5
lines changed

web/delete/web/index.php

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
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_delete_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+
}
33+
34+
// DNS
35+
unset($output);
36+
exec (VESTA_CMD."v_list_dns_domain ".$v_username." ".$v_domain." json", $output, $return_var);
37+
if ((empty($_SESSION['error_msg'])) && ($return_var == 0 )) {
38+
exec (VESTA_CMD."v_delete_dns_domain ".$v_username." ".$v_domain, $output, $return_var);
39+
if ($return_var != 0) {
40+
$error = implode('<br>', $output);
41+
if (empty($error)) $error = 'Error: vesta did not return any output.';
42+
$_SESSION['error_msg'] = $error;
43+
}
44+
}
45+
46+
// Mail
47+
unset($output);
48+
exec (VESTA_CMD."v_list_mail_domain ".$v_username." ".$v_domain." json", $output, $return_var);
49+
if ((empty($_SESSION['error_msg'])) && ($return_var == 0 )) {
50+
exec (VESTA_CMD."v_delete_mail_domain ".$v_username." ".$v_domain, $output, $return_var);
51+
if ($return_var != 0) {
52+
$error = implode('<br>', $output);
53+
if (empty($error)) $error = 'Error: vesta did not return any output.';
54+
$_SESSION['error_msg'] = $error;
55+
}
56+
}
57+
58+
59+
if (empty($_SESSION['error_msg'])) {
60+
$_SESSION['ok_msg'] = "OK: domain <b>".$_GET['domain']."</b> has been deleted.";
61+
unset($v_lname);
62+
}
63+
64+
65+
66+
include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/menu_delete_web.html');
67+
include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/delete_web.html');
68+
unset($_SESSION['error_msg']);
69+
unset($_SESSION['ok_msg']);
70+
71+
} else {
72+
header("Location: /list/web/");
73+
}
74+
75+
}
76+
77+
// Footer
78+
include($_SERVER['DOCUMENT_ROOT'].'/templates/footer.html');

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="button" class="add-button" value="Back to users" onClick="location.href='/list/user/'">
17+
<input type="button" class="add-button" value="List users" onClick="location.href='/list/user/'">
1818
</form>
1919
</td>
2020
</tr>
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
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;">
16+
<form method="post">
17+
<input type="button" class="add-button" value="List domains" onClick="location.href='/list/web/'">
18+
</form>
19+
</td>
20+
</tr>
21+
</table>
22+
</td>
23+
</tr>
24+
</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: 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="get">
17-
<input type="button" class="add-button" value="Back to users" onClick="location.href='/list/user/'">
17+
<input type="button" class="add-button" value="List users" onClick="location.href='/list/user/'">
1818
</form>
1919
</td>
2020
<td style="padding: 24px 0 0 0;">

web/templates/admin/suspend_web.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="get">
17-
<input type="button" class="add-button" value="Back to domains" onClick="location.href='/list/web/'">
17+
<input type="button" class="add-button" value="List domains" onClick="location.href='/list/web/'">
1818
</form>
1919
</td>
2020
<td style="padding: 24px 0 0 0;">

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="button" class="add-button" value="Back to users" onClick="location.href='/list/user/'">
17+
<input type="button" class="add-button" value="List users" onClick="location.href='/list/user/'">
1818
</form>
1919
</td>
2020
<td style="padding: 24px 0 0 0;">

web/templates/admin/unsuspend_web.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="get">
17-
<input type="button" class="add-button" value="Back to domains" onClick="location.href='/list/web/'">
17+
<input type="button" class="add-button" value="List domains" onClick="location.href='/list/web/'">
1818
</form>
1919
</td>
2020
<td style="padding: 24px 0 0 0;">

0 commit comments

Comments
 (0)