added backup/cron/db/ip/package bulk operations

This commit is contained in:
Serghey Rodin 2012-09-27 23:20:37 +03:00
commit cfd8bb297b
16 changed files with 272 additions and 106 deletions

23
web/bulk/backup/index.php Normal file
View file

@ -0,0 +1,23 @@
<?php
// Init
error_reporting(NULL);
ob_start();
session_start();
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
$backup = $_POST['backup'];
$action = $_POST['action'];
switch ($action) {
case 'delete': $cmd='v_delete_user_backup';
break;
default: header("Location: /list/backup/"); exit;
}
foreach ($backup as $value) {
$value = escapeshellarg($value);
exec (VESTA_CMD.$cmd." ".$user." ".$value, $output, $return_var);
}
header("Location: /list/backup/");

40
web/bulk/cron/index.php Normal file
View file

@ -0,0 +1,40 @@
<?php
// Init
error_reporting(NULL);
ob_start();
session_start();
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
$job = $_POST['job'];
$action = $_POST['action'];
if ($_SESSION['user'] == 'admin') {
switch ($action) {
case 'delete': $cmd='v_delete_cron_job';
break;
case 'suspend': $cmd='v_suspend_cron_job';
break;
case 'unsuspend': $cmd='v_unsuspend_cron_job';
break;
default: header("Location: /list/cron/"); exit;
}
} else {
switch ($action) {
case 'delete': $cmd='v_delete_cron_job';
break;
default: header("Location: /list/cron/"); exit;
}
}
foreach ($job as $value) {
$value = escapeshellarg($value);
exec (VESTA_CMD.$cmd." ".$user." ".$value." no", $output, $return_var);
$restart = 'yes';
}
if (!empty($restart)) {
exec (VESTA_CMD."v_restart_cron", $output, $return_var);
}
header("Location: /list/cron/");

35
web/bulk/db/index.php Normal file
View file

@ -0,0 +1,35 @@
<?php
// Init
error_reporting(NULL);
ob_start();
session_start();
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
$database = $_POST['database'];
$action = $_POST['action'];
if ($_SESSION['user'] == 'admin') {
switch ($action) {
case 'delete': $cmd='v_delete_database';
break;
case 'suspend': $cmd='v_suspend_database';
break;
case 'unsuspend': $cmd='v_unsuspend_database';
break;
default: header("Location: /list/db/"); exit;
}
} else {
switch ($action) {
case 'delete': $cmd='v_delete_database';
break;
default: header("Location: /list/db/"); exit;
}
}
foreach ($database as $value) {
$value = escapeshellarg($value);
exec (VESTA_CMD.$cmd." ".$user." ".$value, $output, $return_var);
}
header("Location: /list/db/");

29
web/bulk/ip/index.php Normal file
View file

@ -0,0 +1,29 @@
<?php
// Init
error_reporting(NULL);
ob_start();
session_start();
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
$ip = $_POST['ip'];
$action = $_POST['action'];
if ($_SESSION['user'] == 'admin') {
switch ($action) {
case 'delete': $cmd='v_delete_sys_ip';
break;
default: header("Location: /list/ip/"); exit;
}
} else {
header("Location: /list/ip/");
exit;
}
foreach ($ip as $value) {
$value = escapeshellarg($value);
exec (VESTA_CMD.$cmd." ".$value, $output, $return_var);
}
header("Location: /list/ip/");

View file

@ -53,7 +53,7 @@ if (empty($account)) {
foreach ($domain as $value) {
// Mail
$value = escapeshellarg($value);
exec (VESTA_CMD.$cmd." ".$user." ".$value." no", $output, $return_var);
exec (VESTA_CMD.$cmd." ".$user." ".$value, $output, $return_var);
$restart = 'yes';
}
} else {
@ -61,7 +61,7 @@ if (empty($account)) {
// Mail Account
$value = escapeshellarg($value);
$dom = escapeshellarg($domain);
exec (VESTA_CMD.$cmd." ".$user." ".$dom." ".$value." no", $output, $return_var);
exec (VESTA_CMD.$cmd." ".$user." ".$dom." ".$value, $output, $return_var);
$restart = 'yes';
}
}

View file

@ -0,0 +1,30 @@
<?php
// Init
error_reporting(NULL);
ob_start();
session_start();
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
$package = $_POST['package'];
$action = $_POST['action'];
if ($_SESSION['user'] == 'admin') {
switch ($action) {
case 'delete': $cmd='v_delete_user_package';
break;
default: header("Location: /list/package/"); exit;
}
} else {
header("Location: /list/package/");
exit;
}
foreach ($package as $value) {
$value = escapeshellarg($value);
exec (VESTA_CMD.$cmd." ".$value, $output, $return_var);
$restart = 'yes';
}
header("Location: /list/package/");