This repository was archived by the owner on Jan 30, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathoptions.php
More file actions
87 lines (76 loc) · 3.29 KB
/
options.php
File metadata and controls
87 lines (76 loc) · 3.29 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
<?
use \Bitrix\Main\Config\Option;
use Bitrix\Main\Localization\Loc;
$strRights = $APPLICATION->GetGroupRight('main');
if ($strRights > 'R') {
Loc::loadMessages($_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/main/options.php');
Loc::loadMessages(__FILE__);
\Bitrix\Main\Loader::includeModule('uniplug.metacaptcha');
$obMetaCaptcha = \UniPlug\MetaCaptcha::getInstance();
$arMess = array();
$boolError = false;
if ($_SERVER['REQUEST_METHOD'] == 'POST' && !empty($_POST['save']) && check_bitrix_sessid()) {
if( $obMetaCaptcha->setBackend($_POST["BACKEND"]) ) {
Option::set($obMetaCaptcha::MODULE_ID, 'backend', $_POST["BACKEND"]);
$arMess[] = Loc::getMessage("UNIPLUG_METACAPTCHA_MESS_SET_BACKEND_SUCCESS");
} else {
$arMess[] = Loc::getMessage("UNIPLUG_METACAPTCHA_MESS_SET_BACKEND_ERROR");
$boolError = true;
}
} elseif ($_SERVER['REQUEST_METHOD'] == 'GET' && !empty($_REQUEST['RestoreDefaults']) && check_bitrix_sessid()) {
Option::set($obMetaCaptcha::MODULE_ID, 'backend', $obMetaCaptcha::BACKEND_DEFAULT);
$arMess[] = Loc::getMessage('UNIPLUG_METACAPTCHA_MESS_RESET');
}
if (!empty($arMess)) {
CAdminMessage::ShowMessage(array(
'DETAILS' => (!empty($arMess) ? implode('<br />', $arMess) : ''),
'HTML' => true,
'TYPE' => ($boolError ? 'ERROR' : 'OK'),
));
}
$aTabs = array(
array('DIV' => 'edit1', 'TAB' => Loc::getMessage('UNIPLUG_METACAPTCHA_SETTINGS'), 'ICON' => '', 'TITLE' => Loc::getMessage('UNIPLUG_METACAPTCHA_SETTINGS')),
);
$tabControl = new CAdminTabControl('tabControl', $aTabs, true, true);
$tabControl->Begin();
$backend = Option::get($obMetaCaptcha::MODULE_ID, 'backend', $obMetaCaptcha::BACKEND_DEFAULT);
?>
<form method="post" action="<?= $APPLICATION->GetCurPage() ?>?lang=<?= LANGUAGE_ID ?>&mid=<?= htmlspecialcharsbx($mid) ?>&mid_menu=1">
<?= bitrix_sessid_post(); ?>
<? $tabControl->BeginNextTab(); ?>
<? foreach($obMetaCaptcha->getList() as $arBackend): ?>
<tr>
<td width="5%">
<input type="radio" name="BACKEND" value="<?= $arBackend["CLASS"]?>" id="id-<?= md5($arBackend["CLASS"])?>" <?= $backend == $arBackend["CLASS"] ? 'checked="checked"' : ''?>/>
</td>
<td width="30%">
<label for="id-<?= md5($arBackend["CLASS"])?>"><?= $arBackend["TITLE"] ?></label>:
</td>
<td width="60%">
<?= $arBackend["DESCRIPTION"] ?>
</td>
<td width="10%">
<? if ( !empty($arBackend["CONFIG_URL"]) ): ?>
<a href="<?= $arBackend["CONFIG_URL"] ?>"><?= Loc::getMessage('UNIPLUG_METACAPTCHA_SETTINGS')?></a>
<? endif ?>
</td>
</tr>
<? endforeach ?>
<?
$tabControl->Buttons();
?>
<script type="text/javascript">
function RestoreDefaults() {
if (confirm('<?= GetMessageJS('MAIN_HINT_RESTORE_DEFAULTS_WARNING') ?>'))
window.location = "<?= $APPLICATION->GetCurPage() ?>?RestoreDefaults=Y&lang=<?= LANGUAGE_ID ?>&mid=<?= urlencode($mid) ?>&<?= bitrix_sessid_get() ?>";
}
</script>
<input type="submit" class="adm-btn-save" name="update" value="<?= Loc::getMessage('MAIN_SAVE') ?>">
<input type="hidden" name="save" value="Y">
<input type="reset" name="reset" value="<?= Loc::getMessage('MAIN_RESET')?>">
<input type="button" title="<?= Loc::getMessage('MAIN_HINT_RESTORE_DEFAULTS') ?>" onclick="RestoreDefaults();" value="<?= Loc::getMessage("MAIN_RESTORE_DEFAULTS") ?>">
</form>
<?
$tabControl->End();
}
?>