aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--boot.php5
-rw-r--r--include/plugin.php44
2 files changed, 7 insertions, 42 deletions
diff --git a/boot.php b/boot.php
index 15f096d87..ff73c0146 100644
--- a/boot.php
+++ b/boot.php
@@ -915,9 +915,14 @@ class App {
if ((x($_SERVER, 'QUERY_STRING')) && substr($_SERVER['QUERY_STRING'], 0, 2) === "q=") {
self::$query_string = str_replace(['<', '>'], ['&lt;', '&gt;'], substr($_SERVER['QUERY_STRING'], 2));
+
// removing trailing / - maybe a nginx problem
if (substr(self::$query_string, 0, 1) == "/")
self::$query_string = substr(self::$query_string, 1);
+
+ // trim trailing '&' if no extra args are present
+ self::$query_string = rtrim(self::$query_string, '&');
+
// change the first & to ?
self::$query_string = preg_replace('/&/', '?', self::$query_string, 1);
}
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