/**
	 * Recursive XML Nodes Checking
	 *
	 * @param string $path xpath
	 * @param SLS_XMLToolBox $xml
	 */
	private function checkNode($path, $xml)
	{
		if (substr($path, strlen($path)-1, 1) != "/")
			$path .= "/";
		$childs = $xml->returnXpathQuery($path."*");
		//var_dump($childs->item(0)->getAttribute("isSecure")); exit;
		for ($i=0 ; $i<$childs->length ; $i++)		
		{
			$setAtt = array();
			$isSecure = (string)$childs->item($i)->getAttribute('isSecure');
			if ($isSecure != 'true' && $isSecure != 'false')
				$setAtt['isSecure'] = 'true';
				//array_push($arrayErrors, "The node ".$path.(string)$childs->item($i)->nodeName." should have the attribute 'isSecure' set to 'true' or 'false'");
			$js = (string)$childs->item($i)->getAttribute('js');
			if ($js != 'true' && $js != 'false')
				$setAtt['js'] = 'false';
				//array_push($arrayErrors, "The node ".$path.(string)$childs->item($i)->nodeName." should have the attribute 'js' set to 'true' or 'false'");
			
			if (!empty($setAtt))
				$xml->setTagAttributes($path.(string)$childs->item($i)->nodeName, $setAtt);
			
			if ($childs->item($i)->hasChildNodes()) 
			{
				if (is_object($childs->item($i)->childNodes->item(0)))
				{
					//var_dump(get_class($childs->item($i)->childNodes->item(0))); exit;
					if (get_class($childs->item($i)->childNodes->item(0)) !== "DOMText" && get_class($childs->item($i)->childNodes->item(0)) !== "DOMCdataSection")
						$xml = $this->checkNode($path.(string)$childs->item($i)->name, $xml);
				}
			}
		}
		return $xml;
		
	}
	public function action()
	{
		$user = $this->hasAuthorative();
		$xml = $this->getXML();
		$xml = $this->makeMenu($xml);
		$confirmation = $this->_http->getParam("confirm", 'post');
		$password = SLS_String::trimSlashesFromString($this->_http->getParam("password", 'post'));
		$login = SLS_String::trimSlashesFromString($this->_http->getParam("login", 'post'));
		$stepPassword = false;
		if ($confirmation == 'reset')
		{
			$stepPassword = true;
			if (!empty($password) && !empty($login))
			{
				$slsXml = $this->_generic->getCoreXML('sls');
				$passXML = array_shift($slsXml->getTags("//sls_configs/auth/users/user[@login='******' and @level='0']/@pass"));
				if (!empty($passXML) && $passXML == sha1($password))
				{
					
					 $paths = array(
						'actionsControllers',
					 	'staticsControllers',
					 	'componentsControllers',
						'viewsBody',
						'viewsHeaders',
					 	'viewsGenerics',
						'models',
						'modelsSql',
					 	'coreSlsModels',
					 	'coreSlsModelsSql',
						'actionLangs',
						'genericLangs',
						'plugins',
						'jsStatics',
						'jsDyn',
						'img',
						'css',
						'fonts',
						'configPlugins',
					 	'files',
					 	'cache',
					 	'logs'
					); 
					
					// Destroy Files
					foreach ($paths as $path)
					{
						if (!is_dir($this->_generic->getPathConfig($path)))
							continue;
						$files = scandir($this->_generic->getPathConfig($path));
						for($i=0;$i<$count=count($files);$i++)
						{
							if ($files[$i] != "." && $files[$i] != ".." && $files[$i] != ".svn")
								(is_file($this->_generic->getPathConfig($path).$files[$i])) ? @unlink($this->_generic->getPathConfig($path).$files[$i]) : $this->_generic->rm_recursive($this->_generic->getPathConfig($path).$files[$i]);							
						}
					}
					
					// Destroy xsl templates except __default
					$files = scandir($this->_generic->getPathConfig("viewsTemplates"));
					for($i=0;$i<$count=count($files);$i++)
					{
						if (!SLS_String::startsWith($files[$i],".") && $files[$i] != "__default.xsl" && is_file($this->_generic->getPathConfig("viewsTemplates").$files[$i]))
							@unlink($this->_generic->getPathConfig("viewsTemplates").$files[$i]);						
					}
					
					// Destroy Generics Translations
					$files = scandir($this->_generic->getPathConfig("coreGenericLangs"));
					for($i=0;$i<$count=count($files);$i++)
					{
						if ($files[$i] != "." && $files[$i] != ".." && $files[$i] != ".svn")
							(is_file($this->_generic->getPathConfig("coreGenericLangs").$files[$i])) ? @unlink($this->_generic->getPathConfig("coreGenericLangs").$files[$i]) : $this->_generic->rm_recursive($this->_generic->getPathConfig("coreGenericLangs").$files[$i]);
					}
					
					// Deploy the sls Generic En Lang
					@copy($this->_generic->getPathConfig('installDeployement')."Langs/Generics/generic.en.lang.php", $this->_generic->getPathConfig("coreGenericLangs")."generic.en.lang.php");
					
					// Update Controllers XML
					$controllersXML = $this->_generic->getControllersXML();
					$controllersXML->deleteTags("//controllers/controller[@side='user']");
										
					// Reset Metas
					$metasXML = new SLS_XMLToolBox(file_get_contents($this->_generic->getPathConfig("configSls")."metas.xml"));
					$slsControllers = $controllersXML->getTags("//controllers/controller[@side='sls']/@id");	
					$slsLangs = $controllersXML->getTags("//controllers/controller[@side='sls'][1]/scontrollers/scontroller[1]/scontrollerLangs/scontrollerLang/@lang");
					foreach ($slsControllers as $controller)
					{
						$slsActions = $controllersXML->getTags("//controllers/controller[@side='sls' and @id='".$controller."']/scontrollers/scontroller/@id");
						foreach ($slsActions as $slsAction)
						{
							foreach ($slsLangs as $lang)
							{
								$title = array_shift($metasXML->getTags("//sls_configs/action[@id='".$slsAction."']/title[@lang='".$lang."']"));
								$controllersXML->setTagAttributes("//controllers/controller[@side='sls' and @id='".$controller."']/scontrollers/scontroller[@id='".$slsAction."']/scontrollerLangs/scontrollerLang[@lang='".$lang."']", array("title"=>$title));
							}
							$controllersXML->deleteTagAttribute("//controllers/controller[@side='sls' and @id='".$controller."']/scontrollers/scontroller[@id='".$slsAction."']", "id");
						}
						$controllersXML->deleteTagAttribute("//controllers/controller[@side='sls' and @id='".$controller."']", "id");
					}
										
					// Reset Bo Access
					$controllersXML->deleteContentTag("//controllers/controller[@side='sls' and @name='SLS_Bo']/controllerLangs/controllerLang[@lang='en']");
					$controllersXML->saveXML($this->_generic->getPathConfig("configSecure")."controllers.xml",$controllersXML->getXML());
					$controllersXML->refresh();
					
					// Upate Others XML
					$configs = scandir($this->_generic->getPathConfig("configSecure"));
					foreach($configs as $config)
					{
						if (!SLS_String::startsWith($config,".") && $config != "controllers.xml" && $config != "paths.xml")
							@unlink($this->_generic->getPathConfig("configSecure").$config);
					}
					@copy($this->_generic->getPathConfig('installDeployement')."Configs/Site/cache.xml", $this->_generic->getPathConfig("configSecure")."cache.xml");
					@copy($this->_generic->getPathConfig('installDeployement')."Configs/Site/db.xml", $this->_generic->getPathConfig("configSecure")."db.xml");
					@copy($this->_generic->getPathConfig('installDeployement')."Configs/Site/mail.xml", $this->_generic->getPathConfig("configSecure")."mail.xml");
					@copy($this->_generic->getPathConfig('installDeployement')."Configs/Site/site.xml", $this->_generic->getPathConfig("configSecure")."site.xml");
					@copy($this->_generic->getPathConfig('installDeployement')."Configs/Site/project.xml", $this->_generic->getPathConfig("configSecure")."project.xml");
					
					// Reset the SLS Config Files					
					$xmls = $this->_generic->recursiveReadDir($this->_generic->getPathConfig('installDeployement')."Configs/Sls/", array(), array("xml","json"));
					foreach ($xmls as $file)
					{
						$fileName = SLS_String::substrAfterLastDelimiter($file, "/");
						@unlink($this->_generic->getPathConfig("configSls").$fileName);
						@copy($file, $this->_generic->getPathConfig("configSls").$fileName);
					}
					
					// Reset Plugins Config
					$xmls = $this->_generic->recursiveReadDir($this->_generic->getPathConfig('installDeployement')."Configs/Plugins/", array(), array("xml"));
					foreach ($xmls as $file)
					{
						$fileName = SLS_String::substrAfterLastDelimiter($file, "/");
						@copy($file, $this->_generic->getPathConfig("configPlugins").$fileName);
					}
					
					// Reset session
					$this->_generic->getObjectSession()->destroy();
					 
					header("Location: /");
					exit; 
				}
			}
		}
		$xml->addFullTag('stepPassword', ($stepPassword) ? 'yes' : 'no', true);
		$this->saveXML($xml);
	}
	public function action()
	{
		$user 	= $this->hasAuthorative();
		$xml 	= $this->getXML();
		$xml	= $this->makeMenu($xml);
		$siteXML = $this->_generic->getSiteXML();
		
		$errors = array();
		$aliases = array();
		$domains = array();
		
		// Prod Deployment		
		$env = $this->_http->getParam("Env");
		if (empty($env))
			$env = "prod";
		$finalFile = ($this->_http->getParam("ProdDeployment") == "true") ? "site_".$env.".xml" : "site.xml";
		$isInBatch = ($this->_http->getParam("CompleteBatch") == "true") ? true : false;
		$xml->addFullTag("is_batch",($isInBatch) ? "true" : "false",true);
		$xml->addFullTag("is_prod",($this->_http->getParam("ProdDeployment") == "true") ? "true" : "false",true);
		$xml->addFullTag("env",$env,true);
		
		// Get default values
		if ($this->_http->getParam("ProdDeployment") == "true" && file_exists($this->_generic->getRoot().$this->_generic->getPathConfig("configSecure")."/site_".$env.".xml"))
		{			
			$xmlSite = new SLS_XMLToolbox(file_get_contents($this->_generic->getRoot().$this->_generic->getPathConfig("configSecure")."/site_".$env.".xml"));
			
			$defaultDomain 				= $xmlSite->getTag("//configs/domainName/domain");
			$defaultProject				= $xmlSite->getTag("//configs/projectName");
			$defaultVersion				= $xmlSite->getTag("//configs/versionName");
			$defaultExtension			= $xmlSite->getTag("//configs/defaultExtension");
			$defaultCharset				= $xmlSite->getTag("//configs/defaultCharset");
			$defaultDoctype				= $xmlSite->getTag("//configs/defaultDoctype");
			$timezone_area				= SLS_String::substrBeforeFirstDelimiter($xmlSite->getTag("//configs/defaultTimezone"),"/");
			$timezone_city				= SLS_String::substrAfterFirstDelimiter($xmlSite->getTag("//configs/defaultTimezone"),"/"); 
			$defaultLang 				= $xmlSite->getTag("//configs/defaultLang");
			$defaultdomainSessionShare 	= $xmlSite->getTag("//configs/domainSession");
		}
		else
		{
			$defaultDomain 				= $this->_generic->getSiteConfig("domainName");
			$defaultProject				= $this->_generic->getSiteConfig("projectName");
			$defaultVersion				= $this->_generic->getSiteConfig("versionName"); 
			$defaultExtension			= $this->_generic->getSiteConfig("defaultExtension");
			$defaultCharset				= $this->_generic->getSiteConfig("defaultCharset");
			$defaultDoctype				= $this->_generic->getSiteConfig("defaultDcotype");
			$timezone_area				= SLS_String::substrBeforeFirstDelimiter($this->_generic->getSiteConfig("defaultTimezone"),"/");
			$timezone_city				= SLS_String::substrAfterFirstDelimiter($this->_generic->getSiteConfig("defaultTimezone"),"/"); 
			$defaultLang 				= $this->_generic->getSiteConfig("defaultLang");
			$defaultdomainSessionShare 	= $this->_generic->getSiteConfig("domainSession");
		}
		
		$reload 			= $this->_http->getParam("reload");

		$charsetsXML = new SLS_XMLToolBox(file_get_contents($this->_generic->getPathConfig('configSls')."charset.xml"));
		$charsets = array_map('strtoupper', $charsetsXML->getTags('//sls_configs/charset/code'));
		$handle2 = file_get_contents($this->_generic->getPathConfig("configSls").'timezone.xml');
		$xml->addFullTag("timezones", SLS_String::substrBeforeLastDelimiter(SLS_String::substrAfterFirstDelimiter($handle2, "<sls_configs>"), "</sls_configs>"), false);
		
		$langs = $this->_generic->getSiteXML()->getTags('//configs/langs/name');
			
		if ($reload == "true")
		{			
			$domains = 	$siteXML->getTagsAttributes("//configs/domainName/domain",array("alias"));			
			for($i=0 ; $i<$count=count($domains) ; $i++)
				array_push($aliases,$domains[$i]["attributes"][0]["value"]);
			
			// Get New Parameters
			$exportConfig	= $this->_http->getParam('export');
			
			$domains = array();
			foreach($aliases as $alias)
			{
				$domain = SLS_String::trimSlashesFromString($this->_http->getParam("domain_".$alias, "post"));
				if (SLS_String::endsWith(trim($domain),"/"))
					$domain = SLS_String::substrBeforeLastDelimiter(trim($domain),"/");
				$domains[$alias]= $domain;
			}	
			
			$postProject		= SLS_String::trimSlashesFromString($this->_http->getParam("project", "post"));
			$postVersion		= SLS_String::trimSlashesFromString($this->_http->getParam("version", "post"));
			$postExtension 		= SLS_String::trimSlashesFromString($this->_http->getParam("extension", "post"));
			$postCharset		= SLS_String::trimSlashesFromString($this->_http->getParam("charset", "post"));
			$postDoctype		= SLS_String::trimSlashesFromString($this->_http->getParam("doctype", "post"));
			$timezone_area		= SLS_String::trimSlashesFromString($this->_http->getParam('settings_timezone_area'));
			$timezone_city		= SLS_String::trimSlashesFromString($this->_http->getParam('settings_timezone_area_'.$timezone_area));
			$postLang			= SLS_String::trimSlashesFromString($this->_http->getParam("lang", "post"));
			$domainSessionShare	= SLS_String::trimSlashesFromString($this->_http->getParam("domainSession", "post"));

			if ($this->_http->getParam("domainSessionActive") == "")
				$domainSessionShare = "";		

			foreach($domains as $alias => $domain)
				if (empty($domain))
					array_push($errors, "The Domain name is required for the domain alias ".$alias);
			if (empty($postProject))
				array_push($errors, "The project Name is required");
			if (empty($postVersion))
				array_push($errors, "The version Name is required");
			if (empty($postExtension))
				array_push($errors, "The extension is required");
			if (!in_array($postCharset, $charsets))
				array_push($errors, "The Charset selected is incorrect");
			if (empty($postDoctype))
				array_push($errors, "The doctype is required");
			if (empty($timezone_area) || empty($timezone_city))
				array_push($errors,"You must choose your default timezone");
			if (!in_array($postLang, $langs))
				array_push($errors, "The Default lang selected is incorrect");
			if ($this->_http->getParam("domainSessionActive") != "" && empty($domainSessionShare))
				array_push($errors,"You need to fill the domain pattern from which you want to share session");
			if (empty($errors))
			{
				foreach($domains as $alias => $domain)
					$siteXML->setTag("//configs/domainName/domain[@alias='".$alias."']", $domain, true);
				if ($defaultProject != $postProject)
					 $siteXML->setTag("//configs/projectName", $postProject, true);
				if ($defaultVersion != $postVersion)
					 $siteXML->setTag("//configs/versionName", $postVersion, true);
				if ($defaultExtension != $postExtension)
					 $siteXML->setTag("//configs/defaultExtension", $postExtension, true);
				if ($defaultCharset != $postCharset)
					 $siteXML->setTag("//configs/defaultCharset", $postCharset, true);
				if ($defaultDoctype != $postDoctype)
					 $siteXML->setTag("//configs/defaultDoctype", $postDoctype, true);
				if ($defaultTimezone != $timezone_area."/".$timezone_city)
					 $siteXML->setTag("//configs/defaultTimezone", $timezone_area."/".$timezone_city, true);
				if ($defaultLang != $postLang)
					 $siteXML->setTag("//configs/defaultLang", $postLang, true);
				if ($defaultdomainSessionShare != $domainSessionShare)
					$siteXML->setTag("//configs/domainSession", $domainSessionShare, true);
				if ($exportConfig == "on")
				{
					$date = gmdate('D, d M Y H:i:s');
					header("Content-Type: text/xml"); 
					header('Content-Disposition: attachment; filename='.$finalFile);
					header('Last-Modified: '.$date. ' GMT');
					header('Expires: ' .$date);
					// For This F**k'in Browser
					if(preg_match('/msie|(microsoft internet explorer)/i', $_SERVER['HTTP_USER_AGENT']))
					{
						header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
						header('Pragma: public');
					}
					else
						header('Pragma: no-cache');
					
					print($siteXML->getXML());
					exit; 
				}
				else
				{
					$siteXML->refresh();
					@file_put_contents($this->_generic->getPathConfig("configSecure").$finalFile, $siteXML->getXML());					
					if ($isInBatch)
						$this->_generic->forward("SLS_Bo","DataBaseSettings",array(array("key"=>"ProdDeployment","value"=>"true"),array("key"=>"CompleteBatch","value"=>"true"),array("key"=>"Env","value"=>$env)));
					else if ($this->_http->getParam("ProdDeployment") == "true")
						$this->_generic->forward("SLS_Bo","ProductionDeployment");
				}
			}
			else 
			{
				$xml->startTag('errors');
				foreach ($errors as $error)				
					$xml->addFullTag('error', $error);				
				$xml->endTag('errors');
			}
	
		}
		$this->_generic->eraseCache('Site');
		$xml->startTag("charsets");
		foreach ($charsets as $charset)
			$xml->addFullTag('charset', $charset, true);
		$xml->endTag("charsets");
		
		$xml->startTag("langs");
			foreach ($langs as $lang)
			$xml->addFullTag('lang', $lang, true);
		$xml->endTag("langs");
		
		$xmlSite = (file_exists($this->_generic->getRoot().$this->_generic->getPathConfig("configSecure")."/site_".$env.".xml")) ? new SLS_XMLToolbox(file_get_contents($this->_generic->getRoot().$this->_generic->getPathConfig("configSecure")."/site_".$env.".xml")) : null;
		$xml->startTag("current_values");
			if ($this->_http->getParam("ProdDeployment") == "true" && file_exists($this->_generic->getRoot().$this->_generic->getPathConfig("configSecure")."/site_".$env.".xml"))
				$domains = 	$xmlSite->getTagsAttributes("//configs/domainName/domain",array("alias","default","lang"));
			else
				$domains = 	$siteXML->getTagsAttributes("//configs/domainName/domain",array("alias","default","lang"));
			
			$xml->startTag("domains");
			for($i=0 ; $i<$count=count($domains) ; $i++)
			{
				$alias = $domains[$i]["attributes"][0]["value"];
				$default = ($domains[$i]["attributes"][1]["value"] == 1) ? true : false;
				$domain_lang = $domains[$i]["attributes"][2]["value"];
				$xml->startTag("domain");
					$xml->addFullTag("alias",$alias,true);
					$xml->addFullTag("default",($default) ? "true" : "false",true);
					$xml->addFullTag("domain",$domains[$i]["value"],true);
					$xml->addFullTag("lang",$domain_lang,true);
					$xml->addFullTag("delete_url",$this->_generic->getFullPath("SLS_Bo","DeleteDomain",array(array("key"=>"alias","value"=>$alias))),true);
				$xml->endTag("domain");
			}
			$xml->endTag("domains");
			$xml->addFullTag("project", ($this->_http->getParam("ProdDeployment") == "true" && file_exists($this->_generic->getRoot().$this->_generic->getPathConfig("configSecure")."/site_".$env.".xml")) ? $xmlSite->getTag("//configs/projectName") : $this->_generic->getSiteConfig("projectName"), true);
			$xml->addFullTag("version", ($this->_http->getParam("ProdDeployment") == "true" && file_exists($this->_generic->getRoot().$this->_generic->getPathConfig("configSecure")."/site_".$env.".xml")) ? $xmlSite->getTag("//configs/versionName") : $this->_generic->getSiteConfig("versionName"), true);
			$xml->addFullTag("extension", ($this->_http->getParam("ProdDeployment") == "true" && file_exists($this->_generic->getRoot().$this->_generic->getPathConfig("configSecure")."/site_".$env.".xml")) ? $xmlSite->getTag("//configs/defaultExtension") :$this->_generic->getSiteConfig("defaultExtension"), true);
			$xml->addFullTag("charset", ($this->_http->getParam("ProdDeployment") == "true" && file_exists($this->_generic->getRoot().$this->_generic->getPathConfig("configSecure")."/site_".$env.".xml")) ? $xmlSite->getTag("//configs/defaultCharset") :$this->_generic->getSiteConfig("defaultCharset"), true);
			$xml->addFullTag("doctype", ($this->_http->getParam("ProdDeployment") == "true" && file_exists($this->_generic->getRoot().$this->_generic->getPathConfig("configSecure")."/site_".$env.".xml")) ? $xmlSite->getTag("//configs/defaultDoctype") :$this->_generic->getSiteConfig("defaultDoctype"), true);
			$xml->addFullTag("lang", ($this->_http->getParam("ProdDeployment") == "true" && file_exists($this->_generic->getRoot().$this->_generic->getPathConfig("configSecure")."/site_".$env.".xml")) ? $xmlSite->getTag("//configs/defaultLang") :$this->_generic->getSiteConfig("defaultLang"), true);
			$xml->addFullTag("domain_session", ($this->_http->getParam("ProdDeployment") == "true" && file_exists($this->_generic->getRoot().$this->_generic->getPathConfig("configSecure")."/site_".$env.".xml")) ? $xmlSite->getTag("//configs/domainSession") : ((is_null($this->_generic->getSiteConfig("domainSession"))) ? "" : $this->_generic->getSiteConfig("domainSession")), true);
			$xml->startTag("timezone");
				$xml->addFullTag("area",$timezone_area,true);
				$xml->addFullTag("city",$timezone_city,true);
			$xml->endTag("timezone");
		$xml->endTag("current_values");
		
		$xml->addFullTag("add_domain_url",$this->_generic->getFullPath("SLS_Bo","AddDomain"),true);
		
		$environments = $this->getEnvironments();
		$xml->startTag("environments");
		foreach($environments as $environment)
			$xml->addFullTag("environment",$environment,true);
		$xml->endTag("environments");
		
		$this->saveXML($xml);		
	}
	/**
	 * Format recordsets
	 * 
	 * @param SLS_XMLToolBox $xml
	 * @param array PDO $recordsets
	 * @param string $fkRecursiveExists
	 * @return SLS_XMLToolBox $xml modified
	 */
	public function formatRecordsets($xml,$recordsets,$fkRecursiveExists="")
	{	
		$xml->startTag("entities");
		for($i=0 ; $i<$count=count($recordsets) ; $i++)
		{
			$xml->startTag("entity",array("gap" => $this->_gap));
			foreach($recordsets[$i] as $key => $value)
			{	
				if (array_key_exists($key,$this->_columns) && ($this->_columns[$key]["list"] == "true" || $key == $this->_object->getPrimaryKey()))
				{
					$hashExists = $this->_xmlFilter->getTag("//sls_configs/entry[@table='".strtolower($this->_db_alias."_".$this->_columns[$key]["table"])."' and @column='".$key."' and @filter='hash']/@hash");
					
					if (!empty($this->_columns[$key]["specific_type"]))
					{
						switch($this->_columns[$key]["specific_type"])
						{
							case "email":
								if (SLS_String::validateEmail($value))
									$value = "<a href='mailto:".$value."' target='_blank' class='sls-bo-color-text'>".$value."</a>";
								break;
							case "url":
								if (SLS_String::isValidUrl($value))
									$value = "<a href='".$value."' target='_blank' class='sls-bo-color-text'>".SLS_String::substrAfterLastDelimiter($value,"://")."</a>";
								break;
							case "file";
								switch($this->_columns[$key]["specific_type_extended"])
								{
									case "all":
										if (!empty($value) && file_exists($this->_generic->getPathConfig("files").$value))
											$value = "<a href='".SLS_String::getUrlFile($value)."' target='_blank' class='sls-bo-color-text'>".SLS_String::substrAfterLastDelimiter($value,"/")."</a>";
										break;
									case "img":
										if (!empty($value) && file_exists($this->_generic->getPathConfig("files").$value))
											$value = "<a href='".SLS_String::getUrlFile($value)."' target='_blank'><img class='sls-image' sls-image-src='".((!empty($this->_columns[$key]["image_thumb"])) ? SLS_String::getUrlFileImg($value,$this->_columns[$key]["image_thumb"]) : SLS_String::getUrlFile($value))."' alt='".SLS_String::substrAfterLastDelimiter($value,"/")."' title='".SLS_String::substrAfterLastDelimiter($value,"/")."' /></a>";
										break;
								}
								break;
							case "color":
								$rgb = SLS_String::hex2RGB($value);
								$value = "<div class='sls-bo-box-color' style='color:".((((0.213 * $rgb["red"]) + (0.715 * $rgb["green"]) + (0.072 * $rgb["blue"])) < 0.5) ? "#FFF" : "#000").";background-color:#".$value."'>#".$value."</div>";
								break;
						}
					}
					if ($this->_columns[$key]["html_type"] == "input_textarea")
						$value = "<p>".SLS_String::trimStringToLength(strip_tags($value),150)."</p>";
					if (!empty($hashExists))
						$value = "********";
						
					$xml->addFullTag($key,$value,true);
				}
			}			
			if (!empty($fkRecursiveExists))
			{
				$this->_gap++;
				$xml = $this->getFkChildrens($xml,$fkRecursiveExists,$recordsets[$i]->{$this->_object->getPrimaryKey()});
				$this->_gap--;
			}
			$xml->endTag("entity");
		}
		$xml->endTag("entities");
		
		return $xml;
	}