예제 #1
0
 public function readUser($userid, $shaddowed = FALSE)
 {
     /*
     	| userid        | varchar(100) | NO   | PRI |         |       |
     	| username      | tinytext     | YES  |     | NULL    |       |
     	| email         | tinytext     | YES  |     | NULL    |       |
     	| org           | tinytext     | YES  |     | NULL    |       |
     	| orgunit       | tinytext     | YES  |     | NULL    |       |
     	| photol        | text         | YES  |     | NULL    |       |
     	| photom        | text         | YES  |     | NULL    |       |
     	| photos        | text         | YES  |     | NULL    |       |
     	| notifications | text         | YES  |     | NULL    |       |
     	| features      | text         | YES  |     | NULL    |       |
     	| calendar      | text         | YES  |     | NULL    |       |
     	| timezone      | tinytext     | YES  |     | NULL    |       |
     	| location      | tinytext     | YES  |     | NULL    |       |
     	| realm         | tinytext     | YES  |     | NULL    |       |
     		language
     	
     	userid, username, email, org, orgunit, photol, photom, photos, notifications, features, calendar, timezone, location, realm, language
     */
     Data_User::requireValidUserid($userid);
     $sql = "\n\t\t\tSELECT * \n\t\t\tFROM user WHERE userid = '" . mysql_real_escape_string(strtolower($userid)) . "'";
     try {
         $row = $this->q1($sql);
     } catch (Exception $e) {
         return false;
     }
     $user = new Data_User($this);
     $user->userid = strtolower($row['userid']);
     $user->username = $row['username'];
     $user->email = $row['email'];
     $user->org = $row['org'];
     $user->orgunit = $row['orgunit'];
     $user->photol = $row['photol'];
     $user->photom = $row['photom'];
     $user->photos = $row['photos'];
     $user->notifications = Data_User::decode($row['notifications']);
     $user->features = Data_User::decode($row['features']);
     $user->timezone = $row['timezone'];
     $user->location = $row['location'];
     $user->realm = $row['realm'];
     $user->language = $row['language'];
     $user->role = $row['role'];
     $user->idp = $row['idp'];
     $user->auth = $row['auth'];
     $user->shaddow = $row['shaddow'];
     $user->shaddowed = $shaddowed;
     // error_log('reading usuer from database');
     if (!empty($row['calendar'])) {
         // error_log('Setting calendar: ' . var_export($row['calendar'], TRUE));
         $user->setCalendar($row['calendar']);
     }
     //		$user->calendar = $row['calendar'];
     $user->loadedFromDB = TRUE;
     if (!empty($user->shaddow)) {
         return $this->readUser($user->shaddow, TRUE);
     }
     return $user;
 }