function TerminateSubscribe($arFields) { $saved_s = unserialize(COption::GetOptionString("echogroup.smsru", "SUBS")); if (in_array($arFields["ID"], $saved_s)) { global $USER; $uid = $USER->GetID(); if ($arFields["USER_ID"]) { $uid = $arFields["USER_ID"]; } if ($arFields["UID"]) { $uid = $arFields["UID"]; } if ($uid > 2) { $res = $USER->GetByID($uid); $arUser = $res->Fetch(); if (!$arUser["PERSONAL_PHONE"]) { $arUser["PERSONAL_PHONE"] = $arFields["TO"]; } foreach ($arFields as $k => $v) { $arForm["MESSAGE"] = str_replace("#" . $k . "#", $v, $arForm["MESSAGE"]); } CEchogroupSmsru::Send($arUser["PERSONAL_PHONE"], $arForm["MESSAGE"]); return false; } } }
$arFields["PERSONAL_PHONE"] = $phone; $arFields["EMAIL"] = $arFields["LOGIN"] = $phone . "@megatv.su"; $arFields["UF_PHONE_REG"] = "Y"; } $USER_ID = $user->Add($arFields); if (intval($USER_ID) > 0) { CUserEx::subcribeOnFreeChannels($USER_ID); $arFields["USER_ID"] = $USER_ID; $event = new CEvent(); $event->SendImmediate("NEW_USER", SITE_ID, $arFields); if (CDev::check_phone($phone)) { $checkword = mb_substr(md5(uniqid(rand(), true)), 0, 8); $cuser = new CUser(); $cuser->Update($USER_ID, array("UF_PHONE_CHECKWORD" => $checkword)); $text = GetMessage('AUTH_ACTIVATE_CODE_TEXT') . $checkword; CEchogroupSmsru::Send($phone, $text); $result['message'] = "<font style='color:green'>" . GetMessage('AUTH_REGISTER_SUCCESS_TEXT_1') . "</font><br />"; } else { //Для подтверждения регистрации перейдите по следующей ссылке: //http://#SERVER_NAME#/auth/index.php?confirm_registration=yes&confirm_user_id=#USER_ID#&confirm_code=#CONFIRM_CODE# $event->SendImmediate("NEW_USER_CONFIRM", SITE_ID, $arFields); //на почту письмо для подтверждения $result['message'] = "<font style='color:green'>" . GetMessage('AUTH_REGISTER_SUCCESS_TEXT_2') . "</font><br />"; CUserEx::capacityAdd($USER_ID, 1); // за мэйл +1ГБ } } $result['status'] = "success"; //Бонус за регистрацию CUserEx::capacityAdd($USER_ID, BONUS_FOR_REGISTRATION); COption::SetOptionString("main", "captcha_registration", "Y");