Fixes some sql errors.
authorStéphane Jacob <sj@m4x.org>
Mon, 5 Jul 2010 15:16:27 +0000 (17:16 +0200)
committerStéphane Jacob <sj@m4x.org>
Mon, 5 Jul 2010 15:16:27 +0000 (17:16 +0200)
Signed-off-by: Stéphane Jacob <sj@m4x.org>
modules/register/register.inc.php
modules/stats.php

index afe8d97..4da836b 100644 (file)
@@ -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);
index 24863ae..d931031 100644 (file)
@@ -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);