Пример #1
0
 /**
  * loads a record "user" from database
  * @access private
  */
 function read()
 {
     global $ilErr, $ilDB;
     // Alex: I have removed the JOIN to rbac_ua, since there seems to be no
     // use (3.11.0 alpha)
     /*$q = "SELECT * FROM usr_data ".
     	 "LEFT JOIN rbac_ua ON usr_data.usr_id=rbac_ua.usr_id ".
     	 "WHERE usr_data.usr_id= ".$ilDB->quote($this->id); */
     $r = $ilDB->queryF("SELECT * FROM usr_data " . "WHERE usr_id= %s", array("integer"), array($this->id));
     if ($data = $ilDB->fetchAssoc($r)) {
         // convert password storage layout used by table usr_data into
         // storage layout used by class ilObjUser
         if ($data["passwd"] == "" && $data["i2passwd"] != "") {
             $data["passwd_type"] = IL_PASSWD_CRYPT;
             $data["passwd"] = $data["i2passwd"];
         } else {
             $data["passwd_type"] = IL_PASSWD_MD5;
             //$data["passwd"] = $data["passwd"]; (implicit)
         }
         unset($data["i2passw"]);
         // this assign must not be set via $this->assignData($data)
         // because this method will be called on profile updates and
         // would set this values to 0, because they arent posted from form
         $this->setLastPasswordChangeTS($data['last_password_change']);
         $this->setLoginAttempts($data['login_attempts']);
         // fill member vars in one shot
         $this->assignData($data);
         //get userpreferences from usr_pref table
         $this->readPrefs();
         //set language to default if not set
         if ($this->prefs["language"] == "") {
             $this->prefs["language"] = $this->oldPrefs["language"];
         }
         //check skin-setting
         include_once "./Services/Style/classes/class.ilStyleDefinition.php";
         if ($this->prefs["skin"] == "" || !ilStyleDefinition::skinExists($this->prefs["skin"])) {
             $this->prefs["skin"] = $this->oldPrefs["skin"];
         }
         $this->skin = $this->prefs["skin"];
         //check style-setting (skins could have more than one stylesheet
         if ($this->prefs["style"] == "" || !ilStyleDefinition::skinExists($this->skin, $this->prefs["style"])) {
             //load default (css)
             $this->prefs["style"] = $this->ilias->ini->readVariable("layout", "style");
         }
         if (empty($this->prefs["hits_per_page"])) {
             $this->prefs["hits_per_page"] = 10;
         }
     } else {
         $ilErr->raiseError("<b>Error: There is no dataset with id " . $this->id . "!</b><br />class: " . get_class($this) . "<br />Script: " . __FILE__ . "<br />Line: " . __LINE__, $ilErr->FATAL);
     }
     $this->readUserDefinedFields();
     parent::read();
 }