Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into drizzle
Browse files Browse the repository at this point in the history
  • Loading branch information
piotrp committed Jun 27, 2011
2 parents c734e1f + 49a3978 commit 3bde595
Show file tree
Hide file tree
Showing 176 changed files with 36,103 additions and 38,317 deletions.
3 changes: 2 additions & 1 deletion ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,13 @@ phpMyAdmin - ChangeLog
+ [display] More options for browsing GIS data
+ [interface] Support for spatial indexes
+ [display] GIS data visualization
+ AJAX for table structure multiple-columns change

3.4.4.0 (not yet released)
- bug #3323060 [parser] SQL parser breaks AJAX requests if query has unclosed quotes
- bug #3323101 [parser] Invalid escape sequence in SQL parser

3.4.3.0 (not yet released)
3.4.3.0 (2011-06-27)
- bug #3311170 [sync] Missing helper icons in Synchronize
- patch #3304473 [setup] Redefine a lable that was wrong
- bug #3304544 [parser] master is not a reserved word
Expand Down
2 changes: 2 additions & 0 deletions db_events.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<?php

/**
* Events management.
*
* @package phpMyAdmin
*/
require_once './libraries/common.inc.php';
require_once './libraries/common.lib.php';
Expand Down
4 changes: 0 additions & 4 deletions db_export.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@
/**
* dumps a database
*
* @uses libraries/db_common.inc.php
* @uses libraries/db_info.inc.php
* @uses libraries/display_export.lib.php
* @uses $tables from libraries/db_info.inc.php
* @package phpMyAdmin
*/

Expand Down
4 changes: 2 additions & 2 deletions db_operations.php
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@
// to avoid selecting alternatively the current and new db
// we would need to modify the CREATE definitions to qualify
// the db name
$event_names = PMA_DBI_fetch_result('SELECT EVENT_NAME FROM information_schema.EVENTS WHERE EVENT_SCHEMA= \'' . PMA_sqlAddslashes($db,true) . '\';');
$event_names = PMA_DBI_fetch_result('SELECT EVENT_NAME FROM information_schema.EVENTS WHERE EVENT_SCHEMA= \'' . PMA_sqlAddSlashes($db,true) . '\';');
if ($event_names) {
foreach($event_names as $event_name) {
PMA_DBI_select_db($db);
Expand Down Expand Up @@ -589,7 +589,7 @@
$test_query = '
SELECT *
FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['pdf_pages']) . '
WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\'';
WHERE db_name = \'' . PMA_sqlAddSlashes($db) . '\'';
$test_rs = PMA_query_as_controluser($test_query, null, PMA_DBI_QUERY_STORE);

/*
Expand Down
2 changes: 1 addition & 1 deletion db_printview.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
if ($result != false && PMA_DBI_num_rows($result) > 0) {
while ($tmp = PMA_DBI_fetch_row($result)) {
if (! isset($sot_cache[$tmp[0]])) {
$sts_result = PMA_DBI_query('SHOW TABLE STATUS FROM ' . PMA_backquote($db) . ' LIKE \'' . PMA_sqlAddSlashes($tmp[0]) . '\';');
$sts_result = PMA_DBI_query('SHOW TABLE STATUS FROM ' . PMA_backquote($db) . ' LIKE \'' . PMA_sqlAddSlashes($tmp[0], true) . '\';');
$sts_tmp = PMA_DBI_fetch_assoc($sts_result);
$tables[] = $sts_tmp;
} else { // table in use
Expand Down
8 changes: 5 additions & 3 deletions db_routines.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* Routines management.
*
* @package phpMyAdmin
*/

Expand Down Expand Up @@ -251,8 +253,8 @@
$routine_name = htmlspecialchars(PMA_backquote($_GET['routine_name']));
$routine_type = PMA_DBI_fetch_value("SELECT ROUTINE_TYPE "
. "FROM INFORMATION_SCHEMA.ROUTINES "
. "WHERE ROUTINE_SCHEMA='" . PMA_sqlAddslashes($db) . "' "
. "AND SPECIFIC_NAME='" . PMA_sqlAddslashes($_GET['routine_name']) . "';");
. "WHERE ROUTINE_SCHEMA='" . PMA_sqlAddSlashes($db) . "' "
. "AND SPECIFIC_NAME='" . PMA_sqlAddSlashes($_GET['routine_name']) . "';");
if (! empty($routine_type) && $create_proc = PMA_DBI_get_definition($db, $routine_type, $_GET['routine_name'])) {
$create_proc = '<textarea cols="40" rows="15" style="width: 100%;">' . htmlspecialchars($create_proc) . '</textarea>';
if ($GLOBALS['is_ajax_request']) {
Expand Down Expand Up @@ -345,7 +347,7 @@
$extra_data = array();
if ($message->isSuccess()) {
$columns = "`SPECIFIC_NAME`, `ROUTINE_NAME`, `ROUTINE_TYPE`, `DTD_IDENTIFIER`, `ROUTINE_DEFINITION`";
$where = "ROUTINE_SCHEMA='" . PMA_sqlAddslashes($db) . "' AND ROUTINE_NAME='" . PMA_sqlAddslashes($_REQUEST['routine_name']) . "'";
$where = "ROUTINE_SCHEMA='" . PMA_sqlAddSlashes($db) . "' AND ROUTINE_NAME='" . PMA_sqlAddSlashes($_REQUEST['routine_name']) . "'";
$routine = PMA_DBI_fetch_single_row("SELECT $columns FROM `INFORMATION_SCHEMA`.`ROUTINES` WHERE $where;");
$extra_data['name'] = htmlspecialchars(strtoupper($_REQUEST['routine_name']));
$extra_data['new_row'] = PMA_RTN_getRowForRoutinesList($routine, 0, true);
Expand Down
31 changes: 3 additions & 28 deletions db_search.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,6 @@
*
* @todo make use of UNION when searching multiple tables
* @todo display executed query, optional?
* @uses $cfg['UseDbSearch']
* @uses $GLOBALS['db']
* @uses PMA_DBI_get_tables()
* @uses PMA_sqlAddslashes()
* @uses PMA_getSearchSqls()
* @uses PMA_DBI_fetch_value()
* @uses PMA_linkOrButton()
* @uses PMA_generate_common_url()
* @uses PMA_generate_common_hidden_inputs()
* @uses PMA_showMySQLDocu()
* @uses $_REQUEST['search_str']
* @uses $_REQUEST['submit_search']
* @uses $_REQUEST['search_option']
* @uses $_REQUEST['table_select']
* @uses $_REQUEST['unselectall']
* @uses $_REQUEST['selectall']
* @uses $_REQUEST['field_str']
* @uses is_string()
* @uses htmlspecialchars()
* @uses array_key_exists()
* @uses is_array()
* @uses array_intersect()
* @uses sprintf()
* @uses in_array()
* @package phpMyAdmin
*/

Expand Down Expand Up @@ -85,11 +61,11 @@
$searched = htmlspecialchars($_REQUEST['search_str']);
// For "as regular expression" (search option 4), we should not treat
// this as an expression that contains a LIKE (second parameter of
// PMA_sqlAddslashes()).
// PMA_sqlAddSlashes()).
//
// Usage example: If user is seaching for a literal $ in a regexp search,
// he should enter \$ as the value.
$search_str = PMA_sqlAddslashes($_REQUEST['search_str'], ($search_option == 4 ? false : true));
$search_str = PMA_sqlAddSlashes($_REQUEST['search_str'], ($search_option == 4 ? false : true));
}

$tables_selected = array();
Expand All @@ -108,7 +84,7 @@
if (empty($_REQUEST['field_str']) || ! is_string($_REQUEST['field_str'])) {
unset($field_str);
} else {
$field_str = PMA_sqlAddslashes($_REQUEST['field_str'], true);
$field_str = PMA_sqlAddSlashes($_REQUEST['field_str'], true);
}

/**
Expand All @@ -130,7 +106,6 @@
* Builds the SQL search query
*
* @todo can we make use of fulltextsearch IN BOOLEAN MODE for this?
* @uses PMA_DBI_query
* PMA_backquote
* PMA_DBI_free_result
* PMA_DBI_fetch_assoc
Expand Down
4 changes: 2 additions & 2 deletions db_tracking.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
$all_tables_query = ' SELECT table_name, MAX(version) as version FROM ' .
PMA_backquote($GLOBALS['cfg']['Server']['pmadb']) . '.' .
PMA_backquote($GLOBALS['cfg']['Server']['tracking']) .
' WHERE ' . PMA_backquote('db_name') . ' = \'' . PMA_sqlAddslashes($_REQUEST['db']) . '\' ' .
' WHERE ' . PMA_backquote('db_name') . ' = \'' . PMA_sqlAddSlashes($_REQUEST['db']) . '\' ' .
' GROUP BY '. PMA_backquote('table_name') .
' ORDER BY '. PMA_backquote('table_name') .' ASC';

Expand Down Expand Up @@ -110,7 +110,7 @@
$table_query = ' SELECT * FROM ' .
PMA_backquote($GLOBALS['cfg']['Server']['pmadb']) . '.' .
PMA_backquote($GLOBALS['cfg']['Server']['tracking']) .
' WHERE `db_name` = \'' . PMA_sqlAddslashes($_REQUEST['db']) . '\' AND `table_name` = \'' . PMA_sqlAddslashes($table_name) . '\' AND `version` = \'' . $version_number . '\'';
' WHERE `db_name` = \'' . PMA_sqlAddSlashes($_REQUEST['db']) . '\' AND `table_name` = \'' . PMA_sqlAddSlashes($table_name) . '\' AND `version` = \'' . $version_number . '\'';

$table_result = PMA_query_as_controluser($table_query);
$version_data = PMA_DBI_fetch_array($table_result);
Expand Down
3 changes: 1 addition & 2 deletions import.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
/**
* Core script for import, this is just the glue around all other stuff
*
* @uses PMA_Bookmark_getList()
* @package phpMyAdmin
*/

Expand Down Expand Up @@ -154,7 +153,7 @@
case 0: // bookmarked query that have to be run
$import_text = PMA_Bookmark_get($db, $id_bookmark, 'id', isset($action_bookmark_all));
if (isset($bookmark_variable) && !empty($bookmark_variable)) {
$import_text = preg_replace('|/\*(.*)\[VARIABLE\](.*)\*/|imsU', '${1}' . PMA_sqlAddslashes($bookmark_variable) . '${2}', $import_text);
$import_text = preg_replace('|/\*(.*)\[VARIABLE\](.*)\*/|imsU', '${1}' . PMA_sqlAddSlashes($bookmark_variable) . '${2}', $import_text);
}

// refresh left frame on changes in table or db structure
Expand Down
19 changes: 0 additions & 19 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,7 @@
/**
* forms frameset
*
* @uses $GLOBALS['cfg']['QueryHistoryDB']
* @uses $GLOBALS['cfg']['Server']['user']
* @uses $GLOBALS['cfg']['DefaultTabServer'] as src for the mainframe
* @uses $GLOBALS['cfg']['DefaultTabDatabase'] as src for the mainframe
* @uses $GLOBALS['cfg']['NaviWidth'] for navi frame width
* @uses $GLOBALS['collation_connection'] from $_REQUEST (grab_globals.lib.php)
* or common.inc.php
* @uses $GLOBALS['available_languages'] from common.inc.php (select_lang.lib.php)
* @uses $GLOBALS['db']
* @uses $GLOBALS['lang']
* @uses $GLOBALS['text_dir']
* @uses $_ENV['HTTP_HOST']
* @uses PMA_getRelationsParam()
* @uses PMA_purgeHistory()
* @uses PMA_generate_common_url()
* @uses PMA_VERSION
* @uses session_write_close()
* @uses time()
* @uses PMA_getenv()
* @uses header() to send charset
* @package phpMyAdmin
*/

Expand Down
7 changes: 5 additions & 2 deletions js/functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -2013,6 +2013,10 @@ $(document).ready(function() {
* Hides certain table structure actions, replacing them with the word "More". They are displayed
* in a dropdown menu when the user hovers over the word "More."
*/
displayMoreTableOpts();
});

function displayMoreTableOpts() {
// Remove the actions from the table cells (they are available by default for JavaScript-disabled browsers)
// if the table is not a view or information_schema (otherwise there is only one action to hide and there's no point)
if($("input[type='hidden'][name='table_type']").val() == "table") {
Expand Down Expand Up @@ -2081,8 +2085,7 @@ $(document).ready(function() {
}
});
}
});

}
$(document).ready(initTooltips);

/* Displays tooltips */
Expand Down
7 changes: 7 additions & 0 deletions js/sql.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,13 @@ $(document).ready(function() {
cache: 'false'
});

/* Hides the bookmarkoptions checkboxes when the bookmark label is empty */
$('input#bkm_label').keyup(function() {
$('input#id_bkm_all_users, input#id_bkm_replace')
.parent()
.toggle($(this).attr('value').length > 0);
}).trigger('keyup');

/**
* current value of the direction in which the table is displayed
* @type String
Expand Down
106 changes: 105 additions & 1 deletion js/tbl_structure.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,5 +145,109 @@ $(document).ready(function() {
}) // end $.get()
}) // end $.PMA_confirm()
}) //end Drop Primary Key/Index


/**
*Ajax event handler for muti column change
**/
$("#fieldsForm.ajax .mult_submit[value=change]").live('click', function(event){
event.preventDefault();

/*Check whether atleast one row is selected for change*/
if($("#tablestructure tbody tr").hasClass("marked")){
var div = $('<div id="change_column_dialog"></div>');

/**
* @var button_options Object that stores the options passed to jQueryUI
* dialog
*/
var button_options = {};
// in the following function we need to use $(this)
button_options[PMA_messages['strCancel']] = function() {$(this).parent().dialog('close').remove();}

var button_options_error = {};
button_options_error[PMA_messages['strOK']] = function() {$(this).parent().dialog('close').remove();}
var $form = $("#fieldsForm");
var $msgbox = PMA_ajaxShowMessage();

$.get( $form.attr('action') , $form.serialize()+"&ajax_request=true&submit_mult=change" , function(data) {
//in the case of an error, show the error message returned.
if (data.success != undefined && data.success == false) {
div
.append(data.error)
.dialog({
title: PMA_messages['strChangeTbl'],
height: 230,
width: 900,
open: PMA_verifyTypeOfAllColumns,
buttons : button_options_error
})// end dialog options
} else {
div
.append(data)
.dialog({
title: PMA_messages['strChangeTbl'],
height: 600,
width: 900,
open: PMA_verifyTypeOfAllColumns,
buttons : button_options
})
//Remove the top menu container from the dialog
.find("#topmenucontainer").hide()
; // end dialog options
$("#append_fields_form input[name=do_save_data]").addClass("ajax");
}
PMA_ajaxRemoveMessage($msgbox);
}) // end $.get()
} else {
PMA_ajaxShowMessage(PMA_messages['strNoRowSelected']);
}
});

/**
*Ajax action for submitting the column change form
**/
$("#append_fields_form input[name=do_save_data].ajax").live('click', function(event) {
event.preventDefault();
/**
* @var the_form object referring to the export form
*/
var $form = $("#append_fields_form");

PMA_prepareForAjaxRequest($form);
//User wants to submit the form
$.post($form.attr('action'), $form.serialize()+"&do_save_data=Save", function(data) {
if ($("#sqlqueryresults").length != 0) {
$("#sqlqueryresults").remove();
} else if ($(".error").length != 0) {
$(".error").remove();
}
if (data.success == true) {
PMA_ajaxShowMessage(data.message);
$("<div id='sqlqueryresults'></div>").insertAfter("#topmenucontainer");
$("#sqlqueryresults").html(data.sql_query);
$("#result_query .notice").remove();
$("#result_query").prepend((data.message));
if ($("#change_column_dialog").length > 0) {
$("#change_column_dialog").dialog("close").remove();
}
/*Reload the field form*/
$.post($("#fieldsForm").attr('action'), $("#fieldsForm").serialize()+"&ajax_request=true", function(form_data) {
$("#fieldsForm").remove();
var $temp_div = $("<div id='temp_div'><div>").append(form_data);
if ($("#sqlqueryresults").length != 0) {
$temp_div.find("#fieldsForm").insertAfter("#sqlqueryresults");
} else {
$temp_div.find("#fieldsForm").insertAfter(".error");
}
/*Call the function to display the more options in table*/
displayMoreTableOpts();
});
} else {
var $temp_div = $("<div id='temp_div'><div>").append(data);
var $error = $temp_div.find(".error code").addClass("error");
PMA_ajaxShowMessage($error);
}
}) // end $.post()
}) // end insert table button "do_save_data"

}) // end $(document).ready()
Loading

0 comments on commit 3bde595

Please sign in to comment.