diff options
-rw-r--r-- | HISTORY | 4 | ||||
-rw-r--r-- | demos/personal/protected/Pages/Home.page | 1 | ||||
-rw-r--r-- | framework/Util/TLogRouter.php | 13 | ||||
-rw-r--r-- | framework/Web/THttpResponse.php | 37 |
4 files changed, 32 insertions, 23 deletions
@@ -11,10 +11,12 @@ NEW: SQLMap (Wei) Version 3.0.0 May 1, 2006
=========================
BUG: Ticket#131 - TImageMap and TLinkButton continue to postback even client validator fails (Wei)
-BUT: Non-control components can now use expressions in their properties (Qiang)
+BUG: Ticket#135 - TBrowserLogRoute reports wrong timings (Qiang)
+BUG: Non-control components can now use expressions in their properties (Qiang)
BUG: TControl.Visible did not make use of overriden getVisible() (Qiang)
BUG: TWizard did not stop navigation upon a validation failure (Qiang)
ENH: TButton, TImageButton and TLinkButton now implement IButtonControl interface (Qiang)
+ENH: TResponse::writeFile takes two additional parameters to allow sending memory data (Qiang)
Version 3.0RC2 April 16, 2006
=============================
diff --git a/demos/personal/protected/Pages/Home.page b/demos/personal/protected/Pages/Home.page index bd8bd2c7..204d4c6f 100644 --- a/demos/personal/protected/Pages/Home.page +++ b/demos/personal/protected/Pages/Home.page @@ -1,4 +1,3 @@ <com:TContent ID="main">
main content
-<com:TTextBox ID="TextBox" />
</com:TContent>
\ No newline at end of file diff --git a/framework/Util/TLogRouter.php b/framework/Util/TLogRouter.php index 06d70b1e..233fd373 100644 --- a/framework/Util/TLogRouter.php +++ b/framework/Util/TLogRouter.php @@ -591,17 +591,18 @@ class TBrowserLogRoute extends TLogRoute {
if(empty($logs) || $this->getApplication()->getMode()==='Performance') return;
$first = $logs[0][3];
- $prev = $first;
$even = true;
$response = $this->getApplication()->getResponse();
$response->write($this->renderHeader());
- foreach($logs as $log)
+ for($i=0,$n=count($logs);$i<$n;++$i)
{
- $timing['total'] = $log[3] - $first;
- $timing['delta'] = $log[3] - $prev;
+ $timing['total'] = $logs[$i][3] - $first;
+ if ($i<$n-1)
+ $timing['delta'] = $logs[$i+1][3] - $logs[$i][3];
+ else
+ $timing['delta'] = '?';
$timing['even'] = !($even = !$even);
- $prev=$log[3];
- $response->write($this->renderMessage($log,$timing));
+ $response->write($this->renderMessage($logs[$i],$timing));
}
$response->write($this->renderFooter());
}
diff --git a/framework/Web/THttpResponse.php b/framework/Web/THttpResponse.php index f76218ca..ee2dd99b 100644 --- a/framework/Web/THttpResponse.php +++ b/framework/Web/THttpResponse.php @@ -220,9 +220,11 @@ class THttpResponse extends TModule implements ITextWriter * Sends a file back to user.
* Make sure not to output anything else after calling this method.
* @param string file name
+ * @param string content to be set. If null, the content will be read from the server file pointed to by $fileName.
+ * @param string mime type of the content.
* @throws TInvalidDataValueException if the file cannot be found
*/
- public function writeFile($fileName)
+ public function writeFile($fileName,$content=null,$mimeType=null)
{
static $defaultMimeTypes=array(
'css'=>'text/css',
@@ -234,26 +236,31 @@ class THttpResponse extends TModule implements ITextWriter 'js'=>'javascript/js'
);
- if(!is_file($fileName))
- throw new TInvalidDataValueException('httpresponse_file_inexistent',$fileName);
- header('Pragma: public');
- header('Expires: 0');
- header('Cache-Component: must-revalidate, post-check=0, pre-check=0');
- $mimeType='text/plain';
- if(function_exists('mime_content_type'))
- $mimeType=mime_content_type($fileName);
- else
+ if($mimeType===null)
{
- $ext=array_pop(explode('.',$fileName));
- if(isset($defaultMimeTypes[$ext]))
- $mimeType=$defaultMimeTypes[$ext];
+ if(function_exists('mime_content_type'))
+ $mimeType=mime_content_type($fileName);
+ else
+ {
+ $ext=array_pop(explode('.',$fileName));
+ if(isset($defaultMimeTypes[$ext]))
+ $mimeType=$defaultMimeTypes[$ext];
+ else
+ $mimeType='text/plain';
+ }
}
$fn=basename($fileName);
+ header('Pragma: public');
+ header('Expires: 0');
+ header('Cache-Component: must-revalidate, post-check=0, pre-check=0');
header("Content-type: $mimeType");
header('Content-Length: '.filesize($fileName));
header("Content-Disposition: attachment; filename=\"$fn\"");
header('Content-Transfer-Encoding: binary');
- readfile($fileName);
+ if($content===null)
+ readfile($fileName);
+ else
+ echo $content;
}
/**
@@ -288,7 +295,7 @@ class THttpResponse extends TModule implements ITextWriter $charset=$this->getCharset();
if($charset==='' && ($globalization=$this->getApplication()->getGlobalization(false))!==null)
$charset=$globalization->getCharset();
- if($charset==='')
+ if($charset!=='')
{
$header='Content-Type: '.$this->getContentType().';charset='.$charset;
$this->appendHeader($header);
|