From 93d0534439a8c90ea3ad825afe381def2309b8fe Mon Sep 17 00:00:00 2001 From: Marc Delisle Date: Sun, 23 Aug 2015 09:55:19 -0400 Subject: [PATCH 1/8] Fix return type Signed-off-by: Marc Delisle --- libraries/relation.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/relation.lib.php b/libraries/relation.lib.php index 6a451963ce..338565fe98 100644 --- a/libraries/relation.lib.php +++ b/libraries/relation.lib.php @@ -16,7 +16,7 @@ if (! defined('PHPMYADMIN')) { * @param boolean $show_error whether to display SQL error messages or not * @param int $options query options * - * @return integer the result set, or false if no result set + * @return resource|boolean the result set, or false if no result set * * @access public * From 4b0cd53e75ea855562a0ffed547e13982add0290 Mon Sep 17 00:00:00 2001 From: Marc Delisle Date: Sun, 23 Aug 2015 12:34:42 -0400 Subject: [PATCH 2/8] Add missing type check Fix parameter type Signed-off-by: Marc Delisle --- db_tracking.php | 2 +- libraries/tracking.lib.php | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/db_tracking.php b/db_tracking.php index a4a9258831..42db66199f 100644 --- a/db_tracking.php +++ b/db_tracking.php @@ -109,7 +109,7 @@ $all_tables_query = ' SELECT table_name, MAX(version) as version FROM ' . $all_tables_result = PMA_queryAsControlUser($all_tables_query); // If a HEAD version exists -if ($GLOBALS['dbi']->numRows($all_tables_result) > 0) { +if (is_object($all_tables_result) && $GLOBALS['dbi']->numRows($all_tables_result) > 0) { PMA_displayTrackedTables( $GLOBALS['db'], $all_tables_result, $url_query, $pmaThemeImage, $text_dir, $cfgRelation diff --git a/libraries/tracking.lib.php b/libraries/tracking.lib.php index 5fb845e344..dc839b0413 100644 --- a/libraries/tracking.lib.php +++ b/libraries/tracking.lib.php @@ -1588,12 +1588,12 @@ function PMA_getUntrackedTables($db) /** * Display tracked tables * - * @param string $db current database - * @param resource $all_tables_result result set of tracked tables - * @param string $url_query url query string - * @param string $pmaThemeImage path to theme's image folder - * @param string $text_dir text direction - * @param array $cfgRelation configuration storage info + * @param string $db current database + * @param object $all_tables_result result set of tracked tables + * @param string $url_query url query string + * @param string $pmaThemeImage path to theme's image folder + * @param string $text_dir text direction + * @param array $cfgRelation configuration storage info * * @return void */ From 2d9d60b5b482da28b73c547d3d6a47cebeb3a61d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=CE=A0=CE=B1=CE=BD=CE=B1=CE=B3=CE=B9=CF=8E=CF=84=CE=B7?= =?UTF-8?q?=CF=82=20=CE=A0=CE=B1=CF=80=CE=AC=CE=B6=CE=BF=CE=B3=CE=BB=CE=BF?= =?UTF-8?q?=CF=85?= Date: Sun, 23 Aug 2015 20:15:59 +0200 Subject: [PATCH 3/8] Translated using Weblate (Greek) Currently translated at 100.0% (3207 of 3207 strings) [CI skip] --- po/el.po | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/po/el.po b/po/el.po index 205cb3ea71..15995194b0 100644 --- a/po/el.po +++ b/po/el.po @@ -2,12 +2,12 @@ msgid "" msgstr "" "Project-Id-Version: phpMyAdmin 4.5.0-dev\n" -"Report-Msgid-Bugs-To: developers@phpmyadmin.net\n" +"Report-Msgid-Bugs-To: translators@phpmyadmin.net\n" "POT-Creation-Date: 2015-08-22 07:48-0400\n" -"PO-Revision-Date: 2015-08-19 13:01+0200\n" +"PO-Revision-Date: 2015-08-23 20:15+0200\n" "Last-Translator: Παναγιώτης Παπάζογλου \n" -"Language-Team: Greek \n" +"Language-Team: Greek " +"\n" "Language: el\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -6034,6 +6034,8 @@ msgid "" "Add IF NOT EXISTS (less efficient as indexes will be generated during table " "creation)" msgstr "" +"Προσθήκη του IF NOT EXISTS (λιγότερο αποτελεσματικό από ευρετήρια καθώς θα " +"δημιουργηθούν κατά τη δημιουργία τη δημιουργία πίνακα)" #: libraries/config/messages.inc.php:210 msgid "Use ignore inserts" @@ -10598,12 +10600,14 @@ msgstr "Προσθήκη δηλώσεων:" #: libraries/plugins/export/ExportSql.class.php:277 msgid "(less efficient as indexes will be generated during table creation)" msgstr "" +"(λιγότερυ αποτελεσματικό από ευρετήρια καθώς θα δημιουργηθούν κατά τη " +"δημιουργία πίνακα)" #: libraries/plugins/export/ExportSql.class.php:282 -#, fuzzy, php-format +#, php-format #| msgid "Session value" msgid "%s value" -msgstr "Τιμή συνεδρίας" +msgstr "%s τιμή" #: libraries/plugins/export/ExportSql.class.php:322 msgid "" From 95c8f9fd841d4d96a54c30182864ae43be1e7173 Mon Sep 17 00:00:00 2001 From: Andrea Pezzino Date: Sun, 23 Aug 2015 15:13:43 -0400 Subject: [PATCH 4/8] Fixes #11411 Undefined "replace" function on numeric scalar Signed-off-by: Andrea Pezzino --- js/functions.js | 1 + 1 file changed, 1 insertion(+) diff --git a/js/functions.js b/js/functions.js index f4a9fd1466..d8f5eb61d9 100644 --- a/js/functions.js +++ b/js/functions.js @@ -144,6 +144,7 @@ function PMA_tooltip($elements, item, myContent, additionalOptions) function escapeHtml(unsafe) { if (typeof(unsafe) != 'undefined') { return unsafe + .toString() .replace(/&/g, "&") .replace(//g, ">") From 73261814fda58c20bc23514c7852eb76733a4d2a Mon Sep 17 00:00:00 2001 From: Marc Delisle Date: Sun, 23 Aug 2015 15:15:37 -0400 Subject: [PATCH 5/8] ChangeLog entry Signed-off-by: Marc Delisle --- ChangeLog | 1 + 1 file changed, 1 insertion(+) diff --git a/ChangeLog b/ChangeLog index afcf42b745..49fb7d33ce 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,7 @@ phpMyAdmin - ChangeLog ====================== 4.4.15.0 (not yet released) +- issue #11411 Undefined "replace" function on numeric scalar 4.4.14.0 (2015-08-20) - issue #11367 Export after search, missing WHERE clause From 2edb392efca65a4ca002ce1371d5a62f65eb84b9 Mon Sep 17 00:00:00 2001 From: Brad Kent Date: Sat, 22 Aug 2015 21:45:22 -0500 Subject: [PATCH 6/8] fix for routine radio and checkbox width fixes execute enum/set options and the "is deterministic" checkbox on edit Signed-off-by: Brad Kent --- themes/pmahomme/css/rte.css.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/themes/pmahomme/css/rte.css.php b/themes/pmahomme/css/rte.css.php index 0db21a805c..55d7832e9a 100644 --- a/themes/pmahomme/css/rte.css.php +++ b/themes/pmahomme/css/rte.css.php @@ -38,6 +38,12 @@ if (! defined('PMA_MINIMUM_COMMON') && ! defined('TESTSUITE')) { -webkit-box-sizing: border-box; } +.rte_table input[type=checkbox], +.rte_table input[type=radio] { + width: auto; + margin-right: 6px; +} + .rte_table .routine_params_table { width: 100%; } From 40c67b505d9d5acc315dcb525d1fac72f8990f9a Mon Sep 17 00:00:00 2001 From: Hugues Peccatte Date: Sun, 23 Aug 2015 21:46:46 +0200 Subject: [PATCH 7/8] Remove useless units in CSS. Signed-off-by: Hugues Peccatte --- themes/original/css/common.css.php | 46 +++++++++++--------------- themes/original/css/navigation.css.php | 6 ++-- themes/pmahomme/css/common.css.php | 20 +++++------ themes/pmahomme/css/jqplot.css.php | 12 +++---- themes/pmahomme/css/navigation.css.php | 12 +++---- 5 files changed, 43 insertions(+), 53 deletions(-) diff --git a/themes/original/css/common.css.php b/themes/original/css/common.css.php index f03beebc01..42e7b48c1c 100644 --- a/themes/original/css/common.css.php +++ b/themes/original/css/common.css.php @@ -1044,7 +1044,7 @@ table#chartGrid div.monitorChart { div.tabLinks { margin-left: 0.3em; float: ; - padding: 5px 0px; + padding: 5px 0; } div.tabLinks a, div.tabLinks label { @@ -1052,7 +1052,7 @@ div.tabLinks a, div.tabLinks label { } div.tabLinks .icon { - margin: -0.2em 0.3em 0px 0px; + margin: -0.2em 0.3em 0 0; } .popupContent { @@ -1229,7 +1229,7 @@ div#queryboxcontainer div#bookmarkoptions { } #maincontainer li { - margin: 0.2em 0em; + margin: 0.2em 0; } #full_name_layer { @@ -2409,45 +2409,39 @@ according to css rules*/ .jqplot-xaxis-tick { - top: 0px; + top: 0; /* initial position untill tick is drawn in proper place */ left: 15px; -/* padding-top: 10px;*/ vertical-align: top; } .jqplot-x2axis-tick { - bottom: 0px; + bottom: 0; /* initial position untill tick is drawn in proper place */ left: 15px; -/* padding-bottom: 10px;*/ vertical-align: bottom; } .jqplot-yaxis-tick { - right: 0px; + right: 0; /* initial position untill tick is drawn in proper place */ top: 15px; -/* padding-right: 10px;*/ text-align: right; } .jqplot-yaxis-tick.jqplot-breakTick { right: -20px; - margin-right: 0px; + margin-right: 0; padding:1px 5px 1px 5px; -/* background-color: white;*/ z-index: 2; font-size: 1.5em; } .jqplot-y2axis-tick, .jqplot-y3axis-tick, .jqplot-y4axis-tick, .jqplot-y5axis-tick, .jqplot-y6axis-tick, .jqplot-y7axis-tick, .jqplot-y8axis-tick, .jqplot-y9axis-tick { - left: 0px; - /* initial position untill tick is drawn in proper place */ + left: 0; + /* initial position until tick is drawn in proper place */ top: 15px; -/* padding-left: 10px;*/ -/* padding-right: 15px;*/ text-align: left; } @@ -2547,8 +2541,8 @@ div.jqplot-table-legend-swatch-outline { } div.jqplot-table-legend-swatch { - width:0px; - height:0px; + width:0; + height:0; border-top-width: 5px; border-bottom-width: 5px; border-left-width: 6px; @@ -2560,8 +2554,8 @@ div.jqplot-table-legend-swatch { } .jqplot-title { - top: 0px; - left: 0px; + top: 0; + left: 0; padding-bottom: 0.5em; font-size: 1.2em; } @@ -3052,8 +3046,8 @@ html.ie7 #pma_console .query_input { .pma_drop_handler { display: none; position: fixed; - top: 0px; - left: 0px; + top: 0; + left: 0; width: 100%; background: rgba(0, 0, 0, 0.6); height: 100%; @@ -3067,7 +3061,7 @@ html.ie7 #pma_console .query_input { .pma_sql_import_status { display: none; position: fixed; - bottom: 0px; + bottom: 0; right: 25px; width: 400px; border: 1px solid #999; @@ -3116,13 +3110,13 @@ html.ie7 #pma_console .query_input { .pma_sql_import_status h2 .minimize { float: right; margin-right: 5px; - padding: 0px 10px; + padding: 0 10px; } .pma_sql_import_status h2 .close { float: right; margin-right: 5px; - padding: 0px 10px; + padding: 0 10px; display: none; } @@ -3150,7 +3144,7 @@ html.ie7 #pma_console .query_input { background: white; min-height: 300px; z-index: 800; - -webkit-box-shadow: 0px 0px 15px #999; + -webkit-box-shadow: 0 0 15px #999; border-radius: 10px; cursor: move; } @@ -3158,7 +3152,7 @@ html.ie7 #pma_console .query_input { .pma_drop_result h2 .close { float: right; margin-right: 5px; - padding: 0px 10px; + padding: 0 10px; } #composite_index_list { diff --git a/themes/original/css/navigation.css.php b/themes/original/css/navigation.css.php index d3cc4754eb..97705dca6f 100644 --- a/themes/original/css/navigation.css.php +++ b/themes/original/css/navigation.css.php @@ -123,7 +123,7 @@ if (! defined('PMA_MINIMUM_COMMON') && ! defined('TESTSUITE')) { #pma_navigation_select_database { text-align: left; - padding: 0px 0px 0px; + padding: 0 0 0; border: 0; margin: 0; } @@ -140,7 +140,7 @@ if (! defined('PMA_MINIMUM_COMMON') && ! defined('TESTSUITE')) { border-top: 1px solid #bbb; color: #333; padding: 4px 6px; - margin: 0px 0px 0px; + margin: 0 0 0; width: 92%; font-size: 1.11em; } @@ -346,7 +346,7 @@ li.fast_filter.db_fast_filter { text-align: center; cursor: pointer; z-index: 800; - text-shadow: 0px 1px 0px #fff; + text-shadow: 0 1px 0 #fff; filter: dropshadow(color=#fff, offx=0, offy=1); border: 1px solid #888; } diff --git a/themes/pmahomme/css/common.css.php b/themes/pmahomme/css/common.css.php index f490812e2c..81755cf1b5 100644 --- a/themes/pmahomme/css/common.css.php +++ b/themes/pmahomme/css/common.css.php @@ -1373,7 +1373,7 @@ table#chartGrid div.monitorChart { div.tabLinks { margin-left: 0.3em; float: ; - padding: 5px 0px; + padding: 5px 0; } div.tabLinks a, div.tabLinks label { @@ -1381,7 +1381,7 @@ div.tabLinks a, div.tabLinks label { } div.tabLinks .icon { - margin: -0.2em 0.3em 0px 0px; + margin: -0.2em 0.3em 0 0; } .popupContent { @@ -2942,7 +2942,7 @@ body .ui-widget { /* over-riding jqplot-yaxis class */ .jqplot-yaxis { - left:0px !important; + left:0 !important; min-width:25px; width:auto; } @@ -3365,8 +3365,8 @@ html.ie7 #pma_console .query_input { .pma_drop_handler { display: none; position: fixed; - top: 0px; - left: 0px; + top: 0; + left: 0; width: 100%; background: rgba(0, 0, 0, 0.6); height: 100%; @@ -3380,7 +3380,7 @@ html.ie7 #pma_console .query_input { .pma_sql_import_status { display: none; position: fixed; - bottom: 0px; + bottom: 0; right: 25px; width: 400px; border: 1px solid #999; @@ -3429,13 +3429,13 @@ html.ie7 #pma_console .query_input { .pma_sql_import_status h2 .minimize { float: right; margin-right: 5px; - padding: 0px 10px; + padding: 0 10px; } .pma_sql_import_status h2 .close { float: right; margin-right: 5px; - padding: 0px 10px; + padding: 0 10px; display: none; } @@ -3463,7 +3463,7 @@ html.ie7 #pma_console .query_input { background: white; min-height: 300px; z-index: 800; - -webkit-box-shadow: 0px 0px 15px #999; + -webkit-box-shadow: 0 0 15px #999; border-radius: 10px; cursor: move; } @@ -3471,7 +3471,7 @@ html.ie7 #pma_console .query_input { .pma_drop_result h2 .close { float: right; margin-right: 5px; - padding: 0px 10px; + padding: 0 10px; } .dependencies_box { diff --git a/themes/pmahomme/css/jqplot.css.php b/themes/pmahomme/css/jqplot.css.php index b445927625..1fc4329bb7 100644 --- a/themes/pmahomme/css/jqplot.css.php +++ b/themes/pmahomme/css/jqplot.css.php @@ -56,18 +56,16 @@ if (! defined('PMA_MINIMUM_COMMON') && ! defined('TESTSUITE')) { .jqplot-xaxis-tick { - top: 0px; + top: 0; /* initial position untill tick is drawn in proper place */ : 15px; -/* padding-top: 10px;*/ vertical-align: top; } .jqplot-x2axis-tick { - bottom: 0px; + bottom: 0; /* initial position untill tick is drawn in proper place */ : 15px; -/* padding-bottom: 10px;*/ vertical-align: bottom; } @@ -75,15 +73,13 @@ if (! defined('PMA_MINIMUM_COMMON') && ! defined('TESTSUITE')) { : 0px; /* initial position untill tick is drawn in proper place */ top: 15px; -/* padding-right: 10px;*/ text-align: ; } .jqplot-yaxis-tick.jqplot-breakTick { : -20px; - margin-: 0px; + margin-: 0; padding:1px 5px 1px; -/* background-color: white;*/ z-index: 2; font-size: 1.5em; } @@ -204,7 +200,7 @@ div.jqplot-table-legend-swatch { } .jqplot-title { - top: 0px; + top: 0; : 0px; padding-bottom: 0.5em; font-size: 1.2em; diff --git a/themes/pmahomme/css/navigation.css.php b/themes/pmahomme/css/navigation.css.php index 2d4a6f8271..de0078d5c4 100644 --- a/themes/pmahomme/css/navigation.css.php +++ b/themes/pmahomme/css/navigation.css.php @@ -22,7 +22,7 @@ if (! defined('PMA_MINIMUM_COMMON') && ! defined('TESTSUITE')) { top: 0; : 0; height: 100%; - background: url(./themes/pmahomme/img/left_nav_bg.png) repeat-y right 0% ; + background: url(./themes/pmahomme/img/left_nav_bg.png) repeat-y right 0 ; color: ; z-index: 800; } @@ -77,7 +77,7 @@ if (! defined('PMA_MINIMUM_COMMON') && ! defined('TESTSUITE')) { #pma_navigation #databaseList, #pma_navigation div.pageselector.dbselector { text-align: center; - padding: 5px 10px 0px; + padding: 5px 10px 0; border: 0; } @@ -108,7 +108,7 @@ if (! defined('PMA_MINIMUM_COMMON') && ! defined('TESTSUITE')) { } #pma_navigation_select_database { text-align: left; - padding: 0px 0px 0px; + padding: 0 0 0; border: 0; margin: 0; } @@ -125,7 +125,7 @@ if (! defined('PMA_MINIMUM_COMMON') && ! defined('TESTSUITE')) { border-top: 1px solid #bbb; color: #333; padding: 4px 6px; - margin: 0px 0px 0px; + margin: 0 0 0; width: 92%; font-size: 1.11em; } @@ -318,7 +318,7 @@ html.ie.ie8 li.fast_filter input { } li.fast_filter.db_fast_filter { border: 0; - margin-left: 0px; + margin-left: 0; margin-right: 10px; } @@ -359,7 +359,7 @@ li.fast_filter.db_fast_filter { text-align: center; cursor: pointer; z-index: 800; - text-shadow: 0px 1px 0px #fff; + text-shadow: 0 1px 0 #fff; filter: dropshadow(color=#fff, offx=0, offy=1); border: 1px solid #888; } From aac7ada3915d355372bd720dba7111abfc5aa25e Mon Sep 17 00:00:00 2001 From: Hugues Peccatte Date: Mon, 24 Aug 2015 00:21:50 +0200 Subject: [PATCH 8/8] Use statements and sprintf to create queries instead of concatenation. Initialize variable. Signed-off-by: Hugues Peccatte --- libraries/server_privileges.lib.php | 150 +++++++++++++++++----------- 1 file changed, 91 insertions(+), 59 deletions(-) diff --git a/libraries/server_privileges.lib.php b/libraries/server_privileges.lib.php index c557098be4..016cae72a4 100644 --- a/libraries/server_privileges.lib.php +++ b/libraries/server_privileges.lib.php @@ -1981,7 +1981,7 @@ function PMA_getMessageAndSqlQueryForPrivilegesRevoke($dbname, /** * Get REQUIRE cluase * - * @return stirng REQUIRE clause + * @return string REQUIRE clause */ function PMA_getRequireClause() { @@ -4902,70 +4902,94 @@ function PMA_addUserAndCreateDatabase($_error, $real_sql_query, $sql_query, */ function PMA_getSqlQueriesForDisplayAndAddUser($username, $hostname, $password) { - $create_user_real = 'CREATE USER \'' - . PMA_Util::sqlAddSlashes($username) . '\'@\'' - . PMA_Util::sqlAddSlashes($hostname) . '\''; + $slashedUsername = PMA_Util::sqlAddSlashes($username); + $slashedHostname = PMA_Util::sqlAddSlashes($hostname); - $password_set_real = 'SET PASSWORD FOR \'' - . PMA_Util::sqlAddSlashes($username) . '\'@\'' - . PMA_Util::sqlAddSlashes($hostname) . '\' = ' - . ' PASSWORD(\''; + $create_user_stmt = sprintf( + 'CREATE USER \'%s\'@\'%s\'', + $slashedUsername, + $slashedHostname + ); + $create_user_real = $create_user_show = $create_user_stmt; - $real_sql_query = 'GRANT ' . join(', ', PMA_extractPrivInfo()) . ' ON *.* TO \'' - . PMA_Util::sqlAddSlashes($username) . '\'@\'' - . PMA_Util::sqlAddSlashes($hostname) . '\''; + $password_set_stmt = 'SET PASSWORD FOR \'%s\'@\'%s\' = PASSWORD(\'%s\')'; + $password_set_show = sprintf( + $password_set_stmt, + $slashedUsername, + $slashedHostname, + '***' + ); + $password_set_real = null; - $create_user_show = $create_user_real; - $password_set_show = $password_set_real . '***\')'; - $sql_query = $real_sql_query; + $sql_query_stmt = sprintf( + 'GRANT %s ON *.* TO \'%s\'@\'%s\'', + join(', ', PMA_extractPrivInfo()), + $slashedUsername, + $slashedHostname + ); + $real_sql_query = $sql_query = $sql_query_stmt; + //@todo Following blocks should be delegated to another function and factorized. + //There are too much duplication here. if ($_POST['pred_password'] != 'none' && $_POST['pred_password'] != 'keep') { - if (isset($create_user_real)) { - if (isset($_REQUEST['authentication_plugin']) - && $_REQUEST['authentication_plugin'] - ) { - if (PMA_MYSQL_INT_VERSION >= 50700) { - $create_user_show .= ' IDENTIFIED WITH ' . $_REQUEST['authentication_plugin'] - . ' BY \'***\''; - $create_user_real .= ' IDENTIFIED WITH ' . $_REQUEST['authentication_plugin'] - . ' BY \'' . PMA_Util::sqlAddSlashes($_POST['pma_pw']) . '\' '; - } else { - $create_user_show .= ' IDENTIFIED WITH ' . $_REQUEST['authentication_plugin']; - $create_user_real .= ' IDENTIFIED WITH ' . $_REQUEST['authentication_plugin']; - - $password_set_real .= PMA_Util::sqlAddSlashes($_POST['pma_pw']) . '\')'; - } + $slashedPassword = PMA_Util::sqlAddSlashes($_POST['pma_pw']); + if (isset($_REQUEST['authentication_plugin']) + && $_REQUEST['authentication_plugin'] + ) { + if (PMA_MYSQL_INT_VERSION >= 50700) { + $create_user_stmt = $create_user_stmt . ' IDENTIFIED WITH ' + . $_REQUEST['authentication_plugin'] . ' BY \'%s\''; + $create_user_show = sprintf($create_user_stmt, '***'); + $create_user_real = sprintf( + $create_user_stmt, + $slashedPassword + ); } else { - $sql_query .= ' IDENTIFIED BY \'***\''; - $real_sql_query .= ' IDENTIFIED BY \'' - . PMA_Util::sqlAddSlashes($_POST['pma_pw']) . '\' '; - - $password_set_real .= PMA_Util::sqlAddSlashes( - $_POST['pma_pw'] - ) . '\')'; + $create_user_stmt .= ' IDENTIFIED WITH ' + . $_REQUEST['authentication_plugin']; + $create_user_show = $create_user_real = $create_user_stmt; } + } else { + $sql_query_stmt .= ' IDENTIFIED BY \'%s\' '; + $sql_query = sprintf($sql_query_stmt, '***'); + $real_sql_query = sprintf($sql_query_stmt, $slashedPassword); } + $password_set_real = sprintf( + $password_set_stmt, + $slashedUsername, + $slashedHostname, + $slashedPassword + ); } else { + $slashedPassword = PMA_Util::sqlAddSlashes($password); if ($_POST['pred_password'] == 'keep' && ! empty($password)) { if (isset($_REQUEST['authentication_plugin']) && $_REQUEST['authentication_plugin'] ) { if (PMA_MYSQL_INT_VERSION >= 50700) { - $create_user_show .= ' IDENTIFIED WITH ' . $_REQUEST['authentication_plugin'] - . ' BY \'***\''; - $create_user_real .= ' IDENTIFIED WITH ' . $_REQUEST['authentication_plugin'] - . ' BY \'' . PMA_Util::sqlAddSlashes($password) . '\' '; + $create_user_stmt = $create_user_stmt . ' IDENTIFIED WITH ' + . $_REQUEST['authentication_plugin'] . ' BY \'%s\''; + $create_user_show = sprintf($create_user_stmt, '***'); + $create_user_real = sprintf( + $create_user_stmt, + $slashedPassword + ); } else { - $create_user_show .= ' IDENTIFIED WITH ' . $_REQUEST['authentication_plugin']; - $create_user_real .= ' IDENTIFIED WITH ' . $_REQUEST['authentication_plugin']; - - $password_set_real .= PMA_Util::sqlAddSlashes($password) . '\')'; + $create_user_stmt .= ' IDENTIFIED WITH ' + . $_REQUEST['authentication_plugin']; + $create_user_show = $create_user_real = $create_user_stmt; } - } else { - $sql_query .= ' IDENTIFIED BY \'***\''; - $real_sql_query .= ' IDENTIFIED BY \'' - . PMA_Util::sqlAddSlashes($password) . '\' '; + $password_set_real = sprintf( + $password_set_stmt, + $slashedUsername, + $slashedHostname, + $slashedPassword + ); + } else { + $sql_query_stmt .= ' IDENTIFIED BY \'%s\' '; + $sql_query = sprintf($sql_query_stmt, '***'); + $real_sql_query = sprintf($sql_query_stmt, $slashedPassword); $password_set_real = null; } } elseif ($_POST['pred_password'] == 'keep' && empty($password)) { @@ -4973,20 +4997,28 @@ function PMA_getSqlQueriesForDisplayAndAddUser($username, $hostname, $password) && $_REQUEST['authentication_plugin'] ) { if (PMA_MYSQL_INT_VERSION >= 50700) { - $create_user_show .= ' IDENTIFIED WITH ' . $_REQUEST['authentication_plugin'] - . ' BY \'***\''; - $create_user_real .= ' IDENTIFIED WITH ' . $_REQUEST['authentication_plugin'] - . ' BY \'\' '; + $create_user_stmt = $create_user_stmt . ' IDENTIFIED WITH ' + . $_REQUEST['authentication_plugin'] . ' BY \'%s\''; + $create_user_show = sprintf($create_user_stmt, '***'); + $create_user_real = sprintf( + $create_user_stmt, + null + ); } else { - $create_user_show .= ' IDENTIFIED WITH ' . $_REQUEST['authentication_plugin']; - $create_user_real .= ' IDENTIFIED WITH ' . $_REQUEST['authentication_plugin']; - - $password_set_real .= '\')'; + $create_user_stmt .= ' IDENTIFIED WITH ' + . $_REQUEST['authentication_plugin']; + $create_user_show = $create_user_real = $create_user_stmt; } + $password_set_real = sprintf( + $password_set_stmt, + $slashedUsername, + $slashedHostname, + null + ); } else { - $sql_query .= ' IDENTIFIED BY \'***\''; - $real_sql_query .= ' IDENTIFIED BY \'\' '; - + $sql_query_stmt .= ' IDENTIFIED BY \'%s\' '; + $sql_query = sprintf($sql_query_stmt, '***'); + $real_sql_query = sprintf($sql_query_stmt, null); $password_set_real = null; } }