home *** CD-ROM | disk | FTP | other *** search
/ Freelog 70 / Freelog070.iso / Internet / EasyPHP / easyphp1-8_setup.exe / {app} / phpmyadmin / export.php < prev    next >
Encoding:
PHP Script  |  2005-01-23  |  21.3 KB  |  590 lines

  1. <?php
  2. /* $Id: export.php,v 2.18.2.1 2005/01/23 23:23:57 nijel Exp $ */
  3. // vim: expandtab sw=4 ts=4 sts=4:
  4.  
  5. /**
  6.  * Get the variables sent or posted to this script and a core script
  7.  */
  8. require_once('./libraries/grab_globals.lib.php');
  9. require_once('./libraries/common.lib.php');
  10. require_once('./libraries/zip.lib.php');
  11.  
  12. PMA_checkParameters(array('what'));
  13.  
  14. // What type of export are we doing?
  15. if ($what == 'excel') {
  16.     $type = 'csv';
  17. } else {
  18.     $type = $what;
  19. }
  20.  
  21. // Get the functions specific to the export type
  22. require('./libraries/export/' . PMA_securePath($type) . '.php');
  23.  
  24. // Generate error url
  25. if ($export_type == 'server') {
  26.     $err_url = 'server_export.php?' . PMA_generate_common_url();
  27. } elseif ($export_type == 'database') {
  28.     $err_url = 'db_details_export.php?' . PMA_generate_common_url($db);
  29. } else {
  30.     $err_url = 'tbl_properties_export.php?' . PMA_generate_common_url($db, $table);
  31. }
  32.  
  33. /**
  34.  * Increase time limit for script execution and initializes some variables
  35.  */
  36. @set_time_limit($cfg['ExecTimeLimit']);
  37.  
  38. // Start with empty buffer
  39. $dump_buffer = '';
  40. $dump_buffer_len = 0;
  41.  
  42. // We send fake headers to avoid browser timeout when buffering
  43. $time_start = time();
  44.  
  45.  
  46. /**
  47.  * Output handler for all exports, if needed buffering, it stores data into
  48.  * $dump_buffer, otherwise it prints thems out.
  49.  *
  50.  * @param   string  the insert statement
  51.  *
  52.  * @return  bool    Whether output suceeded
  53.  */
  54. function PMA_exportOutputHandler($line)
  55. {
  56.     global $time_start, $dump_buffer, $dump_buffer_len, $save_filename;
  57.  
  58.     // Kanji encoding convert feature
  59.     if ($GLOBALS['output_kanji_conversion']) {
  60.         $line = PMA_kanji_str_conv($line, $GLOBALS['knjenc'], isset($GLOBALS['xkana']) ? $GLOBALS['xkana'] : '');
  61.     }
  62.     // If we have to buffer data, we will perform everything at once at the end
  63.     if ($GLOBALS['buffer_needed']) {
  64.  
  65.         $dump_buffer .= $line;
  66.         if ($GLOBALS['onfly_compression']) {
  67.  
  68.             $dump_buffer_len += strlen($line);
  69.  
  70.             if ($dump_buffer_len > $GLOBALS['memory_limit']) {
  71.                 if ($GLOBALS['output_charset_conversion']) {
  72.                     $dump_buffer = PMA_convert_string($GLOBALS['charset'], $GLOBALS['charset_of_file'], $dump_buffer);
  73.                 }
  74.                 // as bzipped
  75.                 if ($GLOBALS['compression'] == 'bzip'  && @function_exists('bzcompress')) {
  76.                     $dump_buffer = bzcompress($dump_buffer);
  77.                 }
  78.                 // as a gzipped file
  79.                 else if ($GLOBALS['compression'] == 'gzip' && @function_exists('gzencode')) {
  80.                     // without the optional parameter level because it bug
  81.                     $dump_buffer = gzencode($dump_buffer);
  82.                 }
  83.                 if ($GLOBALS['save_on_server']) {
  84.                     $write_result = @fwrite($GLOBALS['file_handle'], $dump_buffer);
  85.                     if (!$write_result || ($write_result != strlen($dump_buffer))) {
  86.                         $GLOBALS['message'] = sprintf($GLOBALS['strNoSpace'], htmlspecialchars($save_filename));
  87.                         return FALSE;
  88.                     }
  89.                 } else {
  90.                     echo $dump_buffer;
  91.                 }
  92.                 $dump_buffer = '';
  93.                 $dump_buffer_len = 0;
  94.             }
  95.         } else {
  96.             $time_now = time();
  97.             if ($time_start >= $time_now + 30) {
  98.                 $time_start = $time_now;
  99.                 header('X-pmaPing: Pong');
  100.             } // end if
  101.         }
  102.     } else {
  103.         if ($GLOBALS['asfile']) {
  104.             if ($GLOBALS['save_on_server'] && strlen($line) > 0) {
  105.                 $write_result = @fwrite($GLOBALS['file_handle'], $line);
  106.                 if (!$write_result || ($write_result != strlen($line))) {
  107.                     $GLOBALS['message'] = sprintf($GLOBALS['strNoSpace'], htmlspecialchars($save_filename));
  108.                     return FALSE;
  109.                 }
  110.                 $time_now = time();
  111.                 if ($time_start >= $time_now + 30) {
  112.                     $time_start = $time_now;
  113.                     header('X-pmaPing: Pong');
  114.                 } // end if
  115.             } else {
  116.                 // We export as file - output normally
  117.                 if ($GLOBALS['output_charset_conversion']) {
  118.                     $line = PMA_convert_string($GLOBALS['charset'], $GLOBALS['charset_of_file'], $line);
  119.                 }
  120.                 echo $line;
  121.             }
  122.         } else {
  123.             // We export as html - replace special chars
  124.             echo htmlspecialchars($line);
  125.         }
  126.     }
  127.     return TRUE;
  128. } // end of the 'PMA_exportOutputHandler()' function
  129.  
  130. // Will we save dump on server?
  131. $save_on_server = isset($cfg['SaveDir']) && !empty($cfg['SaveDir']) && !empty($onserver);
  132.  
  133. // Ensure compressed formats are associated with the download feature
  134. if (empty($asfile)) {
  135.     if ($save_on_server) {
  136.         $asfile = TRUE;
  137.     } elseif (isset($compression) && ($compression == 'zip' | $compression == 'gzip' | $compression == 'bzip')) {
  138.         $asfile = TRUE;
  139.     } else {
  140.         $asfile = FALSE;
  141.     }
  142. } else {
  143.     $asfile = TRUE;
  144. }
  145.  
  146. // Defines the default <CR><LF> format. For SQL always use \n as MySQL wants this on all platforms.
  147. if ($what == 'sql') {
  148.     $crlf = "\n";
  149. } else {
  150.     $crlf = PMA_whichCrlf();
  151. }
  152.  
  153. $output_kanji_conversion = function_exists('PMA_kanji_str_conv') && $type != 'xls';
  154.  
  155. // Do we need to convert charset?
  156. $output_charset_conversion = $asfile &&
  157.     $cfg['AllowAnywhereRecoding'] && $allow_recoding
  158.     && isset($charset_of_file) && $charset_of_file != $charset
  159.     && $type != 'xls';
  160.  
  161. // Set whether we will need buffering
  162. $buffer_needed = isset($compression) && ($compression == 'zip' | $compression == 'gzip' | $compression == 'bzip');
  163.  
  164. // Use on fly compression?
  165. $onfly_compression = $GLOBALS['cfg']['CompressOnFly'] && isset($compression) && ($compression == 'gzip' | $compression == 'bzip');
  166. if ($onfly_compression) {
  167.     $memory_limit = trim(@ini_get('memory_limit'));
  168.     // 2 MB as default
  169.     if (empty($memory_limit)) $memory_limit = 2 * 1024 * 1024;
  170.  
  171.     if (strtolower(substr($memory_limit, -1)) == 'm') $memory_limit = (int)substr($memory_limit, 0, -1) * 1024 * 1024;
  172.     elseif (strtolower(substr($memory_limit, -1)) == 'k') $memory_limit = (int)substr($memory_limit, 0, -1) * 1024;
  173.     elseif (strtolower(substr($memory_limit, -1)) == 'g') $memory_limit = (int)substr($memory_limit, 0, -1) * 1024 * 1024 * 1024;
  174.     else $memory_limit = (int)$memory_limit;
  175.  
  176.     // Some of memory is needed for other thins and as treshold.
  177.     // Nijel: During export I had allocated (see memory_get_usage function)
  178.     //        approx 1.2MB so this comes from that.
  179.     if ($memory_limit > 1500000) $memory_limit -= 1500000;
  180.  
  181.     // Some memory is needed for compression, assume 1/3
  182.     $memory_limit *= 2/3;
  183. }
  184.  
  185. // Generate filename and mime type if needed
  186. if ($asfile) {
  187.     $pma_uri_parts = parse_url($cfg['PmaAbsoluteUri']);
  188.     if ($export_type == 'server') {
  189.         if (isset($remember_template)) {
  190.             setcookie('pma_server_filename_template', $filename_template , 0,
  191.                 substr($pma_uri_parts['path'], 0, strrpos($pma_uri_parts['path'], '/')),
  192.                 '', ($pma_uri_parts['scheme'] == 'https'));
  193.         }
  194.         $filename = str_replace('__SERVER__', $GLOBALS['cfg']['Server']['host'], strftime($filename_template));
  195.     } elseif ($export_type == 'database') {
  196.         if (isset($remember_template)) {
  197.             setcookie('pma_db_filename_template', $filename_template , 0,
  198.                 substr($pma_uri_parts['path'], 0, strrpos($pma_uri_parts['path'], '/')),
  199.                 '', ($pma_uri_parts['scheme'] == 'https'));
  200.         }
  201.         $filename = str_replace('__DB__', $db, str_replace('__SERVER__', $GLOBALS['cfg']['Server']['host'], strftime($filename_template)));
  202.     } else {
  203.         if (isset($remember_template)) {
  204.             setcookie('pma_table_filename_template', $filename_template , 0,
  205.                 substr($pma_uri_parts['path'], 0, strrpos($pma_uri_parts['path'], '/')),
  206.                 '', ($pma_uri_parts['scheme'] == 'https'));
  207.         }
  208.         $filename = str_replace('__TABLE__', $table, str_replace('__DB__', $db, str_replace('__SERVER__', $GLOBALS['cfg']['Server']['host'], strftime($filename_template))));
  209.     }
  210.  
  211.     // convert filename to iso-8859-1, it is safer
  212.     if (!(isset($cfg['AllowAnywhereRecoding']) && $cfg['AllowAnywhereRecoding'] && $allow_recoding)) {
  213.         $filename = PMA_convert_string($charset, 'iso-8859-1', $filename);
  214.     } else {
  215.         $filename = PMA_convert_string($convcharset, 'iso-8859-1', $filename);
  216.     }
  217.  
  218.     // Generate basic dump extension
  219.     if ($type == 'csv') {
  220.         $filename  .= '.csv';
  221.         $mime_type = 'text/x-comma-separated-values';
  222.     } else if ($type == 'xls') {
  223.         $filename  .= '.xls';
  224.         $mime_type = 'application/vnd.ms-excel';
  225.     } else if ($type == 'xml') {
  226.         $filename  .= '.xml';
  227.         $mime_type = 'text/xml';
  228.     } else if ($type == 'latex') {
  229.         $filename  .= '.tex';
  230.         $mime_type = 'application/x-tex';
  231.     } else {
  232.         $filename  .= '.sql';
  233.         $mime_type = 'text/x-sql';
  234.     }
  235.  
  236.     // If dump is going to be compressed, set correct encoding or mime_type and add
  237.     // compression to extension
  238.     $content_encoding = '';
  239.     if (isset($compression) && $compression == 'bzip') {
  240.         $filename  .= '.bz2';
  241.         // browsers don't like this:
  242.         //$content_encoding = 'x-bzip2';
  243.         $mime_type = 'application/x-bzip2';
  244.     } else if (isset($compression) && $compression == 'gzip') {
  245.         $filename  .= '.gz';
  246.         // needed to avoid recompression by server modules like mod_gzip:
  247.         $content_encoding = 'x-gzip';
  248.         $mime_type = 'application/x-gzip';
  249.     } else if (isset($compression) && $compression == 'zip') {
  250.         $filename  .= '.zip';
  251.         $mime_type = 'application/zip';
  252.     }
  253. }
  254.  
  255. // Open file on server if needed
  256. if ($save_on_server) {
  257.     if (substr($cfg['SaveDir'], -1) != '/') {
  258.         $cfg['SaveDir'] .= '/';
  259.     }
  260.     $save_filename = $cfg['SaveDir'] . preg_replace('@[/\\\\]@','_',$filename);
  261.     unset($message);
  262.     if (file_exists($save_filename) && empty($onserverover)) {
  263.         $message = sprintf($strFileAlreadyExists, htmlspecialchars($save_filename));
  264.     } else {
  265.         if (is_file($save_filename) && !is_writable($save_filename)) {
  266.             $message = sprintf($strNoPermission, htmlspecialchars($save_filename));
  267.         } else {
  268.             if (!$file_handle = @fopen($save_filename, 'w')) {
  269.                 $message = sprintf($strNoPermission, htmlspecialchars($save_filename));
  270.             }
  271.         }
  272.     }
  273.     if (isset($message)) {
  274.         $js_to_run = 'functions.js';
  275.         require_once('./header.inc.php');
  276.         if ($export_type == 'server') {
  277.             $active_page = 'server_export.php';
  278.             require('./server_export.php');
  279.         } elseif ($export_type == 'database') {
  280.             $active_page = 'db_details_export.php';
  281.             require('./db_details_export.php');
  282.         } else {
  283.             $active_page = 'tbl_properties_export.php';
  284.             require('./tbl_properties_export.php');
  285.         }
  286.         exit();
  287.     }
  288. }
  289.  
  290. /**
  291.  * Send headers depending on whether the user chose to download a dump file
  292.  * or not
  293.  */
  294. if (!$save_on_server) {
  295.     if ($asfile ) {
  296.         // Download
  297.         if (!empty($content_encoding)) {
  298.             header('Content-Encoding: ' . $content_encoding);
  299.         }
  300.         header('Content-Type: ' . $mime_type);
  301.         header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT');
  302.         // lem9 & loic1: IE need specific headers
  303.         if (PMA_USR_BROWSER_AGENT == 'IE') {
  304.             header('Content-Disposition: inline; filename="' . $filename . '"');
  305.             header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
  306.             header('Pragma: public');
  307.         } else {
  308.             header('Content-Disposition: attachment; filename="' . $filename . '"');
  309.             header('Pragma: no-cache');
  310.         }
  311.     } else {
  312.         // HTML
  313.         $backup_cfgServer = $cfg['Server'];
  314.         require_once('./header.inc.php');
  315.         $cfg['Server'] = $backup_cfgServer;
  316.         unset($backup_cfgServer);
  317.         echo "\n" . '<div align="' . $cell_align_left . '">' . "\n";
  318.         //echo '    <pre>' . "\n";
  319.         echo '    <form name="nofunction">' . "\n"
  320.            // remove auto-select for now: there is no way to select
  321.            // only a part of the text; anyway, it should obey
  322.            // $cfg['TextareaAutoSelect']
  323.            //. '        <textarea name="sqldump" cols="50" rows="30" onclick="this.select();" id="textSQLDUMP" wrap="OFF">' . "\n";
  324.            . '        <textarea name="sqldump" cols="50" rows="30" id="textSQLDUMP" wrap="OFF">' . "\n";
  325.     } // end download
  326. }
  327.  
  328. // Check if we have something to export
  329. if ($export_type == 'database') {
  330.     $tables     = PMA_DBI_get_tables($db);
  331.     $num_tables = count($tables);
  332.     if ($num_tables == 0) {
  333.         $message = $strNoTablesFound;
  334.         $js_to_run = 'functions.js';
  335.         require_once('./header.inc.php');
  336.         if ($export_type == 'server') {
  337.             $active_page = 'server_export.php';
  338.             require('./server_export.php');
  339.         } elseif ($export_type == 'database') {
  340.             $active_page = 'db_details_export.php';
  341.             require('./db_details_export.php');
  342.         } else {
  343.             $active_page = 'tbl_properties_export.php';
  344.             require('./tbl_properties_export.php');
  345.         }
  346.         exit();
  347.     }
  348. }
  349.  
  350. // Fake loop just to allow skip of remain of this code by break, I'd really
  351. // need exceptions here :-)
  352. do {
  353.  
  354. // Add possibly some comments to export
  355. if (!PMA_exportHeader()) break;
  356.  
  357. // Will we need relation & co. setup?
  358. $do_relation = isset($GLOBALS[$what . '_relation']);
  359. $do_comments = isset($GLOBALS[$what . '_comments']);
  360. $do_mime     = isset($GLOBALS[$what . '_mime']);
  361. if ($do_relation || $do_comments || $do_mime) {
  362.     require_once('./libraries/relation.lib.php');
  363.     $cfgRelation = PMA_getRelationsParam();
  364. }
  365. if ($do_mime) {
  366.     require_once('./libraries/transformations.lib.php');
  367. }
  368.  
  369. // Include dates in export?
  370. $do_dates   = isset($GLOBALS[$what . '_dates']);
  371.  
  372. /**
  373.  * Builds the dump
  374.  */
  375. // Gets the number of tables if a dump of a database has been required
  376. if ($export_type == 'server') {
  377.     /**
  378.      * Gets the databases list - if it has not been built yet
  379.      */
  380.     if ($server > 0 && empty($dblist)) {
  381.         PMA_availableDatabases();
  382.     }
  383.  
  384.     if (isset($db_select)) {
  385.         $tmp_select = implode($db_select, '|');
  386.         $tmp_select = '|' . $tmp_select . '|';
  387.     }
  388.     // Walk over databases
  389.     foreach ($dblist AS $current_db) {
  390.         if ((isset($tmp_select) && strpos(' ' . $tmp_select, '|' . $current_db . '|'))
  391.             || !isset($tmp_select)) {
  392.             if (!PMA_exportDBHeader($current_db))
  393.                 break 2;
  394.             if (!PMA_exportDBCreate($current_db))
  395.                 break 2;
  396.             $tables = PMA_DBI_get_tables($current_db);
  397.             foreach ($tables as $table) {
  398.                 $local_query  = 'SELECT * FROM ' . PMA_backquote($current_db) . '.' . PMA_backquote($table);
  399.                 if (isset($GLOBALS[$what . '_structure'])) {
  400.                     if (!PMA_exportStructure($current_db, $table, $crlf, $err_url, $do_relation, $do_comments, $do_mime, $do_dates))
  401.                         break 3;
  402.                 }
  403.                 if (isset($GLOBALS[$what . '_data'])) {
  404.                     if (!PMA_exportData($current_db, $table, $crlf, $err_url, $local_query))
  405.                         break 3;
  406.                 }
  407.             }
  408.             if (!PMA_exportDBFooter($current_db))
  409.                 break 2;
  410.         }
  411.     }
  412. } elseif ($export_type == 'database') {
  413.     if (!PMA_exportDBHeader($db))
  414.         break;
  415.  
  416.     if (isset($table_select)) {
  417.         $tmp_select = implode($table_select, '|');
  418.         $tmp_select = '|' . $tmp_select . '|';
  419.     }
  420.     $i = 0;
  421.     foreach ($tables as $table) {
  422.         $local_query  = 'SELECT * FROM ' . PMA_backquote($db) . '.' . PMA_backquote($table);
  423.         if ((isset($tmp_select) && strpos(' ' . $tmp_select, '|' . $table . '|'))
  424.             || !isset($tmp_select)) {
  425.  
  426.             if (isset($GLOBALS[$what . '_structure'])) {
  427.                 if (!PMA_exportStructure($db, $table, $crlf, $err_url, $do_relation, $do_comments, $do_mime, $do_dates))
  428.                     break 2;
  429.             }
  430.             if (isset($GLOBALS[$what . '_data'])) {
  431.                 if (!PMA_exportData($db, $table, $crlf, $err_url, $local_query))
  432.                     break 2;
  433.             }
  434.         }
  435.     }
  436.     if (!PMA_exportDBFooter($db))
  437.         break;
  438. } else {
  439.     if (!PMA_exportDBHeader($db))
  440.         break;
  441.     // We export just one table
  442.  
  443.     if ($limit_to > 0 && $limit_from >= 0) {
  444.         $add_query  = ' LIMIT '
  445.                     . (($limit_from > 0) ? $limit_from . ', ' : '')
  446.                     . $limit_to;
  447.     } else {
  448.         $add_query  = '';
  449.     }
  450.  
  451.     if (!empty($sql_query)) {
  452.         $local_query = $sql_query . $add_query;
  453.         PMA_DBI_select_db($db);
  454.     } else {
  455.         $local_query  = 'SELECT * FROM ' . PMA_backquote($db) . '.' . PMA_backquote($table) . $add_query;
  456.     }
  457.  
  458.     if (isset($GLOBALS[$what . '_structure'])) {
  459.         if (!PMA_exportStructure($db, $table, $crlf, $err_url, $do_relation, $do_comments, $do_mime, $do_dates))
  460.             break;
  461.     }
  462.     if (isset($GLOBALS[$what . '_data'])) {
  463.         if (!PMA_exportData($db, $table, $crlf, $err_url, $local_query))
  464.             break;
  465.     }
  466.     if (!PMA_exportDBFooter($db))
  467.         break;
  468. }
  469. if (!PMA_exportFooter()) break;
  470.  
  471. } while (FALSE);
  472. // End of fake loop
  473.  
  474. if ($save_on_server && isset($message)) {
  475.     $js_to_run = 'functions.js';
  476.     require_once('./header.inc.php');
  477.     if ($export_type == 'server') {
  478.         $active_page = 'server_export.php';
  479.         require('./server_export.php');
  480.     } elseif ($export_type == 'database') {
  481.         $active_page = 'db_details_export.php';
  482.         require('./db_details_export.php');
  483.     } else {
  484.         $active_page = 'tbl_properties_export.php';
  485.         require('./tbl_properties_export.php');
  486.     }
  487.     exit();
  488. }
  489.  
  490. /**
  491.  * Send the dump as a file...
  492.  */
  493. if (!empty($asfile)) {
  494.     // Convert the charset if required.
  495.     if ($output_charset_conversion) {
  496.         $dump_buffer = PMA_convert_string($GLOBALS['charset'], $GLOBALS['charset_of_file'], $dump_buffer);
  497.     }
  498.  
  499.     // Do the compression
  500.     // 1. as a gzipped file
  501.     if (isset($compression) && $compression == 'zip') {
  502.         if (@function_exists('gzcompress')) {
  503.             $zipfile = new zipfile();
  504.             $zipfile -> addFile($dump_buffer, substr($filename, 0, -4));
  505.             $dump_buffer = $zipfile -> file();
  506.         }
  507.     }
  508.     // 2. as a bzipped file
  509.     else if (isset($compression) && $compression == 'bzip') {
  510.         if (@function_exists('bzcompress')) {
  511.             $dump_buffer = bzcompress($dump_buffer);
  512.             if ($dump_buffer === -8) {
  513.                 require_once('./header.inc.php');
  514.                 echo sprintf($strBzError, '<a href="http://bugs.php.net/bug.php?id=17300" target="_blank">17300</a>');
  515.                 require_once('./footer.inc.php');
  516.             }
  517.         }
  518.     }
  519.     // 3. as a gzipped file
  520.     else if (isset($compression) && $compression == 'gzip') {
  521.         if (@function_exists('gzencode')) {
  522.             // without the optional parameter level because it bug
  523.             $dump_buffer = gzencode($dump_buffer);
  524.         }
  525.     }
  526.  
  527.     /* If ve saved on server, we have to close file now */
  528.     if ($save_on_server) {
  529.         $write_result = @fwrite($file_handle, $dump_buffer);
  530.         fclose($file_handle);
  531.         if (strlen($dump_buffer) !=0 && (!$write_result || ($write_result != strlen($dump_buffer)))) {
  532.             $message = sprintf($strNoSpace, htmlspecialchars($save_filename));
  533.         } else {
  534.             $message = sprintf($strDumpSaved, htmlspecialchars($save_filename));
  535.         }
  536.  
  537.         $js_to_run = 'functions.js';
  538.         require_once('./header.inc.php');
  539.         if ($export_type == 'server') {
  540.             $active_page = 'server_export.php';
  541.             require_once('./server_export.php');
  542.         } elseif ($export_type == 'database') {
  543.             $active_page = 'db_details_export.php';
  544.             require_once('./db_details_export.php');
  545.         } else {
  546.             $active_page = 'tbl_properties_export.php';
  547.             require_once('./tbl_properties_export.php');
  548.         }
  549.         exit();
  550.     } else {
  551.         echo $dump_buffer;
  552.     }
  553. }
  554. /**
  555.  * Displays the dump...
  556.  */
  557. else {
  558.     /**
  559.      * Close the html tags and add the footers in dump is displayed on screen
  560.      */
  561.     //echo '    </pre>' . "\n";
  562.     echo '        </textarea>' . "\n"
  563.        . '    </form>' . "\n";
  564.     echo '</div>' . "\n";
  565.     echo "\n";
  566. ?><script language="JavaScript" type="text/javascript">
  567. <!--
  568.     var bodyWidth=null; var bodyHeight=null;
  569.     if (document.getElementById('textSQLDUMP')) {
  570.         bodyWidth  = self.innerWidth;
  571.         bodyHeight = self.innerHeight;
  572.         if(!bodyWidth && !bodyHeight){
  573.             if (document.compatMode && document.compatMode == "BackCompat") {
  574.                 bodyWidth  = document.body.clientWidth;
  575.                 bodyHeight = document.body.clientHeight;
  576.             } else if (document.compatMode && document.compatMode == "CSS1Compat") {
  577.                 bodyWidth  = document.documentElement.clientWidth;
  578.                 bodyHeight = document.documentElement.clientHeight;
  579.             }
  580.         }
  581.         document.getElementById('textSQLDUMP').style.width=(bodyWidth-50) + 'px';
  582.         document.getElementById('textSQLDUMP').style.height=(bodyHeight-100) + 'px';
  583.     }
  584. //-->
  585. </script>
  586. <?php
  587.     require_once('./footer.inc.php');
  588. } // end if
  589. ?>
  590.