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';
185 public function __construct($a_user_id = 0, $a_call_by_reference =
false)
197 parent::__construct($a_user_id, $a_call_by_reference);
198 $this->auth_mode =
"default";
207 if ($a_user_id > 0) {
208 $this->
setId($a_user_id);
213 $this->prefs = array();
215 $this->prefs[
"language"] = $this->
ilias->ini->readVariable(
"language",
"default");
218 $this->skin = $this->
ilias->ini->readVariable(
"layout",
"skin");
224 $this->prefs[
"style"] = $this->
ilias->ini->readVariable(
"layout",
"style");
244 $r =
$ilDB->queryF(
"SELECT * FROM usr_data " .
245 "WHERE usr_id= %s", array(
"integer"), array($this->
id));
266 if ($this->prefs[
"language"] ==
"") {
267 $this->prefs[
"language"] = $this->oldPrefs[
"language"];
271 include_once(
"./Services/Style/System/classes/class.ilStyleDefinition.php");
272 if ($this->prefs[
"skin"] ==
"" ||
274 $this->prefs[
"skin"] = $this->oldPrefs[
"skin"];
277 $this->skin = $this->prefs[
"skin"];
280 if ($this->prefs[
"style"] ==
"" ||
283 $this->prefs[
"style"] = $this->
ilias->ini->readVariable(
"layout",
"style");
286 if (empty($this->prefs[
"hits_per_page"])) {
287 $this->prefs[
"hits_per_page"] = 10;
290 $ilErr->raiseError(
"<b>Error: There is no dataset with id " .
291 $this->
id .
"!</b><br />class: " . get_class($this) .
"<br />Script: " . __FILE__ .
292 "<br />Line: " . __LINE__,
$ilErr->FATAL);
314 $this->password_encoding_type = $password_encryption_type;
348 if (!$a_data[
"passwd_type"]) {
349 $ilErr->raiseError(
"<b>Error: passwd_type missing in function assignData(). " .
350 $this->
id .
"!</b><br />class: " . get_class($this) .
"<br />Script: "
351 . __FILE__ .
"<br />Line: " . __LINE__,
$ilErr->FATAL);
353 if ($a_data[
"passwd"] !=
"********" and strlen($a_data[
'passwd'])) {
354 $this->
setPasswd($a_data[
"passwd"], $a_data[
"passwd_type"]);
362 if (!is_array($a_data[
'birthday'])) {
372 $this->
setCity($a_data[
"city"]);
379 $this->
setFax($a_data[
"fax"]);
398 $this->create_date = $a_data[
"create_date"];
399 $this->
setComment($a_data[
"referral_comment"]);
400 $this->approve_date = $a_data[
"approve_date"];
401 $this->active = $a_data[
"active"];
402 $this->agree_date = $a_data[
"agree_date"];
429 public function saveAsNew($a_from_formular =
true)
433 $ilAppEventHandler =
$DIC[
'ilAppEventHandler'];
444 switch ($this->passwd_type) {
446 if (strlen($this->passwd)) {
447 require_once
'Services/User/classes/class.ilUserPasswordManager.php';
460 $ilErr->raiseError(
"<b>Error: passwd_type missing in function saveAsNew. " .
461 $this->
id .
"!</b><br />class: " . get_class($this) .
"<br />Script: " . __FILE__ .
462 "<br />Line: " . __LINE__,
$ilErr->FATAL);
465 if (!$this->active) {
471 $insert_array = array(
472 "usr_id" => array(
"integer", $this->
id),
473 "login" => array(
"text", $this->login),
474 "passwd" => array(
"text", $pw_value),
477 "firstname" => array(
"text", $this->firstname),
478 "lastname" => array(
"text", $this->lastname),
479 "title" => array(
"text", $this->utitle),
480 "gender" => array(
"text", $this->gender),
481 "email" => array(
"text", trim($this->email)),
482 "second_email" => array(
"text", trim($this->second_email)),
483 "hobby" => array(
"text", (
string) $this->hobby),
484 "institution" => array(
"text", $this->institution),
485 "department" => array(
"text", $this->department),
486 "street" => array(
"text", $this->street),
487 "city" => array(
"text", $this->city),
488 "zipcode" => array(
"text", $this->zipcode),
489 "country" => array(
"text", $this->country),
490 "sel_country" => array(
"text", $this->sel_country),
491 "phone_office" => array(
"text", $this->phone_office),
492 "phone_home" => array(
"text", $this->phone_home),
493 "phone_mobile" => array(
"text", $this->phone_mobile),
494 "fax" => array(
"text", $this->fax),
496 "last_login" => array(
"timestamp",
null),
497 "first_login" => array(
"timestamp",
null),
498 "last_profile_prompt" => array(
"timestamp",
null),
499 "last_update" => array(
"timestamp",
ilUtil::now()),
500 "create_date" => array(
"timestamp",
ilUtil::now()),
501 "referral_comment" => array(
"text", $this->referral_comment),
502 "matriculation" => array(
"text", $this->matriculation),
503 "client_ip" => array(
"text", $this->client_ip),
504 "approve_date" => array(
"timestamp", $this->approve_date),
505 "agree_date" => array(
"timestamp", $this->agree_date),
506 "active" => array(
"integer", (
int) $this->active),
511 "auth_mode" => array(
"text", $this->
getAuthMode()),
514 "latitude" => array(
"text", $this->latitude),
515 "longitude" => array(
"text", $this->longitude),
516 "loc_zoom" => array(
"integer", (
int) $this->loc_zoom),
517 "last_password_change" => array(
"integer", (
int) $this->last_password_change_ts),
518 'inactivation_date' => array(
'timestamp', $this->inactivation_date),
519 'is_self_registered' => array(
'integer', (
int) $this->is_self_registered),
521 $ilDB->insert(
"usr_data", $insert_array);
531 include_once(
"Services/Mail/classes/class.ilMailbox.php");
533 $mbox->createDefaultFolder();
535 include_once
"Services/Mail/classes/class.ilMailOptions.php";
537 $mail_options->createMailOptionsEntry();
540 include_once
"./Services/Bookmarks/classes/class.ilBookmarkFolder.php";
542 $bmf->createNewBookmarkTree();
544 $ilAppEventHandler->raise(
547 array(
"user_obj" => $this)
565 $ilAppEventHandler =
$DIC[
'ilAppEventHandler'];
571 } elseif ($this->active) {
575 $update_array = array(
576 "gender" => array(
"text", $this->gender),
577 "title" => array(
"text", $this->utitle),
578 "firstname" => array(
"text", $this->firstname),
579 "lastname" => array(
"text", $this->lastname),
580 "email" => array(
"text", trim($this->email)),
581 "second_email" => array(
"text", trim($this->second_email)),
583 "hobby" => array(
"text", $this->hobby),
584 "institution" => array(
"text", $this->institution),
585 "department" => array(
"text", $this->department),
586 "street" => array(
"text", $this->street),
587 "city" => array(
"text", $this->city),
588 "zipcode" => array(
"text", $this->zipcode),
589 "country" => array(
"text", $this->country),
590 "sel_country" => array(
"text", $this->sel_country),
591 "phone_office" => array(
"text", $this->phone_office),
592 "phone_home" => array(
"text", $this->phone_home),
593 "phone_mobile" => array(
"text", $this->phone_mobile),
594 "fax" => array(
"text", $this->fax),
595 "referral_comment" => array(
"text", $this->referral_comment),
596 "matriculation" => array(
"text", $this->matriculation),
597 "client_ip" => array(
"text", $this->client_ip),
598 "approve_date" => array(
"timestamp", $this->approve_date),
599 "active" => array(
"integer", $this->active),
606 "auth_mode" => array(
"text", $this->
getAuthMode()),
608 "latitude" => array(
"text", $this->latitude),
609 "longitude" => array(
"text", $this->longitude),
610 "loc_zoom" => array(
"integer", (
int) $this->loc_zoom),
611 "last_password_change" => array(
"integer", $this->last_password_change_ts),
612 "last_update" => array(
"timestamp",
ilUtil::now()),
613 'inactivation_date' => array(
'timestamp', $this->inactivation_date)
616 if (isset($this->agree_date) && (strtotime($this->agree_date) !==
false || $this->agree_date ==
null)) {
617 $update_array[
"agree_date"] = array(
"timestamp", $this->agree_date);
619 switch ($this->passwd_type) {
621 if (strlen($this->passwd)) {
622 require_once
'Services/User/classes/class.ilUserPasswordManager.php';
624 $update_array[
'passwd'] = array(
'text', $this->
getPasswd());
626 $update_array[
"passwd"] = array(
"text", (
string) $this->passwd);
631 $update_array[
"passwd"] = array(
"text", (
string) $this->passwd);
635 $ilErr->raiseError(
"<b>Error: passwd_type missing in function update()" . $this->
id .
"!</b><br />class: " .
636 get_class($this) .
"<br />Script: " . __FILE__ .
"<br />Line: " . __LINE__,
$ilErr->FATAL);
640 $update_array[
'passwd_salt'] = array(
'text', $this->
getPasswordSalt());
642 $ilDB->update(
"usr_data", $update_array, array(
"usr_id" => array(
"integer", $this->
id)));
652 parent::updateOwner();
656 $ilAppEventHandler->raise(
659 array(
"user_obj" => $this)
674 $ilDB->manipulateF(
"UPDATE usr_data SET agree_date = " .
$ilDB->now() .
675 " WHERE usr_id = %s", array(
"integer"), array($this->
getId()));
681 private static function _lookup($a_user_id, $a_field)
688 "SELECT " . $a_field .
" FROM usr_data WHERE usr_id = %s",
694 return $set[$a_field];
708 $set =
$ilDB->queryF(
709 "SELECT title, firstname, lastname FROM usr_data WHERE usr_id = %s",
714 if ($rec =
$ilDB->fetchAssoc($set)) {
718 if ($rec[
"firstname"]) {
721 if ($rec[
"lastname"]) {
778 "SELECT firstname, lastname, title, login FROM usr_data WHERE usr_id = %s",
783 return array(
"user_id" => $a_user_id,
784 "firstname" => $user_rec[
"firstname"],
785 "lastname" => $user_rec[
"lastname"],
786 "title" => $user_rec[
"title"],
787 "login" => $user_rec[
"login"]);
800 "SELECT * FROM usr_data WHERE usr_id = %s",
833 if (!is_array($a_user_str)) {
835 "SELECT usr_id FROM usr_data WHERE login = %s",
840 return $user_rec[
"usr_id"];
843 "SELECT usr_id FROM usr_data " .
844 " WHERE " .
$ilDB->in(
"login", $a_user_str,
false,
"text")
847 while ($rec =
$ilDB->fetchAssoc($set)) {
848 $ids[] = $rec[
"usr_id"];
883 "UPDATE usr_data SET " .
884 "last_login = " .
$ilDB->now() .
885 " WHERE usr_id = %s",
892 "UPDATE usr_data SET " .
893 "first_login = " .
$ilDB->now() .
894 " WHERE usr_id = %s",
909 public function resetPassword($raw, $raw_retype)
918 if (func_num_args() != 2) {
922 if (!isset($raw) || !isset($raw_retype)) {
926 if ($raw != $raw_retype) {
930 require_once
'Services/User/classes/class.ilUserPasswordManager.php';
935 SET passwd = %s, passwd_enc_type = %s, passwd_salt = %s
937 array(
'text',
'text',
'text',
'integer'),
962 SELECT * FROM loginname_history
968 return $ilDB->fetchAssoc(
$res) ? true :
false;
989 $ilDB->setLimit(1, 0);
992 SELECT login, history_date FROM loginname_history
993 WHERE usr_id = %s ORDER BY history_date DESC',
998 if (!is_array(
$row) || !count(
$row)) {
1003 $row[
'login'],
$row[
'history_date']
1021 if (func_num_args() != 1) {
1025 if (!isset($a_login)) {
1032 if (0 == strcmp($a_login, $former_login)) {
1039 $last_history_entry =
null;
1043 if ((
int)
$ilSetting->get(
'allow_change_loginname') &&
1044 (
int)
$ilSetting->get(
'reuse_of_loginnames') == 0 &&
1045 self::_doesLoginnameExistInHistory($a_login)) {
1046 throw new ilUserException($this->lng->txt(
'loginname_already_exists'));
1047 } elseif ((
int)
$ilSetting->get(
'allow_change_loginname') &&
1048 (
int)
$ilSetting->get(
'loginname_change_blocking_time') &&
1049 is_array($last_history_entry) &&
1050 $last_history_entry[1] + (
int)
$ilSetting->get(
'loginname_change_blocking_time') > time()) {
1051 include_once
'Services/Calendar/classes/class.ilDate.php';
1054 $this->lng->txt(
'changing_loginname_not_possible_info'),
1065 if ((
int)
$ilSetting->get(
'allow_change_loginname') &&
1066 (
int)
$ilSetting->get(
'create_history_loginname')) {
1071 $this->login = $a_login;
1078 array(
'text',
'integer'),
1095 $this->
setPref($a_keyword, $a_value);
1106 self::_deletePref($this->
getId(), $a_keyword);
1114 public static function _deletePref($a_user_id, $a_keyword)
1124 'DELETE FROM usr_pref WHERE usr_id = %s AND keyword = %s',
1125 array(
'integer',
'text'),
1126 array($a_user_id, $a_keyword)
1142 "DELETE FROM usr_pref WHERE usr_id = %s",
1154 public static function _writePref($a_usr_id, $a_keyword, $a_value)
1162 "usr_id" => array(
"integer", $a_usr_id),
1163 "keyword" => array(
"text", $a_keyword),
1166 "value" => array(
"text",$a_value)
1193 foreach ($this->prefs as $keyword => $value) {
1209 include_once(
'Services/Calendar/classes/class.ilCalendarSettings.php');
1211 return $settings->getDefaultTimeZone();
1226 include_once(
'Services/Calendar/classes/class.ilCalendarSettings.php');
1228 return $settings->getDefaultTimeFormat();
1243 include_once(
'Services/Calendar/classes/class.ilCalendarSettings.php');
1245 return $settings->getDefaultDateFormat();
1257 if ($a_keyword !=
"") {
1258 $this->prefs[$a_keyword] = $a_value;
1269 if (array_key_exists($a_keyword, $this->prefs)) {
1270 return $this->prefs[$a_keyword];
1282 $query =
"SELECT * FROM usr_pref WHERE usr_id = " .
$ilDB->quote($a_usr_id,
"integer") .
" " .
1283 "AND keyword = " .
$ilDB->quote($a_keyword,
"text");
1302 if (is_array($this->prefs)) {
1314 public function delete()
1322 include_once(
'Services/LDAP/classes/class.ilLDAPRoleGroupMapping.php');
1324 $mapping->deleteUser($this->
getId());
1327 include_once(
"Services/Mail/classes/class.ilMailbox.php");
1330 $mailbox->updateMailsOfDeletedUser($this->
getLogin());
1333 include_once(
"./Services/Block/classes/class.ilCustomBlock.php");
1335 $costum_block->setContextObjId($this->
getId());
1336 $costum_block->setContextObjType(
"user");
1337 $c_blocks = $costum_block->queryBlocksForContext();
1338 include_once(
"./Services/Feeds/classes/class.ilPDExternalFeedBlock.php");
1339 foreach ($c_blocks as $c_block) {
1340 if ($c_block[
"type"] ==
"pdfeed") {
1348 include_once(
"./Services/Block/classes/class.ilBlockSetting.php");
1353 "DELETE FROM usr_data WHERE usr_id = %s",
1355 array($this->
getId())
1366 include_once(
"./Services/Authentication/classes/class.ilSession.php");
1374 $q =
"DELETE FROM bookmark_tree WHERE tree = " .
1376 $ilDB->manipulate($q);
1378 $q =
"DELETE FROM bookmark_data WHERE user_id = " .
1380 $ilDB->manipulate($q);
1383 include_once
'./Modules/Forum/classes/class.ilObjForum.php';
1387 include_once
'./Services/LinkChecker/classes/class.ilLinkCheckNotify.php';
1391 include_once
'./Modules/Course/classes/class.ilObjCourse.php';
1395 include_once
'./Services/Tracking/classes/class.ilObjUserTracking.php';
1398 include_once
'Modules/Session/classes/class.ilEventParticipants.php';
1402 include_once
'Modules/Scorm2004/classes/ilSCORM13Package.php';
1406 include_once
'Modules/ScormAicc/classes/class.ilObjSCORMLearningModule.php';
1410 include_once
"./Services/Notification/classes/class.ilNotification.php";
1414 include_once
"./Modules/Portfolio/classes/class.ilObjPortfolio.php";
1418 include_once
"./Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
1420 $tree->cascadingDelete();
1423 include_once
"./Services/DiskQuota/classes/class.ilDiskQuotaHandler.php";
1427 require_once
'Services/User/classes/class.ilCronDeleteInactiveUserReminderMail.php';
1431 include_once
"Services/Badge/classes/class.ilBadgeAssignment.php";
1436 $ilOrgUnitUserAssignmentQueries->deleteAllAssignmentsOfUser($this->
getId());
1450 $ilAppEventHandler =
$DIC[
'ilAppEventHandler'];
1451 $ilAppEventHandler->raise(
1454 array(
'usr_id' => $this->
getId())
1471 public function setFullname($a_title =
"", $a_firstname =
"", $a_lastname =
"")
1473 $this->fullname =
"";
1477 } elseif ($this->utitle) {
1478 $this->fullname = $this->utitle .
" ";
1483 } elseif ($this->firstname) {
1484 $this->fullname .= $this->firstname .
" ";
1510 if (!$a_max_strlen) {
1514 if (strlen($this->fullname) <= $a_max_strlen) {
1518 if ((strlen($this->utitle) + strlen($this->lastname) + 4) <= $a_max_strlen) {
1519 return ilUtil::stripSlashes($this->utitle .
" " . substr($this->firstname, 0, 1) .
". " . $this->lastname);
1522 if ((strlen($this->firstname) + strlen($this->lastname) + 1) <= $a_max_strlen) {
1526 if ((strlen($this->lastname) + 3) <= $a_max_strlen) {
1540 $this->login = $a_str;
1559 $this->passwd = $a_str;
1592 $this->gender = substr($a_str, -1);
1613 $this->utitle = $a_str;
1634 $this->firstname = $a_str;
1653 $this->lastname = $a_str;
1672 $this->institution = $a_str;
1691 $this->department = $a_str;
1710 $this->street = $a_str;
1729 $this->city = $a_str;
1748 $this->zipcode = $a_str;
1768 $this->country = $a_str;
1788 $this->sel_country = $a_val;
1808 $this->phone_office = $a_str;
1827 $this->phone_home = $a_str;
1846 $this->phone_mobile = $a_str;
1865 $this->fax = $a_str;
1884 $this->client_ip = $a_str;
1903 $this->matriculation = $a_str;
1927 $query =
"SELECT matriculation FROM usr_data " .
1928 "WHERE usr_id = " .
$ilDB->quote($a_usr_id);
1931 return $row->matriculation ?
$row->matriculation :
'';
1941 $this->email = $a_str;
1976 $this->hobby = $a_str;
1995 $this->
setPref(
"language", $a_str);
2006 return $this->prefs[
"language"];
2019 $this->
setPref(
"disk_quota", $a_disk_quota);
2033 return $this->prefs[
"disk_quota"] ? $this->prefs[
"disk_quota"] : 0;
2038 return $this->prefs[
"wsp_disk_quota"] ? $this->prefs[
"wsp_disk_quota"] : 0;
2043 $this->last_password_change_ts = $a_last_password_change_ts;
2059 $q =
"SELECT value FROM usr_pref WHERE usr_id= " .
2060 $ilDB->quote($a_usr_id,
"integer") .
" AND keyword = " .
2061 $ilDB->quote(
'language',
"text");
2065 return $row[
'value'];
2067 if (is_object(
$lng)) {
2068 return $lng->getDefaultLanguage();
2080 "UPDATE usr_data " .
2081 " SET ext_account = %s WHERE usr_id = %s",
2082 array(
"text",
"integer"),
2083 array($a_ext_id, $a_usr_id)
2094 "UPDATE usr_data " .
2095 " SET auth_mode = %s WHERE usr_id = %s",
2096 array(
"text",
"integer"),
2097 array($a_auth_mode, $a_usr_id)
2127 $this->last_login = $a_str;
2137 return $this->last_login;
2146 $this->first_login = $a_str;
2164 $this->last_profile_prompt = $a_str;
2183 $this->last_update = $a_str;
2197 $this->referral_comment = $a_str;
2217 $this->approve_date = $a_str;
2248 $this->agree_date = $a_str;
2290 $query =
'SELECT usr_id FROM usr_data ' .
2291 'WHERE active = ' .
$ilDB->quote(1,
'integer') .
' ' .
2292 'AND usr_id = ' .
$ilDB->quote($a_usr_id,
'integer');
2313 if ($this->active) {
2317 if ((!empty($storedActive) && empty($currentActive)) ||
2318 (empty($storedActive) && !empty($currentActive))) {
2332 return $active ? true :
false;
2343 $this->skin = $a_str;
2348 $this->time_limit_owner = $a_owner;
2352 return $this->time_limit_owner ? $this->time_limit_owner : 7;
2356 $this->time_limit_from = $a_from;
2360 return $this->time_limit_from;
2364 $this->time_limit_until = $a_until;
2368 return $this->time_limit_until;
2372 $this->time_limit_unlimited = $a_unlimited;
2376 return $this->time_limit_unlimited;
2380 return $this->time_limit_message = $a_time_limit_message;
2384 return $this->time_limit_message;
2389 $this->login_attempts = $a_login_attempts;
2410 $this->profile_incomplete = (boolean) $a_prof_inc;
2414 if ($this->
id == ANONYMOUS_USER_ID) {
2417 return $this->profile_incomplete;
2425 if ($this->
id == ANONYMOUS_USER_ID) {
2429 if ($this->
id == SYSTEM_USER_ID) {
2430 require_once
'./Services/User/classes/class.ilUserPasswordManager.php';
2441 require_once(
'./Services/PrivacySecurity/classes/class.ilSecuritySettings.php');
2446 $security->isPasswordChangeOnFirstLoginEnabled() &&
2447 $this->getLastPasswordChangeTS() == 0 &&
2448 $this->is_self_registered ==
false
2458 if ($this->
id == ANONYMOUS_USER_ID) {
2462 require_once(
'./Services/PrivacySecurity/classes/class.ilSecuritySettings.php');
2465 $max_pass_age = $security->getPasswordMaxAge();
2466 if ($max_pass_age > 0) {
2467 $max_pass_age_ts = ($max_pass_age * 86400);
2469 $current_ts = time();
2471 if (($current_ts - $pass_change_ts) > $max_pass_age_ts) {
2484 $current_ts = time();
2486 $password_age = (int) (($current_ts - $pass_change_ts) / 86400);
2487 return $password_age;
2498 $query =
"UPDATE usr_data SET last_password_change = %s " .
2499 "WHERE usr_id = %s";
2500 $affected =
$ilDB->manipulateF(
2502 array(
'integer',
'integer'),
2518 $query =
"UPDATE usr_data SET last_password_change = 0 " .
2519 "WHERE usr_id = %s";
2520 $affected =
$ilDB->manipulateF(
2523 array($this->
getId())
2539 $this->latitude = $a_latitude;
2559 $this->longitude = $a_longitude;
2579 $this->loc_zoom = $a_locationzoom;
2604 $set =
$ilDB->queryf(
2606 SELECT COUNT(*) session_count
2607 FROM usr_session WHERE user_id = %s AND expires > %s AND session_id != %s ',
2608 array(
'integer',
'integer',
'text'),
2609 array($a_user_id, time(), $a_session_id)
2612 return (
bool)
$row[
'session_count'];
2638 $uid =
$GLOBALS[
'DIC'][
'ilAuthSession']->getUserId();
2642 require_once(
'Services/WebDAV/classes/class.ilDAVActivationChecker.php');
2659 $pos = strrpos($a_login,
'/');
2660 $pos2 = strrpos($a_login,
'\\');
2661 if ($pos ===
false || $pos < $pos2) {
2664 if ($pos !==
false) {
2665 $a_login = substr($a_login, $pos + 1);
2682 $set =
$ilDB->queryF(
2683 "SELECT active FROM usr_data WHERE login= %s",
2688 if ($rec =
$ilDB->fetchAssoc($set)) {
2689 if ($rec[
"active"]) {
2726 "SELECT usr_id FROM usr_data " .
2727 "WHERE email = %s and active = 1",
2733 $ids[] =
$row->usr_id;
2753 "SELECT login FROM usr_data " .
2754 "WHERE email = %s and active = 1",
2760 $ids[] =
$row->login;
2790 public static function searchUsers($a_search_str,
$active = 1, $a_return_ids_only =
false, $filter_settings =
false)
2799 $query =
"SELECT usr_data.usr_id, usr_data.login, usr_data.firstname, usr_data.lastname, usr_data.email, usr_data.active FROM usr_data ";
2801 $without_anonymous_users =
true;
2804 $join_filter =
" WHERE ";
2805 if ($filter_settings !==
false && strlen($filter_settings)) {
2806 switch ($filter_settings) {
2809 $join_filter =
" LEFT JOIN obj_members ON usr_data.usr_id = obj_members.usr_id WHERE obj_members.usr_id IS NULL AND ";
2815 $join_filter =
" LEFT JOIN obj_members ON usr_data.usr_id = obj_members.usr_id WHERE obj_members.obj_id = " .
2816 "(SELECT obj_id FROM object_reference WHERE ref_id = " .
$ilDB->quote(
$ref_id,
"integer") .
") AND ";
2826 if (is_array($local_roles) && count($local_roles)) {
2827 $join_filter =
" LEFT JOIN rbac_ua ON usr_data.usr_id = rbac_ua.usr_id WHERE " .
2828 $ilDB->in(
"rbac_ua.rol_id", $local_roles,
false, $local_roles) .
" AND ";
2836 $rol_id =
$_SESSION[
"user_filter_data"];
2838 $join_filter =
" LEFT JOIN rbac_ua ON usr_data.usr_id = rbac_ua.usr_id WHERE rbac_ua.rol_id = " .
2839 $ilDB->quote($rol_id,
"integer") .
" AND ";
2840 $without_anonymous_users =
false;
2847 if (strtolower(substr($a_search_str, 0, 5)) ==
"role:") {
2848 $query =
"SELECT DISTINCT usr_data.usr_id,usr_data.login,usr_data.firstname,usr_data.lastname,usr_data.email " .
2849 "FROM object_data,rbac_ua,usr_data " .
2850 "WHERE " .
$ilDB->like(
"object_data.title",
"text",
"%" . substr($a_search_str, 5) .
"%") .
2851 " AND object_data.type = 'role' " .
2852 "AND rbac_ua.rol_id = object_data.obj_id " .
2853 "AND usr_data.usr_id = rbac_ua.usr_id " .
2854 "AND rbac_ua.usr_id != " .
$ilDB->quote(ANONYMOUS_USER_ID,
"integer");
2857 "(" .
$ilDB->like(
"usr_data.login",
"text",
"%" . $a_search_str .
"%") .
" " .
2858 "OR " .
$ilDB->like(
"usr_data.firstname",
"text",
"%" . $a_search_str .
"%") .
" " .
2859 "OR " .
$ilDB->like(
"usr_data.lastname",
"text",
"%" . $a_search_str .
"%") .
" " .
2860 "OR " .
$ilDB->like(
"usr_data.email",
"text",
"%" . $a_search_str .
"%") .
") ";
2862 if ($filter_settings !==
false && strlen($filter_settings)) {
2863 switch ($filter_settings) {
2865 $query .=
" AND usr_data.active = " .
$ilDB->quote(0,
"integer") .
" ";
2868 $query .=
" AND usr_data.active = " .
$ilDB->quote(1,
"integer") .
" ";
2871 $query .=
" AND usr_data.time_limit_unlimited = " .
$ilDB->quote(0,
"integer") .
" ";
2874 $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"]));
2875 $query .=
" AND last_login < " .
$ilDB->quote($date,
"timestamp") .
" ";
2880 if ($without_anonymous_users) {
2881 $query .=
"AND usr_data.usr_id != " .
$ilDB->quote(ANONYMOUS_USER_ID,
"integer");
2884 if (is_numeric(
$active) &&
$active > -1 && $filter_settings ===
false) {
2892 "usr_id" =>
$row->usr_id,
2893 "login" =>
$row->login,
2894 "firstname" =>
$row->firstname,
2895 "lastname" =>
$row->lastname,
2896 "email" =>
$row->email,
2897 "active" =>
$row->active);
2898 $ids[] =
$row->usr_id;
2900 if ($a_return_ids_only) {
2901 return $ids ? $ids : array();
2910 public static function getAllUserLogins()
2922 "SELECT login FROM usr_data WHERE " .
$ilDB->in(
'usr_id', array(ANONYMOUS_USER_ID),
true,
'integer')
2925 $logins[] =
$row[
'login'];
2944 $res =
$ilDB->query(
"SELECT * FROM usr_data WHERE " .
2945 $ilDB->in(
"usr_id", $a_user_ids,
false,
"integer"));
2947 $user_data[
"$row[usr_id]"] =
$row;
2949 return $user_data ? $user_data : array();
2966 $result_arr = array();
2970 if ($a_fields !==
null and is_array($a_fields)) {
2971 if (count($a_fields) == 0) {
2974 if (($usr_id_field = array_search(
"usr_id", $a_fields)) !==
false) {
2975 unset($a_fields[$usr_id_field]);
2978 $select = implode(
",", $a_fields) .
",usr_data.usr_id";
2980 if (in_array(
'online_time', $a_fields)) {
2981 $select .=
",ut_online.online_time ";
2985 $q =
"SELECT " . $select .
" FROM usr_data ";
2989 if (in_array(
'online_time', $a_fields)) {
2990 $q .=
"LEFT JOIN ut_online ON usr_data.usr_id = ut_online.usr_id ";
2996 $q .=
"WHERE active = " .
$ilDB->quote(
$active,
"integer");
2999 $q .=
"WHERE time_limit_unlimited= " .
$ilDB->quote(0,
"integer");;
3002 $qtemp = $q .
", rbac_ua, object_data WHERE rbac_ua.rol_id = object_data.obj_id AND " .
3003 $ilDB->like(
"object_data.title",
"text",
"%crs%") .
" AND usr_data.usr_id = rbac_ua.usr_id";
3005 $course_users = array();
3007 array_push($course_users,
$row[
"usr_id"]);
3009 if (count($course_users)) {
3010 $q .=
" WHERE " .
$ilDB->in(
"usr_data.usr_id", $course_users,
true,
"integer") .
" ";
3016 $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"]));
3017 $q .=
" AND last_login < " .
$ilDB->quote($date,
"timestamp");
3022 $q .=
" LEFT JOIN obj_members ON usr_data.usr_id = obj_members.usr_id " .
3023 "WHERE obj_members.obj_id = (SELECT obj_id FROM object_reference " .
3024 "WHERE ref_id = " .
$ilDB->quote(
$ref_id,
"integer") .
") ";
3034 if (is_array($local_roles) && count($local_roles)) {
3035 $q .=
" LEFT JOIN rbac_ua ON usr_data.usr_id = rbac_ua.usr_id WHERE " .
3036 $ilDB->in(
"rbac_ua.rol_id", $local_roles,
false,
"integer") .
" ";
3041 $rol_id =
$_SESSION[
"user_filter_data"];
3043 $q .=
" LEFT JOIN rbac_ua ON usr_data.usr_id = rbac_ua.usr_id WHERE rbac_ua.rol_id = " .
3044 $ilDB->quote($rol_id,
"integer");
3051 $result_arr[] =
$row;
3067 $q =
"SELECT count(*) as cnt FROM usr_pref up1, usr_pref up2 " .
3068 " WHERE up1.keyword= " .
$ilDB->quote(
"style",
"text") .
3069 " AND up1.value= " .
$ilDB->quote($a_style,
"text") .
3070 " AND up2.keyword= " .
$ilDB->quote(
"skin",
"text") .
3071 " AND up2.value= " .
$ilDB->quote($a_skin,
"text") .
3072 " AND up1.usr_id = up2.usr_id ";
3074 $cnt_set =
$ilDB->query($q);
3076 $cnt_rec =
$ilDB->fetchAssoc($cnt_set);
3078 return $cnt_rec[
"cnt"];
3090 $q =
"SELECT DISTINCT up1.value style, up2.value skin FROM usr_pref up1, usr_pref up2 " .
3091 " WHERE up1.keyword = " .
$ilDB->quote(
"style",
"text") .
3092 " AND up2.keyword = " .
$ilDB->quote(
"skin",
"text") .
3093 " AND up1.usr_id = up2.usr_id";
3095 $sty_set =
$ilDB->query($q);
3098 while ($sty_rec =
$ilDB->fetchAssoc($sty_set)) {
3099 $styles[] = $sty_rec[
"skin"] .
":" . $sty_rec[
"style"];
3114 $q =
"SELECT up1.usr_id usr_id FROM usr_pref up1, usr_pref up2 " .
3115 " WHERE up1.keyword= " .
$ilDB->quote(
"style",
"text") .
3116 " AND up1.value= " .
$ilDB->quote($a_from_style,
"text") .
3117 " AND up2.keyword= " .
$ilDB->quote(
"skin",
"text") .
3118 " AND up2.value= " .
$ilDB->quote($a_from_skin,
"text") .
3119 " AND up1.usr_id = up2.usr_id ";
3121 $usr_set =
$ilDB->query($q);
3123 while ($usr_rec =
$ilDB->fetchAssoc($usr_set)) {
3145 $item_set =
$ilDB->queryF(
3146 "SELECT * FROM desktop_item WHERE " .
3147 "item_id = %s AND type = %s AND user_id = %s",
3148 array(
"integer",
"text",
"integer"),
3149 array($a_item_id,
$a_type, $a_usr_id)
3153 if (!
$ilDB->fetchAssoc($item_set)) {
3155 "INSERT INTO desktop_item (item_id, type, user_id, parameters) VALUES " .
3157 array(
"integer",
"text",
"integer",
"text"),
3158 array($a_item_id,
$a_type,$a_usr_id,$a_par)
3162 include_once
'./Services/Calendar/classes/class.ilCalendarCategories.php';
3193 "UPDATE desktop_item SET parameters = %s " .
3194 " WHERE item_id = %s AND type = %s AND user_id = %s",
3195 array(
"text",
"integer",
"text",
"integer"),
3217 "DELETE FROM desktop_item WHERE " .
3218 " item_id = %s AND type = %s AND user_id = %s",
3219 array(
"integer",
"text",
"integer"),
3220 array($a_item_id,
$a_type, $a_usr_id)
3223 include_once
'./Services/Calendar/classes/class.ilCalendarCategories.php';
3252 "SELECT user_id FROM desktop_item WHERE item_id = %s",
3265 "DELETE FROM desktop_item WHERE item_id = %s",
3289 if (self::$is_desktop_item_loaded[$a_usr_id .
":" . $a_item_id]) {
3290 return self::$is_desktop_item_cache[$a_usr_id .
":" . $a_item_id .
":" .
$a_type];
3292 $item_set =
$ilDB->queryF(
3293 "SELECT item_id FROM desktop_item WHERE " .
3294 "item_id = %s AND type = %s AND user_id = %s",
3295 array(
"integer",
"text",
"integer"),
3296 array($a_item_id,
$a_type, $a_usr_id)
3299 if (
$ilDB->fetchAssoc($item_set)) {
3318 if (!is_array($a_item_ids)) {
3322 $item_ids = array();
3323 foreach ($a_item_ids as
$id) {
3324 if (!self::$is_desktop_item_loaded[$a_usr_id .
":" .
$id]) {
3327 self::$is_desktop_item_loaded[$a_usr_id .
":" .
$id] =
true;
3330 if (count($item_ids) > 0) {
3331 $item_set =
$ilDB->query(
"SELECT item_id, type FROM desktop_item WHERE " .
3332 $ilDB->in(
"item_id", $item_ids,
false,
"integer") .
3333 " AND user_id = " .
$ilDB->quote($a_usr_id,
"integer"));
3334 while (
$r =
$ilDB->fetchAssoc($item_set)) {
3335 self::$is_desktop_item_cache[$a_usr_id .
":" .
$r[
"item_id"] .
":" .
$r[
"type"]]
3369 $rbacsystem =
$DIC[
'rbacsystem'];
3373 if ($a_types ==
"") {
3376 $item_set =
$ilDB->queryF(
"SELECT obj.obj_id, obj.description, oref.ref_id, obj.title, obj.type " .
3377 " FROM desktop_item it, object_reference oref " .
3378 ", object_data obj" .
3380 "it.item_id = oref.ref_id AND " .
3381 "oref.obj_id = obj.obj_id AND " .
3382 "it.user_id = %s", array(
"integer"), array($user_id));
3383 $items = $all_parent_path = array();
3384 while ($item_rec =
$ilDB->fetchAssoc($item_set)) {
3385 if (
$tree->isInTree($item_rec[
"ref_id"])
3386 && $item_rec[
"type"] !=
"rolf"
3387 && $item_rec[
"type"] !=
"itgr") {
3388 $parent_ref =
$tree->getParentId($item_rec[
"ref_id"]);
3390 if (!isset($all_parent_path[$parent_ref])) {
3399 if ($parent_ref > 0) {
3400 $node =
$tree->getNodeData($parent_ref);
3401 $all_parent_path[$parent_ref] = $node[
"title"];
3403 $all_parent_path[$parent_ref] =
"";
3408 $parent_path = $all_parent_path[$parent_ref];
3412 $items[$parent_path .
$title . $item_rec[
"ref_id"]] =
3413 array(
"ref_id" => $item_rec[
"ref_id"],
3414 "obj_id" => $item_rec[
"obj_id"],
3415 "type" => $item_rec[
"type"],
3417 "description" =>
$desc,
3418 "parent_ref" => $parent_ref);
3424 if (!is_array($a_types)) {
3425 $a_types = array($a_types);
3428 $foundsurveys = array();
3429 foreach ($a_types as
$a_type) {
3433 $item_set =
$ilDB->queryF(
3434 "SELECT obj.obj_id, obj.description, oref.ref_id, obj.title FROM desktop_item it, object_reference oref " .
3435 ", object_data obj WHERE " .
3436 "it.item_id = oref.ref_id AND " .
3437 "oref.obj_id = obj.obj_id AND " .
3438 "it.type = %s AND " .
3439 "it.user_id = %s " .
3441 array(
"text",
"integer"),
3445 while ($item_rec =
$ilDB->fetchAssoc($item_set)) {
3449 array(
"ref_id" => $item_rec[
"ref_id"],
3450 "obj_id" => $item_rec[
"obj_id"],
"type" =>
$a_type,
3486 $a_time = date(
"Y-m-d H:i:s", time());
3489 $item_set =
$ilDB->queryF(
3490 "SELECT * FROM personal_clipboard WHERE " .
3491 "parent = %s AND item_id = %s AND type = %s AND user_id = %s",
3492 array(
"integer",
"integer",
"text",
"integer"),
3497 if (!
$d = $item_set->fetchRow()) {
3499 "INSERT INTO personal_clipboard " .
3500 "(item_id, type, user_id, title, parent, insert_time, order_nr) VALUES " .
3501 " (%s,%s,%s,%s,%s,%s,%s)",
3502 array(
"integer",
"text",
"integer",
"text",
"integer",
"timestamp",
"integer"),
3503 array($a_item_id,
$a_type, $this->
getId(), $a_title, (
int) $a_parent, $a_time, (
int) $a_order_nr)
3507 "UPDATE personal_clipboard SET insert_time = %s " .
3508 "WHERE user_id = %s AND item_id = %s AND type = %s AND parent = 0",
3509 array(
"timestamp",
"integer",
"integer",
"text"),
3524 $a_time = date(
"Y-m-d H:i:s", time());
3526 $ilDB->insert(
"personal_pc_clipboard", array(
3527 "user_id" => array(
"integer", $this->
getId()),
3529 "insert_time" => array(
"timestamp", $a_time),
3530 "order_nr" => array(
"integer", $a_nr)
3543 $set =
$ilDB->queryF(
"SELECT MAX(insert_time) mtime FROM personal_pc_clipboard " .
3544 " WHERE user_id = %s", array(
"integer"), array($this->
getId()));
3547 $set =
$ilDB->queryF(
3548 "SELECT * FROM personal_pc_clipboard " .
3549 " WHERE user_id = %s AND insert_time = %s ORDER BY order_nr ASC",
3550 array(
"integer",
"timestamp"),
3554 while (
$row =
$ilDB->fetchAssoc($set)) {
3555 $content[] =
$row[
"content"];
3570 $set =
$ilDB->queryF(
3571 "SELECT * FROM personal_clipboard WHERE " .
3572 "parent = %s AND type = %s AND user_id = %s",
3573 array(
"integer",
"text",
"integer"),
3576 if ($rec =
$ilDB->fetchAssoc($set)) {
3593 "DELETE FROM personal_clipboard WHERE " .
3594 "type = %s AND user_id = %s",
3595 array(
"text",
"integer"),
3609 $ilDB->manipulateF(
"DELETE FROM personal_clipboard WHERE " .
3610 "user_id = %s", array(
"integer"), array($this->
getId()));
3623 if ($a_top_nodes_only) {
3624 $par =
" AND parent = " .
$ilDB->quote(0,
"integer") .
" ";
3630 $q =
"SELECT * FROM personal_clipboard WHERE " .
3631 "user_id = " .
$ilDB->quote($this->
getId(),
"integer") .
" " .
3633 " ORDER BY order_nr";
3634 $objs =
$ilDB->query($q);
3636 while ($obj =
$ilDB->fetchAssoc($objs)) {
3637 if ($obj[
"type"] ==
"mob") {
3640 if ($obj[
"type"] ==
"incl") {
3641 include_once(
"./Modules/MediaPool/classes/class.ilMediaPoolPage.php");
3644 $objects[] = array(
"id" => $obj[
"item_id"],
3645 "type" => $obj[
"type"],
"title" => $obj[
"title"],
3646 "insert_time" => $obj[
"insert_time"]);
3661 $objs =
$ilDB->queryF(
3662 "SELECT * FROM personal_clipboard WHERE " .
3663 "user_id = %s AND parent = %s AND insert_time = %s " .
3664 " ORDER BY order_nr",
3665 array(
"integer",
"integer",
"timestamp"),
3666 array(
$ilUser->getId(), (
int) $a_parent, $a_insert_time)
3669 while ($obj =
$ilDB->fetchAssoc($objs)) {
3670 if ($obj[
"type"] ==
"mob") {
3673 $objects[] = array(
"id" => $obj[
"item_id"],
3674 "type" => $obj[
"type"],
"title" => $obj[
"title"],
"insert_time" => $obj[
"insert_time"]);
3693 $q =
"SELECT DISTINCT user_id FROM personal_clipboard WHERE " .
3694 "item_id = " .
$ilDB->quote($a_id,
"integer") .
" AND " .
3696 $user_set =
$ilDB->query($q);
3698 while ($user_rec =
$ilDB->fetchAssoc($user_set)) {
3699 $users[] = $user_rec[
"user_id"];
3718 $q =
"DELETE FROM personal_clipboard WHERE " .
3719 "item_id = " .
$ilDB->quote($a_item_id,
"integer") .
3721 " AND user_id = " .
$ilDB->quote($this->
getId(),
"integer");
3722 $ilDB->manipulate($q);
3731 $query =
"SELECT obj_id FROM object_data WHERE import_id = " .
3732 $ilDB->quote($i2_id,
"text");
3748 require_once(
'./Modules/OrgUnit/classes/PathStorage/class.ilOrgUnitPathStorage.php');
3749 return ilOrgUnitPathStorage::getTextRepresentationOfUsersOrgUnits($a_usr_id);
3768 $this->auth_mode = $a_str;
3781 include_once(
'./Services/Authentication/classes/class.ilAuthUtils.php');
3794 $this->ext_account = $a_str;
3806 return $this->ext_account;
3827 include_once(
'./Services/Authentication/classes/class.ilAuthUtils.php');
3828 $q =
"SELECT login,usr_id,ext_account,auth_mode FROM usr_data " .
3829 "WHERE auth_mode = %s";
3833 $q .=
" OR auth_mode = %s ";
3840 if (
$row->auth_mode ==
'default') {
3841 $accounts[
$row->usr_id] =
$row->login;
3843 $accounts[
$row->usr_id] =
$row->ext_account;
3846 return $accounts ? $accounts : array();
3862 if (!is_array($a_usr_ids)) {
3868 $q =
"UPDATE usr_data SET active = 1, inactivation_date = NULL WHERE " .
3869 $ilDB->in(
"usr_id", $a_usr_ids,
false,
"integer");
3870 $ilDB->manipulate($q);
3872 $usrId_IN_usrIds =
$ilDB->in(
"usr_id", $a_usr_ids,
false,
"integer");
3874 $q =
"UPDATE usr_data SET active = 0 WHERE $usrId_IN_usrIds";
3875 $ilDB->manipulate($q);
3879 SET inactivation_date = %s
3880 WHERE inactivation_date IS NULL
3881 AND $usrId_IN_usrIds
3883 $ilDB->manipulateF($queryString, array(
'timestamp'), array(
ilUtil::now()));
3912 $settings =
$GLOBALS[
'DIC']->settings();
3916 "SELECT * FROM usr_data WHERE " .
3917 " ext_account = %s AND auth_mode = %s",
3918 array(
"text",
"text"),
3919 array($a_account, $a_auth)
3921 if ($usr =
$db->fetchAssoc(
$r)) {
3922 return $usr[
"login"];
3925 if (!$tryFallback) {
3931 "SELECT login FROM usr_data " .
3932 "WHERE login = %s AND auth_mode = %s AND (ext_account IS NULL OR ext_account = '') ",
3933 array(
"text",
"text"),
3934 array($a_account, $a_auth)
3936 if ($usr =
$db->fetchAssoc(
$res)) {
3937 return $usr[
'login'];
3943 "SELECT login FROM usr_data WHERE " .
3944 " ext_account = %s AND auth_mode = %s",
3945 array(
"text",
"text"),
3946 array($a_account,
"default")
3948 if ($usr =
$db->fetchAssoc(
$res)) {
3949 return $usr[
"login"];
3953 "SELECT login FROM usr_data " .
3954 "WHERE login = %s AND (ext_account IS NULL OR ext_account = '') AND auth_mode = %s",
3955 array(
"text",
"text"),
3956 array($a_account,
"default")
3958 if ($usr =
$db->fetchAssoc(
$res)) {
3959 return $usr[
"login"];
3974 $r =
$ilDB->query(
"SELECT count(*) AS cnt, auth_mode FROM usr_data " .
3975 "GROUP BY auth_mode");
3977 while ($cnt =
$ilDB->fetchAssoc(
$r)) {
3978 $cnt_arr[$cnt[
"auth_mode"]] = $cnt[
"cnt"];
3998 $q =
"SELECT * FROM usr_data WHERE " .
3999 " email = %s AND (auth_mode = %s ";
4000 $types = array(
"text",
"text");
4001 $values = array($a_email,
"local");
4004 $q .=
" OR auth_mode = %s";
4013 while ($usr_rec =
$ilDB->fetchAssoc($usr_set)) {
4014 $users[$usr_rec[
"usr_id"]] = $usr_rec[
"login"];
4031 $image_dir = $webspace_dir .
"/usr_images";
4032 $store_file =
"usr_" . $obj_id .
"." .
"jpg";
4033 $target_file = $image_dir .
"/$store_file";
4035 chmod($tmp_file, 0770);
4039 $show_file =
"$image_dir/usr_" . $obj_id .
".jpg";
4040 $thumb_file =
"$image_dir/usr_" . $obj_id .
"_small.jpg";
4041 $xthumb_file =
"$image_dir/usr_" . $obj_id .
"_xsmall.jpg";
4042 $xxthumb_file =
"$image_dir/usr_" . $obj_id .
"_xxsmall.jpg";
4045 ilUtil::execConvert($tmp_file .
"[0] -geometry 100x100 -quality 100 JPEG:" . $thumb_file);
4047 ilUtil::execConvert($tmp_file .
"[0] -geometry 30x30 -quality 100 JPEG:" . $xxthumb_file);
4066 if (isset(self::$personal_image_cache[$this->
getId()][$a_size][(
int) $a_force_pic])) {
4067 return self::$personal_image_cache[$this->
getId()][$a_size][(int) $a_force_pic];
4070 self::$personal_image_cache[$this->
getId()][$a_size][(int) $a_force_pic] = ilObjUser::_getPersonalPicturePath($this->
getId(), $a_size, $a_force_pic);
4072 return self::$personal_image_cache[$this->
getId()][$a_size][(int) $a_force_pic];
4084 public static function _getPersonalPicturePath(
4087 $a_force_pic =
false,
4088 $a_prevent_no_photo_image =
false
4093 $upload = $profile =
false;
4095 $in =
$DIC->database()->in(
'usr_pref.keyword', array(
'public_upload',
'public_profile'),
false,
'text');
4098 SELECT usr_pref.*, ud.login, ud.firstname, ud.lastname
4099 FROM usr_data ud LEFT JOIN usr_pref ON usr_pref.usr_id = ud.usr_id AND $in
4100 WHERE ud.usr_id = %s",
4109 switch (
$row[
'keyword']) {
4110 case 'public_upload':
4111 $upload =
$row[
'value'] ==
'y';
4113 case 'public_profile':
4114 $profile = (
$row[
'value'] ==
'y' ||
4115 $row[
'value'] ==
'g');
4122 if (defined(
'ILIAS_MODULE')) {
4123 $webspace_dir = (
'.' . $webspace_dir);
4127 $image_dir = $webspace_dir .
"/usr_images";
4129 if ($a_size ==
'big') {
4130 $thumb_file = $image_dir .
"/usr_" . $a_usr_id .
".jpg";
4132 $thumb_file = $image_dir .
"/usr_" . $a_usr_id .
"_" . $a_size .
".jpg";
4136 $random = new \ilRandom();
4137 if ((($upload && $profile) || $a_force_pic)
4138 && @is_file($thumb_file)) {
4139 $file = $thumb_file .
"?t=" . $random->int(1, 99999);
4141 if (!$a_prevent_no_photo_image) {
4143 if ($a_size ==
"small" || $a_size ==
"big") {
4154 $avatar =
$DIC[
"user.avatar.factory"]->avatar($a_size);
4155 $avatar->setName($short);
4156 $avatar->setUsrId($a_usr_id);
4158 return $avatar->getUrl();
4162 require_once(
'./Services/WebAccessChecker/classes/class.ilWACSignedPath.php');
4174 $a_dir = trim(str_replace(
"..",
"", $a_dir));
4175 if ($a_dir ==
"" || !is_dir($a_dir)) {
4180 $image_dir = $webspace_dir .
"/usr_images";
4182 "upload_" . $a_user_id .
"pic",
4183 "usr_" . $a_user_id .
"." .
"jpg",
4184 "usr_" . $a_user_id .
"_small.jpg",
4185 "usr_" . $a_user_id .
"_xsmall.jpg",
4186 "usr_" . $a_user_id .
"_xxsmall.jpg",
4187 "upload_" . $a_user_id);
4188 foreach ($images as $image) {
4189 if (is_file($image_dir .
"/" . $image)) {
4190 copy($image_dir .
"/" . $image, $a_dir .
"/" . $image);
4202 $image_dir = $webspace_dir .
"/usr_images";
4203 $file = $image_dir .
"/usr_" . $this->getID() .
"." .
"jpg";
4204 $thumb_file = $image_dir .
"/usr_" . $this->getID() .
"_small.jpg";
4205 $xthumb_file = $image_dir .
"/usr_" . $this->getID() .
"_xsmall.jpg";
4206 $xxthumb_file = $image_dir .
"/usr_" . $this->getID() .
"_xxsmall.jpg";
4207 $upload_file = $image_dir .
"/upload_" . $this->getID();
4211 $this->
setPref(
"profile_image",
"");
4215 if (@is_file($file)) {
4218 if (@is_file($thumb_file)) {
4219 unlink($thumb_file);
4221 if (@is_file($xthumb_file)) {
4222 unlink($xthumb_file);
4224 if (@is_file($xxthumb_file)) {
4225 unlink($xxthumb_file);
4227 if (@is_file($upload_file)) {
4228 unlink($upload_file);
4235 if (!is_array($a_data)) {
4238 foreach ($a_data as $field =>
$data) {
4239 #$new_data[$field] = ilUtil::stripSlashes($data);
4241 $this->user_defined_data[
'f_' . $field] =
$data;
4243 #$this->user_defined_data = $new_data;
4250 return $this->user_defined_data ? $this->user_defined_data : array();
4261 $field_def = array();
4263 include_once(
"./Services/User/classes/class.ilUserDefinedData.php");
4266 foreach ($this->user_defined_data as $field => $value) {
4267 if ($field !=
'usr_id') {
4269 $udata->set($field, $value);
4303 include_once(
"./Services/User/classes/class.ilUserDefinedData.php");
4315 $this->user_defined_data = $udata->getAll();
4343 include_once(
"./Services/User/classes/class.ilUserDefinedData.php");
4359 public function getProfileAsString(&$a_language)
4361 include_once
'./Services/AccessControl/classes/class.ilObjRole.php';
4369 $language->loadLanguageModule(
'registration');
4396 if (strlen($this->
getCity())) {
4417 if (strlen($this->
getFax())) {
4441 $body .= (
$language->txt(
"create_date") .
": " . $date .
"\n");
4444 foreach (
$rbacreview->getGlobalRoles() as $role) {
4445 if (
$rbacreview->isAssigned($this->getId(), $role)) {
4450 $body .= (
$language->txt(
'reg_role_info') .
': ' . implode(
',', $gr) .
"\n");
4455 $body .= (
$language->txt(
'time_limit') .
": " .
$language->txt(
'crs_unlimited') .
"\n");
4472 include_once
'./Services/User/classes/class.ilUserDefinedFields.php';
4479 foreach ($user_defined_fields->getDefinitions() as $field_id => $definition) {
4481 if (strlen(
$data)) {
4483 $data = preg_replace(
'/<br(\s*)?\/?>/i',
"\n",
$data);
4487 $body .= $definition[
'field_name'] .
': ' .
$data .
"\n";
4503 if ($a_user_id > 0) {
4504 $set =
$ilDB->queryF(
4505 "SELECT feed_hash from usr_data WHERE usr_id = %s",
4509 if ($rec =
$ilDB->fetchAssoc($set)) {
4510 if (strlen($rec[
"feed_hash"]) == 32) {
4511 return $rec[
"feed_hash"];
4512 } elseif ($a_create) {
4513 $random = new \ilRandom();
4514 $hash = md5($random->int(1, 9999999) + str_replace(
" ",
"", (
string) microtime()));
4516 "UPDATE usr_data SET feed_hash = %s" .
4517 " WHERE usr_id = %s",
4518 array(
"text",
"integer"),
4519 array($hash, $a_user_id)
4540 if ($a_user_id > 0) {
4560 ($a_password ==
"") ?
"" : md5($a_password)
4579 $q =
"SELECT DISTINCT login, usr_id FROM usr_data " .
4584 if ($a_user_id != 0) {
4585 $q .=
" AND usr_id != %s ";
4586 $types[] =
"integer";
4593 return $row[
'usr_id'];
4615 "SELECT * FROM usr_data " .
4616 "WHERE ext_account = %s AND auth_mode = %s",
4617 array(
"text",
"text"),
4618 array($a_external_account, $a_auth_mode)
4620 return $ilDB->fetchAssoc(
$res) ? true :
false;
4640 if (count($ids) == 0) {
4644 $query =
"SELECT usr_data.*, usr_pref.value AS language
4646 LEFT JOIN usr_pref ON usr_pref.usr_id = usr_data.usr_id AND usr_pref.keyword = %s
4647 WHERE " .
$ilDB->in(
"usr_data.usr_id", $ids,
false,
"integer");
4653 $query .=
" AND usr_data.active = %s";
4655 $types[] =
"integer";
4658 $query .=
" ORDER BY usr_data.lastname, usr_data.firstname ";
4680 $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 ";
4685 $query .=
" AND usr_data.active = %s";
4687 $types[] =
"integer";
4691 $query .=
" AND usr_data.time_limit_owner = %s";
4693 $types[] =
"integer";
4696 $query .=
" AND usr_data.usr_id != %s ";
4697 $values[] = ANONYMOUS_USER_ID;
4698 $types[] =
"integer";
4700 $query .=
" ORDER BY usr_data.lastname, usr_data.firstname ";
4736 $query =
"SELECT usr_data.*, usr_pref.value AS language
4738 LEFT JOIN usr_pref ON usr_pref.usr_id = usr_data.usr_id AND usr_pref.keyword = %s
4739 WHERE " .
$ilDB->in(
"usr_data.usr_id", $a_mem_ids,
false,
"integer") .
"
4740 AND usr_data.usr_id != %s";
4743 $values[] = ANONYMOUS_USER_ID;
4744 $types[] =
"integer";
4747 $query .=
" AND active = %s";
4749 $types[] =
"integer";
4752 if ($timelimitowner !=
USER_FOLDER_ID && $timelimitowner != -1) {
4753 $query .=
" AND usr_data.time_limit_owner = %s";
4755 $types[] =
"integer";
4758 $query .=
" ORDER BY usr_data.lastname, usr_data.firstname ";
4765 return $mem_arr ? $mem_arr : array();
4782 if (is_array($a_internalids)) {
4783 foreach ($a_internalids as $internalid) {
4784 if (is_numeric($internalid)) {
4785 $ids[] = $internalid;
4788 if (is_numeric($parsedid) && $parsedid > 0) {
4794 if (count($ids) == 0) {
4798 $query =
"SELECT usr_data.*, usr_pref.value AS language
4801 ON usr_pref.usr_id = usr_data.usr_id AND usr_pref.keyword = %s
4802 WHERE " .
$ilDB->in(
"usr_data.usr_id", $ids,
false,
"integer");
4806 $query .=
" ORDER BY usr_data.lastname, usr_data.firstname ";
4831 "SELECT * FROM usr_pref WHERE usr_id = %s",
4859 $set =
$ilDB->query(
4860 "SELECT usr_id FROM usr_pref " .
4861 " WHERE keyword = " .
$ilDB->quote($a_keyword,
"text") .
4862 " AND " .
$ilDB->in(
"usr_id", $a_user_ids,
false,
"integer") .
4863 " AND value = " .
$ilDB->quote($a_val,
"text")
4865 while ($rec =
$ilDB->fetchAssoc($set)) {
4866 $users[] = $rec[
"usr_id"];
4878 $query =
"UPDATE usr_data SET login_attempts = 0 WHERE usr_id = %s";
4879 $affected =
$ilDB->manipulateF(
$query, array(
'integer'), array($a_usr_id));
4894 $query =
"SELECT login_attempts FROM usr_data WHERE usr_id = %s";
4908 $query =
"UPDATE usr_data SET login_attempts = (login_attempts + 1) WHERE usr_id = %s";
4909 $affected =
$ilDB->manipulateF(
$query, array(
'integer'), array($a_usr_id));
4924 $query =
"UPDATE usr_data SET active = 0, inactivation_date = %s WHERE usr_id = %s";
4941 return in_array($this->
getPref(
"public_profile"), array(
"y",
"g"));
4967 'SELECT * FROM loginname_history WHERE usr_id = %s AND login = %s AND history_date = %s',
4968 array(
'integer',
'text',
'integer'),
4975 INSERT INTO loginname_history
4976 (usr_id, login, history_date)
4977 VALUES (%s, %s, %s)',
4978 array(
'integer',
'text',
'integer'),
4993 public static function _getUsersOnline($a_user_id = 0, $a_no_anonymous =
false)
5006 $atime = $pd_set->get(
'user_activity_time') * 60;
5011 if ($a_user_id == 0) {
5012 $where[] =
'user_id > 0';
5013 } elseif (is_array($a_user_id)) {
5014 $where[] =
$ilDB->in(
"user_id", $a_user_id,
false,
"integer");
5016 $where[] =
'user_id = ' .
$ilDB->quote($a_user_id,
'integer');
5019 if ($a_no_anonymous) {
5020 $where[] =
'user_id != ' .
$ilDB->quote(ANONYMOUS_USER_ID,
'integer');
5023 include_once
'Services/User/classes/class.ilUserAccountSettings.php';
5025 include_once
'Services/User/classes/class.ilUserFilter.php';
5029 $where[] =
'expires > ' .
$ilDB->quote($ctime,
'integer');
5030 $where[] =
'(p.value IS NULL OR NOT p.value = ' .
$ilDB->quote(
'y',
'text') .
')';
5032 $where =
'WHERE ' . implode(
' AND ', $where);
5036 SELECT COUNT(user_id) num, user_id, firstname, lastname, title, login, last_login, MAX(ctime) ctime, context, agree_date
5038 LEFT JOIN usr_data u
5039 ON user_id = u.usr_id
5040 LEFT JOIN usr_pref p
5041 ON (p.usr_id = u.usr_id AND p.keyword = %s)
5043 GROUP BY user_id, firstname, lastname, title, login, last_login, context, agree_date
5044 ORDER BY lastname, firstname
5047 array(
'hide_own_online_status')
5050 $log->debug(
"Query: " . $q);
5054 if ($atime <= 0 ||
$user[
'ctime'] + $atime > $ctime) {
5059 $log->debug(
"Found users: " . count(
$users));
5061 require_once
'Services/TermsOfService/classes/class.ilTermsOfServiceHelper.php';
5064 if (
$user[
'agree_date'] ||
$user[
'user_id'] == SYSTEM_USER_ID ||
'root' ===
$user[
'login']) {
5071 $log->debug(
"TOS filtered to users: " . count(
$users));
5092 $random = new \ilRandom();
5093 $hashcode = substr(md5(uniqid($random->int(),
true)), 0, 16);
5097 SELECT COUNT(usr_id) cnt FROM usr_data
5098 WHERE reg_hash = %s',
5103 if (
$row->cnt > 0) {
5118 array(
'text',
'integer'),
5119 array($hashcode, (
int) $a_usr_id)
5144 SELECT usr_id, create_date FROM usr_data
5145 WHERE reg_hash = %s',
5150 require_once
'Services/Registration/classes/class.ilRegistrationSettings.php';
5153 if ((
int) $oRegSettigs->getRegistrationHashLifetime() != 0 &&
5154 time() - (
int) $oRegSettigs->getRegistrationHashLifetime() > strtotime(
$row[
'create_date'])) {
5155 require_once
'Services/Registration/exceptions/class.ilRegConfirmationLinkExpiredException.php';
5164 array(
'text',
'integer'),
5165 array(
'', (
int)
$row[
'usr_id'])
5168 return (
int)
$row[
'usr_id'];
5171 require_once
'Services/Registration/exceptions/class.ilRegistrationHashNotFoundException.php';
5177 if (strlen($a_birthday)) {
5181 $this->birthday =
null;
5200 if (!(
int) $period) {
5208 $date = date(
'Y-m-d H:i:s', (time() - ((
int) $period * 24 * 60 * 60)));
5210 $query =
"SELECT usr_id FROM usr_data WHERE last_login < %s OR (ISNULL(last_login) AND create_date < %s)";
5212 $res =
$ilDB->queryF(
$query, array(
'timestamp',
'timestamp'), array($date, $date));
5216 $ids[] =
$row->usr_id;
5233 $field =
'inactivation_date';
5236 if (!(
int) $period) {
5244 $date = date(
'Y-m-d H:i:s', (time() - ((
int) $period * 24 * 60 * 60)));
5246 $query =
"SELECT usr_id FROM usr_data WHERE $field < %s AND active = %s";
5248 $res =
$ilDB->queryF(
$query, array(
'timestamp',
'integer'), array($date, 0));
5252 $ids[] =
$row->usr_id;
5269 if ($a_last_login !==
null) {
5270 $last_login = $a_last_login;
5272 $last_login = date(
'Y-m-d H:i:s');
5279 $query =
"UPDATE usr_data SET last_login = %s WHERE usr_id = %s";
5280 $affected =
$ilDB->manipulateF(
$query, array(
'timestamp',
'integer'), array($last_login, $a_usr_id));
5282 $query =
"UPDATE usr_data SET first_login = %s WHERE usr_id = %s AND first_login IS NULL";
5283 $ilDB->manipulateF(
$query, array(
'timestamp',
'integer'), array($last_login, $a_usr_id));
5299 $query =
"UPDATE object_data SET owner = 0 " .
5300 "WHERE owner = " .
$ilDB->quote($this->
getId(),
'integer');
5319 $q =
"SELECT DISTINCT " .
$ilDB->upper(
$ilDB->substr(
"lastname", 1, 1)) .
" let" .
5321 " WHERE usr_id <> " .
$ilDB->quote(ANONYMOUS_USER_ID,
"integer") .
5323 $let_set =
$ilDB->query($q);
5326 while ($let_rec =
$ilDB->fetchAssoc($let_set)) {
5327 $let[$let_rec[
"let"]] = $let_rec[
"let"];
5339 $query =
'SELECT count(*) num FROM object_data od ' .
5340 'JOIN usr_data ud ON obj_id = usr_id ' .
5341 'WHERE ' .
$ilDB->in(
'obj_id', $a_usr_ids,
false,
'integer') .
' ';
5344 return $num_rows == count((array) $a_usr_ids);
5353 return (
boolean)
$_SESSION[
"user_captcha_verified"];
5363 $_SESSION[
"user_captcha_verified"] = $a_val;
5374 include_once(
"./Services/Export/classes/class.ilExport.php");
5397 include_once(
"./Services/Export/classes/class.ilExport.php");
5399 if (!is_dir($dir)) {
5403 if (is_int(strpos($entry[
"entry"],
".zip"))) {
5404 return $entry[
"entry"];
5419 include_once(
"./Services/Export/classes/class.ilExport.php");
5422 if (is_file($file)) {
5441 include_once(
"./Services/Export/classes/class.ilImport.php");
5443 if (!$a_profile_data) {
5444 $imp->addSkipEntity(
"Services/User",
"usr_profile");
5447 $imp->addSkipEntity(
"Services/User",
"usr_setting");
5449 if (!$a_bookmarks) {
5450 $imp->addSkipEntity(
"Services/Bookmarks",
"bookmarks");
5453 $imp->addSkipEntity(
"Services/Notes",
"user_notes");
5456 $imp->addSkipEntity(
"Services/Calendar",
"calendar");
5459 $a_file[
"tmp_name"],
5477 $NOW =
$ilDB->now();
5479 $usrId_IN_usrIds =
$ilDB->in(
'usr_id', $usrIds,
false,
'integer');
5483 SET inactivation_date = $NOW
5484 WHERE inactivation_date IS NULL
5485 AND $usrId_IN_usrIds
5488 $ilDB->manipulate($queryString);
5502 $usrId_IN_usrIds =
$ilDB->in(
'usr_id', $usrIds,
false,
'integer');
5506 SET inactivation_date = NULL
5507 WHERE $usrId_IN_usrIds
5510 $ilDB->manipulate($queryString);
5538 require_once
'Services/TermsOfService/classes/class.ilTermsOfServiceHelper.php';
5542 null == $this->agree_date &&
5543 'root' != $this->login &&
5544 !in_array($this->
getId(), array(ANONYMOUS_USER_ID, SYSTEM_USER_ID))
5556 public static function hasUserToAcceptTermsOfService($a_username)
5565 require_once
'Services/TermsOfService/classes/class.ilTermsOfServiceHelper.php';
5571 $in =
$ilDB->in(
'usr_id', array(ANONYMOUS_USER_ID, SYSTEM_USER_ID),
true,
'integer');
5573 "SELECT usr_id FROM usr_data WHERE login = %s AND agree_date IS NULL $in",
5577 return $ilDB->fetchAssoc(
$res) ? true :
false;
5593 $date_is = ($a_agreed)
5597 $users = (is_array($a_users))
5598 ?
" AND " .
$ilDB->in(
"usr_id", $a_users,
false,
"integer")
5601 $set =
$ilDB->query(
"SELECT usr_id FROM usr_data " .
5602 " WHERE agree_date " . $date_is .
5605 while ($rec =
$ilDB->fetchAssoc($set)) {
5606 $ret[] = $rec[
"usr_id"];
5618 if (
null === $status) {
5622 require_once
'Services/TermsOfService/classes/class.ilTermsOfServiceHelper.php';
5642 return $usr_id == ANONYMOUS_USER_ID;
5657 return (
bool) $this->
getPref(
"delete_flag");
5665 $this->is_self_registered = (bool) $status;
5685 $this->interests_general = $value;
5715 $this->interests_help_offered = $value;
5745 $this->interests_help_looking = $value;
5791 if (!$this->
getId()) {
5795 $set =
$ilDB->query(
"SELECT field_id,value" .
5796 " FROM usr_data_multi" .
5797 " WHERE usr_id = " .
$ilDB->quote($this->getId(),
"integer") .
5799 while (
$row =
$ilDB->fetchAssoc($set)) {
5803 if (isset(
$values[
"interests_general"])) {
5808 if (isset(
$values[
"interests_help_offered"])) {
5813 if (isset(
$values[
"interests_help_looking"])) {
5831 if (!$this->
getId()) {
5848 $value = trim($value);
5850 $uniq_id =
$ilDB->nextId(
'usr_data_multi');
5852 $ilDB->manipulate(
"INSERT usr_data_multi" .
5853 " (id,usr_id,field_id,value) VALUES" .
5854 " (" .
$ilDB->quote($uniq_id,
"integer") .
5855 "," .
$ilDB->quote($this->getId(),
"integer") .
5857 "," .
$ilDB->quote($value,
"text") .
5874 if (!$this->
getId()) {
5878 $ilDB->manipulate(
"DELETE FROM usr_data_multi" .
5879 " WHERE usr_id = " .
$ilDB->quote($this->getId(),
"integer"));
5882 public static function findInterests($a_term, $a_user_id =
null, $a_field_id =
null)
5890 $sql =
"SELECT DISTINCT(value)" .
5891 " FROM usr_data_multi" .
5892 " WHERE " .
$ilDB->like(
"value",
"text",
"%" . $a_term .
"%");
5894 $sql .=
" AND field_id = " .
$ilDB->quote($a_field_id,
"text");
5897 $sql .=
" AND usr_id <> " .
$ilDB->quote($a_user_id,
"integer");
5899 $sql .=
" ORDER BY value";
5900 $set =
$ilDB->query($sql);
5901 while (
$row =
$ilDB->fetchAssoc($set)) {
5923 $set =
$ilDB->query(
5924 "SELECT * FROM usr_pref " .
5925 " WHERE keyword = " .
$ilDB->quote(
"public_profile",
"text") .
5926 " AND " .
$ilDB->in(
"usr_id", $a_user_ids,
false,
"integer")
5929 "global" => array(),
5931 "public" => array(),
5932 "not_public" => array()
5934 while ($rec =
$ilDB->fetchAssoc($set)) {
5935 if ($rec[
"value"] ==
"g") {
5936 $r[
"global"][] = $rec[
"usr_id"];
5937 $r[
"public"][] = $rec[
"usr_id"];
5939 if ($rec[
"value"] ==
"y") {
5940 $r[
"local"][] = $rec[
"usr_id"];
5941 $r[
"public"][] = $rec[
"usr_id"];
5944 foreach ($a_user_ids as
$id) {
5945 if (!in_array(
$id,
$r[
"public"])) {
5946 $r[
"not_public"][] =
$id;
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, $include_seconds=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 _lookupFirstLogin($a_user_id)
lookup first login
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.
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.
static getUserIdsByEmail($a_email)
STATIC METHOD get all user_ids of an email address.
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)
setExternalAccount($a_str)
set external account
setLogin($a_str)
set login / username @access public
static userExists($a_usr_ids=array())
getFirstLogin()
returns first login date
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)
setFirstLogin($a_str)
set user's first login
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
getLastProfilePrompt()
returns user's last profile prompt
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,...
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
setLastProfilePrompt($a_str)
set user's last profile prompt
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
static getUserLoginsByEmail($a_email)
get all user login names of an email address
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['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.
update($pash, $contents, Config $config)
redirection script todo: (a better solution should control the processing via a xml file)
foreach($_POST as $key=> $value) $res