1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
file_property.php
См. документацию.
1<?
2require($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/prolog_admin_before.php");
3
5
6$popupWindow = new CJSPopup(GetMessage("PAGE_PROP_WINDOW_TITLE"), array("SUFFIX"=>($_GET['subdialog'] == 'Y'? 'subdialog':'')));
7
8if (IsModuleInstalled("fileman"))
9{
10 if (!$USER->CanDoOperation('fileman_admin_files') && !$USER->CanDoOperation('fileman_edit_existent_files'))
11 $popupWindow->ShowError(GetMessage("PAGE_PROP_ACCESS_DENIED"));
12}
13
15
16//Page path
17$path = "/";
18if (isset($_REQUEST["path"]) && $_REQUEST["path"] <> '')
19 $path = $io->CombinePath("/", $_REQUEST["path"]);
20
21//Lang
22if (!isset($_REQUEST["lang"]) || $_REQUEST["lang"] == '')
23 $lang = LANGUAGE_ID;
24
25//BackUrl
26$back_url = ($_REQUEST["back_url"] ?? "");
27
28//Site ID
30if (isset($_REQUEST["site"]) && $_REQUEST["site"] <> '')
31{
32 $obSite = CSite::GetByID($_REQUEST["site"]);
33 if ($arSite = $obSite->Fetch())
34 $site = $_REQUEST["site"];
35}
36
37$documentRoot = CSite::GetSiteDocRoot($site);
39
40//Check permissions
41if (!$io->FileExists($absoluteFilePath) && !$io->DirectoryExists($absoluteFilePath))
42 $popupWindow->ShowError(GetMessage("PAGE_PROP_FILE_NOT_FOUND")." (".htmlspecialcharsbx($path).")");
43elseif (!$USER->CanDoFileOperation('fm_edit_existent_file',Array($site, $path)))
44 $popupWindow->ShowError(GetMessage("PAGE_PROP_ACCESS_DENIED"));
45
47$fileContent = $f->GetContents();
48
50
51//Save page settings
52if ($_SERVER["REQUEST_METHOD"] == "POST" && !check_bitrix_sessid())
53{
54 $strWarning = GetMessage("MAIN_SESSION_EXPIRED");
55}
56elseif ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_REQUEST["save"]))
57{
58 //Title
59 if (isset($_POST["pageTitle"]) && $_POST["pageTitle"] <> '')
60 $fileContent = SetPrologTitle($fileContent, $_POST["pageTitle"]);
61
62 //Properties
63 if (isset($_POST["PROPERTY"]) && is_array($_POST["PROPERTY"]))
64 {
65 foreach ($_POST["PROPERTY"] as $arProperty)
66 {
67 $arProperty["CODE"] = (isset($arProperty["CODE"]) ? trim($arProperty["CODE"]) : "");
68 $arProperty["VALUE"] = (isset($arProperty["VALUE"]) ? trim($arProperty["VALUE"]) : "");
69
70 if (preg_match("/[a-zA-Z_-~]+/i", $arProperty["CODE"]))
71 $fileContent = SetPrologProperty($fileContent, $arProperty["CODE"], $arProperty["VALUE"]);
72 }
73 }
74
75 //Tags
76 if (isset($_POST["TAGS"]) && IsModuleInstalled("search"))
77 $fileContent = SetPrologProperty($fileContent, COption::GetOptionString("search", "page_tag_property","tags"), $_POST["TAGS"]);
78
79 $f = $io->GetFile($absoluteFilePath);
80 $arUndoParams = array(
81 'module' => 'fileman',
82 'undoType' => 'edit_file',
83 'undoHandler' => 'CFileman::UndoEditFile',
84 'arContent' => array(
85 'absPath' => $absoluteFilePath,
86 'content' => $f->GetContents()
87 )
88 );
89
91
92 if ($success === false && ($exception = $APPLICATION->GetException()))
93 $strWarning = $exception->msg;
94 else
95 {
96 CUndo::ShowUndoMessage(CUndo::Add($arUndoParams));
97
98 if (isset($_GET['subdialog']) && $_GET['subdialog'] == 'Y')
99 echo "<script>structReload('".urlencode($_REQUEST["path"])."');</script>";
100 $popupWindow->Close($bReload=($_GET['subdialog'] <> 'Y'), $back_url);
101 die();
102 }
103}
104
105//Properties from fileman settings
107if (CModule::IncludeModule("fileman") && is_callable(Array("CFileMan", "GetPropstypes")))
109
110//Properties from page
112if ($strWarning != "")
113{
114 //Restore post values if error occured
115 $pageTitle = (isset($_POST["pageTitle"]) && $_POST["pageTitle"] <> '' ? $_POST["pageTitle"] : "");
116
117 if (isset($_POST["PROPERTY"]) && is_array($_POST["PROPERTY"]))
118 {
119 foreach ($_POST["PROPERTY"] as $arProperty)
120 {
121 if (isset($arProperty["VALUE"]) && $arProperty["VALUE"] <> '')
122 $arDirProperties[$arProperty["CODE"]] = $arProperty["VALUE"];
123 }
124 }
125}
126else
127{
128 $arPageSlice = ParseFileContent($fileContent);
129 $arDirProperties = $arPageSlice["PROPERTIES"];
130 $pageTitle = $arPageSlice["TITLE"];
131}
132
133//All properties for file. Includes properties from root folders
134$arInheritProperties = $APPLICATION->GetDirPropertyList(Array($site, $path));
135if ($arInheritProperties === false)
136 $arInheritProperties = Array();
137
138//Tags
139if (IsModuleInstalled("search"))
140{
141 $tagPropertyCode = COption::GetOptionString("search", "page_tag_property","tags");
143
144 if ($strWarning != "" && isset($_POST["TAGS"]) && $_POST["TAGS"] <> '') //Restore post value if error occured
145 $tagPropertyValue = $_POST["TAGS"];
146 elseif (array_key_exists($tagPropertyCode, $arDirProperties))
147 $tagPropertyValue = $arDirProperties[$tagPropertyCode];
148
149 unset($arFilemanProperties[$tagPropertyCode]);
150 unset($arDirProperties[$tagPropertyCode]);
151 unset($arInheritProperties[mb_strtoupper($tagPropertyCode)]);
152}
153
154//Delete equal properties
156foreach ($arFilemanProperties as $propertyCode => $propertyDesc)
157{
158 if (array_key_exists($propertyCode, $arDirProperties))
159 $arGlobalProperties[$propertyCode] = $arDirProperties[$propertyCode];
160 else
161 $arGlobalProperties[$propertyCode] = "";
162
163 unset($arDirProperties[$propertyCode]);
164 unset($arInheritProperties[mb_strtoupper($propertyCode)]);
165}
166
167foreach ($arDirProperties as $propertyCode => $propertyValue)
168 unset($arInheritProperties[mb_strtoupper($propertyCode)]);
169?>
170
171
172<?
173//HTML Output
174$popupWindow->ShowTitlebar(GetMessage("PAGE_PROP_WINDOW_TITLE"));
175$popupWindow->StartDescription("bx-property-page");
176
177if ($strWarning != "")
178 $popupWindow->ShowValidationError($strWarning);
179?>
180
181<p><?=GetMessage("PAGE_PROP_WINDOW_TITLE")?> <b><?=htmlspecialcharsbx($path)?></b></p>
182
183<?if (IsModuleInstalled("fileman")):?>
184 <p><a href="/bitrix/admin/fileman_html_edit.php?lang=<?=urlencode($lang)?>&site=<?=urlencode($site)?>&path=<?=urlencode($path)?>&back_url=<?=urlencode($back_url)?>"><?=GetMessage("PAGE_PROP_EDIT_IN_ADMIN")?></a></p>
185<?endif?>
186
187<?
188$popupWindow->EndDescription();
189$popupWindow->StartContent();
190?>
191
192<table class="bx-width100" id="bx_page_properties">
193
194 <tr class="section">
195 <td colspan="2"><?=GetMessage("PAGE_PROP_FOLDER_NAME")?></td>
196 </tr>
197
198 <tr>
199 <td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_PROP_NAME")?>:</td>
200 <td><input type="text" style="width:90%;" name="pageTitle" value="<?=htmlspecialcharsEx($pageTitle)?>"></td>
201 </tr>
202
203 <tr class="empty">
204 <td colspan="2"><div class="empty"></div></td>
205 </tr>
206
207<?if (!empty($arGlobalProperties) || !empty($arDirProperties) || !empty($arInheritProperties)):?>
208
209 <tr class="section">
210 <td colspan="2">
211 <table cellspacing="0">
212 <tr>
213 <td><?=GetMessage("PAGE_PROP_WINDOW_TITLE")?></td>
214 <td id="bx_page_prop_name">&nbsp;</td>
215 </tr>
216 </table>
217 </td>
218 </tr>
219
220<?endif?>
221
222<?
224$jsInheritPropIds = "var jsInheritProps = [";
225
226foreach ($arGlobalProperties as $propertyCode => $propertyValue):?>
227
228 <tr style="height:30px;">
229 <td class="bx-popup-label bx-width30"><?=(
230 $arFilemanProperties[$propertyCode] <> '' ?
232 htmlspecialcharsEx($propertyCode))
233 ?>:</td>
234 <td>
235
236 <?$inheritValue = $APPLICATION->GetDirProperty($propertyCode, Array($site, $path));?>
237
238 <?if ($inheritValue <> '' && $propertyValue == ''):
240 ?>
241
242 <input type="hidden" name="PROPERTY[<?=$propertyIndex?>][CODE]" value="<?=htmlspecialcharsEx($propertyCode)?>" />
243
244 <div id="bx_view_property_<?=$propertyIndex?>" style="overflow:hidden;padding:2px 12px 2px 2px; border:1px solid white; width:90%; cursor:text; box-sizing:border-box; -moz-box-sizing:border-box;background-color:transparent; background-position:right; background-repeat:no-repeat;" onclick="BXEditProperty(<?=$propertyIndex?>)" onmouseover="this.style.borderColor = '#434B50 #ADC0CF #ADC0CF #434B50';" onmouseout="this.style.borderColor = 'white'" class="edit-field"><?=htmlspecialcharsEx($inheritValue)?></div>
245
246 <div id="bx_edit_property_<?=$propertyIndex?>" style="display:none;"></div>
247
248 <?else:?>
249
250 <input type="text" name="PROPERTY[<?=$propertyIndex?>][VALUE]" value="<?=htmlspecialcharsEx($propertyValue)?>" style="width:90%;"><input type="hidden" name="PROPERTY[<?=$propertyIndex?>][CODE]" value="<?=htmlspecialcharsEx($propertyCode)?>" />
251
252 <?endif?>
253 </td>
254 </tr>
255
257
258<?foreach ($arInheritProperties as $propertyCode => $propertyValue): $jsInheritPropIds .= ",".$propertyIndex;?>
259
260 <tr style="height:30px;">
261 <td class="bx-popup-label bx-width30"><?=htmlspecialcharsEx($propertyCode)?>:</td>
262 <td>
263
264 <input type="hidden" name="PROPERTY[<?=$propertyIndex?>][CODE]" value="<?=htmlspecialcharsEx($propertyCode)?>" />
265
266 <div id="bx_view_property_<?=$propertyIndex?>" style="overflow:hidden;padding:2px 12px 2px 2px; border:1px solid white; width:90%; cursor:text; box-sizing:border-box; -moz-box-sizing:border-box;background-color:transparent; background-position:right; background-repeat:no-repeat;" onclick="BXEditProperty(<?=$propertyIndex?>)" onmouseover="this.style.borderColor = '#434B50 #ADC0CF #ADC0CF #434B50'" onmouseout="this.style.borderColor = 'white'" class="edit-field"><?=htmlspecialcharsEx($propertyValue)?></div>
267
268 <div id="bx_edit_property_<?=$propertyIndex?>" style="display:none;"></div>
269
270 </td>
271 </tr>
272
274
275<?foreach ($arDirProperties as $propertyCode => $propertyValue):?>
276
277 <tr id="bx_user_property_<?=$propertyIndex?>">
278 <td class="bx-popup-label bx-width30"><?=htmlspecialcharsEx(mb_strtoupper($propertyCode))?><input type="hidden" name="PROPERTY[<?=$propertyIndex?>][CODE]" value="<?=htmlspecialcharsEx(mb_strtoupper($propertyCode))?>" />:</td>
279 <td><input type="text" name="PROPERTY[<?=$propertyIndex?>][VALUE]" value="<?=htmlspecialcharsEx($propertyValue)?>" style="width:90%;"></td>
280 </tr>
281
282<?
285$jsInheritPropIds .= "];"
286?>
287
288<?if (CModule::IncludeModule("search") && isset($tagPropertyCode)):?>
289
290 <tr class="empty">
291 <td colspan="2"><div class="empty"></div></td>
292 </tr>
293 <tr class="section">
294 <td colspan="2">
295 <table cellspacing="0">
296 <tr>
297 <td><?=GetMessage("PAGE_PROP_TAGS_NAME")?></td>
298 <td id="bx_page_tags">&nbsp;</td>
299 </tr>
300 </table>
301 </td>
302 </tr>
303
304 <tr>
305 <td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_PROP_TAGS")?>:</td>
306 <td><?=InputTags("TAGS", $tagPropertyValue, array($site), 'style="width:90%;"');?></td>
307 </tr>
308<?endif?>
309
310</table>
311<input type="hidden" name="save" value="Y" />
312<?
313$popupWindow->EndContent();
314$popupWindow->ShowStandardButtons();
315?>
316
317<script>
318window.BXBlurProperty = function(element, propertyIndex)
319{
320 var viewProperty = document.getElementById("bx_view_property_" + propertyIndex);
321
322 if (element.value == "" || element.value == viewProperty.innerHTML)
323 {
324 var editProperty = document.getElementById("bx_edit_property_" + propertyIndex);
325
326 viewProperty.style.display = "block";
327 editProperty.style.display = "none";
328
329 while (editProperty.firstChild)
330 editProperty.removeChild(editProperty.firstChild);
331 }
332}
333
334window.BXEditProperty = function(propertyIndex)
335{
336 if (document.getElementById("bx_property_input_" + propertyIndex))
337 return;
338
339 var editProperty = document.getElementById("bx_edit_property_" + propertyIndex);
340 var viewProperty = document.getElementById("bx_view_property_" + propertyIndex);
341
342 viewProperty.style.display = "none";
343 editProperty.style.display = "block";
344
345 var input = document.createElement("INPUT");
346
347 input.type = "text";
348 input.name = "PROPERTY["+propertyIndex+"][VALUE]";
349 input.style.width = "90%";
350 input.style.padding = "2px";
351 input.id = "bx_property_input_" + propertyIndex;
352 input.onblur = function () {BXBlurProperty(input,propertyIndex)};
353 input.value = viewProperty.innerHTML;
354
355 editProperty.appendChild(input);
356 input.focus();
357 input.select();
358
359}
360
361window.BXFolderEditHint = function()
362{
363 var td = document.getElementById("bx_page_prop_name");
364 if (td)
365 {
366 oBXHint = new BXHint("<?=GetMessage("PAGE_PROP_DESCIPTION")?>");
367 td.appendChild(oBXHint.oIcon);
368 }
369
370 var td = document.getElementById("bx_page_tags");
371 if (td)
372 {
373 oBXHint = new BXHint("<?=GetMessage("PAGE_PROP_TAGS_DESCIPTION")?>");
374 td.appendChild(oBXHint.oIcon);
375 }
376
378
379 for (var index = 0; index < jsInheritProps.length; index++)
380 oBXHint = new BXHint("<?=GetMessage("PAGE_PROP_INHERIT_TITLE")?>", document.getElementById("bx_view_property_"+ jsInheritProps[index]), {"width":200});
381}
382
383window.BXFolderEditHint();
384
385</script>
386
387<?require($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/epilog_admin_js.php");?>
$path
Определения access_edit.php:21
$popupWindow
Определения access_edit.php:10
$back_url
Определения access_edit.php:50
global $APPLICATION
Определения include.php:80
if($canUseYandexMarket) $strWarning
Определения options.php:74
static GetInstance()
Определения virtual_io.php:60
static GetPropstypes($site="")
Определения fileman.php:2077
Определения jspopup.php:10
static ShowUndoMessage($ID)
Определения undo.php:187
static Add($params=array())
Определения undo.php:9
$f
Определения component_props.php:52
& nbsp
Определения epilog_main_admin.php:38
$absoluteFilePath
Определения file_delete.php:178
window BXBlurProperty
Определения file_new.php:1067
for($fileNumber="";; $fileNumber++) $pageTitle
Определения file_new.php:204
endif $jsInheritPropIds
Определения file_new.php:811
</td ></tr ></table ></td ></tr ><?endif?><? $propertyIndex=0;foreach( $arGlobalProperties as $propertyCode=> $propertyValue
Определения file_new.php:729
BXEditProperty(<?=$propertyIndex?>)" onmouseover $propertyIndex
Определения file_new.php:769
if($_SERVER $arFilemanProperties["REQUEST_METHOD"]=="POST" &&isset($_REQUEST["save"]) && $strWarning=="")
Определения file_new.php:504
$arGlobalProperties
Определения file_new.php:542
$arInheritProperties
Определения file_new.php:526
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_PROP_TAGS")?> array( $site)
Определения file_property.php:306
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_PROP_TAGS")?> $tagPropertyValue
Определения file_property.php:306
$fileContent
Определения file_property.php:47
$_REQUEST["admin_mnu_menu_id"]
Определения get_menu.php:8
$arDirProperties
$_SERVER["DOCUMENT_ROOT"]
Определения cron_frame.php:9
global $USER
Определения csv_new_run.php:40
$io
Определения csv_new_run.php:98
endif
Определения csv_new_setup.php:990
$success
Определения mail_entry.php:69
SetPrologProperty($prolog, $property_key, $property_val)
Определения admin_tools.php:415
SetPrologTitle($prolog, $title)
Определения admin_tools.php:374
foreach(['Bitrix\\Main'=> '/lib', 'Psr\\Container'=> '/vendor/psr/container/src', 'Psr\\Log'=> '/vendor/psr/log/src', 'Psr\\Http\\Message'=> '/vendor/psr/http-message/src', 'Psr\\Http\\Client'=> '/vendor/psr/http-client/src', 'Http\\Promise'=> '/vendor/php-http/promise/src', 'PHPMailer\\PHPMailer'=> '/vendor/phpmailer/phpmailer/src', 'GeoIp2'=> '/vendor/geoip2/geoip2/src', 'MaxMind\\Db'=> '/vendor/maxmind-db/reader/src/MaxMind/Db', 'PhpParser'=> '/vendor/nikic/php-parser/lib/PhpParser', 'Recurr'=> '/vendor/simshaun/recurr/src/Recurr',] as $namespace=> $namespacePath) $documentRoot
Определения autoload.php:27
if(!defined('SITE_ID')) $lang
Определения include.php:91
check_bitrix_sessid($varname='sessid')
Определения tools.php:4686
ParseFileContent($filesrc, $params=[])
Определения tools.php:4780
IsModuleInstalled($module_id)
Определения tools.php:5301
htmlspecialcharsEx($str)
Определения tools.php:2685
htmlspecialcharsbx($string, $flags=ENT_COMPAT, $doubleEncode=true)
Определения tools.php:2701
IncludeModuleLangFile($filepath, $lang=false, $bReturnArray=false)
Определения tools.php:3778
GetMessage($name, $aReplace=null)
Определения tools.php:3397
global_menu_<?echo $menu["menu_id"]?> adm main menu item icon adm main menu item text text adm main menu hover adm submenu menucontainer menu_id menu_id items_id items_id desktop menu_id block none adm global submenu<?=($subMenuDisplay=="block" ? " adm-global-submenu-active" :"")?> global_submenu_<?echo $menu["menu_id"]?> text MAIN_PR_ADMIN_FAV items adm submenu items wrap adm submenu items stretch wrap BX adminMenu itemsStretchScroll()"> <table class if (!empty( $menu["items"])) elseif ( $menu[ 'menu_id']=='desktop') if ( $menu[ 'menu_id']=='desktop') endforeach
Определения prolog_main_admin.php:255
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)
Определения prolog_main_admin.php:393
die
Определения quickway.php:367
font style
Определения invoice.php:442
InputTags($sName='', $sValue='', $arSites=[], $sHTML='', $sId='')
Определения tags.php:46
const SITE_ID
Определения sonet_set_content_view.php:12
$site
Определения yandex_run.php:614