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 else if ($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'; $do_display['text_btn'] = (string) '0'; $do_display['pview_lnk'] = (string) '1'; } // 2.2 Statement is a "SHOW..." else if ($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 (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; } else if (($do_display['nav_bar'] == '1' || $do_display['sort_lnk'] == '1') && (!empty($db) && !empty($table))) { $the_total = PMA_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') { if (isset($unlim_num_rows) && $unlim_num_rows < 2) { // 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 the current language * @global string the currect charset for MySQL * @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/horizontalflipped) * @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, $convcharset, $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['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" . ' ' . "\n" . ' ' . "\n" . ' ' . "\n" . ' ' . "\n" . ' '; $param2 = ' ' . "\n" . ' '; echo ' ' . sprintf($GLOBALS['strRowsModeOptions'], "\n" . $param1, "\n" . $param2) . "\n"; ?>
   
/>
/>
    for keep the form alignment of button < and << ?>
   
' . "\n"; echo PMA_generate_common_hidden_inputs($db, $table, 5); echo '' . "\n"; echo '' . "\n"; echo '' . "\n"; echo '' . "\n"; echo '' . "\n"; echo $GLOBALS['strSortByKey'] . ':  '; echo "\n"; echo ''; echo "\n"; echo ''; echo "\n"; ?> ' . "\n"; echo PMA_generate_common_hidden_inputs($db, $table, 1); echo '' . "\n"; echo '' . "\n"; echo '' . "\n"; echo '' . "\n"; } // 1. Displays the full/partial text button (part 1)... if ($disp_direction == 'horizontal' || $disp_direction == 'horizontalflipped') { $colspan = ($is_display['edit_lnk'] != 'nn' && $is_display['del_lnk'] != 'nn') ? ' colspan="3"' : ''; } else { $rowspan = ($is_display['edit_lnk'] != 'nn' && $is_display['del_lnk'] != 'nn') ? ' rowspan="3"' : ''; } $text_url = 'sql.php?' . PMA_generate_common_url($db, $table) . '&sql_query=' . urlencode($sql_query) . '&pos=' . $pos . '&session_max_rows=' . $session_max_rows . '&pos=' . $pos . '&disp_direction=' . $disp_direction . '&repeat_cells=' . $repeat_cells . '&goto=' . $goto . '&dontlimitchars=' . (($dontlimitchars) ? 0 : 1); // ... 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') { ?> <?php echo (($dontlimitchars) ? $GLOBALS['strPartialText'] : $GLOBALS['strFullText']); ?> <?php echo (($dontlimitchars) ? $GLOBALS['strPartialText'] : $GLOBALS['strFullText']); ?> align="center"> <?php echo (($dontlimitchars) ? $GLOBALS['strPartialText'] : $GLOBALS['strFullText']); ?> ' . "\n" . ' ' . "\n" . ' ' . (($dontlimitchars) ? $GLOBALS['strPartialText'] : $GLOBALS['strFullText']) . '' . "\n" . ' ' . "\n"; } // end vertical mode } // ... else if no button, displays empty(ies) col(s) if required else if ($GLOBALS['cfg']['ModifyDeleteAtLeft'] && ($is_display['edit_lnk'] != 'nn' || $is_display['del_lnk'] != 'nn')) { $vertical_display['emptypre'] = ($is_display['edit_lnk'] != 'nn' && $is_display['del_lnk'] != 'nn') ? 3 : 0; if ($disp_direction == 'horizontal' || $disp_direction == 'horizontalflipped') { echo "\n"; ?> > ' . "\n"; } // end vertical mode } // 2. Displays the fields' name // 2.0 If sorting links should be used, checks if the query is a "JOIN" // statement (see 2.1.3) // 2.0.1 Prepare Display column comments if enabled ($cfg['ShowBrowseComments']). // Do not show comments, if using horizontalflipped mode, because of space usage if ($GLOBALS['cfg']['ShowBrowseComments'] && $GLOBALS['cfgRelation']['commwork'] && $disp_direction != 'horizontalflipped') { $comments_map = PMA_getComments($db, $table); } else { $comments_map = array(); } if ($GLOBALS['cfgRelation']['commwork'] && $GLOBALS['cfgRelation']['mimework'] && $GLOBALS['cfg']['BrowseMIME']) { require_once('./libraries/transformations.lib.php'); $GLOBALS['mime_map'] = PMA_getMIME($db, $table); } if ($is_display['sort_lnk'] == '1') { $is_join = preg_match('@(.*)[[:space:]]+FROM[[:space:]]+.*[[:space:]]+JOIN@i', $sql_query, $select_stt); } else { $is_join = FALSE; } // garvin: See if we have to highlight any header fields of a WHERE query. // Uses SQL-Parser results. $highlight_columns = array(); if (isset($analyzed_sql) && isset($analyzed_sql[0]) && isset($analyzed_sql[0]['where_clause_identifiers'])) { $wi = 0; if (isset($analyzed_sql[0]['where_clause_identifiers']) && is_array($analyzed_sql[0]['where_clause_identifiers'])) { foreach($analyzed_sql[0]['where_clause_identifiers'] AS $wci_nr => $wci) { $highlight_columns[$wci] = 'true'; } } } for ($i = 0; $i < $fields_cnt; $i++) { // garvin: See if this column should get highlight because it's used in the // where-query. if (isset($highlight_columns[$fields_meta[$i]->name]) || isset($highlight_columns[PMA_backquote($fields_meta[$i]->name)])) { $column_style = 'style="border: 1px solid ' . $GLOBALS['cfg']['BrowseMarkerColor'] . '"'; } else { $column_style = ''; } // 2.0 Prepare comment-HTML-wrappers for each row, if defined/enabled. if (isset($comments_map[$fields_meta[$i]->name])) { $comments_table_wrap_pre = '
'; $comments_table_wrap_post = '
' . htmlspecialchars($comments_map[$fields_meta[$i]->name]) . '
'; } else { $comments_table_wrap_pre = ''; $comments_table_wrap_post = ''; } // 2.1 Results can be sorted if ($is_display['sort_lnk'] == '1') { // 2.1.1 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, or in queries like // SELECT `1`.`master_field` , `2`.`master_field` // FROM `PMA_relation` AS `1` , `PMA_relation` AS `2` if (($is_join && !preg_match('~([^[:space:],]|`[^`]`)[[:space:]]+(as[[:space:]]+)?' . $fields_meta[$i]->name . '~i', $select_stt[1], $parts)) || ( isset($analyzed_sql[0]['select_expr'][$i]['expr']) && isset($analyzed_sql[0]['select_expr'][$i]['column']) && $analyzed_sql[0]['select_expr'][$i]['expr'] != $analyzed_sql[0]['select_expr'][$i]['column']) ) { $sort_tbl = PMA_backquote($fields_meta[$i]->table) . '.'; } else { $sort_tbl = ''; } // 2.1.2 Checks if the current column is used to sort the // results if (empty($sql_order)) { $is_in_sort = FALSE; } else { // field name may be preceded by a space, or any number // of characters followed by a dot (tablename.fieldname) // so do a direct comparison // for the sort expression (avoids problems with queries // like "SELECT id, count(id)..." and clicking to sort // on id or on count(id) ) $is_in_sort = ($sort_tbl . PMA_backquote($fields_meta[$i]->name) == $sort_expression ? TRUE : FALSE); } // 2.1.3 Check the field name for backquotes. // If it contains some, it's probably a function column // like 'COUNT(`field`)' if (strpos(' ' . $fields_meta[$i]->name, '`') > 0) { $sort_order = ' ORDER BY \'' . $fields_meta[$i]->name . '\' '; } else { $sort_order = ' ORDER BY ' . $sort_tbl . PMA_backquote($fields_meta[$i]->name) . ' '; } // 2.1.4 Do define the sorting url if (!$is_in_sort) { // loic1: patch #455484 ("Smart" order) $cfg['Order'] = strtoupper($GLOBALS['cfg']['Order']); if ($cfg['Order'] == 'SMART') { $cfg['Order'] = (preg_match('@time|date@i', $fields_meta[$i]->type)) ? 'DESC' : 'ASC'; } $sort_order .= $cfg['Order']; $order_img = ''; } else if (preg_match('@[[:space:]]ASC$@i', $sql_order)) { $sort_order .= ' DESC'; $order_img = ' '. $GLOBALS['strAscending'] . ''; } else if (preg_match('@[[:space:]]DESC$@i', $sql_order)) { $sort_order .= ' ASC'; $order_img = ' '. $GLOBALS['strDescending'] . ''; } if (preg_match('@(.*)([[:space:]](LIMIT (.*)|PROCEDURE (.*)|FOR UPDATE|LOCK IN SHARE MODE))@i', $unsorted_sql_query, $regs3)) { $sorted_sql_query = $regs3[1] . $sort_order . $regs3[2]; } else { $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); // 2.1.5 Displays the sorting url if ($disp_direction == 'horizontal' || $disp_direction == 'horizontalflipped') { echo "\n"; ?> > > name), "
\n") : htmlspecialchars($fields_meta[$i]->name)); ?>
' . "\n" . $comments_table_wrap_pre . ' ' . "\n" . ' ' . htmlspecialchars($fields_meta[$i]->name) . '' . $order_img . "\n" . $comments_table_wrap_post . ' ' . "\n"; } // end if (2.1) // 2.2 Results can't be sorted else { if ($disp_direction == 'horizontal' || $disp_direction == 'horizontalflipped') { echo "\n"; ?> > name), "
\n") : htmlspecialchars($fields_meta[$i]->name)) . "\n"; ?> ' . "\n" . $comments_table_wrap_pre . ' ' . htmlspecialchars($fields_meta[$i]->name) . "\n" . $comments_table_wrap_post . ' '; } // end else (2.2) } // 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['cfg']['ModifyDeleteAtRight'] && ($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') { echo "\n"; ?> align="center"> <?php echo (($dontlimitchars) ? $GLOBALS['strPartialText'] : $GLOBALS['strFullText']); ?> ' . "\n" . ' ' . "\n" . ' ' . (($dontlimitchars) ? $GLOBALS['strPartialText'] : $GLOBALS['strFullText']) . '' . "\n" . ' ' . "\n"; } // end vertical mode } // ... else if no button, displays empty cols if required // (unless coming from Browse mode print view) else if ($GLOBALS['cfg']['ModifyDeleteAtRight'] && ($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') { echo "\n"; ?> > ' . "\n"; } // end vertical mode } if ($disp_direction == 'horizontal' || $disp_direction == 'horizontalflipped') { echo "\n"; ?> ' . "\n"; for ($foo_i = 0; $foo_i < $vertical_display['emptypre']; $foo_i++) { echo '  ' . "\n"; } foreach($vertical_display['desc'] AS $key => $val) { echo $val; } for ($foo_i = 0; $foo_i < $vertical_display['emptyafter']; $foo_i++) { echo '  ' . "\n"; } echo '' . "\n"; } // end if if (isset($GLOBALS['printview']) && ($GLOBALS['printview'] == '1')) { $bgcolor = '#ffffff'; } else { $bgcolor = ($row_no % 2) ? $GLOBALS['cfg']['BgcolorOne'] : $GLOBALS['cfg']['BgcolorTwo']; } if ($disp_direction == 'horizontal' || $disp_direction == 'horizontalflipped') { // loic1: pointer code part $on_mouse = ''; if (!isset($GLOBALS['printview']) || ($GLOBALS['printview'] != '1')) { if ($GLOBALS['cfg']['BrowsePointerColor'] != '') { $on_mouse = ' onmouseover="setPointer(this, ' . $row_no . ', \'over\', \'' . $bgcolor . '\', \'' . $GLOBALS['cfg']['BrowsePointerColor'] . '\', \'' . $GLOBALS['cfg']['BrowseMarkerColor'] . '\');"' . ' onmouseout="setPointer(this, ' . $row_no . ', \'out\', \'' . $bgcolor . '\', \'' . $GLOBALS['cfg']['BrowsePointerColor'] . '\', \'' . $GLOBALS['cfg']['BrowseMarkerColor'] . '\');"'; } if ($GLOBALS['cfg']['BrowseMarkerColor'] != '') { $on_mouse .= ' onmousedown="setPointer(this, ' . $row_no . ', \'click\', \'' . $bgcolor . '\', \'' . $GLOBALS['cfg']['BrowsePointerColor'] . '\', \'' . $GLOBALS['cfg']['BrowseMarkerColor'] . '\');"'; } } // end if ?> > builds 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) { $field_flags = PMA_mysql_field_flags($dt_result, $i); $meta = $fields_meta[$i]; // do not use an alias in a condition $column_for_condition = $meta->name; if (isset($analyzed_sql[0]['select_expr']) && is_array($analyzed_sql[0]['select_expr'])) { foreach($analyzed_sql[0]['select_expr'] AS $select_expr_position => $select_expr) { $alias = $analyzed_sql[0]['select_expr'][$select_expr_position]['alias']; if (!empty($alias)) { $true_column = $analyzed_sql[0]['select_expr'][$select_expr_position]['column']; if ($alias == $meta->name) { $column_for_condition = $true_column; } // end if } // end if } // end while } // to fix the bug where float fields (primary or not) // can't be matched because of the imprecision of // floating comparison, use CONCAT // (also, the syntax "CONCAT(field) IS NULL" // that we need on the next "if" will work) if ($meta->type == 'real') { $condition = ' CONCAT(' . PMA_backquote($column_for_condition) . ') '; } else { $condition = ' ' . PMA_backquote($column_for_condition) . ' '; } // end if... else... // loic1: To fix bug #474943 under php4, the row // pointer will depend on whether the "is_null" // php4 function is available or not $pointer = (function_exists('is_null') ? $i : $meta->name); if (!isset($row[$meta->name]) || (function_exists('is_null') && is_null($row[$pointer]))) { $condition .= 'IS NULL AND'; } else { if ($meta->type == 'blob' // hexify only if this is a true not empty BLOB && stristr($field_flags, 'BINARY') && !empty($row[$pointer])) { $condition .= 'LIKE 0x' . bin2hex($row[$pointer]). ' AND'; } else { $condition .= '= \'' . PMA_sqlAddslashes($row[$pointer], FALSE, TRUE) . '\' AND'; } } if ($meta->primary_key > 0) { $primary_key .= $condition; } else if ($meta->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(preg_replace('|\s?AND$|', '', $uva_condition)); } // end if (1.1) // 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; // We need to copy the value or else the == 'both' check will always return true $propicon = (string)$GLOBALS['cfg']['PropertiesIconic']; if ($propicon == 'both') { $iconic_spacer = ''; } else { $iconic_spacer = ''; } // 1.2.1 Modify link(s) if ($is_display['edit_lnk'] == 'ur') { // update row case // $lnk_goto = 'sql.php' // . '?' . str_replace('&', '&', $url_query) // . '&sql_query=' . urlencode($sql_query) // . '&goto=' . (empty($goto) ? 'tbl_properties.php' : $goto); // to reduce the length of the URL, because of some browsers limitations: $lnk_goto = 'sql.php'; $edit_url = 'tbl_change.php' . '?' . $url_query . '&primary_key=' . $uva_condition . '&sql_query=' . urlencode($sql_query) . '&goto=' . urlencode($lnk_goto); if ($GLOBALS['cfg']['PropertiesIconic'] == FALSE) { $edit_str = $GLOBALS['strEdit']; } else { $edit_str = $iconic_spacer . '' . $GLOBALS['strEdit'] . ''; if ($propicon == 'both') { $edit_str .= ' ' . $GLOBALS['strEdit'] . ''; } } } // end if (1.2.1) if ($table == $GLOBALS['cfg']['Bookmark']['table'] && $db == $GLOBALS['cfg']['Bookmark']['db']) { $bookmark_go = ''; if ($GLOBALS['cfg']['PropertiesIconic'] == FALSE) { $bookmark_go .= $GLOBALS['strExecuteBookmarked']; } else { $bookmark_go .= $iconic_spacer . '' . $GLOBALS['strExecuteBookmarked'] . ''; if ($propicon == 'both') { $bookmark_go .= ' ' . $GLOBALS['strExecuteBookmarked'] . ''; } } $bookmark_go .= ''; } else { $bookmark_go = ''; } // 1.2.2 Delete/Kill link(s) if ($is_display['del_lnk'] == 'dr') { // delete row case $lnk_goto = 'sql.php' . '?' . str_replace('&', '&', $url_query) . '&sql_query=' . urlencode($sql_query) . '&zero_rows=' . urlencode(htmlspecialchars($GLOBALS['strDeleted'])) . '&goto=' . (empty($goto) ? 'tbl_properties.php' : $goto); $del_query = urlencode('DELETE FROM ' . PMA_backquote($table) . ' WHERE') . $uva_condition . '+LIMIT+1'; $del_url = 'sql.php' . '?' . $url_query . '&sql_query=' . $del_query . '&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'; if ($GLOBALS['cfg']['PropertiesIconic'] == FALSE) { $del_str = $GLOBALS['strDelete']; } else { $del_str = $iconic_spacer . '' . $GLOBALS['strDelete'] . ''; if ($propicon == 'both') { $del_str .= ' ' . $GLOBALS['strDelete'] . ''; } } } else if ($is_display['del_lnk'] == 'kp') { // kill process case $lnk_goto = 'sql.php' . '?' . str_replace('&', '&', $url_query) . '&sql_query=' . urlencode($sql_query) . '&goto=main.php'; $del_url = 'sql.php?' . PMA_generate_common_url('mysql') . '&sql_query=' . urlencode('KILL ' . $row['Id']) . '&goto=' . urlencode($lnk_goto); $del_query = urlencode('KILL ' . $row['Id']); $js_conf = 'KILL ' . $row['Id']; if ($GLOBALS['cfg']['PropertiesIconic'] == FALSE) { $del_str = $GLOBALS['strKill']; } else { $del_str = $iconic_spacer . '' . $GLOBALS['strKill'] . ''; if ($propicon == 'both') { $del_str .= ' ' . $GLOBALS['strKill'] . ''; } } } // end if (1.2.2) // 1.3 Displays the links at left if required if ($GLOBALS['cfg']['ModifyDeleteAtLeft'] && ($disp_direction == 'horizontal' || $disp_direction == 'horizontalflipped')) { require('./libraries/display_tbl_links.lib.php'); } // end if (1.3) echo (($disp_direction == 'horizontal' || $disp_direction == 'horizontalflipped') ? "\n" : ''); } // end if (1) // 2. Displays the rows' values for ($i = 0; $i < $fields_cnt; ++$i) { $meta = $fields_meta[$i]; // loic1: To fix bug #474943 under php4, the row pointer will // depend on whether the "is_null" php4 function is // available or not $pointer = (function_exists('is_null') ? $i : $meta->name); // garvin: See if this column should get highlight because it's used in the // where-query. if (isset($highlight_columns) && (isset($highlight_columns[$meta->name]) || isset($highlight_columns[PMA_backquote($meta->name)]))) { $column_style = 'style="border: 1px solid ' . $GLOBALS['cfg']['BrowseMarkerColor'] . '"'; } else { $column_style = ''; } // garvin: Wrap MIME-transformations. [MIME] $default_function = 'default_function'; // default_function $transform_function = $default_function; $transform_options = array(); if ($GLOBALS['cfgRelation']['mimework'] && $GLOBALS['cfg']['BrowseMIME']) { if (isset($GLOBALS['mime_map'][$meta->name]['mimetype']) && isset($GLOBALS['mime_map'][$meta->name]['transformation']) && !empty($GLOBALS['mime_map'][$meta->name]['transformation'])) { $include_file = PMA_sanitizeTransformationFile($GLOBALS['mime_map'][$meta->name]['transformation']); if (file_exists('./libraries/transformations/' . $include_file)) { $transformfunction_name = preg_replace('@(\.inc\.php3?)$@i', '', $GLOBALS['mime_map'][$meta->name]['transformation']); require_once('./libraries/transformations/' . $include_file); if (function_exists('PMA_transformation_' . $transformfunction_name)) { $transform_function = 'PMA_transformation_' . $transformfunction_name; $transform_options = PMA_transformation_getOptions((isset($GLOBALS['mime_map'][$meta->name]['transformation_options']) ? $GLOBALS['mime_map'][$meta->name]['transformation_options'] : '')); $meta->mimetype = str_replace('_', '/', $GLOBALS['mime_map'][$meta->name]['mimetype']); } } // end if file_exists } // end if transformation is set } // end if mime/transformation works. $transform_options['wrapper_link'] = '?' . (isset($url_query) ? $url_query : '') . '&primary_key=' . (isset($uva_condition) ? $uva_condition : '') . '&sql_query=' . (isset($sql_query) ? urlencode($sql_query) : '') . '&goto=' . (isset($sql_goto) ? urlencode($lnk_goto) : '') . '&transform_key=' . urlencode($meta->name); // n u m e r i c if ($meta->numeric == 1) { // lem9: if two fields have the same name (this is possible // with self-join queries, for example), using $meta->name // will show both fields NULL even if only one is NULL, // so use the $pointer // (works only if function_exists('is_null') // PS: why not always work with the number ($i), since // the default second parameter of // mysql_fetch_array() is MYSQL_BOTH, so we always get // associative and numeric indices? //if (!isset($row[$meta->name]) if (!isset($row[$pointer]) || (function_exists('is_null') && is_null($row[$pointer]))) { $vertical_display['data'][$row_no][$i] = ' NULL' . "\n"; } else if ($row[$pointer] != '') { $vertical_display['data'][$row_no][$i] = ' '; if (isset($analyzed_sql[0]['select_expr']) && is_array($analyzed_sql[0]['select_expr'])) { foreach($analyzed_sql[0]['select_expr'] AS $select_expr_position => $select_expr) { $alias = $analyzed_sql[0]['select_expr'][$select_expr_position]['alias']; if (!empty($alias)) { $true_column = $analyzed_sql[0]['select_expr'][$select_expr_position]['column']; if ($alias == $meta->name) { $meta->name = $true_column; } // end if } // end if } // end while } if (isset($map[$meta->name])) { // Field to display from the foreign table? if (!empty($map[$meta->name][2])) { $dispsql = 'SELECT ' . PMA_backquote($map[$meta->name][2]) . ' FROM ' . PMA_backquote($map[$meta->name][3]) . '.' . PMA_backquote($map[$meta->name][0]) . ' WHERE ' . PMA_backquote($map[$meta->name][1]) . ' = ' . $row[$pointer]; $dispresult = PMA_mysql_query($dispsql); if ($dispresult && mysql_num_rows($dispresult) > 0) { $dispval = PMA_mysql_result($dispresult, 0); } else { $dispval = $GLOBALS['strLinkNotFound']; } } else { $dispval = ''; } // end if... else... if (isset($GLOBALS['printview']) && $GLOBALS['printview'] == '1') { $vertical_display['data'][$row_no][$i] .= ($transform_function != $default_function ? $transform_function($row[$pointer], $transform_options, $meta) : $transform_function($row[$pointer], array(), $meta)) . ' [->' . $dispval . ']'; } else { $title = (!empty($dispval))? ' title="' . htmlspecialchars($dispval) . '"' : ''; $vertical_display['data'][$row_no][$i] .= '' . ($transform_function != $default_function ? $transform_function($row[$pointer], $transform_options, $meta) : $transform_function($row[$pointer], array(), $meta)) . ''; } } else { $vertical_display['data'][$row_no][$i] .= ($transform_function != $default_function ? $transform_function($row[$pointer], $transform_options, $meta) : $transform_function($row[$pointer], array(), $meta)); } $vertical_display['data'][$row_no][$i] .= '' . "\n"; } else { $vertical_display['data'][$row_no][$i] = '  ' . "\n"; } // b l o b } else if ($GLOBALS['cfg']['ShowBlob'] == FALSE && stristr($meta->type, 'BLOB')) { // loic1 : PMA_mysql_fetch_fields returns BLOB in place of // TEXT fields type, however TEXT fields must be displayed // even if $cfg['ShowBlob'] is false -> get the true type // of the fields. $field_flags = PMA_mysql_field_flags($dt_result, $i); if (stristr($field_flags, 'BINARY')) { $blobtext = '[BLOB'; if (isset($row[$pointer])) { $blob_size = PMA_formatByteDown(strlen($row[$pointer]), 3, 1); $blobtext .= ' - '. $blob_size [0] . ' ' . $blob_size[1]; unset($blob_size); } $blobtext .= ']'; $blobtext = ($default_function != $transform_function ? $transform_function($blobtext, $transform_options, $meta) : $default_function($blobtext, array(), $meta)); $vertical_display['data'][$row_no][$i] = ' ' . $blobtext . ''; } else { //if (!isset($row[$meta->name]) if (!isset($row[$pointer]) || (function_exists('is_null') && is_null($row[$pointer]))) { $vertical_display['data'][$row_no][$i] = ' NULL' . "\n"; } else if ($row[$pointer] != '') { // garvin: if a transform function for blob is set, none of these replacements will be made if (strlen($row[$pointer]) > $GLOBALS['cfg']['LimitChars'] && ($dontlimitchars != 1)) { $row[$pointer] = substr($row[$pointer], 0, $GLOBALS['cfg']['LimitChars']) . '...'; } // loic1: displays all space characters, 4 space // characters for tabulations and / $row[$pointer] = ($default_function != $transform_function ? $transform_function($row[$pointer], $transform_options, $meta) : $default_function($row[$pointer], array(), $meta)); $vertical_display['data'][$row_no][$i] = ' ' . $row[$pointer] . '' . "\n"; } else { $vertical_display['data'][$row_no][$i] = '  ' . "\n"; } } } else { //if (!isset($row[$meta->name]) if (!isset($row[$pointer]) || (function_exists('is_null') && is_null($row[$pointer]))) { $vertical_display['data'][$row_no][$i] = ' NULL' . "\n"; } else if ($row[$pointer] != '') { // loic1: support blanks in the key $relation_id = $row[$pointer]; // nijel: Cut all fields to $cfg['LimitChars'] if (strlen($row[$pointer]) > $GLOBALS['cfg']['LimitChars'] && ($dontlimitchars != 1)) { $row[$pointer] = substr($row[$pointer], 0, $GLOBALS['cfg']['LimitChars']) . '...'; } // loic1: displays special characters from binaries $field_flags = PMA_mysql_field_flags($dt_result, $i); if (stristr($field_flags, 'BINARY')) { $row[$pointer] = str_replace("\x00", '\0', $row[$pointer]); $row[$pointer] = str_replace("\x08", '\b', $row[$pointer]); $row[$pointer] = str_replace("\x0a", '\n', $row[$pointer]); $row[$pointer] = str_replace("\x0d", '\r', $row[$pointer]); $row[$pointer] = str_replace("\x1a", '\Z', $row[$pointer]); $row[$pointer] = ($default_function != $transform_function ? $transform_function($row[$pointer], $transform_options, $meta) : $default_function($row[$pointer], array(), $meta)); } // loic1: displays all space characters, 4 space // characters for tabulations and / else { $row[$pointer] = ($default_function != $transform_function ? $transform_function($row[$pointer], $transform_options, $meta) : $default_function($row[$pointer], array(), $meta)); } // garvin: transform functions may enable nowrapping: $function_nowrap = $transform_function . '_nowrap'; $bool_nowrap = (($default_function != $transform_function && function_exists($function_nowrap)) ? $function_nowrap($transform_options) : false); // loic1: do not wrap if date field type $nowrap = ((preg_match('@DATE|TIME@i', $meta->type) || $bool_nowrap) ? ' nowrap="nowrap"' : ''); $vertical_display['data'][$row_no][$i] = ' '; if (isset($analyzed_sql[0]['select_expr']) && is_array($analyzed_sql[0]['select_expr'])) { foreach($analyzed_sql[0]['select_expr'] AS $select_expr_position => $select_expr) { $alias = $analyzed_sql[0]['select_expr'][$select_expr_position]['alias']; if (!empty($alias)) { $true_column = $analyzed_sql[0]['select_expr'][$select_expr_position]['column']; if ($alias == $meta->name) { $meta->name = $true_column; } // end if } // end if } // end while } if (isset($map[$meta->name])) { // Field to display from the foreign table? if (!empty($map[$meta->name][2])) { $dispsql = 'SELECT ' . PMA_backquote($map[$meta->name][2]) . ' FROM ' . PMA_backquote($map[$meta->name][3]) . '.' . PMA_backquote($map[$meta->name][0]) . ' WHERE ' . PMA_backquote($map[$meta->name][1]) . ' = \'' . PMA_sqlAddslashes($row[$pointer]) . '\''; $dispresult = @PMA_mysql_query($dispsql); if ($dispresult && mysql_num_rows($dispresult) > 0) { $dispval = PMA_mysql_result($dispresult, 0); } else { $dispval = $GLOBALS['strLinkNotFound']; } } else { $dispval = ''; } $title = (!empty($dispval))? ' title="' . htmlspecialchars($dispval) . '"' : ''; $vertical_display['data'][$row_no][$i] .= '' . $row[$pointer] . ''; } else { $vertical_display['data'][$row_no][$i] .= $row[$pointer]; } $vertical_display['data'][$row_no][$i] .= '' . "\n"; } else { $vertical_display['data'][$row_no][$i] = '  ' . "\n"; } } // lem9: output stored cell if ($disp_direction == 'horizontal' || $disp_direction == 'horizontalflipped') { echo $vertical_display['data'][$row_no][$i]; } if (isset($vertical_display['rowdata'][$i][$row_no])) { $vertical_display['rowdata'][$i][$row_no] .= $vertical_display['data'][$row_no][$i]; } else { $vertical_display['rowdata'][$i][$row_no] = $vertical_display['data'][$row_no][$i]; } } // end for (2) // 3. Displays the modify/delete links on the right if required if ($GLOBALS['cfg']['ModifyDeleteAtRight'] && ($disp_direction == 'horizontal' || $disp_direction == 'horizontalflipped')) { require('./libraries/display_tbl_links.lib.php'); } // end if (3) if ($disp_direction == 'horizontal' || $disp_direction == 'horizontalflipped') { echo "\n"; ?> ' . "\n" . ' ' . "\n" . ' ' . "\n"; } else { unset($vertical_display['row_delete'][$row_no]); } if (isset($edit_url)) { $vertical_display['edit'][$row_no] .= ' ' . "\n" . PMA_linkOrButton($edit_url, $edit_str, '') . $bookmark_go . ' ' . "\n"; } else { unset($vertical_display['edit'][$row_no]); } if (isset($del_url)) { $vertical_display['delete'][$row_no] .= ' ' . "\n" . PMA_linkOrButton($del_url, $del_str, (isset($js_conf) ? $js_conf : '')) . ' ' . "\n"; } else { unset($vertical_display['delete'][$row_no]); } echo (($disp_direction == 'horizontal' || $disp_direction == 'horizontalflipped') ? "\n" : ''); $row_no++; } // end while if (isset($url_query)) { $GLOBALS['url_query'] = $url_query; } 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; // Displays "multi row delete" link at top if required if ($GLOBALS['cfg']['ModifyDeleteAtLeft'] && is_array($vertical_display['row_delete']) && (count($vertical_display['row_delete']) > 0 || !empty($vertical_display['textbtn']))) { echo '' . "\n"; echo $vertical_display['textbtn']; $foo_counter = 0; foreach($vertical_display['row_delete'] AS $key => $val) { if (($foo_counter != 0) && ($repeat_cells != 0) && !($foo_counter % $repeat_cells)) { echo ' ' . "\n"; } echo $val; $foo_counter++; } // end while echo '' . "\n"; } // end if // Displays "edit" link at top if required if ($GLOBALS['cfg']['ModifyDeleteAtLeft'] && is_array($vertical_display['edit']) && (count($vertical_display['edit']) > 0 || !empty($vertical_display['textbtn']))) { echo '' . "\n"; if (!is_array($vertical_display['row_delete'])) { echo $vertical_display['textbtn']; } $foo_counter = 0; foreach($vertical_display['edit'] AS $key => $val) { 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['cfg']['ModifyDeleteAtLeft'] && is_array($vertical_display['delete']) && (count($vertical_display['delete']) > 0 || !empty($vertical_display['textbtn']))) { echo '' . "\n"; if (!is_array($vertical_display['edit']) && !is_array($vertical_display['row_delete'])) { echo $vertical_display['textbtn']; } $foo_counter = 0; foreach($vertical_display['delete'] AS $key => $val) { 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 $row_no = 0; foreach($vertical_display['desc'] AS $key => $val) { $row_no++; if (isset($GLOBALS['printview']) && ($GLOBALS['printview'] == '1')) { $bgcolor = '#ffffff'; } else { $bgcolor = ($row_no % 2) ? $GLOBALS['cfg']['BgcolorOne'] : $GLOBALS['cfg']['BgcolorTwo']; } $on_mouse = ''; if (!isset($GLOBALS['printview']) || ($GLOBALS['printview'] != '1')) { if ($GLOBALS['cfg']['BrowsePointerColor'] != '') { $on_mouse = ' onmouseover="setVerticalPointer(this, ' . $row_no . ', \'over\', \'' . $GLOBALS['cfg']['BgcolorOne'] . '\', \'' . $GLOBALS['cfg']['BgcolorTwo'] . '\', \'' . $GLOBALS['cfg']['BrowsePointerColor'] . '\', \'' . $GLOBALS['cfg']['BrowseMarkerColor'] . '\');"' . ' onmouseout="setVerticalPointer(this, ' . $row_no . ', \'out\', \'' . $GLOBALS['cfg']['BgcolorOne'] . '\', \'' . $GLOBALS['cfg']['BgcolorTwo'] . '\', \'' . $GLOBALS['cfg']['BrowsePointerColor'] . '\', \'' . $GLOBALS['cfg']['BrowseMarkerColor'] . '\');"'; } if ($GLOBALS['cfg']['BrowseMarkerColor'] != '') { $on_mouse .= ' onmousedown="setVerticalPointer(this, ' . $row_no . ', \'click\', \'' . $GLOBALS['cfg']['BgcolorOne'] . '\', \'' . $GLOBALS['cfg']['BgcolorTwo'] . '\', \'' . $GLOBALS['cfg']['BrowsePointerColor'] . '\', \'' . $GLOBALS['cfg']['BrowseMarkerColor'] . '\');"'; } } // end if echo '' . "\n"; echo $val; $foo_counter = 0; foreach($vertical_display['rowdata'][$key] AS $subkey => $subval) { 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 "multi row delete" link at bottom if required if ($GLOBALS['cfg']['ModifyDeleteAtRight'] && is_array($vertical_display['row_delete']) && (count($vertical_display['row_delete']) > 0 || !empty($vertical_display['textbtn']))) { echo '' . "\n"; echo $vertical_display['textbtn']; $foo_counter = 0; foreach($vertical_display['row_delete'] AS $key => $val) { if (($foo_counter != 0) && ($repeat_cells != 0) && !($foo_counter % $repeat_cells)) { echo ' ' . "\n"; } echo $val; $foo_counter++; } // end while echo '' . "\n"; } // end if // Displays "edit" link at bottom if required if ($GLOBALS['cfg']['ModifyDeleteAtRight'] && is_array($vertical_display['edit']) && (count($vertical_display['edit']) > 0 || !empty($vertical_display['textbtn']))) { echo '' . "\n"; if (!is_array($vertical_display['row_delete'])) { echo $vertical_display['textbtn']; } $foo_counter = 0; foreach($vertical_display['edit'] AS $key => $val) { 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['cfg']['ModifyDeleteAtRight'] && is_array($vertical_display['delete']) && (count($vertical_display['delete']) > 0 || !empty($vertical_display['textbtn']))) { echo '' . "\n"; if (!is_array($vertical_display['edit']) && !is_array($vertical_display['row_delete'])) { echo $vertical_display['textbtn']; } $foo_counter = 0; foreach($vertical_display['delete'] AS $key => $val) { 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.php" script. * * @param integer the link id associated to the query which results have * to be displayed * @param array the display mode * @param array the analyzed query * * @global string the current language * @global integer the server to use (refers to the number in the * configuration file) * @global array the current server config * @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/horizontalflipped) * @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 * @global array the relation settings * * @access private * * @see PMA_showMessage(), PMA_setDisplayMode(), * PMA_displayTableNavigation(), PMA_displayTableHeaders(), * PMA_displayTableBody() */ function PMA_displayTable(&$dt_result, &$the_disp_mode, $analyzed_sql) { global $lang, $server, $cfg, $db, $table; global $goto; global $sql_query, $num_rows, $unlim_num_rows, $pos, $fields_meta, $fields_cnt; global $vertical_display, $disp_direction, $repeat_cells, $highlight_columns; global $dontlimitchars; global $cfgRelation; // 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['cfg']['MaxRows']; $pos_prev = $pos - $GLOBALS['cfg']['MaxRows']; if ($pos_prev < 0) { $pos_prev = 0; } } } // end if // 1.3 Urlencodes the query to use in input form fields $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 - 1 : $pos_next - 1; PMA_showMessage($GLOBALS['strShowingRecords'] . " $pos - $last_shown_rec ($total " . $GLOBALS['strTotal'] . $selectstring . ', ' . sprintf($GLOBALS['strQueryTime'], $GLOBALS['querytime']) . ')'); } else if (!isset($GLOBALS['printview']) || $GLOBALS['printview'] != '1') { 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 if (!isset($GLOBALS['printview']) || $GLOBALS['printview'] != '1') { echo "\n" . '

' . "\n"; } // 2b ----- Get field references from Database ----- // (see the 'relation' config variable) // loic1, 2002-03-02: extended to php3 // init map $map = array(); // find tables $target=array(); if (isset($analyzed_sql[0]['table_ref']) && is_array($analyzed_sql[0]['table_ref'])) { foreach($analyzed_sql[0]['table_ref'] AS $table_ref_position => $table_ref) { $target[] = $analyzed_sql[0]['table_ref'][$table_ref_position]['table_true_name']; } } $tabs = '(\'' . join('\',\'', $target) . '\')'; if ($cfgRelation['displaywork']) { if (empty($table)) { $exist_rel = FALSE; } else { $exist_rel = PMA_getForeigners($db, $table, '', 'both'); if ($exist_rel) { foreach($exist_rel AS $master_field => $rel) { $display_field = PMA_getDisplayField($rel['foreign_db'],$rel['foreign_table']); $map[$master_field] = array($rel['foreign_table'], $rel['foreign_field'], $display_field, $rel['foreign_db']); } // end while } // end if } // end if } // end if // end 2b // 3. ----- Displays the results table ----- echo '' . "\n" . '' . "\n"; PMA_displayTableHeaders($is_display, $fields_meta, $fields_cnt, $analyzed_sql); $url_query=''; PMA_displayTableBody($dt_result, $is_display, $map, $analyzed_sql); // vertical output case if ($disp_direction == 'vertical') { PMA_displayVerticalTable(); } // end if unset($vertical_display); ?>
'; echo '  ' . $GLOBALS['strWithChecked'] . ''. "\n"; if ($cfg['PropertiesIconic']) { /* Opera has trouble with */ /* IE has trouble with '; echo ' '; } else { echo ' ' . (($propicon == 'both') ? ' ' . $GLOBALS['strEdit'] : ''); echo ' ' . (($propicon == 'both') ? ' ' . $delete_text : ''); } echo "\n"; } else { echo ' ' . "\n"; echo ' ' . "\n"; } echo '' . "\n"; echo '' . "\n"; echo '' . "\n"; echo '
' . "\n"; echo '' . "\n"; } // 5. ----- Displays the navigation bar at the bottom if required ----- if ($is_display['nav_bar'] == '1') { echo '
' . "\n"; PMA_displayTableNavigation($pos_next, $pos_prev, $encoded_sql_query); } else if (!isset($GLOBALS['printview']) || $GLOBALS['printview'] != '1') { echo "\n" . '

' . "\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; } ?>