Beispiel #1
0
     }
     $params = array('server_id' => $server_id, 'parent_domain_id' => $domain_ids[$entry['dom_id']], 'username' => $entry['login'], 'password' => $entry['password'], 'quota_size' => byte_to_mbyte($entry['quota'] == 0 ? -1 : $entry['quota']), 'active' => yes_no(1), 'uid' => $uid, 'gid' => $gid, 'dir' => $document_root . (substr($document_root, -1) !== '/' ? '/' : ''), 'sys_groupid' => $sys_groupid);
     $new_id = false;
     $old_ftp = $app->db->queryOneRecord("SELECT ftp_user_id, parent_domain_id FROM ftp_user WHERE username = '******'login'] . "'");
     if ($old_ftp) {
         if ($old_ftp['parent_domain_id'] != $domain_ids[$entry['dom_id']]) {
             $msg .= "FTP Account conflicts with other domain!<br />";
         } else {
             $new_id = $old_ftp['ftp_user_id'];
             $ok = $importer->sites_ftp_user_update($session_id, $client_id, $new_id, array_merge($old_ftp, $params));
             if ($ok === false) {
                 $msg .= "&nbsp; Error: " . $importer->getFault() . "<br />";
             }
         }
     } else {
         $new_id = $importer->sites_ftp_user_add($session_id, $client_id, $params);
     }
     if ($new_id === false) {
         //something went wrong here...
         $msg .= "FTP " . $entry['id'] . " (" . $entry['login'] . ") could not be inserted.<br />";
         $msg .= "&nbsp; Error: " . $importer->getFault() . "<br />";
         $msg .= "Params: " . var_export($params, true) . "<br />";
     } else {
         $msg .= "FTP Account " . $entry['id'] . " (" . $entry['login'] . ") inserted.<br />";
     }
 }
 $mail_config = $app->getconf->get_server_config($server_id, 'mail');
 $mail_addresses = $exdb->queryAllRecords("SELECT m.id, m.mail_name, m.perm_id, m.postbox, m.account_id, m.redirect, m.redir_addr, m.mail_group, m.autoresponder, m.spamfilter, m.virusfilter, m.mbox_quota, m.dom_id, m.userId, a.password, a.type as `pwtype` FROM mail as m LEFT JOIN accounts as a ON (a.id = m.account_id) ");
 $mail_ids = array();
 foreach ($mail_addresses as $entry) {
     $parent_domain = $exdb->queryOneRecord("SELECT d.id, d.cl_id, d.name FROM domains as d WHERE d.id = '" . $entry['dom_id'] . "'");