From: Stéphane Jacob Date: Mon, 5 Jul 2010 15:16:27 +0000 (+0200) Subject: Fixes some sql errors. X-Git-Tag: xorg/1.0.1~15^2~50 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=edf5e97934d710662babb5de5dd720519fb12e98;p=platal.git Fixes some sql errors. Signed-off-by: Stéphane Jacob --- diff --git a/modules/register/register.inc.php b/modules/register/register.inc.php index afe8d97..4da836b 100644 --- a/modules/register/register.inc.php +++ b/modules/register/register.inc.php @@ -152,9 +152,9 @@ function createAliases(&$subState) SET expire = ADDDATE(NOW(), INTERVAL 1 MONTH) WHERE alias = {?}', $emailXorg); XDB::execute('REPLACE INTO homonyms (homonyme_id, uid) - VALUES ({?}, {?})', $h_id, $h_id); + VALUES ({?}, {?})', $subState->i('uid'), $h_id); XDB::execute('REPLACE INTO homonyms (homonyme_id, uid) - VALUES ({?}, {?})', $h_id, $uid); + VALUES ({?}, {?})', $h_id, $subState->i('uid')); $res = XDB::query('SELECT alias FROM aliases WHERE uid = {?} AND expire IS NULL', $h_id); diff --git a/modules/stats.php b/modules/stats.php index 24863ae..d931031 100644 --- a/modules/stats.php +++ b/modules/stats.php @@ -65,9 +65,9 @@ class StatsModule extends PLModule $res = XDB::iterRow('SELECT IF(registration_date > DATE_SUB(NOW(), INTERVAL {?} DAY), TO_DAYS(registration_date) - TO_DAYS(NOW()), -{?}) AS jour, - COUNT(uid) AS nb + COUNT(a.uid) AS nb FROM accounts AS a - LEFT JOIN account_profiles AS ap ON(ap.uid = a.uid AND FIND_IN_SET(\'owner\', ap.flags)) + LEFT JOIN account_profiles AS ap ON (ap.uid = a.uid AND FIND_IN_SET(\'owner\', ap.perms)) LEFT JOIN profiles AS p ON (ap.pid = p.pid) WHERE state = \'active\' AND p.deathdate IS NULL GROUP BY jour', (int)$jours, 1 + (int)$jours);