/** * Generate navigation for a list * * @param int $count number of elements in the list * @param int $pos current position in the list * @param array $_url_params url parameters * @param string $script script name for form target * @param string $frame target frame * @param int $max_count maximum number of elements to display from the list * * @access public * * @todo use $pos from $_url_params */ function PMA_listNavigator($count, $pos, $_url_params, $script, $frame, $max_count) { if ($max_count < $count) { echo 'frame_navigation' == $frame ? '<div id="navidbpageselector">' . "\n" : ''; echo __('Page number:'); echo 'frame_navigation' == $frame ? '<br />' : ' '; // Move to the beginning or to the previous page if ($pos > 0) { // patch #474210 - part 1 if ($GLOBALS['cfg']['NavigationBarIconic']) { $caption1 = '<<'; $caption2 = ' < '; $title1 = ' title="' . _pgettext('First page', 'Begin') . '"'; $title2 = ' title="' . _pgettext('Previous page', 'Previous') . '"'; } else { $caption1 = _pgettext('First page', 'Begin') . ' <<'; $caption2 = _pgettext('Previous page', 'Previous') . ' <'; $title1 = ''; $title2 = ''; } // end if... else... $_url_params['pos'] = 0; echo '<a' . $title1 . ' href="' . $script . PMA_generate_common_url($_url_params) . '" target="' . $frame . '">' . $caption1 . '</a>'; $_url_params['pos'] = $pos - $max_count; echo '<a' . $title2 . ' href="' . $script . PMA_generate_common_url($_url_params) . '" target="' . $frame . '">' . $caption2 . '</a>'; } echo "\n", '<form action="./', basename($script), '" method="post" target="', $frame, '">', "\n"; echo PMA_generate_common_hidden_inputs($_url_params); echo PMA_pageselector($max_count, floor(($pos + 1) / $max_count) + 1, ceil($count / $max_count)); echo '</form>'; if ($pos + $max_count < $count) { if ($GLOBALS['cfg']['NavigationBarIconic']) { $caption3 = ' > '; $caption4 = '>>'; $title3 = ' title="' . _pgettext('Next page', 'Next') . '"'; $title4 = ' title="' . _pgettext('Last page', 'End') . '"'; } else { $caption3 = '> ' . _pgettext('Next page', 'Next'); $caption4 = '>> ' . _pgettext('Last page', 'End'); $title3 = ''; $title4 = ''; } // end if... else... $_url_params['pos'] = $pos + $max_count; echo '<a' . $title3 . ' href="' . $script . PMA_generate_common_url($_url_params) . '" target="' . $frame . '">' . $caption3 . '</a>'; $_url_params['pos'] = floor($count / $max_count) * $max_count; if ($_url_params['pos'] == $count) { $_url_params['pos'] = $count - $max_count; } echo '<a' . $title4 . ' href="' . $script . PMA_generate_common_url($_url_params) . '" target="' . $frame . '">' . $caption4 . '</a>'; } echo "\n"; if ('frame_navigation' == $frame) { echo '</div>' . "\n"; } } }
/** * Displays a navigation bar to browse among the results of a sql query * * @param integer the offset for the "next" page * @param integer the offset for the "previous" page * @param string the url-encoded 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 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 * * @access private * * @see PMA_displayTable() */ function PMA_displayTableNavigation($pos_next, $pos_prev, $encoded_query) { global $db, $table, $goto, $dontlimitchars; global $num_rows, $unlim_num_rows, $pos, $session_max_rows; global $disp_direction, $repeat_cells; global $is_innodb; global $showtable; // FIXME: move this to a central place // FIXME: for other future table types $is_innodb = isset($showtable['Type']) && $showtable['Type'] == 'InnoDB'; ?> <!-- Navigation bar --> <table border="0" cellpadding="2" cellspacing="0"> <tr> <?php // Move to the beginning or to the previous page if ($pos > 0 && $session_max_rows != 'all') { // loic1: patch #474210 from Gosha Sakovich - part 1 if ($GLOBALS['cfg']['NavigationBarIconic']) { $caption1 = '<<'; $caption2 = ' < '; $title1 = ' title="' . $GLOBALS['strPos1'] . '"'; $title2 = ' title="' . $GLOBALS['strPrevious'] . '"'; } else { $caption1 = $GLOBALS['strPos1'] . ' <<'; $caption2 = $GLOBALS['strPrevious'] . ' <'; $title1 = ''; $title2 = ''; } // end if... else... ?> <td> <form action="sql.php" method="post"> <?php echo PMA_generate_common_hidden_inputs($db, $table); ?> <input type="hidden" name="sql_query" value="<?php echo $encoded_query; ?> " /> <input type="hidden" name="pos" value="0" /> <input type="hidden" name="session_max_rows" value="<?php echo $session_max_rows; ?> " /> <input type="hidden" name="disp_direction" value="<?php echo $disp_direction; ?> " /> <input type="hidden" name="repeat_cells" value="<?php echo $repeat_cells; ?> " /> <input type="hidden" name="goto" value="<?php echo $goto; ?> " /> <input type="hidden" name="dontlimitchars" value="<?php echo $dontlimitchars; ?> " /> <input type="submit" name="navig" value="<?php echo $caption1; ?> "<?php echo $title1; ?> /> </form> </td> <td> <form action="sql.php" method="post"> <?php echo PMA_generate_common_hidden_inputs($db, $table); ?> <input type="hidden" name="sql_query" value="<?php echo $encoded_query; ?> " /> <input type="hidden" name="pos" value="<?php echo $pos_prev; ?> " /> <input type="hidden" name="session_max_rows" value="<?php echo $session_max_rows; ?> " /> <input type="hidden" name="disp_direction" value="<?php echo $disp_direction; ?> " /> <input type="hidden" name="repeat_cells" value="<?php echo $repeat_cells; ?> " /> <input type="hidden" name="goto" value="<?php echo $goto; ?> " /> <input type="hidden" name="dontlimitchars" value="<?php echo $dontlimitchars; ?> " /> <input type="submit" name="navig" value="<?php echo $caption2; ?> "<?php echo $title2; ?> /> </form> </td> <?php } // end move back ?> <td> </td> <td align="center"> <form action="sql.php" method="post" onsubmit="return (checkFormElementInRange(this, 'session_max_rows', '<?php echo str_replace('\'', '\\\'', $GLOBALS['strInvalidRowNumber']); ?> ', 1) && checkFormElementInRange(this, 'pos', '<?php echo str_replace('\'', '\\\'', $GLOBALS['strInvalidRowNumber']); ?> ', 0, <?php echo $unlim_num_rows - 1; ?> ))"> <?php echo PMA_generate_common_hidden_inputs($db, $table); ?> <input type="hidden" name="sql_query" value="<?php echo $encoded_query; ?> " /> <input type="hidden" name="goto" value="<?php echo $goto; ?> " /> <input type="hidden" name="dontlimitchars" value="<?php echo $dontlimitchars; ?> " /> <input type="submit" name="navig" value="<?php echo $GLOBALS['strShow']; ?> :" /> <input type="text" name="session_max_rows" size="3" value="<?php echo $session_max_rows != 'all' ? $session_max_rows : $GLOBALS['cfg']['MaxRows']; ?> " class="textfield" onfocus="this.select()" /> <?php echo $GLOBALS['strRowsFrom'] . "\n"; ?> <input type="text" name="pos" size="6" value="<?php echo $pos_next >= $unlim_num_rows ? 0 : $pos_next; ?> " class="textfield" onfocus="this.select()" /> <br /> <?php // Display mode (horizontal/vertical and repeat headers) $param1 = ' <select name="disp_direction">' . "\n" . ' <option value="horizontal"' . ($disp_direction == 'horizontal' ? ' selected="selected"' : '') . '>' . $GLOBALS['strRowsModeHorizontal'] . '</option>' . "\n" . ' <option value="horizontalflipped"' . ($disp_direction == 'horizontalflipped' ? ' selected="selected"' : '') . '>' . $GLOBALS['strRowsModeFlippedHorizontal'] . '</option>' . "\n" . ' <option value="vertical"' . ($disp_direction == 'vertical' ? ' selected="selected"' : '') . '>' . $GLOBALS['strRowsModeVertical'] . '</option>' . "\n" . ' </select>' . "\n" . ' '; $param2 = ' <input type="text" size="3" name="repeat_cells" value="' . $repeat_cells . '" class="textfield" />' . "\n" . ' '; echo ' ' . sprintf($GLOBALS['strRowsModeOptions'], "\n" . $param1, "\n" . $param2) . "\n"; ?> </form> </td> <td> </td> <?php // Move to the next page or to the last one if ($pos + $session_max_rows < $unlim_num_rows && $num_rows >= $session_max_rows && $session_max_rows != 'all') { // loic1: patch #474210 from Gosha Sakovich - part 2 if ($GLOBALS['cfg']['NavigationBarIconic']) { $caption3 = ' > '; $caption4 = '>>'; $title3 = ' title="' . $GLOBALS['strNext'] . '"'; $title4 = ' title="' . $GLOBALS['strEnd'] . '"'; } else { $caption3 = '> ' . $GLOBALS['strNext']; $caption4 = '>> ' . $GLOBALS['strEnd']; $title3 = ''; $title4 = ''; } // end if... else... echo "\n"; ?> <td> <form action="sql.php" method="post"> <?php echo PMA_generate_common_hidden_inputs($db, $table); ?> <input type="hidden" name="sql_query" value="<?php echo $encoded_query; ?> " /> <input type="hidden" name="pos" value="<?php echo $pos_next; ?> " /> <input type="hidden" name="session_max_rows" value="<?php echo $session_max_rows; ?> " /> <input type="hidden" name="disp_direction" value="<?php echo $disp_direction; ?> " /> <input type="hidden" name="repeat_cells" value="<?php echo $repeat_cells; ?> " /> <input type="hidden" name="goto" value="<?php echo $goto; ?> " /> <input type="hidden" name="dontlimitchars" value="<?php echo $dontlimitchars; ?> " /> <input type="submit" name="navig" value="<?php echo $caption3; ?> "<?php echo $title3; ?> /> </form> </td> <td> <form action="sql.php" method="post" onsubmit="return <?php echo $pos + $session_max_rows < $unlim_num_rows && $num_rows >= $session_max_rows ? 'true' : 'false'; ?> "> <?php echo PMA_generate_common_hidden_inputs($db, $table); ?> <input type="hidden" name="sql_query" value="<?php echo $encoded_query; ?> " /> <input type="hidden" name="pos" value="<?php echo @((ceil($unlim_num_rows / $session_max_rows) - 1) * $session_max_rows); ?> " /> <?php if ($is_innodb && $unlim_num_rows > $GLOBALS['cfg']['MaxExactCount']) { echo '<input type="hidden" name="find_real_end" value="1" />' . "\n"; // no backquote around this message $onclick = ' onclick="return confirmAction(\'' . PMA_jsFormat($GLOBALS['strLongOperation'], false) . '\')"'; } ?> <input type="hidden" name="session_max_rows" value="<?php echo $session_max_rows; ?> " /> <input type="hidden" name="disp_direction" value="<?php echo $disp_direction; ?> " /> <input type="hidden" name="repeat_cells" value="<?php echo $repeat_cells; ?> " /> <input type="hidden" name="goto" value="<?php echo $goto; ?> " /> <input type="hidden" name="dontlimitchars" value="<?php echo $dontlimitchars; ?> " /> <input type="submit" name="navig" value="<?php echo $caption4; ?> "<?php echo $title4; ?> <?php echo empty($onclick) ? '' : $onclick; ?> /> </form> </td> <?php } // end move toward //page redirection $pageNow = @floor($pos / $session_max_rows) + 1; $nbTotalPage = @ceil($unlim_num_rows / $session_max_rows); if ($nbTotalPage > 1) { //if1 ?> <td> </td> <td> <?php //<form> for keep the form alignment of button < and << ?> <form action="none"> <?php echo PMA_pageselector('sql.php?sql_query=' . $encoded_query . '&session_max_rows=' . $session_max_rows . '&disp_direction=' . $disp_direction . '&repeat_cells=' . $repeat_cells . '&goto=' . $goto . '&dontlimitchars=' . $dontlimitchars . '&' . PMA_generate_common_url($db, $table) . '&', $session_max_rows, $pageNow, $nbTotalPage); ?> </form> </td> <?php } //_if1 // Show all the records if allowed if ($GLOBALS['cfg']['ShowAll'] && $num_rows < $unlim_num_rows) { echo "\n"; ?> <td> </td> <td> <form action="sql.php" method="post"> <?php echo PMA_generate_common_hidden_inputs($db, $table); ?> <input type="hidden" name="sql_query" value="<?php echo $encoded_query; ?> " /> <input type="hidden" name="pos" value="0" /> <input type="hidden" name="session_max_rows" value="all" /> <input type="hidden" name="disp_direction" value="<?php echo $disp_direction; ?> " /> <input type="hidden" name="repeat_cells" value="<?php echo $repeat_cells; ?> " /> <input type="hidden" name="goto" value="<?php echo $goto; ?> " /> <input type="hidden" name="dontlimitchars" value="<?php echo $dontlimitchars; ?> " /> <input type="submit" name="navig" value="<?php echo $GLOBALS['strShowAll']; ?> " /> </form> </td> <?php } // end show all echo "\n"; ?> </tr> </table> <?php }
$title2 = ' title="' . $GLOBALS['strPrevious'] . '"'; } else { $caption1 = $GLOBALS['strPos1'] . ' <<'; $caption2 = $GLOBALS['strPrevious'] . ' <'; $title1 = ''; $title2 = ''; } // end if... else... $_url_params['pos'] = 0; echo '<a' . $title1 . 'href="server_databases.php' . PMA_generate_common_url($_url_params) . '">' . $caption1 . '</a>'; $_url_params['pos'] = $pos - $GLOBALS['cfg']['MaxDbList']; echo '<a' . $title2 . 'href="server_databases.php' . PMA_generate_common_url($_url_params) . '">' . $caption2 . '</a>'; } echo '<form action="./server_databases.php" method="post">' . "\n"; echo PMA_generate_common_hidden_inputs($_url_params); echo PMA_pageselector('server_databases.php' . PMA_generate_common_url($_url_params) . '&', $GLOBALS['cfg']['MaxDbList'], floor(($pos + 1) / $GLOBALS['cfg']['MaxDbList']) + 1, ceil($databases_count / $GLOBALS['cfg']['MaxDbList'])); echo '</form>'; if ($pos + $GLOBALS['cfg']['MaxDbList'] < $databases_count) { if ($GLOBALS['cfg']['NavigationBarIconic']) { $caption3 = ' > '; $caption4 = '>>'; $title3 = ' title="' . $GLOBALS['strNext'] . '"'; $title4 = ' title="' . $GLOBALS['strEnd'] . '"'; } else { $caption3 = '> ' . $GLOBALS['strNext']; $caption4 = '>> ' . $GLOBALS['strEnd']; $title3 = ''; $title4 = ''; } // end if... else... $_url_params['pos'] = $pos + $GLOBALS['cfg']['MaxDbList'];
/** * Displays a navigation bar to browse among the results of a SQL query * * @uses $_SESSION['tmp_user_values']['disp_direction'] * @uses $_SESSION['tmp_user_values']['repeat_cells'] * @uses $_SESSION['tmp_user_values']['max_rows'] * @uses $_SESSION['tmp_user_values']['pos'] * @param integer the offset for the "next" page * @param integer the offset for the "previous" page * @param string the URL-encoded query * @param string the id for the direction dropdown * * @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 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 boolean $is_innodb whether its InnoDB or not * @global array $showtable table definitions * * @access private * * @see PMA_displayTable() */ function PMA_displayTableNavigation($pos_next, $pos_prev, $sql_query, $id_for_direction_dropdown) { global $db, $table, $goto; global $num_rows, $unlim_num_rows; global $is_innodb; global $showtable; // here, using htmlentities() would cause problems if the query // contains accented characters $html_sql_query = htmlspecialchars($sql_query); /** * @todo move this to a central place * @todo for other future table types */ $is_innodb = isset($showtable['Type']) && $showtable['Type'] == 'InnoDB'; ?> <!-- Navigation bar --> <table border="0" cellpadding="2" cellspacing="0"> <tr> <?php // Move to the beginning or to the previous page if ($_SESSION['tmp_user_values']['pos'] && $_SESSION['tmp_user_values']['max_rows'] != 'all') { PMA_displayTableNavigationOneButton('<<', $GLOBALS['strPos1'], 0, $html_sql_query); PMA_displayTableNavigationOneButton('<', $GLOBALS['strPrevious'], $pos_prev, $html_sql_query); } // end move back ?> <td> </td> <td align="center"> <?php // if displaying a VIEW, $unlim_num_rows could be zero because // of $cfg['MaxExactCountViews']; in this case, avoid passing // the 5th parameter to checkFormElementInRange() // (this means we can't validate the upper limit ?> <form action="sql.php" method="post" onsubmit="return (checkFormElementInRange(this, 'session_max_rows', '<?php echo str_replace('\'', '\\\'', $GLOBALS['strInvalidRowNumber']); ?> ', 1) && checkFormElementInRange(this, 'pos', '<?php echo str_replace('\'', '\\\'', $GLOBALS['strInvalidRowNumber']); ?> ', 0<?php echo $unlim_num_rows > 0 ? ',' . $unlim_num_rows - 1 : ''; ?> ))"> <?php echo PMA_generate_common_hidden_inputs($db, $table); ?> <input type="hidden" name="sql_query" value="<?php echo $html_sql_query; ?> " /> <input type="hidden" name="goto" value="<?php echo $goto; ?> " /> <input type="submit" name="navig" value="<?php echo $GLOBALS['strShow']; ?> :" /> <input type="text" name="session_max_rows" size="3" value="<?php echo $_SESSION['tmp_user_values']['max_rows'] != 'all' ? $_SESSION['tmp_user_values']['max_rows'] : $GLOBALS['cfg']['MaxRows']; ?> " class="textfield" onfocus="this.select()" /> <?php echo $GLOBALS['strRowsFrom'] . "\n"; ?> <input type="text" name="pos" size="6" value="<?php echo $pos_next >= $unlim_num_rows ? 0 : $pos_next; ?> " class="textfield" onfocus="this.select()" /> <br /> <?php // Display mode (horizontal/vertical and repeat headers) $choices = array('horizontal' => $GLOBALS['strRowsModeHorizontal'], 'horizontalflipped' => $GLOBALS['strRowsModeFlippedHorizontal'], 'vertical' => $GLOBALS['strRowsModeVertical']); $param1 = PMA_generate_html_dropdown('disp_direction', $choices, $_SESSION['tmp_user_values']['disp_direction'], $id_for_direction_dropdown); unset($choices); $param2 = ' <input type="text" size="3" name="repeat_cells" value="' . $_SESSION['tmp_user_values']['repeat_cells'] . '" class="textfield" />' . "\n" . ' '; echo ' ' . sprintf($GLOBALS['strRowsModeOptions'], "\n" . $param1, "\n" . $param2) . "\n"; ?> </form> </td> <td> </td> <?php // Move to the next page or to the last one if ($_SESSION['tmp_user_values']['pos'] + $_SESSION['tmp_user_values']['max_rows'] < $unlim_num_rows && $num_rows >= $_SESSION['tmp_user_values']['max_rows'] && $_SESSION['tmp_user_values']['max_rows'] != 'all') { // display the Next button PMA_displayTableNavigationOneButton('>', $GLOBALS['strNext'], $pos_next, $html_sql_query); // prepare some options for the End button if ($is_innodb && $unlim_num_rows > $GLOBALS['cfg']['MaxExactCount']) { $input_for_real_end = '<input type="hidden" name="find_real_end" value="1" />'; // no backquote around this message $onclick = ' onclick="return confirmAction(\'' . PMA_jsFormat($GLOBALS['strLongOperation'], false) . '\')"'; } else { $input_for_real_end = $onclick = ''; } // display the End button PMA_displayTableNavigationOneButton('>>', $GLOBALS['strEnd'], @((ceil($unlim_num_rows / $_SESSION['tmp_user_values']['max_rows']) - 1) * $_SESSION['tmp_user_values']['max_rows']), $html_sql_query, 'onsubmit="return ' . ($_SESSION['tmp_user_values']['pos'] + $_SESSION['tmp_user_values']['max_rows'] < $unlim_num_rows && $num_rows >= $_SESSION['tmp_user_values']['max_rows'] ? 'true' : 'false') . '"', $input_for_real_end, $onclick); } // end move toward //page redirection // (unless we are showing all records) if ('all' != $_SESSION['tmp_user_values']['max_rows']) { //if1 $pageNow = @floor($_SESSION['tmp_user_values']['pos'] / $_SESSION['tmp_user_values']['max_rows']) + 1; $nbTotalPage = @ceil($unlim_num_rows / $_SESSION['tmp_user_values']['max_rows']); if ($nbTotalPage > 1) { //if2 ?> <td> </td> <td> <?php //<form> for keep the form alignment of button < and << ?> <form action="none"> <?php $_url_params = array('db' => $db, 'table' => $table, 'sql_query' => $sql_query, 'goto' => $goto); echo PMA_pageselector('sql.php' . PMA_generate_common_url($_url_params) . PMA_get_arg_separator('js'), $_SESSION['tmp_user_values']['max_rows'], $pageNow, $nbTotalPage, 200, 5, 5, 20, 10, $GLOBALS['strPageNumber']); ?> </form> </td> <?php } //_if2 } //_if1 // Display the "Show all" button if allowed if ($GLOBALS['cfg']['ShowAll'] && $num_rows < $unlim_num_rows) { echo "\n"; ?> <td> </td> <td> <form action="sql.php" method="post"> <?php echo PMA_generate_common_hidden_inputs($db, $table); ?> <input type="hidden" name="sql_query" value="<?php echo $html_sql_query; ?> " /> <input type="hidden" name="pos" value="0" /> <input type="hidden" name="session_max_rows" value="all" /> <input type="hidden" name="goto" value="<?php echo $goto; ?> " /> <input type="submit" name="navig" value="<?php echo $GLOBALS['strShowAll']; ?> " /> </form> </td> <?php } // end show all echo "\n"; ?> </tr> </table> <?php }
if (isset($rownumber)) { $rownumber_param = '&rownumber=' . urlencode($rownumber); } else { $rownumber_param = ''; } $gotopage = ''; $showall = ''; if (is_array($foreignData['disp_row'])) { if ($cfg['ShowAll'] && $foreignData['the_total'] > $GLOBALS['cfg']['MaxRows']) { $showall = '<input type="submit" name="foreign_navig" value="' . __('Show all') . '" />'; } $session_max_rows = $GLOBALS['cfg']['MaxRows']; $pageNow = @floor($pos / $session_max_rows) + 1; $nbTotalPage = @ceil($foreignData['the_total'] / $session_max_rows); if ($foreignData['the_total'] > $GLOBALS['cfg']['MaxRows']) { $gotopage = PMA_pageselector($session_max_rows, $pageNow, $nbTotalPage, 200, 5, 5, 20, 10, __('Page number:')); } } ?> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $available_languages[$lang][1]; ?> " lang="<?php echo $available_languages[$lang][1]; ?> " dir="<?php echo $text_dir;
/** * 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 * * @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 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 boolean $is_innodb whether its InnoDB or not * @global array $showtable table definitions * * @access private * * @see PMA_displayTable() */ function PMA_displayTableNavigation($pos_next, $pos_prev, $sql_query) { global $db, $table, $goto; global $num_rows, $unlim_num_rows; global $is_innodb; global $showtable; // here, using htmlentities() would cause problems if the query // contains accented characters $html_sql_query = htmlspecialchars($sql_query); /** * @todo move this to a central place * @todo for other future table types */ $is_innodb = isset($showtable['Type']) && $showtable['Type'] == 'InnoDB'; ?> <!-- Navigation bar --> <table border="0" cellpadding="2" cellspacing="0"> <tr> <?php // Move to the beginning or to the previous page if ($_SESSION['userconf']['pos'] && $_SESSION['userconf']['max_rows'] != 'all') { // loic1: patch #474210 from Gosha Sakovich - part 1 if ($GLOBALS['cfg']['NavigationBarIconic']) { $caption1 = '<<'; $caption2 = ' < '; $title1 = ' title="' . $GLOBALS['strPos1'] . '"'; $title2 = ' title="' . $GLOBALS['strPrevious'] . '"'; } else { $caption1 = $GLOBALS['strPos1'] . ' <<'; $caption2 = $GLOBALS['strPrevious'] . ' <'; $title1 = ''; $title2 = ''; } // end if... else... ?> <td> <form action="sql.php" method="post"> <?php echo PMA_generate_common_hidden_inputs($db, $table); ?> <input type="hidden" name="sql_query" value="<?php echo $html_sql_query; ?> " /> <input type="hidden" name="pos" value="0" /> <input type="hidden" name="goto" value="<?php echo $goto; ?> " /> <input type="submit" name="navig" value="<?php echo $caption1; ?> "<?php echo $title1; ?> /> </form> </td> <td> <form action="sql.php" method="post"> <?php echo PMA_generate_common_hidden_inputs($db, $table); ?> <input type="hidden" name="sql_query" value="<?php echo $html_sql_query; ?> " /> <input type="hidden" name="pos" value="<?php echo $pos_prev; ?> " /> <input type="hidden" name="goto" value="<?php echo $goto; ?> " /> <input type="submit" name="navig" value="<?php echo $caption2; ?> "<?php echo $title2; ?> /> </form> </td> <?php } // end move back ?> <td> </td> <td align="center"> <?php // if displaying a VIEW, $unlim_num_rows could be zero because // of $cfg['MaxExactCountViews']; in this case, avoid passing // the 5th parameter to checkFormElementInRange() // (this means we can't validate the upper limit ?> <form action="sql.php" method="post" onsubmit="return (checkFormElementInRange(this, 'session_max_rows', '<?php echo str_replace('\'', '\\\'', $GLOBALS['strInvalidRowNumber']); ?> ', 1) && checkFormElementInRange(this, 'pos', '<?php echo str_replace('\'', '\\\'', $GLOBALS['strInvalidRowNumber']); ?> ', 0<?php echo $unlim_num_rows > 0 ? ',' . $unlim_num_rows - 1 : ''; ?> ))"> <?php echo PMA_generate_common_hidden_inputs($db, $table); ?> <input type="hidden" name="sql_query" value="<?php echo $html_sql_query; ?> " /> <input type="hidden" name="goto" value="<?php echo $goto; ?> " /> <input type="submit" name="navig" value="<?php echo $GLOBALS['strShow']; ?> :" /> <input type="text" name="session_max_rows" size="3" value="<?php echo $_SESSION['userconf']['max_rows'] != 'all' ? $_SESSION['userconf']['max_rows'] : $GLOBALS['cfg']['MaxRows']; ?> " class="textfield" onfocus="this.select()" /> <?php echo $GLOBALS['strRowsFrom'] . "\n"; ?> <input type="text" name="pos" size="6" value="<?php echo $pos_next >= $unlim_num_rows ? 0 : $pos_next; ?> " class="textfield" onfocus="this.select()" /> <br /> <?php // Display mode (horizontal/vertical and repeat headers) $param1 = ' <select name="disp_direction">' . "\n" . ' <option value="horizontal"' . ($_SESSION['userconf']['disp_direction'] == 'horizontal' ? ' selected="selected"' : '') . '>' . $GLOBALS['strRowsModeHorizontal'] . '</option>' . "\n" . ' <option value="horizontalflipped"' . ($_SESSION['userconf']['disp_direction'] == 'horizontalflipped' ? ' selected="selected"' : '') . '>' . $GLOBALS['strRowsModeFlippedHorizontal'] . '</option>' . "\n" . ' <option value="vertical"' . ($_SESSION['userconf']['disp_direction'] == 'vertical' ? ' selected="selected"' : '') . '>' . $GLOBALS['strRowsModeVertical'] . '</option>' . "\n" . ' </select>' . "\n" . ' '; $param2 = ' <input type="text" size="3" name="repeat_cells" value="' . $_SESSION['userconf']['repeat_cells'] . '" class="textfield" />' . "\n" . ' '; echo ' ' . sprintf($GLOBALS['strRowsModeOptions'], "\n" . $param1, "\n" . $param2) . "\n"; ?> </form> </td> <td> </td> <?php // Move to the next page or to the last one 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 = ' > '; $caption4 = '>>'; $title3 = ' title="' . $GLOBALS['strNext'] . '"'; $title4 = ' title="' . $GLOBALS['strEnd'] . '"'; } else { $caption3 = '> ' . $GLOBALS['strNext']; $caption4 = '>> ' . $GLOBALS['strEnd']; $title3 = ''; $title4 = ''; } // end if... else... echo "\n"; ?> <td> <form action="sql.php" method="post"> <?php echo PMA_generate_common_hidden_inputs($db, $table); ?> <input type="hidden" name="sql_query" value="<?php echo $html_sql_query; ?> " /> <input type="hidden" name="pos" value="<?php echo $pos_next; ?> " /> <input type="hidden" name="goto" value="<?php echo $goto; ?> " /> <input type="submit" name="navig" value="<?php echo $caption3; ?> "<?php echo $title3; ?> /> </form> </td> <td> <form action="sql.php" method="post" onsubmit="return <?php echo $_SESSION['userconf']['pos'] + $_SESSION['userconf']['max_rows'] < $unlim_num_rows && $num_rows >= $_SESSION['userconf']['max_rows'] ? 'true' : 'false'; ?> "> <?php echo PMA_generate_common_hidden_inputs($db, $table); ?> <input type="hidden" name="sql_query" value="<?php echo $html_sql_query; ?> " /> <input type="hidden" name="pos" value="<?php echo @((ceil($unlim_num_rows / $_SESSION['userconf']['max_rows']) - 1) * $_SESSION['userconf']['max_rows']); ?> " /> <?php if ($is_innodb && $unlim_num_rows > $GLOBALS['cfg']['MaxExactCount']) { echo '<input type="hidden" name="find_real_end" value="1" />' . "\n"; // no backquote around this message $onclick = ' onclick="return confirmAction(\'' . PMA_jsFormat($GLOBALS['strLongOperation'], false) . '\')"'; } ?> <input type="hidden" name="goto" value="<?php echo $goto; ?> " /> <input type="submit" name="navig" value="<?php echo $caption4; ?> "<?php echo $title4; ?> <?php echo empty($onclick) ? '' : $onclick; ?> /> </form> </td> <?php } // end move toward //page redirection // (unless we are showing all records) if ('all' != $_SESSION['userconf']['max_rows']) { //if1 $pageNow = @floor($_SESSION['userconf']['pos'] / $_SESSION['userconf']['max_rows']) + 1; $nbTotalPage = @ceil($unlim_num_rows / $_SESSION['userconf']['max_rows']); if ($nbTotalPage > 1) { //if2 ?> <td> </td> <td> <?php //<form> for keep the form alignment of button < and << ?> <form action="none"> <?php echo PMA_pageselector('sql.php?sql_query=' . urlencode($sql_query) . '&goto=' . $goto . '&' . PMA_generate_common_url($db, $table) . '&', $_SESSION['userconf']['max_rows'], $pageNow, $nbTotalPage, 200, 5, 5, 20, 10, $GLOBALS['strPageNumber']); ?> </form> </td> <?php } //_if2 } //_if1 // Display the "Show all" button if allowed if ($GLOBALS['cfg']['ShowAll'] && $num_rows < $unlim_num_rows) { echo "\n"; ?> <td> </td> <td> <form action="sql.php" method="post"> <?php echo PMA_generate_common_hidden_inputs($db, $table); ?> <input type="hidden" name="sql_query" value="<?php echo $html_sql_query; ?> " /> <input type="hidden" name="pos" value="0" /> <input type="hidden" name="session_max_rows" value="all" /> <input type="hidden" name="goto" value="<?php echo $goto; ?> " /> <input type="submit" name="navig" value="<?php echo $GLOBALS['strShowAll']; ?> " /> </form> </td> <?php } // end show all echo "\n"; ?> </tr> </table> <?php }
<?php } else { $pk_uri = ''; } $gotopage = ''; $showall = ''; if (isset($disp_row) && is_array($disp_row)) { $count = count($disp_row); if ($cfg['ShowAll'] && $count > $per_page) { $showall = '<input type="submit" name="foreign_navig" value="' . $strShowAll . '" />'; } $session_max_rows = $per_page; $pageNow = @floor($pos / $session_max_rows) + 1; $nbTotalPage = @ceil($count / $session_max_rows); if ($count > $per_page) { $gotopage = PMA_pageselector('browse_foreigners.php?field=' . urlencode($field) . '&' . PMA_generate_common_url($db, $table) . $pk_uri . '&fieldkey=' . (isset($fieldkey) ? $fieldkey : '') . '&foreign_filter=' . (isset($foreign_filter) ? htmlspecialchars($foreign_filter) : '') . '&', $session_max_rows, $pageNow, $nbTotalPage); } } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $available_languages[$lang][2]; ?> " lang="<?php echo $available_languages[$lang][2]; ?> " dir="<?php
} $session_max_rows = $per_page; $pageNow = @floor($pos / $session_max_rows) + 1; $nbTotalPage = @ceil($foreignData['the_total'] / $session_max_rows); if ($foreignData['the_total'] > $per_page) { $gotopage = PMA_pageselector( 'browse_foreigners.php?field=' . urlencode($field) . '&' . PMA_generate_common_url($db, $table) . $pk_uri . '&fieldkey=' . (isset($fieldkey) ? urlencode($fieldkey) : '') . '&foreign_filter=' . (isset($foreign_filter) ? urlencode($foreign_filter) : '') . '&', $session_max_rows, $pageNow, $nbTotalPage, 200, 5, 5, 20, 10, $GLOBALS['strPageNumber'] ); } } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $available_languages[$lang][2]; ?>"
/** * Displays a navigation bar to browse among the results of a SQL query * * @param integer $pos_next the offset for the "next" page * @param integer $pos_prev the offset for the "previous" page * @param string $sql_query the URL-encoded query * @param string $id_for_direction_dropdown the id for the direction dropdown * * @return nothing * * @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 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 boolean $is_innodb whether its InnoDB or not * @global array $showtable table definitions * * @access private * * @see PMA_displayTable() */ function PMA_displayTableNavigation($pos_next, $pos_prev, $sql_query, $id_for_direction_dropdown) { global $db, $table, $goto; global $num_rows, $unlim_num_rows; global $is_innodb; global $showtable; // here, using htmlentities() would cause problems if the query // contains accented characters $html_sql_query = htmlspecialchars($sql_query); /** * @todo move this to a central place * @todo for other future table types */ $is_innodb = isset($showtable['Type']) && $showtable['Type'] == 'InnoDB'; ?> <!-- Navigation bar --> <table border="0" cellpadding="0" cellspacing="0" class="navigation"> <tr> <td class="navigation_separator"></td> <?php // Move to the beginning or to the previous page if ($_SESSION['tmp_user_values']['pos'] && $_SESSION['tmp_user_values']['max_rows'] != 'all') { PMA_displayTableNavigationOneButton('<<', _pgettext('First page', 'Begin'), 0, $html_sql_query); PMA_displayTableNavigationOneButton('<', _pgettext('Previous page', 'Previous'), $pos_prev, $html_sql_query); } // end move back $nbTotalPage = 1; //page redirection // (unless we are showing all records) if ('all' != $_SESSION['tmp_user_values']['max_rows']) { //if1 $pageNow = @floor($_SESSION['tmp_user_values']['pos'] / $_SESSION['tmp_user_values']['max_rows']) + 1; $nbTotalPage = @ceil($unlim_num_rows / $_SESSION['tmp_user_values']['max_rows']); if ($nbTotalPage > 1) { //if2 ?> <td> <?php $_url_params = array('db' => $db, 'table' => $table, 'sql_query' => $sql_query, 'goto' => $goto); //<form> to keep the form alignment of button < and << // and also to know what to execute when the selector changes echo '<form action="sql.php' . PMA_generate_common_url($_url_params) . '" method="post">'; echo PMA_pageselector($_SESSION['tmp_user_values']['max_rows'], $pageNow, $nbTotalPage, 200, 5, 5, 20, 10); ?> </form> </td> <?php } //_if2 } //_if1 // Display the "Show all" button if allowed if ($num_rows < $unlim_num_rows && ($GLOBALS['cfg']['ShowAll'] || $GLOBALS['cfg']['MaxRows'] * 5 >= $unlim_num_rows)) { echo "\n"; ?> <td> <form action="sql.php" method="post"> <?php echo PMA_generate_common_hidden_inputs($db, $table); ?> <input type="hidden" name="sql_query" value="<?php echo $html_sql_query; ?> " /> <input type="hidden" name="pos" value="0" /> <input type="hidden" name="session_max_rows" value="all" /> <input type="hidden" name="goto" value="<?php echo $goto; ?> " /> <input type="submit" name="navig" value="<?php echo __('Show all'); ?> " /> </form> </td> <?php } // end show all // Move to the next page or to the last one if ($_SESSION['tmp_user_values']['pos'] + $_SESSION['tmp_user_values']['max_rows'] < $unlim_num_rows && $num_rows >= $_SESSION['tmp_user_values']['max_rows'] && $_SESSION['tmp_user_values']['max_rows'] != 'all') { // display the Next button PMA_displayTableNavigationOneButton('>', _pgettext('Next page', 'Next'), $pos_next, $html_sql_query); // prepare some options for the End button if ($is_innodb && $unlim_num_rows > $GLOBALS['cfg']['MaxExactCount']) { $input_for_real_end = '<input id="real_end_input" type="hidden" name="find_real_end" value="1" />'; // no backquote around this message $onclick = ''; } else { $input_for_real_end = $onclick = ''; } // display the End button PMA_displayTableNavigationOneButton('>>', _pgettext('Last page', 'End'), @((ceil($unlim_num_rows / $_SESSION['tmp_user_values']['max_rows']) - 1) * $_SESSION['tmp_user_values']['max_rows']), $html_sql_query, 'onsubmit="return ' . ($_SESSION['tmp_user_values']['pos'] + $_SESSION['tmp_user_values']['max_rows'] < $unlim_num_rows && $num_rows >= $_SESSION['tmp_user_values']['max_rows'] ? 'true' : 'false') . '"', $input_for_real_end, $onclick); } // end move toward // show separator if pagination happen if ($nbTotalPage > 1) { echo '<td><div class="navigation_separator">|</div></td>'; } ?> <td> <div class="save_edited hide"> <input type="submit" value="<?php echo __('Save edited data'); ?> " /> <div class="navigation_separator">|</div> </div> </td> <td> <div class="restore_column hide"> <input type="submit" value="<?php echo __('Restore column order'); ?> " /> <div class="navigation_separator">|</div> </div> </td> <?php // if displaying a VIEW, $unlim_num_rows could be zero because // of $cfg['MaxExactCountViews']; in this case, avoid passing // the 5th parameter to checkFormElementInRange() // (this means we can't validate the upper limit ?> <td class="navigation_goto"> <form action="sql.php" method="post" onsubmit="return (checkFormElementInRange(this, 'session_max_rows', '<?php echo str_replace('\'', '\\\'', __('%d is not valid row number.')); ?> ', 1) && checkFormElementInRange(this, 'pos', '<?php echo str_replace('\'', '\\\'', __('%d is not valid row number.')); ?> ', 0<?php echo $unlim_num_rows > 0 ? ',' . $unlim_num_rows - 1 : ''; ?> ))"> <?php echo PMA_generate_common_hidden_inputs($db, $table); ?> <input type="hidden" name="sql_query" value="<?php echo $html_sql_query; ?> " /> <input type="hidden" name="goto" value="<?php echo $goto; ?> " /> <input type="submit" name="navig" <?php echo $GLOBALS['cfg']['AjaxEnable'] ? ' class="ajax"' : ''; ?> value="<?php echo __('Show'); ?> :" /> <?php echo __('Start row') . ': ' . "\n"; ?> <input type="text" name="pos" size="3" value="<?php echo $pos_next >= $unlim_num_rows ? 0 : $pos_next; ?> " class="textfield" onfocus="this.select()" /> <?php echo __('Number of rows') . ': ' . "\n"; ?> <input type="text" name="session_max_rows" size="3" value="<?php echo $_SESSION['tmp_user_values']['max_rows'] != 'all' ? $_SESSION['tmp_user_values']['max_rows'] : $GLOBALS['cfg']['MaxRows']; ?> " class="textfield" onfocus="this.select()" /> <?php if ($GLOBALS['cfg']['ShowDisplayDirection']) { // Display mode (horizontal/vertical and repeat headers) echo __('Mode') . ': ' . "\n"; $choices = array('horizontal' => __('horizontal'), 'horizontalflipped' => __('horizontal (rotated headers)'), 'vertical' => __('vertical')); echo PMA_generate_html_dropdown('disp_direction', $choices, $_SESSION['tmp_user_values']['disp_direction'], $id_for_direction_dropdown); unset($choices); } printf(__('Headers every %s rows'), '<input type="text" size="3" name="repeat_cells" value="' . $_SESSION['tmp_user_values']['repeat_cells'] . '" class="textfield" />'); echo "\n"; ?> </form> </td> <td class="navigation_separator"></td> </tr> </table> <?php }