1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
enable_component.php
См. документацию.
1<?php
7require($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/prolog_admin_before.php");
8require($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/prolog_admin_js.php");
9
10IncludeModuleLangFile(__FILE__);
11
14
16
17$src_path = $io->CombinePath("/", $_GET["src_path"]);
18$src_line = intval($_GET["src_line"]);
19
20if(!$USER->CanDoOperation('edit_php') && !$USER->CanDoFileOperation('fm_lpa', array($_GET["src_site"], $src_path)))
21 die(GetMessage("ACCESS_DENIED"));
22
23// try to read parameters from script file
24/* Try to open script containing the component call */
25if(!$src_path || $src_line <= 0)
26 $strWarning = GetMessage("comp_prop_err_param");
27else
28{
29 $abs_path = $io->RelativeToAbsolutePath($src_path);
30 $f = $io->GetFile($abs_path);
31 $filesrc = $f->GetContents();
32 if(!$filesrc || $filesrc == "")
33 $strWarning = GetMessage("comp_prop_err_open");
34}
35
36if($strWarning == "")
37{
38 $arComponent = PHPParser::FindComponent($_GET["component_name"], $filesrc, $src_line);
39
40 if($arComponent === false)
41 $strWarning = GetMessage("comp_prop_err_comp");
42}
43
44if($strWarning == "")
45{
47 {
48 $strWarning = GetMessage("comp_prop_err_save");
49 }
50 else
51 {
52 if(!is_array($arComponent["DATA"]["FUNCTION_PARAMS"]))
53 $arComponent["DATA"]["FUNCTION_PARAMS"] = array();
54
55 $arComponent["DATA"]["FUNCTION_PARAMS"]["ACTIVE_COMPONENT"] = ($_GET['active'] == 'N'? 'N':'Y');
56
57 $code = PHPParser::buildComponentCode($arComponent);
58
59 $filesrc_for_save = mb_substr($filesrc, 0, $arComponent["START"]).$code.mb_substr($filesrc, $arComponent["END"]);
60
61 $f = $io->GetFile($abs_path);
62 $arUndoParams = array(
63 'module' => 'fileman',
64 'undoType' => $_GET['active'] == 'N'? 'disable_component' : 'enable_component' ,
65 'undoHandler' => 'CFileman::UndoEditFile',
66 'arContent' => array(
67 'absPath' => $abs_path,
68 'content' => $f->GetContents()
69 )
70 );
71
72 if(!$APPLICATION->SaveFileContent($abs_path, $filesrc_for_save))
73 $strWarning = GetMessage("comp_prop_err_save");
74 else
75 CUndo::ShowUndoMessage(CUndo::Add($arUndoParams));
76 }
77}
78
79if($strWarning <> "")
80 echo "<script>alert('".CUtil::JSEscape($strWarning)."')</script>";
81
82require($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/epilog_admin_js.php");
global $APPLICATION
Определения include.php:80
if($canUseYandexMarket) $strWarning
Определения options.php:74
static GetInstance()
Определения virtual_io.php:60
static ShowUndoMessage($ID)
Определения undo.php:187
static Add($params=array())
Определения undo.php:9
$abs_path
Определения component_props2.php:76
$src_path
Определения component_props2.php:37
$arComponent
Определения component_props2.php:72
$f
Определения component_props.php:52
$src_line
Определения component_props.php:43
$filesrc
Определения component_props.php:53
$strWarning
Определения enable_component.php:12
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$_SERVER["DOCUMENT_ROOT"]
Определения cron_frame.php:9
global $USER
Определения csv_new_run.php:40
$io
Определения csv_new_run.php:98
if(!is_null($config))($config as $configItem)(! $configItem->isVisible()) $code
Определения options.php:195
check_bitrix_sessid($varname='sessid')
Определения tools.php:4686
IncludeModuleLangFile($filepath, $lang=false, $bReturnArray=false)
Определения tools.php:3778
GetMessage($name, $aReplace=null)
Определения tools.php:3397
die
Определения quickway.php:367