From 2741f24fdab1eb0c3b0d94312e2121e992e09026 Mon Sep 17 00:00:00 2001 From: domi <> Date: Sat, 25 Aug 2012 11:01:13 +0000 Subject: [PATCH] enum_domains() can now receive a specific uid, defaults to cuid --- bureau/class/m_mail.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/bureau/class/m_mail.php b/bureau/class/m_mail.php index 27a84b86..a4d43d32 100644 --- a/bureau/class/m_mail.php +++ b/bureau/class/m_mail.php @@ -106,10 +106,11 @@ class m_mail { /** Returns the list of mail-hosting domains for a user * @return array indexed array of hosted domains */ - function enum_domains() { + function enum_domains($uid=-1) { global $db,$err,$cuid; $err->log("mail","enum_domains"); - $db->query("select d.id, d.domaine, count(a.id) as nb_mail FROM domaines d left join address a on a.domain_id=d.id where d.compte = $cuid group by d.id order by d.domaine asc;"); + if ($uid == -1) { $uid = $cuid; } + $db->query("SELECT d.id, d.domaine, COUNT(a.id) AS nb_mail FROM domaines d LEFT JOIN address a ON a.domain_id=d.id WHERE d.compte={$uid} GROUP BY d.id ORDER BY d.domaine ASC;"); $this->enum_domains=array(); while($db->next_record()){ $this->enum_domains[]=$db->Record;