Merge remote-tracking branch 'origin/master'

This commit is contained in:
Pootle server 2011-06-21 12:40:08 +02:00
commit cfe283ab60
28 changed files with 131 additions and 97 deletions

View File

@ -53,11 +53,11 @@ require_once './libraries/header_meta_style.inc.php';
?>
</div>
<p>
<a href="enum_editor.php?token=<?php echo urlencode($_GET['token']); ?>&field=<?php echo urlencode($_GET['field']); ?>&extra_fields=<?php echo $_GET['extra_fields'] + 1; ?>&values=<?php echo urlencode(join(",", $values)); ?>">
<a href="enum_editor.php<?php echo PMA_generate_common_url(array('field' => $_GET['field'], 'extra_fields' => $_GET['extra_fields'] + 1, 'values' => join(',', $values))); ?>">
<?php echo __('+ Restart insertion and add a new value'); ?>
</a>
</p>
<input type="hidden" name="token" value="<?php echo htmlspecialchars($_GET['token']); ?>" />
<?php echo PMA_generate_common_hidden_inputs(); ?>
<input type="hidden" name="field" value="<?php echo htmlspecialchars($_GET['field']); ?>" />
<input type="hidden" name="num_fields" value="<?php echo $total_fields; ?>" />
<input type="submit" value="<?php echo __('Go'); ?>" />

View File

@ -108,7 +108,7 @@ if ($import_type == 'table') {
}
$err_url = $goto
. '?' . $common
. (preg_match('@^tbl_[a-z]*\.php$@', $goto) ? '&amp;table=' . urlencode($table) : '');
. (preg_match('@^tbl_[a-z]*\.php$@', $goto) ? '&amp;table=' . htmlspecialchars($table) : '');
$_SESSION['Import_message']['go_back_url'] = $err_url;
}

View File

@ -3,7 +3,8 @@
/**
* Set of functions used to build NHibernate dumps of tables
*
* @package phpMyAdmin-Export-Codegen
* @package phpMyAdmin-Export
* @subpackage Codegen
*/
if (! defined('PHPMYADMIN')) {
exit;
@ -148,7 +149,8 @@ function PMA_exportData($db, $table, $crlf, $error_url, $sql_query)
/**
*
* @package phpMyAdmin-Export-Codegen
* @package phpMyAdmin-Export
* @subpackage Codegen
*/
class TableProperty
{

View File

@ -1,7 +1,10 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* @package phpMyAdmin-Export-CSV
* CSV export code
*
* @package phpMyAdmin-Export
* @subpackage CSV
*/
if (! defined('PHPMYADMIN')) {
exit;

View File

@ -1,9 +1,10 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* Set of functions used to build CSV dumps of tables
* Set of functions used to build CSV dumps of tables for excel
*
* @package phpMyAdmin-Export-CSV
* @package phpMyAdmin-Export
* @subpackage CSV-Excel
*/
if (! defined('PHPMYADMIN')) {
exit;
@ -23,12 +24,12 @@ if (isset($plugin_list)) {
array('type' => 'bool', 'name' => 'removeCRLF', 'text' => __('Remove carriage return/line feed characters within columns')),
array('type' => 'bool', 'name' => 'columns', 'text' => __('Put columns names in the first row')),
array(
'type' => 'select',
'name' => 'edition',
'type' => 'select',
'name' => 'edition',
'values' => array(
'win' => 'Windows',
'mac_excel2003' => 'Excel 2003 / Macintosh',
'mac_excel2008' => 'Excel 2008 / Macintosh'),
'mac_excel2003' => 'Excel 2003 / Macintosh',
'mac_excel2008' => 'Excel 2008 / Macintosh'),
'text' => __('Excel edition:')),
array('type' => 'hidden', 'name' => 'structure_or_data'),
array('type' => 'end_group'),

View File

@ -1,9 +1,10 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* Set of functions used to build CSV dumps of tables
* Set of functions used to build HTML dumps of tables
*
* @package phpMyAdmin-Export-HTMLWord
* @package phpMyAdmin-Export
* @subpackage HTMLWord
*/
if (! defined('PHPMYADMIN')) {
exit;

View File

@ -1,7 +1,11 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* Set of functions used to build dumps of tables as JSON
*
* @package phpMyAdmin-Export
* @subpackage JSON
*/
*/
if (! defined('PHPMYADMIN')) {
exit;

View File

@ -1,9 +1,10 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* Set of functions used to build dumps of tables
* Set of functions used to build LaTeX dumps of tables
*
* @package phpMyAdmin-Export-Latex
* @package phpMyAdmin-Export
* @subpackage Latex
*/
if (! defined('PHPMYADMIN')) {
exit;

View File

@ -3,8 +3,8 @@
/**
* Set of functions used to build MediaWiki dumps of tables
*
* @package phpMyAdmin-Export-MediaWiki
* @version $Id: mediawiki.php 12972 2009-09-14 06:21:04Z drummingds1 $
* @package phpMyAdmin-Export
* @subpackage MediaWiki
*/
if (! defined('PHPMYADMIN')) {
exit;
@ -112,7 +112,7 @@ function PMA_exportDBCreate($db) {
function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) {
global $mediawiki_export_struct;
global $mediawiki_export_data;
$result = PMA_DBI_fetch_result("SHOW COLUMNS FROM `" . $db . "`.`" . $table . "`");
$row_cnt = count($result);
@ -127,7 +127,7 @@ function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) {
}
}
$output .= "\n";
$output .= "|- style=\"background:#f9f9f9;\"\n";
$output .= "! style=\"background:#f2f2f2\" | Type\n";
for ($i = 0; $i < $row_cnt; ++$i) {
@ -137,7 +137,7 @@ function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) {
}
}
$output .= "\n";
$output .= "|- style=\"background:#f9f9f9;\"\n";
$output .= "! style=\"background:#f2f2f2\" | Null\n";
for ($i = 0; $i < $row_cnt; ++$i) {
@ -147,7 +147,7 @@ function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) {
}
}
$output .= "\n";
$output .= "|- style=\"background:#f9f9f9;\"\n";
$output .= "! style=\"background:#f2f2f2\" | Default\n";
for ($i = 0; $i < $row_cnt; ++$i) {
@ -157,7 +157,7 @@ function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) {
}
}
$output .= "\n";
$output .= "|- style=\"background:#f9f9f9;\"\n";
$output .= "! style=\"background:#f2f2f2\" | Extra\n";
for ($i = 0; $i < $row_cnt; ++$i) {
@ -167,7 +167,7 @@ function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) {
}
}
$output .= "\n";
$output .= "|}\n\n\n\n";
return PMA_exportOutputHandler($output);
}

View File

@ -3,7 +3,8 @@
/**
* Set of functions used to build OpenDocument Spreadsheet dumps of tables
*
* @package phpMyAdmin-Export-ODS
* @package phpMyAdmin-Export
* @subpackage ODS
*/
if (! defined('PHPMYADMIN')) {
exit;

View File

@ -3,7 +3,8 @@
/**
* Set of functions used to build OpenDocument Text dumps of tables
*
* @package phpMyAdmin-Export-ODT
* @package phpMyAdmin-Export
* @subpackage ODT
*/
if (! defined('PHPMYADMIN')) {
exit;

View File

@ -3,7 +3,8 @@
/**
* Produce a PDF report (export) from a query
*
* @package phpMyAdmin-Export-PDF
* @package phpMyAdmin-Export
* @subpackage PDF
*/
if (! defined('PHPMYADMIN')) {
exit;
@ -39,7 +40,8 @@ require_once './libraries/tcpdf/tcpdf.php';
/**
* Adapted from a LGPL script by Philip Clarke
* @package phpMyAdmin-Export-PDF
* @package phpMyAdmin-Export
* @subpackage PDF
*/
class PMA_PDF extends TCPDF
{

View File

@ -1,8 +1,10 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* Set of functions used to build dumps of tables as PHP Arrays
*
* @version 0.2b (20090704)
* @package phpMyAdmin-Export
* @subpackage PHP
*/
if (! defined('PHPMYADMIN')) {
exit;

View File

@ -3,7 +3,8 @@
/**
* Set of functions used to build SQL dumps of tables
*
* @package phpMyAdmin-Export-SQL
* @package phpMyAdmin-Export
* @subpackage SQL
*/
if (! defined('PHPMYADMIN')) {
exit;

View File

@ -3,7 +3,8 @@
/**
* Export to Texy! text.
*
* @package phpMyAdmin-Export-Texy
* @package phpMyAdmin-Export
* @subpackage Texy
*/
if (! defined('PHPMYADMIN')) {
exit;

View File

@ -1,9 +1,10 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* Set of functions used to build dumps of tables as Excel files.
*
*
* @package phpMyAdmin-Export-XLS
* @package phpMyAdmin-Export
* @subpackage XLS
*/
if (! defined('PHPMYADMIN')) {
exit;
@ -56,19 +57,19 @@ function PMA_exportComment($text) {
function PMA_exportFooter() {
global $workbook;
global $tmp_filename;
$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))) {
return false;
}
unlink($tmp_filename);
unset($GLOBALS['workbook']);
unset($GLOBALS['sheet_index']);
@ -84,17 +85,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 . ' XLS Dump');
return true;
}
@ -108,8 +109,8 @@ function PMA_exportHeader() {
* @access public
*/
function PMA_exportDBHeader($db) {
return true;
}
@ -155,33 +156,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['xls_columns']) && $GLOBALS['xls_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]])) {
@ -196,10 +197,10 @@ function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) {
}
}
}
$sheet_index++;
}
return true;
}

View File

@ -1,9 +1,10 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* Set of functions used to build dumps of tables as Excel 2007 files.
*
*
* @package phpMyAdmin-Export-XLSX
* @package phpMyAdmin-Export
* @subpackage XLSX
*/
if (! defined('PHPMYADMIN')) {
exit;

View File

@ -3,8 +3,8 @@
/**
* Set of functions used to build XML dumps of tables
*
* @todo
* @package phpMyAdmin-Export-XML
* @package phpMyAdmin-Export
* @subpackage XML
*/
if (! defined('PHPMYADMIN')) {
exit;

View File

@ -3,7 +3,8 @@
/**
* Set of functions used to build YAML dumps of tables
*
* @package phpMyAdmin-Export-YAML
* @package phpMyAdmin-Export
* @subpackage YAML
*/
if (! defined('PHPMYADMIN')) {
exit;

View File

@ -5,6 +5,7 @@
*
* @todo add an option for handling NULL values
* @package phpMyAdmin-Import
* @subpackage CSV
*/
if (! defined('PHPMYADMIN')) {
exit;

View File

@ -4,6 +4,7 @@
* DocSQL import plugin for phpMyAdmin
*
* @package phpMyAdmin-Import
* @subpackage DocSQL
*/
if (! defined('PHPMYADMIN')) {
exit;

View File

@ -1,9 +1,10 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* CSV import plugin for phpMyAdmin
* CSV import plugin for phpMyAdmin using LOAD DATA
*
* @package phpMyAdmin-Import
* @subpackage LDI
*/
if (! defined('PHPMYADMIN')) {
exit;

View File

@ -5,8 +5,8 @@
*
* @todo Pretty much everything
* @todo Importing of accented characters seems to fail
* @version 0.5-beta
* @package phpMyAdmin-Import
* @subpackage ODS
*/
if (! defined('PHPMYADMIN')) {

View File

@ -4,6 +4,7 @@
* SQL import plugin for phpMyAdmin
*
* @package phpMyAdmin-Import
* @subpackage SQL
*/
if (! defined('PHPMYADMIN')) {
exit;
@ -37,8 +38,8 @@ if (isset($plugin_list)) {
),
),
array(
'type' => 'bool',
'name' => 'no_auto_value_on_zero',
'type' => 'bool',
'name' => 'no_auto_value_on_zero',
'text' => __('Do not use <code>AUTO_INCREMENT</code> for zero values'),
'doc' => array(
'manual_MySQL_Database_Administration',
@ -234,7 +235,7 @@ while (!($GLOBALS['finished'] && $i >= $len) && !$error && !$timeout_passed) {
}
// Skip the rest
$start_of_comment = $i;
// do not use PHP_EOL here instead of "\n", because the export
// do not use PHP_EOL here instead of "\n", because the export
// file might have been produced on a different system
$i = strpos($buffer, $ch == '/' ? '*/' : "\n", $i);
// didn't we hit end of string?

View File

@ -5,6 +5,7 @@
*
* @todo Pretty much everything
* @package phpMyAdmin-Import
* @subpackage XLS
*/
if (! defined('PHPMYADMIN')) {
@ -54,26 +55,26 @@ $col_names = array();
for ($s = 0; $s < $num_sheets; ++$s) {
$current_sheet = $objPHPExcel->getSheet($s);
$num_rows = $current_sheet->getHighestRow();
$num_cols = PMA_getColumnNumberFromName($current_sheet->getHighestColumn());
if ($num_rows != 1 && $num_cols != 1) {
for ($r = 1; $r <= $num_rows; ++$r) {
for ($c = 0; $c < $num_cols; ++$c) {
$cell = $current_sheet->getCellByColumnAndRow($c, $r)->getCalculatedValue();
if (! strcmp($cell, '')) {
$cell = 'NULL';
}
$tempRow[] = $cell;
}
$rows[] = $tempRow;
$tempRow = array();
}
if ($_REQUEST['xls_col_names']) {
$col_names = array_splice($rows, 0, 1);
$col_names = $col_names[0];
@ -87,9 +88,9 @@ for ($s = 0; $s < $num_sheets; ++$s) {
$col_names[] = PMA_getColumnAlphaName($n + 1);
}
}
$tables[] = array($sheet_names[$s], $col_names, $rows);
$col_names = array();
$rows = array();
}

View File

@ -5,6 +5,7 @@
*
* @todo Pretty much everything
* @package phpMyAdmin-Import
* @subpackage XLSX
*/
if (! defined('PHPMYADMIN')) {
@ -54,26 +55,26 @@ $col_names = array();
for ($s = 0; $s < $num_sheets; ++$s) {
$current_sheet = $objPHPExcel->getSheet($s);
$num_rows = $current_sheet->getHighestRow();
$num_cols = PMA_getColumnNumberFromName($current_sheet->getHighestColumn());
if ($num_rows != 1 && $num_cols != 1) {
for ($r = 1; $r <= $num_rows; ++$r) {
for ($c = 0; $c < $num_cols; ++$c) {
$cell = $current_sheet->getCellByColumnAndRow($c, $r)->getCalculatedValue();
if (! strcmp($cell, '')) {
$cell = 'NULL';
}
$tempRow[] = $cell;
}
$rows[] = $tempRow;
$tempRow = array();
}
if ($_REQUEST['xlsx_col_names']) {
$col_names = array_splice($rows, 0, 1);
$col_names = $col_names[0];
@ -87,9 +88,9 @@ for ($s = 0; $s < $num_sheets; ++$s) {
$col_names[] = PMA_getColumnAlphaName($n + 1);
}
}
$tables[] = array($sheet_names[$s], $col_names, $rows);
$col_names = array();
$rows = array();
}

View File

@ -4,8 +4,8 @@
* XML import plugin for phpMyAdmin
*
* @todo Improve efficiency
* @version 0.5-beta
* @package phpMyAdmin-Import
* @subpackage XML
*/
if (! defined('PHPMYADMIN')) {
@ -141,19 +141,19 @@ if (isset($namespaces['pma'])) {
* Get structures for all tables
*/
$struct = $xml->children($namespaces['pma']);
$create = array();
foreach ($struct as $tier1 => $val1) {
foreach($val1 as $tier2 => $val2) {
/* Need to select the correct database for the creation of tables, views, triggers, etc. */
/**
* @todo Generating a USE here blocks importing of a table
* into another database.
* @todo Generating a USE here blocks importing of a table
* into another database.
*/
$attrs = $val2->attributes();
$create[] = "USE " . PMA_backquote($attrs["name"]);
foreach ($val2 as $val3) {
/**
* Remove the extra cosmetic spacing
@ -163,7 +163,7 @@ if (isset($namespaces['pma'])) {
}
}
}
$struct_present = true;
}
@ -179,13 +179,13 @@ $data_present = false;
*/
if (@count($xml->children())) {
$data_present = true;
/**
* Process all database content
*/
foreach ($xml as $k1 => $v1) {
$tbl_attr = $v1->attributes();
$isInTables = false;
for ($i = 0; $i < count($tables); ++$i) {
if (! strcmp($tables[$i][TBL_NAME], (string)$tbl_attr['name'])) {
@ -193,11 +193,11 @@ if (@count($xml->children())) {
break;
}
}
if ($isInTables == false) {
$tables[] = array((string)$tbl_attr['name']);
}
foreach ($v1 as $k2 => $v2) {
$row_attr = $v2->attributes();
if (! array_search((string)$row_attr['name'], $tempRow))
@ -206,17 +206,17 @@ if (@count($xml->children())) {
}
$tempCells[] = (string)$v2;
}
$rows[] = array((string)$tbl_attr['name'], $tempRow, $tempCells);
$tempRow = array();
$tempCells = array();
}
unset($tempRow);
unset($tempCells);
unset($xml);
/**
* Bring accumulated rows into the corresponding table
*/
@ -227,17 +227,17 @@ if (@count($xml->children())) {
if (! isset($tables[$i][COL_NAMES])) {
$tables[$i][] = $rows[$j][COL_NAMES];
}
$tables[$i][ROWS][] = $rows[$j][ROWS];
}
}
}
unset($rows);
if (! $struct_present) {
$analyses = array();
$len = count($tables);
for ($i = 0; $i < $len; ++$i) {
$analyses[] = PMA_analyzeTable($tables[$i]);
@ -289,7 +289,7 @@ if (strlen($db)) {
if ($db_name === NULL) {
$db_name = 'XML_DB';
}
/* Set database collation/charset */
$options = array(
'db_collation' => $collation,

View File

@ -1,4 +1,9 @@
<?php
/**
* Theme based generator for SVG gradient.
*
* @package phpMyAdmin-theme
*/
header('Content-Type: image/svg+xml');
header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 3600) . ' GMT');