show switch setting as select

pull/641/head^2
qkqpttgf 2022-07-27 18:14:29 +08:00 committed by GitHub
parent 94f780963b
commit 166f00c3a7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 88 additions and 67 deletions

View File

@ -6,65 +6,66 @@ global $drive;
global $EnvConfigs; global $EnvConfigs;
$EnvConfigs = [ $EnvConfigs = [
// 1 is a switch, 0 input string
// 1 inner, 0 common // 1 inner, 0 common
// 1 showed/enableEdit, 0 hidden/disableEdit // 1 showed/enableEdit, 0 hidden/disableEdit
// 1 base64 to save, 0 not base64 // 1 base64 to save, 0 not base64
'APIKey' => 0b000, // used in heroku. 'APIKey' => 0b0000, // used in heroku.
'SecretId' => 0b000, // used in SCF/CFC. 'SecretId' => 0b0000, // used in SCF/CFC.
'SecretKey' => 0b000, // used in SCF/CFC. 'SecretKey' => 0b0000, // used in SCF/CFC.
'AccessKeyID' => 0b000, // used in FC. 'AccessKeyID' => 0b0000, // used in FC.
'AccessKeySecret' => 0b000, // used in FC. 'AccessKeySecret' => 0b0000, // used in FC.
'HW_urn' => 0b000, // used in FG. 'HW_urn' => 0b0000, // used in FG.
'HW_key' => 0b000, // used in FG. 'HW_key' => 0b0000, // used in FG.
'HW_secret' => 0b000, // used in FG. 'HW_secret' => 0b0000, // used in FG.
'HerokuappId' => 0b000, // used in heroku. 'HerokuappId' => 0b0000, // used in heroku.
'admin' => 0b000, 'admin' => 0b0000,
'adminloginpage' => 0b010, 'adminloginpage' => 0b0010,
'autoJumpFirstDisk' => 0b010, 'autoJumpFirstDisk' => 0b1010,
'background' => 0b011, 'background' => 0b0011,
'backgroundm' => 0b011, 'backgroundm' => 0b0011,
'disableShowThumb' => 0b010, 'disableShowThumb' => 0b1010,
//'disableChangeTheme'=> 0b010, //'disableChangeTheme'=> 0b1010,
'disktag' => 0b000, 'disktag' => 0b0000,
'hideFunctionalityFile'=> 0b010, 'hideFunctionalityFile'=> 0b1010,
'timezone' => 0b010, 'timezone' => 0b0010,
'passfile' => 0b011, 'passfile' => 0b0011,
'sitename' => 0b011, 'sitename' => 0b0011,
'customScript' => 0b011, 'customScript' => 0b0011,
'customCss' => 0b011, 'customCss' => 0b0011,
'customTheme' => 0b011, 'customTheme' => 0b0011,
'theme' => 0b010, 'theme' => 0b0010,
'useBasicAuth' => 0b010, 'useBasicAuth' => 0b1010,
'referrer' => 0b011, 'referrer' => 0b0011,
'forceHttps' => 0b010, 'forceHttps' => 0b1010,
'globalHeadOmfUrl' => 0b011, 'globalHeadOmfUrl' => 0b0011,
'globalHeadMdUrl' => 0b011, 'globalHeadMdUrl' => 0b0011,
'globalReadmeMdUrl' => 0b011, 'globalReadmeMdUrl' => 0b0011,
'globalFootOmfUrl' => 0b011, 'globalFootOmfUrl' => 0b0011,
'bcmathUrl' => 0b011, 'bcmathUrl' => 0b0011,
'Driver' => 0b100, 'Driver' => 0b0100,
'client_id' => 0b100, 'client_id' => 0b0100,
'client_secret' => 0b101, 'client_secret' => 0b0101,
'sharepointSite' => 0b101, 'sharepointSite' => 0b0101,
'shareurl' => 0b101, 'shareurl' => 0b0101,
//'sharecookie' => 0b101, //'sharecookie' => 0b0101,
'shareapiurl' => 0b101, 'shareapiurl' => 0b0101,
'siteid' => 0b100, 'siteid' => 0b0100,
'refresh_token' => 0b100, 'refresh_token' => 0b0100,
'token_expires' => 0b100, 'token_expires' => 0b0100,
'activeLimit' => 0b100, 'activeLimit' => 0b0100,
'driveId' => 0b100, 'driveId' => 0b0100,
'diskDisplay' => 0b110, 'diskDisplay' => 0b0110,
'diskname' => 0b111, 'diskname' => 0b0111,
'diskDescription' => 0b111, 'diskDescription' => 0b0111,
'domain_path' => 0b111, 'domain_path' => 0b0111,
'downloadencrypt' => 0b110, 'downloadencrypt' => 0b1110,
'guestup_path' => 0b111, 'guestup_path' => 0b0111,
'domainforproxy' => 0b111, 'domainforproxy' => 0b0111,
'public_path' => 0b111, 'public_path' => 0b0111,
'fileConduitSize' => 0b110, 'fileConduitSize' => 0b110,
'fileConduitCacheTime' => 0b110, 'fileConduitCacheTime' => 0b110,
]; ];
@ -106,28 +107,35 @@ $timezones = array(
function isCommonEnv($str) function isCommonEnv($str)
{ {
global $EnvConfigs; 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; else return null;
} }
function isInnerEnv($str) function isInnerEnv($str)
{ {
global $EnvConfigs; 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; else return null;
} }
function isShowedEnv($str) function isShowedEnv($str)
{ {
global $EnvConfigs; 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; else return null;
} }
function isBase64Env($str) function isBase64Env($str)
{ {
global $EnvConfigs; 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; else return null;
} }
@ -1617,6 +1625,13 @@ output:
$frame .= ' $frame .= '
</select> </select>
' . getconstStr('EnvironmentsDescription')[$key]; ' . getconstStr('EnvironmentsDescription')[$key];
} elseif (isSwitchEnv($key)) {
$frame .= '
<select name="' . $key . '">
<option value=""></option>
<option value="1"' . (getConfig($key)?' selected="selected"':'') . '>true</option>
</select>
' . getconstStr('EnvironmentsDescription')[$key];
} /*elseif ($key=='domain_path') { } /*elseif ($key=='domain_path') {
$tmp = getConfig($key); $tmp = getConfig($key);
$domain_path = ''; $domain_path = '';
@ -1699,26 +1714,32 @@ output:
<input name="_admin" type="hidden" value=""> <input name="_admin" type="hidden" value="">
<input type="hidden" name="disk" value="' . $disktag . '">'; <input type="hidden" name="disk" value="' . $disktag . '">';
foreach ($EnvConfigs as $key => $val) if (isInnerEnv($key) && isShowedEnv($key)) { foreach ($EnvConfigs as $key => $val) if (isInnerEnv($key) && isShowedEnv($key)) {
if ($key=='diskDisplay') { $frame .= '
$frame .= '
<tr> <tr>
<td><label>' . $key . '</label></td> <td><label>' . $key . '</label></td>
<td width=100%> <td width=100%>';
if ($key=='diskDisplay') {
$frame .= '
<select name="' . $key . '"> <select name="' . $key . '">
<option value=""' . (getConfig($key, $disktag)===''?' selected':'') . '> </option> <option value=""' . (getConfig($key, $disktag)===''?' selected':'') . '> </option>
<option value="hidden"' . (getConfig($key, $disktag)==='hidden'?' selected':'') . '>hidden</option> <option value="hidden"' . (getConfig($key, $disktag)==='hidden'?' selected':'') . '>hidden</option>
<option value="disable"' . (getConfig($key, $disktag)==='disable'?' selected':'') . '>disable</option> <option value="disable"' . (getConfig($key, $disktag)==='disable'?' selected':'') . '>disable</option>
</select> </select>
' . getconstStr('EnvironmentsDescription')[$key] . ' ' . getconstStr('EnvironmentsDescription')[$key];
</td> } elseif (isSwitchEnv($key)) {
</tr>'; $frame .= '
<select name="' . $key . '">
<option value=""></option>
<option value="1"' . (getConfig($key)?' selected="selected"':'') . '>true</option>
</select>
' . getconstStr('EnvironmentsDescription')[$key];
} else { } else {
$frame .= ' $frame .= '
<tr> <input type="text" name="' . $key . '" value="' . getConfig($key, $disktag) . '" placeholder="' . getconstStr('EnvironmentsDescription')[$key] . '" style="width:100%">';
<td><label>' . $key . '</label></td>
<td width=100%><input type="text" name="' . $key . '" value="' . getConfig($key, $disktag) . '" placeholder="' . getconstStr('EnvironmentsDescription')[$key] . '" style="width:100%"></td>
</tr>';
} }
$frame .= '
</td>
</tr>';
} }
$frame .= ' $frame .= '
<tr><td></td><td><input type="submit" name="submit1" value="' . getconstStr('Setup') . '"></td></tr> <tr><td></td><td><input type="submit" name="submit1" value="' . getconstStr('Setup') . '"></td></tr>