pre-lang & p_path

pull/41/head
qkqpttgf 2020-04-04 13:50:29 +08:00 committed by GitHub
parent 97735aec43
commit cf5aa37633
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 34 additions and 11 deletions

View File

@ -26,7 +26,7 @@ $Base64Env = [
//'usesharepoint',
'sharepointname',
'shareurl',
'sharecookie',
//'sharecookie',
'shareapiurl',
//'siteid',
'public_path',
@ -81,7 +81,7 @@ $InnerEnv = [
'sharepointname',
'siteid',
'shareurl',
'sharecookie',
//'sharecookie',
'shareapiurl',
'public_path',
'refresh_token',
@ -113,7 +113,17 @@ function main($path)
global $exts;
global $constStr;
if (in_array($_SERVER['firstacceptlanguage'], array_keys($constStr['languages']))) $constStr['language'] = $_SERVER['firstacceptlanguage'];
if (in_array($_SERVER['firstacceptlanguage'], array_keys($constStr['languages']))) {
$constStr['language'] = $_SERVER['firstacceptlanguage'];
} else {
$prelang = splitfirst($_SERVER['firstacceptlanguage'], '-')[0];
foreach ( array_keys($constStr['languages']) as $lang) {
if ($prelang == splitfirst($lang, '-')[0]) {
$constStr['language'] = $lang;
break;
}
}
}
if (isset($_COOKIE['language'])&&$_COOKIE['language']!='') $constStr['language'] = $_COOKIE['language'];
//if (!$constStr['language']) $constStr['language'] = getConfig('language');
/*echo 'firstacceptlanguage:'.$_SERVER['firstacceptlanguage'].'
@ -1247,15 +1257,28 @@ function render_list($path = '', $files = '')
if ($path !== '/') {
if (isset($files['file'])) {
$pretitle = str_replace('&','&', $files['name']);
$n_path=$pretitle;
$n_path = $pretitle;
$tmp = splitlast(splitlast($path,'/')[0],'/');
if ($tmp[1]=='') {
$p_path = $tmp[0];
} else {
$p_path = $tmp[1];
}
} else {
$pretitle = substr($path,-1)=='/'?substr($path,0,-1):$path;
$n_path=substr($pretitle,strrpos($pretitle,'/')+1);
$pretitle = substr($pretitle,1);
}
if (strrpos($path,'/')!=0) {
$p_path=substr($path,0,strrpos($path,'/'));
$p_path=substr($p_path,strrpos($p_path,'/')+1);
if (substr($path,0,1)=='/') $pretitle = substr($path,1);
if (substr($path,-1)=='/') $pretitle = substr($path,0,-1);
$tmp=splitlast($pretitle,'/');
if ($tmp[1]=='') {
$n_path = $tmp[0];
} else {
$n_path = $tmp[1];
$tmp = splitlast($tmp[0],'/');
if ($tmp[1]=='') {
$p_path = $tmp[0];
} else {
$p_path = $tmp[1];
}
}
}
} else {
$pretitle = getconstStr('Home');