h-source-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[H-source-users] [PATCH] updating url::getroot


From: Yuchen Pei
Subject: [H-source-users] [PATCH] updating url::getroot
Date: Wed, 22 Sep 2021 17:13:49 +1000
User-agent: mu4e 1.4.13; emacs 27.2

Will push to the development branch if no opposition.

From 675bcfe18906171f6fb00dd2e27d861064b28ab8 Mon Sep 17 00:00:00 2001
From: Yuchen Pei <hi@ypei.me>
Date: Wed, 22 Sep 2021 17:01:58 +1000
Subject: [PATCH] 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(-)

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;
        }
 
-- 
2.33.0


--
Best,
Yuchen

PGP Key: 47F9 D050 1E11 8879 9040  4941 2126 7E93 EF86 DFD0
          <https://ypei.me/assets/ypei-pubkey.txt>

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]