From cb87d04b3ec00e0e0d98508e6373a22ea4668215 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Fri, 13 Jan 2023 13:36:48 -0500 Subject: [PATCH] Move api page content from options.php to _options_api.php --- web/skins/classic/views/_options_api.php | 98 ++++++++++++++++++++++++ web/skins/classic/views/options.php | 74 +----------------- 2 files changed, 99 insertions(+), 73 deletions(-) create mode 100644 web/skins/classic/views/_options_api.php diff --git a/web/skins/classic/views/_options_api.php b/web/skins/classic/views/_options_api.php new file mode 100644 index 000000000..6b975859d --- /dev/null +++ b/web/skins/classic/views/_options_api.php @@ -0,0 +1,98 @@ +APIs are disabled. To enable, please turn on OPT_USE_API in Options->System'; + return; +} +?> + +
+ + + +
+'.translate('AllTokensRevoked').''; + } + + function updateSelected() { + # Turn them all off, then selectively turn the checked ones back on + dbQuery('UPDATE `Users` SET `APIEnabled`=0'); + + if (isset($_REQUEST['tokenUids'])) { + $minTime = time(); + foreach ($_REQUEST['tokenUids'] as $markUid) { + dbQuery('UPDATE `Users` SET `TokenMinExpiry`=? WHERE `Id`=?', array($minTime, $markUid)); + } + } + if (isset($_REQUEST['apiUids'])) { + foreach ($_REQUEST['apiUids'] as $markUid) { + dbQuery('UPDATE `Users` SET `APIEnabled`=1 WHERE `Id`=?', array($markUid)); + } + } + echo ''.translate('Updated').''; + } + + if (array_key_exists('revokeAllTokens', $_POST)) { + revokeAllTokens(); + } + + if (array_key_exists('updateSelected', $_POST)) { + updateSelected(); + } +?> +

+ + + + + + + + + + + + +'Username']) as $u) { +?> + + + + + + + +
Username()) ?>APIEnabled()?'checked':''?> />
+
diff --git a/web/skins/classic/views/options.php b/web/skins/classic/views/options.php index 9b9db9a03..15e1382c8 100644 --- a/web/skins/classic/views/options.php +++ b/web/skins/classic/views/options.php @@ -332,79 +332,7 @@ foreach (array_map('basename', glob('skins/'.$skin.'/css/*', GLOB_ONLYDIR)) as $ APIs are disabled. To enable, please turn on OPT_USE_API in Options->System'; - } else { -?> - -
- - -
-'.translate('AllTokensRevoked').''; - } - - function updateSelected() { - # Turn them all off, then selectively turn the checked ones back on - dbQuery('UPDATE `Users` SET `APIEnabled`=0'); - - if (isset($_REQUEST['tokenUids'])) { - foreach ($_REQUEST['tokenUids'] as $markUid) { - $minTime = time(); - dbQuery('UPDATE `Users` SET `TokenMinExpiry`=? WHERE `Id`=?', array($minTime, $markUid)); - } - } - if (isset($_REQUEST['apiUids'])) { - foreach ($_REQUEST['apiUids'] as $markUid) { - dbQuery('UPDATE `Users` SET `APIEnabled`=1 WHERE `Id`=?', array($markUid)); - } - } - echo ''.translate('Updated').''; - } - - if (array_key_exists('revokeAllTokens', $_POST)) { - revokeAllTokens(); - } - - if (array_key_exists('updateSelected', $_POST)) { - updateSelected(); - } -?> -

- - - - - - - - - - - - - - - - - - - - -
/>
-
-