typo3/ext/phpmyadmin/modsub/phpmyadmin-2.6.2/libraries/display_tbl.lib.php

Go to the documentation of this file.
00001 <?php
00002 /* $Id: display_tbl.lib.php,v 2.74 2005/03/13 13:23:08 lem9 Exp $ */
00003 // vim: expandtab sw=4 ts=4 sts=4:
00004 
00048 function PMA_setDisplayMode(&$the_disp_mode, &$the_total)
00049 {
00050     global $db, $table;
00051     global $unlim_num_rows, $fields_meta;
00052     global $err_url;
00053 
00054     // 1. Initializes the $do_display array
00055     $do_display              = array();
00056     $do_display['edit_lnk']  = $the_disp_mode[0] . $the_disp_mode[1];
00057     $do_display['del_lnk']   = $the_disp_mode[2] . $the_disp_mode[3];
00058     $do_display['sort_lnk']  = (string) $the_disp_mode[4];
00059     $do_display['nav_bar']   = (string) $the_disp_mode[5];
00060     $do_display['ins_row']   = (string) $the_disp_mode[6];
00061     $do_display['bkm_form']  = (string) $the_disp_mode[7];
00062     $do_display['text_btn']  = (string) $the_disp_mode[8];
00063     $do_display['pview_lnk'] = (string) $the_disp_mode[9];
00064 
00065     // 2. Display mode is not "false for all elements" -> updates the
00066     // display mode
00067     if ($the_disp_mode != 'nnnn000000') {
00068         // 2.0 Print view -> set all elements to FALSE!
00069         if (isset($GLOBALS['printview']) && $GLOBALS['printview'] == '1') {
00070             $do_display['edit_lnk']  = 'nn'; // no edit link
00071             $do_display['del_lnk']   = 'nn'; // no delete link
00072             $do_display['sort_lnk']  = (string) '0';
00073             $do_display['nav_bar']   = (string) '0';
00074             $do_display['ins_row']   = (string) '0';
00075             $do_display['bkm_form']  = (string) '0';
00076             $do_display['text_btn']  = (string) '0';
00077             $do_display['pview_lnk'] = (string) '0';
00078         }
00079         // 2.1 Statement is a "SELECT COUNT", a
00080         //     "CHECK/ANALYZE/REPAIR/OPTIMIZE", an "EXPLAIN" one or
00081         //     contains a "PROC ANALYSE" part
00082         else if ($GLOBALS['is_count'] || $GLOBALS['is_analyse'] || $GLOBALS['is_maint'] || $GLOBALS['is_explain']) {
00083             $do_display['edit_lnk']  = 'nn'; // no edit link
00084             $do_display['del_lnk']   = 'nn'; // no delete link
00085             $do_display['sort_lnk']  = (string) '0';
00086             $do_display['nav_bar']   = (string) '0';
00087             $do_display['ins_row']   = (string) '0';
00088             $do_display['bkm_form']  = (string) '1';
00089             if ($GLOBALS['is_analyse']) {
00090                 $do_display['text_btn']  = (string) '1';
00091             } else {
00092                 $do_display['text_btn']  = (string) '0';
00093             }
00094             $do_display['pview_lnk'] = (string) '1';
00095         }
00096         // 2.2 Statement is a "SHOW..."
00097         else if ($GLOBALS['is_show']) {
00098             // 2.2.1 TODO : defines edit/delete links depending on show statement
00099             $tmp = preg_match('@^SHOW[[:space:]]+(VARIABLES|(FULL[[:space:]]+)?PROCESSLIST|STATUS|TABLE|GRANTS|CREATE|LOGS|DATABASES|FIELDS)@i', $GLOBALS['sql_query'], $which);
00100             if (isset($which[1]) && strpos(' ' . strtoupper($which[1]), 'PROCESSLIST') > 0) {
00101                 $do_display['edit_lnk'] = 'nn'; // no edit link
00102                 $do_display['del_lnk']  = 'kp'; // "kill process" type edit link
00103             }
00104             else {
00105                 // Default case -> no links
00106                 $do_display['edit_lnk'] = 'nn'; // no edit link
00107                 $do_display['del_lnk']  = 'nn'; // no delete link
00108             }
00109             // 2.2.2 Other settings
00110             $do_display['sort_lnk']  = (string) '0';
00111             $do_display['nav_bar']   = (string) '0';
00112             $do_display['ins_row']   = (string) '0';
00113             $do_display['bkm_form']  = (string) '1';
00114             $do_display['text_btn']  = (string) '1';
00115             $do_display['pview_lnk'] = (string) '1';
00116         }
00117         // 2.3 Other statements (ie "SELECT" ones) -> updates
00118         //     $do_display['edit_lnk'], $do_display['del_lnk'] and
00119         //     $do_display['text_btn'] (keeps other default values)
00120         else {
00121             $prev_table = $fields_meta[0]->table;
00122             $do_display['text_btn']  = (string) '1';
00123             for ($i = 0; $i < $GLOBALS['fields_cnt']; $i++) {
00124                 $is_link = ($do_display['edit_lnk'] != 'nn'
00125                             || $do_display['del_lnk'] != 'nn'
00126                             || $do_display['sort_lnk'] != '0'
00127                             || $do_display['ins_row'] != '0');
00128                 // 2.3.2 Displays edit/delete/sort/insert links?
00129                 if ($is_link
00130                     && ($fields_meta[$i]->table == '' || $fields_meta[$i]->table != $prev_table)) {
00131                     $do_display['edit_lnk'] = 'nn'; // don't display links
00132                     $do_display['del_lnk']  = 'nn';
00133                     // TODO: May be problematic with same fields names in
00134                     //       two joined table.
00135                     // $do_display['sort_lnk'] = (string) '0';
00136                     $do_display['ins_row']  = (string) '0';
00137                     if ($do_display['text_btn'] == '1') {
00138                         break;
00139                     }
00140                 } // end if (2.3.2)
00141                 // 2.3.3 Always display print view link
00142                 $do_display['pview_lnk']    = (string) '1';
00143                 $prev_table = $fields_meta[$i]->table;
00144             } // end for
00145         } // end if..elseif...else (2.1 -> 2.3)
00146     } // end if (2)
00147 
00148     // 3. Gets the total number of rows if it is unknown
00149     if (isset($unlim_num_rows) && $unlim_num_rows != '') {
00150         $the_total = $unlim_num_rows;
00151     }
00152     else if (($do_display['nav_bar'] == '1' || $do_display['sort_lnk'] == '1')
00153              && (!empty($db) && !empty($table))) {
00154         $the_total   = PMA_countRecords($db, $table, TRUE);
00155     }
00156 
00157     // 4. If navigation bar or sorting fields names urls should be
00158     //    displayed but there is only one row, change these settings to
00159     //    false
00160     if ($do_display['nav_bar'] == '1' || $do_display['sort_lnk'] == '1') {
00161 
00162         if (isset($unlim_num_rows) && $unlim_num_rows < 2) {
00163             // garvin: force display of navbar for vertical/horizontal display-choice.
00164             // $do_display['nav_bar']  = (string) '0';
00165             $do_display['sort_lnk'] = (string) '0';
00166         }
00167 
00168     } // end if (3)
00169 
00170     // 5. Updates the synthetic var
00171     $the_disp_mode = join('', $do_display);
00172 
00173     return $do_display;
00174 } // end of the 'PMA_setDisplayMode()' function
00175 
00176 
00205 function PMA_displayTableNavigation($pos_next, $pos_prev, $encoded_query)
00206 {
00207     global $lang, $convcharset, $server, $db, $table;
00208     global $goto;
00209     global $num_rows, $unlim_num_rows, $pos, $session_max_rows;
00210     global $disp_direction, $repeat_cells;
00211     global $dontlimitchars;
00212     global $is_innodb;
00213     global $showtable;
00214 
00215     // FIXME: move this to a central place
00216     // FIXME: for other future table types
00217     $is_innodb = (isset($showtable['Type']) && $showtable['Type'] == 'InnoDB');
00218 
00219     ?>
00220 
00221 <!-- Navigation bar -->
00222 <table border="0" cellpadding="2" cellspacing="0">
00223 <tr>
00224     <?php
00225     // Move to the beginning or to the previous page
00226     if ($pos > 0 && $session_max_rows != 'all') {
00227         // loic1: patch #474210 from Gosha Sakovich - part 1
00228         if ($GLOBALS['cfg']['NavigationBarIconic']) {
00229             $caption1 = '&lt;&lt;';
00230             $caption2 = '&nbsp;&lt;&nbsp;';
00231             $title1   = ' title="' . $GLOBALS['strPos1'] . '"';
00232             $title2   = ' title="' . $GLOBALS['strPrevious'] . '"';
00233         } else {
00234             $caption1 = $GLOBALS['strPos1'] . ' &lt;&lt;';
00235             $caption2 = $GLOBALS['strPrevious'] . ' &lt;';
00236             $title1   = '';
00237             $title2   = '';
00238         } // end if... else...
00239         ?>
00240 <td>
00241     <form action="sql.php" method="post">
00242         <?php echo PMA_generate_common_hidden_inputs($db, $table); ?>
00243         <input type="hidden" name="sql_query" value="<?php echo $encoded_query; ?>" />
00244         <input type="hidden" name="pos" value="0" />
00245         <input type="hidden" name="session_max_rows" value="<?php echo $session_max_rows; ?>" />
00246         <input type="hidden" name="disp_direction" value="<?php echo $disp_direction; ?>" />
00247         <input type="hidden" name="repeat_cells" value="<?php echo $repeat_cells; ?>" />
00248         <input type="hidden" name="goto" value="<?php echo $goto; ?>" />
00249         <input type="hidden" name="dontlimitchars" value="<?php echo $dontlimitchars; ?>" />
00250         <input type="submit" name="navig" value="<?php echo $caption1; ?>"<?php echo $title1; ?> />
00251     </form>
00252 </td>
00253 <td>
00254     <form action="sql.php" method="post">
00255         <?php echo PMA_generate_common_hidden_inputs($db, $table); ?>
00256         <input type="hidden" name="sql_query" value="<?php echo $encoded_query; ?>" />
00257         <input type="hidden" name="pos" value="<?php echo $pos_prev; ?>" />
00258         <input type="hidden" name="session_max_rows" value="<?php echo $session_max_rows; ?>" />
00259         <input type="hidden" name="disp_direction" value="<?php echo $disp_direction; ?>" />
00260         <input type="hidden" name="repeat_cells" value="<?php echo $repeat_cells; ?>" />
00261         <input type="hidden" name="goto" value="<?php echo $goto; ?>" />
00262         <input type="hidden" name="dontlimitchars" value="<?php echo $dontlimitchars; ?>" />
00263         <input type="submit" name="navig" value="<?php echo $caption2; ?>"<?php echo $title2; ?> />
00264     </form>
00265 </td>
00266         <?php
00267     } // end move back
00268     echo "\n";
00269     ?>
00270 <td>
00271     &nbsp;&nbsp;&nbsp;
00272 </td>
00273 <td align="center">
00274     <form action="sql.php" method="post"
00275         onsubmit="return (checkFormElementInRange(this, 'session_max_rows', 1) &amp;&amp; checkFormElementInRange(this, 'pos', 0, <?php echo $unlim_num_rows - 1; ?>))">
00276         <?php echo PMA_generate_common_hidden_inputs($db, $table); ?>
00277         <input type="hidden" name="sql_query" value="<?php echo $encoded_query; ?>" />
00278         <input type="hidden" name="goto" value="<?php echo $goto; ?>" />
00279         <input type="hidden" name="dontlimitchars" value="<?php echo $dontlimitchars; ?>" />
00280         <input type="submit" name="navig" value="<?php echo $GLOBALS['strShow']; ?> :" />
00281         <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()" />
00282         <?php echo $GLOBALS['strRowsFrom'] . "\n"; ?>
00283         <input type="text" name="pos" size="6" value="<?php echo (($pos_next >= $unlim_num_rows) ? 0 : $pos_next); ?>" class="textfield" onfocus="this.select()" />
00284         <br />
00285     <?php
00286     // Display mode (horizontal/vertical and repeat headers)
00287     $param1 = '            <select name="disp_direction">' . "\n"
00288             . '                <option value="horizontal"' . (($disp_direction == 'horizontal') ? ' selected="selected"': '') . '>' . $GLOBALS['strRowsModeHorizontal'] . '</option>' . "\n"
00289             . '                <option value="horizontalflipped"' . (($disp_direction == 'horizontalflipped') ? ' selected="selected"': '') . '>' . $GLOBALS['strRowsModeFlippedHorizontal'] . '</option>' . "\n"
00290             . '                <option value="vertical"' . (($disp_direction == 'vertical') ? ' selected="selected"': '') . '>' . $GLOBALS['strRowsModeVertical'] . '</option>' . "\n"
00291             . '            </select>' . "\n"
00292             . '           ';
00293     $param2 = '            <input type="text" size="3" name="repeat_cells" value="' . $repeat_cells . '" class="textfield" />' . "\n"
00294             . '           ';
00295     echo '    ' . sprintf($GLOBALS['strRowsModeOptions'], "\n" . $param1, "\n" . $param2) . "\n";
00296     ?>
00297     </form>
00298 </td>
00299 <td>
00300     &nbsp;&nbsp;&nbsp;
00301 </td>
00302     <?php
00303     // Move to the next page or to the last one
00304     if (($pos + $session_max_rows < $unlim_num_rows) && $num_rows >= $session_max_rows
00305         && $session_max_rows != 'all') {
00306         // loic1: patch #474210 from Gosha Sakovich - part 2
00307         if ($GLOBALS['cfg']['NavigationBarIconic']) {
00308             $caption3 = '&nbsp;&gt;&nbsp;';
00309             $caption4 = '&gt;&gt;';
00310             $title3   = ' title="' . $GLOBALS['strNext'] . '"';
00311             $title4   = ' title="' . $GLOBALS['strEnd'] . '"';
00312         } else {
00313             $caption3 = '&gt; ' . $GLOBALS['strNext'];
00314             $caption4 = '&gt;&gt; ' . $GLOBALS['strEnd'];
00315             $title3   = '';
00316             $title4   = '';
00317         } // end if... else...
00318         echo "\n";
00319         ?>
00320 <td>
00321     <form action="sql.php" method="post">
00322         <?php echo PMA_generate_common_hidden_inputs($db, $table); ?>
00323         <input type="hidden" name="sql_query" value="<?php echo $encoded_query; ?>" />
00324         <input type="hidden" name="pos" value="<?php echo $pos_next; ?>" />
00325         <input type="hidden" name="session_max_rows" value="<?php echo $session_max_rows; ?>" />
00326         <input type="hidden" name="disp_direction" value="<?php echo $disp_direction; ?>" />
00327         <input type="hidden" name="repeat_cells" value="<?php echo $repeat_cells; ?>" />
00328         <input type="hidden" name="goto" value="<?php echo $goto; ?>" />
00329         <input type="hidden" name="dontlimitchars" value="<?php echo $dontlimitchars; ?>" />
00330         <input type="submit" name="navig" value="<?php echo $caption3; ?>"<?php echo $title3; ?> />
00331     </form>
00332 </td>
00333 <td>
00334     <form action="sql.php" method="post"
00335         onsubmit="return <?php echo (($pos + $session_max_rows < $unlim_num_rows && $num_rows >= $session_max_rows) ? 'true' : 'false'); ?>">
00336         <?php echo PMA_generate_common_hidden_inputs($db, $table); ?>
00337         <input type="hidden" name="sql_query" value="<?php echo $encoded_query; ?>" />
00338         <input type="hidden" name="pos" value="<?php echo @((ceil($unlim_num_rows / $session_max_rows)- 1) * $session_max_rows); ?>" />
00339         <?php
00340         if ($is_innodb && $unlim_num_rows > $GLOBALS['cfg']['MaxExactCount']) {
00341             echo '<input type="hidden" name="find_real_end" value="1" />' . "\n";
00342             // no backquote around this message
00343             $onclick = ' onclick="return confirmAction(\'' . PMA_jsFormat($GLOBALS['strLongOperation'], FALSE) . '\')"';
00344         }
00345         ?>
00346         <input type="hidden" name="session_max_rows" value="<?php echo $session_max_rows; ?>" />
00347         <input type="hidden" name="disp_direction" value="<?php echo $disp_direction; ?>" />
00348         <input type="hidden" name="repeat_cells" value="<?php echo $repeat_cells; ?>" />
00349         <input type="hidden" name="goto" value="<?php echo $goto; ?>" />
00350         <input type="hidden" name="dontlimitchars" value="<?php echo $dontlimitchars; ?>" />
00351         <input type="submit" name="navig" value="<?php echo $caption4; ?>"<?php echo $title4; ?> <?php echo (empty($onclick) ? '' : $onclick); ?>/>
00352     </form>
00353 </td>
00354         <?php
00355     } // end move toward
00356 
00357 
00358     //page redirection
00359     $pageNow = @floor($pos / $session_max_rows) + 1;
00360     $nbTotalPage = @ceil($unlim_num_rows / $session_max_rows);
00361 
00362     if ($nbTotalPage > 1){ //if1
00363        ?>
00364    <td>
00365        &nbsp;&nbsp;&nbsp;
00366    </td>
00367    <td>
00368         <?php //<form> for keep the form alignment of button < and << ?>
00369         <form>
00370         <?php echo PMA_pageselector(
00371                      'sql.php?sql_query='        . $encoded_query .
00372                         '&amp;session_max_rows=' . $session_max_rows .
00373                         '&amp;disp_direction='   . $disp_direction .
00374                         '&amp;repeat_cells='     . $repeat_cells .
00375                         '&amp;goto='             . $goto .
00376                         '&amp;dontlimitchars='   . $dontlimitchars .
00377                         '&amp;'                  . PMA_generate_common_url($db, $table) .
00378                         '&amp;',
00379                      $session_max_rows,
00380                      $pageNow,
00381                      $nbTotalPage
00382               );
00383         ?>
00384         </form>
00385     </td>
00386         <?php
00387     } //_if1
00388 
00389 
00390     // Show all the records if allowed
00391     if ($GLOBALS['cfg']['ShowAll'] && ($num_rows < $unlim_num_rows)) {
00392         echo "\n";
00393         ?>
00394 <td>
00395     &nbsp;&nbsp;&nbsp;
00396 </td>
00397 <td>
00398     <form action="sql.php" method="post">
00399         <?php echo PMA_generate_common_hidden_inputs($db, $table); ?>
00400         <input type="hidden" name="sql_query" value="<?php echo $encoded_query; ?>" />
00401         <input type="hidden" name="pos" value="0" />
00402         <input type="hidden" name="session_max_rows" value="all" />
00403         <input type="hidden" name="disp_direction" value="<?php echo $disp_direction; ?>" />
00404         <input type="hidden" name="repeat_cells" value="<?php echo $repeat_cells; ?>" />
00405         <input type="hidden" name="goto" value="<?php echo $goto; ?>" />
00406         <input type="hidden" name="dontlimitchars" value="<?php echo $dontlimitchars; ?>" />
00407         <input type="submit" name="navig" value="<?php echo $GLOBALS['strShowAll']; ?>" />
00408     </form>
00409 </td>
00410         <?php
00411     } // end show all
00412     echo "\n";
00413     ?>
00414 </tr>
00415 </table>
00416 
00417     <?php
00418 } // end of the 'PMA_displayTableNavigation()' function
00419 
00420 
00452 function PMA_displayTableHeaders(&$is_display, &$fields_meta, $fields_cnt = 0, $analyzed_sql = '')
00453 {
00454     global $lang, $convcharset, $server, $db, $table;
00455     global $goto, $text_url;
00456     global $sql_query, $num_rows, $pos, $session_max_rows;
00457     global $vertical_display, $disp_direction, $repeat_cells, $highlight_columns;
00458     global $dontlimitchars;
00459 
00460     if ($analyzed_sql == '') {
00461         $analyzed_sql = array();
00462     }
00463 
00464     // can the result be sorted?
00465     if ($is_display['sort_lnk'] == '1') {
00466 
00467         // Just as fallback
00468         $unsorted_sql_query     = $sql_query;
00469         if (isset($analyzed_sql[0]['unsorted_query'])) {
00470             $unsorted_sql_query = $analyzed_sql[0]['unsorted_query'];
00471         }
00472 
00473         // we need $sort_expression and $sort_expression_nodir
00474         // even if there are many table references
00475 
00476         $sort_expression = trim(str_replace('  ', ' ',$analyzed_sql[0]['order_by_clause']));
00477 
00478         // Get rid of ASC|DESC (TODO: analyzer)
00479         preg_match('@(.*)([[:space:]]*(ASC|DESC))@si',$sort_expression,$matches);
00480         $sort_expression_nodir = isset($matches[1]) ? trim($matches[1]) : $sort_expression;
00481 
00482         // sorting by indexes, only if it makes sense (only one table ref)
00483         if (isset($analyzed_sql) && isset($analyzed_sql[0]) &&
00484             isset($analyzed_sql[0]['querytype']) && $analyzed_sql[0]['querytype'] == 'SELECT' &&
00485             isset($analyzed_sql[0]['table_ref']) && count($analyzed_sql[0]['table_ref']) == 1) {
00486 
00487             // grab indexes data:
00488             PMA_DBI_select_db($db);
00489             if (!defined('PMA_IDX_INCLUDED')) {
00490                 $ret_keys = PMA_get_indexes($table);
00491             }
00492 
00493             $prev_index = '';
00494             foreach ($ret_keys as $row) {
00495 
00496                 if ($row['Key_name'] != $prev_index ){
00497                     $indexes[]  = $row['Key_name'];
00498                     $prev_index = $row['Key_name'];
00499                 }
00500                 $indexes_info[$row['Key_name']]['Sequences'][]     = $row['Seq_in_index'];
00501                 $indexes_info[$row['Key_name']]['Non_unique']      = $row['Non_unique'];
00502                 if (isset($row['Cardinality'])) {
00503                     $indexes_info[$row['Key_name']]['Cardinality'] = $row['Cardinality'];
00504                 }
00505             //    I don't know what does the following column mean....
00506             //    $indexes_info[$row['Key_name']]['Packed']          = $row['Packed'];
00507                 $indexes_info[$row['Key_name']]['Comment']         = (isset($row['Comment']))
00508                                                                    ? $row['Comment']
00509                                                                    : '';
00510                 $indexes_info[$row['Key_name']]['Index_type']      = (isset($row['Index_type']))
00511                                                                    ? $row['Index_type']
00512                                                                    : '';
00513 
00514                 $indexes_data[$row['Key_name']][$row['Seq_in_index']]['Column_name']  = $row['Column_name'];
00515                 if (isset($row['Sub_part'])) {
00516                     $indexes_data[$row['Key_name']][$row['Seq_in_index']]['Sub_part'] = $row['Sub_part'];
00517                 }
00518             } // end while
00519 
00520             // do we have any index?
00521             if (isset($indexes_data)) {
00522 
00523                 if ($disp_direction == 'horizontal' || $disp_direction == 'horizontalflipped') {
00524                     $span = $fields_cnt;
00525                     if ($is_display['edit_lnk'] != 'nn') $span++;
00526                     if ($is_display['del_lnk'] != 'nn') $span++;
00527                     if ($is_display['del_lnk'] != 'kp' && $is_display['del_lnk'] != 'nn') $span++;
00528                 } else {
00529                     $span = $num_rows + floor($num_rows/$repeat_cells) + 1;
00530                 }
00531 
00532                 echo '<form action="sql.php" method="post">' . "\n";
00533                 echo PMA_generate_common_hidden_inputs($db, $table, 5);
00534                 echo '<input type="hidden" name="pos" value="' . $pos .  '" />' . "\n";
00535                 echo '<input type="hidden" name="session_max_rows" value="' . $session_max_rows . '" />' . "\n";
00536                 echo '<input type="hidden" name="disp_direction" value="' . $disp_direction . '" />' . "\n";
00537                 echo '<input type="hidden" name="repeat_cells" value="' . $repeat_cells . '" />' . "\n";
00538                 echo '<input type="hidden" name="dontlimitchars" value="' . $dontlimitchars . '" />' . "\n";
00539                 echo $GLOBALS['strSortByKey'] . ': <select name="sql_query">' . "\n";
00540                 $used_index = false;
00541                 $local_order = (isset($sort_expression) ? $sort_expression : '');
00542                 foreach ($indexes_data AS $key => $val) {
00543                     $asc_sort = '';
00544                     $desc_sort = '';
00545                     foreach ($val AS $key2 => $val2) {
00546                         $asc_sort .= PMA_backquote($val2['Column_name']) . ' ASC , ';
00547                         $desc_sort .= PMA_backquote($val2['Column_name']) . ' DESC , ';
00548                     }
00549                     $asc_sort = substr($asc_sort, 0, -3);
00550                     $desc_sort = substr($desc_sort, 0, -3);
00551                     $used_index = $used_index || $local_order == $asc_sort || $local_order == $desc_sort;
00552                     echo '<option value="' . htmlspecialchars($unsorted_sql_query . ' ORDER BY ' . $asc_sort) . '"' . ($local_order == $asc_sort ? ' selected="selected"' : '') . '>' . htmlspecialchars($key) . ' (' . $GLOBALS['strAscending'] . ')</option>';
00553                     echo "\n";
00554                     echo '<option value="' . htmlspecialchars($unsorted_sql_query . ' ORDER BY ' . $desc_sort) . '"' . ($local_order == $desc_sort ? ' selected="selected"' : '') . '>' . htmlspecialchars($key) . ' (' . $GLOBALS['strDescending'] . ')</option>';
00555                     echo "\n";
00556                 }
00557                 echo '<option value="' . htmlspecialchars($unsorted_sql_query) . '"' . ($used_index ? '' : ' selected="selected"' ) . '>' . $GLOBALS['strNone'] . '</option>';
00558                 echo "\n";
00559                 echo '</select>&nbsp;';
00560                 echo "\n";
00561                 echo '<input type="submit" value="' . $GLOBALS['strGo'] . '" />';
00562                 echo "\n";
00563                 echo '</form>';
00564                 echo "\n";
00565             }
00566         }
00567     }
00568 
00569 
00570     $vertical_display['emptypre']   = 0;
00571     $vertical_display['emptyafter'] = 0;
00572     $vertical_display['textbtn']    = '';
00573 
00574 
00575     // Start of form for multi-rows delete
00576 
00577     if ($is_display['del_lnk'] == 'dr' || $is_display['del_lnk'] == 'kp' ) {
00578         echo '<form method="post" action="tbl_row_action.php" name="rowsDeleteForm">' . "\n";
00579         echo PMA_generate_common_hidden_inputs($db, $table, 1);
00580         echo '<input type="hidden" name="disp_direction" value="' . $disp_direction . '" />' . "\n";
00581         echo '<input type="hidden" name="repeat_cells"   value="' . $repeat_cells   . '" />' . "\n";
00582         echo '<input type="hidden" name="goto"           value="sql.php" />' . "\n";
00583         echo '<input type="hidden" name="dontlimitchars" value="' . $dontlimitchars . '" />' . "\n";
00584     }
00585 
00586     echo '<!-- Results table -->' . "\n"
00587        . '<table id="table_results" ';
00588     if (isset($GLOBALS['printview']) && $GLOBALS['printview'] == '1') {
00589         echo 'border="1" cellpadding="2" cellspacing="0"';
00590     } else {
00591         echo 'border="' . $GLOBALS['cfg']['Border'] . '" cellpadding="2" cellspacing="1"';
00592     }
00593     echo '>' . "\n";
00594     if ($disp_direction == 'horizontal' || $disp_direction == 'horizontalflipped') {
00595         ?>
00596 <!-- Results table headers -->
00597 <tr>
00598         <?php
00599         echo "\n";
00600     }
00601 
00602     // 1. Displays the full/partial text button (part 1)...
00603     if ($disp_direction == 'horizontal' || $disp_direction == 'horizontalflipped') {
00604         $colspan  = ($is_display['edit_lnk'] != 'nn' && $is_display['del_lnk'] != 'nn')
00605                   ? ' colspan="3"'
00606                   : '';
00607     } else {
00608         $rowspan  = ($is_display['edit_lnk'] != 'nn' && $is_display['del_lnk'] != 'nn')
00609                   ? ' rowspan="3"'
00610                   : '';
00611     }
00612     $text_url = 'sql.php?'
00613               . PMA_generate_common_url($db, $table)
00614               . '&amp;sql_query=' . urlencode($sql_query)
00615               . '&amp;pos=' . $pos
00616               . '&amp;session_max_rows=' . $session_max_rows
00617               . '&amp;pos=' . $pos
00618               . '&amp;disp_direction=' . $disp_direction
00619               . '&amp;repeat_cells=' . $repeat_cells
00620               . '&amp;goto=' . $goto
00621               . '&amp;dontlimitchars=' . (($dontlimitchars) ? 0 : 1);
00622 
00623     //     ... before the result table
00624     if (($is_display['edit_lnk'] == 'nn' && $is_display['del_lnk'] == 'nn')
00625         && $is_display['text_btn'] == '1') {
00626         $vertical_display['emptypre'] = ($is_display['edit_lnk'] != 'nn' && $is_display['del_lnk'] != 'nn') ? 3 : 0;
00627         if ($disp_direction == 'horizontal' || $disp_direction == 'horizontalflipped') {
00628             ?>
00629 <th class="td" colspan="<?php echo $fields_cnt; ?>" align="center">
00630     <a href="<?php echo $text_url; ?>">
00631         <img src="<?php echo $GLOBALS['pmaThemeImage'] . 's_'.(($dontlimitchars) ? 'partialtext' : 'fulltext') . '.png'; ?>" border="0" width="50" height="20" alt="<?php echo (($dontlimitchars) ? $GLOBALS['strPartialText'] : $GLOBALS['strFullText']); ?>" title="<?php echo (($dontlimitchars) ? $GLOBALS['strPartialText'] : $GLOBALS['strFullText']); ?>" /></a>
00632 </th>
00633 </tr>
00634 
00635 <tr>
00636             <?php
00637         } // end horizontal/horizontalflipped mode
00638         else {
00639             echo "\n";
00640             ?>
00641 <tr>
00642 <th class="td" colspan="<?php echo $num_rows + floor($num_rows/$repeat_cells) + 1; ?>" align="center">
00643     <a href="<?php echo $text_url; ?>">
00644         <img src="<?php echo $GLOBALS['pmaThemeImage'] . 's_' . (($dontlimitchars) ? 'partialtext' : 'fulltext') . '.png'; ?>" border="0" width="50" height="20" alt="<?php echo (($dontlimitchars) ? $GLOBALS['strPartialText'] : $GLOBALS['strFullText']); ?>" title="<?php echo (($dontlimitchars) ? $GLOBALS['strPartialText'] : $GLOBALS['strFullText']); ?>" /></a>
00645 </th>
00646 </tr>
00647             <?php
00648         } // end vertical mode
00649     }
00650 
00651     //     ... at the left column of the result table header if possible
00652     //     and required
00653     else if ($GLOBALS['cfg']['ModifyDeleteAtLeft'] && $is_display['text_btn'] == '1') {
00654         $vertical_display['emptypre'] = ($is_display['edit_lnk'] != 'nn' && $is_display['del_lnk'] != 'nn') ? 3 : 0;
00655         if ($disp_direction == 'horizontal' || $disp_direction == 'horizontalflipped') {
00656             echo "\n";
00657             ?>
00658 <th class="td" <?php echo $colspan; ?> align="center">
00659     <a href="<?php echo $text_url; ?>">
00660         <img src="<?php echo $GLOBALS['pmaThemeImage'] . 's_' . (($dontlimitchars) ? 'partialtext' : 'fulltext') . '.png'; ?>" border="0" width="50" height="20" alt="<?php echo (($dontlimitchars) ? $GLOBALS['strPartialText'] : $GLOBALS['strFullText']); ?>" title="<?php echo (($dontlimitchars) ? $GLOBALS['strPartialText'] : $GLOBALS['strFullText']); ?>" /></a>
00661 </th>
00662             <?php
00663         } // end horizontal/horizontalflipped mode
00664         else {
00665             $vertical_display['textbtn'] = '    <th class="td" ' . $rowspan . ' align="center" valign="middle">' . "\n"
00666                                          . '        <a href="' . $text_url . '">' . "\n"
00667                                          . '            <img src="' . $GLOBALS['pmaThemeImage'] . 's_' . (($dontlimitchars) ? 'partialtext' : 'fulltext') . '.png" border="0" width="50" height="20" alt="' . (($dontlimitchars) ? $GLOBALS['strPartialText'] : $GLOBALS['strFullText']) . '" title="' . (($dontlimitchars) ? $GLOBALS['strPartialText'] : $GLOBALS['strFullText']) . '" /></a>' . "\n"
00668                                          . '    </th>' . "\n";
00669         } // end vertical mode
00670     }
00671 
00672     //     ... else if no button, displays empty(ies) col(s) if required
00673     else if ($GLOBALS['cfg']['ModifyDeleteAtLeft']
00674              && ($is_display['edit_lnk'] != 'nn' || $is_display['del_lnk'] != 'nn')) {
00675         $vertical_display['emptypre'] = ($is_display['edit_lnk'] != 'nn' && $is_display['del_lnk'] != 'nn') ? 3 : 0;
00676         if ($disp_direction == 'horizontal' || $disp_direction == 'horizontalflipped') {
00677             echo "\n";
00678             ?>
00679 <td<?php echo $colspan; ?>></td>
00680             <?php
00681             echo "\n";
00682         } // end horizontal/horizontalfipped mode
00683         else {
00684             $vertical_display['textbtn'] = '    <td' . $rowspan . '></td>' . "\n";
00685         } // end vertical mode
00686     }
00687 
00688     // 2. Displays the fields' name
00689     // 2.0 If sorting links should be used, checks if the query is a "JOIN"
00690     //     statement (see 2.1.3)
00691 
00692     // 2.0.1 Prepare Display column comments if enabled ($cfg['ShowBrowseComments']).
00693     //       Do not show comments, if using horizontalflipped mode, because of space usage
00694     if ($GLOBALS['cfg']['ShowBrowseComments'] && $GLOBALS['cfgRelation']['commwork'] && $disp_direction != 'horizontalflipped') {
00695         $comments_map = array();
00696         foreach ($analyzed_sql[0]['table_ref'] as $tbl) {
00697 
00698             $tb = $tbl['table_true_name'];
00699 
00700             $comments_map[$tb] = PMA_getComments($db, $tb);
00701         }
00702     }
00703 
00704     if ($GLOBALS['cfgRelation']['commwork'] && $GLOBALS['cfgRelation']['mimework'] && $GLOBALS['cfg']['BrowseMIME']) {
00705         require_once('./libraries/transformations.lib.php');
00706         $GLOBALS['mime_map'] = PMA_getMIME($db, $table);
00707     }
00708 
00709     if ($is_display['sort_lnk'] == '1') {
00710         //$is_join = preg_match('@(.*)[[:space:]]+FROM[[:space:]]+.*[[:space:]]+JOIN@im', $sql_query, $select_stt);
00711         $is_join = (isset($analyzed_sql[0]['queryflags']['join']) ?TRUE:FALSE);
00712         $select_expr = $analyzed_sql[0]['select_expr_clause'];
00713     } else {
00714         $is_join = FALSE;
00715     }
00716 
00717     // garvin: See if we have to highlight any header fields of a WHERE query.
00718     //  Uses SQL-Parser results.
00719     $highlight_columns = array();
00720     if (isset($analyzed_sql) && isset($analyzed_sql[0]) &&
00721         isset($analyzed_sql[0]['where_clause_identifiers'])) {
00722 
00723         $wi = 0;
00724         if (isset($analyzed_sql[0]['where_clause_identifiers']) && is_array($analyzed_sql[0]['where_clause_identifiers'])) {
00725             foreach ($analyzed_sql[0]['where_clause_identifiers'] AS $wci_nr => $wci) {
00726                 $highlight_columns[$wci] = 'true';
00727             }
00728         }
00729     }
00730 
00731     for ($i = 0; $i < $fields_cnt; $i++) {
00732         // garvin: See if this column should get highlight because it's used in the
00733         //  where-query.
00734         if (isset($highlight_columns[$fields_meta[$i]->name]) || isset($highlight_columns[PMA_backquote($fields_meta[$i]->name)])) {
00735             $column_style = 'style="border: 1px solid ' . $GLOBALS['cfg']['BrowseMarkerColor'] . '"';
00736         } else {
00737             $column_style = '';
00738         }
00739 
00740         // 2.0 Prepare comment-HTML-wrappers for each row, if defined/enabled.
00741         if (isset($comments_map) &&
00742                 isset($comments_map[$fields_meta[$i]->table]) &&
00743                 isset($comments_map[$fields_meta[$i]->table][$fields_meta[$i]->name])) {
00744             /*$comments_table_wrap_pre = '<table border="0" cellpadding="0" cellspacing="0" width="100%"><tr><th>';
00745             $comments_table_wrap_post = '</th></tr><tr><th style="font-size: 8pt; font-weight: normal">' . htmlspecialchars($comments_map[$fields_meta[$i]->name]) . '</td></tr></table>';*/
00746             $comments_table_wrap_pre = '';
00747             $comments_table_wrap_post = '<span class="tblcomment">' . htmlspecialchars($comments_map[$fields_meta[$i]->table][$fields_meta[$i]->name]) . '</span>';
00748         } else {
00749             $comments_table_wrap_pre = '';
00750             $comments_table_wrap_post = '';
00751         }
00752 
00753         // 2.1 Results can be sorted
00754         if ($is_display['sort_lnk'] == '1') {
00755 
00756             // 2.1.1 Checks if the table name is required; it's the case
00757             //       for a query with a "JOIN" statement and if the column
00758             //       isn't aliased, or in queries like
00759             //       SELECT `1`.`master_field` , `2`.`master_field`
00760             //       FROM `PMA_relation` AS `1` , `PMA_relation` AS `2`
00761 
00762             if (($is_join
00763                 //&& !preg_match('~([^[:space:],]|`[^`]`)[[:space:]]+(as[[:space:]]+)?' . $fields_meta[$i]->name . '~i', $select_stt[1], $parts))
00764                 && !preg_match('~([^[:space:],]|`[^`]`)[[:space:]]+(as[[:space:]]+)?' . $fields_meta[$i]->name . '~i', $select_expr, $parts))
00765                || ( isset($analyzed_sql[0]['select_expr'][$i]['expr'])
00766                    && isset($analyzed_sql[0]['select_expr'][$i]['column'])
00767                    && $analyzed_sql[0]['select_expr'][$i]['expr'] !=
00768                    $analyzed_sql[0]['select_expr'][$i]['column']
00769                   && !empty($fields_meta[$i]->table)) ) {
00770                 //$sort_tbl = PMA_backquote($fields_meta[$i]->table) . '.';
00771                 $sort_tbl = PMA_backquote($fields_meta[$i]->table) . ' . ';
00772             } else {
00773                 $sort_tbl = '';
00774             }
00775             // 2.1.2 Checks if the current column is used to sort the
00776             //       results
00777             if (empty($sort_expression)) {
00778                 $is_in_sort = FALSE;
00779             } else {
00780                 // field name may be preceded by a space, or any number
00781                 // of characters followed by a dot (tablename.fieldname)
00782                 // so do a direct comparison
00783                 // for the sort expression (avoids problems with queries
00784                 // like "SELECT id, count(id)..." and clicking to sort
00785                 // on id or on count(id) )
00786                 $is_in_sort = ($sort_tbl . PMA_backquote($fields_meta[$i]->name) == $sort_expression_nodir ? TRUE : FALSE);
00787             }
00788             // 2.1.3 Check the field name for backquotes.
00789             //       If it contains some, it's probably a function column
00790             //       like 'COUNT(`field`)'
00791             if (strpos(' ' . $fields_meta[$i]->name, '`') > 0) {
00792                 $sort_order = ' ORDER BY \'' . $fields_meta[$i]->name . '\' ';
00793             } else {
00794                 $sort_order = ' ORDER BY ' . $sort_tbl . PMA_backquote($fields_meta[$i]->name) . ' ';
00795             }
00796             // 2.1.4 Do define the sorting url
00797             if (!$is_in_sort) {
00798                 // loic1: patch #455484 ("Smart" order)
00799                 $cfg['Order']  = strtoupper($GLOBALS['cfg']['Order']);
00800                 if ($cfg['Order'] == 'SMART') {
00801                     $cfg['Order'] = (preg_match('@time|date@i', $fields_meta[$i]->type)) ? 'DESC' : 'ASC';
00802                 }
00803                 $sort_order .= $cfg['Order'];
00804                 $order_img   = '';
00805             }
00806             else if (preg_match('@[[:space:]]ASC$@i', $sort_expression)) {
00807                 $sort_order .= ' DESC';
00808                 $order_img   = '&nbsp;<img src="' . $GLOBALS['pmaThemeImage'] . 's_asc.png" border="0" width="11" height="9" alt="'. $GLOBALS['strAscending'] . '" title="'. $GLOBALS['strAscending'] . '" id="soimg' . $i . '" />';
00809             }
00810             else if (preg_match('@[[:space:]]DESC$@i', $sort_expression)) {
00811                 $sort_order .= ' ASC';
00812                 $order_img   = '&nbsp;<img src="' . $GLOBALS['pmaThemeImage'] . 's_desc.png" border="0" width="11" height="9" alt="'. $GLOBALS['strDescending'] . '" title="'. $GLOBALS['strDescending'] . '" id="soimg' . $i . '" />';
00813             }
00814             if (preg_match('@(.*)([[:space:]](LIMIT (.*)|PROCEDURE (.*)|FOR UPDATE|LOCK IN SHARE MODE))@i', $unsorted_sql_query, $regs3)) {
00815                 $sorted_sql_query = $regs3[1] . $sort_order . $regs3[2];
00816             } else {
00817                 $sorted_sql_query = $unsorted_sql_query . $sort_order;
00818             }
00819             $url_query = PMA_generate_common_url($db, $table)
00820                        . '&amp;pos=' . $pos
00821                        . '&amp;session_max_rows=' . $session_max_rows
00822                        . '&amp;disp_direction=' . $disp_direction
00823                        . '&amp;repeat_cells=' . $repeat_cells
00824                        . '&amp;dontlimitchars=' . $dontlimitchars
00825                        . '&amp;sql_query=' . urlencode($sorted_sql_query);
00826 
00827             // 2.1.5 Displays the sorting url
00828             // added 20004-06-09: Michael Keck <mail@michaelkeck.de>
00829             //                    enable sord order swapping for image
00830             $order_onmouse = '';
00831             if (isset($order_img) && $order_img!='') {
00832                 if (strstr($order_img,'asc')) {
00833                     $order_onmouse.= ' onmouseover="if(document.getElementById(\'soimg' . $i . '\')){ document.getElementById(\'soimg' . $i . '\').src=\'' . $GLOBALS['pmaThemeImage'] . 's_desc.png\'; }"'
00834                                    .' onmouseout="if(document.getElementById(\'soimg' . $i . '\')){ document.getElementById(\'soimg' . $i . '\').src=\'' . $GLOBALS['pmaThemeImage'] . 's_asc.png\'; }"';
00835                 } else if (strstr($order_img,'desc')) {
00836                     $order_onmouse.= ' onmouseover="if(document.getElementById(\'soimg' . $i . '\')){ document.getElementById(\'soimg' . $i . '\').src=\'' . $GLOBALS['pmaThemeImage'] . 's_asc.png\'; }"'
00837                                    .' onmouseout="if(document.getElementById(\'soimg' . $i . '\')){ document.getElementById(\'soimg' . $i . '\').src=\'' . $GLOBALS['pmaThemeImage'] . 's_desc.png\'; }"';
00838                 }
00839             }
00840             $order_link_pre  = '<a href="sql.php?' . $url_query . '" ' . (($disp_direction == 'horizontalflipped' && $GLOBALS['cfg']['HeaderFlipType'] == 'css') ? 'style="direction: ltr; writing-mode: tb-rl;"' : '') . ' title="' . $GLOBALS['strSort'] . '"' . $order_onmouse . '>';
00841             $order_link_post = '</a>';
00842             $order_link_content = ($disp_direction == 'horizontalflipped' && $GLOBALS['cfg']['HeaderFlipType'] == 'fake' ? PMA_flipstring(htmlspecialchars($fields_meta[$i]->name), "<br />\n") : htmlspecialchars($fields_meta[$i]->name));
00843             $order_link_words = explode(' ', $order_link_content);
00844             if (isset($order_link_words[1])) {
00845                 $order_last_word_index = count($order_link_words)-1;
00846                 $order_last_word = $order_link_words[$order_last_word_index];
00847                 unset($order_link_words[$order_last_word_index]);
00848                 $order_link = $order_link_pre . implode(' ', $order_link_words)
00849                             . ' <div class="nowrap">' . $order_last_word . $order_img . '</div>' . $order_link_post . "\n";
00850             } else {
00851                 $order_link = '<div class="nowrap">' . $order_link_pre . $order_link_content . $order_link_post . $order_img . '</div>' . "\n";
00852             }
00853 
00854             if ($disp_direction == 'horizontal' || $disp_direction == 'horizontalflipped') {
00855                 echo "\n";
00856                 ?>
00857 <th <?php echo $column_style; ?> <?php if ($disp_direction == 'horizontalflipped') echo 'valign="bottom"'; ?>>
00858     <?php echo $comments_table_wrap_pre; ?>
00859     <?php echo $order_link; ?>
00860     <?php echo $comments_table_wrap_post; ?>
00861 </th>
00862                 <?php
00863             }
00864             $vertical_display['desc'][] = '    <th ' . $column_style . '>' . "\n"
00865                                         . $comments_table_wrap_pre
00866                                         . $order_link
00867                                         . $comments_table_wrap_post
00868                                         . '    </th>' . "\n";
00869         } // end if (2.1)
00870 
00871         // 2.2 Results can't be sorted
00872         else {
00873             if ($disp_direction == 'horizontal' || $disp_direction == 'horizontalflipped') {
00874                 echo "\n";
00875                 ?>
00876 <th <?php echo $column_style; ?> <?php if ($disp_direction == 'horizontalflipped') echo 'valign="bottom"'; ?>  <?php echo ($disp_direction == 'horizontalflipped' && $GLOBALS['cfg']['HeaderFlipType'] == 'css' ? 'style="direction: ltr; writing-mode: tb-rl;"' : ''); ?>>
00877     <?php echo $comments_table_wrap_pre; ?>
00878     <?php echo ($disp_direction == 'horizontalflipped' && $GLOBALS['cfg']['HeaderFlipType'] == 'fake'? PMA_flipstring(htmlspecialchars($fields_meta[$i]->name), "<br />\n") : htmlspecialchars($fields_meta[$i]->name)) . "\n"; ?>
00879     <?php echo $comments_table_wrap_post; ?>
00880 </th>
00881                 <?php
00882             }
00883             $vertical_display['desc'][] = '    <th ' . $column_style . '>' . "\n"
00884                                         . $comments_table_wrap_pre
00885                                         . '        ' . htmlspecialchars($fields_meta[$i]->name) . "\n"
00886                                         . $comments_table_wrap_post
00887                                         . '    </th>';
00888         } // end else (2.2)
00889     } // end for
00890 
00891     // 3. Displays the full/partial text button (part 2) at the right
00892     //    column of the result table header if possible and required...
00893     if ($GLOBALS['cfg']['ModifyDeleteAtRight']
00894         && ($is_display['edit_lnk'] != 'nn' || $is_display['del_lnk'] != 'nn')
00895         && $is_display['text_btn'] == '1') {
00896         $vertical_display['emptyafter'] = ($is_display['edit_lnk'] != 'nn' && $is_display['del_lnk'] != 'nn') ? 3 : 1;
00897         if ($disp_direction == 'horizontal' || $disp_direction == 'horizontalflipped') {
00898             echo "\n";
00899             ?>
00900 <th class="td" <?php echo $colspan; ?> align="center">
00901     <a href="<?php echo $text_url; ?>">
00902         <img src="<?php echo $GLOBALS['pmaThemeImage'] . 's_' . (($dontlimitchars) ? 'partialtext' : 'fulltext') . '.png'; ?>" border="0" width="50" height="20" alt="<?php echo (($dontlimitchars) ? $GLOBALS['strPartialText'] : $GLOBALS['strFullText']); ?>" title="<?php echo (($dontlimitchars) ? $GLOBALS['strPartialText'] : $GLOBALS['strFullText']); ?>" /></a>
00903 </th>
00904             <?php
00905         } // end horizontal/horizontalflipped mode
00906         else {
00907             $vertical_display['textbtn'] = '    <th class="td" ' . $rowspan . ' align="center" valign="middle">' . "\n"
00908                                          . '        <a href="' . $text_url . '">' . "\n"
00909                                          . '            <img src="' . $GLOBALS['pmaThemeImage'] . 's_' . (($dontlimitchars) ? 'partialtext' : 'fulltext') . '.png" border="0" width="50" height="20" alt="' . (($dontlimitchars) ? $GLOBALS['strPartialText'] : $GLOBALS['strFullText']) . '" title="' . (($dontlimitchars) ? $GLOBALS['strPartialText'] : $GLOBALS['strFullText']) . '" /></a>' . "\n"
00910                                          . '    </th>' . "\n";
00911         } // end vertical mode
00912     }
00913 
00914     //     ... else if no button, displays empty cols if required
00915     // (unless coming from Browse mode print view)
00916     else if ($GLOBALS['cfg']['ModifyDeleteAtRight']
00917              && ($is_display['edit_lnk'] == 'nn' && $is_display['del_lnk'] == 'nn')
00918              && (!$GLOBALS['is_header_sent'])) {
00919         $vertical_display['emptyafter'] = ($is_display['edit_lnk'] != 'nn' && $is_display['del_lnk'] != 'nn') ? 3 : 1;
00920         if ($disp_direction == 'horizontal' || $disp_direction == 'horizontalflipped') {
00921             echo "\n";
00922             ?>
00923 <td<?php echo $colspan; ?>></td>
00924             <?php
00925         } // end horizontal/horizontalflipped mode
00926         else {
00927             $vertical_display['textbtn'] = '    <td' . $rowspan . '></td>' . "\n";
00928         } // end vertical mode
00929     }
00930 
00931     if ($disp_direction == 'horizontal' || $disp_direction == 'horizontalflipped') {
00932         echo "\n";
00933         ?>
00934 </tr>
00935         <?php
00936     }
00937     echo "\n";
00938 
00939     return TRUE;
00940 } // end of the 'PMA_displayTableHeaders()' function
00941 
00942 
00943 
00977 function PMA_displayTableBody(&$dt_result, &$is_display, $map, $analyzed_sql)
00978 {
00979     global $lang, $convcharset, $server, $db, $table;
00980     global $goto;
00981     global $sql_query, $pos, $session_max_rows, $fields_meta, $fields_cnt;
00982     global $vertical_display, $disp_direction, $repeat_cells, $highlight_columns;
00983     global $dontlimitchars;
00984     global $row; // mostly because of browser transformations, to make the row-data accessible in a plugin
00985 
00986     $url_sql_query          = $sql_query;
00987 
00988     // query without conditions to shorten urls when needed, 200 is just
00989     // guess, it should depend on remaining url length
00990 
00991     if (isset($analyzed_sql) && isset($analyzed_sql[0]) &&
00992         isset($analyzed_sql[0]['querytype']) && $analyzed_sql[0]['querytype'] == 'SELECT' &&
00993         strlen($sql_query) > 200) {
00994 
00995         $url_sql_query = 'SELECT ';
00996         if (isset($analyzed_sql[0]['queryflags']['distinct'])) {
00997             $url_sql_query .= ' DISTINCT ';
00998         }
00999         $url_sql_query .= $analyzed_sql[0]['select_expr_clause'];
01000         if (!empty($analyzed_sql[0]['from_clause'])) {
01001             $url_sql_query .= ' FROM ' . $analyzed_sql[0]['from_clause'];
01002         }
01003     }
01004 
01005     if (!is_array($map)) {
01006         $map = array();
01007     }
01008     ?>
01009 <!-- Results table body -->
01010     <?php
01011     echo "\n";
01012 
01013     $row_no                         = 0;
01014     $vertical_display['edit']       = array();
01015     $vertical_display['delete']     = array();
01016     $vertical_display['data']       = array();
01017     $vertical_display['row_delete'] = array();
01018 
01019     // Correction uva 19991216 in the while below
01020     // Previous code assumed that all tables have keys, specifically that
01021     // the phpMyAdmin GUI should support row delete/edit only for such
01022     // tables.
01023     // Although always using keys is arguably the prescribed way of
01024     // defining a relational table, it is not required. This will in
01025     // particular be violated by the novice.
01026     // We want to encourage phpMyAdmin usage by such novices. So the code
01027     // below has been changed to conditionally work as before when the
01028     // table being displayed has one or more keys; but to display
01029     // delete/edit options correctly for tables without keys.
01030 
01031     // loic1: use 'PMA_mysql_fetch_array' rather than 'PMA_mysql_fetch_row'
01032     //        to get the NULL values
01033 
01034     // rabus: This function needs a little rework.
01035     //        Using MYSQL_BOTH just pollutes the memory!
01036 
01037     // ne0x:  Use function PMA_DBI_fetch_array() due to mysqli
01038     //        compatibility. Now this function is wrapped.
01039 
01040     while ($row = PMA_DBI_fetch_row($dt_result)) {
01041         // lem9: "vertical display" mode stuff
01042         if (($row_no != 0) && ($repeat_cells != 0) && !($row_no % $repeat_cells) && ($disp_direction == 'horizontal' || $disp_direction == 'horizontalflipped')) {
01043             echo '<tr>' . "\n";
01044 
01045             for ($foo_i = 0; $foo_i < $vertical_display['emptypre']; $foo_i++) {
01046                 echo '    <th class="td">&nbsp;</th>' . "\n";
01047             }
01048 
01049             foreach ($vertical_display['desc'] AS $key => $val) {
01050                 echo $val;
01051             }
01052 
01053             for ($foo_i = 0; $foo_i < $vertical_display['emptyafter']; $foo_i++) {
01054                 echo '    <th class="td">&nbsp;</th>' . "\n";
01055             }
01056 
01057             echo '</tr>' . "\n";
01058         } // end if
01059 
01060         if (isset($GLOBALS['printview']) && ($GLOBALS['printview'] == '1')) {
01061             $bgcolor = '#ffffff';
01062         } else {
01063             $bgcolor = ($row_no % 2) ? $GLOBALS['cfg']['BgcolorOne'] : $GLOBALS['cfg']['BgcolorTwo'];
01064         }
01065 
01066         if ($disp_direction == 'horizontal' || $disp_direction == 'horizontalflipped') {
01067             // loic1: pointer code part
01068             $on_mouse     = '';
01069             if (!isset($GLOBALS['printview']) || ($GLOBALS['printview'] != '1')) {
01070                 if ($GLOBALS['cfg']['BrowsePointerEnable'] == TRUE) {
01071                     $on_mouse = ' onmouseover="setPointer(this, ' . $row_no . ', \'over\', \'' . $bgcolor . '\', \'' . $GLOBALS['cfg']['BrowsePointerColor'] . '\', \'' . $GLOBALS['cfg']['BrowseMarkerColor'] . '\');"'
01072                               . ' onmouseout="setPointer(this, ' . $row_no . ', \'out\', \'' . $bgcolor . '\', \'' . $GLOBALS['cfg']['BrowsePointerColor'] . '\', \'' . $GLOBALS['cfg']['BrowseMarkerColor'] . '\');"';
01073                 } else {
01074                     $on_mouse = '';
01075                 }
01076                 if ($GLOBALS['cfg']['BrowseMarkerEnable'] == TRUE) {
01077                     $on_mouse .= ' onmousedown="setPointer(this, ' . $row_no . ', \'click\', \'' . $bgcolor . '\', \'' . $GLOBALS['cfg']['BrowsePointerColor'] . '\', \'' . $GLOBALS['cfg']['BrowseMarkerColor'] . '\');"';
01078                 }
01079             } // end if
01080             ?>
01081 <tr<?php echo $on_mouse; ?>>
01082             <?php
01083             echo "\n";
01084         }
01085 
01086         // 1. Prepares the row (gets primary keys to use)
01087         if ($is_display['edit_lnk'] != 'nn' || $is_display['del_lnk'] != 'nn') {
01088             // 1.1 Results from a "SELECT" statement -> builds the
01089             //     "primary" key to use in links
01090             if ($is_display['edit_lnk'] == 'ur' /* || $is_display['edit_lnk'] == 'dr' */) {
01091                 $uva_condition     = urlencode(PMA_getUvaCondition($dt_result, $fields_cnt, $fields_meta, $row));
01092             } // end if (1.1)
01093 
01094             // 1.2 Defines the urls for the modify/delete link(s)
01095             $url_query  = PMA_generate_common_url($db, $table)
01096                         . '&amp;pos=' . $pos
01097                         . '&amp;session_max_rows=' . $session_max_rows
01098                         . '&amp;disp_direction=' . $disp_direction
01099                         . '&amp;repeat_cells=' . $repeat_cells
01100                         . '&amp;dontlimitchars=' . $dontlimitchars;
01101 
01102             // We need to copy the value or else the == 'both' check will always return true
01103             $propicon = (string)$GLOBALS['cfg']['PropertiesIconic'];
01104 
01105             if ($propicon == 'both') {
01106                 $iconic_spacer = '<div class="nowrap">';
01107             } else {
01108                 $iconic_spacer = '';
01109             }
01110 
01111             // 1.2.1 Modify link(s)
01112             if ($is_display['edit_lnk'] == 'ur') { // update row case
01113 //                    $lnk_goto = 'sql.php'
01114 //                             . '?' . str_replace('&amp;', '&', $url_query)
01115 //                              . '&sql_query=' . urlencode($sql_query)
01116 //                              . '&goto=' . (empty($goto) ? 'tbl_properties.php' : $goto);
01117 // to reduce the length of the URL, because of some browsers limitations:
01118                 $lnk_goto = 'sql.php';
01119 
01120                 $edit_url = 'tbl_change.php'
01121                           . '?' . $url_query
01122                           . '&amp;primary_key=' . $uva_condition
01123                           . '&amp;sql_query=' . urlencode($url_sql_query)
01124                           . '&amp;goto=' . urlencode($lnk_goto);
01125                 if ($GLOBALS['cfg']['PropertiesIconic'] == FALSE) {
01126                     $edit_str = $GLOBALS['strEdit'];
01127                 } else {
01128                     $edit_str = $iconic_spacer . '<img width="16" height="16" src="' . $GLOBALS['pmaThemeImage'] . 'b_edit.png" alt="' . $GLOBALS['strEdit'] . '" title="' . $GLOBALS['strEdit'] . '" border="0" />';
01129                     if ($propicon == 'both') {
01130                         $edit_str .= '&nbsp;' . $GLOBALS['strEdit'] . '</div>';
01131                     }
01132                 }
01133             } // end if (1.2.1)
01134 
01135             if ($table == $GLOBALS['cfg']['Bookmark']['table'] && $db == $GLOBALS['cfg']['Bookmark']['db'] && isset($row[1]) && isset($row[0])) {
01136                 $bookmark_go = '<a href="read_dump.php?'
01137                                 . PMA_generate_common_url($row[1], '')
01138                                 . '&amp;id_bookmark=' . $row[0]
01139                                 . '&amp;action_bookmark=0'
01140                                 . '&amp;action_bookmark_all=1'
01141                                 . '&amp;SQL=' . $GLOBALS['strExecuteBookmarked']
01142                                 .' " title="' . $GLOBALS['strExecuteBookmarked'] . '">';
01143 
01144                 if ($GLOBALS['cfg']['PropertiesIconic'] == FALSE) {
01145                     $bookmark_go .= $GLOBALS['strExecuteBookmarked'];
01146                 } else {
01147                     $bookmark_go .= $iconic_spacer . '<img width="16" height="16" src="' . $GLOBALS['pmaThemeImage'] . 'b_bookmark.png" alt="' . $GLOBALS['strExecuteBookmarked'] . '" title="' . $GLOBALS['strExecuteBookmarked'] . '" border="0" />';
01148                     if ($propicon == 'both') {
01149                         $bookmark_go .= '&nbsp;' . $GLOBALS['strExecuteBookmarked'] . '</div>';
01150                     }
01151                 }
01152 
01153                 $bookmark_go .= '</a>';
01154             } else {
01155                 $bookmark_go = '';
01156             }
01157 
01158             // 1.2.2 Delete/Kill link(s)
01159             if ($is_display['del_lnk'] == 'dr') { // delete row case
01160                 $lnk_goto = 'sql.php'
01161                           . '?' . str_replace('&amp;', '&', $url_query)
01162                           . '&sql_query=' . urlencode($url_sql_query)
01163                           . '&zero_rows=' . urlencode(htmlspecialchars($GLOBALS['strDeleted']))
01164                           . '&goto=' . (empty($goto) ? 'tbl_properties.php' : $goto);
01165                 $del_query = urlencode('DELETE FROM ' . PMA_backquote($table) . ' WHERE') . $uva_condition . '+LIMIT+1';
01166                 $del_url  = 'sql.php'
01167                           . '?' . $url_query
01168                           . '&amp;sql_query=' . $del_query
01169                           . '&amp;zero_rows=' . urlencode(htmlspecialchars($GLOBALS['strDeleted']))
01170                           . '&amp;goto=' . urlencode($lnk_goto);
01171                 $js_conf  = 'DELETE FROM ' . PMA_jsFormat($table)
01172                           . ' WHERE ' . trim(PMA_jsFormat(urldecode($uva_condition), FALSE))
01173                           . ' LIMIT 1';
01174                 if ($GLOBALS['cfg']['PropertiesIconic'] == FALSE) {
01175                     $del_str = $GLOBALS['strDelete'];
01176                 } else {
01177                     $del_str = $iconic_spacer . '<img width="16" height="16" src="' . $GLOBALS['pmaThemeImage'] . 'b_drop.png" alt="' . $GLOBALS['strDelete'] . '" title="' . $GLOBALS['strDelete'] . '" border="0" />';
01178                     if ($propicon == 'both') {
01179                         $del_str .= '&nbsp;' . $GLOBALS['strDelete'] . '</div>';
01180                     }
01181                 }
01182             } else if ($is_display['del_lnk'] == 'kp') { // kill process case
01183                 $lnk_goto = 'sql.php'
01184                           . '?' . str_replace('&amp;', '&', $url_query)
01185                           . '&sql_query=' . urlencode($url_sql_query)
01186                           . '&goto=main.php';
01187                 $del_url  = 'sql.php?'
01188                           . PMA_generate_common_url('mysql')
01189                           . '&amp;sql_query=' . urlencode('KILL ' . $row[0])
01190                           . '&amp;goto=' . urlencode($lnk_goto);
01191                 $del_query = urlencode('KILL ' . $row[0]);
01192                 $js_conf  = 'KILL ' . $row[0];
01193                 if ($GLOBALS['cfg']['PropertiesIconic'] == FALSE) {
01194                     $del_str = $GLOBALS['strKill'];
01195                 } else {
01196                     $del_str = $iconic_spacer . '<img width="16" height="16" src="' . $GLOBALS['pmaThemeImage'] . 'b_drop.png" alt="' . $GLOBALS['strKill'] . '" title="' . $GLOBALS['strKill'] . '" border="0" />';
01197                     if ($propicon == 'both') {
01198                         $del_str .= '&nbsp;' . $GLOBALS['strKill'] . '</div>';
01199                     }
01200                 }
01201             } // end if (1.2.2)
01202 
01203             // 1.3 Displays the links at left if required
01204             if ($GLOBALS['cfg']['ModifyDeleteAtLeft']
01205                 && ($disp_direction == 'horizontal' || $disp_direction == 'horizontalflipped')) {
01206                 $doWriteModifyAt = 'left';
01207                 require('./libraries/display_tbl_links.lib.php');
01208             } // end if (1.3)
01209             echo (($disp_direction == 'horizontal' || $disp_direction == 'horizontalflipped') ? "\n" : '');
01210         } // end if (1)
01211 
01212         // 2. Displays the rows' values
01213         for ($i = 0; $i < $fields_cnt; ++$i) {
01214             $meta    = $fields_meta[$i];
01215             // loic1: To fix bug #474943 under php4, the row pointer will
01216             //        depend on whether the "is_null" php4 function is
01217             //        available or not
01218             $pointer = (function_exists('is_null') ? $i : $meta->name);
01219             // garvin: See if this column should get highlight because it's used in the
01220             //  where-query.
01221             if (isset($highlight_columns) && (isset($highlight_columns[$meta->name]) || isset($highlight_columns[PMA_backquote($meta->name)]))) {
01222                 $column_style = 'style="border: 1px solid ' . $GLOBALS['cfg']['BrowseMarkerColor'] . '"';
01223             } else {
01224                 $column_style = '';
01225             }
01226 
01227             if ($disp_direction == 'vertical' && (!isset($GLOBALS['printview']) || ($GLOBALS['printview'] != '1'))) {
01228                 if ($GLOBALS['cfg']['BrowsePointerColor'] == TRUE) {
01229                     $column_style .= ' onmouseover="setVerticalPointer(this, ' . $row_no . ', \'over\', \'' . $GLOBALS['cfg']['BgcolorOne'] . '\', \'' . $GLOBALS['cfg']['BgcolorTwo'] . '\', \'' . $GLOBALS['cfg']['BrowsePointerColor'] . '\', \'' . $GLOBALS['cfg']['BrowseMarkerColor'] . '\');"'
01230                               . ' onmouseout="setVerticalPointer(this, ' . $row_no . ', \'out\', \'' . $GLOBALS['cfg']['BgcolorOne'] . '\', \'' . $GLOBALS['cfg']['BgcolorTwo'] . '\', \'' . $GLOBALS['cfg']['BrowsePointerColor'] . '\', \'' . $GLOBALS['cfg']['BrowseMarkerColor'] . '\');"';
01231                 }
01232                 if ($GLOBALS['cfg']['BrowseMarkerEnable'] == TRUE) {
01233                     $column_style .= ' onmousedown="setVerticalPointer(this, ' . $row_no . ', \'click\', \'' . $GLOBALS['cfg']['BgcolorOne'] . '\', \'' . $GLOBALS['cfg']['BgcolorTwo'] . '\', \'' . $GLOBALS['cfg']['BrowsePointerColor'] . '\', \'' . $GLOBALS['cfg']['BrowseMarkerColor'] . '\'); setCheckboxColumn(\'id_rows_to_delete' . $row_no . '\');"';
01234                 } else {
01235                     $column_style .= ' onmousedown="setCheckboxColumn(\'id_rows_to_delete' . $row_no . '\');" ';
01236                 }
01237             } else {
01238                 $column_style .= ' onmousedown="setCheckboxColumn(\'id_rows_to_delete' . $row_no . '\');" ';
01239             }// end if
01240 
01241             // garvin: Wrap MIME-transformations. [MIME]
01242             $default_function = 'default_function'; // default_function
01243             $transform_function = $default_function;
01244             $transform_options = array();
01245 
01246             if ($GLOBALS['cfgRelation']['mimework'] && $GLOBALS['cfg']['BrowseMIME']) {
01247 
01248                 if (isset($GLOBALS['mime_map'][$meta->name]['mimetype']) && isset($GLOBALS['mime_map'][$meta->name]['transformation']) && !empty($GLOBALS['mime_map'][$meta->name]['transformation'])) {
01249                     $include_file = PMA_sanitizeTransformationFile($GLOBALS['mime_map'][$meta->name]['transformation']);
01250 
01251                     if (file_exists('./libraries/transformations/' . $include_file)) {
01252                         $transformfunction_name = preg_replace('@(\.inc\.php3?)$@i', '', $GLOBALS['mime_map'][$meta->name]['transformation']);
01253 
01254                         require_once('./libraries/transformations/' . $include_file);
01255 
01256                         if (function_exists('PMA_transformation_' . $transformfunction_name)) {
01257                             $transform_function = 'PMA_transformation_' . $transformfunction_name;
01258                             $transform_options  = PMA_transformation_getOptions((isset($GLOBALS['mime_map'][$meta->name]['transformation_options']) ? $GLOBALS['mime_map'][$meta->name]['transformation_options'] : ''));
01259                             $meta->mimetype     = str_replace('_', '/', $GLOBALS['mime_map'][$meta->name]['mimetype']);
01260                         }
01261                     } // end if file_exists
01262                 } // end if transformation is set
01263             } // end if mime/transformation works.
01264 
01265             $transform_options['wrapper_link'] = '?'
01266                                                 . (isset($url_query) ? $url_query : '')
01267                                                 . '&amp;primary_key=' . (isset($uva_condition) ? $uva_condition : '')
01268                                                 . '&amp;sql_query=' . (isset($sql_query) ? urlencode($url_sql_query) : '')
01269                                                 . '&amp;goto=' . (isset($sql_goto) ? urlencode($lnk_goto) : '')
01270                                                 . '&amp;transform_key=' . urlencode($meta->name);
01271 
01272 
01273             // n u m e r i c
01274             if ($meta->numeric == 1) {
01275 
01276 
01277             // lem9: if two fields have the same name (this is possible
01278             //       with self-join queries, for example), using $meta->name
01279             //       will show both fields NULL even if only one is NULL,
01280             //       so use the $pointer
01281             //      (works only if function_exists('is_null')
01282             // PS:   why not always work with the number ($i), since
01283             //       the default second parameter of
01284             //       mysql_fetch_array() is MYSQL_BOTH, so we always get
01285             //       associative and numeric indices?
01286 
01287                 //if (!isset($row[$meta->name])
01288                 if (!isset($row[$i]) || is_null($row[$i])) {
01289                     $vertical_display['data'][$row_no][$i]     = '    <td align="right" valign="top" ' . $column_style . ' bgcolor="' . $bgcolor . '"><i>NULL</i></td>' . "\n";
01290                 } else if ($row[$i] != '') {
01291                     $vertical_display['data'][$row_no][$i]     = '    <td align="right" valign="top" ' . $column_style . ' bgcolor="' . $bgcolor . '" class="nowrap">';
01292 
01293                     if (isset($analyzed_sql[0]['select_expr']) && is_array($analyzed_sql[0]['select_expr'])) {
01294                         foreach ($analyzed_sql[0]['select_expr'] AS $select_expr_position => $select_expr) {
01295                             $alias = $analyzed_sql[0]['select_expr'][$select_expr_position]['alias'];
01296                             if (!empty($alias)) {
01297                                 $true_column = $analyzed_sql[0]['select_expr'][$select_expr_position]['column'];
01298                                 if ($alias == $meta->name) {
01299                                     $meta->name = $true_column;
01300                                 } // end if
01301                             } // end if
01302                         } // end while
01303                     }
01304 
01305                     if (isset($map[$meta->name])) {
01306                         // Field to display from the foreign table?
01307                         if (!empty($map[$meta->name][2])) {
01308                             $dispsql     = 'SELECT ' . PMA_backquote($map[$meta->name][2])
01309                                          . ' FROM ' . PMA_backquote($map[$meta->name][3]) . '.' . PMA_backquote($map[$meta->name][0])
01310                                          . ' WHERE ' . PMA_backquote($map[$meta->name][1])
01311                                          . ' = ' . $row[$i];
01312                             $dispresult  = PMA_DBI_try_query($dispsql, NULL, PMA_DBI_QUERY_STORE);
01313                             if ($dispresult && PMA_DBI_num_rows($dispresult) > 0) {
01314                                 list($dispval) = PMA_DBI_fetch_row($dispresult, 0);
01315                             }
01316                             else {
01317                                 $dispval = $GLOBALS['strLinkNotFound'];
01318                             }
01319                             @PMA_DBI_free_result($dispresult);
01320                         }
01321                         else {
01322                             $dispval     = '';
01323                         } // end if... else...
01324 
01325                         if (isset($GLOBALS['printview']) && $GLOBALS['printview'] == '1') {
01326                             $vertical_display['data'][$row_no][$i] .= ($transform_function != $default_function ? $transform_function($row[$i], $transform_options, $meta) : $transform_function($row[$i], array(), $meta)) . ' <code>[-&gt;' . $dispval . ']</code>';
01327                         } else {
01328                             $title = (!empty($dispval))? ' title="' . htmlspecialchars($dispval) . '"' : '';
01329 
01330                             $vertical_display['data'][$row_no][$i] .= '<a href="sql.php?'
01331                                                                    .  PMA_generate_common_url($map[$meta->name][3], $map[$meta->name][0])
01332                                                                    .  '&amp;pos=0&amp;session_max_rows=' . $session_max_rows . '&amp;dontlimitchars=' . $dontlimitchars
01333                                                                    .  '&amp;sql_query=' . urlencode('SELECT * FROM ' . PMA_backquote($map[$meta->name][0]) . ' WHERE ' . PMA_backquote($map[$meta->name][1]) . ' = ' . $row[$i]) . '"' . $title . '>'
01334                                                                    .  ($transform_function != $default_function ? $transform_function($row[$i], $transform_options, $meta) : $transform_function($row[$i], array(), $meta)) . '</a>';
01335                         }
01336                     } else {
01337                         $vertical_display['data'][$row_no][$i] .= ($transform_function != $default_function ? $transform_function($row[$i], $transform_options, $meta) : $transform_function($row[$i], array(), $meta));
01338                     }
01339                     $vertical_display['data'][$row_no][$i]     .= '</td>' . "\n";
01340                 } else {
01341                     $vertical_display['data'][$row_no][$i]     = '    <td align="right" ' . $column_style . ' valign="top" bgcolor="' . $bgcolor . '" class="nowrap">&nbsp;</td>' . "\n";
01342                 }
01343 
01344             //  b l o b
01345 
01346             } else if ($GLOBALS['cfg']['ShowBlob'] == FALSE && stristr($meta->type, 'BLOB')) {
01347                 // loic1 : PMA_mysql_fetch_fields returns BLOB in place of
01348                 // TEXT fields type, however TEXT fields must be displayed
01349                 // even if $cfg['ShowBlob'] is false -> get the true type
01350                 // of the fields.
01351                 $field_flags = PMA_DBI_field_flags($dt_result, $i);
01352                 if (stristr($field_flags, 'BINARY')) {
01353                     $blobtext = '[BLOB';
01354                     if (!isset($row[$i]) || is_null($row[$i])) {
01355                         $blobtext .= ' - NULL';
01356                     } elseif (isset($row[$i])) {
01357                         $blob_size = PMA_formatByteDown(strlen($row[$i]), 3, 1);
01358                         $blobtext .= ' - '. $blob_size [0] . ' ' . $blob_size[1];
01359                         unset($blob_size);
01360                     }
01361 
01362                     $blobtext .= ']';
01363                     $blobtext = ($default_function != $transform_function ? $transform_function($blobtext, $transform_options, $meta) : $default_function($blobtext, array(), $meta));
01364 
01365                     $vertical_display['data'][$row_no][$i]      = '    <td align="center" ' . $column_style . ' valign="top" bgcolor="' . $bgcolor . '">' . $blobtext . '</td>';
01366                 } else {
01367                     if (!isset($row[$i]) || is_null($row[$i])) {
01368                         $vertical_display['data'][$row_no][$i] = '    <td valign="top" ' . $column_style . ' bgcolor="' . $bgcolor . '"><i>NULL</i></td>' . "\n";
01369                     } else if ($row[$i] != '') {
01370                         // garvin: if a transform function for blob is set, none of these replacements will be made
01371                         if (PMA_strlen($row[$i]) > $GLOBALS['cfg']['LimitChars'] && ($dontlimitchars != 1)) {
01372                             $row[$i] = PMA_substr($row[$i], 0, $GLOBALS['cfg']['LimitChars']) . '...';
01373                         }
01374                         // loic1: displays all space characters, 4 space
01375                         // characters for tabulations and <cr>/<lf>
01376                         $row[$i]     = ($default_function != $transform_function ? $transform_function($row[$i], $transform_options, $meta) : $default_function($row[$i], array(), $meta));
01377 
01378                         $vertical_display['data'][$row_no][$i] = '    <td valign="top" ' . $column_style . ' bgcolor="' . $bgcolor . '">' . $row[$i] . '</td>' . "\n";
01379                     } else {
01380                         $vertical_display['data'][$row_no][$i] = '    <td valign="top" ' . $column_style . ' bgcolor="' . $bgcolor . '">&nbsp;</td>' . "\n";
01381                     }
01382                 }
01383             } else {
01384                 if (!isset($row[$i]) || is_null($row[$i])) {
01385                     $vertical_display['data'][$row_no][$i]     = '    <td valign="top" ' . $column_style . ' bgcolor="' . $bgcolor . '"><i>NULL</i></td>' . "\n";
01386                 } else if ($row[$i] != '') {
01387                     // loic1: support blanks in the key
01388                     $relation_id = $row[$i];
01389 
01390                     // nijel: Cut all fields to $cfg['LimitChars']
01391                     if (PMA_strlen($row[$i]) > $GLOBALS['cfg']['LimitChars'] && ($dontlimitchars != 1)) {
01392                         $row[$i] = PMA_substr($row[$i], 0, $GLOBALS['cfg']['LimitChars']) . '...';
01393                     }
01394 
01395                     // loic1: displays special characters from binaries
01396                     $field_flags = PMA_DBI_field_flags($dt_result, $i);
01397                     if (stristr($field_flags, 'BINARY')) {
01398                         $row[$i]     = str_replace("\x00", '\0', $row[$i]);
01399                         $row[$i]     = str_replace("\x08", '\b', $row[$i]);
01400                         $row[$i]     = str_replace("\x0a", '\n', $row[$i]);
01401                         $row[$i]     = str_replace("\x0d", '\r', $row[$i]);
01402                         $row[$i]     = str_replace("\x1a", '\Z', $row[$i]);
01403                         $row[$i]     = ($default_function != $transform_function ? $transform_function($row[$i], $transform_options, $meta) : $default_function($row[$i], array(), $meta));
01404                     }
01405                     // loic1: displays all space characters, 4 space
01406                     // characters for tabulations and <cr>/<lf>
01407                     else {
01408                         $row[$i]     = ($default_function != $transform_function ? $transform_function($row[$i], $transform_options, $meta) : $default_function($row[$i], array(), $meta));
01409                     }
01410 
01411                     // garvin: transform functions may enable nowrapping:
01412                     $function_nowrap = $transform_function . '_nowrap';
01413                     $bool_nowrap = (($default_function != $transform_function && function_exists($function_nowrap)) ? $function_nowrap($transform_options) : false);
01414 
01415                     // loic1: do not wrap if date field type
01416                     $nowrap = ((preg_match('@DATE|TIME@i', $meta->type) || $bool_nowrap) ? ' nowrap="nowrap"' : '');
01417                     $vertical_display['data'][$row_no][$i]     = '    <td valign="top" ' . $column_style . ' bgcolor="' . $bgcolor . '"' . $nowrap . '>';
01418 
01419                     if (isset($analyzed_sql[0]['select_expr']) && is_array($analyzed_sql[0]['select_expr'])) {
01420                         foreach ($analyzed_sql[0]['select_expr'] AS $select_expr_position => $select_expr) {
01421                             $alias = $analyzed_sql[0]['select_expr'][$select_expr_position]['alias'];
01422                             if (!empty($alias)) {
01423                                 $true_column = $analyzed_sql[0]['select_expr'][$select_expr_position]['column'];
01424                                 if ($alias == $meta->name) {
01425                                     $meta->name = $true_column;
01426                                 } // end if
01427                             } // end if
01428                         } // end while
01429                     }
01430 
01431                     if (isset($map[$meta->name])) {
01432                         // Field to display from the foreign table?
01433                         if (!empty($map[$meta->name][2])) {
01434                             $dispsql     = 'SELECT ' . PMA_backquote($map[$meta->name][2])
01435                                          . ' FROM ' . PMA_backquote($map[$meta->name][3]) . '.' . PMA_backquote($map[$meta->name][0])
01436                                          . ' WHERE ' . PMA_backquote($map[$meta->name][1])
01437                                          . ' = \'' . PMA_sqlAddslashes($row[$i]) . '\'';
01438                             $dispresult  = PMA_DBI_try_query($dispsql, NULL, PMA_DBI_QUERY_STORE);
01439                             if ($dispresult && PMA_DBI_num_rows($dispresult) > 0) {
01440                                 list($dispval) = PMA_DBI_fetch_row($dispresult);
01441                                 @PMA_DBI_free_result($dispresult);
01442                             }
01443                             else {
01444                                 $dispval = $GLOBALS['strLinkNotFound'];
01445                             }
01446                         }
01447                         else {
01448                             $dispval = '';
01449                         }
01450                         $title = (!empty($dispval))? ' title="' . htmlspecialchars($dispval) . '"' : '';
01451 
01452                         $vertical_display['data'][$row_no][$i] .= '<a href="sql.php?'
01453                                                                .  PMA_generate_common_url($map[$meta->name][3], $map[$meta->name][0])
01454                                                                .  '&amp;pos=0&amp;session_max_rows=' . $session_max_rows . '&amp;dontlimitchars=' . $dontlimitchars
01455                                                                .  '&amp;sql_query=' . urlencode('SELECT * FROM ' . PMA_backquote($map[$meta->name][0]) . ' WHERE ' . PMA_backquote($map[$meta->name][1]) . ' = \'' . PMA_sqlAddslashes($relation_id) . '\'') . '"' . $title . '>'
01456                                                                .  $row[$i] . '</a>';
01457                     } else {
01458                         $vertical_display['data'][$row_no][$i] .= $row[$i];
01459                     }
01460                     $vertical_display['data'][$row_no][$i]     .= '</td>' . "\n";
01461                 } else {
01462                     $vertical_display['data'][$row_no][$i]     = '    <td valign="top" ' . $column_style . ' bgcolor="' . $bgcolor . '">&nbsp;</td>' . "\n";
01463                 }
01464             }
01465 
01466             // lem9: output stored cell
01467             if ($disp_direction == 'horizontal' || $disp_direction == 'horizontalflipped') {
01468                 echo $vertical_display['data'][$row_no][$i];
01469             }
01470 
01471             if (isset($vertical_display['rowdata'][$i][$row_no])) {
01472                 $vertical_display['rowdata'][$i][$row_no] .= $vertical_display['data'][$row_no][$i];
01473             } else {
01474                 $vertical_display['rowdata'][$i][$row_no] = $vertical_display['data'][$row_no][$i];
01475             }
01476         } // end for (2)
01477 
01478         // 3. Displays the modify/delete links on the right if required
01479         if ($GLOBALS['cfg']['ModifyDeleteAtRight']
01480             && ($disp_direction == 'horizontal' || $disp_direction == 'horizontalflipped')) {
01481                 $doWriteModifyAt = 'right';
01482                 require('./libraries/display_tbl_links.lib.php');
01483         } // end if (3)
01484 
01485         if ($disp_direction == 'horizontal' || $disp_direction == 'horizontalflipped') {
01486             echo "\n";
01487             ?>
01488 </tr>
01489             <?php
01490         } // end if
01491 
01492         // 4. Gather links of del_urls and edit_urls in an array for later
01493         //    output
01494         if (!isset($vertical_display['edit'][$row_no])) {
01495             $vertical_display['edit'][$row_no]       = '';
01496             $vertical_display['delete'][$row_no]     = '';
01497             $vertical_display['row_delete'][$row_no] = '';
01498         }
01499 
01500         $column_style_vertical = '';
01501         if ($GLOBALS['cfg']['BrowsePointerEnable'] == TRUE) {
01502             $column_style_vertical .= ' onmouseover="setVerticalPointer(this, ' . $row_no . ', \'over\', \'' . $GLOBALS['cfg']['BgcolorOne'] . '\', \'' . $GLOBALS['cfg']['BgcolorTwo'] . '\', \'' . $GLOBALS['cfg']['BrowsePointerColor'] . '\', \'' . $GLOBALS['cfg']['BrowseMarkerColor'] . '\');"'
01503                          . ' onmouseout="setVerticalPointer(this, ' . $row_no . ', \'out\', \'' . $GLOBALS['cfg']['BgcolorOne'] . '\', \'' . $GLOBALS['cfg']['BgcolorTwo'] . '\', \'' . $GLOBALS['cfg']['BrowsePointerColor'] . '\', \'' . $GLOBALS['cfg']['BrowseMarkerColor'] . '\');"';
01504         }
01505         $column_marker_vertical = '';
01506         if ($GLOBALS['cfg']['BrowseMarkerEnable'] == TRUE) {
01507             $column_marker_vertical .= 'setVerticalPointer(this, ' . $row_no . ', \'click\', \'' . $GLOBALS['cfg']['BgcolorOne'] . '\', \'' . $GLOBALS['cfg']['BgcolorTwo'] . '\', \'' . $GLOBALS['cfg']['BrowsePointerColor'] . '\', \'' . $GLOBALS['cfg']['BrowseMarkerColor'] . '\');';
01508         }
01509 
01510         if (!empty($del_url) && $is_display['del_lnk'] != 'kp') {
01511             $vertical_display['row_delete'][$row_no] .= '    <td align="center" valign="' . ($bookmark_go != '' ? 'top' : 'middle') . '" bgcolor="' . $bgcolor . '"' . $column_style_vertical . '>' . "\n"
01512                                                      .  '        <input type="checkbox" id="id_rows_to_delete' . $row_no . '[%_PMA_CHECKBOX_DIR_%]" name="rows_to_delete[' . $uva_condition . ']"'
01513                                                      .  ' onclick="' . $column_marker_vertical . 'copyCheckboxesRange(\'rowsDeleteForm\', \'id_rows_to_delete' . $row_no . '\',\'[%_PMA_CHECKBOX_DIR_%]\');"'
01514                                                      .  ' value="' . $del_query . '" ' . (isset($GLOBALS['checkall']) ? 'checked="checked"' : '') . ' />' . "\n"
01515                                                      .  '    </td>' . "\n";
01516         } else {
01517             unset($vertical_display['row_delete'][$row_no]);
01518         }
01519 
01520         if (isset($edit_url)) {
01521             $vertical_display['edit'][$row_no]   .= '    <td align="center" valign="' . ($bookmark_go != '' ? 'top' : 'middle') . '" bgcolor="' . $bgcolor . '"' . $column_style_vertical . '>' . "\n"
01522                                                  . PMA_linkOrButton($edit_url, $edit_str, '', FALSE)
01523                                                  . $bookmark_go
01524                                                  .  '    </td>' . "\n";
01525         } else {
01526             unset($vertical_display['edit'][$row_no]);
01527         }
01528 
01529         if (isset($del_url)) {
01530             $vertical_display['delete'][$row_no] .= '    <td align="center" valign="' . ($bookmark_go != '' ? 'top' : 'middle') . '" bgcolor="' . $bgcolor . '"' . $column_style_vertical . '>' . "\n"
01531                                                  . PMA_linkOrButton($del_url, $del_str, (isset($js_conf) ? $js_conf : ''), FALSE)
01532                                                  .  '    </td>' . "\n";
01533         } else {
01534             unset($vertical_display['delete'][$row_no]);
01535         }
01536 
01537         echo (($disp_direction == 'horizontal' || $disp_direction == 'horizontalflipped') ? "\n" : '');
01538         $row_no++;
01539     } // end while
01540 
01541     if (isset($url_query)) {
01542         $GLOBALS['url_query'] = $url_query;
01543     }
01544 
01545     return TRUE;
01546 } // end of the 'PMA_displayTableBody()' function
01547 
01548 
01562 function PMA_displayVerticalTable()
01563 {
01564     global $vertical_display, $repeat_cells;
01565 
01566     // Displays "multi row delete" link at top if required
01567     if ($GLOBALS['cfg']['ModifyDeleteAtLeft'] && is_array($vertical_display['row_delete']) && (count($vertical_display['row_delete']) > 0 || !empty($vertical_display['textbtn']))) {
01568         echo '<tr>' . "\n";
01569         echo $vertical_display['textbtn'];
01570         $foo_counter = 0;
01571         foreach ($vertical_display['row_delete'] AS $key => $val) {
01572             if (($foo_counter != 0) && ($repeat_cells != 0) && !($foo_counter % $repeat_cells)) {
01573                 echo '<th class="td">&nbsp;</th>' . "\n";
01574             }
01575 
01576             echo str_replace('[%_PMA_CHECKBOX_DIR_%]', '', $val);
01577             $foo_counter++;
01578         } // end while
01579         echo '</tr>' . "\n";
01580     } // end if
01581 
01582     // Displays "edit" link at top if required
01583     if ($GLOBALS['cfg']['ModifyDeleteAtLeft'] && is_array($vertical_display['edit']) && (count($vertical_display['edit']) > 0 || !empty($vertical_display['textbtn']))) {
01584         echo '<tr>' . "\n";
01585         if (!is_array($vertical_display['row_delete'])) {
01586             echo $vertical_display['textbtn'];
01587         }
01588         $foo_counter = 0;
01589         foreach ($vertical_display['edit'] AS $key => $val) {
01590             if (($foo_counter != 0) && ($repeat_cells != 0) && !($foo_counter % $repeat_cells)) {
01591                 echo '    <th class="td">&nbsp;</th>' . "\n";
01592             }
01593 
01594             echo $val;
01595             $foo_counter++;
01596         } // end while
01597         echo '</tr>' . "\n";
01598     } // end if
01599 
01600     // Displays "delete" link at top if required
01601     if ($GLOBALS['cfg']['ModifyDeleteAtLeft'] && is_array($vertical_display['delete']) && (count($vertical_display['delete']) > 0 || !empty($vertical_display['textbtn']))) {
01602         echo '<tr>' . "\n";
01603         if (!is_array($vertical_display['edit']) && !is_array($vertical_display['row_delete'])) {
01604             echo $vertical_display['textbtn'];
01605         }
01606         $foo_counter = 0;
01607         foreach ($vertical_display['delete'] AS $key => $val) {
01608             if (($foo_counter != 0) && ($repeat_cells != 0) && !($foo_counter % $repeat_cells)) {
01609                 echo '<th class="td">&nbsp;</th>' . "\n";
01610             }
01611 
01612             echo $val;
01613             $foo_counter++;
01614         } // end while
01615         echo '</tr>' . "\n";
01616     } // end if
01617 
01618     // Displays data
01619     $row_no = 0;
01620     foreach ($vertical_display['desc'] AS $key => $val) {
01621         $row_no++;
01622 
01623         if (isset($GLOBALS['printview']) && ($GLOBALS['printview'] == '1')) {
01624             $bgcolor = '#ffffff';
01625         } else {
01626             $bgcolor = ($row_no % 2) ? $GLOBALS['cfg']['BgcolorOne'] : $GLOBALS['cfg']['BgcolorTwo'];
01627         }
01628 
01629         echo '<tr>' . "\n";
01630         echo $val;
01631 
01632         $foo_counter = 0;
01633         foreach ($vertical_display['rowdata'][$key] AS $subkey => $subval) {
01634             if (($foo_counter != 0) && ($repeat_cells != 0) and !($foo_counter % $repeat_cells)) {
01635                 echo $val;
01636             }
01637 
01638             echo $subval;
01639             $foo_counter++;
01640         } // end while
01641 
01642         echo '</tr>' . "\n";
01643     } // end while
01644 
01645     // Displays "multi row delete" link at bottom if required
01646     if ($GLOBALS['cfg']['ModifyDeleteAtRight'] && is_array($vertical_display['row_delete']) && (count($vertical_display['row_delete']) > 0 || !empty($vertical_display['textbtn']))) {
01647         echo '<tr>' . "\n";
01648         echo $vertical_display['textbtn'];
01649         $foo_counter = 0;
01650         foreach ($vertical_display['row_delete'] AS $key => $val) {
01651             if (($foo_counter != 0) && ($repeat_cells != 0) && !($foo_counter % $repeat_cells)) {
01652                 echo '<th class="td">&nbsp;</th>' . "\n";
01653             }
01654 
01655             echo str_replace('[%_PMA_CHECKBOX_DIR_%]', 'r', $val);
01656             $foo_counter++;
01657         } // end while
01658         echo '</tr>' . "\n";
01659     } // end if
01660 
01661     // Displays "edit" link at bottom if required
01662     if ($GLOBALS['cfg']['ModifyDeleteAtRight'] && is_array($vertical_display['edit']) && (count($vertical_display['edit']) > 0 || !empty($vertical_display['textbtn']))) {
01663         echo '<tr>' . "\n";
01664         if (!is_array($vertical_display['row_delete'])) {
01665             echo $vertical_display['textbtn'];
01666         }
01667         $foo_counter = 0;
01668         foreach ($vertical_display['edit'] AS $key => $val) {
01669             if (($foo_counter != 0) && ($repeat_cells != 0) && !($foo_counter % $repeat_cells)) {
01670                 echo '<th class="td">&nbsp;</th>' . "\n";
01671             }
01672 
01673             echo $val;
01674             $foo_counter++;
01675         } // end while
01676         echo '</tr>' . "\n";
01677     } // end if
01678 
01679     // Displays "delete" link at bottom if required
01680     if ($GLOBALS['cfg']['ModifyDeleteAtRight'] && is_array($vertical_display['delete']) && (count($vertical_display['delete']) > 0 || !empty($vertical_display['textbtn']))) {
01681         echo '<tr>' . "\n";
01682         if (!is_array($vertical_display['edit']) && !is_array($vertical_display['row_delete'])) {
01683             echo $vertical_display['textbtn'];
01684         }
01685         $foo_counter = 0;
01686         foreach ($vertical_display['delete'] AS $key => $val) {
01687             if (($foo_counter != 0) && ($repeat_cells != 0) && !($foo_counter % $repeat_cells)) {
01688                 echo '<th class="td">&nbsp;</th>' . "\n";
01689             }
01690 
01691             echo $val;
01692             $foo_counter++;
01693         } // end while
01694         echo '</tr>' . "\n";
01695     }
01696 
01697     return TRUE;
01698 } // end of the 'PMA_displayVerticalTable' function
01699 
01700 
01738 function PMA_displayTable(&$dt_result, &$the_disp_mode, $analyzed_sql)
01739 {
01740     global $lang, $server, $cfg, $db, $table;
01741     global $goto, $text_url;
01742     global $sql_query, $num_rows, $unlim_num_rows, $pos, $fields_meta, $fields_cnt;
01743     global $vertical_display, $disp_direction, $repeat_cells, $highlight_columns;
01744     global $dontlimitchars;
01745     global $cfgRelation;
01746 
01747     // 1. ----- Prepares the work -----
01748 
01749     // 1.1 Gets the informations about which functionnalities should be
01750     //     displayed
01751     $total      = '';
01752     $is_display = PMA_setDisplayMode($the_disp_mode, $total);
01753     if ($total == '') {
01754         unset($total);
01755     }
01756 
01757     // 1.2 Defines offsets for the next and previous pages
01758     if ($is_display['nav_bar'] == '1') {
01759         if (!isset($pos)) {
01760             $pos          = 0;
01761         }
01762         if ($GLOBALS['session_max_rows'] == 'all') {
01763             $pos_next     = 0;
01764             $pos_prev     = 0;
01765         } else {
01766             $pos_next     = $pos + $GLOBALS['cfg']['MaxRows'];
01767             $pos_prev     = $pos - $GLOBALS['cfg']['MaxRows'];
01768             if ($pos_prev < 0) {
01769                 $pos_prev = 0;
01770             }
01771         }
01772     } // end if
01773 
01774     // 1.3 Urlencodes the query to use in input form fields
01775     $encoded_sql_query = urlencode($sql_query);
01776 
01777     // 2. ----- Displays the top of the page -----
01778 
01779     // 2.1 Displays a messages with position informations
01780     if ($is_display['nav_bar'] == '1' && isset($pos_next)) {
01781         if (isset($unlim_num_rows) && $unlim_num_rows != $total) {
01782             $selectstring = ', ' . $unlim_num_rows . ' ' . $GLOBALS['strSelectNumRows'];
01783         } else {
01784             $selectstring = '';
01785         }
01786         $last_shown_rec = ($GLOBALS['session_max_rows'] == 'all' || $pos_next > $total)
01787                         ? $total - 1
01788                         : $pos_next - 1;
01789         PMA_showMessage($GLOBALS['strShowingRecords'] . " $pos - $last_shown_rec ($total " . $GLOBALS['strTotal'] . $selectstring . ', ' . sprintf($GLOBALS['strQueryTime'], $GLOBALS['querytime']) . ')');
01790     } else if (!isset($GLOBALS['printview']) || $GLOBALS['printview'] != '1') {
01791         PMA_showMessage($GLOBALS['strSQLQuery']);
01792     }
01793 
01794     // 2.3 Displays the navigation bars
01795     if (!isset($table) || strlen(trim($table)) == 0) {
01796         $table = $fields_meta[0]->table;
01797     }
01798     if ($is_display['nav_bar'] == '1') {
01799         PMA_displayTableNavigation($pos_next, $pos_prev, $encoded_sql_query);
01800         echo "\n";
01801     } else if (!isset($GLOBALS['printview']) || $GLOBALS['printview'] != '1') {
01802         echo "\n" . '<br /><br />' . "\n";
01803     }
01804 
01805     // 2b ----- Get field references from Database -----
01806     // (see the 'relation' config variable)
01807     // loic1, 2002-03-02: extended to php3
01808 
01809     // init map
01810     $map = array();
01811 
01812     // find tables
01813 
01814     $target=array();
01815     if (isset($analyzed_sql[0]['table_ref']) && is_array($analyzed_sql[0]['table_ref'])) {
01816         foreach ($analyzed_sql[0]['table_ref'] AS $table_ref_position => $table_ref) {
01817            $target[] = $analyzed_sql[0]['table_ref'][$table_ref_position]['table_true_name'];
01818         }
01819     }
01820     $tabs    = '(\'' . join('\',\'', $target) . '\')';
01821 
01822     if ($cfgRelation['displaywork']) {
01823         if (empty($table)) {
01824             $exist_rel = FALSE;
01825         } else {
01826             $exist_rel = PMA_getForeigners($db, $table, '', 'both');
01827             if ($exist_rel) {
01828                 foreach ($exist_rel AS $master_field => $rel) {
01829                     $display_field = PMA_getDisplayField($rel['foreign_db'],$rel['foreign_table']);
01830                     $map[$master_field] = array($rel['foreign_table'],
01831                                           $rel['foreign_field'],
01832                                           $display_field,
01833                                           $rel['foreign_db']);
01834                 } // end while
01835             } // end if
01836         } // end if
01837     } // end if
01838     // end 2b
01839 
01840     // 3. ----- Displays the results table -----
01841     PMA_displayTableHeaders($is_display, $fields_meta, $fields_cnt, $analyzed_sql);
01842     $url_query='';
01843     PMA_displayTableBody($dt_result, $is_display, $map, $analyzed_sql);
01844     // vertical output case
01845     if ($disp_direction == 'vertical') {
01846         PMA_displayVerticalTable();
01847     } // end if
01848     unset($vertical_display);
01849     ?>
01850 </table>
01851     <?php
01852 
01853     echo "\n";
01854 
01855     // 4. ----- Displays the link for multi-fields delete
01856 
01857     if ($is_display['del_lnk'] == 'dr' && $is_display['del_lnk'] != 'kp') {
01858 
01859         $delete_text = $is_display['del_lnk'] == 'dr' ? $GLOBALS['strDelete'] : $GLOBALS['strKill'];
01860         $propicon = (string)$GLOBALS['cfg']['PropertiesIconic'];
01861 ?>
01862         &nbsp;&nbsp;<img src="<?php echo $GLOBALS['pmaThemeImage'] . 'arrow_' . $GLOBALS['text_dir'] . '.png'; ?>" border="0" width="38" height="22" alt="<?php echo $GLOBALS['strWithChecked']; ?>" />
01863         <a href="<?php echo $text_url . '&amp;checkall=1'; ?>" onclick="setCheckboxesRange('rowsDeleteForm', true, 'id_rows_to_delete', 0, '<?php echo $num_rows; ?>'); return false;">
01864             <?php echo $GLOBALS['strCheckAll']; ?></a>
01865         &nbsp;/&nbsp;
01866         <a href="<?php echo $text_url; ?>" onclick="setCheckboxesRange('rowsDeleteForm', false, 'id_rows_to_delete', 0, '<?php echo $num_rows; ?>'); return false;">
01867             <?php echo $GLOBALS['strUncheckAll']; ?></a>
01868 <?php
01869           echo '&nbsp;&nbsp;<i>' . $GLOBALS['strWithChecked'] . '</i>'. "\n";
01870 
01871         if ($cfg['PropertiesIconic']) {
01872             PMA_buttonOrImage('submit_mult', 'mult_submit', 'submit_mult_change', $GLOBALS['strChange'], 'b_edit.png');
01873             PMA_buttonOrImage('submit_mult', 'mult_submit', 'submit_mult_delete', $delete_text, 'b_drop.png');
01874             if ($analyzed_sql[0]['querytype'] == 'SELECT') {
01875                 PMA_buttonOrImage('submit_mult', 'mult_submit', 'submit_mult_export', $GLOBALS['strExport'], 'b_tblexport.png');
01876             }
01877             echo "\n";
01878         } else {
01879             echo '                    <input type="submit" name="submit_mult" value="' . htmlspecialchars($GLOBALS['strEdit']) . '" title="' . $GLOBALS['strEdit'] . '" />' . "\n";
01880             echo '&nbsp;<input type="submit" name="submit_mult" value="' . htmlspecialchars($delete_text) . '" title="' . $delete_text . '" />' . "\n";
01881             if ($analyzed_sql[0]['querytype'] == 'SELECT') {
01882                 echo '&nbsp;<input type="submit" name="submit_mult" value="' . htmlspecialchars($GLOBALS['strExport']) . '" title="' . $GLOBALS['strExport'] . '" />' . "\n";
01883             }
01884         }
01885         echo '<input type="hidden" name="sql_query" value="' . htmlspecialchars($sql_query) . '" />' . "\n";
01886         echo '<input type="hidden" name="pos" value="' . $pos . '" />' . "\n";
01887         echo '<input type="hidden" name="url_query" value="' . $GLOBALS['url_query'] . '" />' . "\n";
01888         echo '<br />' . "\n";
01889         echo '</form>' . "\n";
01890     }
01891 
01892     // 5. ----- Displays the navigation bar at the bottom if required -----
01893 
01894     if ($is_display['nav_bar'] == '1') {
01895         echo '<br />' . "\n";
01896         PMA_displayTableNavigation($pos_next, $pos_prev, $encoded_sql_query);
01897     } else if (!isset($GLOBALS['printview']) || $GLOBALS['printview'] != '1') {
01898         echo "\n" . '<br /><br />' . "\n";
01899     }
01900 } // end of the 'PMA_displayTable()' function
01901 
01902 function default_function($buffer) {
01903     $buffer = htmlspecialchars($buffer);
01904     $buffer = str_replace("\011", ' &nbsp;&nbsp;&nbsp;', str_replace('  ', ' &nbsp;', $buffer));
01905     $buffer = preg_replace("@((\015\012)|(\015)|(\012))@", '<br />', $buffer);
01906 
01907     return $buffer;
01908 }
01909 ?>

Generated on Wed Aug 10 07:55:58 2005 for TYPO3 3.8.0 by  doxygen 1.4.3-20050530