1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
options.php
См. документацию.
1<?php
2$module_id = 'landing';
3
4use \Bitrix\Landing\Manager;
5use \Bitrix\Main\Localization\Loc;
6use \Bitrix\Main\SiteTemplateTable;
7
8if (!\Bitrix\Main\Loader::includeModule('landing'))
9{
10 return;
11}
12
14
15// vars
17$request = $context->getRequest();
18$mid = $request->get('mid');
19$backUrl = $request->get('back_url_settings');
20$docRoot = Manager::getDocRoot();
22
23// lang
24IncludeModuleLangFile($docRoot . '/bitrix/modules/main/options.php');
25Loc::loadMessages(__FILE__);
26
27// local function for build iblocks tree
28$getIblocksTree = function()
29{
30 static $iblocks = null;
31
32 if ($iblocks !== null)
33 {
34 return $iblocks;
35 }
36
37 $iblocks = [];
38 if (\Bitrix\Main\Loader::includeModule('iblock'))
39 {
40 // first gets types
41 $iblockTypes = [];
42 $res = \CIBlockType::getList();
43 while($row = $res->fetch())
44 {
45 if ($typeLang = \CIBlockType::getByIDLang($row['ID'], LANG))
46 {
47 $iblockTypes[$typeLang['IBLOCK_TYPE_ID']] = [
48 'NAME' => $typeLang['NAME'],
49 'SORT' => $typeLang['SORT']
50 ];
51 }
52 }
53
54 // and iblocks then
55 $res = \CIBlock::getList(['sort' => 'asc']);
56 while ($row = $res->GetNext(true, false))
57 {
58 if (!isset($iblocks[$row['IBLOCK_TYPE_ID']]))
59 {
60 $iblocks[$row['IBLOCK_TYPE_ID']] = [
61 'ID' => $row['IBLOCK_TYPE_ID'],
62 'NAME' => $iblockTypes[$row['IBLOCK_TYPE_ID']]['NAME'],
63 'SORT' => $iblockTypes[$row['IBLOCK_TYPE_ID']]['SORT'],
64 'ITEMS' => []
65 ];
66 }
67 $iblocks[$row['IBLOCK_TYPE_ID']]['ITEMS'][] = [
68 'ID' => $row['ID'],
69 'NAME' => $row['NAME']
70 ];
71 }
72
73 // sorting by sort
74 usort($iblocks,
75 function($a, $b)
76 {
77 if ($a['SORT'] == $b['SORT'])
78 {
79 return 0;
80 }
81 return ($a['SORT'] < $b['SORT']) ? -1 : 1;
82 }
83 );
84
85 return $iblocks;
86 }
87};
88
89if ($postRight >= 'R'):
90
91 // sites list
92 $sites = [];
94 'select' => array(
95 '*'
96 ),
97 'filter' => array(
98 'ACTIVE' => 'Y'
99 ),
100 'order' => array(
101 'SORT' => 'ASC'
102 )
103 ));
104 while ($row = $res->fetch())
105 {
106 $row['NAME'] = \htmlspecialcharsbx($row['NAME']);
107 $sites[] = $row;
108 }
109
110 // site templates
112 'site_template_id',
113 Loc::getMessage('LANDING_OPT_SITE_TEMPLATE_ID') . ':',
114 array('text', 32)
115 );
116 $allOptions[] = array(
117 'header',
118 Loc::getMessage('LANDING_OPT_SITE_TEMPLATE_ID_SITES')
119 );
120 foreach ($sites as $row)
121 {
122 $allOptions[] = array(
123 'site_template_id_' . $row['LID'],
124 $row['NAME'] . ' [' . $row['LID'] . ']:',
125 array('text', 32)
126 );
127 }
128
129 // paths for sites
130 $allOptions[] = array(
131 'header',
132 Loc::getMessage('LANDING_OPT_PUB_PATH_HEADER'),
133 Loc::getMessage('LANDING_OPT_PUB_PATH_HELP')
134 );
135 foreach ($sites as $row)
136 {
137 $allOptions[] = array(
138 'pub_path_' . $row['LID'],
139 $row['NAME'] . ' [' . $row['LID'] . ']:',
140 array('text', 32),
141 \Bitrix\Landing\Manager::getPublicationPathConst()
142 );
143 }
144
145 // other options
146 $allOptions[] = array(
147 'header',
148 Loc::getMessage('LANDING_OPT_OTHER')
149 );
150 if (Manager::isB24())
151 {
152 $allOptions[] = array(
153 'google_images_key',
154 Loc::getMessage('LANDING_OPT_GOOGLE_IMAGES_KEY') . ':',
155 array('text', 32),
156 );
157 $allOptions[] = array(
158 'portal_url',
159 Loc::getMessage('LANDING_OPT_PORTAL_URL') . ' (host[:port]):',
160 array('text', 32)
161 );
162 }
163 $allOptions[] = array(
164 'deleted_lifetime_days',
165 Loc::getMessage('LANDING_OPT_DELETED_LIFETIME_DAYS') . ':',
166 array('text', 4)
167 );
168 $allOptions[] = [
169 'history_lifetime_days',
170 Loc::getMessage('LANDING_OPT_HISTORY_LIFETIME') . ':',
171 ['text', 4]
172 ];
173 if (Manager::isB24())
174 {
175 $allOptions[] = array(
176 'rights_extended_mode',
177 Loc::getMessage('LANDING_OPT_RIGHTS_EXTENDED_MODE') . ':',
178 array('checkbox')
179 );
180 }
181 $allOptions[] = array(
182 'public_hook_on_save',
183 Loc::getMessage('LANDING_OPT_PUBLIC_HOOK_ON_SAVE') . ':',
184 array('checkbox')
185 );
186 $allOptions[] = array(
187 'allow_svg_content',
188 Loc::getMessage('LANDING_OPT_ALLOW_SVG_CONTENT') . ':',
189 array('checkbox')
190 );
191 /*$allOptions[] = array(
192 'strict_verification_update',
193 Loc::getMessage('LANDING_OPT_STRICT_VERIFICATION_UPDATE') . ':',
194 array('checkbox')
195 );*/
196 $allOptions[] = array(
197 'source_iblocks',
198 Loc::getMessage('LANDING_OPT_SOURCE_IBLOCKS') . ':',
199 array(
200 'selectboxtree',
202 'multiple="multiple" size="10"'
203 )
204 );
205
206 // tabs
207 $tabControl = new \CAdmintabControl('tabControl', array(
208 array('DIV' => 'edit1', 'TAB' => Loc::getMessage('MAIN_TAB_SET'), 'ICON' => ''),
209 array('DIV' => 'edit2', 'TAB' => Loc::getMessage('MAIN_TAB_RIGHTS'), 'ICON' => '')
210 ));
211
213 $Apply = $Apply ?? '';
214
215 // post save
216 if (
217 $Update . $Apply <> '' &&
218 ($postRight=='W' || $postRight=='X') &&
220 )
221 {
222 foreach ($allOptions as $arOption)
223 {
224 if ($arOption[0] == 'header')
225 {
226 continue;
227 }
228 $name = $arOption[0];
229 if ($arOption[2][0] == 'text-list')
230 {
231 $val = '';
232 for ($j = 0; $j < count($$name); $j++)
233 {
234 if (trim(${$name}[$j]) <> '')
235 {
236 $val .= ($val <> '' ? ',':'') . trim(${$name}[$j]);
237 }
238 }
239 }
240 elseif ($arOption[2][0] == 'doubletext')
241 {
242 $val = ${$name.'_1'} . 'x' . ${$name.'_2'};
243 }
244 elseif (
245 $arOption[2][0] == 'selectbox' ||
246 $arOption[2][0] == 'selectboxtree'
247 )
248 {
249 $val = '';
250 if (isset($$name))
251 {
252 for ($j=0; $j<count($$name); $j++)
253 {
254 if (trim(${$name}[$j]) <> '')
255 {
256 $val .= ($val <> '' ? ',':'') . trim(${$name}[$j]);
257 }
258 }
259 }
260 }
261 else
262 {
263 $val = $$name ?? '';
264 }
265
266 if ($arOption[2][0] == 'checkbox' && $val<>'Y')
267 {
268 $val = 'N';
269 }
270
271 $val = trim($val);
272
273 // set new references site <> templates
274 $prefix = 'site_template_id_';
275 if ($arOption[0] == 'site_template_id')// base template
276 {
277 $valOld = trim(\COption::getOptionString(
279 'site_template_id'
280 ));
281 if (!$val)
282 {
283 $val = $valOld;
284 }
285 if ($valOld != $val)
286 {
287 $res = SiteTemplateTable::getList(array(
288 'filter' => array(
289 '=TEMPLATE' => $valOld
290 )
291 ));
292 while ($row = $res->fetch())
293 {
294 SiteTemplateTable::update($row['ID'], [
295 'TEMPLATE' => $val
296 ]
297 );
298 }
299 }
300 }
301 elseif (strpos($arOption[0], $prefix) === 0)// individual templates
302 {
303 $valDefault = trim(\COption::getOptionString(
305 'site_template_id'
306 ));
307 $valOld = \COption::getOptionString(
309 $arOption[0]
310 );
311 if ($valOld != $val)
312 {
313 $siteId = substr($arOption[0], strlen($prefix));
314 $res = SiteTemplateTable::getList(array(
315 'filter' => array(
316 '=SITE_ID' => $siteId,
317 '=TEMPLATE' => $valOld ? $valOld : $valDefault
318 )
319 ));
320 while ($row = $res->fetch())
321 {
322 SiteTemplateTable::update($row['ID'], [
323 'TEMPLATE' => $val ? $val : $valDefault
324 ]
325 );
326 }
327 }
328 }
329 elseif (!$val && strpos($name, 'pub_path_') === 0)
330 {
331 $val = '/';
332 }
333
334 \COption::setOptionString($module_id, $name, $val);
335 }
336
338
339 // access settings save
340 ob_start();
341 require_once($docRoot . '/bitrix/modules/main/admin/group_rights.php');
342 ob_end_clean();
343
344 if ($Update <> '' && $backUrl <> '')
345 {
347 }
348 else
349 {
351 $APPLICATION->GetCurPage() .
352 '?mid=' . urlencode($mid) .
353 '&lang=' . urlencode(LANGUAGE_ID) .
354 '&back_url_settings=' . urlencode($backUrl) .
355 '&' . $tabControl->ActiveTabParam());
356 }
357 }
358
359 ?><form method="post" action="<?= $APPLICATION->GetCurPage()?>?mid=<?= urlencode($mid)?>&amp;lang=<?= LANGUAGE_ID?>"><?php
360 $tabControl->Begin();
361 $tabControl->BeginNextTab();
362 foreach($allOptions as $Option):
363 if ($Option[0] == 'header')
364 {
365 ?>
366 <tr class="heading">
367 <td colspan="2">
368 <?= $Option[1];?>
369 </td>
370 </tr>
371 <?php if (isset($Option[2])):?>
372 <tr>
373 <td></td>
374 <td>
375 <?php
376 echo BeginNote();
377 echo $Option[2];
378 echo EndNote();
379 ?>
380 </td>
381 </tr>
382 <?php
383 endif;
384 continue;
385 }
387 $val = \COption::getOptionString(
389 $Option[0],
390 isset($Option[3]) ? $Option[3] : null
391 );
392 ?>
393 <tr>
394 <td valign="top" width="40%"><?php
395 if ($type[0]=='checkbox')
396 {
397 echo '<label for="' . \htmlspecialcharsbx($Option[0]) . '">'.$Option[1].'</label>';
398 }
399 else
400 {
401 echo $Option[1];
402 }
403 ?></td>
404 <td valign="middle" width="60%"><?php
405 if ($type[0] == 'checkbox'):
406 ?><input type="checkbox" name="<?= \htmlspecialcharsbx($Option[0])?>" id="<?= \htmlspecialcharsbx($Option[0])?>" value="Y"<?php if($val == 'Y') echo ' checked="checked"';?> /><?php
407 elseif ($type[0] == 'text'):
408 ?><input type="text" size="<?= $type[1]?>" maxlength="255" value="<?= \htmlspecialcharsbx($val)?>" name="<?= \htmlspecialcharsbx($Option[0])?>" /><?php
409 elseif ($type[0] == 'doubletext'):
410 list($val1, $val2) = explode('x', $val);
411 ?><input type="text" size="<?= $type[1]?>" maxlength="255" value="<?= \htmlspecialcharsbx($val1)?>" name="<?= \htmlspecialcharsbx($Option[0].'_1')?>" /><?php
412 ?><input type="text" size="<?= $type[1]?>" maxlength="255" value="<?= \htmlspecialcharsbx($val2)?>" name="<?= \htmlspecialcharsbx($Option[0].'_2')?>" /><?php
413 elseif ($type[0] == 'textarea'):
414 ?><textarea rows="<?= $type[1]?>" cols="<?= $type[2]?>" name="<?= \htmlspecialcharsbx($Option[0])?>"><?= \htmlspecialcharsbx($val)?></textarea><?php
415 elseif ($type[0] == 'text-list'):
416 $aVal = explode(",", $val);
417 for($j=0; $j<count($aVal); $j++):
418 ?><input type="text" size="<?= $type[2]?>" value="<?= \htmlspecialcharsbx($aVal[$j])?>" name="<?= \htmlspecialcharsbx($Option[0]).'[]'?>" /><br /><?php
419 endfor;
420 for($j=0; $j<$type[1]; $j++):
421 ?><input type="text" size="<?= $type[2]?>" value="" name="<?= \htmlspecialcharsbx($Option[0]).'[]'?>" /><br /><?php
422 endfor;
423 elseif ($type[0] == 'selectbox'):
424 $arr = $type[1];
425 $arr_keys = array_keys($arr);
426 $currValue = explode(',', $val);
427 ?><select name="<?= \htmlspecialcharsbx($Option[0])?>[]"<?= $type[2]?>><?php
428 for($j = 0; $j < count($arr_keys); $j++):
429 ?><option value="<?= $arr_keys[$j]?>"<?php if(in_array($arr_keys[$j], $currValue))echo ' selected="selected"'?>><?= \htmlspecialcharsbx($arr[$arr_keys[$j]])?></option><?php
430 endfor;
431 ?></select><?php
432 elseif ($type[0] == 'selectboxtree'):
433 $arr = $type[1];
434 $currValue = explode(',', $val);
435
436 $output = '<select name="'.\htmlspecialcharsbx($Option[0]).'[]"'.$type[2].'>';
437 $output .= '<option></option>';
438 foreach ($getIblocksTree() as $rowType)
439 {
440 $strIBlocksCpGr = '';
441 foreach ($rowType['ITEMS'] as $rowIb)
442 {
443 if (in_array($rowIb['ID'], $currValue))
444 {
445 $sel = ' selected="selected"';
446 }
447 else
448 {
449 $sel = '';
450 }
451 $strIBlocksCpGr .= '<option value="' . $rowIb['ID'] . '"' . $sel . '>' .
452 $rowIb['NAME'] .
453 '</option>';
454 }
455 if ($strIBlocksCpGr != '')
456 {
457 $output .= '<optgroup label="'.$rowType['NAME'].'">';
458 $output .= $strIBlocksCpGr;
459 $output .= '</optgroup>';
460 }
461 }
462 $output .= '</select>';
463 echo $output;
465 echo $Option[4] ?? '';?>
466 </td>
467 <?php
469
470 // access tab
471 $tabControl->BeginNextTab();
472 require_once($docRoot . '/bitrix/modules/main/admin/group_rights.php');
473
474 $tabControl->Buttons();
475 ?>
476 <input <?php if ($postRight < 'W') echo 'disabled="disabled"' ?> type="submit" name="Update" value="<?= Loc::getMessage('MAIN_SAVE')?>" title="<?= Loc::getMessage('MAIN_OPT_SAVE_TITLE')?>" />
477 <input <?php if ($postRight < 'W') echo 'disabled="disabled"' ?> type="submit" name="Apply" value="<?= Loc::getMessage('MAIN_OPT_APPLY')?>" title="<?= Loc::getMessage('MAIN_OPT_APPLY_TITLE')?>" />
478 <?php if ($backUrl <> ''):?>
479 <input <?php if ($postRight < 'W') echo 'disabled="disabled"' ?> type="button" name="Cancel" value="<?= Loc::getMessage('MAIN_OPT_CANCEL')?>" title="<?= Loc::getMessage('MAIN_OPT_CANCEL_TITLE')?>" onclick="window.location='<?= \htmlspecialcharsbx(CUtil::addslashes($backUrl))?>'" />
480 <input type="hidden" name="back_url_settings" value="<?=\htmlspecialcharsbx($backUrl)?>" />
481 <?php endif?>
482 <?=bitrix_sessid_post()?>
483 <?php $tabControl->End()?>
484 </form>
485
486<?php endif;
return select
Определения access_edit.php:440
$type
Определения options.php:106
global $APPLICATION
Определения include.php:80
$module_id
Определения options.php:6
if(!Loader::includeModule('catalog')) if(!AccessController::getCurrent() ->check(ActionDictionary::ACTION_PRICE_EDIT)) if(!check_bitrix_sessid()) $request
Определения catalog_reindex.php:36
static getInstance()
Определения application.php:98
static getList(array $parameters=array())
Определения datamanager.php:431
$sites
Определения clear_component_cache.php:15
bx popup label bx width30 PAGE_NEW_MENU_NAME text width
Определения file_new.php:677
$arr
Определения file_new.php:624
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$res
Определения filter_act.php:7
EndNote()
Определения filter_tools.php:601
BeginNote($sParams='', $sMessParams='')
Определения filter_tools.php:589
if($request->getPost('Update') !==null) elseif( $request->getPost( 'Apply') !==null) elseif($request->getPost('RestoreDefaults') !==null) $backUrl
Определения options.php:66
$output
Определения options.php:436
$Update
Определения options.php:212
$backUrl
Определения options.php:19
$postRight
Определения options.php:21
$getIblocksTree
Определения options.php:28
$Apply
Определения options.php:213
$docRoot
Определения options.php:20
$val
Определения options.php:387
for($j=0; $j< count($aVal); $j++) for( $j=0;$j< $type[1];$j++) elseif($type[0]=='selectbox') $arr_keys
Определения options.php:425
$currValue
Определения options.php:426
while($row=$res->fetch()) $allOptions[]
Определения options.php:111
$tabControl
Определения csv_new_setup.php:244
$context
Определения csv_new_setup.php:223
endif
Определения csv_new_setup.php:990
$mid
Определения options.php:27
$siteId
Определения ajax.php:8
bitrix_sessid_post($varname='sessid', $returnInvocations=false)
Определения tools.php:4700
check_bitrix_sessid($varname='sessid')
Определения tools.php:4686
htmlspecialcharsbx($string, $flags=ENT_COMPAT, $doubleEncode=true)
Определения tools.php:2701
IncludeModuleLangFile($filepath, $lang=false, $bReturnArray=false)
Определения tools.php:3778
LocalRedirect($url, $skip_security_check=false, $status="302 Found")
Определения tools.php:4005
$name
Определения menu_edit.php:35
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
<? endif;?> window document title
Определения prolog_main_admin.php:76
font size
Определения invoice.php:442
</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."%"
Определения waybill.php:936
endfor
Определения template.php:569
else $a
Определения template.php:137
$val
Определения options.php:1793
else $Option[0]
Определения options.php:387