From 3cc2c26abd598ce1d3a36219a0e52209fb847aa5 Mon Sep 17 00:00:00 2001 From: Pepijn Over Date: Mon, 28 Jul 2014 10:25:41 +0200 Subject: [PATCH] issue #108: fixing dirname() for Windows when used for URLs instead of actual dirs --- CHANGELOG.rst | 1 + src/includes/functions.inc.php | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index b19d80a1..2346a114 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -15,6 +15,7 @@ not yet released * #103: Added Russian translation. * #105: Fixing check for websites with unverified SSL certificates. * #107: Fixing update job for Synology DSM Task Scheduler. +* #108: URLs on Windows contained both back- and forward slashes. * #111: Generated urls for non-default ports included the port twice. * #110: Support for SMSGlobal SMS gateway . * Support for Danish SMS provider Smsit diff --git a/src/includes/functions.inc.php b/src/includes/functions.inc.php index 7caf85ae..6178e1e3 100644 --- a/src/includes/functions.inc.php +++ b/src/includes/functions.inc.php @@ -467,7 +467,11 @@ function psm_build_sms() { */ function psm_build_url($params = array(), $urlencode = true, $htmlentities = true) { $url = ($_SERVER['SERVER_PORT'] == 443 ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST']; + + // on Windows, dirname() adds both back- and forward slashes (http://php.net/dirname). + // for urls, we only want the forward slashes. $url .= dirname($_SERVER['SCRIPT_NAME']) . '/'; + $url = str_replace('\\', '', $url); if($params != null) { $url .= '?';