issue #108: fixing dirname() for Windows when used for URLs instead of actual dirs

This commit is contained in:
Pepijn Over 2014-07-28 10:25:41 +02:00
parent b45c93f254
commit 3cc2c26abd
2 changed files with 5 additions and 0 deletions

View File

@ -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 <https://www.smsglobal.com/>.
* Support for Danish SMS provider Smsit <http://www.smsit.dk/>

View File

@ -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 .= '?';