本文整理汇总了PHP中CUser::Update方法的典型用法代码示例。如果您正苦于以下问题:PHP CUser::Update方法的具体用法?PHP CUser::Update怎么用?PHP CUser::Update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CUser
的用法示例。
在下文中一共展示了CUser::Update方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: OnSalePayOrderHandler
/**
* Обработчик события подтверждения оплаты товара
*/
function OnSalePayOrderHandler($id, $val)
{
$currentUserId = $GLOBALS['USER']->GetID();
//Идентификатор текущего пользователя, по идее администратор
$idRatingGroup = 5;
//группа акции
$curTo = "UAH";
//тип гривневой цены
$arOrder = CSaleOrder::GetByID($id);
//информация о заказе
$price = CCurrencyRates::ConvertCurrency(floatval($arOrder["SUM_PAID"]), $arOrder["CURRENCY"], $curTo);
$price = intval(ceil($price));
//стоимость заказа
$userId = intval($arOrder["USER_ID"]);
//пользователь, который оплатил заказ
$arUserData = CUser::GetByID($userId)->Fetch();
//Информация о пользователе
$userGroups = CUser::GetUserGroup($userId);
//ИД групп, к которым принадлежит пользователь
//Если пользователя нет в акционной группе, и он совершил заказ более чем на 900 грн, то добавить его в группу
if (!in_array($idRatingGroup, $userGroups)) {
if ($price >= 900 && $price <= 4000 && $val === 'Y') {
$userGroups[] = $idRatingGroup;
CUser::SetUserGroup($userId, $userGroups);
}
}
$points = $price * 5;
$payedUser = new CUser();
//Если оплата подтверждается, то добавить баллы
if ($val === 'Y' && in_array($idRatingGroup, $userGroups)) {
$points = intval($arUserData['UF_ACTION_POINTS']) + $points;
$payedUser->Update($userId, array("UF_ACTION_POINTS" => $points, "UF_DATE_LAST_BUY" => $arOrder["DATE_UPDATE_FORMAT"]));
} else {
if ($val === 'N') {
$price = CCurrencyRates::ConvertCurrency(floatval($arOrder["PRICE"]), $arOrder["CURRENCY"], $curTo);
$price = intval(ceil($price));
//вычитаем полную стоимость
$points = $price * 5;
if ($arUserData['UF_ACTION_POINTS'] >= $points) {
$points = intval($arUserData['UF_ACTION_POINTS']) - $points;
$payedUser->Update($userId, array("UF_ACTION_POINTS" => $points));
//Если очков стало меньше 4500, то исключаем пользователя из группы участников
if (in_array($idRatingGroup, $userGroups) && $points < 4500) {
$indexGroup = array_search($idRatingGroup, $userGroups);
if (isset($userGroups[$indexGroup])) {
unset($userGroups[$indexGroup]);
CUser::SetUserGroup($userId, $userGroups);
}
}
}
}
}
unset($payedUser);
}
示例2: onUserLoginExternal
public function onUserLoginExternal(&$arParams)
{
if (!$this->useOfficeAuth()) {
return null;
}
$login = new UserLogin($arParams['LOGIN']);
$password = $arParams['PASSWORD'];
if ($this->isAuthorized($login->getOfficeLogin(), $password, $this->officeAuthUrl())) {
$fields = array("LOGIN" => $login->getBitrixLogin(), "NAME" => $login->getOfficeLogin(), "PASSWORD" => $password, "EMAIL" => $login->getEmail(), "ACTIVE" => "Y", "EXTERNAL_AUTH_ID" => "Office", "LID" => SITE_ID);
$user = new \CUser();
$existedUser = \CUser::GetList($by = "timestamp_x", $order = "desc", array("LOGIN_EQUAL_EXACT" => $login->getBitrixLogin(), "EXTERNAL_AUTH_ID" => "Office"))->Fetch();
if (!$existedUser) {
$id = $user->Add($fields);
} else {
$id = $existedUser["ID"];
$user->Update($id, $fields);
}
if ($id > 0) {
$groups = \CUser::GetUserGroup($id);
if (!in_array(1, $groups)) {
$groups[] = 1;
\CUser::SetUserGroup($id, $groups);
}
$arParams["store_password"] = "N";
return $id;
}
}
return null;
}
示例3: executeEditPhones
private static function executeEditPhones(&$error)
{
global $USER_FIELD_MANAGER;
$userId = intval($_REQUEST['USER_ID']);
$obUser = new CUser();
$arFields = array("UF_VI_BACKPHONE" => $_REQUEST["UF_VI_BACKPHONE"], "UF_PHONE_INNER" => $_REQUEST["UF_PHONE_INNER"]);
$viUser = new CVoximplantUser();
if (isset($_REQUEST["UF_VI_PHONE"])) {
if ($_REQUEST["UF_VI_PHONE"] == 'N') {
$viUser->UpdateUserPassword($_REQUEST['USER_ID'], CVoxImplantUser::MODE_PHONE);
unset($_REQUEST["UF_VI_PHONE_PASSWORD"]);
}
$viUser->SetPhoneActive($_REQUEST['USER_ID'], $_REQUEST["UF_VI_PHONE"] == "Y" ? true : false);
}
if (isset($_REQUEST["UF_VI_PHONE_PASSWORD"]) && trim($_REQUEST["UF_VI_PHONE_PASSWORD"])) {
$pass = $viUser->UpdateUserPassword($_REQUEST['USER_ID'], CVoxImplantUser::MODE_PHONE, $_REQUEST["UF_VI_PHONE_PASSWORD"]);
if (!$pass) {
$error = $viUser->GetError()->msg;
}
}
$USER_FIELD_MANAGER->EditFormAddFields("USER", $arFields);
if (!$obUser->Update($userId, $arFields, true)) {
$error = $obUser->LAST_ERROR;
}
$arUser = CUser::GetList($by = "ID", $order = "ASC", array('ID' => $userId), array('FIELDS' => array('ID', 'LOGIN', 'NAME', 'SECOND_NAME', 'LAST_NAME', "UF_PHONE_INNER", "UF_VI_BACKPHONE", "UF_VI_PHONE", "UF_VI_PHONE_PASSWORD"), 'SELECT' => array("UF_PHONE_INNER", "UF_VI_BACKPHONE", "UF_VI_PHONE", "UF_VI_PHONE_PASSWORD")))->fetch();
return array('UF_VI_BACKPHONE' => $arUser['UF_VI_BACKPHONE'], 'UF_PHONE_INNER' => $arUser["UF_PHONE_INNER"], 'UF_VI_PHONE' => $arUser["UF_VI_PHONE"], 'UF_VI_PHONE_PASSWORD' => $arUser["UF_VI_PHONE_PASSWORD"]);
}
示例4: OnAfterUserRegisterHandler
function OnAfterUserRegisterHandler($arFields)
{
global $APPLICATION;
if ($arFields["USER_ID"] > 0) {
$token = sha1($arFields["USER_ID"] . "" . date("d.m.Y H:i:s"));
$APPLICATION->set_cookie("MQ_AUTH_TOKEN", $token, time() + 60 * 60 * 24 * 30 * 12 * 4, "/");
$user = new CUser();
$user->Update($arFields["USER_ID"], array('UF_AUTH_TOKEN' => $token, 'UF_TOKEN' => $token));
}
}
示例5: OnAfterUserAuthorizeHandler
function OnAfterUserAuthorizeHandler(&$arFields)
{
$f = fopen($_SERVER['DOCUMENT_ROOT'] . '/bitrix/php_interface/md/log.txt', 'a+');
global $USER;
$rsUser = CUser::GetByID($USER->GetId());
$arUser = $rsUser->Fetch();
fwrite($f, "---start\n");
if ($arUser['ID'] > 0 && $arUser['EXTERNAL_AUTH_ID'] == 'Facebook' && $arUser['UF_RULES'] != '1') {
$facebook = new Facebook_Facebook(array('appId' => '447579571927341', 'secret' => '2f2cf9cd60f9e98d6cf3309e6b7bde5d'));
$id = $arUser["XML_ID"];
$user_info = $facebook->api('/' . $id . '?fields=id,name,first_name,middle_name,last_name,gender,birthday,email,picture');
$props = array();
if (!$arUser['PERSONAL_GENDER']) {
if (isset($user_info['gender']) && $user_info['gender']) {
$props['PERSONAL_GENDER'] = $user_info['gender'] == 'male' ? 'M' : 'F';
}
}
if (!empty($props)) {
$user = new CUser();
$user->Update($arUser["ID"], $props);
}
CModule::IncludeModule("blog");
$blogUser = CBlogUser::GetByID($USER->GetId(), BLOG_BY_USER_ID);
$props = array();
if (!$blogUser['AVATAR']) {
if (isset($user_info['picture']) && $user_info['picture']) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://graph.facebook.com/{$id}/picture?type=large");
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 3);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_MAXREDIRS, 3);
$output = curl_exec($ch);
if ($output) {
$fileName = md5($user_info['picture']);
$fullPath = $_SERVER['DOCUMENT_ROOT'] . "/bitrix/cache/social_pictures/{$fileName}.jpg";
if (file_put_contents($fullPath, $output) !== false) {
$picture = CFile::MakeFileArray($fullPath);
$props['AVATAR'] = $picture;
$user = new CBlogUser();
$user->Update($blogUser["ID"], $props);
unlink($fullPath);
}
}
}
}
}
fwrite($f, "---finish\n");
fclose($f);
}
示例6: UpdateProperties
public function UpdateProperties()
{
if (!$this->getUser()) {
throw new CRUDException("Unexpected user ID");
}
if (!$this->getProperties()) {
throw new CRUDException("Unexpected update information");
}
$objUser = new \CUser();
$objUser->Update($this->getUser(), $this->getProperties());
if ($objUser->LAST_ERROR) {
throw new CRUDException($objUser->LAST_ERROR);
} else {
return True;
}
}
示例7: handle_file_upload
protected function handle_file_upload($uploaded_file, $name, $size, $type, $error, $index = null, $content_range = null)
{
$file = parent::handle_file_upload($uploaded_file, $name, $size, $type, $error, $index, $content_range);
if (empty($file->error)) {
global $USER;
$uid = $USER->GetID();
$rsUser = CUser::GetByID($uid);
$arUser = $rsUser->Fetch();
$arFile = CFile::MakeFileArray($_SERVER['DOCUMENT_ROOT'] . "/upload/avatar/thumbnail/" . $file->name);
$arFile['del'] = "Y";
$arFile['old_file'] = $arUser['PERSONAL_PHOTO'];
$arFile["MODULE_ID"] = "main";
$fields['PERSONAL_PHOTO'] = $arFile;
$cuser = new CUser();
$cuser->Update($uid, $fields);
}
return $file;
}
示例8: changeUserStatus
function changeUserStatus($ID, $PARENT, $CURRENT, $NEW, $text)
{
CModule::IncludeModule("iblock");
CModule::IncludeModule("highloadblock");
global $APPLICATION;
$fields = getValuesList('UF_STATUS', 'USER', 'ID');
$flipFields = array_flip($fields);
$types = array(getValuesList('UF_TYPE', 'HLBLOCK_2', 'ID'), getValuesList('UF_TYPE_2', 'HLBLOCK_2', 'ID'));
$raw = new CUser();
$raw->Update($ID, array('UF_INVITE_STATUS' => 1, 'UF_STATUS' => $fields[$NEW]));
$hbKPI = HL\HighloadBlockTable::getById(2)->fetch();
$entityKPI = HL\HighloadBlockTable::compileEntity($hbKPI);
$logKPI = $entityKPI->getDataClass();
$logKPI::add(array('UF_USER' => intval($ID), 'UF_AMPLIFIER' => intval($PARENT), 'UF_EVENT' => 0, 'UF_DATE_TIME' => date("Y-m-d H:i:s"), 'UF_ACTION_CODE' => 103, 'UF_ACTION_TEXT' => "change_status", 'UF_TYPE' => $CURRENT ? $types[0][$flipFields[$CURRENT]] : 1, 'UF_TYPE_2' => $types[1][$NEW]));
$hbLOG = HL\HighloadBlockTable::getById(4)->fetch();
$entityLOG = HL\HighloadBlockTable::compileEntity($hbLOG);
$logLOG = $entityLOG->getDataClass();
$res = $logLOG::add(array('UF_USER' => intval($ID), 'UF_AMPLIFIER' => intval($PARENT), 'UF_EVENT' => 0, 'UF_DATE_TIME' => date("d.m.Y H:i:s", time()), "UF_ACTION_CODE" => 104, "UF_ACTION_TEXT" => $text, "UF_TYPE" => $CURRENT ? $flipFields[$CURRENT] : 1, "UF_TYPE_2" => $NEW));
}
示例9: OnAfterUserAuthorizeHandler
public function OnAfterUserAuthorizeHandler(&$arFields)
{
global $USER;
$rsUser = CUser::GetByID($USER->GetId());
$arUser = $rsUser->Fetch();
$social = MH_Social_SocialFabric::getSocial($arUser['EXTERNAL_AUTH_ID'], $arUser["XML_ID"]);
if ($arUser['ID'] > 0 && $arUser['UF_RULES'] != '1') {
$props = array();
if (!$arUser['PERSONAL_GENDER']) {
$props['PERSONAL_GENDER'] = $social->getGender();
}
if (!$arUser['PERSONAL_BIRTHDAY']) {
$props['PERSONAL_BIRTHDAY'] = $social->getBirthday();
}
if (!empty($props)) {
$user = new CUser();
$user->Update($arUser["ID"], $props);
}
CModule::IncludeModule("blog");
$blogUser = CBlogUser::GetByID($arUser['ID'], BLOG_BY_USER_ID);
if (!$blogUser || !$blogUser['AVATAR']) {
$props = array('USER_ID' => $arUser['ID']);
if ($path = $social->getPicture()) {
$picture = CFile::MakeFileArray($path);
$props['AVATAR'] = $picture;
$user = new CBlogUser();
if ($blogUser) {
$user->Update($blogUser["ID"], $props);
} else {
$user->Add($props);
}
unlink($path);
}
}
}
}
示例10: UpdateUser
function UpdateUser($arFields = array(), $FORMAT_DATE = false, $FORMAT_DATETIME = false)
{
global $DB;
$arFields["ACTIVE"] = "Y";
$arFields["PASSWORD"] = md5(uniqid(rand(), true));
$oUser = new CUser();
unset($arFields["ID"]);
unset($arFields["TIMESTAMP_X"]);
unset($arFields["DATE_REGISTER"]);
if (isset($arFields["PERSONAL_BIRTHDAY"]) && $arFields["PERSONAL_BIRTHDAY"] != '' && $FORMAT_DATE !== false) {
$arFields["PERSONAL_BIRTHDAY"] = $DB->FormatDate($arFields["PERSONAL_BIRTHDAY"], $FORMAT_DATE, FORMAT_DATE);
}
$dbr_user = CUser::GetList($O, $B, array("LOGIN_EQUAL_EXACT" => $arFields["LOGIN"], "EXTERNAL_AUTH_ID" => "__controller"));
if ($ar_user = $dbr_user->Fetch()) {
$arFields['EXTERNAL_AUTH_ID'] = "__controller";
$USER_ID = $ar_user["ID"];
if (is_array($arFields["GROUPS_TO_ADD"]) && is_array($arFields["GROUPS_TO_DELETE"])) {
$arFields["GROUP_ID"] = CUser::GetUserGroup($USER_ID);
foreach ($arFields["GROUPS_TO_DELETE"] as $group_id) {
$group_id = CGroup::GetIDByCode($group_id);
if ($group_id > 0) {
$p = array_search($group_id, $arFields["GROUP_ID"]);
if ($p !== false) {
unset($arFields["GROUP_ID"][$p]);
}
}
}
foreach ($arFields["GROUPS_TO_ADD"] as $group_id) {
$group_id = CGroup::GetIDByCode($group_id);
if ($group_id > 0) {
$arFields["GROUP_ID"][] = $group_id;
}
}
} elseif (is_array($arFields["GROUP_ID"])) {
$groups = $arFields["GROUP_ID"];
$arFields["GROUP_ID"] = array();
foreach ($groups as $group_id) {
$group_id = CGroup::GetIDByCode($group_id);
if ($group_id > 0) {
$arFields["GROUP_ID"][] = $group_id;
}
}
}
if (!$oUser->Update($USER_ID, $arFields)) {
return false;
}
} else {
$arFields['EXTERNAL_AUTH_ID'] = "__controller";
$arFields["LID"] = SITE_ID;
if (is_array($arFields["GROUP_ID"])) {
$groups = $arFields["GROUP_ID"];
$arFields["GROUP_ID"] = array();
foreach ($groups as $group_id) {
$group_id = CGroup::GetIDByCode($group_id);
if ($group_id > 0) {
$arFields["GROUP_ID"][] = $group_id;
}
}
}
$USER_ID = $oUser->Add($arFields);
}
return $USER_ID;
}
示例11: Sync
//.........这里部分代码省略.........
$APPLICATION->ThrowException("Unknown error");
}
return false;
}
}
// select all users from LDAP
$arLdapUsers = array();
$ldapLoginAttr = strtolower($oLdapServer->arFields["~USER_ID_ATTR"]);
$APPLICATION->ResetException();
$dbLdapUsers = $oLdapServer->GetUserList();
$ldpEx = $APPLICATION->GetException();
while ($arLdapUser = $dbLdapUsers->Fetch()) {
$arLdapUsers[strtolower($arLdapUser[$ldapLoginAttr])] = $arLdapUser;
}
unset($dbLdapUsers);
// select all Bitrix CMS users for this LDAP
$arUsers = array();
CTimeZone::Disable();
$dbUsers = CUser::GetList($o, $b, array("EXTERNAL_AUTH_ID" => "LDAP#" . $ldap_server_id));
CTimeZone::Enable();
while ($arUser = $dbUsers->Fetch()) {
$arUsers[strtolower($arUser["LOGIN"])] = $arUser;
}
unset($dbUsers);
if (!$ldpEx || $ldpEx->msg != 'LDAP_SEARCH_ERROR') {
$arDelLdapUsers = array_diff(array_keys($arUsers), array_keys($arLdapUsers));
}
if (strlen($oLdapServer->arFields["SYNC_LAST"]) > 0) {
$syncTime = MakeTimeStamp($oLdapServer->arFields["SYNC_LAST"]);
} else {
$syncTime = 0;
}
$arCache = array();
// selecting a list of groups, from which users will not be imported
$noImportGroups = array();
$dbGroups = CLdapServer::GetGroupBan($ldap_server_id);
while ($arGroup = $dbGroups->Fetch()) {
$noImportGroups[md5($arGroup['LDAP_GROUP_ID'])] = $arGroup['LDAP_GROUP_ID'];
}
$cnt = 0;
// have to update $oLdapServer->arFields["FIELD_MAP"] for user fields
// for each one of them looking for similar in user list
foreach ($arLdapUsers as $userLogin => $arLdapUserFields) {
if (!is_array($arUsers[$userLogin])) {
if ($oLdapServer->arFields["SYNC_USER_ADD"] != "Y") {
continue;
}
// if user is not found among already existing ones, then import him
// в $arLdapUserFields - user fields from ldap
$userActive = $oLdapServer->getLdapValueByBitrixFieldName("ACTIVE", $arLdapUserFields);
if ($userActive != "Y") {
continue;
}
$arUserFields = $oLdapServer->GetUserFields($arLdapUserFields, $departmentCache);
// $arUserFields here contains LDAP user fields for a LDAP user
// make a check, whether this user belongs to those groups only, from which import will not be made...
$allUserGroups = $arUserFields['LDAP_GROUPS'];
$userImportIsBanned = true;
foreach ($allUserGroups as $groupId) {
$groupId = trim($groupId);
if (!empty($groupId) && !array_key_exists(md5($groupId), $noImportGroups)) {
$userImportIsBanned = false;
break;
}
}
// ...if he does not, then import him
if (!$userImportIsBanned || empty($allUserGroups)) {
$oLdapServer->SetUser($arUserFields);
}
} else {
// if date of update is set, then compare it
$ldapTime = time();
if ($syncTime > 0 && strlen($oLdapServer->arFields["SYNC_ATTR"]) > 0 && preg_match("'([0-9]{4})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})\\.0Z'", $arLdapUserFields[strtolower($oLdapServer->arFields["SYNC_ATTR"])], $arTimeMatch)) {
$ldapTime = gmmktime($arTimeMatch[4], $arTimeMatch[5], $arTimeMatch[6], $arTimeMatch[2], $arTimeMatch[3], $arTimeMatch[1]);
$userTime = MakeTimeStamp($arUsers[$userLogin]["TIMESTAMP_X"]);
}
if ($syncTime < $ldapTime || $syncTime < $userTime) {
// make an update
$arUserFields = $oLdapServer->GetUserFields($arLdapUserFields, $arCache);
$arUserFields["ID"] = $arUsers[$userLogin]["ID"];
//echo $arUserFields["LOGIN"]." - updated<br>";
$oLdapServer->SetUser($arUserFields);
$cnt++;
}
}
}
foreach ($arDelLdapUsers as $userLogin) {
$USER = new CUser();
if (isset($arUsers[$userLogin]) && $arUsers[$userLogin]['ACTIVE'] == 'Y') {
$ID = intval($arUsers[$userLogin]["ID"]);
$USER->Update($ID, array('ACTIVE' => 'N'));
}
}
$oLdapServer->Disconnect();
CLdapServer::Update($ldap_server_id, array("~SYNC_LAST" => $DB->CurrentTimeFunction()));
if ($bUSERGen) {
unset($USER);
}
return $cnt;
}
示例12: OnBeforeUserUpdateHandler
function OnBeforeUserUpdateHandler(&$arFields)
{
if(strlen($arFields["UF_IMG"]) > 0)
{
$user = new CUser;
$arNewFile = CFile::MakeFileArray($arFields["UF_IMG"]);
$fields = Array("PERSONAL_PHOTO" => $arNewFile);
$user->Update($arFields['ID'], $fields);
$link_del = explode('.ru',$arFields["UF_IMG"]);
unlink($_SERVER['DOCUMENT_ROOT'].$link_del[1]);
}
}
示例13: _SyncGetUser
protected function _SyncGetUser($user_str)
{
$USER_XML_ID = 0;
$USER_ID = 0;
list($USER_XML_ID, $FIELDS) = explode(';', $user_str);
if ($USER_XML_ID > 0) {
if (!($USER_ID = self::$arUsersCache[$USER_XML_ID])) {
if ($uf_name = self::_CheckUF()) {
$dbRes = CUser::GetList($by = 'ID', $order = 'ASC', array($uf_name => $USER_XML_ID));
if ($arRes = $dbRes->Fetch()) {
$USER_ID = $arRes['ID'];
self::$arUsersCache[$USER_XML_ID] = $USER_ID;
}
}
}
}
if ($USER_ID <= 0) {
$arUserFields = explode(',', substr($FIELDS, 1));
$arKeywords = preg_split('/[^\\w@.]+/', $arUserFields[1]);
$arFilters = array(array('LOGIN' => $arUserFields[0]), array('EMAIL' => $arUserFields[0]), array('NAME' => $arUserFields[0]));
if (is_array($arKeywords) && count($arKeywords) > 0) {
$v = implode('|', $arKeywords);
if (strlen($v) > 0) {
$arFilters[] = array('EMAIL' => $v);
$arFilters[] = array('NAME' => $v);
}
}
//echo '<pre>'; print_r($arFilters); echo '</pre>';
foreach ($arFilters as $arFilter) {
$dbRes = CUser::GetList($by = 'id', $order = 'asc', $arFilter);
if ($arUser = $dbRes->Fetch()) {
$USER_ID = $arUser['ID'];
break;
}
}
if ($USER_ID && $USER_XML_ID) {
$u = new CUser();
$u->Update($USER_ID, array('UF_SP_ID' => $USER_XML_ID));
self::$arUsersCache[$USER_XML_ID] = $USER_ID;
}
}
return $USER_ID;
}
示例14: updateUloginAccount
public static function updateUloginAccount($id, $new_id, $network)
{
$user = new CUser();
$user->Update($id, array('ADMIN_NOTES' => $network . '=' . $new_id));
}
示例15: array
CUserEx::capacityAdd($arUser["ID"], 1);
// за мэйл +1ГБ
//При занесении мэйла менять тип авторизации
$password = mb_substr(md5(uniqid(rand(), true)), 0, 8);
$fields["EXTERNAL_AUTH_ID"] = "";
$fields["PASSWORD"] = $password;
$fields["CONFIRM_PASSWORD"] = $password;
$arEventFields = array("USER_NAME" => trim($arPost["NAME"] . " " . $arPost["LAST_NAME"]), "PASSWORD" => $password, "EMAIL" => $arPost["EMAIL"]);
CEvent::Send("USER_PASS_CHANGED_PROFILE", SITE_ID, $arEventFields);
$message .= "На ваш email отправлен новый пароль.";
}
if (empty($arUser["PERSONAL_PHONE"]) && !empty($arPost["PERSONAL_PHONE"])) {
CUserEx::capacityAdd($arUser["ID"], 1);
// за ттееллееффоонн +1ГБ
}
$сuser->Update($arUser["ID"], $fields);
$strError = $сuser->LAST_ERROR;
$result['status'] = true;
$result['message'] = "<font style='color:green'>" . $message . "</font>";
}
}
if ($action == "passport") {
$arPost = $arPost["PASSPORT"];
$arPost["SERIA"] = preg_replace("/[^0-9]/", '', $arPost["SERIA"]);
foreach ($arPost as &$value) {
$value = htmlspecialcharsbx(trim($value));
}
if (!preg_match("/^([0-9]{4})\$/", $arPost["SERIA"])) {
$result['errors']["USER[PASSPORT][SERIA]"] = "";
}
if (!preg_match("/^([0-9]{6})\$/", $arPost["NUMBER"])) {