4 define (
"IL_PASSWD_PLAIN",
"plain");
5 define (
"IL_PASSWD_MD5",
"md5");
6 define (
"IL_PASSWD_CRYPT",
"crypt");
9 require_once
"./Services/Object/classes/class.ilObject.php";
10 require_once
'./Services/User/exceptions/class.ilUserException.php';
155 function ilObjUser($a_user_id = 0, $a_call_by_reference =
false)
164 $this->
ilObject($a_user_id, $a_call_by_reference);
165 $this->auth_mode =
"default";
175 $this->
setId($a_user_id);
182 $this->prefs = array();
184 $this->prefs[
"language"] = $this->ilias->ini->readVariable(
"language",
"default");
187 $this->skin = $this->ilias->ini->readVariable(
"layout",
"skin");
190 $this->prefs[
"show_users_online"] =
"y";
193 $this->prefs[
"style"] = $this->ilias->ini->readVariable(
"layout",
"style");
210 $r = $ilDB->queryF(
"SELECT * FROM usr_data ".
211 "WHERE usr_id= %s", array(
"integer"), array($this->
id));
213 if (
$data = $ilDB->fetchAssoc($r))
217 if (
$data[
"passwd"] ==
"" &&
$data[
"i2passwd"] !=
"")
227 unset(
$data[
"i2passw"]);
243 if ($this->prefs[
"language"] ==
"")
245 $this->prefs[
"language"] = $this->oldPrefs[
"language"];
249 include_once(
"./Services/Style/classes/class.ilStyleDefinition.php");
250 if ($this->prefs[
"skin"] ==
"" ||
253 $this->prefs[
"skin"] = $this->oldPrefs[
"skin"];
256 $this->skin = $this->prefs[
"skin"];
259 if ($this->prefs[
"style"] ==
"" ||
263 $this->prefs[
"style"] = $this->ilias->ini->readVariable(
"layout",
"style");
266 if (empty($this->prefs[
"hits_per_page"]))
268 $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);
295 if (! $a_data[
"passwd_type"])
297 $ilErr->raiseError(
"<b>Error: passwd_type missing in function assignData(). ".
298 $this->
id.
"!</b><br />class: ".get_class($this).
"<br />Script: "
299 .__FILE__.
"<br />Line: ".__LINE__, $ilErr->FATAL);
301 if ($a_data[
"passwd"] !=
"********" and strlen($a_data[
'passwd']))
303 $this->
setPasswd($a_data[
"passwd"], $a_data[
"passwd_type"]);
311 if (!is_array($a_data[
'birthday']))
324 $this->
setCity($a_data[
"city"]);
331 $this->
setFax($a_data[
"fax"]);
355 $this->create_date = $a_data[
"create_date"];
356 $this->
setComment($a_data[
"referral_comment"]);
357 $this->approve_date = $a_data[
"approve_date"];
358 $this->active = $a_data[
"active"];
359 $this->agree_date = $a_data[
"agree_date"];
393 switch ($this->passwd_type)
396 $pw_field =
"passwd";
397 if(strlen($this->passwd))
399 $pw_value = md5($this->passwd);
408 $pw_field =
"passwd";
413 $pw_field =
"i2passwd";
418 $ilErr->raiseError(
"<b>Error: passwd_type missing in function saveAsNew. ".
419 $this->
id.
"!</b><br />class: ".get_class($this).
"<br />Script: ".__FILE__.
420 "<br />Line: ".__LINE__, $ilErr->FATAL);
432 $insert_array = array(
433 "usr_id" => array(
"integer", $this->
id),
434 "login" => array(
"text", $this->login),
435 $pw_field => array(
"text", $pw_value),
436 "firstname" => array(
"text", $this->firstname),
437 "lastname" => array(
"text", $this->lastname),
438 "title" => array(
"text", $this->utitle),
439 "gender" => array(
"text", $this->gender),
440 "email" => array(
"text", trim($this->email)),
441 "hobby" => array(
"text", (
string) $this->hobby),
442 "institution" => array(
"text", $this->institution),
443 "department" => array(
"text", $this->department),
444 "street" => array(
"text", $this->street),
445 "city" => array(
"text", $this->city),
446 "zipcode" => array(
"text", $this->zipcode),
447 "country" => array(
"text", $this->country),
448 "sel_country" => array(
"text", $this->sel_country),
449 "phone_office" => array(
"text", $this->phone_office),
450 "phone_home" => array(
"text", $this->phone_home),
451 "phone_mobile" => array(
"text", $this->phone_mobile),
452 "fax" => array(
"text", $this->fax),
454 "last_login" => array(
"timestamp", null),
455 "last_update" => array(
"timestamp",
ilUtil::now()),
456 "create_date" => array(
"timestamp",
ilUtil::now()),
457 "referral_comment" => array(
"text", $this->referral_comment),
458 "matriculation" => array(
"text", $this->matriculation),
459 "client_ip" => array(
"text", $this->client_ip),
460 "approve_date" => array(
"timestamp", $this->approve_date),
461 "agree_date" => array(
"timestamp", $this->agree_date),
462 "active" => array(
"integer", (
int) $this->active),
467 "auth_mode" => array(
"text", $this->
getAuthMode()),
470 "im_icq" => array(
"text", $this->im_icq),
471 "im_yahoo" => array(
"text", $this->im_yahoo),
472 "im_msn" => array(
"text", $this->im_msn),
473 "im_aim" => array(
"text", $this->im_aim),
474 "im_skype" => array(
"text", $this->im_skype),
475 "delicious" => array(
"text", $this->delicious),
476 "latitude" => array(
"text", $this->latitude),
477 "longitude" => array(
"text", $this->longitude),
478 "loc_zoom" => array(
"integer", (
int) $this->loc_zoom),
479 "last_password_change" => array(
"integer", (
int) $this->last_password_change_ts),
480 "im_jabber" => array(
"text", $this->im_jabber),
481 "im_voip" => array(
"text", $this->im_voip),
482 'inactivation_date' => array(
'timestamp', $this->inactivation_date),
483 'is_self_registered' => array(
'integer', (
int)$this->is_self_registered)
485 $ilDB->insert(
"usr_data", $insert_array);
493 include_once (
"Services/Mail/classes/class.ilMailbox.php");
495 $mbox->createDefaultFolder();
497 include_once
"Services/Mail/classes/class.ilMailOptions.php";
499 $mail_options->createMailOptionsEntry();
502 include_once
"./Services/Bookmarks/classes/class.ilBookmarkFolder.php";
504 $bmf->createNewBookmarkTree();
513 global
$ilErr, $ilDB, $ilAppEventHandler;
521 else if($this->active)
526 $update_array = array(
527 "gender" => array(
"text", $this->gender),
528 "title" => array(
"text", $this->utitle),
529 "firstname" => array(
"text", $this->firstname),
530 "lastname" => array(
"text", $this->lastname),
531 "email" => array(
"text", trim($this->email)),
533 "hobby" => array(
"text", $this->hobby),
534 "institution" => array(
"text", $this->institution),
535 "department" => array(
"text", $this->department),
536 "street" => array(
"text", $this->street),
537 "city" => array(
"text", $this->city),
538 "zipcode" => array(
"text", $this->zipcode),
539 "country" => array(
"text", $this->country),
540 "sel_country" => array(
"text", $this->sel_country),
541 "phone_office" => array(
"text", $this->phone_office),
542 "phone_home" => array(
"text", $this->phone_home),
543 "phone_mobile" => array(
"text", $this->phone_mobile),
544 "fax" => array(
"text", $this->fax),
545 "referral_comment" => array(
"text", $this->referral_comment),
546 "matriculation" => array(
"text", $this->matriculation),
547 "client_ip" => array(
"text", $this->client_ip),
548 "approve_date" => array(
"timestamp", $this->approve_date),
549 "active" => array(
"integer", $this->active),
556 "auth_mode" => array(
"text", $this->
getAuthMode()),
558 "im_icq" => array(
"text", $this->im_icq),
559 "im_yahoo" => array(
"text", $this->im_yahoo),
560 "im_msn" => array(
"text", $this->im_msn),
561 "im_aim" => array(
"text", $this->im_aim),
562 "im_skype" => array(
"text", $this->im_skype),
563 "delicious" => array(
"text", $this->delicious),
564 "latitude" => array(
"text", $this->latitude),
565 "longitude" => array(
"text", $this->longitude),
566 "loc_zoom" => array(
"integer", (
int) $this->loc_zoom),
567 "last_password_change" => array(
"integer", $this->last_password_change_ts),
568 "im_jabber" => array(
"text", $this->im_jabber),
569 "im_voip" => array(
"text", $this->im_voip),
570 "last_update" => array(
"timestamp",
ilUtil::now()),
571 'inactivation_date' => array(
'timestamp', $this->inactivation_date)
574 if (isset($this->agree_date) && (strtotime($this->agree_date) !==
false || $this->agree_date == null))
576 $update_array[
"agree_date"] = array(
"timestamp", $this->agree_date);
578 switch ($this->passwd_type)
581 if(strlen($this->passwd))
583 $update_array[
"i2passwd"] = array(
"text", (
string)
"");
584 $update_array[
"passwd"] = array(
"text", (
string) md5($this->passwd));
588 $update_array[
"i2passwd"] = array(
"text", (
string)
"");
589 $update_array[
"passwd"] = array(
"text", (
string) $this->passwd);
594 $update_array[
"i2passwd"] = array(
"text", (
string)
"");
595 $update_array[
"passwd"] = array(
"text", (
string) $this->passwd);
599 $update_array[
"i2passwd"] = array(
"text", (
string) $this->passwd);
600 $update_array[
"passwd"] = array(
"text", (
string)
"");
604 $ilErr->raiseError(
"<b>Error: passwd_type missing in function update()".$this->
id.
"!</b><br />class: ".
605 get_class($this).
"<br />Script: ".__FILE__.
"<br />Line: ".__LINE__, $ilErr->FATAL);
608 $ilDB->update(
"usr_data", $update_array, array(
"usr_id" => array(
"integer", $this->
id)));
620 $ilAppEventHandler->raise(
"Services/User",
"afterUpdate",
621 array(
"user_obj" => $this));
633 $ilDB->manipulateF(
"UPDATE usr_data SET agree_date = ".$ilDB->now().
634 " WHERE usr_id = %s", array(
"integer"), array($this->
getId()));
640 private function _lookup($a_user_id, $a_field)
644 $res = $ilDB->queryF(
"SELECT ".$a_field.
" FROM usr_data WHERE usr_id = %s",
645 array(
"integer"), array($a_user_id));
647 while($set = $ilDB->fetchAssoc(
$res))
649 return $set[$a_field];
661 $set = $ilDB->queryF(
"SELECT title, firstname, lastname FROM usr_data WHERE usr_id = %s",
662 array(
"integer"), array($a_user_id));
664 if ($rec = $ilDB->fetchAssoc($set))
670 if ($rec[
"firstname"])
674 if ($rec[
"lastname"])
728 $res = $ilDB->queryF(
"SELECT firstname, lastname, title, login FROM usr_data WHERE usr_id = %s",
729 array(
"integer"), array($a_user_id));
730 $user_rec = $ilDB->fetchAssoc(
$res);
731 return array(
"user_id" => $a_user_id,
732 "firstname" => $user_rec[
"firstname"],
733 "lastname" => $user_rec[
"lastname"],
734 "title" => $user_rec[
"title"],
735 "login" => $user_rec[
"login"]);
745 $res = $ilDB->queryF(
"SELECT * FROM usr_data WHERE usr_id = %s",
746 array(
"integer"), array($a_user_id));
747 $user_rec = $ilDB->fetchAssoc(
$res);
774 $res = $ilDB->queryF(
"SELECT usr_id FROM usr_data WHERE login = %s",
775 array(
"text"), array($a_user_str));
776 $user_rec = $ilDB->fetchAssoc(
$res);
777 return $user_rec[
"usr_id"];
798 $ilDB->manipulateF(
"UPDATE usr_data SET ".
799 "last_login = ".$ilDB->now().
800 " WHERE usr_id = %s",
801 array(
"integer"), array($this->
id));
815 $this->passwd = $new_md5;
817 $ilDB->manipulateF(
"UPDATE usr_data SET ".
820 array(
"text",
"integer"), array($this->passwd, $this->
id));
837 if (func_num_args() != 3)
842 if (!isset($a_old) or !isset($a_new1) or !isset($a_new2))
847 if ($a_new1 != $a_new2)
853 if ($a_new1 ==
"" || $a_old ==
"")
859 switch ($this->passwd_type)
862 if ($a_old != $this->passwd)
869 if (md5($a_old) != $this->passwd)
876 if (self::_makeIlias2Password($a_old) != $this->passwd)
884 $this->passwd = md5($a_new1);
887 $ilDB->manipulateF(
"UPDATE usr_data SET ".
890 array(
"text",
"integer"), array($this->passwd, $this->
id));
906 if (func_num_args() != 2)
911 if (!isset($a_new1) or !isset($a_new2))
916 if ($a_new1 != $a_new2)
922 $this->passwd = md5($a_new1);
925 $ilDB->manipulateF(
"UPDATE usr_data SET ".
928 array(
"text",
"integer"),
929 array($this->passwd, $this->
id));
940 return (crypt($a_passwd,substr($a_passwd,0,2)));
957 $res = $ilDB->queryF(
'
958 SELECT * FROM loginname_history
960 array(
'text'), array($a_login));
962 return $ilDB->fetchAssoc(
$res) ?
true :
false;
981 $ilDB->setLimit(1, 0);
982 $res = $ilDB->queryF(
'
983 SELECT login, history_date FROM loginname_history
984 WHERE usr_id = %s ORDER BY history_date DESC',
985 array(
'integer'), array($a_usr_id));
1005 if(func_num_args() != 1)
1010 if(!isset($a_login))
1016 if(0 == strcmp($a_login, self::_lookupLogin($this->
getId())))
1028 if((
int)$ilSetting->get(
'allow_change_loginname') &&
1029 (int)$ilSetting->get(
'reuse_of_loginnames') == 0 &&
1032 throw new ilUserException($this->lng->txt(
'loginname_already_exists'));
1034 else if((
int)$ilSetting->get(
'allow_change_loginname') &&
1035 (int)$ilSetting->get(
'loginname_change_blocking_time') &&
1036 is_array($last_history_entry) &&
1037 $last_history_entry[1] + (int)$ilSetting->get(
'loginname_change_blocking_time') > time())
1039 include_once
'Services/Calendar/classes/class.ilDate.php';
1042 $this->lng->txt(
'changing_loginname_not_possible_info'),
1046 new ilDateTime(($last_history_entry[1] + (
int)$ilSetting->get(
'loginname_change_blocking_time')),
IL_CAL_UNIX))
1053 if((
int)$ilSetting->get(
'allow_change_loginname') &&
1054 (int)$ilSetting->get(
'create_history_loginname'))
1060 $this->login = $a_login;
1062 $ilDB->manipulateF(
'
1066 array(
'text',
'integer'), array($this->
getLogin(), $this->
getId()));
1080 self::_writePref($this->
id, $a_keyword, $a_value);
1081 $this->
setPref($a_keyword, $a_value);
1092 self::_deletePref($this->
getId(), $a_keyword);
1100 public static function _deletePref($a_user_id, $a_keyword)
1108 'DELETE FROM usr_pref WHERE usr_id = %s AND keyword = %s',
1109 array(
'integer',
'text'),
1110 array($a_user_id, $a_keyword)
1123 $ilDB->manipulateF(
"DELETE FROM usr_pref WHERE usr_id = %s",
1124 array(
"integer"), array($a_user_id));
1133 public static function _writePref($a_usr_id, $a_keyword, $a_value)
1140 self::_deletePref($a_usr_id, $a_keyword);
1141 if(strlen($a_value))
1144 'INSERT INTO usr_pref (usr_id, keyword, value) VALUES (%s, %s, %s)',
1145 array(
'integer',
'text',
'text'),
1146 array($a_usr_id, $a_keyword, $a_value)
1160 foreach ($this->prefs as $keyword => $value)
1162 self::_writePref($this->
id, $keyword, $value);
1174 if($tz = $this->
getPref(
'user_tz'))
1180 include_once(
'Services/Calendar/classes/class.ilCalendarSettings.php');
1182 return $settings->getDefaultTimeZone();
1194 if($format = $this->
getPref(
'time_format'))
1200 include_once(
'Services/Calendar/classes/class.ilCalendarSettings.php');
1202 return $settings->getDefaultTimeFormat();
1214 if($format = $this->
getPref(
'date_format'))
1220 include_once(
'Services/Calendar/classes/class.ilCalendarSettings.php');
1222 return $settings->getDefaultDateFormat();
1234 if ($a_keyword !=
"")
1236 $this->prefs[$a_keyword] = $a_value;
1247 if (array_key_exists($a_keyword, $this->prefs))
1249 return $this->prefs[$a_keyword];
1261 $query =
"SELECT * FROM usr_pref WHERE usr_id = ".$ilDB->quote($a_usr_id,
"integer").
" ".
1262 "AND keyword = ".$ilDB->quote($a_keyword,
"text");
1280 if (is_array($this->prefs))
1295 global $rbacadmin, $ilDB;
1298 include_once(
'Services/LDAP/classes/class.ilLDAPRoleGroupMapping.php');
1300 $mapping->deleteUser($this->
getId());
1303 include_once (
"Services/Mail/classes/class.ilMailbox.php");
1306 $mailbox->updateMailsOfDeletedUser($this->
getLogin());
1309 include_once(
"./Services/Block/classes/class.ilCustomBlock.php");
1311 $costum_block->setContextObjId($this->
getId());
1312 $costum_block->setContextObjType(
"user");
1313 $c_blocks = $costum_block->queryBlocksForContext();
1314 include_once(
"./Services/Feeds/classes/class.ilPDExternalFeedBlock.php");
1315 foreach($c_blocks as $c_block)
1317 if ($c_block[
"type"] ==
"pdfeed")
1326 include_once(
"./Services/Block/classes/class.ilBlockSetting.php");
1330 $ilDB->manipulateF(
"DELETE FROM usr_data WHERE usr_id = %s",
1331 array(
"integer"), array($this->
getId()));
1339 include_once(
"./Services/Authentication/classes/class.ilSession.php");
1343 $rbacadmin->removeUser($this->
getId());
1347 $q =
"DELETE FROM bookmark_tree WHERE tree = ".
1348 $ilDB->quote($this->
getId(),
"integer");
1349 $ilDB->manipulate($q);
1351 $q =
"DELETE FROM bookmark_data WHERE user_id = ".
1352 $ilDB->quote($this->
getId(),
"integer");
1353 $ilDB->manipulate($q);
1356 include_once
'./Modules/Forum/classes/class.ilObjForum.php';
1357 ilObjForum::_deleteUser($this->
getId());
1360 include_once
'./Services/LinkChecker/classes/class.ilLinkCheckNotify.php';
1364 include_once
'./Modules/Course/classes/class.ilObjCourse.php';
1368 include_once
'./Services/Tracking/classes/class.ilObjUserTracking.php';
1371 include_once
'Modules/Session/classes/class.ilEventParticipants.php';
1375 include_once
'Modules/Scorm2004/classes/ilSCORM13Package.php';
1379 include_once
'Modules/ScormAicc/classes/class.ilObjSCORMLearningModule.php';
1383 include_once
"./Services/Notification/classes/class.ilNotification.php";
1387 include_once
"./Services/Portfolio/classes/class.ilObjPortfolio.php";
1391 include_once
"./Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
1393 $tree->cascadingDelete();
1406 global $ilAppEventHandler;
1407 $ilAppEventHandler->raise(
1408 'Services/User',
'deleteUser', array(
'usr_id' => $this->
getId())
1425 function setFullname($a_title =
"",$a_firstname =
"",$a_lastname =
"")
1427 $this->fullname =
"";
1433 elseif ($this->utitle)
1435 $this->fullname = $this->utitle.
" ";
1442 elseif ($this->firstname)
1444 $this->fullname .= $this->firstname.
" ";
1476 if (strlen($this->fullname) <= $a_max_strlen)
1481 if ((strlen($this->utitle) + strlen($this->lastname) + 4) <= $a_max_strlen)
1483 return ilUtil::stripSlashes($this->utitle.
" ".substr($this->firstname,0,1).
". ".$this->lastname);
1486 if ((strlen($this->firstname) + strlen($this->lastname) + 1) <= $a_max_strlen)
1491 if ((strlen($this->lastname) + 3) <= $a_max_strlen)
1511 if($a_username ==
'root')
1516 $res = $ilDB->queryF(
"SELECT usr_id FROM usr_data ".
1517 "WHERE login = %s AND NOT agree_date IS NULL",
1518 array(
"text"), array($a_username));
1519 return $ilDB->fetchAssoc(
$res) ?
true :
false;
1528 if ($this->agree_date != null || $this->login ==
"root")
1542 $this->login = $a_str;
1561 $this->passwd = $a_str;
1562 $this->passwd_type = $a_type;
1594 $this->gender = substr($a_str,-1);
1615 $this->utitle = $a_str;
1636 $this->firstname = $a_str;
1655 $this->lastname = $a_str;
1674 $this->institution = $a_str;
1693 $this->department = $a_str;
1712 $this->street = $a_str;
1731 $this->city = $a_str;
1750 $this->zipcode = $a_str;
1770 $this->country = $a_str;
1790 $this->sel_country = $a_val;
1810 $this->phone_office = $a_str;
1829 $this->phone_home = $a_str;
1848 $this->phone_mobile = $a_str;
1867 $this->fax = $a_str;
1886 $this->client_ip = $a_str;
1905 $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;
1960 $this->hobby = $a_str;
1979 $this->
setPref(
"language",$a_str);
1990 return $this->prefs[
"language"];
2003 $this->
setPref(
"disk_quota",$a_disk_quota);
2017 return $this->prefs[
"disk_quota"] ? $this->prefs[
"disk_quota"] : 0;
2022 $this->last_password_change_ts = $a_last_password_change_ts;
2035 $q =
"SELECT value FROM usr_pref WHERE usr_id= ".
2036 $ilDB->quote($a_usr_id,
"integer").
" AND keyword = ".
2037 $ilDB->quote(
'language',
"text");
2038 $r = $ilDB->query($q);
2040 while(
$row = $ilDB->fetchAssoc($r))
2042 return $row[
'value'];
2053 if ($pw == md5($a_pw))
2064 $ilDB->manipulateF(
"UPDATE usr_data ".
2065 " SET ext_account = %s WHERE usr_id = %s",
2066 array(
"text",
"integer"),
2067 array($a_ext_id, $a_usr_id));
2074 $ilDB->manipulateF(
"UPDATE usr_data ".
2075 " SET auth_mode = %s WHERE usr_id = %s",
2076 array(
"text",
"integer"),
2077 array($a_auth_mode, $a_usr_id));
2096 $this->last_login = $a_str;
2106 return $this->last_login;
2116 $this->last_update = $a_str;
2130 $this->referral_comment = $a_str;
2150 $this->approve_date = $a_str;
2181 $this->agree_date = $a_str;
2224 $query =
'SELECT usr_id FROM usr_data '.
2225 'WHERE active = '.$ilDB->quote(1,
'integer').
' '.
2226 'AND usr_id = '.$ilDB->quote($a_usr_id,
'integer');
2256 if ((!empty($storedActive) && empty($currentActive)) ||
2257 (empty($storedActive) && !empty($currentActive)))
2272 return $active ?
true :
false;
2283 $this->skin = $a_str;
2288 $this->time_limit_owner = $a_owner;
2292 return $this->time_limit_owner ? $this->time_limit_owner : 7;
2296 $this->time_limit_from = $a_from;
2300 return $this->time_limit_from ? $this->time_limit_from : time();
2304 $this->time_limit_until = $a_until;
2308 return $this->time_limit_until ? $this->time_limit_until : time();
2312 $this->time_limit_unlimited = $a_unlimited;
2316 return $this->time_limit_unlimited;
2320 return $this->time_limit_message = $a_time_limit_message;
2324 return $this->time_limit_message;
2329 $this->login_attempts = $a_login_attempts;
2352 $this->profile_incomplete = (boolean) $a_prof_inc;
2356 if($this->
id == ANONYMOUS_USER_ID)
2360 return $this->profile_incomplete;
2366 if( $this->
id == ANONYMOUS_USER_ID || $this->
id == SYSTEM_USER_ID )
2369 require_once(
'./Services/PrivacySecurity/classes/class.ilSecuritySettings.php');
2373 && $security->isPasswordChangeOnFirstLoginEnabled()
2375 && $this->is_self_registered == false
2385 if($this->
id == ANONYMOUS_USER_ID)
return false;
2387 require_once(
'./Services/PrivacySecurity/classes/class.ilSecuritySettings.php');
2392 $max_pass_age = $security->getPasswordMaxAge();
2393 if( $max_pass_age > 0 )
2395 $max_pass_age_ts = ( $max_pass_age * 86400 );
2397 $current_ts = time();
2399 if( ($current_ts - $pass_change_ts) > $max_pass_age_ts )
2408 $current_ts = time();
2410 $password_age = (int) ( ($current_ts - $pass_change_ts) / 86400 );
2411 return $password_age;
2420 $query =
"UPDATE usr_data SET last_password_change = %s " .
2421 "WHERE usr_id = %s";
2422 $affected = $ilDB->manipulateF(
$query,
2423 array(
'integer',
'integer'),
2425 if($affected)
return true;
2433 $query =
"UPDATE usr_data SET last_password_change = 0 " .
2434 "WHERE usr_id = %s";
2435 $affected = $ilDB->manipulateF(
$query, array(
'integer'),
2436 array($this->
getId()) );
2437 if($affected)
return true;
2448 $this->latitude = $a_latitude;
2468 $this->longitude = $a_longitude;
2488 $this->loc_zoom = $a_locationzoom;
2503 $this->applied_users = array();
2506 return $this->applied_users ? $this->applied_users : array();
2511 if($a_usr_id == $this->
getId())
2516 $this->applied_users = array();
2519 return in_array($a_usr_id,$this->applied_users);
2526 $res = $ilDB->queryF(
"SELECT usr_id FROM usr_data ".
2527 "WHERE time_limit_owner = %s",
2529 array($a_parent_id));
2530 while (
$row = $ilDB->fetchObject(
$res))
2532 $this->applied_users[] =
$row->usr_id;
2549 $set = $ilDB->queryf(
'
2550 SELECT COUNT(*) session_count
2551 FROM usr_session WHERE user_id = %s AND expires > %s',
2552 array(
'integer',
'integer'),
2553 array($a_user_id, time()));
2554 $row = $ilDB->fetchAssoc($set);
2555 return (
bool)
$row[
'session_count'];
2582 require_once (
'Services/WebDAV/classes/class.ilDAVActivationChecker.php');
2585 require_once (
'Services/WebDAV/classes/class.ilDAVServer.php');
2586 require_once (
'Services/Database/classes/class.ilAuthContainerMDB2.php');
2591 $login =$ilAuth->getUsername();
2604 global $ilDB,$ilAuth;
2607 $set = $ilDB->queryF(
"SELECT active FROM usr_data WHERE login= %s",
2611 if ($rec = $ilDB->fetchAssoc($set))
2647 $res = $ilDB->queryF(
"SELECT login FROM usr_data ".
2648 "WHERE email = %s and active = 1",
2652 while(
$row = $ilDB->fetchObject(
$res))
2654 $ids[] =
$row->login;
2674 $res = $ilDB->queryF(
"SELECT usr_id FROM usr_data ".
2675 "WHERE email = %s", array(
"text"), array($a_email));
2678 return $row->usr_id ?
$row->usr_id : 0;
2705 static function searchUsers($a_search_str,
$active = 1, $a_return_ids_only =
false, $filter_settings = FALSE)
2710 $query =
"SELECT usr_data.usr_id, usr_data.login, usr_data.firstname, usr_data.lastname, usr_data.email, usr_data.active FROM usr_data ";
2712 $without_anonymous_users =
true;
2715 $join_filter =
" WHERE ";
2716 if ($filter_settings !== FALSE && strlen($filter_settings))
2718 switch ($filter_settings)
2722 $join_filter =
" LEFT JOIN obj_members ON usr_data.usr_id = obj_members.usr_id WHERE obj_members.usr_id IS NULL AND ";
2729 $join_filter =
" LEFT JOIN obj_members ON usr_data.usr_id = obj_members.usr_id WHERE obj_members.obj_id = ".
2730 "(SELECT obj_id FROM object_reference WHERE ref_id = ".$ilDB->quote(
$ref_id,
"integer").
") AND ";
2738 $rolf = $rbacreview->getRoleFolderOfObject(
$ref_id);
2739 $local_roles = $rbacreview->getRolesOfRoleFolder($rolf[
"ref_id"],
false);
2740 if (is_array($local_roles) && count($local_roles))
2742 $join_filter =
" LEFT JOIN rbac_ua ON usr_data.usr_id = rbac_ua.usr_id WHERE ".
2743 $ilDB->in(
"rbac_ua.rol_id", $local_roles,
false, $local_roles).
" AND ";
2749 $rol_id =
$_SESSION[
"user_filter_data"];
2752 $join_filter =
" LEFT JOIN rbac_ua ON usr_data.usr_id = rbac_ua.usr_id WHERE rbac_ua.rol_id = ".
2753 $ilDB->quote($rol_id,
"integer").
" AND ";
2754 $without_anonymous_users =
false;
2761 if (strtolower(substr($a_search_str, 0, 5)) ==
"role:")
2763 $query =
"SELECT DISTINCT usr_data.usr_id,usr_data.login,usr_data.firstname,usr_data.lastname,usr_data.email ".
2764 "FROM object_data,rbac_ua,usr_data ".
2765 "WHERE ".$ilDB->like(
"object_data.title",
"text",
"%".substr($a_search_str,5).
"%").
2766 " AND object_data.type = 'role' ".
2767 "AND rbac_ua.rol_id = object_data.obj_id ".
2768 "AND usr_data.usr_id = rbac_ua.usr_id ".
2769 "AND rbac_ua.usr_id != ".$ilDB->quote(ANONYMOUS_USER_ID,
"integer");
2774 "(".$ilDB->like(
"usr_data.login",
"text",
"%".$a_search_str.
"%").
" ".
2775 "OR ".$ilDB->like(
"usr_data.firstname",
"text",
"%".$a_search_str.
"%").
" ".
2776 "OR ".$ilDB->like(
"usr_data.lastname",
"text",
"%".$a_search_str.
"%").
" ".
2777 "OR ".$ilDB->like(
"usr_data.email",
"text",
"%".$a_search_str.
"%").
") ";
2779 if ($filter_settings !== FALSE && strlen($filter_settings))
2781 switch ($filter_settings)
2784 $query.=
" AND usr_data.active = ".$ilDB->quote(0,
"integer").
" ";
2787 $query.=
" AND usr_data.active = ".$ilDB->quote(1,
"integer").
" ";
2790 $query.=
" AND usr_data.time_limit_unlimited = ".$ilDB->quote(0,
"integer").
" ";
2793 $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"]));
2794 $query.=
" AND last_login < ".$ilDB->quote($date,
"timestamp").
" ";
2799 if ($without_anonymous_users)
2801 $query.=
"AND usr_data.usr_id != ".$ilDB->quote(ANONYMOUS_USER_ID,
"integer");
2804 if (is_numeric(
$active) &&
$active > -1 && $filter_settings === FALSE)
2806 $query.=
" AND active = ".$ilDB->quote(
$active,
"integer").
" ";
2812 while (
$row = $ilDB->fetchObject(
$res))
2815 "usr_id" =>
$row->usr_id,
2816 "login" =>
$row->login,
2817 "firstname" =>
$row->firstname,
2818 "lastname" =>
$row->lastname,
2819 "email" =>
$row->email,
2820 "active" =>
$row->active);
2821 $ids[] =
$row->usr_id;
2823 if ($a_return_ids_only)
2824 return $ids ? $ids : array();
2826 return $users ? $users : array();
2841 $res = $ilDB->query(
"SELECT login FROM usr_data");
2842 while(
$row = $ilDB->fetchObject(
$res))
2844 $logins[] =
$row->login;
2846 return $logins ? $logins : array();
2860 $res = $ilDB->query(
"SELECT * FROM usr_data WHERE ".
2861 $ilDB->in(
"usr_id", $a_user_ids,
false,
"integer"));
2862 while (
$row = $ilDB->fetchAssoc(
$res))
2864 $user_data[
"$row[usr_id]"] =
$row;
2866 return $user_data ? $user_data : array();
2881 $result_arr = array();
2885 if ($a_fields !== NULL and is_array($a_fields))
2887 if (count($a_fields) == 0)
2893 if (($usr_id_field = array_search(
"usr_id",$a_fields)) !==
false)
2894 unset($a_fields[$usr_id_field]);
2896 $select = implode(
",",$a_fields).
",usr_data.usr_id";
2898 if(in_array(
'online_time',$a_fields))
2900 $select .=
",ut_online.online_time ";
2904 $q =
"SELECT ".$select.
" FROM usr_data ";
2908 if(in_array(
'online_time',$a_fields))
2910 $q .=
"LEFT JOIN ut_online ON usr_data.usr_id = ut_online.usr_id ";
2917 $q .=
"WHERE active = ".$ilDB->quote(
$active,
"integer");
2920 $q .=
"WHERE time_limit_unlimited= ".$ilDB->quote(0,
"integer");;
2923 $qtemp = $q .
", rbac_ua, object_data WHERE rbac_ua.rol_id = object_data.obj_id AND ".
2924 $ilDB->like(
"object_data.title",
"text",
"%crs%").
" AND usr_data.usr_id = rbac_ua.usr_id";
2925 $r = $ilDB->query($qtemp);
2926 $course_users = array();
2927 while (
$row = $ilDB->fetchAssoc($r))
2929 array_push($course_users,
$row[
"usr_id"]);
2931 if (count($course_users))
2933 $q .=
" WHERE ".$ilDB->in(
"usr_data.usr_id", $course_users,
true,
"integer").
" ";
2941 $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"]));
2942 $q.=
" AND last_login < ".$ilDB->quote($date,
"timestamp");
2948 $q .=
" LEFT JOIN obj_members ON usr_data.usr_id = obj_members.usr_id ".
2949 "WHERE obj_members.obj_id = (SELECT obj_id FROM object_reference ".
2950 "WHERE ref_id = ".$ilDB->quote(
$ref_id,
"integer").
") ";
2958 $rolf = $rbacreview->getRoleFolderOfObject(
$ref_id);
2959 $local_roles = $rbacreview->getRolesOfRoleFolder($rolf[
"ref_id"],
false);
2960 if (is_array($local_roles) && count($local_roles))
2962 $q.=
" LEFT JOIN rbac_ua ON usr_data.usr_id = rbac_ua.usr_id WHERE ".
2963 $ilDB->in(
"rbac_ua.rol_id", $local_roles,
false,
"integer").
" ";
2968 $rol_id =
$_SESSION[
"user_filter_data"];
2971 $q .=
" LEFT JOIN rbac_ua ON usr_data.usr_id = rbac_ua.usr_id WHERE rbac_ua.rol_id = ".
2972 $ilDB->quote($rol_id,
"integer");
2976 $r = $ilDB->query($q);
2978 while (
$row = $ilDB->fetchAssoc($r))
2980 $result_arr[] =
$row;
2994 $q =
"SELECT count(*) as cnt FROM usr_pref up1, usr_pref up2 ".
2995 " WHERE up1.keyword= ".$ilDB->quote(
"style",
"text").
2996 " AND up1.value= ".$ilDB->quote($a_style,
"text").
2997 " AND up2.keyword= ".$ilDB->quote(
"skin",
"text").
2998 " AND up2.value= ".$ilDB->quote($a_skin,
"text").
2999 " AND up1.usr_id = up2.usr_id ";
3001 $cnt_set = $ilDB->query($q);
3003 $cnt_rec = $ilDB->fetchAssoc($cnt_set);
3005 return $cnt_rec[
"cnt"];
3015 $q =
"SELECT DISTINCT up1.value style, up2.value skin FROM usr_pref up1, usr_pref up2 ".
3016 " WHERE up1.keyword = ".$ilDB->quote(
"style",
"text").
3017 " AND up2.keyword = ".$ilDB->quote(
"skin",
"text").
3018 " AND up1.usr_id = up2.usr_id";
3020 $sty_set = $ilDB->query($q);
3023 while($sty_rec = $ilDB->fetchAssoc($sty_set))
3025 $styles[] = $sty_rec[
"skin"].
":".$sty_rec[
"style"];
3038 $q =
"SELECT up1.usr_id usr_id FROM usr_pref up1, usr_pref up2 ".
3039 " WHERE up1.keyword= ".$ilDB->quote(
"style",
"text").
3040 " AND up1.value= ".$ilDB->quote($a_from_style,
"text").
3041 " AND up2.keyword= ".$ilDB->quote(
"skin",
"text").
3042 " AND up2.value= ".$ilDB->quote($a_from_skin,
"text").
3043 " AND up1.usr_id = up2.usr_id ";
3045 $usr_set = $ilDB->query($q);
3047 while ($usr_rec = $ilDB->fetchAssoc($usr_set))
3049 self::_writePref($usr_rec[
"usr_id"],
"skin", $a_to_skin);
3050 self::_writePref($usr_rec[
"usr_id"],
"style", $a_to_style);
3068 $item_set = $ilDB->queryF(
"SELECT * FROM desktop_item WHERE ".
3069 "item_id = %s AND type = %s AND user_id = %s",
3070 array(
"integer",
"text",
"integer"),
3071 array($a_item_id, $a_type, $a_usr_id));
3074 if (!$ilDB->fetchAssoc($item_set))
3076 $ilDB->manipulateF(
"INSERT INTO desktop_item (item_id, type, user_id, parameters) VALUES ".
3077 " (%s,%s,%s,%s)", array(
"integer",
"text",
"integer",
"text"),
3078 array($a_item_id,$a_type,$a_usr_id,$a_par));
3081 include_once
'./Services/Calendar/classes/class.ilCalendarCategories.php';
3109 $ilDB->manipulateF(
"UPDATE desktop_item SET parameters = %s ".
3110 " WHERE item_id = %s AND type = %s AND user_id = %s",
3111 array(
"text",
"integer",
"text",
"integer"),
3112 array($a_par, $a_item_id, $a_type, $this->
getId()));
3129 $ilDB->manipulateF(
"DELETE FROM desktop_item WHERE ".
3130 " item_id = %s AND type = %s AND user_id = %s",
3131 array(
"integer",
"text",
"integer"),
3132 array($a_item_id, $a_type, $a_usr_id));
3134 include_once
'./Services/Calendar/classes/class.ilCalendarCategories.php';
3160 $r = $ilDB->queryF(
"SELECT user_id FROM desktop_item WHERE item_id = %s",
3161 array(
"integer"), array($a_id));
3165 while (
$row = $ilDB->fetchObject($r))
3167 $users[] =
$row->user_id;
3170 if (count($users) > 0)
3172 $ilDB->manipulateF(
"DELETE FROM desktop_item WHERE item_id = %s",
3173 array(
"integer"), array($a_id));
3192 if (self::$is_desktop_item_loaded[$a_usr_id.
":".$a_item_id])
3194 return self::$is_desktop_item_cache[$a_usr_id.
":".$a_item_id.
":".$a_type];
3196 $item_set = $ilDB->queryF(
"SELECT item_id FROM desktop_item WHERE ".
3197 "item_id = %s AND type = %s AND user_id = %s",
3198 array(
"integer",
"text",
"integer"),
3199 array($a_item_id, $a_type, $a_usr_id));
3201 if ($ilDB->fetchAssoc($item_set))
3221 if (!is_array($a_item_ids))
3226 $item_ids = array();
3227 foreach ($a_item_ids as
$id)
3229 if (!self::$is_desktop_item_loaded[$a_usr_id.
":".$id])
3233 self::$is_desktop_item_loaded[$a_usr_id.
":".
$id] =
true;
3236 if (count($item_ids) > 0)
3238 $item_set = $ilDB->query(
"SELECT item_id, type FROM desktop_item WHERE ".
3239 $ilDB->in(
"item_id", $item_ids,
false,
"integer").
3240 " AND user_id = ".$ilDB->quote($a_usr_id,
"integer"));
3241 while ($r = $ilDB->fetchAssoc($item_set))
3243 self::$is_desktop_item_cache[$a_usr_id.
":".$r[
"item_id"].
":".$r[
"type"]]
3274 global
$ilUser, $rbacsystem, $tree, $ilDB;
3278 $item_set = $ilDB->queryF(
"SELECT obj.obj_id, obj.description, oref.ref_id, obj.title, obj.type ".
3279 " FROM desktop_item it, object_reference oref ".
3280 ", object_data obj".
3282 "it.item_id = oref.ref_id AND ".
3283 "oref.obj_id = obj.obj_id AND ".
3284 "it.user_id = %s", array(
"integer"), array($user_id));
3286 while ($item_rec = $ilDB->fetchAssoc($item_set))
3288 if ($tree->isInTree($item_rec[
"ref_id"])
3289 && $item_rec[
"type"] !=
"rolf"
3290 && $item_rec[
"type"] !=
"itgr")
3292 $parent_ref = $tree->getParentId($item_rec[
"ref_id"]);
3293 $par_left = $tree->getLeftValue($parent_ref);
3294 $par_left = sprintf(
"%010d", $par_left);
3299 $items[$par_left.$title.$item_rec[
"ref_id"]] =
3300 array(
"ref_id" => $item_rec[
"ref_id"],
3301 "obj_id" => $item_rec[
"obj_id"],
3302 "type" => $item_rec[
"type"],
3304 "description" =>
$desc,
3305 "parent_ref" => $parent_ref);
3313 if (!is_array($a_types))
3315 $a_types = array($a_types);
3318 $foundsurveys = array();
3319 foreach($a_types as $a_type)
3321 if ($a_type ==
"itgr")
3325 $item_set = $ilDB->queryF(
"SELECT obj.obj_id, obj.description, oref.ref_id, obj.title FROM desktop_item it, object_reference oref ".
3326 ", object_data obj WHERE ".
3327 "it.item_id = oref.ref_id AND ".
3328 "oref.obj_id = obj.obj_id AND ".
3329 "it.type = %s AND ".
3332 array(
"text",
"integer"),
3333 array($a_type, $user_id));
3335 while ($item_rec = $ilDB->fetchAssoc($item_set))
3339 $items[
$title.$a_type.$item_rec[
"ref_id"]] =
3340 array(
"ref_id" => $item_rec[
"ref_id"],
3341 "obj_id" => $item_rec[
"obj_id"],
"type" => $a_type,
3366 $a_parent = 0, $a_time = 0, $a_order_nr = 0)
3372 $a_time = date(
"Y-m-d H:i:s", time());
3375 $item_set = $ilDB->queryF(
"SELECT * FROM personal_clipboard WHERE ".
3376 "parent = %s AND item_id = %s AND type = %s AND user_id = %s",
3377 array(
"integer",
"integer",
"text",
"integer"),
3378 array(0, $a_item_id, $a_type, $this->
getId()));
3381 if (!
$d = $item_set->fetchRow())
3383 $ilDB->manipulateF(
"INSERT INTO personal_clipboard ".
3384 "(item_id, type, user_id, title, parent, insert_time, order_nr) VALUES ".
3385 " (%s,%s,%s,%s,%s,%s,%s)",
3386 array(
"integer",
"text",
"integer",
"text",
"integer",
"timestamp",
"integer"),
3387 array($a_item_id, $a_type, $this->
getId(), $a_title, (
int) $a_parent, $a_time, (
int) $a_order_nr));
3391 $ilDB->manipulateF(
"UPDATE personal_clipboard SET insert_time = %s ".
3392 "WHERE user_id = %s AND item_id = %s AND type = %s AND parent = 0",
3393 array(
"timestamp",
"integer",
"integer",
"text"),
3394 array($a_time, $this->
getId(), $a_item_id, $a_type));
3406 $a_time = date(
"Y-m-d H:i:s", time());
3408 $ilDB->insert(
"personal_pc_clipboard", array(
3409 "user_id" => array(
"integer", $this->
getId()),
3410 "content" => array(
"clob", $a_content),
3411 "insert_time" => array(
"timestamp", $a_time),
3412 "order_nr" => array(
"integer", $a_nr)
3423 $set = $ilDB->queryF(
"SELECT MAX(insert_time) mtime FROM personal_pc_clipboard ".
3424 " WHERE user_id = %s", array(
"integer"), array($this->
getId()));
3425 $row = $ilDB->fetchAssoc($set);
3427 $set = $ilDB->queryF(
"SELECT * FROM personal_pc_clipboard ".
3428 " WHERE user_id = %s AND insert_time = %s ORDER BY order_nr ASC",
3429 array(
"integer",
"timestamp"),
3432 while (
$row = $ilDB->fetchAssoc($set))
3434 $content[] =
$row[
"content"];
3447 $set = $ilDB->queryF(
"SELECT * FROM personal_clipboard WHERE ".
3448 "parent = %s AND type = %s AND user_id = %s",
3449 array(
"integer",
"text",
"integer"),
3450 array(0, $a_type, $this->
getId()));
3451 if ($rec = $ilDB->fetchAssoc($set))
3466 $ilDB->manipulateF(
"DELETE FROM personal_clipboard WHERE ".
3467 "type = %s AND user_id = %s",
3468 array(
"text",
"integer"),
3469 array($a_type, $this->
getId()));
3479 $ilDB->manipulateF(
"DELETE FROM personal_clipboard WHERE ".
3480 "user_id = %s", array(
"integer"), array($this->
getId()));
3491 if ($a_top_nodes_only)
3493 $par =
" AND parent = ".$ilDB->quote(0,
"integer").
" ";
3496 $type_str = ($a_type !=
"")
3497 ?
" AND type = ".$ilDB->quote($a_type,
"text").
" "
3499 $q =
"SELECT * FROM personal_clipboard WHERE ".
3500 "user_id = ".$ilDB->quote($this->
getId(),
"integer").
" ".
3502 " ORDER BY order_nr";
3503 $objs = $ilDB->query($q);
3505 while ($obj = $ilDB->fetchAssoc($objs))
3507 if ($obj[
"type"] ==
"mob")
3511 if ($obj[
"type"] ==
"incl")
3513 include_once(
"./Modules/MediaPool/classes/class.ilMediaPoolPage.php");
3516 $objects[] = array (
"id" => $obj[
"item_id"],
3517 "type" => $obj[
"type"],
"title" => $obj[
"title"],
3518 "insert_time" => $obj[
"insert_time"]);
3530 $objs = $ilDB->queryF(
"SELECT * FROM personal_clipboard WHERE ".
3531 "user_id = %s AND parent = %s AND insert_time = %s ".
3532 " ORDER BY order_nr",
3533 array(
"integer",
"integer",
"timestamp"),
3534 array($ilUser->getId(), (int) $a_parent, $a_insert_time));
3536 while ($obj = $ilDB->fetchAssoc($objs))
3538 if ($obj[
"type"] ==
"mob")
3542 $objects[] = array (
"id" => $obj[
"item_id"],
3543 "type" => $obj[
"type"],
"title" => $obj[
"title"]);
3560 $q =
"SELECT DISTINCT user_id FROM personal_clipboard WHERE ".
3561 "item_id = ".$ilDB->quote($a_id,
"integer").
" AND ".
3562 "type = ".$ilDB->quote($a_type,
"text");
3563 $user_set = $ilDB->query($q);
3565 while ($user_rec = $ilDB->fetchAssoc($user_set))
3567 $users[] = $user_rec[
"user_id"];
3584 $q =
"DELETE FROM personal_clipboard WHERE ".
3585 "item_id = ".$ilDB->quote($a_item_id,
"integer").
3586 " AND type = ".$ilDB->quote($a_type,
"text").
" ".
3587 " AND user_id = ".$ilDB->quote($this->
getId(),
"integer");
3588 $ilDB->manipulate($q);
3595 $query =
"SELECT obj_id FROM object_data WHERE import_id = ".
3596 $ilDB->quote($i2_id,
"text");
3599 while(
$row = $ilDB->fetchObject(
$res))
3630 $this->auth_mode = $a_str;
3644 include_once(
'./Services/Authentication/classes/class.ilAuthUtils.php');
3657 $this->ext_account = $a_str;
3669 return $this->ext_account;
3687 include_once(
'./Services/Authentication/classes/class.ilAuthUtils.php');
3688 $q =
"SELECT login,usr_id,ext_account,auth_mode FROM usr_data ".
3689 "WHERE auth_mode = %s";
3691 $values[] = $a_auth_mode;
3694 $q.=
" OR auth_mode = %s ";
3696 $values[] =
'default';
3699 $res = $ilDB->queryF($q, $types, $values);
3700 while (
$row = $ilDB->fetchObject(
$res))
3702 if(
$row->auth_mode ==
'default')
3704 $accounts[
$row->usr_id] =
$row->login;
3708 $accounts[
$row->usr_id] =
$row->ext_account;
3711 return $accounts ? $accounts : array();
3725 if(!is_array($a_usr_ids))
3733 $q =
"UPDATE usr_data SET active = 1, inactivation_date = NULL WHERE ".
3734 $ilDB->in(
"usr_id", $a_usr_ids,
false,
"integer");
3735 $ilDB->manipulate($q);
3739 $usrId_IN_usrIds = $ilDB->in(
"usr_id", $a_usr_ids,
false,
"integer");
3741 $q =
"UPDATE usr_data SET active = 0 WHERE $usrId_IN_usrIds";
3742 $ilDB->manipulate($q);
3746 SET inactivation_date = %s
3747 WHERE inactivation_date IS NULL
3748 AND $usrId_IN_usrIds
3750 $ilDB->manipulateF($queryString, array(
'timestamp'), array(
ilUtil::now()));
3781 $r = $ilDB->queryF(
"SELECT * FROM usr_data WHERE ".
3782 " ext_account = %s AND auth_mode = %s",
3783 array(
"text",
"text"),
3784 array($a_account, $a_auth));
3785 if ($usr = $ilDB->fetchAssoc($r))
3787 return $usr[
"login"];
3791 $res = $ilDB->queryF(
"SELECT login FROM usr_data ".
3792 "WHERE login = %s AND auth_mode = %s",
3793 array(
"text",
"text"),
3794 array($a_account, $a_auth));
3795 if($usr = $ilDB->fetchAssoc(
$res))
3797 return $usr[
'login'];
3803 $res = $ilDB->queryF(
"SELECT login FROM usr_data WHERE ".
3804 " ext_account = %s AND auth_mode = %s",
3805 array(
"text",
"text"),
3806 array($a_account,
"default"));
3807 if ($usr = $ilDB->fetchAssoc(
$res))
3809 return $usr[
"login"];
3812 $res = $ilDB->queryF(
"SELECT login FROM usr_data ".
3813 "WHERE login = %s AND (ext_account IS NULL OR ext_account = '') AND auth_mode = %s",
3814 array(
"text",
"text"),
3815 array($a_account,
"default"));
3816 if($usr = $ilDB->fetchAssoc(
$res))
3818 return $usr[
"login"];
3831 $r = $ilDB->query(
"SELECT count(*) AS cnt, auth_mode FROM usr_data ".
3832 "GROUP BY auth_mode");
3834 while($cnt = $ilDB->fetchAssoc($r))
3836 $cnt_arr[$cnt[
"auth_mode"]] = $cnt[
"cnt"];
3853 $q =
"SELECT * FROM usr_data WHERE ".
3854 " email = %s AND (auth_mode = %s ";
3855 $types = array(
"text",
"text");
3856 $values = array($a_email,
"local");
3858 if ($ilSetting->get(
"auth_mode") == 1)
3860 $q.=
" OR auth_mode = %s";
3862 $values[] =
"default";
3868 $usr_set = $ilDB->queryF($q, $types, $values);
3869 while ($usr_rec = $ilDB->fetchAssoc($usr_set))
3871 $users[$usr_rec[
"usr_id"]] = $usr_rec[
"login"];
3888 $image_dir = $webspace_dir.
"/usr_images";
3889 $store_file =
"usr_".$obj_id.
".".
"jpg";
3890 $target_file = $image_dir.
"/$store_file";
3892 chmod($tmp_file, 0770);
3896 $show_file =
"$image_dir/usr_".$obj_id.
".jpg";
3897 $thumb_file =
"$image_dir/usr_".$obj_id.
"_small.jpg";
3898 $xthumb_file =
"$image_dir/usr_".$obj_id.
"_xsmall.jpg";
3899 $xxthumb_file =
"$image_dir/usr_".$obj_id.
"_xxsmall.jpg";
3907 self::_writePref($obj_id,
"profile_image", $store_file);
3923 if(isset(self::$personal_image_cache[$this->
getId()][$a_size][(
int)$a_force_pic]))
3925 return self::$personal_image_cache[$this->
getId()][$a_size][(int)$a_force_pic];
3930 return self::$personal_image_cache[$this->
getId()][$a_size][(int)$a_force_pic];
3943 $a_prevent_no_photo_image =
false)
3948 $res = $ilDB->queryF(
"SELECT * FROM usr_pref WHERE ".
3949 "keyword IN (%s,%s) ".
3951 array(
"text",
"text",
"integer"),
3952 array(
'public_upload',
'public_profile', $a_usr_id));
3953 while (
$row = $ilDB->fetchAssoc(
$res))
3955 switch (
$row[
'keyword'])
3957 case 'public_upload' :
3958 $upload =
$row[
'value'] ==
'y';
3960 case 'public_profile' :
3961 $profile = (
$row[
'value'] ==
'y' ||
3962 $row[
'value'] ==
'g');
3969 if(defined(
'ILIAS_MODULE'))
3971 $webspace_dir = (
'.'.$webspace_dir);
3973 $webspace_dir .= (
'./'.ilUtil::getWebspaceDir());
3975 $image_dir = $webspace_dir.
"/usr_images";
3977 if ($a_size ==
'big')
3979 $thumb_file = $image_dir.
"/usr_".$a_usr_id.
".jpg";
3983 $thumb_file = $image_dir.
"/usr_".$a_usr_id.
"_".$a_size.
".jpg";
3987 if((($upload && $profile) || $a_force_pic)
3988 && @is_file($thumb_file))
3990 $file = $thumb_file.
"?t=".rand(1, 99999);
3994 if (!$a_prevent_no_photo_image)
3997 if($a_size ==
"small" || $a_size ==
"big")
4016 $a_dir = trim(str_replace(
"..",
"", $a_dir));
4017 if ($a_dir ==
"" || !is_dir($a_dir))
4023 $image_dir = $webspace_dir.
"/usr_images";
4025 "upload_".$a_user_id.
"pic",
4026 "usr_".$a_user_id.
".".
"jpg",
4027 "usr_".$a_user_id.
"_small.jpg",
4028 "usr_".$a_user_id.
"_xsmall.jpg",
4029 "usr_".$a_user_id.
"_xxsmall.jpg",
4030 "upload_".$a_user_id);
4031 foreach ($images as $image)
4033 if (is_file($image_dir.
"/".$image))
4035 copy($image_dir.
"/".$image, $a_dir.
"/".$image);
4047 $image_dir = $webspace_dir.
"/usr_images";
4048 $file = $image_dir.
"/usr_".$this->getID().
".".
"jpg";
4049 $thumb_file = $image_dir.
"/usr_".$this->getID().
"_small.jpg";
4050 $xthumb_file = $image_dir.
"/usr_".$this->getID().
"_xsmall.jpg";
4051 $xxthumb_file = $image_dir.
"/usr_".$this->getID().
"_xxsmall.jpg";
4052 $upload_file = $image_dir.
"/upload_".$this->getID();
4057 $this->
setPref(
"profile_image",
"");
4061 if (@is_file(
$file))
4065 if (@is_file($thumb_file))
4067 unlink($thumb_file);
4069 if (@is_file($xthumb_file))
4071 unlink($xthumb_file);
4073 if (@is_file($xxthumb_file))
4075 unlink($xxthumb_file);
4077 if (@is_file($upload_file))
4079 unlink($upload_file);
4086 if(!is_array($a_data))
4090 foreach($a_data as $field =>
$data)
4092 #$new_data[$field] = ilUtil::stripSlashes($data);
4094 $this->user_defined_data[
'f_'.$field] =
$data;
4096 #$this->user_defined_data = $new_data;
4103 return $this->user_defined_data ? $this->user_defined_data : array();
4112 $field_def = array();
4114 include_once(
"./Services/User/classes/class.ilUserDefinedData.php");
4117 foreach($this->user_defined_data as $field => $value)
4119 if($field !=
'usr_id')
4122 $udata->set($field, $value);
4154 include_once(
"./Services/User/classes/class.ilUserDefinedData.php");
4166 $this->user_defined_data = $udata->getAll();
4190 include_once(
"./Services/User/classes/class.ilUserDefinedData.php");
4208 include_once
'./Services/AccessControl/classes/class.ilObjRole.php';
4209 include_once
'./Services/Utilities/classes/class.ilFormat.php';
4211 global
$lng,$rbacreview;
4213 $language =& $a_language;
4214 $language->loadLanguageModule(
'registration');
4215 $language->loadLanguageModule(
'crs');
4218 $body .= ($language->txt(
"login").
": ".$this->
getLogin().
"\n");
4222 $body .= ($language->txt(
"title").
": ".$this->
getUTitle().
"\n");
4227 $language->txt(
'gender_m') :
4228 $language->txt(
'gender_f');
4229 $body .= ($language->txt(
"gender").
": ".
$gender.
"\n");
4233 $body .= ($language->txt(
"firstname").
": ".$this->
getFirstname().
"\n");
4237 $body .= ($language->txt(
"lastname").
": ".$this->
getLastname().
"\n");
4241 $body .= ($language->txt(
"institution").
": ".$this->
getInstitution().
"\n");
4245 $body .= ($language->txt(
"department").
": ".$this->
getDepartment().
"\n");
4249 $body .= ($language->txt(
"street").
": ".$this->
getStreet().
"\n");
4253 $body .= ($language->txt(
"city").
": ".$this->
getCity().
"\n");
4257 $body .= ($language->txt(
"zipcode").
": ".$this->
getZipcode().
"\n");
4261 $body .= ($language->txt(
"country").
": ".$this->
getCountry().
"\n");
4269 $body .= ($language->txt(
"phone_office").
": ".$this->
getPhoneOffice().
"\n");
4273 $body .= ($language->txt(
"phone_home").
": ".$this->
getPhoneHome().
"\n");
4277 $body .= ($language->txt(
"phone_mobile").
": ".$this->
getPhoneMobile().
"\n");
4279 if(strlen($this->
getFax()))
4281 $body .= ($language->txt(
"fax").
": ".$this->
getFax().
"\n");
4285 $body .= ($language->txt(
"email").
": ".$this->
getEmail().
"\n");
4289 $body .= ($language->txt(
"hobby").
": ".$this->
getHobby().
"\n");
4293 $body .= ($language->txt(
"referral_comment").
": ".$this->
getComment().
"\n");
4297 $body .= ($language->txt(
"matriculation").
": ".$this->
getMatriculation().
"\n");
4306 $body .= ($language->txt(
"create_date").
": ".$date.
"\n");
4309 foreach($rbacreview->getGlobalRoles() as $role)
4311 if($rbacreview->isAssigned($this->getId(),$role))
4318 $body .= ($language->txt(
'reg_role_info').
': '.implode(
',',$gr).
"\n");
4324 $body .= ($language->txt(
'time_limit').
": ".$language->txt(
'crs_unlimited').
"\n");
4337 $body .= $language->txt(
'time_limit').
': '.$start->get(
IL_CAL_DATETIME);
4338 $body .= $language->txt(
'time_limit').
': '.$end->get(
IL_CAL_DATETIME);
4341 #$body .= $language->txt('time_limit').': '.$period;
4354 $var =
"im_".$a_im_type;
4355 $this->$var = $a_im_id;
4360 $var =
"im_".$a_im_type;
4366 $this->delicious = $a_delicious;
4383 $set = $ilDB->queryF(
"SELECT feed_hash from usr_data WHERE usr_id = %s",
4384 array(
"integer"), array($a_user_id));
4385 if ($rec = $ilDB->fetchAssoc($set))
4387 if (strlen($rec[
"feed_hash"]) == 32)
4389 return $rec[
"feed_hash"];
4393 $hash = md5(rand(1,9999999) + str_replace(
" ",
"", (
string) microtime()));
4394 $ilDB->manipulateF(
"UPDATE usr_data SET feed_hash = %s".
4395 " WHERE usr_id = %s",
4396 array(
"text",
"integer"),
4397 array($hash, $a_user_id));
4431 self::_writePref($a_user_id,
"priv_feed_pass",
4432 ($a_password==
"") ?
"" : md5($a_password));
4448 $q =
"SELECT DISTINCT login, usr_id FROM usr_data ".
4451 $values[] = $a_login;
4453 if ($a_user_id != 0)
4455 $q.=
" AND usr_id != %s ";
4456 $types[] =
"integer";
4457 $values[] = $a_user_id;
4460 $r = $ilDB->queryF($q, $types, $values);
4462 if (
$row = $ilDB->fetchAssoc($r))
4464 return $row[
'usr_id'];
4483 $res = $ilDB->queryF(
"SELECT * FROM usr_data ".
4484 "WHERE ext_account = %s AND auth_mode = %s",
4485 array(
"text",
"text"),
4486 array($a_external_account, $a_auth_mode));
4487 return $ilDB->fetchAssoc(
$res) ?
true :
false;
4498 global $ilDB, $rbacreview;
4501 $ids = $rbacreview->assignedUsers($role_id);
4503 if (count ($ids) == 0)
4508 $query =
"SELECT usr_data.*, usr_pref.value AS language
4510 LEFT JOIN usr_pref ON usr_pref.usr_id = usr_data.usr_id AND usr_pref.keyword = %s
4511 WHERE ".$ilDB->in(
"usr_data.usr_id", $ids,
false,
"integer");
4512 $values[] =
"language";
4518 $query .=
" AND usr_data.active = %s";
4520 $types[] =
"integer";
4523 $query .=
" ORDER BY usr_data.lastname, usr_data.firstname ";
4525 $r = $ilDB->queryF(
$query, $types, $values);
4527 while (
$row = $ilDB->fetchAssoc($r))
4543 $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 ";
4545 $values[] =
"language";
4549 $query .=
" AND usr_data.active = %s";
4551 $types[] =
"integer";
4556 $query.=
" AND usr_data.time_limit_owner = %s";
4558 $types[] =
"integer";
4561 $query .=
" AND usr_data.usr_id != %s ";
4562 $values[] = ANONYMOUS_USER_ID;
4563 $types[] =
"integer";
4565 $query .=
" ORDER BY usr_data.lastname, usr_data.firstname ";
4596 global $rbacadmin, $rbacreview, $ilDB;
4600 foreach ($a_mem_ids as $mem_id) {
4601 $ids [] = $ilDB->quote($mem_id);
4604 $query =
"SELECT usr_data.*, usr_pref.value AS language
4606 LEFT JOIN usr_pref ON usr_pref.usr_id = usr_data.usr_id AND usr_pref.keyword = %s
4607 WHERE ".$ilDB->in(
"usr_data.usr_id", $ids,
false,
"integer").
"
4608 AND usr_data.usr_id != %s";
4609 $values[] =
"language";
4611 $values[] = ANONYMOUS_USER_ID;
4612 $types[] =
"integer";
4616 $query .=
" AND active = %s";
4618 $types[] =
"integer";
4623 $query.=
" AND usr_data.time_limit_owner = %s";
4624 $values[] = $timelimitowner;
4625 $types[] =
"integer";
4629 $query .=
" ORDER BY usr_data.lastname, usr_data.firstname ";
4637 return $mem_arr ? $mem_arr : array();
4651 if (is_array($a_internalids)) {
4652 foreach ($a_internalids as $internalid) {
4653 if (is_numeric ($internalid))
4655 $ids[] = $internalid;
4660 if (is_numeric($parsedid) && $parsedid > 0)
4667 if (count($ids) == 0)
4670 $query =
"SELECT usr_data.*, usr_pref.value AS language
4673 ON usr_pref.usr_id = usr_data.usr_id AND usr_pref.keyword = %s
4674 WHERE ".$ilDB->in(
"usr_data.usr_id", $ids,
false,
"integer");
4675 $values[] =
"language";
4678 $query .=
" ORDER BY usr_data.lastname, usr_data.firstname ";
4701 $r = $ilDB->queryF(
"SELECT * FROM usr_pref WHERE usr_id = %s",
4702 array(
"integer"), array($user_id));
4704 while(
$row = $ilDB->fetchAssoc($r))
4717 $query =
"UPDATE usr_data SET login_attempts = 0 WHERE usr_id = %s";
4718 $affected = $ilDB->manipulateF(
$query, array(
'integer'), array($a_usr_id) );
4720 if($affected)
return true;
4728 $query =
"SELECT login_attempts FROM usr_data WHERE usr_id = %s";
4729 $result = $ilDB->queryF(
$query, array(
'integer'), array($a_usr_id) );
4730 $record = $ilDB->fetchAssoc(
$result );
4740 $query =
"UPDATE usr_data SET login_attempts = (login_attempts + 1) WHERE usr_id = %s";
4741 $affected = $ilDB->manipulateF(
$query, array(
'integer'), array($a_usr_id) );
4743 if($affected)
return true;
4751 $query =
"UPDATE usr_data SET active = 0, inactivation_date = %s WHERE usr_id = %s";
4752 $affected = $ilDB->manipulateF(
$query, array(
'timestamp',
'integer'), array(
ilUtil::now(), $a_usr_id) );
4754 if($affected)
return true;
4764 return in_array($this->
getPref(
"public_profile"), array(
"y",
"g"));
4787 $res = $ilDB->queryF(
'SELECT * FROM loginname_history WHERE usr_id = %s AND login = %s AND history_date = %s',
4788 array(
'integer',
'text',
'integer'),
4791 if( $ilDB->numRows(
$res) == 0 )
4793 $ilDB->manipulateF(
'
4794 INSERT INTO loginname_history
4795 (usr_id, login, history_date)
4796 VALUES (%s, %s, %s)',
4797 array(
'integer',
'text',
'integer'),
4816 $atime = $pd_set->get(
"user_activity_time") * 60;
4819 if ($a_user_id == 0)
4821 $where =
"WHERE user_id != 0 AND NOT agree_date IS NULL ";
4822 $type_array = array(
"integer");
4823 $val_array = array(time());
4827 $where =
"WHERE user_id = %s ";
4828 $type_array = array(
"integer",
"integer");
4829 $val_array = array($a_user_id, time());
4832 $no_anonym = ($a_no_anonymous)
4833 ?
"AND user_id <> ".$ilDB->quote(ANONYMOUS_USER_ID,
"integer").
" "
4836 include_once
'./Services/User/classes/class.ilUserAccountSettings.php';
4839 include_once
'./Services/User/classes/class.ilUserFilter.php';
4846 $r = $ilDB->queryF($q =
"SELECT count(user_id) as num,user_id,firstname,lastname,title,login,last_login,max(ctime) AS ctime ".
4847 "FROM usr_session ".
4848 "LEFT JOIN usr_data u ON user_id = u.usr_id ".
4849 "LEFT JOIN usr_pref p ON (p.usr_id = u.usr_id AND p.keyword = ".
4850 $ilDB->quote(
"hide_own_online_status",
"text").
") ".$where.
4851 "AND expires > %s ".
4852 "AND (p.value IS NULL OR NOT p.value = ".$ilDB->quote(
"y",
"text").
") ".
4855 "GROUP BY user_id,firstname,lastname,title,login,last_login ".
4856 "ORDER BY lastname, firstname", $type_array, $val_array);
4858 while ($user = $ilDB->fetchAssoc($r))
4861 || $user[
"ctime"] + $atime > $ctime)
4863 $users[$user[
"user_id"]] = $user;
4867 return $users ? $users : array();
4883 $atime = $pd_set->get(
"user_activity_time") * 60;
4885 $no_anonym = ($a_no_anonymous)
4886 ?
"AND user_id <> ".$ilDB->quote(ANONYMOUS_USER_ID,
"integer").
" "
4893 $q =
"SELECT DISTINCT dat.obj_id as obj_id ".
4895 "JOIN rbac_fa fa ON fa.rol_id = ua.rol_id ".
4896 "JOIN object_reference r1 ON r1.ref_id = fa.parent ".
4897 "JOIN tree ON tree.child = r1.ref_id ".
4898 "JOIN object_reference r2 ON r2.ref_id = tree.parent ".
4899 "JOIN object_data dat ON dat.obj_id = r2.obj_id ".
4900 "WHERE ua.usr_id = ".$ilDB->quote($a_user_id,
"integer").
" ".
4901 "AND fa.assign = ".$ilDB->quote(
"y",
"text").
" ".
4902 "AND dat.type IN (".$ilDB->quote(
"crs",
"text").
",".
4903 $ilDB->quote(
"grp",
"text").
")";
4904 $r = $ilDB->query($q);
4906 while (
$row = $ilDB->fetchAssoc($r))
4908 $groups_and_courses_of_user[] =
$row[
"obj_id"];
4911 if (count($groups_and_courses_of_user) == 0)
4913 $q =
"SELECT count(user_id) as num,ctime,user_id,firstname,lastname,title,login,last_login ".
4914 "FROM usr_session ".
4915 "JOIN usr_data ON user_id=usr_id ".
4916 "WHERE user_id = ".$ilDB->quote($a_user_id,
"integer").
" ".
4918 " AND NOT agree_date IS NULL ".
4919 "AND expires > ".$ilDB->quote(time(),
"integer").
" ".
4920 "GROUP BY user_id,ctime,firstname,lastname,title,login,last_login";
4921 $r = $ilDB->query($q);
4925 $q =
"SELECT count(user_id) as num,s.ctime,s.user_id,ud.firstname,ud.lastname,ud.title,ud.login,ud.last_login ".
4926 "FROM usr_session s ".
4927 "JOIN usr_data ud ON ud.usr_id = s.user_id ".
4928 "JOIN rbac_ua ua ON ua.usr_id = s.user_id ".
4929 "JOIN rbac_fa fa ON fa.rol_id = ua.rol_id ".
4930 "JOIN tree ON tree.child = fa.parent ".
4931 "JOIN object_reference or1 ON or1.ref_id = tree.parent ".
4932 "JOIN object_data od ON od.obj_id = or1.obj_id ".
4933 "LEFT JOIN usr_pref p ON (p.usr_id = ud.usr_id AND p.keyword = ".
4934 $ilDB->quote(
"hide_own_online_status",
"text").
") ".
4935 "WHERE s.user_id != 0 ".
4937 "AND (p.value IS NULL OR NOT p.value = ".$ilDB->quote(
"y",
"text").
") ".
4938 "AND s.expires > ".$ilDB->quote(time(),
"integer").
" ".
4939 "AND fa.assign = ".$ilDB->quote(
"y",
"text").
" ".
4940 " AND NOT ud.agree_date IS NULL ".
4941 "AND ".$ilDB->in(
"od.obj_id", $groups_and_courses_of_user,
false,
"integer").
" ".
4942 "GROUP BY s.user_id,s.ctime,ud.firstname,ud.lastname,ud.title,ud.login,ud.last_login ".
4943 "ORDER BY ud.lastname, ud.firstname";
4944 $r = $ilDB->query($q);
4947 while ($user = $ilDB->fetchAssoc($r))
4950 || $user[
"ctime"] + $atime > $ctime)
4952 $users[$user[
"user_id"]] = $user;
4956 return $users ? $users : array();
4973 $hashcode = substr(md5(uniqid(rand(),
true)), 0, 16);
4975 $res = $ilDB->queryf(
'
4976 SELECT COUNT(usr_id) cnt FROM usr_data
4977 WHERE reg_hash = %s',
4982 if(
$row->cnt > 0) $continue =
true;
4986 if($continue)
continue;
4988 $ilDB->manipulateF(
'
4992 array(
'text',
'integer'),
4993 array($hashcode, (
int)$a_usr_id)
5015 $res = $ilDB->queryf(
'
5016 SELECT usr_id, create_date FROM usr_data
5017 WHERE reg_hash = %s',
5020 while(
$row = $ilDB->fetchAssoc(
$res))
5022 require_once
'Services/Registration/classes/class.ilRegistrationSettings.php';
5025 if((
int)$oRegSettigs->getRegistrationHashLifetime() != 0 &&
5026 time() - (int)$oRegSettigs->getRegistrationHashLifetime() > strtotime(
$row[
'create_date']))
5028 require_once
'Services/Registration/exceptions/class.ilRegConfirmationLinkExpiredException.php';
5032 $ilDB->manipulateF(
'
5036 array(
'text',
'integer'),
5037 array(
'', (
int)
$row[
'usr_id'])
5040 return (
int)$row[
'usr_id'];
5043 require_once
'Services/Registration/exceptions/class.ilRegistrationHashNotFoundException.php';
5049 if (strlen($a_birthday))
5056 $this->birthday = null;
5075 if( !(
int)$period )
throw new ilException(
'no valid period given');
5079 $date = date(
'Y-m-d H:i:s', (time() - ((
int)$period * 24 * 60 * 60)) );
5081 $query =
"SELECT usr_id FROM usr_data WHERE last_login < %s";
5083 $res = $ilDB->queryF(
$query, array(
'timestamp'), array($date));
5088 $ids[] =
$row->usr_id;
5105 $field =
'inactivation_date';
5108 if( !(
int)$period )
throw new ilException(
'no valid period given');
5112 $date = date(
'Y-m-d H:i:s', (time() - ((
int)$period * 24 * 60 * 60)) );
5114 $query =
"SELECT usr_id FROM usr_data WHERE $field < %s AND active = %s";
5116 $res = $ilDB->queryF(
$query, array(
'timestamp',
'integer'), array($date, 0));
5121 $ids[] =
$row->usr_id;
5138 if($a_last_login !== null) $last_login = $a_last_login;
5139 else $last_login = date(
'Y-m-d H:i:s');
5143 $query =
"UPDATE usr_data SET last_login = %s WHERE usr_id = %s";
5144 $affected = $ilDB->manipulateF(
$query, array(
'timestamp',
'integer'), array($last_login, $a_usr_id) );
5146 if($affected)
return $last_login;
5154 $query =
"UPDATE object_data SET owner = 0 ".
5155 "WHERE owner = ".$ilDB->quote($this->
getId(),
'integer');
5172 $q =
"SELECT DISTINCT ".$ilDB->upper($ilDB->substr(
"lastname", 1, 1)).
" let".
5174 " WHERE usr_id <> ".$ilDB->quote(ANONYMOUS_USER_ID,
"integer").
5176 $let_set = $ilDB->query($q);
5179 while ($let_rec = $ilDB->fetchAssoc($let_set))
5181 $let[$let_rec[
"let"]] = $let_rec[
"let"];
5191 $query =
'SELECT count(*) num FROM object_data od '.
5192 'JOIN usr_data ud ON obj_id = usr_id '.
5193 'WHERE '.$ilDB->in(
'obj_id',$a_usr_ids,
false,
'integer').
' ';
5196 return $num_rows == count((array) $a_usr_ids);
5205 return (
boolean)
$_SESSION[
"user_captcha_verified"];
5215 $_SESSION[
"user_captcha_verified"] = $a_val;
5226 include_once(
"./Services/Export/classes/class.ilExport.php");
5231 $exp->exportEntity(
"personal_data", $this->
getId(),
"4.3.0",
5232 "Services/User",
$title, $dir);
5243 include_once(
"./Services/Export/classes/class.ilExport.php");
5251 if (is_int(strpos($entry[
"entry"],
".zip")))
5253 return $entry[
"entry"];
5268 include_once(
"./Services/Export/classes/class.ilExport.php");
5270 "/".$this->getPersonalDataExportFile();
5284 $a_bookmarks, $a_notes, $a_calendar)
5286 include_once(
"./Services/Export/classes/class.ilImport.php");
5288 if (!$a_profile_data)
5290 $imp->addSkipEntity(
"Services/User",
"usr_profile");
5294 $imp->addSkipEntity(
"Services/User",
"usr_setting");
5298 $imp->addSkipEntity(
"Services/Bookmarks",
"bookmarks");
5302 $imp->addSkipEntity(
"Services/Notes",
"user_notes");
5306 $imp->addSkipEntity(
"Services/Calendar",
"calendar");
5308 $imp->importEntity($a_file[
"tmp_name"], $a_file[
"name"],
"personal_data",
5321 $NOW = $ilDB->now();
5323 $usrId_IN_usrIds = $ilDB->in(
'usr_id', $usrIds,
false,
'integer');
5327 SET inactivation_date = $NOW
5328 WHERE inactivation_date IS NULL
5329 AND $usrId_IN_usrIds
5332 $ilDB->manipulate($queryString);
5344 $usrId_IN_usrIds = $ilDB->in(
'usr_id', $usrIds,
false,
'integer');
5348 SET inactivation_date = NULL
5349 WHERE $usrId_IN_usrIds
5352 $ilDB->manipulate($queryString);
5381 return $this->
getId() == ANONYMOUS_USER_ID;
5396 return (
bool)$this->
getPref(
"delete_flag");
5404 $this->is_self_registered = (bool) $status;