-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoptions.php
More file actions
127 lines (113 loc) · 3.36 KB
/
options.php
File metadata and controls
127 lines (113 loc) · 3.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
<?php
use Bitrix\Main\Loader;
use Bitrix\Main\Config\Option;
use Bitrix\Main\Localization\Loc;
use Bitrix\Main\HttpApplication;
$module_id = "itscript.rest";
IncludeModuleLangFile($_SERVER['DOCUMENT_ROOT'].'/bitrix/modules/main/options.php');
IncludeModuleLangFile(__FILE__);
Loader::includeModule($module_id);
global $APPLICATION;
$request = HttpApplication::getInstance()->getContext()->getRequest();
$defaultOptions = Option::getDefaults($module_id);
$arMainPropsTab = [
"DIV" => "edit1",
"TAB" => Loc::getMessage("ITSCRIPT_REST_MAIN_TAB_SETTINGS"),
"TITLE" => Loc::getMessage("ITSCRIPT_REST_MAIN_TAB_SETTINGS_TITLE"),
"OPTIONS" => [
[
"ITSCRIPT_REST_ROOT_PATH",
Loc::getMessage("ITSCRIPT_REST_ROOT_PATH"),
$defaultOptions["ITSCRIPT_REST_ROOT_PATH"],
[
"text",
100
]
],
[
"ITSCRIPT_REST_ENCRYPTION_ALG",
Loc::getMessage("ITSCRIPT_REST_ENCRYPTION_ALG"),
$defaultOptions["ITSCRIPT_REST_ENCRYPTION_ALG"],
[
"selectbox",
['HS256' => 'HS256']
]
],
[
"ITSCRIPT_REST_SECRET_KEY",
Loc::getMessage("ITSCRIPT_REST_SECRET_KEY"),
$defaultOptions["ITSCRIPT_REST_SECRET_KEY"],
[
"text",
100
]
],
[
"ITSCRIPT_REST_JWT_LIFETIME",
Loc::getMessage("ITSCRIPT_REST_JWT_LIFETIME"),
$defaultOptions["ITSCRIPT_REST_JWT_LIFETIME"],
[
"text",
100
]
],
[
"ITSCRIPT_REST_JWT_ISS",
Loc::getMessage("ITSCRIPT_REST_JWT_ISS"),
$defaultOptions["ITSCRIPT_REST_JWT_ISS"],
[
"text",
100
]
],
[
"ITSCRIPT_REST_JWT_AUD",
Loc::getMessage("ITSCRIPT_REST_JWT_AUD"),
$defaultOptions["ITSCRIPT_REST_JWT_AUD"],
[
"text",
100
]
]
]
];
$aTabs = [
$arMainPropsTab,
[
"DIV" => "edit2",
"TAB" => Loc::getMessage("MAIN_TAB_RIGHTS"),
"TITLE" => Loc::getMessage("MAIN_TAB_TITLE_RIGHTS")
],
];
?>
<?php
//Save form
if ($request->isPost() && $request["save"] && check_bitrix_sessid()) {
foreach ($aTabs as $aTab) {
if (!empty($aTab['OPTIONS'])) {
__AdmSettingsSaveOptions($module_id, $aTab["OPTIONS"]);
}
}
}
?>
<!-- FORM TAB -->
<?php
$tabControl = new CAdminTabControl("tabControl", $aTabs);
?>
<?php $tabControl->Begin(); ?>
<form method="post" action="<?=$APPLICATION->GetCurPage();?>?mid=<?=htmlspecialcharsbx($request["mid"]);?>&lang=<?=LANGUAGE_ID?>" name="<?=$module_id;?>">
<?php $tabControl->BeginNextTab(); ?>
<?php
foreach ($aTabs as $aTab) {
if(is_array($aTab['OPTIONS'])) {
__AdmSettingsDrawList($module_id, $aTab['OPTIONS']);
$tabControl->BeginNextTab();
}
}
?>
<?php //require_once($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/admin/group_rights.php"); ?>
<?php $tabControl->Buttons(array('btnApply' => false, 'btnCancel' => false, 'btnSaveAndAdd' => false)); ?>
<?=bitrix_sessid_post();?>
</form>
<?php $tabControl->End(); ?>
<!-- X FORM TAB -->