Documentation TYPO3 par Ameos

display_tbl.lib.php

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


Généré par L'expert TYPO3 avec  doxygen 1.4.6