From 0dc15ea95bfd1d5b6da0b96f572784bd19473121 Mon Sep 17 00:00:00 2001 From: Znote Date: Mon, 24 Oct 2016 01:51:52 +0200 Subject: [PATCH] Using a config variable to define protocol and domain name instead of $_SERVER as it seems inconsistent. fix #182 and #225 --- config.php | 1 + engine/function/general.php | 5 +---- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/config.php b/config.php index eacfda1..7a309b8 100644 --- a/config.php +++ b/config.php @@ -14,6 +14,7 @@ $config['site_title'] = 'Znote AAC'; $config['site_title_context'] = 'Because open communities are good communities. :3'; + $config['site_url'] = "http://znote.dev"; // Path to server folder without / Example: C:\Users\Alvaro\Documents\GitHub\forgottenserver $config['server_path'] = ''; diff --git a/engine/function/general.php b/engine/function/general.php index b11edad..0932f51 100644 --- a/engine/function/general.php +++ b/engine/function/general.php @@ -116,11 +116,8 @@ function calculate_discount($orig, $new) { // Proper URLs function url($path = false) { - $protocol = (!empty($_SERVER['HTTPS']) ? 'https' : 'http') . '://'; - $domain = $_SERVER['SERVER_NAME'] . ($_SERVER['SERVER_PORT'] != 80 ? ':' . $_SERVER['SERVER_PORT'] : null); $folder = dirname($_SERVER['SCRIPT_NAME']); - - return $protocol . $domain . ($folder == '/' ? '' : $folder) . '/' . $path; + return config('site_url') . '/' . $path; } function getCache() {