$del_stmt = Database::prepare("\n\t\t\t\t\tDELETE FROM `" . TABLE_PANEL_DOMAINREDIRECTS . "`\n\t\t\t\t\tWHERE `did` = :domainid"); Database::pexecute($del_stmt, array('domainid' => $id)); $log->logAction(ADM_ACTION, LOG_INFO, "deleted domain/subdomains (#" . $result['id'] . ")"); updateCounters(); inserttask('1'); // Using nameserver, insert a task which rebuilds the server config inserttask('4'); redirectTo($filename, array('page' => $page, 's' => $s)); } elseif ($alias_check['count'] > 0) { standard_error('domains_cantdeletedomainwithaliases'); } else { $showcheck = false; if (domainHasMainSubDomains($id)) { $showcheck = true; } ask_yesno_withcheckbox('admin_domain_reallydelete', 'remove_subbutmain_domains', $filename, array('id' => $id, 'page' => $page, 'action' => $action), $idna_convert->decode($result['domain']), $showcheck); } } } elseif ($action == 'add') { if ($userinfo['domains_used'] < $userinfo['domains'] || $userinfo['domains'] == '-1') { if (isset($_POST['send']) && $_POST['send'] == 'send') { if ($_POST['domain'] == Settings::Get('system.hostname')) { standard_error('admin_domain_emailsystemhostname'); exit; } $domain = $idna_convert->encode(preg_replace(array('/\\:(\\d)+$/', '/^https?\\:\\/\\//'), '', validate($_POST['domain'], 'domain'))); $subcanemaildomain = intval($_POST['subcanemaildomain']); $isemaildomain = 0; if (isset($_POST['isemaildomain'])) { $isemaildomain = intval($_POST['isemaildomain']); }
Database::pexecute($stmt, array("name" => $result['username'])); $stmt = Database::prepare("DELETE FROM `" . TABLE_FTP_USERS . "`\n\t\t\t\t\tWHERE `customerid` = :customerid\n\t\t\t\t\tAND `id` = :id"); Database::pexecute($stmt, array("customerid" => $userinfo['customerid'], "id" => $id)); $stmt = Database::prepare("\n\t\t\t\t\tUPDATE `" . TABLE_FTP_GROUPS . "` SET\n\t\t\t\t\t`members` = REPLACE(`members`, :username,'')\n\t\t\t\t\tWHERE `customerid` = :customerid\n\t\t\t\t"); Database::pexecute($stmt, array("username" => "," . $result['username'], "customerid" => $userinfo['customerid'])); $log->logAction(USR_ACTION, LOG_INFO, "deleted ftp-account '" . $result['username'] . "'"); $resetaccnumber = $userinfo['ftps_used'] == '1' ? " , `ftp_lastaccountnumber`='0'" : ''; // refs #293 if (isset($_POST['delete_userfiles']) && (int) $_POST['delete_userfiles'] == 1) { inserttask('8', $userinfo['loginname'], $result['homedir']); } $stmt = Database::prepare("UPDATE `" . TABLE_PANEL_CUSTOMERS . "`\n\t\t\t\t\tSET `ftps_used` = `ftps_used` - 1 {$resetaccnumber}\n\t\t\t\t\tWHERE `customerid` = :customerid"); Database::pexecute($stmt, array("customerid" => $userinfo['customerid'])); redirectTo($filename, array('page' => $page, 's' => $s)); } else { ask_yesno_withcheckbox('ftp_reallydelete', 'admin_customer_alsoremoveftphomedir', $filename, array('id' => $id, 'page' => $page, 'action' => $action), $result['username']); } } else { standard_error('ftp_cantdeletemainaccount'); } } elseif ($action == 'add') { if ($userinfo['ftps_used'] < $userinfo['ftps'] || $userinfo['ftps'] == '-1') { if (isset($_POST['send']) && $_POST['send'] == 'send') { $description = validate($_POST['ftp_description'], 'description'); // @FIXME use a good path-validating regex here (refs #1231) $path = validate($_POST['path'], 'path'); $password = validate($_POST['ftp_password'], 'password'); $password = validatePassword($password); $sendinfomail = isset($_POST['sendinfomail']) ? 1 : 0; if ($sendinfomail != 1) { $sendinfomail = 0;
$db->query("DELETE FROM `" . TABLE_MAIL_USERS . "` WHERE `customerid`='" . (int) $userinfo['customerid'] . "' AND `id`='" . (int) $result['popaccountid'] . "'"); $result['destination'] = str_replace($result['email_full'], '', $result['destination']); $db->query("UPDATE `" . TABLE_MAIL_VIRTUAL . "` SET `destination` = '" . $db->escape(makeCorrectDestination($result['destination'])) . "', `popaccountid` = '0' WHERE `customerid`='" . (int) $userinfo['customerid'] . "' AND `id`='" . (int) $id . "'"); if ($settings['system']['mail_quota_enabled'] == '1' && $userinfo['email_quota'] != '-1') { $quota = (int) $result['quota']; } else { $quota = 0; } if (isset($_POST['delete_userfiles']) && (int) $_POST['delete_userfiles'] == 1) { inserttask('7', $userinfo['loginname'], $result['email_full']); } $db->query("UPDATE `" . TABLE_PANEL_CUSTOMERS . "` SET `email_accounts_used` = `email_accounts_used` - 1, `email_quota_used` = `email_quota_used` - " . (int) $quota . " WHERE `customerid`='" . (int) $userinfo['customerid'] . "'"); $log->logAction(USR_ACTION, LOG_INFO, "deleted email account for '" . $result['email_full'] . "'"); redirectTo($filename, array('page' => 'emails', 'action' => 'edit', 'id' => $id, 's' => $s)); } else { ask_yesno_withcheckbox('email_reallydelete_account', 'admin_customer_alsoremovemail', $filename, array('id' => $id, 'page' => $page, 'action' => $action), $idna_convert->decode($result['email_full'])); } } } } elseif ($page == 'forwarders') { if ($action == 'add' && $id != 0) { if ($userinfo['email_forwarders_used'] < $userinfo['email_forwarders'] || $userinfo['email_forwarders'] == '-1') { $result = $db->query_first("SELECT `id`, `email`, `email_full`, `iscatchall`, `destination`, `customerid`, `popaccountid`, `domainid` FROM `" . TABLE_MAIL_VIRTUAL . "` WHERE `customerid`='" . (int) $userinfo['customerid'] . "' AND `id`='" . (int) $id . "'"); if (isset($result['email']) && $result['email'] != '') { if (isset($_POST['send']) && $_POST['send'] == 'send') { $destination = $idna_convert->encode($_POST['destination']); $result['destination_array'] = explode(' ', $result['destination']); if ($destination == '') { standard_error('destinationnonexist'); } elseif (!validateEmail($destination)) { standard_error('destinationiswrong', $destination);
$tickets = ticket::customerHasTickets($id); if ($tickets !== false && isset($tickets[0])) { foreach ($tickets as $ticket) { $now = time(); $mainticket = ticket::getInstanceOf($userinfo, (int) $ticket); $mainticket->Set('lastchange', $now, true, true); $mainticket->Set('lastreplier', '1', true, true); $mainticket->Set('status', '3', true, true); $mainticket->Update(); $mainticket->Archive(); $log->logAction(ADM_ACTION, LOG_NOTICE, "archived ticket '" . $mainticket->Get('subject') . "'"); } } redirectTo($filename, array('page' => $page, 's' => $s)); } else { ask_yesno_withcheckbox('admin_customer_reallydelete', 'admin_customer_alsoremovefiles', $filename, array('id' => $id, 'page' => $page, 'action' => $action), $result['loginname']); } } } elseif ($action == 'add') { if ($userinfo['customers_used'] < $userinfo['customers'] || $userinfo['customers'] == '-1') { if (isset($_POST['send']) && $_POST['send'] == 'send') { $name = validate($_POST['name'], 'name'); $firstname = validate($_POST['firstname'], 'first name'); $company = validate($_POST['company'], 'company'); $street = validate($_POST['street'], 'street'); $zipcode = validate($_POST['zipcode'], 'zipcode', '/^[0-9 \\-A-Z]*$/'); $city = validate($_POST['city'], 'city'); $phone = validate($_POST['phone'], 'phone', '/^[0-9\\- \\+\\(\\)\\/]*$/'); $fax = validate($_POST['fax'], 'fax', '/^[0-9\\- \\+\\(\\)\\/]*$/'); $email = $idna_convert->encode(validate($_POST['email'], 'email')); $customernumber = validate($_POST['customernumber'], 'customer number', '/^[A-Za-z0-9 \\-]*$/Di');