4define(
"IL_PASSWD_PLAIN", 
"plain");
 
    5define(
"IL_PASSWD_CRYPTED", 
"crypted");
 
    8require_once 
"./Services/Object/classes/class.ilObject.php";
 
    9require_once 
'./Services/User/exceptions/class.ilUserException.php';
 
   10require_once 
'./Modules/OrgUnit/classes/class.ilObjOrgUnit.php';
 
   11require_once 
'./Modules/OrgUnit/classes/class.ilObjOrgUnitTree.php';
 
  175    public function __construct($a_user_id = 0, $a_call_by_reference = 
false)
 
  184        parent::__construct($a_user_id, $a_call_by_reference);
 
  185        $this->auth_mode = 
"default";
 
  194        if ($a_user_id > 0) {
 
  195            $this->
setId($a_user_id);
 
  200            $this->prefs = array();
 
  202            $this->prefs[
"language"] = $this->
ilias->ini->readVariable(
"language", 
"default");
 
  205            $this->skin = $this->
ilias->ini->readVariable(
"layout", 
"skin");
 
  211            $this->prefs[
"style"] = $this->
ilias->ini->readVariable(
"layout", 
"style");
 
  228        $r = 
$ilDB->queryF(
"SELECT * FROM usr_data " .
 
  229             "WHERE usr_id= %s", array(
"integer"), array($this->
id));
 
  231        if (
$data = $ilDB->fetchAssoc(
$r)) {
 
  250            if ($this->prefs[
"language"] == 
"") {
 
  251                $this->prefs[
"language"] = $this->oldPrefs[
"language"];
 
  255            include_once(
"./Services/Style/System/classes/class.ilStyleDefinition.php");
 
  256            if ($this->prefs[
"skin"] == 
"" ||
 
  258                $this->prefs[
"skin"] = $this->oldPrefs[
"skin"];
 
  261            $this->skin = $this->prefs[
"skin"];
 
  264            if ($this->prefs[
"style"] == 
"" ||
 
  267                $this->prefs[
"style"] = $this->
ilias->ini->readVariable(
"layout", 
"style");
 
  270            if (empty($this->prefs[
"hits_per_page"])) {
 
  271                $this->prefs[
"hits_per_page"] = 10;
 
  274            $ilErr->raiseError(
"<b>Error: There is no dataset with id " .
 
  275                               $this->
id . 
"!</b><br />class: " . get_class($this) . 
"<br />Script: " . __FILE__ .
 
  276                               "<br />Line: " . __LINE__, 
$ilErr->FATAL);
 
  298        $this->password_encoding_type = $password_encryption_type;
 
  328        if (!$a_data[
"passwd_type"]) {
 
  329            $ilErr->raiseError(
"<b>Error: passwd_type missing in function assignData(). " .
 
  330                                $this->
id . 
"!</b><br />class: " . get_class($this) . 
"<br />Script: " 
  331                                . __FILE__ . 
"<br />Line: " . __LINE__, 
$ilErr->FATAL);
 
  333        if ($a_data[
"passwd"] != 
"********" and strlen($a_data[
'passwd'])) {
 
  334            $this->
setPasswd($a_data[
"passwd"], $a_data[
"passwd_type"]);
 
  342        if (!is_array($a_data[
'birthday'])) {
 
  352        $this->
setCity($a_data[
"city"]);
 
  359        $this->
setFax($a_data[
"fax"]);
 
  376        $this->create_date      = $a_data[
"create_date"];
 
  377        $this->
setComment($a_data[
"referral_comment"]);
 
  378        $this->approve_date = $a_data[
"approve_date"];
 
  379        $this->active = $a_data[
"active"];
 
  380        $this->agree_date = $a_data[
"agree_date"];
 
  407    public function saveAsNew($a_from_formular = 
true)
 
  409        global $ilAppEventHandler;
 
  417        switch ($this->passwd_type) {
 
  419                if (strlen($this->passwd)) {
 
  420                    require_once 
'Services/User/classes/class.ilUserPasswordManager.php';
 
  433                 $ilErr->raiseError(
"<b>Error: passwd_type missing in function saveAsNew. " .
 
  434                                    $this->
id . 
"!</b><br />class: " . get_class($this) . 
"<br />Script: " . __FILE__ .
 
  435                                    "<br />Line: " . __LINE__, 
$ilErr->FATAL);
 
  438        if (!$this->active) {
 
  444        $insert_array = array(
 
  445            "usr_id" => array(
"integer", $this->
id),
 
  446            "login" => array(
"text", $this->login),
 
  447            "passwd" => array(
"text", $pw_value),
 
  450            "firstname" => array(
"text", $this->firstname),
 
  451            "lastname" => array(
"text", $this->lastname),
 
  452            "title" => array(
"text", $this->utitle),
 
  453            "gender" => array(
"text", $this->gender),
 
  454            "email" => array(
"text", trim($this->email)),
 
  455            "second_email" => array(
"text", trim($this->second_email)),
 
  456            "hobby" => array(
"text", (
string) $this->hobby),
 
  457            "institution" => array(
"text", $this->institution),
 
  458            "department" => array(
"text", $this->department),
 
  459            "street" => array(
"text", $this->street),
 
  460            "city" => array(
"text", $this->city),
 
  461            "zipcode" => array(
"text", $this->zipcode),
 
  462            "country" => array(
"text", $this->country),
 
  463            "sel_country" => array(
"text", $this->sel_country),
 
  464            "phone_office" => array(
"text", $this->phone_office),
 
  465            "phone_home" => array(
"text", $this->phone_home),
 
  466            "phone_mobile" => array(
"text", $this->phone_mobile),
 
  467            "fax" => array(
"text", $this->fax),
 
  469            "last_login" => array(
"timestamp", 
null),
 
  470            "last_update" => array(
"timestamp", 
ilUtil::now()),
 
  471            "create_date" => array(
"timestamp", 
ilUtil::now()),
 
  472            "referral_comment" => array(
"text", $this->referral_comment),
 
  473            "matriculation" => array(
"text", $this->matriculation),
 
  474            "client_ip" => array(
"text", $this->client_ip),
 
  475            "approve_date" => array(
"timestamp", $this->approve_date),
 
  476            "agree_date" => array(
"timestamp", $this->agree_date),
 
  477            "active" => array(
"integer", (
int) $this->active),
 
  482            "auth_mode" => array(
"text", $this->
getAuthMode()),
 
  485            "latitude" => array(
"text", $this->latitude),
 
  486            "longitude" => array(
"text", $this->longitude),
 
  487            "loc_zoom" => array(
"integer", (
int) $this->loc_zoom),
 
  488            "last_password_change" => array(
"integer", (
int) $this->last_password_change_ts),
 
  489            'inactivation_date' => array(
'timestamp', $this->inactivation_date),
 
  490            'is_self_registered' => array(
'integer', (
int) $this->is_self_registered),
 
  492        $ilDB->insert(
"usr_data", $insert_array);
 
  502        include_once(
"Services/Mail/classes/class.ilMailbox.php");
 
  504        $mbox->createDefaultFolder();
 
  506        include_once 
"Services/Mail/classes/class.ilMailOptions.php";
 
  508        $mail_options->createMailOptionsEntry();
 
  511        include_once 
"./Services/Bookmarks/classes/class.ilBookmarkFolder.php";
 
  513        $bmf->createNewBookmarkTree();
 
  515        $ilAppEventHandler->raise(
 
  518            array(
"user_obj" => $this)
 
  538        } elseif ($this->active) {
 
  542        $update_array = array(
 
  543            "gender" => array(
"text", $this->gender),
 
  544            "title" => array(
"text", $this->utitle),
 
  545            "firstname" => array(
"text", $this->firstname),
 
  546            "lastname" => array(
"text", $this->lastname),
 
  547            "email" => array(
"text", trim($this->email)),
 
  548            "second_email" => array(
"text", trim($this->second_email)),
 
  550            "hobby" => array(
"text", $this->hobby),
 
  551            "institution" => array(
"text", $this->institution),
 
  552            "department" => array(
"text", $this->department),
 
  553            "street" => array(
"text", $this->street),
 
  554            "city" => array(
"text", $this->city),
 
  555            "zipcode" => array(
"text", $this->zipcode),
 
  556            "country" => array(
"text", $this->country),
 
  557            "sel_country" => array(
"text", $this->sel_country),
 
  558            "phone_office" => array(
"text", $this->phone_office),
 
  559            "phone_home" => array(
"text", $this->phone_home),
 
  560            "phone_mobile" => array(
"text", $this->phone_mobile),
 
  561            "fax" => array(
"text", $this->fax),
 
  562            "referral_comment" => array(
"text", $this->referral_comment),
 
  563            "matriculation" => array(
"text", $this->matriculation),
 
  564            "client_ip" => array(
"text", $this->client_ip),
 
  565            "approve_date" => array(
"timestamp", $this->approve_date),
 
  566            "active" => array(
"integer", $this->active),
 
  573            "auth_mode" => array(
"text", $this->
getAuthMode()),
 
  575            "latitude" => array(
"text", $this->latitude),
 
  576            "longitude" => array(
"text", $this->longitude),
 
  577            "loc_zoom" => array(
"integer", (
int) $this->loc_zoom),
 
  578            "last_password_change" => array(
"integer", $this->last_password_change_ts),
 
  579            "last_update" => array(
"timestamp", 
ilUtil::now()),
 
  580            'inactivation_date' => array(
'timestamp', $this->inactivation_date)
 
  583        if (isset($this->agree_date) && (strtotime($this->agree_date) !== 
false || $this->agree_date == 
null)) {
 
  584            $update_array[
"agree_date"] = array(
"timestamp", $this->agree_date);
 
  586        switch ($this->passwd_type) {
 
  588                if (strlen($this->passwd)) {
 
  589                    require_once 
'Services/User/classes/class.ilUserPasswordManager.php';
 
  591                    $update_array[
'passwd'] = array(
'text', $this->
getPasswd());
 
  593                    $update_array[
"passwd"] = array(
"text", (
string) $this->passwd);
 
  598                $update_array[
"passwd"] = array(
"text", (
string) $this->passwd);
 
  602                $ilErr->raiseError(
"<b>Error: passwd_type missing in function update()" . $this->
id . 
"!</b><br />class: " .
 
  603                                   get_class($this) . 
"<br />Script: " . __FILE__ . 
"<br />Line: " . __LINE__, 
$ilErr->FATAL);
 
  607        $update_array[
'passwd_salt']     = array(
'text', $this->
getPasswordSalt());
 
  609        $ilDB->update(
"usr_data", $update_array, array(
"usr_id" => array(
"integer", $this->
id)));
 
  619        parent::updateOwner();
 
  623        $ilAppEventHandler->raise(
 
  626            array(
"user_obj" => $this)
 
  639        $ilDB->manipulateF(
"UPDATE usr_data SET agree_date = " . 
$ilDB->now() .
 
  640             " WHERE usr_id = %s", array(
"integer"), array($this->
getId()));
 
  646    private static function _lookup($a_user_id, $a_field)
 
  651            "SELECT " . $a_field . 
" FROM usr_data WHERE usr_id = %s",
 
  657            return $set[$a_field];
 
  669        $set = 
$ilDB->queryF(
 
  670            "SELECT title, firstname, lastname FROM usr_data WHERE usr_id = %s",
 
  675        if ($rec = 
$ilDB->fetchAssoc($set)) {
 
  679            if ($rec[
"firstname"]) {
 
  682            if ($rec[
"lastname"]) {
 
  737            "SELECT firstname, lastname, title, login FROM usr_data WHERE usr_id = %s",
 
  742        return array(
"user_id" => $a_user_id,
 
  743            "firstname" => $user_rec[
"firstname"],
 
  744            "lastname" => $user_rec[
"lastname"],
 
  745            "title" => $user_rec[
"title"],
 
  746            "login" => $user_rec[
"login"]);
 
  757            "SELECT * FROM usr_data WHERE usr_id = %s",
 
  788        if (!is_array($a_user_str)) {
 
  790                "SELECT usr_id FROM usr_data WHERE login = %s",
 
  795            return $user_rec[
"usr_id"];
 
  798                "SELECT usr_id FROM usr_data " .
 
  799                " WHERE " . 
$ilDB->in(
"login", $a_user_str, 
false, 
"text")
 
  802            while ($rec = 
$ilDB->fetchAssoc($set)) {
 
  803                $ids[] = $rec[
"usr_id"];
 
  828            "UPDATE usr_data SET " .
 
  829             "last_login = " . 
$ilDB->now() .
 
  830             " WHERE usr_id = %s",
 
  844    public function resetPassword($raw, $raw_retype)
 
  851        if (func_num_args() != 2) {
 
  855        if (!isset($raw) || !isset($raw_retype)) {
 
  859        if ($raw != $raw_retype) {
 
  863        require_once 
'Services/User/classes/class.ilUserPasswordManager.php';
 
  868                        SET passwd = %s, passwd_enc_type = %s, passwd_salt = %s 
  870            array(
'text', 
'text', 
'text', 
'integer'),
 
  893                        SELECT * FROM loginname_history 
  899        return $ilDB->fetchAssoc(
$res) ? true : 
false;
 
  918        $ilDB->setLimit(1, 0);
 
  921                        SELECT login, history_date FROM loginname_history 
  922                        WHERE usr_id = %s ORDER BY history_date DESC',
 
  927        if (!is_array(
$row) || !count(
$row)) {
 
  947        if (func_num_args() != 1) {
 
  951        if (!isset($a_login)) {
 
  958        if (0 == strcmp($a_login, $former_login)) {
 
  965            $last_history_entry = 
null;
 
  969        if ((
int) 
$ilSetting->get(
'allow_change_loginname') &&
 
  970           (
int) 
$ilSetting->get(
'reuse_of_loginnames') == 0 &&
 
  971           self::_doesLoginnameExistInHistory($a_login)) {
 
  972            throw new ilUserException($this->lng->txt(
'loginname_already_exists'));
 
  973        } elseif ((
int) 
$ilSetting->get(
'allow_change_loginname') &&
 
  974                (
int) 
$ilSetting->get(
'loginname_change_blocking_time') &&
 
  975                is_array($last_history_entry) &&
 
  976                $last_history_entry[1] + (
int) 
$ilSetting->get(
'loginname_change_blocking_time') > time()) {
 
  977            include_once 
'Services/Calendar/classes/class.ilDate.php';
 
  980                    $this->lng->txt(
'changing_loginname_not_possible_info'),
 
  991            if ((
int) 
$ilSetting->get(
'allow_change_loginname') &&
 
  992               (
int) 
$ilSetting->get(
'create_history_loginname')) {
 
  997            $this->login = $a_login;
 
 1004                array(
'text', 
'integer'),
 
 1021        $this->
setPref($a_keyword, $a_value);
 
 1032        self::_deletePref($this->
getId(), $a_keyword);
 
 1040    public static function _deletePref($a_user_id, $a_keyword)
 
 1048            'DELETE FROM usr_pref WHERE usr_id = %s AND keyword = %s',
 
 1049            array(
'integer', 
'text'),
 
 1050            array($a_user_id, $a_keyword)
 
 1064            "DELETE FROM usr_pref WHERE usr_id = %s",
 
 1076    public static function _writePref($a_usr_id, $a_keyword, $a_value)
 
 1082                "usr_id" => array(
"integer", $a_usr_id),
 
 1083                "keyword" => array(
"text", $a_keyword),
 
 1086                "value" => array(
"text",$a_value)
 
 1111        foreach ($this->prefs as $keyword => $value) {
 
 1127            include_once(
'Services/Calendar/classes/class.ilCalendarSettings.php');
 
 1129            return $settings->getDefaultTimeZone();
 
 1144            include_once(
'Services/Calendar/classes/class.ilCalendarSettings.php');
 
 1146            return $settings->getDefaultTimeFormat();
 
 1161            include_once(
'Services/Calendar/classes/class.ilCalendarSettings.php');
 
 1163            return $settings->getDefaultDateFormat();
 
 1175        if ($a_keyword != 
"") {
 
 1176            $this->prefs[$a_keyword] = $a_value;
 
 1187        if (array_key_exists($a_keyword, $this->prefs)) {
 
 1188            return $this->prefs[$a_keyword];
 
 1198        $query = 
"SELECT * FROM usr_pref WHERE usr_id = " . 
$ilDB->quote($a_usr_id, 
"integer") . 
" " .
 
 1199            "AND keyword = " . 
$ilDB->quote($a_keyword, 
"text");
 
 1216        if (is_array($this->prefs)) {
 
 1228    public function delete()
 
 1233        include_once(
'Services/LDAP/classes/class.ilLDAPRoleGroupMapping.php');
 
 1235        $mapping->deleteUser($this->
getId());
 
 1238        include_once(
"Services/Mail/classes/class.ilMailbox.php");
 
 1241        $mailbox->updateMailsOfDeletedUser($this->
getLogin());
 
 1244        include_once(
"./Services/Block/classes/class.ilCustomBlock.php");
 
 1246        $costum_block->setContextObjId($this->
getId());
 
 1247        $costum_block->setContextObjType(
"user");
 
 1248        $c_blocks = $costum_block->queryBlocksForContext();
 
 1249        include_once(
"./Services/Feeds/classes/class.ilPDExternalFeedBlock.php");
 
 1250        foreach ($c_blocks as $c_block) {
 
 1251            if ($c_block[
"type"] == 
"pdfeed") {
 
 1259        include_once(
"./Services/Block/classes/class.ilBlockSetting.php");
 
 1264            "DELETE FROM usr_data WHERE usr_id = %s",
 
 1266            array($this->
getId())
 
 1277        include_once(
"./Services/Authentication/classes/class.ilSession.php");
 
 1281        $rbacadmin->removeUser($this->
getId());
 
 1285        $q = 
"DELETE FROM bookmark_tree WHERE tree = " .
 
 1287        $ilDB->manipulate($q);
 
 1289        $q = 
"DELETE FROM bookmark_data WHERE user_id = " .
 
 1291        $ilDB->manipulate($q);
 
 1294        include_once 
'./Modules/Forum/classes/class.ilObjForum.php';
 
 1298        include_once 
'./Services/LinkChecker/classes/class.ilLinkCheckNotify.php';
 
 1302        include_once 
'./Modules/Course/classes/class.ilObjCourse.php';
 
 1306        include_once 
'./Services/Tracking/classes/class.ilObjUserTracking.php';
 
 1309        include_once 
'Modules/Session/classes/class.ilEventParticipants.php';
 
 1313        include_once 
'Modules/Scorm2004/classes/ilSCORM13Package.php';
 
 1317        include_once 
'Modules/ScormAicc/classes/class.ilObjSCORMLearningModule.php';
 
 1321        include_once 
"./Services/Notification/classes/class.ilNotification.php";
 
 1325        include_once 
"./Modules/Portfolio/classes/class.ilObjPortfolio.php";
 
 1329        include_once 
"./Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
 
 1331        $tree->cascadingDelete();
 
 1334        include_once 
"./Services/DiskQuota/classes/class.ilDiskQuotaHandler.php";
 
 1338        require_once 
'Services/User/classes/class.ilCronDeleteInactiveUserReminderMail.php';
 
 1342        include_once 
"Services/Badge/classes/class.ilBadgeAssignment.php";
 
 1347        $ilOrgUnitUserAssignmentQueries->deleteAllAssignmentsOfUser($this->
getId());
 
 1359        global $ilAppEventHandler;
 
 1360        $ilAppEventHandler->raise(
 
 1363            array(
'usr_id' => $this->
getId())
 
 1380    public function setFullname($a_title = 
"", $a_firstname = 
"", $a_lastname = 
"")
 
 1382        $this->fullname = 
"";
 
 1386        } elseif ($this->utitle) {
 
 1387            $this->fullname = $this->utitle . 
" ";
 
 1392        } elseif ($this->firstname) {
 
 1393            $this->fullname .= $this->firstname . 
" ";
 
 1419        if (!$a_max_strlen) {
 
 1423        if (strlen($this->fullname) <= $a_max_strlen) {
 
 1427        if ((strlen($this->utitle) + strlen($this->lastname) + 4) <= $a_max_strlen) {
 
 1428            return ilUtil::stripSlashes($this->utitle . 
" " . substr($this->firstname, 0, 1) . 
". " . $this->lastname);
 
 1431        if ((strlen($this->firstname) + strlen($this->lastname) + 1) <= $a_max_strlen) {
 
 1435        if ((strlen($this->lastname) + 3) <= $a_max_strlen) {
 
 1449        $this->login = $a_str;
 
 1468        $this->passwd = $a_str;
 
 1501        $this->gender = substr($a_str, -1);
 
 1522        $this->utitle = $a_str;
 
 1543        $this->firstname = $a_str;
 
 1562        $this->lastname = $a_str;
 
 1581        $this->institution = $a_str;
 
 1600        $this->department = $a_str;
 
 1619        $this->street = $a_str;
 
 1638        $this->city = $a_str;
 
 1657        $this->zipcode = $a_str;
 
 1677        $this->country = $a_str;
 
 1697        $this->sel_country = $a_val;
 
 1717        $this->phone_office = $a_str;
 
 1736        $this->phone_home = $a_str;
 
 1755        $this->phone_mobile = $a_str;
 
 1774        $this->fax = $a_str;
 
 1793        $this->client_ip = $a_str;
 
 1812        $this->matriculation = $a_str;
 
 1834        $query = 
"SELECT matriculation FROM usr_data " .
 
 1835            "WHERE usr_id = " . 
$ilDB->quote($a_usr_id);
 
 1838        return $row->matriculation ? 
$row->matriculation : 
'';
 
 1848        $this->email = $a_str;
 
 1883        $this->hobby = $a_str;
 
 1902        $this->
setPref(
"language", $a_str);
 
 1913        return $this->prefs[
"language"];
 
 1926        $this->
setPref(
"disk_quota", $a_disk_quota);
 
 1940        return $this->prefs[
"disk_quota"] ? $this->prefs[
"disk_quota"] : 0;
 
 1945        return $this->prefs[
"wsp_disk_quota"] ? $this->prefs[
"wsp_disk_quota"] : 0;
 
 1950        $this->last_password_change_ts = $a_last_password_change_ts;
 
 1966        $q = 
"SELECT value FROM usr_pref WHERE usr_id= " .
 
 1967            $ilDB->quote($a_usr_id, 
"integer") . 
" AND keyword = " .
 
 1968            $ilDB->quote(
'language', 
"text");
 
 1972            return $row[
'value'];
 
 1974        if (is_object(
$lng)) {
 
 1975            return $lng->getDefaultLanguage();
 
 1985            "UPDATE usr_data " .
 
 1986            " SET ext_account = %s WHERE usr_id = %s",
 
 1987            array(
"text", 
"integer"),
 
 1988            array($a_ext_id, $a_usr_id)
 
 1997            "UPDATE usr_data " .
 
 1998            " SET auth_mode = %s WHERE usr_id = %s",
 
 1999            array(
"text", 
"integer"),
 
 2000            array($a_auth_mode, $a_usr_id)
 
 2030        $this->last_login = $a_str;
 
 2040        return $this->last_login;
 
 2050        $this->last_update = $a_str;
 
 2064        $this->referral_comment = $a_str;
 
 2084        $this->approve_date = $a_str;
 
 2115        $this->agree_date = $a_str;
 
 2155        $query = 
'SELECT usr_id FROM usr_data ' .
 
 2156            'WHERE active = ' . 
$ilDB->quote(1, 
'integer') . 
' ' .
 
 2157            'AND usr_id = ' . 
$ilDB->quote($a_usr_id, 
'integer');
 
 2180        if ($this->active) {
 
 2184        if ((!empty($storedActive) && empty($currentActive)) ||
 
 2185                (empty($storedActive) && !empty($currentActive))) {
 
 2199        return $active ? true : 
false;
 
 2210        $this->skin = $a_str;
 
 2215        $this->time_limit_owner = $a_owner;
 
 2219        return $this->time_limit_owner ? $this->time_limit_owner : 7;
 
 2223        $this->time_limit_from = $a_from;
 
 2227        return $this->time_limit_from;
 
 2231        $this->time_limit_until = $a_until;
 
 2235        return $this->time_limit_until;
 
 2239        $this->time_limit_unlimited = $a_unlimited;
 
 2243        return $this->time_limit_unlimited;
 
 2247        return $this->time_limit_message = $a_time_limit_message;
 
 2251        return $this->time_limit_message;
 
 2256        $this->login_attempts = $a_login_attempts;
 
 2277        $this->profile_incomplete = (boolean) $a_prof_inc;
 
 2281        if ($this->
id == ANONYMOUS_USER_ID) {
 
 2284        return $this->profile_incomplete;
 
 2292        if ($this->
id == ANONYMOUS_USER_ID) {
 
 2296        if ($this->
id == SYSTEM_USER_ID) {
 
 2297            require_once 
'./Services/User/classes/class.ilUserPasswordManager.php';
 
 2308        require_once(
'./Services/PrivacySecurity/classes/class.ilSecuritySettings.php');
 
 2313            $security->isPasswordChangeOnFirstLoginEnabled() &&
 
 2314            $this->getLastPasswordChangeTS() == 0 &&
 
 2315            $this->is_self_registered == 
false 
 2325        if ($this->
id == ANONYMOUS_USER_ID) {
 
 2329        require_once(
'./Services/PrivacySecurity/classes/class.ilSecuritySettings.php');
 
 2332            $max_pass_age = $security->getPasswordMaxAge();
 
 2333            if ($max_pass_age > 0) {
 
 2334                $max_pass_age_ts = ($max_pass_age * 86400);
 
 2336                $current_ts      = time();
 
 2338                if (($current_ts - $pass_change_ts) > $max_pass_age_ts) {
 
 2351        $current_ts = time();
 
 2353        $password_age = (int) (($current_ts - $pass_change_ts) / 86400);
 
 2354        return $password_age;
 
 2363        $query = 
"UPDATE usr_data SET last_password_change = %s " .
 
 2364                "WHERE usr_id = %s";
 
 2365        $affected = 
$ilDB->manipulateF(
 
 2367            array(
'integer',
'integer'),
 
 2381        $query = 
"UPDATE usr_data SET last_password_change = 0 " .
 
 2382                "WHERE usr_id = %s";
 
 2383        $affected = 
$ilDB->manipulateF(
 
 2386            array($this->
getId())
 
 2402        $this->latitude = $a_latitude;
 
 2422        $this->longitude = $a_longitude;
 
 2442        $this->loc_zoom = $a_locationzoom;
 
 2465        $set = 
$ilDB->queryf(
 
 2467                        SELECT COUNT(*) session_count 
 2468                        FROM usr_session WHERE user_id = %s AND expires > %s AND session_id != %s ',
 
 2469            array(
'integer', 
'integer', 
'text'),
 
 2470            array($a_user_id, time(), $a_session_id)
 
 2473        return (
bool) 
$row[
'session_count'];
 
 2499        $uid = 
$GLOBALS[
'DIC'][
'ilAuthSession']->getUserId();
 
 2503        require_once(
'Services/WebDAV/classes/class.ilDAVActivationChecker.php');
 
 2520        $pos = strrpos($a_login, 
'/');
 
 2521        $pos2 = strrpos($a_login, 
'\\');
 
 2522        if ($pos === 
false || $pos < $pos2) {
 
 2525        if ($pos !== 
false) {
 
 2526            $a_login = substr($a_login, $pos + 1);
 
 2538        global 
$ilDB,$ilAuth;
 
 2541        $set = 
$ilDB->queryF(
 
 2542            "SELECT active FROM usr_data WHERE login= %s",
 
 2547        if ($rec = 
$ilDB->fetchAssoc($set)) {
 
 2548            if ($rec[
"active"]) {
 
 2582            "SELECT login FROM usr_data " .
 
 2583            "WHERE email = %s and active = 1",
 
 2589            $ids[] = 
$row->login;
 
 2609        $res = 
$ilDB->queryF(
"SELECT usr_id FROM usr_data " .
 
 2610            "WHERE email = %s", array(
"text"), array($a_email));
 
 2613        return $row->usr_id ? 
$row->usr_id : 0;
 
 2640    public static function searchUsers($a_search_str, 
$active = 1, $a_return_ids_only = 
false, $filter_settings = 
false)
 
 2645        $query = 
"SELECT usr_data.usr_id, usr_data.login, usr_data.firstname, usr_data.lastname, usr_data.email, usr_data.active FROM usr_data ";
 
 2647        $without_anonymous_users = 
true;
 
 2650        $join_filter = 
" WHERE ";
 
 2651        if ($filter_settings !== 
false && strlen($filter_settings)) {
 
 2652            switch ($filter_settings) {
 
 2655                    $join_filter = 
" LEFT JOIN obj_members ON usr_data.usr_id = obj_members.usr_id WHERE obj_members.usr_id IS NULL AND ";
 
 2661                        $join_filter = 
" LEFT JOIN obj_members ON usr_data.usr_id = obj_members.usr_id WHERE obj_members.obj_id = " .
 
 2662                            "(SELECT obj_id FROM object_reference WHERE ref_id = " . 
$ilDB->quote(
$ref_id, 
"integer") . 
") AND ";
 
 2670                        if (is_array($local_roles) && count($local_roles)) {
 
 2671                            $join_filter = 
" LEFT JOIN rbac_ua ON usr_data.usr_id = rbac_ua.usr_id WHERE " .
 
 2672                                $ilDB->in(
"rbac_ua.rol_id", $local_roles, 
false, $local_roles) . 
" AND ";
 
 2678                    $rol_id = 
$_SESSION[
"user_filter_data"];
 
 2680                        $join_filter = 
" LEFT JOIN rbac_ua ON usr_data.usr_id = rbac_ua.usr_id WHERE rbac_ua.rol_id = " .
 
 2681                            $ilDB->quote($rol_id, 
"integer") . 
" AND ";
 
 2682                        $without_anonymous_users = 
false;
 
 2689        if (strtolower(substr($a_search_str, 0, 5)) == 
"role:") {
 
 2690            $query = 
"SELECT DISTINCT usr_data.usr_id,usr_data.login,usr_data.firstname,usr_data.lastname,usr_data.email " .
 
 2691                "FROM object_data,rbac_ua,usr_data " .
 
 2692                "WHERE " . 
$ilDB->like(
"object_data.title", 
"text", 
"%" . substr($a_search_str, 5) . 
"%") .
 
 2693                " AND object_data.type = 'role' " .
 
 2694                "AND rbac_ua.rol_id = object_data.obj_id " .
 
 2695                "AND usr_data.usr_id = rbac_ua.usr_id " .
 
 2696                "AND rbac_ua.usr_id != " . 
$ilDB->quote(ANONYMOUS_USER_ID, 
"integer");
 
 2699                "(" . 
$ilDB->like(
"usr_data.login", 
"text", 
"%" . $a_search_str . 
"%") . 
" " .
 
 2700                "OR " . 
$ilDB->like(
"usr_data.firstname", 
"text", 
"%" . $a_search_str . 
"%") . 
" " .
 
 2701                "OR " . 
$ilDB->like(
"usr_data.lastname", 
"text", 
"%" . $a_search_str . 
"%") . 
" " .
 
 2702                "OR " . 
$ilDB->like(
"usr_data.email", 
"text", 
"%" . $a_search_str . 
"%") . 
") ";
 
 2704            if ($filter_settings !== 
false && strlen($filter_settings)) {
 
 2705                switch ($filter_settings) {
 
 2707                        $query.= 
" AND usr_data.active = " . 
$ilDB->quote(0, 
"integer") . 
" ";
 
 2710                        $query.= 
" AND usr_data.active = " . 
$ilDB->quote(1, 
"integer") . 
" ";
 
 2713                        $query.= 
" AND usr_data.time_limit_unlimited = " . 
$ilDB->quote(0, 
"integer") . 
" ";
 
 2716                        $date = strftime(
"%Y-%m-%d %H:%I:%S", mktime(0, 0, 0, 
$_SESSION[
"user_filter_data"][
"m"], 
$_SESSION[
"user_filter_data"][
"d"], 
$_SESSION[
"user_filter_data"][
"y"]));
 
 2717                        $query.= 
" AND last_login < " . 
$ilDB->quote($date, 
"timestamp") . 
" ";
 
 2722            if ($without_anonymous_users) {
 
 2723                $query.= 
"AND usr_data.usr_id != " . 
$ilDB->quote(ANONYMOUS_USER_ID, 
"integer");
 
 2726            if (is_numeric(
$active) && 
$active > -1 && $filter_settings === 
false) {
 
 2734                "usr_id"    => 
$row->usr_id,
 
 2735                "login"     => 
$row->login,
 
 2736                "firstname" => 
$row->firstname,
 
 2737                "lastname"  => 
$row->lastname,
 
 2738                "email"     => 
$row->email,
 
 2739                "active"    => 
$row->active);
 
 2740            $ids[] = 
$row->usr_id;
 
 2742        if ($a_return_ids_only) {
 
 2743            return $ids ? $ids : array();
 
 2752    public static function getAllUserLogins()
 
 2762            "SELECT login FROM usr_data WHERE " . 
$ilDB->in(
'usr_id', array(ANONYMOUS_USER_ID), 
true, 
'integer')
 
 2765            $logins[] = 
$row[
'login'];
 
 2782        $res = 
$ilDB->query(
"SELECT * FROM usr_data WHERE " .
 
 2783            $ilDB->in(
"usr_id", $a_user_ids, 
false, 
"integer"));
 
 2785            $user_data[
"$row[usr_id]"] = 
$row;
 
 2787        return $user_data ? $user_data : array();
 
 2802        $result_arr = array();
 
 2806        if ($a_fields !== 
null and is_array($a_fields)) {
 
 2807            if (count($a_fields) == 0) {
 
 2810                if (($usr_id_field = array_search(
"usr_id", $a_fields)) !== 
false) {
 
 2811                    unset($a_fields[$usr_id_field]);
 
 2814                $select = implode(
",", $a_fields) . 
",usr_data.usr_id";
 
 2816                if (in_array(
'online_time', $a_fields)) {
 
 2817                    $select .= 
",ut_online.online_time ";
 
 2821            $q = 
"SELECT " . $select . 
" FROM usr_data ";
 
 2825            if (in_array(
'online_time', $a_fields)) {
 
 2826                $q .= 
"LEFT JOIN ut_online ON usr_data.usr_id = ut_online.usr_id ";
 
 2832                    $q .= 
"WHERE active = " . 
$ilDB->quote(
$active, 
"integer");
 
 2835                    $q .= 
"WHERE time_limit_unlimited= " . 
$ilDB->quote(0, 
"integer");;
 
 2838                    $qtemp = $q . 
", rbac_ua, object_data WHERE rbac_ua.rol_id = object_data.obj_id AND " .
 
 2839                        $ilDB->like(
"object_data.title", 
"text", 
"%crs%") . 
" AND usr_data.usr_id = rbac_ua.usr_id";
 
 2841                    $course_users = array();
 
 2843                        array_push($course_users, 
$row[
"usr_id"]);
 
 2845                    if (count($course_users)) {
 
 2846                        $q .= 
" WHERE " . 
$ilDB->in(
"usr_data.usr_id", $course_users, 
true, 
"integer") . 
" ";
 
 2852                    $date = strftime(
"%Y-%m-%d %H:%I:%S", mktime(0, 0, 0, 
$_SESSION[
"user_filter_data"][
"m"], 
$_SESSION[
"user_filter_data"][
"d"], 
$_SESSION[
"user_filter_data"][
"y"]));
 
 2853                    $q.= 
" AND last_login < " . 
$ilDB->quote($date, 
"timestamp");
 
 2858                        $q .= 
" LEFT JOIN obj_members ON usr_data.usr_id = obj_members.usr_id " .
 
 2859                            "WHERE obj_members.obj_id = (SELECT obj_id FROM object_reference " .
 
 2860                            "WHERE ref_id = " . 
$ilDB->quote(
$ref_id, 
"integer") . 
") ";
 
 2868                        if (is_array($local_roles) && count($local_roles)) {
 
 2869                            $q.= 
" LEFT JOIN rbac_ua ON usr_data.usr_id = rbac_ua.usr_id WHERE " .
 
 2870                                $ilDB->in(
"rbac_ua.rol_id", $local_roles, 
false, 
"integer") . 
" ";
 
 2875                    $rol_id = 
$_SESSION[
"user_filter_data"];
 
 2877                        $q .= 
" LEFT JOIN rbac_ua ON usr_data.usr_id = rbac_ua.usr_id WHERE rbac_ua.rol_id = " .
 
 2878                            $ilDB->quote($rol_id, 
"integer");
 
 2885                $result_arr[] = 
$row;
 
 2899        $q = 
"SELECT count(*) as cnt FROM usr_pref up1, usr_pref up2 " .
 
 2900            " WHERE up1.keyword= " . 
$ilDB->quote(
"style", 
"text") .
 
 2901            " AND up1.value= " . 
$ilDB->quote($a_style, 
"text") .
 
 2902            " AND up2.keyword= " . 
$ilDB->quote(
"skin", 
"text") .
 
 2903            " AND up2.value= " . 
$ilDB->quote($a_skin, 
"text") .
 
 2904            " AND up1.usr_id = up2.usr_id ";
 
 2906        $cnt_set = 
$ilDB->query($q);
 
 2908        $cnt_rec = 
$ilDB->fetchAssoc($cnt_set);
 
 2910        return $cnt_rec[
"cnt"];
 
 2920        $q = 
"SELECT DISTINCT up1.value style, up2.value skin FROM usr_pref up1, usr_pref up2 " .
 
 2921            " WHERE up1.keyword = " . 
$ilDB->quote(
"style", 
"text") .
 
 2922            " AND up2.keyword = " . 
$ilDB->quote(
"skin", 
"text") .
 
 2923            " AND up1.usr_id = up2.usr_id";
 
 2925        $sty_set = 
$ilDB->query($q);
 
 2928        while ($sty_rec = 
$ilDB->fetchAssoc($sty_set)) {
 
 2929            $styles[] = $sty_rec[
"skin"] . 
":" . $sty_rec[
"style"];
 
 2942        $q = 
"SELECT up1.usr_id usr_id FROM usr_pref up1, usr_pref up2 " .
 
 2943            " WHERE up1.keyword= " . 
$ilDB->quote(
"style", 
"text") .
 
 2944            " AND up1.value= " . 
$ilDB->quote($a_from_style, 
"text") .
 
 2945            " AND up2.keyword= " . 
$ilDB->quote(
"skin", 
"text") .
 
 2946            " AND up2.value= " . 
$ilDB->quote($a_from_skin, 
"text") .
 
 2947            " AND up1.usr_id = up2.usr_id ";
 
 2949        $usr_set = 
$ilDB->query($q);
 
 2951        while ($usr_rec = 
$ilDB->fetchAssoc($usr_set)) {
 
 2971        $item_set = 
$ilDB->queryF(
 
 2972            "SELECT * FROM desktop_item WHERE " .
 
 2973            "item_id = %s AND type = %s AND user_id = %s",
 
 2974            array(
"integer", 
"text", 
"integer"),
 
 2975            array($a_item_id, 
$a_type, $a_usr_id)
 
 2979        if (!
$ilDB->fetchAssoc($item_set)) {
 
 2981                "INSERT INTO desktop_item (item_id, type, user_id, parameters) VALUES " .
 
 2983                array(
"integer", 
"text", 
"integer", 
"text"),
 
 2984                array($a_item_id,
$a_type,$a_usr_id,$a_par)
 
 2988        include_once 
'./Services/Calendar/classes/class.ilCalendarCategories.php';
 
 3017            "UPDATE desktop_item SET parameters = %s " .
 
 3018            " WHERE item_id = %s AND type = %s AND user_id = %s",
 
 3019            array(
"text", 
"integer", 
"text", 
"integer"),
 
 3039            "DELETE FROM desktop_item WHERE " .
 
 3040            " item_id = %s AND type = %s  AND user_id = %s",
 
 3041            array(
"integer", 
"text", 
"integer"),
 
 3042            array($a_item_id, 
$a_type, $a_usr_id)
 
 3045        include_once 
'./Services/Calendar/classes/class.ilCalendarCategories.php';
 
 3072            "SELECT user_id FROM desktop_item WHERE item_id = %s",
 
 3085                "DELETE FROM desktop_item WHERE item_id = %s",
 
 3107        if (self::$is_desktop_item_loaded[$a_usr_id . 
":" . $a_item_id]) {
 
 3108            return self::$is_desktop_item_cache[$a_usr_id . 
":" . $a_item_id . 
":" . 
$a_type];
 
 3110        $item_set = 
$ilDB->queryF(
 
 3111            "SELECT item_id FROM desktop_item WHERE " .
 
 3112            "item_id = %s AND type = %s AND user_id = %s",
 
 3113            array(
"integer", 
"text", 
"integer"),
 
 3114            array($a_item_id, 
$a_type, $a_usr_id)
 
 3117        if (
$ilDB->fetchAssoc($item_set)) {
 
 3134        if (!is_array($a_item_ids)) {
 
 3138        $item_ids = array();
 
 3139        foreach ($a_item_ids as 
$id) {
 
 3140            if (!self::$is_desktop_item_loaded[$a_usr_id . 
":" . 
$id]) {
 
 3143            self::$is_desktop_item_loaded[$a_usr_id . 
":" . 
$id] = 
true;
 
 3146        if (count($item_ids) > 0) {
 
 3147            $item_set = 
$ilDB->query(
"SELECT item_id, type FROM desktop_item WHERE " .
 
 3148                $ilDB->in(
"item_id", $item_ids, 
false, 
"integer") .
 
 3149                " AND user_id = " . 
$ilDB->quote($a_usr_id, 
"integer"));
 
 3150            while (
$r = 
$ilDB->fetchAssoc($item_set)) {
 
 3151                self::$is_desktop_item_cache[$a_usr_id . 
":" . 
$r[
"item_id"] . 
":" . 
$r[
"type"]]
 
 3184        if ($a_types == 
"") {
 
 3187            $item_set = 
$ilDB->queryF(
"SELECT obj.obj_id, obj.description, oref.ref_id, obj.title, obj.type " .
 
 3188                " FROM desktop_item it, object_reference oref " .
 
 3189                    ", object_data obj" .
 
 3191                "it.item_id = oref.ref_id AND " .
 
 3192                "oref.obj_id = obj.obj_id AND " .
 
 3193                "it.user_id = %s", array(
"integer"), array($user_id));
 
 3194            $items = $all_parent_path = array();
 
 3195            while ($item_rec = 
$ilDB->fetchAssoc($item_set)) {
 
 3196                if (
$tree->isInTree($item_rec[
"ref_id"])
 
 3197                    && $item_rec[
"type"] != 
"rolf" 
 3198                    && $item_rec[
"type"] != 
"itgr") {   
 
 3199                    $parent_ref = 
$tree->getParentId($item_rec[
"ref_id"]);
 
 3201                    if (!isset($all_parent_path[$parent_ref])) {
 
 3210                            if ($parent_ref > 0) {      
 
 3211                                $node = 
$tree->getNodeData($parent_ref);
 
 3212                                $all_parent_path[$parent_ref] = $node[
"title"];
 
 3214                                $all_parent_path[$parent_ref] = 
"";
 
 3219                    $parent_path = $all_parent_path[$parent_ref];
 
 3223                    $items[$parent_path . 
$title . $item_rec[
"ref_id"]] =
 
 3224                        array(
"ref_id" => $item_rec[
"ref_id"],
 
 3225                            "obj_id" => $item_rec[
"obj_id"],
 
 3226                            "type" => $item_rec[
"type"],
 
 3228                            "description" => 
$desc,
 
 3229                            "parent_ref" => $parent_ref);
 
 3235            if (!is_array($a_types)) {
 
 3236                $a_types = array($a_types);
 
 3239            $foundsurveys = array();
 
 3240            foreach ($a_types as 
$a_type) {
 
 3244                $item_set = 
$ilDB->queryF(
 
 3245                    "SELECT obj.obj_id, obj.description, oref.ref_id, obj.title FROM desktop_item it, object_reference oref " .
 
 3246                    ", object_data obj WHERE " .
 
 3247                    "it.item_id = oref.ref_id AND " .
 
 3248                    "oref.obj_id = obj.obj_id AND " .
 
 3249                    "it.type = %s AND " .
 
 3250                    "it.user_id = %s " .
 
 3252                    array(
"text", 
"integer"),
 
 3256                while ($item_rec = 
$ilDB->fetchAssoc($item_set)) {
 
 3260                        array(
"ref_id" => $item_rec[
"ref_id"],
 
 3261                        "obj_id" => $item_rec[
"obj_id"], 
"type" => 
$a_type,
 
 3295            $a_time = 
date(
"Y-m-d H:i:s", time());
 
 3298        $item_set = 
$ilDB->queryF(
 
 3299            "SELECT * FROM personal_clipboard WHERE " .
 
 3300            "parent = %s AND item_id = %s AND type = %s AND user_id = %s",
 
 3301            array(
"integer", 
"integer", 
"text", 
"integer"),
 
 3306        if (!
$d = $item_set->fetchRow()) {
 
 3308                "INSERT INTO personal_clipboard " .
 
 3309                "(item_id, type, user_id, title, parent, insert_time, order_nr) VALUES " .
 
 3310                " (%s,%s,%s,%s,%s,%s,%s)",
 
 3311                array(
"integer", 
"text", 
"integer", 
"text", 
"integer", 
"timestamp", 
"integer"),
 
 3312                array($a_item_id, 
$a_type, $this->
getId(), $a_title, (
int) $a_parent, $a_time, (
int) $a_order_nr)
 
 3316                "UPDATE personal_clipboard SET insert_time = %s " .
 
 3317                "WHERE user_id = %s AND item_id = %s AND type = %s AND parent = 0",
 
 3318                array(
"timestamp", 
"integer", 
"integer", 
"text"),
 
 3331            $a_time = 
date(
"Y-m-d H:i:s", time());
 
 3333        $ilDB->insert(
"personal_pc_clipboard", array(
 
 3334            "user_id" => array(
"integer", $this->
getId()),
 
 3336            "insert_time" => array(
"timestamp", $a_time),
 
 3337            "order_nr" => array(
"integer", $a_nr)
 
 3348        $set = 
$ilDB->queryF(
"SELECT MAX(insert_time) mtime FROM personal_pc_clipboard " .
 
 3349            " WHERE user_id = %s", array(
"integer"), array($this->
getId()));
 
 3350        $row = $ilDB->fetchAssoc($set);
 
 3352        $set = 
$ilDB->queryF(
 
 3353            "SELECT * FROM personal_pc_clipboard " .
 
 3354            " WHERE user_id = %s AND insert_time = %s ORDER BY order_nr ASC",
 
 3355            array(
"integer", 
"timestamp"),
 
 3359        while (
$row = 
$ilDB->fetchAssoc($set)) {
 
 3360            $content[] = 
$row[
"content"];
 
 3373        $set = 
$ilDB->queryF(
 
 3374            "SELECT * FROM personal_clipboard WHERE " .
 
 3375            "parent = %s AND type = %s AND user_id = %s",
 
 3376            array(
"integer", 
"text", 
"integer"),
 
 3379        if ($rec = 
$ilDB->fetchAssoc($set)) {
 
 3394            "DELETE FROM personal_clipboard WHERE " .
 
 3395            "type = %s AND user_id = %s",
 
 3396            array(
"text", 
"integer"),
 
 3408        $ilDB->manipulateF(
"DELETE FROM personal_clipboard WHERE " .
 
 3409            "user_id = %s", array(
"integer"), array($this->
getId()));
 
 3420        if ($a_top_nodes_only) {
 
 3421            $par = 
" AND parent = " . 
$ilDB->quote(0, 
"integer") . 
" ";
 
 3427        $q = 
"SELECT * FROM personal_clipboard WHERE " .
 
 3428            "user_id = " . 
$ilDB->quote($this->
getId(), 
"integer") . 
" " .
 
 3430            " ORDER BY order_nr";
 
 3431        $objs = 
$ilDB->query($q);
 
 3433        while ($obj = 
$ilDB->fetchAssoc($objs)) {
 
 3434            if ($obj[
"type"] == 
"mob") {
 
 3437            if ($obj[
"type"] == 
"incl") {
 
 3438                include_once(
"./Modules/MediaPool/classes/class.ilMediaPoolPage.php");
 
 3441            $objects[] = array(
"id" => $obj[
"item_id"],
 
 3442                "type" => $obj[
"type"], 
"title" => $obj[
"title"],
 
 3443                "insert_time" => $obj[
"insert_time"]);
 
 3455        $objs = 
$ilDB->queryF(
 
 3456            "SELECT * FROM personal_clipboard WHERE " .
 
 3457            "user_id = %s AND parent = %s AND insert_time = %s " .
 
 3458            " ORDER BY order_nr",
 
 3459            array(
"integer", 
"integer", 
"timestamp"),
 
 3460            array(
$ilUser->getId(), (
int) $a_parent, $a_insert_time)
 
 3463        while ($obj = 
$ilDB->fetchAssoc($objs)) {
 
 3464            if ($obj[
"type"] == 
"mob") {
 
 3467            $objects[] = array(
"id" => $obj[
"item_id"],
 
 3468                "type" => $obj[
"type"], 
"title" => $obj[
"title"], 
"insert_time" => $obj[
"insert_time"]);
 
 3485        $q = 
"SELECT DISTINCT user_id FROM personal_clipboard WHERE " .
 
 3486            "item_id = " . 
$ilDB->quote($a_id, 
"integer") . 
" AND " .
 
 3488        $user_set = 
$ilDB->query($q);
 
 3490        while ($user_rec = 
$ilDB->fetchAssoc($user_set)) {
 
 3491            $users[] = $user_rec[
"user_id"];
 
 3508        $q = 
"DELETE FROM personal_clipboard WHERE " .
 
 3509            "item_id = " . 
$ilDB->quote($a_item_id, 
"integer") .
 
 3511            " AND user_id = " . 
$ilDB->quote($this->
getId(), 
"integer");
 
 3512        $ilDB->manipulate($q);
 
 3519        $query = 
"SELECT obj_id FROM object_data WHERE import_id = " .
 
 3520            $ilDB->quote($i2_id, 
"text");
 
 3536        require_once(
'./Modules/OrgUnit/classes/PathStorage/class.ilOrgUnitPathStorage.php');
 
 3537        return ilOrgUnitPathStorage::getTextRepresentationOfUsersOrgUnits($a_usr_id);
 
 3556        $this->auth_mode = $a_str;
 
 3569        include_once(
'./Services/Authentication/classes/class.ilAuthUtils.php');
 
 3582        $this->ext_account = $a_str;
 
 3594        return $this->ext_account;
 
 3612        include_once(
'./Services/Authentication/classes/class.ilAuthUtils.php');
 
 3613        $q = 
"SELECT login,usr_id,ext_account,auth_mode FROM usr_data " .
 
 3614            "WHERE auth_mode = %s";
 
 3616        $values[] = $a_auth_mode;
 
 3618            $q.= 
" OR auth_mode = %s ";
 
 3620            $values[] = 
'default';
 
 3623        $res = 
$ilDB->queryF($q, $types, $values);
 
 3625            if (
$row->auth_mode == 
'default') {
 
 3626                $accounts[
$row->usr_id] = 
$row->login;
 
 3628                $accounts[
$row->usr_id] = 
$row->ext_account;
 
 3631        return $accounts ? $accounts : array();
 
 3645        if (!is_array($a_usr_ids)) {
 
 3651            $q = 
"UPDATE usr_data SET active = 1, inactivation_date = NULL WHERE " .
 
 3652                $ilDB->in(
"usr_id", $a_usr_ids, 
false, 
"integer");
 
 3653            $ilDB->manipulate($q);
 
 3655            $usrId_IN_usrIds = 
$ilDB->in(
"usr_id", $a_usr_ids, 
false, 
"integer");
 
 3657            $q = 
"UPDATE usr_data SET active = 0 WHERE $usrId_IN_usrIds";
 
 3658            $ilDB->manipulate($q);
 
 3662                                SET inactivation_date = %s 
 3663                                WHERE inactivation_date IS NULL 
 3664                                AND $usrId_IN_usrIds 
 3666            $ilDB->manipulateF($queryString, array(
'timestamp'), array(
ilUtil::now()));
 
 3695        $settings = 
$GLOBALS[
'DIC']->settings();
 
 3699            "SELECT * FROM usr_data WHERE " .
 
 3700            " ext_account = %s AND auth_mode = %s",
 
 3701            array(
"text", 
"text"),
 
 3702            array($a_account, $a_auth)
 
 3704        if ($usr = 
$db->fetchAssoc(
$r)) {
 
 3705            return $usr[
"login"];
 
 3708        if (!$tryFallback) {
 
 3714            "SELECT login FROM usr_data " .
 
 3715            "WHERE login = %s AND auth_mode = %s AND (ext_account IS NULL OR ext_account = '') ",
 
 3716            array(
"text", 
"text"),
 
 3717            array($a_account, $a_auth)
 
 3719        if ($usr = 
$db->fetchAssoc(
$res)) {
 
 3720            return $usr[
'login'];
 
 3726                "SELECT login FROM usr_data WHERE " .
 
 3727                " ext_account = %s AND auth_mode = %s",
 
 3728                array(
"text", 
"text"),
 
 3729                array($a_account, 
"default")
 
 3731            if ($usr = 
$db->fetchAssoc(
$res)) {
 
 3732                return $usr[
"login"];
 
 3736                "SELECT login FROM usr_data " .
 
 3737                "WHERE login = %s AND (ext_account IS NULL OR ext_account = '') AND auth_mode = %s",
 
 3738                array(
"text", 
"text"),
 
 3739                array($a_account, 
"default")
 
 3741            if ($usr = 
$db->fetchAssoc(
$res)) {
 
 3742                return $usr[
"login"];
 
 3755        $r = 
$ilDB->query(
"SELECT count(*) AS cnt, auth_mode FROM usr_data " .
 
 3756            "GROUP BY auth_mode");
 
 3758        while ($cnt = 
$ilDB->fetchAssoc(
$r)) {
 
 3759            $cnt_arr[$cnt[
"auth_mode"]] = $cnt[
"cnt"];
 
 3776        $q = 
"SELECT * FROM usr_data WHERE " .
 
 3777            " email = %s AND (auth_mode = %s ";
 
 3778        $types = array(
"text", 
"text");
 
 3779        $values = array($a_email, 
"local");
 
 3782            $q.=
" OR auth_mode = %s";
 
 3784            $values[] = 
"default";
 
 3790        $usr_set = 
$ilDB->queryF($q, $types, $values);
 
 3791        while ($usr_rec = 
$ilDB->fetchAssoc($usr_set)) {
 
 3792            $users[$usr_rec[
"usr_id"]] = $usr_rec[
"login"];
 
 3809        $image_dir = $webspace_dir . 
"/usr_images";
 
 3810        $store_file = 
"usr_" . $obj_id . 
"." . 
"jpg";
 
 3811        $target_file = $image_dir . 
"/$store_file";
 
 3813        chmod($tmp_file, 0770);
 
 3817        $show_file  = 
"$image_dir/usr_" . $obj_id . 
".jpg";
 
 3818        $thumb_file = 
"$image_dir/usr_" . $obj_id . 
"_small.jpg";
 
 3819        $xthumb_file = 
"$image_dir/usr_" . $obj_id . 
"_xsmall.jpg";
 
 3820        $xxthumb_file = 
"$image_dir/usr_" . $obj_id . 
"_xxsmall.jpg";
 
 3823        ilUtil::execConvert($tmp_file . 
"[0] -geometry 100x100 -quality 100 JPEG:" . $thumb_file);
 
 3825        ilUtil::execConvert($tmp_file . 
"[0] -geometry 30x30 -quality 100 JPEG:" . $xxthumb_file);
 
 3844        if (isset(self::$personal_image_cache[$this->
getId()][$a_size][(
int) $a_force_pic])) {
 
 3845            return self::$personal_image_cache[$this->
getId()][$a_size][(int) $a_force_pic];
 
 3848        self::$personal_image_cache[$this->
getId()][$a_size][(int) $a_force_pic] = ilObjUser::_getPersonalPicturePath($this->
getId(), $a_size, $a_force_pic);
 
 3850        return self::$personal_image_cache[$this->
getId()][$a_size][(int) $a_force_pic];
 
 3862    public static function _getPersonalPicturePath(
 
 3865        $a_force_pic = 
false,
 
 3866        $a_prevent_no_photo_image = 
false 
 3871        $upload = $profile              = 
false;
 
 3873        $in  = 
$DIC->database()->in(
'usr_pref.keyword', array(
'public_upload', 
'public_profile'), 
false, 
'text');
 
 3876                        SELECT usr_pref.*, ud.login, ud.firstname, ud.lastname 
 3877                        FROM usr_data ud LEFT JOIN usr_pref ON usr_pref.usr_id = ud.usr_id AND $in 
 3878                        WHERE ud.usr_id = %s",
 
 3887            switch (
$row[
'keyword']) {
 
 3888                case 'public_upload':
 
 3889                    $upload = 
$row[
'value'] == 
'y';
 
 3891                case 'public_profile':
 
 3892                    $profile = (
$row[
'value'] == 
'y' ||
 
 3893                        $row[
'value'] == 
'g');
 
 3900        if (
defined(
'ILIAS_MODULE')) {
 
 3901            $webspace_dir = (
'.' . $webspace_dir);
 
 3905        $image_dir = $webspace_dir . 
"/usr_images";
 
 3907        if ($a_size == 
'big') {
 
 3908            $thumb_file = $image_dir . 
"/usr_" . $a_usr_id . 
".jpg";
 
 3910            $thumb_file = $image_dir . 
"/usr_" . $a_usr_id . 
"_" . $a_size . 
".jpg";
 
 3914        $random = new \ilRandom();
 
 3915        if ((($upload && $profile) || $a_force_pic)
 
 3916            && @is_file($thumb_file)) {
 
 3917            $file = $thumb_file . 
"?t=" . $random->int(1, 99999);
 
 3919            if (!$a_prevent_no_photo_image) {
 
 3921                if ($a_size == 
"small" || $a_size == 
"big") {
 
 3932                $avatar = 
$DIC[
"user.avatar.factory"]->avatar($a_size);
 
 3933                $avatar->setName($short);
 
 3934                $avatar->setUsrId($a_usr_id);
 
 3936                return $avatar->getUrl();
 
 3940        require_once(
'./Services/WebAccessChecker/classes/class.ilWACSignedPath.php');
 
 3952        $a_dir = trim(str_replace(
"..", 
"", $a_dir));
 
 3953        if ($a_dir == 
"" || !is_dir($a_dir)) {
 
 3958        $image_dir = $webspace_dir . 
"/usr_images";
 
 3960            "upload_" . $a_user_id . 
"pic",
 
 3961            "usr_" . $a_user_id . 
"." . 
"jpg",
 
 3962            "usr_" . $a_user_id . 
"_small.jpg",
 
 3963            "usr_" . $a_user_id . 
"_xsmall.jpg",
 
 3964            "usr_" . $a_user_id . 
"_xxsmall.jpg",
 
 3965            "upload_" . $a_user_id);
 
 3966        foreach ($images as $image) {
 
 3967            if (is_file($image_dir . 
"/" . $image)) {
 
 3968                copy($image_dir . 
"/" . $image, $a_dir . 
"/" . $image);
 
 3980        $image_dir = $webspace_dir . 
"/usr_images";
 
 3981        $file = $image_dir . 
"/usr_" . $this->getID() . 
"." . 
"jpg";
 
 3982        $thumb_file = $image_dir . 
"/usr_" . $this->getID() . 
"_small.jpg";
 
 3983        $xthumb_file = $image_dir . 
"/usr_" . $this->getID() . 
"_xsmall.jpg";
 
 3984        $xxthumb_file = $image_dir . 
"/usr_" . $this->getID() . 
"_xxsmall.jpg";
 
 3985        $upload_file = $image_dir . 
"/upload_" . $this->getID();
 
 3989            $this->
setPref(
"profile_image", 
"");
 
 3993        if (@is_file(
$file)) {
 
 3996        if (@is_file($thumb_file)) {
 
 3997            unlink($thumb_file);
 
 3999        if (@is_file($xthumb_file)) {
 
 4000            unlink($xthumb_file);
 
 4002        if (@is_file($xxthumb_file)) {
 
 4003            unlink($xxthumb_file);
 
 4005        if (@is_file($upload_file)) {
 
 4006            unlink($upload_file);
 
 4013        if (!is_array($a_data)) {
 
 4016        foreach ($a_data as $field => 
$data) {
 
 4017            #$new_data[$field] = ilUtil::stripSlashes($data); 
 4019            $this->user_defined_data[
'f_' . $field] = 
$data;
 
 4021        #$this->user_defined_data = $new_data; 
 4028        return $this->user_defined_data ? $this->user_defined_data : array();
 
 4037        $field_def = array();
 
 4039        include_once(
"./Services/User/classes/class.ilUserDefinedData.php");
 
 4042        foreach ($this->user_defined_data as $field => $value) {
 
 4043            if ($field != 
'usr_id') {
 
 4045                $udata->set($field, $value);
 
 4077        include_once(
"./Services/User/classes/class.ilUserDefinedData.php");
 
 4089        $this->user_defined_data = $udata->getAll();
 
 4113        include_once(
"./Services/User/classes/class.ilUserDefinedData.php");
 
 4129    public function getProfileAsString(&$a_language)
 
 4131        include_once 
'./Services/AccessControl/classes/class.ilObjRole.php';
 
 4135        $language =&$a_language;
 
 4136        $language->loadLanguageModule(
'registration');
 
 4137        $language->loadLanguageModule(
'crs');
 
 4140        $body .= ($language->txt(
"login") . 
": " . $this->
getLogin() . 
"\n");
 
 4143            $body .= ($language->txt(
"title") . 
": " . $this->
getUTitle() . 
"\n");
 
 4146            $body .= ($language->txt(
"gender") . 
": " . $language->txt(
'gender_' . strtolower($this->
getGender())) . 
"\n");
 
 4149            $body .= ($language->txt(
"firstname") . 
": " . $this->
getFirstname() . 
"\n");
 
 4152            $body .= ($language->txt(
"lastname") . 
": " . $this->
getLastname() . 
"\n");
 
 4155            $body .= ($language->txt(
"institution") . 
": " . $this->
getInstitution() . 
"\n");
 
 4158            $body .= ($language->txt(
"department") . 
": " . $this->
getDepartment() . 
"\n");
 
 4161            $body .= ($language->txt(
"street") . 
": " . $this->
getStreet() . 
"\n");
 
 4163        if (strlen($this->
getCity())) {
 
 4164            $body .= ($language->txt(
"city") . 
": " . $this->
getCity() . 
"\n");
 
 4167            $body .= ($language->txt(
"zipcode") . 
": " . $this->
getZipcode() . 
"\n");
 
 4170            $body .= ($language->txt(
"country") . 
": " . $this->
getCountry() . 
"\n");
 
 4173            $body .= ($language->txt(
"sel_country") . 
": " . $this->
getSelectedCountry() . 
"\n");
 
 4176            $body .= ($language->txt(
"phone_office") . 
": " . $this->
getPhoneOffice() . 
"\n");
 
 4179            $body .= ($language->txt(
"phone_home") . 
": " . $this->
getPhoneHome() . 
"\n");
 
 4182            $body .= ($language->txt(
"phone_mobile") . 
": " . $this->
getPhoneMobile() . 
"\n");
 
 4184        if (strlen($this->
getFax())) {
 
 4185            $body .= ($language->txt(
"fax") . 
": " . $this->
getFax() . 
"\n");
 
 4188            $body .= ($language->txt(
"email") . 
": " . $this->
getEmail() . 
"\n");
 
 4191            $body .= ($language->txt(
"second_email") . 
": " . $this->
getSecondEmail() . 
"\n");
 
 4194            $body .= ($language->txt(
"hobby") . 
": " . $this->
getHobby() . 
"\n");
 
 4197            $body .= ($language->txt(
"referral_comment") . 
": " . $this->
getComment() . 
"\n");
 
 4200            $body .= ($language->txt(
"matriculation") . 
": " . $this->
getMatriculation() . 
"\n");
 
 4208            $body .= ($language->txt(
"create_date") . 
": " . $date . 
"\n");
 
 4211        foreach (
$rbacreview->getGlobalRoles() as $role) {
 
 4212            if (
$rbacreview->isAssigned($this->getId(), $role)) {
 
 4217            $body .= ($language->txt(
'reg_role_info') . 
': ' . implode(
',', $gr) . 
"\n");
 
 4222            $body .= ($language->txt(
'time_limit') . 
": " . $language->txt(
'crs_unlimited') . 
"\n");
 
 4235            $body .= $language->txt(
'time_limit') . 
': ' . $start->get(
IL_CAL_DATETIME);
 
 4239        include_once 
'./Services/User/classes/class.ilUserDefinedFields.php';
 
 4246        foreach ($user_defined_fields->getDefinitions() as $field_id => $definition) {
 
 4248            if (strlen(
$data)) {
 
 4250                    $data = preg_replace(
'/<br(\s*)?\/?>/i', 
"\n", 
$data);
 
 4254                $body .= $definition[
'field_name'] . 
': ' . 
$data . 
"\n";
 
 4268        if ($a_user_id > 0) {
 
 4269            $set = 
$ilDB->queryF(
 
 4270                "SELECT feed_hash from usr_data WHERE usr_id = %s",
 
 4274            if ($rec = 
$ilDB->fetchAssoc($set)) {
 
 4275                if (strlen($rec[
"feed_hash"]) == 32) {
 
 4276                    return $rec[
"feed_hash"];
 
 4277                } elseif ($a_create) {
 
 4278                    $random = new \ilRandom();
 
 4279                    $hash = md5($random->int(1, 9999999) + str_replace(
" ", 
"", (
string) microtime()));
 
 4281                        "UPDATE usr_data SET feed_hash = %s" .
 
 4282                        " WHERE usr_id = %s",
 
 4283                        array(
"text", 
"integer"),
 
 4284                        array($hash, $a_user_id)
 
 4303        if ($a_user_id > 0) {
 
 4321            ($a_password==
"") ? 
"" : md5($a_password)
 
 4338        $q = 
"SELECT DISTINCT login, usr_id FROM usr_data " .
 
 4341        $values[] = $a_login;
 
 4343        if ($a_user_id != 0) {
 
 4344            $q.= 
" AND usr_id != %s ";
 
 4345            $types[] = 
"integer";
 
 4346            $values[] = $a_user_id;
 
 4349        $r = 
$ilDB->queryF($q, $types, $values);
 
 4352            return $row[
'usr_id'];
 
 4372            "SELECT * FROM usr_data " .
 
 4373            "WHERE ext_account = %s AND auth_mode = %s",
 
 4374            array(
"text", 
"text"),
 
 4375            array($a_external_account, $a_auth_mode)
 
 4377        return $ilDB->fetchAssoc(
$res) ? true :
false;
 
 4394        if (count($ids) == 0) {
 
 4398        $query = 
"SELECT usr_data.*, usr_pref.value AS language 
 4400                                                        LEFT JOIN usr_pref ON usr_pref.usr_id = usr_data.usr_id AND usr_pref.keyword = %s 
 4401                                                        WHERE " . 
$ilDB->in(
"usr_data.usr_id", $ids, 
false, 
"integer");
 
 4402        $values[] = 
"language";
 
 4407            $query .= 
" AND usr_data.active = %s";
 
 4409            $types[] = 
"integer";
 
 4412        $query .= 
" ORDER BY usr_data.lastname, usr_data.firstname ";
 
 4432        $query = 
"SELECT usr_data.*, usr_pref.value AS language FROM usr_data LEFT JOIN usr_pref ON usr_pref.usr_id = usr_data.usr_id and usr_pref.keyword = %s WHERE 1 = 1 ";
 
 4434        $values[] = 
"language";
 
 4437            $query .= 
" AND usr_data.active = %s";
 
 4439            $types[] = 
"integer";
 
 4443            $query.= 
" AND usr_data.time_limit_owner = %s";
 
 4445            $types[] = 
"integer";
 
 4448        $query .=       
" AND usr_data.usr_id != %s ";
 
 4449        $values[] = ANONYMOUS_USER_ID;
 
 4450        $types[] = 
"integer";
 
 4452        $query .= 
" ORDER BY usr_data.lastname, usr_data.firstname ";
 
 4484        $query = 
"SELECT usr_data.*, usr_pref.value AS language 
 4486                          LEFT JOIN usr_pref ON usr_pref.usr_id = usr_data.usr_id AND usr_pref.keyword = %s 
 4487                          WHERE " . 
$ilDB->in(
"usr_data.usr_id", $a_mem_ids, 
false, 
"integer") . 
" 
 4488                                        AND usr_data.usr_id != %s";
 
 4489        $values[] = 
"language";
 
 4491        $values[] = ANONYMOUS_USER_ID;
 
 4492        $types[] = 
"integer";
 
 4495            $query .= 
" AND active = %s";
 
 4497            $types[] = 
"integer";
 
 4500        if ($timelimitowner != 
USER_FOLDER_ID && $timelimitowner != -1) {
 
 4501            $query.= 
" AND usr_data.time_limit_owner = %s";
 
 4502            $values[] = $timelimitowner;
 
 4503            $types[] = 
"integer";
 
 4506        $query .= 
" ORDER BY usr_data.lastname, usr_data.firstname ";
 
 4513        return $mem_arr ? $mem_arr : array();
 
 4528        if (is_array($a_internalids)) {
 
 4529            foreach ($a_internalids as $internalid) {
 
 4530                if (is_numeric($internalid)) {
 
 4531                    $ids[] = $internalid;
 
 4534                    if (is_numeric($parsedid) && $parsedid > 0) {
 
 4540        if (count($ids) == 0) {
 
 4544        $query = 
"SELECT usr_data.*, usr_pref.value AS language 
 4547                          ON usr_pref.usr_id = usr_data.usr_id AND usr_pref.keyword = %s 
 4548                          WHERE " . 
$ilDB->in(
"usr_data.usr_id", $ids, 
false, 
"integer");
 
 4549        $values[] = 
"language";
 
 4552        $query .= 
" ORDER BY usr_data.lastname, usr_data.firstname ";
 
 4575            "SELECT * FROM usr_pref WHERE usr_id = %s",
 
 4601        $set = 
$ilDB->query(
 
 4602            "SELECT usr_id FROM usr_pref " .
 
 4603            " WHERE keyword = " . 
$ilDB->quote($a_keyword, 
"text") .
 
 4604            " AND " . 
$ilDB->in(
"usr_id", $a_user_ids, 
false, 
"integer") .
 
 4605            " AND value = " . 
$ilDB->quote($a_val, 
"text")
 
 4607        while ($rec = 
$ilDB->fetchAssoc($set)) {
 
 4608            $users[] = $rec[
"usr_id"];
 
 4618        $query = 
"UPDATE usr_data SET login_attempts = 0 WHERE usr_id = %s";
 
 4619        $affected = 
$ilDB->manipulateF(
$query, array(
'integer'), array($a_usr_id));
 
 4632        $query = 
"SELECT login_attempts FROM usr_data WHERE usr_id = %s";
 
 4644        $query = 
"UPDATE usr_data SET login_attempts = (login_attempts + 1) WHERE usr_id = %s";
 
 4645        $affected = 
$ilDB->manipulateF(
$query, array(
'integer'), array($a_usr_id));
 
 4658        $query = 
"UPDATE usr_data SET active = 0, inactivation_date = %s WHERE usr_id = %s";
 
 4675        return in_array($this->
getPref(
"public_profile"), array(
"y", 
"g"));
 
 4699            'SELECT * FROM loginname_history WHERE usr_id = %s AND login = %s AND history_date = %s',
 
 4700            array(
'integer', 
'text', 
'integer'),
 
 4707                                INSERT INTO loginname_history  
 4708                                                (usr_id, login, history_date) 
 4709                                VALUES  (%s, %s, %s)',
 
 4710                array(
'integer', 
'text', 
'integer'),
 
 4725    public static function _getUsersOnline($a_user_id = 0, $a_no_anonymous = 
false)
 
 4738        $atime  = $pd_set->get(
'user_activity_time') * 60;
 
 4743        if ($a_user_id == 0) {
 
 4744            $where[] = 
'user_id > 0';
 
 4745        } elseif (is_array($a_user_id)) {
 
 4746            $where[] = 
$ilDB->in(
"user_id", $a_user_id, 
false, 
"integer");
 
 4748            $where[] = 
'user_id = ' . 
$ilDB->quote($a_user_id, 
'integer');
 
 4751        if ($a_no_anonymous) {
 
 4752            $where[] = 
'user_id != ' . 
$ilDB->quote(ANONYMOUS_USER_ID, 
'integer');
 
 4755        include_once 
'Services/User/classes/class.ilUserAccountSettings.php';
 
 4757            include_once 
'Services/User/classes/class.ilUserFilter.php';
 
 4761        $where[] = 
'expires > ' . 
$ilDB->quote($ctime, 
'integer');
 
 4762        $where[] = 
'(p.value IS NULL OR NOT p.value = ' . 
$ilDB->quote(
'y', 
'text') . 
')';
 
 4764        $where = 
'WHERE ' . implode(
' AND ', $where);
 
 4768                        SELECT COUNT(user_id) num, user_id, firstname, lastname, title, login, last_login, MAX(ctime) ctime, context, agree_date 
 4770                        LEFT JOIN usr_data u 
 4771                                ON user_id = u.usr_id 
 4772                        LEFT JOIN usr_pref p 
 4773                                ON (p.usr_id = u.usr_id AND p.keyword = %s) 
 4775                        GROUP BY user_id, firstname, lastname, title, login, last_login, context, agree_date 
 4776                        ORDER BY lastname, firstname 
 4779            array(
'hide_own_online_status')
 
 4782        $log->debug(
"Query: " . $q);
 
 4785        while ($user = 
$ilDB->fetchAssoc(
$r)) {
 
 4786            if ($atime <= 0 || $user[
'ctime'] + $atime > $ctime) {
 
 4787                $users[$user[
'user_id']] = $user;
 
 4791        $log->debug(
"Found users: " . count(
$users));
 
 4793        require_once 
'Services/TermsOfService/classes/class.ilTermsOfServiceHelper.php';
 
 4796                if ($user[
'agree_date'] || $user[
'user_id'] == SYSTEM_USER_ID || 
'root' === $user[
'login']) {
 
 4803            $log->debug(
"TOS filtered to users: " . count(
$users));
 
 4823        $atime = $pd_set->get(
"user_activity_time") * 60;
 
 4825        $no_anonym = ($a_no_anonymous)
 
 4826            ? 
"AND user_id <> " . 
$ilDB->quote(ANONYMOUS_USER_ID, 
"integer") . 
" " 
 4833        $q = 
"SELECT DISTINCT dat.obj_id as obj_id " .
 
 4834            "FROM rbac_ua ua " .
 
 4835            "JOIN rbac_fa fa ON fa.rol_id = ua.rol_id " .
 
 4836            "JOIN object_reference r1 ON r1.ref_id = fa.parent " .
 
 4837            "JOIN tree ON tree.child = r1.ref_id " .
 
 4838            "JOIN object_reference r2 ON r2.ref_id = tree.child " . 
 
 4839            "JOIN object_data dat ON dat.obj_id = r2.obj_id " .
 
 4840            "WHERE ua.usr_id = " . 
$ilDB->quote($a_user_id, 
"integer") . 
" " .
 
 4841            "AND fa.assign = " . 
$ilDB->quote(
"y", 
"text") . 
" " .
 
 4842            "AND dat.type IN (" . 
$ilDB->quote(
"crs", 
"text") . 
"," .
 
 4843            $ilDB->quote(
"grp", 
"text") . 
")";
 
 4847            $groups_and_courses_of_user[] = 
$row[
"obj_id"];
 
 4850        require_once 
'Services/TermsOfService/classes/class.ilTermsOfServiceHelper.php';
 
 4851        $tos_condition = 
'';
 
 4853            $tos_condition = 
" AND (agree_date IS NOT NULL OR ud.usr_id = " . 
$ilDB->quote(SYSTEM_USER_ID, 
'integer') . 
") ";
 
 4857        if (count($groups_and_courses_of_user) == 0) {
 
 4858            $q = 
"SELECT count(user_id) as num,ctime,user_id,firstname,lastname,title,login,last_login " .
 
 4859                "FROM usr_session " .
 
 4860                "JOIN usr_data ud ON user_id = ud.usr_id " .
 
 4861                "WHERE user_id = " . 
$ilDB->quote($a_user_id, 
"integer") . 
" " .
 
 4864                "AND expires > " . 
$ilDB->quote(time(), 
"integer") . 
" " .
 
 4865                "GROUP BY user_id,ctime,firstname,lastname,title,login,last_login";
 
 4868            $q = 
"SELECT count(user_id) as num,s.ctime,s.user_id,ud.firstname,ud.lastname,ud.title,ud.login,ud.last_login " .
 
 4869                "FROM usr_session s " .
 
 4870                "JOIN usr_data ud ON ud.usr_id = s.user_id " .
 
 4871                "JOIN rbac_ua ua ON ua.usr_id = s.user_id " .
 
 4872                "JOIN rbac_fa fa ON fa.rol_id = ua.rol_id " .
 
 4873                "JOIN tree ON tree.child = fa.parent " .
 
 4874                "JOIN object_reference or1 ON or1.ref_id = tree.child " . 
 
 4875                "JOIN object_data od ON od.obj_id = or1.obj_id " .
 
 4876                "LEFT JOIN usr_pref p ON (p.usr_id = ud.usr_id AND p.keyword = " .
 
 4877                    $ilDB->quote(
"hide_own_online_status", 
"text") . 
") " .
 
 4878                "WHERE s.user_id != 0 " .
 
 4880                "AND (p.value IS NULL OR NOT p.value = " . 
$ilDB->quote(
"y", 
"text") . 
") " .
 
 4881                "AND s.expires > " . 
$ilDB->quote(time(), 
"integer") . 
" " .
 
 4882                "AND fa.assign = " . 
$ilDB->quote(
"y", 
"text") . 
" " .
 
 4884                "AND " . 
$ilDB->in(
"od.obj_id", $groups_and_courses_of_user, 
false, 
"integer") . 
" " .
 
 4885                "GROUP BY s.user_id,s.ctime,ud.firstname,ud.lastname,ud.title,ud.login,ud.last_login " .
 
 4886                "ORDER BY ud.lastname, ud.firstname";
 
 4890        while ($user = 
$ilDB->fetchAssoc(
$r)) {
 
 4892                || $user[
"ctime"] + $atime > $ctime) {
 
 4893                $users[$user[
"user_id"]] = $user;
 
 4913            $random = new \ilRandom();
 
 4914            $hashcode = substr(md5(uniqid($random->int(), 
true)), 0, 16);
 
 4918                                SELECT COUNT(usr_id) cnt FROM usr_data  
 4919                                WHERE reg_hash = %s',
 
 4924                if (
$row->cnt > 0) {
 
 4939                array(
'text', 
'integer'),
 
 4940                array($hashcode, (
int) $a_usr_id)
 
 4963                        SELECT usr_id, create_date FROM usr_data  
 4964                        WHERE reg_hash = %s',
 
 4969            require_once 
'Services/Registration/classes/class.ilRegistrationSettings.php';
 
 4972            if ((
int) $oRegSettigs->getRegistrationHashLifetime() != 0 &&
 
 4973               time() - (
int) $oRegSettigs->getRegistrationHashLifetime() > strtotime(
$row[
'create_date'])) {
 
 4974                require_once 
'Services/Registration/exceptions/class.ilRegConfirmationLinkExpiredException.php';
 
 4983                array(
'text', 
'integer'),
 
 4984                array(
'', (
int) 
$row[
'usr_id'])
 
 4987            return (
int) 
$row[
'usr_id'];
 
 4990        require_once 
'Services/Registration/exceptions/class.ilRegistrationHashNotFoundException.php';
 
 4996        if (strlen($a_birthday)) {
 
 5000            $this->birthday = 
null;
 
 5019        if (!(
int) $period) {
 
 5025        $date = 
date(
'Y-m-d H:i:s', (time() - ((
int) $period * 24 * 60 * 60)));
 
 5027        $query = 
"SELECT usr_id FROM usr_data WHERE last_login < %s OR (ISNULL(last_login) AND create_date < %s)";
 
 5029        $res = 
$ilDB->queryF(
$query, array(
'timestamp', 
'timestamp'), array($date, $date));
 
 5033            $ids[] = 
$row->usr_id;
 
 5050        $field = 
'inactivation_date';
 
 5053        if (!(
int) $period) {
 
 5059        $date = 
date(
'Y-m-d H:i:s', (time() - ((
int) $period * 24 * 60 * 60)));
 
 5061        $query = 
"SELECT usr_id FROM usr_data WHERE $field < %s AND active = %s";
 
 5063        $res = 
$ilDB->queryF(
$query, array(
'timestamp', 
'integer'), array($date, 0));
 
 5067            $ids[] = 
$row->usr_id;
 
 5084        if ($a_last_login !== 
null) {
 
 5085            $last_login = $a_last_login;
 
 5087            $last_login = 
date(
'Y-m-d H:i:s');
 
 5092        $query = 
"UPDATE usr_data SET last_login = %s WHERE usr_id = %s";
 
 5093        $affected = 
$ilDB->manipulateF(
$query, array(
'timestamp', 
'integer'), array($last_login, $a_usr_id));
 
 5106        $query = 
"UPDATE object_data SET owner = 0 " .
 
 5107            "WHERE owner = " . 
$ilDB->quote($this->
getId(), 
'integer');
 
 5124        $q = 
"SELECT DISTINCT " . 
$ilDB->upper(
$ilDB->substr(
"lastname", 1, 1)) . 
" let" .
 
 5126            " WHERE usr_id <> " . 
$ilDB->quote(ANONYMOUS_USER_ID, 
"integer") .
 
 5128        $let_set = 
$ilDB->query($q);
 
 5131        while ($let_rec = 
$ilDB->fetchAssoc($let_set)) {
 
 5132            $let[$let_rec[
"let"]] = $let_rec[
"let"];
 
 5142        $query = 
'SELECT count(*) num FROM object_data od ' .
 
 5143                'JOIN usr_data ud ON obj_id = usr_id ' .
 
 5144                'WHERE ' . 
$ilDB->in(
'obj_id', $a_usr_ids, 
false, 
'integer') . 
' ';
 
 5147        return $num_rows == count((array) $a_usr_ids);
 
 5156        return (
boolean) 
$_SESSION[
"user_captcha_verified"];
 
 5166        $_SESSION[
"user_captcha_verified"] = $a_val;
 
 5177        include_once(
"./Services/Export/classes/class.ilExport.php");
 
 5200        include_once(
"./Services/Export/classes/class.ilExport.php");
 
 5202        if (!is_dir($dir)) {
 
 5206            if (is_int(strpos($entry[
"entry"], 
".zip"))) {
 
 5207                return $entry[
"entry"];
 
 5222        include_once(
"./Services/Export/classes/class.ilExport.php");
 
 5225        if (is_file(
$file)) {
 
 5244        include_once(
"./Services/Export/classes/class.ilImport.php");
 
 5246        if (!$a_profile_data) {
 
 5247            $imp->addSkipEntity(
"Services/User", 
"usr_profile");
 
 5250            $imp->addSkipEntity(
"Services/User", 
"usr_setting");
 
 5252        if (!$a_bookmarks) {
 
 5253            $imp->addSkipEntity(
"Services/Bookmarks", 
"bookmarks");
 
 5256            $imp->addSkipEntity(
"Services/Notes", 
"user_notes");
 
 5259            $imp->addSkipEntity(
"Services/Calendar", 
"calendar");
 
 5262            $a_file[
"tmp_name"],
 
 5278        $NOW = 
$ilDB->now();
 
 5280        $usrId_IN_usrIds = 
$ilDB->in(
'usr_id', $usrIds, 
false, 
'integer');
 
 5284                        SET inactivation_date = $NOW 
 5285                        WHERE inactivation_date IS NULL 
 5286                        AND $usrId_IN_usrIds 
 5289        $ilDB->manipulate($queryString);
 
 5301        $usrId_IN_usrIds = 
$ilDB->in(
'usr_id', $usrIds, 
false, 
'integer');
 
 5305                        SET inactivation_date = NULL 
 5306                        WHERE $usrId_IN_usrIds 
 5309        $ilDB->manipulate($queryString);
 
 5337        require_once 
'Services/TermsOfService/classes/class.ilTermsOfServiceHelper.php';
 
 5341            null == $this->agree_date &&
 
 5342            'root' != $this->login &&
 
 5343            !in_array($this->
getId(), array(ANONYMOUS_USER_ID, SYSTEM_USER_ID))
 
 5355    public static function hasUserToAcceptTermsOfService($a_username)
 
 5362        require_once 
'Services/TermsOfService/classes/class.ilTermsOfServiceHelper.php';
 
 5368        $in = 
$ilDB->in(
'usr_id', array(ANONYMOUS_USER_ID, SYSTEM_USER_ID), 
true, 
'integer');
 
 5370            "SELECT usr_id FROM usr_data WHERE login = %s AND agree_date IS NULL $in",
 
 5374        return $ilDB->fetchAssoc(
$res) ? true : 
false;
 
 5388        $date_is = ($a_agreed)
 
 5392        $users = (is_array($a_users))
 
 5393            ? 
" AND " . 
$ilDB->in(
"usr_id", $a_users, 
false, 
"integer")
 
 5396        $set = 
$ilDB->query(
"SELECT usr_id FROM usr_data " .
 
 5397            " WHERE agree_date " . $date_is .
 
 5400        while ($rec = 
$ilDB->fetchAssoc($set)) {
 
 5401            $ret[] = $rec[
"usr_id"];
 
 5413        if (
null === $status) {
 
 5417        require_once 
'Services/TermsOfService/classes/class.ilTermsOfServiceHelper.php';
 
 5437        return $usr_id == ANONYMOUS_USER_ID;
 
 5452        return (
bool) $this->
getPref(
"delete_flag");
 
 5460        $this->is_self_registered = (bool) $status;
 
 5480        $this->interests_general = $value;
 
 5510        $this->interests_help_offered = $value;
 
 5540        $this->interests_help_looking = $value;
 
 5584        if (!$this->
getId()) {
 
 5588        $set = 
$ilDB->query(
"SELECT field_id,value" .
 
 5589            " FROM usr_data_multi" .
 
 5590            " WHERE usr_id = " . 
$ilDB->quote($this->getId(), 
"integer") .
 
 5592        while (
$row = 
$ilDB->fetchAssoc($set)) {
 
 5593            $values[
$row[
"field_id"]][] = 
$row[
"value"];
 
 5596        if (isset($values[
"interests_general"])) {
 
 5601        if (isset($values[
"interests_help_offered"])) {
 
 5606        if (isset($values[
"interests_help_looking"])) {
 
 5622        if (!$this->
getId()) {
 
 5636        foreach ($map as 
$id => $values) {
 
 5637            if (is_array($values) && 
sizeof($values)) {
 
 5638                foreach ($values as $value) {
 
 5639                    $value = trim($value);
 
 5641                        $uniq_id = 
$ilDB->nextId(
'usr_data_multi');
 
 5643                        $ilDB->manipulate(
"INSERT usr_data_multi" .
 
 5644                            " (id,usr_id,field_id,value) VALUES" .
 
 5645                            " (" . 
$ilDB->quote($uniq_id, 
"integer") .
 
 5646                            "," . 
$ilDB->quote($this->getId(), 
"integer") .
 
 5648                            "," . 
$ilDB->quote($value, 
"text") .
 
 5663        if (!$this->
getId()) {
 
 5667        $ilDB->manipulate(
"DELETE FROM usr_data_multi" .
 
 5668            " WHERE usr_id = " . 
$ilDB->quote($this->getId(), 
"integer"));
 
 5671    public static function findInterests($a_term, $a_user_id = 
null, $a_field_id = 
null)
 
 5677        $sql = 
"SELECT DISTINCT(value)" .
 
 5678            " FROM usr_data_multi" .
 
 5679            " WHERE " . 
$ilDB->like(
"value", 
"text", 
"%" . $a_term . 
"%");
 
 5681            $sql .= 
" AND field_id = " . 
$ilDB->quote($a_field_id, 
"text");
 
 5684            $sql .=  
" AND usr_id <> " . 
$ilDB->quote($a_user_id, 
"integer");
 
 5686        $sql .= 
" ORDER BY value";
 
 5687        $set = 
$ilDB->query($sql);
 
 5688        while (
$row = 
$ilDB->fetchAssoc($set)) {
 
 5710        $set = 
$ilDB->query(
 
 5711            "SELECT * FROM usr_pref " .
 
 5712                " WHERE keyword = " . 
$ilDB->quote(
"public_profile", 
"text") .
 
 5713                " AND " . 
$ilDB->in(
"usr_id", $a_user_ids, 
false, 
"integer")
 
 5716            "global" => array(),
 
 5718            "public" => array(),
 
 5719            "not_public" => array()
 
 5721        while ($rec = 
$ilDB->fetchAssoc($set)) {
 
 5722            if ($rec[
"value"] == 
"g") {
 
 5723                $r[
"global"][] = $rec[
"usr_id"];
 
 5724                $r[
"public"][] = $rec[
"usr_id"];
 
 5726            if ($rec[
"value"] == 
"y") {
 
 5727                $r[
"local"][] = $rec[
"usr_id"];
 
 5728                $r[
"public"][] = $rec[
"usr_id"];
 
 5731        foreach ($a_user_ids as 
$id) {
 
 5732            if (!in_array(
$id, 
$r[
"public"])) {
 
 5733                $r[
"not_public"][] = 
$id;
 
sprintf('%.4f', $callTime)
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
if(php_sapi_name() !='cli') $in
foreach($mandatory_scripts as $file) $timestamp
An exception for terminatinating execution or to throw for unit testing.
const USER_FOLDER_ID
Class ilObjUserFolder.
static _getAuthMode($a_auth_mode, $a_db_handler='')
static _needsExternalAccountByAuthMode($a_auth_mode)
Check if chosen auth mode needs an external account entry.
static _getAuthModeName($a_auth_key)
static deleteByUserId($a_user_id)
static _deleteSettingsOfUser($a_user)
Delete block settings of user.
bookmark folder (note: this class handles personal bookmarks folders only)
static deletePDItemsCache($a_usr_id)
Delete cache (add remove desktop item)
static _getInstance()
get singleton instance
static removeSingleUserFromTable($usr_id)
This is the super class of all custom blocks.
static _isActive()
Static getter.
static resetToDefaults()
reset to defaults
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false)
Format a date @access public.
static setLanguage($a_lng)
set language
static setUseRelativeDates($a_status)
set use relative dates
static formatPeriod(ilDateTime $start, ilDateTime $end, $a_skip_starting_day=false)
Format a period of two date Shows: 14.
@classDescription Date and time handling
static deleteByOwner($a_owner_id)
Delete all entries for owner.
static _deleteByUser($a_usr_id)
Base class for ILIAS Exception handling.
static _getExportDirectory($a_obj_id, $a_type="xml", $a_obj_type="", $a_entity="")
Get export directory for an repository object.
static _getInstance()
Get singleton instance of this class.
static _deleteUser($a_usr_id)
static getLogger($a_component_id)
Get component logger.
Class ilMailOptions this class handles user mails.
Mail Box class Base class for creating and handling mail boxes.
static lookupTitle($a_page_id)
Lookup title.
Base class for nested set path based trees.
static removeForUser($user_id)
Remove all notifications for given user.
static _deleteUser($a_usr_id)
static _deleteUser($a_usr_id)
static deleteUserPortfolios($a_user_id)
Delete all portfolio data for user.
static _removeTrackingDataForUser($user_id)
static _deleteUser($a_usr_id)
updateMultiTextFields($a_create=false)
Write multi-text values to DB.
setCity($a_str)
set city @access public
static _resetLoginAttempts($a_usr_id)
updateLogin($a_login)
update login name
getPasswdType()
get password type
static lookupMatriculation($a_usr_id)
Lookup matriculation.
getPhoneHome()
get home phone @access public
deleteMultiTextFields()
Remove multi-text values from DB.
static _writeExternalAccount($a_usr_id, $a_ext_id)
setCurrentLanguage($a_val)
Set current language.
getDiskQuota()
Returns the minimal disk quota imposed by this user account.
static _getUsersForIds($a_mem_ids, $active=-1, $timelimitowner=-1)
return user data for given user id
setUTitle($a_str)
set user title (note: don't mix up this method with setTitle() that is derived from ilObject and sets...
static copyProfilePicturesToDirectory($a_user_id, $a_dir)
Get profile picture direcotory.
setInactivationDate($inactivation_date)
setter for inactivation date
static _getUsersForRole($role_id, $active=-1)
return array of complete users which belong to a specific role
readMultiTextFields()
Fetch multi-text values from DB.
static _lookupPref($a_usr_id, $a_keyword)
static _getLastHistoryDataByUserId($a_usr_id)
Returns the last used loginname and the changedate of the passed user_id.
setSecondEmail($second_email)
addToPCClipboard($a_content, $a_time, $a_nr)
Add a page content item to PC clipboard (should go to another class)
getAgreeDate()
get the date when the user accepted the user agreement @access public
static _verifyRegistrationHash($a_hash)
Verifies a registration hash.
static _getImportedUserId($i2_id)
getLatitude()
Get Latitude.
addDesktopItem($a_item_id, $a_type, $a_par="")
add an item to user's personal desktop
setLocationZoom($a_locationzoom)
Set Location Zoom.
static _lookupEmail($a_user_id)
Lookup email.
getLookingForHelpAsText()
Get help looking for as plain text.
getOfferingHelpAsText()
Get help offering as plain text.
setLanguage($a_str)
set user language @access public
setClientIP($a_str)
set client ip number @access public
getPhoneOffice()
get office phone @access public
setLatitude($a_latitude)
Set Latitude.
static searchUsers($a_search_str, $active=1, $a_return_ids_only=false, $filter_settings=false)
STATIC METHOD get the user_ids which correspond a search string.
static _getUserData($a_internalids)
return user data for given user ids
setInstitution($a_str)
set institution @access public
hasToAcceptTermsOfService()
setLastUpdate($a_str)
set last update of user data set @access public
getClipboardObjects($a_type="", $a_top_nodes_only=false)
get all clipboard objects of user and specified type
static initInactivationDate($usrIds)
@global type $ilDB
getActive()
get user active state @access public
static $personal_image_cache
sendPersonalDataFile()
Send personal data file.
static _updateLastLogin($a_usr_id, $a_last_login=null)
STATIC METHOD updates the last_login field of user with given id to given or current date.
setAgreeDate($a_str)
set date the user account was accepted by the user nullindicates that the user has not accepted his a...
static _getAllUserData($a_fields=null, $active=-1)
STATIC METHOD get all user data.
getUserIdByEmail($a_email)
STATIC METHOD get the user_id of an email address.
setFirstname($a_str)
set firstname @access public
getGeneralInterests()
Get general interests.
static _lookupFields($a_user_id)
lookup fields (deprecated; use more specific methods instead)
$login
all user related data in single vars @access public
static _lookupLogin($a_user_id)
lookup login
setDepartment($a_str)
set department @access public
getCountry()
Get country (free text)
static _lookupSecondEmail($a_user_id)
Lookup second e-mail.
static _checkExternalAuthAccount($a_auth, $a_account, $tryFallback=true)
check whether external account and authentication method matches with a user
deletePref($a_keyword)
Deletes a userpref value of the user from the database @access public.
static getUserSubsetByPreferenceValue($a_user_ids, $a_keyword, $a_val)
For a given set of user IDs return a subset that has a given user preference set.
writeAccepted()
write accept date of user agreement to db
static getFirstLettersOfLastnames()
Get first letters of all lastnames.
getTimeZone()
get timezone of user
getFax()
get fax @access public
static getLoginFromAuth()
Gets the username from $ilAuth, and converts it into an ILIAS login name.
static getUserIdByLogin($a_login)
addObjectToClipboard( $a_item_id, $a_type, $a_title, $a_parent=0, $a_time=0, $a_order_nr=0)
add an item to user's personal clipboard
setDiskQuota($a_disk_quota)
Sets the minimal disk quota imposed by this user account.
getLastname()
get lastname @access public
removeUserPicture($a_do_update=true)
Remove user picture.
getUTitle()
get user title (note: don't mix up this method with getTitle() that is derived from ilObject and gets...
getPersonalPicturePath($a_size="small", $a_force_pic=false)
Get path to personal picture.
setLookingForHelp(array $value=null)
Set help looking for.
static lookupOrgUnitsRepresentation($a_usr_id)
lokup org unit representation
static _writeAuthMode($a_usr_id, $a_auth_mode)
static _isDesktopItem($a_usr_id, $a_item_id, $a_type)
check wether an item is on the users desktop or not
static _dropDesktopItem($a_usr_id, $a_item_id, $a_type)
drop an item from user's personal desktop
getMatriculation()
get matriculation number @access public
setPasswordEncodingType($password_encryption_type)
static resetInactivationDate($usrIds)
@global type $ilDB
resetLastPasswordChange()
buildTextFromArray($a_attr)
Convert multi-text values to plain text.
static findInterests($a_term, $a_user_id=null, $a_field_id=null)
static _getAssociatedUsersOnline($a_user_id, $a_no_anonymous=false)
reads all active sessions from db and returns users that are online and who have a local role in a gr...
setExternalAccount($a_str)
set external account
setLogin($a_str)
set login / username @access public
static userExists($a_usr_ids=array())
static _getPreferences($user_id)
get preferences for user
clipboardDeleteAll()
Delete objects of type for user.
setTimeLimitFrom($a_from)
readPrefs()
get all user preferences @access private
static _writePref($a_usr_id, $a_keyword, $a_value)
static _incrementLoginAttempts($a_usr_id)
importPersonalData( $a_file, $a_profile_data, $a_settings, $a_bookmarks, $a_notes, $a_calendar)
Import personal data.
hasPublicProfile()
returns true if public is profile, false otherwise
static _lookupFeedHash($a_user_id, $a_create=false)
Lookup news feed hash for user.
static _uploadPersonalPicture($tmp_file, $obj_id)
Create a personal picture image file from a temporary image file.
getDateFormat()
get date format
setSkin($a_str)
set user skin (template set) @access public
getHobby()
get hobby @access public
static _getUsersForFolder($ref_id, $active)
get users for a category or from system folder
getCurrentLanguage()
returns the current language (may differ from user's pref setting!)
setSelectedCountry($a_val)
Set selected country (selection drop down)
getLongitude()
Get Longitude.
getEmail()
get email address @access public
getLoginByUserId($a_userid)
isDesktopItem($a_item_id, $a_type)
check wether an item is on the users desktop or not
setCaptchaVerified($a_val)
Set captcha verified.
clipboardDeleteObjectsOfType($a_type)
Delete objects of type for user.
static preloadIsDesktopItem($a_usr_id, $a_item_ids)
Preload desktop item information.
static _lookupExternalAccount($a_user_id)
lookup external account for login and authmethod
setCountry($a_str)
Set country (free text)
setTimeLimitMessage($a_time_limit_message)
setPasswd($a_str, $a_type=IL_PASSWD_PLAIN)
set password @access public
static _lookupId($a_user_str)
Lookup id by login.
isPasswordChangeDemanded()
read()
loads a record "user" from database @access private
getLocationZoom()
Get Location Zoom.
getAuthMode($a_auth_key=false)
get auth mode @access public
static _lookupDesktopItems($user_id, $a_types="")
get all desktop items of user and specified type
static _getAllUserAssignedStyles()
skins and styles
static _deleteAllPref($a_user_id)
Deletes a userpref value of the user from the database @access public.
setComment($a_str)
set referral comment @access public
getComment()
get referral comment @access public
static getUsersAgreed($a_agreed=true, $a_users=null)
Get users that have or have not agreed to the user agreement.
getTimeFormat()
get time format
getPersonalDataExportFile()
Get personal data export file.
setAuthMode($a_str)
set auth mode @access public
setPhoneHome($a_str)
set home phone @access public
static _getUserIdsByInactivityPeriod($period)
get ids of all users that have been inactive for at least the given period
static _lookupGender($a_user_id)
Lookup gender.
setPasswordSalt($password_salt)
setFax($a_str)
set fax @access public
setTimeLimitUntil($a_until)
static _lookupName($a_user_id)
lookup user name
static _getNumberOfUsersPerAuthMode()
get number of users per auth mode
getStreet()
get street @access public
getClipboardChilds($a_parent, $a_insert_time)
Get childs of an item.
static _toggleActiveStatusOfUsers($a_usr_ids, $a_status)
Toggle active status of users.
getSelectedCountry()
Get selected country (selection drop down)
setTimeLimitOwner($a_owner)
getInstitution()
get institution @access public
getDesktopItems($a_types="")
getApproveDate()
get the date when the user account was approved @access public
getFirstname()
get firstname @access public
getZipcode()
get zipcode @access public
static _readUsersProfileData($a_user_ids)
STATIC METHOD get user data of selected users.
static _moveUsersToStyle($a_from_skin, $a_from_style, $a_to_skin, $a_to_style)
skins and styles
static _getUsersForClipboadObject($a_type, $a_id)
get all users, that have a certain object within their clipboard
setZipcode($a_str)
set zipcode @access public
setApproveDate($a_str)
set date the user account was activated null indicates that the user has not yet been activated @acce...
setLongitude($a_longitude)
Set Longitude.
getLogin()
get login / username @access public
getPref($a_keyword)
get a user preference
setFullname($a_title="", $a_firstname="", $a_lastname="")
builds a string with title + firstname + lastname method is used to build fullname in member variable...
setPref($a_keyword, $a_value)
set a user preference
deleteUserDefinedFieldEntries()
setLastname($a_str)
set lastame @access public
hasToAcceptTermsOfServiceInSession($status=null)
static _getFeedPass($a_user_id)
Lookup news feed password for user.
setGeneralInterests(array $value=null)
Set general interests.
static _externalAccountExists($a_external_account, $a_auth_mode)
Check if an external account name already exists.
static _generateRegistrationHash($a_usr_id)
Generates a unique hashcode for activating a user profile after registration.
static _getUserIdsByInactivationPeriod($period)
get ids of all users that have been inactivated since at least the given period
static _setUserInactive($a_usr_id)
static _lookupFullname($a_user_id)
Lookup Full Name.
setOfferingHelp(array $value=null)
Set help offering.
static _lookupAuthMode($a_usr_id)
lookup auth mode
getStoredActive($a_id)
get user active state
setStreet($a_str)
set street @access public
setLastPasswordChangeTS($a_last_password_change_ts)
getLastLogin()
returns last login date @access public
static $is_desktop_item_loaded
setActive($a_active, $a_owner=0)
set user active state and updates system fields appropriately @access public
refreshLogin()
updates the login data of a "user" // TODO set date with now() should be enough @access public
setGender($a_str)
set gender @access public
static _getUsersForGroup($a_mem_ids, $active=-1)
return user data for group members
static _lookupLastLogin($a_user_id)
lookup last login
setProfileIncomplete($a_prof_inc)
static _setFeedPass($a_user_id, $a_password)
Set news feed password for user.
setTimeLimitUnlimited($a_unlimited)
static _doesLoginnameExistInHistory($a_login)
Checks wether the passed loginname already exists in history.
static _getLoginAttempts($a_usr_id)
getOrgUnitsRepresentation()
static getProfileStatusOfUsers($a_user_ids)
Get profile status.
getPhoneMobile()
get mobile phone @access public
getPublicName()
returns firstname lastname and login if profile is public, login otherwise
setEmail($a_str)
set email @access public
getFullname($a_max_strlen=0)
get fullname @access public
static _lookup($a_user_id, $a_field)
Private function for lookup methods.
clipboardHasObjectsOfType($a_type)
Check whether clipboard has objects of a certain type.
setIsSelfRegistered($status)
getCity()
get city @access public
static _loginExists($a_login, $a_user_id=0)
check if a login name already exists You may exclude a user from the check by giving his user id as 2...
getLastPasswordChangeTS()
getLanguage()
returns a 2char-language-string @access public
__construct($a_user_id=0, $a_call_by_reference=false)
Constructor @access public.
setMatriculation($a_str)
set matriculation number @access public
static _writeHistory($a_usr_id, $a_login)
getOfferingHelp()
Get help offering.
addUserDefinedFieldEntry()
getPasswordEncodingType()
syncActive()
synchronizes current and stored user active values for the owner value to be set correctly,...
static _getUserIdsByEmail($a_email)
STATIC METHOD get all user_ids of an email address.
setLastLogin($a_str)
set user's last login @access public
writePrefs()
write all userprefs @access private
static _getLocalAccountsForEmail($a_email)
check whether external account and authentication method matches with a user
getInactivationDate()
getter for inactivation date
getDepartment()
get department @access public
assignData($a_data)
loads a record "user" from array @access public
getPersonalWorkspaceDiskQuota()
setLastPasswordChangeToNow()
setHobby($a_str)
set hobby @access public
getLookingForHelp()
Get help looking for.
static _isAnonymous($usr_id)
static _removeItemFromDesktops($a_id)
removes object from all user's desktops @access public
static _lookupLanguage($a_usr_id)
getGeneralInterestsAsText()
Get general interests as plain text.
static _addDesktopItem($a_usr_id, $a_item_id, $a_type, $a_par="")
add an item to user's personal desktop
setPhoneOffice($a_str)
set office phone @access public
removeObjectFromClipboard($a_item_id, $a_type)
remove object from user's personal clipboard
getPCClipboardContent()
Add a page content item to PC clipboard (should go to another class)
dropDesktopItem($a_item_id, $a_type)
drop an item from user's personal desktop
exportPersonalData()
Export personal data.
setUserDefinedData($a_data)
static hasActiveSession($a_user_id, $a_session_id)
Check for simultaneous login.
setPhoneMobile($a_str)
set mobile phone @access public
isCaptchaVerified()
Is user captcha verified?
setLoginAttempts($a_login_attempts)
setDesktopItemParameters($a_item_id, $a_type, $a_par)
set parameters of a desktop item entry
getGender()
get gender @access public
getExternalAccount()
get external account
static $is_desktop_item_cache
static _lookupClientIP($a_user_id)
Lookup client ip.
updateUserDefinedFields()
static toUsernameWithoutDomain($a_login)
Static function removes Microsoft domain name from username webdav related.
static _getNumberOfUsersForStyle($a_skin, $a_style)
skins and styles
writePref($a_keyword, $a_value)
write userpref to user table @access private
static _getExternalAccountsByAuthMode($a_auth_mode, $a_read_auth_default=false)
Get list of external account by authentication method Note: If login == ext_account for two user with...
static _lookupActive($a_usr_id)
Check user account active.
getClientIP()
get client ip number @access public
Class ilObject Basic functions for all objects.
setId($a_id)
set object id @access public
update()
update object in db
static _lookupTitle($a_id)
lookup object title
static _lookupDescription($a_id)
lookup object description
setOwner($a_owner)
set object owner
getId()
get object id @access public
getCreateDate()
get create date @access public
Custom block for external feeds on personal desktop.
Class for user related exception handling in ILIAS.
Class for user related exception handling in ILIAS.
Class ilObjAuthSettingsGUI.
static _removeTrackingDataForUser($user_id)
static _getInstance()
Get instance of ilSecuritySettings.
static set($a_var, $a_val)
Set a value.
static _destroyByUserId($a_user_id)
Destroy session.
static get($a_var)
Get a value.
static subStr($a_str, $a_start, $a_length=null)
static skinExists($skin_id, ilSystemStyleConfig $system_style_config=null)
Check whether a skin exists.
static styleExistsForSkinId($skin_id, $style_id)
static getInstance()
Singelton get instance.
static deleteEntriesOfUser($a_user_id)
Delete data of user.
static _getInstance()
Get instance.
Class for user related exception handling in ILIAS.
static getInstance()
Singelton get instance.
static getInstance()
Single method to reduce footprint (included files, created instances)
static delDir($a_dir, $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
static getWebspaceDir($mode="filesystem")
get webspace directory
static execConvert($args)
execute convert command
static getDir($a_dir, $a_rec=false, $a_sub_dir="")
get directory
static now()
Return current timestamp in Y-m-d H:i:s format.
static deliverFile( $a_file, $a_filename, $a_mime='', $isInline=false, $removeAfterDelivery=false, $a_exit_after=true)
deliver file for download via browser.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static __extractId($ilias_id, $inst_id)
extract ref id from role title, e.g.
static signFile($path_to_file)
Tree handler for personal workspace.
for( $i=6;$i< 13;$i++) for($i=1; $i< 13; $i++) $d
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
update($pash, $contents, Config $config)
redirection script todo: (a better solution should control the processing via a xml file)
defined( 'APPLICATION_ENV')||define( 'APPLICATION_ENV'
if(!file_exists("$old.txt")) if( $old===$new) if(file_exists("$new.txt")) $file
foreach($_POST as $key=> $value) $res