13use Bitrix\Main\Page\Asset;
73 private $__componentStack = [];
77 $this->oAsset = Asset::getInstance();
82 if (
null === $get_index_page)
84 if (defined(
'BX_DISABLE_INDEX_PAGE'))
86 $get_index_page = !BX_DISABLE_INDEX_PAGE;
90 $get_index_page =
true;
94 if ($this->sDocPath2 ===
null)
101 if (!$get_index_page)
103 if ((
$i = mb_strpos(
$str,
'/index.php')) !==
false)
115 $this->sDirPath =
GetDirPath($this->sDocPath2);
118 public function GetCurUri($addParam =
"", $get_index_page =
null)
124 $url =
$page .
"?" . $param . ($addParam !=
"" ?
"&" . $addParam :
"");
128 $url =
$page . ($addParam !=
"" ?
"?" . $addParam :
"");
133 public function GetCurPageParam($strParam =
"", $arParamKill = [], $get_index_page =
null)
135 $sUrlPath = $this->
GetCurPage($get_index_page);
138 if ($strNavQueryString <>
"" && $strParam <>
"")
140 $strNavQueryString =
"&" . $strNavQueryString;
142 if ($strNavQueryString ==
"" && $strParam ==
"")
148 return $sUrlPath .
"?" . $strParam . $strNavQueryString;
154 return $_SERVER[
"QUERY_STRING"] ??
'';
159 if ($this->sDirPath ===
null)
168 if ($strDir ===
false)
174 $fn =
$io->CombinePath(
"/", $strDir, $strFileName);
177 while (!
$io->FileExists(
$io->RelativeToAbsolutePath($fn)))
184 $strDir = mb_substr($strDir, 0,
$p);
185 $fn =
$io->CombinePath(
"/", $strDir, $strFileName);
198 static $exclude = [
"this" => 1,
"exclude" => 1,
"key" => 1,
"GLOBALS" => 1,
"strTitle" => 1,
"filepath" => 1];
201 if (!isset($exclude[
$key]))
208 $this->SetTitle($strTitle);
210 include(
$_SERVER[
"DOCUMENT_ROOT"] .
BX_ROOT .
"/modules/main/include/prolog_admin_after.php");
212 include(
$_SERVER[
"DOCUMENT_ROOT"] .
BX_ROOT .
"/modules/main/include/epilog_admin.php");
221 public function AuthForm($mess, $show_prolog =
true, $show_epilog =
true, $not_show_links =
"N", $do_die =
true)
223 static $exclude = [
"this" => 1,
"exclude" => 1,
"key" => 1,
"GLOBALS" => 1,
"mess" => 1,
"show_prolog" => 1,
"show_epilog" => 1,
"not_show_links" => 1,
"do_die" => 1];
226 if (!isset($exclude[
$key]))
241 if (isset($this->arAuthResult) && $this->arAuthResult !==
true && (is_array($this->arAuthResult) || $this->arAuthResult <>
''))
251 global
$APPLICATION, $forgot_password, $change_password, $register, $confirm_registration;
265 $change_password =
"yes";
269 if ($forgot_password ==
"yes")
273 $comp_name =
"system.auth.forgotpasswd";
274 $inc_file =
"forgot_password";
276 elseif ($change_password ==
"yes")
280 $comp_name =
"system.auth.changepasswd";
281 $inc_file =
"change_password";
283 elseif ($register ==
"yes" && $isAdmin ==
"" && COption::GetOptionString(
"main",
"new_user_registration",
"N") ==
"Y")
287 $comp_name =
"system.auth.registration";
289 elseif (($confirm_registration ===
"yes") && ($isAdmin ===
"") && (COption::GetOptionString(
"main",
"new_user_registration_email_confirmation",
"N") ===
"Y"))
293 $comp_name =
"system.auth.confirmation";
296 CModule::IncludeModule(
"security")
303 $comp_name =
"system.auth.otp";
308 header(
'X-Bitrix-Ajax-Status: Authorize');
311 $comp_name =
"system.auth.authorize";
312 $inc_file =
"authorize";
319 define(
"BX_AUTH_FORM",
true);
320 include(
$_SERVER[
"DOCUMENT_ROOT"] .
BX_ROOT .
"/modules/main/include/prolog" . $isAdmin .
"_after.php");
327 "bitrix:" . $comp_name,
328 COption::GetOptionString(
"main",
"auth_components_template",
""),
331 "NOT_SHOW_LINKS" => $not_show_links,
337 include(
$_SERVER[
"DOCUMENT_ROOT"] .
BX_ROOT .
"/modules/main/interface/auth/wrapper.php");
341 $autoCompositeArea?->end();
345 include(
$_SERVER[
"DOCUMENT_ROOT"] .
BX_ROOT .
"/modules/main/include/epilog" . $isAdmin .
".php");
386 $USER_ATTEMPTS =
false;
391 if (!$session->has(
"BX_LOGIN_NEED_CAPTCHA_LOGIN") || $session[
"BX_LOGIN_NEED_CAPTCHA_LOGIN"][
"LOGIN"] !==
$login)
393 $POLICY_ATTEMPTS = 0;
396 $rsUser = CUser::GetList(
'LOGIN',
'DESC', [
397 "LOGIN_EQUAL_EXACT" =>
$login,
398 "EXTERNAL_AUTH_ID" =>
"",
400 [
'FIELDS' => [
'ID',
'LOGIN',
'LOGIN_ATTEMPTS']]
402 $arUser = $rsUser->Fetch();
405 $policy = CUser::getPolicy($arUser[
"ID"]);
406 $POLICY_ATTEMPTS = (int)$policy->getLoginAttempts();
407 $USER_ATTEMPTS = (int)$arUser[
"LOGIN_ATTEMPTS"];
410 $session[
"BX_LOGIN_NEED_CAPTCHA_LOGIN"] = [
412 "POLICY_ATTEMPTS" => $POLICY_ATTEMPTS,
418 if (
$login <> '' && $session[
"BX_LOGIN_NEED_CAPTCHA_LOGIN"][
"POLICY_ATTEMPTS"] > 0)
421 if ($USER_ATTEMPTS ===
false)
423 $rsUser = CUser::GetList(
'LOGIN',
'DESC', [
424 "LOGIN_EQUAL_EXACT" =>
$login,
425 "EXTERNAL_AUTH_ID" =>
"",
427 [
'FIELDS' => [
'ID',
'LOGIN',
'LOGIN_ATTEMPTS']]
429 $arUser = $rsUser->Fetch();
432 $USER_ATTEMPTS = intval($arUser[
"LOGIN_ATTEMPTS"]);
440 if ($USER_ATTEMPTS >= $session[
"BX_LOGIN_NEED_CAPTCHA_LOGIN"][
"POLICY_ATTEMPTS"])
452 return $menu->GetMenuHtml();
458 return $menu->GetMenuHtmlEx();
464 if ($sInitDir ===
false)
468 if (!$menu->Init($sInitDir, $bMenuExt,
$template))
470 $menu->MenuDir = $sInitDir;
481 return Main\Context::getCurrent()->getRequest()->isHttps();
484 public function GetTitle($property_name =
false, $strip_tags =
false)
486 if ($property_name !==
false && $this->
GetProperty($property_name) <>
'')
494 if ($strip_tags && is_string(
$res))
496 return strip_tags(
$res);
503 $this->sDocTitle =
$title;
511 $arTrace = array_reverse(Main\Diag\Helper::getBackTrace(0, DEBUG_BACKTRACE_PROVIDE_OBJECT | DEBUG_BACKTRACE_IGNORE_ARGS));
513 foreach ($arTrace as $arTraceRes)
515 if (isset($arTraceRes[
'class']) && isset($arTraceRes[
'function']))
517 if (strtoupper($arTraceRes[
'class']) ==
'CBITRIXCOMPONENT' && strtoupper($arTraceRes[
'function']) ==
'INCLUDECOMPONENT' && is_object($arTraceRes[
'object']))
520 $comp = $arTraceRes[
'object'];
521 $this->sDocTitleChanger = [
522 'COMPONENT_NAME' => $comp->GetName(),
532 public function ShowTitle($property_name =
"title", $strip_tags =
true)
539 $this->arPageProperties[mb_strtoupper($PROPERTY_ID)] = $PROPERTY_VALUE;
543 $this->arPagePropertiesChanger[mb_strtoupper($PROPERTY_ID)] =
$arOptions;
549 if (isset($this->arPageProperties[mb_strtoupper($PROPERTY_ID)]))
551 return $this->arPageProperties[mb_strtoupper($PROPERTY_ID)];
553 return $default_value;
558 $this->
AddBufferContent([&$this,
"GetProperty"], $PROPERTY_ID, $default_value);
564 if ($propVal !==
false)
570 if ($propVal !==
false)
575 return $default_value;
607 if (!isset($this->arDirProperties[
$site][
$path]))
612 $this->arDirProperties[
$site][
$path][mb_strtoupper($PROPERTY_ID)] = $PROPERTY_VALUE;
630 if (isset($this->arDirProperties[
$site][
$path]))
643 if (
$io->FileExists($section_file_name))
646 include(
$io->GetPhysicalName($section_file_name));
651 $prid = mb_strtoupper($prid);
652 if (!isset($this->arDirProperties[
$site][
$path][$prid]))
654 $this->arDirProperties[
$site][
$path][$prid] = $prval;
673 $dir = mb_substr(
$dir, 0, $pos + 1);
692 if (!isset($this->arDirProperties[
$site][
$path]))
697 $prop_id = mb_strtoupper($PROPERTY_ID);
698 if (isset($this->arDirProperties[
$site][
$path][$prop_id]))
700 return $this->arDirProperties[
$site][
$path][$prop_id];
703 return $default_value;
719 if (!isset($this->arDirProperties[
$site][
$path]))
724 if (isset($this->arDirProperties[
$site][
$path]) && is_array($this->arDirProperties[
$site][
$path]))
732 public function GetMeta($id, $meta_name =
false, $bXhtmlStyle =
true)
746 public function GetLink($id, $rel =
null, $bXhtmlStyle =
true)
755 return '<link rel="' . $rel .
'" href="' . $href .
'"' . ($bXhtmlStyle ?
' /' :
'') .
'>' .
"\n";
762 if (!CModule::IncludeModule(
"advertising"))
769 $APPLICATION->AddBufferContent([
"CAdvBanner",
"Show"],
$type, $html_before, $html_after);
772 public function ShowMeta($id, $meta_name =
false, $bXhtmlStyle =
true)
774 $this->
AddBufferContent([&$this,
"GetMeta"], $id, $meta_name, $bXhtmlStyle);
777 public function ShowLink($id, $rel =
null, $bXhtmlStyle =
true)
784 $this->oAsset->addCss($Path2css, $additional);
788 $this->arHeadAdditionalCSS[] = $this->oAsset->getAssetPath($Path2css);
792 $this->sPath2css[] = $this->oAsset->getAssetPath($Path2css);
802 return $this->sPath2css[
$n - 1];
809 return array_unique($this->sPath2css);
813 public function GetCSS($cMaxStylesCnt =
true, $bXhtmlStyle =
true, $assetTargetType =
Main\
Page\AssetShowTargetType::ALL)
815 if ($cMaxStylesCnt ===
true)
819 $this->oAsset->setMaxCss($cMaxStylesCnt);
820 $this->oAsset->setXhtml($bXhtmlStyle);
821 $res = $this->oAsset->getCss($assetTargetType);
825 public function ShowCSS($cMaxStylesCnt =
true, $bXhtmlStyle =
true)
841 if (
$location === AssetLocation::AFTER_JS_KERNEL)
843 $res = $this->oAsset->getJs(1);
850 return (
$res ==
'' ?
'' :
$res .
"\n");
855 if (!$this->oAsset->getShowHeadString())
857 $this->oAsset->setShowHeadString();
865 $this->oAsset->addJs($src, $additional);
871 $this->arHeadAdditionalScripts[] = Asset::getAssetPath($src);
875 $this->arHeadScripts[] = Asset::getAssetPath($src);
883 $this->oAsset->addString(
$content,
true,
'AFTER_CSS');
889 $this->oAsset->addString(
$content,
false, AssetLocation::AFTER_JS);
894 return (strncasecmp($src,
'http://', 7) == 0 || strncasecmp($src,
'https://', 8) == 0 || strncmp($src,
'//', 2) == 0);
900 $this->oAsset->addCssKernelInfo($module, $arCSS);
906 $this->oAsset->addJsKernelInfo($module, $arJS);
912 $this->oAsset->groupJs($from, $to);
918 $this->oAsset->moveJs($module);
924 $this->oAsset->groupCss($from, $to);
930 $cssType = (($cssType ==
'page') ?
'PAGE' :
'TEMPLATE');
931 $this->oAsset->setUnique($cssType, $id);
944 return $this->oAsset->getJs(
$type);
949 $this->oAsset->setShowHeadScript();
955 $this->oAsset->setShowBodyScript();
961 echo
'<meta http-equiv="Content-Type" content="text/html; charset=' .
LANG_CHARSET .
'"' . ($bXhtmlStyle ?
' /' :
'') .
'>' .
"\n";
962 $this->
ShowMeta(
"robots",
false, $bXhtmlStyle);
963 $this->
ShowMeta(
"keywords",
false, $bXhtmlStyle);
964 $this->
ShowMeta(
"description",
false, $bXhtmlStyle);
965 $this->
ShowLink(
"canonical",
null, $bXhtmlStyle);
966 $this->
ShowCSS(
true, $bXhtmlStyle);
971 public function ShowAjaxHead($bXhtmlStyle =
true, $showCSS =
true, $showStrings =
true, $showScripts =
true)
974 $this->sPath2css = [];
975 $this->arHeadAdditionalCSS = [];
976 $this->arHeadAdditionalStrings = [];
977 $this->arHeadAdditionalScripts = [];
978 $this->arHeadScripts = [];
979 $this->arHeadStrings = [];
980 $this->bInAjax =
true;
982 $this->oAsset = $this->oAsset->setAjax();
984 if ($showCSS ===
true)
986 $this->
ShowCSS(
true, $bXhtmlStyle);
989 if ($showStrings ===
true)
994 if ($showScripts ===
true)
1018 static $panel_dynamic_mode =
null;
1019 if (!isset($panel_dynamic_mode))
1021 $aUserOpt = CUserOptions::GetOption(
"global",
"settings", []);
1022 $panel_dynamic_mode = (isset(
$aUserOpt[
"panel_dynamic_mode"]) &&
$aUserOpt[
"panel_dynamic_mode"] ==
"Y");
1024 return $panel_dynamic_mode;
1049 $this->
editArea->SetEditArea($areaId, $arIcons);
1058 return $this->
editArea->IncludeStringBefore();
1073 if (!str_starts_with($rel_path,
"/"))
1075 if (defined(
"SITE_TEMPLATE_ID"))
1077 $path =
getLocalPath(
"templates/" . SITE_TEMPLATE_ID .
"/" . $rel_path, BX_PERSONAL_ROOT);
1078 if (
$path !==
false)
1085 if (
$path !==
false)
1091 $module_id = mb_substr($rel_path, 0, mb_strpos($rel_path,
"/"));
1094 $path =
"/bitrix/modules/" .
$module_id .
"/install/templates/" . $rel_path;
1122 if (is_array($this->arComponentMatch))
1124 $skipComponent =
true;
1125 foreach ($this->arComponentMatch as $cValue)
1129 $skipComponent =
false;
1139 $componentRelativePath = CComponentEngine::MakeComponentPath(
$componentName);
1140 if ($componentRelativePath ==
'')
1148 $USER->CanDoOperation(
'edit_php')
1151 && !defined(
"PUBLIC_AJAX_MODE");
1158 if (is_object($parentComponent))
1160 if (!($parentComponent instanceof cbitrixcomponent))
1162 $parentComponent =
null;
1166 $bDrawIcons = ((!isset($arFunctionParams[
"HIDE_ICONS"]) || $arFunctionParams[
"HIDE_ICONS"] <>
"Y") &&
$APPLICATION->GetShowIncludeAreas());
1174 $bComponentEnabled = (!isset($arFunctionParams[
"ACTIVE_COMPONENT"]) || $arFunctionParams[
"ACTIVE_COMPONENT"] <>
"N");
1180 if ($bComponentEnabled)
1182 if ((
$arParams[
'AJAX_MODE'] ??
'') ==
'Y')
1187 $this->__componentStack[] = $component;
1190 array_pop($this->__componentStack);
1196 $arIcons =
$panel->GetIcons();
1201 if ($bComponentEnabled && $obAjax)
1209 echo $debug->Output(
$componentName,
"/bitrix/components" . $componentRelativePath .
"/component.php", (
$arParams[
"CACHE_TYPE"] ??
'') . (
$arParams[
"MENU_CACHE_TYPE"] ??
''));
1213 $debug->Stop(
$componentName,
"/bitrix/components" . $componentRelativePath .
"/component.php", (
$arParams[
"CACHE_TYPE"] ??
'') . (
$arParams[
"MENU_CACHE_TYPE"] ??
''));
1227 return end($this->__componentStack);
1236 return $this->__componentStack;
1246 if ($this->__view[$view] ??
null)
1248 unset($this->__view[$view]);
1254 if (!isset($this->__view[$view]) || !is_array($this->__view[$view]))
1256 $this->__view[$view] = [[
$content, $pos]];
1260 $this->__view[$view][] = [
$content, $pos];
1271 if (!isset($this->__view[$view]) || !is_array($this->__view[$view]))
1277 $this->__view[$view],
1283 return (
$a[1] < $b[1] ? -1 : 1);
1288 foreach ($this->__view[$view] as $item)
1293 return implode(
$res);
1301 if (
$site ===
false)
1337 $sType =
"TEMPLATE";
1338 $bComponent =
false;
1339 if (!str_starts_with($rel_path,
"/"))
1342 $path =
getLocalPath(
"templates/" . SITE_TEMPLATE_ID .
"/" . $rel_path, BX_PERSONAL_ROOT);
1343 if (
$path ===
false)
1347 if (
$path ===
false)
1349 $path = BX_PERSONAL_ROOT .
"/templates/" . SITE_TEMPLATE_ID .
"/" . $rel_path;
1350 $module_id = mb_substr($rel_path, 0, mb_strpos($rel_path,
"/"));
1353 $path =
"/bitrix/modules/" .
$module_id .
"/install/templates/" . $rel_path;
1357 $sType =
"TEMPLATE";
1358 $path = BX_PERSONAL_ROOT .
"/templates/" . SITE_TEMPLATE_ID .
"/" . $rel_path;
1369 if (isset($arFunctionParams[
"WORKFLOW"]) && $arFunctionParams[
"WORKFLOW"] && !
IsModuleInstalled(
"workflow"))
1371 $arFunctionParams[
"WORKFLOW"] =
false;
1373 elseif ($sType !=
"TEMPLATE" && isset($arFunctionParams[
"WORKFLOW"]) && $arFunctionParams[
"WORKFLOW"])
1375 $arFunctionParams[
"WORKFLOW"] =
false;
1379 (!isset($arFunctionParams[
"SHOW_BORDER"]) || $arFunctionParams[
"SHOW_BORDER"] !==
false)
1383 || ($arFunctionParams[
"WORKFLOW"] &&
$USER->CanDoFileOperation(
'fm_edit_in_workflow', [
SITE_ID,
$path]))
1393 $path_url =
"path=" .
$path;
1394 $encSiteTemplateId = urlencode(SITE_TEMPLATE_ID);
1398 if (!in_array($arFunctionParams[
'MODE'], [
'html',
'text',
'php']))
1400 $arFunctionParams[
'MODE'] = $bComponent ?
'php' :
'html';
1403 if ($sType !=
'TEMPLATE')
1405 switch ($arFunctionParams[
'MODE'])
1408 $editor =
"/bitrix/admin/fileman_html_edit.php?site=" .
SITE_ID .
"&";
1411 $editor =
"/bitrix/admin/fileman_file_edit.php?site=" .
SITE_ID .
"&";
1414 $editor =
"/bitrix/admin/fileman_file_edit.php?full_src=Y&site=" .
SITE_ID .
"&";
1417 $editor .=
"templateID=" . $encSiteTemplateId .
"&";
1421 switch ($arFunctionParams[
'MODE'])
1424 $editor =
'/bitrix/admin/public_file_edit.php?site=' .
SITE_ID .
'&bxpublic=Y&from=includefile&templateID=' . $encSiteTemplateId .
'&';
1428 $editor =
'/bitrix/admin/public_file_edit.php?site=' .
SITE_ID .
'&bxpublic=Y&from=includefile&noeditor=Y&';
1433 $editor =
'/bitrix/admin/public_file_edit_src.php?site=' .
SITE_ID .
'&templateID=' . $encSiteTemplateId .
'&';
1439 if ($arFunctionParams[
"TEMPLATE"])
1441 $arFunctionParams[
"TEMPLATE"] =
"&template=" . urlencode($arFunctionParams[
"TEMPLATE"]);
1444 if ($arFunctionParams[
"BACK_URL"])
1446 $arFunctionParams[
"BACK_URL"] =
"&back_url=" . urlencode($arFunctionParams[
"BACK_URL"]);
1450 $arFunctionParams[
"BACK_URL"] =
"&back_url=" . urlencode(
$_SERVER[
"REQUEST_URI"]);
1453 if ($arFunctionParams[
"LANG"])
1455 $arFunctionParams[
"LANG"] =
"&lang=" . urlencode($arFunctionParams[
"LANG"]);
1459 $arFunctionParams[
"LANG"] =
"&lang=" . LANGUAGE_ID;
1462 $arPanelParams = [];
1464 $bDefaultExists =
false;
1465 if (
$USER->CanDoOperation(
'edit_php') && $bComponent)
1467 $bDefaultExists =
true;
1468 $arPanelParams[
"TOOLTIP"] = [
1469 'TITLE' =>
GetMessage(
"main_incl_component1"),
1470 'TEXT' => $rel_path,
1475 $sSrcFile = $aTrace[0][
"file"];
1476 $iSrcLine = intval($aTrace[0][
"line"]);
1479 'URL' =>
"/bitrix/admin/component_props.php?" .
1480 "path=" . urlencode(CUtil::addslashes($rel_path)) .
1481 "&template_id=" . urlencode(CUtil::addslashes(SITE_TEMPLATE_ID)) .
1482 "&lang=" . LANGUAGE_ID .
1483 "&src_path=" . urlencode(CUtil::addslashes($sSrcFile)) .
1484 "&src_line=" . $iSrcLine,
1486 'ICON' =>
"parameters",
1487 'TITLE' =>
GetMessage(
"main_incl_file_comp_param"),
1492 if ($sType ==
"MODULE")
1495 'URL' =>
'javascript:if(confirm(\'' .
GetMessage(
"MAIN_INC_BLOCK_MODULE") .
'\'))window.location=\
'' . $editor .
'&path=' . urlencode(BX_PERSONAL_ROOT .
'/templates/' . SITE_TEMPLATE_ID .
'/' . $rel_path) . $arFunctionParams[
"BACK_URL"] . $arFunctionParams[
"LANG"] .
'&template=' .
$path .
'\';
',
1497 'TITLE
' => str_replace("#MODE#", $arFunctionParams["MODE"], str_replace("#BLOCK_TYPE#", (!is_set($arFunctionParams, "NAME") ? GetMessage("MAIN__INC_BLOCK") : $arFunctionParams["NAME"]), GetMessage("main_incl_file_edit_copy"))),
1500 elseif ($sType == "DEFAULT")
1503 'URL
' => 'javascript:
if(confirm(\
'' .
GetMessage(
"MAIN_INC_BLOCK_COMMON") .
'\'))window.location=\
'' . $editor . $path_url . $arFunctionParams[
"BACK_URL"] . $arFunctionParams[
"LANG"] . $arFunctionParams[
"TEMPLATE"] .
'\';
',
1504 'ICON
' => 'edit-common
',
1505 'TITLE
' => str_replace("#MODE#", $arFunctionParams["MODE"], str_replace("#BLOCK_TYPE#", (!is_set($arFunctionParams, "NAME") ? GetMessage("MAIN__INC_BLOCK") : $arFunctionParams["NAME"]), GetMessage("MAIN_INC_BLOCK_EDIT"))),
1509 'URL
' => $editor . '&
path=
' . urlencode(BX_PERSONAL_ROOT . '/templates/
' . SITE_TEMPLATE_ID . '/
' . $rel_path) . $arFunctionParams["BACK_URL"] . $arFunctionParams["LANG"] . '&
template=
' . $path,
1511 'TITLE
' => str_replace("#MODE#", $arFunctionParams["MODE"], str_replace("#BLOCK_TYPE#", (!is_set($arFunctionParams, "NAME") ? GetMessage("MAIN__INC_BLOCK") : $arFunctionParams["NAME"]), GetMessage("MAIN_INC_BLOCK_COMMON_COPY"))),
1516 $arPanelParams["TOOLTIP"] = [
1517 'TITLE
' => GetMessage('main_incl_file
'),
1522 'URL
' => 'javascript:
' . $APPLICATION->GetPopupLink(
1524 'URL
' => $editor . $path_url . $arFunctionParams["BACK_URL"] . $arFunctionParams["LANG"] . $arFunctionParams["TEMPLATE"],
1528 'resize
' => $resize,
1532 'ICON
' => 'bx-context-toolbar-edit-icon
',
1533 'TITLE
' => str_replace("#MODE#", $arFunctionParams["MODE"], str_replace("#BLOCK_TYPE#", (!is_set($arFunctionParams, "NAME") ? GetMessage("MAIN__INC_BLOCK") : $arFunctionParams["NAME"]), GetMessage("MAIN_INC_ED"))),
1534 'DEFAULT
' => !$bDefaultExists,
1537 if ($arFunctionParams["WORKFLOW"])
1540 'URL
' => '/bitrix/admin/workflow_edit.php?
' . $arFunctionParams["LANG"] . '&fname=
' . urlencode($path) . $arFunctionParams["TEMPLATE"] . $arFunctionParams["BACK_URL"],
1541 'ICON
' => 'bx-context-toolbar-edit-icon
',
1542 'TITLE
' => str_replace("#BLOCK_TYPE#", (!is_set($arFunctionParams, "NAME") ? GetMessage("MAIN__INC_BLOCK") : $arFunctionParams["NAME"]), GetMessage("MAIN_INC_ED_WF")),
1547 echo $this->IncludeStringBefore();
1551 if (is_file($_SERVER["DOCUMENT_ROOT"] . $path))
1553 if (is_array($arParams))
1555 extract($arParams, EXTR_SKIP);
1558 $res = include($_SERVER["DOCUMENT_ROOT"] . $path);
1561 if (Main\Application::getInstance()->getKernelSession()["SESS_SHOW_INCLUDE_TIME_EXEC"] == "Y" && ($USER->CanDoOperation('edit_php
') || Main\Application::getInstance()->getKernelSession()["SHOW_SQL_STAT"] == "Y"))
1563 echo $debug->Output($rel_path, $path);
1565 elseif (is_object($debug))
1567 $debug->Stop($rel_path, $path);
1575 $comp_id .= '|
' . $sSrcFile;
1579 $comp_id .= '|
' . $iSrcLine;
1582 $arPanelParams['COMPONENT_ID
'] = md5($comp_id);
1583 echo $this->IncludeStringAfter($arIcons, $arPanelParams);
1589 public function AddChainItem($title, $link = "", $bUnQuote = true)
1593 $title = str_replace(["&", """, "'", "<", ">"], ["&", "\"", "'", "<
", ">
"], $title);
1595 $this->arAdditionalChain[] = ["TITLE
" => $title, "LINK
" => htmlspecialcharsbx($link)];
1598 public function GetNavChain($path = false, $iNumFrom = 0, $sNavChainPath = false, $bIncludeOnce = false, $bShowIcons = true)
1600 if ($this->GetProperty("NOT_SHOW_NAV_CHAIN
") == "Y
")
1605 CMain::InitPathVars($site, $path);
1606 $DOC_ROOT = CSite::GetSiteDocRoot($site);
1608 if ($path === false)
1610 $path = $this->GetCurDir();
1614 $strChainTemplate = $DOC_ROOT . SITE_TEMPLATE_PATH . "/chain_template.php
";
1615 if (!file_exists($strChainTemplate))
1617 if (($template = getLocalPath("templates/.default/chain_template.php
", BX_PERSONAL_ROOT)) !== false)
1619 $strChainTemplate = $DOC_ROOT . $template;
1623 $io = CBXVirtualIo::GetInstance();
1625 while (true)//until the root
1627 $path = rtrim($path, "/
");
1629 $chain_file_name = $DOC_ROOT . $path . "/.section.php
";
1630 if ($io->FileExists($chain_file_name))
1632 $sChainTemplate = "";
1634 include($io->GetPhysicalName($chain_file_name));
1635 if ($sSectionName <> '')
1637 $arChain[] = ["TITLE
" => $sSectionName, "LINK
" => $path . "/
"];
1639 if ($sChainTemplate <> '')
1641 $strChainTemplate = $sChainTemplate;
1645 if ($path . '/' == SITE_DIR)
1656 $pos = bxstrrpos($path, "/
");
1663 $path = mb_substr($path, 0, $pos + 1);
1666 if ($sNavChainPath !== false)
1668 $strChainTemplate = $DOC_ROOT . $sNavChainPath;
1671 $arChain = array_reverse($arChain);
1672 $arChain = array_merge($arChain, $this->arAdditionalChain);
1675 $arChain = array_slice($arChain, $iNumFrom);
1678 return $this->_mkchain($arChain, $strChainTemplate, $bIncludeOnce, $bShowIcons);
1681 public function _mkchain($arChain, $strChainTemplate, $bIncludeOnce = false, $bShowIcons = true)
1683 $strChain = $sChainProlog = $sChainEpilog = "";
1684 if (file_exists($strChainTemplate))
1686 $ITEM_COUNT = count($arChain);
1687 $arCHAIN = $arChain;
1688 $arCHAIN_LINK = &$arChain;
1689 $arResult = &$arChain; // for component 2.0
1692 $strChain = include($strChainTemplate);
1696 foreach ($arChain as $i => $arChainItem)
1699 $TITLE = $arChainItem["TITLE
"];
1700 $LINK = $arChainItem["LINK
"];
1702 include($strChainTemplate);
1703 $strChain .= $sChainBody;
1706 $strChain = $sChainProlog . $strChain;
1709 if (!empty($arChain))
1711 $strChain .= $sChainEpilog;
1718 if ($this->GetShowIncludeAreas() && $USER->CanDoOperation('edit_php') && $bShowIcons)
1720 $site = CSite::GetSiteByFullPath($strChainTemplate);
1721 $DOC_ROOT = CSite::GetSiteDocRoot($site);
1723 if (mb_strpos($strChainTemplate, $DOC_ROOT) === 0)
1725 $path = mb_substr($strChainTemplate, mb_strlen($DOC_ROOT));
1727 $templ_perm = $this->GetFileAccessPermission($path);
1728 if ((!defined("
ADMIN_SECTION") || ADMIN_SECTION !== true) && $templ_perm >= "W")
1732 "URL
" => "/bitrix/admin/fileman_file_edit.php?
lang=
" . LANGUAGE_ID . "&site=
" . $site . "&back_url=
" . urlencode($_SERVER["REQUEST_URI
"]) . "&full_src=Y&
path=
" . urlencode($path),
1733 "ICON
" => "nav-
template",
1734 "TITLE
" => GetMessage("MAIN_INC_ED_NAV
"),
1737 $strChain = $this->IncludeString($strChain, $arIcons);
1744 public function ShowNavChain($path = false, $iNumFrom = 0, $sNavChainPath = false)
1746 $this->AddBufferContent([&$this, "GetNavChain"], $path, $iNumFrom, $sNavChainPath);
1749 public function ShowNavChainEx($path = false, $iNumFrom = 0, $sNavChainPath = false)
1751 $this->AddBufferContent([&$this, "GetNavChain"], $path, $iNumFrom, $sNavChainPath, true);
1754 /*****************************************************/
1756 public function SetFileAccessPermission($path, $arPermissions, $bOverWrite = true)
1758 global $CACHE_MANAGER;
1760 CMain::InitPathVars($site, $path);
1761 $DOC_ROOT = CSite::GetSiteDocRoot($site);
1763 $path = rtrim($path, "/
");
1769 if (($p = bxstrrpos($path, "/
")) !== false)
1771 $path_file = mb_substr($path, $p + 1);
1772 $path_dir = mb_substr($path, 0, $p);
1779 if ($path_file == "" && $path_dir == "")
1786 $io = CBXVirtualIo::GetInstance();
1787 if ($io->FileExists($DOC_ROOT . $path_dir . "/.access.php
"))
1789 include $io->GetPhysicalName($DOC_ROOT . $path_dir . "/.access.php
");
1792 $FILE_PERM = $PERM[$path_file];
1793 if (!is_array($FILE_PERM))
1798 if (!$bOverWrite && !empty($FILE_PERM))
1806 foreach ($arPermissions as $group => $perm)
1816 $curr_perm = $FILE_PERM[$group];
1817 if (!isset($curr_perm) && preg_match(
'/^G[0-9]+$/', $group))
1819 $curr_perm = $FILE_PERM[mb_substr($group, 1)];
1822 if ($curr_perm !=
$perm)
1829 foreach ($PERM as $file => $arPerm)
1831 if (strval($file) !== $path_file)
1833 foreach ($arPerm as $group =>
$perm)
1842 foreach ($FILE_PERM as $group =>
$perm)
1845 $new_perm = $arPermissions[$group];
1846 if (!isset($new_perm) && preg_match(
'/^G[0-9]+$/', $group))
1848 $new_perm = $arPermissions[substr($group, 1)];
1851 if ($new_perm !=
$perm)
1864 unset($this->FILE_PERMISSION_CACHE[
$site .
"|" . $path_dir .
"/.access.php"]);
1868 foreach (
GetModuleEvents(
"main",
"OnChangePermissions",
true) as $arEvent)
1873 if (COption::GetOptionString(
"main",
"event_log_file_access",
"N") ===
"Y")
1896 $path_file = mb_substr(
$path,
$p + 1);
1897 $path_dir = mb_substr(
$path, 0,
$p);
1906 if (!
$io->FileExists(
$DOC_ROOT . $path_dir .
"/.access.php"))
1911 include(
$io->GetPhysicalName(
$DOC_ROOT . $path_dir .
"/.access.php"));
1914 foreach ($PERM as $file => $arPerm)
1916 if ($file != $path_file ||
$arGroups !==
false)
1918 foreach ($arPerm as $group =>
$perm)
1928 elseif (preg_match(
'/^G[0-9]+$/', $group) && in_array(mb_substr($group, 1),
$arGroups))
1932 elseif (preg_match(
'/^[0-9]+$/', $group) && in_array(
'G' . $group,
$arGroups))
1937 if ($file != $path_file || (
$arGroups !==
false && !$bExists))
1949 CBitrixComponent::clearComponentCache(
"bitrix:menu");
1950 unset($this->FILE_PERMISSION_CACHE[
$site .
"|" . $path_dir .
"/.access.php"]);
1952 foreach (
GetModuleEvents(
"main",
"OnChangePermissions",
true) as $arEvent)
1963 $DOC_ROOT_FROM = CSite::GetSiteDocRoot($site_from);
1970 $path_from_file = mb_substr($path_from,
$p + 1);
1971 $path_from_dir = mb_substr($path_from, 0,
$p);
1981 if (!
$io->FileExists($DOC_ROOT_FROM . $path_from_dir .
"/.access.php"))
1986 include(
$io->GetPhysicalName($DOC_ROOT_FROM . $path_from_dir .
"/.access.php"));
1988 $FILE_PERM = $PERM[$path_from_file];
1989 if (!empty($FILE_PERM))
2003 if (!is_object(
$USER))
2015 $bNumbers = preg_match(
'/^[0-9]+$/',
$groups[0]);
2029 $bWin = (strncasecmp(PHP_OS,
"WIN", 3) == 0);
2035 if (trim(
$path,
"/") !=
"")
2044 if (COption::GetOptionString(
"main",
"controller_member",
"N") ==
"Y" && COption::GetOptionString(
"main",
"~controller_limited_admin",
"N") ==
"Y")
2046 $bAdminM = (is_object(
$USER) &&
$USER->IsAdmin());
2050 $bAdminM = in_array(
"G1",
$groups);
2077 $access_file_name =
"/.access.php";
2088 $Dir = mb_substr(
$path, $pos + 1);
2096 $access_file_name =
$path .
".access.php";
2099 if (array_key_exists(
$site .
"|" . $access_file_name, $this->FILE_PERMISSION_CACHE))
2101 $PERM = $this->FILE_PERMISSION_CACHE[
$site .
"|" . $access_file_name];
2110 include(
$io->GetPhysicalName(
$DOC_ROOT . $access_file_name));
2114 if ($bWin && !empty($PERM))
2119 $PERM_TMP[mb_strtolower(
$key)] =
$val;
2124 $this->FILE_PERMISSION_CACHE[
$site .
"|" . $access_file_name] = $PERM;
2128 if (isset($PERM[$Dir]) && is_array($PERM[$Dir]))
2130 $dir_perm = $PERM[$Dir];
2133 if (isset($dir_perm[$group_id]))
2135 $perm = $dir_perm[$group_id];
2137 elseif (preg_match(
'/^G([0-9]+)$/', $group_id, $match))
2139 if (isset($dir_perm[$match[1]]))
2141 $perm = $dir_perm[$match[1]];
2155 if (str_starts_with(
$perm,
'T_'))
2157 $tid = intval(substr(
$perm, 2));
2164 $arGroupTask[$group_id] = $tid;
2168 if (str_starts_with(
$perm,
'T_'))
2170 $tid = intval(substr(
$perm, 2));
2178 if ($max_perm ==
"" ||
$perm > $max_perm)
2188 if ($group_id ==
"*")
2216 $arTasks = array_unique(array_values($arGroupTask));
2235 $intUserID = intval($userID);
2236 if ($intUserID .
'|' != $userID .
'|')
2243 $groups = CUser::GetUserGroup($intUserID);
2251 $strContent = str_replace(
"\r\n",
"\n", $strContent);
2256 foreach (
GetModuleEvents(
"main",
"OnBeforeChangeFile",
true) as $arEvent)
2271 $io->CreateDirectory($fileIo->GetPath());
2273 if ($fileIo->IsExists())
2275 $file[
"exists"] =
true;
2276 if (!$fileIo->IsWritable())
2278 $fileIo->MarkWritable();
2280 $file[
"size"] = $fileIo->GetFileSize();
2284 if (COption::GetOptionInt(
"main",
"disk_space") > 0)
2287 if (
false === $quota->checkDiskQuota([
"FILE_SIZE" => mb_strlen($strContent) - intval($file[
"size"])]))
2294 if ($fileIo->PutContents($strContent))
2296 $fileIo->MarkWritable();
2300 if ($file[
"exists"])
2315 if (mb_strtoupper(mb_substr(PHP_OS, 0, 3)) ===
'WIN')
2333 if (COption::GetOptionInt(
"main",
"disk_space") > 0)
2335 $fs = $fileIo->GetFileSize();
2336 CDiskQuota::updateDiskQuota(
"files", $fs - intval($file[
"size"]),
"update");
2353 if (
$f->GetFileSize() <= 0)
2366 return LPA::Process(
$filesrc, $old_filesrc);
2374 LPA::ComponentChecker(
$arParams, $arPHPparams, $parentParamName);
2379 return preg_replace(
"/[^a-zA-Z0-9_:.!\$\\-;@^~]/i",
"",
$str);
2393 $path_without_lang = $path_without_lang_tmp =
"";
2395 $db_res = CSite::GetList(
'',
'', [
"ACTIVE" =>
"Y",
"ID" => LANG]);
2396 if ((
$ar =
$db_res->Fetch()) && mb_strpos($cur_page,
$ar[
"DIR"]) === 0)
2398 $path_without_lang = mb_substr($cur_page, mb_strlen(
$ar[
"DIR"]) - 1);
2399 $path_without_lang = ltrim($path_without_lang,
"/");
2400 $path_without_lang_tmp = rtrim($path_without_lang,
"/");
2404 $db_res = CSite::GetList(
"SORT",
"ASC", [
"ACTIVE" =>
"Y"]);
2408 $ar[
"SELECTED"] = (
$ar[
"LID"] == LANG);
2412 $p = rtrim(str_replace(
"&#",
"#", preg_replace(
"/lang=[^&#]*&*/",
"",
$_SERVER[
"QUERY_STRING"])),
"&");
2419 if (mb_strlen($path_without_lang) > 1 && file_exists(
$ar[
"ABS_DOC_ROOT"] .
"/" .
$ar[
"DIR"] .
"/" . $path_without_lang_tmp))
2421 $ar[
"PATH"] =
$ar[
"DIR"] . $path_without_lang;
2424 if (
$ar[
"PATH"] ==
'')
2426 $ar[
"PATH"] =
$ar[
"DIR"];
2429 if (
$ar[
"ABS_DOC_ROOT"] !==
$_SERVER[
"DOCUMENT_ROOT"])
2435 $ar[
"FULL_URL"] =
$ar[
"PATH"];
2457 static $MODULE_ROLES = [];
2464 if (is_object(
$USER))
2473 $key = $use_default_role .
"_" . $max_role_for_super_admin;
2484 $cache_site_key = (
$site_id ?:
"COMMON");
2494 if (in_array(1,
$arGroups) && $max_role_for_super_admin ==
"Y")
2496 $arRoles[] = $max_role;
2500 "SELECT MG.G_ACCESS FROM b_group G " .
2501 " LEFT JOIN b_module_group MG ON (G.ID = MG.GROUP_ID " .
2502 " AND MG.MODULE_ID = '" .
$DB->ForSql(
$module_id, 50) .
"') " .
2504 "WHERE G.ID in (" .
$groups .
") AND G.ACTIVE = 'Y'";
2506 $t =
$DB->Query($strSql);
2508 $default_role = $min_role;
2509 if ($use_default_role ==
"Y")
2511 $default_role = COption::GetOptionString(
$module_id,
"GROUP_DEFAULT_RIGHT", $min_role);
2514 while ($tr = $t->Fetch())
2516 if ($tr[
"G_ACCESS"] !==
null)
2518 $arRoles[] = $tr[
"G_ACCESS"];
2522 if ($use_default_role ==
"Y")
2524 $arRoles[] = $default_role;
2533 $arRoles = array_unique($arRoles);
2558 if ($max_right_for_super_admin ==
'Y' &&
$USER->IsAdmin())
2571 $max_right_for_super_admin ==
'Y'
2574 COption::GetOptionString(
'main',
'controller_member',
'N') !=
'Y'
2575 || COption::GetOptionString(
'main',
'~controller_limited_admin',
'N') !=
'Y'
2587 $modulePermissions = ModuleGroupTable::query()
2590 ->where(
'GROUP.ACTIVE',
'Y')
2591 ->setCacheTtl(86400)
2597 foreach ($modulePermissions as $permission)
2600 if (in_array($permission[
'SITE_ID'],
$siteId))
2603 if (in_array($permission[
'GROUP_ID'],
$groups))
2606 if ($permission[
'G_ACCESS'] >
$right)
2608 $right = $permission[
'G_ACCESS'];
2614 if (
$right ==
'' && $use_default_level ==
'Y')
2616 $right = COption::GetOptionString(
$moduleId,
'GROUP_DEFAULT_RIGHT', $minRight);
2628 $query = ModuleGroupTable::query()
2631 ->where(
'GROUP.ACTIVE',
'Y')
2632 ->setCacheTtl(86400)
2637 while ($tr =
$query->fetch())
2639 if (in_array($tr[
'GROUP_ID'],
$groups))
2641 $arRes[($tr[
'SITE_ID'] !=
'' ? $tr[
'SITE_ID'] :
'common')][$tr[
'GROUP_ID']] = $tr[
'G_ACCESS'];
2651 static $fields = [
'MODULE_ID' => 1,
'GROUP_ID' => 1,
'G_ACCESS' => 1];
2653 $query = ModuleGroupTable::query()->setSelect([
'*']);
2659 $query->where($field, $value);
2669 $query->whereNull(
'SITE_ID');
2684 $group_id = intval($group_id);
2686 if (COption::GetOptionString(
"main",
"event_log_module_access",
"N") ===
"Y")
2690 $rsRight =
$DB->Query(
"SELECT G_ACCESS FROM b_module_group WHERE MODULE_ID='" .
$DB->ForSql(
$module_id, 50) .
"' AND GROUP_ID=" . $group_id .
" AND SITE_ID " . (
$site_id ?
"= '" .
$DB->ForSql(
$site_id) .
"'" :
"IS NULL"));
2691 if ($arRight = $rsRight->Fetch())
2693 $sOldRight = $arRight[
"G_ACCESS"];
2695 if ($sOldRight <>
$right)
2704 "GROUP_ID" => $group_id,
2705 "G_ACCESS" =>
"'" .
$DB->ForSql(
$right, 255) .
"'",
2709 if (intval(
$rows) <= 0)
2719 ModuleGroupTable::cleanCache();
2721 foreach (
GetModuleEvents(
"main",
"OnAfterSetGroupRight",
true) as $arEvent)
2738 $sGroups .= ($sGroups <>
'' ?
',' :
'') . intval($grp);
2746 if (COption::GetOptionString(
"main",
"event_log_module_access",
"N") ===
"Y")
2749 $rsRight =
$DB->Query(
"SELECT GROUP_ID, G_ACCESS FROM b_module_group WHERE MODULE_ID='" .
$DB->ForSql(
$module_id, 50) .
"' AND GROUP_ID IN (" . $sGroups .
") AND SITE_ID " . (
$site_id ?
"= '" .
$DB->ForSql(
$site_id) .
"'" :
"IS NULL"));
2750 while ($arRight = $rsRight->Fetch())
2755 $strSql =
"DELETE FROM b_module_group WHERE MODULE_ID='" .
$DB->ForSql(
$module_id, 50) .
"' and GROUP_ID in (" . $sGroups .
") AND SITE_ID " . (
$site_id ?
"= '" .
$DB->ForSql(
$site_id) .
"'" :
"IS NULL");
2760 $strSql =
"DELETE FROM b_module_group WHERE MODULE_ID='" .
$DB->ForSql(
$module_id, 50) .
"' AND SITE_ID " . (
$site_id ?
"= '" .
$DB->ForSql(
$site_id) .
"'" :
"IS NULL");
2766 $strSql =
"DELETE FROM b_module_group WHERE GROUP_ID in (" . $sGroups .
") AND SITE_ID " . (
$site_id ?
"= '" .
$DB->ForSql(
$site_id) .
"'" :
"IS NULL");
2771 $DB->Query($strSql);
2773 ModuleGroupTable::cleanCache();
2775 foreach (
GetModuleEvents(
"main",
"OnAfterDelGroupRight",
true) as $arEvent)
2796 "[T] " .
GetMessage(
"OPTION_READ_PROFILE_WRITE"),
2797 "[V] " .
GetMessage(
"OPTION_READ_OTHER_PROFILES_WRITE"),
2806 "reference_id" => [
"D",
"R",
"W"],
2823 if ($name_prefix ===
false)
2825 $name = COption::GetOptionString(
"main",
"cookie_name",
"BITRIX_SM") .
"_" .
$name;
2831 return ($_COOKIE[
$name] ??
"");
2849 public function set_cookie(
$name, $value,
$time =
false, $folder =
"/", $domain =
false, $secure =
false, $spread =
true, $name_prefix =
false, $httpOnly =
false)
2851 if (
$time ===
false)
2858 if ($name_prefix !==
false)
2860 $cookie->setName($name_prefix .
"_" .
$name);
2863 if ($domain !==
false)
2865 $cookie->setDomain($domain);
2867 $cookie->setPath($folder);
2868 $cookie->setSecure($secure);
2869 $cookie->setHttpOnly($httpOnly);
2871 if ($spread ===
"Y" || $spread ===
true)
2877 $spread_mode = $spread;
2883 $cookie->setSpread($spread_mode);
2885 Main\Context::getCurrent()->getResponse()->addCookie($cookie);
2901 if (
$application->getSessionLocalStorageManager()->isReady())
2903 $response = Main\Context::getCurrent()->getResponse();
2905 $localStorage =
$application->getLocalSession(
'spreadCookies');
2906 $cookies = $localStorage->getData();
2908 foreach ($cookies as $cookie)
2910 if ($cookie instanceof
Main\
Web\Cookie)
2916 $localStorage->setData(
$response->getCookies());
2924 static $showed_already =
false;
2928 $showed_already =
true;
2937 $request = Main\Context::getCurrent()->getRequest();
2941 && !$this->HoldSpreadCookieHTML()
2942 && COption::GetOptionString(
"main",
"ALLOW_SPREAD_COOKIE",
"Y") ==
"Y"
2947 $res .=
"new Image().src='" . CUtil::JSEscape(
$url) .
"';\n";
2954 return '<script>' .
$res .
'</script>';
2969 if (COption::GetOptionString(
"main",
"ALLOW_SPREAD_COOKIE",
"Y") ==
"Y")
2971 $response = Main\Context::getCurrent()->getResponse();
2972 $request = Main\Context::getCurrent()->getRequest();
2975 $localStorage =
$application->getLocalSession(
'spreadCookies');
2976 $cookies = $localStorage->getData();
2978 foreach ($cookies as $cookie)
2980 if ($cookie instanceof
Main\
Web\Cookie)
2985 $localStorage->clear();
2989 if (!empty($cookies))
2992 foreach ($cookies as $cookie)
2994 if ($cookie->getSpread() &
Main\
Web\Cookie::SPREAD_SITES)
2996 $params .= $cookie->getName() . chr(1) .
2997 $cookie->getValue() . chr(1) .
2998 $cookie->getExpires() . chr(1) .
2999 $cookie->getPath() . chr(1) .
3001 $cookie->getSecure() . chr(1) .
3002 $cookie->getHttpOnly() . chr(2);
3005 $salt =
$_SERVER[
"REMOTE_ADDR"] .
"|" . @filemtime(
$_SERVER[
"DOCUMENT_ROOT"] .
"/bitrix/modules/main/classes/general/version.php") .
"|" .
$application->getLicense()->getKey();
3009 $arrDomain[] =
$request->getHttpHost();
3011 $rs = CSite::GetList(
'',
'', [
"ACTIVE" =>
"Y"]);
3012 while (
$ar =
$rs->Fetch())
3014 $arD = explode(
"\n", str_replace(
"\r",
"\n",
$ar[
"DOMAINS"]));
3017 foreach ($arD as $d)
3027 if (!empty($arrDomain))
3029 $arUniqDomains = [];
3030 $arrDomain = array_unique($arrDomain);
3031 $arrDomain2 = array_unique($arrDomain);
3032 foreach ($arrDomain as $domain1)
3035 foreach ($arrDomain2 as $domain2)
3037 if (mb_strlen($domain1) > mb_strlen($domain2) && str_ends_with($domain1,
"." . $domain2))
3045 $arUniqDomains[] = $domain1;
3051 foreach ($arUniqDomains as $domain)
3053 if (trim($domain) <>
'')
3056 $arrUrl = parse_url(
$url);
3057 if ($arrUrl[
"host"] != $arrCurUrl[
"host"])
3077 if (is_array($arButton) && !empty($arButton))
3079 if (isset($arButton[
"ID"]) && $arButton[
"ID"] <>
"")
3081 if (!isset($this->arPanelButtons[$arButton[
"ID"]]))
3083 $this->arPanelButtons[$arButton[
"ID"]] = $arButton;
3088 isset($this->arPanelButtons[$arButton[
"ID"]][
"MENU"])
3089 && is_array($this->arPanelButtons[$arButton[
"ID"]][
"MENU"])
3092 if (!isset($arButton[
"MENU"]) || !is_array($arButton[
"MENU"]))
3094 $arButton[
"MENU"] = [];
3096 $arButton[
"MENU"] = array_merge($this->arPanelButtons[$arButton[
"ID"]][
"MENU"], $arButton[
"MENU"]);
3098 $this->arPanelButtons[$arButton[
"ID"]] = $arButton;
3101 if (isset($this->arPanelFutureButtons[$arButton[
'ID']]))
3104 isset($this->arPanelButtons[$arButton[
"ID"]][
"MENU"])
3105 && is_array($this->arPanelButtons[$arButton[
"ID"]][
"MENU"])
3108 $this->arPanelButtons[$arButton[
"ID"]][
"MENU"] = array_merge(
3109 $this->arPanelButtons[$arButton[
"ID"]][
"MENU"],
3110 $this->arPanelFutureButtons[$arButton[
"ID"]]
3115 $this->arPanelButtons[$arButton[
"ID"]][
"MENU"] = $this->arPanelFutureButtons[$arButton[
"ID"]];
3117 unset($this->arPanelFutureButtons[$arButton[
'ID']]);
3122 $this->arPanelButtons[] = $arButton;
3129 if (isset($this->arPanelButtons[$button_id]))
3131 if (!isset($this->arPanelButtons[$button_id][
'MENU']))
3133 $this->arPanelButtons[$button_id][
'MENU'] = [];
3135 $this->arPanelButtons[$button_id][
'MENU'][] = $arMenuItem;
3139 if (!isset($this->arPanelFutureButtons[$button_id]))
3141 $this->arPanelFutureButtons[$button_id] = [];
3144 $this->arPanelFutureButtons[$button_id][] = $arMenuItem;
3166 $this->showPanelWasInvoked =
true;
3168 AddEventHandler(
'main',
'OnBeforeEndBufferContent', [
'CTopPanel',
'InitPanel']);
3194 $context = Main\Context::getCurrent();
3201 "SERVER_NAME" => (
$site ?
$site->getServerName() :
''),
3202 "CHARSET" =>
$culture->getCharset(),
3203 "FORMAT_DATE" =>
$culture->getFormatDate(),
3204 "FORMAT_DATETIME" =>
$culture->getFormatDatetime(),
3205 "LANGUAGE_ID" =>
$context->getLanguage(),
3219 static $index =
null;
3220 static $view =
null;
3227 $index =
count($this->buffer_content);
3234 || !isset($this->buffer_content_type[$index / 2 - 1])
3235 || $this->buffer_content_type[$index / 2 - 1][
"F"] !==
"trim"
3243 $autoCompositeArea?->end();
3245 $this->buffer_man =
true;
3247 $this->buffer_man =
false;
3249 array_splice($this->buffer_content, $index);
3250 array_splice($this->buffer_content_type, $index / 2);
3252 ob_start([&$this,
"EndBufferContent"]);
3254 $this->__view = $view;
3263 $args_num = func_num_args();
3266 for (
$i = 1;
$i < $args_num;
$i++)
3268 $args[] = func_get_arg(
$i);
3274 echo call_user_func_array($callback, $args);
3277 $this->buffer_content[] = ob_get_contents();
3278 $this->buffer_content[] =
"";
3279 $this->buffer_content_type[] = [
"F" => $callback,
"P" => $args];
3280 $this->buffer_man =
true;
3281 $this->auto_buffer_cleaned =
false;
3283 $this->buffer_man =
false;
3284 $this->buffered =
true;
3285 if ($this->auto_buffer_cleaned)
3287 ob_start([&$this,
"EndBufferContent"]);
3297 $this->oAsset->setShowHeadString(
false);
3298 $this->oAsset->setShowHeadScript(
false);
3299 $this->buffer_man =
true;
3301 $this->buffer_man =
false;
3302 $this->buffer_content_type = [];
3303 $this->buffer_content = [];
3305 if (function_exists(
"getmoduleevents"))
3307 foreach (
GetModuleEvents(
"main",
"OnBeforeRestartBuffer",
true) as $arEvent)
3313 ob_start([&$this,
"EndBufferContent"]);
3322 if (!$this->buffered)
3328 $this->buffer_man =
true;
3330 $this->buffered =
false;
3331 $this->buffer_man =
false;
3333 $this->buffer_manual =
true;
3335 $this->buffer_manual =
false;
3337 $this->buffer_content_type = [];
3338 $this->buffer_content = [];
3345 if ($this->buffer_man)
3347 $this->auto_buffer_cleaned =
true;
3353 if (function_exists(
"getmoduleevents"))
3355 foreach (
GetModuleEvents(
"main",
"OnBeforeEndBufferContent",
true) as $arEvent)
3361 $asset = Asset::getInstance();
3365 $asset->addString($this->
GetSpreadCookieHTML(),
false, AssetLocation::AFTER_JS, AssetMode::STANDARD);
3371 if (is_object(
$GLOBALS[
"APPLICATION"]))
3373 $cnt =
count($this->buffer_content_type);
3374 for (
$i = 0;
$i < $cnt;
$i++)
3376 $this->buffer_content[
$i * 2 + 1] = call_user_func_array($this->buffer_content_type[
$i][
"F"], $this->buffer_content_type[
$i][
"P"]);
3383 if (function_exists(
"getmoduleevents"))
3385 foreach (
GetModuleEvents(
"main",
"OnEndBufferContent",
true) as $arEvent)
3392 if (!$wasContentModified && $asset->canMoveJsToBody())
3402 if ($this->LAST_ERROR)
3406 $this->LAST_ERROR =
false;
3412 if (is_object($msg) && (is_subclass_of($msg,
'CApplicationException') || (mb_strtolower(get_class($msg)) ==
'capplicationexception')))
3414 $this->LAST_ERROR = $msg;
3453 $cpt =
new CCaptcha();
3456 return $cpt->GetSID();
3461 $cpt =
new CCaptcha();
3462 if ($cpt->CheckCode($captcha_word, $captcha_sid))
3474 if (str_contains(
$str,
"%u"))
3476 $str = preg_replace_callback(
3477 "'%u([0-9A-F]{2})([0-9A-F]{2})'i",
3479 $res = chr(hexdec(
$ch[2])) . chr(hexdec(
$ch[1]));
3480 return \Bitrix\Main\Text\Encoding::convertEncoding(
$res,
"UTF-16",
LANG_CHARSET);
3495 "arResultDest" => $arResultDest,
3497 "select" => $bAllowFolderSelect ?
'DF' :
'F',
3498 "fileFilter" => $fileFilter,
3500 "showUploadTab" =>
true,
3501 "showAddToMenuTab" =>
false,
3502 "allowAllFiles" =>
true,
3503 "SaveConfig" =>
true,
3515 CUtil::InitJSCore([
'window',
'ajax']);
3518 class_exists(
'CUserOptions')
3520 !isset($arUrl[
'PARAMS'])
3521 || !is_array($arUrl[
'PARAMS'])
3522 || !isset($arUrl[
'PARAMS'][
'resizable'])
3523 || $arUrl[
'PARAMS'][
'resizable'] !==
false
3527 $pos = mb_strpos($arUrl[
'URL'],
'?');
3530 $check_url = $arUrl[
'URL'];
3534 $check_url = mb_substr($arUrl[
'URL'], 0, $pos);
3537 if (defined(
'SITE_TEMPLATE_ID'))
3539 $arUrl[
'URL'] = (
new Uri($arUrl[
'URL']))
3540 ->addParams([
'siteTemplateId' => SITE_TEMPLATE_ID])
3545 $arPos = CUtil::GetPopupSize($check_url);
3547 if ($arPos[
'width'])
3549 if (!is_array($arUrl[
'PARAMS']))
3551 $arUrl[
'PARAMS'] = [];
3554 $arUrl[
'PARAMS'][
'width'] = $arPos[
'width'];
3555 $arUrl[
'PARAMS'][
'height'] = $arPos[
'height'];
3559 $dialog_class =
'CDialog';
3560 if (isset($arUrl[
'PARAMS'][
'dialog_type']) && $arUrl[
'PARAMS'][
'dialog_type'])
3562 switch ($arUrl[
'PARAMS'][
'dialog_type'])
3565 $dialog_class =
'CEditorDialog';
3568 $dialog_class =
'CAdminDialog';
3572 elseif (str_contains($arUrl[
'URL'],
'bxpublic='))
3574 $dialog_class =
'CAdminDialog';
3578 'content_url' => $arUrl[
'URL'],
3583 if (isset($arUrl[
'PARAMS'][
'width']))
3585 $arDialogParams[
'width'] = intval($arUrl[
'PARAMS'][
'width']);
3587 if (isset($arUrl[
'PARAMS'][
'height']))
3589 $arDialogParams[
'height'] = intval($arUrl[
'PARAMS'][
'height']);
3591 if (isset($arUrl[
'PARAMS'][
'min_width']))
3593 $arDialogParams[
'min_width'] = intval($arUrl[
'PARAMS'][
'min_width']);
3595 if (isset($arUrl[
'PARAMS'][
'min_height']))
3597 $arDialogParams[
'min_height'] = intval($arUrl[
'PARAMS'][
'min_height']);
3599 if (isset($arUrl[
'PARAMS'][
'resizable']) && $arUrl[
'PARAMS'][
'resizable'] ===
false)
3601 $arDialogParams[
'resizable'] =
false;
3603 if (isset($arUrl[
'POST']) && $arUrl[
'POST'])
3605 $arDialogParams[
'content_post'] = $arUrl[
'POST'];
3608 return '(new BX.' . $dialog_class .
'(' . CUtil::PhpToJsObject($arDialogParams) .
')).Show()';
3613 static $uniq =
null;
3616 $uniq = COption::GetOptionString(
"main",
"server_uniq_id",
"");
3621 COption::SetOptionString(
"main",
"server_uniq_id", $uniq);
3635 define(
"BX_BUFFER_USED",
true);
3637 register_shutdown_function(
3639 define(
"BX_BUFFER_SHUTDOWN",
true);
3640 for (
$i = 0,
$n = ob_get_level();
$i <
$n;
$i++)
3651 if (COption::GetOptionString(
"main",
"session_expand",
"Y") <>
"N")
3654 if (COption::GetOptionString(
"main",
"session_auth_only",
"Y") <>
"Y" ||
$USER->IsAuthorized())
3664 if (CTimeZone::Enabled() && (!defined(
"BX_SKIP_TIMEZONE_COOKIE") || BX_SKIP_TIMEZONE_COOKIE ===
false))
3666 CTimeZone::SetAutoCookie();
3670 if (
$USER->IsAuthorized())
3672 $cookieName = COption::GetOptionString(
"main",
"cookie_name",
"BITRIX_SM") .
"_LAST_SETTINGS";
3673 if (!empty($_COOKIE[$cookieName]))
3675 CUserOptions::SetCookieOptions($cookieName);
3699 $response = Main\Context::getCurrent()->getResponse();
3712 if (!defined(
'BX_WITH_ON_AFTER_EPILOG'))
3714 define(
'BX_WITH_ON_AFTER_EPILOG',
true);
3719 define(
"START_EXEC_EVENTS_1", microtime());
3723 $DB->StartUsingMasterOnly();
3724 if (CUserCounter::CheckLiveMode())
3728 $DB->StopUsingMasterOnly();
3731 define(
"START_EXEC_EVENTS_2", microtime());
3734 foreach ($events as
$event)
3755 if ($func !==
false)
3767 return $helper->quote(
'CONDITION');
if(!Loader::includeModule('catalog')) if(!AccessController::getCurrent() ->check(ActionDictionary::ACTION_PRICE_EDIT)) if(!check_bitrix_sessid()) $request
change_password_forgot_link login popup forget pas AUTH_GOTO_FORGOT_FORM login btn wrap change_password_button login popup link login popup return auth javascript
static resetAccelerator(string $filename=null)
static getConnection($name="")
static deleteByFilter($filter)
static endBuffering(&$originalContent, $compositeContent)
static startBuffering($content)
static get($moduleId, $name, $default="", $siteId=false)
static getBackTrace($limit=0, $options=null, $skip=1)
static includeModule($moduleName)
static getString($length, $caseSensitive=false)
static convertEncoding($data, $charsetFrom, $charsetTo)
static delete($siteId, $filter)
static reindexFile($siteId, $rootPath, $path, $maxFileSize=0)
static ShowScript($arConfig)
GetMenuHtml($type="left", $bMenuExt=false, $template=false, $sInitDir=false)
GroupModuleCSS($from='', $to='')
AuthForm($mess, $show_prolog=true, $show_epilog=true, $not_show_links="N", $do_die=true)
GetProperty($PROPERTY_ID, $default_value=false)
AddJSKernelInfo($module='', $arJS=[])
GetNavChain($path=false, $iNumFrom=0, $sNavChainPath=false, $bIncludeOnce=false, $bShowIcons=true)
static FinalActions($output="")
SetPageProperty($PROPERTY_ID, $PROPERTY_VALUE, $arOptions=null)
SaveFileContent($abs_path, $strContent)
GetMenu($type="left", $bMenuExt=false, $template=false, $sInitDir=false)
GetTemplatePath($rel_path)
IncludeStringAfter($arIcons=false, $arParams=[])
GetLink($id, $rel=null, $bXhtmlStyle=true)
static GetGroupRight($module_id, $arGroups=false, $use_default_level="Y", $max_right_for_super_admin="Y", $site_id=false)
static ProcessLPA($filesrc=false, $old_filesrc=false)
static PrintHKGlobalUrlVar()
SetTemplateCSS($rel_path)
AddBufferContent($callback)
SetAuthResult($arAuthResult)
GetFileAccessPermissionByUser($userID, $path, $groups=false, $task_mode=false)
GetHeadStrings($location=AssetLocation::AFTER_JS_KERNEL)
ShowLink($id, $rel=null, $bXhtmlStyle=true)
GetCSS($cMaxStylesCnt=true, $bXhtmlStyle=true, $assetTargetType=Main\Page\AssetShowTargetType::ALL)
IncludeComponent($componentName, $componentTemplate, $arParams=[], $parentComponent=null, $arFunctionParams=[], $returnResult=false)
GetPageProperty($PROPERTY_ID, $default_value=false)
AddCSSKernelInfo($module='', $arCSS=[])
static GetDefaultRightList()
GetFileAccessPermission($path, $groups=false, $task_mode=false)
AddPanelButton($arButton, $bReplace=false)
EndBufferContent($content="")
static GetUserRoles($module_id, $arGroups=false, $use_default_role="Y", $max_role_for_super_admin="Y", $site_id=false)
SetDirProperty($PROPERTY_ID, $PROPERTY_VALUE, $path=false)
HoldSpreadCookieHTML($bSet=false)
ConvertCharset($string, $charset_in, $charset_out)
static ShowFileSelectDialog($event, $arResultDest, $arPath=[], $fileFilter="", $bAllowFolderSelect=false)
set_cookie($name, $value, $time=false, $folder="/", $domain=false, $secure=false, $spread=true, $name_prefix=false, $httpOnly=false)
SetFileAccessPermission($path, $arPermissions, $bOverWrite=true)
GetMeta($id, $meta_name=false, $bXhtmlStyle=true)
static GetMainRightList()
ThrowException($msg, $id=false)
clearViewContent(string $view)
static GetUserRightArray($moduleId, $groups)
RemoveFileAccessPermission($path, $arGroups=false)
ShowProperty($PROPERTY_ID, $default_value=false)
ShowMeta($id, $meta_name=false, $bXhtmlStyle=true)
GroupModuleJS($from='', $to='')
GetMenuHtmlEx($type="left", $bMenuExt=false, $template=false, $sInitDir=false)
static __GetConditionFName()
static GetGroupRightList($arFilter, $site_id=false)
GetCurUri($addParam="", $get_index_page=null)
IncludeAdminFile($strTitle, $filepath)
RestartWorkarea($start=false)
get_cookie($name, $name_prefix=false)
GetCurPageParam($strParam="", $arParamKill=[], $get_index_page=null)
ShowCSS($cMaxStylesCnt=true, $bXhtmlStyle=true)
static IsExternalLink($src)
NeedCAPTHAForLogin($login)
static ForkActions($func=false, $args=[])
GetFileRecursive($strFileName, $strDir=false)
GetTitle($property_name=false, $strip_tags=false)
static _ReplaceNonLatin($str)
AddAdditionalJS($content)
AddViewContent($view, $content, $pos=500)
CopyFileAccessPermission($path_from, $path_to, $bOverWrite=false)
GetDirPropertyList($path=false)
ShowAjaxHead($bXhtmlStyle=true, $showCSS=true, $showStrings=true, $showScripts=true)
static InitPathVars(&$site, &$path)
static RunFinalActionsInternal()
ShowTitle($property_name="title", $strip_tags=true)
SetEditArea($areaId, $arIcons)
getCurrentIncludedComponent()
SetShowIncludeAreas($bShow=true)
AddPanelButtonMenu($button_id, $arMenuItem)
CaptchaCheckCode($captcha_word, $captcha_sid)
static OnChangeFileComponent($path, $site)
static ShowBanner($type, $html_before="", $html_after="")
IncludeFile($rel_path, $arParams=[], $arFunctionParams=[])
static DelGroupRight($module_id='', $arGroups=[], $site_id=false)
ConvertCharsetArray($arData, $charset_from, $charset_to)
static SetGroupRight($module_id, $group_id, $right, $site_id=false)
IncludeString($string, $arIcons=false)
static GetUserRight($moduleId, $groups=false, $use_default_level='Y', $max_right_for_super_admin='Y', $siteId=false)
AddHeadScript($src, $additional=false)
AddHeadString($str, $bUnique=false, $location=AssetLocation::AFTER_JS_KERNEL)
GetCurPage($get_index_page=null)
static LPAComponentChecker(&$arParams, &$arPHPparams, $parentParamName=false)
SetAdditionalCSS($Path2css, $additional=false)
GetDirProperty($PROPERTY_ID, $path=false, $default_value=false)
SetUniqueCSS($id='', $cssType='page')
ShowHead($bXhtmlStyle=true)
static GetIdByLetter($letter, $module, $binding='module')
static clearComponentCache($componentName, $siteId="")
static Log($SEVERITY, $AUDIT_TYPE_ID, $MODULE_ID, $ITEM_ID, $DESCRIPTION=false, $SITE_ID=false)
static GetCoreMessagesScript($compositeMode=false)
static checkSendCounter()
hidden PROPERTY[<?=$propertyIndex?>][CODE]<?=htmlspecialcharsEx( $propertyCode)?> height
bx popup label bx width30 PAGE_NEW_MENU_NAME text width
while($group=$gr->Fetch()) $bAdmin
$_SERVER["DOCUMENT_ROOT"]
EscapePHPString($str, $encloser='"')
ExecuteModuleEventEx($arEvent, $arParams=[])
GetPagePath($page=false, $get_index_page=null)
bxstrrpos($haystack, $needle)
IsModuleInstalled($module_id)
HasScriptExtension($check_name)
AddEventHandler($FROM_MODULE_ID, $MESSAGE_ID, $CALLBACK, $SORT=100, $FULL_PATH=false)
htmlspecialcharsbx($string, $flags=ENT_COMPAT, $doubleEncode=true)
GetModuleEvents($MODULE_ID, $MESSAGE_ID, $bReturnArray=false)
IncludeModuleLangFile($filepath, $lang=false, $bReturnArray=false)
Rel2Abs($curdir, $relpath)
GetMessage($name, $aReplace=null)
IsConfigFile(string $path)
getLocalPath($path, $baseFolder="/bitrix")
$GLOBALS['____1690880296']
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)
if(empty($signedUserToken)) $key
const BX_SENDPULL_COUNTER_QUEUE_DISABLE
</p ></td >< td valign=top style='border-top:none;border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;padding:0cm 2.0pt 0cm 2.0pt;height:9.0pt'>< p class=Normal align=center style='margin:0cm;margin-bottom:.0001pt;text-align:center;line-height:normal'>< a name=ТекстовоеПоле54 ></a ><?=($taxRate > count( $arTaxList) > 0) ? $taxRate."%"
if($inWords) echo htmlspecialcharsbx(Number2Word_Rus(roundEx($totalVatSum $params['CURRENCY']