コード例 #1
0
	public function action()
	{
		$user 	= $this->hasAuthorative();
		$xml 	= $this->getXML();
		$xml	= $this->makeMenu($xml);
		
		$env = $this->_http->getParam("Env");
		if (empty($env))
			$env = "prod";
		
		if ($this->_http->getParam("ProdDeployment") == "true" && file_exists($this->_generic->getRoot().$this->_generic->getPathConfig("configSecure")."/mail_".$env.".xml"))					
			$mailXML = new SLS_XMLToolbox(file_get_contents($this->_generic->getRoot().$this->_generic->getPathConfig("configSecure")."/mail_".$env.".xml"));
		else		
			$mailXML = $this->_generic->getMailXML();
		
		$errors = array();
		
		// Prod Deployment		
		$finalFile = ($this->_http->getParam("ProdDeployment") == "true") ? "mail_".$env.".xml" : "mail.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);
		
		// Get default values
		$defaultHost 		= $this->_generic->getMailConfig("host");
		$defaultPort		= $this->_generic->getMailConfig("port"); 
		$defaultUser 		= $this->_generic->getMailConfig("username");
		$defaultPass		= $this->_generic->getMailConfig("passsword"); 
		$defaultDomain 		= $this->_generic->getMailConfig("defaultDomain");
		$defaultReturn		= $this->_generic->getMailConfig("defaultReturn"); 
		$defaultNameReturn	= $this->_generic->getMailConfig("defaultNameReturn");
		$defaultReply		= $this->_generic->getMailConfig("defaultReply");
		$defaultNameReply	= $this->_generic->getMailConfig("defaultNameReply");
		$defaultSender		= $this->_generic->getMailConfig("defaultSender"); 
		$defaultNameSender	= $this->_generic->getMailConfig("defaultNameSender");
		$TemplatesHeader	= $mailXML->getTags("//mails/templates/item[@id='default']/header");
		$TemplatesFooter	= $mailXML->getTags("//mails/templates/item[@id='default']/footer");
		
		$reload 			= $this->_http->getParam("reload");
				
		if ($reload == "true")
		{
			// Get New Parameters
			$exportConfig	= $this->_http->getParam('export');
			
			$postHost 		= SLS_String::trimSlashesFromString($this->_http->getParam("host", "post"));
			$postPort		= SLS_String::trimSlashesFromString($this->_http->getParam("port", "post"));
			$postUser 		= SLS_String::trimSlashesFromString($this->_http->getParam("user", "post"));
			$postPass		= SLS_String::trimSlashesFromString($this->_http->getParam("pass", "post"));
			$postDomain		= SLS_String::trimSlashesFromString($this->_http->getParam("domain", "post"));
			$postReturn		= SLS_String::trimSlashesFromString($this->_http->getParam("return", "post")); 
			$postNameReturn	= SLS_String::trimSlashesFromString($this->_http->getParam("nameReturn", "post"));;
			$postReply		= SLS_String::trimSlashesFromString($this->_http->getParam("reply", "post"));
			$postNameReply	= SLS_String::trimSlashesFromString($this->_http->getParam("nameReply", "post"));
			$postSender		= SLS_String::trimSlashesFromString($this->_http->getParam("sender", "post")); 
			$postNameSender	= SLS_String::trimSlashesFromString($this->_http->getParam("nameSender", "post"));
			$postPassNeed	= SLS_String::trimSlashesFromString($this->_http->getParam("needpass", "post"));
			$postUserNeed	= SLS_String::trimSlashesFromString($this->_http->getParam("needuser", "post"));
			
			$varsPost = $this->_http->getParams("post");
			
			if ($postUserNeed != "on" && empty($postUser))
				array_push($errors, "You need to fill the username");
			if ($postPassNeed != "on" && empty($postPass))
				array_push($errors, "You need to fill the password");
			if (empty($errors) && $this->_http->getParam("ping") != "true")
			{			
				if ($defaultHost != $postHost)
					 $mailXML->setTag("//mails/host", SLS_Security::getInstance()->encrypt($postHost, $this->_generic->getSiteConfig("privateKey")), true);
				if ($defaultPort != $postPort)
					 $mailXML->setTag("//mails/port", SLS_Security::getInstance()->encrypt($postPort, $this->_generic->getSiteConfig("privateKey")), true);
				if ($defaultReturn != $postReturn)
					 $mailXML->setTag("//mails/defaultReturn", $postReturn, true);
				if ($defaultDomain != $postDomain)
					 $mailXML->setTag("//mails/defaultDomain", $postDomain, true);
				if ($defaultNameReturn != $postNameReturn)
					 $mailXML->setTag("//mails/defaultNameReturn", $postNameReturn, true);
				if ($defaultReply != $postReply)
					 $mailXML->setTag("//mails/defaultReply", $postReply, true);
				if ($defaultNameReply != $postNameReply)
					 $mailXML->setTag("//mails/defaultNameReply", $postNameReply, true);
				if ($defaultSender != $postSender)
					 $mailXML->setTag("//mails/defaultSender", $postSender, true);
				if ($defaultNameSender != $postNameSender)
					 $mailXML->setTag("//mails/defaultNameSender", $postNameSender, true);
				
				if ($postUserNeed == "on")
					$mailXML->setTag("//mails/username", "", true);
				else 
					$mailXML->setTag("//mails/username", SLS_Security::getInstance()->encrypt($postUser, $this->_generic->getSiteConfig("privateKey")), true); 
				if ($postPassNeed == "on")
					$mailXML->setTag("//mails/password", "", true);
				else 
					$mailXML->setTag("//mails/password", SLS_Security::getInstance()->encrypt($postPass, $this->_generic->getSiteConfig("privateKey")), 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($mailXML->getXML());
					exit; 
				}
				else 
				{
					$mailXML->refresh();	
					@file_put_contents($this->_generic->getPathConfig("configSecure").$finalFile, $mailXML->getXML());
					if ($isInBatch)
						$this->_generic->forward("SLS_Bo","ProjectSettings",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");
				}
			}
			if (!empty($errors) && $this->_http->getParam("ping") != "true")
			{
				$xml->startTag('errors');
				foreach ($errors as $error)
				{
					$xml->addFullTag('error', $error);
				}
				$xml->endTag('errors');
			}
			if ($this->_http->getParam("ping") == "true")
			{
				$smtp = new SLS_Email("");
				$verdict = $smtp->pingConnection($postHost,$postPort,$postUser,$postPass);			
				$xml->addFullTag("ping",($verdict===true) ? "true" : $verdict,true);
			}
		}
		$this->_generic->eraseCache('Mail');
		$xml->startTag("current_values");
			$xml->addFullTag("host", ($this->_http->getParam("ProdDeployment") == "true" && file_exists($this->_generic->getRoot().$this->_generic->getPathConfig("configSecure")."/mail_".$env.".xml")) ? SLS_Security::getInstance()->decrypt(array_shift($mailXML->getTags("//mails/host")), $this->_generic->getSiteConfig("privateKey")) : SLS_Security::getInstance()->decrypt($this->_generic->getMailConfig("host"), $this->_generic->getSiteConfig("privateKey")), true);
			$xml->addFullTag("port", ($this->_http->getParam("ProdDeployment") == "true" && file_exists($this->_generic->getRoot().$this->_generic->getPathConfig("configSecure")."/mail_".$env.".xml")) ? SLS_Security::getInstance()->decrypt(array_shift($mailXML->getTags("//mails/port")), $this->_generic->getSiteConfig("privateKey")) : SLS_Security::getInstance()->decrypt($this->_generic->getMailConfig("port"), $this->_generic->getSiteConfig("privateKey")), true);
			$xml->addFullTag("user", ($this->_http->getParam("ProdDeployment") == "true" && file_exists($this->_generic->getRoot().$this->_generic->getPathConfig("configSecure")."/mail_".$env.".xml")) ? SLS_Security::getInstance()->decrypt(array_shift($mailXML->getTags("//mails/username")), $this->_generic->getSiteConfig("privateKey")) : SLS_Security::getInstance()->decrypt($this->_generic->getMailConfig("username"), $this->_generic->getSiteConfig("privateKey")), true);
			$xml->addFullTag("pass", ($this->_http->getParam("ProdDeployment") == "true" && file_exists($this->_generic->getRoot().$this->_generic->getPathConfig("configSecure")."/mail_".$env.".xml")) ? array_shift($mailXML->getTags("//mails/password")) : $this->_generic->getMailConfig("password"), true);
			$xml->addFullTag("domain", ($this->_http->getParam("ProdDeployment") == "true" && file_exists($this->_generic->getRoot().$this->_generic->getPathConfig("configSecure")."/mail_".$env.".xml")) ? array_shift($mailXML->getTags("//mails/defaultDomain")) : $this->_generic->getMailConfig("defaultDomain"), true);
			$xml->addFullTag("return", ($this->_http->getParam("ProdDeployment") == "true" && file_exists($this->_generic->getRoot().$this->_generic->getPathConfig("configSecure")."/mail_".$env.".xml")) ? array_shift($mailXML->getTags("//mails/defaultReturn")) : $this->_generic->getMailConfig("defaultReturn"), true);
			$xml->addFullTag("nameReturn", ($this->_http->getParam("ProdDeployment") == "true" && file_exists($this->_generic->getRoot().$this->_generic->getPathConfig("configSecure")."/mail_".$env.".xml")) ? array_shift($mailXML->getTags("//mails/defaultNameReturn")) : $this->_generic->getMailConfig("defaultNameReturn"), true);
			$xml->addFullTag("reply", ($this->_http->getParam("ProdDeployment") == "true" && file_exists($this->_generic->getRoot().$this->_generic->getPathConfig("configSecure")."/mail_".$env.".xml")) ? array_shift($mailXML->getTags("//mails/defaultReply")) : $this->_generic->getMailConfig("defaultReply"), true);
			$xml->addFullTag("nameReply", ($this->_http->getParam("ProdDeployment") == "true" && file_exists($this->_generic->getRoot().$this->_generic->getPathConfig("configSecure")."/mail_".$env.".xml")) ? array_shift($mailXML->getTags("//mails/defaultNameReply")) : $this->_generic->getMailConfig("defaultNameReply"), true);
			$xml->addFullTag("sender", ($this->_http->getParam("ProdDeployment") == "true" && file_exists($this->_generic->getRoot().$this->_generic->getPathConfig("configSecure")."/mail_".$env.".xml")) ? array_shift($mailXML->getTags("//mails/defaultSender")) : $this->_generic->getMailConfig("defaultSender"), true);
			$xml->addFullTag("nameSender", ($this->_http->getParam("ProdDeployment") == "true" && file_exists($this->_generic->getRoot().$this->_generic->getPathConfig("configSecure")."/mail_".$env.".xml")) ? array_shift($mailXML->getTags("//mails/defaultNameSender")) : $this->_generic->getMailConfig("defaultNameSender"), true);
		$xml->endTag("current_values");
		
		$xml->addFullTag("url_mail_templates",$this->_generic->getFullPath("SLS_Bo","MailTemplates"),true);
		
		$this->saveXML($xml);		
	}
コード例 #2
0
	/**
	 * Action Home
	 *
	 */
	public function action() 
	{
		$this->secureURL();
		$this->_generic->registerLink('DataBase', 'SLS_Init', 'DataBase');
		$step = 0;
		$xml = $this->getXML();
		$errors = array();
		$mysqlCharsets = array("armscii8","ascii","big5","binary","cp1250","cp1251","cp1256","cp1257","cp850","cp852","cp866","cp932","dec8","eucjpms","euckr","gb2312","gbk","geostd8","greek","hebrew","hp8","keybcs2","koi8u","koi8r","latin1","latin2","latin5","latin7","macce","macroman","sjis","swe7","tis620","ucs2","ujis","utf8");
		
		if ($this->_http->getParam("database_reload") == "1")
		{
			$useSql = $this->_http->getParam("database_useSql");
			if (empty($useSql))
				array_push($errors, "Will you need MySQL connection?");
			else
			{
				if ($this->_http->getParam("database_useSql") == "false")
				{
					$this->setInstallationStep(array(0=>"SLS_Init",1=>"Initialization"), array(0=>"MailSettings",1=>"MailSettings"));
					return $this->_generic->dispatch("SLS_Init", "MailSettings");	
				}
				else
				{
					$step = 1;
					$nbDbs = $this->_http->getParam("nb_databases");
					if (empty($nbDbs) || !is_numeric($nbDbs) || $nbDbs <= 0)
						$nbDbs = 1;
					$xml->startTag("nb_databases");
					for($i=0 ; $i<$nbDbs ; $i++)
						$xml->addFullTag("nb_database","",true);
					$xml->endTag("nb_databases");
				}
			}
		}
		elseif ($this->_http->getParam("database_reload") == "2")
		{
			$nb_databases = SLS_String::trimSlashesFromString($this->_http->getParam("nb_databases"));
			if (empty($nb_databases) || !is_numeric($nb_databases) || $nb_databases <= 0)
				$nb_databases = 1;
			$xml->startTag("nb_databases");
			for($i=0 ; $i<$nb_databases ; $i++)
				$xml->addFullTag("nb_database","",true);
			$xml->endTag("nb_databases");
			$nicks_used = array();
			
			for($i=1 ; $i<=$nb_databases ; $i++)
			{
				$nick_{$i} 		= strtolower(SLS_String::tableToClass(SLS_String::trimSlashesFromString($this->_http->getParam("database_alias_".$i))));
				$charset_{$i} 	= SLS_String::trimSlashesFromString($this->_http->getParam("database_charset_".$i));
				$host_{$i} 		= SLS_String::trimSlashesFromString($this->_http->getParam("database_host_".$i));			
				$name_{$i} 		= SLS_String::trimSlashesFromString($this->_http->getParam("database_name_".$i));
				$user_{$i} 		= SLS_String::trimSlashesFromString($this->_http->getParam("database_user_".$i));
				$pass_{$i} 		= SLS_String::trimSlashesFromString($this->_http->getParam("database_pass_".$i));
				$no_p_{$i} 		= SLS_String::trimSlashesFromString($this->_http->getParam("database_no_pass_".$i));
				
				if (empty($charset_{$i}) || !in_array($charset_{$i},$mysqlCharsets))
					array_push($errors, "You have to fill the charset for the database n°".$i);
				if (empty($nick_{$i}))
					array_push($errors, "You have to fill the database alias for the database n°".$i);
				else if (in_array($nick_{$i},$nicks_used))
					array_push($errors, "The database alias must be unique");
				else
					array_push($nicks_used,$nick_{$i});
					
				if (empty($host_{$i}))
					array_push($errors, "You have to fill the database host for the database n°".$i);
				if (empty($name_{$i}))
					array_push($errors, "You have to fill the database name for the database n°".$i);
				if (empty($user_{$i}))
					array_push($errors, "You have to fill the database username for the database n°".$i);
				if (empty($no_p_{$i}) && empty($pass_{$i}))
					array_push($errors, "You have to fill the database password or to check 'No password' for the database n°".$i);
			}
			
			// Ping
			if ($this->_http->getParam("ping") == "true")
			{
				$sql = SLS_Sql::getInstance();
				$errorsP = array();
				for($i=1 ; $i<=$nb_databases ; $i++)
				{					
					$verdict = $sql->pingConnection($host_{$i},$name_{$i},$user_{$i},(empty($no_p_{$i}) ? $pass_{$i} : ""));					
					if ($verdict === true)
						array_push($errorsP,'<li style="color:green;"><u>Database n°'.$i.':</u><br />Connection successfull</li>');
					if ($verdict !== true)
						array_push($errorsP,'<li style="color:red;"><u>Database n°'.$i.':</u><br />Connection failed with message `'.$verdict.'`</li>');
				}				
				$xml->addFullTag("ping",(empty($errorsP)) ? "true" : "false",true);
				$xml->startTag("ping_msgs");
				foreach($errorsP as $errorP)
					$xml->addFullTag("ping_msg",$errorP,true);
				$xml->endTag("ping_msgs");
			}
			
			// If it have errors
			//if (!empty($errors))
			//{
				$xml->startTag("dbs");
				for($i=1 ; $i<=$nb_databases ; $i++)
				{
					$xml->startTag("db_".$i);
					$xml->addFullTag("alias",$nick_{$i},true);
					$xml->addFullTag("charset",$charset_{$i},true);
					$xml->addFullTag("host",$host_{$i},true);
					$xml->addFullTag("name",$name_{$i},true);
					$xml->addFullTag("user",$user_{$i},true);
					$xml->addFullTag("pass",$pass_{$i},true);
					$xml->addFullTag("no_pass",(empty($no_p_{$i}))?"false":"true",true);
					$xml->endTag("db_".$i);
				}
				$xml->endTag("dbs");
			//}
			// Good, we can save it!
			if (empty($errors)  && $this->_http->getParam("ping") != "true")
			{
				$dbXml 		= $this->_generic->getDbXML();
				$str_xml 	= "";
				for($i=1 ; $i<=$nb_databases ; $i++)
				{
					$default = ($i==1) ? 'true' : 'false';
					
					$host_{$i} = SLS_Security::getInstance()->encrypt($host_{$i},$this->_generic->getSiteConfig("privateKey"));
					$name_{$i} = SLS_Security::getInstance()->encrypt($name_{$i},$this->_generic->getSiteConfig("privateKey"));
					$user_{$i} = SLS_Security::getInstance()->encrypt($user_{$i},$this->_generic->getSiteConfig("privateKey"));
					$pass_{$i} = (empty($no_p_{$i})) ? SLS_Security::getInstance()->encrypt($pass_{$i},$this->_generic->getSiteConfig("privateKey")) : "";
					
					$str_xml .= '<db alias="'.$nick_{$i}.'" isDefault="'.$default.'" isSecure="true" js="false" charset="'.$charset_{$i}.'">'.
									'<host><![CDATA['.$host_{$i}.']]></host>'.
									'<base><![CDATA['.$name_{$i}.']]></base>'.
									'<user><![CDATA['.$user_{$i}.']]></user>'.
									'<pass><![CDATA['.$pass_{$i}.']]></pass>'.
								'</db>';
				}
				$dbXml->appendXMLNode("//dbs",$str_xml);
				$dbXml->saveXML($this->_generic->getPathConfig("configSecure")."db.xml");
				$this->setInstallationStep(array(0=>"SLS_Init",1=>"Initialization"), array(0=>"MailSettings",1=>"MailSettings"));
				
				// If old sls_graph_* exists
				$sql = SLS_Sql::getInstance();
				$graphTables = array("sls_graph",
									 "sls_graph_query",
									 "sls_graph_query_column",
									 "sls_graph_query_group",
									 "sls_graph_query_join",
									 "sls_graph_query_limit",
									 "sls_graph_query_order",
									 "sls_graph_query_where");
				foreach($graphTables as $graphTable)
				{
					try 
					{
						if ($sql->tableExists($graphTable))
							$sql->exec("DROP TABLE `".$graphTable."`");
					}
					catch (Exception $e)
					{
						continue;
					}
				}
				return $this->_generic->dispatch("SLS_Init", "MailSettings");
			}			
			$step = 1;
		}
		
		if (!empty($errors) && $this->_http->getParam("database_reload") == "1" || ( !empty($errors) && $this->_http->getParam("ping") != "true"))
		{
			$xml->startTag("errors");
			foreach($errors as $error)
				$xml->addFullTag("error", $error, true);
			$xml->endTag("errors");
		}
		$xml->addFullTag("step", $step, true);
		$xml->startTag("charsets");
		foreach($mysqlCharsets as $key => $value)
			$xml->addFullTag("charset",$value,true);
		$xml->endTag("charsets");
		$this->saveXML($xml);
	}
コード例 #3
0
	/**
	 * Action Home
	 *
	 */
	public function action() 
	{
		$this->secureURL();
		$this->_generic->registerLink('MailSettings', 'SLS_Init', 'MailSettings');
		$step = 0;
		$xml = $this->getXML();
		$errors = array();
		if ($this->_http->getParam("mails_reload") == "1")
		{
			$useSmtp = $this->_http->getParam("mails_useSmtp");
			if (empty($useSmtp))
				array_push($errors, "Will you need SMTP connection?");
			else
			{
				if ($this->_http->getParam("mails_useSmtp") == "false")
				{
					$this->setInstallationStep(array(0=>"SLS_Init",1=>"Initialization"), array(0=>"Final",1=>"Congratulations"));
					return $this->_generic->dispatch("SLS_Init", "Final");	
				}
				else
				{
					$step = 1;
					$domainName = $this->_generic->getSiteConfig("domainName");
					$port = 25;
					$xmlToolBox = $this->getXML();
					$xmlToolBox->addFullTag("defaultDomain",$domainName,true);
					$xmlToolBox->addFullTag("port",$port,true);
					$xmlToolBox->addFullTag("header",'<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"></head><body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" bgcolor="FFFFFF" color="000000">',true);
					$xmlToolBox->addFullTag("footer",'</body></html>',true);
					$this->saveXML($xmlToolBox);
				}
			}
		}
		elseif ($this->_http->getParam("mails_reload") == "2")
		{			
			$host 				= SLS_String::trimSlashesFromString($this->_http->getParam("host"));
			$port 				= ($this->_http->getParam("port")=="") ? 25 : SLS_String::trimSlashesFromString($this->_http->getParam("port"));
			$username 			= SLS_String::trimSlashesFromString($this->_http->getParam("username"));
			$password			= SLS_String::trimSlashesFromString($this->_http->getParam("password"));
			$password2			= SLS_String::trimSlashesFromString($this->_http->getParam("password2"));
			$defaultDomain		= ($this->_http->getParam("defaultDomain") == "") ? $this->_generic->getSiteConfig("domainName") : SLS_String::trimSlashesFromString($this->_http->getParam("defaultDomain"));
			$defaultNameSender	= SLS_String::trimSlashesFromString($this->_http->getParam("defaultNameSender"));
			$defaultSender		= SLS_String::trimSlashesFromString($this->_http->getParam("defaultSender"));
			$defaultNameReply	= SLS_String::trimSlashesFromString($this->_http->getParam("defaultNameReply"));
			$defaultReply		= SLS_String::trimSlashesFromString($this->_http->getParam("defaultReply"));
			$defaultNameReturn	= SLS_String::trimSlashesFromString($this->_http->getParam("defaultNameReturn"));
			$defaultReturn		= SLS_String::trimSlashesFromString($this->_http->getParam("defaultReturn"));
			$header				= SLS_String::trimSlashesFromString($this->_http->getParam("header"));
			$footer				= SLS_String::trimSlashesFromString($this->_http->getParam("footer"));
			
			if (empty($host))
				array_push($errors, "You have to fill the SMTP Host");
			if (empty($port))
				array_push($errors, "You have to fill the SMTP Port");
			if (empty($username))
				array_push($errors, "You have to fill the SMTP Username");
			if (empty($password))
				array_push($errors, "You have to fill the SMTP Password");
			else if ($password != $password2)
				array_push($errors, "Both passwords don't match");
			if (empty($defaultDomain))
				array_push($errors, "You have to fill the SMTP Domain");			
			if (empty($defaultNameSender))
				array_push($errors, "You have to fill the `From`' name");
			if (empty($defaultSender))
				array_push($errors, "You have to fill the `From`' alias");
			if (empty($defaultNameReply))
				array_push($errors, "You have to fill the `Reply To`' name");
			if (empty($defaultReply))
				array_push($errors, "You have to fill the `Reply To`' alias");
			if (empty($defaultNameReturn))
				array_push($errors, "You have to fill the `Return-Path`' name");
			if (empty($defaultReturn))
				array_push($errors, "You have to fill the `Return-Path`' alias");
			
			if (empty($errors) && $this->_http->getParam("ping") != "true")
			{
				$dbXml = $this->_generic->getMailXML();
				$dbXml->setTag("host", SLS_Security::getInstance()->encrypt($this->_http->getParam("host"), $this->_generic->getSiteConfig("privateKey")));
				$dbXml->setTag("port", SLS_Security::getInstance()->encrypt($this->_http->getParam("port"), $this->_generic->getSiteConfig("privateKey")));
				$dbXml->setTag("username", SLS_Security::getInstance()->encrypt($this->_http->getParam("username"), $this->_generic->getSiteConfig("privateKey")));
				$dbXml->setTag("password", SLS_Security::getInstance()->encrypt($this->_http->getParam("password"), $this->_generic->getSiteConfig("privateKey")));
				$dbXml->setTag("defaultDomain",$defaultDomain);
				$dbXml->setTag("defaultSender",$defaultSender);
				$dbXml->setTag("defaultNameSender",$defaultNameSender);
				$dbXml->setTag("defaultReply",$defaultReply);
				$dbXml->setTag("defaultNameReply",$defaultNameReply);
				$dbXml->setTag("defaultReturn",$defaultReturn);
				$dbXml->setTag("defaultNameReturn",$defaultNameReturn);
				// Default Template
				$mailTpl = '<item id="default" isSecure="false" js="false" default="true">';
				$mailTpl .= '<header isSecure="false" js="false"><![CDATA['.$header.']]></header>';
				$mailTpl .= '<footer isSecure="false" js="false"><![CDATA['.$footer.']]></footer>';
				$mailTpl .= '</item>';
				$dbXml->appendXMLNode("//mails/templates",$mailTpl);
				file_put_contents($this->_generic->getPathConfig("configSecure")."mail.xml", $dbXml->getXML());
				
				$this->setInstallationStep(array(0=>"SLS_Init",1=>"Initialization"), array(0=>"Final",1=>"Congratulations"));
				return $this->_generic->dispatch("SLS_Init", "Final");
			}
			else
			{
				$xmlToolBox = $this->getXML();
				$xmlToolBox->addFullTag("host",$host,true);
				$xmlToolBox->addFullTag("port",$port,true);
				$xmlToolBox->addFullTag("username",$username,true);
				$xmlToolBox->addFullTag("password",$password,true);
				$xmlToolBox->addFullTag("defaultDomain",$defaultDomain,true);
				$xmlToolBox->addFullTag("defaultSender",$defaultSender,true);
				$xmlToolBox->addFullTag("defaultNameSender",$defaultNameSender,true);
				$xmlToolBox->addFullTag("defaultReply",$defaultReply,true);
				$xmlToolBox->addFullTag("defaultNameReply",$defaultNameReply,true);
				$xmlToolBox->addFullTag("defaultReturn",$defaultReturn,true);
				$xmlToolBox->addFullTag("defaultNameReturn",$defaultNameReturn,true);
				$xmlToolBox->addFullTag("header",$header,true);
				$xmlToolBox->addFullTag("footer",$footer,true);
				$this->saveXML($xmlToolBox);
			}
			$step = 1;
		}
		if (!empty($errors) && $this->_http->getParam("ping") != "true")
		{
			$xml->startTag("errors");
			foreach($errors as $error)
				$xml->addFullTag("error", $error, true);
			$xml->endTag("errors");
		}
		if ($this->_http->getParam("ping") == "true")
		{
			$smtp = new SLS_Email("");
			$verdict = $smtp->pingConnection($host,$port,$username,$password);
			$xml->addFullTag("ping",($verdict===true) ? "true" : $verdict,true);
		}
					
		
		$xml->addFullTag("step", $step, true);
		$this->saveXML($xml);
	}
コード例 #4
0
	/**
	 * Constructor
	 *	 
	 * @access public
	 * @param string $hostname smtp host (leave empty for simple mail() function)
	 * @param int $smtpport smtp port (leave empty for simple mail() function)
	 * @param string $login smtp login (leave empty for anonymous authentication or simple mail() function)
	 * @param string $password smtp password (leave empty for anonymous authentication or simple mail() function)
	 * @since 1.0
	 */
	public function __construct($hostname="",$smtpport="",$login="",$password="")
	{
		if (empty($hostname) && empty($smtpport) && empty($login) && empty($password))
		{
			$hostname 	= SLS_Security::getInstance()->decrypt(SLS_Generic::getInstance()->getMailConfig("host"),SLS_Generic::getInstance()->getSiteConfig("privateKey"));
			$smtpport 	= SLS_Security::getInstance()->decrypt(SLS_Generic::getInstance()->getMailConfig("port"),SLS_Generic::getInstance()->getSiteConfig("privateKey"));
			$login 		= SLS_Security::getInstance()->decrypt(SLS_Generic::getInstance()->getMailConfig("username"),SLS_Generic::getInstance()->getSiteConfig("privateKey"));
			$password 	= SLS_Security::getInstance()->decrypt(SLS_Generic::getInstance()->getMailConfig("password"),SLS_Generic::getInstance()->getSiteConfig("privateKey"));
		}
		
		$this->hostname 				= $hostname;
		$this->hostaddr 				= gethostbyname($hostname);
		$this->smtpport 				= $smtpport;
		$this->login 					= $login;
		$this->password 				= $password;
		$this->logurl 					= SLS_Generic::getInstance()->getPathConfig("logs")."mail.log";
		$this->headers['Date'] 			= date("D, d M Y H:i:s O",time());
		$this->boundary['mixed'] 		= md5(uniqid(microtime()));
		$this->boundary['related'] 		= md5(uniqid(microtime()));
		$this->boundary['alternative'] 	= md5(uniqid(microtime()));
		
		if (!file_exists($this->logurl))
			@touch($this->logurl);
	}
コード例 #5
0
	/**
	 * Symmetric encryption
	 *
	 * @access public static	 
	 * @param string $text the text to encrypt
	 * @param string $key the private key (default Project Private key)
	 * @return string $decrypted the text decrypted
	 * @see SLS_Security::crypte
	 * @since 1.0
	 * @example 
	 * $uncrypted = SLS_Security::getInstance()->decrypt("VyUA[..]UgCCA=");
     * var_dump($uncrypted);
     * // will produce : "sillysmart"
	 */	
	public static function decrypt($text,$key="")
	{
		if ($key == "")
			$key = SLS_Generic::getInstance()->getSiteConfig('privateKey');
		$text = SLS_Security::generateKey(base64_decode($text),$key);
		$decrypted = "";
		for ($i=0;$i<strlen($text);$i++)
		{
			$md5 = substr($text,$i,1);
			$i++;
			$decrypted.= (substr($text,$i,1) ^ $md5);
		}
		return $decrypted;
	}
コード例 #6
0
	public function action()
	{
		$user 	= $this->hasAuthorative();
		$xml 	= $this->getXML();
		$xml	= $this->makeMenu($xml);
		
		$errors = array();
		
		// Prod Deployment
		$env = $this->_http->getParam("Env");
		if (empty($env))
			$env = "prod";
		$finalFile = ($this->_http->getParam("ProdDeployment") == "true") ? "db_".$env.".xml" : "db.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);
		
		if ($this->_http->getParam("ProdDeployment") == "true" && file_exists($this->_generic->getRoot().$this->_generic->getPathConfig("configSecure")."/db_".$env.".xml"))					
			$dbXML = new SLS_XMLToolbox(file_get_contents($this->_generic->getRoot().$this->_generic->getPathConfig("configSecure")."/db_".$env.".xml"));
		else		
			$dbXML = $this->_generic->getDbXML();
		
		$nbDbs = count($dbXML->getTags("//dbs/db"));
		$mysqlCharsets = array("armscii8","ascii","big5","binary","cp1250","cp1251","cp1256","cp1257","cp850","cp852","cp866","cp932","dec8","eucjpms","euckr","gb2312","gbk","geostd8","greek","hebrew","hp8","keybcs2","koi8u","koi8r","latin1","latin2","latin5","latin7","macce","macroman","sjis","swe7","tis620","ucs2","ujis","utf8");
		
		if ($this->_http->getParam("reload") == "true")
		{
			$exportConfig = $this->_http->getParam('export');
			$result = $dbXML->getTagsAttribute("//dbs/db","alias");
			for($i=0 ; $i<$count=count($result) ; $i++)
			{
				$current_alias = $result[$i]["attribute"];
				
				$charset_{$i} 	= SLS_String::trimSlashesFromString($this->_http->getParam("charset_".$current_alias));
				$host_{$i} 		= SLS_String::trimSlashesFromString($this->_http->getParam("host_".$current_alias));
				$base_{$i} 		= SLS_String::trimSlashesFromString($this->_http->getParam("base_".$current_alias));
				$user_{$i} 		= SLS_String::trimSlashesFromString($this->_http->getParam("user_".$current_alias));
				$pass_{$i} 		= SLS_String::trimSlashesFromString($this->_http->getParam("pass_".$current_alias));
				$no_p_{$i} 		= SLS_String::trimSlashesFromString($this->_http->getParam("no_pass_".$current_alias));
				
				if (empty($charset_{$i}) || !in_array($charset_{$i},$mysqlCharsets))
					array_push($errors, "You have to fill the charset for the database '".$current_alias."'");
				if (empty($host_{$i}))
					array_push($errors, "You have to fill the database host for the database '".$current_alias."'");
				if (empty($base_{$i}))
					array_push($errors, "You have to fill the database name for the database '".$current_alias."'");
				if (empty($user_{$i}))
					array_push($errors, "You have to fill the database username for the database '".$current_alias."'");
				if (empty($no_p_{$i}) && empty($pass_{$i}))
					array_push($errors, "You have to fill the database password or to check 'Don't require a password' for the database '".$current_alias."'");
			}
			
			if (empty($errors))
			{
				for($i=0 ; $i<$count=count($result) ; $i++)
				{
					$current_alias = $result[$i]["attribute"];
					
					$charset_{$i} 	= SLS_String::trimSlashesFromString($this->_http->getParam("charset_".$current_alias));
					$host_{$i} 		= SLS_Security::getInstance()->encrypt($host_{$i},$this->_generic->getSiteConfig("privateKey"));
					$base_{$i} 		= SLS_Security::getInstance()->encrypt($base_{$i},$this->_generic->getSiteConfig("privateKey"));
					$user_{$i} 		= SLS_Security::getInstance()->encrypt($user_{$i},$this->_generic->getSiteConfig("privateKey"));
					$pass_{$i} 		= (empty($no_p_{$i})) ? SLS_Security::getInstance()->encrypt($pass_{$i},$this->_generic->getSiteConfig("privateKey")) : "";
					
					$dbXML->setTagAttributes("//dbs/db[@alias='".$current_alias."']",array("charset"=>$charset_{$i}));
					$dbXML->setTag("//dbs/db[@alias='".$current_alias."']/host",$host_{$i});
					$dbXML->setTag("//dbs/db[@alias='".$current_alias."']/base",$base_{$i});
					$dbXML->setTag("//dbs/db[@alias='".$current_alias."']/user",$user_{$i});
					if (empty($no_p_{$i}))
						$dbXML->setTag("//dbs/db[@alias='".$current_alias."']/pass",$pass_{$i});
					else
						$dbXML->setTag("//dbs/db[@alias='".$current_alias."']/pass","");
					
				}
				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($dbXML->getXML());
					exit; 
				}
				else
				{ 			
					$dbXML->refresh();	
					@file_put_contents($this->_generic->getPathConfig("configSecure").$finalFile, $dbXML->getXML());
					if ($isInBatch)
						$this->_generic->forward("SLS_Bo","MailSettings",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");
				}
			}
		}
		
		$this->_generic->eraseCache('Dbs');
		
		
		$xml->startTag("dbs");
		for($i=1 ; $i<=$nbDbs ; $i++)
		{
			$result 	= array_shift($dbXML->getTagsAttribute("//dbs/db[".$i."]","alias"));
			$alias 		= $result["attribute"];
			$result		= array_shift($dbXML->getTagsAttribute("//dbs/db[".$i."]","isDefault"));
			$default 	= $result["attribute"];
			$result 	= array_shift($dbXML->getTagsAttribute("//dbs/db[".$i."]","charset"));			
			$charset	= $result["attribute"];
			
			$xml->startTag("db");
			$xml->addFullTag("alias",$alias,true);
			$xml->addFullTag("default",$default,true);
			$xml->addFullTag("charset",$charset,true);
			$xml->addFullTag("host",($this->_http->getParam("ProdDeployment") == "true" && file_exists($this->_generic->getRoot().$this->_generic->getPathConfig("configSecure")."/db_".$env.".xml")) ? SLS_Security::getInstance()->decrypt(array_shift($dbXML->getTags("//dbs/db[@alias='".$alias."']/host")), $this->_generic->getSiteConfig("privateKey")) : $this->_generic->getDbConfig("host",$alias),true);
			$xml->addFullTag("base",($this->_http->getParam("ProdDeployment") == "true" && file_exists($this->_generic->getRoot().$this->_generic->getPathConfig("configSecure")."/db_".$env.".xml")) ? SLS_Security::getInstance()->decrypt(array_shift($dbXML->getTags("//dbs/db[@alias='".$alias."']/base")), $this->_generic->getSiteConfig("privateKey")) : $this->_generic->getDbConfig("base",$alias),true);
			$xml->addFullTag("user",($this->_http->getParam("ProdDeployment") == "true" && file_exists($this->_generic->getRoot().$this->_generic->getPathConfig("configSecure")."/db_".$env.".xml")) ? SLS_Security::getInstance()->decrypt(array_shift($dbXML->getTags("//dbs/db[@alias='".$alias."']/user")), $this->_generic->getSiteConfig("privateKey")) : $this->_generic->getDbConfig("user",$alias),true);
			$xml->addFullTag("pass",($this->_http->getParam("ProdDeployment") == "true" && file_exists($this->_generic->getRoot().$this->_generic->getPathConfig("configSecure")."/db_".$env.".xml")) ? SLS_Security::getInstance()->decrypt(array_shift($dbXML->getTags("//dbs/db[@alias='".$alias."']/pass")), $this->_generic->getSiteConfig("privateKey")) : $this->_generic->getDbConfig("pass",$alias),true);
			$xml->addFullTag("url_delete",$this->_generic->getFullPath("SLS_Bo","DeleteDataBase",array(array("key"=>"alias","value"=>rawurlencode($alias)))),true);
			$xml->endTag("db");
		}
		$xml->endTag("dbs");
		
		if (!empty($errors))
		{
			$xml->startTag("errors");
			foreach($errors as $error)
				$xml->addFullTag("error",$error,true);
			$xml->endTag("errors");
		}
		$xml->addFullTag("url_add_database",$this->_generic->getFullPath("SLS_Bo","AddDataBase"),true);
		$xml->startTag("charsets");
		foreach($mysqlCharsets as $key => $value)
			$xml->addFullTag("charset",$value,true);
		$xml->endTag("charsets");
		$this->saveXML($xml);
	}
コード例 #7
0
	public function action()
	{
		$user 	= $this->hasAuthorative();
		$xml 	= $this->getXML();
		$xml	= $this->makeMenu($xml);
		$errors = array();
		$mysqlCharsets = array("armscii8","ascii","big5","binary","cp1250","cp1251","cp1256","cp1257","cp850","cp852","cp866","cp932","dec8","eucjpms","euckr","gb2312","gbk","geostd8","greek","hebrew","hp8","keybcs2","koi8u","koi8r","latin1","latin2","latin5","latin7","macce","macroman","sjis","swe7","tis620","ucs2","ujis","utf8");
		
		if ($this->_http->getParam("reload") == "true")
		{
			$dbXML = $this->_generic->getDbXML();
			
			$charset= SLS_String::trimSlashesFromString($this->_http->getParam("charset"));
			$alias 	= strtolower(SLS_String::sanitize(SLS_String::trimSlashesFromString($this->_http->getParam("alias")),""));
			$host 	= SLS_String::trimSlashesFromString($this->_http->getParam("host"));
			$db 	= SLS_String::trimSlashesFromString($this->_http->getParam("db"));
			$user 	= SLS_String::trimSlashesFromString($this->_http->getParam("user"));
			$pass 	= SLS_String::trimSlashesFromString($this->_http->getParam("pass"));
			$no_pas = SLS_String::trimSlashesFromString($this->_http->getParam("no_pass"));
			
			$result = $dbXML->getTagsAttribute("//dbs/db","alias");
			$dbs = array();
			for($i=0 ; $i<$count=count($result) ; $i++)
				array_push($dbs,$result[$i]["attribute"]);
			
			if (empty($charset) || !in_array($charset,$mysqlCharsets))
				array_push($errors, "You have to fill the charset of your database");
			if (empty($alias))
				array_push($errors,"You have to fill the alias of your database");
			if (in_array($alias,$dbs))
				array_push($errors,"This alias is already used by another database");
			if (empty($host))
				array_push($errors,"You have to fill the host of your database");
			if (empty($db))
				array_push($errors,"You have to fill the name of your database");
			if (empty($user))
				array_push($errors,"You have to fill the username of your database");
			if (empty($no_pas) && empty($pass))
				array_push($errors,"You have to fill the password of your database or to check the checkbox");
				
			if (empty($errors) && $this->_http->getParam("ping") != "true")
			{
				$host = SLS_Security::getInstance()->encrypt($host,$this->_generic->getSiteConfig("privateKey"));
				$db   = SLS_Security::getInstance()->encrypt($db,$this->_generic->getSiteConfig("privateKey"));
				$user = SLS_Security::getInstance()->encrypt($user,$this->_generic->getSiteConfig("privateKey"));
				$pass = (empty($no_pas)) ? SLS_Security::getInstance()->encrypt($pass,$this->_generic->getSiteConfig("privateKey")) : "";
				
				$str_xml = '<db alias="'.$alias.'" isDefault="'.((empty($dbs)) ? 'true' : 'false').'" isSecure="true" js="false" charset="'.$charset.'">'.
								'<host><![CDATA['.$host.']]></host>'.
								'<base><![CDATA['.$db.']]></base>'.
								'<user><![CDATA['.$user.']]></user>'.
								'<pass><![CDATA['.$pass.']]></pass>'.
							'</db>';
				$dbXML->appendXMLNode("//dbs",$str_xml);
				$dbXML->saveXML($this->_generic->getPathConfig("configSecure")."db.xml");
				$controllers = $this->_generic->getTranslatedController("SLS_Bo","DataBaseSettings");
				$this->_generic->redirect($controllers["controller"]."/".$controllers["scontroller"].".sls");
			}			
			$xml->startTag("db");
			$xml->addFullTag("alias",$alias,true);
			$xml->addFullTag("charset",$charset,true);
			$xml->addFullTag("host",$host,true);
			$xml->addFullTag("db",$db,true);
			$xml->addFullTag("user",$user,true);
			$xml->endTag("db");			
		}
		$xml->startTag("charsets");
		foreach($mysqlCharsets as $key => $value)
			$xml->addFullTag("charset",$value,true);
		$xml->endTag("charsets");
		// Ping
		if ($this->_http->getParam("ping") == "true")
		{
			$sql = SLS_Sql::getInstance();
			$verdict = $sql->pingConnection($host,$db,$user,(empty($no_pas) ? $pass : ""));			
			$xml->addFullTag("ping",($verdict===true) ? "true" : $verdict,true);
		}
		if (!empty($errors) && $this->_http->getParam("ping") != "true")
		{
			$xml->startTag("errors");
			foreach($errors as $error)
				$xml->addFullTag("error",$error,true);
			$xml->endTag("errors");
		}		
		$this->saveXML($xml);
	}
コード例 #8
0
	public function action()
	{
		$user 	= $this->hasAuthorative();
		$xml 	= $this->getXML();
		$xml	= $this->makeMenu($xml);		
		
		$plugId = $this->_http->getParam('Plugin');
		$reload = $this->_http->getParam('reload', 'post');
		$controllers = $this->_generic->getTranslatedController('SLS_Bo', 'Plugins');
		
		
		if(SLS_PluginsManager::isExists($plugId) === false)
			$this->redirect($controllers['controller']."/".$controllers['scontroller']);
		
		$plugin = new SLS_PluginsManager($plugId);
		$xmlPlug = $plugin->getXML();
		
		
		if (!$plugin->isCustomizable())
			$this->redirect($controllers['controller']."/".$controllers['scontroller']);
		
		$xml->startTag("plugin_infos");
			$xml->addFullTag('name', $plugin->_name);
			$xml->addFullTag('code', $plugin->_code);
			$xml->addFullTag('id', $plugin->_id);
			$xml->addFullTag('version', $plugin->_version);
		$xml->endTag("plugin_infos");
		
		if ($reload == 'true')
		{
			$errors = array();
			$form_memory = array();
			$form_memory = $this->recoverFormValues("//plugin", $xmlPlug, $form_memory);
			$xml->startTag("memory");
			foreach ($form_memory as $key=>$field)
			{
				$xml->startTag("values");
				$xml->addFullTag("name", $key, true);
				$xml->addFullTag("value", $field['value'], true);
				$xml->endTag("values");
				$xpath = $field['xpath'];
				$index = SLS_String::substrBeforeFirstDelimiter(SLS_String::substrAfterLastDelimiter($xpath, "["), "]");
				$xpathNoIndex = SLS_String::substrBeforeLastDelimiter($xpath, "[");
				if (SLS_String::endsWith($key, "_alias"))
				{
					if (count($xmlPlug->getTags($xpathNoIndex."[position() != ".$index." and @alias='".$field['value']."']")) != 0)
						$errors[] = array_shift($xmlPlug->getTags($xpath."/@label"))." alias ".$GLOBALS[$GLOBALS['PROJECT_NAME']]['JS']['SLS_E_UNIQUE'];
					else 
						$xmlPlug->setTagAttributes($xpath, array("alias"=>$field['value']));
				}
				else {
					$is_null = (array_shift($xmlPlug->getTags($xpath."/@null")) == "1") ? true : false;
					switch (array_shift($xmlPlug->getTags($xpath."/@type")))
					{
						case "string" :
							if (!SLS_String::validateString($field['value']) && !$is_null)
								$errors[] = array_shift($xmlPlug->getTags($xpath."/@label"))." ".$GLOBALS[$GLOBALS['PROJECT_NAME']]['JS']['SLS_E_TYPE'];
							else 
								$xmlPlug->setTag($xpath, $field['value']);
							break;
						case "password" :
								if (isset($field['value']))
									$xmlPlug->setTag($xpath, SLS_Security::encrypt($field['value'], $this->_generic->getSiteConfig("privateKey")));
							break;
						case "int" : 
							if (!is_int($field['value']) && !$is_null)
								$errors[] = array_shift($xmlPlug->getTags($xpath."/@label"))." ".$GLOBALS[$GLOBALS['PROJECT_NAME']]['JS']['SLS_E_TYPE'];
							else 
								$xmlPlug->setTag($xpath, $field['value']);
							break;
						case "float" :
							if (!is_float($field['value']) && !$is_null)
								$errors[] = array_shift($xmlPlug->getTags($xpath."/@label"))." ".$GLOBALS[$GLOBALS['PROJECT_NAME']]['JS']['SLS_E_TYPE'];
							else 
								$xmlPlug->setTag($xpath, $field['value']);
							break;
						case "select" : 
							$values = explode("|||", array_shift($xmlPlug->getTags($xpath."/@values")));
							if (!in_array($field['value'], $values))
								$errors[] = array_shift($xmlPlug->getTags($xpath."/@label"))." ".$GLOBALS[$GLOBALS['PROJECT_NAME']]['JS']['SLS_E_CONTENT'];
							else 
								$xmlPlug->setTag($xpath, $field['value']);
							break;
						default:
							break;
					}
				}
				
			}
			$xml->endTag("memory");
			if (!empty($errors))
			{
				$xml->startTag("errors");
					foreach ($errors as $error)
						$xml->addFullTag("error", $error, true);
				$xml->endTag("errors");
			}
			else 
			{
				$xml->addFullTag("success", "ok", true);
				$plugin->saveXML($xmlPlug);
			}
		}
		
		$xml->addFullTag("fields", $plugin->getFields()->getXML('noHeader'), false);	
				
		$this->saveXML($xml);		
	}
コード例 #9
0
	/**
	 * Get database config
	 *
	 * @access public
	 * @param string $config the key wanted
	 * @param string $db the alias db wanted (empty will choose the default database)
	 * @return string $param
	 * @see SLS_Generic::getCoreConfig
	 * @see SLS_Generic::getSiteConfig
	 * @see SLS_Generic::getMailConfig
	 * @see SLS_Generic::getPathConfig
	 * @see SLS_Generic::getProjectConfig
	 * @since 1.0
	 */
	public function getDbConfig($config,$db="")
	{
		if (empty($db))
		{
			$result = array_shift($this->_configDb->getTagsAttribute("//dbs/db[@isDefault='true']","alias"));
			$db = $result["attribute"];
		}		
		if (is_array($this->_dataCache['Dbs'][$db]) && array_key_exists($config, $this->_dataCache['Dbs'][$db]))
			return $this->_dataCache['Dbs'][$db][$config];
		else 
		{
			$this->_dataCache['Dbs'][$db][$config] = SLS_Security::getInstance()->decrypt($this->_configDb->getTag("//dbs/db[@alias='".$db."']/".$config), $this->getSiteConfig("privateKey"));
			return $this->_dataCache['Dbs'][$db][$config];
		}
	}