update
[phpmyadmin/crack.git] / libraries / display_tbl.lib.php3
blobdef23717084d1c648044ac5a47d099054c6a0a4d
1 <?php
2 /* $Id$ */
3 // vim: expandtab sw=4 ts=4 sts=4:
5 /**
6 * Set of functions used to display the records returned by a sql query
7 */
10 if (!defined('PMA_DISPLAY_TBL_LIB_INCLUDED')) {
11 define('PMA_DISPLAY_TBL_LIB_INCLUDED', 1);
13 /**
14 * Defines the display mode to use for the results of a sql query
16 * It uses a synthetic string that contains all the required informations.
17 * In this string:
18 * - the first two characters stand for the action to do while
19 * clicking on the "edit" link (eg 'ur' for update a row, 'nn' for no
20 * edit link...);
21 * - the next two characters stand for the action to do while
22 * clicking on the "delete" link (eg 'kp' for kill a process, 'nn' for
23 * no delete link...);
24 * - the next characters are boolean values (1/0) and respectively stand
25 * for sorting links, navigation bar, "insert a new row" link, the
26 * bookmark feature, the expand/collapse text/blob fields button and
27 * the "display printable view" option.
28 * Of course '0'/'1' means the feature won't/will be enabled.
30 * @param string the synthetic value for display_mode (see ยง1 a few
31 * lines above for explanations)
32 * @param integer the total number of rows returned by the sql query
33 * without any programmatically appended "LIMIT" clause
34 * (just a copy of $unlim_num_rows if it exists, else
35 * computed inside this function)
37 * @return array an array with explicit indexes for all the display
38 * elements
40 * @global string the database name
41 * @global string the table name
42 * @global integer the total number of rows returned by the sql query
43 * without any programmatically appended "LIMIT" clause
44 * @global array the properties of the fields returned by the query
45 * @global string the url to return to in case of error in a sql
46 * statement
48 * @access private
50 * @see PMA_displayTable()
52 function PMA_setDisplayMode(&$the_disp_mode, &$the_total)
54 global $db, $table;
55 global $unlim_num_rows, $fields_meta;
56 global $err_url;
58 // 1. Initializes the $do_display array
59 $do_display = array();
60 $do_display['edit_lnk'] = $the_disp_mode[0] . $the_disp_mode[1];
61 $do_display['del_lnk'] = $the_disp_mode[2] . $the_disp_mode[3];
62 $do_display['sort_lnk'] = (string) $the_disp_mode[4];
63 $do_display['nav_bar'] = (string) $the_disp_mode[5];
64 $do_display['ins_row'] = (string) $the_disp_mode[6];
65 $do_display['bkm_form'] = (string) $the_disp_mode[7];
66 $do_display['text_btn'] = (string) $the_disp_mode[8];
67 $do_display['pview_lnk'] = (string) $the_disp_mode[9];
69 // 2. Display mode is not "false for all elements" -> updates the
70 // display mode
71 if ($the_disp_mode != 'nnnn000000') {
72 // 2.0 Print view -> set all elements to FALSE!
73 if (isset($GLOBALS['printview']) && $GLOBALS['printview'] == '1') {
74 $do_display['edit_lnk'] = 'nn'; // no edit link
75 $do_display['del_lnk'] = 'nn'; // no delete link
76 $do_display['sort_lnk'] = (string) '0';
77 $do_display['nav_bar'] = (string) '0';
78 $do_display['ins_row'] = (string) '0';
79 $do_display['bkm_form'] = (string) '0';
80 $do_display['text_btn'] = (string) '0';
81 $do_display['pview_lnk'] = (string) '0';
83 // 2.1 Statement is a "SELECT COUNT", a
84 // "CHECK/ANALYZE/REPAIR/OPTIMIZE", an "EXPLAIN" one or
85 // contains a "PROC ANALYSE" part
86 else if ($GLOBALS['is_count'] || $GLOBALS['is_analyse'] || $GLOBALS['is_maint'] || $GLOBALS['is_explain']) {
87 $do_display['edit_lnk'] = 'nn'; // no edit link
88 $do_display['del_lnk'] = 'nn'; // no delete link
89 $do_display['sort_lnk'] = (string) '0';
90 $do_display['nav_bar'] = (string) '0';
91 $do_display['ins_row'] = (string) '0';
92 $do_display['bkm_form'] = (string) '1';
93 $do_display['text_btn'] = (string) '0';
94 $do_display['pview_lnk'] = (string) '1';
96 // 2.2 Statement is a "SHOW..."
97 else if ($GLOBALS['is_show']) {
98 // 2.2.1 TODO : defines edit/delete links depending on show statement
99 $tmp = eregi('^SHOW[[:space:]]+(VARIABLES|(FULL[[:space:]]+)?PROCESSLIST|STATUS|TABLE|GRANTS|CREATE|LOGS)', $GLOBALS['sql_query'], $which);
100 if (strpos(' ' . strtoupper($which[1]), 'PROCESSLIST') > 0) {
101 $do_display['edit_lnk'] = 'nn'; // no edit link
102 $do_display['del_lnk'] = 'kp'; // "kill process" type edit link
104 else {
105 // Default case -> no links
106 $do_display['edit_lnk'] = 'nn'; // no edit link
107 $do_display['del_lnk'] = 'nn'; // no delete link
109 // 2.2.2 Other settings
110 $do_display['sort_lnk'] = (string) '0';
111 $do_display['nav_bar'] = (string) '0';
112 $do_display['ins_row'] = (string) '0';
113 $do_display['bkm_form'] = (string) '1';
114 $do_display['text_btn'] = (string) '0';
115 $do_display['pview_lnk'] = (string) '1';
117 // 2.3 Other statements (ie "SELECT" ones) -> updates
118 // $do_display['edit_lnk'], $do_display['del_lnk'] and
119 // $do_display['text_btn'] (keeps other default values)
120 else {
121 $prev_table = $fields_meta[0]->table;
122 for ($i = 0; $i < $GLOBALS['fields_cnt']; $i++) {
123 $is_link = ($do_display['edit_lnk'] != 'nn'
124 || $do_display['del_lnk'] != 'nn'
125 || $do_display['sort_lnk'] != '0'
126 || $do_display['ins_row'] != '0');
127 // 2.3.1 Displays text cut/expand button?
128 if ($do_display['text_btn'] == '0' && eregi('BLOB', $fields_meta[$i]->type)) {
129 $do_display['text_btn'] = (string) '1';
130 if (!$is_link) {
131 break;
133 } // end if (2.3.1)
134 // 2.3.2 Displays edit/delete/sort/insert links?
135 if ($is_link
136 && ($fields_meta[$i]->table == '' || $fields_meta[$i]->table != $prev_table)) {
137 $do_display['edit_lnk'] = 'nn'; // don't display links
138 $do_display['del_lnk'] = 'nn';
139 // TODO: May be problematic with same fields names in
140 // two joined table.
141 // $do_display['sort_lnk'] = (string) '0';
142 $do_display['ins_row'] = (string) '0';
143 if ($do_display['text_btn'] == '1') {
144 break;
146 } // end if (2.3.2)
147 // 2.3.3 Always display print view link
148 $do_display['pview_lnk'] = (string) '1';
149 $prev_table = $fields_meta[$i]->table;
150 } // end for
151 } // end if..elseif...else (2.1 -> 2.3)
152 } // end if (2)
154 // 3. Gets the total number of rows if it is unknown
155 if (isset($unlim_num_rows) && $unlim_num_rows != '') {
156 $the_total = $unlim_num_rows;
158 else if (($do_display['nav_bar'] == '1' || $do_display['sort_lnk'] == '1')
159 && (!empty($db) && !empty($table))) {
160 $local_query = 'SELECT COUNT(*) AS total FROM ' . PMA_backquote($db) . '.' . PMA_backquote($table);
161 $result = PMA_mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url);
162 $the_total = PMA_mysql_result($result, 0, 'total');
163 mysql_free_result($result);
166 // 4. If navigation bar or sorting fields names urls should be
167 // displayed but there is only one row, change these settings to
168 // false
169 if ($do_display['nav_bar'] == '1' || $do_display['sort_lnk'] == '1') {
170 if (isset($unlim_num_rows) && $unlim_num_rows < 2) {
171 $do_display['nav_bar'] = (string) '0';
172 $do_display['sort_lnk'] = (string) '0';
174 } // end if (3)
176 // 5. Updates the synthetic var
177 $the_disp_mode = join('', $do_display);
179 return $do_display;
180 } // end of the 'PMA_setDisplayMode()' function
184 * Displays a navigation bar to browse among the results of a sql query
186 * @param integer the offset for the "next" page
187 * @param integer the offset for the "previous" page
188 * @param string the url-encoded query
190 * @global string the current language
191 * @global string the currect charset for MySQL
192 * @global integer the server to use (refers to the number in the
193 * configuration file)
194 * @global string the database name
195 * @global string the table name
196 * @global string the url to go back in case of errors
197 * @global integer the total number of rows returned by the sql query
198 * @global integer the total number of rows returned by the sql query
199 * without any programmatically appended "LIMIT" clause
200 * @global integer the current position in results
201 * @global mixed the maximum number of rows per page ('all' = no limit)
202 * @global string the display mode (horizontal/vertical)
203 * @global integer the number of row to display between two table headers
204 * @global boolean whether to limit the number of displayed characters of
205 * text type fields or not
207 * @access private
209 * @see PMA_displayTable()
211 function PMA_displayTableNavigation($pos_next, $pos_prev, $encoded_query)
213 global $lang, $convcharset, $server, $db, $table;
214 global $goto;
215 global $num_rows, $unlim_num_rows, $pos, $session_max_rows;
216 global $disp_direction, $repeat_cells;
217 global $dontlimitchars;
220 <!-- Navigation bar -->
221 <table border="0">
222 <tr>
223 <?php
224 // Move to the beginning or to the previous page
225 if ($pos > 0 && $session_max_rows != 'all') {
226 // loic1: patch #474210 from Gosha Sakovich - part 1
227 if ($GLOBALS['cfg']['NavigationBarIconic']) {
228 $caption1 = '&lt;&lt;';
229 $caption2 = '&nbsp;&lt;&nbsp;';
230 $title1 = ' title="' . $GLOBALS['strPos1'] . '"';
231 $title2 = ' title="' . $GLOBALS['strPrevious'] . '"';
232 } else {
233 $caption1 = $GLOBALS['strPos1'] . ' &lt;&lt;';
234 $caption2 = $GLOBALS['strPrevious'] . ' &lt;';
235 $title1 = '';
236 $title2 = '';
237 } // end if... else...
239 <td>
240 <form action="sql.php3" method="post">
241 <input type="hidden" name="lang" value="<?php echo $lang; ?>" />
242 <input type="hidden" name="convcharset" value="<?php echo $convcharset; ?>" />
243 <input type="hidden" name="server" value="<?php echo $server; ?>" />
244 <input type="hidden" name="db" value="<?php echo $db; ?>" />
245 <input type="hidden" name="table" value="<?php echo $table; ?>" />
246 <input type="hidden" name="sql_query" value="<?php echo $encoded_query; ?>" />
247 <input type="hidden" name="pos" value="0" />
248 <input type="hidden" name="session_max_rows" value="<?php echo $session_max_rows; ?>" />
249 <input type="hidden" name="disp_direction" value="<?php echo $disp_direction; ?>" />
250 <input type="hidden" name="repeat_cells" value="<?php echo $repeat_cells; ?>" />
251 <input type="hidden" name="goto" value="<?php echo $goto; ?>" />
252 <input type="hidden" name="dontlimitchars" value="<?php echo $dontlimitchars; ?>" />
253 <input type="submit" name="navig" value="<?php echo $caption1; ?>"<?php echo $title1; ?> />
254 </form>
255 </td>
256 <td>
257 <form action="sql.php3" method="post">
258 <input type="hidden" name="lang" value="<?php echo $lang; ?>" />
259 <input type="hidden" name="convcharset" value="<?php echo $convcharset; ?>" />
260 <input type="hidden" name="server" value="<?php echo $server; ?>" />
261 <input type="hidden" name="db" value="<?php echo $db; ?>" />
262 <input type="hidden" name="table" value="<?php echo $table; ?>" />
263 <input type="hidden" name="sql_query" value="<?php echo $encoded_query; ?>" />
264 <input type="hidden" name="pos" value="<?php echo $pos_prev; ?>" />
265 <input type="hidden" name="session_max_rows" value="<?php echo $session_max_rows; ?>" />
266 <input type="hidden" name="disp_direction" value="<?php echo $disp_direction; ?>" />
267 <input type="hidden" name="repeat_cells" value="<?php echo $repeat_cells; ?>" />
268 <input type="hidden" name="goto" value="<?php echo $goto; ?>" />
269 <input type="hidden" name="dontlimitchars" value="<?php echo $dontlimitchars; ?>" />
270 <input type="submit" name="navig" value="<?php echo $caption2; ?>"<?php echo $title2; ?> />
271 </form>
272 </td>
273 <?php
274 } // end move back
275 echo "\n";
277 <td>
278 &nbsp;&nbsp;&nbsp;
279 </td>
280 <td align="center">
281 <form action="sql.php3" method="post"
282 onsubmit="return (checkFormElementInRange(this, 'session_max_rows', 1) && checkFormElementInRange(this, 'pos', 0, <?php echo $unlim_num_rows - 1; ?>))">
283 <input type="hidden" name="lang" value="<?php echo $lang; ?>" />
284 <input type="hidden" name="convcharset" value="<?php echo $convcharset; ?>" />
285 <input type="hidden" name="server" value="<?php echo $server; ?>" />
286 <input type="hidden" name="db" value="<?php echo $db; ?>" />
287 <input type="hidden" name="table" value="<?php echo $table; ?>" />
288 <input type="hidden" name="sql_query" value="<?php echo $encoded_query; ?>" />
289 <input type="hidden" name="goto" value="<?php echo $goto; ?>" />
290 <input type="hidden" name="dontlimitchars" value="<?php echo $dontlimitchars; ?>" />
291 <input type="submit" name="navig" value="<?php echo $GLOBALS['strShow']; ?>&nbsp;:" />
292 <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()" />
293 <?php echo $GLOBALS['strRowsFrom'] . "\n"; ?>
294 <input type="text" name="pos" size="6" value="<?php echo (($pos_next >= $unlim_num_rows) ? 0 : $pos_next); ?>" class="textfield" onfocus="this.select()" />
295 <br />
296 <?php
297 // Display mode (horizontal/vertical and repeat headers)
298 $param1 = ' <select name="disp_direction">' . "\n"
299 . ' <option value="horizontal"' . (($disp_direction == 'horizontal') ? ' selected="selected"': '') . '>' . $GLOBALS['strRowsModeHorizontal'] . '</option>' . "\n"
300 . ' <option value="vertical"' . (($disp_direction == 'vertical') ? ' selected="selected"': '') . '>' . $GLOBALS['strRowsModeVertical'] . '</option>' . "\n"
301 . ' </select>' . "\n"
302 . ' ';
303 $param2 = ' <input type="text" size="3" name="repeat_cells" value="' . $repeat_cells . '" class="textfield" />' . "\n"
304 . ' ';
305 echo ' ' . sprintf($GLOBALS['strRowsModeOptions'], "\n" . $param1, "\n" . $param2) . "\n";
307 </form>
308 </td>
309 <td>
310 &nbsp;&nbsp;&nbsp;
311 </td>
312 <?php
313 // Move to the next page or to the last one
314 if (($pos + $session_max_rows < $unlim_num_rows) && $num_rows >= $session_max_rows
315 && $session_max_rows != 'all') {
316 // loic1: patch #474210 from Gosha Sakovich - part 2
317 if ($GLOBALS['cfg']['NavigationBarIconic']) {
318 $caption3 = '&nbsp;&gt;&nbsp;';
319 $caption4 = '&gt;&gt;';
320 $title3 = ' title="' . $GLOBALS['strNext'] . '"';
321 $title4 = ' title="' . $GLOBALS['strEnd'] . '"';
322 } else {
323 $caption3 = '&gt; ' . $GLOBALS['strNext'];
324 $caption4 = '&gt;&gt; ' . $GLOBALS['strEnd'];
325 $title3 = '';
326 $title4 = '';
327 } // end if... else...
328 echo "\n";
330 <td>
331 <form action="sql.php3" method="post">
332 <input type="hidden" name="lang" value="<?php echo $lang; ?>" />
333 <input type="hidden" name="convcharset" value="<?php echo $convcharset; ?>" />
334 <input type="hidden" name="server" value="<?php echo $server; ?>" />
335 <input type="hidden" name="db" value="<?php echo $db; ?>" />
336 <input type="hidden" name="table" value="<?php echo $table; ?>" />
337 <input type="hidden" name="sql_query" value="<?php echo $encoded_query; ?>" />
338 <input type="hidden" name="pos" value="<?php echo $pos_next; ?>" />
339 <input type="hidden" name="session_max_rows" value="<?php echo $session_max_rows; ?>" />
340 <input type="hidden" name="disp_direction" value="<?php echo $disp_direction; ?>" />
341 <input type="hidden" name="repeat_cells" value="<?php echo $repeat_cells; ?>" />
342 <input type="hidden" name="goto" value="<?php echo $goto; ?>" />
343 <input type="hidden" name="dontlimitchars" value="<?php echo $dontlimitchars; ?>" />
344 <input type="submit" name="navig" value="<?php echo $caption3; ?>"<?php echo $title3; ?> />
345 </form>
346 </td>
347 <td>
348 <form action="sql.php3" method="post"
349 onsubmit="return <?php echo (($pos + $session_max_rows < $unlim_num_rows && $num_rows >= $session_max_rows) ? 'true' : 'false'); ?>">
350 <input type="hidden" name="lang" value="<?php echo $lang; ?>" />
351 <input type="hidden" name="convcharset" value="<?php echo $convcharset; ?>" />
352 <input type="hidden" name="server" value="<?php echo $server; ?>" />
353 <input type="hidden" name="db" value="<?php echo $db; ?>" />
354 <input type="hidden" name="table" value="<?php echo $table; ?>" />
355 <input type="hidden" name="sql_query" value="<?php echo $encoded_query; ?>" />
356 <input type="hidden" name="pos" value="<?php echo $unlim_num_rows - $session_max_rows; ?>" />
357 <input type="hidden" name="session_max_rows" value="<?php echo $session_max_rows; ?>" />
358 <input type="hidden" name="disp_direction" value="<?php echo $disp_direction; ?>" />
359 <input type="hidden" name="repeat_cells" value="<?php echo $repeat_cells; ?>" />
360 <input type="hidden" name="goto" value="<?php echo $goto; ?>" />
361 <input type="hidden" name="dontlimitchars" value="<?php echo $dontlimitchars; ?>" />
362 <input type="submit" name="navig" value="<?php echo $caption4; ?>"<?php echo $title4; ?> />
363 </form>
364 </td>
365 <?php
366 } // end move toward
368 // Show all the records if allowed
369 if ($GLOBALS['cfg']['ShowAll'] && ($num_rows < $unlim_num_rows)) {
370 echo "\n";
372 <td>
373 &nbsp;&nbsp;&nbsp;
374 </td>
375 <td>
376 <form action="sql.php3" method="post">
377 <input type="hidden" name="lang" value="<?php echo $lang; ?>" />
378 <input type="hidden" name="convcharset" value="<?php echo $convcharset; ?>" />
379 <input type="hidden" name="server" value="<?php echo $server; ?>" />
380 <input type="hidden" name="db" value="<?php echo $db; ?>" />
381 <input type="hidden" name="table" value="<?php echo $table; ?>" />
382 <input type="hidden" name="sql_query" value="<?php echo $encoded_query; ?>" />
383 <input type="hidden" name="pos" value="0" />
384 <input type="hidden" name="session_max_rows" value="all" />
385 <input type="hidden" name="disp_direction" value="<?php echo $disp_direction; ?>" />
386 <input type="hidden" name="repeat_cells" value="<?php echo $repeat_cells; ?>" />
387 <input type="hidden" name="goto" value="<?php echo $goto; ?>" />
388 <input type="hidden" name="dontlimitchars" value="<?php echo $dontlimitchars; ?>" />
389 <input type="submit" name="navig" value="<?php echo $GLOBALS['strShowAll']; ?>" />
390 </form>
391 </td>
392 <?php
393 } // end show all
394 echo "\n";
396 </tr>
397 </table>
399 <?php
400 } // end of the 'PMA_displayTableNavigation()' function
404 * Displays the headers of the results table
406 * @param array which elements to display
407 * @param array the list of fields properties
408 * @param integer the total number of fields returned by the sql query
410 * @return boolean always true
412 * @global string the current language
413 * @global string the current charset for MySQL
414 * @global integer the server to use (refers to the number in the
415 * configuration file)
416 * @global string the database name
417 * @global string the table name
418 * @global string the sql query
419 * @global string the url to go back in case of errors
420 * @global integer the total number of rows returned by the sql query
421 * @global integer the current position in results
422 * @global integer the maximum number of rows per page
423 * @global array informations used with vertical display mode
424 * @global string the display mode (horizontal/vertical)
425 * @global integer the number of row to display between two table headers
426 * @global boolean whether to limit the number of displayed characters of
427 * text type fields or not
429 * @access private
431 * @see PMA_displayTable()
433 function PMA_displayTableHeaders(&$is_display, &$fields_meta, $fields_cnt = 0)
435 global $lang, $convcharset, $server, $db, $table;
436 global $goto;
437 global $sql_query, $num_rows, $pos, $session_max_rows;
438 global $vertical_display, $disp_direction, $repeat_cells;
439 global $dontlimitchars;
441 if ($disp_direction == 'horizontal') {
443 <!-- Results table headers -->
444 <tr>
445 <?php
446 echo "\n";
449 $vertical_display['emptypre'] = 0;
450 $vertical_display['emptyafter'] = 0;
451 $vertical_display['textbtn'] = '';
453 // 1. Displays the full/partial text button (part 1)...
454 if ($disp_direction == 'horizontal') {
455 $colspan = ($is_display['edit_lnk'] != 'nn' && $is_display['del_lnk'] != 'nn')
456 ? ' colspan="2"'
457 : '';
458 } else {
459 $rowspan = ($is_display['edit_lnk'] != 'nn' && $is_display['del_lnk'] != 'nn')
460 ? ' rowspan="2"'
461 : '';
463 $text_url = 'sql.php3'
464 . '?lang=' . $lang
465 . '&amp;convcharset=' . $convcharset
466 . '&amp;server=' . $server
467 . '&amp;db=' . urlencode($db)
468 . '&amp;table=' . urlencode($table)
469 . '&amp;sql_query=' . urlencode($sql_query)
470 . '&amp;pos=' . $pos
471 . '&amp;session_max_rows=' . $session_max_rows
472 . '&amp;pos=' . $pos
473 . '&amp;disp_direction=' . $disp_direction
474 . '&amp;repeat_cells=' . $repeat_cells
475 . '&amp;goto=' . $goto
476 . '&amp;dontlimitchars=' . (($dontlimitchars) ? 0 : 1);
478 // ... before the result table
479 if (($is_display['edit_lnk'] == 'nn' && $is_display['del_lnk'] == 'nn')
480 && $is_display['text_btn'] == '1') {
481 $vertical_display['emptypre'] = ($is_display['edit_lnk'] != 'nn' && $is_display['del_lnk'] != 'nn') ? 2 : 1;
482 if ($disp_direction == 'horizontal') {
484 <td colspan="<?php echo $fields_cnt; ?>" align="center">
485 <a href="<?php echo $text_url; ?>">
486 <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>
487 </td>
488 </tr>
490 <tr>
491 <?php
492 } // end horizontal mode
493 else {
494 echo "\n";
496 <tr>
497 <td colspan="<?php echo $num_rows + floor($num_rows/$repeat_cells) + 1; ?>" align="center">
498 <a href="<?php echo $text_url; ?>">
499 <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>
500 </td>
501 </tr>
502 <?php
503 } // end vertical mode
506 // ... at the left column of the result table header if possible
507 // and required
508 else if ($GLOBALS['cfg']['ModifyDeleteAtLeft'] && $is_display['text_btn'] == '1') {
509 $vertical_display['emptypre'] = ($is_display['edit_lnk'] != 'nn' && $is_display['del_lnk'] != 'nn') ? 2 : 1;
510 if ($disp_direction == 'horizontal') {
511 echo "\n";
513 <td<?php echo $colspan; ?> align="center">
514 <a href="<?php echo $text_url; ?>">
515 <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>
516 </td>
517 <?php
518 } // end horizontal mode
519 else {
520 $vertical_display['textbtn'] = ' <td' . $rowspan . ' align="center" valign="middle">' . "\n"
521 . ' <a href="' . $text_url . '">' . "\n"
522 . ' <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"
523 . ' </td>' . "\n";
524 } // end vertical mode
527 // ... else if no button, displays empty(ies) col(s) if required
528 else if ($GLOBALS['cfg']['ModifyDeleteAtLeft']
529 && ($is_display['edit_lnk'] != 'nn' || $is_display['del_lnk'] != 'nn')) {
530 $vertical_display['emptypre'] = ($is_display['edit_lnk'] != 'nn' && $is_display['del_lnk'] != 'nn') ? 2 : 1;
531 if ($disp_direction == 'horizontal') {
532 echo "\n";
534 <td<?php echo $colspan; ?>></td>
535 <?php
536 echo "\n";
537 } // end horizontal mode
538 else {
539 $vertical_display['textbtn'] = ' <td' . $rowspan . '></td>' . "\n";
540 } // end vertical mode
543 // 2. Displays the fields' name
544 // 2.0 If sorting links should be used, checks if the query is a "JOIN"
545 // statement (see 2.1.3)
546 if ($is_display['sort_lnk'] == '1') {
547 $is_join = eregi('(.*)[[:space:]]+FROM[[:space:]]+.*[[:space:]]+JOIN', $sql_query, $select_stt);
548 } else {
549 $is_join = FALSE;
551 for ($i = 0; $i < $fields_cnt; $i++) {
553 // 2.1 Results can be sorted
554 if ($is_display['sort_lnk'] == '1') {
555 // Defines the url used to append/modify a sorting order
556 // 2.1.1 Checks if an hard coded 'order by' clause exists
557 if (eregi('(.*)([[:space:]]ORDER[[:space:]]*BY[[:space:]](.*))', $sql_query, $regs1)) {
558 if (eregi('((.*)([[:space:]]ASC|[[:space:]]DESC)([[:space:]]|$))(.*)', $regs1[2], $regs2)) {
559 $unsorted_sql_query = trim($regs1[1] . ' ' . $regs2[5]);
560 $sql_order = trim($regs2[1]);
562 else if (eregi('((.*))[[:space:]](LIMIT (.*)|PROCEDURE (.*)|FOR UPDATE|LOCK IN SHARE MODE)', $regs1[2], $regs3)) {
563 $unsorted_sql_query = trim($regs1[1] . ' ' . $regs3[3]);
564 $sql_order = trim($regs3[1]) . ' ASC';
565 } else {
566 $unsorted_sql_query = trim($regs1[1]);
567 $sql_order = trim($regs1[2]) . ' ASC';
569 } else {
570 $unsorted_sql_query = $sql_query;
572 // 2.1.2 Checks if the current column is used to sort the
573 // results
574 if (empty($sql_order)) {
575 $is_in_sort = FALSE;
576 } else {
577 //$is_in_sort = eregi('[[:space:]](`?)' . str_replace('\\', '\\\\', $fields_meta[$i]->name) . '(`?)[ ,$]', $sql_order);
578 $pattern = str_replace('\\', '\\\\', $fields_meta[$i]->name);
579 $pattern = str_replace('(','\(', $pattern);
580 $pattern = str_replace(')','\)', $pattern);
581 //$is_in_sort = eregi('[[:space:]](`?)' . $pattern . '(`?)[ ,$]', $sql_order);
582 // field name may be preceded by a space, or any number
583 // of characters followed by a dot (tablename.fieldname)
584 $is_in_sort = eregi('([[:space:]]|(.*\.))(`?)' . $pattern . '(`?)[ ,$]', $sql_order);
586 // 2.1.3 Checks if the table name is required (it's the case
587 // for a query with a "JOIN" statement and if the column
588 // isn't aliased)
589 if ($is_join
590 && !eregi('([^[:space:],]|`[^`]`)[[:space:]]+(as[[:space:]]+)?' . $fields_meta[$i]->name, $select_stt[1], $parts)) {
591 $sort_tbl = PMA_backquote($fields_meta[$i]->table) . '.';
592 } else {
593 $sort_tbl = '';
595 // 2.1.4 Check the field name for backquotes.
596 // If it contains some, it's probably a function column
597 // like 'COUNT(`field`)'
598 if (strpos(' ' . $fields_meta[$i]->name, '`') > 0) {
599 $sort_order = ' ORDER BY \'' . $fields_meta[$i]->name . '\' ';
600 } else {
601 $sort_order = ' ORDER BY ' . $sort_tbl . PMA_backquote($fields_meta[$i]->name) . ' ';
603 // 2.1.5 Do define the sorting url
604 if (!$is_in_sort) {
605 // loic1: patch #455484 ("Smart" order)
606 $cfg['Order'] = strtoupper($GLOBALS['cfg']['Order']);
607 if ($cfg['Order'] == 'SMART') {
608 $cfg['Order'] = (eregi('time|date', $fields_meta[$i]->type)) ? 'DESC' : 'ASC';
610 $sort_order .= $cfg['Order'];
611 $order_img = '';
613 else if (eregi('[[:space:]]ASC$', $sql_order)) {
614 $sort_order .= ' DESC';
615 $order_img = '&nbsp;<img src="./images/asc_order.gif" border="0" width="7" height="7" alt="'. $GLOBALS['strAscending'] . '" title="'. $GLOBALS['strAscending'] . '" />';
617 else if (eregi('[[:space:]]DESC$', $sql_order)) {
618 $sort_order .= ' ASC';
619 $order_img = '&nbsp;<img src="./images/desc_order.gif" border="0" width="7" height="7" alt="'. $GLOBALS['strDescending'] . '" title="'. $GLOBALS['strDescending'] . '" />';
621 if (eregi('(.*)([[:space:]](LIMIT (.*)|PROCEDURE (.*)|FOR UPDATE|LOCK IN SHARE MODE))', $unsorted_sql_query, $regs3)) {
622 $sorted_sql_query = $regs3[1] . $sort_order . $regs3[2];
623 } else {
624 $sorted_sql_query = $unsorted_sql_query . $sort_order;
626 $url_query = 'lang=' . $lang
627 . '&amp;convcharset=' . $convcharset
628 . '&amp;server=' . $server
629 . '&amp;db=' . urlencode($db)
630 . '&amp;table=' . urlencode($table)
631 . '&amp;pos=' . $pos
632 . '&amp;session_max_rows=' . $session_max_rows
633 . '&amp;disp_direction=' . $disp_direction
634 . '&amp;repeat_cells=' . $repeat_cells
635 . '&amp;dontlimitchars=' . $dontlimitchars
636 . '&amp;sql_query=' . urlencode($sorted_sql_query);
638 // 2.1.5 Displays the sorting url
639 if ($disp_direction == 'horizontal') {
640 echo "\n";
642 <th>
643 <a href="sql.php3?<?php echo $url_query; ?>">
644 <?php echo htmlspecialchars($fields_meta[$i]->name); ?></a><?php echo $order_img . "\n"; ?>
645 </th>
646 <?php
648 $vertical_display['desc'][] = ' <th>' . "\n"
649 . ' <a href="sql.php3?' . $url_query . '">' . "\n"
650 . ' ' . htmlspecialchars($fields_meta[$i]->name) . '</a>' . $order_img . "\n"
651 . ' </th>' . "\n";
652 } // end if (2.1)
654 // 2.2 Results can't be sorted
655 else {
656 if ($disp_direction == 'horizontal') {
657 echo "\n";
659 <th>
660 <?php echo htmlspecialchars($fields_meta[$i]->name) . "\n"; ?>
661 </th>
662 <?php
664 $vertical_display['desc'][] = ' <th>' . "\n"
665 . ' ' . htmlspecialchars($fields_meta[$i]->name) . "\n"
666 . ' </th>';
667 } // end else (2.2)
668 } // end for
670 // 3. Displays the full/partial text button (part 2) at the right
671 // column of the result table header if possible and required...
672 if ($GLOBALS['cfg']['ModifyDeleteAtRight']
673 && ($is_display['edit_lnk'] != 'nn' || $is_display['del_lnk'] != 'nn')
674 && $is_display['text_btn'] == '1') {
675 $vertical_display['emptyafter'] = ($is_display['edit_lnk'] != 'nn' && $is_display['del_lnk'] != 'nn') ? 2 : 1;
676 if ($disp_direction == 'horizontal') {
677 echo "\n";
679 <td<?php echo $colspan; ?> align="center">
680 <a href="<?php echo $text_url; ?>">
681 <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>
682 </td>
683 <?php
684 } // end horizontal mode
685 else {
686 $vertical_display['textbtn'] = ' <td' . $rowspan . ' align="center" valign="middle">' . "\n"
687 . ' <a href="' . $text_url . '">' . "\n"
688 . ' <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"
689 . ' </td>' . "\n";
690 } // end vertical mode
693 // ... else if no button, displays empty cols if required
694 // (unless coming from Browse mode print view)
695 else if ($GLOBALS['cfg']['ModifyDeleteAtRight']
696 && ($is_display['edit_lnk'] == 'nn' && $is_display['del_lnk'] == 'nn')
697 && (!$GLOBALS['is_header_sent'])) {
698 $vertical_display['emptyafter'] = ($is_display['edit_lnk'] != 'nn' && $is_display['del_lnk'] != 'nn') ? 2 : 1;
699 if ($disp_direction == 'horizontal') {
700 echo "\n";
702 <td<?php echo $colspan; ?>></td>
703 <?php
704 } // end horizontal mode
705 else {
706 $vertical_display['textbtn'] = ' <td' . $rowspan . '></td>' . "\n";
707 } // end vertical mode
710 if ($disp_direction == 'horizontal') {
711 echo "\n";
713 </tr>
714 <?php
716 echo "\n";
718 return TRUE;
719 } // end of the 'PMA_displayTableHeaders()' function
723 * Displays a link, or a button if the link's URL is too large, to
724 * accommodate some browsers' limitations
726 * @param string the URL
727 * @param string the link message
728 * @param string js confirmation
730 * @return string the results to be echoed or saved in an array
732 function PMA_linkOrButton($url, $message, $js_conf)
734 if (strlen($url) <= 2047) {
735 $onclick_url = (empty($js_conf) ? '' : ' onclick="return confirmLink(this, \'' . $js_conf . '\')"');
736 $link_or_button = ' <a href="' . $url . '"' . $onclick_url . '>' . "\n"
737 . ' ' . $message . '</a>' . "\n";
739 else {
740 $edit_url_parts = parse_url($url);
741 $query_parts = explode('&', $edit_url_parts['query']);
742 $link_or_button = ' <form action="'
743 . $edit_url_parts['path']
744 . '" method="post">' . "\n";
745 reset ($query_parts);
746 while (list(, $query_pair) = each($query_parts)) {
747 list($eachvar, $eachval) = explode('=', $query_pair);
748 $link_or_button .= ' <input type="hidden" name="' . str_replace('amp;', '', $eachvar) . '" value="' . htmlspecialchars(urldecode($eachval)) . '" />' . "\n";
749 } // end while
750 $link_or_button .= ' <input type="submit" value="'
751 . htmlspecialchars($message) . '" />' . "\n" . '</form>' . "\n";
752 } // end if... else...
754 return $link_or_button;
755 } // end of the 'PMA_linkOrButton()' function
759 * Displays the body of the results table
761 * @param integer the link id associated to the query which results have
762 * to be displayed
763 * @param array which elements to display
764 * @param array the list of relations
765 * @param array the analyzed query
767 * @return boolean always true
769 * @global string the current language
770 * @global string the current charset for MySQL
771 * @global integer the server to use (refers to the number in the
772 * configuration file)
773 * @global string the database name
774 * @global string the table name
775 * @global string the sql query
776 * @global string the url to go back in case of errors
777 * @global integer the current position in results
778 * @global integer the maximum number of rows per page
779 * @global array the list of fields properties
780 * @global integer the total number of fields returned by the sql query
781 * @global array informations used with vertical display mode
782 * @global string the display mode (horizontal/vertical)
783 * @global integer the number of row to display between two table headers
784 * @global boolean whether to limit the number of displayed characters of
785 * text type fields or not
787 * @access private
789 * @see PMA_displayTable()
791 function PMA_displayTableBody(&$dt_result, &$is_display, $map, $analyzed_sql)
793 global $lang, $convcharset, $server, $db, $table;
794 global $goto;
795 global $sql_query, $pos, $session_max_rows, $fields_meta, $fields_cnt;
796 global $vertical_display, $disp_direction, $repeat_cells;
797 global $dontlimitchars;
799 if (!is_array($map)) {
800 $map = array();
803 <!-- Results table body -->
804 <?php
805 echo "\n";
807 $row_no = 0;
808 $vertical_display['edit'] = array();
809 $vertical_display['delete'] = array();
810 $vertical_display['data'] = array();
812 // Correction uva 19991216 in the while below
813 // Previous code assumed that all tables have keys, specifically that
814 // the phpMyAdmin GUI should support row delete/edit only for such
815 // tables.
816 // Although always using keys is arguably the prescribed way of
817 // defining a relational table, it is not required. This will in
818 // particular be violated by the novice.
819 // We want to encourage phpMyAdmin usage by such novices. So the code
820 // below has been changed to conditionally work as before when the
821 // table being displayed has one or more keys; but to display
822 // delete/edit options correctly for tables without keys.
824 // loic1: use 'PMA_mysql_fetch_array' rather than 'PMA_mysql_fetch_row'
825 // to get the NULL values
827 while ($row = PMA_mysql_fetch_array($dt_result)) {
829 // lem9: "vertical display" mode stuff
830 if (($row_no != 0) && ($repeat_cells != 0) && !($row_no % $repeat_cells) && $disp_direction == 'horizontal') {
831 echo '<tr>' . "\n";
833 for ($foo_i = 0; $foo_i < $vertical_display['emptypre']; $foo_i++) {
834 echo ' <td>&nbsp;</td>' . "\n";
837 reset($vertical_display['desc']);
838 while (list($key, $val) = each($vertical_display['desc'])) {
839 echo $val;
842 for ($foo_i = 0; $foo_i < $vertical_display['emptyafter']; $foo_i++) {
843 echo ' <td>&nbsp;</td>' . "\n";
846 echo '</tr>' . "\n";
847 } // end if
849 if (isset($GLOBALS['printview']) && ($GLOBALS['printview'] == '1')) {
850 $bgcolor = '#ffffff';
851 } else {
852 $bgcolor = ($row_no % 2) ? $GLOBALS['cfg']['BgcolorOne'] : $GLOBALS['cfg']['BgcolorTwo'];
855 if ($disp_direction == 'horizontal') {
856 // loic1: pointer code part
857 $on_mouse = '';
858 if (!isset($GLOBALS['printview']) || ($GLOBALS['printview'] != '1')) {
859 if ($GLOBALS['cfg']['BrowsePointerColor'] != '') {
860 $on_mouse = ' onmouseover="setPointer(this, ' . $row_no . ', \'over\', \'' . $bgcolor . '\', \'' . $GLOBALS['cfg']['BrowsePointerColor'] . '\', \'' . $GLOBALS['cfg']['BrowseMarkerColor'] . '\');"'
861 . ' onmouseout="setPointer(this, ' . $row_no . ', \'out\', \'' . $bgcolor . '\', \'' . $GLOBALS['cfg']['BrowsePointerColor'] . '\', \'' . $GLOBALS['cfg']['BrowseMarkerColor'] . '\');"';
863 if ($GLOBALS['cfg']['BrowseMarkerColor'] != '') {
864 $on_mouse .= ' onmousedown="setPointer(this, ' . $row_no . ', \'click\', \'' . $bgcolor . '\', \'' . $GLOBALS['cfg']['BrowsePointerColor'] . '\', \'' . $GLOBALS['cfg']['BrowseMarkerColor'] . '\');"';
866 } // end if
868 <tr<?php echo $on_mouse; ?>>
869 <?php
870 echo "\n";
873 // 1. Prepares the row (gets primary keys to use)
874 if ($is_display['edit_lnk'] != 'nn' || $is_display['del_lnk'] != 'nn') {
875 $primary_key = '';
876 $unique_key = '';
877 $uva_nonprimary_condition = '';
879 // 1.1 Results from a "SELECT" statement -> builds the
880 // "primary" key to use in links
881 if ($is_display['edit_lnk'] == 'ur' /* || $is_display['edit_lnk'] == 'dr' */) {
882 for ($i = 0; $i < $fields_cnt; ++$i) {
883 $meta = $fields_meta[$i];
885 // do not use an alias in a condition
886 $column_for_condition = $meta->name;
887 reset($analyzed_sql[0]['select_expr']);
888 while (list ($select_expr_position, $select_expr) = each ($analyzed_sql[0]['select_expr'])) {
889 $alias = $analyzed_sql[0]['select_expr'][$select_expr_position]['alias'];
890 if (!empty($alias)) {
891 $true_column = $analyzed_sql[0]['select_expr'][$select_expr_position]['column'];
892 if ($alias == $meta->name) {
893 $column_for_condition = $true_column;
894 } // end if
895 } // end if
896 } // end while
898 // to fix the bug where float fields (primary or not)
899 // can't be matched because of the imprecision of
900 // floating comparison, use CONCAT
901 // (also, the syntax "CONCAT(field) IS NULL"
902 // that we need on the next "if" will work)
903 if ($meta->type == 'real') {
904 $condition = ' CONCAT(' . PMA_backquote($column_for_condition) . ') ';
905 } else {
906 $condition = ' ' . PMA_backquote($column_for_condition) . ' ';
907 } // end if... else...
909 // loic1: To fix bug #474943 under php4, the row
910 // pointer will depend on whether the "is_null"
911 // php4 function is available or not
912 $pointer = (function_exists('is_null') ? $i : $meta->name);
913 if (!isset($row[$meta->name])
914 || (function_exists('is_null') && is_null($row[$pointer]))) {
915 $condition .= 'IS NULL AND';
916 } else {
917 $condition .= '= \'' . PMA_sqlAddslashes($row[$pointer]) . '\' AND';
919 if ($meta->primary_key > 0) {
920 $primary_key .= $condition;
921 } else if ($meta->unique_key > 0) {
922 $unique_key .= $condition;
924 $uva_nonprimary_condition .= $condition;
925 } // end for
927 // Correction uva 19991216: prefer primary or unique keys
928 // for condition, but use conjunction of all values if no
929 // primary key
930 if ($primary_key) {
931 $uva_condition = $primary_key;
932 } else if ($unique_key) {
933 $uva_condition = $unique_key;
934 } else {
935 $uva_condition = $uva_nonprimary_condition;
937 $uva_condition = urlencode(ereg_replace('[[:space:]]?AND$', '', $uva_condition));
938 } // end if (1.1)
940 // 1.2 Defines the urls for the modify/delete link(s)
941 $url_query = 'lang=' . $lang
942 . '&amp;convcharset=' . $convcharset
943 . '&amp;server=' . $server
944 . '&amp;db=' . urlencode($db)
945 . '&amp;table=' . urlencode($table)
946 . '&amp;pos=' . $pos
947 . '&amp;session_max_rows=' . $session_max_rows
948 . '&amp;disp_direction=' . $disp_direction
949 . '&amp;repeat_cells=' . $repeat_cells
950 . '&amp;dontlimitchars=' . $dontlimitchars;
952 // 1.2.1 Modify link(s)
953 if ($is_display['edit_lnk'] == 'ur') { // update row case
954 // $lnk_goto = 'sql.php3'
955 // . '?' . str_replace('&amp;', '&', $url_query)
956 // . '&sql_query=' . urlencode($sql_query)
957 // . '&goto=' . (empty($goto) ? 'tbl_properties.php3' : $goto);
958 // to reduce the length of the URL, because of some browsers limitations:
959 $lnk_goto = 'sql.php3';
961 $edit_url = 'tbl_change.php3'
962 . '?' . $url_query
963 . '&amp;primary_key=' . $uva_condition
964 . '&amp;sql_query=' . urlencode($sql_query)
965 . '&amp;goto=' . urlencode($lnk_goto);
966 $edit_str = $GLOBALS['strEdit'];
967 } // end if (1.2.1)
969 // 1.2.2 Delete/Kill link(s)
970 if ($is_display['del_lnk'] == 'dr') { // delete row case
971 $lnk_goto = 'sql.php3'
972 . '?' . str_replace('&amp;', '&', $url_query)
973 . '&sql_query=' . urlencode($sql_query)
974 . '&zero_rows=' . urlencode(htmlspecialchars($GLOBALS['strDeleted']))
975 . '&goto=' . (empty($goto) ? 'tbl_properties.php3' : $goto);
976 $del_url = 'sql.php3'
977 . '?' . $url_query
978 . '&amp;sql_query=' . urlencode('DELETE FROM ' . PMA_backquote($table) . ' WHERE') . $uva_condition . ((PMA_MYSQL_INT_VERSION >= 32207) ? urlencode(' LIMIT 1') : '')
979 . '&amp;zero_rows=' . urlencode(htmlspecialchars($GLOBALS['strDeleted']))
980 . '&amp;goto=' . urlencode($lnk_goto);
981 $js_conf = 'DELETE FROM ' . PMA_jsFormat($table)
982 . ' WHERE ' . trim(PMA_jsFormat(urldecode($uva_condition), FALSE))
983 . ((PMA_MYSQL_INT_VERSION >= 32207) ? ' LIMIT 1' : '');
984 $del_str = $GLOBALS['strDelete'];
985 } else if ($is_display['del_lnk'] == 'kp') { // kill process case
986 $lnk_goto = 'sql.php3'
987 . '?' . str_replace('&amp;', '&', $url_query)
988 . '&sql_query=' . urlencode($sql_query)
989 . '&goto=main.php3';
990 $del_url = 'sql.php3'
991 . '?lang=' . $lang
992 . '&amp;convcharset=' . $convcharset
993 . '&amp;server=' . $server
994 . '&amp;db=mysql'
995 . '&amp;sql_query=' . urlencode('KILL ' . $row['Id'])
996 . '&amp;goto=' . urlencode($lnk_goto);
997 $js_conf = 'KILL ' . $row['Id'];
998 $del_str = $GLOBALS['strKill'];
999 } // end if (1.2.2)
1001 // 1.3 Displays the links at left if required
1002 if ($GLOBALS['cfg']['ModifyDeleteAtLeft']
1003 && ($disp_direction == 'horizontal')) {
1004 if (!empty($edit_url)) {
1005 echo ' <td bgcolor="' . $bgcolor . '">' . "\n";
1006 echo PMA_linkOrButton($edit_url, $edit_str, '');
1007 echo ' </td>' . "\n";
1009 if (!empty($del_url)) {
1010 echo ' <td bgcolor="' . $bgcolor . '">' . "\n";
1011 echo PMA_linkOrButton($del_url, $del_str, (isset($js_conf) ? $js_conf : ''));
1012 echo ' </td>' . "\n";
1014 } // end if (1.3)
1015 echo (($disp_direction == 'horizontal') ? "\n" : '');
1016 } // end if (1)
1018 // 2. Displays the rows' values
1019 for ($i = 0; $i < $fields_cnt; ++$i) {
1020 $meta = $fields_meta[$i];
1021 // loic1: To fix bug #474943 under php4, the row pointer will
1022 // depend on whether the "is_null" php4 function is
1023 // available or not
1024 $pointer = (function_exists('is_null') ? $i : $meta->name);
1026 // n u m e r i c
1027 if ($meta->numeric == 1) {
1029 // lem9: if two fields have the same name (this is possible
1030 // with self-join queries, for example), using $meta->name
1031 // will show both fields NULL even if only one is NULL,
1032 // so use the $pointer
1033 // (works only if function_exists('is_null')
1034 // PS: why not always work with the number ($i), since
1035 // the default second parameter of
1036 // mysql_fetch_array() is MYSQL_BOTH, so we always get
1037 // associative and numeric indices?
1039 //if (!isset($row[$meta->name])
1040 if (!isset($row[$pointer])
1041 || (function_exists('is_null') && is_null($row[$pointer]))) {
1042 $vertical_display['data'][$row_no][$i] = ' <td align="right" valign="top" bgcolor="' . $bgcolor . '"><i>NULL</i></td>' . "\n";
1043 } else if ($row[$pointer] != '') {
1044 $vertical_display['data'][$row_no][$i] = ' <td align="right" valign="top" bgcolor="' . $bgcolor . '">';
1046 if (isset($map[$meta->name])) {
1047 // Field to display from the foreign table?
1048 if (!empty($map[$meta->name][2])) {
1049 $dispsql = 'SELECT ' . PMA_backquote($map[$meta->name][2])
1050 . ' FROM ' . PMA_backquote($map[$meta->name][0])
1051 . ' WHERE ' . PMA_backquote($map[$meta->name][1])
1052 . ' = ' . $row[$pointer];
1053 $dispresult = PMA_mysql_query($dispsql);
1054 if ($dispresult && mysql_num_rows($dispresult) > 0) {
1055 $dispval = PMA_mysql_result($dispresult, 0);
1057 else {
1058 $dispval = $GLOBALS['strLinkNotFound'];
1061 else {
1062 $dispval = '';
1063 } // end if... else...
1064 $title = (!empty($dispval))? ' title="' . htmlspecialchars($dispval) . '"' : '';
1066 $vertical_display['data'][$row_no][$i] .= '<a href="sql.php3?'
1067 . 'lang=' . $lang . '&amp;server=' . $server
1068 . '&amp;convcharset=' . $convcharset
1069 . '&amp;db=' . urlencode($db) . '&amp;table=' . urlencode($map[$meta->name][0])
1070 . '&amp;pos=0&amp;session_max_rows=' . $session_max_rows . '&amp;dontlimitchars=' . $dontlimitchars
1071 . '&amp;sql_query=' . urlencode('SELECT * FROM ' . PMA_backquote($map[$meta->name][0]) . ' WHERE ' . PMA_backquote($map[$meta->name][1]) . ' = ' . $row[$pointer]) . '"' . $title . '>'
1072 . $row[$pointer] . '</a>';
1073 } else {
1074 $vertical_display['data'][$row_no][$i] .= $row[$pointer];
1076 $vertical_display['data'][$row_no][$i] .= '</td>' . "\n";
1077 } else {
1078 $vertical_display['data'][$row_no][$i] = ' <td align="right" valign="top" bgcolor="' . $bgcolor . '">&nbsp;</td>' . "\n";
1081 // b l o b
1083 } else if ($GLOBALS['cfg']['ShowBlob'] == FALSE && eregi('BLOB', $meta->type)) {
1084 // loic1 : PMA_mysql_fetch_fields returns BLOB in place of
1085 // TEXT fields type, however TEXT fields must be displayed
1086 // even if $cfg['ShowBlob'] is false -> get the true type
1087 // of the fields.
1088 $field_flags = PMA_mysql_field_flags($dt_result, $i);
1089 if (eregi('BINARY', $field_flags)) {
1090 $vertical_display['data'][$row_no][$i] = ' <td align="center" valign="top" bgcolor="' . $bgcolor . '">[BLOB]</td>' . "\n";
1091 } else {
1092 //if (!isset($row[$meta->name])
1093 if (!isset($row[$pointer])
1094 || (function_exists('is_null') && is_null($row[$pointer]))) {
1095 $vertical_display['data'][$row_no][$i] = ' <td valign="top" bgcolor="' . $bgcolor . '"><i>NULL</i></td>' . "\n";
1096 } else if ($row[$pointer] != '') {
1097 if (strlen($row[$pointer]) > $GLOBALS['cfg']['LimitChars'] && ($dontlimitchars != 1)) {
1098 $row[$pointer] = substr($row[$pointer], 0, $GLOBALS['cfg']['LimitChars']) . '...';
1100 // loic1: displays all space characters, 4 space
1101 // characters for tabulations and <cr>/<lf>
1102 $row[$pointer] = htmlspecialchars($row[$pointer]);
1103 $row[$pointer] = str_replace("\011", ' &nbsp;&nbsp;&nbsp;', str_replace(' ', ' &nbsp;', $row[$pointer]));
1104 $row[$pointer] = ereg_replace("((\015\012)|(\015)|(\012))", '<br />', $row[$pointer]);
1105 $vertical_display['data'][$row_no][$i] = ' <td valign="top" bgcolor="' . $bgcolor . '">' . $row[$pointer] . '</td>' . "\n";
1106 } else {
1107 $vertical_display['data'][$row_no][$i] = ' <td valign="top" bgcolor="' . $bgcolor . '">&nbsp;</td>' . "\n";
1110 } else {
1111 //if (!isset($row[$meta->name])
1112 if (!isset($row[$pointer])
1113 || (function_exists('is_null') && is_null($row[$pointer]))) {
1114 $vertical_display['data'][$row_no][$i] = ' <td valign="top" bgcolor="' . $bgcolor . '"><i>NULL</i></td>' . "\n";
1115 } else if ($row[$pointer] != '') {
1116 // loic1: support blanks in the key
1117 $relation_id = $row[$pointer];
1119 // loic1: Cut text/blob fields even if $cfg['ShowBlob'] is true
1120 if (eregi('BLOB', $meta->type)) {
1121 if (strlen($row[$pointer]) > $GLOBALS['cfg']['LimitChars'] && ($dontlimitchars != 1)) {
1122 $row[$pointer] = substr($row[$pointer], 0, $GLOBALS['cfg']['LimitChars']) . '...';
1125 // loic1: displays special characters from binaries
1126 $field_flags = PMA_mysql_field_flags($dt_result, $i);
1127 if (eregi('BINARY', $field_flags)) {
1128 $row[$pointer] = str_replace("\x00", '\0', $row[$pointer]);
1129 $row[$pointer] = str_replace("\x08", '\b', $row[$pointer]);
1130 $row[$pointer] = str_replace("\x0a", '\n', $row[$pointer]);
1131 $row[$pointer] = str_replace("\x0d", '\r', $row[$pointer]);
1132 $row[$pointer] = str_replace("\x1a", '\Z', $row[$pointer]);
1133 $row[$pointer] = htmlspecialchars($row[$pointer]);
1135 // loic1: displays all space characters, 4 space
1136 // characters for tabulations and <cr>/<lf>
1137 else {
1138 $row[$pointer] = htmlspecialchars($row[$pointer]);
1139 $row[$pointer] = str_replace("\011", ' &nbsp;&nbsp;&nbsp;', str_replace(' ', ' &nbsp;', $row[$pointer]));
1140 $row[$pointer] = ereg_replace("((\015\012)|(\015)|(\012))", '<br />', $row[$pointer]);
1142 // loic1: do not wrap if date field type
1143 $nowrap = (eregi('DATE|TIME', $meta->type) ? ' nowrap="nowrap"' : '');
1144 $vertical_display['data'][$row_no][$i] = ' <td valign="top" bgcolor="' . $bgcolor . '"' . $nowrap . '>';
1146 reset($analyzed_sql[0]['select_expr']);
1147 while (list ($select_expr_position, $select_expr) = each ($analyzed_sql[0]['select_expr'])) {
1148 $alias = $analyzed_sql[0]['select_expr'][$select_expr_position]['alias'];
1149 if (!empty($alias)) {
1150 $true_column = $analyzed_sql[0]['select_expr'][$select_expr_position]['column'];
1151 if ($alias == $meta->name) {
1152 $meta->name = $true_column;
1153 } // end if
1154 } // end if
1155 } // end while
1157 if (isset($map[$meta->name])) {
1158 // Field to display from the foreign table?
1159 if (!empty($map[$meta->name][2])) {
1160 $dispsql = 'SELECT ' . PMA_backquote($map[$meta->name][2])
1161 . ' FROM ' . PMA_backquote($map[$meta->name][0])
1162 . ' WHERE ' . PMA_backquote($map[$meta->name][1])
1163 . ' = \'' . PMA_sqlAddslashes($row[$pointer]) . '\'';
1164 $dispresult = @PMA_mysql_query($dispsql);
1165 if ($dispresult && mysql_num_rows($dispresult) > 0) {
1166 $dispval = PMA_mysql_result($dispresult, 0);
1168 else {
1169 $dispval = $GLOBALS['strLinkNotFound'];
1172 else {
1173 $dispval = '';
1175 $title = (!empty($dispval))? ' title="' . htmlspecialchars($dispval) . '"' : '';
1177 $vertical_display['data'][$row_no][$i] .= '<a href="sql.php3?'
1178 . 'lang=' . $lang . '&amp;convcharset=' . $convcharset
1179 . '&amp;server=' . $server
1180 . '&amp;db=' . urlencode($db) . '&amp;table=' . urlencode($map[$meta->name][0])
1181 . '&amp;pos=0&amp;session_max_rows=' . $session_max_rows . '&amp;dontlimitchars=' . $dontlimitchars
1182 . '&amp;sql_query=' . urlencode('SELECT * FROM ' . PMA_backquote($map[$meta->name][0]) . ' WHERE ' . PMA_backquote($map[$meta->name][1]) . ' = \'' . PMA_sqlAddslashes($relation_id) . '\'') . '"' . $title . '>'
1183 . $row[$pointer] . '</a>';
1184 } else {
1185 $vertical_display['data'][$row_no][$i] .= $row[$pointer];
1187 $vertical_display['data'][$row_no][$i] .= '</td>' . "\n";
1188 } else {
1189 $vertical_display['data'][$row_no][$i] = ' <td valign="top" bgcolor="' . $bgcolor . '">&nbsp;</td>' . "\n";
1193 // lem9: output stored cell
1194 if ($disp_direction == 'horizontal') {
1195 echo $vertical_display['data'][$row_no][$i];
1198 if (isset($vertical_display['rowdata'][$i][$row_no])) {
1199 $vertical_display['rowdata'][$i][$row_no] .= $vertical_display['data'][$row_no][$i];
1200 } else {
1201 $vertical_display['rowdata'][$i][$row_no] = $vertical_display['data'][$row_no][$i];
1203 } // end for (2)
1205 // 3. Displays the modify/delete links on the right if required
1206 if ($GLOBALS['cfg']['ModifyDeleteAtRight']
1207 && ($disp_direction == 'horizontal')) {
1208 if (!empty($edit_url)) {
1209 echo ' <td bgcolor="' . $bgcolor . '">' . "\n";
1210 echo PMA_linkOrButton($edit_url, $edit_str, '');
1211 echo ' </td>' . "\n";
1213 if (!empty($del_url)) {
1214 echo ' <td bgcolor="' . $bgcolor . '">' . "\n";
1215 echo PMA_linkOrButton($del_url, $del_str, (isset($js_conf) ? $js_conf : ''));
1216 echo ' </td>' . "\n";
1218 } // end if (3)
1220 if ($disp_direction == 'horizontal') {
1221 echo "\n";
1223 </tr>
1224 <?php
1225 } // end if
1227 // 4. Gather links of del_urls and edit_urls in an array for later
1228 // output
1229 if (!isset($vertical_display['edit'][$row_no])) {
1230 $vertical_display['edit'][$row_no] = '';
1231 $vertical_display['delete'][$row_no] = '';
1234 if (isset($edit_url)) {
1235 $vertical_display['edit'][$row_no] .= ' <td bgcolor="' . $bgcolor . '">' . "\n"
1236 . PMA_linkOrButton($edit_url, $edit_str, '')
1237 . ' </td>' . "\n";
1240 if (isset($del_url)) {
1241 $vertical_display['delete'][$row_no] .= ' <td bgcolor="' . $bgcolor . '">' . "\n"
1242 . PMA_linkOrButton($del_url, $del_str, (isset($js_conf) ? $js_conf : ''))
1243 . ' </td>' . "\n";
1246 echo (($disp_direction == 'horizontal') ? "\n" : '');
1247 $row_no++;
1248 } // end while
1250 return TRUE;
1251 } // end of the 'PMA_displayTableBody()' function
1255 * Do display the result table with the vertical direction mode.
1256 * Credits for this feature goes to Garvin Hicking <hicking@faktor-e.de>.
1258 * @return boolean always true
1260 * @global array the information to display
1261 * @global integer the number of row to display between two table headers
1263 * @access private
1265 * @see PMA_displayTable()
1267 function PMA_displayVerticalTable()
1269 global $vertical_display, $repeat_cells;
1271 reset($vertical_display);
1273 // Displays "edit" link at top if required
1274 if ($GLOBALS['cfg']['ModifyDeleteAtLeft'] && is_array($vertical_display['edit'])) {
1275 echo '<tr>' . "\n";
1276 echo $vertical_display['textbtn'];
1277 reset($vertical_display['edit']);
1278 $foo_counter = 0;
1279 while (list($key, $val) = each($vertical_display['edit'])) {
1280 if (($foo_counter != 0) && ($repeat_cells != 0) && !($foo_counter % $repeat_cells)) {
1281 echo ' <td>&nbsp;</td>' . "\n";
1284 echo $val;
1285 $foo_counter++;
1286 } // end while
1287 echo '</tr>' . "\n";
1288 } // end if
1290 // Displays "delete" link at top if required
1291 if ($GLOBALS['cfg']['ModifyDeleteAtLeft'] && is_array($vertical_display['delete'])) {
1292 echo '<tr>' . "\n";
1293 if (!is_array($vertical_display['edit'])) {
1294 echo $vertical_display['textbtn'];
1296 reset($vertical_display['delete']);
1297 $foo_counter = 0;
1298 while (list($key, $val) = each($vertical_display['delete'])) {
1299 if (($foo_counter != 0) && ($repeat_cells != 0) && !($foo_counter % $repeat_cells)) {
1300 echo '<td>&nbsp;</td>' . "\n";
1303 echo $val;
1304 $foo_counter++;
1305 } // end while
1306 echo '</tr>' . "\n";
1307 } // end if
1309 // Displays data
1310 reset($vertical_display['desc']);
1311 while (list($key, $val) = each($vertical_display['desc'])) {
1312 echo '<tr>' . "\n";
1313 echo $val;
1315 $foo_counter = 0;
1316 while (list($subkey, $subval) = each($vertical_display['rowdata'][$key])) {
1317 if (($foo_counter != 0) && ($repeat_cells != 0) and !($foo_counter % $repeat_cells)) {
1318 echo $val;
1321 echo $subval;
1322 $foo_counter++;
1323 } // end while
1325 echo '</tr>' . "\n";
1326 } // end while
1328 // Displays "edit" link at bottom if required
1329 if ($GLOBALS['cfg']['ModifyDeleteAtRight'] && is_array($vertical_display['edit'])) {
1330 echo '<tr>' . "\n";
1331 echo $vertical_display['textbtn'];
1332 reset($vertical_display['edit']);
1333 $foo_counter = 0;
1334 while (list($key, $val) = each($vertical_display['edit'])) {
1335 if (($foo_counter != 0) && ($repeat_cells != 0) && !($foo_counter % $repeat_cells)) {
1336 echo '<td>&nbsp;</td>' . "\n";
1339 echo $val;
1340 $foo_counter++;
1341 } // end while
1342 echo '</tr>' . "\n";
1343 } // end if
1345 // Displays "delete" link at bottom if required
1346 if ($GLOBALS['cfg']['ModifyDeleteAtRight'] && is_array($vertical_display['delete'])) {
1347 echo '<tr>' . "\n";
1348 if (!is_array($vertical_display['edit'])) {
1349 echo $vertical_display['textbtn'];
1351 reset($vertical_display['delete']);
1352 $foo_counter = 0;
1353 while (list($key, $val) = each($vertical_display['delete'])) {
1354 if (($foo_counter != 0) && ($repeat_cells != 0) && !($foo_counter % $repeat_cells)) {
1355 echo '<td>&nbsp;</td>' . "\n";
1358 echo $val;
1359 $foo_counter++;
1360 } // end while
1361 echo '</tr>' . "\n";
1364 return TRUE;
1365 } // end of the 'PMA_displayVerticalTable' function
1369 * Displays a table of results returned by a sql query.
1370 * This function is called by the "sql.php3" script.
1372 * @param integer the link id associated to the query which results have
1373 * to be displayed
1374 * @param array the display mode
1375 * @param array the analyzed query
1377 * @global string the current language
1378 * @global integer the server to use (refers to the number in the
1379 * configuration file)
1380 * @global array the current server config
1381 * @global string the database name
1382 * @global string the table name
1383 * @global string the url to go back in case of errors
1384 * @global string the current sql query
1385 * @global integer the total number of rows returned by the sql query
1386 * @global integer the total number of rows returned by the sql query
1387 * without any programmatically appended "LIMIT" clause
1388 * @global integer the current postion of the first record to be
1389 * displayed
1390 * @global array the list of fields properties
1391 * @global integer the total number of fields returned by the sql query
1392 * @global array informations used with vertical display mode
1393 * @global string the display mode (horizontal/vertical)
1394 * @global integer the number of row to display between two table headers
1395 * @global boolean whether to limit the number of displayed characters of
1396 * text type fields or not
1397 * @global array the relation settings
1399 * @access private
1401 * @see PMA_showMessage(), PMA_setDisplayMode(),
1402 * PMA_displayTableNavigation(), PMA_displayTableHeaders(),
1403 * PMA_displayTableBody()
1405 function PMA_displayTable(&$dt_result, &$the_disp_mode, $analyzed_sql)
1407 global $lang, $server, $cfg, $db, $table;
1408 global $goto;
1409 global $sql_query, $num_rows, $unlim_num_rows, $pos, $fields_meta, $fields_cnt;
1410 global $vertical_display, $disp_direction, $repeat_cells;
1411 global $dontlimitchars;
1412 global $cfgRelation;
1414 // 1. ----- Prepares the work -----
1416 // 1.1 Gets the informations about which functionnalities should be
1417 // displayed
1418 $total = '';
1419 $is_display = PMA_setDisplayMode($the_disp_mode, $total);
1420 if ($total == '') {
1421 unset($total);
1424 // 1.2 Defines offsets for the next and previous pages
1425 if ($is_display['nav_bar'] == '1') {
1426 if (!isset($pos)) {
1427 $pos = 0;
1429 if ($GLOBALS['session_max_rows'] == 'all') {
1430 $pos_next = 0;
1431 $pos_prev = 0;
1432 } else {
1433 $pos_next = $pos + $GLOBALS['cfg']['MaxRows'];
1434 $pos_prev = $pos - $GLOBALS['cfg']['MaxRows'];
1435 if ($pos_prev < 0) {
1436 $pos_prev = 0;
1439 } // end if
1441 // 1.3 Urlencodes the query to use in input form fields ($sql_query
1442 // will be stripslashed in 'sql.php3' if the 'magic_quotes_gpc'
1443 // directive is set to 'on')
1444 if (get_magic_quotes_gpc()) {
1445 $encoded_sql_query = urlencode(addslashes($sql_query));
1446 } else {
1447 $encoded_sql_query = urlencode($sql_query);
1450 // 2. ----- Displays the top of the page -----
1452 // 2.1 Displays a messages with position informations
1453 if ($is_display['nav_bar'] == '1' && isset($pos_next)) {
1454 if (isset($unlim_num_rows) && $unlim_num_rows != $total) {
1455 $selectstring = ', ' . $unlim_num_rows . ' ' . $GLOBALS['strSelectNumRows'];
1456 } else {
1457 $selectstring = '';
1459 $last_shown_rec = ($GLOBALS['session_max_rows'] == 'all' || $pos_next > $total)
1460 ? $total - 1
1461 : $pos_next - 1;
1462 PMA_showMessage($GLOBALS['strShowingRecords'] . " $pos - $last_shown_rec ($total " . $GLOBALS['strTotal'] . $selectstring . ')');
1463 } else if (!isset($GLOBALS['printview']) || $GLOBALS['printview'] != '1') {
1464 PMA_showMessage($GLOBALS['strSQLQuery']);
1467 // 2.3 Displays the navigation bars
1468 if (!isset($table) || strlen(trim($table)) == 0) {
1469 $table = $fields_meta[0]->table;
1471 if ($is_display['nav_bar'] == '1') {
1472 PMA_displayTableNavigation($pos_next, $pos_prev, $encoded_sql_query);
1473 echo "\n";
1474 } else if (!isset($GLOBALS['printview']) || $GLOBALS['printview'] != '1') {
1475 echo "\n" . '<br /><br />' . "\n";
1478 // 2b ----- Get field references from Database -----
1479 // (see the 'relation' config variable)
1480 // loic1, 2002-03-02: extended to php3
1482 // init map
1483 $map = array();
1485 if ($cfgRelation['relwork']) {
1486 // find tables
1487 //$pattern = '`?[[:space:]]+(((ON|on)[[:space:]]+[^,]+)?,|((NATURAL|natural)[[:space:]]+)?(INNER|inner|LEFT|left|RIGHT|right)([[:space:]]+(OUTER|outer))?[[:space:]]+(JOIN|join))[[:space:]]*`?';
1488 //$target = eregi_replace('^.*[[:space:]]+FROM[[:space:]]+`?|`?[[:space:]]*(ON[[:space:]]+[^,]+)?(WHERE[[:space:]]+.*)?$', '', $sql_query);
1489 //$target = eregi_replace('`?[[:space:]]ORDER BY[[:space:]](.*)','',$target);
1490 //$tabs = '(\'' . join('\',\'', split($pattern, $target)) . '\')';
1491 $target=array();
1492 reset($analyzed_sql[0]['table_ref']);
1493 while (list ($table_ref_position, $table_ref) = each ($analyzed_sql[0]['table_ref'])) {
1494 $target[] = $analyzed_sql[0]['table_ref'][$table_ref_position]['table_true_name'];
1496 $tabs = '(\'' . join('\',\'', $target) . '\')';
1498 $local_query = 'SELECT master_field, foreign_db, foreign_table, foreign_field'
1499 . ' FROM ' . PMA_backquote($cfgRelation['relation'])
1500 . ' WHERE master_db = \'' . PMA_sqlAddslashes($db) . '\''
1501 . ' AND master_table IN ' . $tabs;
1502 $result = @PMA_query_as_cu($local_query, FALSE);
1503 if ($result) {
1504 while ($rel = PMA_mysql_fetch_row($result)) {
1505 // check for display field?
1506 if ($cfgRelation['displaywork']) {
1507 $display_field = PMA_getDisplayField($db, $rel[2]);
1508 } // end if
1509 $map[$rel[0]] = array($rel[2], $rel[3], $display_field);
1510 } // end while
1511 } // end if
1512 } // end 2b
1514 // 3. ----- Displays the results table -----
1515 echo '<!-- Results table -->' . "\n"
1516 . '<table ';
1517 if (isset($GLOBALS['printview']) && $GLOBALS['printview'] == '1') {
1518 echo 'border="1" cellpadding="2" cellspacing="0"';
1519 } else {
1520 echo 'border="' . $GLOBALS['cfg']['Border'] . '" cellpadding="5"';
1522 echo '>' . "\n";
1523 PMA_displayTableHeaders($is_display, $fields_meta, $fields_cnt);
1524 PMA_displayTableBody($dt_result, $is_display, $map, $analyzed_sql);
1525 // lem9: vertical output case
1526 if ($disp_direction == 'vertical') {
1527 PMA_displayVerticalTable();
1528 } // end if
1529 unset($vertical_display);
1531 </table>
1532 <?php
1534 echo "\n";
1536 // 4. ----- Displays the navigation bar at the bottom if required -----
1538 if ($is_display['nav_bar'] == '1') {
1539 echo '<br />' . "\n";
1540 PMA_displayTableNavigation($pos_next, $pos_prev, $encoded_sql_query);
1541 } else if (!isset($GLOBALS['printview']) || $GLOBALS['printview'] != '1') {
1542 echo "\n" . '<br /><br />' . "\n";
1544 } // end of the 'PMA_displayTable()' function
1546 } // $__PMA_DISPLAY_TBL_LIB__