6define(
"IL_PASSWD_PLAIN", 
"plain");
 
    7define(
"IL_PASSWD_CRYPTED", 
"crypted");
 
   10require_once 
"./Services/Object/classes/class.ilObject.php";
 
   11require_once 
'./Services/User/exceptions/class.ilUserException.php';
 
   12require_once 
'./Modules/OrgUnit/classes/class.ilObjOrgUnit.php';
 
   13require_once 
'./Modules/OrgUnit/classes/class.ilObjOrgUnitTree.php';
 
  189    public function __construct($a_user_id = 0, $a_call_by_reference = 
false)
 
  202        $this->auth_mode = 
"default";
 
  211        if ($a_user_id > 0) {
 
  212            $this->
setId($a_user_id);
 
  217            $this->prefs = array();
 
  219            $this->prefs[
"language"] = $this->
ilias->ini->readVariable(
"language", 
"default");
 
  222            $this->skin = $this->
ilias->ini->readVariable(
"layout", 
"skin");
 
  228            $this->prefs[
"style"] = $this->
ilias->ini->readVariable(
"layout", 
"style");
 
  248        $r = 
$ilDB->queryF(
"SELECT * FROM usr_data " .
 
  249             "WHERE usr_id= %s", array(
"integer"), array($this->
id));
 
  271            if ($this->prefs[
"language"] == 
"") {
 
  272                $this->prefs[
"language"] = $this->oldPrefs[
"language"];
 
  276            include_once(
"./Services/Style/System/classes/class.ilStyleDefinition.php");
 
  277            if ($this->prefs[
"skin"] == 
"" ||
 
  279                $this->prefs[
"skin"] = $this->oldPrefs[
"skin"];
 
  282            $this->skin = $this->prefs[
"skin"];
 
  285            if ($this->prefs[
"style"] == 
"" ||
 
  289                $this->prefs[
"style"] = $this->
ilias->ini->readVariable(
"layout", 
"style");
 
  292            if (empty($this->prefs[
"hits_per_page"])) {
 
  293                $this->prefs[
"hits_per_page"] = 10;
 
  296            $ilErr->raiseError(
"<b>Error: There is no dataset with id " .
 
  297                               $this->
id . 
"!</b><br />class: " . get_class($this) . 
"<br />Script: " . __FILE__ .
 
  298                               "<br />Line: " . __LINE__, 
$ilErr->FATAL);
 
  320        $this->password_encoding_type = $password_encryption_type;
 
  354        if (!$a_data[
"passwd_type"]) {
 
  355            $ilErr->raiseError(
"<b>Error: passwd_type missing in function assignData(). " .
 
  356                                $this->
id . 
"!</b><br />class: " . get_class($this) . 
"<br />Script: " 
  357                                . __FILE__ . 
"<br />Line: " . __LINE__, 
$ilErr->FATAL);
 
  359        if ($a_data[
"passwd"] != 
"********" and strlen($a_data[
'passwd'])) {
 
  360            $this->
setPasswd($a_data[
"passwd"], $a_data[
"passwd_type"]);
 
  368        if (!is_array($a_data[
'birthday'])) {
 
  378        $this->
setCity($a_data[
"city"]);
 
  385        $this->
setFax($a_data[
"fax"]);
 
  404        $this->create_date = $a_data[
"create_date"];
 
  405        $this->
setComment($a_data[
"referral_comment"]);
 
  406        $this->approve_date = $a_data[
"approve_date"];
 
  407        $this->active = $a_data[
"active"];
 
  408        $this->agree_date = $a_data[
"agree_date"];
 
  435    public function saveAsNew($a_from_formular = 
true)
 
  439        $ilAppEventHandler = 
$DIC[
'ilAppEventHandler'];
 
  450        switch ($this->passwd_type) {
 
  452                if (strlen($this->passwd)) {
 
  453                    require_once 
'Services/User/classes/class.ilUserPasswordManager.php';
 
  466                 $ilErr->raiseError(
"<b>Error: passwd_type missing in function saveAsNew. " .
 
  467                                    $this->
id . 
"!</b><br />class: " . get_class($this) . 
"<br />Script: " . __FILE__ .
 
  468                                    "<br />Line: " . __LINE__, 
$ilErr->FATAL);
 
  471        if (!$this->active) {
 
  477        $insert_array = array(
 
  478            "usr_id" => array(
"integer", $this->
id),
 
  479            "login" => array(
"text", $this->
login),
 
  480            "passwd" => array(
"text", $pw_value),
 
  483            "firstname" => array(
"text", $this->firstname),
 
  484            "lastname" => array(
"text", $this->lastname),
 
  485            "title" => array(
"text", $this->utitle),
 
  486            "gender" => array(
"text", $this->gender),
 
  487            "email" => array(
"text", trim($this->email)),
 
  488            "second_email" => array(
"text", trim($this->second_email)),
 
  489            "hobby" => array(
"text", (
string) $this->hobby),
 
  490            "institution" => array(
"text", $this->institution),
 
  491            "department" => array(
"text", $this->department),
 
  492            "street" => array(
"text", $this->street),
 
  493            "city" => array(
"text", $this->city),
 
  494            "zipcode" => array(
"text", $this->zipcode),
 
  495            "country" => array(
"text", $this->country),
 
  496            "sel_country" => array(
"text", $this->sel_country),
 
  497            "phone_office" => array(
"text", $this->phone_office),
 
  498            "phone_home" => array(
"text", $this->phone_home),
 
  499            "phone_mobile" => array(
"text", $this->phone_mobile),
 
  500            "fax" => array(
"text", $this->fax),
 
  502            "last_login" => array(
"timestamp", 
null),
 
  503            "first_login" => array(
"timestamp", 
null),
 
  504            "last_profile_prompt" => array(
"timestamp", 
null),
 
  505            "last_update" => array(
"timestamp", 
ilUtil::now()),
 
  506            "create_date" => array(
"timestamp", 
ilUtil::now()),
 
  507            "referral_comment" => array(
"text", $this->referral_comment),
 
  508            "matriculation" => array(
"text", $this->matriculation),
 
  509            "client_ip" => array(
"text", $this->client_ip),
 
  510            "approve_date" => array(
"timestamp", $this->approve_date),
 
  511            "agree_date" => array(
"timestamp", $this->agree_date),
 
  512            "active" => array(
"integer", (
int) $this->active),
 
  517            "auth_mode" => array(
"text", $this->
getAuthMode()),
 
  520            "latitude" => array(
"text", $this->latitude),
 
  521            "longitude" => array(
"text", $this->longitude),
 
  522            "loc_zoom" => array(
"integer", (
int) $this->loc_zoom),
 
  523            "last_password_change" => array(
"integer", (
int) $this->last_password_change_ts),
 
  524            "passwd_policy_reset" => array(
"integer", (
int) $this->passwd_policy_reset),
 
  525            'inactivation_date' => array(
'timestamp', $this->inactivation_date),
 
  526            'is_self_registered' => array(
'integer', (
int) $this->is_self_registered),
 
  528        $ilDB->insert(
"usr_data", $insert_array);
 
  538        include_once(
"Services/Mail/classes/class.ilMailbox.php");
 
  540        $mbox->createDefaultFolder();
 
  542        include_once 
"Services/Mail/classes/class.ilMailOptions.php";
 
  544        $mail_options->createMailOptionsEntry();
 
  547        $ilAppEventHandler->raise(
 
  550            array(
"user_obj" => $this)
 
  568        $ilAppEventHandler = 
$DIC[
'ilAppEventHandler'];
 
  574        } elseif ($this->active) {
 
  578        $update_array = array(
 
  579            "gender" => array(
"text", $this->gender),
 
  580            "title" => array(
"text", $this->utitle),
 
  581            "firstname" => array(
"text", $this->firstname),
 
  582            "lastname" => array(
"text", $this->lastname),
 
  583            "email" => array(
"text", trim($this->email)),
 
  584            "second_email" => array(
"text", trim($this->second_email)),
 
  586            "hobby" => array(
"text", $this->hobby),
 
  587            "institution" => array(
"text", $this->institution),
 
  588            "department" => array(
"text", $this->department),
 
  589            "street" => array(
"text", $this->street),
 
  590            "city" => array(
"text", $this->city),
 
  591            "zipcode" => array(
"text", $this->zipcode),
 
  592            "country" => array(
"text", $this->country),
 
  593            "sel_country" => array(
"text", $this->sel_country),
 
  594            "phone_office" => array(
"text", $this->phone_office),
 
  595            "phone_home" => array(
"text", $this->phone_home),
 
  596            "phone_mobile" => array(
"text", $this->phone_mobile),
 
  597            "fax" => array(
"text", $this->fax),
 
  598            "referral_comment" => array(
"text", $this->referral_comment),
 
  599            "matriculation" => array(
"text", $this->matriculation),
 
  600            "client_ip" => array(
"text", $this->client_ip),
 
  601            "approve_date" => array(
"timestamp", $this->approve_date),
 
  602            "active" => array(
"integer", $this->active),
 
  609            "auth_mode" => array(
"text", $this->
getAuthMode()),
 
  611            "latitude" => array(
"text", $this->latitude),
 
  612            "longitude" => array(
"text", $this->longitude),
 
  613            "loc_zoom" => array(
"integer", (
int) $this->loc_zoom),
 
  614            "last_password_change" => array(
"integer", $this->last_password_change_ts),
 
  615            "passwd_policy_reset" => array(
"integer", $this->passwd_policy_reset),
 
  616            "last_update" => array(
"timestamp", 
ilUtil::now()),
 
  617            'inactivation_date' => array(
'timestamp', $this->inactivation_date)
 
  620        if (isset($this->agree_date) && (strtotime($this->agree_date) !== 
false || $this->agree_date == 
null)) {
 
  621            $update_array[
"agree_date"] = array(
"timestamp", $this->agree_date);
 
  623        switch ($this->passwd_type) {
 
  625                if (strlen($this->passwd)) {
 
  626                    require_once 
'Services/User/classes/class.ilUserPasswordManager.php';
 
  628                    $update_array[
'passwd'] = array(
'text', $this->
getPasswd());
 
  630                    $update_array[
"passwd"] = array(
"text", (
string) $this->passwd);
 
  635                $update_array[
"passwd"] = array(
"text", (
string) $this->passwd);
 
  639                $ilErr->raiseError(
"<b>Error: passwd_type missing in function update()" . $this->
id . 
"!</b><br />class: " .
 
  640                                   get_class($this) . 
"<br />Script: " . __FILE__ . 
"<br />Line: " . __LINE__, 
$ilErr->FATAL);
 
  644        $update_array[
'passwd_salt'] = array(
'text', $this->
getPasswordSalt());
 
  646        $ilDB->update(
"usr_data", $update_array, array(
"usr_id" => array(
"integer", $this->
id)));
 
  656        parent::updateOwner();
 
  660        $ilAppEventHandler->raise(
 
  663            array(
"user_obj" => $this)
 
  678        $ilDB->manipulateF(
"UPDATE usr_data SET agree_date = " . 
$ilDB->now() .
 
  679             " WHERE usr_id = %s", array(
"integer"), array($this->
getId()));
 
  685    private static function _lookup($a_user_id, $a_field)
 
  692            "SELECT " . $a_field . 
" FROM usr_data WHERE usr_id = %s",
 
  698            return $set[$a_field];
 
  712        $set = 
$ilDB->queryF(
 
  713            "SELECT title, firstname, lastname FROM usr_data WHERE usr_id = %s",
 
  718        if ($rec = 
$ilDB->fetchAssoc($set)) {
 
  722            if ($rec[
"firstname"]) {
 
  725            if ($rec[
"lastname"]) {
 
  782            "SELECT firstname, lastname, title, login FROM usr_data WHERE usr_id = %s",
 
  787        return array(
"user_id" => $a_user_id,
 
  788            "firstname" => $user_rec[
"firstname"],
 
  789            "lastname" => $user_rec[
"lastname"],
 
  790            "title" => $user_rec[
"title"],
 
  791            "login" => $user_rec[
"login"]);
 
  804            "SELECT * FROM usr_data WHERE usr_id = %s",
 
  837        if (!is_array($a_user_str)) {
 
  839                "SELECT usr_id FROM usr_data WHERE login = %s",
 
  844            return $user_rec[
"usr_id"];
 
  847                "SELECT usr_id FROM usr_data " .
 
  848                " WHERE " . 
$ilDB->in(
"login", $a_user_str, 
false, 
"text")
 
  851            while ($rec = 
$ilDB->fetchAssoc($set)) {
 
  852                $ids[] = $rec[
"usr_id"];
 
  887            "UPDATE usr_data SET " .
 
  888             "last_login = " . 
$ilDB->now() .
 
  889             " WHERE usr_id = %s",
 
  896                "UPDATE usr_data SET " .
 
  897                "first_login = " . 
$ilDB->now() .
 
  898                " WHERE usr_id = %s",
 
  913    public function resetPassword($raw, $raw_retype)
 
  922        if (func_num_args() != 2) {
 
  926        if (!isset($raw) || !isset($raw_retype)) {
 
  930        if ($raw != $raw_retype) {
 
  934        require_once 
'Services/User/classes/class.ilUserPasswordManager.php';
 
  939                        SET passwd = %s, passwd_enc_type = %s, passwd_salt = %s 
  941            array(
'text', 
'text', 
'text', 
'integer'),
 
  966                        SELECT * FROM loginname_history 
  972        return $ilDB->fetchAssoc(
$res) ? true : 
false;
 
  993        $ilDB->setLimit(1, 0);
 
  996                        SELECT login, history_date FROM loginname_history 
  997                        WHERE usr_id = %s ORDER BY history_date DESC',
 
 1002        if (!is_array($row) || !count($row)) {
 
 1007            $row[
'login'], $row[
'history_date']
 
 1025        if (func_num_args() != 1) {
 
 1029        if (!isset($a_login)) {
 
 1036        if (0 == strcmp($a_login, $former_login)) {
 
 1043            $last_history_entry = 
null;
 
 1047        if ((
int) 
$ilSetting->get(
'allow_change_loginname') &&
 
 1048           (
int) 
$ilSetting->get(
'reuse_of_loginnames') == 0 &&
 
 1049           self::_doesLoginnameExistInHistory($a_login)) {
 
 1050            throw new ilUserException($this->lng->txt(
'loginname_already_exists'));
 
 1051        } elseif ((
int) 
$ilSetting->get(
'allow_change_loginname') &&
 
 1052                (
int) 
$ilSetting->get(
'loginname_change_blocking_time') &&
 
 1053                is_array($last_history_entry) &&
 
 1054                $last_history_entry[1] + (
int) 
$ilSetting->get(
'loginname_change_blocking_time') > time()) {
 
 1055            include_once 
'Services/Calendar/classes/class.ilDate.php';
 
 1058                    $this->lng->txt(
'changing_loginname_not_possible_info'),
 
 1069            if ((
int) 
$ilSetting->get(
'allow_change_loginname') &&
 
 1070               (
int) 
$ilSetting->get(
'create_history_loginname')) {
 
 1075            $this->
login = $a_login;
 
 1082                array(
'text', 
'integer'),
 
 1099        $this->
setPref($a_keyword, $a_value);
 
 1110        self::_deletePref($this->
getId(), $a_keyword);
 
 1118    public static function _deletePref($a_user_id, $a_keyword)
 
 1128            'DELETE FROM usr_pref WHERE usr_id = %s AND keyword = %s',
 
 1129            array(
'integer', 
'text'),
 
 1130            array($a_user_id, $a_keyword)
 
 1146            "DELETE FROM usr_pref WHERE usr_id = %s",
 
 1158    public static function _writePref($a_usr_id, $a_keyword, $a_value)
 
 1166                "usr_id" => array(
"integer", $a_usr_id),
 
 1167                "keyword" => array(
"text", $a_keyword),
 
 1170                "value" => array(
"text",$a_value)
 
 1197        foreach ($this->prefs as $keyword => $value) {
 
 1213            include_once(
'Services/Calendar/classes/class.ilCalendarSettings.php');
 
 1215            return $settings->getDefaultTimeZone();
 
 1230            include_once(
'Services/Calendar/classes/class.ilCalendarSettings.php');
 
 1232            return $settings->getDefaultTimeFormat();
 
 1247            include_once(
'Services/Calendar/classes/class.ilCalendarSettings.php');
 
 1249            return $settings->getDefaultDateFormat();
 
 1261        if ($a_keyword != 
"") {
 
 1262            $this->prefs[$a_keyword] = $a_value;
 
 1273        if (array_key_exists($a_keyword, $this->prefs)) {
 
 1274            return $this->prefs[$a_keyword];
 
 1286        $query = 
"SELECT * FROM usr_pref WHERE usr_id = " . 
$ilDB->quote($a_usr_id, 
"integer") . 
" " .
 
 1287            "AND keyword = " . 
$ilDB->quote($a_keyword, 
"text");
 
 1306        if (is_array($this->prefs)) {
 
 1318    public function delete()
 
 1326        include_once(
'Services/LDAP/classes/class.ilLDAPRoleGroupMapping.php');
 
 1328        $mapping->deleteUser($this->
getId());
 
 1331        include_once(
"Services/Mail/classes/class.ilMailbox.php");
 
 1334        $mailbox->updateMailsOfDeletedUser($this->
getLogin());
 
 1337        include_once(
"./Services/Block/classes/class.ilCustomBlock.php");
 
 1339        $costum_block->setContextObjId($this->
getId());
 
 1340        $costum_block->setContextObjType(
"user");
 
 1341        $c_blocks = $costum_block->queryBlocksForContext();
 
 1342        include_once(
"./Services/Feeds/classes/class.ilPDExternalFeedBlock.php");
 
 1343        foreach ($c_blocks as $c_block) {
 
 1344            if ($c_block[
"type"] == 
"pdfeed") {
 
 1352        include_once(
"./Services/Block/classes/class.ilBlockSetting.php");
 
 1357            "DELETE FROM usr_data WHERE usr_id = %s",
 
 1359            array($this->
getId())
 
 1370        include_once(
"./Services/Authentication/classes/class.ilSession.php");
 
 1378        $q = 
"DELETE FROM bookmark_tree WHERE tree = " .
 
 1380        $ilDB->manipulate($q);
 
 1382        $q = 
"DELETE FROM bookmark_data WHERE user_id = " .
 
 1384        $ilDB->manipulate($q);
 
 1387        include_once 
'./Modules/Forum/classes/class.ilObjForum.php';
 
 1391        include_once 
'./Services/LinkChecker/classes/class.ilLinkCheckNotify.php';
 
 1395        include_once 
'./Modules/Course/classes/class.ilObjCourse.php';
 
 1399        include_once 
'./Services/Tracking/classes/class.ilObjUserTracking.php';
 
 1402        include_once 
'Modules/Session/classes/class.ilEventParticipants.php';
 
 1406        include_once 
'Modules/Scorm2004/classes/ilSCORM13Package.php';
 
 1410        include_once 
'Modules/ScormAicc/classes/class.ilObjSCORMLearningModule.php';
 
 1414        include_once 
"./Services/Notification/classes/class.ilNotification.php";
 
 1418        include_once 
"./Modules/Portfolio/classes/class.ilObjPortfolio.php";
 
 1422        include_once 
"./Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
 
 1424        $tree->cascadingDelete();
 
 1427        include_once 
"./Services/DiskQuota/classes/class.ilDiskQuotaHandler.php";
 
 1431        require_once 
'Services/User/classes/class.ilCronDeleteInactiveUserReminderMail.php';
 
 1435        include_once 
"Services/Badge/classes/class.ilBadgeAssignment.php";
 
 1440        $ilOrgUnitUserAssignmentQueries->deleteAllAssignmentsOfUser($this->
getId());
 
 1454        $ilAppEventHandler = 
$DIC[
'ilAppEventHandler'];
 
 1455        $ilAppEventHandler->raise(
 
 1458            array(
'usr_id' => $this->
getId())
 
 1475    public function setFullname($a_title = 
"", $a_firstname = 
"", $a_lastname = 
"")
 
 1477        $this->fullname = 
"";
 
 1481        } elseif ($this->utitle) {
 
 1482            $this->fullname = $this->utitle . 
" ";
 
 1487        } elseif ($this->firstname) {
 
 1488            $this->fullname .= $this->firstname . 
" ";
 
 1514        if (!$a_max_strlen) {
 
 1518        if (strlen($this->fullname) <= $a_max_strlen) {
 
 1522        if ((strlen($this->utitle) + strlen($this->lastname) + 4) <= $a_max_strlen) {
 
 1523            return ilUtil::stripSlashes($this->utitle . 
" " . substr($this->firstname, 0, 1) . 
". " . $this->lastname);
 
 1526        if ((strlen($this->firstname) + strlen($this->lastname) + 1) <= $a_max_strlen) {
 
 1530        if ((strlen($this->lastname) + 3) <= $a_max_strlen) {
 
 1544        $this->
login = $a_str;
 
 1563        $this->passwd = $a_str;
 
 1596        $this->gender = substr($a_str, -1);
 
 1617        $this->utitle = $a_str;
 
 1638        $this->firstname = $a_str;
 
 1657        $this->lastname = $a_str;
 
 1676        $this->institution = $a_str;
 
 1695        $this->department = $a_str;
 
 1714        $this->street = $a_str;
 
 1733        $this->city = $a_str;
 
 1752        $this->zipcode = $a_str;
 
 1772        $this->country = $a_str;
 
 1792        $this->sel_country = $a_val;
 
 1812        $this->phone_office = $a_str;
 
 1831        $this->phone_home = $a_str;
 
 1850        $this->phone_mobile = $a_str;
 
 1869        $this->fax = $a_str;
 
 1888        $this->client_ip = $a_str;
 
 1907        $this->matriculation = $a_str;
 
 1931        $query = 
"SELECT matriculation FROM usr_data " .
 
 1932            "WHERE usr_id = " . 
$ilDB->quote($a_usr_id);
 
 1935        return $row->matriculation ? $row->matriculation : 
'';
 
 1945        $this->email = $a_str;
 
 1980        $this->hobby = $a_str;
 
 1999        $this->
setPref(
"language", $a_str);
 
 2010        return $this->prefs[
"language"];
 
 2023        $this->
setPref(
"disk_quota", $a_disk_quota);
 
 2037        return $this->prefs[
"disk_quota"] ? $this->prefs[
"disk_quota"] : 0;
 
 2042        return $this->prefs[
"wsp_disk_quota"] ? $this->prefs[
"wsp_disk_quota"] : 0;
 
 2047        $this->last_password_change_ts = $a_last_password_change_ts;
 
 2068        $this->passwd_policy_reset = $status;
 
 2078        $q = 
"SELECT value FROM usr_pref WHERE usr_id= " .
 
 2079            $ilDB->quote($a_usr_id, 
"integer") . 
" AND keyword = " .
 
 2080            $ilDB->quote(
'language', 
"text");
 
 2081        $r = 
$ilDB->query($q);
 
 2083        while ($row = 
$ilDB->fetchAssoc($r)) {
 
 2084            return $row[
'value'];
 
 2086        if (is_object(
$lng)) {
 
 2087            return $lng->getDefaultLanguage();
 
 2099            "UPDATE usr_data " .
 
 2100            " SET ext_account = %s WHERE usr_id = %s",
 
 2101            array(
"text", 
"integer"),
 
 2102            array($a_ext_id, $a_usr_id)
 
 2113            "UPDATE usr_data " .
 
 2114            " SET auth_mode = %s WHERE usr_id = %s",
 
 2115            array(
"text", 
"integer"),
 
 2116            array($a_auth_mode, $a_usr_id)
 
 2146        $this->last_login = $a_str;
 
 2156        return $this->last_login;
 
 2165        $this->first_login = $a_str;
 
 2183        $this->last_profile_prompt = $a_str;
 
 2202        $this->last_update = $a_str;
 
 2216        $this->referral_comment = $a_str;
 
 2236        $this->approve_date = $a_str;
 
 2267        $this->agree_date = $a_str;
 
 2309        $query = 
'SELECT usr_id FROM usr_data ' .
 
 2310            'WHERE active = ' . 
$ilDB->quote(1, 
'integer') . 
' ' .
 
 2311            'AND usr_id = ' . 
$ilDB->quote($a_usr_id, 
'integer');
 
 2332        if ($this->active) {
 
 2336        if ((!empty($storedActive) && empty($currentActive)) ||
 
 2337                (empty($storedActive) && !empty($currentActive))) {
 
 2351        return $active ? true : 
false;
 
 2362        $this->skin = $a_str;
 
 2367        $this->time_limit_owner = $a_owner;
 
 2371        return $this->time_limit_owner ? $this->time_limit_owner : 7;
 
 2375        $this->time_limit_from = $a_from;
 
 2379        return $this->time_limit_from;
 
 2383        $this->time_limit_until = $a_until;
 
 2387        return $this->time_limit_until;
 
 2391        $this->time_limit_unlimited = $a_unlimited;
 
 2395        return $this->time_limit_unlimited;
 
 2399        return $this->time_limit_message = $a_time_limit_message;
 
 2403        return $this->time_limit_message;
 
 2408        $this->login_attempts = $a_login_attempts;
 
 2429        $this->profile_incomplete = (boolean) $a_prof_inc;
 
 2433        if ($this->
id == ANONYMOUS_USER_ID) {
 
 2436        return $this->profile_incomplete;
 
 2444        if ($this->
id == ANONYMOUS_USER_ID) {
 
 2448        if ($this->
id == SYSTEM_USER_ID) {
 
 2462        $passwordResetOnFirstLogin = (
 
 2463            $security->isPasswordChangeOnFirstLoginEnabled() &&
 
 2468        return ($authModeAllowsPasswordChange && ($passwordResetOnFirstLogin || $passwordResetOnChangedPolicy));
 
 2473        if ($this->
id == ANONYMOUS_USER_ID) {
 
 2477        require_once(
'./Services/PrivacySecurity/classes/class.ilSecuritySettings.php');
 
 2480            $max_pass_age = $security->getPasswordMaxAge();
 
 2481            if ($max_pass_age > 0) {
 
 2482                $max_pass_age_ts = ($max_pass_age * 86400);
 
 2484                $current_ts = time();
 
 2486                if (($current_ts - $pass_change_ts) > $max_pass_age_ts) {
 
 2499        $current_ts = time();
 
 2501        $password_age = (int) (($current_ts - $pass_change_ts) / 86400);
 
 2502        return $password_age;
 
 2513        $query = 
"UPDATE usr_data SET last_password_change = %s " .
 
 2514                "WHERE usr_id = %s";
 
 2515        $affected = 
$ilDB->manipulateF(
 
 2517            array(
'integer',
'integer'),
 
 2533        $query = 
"UPDATE usr_data SET last_password_change = 0 " .
 
 2534                "WHERE usr_id = %s";
 
 2535        $affected = 
$ilDB->manipulateF(
 
 2538            array($this->
getId())
 
 2554        $this->latitude = $a_latitude;
 
 2574        $this->longitude = $a_longitude;
 
 2594        $this->loc_zoom = $a_locationzoom;
 
 2619        $set = 
$ilDB->queryf(
 
 2621                        SELECT COUNT(*) session_count 
 2622                        FROM usr_session WHERE user_id = %s AND expires > %s AND session_id != %s ',
 
 2623            array(
'integer', 
'integer', 
'text'),
 
 2624            array($a_user_id, time(), $a_session_id)
 
 2626        $row = 
$ilDB->fetchAssoc($set);
 
 2627        return (
bool) $row[
'session_count'];
 
 2653        $uid = 
$GLOBALS[
'DIC'][
'ilAuthSession']->getUserId();
 
 2657        require_once(
'Services/WebDAV/classes/class.ilDAVActivationChecker.php');
 
 2674        $pos = strrpos($a_login, 
'/');
 
 2675        $pos2 = strrpos($a_login, 
'\\');
 
 2676        if ($pos === 
false || $pos < $pos2) {
 
 2679        if ($pos !== 
false) {
 
 2680            $a_login = substr($a_login, $pos + 1);
 
 2697        $set = 
$ilDB->queryF(
 
 2698            "SELECT active FROM usr_data WHERE login= %s",
 
 2703        if ($rec = 
$ilDB->fetchAssoc($set)) {
 
 2704            if ($rec[
"active"]) {
 
 2741            "SELECT usr_id FROM usr_data " .
 
 2742            "WHERE email = %s and active = 1",
 
 2747        while ($row = 
$ilDB->fetchObject(
$res)) {
 
 2748            $ids[] = $row->usr_id;
 
 2768            "SELECT login FROM usr_data " .
 
 2769            "WHERE email = %s and active = 1",
 
 2774        while ($row = 
$ilDB->fetchObject(
$res)) {
 
 2775            $ids[] = $row->login;
 
 2805    public static function searchUsers($a_search_str, 
$active = 1, $a_return_ids_only = 
false, $filter_settings = 
false)
 
 2814        $query = 
"SELECT usr_data.usr_id, usr_data.login, usr_data.firstname, usr_data.lastname, usr_data.email, usr_data.active FROM usr_data ";
 
 2816        $without_anonymous_users = 
true;
 
 2819        $join_filter = 
" WHERE ";
 
 2820        if ($filter_settings !== 
false && strlen($filter_settings)) {
 
 2821            switch ($filter_settings) {
 
 2824                    $join_filter = 
" LEFT JOIN obj_members ON usr_data.usr_id = obj_members.usr_id WHERE obj_members.usr_id IS NULL AND ";
 
 2830                        $join_filter = 
" LEFT JOIN obj_members ON usr_data.usr_id = obj_members.usr_id WHERE obj_members.obj_id = " .
 
 2831                            "(SELECT obj_id FROM object_reference WHERE ref_id = " . 
$ilDB->quote(
$ref_id, 
"integer") . 
") AND ";
 
 2841                        if (is_array($local_roles) && count($local_roles)) {
 
 2842                            $join_filter = 
" LEFT JOIN rbac_ua ON usr_data.usr_id = rbac_ua.usr_id WHERE " .
 
 2843                                $ilDB->in(
"rbac_ua.rol_id", $local_roles, 
false, $local_roles) . 
" AND ";
 
 2851                    $rol_id = 
$_SESSION[
"user_filter_data"];
 
 2853                        $join_filter = 
" LEFT JOIN rbac_ua ON usr_data.usr_id = rbac_ua.usr_id WHERE rbac_ua.rol_id = " .
 
 2854                            $ilDB->quote($rol_id, 
"integer") . 
" AND ";
 
 2855                        $without_anonymous_users = 
false;
 
 2862        if (strtolower(substr($a_search_str, 0, 5)) == 
"role:") {
 
 2863            $query = 
"SELECT DISTINCT usr_data.usr_id,usr_data.login,usr_data.firstname,usr_data.lastname,usr_data.email " .
 
 2864                "FROM object_data,rbac_ua,usr_data " .
 
 2865                "WHERE " . 
$ilDB->like(
"object_data.title", 
"text", 
"%" . substr($a_search_str, 5) . 
"%") .
 
 2866                " AND object_data.type = 'role' " .
 
 2867                "AND rbac_ua.rol_id = object_data.obj_id " .
 
 2868                "AND usr_data.usr_id = rbac_ua.usr_id " .
 
 2869                "AND rbac_ua.usr_id != " . 
$ilDB->quote(ANONYMOUS_USER_ID, 
"integer");
 
 2872                "(" . 
$ilDB->like(
"usr_data.login", 
"text", 
"%" . $a_search_str . 
"%") . 
" " .
 
 2873                "OR " . 
$ilDB->like(
"usr_data.firstname", 
"text", 
"%" . $a_search_str . 
"%") . 
" " .
 
 2874                "OR " . 
$ilDB->like(
"usr_data.lastname", 
"text", 
"%" . $a_search_str . 
"%") . 
" " .
 
 2875                "OR " . 
$ilDB->like(
"usr_data.email", 
"text", 
"%" . $a_search_str . 
"%") . 
") ";
 
 2877            if ($filter_settings !== 
false && strlen($filter_settings)) {
 
 2878                switch ($filter_settings) {
 
 2880                        $query .= 
" AND usr_data.active = " . 
$ilDB->quote(0, 
"integer") . 
" ";
 
 2883                        $query .= 
" AND usr_data.active = " . 
$ilDB->quote(1, 
"integer") . 
" ";
 
 2886                        $query .= 
" AND usr_data.time_limit_unlimited = " . 
$ilDB->quote(0, 
"integer") . 
" ";
 
 2889                        $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"]));
 
 2890                        $query .= 
" AND last_login < " . 
$ilDB->quote($date, 
"timestamp") . 
" ";
 
 2895            if ($without_anonymous_users) {
 
 2896                $query .= 
"AND usr_data.usr_id != " . 
$ilDB->quote(ANONYMOUS_USER_ID, 
"integer");
 
 2899            if (is_numeric(
$active) && 
$active > -1 && $filter_settings === 
false) {
 
 2905        while ($row = 
$ilDB->fetchObject(
$res)) {
 
 2907                "usr_id" => $row->usr_id,
 
 2908                "login" => $row->login,
 
 2909                "firstname" => $row->firstname,
 
 2910                "lastname" => $row->lastname,
 
 2911                "email" => $row->email,
 
 2912                "active" => $row->active);
 
 2913            $ids[] = $row->usr_id;
 
 2915        if ($a_return_ids_only) {
 
 2916            return $ids ? $ids : array();
 
 2918            return $users ? $users : array();
 
 2925    public static function getAllUserLogins()
 
 2937            "SELECT login FROM usr_data WHERE " . 
$ilDB->in(
'usr_id', array(ANONYMOUS_USER_ID), 
true, 
'integer')
 
 2939        while ($row = 
$ilDB->fetchAssoc(
$res)) {
 
 2940            $logins[] = $row[
'login'];
 
 2959        $res = 
$ilDB->query(
"SELECT * FROM usr_data WHERE " .
 
 2960            $ilDB->in(
"usr_id", $a_user_ids, 
false, 
"integer"));
 
 2961        while ($row = 
$ilDB->fetchAssoc(
$res)) {
 
 2962            $user_data[
"$row[usr_id]"] = $row;
 
 2964        return $user_data ? $user_data : array();
 
 2981        $result_arr = array();
 
 2985        if ($a_fields !== 
null and is_array($a_fields)) {
 
 2986            if (count($a_fields) == 0) {
 
 2989                if (($usr_id_field = array_search(
"usr_id", $a_fields)) !== 
false) {
 
 2990                    unset($a_fields[$usr_id_field]);
 
 2993                $select = implode(
",", $a_fields) . 
",usr_data.usr_id";
 
 2995                if (in_array(
'online_time', $a_fields)) {
 
 2996                    $select .= 
",ut_online.online_time ";
 
 3000            $q = 
"SELECT " . $select . 
" FROM usr_data ";
 
 3004            if (in_array(
'online_time', $a_fields)) {
 
 3005                $q .= 
"LEFT JOIN ut_online ON usr_data.usr_id = ut_online.usr_id ";
 
 3011                    $q .= 
"WHERE active = " . 
$ilDB->quote(
$active, 
"integer");
 
 3014                    $q .= 
"WHERE time_limit_unlimited= " . 
$ilDB->quote(0, 
"integer");;
 
 3017                    $qtemp = $q . 
", rbac_ua, object_data WHERE rbac_ua.rol_id = object_data.obj_id AND " .
 
 3018                        $ilDB->like(
"object_data.title", 
"text", 
"%crs%") . 
" AND usr_data.usr_id = rbac_ua.usr_id";
 
 3019                    $r = 
$ilDB->query($qtemp);
 
 3020                    $course_users = array();
 
 3021                    while ($row = 
$ilDB->fetchAssoc($r)) {
 
 3022                        array_push($course_users, $row[
"usr_id"]);
 
 3024                    if (count($course_users)) {
 
 3025                        $q .= 
" WHERE " . 
$ilDB->in(
"usr_data.usr_id", $course_users, 
true, 
"integer") . 
" ";
 
 3031                    $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"]));
 
 3032                    $q .= 
" AND last_login < " . 
$ilDB->quote($date, 
"timestamp");
 
 3037                        $q .= 
" LEFT JOIN obj_members ON usr_data.usr_id = obj_members.usr_id " .
 
 3038                            "WHERE obj_members.obj_id = (SELECT obj_id FROM object_reference " .
 
 3039                            "WHERE ref_id = " . 
$ilDB->quote(
$ref_id, 
"integer") . 
") ";
 
 3049                        if (is_array($local_roles) && count($local_roles)) {
 
 3050                            $q .= 
" LEFT JOIN rbac_ua ON usr_data.usr_id = rbac_ua.usr_id WHERE " .
 
 3051                                $ilDB->in(
"rbac_ua.rol_id", $local_roles, 
false, 
"integer") . 
" ";
 
 3056                    $rol_id = 
$_SESSION[
"user_filter_data"];
 
 3058                        $q .= 
" LEFT JOIN rbac_ua ON usr_data.usr_id = rbac_ua.usr_id WHERE rbac_ua.rol_id = " .
 
 3059                            $ilDB->quote($rol_id, 
"integer");
 
 3063            $r = 
$ilDB->query($q);
 
 3065            while ($row = 
$ilDB->fetchAssoc($r)) {
 
 3066                $result_arr[] = $row;
 
 3082        $q = 
"SELECT count(*) as cnt FROM usr_pref up1, usr_pref up2 " .
 
 3083            " WHERE up1.keyword= " . 
$ilDB->quote(
"style", 
"text") .
 
 3084            " AND up1.value= " . 
$ilDB->quote($a_style, 
"text") .
 
 3085            " AND up2.keyword= " . 
$ilDB->quote(
"skin", 
"text") .
 
 3086            " AND up2.value= " . 
$ilDB->quote($a_skin, 
"text") .
 
 3087            " AND up1.usr_id = up2.usr_id ";
 
 3089        $cnt_set = 
$ilDB->query($q);
 
 3091        $cnt_rec = 
$ilDB->fetchAssoc($cnt_set);
 
 3093        return $cnt_rec[
"cnt"];
 
 3105        $q = 
"SELECT DISTINCT up1.value style, up2.value skin FROM usr_pref up1, usr_pref up2 " .
 
 3106            " WHERE up1.keyword = " . 
$ilDB->quote(
"style", 
"text") .
 
 3107            " AND up2.keyword = " . 
$ilDB->quote(
"skin", 
"text") .
 
 3108            " AND up1.usr_id = up2.usr_id";
 
 3110        $sty_set = 
$ilDB->query($q);
 
 3113        while ($sty_rec = 
$ilDB->fetchAssoc($sty_set)) {
 
 3114            $styles[] = $sty_rec[
"skin"] . 
":" . $sty_rec[
"style"];
 
 3129        $q = 
"SELECT up1.usr_id usr_id FROM usr_pref up1, usr_pref up2 " .
 
 3130            " WHERE up1.keyword= " . 
$ilDB->quote(
"style", 
"text") .
 
 3131            " AND up1.value= " . 
$ilDB->quote($a_from_style, 
"text") .
 
 3132            " AND up2.keyword= " . 
$ilDB->quote(
"skin", 
"text") .
 
 3133            " AND up2.value= " . 
$ilDB->quote($a_from_skin, 
"text") .
 
 3134            " AND up1.usr_id = up2.usr_id ";
 
 3136        $usr_set = 
$ilDB->query($q);
 
 3138        while ($usr_rec = 
$ilDB->fetchAssoc($usr_set)) {
 
 3171            $a_time = date(
"Y-m-d H:i:s", time());
 
 3174        $item_set = 
$ilDB->queryF(
 
 3175            "SELECT * FROM personal_clipboard WHERE " .
 
 3176            "parent = %s AND item_id = %s AND type = %s AND user_id = %s",
 
 3177            array(
"integer", 
"integer", 
"text", 
"integer"),
 
 3182        if (!
$d = $item_set->fetchRow()) {
 
 3184                "INSERT INTO personal_clipboard " .
 
 3185                "(item_id, type, user_id, title, parent, insert_time, order_nr) VALUES " .
 
 3186                " (%s,%s,%s,%s,%s,%s,%s)",
 
 3187                array(
"integer", 
"text", 
"integer", 
"text", 
"integer", 
"timestamp", 
"integer"),
 
 3188                array($a_item_id, 
$a_type, $this->
getId(), $a_title, (
int) $a_parent, $a_time, (
int) $a_order_nr)
 
 3192                "UPDATE personal_clipboard SET insert_time = %s " .
 
 3193                "WHERE user_id = %s AND item_id = %s AND type = %s AND parent = 0",
 
 3194                array(
"timestamp", 
"integer", 
"integer", 
"text"),
 
 3209            $a_time = date(
"Y-m-d H:i:s", time());
 
 3211        $ilDB->insert(
"personal_pc_clipboard", array(
 
 3212            "user_id" => array(
"integer", $this->
getId()),
 
 3214            "insert_time" => array(
"timestamp", $a_time),
 
 3215            "order_nr" => array(
"integer", $a_nr)
 
 3228        $set = 
$ilDB->queryF(
"SELECT MAX(insert_time) mtime FROM personal_pc_clipboard " .
 
 3229            " WHERE user_id = %s", array(
"integer"), array($this->
getId()));
 
 3230        $row = 
$ilDB->fetchAssoc($set);
 
 3232        $set = 
$ilDB->queryF(
 
 3233            "SELECT * FROM personal_pc_clipboard " .
 
 3234            " WHERE user_id = %s AND insert_time = %s ORDER BY order_nr ASC",
 
 3235            array(
"integer", 
"timestamp"),
 
 3236            array($this->
getId(), $row[
"mtime"])
 
 3239        while ($row = 
$ilDB->fetchAssoc($set)) {
 
 3240            $content[] = $row[
"content"];
 
 3255        $set = 
$ilDB->queryF(
 
 3256            "SELECT * FROM personal_clipboard WHERE " .
 
 3257            "parent = %s AND type = %s AND user_id = %s",
 
 3258            array(
"integer", 
"text", 
"integer"),
 
 3261        if ($rec = 
$ilDB->fetchAssoc($set)) {
 
 3278            "DELETE FROM personal_clipboard WHERE " .
 
 3279            "type = %s AND user_id = %s",
 
 3280            array(
"text", 
"integer"),
 
 3294        $ilDB->manipulateF(
"DELETE FROM personal_clipboard WHERE " .
 
 3295            "user_id = %s", array(
"integer"), array($this->
getId()));
 
 3308        if ($a_top_nodes_only) {
 
 3309            $par = 
" AND parent = " . 
$ilDB->quote(0, 
"integer") . 
" ";
 
 3315        $q = 
"SELECT * FROM personal_clipboard WHERE " .
 
 3316            "user_id = " . 
$ilDB->quote($this->
getId(), 
"integer") . 
" " .
 
 3318            " ORDER BY order_nr";
 
 3319        $objs = 
$ilDB->query($q);
 
 3321        while ($obj = 
$ilDB->fetchAssoc($objs)) {
 
 3322            if ($obj[
"type"] == 
"mob") {
 
 3328            if ($obj[
"type"] == 
"incl") {
 
 3329                include_once(
"./Modules/MediaPool/classes/class.ilMediaPoolPage.php");
 
 3335            $objects[] = array(
"id" => $obj[
"item_id"],
 
 3336                "type" => $obj[
"type"], 
"title" => $obj[
"title"],
 
 3337                "insert_time" => $obj[
"insert_time"]);
 
 3352        $objs = 
$ilDB->queryF(
 
 3353            "SELECT * FROM personal_clipboard WHERE " .
 
 3354            "user_id = %s AND parent = %s AND insert_time = %s " .
 
 3355            " ORDER BY order_nr",
 
 3356            array(
"integer", 
"integer", 
"timestamp"),
 
 3357            array(
$ilUser->getId(), (
int) $a_parent, $a_insert_time)
 
 3360        while ($obj = 
$ilDB->fetchAssoc($objs)) {
 
 3361            if ($obj[
"type"] == 
"mob") {
 
 3364            $objects[] = array(
"id" => $obj[
"item_id"],
 
 3365                "type" => $obj[
"type"], 
"title" => $obj[
"title"], 
"insert_time" => $obj[
"insert_time"]);
 
 3384        $q = 
"SELECT DISTINCT user_id FROM personal_clipboard WHERE " .
 
 3385            "item_id = " . 
$ilDB->quote($a_id, 
"integer") . 
" AND " .
 
 3387        $user_set = 
$ilDB->query($q);
 
 3389        while ($user_rec = 
$ilDB->fetchAssoc($user_set)) {
 
 3390            $users[] = $user_rec[
"user_id"];
 
 3409        $q = 
"DELETE FROM personal_clipboard WHERE " .
 
 3410            "item_id = " . 
$ilDB->quote($a_item_id, 
"integer") .
 
 3412            " AND user_id = " . 
$ilDB->quote($this->
getId(), 
"integer");
 
 3413        $ilDB->manipulate($q);
 
 3422        $query = 
"SELECT obj_id FROM object_data WHERE import_id = " .
 
 3423            $ilDB->quote($i2_id, 
"text");
 
 3426        while ($row = 
$ilDB->fetchObject(
$res)) {
 
 3439        require_once(
'./Modules/OrgUnit/classes/PathStorage/class.ilOrgUnitPathStorage.php');
 
 3440        return ilOrgUnitPathStorage::getTextRepresentationOfUsersOrgUnits($a_usr_id);
 
 3459        $this->auth_mode = $a_str;
 
 3472        include_once(
'./Services/Authentication/classes/class.ilAuthUtils.php');
 
 3485        $this->ext_account = $a_str;
 
 3497        return $this->ext_account;
 
 3518        include_once(
'./Services/Authentication/classes/class.ilAuthUtils.php');
 
 3519        $q = 
"SELECT login,usr_id,ext_account,auth_mode FROM usr_data " .
 
 3520            "WHERE auth_mode = %s";
 
 3522        $values[] = $a_auth_mode;
 
 3524            $q .= 
" OR auth_mode = %s ";
 
 3526            $values[] = 
'default';
 
 3529        $res = 
$ilDB->queryF($q, $types, $values);
 
 3530        while ($row = 
$ilDB->fetchObject(
$res)) {
 
 3531            if ($row->auth_mode == 
'default') {
 
 3532                $accounts[$row->usr_id] = $row->login;
 
 3534                $accounts[$row->usr_id] = $row->ext_account;
 
 3537        return $accounts ? $accounts : array();
 
 3553        if (!is_array($a_usr_ids)) {
 
 3559            $q = 
"UPDATE usr_data SET active = 1, inactivation_date = NULL WHERE " .
 
 3560                $ilDB->in(
"usr_id", $a_usr_ids, 
false, 
"integer");
 
 3561            $ilDB->manipulate($q);
 
 3563            $usrId_IN_usrIds = 
$ilDB->in(
"usr_id", $a_usr_ids, 
false, 
"integer");
 
 3565            $q = 
"UPDATE usr_data SET active = 0 WHERE $usrId_IN_usrIds";
 
 3566            $ilDB->manipulate($q);
 
 3570                                SET inactivation_date = %s 
 3571                                WHERE inactivation_date IS NULL 
 3572                                AND $usrId_IN_usrIds 
 3574            $ilDB->manipulateF($queryString, array(
'timestamp'), array(
ilUtil::now()));
 
 3603        $settings = 
$GLOBALS[
'DIC']->settings();
 
 3607            "SELECT * FROM usr_data WHERE " .
 
 3608            " ext_account = %s AND auth_mode = %s",
 
 3609            array(
"text", 
"text"),
 
 3610            array($a_account, $a_auth)
 
 3612        if ($usr = 
$db->fetchAssoc($r)) {
 
 3613            return $usr[
"login"];
 
 3616        if (!$tryFallback) {
 
 3622            "SELECT login FROM usr_data " .
 
 3623            "WHERE login = %s AND auth_mode = %s AND (ext_account IS NULL OR ext_account = '') ",
 
 3624            array(
"text", 
"text"),
 
 3625            array($a_account, $a_auth)
 
 3627        if ($usr = 
$db->fetchAssoc(
$res)) {
 
 3628            return $usr[
'login'];
 
 3634                "SELECT login FROM usr_data WHERE " .
 
 3635                " ext_account = %s AND auth_mode = %s",
 
 3636                array(
"text", 
"text"),
 
 3637                array($a_account, 
"default")
 
 3639            if ($usr = 
$db->fetchAssoc(
$res)) {
 
 3640                return $usr[
"login"];
 
 3644                "SELECT login FROM usr_data " .
 
 3645                "WHERE login = %s AND (ext_account IS NULL OR ext_account = '') AND auth_mode = %s",
 
 3646                array(
"text", 
"text"),
 
 3647                array($a_account, 
"default")
 
 3649            if ($usr = 
$db->fetchAssoc(
$res)) {
 
 3650                return $usr[
"login"];
 
 3665        $r = 
$ilDB->query(
"SELECT count(*) AS cnt, auth_mode FROM usr_data " .
 
 3666            "GROUP BY auth_mode");
 
 3668        while ($cnt = 
$ilDB->fetchAssoc($r)) {
 
 3669            $cnt_arr[$cnt[
"auth_mode"]] = $cnt[
"cnt"];
 
 3689        $q = 
"SELECT * FROM usr_data WHERE " .
 
 3690            " email = %s AND (auth_mode = %s ";
 
 3691        $types = array(
"text", 
"text");
 
 3692        $values = array($a_email, 
"local");
 
 3695            $q .= 
" OR auth_mode = %s";
 
 3697            $values[] = 
"default";
 
 3703        $usr_set = 
$ilDB->queryF($q, $types, $values);
 
 3704        while ($usr_rec = 
$ilDB->fetchAssoc($usr_set)) {
 
 3705            $users[$usr_rec[
"usr_id"]] = $usr_rec[
"login"];
 
 3722        $image_dir = $webspace_dir . 
"/usr_images";
 
 3723        $store_file = 
"usr_" . $obj_id . 
"." . 
"jpg";
 
 3724        $target_file = $image_dir . 
"/$store_file";
 
 3726        chmod($tmp_file, 0770);
 
 3730        $show_file = 
"$image_dir/usr_" . $obj_id . 
".jpg";
 
 3731        $thumb_file = 
"$image_dir/usr_" . $obj_id . 
"_small.jpg";
 
 3732        $xthumb_file = 
"$image_dir/usr_" . $obj_id . 
"_xsmall.jpg";
 
 3733        $xxthumb_file = 
"$image_dir/usr_" . $obj_id . 
"_xxsmall.jpg";
 
 3736        ilUtil::execConvert($tmp_file . 
"[0] -geometry 100x100 -quality 100 JPEG:" . $thumb_file);
 
 3738        ilUtil::execConvert($tmp_file . 
"[0] -geometry 30x30 -quality 100 JPEG:" . $xxthumb_file);
 
 3757        if (isset(self::$personal_image_cache[$this->
getId()][$a_size][(
int) $a_force_pic])) {
 
 3758            return self::$personal_image_cache[$this->
getId()][$a_size][(int) $a_force_pic];
 
 3763        return self::$personal_image_cache[$this->
getId()][$a_size][(int) $a_force_pic];
 
 3775        return $define->getAvatar();
 
 3792        $a_force_pic = 
false,
 
 3793        $a_prevent_no_photo_image = 
false 
 3796        $define->setForcePicture($a_force_pic);
 
 3797        $define->setSize($a_size);
 
 3810        $a_dir = trim(str_replace(
"..", 
"", $a_dir));
 
 3811        if ($a_dir == 
"" || !is_dir($a_dir)) {
 
 3816        $image_dir = $webspace_dir . 
"/usr_images";
 
 3818            "upload_" . $a_user_id . 
"pic",
 
 3819            "usr_" . $a_user_id . 
"." . 
"jpg",
 
 3820            "usr_" . $a_user_id . 
"_small.jpg",
 
 3821            "usr_" . $a_user_id . 
"_xsmall.jpg",
 
 3822            "usr_" . $a_user_id . 
"_xxsmall.jpg",
 
 3823            "upload_" . $a_user_id);
 
 3824        foreach ($images as $image) {
 
 3825            if (is_file($image_dir . 
"/" . $image)) {
 
 3826                copy($image_dir . 
"/" . $image, $a_dir . 
"/" . $image);
 
 3838        $image_dir = $webspace_dir . 
"/usr_images";
 
 3839        $file = $image_dir . 
"/usr_" . $this->getID() . 
"." . 
"jpg";
 
 3840        $thumb_file = $image_dir . 
"/usr_" . $this->getID() . 
"_small.jpg";
 
 3841        $xthumb_file = $image_dir . 
"/usr_" . $this->getID() . 
"_xsmall.jpg";
 
 3842        $xxthumb_file = $image_dir . 
"/usr_" . $this->getID() . 
"_xxsmall.jpg";
 
 3843        $upload_file = $image_dir . 
"/upload_" . $this->getID();
 
 3847            $this->
setPref(
"profile_image", 
"");
 
 3851        if (@is_file($file)) {
 
 3854        if (@is_file($thumb_file)) {
 
 3855            unlink($thumb_file);
 
 3857        if (@is_file($xthumb_file)) {
 
 3858            unlink($xthumb_file);
 
 3860        if (@is_file($xxthumb_file)) {
 
 3861            unlink($xxthumb_file);
 
 3863        if (@is_file($upload_file)) {
 
 3864            unlink($upload_file);
 
 3871        if (!is_array($a_data)) {
 
 3874        foreach ($a_data as $field => 
$data) {
 
 3875            #$new_data[$field] = ilUtil::stripSlashes($data); 
 3877            $this->user_defined_data[
'f_' . $field] = 
$data;
 
 3879        #$this->user_defined_data = $new_data; 
 3886        return $this->user_defined_data ? $this->user_defined_data : array();
 
 3897        $field_def = array();
 
 3899        include_once(
"./Services/User/classes/class.ilUserDefinedData.php");
 
 3902        foreach ($this->user_defined_data as $field => $value) {
 
 3903            if ($field != 
'usr_id') {
 
 3905                $udata->set($field, $value);
 
 3939        include_once(
"./Services/User/classes/class.ilUserDefinedData.php");
 
 3951        $this->user_defined_data = $udata->getAll();
 
 3979        include_once(
"./Services/User/classes/class.ilUserDefinedData.php");
 
 3995    public function getProfileAsString(&$a_language)
 
 3997        include_once 
'./Services/AccessControl/classes/class.ilObjRole.php';
 
 4004        $language = &$a_language;
 
 4005        $language->loadLanguageModule(
'registration');
 
 4006        $language->loadLanguageModule(
'crs');
 
 4009        $body .= ($language->txt(
"login") . 
": " . $this->
getLogin() . 
"\n");
 
 4012            $body .= ($language->txt(
"title") . 
": " . $this->
getUTitle() . 
"\n");
 
 4015            $body .= ($language->txt(
"gender") . 
": " . $language->txt(
'gender_' . strtolower($this->
getGender())) . 
"\n");
 
 4018            $body .= ($language->txt(
"firstname") . 
": " . $this->
getFirstname() . 
"\n");
 
 4021            $body .= ($language->txt(
"lastname") . 
": " . $this->
getLastname() . 
"\n");
 
 4024            $body .= ($language->txt(
"institution") . 
": " . $this->
getInstitution() . 
"\n");
 
 4027            $body .= ($language->txt(
"department") . 
": " . $this->
getDepartment() . 
"\n");
 
 4030            $body .= ($language->txt(
"street") . 
": " . $this->
getStreet() . 
"\n");
 
 4032        if (strlen($this->
getCity())) {
 
 4033            $body .= ($language->txt(
"city") . 
": " . $this->
getCity() . 
"\n");
 
 4036            $body .= ($language->txt(
"zipcode") . 
": " . $this->
getZipcode() . 
"\n");
 
 4039            $body .= ($language->txt(
"country") . 
": " . $this->
getCountry() . 
"\n");
 
 4042            $body .= ($language->txt(
"sel_country") . 
": " . $this->
getSelectedCountry() . 
"\n");
 
 4045            $body .= ($language->txt(
"phone_office") . 
": " . $this->
getPhoneOffice() . 
"\n");
 
 4048            $body .= ($language->txt(
"phone_home") . 
": " . $this->
getPhoneHome() . 
"\n");
 
 4051            $body .= ($language->txt(
"phone_mobile") . 
": " . $this->
getPhoneMobile() . 
"\n");
 
 4053        if (strlen($this->
getFax())) {
 
 4054            $body .= ($language->txt(
"fax") . 
": " . $this->
getFax() . 
"\n");
 
 4057            $body .= ($language->txt(
"email") . 
": " . $this->
getEmail() . 
"\n");
 
 4060            $body .= ($language->txt(
"second_email") . 
": " . $this->
getSecondEmail() . 
"\n");
 
 4063            $body .= ($language->txt(
"hobby") . 
": " . $this->
getHobby() . 
"\n");
 
 4066            $body .= ($language->txt(
"referral_comment") . 
": " . $this->
getComment() . 
"\n");
 
 4069            $body .= ($language->txt(
"matriculation") . 
": " . $this->
getMatriculation() . 
"\n");
 
 4077            $body .= ($language->txt(
"create_date") . 
": " . $date . 
"\n");
 
 4081        foreach (
$rbacreview->getGlobalRoles() as $role) {
 
 4082            if (
$rbacreview->isAssigned($this->getId(), $role)) {
 
 4087            $body .= ($language->txt(
'reg_role_info') . 
': ' . implode(
',', $gr) . 
"\n");
 
 4092            $body .= ($language->txt(
'time_limit') . 
": " . $language->txt(
'crs_unlimited') . 
"\n");
 
 4105            $body .= $language->txt(
'time_limit') . 
': ' .
 
 4106                $language->txt(
'from') . 
" " .
 
 4111        include_once 
'./Services/User/classes/class.ilUserDefinedFields.php';
 
 4118        foreach ($user_defined_fields->getDefinitions() as $field_id => $definition) {
 
 4120            if (strlen(
$data)) {
 
 4122                    $data = preg_replace(
'/<br(\s*)?\/?>/i', 
"\n", 
$data);
 
 4126                $body .= $definition[
'field_name'] . 
': ' . 
$data . 
"\n";
 
 4142        if ($a_user_id > 0) {
 
 4143            $set = 
$ilDB->queryF(
 
 4144                "SELECT feed_hash from usr_data WHERE usr_id = %s",
 
 4148            if ($rec = 
$ilDB->fetchAssoc($set)) {
 
 4149                if (strlen($rec[
"feed_hash"]) == 32) {
 
 4150                    return $rec[
"feed_hash"];
 
 4151                } elseif ($a_create) {
 
 4152                    $hash = md5(rand(1, 9999999) + str_replace(
" ", 
"", (
string) microtime()));
 
 4154                        "UPDATE usr_data SET feed_hash = %s" .
 
 4155                        " WHERE usr_id = %s",
 
 4156                        array(
"text", 
"integer"),
 
 4157                        array($hash, $a_user_id)
 
 4178        if ($a_user_id > 0) {
 
 4198            ($a_password == 
"") ? 
"" : md5($a_password)
 
 4217        $q = 
"SELECT DISTINCT login, usr_id FROM usr_data " .
 
 4220        $values[] = $a_login;
 
 4222        if ($a_user_id != 0) {
 
 4223            $q .= 
" AND usr_id != %s ";
 
 4224            $types[] = 
"integer";
 
 4225            $values[] = $a_user_id;
 
 4228        $r = 
$ilDB->queryF($q, $types, $values);
 
 4230        if ($row = 
$ilDB->fetchAssoc($r)) {
 
 4231            return $row[
'usr_id'];
 
 4253            "SELECT * FROM usr_data " .
 
 4254            "WHERE ext_account = %s AND auth_mode = %s",
 
 4255            array(
"text", 
"text"),
 
 4256            array($a_external_account, $a_auth_mode)
 
 4258        return $ilDB->fetchAssoc(
$res) ? true :
false;
 
 4278        if (count($ids) == 0) {
 
 4282        $query = 
"SELECT usr_data.*, usr_pref.value AS language 
 4284                                                        LEFT JOIN usr_pref ON usr_pref.usr_id = usr_data.usr_id AND usr_pref.keyword = %s 
 4285                                                        WHERE " . 
$ilDB->in(
"usr_data.usr_id", $ids, 
false, 
"integer");
 
 4286        $values[] = 
"language";
 
 4291            $query .= 
" AND usr_data.active = %s";
 
 4293            $types[] = 
"integer";
 
 4296        $query .= 
" ORDER BY usr_data.lastname, usr_data.firstname ";
 
 4300        while ($row = 
$ilDB->fetchAssoc($r)) {
 
 4318        $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 ";
 
 4320        $values[] = 
"language";
 
 4323            $query .= 
" AND usr_data.active = %s";
 
 4325            $types[] = 
"integer";
 
 4329            $query .= 
" AND usr_data.time_limit_owner = %s";
 
 4331            $types[] = 
"integer";
 
 4334        $query .= 
" AND usr_data.usr_id != %s ";
 
 4335        $values[] = ANONYMOUS_USER_ID;
 
 4336        $types[] = 
"integer";
 
 4338        $query .= 
" ORDER BY usr_data.lastname, usr_data.firstname ";
 
 4343            array_push(
$data, $row);
 
 4374        $query = 
"SELECT usr_data.*, usr_pref.value AS language 
 4376                          LEFT JOIN usr_pref ON usr_pref.usr_id = usr_data.usr_id AND usr_pref.keyword = %s 
 4377                          WHERE " . 
$ilDB->in(
"usr_data.usr_id", $a_mem_ids, 
false, 
"integer") . 
" 
 4378                                        AND usr_data.usr_id != %s";
 
 4379        $values[] = 
"language";
 
 4381        $values[] = ANONYMOUS_USER_ID;
 
 4382        $types[] = 
"integer";
 
 4385            $query .= 
" AND active = %s";
 
 4387            $types[] = 
"integer";
 
 4390        if ($timelimitowner != 
USER_FOLDER_ID && $timelimitowner != -1) {
 
 4391            $query .= 
" AND usr_data.time_limit_owner = %s";
 
 4392            $values[] = $timelimitowner;
 
 4393            $types[] = 
"integer";
 
 4396        $query .= 
" ORDER BY usr_data.lastname, usr_data.firstname ";
 
 4403        return $mem_arr ? $mem_arr : array();
 
 4420        if (is_array($a_internalids)) {
 
 4421            foreach ($a_internalids as $internalid) {
 
 4422                if (is_numeric($internalid)) {
 
 4423                    $ids[] = $internalid;
 
 4426                    if (is_numeric($parsedid) && $parsedid > 0) {
 
 4432        if (count($ids) == 0) {
 
 4436        $query = 
"SELECT usr_data.*, usr_pref.value AS language 
 4439                          ON usr_pref.usr_id = usr_data.usr_id AND usr_pref.keyword = %s 
 4440                          WHERE " . 
$ilDB->in(
"usr_data.usr_id", $ids, 
false, 
"integer");
 
 4441        $values[] = 
"language";
 
 4444        $query .= 
" ORDER BY usr_data.lastname, usr_data.firstname ";
 
 4469            "SELECT * FROM usr_pref WHERE usr_id = %s",
 
 4474        while ($row = 
$ilDB->fetchAssoc($r)) {
 
 4475            $prefs[$row[
"keyword"]] = $row[
"value"];
 
 4497        $set = 
$ilDB->query(
 
 4498            "SELECT usr_id FROM usr_pref " .
 
 4499            " WHERE keyword = " . 
$ilDB->quote($a_keyword, 
"text") .
 
 4500            " AND " . 
$ilDB->in(
"usr_id", $a_user_ids, 
false, 
"integer") .
 
 4501            " AND value = " . 
$ilDB->quote($a_val, 
"text")
 
 4503        while ($rec = 
$ilDB->fetchAssoc($set)) {
 
 4504            $users[] = $rec[
"usr_id"];
 
 4516        $query = 
"UPDATE usr_data SET login_attempts = 0 WHERE usr_id = %s";
 
 4517        $affected = 
$ilDB->manipulateF(
$query, array(
'integer'), array($a_usr_id));
 
 4532        $query = 
"SELECT login_attempts FROM usr_data WHERE usr_id = %s";
 
 4546        $query = 
"UPDATE usr_data SET login_attempts = (login_attempts + 1) WHERE usr_id = %s";
 
 4547        $affected = 
$ilDB->manipulateF(
$query, array(
'integer'), array($a_usr_id));
 
 4562        $query = 
"UPDATE usr_data SET active = 0, inactivation_date = %s WHERE usr_id = %s";
 
 4579        return in_array($this->
getPref(
"public_profile"), array(
"y", 
"g"));
 
 4605            'SELECT * FROM loginname_history WHERE usr_id = %s AND login = %s AND history_date = %s',
 
 4606            array(
'integer', 
'text', 
'integer'),
 
 4613                                INSERT INTO loginname_history  
 4614                                                (usr_id, login, history_date) 
 4615                                VALUES  (%s, %s, %s)',
 
 4616                array(
'integer', 
'text', 
'integer'),
 
 4631    public static function _getUsersOnline($a_user_id = 0, $a_no_anonymous = 
false)
 
 4644        $atime = $pd_set->get(
'user_activity_time') * 60;
 
 4649        if ($a_user_id == 0) {
 
 4650            $where[] = 
'user_id > 0';
 
 4651        } elseif (is_array($a_user_id)) {
 
 4652            $where[] = 
$ilDB->in(
"user_id", $a_user_id, 
false, 
"integer");
 
 4654            $where[] = 
'user_id = ' . 
$ilDB->quote($a_user_id, 
'integer');
 
 4657        if ($a_no_anonymous) {
 
 4658            $where[] = 
'user_id != ' . 
$ilDB->quote(ANONYMOUS_USER_ID, 
'integer');
 
 4661        include_once 
'Services/User/classes/class.ilUserAccountSettings.php';
 
 4663            include_once 
'Services/User/classes/class.ilUserFilter.php';
 
 4667        $where[] = 
'expires > ' . 
$ilDB->quote($ctime, 
'integer');
 
 4668        $where[] = 
'(p.value IS NULL OR NOT p.value = ' . 
$ilDB->quote(
'y', 
'text') . 
')';
 
 4670        $where = 
'WHERE ' . implode(
' AND ', $where);
 
 4674                        SELECT COUNT(user_id) num, user_id, firstname, lastname, title, login, last_login, MAX(ctime) ctime, context, agree_date 
 4676                        LEFT JOIN usr_data u 
 4677                                ON user_id = u.usr_id 
 4678                        LEFT JOIN usr_pref p 
 4679                                ON (p.usr_id = u.usr_id AND p.keyword = %s) 
 4681                        GROUP BY user_id, firstname, lastname, title, login, last_login, context, agree_date 
 4682                        ORDER BY lastname, firstname 
 4685            array(
'hide_own_online_status')
 
 4688        $log->debug(
"Query: " . $q);
 
 4691        while ($user = 
$ilDB->fetchAssoc($r)) {
 
 4692            if ($atime <= 0 || $user[
'ctime'] + $atime > $ctime) {
 
 4693                $users[$user[
'user_id']] = $user;
 
 4697        $log->debug(
"Found users: " . count($users));
 
 4699        require_once 
'Services/TermsOfService/classes/class.ilTermsOfServiceHelper.php';
 
 4701            $users = array_filter($users, 
function ($user) {
 
 4702                if ($user[
'agree_date'] || $user[
'user_id'] == SYSTEM_USER_ID || 
'root' === $user[
'login']) {
 
 4709            $log->debug(
"TOS filtered to users: " . count($users));
 
 4730            $hashcode = substr(md5(uniqid(rand(), 
true)), 0, 16);
 
 4734                                SELECT COUNT(usr_id) cnt FROM usr_data  
 4735                                WHERE reg_hash = %s',
 
 4740                if ($row->cnt > 0) {
 
 4755                array(
'text', 
'integer'),
 
 4756                array($hashcode, (
int) $a_usr_id)
 
 4781                        SELECT usr_id, create_date FROM usr_data  
 4782                        WHERE reg_hash = %s',
 
 4786        while ($row = 
$ilDB->fetchAssoc(
$res)) {
 
 4787            require_once 
'Services/Registration/classes/class.ilRegistrationSettings.php';
 
 4790            if ((
int) $oRegSettigs->getRegistrationHashLifetime() != 0 &&
 
 4791               time() - (
int) $oRegSettigs->getRegistrationHashLifetime() > strtotime($row[
'create_date'])) {
 
 4792                require_once 
'Services/Registration/exceptions/class.ilRegConfirmationLinkExpiredException.php';
 
 4801                array(
'text', 
'integer'),
 
 4802                array(
'', (
int) $row[
'usr_id'])
 
 4805            return (
int) $row[
'usr_id'];
 
 4808        require_once 
'Services/Registration/exceptions/class.ilRegistrationHashNotFoundException.php';
 
 4814        if (strlen($a_birthday)) {
 
 4818            $this->birthday = 
null;
 
 4838        if (!is_numeric($periodInDays) && $periodInDays < 1) {
 
 4839            throw new \ilException(
'Invalid period given');
 
 4842        $date = date(
'Y-m-d H:i:s', (time() - ((
int) $periodInDays * 24 * 60 * 60)));
 
 4844        $query = 
"SELECT usr_id FROM usr_data WHERE last_login IS NOT NULL AND last_login < %s";
 
 4848        $types = [
'timestamp'];
 
 4852        while ($row = 
$DIC->database()->fetchAssoc(
$res)) {
 
 4853            $ids[] = $row[
'usr_id'];
 
 4868        $date = date(
'Y-m-d H:i:s', (time() - ((
int) $thresholdInDays * 24 * 60 * 60)));
 
 4870        $query = 
"SELECT usr_id FROM usr_data WHERE last_login IS NULL AND create_date < %s";
 
 4874        $types = [
'timestamp'];
 
 4878        while ($row = 
$DIC->database()->fetchAssoc(
$res)) {
 
 4879            $ids[] = $row[
'usr_id'];
 
 4896        $field = 
'inactivation_date';
 
 4899        if (!(
int) $period) {
 
 4907        $date = date(
'Y-m-d H:i:s', (time() - ((
int) $period * 24 * 60 * 60)));
 
 4909        $query = 
"SELECT usr_id FROM usr_data WHERE $field < %s AND active = %s";
 
 4911        $res = 
$ilDB->queryF(
$query, array(
'timestamp', 
'integer'), array($date, 0));
 
 4915            $ids[] = $row->usr_id;
 
 4932        if ($a_last_login !== 
null) {
 
 4933            $last_login = $a_last_login;
 
 4935            $last_login = date(
'Y-m-d H:i:s');
 
 4942        $query = 
"UPDATE usr_data SET last_login = %s WHERE usr_id = %s";
 
 4943        $affected = 
$ilDB->manipulateF(
$query, array(
'timestamp', 
'integer'), array($last_login, $a_usr_id));
 
 4945        $query = 
"UPDATE usr_data SET first_login = %s WHERE usr_id = %s AND first_login IS NULL";
 
 4946        $ilDB->manipulateF(
$query, array(
'timestamp', 
'integer'), array($last_login, $a_usr_id));
 
 4962        $query = 
"UPDATE object_data SET owner = 0 " .
 
 4963            "WHERE owner = " . 
$ilDB->quote($this->
getId(), 
'integer');
 
 4982        $q = 
"SELECT DISTINCT " . 
$ilDB->upper(
$ilDB->substr(
"lastname", 1, 1)) . 
" let" .
 
 4984            " WHERE usr_id <> " . 
$ilDB->quote(ANONYMOUS_USER_ID, 
"integer") .
 
 4985            ($user_ids !== 
null ? 
" AND " . 
$ilDB->in(
'usr_id', $user_ids, 
false, 
"integer") : 
"") .
 
 4987        $let_set = 
$ilDB->query($q);
 
 4990        while ($let_rec = 
$ilDB->fetchAssoc($let_set)) {
 
 4991            $let[$let_rec[
"let"]] = $let_rec[
"let"];
 
 5003        $query = 
'SELECT count(*) num FROM object_data od ' .
 
 5004                'JOIN usr_data ud ON obj_id = usr_id ' .
 
 5005                'WHERE ' . 
$ilDB->in(
'obj_id', $a_usr_ids, 
false, 
'integer') . 
' ';
 
 5008        return $num_rows == count((array) $a_usr_ids);
 
 5017        return (
boolean) 
$_SESSION[
"user_captcha_verified"];
 
 5027        $_SESSION[
"user_captcha_verified"] = $a_val;
 
 5038        include_once(
"./Services/Export/classes/class.ilExport.php");
 
 5061        include_once(
"./Services/Export/classes/class.ilExport.php");
 
 5063        if (!is_dir($dir)) {
 
 5067            if (is_int(strpos($entry[
"entry"], 
".zip"))) {
 
 5068                return $entry[
"entry"];
 
 5083        include_once(
"./Services/Export/classes/class.ilExport.php");
 
 5086        if (is_file($file)) {
 
 5104        include_once(
"./Services/Export/classes/class.ilImport.php");
 
 5107        $imp->addSkipImporter(
"Services/Bookmarks");
 
 5108        if (!$a_profile_data) {
 
 5109            $imp->addSkipEntity(
"Services/User", 
"usr_profile");
 
 5112            $imp->addSkipEntity(
"Services/User", 
"usr_setting");
 
 5115            $imp->addSkipEntity(
"Services/Notes", 
"user_notes");
 
 5118            $imp->addSkipEntity(
"Services/Calendar", 
"calendar");
 
 5121            $a_file[
"tmp_name"],
 
 5139        $NOW = 
$ilDB->now();
 
 5141        $usrId_IN_usrIds = 
$ilDB->in(
'usr_id', $usrIds, 
false, 
'integer');
 
 5145                        SET inactivation_date = $NOW 
 5146                        WHERE inactivation_date IS NULL 
 5147                        AND $usrId_IN_usrIds 
 5150        $ilDB->manipulate($queryString);
 
 5164        $usrId_IN_usrIds = 
$ilDB->in(
'usr_id', $usrIds, 
false, 
'integer');
 
 5168                        SET inactivation_date = NULL 
 5169                        WHERE $usrId_IN_usrIds 
 5172        $ilDB->manipulate($queryString);
 
 5200        require_once 
'Services/TermsOfService/classes/class.ilTermsOfServiceHelper.php';
 
 5204            null == $this->agree_date &&
 
 5205            'root' != $this->
login &&
 
 5206            !in_array($this->
getId(), array(ANONYMOUS_USER_ID, SYSTEM_USER_ID))
 
 5218    public static function hasUserToAcceptTermsOfService($a_username)
 
 5227        require_once 
'Services/TermsOfService/classes/class.ilTermsOfServiceHelper.php';
 
 5233        $in = 
$ilDB->in(
'usr_id', array(ANONYMOUS_USER_ID, SYSTEM_USER_ID), 
true, 
'integer');
 
 5235            "SELECT usr_id FROM usr_data WHERE login = %s AND agree_date IS NULL $in",
 
 5239        return $ilDB->fetchAssoc(
$res) ? true : 
false;
 
 5255        $date_is = ($a_agreed)
 
 5259        $users = (is_array($a_users))
 
 5260            ? 
" AND " . 
$ilDB->in(
"usr_id", $a_users, 
false, 
"integer")
 
 5263        $set = 
$ilDB->query(
"SELECT usr_id FROM usr_data " .
 
 5264            " WHERE agree_date " . $date_is .
 
 5267        while ($rec = 
$ilDB->fetchAssoc($set)) {
 
 5268            $ret[] = $rec[
"usr_id"];
 
 5280        if (
null === $status) {
 
 5284        require_once 
'Services/TermsOfService/classes/class.ilTermsOfServiceHelper.php';
 
 5304        return $usr_id == ANONYMOUS_USER_ID;
 
 5319        return (
bool) $this->
getPref(
"delete_flag");
 
 5327        $this->is_self_registered = (bool) $status;
 
 5347        $this->interests_general = $value;
 
 5377        $this->interests_help_offered = $value;
 
 5407        $this->interests_help_looking = $value;
 
 5438        $current = $this->$a_attr;
 
 5439        if (is_array($current) && 
sizeof($current)) {
 
 5440            return implode(
", ", $current);
 
 5453        if (!$this->
getId()) {
 
 5457        $set = 
$ilDB->query(
"SELECT field_id,value" .
 
 5458            " FROM usr_data_multi" .
 
 5459            " WHERE usr_id = " . 
$ilDB->quote($this->getId(), 
"integer") .
 
 5461        while ($row = 
$ilDB->fetchAssoc($set)) {
 
 5462            $values[$row[
"field_id"]][] = $row[
"value"];
 
 5465        if (isset($values[
"interests_general"])) {
 
 5470        if (isset($values[
"interests_help_offered"])) {
 
 5475        if (isset($values[
"interests_help_looking"])) {
 
 5493        if (!$this->
getId()) {
 
 5507        foreach ($map as 
$id => $values) {
 
 5508            if (is_array($values) && 
sizeof($values)) {
 
 5509                foreach ($values as $value) {
 
 5510                    $value = trim($value);
 
 5512                        $uniq_id = 
$ilDB->nextId(
'usr_data_multi');
 
 5514                        $ilDB->manipulate(
"INSERT usr_data_multi" .
 
 5515                            " (id,usr_id,field_id,value) VALUES" .
 
 5516                            " (" . 
$ilDB->quote($uniq_id, 
"integer") .
 
 5517                            "," . 
$ilDB->quote($this->getId(), 
"integer") .
 
 5519                            "," . 
$ilDB->quote($value, 
"text") .
 
 5536        if (!$this->
getId()) {
 
 5540        $ilDB->manipulate(
"DELETE FROM usr_data_multi" .
 
 5541            " WHERE usr_id = " . 
$ilDB->quote($this->getId(), 
"integer"));
 
 5544    public static function findInterests($a_term, $a_user_id = 
null, $a_field_id = 
null)
 
 5552        $sql = 
"SELECT DISTINCT(value)" .
 
 5553            " FROM usr_data_multi" .
 
 5554            " WHERE " . 
$ilDB->like(
"value", 
"text", 
"%" . $a_term . 
"%");
 
 5556            $sql .= 
" AND field_id = " . 
$ilDB->quote($a_field_id, 
"text");
 
 5559            $sql .= 
" AND usr_id <> " . 
$ilDB->quote($a_user_id, 
"integer");
 
 5561        $sql .= 
" ORDER BY value";
 
 5562        $set = 
$ilDB->query($sql);
 
 5563        while ($row = 
$ilDB->fetchAssoc($set)) {
 
 5564            $res[] = $row[
"value"];
 
 5585        $set = 
$ilDB->query(
 
 5586            "SELECT * FROM usr_pref " .
 
 5587                " WHERE keyword = " . 
$ilDB->quote(
"public_profile", 
"text") .
 
 5588                " AND " . 
$ilDB->in(
"usr_id", $a_user_ids, 
false, 
"integer")
 
 5591            "global" => array(),
 
 5593            "public" => array(),
 
 5594            "not_public" => array()
 
 5596        while ($rec = 
$ilDB->fetchAssoc($set)) {
 
 5597            if ($rec[
"value"] == 
"g") {
 
 5598                $r[
"global"][] = $rec[
"usr_id"];
 
 5599                $r[
"public"][] = $rec[
"usr_id"];
 
 5601            if ($rec[
"value"] == 
"y") {
 
 5602                $r[
"local"][] = $rec[
"usr_id"];
 
 5603                $r[
"public"][] = $rec[
"usr_id"];
 
 5606        foreach ($a_user_ids as 
$id) {
 
 5607            if (!in_array(
$id, $r[
"public"])) {
 
 5608                $r[
"not_public"][] = 
$id;
 
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
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.
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.
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 getUserIdsNeverLoggedIn(int $thresholdInDays)
Get ids of all users that have never logged in.
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 _getPersonalPicturePath( $a_usr_id, $a_size="small", $a_force_pic=false, $a_prevent_no_photo_image=false)
Get path to personal picture.
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.
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
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)
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)
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)
setCaptchaVerified($a_val)
Set captcha verified.
clipboardDeleteObjectsOfType($a_type)
Delete objects of type for user.
importPersonalData( $a_file, $a_profile_data, $a_settings, $a_notes, $a_calendar)
Import personal data.
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
setPasswordPolicyResetStatus(bool $status)
static _getAllUserAssignedStyles()
skins and styles
static _deleteAllPref($a_user_id)
Deletes a userpref value of the user from the database @access public.
static _getAvatar($a_usr_id)
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 _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
getPasswordPolicyResetStatus()
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
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 _lookupLanguage($a_usr_id)
getGeneralInterestsAsText()
Get general interests as plain text.
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)
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
static getUserIdsByInactivityPeriod(int $periodInDays)
Get ids of all users that have been inactive for at least the given period.
isCaptchaVerified()
Is user captcha verified?
setLoginAttempts($a_login_attempts)
getGender()
get gender @access public
getExternalAccount()
get external account
static getFirstLettersOfLastnames(?array $user_ids=null)
Get first letters of all lastnames.
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
setOwner($a_owner)
set object owner
getId()
get object id @access public
static _lookupType($a_id, $a_reference=false)
lookup object type
getCreateDate()
get create date @access public
Custom block for external feeds on personal desktop.
static _exists($a_parent_type, $a_id, $a_lang="", $a_no_cache=false)
Checks whether page exists.
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 skinExists($skin_id, ilSystemStyleConfig $system_style_config=null)
Check whether a skin exists.
static styleExistsForSkinId($skin_id, $style_id)
static styleExists($style_id)
static getInstance()
Singelton get instance.
Class ilUserAvatarResolver.
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
This describes how a letter or a picture avatar could be modified during construction of UI.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
redirection script todo: (a better solution should control the processing via a xml file)
foreach($_POST as $key=> $value) $res