Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
c34fe3acde
61
export.php
61
export.php
@ -295,62 +295,13 @@ if (!defined('TESTSUITE')) {
|
||||
|
||||
// Generate filename and mime type if needed
|
||||
if ($asfile) {
|
||||
$pma_uri_parts = parse_url($cfg['PmaAbsoluteUri']);
|
||||
if ($export_type == 'server') {
|
||||
if (isset($remember_template)) {
|
||||
$GLOBALS['PMA_Config']->setUserValue(
|
||||
'pma_server_filename_template',
|
||||
'Export/file_template_server',
|
||||
$filename_template
|
||||
);
|
||||
}
|
||||
} elseif ($export_type == 'database') {
|
||||
if (isset($remember_template)) {
|
||||
$GLOBALS['PMA_Config']->setUserValue(
|
||||
'pma_db_filename_template',
|
||||
'Export/file_template_database',
|
||||
$filename_template
|
||||
);
|
||||
}
|
||||
} else {
|
||||
if (isset($remember_template)) {
|
||||
$GLOBALS['PMA_Config']->setUserValue(
|
||||
'pma_table_filename_template',
|
||||
'Export/file_template_table',
|
||||
$filename_template
|
||||
);
|
||||
}
|
||||
}
|
||||
$filename = PMA_Util::expandUserString($filename_template);
|
||||
// remove dots in filename (coming from either the template or already
|
||||
// part of the filename) to avoid a remote code execution vulnerability
|
||||
$filename = PMA_sanitizeFilename($filename, $replaceDots = true);
|
||||
|
||||
// Grab basic dump extension and mime type
|
||||
// Check if the user already added extension;
|
||||
// get the substring where the extension would be if it was included
|
||||
$extension_start_pos = strlen($filename) - strlen(
|
||||
$export_plugin->getProperties()->getExtension()
|
||||
) - 1;
|
||||
$user_extension = substr($filename, $extension_start_pos, strlen($filename));
|
||||
$required_extension = "." . $export_plugin->getProperties()->getExtension();
|
||||
if (strtolower($user_extension) != $required_extension) {
|
||||
$filename .= $required_extension;
|
||||
}
|
||||
$mime_type = $export_plugin->getProperties()->getMimeType();
|
||||
|
||||
// If dump is going to be compressed, set correct mime_type and add
|
||||
// compression to extension
|
||||
if ($compression == 'bzip2') {
|
||||
$filename .= '.bz2';
|
||||
$mime_type = 'application/x-bzip2';
|
||||
} elseif ($compression == 'gzip') {
|
||||
$filename .= '.gz';
|
||||
$mime_type = 'application/x-gzip';
|
||||
} elseif ($compression == 'zip') {
|
||||
$filename .= '.zip';
|
||||
$mime_type = 'application/zip';
|
||||
if (empty($remember_template)) {
|
||||
$remember_template = '';
|
||||
}
|
||||
list($filename, $mime_type) = PMA_getExportFilenameAndMimetype(
|
||||
$export_type, $remember_template, $export_plugin, $compression,
|
||||
$filename_template
|
||||
);
|
||||
}
|
||||
|
||||
// Open file on server if needed
|
||||
|
||||
@ -221,4 +221,77 @@ function PMA_getMemoryLimitForExport()
|
||||
$memory_limit /= 8;
|
||||
return $memory_limit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the filename and MIME type for export file
|
||||
*
|
||||
* @param string $export_type type of export
|
||||
* @param string $remember_template whether to remember template
|
||||
* @param object $export_plugin the export plugin
|
||||
* @param string $compression compression asked
|
||||
* @param string $filename_template the filename template
|
||||
*
|
||||
* @return array the filename template and mime type
|
||||
*/
|
||||
function PMA_getExportFilenameAndMimetype(
|
||||
$export_type, $remember_template, $export_plugin, $compression,
|
||||
$filename_template
|
||||
) {
|
||||
if ($export_type == 'server') {
|
||||
if (! empty($remember_template)) {
|
||||
$GLOBALS['PMA_Config']->setUserValue(
|
||||
'pma_server_filename_template',
|
||||
'Export/file_template_server',
|
||||
$filename_template
|
||||
);
|
||||
}
|
||||
} elseif ($export_type == 'database') {
|
||||
if (! empty($remember_template)) {
|
||||
$GLOBALS['PMA_Config']->setUserValue(
|
||||
'pma_db_filename_template',
|
||||
'Export/file_template_database',
|
||||
$filename_template
|
||||
);
|
||||
}
|
||||
} else {
|
||||
if (! empty($remember_template)) {
|
||||
$GLOBALS['PMA_Config']->setUserValue(
|
||||
'pma_table_filename_template',
|
||||
'Export/file_template_table',
|
||||
$filename_template
|
||||
);
|
||||
}
|
||||
}
|
||||
$filename = PMA_Util::expandUserString($filename_template);
|
||||
// remove dots in filename (coming from either the template or already
|
||||
// part of the filename) to avoid a remote code execution vulnerability
|
||||
$filename = PMA_sanitizeFilename($filename, $replaceDots = true);
|
||||
|
||||
// Grab basic dump extension and mime type
|
||||
// Check if the user already added extension;
|
||||
// get the substring where the extension would be if it was included
|
||||
$extension_start_pos = strlen($filename) - strlen(
|
||||
$export_plugin->getProperties()->getExtension()
|
||||
) - 1;
|
||||
$user_extension = substr($filename, $extension_start_pos, strlen($filename));
|
||||
$required_extension = "." . $export_plugin->getProperties()->getExtension();
|
||||
if (strtolower($user_extension) != $required_extension) {
|
||||
$filename .= $required_extension;
|
||||
}
|
||||
$mime_type = $export_plugin->getProperties()->getMimeType();
|
||||
|
||||
// If dump is going to be compressed, set correct mime_type and add
|
||||
// compression to extension
|
||||
if ($compression == 'bzip2') {
|
||||
$filename .= '.bz2';
|
||||
$mime_type = 'application/x-bzip2';
|
||||
} elseif ($compression == 'gzip') {
|
||||
$filename .= '.gz';
|
||||
$mime_type = 'application/x-gzip';
|
||||
} elseif ($compression == 'zip') {
|
||||
$filename .= '.zip';
|
||||
$mime_type = 'application/zip';
|
||||
}
|
||||
return array($filename, $mime_type);
|
||||
}
|
||||
?>
|
||||
|
||||
@ -32,23 +32,14 @@ function PMA_getHtmlForCharsets($mysql_charsets, $mysql_collations,
|
||||
*/
|
||||
$html = '<div id="div_mysql_charset_collations">' . "\n"
|
||||
. '<table class="data noclick">' . "\n"
|
||||
. '<tr><th>' . __('Collation') . '</th>' . "\n"
|
||||
. '<tr><th id="collationHeader">' . __('Collation') . '</th>' . "\n"
|
||||
. ' <th>' . __('Description') . '</th>' . "\n"
|
||||
. '</tr>' . "\n";
|
||||
|
||||
$i = 0;
|
||||
$table_row_count = count($mysql_charsets) + count($mysql_collations);
|
||||
|
||||
foreach ($mysql_charsets as $current_charset) {
|
||||
if ($i >= $table_row_count / 2) {
|
||||
$i = 0;
|
||||
$html .= '</table>' . "\n"
|
||||
. '<table class="data noclick">' . "\n"
|
||||
. '<tr><th>' . __('Collation') . '</th>' . "\n"
|
||||
. ' <th>' . __('Description') . '</th>' . "\n"
|
||||
. '</tr>' . "\n";
|
||||
}
|
||||
$i++;
|
||||
|
||||
$html .= '<tr><th colspan="2" class="right">' . "\n"
|
||||
. ' ' . htmlspecialchars($current_charset) . "\n"
|
||||
. (empty($mysql_charsets_descriptions[$current_charset])
|
||||
@ -62,10 +53,10 @@ function PMA_getHtmlForCharsets($mysql_charsets, $mysql_collations,
|
||||
$html .= PMA_getHtmlForCollationCurrentCharset(
|
||||
$current_charset,
|
||||
$mysql_collations,
|
||||
$i,
|
||||
$mysql_default_collations,
|
||||
$mysql_collations_available
|
||||
);
|
||||
|
||||
}
|
||||
unset($table_row_count);
|
||||
$html .= '</table>' . "\n"
|
||||
@ -79,20 +70,19 @@ function PMA_getHtmlForCharsets($mysql_charsets, $mysql_collations,
|
||||
*
|
||||
* @param String $current_charset Current Charset
|
||||
* @param Array $mysql_collations Collations list
|
||||
* @param int &$i Display Index
|
||||
* @param Array $mysql_default_collations Default Collations list
|
||||
* @param Array $mysql_collations_available Available Collations list
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function PMA_getHtmlForCollationCurrentCharset(
|
||||
$current_charset, $mysql_collations, &$i,
|
||||
$current_charset, $mysql_collations,
|
||||
$mysql_default_collations, $mysql_collations_available
|
||||
) {
|
||||
$odd_row = true;
|
||||
$html = '';
|
||||
foreach ($mysql_collations[$current_charset] as $current_collation) {
|
||||
$i++;
|
||||
|
||||
$html .= '<tr class="'
|
||||
. ($odd_row ? 'odd' : 'even')
|
||||
. ($mysql_default_collations[$current_charset] == $current_collation
|
||||
|
||||
@ -1274,6 +1274,15 @@ li.no_bullets {
|
||||
float: <?php echo $left; ?>;
|
||||
}
|
||||
|
||||
#div_mysql_charset_collations table th,
|
||||
#div_mysql_charset_collations table td {
|
||||
padding: 0.4em;
|
||||
}
|
||||
|
||||
#div_mysql_charset_collations table th#collationHeader {
|
||||
width: 35%;
|
||||
}
|
||||
|
||||
.operations_half_width {
|
||||
width: 48%;
|
||||
float: <?php echo $left; ?>;
|
||||
|
||||
@ -1636,6 +1636,15 @@ li.no_bullets {
|
||||
float: <?php echo $left; ?>;
|
||||
}
|
||||
|
||||
#div_mysql_charset_collations table th,
|
||||
#div_mysql_charset_collations table td {
|
||||
padding: 0.4em;
|
||||
}
|
||||
|
||||
#div_mysql_charset_collations table th#collationHeader {
|
||||
width: 35%;
|
||||
}
|
||||
|
||||
.operations_half_width {
|
||||
width: 48%;
|
||||
float: <?php echo $left; ?>;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user