From 166f00c3a7013a9c2e62d32e1bb9d815b0de02d0 Mon Sep 17 00:00:00 2001 From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com> Date: Wed, 27 Jul 2022 18:14:29 +0800 Subject: [PATCH] show switch setting as select --- common.php | 155 ++++++++++++++++++++++++++++++----------------------- 1 file changed, 88 insertions(+), 67 deletions(-) diff --git a/common.php b/common.php index 19613c0..f7cd53f 100644 --- a/common.php +++ b/common.php @@ -6,65 +6,66 @@ global $drive; global $EnvConfigs; $EnvConfigs = [ + // 1 is a switch, 0 input string // 1 inner, 0 common // 1 showed/enableEdit, 0 hidden/disableEdit // 1 base64 to save, 0 not base64 - 'APIKey' => 0b000, // used in heroku. - 'SecretId' => 0b000, // used in SCF/CFC. - 'SecretKey' => 0b000, // used in SCF/CFC. - 'AccessKeyID' => 0b000, // used in FC. - 'AccessKeySecret' => 0b000, // used in FC. - 'HW_urn' => 0b000, // used in FG. - 'HW_key' => 0b000, // used in FG. - 'HW_secret' => 0b000, // used in FG. - 'HerokuappId' => 0b000, // used in heroku. + 'APIKey' => 0b0000, // used in heroku. + 'SecretId' => 0b0000, // used in SCF/CFC. + 'SecretKey' => 0b0000, // used in SCF/CFC. + 'AccessKeyID' => 0b0000, // used in FC. + 'AccessKeySecret' => 0b0000, // used in FC. + 'HW_urn' => 0b0000, // used in FG. + 'HW_key' => 0b0000, // used in FG. + 'HW_secret' => 0b0000, // used in FG. + 'HerokuappId' => 0b0000, // used in heroku. - 'admin' => 0b000, - 'adminloginpage' => 0b010, - 'autoJumpFirstDisk' => 0b010, - 'background' => 0b011, - 'backgroundm' => 0b011, - 'disableShowThumb' => 0b010, - //'disableChangeTheme'=> 0b010, - 'disktag' => 0b000, - 'hideFunctionalityFile'=> 0b010, - 'timezone' => 0b010, - 'passfile' => 0b011, - 'sitename' => 0b011, - 'customScript' => 0b011, - 'customCss' => 0b011, - 'customTheme' => 0b011, - 'theme' => 0b010, - 'useBasicAuth' => 0b010, - 'referrer' => 0b011, - 'forceHttps' => 0b010, - 'globalHeadOmfUrl' => 0b011, - 'globalHeadMdUrl' => 0b011, - 'globalReadmeMdUrl' => 0b011, - 'globalFootOmfUrl' => 0b011, - 'bcmathUrl' => 0b011, + 'admin' => 0b0000, + 'adminloginpage' => 0b0010, + 'autoJumpFirstDisk' => 0b1010, + 'background' => 0b0011, + 'backgroundm' => 0b0011, + 'disableShowThumb' => 0b1010, + //'disableChangeTheme'=> 0b1010, + 'disktag' => 0b0000, + 'hideFunctionalityFile'=> 0b1010, + 'timezone' => 0b0010, + 'passfile' => 0b0011, + 'sitename' => 0b0011, + 'customScript' => 0b0011, + 'customCss' => 0b0011, + 'customTheme' => 0b0011, + 'theme' => 0b0010, + 'useBasicAuth' => 0b1010, + 'referrer' => 0b0011, + 'forceHttps' => 0b1010, + 'globalHeadOmfUrl' => 0b0011, + 'globalHeadMdUrl' => 0b0011, + 'globalReadmeMdUrl' => 0b0011, + 'globalFootOmfUrl' => 0b0011, + 'bcmathUrl' => 0b0011, - 'Driver' => 0b100, - 'client_id' => 0b100, - 'client_secret' => 0b101, - 'sharepointSite' => 0b101, - 'shareurl' => 0b101, - //'sharecookie' => 0b101, - 'shareapiurl' => 0b101, - 'siteid' => 0b100, - 'refresh_token' => 0b100, - 'token_expires' => 0b100, - 'activeLimit' => 0b100, - 'driveId' => 0b100, + 'Driver' => 0b0100, + 'client_id' => 0b0100, + 'client_secret' => 0b0101, + 'sharepointSite' => 0b0101, + 'shareurl' => 0b0101, + //'sharecookie' => 0b0101, + 'shareapiurl' => 0b0101, + 'siteid' => 0b0100, + 'refresh_token' => 0b0100, + 'token_expires' => 0b0100, + 'activeLimit' => 0b0100, + 'driveId' => 0b0100, - 'diskDisplay' => 0b110, - 'diskname' => 0b111, - 'diskDescription' => 0b111, - 'domain_path' => 0b111, - 'downloadencrypt' => 0b110, - 'guestup_path' => 0b111, - 'domainforproxy' => 0b111, - 'public_path' => 0b111, + 'diskDisplay' => 0b0110, + 'diskname' => 0b0111, + 'diskDescription' => 0b0111, + 'domain_path' => 0b0111, + 'downloadencrypt' => 0b1110, + 'guestup_path' => 0b0111, + 'domainforproxy' => 0b0111, + 'public_path' => 0b0111, 'fileConduitSize' => 0b110, 'fileConduitCacheTime' => 0b110, ]; @@ -106,28 +107,35 @@ $timezones = array( function isCommonEnv($str) { global $EnvConfigs; - if (isset($EnvConfigs[$str])) return ( $EnvConfigs[$str] & 0b100 ) ? false : true; + if (isset($EnvConfigs[$str])) return ( $EnvConfigs[$str] & 0b0100 ) ? false : true; else return null; } function isInnerEnv($str) { global $EnvConfigs; - if (isset($EnvConfigs[$str])) return ( $EnvConfigs[$str] & 0b100 ) ? true : false; + if (isset($EnvConfigs[$str])) return ( $EnvConfigs[$str] & 0b0100 ) ? true : false; else return null; } function isShowedEnv($str) { global $EnvConfigs; - if (isset($EnvConfigs[$str])) return ( $EnvConfigs[$str] & 0b010 ) ? true : false; + if (isset($EnvConfigs[$str])) return ( $EnvConfigs[$str] & 0b0010 ) ? true : false; else return null; } function isBase64Env($str) { global $EnvConfigs; - if (isset($EnvConfigs[$str])) return ( $EnvConfigs[$str] & 0b001 ) ? true : false; + if (isset($EnvConfigs[$str])) return ( $EnvConfigs[$str] & 0b0001 ) ? true : false; + else return null; +} + +function isSwitchEnv($str) +{ + global $EnvConfigs; + if (isset($EnvConfigs[$str])) return ( $EnvConfigs[$str] & 0b1000 ) ? true : false; else return null; } @@ -1617,6 +1625,13 @@ output: $frame .= ' ' . getconstStr('EnvironmentsDescription')[$key]; + } elseif (isSwitchEnv($key)) { + $frame .= ' + + ' . getconstStr('EnvironmentsDescription')[$key]; } /*elseif ($key=='domain_path') { $tmp = getConfig($key); $domain_path = ''; @@ -1699,26 +1714,32 @@ output: '; foreach ($EnvConfigs as $key => $val) if (isInnerEnv($key) && isShowedEnv($key)) { - if ($key=='diskDisplay') { - $frame .= ' + $frame .= '