Merge remote-tracking branch 'origin/master'

This commit is contained in:
Pootle server 2011-07-18 10:40:26 +02:00
commit fa53c8a722
3 changed files with 20 additions and 46 deletions

View File

@ -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) {

View File

@ -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 = '<tr class="print-category">';
$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 = '&nbsp;';
}
$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 = '&nbsp;';
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 = '<b>' . $fmt_pre;
$fmt_post = $fmt_post . '</b>';
}
if ($row['Key'] == 'PRI') {
if ($column['Key'] == 'PRI') {
$fmt_pre = '<i>' . $fmt_pre;
$fmt_post = $fmt_post . '</i>';
}
$schema_insert .= '<td class="print">' . $fmt_pre . htmlspecialchars($row['Field']) . $fmt_post . '</td>';
$schema_insert .= '<td class="print">' . $fmt_pre . htmlspecialchars($column['Field']) . $fmt_post . '</td>';
$schema_insert .= '<td class="print">' . htmlspecialchars($type) . '</td>';
$schema_insert .= '<td class="print">' . htmlspecialchars(($row['Null'] == '' || $row['Null'] == 'NO') ? __('No') : __('Yes')) . '</td>';
$schema_insert .= '<td class="print">' . htmlspecialchars(isset($row['Default']) ? $row['Default'] : '') . '</td>';
$schema_insert .= '<td class="print">' . htmlspecialchars(($column['Null'] == '' || $column['Null'] == 'NO') ? __('No') : __('Yes')) . '</td>';
$schema_insert .= '<td class="print">' . htmlspecialchars(isset($column['Default']) ? $column['Default'] : '') . '</td>';
$field_name = $row['Field'];
$field_name = $column['Field'];
if ($do_relation && $have_rel) {
$schema_insert .= '<td class="print">' . (isset($res_rel[$field_name]) ? htmlspecialchars($res_rel[$field_name]['foreign_table'] . ' (' . $res_rel[$field_name]['foreign_field'] . ')') : '') . '</td>';

View File

@ -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 <eric@themepark.com>
*
* http://www.zend.com/codex.php?id=470&single=1
* by Denis125 <webmaster@atlant.ru>
*
* a patch from Peter Listiak <mlady@users.sourceforge.net> 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