1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
options.php
См. документацию.
1<?php
2$module_id = 'rest';
3
8
9if (!Loader::includeModule($module_id))
10{
11 return;
12}
13
14$context = Application::getInstance()->getContext();
15$request = $context->getRequest();
16$docRoot = $context->getServer()->getDocumentRoot();
17
18Loc::loadMessages($docRoot . BX_ROOT . "/modules/main/options.php");
19Loc::loadMessages(__FILE__);
20
21if ($APPLICATION->GetGroupRight($module_id) < "S")
22{
23 $APPLICATION->AuthForm(Loc::getMessage("ACCESS_DENIED"));
24}
25
27 [
28 "DIV" => "edit1",
29 "TAB" => Loc::getMessage("REST_TAB_SET"),
30 "TITLE" => Loc::getMessage("REST_TAB_TITLE_SET"),
31 ],
32 [
33 "DIV" => "edit2",
34 "TAB" => Loc::getMessage("REST_TAB_LOG"),
35 "TITLE" => Loc::getMessage("REST_TAB_TITLE_LOG"),
36 ],
37];
38
39$tabControl = new CAdminTabControl("tabControl", $tabs);
40
41$backUrl = $request->get('back_url_settings');
43 'BLOCK_NEW_USER_LF_SITE' => 'N',
44);
46 [
47 'CODE' => 'enable_mod_zip',
48 'NAME' => Loc::getMessage('REST_OPT_ENABLE_MOD_ZIP') . ':',
49 'PARAMS' => [
50 'TYPE' => 'checkbox'
51 ]
52 ],
53 [
54 'CODE' => 'import_max_size',
55 'NAME' => Loc::getMessage('REST_OPT_MAX_IMPORT_SIZE') . ':',
56 'PARAMS' => [
57 'TYPE' => 'float',
58 'PRECISION' => 2,
59 'ABS' => 'Y'
60 ]
61 ],
62];
64 [
65 'CODE' => 'client_id',
66 'NAME' => Loc::getMessage('REST_OPT_LOG_FILTER_CLIENT_ID') . ' (client_id):',
67 'SIZE' => 45,
68 ],
69 [
70 'CODE' => 'password_id',
71 'NAME' => Loc::getMessage('REST_OPT_LOG_FILTER_PASSWORD_ID') . ' (password_id):',
72 'SIZE' => 45,
73 ],
74 [
75 'CODE' => 'scope',
76 'NAME' => Loc::getMessage('REST_OPT_LOG_FILTER_SCOPE') . ' (scope):',
77 'SIZE' => 12,
78 ],
79 [
80 'CODE' => 'method',
81 'NAME' => Loc::getMessage('REST_OPT_LOG_FILTER_METHOD') . ' (method):',
82 'SIZE' => 45,
83 ],
84 [
85 'CODE' => 'user_id',
86 'NAME' => Loc::getMessage('REST_OPT_LOG_FILTER_USER_ID') . ' (user_id):',
87 'SIZE' => 6,
88 ],
89];
90
91// post save
92if ($Apply.$RestoreDefaults <> '' && \check_bitrix_sessid())
93{
95 {
96 include_once('default_option.php');
97 if (is_array($rest_default_option))
98 {
99 foreach ($rest_default_option as $option => $value)
100 {
101 \COption::setOptionString($module_id, $option, $value);
102 }
103 }
104 }
105 else
106 {
107 foreach ($allOptions as $option)
108 {
109 if ($option[0] == 'header')
110 {
111 continue;
112 }
113
114 $code = $option['CODE'];
115 $val = ${$code};
116 $val = trim($val);
117
118 switch ($option['PARAMS']['TYPE']):
119 case 'checkbox':
120 if ($val <> 'Y')
121 {
122 $val = 'N';
123 }
124 break;
125 case 'float':
126 $precision = $option['PARAMS']['PRECISION'] ? : 0;
127 $val = round($val, $precision);
128 break;
129 endswitch;
130
131 if($option['PARAMS']['ABS'] && $option['PARAMS']['ABS'] == 'Y')
132 {
133 $val = abs($val);
134 }
135
136 \COption::setOptionString($module_id, $code, $val);
137 }
138
139 if ($_REQUEST["clear_data"] === "y")
140 {
142 }
143
144 if (array_key_exists('ACTIVE', $_REQUEST))
145 {
146 $ACTIVE = intval($_REQUEST['ACTIVE']);
147 if ($ACTIVE > 0 && $ACTIVE <= 86400)
148 {
149 LoggerManager::getInstance()->setEndTimeLogging(time() + $ACTIVE);
150 LoggerManager::getInstance()->setLevel('info');
151 LoggerManager::getInstance()->setType('db');
152 }
153 else
154 {
155 LoggerManager::getInstance()->deactivate();
156 }
157 }
158
159 $filters = array();
160 foreach ($filterOptions as $option)
161 {
162 $val = trim($_REQUEST["log_filters"][$option["CODE"]]);
163 if ($val)
164 {
165 $filters[$option["CODE"]] = $val;
166 }
167 }
168
169 LoggerManager::getInstance()->setFilterOptions($filters);
170 }
171
173 $APPLICATION->GetCurPage() .
174 '?mid=' . urlencode($mid) .
175 '&lang=' . urlencode(LANGUAGE_ID) .
176 '&back_url_settings=' . urlencode($backUrl) .
177 '&' . $tabControl->ActiveTabParam());
178}
179
180$tabControl->Begin();
181?>
182<form method="post" name="intr_opt_form" action="<? echo $APPLICATION->GetCurPage() ?>?mid=<?=urlencode($mid)?>&amp;lang=<? echo LANGUAGE_ID ?>">
183 <? echo bitrix_sessid_post(); ?>
184 <?
185 $tabControl->BeginNextTab();
186 ?>
187 <? foreach($allOptions as $option): ?>
188 <? if ($option['CODE'] == 'header'):?>
189 <tr class="heading">
190 <td colspan="2">
191 <?= $option['NAME'];?>
192 </td>
193 </tr>
194 <?if (isset($option['PARAMS'])):?>
195 <tr>
196 <td></td>
197 <td>
198 <?
199 echo BeginNote();
200 echo $option['PARAMS'];
201 echo EndNote();
202 ?>
203 </td>
204 </tr>
205 <?endif;?>
206 <? continue;
207 endif;
208 ?>
209 <?
210 $params = $option['PARAMS'];
211 $val = \COption::getOptionString(
213 $option['CODE'],
214 isset($option['DEFAULT']) ? $option['DEFAULT'] : null
215 );
216 ?>
217 <tr>
218 <td valign="top" width="40%"><?
219 if ($params['TYPE'] == 'checkbox')
220 {
221 echo '<label for="' . \htmlspecialcharsbx($option['CODE']) . '">'.$option['NAME'].'</label>';
222 }
223 else
224 {
225 echo $option['NAME'];
226 }
227 ?></td>
228 <td valign="middle" width="60%">
229 <? if ($params['TYPE'] == 'checkbox'): ?>
230 <input
231 type="checkbox"
232 name="<?=\htmlspecialcharsbx($option['CODE'])?>"
233 id="<?=\htmlspecialcharsbx($option['CODE'])?>"
234 value="Y"
235 <?=($val == 'Y') ? 'checked="checked" ' : '';?>
236 />
237 <? else: ?>
238 <input
239 type="text"
240 size="<?=$params['SIZE']?>"
241 maxlength="255"
242 value="<?=\htmlspecialcharsbx($val)?>"
243 name="<?=\htmlspecialcharsbx($option['CODE'])?>"
244 />
245 <? endif;?>
246 </td>
247 </tr>
248 <?
250 $tabControl->BeginNextTab();
251 $ACTIVE = \COption::GetOptionInt('rest', 'log_end_time', 0) >= time();
252 ?>
253 <tr>
254 <td valign="top" width="40%">
255 <? echo GetMessage("REST_OPT_ACTIVE") ?>:
256 </td>
257 <td valign="middle" width="60%">
258 <? if ($ACTIVE): ?>
259 <? echo GetMessage("REST_OPT_ACTIVE_Y") ?>
260 <? else: ?>
261 <? echo GetMessage("REST_OPT_ACTIVE_N") ?>
262 <? endif; ?>
263 </td>
264 </tr>
265 <? if ($ACTIVE): ?>
266 <tr>
267 <td valign="top" width="40%">
268 <? echo GetMessage("REST_OPT_ACTIVE_TO") ?>:
269 </td>
270 <td valign="top" width="60%">
271 <?
272 $interval = max(0, COption::GetOptionInt("rest", "log_end_time") - time());
273 $hours = sprintf("%02d", intval($interval / 3600));
274 $interval -= $hours * 3600;
275 $minutes = sprintf("%02d", intval($interval / 60));
276 $interval -= $minutes * 60;
277 $seconds = sprintf("%02d", intval($interval));
278 echo GetMessage("REST_OPT_MINUTES", array("#HOURS#" => $hours, "#MINUTES#" => $minutes, "#SECONDS#" => $seconds));
279 ?>
280 </td>
281 </tr>
282 <tr>
283 <td valign="top" width="40%">
284 <label for="ACTIVE_CKBOX"><? echo GetMessage("REST_OPT_SET_IN_ACTIVE") ?></label>:
285 </td>
286 <td valign="top" width="60%">
287 <input type="checkbox" name="ACTIVE" value="0" id="ACTIVE_CKBOX">
288 </td>
289 </tr>
290 <? else: ?>
291 <tr>
292 <td valign="top" width="40%">
293 <? echo GetMessage("REST_OPT_SET_ACTIVE") ?>:
294 </td>
295 <td valign="top" width="60%">
296 <select name="ACTIVE" id="ACTIVE_LIST">
297 <option value="0"><? echo GetMessage("REST_OPT_INTERVAL_NO") ?></option>
298 <option value="600"><? echo GetMessage("REST_OPT_INTERVAL_600_SEC") ?></option>
299 <option value="3600"><? echo GetMessage("REST_OPT_INTERVAL_3600_SEC") ?></option>
300 <option value="86400"><? echo GetMessage("REST_OPT_INTERVAL_24_HOURS") ?></option>
301 </select>
302 </td>
303 <tr>
304 <td valign="top" width="40%">
305 <label for="clear_data"><? echo GetMessage("REST_OPT_CLEAR_DATA") ?>:</label>
306 </td>
307 <td valign="top" width="60%">
308 <input type="checkbox" name="clear_data" id="clear_data" value="y">
309 </td>
310 </tr>
311 </tr>
312 <?endif;?>
313 <?if (IsModuleInstalled('perfmon')): ?>
314 <tr>
315 <td valign="top" width="40%">
316 <? echo GetMessage("REST_OPT_LOG_RECS_COUNT") ?>:
317 </td>
318 <td valign="top" width="60%">
319 <a href="<? echo htmlspecialcharsbx("/bitrix/admin/perfmon_table.php?lang=".LANGUAGE_ID."&table_name=b_rest_log&by=ID&order=desc") ?>"><? echo \Bitrix\Rest\LogTable::getCountAll(); ?></a>
320 </td>
321 </tr>
322 <? endif; ?>
323 <tr class="heading">
324 <td colspan="2"><?=GetMessage("REST_OPT_LOG_FILTERS")?></td>
325 </tr>
326 <? foreach($filterOptions as $option):
327 $filters = @unserialize(
328 \Bitrix\Main\Config\Option::get('rest', 'log_filters', ''),
329 [
330 'allowed_classes' => false
331 ]
332 );
333 if (!is_array($filters))
334 {
335 $filters = array();
336 }
337 ?>
338 <tr>
339 <td width="40%">
340 <label for="<? echo htmlspecialcharsbx($option['CODE']) ?>"><? echo $option["NAME"] ?></label>
341 </td>
342 <td valign="middle" width="60%">
343 <input
344 type="text"
345 size="<?=$option['SIZE']?>"
346 maxlength="255"
347 value="<?=\htmlspecialcharsbx($filters[$option["CODE"]])?>"
348 name="<?=\htmlspecialcharsbx("log_filters[".$option['CODE']."]")?>"
349 id="<?=\htmlspecialcharsbx($option['CODE'])?>"
350 />
351 </td>
352 </tr>
353 <? endforeach; ?>
354 <? $tabControl->Buttons(); ?>
355 <?=bitrix_sessid_post();?>
356 <input type="submit" name="Apply" value="<?=GetMessage("MAIN_APPLY")?>" title="<?=GetMessage("MAIN_OPT_APPLY_TITLE")?>">
357 <input type="button" title="<?echo GetMessage("MAIN_HINT_RESTORE_DEFAULTS")?>" OnClick="RestoreDefaults();" value="<?echo GetMessage("MAIN_RESTORE_DEFAULTS")?>">
358
359 <? if ($backUrl <> ''): ?>
360 <input
361 type="button"
362 name="Cancel"
363 value="<?=Loc::getMessage('MAIN_OPT_CANCEL')?>"
364 title="<?=Loc::getMessage('MAIN_OPT_CANCEL_TITLE')?>"
365 onclick="window.location='<?=\htmlspecialcharsbx(CUtil::addslashes($backUrl)) ?>'"/>
366 <input type="hidden" name="back_url_settings" value="<?=\htmlspecialcharsbx($backUrl)?>"/>
367 <? endif ?>
368 <? $tabControl->End(); ?>
369</form>
370<script>
371 function RestoreDefaults()
372 {
373 if(confirm('<?echo AddSlashes(GetMessage("MAIN_HINT_RESTORE_DEFAULTS_WARNING"))?>'))
374 window.location = "<?echo $APPLICATION->GetCurPage()?>?RestoreDefaults=Y&lang=<?=LANGUAGE_ID?>&mid=<?echo urlencode($mid)?>&<?echo bitrix_sessid_get()?>";
375 }
376</script>
return select
Определения access_edit.php:440
const BX_ROOT
Определения bx_root.php:3
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
Определения loader.php:13
static clearAll()
Определения log.php:118
$tabs
Определения options.php:101
$hours
Определения cron_html_pages.php:15
bx popup label bx width30 PAGE_NEW_MENU_NAME text width
Определения file_new.php:677
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
EndNote()
Определения filter_tools.php:601
BeginNote($sParams='', $sMessParams='')
Определения filter_tools.php:589
$_REQUEST["admin_mnu_menu_id"]
Определения get_menu.php:8
if($request->getPost('Update') !==null) elseif( $request->getPost( 'Apply') !==null) elseif($request->getPost('RestoreDefaults') !==null) $backUrl
Определения options.php:66
if(CIMConvert::ConvertCount() > 0) $arDefaultValues['default']
Определения options.php:26
$Apply
Определения options.php:213
$docRoot
Определения options.php:20
while($row=$res->fetch()) $allOptions[]
Определения options.php:111
$RestoreDefaults
Определения options.php:55
$tabControl
Определения csv_new_setup.php:244
$context
Определения csv_new_setup.php:223
endif
Определения csv_new_setup.php:990
if(!is_null($config))($config as $configItem)(! $configItem->isVisible()) $code
Определения options.php:195
$mid
Определения options.php:27
bitrix_sessid_post($varname='sessid', $returnInvocations=false)
Определения tools.php:4700
check_bitrix_sessid($varname='sessid')
Определения tools.php:4686
IsModuleInstalled($module_id)
Определения tools.php:5301
htmlspecialcharsbx($string, $flags=ENT_COMPAT, $doubleEncode=true)
Определения tools.php:2701
GetMessage($name, $aReplace=null)
Определения tools.php:3397
LocalRedirect($url, $skip_security_check=false, $status="302 Found")
Определения tools.php:4005
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
<? endif;?> window document title
Определения prolog_main_admin.php:76
$rest_default_option
Определения default_option.php:2
$filterOptions
Определения options.php:63
$backUrl
Определения options.php:41
$val
Определения options.php:211
lang
Определения options.php:182
font size
Определения invoice.php:442
if($inWords) echo htmlspecialcharsbx(Number2Word_Rus(roundEx($totalVatSum $params['CURRENCY']
Определения template.php:799
$precision
Определения template.php:403
$option
Определения options.php:1711
$val
Определения options.php:1793