1
0
mirror of https://github.com/serghey-rodin/vesta.git synced 2025-03-12 04:36:25 -07:00
vesta/web/bulk/mail/index.php

82 lines
2.1 KiB
PHP
Raw Permalink Normal View History

2012-09-27 22:09:58 +03:00
<?php
// Init
error_reporting(NULL);
ob_start();
session_start();
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
2015-06-03 02:31:03 +03:00
// Check token
if ((!isset($_POST['token'])) || ($_SESSION['token'] != $_POST['token'])) {
header('location: /login/');
exit();
2015-06-03 02:31:03 +03:00
}
2012-09-27 22:09:58 +03:00
$domain = $_POST['domain'];
$account = $_POST['account'];
$action = $_POST['action'];
if ($_SESSION['user'] == 'admin') {
if (empty($account)) {
switch ($action) {
case 'delete': $cmd='v-delete-mail-domain';
2012-09-27 22:09:58 +03:00
break;
case 'suspend': $cmd='v-suspend-mail-domain';
2012-09-27 22:09:58 +03:00
break;
case 'unsuspend': $cmd='v-unsuspend-mail-domain';
2012-09-27 22:09:58 +03:00
break;
default: header("Location: /list/mail/"); exit;
}
} else {
switch ($action) {
case 'delete': $cmd='v-delete-mail-account';
2012-09-27 22:09:58 +03:00
break;
case 'suspend': $cmd='v-suspend-mail-account';
2012-09-27 22:09:58 +03:00
break;
case 'unsuspend': $cmd='v-unsuspend-mail-account';
2012-09-27 22:09:58 +03:00
break;
default: header("Location: /list/mail/?domain=".$domain); exit;
}
}
} else {
if (empty($account)) {
switch ($action) {
case 'delete': $cmd='v-delete-mail-domain';
2012-09-27 22:09:58 +03:00
break;
default: header("Location: /list/mail/"); exit;
}
} else {
switch ($action) {
case 'delete': $cmd='v-delete-mail-account';
2012-09-27 22:09:58 +03:00
break;
default: header("Location: /list/mail/?domain=".$domain); exit;
}
}
}
if (empty($account)) {
foreach ($domain as $value) {
// Mail
$value = escapeshellarg($value);
exec (VESTA_CMD.$cmd." ".$user." ".$value, $output, $return_var);
2012-09-27 22:09:58 +03:00
$restart = 'yes';
}
} else {
foreach ($account as $value) {
// Mail Account
$value = escapeshellarg($value);
$dom = escapeshellarg($domain);
exec (VESTA_CMD.$cmd." ".$user." ".$dom." ".$value, $output, $return_var);
2012-09-27 22:09:58 +03:00
$restart = 'yes';
}
}
if (empty($account)) {
2012-09-27 22:09:58 +03:00
header("Location: /list/mail/");
exit;
} else {
header("Location: /list/mail/?domain=".$domain);
exit;
}