updates the
// display mode
if ($the_disp_mode != 'nnnn000000') {
// 2.0 Print view -> set all elements to false!
if (isset($GLOBALS['printview']) && $GLOBALS['printview'] == '1') {
$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) '0';
$do_display['text_btn'] = (string) '0';
$do_display['pview_lnk'] = (string) '0';
}
// 2.1 Statement is a "SELECT COUNT", a
// "CHECK/ANALYZE/REPAIR/OPTIMIZE", an "EXPLAIN" one or
// contains a "PROC ANALYSE" part
elseif ($GLOBALS['is_count'] || $GLOBALS['is_analyse'] || $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';
if ($GLOBALS['is_maint']) {
$do_display['text_btn'] = (string) '1';
} else {
$do_display['text_btn'] = (string) '0';
}
$do_display['pview_lnk'] = (string) '1';
}
// 2.2 Statement is a "SHOW..."
elseif ($GLOBALS['is_show']) {
/**
* 2.2.1
* @todo defines edit/delete links depending on show statement
*/
$tmp = preg_match('@^SHOW[[:space:]]+(VARIABLES|(FULL[[:space:]]+)?PROCESSLIST|STATUS|TABLE|GRANTS|CREATE|LOGS|DATABASES|FIELDS)@i', $GLOBALS['sql_query'], $which);
if (isset($which[1]) && 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) '1';
$do_display['pview_lnk'] = (string) '1';
}
// 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;
$do_display['text_btn'] = (string) '1';
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.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)
// 2.3.3 Always display print view link
$do_display['pview_lnk'] = (string) '1';
$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;
} elseif (($do_display['nav_bar'] == '1' || $do_display['sort_lnk'] == '1')
&& (isset($db) && strlen($db) && !empty($table))) {
$the_total = PMA_Table::countRecords($db, $table, true);
}
// 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') {
// - Do not display sort links if less than 2 rows.
// - For a VIEW we (probably) did not count the number of rows
// so don't test this number here, it would remove the possibility
// of sorting VIEW results.
if (isset($unlim_num_rows) && $unlim_num_rows < 2 && ! PMA_Table::isView($db, $table)) {
// garvin: force display of navbar for vertical/horizontal display-choice.
// $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 $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;
/**
* @todo move this to a central place
* @todo for other future table types
*/
$is_innodb = (isset($showtable['Type']) && $showtable['Type'] == 'InnoDB');
?>
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...
?>
= $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";
?>
1){ //if1
?>
' . "\n";
}
} // end of the 'PMA_displayTable()' function
function default_function($buffer) {
$buffer = htmlspecialchars($buffer);
$buffer = str_replace("\011", ' ',
str_replace(' ', ' ', $buffer));
$buffer = preg_replace("@((\015\012)|(\015)|(\012))@", ' ', $buffer);
return $buffer;
}
/**
* Displays operations that are available on results.
*
* @param array the display mode
* @param array the analyzed query
*
* @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
*
* @see PMA_showMessage(), PMA_setDisplayMode(),
* PMA_displayTableNavigation(), PMA_displayTableHeaders(),
* 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;
$header_shown = FALSE;
$header = ' ';
}
}
?>