updates the
// display mode
if ($the_disp_mode != 'nnnn00000') {
// 2.1 Statement is a "SELECT COUNT",
// "CHECK/ANALYZE/REPAIR/OPTIMIZE" or an "EXPLAIN"
if ($GLOBALS['is_count'] || $GLOBALS['is_maint'] || $GLOBALS['is_explain']) {
$do_display['edit_lnk'] = 'nn'; // no edit link
$do_display['del_lnk'] = 'nn'; // no delete link
$do_display['sort_lnk'] = (string) '0';
$do_display['nav_bar'] = (string) '0';
$do_display['ins_row'] = (string) '0';
$do_display['bkm_form'] = (string) '1';
$do_display['text_btn'] = (string) '0';
}
// 2.2 Statement is a "SHOW..."
else if ($GLOBALS['is_show']) {
// 2.2.1 TODO : defines edit/delete links depending on show statement
$tmp = eregi('^SHOW[[:space:]]+(VARIABLES|(FULL[[:space:]]+)?PROCESSLIST|STATUS|TABLE|GRANTS|CREATE|LOGS)', $GLOBALS['sql_query'], $which);
if (strpos(' ' . strtoupper($which[1]), 'PROCESSLIST') > 0) {
$do_display['edit_lnk'] = 'nn'; // no edit link
$do_display['del_lnk'] = 'kp'; // "kill process" type edit link
}
else {
// Default case -> no links
$do_display['edit_lnk'] = 'nn'; // no edit link
$do_display['del_lnk'] = 'nn'; // no delete link
}
// 2.2.2 Other settings
$do_display['sort_lnk'] = (string) '0';
$do_display['nav_bar'] = (string) '0';
$do_display['ins_row'] = (string) '0';
$do_display['bkm_form'] = (string) '1';
$do_display['text_btn'] = (string) '0';
}
// 2.3 Other statements (ie "SELECT" ones) -> updates
// $do_display['edit_lnk'], $do_display['del_lnk'] and
// $do_display['text_btn'] (keeps other default values)
else {
$prev_table = $fields_meta[0]->table;
for ($i = 0; $i < $GLOBALS['fields_cnt']; $i++) {
$is_link = ($do_display['edit_lnk'] != 'nn'
|| $do_display['del_lnk'] != 'nn'
|| $do_display['sort_lnk'] != '0'
|| $do_display['ins_row'] != '0');
// 2.3.1 Displays text cut/expand button?
if ($do_display['text_btn'] == '0' && eregi('BLOB', $fields_meta[$i]->type)) {
$do_display['text_btn'] = (string) '1';
if (!$is_link) {
break;
}
} // end if (2.3.1)
// 2.3.2 Displays edit/delete/sort/insert links?
if ($is_link
&& ($fields_meta[$i]->table == '' || $fields_meta[$i]->table != $prev_table)) {
$do_display['edit_lnk'] = 'nn'; // don't display links
$do_display['del_lnk'] = 'nn';
// TODO: May be problematic with same fields names in
// two joined table.
// $do_display['sort_lnk'] = (string) '0';
$do_display['ins_row'] = (string) '0';
if ($do_display['text_btn'] == '1') {
break;
}
} // end if (2.3.2)
$prev_table = $fields_meta[$i]->table;
} // end for
} // end if..elseif...else (2.1 -> 2.3)
} // end if (2)
// 3. Gets the total number of rows if it is unknown
if (isset($unlim_num_rows) && $unlim_num_rows != '') {
$the_total = $unlim_num_rows;
}
else if (($do_display['nav_bar'] == '1' || $do_display['sort_lnk'] == '1')
&& (!empty($db) && !empty($table))) {
$local_query = 'SELECT COUNT(*) AS total FROM ' . PMA_backquote($db) . '.' . PMA_backquote($table);
$result = mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url);
$the_total = mysql_result($result, 0, 'total');
mysql_free_result($result);
}
// 4. If navigation bar or sorting fields names urls should be
// displayed but there is only one row, change these settings to
// false
if ($do_display['nav_bar'] == '1' || $do_display['sort_lnk'] == '1') {
if (isset($unlim_num_rows) && $unlim_num_rows < 2) {
$do_display['nav_bar'] = (string) '0';
$do_display['sort_lnk'] = (string) '0';
}
} // end if (3)
// 5. Updates the synthetic var
$the_disp_mode = join('', $do_display);
return $do_display;
} // end of the 'PMA_setDisplayMode()' function
/**
* 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 the current language
* @global integer the server to use (refers to the number in the
* configuration file)
* @global string the database name
* @global string the table name
* @global string the url to go back in case of errors
* @global integer the total number of rows returned by the sql query
* @global integer the total number of rows returned by the sql query
* without any programmatically appended "LIMIT" clause
* @global integer the current position in results
* @global mixed the maximum number of rows per page ('all' = no limit)
* @global string the display mode (horizontal/vertical)
* @global integer the number of row to display between two table headers
* @global boolean whether to limit the number of displayed characters of
* text type fields or not
*
* @access private
*
* @see PMA_displayTable()
*/
function PMA_displayTableNavigation($pos_next, $pos_prev, $encoded_query)
{
global $lang, $server, $db, $table;
global $goto;
global $num_rows, $unlim_num_rows, $pos, $session_max_rows;
global $disp_direction, $repeat_cells;
global $dontlimitchars;
?>
0 && $session_max_rows != 'all') {
// loic1: patch #474210 from Gosha Sakovich - part 1
if ($GLOBALS['cfgNavigationBarIconic']) {
$caption1 = '<<';
$caption2 = ' < ';
$title1 = ' title="' . $GLOBALS['strPos1'] . '"';
$title2 = ' title="' . $GLOBALS['strPrevious'] . '"';
} else {
$caption1 = $GLOBALS['strPos1'] . ' <<';
$caption2 = $GLOBALS['strPrevious'] . ' <';
$title1 = '';
$title2 = '';
} // end if... else...
?>
|
|
|
|
|
= $session_max_rows
&& $session_max_rows != 'all') {
// loic1: patch #474210 from Gosha Sakovich - part 2
if ($GLOBALS['cfgNavigationBarIconic']) {
$caption3 = ' > ';
$caption4 = '>>';
$title3 = ' title="' . $GLOBALS['strNext'] . '"';
$title4 = ' title="' . $GLOBALS['strEnd'] . '"';
} else {
$caption3 = '> ' . $GLOBALS['strNext'];
$caption4 = '>> ' . $GLOBALS['strEnd'];
$title3 = '';
$title4 = '';
} // end if... else...
echo "\n";
?>
|
|
|
|
|
align="center">
|
> |
name) . '(`?)[ ,$]', $sql_order);
}
// 2.1.3 Checks if the table name is required (it's the case
// for a query with a "JOIN" statement and if the column
// isn't aliased)
if ($is_join
&& !eregi('([^[:space:],]|`[^`]`)[[:space:]]+(as[[:space:]]+)?' . $fields_meta[$i]->name, $select_stt[1], $parts)) {
$sort_tbl = PMA_backquote($fields_meta[$i]->table) . '.';
} else {
$sort_tbl = '';
}
// 2.1.4 Do define the sorting url
if (!$is_in_sort) {
// loic1: patch #455484 ("Smart" order)
$cfgOrder = strtoupper($GLOBALS['cfgOrder']);
if ($cfgOrder == 'SMART') {
$cfgOrder = (eregi('time|date', $fields_meta[$i]->type)) ? 'DESC' : 'ASC';
}
$sort_order = ' ORDER BY ' . $sort_tbl . PMA_backquote($fields_meta[$i]->name) . ' ' . $cfgOrder;
$order_img = '';
}
else if (substr($sql_order, -3) == 'ASC' && $is_in_sort) {
$sort_order = ' ORDER BY ' . $sort_tbl . PMA_backquote($fields_meta[$i]->name) . ' DESC';
$order_img = '
';
}
else if (substr($sql_order, -4) == 'DESC' && $is_in_sort) {
$sort_order = ' ORDER BY ' . $sort_tbl . PMA_backquote($fields_meta[$i]->name) . ' ASC';
$order_img = '
';
}
if (eregi('(.*)( LIMIT (.*)| PROCEDURE (.*)| FOR UPDATE| LOCK IN SHARE MODE)', $unsorted_sql_query, $regs3)) {
$sorted_sql_query = $regs3[1] . $sort_order . $regs3[2];
} else {
$sorted_sql_query = $unsorted_sql_query . $sort_order;
}
$url_query = 'lang=' . $lang
. '&server=' . $server
. '&db=' . urlencode($db)
. '&table=' . urlencode($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);
// 2.1.5 Displays the sorting url
if ($disp_direction == 'horizontal') {
?>
name); ?>
|
' . "\n"
. ' ' . "\n"
. ' ' . htmlspecialchars($fields_meta[$i]->name) . '' . $order_img . "\n"
. ' ' . "\n";
} // end if (2.1)
// 2.2 Results can't be sorted
else {
echo "\n";
if ($disp_direction == 'horizontal') {
?>
name) . "\n"; ?>
|
' . "\n"
. ' ' . htmlspecialchars($fields_meta[$i]->name) . "\n"
. ' ';
} // end else (2.2)
echo "\n";
} // end for
// 3. Displays the full/partial text button (part 2) at the right
// column of the result table header if possible and required...
if ($GLOBALS['cfgModifyDeleteAtRight']
&& ($is_display['edit_lnk'] != 'nn' || $is_display['del_lnk'] != 'nn')
&& $is_display['text_btn'] == '1') {
echo "\n";
$vertical_display['emptyafter'] = ($is_display['edit_lnk'] != 'nn' && $is_display['del_lnk'] != 'nn') ? 2 : 1;
if ($disp_direction == 'horizontal') {
?>
align="center">
|
';
$vertical_display['emptyafter'] = ($is_display['edit_lnk'] != 'nn' && $is_display['del_lnk'] != 'nn') ? 2 : 1;
}
echo "\n";
if ($disp_direction == 'horizontal') {
?>
' . "\n";
for ($foo_i = 0; $foo_i < $vertical_display['emptypre']; $foo_i++) {
echo ' | ' . "\n";
}
reset($vertical_display['desc']);
while (list($key, $val) = each($vertical_display['desc'])) {
echo ' ' . $val;
}
for ($foo_i = 0; $foo_i < $vertical_display['emptyafter']; $foo_i++) {
echo ' | ' . "\n";
}
echo '' . "\n";
} // end if
$bgcolor = ($foo % 2) ? $GLOBALS['cfgBgcolorOne'] : $GLOBALS['cfgBgcolorTwo'];
if ($disp_direction == 'horizontal') {
// loic1: pointer code part
$on_mouse = ($GLOBALS['cfgBrowsePointerColor'] == '')
? ''
: ' onmouseover="setPointer(this, \'' . $GLOBALS['cfgBrowsePointerColor'] . '\')" onmouseout="setPointer(this, \'' . $bgcolor . '\')"';
?>
>
builds the
// the "primary" key to use in links
if ($is_display['edit_lnk'] == 'ur' /* || $is_display['edit_lnk'] == 'dr' */) {
for ($i = 0; $i < $fields_cnt; ++$i) {
$primary = $fields_meta[$i];
$condition = ' ' . PMA_backquote($primary->name) . ' ';
if (!isset($row[$primary->name])
|| (function_exists('is_null') && is_null($row[$primary->name]))) {
$condition .= 'IS NULL AND';
} else {
$condition .= '= \'' . PMA_sqlAddslashes($row[$primary->name]) . '\' AND';
}
if ($primary->primary_key > 0) {
$primary_key .= $condition;
} else if ($primary->unique_key > 0) {
$unique_key .= $condition;
}
$uva_nonprimary_condition .= $condition;
} // end for
// Correction uva 19991216: prefer primary or unique keys
// for condition, but use conjunction of all values if no
// primary key
if ($primary_key) {
$uva_condition = $primary_key;
} else if ($unique_key) {
$uva_condition = $unique_key;
} else {
$uva_condition = $uva_nonprimary_condition;
}
$uva_condition = urlencode(ereg_replace(' ?AND$', '', $uva_condition));
} // end if (1.1)
// 1.2 Defines the urls for the modify/delete link(s)
$url_query = 'lang=' . $lang
. '&server=' . $server
. '&db=' . urlencode($db)
. '&table=' . urlencode($table)
. '&pos=' . $pos
. '&session_max_rows=' . $session_max_rows
. '&disp_direction=' . $disp_direction
. '&repeat_cells=' . $repeat_cells
. '&dontlimitchars=' . $dontlimitchars;
// 1.2.1 Modify link(s)
if ($is_display['edit_lnk'] == 'ur') { // update row case
if (!empty($goto)
&& empty($GLOBALS['QUERY_STRING'])
&& (empty($GLOBALS['HTTP_SERVER_VARS']) || empty($GLOBALS['HTTP_SERVER_VARS']['QUERY_STRING']))) {
$lnk_goto = $goto;
} else {
$lnk_goto = 'sql.php3';
}
$edit_url = 'tbl_change.php3'
. '?' . $url_query
. '&primary_key=' . $uva_condition
. '&sql_query=' . urlencode($sql_query)
. '&goto=' . urlencode($lnk_goto);
$edit_str = $GLOBALS['strEdit'];
} // end if (1.2.1)
// 1.2.2 Delete/Kill link(s)
if ($is_display['del_lnk'] == 'dr') { // delete row case
$lnk_goto = 'sql.php3'
. '?' . str_replace('&', '&', $url_query)
. '&sql_query=' . urlencode($sql_query)
. '&zero_rows=' . urlencode(htmlspecialchars($GLOBALS['strDeleted']))
. '&goto=tbl_properties.php3';
$del_url = 'sql.php3'
. '?' . $url_query
. '&sql_query=' . urlencode('DELETE FROM ' . PMA_backquote($table) . ' WHERE') . $uva_condition . urlencode(' LIMIT 1')
. '&zero_rows=' . urlencode(htmlspecialchars($GLOBALS['strDeleted']))
. '&goto=' . urlencode($lnk_goto);
$js_conf = 'DELETE FROM ' . PMA_jsFormat($table)
. ' WHERE ' . trim(PMA_jsFormat(urldecode($uva_condition), FALSE)) . ' LIMIT 1';
$del_str = $GLOBALS['strDelete'];
} else if ($is_display['del_lnk'] == 'kp') { // kill process case
$lnk_goto = 'sql.php3'
. '?' . str_replace('&', '&', $url_query)
. '&sql_query=' . urlencode($sql_query)
. '&goto=main.php3';
$del_url = 'sql.php3'
. '?lang=' . $lang
. '&server=' . $server
. '&db=mysql'
. '&sql_query=' . urlencode('KILL ' . $row['Id'])
. '&goto=' . urlencode($lnk_goto);
$js_conf = 'KILL ' . $row['Id'];
$del_str = $GLOBALS['strKill'];
} // end if (1.2.2)
// 1.3 Displays the links at left if required
if ($GLOBALS['cfgModifyDeleteAtLeft']
&& ($disp_direction == 'horizontal')) {
if (!empty($edit_url)) {
?>
|
>
|
numeric == 1) {
if (!isset($row[$primary->name])
|| (function_exists('is_null') && is_null($row[$primary->name]))) {
$vertical_display['data'][$foo][$i] = ' NULL | ' . "\n";
} else if ($row[$i] != '') {
$vertical_display['data'][$foo][$i] = ' ' . $row[$primary->name] . ' | ' . "\n";
} else {
$vertical_display['data'][$foo][$i] = ' | ' . "\n";
}
} else if ($GLOBALS['cfgShowBlob'] == FALSE && eregi('BLOB', $primary->type)) {
// loic1 : mysql_fetch_fields returns BLOB in place of TEXT
// fields type, however TEXT fields must be displayed even
// if $cfgShowBlob is false -> get the true type of the
// fields.
$field_flags = mysql_field_flags($dt_result, $i);
if (eregi('BINARY', $field_flags)) {
$vertical_display['data'][$foo][$i] = ' [BLOB] | ' . "\n";
} else {
if (!isset($row[$primary->name])
|| (function_exists('is_null') && is_null($row[$primary->name]))) {
$vertical_display['data'][$foo][$i] = ' NULL | ' . "\n";
} else if ($row[$primary->name] != '') {
if (strlen($row[$primary->name]) > $GLOBALS['cfgLimitChars'] && ($dontlimitchars != 1)) {
$row[$primary->name] = substr($row[$primary->name], 0, $GLOBALS['cfgLimitChars']) . '...';
}
// loic1: displays all space characters, 4 space
// characters for tabulations and /
$row[$primary->name] = htmlspecialchars($row[$primary->name]);
$row[$primary->name] = str_replace("\011", ' ', str_replace(' ', ' ', $row[$primary->name]));
$row[$primary->name] = ereg_replace("((\015\012)|(\015)|(\012))", '
', $row[$primary->name]);
$vertical_display['data'][$foo][$i] = ' ' . $row[$primary->name] . ' | ' . "\n";
} else {
$vertical_display['data'][$foo][$i] = ' | ' . "\n";
}
}
} else {
if (!isset($row[$primary->name])
|| (function_exists('is_null') && is_null($row[$primary->name]))) {
$vertical_display['data'][$foo][$i] = ' NULL | ' . "\n";
} else if ($row[$primary->name] != '') {
// loic1: Cut text/blob fields even if $cfgShowBlob is true
if (eregi('BLOB', $primary->type)) {
if (strlen($row[$primary->name]) > $GLOBALS['cfgLimitChars'] && ($dontlimitchars != 1)) {
$row[$primary->name] = substr($row[$primary->name], 0, $GLOBALS['cfgLimitChars']) . '...';
}
}
// loic1: displays special characters from binaries
$field_flags = mysql_field_flags($dt_result, $i);
if (eregi('BINARY', $field_flags)) {
$row[$primary->name] = str_replace("\x00", '\0', $row[$primary->name]);
$row[$primary->name] = str_replace("\x08", '\b', $row[$primary->name]);
$row[$primary->name] = str_replace("\x0a", '\n', $row[$primary->name]);
$row[$primary->name] = str_replace("\x0d", '\r', $row[$primary->name]);
$row[$primary->name] = str_replace("\x1a", '\Z', $row[$primary->name]);
}
// loic1: displays all space characters, 4 space
// characters for tabulations and /
else {
$row[$primary->name] = htmlspecialchars($row[$primary->name]);
$row[$primary->name] = str_replace("\011", ' ', str_replace(' ', ' ', $row[$primary->name]));
$row[$primary->name] = ereg_replace("((\015\012)|(\015)|(\012))", '
', $row[$primary->name]);
}
$vertical_display['data'][$foo][$i] = ' ' . $row[$primary->name] . ' | ' . "\n";
} else {
$vertical_display['data'][$foo][$i] = ' | ' . "\n";
}
}
// lem9: output stored cell
if ($disp_direction == 'horizontal') {
echo $vertical_display['data'][$foo][$i];
}
if (isset($vertical_display['rowdata'][$i][$foo])) {
$vertical_display['rowdata'][$i][$foo] .= $vertical_display['data'][$foo][$i];
} else {
$vertical_display['rowdata'][$i][$foo] = $vertical_display['data'][$foo][$i];
}
} // end for (2)
// 3. Displays the modify/delete links on the right if required
if ($GLOBALS['cfgModifyDeleteAtRight']
&& ($disp_direction == 'horizontal')) {
if (!empty($edit_url)) {
?>
|
>
|
' . "\n"
. ' ' . "\n"
. ' ' . $edit_str . '' . "\n"
. ' ' . "\n";
$vertical_display['delete'][$foo] .= ' ' . "\n"
. ' ' . "\n"
. ' | ' . "\n";
echo (($disp_direction == 'horizontal') ? "\n" : '');
$foo++;
} // end while
return TRUE;
} // end of the 'PMA_displayTableBody()' function
/**
* Do display the result table with the vertical direction mode.
* Credits for this feature goes to Garvin Hicking .
*
* @return boolean always true
*
* @global array the information to display
* @global integer the number of row to display between two table headers
*
* @access private
*
* @see PMA_displayTable()
*/
function PMA_displayVerticalTable()
{
global $vertical_display, $repeat_cells;
reset($vertical_display);
// Displays "edit" link at top if required
if ($GLOBALS['cfgModifyDeleteAtLeft'] && is_array($vertical_display['edit'])) {
echo '' . "\n";
echo ' | ' . "\n";
reset($vertical_display['edit']);
$foo_counter = 0;
while (list($key, $val) = each($vertical_display['edit'])) {
if (($foo_counter != 0) && ($repeat_cells != 0) && !($foo_counter % $repeat_cells)) {
echo ' | ' . "\n";
}
echo $val;
$foo_counter++;
} // end while
echo '
' . "\n";
} // end if
// Displays "delete" link at top if required
if ($GLOBALS['cfgModifyDeleteAtLeft'] && is_array($vertical_display['delete'])) {
echo '' . "\n";
echo ' | ' . "\n";
reset($vertical_display['delete']);
$foo_counter = 0;
while (list($key, $val) = each($vertical_display['delete'])) {
if (($foo_counter != 0) && ($repeat_cells != 0) && !($foo_counter % $repeat_cells)) {
echo ' | ' . "\n";
}
echo $val;
$foo_counter++;
} // end while
echo '
' . "\n";
} // end if
// Displays data
reset($vertical_display['desc']);
while (list($key, $val) = each($vertical_display['desc'])) {
echo '' . "\n";
echo $val;
$foo_counter = 0;
while (list($subkey, $subval) = each($vertical_display['rowdata'][$key])) {
if (($foo_counter != 0) && ($repeat_cells != 0) and !($foo_counter % $repeat_cells)) {
echo $val;
}
echo $subval;
$foo_counter++;
} // end while
echo '
' . "\n";
} // end while
// Displays "edit" link at bottom if required
if ($GLOBALS['cfgModifyDeleteAtRight'] && is_array($vertical_display['edit'])) {
echo '' . "\n";
echo ' | ' . "\n";
reset($vertical_display['edit']);
$foo_counter = 0;
while (list($key, $val) = each($vertical_display['edit'])) {
if (($foo_counter != 0) && ($repeat_cells != 0) && !($foo_counter % $repeat_cells)) {
echo ' | ' . "\n";
}
echo $val;
$foo_counter++;
} // end while
echo '
' . "\n";
} // end if
// Displays "delete" link at bottom if required
if ($GLOBALS['cfgModifyDeleteAtRight'] && is_array($vertical_display['delete'])) {
echo '' . "\n";
echo ' | ' . "\n";
reset($vertical_display['delete']);
$foo_counter = 0;
while (list($key, $val) = each($vertical_display['delete'])) {
if (($foo_counter != 0) && ($repeat_cells != 0) && !($foo_counter % $repeat_cells)) {
echo ' | ' . "\n";
}
echo $val;
$foo_counter++;
} // end while
echo '
' . "\n";
}
return TRUE;
} // end of the 'PMA_displayVerticalTable' function
/**
* Displays a table of results returned by a sql query.
* This function is called by the "sql.php3" script.
*
* @param integer the link id associated to the query which results have
* to be displayed
* @param array the display mode
*
* @global string the current language
* @global integer the server to use (refers to the number in the
* configuration file)
* @global string the database name
* @global string the table name
* @global string the url to go back in case of errors
* @global string the current sql query
* @global integer the total number of rows returned by the sql query
* @global integer the total number of rows returned by the sql query
* without any programmatically appended "LIMIT" clause
* @global integer the current postion of the first record to be
* displayed
* @global array the list of fields properties
* @global integer the total number of fields returned by the sql query
* @global array informations used with vertical display mode
* @global string the display mode (horizontal/vertical)
* @global integer the number of row to display between two table headers
* @global boolean whether to limit the number of displayed characters of
* text type fields or not
*
* @access private
*
* @see PMA_showMessage(), PMA_setDisplayMode(),
* PMA_displayTableNavigation(), PMA_displayTableHeaders(),
* PMA_displayTableBody()
*/
function PMA_displayTable(&$dt_result, &$the_disp_mode)
{
global $lang, $server, $db, $table;
global $goto;
global $sql_query, $num_rows, $unlim_num_rows, $pos, $fields_meta, $fields_cnt;
global $vertical_display, $disp_direction, $repeat_cells;
global $dontlimitchars;
// 1. ----- Prepares the work -----
// 1.1 Gets the informations about which functionnalities should be
// displayed
$total = '';
$is_display = PMA_setDisplayMode($the_disp_mode, $total);
if ($total == '') {
unset($total);
}
// 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') {
$pos_next = 0;
$pos_prev = 0;
} else {
$pos_next = $pos + $GLOBALS['cfgMaxRows'];
$pos_prev = $pos - $GLOBALS['cfgMaxRows'];
if ($pos_prev < 0) {
$pos_prev = 0;
}
}
} // end if
// 1.3 Urlencodes the query to use in input form fields ($sql_query
// will be stripslashed in 'sql.php3' if the 'magic_quotes_gpc'
// directive is set to 'on')
if (get_magic_quotes_gpc()) {
$encoded_sql_query = urlencode(addslashes($sql_query));
} else {
$encoded_sql_query = urlencode($sql_query);
}
// 2. ----- Displays the top of the page -----
// 2.1 Displays a messages with position informations
if ($is_display['nav_bar'] == '1' && isset($pos_next)) {
if (isset($unlim_num_rows) && $unlim_num_rows != $total) {
$selectstring = ', ' . $unlim_num_rows . ' ' . $GLOBALS['strSelectNumRows'];
} else {
$selectstring = '';
}
$last_shown_rec = ($GLOBALS['session_max_rows'] == 'all' || $pos_next > $total)
? $total
: $pos_next;
PMA_showMessage($GLOBALS['strShowingRecords'] . " $pos - $last_shown_rec ($total " . $GLOBALS['strTotal'] . $selectstring . ')');
} else {
PMA_showMessage($GLOBALS['strSQLQuery']);
}
// 2.3 Displays the navigation bars
if (!isset($table) || strlen(trim($table)) == 0) {
$table = $fields_meta[0]->table;
}
if ($is_display['nav_bar'] == '1') {
PMA_displayTableNavigation($pos_next, $pos_prev, $encoded_sql_query);
echo "\n";
} else {
echo "\n" . '
' . "\n";
}
// 3. ----- Displays the results table -----
?>
' . "\n";
}
} // end of the 'PMA_displayTable()' function
} // $__PMA_DISPLAY_TBL_LIB__
?>