%PDF- %PDF-
Direktori : /proc/self/root/home/bitrix/www/local/components/UB/main.profile/ |
Current File : //proc/self/root/home/bitrix/www/local/components/UB/main.profile/component.php |
<?if(!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) die(); global $USER_FIELD_MANAGER; $arResult["ID"] = intval($USER->GetID()); $arResult["GROUP_POLICY"] = CUser::GetGroupPolicy($arResult["ID"]); $arParams['SEND_INFO'] = $arParams['SEND_INFO'] == 'Y' ? 'Y' : 'N'; $arParams['CHECK_RIGHTS'] = $arParams['CHECK_RIGHTS'] == 'Y' ? 'Y' : 'N'; if(!($arParams['CHECK_RIGHTS'] == 'N' || $USER->CanDoOperation('edit_own_profile')) || $arResult["ID"]<=0) { $APPLICATION->ShowAuthForm(""); return; } $strError = ''; $exper = GetMessage("SELECT_EXPERIENCE"); $country = GetMessage("SELECT_THE_COUNTRY"); $usr_id = $USER->GetID(); // аккаунт if (CModule::IncludeModule("iblock")) { // Подгружаем данные из профиля (если профиль существует) $res = CIBlockElement::GetList(array(), array("IBLOCK_ID"=>IBLOCK_PROFILE_ID, "PROPERTY_ACCOUNT"=>$usr_id, 'SHOW_NEW'=>'Y'), false, false, array("IBLOCK_ID", "ID", "IBLOCK_SECTION_ID", "NAME", "CODE", "PROPERTY_REGION", "PROPERTY_COUNTRY", "PROPERTY_STAGE", "PROPERTY_TYPE", "PROPERTY_TYPE_P4", "PROPERTY_SEX", "PROPERTY_LANGUAGE", "DETAIL_PICTURE")); if($ar_fields = $res->GetNext()) { $prof_id = $ar_fields["ID"]; $arResult["arUser_prof"]["TYPE"] = $ar_fields["PROPERTY_TYPE_VALUE"]; $arResult["arUser_prof"]["TYPE_P4"] = $ar_fields["PROPERTY_TYPE_P4_VALUE"]; $arResult["arUser_prof"]["NAME"] = $ar_fields["NAME"]; $arResult["arUser_prof"]["CODE"] = $ar_fields["CODE"]; $arResult["arUser_prof"]["IBLOCK_SECTION_ID"] = $ar_fields["IBLOCK_SECTION_ID"]; $arResult["arUser_prof"]["CITY"] = $ar_fields["PROPERTY_REGION_VALUE"]; $arResult["arUser_prof"]["COUNTRY"] = $ar_fields["PROPERTY_COUNTRY_VALUE"]; $arResult["arUser_prof"]["STAGE"] = $ar_fields["PROPERTY_STAGE_ENUM_ID"]; $arResult["arUser_prof"]["SEX"] = $ar_fields["PROPERTY_SEX_ENUM_ID"]; $arResult["arUser_prof"]["LANGUAGE"] = $ar_fields["PROPERTY_LANGUAGE_ENUM_ID"]; $arResult["arUser_prof"]["DETAIL_PICTURE"] = $ar_fields["DETAIL_PICTURE"]; } } if($_SERVER["REQUEST_METHOD"]=="POST" && ($_REQUEST["save"] <>'' || $_REQUEST["apply"] <> '') && check_bitrix_sessid()) { if(COption::GetOptionString('main', 'use_encrypted_auth', 'N') == 'Y') { $sec = new CRsaSecurity(); if(($arKeys = $sec->LoadKeys())) { $sec->SetKeys($arKeys); $errno = $sec->AcceptFromForm(array('NEW_PASSWORD', 'NEW_PASSWORD_CONFIRM')); if($errno == CRsaSecurity::ERROR_SESS_CHECK) $strError .= GetMessage("main_profile_sess_expired").'<br />'; elseif($errno < 0) $strError .= GetMessage("main_profile_decode_err", array("#ERRCODE#"=>$errno)).'<br />'; } } if($strError=='') { $bOk = false; $isCustomer = false; $obUser = new CUser; $arPERSONAL_PHOTO = $_FILES["PERSONAL_PHOTO"]; $arWORK_LOGO = $_FILES["WORK_LOGO"]; $rsUser = CUser::GetByID($arResult["ID"]); $arUser = $rsUser->Fetch(); if($arUser) { $arPERSONAL_PHOTO["old_file"] = $arUser["PERSONAL_PHOTO"]; $arPERSONAL_PHOTO["del"] = $_REQUEST["PERSONAL_PHOTO_del"]; $arWORK_LOGO["old_file"] = $arUser["WORK_LOGO"]; $arWORK_LOGO["del"] = $_REQUEST["WORK_LOGO_del"]; $isCustomer = $arUser['UF_USR']==USR_CUSTOMER; } $pers_mob = strpos($_REQUEST["PERSONAL_MOBILE"], "_") !== false ? "" : preg_replace('/[^0-9+]/', '', $_REQUEST["PERSONAL_MOBILE"]); $pers_phone = strpos($_REQUEST["PERSONAL_PHONE"], "_") !== false ? "" : preg_replace('/[^0-9+]/', '', $_REQUEST["PERSONAL_PHONE"]); $arFields = array( "NAME" => $_REQUEST["NAME"], "LAST_NAME" => $_REQUEST["LAST_NAME"], "PERSONAL_PROFESSION" => $_REQUEST["PERSONAL_PROFESSION"], "SECOND_NAME" => $_REQUEST["PROFILE_NAME"], "EMAIL" => $_REQUEST["EMAIL"], "LOGIN" => $_REQUEST["LOGIN"], "PERSONAL_PROFESSION" => $_REQUEST["PERSONAL_PROFESSION"], "PERSONAL_WWW" => $_REQUEST["PERSONAL_WWW"], "PERSONAL_ICQ" => $_REQUEST["PERSONAL_ICQ"], "PERSONAL_GENDER" => $_REQUEST["PERSONAL_GENDER"], "PERSONAL_BIRTHDAY" => $_REQUEST["PERSONAL_BIRTHDAY"], "PERSONAL_PHOTO" => $arPERSONAL_PHOTO, "PERSONAL_PHONE" => $pers_phone, "PERSONAL_FAX" => $_REQUEST["PERSONAL_FAX"], "PERSONAL_MOBILE" => $pers_mob, "PERSONAL_PAGER" => $_REQUEST["PERSONAL_PAGER"], "PERSONAL_STREET" => $_REQUEST["PERSONAL_STREET"], "PERSONAL_MAILBOX" => $_REQUEST["PERSONAL_MAILBOX"], "PERSONAL_CITY" => $_REQUEST["PROF_PERSONAL_CITY"], "PERSONAL_STATE" => $_REQUEST["PERSONAL_STATE"], "PERSONAL_ZIP" => $_REQUEST["PERSONAL_ZIP"], "PERSONAL_COUNTRY" => $_REQUEST["PERSONAL_COUNTRY"], "PERSONAL_NOTES" => $_REQUEST["PERSONAL_NOTES"], "WORK_COMPANY" => $_REQUEST["WORK_COMPANY"], "WORK_DEPARTMENT" => $_REQUEST["WORK_DEPARTMENT"], "WORK_POSITION" => $_REQUEST["WORK_POSITION"], "WORK_WWW" => $_REQUEST["WORK_WWW"], "WORK_PHONE" => $_REQUEST["WORK_PHONE"], "WORK_FAX" => $_REQUEST["WORK_FAX"], "WORK_PAGER" => $_REQUEST["WORK_PAGER"], "WORK_STREET" => $_REQUEST["WORK_STREET"], "WORK_MAILBOX" => $_REQUEST["WORK_MAILBOX"], "WORK_CITY" => $_REQUEST["WORK_CITY"], "WORK_STATE" => $_REQUEST["WORK_STATE"], "WORK_ZIP" => $_REQUEST["WORK_ZIP"], "WORK_COUNTRY" => $_REQUEST["WORK_COUNTRY"], "WORK_PROFILE" => $_REQUEST["WORK_PROFILE"], "WORK_LOGO" => $arWORK_LOGO, "WORK_NOTES" => $_REQUEST["WORK_NOTES"], "AUTO_TIME_ZONE" => ($_REQUEST["AUTO_TIME_ZONE"] == "Y" || $_REQUEST["AUTO_TIME_ZONE"] == "N"? $_REQUEST["AUTO_TIME_ZONE"] : ""), "PROFILE_NAME" => $_REQUEST["PROFILE_NAME"], "CAT_PROF" => $_REQUEST["CAT_PROF"], "PROF_PERSONAL_CITY" => $_REQUEST["PROF_PERSONAL_CITY"], "PROF_PERSONAL_STATE" => $_REQUEST["PROF_PERSONAL_STATE"], "SEX" => $_REQUEST["SEX"], "LANGUAGE" => $_REQUEST["LANGUAGE"], "STAGE" => $_REQUEST["STAGE"], "TYPE_P4" => isset($_REQUEST["SINGLE_PROFILE"]) ? ProfileTypeHelper::DEFAULT_ID_P4 : "", "UF_SOCIAL" => $_REQUEST["UF_SOCIAL"], "UF_HIDECONT" => $_REQUEST["UF_HIDECONT"] ); if(isset($_REQUEST["TIME_ZONE"])) $arFields["TIME_ZONE"] = $_REQUEST["TIME_ZONE"]; if($arUser) { if($arUser['EXTERNAL_AUTH_ID'] <> '') { $arFields['EXTERNAL_AUTH_ID'] = $arUser['EXTERNAL_AUTH_ID']; } } if($USER->IsAdmin()) { $arFields["ADMIN_NOTES"] = $_REQUEST["ADMIN_NOTES"]; } if($_REQUEST["NEW_PASSWORD"] <> '' && $arUser['EXTERNAL_AUTH_ID'] == '') { $arFields["PASSWORD"] = $_REQUEST["NEW_PASSWORD"]; $arFields["CONFIRM_PASSWORD"] = $_REQUEST["NEW_PASSWORD_CONFIRM"]; } $USER_FIELD_MANAGER->EditFormAddFields("USER", $arFields); if(!$obUser->Update($arResult["ID"], $arFields, true)) $strError .= $obUser->LAST_ERROR; } if($strError == '' && !$isCustomer) { // Обрабатываем символьный код (адрес страницы) if (strlen($_REQUEST['PROFILE_CODE'])>0) $trans = Cutil::translit($_REQUEST["PROFILE_CODE"],"ru"); // приводим к битриксовому виду (и исправляем ошибки ручного ввода) else $trans = Cutil::translit($_REQUEST["PROFILE_NAME"],"ru"); $arCodeFiler = $prof_id ? Array("IBLOCK_ID"=>2, "CODE"=>$trans, "!ID" => $prof_id) : Array("CODE"=>$trans); $res = CIBlockElement::GetList(Array(), $arCodeFiler); if($ar_fields = $res->GetNext()) { $strError .= GetMessage("PAGE_ADDRESS_IS_NOT_AVAILABLE_SELECT_A_DIFFERENT_VALUE").'<br/>'; } $arFields['CODE'] = $trans; } if($strError == '' && !$isCustomer) { // Заполним Профиль в ИБ $el = new CIBlockElement; $PROP = array(); $PROP[62] = $arFields["PROF_PERSONAL_CITY"]; $PROP[107] = $arFields["PERSONAL_COUNTRY"]; $PROP[109] = $usr_id; $PROP[38] = $arFields["SEX"]; $PROP[180] = $arFields["TYPE_P4"]; $PROP[61] = $arFields["LANGUAGE"]; $PROP[40] = $arFields["STAGE"]; $PROP[35] = $arFields["NAME"]; $PROP[36] = $arFields["LAST_NAME"]; $PROP[37] = $arFields['PERSONAL_BIRTHDAY']; $PROP[39] = getAgeByBirthDate($arFields['PERSONAL_BIRTHDAY']); $arLoadProductArray = Array( "MODIFIED_BY" => $USER->GetID(), "IBLOCK_SECTION_ID" => $arFields["CAT_PROF"], "IBLOCK_ID" => 2, /* "PROPERTY_VALUES"=> $PROP, эдило-мудило - так нельзя тут! */ "NAME" => $arFields["PROFILE_NAME"], "CODE" => $arFields['CODE'], "ACTIVE" => "Y" ); if($prof_id) { //unset($arLoadProductArray["CODE"]); $res = $el->Update($prof_id, $arLoadProductArray); CIBlockElement::SetPropertyValuesEx($prof_id, 2, $PROP); if($res) { $arResult["arUser_prof"]["NAME"] = $arFields["PROFILE_NAME"]; $arResult["arUser_prof"]["CITY"] = $arFields["PROF_PERSONAL_CITY"]; $arResult["arUser_prof"]["COUNTRY"] = $arFields["PERSONAL_COUNTRY"]; $arResult["arUser_prof"]["STAGE"] = $arFields["STAGE"]; $arResult["arUser_prof"]["TYPE_P4"] = $arFields["TYPE_P4"]; $arResult["arUser_prof"]["SEX"] = $arFields["SEX"]; $arResult["arUser_prof"]["LANGUAGE"] = $arFields["LANGUAGE"]; $arResult["arUser_prof"]["CODE"] = $arFields["CODE"]; $ipropValues = new \Bitrix\Iblock\InheritedProperty\ElementValues(2, $prof_id); $ipropValues->clearValues(); } } else { $rsUser = CUser::GetByID($usr_id); if ( ($arUser=$rsUser->Fetch()) && $arUser["PERSONAL_PHOTO"]>0) { // Копируем аватар в профиль $arLoadProductArray['DETAIL_PICTURE'] = CFile::MakeFileArray($arUser["PERSONAL_PHOTO"]); } $PROP[34] = ProfileTypeHelper::DEFAULT_ID_UB; // Тип аккаунта if (intval($arFields["CAT_PROF"]) == 7){ $PROP[177] = 259; // Тип модели }; $arLoadProductArray['PROPERTY_VALUES'] = $PROP; if($PRODUCT_ID = $el->Add($arLoadProductArray)) { $arResult["PROF_ID"] = $PRODUCT_ID; // CIBlockElement::SetPropertyValuesEx($PRODUCT_ID, 2, $PROP); $res = CIBlockElement::GetList(array(), array("IBLOCK_ID"=>2, "ID"=>$PRODUCT_ID), false, false, array("IBLOCK_ID", "ID", "NAME", "PROPERTY_REGION", "", "PROPERTY_COUNTRY", "PROPERTY_STAGE", "PROPERTY_SEX", "PROPERTY_LANGUAGE")); if($ar_fields = $res->GetNext()) { $arResult["arUser_prof"]["NAME"] = $ar_fields["NAME"]; $arResult["arUser_prof"]["CITY"] = $ar_fields["PROPERTY_REGION_VALUE"]; $arResult["arUser_prof"]["COUNTRY"] = $ar_fields["PROPERTY_COUNTRY_VALUE"]; $arResult["arUser_prof"]["STAGE"] = $ar_fields["PROPERTY_STAGE_ENUM_ID"]; $arResult["arUser_prof"]["SEX"] = $ar_fields["PROPERTY_SEX_ENUM_ID"]; $arResult["arUser_prof"]["LANGUAGE"] = $ar_fields["PROPERTY_LANGUAGE_ENUM_ID"]; $arResult["arUser_prof"]["CODE"] = $arFields["CODE"]; } $prof_id = $PRODUCT_ID; } } $obUser->Update($arResult["ID"], $arFields, true); // Найдём раздел портфолио пользователя, если нет, создадим $portf_f = false; // if ($PRODUCT_ID>0) $prof_id = $PRODUCT_ID; $db_list = CIBlockSection::GetList(Array(), array("IBLOCK_ID"=>4, "DEPTH_LEVEL"=>1), false, array("IBLOCK_ID", "ID", "UF_PORTF_USR")); while($ar_result = $db_list->GetNext()) { if($ar_result['UF_PORTF_USR']==$prof_id) { $portf_f = true; $s_name=$ar_result["NAME"]; $s_id=$ar_result["ID"]; } } if (!$portf_f) { $bs = new CIBlockSection; $ID = $bs->Add(array("IBLOCK_ID"=>4, "ACTIVE"=>"Y", "NAME"=>$arResult["arUser_prof"]["NAME"], "UF_PORTF_USR"=>$prof_id)); // $ID2 = $bs->Add(array("IBLOCK_ID"=>4, "ACTIVE"=>"Y", "NAME"=>"Фотоальбом", "IBLOCK_SECTION_ID" => $ID)); } elseif($s_name!=$arResult["arUser_prof"]["NAME"]) { $bs = new CIBlockSection; $res = $bs->Update($s_id, array("NAME"=>$arResult["arUser_prof"]["NAME"])); } } if($strError == '' && !$isCustomer) { if (CModule::IncludeModule("forum")) { $APPLICATION->ResetException(); $arforumFields = array( "SHOW_NAME" => ($_REQUEST["forum_SHOW_NAME"]=="Y") ? "Y" : "N", "DESCRIPTION" => $_REQUEST["forum_DESCRIPTION"], "INTERESTS" => $_REQUEST["forum_INTERESTS"], "SIGNATURE" => $_REQUEST["forum_SIGNATURE"], "AVATAR" => $_FILES["forum_AVATAR"] ); $arforumFields["AVATAR"]["del"] = $_REQUEST["forum_AVATAR_del"]; $ar_res = CForumUser::GetByUSER_ID($arResult["ID"]); if ($ar_res) { $arforumFields["AVATAR"]["old_file"] = $ar_res["AVATAR"]; $FORUM_USER_ID = IntVal($ar_res["ID"]); $FORUM_USER_ID1 = CForumUser::Update($FORUM_USER_ID, $arforumFields); $forum_res = (IntVal($FORUM_USER_ID1)>0); } else { $arforumFields["USER_ID"] = $arResult["ID"]; $FORUM_USER_ID = CForumUser::Add($arforumFields); $forum_res = (IntVal($FORUM_USER_ID)>0); } if($ex = $APPLICATION->GetException()) $strError = $ex->GetString(); } } // Обработка блога if($strError == '' && !$isCustomer) { if (CModule::IncludeModule("blog")) { // Персональный блог $arBlog = CBlog::GetByOwnerID($arResult['ID'],array(3)); if(is_array($arBlog)) { // обновляем $arBlogFields = array( "NAME" => $arFields["PROFILE_NAME"], "URL" => $arFields['CODE'], "=DATE_UPDATE" => $DB->CurrentTimeFunction(), ); $updateBlogID = CBlog::Update($arBlog['ID'], $arBlogFields); if(intval($updateBlogID)>0) { } else { if ($ex = $APPLICATION->GetException()) $strError .= GetMessage("FAILED_TO_CHANGE_THE_BLOG").': '.$ex->GetString().'<br/>'; else $strError .= GetMessage("FAILED_TO_CHANGE_THE_BLOG").'<br/>'; } } else { // создаем блог $arBlogFields = array( "NAME" => $arFields["PROFILE_NAME"], "DESCRIPTION" => '', "GROUP_ID" => '3', "ENABLE_COMMENTS" => 'Y', "EMAIL_NOTIFY" => 'Y', "ENABLE_RSS" => 'N', "URL" => $arFields['CODE'], "ACTIVE" => "Y", "OWNER_ID" => $arResult['ID'] ); $newBlogID = CBlog::Add($arBlogFields); if(intval($newBlogID)>0) { // даем права на посты $arBlogPerms = array( "1" => BLOG_PERMS_READ, "2" => BLOG_PERMS_READ ); CBlog::SetBlogPerms($newBlogID, $arBlogPerms, BLOG_PERMS_POST); // даем права на комменты $arBlogPerms = array( "1" => BLOG_PERMS_READ, "2" => BLOG_PERMS_WRITE ); CBlog::SetBlogPerms($newBlogID, $arBlogPerms, BLOG_PERMS_COMMENT); } else { if ($ex = $APPLICATION->GetException()) $strError .= GetMessage("FAILED_TO_CREATE_THE_BLOG").': '.$ex->GetString().'<br/>'; else $strError .= GetMessage("FAILED_TO_CREATE_THE_BLOG").'<br/>'; } } // Пользователь блога $APPLICATION->ResetException(); $arblogFields = array( "ALIAS" => $_REQUEST["PROFILE_NAME"], "DESCRIPTION" => $_REQUEST["blog_DESCRIPTION"], "INTERESTS" => $_REQUEST["blog_INTERESTS"], "AVATAR" => $_FILES["blog_AVATAR"] ); $arblogFields["AVATAR"]["del"] = $_REQUEST["blog_AVATAR_del"]; $ar_res = CBlogUser::GetByID($arResult["ID"], BLOG_BY_USER_ID); if ($ar_res) { $arblogFields["AVATAR"]["old_file"] = $ar_res["AVATAR"]; $BLOG_USER_ID = intval($ar_res["ID"]); $BLOG_USER_ID1 = CBlogUser::Update($BLOG_USER_ID, $arblogFields); $blog_res = (intval($BLOG_USER_ID1)>0); } else { $arblogFields["USER_ID"] = $arResult["ID"]; $arblogFields["~DATE_REG"] = CDatabase::CurrentTimeFunction(); $BLOG_USER_ID = CBlogUser::Add($arblogFields); $blog_res = (intval($BLOG_USER_ID)>0); } if($ex = $APPLICATION->GetException()) $strError = $ex->GetString(); } } if(CModule::IncludeModule("learning") && $strError == '') { $arStudentFields = array( "RESUME" => $_REQUEST["student_RESUME"], "PUBLIC_PROFILE" => ($_REQUEST["student_PUBLIC_PROFILE"]=="Y" ? "Y" : "N") ); $ar_res = CStudent::GetList(array(), array("USER_ID" => $arResult["ID"])); if ($arStudent = $ar_res->Fetch()) { $learning_res = CStudent::Update($arResult["ID"], $arStudentFields); } else { $arStudentFields["USER_ID"] = $arResult["ID"]; $STUDENT_USER_ID = CStudent::Add($arStudentFields); $learning_res = (intval($STUDENT_USER_ID)>0); } } if($strError == '') { if($arParams['SEND_INFO'] == 'Y') $obUser->SendUserInfo($arResult["ID"], SITE_ID, GetMessage("ACCOUNT_UPDATE"), true); $bOk = true; } } $rsUser = CUser::GetByID($arResult["ID"]); if(!($arResult["arUser"] = $rsUser->GetNext(false))) { $arResult["ID"] = 0; } elseif ($arResult["arUser"]['UF_USR']==USR_CUSTOMER) $arResult["arUser_prof"]["CITY"] = intval($arResult["arUser"]["PERSONAL_CITY"]); // Найдём Регион / Штат $res = CIBlockElement::GetByID($arResult["arUser_prof"]["CITY"]); if($ar_res = $res->GetNext()) $arResult["arUser_prof"]["RN"] = $ar_res["IBLOCK_SECTION_ID"]; // Определим, не страна ли это $res = CIBlockSection::GetByID($arResult["arUser_prof"]["RN"]); if($ar_res = $res->GetNext()) { if($ar_res["DEPTH_LEVEL"]<=1) $arResult["arUser_prof"]["RN"] = ""; } if (CModule::IncludeModule("blog")) { $arResult["INCLUDE_BLOG"] = "Y"; $arResult["arBlogUser"] = array(); $arBlg = CBlogUser::GetByID($arResult["ID"], BLOG_BY_USER_ID); if(is_array($arBlg)) { foreach($arBlg as $key => $val) { $arResult["arBlogUser"]["~".$key] = $val; $arResult["arBlogUser"][$key] = htmlspecialcharsbx($val); } } if (!isset($arResult["arBlogUser"]["ALLOW_POST"]) || ($arResult["arBlogUser"]["ALLOW_POST"]!="Y" && $arResult["arBlogUser"]["ALLOW_POST"]!="N")) $arResult["arBlogUser"]["ALLOW_POST"] = "Y"; } if (CModule::IncludeModule("forum")) { $arResult["INCLUDE_FORUM"] = "Y"; $rsForumUser = CForumUser::GetList(array(), array("USER_ID" => $arResult["ID"])); $arResult["arForumUser"] = $rsForumUser->GetNext(false); if (!isset($arResult["arForumUser"]["ALLOW_POST"]) || ($arResult["arForumUser"]["ALLOW_POST"]!="Y" && $arResult["arForumUser"]["ALLOW_POST"]!="N")) $arResult["arForumUser"]["ALLOW_POST"] = "Y"; } if (CModule::IncludeModule("learning")) { $arResult["INCLUDE_LEARNING"] = "Y"; $dbStudent = CStudent::GetList(array(), array("USER_ID" => $arResult["ID"])); $arResult["arStudent"] = $dbStudent->GetNext(); if (!isset($arResult["arStudent"]["PUBLIC_PROFILE"]) || ($arResult["arStudent"]["PUBLIC_PROFILE"]!="Y" && $arResult["arStudent"]["PUBLIC_PROFILE"]!="N")) $arResult["arStudent"]["PUBLIC_PROFILE"] = "N"; } if($strError <> '') { foreach($_POST as $k=>$val) { if(!is_array($val)) { $arResult["arUser"][$k] = htmlspecialcharsex($val); $arResult["arForumUser"][$k] = htmlspecialcharsex($val); } else { $arResult["arUser"][$k] = $val; $arResult["arForumUser"][$k] = $val; } } } $arResult["FORM_TARGET"] = $APPLICATION->GetCurPage(); $arResult["arUser"]["PERSONAL_PHOTO_INPUT"] = CFile::InputFile("PERSONAL_PHOTO", 20, $arResult["arUser"]["PERSONAL_PHOTO"], false, 0, "IMAGE"); if (strlen($arResult["arUser"]["PERSONAL_PHOTO"])>0) $arResult["arUser"]["PERSONAL_PHOTO_HTML"] = CFile::ShowImage($arResult["arUser"]["PERSONAL_PHOTO"], 150, 150, "border=0", "", true); $arResult["arUser"]["WORK_LOGO_INPUT"] = CFile::InputFile("WORK_LOGO", 20, $arResult["arUser"]["WORK_LOGO"], false, 0, "IMAGE"); if (strlen($arResult["arUser"]["WORK_LOGO"])>0) $arResult["arUser"]["WORK_LOGO_HTML"] = CFile::ShowImage($arResult["arUser"]["WORK_LOGO"], 150, 150, "border=0", "", true); $arResult["arUser"]["WORK_LOGO_INPUT"] = CFile::InputFile("WORK_LOGO", 20, $arResult["arUser"]["WORK_LOGO"], false, 0, "IMAGE"); if (strlen($arResult["arUser"]["WORK_LOGO"])>0) $arResult["arUser"]["WORK_LOGO_HTML"] = CFile::ShowImage($arResult["arUser"]["WORK_LOGO"], 150, 150, "border=0", "", true); $arResult["arForumUser"]["AVATAR_INPUT"] = CFile::InputFile("forum_AVATAR", 20, $arResult["arForumUser"]["AVATAR"], false, 0, "IMAGE"); if (strlen($arResult["arForumUser"]["AVATAR"])>0) $arResult["arForumUser"]["AVATAR_HTML"] = CFile::ShowImage($arResult["arForumUser"]["AVATAR"], 150, 150, "border=0", "", true); $arResult["arBlogUser"]["AVATAR_INPUT"] = CFile::InputFile("blog_AVATAR", 20, $arResult["arBlogUser"]["AVATAR"], false, 0, "IMAGE"); if (strlen($arResult["arBlogUser"]["AVATAR"])>0) $arResult["arBlogUser"]["AVATAR_HTML"] = CFile::ShowImage($arResult["arBlogUser"]["AVATAR"], 150, 150, "border=0", "", true); $arResult["IS_ADMIN"] = $USER->IsAdmin(); if (CModule::IncludeModule("iblock")) { // Найдём массив стран $ar_ref = array(); $ar_ref_id = array(); $db_list = CIBlockSection::GetList(Array("sort"=>"asc","name"=>"asc"), Array("IBLOCK_ID"=>6, "ACTIVE"=>"Y", "DEPTH_LEVEL"=>1)); while($ar_result = $db_list->GetNext()) { $ar_ref[] = $ar_result['NAME']; $ar_ref_id[] = $ar_result['ID']; } $arCountries = array('reference_id'=>$ar_ref_id, 'reference'=>$ar_ref); // Найдём массив Опыт работы $ar_stage = array(); $ar_stage_n = array(); $ar_stage_id = array(); $property_enums = CIBlockPropertyEnum::GetList(Array("SORT"=>"ASC"), Array("IBLOCK_ID"=>2, "CODE"=>"STAGE")); if (SITE_ID == "dv") {$ar_stage_n = array('less than 1 year', '1-2 years', '3-5 years', 'more than 5 years', ); while($enum_fields = $property_enums->GetNext()){ $ar_stage_id[] = $enum_fields["ID"]; }; } else {while($enum_fields = $property_enums->GetNext()){ $ar_stage_n[] = htmlspecialchars_decode($enum_fields["VALUE"]); $ar_stage_id[] = $enum_fields["ID"]; }; }; $ar_stage = array('reference_id'=>$ar_stage_id, 'reference'=>$ar_stage_n); } $arResult["arUser_prof"]["ARSTAGE"] = SelectBoxFromArray("STAGE", $ar_stage, $arResult["arUser_prof"]["STAGE"], " ", "data-placeholder='$exper'"); $arResult["COUNTRY_SELECT"] = SelectBoxFromArray("PERSONAL_COUNTRY", $arCountries, $arResult["arUser"]["PERSONAL_COUNTRY"], " "/*GetMessage("USER_DONT_KNOW")*/, "data-placeholder='$country' data-required='desc-country'"); $arResult["COUNTRY_SELECT_WORK"] = SelectBoxFromArray("WORK_COUNTRY", $arCountries, $arResult["arUser"]["WORK_COUNTRY"], GetMessage("USER_DONT_KNOW")); $arResult["strProfileError"] = $strError; $arResult["BX_SESSION_CHECK"] = bitrix_sessid_post(); $arResult["DATE_FORMAT"] = CLang::GetDateFormat("SHORT"); $arResult["COOKIE_PREFIX"] = COption::GetOptionString("main", "cookie_name", "BITRIX_SM"); if (strlen($arResult["COOKIE_PREFIX"]) <= 0) $arResult["COOKIE_PREFIX"] = "BX"; // ********************* User properties *************************************************** $arResult["USER_PROPERTIES"] = array("SHOW" => "N"); if (!empty($arParams["USER_PROPERTY"])) { $arUserFields = $USER_FIELD_MANAGER->GetUserFields("USER", $arResult["ID"], LANGUAGE_ID); if (count($arParams["USER_PROPERTY"]) > 0) { foreach ($arUserFields as $FIELD_NAME => $arUserField) { if (!in_array($FIELD_NAME, $arParams["USER_PROPERTY"])) continue; $arUserField["EDIT_FORM_LABEL"] = strLen($arUserField["EDIT_FORM_LABEL"]) > 0 ? $arUserField["EDIT_FORM_LABEL"] : $arUserField["FIELD_NAME"]; $arUserField["EDIT_FORM_LABEL"] = htmlspecialcharsEx($arUserField["EDIT_FORM_LABEL"]); $arUserField["~EDIT_FORM_LABEL"] = $arUserField["EDIT_FORM_LABEL"]; $arResult["USER_PROPERTIES"]["DATA"][$FIELD_NAME] = $arUserField; } } if (!empty($arResult["USER_PROPERTIES"]["DATA"])) $arResult["USER_PROPERTIES"]["SHOW"] = "Y"; $arResult["bVarsFromForm"] = ($strError == ''? false : true); } // ******************** /User properties *************************************************** if($arParams["SET_TITLE"] == "Y") $APPLICATION->SetTitle(GetMessage("PROFILE_DEFAULT_TITLE")); if($bOk) $arResult['DATA_SAVED'] = 'Y'; //time zones $arResult["TIME_ZONE_ENABLED"] = CTimeZone::Enabled(); if($arResult["TIME_ZONE_ENABLED"]) $arResult["TIME_ZONE_LIST"] = CTimeZone::GetZones(); //secure authorization $arResult["SECURE_AUTH"] = false; if(!CMain::IsHTTPS() && COption::GetOptionString('main', 'use_encrypted_auth', 'N') == 'Y') { $sec = new CRsaSecurity(); if(($arKeys = $sec->LoadKeys())) { $sec->SetKeys($arKeys); $sec->AddToForm('form1', array('NEW_PASSWORD', 'NEW_PASSWORD_CONFIRM')); $arResult["SECURE_AUTH"] = true; } } //socialservices $arResult["SOCSERV_ENABLED"] = IsModuleInstalled("socialservices"); $templateName = $arResult["arUser"]['UF_USR']==USR_CUSTOMER?'template_customer': (isCompany()?'template_company':'template_profi'); $this->IncludeComponentTemplate($templateName); //echo '<pre>'; print_r($strError); echo '</pre>';?>