$parent_domain = $exdb->queryOneRecord("SELECT d.id, d.cl_id, d.name FROM domains as d WHERE d.id = '" . $entry['dom_id'] . "'"); if (!$parent_domain) { $msg .= "Could not insert/update mail alias " . $entry['alias'] . " as domain is missing.<br />"; continue; } $params = array('server_id' => $server_id, 'source' => $entry['alias'] . "@" . $parent_domain['name'], 'destination' => $entry['mail_name'] . "@" . $parent_domain['name'], 'type' => 'alias', 'active' => yes_no(1)); $client_id = $plesk_ispc_ids[$domain_owners[$entry['dom_id']]]; $old_mail = $app->db->queryOneRecord("SELECT forwarding_id FROM mail_forwarding WHERE source = '" . $entry['alias'] . "@" . $parent_domain['name'] . "' AND destination = '" . $entry['mail_name'] . "@" . $parent_domain['name'] . "'"); if ($old_mail) { $new_id = $old_mail['forwarding_id']; $ok = $importer->mail_alias_update($session_id, $client_id, $new_id, array_merge($old_mail, $params)); if ($ok === false) { $msg .= " Error: " . $importer->getFault() . "<br />"; } } else { $new_id = $importer->mail_alias_add($session_id, $client_id, $params); } if ($new_id === false) { //something went wrong here... $msg .= "Mail alias " . $entry['id'] . " (" . $entry['alias'] . "@" . $parent_domain['name'] . ") could not be inserted/updated.<br />"; $msg .= " Error: " . $importer->getFault() . "<br />"; } else { $msg .= "Mail alias " . $entry['id'] . " (" . $entry['alias'] . "@" . $parent_domain['name'] . ") inserted/updated.<br />"; } } unset($mail_aliases); //spamfilter // preferences = true/false, username = email address, can be *@* //id, username, preferences //spamfilter_preferences //prefid, spamfilter_id, preference, value //$client_traffic = $exdb->queryAllRecords("SELECT t.cl_id, t.date, t.http_in, t.http_out, t.ftp_in, t.ftp_out, t.smtp_in, t.smtp_out, t.pop3_imap_in, t.pop3_imap_out FROM ClientsTraffic as t");