Merge remote branch 'upstream/master' into ayusun-fr1410

This commit is contained in:
Isaac Bennetch 2013-05-16 09:39:09 -04:00
commit 8fbad56812
49 changed files with 716 additions and 591 deletions

View File

@ -14,14 +14,18 @@ phpMyAdmin - ChangeLog
+ rfe #1410 Added support for AES_ENCRYPT for blob fields
4.0.2.0 (not yet released)
- bug #3902 Cannot browse when table name contains keyword "call"
+ center loading indicator for navigation refresh, related to bug #3920
- bug #3925 Table sorting in navigation panel is case-sensitive
- bug #3915 Import of CSV file (Replace table data with file) with duplicate
values
- bug #3915 Import of CSV file (Replace table data with file) with duplicate values
- bug #3907 undefined variables, function parameter problems
- bug #3898 Structure not refreshed after column drop
- bug #3926 View is not updatable
- bug #3919 PropertiesIconic not honored
- bug #3930 Databases to choose for specific privileges show up escaped
- bug #3910 Export database with empty table as a php array, does not produce valid PHP
4.0.1.0 (not yet released)
4.0.1.0 (2013-05-14)
- bug #3879 Import broken for CSV using LOAD DATA
- bug #3889 When login fails and error display is active, login data is displayed
- bug #3890 [import] Web server upload directory import fails

View File

@ -11,7 +11,8 @@
*/
require 'libraries/common.inc.php';
$response = PMA_Response::getInstance()->disable();
$response = PMA_Response::getInstance();
$response->disable();
$filename = CHANGELOG_FILE;

View File

@ -1022,6 +1022,33 @@ Generic settings
This setting can be adjusted by your vendor.
.. config:option:: $cfg['VersionCheckProxyUrl']
:type: string
:default: ""
The url of the proxy to be used when retrieving the information about
the latest version of phpMyAdmin. You need this if the server where
phpMyAdmin is installed does not have direct access to the internet.
The format is: "hostname:portnumber"
.. config:option:: $cfg['VersionCheckProxyUser']
:type: string
:default: ""
The username for authenticating with the proxy. By default, no
authentication is performed. If a username is supplied, Basic
Authentication will be performed. No other types of authentication
are currently supported.
.. config:option:: $cfg['VersionCheckProxyPass']
:type: string
:default: ""
The password for authenticating with the proxy.
.. config:option:: $cfg['MaxDbList']
:type: integer

View File

@ -36,6 +36,7 @@ $post_params = array(
'local_import_file'
);
// TODO: adapt full list of allowed parameters, as in export.php
foreach ($post_params as $one_post_param) {
if (isset($_POST[$one_post_param])) {
$GLOBALS[$one_post_param] = $_POST[$one_post_param];

View File

@ -209,7 +209,7 @@ echo '</ul>';
if ($server > 0) {
echo '<ul>';
echo PMA_printListItem(
PMA_printListItem(
PMA_Util::getImage('b_tblops.png')." " .__('More settings'),
'li_user_preferences',
'prefs_manage.php?' . $common_url_query,

View File

@ -159,7 +159,7 @@ class PMA_Config
{
if (PMA_getenv('HTTP_USER_AGENT')) {
$HTTP_USER_AGENT = PMA_getenv('HTTP_USER_AGENT');
} elseif (! isset($HTTP_USER_AGENT)) {
} else {
$HTTP_USER_AGENT = '';
}

View File

@ -1235,7 +1235,7 @@ class PMA_DbQbe
// Create LEFT JOINS out of Relations
if ($cfgRelation['relwork'] && count($all_tables) > 0) {
// Get tables and columns with valid where clauses
$valid_where_clauses = $this->_getWhereClauseTablesAndColumns($this->_criteria);
$valid_where_clauses = $this->_getWhereClauseTablesAndColumns();
$where_clause_tables = $valid_where_clauses['where_clause_tables'];
$where_clause_columns = $valid_where_clauses['where_clause_columns'];
// Get master table

View File

@ -2543,7 +2543,7 @@ class PMA_DisplayResults
// In print view these variable needs toinitialized
$del_url = $del_query = $del_str = $edit_anchor_class
= $edit_str = $js_conf = $copy_url = $copy_str = null;
= $edit_str = $js_conf = $copy_url = $copy_str = $edit_url = null;
// 1.2 Defines the URLs for the modify/delete link(s)
@ -2579,7 +2579,8 @@ class PMA_DisplayResults
list($del_query, $del_url, $del_str, $js_conf)
= $this->_getDeleteAndKillLinks(
$where_clause, $clause_is_unique,
$url_sql_query, $is_display['del_lnk']
$url_sql_query, $is_display['del_lnk'],
$row
);
} // end if (1.2.2)
@ -2641,8 +2642,9 @@ class PMA_DisplayResults
// output
$this->_gatherLinksForLaterOutputs(
$row_no, $is_display, $where_clause, $where_clause_html, $js_conf,
$del_url, $del_query, $del_str, $edit_anchor_class, $edit_str,
$copy_url, $copy_str, $alternating_color_class, $condition_array
$del_url, $del_query, $del_str, $edit_anchor_class, $edit_url,
$edit_str, $copy_url, $copy_str, $alternating_color_class,
$condition_array
);
$table_body_html .= $directionCondition ? "\n" : '';
@ -2932,6 +2934,7 @@ class PMA_DisplayResults
* @param string $del_query the query for delete row
* @param string $del_str the label for delete row
* @param string $edit_anchor_class the class for html element for edit
* @param string $edit_url the url for edit row
* @param string $edit_str the label for edit row
* @param string $copy_url the url for copy row
* @param string $copy_str the label for copy row
@ -2947,7 +2950,7 @@ class PMA_DisplayResults
*/
private function _gatherLinksForLaterOutputs(
$row_no, $is_display, $where_clause, $where_clause_html, $js_conf,
$del_url, $del_query, $del_str, $edit_anchor_class, $edit_str,
$del_url, $del_query, $del_str, $edit_anchor_class, $edit_url, $edit_str,
$copy_url, $copy_str, $alternating_color_class, $condition_array
) {
@ -3332,6 +3335,7 @@ class PMA_DisplayResults
* @param boolean $clause_is_unique the unique condition of clause
* @param string $url_sql_query the analyzed sql query
* @param string $del_lnk the delete link of current row
* @param array $row the current row
*
* @return array 4 element array - $del_query,
* $del_url, $del_str, $js_conf
@ -3341,7 +3345,7 @@ class PMA_DisplayResults
* @see _getTableBody()
*/
private function _getDeleteAndKillLinks(
$where_clause, $clause_is_unique, $url_sql_query, $del_lnk
$where_clause, $clause_is_unique, $url_sql_query, $del_lnk, $row
) {
$goto = $this->__get('goto');
@ -3398,13 +3402,13 @@ class PMA_DisplayResults
$_url_params = array(
'db' => 'mysql',
'sql_query' => 'KILL ' . $row[0], //FIXME:variable $row is undefined
'sql_query' => 'KILL ' . $row[0],
'goto' => $lnk_goto,
);
$del_url = 'sql.php' . PMA_generate_common_url($_url_params);
$del_query = 'KILL ' . $row[0]; //FIXME:variable $row is undefined
$js_conf = 'KILL ' . $row[0]; //FIXME:variable $row is undefined
$del_query = 'KILL ' . $row[0];
$js_conf = 'KILL ' . $row[0];
$del_str = PMA_Util::getIcon(
'b_drop.png', __('Kill')
);
@ -5210,6 +5214,8 @@ class PMA_DisplayResults
private function _getResultsOperations(
$the_disp_mode, $analyzed_sql, $only_view = false
) {
global $printview;
$results_operations_html = '';
$fields_meta = $this->__get('fields_meta'); // To safe use in foreach
$header_shown = false;
@ -5910,41 +5916,41 @@ class PMA_DisplayResults
$ret .= $this->_getCheckboxForMultiRowSubmissions(
$del_url, $is_display, $row_no, $where_clause_html, $condition_array,
$del_query, $id_suffix = '_left', '', '', ''
$del_query, $id_suffix = '_left', ''
);
$ret .= $this->_getEditLink(
$edit_url, $class, $edit_str, $where_clause, $where_clause_html, ''
$edit_url, $class, $edit_str, $where_clause, $where_clause_html
);
$ret .= $this->_getCopyLink(
$copy_url, $copy_str, $where_clause, $where_clause_html, ''
);
$ret .= $this->_getDeleteLink($del_url, $del_str, $js_conf, '', '');
$ret .= $this->_getDeleteLink($del_url, $del_str, $js_conf, '');
} elseif ($position == self::POSITION_RIGHT) {
$ret .= $this->_getDeleteLink($del_url, $del_str, $js_conf, '', '');
$ret .= $this->_getDeleteLink($del_url, $del_str, $js_conf, '');
$ret .= $this->_getCopyLink(
$copy_url, $copy_str, $where_clause, $where_clause_html, ''
);
$ret .= $this->_getEditLink(
$edit_url, $class, $edit_str, $where_clause, $where_clause_html, ''
$edit_url, $class, $edit_str, $where_clause, $where_clause_html
);
$ret .= $this->_getCheckboxForMultiRowSubmissions(
$del_url, $is_display, $row_no, $where_clause_html, $condition_array,
$del_query, $id_suffix = '_right', '', '', ''
$del_query, $id_suffix = '_right', ''
);
} else { // $position == self::POSITION_NONE
$ret .= $this->_getCheckboxForMultiRowSubmissions(
$del_url, $is_display, $row_no, $where_clause_html, $condition_array,
$del_query, $id_suffix = '_left', '', '', ''
$del_query, $id_suffix = '_left', ''
);
}

View File

@ -465,12 +465,13 @@ EOT;
* @param mixed $criteriaValues Search criteria input
* @param string $names Name of the column on which search is submitted
* @param string $func_type Search function/operator
* @param string $types Type of the field
* @param bool $geom_func Whether geometry functions should be applied
*
* @return string part of where clause.
*/
private function _getGeomWhereClause($criteriaValues, $names,
$func_type, $geom_func = null
$func_type, $types, $geom_func = null
) {
$geom_unary_functions = array(
'IsEmpty' => 1,
@ -480,7 +481,7 @@ EOT;
);
$where = '';
// Get details about the geometry fucntions
// Get details about the geometry functions
$geom_funcs = PMA_Util::getGISFunctions($types, true, false);
// New output type is the output type of the function being applied
$types = $geom_funcs[$geom_func]['type'];
@ -531,7 +532,7 @@ EOT;
// If geometry function is set
if ($geom_func != null && trim($geom_func) != '') {
return $this->_getGeomWhereClause(
$criteriaValues, $names, $func_type, $geom_func
$criteriaValues, $names, $func_type, $types, $geom_func
);
}

View File

@ -575,6 +575,33 @@ $cfg['ServerDefault'] = 1;
*/
$cfg['VersionCheck'] = VERSION_CHECK_DEFAULT;
/**
* The url of the proxy to be used when retrieving the information about
* the latest version of phpMyAdmin. You need this if the server where
* phpMyAdmin is installed does not have direct access to the internet.
* The format is: "hostname:portnumber"
*
* @global string $cfg['VersionCheckProxyUrl']
*/
$cfg['VersionCheckProxyUrl'] = "";
/**
* The username for authenticating with the proxy. By default, no
* authentication is performed. If a username is supplied, Basic
* Authentication will be performed. No other types of authentication
* are currently supported.
*
* @global string $cfg['VersionCheckProxyUser']
*/
$cfg['VersionCheckProxyUser'] = "";
/**
* The password for authenticating with the proxy.
*
* @global string $cfg['VersionCheckProxyPass']
*/
$cfg['VersionCheckProxyPass'] = "";
/**
* maximum number of db's displayed in database list
*

View File

@ -237,8 +237,7 @@ class ConfigFile
);
if (($value === $default_value && (defined('PMA_SETUP')
|| $instance_default_value === $default_value))
|| (empty($value) && empty($default_value) && (defined('PMA_SETUP')
|| empty($current_global)))
|| (empty($value) && empty($default_value) && (defined('PMA_SETUP')))
) {
PMA_arrayRemove($path, $_SESSION[$this->_id]);
return;

View File

@ -521,6 +521,13 @@ $strConfigUserprefsDeveloperTab_name = __('Enable the Developer tab in settings'
$strConfigVersionCheckLink = __('Check for latest version');
$strConfigVersionCheck_desc = __('Enables check for latest version on main phpMyAdmin page');
$strConfigVersionCheck_name = __('Version check');
$strConfigVersionCheckProxyUrl_desc = __('The url of the proxy to be used when retrieving the information about the latest version of phpMyAdmin. You need this if the server where phpMyAdmin is installed does not have direct access to the internet. The format is: "hostname:portnumber"');
$strConfigVersionCheckProxyUrl_name = __('Version check proxy url');
$strConfigVersionCheckProxyUser_desc = __('The username for authenticating with the proxy. By default, no authentication is performed. If a username is supplied, Basic Authentication will be performed. No other types of authentication are currently supported.');
$strConfigVersionCheckProxyUser_name = __('Version check proxy username');
$strConfigVersionCheckProxyPass_desc = __('The password for authenticating with the proxy');
$strConfigVersionCheckProxyPass_name = __('Version check proxy password');
$strConfigZipDump_desc = __('Enable [a@http://en.wikipedia.org/wiki/ZIP_(file_format)]ZIP[/a] compression for import and export operations');
$strConfigZipDump_name = __('ZIP');

View File

@ -125,7 +125,6 @@ $forms['Features']['Developer'] = array(
'Error_Handler/gather',
'DBG/sql');
$forms['Features']['Other_core_settings'] = array(
'VersionCheck',
'NaturalOrder',
'InitialSlidersState',
'MaxDbList',
@ -138,7 +137,12 @@ $forms['Features']['Other_core_settings'] = array(
'MemoryLimit',
'SkipLockedTables',
'DisableMultiTableMaintenance',
'UseDbSearch');
'UseDbSearch',
'VersionCheck',
'VersionCheckProxyUrl',
'VersionCheckProxyUser',
'VersionCheckProxyPass'
);
$forms['Sql_queries']['Sql_queries'] = array(
'ShowSQL',
'Confirm',

View File

@ -0,0 +1,229 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* set of functions that needed for tbl_create.php and tbl_addfield.php in pma
*
* @package PhpMyAdmin
*/
if (! defined('PHPMYADMIN')) {
exit;
}
/**
* Transforms the radio button field_key into 4 arrays
*
* @return array An array of arrays which represents column keys for each index type
*/
function PMA_getIndexedColumns()
{
$field_cnt = count($_REQUEST['field_name']);
$field_primary = array();
$field_index = array();
$field_unique = array();
$field_fulltext = array();
for ($i = 0; $i < $field_cnt; ++$i) {
if (isset($_REQUEST['field_key'][$i])
&& strlen($_REQUEST['field_name'][$i])
) {
if ($_REQUEST['field_key'][$i] == 'primary_' . $i) {
$field_primary[] = $i;
}
if ($_REQUEST['field_key'][$i] == 'index_' . $i) {
$field_index[] = $i;
}
if ($_REQUEST['field_key'][$i] == 'unique_' . $i) {
$field_unique[] = $i;
}
if ($_REQUEST['field_key'][$i] == 'fulltext_' . $i) {
$field_fulltext[] = $i;
}
} // end if
} // end for
return array(
$field_cnt, $field_primary, $field_index, $field_unique, $field_fulltext );
}
/**
* Initiate the column creation statement according to the table creation or
* add columns to a existing table
*
* @param int $field_cnt number of columns
* @param boolean $is_create_tbl true if requirement is to get the statement
* for table creation
*
* @return array $definitions An array of initial sql statements
* according to the request
*/
function PMA_buildColumnCreationStatement($field_cnt ,$is_create_tbl = true)
{
$definitions = array();
for ($i = 0; $i < $field_cnt; ++$i) {
// '0' is also empty for php :-(
if (empty($_REQUEST['field_name'][$i])
&& $_REQUEST['field_name'][$i] != '0'
) {
continue;
}
$definition = PMA_getStatementPrefix($is_create_tbl) .
PMA_Table::generateFieldSpec(
$_REQUEST['field_name'][$i],
$_REQUEST['field_type'][$i],
$i,
$_REQUEST['field_length'][$i],
$_REQUEST['field_attribute'][$i],
isset($_REQUEST['field_collation'][$i])
? $_REQUEST['field_collation'][$i]
: '',
isset($_REQUEST['field_null'][$i])
? $_REQUEST['field_null'][$i]
: 'NOT NULL',
$_REQUEST['field_default_type'][$i],
$_REQUEST['field_default_value'][$i],
isset($_REQUEST['field_extra'][$i])
? $_REQUEST['field_extra'][$i]
: false,
isset($_REQUEST['field_comments'][$i])
? $_REQUEST['field_comments'][$i]
: '',
$field_primary
);
$definition .= PMA_setColumnCreationStatementSuffix($i, $is_create_tbl);
$definitions[] = $definition;
} // end for
return $definitions;
}
/**
* Set column creation suffix according to requested position of the new column
*
* @param int $current_field_num current column number
* @param boolean $is_create_tbl true if requirement is to get the statement
* for table creation
*
* @return string $sql_suffix suffix
*/
function PMA_setColumnCreationStatementSuffix($current_field_num ,$is_create_tbl = true)
{
// no suffix is needed if request is a table creation
$sql_suffix = " ";
if (! $is_create_tbl) {
if ($_REQUEST['field_where'] != 'last') {
// Only the first field can be added somewhere other than at the end
if ($current_field_num == 0) {
if ($_REQUEST['field_where'] == 'first') {
$sql_suffix .= ' FIRST';
} else {
$sql_suffix .= ' AFTER '
. PMA_Util::backquote($_REQUEST['after_field']);
}
} else {
$sql_suffix .= ' AFTER '
. PMA_Util::backquote(
$_REQUEST['field_name'][$current_field_num - 1]
);
}
}
}
return $sql_suffix;
}
/**
* Create relevent index statements
*
* @param array $indexed_fields an array of index columns
* @param string $index_type index type that which represents
* the index type of $indexed_fields
* @param boolean $is_create_tbl true if requirement is to get the statement
* for table creation
*
* @return array an array of sql statements for indexes
*/
function PMA_buildIndexStatements($indexed_fields, $index_type, $is_create_tbl = true)
{
$statement = array();
if (count($indexed_fields)) {
$fields = array();
foreach ($indexed_fields as $field_nr) {
$fields[] = PMA_Util::backquote($_REQUEST['field_name'][$field_nr]);
}
$statement[] = PMA_getStatementPrefix($is_create_tbl)
.' '.$index_type.' (' . implode(', ', $fields) . ') ';
unset($fields);
}
return $statement;
}
/**
* Statement prefix for the PMA_buildColumnCreationStatement()
*
* @param boolean $is_create_tbl true if requirement is to get the statement
* for table creation
*
* @return string $sql_prefix prefix
*/
function PMA_getStatementPrefix($is_create_tbl = true)
{
$sql_prefix = " ";
if (! $is_create_tbl) {
$sql_prefix = ' ADD ';
}
return $sql_prefix;
}
/**
* Returns sql statement according to the column and index specifications as requested
*
* @param boolean $is_create_tbl true if requirement is to get the statement
* for table creation
*
* @return string sql statement
*/
function PMA_getColumnCreationStatements($is_create_tbl = true)
{
$definitions = array();
$sql_statement = "";
list($field_cnt, $field_primary, $field_index,
$field_unique, $field_fulltext
) = PMA_getIndexedColumns();
$definitions = PMA_buildColumnCreationStatement($field_cnt, $is_create_tbl);
// Builds the primary keys statements
$primary_key_statements = PMA_buildIndexStatements(
$field_primary, " PRIMARY KEY ", $is_create_tbl
);
$definitions = array_merge($definitions, $primary_key_statements);
// Builds the indexes statements
$index_statements = PMA_buildIndexStatements(
$field_index, " INDEX ", $is_create_tbl
);
$definitions = array_merge($definitions, $index_statements);
// Builds the uniques statements
$unique_statements = PMA_buildIndexStatements(
$field_unique, " UNIQUE ", $is_create_tbl
);
$definitions = array_merge($definitions, $unique_statements);
// Builds the fulltext statements
$fulltext_statements = PMA_buildIndexStatements(
$field_fulltext, " FULLTEXT ", $is_create_tbl
);
$definitions = array_merge($definitions, $fulltext_statements);
if (count($definitions)) {
$sql_statement = implode(', ', $definitions);
}
$sql_statement = preg_replace('@, $@', '', $sql_statement);
return $sql_statement;
}
?>

View File

@ -414,10 +414,10 @@ function PMA_DBI_fetchRow($result)
*/
function PMA_DBI_dataSeek($result, $offset)
{
if ($offset > count($GLOBALS['dummy_queries'][$i]['result'])) {
if ($offset > count($GLOBALS['dummy_queries'][$result]['result'])) {
return false;
}
$GLOBALS['dummy_queries'][$i]['pos'] = $offset;
$GLOBALS['dummy_queries'][$result]['pos'] = $offset;
return true;
}

View File

@ -388,12 +388,10 @@ function PMA_DBI_nextResult($link = null)
*/
function PMA_DBI_storeResult()
{
if (empty($link)) {
if (isset($GLOBALS['userlink'])) {
$link = $GLOBALS['userlink'];
} else {
return false;
}
if (isset($GLOBALS['userlink'])) {
$link = $GLOBALS['userlink'];
} else {
return false;
}
return mysqli_store_result($link);
}

View File

@ -1453,6 +1453,8 @@ function PMA_getTableAltersArray($is_myisam_or_aria, $is_isam, $pack_keys,
$checksum, $is_aria, $page_checksum, $delay_key_write, $is_innodb,
$is_pbxt, $row_format, $new_tbl_storage_engine, $transactional, $tbl_collation
) {
global $auto_increment;
$table_alters = array();
if (isset($_REQUEST['comment'])
@ -1538,7 +1540,7 @@ function PMA_getTableAltersArray($is_myisam_or_aria, $is_isam, $pack_keys,
* @param string $tbl_storage_engine table storage engine
*
* @return array ($is_myisam_or_aria, $is_innodb, $is_isam,
$is_berkeleydb, $is_aria, $is_pbxt)
* $is_berkeleydb, $is_aria, $is_pbxt)
*/
function PMA_setGlobalVariablesForEngine($tbl_storage_engine)
{

View File

@ -174,13 +174,14 @@ function _get_codeset($domain=null) {
* Convert the given string to the encoding set by bind_textdomain_codeset.
*/
function _encode($text) {
$target_encoding = _get_codeset();
if (function_exists("mb_detect_encoding")) {
$source_encoding = mb_detect_encoding($text);
if ($source_encoding != $target_encoding)
$text = mb_convert_encoding($text, $target_encoding, $source_encoding);
}
return $text;
$target_encoding = _get_codeset();
if ($source_encoding != $target_encoding) {
return mb_convert_encoding($text, $target_encoding, $source_encoding);
}
else {
return $text;
}
}

View File

@ -129,7 +129,7 @@ class ExportHtmlword extends ExportPlugin
<html>
<head>
<meta http-equiv="Content-type" content="text/html;charset='
. (isset($charsetOfFile) ? $charsetOfFile : 'utf-8') . '" />
. (isset($charset_of_file) ? $charset_of_file : 'utf-8') . '" />
</head>
<body>'
);
@ -287,10 +287,10 @@ class ExportHtmlword extends ExportPlugin
. '</tr>';
/**
* Get the unique keys in the table
* Get the unique keys in the view
*/
$unique_keys = array();
$keys = PMA_DBI_getTableIndexes($db, $table);
$keys = PMA_DBI_getTableIndexes($db, $view);
foreach ($keys as $key) {
if ($key['Non_unique'] == 0) {
$unique_keys[] = $key['Column_name'];
@ -642,4 +642,4 @@ class ExportHtmlword extends ExportPlugin
return $definition;
}
}
?>
?>

View File

@ -347,7 +347,7 @@ class ExportOdt extends ExportPlugin
*/
$GLOBALS['odt_buffer'] .=
'<table:table table:name="'
. htmlspecialchars($table) . '_data">';
. htmlspecialchars($view) . '_data">';
$columns_cnt = 4;
$GLOBALS['odt_buffer'] .=
'<table:table-column'

View File

@ -191,16 +191,17 @@ class ExportPhparray extends ExportPlugin
$buffer = '';
$record_cnt = 0;
// Output table name as comment
$buffer .= $crlf . '// '
. PMA_Util::backquote($db) . '.'
. PMA_Util::backquote($table) . $crlf;
$buffer .= '$' . $tablefixed . ' = array(';
while ($record = PMA_DBI_fetchRow($result)) {
$record_cnt++;
// Output table name as comment if it's the first record of the table
if ($record_cnt == 1) {
$buffer .= $crlf . '// '
. PMA_Util::backquote($db) . '.'
. PMA_Util::backquote($table) . $crlf;
$buffer .= '$' . $tablefixed . ' = array(' . $crlf;
$buffer .= ' array(';
$buffer .= $crlf . ' array(';
} else {
$buffer .= ',' . $crlf . ' array(';
}
@ -223,4 +224,4 @@ class ExportPhparray extends ExportPlugin
return true;
}
}
?>
?>

View File

@ -105,9 +105,11 @@ class ImportCsv extends AbstractImportCsv
*/
public function doImport()
{
global $db, $table, $csv_terminated, $csv_enclosed, $csv_escaped;
global $error, $timeout_passed, $finished, $csv_new_line;
// $csv_replace should have been here but we use directly from $_POST
global $db, $table, $csv_terminated, $csv_enclosed, $csv_escaped,
$csv_new_line, $csv_columns, $err_url;
// $csv_replace and $csv_ignore should have been here,
// but we use directly from $_POST
global $error, $timeout_passed, $finished;
$replacements = array(
'\\n' => "\n",
@ -172,7 +174,7 @@ class ImportCsv extends AbstractImportCsv
$sql_template = 'REPLACE';
} else {
$sql_template = 'INSERT';
if (isset($csv_ignore)) {
if (isset($_POST['csv_ignore'])) {
$sql_template .= ' IGNORE';
}
}

View File

@ -97,9 +97,9 @@ class ImportLdi extends AbstractImportCsv
*/
public function doImport()
{
global $finished, $error, $import_file, $compression, $charset_conversion;
global $ldi_local_option, $ldi_replace, $ldi_terminated, $ldi_enclosed,
$ldi_escaped, $ldi_new_line, $skip_queries, $ldi_columns, $table;
global $finished, $error, $import_file, $compression, $charset_conversion, $table;
global $ldi_local_option, $ldi_replace, $ldi_ignore, $ldi_terminated, $ldi_enclosed,
$ldi_escaped, $ldi_new_line, $skip_queries, $ldi_columns;
if ($import_file == 'none'
|| $compression != 'none'

View File

@ -78,7 +78,8 @@ class ImportShp extends ImportPlugin
*/
public function doImport()
{
global $db, $error, $finished;
global $db, $error, $finished, $compression,
$import_file, $local_import_file;
if ((int) ini_get('memory_limit') < 512) {
@ini_set('memory_limit', '512M');
@ -106,8 +107,8 @@ class ImportShp extends ImportPlugin
// If we can extract the zip archive to 'TempDir'
// and use the files in it for import
if ($compression == 'application/zip'
&& ! empty($cfg['TempDir'])
&& is_writable($cfg['TempDir'])
&& ! empty($GLOBALS['cfg']['TempDir'])
&& is_writable($GLOBALS['cfg']['TempDir'])
) {
$dbf_file_name = PMA_findFileFromZipArchive(
'/^.*\.dbf$/i', $import_file
@ -117,11 +118,11 @@ class ImportShp extends ImportPlugin
// Extract the .dbf file and point to it.
$extracted = PMA_zipExtract(
$import_file,
realpath($cfg['TempDir']),
realpath($GLOBALS['cfg']['TempDir']),
array($dbf_file_name)
);
if ($extracted) {
$dbf_file_path = realpath($cfg['TempDir'])
$dbf_file_path = realpath($GLOBALS['cfg']['TempDir'])
. (PMA_IS_WINDOWS ? '\\' : '/') . $dbf_file_name;
$temp_dbf_file = true;
// Replace the .dbf with .*, as required
@ -133,7 +134,7 @@ class ImportShp extends ImportPlugin
}
}
} elseif (! empty($local_import_file)
&& ! empty($cfg['UploadDir'])
&& ! empty($GLOBALS['cfg']['UploadDir'])
&& $compression == 'none'
) {
// If file is in UploadDir, use .dbf file in the same UploadDir
@ -158,7 +159,10 @@ class ImportShp extends ImportPlugin
}
// Delete the .dbf file extracted to 'TempDir'
if ($temp_dbf_file) {
if ($temp_dbf_file
&& isset($dbf_file_path)
&& file_exists($dbf_file_path)
) {
unlink($dbf_file_path);
}

View File

@ -304,126 +304,4 @@ function PMA_replication_master_replicated_dbs($link = null)
return $link;
}
/**
* This function provides synchronization of structure and data
* between two mysql servers.
*
* @param string $db name of database, which should be synchronized
* @param mixed $src_link link of source server,
* note: if the server is current PMA server, use null
* @param mixed $trg_link link of target server,
* note: if the server is current PMA server, use null
* @param bool $data if true, then data will be copied as well
*
* @return void
*
* @todo improve code sharing between the function and synchronization
*/
function PMA_replication_synchronize_db($db, $src_link, $trg_link, $data = true)
{
$src_db = $trg_db = $db;
$src_tables = PMA_DBI_getTables($src_db, $src_link);
$trg_tables = PMA_DBI_getTables($trg_db, $trg_link);
/**
* initializing arrays to save table names
*/
$source_tables_uncommon = array();
$target_tables_uncommon = array();
$matching_tables = array();
$matching_tables_num = 0;
/**
* Criterion for matching tables is just their names.
* Finding the uncommon tables for the source database
* BY comparing the matching tables with all the tables in the source database
*/
PMA_getMatchingTables($trg_tables, $src_tables, $matching_tables, $source_tables_uncommon);
/**
* Finding the uncommon tables for the target database
* BY comparing the matching tables with all the tables in the target database
*/
PMA_getNonMatchingTargetTables($trg_tables, $matching_tables, $target_tables_uncommon);
/**
*
* Comparing Data In the Matching Tables
* It is assumed that the matching tables are structurally
* and typely exactly the same
*/
$fields_num = array();
$matching_tables_fields = array();
$matching_tables_keys = array();
$insert_array = array(array(array()));
$update_array = array(array(array()));
$delete_array = array();
$row_count = array();
$uncommon_tables_fields = array();
$matching_tables_num = sizeof($matching_tables);
for ($i = 0; $i < sizeof($matching_tables); $i++) {
PMA_dataDiffInTables(
$src_db, $trg_db, $src_link, $trg_link, $matching_tables,
$matching_tables_fields, $update_array, $insert_array,
$delete_array, $fields_num, $i, $matching_tables_keys
);
}
for ($j = 0; $j < sizeof($source_tables_uncommon); $j++) {
PMA_dataDiffInUncommonTables($source_tables_uncommon, $src_db, $src_link, $j, $row_count);
}
/**
* INTEGRATION OF STRUCTURE DIFFERENCE CODE
*
*/
$source_columns = array();
$target_columns = array();
$alter_str_array = array(array());
$add_column_array = array(array());
$uncommon_columns = array();
$target_tables_keys = array();
$source_indexes = array();
$target_indexes = array();
$add_indexes_array = array();
$alter_indexes_array = array();
$remove_indexes_array = array();
$criteria = array('Field', 'Type', 'Null', 'Collation', 'Key', 'Default', 'Comment');
for ($counter = 0; $counter < $matching_tables_num; $counter++) {
PMA_structureDiffInTables(
$src_db, $trg_db, $src_link, $trg_link, $matching_tables,
$source_columns, $target_columns, $alter_str_array, $add_column_array,
$uncommon_columns, $criteria, $target_tables_keys, $counter
);
PMA_indexesDiffInTables(
$src_db, $trg_db, $src_link, $trg_link, $matching_tables,
$source_indexes, $target_indexes, $add_indexes_array,
$alter_indexes_array, $remove_indexes_array, $counter
);
}
/**
* Generating Create Table query for all the non-matching tables present
* in Source but not in Target and populating tables.
*/
for ($q = 0; $q < sizeof($source_tables_uncommon); $q++) {
if (isset($source_tables_uncommon[$q])) {
PMA_createTargetTables(
$src_db, $trg_db, $src_link, $trg_link, $source_tables_uncommon,
$q, $uncommon_tables_fields, false
);
}
if (isset($row_count[$q]) && $data) {
PMA_populateTargetTables(
$src_db, $trg_db, $src_link, $trg_link, $source_tables_uncommon,
$q, $uncommon_tables_fields, false
);
}
}
}
?>

View File

@ -365,7 +365,7 @@ function PMA_replication_gui_master_addslaveuser()
. __('Password') . '"'
. ' onchange="if (this.value == \'none\') { pma_pw.value = \'\'; pma_pw2.value = \'\'; } else if (this.value == \'userdefined\') { pma_pw.focus(); pma_pw.select(); }">'
. ' <option value="none"';
if (isset($GLOBALS['username']) && $mode != 'change') {
if (isset($GLOBALS['username'])) {
echo ' selected="selected"';
}
echo '>' . __('No Password') . '</option>'

View File

@ -42,11 +42,11 @@ function PMA_RTE_handleExport($item_name, $export_data)
$_db = htmlspecialchars(PMA_Util::backquote($db));
$message = __('Error in processing request:') . ' '
. sprintf(PMA_RTE_getWord('not_found'), $item_name, $_db);
$response = PMA_message::error($response);
$response = PMA_message::error($message);
if ($GLOBALS['is_ajax_request'] == true) {
$response = PMA_Response::getInstance();
$response->isSuccess(false);
$response->addJSON('message', $response);
$response->addJSON('message', $message);
exit;
} else {
$response->display();

View File

@ -106,7 +106,7 @@ class PMA_VISIO extends XMLWriter
* Sets Visio XML .VDX Document Properties
*
* DocumentProperties tag contains document property elements such as
the document's Title,Subject,Creator and templates tags
* the document's Title,Subject,Creator and templates tags
*
* @return void
* @access private
@ -257,11 +257,11 @@ class Table_Stats
$this->_showInfo = $showInfo;
// height and width
$this->_setHeightTable($fontSize);
$this->_setHeightTable($this->fontSize);
// setWidth must me after setHeight, because title
// can include table height which changes table width
$this->_setWidthTable($font, $fontSize);
$this->_setWidthTable($this->font, $this->fontSize);
if ($same_wide_width < $this->width) {
$same_wide_width = $this->width;
}

View File

@ -2280,9 +2280,9 @@ function PMA_getTableForDisplayAllTableSpecificRights($username, $hostname
*
* @return string HTML snippet
*/
function PMA_getHTmlForDisplaySelectDbInEditPrivs($found_rows)
function PMA_getHtmlForDisplaySelectDbInEditPrivs($found_rows)
{
$pred_db_array =PMA_DBI_fetchResult('SHOW DATABASES;');
$pred_db_array = PMA_DBI_fetchResult('SHOW DATABASES;');
$html_output = '<label for="text_dbname">'
. __('Add privileges on the following database:') . '</label>' . "\n";
@ -2291,14 +2291,15 @@ function PMA_getHTmlForDisplaySelectDbInEditPrivs($found_rows)
. '<option value="" selected="selected">'
. __('Use text field:') . '</option>' . "\n";
foreach ($pred_db_array as $current_db) {
$current_db_show = $current_db;
$current_db = PMA_Util::escapeMysqlWildcards($current_db);
// cannot use array_diff() once, outside of the loop,
// because the list of databases has special characters
// already escaped in $found_rows,
// contrary to the output of SHOW DATABASES
if (empty($found_rows) || ! in_array($current_db, $found_rows)) {
if (empty($found_rows) || ! in_array($current_db_show, $found_rows)) {
$html_output .= '<option value="' . htmlspecialchars($current_db) . '">'
. htmlspecialchars($current_db) . '</option>' . "\n";
. htmlspecialchars($current_db_show) . '</option>' . "\n";
}
}
$html_output .= '</select>' . "\n";
@ -3073,7 +3074,7 @@ function PMA_getHtmlForDisplayUserProperties($dbname_is_wildcard,$url_dbname,
if (! strlen($dbname)) {
// no database name was given, display select db
$html_output .= PMA_getHTmlForDisplaySelectDbInEditPrivs($found_rows);
$html_output .= PMA_getHtmlForDisplaySelectDbInEditPrivs($found_rows);
} else {
$html_output .= PMA_displayTablesInEditPrivs($dbname, $found_rows);

View File

@ -420,7 +420,7 @@ function PMA_getHtmlForRelationalColumnDropdown($db, $table, $column, $curr_valu
$foreignData['foreign_field'],
$foreignData['foreign_display'],
$curr_value,
$cfg['ForeignKeyMaxLimit']
$GLOBALS['cfg']['ForeignKeyMaxLimit']
);
$dropdown = '<select>' . $dropdown . '</select>';
}
@ -440,12 +440,12 @@ function PMA_getHtmlForRelationalColumnDropdown($db, $table, $column, $curr_valu
function PMA_getHtmlForPrintViewHeader($db, $sql_query, $num_rows)
{
$hostname = '';
if ($cfg['Server']['verbose']) {
$hostname = $cfg['Server']['verbose'];
if ( $GLOBALS['cfg']['Server']['verbose']) {
$hostname = $GLOBALS['cfg']['Server']['verbose'];
} else {
$hostname = $cfg['Server']['host'];
if (! empty($cfg['Server']['port'])) {
$hostname .= $cfg['Server']['port'];
$hostname = $GLOBALS['cfg']['Server']['host'];
if (! empty( $GLOBALS['cfg']['Server']['port'])) {
$hostname .= $GLOBALS['cfg']['Server']['port'];
}
}

View File

@ -446,7 +446,9 @@ function PMA_sqlQueryFormBookmark()
*/
function PMA_sqlQueryFormUpload()
{
$errors = array ();
global $timeout_passed, $local_import_file;
$errors = array();
// we allow only SQL here
$matcher = '@\.sql(\.(' . PMA_supportedDecompressions() . '))?$@';

View File

@ -386,7 +386,8 @@ if (!$GLOBALS['sqlvalidator_error']) {
$this->service_link, $this->username, $this->password,
$this->calling_program, $this->calling_program_version,
$this->target_dbms, $this->target_dbms_version,
$this->connection_technology, $this->connection_technology_version
$this->connection_technology, $this->connection_technology_version,
true // FIXME: Are we to tell them that we are interactive?
);
if (isset($this->session_data)

View File

@ -379,11 +379,12 @@ function PMA_transformation_global_html_replace($buffer, $options = array())
*/
function PMA_clearTransformations($db, $table = '', $column = '')
{
$cfgRelation = PMA_getRelationsParam();
if (! isset($cfgRelation['column_info'])) {
return false;
}
$cfgRelation = PMA_getRelationsParam();
$delete_sql = 'DELETE FROM '
. PMA_Util::backquote($cfgRelation['db']) . '.'
. PMA_Util::backquote($cfgRelation['column_info'])

View File

@ -4,17 +4,17 @@ msgstr ""
"Project-Id-Version: phpMyAdmin 4.1-dev\n"
"Report-Msgid-Bugs-To: phpmyadmin-devel@lists.sourceforge.net\n"
"POT-Creation-Date: 2013-05-10 10:24+0200\n"
"PO-Revision-Date: 2013-02-11 19:03+0200\n"
"Last-Translator: Edgaras Janušauskas <edgaras.janusauskas@gmail.com>\n"
"Language-Team: Lithuanian <http://l10n.cihar.com/projects/phpmyadmin/master/"
"lt/>\n"
"PO-Revision-Date: 2013-05-16 14:41+0200\n"
"Last-Translator: Rytis Slatkevičius <rytis.s@gmail.com>\n"
"Language-Team: Lithuanian "
"<http://l10n.cihar.com/projects/phpmyadmin/master/lt/>\n"
"Language: lt\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && (n"
"%100<10 || n%100>=20) ? 1 : 2;\n"
"X-Generator: Weblate 1.5-dev\n"
"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && (n%"
"100<10 || n%100>=20) ? 1 : 2;\n"
"X-Generator: Weblate 1.6-dev\n"
#: browse_foreigners.php:36 browse_foreigners.php:60 js/messages.php:335
#: libraries/DisplayResults.class.php:809
@ -1314,10 +1314,10 @@ msgid "Differential"
msgstr "Skirtumas"
#: js/messages.php:145
#, fuzzy, php-format
#, php-format
#| msgid "Divided by %s:"
msgid "Divided by %s"
msgstr "Padalintas į %s:"
msgstr "Padalintas į %s"
#: js/messages.php:146
msgid "Unit"
@ -1332,10 +1332,9 @@ msgid "From general log"
msgstr ""
#: js/messages.php:150
#, fuzzy
#| msgid "Loading logs"
msgid "Analysing logs"
msgstr "Įkeliami žurnalai"
msgstr "Analizuojami žurnalai"
#: js/messages.php:151
msgid "Analysing & loading logs. This may take a while."
@ -1438,10 +1437,9 @@ msgid "Group queries, ignoring variable data in WHERE clauses"
msgstr "Sugrupuoti užklausas, nepaisant kintamųjų duomenų WHERE dalyje"
#: js/messages.php:178
#, fuzzy
#| msgid "Number of inserted rows"
msgid "Sum of grouped rows:"
msgstr "Įkeltų eilučių skaičius"
msgstr "Sugrupuotų eilučių suma:"
#: js/messages.php:179
msgid "Total:"

View File

@ -4,10 +4,10 @@ msgstr ""
"Project-Id-Version: phpMyAdmin 4.1-dev\n"
"Report-Msgid-Bugs-To: phpmyadmin-devel@lists.sourceforge.net\n"
"POT-Creation-Date: 2013-05-10 10:24+0200\n"
"PO-Revision-Date: 2013-04-25 16:12+0200\n"
"Last-Translator: greensea g <gs@bbxy.net>\n"
"Language-Team: Simplified Chinese <http://l10n.cihar.com/projects/phpmyadmin/"
"master/zh_CN/>\n"
"PO-Revision-Date: 2013-05-14 06:43+0200\n"
"Last-Translator: Randall Fan <fanrandall@gmail.com>\n"
"Language-Team: Simplified Chinese "
"<http://l10n.cihar.com/projects/phpmyadmin/master/zh_CN/>\n"
"Language: zh_CN\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
@ -19,7 +19,7 @@ msgstr ""
#: libraries/DisplayResults.class.php:809
#: libraries/server_privileges.lib.php:2622
msgid "Show all"
msgstr "显示所有"
msgstr "显示全部"
#: browse_foreigners.php:77 libraries/PDF.class.php:67
#: libraries/Util.class.php:2541
@ -338,7 +338,6 @@ msgstr "创建时间:"
#: db_printview.php:194 libraries/plugins/export/ExportSql.class.php:959
#: libraries/schema/Pdf_Relation_Schema.class.php:1342
#, fuzzy
#| msgid "Last update"
msgid "Last update:"
msgstr "最后更新:"
@ -514,10 +513,9 @@ msgstr "以 OpenStreetMaps 为背景"
# what's the f**k word of "SRID"?
#: gis_data_editor.php:161
#, fuzzy
#| msgid "SRID"
msgid "SRID:"
msgstr "SRID"
msgstr "SRID:"
#: gis_data_editor.php:184
#, fuzzy, php-format
@ -731,36 +729,32 @@ msgid "User:"
msgstr "用户:"
#: index.php:258
#, fuzzy
#| msgid "Server charset"
msgid "Server charset:"
msgstr "服务器字符集"
msgstr "服务器字符集:"
#: index.php:270
msgid "Web server"
msgstr "网站服务器"
#: index.php:283
#, fuzzy
#| msgid "Database client version"
msgid "Database client version:"
msgstr "数据库客户端版本"
msgstr "数据库客户端版本:"
#: index.php:287
#, fuzzy
#| msgid "PHP extension"
msgid "PHP extension:"
msgstr "PHP 扩展"
msgstr "PHP 扩展:"
#: index.php:301
msgid "Show PHP information"
msgstr "显示 PHP 信息"
#: index.php:324
#, fuzzy
#| msgid "Version information"
msgid "Version information:"
msgstr "版本信息"
msgstr "版本信息"
#: index.php:333 libraries/Util.class.php:430 libraries/Util.class.php:516
#: libraries/config/FormDisplay.tpl.php:145
@ -844,7 +838,6 @@ msgid "The configuration file now needs a secret passphrase (blowfish_secret)."
msgstr "配置文件现在需要一个短语密码。"
#: index.php:476
#, fuzzy
#| msgid ""
#| "Directory [code]config[/code], which is used by the setup script, still "
#| "exists in your phpMyAdmin directory. You should remove it once phpMyAdmin "
@ -855,8 +848,8 @@ msgid ""
"once phpMyAdmin has been configured. Otherwise the security of your server "
"may be compromised by unauthorized people downloading your configuration."
msgstr ""
"安装时所用的 [code]config[/code] 文件夹尚未删除,如果 phpMyAdmin 已经安装配置"
"好,请立即删除该文件夹。"
"安装时所用的 [code]config[/code] 文件夹尚未删除,如果 phpMyAdmin "
"已经安装配置好,请立即删除该文件夹。否则,未经授权的人员可通过下载配置文件入侵服务器。"
#: index.php:486
#, php-format
@ -2267,22 +2260,19 @@ msgid "Column:"
msgstr "字段"
#: libraries/DBQbe.class.php:406
#, fuzzy
#| msgid "Sort"
msgid "Sort:"
msgstr "排序"
msgstr "排序"
#: libraries/DBQbe.class.php:468 libraries/DisplayResults.class.php:903
#, fuzzy
#| msgid "Show"
msgid "Show:"
msgstr "显示"
msgstr "显示"
#: libraries/DBQbe.class.php:513
#, fuzzy
#| msgid "Criteria"
msgid "Criteria:"
msgstr "条件"
msgstr "条件"
#: libraries/DBQbe.class.php:576
msgid "Add/Delete criteria rows"
@ -2301,14 +2291,13 @@ msgid "Use Tables"
msgstr "使用表"
#: libraries/DBQbe.class.php:653 libraries/DBQbe.class.php:757
#, fuzzy
#| msgid "Or"
msgid "Or:"
msgstr "或"
msgstr "或"
#: libraries/DBQbe.class.php:657 libraries/DBQbe.class.php:742
msgid "And:"
msgstr ""
msgstr "和:"
#: libraries/DBQbe.class.php:661
msgid "Ins"
@ -2319,10 +2308,9 @@ msgid "Del"
msgstr "删除"
#: libraries/DBQbe.class.php:680
#, fuzzy
#| msgid "Modify"
msgid "Modify:"
msgstr "修改"
msgstr "修改"
#: libraries/DBQbe.class.php:737
msgid "Ins:"
@ -2464,10 +2452,9 @@ msgid "Number of rows:"
msgstr "记录数:"
#: libraries/DisplayResults.class.php:917
#, fuzzy
#| msgid "Mode"
msgid "Mode:"
msgstr "模式"
msgstr "模式"
#: libraries/DisplayResults.class.php:919
msgid "horizontal"
@ -3099,16 +3086,14 @@ msgid "Target database `%s` was not found!"
msgstr "未找到目标数据库 %s "
#: libraries/Table.class.php:1164
#, fuzzy
#| msgid "Invalid database"
msgid "Invalid database:"
msgstr "无效的数据库"
msgstr "无效的数据库"
#: libraries/Table.class.php:1178
#, fuzzy
#| msgid "Invalid table name"
msgid "Invalid table name:"
msgstr "无效的数据表名"
msgstr "无效的数据表名"
#: libraries/Table.class.php:1210
#, php-format
@ -3255,10 +3240,9 @@ msgid "Theme path not found for theme %s!"
msgstr "找不到主题 %s 的路径!"
#: libraries/Theme_Manager.class.php:363
#, fuzzy
#| msgid "Theme"
msgid "Theme:"
msgstr "主题"
msgstr "主题"
#: libraries/Types.class.php:296
msgid ""
@ -3465,7 +3449,7 @@ msgstr "从一组最多64个成员的集合中选择的单个值"
#: libraries/Types.class.php:358
msgid "A type that can store a geometry of any type"
msgstr "一个能存储任何类型几何形状的类型"
msgstr "一个能存储任何几何形状的类型"
#: libraries/Types.class.php:360
msgid "A point in 2-dimensional space"
@ -3567,10 +3551,9 @@ msgid "Max: %s%s"
msgstr "最大限制:%s %s"
#: libraries/Util.class.php:674 libraries/sql.lib.php:467
#, fuzzy
#| msgid "SQL query"
msgid "SQL query:"
msgstr "SQL 查询"
msgstr "SQL 查询"
#: libraries/Util.class.php:718 libraries/rte/rte_events.lib.php:114
#: libraries/rte/rte_events.lib.php:123 libraries/rte/rte_events.lib.php:140
@ -6456,7 +6439,7 @@ msgstr "正在上传要导入的文件…"
#: libraries/display_import.lib.php:94
#, php-format
msgid "%s/sec."
msgstr "%s/秒"
msgstr "%s/秒"
#: libraries/display_import.lib.php:101
msgid "About %MIN min. %SEC sec. remaining."
@ -10116,10 +10099,9 @@ msgid "FOREIGN KEY relation added"
msgstr "已添加外键关联"
#: pmd_relation_new.php:82
#, fuzzy
#| msgid "Error: Relation not added."
msgid "Error: Relational features are disabled!"
msgstr "错误:关系未添加。"
msgstr "错误:关系功能被禁用!"
#: pmd_relation_new.php:98
msgid "Internal relation added"
@ -11860,11 +11842,11 @@ msgstr "没有可显示数据"
#: tbl_chart.php:62 tbl_gis_visualization.php:24
msgid "No SQL query was set to fetch data."
msgstr "没有设置SQL 查询来检索数据"
msgstr "没有设置SQL 查询来检索数据"
#: tbl_chart.php:124
msgid "No numeric columns present in the table to plot."
msgstr "在将表格转为图标是没有找到数字类型的列"
msgstr "在将表格转为图表时没有找到数字类型的列。"
#: tbl_chart.php:154
msgctxt "Chart type"
@ -12062,10 +12044,9 @@ msgid "Choose column to display:"
msgstr "选择要显示的字段"
#: tbl_structure.php:125
#, fuzzy
#| msgid "No rows selected"
msgid "No column selected."
msgstr "没有选中任何"
msgstr "没有选中任何列。"
#: tbl_structure.php:149
#, php-format

View File

@ -15,14 +15,15 @@ require_once 'libraries/common.inc.php';
*/
require 'libraries/server_common.inc.php';
$response = PMA_Response::getInstance();
/**
* Displays the sub-page heading
*/
echo '<h2>' . "\n"
. ' ' . PMA_Util::getImage('s_asci.png')
. '' . __('Character Sets and Collations') . "\n"
. '</h2>' . "\n";
$html = '<h2>' . "\n"
. ' ' . PMA_Util::getImage('s_asci.png')
. '' . __('Character Sets and Collations') . "\n"
. '</h2>' . "\n";
/**
* Includes the required charset library
@ -33,11 +34,11 @@ require_once 'libraries/mysql_charsets.lib.php';
/**
* Outputs the result
*/
echo '<div id="div_mysql_charset_collations">' . "\n"
. '<table class="data noclick">' . "\n"
. '<tr><th>' . __('Collation') . '</th>' . "\n"
. ' <th>' . __('Description') . '</th>' . "\n"
. '</tr>' . "\n";
$html .= '<div id="div_mysql_charset_collations">' . "\n"
. '<table class="data noclick">' . "\n"
. '<tr><th>' . __('Collation') . '</th>' . "\n"
. ' <th>' . __('Description') . '</th>' . "\n"
. '</tr>' . "\n";
$i = 0;
$table_row_count = count($mysql_charsets) + count($mysql_collations);
@ -45,40 +46,42 @@ $table_row_count = count($mysql_charsets) + count($mysql_collations);
foreach ($mysql_charsets as $current_charset) {
if ($i >= $table_row_count / 2) {
$i = 0;
echo '</table>' . "\n"
. '<table class="data noclick">' . "\n"
. '<tr><th>' . __('Collation') . '</th>' . "\n"
. ' <th>' . __('Description') . '</th>' . "\n"
. '</tr>' . "\n";
$html .= '</table>' . "\n"
. '<table class="data noclick">' . "\n"
. '<tr><th>' . __('Collation') . '</th>' . "\n"
. ' <th>' . __('Description') . '</th>' . "\n"
. '</tr>' . "\n";
}
$i++;
echo '<tr><th colspan="2" class="right">' . "\n"
. ' ' . htmlspecialchars($current_charset) . "\n"
. (empty($mysql_charsets_descriptions[$current_charset])
$html .= '<tr><th colspan="2" class="right">' . "\n"
. ' ' . htmlspecialchars($current_charset) . "\n"
. (empty($mysql_charsets_descriptions[$current_charset])
? ''
: ' (<i>' . htmlspecialchars(
$mysql_charsets_descriptions[$current_charset]
) . '</i>)' . "\n")
. ' </th>' . "\n"
. '</tr>' . "\n";
. ' </th>' . "\n"
. '</tr>' . "\n";
$odd_row = true;
foreach ($mysql_collations[$current_charset] as $current_collation) {
$i++;
echo '<tr class="'
. ($odd_row ? 'odd' : 'even')
. ($mysql_default_collations[$current_charset] == $current_collation
$html .= '<tr class="'
. ($odd_row ? 'odd' : 'even')
. ($mysql_default_collations[$current_charset] == $current_collation
? ' marked'
: '')
. ($mysql_collations_available[$current_collation] ? '' : ' disabled')
. '">' . "\n"
. ' <td>' . htmlspecialchars($current_collation) . '</td>' . "\n"
. ' <td>' . PMA_getCollationDescr($current_collation) . '</td>' . "\n"
. '</tr>' . "\n";
. ($mysql_collations_available[$current_collation] ? '' : ' disabled')
. '">' . "\n"
. ' <td>' . htmlspecialchars($current_collation) . '</td>' . "\n"
. ' <td>' . PMA_getCollationDescr($current_collation) . '</td>' . "\n"
. '</tr>' . "\n";
$odd_row = !$odd_row;
}
}
unset($table_row_count);
echo '</table>' . "\n"
. '</div>' . "\n";
$html .= '</table>' . "\n"
. '</div>' . "\n";
$response->addHTML($html);
?>

View File

@ -294,7 +294,7 @@ if (! isset($GLOBALS['repl_clear_scr'])) {
echo '<br />';
echo '<ul>';
echo ' <li><a href="#" id="slave_status_href">' . __('See slave status table') . '</a>';
echo PMA_replication_print_status_table('slave', true, false);
PMA_replication_print_status_table('slave', true, false);
echo ' </li>';
echo ' <li><a href="#" id="slave_control_href">' . __('Control slave:') . '</a>';

View File

@ -46,7 +46,7 @@ if (! empty($_REQUEST['kill'])) {
$response = PMA_Response::getInstance();
$response->addHTML('<div>');
$response->addHTML($ServerStatusData->getMenuHtml());
$response->addHTML(getServerTrafficHtml($ServerStatusData));
$response->addHTML(PMA_getServerTrafficHtml($ServerStatusData));
$response->addHTML('</div>');
exit;
@ -58,19 +58,19 @@ exit;
*
* @return string
*/
function getServerTrafficHtml($ServerStatusData)
function PMA_getServerTrafficHtml($ServerStatusData)
{
//display the server state General Information
$retval = getServerStateGeneralInfoHtml($ServerStatusData);
$retval = PMA_getServerStateGeneralInfoHtml($ServerStatusData);
//display the server state traffic
$retval .= getServerStateTrafficHtml($ServerStatusData);
$retval .= PMA_getServerStateTrafficHtml($ServerStatusData);
//display the server state connection information
$retval .= getServerStateConnectionsHtml($ServerStatusData);
$retval .= PMA_getServerStateConnectionsHtml($ServerStatusData);
//display the Table Process List information
$retval .= getTableProcesslistHtml($ServerStatusData);
$retval .= PMA_getTableProcesslistHtml($ServerStatusData);
return $retval;
}
@ -82,7 +82,7 @@ function getServerTrafficHtml($ServerStatusData)
*
* @return string
*/
function getServerStateGeneralInfoHtml($ServerStatusData)
function PMA_getServerStateGeneralInfoHtml($ServerStatusData)
{
$start_time = PMA_DBI_fetchValue(
'SELECT UNIX_TIMESTAMP() - ' . $ServerStatusData->status['Uptime']
@ -161,7 +161,7 @@ function getServerStateGeneralInfoHtml($ServerStatusData)
*
* @return string
*/
function getServerStateTrafficHtml($ServerStatusData)
function PMA_getServerStateTrafficHtml($ServerStatusData)
{
$hour_factor = 3600 / $ServerStatusData->status['Uptime'];
$retval = '<table id="serverstatustraffic" class="data noclick">';
@ -250,7 +250,7 @@ function getServerStateTrafficHtml($ServerStatusData)
*
* @return string
*/
function getServerStateConnectionsHtml($ServerStatusData)
function PMA_getServerStateConnectionsHtml($ServerStatusData)
{
$hour_factor = 3600 / $ServerStatusData->status['Uptime'];
$retval = '<table id="serverstatusconnections" class="data noclick">';
@ -349,7 +349,7 @@ function getServerStateConnectionsHtml($ServerStatusData)
*
* @return string
*/
function getTableProcesslistHtml($ServerStatusData)
function PMA_getTableProcesslistHtml($ServerStatusData)
{
$url_params = array();

View File

@ -17,7 +17,7 @@ if (PMA_DRIZZLE) {
include_once 'libraries/replication_gui.lib.php';
}
$ServerStatusData = new PMA_ServerStatusData('server_status_advisor.php');
$ServerStatusData = new PMA_ServerStatusData();
$response = PMA_Response::getInstance();
$scripts = $response->getHeader()->getScripts();

View File

@ -293,10 +293,10 @@ if (isset($_REQUEST['ajax_request']) && $_REQUEST['ajax_request'] == true) {
. implode(
' ',
PMA_Util::formatByteDown(
strlen($row['argument'])
),
2,
2
strlen($row['argument']),
2,
2
)
)
. ']';
}
@ -433,7 +433,7 @@ $ServerStatusData = new PMA_ServerStatusData();
$response->addHTML('<div>');
$response->addHTML($ServerStatusData->getMenuHtml());
$response->addHTML(PMA_getMonitorHtml($ServerStatusData));
$response->addHTML(getClientSideDataAndLinksHtml($ServerStatusData));
$response->addHTML(PMA_getClientSideDataAndLinksHtml($ServerStatusData));
$response->addHTML('</div>');
exit;
@ -446,8 +446,8 @@ exit;
*/
function PMA_getMonitorHtml($ServerStatusData)
{
$retval = PMA_getTabLinksHtml();
$retval .= getPopContentHtml();
$retval = PMA_getTabLinksHtml();
$retval .= PMA_getPopContentHtml();
$retval .= '<div id="monitorInstructionsDialog" title="';
$retval .= __('Monitor Instructions') . '" style="display:none;">';
@ -694,7 +694,7 @@ function PMA_getTabLinksHtml()
*
* @return string
*/
function getPopContentHtml()
function PMA_getPopContentHtml()
{
$retval = '<div class="popupContent settingsPopup">';
$retval .= '<a href="#addNewChart">';
@ -763,7 +763,7 @@ function getPopContentHtml()
*
* @return string
*/
function getClientSideDataAndLinksHtml($ServerStatusData)
function PMA_getClientSideDataAndLinksHtml($ServerStatusData)
{
/**
* Define some data needed on the client side

View File

@ -42,7 +42,7 @@ $scripts->addFile('server_status_sorter.js');
// Add the html content to the response
$response->addHTML('<div>');
$response->addHTML($ServerStatusData->getMenuHtml());
$response->addHTML(getQueryStatisticsHtml($ServerStatusData));
$response->addHTML(PMA_getQueryStatisticsHtml($ServerStatusData));
$response->addHTML('</div>');
exit;
@ -53,7 +53,7 @@ exit;
*
* @return string
*/
function getQueryStatisticsHtml($ServerStatusData)
function PMA_getQueryStatisticsHtml($ServerStatusData)
{
$retval = '';
@ -89,7 +89,7 @@ function getQueryStatisticsHtml($ServerStatusData)
$retval .= '</span>';
$retval .= '</h3>';
$retval .= getServerStatusQueriesDetailsHtml($ServerStatusData);
$retval .= PMA_getServerStatusQueriesDetailsHtml($ServerStatusData);
return $retval;
}
@ -101,8 +101,9 @@ function getQueryStatisticsHtml($ServerStatusData)
*
* @return string
*/
function getServerStatusQueriesDetailsHtml($ServerStatusData)
function PMA_getServerStatusQueriesDetailsHtml($ServerStatusData)
{
$hour_factor = 3600 / $ServerStatusData->status['Uptime'];
$used_queries = $ServerStatusData->used_queries;
$total_queries = array_sum($used_queries);
// reverse sort by value to show most used statements first

View File

@ -44,9 +44,9 @@ $scripts->addFile('server_status_sorter.js');
$response->addHTML('<div>');
$response->addHTML($ServerStatusData->getMenuHtml());
$response->addHTML(getFilterHtml($ServerStatusData));
$response->addHTML(getLinkSuggestionsHtml($ServerStatusData));
$response->addHTML(getVariablesTableHtml($ServerStatusData));
$response->addHTML(PMA_getFilterHtml($ServerStatusData));
$response->addHTML(PMA_getLinkSuggestionsHtml($ServerStatusData));
$response->addHTML(PMA_getVariablesTableHtml($ServerStatusData));
$response->addHTML('</div>');
exit;
@ -58,7 +58,7 @@ exit;
*
* @return string
*/
function getFilterHtml($ServerStatusData)
function PMA_getFilterHtml($ServerStatusData)
{
$filterAlert = '';
if (! empty($_REQUEST['filterAlert'])) {
@ -127,7 +127,7 @@ function getFilterHtml($ServerStatusData)
*
* @return string
*/
function getLinkSuggestionsHtml($ServerStatusData)
function PMA_getLinkSuggestionsHtml($ServerStatusData)
{
$retval = '<div id="linkSuggestions" class="defaultLinks" style="display:none">';
$retval .= '<p class="notice">' . __('Related links:');
@ -161,10 +161,10 @@ function getLinkSuggestionsHtml($ServerStatusData)
*
* @return string
*/
function getVariablesTableHtml($ServerStatusData)
function PMA_getVariablesTableHtml($ServerStatusData)
{
$retval = '';
$strShowStatus = getStatusVariablesDescriptions();
$strShowStatus = PMA_getStatusVariablesDescriptions();
/**
* define some alerts
*/
@ -320,7 +320,7 @@ function getVariablesTableHtml($ServerStatusData)
*
* @return array
*/
function getStatusVariablesDescriptions()
function PMA_getStatusVariablesDescriptions()
{
/**
* Messages are built using the message name

View File

@ -98,7 +98,7 @@ if (isset($_REQUEST['ajax_request']) && $_REQUEST['ajax_request'] == true) {
);
$response->addJSON(
'variable',
formatVariable($_REQUEST['varName'], $varValue[1])
PMA_formatVariable($_REQUEST['varName'], $varValue[1])
);
} else {
$response->isSuccess(false);
@ -198,7 +198,7 @@ foreach ($serverVars as $name => $value) {
}
$output .= '</div>'
. '<div class="var-value value' . (PMA_isSuperuser() ? ' editable' : '') . '">&nbsp;'
. formatVariable($name, $value)
. PMA_formatVariable($name, $value)
. '</div>'
. '<div style="clear:both"></div>'
. '</div>';
@ -207,7 +207,7 @@ foreach ($serverVars as $name => $value) {
$output .= '<div class="var-row' . ($odd_row ? ' odd' : ' even') . '">'
. '<div class="var-name session">(' . __('Session value') . ')</div>'
. '<div class="var-value value">&nbsp;'
. formatVariable($name, $serverVarsSession[$name]) . '</div>'
. PMA_formatVariable($name, $serverVarsSession[$name]) . '</div>'
. '<div style="clear:both"></div>'
. '</div>';
}
@ -226,7 +226,7 @@ $response->addHtml($output);
*
* @return formatted string
*/
function formatVariable($name, $value)
function PMA_formatVariable($name, $value)
{
global $VARIABLE_DOC_LINKS;

View File

@ -556,7 +556,13 @@ if (isset($GLOBALS['show_as_php']) || ! empty($GLOBALS['validatequery'])) {
} while (PMA_DBI_nextResult());
$is_procedure = false;
if (stripos($full_sql_query, 'call') !== false) {
// Since multiple query execution is anyway handled,
// ignore the WHERE clause of the first sql statement
// which might contain a phrase like 'call '
if (preg_match("/\bcall\b/i", $full_sql_query)
&& empty($analyzed_sql[0]['where_clause'])
) {
$is_procedure = true;
}

View File

@ -50,123 +50,10 @@ if (isset($_REQUEST['do_save_data'])) {
//avoid an incorrect calling of PMA_updateColumns() via
//tbl_structure.php below
unset($_REQUEST['do_save_data']);
$query = '';
$definitions = array();
// Transforms the radio button field_key into 3 arrays
$field_cnt = count($_REQUEST['field_name']);
$field_primary = array();
$field_index = array();
$field_unique = array();
$field_fulltext = array();
for ($i = 0; $i < $field_cnt; ++$i) {
if (isset($_REQUEST['field_key'][$i])
&& strlen($_REQUEST['field_name'][$i])
) {
if ($_REQUEST['field_key'][$i] == 'primary_' . $i) {
$field_primary[] = $i;
}
if ($_REQUEST['field_key'][$i] == 'index_' . $i) {
$field_index[] = $i;
}
if ($_REQUEST['field_key'][$i] == 'unique_' . $i) {
$field_unique[] = $i;
}
if ($_REQUEST['field_key'][$i] == 'fulltext_' . $i) {
$field_fulltext[] = $i;
}
} // end if
} // end for
// Builds the field creation statement and alters the table
for ($i = 0; $i < $field_cnt; ++$i) {
// '0' is also empty for php :-(
if (empty($_REQUEST['field_name'][$i])
&& $_REQUEST['field_name'][$i] != '0'
) {
continue;
}
$definition = ' ADD ' . PMA_Table::generateFieldSpec(
$_REQUEST['field_name'][$i],
$_REQUEST['field_type'][$i],
$i,
$_REQUEST['field_length'][$i],
$_REQUEST['field_attribute'][$i],
isset($_REQUEST['field_collation'][$i])
? $_REQUEST['field_collation'][$i]
: '',
isset($_REQUEST['field_null'][$i])
? $_REQUEST['field_null'][$i]
: 'NOT NULL',
$_REQUEST['field_default_type'][$i],
$_REQUEST['field_default_value'][$i],
isset($_REQUEST['field_extra'][$i])
? $_REQUEST['field_extra'][$i]
: false,
isset($_REQUEST['field_comments'][$i])
? $_REQUEST['field_comments'][$i]
: '',
$field_primary
);
if ($_REQUEST['field_where'] != 'last') {
// Only the first field can be added somewhere other than at the end
if ($i == 0) {
if ($_REQUEST['field_where'] == 'first') {
$definition .= ' FIRST';
} else {
$definition .= ' AFTER '
. PMA_Util::backquote($_REQUEST['after_field']);
}
} else {
$definition .= ' AFTER '
. PMA_Util::backquote($_REQUEST['field_name'][$i-1]);
}
}
$definitions[] = $definition;
} // end for
// Builds the primary keys statements and updates the table
if (count($field_primary)) {
$fields = array();
foreach ($field_primary as $field_nr) {
$fields[] = PMA_Util::backquote($_REQUEST['field_name'][$field_nr]);
}
$definitions[] = ' ADD PRIMARY KEY (' . implode(', ', $fields) . ') ';
unset($fields);
}
// Builds the indexes statements and updates the table
if (count($field_index)) {
$fields = array();
foreach ($field_index as $field_nr) {
$fields[] = PMA_Util::backquote($_REQUEST['field_name'][$field_nr]);
}
$definitions[] = ' ADD INDEX (' . implode(', ', $fields) . ') ';
unset($fields);
}
// Builds the uniques statements and updates the table
if (count($field_unique)) {
$fields = array();
foreach ($field_unique as $field_nr) {
$fields[] = PMA_Util::backquote($_REQUEST['field_name'][$field_nr]);
}
$definitions[] = ' ADD UNIQUE (' . implode(', ', $fields) . ') ';
unset($fields);
}
// Builds the fulltext statements and updates the table
if (count($field_fulltext)) {
$fields = array();
foreach ($field_fulltext as $field_nr) {
$fields[] = PMA_Util::backquote($_REQUEST['field_name'][$field_nr]);
}
$definitions[] = ' ADD FULLTEXT (' . implode(', ', $fields) . ') ';
unset($fields);
}
require_once 'libraries/create_addfield.lib.php';
// get column addition statements
$sql_statement = PMA_getColumnCreationStatements(false);
// To allow replication, we first select the db to use and then run queries
// on this db.
@ -175,7 +62,7 @@ if (isset($_REQUEST['do_save_data'])) {
PMA_DBI_getError(), 'USE ' . PMA_Util::backquote($db), '', $err_url
);
$sql_query = 'ALTER TABLE ' .
PMA_Util::backquote($table) . ' ' . implode(', ', $definitions) . ';';
PMA_Util::backquote($table) . ' ' . $sql_statement . ';';
$result = PMA_DBI_tryQuery($sql_query);
if ($result === true) {

View File

@ -67,137 +67,14 @@ if (!PMA_DBI_selectDb($db)) {
*/
if (isset($_REQUEST['do_save_data'])) {
$sql_query = '';
// Transforms the radio button field_key into 3 arrays
$field_cnt = count($_REQUEST['field_name']);
for ($i = 0; $i < $field_cnt; ++$i) {
if (isset($_REQUEST['field_key'][$i])) {
if ($_REQUEST['field_key'][$i] == 'primary_' . $i) {
$field_primary[] = $i;
}
if ($_REQUEST['field_key'][$i] == 'index_' . $i) {
$field_index[] = $i;
}
if ($_REQUEST['field_key'][$i] == 'unique_' . $i) {
$field_unique[] = $i;
}
} // end if
} // end for
// Builds the fields creation statements
for ($i = 0; $i < $field_cnt; $i++) {
// '0' is also empty for php :-(
if (empty($_REQUEST['field_name'][$i])
&& $_REQUEST['field_name'][$i] != '0'
) {
continue;
}
$query = PMA_Table::generateFieldSpec(
$_REQUEST['field_name'][$i],
$_REQUEST['field_type'][$i],
$i,
$_REQUEST['field_length'][$i],
$_REQUEST['field_attribute'][$i],
isset($_REQUEST['field_collation'][$i])
? $_REQUEST['field_collation'][$i]
: '',
isset($_REQUEST['field_null'][$i])
? $_REQUEST['field_null'][$i]
: 'NOT NULL',
$_REQUEST['field_default_type'][$i],
$_REQUEST['field_default_value'][$i],
isset($_REQUEST['field_extra'][$i])
? $_REQUEST['field_extra'][$i]
: false,
isset($_REQUEST['field_comments'][$i])
? $_REQUEST['field_comments'][$i]
: '',
$field_primary,
''
);
$query .= ', ';
$sql_query .= $query;
} // end for
unset($field_cnt, $query);
$sql_query = preg_replace('@, $@', '', $sql_query);
// Builds the primary keys statements
$primary = '';
$primary_cnt = (isset($field_primary) ? count($field_primary) : 0);
for ($i = 0; $i < $primary_cnt; $i++) {
$j = $field_primary[$i];
if (isset($_REQUEST['field_name'][$j])
&& strlen($_REQUEST['field_name'][$j])
) {
$primary .= PMA_Util::backquote($_REQUEST['field_name'][$j]) . ', ';
}
} // end for
unset($primary_cnt);
$primary = preg_replace('@, $@', '', $primary);
if (strlen($primary)) {
$sql_query .= ', PRIMARY KEY (' . $primary . ')';
}
unset($primary);
// Builds the indexes statements
$index = '';
$index_cnt = (isset($field_index) ? count($field_index) : 0);
for ($i = 0;$i < $index_cnt; $i++) {
$j = $field_index[$i];
if (isset($_REQUEST['field_name'][$j])
&& strlen($_REQUEST['field_name'][$j])
) {
$index .= PMA_Util::backquote($_REQUEST['field_name'][$j]) . ', ';
}
} // end for
unset($index_cnt);
$index = preg_replace('@, $@', '', $index);
if (strlen($index)) {
$sql_query .= ', INDEX (' . $index . ')';
}
unset($index);
// Builds the uniques statements
$unique = '';
$unique_cnt = (isset($field_unique) ? count($field_unique) : 0);
for ($i = 0; $i < $unique_cnt; $i++) {
$j = $field_unique[$i];
if (isset($_REQUEST['field_name'][$j])
&& strlen($_REQUEST['field_name'][$j])
) {
$unique .= PMA_Util::backquote($_REQUEST['field_name'][$j]) . ', ';
}
} // end for
unset($unique_cnt);
$unique = preg_replace('@, $@', '', $unique);
if (strlen($unique)) {
$sql_query .= ', UNIQUE (' . $unique . ')';
}
unset($unique);
// Builds the FULLTEXT statements
$fulltext = '';
$fulltext_cnt = (isset($field_fulltext) ? count($field_fulltext) : 0);
for ($i = 0; $i < $fulltext_cnt; $i++) {
$j = $field_fulltext[$i];
if (isset($_REQUEST['field_name'][$j])
&& strlen($_REQUEST['field_name'][$j])
) {
$fulltext .= PMA_Util::backquote($_REQUEST['field_name'][$j]) . ', ';
}
} // end for
$fulltext = preg_replace('@, $@', '', $fulltext);
if (strlen($fulltext)) {
$sql_query .= ', FULLTEXT (' . $fulltext . ')';
}
unset($fulltext);
require_once 'libraries/create_addfield.lib.php';
// get column addition statements
$sql_statement = PMA_getColumnCreationStatements(true);
// Builds the 'create table' statement
$sql_query = 'CREATE TABLE ' . PMA_Util::backquote($db) . '.'
. PMA_Util::backquote($table) . ' (' . $sql_query . ')';
. PMA_Util::backquote($table) . ' (' . $sql_statement . ')';
// Adds table type, character set, comments and partition definition
if (!empty($_REQUEST['tbl_storage_engine'])

View File

@ -62,7 +62,7 @@ class PMA_ConfigTest extends PHPUnit_Framework_TestCase
}
public function testGetFontsizeForm()
{
{
$this->assertContains(
'<form name="form_fontsize_selection" id="form_fontsize_selection"',
PMA_Config::getFontsizeForm()
@ -72,6 +72,51 @@ class PMA_ConfigTest extends PHPUnit_Framework_TestCase
'<label for="select_fontsize">',
PMA_Config::getFontsizeForm()
);
//test getFontsizeOptions for "em" unit
$_COOKIE['pma_fontsize'] = "10em";
$this->assertContains(
'<option value="7em"',
PMA_Config::getFontsizeForm()
);
$this->assertContains(
'<option value="8em"',
PMA_Config::getFontsizeForm()
);
//test getFontsizeOptions for "pt" unit
$_COOKIE['pma_fontsize'] = "10pt";
$this->assertContains(
'<option value="2pt"',
PMA_Config::getFontsizeForm()
);
$this->assertContains(
'<option value="4pt"',
PMA_Config::getFontsizeForm()
);
//test getFontsizeOptions for "px" unit
$_COOKIE['pma_fontsize'] = "10px";
$this->assertContains(
'<option value="5px"',
PMA_Config::getFontsizeForm()
);
$this->assertContains(
'<option value="6px"',
PMA_Config::getFontsizeForm()
);
//test getFontsizeOptions for unknown unit
$_COOKIE['pma_fontsize'] = "10abc";
$this->assertContains(
'<option value="7abc"',
PMA_Config::getFontsizeForm()
);
$this->assertContains(
'<option value="8abc"',
PMA_Config::getFontsizeForm()
);
unset($_COOKIE['pma_fontsize']);
}
public function testCheckOutputCompression()

View File

@ -0,0 +1,100 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* Test for PMA_Util class
*
* @package PhpMyAdmin-test
*/
/*
* Include to test.
*/
require_once 'libraries/Util.class.php';
/**
* Test for PMA_Util class
*
* @package PhpMyAdmin-test
*/
class PMA_Util_Test extends PHPUnit_Framework_TestCase
{
/**
* Test for analyze Limit Clause
*
* @return void
*/
public function testAnalyzeLimitClause()
{
$limit_data = PMA_Util::analyzeLimitClause("limit 2,4");
$this->assertEquals(
'2',
$limit_data['start']
);
$this->assertEquals(
'4',
$limit_data['length']
);
$limit_data = PMA_Util::analyzeLimitClause("limit 3");
$this->assertEquals(
'0',
$limit_data['start']
);
$this->assertEquals(
'3',
$limit_data['length']
);
}
/**
* Test for createGISData
*
* @return void
*/
public function testCreateGISData()
{
$this->assertEquals(
"abc",
PMA_Util::createGISData("abc")
);
$this->assertEquals(
"GeomFromText('POINT()',10)",
PMA_Util::createGISData("'POINT()',10")
);
}
/**
* Test for getGISFunctions
*
* @return void
*/
public function testGetGISFunctions()
{
$funcs = PMA_Util::getGISFunctions();
$this->assertArrayHasKey(
'Dimension',
$funcs
);
$this->assertArrayHasKey(
'GeometryType',
$funcs
);
$this->assertArrayHasKey(
'MBRDisjoint',
$funcs
);
}
/**
* Test for Page Selector
*
* @return void
*/
public function testPageSelector()
{
$this->assertContains(
'<select class="pageselector ajax" name="pma" >',
PMA_Util::pageselector("pma",3)
);
}
}

View File

@ -21,9 +21,39 @@ if (isset($_SESSION['cache']['version_check'])
$save = true;
$file = 'http://www.phpmyadmin.net/home_page/version.json';
if (ini_get('allow_url_fopen')) {
$response = file_get_contents($file);
if (strlen($cfg['VersionCheckProxyUrl'])) {
$context = array(
'http' => array(
'proxy' => $cfg['VersionCheckProxyUrl'],
'request_fulluri' => true
)
);
if (strlen($cfg['VersionCheckProxyUser'])) {
$auth = base64_encode(
$cfg['VersionCheckProxyUser'] . ':' . $cfg['VersionCheckProxyPass']
);
$context['http']['header'] = 'Proxy-Authorization: Basic ' . $auth;
}
$response = file_get_contents(
$file,
false,
stream_context_create($context)
);
} else {
$response = file_get_contents($file);
}
} else if (function_exists('curl_init')) {
$curl_handle = curl_init($file);
if (strlen($cfg['VersionCheckProxyUrl'])) {
curl_setopt($curl_handle, CURLOPT_PROXY, $cfg['VersionCheckProxyUrl']);
if (strlen($cfg['VersionCheckProxyUser'])) {
curl_setopt(
$curl_handle,
CURLOPT_PROXYUSERPWD,
$cfg['VersionCheckProxyUser'] . ':' . $cfg['VersionCheckProxyPass']
);
}
}
curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($curl_handle);
}