- Fixed the URL to the portal hyperlink (hyperlink(portal)) in email notifications.

SVN:trunk[853]
This commit is contained in:
Denis Flaven
2010-09-13 18:55:30 +00:00
parent 2e06fae105
commit 822c79ce5e
2 changed files with 18 additions and 1 deletions

View File

@@ -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:

View File

@@ -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)'] = '<a href="'.$sToPortal.'">'.$this->GetName().'</a>';
$aScalarArgs[$sArgName.'->name()'] = $this->GetName();