Mar 08 09:11:01 host=127.0.0.1 tls=on auth=off from=noreply@binpro.ru recipients=alex-00@mail.ru mailsize=3749 smtpstatus=250 smtpmsg='250 2.0.0 Ok: queued as A6E0723B4D' exitcode=EX_OK Mar 08 09:40:05 host=127.0.0.1 tls=on auth=off from=noreply@binpro.ru recipients=velobox@inbox.ru mailsize=36938 smtpstatus=250 smtpmsg='250 2.0.0 Ok: queued as 8FC7E23B4C' exitcode=EX_OK Mar 08 10:09:03 host=127.0.0.1 tls=on auth=off from=noreply@binpro.ru recipients=alex-00@mail.ru mailsize=3749 smtpstatus=250 smtpmsg='250 2.0.0 Ok: queued as D129E23B51' exitcode=EX_OK |
# smtp account configuration for default account default logfile /home/bitrix/msmtp_default.log host 127.0.0.1 port 25 from noreply@binpro.ru keepbcc off auth off tls on tls_certcheck off |
sendmail_path = sendmail -t -i -f noreply@binpro.ru ;bitrix-env |
127.0.0.1 localhost localhost.localdomain ::1 localhost localhost.localdomain 23.111.204.11 binpro.ru |
if(mail(" else echo "Неудача, почтовая система не работает, попробуйте еще!"; |
php -r "mail(' |
echo "hello from mail.com.ru." | msmtp --debug -a site.ru |
# smtp account configuration for site.ru account site.ru logfile /home/bitrix/msmtp_site.ru.log host smtp.yandex.ru port 587 from keepbcc on auth on user password *********** tls on tls_starttls on tls_certcheck off |
$properties['PRICE_ADD'] = array( 'NAME' => 'Наценка', 'CODE' => 'PRICE_ADD', 'VALUE' => $request->getPost('price_add'), 'SORT' => 500 ); |
/** * @param array $products * * @return Sale\Result */ public function getProductData(array $products) { $result = parent::getProductData($products); // Во избежании казусов при работе с командной строкой PHP if(!Bitrix\Main\Context::getCurrent()->getSite()) return $result; $basket = Sale\Basket::loadItemsForFUser(Sale\Fuser::getId(), Bitrix\Main\Context::getCurrent()->getSite()); $productDataList = array(); foreach($result->getData()['PRODUCT_DATA_LIST'] as $productId => $arProduct) { foreach($arProduct['PRICE_LIST'] as $basketItemId => &$arItem) { // При добавлении в корзину нет у товара ID, мы не сможем его свойства тут посмотреть if((int)$basketItemId !== 0) { if($basketItem = $basket->getItemById($basketItemId)) { $properties = $basketItem->getPropertyCollection()->getPropertyValues(); // Если есть наценка, добавляем её к цене if(!empty($properties['PRICE_ADD']) && isset($properties['PRICE_ADD']['VALUE'])) { $arItem['BASE_PRICE'] = $arItem['BASE_PRICE'] + (float)$properties['PRICE_ADD']['VALUE']; $arItem['PRICE'] = $arItem['PRICE'] + (float)$properties['PRICE_ADD']['VALUE']; } } } } $productDataList[$productId] = $arProduct; unset($arItem); } $result->setData(['PRODUCT_DATA_LIST' => $productDataList]); return $result; } |
$item->setField('QUANTITY', $value); |
$item->setFieldNoDemand('QUANTITY', $value); |
// Не надо нам при удалении ничего пересчитывать здесь. Таков путь. if(!$_POST['sbblRemoveItemFromCart']) { $basket = \Bitrix\Sale\Basket::loadItemsForFUser(\Bitrix\Sale\Fuser::getId(), SITE_ID); $refreshStrategy = \Bitrix\Sale\Basket\RefreshFactory::create(\Bitrix\Sale\Basket\RefreshFactory::TYPE_FULL); $result = $basket->refresh($refreshStrategy); $basket->save(); } |
$eventManager = \Bitrix\Main\EventManager::getInstance(); // draw user picture after login $eventManager->addEventHandler( "main", "OnAdminListDisplay", /** @param CAdminUiList $this_al */ static function (&$this_al) { if ($this_al->table_id == "tbl_user") { foreach ($this_al->aRows as &$row) { $userId = (int)$row->arRes['ID']; $picPath = CFile::GetPath( (CUser::GetByID($userId)->Fetch())["PERSONAL_PHOTO"] ); if (trim($picPath) != '') { $row->aFields["LOGIN"]["view"]["value"] .= ' <br><a target="_blank" href="' . $picPath . '">' . '<img style="max-width:200px;" src="' . $picPath . '"></a>'; } } } } ); |
<?php use Bitrix\Main\EventManager; use Bitrix\Main\EventResult; use Bitrix\Main\UI\Copyright; $eventManager = EventManager::getInstance(); $eventManager->addEventHandler( 'main', 'onGetThirdPartySoftware', function () { return new EventResult( EventResult::SUCCESS, [ (new Copyright('Модуль интеграции с Тинькофф')) ->setProductUrl('https://github.com/saundefined/tinkoff-sdk') ->setCopyright("Copyright 2020, Sergey Panteleev") ->setLicence(Copyright::LICENCE_MIT) ->setLicenceUrl('https://github.com/saundefined/tinkoff-sdk/blob/master/LICENSE.md'), (new Copyright('Модуль СМС-сервисы')) ->setProductUrl('https://github.com/qq-agency/ps.sms') ->setCopyright("Copyright 2020, QQ") ->setLicence(Copyright::LICENCE_MIT) ->setLicenceUrl('https://github.com/qq-agency/ps.sms/blob/master/LICENSE.md'), ] ); } ); |
composer update darkfriend/hlhelpers |
AddEventHandler('main', 'OnBeforeEventSend', "OnBeforeEventSendHandler"); function OnBeforeEventSendHandler(&$arFields, &$arTemplate) { global $USER; if($USER->IsAuthorized()) { $arFields["AUTHOR"] = 'Юзер залогинен: '.$USER->GetID().' ('.$USER->GetLogin().') '.$USER->GetFullName().', поле формы: '.$arFields["AUTHOR"]; }else{ $arFields["AUTHOR"] = 'Юзер не залогинен, поле формы: '.$arFields["AUTHOR"]; } } |
//отладка отправляемых сообщений с сайта if (!function_exists('custom_mail')) { function custom_mail($to, $subject, $body, $headers) { $f = fopen($_SERVER["DOCUMENT_ROOT"] . "/__maillog.txt", "a+"); fwrite($f, print_r(array('TO' => $to, 'SUBJECT' => $subject, 'BODY' => $body, 'HEADERS' => $headers), 1) . "\n========\n"); fclose($f); return mail($to, $subject, $body, $headers); } } |
//Проверяем, является ли $password текущим паролем пользователя. function isUserPassword($userId, $password) { $userData = CUser::GetByID($userId)->Fetch(); $salt = substr($userData['PASSWORD'], 0, (strlen($userData['PASSWORD']) - 32)); $realPassword = substr($userData['PASSWORD'], -32); $password = md5($salt.$password); return ($password == $realPassword); } |
v20.5.400 2020-07-24 Пароли пользователей теперь хешируются по алгоритму SHA-512. |
//проверяем, является ли $password текущим паролем пользователя function isUserPassword($userId, $password){ $userData = CUser::GetByID($userId)->Fetch(); $salt = substr($userData['PASSWORD'], 3, 16); $password = crypt($password, '$6$'.$salt.'$'); return ($password == $userData['PASSWORD']); } |