From f17018962bfc6cc38a0b2ccc5f40a939f5fe49fa Mon Sep 17 00:00:00 2001 From: Damien Zammit Date: Tue, 10 Aug 2021 19:16:48 +1000 Subject: Use relative URLs instead of hardcoding domain --- h-source/Library/Helper/List.php | 2 +- h-source/Library/Helper/Menu.php | 2 +- h-source/Library/Helper/Popup.php | 4 ++-- h-source/Library/Theme.php | 6 ++---- h-source/Library/Url.php | 4 +--- 5 files changed, 7 insertions(+), 11 deletions(-) (limited to 'h-source/Library') diff --git a/h-source/Library/Helper/List.php b/h-source/Library/Helper/List.php index ba59643..57aeeff 100755 --- a/h-source/Library/Helper/List.php +++ b/h-source/Library/Helper/List.php @@ -73,7 +73,7 @@ class Helper_List extends Helper_Html { //get the generic language class $this->strings = Factory_Strings::generic(Params::$language); - $baseUrl = 'http://'.DOMAIN_NAME.'/Public/Img/Icons/elementary_2_5/'; + $baseUrl = '/Public/Img/Icons/elementary_2_5/'; //set the files of the images $this->submitImages = array( diff --git a/h-source/Library/Helper/Menu.php b/h-source/Library/Helper/Menu.php index 8fd4bf4..86ee24a 100755 --- a/h-source/Library/Helper/Menu.php +++ b/h-source/Library/Helper/Menu.php @@ -36,7 +36,7 @@ class Helper_Menu extends Helper_Html public function __construct() { - $baseUrl = "http://".DOMAIN_NAME.'/Public/Img/Icons/elementary_2_5/'; + $baseUrl = '/Public/Img/Icons/elementary_2_5/'; //get the generic language class $this->strings = Factory_Strings::generic(Params::$language); diff --git a/h-source/Library/Helper/Popup.php b/h-source/Library/Helper/Popup.php index 18bb00d..43140fe 100755 --- a/h-source/Library/Helper/Popup.php +++ b/h-source/Library/Helper/Popup.php @@ -133,10 +133,10 @@ class Helper_Popup extends Helper_Html { $returnString .= "\n"; } if (count($this->popupArray)>0) { - $returnString .= "\n"; + $returnString .= "\n"; } } return $returnString; } -} \ No newline at end of file +} diff --git a/h-source/Library/Theme.php b/h-source/Library/Theme.php index 10c0fce..fe938ee 100755 --- a/h-source/Library/Theme.php +++ b/h-source/Library/Theme.php @@ -39,11 +39,9 @@ class Theme { function __construct($controller) { - $protocol = Params::$useHttps ? "https" : "http"; - $this->controller = $controller; - $this->baseUrl = MOD_REWRITE_MODULE === true ? "$protocol://" . DOMAIN_NAME : "$protocol://" . DOMAIN_NAME . '/index.php'; - $this->baseUrlSrc = "$protocol://" . DOMAIN_NAME; + $this->baseUrl = MOD_REWRITE_MODULE === true ? '': '/index.php'; + $this->baseUrlSrc = ''; } diff --git a/h-source/Library/Url.php b/h-source/Library/Url.php index efb8e6e..5124047 100755 --- a/h-source/Library/Url.php +++ b/h-source/Library/Url.php @@ -27,9 +27,7 @@ class Url { //get the url starting from the root folder public static function getRoot($pathFromRootFolder = null) { - $protocol = Params::$useHttps ? "https" : "http"; - - $url = MOD_REWRITE_MODULE === true ? "$protocol://" . DOMAIN_NAME . '/' . $pathFromRootFolder : "$protocol://" . DOMAIN_NAME . '/index.php/' . $pathFromRootFolder; + $url = MOD_REWRITE_MODULE === true ? '/' . $pathFromRootFolder : '/index.php/' . $pathFromRootFolder; return $url; } -- cgit v1.2.3 From ad2cfad59b62b1b188d76d83ebf89b3dc69787f3 Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Thu, 9 Sep 2021 17:33:45 +1000 Subject: minor changes to dispel php notices - end(): https://stackoverflow.com/questions/4636166/only-variables-should-be-passed-by-reference - get_magic_quotes_gpc() always returns false: https://www.php.net/manual/en/function.get-magic-quotes-gpc.php - __autoload(): https://stackoverflow.com/questions/50780678/deprecated-autoload-is-deprecated-use-spl-autoload-register --- h-source/Library/Call.php | 8 +++++--- h-source/Library/Functions.php | 5 +---- 2 files changed, 6 insertions(+), 7 deletions(-) (limited to 'h-source/Library') diff --git a/h-source/Library/Call.php b/h-source/Library/Call.php index c75508b..a9145c2 100755 --- a/h-source/Library/Call.php +++ b/h-source/Library/Call.php @@ -257,7 +257,7 @@ function getQueryString() return ''; } -function __autoload($className) +function autoloader($className) { $backupName = $className; @@ -290,6 +290,7 @@ function __autoload($className) } } +spl_autoload_register('autoloader'); try { @@ -324,7 +325,8 @@ try { //load the files defined inside Config/Autoload.php foreach (Autoload::$files as $file) { - $ext = strtolower(end(explode('.', $file))); + $parts = explode('.', $file); + $ext = strtolower(end($parts)); $path = ROOT . DS . APPLICATION_PATH . DS . 'Include' . DS . $file; if (file_exists($path) and $ext === 'php') { @@ -354,4 +356,4 @@ try { echo '
Message: '.$e->getMessage().'
'; -} \ No newline at end of file +} diff --git a/h-source/Library/Functions.php b/h-source/Library/Functions.php index 1477680..e0e77bf 100755 --- a/h-source/Library/Functions.php +++ b/h-source/Library/Functions.php @@ -107,9 +107,6 @@ SANITIZE DEEP */ function stripslashesDeep($value) { - if(get_magic_quotes_gpc()) {#if stripslashes - return array_map('stripslashes', $value); - } return $value; } @@ -304,4 +301,4 @@ function xml_encode($string) } return strtr($string, $trans); -} \ No newline at end of file +} -- cgit v1.2.3 From 675bcfe18906171f6fb00dd2e27d861064b28ab8 Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Wed, 22 Sep 2021 17:01:58 +1000 Subject: updating url::getroot otherwise things may look weird e.g. urls in confirmation email would start with `/` --- h-source/Library/Url.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'h-source/Library') diff --git a/h-source/Library/Url.php b/h-source/Library/Url.php index 5124047..efb8e6e 100755 --- a/h-source/Library/Url.php +++ b/h-source/Library/Url.php @@ -27,7 +27,9 @@ class Url { //get the url starting from the root folder public static function getRoot($pathFromRootFolder = null) { - $url = MOD_REWRITE_MODULE === true ? '/' . $pathFromRootFolder : '/index.php/' . $pathFromRootFolder; + $protocol = Params::$useHttps ? "https" : "http"; + + $url = MOD_REWRITE_MODULE === true ? "$protocol://" . DOMAIN_NAME . '/' . $pathFromRootFolder : "$protocol://" . DOMAIN_NAME . '/index.php/' . $pathFromRootFolder; return $url; } -- cgit v1.2.3