[fusion-commits] r1453 - trunk/MapGuide/php

svn_fusion at osgeo.org svn_fusion at osgeo.org
Fri Aug 8 14:11:09 EDT 2008


Author: madair
Date: 2008-08-08 14:11:09 -0400 (Fri, 08 Aug 2008)
New Revision: 1453

Modified:
   trunk/MapGuide/php/UserManager.php
Log:
add check for non empty user ID in getUser()

Modified: trunk/MapGuide/php/UserManager.php
===================================================================
--- trunk/MapGuide/php/UserManager.php	2008-08-07 20:37:00 UTC (rev 1452)
+++ trunk/MapGuide/php/UserManager.php	2008-08-08 18:11:09 UTC (rev 1453)
@@ -387,22 +387,24 @@
     
     function GetUser($id) {
         $user = FALSE;
-        $result = $this->db->query("SELECT * FROM users where userid = $id;");
-        if ($result) {
-            $a = $result->fetch();
-            $result = $this->db->query('SELECT * from user_prefs, prefs WHERE userid = '.$id.' AND user_prefs.prefid = prefs.prefid;');
-            $prefs = array();
-            if ($result) {
-                while ($pref = $result->fetch()) {
-                    array_push($prefs, array('name'=>$pref['prefs.name'], 'value'=>$pref['user_prefs.value']));
-                }
-            }
-            $groups = array();
-            $aGroups = $this->GetGroups($a['username']);
-            for ( $i=0; $i < count($aGroups); $i++) { 
-                array_push($groups, $aGroups[$i]['name']);
-            }
-            $user = new FusionUser($a['userid'], $a['username'], $a['email'], $prefs, $groups );
+        if (!empty($id)) {
+          $result = $this->db->query("SELECT * FROM users where userid = $id;");
+          if ($result) {
+              $a = $result->fetch();
+              $result = $this->db->query('SELECT * from user_prefs, prefs WHERE userid = '.$id.' AND user_prefs.prefid = prefs.prefid;');
+              $prefs = array();
+              if ($result) {
+                  while ($pref = $result->fetch()) {
+                      array_push($prefs, array('name'=>$pref['prefs.name'], 'value'=>$pref['user_prefs.value']));
+                  }
+              }
+              $groups = array();
+              $aGroups = $this->GetGroups($a['username']);
+              for ( $i=0; $i < count($aGroups); $i++) { 
+                  array_push($groups, $aGroups[$i]['name']);
+              }
+              $user = new FusionUser($a['userid'], $a['username'], $a['email'], $prefs, $groups );
+          }
         }
         return $user;
     }



More information about the fusion-commits mailing list