Browse Source

Bug fix: protect against a non existing Contact class (a rather drastic iTop customization!)

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@4559 a333f486-631f-4898-b8df-5754b55c2be0
dflaven 8 years ago
parent
commit
4544235eff
2 changed files with 7 additions and 3 deletions
  1. 6 2
      application/forms.class.inc.php
  2. 1 1
      core/userrights.class.inc.php

+ 6 - 2
application/forms.class.inc.php

@@ -1438,8 +1438,12 @@ class RunTimeIconSelectionField extends DesignerIconSelectionField
 
 	public function GetDefaultValue($sClass = 'Contact')
 	{
-		$sIconPath = MetaModel::GetClassIcon($sClass, false);
-		$sIcon = str_replace(utils::GetAbsoluteUrlModulesRoot(), '', $sIconPath);
+		$sIcon = '';
+		if (MetaModel::IsValidClass($sClass))
+		{
+			$sIconPath = MetaModel::GetClassIcon($sClass, false);
+			$sIcon = str_replace(utils::GetAbsoluteUrlModulesRoot(), '', $sIconPath);
+		}
 		return $sIcon;	
 	}
 }

+ 1 - 1
core/userrights.class.inc.php

@@ -245,7 +245,7 @@ abstract class User extends cmdbAbstractObject
 	{
 		if (is_null($this->oContactObject))
 		{
-			if ($this->Get('contactid') != 0)
+			if (MetaModel::IsValidAttCode(get_class($this), 'contactid') && ($this->Get('contactid') != 0))
 			{
 				$this->oContactObject = MetaModel::GetObject('Contact', $this->Get('contactid'));
 			}