本文整理汇总了PHP中CEvent::SendImmediate方法的典型用法代码示例。如果您正苦于以下问题:PHP CEvent::SendImmediate方法的具体用法?PHP CEvent::SendImmediate怎么用?PHP CEvent::SendImmediate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CEvent
的用法示例。
在下文中一共展示了CEvent::SendImmediate方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: elseif
$USER_DESCRIPTION .= $valProps['NAME'] . ' - ' . sestHL::getByIdHL(HL_PeriodOfLicence, $valProps['VALUE'], true, 'UF_NAME') . ';';
} elseif ($valProps['CODE'] == 'HL_VersionB') {
$USER_DESCRIPTION .= $valProps['NAME'] . ' - ' . sestHL::getByIdHL(HL_Version, $valProps['VALUE'], true, 'UF_NAME') . ';';
}
}
}
}
$index += 1;
}
//dd($USER_DESCRIPTION);
$arFields = array("LID" => "s1", "PERSON_TYPE_ID" => 1, "PAYED" => "N", "CANCELED" => "N", "STATUS_ID" => "N", "PRICE" => $totalSum, "CURRENCY" => "UAH", "USER_ID" => IntVal($USER->GetID()), "PAY_SYSTEM_ID" => 1, "PRICE_DELIVERY" => 1, "DELIVERY_ID" => 1, "DISCOUNT_VALUE" => 0.0, "TAX_VALUE" => 0.0, "USER_DESCRIPTION" => $USER_DESCRIPTION);
$ORDER_ID = CSaleOrder::Add($arFields);
if ($ORDER_ID) {
global $USER;
$arEventFields = array("EMAIL" => $USER->GetEmail(), "ORDER_ID" => $ORDER_ID, "PRICE" => $_GET['totalSum']);
CEvent::SendImmediate("SALE_NEW_ORDER_SEST", "s1", $arEventFields);
//привязал корзину к заказу
CSaleBasket::OrderBasket($ORDER_ID, 0, SITE_ID);
//$_SESSION["SALE_USER_ID"]
foreach ($arrCleanProducts as $key => $value) {
$res = CSaleBasket::Update($value->elementBaskId, array('QUANTITY' => $value->quantity, 'PRICE' => $value->oneSum));
}
} else {
//dd(bad);
}
}
}
?>
示例2: registerUser
function registerUser($userInfo)
{
$errors = array();
$result = '';
if (empty($userInfo['name'])) {
$errors[] = 'Вы не ввели имя';
}
if (empty($userInfo['email'])) {
$errors[] = 'Вы не ввели email';
}
if (empty($userInfo['phone'])) {
$errors[] = 'Вы не ввели телефон';
}
if (empty($errors)) {
$user = new CUser();
$password = make_password(8);
$arFields = array("NAME" => $userInfo['name'], "EMAIL" => $userInfo['email'], "LOGIN" => $userInfo['email'], "ACTIVE" => "Y", "GROUP_ID" => array(6), "PASSWORD" => $password, "CONFIRM_PASSWORD" => $password, "PERSONAL_PHONE" => $userInfo['phone']);
$ID = $user->Add($arFields);
if (intval($ID) > 0) {
$result = "Вы успешно зарегистрированы.";
$arEventField = array("NAME" => $userInfo['name'], "EMAIL" => $userInfo['email'], "PASSWORD" => $password);
CEvent::SendImmediate("NEW_REG", "s1", $arEventField);
unset($_POST['user']);
global $USER;
global $APPLICATION;
$USER->Authorize($ID);
LocalRedirect($APPLICATION->GetCurPageParam('', array('user[name]', 'user[email]', 'ELEMENT_CODE', 'code')));
} else {
$errors[] = $user->LAST_ERROR;
}
}
return $errors;
}
示例3: dailyAllUsers
/**
* Billing by all users at 3-30
*/
public static function dailyAllUsers()
{
global $DB;
$table = \Hawkart\Megatv\SubscribeTable::getTableName();
$time_update = "03:30:00";
$datetime = new \Bitrix\Main\Type\Datetime(date("Y-m-d " . $time_update), 'Y-m-d H:i:s');
$datetime_next_date = new \Bitrix\Main\Type\Datetime(date('Y-m-d' . $time_update, strtotime('+1 day')), 'Y-m-d H:i:s');
$datetime_from_db = date("d.m.Y " . $time_update);
$datetime_to_db = date("d.m.Y " . $time_update, strtotime('+1 day'));
/**
* Get all users
*/
$arUsers = array();
$arFilter = array("ACTIVE" => "Y");
$rsUsers = \CUser::GetList($by = "LAST_NAME", $order = "asc", $arFilter);
while ($arUser = $rsUsers->GetNext()) {
$arUsers[$arUser["ID"]] = $arUser;
}
/**
* Get all priced subscribe for all users
*/
$arSubscribeUsers = array();
$result = \Hawkart\Megatv\SubscribeTable::getList(array('filter' => array("UF_ACTIVE" => 1, ">UF_CHANNEL_ID" => 0, ">UF_CHANNEL.UF_PRICE_H24" => 0, "<=UF_DATETIME_TO" => $datetime), 'select' => array("ID", "PRICE" => "UF_CHANNEL.UF_PRICE_H24", "UF_USER_ID")));
while ($arSub = $result->fetch()) {
$arSubscribeUsers[$arSub["UF_USER_ID"]][] = array("ID" => $arSub["ID"], "PRICE" => $arSub["PRICE"]);
}
$result = \Hawkart\Megatv\SubscribeTable::getList(array('filter' => array("UF_ACTIVE" => 1, ">UF_SERVICE_ID" => 0, ">UF_SERVICE.UF_PRICE" => 0), 'select' => array("ID", "PRICE" => "UF_SERVICE.UF_PRICE", "UF_USER_ID")));
while ($arSub = $result->fetch()) {
$arSubscribeUsers[$arSub["UF_USER_ID"]][] = array("ID" => $arSub["ID"], "PRICE" => $arSub["PRICE"]);
}
/**
* Make transaction for 1 day for all users
*/
foreach ($arSubscribeUsers as $user_id => $arSubscribes) {
$daily_price = 0;
foreach ($arSubscribes as $arSubscribe) {
$daily_price += $arSubscribe["PRICE"];
}
$balance = \CUserEx::getBudget($user_id);
if ($balance > 0 && $daily_price > 0) {
\CSaleAccountEx::transaction(-1 * $daily_price, $user_id, "Оплата услуг за " . date('d.m.Y'));
$strSql = "UPDATE " . $table . " SET UF_DATETIME_TO=curdate() + INTERVAL 1 DAY + INTERVAL 3 HOUR + INTERVAL 30 MINUTE WHERE UF_USER_ID=" . $user_id;
$res = $DB->Query($strSql, false, $err_mess . __LINE__);
//Send email to user to add money to budget for 3 days
if ($balance < $daily_price * 2) {
\CEvent::SendImmediate("NOTIFICATION_PAY_AFTER_DAYS", SITE_ID, array("EMAIL_TO" => $arUsers[$user_id]["EMAIL"], "PRICE" => $daily_price * 5));
}
}
}
}
示例4:
// authorize user
if ($arParams["AUTH"] == "Y" && $arResult["VALUES"]["ACTIVE"] == "Y")
{
if (!$arAuthResult = $USER->Login($arResult["VALUES"]["LOGIN"], $arResult["VALUES"]["PASSWORD"]))
$arResult["ERRORS"][] = $arAuthResult;
}
$arResult['VALUES']["USER_ID"] = $ID;
$arEventFields = $arResult['VALUES'];
unset($arEventFields["PASSWORD"]);
unset($arEventFields["CONFIRM_PASSWORD"]);
$event = new CEvent;
$event->SendImmediate("NEW_USER", SITE_ID, $arEventFields);
if($bConfirmReq)
$event->SendImmediate("NEW_USER_CONFIRM", SITE_ID, $arEventFields);
}
else
{
$arResult["ERRORS"][] = $user->LAST_ERROR;
}
if(count($arResult["ERRORS"]) <= 0)
{
if(COption::GetOptionString("main", "event_log_register", "N") === "Y")
CEventLog::Log("SECURITY", "USER_REGISTER", "main", $ID);
}
else
{
示例5: SimpleRegister
function SimpleRegister($USER_EMAIL, $SITE_ID = false, $captcha_word = "", $captcha_sid = 0)
{
global $APPLICATION, $DB;
$APPLICATION->ResetException();
if (defined("ADMIN_SECTION") && ADMIN_SECTION === true && $SITE_ID === false) {
$APPLICATION->ThrowException(GetMessage("MAIN_FUNCTION_SIMPLEREGISTER_NA_INADMIN"));
return array("MESSAGE" => GetMessage("MAIN_FUNCTION_SIMPLEREGISTER_NA_INADMIN"), "TYPE" => "ERROR");
}
if ($SITE_ID === false) {
$SITE_ID = SITE_ID;
}
global $REMOTE_ADDR;
$checkword = md5(CMain::GetServerUniqID() . uniqid());
$arFields = array("CHECKWORD" => $checkword, "~CHECKWORD_TIME" => $DB->CurrentTimeFunction(), "EMAIL" => $USER_EMAIL, "ACTIVE" => "Y", "NAME" => "", "LAST_NAME" => "", "USER_IP" => $REMOTE_ADDR, "USER_HOST" => @gethostbyaddr($REMOTE_ADDR), "SITE_ID" => $SITE_ID);
$def_group = COption::GetOptionString("main", "new_user_registration_def_group", "");
if ($def_group != "") {
$arFields["GROUP_ID"] = explode(",", $def_group);
$arPolicy = $this->GetGroupPolicy($arFields["GROUP_ID"]);
} else {
$arPolicy = $this->GetGroupPolicy(array());
}
$password_min_length = intval($arPolicy["PASSWORD_LENGTH"]);
if ($password_min_length <= 0) {
$password_min_length = 6;
}
$password_chars = array("abcdefghijklnmopqrstuvwxyz", "ABCDEFGHIJKLNMOPQRSTUVWXYZ", "0123456789");
if ($arPolicy["PASSWORD_PUNCTUATION"] === "Y") {
$password_chars[] = ",.<>/?;:'\"[]{}\\|`~!@#\$%^&*()-_+=";
}
$arFields["PASSWORD"] = $arFields["CONFIRM_PASSWORD"] = randString($password_min_length, $password_chars);
$bOk = true;
$result_message = false;
$events = GetModuleEvents("main", "OnBeforeUserSimpleRegister");
while ($arEvent = $events->Fetch()) {
if (ExecuteModuleEventEx($arEvent, array(&$arFields)) === false) {
if ($err = $APPLICATION->GetException()) {
$result_message = array("MESSAGE" => $err->GetString() . "<br>", "TYPE" => "ERROR");
} else {
$APPLICATION->ThrowException("Unknown error");
$result_message = array("MESSAGE" => "Unknown error" . "<br>", "TYPE" => "ERROR");
}
$bOk = false;
break;
}
}
$bRandLogin = false;
if (!is_set($arFields, "LOGIN")) {
$arFields["LOGIN"] = randString(50);
$bRandLogin = true;
}
if ($bOk) {
$arFields["LID"] = $arFields["SITE_ID"];
$arFields["CHECKWORD"] = $checkword;
if ($ID = $this->Add($arFields)) {
if ($bRandLogin) {
$this->Update($ID, array("LOGIN" => "user" . $ID));
$arFields["LOGIN"] = "user" . $ID;
}
$this->Authorize($ID);
$event = new CEvent();
$arFields["USER_ID"] = $ID;
$arEventFields = $arFields;
unset($arEventFields["PASSWORD"]);
unset($arEventFields["CONFIRM_PASSWORD"]);
$event->SendImmediate("NEW_USER", $arEventFields["SITE_ID"], $arEventFields);
CUser::SendUserInfo($ID, $arEventFields["SITE_ID"], GetMessage("USER_REGISTERED_SIMPLE"), true);
$result_message = array("MESSAGE" => GetMessage("USER_REGISTER_OK"), "TYPE" => "OK");
} else {
$result_message = array("MESSAGE" => $this->LAST_ERROR, "TYPE" => "ERROR");
}
}
if (is_array($result_message)) {
if ($result_message["TYPE"] == "OK") {
if (COption::GetOptionString("main", "event_log_register", "N") === "Y") {
$res_log["user"] = $arFields["LOGIN"];
CEventLog::Log("SECURITY", "USER_REGISTER", "main", $ID, serialize($res_log));
}
} else {
if (COption::GetOptionString("main", "event_log_register_fail", "N") === "Y") {
CEventLog::Log("SECURITY", "USER_REGISTER_FAIL", "main", $ID, $result_message["MESSAGE"]);
}
}
}
$arFields["RESULT_MESSAGE"] = $result_message;
foreach (GetModuleEvents("main", "OnAfterUserSimpleRegister", true) as $arEvent) {
ExecuteModuleEventEx($arEvent, array(&$arFields));
}
return $arFields["RESULT_MESSAGE"];
}
示例6: CIBlockElement
// Записываем в лог регистрацию
$el_log = new CIBlockElement();
$PROP_log = array('ID' => $ID, 'PERSONAL_BIRTHDAY' => $val["PERSONAL_BIRTHDAY"], 'PARENT_USER' => $Fields["UF_USER_PARENT"], 'UF_IAGREE' => $status[$val["UF_IAGREE"]], 'UF_YOU_HAVE_18' => $status[$val["UF_YOU_HAVE_18"]], 'UF_DO_YOU_SMOKE' => $status[$val["UF_DO_YOU_SMOKE"]], 'TYPE' => "app_user_add");
$arLoadProductArray_log = array("IBLOCK_ID" => 26, "PROPERTY_VALUES" => $PROP_log, "NAME" => $ID);
$el_log->Add($arLoadProductArray_log);
// Создаем Токен для пользователя
$Hash = md5($ID . $USER->GetID() . time());
// Если указана почта отправляем ему письмо с токеном, логином и паролем
if (!empty($val["EMAIL"])) {
CModule::IncludeModule("main");
$arEventFields = array("USER_ID" => $ID, "LOGIN" => $Fields["LOGIN"], "EMAIL" => $Fields["EMAIL"], "NAME" => $Fields["NAME"], "LAST_NAME" => $Fields["LAST_NAME"], "PASSWORD" => $Fields["PASSWORD"], "TOKEN" => $Hash);
$userFields = $USER->GetByID($USER->GetID())->Fetch();
if ($userFields["PERSONAL_CITY"] == "Екатеринбург") {
CEvent::SendImmediate("NEW_APP_USER", "s1", $arEventFields);
} else {
CEvent::SendImmediate("NEW_USER_NEW", "s1", $arEventFields);
}
}
// Обновляем счетчик для группы KENT Lab
$usersInGroup = CIBlockElement::GetProperty(4, 1, array("sort" => "asc"), array("CODE" => "USERS"))->Fetch();
$usersInGroup["VALUE"]++;
CIBlockElement::SetPropertyValues(1, 4, $usersInGroup["VALUE"], "USERS");
// Сохраняем токены
$Field["UF_HASH"] = $Hash;
$Field["UF_TOKEN"] = $Hash;
$USER->Update($ID, $Field);
// Добавляем записи в KPI
$arKpi = CIBlockElement::GetList(array(), array("IBLOCK_ID" => 17, "><DATE_ACTIVE_FROM" => array(date($DB->DateFormatToPHP(CLang::GetDateFormat("SHORT")), mktime(0, 0, 0, date("n"), 1, date("Y"))), date($DB->DateFormatToPHP(CLang::GetDateFormat("SHORT")), mktime(0, 0, 0, date("n") + 1, 1, date("Y")))), "PROPERTY_USER_ID" => $USER->GetID()), false, false, array("*"));
while ($obKpi = $arKpi->GetNextElement()) {
$kpi = $obKpi->GetFields();
}
示例7: array
if (in_array($k, $sent)) {
continue;
} else {
$sent[] = $k;
}
if ($v == "on") {
if ($_POST["mail_template"] !== 34 && $_POST["mail_template"] !== 38) {
if ($_POST["mail_template"] == 32) {
$eventFields = array("EMAIL" => $k, "NAME" => "");
CEvent::SendImmediate("NEW_AMBASSADOR", "s1", $eventFields, $Duplicate = "N", $message_id = "32");
} elseif ($_POST["mail_template"] == 37) {
$eventFields = array("EMAIL" => $k, "NAME" => "");
CEvent::SendImmediate("THANKS_FOR_PARTICIPATING", "s1", $eventFields, $Duplicate = "N", $message_id = "37");
} elseif ($_POST["mail_template"] == 39) {
$eventFields = array("EMAIL" => $k, "NAME" => "");
CEvent::SendImmediate("U_CONCEPT", "s1", $eventFields, $Duplicate = "N", $message_id = "39");
} elseif ($_POST["mail_template"] == 29) {
$eventFields = array("EMAIL" => $k, "NAME" => "");
CEvent::SendImmediate("LAUNCH_OFFER", "s1", $eventFields, $Duplicate = "N", $message_id = "29");
} elseif ($_POST["mail_template"] == 41) {
$arFields = array("EMAIL" => $k, "NAME" => "");
CEvent::SendImmediate("Launch_flagship", "s1", $arFields, $Duplicate = "N", $message_id = "41");
} elseif ($_POST["mail_template"] == 42) {
$arFields = array("EMAIL" => $k, "NAME" => "");
CEvent::SendImmediate("winner_WOM", "s1", $arFields, $Duplicate = "N", $message_id = "42");
}
}
}
}
$data = array('success' => 'Form was submitted', 'formData' => "all ok");
echo json_encode($data);
示例8: htmlspecialchars
'ACTIVE' => 'Y',
'DATE_ACTIVE_FROM' => $arFields['DATE'],
'NAME' => htmlspecialchars(trim($arFields['PHONE'])),
'PROPERTY_VALUES' => array(
'NAME' => htmlspecialchars(trim($arFields['NAME'])),
'EMAIL' => htmlspecialchars(trim($arFields['EMAIL'])),
'QUEST' => htmlspecialchars(trim($arFields['QUEST'])),
'PRICE' => $arFields['PRICE'],
'DAYWEEK' => $arFields['DAYWEEK']
)
);
if ($requestId = $el->add($arAddFields)) {
$arResult = array(
'success' => 1,
'message' => 'Игра успешно забронирована. В ближайшее время наш менеджер Вам перезвонит',
'date' => $arFields['DATE']
);
CEvent::SendImmediate('SEND_REQUEST', 's1', $arFields);
} else {
$arResult = array(
'success' => 0,
'error' => 'Невозможно забронировать игру. Для бронирования, пожалуйста, обратитесь по номеру телефона'
);
}
}
}
echo json_encode($arResult);
示例9: ReinviteUser
function ReinviteUser($SITE_ID, $USER_ID)
{
global $USER;
$USER_ID = intval($USER_ID);
$rsUser = CUser::GetList($o = "ID", $b = "DESC", array("ID_EQUAL_EXACT" => $USER_ID));
if ($arUser = $rsUser->Fetch()) {
$messageText = ($userMessageText = CUserOptions::GetOption("bitrix24", "invite_message_text")) ? htmlspecialcharsbx($userMessageText) : GetMessage("BX24_INVITE_DIALOG_INVITE_MESSAGE_TEXT");
$event = new CEvent();
$event->SendImmediate("BITRIX24_USER_INVITATION", $SITE_ID, array("EMAIL_FROM" => $USER->GetEmail(), "EMAIL_TO" => $arUser["EMAIL"], "LINK" => CHTTP::URN2URI("/bitrix/tools/intranet_invite_dialog.php?user_id=" . $USER_ID . "&checkword=" . urlencode($arUser["CONFIRM_CODE"])), "USER_TEXT" => $messageText));
return true;
}
return false;
}
示例10: ConvertTimeStamp
require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_before.php";
if (CModule::IncludeModule("sale") && CModule::IncludeModule("main")) {
$tm = ConvertTimeStamp(time() - 2592000);
// Дата 30 дней назад
$dbBasketItems = CSaleBasket::GetList(array("NAME" => "ASC"), array("LID" => "s1", "ORDER_ID" => NULL, ">=DATE_UPDATE" => $tm, "DELAY" => "Y"));
/*
Здесь возникают уточняющие вопросы - отложенные товары - это вы имеете в виду как я понял именно товары со статусом "Отложен"
"При этом нужно проверить, чтобы в список не попали изделия, которые присутствуют в заказах пользователя за последний месяц" -
если я правильно понял задание, это решается установкой "ORDER_ID"=>NULL и здесь вы не имеете в виду, что ВООБЩЕ не нужно выводить наименование товара,
если таковой был заказан за данный период
*/
$ar_users = array();
// Массив Пользователь=>Список товаров
while ($arItems = $dbBasketItems->Fetch()) {
// echo $arItems["USER_ID"]." - ".$arItems["NAME"]."<br/>";
if (!isset($ar_users[$arItems["USER_ID"]])) {
$ar_users[$arItems["USER_ID"]] = $arItems["NAME"] . PHP_EOL;
} else {
$ar_users[$arItems["USER_ID"]] .= $arItems["NAME"] . PHP_EOL;
}
}
// Отправим извещения пользователям
// Был создан тпп почтового события и соответствующий почтовый шаблон
foreach ($ar_users as $u => $goods) {
$rsUser = CUser::GetByID($u);
$arUser = $rsUser->Fetch();
CEvent::SendImmediate("BASKET_NOTICE", "s1", array("USER_MAIL" => $arUser["EMAIL"], "NAME" => $arUser["NAME"] . " " . $arUser["LAST_NAME"], "GOODS" => $goods));
}
}
require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/epilog_after.php";
示例11: CIBlockElement
$arFields = $ob->GetFields();
$arProps = $ob->GetProperties();
}
if ($arFields["ID"] > 0 && empty($arProps["USER"]["VALUE"])) {
$el = new CIBlockElement();
$PROP = array();
$PROP[141] = $_POST["performance"];
$PROP[142] = $user_id;
$PROP[145] = $arProps["AMBASSADOR"]["VALUE"];
$arLoadProductArray = array("PROPERTY_VALUES" => $PROP);
$res = $el->Update($arFields["ID"], $arLoadProductArray);
$countUsers["VALUE"]--;
CIBlockElement::SetPropertyValues($_POST["performance"], $iblock_id, $countUsers["VALUE"], "SEATS");
$arUser = $USER->GetByID($user_id)->Fetch();
$eventFields = array("EMAIL" => $_POST["email"], "NAME" => $arUser["NAME"], "DATE" => date("H:m d.m.Y", strtotime($arPerformance["PROPS"]["DATE_START"]["VALUE"])), "QR_GIF" => "http://myqube.ru" . CFile::GetPath($arFields["PREVIEW_PICTURE"]));
CEvent::SendImmediate("PERFORMANCE", "s1", $eventFields, $Duplicate = "N", $message_id = "33");
} else {
echo "Регистрация не удалась. Данный код уже был использован.";
}
} else {
echo "Регистрация не удалась. Места закончились.";
}
}
$arFilter = array("IBLOCK_ID" => $iblock_id, "ACTIVE_DATE" => "Y", "ACTIVE" => "Y");
$res = CIBlockElement::GetList(array("PROPERTY_DATE_FROM" => "ASC"), $arFilter, false, array("nPageSize" => 5));
while ($arItemObj = $res->GetNextElement()) {
$arItem = $arItemObj->GetFields();
$arItem["PROPERTIES"] = $arItemObj->GetProperties();
$arItem["close"] = false;
if ($DB->CompareDates($arItem["PROPERTIES"]["DATE_FROM"]["VALUE"], date("d.m.Y H:i:s", strtotime("+4 hours"))) != 1 || $arItem["PROPERTIES"]["SEATS"]["VALUE"] == 0) {
$arItem["close"] = true;
示例12: array
"NAME" => $_POST["name"],
"ACTIVE" => "N", // активен
"PREVIEW_TEXT" => $_POST["comment"],
"CODE" => $_POST["phone"],
"DETAIL_TEXT" => ""
);
if($PRODUCT_ID = $el->Add($arLoadProductArray)){
$success_mess = "<span class='success_mess'>Спасибо! Ваша заявка принята</span>";
$arEventField = array(
"NAME" => $_POST["name"],
"PHONE" => $_POST["phone"],
"COMMENT" => $_POST["comment"]
);
CEvent::SendImmediate("REQUEST_CALL_BACK", "s1", $arEventField, "N", 47);
}
}
if(
isset($_POST["name"]) &&
isset($_POST["phone"]) &&
isset($_POST["comment"])
){
if(empty($_POST["name"])) $name_empt = true;
if(empty($_POST["phone"])) $phone_empt = true;
if(empty($_POST["comment"])) $comment_empt = true;
}
if(
isset($_POST["emailsend"]) && !empty($_POST["emailsend"])
示例13: RegistrationUser
/**
* Регистрация на сайте и в таблице uLogin
*
* @param Array $u_user - данные о пользователе, полученные от uLogin
* @param int $in_db - при значении 1 необходимо переписать данные в таблице uLogin
*
* @return bool|int|Error
*/
public static function RegistrationUser($u_user, $in_db = 0, $arParams)
{
global $APPLICATION;
if (!isset($u_user['email'])) {
ShowMessage(array("TYPE" => "ERROR", "MESSAGE" => 'Через данную форму выполнить регистрацию невозможно. Сообщите администратору сайта о следующей ошибке:
Необходимо указать "email" в возвращаемых полях uLogin'));
die('<br/><a href="' . $_POST['backurl'] . '">Назад</a>');
}
global $USER;
global $DB;
$rsUsers = CUser::GetList($by = "id", $order = "desc", array("EMAIL" => $u_user['email']));
$arUser = $rsUsers->GetNext();
if ($in_db == 1) {
$result = $DB->Query('DELETE FROM ulogin_users WHERE identity = "' . urlencode($u_user['identity']) . '"');
}
// // $check_m_user == true -> есть пользователь с таким email
$check_m_user = $arUser['ID'] > 0 ? true : false;
$current_user = $USER->GetID();
if ($check_m_user == false) {
$u_user['first_name'] = isset($u_user['first_name']) ? $APPLICATION->ConvertCharset($u_user['first_name'], "UTF-8", SITE_CHARSET) : "";
$u_user['last_name'] = isset($u_user['last_name']) ? $APPLICATION->ConvertCharset($u_user['last_name'], "UTF-8", SITE_CHARSET) : "";
$u_user['nickname'] = isset($u_user['nickname']) ? $APPLICATION->ConvertCharset($u_user['nickname'], "UTF-8", SITE_CHARSET) : "";
$u_user['b_date'] = isset($u_user['b_date']) ? $u_user['b_date'] : "";
// регистрируем пользователя
list($d, $m, $y) = explode('.', $u_user['bdate']);
//можно просто представить в другом формате стандартной функцией php
$longLogin = uLogin::ulogin_generateNickname($u_user['first_name'], $u_user['last_name']);
$arResult['USER'] = array('EMAIL' => $u_user['email'], 'PERSONAL_GENDER' => $u_user['sex'] == 2 ? 'M' : 'F', 'PERSONAL_CITY' => isset($u_user['city']) ? $u_user['city'] : '', 'PERSONAL_BIRTHDAY' => $d . '.' . $m . '.' . $y, 'EXTERNAL_AUTH_ID' => $u_user['identity'], 'PHOTO' => $u_user['photo'], 'PHOTO_BIG' => $u_user['photo_big'], 'NETWORK' => $u_user['network']);
$GroupID = "5";
$passw = RandString();
if (is_array($arParams["GROUP_ID"])) {
$GroupID = $arParams["GROUP_ID"];
}
if (!is_array($GroupID)) {
$GroupID = array($GroupID);
}
$arIMAGE = '';
if (isset($u_user['photo'])) {
$imageContent = file_get_contents($u_user['photo']);
$ext = strtolower(substr($u_user['photo'], -3));
if (!in_array($ext, array('jpg', 'jpeg', 'png', 'gif', 'bmp'))) {
$ext = 'jpg';
}
$tmpName = $tmpName = md5(rand()) . '.' . $ext;
$tmpName = $_SERVER["DOCUMENT_ROOT"] . "/images/" . $tmpName;
file_put_contents($tmpName, $imageContent);
$arIMAGE = CFile::MakeFileArray($tmpName);
$arIMAGE["MODULE_ID"] = "main";
}
$user = new CUser();
$arFields = array("NAME" => $u_user['first_name'], "LAST_NAME" => $u_user['last_name'], "EMAIL" => $u_user['email'], "LOGIN" => $longLogin, "ACTIVE" => "Y", "GROUP_ID" => array(5), "PASSWORD" => $passw, "CONFIRM_PASSWORD" => $passw, "PERSONAL_PHOTO" => $arIMAGE);
$UserID = $user->Add($arFields);
if ($UserID > 0) {
$result = $DB->Query('INSERT INTO ulogin_users (id, userid, identity, network) VALUES (NULL,"' . $UserID . '","' . urlencode($u_user['identity']) . '","' . $u_user['network'] . '")');
} else {
ShowMessage(array("TYPE" => "ERROR", "MESSAGE" => 'Ошибка регистрации: Не удалось зарегистрировать пользователя.'));
die('<br/><a href="' . $_POST['backurl'] . '">Назад</a>');
}
if ($UserID && $arParams['SEND_EMAIL'] == 'Y') {
$arEventFields = array('USER_ID' => $UserID, 'LOGIN' => $arFields['LOGIN'], 'EMAIL' => $arFields['EMAIL'], 'NAME' => $arFields['NAME'], 'LAST_NAME' => $arFields['LAST_NAME'], 'USER_IP' => '', 'USER_HOST' => '');
$event = new CEvent();
$msg = $event->SendImmediate("NEW_USER", SITE_ID, $arEventFields);
ShowMessage($msg);
}
unlink($tmpName);
return $UserID;
} else {
if (!isset($u_user["verified_email"]) || intval($u_user["verified_email"]) != 1) {
die('<script src="//ulogin.ru/js/ulogin.js" type="text/javascript"></script><script type="text/javascript">uLogin.mergeAccounts("' . $_POST['token'] . '")</script>' . 'Электронный адрес данного аккаунта совпадает с электронным адресом существующего пользователя. Требуется подтверждение на владение указанным email.' . '<br/><a href="' . $_POST['backurl'] . '">Назад</a>');
}
if (intval($u_user["verified_email"]) == 1) {
$user_id = $arUser['ID'];
$other_u = $DB->Query('SELECT identity,network FROM ulogin_users WHERE userid = "' . $user_id . '"');
$other = array();
while ($row = $other_u->Fetch()) {
$ident = $row['identity'];
$key = $row['network'];
$other[$key] = $ident;
}
if ($other) {
if (!isset($u_user['merge_account'])) {
die('<script src="//ulogin.ru/js/ulogin.js" type="text/javascript"></script><script type="text/javascript">uLogin.mergeAccounts("' . $_POST['token'] . '","' . $other[$key] . '")</script>' . 'С данным аккаунтом уже связаны данные из другой социальной сети. Требуется привязка новой учётной записи социальной сети к этому аккаунту' . '<br/><a href="' . $_POST['backurl'] . '">Назад</a>');
}
}
}
$result = $DB->Query('INSERT INTO ulogin_users (id, userid, identity, network) VALUES (NULL,"' . $arUser['ID'] . '","' . urlencode($u_user['identity']) . '","' . $u_user['network'] . '")');
$result = $result->GetNext();
return $arUser['ID'];
}
}
示例14: winner
function winner()
{
$log = new CLoger("winner");
$log->Add("вызвали функцию: " . $_SERVER["SCRIPT_NAME"]);
$finish = MakeTimeStamp($this->finish_time, "DD.MM.YYYY HH:MI:SS");
$now = time();
if ($now > $finish) {
$ar = $this->rate_history;
$win_idx = count($ar) - 1;
$win_id = $ar[$win_idx];
$filter = array("ID" => $win_id);
//$filter = Array("ID"=>$user_id);
$arUser = CUser::GetList($by = "personal_country", $order = "desc", $filter, array("SELECT" => array("UF_POINTS")))->Fetch();
$user = new CUser();
if ($arUser["ID"] == $win_id) {
//отправляем письмо победителю
$log->Add("winner:" . $arUser["EMAIL"] . " " . $arUser["NAME"] . " " . $this->name . " " . $arUser["UF_POINTS"] . " " . $this->id . ";");
if (strlen($arUser["NAME"]) > 0) {
$name = "Уважаемый " . $arUser["NAME"] . "!";
} else {
$name = "";
}
CEvent::SendImmediate("AUCTION_WINNER", "s1", array("EMAIL_TO" => $arUser["EMAIL"], "USER_NAME" => $arUser["NAME"], "UNIT_NAME" => $this->name, "USER_POINTS" => $arUser["UF_POINTS"], "UNIT_ID" => $this->id), "N");
}
$this->winner = $win_id;
return $win_id;
} else {
return 0;
}
}
示例15: OnBeforeIBlockElementAddHandler
//.........这里部分代码省略.........
);
$ID = $user->Add($arFieldsUser);
}
if(($ID)||(CUser::IsAuthorized())){
if(CUser::IsAuthorized()){
$rsUser = CUser::GetByID(CUser::GetID());
$arUser = $rsUser->Fetch();
$ID=$arUser['ID'];
}
$arFields["CREATED_BY"]=$ID;
$arFields["PROPERTY_VALUES"][83]=$ID;
$_SESSION['NEW_USER_ID']=$ID;
}
if($ID){
if (strlen($arFields["NAME"]) > 0 && strlen($arFields["CODE"]) <= 0) {
$arParams = array(
"max_len" => "100", // обрезаем символьный код до 100 символов
"change_case" => "L", // приводим к нижнему регистру
"replace_space" => "-", // меняем пробелы на тире
"replace_other" => "-", // меняем плохие символы на тире
"delete_repeat_replace" => "true", // удаляем повторяющиеся тире
"use_google" => "false", // отключаем использование google
);
$arFields["CODE"] = Cutil::translit($arFields["NAME"], "ru", $arParams);
}
unset($_SESSION['VIP_ID']);
if(($arFields["PROPERTY_VALUES"][81][0]=='40')){
$_SESSION['VIP_ID']=40;
}
if(($arFields["PROPERTY_VALUES"][81][0]=='46')){
$_SESSION['VIP_ID']=46;
}
if((!$_REQUEST['CODE'])&&(!CUser::IsAuthorized())){
$arEventFields = Array(
"NAME" => $arFields["PROPERTY_VALUES"][89],
"EMAIL" => $arFields["PROPERTY_VALUES"][88],
"LOGIN" => $arFields["PROPERTY_VALUES"][88],
"PERSONAL_MOBILE" => $arFields["PROPERTY_VALUES"][91],
"PASSWORD" => $password,
);
$event = new CEvent;
$event->SendImmediate("MAIN_USER_INFOTEHNOLOG", SITE_ID, $arEventFields);
}else{
}
}
}
if (($arFields["IBLOCK_ID"] == 11) &&($arFields["ACTIVE"] == "Y")){
$_SESSION['active_block'] = $arFields;
$params = Array(
"max_len" => "100", // обрезает символьный код до 100 символов
"change_case" => "L", // буквы преобразуются к нижнему регистру
"replace_space" => "_", // меняем пробелы на нижнее подчеркивание
"replace_other" => "_", // меняем левые символы на нижнее подчеркивание
"delete_repeat_replace" => "true", // удаляем повторяющиеся нижние подчеркивания
"use_google" => "false", // отключаем использование google
);
$el = new CIBlockElement;
$PROP = array();
$PROP[108] = $arProps['F_EMAIL']['VALUE'];
$PROP[60] = $arProps['F_TELEPHONE']['VALUE'];
$PROP[100] = $arUserLogin['ID'];
$arElem= Array(
"CREATED_BY"=>$arUserLogin['ID'],
"IBLOCK_ID" => 9,
"NAME" => $arProps['F_NAMECOMPANY']['VALUE'],
"CODE" => CUtil::translit($arProps['F_NAMECOMPANY']['VALUE'], "ru" , $params),
"ACTIVE" => "Y",
"PROPERTY_VALUES"=> $PROP,
);
if($PRODUCT_ID = $el->Add($arElem)) {
if($new_partner){
$lg_psswrd="Ваши регистрационные данные: <br> Логин:".$arProps['F_EMAIL']['VALUE']."<br> Пароль:".$password."<br>";
}else{
$lg_psswrd="Ваш логин и пароль были высланы ранее при регистрации данного аккаунта";
}
}
}
}