summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxue <>2005-12-03 16:19:08 +0000
committerxue <>2005-12-03 16:19:08 +0000
commit3ea63072225a473239227facfabde294bb58ed1d (patch)
tree2716662f13c184f31281bab45871c3ad3c9634b4
parentbdd139266bbd71b828394a1500551254fc42a819 (diff)
-rw-r--r--.gitattributes5
-rw-r--r--framework/Exceptions/TErrorHandler.php48
-rw-r--r--framework/Exceptions/templates/error-fr.html3
-rw-r--r--framework/Exceptions/templates/error-zh.html11
-rw-r--r--framework/Exceptions/templates/error.html3
-rw-r--r--framework/Exceptions/templates/error404-en.html3
-rw-r--r--framework/Exceptions/templates/error404-fr.html3
-rw-r--r--framework/Exceptions/templates/error404-zh.html3
-rw-r--r--framework/Exceptions/templates/error404.html3
-rw-r--r--framework/Exceptions/templates/error500-en.html3
-rw-r--r--framework/Exceptions/templates/error500-fr.html3
-rw-r--r--framework/Exceptions/templates/error500-zh.html3
-rw-r--r--framework/Exceptions/templates/error500.html3
-rw-r--r--framework/Exceptions/templates/error503-en.html3
-rw-r--r--framework/Exceptions/templates/error503-fr.html3
-rw-r--r--framework/Exceptions/templates/error503-zh.html3
-rw-r--r--framework/Exceptions/templates/error503.html3
-rw-r--r--framework/Exceptions/templates/exception-en.html3
-rw-r--r--framework/Exceptions/templates/exception-fr.html7
-rw-r--r--framework/Exceptions/templates/exception-zh.html3
-rw-r--r--framework/Exceptions/templates/exception.html3
-rw-r--r--framework/Web/UI/THiddenFieldPageStatePersister.php9
-rw-r--r--framework/Web/UI/TPage.php40
-rw-r--r--requirements/index.php123
-rw-r--r--requirements/messages-zh.txt11
-rw-r--r--requirements/messages.txt11
-rw-r--r--requirements/template-zh.html48
-rw-r--r--requirements/template.html49
28 files changed, 305 insertions, 108 deletions
diff --git a/.gitattributes b/.gitattributes
index 1ff1ed0f..7f95dbe2 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -105,6 +105,11 @@ framework/Web/UI/WebControls/TTextBox.php -text
framework/Web/UI/WebControls/TWebControl.php -text
framework/core.php -text
framework/prado.php -text
+requirements/index.php -text
+requirements/messages-zh.txt -text
+requirements/messages.txt -text
+requirements/template-zh.html -text
+requirements/template.html -text
tests/UnitTests/TODO.txt -text
tests/UnitTests/framework/Collections/utList.php -text
tests/UnitTests/framework/Collections/utMap.php -text
diff --git a/framework/Exceptions/TErrorHandler.php b/framework/Exceptions/TErrorHandler.php
index e9f48a2b..7d914fca 100644
--- a/framework/Exceptions/TErrorHandler.php
+++ b/framework/Exceptions/TErrorHandler.php
@@ -190,21 +190,14 @@ class TErrorHandler extends TComponent implements IModule
die("Unable to open error template file '$errorFile'.");
$serverAdmin=isset($_SERVER['SERVER_ADMIN'])?$_SERVER['SERVER_ADMIN']:'';
- $fields=array(
- '%%StatusCode%%',
- '%%ErrorMessage%%',
- '%%ServerAdmin%%',
- '%%Version%%',
- '%%Time%%'
+ $tokens=array(
+ '%%StatusCode%%' => "$statusCode",
+ '%%ErrorMessage%%' => htmlspecialchars($exception->getMessage()),
+ '%%ServerAdmin%%' => $serverAdmin,
+ '%%Version%%' => $_SERVER['SERVER_SOFTWARE'].' <a href="http://www.pradosoft.com/">PRADO</a>/'.Prado::getVersion(),
+ '%%Time%%' => strftime('%Y-%m-%d %H:%m',time())
);
- $values=array(
- "$statusCode",
- htmlspecialchars($exception->getMessage()),
- $serverAdmin,
- $_SERVER['SERVER_SOFTWARE'].' <a href="http://www.pradosoft.com/">PRADO</a>/'.Prado::getVersion(),
- strftime('%Y-%m-%d %H:%m',time())
- );
- echo str_replace($fields,$values,$content);
+ echo strtr($content,$tokens);
}
/**
@@ -257,23 +250,14 @@ class TErrorHandler extends TComponent implements IModule
$source.=htmlspecialchars(sprintf("%04d: %s",$i+1,str_replace("\t",' ',$lines[$i])));
}
- $fields=array(
- '%%ErrorType%%',
- '%%ErrorMessage%%',
- '%%SourceFile%%',
- '%%SourceCode%%',
- '%%StackTrace%%',
- '%%Version%%',
- '%%Time%%'
- );
- $values=array(
- get_class($exception),
- htmlspecialchars($exception->getMessage()),
- htmlspecialchars($exception->getFile()).' ('.$exception->getLine().')',
- $source,
- htmlspecialchars($exception->getTraceAsString()),
- $_SERVER['SERVER_SOFTWARE'].' <a href="http://www.pradosoft.com/">PRADO</a>/'.Prado::getVersion(),
- strftime('%Y-%m-%d %H:%m',time())
+ $tokens=array(
+ '%%ErrorType%%' => get_class($exception),
+ '%%ErrorMessage%%' => htmlspecialchars($exception->getMessage()),
+ '%%SourceFile%%' => htmlspecialchars($exception->getFile()).' ('.$exception->getLine().')',
+ '%%SourceCode%%' => $source,
+ '%%StackTrace%%' => htmlspecialchars($exception->getTraceAsString()),
+ '%%Version%%' => $_SERVER['SERVER_SOFTWARE'].' <a href="http://www.pradosoft.com/">PRADO</a>/'.Prado::getVersion(),
+ '%%Time%%' => strftime('%Y-%m-%d %H:%m',time())
);
$lang=Prado::getPreferredLanguage();
$exceptionFile=Prado::getFrameworkPath().'/Exceptions/templates/'.self::EXCEPTION_FILE_NAME.'-'.$lang.'.html';
@@ -281,7 +265,7 @@ class TErrorHandler extends TComponent implements IModule
$exceptionFile=Prado::getFrameworkPath().'/Exceptions/templates/'.self::EXCEPTION_FILE_NAME.'.html';
if(($content=@file_get_contents($exceptionFile))===false)
die("Unable to open exception template file '$exceptionFile'.");
- echo str_replace($fields,$values,$content);
+ echo strtr($content,$tokens);
}
}
diff --git a/framework/Exceptions/templates/error-fr.html b/framework/Exceptions/templates/error-fr.html
index edea47bc..5546dcdb 100644
--- a/framework/Exceptions/templates/error-fr.html
+++ b/framework/Exceptions/templates/error-fr.html
@@ -23,8 +23,7 @@ Cette erreur est survenue en essayant de répondre à votre requête.
Si vous pensez qu'il s'agit d'une erreur inattendue du serveur, merci de contacter l'<a href="mailto:%%ServerAdmin%%">administrateur</a>
</p>
<div class="version">
-%%Version%%<br/>
-%%Time%%
+%%Time%% %%Version%%
</div>
</body>
</html> \ No newline at end of file
diff --git a/framework/Exceptions/templates/error-zh.html b/framework/Exceptions/templates/error-zh.html
index af921417..545f057c 100644
--- a/framework/Exceptions/templates/error-zh.html
+++ b/framework/Exceptions/templates/error-zh.html
@@ -1,4 +1,4 @@
-<html>
+<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset="utf-8"/>
<meta http-equiv="content-language" content="zh"/>
@@ -14,17 +14,16 @@ p {font-family:"Verdana";font-weight:normal;color:black;font-size:9pt;margin-top
</head>
<body bgcolor="white">
-<h1>Error %%StatusCode%%</h1>
+<h1>错误%%StatusCode%%</h1>
<h2>%%ErrorMessage%%</h2>
<p>
-The above error happened when the server was processing your request.
+服务器在处理您的页面请求时出现了以上错误。
</p>
<p>
-If you think this is a server error, please contact the <a href="mailto:%%ServerAdmin%%">webmaster</a>.
+如果您认为这是服务器的原因,请联系通知<a href="mailto:%%ServerAdmin%%">系统管理员</a>。
</p>
<div class="version">
-%%Version%%<br/>
-%%Time%%
+%%Time%% %%Version%%
</div>
</body>
</html> \ No newline at end of file
diff --git a/framework/Exceptions/templates/error.html b/framework/Exceptions/templates/error.html
index 0dd625b6..931f96a3 100644
--- a/framework/Exceptions/templates/error.html
+++ b/framework/Exceptions/templates/error.html
@@ -23,8 +23,7 @@ The above error happened when the server was processing your request.
If you think this is a server error, please contact the <a href="mailto:%%ServerAdmin%%">webmaster</a>.
</p>
<div class="version">
-%%Version%%<br/>
-%%Time%%
+%%Time%% %%Version%%
</div>
</body>
</html> \ No newline at end of file
diff --git a/framework/Exceptions/templates/error404-en.html b/framework/Exceptions/templates/error404-en.html
index 1f6610fe..92ac65b1 100644
--- a/framework/Exceptions/templates/error404-en.html
+++ b/framework/Exceptions/templates/error404-en.html
@@ -24,8 +24,7 @@ If you entered the URL manually please check your spelling and try again.
If you think this is a server error, please contact the <a href="mailto:%%ServerAdmin%%">webmaster</a>.
</p>
<div class="version">
-%%Version%%<br/>
-%%Time%%
+%%Time%% %%Version%%
</div>
</body>
</html> \ No newline at end of file
diff --git a/framework/Exceptions/templates/error404-fr.html b/framework/Exceptions/templates/error404-fr.html
index 76c219bb..181bd8a7 100644
--- a/framework/Exceptions/templates/error404-fr.html
+++ b/framework/Exceptions/templates/error404-fr.html
@@ -24,8 +24,7 @@ Si vous avez tapé cette URL manuellement dans la barre d'adresse, merci de vér
Si vous pensez qu'il s'agit d'une erreur inattendue du serveur, merci de contacter l'<a href="mailto:%%ServerAdmin%%">administrateur</a>
</p>
<div class="version">
-%%Version%%<br/>
-%%Time%%
+%%Time%% %%Version%%
</div>
</body>
</html> \ No newline at end of file
diff --git a/framework/Exceptions/templates/error404-zh.html b/framework/Exceptions/templates/error404-zh.html
index 7766acd4..ae5d8275 100644
--- a/framework/Exceptions/templates/error404-zh.html
+++ b/framework/Exceptions/templates/error404-zh.html
@@ -24,8 +24,7 @@ p {font-family:"Verdana";font-weight:normal;color:black;font-size:9pt;margin-top
如果您确认这是服务器错误,请联系<a href="mailto:%%ServerAdmin%%">系统管理员</a>。
</p>
<div class="version">
-%%Version%%<br/>
-%%Time%%
+%%Time%% %%Version%%
</div>
</body>
</html> \ No newline at end of file
diff --git a/framework/Exceptions/templates/error404.html b/framework/Exceptions/templates/error404.html
index 1f6610fe..92ac65b1 100644
--- a/framework/Exceptions/templates/error404.html
+++ b/framework/Exceptions/templates/error404.html
@@ -24,8 +24,7 @@ If you entered the URL manually please check your spelling and try again.
If you think this is a server error, please contact the <a href="mailto:%%ServerAdmin%%">webmaster</a>.
</p>
<div class="version">
-%%Version%%<br/>
-%%Time%%
+%%Time%% %%Version%%
</div>
</body>
</html> \ No newline at end of file
diff --git a/framework/Exceptions/templates/error500-en.html b/framework/Exceptions/templates/error500-en.html
index 1c7c531e..25d4ad92 100644
--- a/framework/Exceptions/templates/error500-en.html
+++ b/framework/Exceptions/templates/error500-en.html
@@ -24,8 +24,7 @@ Please contact the <a href="mailto:%%ServerAdmin%%">webmaster</a> to report this
Thank you.
</p>
<div class="version">
-%%Version%%<br/>
-%%Time%%
+%%Time%% %%Version%%
</div>
</body>
</html> \ No newline at end of file
diff --git a/framework/Exceptions/templates/error500-fr.html b/framework/Exceptions/templates/error500-fr.html
index c7685e1c..804425ef 100644
--- a/framework/Exceptions/templates/error500-fr.html
+++ b/framework/Exceptions/templates/error500-fr.html
@@ -24,8 +24,7 @@ Veuillez contacter l'<a href="mailto:%%ServerAdmin%%">administrateur</a> pour lu
Merci de votre compréhension.
</p>
<div class="version">
-%%Version%%<br/>
-%%Time%%
+%%Time%% %%Version%%
</div>
</body>
</html> \ No newline at end of file
diff --git a/framework/Exceptions/templates/error500-zh.html b/framework/Exceptions/templates/error500-zh.html
index 647f8dec..a10dbba4 100644
--- a/framework/Exceptions/templates/error500-zh.html
+++ b/framework/Exceptions/templates/error500-zh.html
@@ -23,8 +23,7 @@ p {font-family:"Verdana";font-weight:normal;color:black;font-size:9pt;margin-top
谢谢。
</p>
<div class="version">
-%%Version%%<br/>
-%%Time%%
+%%Time%% %%Version%%
</div>
</body>
</html> \ No newline at end of file
diff --git a/framework/Exceptions/templates/error500.html b/framework/Exceptions/templates/error500.html
index 1c7c531e..25d4ad92 100644
--- a/framework/Exceptions/templates/error500.html
+++ b/framework/Exceptions/templates/error500.html
@@ -24,8 +24,7 @@ Please contact the <a href="mailto:%%ServerAdmin%%">webmaster</a> to report this
Thank you.
</p>
<div class="version">
-%%Version%%<br/>
-%%Time%%
+%%Time%% %%Version%%
</div>
</body>
</html> \ No newline at end of file
diff --git a/framework/Exceptions/templates/error503-en.html b/framework/Exceptions/templates/error503-en.html
index 007a498c..718dd4ea 100644
--- a/framework/Exceptions/templates/error503-en.html
+++ b/framework/Exceptions/templates/error503-en.html
@@ -22,8 +22,7 @@ Our system is currently under maintenance. Please come back later.
Thank you.
</p>
<div class="version">
-%%Version%%<br/>
-%%Time%%
+%%Time%% %%Version%%
</div>
</body>
</html> \ No newline at end of file
diff --git a/framework/Exceptions/templates/error503-fr.html b/framework/Exceptions/templates/error503-fr.html
index 34198a0f..699114de 100644
--- a/framework/Exceptions/templates/error503-fr.html
+++ b/framework/Exceptions/templates/error503-fr.html
@@ -22,8 +22,7 @@ Le service est actuellement en maintenance et indisponible. Merci de réessayer
Merci de votre compréhension.
</p>
<div class="version">
-%%Version%%<br/>
-%%Time%%
+%%Time%% %%Version%%
</div>
</body>
</html> \ No newline at end of file
diff --git a/framework/Exceptions/templates/error503-zh.html b/framework/Exceptions/templates/error503-zh.html
index 7ce0c29d..5babac19 100644
--- a/framework/Exceptions/templates/error503-zh.html
+++ b/framework/Exceptions/templates/error503-zh.html
@@ -22,8 +22,7 @@ p {font-family:"Verdana";font-weight:normal;color:black;font-size:9pt;margin-top
谢谢。
</p>
<div class="version">
-%%Version%%<br/>
-%%Time%%
+%%Time%% %%Version%%
</div>
</body>
</html> \ No newline at end of file
diff --git a/framework/Exceptions/templates/error503.html b/framework/Exceptions/templates/error503.html
index 007a498c..718dd4ea 100644
--- a/framework/Exceptions/templates/error503.html
+++ b/framework/Exceptions/templates/error503.html
@@ -22,8 +22,7 @@ Our system is currently under maintenance. Please come back later.
Thank you.
</p>
<div class="version">
-%%Version%%<br/>
-%%Time%%
+%%Time%% %%Version%%
</div>
</body>
</html> \ No newline at end of file
diff --git a/framework/Exceptions/templates/exception-en.html b/framework/Exceptions/templates/exception-en.html
index 7dd133f5..45fc264c 100644
--- a/framework/Exceptions/templates/exception-en.html
+++ b/framework/Exceptions/templates/exception-en.html
@@ -35,8 +35,7 @@ td,.version {color: gray;font-size:8pt;border-top:1px solid #aaaaaa;}
</pre></code>
</div>
<div class="version">
-%%Version%%<br/>
-%%Time%%
+%%Time%% %%Version%%
</div>
</body>
</html> \ No newline at end of file
diff --git a/framework/Exceptions/templates/exception-fr.html b/framework/Exceptions/templates/exception-fr.html
index 7da91bfd..b6f1369b 100644
--- a/framework/Exceptions/templates/exception-fr.html
+++ b/framework/Exceptions/templates/exception-fr.html
@@ -1,4 +1,4 @@
-<html>
+<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset="utf-8"/>
<meta http-equiv="content-language" content="fr"/>
@@ -28,15 +28,14 @@ td,.version {color: gray;font-size:8pt;border-top:1px solid #aaaaaa;}
%%SourceCode%%
</pre></code>
</div>
-<h3>Trace de la pile d'excution:</h3>
+<h3>Trace de la pile d'ex閏ution:</h3>
<div class="source">
<code><pre>
%%StackTrace%%
</pre></code>
</div>
<div class="version">
-%%Version%%<br/>
-%%Time%%
+%%Time%% %%Version%%
</div>
</body>
</html> \ No newline at end of file
diff --git a/framework/Exceptions/templates/exception-zh.html b/framework/Exceptions/templates/exception-zh.html
index ed8db236..8568dde1 100644
--- a/framework/Exceptions/templates/exception-zh.html
+++ b/framework/Exceptions/templates/exception-zh.html
@@ -35,8 +35,7 @@ td,.version {color: gray;font-size:8pt;border-top:1px solid #aaaaaa;}
</pre></code>
</div>
<div class="version">
-%%Version%%<br/>
-%%Time%%
+%%Time%% %%Version%%
</div>
</body>
</html> \ No newline at end of file
diff --git a/framework/Exceptions/templates/exception.html b/framework/Exceptions/templates/exception.html
index 7dd133f5..45fc264c 100644
--- a/framework/Exceptions/templates/exception.html
+++ b/framework/Exceptions/templates/exception.html
@@ -35,8 +35,7 @@ td,.version {color: gray;font-size:8pt;border-top:1px solid #aaaaaa;}
</pre></code>
</div>
<div class="version">
-%%Version%%<br/>
-%%Time%%
+%%Time%% %%Version%%
</div>
</body>
</html> \ No newline at end of file
diff --git a/framework/Web/UI/THiddenFieldPageStatePersister.php b/framework/Web/UI/THiddenFieldPageStatePersister.php
index bd32f686..5525b50a 100644
--- a/framework/Web/UI/THiddenFieldPageStatePersister.php
+++ b/framework/Web/UI/THiddenFieldPageStatePersister.php
@@ -14,6 +14,7 @@ class THiddenFieldPageStatePersister extends TComponent implements IPageStatePer
public function init($application, $config)
{
$this->_application=$application;
+ $application->getService()->setPageStatePersister($this);
}
/**
@@ -36,19 +37,19 @@ class THiddenFieldPageStatePersister extends TComponent implements IPageStatePer
{
$data=Prado::serialize($state);
$hmac=$this->computeHMAC($data,$this->getKey());
- if(function_exists('gzuncompress') && function_exists('gzcompress'))
+ if(extension_loaded('zlib'))
$data=gzcompress($hmac.$data);
else
$data=$hmac.$data;
- $this->_application->getService()->getRequestedPage()->saveStateField($data);
+ $this->_application->getService()->getRequestedPage()->getClientScript()->registerHiddenField(TClientScriptManager::FIELD_PAGE_STATE,base64_encode($data));
}
public function load()
{
- $str=$this->_application->getService()->getRequestedPage()->loadStateField();
+ $str=base64_decode($this->_application->getRequest()->getItems()->itemAt(TClientScriptManager::FIELD_PAGE_STATE));
if($str==='')
return null;
- if(function_exists('gzuncompress') && function_exists('gzcompress'))
+ if(extension_loaded('zlib'))
$data=gzuncompress($str);
else
$data=$str;
diff --git a/framework/Web/UI/TPage.php b/framework/Web/UI/TPage.php
index 9eb50cde..4c04f597 100644
--- a/framework/Web/UI/TPage.php
+++ b/framework/Web/UI/TPage.php
@@ -14,6 +14,10 @@ class TPage extends TTemplateControl
*/
private $_pageService;
/**
+ * @var TForm form instance
+ */
+ private $_form=null;
+ /**
* @var string template file name
*/
private $_templateFile=null;
@@ -37,25 +41,28 @@ class TPage extends TTemplateControl
* @var TClientScriptManager client script manager
*/
private $_clientScript=null;
+ /**
+ * @var TMap data post back by user
+ */
+ private $_postData;
+ /**
+ * @var TMap postback data that is not handled during first invocation of LoadPostData.
+ */
+ private $_restPostData;
private $_maxPageStateFieldLength=10;
private $_enableViewStateMac=true;
private $_performPreRendering=true;
private $_performRendering=true;
- private $_form=null;
private $_formRendered=false;
private $_inFormRender=false;
- private $_pageState='';
private $_requirePostBackScript=false;
private $_postBackScriptRendered=false;
private $_isCrossPagePostBack=false;
private $_previousPagePath='';
private $_preInitWorkComplete=false;
private $_changedPostDataConsumers=array();
- private $_postData;
- private $_restPostData;
- private $_pageStateChanged=false;
private $_controlsRequiringPostBack=array();
private $_registeredControlThatRequireRaiseEvent=null;
private $_registeredControlsThatRequirePostBack=null;
@@ -409,24 +416,6 @@ class TPage extends TTemplateControl
$this->getPageStatePersister()->save($state);
}
- /**
- * Loads page state data from a hidden field.
- * @return string page state data stored in hidden field
- */
- public function loadStateField()
- {
- return base64_decode($this->_postData->itemAt(TClientScriptManager::FIELD_PAGE_STATE));
- }
-
- /**
- * Saves page state data in a hidden field.
- * @param string string representation of the page state data.
- */
- public function saveStateField($state)
- {
- $this->getClientScript()->registerHiddenField(TClientScriptManager::FIELD_PAGE_STATE,base64_encode($state));
- }
-
public function RegisterEnabledControl($control)
{
$this->getEna.EnabledControls.Add(control);
@@ -603,11 +592,6 @@ EOD;
$this->_registeredControlThatRequireRaiseEvent=$control;
}
- public function getApplication()
- {
- return $this->_application;
- }
-
protected function processPostData($postData,$beforeLoad)
{
$eventTarget=$postData->itemAt('__EVENTTARGET');
diff --git a/requirements/index.php b/requirements/index.php
new file mode 100644
index 00000000..5a83da62
--- /dev/null
+++ b/requirements/index.php
@@ -0,0 +1,123 @@
+<?php
+/**
+ * PRADO Requirements Checker script
+ *
+ * @author Qiang Xue <qiang.xue@gmail.com>
+ * @link http://www.pradosoft.com/
+ * @copyright Copyright &copy; 2005 PradoSoft
+ * @license http://www.pradosoft.com/license/
+ * @version $Revision: $ $Date: $
+ * @package prado
+ */
+
+/**
+ * PRADO Requirements Checker script
+ *
+ * This script will check if your system meets the requirements for running PRADO.
+ * It will check if you are running the right version of PHP, if you included
+ * the right libraries and if your php.ini file settings are correct.
+ *
+ * This script is capable of displaying localized messages.
+ * All messages are stored in messages.txt. A localized message file is named as
+ * messsages-<language code>.txt, and it will be used when the client browser
+ * chooses the corresponding language.
+ * The script output uses a template named template.html.
+ * Its localized version is stored in template-<language code>.html.
+ */
+
+/**
+ * Includes Prado class file
+ */
+require_once(dirname(__FILE__).'/../framework/prado.php');
+
+/**
+ * @var array List of requirements (required or not, check item, hint)
+ */
+$requirements = array(
+ array(true,'version_compare(PHP_VERSION,"5.0.4",">=")','PHP version check','PHP 5.0.4 or higher required'),
+ array(false,'extension_loaded("zlib")','Zlib check','Zlib extension optional'),
+ array(false,'extension_loaded("sqlite")','SQLite check','SQLite extension optional'),
+ array(false,'extension_loaded("memcache")','Memcache check','Memcache extension optional'),
+);
+
+$results = "<table class=\"result\">\n";
+$conclusion = 0;
+foreach($requirements as $requirement)
+{
+ list($required,$expression,$aspect,$hint)=$requirement;
+ eval('$ret='.$expression.';');
+ if($required)
+ {
+ if($ret)
+ $ret='passed';
+ else
+ {
+ $conclusion=1;
+ $ret='error';
+ }
+ }
+ else
+ {
+ if($ret)
+ $ret='passed';
+ else
+ {
+ if($conclusion!==1)
+ $conclusion=2;
+ $ret='warning';
+ }
+ }
+ $results.="<tr class=\"$ret\"><td class=\"$ret\">".lmessage($aspect)."</td><td class=\"$ret\">".lmessage($hint)."</td></tr>\n";
+}
+$results .= '</table>';
+if($conclusion===0)
+ $conclusion=lmessage('all passed');
+else if($conclusion===1)
+ $conclusion=lmessage('failed');
+else
+ $conclusion=lmessage('passed with warnings');
+
+$tokens = array(
+ '%%Conclusion%%' => $conclusion,
+ '%%Details%%' => $results,
+ '%%Version%%' => $_SERVER['SERVER_SOFTWARE'].' <a href="http://www.pradosoft.com/">PRADO</a>/'.Prado::getVersion(),
+ '%%Time%%' => strftime('%Y-%m-%d %H:%m',time()),
+);
+
+$lang = Prado::getPreferredLanguage();
+$templateFile=dirname(__FILE__)."/template-$lang.html";
+if(!is_file($templateFile))
+ $templateFile=dirname(__FILE__).'/template.html';
+if(($content=@file_get_contents($templateFile))===false)
+ die("Unable to open template file '$templateFile'.");
+
+header('Content-Type: text/html; charset=UTF-8');
+echo strtr($content,$tokens);
+
+/**
+ * Returns a localized message according to user preferred language.
+ * @param string message to be translated
+ * @return string translated message
+ */
+function lmessage($token)
+{
+ static $messages=null;
+ if($messages===null)
+ {
+ $lang = Prado::getPreferredLanguage();
+ $msgFile=dirname(__FILE__)."/messages-$lang.txt";
+ if(!is_file($msgFile))
+ $msgFile=dirname(__FILE__).'/messages.txt';
+ if(($entries=@file($msgFile))!==false)
+ {
+ foreach($entries as $entry)
+ {
+ @list($code,$message)=explode('=',$entry,2);
+ $messages[trim($code)]=trim($message);
+ }
+ }
+ }
+ return isset($messages[$token])?$messages[$token]:$token;
+}
+
+?> \ No newline at end of file
diff --git a/requirements/messages-zh.txt b/requirements/messages-zh.txt
new file mode 100644
index 00000000..29888113
--- /dev/null
+++ b/requirements/messages-zh.txt
@@ -0,0 +1,11 @@
+all passed = 恭喜!您的服务器配置完全符合PRADO的要求。
+passed with warnings = 您的服务器配置符合PRADO的最低要求。请关注以下的警告信息。
+failed = 对不起,您的服务器配置不符合PRADO的要求。
+PHP version check = PHP版本检查
+PHP 5.0.4 or higher required = PRADO需要PHP 5.0.4或更高版本。
+SQLite check = SQLite模块检查
+SQLite extension optional = SQLite模块是可选的。如果它不存在,您将无法使用TSQLiteCache。
+Memcache check = Memcache模块检查
+Memcache extension optional = Memcache模块是可选的。如果它不存在,您将无法使用TMemCache。
+Zlib check = Zlib模块检查
+Zlib extension optional = Zlib模块是可选的。如果它不存在,页面的状态信息将无法压缩,由此可能导致您的页面传送数据量增大。 \ No newline at end of file
diff --git a/requirements/messages.txt b/requirements/messages.txt
new file mode 100644
index 00000000..6aecf6a2
--- /dev/null
+++ b/requirements/messages.txt
@@ -0,0 +1,11 @@
+all passed = Congratulations! Your server configuration satisfies all requirements by PRADO.
+passed with warnings = Your server configuration satisfies minimum requirements by PRADO. Please pay attention to the warnings listed below.
+failed = Sorry, your server configuration does not satisfy the requirements by PRADO.
+PHP version check = PHP version check
+PHP 5.0.4 or higher required = PHP version 5.0.4 or higher is required by PRADO.
+SQLite check = SQLite check
+SQLite extension optional = SQLite extension is optional. If it is absent, you will not be able to use TSqliteCache.
+Memcache check = Memcache check
+Memcache extension optional = Memcache extension is optional. If it is absent, you will not be able to use TMemCache.
+Zlib check = Zlib check
+Zlib extension optional = Zlib extension is optional. If it is absent, page state will not be compressed and your page size may increase. \ No newline at end of file
diff --git a/requirements/template-zh.html b/requirements/template-zh.html
new file mode 100644
index 00000000..966d04ce
--- /dev/null
+++ b/requirements/template-zh.html
@@ -0,0 +1,48 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset="utf-8"/>
+<meta http-equiv="content-language" content="en"/>
+<title>PRADO配置需求检查</title>
+<style>
+body {font-family:"Verdana";font-weight:normal;color:black;}
+h1 { font-family:"Verdana";font-weight:normal;font-size:18pt; }
+h3 {font-family:"Verdana";font-weight:bold;font-size:11pt}
+p, td {font-family:"Verdana";font-weight:normal;font-size:10pt;}
+table.result {border-collapse: collapse; width: 100%; font-size: 10pt; font-family:"Verdana";}
+td.passed {background-color: #60BF60;border: 1px solid silver; padding: 2px;}
+td.warning {background-color: #FFFFBF;border: 1px solid silver; padding: 2px;}
+td.error {background-color: #FF8080;border: 1px solid silver; padding: 2px;}
+.version {color: gray;font-size:8pt;border-top:1px solid #aaaaaa;}
+</style>
+</head>
+
+<body bgcolor="white">
+<h1>PRADO配置需求检查</h1>
+<h3>检查说明</h3>
+<p>
+本页面用于检查您的服务器配置是否达到运行<a href="http://www.pradosoft.com/">PRADO</a>应用程序所需的标准。
+它将检查服务器运行的PHP版本,PHP加载的模块,以及php.ini文件中的一些设置。
+</p>
+<h3>检查结果</h3>
+<p>
+%%Conclusion%%
+</p>
+<h3>具体情况</h3>
+</p>
+%%Details%%
+</p>
+<p>
+<table>
+<tr>
+<td class="passed">&nbsp;</td><td>通过</td>
+<td class="error">&nbsp;</td><td>失败</td>
+<td class="warning">&nbsp;</td><td>警告</td>
+</tr>
+</table>
+</p>
+<div class="version">
+%%Time%% %%Version%%
+
+</div>
+</body>
+</html> \ No newline at end of file
diff --git a/requirements/template.html b/requirements/template.html
new file mode 100644
index 00000000..def4a6a7
--- /dev/null
+++ b/requirements/template.html
@@ -0,0 +1,49 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset="utf-8"/>
+<meta http-equiv="content-language" content="en"/>
+<title>PRADO Requirements Checker</title>
+<style>
+body {font-family:"Verdana";font-weight:normal;color:black;}
+h1 { font-family:"Verdana";font-weight:normal;font-size:18pt; }
+h3 {font-family:"Verdana";font-weight:bold;font-size:11pt}
+p, td {font-family:"Verdana";font-weight:normal;font-size:10pt;}
+table.result {border-collapse: collapse; width: 100%; font-size: 10pt; font-family:"Verdana";}
+td.passed {background-color: #60BF60;border: 1px solid silver; padding: 2px;}
+td.warning {background-color: #FFFFBF;border: 1px solid silver; padding: 2px;}
+td.error {background-color: #FF8080;border: 1px solid silver; padding: 2px;}
+.version {color: gray;font-size:8pt;border-top:1px solid #aaaaaa;}
+</style>
+</head>
+
+<body bgcolor="white">
+<h1>PRADO Requirements Checker</h1>
+<h3>Description</h3>
+<p>
+This script checks if your server configuration meets the requirements
+for running <a href="http://www.pradosoft.com/">PRADO</a>-powered applications.
+It checks if the server is running the right version of PHP,
+if appropriate PHP extensions have been loaded, and if php.ini file settings are correct.
+</p>
+<h3>Conclusion</h3>
+<p>
+%%Conclusion%%
+</p>
+<h3>Details</h3>
+</p>
+%%Details%%
+</p>
+<p>
+<table>
+<tr>
+<td class="passed">&nbsp;</td><td>passed</td>
+<td class="error">&nbsp;</td><td>failed</td>
+<td class="warning">&nbsp;</td><td>warning</td>
+</tr>
+</table>
+</p>
+<div class="version">
+%%Time%% %%Version%%
+</div>
+</body>
+</html> \ No newline at end of file