diff --git a/libraries/Config.class.php b/libraries/Config.class.php index 9c7ab4804d..942ee9e2d4 100644 --- a/libraries/Config.class.php +++ b/libraries/Config.class.php @@ -350,16 +350,11 @@ class PMA_Config $cfg = array(); /** - * Parses the configuration file + * Parses the configuration file, the eval is used here to avoid + * problems with trailing whitespace, what is often a problem. */ $old_error_reporting = error_reporting(0); - if (function_exists('file_get_contents')) { - $eval_result = - eval('?' . '>' . trim(file_get_contents($this->getSource()))); - } else { - $eval_result = - eval('?' . '>' . trim(implode("\n", file($this->getSource())))); - } + $eval_result = eval('?' . '>' . trim(file_get_contents($this->getSource()))); error_reporting($old_error_reporting); if ($eval_result === false) { diff --git a/libraries/export/htmlword.php b/libraries/export/htmlword.php index e662cfb52d..ddc18ac4d5 100644 --- a/libraries/export/htmlword.php +++ b/libraries/export/htmlword.php @@ -213,9 +213,6 @@ function PMA_exportStructure($db, $table, $crlf, $error_url, $do_relation = fals * Gets fields properties */ PMA_DBI_select_db($db); - $local_query = 'SHOW FIELDS FROM ' . PMA_backquote($db) . '.' . PMA_backquote($table); - $result = PMA_DBI_query($local_query); - $fields_cnt = PMA_DBI_num_rows($result); // Check if we can use Relations if ($do_relation && ! empty($cfgRelation['relation'])) { @@ -272,10 +269,11 @@ function PMA_exportStructure($db, $table, $crlf, $error_url, $do_relation = fals return false; } - while ($row = PMA_DBI_fetch_assoc($result)) { + $columns = PMA_DBI_get_columns($db, $table); + foreach ($columns as $column) { $schema_insert = ''; - $type = $row['Type']; + $type = $column['Type']; // reformat mysql query output // set or enum types: slashes single quotes inside options if (preg_match('/^(set|enum)\((.+)\)$/i', $type, $tmp)) { @@ -295,9 +293,9 @@ function PMA_exportStructure($db, $table, $crlf, $error_url, $do_relation = fals $type = ' '; } - $binary = preg_match('/BINARY/i', $row['Type']); - $unsigned = preg_match('/UNSIGNED/i', $row['Type']); - $zerofill = preg_match('/ZEROFILL/i', $row['Type']); + $binary = preg_match('/BINARY/i', $column['Type']); + $unsigned = preg_match('/UNSIGNED/i', $column['Type']); + $zerofill = preg_match('/ZEROFILL/i', $column['Type']); } $attribute = ' '; if ($binary) { @@ -309,28 +307,28 @@ function PMA_exportStructure($db, $table, $crlf, $error_url, $do_relation = fals if ($zerofill) { $attribute = 'UNSIGNED ZEROFILL'; } - if (! isset($row['Default'])) { - if ($row['Null'] != 'NO') { - $row['Default'] = 'NULL'; + if (! isset($column['Default'])) { + if ($column['Null'] != 'NO') { + $column['Default'] = 'NULL'; } } $fmt_pre = ''; $fmt_post = ''; - if (in_array($row['Field'], $unique_keys)) { + if (in_array($column['Field'], $unique_keys)) { $fmt_pre = '' . $fmt_pre; $fmt_post = $fmt_post . ''; } - if ($row['Key'] == 'PRI') { + if ($column['Key'] == 'PRI') { $fmt_pre = '' . $fmt_pre; $fmt_post = $fmt_post . ''; } - $schema_insert .= '' . $fmt_pre . htmlspecialchars($row['Field']) . $fmt_post . ''; + $schema_insert .= '' . $fmt_pre . htmlspecialchars($column['Field']) . $fmt_post . ''; $schema_insert .= '' . htmlspecialchars($type) . ''; - $schema_insert .= '' . htmlspecialchars(($row['Null'] == '' || $row['Null'] == 'NO') ? __('No') : __('Yes')) . ''; - $schema_insert .= '' . htmlspecialchars(isset($row['Default']) ? $row['Default'] : '') . ''; + $schema_insert .= '' . htmlspecialchars(($column['Null'] == '' || $column['Null'] == 'NO') ? __('No') : __('Yes')) . ''; + $schema_insert .= '' . htmlspecialchars(isset($column['Default']) ? $column['Default'] : '') . ''; - $field_name = $row['Field']; + $field_name = $column['Field']; if ($do_relation && $have_rel) { $schema_insert .= '' . (isset($res_rel[$field_name]) ? htmlspecialchars($res_rel[$field_name]['foreign_table'] . ' (' . $res_rel[$field_name]['foreign_field'] . ')') : '') . ''; diff --git a/libraries/zip.lib.php b/libraries/zip.lib.php index 443b173783..23f28ceee2 100644 --- a/libraries/zip.lib.php +++ b/libraries/zip.lib.php @@ -9,18 +9,7 @@ * Zip file creation class. * Makes zip files. * - * Based on : - * - * http://www.zend.com/codex.php?id=535&single=1 - * By Eric Mueller - * - * http://www.zend.com/codex.php?id=470&single=1 - * by Denis125 - * - * a patch from Peter Listiak for last modified - * date and time of the compressed file - * - * Official ZIP file format: http://www.pkware.com/appnote.txt + * @see Official ZIP file format: http://www.pkware.com/support/zip-app-note * * @access public * @package phpMyAdmin @@ -147,14 +136,6 @@ class zipfile // "file data" segment $fr .= $zdata; - // "data descriptor" segment (optional but necessary if archive is not - // served as file) - // this seems not to be needed at all and causes - // problems in some cases (bug #1037737) - //$fr .= pack('V', $crc); // crc32 - //$fr .= pack('V', $c_len); // compressed filesize - //$fr .= pack('V', $unc_len); // uncompressed filesize - // echo this entry on the fly, ... if ( $this -> doWrite) { echo $fr; @@ -205,7 +186,7 @@ class zipfile pack('v', sizeof($this -> ctrl_dir)) . // total # of entries "on this disk" pack('v', sizeof($this -> ctrl_dir)) . // total # of entries overall pack('V', strlen($ctrldir)) . // size of central dir - pack('V', strlen($data)) . // offset to start of central dir + pack('V', $this -> old_offset) . // offset to start of central dir "\x00\x00"; // .zip file comment length if ( $this -> doWrite ) { // Send central directory & end ctrl dir to STDOUT