[Phpmyadmin-git] [SCM] phpMyAdmin branch, QA_3_3, updated. RELEASE_3_3_1RC1-84-geb5e038

Michal Čihař nijel at users.sourceforge.net
Wed Mar 31 14:32:46 CEST 2010


The branch, QA_3_3 has been updated
       via  eb5e03880e579d572ec8e45a8fc0777929defddc (commit)
      from  1e984375b6ab0253b8c1860b55a11e705be772c0 (commit)


- Log -----------------------------------------------------------------
-----------------------------------------------------------------------

Summary of changes:
 ChangeLog                 |    1 +
 libraries/export/xls.php  |    1 +
 libraries/export/xlsx.php |   37 +++++++++++++++++++------------------
 3 files changed, 21 insertions(+), 18 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 0b902ce..61e090d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -20,6 +20,7 @@ $HeadURL: https://phpmyadmin.svn.sourceforge.net/svnroot/phpmyadmin/trunk/phpMyA
 - patch #2977725 [export] XML wrongly encoded, thanks to Victor Volkov - hanut
 - patch #2979234 [import] Create tables with current charset and collation.
 - patch #2979234, bug #2960105 [import] Properly import unicode text from ODS.
+- bug #2973280 [export] Proper handling of temporary directory in XLS export.
 
 3.3.1.0 (2010-03-16)
 - bug #2941037 [core] Database structure not sorted by table correctly 
diff --git a/libraries/export/xls.php b/libraries/export/xls.php
index b450d6f..efbb481 100644
--- a/libraries/export/xls.php
+++ b/libraries/export/xls.php
@@ -59,6 +59,7 @@ function PMA_exportFooter() {
     $tmp_filename = tempnam(realpath($GLOBALS['cfg']['TempDir']), 'pma_xls_');
     
     $workbookWriter = new PHPExcel_Writer_Excel5($workbook);
+    $workbookWriter->setTempDir(realpath($GLOBALS['cfg']['TempDir']));
     $workbookWriter->save($tmp_filename);
     
     if (!PMA_exportOutputHandler(file_get_contents($tmp_filename))) {
diff --git a/libraries/export/xlsx.php b/libraries/export/xlsx.php
index 5a8ec70..86a17a9 100644
--- a/libraries/export/xlsx.php
+++ b/libraries/export/xlsx.php
@@ -55,18 +55,19 @@ function PMA_exportComment($text) {
 function PMA_exportFooter() {
     global $workbook;
     global $tmp_filename;
-    
+
     $tmp_filename = tempnam(realpath($GLOBALS['cfg']['TempDir']), 'pma_xlsx_');
-    
+
     $workbookWriter = new PHPExcel_Writer_Excel2007($workbook);
+    $workbookWriter->setTempDir(realpath($GLOBALS['cfg']['TempDir']));
     $workbookWriter->save($tmp_filename);
-    
+
     if (!PMA_exportOutputHandler(file_get_contents($tmp_filename))) {
         return FALSE;
     }
-    
+
     unlink($tmp_filename);
-    
+
     unset($GLOBALS['workbook']);
     unset($GLOBALS['sheet_index']);
 
@@ -82,17 +83,17 @@ function PMA_exportFooter() {
  */
 function PMA_exportHeader() {
     global $db;
-    
+
     /* Initialize the workbook */
     $GLOBALS['workbook'] = new PHPExcel();
     $GLOBALS['sheet_index'] = 0;
     global $workbook;
-    
+
     $workbook->getProperties()->setCreator('phpMyAdmin ' . PMA_VERSION);
     $workbook->getProperties()->setLastModifiedBy('phpMyAdmin ' . PMA_VERSION);
     $workbook->getProperties()->setTitle($db);
     $workbook->getProperties()->setSubject('phpMyAdmin ' . PMA_VERSION . ' XLSX Dump');
-    
+
     return TRUE;
 }
 
@@ -106,8 +107,8 @@ function PMA_exportHeader() {
  * @access  public
  */
 function PMA_exportDBHeader($db) {
-    
-    
+
+
     return TRUE;
 }
 
@@ -153,33 +154,33 @@ function PMA_exportDBCreate($db) {
 function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) {
     global $workbook;
     global $sheet_index;
-    
+
     /**
      * Get the data from the database using the original query
      */
     $result      = PMA_DBI_fetch_result($sql_query);
     $row_cnt     = count($result);
-    
+
     if ($row_cnt > 0) {
         $col_names = array_keys($result[0]);
         $fields_cnt = count($result[0]);
         $row_offset = 1;
-        
+
         /* Only one sheet is created on workbook initialization */
         if ($sheet_index > 0) {
             $workbook->createSheet();
         }
-        
+
         $workbook->setActiveSheetIndex($sheet_index);
         $workbook->getActiveSheet()->setTitle(substr($table, 0, 31));
-        
+
         if (isset($GLOBALS['xlsx_columns']) && $GLOBALS['xlsx_columns']) {
             for ($i = 0; $i < $fields_cnt; ++$i) {
                 $workbook->getActiveSheet()->setCellValueByColumnAndRow($i, $row_offset, $col_names[$i]);
             }
             $row_offset++;
         }
-        
+
         for ($r = 0; ($r < 65536) && ($r < $row_cnt); ++$r) {
             for ($c = 0; $c < $fields_cnt; ++$c) {
                 if (!isset($result[$r][$col_names[$c]]) || is_null($result[$r][$col_names[$c]])) {
@@ -194,10 +195,10 @@ function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) {
                 }
             }
         }
-        
+
         $sheet_index++;
     }
-    
+
     return TRUE;
 }
 


hooks/post-receive
-- 
phpMyAdmin




More information about the Git mailing list