Skip to content

Commit cfd8bb2

Browse files
committed
added backup/cron/db/ip/package bulk operations
1 parent daea239 commit cfd8bb2

File tree

16 files changed

+272
-106
lines changed

16 files changed

+272
-106
lines changed

web/bulk/backup/index.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php
2+
// Init
3+
error_reporting(NULL);
4+
ob_start();
5+
session_start();
6+
7+
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
8+
9+
$backup = $_POST['backup'];
10+
$action = $_POST['action'];
11+
12+
switch ($action) {
13+
case 'delete': $cmd='v_delete_user_backup';
14+
break;
15+
default: header("Location: /list/backup/"); exit;
16+
}
17+
18+
foreach ($backup as $value) {
19+
$value = escapeshellarg($value);
20+
exec (VESTA_CMD.$cmd." ".$user." ".$value, $output, $return_var);
21+
}
22+
23+
header("Location: /list/backup/");

web/bulk/cron/index.php

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<?php
2+
// Init
3+
error_reporting(NULL);
4+
ob_start();
5+
session_start();
6+
7+
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
8+
9+
$job = $_POST['job'];
10+
$action = $_POST['action'];
11+
12+
if ($_SESSION['user'] == 'admin') {
13+
switch ($action) {
14+
case 'delete': $cmd='v_delete_cron_job';
15+
break;
16+
case 'suspend': $cmd='v_suspend_cron_job';
17+
break;
18+
case 'unsuspend': $cmd='v_unsuspend_cron_job';
19+
break;
20+
default: header("Location: /list/cron/"); exit;
21+
}
22+
} else {
23+
switch ($action) {
24+
case 'delete': $cmd='v_delete_cron_job';
25+
break;
26+
default: header("Location: /list/cron/"); exit;
27+
}
28+
}
29+
30+
foreach ($job as $value) {
31+
$value = escapeshellarg($value);
32+
exec (VESTA_CMD.$cmd." ".$user." ".$value." no", $output, $return_var);
33+
$restart = 'yes';
34+
}
35+
36+
if (!empty($restart)) {
37+
exec (VESTA_CMD."v_restart_cron", $output, $return_var);
38+
}
39+
40+
header("Location: /list/cron/");

web/bulk/db/index.php

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<?php
2+
// Init
3+
error_reporting(NULL);
4+
ob_start();
5+
session_start();
6+
7+
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
8+
9+
$database = $_POST['database'];
10+
$action = $_POST['action'];
11+
12+
if ($_SESSION['user'] == 'admin') {
13+
switch ($action) {
14+
case 'delete': $cmd='v_delete_database';
15+
break;
16+
case 'suspend': $cmd='v_suspend_database';
17+
break;
18+
case 'unsuspend': $cmd='v_unsuspend_database';
19+
break;
20+
default: header("Location: /list/db/"); exit;
21+
}
22+
} else {
23+
switch ($action) {
24+
case 'delete': $cmd='v_delete_database';
25+
break;
26+
default: header("Location: /list/db/"); exit;
27+
}
28+
}
29+
30+
foreach ($database as $value) {
31+
$value = escapeshellarg($value);
32+
exec (VESTA_CMD.$cmd." ".$user." ".$value, $output, $return_var);
33+
}
34+
35+
header("Location: /list/db/");

web/bulk/ip/index.php

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?php
2+
// Init
3+
error_reporting(NULL);
4+
ob_start();
5+
session_start();
6+
7+
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
8+
9+
$ip = $_POST['ip'];
10+
$action = $_POST['action'];
11+
12+
if ($_SESSION['user'] == 'admin') {
13+
switch ($action) {
14+
case 'delete': $cmd='v_delete_sys_ip';
15+
break;
16+
default: header("Location: /list/ip/"); exit;
17+
}
18+
} else {
19+
header("Location: /list/ip/");
20+
exit;
21+
}
22+
23+
foreach ($ip as $value) {
24+
$value = escapeshellarg($value);
25+
exec (VESTA_CMD.$cmd." ".$value, $output, $return_var);
26+
}
27+
28+
29+
header("Location: /list/ip/");

web/bulk/mail/index.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,15 +53,15 @@
5353
foreach ($domain as $value) {
5454
// Mail
5555
$value = escapeshellarg($value);
56-
exec (VESTA_CMD.$cmd." ".$user." ".$value." no", $output, $return_var);
56+
exec (VESTA_CMD.$cmd." ".$user." ".$value, $output, $return_var);
5757
$restart = 'yes';
5858
}
5959
} else {
6060
foreach ($account as $value) {
6161
// Mail Account
6262
$value = escapeshellarg($value);
6363
$dom = escapeshellarg($domain);
64-
exec (VESTA_CMD.$cmd." ".$user." ".$dom." ".$value." no", $output, $return_var);
64+
exec (VESTA_CMD.$cmd." ".$user." ".$dom." ".$value, $output, $return_var);
6565
$restart = 'yes';
6666
}
6767
}

web/bulk/package/index.php

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?php
2+
// Init
3+
error_reporting(NULL);
4+
ob_start();
5+
session_start();
6+
7+
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
8+
9+
$package = $_POST['package'];
10+
$action = $_POST['action'];
11+
12+
if ($_SESSION['user'] == 'admin') {
13+
switch ($action) {
14+
case 'delete': $cmd='v_delete_user_package';
15+
break;
16+
default: header("Location: /list/package/"); exit;
17+
}
18+
} else {
19+
header("Location: /list/package/");
20+
exit;
21+
}
22+
23+
foreach ($package as $value) {
24+
$value = escapeshellarg($value);
25+
exec (VESTA_CMD.$cmd." ".$value, $output, $return_var);
26+
$restart = 'yes';
27+
}
28+
29+
30+
header("Location: /list/package/");

web/templates/admin/list_backup.html

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,24 @@
11

22
<table class="sub-menu" style="background: white;">
33
<tr>
4-
<td style="padding: 12px 0 8px 6px">
4+
<td style="padding: 12px 0 0 6px">
55
<div style="float:left">
66
<button style="width:120px; padding: 2px 0px;" > Create Backup </button>
77
</div>
88
<div style="text-align: right; float: right;">
9-
<input type="text" size="30" style="padding: 3px 80px 3px 0; margin: 0 2px 0 0;">
10-
<button> Search </button>
9+
<form action="/search/" method="get" >
10+
<input type="text" size="30" style="padding: 3px 80px 3px 0; margin: 0 2px 0 0;" name="q">
11+
<input type="submit" name="search" value="Search" class="button" style="font-size: 12px;">
12+
</form>
1113
</div>
1214
<div style="float:left; padding-left: 26px;">
13-
<a style="padding: 0 4px 0 12px" class="select-controls" href='javascript:checkedAll("vstobjects");'> toggle all </a>
14-
<select style="margin:0 2px 0 0px;" >
15+
<form action="/bulk/backup/" method="post" id="objects">
16+
<a style="padding: 0 4px 0 12px" class="select-controls" href='javascript:checkedAll("objects");'> toggle all </a>
17+
<select style="margin:0 2px 0 0px;" name="action">
1518
<option>apply to selected</option>
16-
<option>rebuild</option>
17-
<option>update counters</option>
18-
<option>suspend</option>
19-
<option>unsuspend</option>
2019
<option>delete</option>
2120
</select>
22-
<button style="width:27px;"></button>
21+
<input type="submit" name="ok" value="" class="button" style="width: 37px; font-size: 12px;">
2322
</div>
2423
</td>
2524
</tr>
@@ -28,7 +27,7 @@
2827
</tr>
2928
</table>
3029

31-
<form id="vstobjects">
30+
<div id="vstobjects">
3231
<table class="data">
3332

3433
<?php
@@ -88,7 +87,7 @@
8887
<tr class="data-row">
8988
<td class="data-dotted" style="padding: 0px 10px 0px 0px" width="150">
9089
<table class="data-col1">
91-
<tr><td style="padding: 18 0 4 18;"><input type="checkbox" name="object" ></td></tr>
90+
<tr><td style="padding: 18 0 4 18;"><input type="checkbox" name="backup[]" value="<?php echo $key ?>" ></td></tr>
9291
<tr><td><a class="data-date" title="<?php echo $data[$key]['DATE']." ".$data[$key]['TIME'] ?>"><?php echo date("d M Y", strtotime($data[$key]['DATE'])) ?></td></tr>
9392
<tr><td class="data-active"><b>active</b></td></tr>
9493
</table>
@@ -219,6 +218,7 @@
219218
?>
220219

221220
</table>
221+
</form>
222222

223223
<table class="data-count">
224224
<tr>
@@ -234,5 +234,5 @@
234234
</td>
235235
</tr>
236236
</table>
237-
</form>
237+
</div>
238238

web/templates/admin/list_cron.html

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,25 @@
11
<table class="sub-menu" style="background: white;">
22
<tr>
3-
<td style="padding: 12px 0 8px 6px">
3+
<td style="padding: 12px 0 0 6px">
44
<div style="float:left">
55
<button style="width:120px; padding: 2px 0px;" onclick="location.href='/add/cron/'"> Add Cron Job </button>
66
</div>
77
<div style="text-align: right; float: right;">
8-
<input type="text" size="30" style="padding: 3px 80px 3px 0; margin: 0 2px 0 0;">
9-
<button> Search </button>
8+
<form action="/search/" method="get" >
9+
<input type="text" size="30" style="padding: 3px 80px 3px 0; margin: 0 2px 0 0;" name="q">
10+
<input type="submit" name="search" value="Search" class="button" style="font-size: 12px;">
11+
</form>
1012
</div>
1113
<div style="float:left; padding-left: 26px;">
12-
<a style="padding: 0 4px 0 12px" class="select-controls" href='javascript:checkedAll("vstobjects");'> toggle all </a>
13-
<select style="margin:0 2px 0 0px;" >
14+
<form action="/bulk/cron/" method="post" id="objects">
15+
<a style="padding: 0 4px 0 12px" class="select-controls" href='javascript:checkedAll("objects");'> toggle all </a>
16+
<select style="margin:0 2px 0 0px;" name="action">
1417
<option>apply to selected</option>
15-
<option>rebuild</option>
16-
<option>update counters</option>
1718
<option>suspend</option>
1819
<option>unsuspend</option>
1920
<option>delete</option>
2021
</select>
21-
<button style="width:27px;"></button>
22+
<input type="submit" name="ok" value="" class="button" style="width: 37px; font-size: 12px;">
2223
</div>
2324
</td>
2425
</tr>
@@ -27,7 +28,7 @@
2728
</tr>
2829
</table>
2930

30-
<form id="vstobjects">
31+
<div id="vstobjects">
3132
<table class='data'>
3233

3334
<?php
@@ -83,7 +84,7 @@
8384
</script>
8485
<td class="data-dotted" style="padding: 0px 10px 0px 0px" width="150">
8586
<table class="data-col1">
86-
<tr><td style="padding: 18 0 4 18;"><input type="checkbox" name="object" ></td></tr>
87+
<tr><td style="padding: 18 0 4 18;"><input type="checkbox" name="job[]" value="<?php echo $data[$key]['JOB'] ?>" ></td></tr>
8788
<tr><td><a class="data-date" title="<?php echo $data[$key]['DATE']." ".$data[$key]['TIME'] ?>"><?php echo date("d M Y", strtotime($data[$key]['DATE'])) ?></td></tr>
8889
<tr><td class="data-<?php echo $status ?>"><b><?php echo $status ?></b></td></tr>
8990
</table>
@@ -196,6 +197,7 @@
196197
}
197198
?>
198199
</table>
200+
</from>
199201

200202
<table class="data-count">
201203
<tr>
@@ -211,5 +213,5 @@
211213
</td>
212214
</tr>
213215
</table>
214-
</form>
216+
</div>
215217

web/templates/admin/list_db.html

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,26 @@
11

22
<table class="sub-menu" style="background: white;">
33
<tr>
4-
<td style="padding: 12px 0 8px 6px">
4+
<td style="padding: 12px 0 0 6px">
55
<div style="float:left">
66
<button style="width:120px; padding: 2px 0px;" onclick="location.href='/add/db/'"> Add Database </button>
77
</div>
88
<div style="text-align: right; float: right;">
9-
<input type="text" size="30" style="padding: 3px 80px 3px 0; margin: 0 2px 0 0;">
10-
<button> Search </button>
9+
<form action="/search/" method="get" >
10+
<input type="text" size="30" style="padding: 3px 80px 3px 0; margin: 0 2px 0 0;" name="q">
11+
<input type="submit" name="search" value="Search" class="button" style="font-size: 12px;">
12+
</form>
1113
</div>
1214
<div style="float:left; padding-left: 26px;">
13-
<a style="padding: 0 4px 0 12px" class="select-controls" href='javascript:checkedAll("vstobjects");'> toggle all </a>
14-
<select style="margin:0 2px 0 0px;" >
15+
<form action="/bulk/db/" method="post" id="objects">
16+
<a style="padding: 0 4px 0 12px" class="select-controls" href='javascript:checkedAll("objects");'> toggle all </a>
17+
<select style="margin:0 2px 0 0px;" name="action">
1518
<option>apply to selected</option>
16-
<option>rebuild</option>
17-
<option>update counters</option>
1819
<option>suspend</option>
1920
<option>unsuspend</option>
2021
<option>delete</option>
2122
</select>
22-
<button style="width:27px;"></button>
23+
<input type="submit" name="ok" value="" class="button" style="width: 37px; font-size: 12px;">
2324
</div>
2425
</td>
2526
</tr>
@@ -28,7 +29,7 @@
2829
</tr>
2930
</table>
3031

31-
<form id="vstobjects">
32+
<div id="vstobjects">
3233
<table class='data'>
3334
<?php
3435
list($http_host, $port) = explode(':', $_SERVER["HTTP_HOST"]);
@@ -87,7 +88,7 @@
8788
</script>
8889
<td class="data-dotted" style="padding: 0px 10px 0px 0px" width="150">
8990
<table class="data-col1">
90-
<tr><td style="padding: 18 0 4 18;"><input type="checkbox" name="object" ></td></tr>
91+
<tr><td style="padding: 18 0 4 18;"><input type="checkbox" name="database[]" value="<?php echo $key ?>" ></td></tr>
9192
<tr><td><a class="data-date" title="<?php echo $data[$key]['DATE']." ".$data[$key]['TIME'] ?>"><?php echo date("d M Y", strtotime($data[$key]['DATE'])) ?></td></tr>
9293
<tr><td class="data-<?php echo $status ?>"><b><?php echo $status ?></b></td></tr>
9394
</table>
@@ -177,6 +178,7 @@
177178
}
178179
?>
179180
</table>
181+
</form>
180182

181183
<table class="data-count">
182184
<tr>
@@ -192,4 +194,4 @@
192194
</td>
193195
</tr>
194196
</table>
195-
</form>
197+
</div>

0 commit comments

Comments
 (0)