forked from may-cat/maycat.d7dull
-
Notifications
You must be signed in to change notification settings - Fork 56
/
options.php
90 lines (80 loc) · 2.8 KB
/
options.php
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
<?php
use Bitrix\Main\Application;
use Bitrix\Main\Config\Option;
use Bitrix\Main\Localization\Loc;
use Bitrix\Main\Text\HtmlFilter;
defined('ADMIN_MODULE_NAME') or define('ADMIN_MODULE_NAME', 'bex.d7dull');
if (!$USER->isAdmin()) {
$APPLICATION->authForm('Nope');
}
$app = Application::getInstance();
$context = $app->getContext();
$request = $context->getRequest();
Loc::loadMessages($context->getServer()->getDocumentRoot()."/bitrix/modules/main/options.php");
Loc::loadMessages(__FILE__);
$tabControl = new CAdminTabControl("tabControl", array(
array(
"DIV" => "edit1",
"TAB" => Loc::getMessage("MAIN_TAB_SET"),
"TITLE" => Loc::getMessage("MAIN_TAB_TITLE_SET"),
),
));
if ((!empty($save) || !empty($restore)) && $request->isPost() && check_bitrix_sessid()) {
if (!empty($restore)) {
Option::delete(ADMIN_MODULE_NAME);
CAdminMessage::showMessage(array(
"MESSAGE" => Loc::getMessage("REFERENCES_OPTIONS_RESTORED"),
"TYPE" => "OK",
));
} elseif ($request->getPost('max_image_size') && ($request->getPost('max_image_size') > 0) && ($request->getPost('max_image_size') < 100000)) {
Option::set(
ADMIN_MODULE_NAME,
"max_image_size",
$request->getPost('max_image_size')
);
CAdminMessage::showMessage(array(
"MESSAGE" => Loc::getMessage("REFERENCES_OPTIONS_SAVED"),
"TYPE" => "OK",
));
} else {
CAdminMessage::showMessage(Loc::getMessage("REFERENCES_INVALID_VALUE"));
}
}
$tabControl->begin();
?>
<form method="post" action="<?=sprintf('%s?mid=%s&lang=%s', $request->getRequestedPage(), urlencode($mid), LANGUAGE_ID)?>">
<?php
echo bitrix_sessid_post();
$tabControl->beginNextTab();
?>
<tr>
<td width="40%">
<label for="max_image_size"><?=Loc::getMessage("REFERENCES_MAX_IMAGE_SIZE") ?>:</label>
<td width="60%">
<input type="text"
size="50"
maxlength="5"
name="max_image_size"
value="<?=HtmlFilter::encode(Option::get(ADMIN_MODULE_NAME, "max_image_size", 500));?>"
/>
</td>
</tr>
<?php
$tabControl->buttons();
?>
<input type="submit"
name="save"
value="<?=Loc::getMessage("MAIN_SAVE") ?>"
title="<?=Loc::getMessage("MAIN_OPT_SAVE_TITLE") ?>"
class="adm-btn-save"
/>
<input type="submit"
name="restore"
title="<?=Loc::getMessage("MAIN_HINT_RESTORE_DEFAULTS") ?>"
onclick="return confirm('<?= AddSlashes(GetMessage("MAIN_HINT_RESTORE_DEFAULTS_WARNING")) ?>')"
value="<?=Loc::getMessage("MAIN_RESTORE_DEFAULTS") ?>"
/>
<?php
$tabControl->end();
?>
</form>