From ba7a49e81c38a0d403553190a116c9fc5804013a Mon Sep 17 00:00:00 2001 From: Rouslan Placella Date: Thu, 2 Aug 2012 18:57:24 +0200 Subject: [PATCH 01/10] Fixed order of tabs in the top menu for empty databases --- libraries/Menu.class.php | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/libraries/Menu.class.php b/libraries/Menu.class.php index adbc5081fa..6c694bc256 100644 --- a/libraries/Menu.class.php +++ b/libraries/Menu.class.php @@ -36,13 +36,13 @@ class PMA_Menu * @access private * @var string */ - private $_table; - + private $_table; + private $_common_functions; - + /** * Get CommmonFunctions - * + * * @return CommonFunctions object */ public function getCommonFunctions() @@ -351,15 +351,6 @@ class PMA_Menu $tabs = array(); - /** - * export, search and qbe links if there is at least one table - */ - if ($num_tables == 0) { - $tabs['qbe']['warning'] = __('Database seems to be empty!'); - $tabs['search']['warning'] = __('Database seems to be empty!'); - $tabs['export']['warning'] = __('Database seems to be empty!'); - } - $tabs['structure']['link'] = 'db_structure.php'; $tabs['structure']['text'] = __('Structure'); $tabs['structure']['icon'] = 'b_props.png'; @@ -372,14 +363,23 @@ class PMA_Menu $tabs['search']['text'] = __('Search'); $tabs['search']['icon'] = 'b_search.png'; $tabs['search']['link'] = 'db_search.php'; + if ($num_tables == 0) { + $tabs['search']['warning'] = __('Database seems to be empty!'); + } $tabs['qbe']['text'] = __('Query'); $tabs['qbe']['icon'] = 's_db.png'; $tabs['qbe']['link'] = 'db_qbe.php'; + if ($num_tables == 0) { + $tabs['qbe']['warning'] = __('Database seems to be empty!'); + } $tabs['export']['text'] = __('Export'); $tabs['export']['icon'] = 'b_export.png'; $tabs['export']['link'] = 'db_export.php'; + if ($num_tables == 0) { + $tabs['export']['warning'] = __('Database seems to be empty!'); + } if (! $db_is_information_schema) { $tabs['import']['link'] = 'db_import.php'; From 2428a6f4c2082395c2c7605b0fdb0373dd3a39cc Mon Sep 17 00:00:00 2001 From: Rouslan Placella Date: Thu, 2 Aug 2012 19:02:14 +0200 Subject: [PATCH 02/10] Dropped pointless lazy getter (if the menu is instanciated, we'll have to get a reference to the common functions anyway) --- libraries/Menu.class.php | 32 +++++++++++--------------------- 1 file changed, 11 insertions(+), 21 deletions(-) diff --git a/libraries/Menu.class.php b/libraries/Menu.class.php index 6c694bc256..1a1160cee9 100644 --- a/libraries/Menu.class.php +++ b/libraries/Menu.class.php @@ -37,21 +37,10 @@ class PMA_Menu * @var string */ private $_table; - - private $_common_functions; - /** - * Get CommmonFunctions - * - * @return CommonFunctions object + * @var object A reference to the common functions object */ - public function getCommonFunctions() - { - if (is_null($this->_common_functions)) { - $this->_common_functions = PMA_CommonFunctions::getInstance(); - } - return $this->_common_functions; - } + private $_commonFunctions; /** * Creates a new instance of PMA_Menu @@ -67,6 +56,7 @@ class PMA_Menu $this->_server = $server; $this->_db = $db; $this->_table = $table; + $this->_commonFunctions = PMA_commonFunctions::getInstance(); } /** @@ -92,7 +82,7 @@ class PMA_Menu if (isset($GLOBALS['buffer_message'])) { $buffer_message = $GLOBALS['buffer_message']; } - $retval .= $this->getCommonFunctions()->getMessage($GLOBALS['message']); + $retval .= $this->_commonFunctions->getMessage($GLOBALS['message']); unset($GLOBALS['message']); if (isset($buffer_message)) { $GLOBALS['buffer_message'] = $buffer_message; @@ -118,7 +108,7 @@ class PMA_Menu } else { $tabs = $this->_getServerTabs(); } - return $this->getCommonFunctions()->getHtmlTabs($tabs, $url_params); + return $this->_commonFunctions->getHtmlTabs($tabs, $url_params); } /** @@ -147,7 +137,7 @@ class PMA_Menu $retval .= "
"; $retval .= "
"; if ($GLOBALS['cfg']['NavigationBarIconic']) { - $retval .= $this->getCommonFunctions()->getImage( + $retval .= $this->_commonFunctions->getImage( 's_host.png', '', array('class' => 'item') @@ -164,7 +154,7 @@ class PMA_Menu if (strlen($this->_db)) { $retval .= $separator; if ($GLOBALS['cfg']['NavigationBarIconic']) { - $retval .= $this->getCommonFunctions()->getImage( + $retval .= $this->_commonFunctions->getImage( 's_db.png', '', array('class' => 'item') @@ -187,7 +177,7 @@ class PMA_Menu $retval .= $separator; if ($GLOBALS['cfg']['NavigationBarIconic']) { $icon = $tbl_is_view ? 'b_views.png' : 's_tbl.png'; - $retval .= $this->getCommonFunctions()->getImage( + $retval .= $this->_commonFunctions->getImage( $icon, '', array('class' => 'item') @@ -309,7 +299,7 @@ class PMA_Menu } if (! $db_is_information_schema && ! PMA_DRIZZLE - && $this->getCommonFunctions()->currentUserHasPrivilege('TRIGGER', $this->_db, $this->_table) + && $this->_commonFunctions->currentUserHasPrivilege('TRIGGER', $this->_db, $this->_table) && ! $tbl_is_view ) { $tabs['triggers']['link'] = 'tbl_triggers.php'; @@ -405,14 +395,14 @@ class PMA_Menu } if (PMA_MYSQL_INT_VERSION >= 50106 && ! PMA_DRIZZLE - && $this->getCommonFunctions()->currentUserHasPrivilege('EVENT', $this->_db) + && $this->_commonFunctions->currentUserHasPrivilege('EVENT', $this->_db) ) { $tabs['events']['link'] = 'db_events.php'; $tabs['events']['text'] = __('Events'); $tabs['events']['icon'] = 'b_events.png'; } if (! PMA_DRIZZLE - && $this->getCommonFunctions()->currentUserHasPrivilege('TRIGGER', $this->_db) + && $this->_commonFunctions->currentUserHasPrivilege('TRIGGER', $this->_db) ) { $tabs['triggers']['link'] = 'db_triggers.php'; $tabs['triggers']['text'] = __('Triggers'); From f544ba3f6f7e12b59a040109d8e6103f5d58c88e Mon Sep 17 00:00:00 2001 From: Marc Delisle Date: Thu, 2 Aug 2012 14:11:22 -0400 Subject: [PATCH 03/10] Fix undefined index problem --- libraries/Table.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/Table.class.php b/libraries/Table.class.php index c646f28eca..49ce1d658f 100644 --- a/libraries/Table.class.php +++ b/libraries/Table.class.php @@ -320,7 +320,7 @@ class PMA_Table $force_read = false, $disable_error = false ) { - if ($_SESSION['is_multi_query']) { + if (isset($_SESSION['is_multi_query']) && $_SESSION['is_multi_query']) { $disable_error = true; } From d9d92dda4670da467c718d6307031894ac9a4ca9 Mon Sep 17 00:00:00 2001 From: Chanaka Indrajith Date: Fri, 3 Aug 2012 00:35:09 +0530 Subject: [PATCH 04/10] Image link display transformed data in sql query results --- libraries/CommonFunctions.class.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/libraries/CommonFunctions.class.php b/libraries/CommonFunctions.class.php index de5a172d42..6ffa509590 100644 --- a/libraries/CommonFunctions.class.php +++ b/libraries/CommonFunctions.class.php @@ -2302,7 +2302,9 @@ class PMA_CommonFunctions $con_key = $this->backquote($meta->table) . '.' . $this->backquote($meta->orgname); } // end if... else... - $condition = ' ' . $con_key . ' '; + $condition = ($fields_cnt == 1) + ? ' CHAR_LENGTH(' . $con_key . ') ' + : ' ' . $con_key . ' '; if (! isset($row[$i]) || is_null($row[$i])) { $con_val = 'IS NULL'; @@ -2330,7 +2332,9 @@ class PMA_CommonFunctions $con_val = '= CAST(0x' . bin2hex($row[$i]) . ' AS BINARY)'; } else { // this blob won't be part of the final condition - $con_val = null; + $con_val = ($fields_cnt == 1) + ? ' = '. strlen($row[$i]) + : null; } } elseif (in_array($meta->type, $this->getGISDatatypes()) From ef65ca306a4c5cf780affbd0c8676c8b1637c3d6 Mon Sep 17 00:00:00 2001 From: Rouslan Placella Date: Thu, 2 Aug 2012 21:25:54 +0200 Subject: [PATCH 05/10] Neater test for potentially undefined variable and some whitespace cleanup --- libraries/Table.class.php | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/libraries/Table.class.php b/libraries/Table.class.php index 49ce1d658f..e504746fd5 100644 --- a/libraries/Table.class.php +++ b/libraries/Table.class.php @@ -65,12 +65,12 @@ class PMA_Table * @var array messages */ var $messages = array(); - + private $_common_functions; - + /** * Get CommmonFunctions - * + * * @return CommonFunctions object */ public function getCommonFunctions() @@ -201,9 +201,9 @@ class PMA_Table */ static public function isView($db = null, $table = null) { - + $common_functions = PMA_CommonFunctions::getInstance(); - + if (empty($db) || empty($table)) { return false; } @@ -319,11 +319,11 @@ class PMA_Table static public function sGetStatusInfo($db, $table, $info = null, $force_read = false, $disable_error = false ) { - - if (isset($_SESSION['is_multi_query']) && $_SESSION['is_multi_query']) { + + if (! empty($_SESSION['is_multi_query'])) { $disable_error = true; } - + if (! isset(PMA_Table::$cache[$db][$table]) || $force_read) { PMA_DBI_get_tables_full($db, $table); } @@ -383,7 +383,7 @@ class PMA_Table $default_type = 'USER_DEFINED', $default_value = '', $extra = '', $comment = '', &$field_primary = null, $move_to = '' ) { - + $common_functions = PMA_CommonFunctions::getInstance(); $is_timestamp = strpos(strtoupper($type), 'TIMESTAMP') !== false; @@ -519,9 +519,9 @@ class PMA_Table static public function countRecords($db, $table, $force_exact = false, $is_view = null ) { - + $common_functions = PMA_CommonFunctions::getInstance(); - + if (isset(PMA_Table::$cache[$db][$table]['ExactRows'])) { $row_count = PMA_Table::$cache[$db][$table]['ExactRows']; } else { @@ -649,7 +649,7 @@ class PMA_Table static public function duplicateInfo($work, $pma_table, $get_fields, $where_fields, $new_fields ) { - + $common_functions = PMA_CommonFunctions::getInstance(); $last_id = -1; @@ -732,7 +732,7 @@ class PMA_Table $target_table, $what, $move, $mode ) { global $err_url; - + $common_functions = PMA_CommonFunctions::getInstance(); /* Try moving table directly */ @@ -787,7 +787,7 @@ class PMA_Table // get Export SQL instance $export_sql_plugin = PMA_getPlugin( "export", - "sql", + "sql", 'libraries/plugins/export/', array( 'export_type' => $export_type, From b77acffe43583474ff0dcbc4af178f7435935963 Mon Sep 17 00:00:00 2001 From: "J.M" Date: Thu, 2 Aug 2012 22:02:46 +0200 Subject: [PATCH 06/10] Show error message when trying to change password right after changing password, see bug #3547670 --- js/functions.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/js/functions.js b/js/functions.js index b6195c13bf..94a74bca4d 100644 --- a/js/functions.js +++ b/js/functions.js @@ -2598,6 +2598,13 @@ $(function() { $(this).dialog('close'); }; $.get($(this).attr('href'), {'ajax_request': true}, function(data) { + if (data.error) { + var $temp_div = $("
"); + $temp_div.html(data.error); + var $error = $temp_div.addClass("error"); + PMA_ajaxShowMessage($temp_div, false); + return false; + } $('
') .dialog({ title: PMA_messages['strChangePassword'], From 0c00bc9d7719e126b2b101a4a01438df9ff22739 Mon Sep 17 00:00:00 2001 From: Ashiyane Digital Security Team Date: Fri, 3 Aug 2012 00:13:02 +0200 Subject: [PATCH 07/10] Translated using Weblate. --- po/fa.po | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/po/fa.po b/po/fa.po index 0b787b01a7..31699fc055 100644 --- a/po/fa.po +++ b/po/fa.po @@ -4,15 +4,16 @@ msgstr "" "Project-Id-Version: phpMyAdmin 4.0.0-dev\n" "Report-Msgid-Bugs-To: phpmyadmin-devel@lists.sourceforge.net\n" "POT-Creation-Date: 2012-07-27 10:40+0200\n" -"PO-Revision-Date: 2012-07-22 18:51+0200\n" +"PO-Revision-Date: 2012-08-03 00:13+0200\n" "Last-Translator: Ashiyane Digital Security Team \n" -"Language-Team: persian \n" +"Language-Team: Persian " +"\n" "Language: fa\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" -"X-Generator: Weblate 1.1\n" +"X-Generator: Weblate 1.2\n" #: browse_foreigners.php:36 browse_foreigners.php:60 js/messages.php:354 #: libraries/DisplayResults.class.php:794 @@ -2896,7 +2897,7 @@ msgstr "فایل آپلود شده نبود." #: libraries/File.class.php:273 msgid "The uploaded file exceeds the upload_max_filesize directive in php.ini." -msgstr "" +msgstr "فایل آپلود شده بیش از upload_max_size قرار دستور در فایل php.ini اجرا" #: libraries/File.class.php:276 msgid "" From b0a9418591bbc3d33e11962d052e70b1c4a810a3 Mon Sep 17 00:00:00 2001 From: Rouslan Placella Date: Sun, 17 Jun 2012 21:12:29 +0100 Subject: [PATCH 08/10] Use PMA_Message for all connection errors --- libraries/plugins/auth/AuthenticationCookie.class.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/libraries/plugins/auth/AuthenticationCookie.class.php b/libraries/plugins/auth/AuthenticationCookie.class.php index a4bd88982f..01ca6da1db 100644 --- a/libraries/plugins/auth/AuthenticationCookie.class.php +++ b/libraries/plugins/auth/AuthenticationCookie.class.php @@ -73,7 +73,12 @@ class AuthenticationCookie extends AuthenticationPlugin if ($response->isAjax()) { $response->isSuccess(false); if (! empty($conn_error)) { - $response->addJSON('message', $conn_error); + $response->addJSON( + 'message', + PMA_Message::error( + $conn_error + ) + ); } else { $response->addJSON( 'message', @@ -688,4 +693,4 @@ class AuthenticationCookie extends AuthenticationPlugin public function update (SplSubject $subject) { } -} \ No newline at end of file +} From 5750ab31db4ecf6f7ee0ec59eeac32ff3f0c69ad Mon Sep 17 00:00:00 2001 From: Rouslan Placella Date: Fri, 3 Aug 2012 10:07:47 +0200 Subject: [PATCH 09/10] Don't double-wrap error messages for change password form --- js/functions.js | 63 +++++++++++++++++++++++-------------------------- 1 file changed, 30 insertions(+), 33 deletions(-) diff --git a/js/functions.js b/js/functions.js index 94a74bca4d..e7877e0db2 100644 --- a/js/functions.js +++ b/js/functions.js @@ -2598,40 +2598,37 @@ $(function() { $(this).dialog('close'); }; $.get($(this).attr('href'), {'ajax_request': true}, function(data) { - if (data.error) { - var $temp_div = $("
"); - $temp_div.html(data.error); - var $error = $temp_div.addClass("error"); - PMA_ajaxShowMessage($temp_div, false); - return false; + if (data.success) { + $('
') + .dialog({ + title: PMA_messages['strChangePassword'], + width: 600, + close: function(ev, ui) { + $(this).remove(); + }, + buttons : button_options, + modal: true + }) + .append(data.message); + // for this dialog, we remove the fieldset wrapping due to double headings + $("fieldset#fieldset_change_password") + .find("legend").remove().end() + .find("table.noclick").unwrap().addClass("some-margin") + .find("input#text_pma_pw").focus(); + displayPasswordGenerateButton(); + $('#fieldset_change_password_footer').hide(); + PMA_ajaxRemoveMessage($msgbox); + $('#change_password_form').bind('submit', function (e) { + e.preventDefault(); + $(this) + .closest('.ui-dialog') + .find('.ui-dialog-buttonpane .ui-button') + .first() + .click(); + }); + } else { + PMA_ajaxShowMessage(data.error, false); } - $('
') - .dialog({ - title: PMA_messages['strChangePassword'], - width: 600, - close: function(ev, ui) { - $(this).remove(); - }, - buttons : button_options, - modal: true - }) - .append(data.message); - // for this dialog, we remove the fieldset wrapping due to double headings - $("fieldset#fieldset_change_password") - .find("legend").remove().end() - .find("table.noclick").unwrap().addClass("some-margin") - .find("input#text_pma_pw").focus(); - displayPasswordGenerateButton(); - $('#fieldset_change_password_footer').hide(); - PMA_ajaxRemoveMessage($msgbox); - $('#change_password_form').bind('submit', function (e) { - e.preventDefault(); - $(this) - .closest('.ui-dialog') - .find('.ui-dialog-buttonpane .ui-button') - .first() - .click(); - }); }); // end $.get() }); // end handler for change password anchor }); // end $() for Change Password From 4147285d812b94044acce08c50f3118de482276e Mon Sep 17 00:00:00 2001 From: Rouslan Placella Date: Fri, 3 Aug 2012 12:07:05 +0200 Subject: [PATCH 10/10] [pmahomme] Drop the background color from self link - it looks ugly on some monitors --- themes/pmahomme/css/common.css.php | 1 - 1 file changed, 1 deletion(-) diff --git a/themes/pmahomme/css/common.css.php b/themes/pmahomme/css/common.css.php index 0744db065a..f327394629 100644 --- a/themes/pmahomme/css/common.css.php +++ b/themes/pmahomme/css/common.css.php @@ -1747,7 +1747,6 @@ li#li_user_preferences { display: block; margin-top: 1em; margin-bottom: 1em; - background: #f3f3f3; width: 100%; border-top: .1em solid silver; text-align: ;