fix base path behind proxy
This commit is contained in:
@@ -1,8 +1,13 @@
|
|||||||
<?php
|
<?php
|
||||||
mb_internal_encoding("utf8");
|
mb_internal_encoding("utf8");
|
||||||
$subpath="";
|
$subpath = "";
|
||||||
$file="";
|
$file = "";
|
||||||
$username="";
|
$username = "";
|
||||||
|
$myurl = (isset($_SERVER['HTTPS']) ? 'https' : 'http')
|
||||||
|
.'://'.$_SERVER['HTTP_HOST']
|
||||||
|
.explode('?', (isset($_SERVER['HTTP_X_ORIGINAL_REQUEST'])
|
||||||
|
? $_SERVER['HTTP_X_ORIGINAL_REQUEST']
|
||||||
|
: $_SERVER['REQUEST_URI']))[0];
|
||||||
function error_die($reason, $status='500 Internal Server Error') {
|
function error_die($reason, $status='500 Internal Server Error') {
|
||||||
header("Expires: Tue, 01 Jan 2000 00:00:00 GMT");
|
header("Expires: Tue, 01 Jan 2000 00:00:00 GMT");
|
||||||
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
|
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
|
||||||
@@ -159,8 +164,7 @@ function linkorselect($link, $img, $filename) {
|
|||||||
if (!isset($_REQUEST['secret'])) {
|
if (!isset($_REQUEST['secret'])) {
|
||||||
if ($username=="") error_die('not authorized', '403 Forbidden');
|
if ($username=="") error_die('not authorized', '403 Forbidden');
|
||||||
if (isset($_REQUEST['qrcode'])) {
|
if (isset($_REQUEST['qrcode'])) {
|
||||||
QRcode::png((isset($_SERVER['HTTPS']) ? 'https' : 'http')
|
QRcode::png($myurl.'?secret='.$_REQUEST['qrcode']);
|
||||||
.'://'.$_SERVER['HTTP_HOST'].explode('?', $_SERVER['REQUEST_URI'])[0].'?secret='.$_REQUEST['qrcode']);
|
|
||||||
exit;
|
exit;
|
||||||
} else {
|
} else {
|
||||||
if (isset($_REQUEST['path'])) checkPath($_REQUEST['path']);
|
if (isset($_REQUEST['path'])) checkPath($_REQUEST['path']);
|
||||||
@@ -280,7 +284,7 @@ if (!isset($_REQUEST['secret'])) {
|
|||||||
$message = preg_replace('/PASSWORD/', $_REQUEST['password'], $_REQUEST['mailtext']);
|
$message = preg_replace('/PASSWORD/', $_REQUEST['password'], $_REQUEST['mailtext']);
|
||||||
else
|
else
|
||||||
$message = $_REQUEST['mailtext']."\n\npassword: ".$REQUEST['password'];
|
$message = $_REQUEST['mailtext']."\n\npassword: ".$REQUEST['password'];
|
||||||
$link = (isset($_SERVER['HTTPS'])?'https://':'http://').$_SERVER['HTTP_HOST'].explode('?', $_SERVER['REQUEST_URI'])[0].'?secret='.$secret;
|
$link = $myurl.'?secret='.$secret;
|
||||||
if (preg_match('/LINK/', $message))
|
if (preg_match('/LINK/', $message))
|
||||||
$message = preg_replace('/LINK/', $link, $message);
|
$message = preg_replace('/LINK/', $link, $message);
|
||||||
else
|
else
|
||||||
@@ -298,8 +302,7 @@ if (!isset($_REQUEST['secret'])) {
|
|||||||
echo '<p>Share files: Tell your friend the password on a separate channel and send this: <a href="?secret
|
echo '<p>Share files: Tell your friend the password on a separate channel and send this: <a href="?secret
|
||||||
='.$secret.'">Link to Share</a></p>';
|
='.$secret.'">Link to Share</a></p>';
|
||||||
?>
|
?>
|
||||||
<img src="<?php echo (isset($_SERVER['HTTPS']) ? 'https' : 'http')
|
<img src="<?php echo $myurl.'?qrcode='.$secret; ?>" />
|
||||||
.'://'.$_SERVER['HTTP_HOST'].explode('?', $_SERVER['REQUEST_URI'])[0].'?qrcode='.$secret; ?>" />
|
|
||||||
<p>or Send Link in E-Mail:</p>
|
<p>or Send Link in E-Mail:</p>
|
||||||
<form method="POST">
|
<form method="POST">
|
||||||
<table style="width: 100%"><tr>
|
<table style="width: 100%"><tr>
|
||||||
|
Reference in New Issue
Block a user