From 822c79ce5e557babf33a3ed03165ac08fb4838c1 Mon Sep 17 00:00:00 2001 From: Denis Flaven Date: Mon, 13 Sep 2010 18:55:30 +0000 Subject: [PATCH] - Fixed the URL to the portal hyperlink (hyperlink(portal)) in email notifications. SVN:trunk[853] --- application/utils.inc.php | 17 +++++++++++++++++ core/dbobject.class.php | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/application/utils.inc.php b/application/utils.inc.php index db655a948..3ab30d204 100644 --- a/application/utils.inc.php +++ b/application/utils.inc.php @@ -292,6 +292,23 @@ class utils return $sAbsoluteUrl; } + /** + * Returns the absolute URL to the server's root path + * @param $bForceHTTPS bool True to force HTTPS, false otherwise + * @return string The absolute URL to the server's root, without the first slash + */ + static public function GetAbsoluteUrlRoot($bForceHTTPS = false) + { + $sAbsoluteUrl = self::GetAbsoluteUrl(false, $bForceHTTPS); // False => Don't get the query string + $sServerPos = 3 + strpos($sAbsoluteUrl, '://'); + $iFirstSlashPos = strpos($sAbsoluteUrl, '/', $sServerPos); + if ($iFirstSlashPos !== false) + { + $sAbsoluteUrl = substr($sAbsoluteUrl, 0, $iFirstSlashPos); // remove the current page, keep just the path, without the first / + } + return $sAbsoluteUrl; + } + /** * Tells whether or not log off operation is supported. * Actually in only one case: diff --git a/core/dbobject.class.php b/core/dbobject.class.php index 5bcee5c46..8c8ed83a4 100644 --- a/core/dbobject.class.php +++ b/core/dbobject.class.php @@ -1126,7 +1126,7 @@ abstract class DBObject $aScalarArgs[$sArgName.'->object()'] = $this; $aScalarArgs[$sArgName.'->hyperlink()'] = $this->GetHyperlink(); // #@# Prototype for a user portal - to be dehardcoded later - $sToPortal = utils::GetAbsoluteUrlPath().'portal/index.php?operation=details&id='.$this->GetKey(); + $sToPortal = utils::GetAbsoluteUrlRoot().'/portal/index.php?operation=details&id='.$this->GetKey(); $aScalarArgs[$sArgName.'->hyperlink(portal)'] = ''.$this->GetName().''; $aScalarArgs[$sArgName.'->name()'] = $this->GetName();