aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2022-03-17 08:23:02 +0000
committerMario <mario@mariovavti.com>2022-03-17 08:23:02 +0000
commit1beadfc6e769cfe21d6c3d6c13f7db29210e40fb (patch)
treec3f0572acae928f68fc2fccb8297f990543ad295 /include
parent4ffd7587a953fa1389326138c37297f046dae155 (diff)
parentf4af532c5a8f37f69035616e2ae7908bf5b77a62 (diff)
downloadvolse-hubzilla-1beadfc6e769cfe21d6c3d6c13f7db29210e40fb.tar.gz
volse-hubzilla-1beadfc6e769cfe21d6c3d6c13f7db29210e40fb.tar.bz2
volse-hubzilla-1beadfc6e769cfe21d6c3d6c13f7db29210e40fb.zip
Merge branch 'volse-fix-stylesheet-root-path' into 'dev'
Use correct base url for stylesheets and js. See merge request hubzilla/core!2015
Diffstat (limited to 'include')
-rw-r--r--include/plugin.php44
1 files changed, 2 insertions, 42 deletions
diff --git a/include/plugin.php b/include/plugin.php
index 25fa22e10..f9cee7ed6 100644
--- a/include/plugin.php
+++ b/include/plugin.php
@@ -941,9 +941,7 @@ function head_get_links() {
function format_css_if_exists($source) {
- // script_path() returns https://yoursite.tld
-
- $path_prefix = script_path();
+ $path_prefix = z_root();
$script = $source[0];
@@ -965,44 +963,6 @@ function format_css_if_exists($source) {
}
}
-/**
- * This basically calculates the baseurl. We have other functions to do that, but
- * there was an issue with script paths and mixed-content whose details are arcane
- * and perhaps lost in the message archives. The short answer is that we're ignoring
- * the URL which we are "supposed" to use, and generating script paths relative to
- * the URL which we are currently using; in order to ensure they are found and aren't
- * blocked due to mixed content issues.
- *
- * @return string
- */
-function script_path() {
- if(x($_SERVER,'HTTPS') && $_SERVER['HTTPS'])
- $scheme = 'https';
- elseif(x($_SERVER,'SERVER_PORT') && (intval($_SERVER['SERVER_PORT']) == 443))
- $scheme = 'https';
- elseif (!empty($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https' || !empty($_SERVER['HTTP_X_FORWARDED_SSL']) && $_SERVER['HTTP_X_FORWARDED_SSL'] == 'on')
- $scheme = 'https';
- else
- $scheme = 'http';
-
- // Some proxy setups may require using http_host
-
- if(isset(App::$config['system']['script_path_use_http_host']) && intval(App::$config['system']['script_path_use_http_host']))
- $server_var = 'HTTP_HOST';
- else
- $server_var = 'SERVER_NAME';
-
-
- if(x($_SERVER,$server_var)) {
- $hostname = $_SERVER[$server_var];
- }
- else {
- return z_root();
- }
-
- return $scheme . '://' . $hostname;
-}
-
function head_add_js($src, $priority = 0) {
if(isset(App::$js_sources[$priority]) && !is_array(App::$js_sources[$priority]))
App::$js_sources[$priority] = [];
@@ -1054,7 +1014,7 @@ function head_get_main_js() {
}
function format_js_if_exists($source) {
- $path_prefix = script_path();
+ $path_prefix = z_root();
if(strpos($source,'/') !== false) {
// The source is a known path on the system