From 7f80aa29718d85ad2fdd427d02c77bec979c59a9 Mon Sep 17 00:00:00 2001 From: Spun Nakandala Date: Tue, 11 Jun 2013 20:42:07 +0530 Subject: [PATCH 1/8] Avoided the use of global variables by directly accessing super global variables. --- sql.php | 72 +++++++++++++++------------------------------------------ 1 file changed, 19 insertions(+), 53 deletions(-) diff --git a/sql.php b/sql.php index 364cb286d7..1977de7ebd 100644 --- a/sql.php +++ b/sql.php @@ -35,42 +35,6 @@ if (isset($ajax_reload) && $ajax_reload['reload'] === true) { $response->addJSON('ajax_reload', $ajax_reload); } -/** - * Sets globals from $_POST - */ -$post_params = array( - 'bkm_all_users', - 'fields', - 'store_bkm' -); -foreach ($post_params as $one_post_param) { - if (isset($_POST[$one_post_param])) { - $GLOBALS[$one_post_param] = $_POST[$one_post_param]; - } -} - -/** - * Sets globals from $_GET - */ -$get_params = array( - 'id_bookmark', - 'label', - 'sql_query' -); -foreach ($get_params as $one_get_param) { - if (isset($_GET[$one_get_param])) { - $GLOBALS[$one_get_param] = $_GET[$one_get_param]; - } -} - - -if (isset($_REQUEST['printview'])) { - $GLOBALS['printview'] = $_REQUEST['printview']; -} - -if (!isset($_SESSION['is_multi_query'])) { - $_SESSION['is_multi_query'] = false; -} /** * Defines the url to return to in case of error in a sql statement @@ -102,13 +66,15 @@ if (! isset($err_url)) { } // end if // Coming from a bookmark dialog -if (isset($fields['query'])) { - $sql_query = $fields['query']; +if (isset($_POST['fields']['query'])) { + $sql_query = $_POST['fields']['query']; +}elseif (isset($_GET['sql_query'])) { + $sql_query = $_GET['sql_query']; } // This one is just to fill $db -if (isset($fields['dbase'])) { - $db = $fields['dbase']; +if (isset($_POST['fields']['dbase'])) { + $db = $_POST['fields']['dbase']; } @@ -283,16 +249,16 @@ if (isset($find_real_end) && $find_real_end) { /** * Bookmark add */ -if (isset($store_bkm)) { +if (isset($_POST['store_bkm'])) { $result = PMA_Bookmark_save( - $fields, - (isset($bkm_all_users) && $bkm_all_users == 'true' ? true : false) + $_POST['fields'], + (isset($_POST['bkm_all_users']) && $_POST['bkm_all_users'] == 'true' ? true : false) ); $response = PMA_Response::getInstance(); if ($response->isAjax()) { if ($result) { $msg = PMA_message::success(__('Bookmark %s created')); - $msg->addParam($fields['label']); + $msg->addParam($_POST['fields']['label']); $response->addJSON('message', $msg); } else { $msg = PMA_message::error(__('Bookmark not created')); @@ -303,7 +269,7 @@ if (isset($store_bkm)) { } else { // go back to sql.php to redisplay query; do not use & in this case: PMA_sendHeaderLocation( - $cfg['PmaAbsoluteUri'] . $goto . '&label=' . $fields['label'] + $cfg['PmaAbsoluteUri'] . $goto . '&label=' . $_POST['fields']['label'] ); } } // end if @@ -615,7 +581,7 @@ if (isset($GLOBALS['show_as_php']) || ! empty($GLOBALS['validatequery'])) { } } - PMA_Bookmark_save($bfields, isset($bkm_all_users)); + PMA_Bookmark_save($bfields, isset($_POST['bkm_all_users'])); $bookmark_created = true; } // end store bookmarks @@ -974,7 +940,7 @@ if ((0 == $num_rows && 0 == $unlim_num_rows) || $is_affected) { // Should be initialized these parameters before parsing $showtable = isset($showtable) ? $showtable : null; - $printview = isset($printview) ? $printview : null; + $printview = isset($_REQUEST['printview']) ? $_REQUEST['printview'] : null; $url_query = isset($url_query) ? $url_query : null; if (!empty($sql_data) && ($sql_data['valid_queries'] > 1)) { @@ -1007,7 +973,7 @@ if ((0 == $num_rows && 0 == $unlim_num_rows) || $is_affected) { if (isset($show_query)) { unset($show_query); } - if (isset($printview) && $printview == '1') { + if (isset($_REQUEST['printview']) && $_REQUEST['printview'] == '1') { PMA_Util::checkParameters(array('db', 'full_sql_query')); $response = PMA_Response::getInstance(); @@ -1107,15 +1073,15 @@ if ((0 == $num_rows && 0 == $unlim_num_rows) || $is_affected) { $html_output .= $msg->getDisplay(); } - if (isset($label)) { + if (isset($_GET['label'])) { $msg = PMA_message::success(__('Bookmark %s created')); - $msg->addParam($label); + $msg->addParam($_GET['label']); $html_output .= $msg->getDisplay(); } // Should be initialized these parameters before parsing $showtable = isset($showtable) ? $showtable : null; - $printview = isset($printview) ? $printview : null; + $printview = isset($_REQUEST['printview']) ? $_REQUEST['printview'] : null; $url_query = isset($url_query) ? $url_query : null; if (! empty($sql_data) && ($sql_data['valid_queries'] > 1) || $is_procedure) { @@ -1160,7 +1126,7 @@ if ((0 == $num_rows && 0 == $unlim_num_rows) || $is_affected) { // Bookmark support if required if ($disp_mode[7] == '1' - && (! empty($cfg['Bookmark']) && empty($id_bookmark)) + && (! empty($cfg['Bookmark']) && empty($_GET['id_bookmark'])) && ! empty($sql_query) ) { $html_output .= "\n"; @@ -1210,7 +1176,7 @@ if ((0 == $num_rows && 0 == $unlim_num_rows) || $is_affected) { } // end bookmark support // Do print the page if required - if (isset($printview) && $printview == '1') { + if (isset($_REQUEST['printview']) && $_REQUEST['printview'] == '1') { $html_output .= PMA_Util::getButton(); } // end print case $html_output .= ''; // end sqlqueryresults div From 96bf1782d3464a21bda56cd0646258afa859309a Mon Sep 17 00:00:00 2001 From: Spun Nakandala Date: Tue, 11 Jun 2013 21:55:39 +0530 Subject: [PATCH 2/8] PMA_getHtmlForConfirmPage method added to sql.lib.php to create html for the confirm page. --- libraries/sql.lib.php | 78 +++++++++++++++++++++++++++++++++++++++++++ sql.php | 67 ++----------------------------------- 2 files changed, 81 insertions(+), 64 deletions(-) diff --git a/libraries/sql.lib.php b/libraries/sql.lib.php index 2055c49bba..f518f70d9a 100644 --- a/libraries/sql.lib.php +++ b/libraries/sql.lib.php @@ -696,4 +696,82 @@ function PMA_getHtmlForOptionsList($values, $selected_values) } return $options; } + +/** + * Get HTML for the confirm page + * + * @param string $db current database + * @param string $table current table + * @param string $sql_query the sql query to be executed + * @param boolean $is_drop_database whether the query is to drop a database + * @param string $goto the url to return to in case of error in a sql statement + * + * @return string $output the html for the confirm page + */ +function PMA_getHtmlForConfirmPage($db, $table, $sql_query, $is_drop_database, $goto) +{ + $stripped_sql_query = $sql_query; + $input = ''; + $output = ''; + if ($is_drop_database) { + $output .= '

'; + $output .= __('You are about to DESTROY a complete database!'); + $output .= '

'; + } + $form = '
'; + $form .= PMA_generate_common_hidden_inputs($db, $table); + $form .= sprintf( + $input, 'sql_query', htmlspecialchars($sql_query) + ); + $form .= sprintf( + $input, 'message_to_show', + (isset($message_to_show) ? PMA_sanitize($message_to_show, true) : '') + ); + $form .= sprintf( + $input, 'goto', $goto + ); + $form .= sprintf( + $input, 'back', + (isset($back) ? PMA_sanitize($back, true) : '') + ); + $form .= sprintf( + $input, 'reload', + (isset($reload) ? PMA_sanitize($reload, true) : '') + ); + $form .= sprintf( + $input, 'purge', + (isset($purge) ? PMA_sanitize($purge, true) : '') + ); + + $form .= sprintf( + $input, 'dropped_column', + (isset($dropped_column) ? PMA_sanitize($dropped_column, true) : '') + ); + $form .= sprintf( + $input, 'show_query', + (isset($message_to_show) ? PMA_sanitize($show_query, true) : '') + ); + $form = str_replace('%', '%%', $form) . '%s
'; + + $output .='
' + .'' + . __('Do you really want to execute the following query?') + . '' + .'' . htmlspecialchars($stripped_sql_query) . '' + .'
' + .'
'; + + $yes_input = sprintf($input, 'btnDrop', __('Yes')); + $yes_input .= ''; + $no_input = sprintf($input, 'btnDrop', __('No')); + $no_input .= ''; + + $output .= sprintf($form, $yes_input); + $output .= sprintf($form, $no_input); + + $output .='
'; + $output .= ''; + + return $output; +} ?> diff --git a/sql.php b/sql.php index 1977de7ebd..973fd9e0e7 100644 --- a/sql.php +++ b/sql.php @@ -334,70 +334,9 @@ if (! $cfg['Confirm'] } if ($do_confirm) { - $stripped_sql_query = $sql_query; - $input = ''; - $output = ''; - if ($is_drop_database) { - $output .= '

'; - $output .= __('You are about to DESTROY a complete database!'); - $output .= '

'; - } - $form = '
'; - $form .= PMA_generate_common_hidden_inputs($db, $table); - - $form .= sprintf( - $input, 'sql_query', htmlspecialchars($sql_query) - ); - $form .= sprintf( - $input, 'message_to_show', - (isset($message_to_show) ? PMA_sanitize($message_to_show, true) : '') - ); - $form .= sprintf( - $input, 'goto', $goto - ); - $form .= sprintf( - $input, 'back', - (isset($back) ? PMA_sanitize($back, true) : '') - ); - $form .= sprintf( - $input, 'reload', - (isset($reload) ? PMA_sanitize($reload, true) : '') - ); - $form .= sprintf( - $input, 'purge', - (isset($purge) ? PMA_sanitize($purge, true) : '') - ); - $form .= sprintf( - $input, 'dropped_column', - (isset($dropped_column) ? PMA_sanitize($dropped_column, true) : '') - ); - $form .= sprintf( - $input, 'show_query', - (isset($message_to_show) ? PMA_sanitize($show_query, true) : '') - ); - $form = str_replace('%', '%%', $form) . '%s
'; - - $output .='
' - .'' - . __('Do you really want to execute the following query?') - . '' - .'' . htmlspecialchars($stripped_sql_query) . '' - .'
' - .'
'; - - $yes_input = sprintf($input, 'btnDrop', __('Yes')); - $yes_input .= ''; - $no_input = sprintf($input, 'btnDrop', __('No')); - $no_input .= ''; - - $output .= sprintf($form, $yes_input); - $output .= sprintf($form, $no_input); - - $output .='
'; - $output .= ''; - - PMA_Response::getInstance()->addHTML($output); - + $html = PMA_getHtmlForConfirmPage($db, $table, $sql_query, $is_drop_database, + $goto); + PMA_Response::getInstance()->addHTML($html); exit; } // end if $do_confirm From 9ef591e69ebbf5ff96fb57601db28dfb47ff29db Mon Sep 17 00:00:00 2001 From: Spun Nakandala Date: Wed, 12 Jun 2013 17:21:51 +0530 Subject: [PATCH 3/8] space added before elseif --- sql.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql.php b/sql.php index 973fd9e0e7..d79763a872 100644 --- a/sql.php +++ b/sql.php @@ -68,7 +68,7 @@ if (! isset($err_url)) { // Coming from a bookmark dialog if (isset($_POST['fields']['query'])) { $sql_query = $_POST['fields']['query']; -}elseif (isset($_GET['sql_query'])) { +} elseif (isset($_GET['sql_query'])) { $sql_query = $_GET['sql_query']; } From e32064bcd23f2bd18914d6610869d8e02b19a4eb Mon Sep 17 00:00:00 2001 From: Spun Nakandala Date: Wed, 12 Jun 2013 19:54:44 +0530 Subject: [PATCH 4/8] code for displaying confirm page removed. --- libraries/sql.lib.php | 78 ------------------------------------------- sql.php | 31 ----------------- 2 files changed, 109 deletions(-) diff --git a/libraries/sql.lib.php b/libraries/sql.lib.php index f518f70d9a..2055c49bba 100644 --- a/libraries/sql.lib.php +++ b/libraries/sql.lib.php @@ -696,82 +696,4 @@ function PMA_getHtmlForOptionsList($values, $selected_values) } return $options; } - -/** - * Get HTML for the confirm page - * - * @param string $db current database - * @param string $table current table - * @param string $sql_query the sql query to be executed - * @param boolean $is_drop_database whether the query is to drop a database - * @param string $goto the url to return to in case of error in a sql statement - * - * @return string $output the html for the confirm page - */ -function PMA_getHtmlForConfirmPage($db, $table, $sql_query, $is_drop_database, $goto) -{ - $stripped_sql_query = $sql_query; - $input = ''; - $output = ''; - if ($is_drop_database) { - $output .= '

'; - $output .= __('You are about to DESTROY a complete database!'); - $output .= '

'; - } - $form = '
'; - $form .= PMA_generate_common_hidden_inputs($db, $table); - $form .= sprintf( - $input, 'sql_query', htmlspecialchars($sql_query) - ); - $form .= sprintf( - $input, 'message_to_show', - (isset($message_to_show) ? PMA_sanitize($message_to_show, true) : '') - ); - $form .= sprintf( - $input, 'goto', $goto - ); - $form .= sprintf( - $input, 'back', - (isset($back) ? PMA_sanitize($back, true) : '') - ); - $form .= sprintf( - $input, 'reload', - (isset($reload) ? PMA_sanitize($reload, true) : '') - ); - $form .= sprintf( - $input, 'purge', - (isset($purge) ? PMA_sanitize($purge, true) : '') - ); - - $form .= sprintf( - $input, 'dropped_column', - (isset($dropped_column) ? PMA_sanitize($dropped_column, true) : '') - ); - $form .= sprintf( - $input, 'show_query', - (isset($message_to_show) ? PMA_sanitize($show_query, true) : '') - ); - $form = str_replace('%', '%%', $form) . '%s
'; - - $output .='
' - .'' - . __('Do you really want to execute the following query?') - . '' - .'' . htmlspecialchars($stripped_sql_query) . '' - .'
' - .'
'; - - $yes_input = sprintf($input, 'btnDrop', __('Yes')); - $yes_input .= ''; - $no_input = sprintf($input, 'btnDrop', __('No')); - $no_input .= ''; - - $output .= sprintf($form, $yes_input); - $output .= sprintf($form, $no_input); - - $output .='
'; - $output .= ''; - - return $output; -} ?> diff --git a/sql.php b/sql.php index d79763a872..8cc384721a 100644 --- a/sql.php +++ b/sql.php @@ -310,37 +310,6 @@ if (isset($_REQUEST['btnDrop']) && $_REQUEST['btnDrop'] == __('No')) { exit(); } // end if - -/** - * Displays the confirm page if required - * - * This part of the script is bypassed if $is_js_confirmed = 1 (already checked - * with js) because possible security issue is not so important here: at most, - * the confirm message isn't displayed. - * - * Also bypassed if only showing php code.or validating a SQL query - */ -// if we are coming from a "Create PHP code" or a "Without PHP Code" -// dialog, we won't execute the query anyway, so don't confirm -if (! $cfg['Confirm'] - || isset($_REQUEST['is_js_confirmed']) - || isset($_REQUEST['btnDrop']) - || isset($GLOBALS['show_as_php']) - || ! empty($GLOBALS['validatequery']) -) { - $do_confirm = false; -} else { - $do_confirm = isset($analyzed_sql[0]['queryflags']['need_confirm']); -} - -if ($do_confirm) { - $html = PMA_getHtmlForConfirmPage($db, $table, $sql_query, $is_drop_database, - $goto); - PMA_Response::getInstance()->addHTML($html); - exit; -} // end if $do_confirm - - // Defines some variables // A table has to be created, renamed, dropped -> navi frame should be reloaded /** From ca8d81b95c8a5523cf20525c414d9efaf2a70841 Mon Sep 17 00:00:00 2001 From: Spun Nakandala Date: Wed, 12 Jun 2013 22:05:24 +0530 Subject: [PATCH 5/8] PMA_isDropDatabase($sql_query) method added to sqlparser.lib.php --- libraries/sqlparser.lib.php | 14 ++++++++++++++ sql.php | 9 ++------- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/libraries/sqlparser.lib.php b/libraries/sqlparser.lib.php index 6321856015..2f72dd954d 100644 --- a/libraries/sqlparser.lib.php +++ b/libraries/sqlparser.lib.php @@ -2913,4 +2913,18 @@ function PMA_SQP_isKeyWord($column) return in_array(strtoupper($column), $PMA_SQPdata_forbidden_word); } +/** + * Checks whether a given query is to drop a database + * + * @param string $sql_query The SQL query to be checked for drop database + * + * @return boolean whether true or false + */ +function PMA_isDropDatabase($sql_query) +{ + return preg_match( + '/DROP[[:space:]]+(DATABASE|SCHEMA)[[:space:]]+/i', + $sql_query + ); +} ?> diff --git a/sql.php b/sql.php index 8cc384721a..c0a748f081 100644 --- a/sql.php +++ b/sql.php @@ -17,6 +17,7 @@ require_once 'libraries/Header.class.php'; require_once 'libraries/check_user_privileges.lib.php'; require_once 'libraries/bookmark.lib.php'; require_once 'libraries/sql.lib.php'; +require_once 'libraries/sqlparser.lib.php'; $response = PMA_Response::getInstance(); $header = $response->getHeader(); @@ -198,12 +199,6 @@ if (empty($sql_query) && strlen($table) && strlen($db)) { PMA_Util::checkParameters(array('sql_query')); } -// instead of doing the test twice -$is_drop_database = preg_match( - '/DROP[[:space:]]+(DATABASE|SCHEMA)[[:space:]]+/i', - $sql_query -); - /** * Check rights in case of DROP DATABASE * @@ -213,7 +208,7 @@ $is_drop_database = preg_match( */ if (! defined('PMA_CHK_DROP') && ! $cfg['AllowUserDropDatabase'] - && $is_drop_database + && PMA_isDropDatabase($sql_query) && ! $is_superuser ) { PMA_Util::mysqlDie( From 3fabd7728f629ea4e44c8fc965d71c4005098443 Mon Sep 17 00:00:00 2001 From: Spun Nakandala Date: Thu, 13 Jun 2013 11:31:29 +0530 Subject: [PATCH 6/8] $_POST['fields'][...] variables renamed such that they better reflect their intended purpose --- sql.php | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/sql.php b/sql.php index c0a748f081..2ad8f964db 100644 --- a/sql.php +++ b/sql.php @@ -67,15 +67,15 @@ if (! isset($err_url)) { } // end if // Coming from a bookmark dialog -if (isset($_POST['fields']['query'])) { - $sql_query = $_POST['fields']['query']; +if (isset($_POST['bkm_fields']['bkm_sql_query'])) { + $sql_query = $_POST['bkm_fields']['bkm_sql_query']; } elseif (isset($_GET['sql_query'])) { $sql_query = $_GET['sql_query']; } // This one is just to fill $db -if (isset($_POST['fields']['dbase'])) { - $db = $_POST['fields']['dbase']; +if (isset($_POST['bkm_fields']['bkm_database'])) { + $db = $_POST['bkm_fields']['bkm_database']; } @@ -246,14 +246,14 @@ if (isset($find_real_end) && $find_real_end) { */ if (isset($_POST['store_bkm'])) { $result = PMA_Bookmark_save( - $_POST['fields'], + $_POST['bkm_fields'], (isset($_POST['bkm_all_users']) && $_POST['bkm_all_users'] == 'true' ? true : false) ); $response = PMA_Response::getInstance(); if ($response->isAjax()) { if ($result) { $msg = PMA_message::success(__('Bookmark %s created')); - $msg->addParam($_POST['fields']['label']); + $msg->addParam($_POST['bkm_fields']['bkm_label']); $response->addJSON('message', $msg); } else { $msg = PMA_message::error(__('Bookmark not created')); @@ -264,7 +264,7 @@ if (isset($_POST['store_bkm'])) { } else { // go back to sql.php to redisplay query; do not use & in this case: PMA_sendHeaderLocation( - $cfg['PmaAbsoluteUri'] . $goto . '&label=' . $_POST['fields']['label'] + $cfg['PmaAbsoluteUri'] . $goto . '&label=' . $_POST['bkm_fields']['bkm_label'] ); } } // end if @@ -1039,15 +1039,15 @@ if ((0 == $num_rows && 0 == $unlim_num_rows) || $is_affected) { . '&id_bookmark=1'; $html_output .= '
'; $html_output .= PMA_generate_common_hidden_inputs(); $html_output .= ''; - $html_output .= ''; - $html_output .= ''; - $html_output .= ''; $html_output .= '
'; @@ -1059,7 +1059,7 @@ if ((0 == $num_rows && 0 == $unlim_num_rows) || $is_affected) { $html_output .= '
'; $html_output .= ''; $html_output .= ''; + . ' name="bkm_fields[bkm_label]" value="" />'; $html_output .= '
'; $html_output .= '
'; $html_output .= ' Date: Thu, 13 Jun 2013 19:35:10 +0530 Subject: [PATCH 7/8] bookmark.lib.php corrected to use the new variable names in $_POST['bkm_fields'][..] --- libraries/bookmark.lib.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/libraries/bookmark.lib.php b/libraries/bookmark.lib.php index d2d5aecf7c..4d4ac069f2 100644 --- a/libraries/bookmark.lib.php +++ b/libraries/bookmark.lib.php @@ -138,8 +138,8 @@ function PMA_Bookmark_get($db, $id, $id_field = 'id', $action_bookmark_all = fal /** * Adds a bookmark * - * @param array $fields the properties of the bookmark to add; here, - * $fields['query'] is urlencoded + * @param array $bkm_fields the properties of the bookmark to add; here, + * $bkm_fields['bkm_sql_query'] is urlencoded * @param boolean $all_users whether to make the bookmark available for all users * * @return boolean whether the INSERT succeeds or not @@ -161,10 +161,10 @@ function PMA_Bookmark_save($fields, $all_users = false) $query = 'INSERT INTO ' . PMA_Util::backquote($cfgBookmark['db']) . '.' . PMA_Util::backquote($cfgBookmark['table']) . ' (id, dbase, user, query, label)' - . ' VALUES (NULL, \'' . PMA_Util::sqlAddSlashes($fields['dbase']) . '\', ' - . '\'' . ($all_users ? '' : PMA_Util::sqlAddSlashes($fields['user'])) . '\', ' - . '\'' . PMA_Util::sqlAddSlashes(urldecode($fields['query'])) . '\', ' - . '\'' . PMA_Util::sqlAddSlashes($fields['label']) . '\')'; + . ' VALUES (NULL, \'' . PMA_Util::sqlAddSlashes($bkm_fields['bkm_database']) . '\', ' + . '\'' . ($all_users ? '' : PMA_Util::sqlAddSlashes($bkm_fields['bkm_user'])) . '\', ' + . '\'' . PMA_Util::sqlAddSlashes(urldecode($bkm_fields['bkm_sql_query'])) . '\', ' + . '\'' . PMA_Util::sqlAddSlashes($bkm_fields['bkm_label']) . '\')'; return $GLOBALS['dbi']->query($query, $controllink); } // end of the 'PMA_Bookmark_save()' function From 01a12cd253e4f8219392215fbb0363d085a1680d Mon Sep 17 00:00:00 2001 From: Spun Nakandala Date: Thu, 13 Jun 2013 20:28:29 +0530 Subject: [PATCH 8/8] error corrected --- libraries/bookmark.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/bookmark.lib.php b/libraries/bookmark.lib.php index 4d4ac069f2..ef126232bc 100644 --- a/libraries/bookmark.lib.php +++ b/libraries/bookmark.lib.php @@ -148,7 +148,7 @@ function PMA_Bookmark_get($db, $id, $id_field = 'id', $action_bookmark_all = fal * * @global resource the controluser db connection handle */ -function PMA_Bookmark_save($fields, $all_users = false) +function PMA_Bookmark_save($bkm_fields, $all_users = false) { global $controllink;