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');
 
  286        $this->roles = array();
 
  287        $this->mode = $a_mode;
 
  288        $this->conflict_rule = $a_conflict_rule;
 
  290        $this->protocol = array();
 
  291        $this->logins = array();
 
  292        $this->userCount = 0;
 
  293        $this->localRoleCache = array();
 
  294        $this->parentRolesCache = array();
 
  295        $this->send_mail = 
false;
 
  299        $this->userStyles = array();
 
  300        include_once 
'./Services/Style/System/classes/class.ilStyleDefinition.php';
 
  301        $skins = ilStyleDefinition::getAllSkins();
 
  303        if (is_array($skins)) {
 
  304            foreach ($skins as 
$skin) {
 
  306                    include_once(
"./Services/Style/System/classes/class.ilSystemStyleSettings.php");
 
  310                    $this->userStyles [] = 
$skin->getId() . 
":" . 
$style->getId();
 
  315        $settings = 
$ilias->getAllSettings();
 
  316        if ($settings[
"usr_settings_hide_skin_style"] == 1) {
 
  317            $this->hideSkin = 
true;
 
  319            $this->hideSkin = 
false;
 
  321        if ($settings[
"usr_settings_disable_skin_style"] == 1) {
 
  322            $this->disableSkin = 
true;
 
  324            $this->disableSkin = 
false;
 
  327        include_once(
"Services/Mail/classes/class.ilAccountMail.php");
 
  329        $this->acc_mail->useLangVariablesAsFallback(
true);
 
  331        parent::__construct($a_xml_file);
 
  341        $this->folder_id = $a_folder_id;
 
  356        xml_set_object($a_xml_parser, $this);
 
  357        xml_set_element_handler($a_xml_parser, 
'handlerBeginTag', 
'handlerEndTag');
 
  358        xml_set_character_data_handler($a_xml_parser, 
'handlerCharacterData');
 
  366        parent::startParsing();
 
  376        $this->role_assign = $a_assign;
 
  390        if (
$type == 
"end") {
 
  396        if (is_array($attr)) {
 
  397            foreach ($attr as $k => $v) {
 
  398                $tag .= 
" " . $k . 
"=\"$v\"";
 
  412        switch ($this->mode) {
 
  435                $this->current_role_id = $a_attribs[
"Id"];
 
  437                    $this->current_role_id = $internal_id;
 
  439                $this->current_role_type = $a_attribs[
"Type"];
 
  453                $this->current_role_id = $a_attribs[
"Id"];
 
  455                    $this->current_role_id = $internal_id;
 
  457                $this->current_role_type = $a_attribs[
"Type"];
 
  458                $this->current_role_action = (is_null($a_attribs[
"Action"])) ? 
"Assign" : $a_attribs[
"Action"];
 
  461            case "PersonalPicture":
 
  462                $this->personalPicture = array(
 
  463                    "encoding" => $a_attribs[
"encoding"],
 
  464                    "imagetype" => $a_attribs[
"imagetype"],
 
  470                $this->skin = $a_attribs[
"Skin"];
 
  471                $this->style = $a_attribs[
"Style"];
 
  475                $this->acc_mail->reset();
 
  476                $this->prefs = array();
 
  477                $this->currentPrefKey = 
null;
 
  478                $this->auth_mode_set = 
false;
 
  479                $this->approve_date_set = 
false;
 
  480                $this->time_limit_set = 
false;
 
  481                $this->time_limit_owner_set = 
false;
 
  482                $this->updateLookAndSkin = 
false;
 
  485                $this->personalPicture = 
null;
 
  490                $this->udf_data = array();
 
  495                    if (is_numeric($a_attribs[
"Id"])) {
 
  496                        $this->user_id = $a_attribs[
"Id"];
 
  498                        $this->user_id = 
$id;
 
  502                $this->userObj->setPref(
 
  504                    $ilias->ini->readVariable(
"layout", 
"skin")
 
  506                $this->userObj->setPref(
 
  508                    $ilias->ini->readVariable(
"layout", 
"style")
 
  511                $this->userObj->setLanguage($a_attribs[
"Language"]);
 
  512                $this->userObj->setImportId($a_attribs[
"Id"]);
 
  513                $this->action = (is_null($a_attribs[
"Action"])) ? 
"Insert" : $a_attribs[
"Action"];
 
  514                $this->currPassword     = 
null;
 
  515                $this->currPasswordType = 
null;
 
  516                $this->currActive = 
null;
 
  517                $this->multi_values = array();
 
  521                $this->currPasswordType = $a_attribs[
'Type'];
 
  524                if (array_key_exists(
"type", $a_attribs)) {
 
  525                    switch ($a_attribs[
"type"]) {
 
  528                            if (strcmp(
'saml', $a_attribs[
'type']) === 0) {
 
  529                                require_once 
'./Services/Saml/classes/class.ilSamlIdp.php';
 
  531                                if (count(
$list) == 1) {
 
  532                                    $this->auth_mode_set = 
true;
 
  533                                    $ldap_id = current(
$list);
 
  534                                    $this->userObj->setAuthMode(
'saml_' . $ldap_id);
 
  538                            if (strcmp(
'ldap', $a_attribs[
'type']) === 0) {
 
  540                                include_once 
'./Services/LDAP/classes/class.ilLDAPServer.php';
 
  542                                if (count(
$list) == 1) {
 
  543                                    $this->auth_mode_set = 
true;
 
  544                                    $ldap_id = current(
$list);
 
  545                                    $this->userObj->setAuthMode(
'ldap_' . $ldap_id);
 
  560                            $this->auth_mode_set = 
true;
 
  561                            $this->userObj->setAuthMode($a_attribs[
"type"]);
 
  572                        $this->userObj->getLogin(),
 
  573                        sprintf(
$lng->txt(
"usrimport_xml_element_inapplicable"), 
"AuthMode", $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"];
 
  605                if (is_null($a_attribs[
'Id'])
 
  606                || $a_attribs[
'Id'] == 
"") {
 
  607                    $this->
logFailure($this->userObj->getLogin(), 
sprintf(
$lng->txt(
"usrimport_xml_attribute_missing"), 
"Role", 
"Id"));
 
  609                $this->current_role_id = $a_attribs[
"Id"];
 
  610                $this->current_role_type = $a_attribs[
"Type"];
 
  611                if ($this->current_role_type != 
'Global' 
  612                && $this->current_role_type != 
'Local') {
 
  613                    $this->
logFailure($this->userObj->getLogin(), 
sprintf(
$lng->txt(
"usrimport_xml_attribute_missing"), 
"Role", 
"Type"));
 
  615                $this->current_role_action = (is_null($a_attribs[
"Action"])) ? 
"Assign" : $a_attribs[
"Action"];
 
  616                if ($this->current_role_action != 
"Assign" 
  617                && $this->current_role_action != 
"AssignWithParents" 
  618                && $this->current_role_action != 
"Detach") {
 
  619                    $this->
logFailure($this->userObj->getLogin(), 
sprintf(
$lng->txt(
"usrimport_xml_attribute_value_illegal"), 
"Role", 
"Action", $a_attribs[
"Action"]));
 
  621                if ($this->action == 
"Insert" 
  622                && $this->current_role_action == 
"Detach") {
 
  623                    $this->
logFailure($this->userObj->getLogin(), 
sprintf(
$lng->txt(
"usrimport_xml_attribute_value_inapplicable"), 
"Role", 
"Action", $this->current_role_action, $this->action));
 
  625                if ($this->action == 
"Delete") {
 
  626                    $this->
logFailure($this->userObj->getLogin(), 
sprintf(
$lng->txt(
"usrimport_xml_element_inapplicable"), 
"Role", 
"Delete"));
 
  633                $this->userObj->setLanguage($a_attribs[
"Language"]);
 
  634                $this->userObj->setImportId($a_attribs[
"Id"]);
 
  635                $this->currentPrefKey = 
null;
 
  640                    if (is_numeric($a_attribs[
"Id"])) {
 
  641                        $this->user_id = $a_attribs[
"Id"];
 
  643                        $this->user_id = 
$id;
 
  647                $this->action = (is_null($a_attribs[
"Action"])) ? 
"Insert" : $a_attribs[
"Action"];
 
  648                if ($this->action != 
"Insert" 
  649                && $this->action != 
"Update" 
  650                && $this->action != 
"Delete") {
 
  651                    $this->
logFailure($this->userObj->getImportId(), 
sprintf(
$lng->txt(
"usrimport_xml_attribute_value_illegal"), 
"User", 
"Action", $a_attribs[
"Action"]));
 
  653                $this->currPassword     = 
null;
 
  654                $this->currPasswordType = 
null;
 
  658                $this->currPasswordType = $a_attribs[
'Type'];
 
  661                if (array_key_exists(
"type", $a_attribs)) {
 
  662                    switch ($a_attribs[
"type"]) {
 
  665                            if (strcmp(
'saml', $a_attribs[
'type']) === 0) {
 
  666                                require_once 
'./Services/Saml/classes/class.ilSamlIdp.php';
 
  668                                if (count(
$list) != 1) {
 
  670                                        $this->userObj->getImportId(),
 
  671                                        sprintf(
$lng->txt(
"usrimport_xml_attribute_value_illegal"), 
"AuthMode", 
"type", $a_attribs[
'type'])
 
  676                            if (strcmp(
'ldap', $a_attribs[
'type']) === 0) {
 
  678                                include_once 
'./Services/LDAP/classes/class.ilLDAPServer.php';
 
  680                                if (count(
$list) != 1) {
 
  682                                        $this->userObj->getImportId(),
 
  683                                        sprintf(
$lng->txt(
"usrimport_xml_attribute_value_illegal"), 
"AuthMode", 
"type", $a_attribs[
'type'])
 
  699                            $this->userObj->setAuthMode($a_attribs[
"type"]);
 
  709                    $this->
logFailure($this->userObj->getImportId(), 
sprintf(
$lng->txt(
"usrimport_xml_attribute_value_illegal"), 
"AuthMode", 
"type", 
""));
 
  713                $this->currentPrefKey = $a_attribs[
"key"];
 
  724        switch ($this->mode) {
 
  744                $this->roles[$this->current_role_id][
"name"] = $this->cdata;
 
  745                $this->roles[$this->current_role_id][
"type"] =
 
  746                    $this->current_role_type;
 
  756        if (array_key_exists($a_role_id, $this->localRoleCache)) {
 
  757            return $this->localRoleCache[$a_role_id];
 
  759            $role_obj = 
new ilObjRole($a_role_id, 
false);
 
  761            $this->localRoleCache[$a_role_id] = $role_obj;
 
  770        global $rbacreview, $rbacadmin, $tree;
 
  772        if (array_key_exists($a_role_id . 
'_courseMembersObject', $this->localRoleCache)) {
 
  773            return $this->localRoleCache[$a_role_id . 
'_courseMembersObject'];
 
  775            require_once(
"Modules/Course/classes/class.ilObjCourse.php");
 
  776            require_once(
"Modules/Course/classes/class.ilCourseParticipants.php");
 
  777            $course_refs = $rbacreview->getFoldersAssignedToRole($a_role_id, 
true);
 
  778            $course_ref = $course_refs[0];
 
  781            $this->localRoleCache[$a_role_id . 
'_courseMembersObject'] = $crsmembers_obj;
 
  782            return $crsmembers_obj;
 
  791        require_once 
"./Services/AccessControl/classes/class.ilObjRole.php";
 
  792        include_once(
'./Services/Object/classes/class.ilObject.php');
 
  793        #require_once "Modules/Course/classes/class.ilObjCourse.php";
 
  794        #require_once "Modules/Course/classes/class.ilCourseParticipants.php";
 
  796        global $rbacreview, $rbacadmin, $tree;
 
  802        if ($rbacreview->isAssigned($a_user_obj->getId(), $a_role_id)) {
 
  809        $rbacadmin->assignUser($a_role_id, $a_user_obj->getId(), 
true);
 
  810        $obj_id = $rbacreview->getObjectOfRole($a_role_id);
 
  815                $ref_id = current((array) $ref_ids);
 
  832        if (!array_key_exists($a_role_id, $this->parentRolesCache)) {
 
  833            $parent_role_ids = array();
 
  836            $short_role_title = substr($role_obj->getTitle(), 0, 12);
 
  837            $folders = $rbacreview->getFoldersAssignedToRole($a_role_id, 
true);
 
  838            if (count($folders) > 0) {
 
  839                $all_parent_role_ids = $rbacreview->getParentRoleIds($folders[0]);
 
  840                foreach ($all_parent_role_ids as $parent_role_id => $parent_role_data) {
 
  841                    if ($parent_role_id != $a_role_id) {
 
  842                        switch (substr($parent_role_data[
'title'], 0, 12)) {
 
  845                                if ($short_role_title == 
'il_crs_admin' || $short_role_title == 
'il_grp_admin') {
 
  846                                    $parent_role_ids[] = $parent_role_id;
 
  851                                if ($short_role_title == 
'il_crs_tutor' || $short_role_title == 
'il_grp_tutor') {
 
  852                                    $parent_role_ids[] = $parent_role_id;
 
  857                                if ($short_role_title == 
'il_crs_membe' || $short_role_title == 
'il_grp_membe') {
 
  858                                    $parent_role_ids[] = $parent_role_id;
 
  867            $this->parentRolesCache[$a_role_id] = $parent_role_ids;
 
  869        return $this->parentRolesCache[$a_role_id];
 
  879        foreach ($parent_role_ids as $parent_role_id) {
 
  888        global $rbacreview, $rbacadmin, $tree;
 
  890        $rbacadmin->deassignUser($a_role_id, $a_user_obj->getId());
 
  894            $obj = $rbacreview->getObjectOfRole($a_role_id);
 
  910                $this->roles[$this->current_role_id][
"name"] = $this->cdata;
 
  911                $this->roles[$this->current_role_id][
"type"] = $this->current_role_type;
 
  912                $this->roles[$this->current_role_id][
"action"] = $this->current_role_action;
 
  915            case "PersonalPicture":
 
  916                switch ($this->personalPicture[
"encoding"]) {
 
  918                        $this->personalPicture[
"content"] = base64_decode($this->cdata);
 
  921                        $this->personalPicture[
"content"] = convert_uudecode($this->cdata);
 
  927                $this->userObj->setFullname();
 
  930                if ($this->user_id == -1 || $this->action==
"Insert") {
 
  939                switch ($this->conflict_rule) {
 
  944                        switch ($this->action) {
 
  947                                    $this->
logWarning($this->userObj->getLogin(), 
sprintf(
$lng->txt(
"usrimport_action_replaced"), 
"Insert", 
"Update"));
 
  948                                    $this->action = 
"Update";
 
  953                                    $this->
logWarning($this->userObj->getLogin(), 
sprintf(
$lng->txt(
"usrimport_action_replaced"), 
"Update", 
"Insert"));
 
  954                                    $this->action = 
"Insert";
 
  959                                    $this->
logWarning($this->userObj->getLogin(), 
sprintf(
$lng->txt(
"usrimport_action_ignored"), 
"Delete"));
 
  960                                    $this->action = 
"Ignore";
 
  966                        switch ($this->action) {
 
  969                                    $this->
logWarning($this->userObj->getLogin(), 
sprintf(
$lng->txt(
"usrimport_action_ignored"), 
"Insert"));
 
  970                                    $this->action = 
"Ignore";
 
  975                                    $this->
logWarning($this->userObj->getLogin(), 
sprintf(
$lng->txt(
"usrimport_action_ignored"), 
"Update"));
 
  976                                    $this->action = 
"Ignore";
 
  981                                    $this->
logWarning($this->userObj->getLogin(), 
sprintf(
$lng->txt(
"usrimport_action_ignored"), 
"Delete"));
 
  982                                    $this->action = 
"Ignore";
 
  993                $am = ($this->userObj->getAuthMode() == 
"default" || $this->userObj->getAuthMode() == 
"")
 
  995                    : $this->userObj->getAuthMode();
 
  996                $loginForExternalAccount = ($this->userObj->getExternalAccount() == 
"")
 
  999                switch ($this->action) {
 
 1001                        if ($loginForExternalAccount != 
"") {
 
 1002                            $this->
logWarning($this->userObj->getLogin(), 
$lng->txt(
"usrimport_no_insert_ext_account_exists") . 
" (" . $this->userObj->getExternalAccount() . 
")");
 
 1003                            $this->action = 
"Ignore";
 
 1012                        if ($loginForExternalAccount != 
"") {
 
 1016                            if ($externalAccountHasChanged && trim($loginForExternalAccount) != trim($this->userObj->getLogin())) {
 
 1017                                $this->
logWarning($this->userObj->getLogin(), 
$lng->txt(
"usrimport_no_update_ext_account_exists") . 
" (" . $this->userObj->getExternalAccount() . 
")");
 
 1018                                $this->action = 
"Ignore";
 
 1024                if (
sizeof($this->multi_values)) {
 
 1025                    if (isset($this->multi_values[
"GeneralInterest"])) {
 
 1026                        $this->userObj->setGeneralInterests($this->multi_values[
"GeneralInterest"]);
 
 1028                    if (isset($this->multi_values[
"OfferingHelp"])) {
 
 1029                        $this->userObj->setOfferingHelp($this->multi_values[
"OfferingHelp"]);
 
 1031                    if (isset($this->multi_values[
"LookingForHelp"])) {
 
 1032                        $this->userObj->setLookingForHelp($this->multi_values[
"LookingForHelp"]);
 
 1037                switch ($this->action) {
 
 1040                            $this->
logFailure($this->userObj->getLogin(), 
$lng->txt(
"usrimport_cant_insert"));
 
 1042                            if (!strlen($this->currPassword) == 0) {
 
 1043                                switch (strtoupper($this->currPasswordType)) {
 
 1046                                        $this->userObj->setPasswordEncodingType(
'bcryptphp');
 
 1047                                        $this->userObj->setPasswordSalt(
null);
 
 1052                                        $this->acc_mail->setUserPassword($this->currPassword);
 
 1056                                        $this->
logFailure($this->userObj->getLogin(), 
sprintf(
$lng->txt(
"usrimport_xml_attribute_value_illegal"), 
"Type", 
"Password", $this->currPasswordType));
 
 1068                            $this->userObj->setTitle($this->userObj->getFullname());
 
 1069                            $this->userObj->setDescription($this->userObj->getEmail());
 
 1071                            if (!$this->time_limit_owner_set) {
 
 1072                                $this->userObj->setTimeLimitOwner($this->
getFolderId());
 
 1076                            if (!$this->time_limit_set) {
 
 1077                                $this->userObj->setTimeLimitUnlimited(1);
 
 1078                                $this->userObj->setTimeLimitMessage(0);
 
 1080                                if (!$this->approve_date_set) {
 
 1081                                    $this->userObj->setApproveDate(
date(
"Y-m-d H:i:s"));
 
 1086                            $this->userObj->setActive($this->currActive == 
'true' || is_null($this->currActive));
 
 1092                            if (count($this->udf_data)) {
 
 1093                                $this->userObj->setUserDefinedData($this->udf_data);
 
 1097                            $this->userObj->create();
 
 1100                            $this->userObj->saveAsNew(
false);
 
 1103                            $this->userObj->setPref(
'hits_per_page', 
$ilSetting->get(
'hits_per_page', 30));
 
 1106                            if (count($this->prefs)) {
 
 1107                                foreach ($this->prefs as 
$key => $value) {
 
 1108                                    if (
$key != 
"mail_incoming_type" &&
 
 1109                                        $key != 
"mail_signature" &&
 
 1110                                        $key != 
"mail_linebreak" 
 1112                                        $this->userObj->setPref(
$key, $value);
 
 1117                            if (!is_array($this->prefs) || array_search(
'chat_osc_accept_msg', $this->prefs) === 
false) {
 
 1118                                $this->userObj->setPref(
'chat_osc_accept_msg', 
$ilSetting->get(
'chat_osc_accept_msg', 
'n'));
 
 1120                            if (!is_array($this->prefs) || array_search(
'bs_allow_to_contact_me', $this->prefs) === 
false) {
 
 1121                                $this->userObj->setPref(
'bs_allow_to_contact_me', 
$ilSetting->get(
'bs_allow_to_contact_me', 
'n'));
 
 1124                            $this->userObj->writePrefs();
 
 1129                            if (is_array($this->personalPicture)) {
 
 1130                                if (strlen($this->personalPicture[
"content"])) {
 
 1132                                    if (preg_match(
"/.*(png|jpg|gif|jpeg)$/", $this->personalPicture[
"imagetype"], $matches)) {
 
 1133                                        $extension = $matches[1];
 
 1135                                    $tmp_name = $this->
saveTempImage($this->personalPicture[
"content"], 
".$extension");
 
 1136                                    if (strlen($tmp_name)) {
 
 1144                            foreach ($this->roles as $role_id => $role) {
 
 1145                                if ($this->role_assign[$role_id]) {
 
 1146                                    $this->
assignToRole($this->userObj, $this->role_assign[$role_id]);
 
 1150                            if (count($this->udf_data)) {
 
 1151                                include_once 
'./Services/User/classes/class.ilUserDefinedData.php';
 
 1153                                foreach ($this->udf_data as $field => $value) {
 
 1154                                    $udd->set(
"f_" . $field, $value);
 
 1160                            $this->
logSuccess($this->userObj->getLogin(), $this->userObj->getId(), 
"Insert");
 
 1162                            $this->acc_mail->reset();
 
 1168                            $this->
logFailure($this->userObj->getLogin(), 
$lng->txt(
"usrimport_cant_update"));
 
 1171                            $updateUser->read();
 
 1172                            $updateUser->readPrefs();
 
 1173                            if ($this->currPassword != 
null) {
 
 1174                                switch (strtoupper($this->currPasswordType)) {
 
 1177                                        $updateUser->setPasswordEncodingType(
'bcryptphp');
 
 1178                                        $updateUser->setPasswordSalt(
null);
 
 1183                                        $this->acc_mail->setUserPassword($this->currPassword);
 
 1187                                        $this->
logFailure($this->userObj->getLogin(), 
sprintf(
$lng->txt(
"usrimport_xml_attribute_value_illegal"), 
"Type", 
"Password", $this->currPasswordType));
 
 1191                            if (!is_null($this->userObj->getFirstname())) {
 
 1192                                $updateUser->setFirstname($this->userObj->getFirstname());
 
 1194                            if (!is_null($this->userObj->getLastname())) {
 
 1195                                $updateUser->setLastname($this->userObj->getLastname());
 
 1197                            if (!is_null($this->userObj->getUTitle())) {
 
 1198                                $updateUser->setUTitle($this->userObj->getUTitle());
 
 1200                            if (!is_null($this->userObj->getGender())) {
 
 1201                                $updateUser->setGender($this->userObj->getGender());
 
 1203                            if (!is_null($this->userObj->getEmail())) {
 
 1204                                $updateUser->setEmail($this->userObj->getEmail());
 
 1206                            if (!is_null($this->userObj->getSecondEmail())) {
 
 1207                                $updateUser->setSecondEmail($this->userObj->getSecondEmail());
 
 1209                            if (!is_null($this->userObj->getBirthday())) {
 
 1210                                $updateUser->setBirthday($this->userObj->getBirthday());
 
 1212                            if (!is_null($this->userObj->getInstitution())) {
 
 1213                                $updateUser->setInstitution($this->userObj->getInstitution());
 
 1215                            if (!is_null($this->userObj->getStreet())) {
 
 1216                                $updateUser->setStreet($this->userObj->getStreet());
 
 1218                            if (!is_null($this->userObj->getCity())) {
 
 1219                                $updateUser->setCity($this->userObj->getCity());
 
 1221                            if (!is_null($this->userObj->getZipCode())) {
 
 1222                                $updateUser->setZipCode($this->userObj->getZipCode());
 
 1224                            if (!is_null($this->userObj->getCountry())) {
 
 1225                                $updateUser->setCountry($this->userObj->getCountry());
 
 1227                            if (!is_null($this->userObj->getSelectedCountry())) {
 
 1228                                $updateUser->setSelectedCountry($this->userObj->getSelectedCountry());
 
 1230                            if (!is_null($this->userObj->getPhoneOffice())) {
 
 1231                                $updateUser->setPhoneOffice($this->userObj->getPhoneOffice());
 
 1233                            if (!is_null($this->userObj->getPhoneHome())) {
 
 1234                                $updateUser->setPhoneHome($this->userObj->getPhoneHome());
 
 1236                            if (!is_null($this->userObj->getPhoneMobile())) {
 
 1237                                $updateUser->setPhoneMobile($this->userObj->getPhoneMobile());
 
 1239                            if (!is_null($this->userObj->getFax())) {
 
 1240                                $updateUser->setFax($this->userObj->getFax());
 
 1242                            if (!is_null($this->userObj->getHobby())) {
 
 1243                                $updateUser->setHobby($this->userObj->getHobby());
 
 1245                            if (!is_null($this->userObj->getGeneralInterests())) {
 
 1246                                $updateUser->setGeneralInterests($this->userObj->getGeneralInterests());
 
 1248                            if (!is_null($this->userObj->getOfferingHelp())) {
 
 1249                                $updateUser->setOfferingHelp($this->userObj->getOfferingHelp());
 
 1251                            if (!is_null($this->userObj->getLookingForHelp())) {
 
 1252                                $updateUser->setLookingForHelp($this->userObj->getLookingForHelp());
 
 1254                            if (!is_null($this->userObj->getComment())) {
 
 1255                                $updateUser->setComment($this->userObj->getComment());
 
 1257                            if (!is_null($this->userObj->getDepartment())) {
 
 1258                                $updateUser->setDepartment($this->userObj->getDepartment());
 
 1260                            if (!is_null($this->userObj->getMatriculation())) {
 
 1261                                $updateUser->setMatriculation($this->userObj->getMatriculation());
 
 1263                            if (!is_null($this->currActive)) {
 
 1264                                $updateUser->setActive($this->currActive == 
"true", is_object(
$ilUser) ? 
$ilUser->getId() : 0);
 
 1266                            if (!is_null($this->userObj->getClientIP())) {
 
 1267                                $updateUser->setClientIP($this->userObj->getClientIP());
 
 1269                            if (!is_null($this->userObj->getTimeLimitUnlimited())) {
 
 1270                                $updateUser->setTimeLimitUnlimited($this->userObj->getTimeLimitUnlimited());
 
 1272                            if (!is_null($this->userObj->getTimeLimitFrom())) {
 
 1273                                $updateUser->setTimeLimitFrom($this->userObj->getTimeLimitFrom());
 
 1275                            if (!is_null($this->userObj->getTimeLimitUntil())) {
 
 1276                                $updateUser->setTimeLimitUntil($this->userObj->getTimeLimitUntil());
 
 1278                            if (!is_null($this->userObj->getTimeLimitMessage())) {
 
 1279                                $updateUser->setTimeLimitMessage($this->userObj->getTimeLimitMessage());
 
 1281                            if (!is_null($this->userObj->getApproveDate())) {
 
 1282                                $updateUser->setApproveDate($this->userObj->getApproveDate());
 
 1284                            if (!is_null($this->userObj->getAgreeDate())) {
 
 1285                                $updateUser->setAgreeDate($this->userObj->getAgreeDate());
 
 1287                            if (!is_null($this->userObj->getLanguage())) {
 
 1288                                $updateUser->setLanguage($this->userObj->getLanguage());
 
 1290                            if (!is_null($this->userObj->getExternalAccount())) {
 
 1291                                $updateUser->setExternalAccount($this->userObj->getExternalAccount());
 
 1295                            #if (! is_null($this->userObj->getAuthMode())) $updateUser->setAuthMode($this->userObj->getAuthMode()); 
 1296                            if ($this->auth_mode_set) {
 
 1297                                $updateUser->setAuthMode($this->userObj->getAuthMode());
 
 1301                            if ($this->time_limit_owner_set) {
 
 1302                                $updateUser->setTimeLimitOwner($this->userObj->getTimeLimitOwner());
 
 1306                            if (count($this->prefs)) {
 
 1307                                foreach ($this->prefs as 
$key => $value) {
 
 1308                                    if (
$key != 
"mail_incoming_type" &&
 
 1309                                        $key != 
"mail_signature" &&
 
 1310                                        $key != 
"mail_linebreak" 
 1312                                        $updateUser->setPref(
$key, $value);
 
 1318                            if ($this->updateLookAndSkin) {
 
 1319                                $updateUser->setPref(
"skin", $this->userObj->getPref(
"skin"));
 
 1320                                $updateUser->setPref(
"style", $this->userObj->getPref(
"style"));
 
 1324                            $updateUser->writePrefs();
 
 1330                            if (count($this->udf_data)) {
 
 1331                                $updateUser->setUserDefinedData($this->udf_data);
 
 1335                            $updateUser->setFullname();
 
 1336                            $updateUser->setTitle($updateUser->getFullname());
 
 1337                            $updateUser->setDescription($updateUser->getEmail());
 
 1338                            $updateUser->update();
 
 1340                            if (count($this->udf_data)) {
 
 1341                                include_once 
'./Services/User/classes/class.ilUserDefinedData.php';
 
 1343                                foreach ($this->udf_data as $field => $value) {
 
 1344                                    $udd->set(
"f_" . $field, $value);
 
 1350                            if (!is_null($this->userObj->getLogin()) && $this->user_id != -1) {
 
 1352                                    $updateUser->updateLogin($this->userObj->getLogin());
 
 1360                            if (is_array($this->personalPicture)) {
 
 1361                                if (strlen($this->personalPicture[
"content"])) {
 
 1363                                    if (preg_match(
"/.*(png|jpg|gif|jpeg)$/", $this->personalPicture[
"imagetype"], $matches)) {
 
 1364                                        $extension = $matches[1];
 
 1366                                    $tmp_name = $this->
saveTempImage($this->personalPicture[
"content"], 
".$extension");
 
 1367                                    if (strlen($tmp_name)) {
 
 1377                            foreach ($this->roles as $role_id => $role) {
 
 1378                                if ($this->role_assign[$role_id]) {
 
 1379                                    switch ($role[
"action"]) {
 
 1381                                            $this->
assignToRole($updateUser, $this->role_assign[$role_id]);
 
 1383                                        case "AssignWithParents":
 
 1387                                            $this->
detachFromRole($updateUser, $this->role_assign[$role_id]);
 
 1397                            $this->
logFailure($this->userObj->getLogin(), 
$lng->txt(
"usrimport_cant_delete"));
 
 1400                            $deleteUser->delete();
 
 1408                $this->roles = array();
 
 1412                $this->userObj->setLogin($this->cdata);
 
 1416                $this->currPassword = $this->cdata;
 
 1420                $this->userObj->setFirstname($this->cdata);
 
 1424                $this->userObj->setLastname($this->cdata);
 
 1428                $this->userObj->setUTitle($this->cdata);
 
 1432                $this->userObj->setGender($this->cdata);
 
 1436                $this->userObj->setEmail($this->cdata);
 
 1439                $this->userObj->setSecondEmail($this->cdata);
 
 1444                    $this->userObj->setBirthday($this->cdata);
 
 1448                $this->userObj->setInstitution($this->cdata);
 
 1452                $this->userObj->setStreet($this->cdata);
 
 1456                $this->userObj->setCity($this->cdata);
 
 1460                $this->userObj->setZipCode($this->cdata);
 
 1464                $this->userObj->setCountry($this->cdata);
 
 1468                $this->userObj->setSelectedCountry($this->cdata);
 
 1472                $this->userObj->setPhoneOffice($this->cdata);
 
 1476                $this->userObj->setPhoneHome($this->cdata);
 
 1480                $this->userObj->setPhoneMobile($this->cdata);
 
 1484                $this->userObj->setFax($this->cdata);
 
 1488                $this->userObj->setHobby($this->cdata);
 
 1491            case "GeneralInterest":
 
 1492            case "OfferingHelp":
 
 1493            case "LookingForHelp":
 
 1494                $this->multi_values[$a_name][] = $this->cdata;
 
 1498                $this->userObj->setComment($this->cdata);
 
 1502                $this->userObj->setDepartment($this->cdata);
 
 1505            case "Matriculation":
 
 1506                $this->userObj->setMatriculation($this->cdata);
 
 1510                $this->currActive = $this->cdata;
 
 1514                $this->userObj->setClientIP($this->cdata);
 
 1517            case "TimeLimitOwner":
 
 1518                $this->time_limit_owner_set = 
true;
 
 1519                $this->userObj->setTimeLimitOwner($this->cdata);
 
 1522            case "TimeLimitUnlimited":
 
 1523                $this->time_limit_set = 
true;
 
 1524                $this->userObj->setTimeLimitUnlimited($this->cdata);
 
 1527            case "TimeLimitFrom":
 
 1528                if (is_numeric($this->cdata)) {
 
 1530                    $this->userObj->setTimeLimitFrom($this->cdata);
 
 1534                    if (
$timestamp !== 
false && trim($this->cdata) != 
"0000-00-00 00:00:00") {
 
 1535                        $this->userObj->setTimeLimitFrom(
$timestamp);
 
 1536                    } elseif ($this->cdata == 
"0000-00-00 00:00:00") {
 
 1537                        $this->userObj->setTimeLimitFrom(
null);
 
 1542            case "TimeLimitUntil":
 
 1543                if (is_numeric($this->cdata)) {
 
 1545                    $this->userObj->setTimeLimitUntil($this->cdata);
 
 1549                    if (
$timestamp !== 
false && trim($this->cdata) != 
"0000-00-00 00:00:00") {
 
 1550                        $this->userObj->setTimeLimitUntil(
$timestamp);
 
 1551                    } elseif ($this->cdata == 
"0000-00-00 00:00:00") {
 
 1552                        $this->userObj->setTimeLimitUntil(
null);
 
 1557            case "TimeLimitMessage":
 
 1558                $this->userObj->setTimeLimitMessage($this->cdata);
 
 1562                $this->approve_date_set = 
true;
 
 1563                if (is_numeric($this->cdata)) {
 
 1570                    if (
$timestamp !== 
false && trim($this->cdata) != 
"0000-00-00 00:00:00") {
 
 1573                    } elseif ($this->cdata == 
"0000-00-00 00:00:00") {
 
 1574                        $this->userObj->setApproveDate(
null);
 
 1580                if (is_numeric($this->cdata)) {
 
 1587                    if (
$timestamp !== 
false && trim($this->cdata) != 
"0000-00-00 00:00:00") {
 
 1590                    } elseif ($this->cdata == 
"0000-00-00 00:00:00") {
 
 1591                        $this->userObj->setAgreeDate(
null);
 
 1596            case "ExternalAccount":
 
 1597                $this->userObj->setExternalAccount($this->cdata);
 
 1601                $this->updateLookAndSkin = 
false;
 
 1602                if (!$this->hideSkin) {
 
 1604                    if ((strlen($this->skin) > 0) && (strlen($this->style) > 0)) {
 
 1605                        if (is_array($this->userStyles)) {
 
 1606                            if (in_array($this->skin . 
":" . $this->style, $this->userStyles)) {
 
 1607                                $this->userObj->setPref(
"skin", $this->skin);
 
 1608                                $this->userObj->setPref(
"style", $this->style);
 
 1609                                $this->updateLookAndSkin = 
true;
 
 1616            case 'UserDefinedField':
 
 1617                include_once 
'./Services/User/classes/class.ilUserDefinedFields.php';
 
 1619                if ($field_id = $udf->fetchFieldIdFromImportId($this->tmp_udf_id)) {
 
 1620                    $this->udf_data[$field_id] = $this->cdata;
 
 1621                } elseif ($field_id = $udf->fetchFieldIdFromName($this->tmp_udf_name)) {
 
 1622                    $this->udf_data[$field_id] = $this->cdata;
 
 1626                if ($this->current_messenger_type ==
"external") {
 
 1627                    $this->userObj->setExternalAccount($this->cdata);
 
 1631                if ($this->currentPrefKey != 
null && strlen(trim($this->cdata)) > 0
 
 1633                    $this->prefs[$this->currentPrefKey] = trim($this->cdata);
 
 1635                $this->currentPrefKey = 
null;
 
 1647        $fh = fopen($tempname, 
"wb");
 
 1651        $imagefile = fwrite(
$fh, $image_data);
 
 1665                $this->roles[$this->current_role_id][
"name"] = $this->cdata;
 
 1666                $this->roles[$this->current_role_id][
"type"] = $this->current_role_type;
 
 1667                $this->roles[$this->current_role_id][
"action"] = $this->current_role_action;
 
 1671                $this->userObj->setFullname();
 
 1672                if ($this->user_id != -1 && ($this->action == 
"Update" || $this->action == 
"Delete")) {
 
 1678                if (is_null($this->userObj->getLogin())) {
 
 1679                    $this->
logFailure(
"---", 
sprintf($lng->txt(
"usrimport_xml_element_for_action_required"), 
"Login", 
"Insert"));
 
 1682                switch ($this->action) {
 
 1685                            $this->
logWarning($this->userObj->getLogin(), 
$lng->txt(
"usrimport_cant_insert"));
 
 1687                        if (is_null($this->userObj->getGender()) && $this->isFieldRequired(
"gender")) {
 
 1688                            $this->
logFailure($this->userObj->getLogin(), 
sprintf(
$lng->txt(
"usrimport_xml_element_for_action_required"), 
"Gender", 
"Insert"));
 
 1690                        if (is_null($this->userObj->getFirstname())) {
 
 1691                            $this->
logFailure($this->userObj->getLogin(), 
sprintf(
$lng->txt(
"usrimport_xml_element_for_action_required"), 
"Firstname", 
"Insert"));
 
 1693                        if (is_null($this->userObj->getLastname())) {
 
 1694                            $this->
logFailure($this->userObj->getLogin(), 
sprintf(
$lng->txt(
"usrimport_xml_element_for_action_required"), 
"Lastname", 
"Insert"));
 
 1696                        if (count($this->roles) == 0) {
 
 1697                            $this->
logFailure($this->userObj->getLogin(), 
sprintf(
$lng->txt(
"usrimport_xml_element_for_action_required"), 
"Role", 
"Insert"));
 
 1699                            $has_global_role = 
false;
 
 1700                            foreach ($this->roles as $role) {
 
 1701                                if ($role[
'type'] == 
'Global') {
 
 1702                                    $has_global_role = 
true;
 
 1706                            if (!$has_global_role) {
 
 1707                                $this->
logFailure($this->userObj->getLogin(), 
sprintf(
$lng->txt(
"usrimport_global_role_for_action_required"), 
"Insert"));
 
 1712                        if (!$user_exists) {
 
 1713                            $this->
logWarning($this->userObj->getLogin(), 
$lng->txt(
"usrimport_cant_update"));
 
 1714                        } elseif ($this->user_id != -1 && !is_null($this->userObj->getLogin())) {
 
 1718                            if (is_numeric($someonesId) && $someonesId != $this->user_id) {
 
 1719                                $this->
logFailure($this->userObj->getLogin(), 
$lng->txt(
"usrimport_login_is_not_unique"));
 
 1724                        if (!$user_exists) {
 
 1725                            $this->
logWarning($this->userObj->getLogin(), 
$lng->txt(
"usrimport_cant_delete"));
 
 1731                $this->roles = array();
 
 1735                if (array_key_exists($this->cdata, $this->logins)) {
 
 1736                    $this->
logWarning($this->cdata, 
$lng->txt(
"usrimport_login_is_not_unique"));
 
 1738                    $this->logins[$this->cdata] = $this->cdata;
 
 1740                $this->userObj->setLogin($this->cdata);
 
 1744                switch ($this->currPasswordType) {
 
 1747                        $this->userObj->setPasswordEncodingType(
'bcryptphp');
 
 1748                        $this->userObj->setPasswordSalt(
null);
 
 1753                        $this->acc_mail->setUserPassword($this->currPassword);
 
 1757                        $this->
logFailure($this->userObj->getLogin(), 
sprintf(
$lng->txt(
"usrimport_xml_attribute_value_illegal"), 
"Type", 
"Password", $this->currPasswordType));
 
 1763                $this->userObj->setFirstname($this->cdata);
 
 1767                $this->userObj->setLastname($this->cdata);
 
 1771                $this->userObj->setUTitle($this->cdata);
 
 1775                if (!in_array(strtolower($this->cdata), [
'n', 
'm', 
'f'])) {
 
 1777                        $this->userObj->getLogin(),
 
 1778                        sprintf(
$lng->txt(
"usrimport_xml_element_content_illegal"), 
"Gender", $this->cdata)
 
 1781                $this->userObj->setGender($this->cdata);
 
 1785                $this->userObj->setEmail($this->cdata);
 
 1788                $this->userObj->setSecondEmail($this->cdata);
 
 1791                $this->userObj->setInstitution($this->cdata);
 
 1795                $this->userObj->setStreet($this->cdata);
 
 1799                $this->userObj->setCity($this->cdata);
 
 1803                $this->userObj->setZipCode($this->cdata);
 
 1807                $this->userObj->setCountry($this->cdata);
 
 1811                $this->userObj->setSelectedCountry($this->cdata);
 
 1815                $this->userObj->setPhoneOffice($this->cdata);
 
 1819                $this->userObj->setPhoneHome($this->cdata);
 
 1823                $this->userObj->setPhoneMobile($this->cdata);
 
 1827                $this->userObj->setFax($this->cdata);
 
 1831                $this->userObj->setHobby($this->cdata);
 
 1834            case "GeneralInterest":
 
 1835            case "OfferingHelp":
 
 1836            case "LookingForHelp":
 
 1837                $this->multi_values[$a_name][] = $this->cdata;
 
 1841                $this->userObj->setComment($this->cdata);
 
 1845                $this->userObj->setDepartment($this->cdata);
 
 1848            case "Matriculation":
 
 1849                $this->userObj->setMatriculation($this->cdata);
 
 1852            case "ExternalAccount":
 
 1854                $am = ($this->userObj->getAuthMode() == 
"default" || $this->userObj->getAuthMode() == 
"")
 
 1856                    : $this->userObj->getAuthMode();
 
 1857                $loginForExternalAccount = (trim($this->cdata) == 
"")
 
 1860                switch ($this->action) {
 
 1862                        if ($loginForExternalAccount != 
"") {
 
 1863                            $this->
logWarning($this->userObj->getLogin(), 
$lng->txt(
"usrimport_no_insert_ext_account_exists") . 
" (" . $this->cdata . 
")");
 
 1868                        if ($loginForExternalAccount != 
"") {
 
 1870                            if ($externalAccountHasChanged && trim($loginForExternalAccount) != trim($this->userObj->getLogin())) {
 
 1872                                    $this->userObj->getLogin(),
 
 1873                                    $lng->txt(
"usrimport_no_update_ext_account_exists") . 
" (" . $this->cdata . 
" for " . $loginForExternalAccount . 
")" 
 1880                if ($externalAccountHasChanged) {
 
 1881                    $this->userObj->setExternalAccount(trim($this->cdata));
 
 1886                if ($this->cdata != 
"true" 
 1887                && $this->cdata != 
"false") {
 
 1889                        $this->userObj->getLogin(),
 
 1890                        sprintf(
$lng->txt(
"usrimport_xml_element_content_illegal"), 
"Active", $this->cdata)
 
 1893                $this->currActive = $this->cdata;
 
 1895            case "TimeLimitOwner":
 
 1896                if (!preg_match(
"/\d+/", $this->cdata)) {
 
 1898                        $this->userObj->getLogin(),
 
 1899                        sprintf(
$lng->txt(
"usrimport_xml_element_content_illegal"), 
"TimeLimitOwner", $this->cdata)
 
 1901                } elseif (!$ilAccess->checkAccess(
'cat_administrate_users', 
'', $this->cdata)) {
 
 1903                        $this->userObj->getLogin(),
 
 1904                        sprintf(
$lng->txt(
"usrimport_xml_element_content_illegal"), 
"TimeLimitOwner", $this->cdata)
 
 1906                } elseif ($ilObjDataCache->lookupType($ilObjDataCache->lookupObjId($this->cdata)) != 
'cat' && !(
int) $this->cdata == 
USER_FOLDER_ID) {
 
 1908                        $this->userObj->getLogin(),
 
 1909                        sprintf(
$lng->txt(
"usrimport_xml_element_content_illegal"), 
"TimeLimitOwner", $this->cdata)
 
 1912                $this->userObj->setTimeLimitOwner($this->cdata);
 
 1914            case "TimeLimitUnlimited":
 
 1915                switch (strtolower($this->cdata)) {
 
 1918                        $this->userObj->setTimeLimitUnlimited(1);
 
 1922                        $this->userObj->setTimeLimitUnlimited(0);
 
 1925                        $this->
logFailure($this->userObj->getLogin(), 
sprintf(
$lng->txt(
"usrimport_xml_element_content_illegal"), 
"TimeLimitUnlimited", $this->cdata));
 
 1929            case "TimeLimitFrom":
 
 1931                if (strtotime($this->cdata) === 
false && !is_numeric($this->cdata)) {
 
 1932                    $this->
logFailure($this->userObj->getLogin(), 
sprintf(
$lng->txt(
"usrimport_xml_element_content_illegal"), 
"TimeLimitFrom", $this->cdata));
 
 1934                $this->userObj->setTimeLimitFrom($this->cdata);
 
 1936            case "TimeLimitUntil":
 
 1938                if (strtotime($this->cdata) === 
false && !is_numeric($this->cdata)) {
 
 1939                    $this->
logFailure($this->userObj->getLogin(), 
sprintf(
$lng->txt(
"usrimport_xml_element_content_illegal"), 
"TimeLimitUntil", $this->cdata));
 
 1941                $this->userObj->setTimeLimitUntil($this->cdata);
 
 1943            case "TimeLimitMessage":
 
 1944                switch (strtolower($this->cdata)) {
 
 1946                        $this->userObj->setTimeLimitMessage(1);
 
 1949                        $this->userObj->setTimeLimitMessage(0);
 
 1952                        $this->
logFailure($this->userObj->getLogin(), 
sprintf(
$lng->txt(
"usrimport_xml_element_content_illegal"), 
"TimeLimitMessage", $this->cdata));
 
 1958                if (strtotime($this->cdata) === 
false && !is_numeric($this->cdata) && !$this->cdata == 
"0000-00-00 00:00:00") {
 
 1959                    $this->
logFailure($this->userObj->getLogin(), 
sprintf(
$lng->txt(
"usrimport_xml_element_content_illegal"), 
"ApproveDate", $this->cdata));
 
 1964                if (strtotime($this->cdata) === 
false && !is_numeric($this->cdata) && !$this->cdata == 
"0000-00-00 00:00:00") {
 
 1965                    $this->
logFailure($this->userObj->getLogin(), 
sprintf(
$lng->txt(
"usrimport_xml_element_content_illegal"), 
"AgreeDate", $this->cdata));
 
 1969                if ($this->currentPrefKey != 
null) {
 
 1970                    $this->
verifyPref($this->currentPrefKey, $this->cdata);
 
 1972                $this->currentPrefKey == 
null;
 
 1984        if ($a_data != 
"\n") {
 
 1985            $a_data = preg_replace(
"/\t+/", 
" ", $a_data);
 
 1988        if (strlen($a_data) > 0) {
 
 1989            $this->cdata .= $a_data;
 
 2016        if (!array_key_exists($aLogin, $this->protocol)) {
 
 2017            $this->protocol[$aLogin] = array();
 
 2020            $this->protocol[$aLogin][] = $aMessage;
 
 2034        if (!array_key_exists($aLogin, $this->protocol)) {
 
 2035            $this->protocol[$aLogin] = array();
 
 2038            $this->protocol[$aLogin][] = $aMessage;
 
 2052        $this->user_mapping[
$userid] = array(
"login" => $aLogin, 
"action" => 
$action, 
"message" => 
"successful");
 
 2075        $block = 
new ilTemplate(
"tpl.usr_import_log_block.html", 
true, 
true, 
"Services/User");
 
 2076        $block->setVariable(
"TXT_LOG_TITLE", $a_log_title);
 
 2077        $block->setVariable(
"TXT_MESSAGE_ID", 
$lng->txt(
"login"));
 
 2078        $block->setVariable(
"TXT_MESSAGE_TEXT", 
$lng->txt(
"message"));
 
 2080            $block->setCurrentBlock(
"log_row");
 
 2083                if ($reason == 
"") {
 
 2086                    $reason = $reason . 
"<br>" . 
$message;
 
 2089            $block->setVariable(
"MESSAGE_ID", $login);
 
 2090            $block->setVariable(
"MESSAGE_TEXT", $reason);
 
 2091            $block->parseCurrentBlock();
 
 2093        return $block->get();
 
 2128        if (
$_POST[
"send_mail"] != 
"" ||
 
 2129            ($this->
isSendMail() && $this->userObj->getEmail() != 
"")) {
 
 2130            $this->acc_mail->setUser($this->userObj);
 
 2133            if ($amail[
"att_file"]) {
 
 2134                include_once 
"Services/User/classes/class.ilFSStorageUserFolder.php";
 
 2137                $path = $fs->getAbsolutePath() . 
"/";
 
 2139                $this->acc_mail->addAttachment(
$path . 
"/" . $amail[
"lang"], $amail[
"att_file"]);
 
 2141            $this->acc_mail->send();
 
 2151        if (!isset(self::$account_mail_cache[$lang_key])) {
 
 2152            $default_lang_key = 
$GLOBALS[
"lng"]->getDefaultLanguage();
 
 2155            include_once 
'./Services/User/classes/class.ilObjUserFolder.php';
 
 2159            if (trim($amail[
"body"]) != 
"" && trim($amail[
"subject"]) != 
"") {
 
 2160                self::$account_mail_cache[$lang_key] = $amail;
 
 2162                $lang_key = $default_lang_key;
 
 2165            if (!isset(self::$account_mail_cache[$default_lang_key])) {
 
 2167                self::$account_mail_cache[$default_lang_key] = $amail;
 
 2170        return self::$account_mail_cache[$lang_key];
 
 2180        $this->send_mail = $value ? 
true: 
false;
 
 2201            $this->mapping_mode = $value;
 
 2203            die(
"wrong argument using methode setUserMappingMethod in " . __FILE__);
 
 2227        if (is_array($this->required_fields)) {
 
 2228            return $this->required_fields;
 
 2230        foreach (
$ilSetting->getAll() as $field => $value) {
 
 2231            if (substr($field, 0, 8) == 
'require_' and $value == 1) {
 
 2232                $value = substr($field, 8);
 
 2233                $this->required_fields[$value] = $value;
 
 2236        return $this->required_fields ? $this->required_fields : array();
 
 2249        include_once 
"Services/User/classes/class.ilUserProfile.php";
 
 2262        $fieldname = strtolower(trim($fieldname));
 
 2263        return array_key_exists($fieldname, $requiredFields);
 
 2269            case 'mail_linebreak':
 
 2270            case 'hits_per_page':
 
 2271                if (!is_numeric($value) || $value < 0) {
 
 2272                    $this->
logFailure(
"---", 
"Wrong value '$value': Positiv numeric value expected for preference $key.");
 
 2278            case 'ilPageEditor_HTMLMode':
 
 2279            case 'ilPageEditor_JavaScript':
 
 2280            case 'ilPageEditor_MediaMode':
 
 2281            case 'tst_javascript':
 
 2282            case 'tst_lastquestiontype':
 
 2283            case 'tst_multiline_answers':
 
 2284            case 'tst_use_previous_answers':
 
 2285            case 'graphicalAnswerSetting':
 
 2286            case 'priv_feed_pass':
 
 2287                $this->
logFailure(
"---", 
"Preference $key is not supported.");
 
 2290            case 'public_country':
 
 2291            case 'public_department':
 
 2292            case 'public_email':
 
 2293            case 'public_second_email':
 
 2295            case 'public_hobby':
 
 2296            case 'public_institution':
 
 2297            case 'public_matriculation':
 
 2298            case 'public_phone':
 
 2299            case 'public_phone_home':
 
 2300            case 'public_phone_mobile':
 
 2301            case 'public_phone_office':
 
 2302            case 'public_street':
 
 2303            case 'public_upload':
 
 2305            case 'public_interests_general':
 
 2306            case 'public_interests_help_offered':
 
 2307            case 'public_interests_help_looking':
 
 2308            case 'send_info_mails':
 
 2309            case 'hide_own_online_status':
 
 2310                if (!in_array($value, array(
'y', 
'n'))) {
 
 2311                    $this->
logFailure(
"---", 
"Wrong value '$value': Value 'y' or 'n' expected for preference $key.");
 
 2314            case 'bs_allow_to_contact_me':
 
 2315                if (!in_array($value, array(
'y', 
'n'))) {
 
 2316                    $this->
logFailure(
"---", 
"Wrong value '$value': Value 'y' or 'n' expected for preference $key.");
 
 2319            case 'chat_osc_accept_msg':
 
 2320                if (!in_array($value, array(
'y', 
'n'))) {
 
 2321                    $this->
logFailure(
"---", 
"Wrong value '$value': Value 'y' or 'n' expected for preference $key.");
 
 2324            case 'public_profile':
 
 2325                if (!in_array($value, array(
'y', 
'n', 
'g'))) {
 
 2326                    $this->
logFailure(
"---", 
"Wrong value '$value': Value 'y', 'g' or 'n' expected for preference $key.");
 
 2329            case 'show_users_online':
 
 2330                if (!in_array($value, array(
'y', 
'n', 
'associated'))) {
 
 2331                    $this->
logFailure(
"---", 
"Wrong value '$value': Value 'y' or 'n' or 'associated' expected for preference $key.");
 
 2334            case 'mail_incoming_type':
 
 2335                if (!in_array((
int) $value, array(
"0",
"1",
"2"))) {
 
 2336                    $this->
logFailure(
"---", 
"Wrong value '$value': Value \"0\" (LOCAL),\"1\" (EMAIL) or \"2\" (BOTH) expected for preference $key.");
 
 2340                if (!in_array($value, array(
"0",
"1"))) {
 
 2341                    $this->
logFailure(
"---", 
"Wrong value '$value': Value \"0\" (Sunday) or \"1\" (Monday) expected for preference $key.");
 
 2345            case 'mail_signature':
 
 2348                include_once(
'Services/Calendar/classes/class.ilTimeZone.php');
 
 2353                    $this->
logFailure(
"---", 
"Wrong value '$value': Invalid timezone $value detected for preference $key.");
 
 2358                    $this->
logFailure(
"---", 
"Preference $key is not supported.");
 
 2366        if (array_key_exists(
"mail_incoming_type", $this->prefs) ||
 
 2367            array_key_exists(
"mail_signature", $this->prefs) ||
 
 2368            array_key_exists(
"mail_linebreak", $this->prefs)
 
 2370            include_once(
"Services/Mail/classes/class.ilMailOptions.php");
 
 2373            $mailOptions->setLinebreak(array_key_exists(
"mail_linebreak", $this->prefs) ? $this->prefs[
"mail_linebreak"] : $mailOptions->getLinebreak());
 
 2374            $mailOptions->setSignature(array_key_exists(
"mail_signature", $this->prefs) ? $this->prefs[
"mail_signature"] : $mailOptions->getSignature());
 
 2375            $mailOptions->setIncomingType(array_key_exists(
"mail_incoming_type", $this->prefs) ? $this->prefs[
"mail_incoming_type"] : $mailOptions->getIncomingType());
 
 2376            $mailOptions->updateOptions();
 
sprintf('%.4f', $callTime)
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
foreach($mandatory_scripts as $file) $timestamp
An exception for terminatinating execution or to throw for unit testing.
const USER_FOLDER_ID
Class ilObjUserFolder.
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 _lookupNewAccountMail($a_lang)
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 _dropDesktopItem($a_usr_id, $a_item_id, $a_type)
drop an item from user's personal desktop
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 _addDesktopItem($a_usr_id, $a_item_id, $a_type, $a_par="")
add an item to user's personal desktop
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
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.
readAccountMailFromCache($lang_key)
$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.
static $account_mail_cache
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
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.
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.
static isPrefExportable($key)
returns wether a key from db is exportable or not
static ilTempnam($a_temp_path=null)
Create a temporary file in an ILIAS writable directory.
static __extractId($ilias_id, $inst_id)
extract ref id from role title, e.g.
if(empty($userids)) $userid
if(!array_key_exists('StateId', $_REQUEST)) $id
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
if(function_exists( 'posix_getuid') &&posix_getuid()===0) if(!array_key_exists('t', $options)) $tag
catch(Exception $e) $message
if(isset($_REQUEST['delete'])) $list