From d7e44f384f4e7f8c9d00edc337a6e0985544eb4d Mon Sep 17 00:00:00 2001 From: Steven Mondji-Lerider Date: Tue, 18 Mar 2014 15:48:39 +0000 Subject: [PATCH] Fixing SQL queries on fix_quota_script --- src/fix_dovecot_quota.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/fix_dovecot_quota.php b/src/fix_dovecot_quota.php index 5e72c9fa..a561c060 100755 --- a/src/fix_dovecot_quota.php +++ b/src/fix_dovecot_quota.php @@ -31,7 +31,6 @@ if ( $nb2 != 1 ){ exit(1); } - #function taking a query used to select the mailbox(es) root and updating their quotas into the mailbox table function FixQuotaDovecot($conditions){ global $db; @@ -41,7 +40,7 @@ function FixQuotaDovecot($conditions){ mailbox join address on address.id = mailbox.address_id join domaines on domaines.id = address.domain_id - WHERE $conditions ;"; + $conditions ;"; if(!$db->query($query)){ usage("failed"); // FIXME real error @@ -65,7 +64,7 @@ switch($opt){ usage("The email you entered is syntaxically incorrect"); exit(1); } - $cond = "concat(address.address,'@',domaines.domaine) ='".$val ; + $cond = "WHERE concat(address.address,'@',domaines.domaine) ='".$val."'" ; break; case "l": $login=strtolower($val); @@ -73,14 +72,14 @@ switch($opt){ usage("the login you entered is syntaxically incorrect"); exit(1); } - $cond = "membres.login = ".mysql_real_escape_string($login) ; + $cond = "join membres on domaines.compte = membres.uid WHERE membres.login = '".mysql_real_escape_string($login)."'"; break; case "d": if(checkfqdn($val) != 0){ usage("The domain you entered is syntaxically incorrect"); exit(1); } - $cond = "domaines.domaine = ".mysql_real_escape_string($val) ; + $cond = "WHERE domaines.domaine = '".mysql_real_escape_string($val)."'" ; break; default: usage();