function emailAliasesDeleteCallback($id) { global $pro_mysql_mailaliasgroup_table; triggerMXListUpdate(); updateUsingCron("gen_qmail='yes', qmail_newu='yes'"); $q = "DELETE FROM {$pro_mysql_mailaliasgroup_table} WHERE autoinc='{$id}';"; $r = mysql_query($q) or die("Cannot query {$q} line: " . __LINE__ . " file " . __FILE__ . " sql said:" . mysql_error()); if ($r != true) { die("Cannot find created email line " . __LINE__ . " file " . __FILE__); } triggerMXListUpdate(); updateUsingCron("gen_qmail='yes', qmail_newu='yes'"); return ""; }
function emailAccountsDeleteCallback($id) { global $cyrus_used; global $pro_mysql_pop_table; global $pro_mysql_fetchmail_table; triggerMXListUpdate(); updateUsingCron("gen_qmail='yes', qmail_newu='yes'"); $q = "SELECT id, mbox_host, home FROM {$pro_mysql_pop_table} WHERE autoinc='{$id}';"; $r = mysql_query($q) or die("Cannot query {$q} line: " . __LINE__ . " file " . __FILE__ . " sql said:" . mysql_error()); $n = mysql_num_rows($r); if ($n != 1) { die("Cannot find created email line " . __LINE__ . " file " . __FILE__); } $v = mysql_fetch_array($r); if ($cyrus_used) { # login to cyradm $cyr_conn = new cyradm(); $error = $cyr_conn->imap_login(); if ($error != 0) { die("imap_login Error {$error}"); } $result = $cyr_conn->deletemb("user/" . $v["id"] . "@" . $v["mbox_host"]); } $cmd = "rm -rf " . $v["home"]; exec($cmd, $exec_out, $return_val); $q = "DELETE FROM {$pro_mysql_fetchmail_table} WHERE domain_user='******' AND domain_name='" . $v["mbox_host"] . "';"; $r = mysql_query($q) or die("Cannot query {$q} line: " . __LINE__ . " file " . __FILE__ . " sql said:" . mysql_error()); updateUsingCron("qmail_newu='yes',restart_qmail='yes',gen_qmail='yes'"); return ""; }
if (isset($_REQUEST["dellist"]) && $_REQUEST["dellist"] == "Del") { checkLoginPassAndDomain($adm_login, $adm_pass, $edit_domain); // Verify strings given if (!isMailbox($_REQUEST["edit_mailbox"])) { die($_REQUEST["edit_mailbox"] . _(" does not look like a mailbox login...")); } //Some vars $name = $_REQUEST["edit_mailbox"]; $admin_path = getAdminPath($adm_login); $folder_name = $edit_domain . "_" . $name; $list_full_path = $admin_path . "/" . $edit_domain . "/lists/" . $folder_name; //I delete all files of this mailing list $del_spool = "rm /var/spool/mlmmj/" . $folder_name; exec($del_spool); $del_etc = "rm -rf /etc/mlmmj/lists/" . $folder_name; exec($del_etc); $del_ml = "rm -rf " . $list_full_path; exec($del_ml); // i need to add the postfix's aliases deletion // very important!!! // Delete list from sql database $adm_query = "DELETE FROM {$pro_mysql_list_table} WHERE domain='{$edit_domain}' AND name='{$name}' LIMIT 1"; unset($edit_mailbox); mysql_query($adm_query) or die("Cannot execute query \"{$adm_query}\""); if ($edit_domain == $conf_main_domain) { $adm_query = "DELETE FROM {$pro_mysql_vps_server_lists_table} WHERE list_name='{$name}';"; mysql_query($adm_query) or die("Cannot execute query \"{$adm_query}\" line " . __LINE__ . " file " . __FILE__ . " sql said: " . mysql_error()); } triggerMXListUpdate(); updateUsingCron("gen_qmail='yes', qmail_newu='yes'"); }