From aaf9f775c41b3c7f71537214cfc0f4bd6e42d991 Mon Sep 17 00:00:00 2001 From: Madhura Jayaratne Date: Sat, 28 Jul 2012 12:04:37 +0530 Subject: [PATCH 01/10] White space cleanup --- libraries/relation.lib.php | 40 +++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/libraries/relation.lib.php b/libraries/relation.lib.php index 4781511f47..43433bc9ca 100644 --- a/libraries/relation.lib.php +++ b/libraries/relation.lib.php @@ -79,7 +79,7 @@ function PMA_getRelationsParam() */ function PMA_getRelationsParamDiagnostic($cfgRelation) { - + $common_functions = PMA_CommonFunctions::getInstance(); $retval = ''; @@ -497,7 +497,7 @@ function PMA__getRelationsParam() */ function PMA_getForeigners($db, $table, $column = '', $source = 'both') { - + $common_functions = PMA_CommonFunctions::getInstance(); $cfgRelation = PMA_getRelationsParam(); $foreign = array(); @@ -520,7 +520,7 @@ function PMA_getForeigners($db, $table, $column = '', $source = 'both') if (($source == 'both' || $source == 'foreign') && strlen($table) && isset($analyzed_sql[0]['foreign_keys']) ) { - + $show_create_table_query = 'SHOW CREATE TABLE ' . $common_functions->backquote($db) . '.' . $common_functions->backquote($table); $show_create_table = PMA_DBI_fetch_value($show_create_table_query, 0, 1); @@ -605,7 +605,7 @@ function PMA_getForeigners($db, $table, $column = '', $source = 'both') */ function PMA_getDisplayField($db, $table) { - + $common_functions = PMA_CommonFunctions::getInstance(); $cfgRelation = PMA_getRelationsParam(); @@ -686,7 +686,7 @@ function PMA_getComments($db, $table = '') */ function PMA_getDbComment($db) { - + $common_functions = PMA_CommonFunctions::getInstance(); $cfgRelation = PMA_getRelationsParam(); $comment = ''; @@ -720,7 +720,7 @@ function PMA_getDbComment($db) */ function PMA_getDbComments() { - + $common_functions = PMA_CommonFunctions::getInstance(); $cfgRelation = PMA_getRelationsParam(); $comments = array(); @@ -756,7 +756,7 @@ function PMA_getDbComments() */ function PMA_setDbComment($db, $comment = '') { - + $common_functions = PMA_CommonFunctions::getInstance(); $cfgRelation = PMA_getRelationsParam(); @@ -806,9 +806,9 @@ function PMA_setDbComment($db, $comment = '') */ function PMA_setHistory($db, $table, $username, $sqlquery) { - + $common_functions = PMA_CommonFunctions::getInstance(); - + if (strlen($sqlquery) > $GLOBALS['cfg']['MaxCharactersInDisplayedSQL']) { return; } @@ -868,7 +868,7 @@ function PMA_setHistory($db, $table, $username, $sqlquery) */ function PMA_getHistory($username) { - + $common_functions = PMA_CommonFunctions::getInstance(); $cfgRelation = PMA_getRelationsParam(); @@ -901,7 +901,7 @@ function PMA_getHistory($username) */ function PMA_purgeHistory($username) { - + $common_functions = PMA_CommonFunctions::getInstance(); $cfgRelation = PMA_getRelationsParam(); if (! $GLOBALS['cfg']['QueryHistoryDB'] || ! $cfgRelation['historywork']) { @@ -1089,9 +1089,9 @@ function PMA_foreignDropdown($disp_row, $foreign_field, $foreign_display, $data, function PMA_getForeignData($foreigners, $field, $override_total, $foreign_filter, $foreign_limit) { - + $common_functions = PMA_CommonFunctions::getInstance(); - + // we always show the foreign field in the drop-down; if a display // field is defined, we show it besides the foreign field $foreign_link = false; @@ -1189,7 +1189,7 @@ function PMA_getRelatives($all_tables, $master) } else { $from = 'foreign'; $to = 'master'; - } + } $in_know = '(\'' . implode('\', \'', $known_tables) . '\')'; $in_left = '(\'' . implode('\', \'', $remaining_tables) . '\')'; $rel_query = 'SELECT *' @@ -1240,7 +1240,7 @@ function PMA_getRelatives($all_tables, $master) */ function PMA_REL_renameField($db, $table, $field, $new_name) { - + $common_functions = PMA_CommonFunctions::getInstance(); $cfgRelation = PMA_getRelationsParam(); @@ -1296,9 +1296,9 @@ function PMA_REL_renameSingleTable($table, $source_table, $target_table, $db_field, $table_field ) { - + $common_functions = PMA_CommonFunctions::getInstance(); - + $query = 'UPDATE ' . $common_functions->backquote($GLOBALS['cfgRelation']['db']) . '.' . $common_functions->backquote($GLOBALS['cfgRelation'][$table]) @@ -1401,9 +1401,9 @@ function PMA_REL_renameTable($source_db, $target_db, $source_table, $target_tabl */ function PMA_REL_createPage($newpage, $cfgRelation, $db) { - + $common_functions = PMA_CommonFunctions::getInstance(); - + if (! isset($newpage) || $newpage == '') { $newpage = __('no description'); } @@ -1415,7 +1415,7 @@ function PMA_REL_createPage($newpage, $cfgRelation, $db) . $common_functions->sqlAddSlashes($db) . '\', \'' . $common_functions->sqlAddSlashes($newpage) . '\')'; PMA_queryAsControlUser($ins_query, false); - + return PMA_DBI_insert_id( isset($GLOBALS['controllink']) ? $GLOBALS['controllink'] : '' ); From 18da661f604444260801a44506db93ff536dc0a1 Mon Sep 17 00:00:00 2001 From: Madhura Jayaratne Date: Sat, 28 Jul 2012 12:05:58 +0530 Subject: [PATCH 02/10] Reverting 4465c287c. $analyzed_sql is not defined at this point --- libraries/relation.lib.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/libraries/relation.lib.php b/libraries/relation.lib.php index 43433bc9ca..1fd2eae399 100644 --- a/libraries/relation.lib.php +++ b/libraries/relation.lib.php @@ -517,9 +517,7 @@ function PMA_getForeigners($db, $table, $column = '', $source = 'both') $foreign = PMA_DBI_fetch_result($rel_query, 'master_field', null, $GLOBALS['controllink']); } - if (($source == 'both' || $source == 'foreign') && strlen($table) - && isset($analyzed_sql[0]['foreign_keys']) - ) { + if (($source == 'both' || $source == 'foreign') && strlen($table)) { $show_create_table_query = 'SHOW CREATE TABLE ' . $common_functions->backquote($db) . '.' . $common_functions->backquote($table); From b92d7151a14410699078fbe2705bf81511115dce Mon Sep 17 00:00:00 2001 From: Madhura Jayaratne Date: Sat, 28 Jul 2012 15:23:28 +0530 Subject: [PATCH 03/10] White space cleanup --- libraries/DisplayResults.class.php | 64 +++++++++++++++--------------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/libraries/DisplayResults.class.php b/libraries/DisplayResults.class.php index b28786e615..617ce597b9 100644 --- a/libraries/DisplayResults.class.php +++ b/libraries/DisplayResults.class.php @@ -71,82 +71,82 @@ class PMA_DisplayResults // Declare global fields /** PMA_CommonFunctions object */ private $_common_functions; - + /** array with properties of the class */ private $_property_array = array( - + /** string Database name */ '_db' => null, - + /** string Table name */ '_table' => null, - + /** string the URL to go back in case of errors */ '_goto' => null, - + /** string the SQL query */ '_sql_query' => null, - + /** * integer the total number of rows returned by the SQL query without any * appended "LIMIT" clause programmatically */ '_unlim_num_rows' => null, - + /** array meta information about fields */ '_fields_meta' => null, - + /** boolean */ '_is_count' => null, - + /** integer */ '_is_export' => null, - + /** boolean */ '_is_func' => null, - + /** integer */ '_is_analyse' => null, - + /** integer the total number of rows returned by the SQL query */ '_num_rows' => null, - + /** integer the total number of fields returned by the SQL query */ '_fields_cnt' => null, - + /** double time taken for execute the SQL query */ '_querytime' => null, - + /** string path for theme images directory */ '_pma_theme_image' => null, - + /** string */ '_text_dir' => null, - + /** boolean */ '_is_maint' => null, - + /** boolean */ '_is_explain' => null, - + /** boolean */ '_is_show' => null, - + /** array table definitions */ '_showtable' => null, - + /** string */ '_printview' => null, - + /** string URL query */ '_url_query' => null, - + /** array column names to highlight */ '_highlight_columns' => null, - + /** array informations used with vertical display mode */ '_vertical_display' => null, - + /** array mime types information of fields */ '_mime_map' => null ); @@ -176,7 +176,7 @@ class PMA_DisplayResults * @return void */ public function __set($property, $value) - { + { if(array_key_exists($property, $this->_property_array)) { $this->_property_array[$property] = $value; } @@ -266,7 +266,7 @@ class PMA_DisplayResults $this->__set('_showtable', $showtable); $this->__set('_printview', $printview); $this->__set('_url_query', $url_query); - + } // end of the 'setProperties()' function @@ -338,7 +338,7 @@ class PMA_DisplayResults $do_display['bkm_form'] = (string) '0'; $do_display['text_btn'] = (string) '0'; $do_display['pview_lnk'] = (string) '0'; - + } elseif ($this->__get('_is_count') || $this->__get('_is_analyse') || $this->__get('_is_maint') || $this->__get('_is_explain') ) { @@ -351,7 +351,7 @@ class PMA_DisplayResults $do_display['nav_bar'] = (string) '0'; $do_display['ins_row'] = (string) '0'; $do_display['bkm_form'] = (string) '1'; - + if ($this->__get('_is_maint')) { $do_display['text_btn'] = (string) '1'; } else { @@ -488,7 +488,7 @@ class PMA_DisplayResults if (!isset($analyzed_sql[0]['select_expr'])) { $analyzed_sql[0]['select_expr'] = 0; } - + return ! ($this->__get('_is_count') || $this->__get('_is_export') || $this->__get('_is_func') || $this->__get('_is_analyse')) && (count($analyzed_sql[0]['select_expr']) == 0) @@ -2453,7 +2453,7 @@ class PMA_DisplayResults $vertical_display['data'] = array(); $vertical_display['row_delete'] = array(); $this->__set('_vertical_display', $vertical_display); - + // name of the class added to all grid editable elements $grid_edit_class = $is_limited_display ? '' : 'grid_edit'; @@ -4256,7 +4256,7 @@ class PMA_DisplayResults public function getTable( &$dt_result, &$the_disp_mode, $analyzed_sql, $is_limited_display = false ) { - + $table_html = ''; // Following variable are needed for use in isset/empty or // use with array indexes/safe use in foreach From d8c334ee29364c88aa7b71e92ef29aac50210532 Mon Sep 17 00:00:00 2001 From: Madhura Jayaratne Date: Sat, 28 Jul 2012 15:29:22 +0530 Subject: [PATCH 04/10] Grid editing of binary columns should adhere to cfg['ProtectBinary'] directive --- libraries/DisplayResults.class.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/libraries/DisplayResults.class.php b/libraries/DisplayResults.class.php index 617ce597b9..aa27388f7d 100644 --- a/libraries/DisplayResults.class.php +++ b/libraries/DisplayResults.class.php @@ -3650,6 +3650,12 @@ class PMA_DisplayResults ) { $is_analyse = $this->__get('_is_analyse'); + $field_flags = PMA_DBI_field_flags($dt_result, $col_index); + if (stristr($field_flags, self::BINARY_FIELD) + && $GLOBALS['cfg']['ProtectBinary'] === 'all' + ) { + $class = str_replace('grid_edit', '', $class); + } if (! isset($column) || is_null($column)) { @@ -3669,10 +3675,7 @@ class PMA_DisplayResults $is_field_truncated = true; } - // displays special characters from binaries - $field_flags = PMA_DBI_field_flags($dt_result, $col_index); $formatted = false; - if (isset($meta->_type) && $meta->_type === MYSQLI_TYPE_BIT) { $column = $this->getCommonFunctions()->printableBitValue( From a143b74067d215f51b11c321038028f91dd3ab1f Mon Sep 17 00:00:00 2001 From: Madhura Jayaratne Date: Sat, 28 Jul 2012 17:10:44 +0530 Subject: [PATCH 05/10] bug #3549084 [edit] Can't enter date directly when editing inline --- ChangeLog | 1 + js/makegrid.js | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/ChangeLog b/ChangeLog index ce2004c8b3..d68b0a55eb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -7,6 +7,7 @@ phpMyAdmin - ChangeLog - bug #3527531 [interface] GC-maxlifetime warning incorrectly displayed - bug #3526916 [interface] Search fails with JS error when tooltips disabled - bug #3544366 [interface] Event comments not saved +- bug #3549084 [edit] Can't enter date directly when editing inline 3.5.2.0 (2012-07-07) - bug #3521416 [interface] JS error when editing index diff --git a/js/makegrid.js b/js/makegrid.js index e13ec7eece..a1decc4fd6 100644 --- a/js/makegrid.js +++ b/js/makegrid.js @@ -976,6 +976,12 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi $input_field.val(''); } $editArea.append('
' + g.cellEditHint + '
'); + + // remove {cursor: 'pointer'} added inside timepicker.js + $input_field.css('cursor', ''); + // make the cell editable, so one can can bypass the timepicker + // and enter date/time value manually + g.isEditCellTextEditable = true; } else { g.isEditCellTextEditable = true; // only append edit area hint if there is a null checkbox From ad1bc257e4f3d71925c53d7338fec5a7ce05efb9 Mon Sep 17 00:00:00 2001 From: Madhura Jayaratne Date: Sat, 28 Jul 2012 17:29:52 +0530 Subject: [PATCH 06/10] bug #3548491 [interface] Inline query editor doesn't work from search results --- ChangeLog | 1 + tbl_select.php | 2 ++ 2 files changed, 3 insertions(+) diff --git a/ChangeLog b/ChangeLog index d68b0a55eb..b5980c89a6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -8,6 +8,7 @@ phpMyAdmin - ChangeLog - bug #3526916 [interface] Search fails with JS error when tooltips disabled - bug #3544366 [interface] Event comments not saved - bug #3549084 [edit] Can't enter date directly when editing inline +- bug #3548491 [interface] Inline query editor doesn't work from search results 3.5.2.0 (2012-07-07) - bug #3521416 [interface] JS error when editing index diff --git a/tbl_select.php b/tbl_select.php index c888291441..81ca73403a 100644 --- a/tbl_select.php +++ b/tbl_select.php @@ -24,6 +24,8 @@ $GLOBALS['js_include'][] = 'tbl_change.js'; $GLOBALS['js_include'][] = 'jquery/jquery-ui-1.8.16.custom.js'; $GLOBALS['js_include'][] = 'jquery/timepicker.js'; $GLOBALS['js_include'][] = 'gis_data_editor.js'; +$GLOBALS['js_include'][] = 'codemirror/lib/codemirror.js'; +$GLOBALS['js_include'][] = 'codemirror/mode/mysql/mysql.js'; $titles['Browse'] = PMA_getIcon('b_browse.png', __('Browse foreign values')); From 191cf52cd00a47ee663bd170c25a570c025f2764 Mon Sep 17 00:00:00 2001 From: Madhura Jayaratne Date: Sat, 28 Jul 2012 19:15:39 +0530 Subject: [PATCH 07/10] bug #3547825 [edit] BLOB download no longer works --- ChangeLog | 1 + js/makegrid.js | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index b5980c89a6..49425144f7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -9,6 +9,7 @@ phpMyAdmin - ChangeLog - bug #3544366 [interface] Event comments not saved - bug #3549084 [edit] Can't enter date directly when editing inline - bug #3548491 [interface] Inline query editor doesn't work from search results +- bug #3547825 [edit] BLOB download no longer works 3.5.2.0 (2012-07-07) - bug #3521416 [interface] JS error when editing index diff --git a/js/makegrid.js b/js/makegrid.js index a1decc4fd6..6355305aa1 100644 --- a/js/makegrid.js +++ b/js/makegrid.js @@ -1588,7 +1588,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi e.stopPropagation(); } // prevent default action when clicking on "link" in a table - if ($(e.target).is('a')) { + if ($(e.target).is('.grid_edit a')) { e.preventDefault(); } }); From 6fb2f8c37d4615136087d20f137eca5aa1dc57e5 Mon Sep 17 00:00:00 2001 From: Madhura Jayaratne Date: Sat, 28 Jul 2012 20:20:57 +0530 Subject: [PATCH 08/10] bug #3543661 [interface] "Check All" checkbox does not check all --- libraries/DisplayResults.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/DisplayResults.class.php b/libraries/DisplayResults.class.php index aa27388f7d..0045bfb7a9 100644 --- a/libraries/DisplayResults.class.php +++ b/libraries/DisplayResults.class.php @@ -5491,7 +5491,7 @@ class PMA_DisplayResults . ' Date: Sun, 29 Jul 2012 08:05:04 +0530 Subject: [PATCH 09/10] bug #3541966 [config] Error in generated configuration array --- ChangeLog | 1 + setup/lib/ConfigGenerator.class.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 49425144f7..237060b1a0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -10,6 +10,7 @@ phpMyAdmin - ChangeLog - bug #3549084 [edit] Can't enter date directly when editing inline - bug #3548491 [interface] Inline query editor doesn't work from search results - bug #3547825 [edit] BLOB download no longer works +- bug #3541966 [config] Error in generated configuration arrray 3.5.2.0 (2012-07-07) - bug #3521416 [interface] JS error when editing index diff --git a/setup/lib/ConfigGenerator.class.php b/setup/lib/ConfigGenerator.class.php index b4b49fe219..8a11d2bf3d 100644 --- a/setup/lib/ConfigGenerator.class.php +++ b/setup/lib/ConfigGenerator.class.php @@ -141,7 +141,7 @@ class ConfigGenerator // more than 4 values - value per line $imax = count($retv)-1; for ($i = 0; $i <= $imax; $i++) { - $ret .= ($i < $imax ? ($i > 0 ? ',' : '') : '') . $crlf . ' ' . $retv[$i]; + $ret .= ($i > 0 ? ',' : '') . $crlf . ' ' . $retv[$i]; } } $ret .= ')'; From 72cdb4d05861ef90c1201c10b9590c29cb01db29 Mon Sep 17 00:00:00 2001 From: Madhura Jayaratne Date: Sun, 29 Jul 2012 08:10:25 +0530 Subject: [PATCH 10/10] Simplify the logic a bit --- setup/lib/ConfigGenerator.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup/lib/ConfigGenerator.class.php b/setup/lib/ConfigGenerator.class.php index 373c10727e..8dc359bb7c 100644 --- a/setup/lib/ConfigGenerator.class.php +++ b/setup/lib/ConfigGenerator.class.php @@ -142,8 +142,8 @@ class ConfigGenerator $ret .= implode(', ', $retv); } else { // more than 4 values - value per line - $imax = count($retv)-1; - for ($i = 0; $i <= $imax; $i++) { + $imax = count($retv); + for ($i = 0; $i < $imax; $i++) { $ret .= ($i > 0 ? ',' : '') . $crlf . ' ' . $retv[$i]; } }