From fa30ac8c33cc41314de46374fb14b285192fda71 Mon Sep 17 00:00:00 2001 From: Sebastian Mendel Date: Tue, 15 May 2007 11:16:10 +0000 Subject: [PATCH] store browse state in session per query --- ChangeLog | 1 + import.php | 7 - libraries/common.lib.php | 1 - libraries/display_tbl.lib.php | 428 +++++++++++++++++---------------- libraries/mult_submits.inc.php | 7 +- sql.php | 61 +---- tbl_change.php | 22 +- tbl_replace.php | 15 -- tbl_row_action.php | 14 +- 9 files changed, 238 insertions(+), 318 deletions(-) diff --git a/ChangeLog b/ChangeLog index b96d202b4..fcd674337 100644 --- a/ChangeLog +++ b/ChangeLog @@ -59,6 +59,7 @@ $HeadURL: https://phpmyadmin.svn.sourceforge.net/svnroot/phpmyadmin/trunk/phpMyA + RFE #1704779 [gui] link documentation from login page + RFE #1513345 [setup] check control user connection during setup + [structure] TRIGGERS: display/edit/drop/SQL export ++ [browse] store browse state in session per query 2.10.2.0 (not yet released) diff --git a/import.php b/import.php index 89f8a292f..bf5725526 100644 --- a/import.php +++ b/import.php @@ -407,13 +407,6 @@ if (isset($my_die)) { } if ($go_sql) { - if (isset($_GET['pos'])) { - // comes from the Refresh link - $pos = $_GET['pos']; - } else { - // Set pos to zero to possibly append limit - $pos = 0; - } require './sql.php'; } else { $active_page = $goto; diff --git a/libraries/common.lib.php b/libraries/common.lib.php index cc9641766..60958e5f0 100644 --- a/libraries/common.lib.php +++ b/libraries/common.lib.php @@ -1200,7 +1200,6 @@ function PMA_showMessage($message, $sql_query = null) $refresh_link = 'import.php' . $url_qpart . '&show_query=1' - . (isset($_GET['pos']) ? '&pos=' . $_GET['pos'] : '') . '&sql_query=' . urlencode($sql_query); $refresh_link = ' [' . PMA_linkOrButton($refresh_link, $GLOBALS['strRefresh']) . ']'; } else { diff --git a/libraries/display_tbl.lib.php b/libraries/display_tbl.lib.php index 75f3b54f4..ad4727f54 100644 --- a/libraries/display_tbl.lib.php +++ b/libraries/display_tbl.lib.php @@ -14,16 +14,6 @@ require_once './libraries/Table.class.php'; * Set of functions used to display the records returned by a SQL query */ -/** - * Avoids undefined variables - */ -if (!isset($pos)) { - $pos = 0; -} else { - /* We need this to be a integer */ - $pos = (int)$pos; -} - /** * Defines the display mode to use for the results of a SQL query * @@ -197,6 +187,10 @@ function PMA_setDisplayMode(&$the_disp_mode, &$the_total) /** * Displays a navigation bar to browse among the results of a SQL query * + * @uses $_SESSION['userconf']['disp_direction'] + * @uses $_SESSION['userconf']['repeat_cells'] + * @uses $_SESSION['userconf']['max_rows'] + * @uses $_SESSION['userconf']['pos'] * @param integer the offset for the "next" page * @param integer the offset for the "previous" page * @param string the URL-encoded query @@ -204,19 +198,10 @@ function PMA_setDisplayMode(&$the_disp_mode, &$the_total) * @global string $db the database name * @global string $table the table name * @global string $goto the URL to go back in case of errors - * @global boolean $dontlimitchars whether to limit the number of displayed - * characters of text type fields or not * @global integer $num_rows the total number of rows returned by the * SQL query * @global integer $unlim_num_rows the total number of rows returned by the * SQL any programmatically appended "LIMIT" clause - * @global integer $pos the current position in results - * @global mixed $session_max_rows the maximum number of rows per page - * ('all' = no limit) - * @global string $disp_direction the display mode - * (horizontal / vertical / horizontalflipped) - * @global integer $repeat_cells the number of row to display between two - * table headers * @global boolean $is_innodb whether its InnoDB or not * @global array $showtable table definitions * @@ -226,9 +211,8 @@ function PMA_setDisplayMode(&$the_disp_mode, &$the_total) */ function PMA_displayTableNavigation($pos_next, $pos_prev, $sql_query) { - global $db, $table, $goto, $dontlimitchars; - global $num_rows, $unlim_num_rows, $pos, $session_max_rows; - global $disp_direction, $repeat_cells; + global $db, $table, $goto; + global $num_rows, $unlim_num_rows; global $is_innodb; global $showtable; @@ -247,7 +231,7 @@ function PMA_displayTableNavigation($pos_next, $pos_prev, $sql_query) 0 && $session_max_rows != 'all') { + if ($_SESSION['userconf']['pos'] && $_SESSION['userconf']['max_rows'] != 'all') { // loic1: patch #474210 from Gosha Sakovich - part 1 if ($GLOBALS['cfg']['NavigationBarIconic']) { $caption1 = '<<'; @@ -266,11 +250,7 @@ function PMA_displayTableNavigation($pos_next, $pos_prev, $sql_query) - - - - /> @@ -279,11 +259,7 @@ function PMA_displayTableNavigation($pos_next, $pos_prev, $sql_query) - - - - /> @@ -299,21 +275,20 @@ function PMA_displayTableNavigation($pos_next, $pos_prev, $sql_query) - - +
' . "\n" - . ' ' . "\n" - . ' ' . "\n" - . ' ' . "\n" + . ' ' . "\n" + . ' ' . "\n" + . ' ' . "\n" . ' ' . "\n" . ' '; - $param2 = ' ' . "\n" + $param2 = ' ' . "\n" . ' '; echo ' ' . sprintf($GLOBALS['strRowsModeOptions'], "\n" . $param1, "\n" . $param2) . "\n"; ?> @@ -324,8 +299,8 @@ function PMA_displayTableNavigation($pos_next, $pos_prev, $sql_query) = $session_max_rows - && $session_max_rows != 'all') { + if (($_SESSION['userconf']['pos'] + $_SESSION['userconf']['max_rows'] < $unlim_num_rows) && $num_rows >= $_SESSION['userconf']['max_rows'] + && $_SESSION['userconf']['max_rows'] != 'all') { // loic1: patch #474210 from Gosha Sakovich - part 2 if ($GLOBALS['cfg']['NavigationBarIconic']) { $caption3 = ' > '; @@ -345,20 +320,16 @@ function PMA_displayTableNavigation($pos_next, $pos_prev, $sql_query) - - - - />
+ onsubmit="return = $_SESSION['userconf']['max_rows']) ? 'true' : 'false'); ?>"> - + $GLOBALS['cfg']['MaxExactCount']) { echo '' . "\n"; @@ -366,11 +337,7 @@ function PMA_displayTableNavigation($pos_next, $pos_prev, $sql_query) $onclick = ' onclick="return confirmAction(\'' . PMA_jsFormat($GLOBALS['strLongOperation'], false) . '\')"'; } ?> - - - - />
@@ -379,8 +346,8 @@ function PMA_displayTableNavigation($pos_next, $pos_prev, $sql_query) //page redirection - $pageNow = @floor($pos / $session_max_rows) + 1; - $nbTotalPage = @ceil($unlim_num_rows / $session_max_rows); + $pageNow = @floor($_SESSION['userconf']['pos'] / $_SESSION['userconf']['max_rows']) + 1; + $nbTotalPage = @ceil($unlim_num_rows / $_SESSION['userconf']['max_rows']); if ($nbTotalPage > 1){ //if1 ?> @@ -392,14 +359,10 @@ function PMA_displayTableNavigation($pos_next, $pos_prev, $sql_query)
" /> - - -
@@ -444,6 +404,10 @@ function PMA_displayTableNavigation($pos_next, $pos_prev, $sql_query) /** * Displays the headers of the results table * + * @uses $_SESSION['userconf']['disp_direction'] + * @uses $_SESSION['userconf']['repeat_cells'] + * @uses $_SESSION['userconf']['max_rows'] + * @uses $_SESSION['userconf']['dontlimitchars'] * @param array which elements to display * @param array the list of fields properties * @param integer the total number of fields returned by the SQL query @@ -454,19 +418,11 @@ function PMA_displayTableNavigation($pos_next, $pos_prev, $sql_query) * @global string $db the database name * @global string $table the table name * @global string $goto the URL to go back in case of errors - * @global boolean $dontlimitchars whether to limit the number of displayed - * characters of text type fields or not - * @global string $sql_query the sql query + * @global string $sql_query the SQL query * @global integer $num_rows the total number of rows returned by the * SQL query - * @global integer $pos the current position in results - * @global integer $session_max_rows the maximum number of rows per page * @global array $vertical_display informations used with vertical display * mode - * @global string $disp_direction the display mode - * (horizontal/vertical/horizontalflipped) - * @global integer $repeat_cellsthe number of row to display between two - * table headers * * @access private * @@ -474,9 +430,9 @@ function PMA_displayTableNavigation($pos_next, $pos_prev, $sql_query) */ function PMA_displayTableHeaders(&$is_display, &$fields_meta, $fields_cnt = 0, $analyzed_sql = '') { - global $db, $table, $goto, $dontlimitchars; - global $sql_query, $num_rows, $pos, $session_max_rows; - global $vertical_display, $disp_direction, $repeat_cells, $highlight_columns; + global $db, $table, $goto; + global $sql_query, $num_rows; + global $vertical_display, $highlight_columns; if ($analyzed_sql == '') { $analyzed_sql = array(); @@ -544,7 +500,8 @@ function PMA_displayTableHeaders(&$is_display, &$fields_meta, $fields_cnt = 0, $ // do we have any index? if (isset($indexes_data)) { - if ($disp_direction == 'horizontal' || $disp_direction == 'horizontalflipped') { + if ($_SESSION['userconf']['disp_direction'] == 'horizontal' + || $_SESSION['userconf']['disp_direction'] == 'horizontalflipped') { $span = $fields_cnt; if ($is_display['edit_lnk'] != 'nn') { $span++; @@ -556,16 +513,11 @@ function PMA_displayTableHeaders(&$is_display, &$fields_meta, $fields_cnt = 0, $ $span++; } } else { - $span = $num_rows + floor($num_rows/$repeat_cells) + 1; + $span = $num_rows + floor($num_rows/$_SESSION['userconf']['repeat_cells']) + 1; } echo '
' . "\n"; echo PMA_generate_common_hidden_inputs($db, $table, 5); - echo '' . "\n"; - echo '' . "\n"; - echo '' . "\n"; - echo '' . "\n"; - echo '' . "\n"; echo $GLOBALS['strSortByKey'] . ': ' . "\n"; - echo '' . "\n"; - echo '' . "\n"; - echo '' . "\n"; - echo '' . "\n"; echo '' . "\n"; } echo '' . "\n"; - if ($disp_direction == 'horizontal' || $disp_direction == 'horizontalflipped') { + if ($_SESSION['userconf']['disp_direction'] == 'horizontal' + || $_SESSION['userconf']['disp_direction'] == 'horizontalflipped') { echo '' . "\n"; } // 1. Displays the full/partial text button (part 1)... - if ($disp_direction == 'horizontal' || $disp_direction == 'horizontalflipped') { + if ($_SESSION['userconf']['disp_direction'] == 'horizontal' + || $_SESSION['userconf']['disp_direction'] == 'horizontalflipped') { $colspan = ($is_display['edit_lnk'] != 'nn' && $is_display['del_lnk'] != 'nn') ? ' colspan="3"' : ''; @@ -631,20 +580,22 @@ function PMA_displayTableHeaders(&$is_display, &$fields_meta, $fields_cnt = 0, $ $text_url = 'sql.php?' . PMA_generate_common_url($db, $table) . '&sql_query=' . urlencode($sql_query) - . '&session_max_rows=' . $session_max_rows - . '&pos=' . $pos - . '&disp_direction=' . $disp_direction - . '&repeat_cells=' . $repeat_cells - . '&goto=' . $goto - . '&dontlimitchars=' . (($dontlimitchars) ? 0 : 1); - $text_message = '' . ($dontlimitchars ? $GLOBALS['strPartialText'] : $GLOBALS['strFullText']) . ''; + . '&goto=' . $goto; + $text_message = ''
+        . ($_SESSION['userconf']['dontlimitchars'] ? $GLOBALS['strPartialText'] : $GLOBALS['strFullText'])
+        . ''; $text_link = PMA_linkOrButton($text_url, $text_message, array(), false); // ... before the result table if (($is_display['edit_lnk'] == 'nn' && $is_display['del_lnk'] == 'nn') && $is_display['text_btn'] == '1') { $vertical_display['emptypre'] = ($is_display['edit_lnk'] != 'nn' && $is_display['del_lnk'] != 'nn') ? 3 : 0; - if ($disp_direction == 'horizontal' || $disp_direction == 'horizontalflipped') { + if ($_SESSION['userconf']['disp_direction'] == 'horizontal' + || $_SESSION['userconf']['disp_direction'] == 'horizontalflipped') { ?> @@ -654,7 +605,7 @@ function PMA_displayTableHeaders(&$is_display, &$fields_meta, $fields_cnt = 0, $ else { ?> - > = 40100) && $disp_direction != 'horizontalflipped') { + if ($GLOBALS['cfg']['ShowBrowseComments'] + && ($GLOBALS['cfgRelation']['commwork'] + || PMA_MYSQL_INT_VERSION >= 40100) + && $_SESSION['userconf']['disp_direction'] != 'horizontalflipped') { $comments_map = array(); if (isset($analyzed_sql[0]) && is_array($analyzed_sql[0])) { foreach ($analyzed_sql[0]['table_ref'] as $tbl) { @@ -824,11 +780,6 @@ function PMA_displayTableHeaders(&$is_display, &$fields_meta, $fields_cnt = 0, $ $sorted_sql_query = $unsorted_sql_query . $sort_order; } $url_query = PMA_generate_common_url($db, $table) - . '&pos=' . $pos - . '&session_max_rows=' . $session_max_rows - . '&disp_direction=' . $disp_direction - . '&repeat_cells=' . $repeat_cells - . '&dontlimitchars=' . $dontlimitchars . '&sql_query=' . urlencode($sorted_sql_query); $order_url = 'sql.php?' . $url_query; @@ -845,20 +796,21 @@ function PMA_displayTableHeaders(&$is_display, &$fields_meta, $fields_cnt = 0, $ $order_link_params['onmouseout'] = 'if(document.getElementById(\'soimg' . $i . '\')){ document.getElementById(\'soimg' . $i . '\').src=\'' . $GLOBALS['pmaThemeImage'] . 's_desc.png\'; }'; } } - if ($disp_direction == 'horizontalflipped' - && $GLOBALS['cfg']['HeaderFlipType'] == 'css') { + if ($_SESSION['userconf']['disp_direction'] == 'horizontalflipped' + && $GLOBALS['cfg']['HeaderFlipType'] == 'css') { $order_link_params['style'] = 'direction: ltr; writing-mode: tb-rl;'; } $order_link_params['title'] = $GLOBALS['strSort']; - $order_link_content = ($disp_direction == 'horizontalflipped' && $GLOBALS['cfg']['HeaderFlipType'] == 'fake' ? PMA_flipstring(htmlspecialchars($fields_meta[$i]->name), "
\n") : htmlspecialchars($fields_meta[$i]->name)); + $order_link_content = ($_SESSION['userconf']['disp_direction'] == 'horizontalflipped' && $GLOBALS['cfg']['HeaderFlipType'] == 'fake' ? PMA_flipstring(htmlspecialchars($fields_meta[$i]->name), "
\n") : htmlspecialchars($fields_meta[$i]->name)); $order_link = PMA_linkOrButton($order_url, $order_link_content . $order_img, $order_link_params, false, true); - if ($disp_direction == 'horizontal' || $disp_direction == 'horizontalflipped') { + if ($_SESSION['userconf']['disp_direction'] == 'horizontal' + || $_SESSION['userconf']['disp_direction'] == 'horizontalflipped') { echo '' . $order_link . $comments . ''; @@ -870,20 +822,21 @@ function PMA_displayTableHeaders(&$is_display, &$fields_meta, $fields_cnt = 0, $ // 2.2 Results can't be sorted else { - if ($disp_direction == 'horizontal' || $disp_direction == 'horizontalflipped') { + if ($_SESSION['userconf']['disp_direction'] == 'horizontal' + || $_SESSION['userconf']['disp_direction'] == 'horizontalflipped') { echo ''; - if ($disp_direction == 'horizontalflipped' + if ($_SESSION['userconf']['disp_direction'] == 'horizontalflipped' && $GLOBALS['cfg']['HeaderFlipType'] == 'fake') { echo PMA_flipstring(htmlspecialchars($fields_meta[$i]->name), '
'); } else { @@ -904,7 +857,8 @@ function PMA_displayTableHeaders(&$is_display, &$fields_meta, $fields_cnt = 0, $ && ($is_display['edit_lnk'] != 'nn' || $is_display['del_lnk'] != 'nn') && $is_display['text_btn'] == '1') { $vertical_display['emptyafter'] = ($is_display['edit_lnk'] != 'nn' && $is_display['del_lnk'] != 'nn') ? 3 : 1; - if ($disp_direction == 'horizontal' || $disp_direction == 'horizontalflipped') { + if ($_SESSION['userconf']['disp_direction'] == 'horizontal' + || $_SESSION['userconf']['disp_direction'] == 'horizontalflipped') { echo "\n"; ?>
@@ -951,6 +907,10 @@ function PMA_displayTableHeaders(&$is_display, &$fields_meta, $fields_cnt = 0, $ /** * Displays the body of the results table * + * @uses $_SESSION['userconf']['disp_direction'] + * @uses $_SESSION['userconf']['repeat_cells'] + * @uses $_SESSION['userconf']['max_rows'] + * @uses $_SESSION['userconf']['dontlimitchars'] * @param integer the link id associated to the query which results have * to be displayed * @param array which elements to display @@ -962,31 +922,23 @@ function PMA_displayTableHeaders(&$is_display, &$fields_meta, $fields_cnt = 0, $ * @global string $db the database name * @global string $table the table name * @global string $goto the URL to go back in case of errors - * @global boolean $dontlimitchars whether to limit the number of displayed - * characters of text type fields or not * @global string $sql_query the SQL query - * @global integer $pos the current position in results - * @global integer $session_max_rows the maximum number of rows per page * @global array $fields_meta the list of fields properties * @global integer $fields_cnt the total number of fields returned by * the SQL query * @global array $vertical_display informations used with vertical display * mode - * @global string $disp_direction the display mode - * (horizontal/vertical/horizontalflipped) - * @global integer $repeat_cells the number of row to display between two - * table headers - * @global array $highlight_columns collumn names to highlight - * @gloabl array $row current row data + * @global array $highlight_columns column names to highlight + * @global array $row current row data * * @access private * * @see PMA_displayTable() */ function PMA_displayTableBody(&$dt_result, &$is_display, $map, $analyzed_sql) { - global $db, $table, $goto, $dontlimitchars; - global $sql_query, $pos, $session_max_rows, $fields_meta, $fields_cnt; - global $vertical_display, $disp_direction, $repeat_cells, $highlight_columns; + global $db, $table, $goto; + global $sql_query, $fields_meta, $fields_cnt; + global $vertical_display, $highlight_columns; global $row; // mostly because of browser transformations, to make the row-data accessible in a plugin $url_sql_query = $sql_query; @@ -1041,9 +993,9 @@ function PMA_displayTableBody(&$dt_result, &$is_display, $map, $analyzed_sql) { $odd_row = true; while ($row = PMA_DBI_fetch_row($dt_result)) { // lem9: "vertical display" mode stuff - if ($row_no != 0 && $repeat_cells != 0 && !($row_no % $repeat_cells) - && ($disp_direction == 'horizontal' - || $disp_direction == 'horizontalflipped')) + if ($row_no != 0 && $_SESSION['userconf']['repeat_cells'] != 0 && !($row_no % $_SESSION['userconf']['repeat_cells']) + && ($_SESSION['userconf']['disp_direction'] == 'horizontal' + || $_SESSION['userconf']['disp_direction'] == 'horizontalflipped')) { echo '' . "\n"; if ($vertical_display['emptypre'] > 0) { @@ -1064,7 +1016,8 @@ function PMA_displayTableBody(&$dt_result, &$is_display, $map, $analyzed_sql) { $class = $odd_row ? 'odd' : 'even'; $odd_row = ! $odd_row; - if ($disp_direction == 'horizontal' || $disp_direction == 'horizontalflipped') { + if ($_SESSION['userconf']['disp_direction'] == 'horizontal' + || $_SESSION['userconf']['disp_direction'] == 'horizontalflipped') { // loic1: pointer code part echo ' ' . "\n"; $class = ''; @@ -1082,12 +1035,7 @@ function PMA_displayTableBody(&$dt_result, &$is_display, $map, $analyzed_sql) { $unique_condition = urlencode(PMA_getUniqueCondition($dt_result, $fields_cnt, $fields_meta, $row)); // 1.2 Defines the URLs for the modify/delete link(s) - $url_query = PMA_generate_common_url($db, $table) - . '&pos=' . $pos - . '&session_max_rows=' . $session_max_rows - . '&disp_direction=' . $disp_direction - . '&repeat_cells=' . $repeat_cells - . '&dontlimitchars=' . $dontlimitchars; + $url_query = PMA_generate_common_url($db, $table); if ($is_display['edit_lnk'] != 'nn' || $is_display['del_lnk'] != 'nn') { // We need to copy the value or else the == 'both' check will always return true @@ -1187,7 +1135,8 @@ function PMA_displayTableBody(&$dt_result, &$is_display, $map, $analyzed_sql) { // 1.3 Displays the links at left if required if ($GLOBALS['cfg']['ModifyDeleteAtLeft'] - && ($disp_direction == 'horizontal' || $disp_direction == 'horizontalflipped')) { + && ($_SESSION['userconf']['disp_direction'] == 'horizontal' + || $_SESSION['userconf']['disp_direction'] == 'horizontalflipped')) { $doWriteModifyAt = 'left'; require './libraries/display_tbl_links.lib.php'; } // end if (1.3) @@ -1209,7 +1158,7 @@ function PMA_displayTableBody(&$dt_result, &$is_display, $map, $analyzed_sql) { } $mouse_events = ''; - if ($disp_direction == 'vertical' && (!isset($GLOBALS['printview']) || ($GLOBALS['printview'] != '1'))) { + if ($_SESSION['userconf']['disp_direction'] == 'vertical' && (!isset($GLOBALS['printview']) || ($GLOBALS['printview'] != '1'))) { if ($GLOBALS['cfg']['BrowsePointerEnable'] == true) { $mouse_events .= ' onmouseover="setVerticalPointer(this, ' . $row_no . ', \'over\', \'odd\', \'even\', \'hover\', \'marked\');"' . ' onmouseout="setVerticalPointer(this, ' . $row_no . ', \'out\', \'odd\', \'even\', \'hover\', \'marked\');" '; @@ -1310,7 +1259,7 @@ function PMA_displayTableBody(&$dt_result, &$is_display, $map, $analyzed_sql) { $vertical_display['data'][$row_no][$i] .= '' . ($transform_function != $default_function ? $transform_function($row[$i], $transform_options, $meta) : $transform_function($row[$i], array(), $meta)) . ''; } @@ -1357,7 +1306,7 @@ function PMA_displayTableBody(&$dt_result, &$is_display, $map, $analyzed_sql) { $vertical_display['data'][$row_no][$i] = ' NULL' . "\n"; } elseif ($row[$i] != '') { // garvin: if a transform function for blob is set, none of these replacements will be made - if (PMA_strlen($row[$i]) > $GLOBALS['cfg']['LimitChars'] && ($dontlimitchars != 1)) { + if (PMA_strlen($row[$i]) > $GLOBALS['cfg']['LimitChars'] && ! $_SESSION['userconf']['dontlimitchars']) { $row[$i] = PMA_substr($row[$i], 0, $GLOBALS['cfg']['LimitChars']) . '...'; } // loic1: displays all space characters, 4 space @@ -1378,7 +1327,7 @@ function PMA_displayTableBody(&$dt_result, &$is_display, $map, $analyzed_sql) { // nijel: Cut all fields to $GLOBALS['cfg']['LimitChars'] // lem9: (unless it's a link-type transformation) - if (PMA_strlen($row[$i]) > $GLOBALS['cfg']['LimitChars'] && ($dontlimitchars != 1) && !strpos($transform_function, 'link') === true) { + if (PMA_strlen($row[$i]) > $GLOBALS['cfg']['LimitChars'] && ! $_SESSION['userconf']['dontlimitchars'] && !strpos($transform_function, 'link') === true) { $row[$i] = PMA_substr($row[$i], 0, $GLOBALS['cfg']['LimitChars']) . '...'; } @@ -1446,7 +1395,7 @@ function PMA_displayTableBody(&$dt_result, &$is_display, $map, $analyzed_sql) { $vertical_display['data'][$row_no][$i] .= '' . $row[$i] . ''; } else { @@ -1459,7 +1408,8 @@ function PMA_displayTableBody(&$dt_result, &$is_display, $map, $analyzed_sql) { } // lem9: output stored cell - if ($disp_direction == 'horizontal' || $disp_direction == 'horizontalflipped') { + if ($_SESSION['userconf']['disp_direction'] == 'horizontal' + || $_SESSION['userconf']['disp_direction'] == 'horizontalflipped') { echo $vertical_display['data'][$row_no][$i]; } @@ -1472,12 +1422,14 @@ function PMA_displayTableBody(&$dt_result, &$is_display, $map, $analyzed_sql) { // 3. Displays the modify/delete links on the right if required if ($GLOBALS['cfg']['ModifyDeleteAtRight'] - && ($disp_direction == 'horizontal' || $disp_direction == 'horizontalflipped')) { + && ($_SESSION['userconf']['disp_direction'] == 'horizontal' + || $_SESSION['userconf']['disp_direction'] == 'horizontalflipped')) { $doWriteModifyAt = 'right'; require './libraries/display_tbl_links.lib.php'; } // end if (3) - if ($disp_direction == 'horizontal' || $disp_direction == 'horizontalflipped') { + if ($_SESSION['userconf']['disp_direction'] == 'horizontal' + || $_SESSION['userconf']['disp_direction'] == 'horizontalflipped') { ?> 0 || !empty($vertical_display['textbtn']))) { @@ -1564,7 +1515,7 @@ function PMA_displayVerticalTable() echo $vertical_display['textbtn']; $foo_counter = 0; foreach ($vertical_display['row_delete'] as $val) { - if (($foo_counter != 0) && ($repeat_cells != 0) && !($foo_counter % $repeat_cells)) { + if (($foo_counter != 0) && ($_SESSION['userconf']['repeat_cells'] != 0) && !($foo_counter % $_SESSION['userconf']['repeat_cells'])) { echo '' . "\n"; } @@ -1582,7 +1533,7 @@ function PMA_displayVerticalTable() } $foo_counter = 0; foreach ($vertical_display['edit'] as $val) { - if (($foo_counter != 0) && ($repeat_cells != 0) && !($foo_counter % $repeat_cells)) { + if (($foo_counter != 0) && ($_SESSION['userconf']['repeat_cells'] != 0) && !($foo_counter % $_SESSION['userconf']['repeat_cells'])) { echo ' ' . "\n"; } @@ -1600,7 +1551,7 @@ function PMA_displayVerticalTable() } $foo_counter = 0; foreach ($vertical_display['delete'] as $val) { - if (($foo_counter != 0) && ($repeat_cells != 0) && !($foo_counter % $repeat_cells)) { + if (($foo_counter != 0) && ($_SESSION['userconf']['repeat_cells'] != 0) && !($foo_counter % $_SESSION['userconf']['repeat_cells'])) { echo '' . "\n"; } @@ -1618,7 +1569,7 @@ function PMA_displayVerticalTable() $foo_counter = 0; foreach ($vertical_display['rowdata'][$key] as $subval) { - if (($foo_counter != 0) && ($repeat_cells != 0) and !($foo_counter % $repeat_cells)) { + if (($foo_counter != 0) && ($_SESSION['userconf']['repeat_cells'] != 0) and !($foo_counter % $_SESSION['userconf']['repeat_cells'])) { echo $val; } @@ -1635,7 +1586,7 @@ function PMA_displayVerticalTable() echo $vertical_display['textbtn']; $foo_counter = 0; foreach ($vertical_display['row_delete'] as $val) { - if (($foo_counter != 0) && ($repeat_cells != 0) && !($foo_counter % $repeat_cells)) { + if (($foo_counter != 0) && ($_SESSION['userconf']['repeat_cells'] != 0) && !($foo_counter % $_SESSION['userconf']['repeat_cells'])) { echo '' . "\n"; } @@ -1653,7 +1604,7 @@ function PMA_displayVerticalTable() } $foo_counter = 0; foreach ($vertical_display['edit'] as $val) { - if (($foo_counter != 0) && ($repeat_cells != 0) && !($foo_counter % $repeat_cells)) { + if (($foo_counter != 0) && ($_SESSION['userconf']['repeat_cells'] != 0) && !($foo_counter % $_SESSION['userconf']['repeat_cells'])) { echo '' . "\n"; } @@ -1671,7 +1622,7 @@ function PMA_displayVerticalTable() } $foo_counter = 0; foreach ($vertical_display['delete'] as $val) { - if (($foo_counter != 0) && ($repeat_cells != 0) && !($foo_counter % $repeat_cells)) { + if (($foo_counter != 0) && ($_SESSION['userconf']['repeat_cells'] != 0) && !($foo_counter % $_SESSION['userconf']['repeat_cells'])) { echo '' . "\n"; } @@ -1684,6 +1635,96 @@ function PMA_displayVerticalTable() return true; } // end of the 'PMA_displayVerticalTable' function +/** + * + * @uses $_SESSION['userconf']['disp_direction'] + * @uses $_REQUEST['disp_direction'] + * @uses $GLOBALS['cfg']['DefaultDisplay'] + * @uses $_SESSION['userconf']['repeat_cells'] + * @uses $_REQUEST['repeat_cells'] + * @uses $GLOBALS['cfg']['RepeatCells'] + * @uses $_SESSION['userconf']['max_rows'] + * @uses $_REQUEST['session_max_rows'] + * @uses $GLOBALS['cfg']['MaxRows'] + * @uses $_SESSION['userconf']['pos'] + * @uses $_REQUEST['pos'] + * @uses $_SESSION['userconf']['dontlimitchars'] + * @uses $_REQUEST['dontlimitchars'] + * @uses PMA_isValid() + * @uses $GLOBALS['sql_query'] + * @todo make maximum remembered queries configurable + * @todo move/split into SQL class!? + * @todo currently this is called twice unnecessary + * @todo ignore LIMIT and ORDER in query!? + */ +function PMA_displayTable_checkConfigParams() +{ + $sql_key = md5($GLOBALS['sql_query']); + + $_SESSION['userconf']['query'][$sql_key]['sql'] = $GLOBALS['sql_query']; + + if (PMA_isValid($_REQUEST['disp_direction'], array('horizontal', 'vertical', 'horizontalflipped'))) { + $_SESSION['userconf']['query'][$sql_key]['disp_direction'] = $_REQUEST['disp_direction']; + unset($_REQUEST['disp_direction']); + } elseif (empty($_SESSION['userconf']['query'][$sql_key]['disp_direction'])) { + $_SESSION['userconf']['query'][$sql_key]['disp_direction'] = $GLOBALS['cfg']['DefaultDisplay']; + } + + if (PMA_isValid($_REQUEST['repeat_cells'], 'numeric')) { + $_SESSION['userconf']['query'][$sql_key]['repeat_cells'] = $_REQUEST['repeat_cells']; + unset($_REQUEST['repeat_cells']); + } elseif (empty($_SESSION['userconf']['query'][$sql_key]['repeat_cells'])) { + $_SESSION['userconf']['query'][$sql_key]['repeat_cells'] = $GLOBALS['cfg']['RepeatCells']; + } + + if (PMA_isValid($_REQUEST['session_max_rows'], 'numeric')) { + $_SESSION['userconf']['query'][$sql_key]['max_rows'] = $_REQUEST['session_max_rows']; + unset($_REQUEST['session_max_rows']); + } elseif (empty($_SESSION['userconf']['query'][$sql_key]['max_rows'])) { + $_SESSION['userconf']['query'][$sql_key]['max_rows'] = $GLOBALS['cfg']['MaxRows']; + } + + if (PMA_isValid($_REQUEST['pos'], 'numeric')) { + $_SESSION['userconf']['query'][$sql_key]['pos'] = $_REQUEST['pos']; + unset($_REQUEST['pos']); + } elseif (empty($_SESSION['userconf']['query'][$sql_key]['pos'])) { + $_SESSION['userconf']['query'][$sql_key]['pos'] = 0; + } + + if (PMA_isValid($_REQUEST['dontlimitchars'], array('0', '1'))) { + $_SESSION['userconf']['query'][$sql_key]['dontlimitchars'] = (int) $_REQUEST['dontlimitchars']; + unset($_REQUEST['dontlimitchars']); + } elseif (empty($_SESSION['userconf']['query'][$sql_key]['dontlimitchars'])) { + $_SESSION['userconf']['query'][$sql_key]['dontlimitchars'] = 0; + } + + // move current query to the last position, to be removed last + // so only least executed query will be removed if maximum remembered queries + // limit is reached + $tmp = $_SESSION['userconf']['query'][$sql_key]; + unset($_SESSION['userconf']['query'][$sql_key]); + $_SESSION['userconf']['query'][$sql_key] = $tmp; + + // do not exceed a maximum number of queries to remember + if (count($_SESSION['userconf']['query']) > 10) { + array_shift($_SESSION['userconf']['query']); + echo 'deleting one element ...'; + } + + // populate query configuration + $_SESSION['userconf']['dontlimitchars'] = $_SESSION['userconf']['query'][$sql_key]['dontlimitchars']; + $_SESSION['userconf']['pos'] = $_SESSION['userconf']['query'][$sql_key]['pos']; + $_SESSION['userconf']['max_rows'] = $_SESSION['userconf']['query'][$sql_key]['max_rows']; + $_SESSION['userconf']['repeat_cells'] = $_SESSION['userconf']['query'][$sql_key]['repeat_cells']; + $_SESSION['userconf']['disp_direction'] = $_SESSION['userconf']['query'][$sql_key]['disp_direction']; + + /* + * debugging + echo '
';
+    var_dump($_SESSION['userconf']);
+    echo '
'; + */ +} /** * Displays a table of results returned by a SQL query. @@ -1694,29 +1735,22 @@ function PMA_displayVerticalTable() * @param array the display mode * @param array the analyzed query * + * @uses $_SESSION['userconf']['pos'] * @global string $db the database name * @global string $table the table name * @global string $goto the URL to go back in case of errors - * @global boolean $dontlimitchars whether to limit the number of displayed - * characters of text type fields or not - * @global string $sql_query the current sql query + * @global string $sql_query the current SQL query * @global integer $num_rows the total number of rows returned by the * SQL query * @global integer $unlim_num_rows the total number of rows returned by the * SQL query without any programmatically * appended "LIMIT" clause - * @global integer $pos the current postion of the first record - * to be displayed * @global array $fields_meta the list of fields properties * @global integer $fields_cnt the total number of fields returned by * the SQL query * @global array $vertical_display informations used with vertical display * mode - * @global string $disp_direction the display mode - * (horizontal/vertical/horizontalflipped) - * @global integer $repeat_cells the number of row to display between two - * table headers - * @global array $highlight_columns collumn names to highlight + * @global array $highlight_columns column names to highlight * @global array $cfgRelation the relation settings * * @access private @@ -1727,12 +1761,14 @@ function PMA_displayVerticalTable() */ function PMA_displayTable(&$dt_result, &$the_disp_mode, $analyzed_sql) { - global $db, $table, $goto, $dontlimitchars; - global $sql_query, $num_rows, $unlim_num_rows, $pos, $fields_meta, $fields_cnt; - global $vertical_display, $disp_direction, $repeat_cells, $highlight_columns; + global $db, $table, $goto; + global $sql_query, $num_rows, $unlim_num_rows, $fields_meta, $fields_cnt; + global $vertical_display, $highlight_columns; global $cfgRelation; global $showtable; + PMA_displayTable_checkConfigParams(); + /** * @todo move this to a central place * @todo for other future table types @@ -1766,15 +1802,12 @@ function PMA_displayTable(&$dt_result, &$the_disp_mode, $analyzed_sql) // 1.2 Defines offsets for the next and previous pages if ($is_display['nav_bar'] == '1') { - if (!isset($pos)) { - $pos = 0; - } - if ($GLOBALS['session_max_rows'] == 'all') { + if ($_SESSION['userconf']['max_rows'] == 'all') { $pos_next = 0; $pos_prev = 0; } else { - $pos_next = $pos + $GLOBALS['cfg']['MaxRows']; - $pos_prev = $pos - $GLOBALS['cfg']['MaxRows']; + $pos_next = $_SESSION['userconf']['pos'] + $_SESSION['userconf']['max_rows']; + $pos_prev = $_SESSION['userconf']['pos'] - $_SESSION['userconf']['max_rows']; if ($pos_prev < 0) { $pos_prev = 0; } @@ -1793,10 +1826,10 @@ function PMA_displayTable(&$dt_result, &$the_disp_mode, $analyzed_sql) } else { $selectstring = ''; } - $last_shown_rec = ($GLOBALS['session_max_rows'] == 'all' || $pos_next > $total) + $last_shown_rec = ($_SESSION['userconf']['max_rows'] == 'all' || $pos_next > $total) ? $total - 1 : $pos_next - 1; - PMA_showMessage($GLOBALS['strShowingRecords'] . " $pos - $last_shown_rec (" . $pre_count . PMA_formatNumber($total, 0) . $after_count . ' ' . $GLOBALS['strTotal'] . $selectstring . ', ' . sprintf($GLOBALS['strQueryTime'], $GLOBALS['querytime']) . ')'); + PMA_showMessage($GLOBALS['strShowingRecords'] . ' ' . $_SESSION['userconf']['pos'] . ' - ' . $last_shown_rec . ' (' . $pre_count . PMA_formatNumber($total, 0) . $after_count . ' ' . $GLOBALS['strTotal'] . $selectstring . ', ' . sprintf($GLOBALS['strQueryTime'], $GLOBALS['querytime']) . ')'); if (PMA_Table::isView($db, $table) && $total == $GLOBALS['cfg']['MaxExactCount']) { echo '
' . "\n"; @@ -1876,7 +1909,7 @@ function PMA_displayTable(&$dt_result, &$the_disp_mode, $analyzed_sql) PMA_displayTableBody($dt_result, $is_display, $map, $analyzed_sql); echo '
' . "\n"; // vertical output case - if ($disp_direction == 'vertical') { + if ($_SESSION['userconf']['disp_direction'] == 'vertical') { PMA_displayVerticalTable(); } // end if unset($vertical_display); @@ -1893,16 +1926,10 @@ function PMA_displayTable(&$dt_result, &$the_disp_mode, $analyzed_sql) $uncheckall_url = 'sql.php?' . PMA_generate_common_url($db, $table) . '&sql_query=' . urlencode($sql_query) - . '&pos=' . $pos - . '&session_max_rows=' . $GLOBALS['session_max_rows'] - . '&pos=' . $pos - . '&disp_direction=' . $disp_direction - . '&repeat_cells=' . $repeat_cells - . '&goto=' . $goto - . '&dontlimitchars=' . $dontlimitchars; + . '&goto=' . $goto; $checkall_url = $uncheckall_url . '&checkall=1'; - if ($disp_direction == 'vertical') { + if ($_SESSION['userconf']['disp_direction'] == 'vertical') { $checkall_params['onclick'] = 'if (setCheckboxes(\'rowsDeleteForm\', true)) return false;'; $uncheckall_params['onclick'] = 'if (setCheckboxes(\'rowsDeleteForm\', false)) return false;'; } else { @@ -1911,7 +1938,7 @@ function PMA_displayTable(&$dt_result, &$the_disp_mode, $analyzed_sql) } $checkall_link = PMA_linkOrButton($checkall_url, $GLOBALS['strCheckAll'], $checkall_params, false); $uncheckall_link = PMA_linkOrButton($uncheckall_url, $GLOBALS['strUncheckAll'], $uncheckall_params, false); - if ($disp_direction != 'vertical') { + if ($_SESSION['userconf']['disp_direction'] != 'vertical') { echo '' . $GLOBALS['strWithChecked'] . ''; @@ -1947,7 +1974,6 @@ function PMA_displayTable(&$dt_result, &$the_disp_mode, $analyzed_sql) } echo '' . "\n"; - echo '' . "\n"; echo '' . "\n"; echo '' . "\n"; @@ -1978,20 +2004,14 @@ function default_function($buffer) { * @param array the display mode * @param array the analyzed query * + * @uses $_SESSION['userconf']['pos'] + * @uses $_SESSION['userconf']['dontlimitchars'] * @global string $db the database name * @global string $table the table name - * @global boolean $dontlimitchars whether to limit the number of displayed - * characters of text type fields or not - * @global integer $pos the current postion of the first record - * to be displayed * @global string $sql_query the current SQL query * @global integer $unlim_num_rows the total number of rows returned by the * SQL query without any programmatically * appended "LIMIT" clause - * @global string $disp_direction the display mode - * (horizontal/vertical/horizontalflipped) - * @global integer $repeat_cells the number of row to display between two - * table headers * * @access private * @@ -2000,7 +2020,7 @@ function default_function($buffer) { * PMA_displayTableBody(), PMA_displayResultsOperations() */ function PMA_displayResultsOperations($the_disp_mode, $analyzed_sql) { - global $db, $table, $dontlimitchars, $pos, $sql_query, $unlim_num_rows, $disp_direction, $repeat_cells; + global $db, $table, $sql_query, $unlim_num_rows; $header_shown = FALSE; $header = '
' . $GLOBALS['strQueryResultsOperations'] . ''; @@ -2016,19 +2036,15 @@ function PMA_displayResultsOperations($the_disp_mode, $analyzed_sql) { $url_query = '?' . PMA_generate_common_url($db, $table) - . '&pos=' . $pos - . '&session_max_rows=' . $GLOBALS['session_max_rows'] - . '&disp_direction=' . $disp_direction - . '&repeat_cells=' . $repeat_cells . '&printview=1' . '&sql_query=' . urlencode($sql_query); echo ' ' . "\n"; echo PMA_linkOrButton( - 'sql.php' . $url_query . ((isset($dontlimitchars) && $dontlimitchars == '1') ? '&dontlimitchars=1' : ''), + 'sql.php' . $url_query, ($GLOBALS['cfg']['PropertiesIconic'] ? '' . $GLOBALS['strPrintView'] . '' : '') . $GLOBALS['strPrintView'], '', true, true, 'print_view') . "\n"; - if (!$dontlimitchars) { + if (! $_SESSION['userconf']['dontlimitchars']) { echo '   ' . "\n"; echo PMA_linkOrButton( 'sql.php' . $url_query . '&dontlimitchars=1', diff --git a/libraries/mult_submits.inc.php b/libraries/mult_submits.inc.php index 71f79bc2c..fe19711cb 100644 --- a/libraries/mult_submits.inc.php +++ b/libraries/mult_submits.inc.php @@ -241,7 +241,7 @@ if (!empty($submit_mult) && !empty($what)) { ?> $sval) { + foreach ($selected as $idx => $sval) { echo '' . "\n"; } if ($what == 'drop_tbl' && !empty($views)) { @@ -253,11 +253,6 @@ if (!empty($submit_mult) && !empty($what)) { echo '' . "\n"; echo '' . "\n"; echo '' . "\n"; - echo '' . "\n"; - echo '' . "\n"; - echo '' . "\n"; - echo '' . "\n"; - echo '' . "\n"; } ?>
diff --git a/sql.php b/sql.php index a3006e992..4e2c00e1e 100644 --- a/sql.php +++ b/sql.php @@ -15,13 +15,6 @@ require_once './libraries/tbl_indexes.lib.php'; require_once './libraries/check_user_privileges.lib.php'; require_once './libraries/bookmark.lib.php'; -/** - * Could be coming from a subform ("T" column expander) - */ -if (isset($_REQUEST['dontlimitchars'])) { - $dontlimitchars = $_REQUEST['dontlimitchars']; -} - /** * Defines the url to return to in case of error in a sql statement */ @@ -89,32 +82,25 @@ $is_drop_database = preg_match('/DROP[[:space:]]+(DATABASE|SCHEMA)[[:space:]]+/i * into account this case. */ if (!defined('PMA_CHK_DROP') - && !$cfg['AllowUserDropDatabase'] - && $is_drop_database - && !$is_superuser) { + && !$cfg['AllowUserDropDatabase'] + && $is_drop_database + && !$is_superuser) { require_once './libraries/header.inc.php'; PMA_mysqlDie($strNoDropDatabases, '', '', $err_url); } // end if +require_once './libraries/display_tbl.lib.php'; +PMA_displayTable_checkConfigParams(); /** * Need to find the real end of rows? */ - if (isset($find_real_end) && $find_real_end) { $unlim_num_rows = PMA_Table::countRecords($db, $table, true, true); - $pos = @((ceil($unlim_num_rows / $session_max_rows) - 1) * $session_max_rows); -} -/** - * Avoids undefined variables - */ -elseif (!isset($pos)) { - $pos = 0; -} else { - /* We need this to be a integer */ - $pos = (int)$pos; + $_SESSION['userconf']['pos'] = @((ceil($unlim_num_rows / $_SESSION['userconf']['max_rows']) - 1) * $_SESSION['userconf']['max_rows']); } + /** * Bookmark add */ @@ -145,7 +131,6 @@ if ($goto == 'sql.php') { $is_gotofile = false; $goto = 'sql.php?' . PMA_generate_common_url($db, $table) - . '&pos=' . $pos . '&sql_query=' . urlencode($sql_query); } // end if @@ -238,19 +223,6 @@ if (empty($reload) && preg_match('/^(CREATE|ALTER|DROP)\s+(VIEW|TABLE|DATABASE|SCHEMA)\s+/i', $sql_query)) { $reload = 1; } -// Gets the number of rows per page -if (empty($session_max_rows)) { - $session_max_rows = $cfg['MaxRows']; -} elseif ($session_max_rows != 'all') { - $cfg['MaxRows'] = $session_max_rows; -} -// Defines the display mode (horizontal/vertical) and header "frequency" -if (empty($disp_direction)) { - $disp_direction = $cfg['DefaultDisplay']; -} -if (empty($repeat_cells)) { - $repeat_cells = $cfg['RepeatCells']; -} // SK -- Patch: $is_group added for use in calculation of total number of // rows. @@ -290,13 +262,13 @@ if ($is_select) { // see line 141 } // Do append a "LIMIT" clause? -if (isset($pos) - && (!$cfg['ShowAll'] || $session_max_rows != 'all') +if ((!$cfg['ShowAll'] || $_SESSION['userconf']['max_rows'] != 'all') && !($is_count || $is_export || $is_func || $is_analyse) && isset($analyzed_sql[0]['queryflags']['select_from']) && !isset($analyzed_sql[0]['queryflags']['offset']) - && !preg_match('@[[:space:]]LIMIT[[:space:]0-9,-]+(;)?$@i', $sql_query)) { - $sql_limit_to_append = " LIMIT $pos, ".$cfg['MaxRows'] . " "; + && !preg_match('@[[:space:]]LIMIT[[:space:]0-9,-]+(;)?$@i', $sql_query) + ) { + $sql_limit_to_append = ' LIMIT ' . $_SESSION['userconf']['pos'] . ', ' . $_SESSION['userconf']['max_rows'] . " "; $full_sql_query = $analyzed_sql[0]['section_before_limit'] . "\n" . $sql_limit_to_append . $analyzed_sql[0]['section_after_limit']; /** @@ -401,7 +373,7 @@ if (isset($GLOBALS['show_as_php']) || !empty($GLOBALS['validatequery'])) { $unlim_num_rows = $num_rows; // if we did not append a limit, set this to get a correct // "Showing rows..." message - $GLOBALS['session_max_rows'] = 'all'; + //$_SESSION['userconf']['max_rows'] = 'all'; } elseif ($is_select) { // c o u n t q u e r y @@ -696,15 +668,11 @@ else { } // Displays the results in a table - require_once './libraries/display_tbl.lib.php'; if (empty($disp_mode)) { // see the "PMA_setDisplayMode()" function in // libraries/display_tbl.lib.php $disp_mode = 'urdr111101'; } - if (!isset($dontlimitchars)) { - $dontlimitchars = 0; - } // hide edit and delete links for information_schema if (PMA_MYSQL_INT_VERSION >= 50002 && $db == 'information_schema') { @@ -739,11 +707,6 @@ else { $goto = 'sql.php?' . PMA_generate_common_url($db, $table) - . '&pos=' . $pos - . '&session_max_rows=' . $session_max_rows - . '&disp_direction=' . $disp_direction - . '&repeat_cells=' . $repeat_cells - . '&dontlimitchars=' . $dontlimitchars . '&sql_query=' . urlencode($sql_query) . '&id_bookmark=1'; diff --git a/tbl_change.php b/tbl_change.php index c0df27b76..d58c6aef5 100644 --- a/tbl_change.php +++ b/tbl_change.php @@ -15,21 +15,6 @@ require_once './libraries/common.inc.php'; * Here it's better to use a if, instead of the '?' operator * to avoid setting a variable to '' when it's not present in $_REQUEST */ -if (isset($_REQUEST['pos'])) { - $pos = $_REQUEST['pos']; -} -if (isset($_REQUEST['session_max_rows'])) { - $session_max_rows = $_REQUEST['session_max_rows']; -} -if (isset($_REQUEST['disp_direction'])) { - $disp_direction = $_REQUEST['disp_direction']; -} -if (isset($_REQUEST['repeat_cells'])) { - $repeat_cells = $_REQUEST['repeat_cells']; -} -if (isset($_REQUEST['dontlimitchars'])) { - $dontlimitchars = $_REQUEST['dontlimitchars']; -} /** * @todo this one is badly named, it's really a WHERE condition * and exists even for tables not having a primary key or unique key @@ -203,11 +188,6 @@ document.onkeydown = onKeyDownArrowsHandler;
> - - - - - ' . $value . '' . "\n"; diff --git a/tbl_replace.php b/tbl_replace.php index db9bddb6d..e2e154d61 100644 --- a/tbl_replace.php +++ b/tbl_replace.php @@ -64,21 +64,6 @@ PMA_DBI_select_db($GLOBALS['db']); */ $goto_include = false; -if (isset($_REQUEST['dontlimitchars'])) { - $url_params['dontlimitchars'] = $_REQUEST['dontlimitchars']; -} -if (isset($_REQUEST['pos'])) { - $url_params['pos'] = (int) $_REQUEST['pos']; -} -if (isset($_REQUEST['session_max_rows'])) { - $url_params['session_max_rows'] = (int) $_REQUEST['session_max_rows']; -} -if (isset($_REQUEST['disp_direction'])) { - $url_params['disp_direction'] = $_REQUEST['disp_direction']; -} -if (isset($_REQUEST['repeat_cells'])) { - $url_params['repeat_cells'] = (int) $_REQUEST['repeat_cells']; -} if (isset($_REQUEST['insert_rows']) && is_numeric($_REQUEST['insert_rows']) && $_REQUEST['insert_rows'] != $cfg['InsertRows']) { $cfg['InsertRows'] = $_REQUEST['insert_rows']; require_once './libraries/header.inc.php'; diff --git a/tbl_row_action.php b/tbl_row_action.php index 577c9c3df..584121412 100644 --- a/tbl_row_action.php +++ b/tbl_row_action.php @@ -11,13 +11,6 @@ require_once './libraries/common.inc.php'; require_once './libraries/mysql_charsets.lib.php'; -/** - * Avoids undefined variables - */ -if (!isset($pos)) { - $pos = 0; -} - /** * No rows were selected => show again the query and tell that user. */ @@ -113,10 +106,9 @@ if (!empty($submit_mult)) { default: $action = 'tbl_row_action.php'; $err_url = 'tbl_row_action.php?' . PMA_generate_common_url($db, $table); - if (!isset($mult_btn)) { + if (! isset($mult_btn)) { $original_sql_query = $sql_query; $original_url_query = $url_query; - $original_pos = $pos; } require './libraries/mult_submits.inc.php'; $url_query = PMA_generate_common_url($db, $table) @@ -140,10 +132,6 @@ if (!empty($submit_mult)) { $url_query = $original_url_query; } - if (isset($original_pos)) { - $pos = $original_pos; - } - // this is because sql.php could call tbl_structure // which would think it needs to call mult_submits.inc.php: unset($submit_mult);
+
> > @@ -925,7 +879,8 @@ function PMA_displayTableHeaders(&$is_display, &$fields_meta, $fields_cnt = 0, $ && ($is_display['edit_lnk'] == 'nn' && $is_display['del_lnk'] == 'nn') && (!$GLOBALS['is_header_sent'])) { $vertical_display['emptyafter'] = ($is_display['edit_lnk'] != 'nn' && $is_display['del_lnk'] != 'nn') ? 3 : 1; - if ($disp_direction == 'horizontal' || $disp_direction == 'horizontalflipped') { + if ($_SESSION['userconf']['disp_direction'] == 'horizontal' + || $_SESSION['userconf']['disp_direction'] == 'horizontalflipped') { echo "\n"; ?> > @@ -936,7 +891,8 @@ function PMA_displayTableHeaders(&$is_display, &$fields_meta, $fields_cnt = 0, $ } // end vertical mode } - if ($disp_direction == 'horizontal' || $disp_direction == 'horizontalflipped') { + if ($_SESSION['userconf']['disp_direction'] == 'horizontal' + || $_SESSION['userconf']['disp_direction'] == 'horizontalflipped') { ?>