function InstallUserFields() { global $USER_FIELD_MANAGER, $APPLICATION; if (!IsModuleInstalled("blog")) { return; } $db_res = CUserTypeEntity::GetList(array("ID" => "ASC"), array("FIELD_NAME" => "UF_BLOG_POST_VOTE")); if ($db_res && ($res = $db_res->Fetch())) { return; } AddEventHandler("main", "OnUserTypeBuildList", array("CUserTypeVote", "GetUserTypeDescription")); require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/vote/classes/general/usertypevote.php"; $USER_FIELD_MANAGER->CleanCache(); $USER_FIELD_MANAGER->arUserTypes = ''; $arFields = array("BLOG_POST" => array("ENTITY_ID" => "BLOG_POST", "FIELD_NAME" => "UF_BLOG_POST_VOTE", "XML_ID" => "UF_BLOG_POST_VOTE", "SETTINGS" => array("CHANNEL_ID" => "add", "CHANNEL_TITLE" => "UF_BLOG_POST_VOTE", "CHANNEL_SYMBOLIC_NAME" => "UF_BLOG_POST_VOTE", "CHANNEL_USE_CAPTCHA" => "N", "UNIQUE" => 13, "UNIQUE_IP_DELAY" => array("DELAY" => "10", "DELAY_TYPE" => "D")))); $arFieldProps = array("USER_TYPE_ID" => "vote", "SORT" => 100); foreach ($arFields as $arField) { $rsData = CUserTypeEntity::GetList(array("FIELD_NAME" => "ASC"), $arField); if (!($arRes = $rsData->Fetch())) { $arProps = array_merge($arFieldProps, $arField); $obUserField = new CUserTypeEntity(); $intID = $obUserField->Add($arProps); if (false == $intID) { if ($strEx = $APPLICATION->GetException()) { $this->errors[] = $strEx->GetString(); } } } } }
function __construct(&$component) { global $APPLICATION; $this->component =& $component; $arResult =& $component->arResult; $arParams =& $component->arParams; $_REQUEST["FILES"] = is_array($_REQUEST["FILES"]) ? $_REQUEST["FILES"] : array(); $_REQUEST["FILES_TO_UPLOAD"] = is_array($_REQUEST["FILES_TO_UPLOAD"]) ? $_REQUEST["FILES_TO_UPLOAD"] : array(); if (isset($arParams['FILES_COUNT']) && (intval($arParams['FILES_COUNT']) > 0 || $arParams['FILES_COUNT'] === 0)) { $this->filesCount = intval($arParams['FILES_COUNT']); } if (isset($arParams['IMAGE_SIZE']) && (intval($arParams['IMAGE_SIZE']) > 0 || $arParams['IMAGE_SIZE'] === 0)) { $this->imageSize = intval($arParams['IMAGE_SIZE']); } $APPLICATION->AddHeadScript("/bitrix/js/main/utils.js"); $APPLICATION->AddHeadScript("/bitrix/js/forum/popup_image.js"); AddEventHandler("forum", "OnPrepareComments", array(&$this, "OnPrepareComments")); AddEventHandler("forum", "OnCommentDispay", array(&$this, "OnCommentDispay")); if ($arResult["FORUM"]["ALLOW_UPLOAD"] !== "N") { AddEventHandler("forum", "OnCommentAdd", array(&$this, "OnCommentAdd")); AddEventHandler("forum", "OnCommentPreview", array(&$this, "OnCommentPreview")); AddEventHandler("forum", "OnCommentFormDisplay", array(&$this, "OnCommentFormDisplay")); AddEventHandler("forum", "OnCommentPreviewDisplay", array(&$this, "OnCommentPreviewDisplay")); } }
function ForumEventManager() { if (IsModuleInstalled("iblock")) { AddEventHandler("forum", "onAfterMessageAdd", array(&$this, "updateIBlockPropertyAfterAddingMessage")); AddEventHandler("forum", "onMessageModerate", array(&$this, "updateIBlockProperty")); AddEventHandler("forum", "onAfterMessageDelete", array(&$this, "updateIBlockPropertyAfterDeletingMessage")); } }
function __construct(&$component) { $this->component =& $component; if (isset($this->component->arResult['FORUM']['INDEXATION']) && $this->component->arResult['FORUM']['INDEXATION'] == 'Y') { AddEventHandler("forum", "OnCommentDispay", array(&$this, "OnCommentDispay")); AddEventHandler("forum", "OnPrepareComments", array($this, "OnPrepareComments")); } }
function GetAuditTypes() { AddEventHandler("main", "GetAuditTypesForum", array("CForumEventLog", "GetAuditTypes")); foreach (GetModuleEvents("main", "GetAuditTypesForum", true) as $arEvent) { $AuditTypes = ExecuteModuleEventEx($arEvent); } return $AuditTypes; }
function __construct(&$component) { global $APPLICATION; $this->component =& $component; $arResult =& $component->arResult; $arParams =& $component->arParams; AddEventHandler("forum", "OnCommentsInit", array(&$this, "OnCommentsInit")); AddEventHandler("forum", "OnPrepareComments", array(&$this, "OnPrepareComments")); }
function GetAuditTypes() { AddEventHandler("main", "GetAuditTypesIblock", array("CAllIBlock", "GetAuditTypes")); $db_events = GetModuleEvents("main", "GetAuditTypesIblock"); while ($arEvent = $db_events->Fetch()) { $AuditTypes = ExecuteModuleEventEx($arEvent); } return $AuditTypes; }
function GetUserTypeDescription() { AddEventHandler("main", "OnBeforeUserTypeUpdate", array(__CLASS__, "CheckSettings")); AddEventHandler("main", "OnBeforeUserTypeAdd", array(__CLASS__, "CheckSettings")); if (IsModuleInstalled("blog")) { AddEventHandler("blog", "OnBeforePostUserFieldUpdate", array(__CLASS__, "OnBeforePostUserFieldUpdate")); } return array("USER_TYPE_ID" => "vote", "CLASS_NAME" => __CLASS__, "DESCRIPTION" => GetMessage("V_USER_TYPE_DESCRIPTION"), "BASE_TYPE" => "int"); }
/** * Регистрация пункта меню */ public function register() { foreach ($this->items as &$item) { $this->setChildrenItemsId($item); } AddEventHandler("main", "OnBuildGlobalMenu", function () { return [$this->menu_id => $this->toArray()]; }); }
/** * Creates or updates the manifest file for the page with usage its content. * * @param $content */ public static function setEnable($isEnable = true) { $selfObject = self::getInstance(); if ($isEnable && !$selfObject->isEnable) { AddEventHandler("main", "OnBeforeEndBufferContent", array(__CLASS__, "onBeforeEndBufferContent")); AddEventHandler("main", "OnEndBufferContent", array(__CLASS__, "onEndBufferContent")); $selfObject->isEnable = true; } }
public static function GetInstance() { static $instance = null; if ($instance === null) $instance = new static(); AddEventHandler("main", "OnEpilog", array("CNocaptcha", "AddSettingsAndScript")); return $instance; }
function RegisterVirtualIOCompatibility($baseDir = '') { static $IOCompartible = 'BX_IO_Compartible'; if (defined($IOCompartible)) { return false; } define($IOCompartible, 'Y'); AddEventHandler('main', 'BXVirtualIO_ConvertCharset', array($this, 'VirtualIO_ConvertCharset')); return true; }
function InitLogEvents(&$webdav) { static $loaded = false; if ($webdav->Type === "iblock" && !$loaded) { $loaded = true; $this->iblock_id = $webdav->IBLOCK_ID; $event_names = array_keys($this->events); foreach ($event_names as $k) { AddEventHandler("webdav", $k, array(&$this, $k)); } } }
function InstallUserFields() { global $USER_FIELD_MANAGER, $APPLICATION; AddEventHandler("main", "OnUserTypeBuildList", array("CUserTypeWebdavElement", "GetUserTypeDescription")); AddEventHandler("main", "OnUserTypeBuildList", array("CUserTypeWebdavElementHistory", "GetUserTypeDescription")); require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/webdav/classes/usertypewebdav.php"; require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/webdav/classes/usertypewebdavelementhistory.php"; $USER_FIELD_MANAGER->CleanCache(); $USER_FIELD_MANAGER->arUserTypes = ''; $arFields = array("BLOG_POST" => array("ENTITY_ID" => "BLOG_POST", "FIELD_NAME" => "UF_BLOG_POST_FILE", "XML_ID" => "UF_BLOG_POST_FILE"), "BLOG_COMMENT" => array("ENTITY_ID" => "BLOG_COMMENT", "FIELD_NAME" => "UF_BLOG_COMMENT_FILE", "XML_ID" => "UF_BLOG_COMMENT_FILE")); $arFieldProps = array("USER_TYPE_ID" => "webdav_element", "SORT" => 100, "MULTIPLE" => "Y", "MANDATORY" => "N", "SHOW_FILTER" => "N", "SHOW_IN_LIST" => "N", "EDIT_IN_LIST" => "Y", "IS_SEARCHABLE" => "N", "SETTINGS" => array(), "EDIT_FORM_LABEL" => "", "LIST_COLUMN_LABEL" => "", "LIST_FILTER_LABEL" => "", "ERROR_MESSAGE" => "", "HELP_MESSAGE" => ""); $typeData = CUserTypeEntity::GetList(array(), array("ENTITY_ID" => "BLOG_COMMENT", "FIELD_NAME" => "UF_BLOG_COMMENT_FH", "XML_ID" => "UF_BLOG_COMMENT_FH")); if (!($typeData = $typeData->Fetch())) { $arFieldPropsHistory = array("USER_TYPE_ID" => "webdav_element_history", "SORT" => 100, "MULTIPLE" => "N", "MANDATORY" => "N", "SHOW_FILTER" => "N", "SHOW_IN_LIST" => "N", "EDIT_IN_LIST" => "Y", "IS_SEARCHABLE" => "N", "SETTINGS" => array(), "EDIT_FORM_LABEL" => "", "LIST_COLUMN_LABEL" => "", "LIST_FILTER_LABEL" => "", "ERROR_MESSAGE" => "", "HELP_MESSAGE" => "", "ENTITY_ID" => "BLOG_COMMENT", "FIELD_NAME" => "UF_BLOG_COMMENT_FH", "XML_ID" => "UF_BLOG_COMMENT_FH"); $obUserField = new CUserTypeEntity(); $intID = $obUserField->Add($arFieldPropsHistory); if (false == $intID) { if ($strEx = $APPLICATION->GetException()) { $this->errors[] = $strEx->GetString(); } } } foreach ($arFields as $fieldName => $arField) { $rsData = CUserTypeEntity::GetList(array(), $arField); if ($arRes = $rsData->Fetch()) { $intID = $arRes['ID']; } else { $arProps = $arFieldProps + $arField; $obUserField = new CUserTypeEntity(); $intID = $obUserField->Add($arProps); if (false == $intID) { if ($strEx = $APPLICATION->GetException()) { $this->errors[] = $strEx->GetString(); } } } } $rsData = CUserTypeEntity::GetList(array(), array("ENTITY_ID" => "BLOG_POST", "XML_ID" => "UF_BLOG_POST_F_EDIT")); $arRes = $rsData->Fetch(); if (!$arRes) { $arFieldProps = array("USER_TYPE_ID" => "boolean", "SORT" => 100, "MULTIPLE" => "N", "MANDATORY" => "N", "SHOW_FILTER" => "N", "SHOW_IN_LIST" => "N", "EDIT_IN_LIST" => "Y", "IS_SEARCHABLE" => "N", "SETTINGS" => array(), "EDIT_FORM_LABEL" => "", "LIST_COLUMN_LABEL" => "", "LIST_FILTER_LABEL" => "", "ERROR_MESSAGE" => "", "HELP_MESSAGE" => "", "ENTITY_ID" => "BLOG_POST", "FIELD_NAME" => "UF_BLOG_POST_F_EDIT", "XML_ID" => "UF_BLOG_POST_F_EDIT"); $obUserField = new CUserTypeEntity(); $propID = $obUserField->Add($arFieldProps, false); } $rsData = CUserTypeEntity::GetList(array(), array("ENTITY_ID" => "BLOG_POST", "XML_ID" => "UF_BLOG_POST_FILE")); $arRes = $rsData->Fetch(); if ($arRes && empty($arRes['SETTINGS']['UF_TO_SAVE_ALLOW_EDIT'])) { $arRes['SETTINGS']['UF_TO_SAVE_ALLOW_EDIT'] = 'UF_BLOG_POST_F_EDIT'; $obUserField = new CUserTypeEntity(); $res = $obUserField->Update($arRes['ID'], array('SETTINGS' => $arRes['SETTINGS'])); } }
function __construct() { AddEventHandler("vote", "onAfterVoteChannelAdd", array(&$this, "OnAfterVoteChannelChange")); AddEventHandler("vote", "onAfterVoteChannelUpdate", array(&$this, "OnAfterVoteChannelChange")); AddEventHandler("vote", "onAfterChannelDelete", array(&$this, "OnAfterVoteChannelChange")); AddEventHandler("vote", "onAfterVoteAdd", array(&$this, "OnAfterVoteChange")); AddEventHandler("vote", "onAfterVoteUpdate", array(&$this, "OnAfterVoteChange")); AddEventHandler("vote", "onAfterVoteDelete", array(&$this, "OnAfterVoteChange")); AddEventHandler("vote", "onVoteReset", array(&$this, "OnAfterVoteChange")); AddEventHandler("vote", "onAfterVoting", array(&$this, "OnAfterVoteChange")); if (defined("BX_COMP_MANAGED_CACHE")) { AddEventHandler("vote", "onAfterVoteQuestionAdd", array(&$this, "OnAfterVoteQuestionAdd")); AddEventHandler("vote", "onBeforeVoteQuestionUpdate", array(&$this, "OnBeforeVoteQuestionUpdate")); AddEventHandler("vote", "onAfterVoteQuestionUpdate", array(&$this, "OnAfterVoteQuestionUpdate")); AddEventHandler("vote", "onAfterVoteQuestionDelete", array(&$this, "OnAfterVoteQuestionDelete")); AddEventHandler("vote", "onAfterVoteAnswerAdd", array(&$this, "OnAfterVoteAnswerAdd")); AddEventHandler("vote", "onBeforeVoteAnswerUpdate", array(&$this, "OnBeforeVoteAnswerUpdate")); AddEventHandler("vote", "onAfterVoteAnswerUpdate", array(&$this, "OnAfterVoteAnswerUpdate")); AddEventHandler("vote", "onAfterVoteAnswerDelete", array(&$this, "OnAfterVoteAnswerDelete")); } }
/** * Sets isEnable property value * @param bool $isEnable */ public static function setEnable($isEnable = true) { if ($isEnable && !self::$isEnable) { self::$onBeforeHandleKey = AddEventHandler("main", "OnBeforeEndBufferContent", array(__CLASS__, "OnBeforeEndBufferContent")); self::$onHandleKey = AddEventHandler("main", "OnEndBufferContent", array(__CLASS__, "OnEndBufferContent")); self::$isEnable = true; \CJSCore::init(array("fc"), false); $actionType = \Bitrix\Main\Context::getCurrent()->getServer()->get("HTTP_BX_ACTION_TYPE"); if ($actionType == "get_dynamic") { //Is it the background request? self::$isBackgroundRequest = true; } } elseif (!$isEnable && self::$isEnable) { if (self::$onBeforeHandleKey >= 0) { RemoveEventHandler("main", "OnBeforeEndBufferContent", self::$onBeforeHandleKey); } if (self::$onBeforeHandleKey >= 0) { RemoveEventHandler("main", "OnEndBufferContent", self::$onHandleKey); } self::$isEnable = false; } }
function convert($text, $bPreview = True, $arImages = array(), $allow = array("HTML" => "N", "ANCHOR" => "Y", "BIU" => "Y", "IMG" => "Y", "QUOTE" => "Y", "CODE" => "Y", "FONT" => "Y", "LIST" => "Y", "SMILES" => "Y", "NL2BR" => "N", "VIDEO" => "Y", "TABLE" => "Y", "CUT_ANCHOR" => "N", "SHORT_ANCHOR" => "N"), $arParams = array()) { if (!is_array($arParams) && strlen($arParams) > 0) { $type = $arParams; } elseif (is_array($arParams)) { $type = $arParams["type"]; } if (IntVal($arParams["imageWidth"]) > 0) { $this->imageWidth = IntVal($arParams["imageWidth"]); } if (IntVal($arParams["imageHeight"]) > 0) { $this->imageHeight = IntVal($arParams["imageHeight"]); } if (strlen($arParams["pathToUser"]) > 0) { $this->pathToUser = $arParams["pathToUser"]; } $this->parser_nofollow = COption::GetOptionString("blog", "parser_nofollow", "N"); $this->type = $type == "rss" ? "rss" : "html"; $this->isSonetLog = $arParams["isSonetLog"]; $this->allow = array("HTML" => $allow["HTML"] == "Y" ? "Y" : "N", "NL2BR" => $allow["NL2BR"] == "Y" ? "Y" : "N", "CODE" => $allow["CODE"] == "N" ? "N" : "Y", "VIDEO" => $allow["VIDEO"] == "N" ? "N" : "Y", "ANCHOR" => $allow["ANCHOR"] == "N" ? "N" : "Y", "BIU" => $allow["BIU"] == "N" ? "N" : "Y", "IMG" => $allow["IMG"] == "N" ? "N" : "Y", "QUOTE" => $allow["QUOTE"] == "N" ? "N" : "Y", "FONT" => $allow["FONT"] == "N" ? "N" : "Y", "LIST" => $allow["LIST"] == "N" ? "N" : "Y", "SMILES" => $allow["SMILES"] == "N" ? "N" : "Y", "TABLE" => $allow["TABLE"] == "N" ? "N" : "Y", "ALIGN" => $allow["ALIGN"] == "N" ? "N" : "Y", "CUT_ANCHOR" => $allow["CUT_ANCHOR"] == "Y" ? "Y" : "N", "SHORT_ANCHOR" => $allow["SHORT_ANCHOR"] == "Y" ? "Y" : "N", "USER" => $allow["USER"] == "N" ? "N" : "Y", "TAG" => $allow["TAG"] == "N" ? "N" : "Y"); $this->arImages = $arImages; $this->bPreview = $bPreview; static $firstCall = true; if ($firstCall) { $firstCall = false; AddEventHandler("main", "TextParserBefore", array("blogTextParser", "ParserCut")); AddEventHandler("main", "TextParserBefore", array("blogTextParser", "ParserBlogImageBefore")); AddEventHandler("main", "TextParserAfterTags", array("blogTextParser", "ParserBlogImage")); AddEventHandler("main", "TextParserAfterTags", array("blogTextParser", "ParserUser")); AddEventHandler("main", "TextParserAfterTags", array("blogTextParser", "ParserTag")); AddEventHandler("main", "TextParserAfter", array("blogTextParser", "ParserCutAfter")); AddEventHandler("main", "TextParserVideoConvert", array("blogTextParser", "blogConvertVideo")); AddEventHandler("main", "TextParserAfterTags", array(&$this, "ParserUserfields")); } $text = $this->convertText($text); return trim($text); }
OnLoad: function() {}, OnSave: function() {} }; }; // Submit form by ctrl+enter window.blogCommentCtrlEnterHandler = function(e) { oBlogComLHE.SaveContent(); if (document.forms.form_comment) document.forms.form_comment.submit(); }; document.forms.form_comment.onsubmit = function() { oBlogComLHE.SaveContent(); }; </script> <?php } AddEventHandler("fileman", "OnIncludeLightEditorScript", "CustomizeLHEForBlogComments"); } $arSmiles = array(); if (!empty($arResult["Smiles"])) { foreach ($arResult["Smiles"] as $arSmile) { $arSmiles[] = array('name' => $arSmile["~LANG_NAME"], 'path' => "/bitrix/images/blog/smile/" . $arSmile["IMAGE"], 'code' => str_replace("\\\\", "\\", $arSmile["TYPE"])); } } rsort($arSmiles); $LHE = new CLightHTMLEditor(); $LHE->Show(array('id' => 'LHEBlogCom', 'height' => $arParams['EDITOR_DEFAULT_HEIGHT'], 'inputId' => 'comment', 'inputName' => 'comment', 'content' => "", 'bUseFileDialogs' => false, 'bUseMedialib' => false, 'toolbarConfig' => array('Bold', 'Italic', 'Underline', 'Strike', 'ForeColor', 'FontList', 'FontSizeList', 'RemoveFormat', 'Quote', 'Code', !$arResult["NoCommentUrl"] ? 'CreateLink' : 'CreateLinkNC', !$arResult["NoCommentUrl"] ? 'DeleteLink' : '', 'Image', $arResult["allowVideo"] == "Y" ? 'BlogInputVideo' : '', 'Table', 'InsertOrderedList', 'InsertUnorderedList', 'SmileList', 'Source'), 'jsObjName' => 'oBlogComLHE', 'arSmiles' => $arSmiles, 'smileCountInToolbar' => $arParams['SMILES_COUNT'], 'bSaveOnBlur' => false, 'BBCode' => true, 'bResizable' => $arParams['EDITOR_RESIZABLE'], 'bQuoteFromSelection' => true, 'ctrlEnterHandler' => 'blogCommentCtrlEnterHandler', 'bSetDefaultCodeView' => $arParams['EDITOR_CODE_DEFAULT'], 'bBBParseImageSize' => true));
$arResult['WIKI_oper'] = 'edit'; if (isset($_REQUEST[$arParams['OPER_VAR']])) { $arResult['WIKI_oper'] = $_REQUEST[$arParams['OPER_VAR']]; } $GLOBALS['arParams'] = $arParams; if (!CModule::IncludeModule('wiki')) { ShowError(GetMessage('WIKI_MODULE_NOT_INSTALLED')); return; } $arResult['ALLOW_HTML'] = CWikiUtils::isAllowHTML() ? 'Y' : 'N'; if (!CModule::IncludeModule('iblock')) { ShowError(GetMessage('IBLOCK_MODULE_NOT_INSTALLED')); return; } if (IsModuleInstalled('search')) { AddEventHandler('search', 'BeforeIndex', array('CWikiUtils', 'OnBeforeIndex')); } if (empty($arParams['IBLOCK_ID'])) { ShowError(GetMessage('IBLOCK_NOT_ASSIGNED')); return; } if (array_key_exists('SOCNET_GROUP_ID', $arParams) && empty($arParams['SOCNET_GROUP_ID'])) { ShowError(GetMessage('WIKI_ACCESS_DENIED')); return; } if (CWikiSocnet::isEnabledSocnet() && !empty($arParams['SOCNET_GROUP_ID'])) { if (!CModule::IncludeModule('socialnetwork')) { ShowError(GetMessage('SOCNET_MODULE_NOT_INSTALLED')); return; } }
?> " alt="" border="0" data-bx-image="<?php echo $val["full"]; ?> "></span><?php } ?> </div> </div> <?php } ?> <?php if ($CurPost["POST_PROPERTIES"]["SHOW"] == "Y") { $eventHandlerID = false; $eventHandlerID = AddEventHandler('main', 'system.field.view.file', array('CBlogTools', 'blogUFfileShow')); ?> <?php foreach ($CurPost["POST_PROPERTIES"]["DATA"] as $FIELD_NAME => $arPostField) { ?> <?php if (!empty($arPostField["VALUE"])) { ?> <div> <?php echo $FIELD_NAME == 'UF_BLOG_POST_DOC' ? "" : "<b>" . $arPostField["EDIT_FORM_LABEL"] . ":</b> "; ?> <?php $APPLICATION->IncludeComponent("bitrix:system.field.view", $arPostField["USER_TYPE"]["USER_TYPE_ID"], array("arUserField" => $arPostField), null, array("HIDE_ICONS" => "Y")); ?> </div>
if ($uperWeight > $weightForCalc) { $price = self::getConfValue($arConfig, 'TARIF_WARE_DOOR_' . $uperWeight); $arDebug[] = 'ware-door price: ' . $price; $servicePrice += $price; $arDebug[] = 'Service price: ' . $servicePrice; break; } } } } $totalPrice = $servicePrice + $BO + $CK; $arDebug[] = 'Total value: ' . $totalPrice; return $totalPrice; } public static function calcVolumeWeightByVolume($volume) { return $volume / 4000000; } public static function getWeightForCalc($weight, $volume) { $volWeight = self::calcVolumeWeightByVolume($volume); if (floatval($weight) >= floatval($volWeight)) { $result = $weight; } else { $result = $volWeight; } return $result; } } AddEventHandler('sale', 'onSaleDeliveryHandlersBuildList', array('CDeliveryUaPost', 'Init'));
} public static function DeleteByUser($USER_ID) { global $DB; $USER_ID = intval($USER_ID); $DB->Query("delete from b_user_access where user_id=" . $USER_ID); self::ClearStat(false, $USER_ID); } public static function SaveLastRecentlyUsed($arLRU) { foreach ($arLRU as $provider => $arRecent) { if (is_array($arRecent)) { $arLastRecent = CUserOptions::GetOption("access_dialog_recent", $provider, array()); $arItems = array_keys($arRecent); $arItems = array_unique(array_merge($arItems, $arLastRecent)); $arItems = array_slice($arItems, 0, 20); CUserOptions::SetOption("access_dialog_recent", $provider, $arItems); } } } public static function GetLastRecentlyUsed($provider) { $res = CUserOptions::GetOption("access_dialog_recent", $provider, array()); if (!is_array($res)) { $res = array(); } return $res; } } AddEventHandler("main", "OnAuthProvidersBuildList", array("CAccess", "GetProviders"));
<?php if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) { die; } if (!CModule::IncludeModule("webdav")) { //ShowError(GetMessage("SONET_WD_MODULE_IS_NOT_INSTALLED")); return 0; } elseif (!CModule::IncludeModule("iblock")) { //ShowError(GetMessage("SONET_IB_MODULE_IS_NOT_INSTALLED")); return 0; } $file = trim(preg_replace("'[\\\\/]+'", "/", dirname(__FILE__) . "/../lang/" . LANGUAGE_ID . "/include/webdav_2.php")); __IncludeLang($file); $obDavEventHandler = CWebDavSocNetEvent::GetRuntime(); $obDavEventHandler->SetSocnetVars($arResult, $arParams); AddEventHandler("socialnetwork", "OnBeforeSocNetGroupUpdate", array($obDavEventHandler, "SocNetGroupRename"));
<?php IncludeModuleLangFile(__FILE__); class CSocServDescription { public function GetDescription() { $tw_disabled = !function_exists("hash_hmac"); return array(array("ID" => "Bitrix24Net", "CLASS" => "CSocServBitrix24Net", "NAME" => GetMessage("socserv_bitrix24net_name"), "ICON" => "bitrix24"), array("ID" => "Facebook", "CLASS" => "CSocServFacebook", "NAME" => "Facebook", "ICON" => "facebook"), array("ID" => "YandexOAuth", "CLASS" => "CSocServYandexAuth", "NAME" => GetMessage("socserv_openid_yandex"), "ICON" => "yandex"), array("ID" => "MyMailRu", "CLASS" => "CSocServMyMailRu", "NAME" => GetMessage("socserv_mailru_name"), "ICON" => "mymailru"), array("ID" => "OpenID", "CLASS" => "CSocServOpenID", "NAME" => "OpenID", "ICON" => "openid"), array("ID" => "YandexOpenID", "CLASS" => "CSocServYandex", "NAME" => GetMessage("socserv_openid_yandex_openid"), "ICON" => "yandex"), array("ID" => "MailRuOpenID", "CLASS" => "CSocServMailRu", "NAME" => "Mail.Ru", "ICON" => "openid-mail-ru"), array("ID" => "Livejournal", "CLASS" => "CSocServLivejournal", "NAME" => "Livejournal", "ICON" => "livejournal"), array("ID" => "Liveinternet", "CLASS" => "CSocServLiveinternet", "NAME" => "Liveinternet", "ICON" => "liveinternet"), array("ID" => "Blogger", "CLASS" => "CSocServBlogger", "NAME" => "Blogger", "ICON" => "blogger"), array("ID" => "Twitter", "CLASS" => "CSocServTwitter", "NAME" => "Twitter", "ICON" => "twitter", "DISABLED" => $tw_disabled), array("ID" => "VKontakte", "CLASS" => "CSocServVKontakte", "NAME" => GetMessage("socserv_vk_name"), "ICON" => "vkontakte"), array("ID" => "GoogleOAuth", "CLASS" => "CSocServGoogleOAuth", "NAME" => "Google", "ICON" => "google"), array("ID" => "GooglePlusOAuth", "CLASS" => "CSocServGooglePlusOAuth", "NAME" => "Google+", "ICON" => "google-plus"), array("ID" => "LiveIDOAuth", "CLASS" => "CSocServLiveIDOAuth", "NAME" => "LiveID", "ICON" => "liveid"), array("ID" => "Odnoklassniki", "CLASS" => "CSocServOdnoklassniki", "NAME" => GetMessage("socserv_odnoklassniki_name"), "ICON" => "odnoklassniki"), array("ID" => "Dropbox", "CLASS" => "CSocServDropboxAuth", "NAME" => "Dropbox", "ICON" => "dropbox"), array("ID" => "Box", "CLASS" => "CSocServBoxAuth", "NAME" => "Box.com", "ICON" => "box")); } } AddEventHandler("socialservices", "OnAuthServicesBuildList", array("CSocServDescription", "GetDescription"));
<?php /** * Created by PhpStorm. * User: root * Date: 07.08.15 * Time: 1:37 */ AddEventHandler("sale", "OnSaleComponentOrderOneStepFinal", array("WeSaleOrderAjaxHandler", "AddGoogleAnaliticsEcommerceCode")); class WeSaleOrderAjaxHandler { function AddGoogleAnaliticsEcommerceCode($orderId, $arOrder, $arParams){ global $APPLICATION; if(isset($_SESSION['GA_ORDER_ID']) && $_SESSION['GA_ORDER_ID'] == $orderId) return; $gaOutput = array(); $arSite = CSite::GetByID($arOrder['LID'])->Fetch(); $gaOutput[] = "<script>"; $gaOutput[] = "ga('require', 'ecommerce', 'ecommerce.js');"; $gaOutput[] = sprintf( "ga('ecommerce:addTransaction', { 'id': '%s', 'affiliation': '%s', 'revenue': '%s', 'shipping': '%s',
<?php if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) { die; } if ($_REQUEST["AJAX_POST"] == "Y" && $_REQUEST["ENTITY_XML_ID"] == $arParams["ENTITY_XML_ID"] && !empty($arResult["OUTPUT_LIST"]["JSON"])) { if (!function_exists("__fcParseAnswer")) { function __fcParseAnswer(&$output, $arParams, $arResult) { $GLOBALS["APPLICATION"]->RestartBuffer(); echo CUtil::PhpToJSObject($arResult["OUTPUT_LIST"]["JSON"]); die; } } AddEventHandler('forum', 'OnCommentsDisplayTemplate', __fcParseAnswer); }
/** * Function gets pay system info from database, no cache is used here * @return void */ protected function obtainDataPaySystem() { if (empty($this->dbResult["ID"])) { return; } if (intval($this->dbResult["PAY_SYSTEM_ID"])) { $this->dbResult["PAY_SYSTEM"] = CSalePaySystem::GetByID($this->dbResult["PAY_SYSTEM_ID"], $this->dbResult["PERSON_TYPE_ID"]); } if ($this->dbResult["PAYED"] != "Y" && $this->dbResult["CANCELED"] != "Y") { if (intval($this->dbResult["PAY_SYSTEM_ID"])) { $dbPaySysAction = CSalePaySystemAction::GetList(array(), array("PAY_SYSTEM_ID" => $this->dbResult["PAY_SYSTEM_ID"], "PERSON_TYPE_ID" => $this->dbResult["PERSON_TYPE_ID"]), false, false, array("NAME", "ACTION_FILE", "NEW_WINDOW", "PARAMS", "ENCODING")); if ($arPaySysAction = $dbPaySysAction->Fetch()) { if (strlen($arPaySysAction["ACTION_FILE"])) { $this->dbResult["CAN_REPAY"] = "Y"; if ($arPaySysAction["NEW_WINDOW"] == "Y") { $this->dbResult["PAY_SYSTEM"]["PSA_ACTION_FILE"] = htmlspecialcharsbx($this->arParams["PATH_TO_PAYMENT"]) . '?ORDER_ID=' . urlencode(urlencode($this->dbResult["ACCOUNT_NUMBER"])); } else { CSalePaySystemAction::InitParamArrays($this->dbResult, $this->requestData["ID"], $arPaySysAction["PARAMS"]); $pathToAction = $_SERVER["DOCUMENT_ROOT"] . $arPaySysAction["ACTION_FILE"]; $pathToAction = str_replace("\\", "/", $pathToAction); while (substr($pathToAction, strlen($pathToAction) - 1, 1) == "/") { $pathToAction = substr($pathToAction, 0, strlen($pathToAction) - 1); } if (file_exists($pathToAction)) { if (is_dir($pathToAction) && file_exists($pathToAction . "/payment.php")) { $pathToAction .= "/payment.php"; } $this->dbResult["PAY_SYSTEM"]["PSA_ACTION_FILE"] = $pathToAction; } if (strlen($arPaySysAction["ENCODING"])) { define("BX_SALE_ENCODING", $arPaySysAction["ENCODING"]); AddEventHandler("main", "OnEndBufferContent", array($this, "changeBodyEncoding")); } } } } } } }
{ var arButton = arGlobalToolbar[i]; if (arButton[1] && arButton[1].id == "insert_flash" && arGlobalToolbar[i+1][1].id != "media") { arGlobalToolbar.splice(i + 1, 0, pMediaButton); break; } } } else { oBXEditorUtils.appendButton("insert_media", pMediaButton, "standart"); } </script> <?php } AddEventHandler("fileman", "OnIncludeHTMLEditorScript", "CustomizeEditor"); ?> <?php $tabControl->BeginEpilogContent(); ?> <?php echo bitrix_sessid_post(); ?> <?php echo GetFilterHiddens("filter_"); ?> <input type="hidden" name="Update" value="Y"> <input type="hidden" name="from" value="<?php echo htmlspecialcharsbx($from); ?>
} if ($arParams["NUMBER_TO"] < 0) { $arParams["NUMBER_TO"] = 0; } if ($arParams["NUMBER_FROM"] > $arParams["NUMBER_TO"]) { $tmp = $arParams["NUMBER_FROM"]; $arParams["NUMBER_FROM"] = $arParams["NUMBER_TO"]; $arParams["NUMBER_TO"] = $tmp; } return serialize($arParams); } function FromDB($strParams) { return unserialize($strParams); } function DoValidate($arParams, $arQuestion, $arAnswers, $arValues) { global $APPLICATION; if (strlen($arParams["NUMBER_FROM"]) > 0 && count($arValues) < $arParams["NUMBER_FROM"]) { $APPLICATION->ThrowException(GetMessage("FORM_VALIDATOR_VAL_NUM_SELECTED_ERROR_LESS")); return false; } if (strlen($arParams["NUMBER_TO"]) > 0 && count($arValues) > $arParams["NUMBER_TO"]) { $APPLICATION->ThrowException(GetMessage("FORM_VALIDATOR_VAL_NUM_SELECTED_ERROR_MORE")); return false; } return true; } } AddEventHandler("form", "onFormValidatorBuildList", array("CFormValidatorNumSelected", "GetDescription"));
/WebDav ********************************************************************/ /******************************************************************** Search Index ********************************************************************/ if (check_bitrix_sessid() || $_SERVER['REQUEST_METHOD'] == "PUT") { global $bxSocNetSearch; if (!is_object($bxSocNetSearch)) { $bxSocNetSearch = new CSocNetSearch($arResult["VARIABLES"]["user_id"], $arResult["VARIABLES"]["group_id"], array("PATH_TO_GROUP" => $arResult["PATH_TO_GROUP"], "BLOG_GROUP_ID" => $arParams["BLOG_GROUP_ID"], "PATH_TO_GROUP_BLOG" => $arResult["PATH_TO_GROUP_BLOG"], "PATH_TO_GROUP_BLOG_POST" => $arResult["PATH_TO_GROUP_BLOG_POST"], "PATH_TO_GROUP_BLOG_COMMENT" => $arResult["PATH_TO_GROUP_BLOG_POST"] . "?commentId=#comment_id###comment_id#", "PATH_TO_USER_BLOG" => "", "PATH_TO_USER_BLOG_POST" => "", "PATH_TO_USER_BLOG_COMMENT" => "", "FORUM_ID" => $arParams["FORUM_ID"], "PATH_TO_GROUP_FORUM_MESSAGE" => $arResult["PATH_TO_GROUP_FORUM_MESSAGE"], "PATH_TO_USER_FORUM_MESSAGE" => "", "PHOTO_GROUP_IBLOCK_ID" => $arParams["PHOTO_GROUP_IBLOCK_ID"], "PATH_TO_GROUP_PHOTO_ELEMENT" => $arResult["PATH_TO_GROUP_PHOTO_ELEMENT"], "PHOTO_USER_IBLOCK_ID" => false, "PATH_TO_USER_PHOTO_ELEMENT" => "", "PHOTO_FORUM_ID" => $arParams["PHOTO_FORUM_ID"], "CALENDAR_GROUP_IBLOCK_ID" => $arParams["CALENDAR_GROUP_IBLOCK_ID"], "PATH_TO_GROUP_CALENDAR_ELEMENT" => $arResult["PATH_TO_GROUP_CALENDAR"] . "?EVENT_ID=#element_id#", "TASK_IBLOCK_ID" => $arParams["TASK_IBLOCK_ID"], "PATH_TO_GROUP_TASK_ELEMENT" => $arResult["PATH_TO_GROUP_TASKS_TASK"], "PATH_TO_USER_TASK_ELEMENT" => "", "TASK_FORUM_ID" => $arParams["TASK_FORUM_ID"], "FILES_PROPERTY_CODE" => $arParams["NAME_FILE_PROPERTY"], "FILES_FORUM_ID" => $arParams["FILES_FORUM_ID"], "FILES_GROUP_IBLOCK_ID" => $arParams["FILES_GROUP_IBLOCK_ID"], "PATH_TO_GROUP_FILES_ELEMENT" => $arResult["PATH_TO_GROUP_FILES_ELEMENT"], "PATH_TO_GROUP_FILES" => $arResult["PATH_TO_GROUP_FILES"], "FILES_USER_IBLOCK_ID" => false, "PATH_TO_USER_FILES_ELEMENT" => "", "PATH_TO_USER_FILES" => "")); AddEventHandler("search", "BeforeIndex", array($bxSocNetSearch, "BeforeIndex")); AddEventHandler("iblock", "OnAfterIBlockElementUpdate", array($bxSocNetSearch, "IBlockElementUpdate")); AddEventHandler("iblock", "OnAfterIBlockElementAdd", array($bxSocNetSearch, "IBlockElementUpdate")); AddEventHandler("iblock", "OnAfterIBlockElementDelete", array($bxSocNetSearch, "IBlockElementDelete")); AddEventHandler("iblock", "OnAfterIBlockSectionUpdate", array($bxSocNetSearch, "IBlockSectionUpdate")); AddEventHandler("iblock", "OnAfterIBlockSectionAdd", array($bxSocNetSearch, "IBlockSectionUpdate")); AddEventHandler("iblock", "OnAfterIBlockSectionDelete", array($bxSocNetSearch, "IBlockSectionDelete")); } } /******************************************************************** Bizproc ********************************************************************/ if (IsModuleInstalled("bizproc")) { $arDefaultUrlTemplates404["bizproc_task_list"] = $arResult["PATH_TO_BIZPROC_TASK_LIST"] = empty($arParams["PATH_TO_BIZPROC_TASK_LIST"]) ? "/company/personal/user/#user_id#/bizproc/" : $arParams["PATH_TO_BIZPROC_TASK_LIST"]; $arResult["PATH_TO_BIZPROC_TASK"] = empty($arParams["PATH_TO_BIZPROC_TASK"]) ? (empty($arParams['PATH_TO_USER']) ? "/company/personal/user/#user_id#/" : $arParams['PATH_TO_USER']) . "bizproc/#id#/" : $arParams["PATH_TO_BIZPROC_TASK"]; $arDefaultUrlTemplates404["bizproc_task"] = $arResult["PATH_TO_BIZPROC_TASK"] = str_replace("#task_id#", "#id#", $arResult["PATH_TO_BIZPROC_TASK"]); } /******************************************************************** Bizproc ********************************************************************/ /******************************************************************** WebDav