Merge remote-tracking branch 'origin/master'

This commit is contained in:
Michal Čihař 2012-07-29 15:56:33 +02:00
commit 03a523f2a7
11 changed files with 96 additions and 61 deletions

View File

@ -21,7 +21,9 @@ require 'libraries/config/user_preferences.forms.php';
PMA_userprefs_pageinit();
$error = '';
if (isset($_POST['submit_export']) && filter_input(INPUT_POST, 'export_type') == 'text_file') {
if (isset($_POST['submit_export'])
&& filter_input(INPUT_POST, 'export_type') == 'text_file'
) {
// export to JSON file
PMA_Response::getInstance()->disable();
$filename = 'phpMyAdmin-config-' . urlencode(PMA_getenv('HTTP_HOST')) . '.json';
@ -78,7 +80,8 @@ if (isset($_POST['submit_export']) && filter_input(INPUT_POST, 'export_type') ==
if (! is_array($config)) {
$error = __('Could not import configuration');
} else {
// sanitize input values: treat them as though they came from HTTP POST request
// sanitize input values: treat them as though
// they came from HTTP POST request
$form_display = new FormDisplay();
foreach ($forms as $formset_id => $formset) {
foreach ($formset as $form_name => $form) {
@ -192,7 +195,9 @@ if (isset($_POST['submit_export']) && filter_input(INPUT_POST, 'export_type') ==
if ($result === true) {
$params = array();
if ($_SESSION['PMA_Theme_Manager']->theme->getId() != 'original') {
$GLOBALS['PMA_Config']->removeCookie($_SESSION['PMA_Theme_Manager']->getThemeCookieName());
$GLOBALS['PMA_Config']->removeCookie(
$_SESSION['PMA_Theme_Manager']->getThemeCookieName()
);
unset($_SESSION['PMA_Theme_Manager']);
unset($_SESSION['PMA_Theme']);
$params['reload_left_frame'] = true;

View File

@ -124,14 +124,14 @@ $scripts->addFile('common.js');
$scripts->addFile('querywindow.js');
if (PMA_isValid($_REQUEST['auto_commit'], 'identical', 'true')) {
$scripts->addEvent('load','PMA_queryAutoCommit');
$scripts->addEvent('load', 'PMA_queryAutoCommit');
}
if (PMA_isValid($_REQUEST['init'])) {
$scripts->addEvent('load','PMA_querywindowResize');
$scripts->addEvent('load', 'PMA_querywindowResize');
}
// always set focus to the textarea
if ($querydisplay_tab == 'sql' || $querydisplay_tab == 'full') {
$scripts->addEvent('load','PMA_querywindowSetFocus');
$scripts->addEvent('load', 'PMA_querywindowSetFocus');
}
echo '<div id="querywindowcontainer">';

View File

@ -56,7 +56,11 @@ PMA_DBI_select_db($db);
$path = PMA_securePath(ucfirst($export_type));
if (!file_exists('libraries/schema/' . $path . '_Relation_Schema.class.php')) {
PMA_Export_Relation_Schema::dieSchema($_POST['chpage'], $export_type, __('File doesn\'t exist'));
PMA_Export_Relation_Schema::dieSchema(
$_POST['chpage'],
$export_type,
__('File doesn\'t exist')
);
}
require "libraries/schema/".$path."_Relation_Schema.class.php";
$obj_schema = eval("new PMA_".$path."_Relation_Schema();");

View File

@ -29,7 +29,9 @@ if (! isset($_REQUEST['pos'])) {
$pos = (int) $_REQUEST['pos'];
}
if (! isset($_REQUEST['log']) || ! array_key_exists($_REQUEST['log'], $binary_logs)) {
if (! isset($_REQUEST['log'])
|| ! array_key_exists($_REQUEST['log'], $binary_logs)
) {
$_REQUEST['log'] = '';
} else {
$url_params['log'] = $_REQUEST['log'];

View File

@ -32,7 +32,9 @@ if (!PMA_DBI_get_columns($db, $table)) {
}
/* Grab data */
$sql = 'SELECT ' . $common_functions->backquote($transform_key) . ' FROM ' . $common_functions->backquote($table) . ' WHERE ' . $where_clause . ';';
$sql = 'SELECT ' . $common_functions->backquote($transform_key)
. ' FROM ' . $common_functions->backquote($table)
. ' WHERE ' . $where_clause . ';';
$result = PMA_DBI_fetch_value($sql);
/* Check return code */

View File

@ -90,11 +90,14 @@ if (isset($_REQUEST['saveToFile'])) {
exit();
}
$svg_support = (PMA_USR_BROWSER_AGENT == 'IE' && PMA_USR_BROWSER_VER <= 8) ? false : true;
$svg_support = (PMA_USR_BROWSER_AGENT == 'IE' && PMA_USR_BROWSER_VER <= 8)
? false : true;
$format = $svg_support ? 'svg' : 'png';
// get the chart and settings after chart generation
$visualization = PMA_GIS_visualizationResults($data, $visualizationSettings, $format);
$visualization = PMA_GIS_visualizationResults(
$data, $visualizationSettings, $format
);
/**
* Displays the page

View File

@ -22,7 +22,7 @@ foreach (PMA_DBI_get_columns_full($db, $table) as $row) {
$tmp[2] = substr(
preg_replace('@([^,])\'\'@', '\\1\\\'', ',' . $tmp[2]), 1
);
$fields[$row['Field']] = $tmp[1] . '('
$fields[$row['Field']] = $tmp[1] . '('
. str_replace(',', ', ', $tmp[2]) . ')';
} else {
$fields[$row['Field']] = $row['Type'];
@ -50,39 +50,41 @@ if (isset($_REQUEST['do_save_data'])) {
$error = false;
// $sql_query is the one displayed in the query box
$sql_query = 'ALTER TABLE ' . $common_functions->backquote($db) . '.' . $common_functions->backquote($table);
$sql_query = 'ALTER TABLE ' . $common_functions->backquote($db)
. '.' . $common_functions->backquote($table);
// Drops the old index
if (! empty($_REQUEST['old_index'])) {
if ($_REQUEST['old_index'] == 'PRIMARY') {
$sql_query .= ' DROP PRIMARY KEY,';
} else {
$sql_query .= ' DROP INDEX '
$sql_query .= ' DROP INDEX '
. $common_functions->backquote($_REQUEST['old_index']) . ',';
}
} // end if
// Builds the new one
switch ($index->getType()) {
case 'PRIMARY':
if ($index->getName() == '') {
$index->setName('PRIMARY');
} elseif ($index->getName() != 'PRIMARY') {
$error = PMA_Message::error(__(
'The name of the primary key must be "PRIMARY"!'));
}
$sql_query .= ' ADD PRIMARY KEY';
break;
case 'FULLTEXT':
case 'UNIQUE':
case 'INDEX':
case 'SPATIAL':
if ($index->getName() == 'PRIMARY') {
$error = PMA_Message::error(__('Can\'t rename index to PRIMARY!'));
}
$sql_query .= ' ADD ' . $index->getType() . ' '
. ($index->getName() ? $common_functions->backquote($index->getName()) : '');
break;
case 'PRIMARY':
if ($index->getName() == '') {
$index->setName('PRIMARY');
} elseif ($index->getName() != 'PRIMARY') {
$error = PMA_Message::error(
__('The name of the primary key must be "PRIMARY"!')
);
}
$sql_query .= ' ADD PRIMARY KEY';
break;
case 'FULLTEXT':
case 'UNIQUE':
case 'INDEX':
case 'SPATIAL':
if ($index->getName() == 'PRIMARY') {
$error = PMA_Message::error(__('Can\'t rename index to PRIMARY!'));
}
$sql_query .= ' ADD ' . $index->getType() . ' '
. ($index->getName() ? $common_functions->backquote($index->getName()) : '');
break;
} // end switch
$index_fields = array();
@ -103,8 +105,9 @@ if (isset($_REQUEST['do_save_data'])) {
if (! $error) {
PMA_DBI_query($sql_query);
$message = PMA_Message::success(__(
'Table %1$s has been altered successfully'));
$message = PMA_Message::success(
__('Table %1$s has been altered successfully')
);
$message->addParam($table);
if ($GLOBALS['is_ajax_request'] == true) {
@ -161,8 +164,8 @@ if (isset($_REQUEST['index']) && is_array($_REQUEST['index'])) {
?>
<form action="tbl_indexes.php" method="post" name="index_frm" id="index_frm" <?php
echo ($GLOBALS['cfg']['AjaxEnable']
? ' class="ajax"'
echo ($GLOBALS['cfg']['AjaxEnable']
? ' class="ajax"'
: ''); ?>
onsubmit="if (typeof(this.elements['index[Key_name]'].disabled) != 'undefined') {
this.elements['index[Key_name]'].disabled = false}">
@ -249,16 +252,16 @@ foreach ($index->getColumns() as $column) {
<option value="">-- <?php echo __('Ignore'); ?> --</option>
<?php
foreach ($fields as $field_name => $field_type) {
if (($index->getType() != 'FULLTEXT'
if (($index->getType() != 'FULLTEXT'
|| preg_match('/(char|text)/i', $field_type))
&& ($index->getType() != 'SPATIAL'
&& ($index->getType() != 'SPATIAL'
|| in_array($field_type, $spatial_types))
) {
echo '<option value="' . htmlspecialchars($field_name) . '"'
. (($field_name == $column->getName())
? ' selected="selected"'
. (($field_name == $column->getName())
? ' selected="selected"'
: '') . '>'
. htmlspecialchars($field_name) . ' ['
. htmlspecialchars($field_name) . ' ['
. htmlspecialchars($field_type) . ']'
. '</option>' . "\n";
}
@ -285,7 +288,7 @@ for ($i = 0; $i < $add_fields; $i++) {
<?php
foreach ($fields as $field_name => $field_type) {
echo '<option value="' . htmlspecialchars($field_name) . '">'
. htmlspecialchars($field_name) . ' ['
. htmlspecialchars($field_name) . ' ['
. htmlspecialchars($field_type) . ']'
. '</option>' . "\n";
} // end foreach $fields

View File

@ -58,13 +58,17 @@ if (PMA_isValid($_REQUEST['new_name'])) {
} else {
$message = PMA_Message::success(__('Table %s has been copied to %s.'));
}
$old = $common_functions->backquote($db) . '.' . $common_functions->backquote($table);
$old = $common_functions->backquote($db) . '.'
. $common_functions->backquote($table);
$message->addParam($old);
$new = $common_functions->backquote($_REQUEST['target_db']) . '.' . $common_functions->backquote($_REQUEST['new_name']);
$new = $common_functions->backquote($_REQUEST['target_db']) . '.'
. $common_functions->backquote($_REQUEST['new_name']);
$message->addParam($new);
/* Check: Work on new table or on old table? */
if (isset($_REQUEST['submit_move']) || PMA_isValid($_REQUEST['switch_to_new'])) {
if (isset($_REQUEST['submit_move'])
|| PMA_isValid($_REQUEST['switch_to_new'])
) {
$db = $_REQUEST['target_db'];
$table = $_REQUEST['new_name'];
}

View File

@ -5,11 +5,14 @@
*
* includes phpMyAdmin relations and InnoDB relations
*
* @todo fix name handling: currently names with dots (.) are not properly handled for internal relations (but foreign keys relations are correct)
* @todo fix name handling: currently names with dots (.) are not properly handled
* for internal relations (but foreign keys relations are correct)
* @todo foreign key constraints require both fields being of equal type and size
* @todo check foreign fields to be from same type and size, all other makes no sense
* @todo add an link to create an index required for constraints, or an option to do automatically
* @todo if above todos are fullfilled we can add all fields meet requirements in the select dropdown
* @todo add an link to create an index required for constraints,
* or an option to do automatically
* @todo if above todos are fullfilled we can add all fields meet requirements
* in the select dropdown
* @package PhpMyAdmin
*/
@ -108,7 +111,9 @@ function PMA_backquote_split($text)
if (false === $first_backquote || false === $second_backquote) {
break;
}
$elements[] = substr($text, $first_backquote, $second_backquote - $first_backquote + 1);
$elements[] = substr(
$text, $first_backquote, $second_backquote - $first_backquote + 1
);
$pos = $second_backquote + 1;
}
return($elements);
@ -361,15 +366,15 @@ if ($cfgRelation['relwork']
// same engine.
if ($common_functions->isForeignKeySupported($tbl_storage_engine)) {
$tab_query = 'SHOW TABLE STATUS FROM ' . $common_functions->backquote($db);
$tab_query = 'SHOW TABLE STATUS FROM ' . $common_functions->backquote($db);
// [0] of the row is the name
// [1] is the type
} else {
$tab_query = 'SHOW TABLES FROM ' . $common_functions->backquote($db);
$tab_query = 'SHOW TABLES FROM ' . $common_functions->backquote($db);
// [0] of the row is the name
}
$tab_rs = PMA_DBI_query($tab_query, null, PMA_DBI_QUERY_STORE);
$tab_rs = PMA_DBI_query($tab_query, null, PMA_DBI_QUERY_STORE);
$selectboxall[] = '';
$selectboxall_foreign[] = '';
@ -377,7 +382,10 @@ if ($cfgRelation['relwork']
$current_table = new PMA_Table($curr_table[0], $db);
// explicitely ask for non-quoted list of indexed columns
$selectboxall = array_merge($selectboxall, $current_table->getUniqueColumns($backquoted = false));
$selectboxall = array_merge(
$selectboxall,
$current_table->getUniqueColumns($backquoted = false)
);
// if foreign keys are supported, collect all keys from other
// tables of the same engine
@ -387,7 +395,10 @@ if ($cfgRelation['relwork']
) {
// explicitely ask for non-quoted list of indexed columns
// need to obtain backquoted values to support dots inside values
$selectboxall_foreign = array_merge($selectboxall_foreign, $current_table->getIndexedColumns($backquoted = true));
$selectboxall_foreign = array_merge(
$selectboxall_foreign,
$current_table->getIndexedColumns($backquoted = true)
);
}
} // end while over tables
} // end if

View File

@ -65,7 +65,8 @@ if (! empty($submit_mult) && isset($_REQUEST['selected_fld'])) {
// what is this htmlspecialchars() for??
//$sql_query .= ' FROM ' . backquote(htmlspecialchars($table));
$sql_query .= ' FROM ' . $common_functions->backquote($db) . '.' . $common_functions->backquote($table);
$sql_query .= ' FROM ' . $common_functions->backquote($db)
. '.' . $common_functions->backquote($table);
include 'sql.php';
exit;
} else {
@ -733,7 +734,7 @@ if (! $tbl_is_view
&& 'ARCHIVE' != $tbl_storage_engine
) {
echo $common_functions->getDivForSliderEffect('indexes', __('Indexes'));
/**
* Display indexes
*/

View File

@ -55,10 +55,10 @@ if (isset($_REQUEST['report_export'])) {
/**
* Filters tracking entries
*
* @param array the entries to filter
* @param string "from" date
* @param string "to" date
* @param string users
* @param array $data the entries to filter
* @param string $filter_ts_from "from" date
* @param string $filter_ts_to "to" date
* @param string $filter_users users
*
* @return array filtered entries
*/