more removing of aps/autoresponder/backup
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
This commit is contained in:
@@ -47,10 +47,6 @@ if ($page == 'customers'
|
||||
'c.traffic_used' => $lng['customer']['traffic'] . ' (' . $lng['panel']['used'] . ')'
|
||||
);
|
||||
|
||||
if ($settings['system']['backup_enabled'] == '1') {
|
||||
$field['c.backup_allowed'] = $lng['backup_allowed'];
|
||||
}
|
||||
|
||||
$paging = new paging($userinfo, TABLE_PANEL_CUSTOMERS, $fields, $settings['panel']['paging'], $settings['panel']['natsorting']);
|
||||
$customers = '';
|
||||
$result_stmt = Database::prepare("
|
||||
@@ -120,7 +116,7 @@ if ($page == 'customers'
|
||||
$islocked = 1;
|
||||
}
|
||||
|
||||
$row = str_replace_array('-1', 'UL', $row, 'diskspace traffic mysqls emails email_accounts email_forwarders ftps tickets subdomains email_autoresponder');
|
||||
$row = str_replace_array('-1', 'UL', $row, 'diskspace traffic mysqls emails email_accounts email_forwarders ftps tickets subdomains');
|
||||
$row = htmlentities_array($row);
|
||||
eval("\$customers.=\"" . getTemplate("customers/customers_customer") . "\";");
|
||||
$count++;
|
||||
@@ -307,8 +303,6 @@ if ($page == 'customers'
|
||||
Database::pexecute($stmt, array('id' => $id));
|
||||
$stmt = Database::prepare("DELETE FROM `" . TABLE_FTP_USERS . "` WHERE `customerid` = :id");
|
||||
Database::pexecute($stmt, array('id' => $id));
|
||||
$stmt = Database::prepare("DELETE FROM `" . TABLE_MAIL_AUTORESPONDER . "` WHERE `customerid` = :id");
|
||||
Database::pexecute($stmt, array('id' => $id));
|
||||
|
||||
// Delete all waiting "create user" -tasks for this user, #276
|
||||
// Note: the WHERE selects part of a serialized array, but it should be safe this way
|
||||
@@ -318,26 +312,6 @@ if ($page == 'customers'
|
||||
);
|
||||
Database::pexecute($del_stmt, array(':loginname' => "%:{$result['loginname']};%"));
|
||||
|
||||
// remove everything APS-related, #216
|
||||
$apsresult_stmt = Database::prepare("SELECT `ID` FROM `".TABLE_APS_INSTANCES."` WHERE `CustomerID` = :id");
|
||||
Database::pexecute($apsresult_stmt, array('id' => $id));
|
||||
|
||||
while ($apsrow = $apsresult_stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||
// remove all package related settings
|
||||
$del_stmt = Database::prepare("DELETE FROM `".TABLE_APS_SETTINGS."` WHERE `InstanceID` = :iid");
|
||||
Database::pexecute($del_stmt, array('iid' => $apsrow['ID']));
|
||||
// maybe some leftovers in the tasks
|
||||
$del_stmt = Database::prepare("DELETE FROM `".TABLE_APS_TASKS."` WHERE `InstanceID` = :iid");
|
||||
Database::pexecute($del_stmt, array('iid' => $apsrow['ID']));
|
||||
}
|
||||
// now remove all user instances
|
||||
$stmt = Database::prepare("DELETE FROM `".TABLE_APS_INSTANCES."` WHERE `CustomerID` = :id'");
|
||||
Database::pexecute($stmt, array('id' => $id));
|
||||
// eventually some temp-setting-leftovers
|
||||
$stmt = Database::prepare("DELETE FROM `".TABLE_APS_TEMP_SETTINGS."` WHERE `CustomerID` = :id");
|
||||
Database::pexecute($stmt, array('id' => $id));
|
||||
// eof APS-related removings, #216
|
||||
|
||||
$admin_update_query = "UPDATE `" . TABLE_PANEL_ADMINS . "` SET `customers_used` = `customers_used` - 1 ";
|
||||
$admin_update_query.= ", `domains_used` = `domains_used` - 0" . (int)($domains_deleted - $result['subdomains_used']);
|
||||
|
||||
@@ -361,10 +335,6 @@ if ($page == 'customers'
|
||||
$admin_update_query.= ", `email_quota_used` = `email_quota_used` - 0" . (int)$result['email_quota'];
|
||||
}
|
||||
|
||||
if ($result['email_autoresponder'] != '-1') {
|
||||
$admin_update_query.= ", `email_autoresponder_used` = `email_autoresponder_used` - 0" . (int)$result['email_autoresponder'];
|
||||
}
|
||||
|
||||
if ($result['subdomains'] != '-1') {
|
||||
$admin_update_query.= ", `subdomains_used` = `subdomains_used` - 0" . (int)$result['subdomains'];
|
||||
}
|
||||
@@ -377,10 +347,6 @@ if ($page == 'customers'
|
||||
$admin_update_query.= ", `tickets_used` = `tickets_used` - 0" . (int)$result['tickets'];
|
||||
}
|
||||
|
||||
if ($result['aps_packages'] != '-1') {
|
||||
$admin_update_query.= ", `aps_packages_used` = `aps_packages_used` - 0" . (int)$result['aps_packages'];
|
||||
}
|
||||
|
||||
if (($result['diskspace'] / 1024) != '-1') {
|
||||
$admin_update_query.= ", `diskspace_used` = `diskspace_used` - 0" . (int)$result['diskspace'];
|
||||
}
|
||||
@@ -485,15 +451,6 @@ if ($page == 'customers'
|
||||
$email_quota = - 1;
|
||||
}
|
||||
|
||||
if ($settings['autoresponder']['autoresponder_active'] == '1') {
|
||||
$email_autoresponder = intval_ressource($_POST['email_autoresponder']);
|
||||
if (isset($_POST['email_autoresponder_ul'])) {
|
||||
$email_autoresponder = - 1;
|
||||
}
|
||||
} else {
|
||||
$email_autoresponder = 0;
|
||||
}
|
||||
|
||||
$email_imap = 0;
|
||||
if (isset($_POST['email_imap'])) {
|
||||
$email_imap = intval_ressource($_POST['email_imap']);
|
||||
@@ -524,15 +481,6 @@ if ($page == 'customers'
|
||||
$mysqls = - 1;
|
||||
}
|
||||
|
||||
if ($settings['aps']['aps_active'] == '1') {
|
||||
$number_of_aps_packages = intval_ressource($_POST['number_of_aps_packages']);
|
||||
if (isset($_POST['number_of_aps_packages_ul'])) {
|
||||
$number_of_aps_packages = - 1;
|
||||
}
|
||||
} else {
|
||||
$number_of_aps_packages = 0;
|
||||
}
|
||||
|
||||
$createstdsubdomain = 0;
|
||||
if(isset($_POST['createstdsubdomain'])) {
|
||||
$createstdsubdomain = intval($_POST['createstdsubdomain']);
|
||||
@@ -545,15 +493,6 @@ if ($page == 'customers'
|
||||
$password = validatePassword($password);
|
||||
}
|
||||
|
||||
$backup_allowed = 0;
|
||||
if (isset($_POST['backup_allowed'])) {
|
||||
$backup_allowed = intval($_POST['backup_allowed']);
|
||||
}
|
||||
|
||||
if ($backup_allowed != 0) {
|
||||
$backup_allowed = 1;
|
||||
}
|
||||
|
||||
// gender out of range? [0,2]
|
||||
if ($gender < 0 || $gender > 2) {
|
||||
$gender = 0;
|
||||
@@ -588,22 +527,18 @@ if ($page == 'customers'
|
||||
|| ((($userinfo['email_accounts_used'] + $email_accounts) > $userinfo['email_accounts']) && $userinfo['email_accounts'] != '-1')
|
||||
|| ((($userinfo['email_forwarders_used'] + $email_forwarders) > $userinfo['email_forwarders']) && $userinfo['email_forwarders'] != '-1')
|
||||
|| ((($userinfo['email_quota_used'] + $email_quota) > $userinfo['email_quota']) && $userinfo['email_quota'] != '-1' && $settings['system']['mail_quota_enabled'] == '1')
|
||||
|| ((($userinfo['email_autoresponder_used'] + $email_autoresponder) > $userinfo['email_autoresponder']) && $userinfo['email_autoresponder'] != '-1' && $settings['autoresponder']['autoresponder_active'] == '1')
|
||||
|| ((($userinfo['ftps_used'] + $ftps) > $userinfo['ftps']) && $userinfo['ftps'] != '-1')
|
||||
|| ((($userinfo['tickets_used'] + $tickets) > $userinfo['tickets']) && $userinfo['tickets'] != '-1')
|
||||
|| ((($userinfo['subdomains_used'] + $subdomains) > $userinfo['subdomains']) && $userinfo['subdomains'] != '-1')
|
||||
|| ((($userinfo['aps_packages_used'] + $number_of_aps_packages) > $userinfo['aps_packages']) && $userinfo['aps_packages'] != '-1' && $settings['aps']['aps_active'] == '1')
|
||||
|| (($diskspace / 1024) == '-1' && ($userinfo['diskspace'] / 1024) != '-1')
|
||||
|| ($mysqls == '-1' && $userinfo['mysqls'] != '-1')
|
||||
|| ($emails == '-1' && $userinfo['emails'] != '-1')
|
||||
|| ($email_accounts == '-1' && $userinfo['email_accounts'] != '-1')
|
||||
|| ($email_forwarders == '-1' && $userinfo['email_forwarders'] != '-1')
|
||||
|| ($email_quota == '-1' && $userinfo['email_quota'] != '-1' && $settings['system']['mail_quota_enabled'] == '1')
|
||||
|| ($email_autoresponder == '-1' && $userinfo['email_autoresponder'] != '-1' && $settings['autoresponder']['autoresponder_active'] == '1')
|
||||
|| ($ftps == '-1' && $userinfo['ftps'] != '-1')
|
||||
|| ($tickets == '-1' && $userinfo['tickets'] != '-1')
|
||||
|| ($subdomains == '-1' && $userinfo['subdomains'] != '-1')
|
||||
|| ($number_of_aps_packages == '-1' && $userinfo['aps_packages'] != '-1')
|
||||
) {
|
||||
standard_error('youcantallocatemorethanyouhave');
|
||||
exit;
|
||||
@@ -728,10 +663,7 @@ if ($page == 'customers'
|
||||
'phpenabled' => $phpenabled,
|
||||
'imap' => $email_imap,
|
||||
'pop3' => $email_pop3,
|
||||
'aps' => $number_of_aps_packages,
|
||||
'perlenabled' => $perlenabled,
|
||||
'email_autoresponder' => $email_autoresponder,
|
||||
'backup_allowed' => $backup_allowed,
|
||||
'theme' => $theme
|
||||
);
|
||||
|
||||
@@ -768,10 +700,7 @@ if ($page == 'customers'
|
||||
`phpenabled` = :phpenabled,
|
||||
`imap` = :imap,
|
||||
`pop3` = :pop3,
|
||||
`aps_packages` = :aps,
|
||||
`perlenabled` = :perlenabled,
|
||||
`email_autoresponder` = :email_autoresponder,
|
||||
`backup_allowed` = :backup_allowed,
|
||||
`theme` = :theme"
|
||||
);
|
||||
Database::pexecute($ins_stmt, $ins_data);
|
||||
@@ -800,12 +729,6 @@ if ($page == 'customers'
|
||||
$admin_update_query.= ", `email_quota_used` = `email_quota_used` + 0" . (int)$email_quota;
|
||||
}
|
||||
|
||||
if ($email_autoresponder != '-1'
|
||||
&& $settings['autoresponder']['autoresponder_active'] == 1
|
||||
) {
|
||||
$admin_update_query.= ", `email_autoresponder_used` = `email_autoresponder_used` + 0" . (int)$email_autoresponder;
|
||||
}
|
||||
|
||||
if ($subdomains != '-1') {
|
||||
$admin_update_query.= ", `subdomains_used` = `subdomains_used` + 0" . (int)$subdomains;
|
||||
}
|
||||
@@ -824,10 +747,6 @@ if ($page == 'customers'
|
||||
$admin_update_query.= ", `diskspace_used` = `diskspace_used` + 0" . (int)$diskspace;
|
||||
}
|
||||
|
||||
if ($number_of_aps_packages != '-1') {
|
||||
$admin_update_query.= ", `aps_packages_used` = `aps_packages_used` + 0" . (int)$number_of_aps_packages;
|
||||
}
|
||||
|
||||
$admin_update_query.= " WHERE `adminid` = '" . (int)$userinfo['adminid'] . "'";
|
||||
Database::query($admin_update_query);
|
||||
|
||||
@@ -1032,11 +951,9 @@ if ($page == 'customers'
|
||||
$email_accounts_ul = makecheckbox('email_accounts_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
|
||||
$email_forwarders_ul = makecheckbox('email_forwarders_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
|
||||
$email_quota_ul = makecheckbox('email_quota_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
|
||||
$email_autoresponder_ul = makecheckbox('email_autoresponder_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
|
||||
$ftps_ul = makecheckbox('ftps_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
|
||||
$tickets_ul = makecheckbox('tickets_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
|
||||
$mysqls_ul = makecheckbox('mysqls_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
|
||||
$number_of_aps_packages_ul = makecheckbox('number_of_aps_packages_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
|
||||
|
||||
$gender_options = makeoption($lng['gender']['undef'], 0, true, true, true);
|
||||
$gender_options .= makeoption($lng['gender']['male'], 1, null, true, true);
|
||||
@@ -1125,15 +1042,6 @@ if ($page == 'customers'
|
||||
$email_quota = - 1;
|
||||
}
|
||||
|
||||
if ($settings['autoresponder']['autoresponder_active'] == '1') {
|
||||
$email_autoresponder = intval_ressource($_POST['email_autoresponder']);
|
||||
if (isset($_POST['email_autoresponder_ul'])) {
|
||||
$email_autoresponder = - 1;
|
||||
}
|
||||
} else {
|
||||
$email_autoresponder = 0;
|
||||
}
|
||||
|
||||
$email_imap = 0;
|
||||
if (isset($_POST['email_imap'])) {
|
||||
$email_imap = intval_ressource($_POST['email_imap']);
|
||||
@@ -1159,14 +1067,6 @@ if ($page == 'customers'
|
||||
$tickets = - 1;
|
||||
}
|
||||
|
||||
$backup_allowed = 0;
|
||||
if (isset($_POST['backup_allowed'])) {
|
||||
$backup_allowed = intval($_POST['backup_allowed']);
|
||||
}
|
||||
if ($backup_allowed != '0') {
|
||||
$backup_allowed = 1;
|
||||
}
|
||||
|
||||
// gender out of range? [0,2]
|
||||
if ($gender < 0 || $gender > 2) {
|
||||
$gender = 0;
|
||||
@@ -1180,15 +1080,6 @@ if ($page == 'customers'
|
||||
$mysqls = - 1;
|
||||
}
|
||||
|
||||
if ($settings['aps']['aps_active'] == '1') {
|
||||
$number_of_aps_packages = intval_ressource($_POST['number_of_aps_packages']);
|
||||
if (isset($_POST['number_of_aps_packages_ul'])) {
|
||||
$number_of_aps_packages = - 1;
|
||||
}
|
||||
} else {
|
||||
$number_of_aps_packages = 0;
|
||||
}
|
||||
|
||||
$createstdsubdomain = 0;
|
||||
if (isset($_POST['createstdsubdomain'])) {
|
||||
$createstdsubdomain = intval($_POST['createstdsubdomain']);
|
||||
@@ -1218,22 +1109,18 @@ if ($page == 'customers'
|
||||
|| ((($userinfo['email_accounts_used'] + $email_accounts - $result['email_accounts']) > $userinfo['email_accounts']) && $userinfo['email_accounts'] != '-1')
|
||||
|| ((($userinfo['email_forwarders_used'] + $email_forwarders - $result['email_forwarders']) > $userinfo['email_forwarders']) && $userinfo['email_forwarders'] != '-1')
|
||||
|| ((($userinfo['email_quota_used'] + $email_quota - $result['email_quota']) > $userinfo['email_quota']) && $userinfo['email_quota'] != '-1' && $settings['system']['mail_quota_enabled'] == '1')
|
||||
|| ((($userinfo['email_autoresponder_used'] + $email_autoresponder - $result['email_autoresponder']) > $userinfo['email_autoresponder']) && $userinfo['email_autoresponder'] != '-1' && $settings['autoresponder']['autoresponder_active'] == '1')
|
||||
|| ((($userinfo['ftps_used'] + $ftps - $result['ftps']) > $userinfo['ftps']) && $userinfo['ftps'] != '-1')
|
||||
|| ((($userinfo['tickets_used'] + $tickets - $result['tickets']) > $userinfo['tickets']) && $userinfo['tickets'] != '-1')
|
||||
|| ((($userinfo['subdomains_used'] + $subdomains - $result['subdomains']) > $userinfo['subdomains']) && $userinfo['subdomains'] != '-1')
|
||||
|| (($diskspace / 1024) == '-1' && ($userinfo['diskspace'] / 1024) != '-1')
|
||||
|| ((($userinfo['aps_packages'] + $number_of_aps_packages - $result['aps_packages']) > $userinfo['aps_packages']) && $userinfo['aps_packages'] != '-1' && $settings['aps']['aps_active'] == '1')
|
||||
|| ($mysqls == '-1' && $userinfo['mysqls'] != '-1')
|
||||
|| ($emails == '-1' && $userinfo['emails'] != '-1')
|
||||
|| ($email_accounts == '-1' && $userinfo['email_accounts'] != '-1')
|
||||
|| ($email_forwarders == '-1' && $userinfo['email_forwarders'] != '-1')
|
||||
|| ($email_quota == '-1' && $userinfo['email_quota'] != '-1' && $settings['system']['mail_quota_enabled'] == '1')
|
||||
|| ($email_autoresponder == '-1' && $userinfo['email_autoresponder'] != '-1' && $settings['autoresponder']['autoresponder_active'] == '1')
|
||||
|| ($ftps == '-1' && $userinfo['ftps'] != '-1')
|
||||
|| ($tickets == '-1' && $userinfo['tickets'] != '-1')
|
||||
|| ($subdomains == '-1' && $userinfo['subdomains'] != '-1')
|
||||
|| ($number_of_aps_packages == '-1' && $userinfo['aps_packages'] != '-1')
|
||||
) {
|
||||
standard_error('youcantallocatemorethanyouhave');
|
||||
exit;
|
||||
@@ -1451,10 +1338,7 @@ if ($page == 'customers'
|
||||
'phpenabled' => $phpenabled,
|
||||
'imap' => $email_imap,
|
||||
'pop3' => $email_pop3,
|
||||
'aps' => $number_of_aps_packages,
|
||||
'perlenabled' => $perlenabled,
|
||||
'email_autoresponder' => $email_autoresponder,
|
||||
'backup_allowed' => $backup_allowed
|
||||
'perlenabled' => $perlenabled
|
||||
);
|
||||
$upd_stmt = Database::prepare("
|
||||
UPDATE `" . TABLE_PANEL_CUSTOMERS . "` SET
|
||||
@@ -1485,10 +1369,7 @@ if ($page == 'customers'
|
||||
`email_quota` = :email_quota,
|
||||
`imap` = :imap,
|
||||
`pop3` = :pop3,
|
||||
`aps_packages` = :aps,
|
||||
`perlenabled` = :perlenabled,
|
||||
`email_autoresponder` = :email_autoresponder,
|
||||
`backup_allowed` = :backup_allowed
|
||||
`perlenabled` = :perlenabled
|
||||
WHERE `customerid` = :customerid"
|
||||
);
|
||||
Database::pexecute($upd_stmt, $upd_data);
|
||||
@@ -1553,17 +1434,6 @@ if ($page == 'customers'
|
||||
}
|
||||
}
|
||||
|
||||
if ($email_autoresponder != '-1' || $result['email_autoresponder'] != '-1') {
|
||||
$admin_update_query.= ", `email_autoresponder_used` = `email_autoresponder_used` ";
|
||||
|
||||
if ($email_autoresponder != '-1') {
|
||||
$admin_update_query.= " + 0" . (int)$email_autoresponder . " ";
|
||||
}
|
||||
if ($result['email_autoresponder'] != '-1') {
|
||||
$admin_update_query.= " - 0" . (int)$result['email_autoresponder'] . " ";
|
||||
}
|
||||
}
|
||||
|
||||
if ($subdomains != '-1' || $result['subdomains'] != '-1') {
|
||||
$admin_update_query.= ", `subdomains_used` = `subdomains_used` ";
|
||||
|
||||
@@ -1608,17 +1478,6 @@ if ($page == 'customers'
|
||||
}
|
||||
}
|
||||
|
||||
if ($number_of_aps_packages != '-1' || $result['aps_packages'] != '-1') {
|
||||
$admin_update_query.= ", `aps_packages_used` = `aps_packages_used` ";
|
||||
|
||||
if ($number_of_aps_packages != '-1') {
|
||||
$admin_update_query.= " + 0" . (int)$number_of_aps_packages . " ";
|
||||
}
|
||||
if ($result['aps_packages'] != '-1') {
|
||||
$admin_update_query.= " - 0" . (int)$result['aps_packages'] . " ";
|
||||
}
|
||||
}
|
||||
|
||||
$admin_update_query.= " WHERE `adminid` = '" . (int)$result['adminid'] . "'";
|
||||
Database::query($admin_update_query);
|
||||
$log->logAction(ADM_ACTION, LOG_INFO, "edited user '" . $result['loginname'] . "'");
|
||||
@@ -1676,11 +1535,6 @@ if ($page == 'customers'
|
||||
$result['email_quota'] = '';
|
||||
}
|
||||
|
||||
$email_autoresponder_ul = makecheckbox('email_autoresponder_ul', $lng['customer']['unlimited'], '-1', false, $result['email_autoresponder'], true, true);
|
||||
if ($result['email_autoresponder'] == '-1') {
|
||||
$result['email_autoresponder'] = '';
|
||||
}
|
||||
|
||||
$ftps_ul = makecheckbox('ftps_ul', $lng['customer']['unlimited'], '-1', false, $result['ftps'], true, true);
|
||||
if ($result['ftps'] == '-1') {
|
||||
$result['ftps'] = '';
|
||||
@@ -1696,11 +1550,6 @@ if ($page == 'customers'
|
||||
$result['mysqls'] = '';
|
||||
}
|
||||
|
||||
$number_of_aps_packages_ul = makecheckbox('number_of_aps_packages_ul', $lng['customer']['unlimited'], '-1', false, $result['aps_packages'], true, true);
|
||||
if ($result['aps_packages'] == '-1') {
|
||||
$result['aps_packages'] = '';
|
||||
}
|
||||
|
||||
$result = htmlentities_array($result);
|
||||
|
||||
$gender_options = makeoption($lng['gender']['undef'], 0, ($result['gender'] == '0' ? true : false), true, true);
|
||||
|
||||
Reference in New Issue
Block a user