diff --git a/core/util.inc.php b/core/util.inc.php
index 029fcee0..bed0794f 100644
--- a/core/util.inc.php
+++ b/core/util.inc.php
@@ -402,10 +402,18 @@ function modify_url($url, $changes) {
* @return string
*/
function make_http(/*string*/ $link) {
- if(strpos($link, "ttp://") > 0) return $link;
- if(strlen($link) > 0 && $link[0] != '/') $link = get_base_href().'/'.$link;
- $link = "http://".$_SERVER["HTTP_HOST"].$link;
+ if(strpos($link, "ttp://") > 0) {
+ return $link;
+ }
+
+ if(strlen($link) > 0 && $link[0] != '/') {
+ $link = get_base_href() . '/' . $link;
+ }
+
+ $protocol = is_https_enabled() ? "https://" : "http://";
+ $link = $protocol . $_SERVER["HTTP_HOST"] . $link;
$link = str_replace("/./", "/", $link);
+
return $link;
}
@@ -549,6 +557,15 @@ function captcha_check() {
* Misc *
\* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+/**
+ * Check if HTTPS is enabled for the server.
+ *
+ * @return bool True if HTTPS is enabled
+ */
+function is_https_enabled() {
+ return (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off');
+}
+
/**
* Get MIME type for file
*
diff --git a/ext/qr_code/theme.php b/ext/qr_code/theme.php
index c0600f23..90221b26 100644
--- a/ext/qr_code/theme.php
+++ b/ext/qr_code/theme.php
@@ -5,8 +5,11 @@ class QRImageTheme extends Themelet {
*/
public function links_block($link) {
global $page;
+
+ $protocol = is_https_enabled() ? "https://" : "http://";
+
$page->add_block( new Block(
- "QR Code","
","left",50));
+ "QR Code","
","left",50));
}
}