Subdomains und Domains besser auseinanderhalten
bernd

bernd commited on 2009-01-04 20:05:48
Zeige 1 geänderte Dateien mit 11 Einfügungen und 5 Löschungen.


git-svn-id: https://svn.schokokeks.org/repos/tools/webinterface/trunk@1210 87cf0b9e-d624-0410-a070-f6ee81989793
... ...
@@ -256,14 +256,17 @@ function delete_account($id)
256 256
 
257 257
 function domainsettings($only_domain=NULL) {
258 258
   $uid = (int) $_SESSION['userinfo']['uid'];
259
-  if ($domain)
259
+  if ($only_domain)
260 260
     $only_domain = (int) $only_domain;
261
-  $result = db_query("SELECT d.id, CONCAT_WS('.',d.domainname,d.tld) AS name, d.mail, m.id AS m_id, v.id AS v_id, IF(ISNULL(v.hostname),m.subdomain,v.hostname) AS hostname FROM kundendaten.domains AS d LEFT JOIN mail.virtual_mail_domains AS v ON (d.id=v.domain) LEFT JOIN mail.custom_mappings AS m ON (d.id=m.domain) WHERE d.useraccount={$uid} OR m.uid={$uid};");
262 261
   $domains = array();
263 262
   $subdomains = array();
263
+
264
+  // Domains
265
+  $result = db_query("SELECT d.id, CONCAT_WS('.',d.domainname,d.tld) AS name, d.mail, m.id AS m_id, v.id AS v_id FROM kundendaten.domains AS d LEFT JOIN mail.virtual_mail_domains AS v ON (d.id=v.domain AND v.hostname IS NULL) LEFT JOIN mail.custom_mappings AS m ON (d.id=m.domain AND m.subdomain IS NULL) WHERE d.useraccount={$uid} OR m.uid={$uid};");
266
+
264 267
   while ($mydom = mysql_fetch_assoc($result)) {
265 268
     if (! array_key_exists($mydom['id'], $domains)) {
266
-      if ($mydom['v_id'] && ! $mydom['hostname'])
269
+      if ($mydom['v_id'])
267 270
         $mydom['mail'] = 'virtual';
268 271
       $domains[$mydom['id']] = array(
269 272
         "name" => $mydom['name'],
... ...
@@ -272,7 +275,11 @@ function domainsettings($only_domain=NULL) {
272 275
       if ($only_domain && $only_domain == $mydom['id'])
273 276
         return $domains[$only_domain];
274 277
     }
275
-    if ($mydom['hostname']) {
278
+  }      
279
+
280
+  // Subdomains
281
+  $result = db_query("SELECT d.id, CONCAT_WS('.',d.domainname,d.tld) AS name, d.mail, m.id AS m_id, v.id AS v_id, IF(ISNULL(v.hostname),m.subdomain,v.hostname) AS hostname FROM kundendaten.domains AS d LEFT JOIN mail.virtual_mail_domains AS v ON (d.id=v.domain AND v.hostname IS NOT NULL) LEFT JOIN mail.custom_mappings AS m ON (d.id=m.domain AND m.subdomain IS NOT NULL) WHERE d.useraccount={$uid} OR m.uid={$uid};");
282
+  while ($mydom = mysql_fetch_assoc($result)) {
276 283
     if (! array_key_exists($mydom['id'], $subdomains))
277 284
       $subdomains[$mydom['id']] = array();
278 285
         
... ...
@@ -284,7 +291,6 @@ function domainsettings($only_domain=NULL) {
284 291
       "type" => $type
285 292
       );
286 293
   }
287
-  }
288 294
   return array("domains" => $domains, "subdomains" => $subdomains);
289 295
 }
290 296
 
291 297