The branch, master has been updated via 8fcb4720e2138429df9f9c3a197187882c0c51ef (commit) via 99faf22237879cd5001043557f730c83b2268029 (commit) via 94ac586dba53e361d59503b1e934809539df454b (commit) via 3a10de866c257225ffb41a92d081b31489c305b2 (commit) from fa300e3887c8468ca738077594d6ef5fae459f46 (commit)
- Log ----------------------------------------------------------------- commit 8fcb4720e2138429df9f9c3a197187882c0c51ef Author: Michal Čihař mcihar@suse.cz Date: Thu Aug 4 15:06:09 2011 +0200
Include length in headers when we know it
commit 99faf22237879cd5001043557f730c83b2268029 Author: Michal Čihař mcihar@suse.cz Date: Thu Aug 4 15:03:31 2011 +0200
Add missing docs
commit 94ac586dba53e361d59503b1e934809539df454b Author: Michal Čihař mcihar@suse.cz Date: Thu Aug 4 15:02:32 2011 +0200
Move avoid_cache to end, it is not used so often as size
commit 3a10de866c257225ffb41a92d081b31489c305b2 Author: Michal Čihař mcihar@suse.cz Date: Thu Aug 4 15:00:38 2011 +0200
Include length in headers
-----------------------------------------------------------------------
Summary of changes: bs_disp_as_mime_type.php | 2 +- libraries/core.lib.php | 9 ++++++--- libraries/schema/Dia_Relation_Schema.class.php | 2 +- libraries/schema/Eps_Relation_Schema.class.php | 2 +- libraries/schema/Pdf_Relation_Schema.class.php | 2 +- libraries/schema/Svg_Relation_Schema.class.php | 2 +- libraries/schema/Visio_Relation_Schema.class.php | 2 +- tbl_get_field.php | 5 ++++- tbl_tracking.php | 2 +- webapp.php | 2 +- 10 files changed, 18 insertions(+), 12 deletions(-)
diff --git a/bs_disp_as_mime_type.php b/bs_disp_as_mime_type.php index fd75c4d..5284e55 100644 --- a/bs_disp_as_mime_type.php +++ b/bs_disp_as_mime_type.php @@ -43,7 +43,7 @@ if ($fHnd === false) {
$f_size = $hdrs['Content-Length'];
-PMA_download_header(basename($filename), $c_type, true, $f_size); +PMA_download_header(basename($filename), $c_type, $f_size);
$pos = 0; $content = ""; diff --git a/libraries/core.lib.php b/libraries/core.lib.php index 38473ff..306ad2d 100644 --- a/libraries/core.lib.php +++ b/libraries/core.lib.php @@ -562,11 +562,14 @@ function PMA_no_cache_header() /** * Sends header indicating file download. * - * @param $filename string Filename to include in headers. - * @param $mimetype string MIME type to include in headers. + * @param $filename string Filename to include in headers. + * @param $mimetype string MIME type to include in headers. + * @param $length int Length of content (optional) + * @param $avoid_cache bool Whether to include no-caching headers. + * * @return nothing */ -function PMA_download_header($filename, $mimetype, $avoid_cache = true, $length = 0) { +function PMA_download_header($filename, $mimetype, $length = 0, $avoid_cache = true) { if ($avoid_cache) { PMA_no_cache_header(); } diff --git a/libraries/schema/Dia_Relation_Schema.class.php b/libraries/schema/Dia_Relation_Schema.class.php index 46e07d3..fa2884d 100644 --- a/libraries/schema/Dia_Relation_Schema.class.php +++ b/libraries/schema/Dia_Relation_Schema.class.php @@ -170,8 +170,8 @@ class PMA_DIA extends XMLWriter if(ob_get_clean()){ ob_end_clean(); } - PMA_download_header($fileName . '.dia', 'application/x-dia-diagram'); $output = $this->flush(); + PMA_download_header($fileName . '.dia', 'application/x-dia-diagram', strlen($output)); print $output; } } diff --git a/libraries/schema/Eps_Relation_Schema.class.php b/libraries/schema/Eps_Relation_Schema.class.php index 91e4bfa..367b8c2 100644 --- a/libraries/schema/Eps_Relation_Schema.class.php +++ b/libraries/schema/Eps_Relation_Schema.class.php @@ -333,8 +333,8 @@ class PMA_EPS // if(ob_get_clean()){ //ob_end_clean(); //} - PMA_download_header($fileName . '.eps', 'image/x-eps'); $output = $this->stringCommands; + PMA_download_header($fileName . '.eps', 'image/x-eps', strlen($output)); print $output; } } diff --git a/libraries/schema/Pdf_Relation_Schema.class.php b/libraries/schema/Pdf_Relation_Schema.class.php index 68efc28..ec03d37 100644 --- a/libraries/schema/Pdf_Relation_Schema.class.php +++ b/libraries/schema/Pdf_Relation_Schema.class.php @@ -1068,7 +1068,7 @@ class PMA_Pdf_Relation_Schema extends PMA_Export_Relation_Schema } // instead of $pdf->Output(): $pdfData = $pdf->getPDFData(); - PMA_download_header($filename, 'application/pdf'); + PMA_download_header($filename, 'application/pdf', strlen($pdfData)); echo $pdfData; }
diff --git a/libraries/schema/Svg_Relation_Schema.class.php b/libraries/schema/Svg_Relation_Schema.class.php index 71f93c6..0593abd 100644 --- a/libraries/schema/Svg_Relation_Schema.class.php +++ b/libraries/schema/Svg_Relation_Schema.class.php @@ -168,8 +168,8 @@ class PMA_SVG extends XMLWriter function showOutput($fileName) { //ob_get_clean(); - PMA_download_header($fileName . '.svg', 'image/svg+xml'); $output = $this->flush(); + PMA_download_header($fileName . '.svg', 'image/svg+xml', strlen($output)); print $output; }
diff --git a/libraries/schema/Visio_Relation_Schema.class.php b/libraries/schema/Visio_Relation_Schema.class.php index aa18c06..cfe4424 100644 --- a/libraries/schema/Visio_Relation_Schema.class.php +++ b/libraries/schema/Visio_Relation_Schema.class.php @@ -155,8 +155,8 @@ class PMA_VISIO extends XMLWriter //if(ob_get_clean()){ //ob_end_clean(); //} - PMA_download_header($fileName . '.vdx', 'application/visio'); $output = $this->flush(); + PMA_download_header($fileName . '.vdx', 'application/visio', strlen($output)); print $output; } } diff --git a/tbl_get_field.php b/tbl_get_field.php index 8c6c163..f7efd4f 100644 --- a/tbl_get_field.php +++ b/tbl_get_field.php @@ -37,6 +37,9 @@ if ($result === false) { /* Avoid corrupting data */ @ini_set('url_rewriter.tags', '');
-PMA_download_header($table . '-' . $transform_key . '.bin', PMA_detectMIME($result)); +PMA_download_header( + $table . '-' . $transform_key . '.bin', + PMA_detectMIME($result), + strlen($result)); echo $result; ?> diff --git a/tbl_tracking.php b/tbl_tracking.php index 445976f..76ed16a 100644 --- a/tbl_tracking.php +++ b/tbl_tracking.php @@ -112,7 +112,7 @@ if (isset($_REQUEST['report_export']) && $_REQUEST['export_type'] == 'sqldumpfil $dump .= $entry['statement']; } $filename = 'log_' . htmlspecialchars($_REQUEST['table']) . '.sql'; - PMA_download_header($filename, 'text/x-sql'); + PMA_download_header($filename, 'text/x-sql', strlen($dump));
echo $dump; exit(); diff --git a/webapp.php b/webapp.php index 8295efd..63ca1bf 100644 --- a/webapp.php +++ b/webapp.php @@ -44,7 +44,7 @@ foreach ($parameters as $key => $value) { $ini_file .= $key . '=' . $value . "\n"; }
-PMA_download_header($name, 'application/webapp', false); +PMA_download_header($name, 'application/webapp', 0, false);
$zip = new zipfile; $zip->setDoWrite();
hooks/post-receive