24define(
"IL_EXTRACT_ROLES", 1);
 
   25define(
"IL_USER_IMPORT", 2);
 
   26define(
"IL_VERIFY", 3);
 
   28define(
"IL_FAIL_ON_CONFLICT", 1);
 
   29define(
"IL_UPDATE_ON_CONFLICT", 2);
 
   30define(
"IL_IGNORE_ON_CONFLICT", 3);
 
   32define(
"IL_IMPORT_SUCCESS", 1);
 
   33define(
"IL_IMPORT_WARNING", 2);
 
   34define(
"IL_IMPORT_FAILURE", 3);
 
   36define(
"IL_USER_MAPPING_LOGIN", 1);
 
   37define(
"IL_USER_MAPPING_ID", 2);
 
   39require_once(
"./Services/Xml/classes/class.ilSaxParser.php");
 
   40require_once(
'Services/User/classes/class.ilUserXMLWriter.php');
 
  292        $global_settings = 
$DIC->settings();
 
  294        $this->roles = array();
 
  295        $this->mode = $a_mode;
 
  296        $this->conflict_rule = $a_conflict_rule;
 
  298        $this->protocol = array();
 
  299        $this->logins = array();
 
  300        $this->userCount = 0;
 
  301        $this->localRoleCache = array();
 
  302        $this->parentRolesCache = array();
 
  303        $this->send_mail = 
false;
 
  309        $this->userStyles = array();
 
  310        include_once 
'./Services/Style/System/classes/class.ilStyleDefinition.php';
 
  311        $skins = ilStyleDefinition::getAllSkins();
 
  313        if (is_array($skins)) {
 
  314            foreach ($skins as 
$skin) {
 
  316                    include_once(
"./Services/Style/System/classes/class.ilSystemStyleSettings.php");
 
  320                    $this->userStyles [] = 
$skin->getId() . 
":" . 
$style->getId();
 
  325        $this->hideSkin = (!$this->user_settings_config->isVisible(
"skin_style"));
 
  326        $this->disableSkin = (!$this->user_settings_config->isChangeable(
"skin_style"));
 
  328        include_once(
"Services/Mail/classes/class.ilAccountMail.php");
 
  330        $this->acc_mail->setAttachConfiguredFiles(
true);
 
  331        $this->acc_mail->useLangVariablesAsFallback(
true);
 
  345        $this->folder_id = $a_folder_id;
 
  360        xml_set_object($a_xml_parser, $this);
 
  361        xml_set_element_handler($a_xml_parser, 
'handlerBeginTag', 
'handlerEndTag');
 
  362        xml_set_character_data_handler($a_xml_parser, 
'handlerCharacterData');
 
  370        parent::startParsing();
 
  380        $this->role_assign = $a_assign;
 
  394        if (
$type == 
"end") {
 
  400        if (is_array($attr)) {
 
  401            foreach ($attr as $k => $v) {
 
  402                $tag .= 
" " . $k . 
"=\"$v\"";
 
  416        switch ($this->mode) {
 
  439                $this->current_role_id = $a_attribs[
"Id"];
 
  441                    $this->current_role_id = $internal_id;
 
  443                $this->current_role_type = $a_attribs[
"Type"];
 
  460                $this->current_role_id = $a_attribs[
"Id"];
 
  462                    $this->current_role_id = $internal_id;
 
  464                $this->current_role_type = $a_attribs[
"Type"];
 
  465                $this->current_role_action = (is_null($a_attribs[
"Action"])) ? 
"Assign" : $a_attribs[
"Action"];
 
  468            case "PersonalPicture":
 
  469                $this->personalPicture = array(
 
  470                    "encoding" => $a_attribs[
"encoding"],
 
  471                    "imagetype" => $a_attribs[
"imagetype"],
 
  477                $this->skin = $a_attribs[
"Skin"];
 
  478                $this->style = $a_attribs[
"Style"];
 
  482                $this->acc_mail->reset();
 
  483                $this->prefs = array();
 
  484                $this->currentPrefKey = 
null;
 
  485                $this->auth_mode_set = 
false;
 
  486                $this->approve_date_set = 
false;
 
  487                $this->time_limit_set = 
false;
 
  488                $this->time_limit_owner_set = 
false;
 
  489                $this->updateLookAndSkin = 
false;
 
  492                $this->personalPicture = 
null;
 
  497                $this->udf_data = array();
 
  502                    if (is_numeric($a_attribs[
"Id"])) {
 
  503                        $this->user_id = $a_attribs[
"Id"];
 
  505                        $this->user_id = $id;
 
  509                $this->userObj->setPref(
 
  511                    $ilias->ini->readVariable(
"layout", 
"skin")
 
  513                $this->userObj->setPref(
 
  515                    $ilias->ini->readVariable(
"layout", 
"style")
 
  518                $this->userObj->setLanguage($a_attribs[
"Language"]);
 
  519                $this->userObj->setImportId($a_attribs[
"Id"]);
 
  520                $this->action = (is_null($a_attribs[
"Action"])) ? 
"Insert" : $a_attribs[
"Action"];
 
  521                $this->currPassword = 
null;
 
  522                $this->currPasswordType = 
null;
 
  523                $this->currActive = 
null;
 
  524                $this->multi_values = array();
 
  528                $this->currPasswordType = $a_attribs[
'Type'];
 
  531                if (array_key_exists(
"type", $a_attribs)) {
 
  532                    switch ($a_attribs[
"type"]) {
 
  535                            if (strcmp(
'saml', $a_attribs[
'type']) === 0) {
 
  537                                if (count($list) === 1) {
 
  538                                    $this->auth_mode_set = 
true;
 
  539                                    $idp = current($list);
 
  540                                    $this->userObj->setAuthMode(
'saml_' . $idp->getIdpId());
 
  544                            if (strcmp(
'ldap', $a_attribs[
'type']) === 0) {
 
  546                                include_once 
'./Services/LDAP/classes/class.ilLDAPServer.php';
 
  548                                if (count($list) == 1) {
 
  549                                    $this->auth_mode_set = 
true;
 
  550                                    $ldap_id = current($list);
 
  551                                    $this->userObj->setAuthMode(
'ldap_' . $ldap_id);
 
  566                            $this->auth_mode_set = 
true;
 
  567                            $this->userObj->setAuthMode($a_attribs[
"type"]);
 
  572                        $this->userObj->getLogin(),
 
  573                        sprintf(
$lng->txt(
"usrimport_xml_element_inapplicable"), 
"AuthMode", $this->stripTags($a_attribs[
"type"]))
 
  578            case 'UserDefinedField':
 
  579                $this->tmp_udf_id = $a_attribs[
'Id'];
 
  580                $this->tmp_udf_name = $a_attribs[
'Name'];
 
  584                $this->current_messenger_type = strtolower($a_attribs[
"Type"]);
 
  587                $this->userObj->setLatitude($a_attribs[
"latitude"]);
 
  588                $this->userObj->setLongitude($a_attribs[
"longitude"]);
 
  589                $this->userObj->setLocationZoom($a_attribs[
"zoom"]);
 
  592                $this->currentPrefKey = $a_attribs[
"key"];
 
  607                if (is_null($a_attribs[
'Id'])
 
  608                || $a_attribs[
'Id'] == 
"") {
 
  609                    $this->
logFailure($this->userObj->getLogin(), sprintf(
$lng->txt(
"usrimport_xml_attribute_missing"), 
"Role", 
"Id"));
 
  611                $this->current_role_id = $a_attribs[
"Id"];
 
  612                $this->current_role_type = $a_attribs[
"Type"];
 
  613                if ($this->current_role_type != 
'Global' 
  614                && $this->current_role_type != 
'Local') {
 
  615                    $this->
logFailure($this->userObj->getLogin(), sprintf(
$lng->txt(
"usrimport_xml_attribute_missing"), 
"Role", 
"Type"));
 
  617                $this->current_role_action = (is_null($a_attribs[
"Action"])) ? 
"Assign" : $a_attribs[
"Action"];
 
  618                if ($this->current_role_action != 
"Assign" 
  619                && $this->current_role_action != 
"AssignWithParents" 
  620                && $this->current_role_action != 
"Detach") {
 
  621                    $this->
logFailure($this->userObj->getLogin(), sprintf(
$lng->txt(
"usrimport_xml_attribute_value_illegal"), 
"Role", 
"Action", $this->stripTags($a_attribs[
"Action"])));
 
  623                if ($this->action == 
"Insert" 
  624                && $this->current_role_action == 
"Detach") {
 
  625                    $this->
logFailure($this->userObj->getLogin(), sprintf(
$lng->txt(
"usrimport_xml_attribute_value_inapplicable"), 
"Role", 
"Action", $this->stripTags($this->current_role_action), $this->stripTags($this->action)));
 
  627                if ($this->action == 
"Delete") {
 
  628                    $this->
logFailure($this->userObj->getLogin(), sprintf(
$lng->txt(
"usrimport_xml_element_inapplicable"), 
"Role", 
"Delete"));
 
  635                $this->userObj->setLanguage($a_attribs[
"Language"]);
 
  636                $this->userObj->setImportId($a_attribs[
"Id"]);
 
  637                $this->currentPrefKey = 
null;
 
  642                    if (is_numeric($a_attribs[
"Id"])) {
 
  643                        $this->user_id = $a_attribs[
"Id"];
 
  645                        $this->user_id = $id;
 
  649                $this->action = (is_null($a_attribs[
"Action"])) ? 
"Insert" : $a_attribs[
"Action"];
 
  650                if ($this->action != 
"Insert" 
  651                && $this->action != 
"Update" 
  652                && $this->action != 
"Delete") {
 
  653                    $this->
logFailure($this->userObj->getImportId(), sprintf(
$lng->txt(
"usrimport_xml_attribute_value_illegal"), 
"User", 
"Action", $this->stripTags($a_attribs[
"Action"])));
 
  655                $this->currPassword = 
null;
 
  656                $this->currPasswordType = 
null;
 
  660                $this->currPasswordType = $a_attribs[
'Type'];
 
  663                if (array_key_exists(
"type", $a_attribs)) {
 
  664                    switch ($a_attribs[
"type"]) {
 
  667                            if (strcmp(
'saml', $a_attribs[
'type']) === 0) {
 
  669                                if (count($list) !== 1) {
 
  671                                        $this->userObj->getImportId(),
 
  672                                        sprintf(
$lng->txt(
"usrimport_xml_attribute_value_illegal"), 
"AuthMode", 
"type", $this->stripTags($a_attribs[
'type']))
 
  677                            if (strcmp(
'ldap', $a_attribs[
'type']) === 0) {
 
  679                                include_once 
'./Services/LDAP/classes/class.ilLDAPServer.php';
 
  681                                if (count($list) != 1) {
 
  683                                        $this->userObj->getImportId(),
 
  684                                        sprintf(
$lng->txt(
"usrimport_xml_attribute_value_illegal"), 
"AuthMode", 
"type", $this->stripTags($a_attribs[
'type']))
 
  700                            $this->userObj->setAuthMode($a_attribs[
"type"]);
 
  704                    $this->
logFailure($this->userObj->getImportId(), sprintf(
$lng->txt(
"usrimport_xml_attribute_value_illegal"), 
"AuthMode", 
"type", 
""));
 
  708                $this->currentPrefKey = $a_attribs[
"key"];
 
  719        switch ($this->mode) {
 
  739                $this->roles[$this->current_role_id][
"name"] = $this->cdata;
 
  740                $this->roles[$this->current_role_id][
"type"] =
 
  741                    $this->current_role_type;
 
  751        if (array_key_exists($a_role_id, $this->localRoleCache)) {
 
  752            return $this->localRoleCache[$a_role_id];
 
  754            $role_obj = 
new ilObjRole($a_role_id, 
false);
 
  756            $this->localRoleCache[$a_role_id] = $role_obj;
 
  767        $rbacreview = 
$DIC[
'rbacreview'];
 
  768        $rbacadmin = 
$DIC[
'rbacadmin'];
 
  769        $tree = 
$DIC[
'tree'];
 
  771        if (array_key_exists($a_role_id . 
'_courseMembersObject', $this->localRoleCache)) {
 
  772            return $this->localRoleCache[$a_role_id . 
'_courseMembersObject'];
 
  774            require_once(
"Modules/Course/classes/class.ilObjCourse.php");
 
  775            require_once(
"Modules/Course/classes/class.ilCourseParticipants.php");
 
  776            $course_refs = $rbacreview->getFoldersAssignedToRole($a_role_id, 
true);
 
  777            $course_ref = $course_refs[0];
 
  780            $this->localRoleCache[$a_role_id . 
'_courseMembersObject'] = $crsmembers_obj;
 
  781            return $crsmembers_obj;
 
  790        require_once 
"./Services/AccessControl/classes/class.ilObjRole.php";
 
  791        include_once(
'./Services/Object/classes/class.ilObject.php');
 
  792        #require_once "Modules/Course/classes/class.ilObjCourse.php";
 
  793        #require_once "Modules/Course/classes/class.ilCourseParticipants.php";
 
  797        $rbacreview = 
$DIC[
'rbacreview'];
 
  798        $rbacadmin = 
$DIC[
'rbacadmin'];
 
  799        $tree = 
$DIC[
'tree'];
 
  805        if ($rbacreview->isAssigned($a_user_obj->getId(), $a_role_id)) {
 
  812        $rbacadmin->assignUser($a_role_id, $a_user_obj->getId(), 
true);
 
  813        $obj_id = $rbacreview->getObjectOfRole($a_role_id);
 
  818                $ref_id = current((array) $ref_ids);
 
  837        $rbacreview = 
$DIC[
'rbacreview'];
 
  839        if (!array_key_exists($a_role_id, $this->parentRolesCache)) {
 
  840            $parent_role_ids = array();
 
  843            $short_role_title = substr($role_obj->getTitle(), 0, 12);
 
  844            $folders = $rbacreview->getFoldersAssignedToRole($a_role_id, 
true);
 
  845            if (count($folders) > 0) {
 
  846                $all_parent_role_ids = $rbacreview->getParentRoleIds($folders[0]);
 
  847                foreach ($all_parent_role_ids as $parent_role_id => $parent_role_data) {
 
  848                    if ($parent_role_id != $a_role_id) {
 
  849                        switch (substr($parent_role_data[
'title'], 0, 12)) {
 
  852                                if ($short_role_title == 
'il_crs_admin' || $short_role_title == 
'il_grp_admin') {
 
  853                                    $parent_role_ids[] = $parent_role_id;
 
  858                                if ($short_role_title == 
'il_crs_tutor' || $short_role_title == 
'il_grp_tutor') {
 
  859                                    $parent_role_ids[] = $parent_role_id;
 
  864                                if ($short_role_title == 
'il_crs_membe' || $short_role_title == 
'il_grp_membe') {
 
  865                                    $parent_role_ids[] = $parent_role_id;
 
  874            $this->parentRolesCache[$a_role_id] = $parent_role_ids;
 
  876        return $this->parentRolesCache[$a_role_id];
 
  886        foreach ($parent_role_ids as $parent_role_id) {
 
  897        $rbacreview = 
$DIC[
'rbacreview'];
 
  898        $rbacadmin = 
$DIC[
'rbacadmin'];
 
  899        $tree = 
$DIC[
'tree'];
 
  901        $rbacadmin->deassignUser($a_role_id, $a_user_obj->getId());
 
  905            $obj = $rbacreview->getObjectOfRole($a_role_id);
 
  908            $this->recommended_content_manager->removeObjectRecommendation($a_user_obj->getId(), $ref_id);
 
  920        $rbacadmin = 
$DIC[
'rbacadmin'];
 
  921        $rbacreview = 
$DIC[
'rbacreview'];
 
  928                $this->roles[$this->current_role_id][
"name"] = $this->cdata;
 
  929                $this->roles[$this->current_role_id][
"type"] = $this->current_role_type;
 
  930                $this->roles[$this->current_role_id][
"action"] = $this->current_role_action;
 
  933            case "PersonalPicture":
 
  934                switch ($this->personalPicture[
"encoding"]) {
 
  936                        $this->personalPicture[
"content"] = base64_decode($this->cdata);
 
  939                        $this->personalPicture[
"content"] = convert_uudecode($this->cdata);
 
  945                $this->userObj->setFullname();
 
  948                if ($this->user_id == -1 || $this->action == 
"Insert") {
 
  959                switch ($this->conflict_rule) {
 
  964                        switch ($this->action) {
 
  967                                    $this->
logWarning($this->userObj->getLogin(), sprintf(
$lng->txt(
"usrimport_action_replaced"), 
"Insert", 
"Update"));
 
  968                                    $this->action = 
"Update";
 
  973                                    $this->
logWarning($this->userObj->getLogin(), sprintf(
$lng->txt(
"usrimport_action_replaced"), 
"Update", 
"Insert"));
 
  974                                    $this->action = 
"Insert";
 
  979                                    $this->
logWarning($this->userObj->getLogin(), sprintf(
$lng->txt(
"usrimport_action_ignored"), 
"Delete"));
 
  980                                    $this->action = 
"Ignore";
 
  986                        switch ($this->action) {
 
  989                                    $this->
logWarning($this->userObj->getLogin(), sprintf(
$lng->txt(
"usrimport_action_ignored"), 
"Insert"));
 
  990                                    $this->action = 
"Ignore";
 
  995                                    $this->
logWarning($this->userObj->getLogin(), sprintf(
$lng->txt(
"usrimport_action_ignored"), 
"Update"));
 
  996                                    $this->action = 
"Ignore";
 
 1001                                    $this->
logWarning($this->userObj->getLogin(), sprintf(
$lng->txt(
"usrimport_action_ignored"), 
"Delete"));
 
 1002                                    $this->action = 
"Ignore";
 
 1013                $am = ($this->userObj->getAuthMode() == 
"default" || $this->userObj->getAuthMode() == 
"")
 
 1015                    : $this->userObj->getAuthMode();
 
 1016                $loginForExternalAccount = ($this->userObj->getExternalAccount() == 
"")
 
 1019                switch ($this->action) {
 
 1021                        if ($loginForExternalAccount != 
"") {
 
 1023                                $this->userObj->getLogin(),
 
 1024                                $lng->txt(
'usrimport_no_insert_ext_account_exists')
 
 1025                                    . 
' (' . $this->stripTags($this->userObj->getExternalAccount()) . 
')' 
 1027                            $this->action = 
"Ignore";
 
 1036                        if ($loginForExternalAccount != 
"") {
 
 1040                            if ($externalAccountHasChanged && trim($loginForExternalAccount) != trim($this->userObj->getLogin())) {
 
 1042                                    $this->userObj->getLogin(),
 
 1043                                    $lng->txt(
'usrimport_no_update_ext_account_exists')
 
 1044                                        . 
' (' . $this->stripTags($this->userObj->getExternalAccount()) . 
')' 
 1046                                $this->action = 
"Ignore";
 
 1052                if (
sizeof($this->multi_values)) {
 
 1053                    if (isset($this->multi_values[
"GeneralInterest"])) {
 
 1054                        $this->userObj->setGeneralInterests($this->multi_values[
"GeneralInterest"]);
 
 1056                    if (isset($this->multi_values[
"OfferingHelp"])) {
 
 1057                        $this->userObj->setOfferingHelp($this->multi_values[
"OfferingHelp"]);
 
 1059                    if (isset($this->multi_values[
"LookingForHelp"])) {
 
 1060                        $this->userObj->setLookingForHelp($this->multi_values[
"LookingForHelp"]);
 
 1065                switch ($this->action) {
 
 1068                            $this->
logFailure($this->userObj->getLogin(), 
$lng->txt(
"usrimport_cant_insert"));
 
 1070                            if (!strlen($this->currPassword) == 0) {
 
 1071                                switch (strtoupper($this->currPasswordType)) {
 
 1074                                        $this->userObj->setPasswordEncodingType(
'bcryptphp');
 
 1075                                        $this->userObj->setPasswordSalt(
null);
 
 1080                                        $this->acc_mail->setUserPassword($this->currPassword);
 
 1084                                        $this->
logFailure($this->userObj->getLogin(), sprintf(
$lng->txt(
"usrimport_xml_attribute_value_illegal"), 
"Type", 
"Password", $this->stripTags($this->currPasswordType)));
 
 1096                            $this->userObj->setTitle($this->userObj->getFullname());
 
 1097                            $this->userObj->setDescription($this->userObj->getEmail());
 
 1099                            if (!$this->time_limit_owner_set) {
 
 1100                                $this->userObj->setTimeLimitOwner($this->
getFolderId());
 
 1104                            if (!$this->time_limit_set) {
 
 1105                                $this->userObj->setTimeLimitUnlimited(1);
 
 1106                                $this->userObj->setTimeLimitMessage(0);
 
 1108                                if (!$this->approve_date_set) {
 
 1109                                    $this->userObj->setApproveDate(date(
"Y-m-d H:i:s"));
 
 1114                            $this->userObj->setActive($this->currActive == 
'true' || is_null($this->currActive));
 
 1120                            if (count($this->udf_data)) {
 
 1121                                $this->userObj->setUserDefinedData($this->udf_data);
 
 1124                            if (!$this->userObj->getLanguage()) {
 
 1125                                $this->userObj->setLanguage($this->lng->getDefaultLanguage());
 
 1129                            $this->userObj->create();
 
 1132                            $this->userObj->saveAsNew(
false);
 
 1135                            $this->userObj->setPref(
'hits_per_page', 
$ilSetting->get(
'hits_per_page', 30));
 
 1138                            if (count($this->prefs)) {
 
 1139                                foreach ($this->prefs as $key => $value) {
 
 1140                                    if ($key != 
"mail_incoming_type" &&
 
 1141                                        $key != 
"mail_signature" &&
 
 1142                                        $key != 
"mail_linebreak" 
 1144                                        $this->userObj->setPref($key, $value);
 
 1149                            if (!is_array($this->prefs) || array_search(
'chat_osc_accept_msg', $this->prefs) === 
false) {
 
 1150                                $this->userObj->setPref(
'chat_osc_accept_msg', 
$ilSetting->get(
'chat_osc_accept_msg', 
'n'));
 
 1152                            if (!is_array($this->prefs) || array_search(
'bs_allow_to_contact_me', $this->prefs) === 
false) {
 
 1153                                $this->userObj->setPref(
'bs_allow_to_contact_me', 
$ilSetting->get(
'bs_allow_to_contact_me', 
'n'));
 
 1156                            $this->userObj->writePrefs();
 
 1161                            if (is_array($this->personalPicture)) {
 
 1162                                if (strlen($this->personalPicture[
"content"])) {
 
 1164                                    if (preg_match(
"/.*(png|jpg|gif|jpeg)$/", $this->personalPicture[
"imagetype"], $matches)) {
 
 1165                                        $extension = $matches[1];
 
 1167                                    $tmp_name = $this->
saveTempImage($this->personalPicture[
"content"], 
".$extension");
 
 1168                                    if (strlen($tmp_name)) {
 
 1176                            foreach ($this->roles as $role_id => $role) {
 
 1177                                if ($this->role_assign[$role_id]) {
 
 1178                                    $this->
assignToRole($this->userObj, $this->role_assign[$role_id]);
 
 1182                            if (count($this->udf_data)) {
 
 1183                                include_once 
'./Services/User/classes/class.ilUserDefinedData.php';
 
 1185                                foreach ($this->udf_data as $field => $value) {
 
 1186                                    $udd->set(
"f_" . $field, $value);
 
 1192                            $this->
logSuccess($this->userObj->getLogin(), $this->userObj->getId(), 
"Insert");
 
 1194                            $this->acc_mail->reset();
 
 1200                            $this->
logFailure($this->userObj->getLogin(), 
$lng->txt(
"usrimport_cant_update"));
 
 1203                            $updateUser->read();
 
 1204                            $updateUser->readPrefs();
 
 1205                            if ($this->currPassword != 
null) {
 
 1206                                switch (strtoupper($this->currPasswordType)) {
 
 1209                                        $updateUser->setPasswordEncodingType(
'bcryptphp');
 
 1210                                        $updateUser->setPasswordSalt(
null);
 
 1215                                        $this->acc_mail->setUserPassword($this->currPassword);
 
 1219                                        $this->
logFailure($this->userObj->getLogin(), sprintf(
$lng->txt(
"usrimport_xml_attribute_value_illegal"), 
"Type", 
"Password", $this->stripTags($this->currPasswordType)));
 
 1223                            if (!is_null($this->userObj->getFirstname())) {
 
 1224                                $updateUser->setFirstname($this->userObj->getFirstname());
 
 1226                            if (!is_null($this->userObj->getLastname())) {
 
 1227                                $updateUser->setLastname($this->userObj->getLastname());
 
 1229                            if (!is_null($this->userObj->getUTitle())) {
 
 1230                                $updateUser->setUTitle($this->userObj->getUTitle());
 
 1232                            if (!is_null($this->userObj->getGender())) {
 
 1233                                $updateUser->setGender($this->userObj->getGender());
 
 1235                            if (!is_null($this->userObj->getEmail())) {
 
 1236                                $updateUser->setEmail($this->userObj->getEmail());
 
 1238                            if (!is_null($this->userObj->getSecondEmail())) {
 
 1239                                $updateUser->setSecondEmail($this->userObj->getSecondEmail());
 
 1241                            if (!is_null($this->userObj->getBirthday())) {
 
 1242                                $updateUser->setBirthday($this->userObj->getBirthday());
 
 1244                            if (!is_null($this->userObj->getInstitution())) {
 
 1245                                $updateUser->setInstitution($this->userObj->getInstitution());
 
 1247                            if (!is_null($this->userObj->getStreet())) {
 
 1248                                $updateUser->setStreet($this->userObj->getStreet());
 
 1250                            if (!is_null($this->userObj->getCity())) {
 
 1251                                $updateUser->setCity($this->userObj->getCity());
 
 1253                            if (!is_null($this->userObj->getZipCode())) {
 
 1254                                $updateUser->setZipCode($this->userObj->getZipCode());
 
 1256                            if (!is_null($this->userObj->getCountry())) {
 
 1257                                $updateUser->setCountry($this->userObj->getCountry());
 
 1259                            if (!is_null($this->userObj->getSelectedCountry())) {
 
 1260                                $updateUser->setSelectedCountry($this->userObj->getSelectedCountry());
 
 1262                            if (!is_null($this->userObj->getPhoneOffice())) {
 
 1263                                $updateUser->setPhoneOffice($this->userObj->getPhoneOffice());
 
 1265                            if (!is_null($this->userObj->getPhoneHome())) {
 
 1266                                $updateUser->setPhoneHome($this->userObj->getPhoneHome());
 
 1268                            if (!is_null($this->userObj->getPhoneMobile())) {
 
 1269                                $updateUser->setPhoneMobile($this->userObj->getPhoneMobile());
 
 1271                            if (!is_null($this->userObj->getFax())) {
 
 1272                                $updateUser->setFax($this->userObj->getFax());
 
 1274                            if (!is_null($this->userObj->getHobby())) {
 
 1275                                $updateUser->setHobby($this->userObj->getHobby());
 
 1277                            if (!is_null($this->userObj->getGeneralInterests())) {
 
 1278                                $updateUser->setGeneralInterests($this->userObj->getGeneralInterests());
 
 1280                            if (!is_null($this->userObj->getOfferingHelp())) {
 
 1281                                $updateUser->setOfferingHelp($this->userObj->getOfferingHelp());
 
 1283                            if (!is_null($this->userObj->getLookingForHelp())) {
 
 1284                                $updateUser->setLookingForHelp($this->userObj->getLookingForHelp());
 
 1286                            if (!is_null($this->userObj->getComment())) {
 
 1287                                $updateUser->setComment($this->userObj->getComment());
 
 1289                            if (!is_null($this->userObj->getDepartment())) {
 
 1290                                $updateUser->setDepartment($this->userObj->getDepartment());
 
 1292                            if (!is_null($this->userObj->getMatriculation())) {
 
 1293                                $updateUser->setMatriculation($this->userObj->getMatriculation());
 
 1295                            if (!is_null($this->currActive)) {
 
 1296                                $updateUser->setActive($this->currActive == 
"true", is_object(
$ilUser) ? 
$ilUser->getId() : 0);
 
 1298                            if (!is_null($this->userObj->getClientIP())) {
 
 1299                                $updateUser->setClientIP($this->userObj->getClientIP());
 
 1301                            if (!is_null($this->userObj->getTimeLimitUnlimited())) {
 
 1302                                $updateUser->setTimeLimitUnlimited($this->userObj->getTimeLimitUnlimited());
 
 1304                            if (!is_null($this->userObj->getTimeLimitFrom())) {
 
 1305                                $updateUser->setTimeLimitFrom($this->userObj->getTimeLimitFrom());
 
 1307                            if (!is_null($this->userObj->getTimeLimitUntil())) {
 
 1308                                $updateUser->setTimeLimitUntil($this->userObj->getTimeLimitUntil());
 
 1310                            if (!is_null($this->userObj->getTimeLimitMessage())) {
 
 1311                                $updateUser->setTimeLimitMessage($this->userObj->getTimeLimitMessage());
 
 1313                            if (!is_null($this->userObj->getApproveDate())) {
 
 1314                                $updateUser->setApproveDate($this->userObj->getApproveDate());
 
 1316                            if (!is_null($this->userObj->getAgreeDate())) {
 
 1317                                $updateUser->setAgreeDate($this->userObj->getAgreeDate());
 
 1319                            if (!is_null($this->userObj->getLanguage())) {
 
 1320                                $updateUser->setLanguage($this->userObj->getLanguage());
 
 1322                            if (!is_null($this->userObj->getExternalAccount())) {
 
 1323                                $updateUser->setExternalAccount($this->userObj->getExternalAccount());
 
 1327                            #if (! is_null($this->userObj->getAuthMode())) $updateUser->setAuthMode($this->userObj->getAuthMode()); 
 1328                            if ($this->auth_mode_set) {
 
 1329                                $updateUser->setAuthMode($this->userObj->getAuthMode());
 
 1333                            if ($this->time_limit_owner_set) {
 
 1334                                $updateUser->setTimeLimitOwner($this->userObj->getTimeLimitOwner());
 
 1338                            if (count($this->prefs)) {
 
 1339                                foreach ($this->prefs as $key => $value) {
 
 1340                                    if ($key != 
"mail_incoming_type" &&
 
 1341                                        $key != 
"mail_signature" &&
 
 1342                                        $key != 
"mail_linebreak" 
 1344                                        $updateUser->setPref($key, $value);
 
 1350                            if ($this->updateLookAndSkin) {
 
 1351                                $updateUser->setPref(
"skin", $this->userObj->getPref(
"skin"));
 
 1352                                $updateUser->setPref(
"style", $this->userObj->getPref(
"style"));
 
 1356                            $updateUser->writePrefs();
 
 1362                            if (count($this->udf_data)) {
 
 1363                                $updateUser->setUserDefinedData($this->udf_data);
 
 1367                            $updateUser->setFullname();
 
 1368                            $updateUser->setTitle($updateUser->getFullname());
 
 1369                            $updateUser->setDescription($updateUser->getEmail());
 
 1370                            $updateUser->update();
 
 1372                            if (count($this->udf_data)) {
 
 1373                                include_once 
'./Services/User/classes/class.ilUserDefinedData.php';
 
 1375                                foreach ($this->udf_data as $field => $value) {
 
 1376                                    $udd->set(
"f_" . $field, $value);
 
 1382                            if (!is_null($this->userObj->getLogin()) && $this->user_id != -1) {
 
 1384                                    $updateUser->updateLogin($this->userObj->getLogin());
 
 1392                            if (is_array($this->personalPicture)) {
 
 1393                                if (strlen($this->personalPicture[
"content"])) {
 
 1395                                    if (preg_match(
"/.*(png|jpg|gif|jpeg)$/", $this->personalPicture[
"imagetype"], $matches)) {
 
 1396                                        $extension = $matches[1];
 
 1398                                    $tmp_name = $this->
saveTempImage($this->personalPicture[
"content"], 
".$extension");
 
 1399                                    if (strlen($tmp_name)) {
 
 1409                            foreach ($this->roles as $role_id => $role) {
 
 1410                                if (array_key_exists($role_id, $this->role_assign)) {
 
 1411                                    switch ($role[
"action"]) {
 
 1413                                            $this->
assignToRole($updateUser, $this->role_assign[$role_id]);
 
 1415                                        case "AssignWithParents":
 
 1419                                            $this->
detachFromRole($updateUser, $this->role_assign[$role_id]);
 
 1429                            $this->
logFailure($this->userObj->getLogin(), 
$lng->txt(
"usrimport_cant_delete"));
 
 1432                            $deleteUser->delete();
 
 1440                $this->roles = array();
 
 1448                $this->currPassword = $this->cdata;
 
 1464                $this->userObj->setGender($this->cdata);
 
 1475                if (strtotime($birthday) !== 
false) {
 
 1476                    $this->userObj->setBirthday($birthday);
 
 1523            case "GeneralInterest":
 
 1524            case "OfferingHelp":
 
 1525            case "LookingForHelp":
 
 1537            case "Matriculation":
 
 1542                $this->currActive = $this->cdata;
 
 1549            case "TimeLimitOwner":
 
 1550                $this->time_limit_owner_set = 
true;
 
 1551                $this->userObj->setTimeLimitOwner($this->cdata);
 
 1554            case "TimeLimitUnlimited":
 
 1555                $this->time_limit_set = 
true;
 
 1556                $this->userObj->setTimeLimitUnlimited($this->cdata);
 
 1559            case "TimeLimitFrom":
 
 1560                if (is_numeric($this->cdata)) {
 
 1562                    $this->userObj->setTimeLimitFrom($this->cdata);
 
 1566                    if (
$timestamp !== 
false && trim($this->cdata) != 
"0000-00-00 00:00:00") {
 
 1567                        $this->userObj->setTimeLimitFrom(
$timestamp);
 
 1568                    } elseif ($this->cdata == 
"0000-00-00 00:00:00") {
 
 1569                        $this->userObj->setTimeLimitFrom(
null);
 
 1574            case "TimeLimitUntil":
 
 1575                if (is_numeric($this->cdata)) {
 
 1577                    $this->userObj->setTimeLimitUntil($this->cdata);
 
 1581                    if (
$timestamp !== 
false && trim($this->cdata) != 
"0000-00-00 00:00:00") {
 
 1582                        $this->userObj->setTimeLimitUntil(
$timestamp);
 
 1583                    } elseif ($this->cdata == 
"0000-00-00 00:00:00") {
 
 1584                        $this->userObj->setTimeLimitUntil(
null);
 
 1589            case "TimeLimitMessage":
 
 1590                $this->userObj->setTimeLimitMessage($this->cdata);
 
 1594                $this->approve_date_set = 
true;
 
 1595                if (is_numeric($this->cdata)) {
 
 1602                    if (
$timestamp !== 
false && trim($this->cdata) != 
"0000-00-00 00:00:00") {
 
 1605                    } elseif ($this->cdata == 
"0000-00-00 00:00:00") {
 
 1606                        $this->userObj->setApproveDate(
null);
 
 1612                if (is_numeric($this->cdata)) {
 
 1619                    if (
$timestamp !== 
false && trim($this->cdata) != 
"0000-00-00 00:00:00") {
 
 1622                    } elseif ($this->cdata == 
"0000-00-00 00:00:00") {
 
 1623                        $this->userObj->setAgreeDate(
null);
 
 1628            case "ExternalAccount":
 
 1633                $this->updateLookAndSkin = 
false;
 
 1634                if (!$this->hideSkin) {
 
 1636                    if ((strlen($this->skin) > 0) && (strlen($this->style) > 0)) {
 
 1637                        if (is_array($this->userStyles)) {
 
 1638                            if (in_array($this->skin . 
":" . $this->style, $this->userStyles)) {
 
 1639                                $this->userObj->setPref(
"skin", $this->skin);
 
 1640                                $this->userObj->setPref(
"style", $this->style);
 
 1641                                $this->updateLookAndSkin = 
true;
 
 1648            case 'UserDefinedField':
 
 1649                include_once 
'./Services/User/classes/class.ilUserDefinedFields.php';
 
 1652                $field_id = $udf->fetchFieldIdFromImportId($this->tmp_udf_id);
 
 1654                if ($field_id === 0) {
 
 1655                    $field_id = $udf->fetchFieldIdFromName($this->tmp_udf_name);
 
 1658                if ($field_id === 0) {
 
 1666                if ($this->current_messenger_type == 
"external") {
 
 1667                    $this->userObj->setExternalAccount($this->cdata);
 
 1671                if ($this->currentPrefKey != 
null && strlen(trim($this->cdata)) > 0
 
 1673                    $this->prefs[$this->currentPrefKey] = trim($this->cdata);
 
 1675                $this->currentPrefKey = 
null;
 
 1687        $fh = fopen($tempname, 
"wb");
 
 1691        $imagefile = fwrite($fh, $image_data);
 
 1704        $ilAccess = 
$DIC[
'ilAccess'];
 
 1706        $ilObjDataCache = 
$DIC[
'ilObjDataCache'];
 
 1710                $this->roles[$this->current_role_id][
"name"] = $this->cdata;
 
 1711                $this->roles[$this->current_role_id][
"type"] = $this->current_role_type;
 
 1712                $this->roles[$this->current_role_id][
"action"] = $this->current_role_action;
 
 1716                $this->userObj->setFullname();
 
 1717                if ($this->user_id != -1 && ($this->action == 
"Update" || $this->action == 
"Delete")) {
 
 1725                if (is_null($this->userObj->getLogin())) {
 
 1726                    $this->
logFailure(
"---", sprintf(
$lng->txt(
"usrimport_xml_element_for_action_required"), 
"Login", 
"Insert"));
 
 1730                    $this->
logWarning($this->userObj->getLogin(), 
$lng->txt(
'usrimport_xml_anonymous_or_root_not_allowed'));
 
 1734                switch ($this->action) {
 
 1737                            $this->
logWarning($this->userObj->getLogin(), 
$lng->txt(
"usrimport_cant_insert"));
 
 1739                        if (is_null($this->userObj->getGender()) && $this->isFieldRequired(
"gender")) {
 
 1740                            $this->
logFailure($this->userObj->getLogin(), sprintf(
$lng->txt(
"usrimport_xml_element_for_action_required"), 
"Gender", 
"Insert"));
 
 1742                        if (is_null($this->userObj->getFirstname())) {
 
 1743                            $this->
logFailure($this->userObj->getLogin(), sprintf(
$lng->txt(
"usrimport_xml_element_for_action_required"), 
"Firstname", 
"Insert"));
 
 1745                        if (is_null($this->userObj->getLastname())) {
 
 1746                            $this->
logFailure($this->userObj->getLogin(), sprintf(
$lng->txt(
"usrimport_xml_element_for_action_required"), 
"Lastname", 
"Insert"));
 
 1748                        if (count($this->roles) == 0) {
 
 1749                            $this->
logFailure($this->userObj->getLogin(), sprintf(
$lng->txt(
"usrimport_xml_element_for_action_required"), 
"Role", 
"Insert"));
 
 1751                            $has_global_role = 
false;
 
 1752                            foreach ($this->roles as $role) {
 
 1753                                if ($role[
'type'] == 
'Global') {
 
 1754                                    $has_global_role = 
true;
 
 1758                            if (!$has_global_role) {
 
 1759                                $this->
logFailure($this->userObj->getLogin(), sprintf(
$lng->txt(
"usrimport_global_role_for_action_required"), 
"Insert"));
 
 1764                        if (!$user_exists) {
 
 1765                            $this->
logWarning($this->userObj->getLogin(), 
$lng->txt(
"usrimport_cant_update"));
 
 1766                        } elseif ($this->user_id != -1 && !is_null($this->userObj->getLogin())) {
 
 1770                            if (is_numeric($someonesId) && $someonesId != $this->user_id) {
 
 1771                                $this->
logFailure($this->userObj->getLogin(), 
$lng->txt(
"usrimport_login_is_not_unique"));
 
 1776                        if (!$user_exists) {
 
 1777                            $this->
logWarning($this->userObj->getLogin(), 
$lng->txt(
"usrimport_cant_delete"));
 
 1783                $this->roles = array();
 
 1787                if (array_key_exists($this->cdata, $this->logins)) {
 
 1788                    $this->
logWarning($this->cdata, 
$lng->txt(
"usrimport_login_is_not_unique"));
 
 1790                    $this->logins[$this->cdata] = $this->cdata;
 
 1792                $this->userObj->setLogin($this->
stripTags($this->cdata));
 
 1796                switch ($this->currPasswordType) {
 
 1799                        $this->userObj->setPasswordEncodingType(
'bcryptphp');
 
 1800                        $this->userObj->setPasswordSalt(
null);
 
 1805                        $this->acc_mail->setUserPassword($this->currPassword);
 
 1809                        $this->
logFailure($this->userObj->getLogin(), sprintf(
$lng->txt(
"usrimport_xml_attribute_value_illegal"), 
"Type", 
"Password", $this->stripTags($this->currPasswordType)));
 
 1815                $this->userObj->setFirstname($this->cdata);
 
 1819                $this->userObj->setLastname($this->cdata);
 
 1823                $this->userObj->setUTitle($this->cdata);
 
 1827                if (!in_array(strtolower($this->cdata), [
'n', 
'm', 
'f'])) {
 
 1829                        $this->userObj->getLogin(),
 
 1830                        sprintf(
$lng->txt(
"usrimport_xml_element_content_illegal"), 
"Gender", $this->stripTags($this->cdata))
 
 1833                $this->userObj->setGender($this->cdata);
 
 1837                $this->userObj->setEmail($this->cdata);
 
 1840                $this->userObj->setSecondEmail($this->cdata);
 
 1843                $this->userObj->setInstitution($this->cdata);
 
 1847                $this->userObj->setStreet($this->cdata);
 
 1851                $this->userObj->setCity($this->cdata);
 
 1855                $this->userObj->setZipCode($this->cdata);
 
 1859                $this->userObj->setCountry($this->cdata);
 
 1863                $this->userObj->setSelectedCountry($this->cdata);
 
 1867                $this->userObj->setPhoneOffice($this->cdata);
 
 1871                $this->userObj->setPhoneHome($this->cdata);
 
 1875                $this->userObj->setPhoneMobile($this->cdata);
 
 1879                $this->userObj->setFax($this->cdata);
 
 1883                $this->userObj->setHobby($this->cdata);
 
 1886            case "GeneralInterest":
 
 1887            case "OfferingHelp":
 
 1888            case "LookingForHelp":
 
 1889                $this->multi_values[$a_name][] = $this->cdata;
 
 1893                $this->userObj->setComment($this->cdata);
 
 1897                $this->userObj->setDepartment($this->cdata);
 
 1900            case "Matriculation":
 
 1901                $this->userObj->setMatriculation($this->cdata);
 
 1904            case "ExternalAccount":
 
 1905                $am = ($this->userObj->getAuthMode() == 
"default" || $this->userObj->getAuthMode() == 
"")
 
 1907                    : $this->userObj->getAuthMode();
 
 1908                $loginForExternalAccount = (trim($this->cdata) == 
"")
 
 1911                switch ($this->action) {
 
 1913                        if ($loginForExternalAccount != 
"") {
 
 1914                            $this->
logWarning($this->userObj->getLogin(), 
$lng->txt(
"usrimport_no_insert_ext_account_exists") . 
" (" . $this->stripTags($this->cdata) . 
")");
 
 1919                        if ($loginForExternalAccount != 
"") {
 
 1921                            if ($externalAccountHasChanged && trim($loginForExternalAccount) != trim($this->userObj->getLogin())) {
 
 1923                                    $this->userObj->getLogin(),
 
 1924                                    $lng->txt(
"usrimport_no_update_ext_account_exists") . 
" (" . $this->stripTags($this->cdata) . 
" for " . $this->stripTags($loginForExternalAccount) . 
")" 
 1931                if ($externalAccountHasChanged) {
 
 1932                    $this->userObj->setExternalAccount(trim($this->cdata));
 
 1937                if ($this->cdata != 
"true" 
 1938                && $this->cdata != 
"false") {
 
 1940                        $this->userObj->getLogin(),
 
 1941                        sprintf(
$lng->txt(
"usrimport_xml_element_content_illegal"), 
"Active", $this->stripTags($this->cdata))
 
 1944                $this->currActive = $this->cdata;
 
 1946            case "TimeLimitOwner":
 
 1947                if (!preg_match(
"/\d+/", $this->cdata)) {
 
 1949                        $this->userObj->getLogin(),
 
 1950                        sprintf(
$lng->txt(
"usrimport_xml_element_content_illegal"), 
"TimeLimitOwner", $this->stripTags($this->cdata))
 
 1952                } elseif (!$ilAccess->checkAccess(
'cat_administrate_users', 
'', $this->cdata)) {
 
 1954                        $this->userObj->getLogin(),
 
 1955                        sprintf(
$lng->txt(
"usrimport_xml_element_content_illegal"), 
"TimeLimitOwner", $this->stripTags($this->cdata))
 
 1957                } elseif ($ilObjDataCache->lookupType($ilObjDataCache->lookupObjId($this->cdata)) != 
'cat' && !(
int) $this->cdata == 
USER_FOLDER_ID) {
 
 1959                        $this->userObj->getLogin(),
 
 1960                        sprintf(
$lng->txt(
"usrimport_xml_element_content_illegal"), 
"TimeLimitOwner", $this->stripTags($this->cdata))
 
 1963                $this->userObj->setTimeLimitOwner($this->cdata);
 
 1965            case "TimeLimitUnlimited":
 
 1966                switch (strtolower($this->cdata)) {
 
 1969                        $this->userObj->setTimeLimitUnlimited(1);
 
 1973                        $this->userObj->setTimeLimitUnlimited(0);
 
 1976                        $this->
logFailure($this->userObj->getLogin(), sprintf(
$lng->txt(
"usrimport_xml_element_content_illegal"), 
"TimeLimitUnlimited", $this->stripTags($this->cdata)));
 
 1980            case "TimeLimitFrom":
 
 1982                if (strtotime($this->cdata) === 
false && !is_numeric($this->cdata)) {
 
 1983                    $this->
logFailure($this->userObj->getLogin(), sprintf(
$lng->txt(
"usrimport_xml_element_content_illegal"), 
"TimeLimitFrom", $this->stripTags($this->cdata)));
 
 1985                $this->userObj->setTimeLimitFrom($this->cdata);
 
 1987            case "TimeLimitUntil":
 
 1989                if (strtotime($this->cdata) === 
false && !is_numeric($this->cdata)) {
 
 1990                    $this->
logFailure($this->userObj->getLogin(), sprintf(
$lng->txt(
"usrimport_xml_element_content_illegal"), 
"TimeLimitUntil", $this->stripTags($this->cdata)));
 
 1992                $this->userObj->setTimeLimitUntil($this->cdata);
 
 1994            case "TimeLimitMessage":
 
 1995                switch (strtolower($this->cdata)) {
 
 1997                        $this->userObj->setTimeLimitMessage(1);
 
 2000                        $this->userObj->setTimeLimitMessage(0);
 
 2003                        $this->
logFailure($this->userObj->getLogin(), sprintf(
$lng->txt(
"usrimport_xml_element_content_illegal"), 
"TimeLimitMessage", $this->stripTags($this->cdata)));
 
 2009                if (strtotime($this->cdata) === 
false && !is_numeric($this->cdata) && !$this->cdata == 
"0000-00-00 00:00:00") {
 
 2010                    $this->
logFailure($this->userObj->getLogin(), sprintf(
$lng->txt(
"usrimport_xml_element_content_illegal"), 
"ApproveDate", $this->stripTags($this->cdata)));
 
 2015                if (strtotime($this->cdata) === 
false && !is_numeric($this->cdata) && !$this->cdata == 
"0000-00-00 00:00:00") {
 
 2016                    $this->
logFailure($this->userObj->getLogin(), sprintf(
$lng->txt(
"usrimport_xml_element_content_illegal"), 
"AgreeDate", $this->stripTags($this->cdata)));
 
 2020                if ($this->currentPrefKey != 
null) {
 
 2021                    $this->
verifyPref($this->currentPrefKey, $this->cdata);
 
 2023                $this->currentPrefKey == 
null;
 
 2035        if ($a_data != 
"\n") {
 
 2036            $a_data = preg_replace(
"/\t+/", 
" ", $a_data);
 
 2039        if (strlen($a_data) > 0) {
 
 2040            $this->cdata .= $a_data;
 
 2067        if (!array_key_exists($aLogin, $this->protocol)) {
 
 2068            $this->protocol[$aLogin] = array();
 
 2071            $this->protocol[$aLogin][] = $aMessage;
 
 2085        if (!array_key_exists($aLogin, $this->protocol)) {
 
 2086            $this->protocol[$aLogin] = array();
 
 2089            $this->protocol[$aLogin][] = $aMessage;
 
 2103        $this->user_mapping[$userid] = array(
"login" => $aLogin, 
"action" => 
$action, 
"message" => 
"successful");
 
 2128        $block = 
new ilTemplate(
"tpl.usr_import_log_block.html", 
true, 
true, 
"Services/User");
 
 2129        $block->setVariable(
"TXT_LOG_TITLE", $a_log_title);
 
 2130        $block->setVariable(
"TXT_MESSAGE_ID", 
$lng->txt(
"login"));
 
 2131        $block->setVariable(
"TXT_MESSAGE_TEXT", 
$lng->txt(
"message"));
 
 2133            $block->setCurrentBlock(
"log_row");
 
 2136                if ($reason == 
"") {
 
 2139                    $reason = $reason . 
"<br>" . 
$message;
 
 2142            $block->setVariable(
"MESSAGE_ID", 
$login);
 
 2143            $block->setVariable(
"MESSAGE_TEXT", $reason);
 
 2144            $block->parseCurrentBlock();
 
 2146        return $block->get();
 
 2181        if (
$_POST[
"send_mail"] != 
"" ||
 
 2182            ($this->
isSendMail() && $this->userObj->getEmail() != 
"")) {
 
 2183            $this->acc_mail->setUser($this->userObj);
 
 2184            $this->acc_mail->send();
 
 2195        $this->send_mail = $value ? 
true: 
false;
 
 2216            $this->mapping_mode = $value;
 
 2218            die(
"wrong argument using methode setUserMappingMethod in " . __FILE__);
 
 2244        if (is_array($this->required_fields)) {
 
 2245            return $this->required_fields;
 
 2247        foreach (
$ilSetting->getAll() as $field => $value) {
 
 2248            if (substr($field, 0, 8) == 
'require_' and $value == 1) {
 
 2249                $value = substr($field, 8);
 
 2250                $this->required_fields[$value] = $value;
 
 2253        return $this->required_fields ? $this->required_fields : array();
 
 2266        include_once 
"Services/User/classes/class.ilUserProfile.php";
 
 2279        $fieldname = strtolower(trim($fieldname));
 
 2280        return array_key_exists($fieldname, $requiredFields);
 
 2286            case 'mail_linebreak':
 
 2287            case 'hits_per_page':
 
 2288                if (!is_numeric($value) || $value < 0) {
 
 2289                    $this->
logFailure(
"---", 
"Wrong value '{$this->stripTags($value)}': Positiv numeric value expected for preference {$this->stripTags($key)}.");
 
 2295            case 'ilPageEditor_HTMLMode':
 
 2296            case 'ilPageEditor_JavaScript':
 
 2297            case 'ilPageEditor_MediaMode':
 
 2298            case 'tst_javascript':
 
 2299            case 'tst_lastquestiontype':
 
 2300            case 'tst_multiline_answers':
 
 2301            case 'tst_use_previous_answers':
 
 2302            case 'graphicalAnswerSetting':
 
 2303            case 'priv_feed_pass':
 
 2304                $this->
logFailure(
"---", 
"Preference {$this->stripTags($key)} is not supported.");
 
 2307            case 'public_country':
 
 2308            case 'public_department':
 
 2309            case 'public_email':
 
 2310            case 'public_second_email':
 
 2312            case 'public_hobby':
 
 2313            case 'public_institution':
 
 2314            case 'public_matriculation':
 
 2315            case 'public_phone':
 
 2316            case 'public_phone_home':
 
 2317            case 'public_phone_mobile':
 
 2318            case 'public_phone_office':
 
 2319            case 'public_street':
 
 2320            case 'public_upload':
 
 2322            case 'public_interests_general':
 
 2323            case 'public_interests_help_offered':
 
 2324            case 'public_interests_help_looking':
 
 2325            case 'send_info_mails':
 
 2326            case 'hide_own_online_status':
 
 2327                if (!in_array($value, array(
'y', 
'n'))) {
 
 2328                    $this->
logFailure(
"---", 
"Wrong value '{$this->stripTags($value)}': Value 'y' or 'n' expected for preference {$this->stripTags($key)}.");
 
 2331            case 'bs_allow_to_contact_me':
 
 2332                if (!in_array($value, array(
'y', 
'n'))) {
 
 2333                    $this->
logFailure(
"---", 
"Wrong value '{$this->stripTags($value)}': Value 'y' or 'n' expected for preference {$this->stripTags($key)}.");
 
 2336            case 'chat_osc_accept_msg':
 
 2337                if (!in_array($value, array(
'y', 
'n'))) {
 
 2338                    $this->
logFailure(
"---", 
"Wrong value '{$this->stripTags($value)}': Value 'y' or 'n' expected for preference {$this->stripTags($key)}.");
 
 2341            case 'public_profile':
 
 2342                if (!in_array($value, array(
'y', 
'n', 
'g'))) {
 
 2343                    $this->
logFailure(
"---", 
"Wrong value '{$this->stripTags($value)}': Value 'y', 'g' or 'n' expected for preference {$this->stripTags($key)}.");
 
 2346            case 'show_users_online':
 
 2347                if (!in_array($value, array(
'y', 
'n', 
'associated'))) {
 
 2348                    $this->
logFailure(
"---", 
"Wrong value '{$this->stripTags($value)}': Value 'y' or 'n' or 'associated' expected for preference {$this->stripTags($key)}.");
 
 2351            case 'mail_incoming_type':
 
 2352                if (!in_array((
int) $value, array(
"0",
"1",
"2"))) {
 
 2353                    $this->
logFailure(
"---", 
"Wrong value '{$this->stripTags($value)}': Value \"0\" (LOCAL),\"1\" (EMAIL) or \"2\" (BOTH) expected for preference {$this->stripTags($key)}.");
 
 2357                if (!in_array($value, array(
"0",
"1"))) {
 
 2358                    $this->
logFailure(
"---", 
"Wrong value '{$this->stripTags($value)}': Value \"0\" (Sunday) or \"1\" (Monday) expected for preference {$this->stripTags($key)}.");
 
 2362            case 'mail_signature':
 
 2365                include_once(
'Services/Calendar/classes/class.ilTimeZone.php');
 
 2370                    $this->
logFailure(
"---", 
"Wrong value '{$this->stripTags($value)}': Invalid timezone $value detected for preference {$this->stripTags($key)}.");
 
 2375                    $this->
logFailure(
"---", 
"Preference {$this->stripTags($key)} is not supported.");
 
 2383        if (array_key_exists(
"mail_incoming_type", $this->prefs) ||
 
 2384            array_key_exists(
"mail_signature", $this->prefs) ||
 
 2385            array_key_exists(
"mail_linebreak", $this->prefs)
 
 2387            include_once(
"Services/Mail/classes/class.ilMailOptions.php");
 
 2390            $mailOptions->setLinebreak(array_key_exists(
"mail_linebreak", $this->prefs) ? $this->prefs[
"mail_linebreak"] : $mailOptions->getLinebreak());
 
 2391            $mailOptions->setSignature(array_key_exists(
"mail_signature", $this->prefs) ? $this->prefs[
"mail_signature"] : $mailOptions->getSignature());
 
 2392            $mailOptions->setIncomingType(array_key_exists(
"mail_incoming_type", $this->prefs) ? $this->prefs[
"mail_incoming_type"] : $mailOptions->getIncomingType());
 
 2393            $mailOptions->updateOptions();
 
 2404        return strip_tags($string);
 
foreach($mandatory_scripts as $file) $timestamp
An exception for terminatinating execution or to throw for unit testing.
const IL_FAIL_ON_CONFLICT
const IL_UPDATE_ON_CONFLICT
const IL_USER_MAPPING_LOGIN
const IL_IGNORE_ON_CONFLICT
static _getAuthModeName($a_auth_key)
static _getInstanceByObjId($a_obj_id)
Get singleton instance.
@classDescription Date and time handling
static _getActiveServerList()
Get active server list.
Class ilMailOptions this class handles user mails.
static _getUsedHTMLTags($a_module="")
Returns an array of all allowed HTML tags for text editing.
static _lookupLogin($a_user_id)
lookup login
static _checkExternalAuthAccount($a_auth, $a_account, $tryFallback=true)
check whether external account and authentication method matches with a user
static getUserIdByLogin($a_login)
static _uploadPersonalPicture($tmp_file, $obj_id)
Create a personal picture image file from a temporary image file.
static _lookupExternalAccount($a_user_id)
lookup external account for login and authmethod
static _lookupId($a_user_str)
Lookup id by login.
static _lookupTitle($a_id)
lookup object title
static _getAllReferences($a_id)
get all reference ids of object
static _lookupType($a_id, $a_reference=false)
lookup object type
Recommended content manager (business logic)
static getActiveIdpList()
Base class for sax-based expat parsing extended classes need to overwrite the method setHandlers and ...
static _lookupActivatedStyle($a_skin, $a_style)
lookup if a style is activated
special template class to simplify handling of ITX/PEAR
Class for TimeZone exceptions.
static _getInstance($a_tz='')
get instance by timezone
static _getInstance()
Get instance.
Class for user related exception handling in ILIAS.
$action
The Action attribute determines what to do for the current User element.
getUserCount()
get count of User elements
isFieldRequired($fieldname)
determine if a field $fieldname is to a required field (global setting)
getCollectedRoles()
get collected roles
handlerBeginTag($a_xml_parser, $a_name, $a_attribs)
handler for begin of element
$userCount
The count of user elements in the XML file.
$personalPicture
Cached personal picture of the actual user This is used because the ilObjUser object has no field for...
logWarning($aLogin, $aMessage)
Writes a warning log message to the protocol.
$parentRolesCache
Cached parent roles.
extractRolesEndTag($a_xml_parser, $a_name)
handler for end of element when in extract roles mode.
logFailure($aLogin, $aMessage)
Writes a failure log message to the protocol.
$disableSkin
Indicates if the skins are enabled.
setUserMappingMode($value)
write access to user mapping mode
logSuccess($aLogin, $userid, $action)
Writes a success log message to the protocol.
setHandlers($a_xml_parser)
set event handler should be overwritten by inherited class @access private
startParsing()
start the parser
assignToRoleWithParents($a_user_obj, $a_role_id)
Assigns a user to a role and to all parent roles.
$conflict_rule
Conflict handling rule.
updateMailPreferences($usr_id)
saveTempImage($image_data, $filename)
Saves binary image data to a temporary image file and returns the name of the image file on success.
importEndTag($a_xml_parser, $a_name)
handler for end of element when in import user mode.
verifyBeginTag($a_xml_parser, $a_name, $a_attribs)
handler for begin of element
$protocol
The variable holds the protocol of the import.
isSuccess()
Returns true, if the import was successful.
$currActive
The active state of the current user.
importBeginTag($a_xml_parser, $a_name, $a_attribs)
handler for begin of element in user import mode
$updateLookAndSkin
boolean to determine if look and skin should be updated
$localRoleCache
Cached local roles.
verifyEndTag($a_xml_parser, $a_name)
handler for end of element when in verify mode.
getParentRoleIds($a_role_id)
Get array of parent role ids from cache.
setRoleAssignment($a_assign)
set import to local role assignemt
getProtocolAsHTML($a_log_title)
Returns the protocol as a HTML table.
__construct($a_xml_file='', $a_mode=IL_USER_IMPORT, $a_conflict_rule=IL_FAIL_ON_CONFLICT)
Constructor.
$error_level
This variable is used to report the error level of the validation process or the importing process.
$currPassword
The password of the current user.
$currPasswordType
The password type of the current user.
assignToRole($a_user_obj, $a_role_id)
Assigns a user to a role.
getUserMappingMode()
read access to user mapping mode
sendAccountMail()
send account mail
isSendMail()
read access to property send mail
getErrorLevel()
Returns the error level.
checkProfileIncomplete($user_obj)
Check if profile is incomplete Will set the usr_data field profile_incomplete if any required field i...
handlerCharacterData($a_xml_parser, $a_data)
handler for character data
buildTag($type, $name, $attr="")
generate a tag with given name and attributes
handlerEndTag($a_xml_parser, $a_name)
handler for end of element
stripTags(string $string)
getRoleObject($a_role_id)
Returns the parent object of the role folder object which contains the specified role.
getProtocol()
Returns the protocol.
readRequiredFields()
read required fields
getUserMapping()
returns a map user_id <=> login
$logins
This variable is used to collect each login that we encounter in the import data.
$recommended_content_manager
getCourseMembersObjectForRole($a_role_id)
Returns the parent object of the role folder object which contains the specified role.
extractRolesBeginTag($a_xml_parser, $a_name, $a_attribs)
handler for begin of element in extract roles mode
detachFromRole($a_user_obj, $a_role_id)
Detachs a user from a role.
$hideSkin
Indicates if the skins are hidden.
setSendMail($value)
write access to property send mail
$userStyles
User assigned styles.
setFolderId($a_folder_id)
assign users to this folder (normally the usr_folder) But if called from local admin => the ref_id of...
static isProfileIncomplete($a_user, $a_include_udf=true, $a_personal_data_only=true)
Check if all required personal data fields are set.
User settings configuration (what preferences can be visible/changed/...)
static isPrefExportable($key)
returns wether a key from db is exportable or not
static ilTempnam($a_temp_path=null)
Returns a unique and non existing Path for e temporary file or directory.
static __extractId($ilias_id, $inst_id)
extract ref id from role title, e.g.
const SYSTEM_USER_ID
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc