mirror of
https://github.com/wavelog/wavelog.git
synced 2026-03-22 10:24:14 +00:00
fix https detection
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
/*
|
||||
New Wavelog Installer
|
||||
|
||||
This installer guides a user through the install process and all
|
||||
This installer guides an user through the install process and all
|
||||
necessary parameters for the new Wavelog Installation.
|
||||
|
||||
HB9HIL - January 2024
|
||||
@@ -79,6 +79,25 @@ function delDir($dir)
|
||||
}
|
||||
}
|
||||
|
||||
function is_https() {
|
||||
if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on') {
|
||||
return true;
|
||||
}
|
||||
if (!empty($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https') {
|
||||
return true;
|
||||
}
|
||||
if (!empty($_SERVER['HTTP_X_FORWARDED_SSL']) && $_SERVER['HTTP_X_FORWARDED_SSL'] === 'on') {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
if (is_https()) {
|
||||
$html_scheme = "https";
|
||||
} else {
|
||||
$html_scheme = "http";
|
||||
}
|
||||
|
||||
if (file_exists($db_file_path)) {
|
||||
delDir(getcwd());
|
||||
header("../");
|
||||
@@ -382,13 +401,13 @@ global $wavelog_url;
|
||||
<div class="mb-3">
|
||||
<label for="directory" class="form-label">Directory<i id="directory_tooltip" data-bs-toggle="tooltip" data-bs-placement="top" class="fas fa-question-circle text-muted ms-2" data-bs-custom-class="custom-tooltip" data-bs-html="true" data-bs-title="The 'Directory' is basically your subfolder of the webroot In normal conditions the prefilled value is doing it's job. It also can be empty."></i></label>
|
||||
<div class="input-group">
|
||||
<span class="input-group-text" id="main-url"><?php echo $_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['HTTP_HOST'] . "/"; ?></span>
|
||||
<span class="input-group-text" id="main-url"><?php echo $html_scheme . '://' . $_SERVER['HTTP_HOST'] . "/"; ?></span>
|
||||
<input type="text" id="directory" value="<?php echo substr(str_replace("index.php", "", str_replace("/install/", "", $_SERVER['REQUEST_URI'])), 1); ?>" class="form-control" name="directory" aria-describedby="main-url" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="mb-3 position-relative">
|
||||
<label for="websiteurl" class="form-label">Website URL<i id="websiteurl_tooltip" data-bs-toggle="tooltip" data-bs-placement="top" class="fas fa-question-circle text-muted ms-2" data-bs-custom-class="custom-tooltip" data-bs-html="true" data-bs-title="This is the complete URL where your Wavelog Instance will be available. If you run this installer locally but want to place Wavelog behind a Reverse Proxy with SSL you should type in the new URL here (e.g. https://mywavelog.example.org/ instead of http://192.168.1.100/). Don't forget to include the directory from above."></i></label>
|
||||
<input type="text" id="websiteurl" value="<?php echo $_SERVER['REQUEST_SCHEME']; ?>://<?php echo str_replace("index.php", "", $_SERVER['HTTP_HOST'] . str_replace("/install/", "", $_SERVER['REQUEST_URI'])); ?>" class="form-control" name="websiteurl" />
|
||||
<input type="text" id="websiteurl" value="<?php echo $html_scheme; ?>://<?php echo str_replace("index.php", "", $_SERVER['HTTP_HOST'] . str_replace("/install/", "", $_SERVER['REQUEST_URI'])); ?>" class="form-control" name="websiteurl" />
|
||||
<div class="invalid-tooltip">
|
||||
This field can't be empty!
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user