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');
 
  290                $this->roles = array();
 
  291                $this->mode = $a_mode;
 
  292                $this->conflict_rule = $a_conflict_rule;
 
  294                $this->protocol = array();
 
  295                $this->logins = array();
 
  296                $this->userCount = 0;
 
  297                $this->localRoleCache = array();
 
  298                $this->parentRolesCache = array();
 
  299                $this->send_mail = 
false;
 
  303                $this->userStyles = array();
 
  304                include_once(
"./Services/Style/classes/class.ilObjStyleSettings.php");
 
  305                include_once 
'./Services/Style/classes/class.ilStyleDefinition.php';
 
  308                if (is_array($templates))
 
  311                        foreach($templates as $template)
 
  315                                $styleDef->startParsing();
 
  316                                $styles = $styleDef->getStyles();
 
  318                                foreach($styles as 
$style)
 
  324                                        $this->userStyles [] = $template[
"id"].
":".
$style[
"id"];
 
  329                $settings = 
$ilias->getAllSettings();
 
  330                if ($settings[
"usr_settings_hide_skin_style"] == 1)
 
  332                        $this->hideSkin = TRUE;
 
  336                        $this->hideSkin = FALSE;
 
  338                if ($settings[
"usr_settings_disable_skin_style"] == 1)
 
  340                        $this->disableSkin = TRUE;
 
  344                        $this->disableSkin = FALSE;
 
  347                include_once(
"Services/Mail/classes/class.ilAccountMail.php");
 
  349                $this->acc_mail->useLangVariablesAsFallback(
true);
 
  351                parent::ilSaxParser($a_xml_file);
 
  361                $this->folder_id = $a_folder_id;
 
  376                xml_set_object($a_xml_parser,$this);
 
  377                xml_set_element_handler($a_xml_parser,
'handlerBeginTag',
'handlerEndTag');
 
  378                xml_set_character_data_handler($a_xml_parser,
'handlerCharacterData');
 
  386                parent::startParsing();
 
  396                $this->role_assign = $a_assign;
 
  417                        while (list($k,$v) = each($attr))
 
  418                                $tag.= 
" ".$k.
"=\"$v\"";
 
  456                                $this->current_role_id = $a_attribs[
"Id"]; 
 
  459                                         $this->current_role_id = $internal_id;
 
  461                                $this->current_role_type = $a_attribs[
"Type"];                                                  
 
  476                                $this->current_role_id = $a_attribs[
"Id"];
 
  479                                         $this->current_role_id = $internal_id;
 
  481                                $this->current_role_type = $a_attribs[
"Type"];
 
  482                                $this->current_role_action = (is_null($a_attribs[
"Action"])) ? 
"Assign" : $a_attribs[
"Action"];
 
  485                        case "PersonalPicture":
 
  486                                $this->personalPicture = array(
 
  487                                        "encoding" => $a_attribs[
"encoding"],
 
  488                                        "imagetype" => $a_attribs[
"imagetype"],
 
  494                                $this->skin = $a_attribs[
"Skin"];
 
  495                                $this->style = $a_attribs[
"Style"];
 
  499                                $this->acc_mail->reset();
 
  500                                $this->prefs = array();
 
  501                                $this->currentPrefKey = 
null;
 
  502                                $this->auth_mode_set = 
false;
 
  503                                $this->approve_date_set = 
false;
 
  504                                $this->time_limit_set = 
false;
 
  505                                $this->time_limit_owner_set = 
false;    
 
  506                                $this->updateLookAndSkin = 
false;
 
  509                                $this->personalPicture = 
null;
 
  514                                $this->udf_data = array();
 
  520                                    if (is_numeric($a_attribs[
"Id"]))
 
  522                                        $this->user_id = $a_attribs[
"Id"];
 
  526                                        $this->user_id = $id;
 
  530                                $this->userObj->setPref(
"skin",
 
  531                                        $ilias->ini->readVariable(
"layout",
"skin"));
 
  532                                $this->userObj->setPref(
"style",
 
  533                                        $ilias->ini->readVariable(
"layout",
"style"));
 
  535                                $this->userObj->setLanguage($a_attribs[
"Language"]);
 
  536                                $this->userObj->setImportId($a_attribs[
"Id"]);
 
  537                                $this->action = (is_null($a_attribs[
"Action"])) ? 
"Insert" : $a_attribs[
"Action"];
 
  538                                $this->currPassword         = 
null;
 
  539                                $this->currPasswordType     = 
null;
 
  540                                $this->currPasswordSalt     = 
null;
 
  541                                $this->currActive = 
null;                               
 
  542                                $this->multi_values = array();
 
  546                                $this->currPasswordType     = $a_attribs[
'Type'];
 
  547                                $this->currPasswordSalt     = $a_attribs[
'Salt'];
 
  550                                if (array_key_exists(
"type", $a_attribs))
 
  552                                        switch ($a_attribs[
"type"])
 
  565                                                        $this->auth_mode_set = 
true;
 
  566                                                        $this->userObj->setAuthMode($a_attribs[
"type"]);
 
  579                                                                          sprintf(
$lng->txt(
"usrimport_xml_element_inapplicable"),
"AuthMode",$a_attribs[
"type"]));
 
  583                        case 'UserDefinedField':
 
  584                                $this->tmp_udf_id = $a_attribs[
'Id'];
 
  585                                $this->tmp_udf_name = $a_attribs[
'Name'];
 
  589                                $this->current_messenger_type = strtolower($a_attribs[
"Type"]);
 
  592                                $this->userObj->setLatitude($a_attribs[
"latitude"]);
 
  593                                $this->userObj->setLongitude($a_attribs[
"longitude"]);
 
  594                                $this->userObj->setLocationZoom($a_attribs[
"zoom"]);
 
  597                                $this->currentPrefKey = $a_attribs[
"key"];
 
  611                                if (is_null($a_attribs[
'Id'])
 
  612                                || $a_attribs[
'Id'] == 
"")
 
  614                                        $this->
logFailure($this->userObj->getLogin(), sprintf(
$lng->txt(
"usrimport_xml_attribute_missing"),
"Role",
"Id"));
 
  616                                $this->current_role_id = $a_attribs[
"Id"];
 
  617                                $this->current_role_type = $a_attribs[
"Type"];
 
  618                                if ($this->current_role_type != 
'Global' 
  619                                && $this->current_role_type != 
'Local')
 
  621                                        $this->
logFailure($this->userObj->getLogin(), sprintf(
$lng->txt(
"usrimport_xml_attribute_missing"),
"Role",
"Type"));
 
  623                                $this->current_role_action = (is_null($a_attribs[
"Action"])) ? 
"Assign" : $a_attribs[
"Action"];
 
  624                                if ($this->current_role_action != 
"Assign" 
  625                                && $this->current_role_action != 
"AssignWithParents" 
  626                                && $this->current_role_action != 
"Detach")
 
  628                                        $this->
logFailure($this->userObj->getLogin(), sprintf(
$lng->txt(
"usrimport_xml_attribute_value_illegal"),
"Role",
"Action",$a_attribs[
"Action"]));
 
  630                                if ($this->action == 
"Insert" 
  631                                && $this->current_role_action == 
"Detach")
 
  633                                        $this->
logFailure($this->userObj->getLogin(), sprintf(
$lng->txt(
"usrimport_xml_attribute_value_inapplicable"),
"Role",
"Action",$this->current_role_action,$this->action));
 
  635                                if ($this->action == 
"Delete")
 
  637                                        $this->
logFailure($this->userObj->getLogin(), sprintf(
$lng->txt(
"usrimport_xml_element_inapplicable"),
"Role",
"Delete"));
 
  644                                $this->userObj->setLanguage($a_attribs[
"Language"]);
 
  645                                $this->userObj->setImportId($a_attribs[
"Id"]);
 
  646                                $this->currentPrefKey = 
null;
 
  652                                    if (is_numeric($a_attribs[
"Id"]))
 
  654                                        $this->user_id = $a_attribs[
"Id"];
 
  658                                        $this->user_id = $id;
 
  662                                $this->action = (is_null($a_attribs[
"Action"])) ? 
"Insert" : $a_attribs[
"Action"];
 
  663                                if ($this->action != 
"Insert" 
  664                                && $this->action != 
"Update" 
  665                                && $this->action != 
"Delete")
 
  667                                        $this->
logFailure($this->userObj->getImportId(), sprintf(
$lng->txt(
"usrimport_xml_attribute_value_illegal"),
"User",
"Action",$a_attribs[
"Action"]));
 
  669                                $this->currPassword         = 
null;
 
  670                                $this->currPasswordType     = 
null;
 
  671                                $this->currPasswordSalt     = 
null;
 
  675                                $this->currPasswordType     = $a_attribs[
'Type'];
 
  676                                $this->currPasswordSalt     = $a_attribs[
'Salt'];
 
  679                                if (array_key_exists(
"type", $a_attribs))
 
  681                                        switch ($a_attribs[
"type"])
 
  694                                                        $this->userObj->setAuthMode($a_attribs[
"type"]);
 
  706                                        $this->
logFailure($this->userObj->getImportId(), sprintf(
$lng->txt(
"usrimport_xml_attribute_value_illegal"),
"AuthMode",
"type",
""));
 
  710                                $this->currentPrefKey = $a_attribs[
"key"];
 
  743                                $this->roles[$this->current_role_id][
"name"] = $this->cdata;
 
  744                                $this->roles[$this->current_role_id][
"type"] =
 
  745                                        $this->current_role_type;
 
  755                if (array_key_exists($a_role_id, $this->localRoleCache))
 
  757                        return $this->localRoleCache[$a_role_id];
 
  761                        $role_obj = 
new ilObjRole($a_role_id, 
false);
 
  763                        $this->localRoleCache[$a_role_id] = $role_obj;
 
  773                global $rbacreview, $rbacadmin, $tree;
 
  775                if (array_key_exists($a_role_id.
'_courseMembersObject', $this->localRoleCache))
 
  777                        return $this->localRoleCache[$a_role_id.
'_courseMembersObject'];
 
  781                        require_once(
"Modules/Course/classes/class.ilObjCourse.php");
 
  782                        require_once(
"Modules/Course/classes/class.ilCourseParticipants.php");
 
  783                        $course_refs = $rbacreview->getFoldersAssignedToRole($a_role_id, 
true);
 
  784                        $course_ref = $course_refs[0];
 
  787                        $this->localRoleCache[$a_role_id.
'_courseMembersObject'] = $crsmembers_obj;
 
  788                        return $crsmembers_obj;
 
  798                require_once 
"./Services/AccessControl/classes/class.ilObjRole.php";
 
  799                include_once(
'./Services/Object/classes/class.ilObject.php');
 
  800                #require_once "Modules/Course/classes/class.ilObjCourse.php";
 
  801                #require_once "Modules/Course/classes/class.ilCourseParticipants.php";
 
  803                global $rbacreview, $rbacadmin, $tree;
 
  809                if ($rbacreview->isAssigned($a_user_obj->getId(), $a_role_id))
 
  817                $rbacadmin->assignUser($a_role_id, $a_user_obj->getId(), 
true);
 
  818                $obj_id = $rbacreview->getObjectOfRole($a_role_id);
 
  824                                $ref_id = current((array) $ref_ids);
 
  842                if (! array_key_exists($a_role_id, $this->parentRolesCache))
 
  844                        $parent_role_ids = array();
 
  847                        $short_role_title = substr($role_obj->getTitle(),0,12);
 
  848                        $folders = $rbacreview->getFoldersAssignedToRole($a_role_id, 
true);
 
  849                        if (count($folders) > 0)
 
  851                                $all_parent_role_ids = $rbacreview->getParentRoleIds($folders[0]);
 
  852                                foreach ($all_parent_role_ids as $parent_role_id => $parent_role_data)
 
  854                                        if ($parent_role_id != $a_role_id)
 
  856                                                switch (substr($parent_role_data[
'title'],0,12))
 
  858                                                        case 'il_crs_admin' :
 
  859                                                        case 'il_grp_admin' :
 
  860                                                                if ($short_role_title == 
'il_crs_admin' || $short_role_title == 
'il_grp_admin')
 
  862                                                                        $parent_role_ids[] = $parent_role_id;
 
  865                                                        case 'il_crs_tutor' :
 
  866                                                        case 'il_grp_tutor' :
 
  867                                                                if ($short_role_title == 
'il_crs_tutor' || $short_role_title == 
'il_grp_tutor')
 
  869                                                                        $parent_role_ids[] = $parent_role_id;
 
  872                                                        case 'il_crs_membe' :
 
  873                                                        case 'il_grp_membe' :
 
  874                                                                if ($short_role_title == 
'il_crs_membe' || $short_role_title == 
'il_grp_membe')
 
  876                                                                        $parent_role_ids[] = $parent_role_id;
 
  885                        $this->parentRolesCache[$a_role_id] = $parent_role_ids;
 
  887                return $this->parentRolesCache[$a_role_id];
 
  897                foreach ($parent_role_ids as $parent_role_id)
 
  907                global $rbacreview, $rbacadmin, $tree;
 
  909                $rbacadmin->deassignUser($a_role_id, $a_user_obj->getId());
 
  914                        $obj = $rbacreview->getObjectOfRole($a_role_id);
 
  931                                $this->roles[$this->current_role_id][
"name"] = $this->cdata;
 
  932                                $this->roles[$this->current_role_id][
"type"] = $this->current_role_type;
 
  933                                $this->roles[$this->current_role_id][
"action"] = $this->current_role_action;
 
  936                        case "PersonalPicture":
 
  937                                switch ($this->personalPicture[
"encoding"])
 
  940                                                $this->personalPicture[
"content"] = base64_decode($this->cdata);
 
  944                                                if (version_compare(PHP_VERSION,
'5',
'>='))
 
  946                                                        $this->personalPicture[
"content"] = convert_uudecode($this->cdata);
 
  953                                $this->userObj->setFullname();
 
  956                                if ($this->user_id == -1 || $this->action==
"Insert")
 
  964                                switch ($this->conflict_rule)
 
  970                                                switch ($this->action)
 
  975                                                                        $this->
logWarning($this->userObj->getLogin(),sprintf(
$lng->txt(
"usrimport_action_replaced"),
"Insert",
"Update"));
 
  976                                                                        $this->action = 
"Update";
 
  982                                                                        $this->
logWarning($this->userObj->getLogin(),sprintf(
$lng->txt(
"usrimport_action_replaced"),
"Update",
"Insert"));
 
  983                                                                        $this->action = 
"Insert";
 
  989                                                                        $this->
logWarning($this->userObj->getLogin(),sprintf(
$lng->txt(
"usrimport_action_ignored"),
"Delete"));
 
  990                                                                        $this->action = 
"Ignore";
 
  996                                                switch ($this->action)
 
 1001                                                                        $this->
logWarning($this->userObj->getLogin(),sprintf(
$lng->txt(
"usrimport_action_ignored"),
"Insert"));
 
 1002                                                                        $this->action = 
"Ignore";
 
 1008                                                                        $this->
logWarning($this->userObj->getLogin(),sprintf(
$lng->txt(
"usrimport_action_ignored"),
"Update"));
 
 1009                                                                        $this->action = 
"Ignore";
 
 1015                                                                        $this->
logWarning($this->userObj->getLogin(),sprintf(
$lng->txt(
"usrimport_action_ignored"),
"Delete"));
 
 1016                                                                        $this->action = 
"Ignore";
 
 1027                                $am = ($this->userObj->getAuthMode() == 
"default" || $this->userObj->getAuthMode() == 
"")
 
 1029                                        : $this->userObj->getAuthMode();
 
 1030                                $loginForExternalAccount = ($this->userObj->getExternalAccount() == 
"")
 
 1033                                switch ($this->action)
 
 1036                                                if ($loginForExternalAccount != 
"")
 
 1038                                                        $this->
logWarning($this->userObj->getLogin(), 
$lng->txt(
"usrimport_no_insert_ext_account_exists").
" (".$this->userObj->getExternalAccount().
")");
 
 1039                                                        $this->action = 
"Ignore";
 
 1048                                                if ($loginForExternalAccount != 
"") 
 
 1053                                                        if ($externalAccountHasChanged && trim($loginForExternalAccount) != trim($this->userObj->getLogin()))
 
 1055                                                                $this->
logWarning($this->userObj->getLogin(), 
$lng->txt(
"usrimport_no_update_ext_account_exists").
" (".$this->userObj->getExternalAccount().
")");
 
 1056                                                                $this->action = 
"Ignore";
 
 1062                                if(
sizeof($this->multi_values))
 
 1064                                        if(isset($this->multi_values[
"GeneralInterest"]))
 
 1066                                                $this->userObj->setGeneralInterests($this->multi_values[
"GeneralInterest"]);
 
 1068                                        if(isset($this->multi_values[
"OfferingHelp"]))
 
 1070                                                $this->userObj->setOfferingHelp($this->multi_values[
"OfferingHelp"]);
 
 1072                                        if(isset($this->multi_values[
"LookingForHelp"]))
 
 1074                                                $this->userObj->setLookingForHelp($this->multi_values[
"LookingForHelp"]);
 
 1079                                switch ($this->action)
 
 1084                                                        $this->
logFailure($this->userObj->getLogin(),
$lng->txt(
"usrimport_cant_insert"));
 
 1089                                                        if(!strlen($this->currPassword) == 0)
 
 1091                                                                switch($this->currPasswordType)
 
 1094                                                                                if(!strlen($this->currPasswordSalt))
 
 1096                                                                                        $this->
logFailure($this->userObj->getLogin(), 
$lng->txt(
"usrimport_xml_pw_bcrypt_missing_salt"));
 
 1099                                                                                $this->userObj->setPasswordEncodingType(
'bcrypt');
 
 1100                                                                                $this->userObj->setPasswordSalt($this->currPasswordSalt);
 
 1105                                                                                $this->acc_mail->setUserPassword($this->currPassword);
 
 1120                                                        $this->userObj->setTitle($this->userObj->getFullname());
 
 1121                                                        $this->userObj->setDescription($this->userObj->getEmail());
 
 1123                                                        if(!$this->time_limit_owner_set)
 
 1125                                                                $this->userObj->setTimeLimitOwner($this->
getFolderId());
 
 1129                                                        if(!$this->time_limit_set)
 
 1131                                                                $this->userObj->setTimeLimitUnlimited(1);
 
 1132                                                                $this->userObj->setTimeLimitMessage(0);
 
 1134                                                                if (! $this->approve_date_set)
 
 1136                                                                        $this->userObj->setApproveDate(date(
"Y-m-d H:i:s"));
 
 1141                                                        $this->userObj->setActive($this->currActive == 
'true' || is_null($this->currActive));
 
 1147                                                        if(count($this->udf_data))
 
 1149                                                                $this->userObj->setUserDefinedData($this->udf_data);                                                            
 
 1153                                                        $this->userObj->create();
 
 1156                                                        $this->userObj->saveAsNew(
false);
 
 1159                                                        $this->userObj->setPref(
'hits_per_page',
$ilSetting->get(
'hits_per_page',30));
 
 1160                                                        $this->userObj->setPref(
'show_users_online',
$ilSetting->get(
'show_users_online',
'y'));
 
 1162                                                        if (count ($this->prefs)) 
 
 1164                                                                foreach ($this->prefs as $key => $value)
 
 1166                                                                        if ($key != 
"mail_incoming_type" && 
 
 1167                                                                            $key != 
"mail_signature" &&
 
 1168                                                                            $key != 
"mail_linebreak" 
 1171                                                                           $this->userObj->setPref($key, $value);
 
 1176                                                        $this->userObj->writePrefs();
 
 1181                                                        if (is_array($this->personalPicture))
 
 1183                                                                if (strlen($this->personalPicture[
"content"]))
 
 1186                                                                        if (preg_match(
"/.*(png|jpg|gif|jpeg)$/", $this->personalPicture[
"imagetype"], $matches))
 
 1188                                                                                $extension = $matches[1];
 
 1190                                                                        $tmp_name = $this->
saveTempImage($this->personalPicture[
"content"], 
".$extension");
 
 1191                                                                        if (strlen($tmp_name))
 
 1200                                                        foreach($this->roles as $role_id => $role)
 
 1202                                                                if ($this->role_assign[$role_id])
 
 1204                                                                        $this->
assignToRole($this->userObj, $this->role_assign[$role_id]);
 
 1208                                                        if(count($this->udf_data))
 
 1210                                                                include_once 
'./Services/User/classes/class.ilUserDefinedData.php';
 
 1212                                                                foreach($this->udf_data as $field => $value)
 
 1214                                                                        $udd->set(
"f_".$field,$value);
 
 1220                                                        $this->
logSuccess($this->userObj->getLogin(),$this->userObj->getId(), 
"Insert");
 
 1222                                                        $this->acc_mail->reset();
 
 1229                                                        $this->
logFailure($this->userObj->getLogin(),
$lng->txt(
"usrimport_cant_update"));
 
 1234                                                        $updateUser->read();
 
 1235                                                        $updateUser->readPrefs();
 
 1236                                                        if ($this->currPassword != 
null)
 
 1238                                                                switch ($this->currPasswordType)
 
 1241                                                                                if(!strlen($this->currPasswordSalt))
 
 1243                                                                                        $this->
logFailure($this->userObj->getLogin(), 
$lng->txt(
"usrimport_xml_pw_bcrypt_missing_salt"));
 
 1246                                                                                $updateUser->setPasswordEncodingType(
'bcrypt');
 
 1247                                                                                $updateUser->setPasswordSalt($this->currPasswordSalt);
 
 1252                                                                                $this->acc_mail->setUserPassword($this->currPassword);
 
 1256                                                        if (! is_null($this->userObj->getFirstname())) $updateUser->setFirstname($this->userObj->getFirstname());
 
 1257                                                        if (! is_null($this->userObj->getLastname())) $updateUser->setLastname($this->userObj->getLastname());
 
 1258                                                        if (! is_null($this->userObj->getUTitle())) $updateUser->setUTitle($this->userObj->getUTitle());
 
 1259                                                        if (! is_null($this->userObj->getGender())) $updateUser->setGender($this->userObj->getGender());
 
 1260                                                        if (! is_null($this->userObj->getEmail())) $updateUser->setEmail($this->userObj->getEmail());
 
 1261                                                        if (! is_null($this->userObj->getBirthday())) $updateUser->setBirthday($this->userObj->getBirthday());
 
 1262                                                        if (! is_null($this->userObj->getInstitution())) $updateUser->setInstitution($this->userObj->getInstitution());
 
 1263                                                        if (! is_null($this->userObj->getStreet())) $updateUser->setStreet($this->userObj->getStreet());
 
 1264                                                        if (! is_null($this->userObj->getCity())) $updateUser->setCity($this->userObj->getCity());
 
 1265                                                        if (! is_null($this->userObj->getZipCode())) $updateUser->setZipCode($this->userObj->getZipCode());
 
 1266                                                        if (! is_null($this->userObj->getCountry())) $updateUser->setCountry($this->userObj->getCountry());
 
 1267                                                        if (! is_null($this->userObj->getPhoneOffice())) $updateUser->setPhoneOffice($this->userObj->getPhoneOffice());
 
 1268                                                        if (! is_null($this->userObj->getPhoneHome())) $updateUser->setPhoneHome($this->userObj->getPhoneHome());
 
 1269                                                        if (! is_null($this->userObj->getPhoneMobile())) $updateUser->setPhoneMobile($this->userObj->getPhoneMobile());
 
 1270                                                        if (! is_null($this->userObj->getFax())) $updateUser->setFax($this->userObj->getFax());
 
 1271                                                        if (! is_null($this->userObj->getHobby())) $updateUser->setHobby($this->userObj->getHobby());
 
 1272                                                        if (! is_null($this->userObj->getGeneralInterests())) $updateUser->setGeneralInterests($this->userObj->getGeneralInterests());
 
 1273                                                        if (! is_null($this->userObj->getOfferingHelp())) $updateUser->setOfferingHelp($this->userObj->getOfferingHelp());
 
 1274                                                        if (! is_null($this->userObj->getLookingForHelp())) $updateUser->setLookingForHelp($this->userObj->getLookingForHelp());
 
 1275                                                        if (! is_null($this->userObj->getComment())) $updateUser->setComment($this->userObj->getComment());
 
 1276                                                        if (! is_null($this->userObj->getDepartment())) $updateUser->setDepartment($this->userObj->getDepartment());
 
 1277                                                        if (! is_null($this->userObj->getMatriculation())) $updateUser->setMatriculation($this->userObj->getMatriculation());
 
 1278                                                        if (! is_null($this->currActive)) $updateUser->setActive($this->currActive == 
"true", is_object(
$ilUser) ? 
$ilUser->getId() : 0);
 
 1279                                                        if (! is_null($this->userObj->getClientIP())) $updateUser->setClientIP($this->userObj->getClientIP());
 
 1280                                                        if (! is_null($this->userObj->getTimeLimitUnlimited())) $updateUser->setTimeLimitUnlimited($this->userObj->getTimeLimitUnlimited());
 
 1281                                                        if (! is_null($this->userObj->getTimeLimitFrom())) $updateUser->setTimeLimitFrom($this->userObj->getTimeLimitFrom());
 
 1282                                                        if (! is_null($this->userObj->getTimeLimitUntil())) $updateUser->setTimeLimitUntil($this->userObj->getTimeLimitUntil());
 
 1283                                                        if (! is_null($this->userObj->getTimeLimitMessage())) $updateUser->setTimeLimitMessage($this->userObj->getTimeLimitMessage());
 
 1284                                                        if (! is_null($this->userObj->getApproveDate())) $updateUser->setApproveDate($this->userObj->getApproveDate());
 
 1285                                                        if (! is_null($this->userObj->getAgreeDate())) $updateUser->setAgreeDate($this->userObj->getAgreeDate());
 
 1286                                                        if (! is_null($this->userObj->getLanguage())) $updateUser->setLanguage($this->userObj->getLanguage());
 
 1287                                                        if (! is_null($this->userObj->getExternalAccount())) $updateUser->setExternalAccount($this->userObj->getExternalAccount());
 
 1290                                                        #if (! is_null($this->userObj->getAuthMode())) $updateUser->setAuthMode($this->userObj->getAuthMode()); 
 1291                                                        if($this->auth_mode_set)
 
 1292                                                                $updateUser->setAuthMode($this->userObj->getAuthMode());
 
 1294                                                        if (! is_null($this->userObj->getInstantMessengerId(
"aim"))) $updateUser->setInstantMessengerId(
"aim", $this->userObj->getInstantMessengerId(
"aim"));
 
 1295                                                        if (! is_null($this->userObj->getInstantMessengerId(
"msn"))) $updateUser->setInstantMessengerId(
"msn", $this->userObj->getInstantMessengerId(
"msn"));
 
 1296                                                        if (! is_null($this->userObj->getInstantMessengerId(
"icq"))) $updateUser->setInstantMessengerId(
"icq", $this->userObj->getInstantMessengerId(
"icq"));
 
 1297                                                        if (! is_null($this->userObj->getInstantMessengerId(
"yahoo"))) $updateUser->setInstantMessengerId(
"yahoo", $this->userObj->getInstantMessengerId(
"yahoo"));
 
 1298                                                        if (! is_null($this->userObj->getInstantMessengerId(
"skype"))) $updateUser->setInstantMessengerId(
"skype", $this->userObj->getInstantMessengerId(
"skype"));
 
 1299                                                        if (! is_null($this->userObj->getInstantMessengerId(
"jabber"))) $updateUser->setInstantMessengerId(
"jabber", $this->userObj->getInstantMessengerId(
"jabber"));
 
 1300                                                        if (! is_null($this->userObj->getInstantMessengerId(
"voip"))) $updateUser->setInstantMessengerId(
"voip", $this->userObj->getInstantMessengerId(
"voip"));
 
 1303                                                        if($this->time_limit_owner_set)
 
 1305                                                                $updateUser->setTimeLimitOwner($this->userObj->getTimeLimitOwner());
 
 1309                                                        if (count ($this->prefs)) 
 
 1311                                                                foreach ($this->prefs as $key => $value)
 
 1313                                                                        if ($key != 
"mail_incoming_type" && 
 
 1314                                                                            $key != 
"mail_signature" &&
 
 1315                                                                            $key != 
"mail_linebreak" 
 1317                                                                            $updateUser->setPref($key, $value);
 
 1323                                                        if ($this->updateLookAndSkin)
 
 1325                                                                $updateUser->setPref(
"skin", $this->userObj->getPref(
"skin"));
 
 1326                                                                $updateUser->setPref(
"style", $this->userObj->getPref(
"style"));
 
 1330                                                        $updateUser->writePrefs();
 
 1336                                                        if(count($this->udf_data))
 
 1338                                                                $updateUser->setUserDefinedData($this->udf_data);                                                               
 
 1343                                                        $updateUser->setTitle($updateUser->getFullname());
 
 1344                                                        $updateUser->setDescription($updateUser->getEmail());
 
 1345                                                        $updateUser->update();
 
 1347                                                        if(count($this->udf_data))
 
 1349                                                                include_once 
'./Services/User/classes/class.ilUserDefinedData.php';
 
 1351                                                                foreach($this->udf_data as $field => $value)
 
 1353                                                                        $udd->set(
"f_".$field,$value);
 
 1359                                                        if (!is_null($this->userObj->getLogin()) && $this->user_id != -1)
 
 1363                                                                        $updateUser->updateLogin($this->userObj->getLogin());
 
 1373                                                        if (is_array($this->personalPicture))
 
 1375                                                                if (strlen($this->personalPicture[
"content"]))
 
 1378                                                                        if (preg_match(
"/.*(png|jpg|gif|jpeg)$/", $this->personalPicture[
"imagetype"], $matches))
 
 1380                                                                                $extension = $matches[1];
 
 1382                                                                        $tmp_name = $this->
saveTempImage($this->personalPicture[
"content"], 
".$extension");
 
 1383                                                                        if (strlen($tmp_name))
 
 1394                                                        foreach ($this->roles as $role_id => $role)
 
 1396                                                                if ($this->role_assign[$role_id])
 
 1398                                                                        switch ($role[
"action"])
 
 1401                                                                                        $this->
assignToRole($updateUser, $this->role_assign[$role_id]);
 
 1403                                                                                case "AssignWithParents" :
 
 1407                                                                                        $this->
detachFromRole($updateUser, $this->role_assign[$role_id]);
 
 1418                                                        $this->
logFailure($this->userObj->getLogin(),
$lng->txt(
"usrimport_cant_delete"));
 
 1423                                                        $deleteUser->delete();
 
 1431                                $this->roles = array();
 
 1435                                $this->userObj->setLogin($this->cdata);
 
 1439                                $this->currPassword = $this->cdata;
 
 1443                                $this->userObj->setFirstname($this->cdata);
 
 1447                                $this->userObj->setLastname($this->cdata);
 
 1451                                $this->userObj->setUTitle($this->cdata);
 
 1455                                $this->userObj->setGender($this->cdata);
 
 1459                                $this->userObj->setEmail($this->cdata);
 
 1466                                        $this->userObj->setBirthday($this->cdata);
 
 1470                                $this->userObj->setInstitution($this->cdata);
 
 1474                                $this->userObj->setStreet($this->cdata);
 
 1478                                $this->userObj->setCity($this->cdata);
 
 1482                                $this->userObj->setZipCode($this->cdata);
 
 1486                                $this->userObj->setCountry($this->cdata);
 
 1490                                $this->userObj->setPhoneOffice($this->cdata);
 
 1494                                $this->userObj->setPhoneHome($this->cdata);
 
 1498                                $this->userObj->setPhoneMobile($this->cdata);
 
 1502                                $this->userObj->setFax($this->cdata);
 
 1506                                $this->userObj->setHobby($this->cdata);
 
 1509                        case "GeneralInterest":
 
 1510                        case "OfferingHelp":
 
 1511                        case "LookingForHelp":
 
 1512                                $this->multi_values[$a_name][] = $this->cdata;                          
 
 1516                                $this->userObj->setComment($this->cdata);
 
 1520                                $this->userObj->setDepartment($this->cdata);
 
 1523                        case "Matriculation":
 
 1524                                $this->userObj->setMatriculation($this->cdata);
 
 1528                                $this->currActive = $this->cdata;
 
 1532                                $this->userObj->setClientIP($this->cdata);
 
 1535                        case "TimeLimitOwner":
 
 1536                                $this->time_limit_owner_set = 
true;
 
 1537                                $this->userObj->setTimeLimitOwner($this->cdata);
 
 1540                        case "TimeLimitUnlimited":
 
 1541                                $this->time_limit_set = 
true;
 
 1542                                $this->userObj->setTimeLimitUnlimited($this->cdata);
 
 1545                        case "TimeLimitFrom":
 
 1546                                if (is_numeric($this->cdata))
 
 1549                                        $this->userObj->setTimeLimitFrom($this->cdata);
 
 1555                                        if (
$timestamp !== 
false && trim($this->cdata) != 
"0000-00-00 00:00:00")
 
 1557                                                $this->userObj->setTimeLimitFrom(
$timestamp);
 
 1559                                        elseif ($this->cdata == 
"0000-00-00 00:00:00") 
 
 1561                                            $this->userObj->setTimeLimitFrom(
null);
 
 1567                        case "TimeLimitUntil":
 
 1568                                if (is_numeric($this->cdata))
 
 1571                                        $this->userObj->setTimeLimitUntil($this->cdata);
 
 1577                                        if (
$timestamp !== 
false && trim($this->cdata) != 
"0000-00-00 00:00:00")
 
 1579                                                $this->userObj->setTimeLimitUntil(
$timestamp);
 
 1581                                        elseif ($this->cdata == 
"0000-00-00 00:00:00") 
 
 1583                                            $this->userObj->setTimeLimitUntil(
null);
 
 1588                        case "TimeLimitMessage":
 
 1589                                $this->userObj->setTimeLimitMessage($this->cdata);
 
 1593                                $this->approve_date_set = 
true;
 
 1594                                if (is_numeric($this->cdata))
 
 1604                                        if (
$timestamp !== 
false && trim($this->cdata) != 
"0000-00-00 00:00:00")
 
 1609                                        elseif ($this->cdata == 
"0000-00-00 00:00:00") 
 
 1611                                            $this->userObj->setApproveDate(
null);
 
 1617                                if (is_numeric($this->cdata))
 
 1627                                        if (
$timestamp !== 
false && trim($this->cdata) != 
"0000-00-00 00:00:00")
 
 1632                                        elseif ($this->cdata == 
"0000-00-00 00:00:00") 
 
 1634                                            $this->userObj->setAgreeDate(
null);
 
 1639                        case "ExternalAccount":
 
 1640                                $this->userObj->setExternalAccount($this->cdata);
 
 1644                                $this->updateLookAndSkin = 
false;
 
 1645                                if (!$this->hideSkin)
 
 1648                                        if ((strlen($this->skin) > 0) && (strlen($this->style) > 0))
 
 1650                                                if (is_array($this->userStyles))
 
 1652                                                        if (in_array($this->skin . 
":" . $this->style, $this->userStyles))
 
 1654                                                                $this->userObj->setPref(
"skin", $this->skin);
 
 1655                                                                $this->userObj->setPref(
"style", $this->style);
 
 1656                                                                $this->updateLookAndSkin = 
true;
 
 1663                        case 'UserDefinedField':
 
 1664                                include_once 
'./Services/User/classes/class.ilUserDefinedFields.php';
 
 1666                                if($field_id = $udf->fetchFieldIdFromImportId($this->tmp_udf_id))
 
 1668                                        $this->udf_data[$field_id] = $this->cdata;
 
 1670                                elseif($field_id = $udf->fetchFieldIdFromName($this->tmp_udf_name))
 
 1672                                        $this->udf_data[$field_id] = $this->cdata;
 
 1676                                if ($this->current_messenger_type ==
"delicious")
 
 1678                                        $this->userObj->setDelicious($this->cdata);
 
 1680                                elseif ($this->current_messenger_type ==
"external")
 
 1682                                        $this->userObj->setExternalAccount($this->cdata);
 
 1686                                        $this->userObj->setInstantMessengerId($this->current_messenger_type, $this->cdata);
 
 1690                                if ($this->currentPrefKey != 
null && strlen(trim($this->cdata)) > 0 
 
 1692                                        $this->prefs[$this->currentPrefKey] = trim($this->cdata);
 
 1693                                $this->currentPrefKey = 
null;
 
 1705                $fh = fopen($tempname, 
"wb");
 
 1710                $imagefile = fwrite($fh, $image_data);
 
 1725                                $this->roles[$this->current_role_id][
"name"] = $this->cdata;
 
 1726                                $this->roles[$this->current_role_id][
"type"] = $this->current_role_type;
 
 1727                                $this->roles[$this->current_role_id][
"action"] = $this->current_role_action;
 
 1731                                $this->userObj->setFullname();
 
 1732                                if ($this->user_id != -1 && ($this->action == 
"Update" || $this->action == 
"Delete"))
 
 1737                                if (is_null($this->userObj->getLogin()))
 
 1739                                        $this->
logFailure(
"---",sprintf(
$lng->txt(
"usrimport_xml_element_for_action_required"),
"Login", 
"Insert"));
 
 1742                                switch ($this->action)
 
 1747                                                        $this->
logWarning($this->userObj->getLogin(),
$lng->txt(
"usrimport_cant_insert"));
 
 1749                                                if (is_null($this->userObj->getGender()) && $this->isFieldRequired(
"gender"))
 
 1751                                                        $this->
logFailure($this->userObj->getLogin(),sprintf(
$lng->txt(
"usrimport_xml_element_for_action_required"),
"Gender", 
"Insert"));
 
 1753                                                if (is_null($this->userObj->getFirstname()))
 
 1755                                                        $this->
logFailure($this->userObj->getLogin(),sprintf(
$lng->txt(
"usrimport_xml_element_for_action_required"),
"Firstname", 
"Insert"));
 
 1757                                                if (is_null($this->userObj->getLastname()))
 
 1759                                                        $this->
logFailure($this->userObj->getLogin(),sprintf(
$lng->txt(
"usrimport_xml_element_for_action_required"),
"Lastname", 
"Insert"));
 
 1761                                                if (count($this->roles) == 0)
 
 1763                                                        $this->
logFailure($this->userObj->getLogin(),sprintf(
$lng->txt(
"usrimport_xml_element_for_action_required"),
"Role", 
"Insert"));
 
 1767                                                        $has_global_role = 
false;
 
 1768                                                        foreach ($this->roles as $role)
 
 1770                                                                if ($role[
'type'] == 
'Global')
 
 1772                                                                        $has_global_role = 
true;
 
 1776                                                        if (! $has_global_role)
 
 1778                                                                $this->
logFailure($this->userObj->getLogin(),sprintf(
$lng->txt(
"usrimport_global_role_for_action_required"),
"Insert"));
 
 1785                                                        $this->
logWarning($this->userObj->getLogin(),
$lng->txt(
"usrimport_cant_update"));
 
 1787                                                elseif($this->user_id != -1 && !is_null($this->userObj->getLogin()))
 
 1792                            if (is_numeric($someonesId ) && $someonesId != $this->user_id) {
 
 1793                                          $this->
logFailure($this->userObj->getLogin(), 
$lng->txt(
"usrimport_login_is_not_unique"));
 
 1800                                                        $this->
logWarning($this->userObj->getLogin(),
$lng->txt(
"usrimport_cant_delete"));
 
 1806                                $this->roles = array();
 
 1810                                if (array_key_exists($this->cdata, $this->logins))
 
 1812                                        $this->
logWarning($this->cdata, 
$lng->txt(
"usrimport_login_is_not_unique"));
 
 1816                                        $this->logins[$this->cdata] = $this->cdata;
 
 1818                        $this->userObj->setLogin($this->cdata);
 
 1822                                switch ($this->currPasswordType)
 
 1825                                                if(!strlen($this->currPasswordSalt))
 
 1827                                                        $this->
logFailure($this->userObj->getLogin(), 
$lng->txt(
"usrimport_xml_pw_bcrypt_missing_salt"));
 
 1830                                                $this->userObj->setPasswordEncodingType(
'bcrypt');
 
 1831                                                $this->userObj->setPasswordSalt($this->currPasswordSalt);
 
 1836                                                $this->acc_mail->setUserPassword($this->currPassword);
 
 1840                                                $this->
logFailure($this->userObj->getLogin(), sprintf(
$lng->txt(
"usrimport_xml_attribute_value_illegal"),
"Type",
"Password",$this->currPasswordType));
 
 1846                                $this->userObj->setFirstname($this->cdata);
 
 1850                                $this->userObj->setLastname($this->cdata);
 
 1854                                $this->userObj->setUTitle($this->cdata);
 
 1858                                if ($this->cdata != 
"m" 
 1859                                && $this->cdata != 
"f")
 
 1862                                                $this->userObj->getLogin(), 
 
 1863                                                sprintf(
$lng->txt(
"usrimport_xml_element_content_illegal"),
"Gender",$this->cdata)
 
 1866                                $this->userObj->setGender($this->cdata);
 
 1870                                $this->userObj->setEmail($this->cdata);
 
 1874                                $this->userObj->setInstitution($this->cdata);
 
 1878                                $this->userObj->setStreet($this->cdata);
 
 1882                                $this->userObj->setCity($this->cdata);
 
 1886                                $this->userObj->setZipCode($this->cdata);
 
 1890                                $this->userObj->setCountry($this->cdata);
 
 1894                                $this->userObj->setPhoneOffice($this->cdata);
 
 1898                                $this->userObj->setPhoneHome($this->cdata);
 
 1902                                $this->userObj->setPhoneMobile($this->cdata);
 
 1906                                $this->userObj->setFax($this->cdata);
 
 1910                                $this->userObj->setHobby($this->cdata);
 
 1913                        case "GeneralInterest":
 
 1914                        case "OfferingHelp":
 
 1915                        case "LookingForHelp":
 
 1916                                $this->multi_values[$a_name][] = $this->cdata;                          
 
 1920                                $this->userObj->setComment($this->cdata);
 
 1924                                $this->userObj->setDepartment($this->cdata);
 
 1927                        case "Matriculation":
 
 1928                                $this->userObj->setMatriculation($this->cdata);
 
 1931                        case "ExternalAccount":
 
 1933                                $am = ($this->userObj->getAuthMode() == 
"default" || $this->userObj->getAuthMode() == 
"")
 
 1935                                        : $this->userObj->getAuthMode();
 
 1936                                $loginForExternalAccount = (trim($this->cdata) == 
"")
 
 1939                                switch ($this->action)
 
 1942                                                if ($loginForExternalAccount != 
"")
 
 1944                                                        $this->
logWarning($this->userObj->getLogin(), 
$lng->txt(
"usrimport_no_insert_ext_account_exists").
" (".$this->cdata.
")");
 
 1949                                                if ($loginForExternalAccount != 
"")
 
 1952                                                        if ($externalAccountHasChanged && trim($loginForExternalAccount) != trim($this->userObj->getLogin()))
 
 1954                                                                $this->
logWarning($this->userObj->getLogin(),
 
 1955                                                                        $lng->txt(
"usrimport_no_update_ext_account_exists").
" (".$this->cdata.
" for ".$loginForExternalAccount.
")");
 
 1961                                if ($externalAccountHasChanged)
 
 1962                                        $this->userObj->setExternalAccount(trim($this->cdata));
 
 1966                                if ($this->cdata != 
"true" 
 1967                                && $this->cdata != 
"false")
 
 1969                                        $this->
logFailure($this->userObj->getLogin(),
 
 1970                                                                          sprintf(
$lng->txt(
"usrimport_xml_element_content_illegal"),
"Active",$this->cdata));
 
 1972                                $this->currActive = $this->cdata;
 
 1974                        case "TimeLimitOwner":
 
 1975                                if (!preg_match(
"/\d+/", $this->cdata))
 
 1977                                        $this->
logFailure($this->userObj->getLogin(),
 
 1978                                                                          sprintf(
$lng->txt(
"usrimport_xml_element_content_illegal"),
"TimeLimitOwner",$this->cdata));
 
 1980                                elseif(!$ilAccess->checkAccess(
'cat_administrate_users',
'',$this->cdata))
 
 1982                                        $this->
logFailure($this->userObj->getLogin(),
 
 1983                                                                          sprintf(
$lng->txt(
"usrimport_xml_element_content_illegal"),
"TimeLimitOwner",$this->cdata));
 
 1985                                elseif($ilObjDataCache->lookupType($ilObjDataCache->lookupObjId($this->cdata)) != 
'cat' && !(
int) $this->cdata == 
USER_FOLDER_ID)
 
 1987                                        $this->
logFailure($this->userObj->getLogin(),
 
 1988                                                                          sprintf(
$lng->txt(
"usrimport_xml_element_content_illegal"),
"TimeLimitOwner",$this->cdata));
 
 1991                                $this->userObj->setTimeLimitOwner($this->cdata);
 
 1993                        case "TimeLimitUnlimited":
 
 1994                                switch (strtolower($this->cdata))
 
 1998                                                $this->userObj->setTimeLimitUnlimited(1);
 
 2002                                                $this->userObj->setTimeLimitUnlimited(0);
 
 2005                                                $this->
logFailure($this->userObj->getLogin(), sprintf(
$lng->txt(
"usrimport_xml_element_content_illegal"),
"TimeLimitUnlimited",$this->cdata));
 
 2009                        case "TimeLimitFrom":
 
 2011                                if (strtotime($this->cdata) === 
false && ! is_numeric($this->cdata))
 
 2013                                        $this->
logFailure($this->userObj->getLogin(), sprintf(
$lng->txt(
"usrimport_xml_element_content_illegal"),
"TimeLimitFrom",$this->cdata));
 
 2015                                $this->userObj->setTimeLimitFrom($this->cdata);
 
 2017                        case "TimeLimitUntil":
 
 2019                                if (strtotime($this->cdata) === 
false && ! is_numeric($this->cdata))
 
 2021                                        $this->
logFailure($this->userObj->getLogin(), sprintf(
$lng->txt(
"usrimport_xml_element_content_illegal"),
"TimeLimitUntil",$this->cdata));
 
 2023                                $this->userObj->setTimeLimitUntil($this->cdata);
 
 2025                        case "TimeLimitMessage":
 
 2026                                switch (strtolower($this->cdata))
 
 2029                                                $this->userObj->setTimeLimitMessage(1);
 
 2032                                                $this->userObj->setTimeLimitMessage(0);
 
 2035                                                $this->
logFailure($this->userObj->getLogin(), sprintf(
$lng->txt(
"usrimport_xml_element_content_illegal"),
"TimeLimitMessage",$this->cdata));
 
 2041                                if (strtotime($this->cdata) === 
false && ! is_numeric($this->cdata) && !$this->cdata == 
"0000-00-00 00:00:00")
 
 2043                                        $this->
logFailure($this->userObj->getLogin(), sprintf(
$lng->txt(
"usrimport_xml_element_content_illegal"),
"ApproveDate",$this->cdata));
 
 2048                                if (strtotime($this->cdata) === 
false && ! is_numeric($this->cdata) && !$this->cdata == 
"0000-00-00 00:00:00")
 
 2050                                        $this->
logFailure($this->userObj->getLogin(), sprintf(
$lng->txt(
"usrimport_xml_element_content_illegal"),
"AgreeDate",$this->cdata));
 
 2054                                if ($this->currentPrefKey != 
null)
 
 2055                                        $this->
verifyPref($this->currentPrefKey, $this->cdata);
 
 2056                                $this->currentPrefKey == 
null;
 
 2068                if($a_data != 
"\n") $a_data = preg_replace(
"/\t+/",
" ",$a_data);
 
 2070                if(strlen($a_data) > 0)
 
 2072                        $this->cdata .= $a_data;
 
 2099                if (! array_key_exists($aLogin, $this->protocol))
 
 2101                        $this->protocol[$aLogin] = array();
 
 2105                        $this->protocol[$aLogin][] = $aMessage;
 
 2120                if (! array_key_exists($aLogin, $this->protocol))
 
 2122                        $this->protocol[$aLogin] = array();
 
 2126                        $this->protocol[$aLogin][] = $aMessage;
 
 2140            $this->user_mapping[$userid] = array(
"login" => $aLogin, 
"action" => 
$action, 
"message" => 
"successful");
 
 2163                $block = 
new ilTemplate(
"tpl.usr_import_log_block.html", 
true, 
true, 
"Services/User");
 
 2164                $block->setVariable(
"TXT_LOG_TITLE", $a_log_title);
 
 2165                $block->setVariable(
"TXT_MESSAGE_ID", 
$lng->txt(
"login"));
 
 2166                $block->setVariable(
"TXT_MESSAGE_TEXT", 
$lng->txt(
"message"));
 
 2169                        $block->setCurrentBlock(
"log_row");
 
 2179                                        $reason = $reason.
"<br>".$message;
 
 2182                        $block->setVariable(
"MESSAGE_ID", $login);
 
 2183                        $block->setVariable(
"MESSAGE_TEXT", $reason);
 
 2184                        $block->parseCurrentBlock();
 
 2186                return $block->get();
 
 2220                if(
$_POST[
"send_mail"] != 
"" ||
 
 2221                        ($this->
isSendMail() && $this->userObj->getEmail() != 
""))
 
 2223                        $this->acc_mail->setUser($this->userObj);
 
 2226                        if($amail[
"att_file"])
 
 2228                                include_once 
"Services/User/classes/class.ilFSStorageUserFolder.php";
 
 2231                                $path = $fs->getAbsolutePath() . 
"/";
 
 2233                                $this->acc_mail->addAttachment(
$path . 
"/" . $amail[
"lang"], $amail[
"att_file"]);
 
 2235                        $this->acc_mail->send();
 
 2245                if(!isset(self::$account_mail_cache[$lang_key]))
 
 2247                        $default_lang_key = 
$GLOBALS[
"lng"]->getDefaultLanguage();
 
 2250                        include_once 
'./Services/User/classes/class.ilObjUserFolder.php';
 
 2254                        if (trim($amail[
"body"]) != 
"" && trim($amail[
"subject"]) != 
"")
 
 2256                                self::$account_mail_cache[$lang_key] = $amail;
 
 2260                                $lang_key = $default_lang_key;
 
 2263                        if(!isset(self::$account_mail_cache[$default_lang_key]))
 
 2266                                self::$account_mail_cache[$default_lang_key] = $amail;
 
 2269                return self::$account_mail_cache[$lang_key];
 
 2278            $this->send_mail = $value ? 
true: 
false;
 
 2298               $this->mapping_mode = $value;
 
 2299            else die (
"wrong argument using methode setUserMappingMethod in ".__FILE__);
 
 2322                if(is_array($this->required_fields))
 
 2324                        return $this->required_fields;
 
 2326                foreach(
$ilSetting->getAll() as $field => $value)
 
 2328                        if(substr($field,0,8) == 
'require_' and $value == 1)
 
 2330                                $value = substr($field,8);
 
 2331                                $this->required_fields[$value] = $value;
 
 2334                return $this->required_fields ? $this->required_fields : array();
 
 2347                include_once 
"Services/User/classes/class.ilUserProfile.php";
 
 2360                $fieldname = strtolower(trim($fieldname));
 
 2361                return array_key_exists($fieldname, $requiredFields);
 
 2366                    case 'mail_linebreak':
 
 2367                        case 'hits_per_page': 
 
 2368                                if (!is_numeric($value) || $value < 0)
 
 2369                                        $this->
logFailure(
"---", 
"Wrong value '$value': Positiv numeric value expected for preference $key.");
 
 2374                        case 'ilPageEditor_HTMLMode': 
 
 2375                        case 'ilPageEditor_JavaScript': 
 
 2376                        case 'ilPageEditor_MediaMode':
 
 2377                        case 'tst_javascript': 
 
 2378                        case 'tst_lastquestiontype': 
 
 2379                        case 'tst_multiline_answers':
 
 2380                        case 'tst_use_previous_answers':
 
 2381                        case 'graphicalAnswerSetting': 
 
 2382                        case 'priv_feed_pass': 
 
 2383                                $this->
logFailure(
"---", 
"Preference $key is not supported.");                          
 
 2386                        case 'public_country':
 
 2387                        case 'public_department':
 
 2388                        case 'public_email':
 
 2390                        case 'public_hobby':
 
 2391                        case 'public_institution':
 
 2392                        case 'public_matriculation':
 
 2393                        case 'public_phone':
 
 2394                        case 'public_phone_home':
 
 2395                        case 'public_phone_mobile':
 
 2396                        case 'public_phone_office':
 
 2397                        case 'public_street':
 
 2398                        case 'public_upload':
 
 2400                        case 'public_interests_general':
 
 2401                        case 'public_interests_help_offered':
 
 2402                        case 'public_interests_help_looking':
 
 2403                        case 'send_info_mails':
 
 2404                        case 'hide_own_online_status':
 
 2405                                if (!in_array($value, array(
'y', 
'n')))
 
 2406                                        $this->
logFailure(
"---", 
"Wrong value '$value': Value 'y' or 'n' expected for preference $key.");                               
 
 2408                        case 'public_profile':
 
 2409                                if (!in_array($value, array(
'y', 
'n', 
'g')))
 
 2410                                        $this->
logFailure(
"---", 
"Wrong value '$value': Value 'y', 'g' or 'n' expected for preference $key.");                          
 
 2412                        case 'show_users_online':
 
 2413                                if (!in_array($value, array(
'y', 
'n', 
'associated')))
 
 2414                                        $this->
logFailure(
"---", 
"Wrong value '$value': Value 'y' or 'n' or 'associated' expected for preference $key.");
 
 2416                        case 'mail_incoming_type':
 
 2417                            if (!in_array((
int) $value, array(
"0",
"1",
"2")))
 
 2418                                $this->
logFailure(
"---", 
"Wrong value '$value': Value \"0\" (LOCAL),\"1\" (EMAIL) or \"2\" (BOTH) expected for preference $key.");
 
 2421                            if (!in_array($value, array (
"0",
"1")))
 
 2422                                $this->
logFailure(
"---", 
"Wrong value '$value': Value \"0\" (Sunday) or \"1\" (Monday) expected for preference $key.");
 
 2425                        case 'mail_signature':
 
 2428                                include_once(
'Services/Calendar/classes/class.ilTimeZone.php');
 
 2433                                        $this->
logFailure(
"---", 
"Wrong value '$value': Invalid timezone $value detected for preference $key.");                                        
 
 2438                                $this->
logFailure(
"---", 
"Preference $key is not supported.");                          
 
 2444            if (array_key_exists(
"mail_incoming_type", $this->prefs) || 
 
 2445                array_key_exists(
"mail_signature", $this->prefs) ||
 
 2446                array_key_exists(
"mail_linebreak", $this->prefs)
 
 2449                include_once(
"Services/Mail/classes/class.ilMailOptions.php"); 
 
 2451                $mailOptions->updateOptions(    
 
 2452                    array_key_exists(
"mail_signature", $this->prefs) ? $this->prefs[
"mail_signature"] : $mailOptions->getSignature(),
 
 2453                    array_key_exists(
"mail_linebreak", $this->prefs) ? $this->prefs[
"mail_linebreak"] : $mailOptions->getLinebreak(),
 
 2454                    array_key_exists(
"mail_incoming_type", $this->prefs) ? $this->prefs[
"mail_incoming_type"] : $mailOptions->getIncomingType(),
 
 2455                    $mailOptions->getCronjobNotification()
 
foreach($mandatory_scripts as $file) $timestamp
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
Class UserMail this class handles user mails.
_lookupActivatedStyle($a_skin, $a_style)
lookup if a style is activated
_lookupNewAccountMail($a_lang)
static _dropDesktopItem($a_usr_id, $a_item_id, $a_type)
drop an item from user's personal desktop
_uploadPersonalPicture($tmp_file, $obj_id)
Create a personal picture image file from a temporary image file.
_lookupLogin($a_user_id)
lookup login
_lookupExternalAccount($a_user_id)
lookup external account for login and authmethod
getUserIdByLogin($a_login)
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 _checkExternalAuthAccount($a_auth, $a_account)
check whether external account and authentication method matches with a user
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
Base class for sax-based expat parsing extended classes need to overwrite the method setHandlers and ...
parses the template.xml that defines all styles of the current template
static _getAllTemplates()
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.
getUserCount()
get count of User elements
isFieldRequired($fieldname)
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.
ilUserImportParser($a_xml_file='', $a_mode=IL_USER_IMPORT, $a_conflict_rule=IL_FAIL_ON_CONFLICT)
Constructor.
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
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.
readAccountMailFromCache($lang_key)
$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()
Create a temporary file in an ILIAS writable directory.
static __extractId($ilias_id, $inst_id)
extract ref id from role title, e.g.