Fix session init when the user have no last connection.
authorFlorent Bruneau <florent.bruneau@polytechnique.org>
Sat, 10 Nov 2007 17:54:43 +0000 (18:54 +0100)
committerFlorent Bruneau <florent.bruneau@polytechnique.org>
Sat, 10 Nov 2007 17:54:43 +0000 (18:54 +0100)
Signed-off-by: Florent Bruneau <florent.bruneau@polytechnique.org>
include/xorg/session.inc.php
modules/admin.php

index 0075c28..0f05e15 100644 (file)
@@ -255,7 +255,9 @@ function start_connexion ($uid, $identified)
                         WHERE  s.uid = {?} AND s.suid = 0
                      ORDER BY  s.start DESC
                         LIMIT  1", $uid);
-    $sess = array_merge($sess, $res->fetchOneAssoc());
+    if ($res->numRows()) {
+        $sess = array_merge($sess, $res->fetchOneAssoc());
+    }
     $suid = S::v('suid');
 
     if ($suid) {
index 9327f8a..7bbe5e7 100644 (file)
@@ -382,7 +382,7 @@ class AdminModule extends PLModule
             $_SESSION['suid'] = $_SESSION;
             $r = XDB::query("SELECT id FROM aliases WHERE alias={?}", $login);
             if($uid = $r->fetchOneCell()) {
-                start_connexion($uid,true);
+                start_connexion($uid, true);
                 pl_redirect("");
             }
         }