Add files via upload

This commit is contained in:
qkqpttgf
2020-02-18 21:57:38 +08:00
committed by GitHub
parent e2946ad471
commit a81339b87f
4 changed files with 73 additions and 42 deletions
+24 -1
View File
@@ -12,6 +12,18 @@ $innerEnv = [
'token_expires',
];
$ShowedinnerEnv = [
//'Onedrive_ver',
//'client_id',
//'client_secret',
'domain_path',
'guestup_path',
'diskname',
'public_path',
//'refresh_token',
//'token_expires',
];
function getcache($str)
{
$cache = null;
@@ -61,7 +73,8 @@ function config_oauth()
// MS Customer
// https://portal.azure.com
$_SERVER['client_id'] = getConfig('client_id');
$_SERVER['client_secret'] = getConfig('client_secret');
$_SERVER['client_secret'] = base64_decode(equal_replace(getenv('client_secret'),1));
//getConfig('client_secret');
$_SERVER['oauth_url'] = 'https://login.microsoftonline.com/common/oauth2/v2.0/';
$_SERVER['api_url'] = 'https://graph.microsoft.com/v1.0/me/drive/root';
$_SERVER['scope'] = 'https://graph.microsoft.com/Files.ReadWrite.All offline_access';
@@ -118,6 +131,16 @@ function spurlencode($str,$splite='')
return $tmp;
}
function equal_replace($str, $add = false)
{
if ($add) {
while(strlen($str)%4) $str .= '=';
} else {
while(substr($str,-1)=='=') $str=substr($str,0,-1);
}
return $str;
}
function is_guestup_path($path)
{
if (path_format('/'.path_format(urldecode($_SERVER['list_path'].path_format($path))).'/')==path_format('/'.path_format(getConfig('guestup_path')).'/')&&getConfig('guestup_path')!='') return 1;