Преглед на файлове

- Do NOT rely on PHP short open tags, for a better compatibility
- In case of exception, display the whole error string even if it contains HTML tags, sometimes ugly but sometimes VERY useful

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@99 a333f486-631f-4898-b8df-5754b55c2be0

dflaven преди 16 години
родител
ревизия
98dac682b1
променени са 1 файла, в които са добавени 3 реда и са изтрити 4 реда
  1. 3 4
      core/config.class.inc.php

+ 3 - 4
core/config.class.inc.php

@@ -70,8 +70,7 @@ class Config
 		try
 		{
 			ob_start();
-			$sCode = str_replace('<'.'?php','<'.'?', $sConfigCode);
-			eval('?'.'>'.trim($sCode).'<'.'?');
+			eval('?'.'>'.trim($sConfigCode));
 			$sNoise = trim(ob_get_contents());
 			ob_end_clean();
 		}
@@ -84,7 +83,7 @@ class Config
 		if (strlen($sNoise) > 0)
 		{
 			// Note: sNoise is an html output, but so far it was ok for me (e.g. showing the entire call stack) 
-			throw new ConfigException('Syntax error in configuration file', array('file' => $sConfigFile, 'error' => $sNoise));
+			throw new ConfigException('Syntax error in configuration file', array('file' => $sConfigFile, 'error' => '<tt>'.htmlentities($sNoise).'</tt>'));
 		}
 
 		if (!isset($MySettings) || !is_array($MySettings))
@@ -235,7 +234,7 @@ class Config
 			fwrite($hFile, "\$MySettings = array(\n");
 			fwrite($hFile, "\t'db_host' => '{$this->m_sDBHost}',\n");
 			fwrite($hFile, "\t'db_user' => '{$this->m_sDBUser}',\n");
-			fwrite($hFile, "\t'db_pwd' => '{$this->m_sDBPwd}',\n");
+			fwrite($hFile, "\t'db_pwd' => '".addslashes($this->m_sDBPwd)."',\n");
 			fwrite($hFile, "\t'db_name' => '{$this->m_sDBName}',\n");
 			fwrite($hFile, "\t'db_subname' => '{$this->m_sDBSubname}',\n");
 			fwrite($hFile, ");\n");