Ver código fonte

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

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@853 a333f486-631f-4898-b8df-5754b55c2be0
dflaven 14 anos atrás
pai
commit
e63a84eecc
2 arquivos alterados com 18 adições e 1 exclusões
  1. 17 0
      application/utils.inc.php
  2. 1 1
      core/dbobject.class.php

+ 17 - 0
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:

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