Skip to content

Instantly share code, notes, and snippets.

View hipot's full-sized avatar
💭
someone still has to support legacy

Valerii (Cheban) Ceban hipot

💭
someone still has to support legacy
View GitHub Profile
@hipot
hipot / gist:96349b047b820036fe2b623bec92f28c
Created August 22, 2026 13:25
tmp open site when it's closed in config
// tmp open site when it's closed in config
Bitrix\Main\EventManager::getInstance()->addEventHandler("main", "OnBeforeProlog", static function () {
if (\Bitrix\Main\Application::getInstance()?->getContext()?->getRequest()->get('site_closed') == 'N') {
\Bitrix\Main\Application::getInstance()->getKernelSession()['SESS_OPERATIONS']['edit_other_settings'] = 'Y';
}
});
@hipot
hipot / gist:3c734c39e8236890083b3a3e8cfa7a01
Created August 22, 2026 13:35
Magic string constants: icons and types
// Выводит список доступных иконок для меню
$arr = [
'fav_menu_icon',
'iblock_menu_icon_iblocks',
'fileman_menu_icon',
'clouds_menu_icon',
'iblock_menu_icon_types',
'smile_menu_icon',
'rating_menu_icon',
'support_menu_icon',
@hipot
hipot / gist:7938e44b2a34b588bc97420e4851a9d7
Last active August 22, 2026 13:53
log 404 in content part
// log 404 in content part
$lastStatus = \CHTTP::GetLastStatus();
if ((constant('ERROR_404') == 'Y' || strpos($lastStatus, '404') !== false)
&& $APPLICATION->GetCurPage() != '/404.php'
) {
/*
CREATE TABLE `hi_seo_error404log` (
`ID` int(11) unsigned NOT NULL AUTO_INCREMENT,
`UF_DATETIME` datetime DEFAULT NULL,
`UF_URL` text,
@hipot
hipot / gist:bd68b3062f5fbe467316b747410a5f43
Created August 22, 2026 13:42
dbconn.php: some addons cache config and more
// some addons cache config
define('CACHED_b_iblock_type', 3600 * 24);
define("CACHED_b_iblock", 3600 * 24);
define("CACHED_b_iblock_bucket_size", 40);
define('CACHED_b_iblock_property_enum', 3600 * 24);
define('CACHED_b_iblock_property_enum_bucket_size', 100);
define('CACHED_b_user_access_check', 3600);
define('CACHED_b_sec_redirect_url', 3600 * 24 * 30);
define('CACHED_b_user_counter', 3600 * 3);
@hipot
hipot / gist:3d2652814bdf501ef746e84c1f7a5024
Last active August 22, 2026 13:57
some js connection and help for that
CJSCore::Init(["jquery"]);
$arJqueryExt = CJSCore::getExtInfo("jquery");
CJSCore::markExtensionLoaded('jquery');
CJSCore::markExtensionLoaded('jquery2');
CJSCore::Init(['jquery3']);
/*
* Для popup надо вызывать
*/
@hipot
hipot / gist:a67d4ae8e1867a3b0226af9f7a33594f
Created August 22, 2026 13:52
restore agents (cron) and use default-script: /bitrix/modules/main/tools/cron_events.php
// restore agents (cron)
COption::SetOptionString("main", "agents_use_crontab", "Y");
echo COption::GetOptionString("main", "agents_use_crontab", "N");
COption::SetOptionString("main", "check_agents", "Y");
echo COption::GetOptionString("main", "check_agents", "N");
COption::SetOptionString("main", "mail_event_bulk", "20");
echo COption::GetOptionString("main", "mail_event_bulk", "5");
@hipot
hipot / gist:3328946d116010eadc01b5429fe072b1
Created August 22, 2026 13:55
template browser title and h1 use cases
<?
$APPLICATION->SetTitle("title h1");
$APPLICATION->SetPageProperty('title', "title browser"); // optional to change title browser or will be used value from SetTitle()
// <title><?$APPLICATION->ShowTitle()?></title>
// <h1 id="pagetitle"><?$APPLICATION->ShowTitle(false)?></h1>
?>
@hipot
hipot / gist:b91aa8274e15eadfdfecc9f33cc6021e
Created August 22, 2026 14:05
Multisite mails via multisite bitrix config
/**
* Multisite mails
* /home/bitrix/.msmtprc
*
* # smtp account configuration for domain1.com
* account domain2.com
* ... etc
*/
function custom_mail($to, $subject, $message, $additional_headers = '', $additional_parameters = '')
{