forceHttps
parent
d33578ad57
commit
e131588680
54
common.php
54
common.php
|
@ -37,6 +37,7 @@ $EnvConfigs = [
|
|||
'theme' => 0b010,
|
||||
'dontBasicAuth' => 0b010,
|
||||
'referrer' => 0b011,
|
||||
'forceHttps' => 0b010,
|
||||
|
||||
'Driver' => 0b100,
|
||||
'client_id' => 0b100,
|
||||
|
@ -133,6 +134,19 @@ function main($path)
|
|||
if (strpos(__DIR__, ':')) $slash = '\\';
|
||||
$_SERVER['php_starttime'] = microtime(true);
|
||||
$path = path_format($path);
|
||||
$_SERVER['PHP_SELF'] = path_format($_SERVER['base_path'] . $path);
|
||||
if (getConfig('forceHttps')&&$_SERVER['REQUEST_SCHEME']=='http') {
|
||||
if ($_GET) {
|
||||
$tmp = '';
|
||||
foreach ($_GET as $k => $v) {
|
||||
if ($v===true) $tmp .= '&' . $k;
|
||||
else $tmp .= '&' . $k . '=' . $v;
|
||||
}
|
||||
$tmp = substr($tmp, 1);
|
||||
if ($tmp!='') $param = '?' . $tmp;
|
||||
}
|
||||
return output('visit via https.', 302, [ 'Location' => 'https://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'] . $param ]);
|
||||
}
|
||||
if (in_array($_SERVER['firstacceptlanguage'], array_keys($constStr['languages']))) {
|
||||
$constStr['language'] = $_SERVER['firstacceptlanguage'];
|
||||
} else {
|
||||
|
@ -150,8 +164,6 @@ function main($path)
|
|||
$_SERVER['timezone'] = getConfig('timezone');
|
||||
if (isset($_COOKIE['timezone'])&&$_COOKIE['timezone']!='') $_SERVER['timezone'] = $_COOKIE['timezone'];
|
||||
if ($_SERVER['timezone']=='') $_SERVER['timezone'] = 0;
|
||||
$_SERVER['PHP_SELF'] = path_format($_SERVER['base_path'] . $path);
|
||||
|
||||
|
||||
if (getConfig('admin')=='') return install();
|
||||
if (getConfig('adminloginpage')=='') {
|
||||
|
@ -304,12 +316,13 @@ function main($path)
|
|||
if ($thumb_url!='') {
|
||||
if ($_GET['location']) {
|
||||
$url = $thumb_url;
|
||||
$header['Location'] = $url;
|
||||
$domainforproxy = '';
|
||||
$domainforproxy = getConfig('domainforproxy', $_SERVER['disktag']);
|
||||
if ($domainforproxy!='') {
|
||||
$url = proxy_replace_domain($url, $domainforproxy);
|
||||
$url = proxy_replace_domain($url, $domainforproxy, $header);
|
||||
}
|
||||
return output('', 302, [ 'Location' => $url ]);
|
||||
return output('', 302, $header);
|
||||
} else return output($thumb_url);
|
||||
}
|
||||
return output('', 404);
|
||||
|
@ -350,12 +363,13 @@ function main($path)
|
|||
if (count($tmp)>0) {
|
||||
$url = $tmp[rand(0, count($tmp)-1)];
|
||||
if (isset($_GET['url'])) return output($url, 200);
|
||||
$header['Location'] = $url;
|
||||
$domainforproxy = '';
|
||||
$domainforproxy = getConfig('domainforproxy', $_SERVER['disktag']);
|
||||
if ($domainforproxy!='') {
|
||||
$url = proxy_replace_domain($url, $domainforproxy);
|
||||
$url = proxy_replace_domain($url, $domainforproxy, $header);
|
||||
}
|
||||
return output('', 302, [ 'Location' => $url ]);
|
||||
return output('', 302, $header);
|
||||
} else return output('No ' . $_GET['random'] . 'file', 404);
|
||||
} else return output('Hidden', 401);
|
||||
}
|
||||
|
@ -363,15 +377,15 @@ function main($path)
|
|||
if ($files['type']=='file' && !isset($_GET['preview'])) {
|
||||
if ( $_SERVER['ishidden']<4 || (!!getConfig('downloadencrypt', $_SERVER['disktag'])&&$files['name']!=getConfig('passfile')) ) {
|
||||
$url = $files['url'];
|
||||
$domainforproxy = '';
|
||||
$domainforproxy = getConfig('domainforproxy', $_SERVER['disktag']);
|
||||
if ($domainforproxy!='') {
|
||||
$url = proxy_replace_domain($url, $domainforproxy);
|
||||
}
|
||||
if ( strtolower(splitlast($files['name'], '.')[1])=='html' ) return output($files['content']['body'], $files['content']['stat']);
|
||||
else {
|
||||
if ($_SERVER['HTTP_RANGE']!='') $header['Range'] = $_SERVER['HTTP_RANGE'];
|
||||
$header['Location'] = $url;
|
||||
$domainforproxy = '';
|
||||
$domainforproxy = getConfig('domainforproxy', $_SERVER['disktag']);
|
||||
if ($domainforproxy!='') {
|
||||
$url = proxy_replace_domain($url, $domainforproxy, $header);
|
||||
}
|
||||
return output('', 302, $header);
|
||||
}
|
||||
}
|
||||
|
@ -454,6 +468,7 @@ function compareadminmd5($admincookie, $name, $pass)
|
|||
if (md5($name . ':' . md5($pass) . '@' . $c_time) == $c_md5) return true;
|
||||
else return false;
|
||||
}
|
||||
|
||||
function compareadminsha1($adminsha1, $timestamp, $pass)
|
||||
{
|
||||
if (!is_numeric($timestamp)) return 'Timestamp not Number';
|
||||
|
@ -465,8 +480,9 @@ function compareadminsha1($adminsha1, $timestamp, $pass)
|
|||
else return 'Error password';
|
||||
}
|
||||
|
||||
function proxy_replace_domain($url, $domainforproxy)
|
||||
function proxy_replace_domain($url, $domainforproxy, &$header)
|
||||
{
|
||||
global $drive;
|
||||
$tmp = splitfirst($url, '//');
|
||||
$http = $tmp[0];
|
||||
$tmp = splitfirst($tmp[1], '/');
|
||||
|
@ -475,10 +491,14 @@ function proxy_replace_domain($url, $domainforproxy)
|
|||
if (substr($domainforproxy, 0, 7)=='http://' || substr($domainforproxy, 0, 8)=='https://') $aim = $domainforproxy;
|
||||
else $aim = $http . '//' . $domainforproxy;
|
||||
if (substr($aim, -1)=='/') $aim = substr($aim, 0, -1);
|
||||
//$header['Location'] = $aim . '/' . $uri;
|
||||
//return $aim . '/' . $uri;
|
||||
if (strpos($url, '?')>0) $sp = '&';
|
||||
else $sp = '?';
|
||||
$aim .= '/' . $uri . $sp . 'Origindomain=' . $domain;
|
||||
if ($drive->show_base_class()=='Aliyundrive') $aim .= '&Aliyundrive';
|
||||
$header['Location'] = $aim;
|
||||
return $aim . '/' . $uri . $sp . 'Origindomain=' . $domain;
|
||||
//$url = str_replace($tmp, $domainforproxy, $url).'&Origindomain='.$tmp;
|
||||
}
|
||||
|
||||
function isHideFile($name)
|
||||
|
@ -489,6 +509,7 @@ function isHideFile($name)
|
|||
'head.omf',
|
||||
'foot.omf',
|
||||
'favicon.ico',
|
||||
'robots.txt',
|
||||
'index.html',
|
||||
];
|
||||
|
||||
|
@ -823,8 +844,9 @@ function needUpdate()
|
|||
function output($body, $statusCode = 200, $headers = ['Content-Type' => 'text/html'], $isBase64Encoded = false)
|
||||
{
|
||||
if (isset($_SERVER['Set-Cookie'])) $headers['Set-Cookie'] = $_SERVER['Set-Cookie'];
|
||||
$headers['Referrer-Policy'] = 'no-referrer'; //$headers['Referrer-Policy'] = 'same-origin';
|
||||
$headers['X-Frame-Options'] = 'sameorigin';
|
||||
//$headers['Referrer-Policy'] = 'no-referrer';
|
||||
//$headers['Referrer-Policy'] = 'same-origin';
|
||||
//$headers['X-Frame-Options'] = 'sameorigin';
|
||||
return [
|
||||
'isBase64Encoded' => $isBase64Encoded,
|
||||
'statusCode' => $statusCode,
|
||||
|
@ -1792,7 +1814,7 @@ function render_list($path = '', $files = [])
|
|||
} else {
|
||||
if (!($html = getcache('customTheme'))) {
|
||||
$file_path = $theme;
|
||||
$tmp = curl('GET', $file_path, false, [], 1);
|
||||
$tmp = curl('GET', $file_path, '', [], 1);
|
||||
if ($tmp['stat']==302) {
|
||||
error_log1(json_encode($tmp));
|
||||
$tmp = curl('GET', $tmp["returnhead"]["Location"]);
|
||||
|
|
25
conststr.php
25
conststr.php
|
@ -104,15 +104,15 @@ $constStr = [
|
|||
'dontBasicAuth' => 'if 1, will not popup user/pass windows in encrypted folder, but show the page in theme.',
|
||||
'background' => 'Set an url as background photo.',
|
||||
'backgroundm' => 'Set an url as background in mobile phone.',
|
||||
'forceHttps' => 'if 1, force to redirect to https when visit via http.',
|
||||
'theme' => 'Select theme for guest.',
|
||||
'timezone' => 'Set default timezone.',
|
||||
'guestup_path' => 'Set guest upload dir, before set this, the files in this dir will show as normal.',
|
||||
'hideFunctionalityFile' => '0 or 1. if 1, some file will not show in list to guest, like readme.md',
|
||||
'passfile' => 'The password of folder(& its childrens) will save in this file.',
|
||||
'domainforproxy' => 'Will replace the https://xxxxx-my.sharepoint.com with this value.Add &Origindomain=xxxxx-my.sharepoint.com at last',
|
||||
'public_path' => 'Show this Onedrive dir when through the long url of API Gateway; public show files less than private.',
|
||||
'public_path' => 'Show this Onedrive dir when through the long url of API Gateway.',
|
||||
'sitename' => 'sitename',
|
||||
'Onedrive_ver' => 'Onedrive version',
|
||||
],
|
||||
'zh-cn' => [
|
||||
'admin' => '管理密码,不添加时不显示登录页面且无法登录。',
|
||||
|
@ -122,7 +122,7 @@ $constStr = [
|
|||
'customCss' => '<style>,在<head>最后面',
|
||||
'customTheme' => 'html格式的主题的url',
|
||||
'referrer' => '只有这些域名能引用本站资源。格式为a1.com|b1.com',
|
||||
'domain_path' => '使用多个自定义域名时,指定每个域名看到的目录。格式为a1.com:/dirto/path1|b1.com:/path2,比private_path优先。',
|
||||
'domain_path' => '使用多个自定义域名时,指定每个域名看到的目录。格式为a1.com:/dirto/path1|b1.com:/path2。',
|
||||
'diskname' => '这个盘你想显示什么名称。',
|
||||
'diskDescription' => '对这个盘的一些描述,随便写,代码不引用这个。',
|
||||
'disktag' => '一个标签,用于保存配置,多盘时会显示在url中。',
|
||||
|
@ -132,15 +132,15 @@ $constStr = [
|
|||
'dontBasicAuth' => '如果为 1,加密目录不再弹出用户名密码窗口,只会显示主题自带的页面。',
|
||||
'background' => '设置一个url作为背景。',
|
||||
'backgroundm' => '设置一个url作为手机端用的背景。',
|
||||
'forceHttps' => '0或1。如果设置为1,会强制跳https',
|
||||
'theme' => '为游客选择一个主题。',
|
||||
'timezone' => '设置默认时区。',
|
||||
'guestup_path' => '设置游客上传路径(图床路径),不设置这个值时该目录内容会正常列文件出来,设置后只有上传界面,不显示其中文件(登录后显示)。',
|
||||
'hideFunctionalityFile' => '0 或 1。如果 1, 某些文件不列表给游客看,但它的功能正常,比如readme.md',
|
||||
'passfile' => '自定义密码文件的名字,可以是\'pppppp\',也可以是\'aaaa.txt\'等等;列目录时不会显示,只有知道密码才能查看或下载此文件。密码是这个文件的内容,可以空格、可以中文;',
|
||||
'domainforproxy' => '会将https://xxxxx-my.sharepoint.com替换成这个值,在目标需要自己设置反代。会加上&Origindomain=原域名',
|
||||
'public_path' => '使用API长链接访问时,显示网盘文件的路径,不设置时默认为根目录;不能是private_path的上级(public看到的不能比private多,要么看到的就不一样)。',
|
||||
'public_path' => '使用API长链接访问时,显示网盘文件的路径,不设置时默认为根目录。',
|
||||
'sitename' => '网站的名称',
|
||||
'Onedrive_ver' => 'Onedrive版本',
|
||||
],
|
||||
'zh-tw' => [
|
||||
'admin' => '管理密碼,不設定密碼將不顯示登入頁面且無法登入。',
|
||||
|
@ -150,7 +150,7 @@ $constStr = [
|
|||
'customCss' => '<style>,在<head>最後面',
|
||||
'customTheme' => 'html格式的主題的url',
|
||||
'referrer' => '',
|
||||
'domain_path' => '使用多個自訂域名時,指定每個域名看到的目錄。格式為a1.com:/dirto/path1|b1.com:/path2,比private_path優先。',
|
||||
'domain_path' => '使用多個自訂域名時,指定每個域名看到的目錄。格式為a1.com:/dirto/path1|b1.com:/path2。',
|
||||
'diskname' => '這個盤你想顯示什麼名稱。',
|
||||
'disktag' => '一個標籤,用於儲存配置,多盤時會顯示在url中。',
|
||||
'disableShowThumb' => '如果填 1, ‘顯示縮略’按鈕將被隱藏。',
|
||||
|
@ -164,9 +164,8 @@ $constStr = [
|
|||
'hideFunctionalityFile' => '0 或 1。如果 1, 某些文件不列表給遊客看,但它的功能正常,比如readme.md',
|
||||
'passfile' => '自訂密碼文件的名字,可以是\'pppppp\',也可以是\'aaaa.txt\'等等;列目錄時不會顯示,只有知道密碼才能查看或下載此文件。密碼是這個文件的內容,可以空格、可以中文;',
|
||||
'domainforproxy' => '會將https://xxxxx-my.sharepoint.com取代成這個值,在目標需要自己設定反代。會加上&Origindomain=原域名',
|
||||
'public_path' => '使用API長連結訪問時,顯示網路硬碟檔案的路徑,不設定時預設為根目錄;不能是private_path的上級(public看到的不能比private多,要麼看到的就不一樣)。',
|
||||
'public_path' => '使用API長連結訪問時,顯示網路硬碟檔案的路徑,不設定時預設為根目錄。',
|
||||
'sitename' => '網站的名稱',
|
||||
'Onedrive_ver' => 'Onedrive版本',
|
||||
],
|
||||
'ja' => [
|
||||
'admin' => 'パスワードを管理する、追加しない場合、ログインページは表示されず、ログインできません。',
|
||||
|
@ -176,7 +175,7 @@ $constStr = [
|
|||
'customCss' => '<style>は、<head>の一番後ろにあります。',
|
||||
'customTheme' => 'htmlフォーマットのテーマのurl',
|
||||
'referrer' => '',
|
||||
'domain_path' => '複数のドメイン名を使用する場合、ドメイン名ごとに見られるディレクトリを指定します。フォーマットはa 1.com:/dirto/path 1.com:/path 2で、prvate_path優先。',
|
||||
'domain_path' => '複数のドメイン名を使用する場合、ドメイン名ごとに見られるディレクトリを指定します。フォーマットはa1.com:/dirto/path1|b1.com:/path2。',
|
||||
'diskname' => 'このディスクの名前を表示したいですか?',
|
||||
'disktag' => '一つのラベルは保存配置に使い、複数のディスクはurlに表示されます。',
|
||||
'disableShowThumb' => '1を記入すると、「表示サムネイル」ボタンが隠れます。',
|
||||
|
@ -190,9 +189,8 @@ $constStr = [
|
|||
'hideFunctionalityFile' => '0または1です。もし1ならば、いくつかの書類はリストで観光客に見せませんが、その機能は正常です。readme.md',
|
||||
'passfile' => 'カスタムパスワードファイルの名前は、\'pppppp \'、\'aaaa.txt \'などの場合があります。ディレクトリをリストするときには表示されません。パスワードを知っている場合にのみ、このファイルを表示またはダウンロードできます。 パスワードはこのファイルの内容であり、スペースまたは漢字を使用できます。',
|
||||
'domainforproxy' => '会将https://xxxy-my.sharepoint.comこの値に代えて、目標には自分で反世代を設定する必要があります。に加えて&Originndomain=元のドメイン名',
|
||||
'public_path' => 'APIのロングリンクアクセスを使用する場合、ネットワークディスクファイルのパスが表示されますが、設定されていない場合はデフォルトでルートディレクトリになり、private_pathの上位にはなりません(publicはprivate以上のものを見ることができません。それ以外は異なります。)。',
|
||||
'public_path' => 'APIのロングリンクアクセスを使用する場合、ネットワークディスクファイルのパスが表示されますが、設定されていない場合はデフォルトでルートディレクトリになり。',
|
||||
'sitename' => 'ウェブサイト名',
|
||||
'Onedrive_ver' => 'Onedriveバージョン',
|
||||
],
|
||||
'ko-kr' => [
|
||||
'admin' => '비밀번호를 관리하고 로그인 페이지를 표시하지 않으며 추가하지 않으면 로그인 할 수 없습니다.',
|
||||
|
@ -202,7 +200,7 @@ $constStr = [
|
|||
'customCss' => '< 스타일 >, < 헤드 > 맨 뒤에',
|
||||
'customTheme' => 'html 형식의 테마 url',
|
||||
'referrer' => '',
|
||||
'domain_path' => '도 메 인 이름 을 여러 개 사용자 정의 할 때 도 메 인 이름 마다 보 이 는 디 렉 터 리 를 지정 합 니 다.형식 은 a1. com: / dirto / path 1 | b1. com: / path 2, privatepath 우선.',
|
||||
'domain_path' => '도 메 인 이름 을 여러 개 사용자 정의 할 때 도 메 인 이름 마다 보 이 는 디 렉 터 리 를 지정 합 니 다.형식 은 a1.com:/dirto/path1|b1.com:/path2.',
|
||||
'diskname' => '이 접시 에 당신 은 어떤 명칭 을 표시 하고 싶 습 니까?',
|
||||
'disktag' => '디스크가 여러 개인 경우 구성을 저장하는 데 사용되는 레이블이 url에 표시됩니다.',
|
||||
'disableShowThumb' => '1을 입력하면 “썸네일 표시”버튼이 숨겨집니다.',
|
||||
|
@ -218,7 +216,6 @@ $constStr = [
|
|||
'domainforproxy' => 'https://xxxxx-my.sharepoint.com을이 값으로 바꾸고 대상에서 안티 생성을 설정해야합니다. & Origindomain = Original domain name 을 추가합니다.',
|
||||
'public_path' => 'API 긴 링크 액세스를 사용하는 경우 네트워크 디스크 파일의 경로가 표시됩니다. 설정되지 않은 경우 기본적으로 루트 디렉토리로 설정됩니다.',
|
||||
'sitename' => '웹 사이트 이름',
|
||||
'Onedrive_ver' => 'Onedrive 버전',
|
||||
],
|
||||
'fa' => [
|
||||
'admin' => 'رمز عبور ادمین، در صورت خالی بودن دکمه لاگین به نمایش در نمیآید',
|
||||
|
@ -233,7 +230,6 @@ $constStr = [
|
|||
'passfile' => 'رمز عبور dir در این فایل ذخیره می شود.',
|
||||
'public_path' => 'این مسیر Onedrive را هنگامی که از طریق آدرس طولانی API Gateway استفاده می کنید ، نشان دهید. فایل های نمایش عمومی کمتر از خصوصی.',
|
||||
'sitename' => 'نام سایت',
|
||||
'Onedrive_ver' => 'ورژن Onedrive',
|
||||
],
|
||||
'ar-sa' => [
|
||||
'admin' => ' إدارة كلمة السر ، لا يمكنك عرض صفحة تسجيل الدخول دون إضافة',
|
||||
|
@ -259,7 +255,6 @@ $constStr = [
|
|||
'domainforproxy' => 'سوف لا شيء استبدال هذه القيمة ، تحتاج إلى تعيين جيل معاكس في الهدف الخاص بك إضافة اسم النطاق الأصلي',
|
||||
'public_path' => 'عند استخدام API وصلة طويلة للوصول إلى عرض مسار الملف على القرص ، إذا لم يتم تعيين الافتراضي هو الجذر ، لا يمكن أن يكون private ش لا يمكن أن نرى أكثر من private publics ، أو لا',
|
||||
'sitename' => 'اسم الموقع',
|
||||
'Onedrive_ver' => 'أوندريف',
|
||||
],
|
||||
],
|
||||
'SetSecretsFirst' => [
|
||||
|
|
|
@ -43,12 +43,12 @@ function GetPathSetting($event, $context)
|
|||
if ($path=='/'||$path=='') {
|
||||
$_SERVER['base_path'] = $tmp;
|
||||
} else {
|
||||
$_SERVER['base_path'] = substr($tmp, 0, -strlen($path)+1);
|
||||
$_SERVER['base_path'] = substr($tmp, 0, strlen($tmp)-strlen($path)+1);
|
||||
}
|
||||
|
||||
if (substr($path,-1)=='/') $path=substr($path,0,-1);
|
||||
$_SERVER['is_guestup_path'] = is_guestup_path($path);
|
||||
$_SERVER['PHP_SELF'] = path_format($_SERVER['base_path'] . $path);
|
||||
//$_SERVER['PHP_SELF'] = path_format($_SERVER['base_path'] . $path);
|
||||
$_SERVER['REMOTE_ADDR'] = $event['clientIP'];
|
||||
$_SERVER['HTTP_X_REQUESTED_WITH'] = $event['headers']['X-Requested-With'][0];
|
||||
if (isset($event['headers']['Authorization'])) {
|
||||
|
@ -59,7 +59,6 @@ function GetPathSetting($event, $context)
|
|||
$_SERVER['HTTP_HOST'] = $event['headers']['Host'][0];
|
||||
$_SERVER['REQUEST_SCHEME'] = $event['headers']['X-Forwarded-Proto'][0];
|
||||
$_SERVER['host'] = $_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['HTTP_HOST'];
|
||||
//if ($_SERVER['HTTP_REFERER']!='')
|
||||
$_SERVER['referhost'] = explode('/', $event['headers']['Referer'][0])[2];
|
||||
$_SERVER['FC_SERVER_PATH'] = '/var/fc/runtime/php7.2';
|
||||
return $path;
|
||||
|
|
|
@ -36,7 +36,7 @@ function GetPathSetting($event, $context)
|
|||
$path = $event['path'];
|
||||
if (substr($path,-1)=='/') $path=substr($path,0,-1);
|
||||
$_SERVER['is_guestup_path'] = is_guestup_path($path);
|
||||
$_SERVER['PHP_SELF'] = path_format($_SERVER['base_path'] . $path);
|
||||
//$_SERVER['PHP_SELF'] = path_format($_SERVER['base_path'] . $path);
|
||||
$_SERVER['REMOTE_ADDR'] = $event['requestContext']['sourceIp'];
|
||||
$_SERVER['HTTP_X_REQUESTED_WITH'] = $event['headers']['X-Requested-With'];
|
||||
$_SERVER['HTTP_USER_AGENT'] = $event['headers']['User-Agent'];
|
||||
|
@ -48,7 +48,6 @@ function GetPathSetting($event, $context)
|
|||
$_SERVER['HTTP_HOST'] = $event['headers']['Host'];
|
||||
$_SERVER['REQUEST_SCHEME'] = $event['headers']['X-Forwarded-Proto'];
|
||||
$_SERVER['host'] = $_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['HTTP_HOST'];
|
||||
//if ($_SERVER['HTTP_REFERER']!='')
|
||||
$_SERVER['referhost'] = explode('/', $event['headers']['Referer'])[2];
|
||||
$_SERVER['HTTP_TRANSLATE'] = $event['headers']['translate'];//'f'
|
||||
$_SERVER['BCE_CFC_RUNTIME_NAME'] = 'php7';
|
||||
|
|
|
@ -58,7 +58,7 @@ function GetPathSetting($event, $context)
|
|||
}
|
||||
if (substr($path,-1)=='/') $path=substr($path,0,-1);
|
||||
$_SERVER['is_guestup_path'] = is_guestup_path($path);
|
||||
$_SERVER['PHP_SELF'] = path_format($_SERVER['base_path'] . $path);
|
||||
//$_SERVER['PHP_SELF'] = path_format($_SERVER['base_path'] . $path);
|
||||
$_SERVER['REMOTE_ADDR'] = $event['headers']['x-real-ip'];
|
||||
$_SERVER['HTTP_X_REQUESTED_WITH'] = $event['headers']['x-requested-with'];
|
||||
$_SERVER['HTTP_USER_AGENT'] = $event['headers']['user-agent'];
|
||||
|
@ -69,7 +69,6 @@ function GetPathSetting($event, $context)
|
|||
}
|
||||
$_SERVER['REQUEST_SCHEME'] = $event['headers']['x-forwarded-proto'];
|
||||
$_SERVER['host'] = $_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['HTTP_HOST'];
|
||||
//if ($_SERVER['HTTP_REFERER']!='')
|
||||
$_SERVER['referhost'] = explode('/', $event['headers']['referer'])[2];
|
||||
$_SERVER['HTTP_TRANSLATE'] = $event['headers']['translate'];//'f'
|
||||
$_SERVER['_APP_SHARE_DIR'] = '/var/share/CFF/processrouter';
|
||||
|
|
|
@ -58,7 +58,7 @@ function GetPathSetting($event, $context)
|
|||
}
|
||||
if (substr($path,-1)=='/') $path=substr($path,0,-1);
|
||||
$_SERVER['is_guestup_path'] = is_guestup_path($path);
|
||||
$_SERVER['PHP_SELF'] = path_format($_SERVER['base_path'] . $path);
|
||||
//$_SERVER['PHP_SELF'] = path_format($_SERVER['base_path'] . $path);
|
||||
$_SERVER['REMOTE_ADDR'] = $event['headers']['x-real-ip'];
|
||||
$_SERVER['HTTP_X_REQUESTED_WITH'] = $event['headers']['x-requested-with'];
|
||||
$_SERVER['HTTP_USER_AGENT'] = $event['headers']['user-agent'];
|
||||
|
@ -69,7 +69,6 @@ function GetPathSetting($event, $context)
|
|||
}
|
||||
$_SERVER['REQUEST_SCHEME'] = $event['headers']['x-forwarded-proto'];
|
||||
$_SERVER['host'] = $_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['HTTP_HOST'];
|
||||
//if ($_SERVER['HTTP_REFERER']!='')
|
||||
$_SERVER['referhost'] = explode('/', $event['headers']['referer'])[2];
|
||||
$_SERVER['HTTP_TRANSLATE'] = $event['headers']['translate'];//'f'
|
||||
$_SERVER['_APP_SHARE_DIR'] = '/var/share/CFF/processrouter';
|
||||
|
|
|
@ -4,8 +4,16 @@ function getpath()
|
|||
{
|
||||
$_SERVER['firstacceptlanguage'] = strtolower(splitfirst(splitfirst($_SERVER['HTTP_ACCEPT_LANGUAGE'],';')[0],',')[0]);
|
||||
if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) $_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_X_FORWARDED_FOR'];
|
||||
if ($_SERVER['REQUEST_SCHEME']!='http'&&$_SERVER['REQUEST_SCHEME']!='https') {
|
||||
if ($_SERVER['HTTP_X_FORWARDED_PROTO']!='') {
|
||||
$tmp = explode(',', $_SERVER['HTTP_X_FORWARDED_PROTO'])[0];
|
||||
if ($tmp=='http'||$tmp=='https') $_SERVER['REQUEST_SCHEME'] = $tmp;
|
||||
}
|
||||
//if ($_SERVER['REQUEST_SCHEME']!='http'&&$_SERVER['REQUEST_SCHEME']!='https') {
|
||||
// echo $_SERVER['REQUEST_SCHEME'];
|
||||
//}
|
||||
}
|
||||
$_SERVER['host'] = $_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['HTTP_HOST'];
|
||||
//if ($_SERVER['HTTP_REFERER']!='')
|
||||
$_SERVER['referhost'] = explode('/', $_SERVER['HTTP_REFERER'])[2];
|
||||
if (isset($_SERVER['DOCUMENT_ROOT'])&&$_SERVER['DOCUMENT_ROOT']==='/app') $_SERVER['base_path'] = '/';
|
||||
else $_SERVER['base_path'] = path_format(substr($_SERVER['SCRIPT_NAME'], 0, -10) . '/');
|
||||
|
|
|
@ -43,7 +43,7 @@ function GetPathSetting($event, $context)
|
|||
}
|
||||
if (substr($path,-1)=='/') $path=substr($path,0,-1);
|
||||
$_SERVER['is_guestup_path'] = is_guestup_path($path);
|
||||
$_SERVER['PHP_SELF'] = path_format($_SERVER['base_path'] . $path);
|
||||
//$_SERVER['PHP_SELF'] = path_format($_SERVER['base_path'] . $path);
|
||||
$_SERVER['REMOTE_ADDR'] = $event['requestContext']['sourceIp'];
|
||||
$_SERVER['HTTP_X_REQUESTED_WITH'] = $event['headers']['x-requested-with'];
|
||||
$_SERVER['HTTP_USER_AGENT'] = $event['headers']['user-agent'];
|
||||
|
@ -52,7 +52,8 @@ function GetPathSetting($event, $context)
|
|||
$_SERVER['PHP_AUTH_USER'] = $basicAuth[0];
|
||||
$_SERVER['PHP_AUTH_PW'] = $basicAuth[1];
|
||||
}
|
||||
$_SERVER['REQUEST_SCHEME'] = $event['headers']['x-forwarded-proto'];
|
||||
$_SERVER['REQUEST_SCHEME'] = $event['headers']['x-api-scheme'];
|
||||
//$_SERVER['REQUEST_SCHEME'] = $event['headers']['x-forwarded-proto'];
|
||||
$_SERVER['host'] = $_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['HTTP_HOST'];
|
||||
$_SERVER['referhost'] = explode('/', $event['headers']['referer'])[2];
|
||||
$_SERVER['HTTP_TRANSLATE']==$event['headers']['translate'];//'f'
|
||||
|
|
|
@ -43,7 +43,7 @@ function GetPathSetting($event, $context)
|
|||
}
|
||||
if (substr($path,-1)=='/') $path=substr($path,0,-1);
|
||||
$_SERVER['is_guestup_path'] = is_guestup_path($path);
|
||||
$_SERVER['PHP_SELF'] = path_format($_SERVER['base_path'] . $path);
|
||||
//$_SERVER['PHP_SELF'] = path_format($_SERVER['base_path'] . $path);
|
||||
$_SERVER['REMOTE_ADDR'] = $event['requestContext']['sourceIp'];
|
||||
$_SERVER['HTTP_X_REQUESTED_WITH'] = $event['headers']['x-requested-with'];
|
||||
$_SERVER['HTTP_USER_AGENT'] = $event['headers']['user-agent'];
|
||||
|
@ -52,7 +52,8 @@ function GetPathSetting($event, $context)
|
|||
$_SERVER['PHP_AUTH_USER'] = $basicAuth[0];
|
||||
$_SERVER['PHP_AUTH_PW'] = $basicAuth[1];
|
||||
}
|
||||
$_SERVER['REQUEST_SCHEME'] = $event['headers']['x-forwarded-proto'];
|
||||
$_SERVER['REQUEST_SCHEME'] = $event['headers']['x-api-scheme'];
|
||||
//$_SERVER['REQUEST_SCHEME'] = $event['headers']['x-forwarded-proto'];
|
||||
$_SERVER['host'] = $_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['HTTP_HOST'];
|
||||
$_SERVER['referhost'] = explode('/', $event['headers']['referer'])[2];
|
||||
$_SERVER['HTTP_TRANSLATE']==$event['headers']['translate'];//'f'
|
||||
|
|
Loading…
Reference in New Issue