- 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

SVN:trunk[99]
This commit is contained in:
Denis Flaven
2009-08-22 09:52:12 +00:00
parent 9c201eb65d
commit a8946fbfdb

View File

@@ -70,8 +70,7 @@ class Config
try try
{ {
ob_start(); ob_start();
$sCode = str_replace('<'.'?php','<'.'?', $sConfigCode); eval('?'.'>'.trim($sConfigCode));
eval('?'.'>'.trim($sCode).'<'.'?');
$sNoise = trim(ob_get_contents()); $sNoise = trim(ob_get_contents());
ob_end_clean(); ob_end_clean();
} }
@@ -84,7 +83,7 @@ class Config
if (strlen($sNoise) > 0) 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) // 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)) if (!isset($MySettings) || !is_array($MySettings))
@@ -235,7 +234,7 @@ class Config
fwrite($hFile, "\$MySettings = array(\n"); fwrite($hFile, "\$MySettings = array(\n");
fwrite($hFile, "\t'db_host' => '{$this->m_sDBHost}',\n"); fwrite($hFile, "\t'db_host' => '{$this->m_sDBHost}',\n");
fwrite($hFile, "\t'db_user' => '{$this->m_sDBUser}',\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_name' => '{$this->m_sDBName}',\n");
fwrite($hFile, "\t'db_subname' => '{$this->m_sDBSubname}',\n"); fwrite($hFile, "\t'db_subname' => '{$this->m_sDBSubname}',\n");
fwrite($hFile, ");\n"); fwrite($hFile, ");\n");