2 /* vim: set expandtab sw=4 ts=4 sts=4: */
4 * library for displaying table with results from all sort of select queries
12 require_once './libraries/Index.class.php';
15 * Defines the display mode to use for the results of a SQL query
17 * It uses a synthetic string that contains all the required informations.
19 * - the first two characters stand for the action to do while
20 * clicking on the "edit" link (e.g. 'ur' for update a row, 'nn' for no
22 * - the next two characters stand for the action to do while
23 * clicking on the "delete" link (e.g. 'kp' for kill a process, 'nn' for
25 * - the next characters are boolean values (1/0) and respectively stand
26 * for sorting links, navigation bar, "insert a new row" link, the
27 * bookmark feature, the expand/collapse text/blob fields button and
28 * the "display printable view" option.
29 * Of course '0'/'1' means the feature won't/will be enabled.
31 * @param string &$the_disp_mode the synthetic value for display_mode (see a few
32 * lines above for explanations)
33 * @param integer &$the_total the total number of rows returned by the SQL query
34 * without any programmatically appended "LIMIT" clause
35 * (just a copy of $unlim_num_rows if it exists, else
36 * computed inside this function)
38 * @return array an array with explicit indexes for all the display
41 * @global string the database name
42 * @global string the table name
43 * @global integer the total number of rows returned by the SQL query
44 * without any programmatically appended "LIMIT" clause
45 * @global array the properties of the fields returned by the query
46 * @global string the URL to return to in case of error in a SQL
51 * @see PMA_displayTable()
53 function PMA_setDisplayMode(&$the_disp_mode, &$the_total)
56 global $unlim_num_rows, $fields_meta;
59 // 1. Initializes the $do_display array
60 $do_display = array();
61 $do_display['edit_lnk'] = $the_disp_mode[0] . $the_disp_mode[1];
62 $do_display['del_lnk'] = $the_disp_mode[2] . $the_disp_mode[3];
63 $do_display['sort_lnk'] = (string) $the_disp_mode[4];
64 $do_display['nav_bar'] = (string) $the_disp_mode[5];
65 $do_display['ins_row'] = (string) $the_disp_mode[6];
66 $do_display['bkm_form'] = (string) $the_disp_mode[7];
67 $do_display['text_btn'] = (string) $the_disp_mode[8];
68 $do_display['pview_lnk'] = (string) $the_disp_mode[9];
70 // 2. Display mode is not "false for all elements" -> updates the
72 if ($the_disp_mode != 'nnnn000000') {
73 if (isset($GLOBALS['printview']) && $GLOBALS['printview'] == '1') {
74 // 2.0 Print view -> set all elements to false!
75 $do_display['edit_lnk'] = 'nn'; // no edit link
76 $do_display['del_lnk'] = 'nn'; // no delete link
77 $do_display['sort_lnk'] = (string) '0';
78 $do_display['nav_bar'] = (string) '0';
79 $do_display['ins_row'] = (string) '0';
80 $do_display['bkm_form'] = (string) '0';
81 $do_display['text_btn'] = (string) '0';
82 $do_display['pview_lnk'] = (string) '0';
83 } elseif ($GLOBALS['is_count'] ||
$GLOBALS['is_analyse']
84 ||
$GLOBALS['is_maint'] ||
$GLOBALS['is_explain']
86 // 2.1 Statement is a "SELECT COUNT", a
87 // "CHECK/ANALYZE/REPAIR/OPTIMIZE", an "EXPLAIN" one or
88 // contains a "PROC ANALYSE" part
89 $do_display['edit_lnk'] = 'nn'; // no edit link
90 $do_display['del_lnk'] = 'nn'; // no delete link
91 $do_display['sort_lnk'] = (string) '0';
92 $do_display['nav_bar'] = (string) '0';
93 $do_display['ins_row'] = (string) '0';
94 $do_display['bkm_form'] = (string) '1';
95 if ($GLOBALS['is_maint']) {
96 $do_display['text_btn'] = (string) '1';
98 $do_display['text_btn'] = (string) '0';
100 $do_display['pview_lnk'] = (string) '1';
101 } elseif ($GLOBALS['is_show']) {
102 // 2.2 Statement is a "SHOW..."
105 * @todo defines edit/delete links depending on show statement
107 $tmp = preg_match('@^SHOW[[:space:]]+(VARIABLES|(FULL[[:space:]]+)?PROCESSLIST|STATUS|TABLE|GRANTS|CREATE|LOGS|DATABASES|FIELDS)@i', $GLOBALS['sql_query'], $which);
108 if (isset($which[1]) && strpos(' ' . strtoupper($which[1]), 'PROCESSLIST') > 0) {
109 $do_display['edit_lnk'] = 'nn'; // no edit link
110 $do_display['del_lnk'] = 'kp'; // "kill process" type edit link
112 // Default case -> no links
113 $do_display['edit_lnk'] = 'nn'; // no edit link
114 $do_display['del_lnk'] = 'nn'; // no delete link
116 // 2.2.2 Other settings
117 $do_display['sort_lnk'] = (string) '0';
118 $do_display['nav_bar'] = (string) '0';
119 $do_display['ins_row'] = (string) '0';
120 $do_display['bkm_form'] = (string) '1';
121 $do_display['text_btn'] = (string) '1';
122 $do_display['pview_lnk'] = (string) '1';
124 // 2.3 Other statements (ie "SELECT" ones) -> updates
125 // $do_display['edit_lnk'], $do_display['del_lnk'] and
126 // $do_display['text_btn'] (keeps other default values)
127 $prev_table = $fields_meta[0]->table
;
128 $do_display['text_btn'] = (string) '1';
129 for ($i = 0; $i < $GLOBALS['fields_cnt']; $i++
) {
130 $is_link = ($do_display['edit_lnk'] != 'nn'
131 ||
$do_display['del_lnk'] != 'nn'
132 ||
$do_display['sort_lnk'] != '0'
133 ||
$do_display['ins_row'] != '0');
134 // 2.3.2 Displays edit/delete/sort/insert links?
136 && ($fields_meta[$i]->table
== '' ||
$fields_meta[$i]->table
!= $prev_table)
138 $do_display['edit_lnk'] = 'nn'; // don't display links
139 $do_display['del_lnk'] = 'nn';
141 * @todo May be problematic with same fields names in two joined table.
143 // $do_display['sort_lnk'] = (string) '0';
144 $do_display['ins_row'] = (string) '0';
145 if ($do_display['text_btn'] == '1') {
149 // 2.3.3 Always display print view link
150 $do_display['pview_lnk'] = (string) '1';
151 $prev_table = $fields_meta[$i]->table
;
153 } // end if..elseif...else (2.1 -> 2.3)
156 // 3. Gets the total number of rows if it is unknown
157 if (isset($unlim_num_rows) && $unlim_num_rows != '') {
158 $the_total = $unlim_num_rows;
159 } elseif (($do_display['nav_bar'] == '1' ||
$do_display['sort_lnk'] == '1')
160 && (strlen($db) && !empty($table))) {
161 $the_total = PMA_Table
::countRecords($db, $table);
164 // 4. If navigation bar or sorting fields names URLs should be
165 // displayed but there is only one row, change these settings to
167 if ($do_display['nav_bar'] == '1' ||
$do_display['sort_lnk'] == '1') {
169 // - Do not display sort links if less than 2 rows.
170 // - For a VIEW we (probably) did not count the number of rows
171 // so don't test this number here, it would remove the possibility
172 // of sorting VIEW results.
173 if (isset($unlim_num_rows) && $unlim_num_rows < 2 && ! PMA_Table
::isView($db, $table)) {
174 // force display of navbar for vertical/horizontal display-choice.
175 // $do_display['nav_bar'] = (string) '0';
176 $do_display['sort_lnk'] = (string) '0';
180 // 5. Updates the synthetic var
181 $the_disp_mode = join('', $do_display);
184 } // end of the 'PMA_setDisplayMode()' function
188 * Return true if we are executing a query in the form of
189 * "SELECT * FROM <a table> ..."
193 function PMA_isSelect()
195 // global variables set from sql.php
196 global $is_count, $is_export, $is_func, $is_analyse;
197 global $analyzed_sql;
199 return ! ($is_count ||
$is_export ||
$is_func ||
$is_analyse)
200 && count($analyzed_sql[0]['select_expr']) == 0
201 && isset($analyzed_sql[0]['queryflags']['select_from'])
202 && count($analyzed_sql[0]['table_ref']) == 1;
207 * Displays a navigation button
209 * @param string $caption iconic caption for button
210 * @param string $title text for button
211 * @param integer $pos position for next query
212 * @param string $html_sql_query query ready for display
213 * @param string $onsubmit optional onsubmit clause
214 * @param string $input_for_real_end optional hidden field for special treatment
215 * @param string $onclick optional onclick clause
219 * @global string $db the database name
220 * @global string $table the table name
221 * @global string $goto the URL to go back in case of errors
225 * @see PMA_displayTableNavigation()
227 function PMA_displayTableNavigationOneButton($caption, $title, $pos, $html_sql_query, $onsubmit = '', $input_for_real_end = '', $onclick = '')
230 global $db, $table, $goto;
232 $caption_output = '';
233 // for true or 'both'
234 if ($GLOBALS['cfg']['NavigationBarIconic']) {
235 $caption_output .= $caption;
237 // for false or 'both'
238 if (false === $GLOBALS['cfg']['NavigationBarIconic'] ||
'both' === $GLOBALS['cfg']['NavigationBarIconic']) {
239 $caption_output .= ' ' . $title;
241 $title_output = ' title="' . $title . '"';
244 <form action
="sql.php" method
="post" <?php
echo $onsubmit; ?
>>
245 <?php
echo PMA_generate_common_hidden_inputs($db, $table); ?
>
246 <input type
="hidden" name
="sql_query" value
="<?php echo $html_sql_query; ?>" />
247 <input type
="hidden" name
="pos" value
="<?php echo $pos; ?>" />
248 <input type
="hidden" name
="goto" value
="<?php echo $goto; ?>" />
249 <?php
echo $input_for_real_end; ?
>
250 <input type
="submit" name
="navig" <?php
echo ($GLOBALS['cfg']['AjaxEnable'] ?
' class="ajax" ' : '' ); ?
> value
="<?php echo $caption_output; ?>"<?php
echo $title_output . $onclick; ?
> />
254 } // end function PMA_displayTableNavigationOneButton()
257 * Displays a navigation bar to browse among the results of a SQL query
259 * @param integer $pos_next the offset for the "next" page
260 * @param integer $pos_prev the offset for the "previous" page
261 * @param string $sql_query the URL-encoded query
262 * @param string $id_for_direction_dropdown the id for the direction dropdown
266 * @global string $db the database name
267 * @global string $table the table name
268 * @global string $goto the URL to go back in case of errors
269 * @global integer $num_rows the total number of rows returned by the
271 * @global integer $unlim_num_rows the total number of rows returned by the
272 * SQL any programmatically appended "LIMIT" clause
273 * @global boolean $is_innodb whether its InnoDB or not
274 * @global array $showtable table definitions
278 * @see PMA_displayTable()
280 function PMA_displayTableNavigation($pos_next, $pos_prev, $sql_query, $id_for_direction_dropdown)
282 global $db, $table, $goto;
283 global $num_rows, $unlim_num_rows;
287 // here, using htmlentities() would cause problems if the query
288 // contains accented characters
289 $html_sql_query = htmlspecialchars($sql_query);
292 * @todo move this to a central place
293 * @todo for other future table types
295 $is_innodb = (isset($showtable['Type']) && $showtable['Type'] == 'InnoDB');
299 <!-- Navigation bar
-->
300 <table border
="0" cellpadding
="0" cellspacing
="0" class="navigation">
302 <td
class="navigation_separator"></td
>
304 // Move to the beginning or to the previous page
305 if ($_SESSION['tmp_user_values']['pos'] && $_SESSION['tmp_user_values']['max_rows'] != 'all') {
306 PMA_displayTableNavigationOneButton('<<', _pgettext('First page', 'Begin'), 0, $html_sql_query);
307 PMA_displayTableNavigationOneButton('<', _pgettext('Previous page', 'Previous'), $pos_prev, $html_sql_query);
312 // (unless we are showing all records)
313 if ('all' != $_SESSION['tmp_user_values']['max_rows']) { //if1
314 $pageNow = @floor
($_SESSION['tmp_user_values']['pos'] / $_SESSION['tmp_user_values']['max_rows']) +
1;
315 $nbTotalPage = @ceil
($unlim_num_rows / $_SESSION['tmp_user_values']['max_rows']);
317 if ($nbTotalPage > 1) { //if2
321 $_url_params = array(
324 'sql_query' => $sql_query,
327 //<form> to keep the form alignment of button < and <<
328 // and also to know what to execute when the selector changes
329 echo '<form action="sql.php' . PMA_generate_common_url($_url_params). '" method="post">';
330 echo PMA_pageselector(
331 $_SESSION['tmp_user_values']['max_rows'],
347 // Display the "Show all" button if allowed
348 if ($GLOBALS['cfg']['ShowAll'] && ($num_rows < $unlim_num_rows)) {
352 <form action
="sql.php" method
="post">
353 <?php
echo PMA_generate_common_hidden_inputs($db, $table); ?
>
354 <input type
="hidden" name
="sql_query" value
="<?php echo $html_sql_query; ?>" />
355 <input type
="hidden" name
="pos" value
="0" />
356 <input type
="hidden" name
="session_max_rows" value
="all" />
357 <input type
="hidden" name
="goto" value
="<?php echo $goto; ?>" />
358 <input type
="submit" name
="navig" value
="<?php echo __('Show all'); ?>" />
364 // Move to the next page or to the last one
365 if (($_SESSION['tmp_user_values']['pos'] +
$_SESSION['tmp_user_values']['max_rows'] < $unlim_num_rows)
366 && $num_rows >= $_SESSION['tmp_user_values']['max_rows']
367 && $_SESSION['tmp_user_values']['max_rows'] != 'all'
369 // display the Next button
370 PMA_displayTableNavigationOneButton(
372 _pgettext('Next page', 'Next'),
377 // prepare some options for the End button
378 if ($is_innodb && $unlim_num_rows > $GLOBALS['cfg']['MaxExactCount']) {
379 $input_for_real_end = '<input id="real_end_input" type="hidden" name="find_real_end" value="1" />';
380 // no backquote around this message
383 $input_for_real_end = $onclick = '';
386 // display the End button
387 PMA_displayTableNavigationOneButton(
389 _pgettext('Last page', 'End'),
390 @((ceil($unlim_num_rows / $_SESSION['tmp_user_values']['max_rows'])- 1) * $_SESSION['tmp_user_values']['max_rows']),
392 'onsubmit="return ' . (($_SESSION['tmp_user_values']['pos'] +
$_SESSION['tmp_user_values']['max_rows'] < $unlim_num_rows && $num_rows >= $_SESSION['tmp_user_values']['max_rows']) ?
'true' : 'false') . '"',
398 // show separator if pagination happen
399 if ($nbTotalPage > 1) {
400 echo '<td><div class="navigation_separator">|</div></td>';
404 <div
class="save_edited hide">
405 <input type
="submit" value
="<?php echo __('Save edited data'); ?>" />
406 <div
class="navigation_separator">|
</div
>
410 <div
class="restore_column hide">
411 <input type
="submit" value
="<?php echo __('Restore column order'); ?>" />
412 <div
class="navigation_separator">|
</div
>
416 <?php
// if displaying a VIEW, $unlim_num_rows could be zero because
417 // of $cfg['MaxExactCountViews']; in this case, avoid passing
418 // the 5th parameter to checkFormElementInRange()
419 // (this means we can't validate the upper limit ?>
420 <td
class="navigation_goto">
421 <form action
="sql.php" method
="post"
422 onsubmit
="return (checkFormElementInRange(this, 'session_max_rows', '<?php echo str_replace('\'', '\\\'', __('%d is not valid row number.')); ?>', 1) && checkFormElementInRange(this, 'pos', '<?php echo str_replace('\'', '\\\'', __('%d is not valid row number.')); ?>', 0<?php echo $unlim_num_rows > 0 ? ',' . $unlim_num_rows - 1 : ''; ?>))">
423 <?php
echo PMA_generate_common_hidden_inputs($db, $table); ?
>
424 <input type
="hidden" name
="sql_query" value
="<?php echo $html_sql_query; ?>" />
425 <input type
="hidden" name
="goto" value
="<?php echo $goto; ?>" />
426 <input type
="submit" name
="navig" <?php
echo ($GLOBALS['cfg']['AjaxEnable'] ?
' class="ajax"' : ''); ?
> value
="<?php echo __('Show'); ?> :" />
427 <?php
echo __('Start row') . ': ' . "\n"; ?
>
428 <input type
="text" name
="pos" size
="3" value
="<?php echo (($pos_next >= $unlim_num_rows) ? 0 : $pos_next); ?>" class="textfield" onfocus
="this.select()" />
429 <?php
echo __('Number of rows') . ': ' . "\n"; ?
>
430 <input type
="text" name
="session_max_rows" size
="3" value
="<?php echo (($_SESSION['tmp_user_values']['max_rows'] != 'all') ? $_SESSION['tmp_user_values']['max_rows'] : $GLOBALS['cfg']['MaxRows']); ?>" class="textfield" onfocus
="this.select()" />
432 if ($GLOBALS['cfg']['ShowDisplayDirection']) {
433 // Display mode (horizontal/vertical and repeat headers)
434 echo __('Mode') . ': ' . "\n";
436 'horizontal' => __('horizontal'),
437 'horizontalflipped' => __('horizontal (rotated headers)'),
438 'vertical' => __('vertical'));
439 echo PMA_generate_html_dropdown('disp_direction', $choices, $_SESSION['tmp_user_values']['disp_direction'], $id_for_direction_dropdown);
444 __('Headers every %s rows'),
445 '<input type="text" size="3" name="repeat_cells" value="' . $_SESSION['tmp_user_values']['repeat_cells'] . '" class="textfield" />'
451 <td
class="navigation_separator"></td
>
456 } // end of the 'PMA_displayTableNavigation()' function
460 * Displays the headers of the results table
462 * @param array &$is_display which elements to display
463 * @param array &$fields_meta the list of fields properties
464 * @param integer $fields_cnt the total number of fields returned by the SQL query
465 * @param array $analyzed_sql the analyzed query
466 * @param string $sort_expression sort expression
467 * @param string $sort_expression_nodirection sort expression without direction
468 * @param string $sort_direction sort direction
470 * @return boolean $clause_is_unique
472 * @global string $db the database name
473 * @global string $table the table name
474 * @global string $goto the URL to go back in case of errors
475 * @global string $sql_query the SQL query
476 * @global integer $num_rows the total number of rows returned by the
478 * @global array $vertical_display informations used with vertical display
483 * @see PMA_displayTable()
485 function PMA_displayTableHeaders(&$is_display, &$fields_meta, $fields_cnt = 0, $analyzed_sql = '', $sort_expression, $sort_expression_nodirection, $sort_direction)
487 global $db, $table, $goto;
488 global $sql_query, $num_rows;
489 global $vertical_display, $highlight_columns;
491 // required to generate sort links that will remember whether the
492 // "Show all" button has been clicked
493 $sql_md5 = md5($GLOBALS['sql_query']);
494 $session_max_rows = $_SESSION['tmp_user_values']['query'][$sql_md5]['max_rows'];
496 if ($analyzed_sql == '') {
497 $analyzed_sql = array();
500 // can the result be sorted?
501 if ($is_display['sort_lnk'] == '1') {
504 $unsorted_sql_query = $sql_query;
505 if (isset($analyzed_sql[0]['unsorted_query'])) {
506 $unsorted_sql_query = $analyzed_sql[0]['unsorted_query'];
508 // Handles the case of multiple clicks on a column's header
509 // which would add many spaces before "ORDER BY" in the
511 $unsorted_sql_query = trim($unsorted_sql_query);
513 // sorting by indexes, only if it makes sense (only one table ref)
514 if (isset($analyzed_sql)
515 && isset($analyzed_sql[0])
516 && isset($analyzed_sql[0]['querytype'])
517 && $analyzed_sql[0]['querytype'] == 'SELECT'
518 && isset($analyzed_sql[0]['table_ref'])
519 && count($analyzed_sql[0]['table_ref']) == 1
522 // grab indexes data:
523 $indexes = PMA_Index
::getFromTable($table, $db);
525 // do we have any index?
528 if ($_SESSION['tmp_user_values']['disp_direction'] == 'horizontal'
529 ||
$_SESSION['tmp_user_values']['disp_direction'] == 'horizontalflipped'
532 if ($is_display['edit_lnk'] != 'nn') {
535 if ($is_display['del_lnk'] != 'nn') {
538 if ($is_display['del_lnk'] != 'kp' && $is_display['del_lnk'] != 'nn') {
542 $span = $num_rows +
floor($num_rows/$_SESSION['tmp_user_values']['repeat_cells']) +
1;
545 echo '<form action="sql.php" method="post">' . "\n";
546 echo PMA_generate_common_hidden_inputs($db, $table);
547 echo __('Sort by key') . ': <select name="sql_query" class="autosubmit">' . "\n";
549 $local_order = (isset($sort_expression) ?
$sort_expression : '');
550 foreach ($indexes as $index) {
551 $asc_sort = '`' . implode('` ASC, `', array_keys($index->getColumns())) . '` ASC';
552 $desc_sort = '`' . implode('` DESC, `', array_keys($index->getColumns())) . '` DESC';
553 $used_index = $used_index ||
$local_order == $asc_sort ||
$local_order == $desc_sort;
554 echo '<option value="'
555 . htmlspecialchars($unsorted_sql_query . ' ORDER BY ' . $asc_sort)
556 . '"' . ($local_order == $asc_sort ?
' selected="selected"' : '')
557 . '>' . htmlspecialchars($index->getName()) . ' ('
558 . __('Ascending') . ')</option>';
559 echo '<option value="'
560 . htmlspecialchars($unsorted_sql_query . ' ORDER BY ' . $desc_sort)
561 . '"' . ($local_order == $desc_sort ?
' selected="selected"' : '')
562 . '>' . htmlspecialchars($index->getName()) . ' ('
563 . __('Descending') . ')</option>';
565 echo '<option value="' . htmlspecialchars($unsorted_sql_query) . '"' . ($used_index ?
'' : ' selected="selected"') . '>' . __('None') . '</option>';
566 echo '</select>' . "\n";
567 echo '<noscript><input type="submit" value="' . __('Go') . '" /></noscript>';
568 echo '</form>' . "\n";
574 // Output data needed for grid editing
575 echo '<input id="save_cells_at_once" type="hidden" value="' . $GLOBALS['cfg']['SaveCellsAtOnce'] . '" />';
576 echo '<div class="common_hidden_inputs">';
577 echo PMA_generate_common_hidden_inputs($db, $table);
579 // Output data needed for column reordering and show/hide column
580 if (PMA_isSelect()) {
581 // generate the column order, if it is set
582 $pmatable = new PMA_Table($GLOBALS['table'], $GLOBALS['db']);
583 $col_order = $pmatable->getUiProp(PMA_Table
::PROP_COLUMN_ORDER
);
585 echo '<input id="col_order" type="hidden" value="' . implode(',', $col_order) . '" />';
587 $col_visib = $pmatable->getUiProp(PMA_Table
::PROP_COLUMN_VISIB
);
589 echo '<input id="col_visib" type="hidden" value="' . implode(',', $col_visib) . '" />';
591 // generate table create time
592 if (! PMA_Table
::isView($GLOBALS['table'], $GLOBALS['db'])) {
593 echo '<input id="table_create_time" type="hidden" value="' .
594 PMA_Table
::sGetStatusInfo($GLOBALS['db'], $GLOBALS['table'], 'Create_time') . '" />';
599 $vertical_display['emptypre'] = 0;
600 $vertical_display['emptyafter'] = 0;
601 $vertical_display['textbtn'] = '';
603 // Display options (if we are not in print view)
604 if (! (isset($GLOBALS['printview']) && $GLOBALS['printview'] == '1')) {
605 echo '<form method="post" action="sql.php" name="displayOptionsForm" id="displayOptionsForm"';
606 if ($GLOBALS['cfg']['AjaxEnable']) {
607 echo ' class="ajax" ';
613 'sql_query' => $sql_query,
615 'display_options_form' => 1
617 echo PMA_generate_common_hidden_inputs($url_params);
619 PMA_generate_slider_effect('displayoptions', __('Options'));
622 echo '<div class="formelement">';
624 'P' => __('Partial texts'),
625 'F' => __('Full texts')
627 PMA_display_html_radio('display_text', $choices, $_SESSION['tmp_user_values']['display_text']);
630 // prepare full/partial text button or link
631 $url_params_full_text = array(
634 'sql_query' => $sql_query,
636 'full_text_button' => 1
639 if ($_SESSION['tmp_user_values']['display_text']=='F') {
640 // currently in fulltext mode so show the opposite link
641 $tmp_image_file = $GLOBALS['pmaThemeImage'] . 's_partialtext.png';
642 $tmp_txt = __('Partial texts');
643 $url_params_full_text['display_text'] = 'P';
645 $tmp_image_file = $GLOBALS['pmaThemeImage'] . 's_fulltext.png';
646 $tmp_txt = __('Full texts');
647 $url_params_full_text['display_text'] = 'F';
650 $tmp_image = '<img class="fulltext" src="' . $tmp_image_file . '" alt="' . $tmp_txt . '" title="' . $tmp_txt . '" />';
651 $tmp_url = 'sql.php' . PMA_generate_common_url($url_params_full_text);
652 $full_or_partial_text_link = PMA_linkOrButton($tmp_url, $tmp_image, array(), false);
653 unset($tmp_image_file, $tmp_txt, $tmp_url, $tmp_image);
656 if ($GLOBALS['cfgRelation']['relwork'] && $GLOBALS['cfgRelation']['displaywork']) {
657 echo '<div class="formelement">';
659 'K' => __('Relational key'),
660 'D' => __('Relational display column')
662 PMA_display_html_radio('relational_display', $choices, $_SESSION['tmp_user_values']['relational_display']);
666 echo '<div class="formelement">';
667 PMA_display_html_checkbox('display_binary', __('Show binary contents'), ! empty($_SESSION['tmp_user_values']['display_binary']), false);
669 PMA_display_html_checkbox('display_blob', __('Show BLOB contents'), ! empty($_SESSION['tmp_user_values']['display_blob']), false);
671 PMA_display_html_checkbox('display_binary_as_hex', __('Show binary contents as HEX'), ! empty($_SESSION['tmp_user_values']['display_binary_as_hex']), false);
674 // I would have preferred to name this "display_transformation".
675 // This is the only way I found to be able to keep this setting sticky
676 // per SQL query, and at the same time have a default that displays
677 // the transformations.
678 echo '<div class="formelement">';
679 PMA_display_html_checkbox('hide_transformation', __('Hide') . ' ' . __('Browser transformation'), ! empty($_SESSION['tmp_user_values']['hide_transformation']), false);
683 echo '<div class="formelement">';
685 'GEOM' => __('Geometry'),
686 'WKT' => __('Well Known Text'),
687 'WKB' => __('Well Known Binary')
689 PMA_display_html_radio('geometry_display', $choices, $_SESSION['tmp_user_values']['geometry_display']);
693 echo '<div class="clearfloat"></div>';
696 echo '<fieldset class="tblFooters">';
697 echo '<input type="submit" value="' . __('Go') . '" />';
703 // Start of form for multi-rows edit/delete/export
705 if ($is_display['del_lnk'] == 'dr' ||
$is_display['del_lnk'] == 'kp') {
706 echo '<form method="post" action="tbl_row_action.php" name="resultsForm" id="resultsForm"';
707 if ($GLOBALS['cfg']['AjaxEnable']) {
708 echo ' class="ajax" ';
711 echo PMA_generate_common_hidden_inputs($db, $table, 1);
712 echo '<input type="hidden" name="goto" value="sql.php" />' . "\n";
715 echo '<table id="table_results" class="data';
716 if ($GLOBALS['cfg']['AjaxEnable']) {
720 if ($_SESSION['tmp_user_values']['disp_direction'] == 'horizontal'
721 ||
$_SESSION['tmp_user_values']['disp_direction'] == 'horizontalflipped'
723 echo '<thead><tr>' . "\n";
726 // 1. Displays the full/partial text button (part 1)...
727 if ($_SESSION['tmp_user_values']['disp_direction'] == 'horizontal'
728 ||
$_SESSION['tmp_user_values']['disp_direction'] == 'horizontalflipped'
730 $colspan = ($is_display['edit_lnk'] != 'nn' && $is_display['del_lnk'] != 'nn')
734 $rowspan = ($is_display['edit_lnk'] != 'nn' && $is_display['del_lnk'] != 'nn')
739 // ... before the result table
740 if (($is_display['edit_lnk'] == 'nn' && $is_display['del_lnk'] == 'nn')
741 && $is_display['text_btn'] == '1'
743 $vertical_display['emptypre'] = ($is_display['edit_lnk'] != 'nn' && $is_display['del_lnk'] != 'nn') ?
4 : 0;
744 if ($_SESSION['tmp_user_values']['disp_direction'] == 'horizontal'
745 ||
$_SESSION['tmp_user_values']['disp_direction'] == 'horizontalflipped'
748 <th colspan
="<?php echo $fields_cnt; ?>"></th
>
752 // end horizontal/horizontalflipped mode
756 <th colspan
="<?php echo $num_rows + floor($num_rows/$_SESSION['tmp_user_values']['repeat_cells']) + 1; ?>"></th
>
759 } // end vertical mode
762 // ... at the left column of the result table header if possible
764 elseif (($GLOBALS['cfg']['RowActionLinks'] == 'left' ||
$GLOBALS['cfg']['RowActionLinks'] == 'both')
765 && $is_display['text_btn'] == '1'
767 $vertical_display['emptypre'] = ($is_display['edit_lnk'] != 'nn' && $is_display['del_lnk'] != 'nn') ?
4 : 0;
768 if ($_SESSION['tmp_user_values']['disp_direction'] == 'horizontal'
769 ||
$_SESSION['tmp_user_values']['disp_direction'] == 'horizontalflipped'
772 <th
<?php
echo $colspan; ?
>><?php
echo $full_or_partial_text_link;?
></th
>
774 // end horizontal/horizontalflipped mode
776 $vertical_display['textbtn'] = ' <th ' . $rowspan . ' valign="middle">' . "\n"
779 } // end vertical mode
782 // ... elseif no button, displays empty(ies) col(s) if required
783 elseif (($GLOBALS['cfg']['RowActionLinks'] == 'left' ||
$GLOBALS['cfg']['RowActionLinks'] == 'both')
784 && ($is_display['edit_lnk'] != 'nn' ||
$is_display['del_lnk'] != 'nn')) {
785 $vertical_display['emptypre'] = ($is_display['edit_lnk'] != 'nn' && $is_display['del_lnk'] != 'nn') ?
4 : 0;
786 if ($_SESSION['tmp_user_values']['disp_direction'] == 'horizontal'
787 ||
$_SESSION['tmp_user_values']['disp_direction'] == 'horizontalflipped'
790 <td
<?php
echo $colspan; ?
>></td
>
792 // end horizontal/horizontalfipped mode
794 $vertical_display['textbtn'] = ' <td' . $rowspan . '></td>' . "\n";
795 } // end vertical mode
798 // ... elseif display an empty column if the actions links are disabled to match the rest of the table
799 elseif ($GLOBALS['cfg']['RowActionLinks'] == 'none'
800 && ($_SESSION['tmp_user_values']['disp_direction'] == 'horizontal' ||
$_SESSION['tmp_user_values']['disp_direction'] == 'horizontalflipped')
805 // 2. Displays the fields' name
806 // 2.0 If sorting links should be used, checks if the query is a "JOIN"
807 // statement (see 2.1.3)
809 // 2.0.1 Prepare Display column comments if enabled ($GLOBALS['cfg']['ShowBrowseComments']).
810 // Do not show comments, if using horizontalflipped mode, because of space usage
811 if ($GLOBALS['cfg']['ShowBrowseComments']
812 && $_SESSION['tmp_user_values']['disp_direction'] != 'horizontalflipped'
814 $comments_map = array();
815 if (isset($analyzed_sql[0]) && is_array($analyzed_sql[0])) {
816 foreach ($analyzed_sql[0]['table_ref'] as $tbl) {
817 $tb = $tbl['table_true_name'];
818 $comments_map[$tb] = PMA_getComments($db, $tb);
824 if ($GLOBALS['cfgRelation']['commwork'] && $GLOBALS['cfgRelation']['mimework'] && $GLOBALS['cfg']['BrowseMIME'] && ! $_SESSION['tmp_user_values']['hide_transformation']) {
825 include_once './libraries/transformations.lib.php';
826 $GLOBALS['mime_map'] = PMA_getMIME($db, $table);
829 // See if we have to highlight any header fields of a WHERE query.
830 // Uses SQL-Parser results.
831 $highlight_columns = array();
832 if (isset($analyzed_sql) && isset($analyzed_sql[0])
833 && isset($analyzed_sql[0]['where_clause_identifiers'])
837 if (isset($analyzed_sql[0]['where_clause_identifiers']) && is_array($analyzed_sql[0]['where_clause_identifiers'])) {
838 foreach ($analyzed_sql[0]['where_clause_identifiers'] AS $wci_nr => $wci) {
839 $highlight_columns[$wci] = 'true';
844 if (PMA_isSelect()) {
845 // prepare to get the column order, if available
846 $pmatable = new PMA_Table($GLOBALS['table'], $GLOBALS['db']);
847 $col_order = $pmatable->getUiProp(PMA_Table
::PROP_COLUMN_ORDER
);
848 $col_visib = $pmatable->getUiProp(PMA_Table
::PROP_COLUMN_VISIB
);
854 for ($j = 0; $j < $fields_cnt; $j++
) {
855 // assign $i with appropriate column order
856 $i = $col_order ?
$col_order[$j] : $j;
857 // See if this column should get highlight because it's used in the
859 if (isset($highlight_columns[$fields_meta[$i]->name
]) ||
isset($highlight_columns[PMA_backquote($fields_meta[$i]->name
)])) {
860 $condition_field = true;
862 $condition_field = false;
865 // 2.0 Prepare comment-HTML-wrappers for each row, if defined/enabled.
866 if (isset($comments_map)
867 && isset($comments_map[$fields_meta[$i]->table
])
868 && isset($comments_map[$fields_meta[$i]->table
][$fields_meta[$i]->name
])
870 $comments = '<span class="tblcomment">' . htmlspecialchars($comments_map[$fields_meta[$i]->table
][$fields_meta[$i]->name
]) . '</span>';
875 // 2.1 Results can be sorted
876 if ($is_display['sort_lnk'] == '1') {
878 // 2.1.1 Checks if the table name is required; it's the case
879 // for a query with a "JOIN" statement and if the column
880 // isn't aliased, or in queries like
881 // SELECT `1`.`master_field` , `2`.`master_field`
882 // FROM `PMA_relation` AS `1` , `PMA_relation` AS `2`
884 if (isset($fields_meta[$i]->table
) && strlen($fields_meta[$i]->table
)) {
885 $sort_tbl = PMA_backquote($fields_meta[$i]->table
) . '.';
890 // 2.1.2 Checks if the current column is used to sort the
892 // the orgname member does not exist for all MySQL versions
893 // but if found, it's the one on which to sort
894 $name_to_use_in_sort = $fields_meta[$i]->name
;
896 if (isset($fields_meta[$i]->orgname
) && strlen($fields_meta[$i]->orgname
)) {
897 $name_to_use_in_sort = $fields_meta[$i]->orgname
;
900 // $name_to_use_in_sort might contain a space due to
901 // formatting of function expressions like "COUNT(name )"
902 // so we remove the space in this situation
903 $name_to_use_in_sort = str_replace(' )', ')', $name_to_use_in_sort);
905 if (empty($sort_expression)) {
908 // Field name may be preceded by a space, or any number
909 // of characters followed by a dot (tablename.fieldname)
910 // so do a direct comparison for the sort expression;
911 // this avoids problems with queries like
912 // "SELECT id, count(id)..." and clicking to sort
913 // on id or on count(id).
914 // Another query to test this:
915 // SELECT p.*, FROM_UNIXTIME(p.temps) FROM mytable AS p
916 // (and try clicking on each column's header twice)
917 if (! empty($sort_tbl)
918 && strpos($sort_expression_nodirection, $sort_tbl) === false
919 && strpos($sort_expression_nodirection, '(') === false
921 $sort_expression_nodirection = $sort_tbl . $sort_expression_nodirection;
923 $is_in_sort = (str_replace('`', '', $sort_tbl) . $name_to_use_in_sort == str_replace('`', '', $sort_expression_nodirection) ?
true : false);
925 // 2.1.3 Check the field name for a bracket.
926 // If it contains one, it's probably a function column
927 // like 'COUNT(`field`)'
928 // It still might be a column name of a view. See bug #3383711
930 if (strpos($name_to_use_in_sort, '(') !== false && ! $is_orgname) {
931 $sort_order = "\n" . 'ORDER BY ' . $name_to_use_in_sort . ' ';
933 $sort_order = "\n" . 'ORDER BY ' . $sort_tbl . PMA_backquote($name_to_use_in_sort) . ' ';
935 unset($name_to_use_in_sort);
938 // 2.1.4 Do define the sorting URL
940 // patch #455484 ("Smart" order)
941 $GLOBALS['cfg']['Order'] = strtoupper($GLOBALS['cfg']['Order']);
942 if ($GLOBALS['cfg']['Order'] === 'SMART') {
943 $sort_order .= (preg_match('@time|date@i', $fields_meta[$i]->type
)) ?
'DESC' : 'ASC';
945 $sort_order .= $GLOBALS['cfg']['Order'];
948 } elseif ('DESC' == $sort_direction) {
949 $sort_order .= ' ASC';
950 $order_img = ' ' . PMA_getImage('s_desc.png', __('Descending'), array('class' => "soimg$i", 'title' => ''));
951 $order_img .= ' ' . PMA_getImage('s_asc.png', __('Ascending'), array('class' => "soimg$i hide", 'title' => ''));
953 $sort_order .= ' DESC';
954 $order_img = ' ' . PMA_getImage('s_asc.png', __('Ascending'), array('class' => "soimg$i", 'title' => ''));
955 $order_img .= ' ' . PMA_getImage('s_desc.png', __('Descending'), array('class' => "soimg$i hide", 'title' => ''));
958 if (preg_match('@(.*)([[:space:]](LIMIT (.*)|PROCEDURE (.*)|FOR UPDATE|LOCK IN SHARE MODE))@is', $unsorted_sql_query, $regs3)) {
959 $sorted_sql_query = $regs3[1] . $sort_order . $regs3[2];
961 $sorted_sql_query = $unsorted_sql_query . $sort_order;
963 $_url_params = array(
966 'sql_query' => $sorted_sql_query,
967 'session_max_rows' => $session_max_rows
969 $order_url = 'sql.php' . PMA_generate_common_url($_url_params);
971 // 2.1.5 Displays the sorting URL
972 // enable sort order swapping for image
973 $order_link_params = array();
974 if (isset($order_img) && $order_img!='') {
975 if (strstr($order_img, 'asc')) {
976 $order_link_params['onmouseover'] = "$('.soimg$i').toggle()";
977 $order_link_params['onmouseout'] = "$('.soimg$i').toggle()";
978 } elseif (strstr($order_img, 'desc')) {
979 $order_link_params['onmouseover'] = "$('.soimg$i').toggle()";
980 $order_link_params['onmouseout'] = "$('.soimg$i').toggle()";
983 if ($GLOBALS['cfg']['HeaderFlipType'] == 'auto') {
984 if (PMA_USR_BROWSER_AGENT
== 'IE') {
985 $GLOBALS['cfg']['HeaderFlipType'] = 'css';
987 $GLOBALS['cfg']['HeaderFlipType'] = 'fake';
990 if ($_SESSION['tmp_user_values']['disp_direction'] == 'horizontalflipped'
991 && $GLOBALS['cfg']['HeaderFlipType'] == 'css'
993 $order_link_params['style'] = 'direction: ltr; writing-mode: tb-rl;';
995 $order_link_params['title'] = __('Sort');
996 $order_link_content = ($_SESSION['tmp_user_values']['disp_direction'] == 'horizontalflipped' && $GLOBALS['cfg']['HeaderFlipType'] == 'fake' ?
PMA_flipstring(htmlspecialchars($fields_meta[$i]->name
), "<br />\n") : htmlspecialchars($fields_meta[$i]->name
));
997 $order_link = PMA_linkOrButton($order_url, $order_link_content . $order_img, $order_link_params, false, true);
999 if ($_SESSION['tmp_user_values']['disp_direction'] == 'horizontal'
1000 ||
$_SESSION['tmp_user_values']['disp_direction'] == 'horizontalflipped'
1003 $th_class = array();
1004 $th_class[] = 'draggable';
1005 if ($col_visib && !$col_visib[$j]) {
1006 $th_class[] = 'hide';
1008 if ($condition_field) {
1009 $th_class[] = 'condition';
1011 $th_class[] = 'column_heading';
1012 if ($GLOBALS['cfg']['BrowsePointerEnable'] == true) {
1013 $th_class[] = 'pointer';
1015 if ($GLOBALS['cfg']['BrowseMarkerEnable'] == true) {
1016 $th_class[] = 'marker';
1018 echo ' class="' . implode(' ', $th_class) . '"';
1020 if ($_SESSION['tmp_user_values']['disp_direction'] == 'horizontalflipped') {
1021 echo ' valign="bottom"';
1023 echo '>' . $order_link . $comments . '</th>';
1025 $vertical_display['desc'][] = ' <th '
1026 . 'class="draggable'
1027 . ($condition_field ?
' condition' : '')
1029 . $order_link . $comments . ' </th>' . "\n";
1032 // 2.2 Results can't be sorted
1034 if ($_SESSION['tmp_user_values']['disp_direction'] == 'horizontal'
1035 ||
$_SESSION['tmp_user_values']['disp_direction'] == 'horizontalflipped'
1038 $th_class = array();
1039 $th_class[] = 'draggable';
1040 if ($col_visib && !$col_visib[$j]) {
1041 $th_class[] = 'hide';
1043 if ($condition_field) {
1044 $th_class[] = 'condition';
1046 echo ' class="' . implode(' ', $th_class) . '"';
1047 if ($_SESSION['tmp_user_values']['disp_direction'] == 'horizontalflipped') {
1048 echo ' valign="bottom"';
1050 if ($_SESSION['tmp_user_values']['disp_direction'] == 'horizontalflipped'
1051 && $GLOBALS['cfg']['HeaderFlipType'] == 'css'
1053 echo ' style="direction: ltr; writing-mode: tb-rl;"';
1056 if ($_SESSION['tmp_user_values']['disp_direction'] == 'horizontalflipped'
1057 && $GLOBALS['cfg']['HeaderFlipType'] == 'fake'
1059 echo PMA_flipstring(htmlspecialchars($fields_meta[$i]->name
), '<br />');
1061 echo htmlspecialchars($fields_meta[$i]->name
);
1063 echo "\n" . $comments . '</th>';
1065 $vertical_display['desc'][] = ' <th '
1066 . 'class="draggable'
1067 . ($condition_field ?
' condition"' : '')
1069 . ' ' . htmlspecialchars($fields_meta[$i]->name
) . "\n"
1070 . $comments . ' </th>';
1074 // 3. Displays the needed checkboxes at the right
1075 // column of the result table header if possible and required...
1076 if (($GLOBALS['cfg']['RowActionLinks'] == 'right' ||
$GLOBALS['cfg']['RowActionLinks'] == 'both')
1077 && ($is_display['edit_lnk'] != 'nn' ||
$is_display['del_lnk'] != 'nn')
1078 && $is_display['text_btn'] == '1'
1080 $vertical_display['emptyafter'] = ($is_display['edit_lnk'] != 'nn' && $is_display['del_lnk'] != 'nn') ?
4 : 1;
1081 if ($_SESSION['tmp_user_values']['disp_direction'] == 'horizontal'
1082 ||
$_SESSION['tmp_user_values']['disp_direction'] == 'horizontalflipped'
1086 <th
<?php
echo $colspan; ?
>><?php
echo $full_or_partial_text_link;?
>
1089 // end horizontal/horizontalflipped mode
1091 $vertical_display['textbtn'] = ' <th ' . $rowspan . ' valign="middle">' . "\n"
1094 } // end vertical mode
1097 // ... elseif no button, displays empty columns if required
1098 // (unless coming from Browse mode print view)
1099 elseif (($GLOBALS['cfg']['RowActionLinks'] == 'left' ||
$GLOBALS['cfg']['RowActionLinks'] == 'both')
1100 && ($is_display['edit_lnk'] == 'nn' && $is_display['del_lnk'] == 'nn')
1101 && (! $GLOBALS['is_header_sent'])
1103 $vertical_display['emptyafter'] = ($is_display['edit_lnk'] != 'nn' && $is_display['del_lnk'] != 'nn') ?
4 : 1;
1104 if ($_SESSION['tmp_user_values']['disp_direction'] == 'horizontal'
1105 ||
$_SESSION['tmp_user_values']['disp_direction'] == 'horizontalflipped'
1109 <td
<?php
echo $colspan; ?
>></td
>
1111 // end horizontal/horizontalflipped mode
1113 $vertical_display['textbtn'] = ' <td' . $rowspan . '></td>' . "\n";
1114 } // end vertical mode
1117 if ($_SESSION['tmp_user_values']['disp_direction'] == 'horizontal'
1118 ||
$_SESSION['tmp_user_values']['disp_direction'] == 'horizontalflipped'
1127 } // end of the 'PMA_displayTableHeaders()' function
1131 * Prepares the display for a value
1133 * @param string $class class of table cell
1134 * @param bool $condition_field whether to add CSS class condition
1135 * @param string $value value to display
1137 * @return string the td
1139 function PMA_buildValueDisplay($class, $condition_field, $value)
1141 return '<td align="left"' . ' class="' . $class . ($condition_field ?
' condition' : '') . '">' . $value . '</td>';
1145 * Prepares the display for a null value
1147 * @param string $class class of table cell
1148 * @param bool $condition_field whether to add CSS class condition
1150 * @return string the td
1152 function PMA_buildNullDisplay($class, $condition_field)
1154 // the null class is needed for grid editing
1155 return '<td align="right"' . ' class="' . $class . ($condition_field ?
' condition' : '') . ' null"><i>NULL</i></td>';
1159 * Prepares the display for an empty value
1161 * @param string $class class of table cell
1162 * @param bool $condition_field whether to add CSS class condition
1163 * @param object $meta the meta-information about this field
1164 * @param string $align cell allignment
1166 * @return string the td
1168 function PMA_buildEmptyDisplay($class, $condition_field, $meta, $align = '')
1170 $nowrap = ' nowrap';
1171 return '<td ' . $align . ' class="' . PMA_addClass($class, $condition_field, $meta, $nowrap) . '"></td>';
1175 * Adds the relavant classes.
1177 * @param string $class class of table cell
1178 * @param bool $condition_field whether to add CSS class condition
1179 * @param object $meta the meta-information about this field
1180 * @param string $nowrap avoid wrapping
1181 * @param bool $is_field_truncated is field truncated (display ...)
1182 * @param string $transform_function transformation function
1183 * @param string $default_function default transformation function
1185 * @return string the list of classes
1187 function PMA_addClass($class, $condition_field, $meta, $nowrap, $is_field_truncated = false, $transform_function = '', $default_function = '')
1189 // Define classes to be added to this data field based on the type of data
1191 if (strpos($meta->flags
, 'enum') !== false) {
1192 $enum_class = ' enum';
1196 if (strpos($meta->flags
, 'set') !== false) {
1197 $set_class = ' set';
1201 if (strpos($meta->type
, 'bit') !== false) {
1202 $bit_class = ' bit';
1205 $mime_type_class = '';
1206 if (isset($meta->mimetype
)) {
1207 $mime_type_class = ' ' . preg_replace('/\//', '_', $meta->mimetype
);
1210 $result = $class . ($condition_field ?
' condition' : '') . $nowrap
1211 . ' ' . ($is_field_truncated ?
' truncated' : '')
1212 . ($transform_function != $default_function ?
' transformed' : '')
1213 . $enum_class . $set_class . $bit_class . $mime_type_class;
1218 * Displays the body of the results table
1220 * @param integer &$dt_result the link id associated to the query which results have
1222 * @param array &$is_display which elements to display
1223 * @param array $map the list of relations
1224 * @param array $analyzed_sql the analyzed query
1226 * @return boolean always true
1228 * @global string $db the database name
1229 * @global string $table the table name
1230 * @global string $goto the URL to go back in case of errors
1231 * @global string $sql_query the SQL query
1232 * @global array $fields_meta the list of fields properties
1233 * @global integer $fields_cnt the total number of fields returned by
1235 * @global array $vertical_display informations used with vertical display
1237 * @global array $highlight_columns column names to highlight
1238 * @global array $row current row data
1242 * @see PMA_displayTable()
1244 function PMA_displayTableBody(&$dt_result, &$is_display, $map, $analyzed_sql)
1246 global $db, $table, $goto;
1247 global $sql_query, $fields_meta, $fields_cnt;
1248 global $vertical_display, $highlight_columns;
1249 global $row; // mostly because of browser transformations, to make the row-data accessible in a plugin
1251 $url_sql_query = $sql_query;
1253 // query without conditions to shorten URLs when needed, 200 is just
1254 // guess, it should depend on remaining URL length
1256 if (isset($analyzed_sql)
1257 && isset($analyzed_sql[0])
1258 && isset($analyzed_sql[0]['querytype'])
1259 && $analyzed_sql[0]['querytype'] == 'SELECT'
1260 && strlen($sql_query) > 200
1263 $url_sql_query = 'SELECT ';
1264 if (isset($analyzed_sql[0]['queryflags']['distinct'])) {
1265 $url_sql_query .= ' DISTINCT ';
1267 $url_sql_query .= $analyzed_sql[0]['select_expr_clause'];
1268 if (!empty($analyzed_sql[0]['from_clause'])) {
1269 $url_sql_query .= ' FROM ' . $analyzed_sql[0]['from_clause'];
1273 if (! is_array($map)) {
1277 $vertical_display['edit'] = array();
1278 $vertical_display['copy'] = array();
1279 $vertical_display['delete'] = array();
1280 $vertical_display['data'] = array();
1281 $vertical_display['row_delete'] = array();
1282 // name of the class added to all grid editable elements
1283 $grid_edit_class = 'grid_edit';
1285 // prepare to get the column order, if available
1286 if (PMA_isSelect()) {
1287 $pmatable = new PMA_Table($GLOBALS['table'], $GLOBALS['db']);
1288 $col_order = $pmatable->getUiProp(PMA_Table
::PROP_COLUMN_ORDER
);
1289 $col_visib = $pmatable->getUiProp(PMA_Table
::PROP_COLUMN_VISIB
);
1295 // Correction University of Virginia 19991216 in the while below
1296 // Previous code assumed that all tables have keys, specifically that
1297 // the phpMyAdmin GUI should support row delete/edit only for such
1299 // Although always using keys is arguably the prescribed way of
1300 // defining a relational table, it is not required. This will in
1301 // particular be violated by the novice.
1302 // We want to encourage phpMyAdmin usage by such novices. So the code
1303 // below has been changed to conditionally work as before when the
1304 // table being displayed has one or more keys; but to display
1305 // delete/edit options correctly for tables without keys.
1308 while ($row = PMA_DBI_fetch_row($dt_result)) {
1309 // "vertical display" mode stuff
1310 if ($row_no != 0 && $_SESSION['tmp_user_values']['repeat_cells'] != 0
1311 && !($row_no %
$_SESSION['tmp_user_values']['repeat_cells'])
1312 && ($_SESSION['tmp_user_values']['disp_direction'] == 'horizontal'
1313 ||
$_SESSION['tmp_user_values']['disp_direction'] == 'horizontalflipped')
1316 if ($vertical_display['emptypre'] > 0) {
1317 echo ' <th colspan="' . $vertical_display['emptypre'] . '">' . "\n"
1318 .' </th>' . "\n";
1319 } else if ($GLOBALS['cfg']['RowActionLinks'] == 'none') {
1320 echo ' <th></th>' . "\n";
1323 foreach ($vertical_display['desc'] as $val) {
1327 if ($vertical_display['emptyafter'] > 0) {
1328 echo ' <th colspan="' . $vertical_display['emptyafter'] . '">' . "\n"
1329 .' </th>' . "\n";
1331 echo '</tr>' . "\n";
1334 $alternating_color_class = ($odd_row ?
'odd' : 'even');
1335 $odd_row = ! $odd_row;
1337 if ($_SESSION['tmp_user_values']['disp_direction'] == 'horizontal'
1338 ||
$_SESSION['tmp_user_values']['disp_direction'] == 'horizontalflipped'
1340 // pointer code part
1341 echo '<tr class="' . $alternating_color_class . '">';
1345 // 1. Prepares the row
1346 // 1.1 Results from a "SELECT" statement -> builds the
1347 // WHERE clause to use in links (a unique key if possible)
1349 * @todo $where_clause could be empty, for example a table
1350 * with only one field and it's a BLOB; in this case,
1351 * avoid to display the delete and edit links
1353 list($where_clause, $clause_is_unique, $condition_array) = PMA_getUniqueCondition($dt_result, $fields_cnt, $fields_meta, $row);
1354 $where_clause_html = urlencode($where_clause);
1356 // 1.2 Defines the URLs for the modify/delete link(s)
1358 if ($is_display['edit_lnk'] != 'nn' ||
$is_display['del_lnk'] != 'nn') {
1359 // We need to copy the value or else the == 'both' check will always return true
1361 if ($GLOBALS['cfg']['PropertiesIconic'] === 'both') {
1362 $iconic_spacer = '<div class="nowrap">';
1364 $iconic_spacer = '';
1367 // 1.2.1 Modify link(s)
1368 if ($is_display['edit_lnk'] == 'ur') { // update row case
1369 $_url_params = array(
1372 'where_clause' => $where_clause,
1373 'clause_is_unique' => $clause_is_unique,
1374 'sql_query' => $url_sql_query,
1375 'goto' => 'sql.php',
1377 $edit_url = 'tbl_change.php' . PMA_generate_common_url($_url_params +
array('default_action' => 'update'));
1378 $copy_url = 'tbl_change.php' . PMA_generate_common_url($_url_params +
array('default_action' => 'insert'));
1380 $edit_str = PMA_getIcon('b_edit.png', __('Edit'));
1381 $copy_str = PMA_getIcon('b_insrow.png', __('Copy'));
1383 // Class definitions required for grid editing jQuery scripts
1384 $edit_anchor_class = "edit_row_anchor";
1385 if ( $clause_is_unique == 0) {
1386 $edit_anchor_class .= ' nonunique';
1390 // 1.2.2 Delete/Kill link(s)
1391 if ($is_display['del_lnk'] == 'dr') { // delete row case
1392 $_url_params = array(
1395 'sql_query' => $url_sql_query,
1396 'message_to_show' => __('The row has been deleted'),
1397 'goto' => (empty($goto) ?
'tbl_sql.php' : $goto),
1399 $lnk_goto = 'sql.php' . PMA_generate_common_url($_url_params, 'text');
1401 $del_query = 'DELETE FROM ' . PMA_backquote($db) . '.' . PMA_backquote($table)
1402 . ' WHERE ' . $where_clause . ($clause_is_unique ?
'' : ' LIMIT 1');
1404 $_url_params = array(
1407 'sql_query' => $del_query,
1408 'message_to_show' => __('The row has been deleted'),
1409 'goto' => $lnk_goto,
1411 $del_url = 'sql.php' . PMA_generate_common_url($_url_params);
1413 $js_conf = 'DELETE FROM ' . PMA_jsFormat($db) . '.' . PMA_jsFormat($table)
1414 . ' WHERE ' . PMA_jsFormat($where_clause, false)
1415 . ($clause_is_unique ?
'' : ' LIMIT 1');
1416 $del_str = PMA_getIcon('b_drop.png', __('Delete'));
1417 } elseif ($is_display['del_lnk'] == 'kp') { // kill process case
1419 $_url_params = array(
1422 'sql_query' => $url_sql_query,
1423 'goto' => 'main.php',
1425 $lnk_goto = 'sql.php' . PMA_generate_common_url($_url_params, 'text');
1427 $_url_params = array(
1429 'sql_query' => 'KILL ' . $row[0],
1430 'goto' => $lnk_goto,
1432 $del_url = 'sql.php' . PMA_generate_common_url($_url_params);
1433 $del_query = 'KILL ' . $row[0];
1434 $js_conf = 'KILL ' . $row[0];
1435 $del_str = PMA_getIcon('b_drop.png', __('Kill'));
1438 // 1.3 Displays the links at left if required
1439 if (($GLOBALS['cfg']['RowActionLinks'] == 'left' ||
$GLOBALS['cfg']['RowActionLinks'] == 'both')
1440 && ($_SESSION['tmp_user_values']['disp_direction'] == 'horizontal'
1441 ||
$_SESSION['tmp_user_values']['disp_direction'] == 'horizontalflipped')
1443 if (! isset($js_conf)) {
1446 echo PMA_generateCheckboxAndLinks('left', $del_url, $is_display, $row_no, $where_clause, $where_clause_html, $condition_array, $del_query, 'l', $edit_url, $copy_url, $edit_anchor_class, $edit_str, $copy_str, $del_str, $js_conf);
1447 } elseif (($GLOBALS['cfg']['RowActionLinks'] == 'none')
1448 && ($_SESSION['tmp_user_values']['disp_direction'] == 'horizontal'
1449 ||
$_SESSION['tmp_user_values']['disp_direction'] == 'horizontalflipped')
1451 if (! isset($js_conf)) {
1454 echo PMA_generateCheckboxAndLinks('none', $del_url, $is_display, $row_no, $where_clause, $where_clause_html, $condition_array, $del_query, 'l', $edit_url, $copy_url, $edit_anchor_class, $edit_str, $copy_str, $del_str, $js_conf);
1458 // 2. Displays the rows' values
1460 for ($j = 0; $j < $fields_cnt; ++
$j) {
1461 // assign $i with appropriate column order
1462 $i = $col_order ?
$col_order[$j] : $j;
1464 $meta = $fields_meta[$i];
1465 $not_null_class = $meta->not_null ?
'not_null' : '';
1466 $relation_class = isset($map[$meta->name
]) ?
'relation' : '';
1467 $hide_class = ($col_visib && !$col_visib[$j] &&
1468 // hide per <td> only if the display direction is not vertical
1469 $_SESSION['tmp_user_values']['disp_direction'] != 'vertical') ?
'hide' : '';
1470 // handle datetime-related class, for grid editing
1471 if (substr($meta->type
, 0, 9) == 'timestamp' ||
$meta->type
== 'datetime') {
1472 $field_type_class = 'datetimefield';
1473 } else if ($meta->type
== 'date') {
1474 $field_type_class = 'datefield';
1476 $field_type_class = '';
1479 $is_field_truncated = false;
1480 //If the previous column had blob data, we need to reset the class
1481 // to $inline_edit_class
1482 $class = 'data ' . $grid_edit_class . ' ' . $not_null_class . ' ' . $relation_class . ' ' . $hide_class . ' ' . $field_type_class; //' ' . $alternating_color_class .
1484 // See if this column should get highlight because it's used in the
1486 if (isset($highlight_columns) && (isset($highlight_columns[$meta->name
]) ||
isset($highlight_columns[PMA_backquote($meta->name
)]))) {
1487 $condition_field = true;
1489 $condition_field = false;
1492 if ($_SESSION['tmp_user_values']['disp_direction'] == 'vertical' && (! isset($GLOBALS['printview']) ||
($GLOBALS['printview'] != '1'))) {
1493 // the row number corresponds to a data row, not HTML table row
1494 $class .= ' row_' . $row_no;
1495 if ($GLOBALS['cfg']['BrowsePointerEnable'] == true) {
1496 $class .= ' vpointer';
1498 if ($GLOBALS['cfg']['BrowseMarkerEnable'] == true) {
1499 $class .= ' vmarker';
1503 // Wrap MIME-transformations. [MIME]
1504 $default_function = 'default_function'; // default_function
1505 $transform_function = $default_function;
1506 $transform_options = array();
1508 if ($GLOBALS['cfgRelation']['mimework'] && $GLOBALS['cfg']['BrowseMIME']) {
1510 if (isset($GLOBALS['mime_map'][$meta->name
]['mimetype']) && isset($GLOBALS['mime_map'][$meta->name
]['transformation']) && !empty($GLOBALS['mime_map'][$meta->name
]['transformation'])) {
1511 $include_file = PMA_securePath($GLOBALS['mime_map'][$meta->name
]['transformation']);
1513 if (file_exists('./libraries/transformations/' . $include_file)) {
1514 $transformfunction_name = str_replace('.inc.php', '', $GLOBALS['mime_map'][$meta->name
]['transformation']);
1516 include_once './libraries/transformations/' . $include_file;
1518 if (function_exists('PMA_transformation_' . $transformfunction_name)) {
1519 $transform_function = 'PMA_transformation_' . $transformfunction_name;
1520 $transform_options = PMA_transformation_getOptions((isset($GLOBALS['mime_map'][$meta->name
]['transformation_options']) ?
$GLOBALS['mime_map'][$meta->name
]['transformation_options'] : ''));
1521 $meta->mimetype
= str_replace('_', '/', $GLOBALS['mime_map'][$meta->name
]['mimetype']);
1523 } // end if file_exists
1524 } // end if transformation is set
1525 } // end if mime/transformation works.
1527 $_url_params = array(
1530 'where_clause' => $where_clause,
1531 'transform_key' => $meta->name
,
1534 if (! empty($sql_query)) {
1535 $_url_params['sql_query'] = $url_sql_query;
1538 $transform_options['wrapper_link'] = PMA_generate_common_url($_url_params);
1541 if ($meta->numeric == 1) {
1543 // if two fields have the same name (this is possible
1544 // with self-join queries, for example), using $meta->name
1545 // will show both fields NULL even if only one is NULL,
1546 // so use the $pointer
1548 if (! isset($row[$i]) ||
is_null($row[$i])) {
1549 $vertical_display['data'][$row_no][$i] = PMA_buildNullDisplay($class, $condition_field);
1550 } elseif ($row[$i] != '') {
1552 $nowrap = ' nowrap';
1553 $where_comparison = ' = ' . $row[$i];
1555 $vertical_display['data'][$row_no][$i] = '<td align="right"' . PMA_prepare_row_data($class, $condition_field, $analyzed_sql, $meta, $map, $row[$i], $transform_function, $default_function, $nowrap, $where_comparison, $transform_options, $is_field_truncated);
1557 $vertical_display['data'][$row_no][$i] = PMA_buildEmptyDisplay($class, $condition_field, $meta, 'align="right"');
1562 } elseif (stristr($meta->type
, 'BLOB')) {
1563 // PMA_mysql_fetch_fields returns BLOB in place of
1564 // TEXT fields type so we have to ensure it's really a BLOB
1565 $field_flags = PMA_DBI_field_flags($dt_result, $i);
1567 if (stristr($field_flags, 'BINARY')) {
1568 // remove 'grid_edit' from $class as we can't edit binary data.
1569 $class = str_replace('grid_edit', '', $class);
1571 if (! isset($row[$i]) ||
is_null($row[$i])) {
1572 $vertical_display['data'][$row_no][$i] = PMA_buildNullDisplay($class, $condition_field);
1574 // for blobstreaming
1575 // if valid BS reference exists
1576 if (PMA_BS_IsPBMSReference($row[$i], $db)) {
1577 $blobtext = PMA_BS_CreateReferenceLink($row[$i], $db);
1579 $blobtext = PMA_handle_non_printable_contents('BLOB', (isset($row[$i]) ?
$row[$i] : ''), $transform_function, $transform_options, $default_function, $meta, $_url_params);
1582 $vertical_display['data'][$row_no][$i] = PMA_buildValueDisplay($class, $condition_field, $blobtext);
1587 if (! isset($row[$i]) ||
is_null($row[$i])) {
1588 $vertical_display['data'][$row_no][$i] = PMA_buildNullDisplay($class, $condition_field);
1589 } elseif ($row[$i] != '') {
1590 // if a transform function for blob is set, none of these replacements will be made
1591 if (PMA_strlen($row[$i]) > $GLOBALS['cfg']['LimitChars'] && $_SESSION['tmp_user_values']['display_text'] == 'P') {
1592 $row[$i] = PMA_substr($row[$i], 0, $GLOBALS['cfg']['LimitChars']) . '...';
1593 $is_field_truncated = true;
1595 // displays all space characters, 4 space
1596 // characters for tabulations and <cr>/<lf>
1597 $row[$i] = ($default_function != $transform_function ?
$transform_function($row[$i], $transform_options, $meta) : $default_function($row[$i], array(), $meta));
1599 if ($is_field_truncated) {
1600 $class .= ' truncated';
1603 $vertical_display['data'][$row_no][$i] = PMA_buildValueDisplay($class, $condition_field, $row[$i]);
1605 $vertical_display['data'][$row_no][$i] = PMA_buildEmptyDisplay($class, $condition_field, $meta);
1609 } elseif ($meta->type
== 'geometry') {
1611 // Remove 'grid_edit' from $class as we do not allow to inline-edit geometry data.
1612 $class = str_replace('grid_edit', '', $class);
1614 if (! isset($row[$i]) ||
is_null($row[$i])) {
1615 $vertical_display['data'][$row_no][$i] = PMA_buildNullDisplay($class, $condition_field);
1616 } elseif ($row[$i] != '') {
1617 // Display as [GEOMETRY - (size)]
1618 if ('GEOM' == $_SESSION['tmp_user_values']['geometry_display']) {
1619 $geometry_text = PMA_handle_non_printable_contents(
1620 'GEOMETRY', (isset($row[$i]) ?
$row[$i] : ''), $transform_function,
1621 $transform_options, $default_function, $meta
1623 $vertical_display['data'][$row_no][$i] = PMA_buildValueDisplay(
1624 $class, $condition_field, $geometry_text
1627 // Display in Well Known Text(WKT) format.
1628 } elseif ('WKT' == $_SESSION['tmp_user_values']['geometry_display']) {
1629 $where_comparison = ' = ' . $row[$i];
1631 // Convert to WKT format
1632 $wktval = PMA_asWKT($row[$i]);
1634 if (PMA_strlen($wktval) > $GLOBALS['cfg']['LimitChars']
1635 && $_SESSION['tmp_user_values']['display_text'] == 'P'
1637 $wktval = PMA_substr($wktval, 0, $GLOBALS['cfg']['LimitChars']) . '...';
1638 $is_field_truncated = true;
1641 $vertical_display['data'][$row_no][$i] = '<td ' . PMA_prepare_row_data(
1642 $class, $condition_field, $analyzed_sql, $meta, $map, $wktval, $transform_function,
1643 $default_function, '', $where_comparison, $transform_options, $is_field_truncated
1646 // Display in Well Known Binary(WKB) format.
1648 if ($_SESSION['tmp_user_values']['display_binary']) {
1649 $where_comparison = ' = ' . $row[$i];
1651 if ($_SESSION['tmp_user_values']['display_binary_as_hex']
1652 && PMA_contains_nonprintable_ascii($row[$i])
1654 $wkbval = PMA_substr(bin2hex($row[$i]), 8);
1656 $wkbval = htmlspecialchars(PMA_replace_binary_contents($row[$i]));
1659 if (PMA_strlen($wkbval) > $GLOBALS['cfg']['LimitChars']
1660 && $_SESSION['tmp_user_values']['display_text'] == 'P'
1662 $wkbval = PMA_substr($wkbval, 0, $GLOBALS['cfg']['LimitChars']) . '...';
1663 $is_field_truncated = true;
1666 $vertical_display['data'][$row_no][$i] = '<td ' . PMA_prepare_row_data(
1667 $class, $condition_field, $analyzed_sql, $meta, $map, $wkbval, $transform_function,
1668 $default_function, '', $where_comparison, $transform_options, $is_field_truncated
1671 $wkbval = PMA_handle_non_printable_contents(
1672 'BINARY', $row[$i], $transform_function, $transform_options, $default_function, $meta, $_url_params
1674 $vertical_display['data'][$row_no][$i] = PMA_buildValueDisplay($class, $condition_field, $wkbval);
1678 $vertical_display['data'][$row_no][$i] = PMA_buildEmptyDisplay($class, $condition_field, $meta);
1681 // n o t n u m e r i c a n d n o t B L O B
1683 if (! isset($row[$i]) ||
is_null($row[$i])) {
1684 $vertical_display['data'][$row_no][$i] = PMA_buildNullDisplay($class, $condition_field);
1685 } elseif ($row[$i] != '') {
1686 // support blanks in the key
1687 $relation_id = $row[$i];
1689 // Cut all fields to $GLOBALS['cfg']['LimitChars']
1690 // (unless it's a link-type transformation)
1691 if (PMA_strlen($row[$i]) > $GLOBALS['cfg']['LimitChars'] && $_SESSION['tmp_user_values']['display_text'] == 'P' && !strpos($transform_function, 'link') === true) {
1692 $row[$i] = PMA_substr($row[$i], 0, $GLOBALS['cfg']['LimitChars']) . '...';
1693 $is_field_truncated = true;
1696 // displays special characters from binaries
1697 $field_flags = PMA_DBI_field_flags($dt_result, $i);
1699 if (isset($meta->_type
) && $meta->_type
=== MYSQLI_TYPE_BIT
) {
1700 $row[$i] = PMA_printable_bit_value($row[$i], $meta->length
);
1701 // some results of PROCEDURE ANALYSE() are reported as
1702 // being BINARY but they are quite readable,
1703 // so don't treat them as BINARY
1704 } elseif (stristr($field_flags, 'BINARY') && $meta->type
== 'string' && !(isset($GLOBALS['is_analyse']) && $GLOBALS['is_analyse'])) {
1705 if ($_SESSION['tmp_user_values']['display_binary']) {
1706 // user asked to see the real contents of BINARY
1708 if ($_SESSION['tmp_user_values']['display_binary_as_hex'] && PMA_contains_nonprintable_ascii($row[$i])) {
1709 $row[$i] = bin2hex($row[$i]);
1711 $row[$i] = htmlspecialchars(PMA_replace_binary_contents($row[$i]));
1714 // we show the BINARY message and field's size
1715 // (or maybe use a transformation)
1716 $row[$i] = PMA_handle_non_printable_contents('BINARY', $row[$i], $transform_function, $transform_options, $default_function, $meta, $_url_params);
1722 $vertical_display['data'][$row_no][$i] = PMA_buildValueDisplay($class, $condition_field, $row[$i]);
1724 // transform functions may enable no-wrapping:
1725 $function_nowrap = $transform_function . '_nowrap';
1726 $bool_nowrap = (($default_function != $transform_function && function_exists($function_nowrap)) ?
$function_nowrap($transform_options) : false);
1728 // do not wrap if date field type
1729 $nowrap = ((preg_match('@DATE|TIME@i', $meta->type
) ||
$bool_nowrap) ?
' nowrap' : '');
1730 $where_comparison = ' = \'' . PMA_sqlAddSlashes($row[$i]) . '\'';
1731 $vertical_display['data'][$row_no][$i] = '<td ' . PMA_prepare_row_data($class, $condition_field, $analyzed_sql, $meta, $map, $row[$i], $transform_function, $default_function, $nowrap, $where_comparison, $transform_options, $is_field_truncated);
1734 $vertical_display['data'][$row_no][$i] = PMA_buildEmptyDisplay($class, $condition_field, $meta);
1738 // output stored cell
1739 if ($_SESSION['tmp_user_values']['disp_direction'] == 'horizontal'
1740 ||
$_SESSION['tmp_user_values']['disp_direction'] == 'horizontalflipped'
1742 echo $vertical_display['data'][$row_no][$i];
1745 if (isset($vertical_display['rowdata'][$i][$row_no])) {
1746 $vertical_display['rowdata'][$i][$row_no] .= $vertical_display['data'][$row_no][$i];
1748 $vertical_display['rowdata'][$i][$row_no] = $vertical_display['data'][$row_no][$i];
1752 // 3. Displays the modify/delete links on the right if required
1753 if (($GLOBALS['cfg']['RowActionLinks'] == 'right' ||
$GLOBALS['cfg']['RowActionLinks'] == 'both')
1754 && ($_SESSION['tmp_user_values']['disp_direction'] == 'horizontal'
1755 ||
$_SESSION['tmp_user_values']['disp_direction'] == 'horizontalflipped')
1757 if (! isset($js_conf)) {
1760 echo PMA_generateCheckboxAndLinks('right', $del_url, $is_display, $row_no, $where_clause, $where_clause_html, $condition_array, $del_query, 'r', $edit_url, $copy_url, $edit_anchor_class, $edit_str, $copy_str, $del_str, $js_conf);
1763 if ($_SESSION['tmp_user_values']['disp_direction'] == 'horizontal'
1764 ||
$_SESSION['tmp_user_values']['disp_direction'] == 'horizontalflipped'
1771 // 4. Gather links of del_urls and edit_urls in an array for later
1773 if (! isset($vertical_display['edit'][$row_no])) {
1774 $vertical_display['edit'][$row_no] = '';
1775 $vertical_display['copy'][$row_no] = '';
1776 $vertical_display['delete'][$row_no] = '';
1777 $vertical_display['row_delete'][$row_no] = '';
1779 $vertical_class = ' row_' . $row_no;
1780 if ($GLOBALS['cfg']['BrowsePointerEnable'] == true) {
1781 $vertical_class .= ' vpointer';
1783 if ($GLOBALS['cfg']['BrowseMarkerEnable'] == true) {
1784 $vertical_class .= ' vmarker';
1787 if (!empty($del_url) && $is_display['del_lnk'] != 'kp') {
1788 $vertical_display['row_delete'][$row_no] .= PMA_generateCheckboxForMulti($del_url, $is_display, $row_no, $where_clause_html, $condition_array, $del_query, '[%_PMA_CHECKBOX_DIR_%]', $alternating_color_class . $vertical_class);
1790 unset($vertical_display['row_delete'][$row_no]);
1793 if (isset($edit_url)) {
1794 $vertical_display['edit'][$row_no] .= PMA_generateEditLink($edit_url, $alternating_color_class . ' ' . $edit_anchor_class . $vertical_class, $edit_str, $where_clause, $where_clause_html);
1796 unset($vertical_display['edit'][$row_no]);
1799 if (isset($copy_url)) {
1800 $vertical_display['copy'][$row_no] .= PMA_generateCopyLink($copy_url, $copy_str, $where_clause, $where_clause_html, $alternating_color_class . $vertical_class);
1802 unset($vertical_display['copy'][$row_no]);
1805 if (isset($del_url)) {
1806 if (! isset($js_conf)) {
1809 $vertical_display['delete'][$row_no] .= PMA_generateDeleteLink($del_url, $del_str, $js_conf, $alternating_color_class . $vertical_class);
1811 unset($vertical_display['delete'][$row_no]);
1814 echo (($_SESSION['tmp_user_values']['disp_direction'] == 'horizontal' ||
$_SESSION['tmp_user_values']['disp_direction'] == 'horizontalflipped') ?
"\n" : '');
1818 // this is needed by PMA_displayTable() to generate the proper param
1819 // in the multi-edit and multi-delete form
1820 return $clause_is_unique;
1821 } // end of the 'PMA_displayTableBody()' function
1825 * Do display the result table with the vertical direction mode.
1827 * @return boolean always true
1829 * @global array $vertical_display the information to display
1833 * @see PMA_displayTable()
1835 function PMA_displayVerticalTable()
1837 global $vertical_display;
1839 // Displays "multi row delete" link at top if required
1840 if ($GLOBALS['cfg']['RowActionLinks'] != 'right'
1841 && is_array($vertical_display['row_delete'])
1842 && (count($vertical_display['row_delete']) > 0 ||
!empty($vertical_display['textbtn']))
1845 if ($GLOBALS['cfg']['RowActionLinks'] == 'none') {
1846 // if we are not showing the RowActionLinks, then we need to show the Multi-Row-Action checkboxes
1847 echo '<th></th>' . "\n";
1849 echo $vertical_display['textbtn'];
1850 $cell_displayed = 0;
1851 foreach ($vertical_display['row_delete'] as $val) {
1852 if (($cell_displayed != 0) && ($_SESSION['tmp_user_values']['repeat_cells'] != 0) && !($cell_displayed %
$_SESSION['tmp_user_values']['repeat_cells'])) {
1854 (($is_display['edit_lnk'] != 'nn' && $is_display['del_lnk'] != 'nn') ?
' rowspan="4"' : '') .
1857 echo str_replace('[%_PMA_CHECKBOX_DIR_%]', '_left', $val);
1860 echo '</tr>' . "\n";
1863 // Displays "edit" link at top if required
1864 if (($GLOBALS['cfg']['RowActionLinks'] == 'left' ||
$GLOBALS['cfg']['RowActionLinks'] == 'both')
1865 && is_array($vertical_display['edit'])
1866 && (count($vertical_display['edit']) > 0 ||
!empty($vertical_display['textbtn']))
1869 if (! is_array($vertical_display['row_delete'])) {
1870 echo $vertical_display['textbtn'];
1872 foreach ($vertical_display['edit'] as $val) {
1875 echo '</tr>' . "\n";
1878 // Displays "copy" link at top if required
1879 if (($GLOBALS['cfg']['RowActionLinks'] == 'left' ||
$GLOBALS['cfg']['RowActionLinks'] == 'both')
1880 && is_array($vertical_display['copy'])
1881 && (count($vertical_display['copy']) > 0 ||
!empty($vertical_display['textbtn']))
1884 if (! is_array($vertical_display['row_delete'])) {
1885 echo $vertical_display['textbtn'];
1887 foreach ($vertical_display['copy'] as $val) {
1890 echo '</tr>' . "\n";
1893 // Displays "delete" link at top if required
1894 if (($GLOBALS['cfg']['RowActionLinks'] == 'left' ||
$GLOBALS['cfg']['RowActionLinks'] == 'both')
1895 && is_array($vertical_display['delete'])
1896 && (count($vertical_display['delete']) > 0 ||
!empty($vertical_display['textbtn']))
1899 if (! is_array($vertical_display['edit']) && ! is_array($vertical_display['row_delete'])) {
1900 echo $vertical_display['textbtn'];
1902 foreach ($vertical_display['delete'] as $val) {
1905 echo '</tr>' . "\n";
1908 if (PMA_isSelect()) {
1909 // prepare to get the column order, if available
1910 $pmatable = new PMA_Table($GLOBALS['table'], $GLOBALS['db']);
1911 $col_order = $pmatable->getUiProp(PMA_Table
::PROP_COLUMN_ORDER
);
1912 $col_visib = $pmatable->getUiProp(PMA_Table
::PROP_COLUMN_VISIB
);
1919 foreach ($vertical_display['desc'] AS $j => $val) {
1920 // assign appropriate key with current column order
1921 $key = $col_order ?
$col_order[$j] : $j;
1923 echo '<tr' . (($col_visib && !$col_visib[$j]) ?
' class="hide"' : '') . '>' . "\n";
1926 $cell_displayed = 0;
1927 foreach ($vertical_display['rowdata'][$key] as $subval) {
1928 if (($cell_displayed != 0) && ($_SESSION['tmp_user_values']['repeat_cells'] != 0) and !($cell_displayed %
$_SESSION['tmp_user_values']['repeat_cells'])) {
1936 echo '</tr>' . "\n";
1939 // Displays "multi row delete" link at bottom if required
1940 if (($GLOBALS['cfg']['RowActionLinks'] == 'right' ||
$GLOBALS['cfg']['RowActionLinks'] == 'both')
1941 && is_array($vertical_display['row_delete'])
1942 && (count($vertical_display['row_delete']) > 0 ||
!empty($vertical_display['textbtn']))
1945 echo $vertical_display['textbtn'];
1946 $cell_displayed = 0;
1947 foreach ($vertical_display['row_delete'] as $val) {
1948 if (($cell_displayed != 0) && ($_SESSION['tmp_user_values']['repeat_cells'] != 0) && !($cell_displayed %
$_SESSION['tmp_user_values']['repeat_cells'])) {
1950 (($is_display['edit_lnk'] != 'nn' && $is_display['del_lnk'] != 'nn') ?
' rowspan="4"' : '') .
1954 echo str_replace('[%_PMA_CHECKBOX_DIR_%]', '_right', $val);
1957 echo '</tr>' . "\n";
1960 // Displays "edit" link at bottom if required
1961 if (($GLOBALS['cfg']['RowActionLinks'] == 'right' ||
$GLOBALS['cfg']['RowActionLinks'] == 'both')
1962 && is_array($vertical_display['edit'])
1963 && (count($vertical_display['edit']) > 0 ||
!empty($vertical_display['textbtn']))
1966 if (! is_array($vertical_display['row_delete'])) {
1967 echo $vertical_display['textbtn'];
1969 foreach ($vertical_display['edit'] as $val) {
1972 echo '</tr>' . "\n";
1975 // Displays "copy" link at bottom if required
1976 if (($GLOBALS['cfg']['RowActionLinks'] == 'right' ||
$GLOBALS['cfg']['RowActionLinks'] == 'both')
1977 && is_array($vertical_display['copy'])
1978 && (count($vertical_display['copy']) > 0 ||
!empty($vertical_display['textbtn']))
1981 if (! is_array($vertical_display['row_delete'])) {
1982 echo $vertical_display['textbtn'];
1984 foreach ($vertical_display['copy'] as $val) {
1987 echo '</tr>' . "\n";
1990 // Displays "delete" link at bottom if required
1991 if (($GLOBALS['cfg']['RowActionLinks'] == 'right' ||
$GLOBALS['cfg']['RowActionLinks'] == 'both')
1992 && is_array($vertical_display['delete'])
1993 && (count($vertical_display['delete']) > 0 ||
!empty($vertical_display['textbtn']))
1996 if (! is_array($vertical_display['edit']) && ! is_array($vertical_display['row_delete'])) {
1997 echo $vertical_display['textbtn'];
1999 foreach ($vertical_display['delete'] as $val) {
2002 echo '</tr>' . "\n";
2006 } // end of the 'PMA_displayVerticalTable' function
2009 * Checks the posted options for viewing query resutls
2010 * and sets appropriate values in the session.
2012 * @todo make maximum remembered queries configurable
2013 * @todo move/split into SQL class!?
2014 * @todo currently this is called twice unnecessary
2015 * @todo ignore LIMIT and ORDER in query!?
2019 function PMA_displayTable_checkConfigParams()
2021 $sql_md5 = md5($GLOBALS['sql_query']);
2023 $_SESSION['tmp_user_values']['query'][$sql_md5]['sql'] = $GLOBALS['sql_query'];
2025 if (PMA_isValid($_REQUEST['disp_direction'], array('horizontal', 'vertical', 'horizontalflipped'))) {
2026 $_SESSION['tmp_user_values']['query'][$sql_md5]['disp_direction'] = $_REQUEST['disp_direction'];
2027 unset($_REQUEST['disp_direction']);
2028 } elseif (empty($_SESSION['tmp_user_values']['query'][$sql_md5]['disp_direction'])) {
2029 $_SESSION['tmp_user_values']['query'][$sql_md5]['disp_direction'] = $GLOBALS['cfg']['DefaultDisplay'];
2032 if (PMA_isValid($_REQUEST['repeat_cells'], 'numeric')) {
2033 $_SESSION['tmp_user_values']['query'][$sql_md5]['repeat_cells'] = $_REQUEST['repeat_cells'];
2034 unset($_REQUEST['repeat_cells']);
2035 } elseif (empty($_SESSION['tmp_user_values']['query'][$sql_md5]['repeat_cells'])) {
2036 $_SESSION['tmp_user_values']['query'][$sql_md5]['repeat_cells'] = $GLOBALS['cfg']['RepeatCells'];
2039 // as this is a form value, the type is always string so we cannot
2040 // use PMA_isValid($_REQUEST['session_max_rows'], 'integer')
2041 if ((PMA_isValid($_REQUEST['session_max_rows'], 'numeric')
2042 && (int) $_REQUEST['session_max_rows'] == $_REQUEST['session_max_rows'])
2043 ||
$_REQUEST['session_max_rows'] == 'all'
2045 $_SESSION['tmp_user_values']['query'][$sql_md5]['max_rows'] = $_REQUEST['session_max_rows'];
2046 unset($_REQUEST['session_max_rows']);
2047 } elseif (empty($_SESSION['tmp_user_values']['query'][$sql_md5]['max_rows'])) {
2048 $_SESSION['tmp_user_values']['query'][$sql_md5]['max_rows'] = $GLOBALS['cfg']['MaxRows'];
2051 if (PMA_isValid($_REQUEST['pos'], 'numeric')) {
2052 $_SESSION['tmp_user_values']['query'][$sql_md5]['pos'] = $_REQUEST['pos'];
2053 unset($_REQUEST['pos']);
2054 } elseif (empty($_SESSION['tmp_user_values']['query'][$sql_md5]['pos'])) {
2055 $_SESSION['tmp_user_values']['query'][$sql_md5]['pos'] = 0;
2058 if (PMA_isValid($_REQUEST['display_text'], array('P', 'F'))) {
2059 $_SESSION['tmp_user_values']['query'][$sql_md5]['display_text'] = $_REQUEST['display_text'];
2060 unset($_REQUEST['display_text']);
2061 } elseif (empty($_SESSION['tmp_user_values']['query'][$sql_md5]['display_text'])) {
2062 $_SESSION['tmp_user_values']['query'][$sql_md5]['display_text'] = 'P';
2065 if (PMA_isValid($_REQUEST['relational_display'], array('K', 'D'))) {
2066 $_SESSION['tmp_user_values']['query'][$sql_md5]['relational_display'] = $_REQUEST['relational_display'];
2067 unset($_REQUEST['relational_display']);
2068 } elseif (empty($_SESSION['tmp_user_values']['query'][$sql_md5]['relational_display'])) {
2069 $_SESSION['tmp_user_values']['query'][$sql_md5]['relational_display'] = 'K';
2072 if (PMA_isValid($_REQUEST['geometry_display'], array('WKT', 'WKB', 'GEOM'))) {
2073 $_SESSION['tmp_user_values']['query'][$sql_md5]['geometry_display'] = $_REQUEST['geometry_display'];
2074 unset($_REQUEST['geometry_display']);
2075 } elseif (empty($_SESSION['tmp_user_values']['query'][$sql_md5]['geometry_display'])) {
2076 $_SESSION['tmp_user_values']['query'][$sql_md5]['geometry_display'] = 'GEOM';
2079 if (isset($_REQUEST['display_binary'])) {
2080 $_SESSION['tmp_user_values']['query'][$sql_md5]['display_binary'] = true;
2081 unset($_REQUEST['display_binary']);
2082 } elseif (isset($_REQUEST['display_options_form'])) {
2083 // we know that the checkbox was unchecked
2084 unset($_SESSION['tmp_user_values']['query'][$sql_md5]['display_binary']);
2085 } elseif (isset($_REQUEST['full_text_button'])) {
2086 // do nothing to keep the value that is there in the session
2088 // selected by default because some operations like OPTIMIZE TABLE
2089 // and all queries involving functions return "binary" contents,
2090 // according to low-level field flags
2091 $_SESSION['tmp_user_values']['query'][$sql_md5]['display_binary'] = true;
2094 if (isset($_REQUEST['display_binary_as_hex'])) {
2095 $_SESSION['tmp_user_values']['query'][$sql_md5]['display_binary_as_hex'] = true;
2096 unset($_REQUEST['display_binary_as_hex']);
2097 } elseif (isset($_REQUEST['display_options_form'])) {
2098 // we know that the checkbox was unchecked
2099 unset($_SESSION['tmp_user_values']['query'][$sql_md5]['display_binary_as_hex']);
2100 } elseif (isset($_REQUEST['full_text_button'])) {
2101 // do nothing to keep the value that is there in the session
2103 // display_binary_as_hex config option
2104 if (isset($GLOBALS['cfg']['DisplayBinaryAsHex']) && true === $GLOBALS['cfg']['DisplayBinaryAsHex']) {
2105 $_SESSION['tmp_user_values']['query'][$sql_md5]['display_binary_as_hex'] = true;
2109 if (isset($_REQUEST['display_blob'])) {
2110 $_SESSION['tmp_user_values']['query'][$sql_md5]['display_blob'] = true;
2111 unset($_REQUEST['display_blob']);
2112 } elseif (isset($_REQUEST['display_options_form'])) {
2113 // we know that the checkbox was unchecked
2114 unset($_SESSION['tmp_user_values']['query'][$sql_md5]['display_blob']);
2117 if (isset($_REQUEST['hide_transformation'])) {
2118 $_SESSION['tmp_user_values']['query'][$sql_md5]['hide_transformation'] = true;
2119 unset($_REQUEST['hide_transformation']);
2120 } elseif (isset($_REQUEST['display_options_form'])) {
2121 // we know that the checkbox was unchecked
2122 unset($_SESSION['tmp_user_values']['query'][$sql_md5]['hide_transformation']);
2125 // move current query to the last position, to be removed last
2126 // so only least executed query will be removed if maximum remembered queries
2128 $tmp = $_SESSION['tmp_user_values']['query'][$sql_md5];
2129 unset($_SESSION['tmp_user_values']['query'][$sql_md5]);
2130 $_SESSION['tmp_user_values']['query'][$sql_md5] = $tmp;
2132 // do not exceed a maximum number of queries to remember
2133 if (count($_SESSION['tmp_user_values']['query']) > 10) {
2134 array_shift($_SESSION['tmp_user_values']['query']);
2135 //echo 'deleting one element ...';
2138 // populate query configuration
2139 $_SESSION['tmp_user_values']['display_text'] = $_SESSION['tmp_user_values']['query'][$sql_md5]['display_text'];
2140 $_SESSION['tmp_user_values']['relational_display'] = $_SESSION['tmp_user_values']['query'][$sql_md5]['relational_display'];
2141 $_SESSION['tmp_user_values']['geometry_display'] = $_SESSION['tmp_user_values']['query'][$sql_md5]['geometry_display'];
2142 $_SESSION['tmp_user_values']['display_binary'] = isset($_SESSION['tmp_user_values']['query'][$sql_md5]['display_binary']) ?
true : false;
2143 $_SESSION['tmp_user_values']['display_binary_as_hex'] = isset($_SESSION['tmp_user_values']['query'][$sql_md5]['display_binary_as_hex']) ?
true : false;
2144 $_SESSION['tmp_user_values']['display_blob'] = isset($_SESSION['tmp_user_values']['query'][$sql_md5]['display_blob']) ?
true : false;
2145 $_SESSION['tmp_user_values']['hide_transformation'] = isset($_SESSION['tmp_user_values']['query'][$sql_md5]['hide_transformation']) ?
true : false;
2146 $_SESSION['tmp_user_values']['pos'] = $_SESSION['tmp_user_values']['query'][$sql_md5]['pos'];
2147 $_SESSION['tmp_user_values']['max_rows'] = $_SESSION['tmp_user_values']['query'][$sql_md5]['max_rows'];
2148 $_SESSION['tmp_user_values']['repeat_cells'] = $_SESSION['tmp_user_values']['query'][$sql_md5]['repeat_cells'];
2149 $_SESSION['tmp_user_values']['disp_direction'] = $_SESSION['tmp_user_values']['query'][$sql_md5]['disp_direction'];
2154 var_dump($_SESSION['tmp_user_values']);
2160 * Displays a table of results returned by a SQL query.
2161 * This function is called by the "sql.php" script.
2163 * @param integer &$dt_result the link id associated to the query which results have
2165 * @param array &$the_disp_mode the display mode
2166 * @param array $analyzed_sql the analyzed query
2168 * @global string $db the database name
2169 * @global string $table the table name
2170 * @global string $goto the URL to go back in case of errors
2171 * @global string $sql_query the current SQL query
2172 * @global integer $num_rows the total number of rows returned by the
2174 * @global integer $unlim_num_rows the total number of rows returned by the
2175 * SQL query without any programmatically
2176 * appended "LIMIT" clause
2177 * @global array $fields_meta the list of fields properties
2178 * @global integer $fields_cnt the total number of fields returned by
2180 * @global array $vertical_display informations used with vertical display
2182 * @global array $highlight_columns column names to highlight
2183 * @global array $cfgRelation the relation settings
2184 * @global array $showtable table definitions
2188 * @see PMA_showMessage(), PMA_setDisplayMode(),
2189 * PMA_displayTableNavigation(), PMA_displayTableHeaders(),
2190 * PMA_displayTableBody(), PMA_displayResultsOperations()
2194 function PMA_displayTable(&$dt_result, &$the_disp_mode, $analyzed_sql)
2196 global $db, $table, $goto;
2197 global $sql_query, $num_rows, $unlim_num_rows, $fields_meta, $fields_cnt;
2198 global $vertical_display, $highlight_columns;
2199 global $cfgRelation;
2202 // why was this called here? (already called from sql.php)
2203 //PMA_displayTable_checkConfigParams();
2206 * @todo move this to a central place
2207 * @todo for other future table types
2209 $is_innodb = (isset($showtable['Type']) && $showtable['Type'] == 'InnoDB');
2212 && ! isset($analyzed_sql[0]['queryflags']['union'])
2213 && ! isset($analyzed_sql[0]['table_ref'][1]['table_name'])
2214 && (empty($analyzed_sql[0]['where_clause']) ||
$analyzed_sql[0]['where_clause'] == '1 ')
2216 // "j u s t b r o w s i n g"
2218 $after_count = PMA_showHint(PMA_sanitize(__('May be approximate. See [a@./Documentation.html#faq3_11@Documentation]FAQ 3.11[/a]')));
2224 // 1. ----- Prepares the work -----
2226 // 1.1 Gets the informations about which functionalities should be
2229 $is_display = PMA_setDisplayMode($the_disp_mode, $total);
2231 // 1.2 Defines offsets for the next and previous pages
2232 if ($is_display['nav_bar'] == '1') {
2233 if ($_SESSION['tmp_user_values']['max_rows'] == 'all') {
2237 $pos_next = $_SESSION['tmp_user_values']['pos'] +
$_SESSION['tmp_user_values']['max_rows'];
2238 $pos_prev = $_SESSION['tmp_user_values']['pos'] - $_SESSION['tmp_user_values']['max_rows'];
2239 if ($pos_prev < 0) {
2245 // 1.3 Find the sort expression
2247 // we need $sort_expression and $sort_expression_nodirection
2248 // even if there are many table references
2249 if (! empty($analyzed_sql[0]['order_by_clause'])) {
2250 $sort_expression = trim(str_replace(' ', ' ', $analyzed_sql[0]['order_by_clause']));
2252 * Get rid of ASC|DESC
2254 preg_match('@(.*)([[:space:]]*(ASC|DESC))@si', $sort_expression, $matches);
2255 $sort_expression_nodirection = isset($matches[1]) ?
trim($matches[1]) : $sort_expression;
2256 $sort_direction = isset($matches[2]) ?
trim($matches[2]) : '';
2259 $sort_expression = $sort_expression_nodirection = $sort_direction = '';
2262 // 1.4 Prepares display of first and last value of the sorted column
2264 if (! empty($sort_expression_nodirection)) {
2265 if (strpos($sort_expression_nodirection, '.') === false) {
2266 $sort_table = $table;
2267 $sort_column = $sort_expression_nodirection;
2269 list($sort_table, $sort_column) = explode('.', $sort_expression_nodirection);
2271 $sort_table = PMA_unQuote($sort_table);
2272 $sort_column = PMA_unQuote($sort_column);
2273 // find the sorted column index in row result
2274 // (this might be a multi-table query)
2275 $sorted_column_index = false;
2276 foreach ($fields_meta as $key => $meta) {
2277 if ($meta->table
== $sort_table && $meta->name
== $sort_column) {
2278 $sorted_column_index = $key;
2282 if ($sorted_column_index !== false) {
2283 // fetch first row of the result set
2284 $row = PMA_DBI_fetch_row($dt_result);
2285 // initializing default arguments
2286 $default_function = 'default_function';
2287 $transform_function = $default_function;
2288 $transform_options = array();
2289 // check for non printable sorted row data
2290 $meta = $fields_meta[$sorted_column_index];
2291 if (stristr($meta->type
, 'BLOB') ||
$meta->type
== 'geometry') {
2292 $column_for_first_row = PMA_handle_non_printable_contents($meta->type
, $row[$sorted_column_index], $transform_function, $transform_options, $default_function, $meta, null);
2294 $column_for_first_row = $row[$sorted_column_index];
2296 $column_for_first_row = strtoupper(substr($column_for_first_row, 0, $GLOBALS['cfg']['LimitChars']));
2297 // fetch last row of the result set
2298 PMA_DBI_data_seek($dt_result, $num_rows - 1);
2299 $row = PMA_DBI_fetch_row($dt_result);
2300 // check for non printable sorted row data
2301 $meta = $fields_meta[$sorted_column_index];
2302 if (stristr($meta->type
, 'BLOB') ||
$meta->type
== 'geometry') {
2303 $column_for_last_row = PMA_handle_non_printable_contents($meta->type
, $row[$sorted_column_index], $transform_function, $transform_options, $default_function, $meta, null);
2305 $column_for_last_row = $row[$sorted_column_index];
2307 $column_for_last_row = strtoupper(substr($column_for_last_row, 0, $GLOBALS['cfg']['LimitChars']));
2308 // reset to first row for the loop in PMA_displayTableBody()
2309 PMA_DBI_data_seek($dt_result, 0);
2310 // we could also use here $sort_expression_nodirection
2311 $sorted_column_message = ' [' . htmlspecialchars($sort_column) . ': <strong>' . htmlspecialchars($column_for_first_row) . ' - ' . htmlspecialchars($column_for_last_row) . '</strong>]';
2312 unset($row, $column_for_first_row, $column_for_last_row, $meta, $default_function, $transform_function, $transform_options);
2314 unset($sorted_column_index, $sort_table, $sort_column);
2317 // 2. ----- Displays the top of the page -----
2319 // 2.1 Displays a messages with position informations
2320 if ($is_display['nav_bar'] == '1' && isset($pos_next)) {
2321 if (isset($unlim_num_rows) && $unlim_num_rows != $total) {
2322 $selectstring = ', ' . $unlim_num_rows . ' ' . __('in query');
2327 if (! empty($analyzed_sql[0]['limit_clause'])) {
2328 $limit_data = PMA_analyzeLimitClause($analyzed_sql[0]['limit_clause']);
2329 $first_shown_rec = $limit_data['start'];
2330 if ($limit_data['length'] < $total) {
2331 $last_shown_rec = $limit_data['start'] +
$limit_data['length'] - 1;
2333 $last_shown_rec = $limit_data['start'] +
$total - 1;
2335 } elseif ($_SESSION['tmp_user_values']['max_rows'] == 'all' ||
$pos_next > $total) {
2336 $first_shown_rec = $_SESSION['tmp_user_values']['pos'];
2337 $last_shown_rec = $total - 1;
2339 $first_shown_rec = $_SESSION['tmp_user_values']['pos'];
2340 $last_shown_rec = $pos_next - 1;
2343 if (PMA_Table
::isView($db, $table)
2344 && $total == $GLOBALS['cfg']['MaxExactCountViews']
2346 $message = PMA_Message
::notice(__('This view has at least this number of rows. Please refer to %sdocumentation%s.'));
2347 $message->addParam('[a@./Documentation.html#cfg_MaxExactCount@_blank]');
2348 $message->addParam('[/a]');
2349 $message_view_warning = PMA_showHint($message);
2351 $message_view_warning = false;
2354 $message = PMA_Message
::success(__('Showing rows'));
2355 $message->addMessage($first_shown_rec);
2356 if ($message_view_warning) {
2357 $message->addMessage('...', ' - ');
2358 $message->addMessage($message_view_warning);
2359 $message->addMessage('(');
2361 $message->addMessage($last_shown_rec, ' - ');
2362 $message->addMessage(' (');
2363 $message->addMessage($pre_count . PMA_formatNumber($total, 0));
2364 $message->addString(__('total'));
2365 if (!empty($after_count)) {
2366 $message->addMessage($after_count);
2368 $message->addMessage($selectstring, '');
2369 $message->addMessage(', ', '');
2372 $messagge_qt = PMA_Message
::notice(__('Query took %01.4f sec'));
2373 $messagge_qt->addParam($GLOBALS['querytime']);
2375 $message->addMessage($messagge_qt, '');
2376 $message->addMessage(')', '');
2378 $message->addMessage(isset($sorted_column_message) ?
$sorted_column_message : '', '');
2380 PMA_showMessage($message, $sql_query, 'success');
2382 } elseif (! isset($GLOBALS['printview']) ||
$GLOBALS['printview'] != '1') {
2383 PMA_showMessage(__('Your SQL query has been executed successfully'), $sql_query, 'success');
2386 // 2.3 Displays the navigation bars
2387 if (! strlen($table)) {
2388 if (isset($analyzed_sql[0]['query_type'])
2389 && $analyzed_sql[0]['query_type'] == 'SELECT'
2391 // table does not always contain a real table name,
2392 // for example in MySQL 5.0.x, the query SHOW STATUS
2393 // returns STATUS as a table name
2394 $table = $fields_meta[0]->table
;
2400 if ($is_display['nav_bar'] == '1' && empty($analyzed_sql[0]['limit_clause'])) {
2401 PMA_displayTableNavigation($pos_next, $pos_prev, $sql_query, 'top_direction_dropdown');
2403 } elseif (! isset($GLOBALS['printview']) ||
$GLOBALS['printview'] != '1') {
2404 echo "\n" . '<br /><br />' . "\n";
2407 // 2b ----- Get field references from Database -----
2408 // (see the 'relation' configuration variable)
2415 if (isset($analyzed_sql[0]['table_ref']) && is_array($analyzed_sql[0]['table_ref'])) {
2416 foreach ($analyzed_sql[0]['table_ref'] AS $table_ref_position => $table_ref) {
2417 $target[] = $analyzed_sql[0]['table_ref'][$table_ref_position]['table_true_name'];
2420 $tabs = '(\'' . join('\',\'', $target) . '\')';
2422 if (! strlen($table)) {
2425 // To be able to later display a link to the related table,
2426 // we verify both types of relations: either those that are
2427 // native foreign keys or those defined in the phpMyAdmin
2428 // configuration storage. If no PMA storage, we won't be able
2429 // to use the "column to display" notion (for example show
2430 // the name related to a numeric id).
2431 $exist_rel = PMA_getForeigners($db, $table, '', 'both');
2433 foreach ($exist_rel AS $master_field => $rel) {
2434 $display_field = PMA_getDisplayField($rel['foreign_db'], $rel['foreign_table']);
2435 $map[$master_field] = array($rel['foreign_table'],
2436 $rel['foreign_field'],
2438 $rel['foreign_db']);
2444 // 3. ----- Displays the results table -----
2445 PMA_displayTableHeaders($is_display, $fields_meta, $fields_cnt, $analyzed_sql, $sort_expression, $sort_expression_nodirection, $sort_direction);
2447 echo '<tbody>' . "\n";
2448 $clause_is_unique = PMA_displayTableBody($dt_result, $is_display, $map, $analyzed_sql);
2449 // vertical output case
2450 if ($_SESSION['tmp_user_values']['disp_direction'] == 'vertical') {
2451 PMA_displayVerticalTable();
2453 unset($vertical_display);
2454 echo '</tbody>' . "\n";
2459 // 4. ----- Displays the link for multi-fields edit and delete
2461 if ($is_display['del_lnk'] == 'dr' && $is_display['del_lnk'] != 'kp') {
2463 $delete_text = $is_display['del_lnk'] == 'dr' ?
__('Delete') : __('Kill');
2465 $_url_params = array(
2468 'sql_query' => $sql_query,
2471 $uncheckall_url = 'sql.php' . PMA_generate_common_url($_url_params);
2473 $_url_params['checkall'] = '1';
2474 $checkall_url = 'sql.php' . PMA_generate_common_url($_url_params);
2476 if ($_SESSION['tmp_user_values']['disp_direction'] == 'vertical') {
2477 $checkall_params['onclick'] = 'if (setCheckboxes(\'resultsForm\', true)) return false;';
2478 $uncheckall_params['onclick'] = 'if (setCheckboxes(\'resultsForm\', false)) return false;';
2480 $checkall_params['onclick'] = 'if (markAllRows(\'resultsForm\')) return false;';
2481 $uncheckall_params['onclick'] = 'if (unMarkAllRows(\'resultsForm\')) return false;';
2483 $checkall_link = PMA_linkOrButton($checkall_url, __('Check All'), $checkall_params, false);
2484 $uncheckall_link = PMA_linkOrButton($uncheckall_url, __('Uncheck All'), $uncheckall_params, false);
2485 if ($_SESSION['tmp_user_values']['disp_direction'] != 'vertical') {
2486 echo '<img class="selectallarrow" width="38" height="22"'
2487 .' src="' . $GLOBALS['pmaThemeImage'] . 'arrow_' . $GLOBALS['text_dir'] . '.png' . '"'
2488 .' alt="' . __('With selected:') . '" />';
2490 echo $checkall_link . "\n"
2492 .$uncheckall_link . "\n"
2493 .'<i>' . __('With selected:') . '</i>' . "\n";
2496 'submit_mult', 'mult_submit', 'submit_mult_change',
2497 __('Change'), 'b_edit.png', 'edit'
2500 'submit_mult', 'mult_submit', 'submit_mult_delete',
2501 $delete_text, 'b_drop.png', 'delete'
2503 if (isset($analyzed_sql[0]) && $analyzed_sql[0]['querytype'] == 'SELECT') {
2505 'submit_mult', 'mult_submit', 'submit_mult_export',
2506 __('Export'), 'b_tblexport.png', 'export'
2511 echo '<input type="hidden" name="sql_query"'
2512 .' value="' . htmlspecialchars($sql_query) . '" />' . "\n";
2514 if (! empty($GLOBALS['url_query'])) {
2515 echo '<input type="hidden" name="url_query"'
2516 .' value="' . $GLOBALS['url_query'] . '" />' . "\n";
2519 echo '<input type="hidden" name="clause_is_unique"'
2520 .' value="' . $clause_is_unique . '" />' . "\n";
2522 echo '</form>' . "\n";
2525 // 5. ----- Displays the navigation bar at the bottom if required -----
2527 if ($is_display['nav_bar'] == '1' && empty($analyzed_sql[0]['limit_clause'])) {
2528 echo '<br />' . "\n";
2529 PMA_displayTableNavigation($pos_next, $pos_prev, $sql_query, 'bottom_direction_dropdown');
2530 } elseif (! isset($GLOBALS['printview']) ||
$GLOBALS['printview'] != '1') {
2531 echo "\n" . '<br /><br />' . "\n";
2534 // 6. ----- Displays "Query results operations"
2535 if (! isset($GLOBALS['printview']) ||
$GLOBALS['printview'] != '1') {
2536 PMA_displayResultsOperations($the_disp_mode, $analyzed_sql);
2538 } // end of the 'PMA_displayTable()' function
2540 function default_function($buffer)
2542 $buffer = htmlspecialchars($buffer);
2543 $buffer = str_replace("\011", ' ', str_replace(' ', ' ', $buffer));
2544 $buffer = preg_replace("@((\015\012)|(\015)|(\012))@", '<br />', $buffer);
2550 * Displays operations that are available on results.
2552 * @param array $the_disp_mode the display mode
2553 * @param array $analyzed_sql the analyzed query
2555 * @global string $db the database name
2556 * @global string $table the table name
2557 * @global string $sql_query the current SQL query
2558 * @global integer $unlim_num_rows the total number of rows returned by the
2559 * SQL query without any programmatically
2560 * appended "LIMIT" clause
2564 * @see PMA_showMessage(), PMA_setDisplayMode(),
2565 * PMA_displayTableNavigation(), PMA_displayTableHeaders(),
2566 * PMA_displayTableBody(), PMA_displayResultsOperations()
2570 function PMA_displayResultsOperations($the_disp_mode, $analyzed_sql)
2572 global $db, $table, $sql_query, $unlim_num_rows, $fields_meta;
2574 $header_shown = false;
2575 $header = '<fieldset><legend>' . __('Query results operations') . '</legend>';
2577 if ($the_disp_mode[6] == '1' ||
$the_disp_mode[9] == '1') {
2578 // Displays "printable view" link if required
2579 if ($the_disp_mode[9] == '1') {
2581 if (!$header_shown) {
2583 $header_shown = true;
2586 $_url_params = array(
2590 'sql_query' => $sql_query,
2592 $url_query = PMA_generate_common_url($_url_params);
2594 echo PMA_linkOrButton(
2595 'sql.php' . $url_query,
2596 PMA_getIcon('b_print.png', __('Print view'), true),
2597 '', true, true, 'print_view'
2600 if ($_SESSION['tmp_user_values']['display_text']) {
2601 $_url_params['display_text'] = 'F';
2602 echo PMA_linkOrButton(
2603 'sql.php' . PMA_generate_common_url($_url_params),
2604 PMA_getIcon('b_print.png', __('Print view (with full texts)'), true),
2605 '', true, true, 'print_view'
2607 unset($_url_params['display_text']);
2609 } // end displays "printable view"
2613 // (the url_query has extra parameters that won't be used to export)
2614 // (the single_table parameter is used in display_export.lib.php
2615 // to hide the SQL and the structure export dialogs)
2616 // If the parser found a PROCEDURE clause
2617 // (most probably PROCEDURE ANALYSE()) it makes no sense to
2618 // display the Export link).
2619 if (isset($analyzed_sql[0]) && $analyzed_sql[0]['querytype'] == 'SELECT' && ! isset($printview) && ! isset($analyzed_sql[0]['queryflags']['procedure'])) {
2620 if (isset($analyzed_sql[0]['table_ref'][0]['table_true_name']) && ! isset($analyzed_sql[0]['table_ref'][1]['table_true_name'])) {
2621 $_url_params['single_table'] = 'true';
2623 if (!$header_shown) {
2625 $header_shown = true;
2627 $_url_params['unlim_num_rows'] = $unlim_num_rows;
2630 * At this point we don't know the table name; this can happen
2631 * for example with a query like
2632 * SELECT bike_code FROM (SELECT bike_code FROM bikes) tmp
2633 * As a workaround we set in the table parameter the name of the
2634 * first table of this database, so that tbl_export.php and
2635 * the script it calls do not fail
2637 if (empty($_url_params['table']) && !empty($_url_params['db'])) {
2638 $_url_params['table'] = PMA_DBI_fetch_value("SHOW TABLES");
2639 /* No result (probably no database selected) */
2640 if ($_url_params['table'] === false) {
2641 unset($_url_params['table']);
2645 echo PMA_linkOrButton(
2646 'tbl_export.php' . PMA_generate_common_url($_url_params),
2647 PMA_getIcon('b_tblexport.png', __('Export'), true),
2652 echo PMA_linkOrButton(
2653 'tbl_chart.php' . PMA_generate_common_url($_url_params),
2654 PMA_getIcon('b_chart.png', __('Display chart'), true),
2659 $geometry_found = false;
2660 // If atleast one geometry field is found
2661 foreach ($fields_meta as $meta) {
2662 if ($meta->type
== 'geometry') {
2663 $geometry_found = true;
2667 if ($geometry_found) {
2668 echo PMA_linkOrButton(
2669 'tbl_gis_visualization.php' . PMA_generate_common_url($_url_params),
2670 PMA_getIcon('b_globe.gif', __('Visualize GIS data'), true),
2679 * @todo detect privileges to create a view
2680 * (but see 2006-01-19 note in display_create_table.lib.php,
2681 * I think we cannot detect db-specific privileges reliably)
2682 * Note: we don't display a Create view link if we found a PROCEDURE clause
2684 if (!$header_shown) {
2686 $header_shown = true;
2688 if (!PMA_DRIZZLE
&& !isset($analyzed_sql[0]['queryflags']['procedure'])) {
2689 echo PMA_linkOrButton(
2690 'view_create.php' . $url_query,
2691 PMA_getIcon('b_views.png', __('Create view'), true),
2695 if ($header_shown) {
2696 echo '</fieldset><br />';
2701 * Verifies what to do with non-printable contents (binary or BLOB)
2704 * @param string $category BLOB|BINARY|GEOMETRY
2705 * @param string $content the binary content
2706 * @param string $transform_function transformation function
2707 * @param string $transform_options transformation parameters
2708 * @param string $default_function default transformation function
2709 * @param object $meta the meta-information about this field
2710 * @param array $url_params parameters that should go to the download link
2712 * @return mixed string or float
2714 function PMA_handle_non_printable_contents($category, $content, $transform_function, $transform_options, $default_function, $meta, $url_params = array())
2716 $result = '[' . $category;
2717 if (is_null($content)) {
2718 $result .= ' - NULL';
2720 } elseif (isset($content)) {
2721 $size = strlen($content);
2722 $display_size = PMA_formatByteDown($size, 3, 1);
2723 $result .= ' - '. $display_size[0] . ' ' . $display_size[1];
2727 if (strpos($transform_function, 'octetstream')) {
2731 if ($default_function != $transform_function) {
2732 $result = $transform_function($result, $transform_options, $meta);
2734 $result = $default_function($result, array(), $meta);
2735 if (stristr($meta->type
, 'BLOB') && $_SESSION['tmp_user_values']['display_blob']) {
2736 // in this case, restart from the original $content
2737 $result = htmlspecialchars(PMA_replace_binary_contents($content));
2739 /* Create link to download */
2740 if (count($url_params) > 0) {
2741 $result = '<a href="tbl_get_field.php' . PMA_generate_common_url($url_params) . '">' . $result . '</a>';
2749 * Prepares the displayable content of a data cell in Browse mode,
2750 * taking into account foreign key description field and transformations
2752 * @param string $class css classes for the td element
2753 * @param bool $condition_field whether the column is a part of the where clause
2754 * @param string $analyzed_sql the analyzed query
2755 * @param object $meta the meta-information about this field
2756 * @param array $map the list of relations
2757 * @param string $data data
2758 * @param string $transform_function transformation function
2759 * @param string $default_function default function
2760 * @param string $nowrap 'nowrap' if the content should not be wrapped
2761 * @param string $where_comparison data for the where cluase
2762 * @param array $transform_options array of options for transformation
2763 * @param bool $is_field_truncated whether the field is truncated
2765 * @return string formatted data
2767 function PMA_prepare_row_data($class, $condition_field, $analyzed_sql, $meta, $map, $data, $transform_function, $default_function, $nowrap, $where_comparison, $transform_options, $is_field_truncated )
2770 $result = ' class="' . PMA_addClass($class, $condition_field, $meta, $nowrap, $is_field_truncated, $transform_function, $default_function) . '">';
2772 if (isset($analyzed_sql[0]['select_expr']) && is_array($analyzed_sql[0]['select_expr'])) {
2773 foreach ($analyzed_sql[0]['select_expr'] AS $select_expr_position => $select_expr) {
2774 $alias = $analyzed_sql[0]['select_expr'][$select_expr_position]['alias'];
2775 if (isset($alias) && strlen($alias)) {
2776 $true_column = $analyzed_sql[0]['select_expr'][$select_expr_position]['column'];
2777 if ($alias == $meta->name
) {
2778 // this change in the parameter does not matter
2779 // outside of the function
2780 $meta->name
= $true_column;
2786 if (isset($map[$meta->name
])) {
2787 // Field to display from the foreign table?
2788 if (isset($map[$meta->name
][2]) && strlen($map[$meta->name
][2])) {
2789 $dispsql = 'SELECT ' . PMA_backquote($map[$meta->name
][2])
2790 . ' FROM ' . PMA_backquote($map[$meta->name
][3])
2791 . '.' . PMA_backquote($map[$meta->name
][0])
2792 . ' WHERE ' . PMA_backquote($map[$meta->name
][1])
2793 . $where_comparison;
2794 $dispresult = PMA_DBI_try_query($dispsql, null, PMA_DBI_QUERY_STORE
);
2795 if ($dispresult && PMA_DBI_num_rows($dispresult) > 0) {
2796 list($dispval) = PMA_DBI_fetch_row($dispresult, 0);
2798 $dispval = __('Link not found');
2800 @PMA_DBI_free_result
($dispresult);
2803 } // end if... else...
2805 if (isset($GLOBALS['printview']) && $GLOBALS['printview'] == '1') {
2806 $result .= ($transform_function != $default_function ?
$transform_function($data, $transform_options, $meta) : $transform_function($data, array(), $meta)) . ' <code>[->' . $dispval . ']</code>';
2809 if ('K' == $_SESSION['tmp_user_values']['relational_display']) {
2810 // user chose "relational key" in the display options, so
2811 // the title contains the display field
2812 $title = (! empty($dispval))?
' title="' . htmlspecialchars($dispval) . '"' : '';
2814 $title = ' title="' . htmlspecialchars($data) . '"';
2817 $_url_params = array(
2818 'db' => $map[$meta->name
][3],
2819 'table' => $map[$meta->name
][0],
2821 'sql_query' => 'SELECT * FROM '
2822 . PMA_backquote($map[$meta->name
][3]) . '.' . PMA_backquote($map[$meta->name
][0])
2823 . ' WHERE ' . PMA_backquote($map[$meta->name
][1])
2824 . $where_comparison,
2826 $result .= '<a href="sql.php' . PMA_generate_common_url($_url_params)
2827 . '"' . $title . '>';
2829 if ($transform_function != $default_function) {
2830 // always apply a transformation on the real data,
2831 // not on the display field
2832 $result .= $transform_function($data, $transform_options, $meta);
2834 if ('D' == $_SESSION['tmp_user_values']['relational_display']) {
2835 // user chose "relational display field" in the
2836 // display options, so show display field in the cell
2837 $result .= $transform_function($dispval, array(), $meta);
2839 // otherwise display data in the cell
2840 $result .= $transform_function($data, array(), $meta);
2846 $result .= ($transform_function != $default_function ?
$transform_function($data, $transform_options, $meta) : $transform_function($data, array(), $meta));
2848 $result .= '</td>' . "\n";
2854 * Generates a checkbox for multi-row submits
2856 * @param string $del_url delete url
2857 * @param array $is_display array with explicit indexes for all the display elements
2858 * @param string $row_no the row number
2859 * @param string $where_clause_html url encoded where cluase
2860 * @param array $condition_array array of conditions in the where cluase
2861 * @param string $del_query delete query
2862 * @param string $id_suffix suffix for the id
2863 * @param string $class css classes for the td element
2865 * @return string the generated HTML
2868 function PMA_generateCheckboxForMulti($del_url, $is_display, $row_no, $where_clause_html, $condition_array, $del_query, $id_suffix, $class)
2871 if (! empty($del_url) && $is_display['del_lnk'] != 'kp') {
2873 if (! empty($class)) {
2874 $ret .= 'class="' . $class . '"';
2876 $ret .= ' align="center">'
2877 . '<input type="checkbox" id="id_rows_to_delete' . $row_no . $id_suffix . '" name="rows_to_delete[' . $where_clause_html . ']"'
2878 . ' class="multi_checkbox"'
2879 . ' value="' . htmlspecialchars($del_query) . '" ' . (isset($GLOBALS['checkall']) ?
'checked="checked"' : '') . ' />'
2880 . '<input type="hidden" class="condition_array" value="' . htmlspecialchars(json_encode($condition_array)) . '" />'
2887 * Generates an Edit link
2889 * @param string $edit_url edit url
2890 * @param string $class css classes for td element
2891 * @param string $edit_str text for the edit link
2892 * @param string $where_clause where cluase
2893 * @param string $where_clause_html url encoded where cluase
2895 * @return string the generated HTML
2897 function PMA_generateEditLink($edit_url, $class, $edit_str, $where_clause, $where_clause_html)
2900 if (! empty($edit_url)) {
2901 $ret .= '<td class="' . $class . '" align="center" ' . ' ><span class="nowrap">'
2902 . PMA_linkOrButton($edit_url, $edit_str, array(), false);
2904 * Where clause for selecting this row uniquely is provided as
2905 * a hidden input. Used by jQuery scripts for handling grid editing
2907 if (! empty($where_clause)) {
2908 $ret .= '<input type="hidden" class="where_clause" value ="' . $where_clause_html . '" />';
2910 $ret .= '</span></td>';
2916 * Generates an Copy link
2918 * @param string $copy_url copy url
2919 * @param string $copy_str text for the copy link
2920 * @param string $where_clause where clause
2921 * @param string $where_clause_html url encoded where cluase
2922 * @param string $class css classes for the td element
2924 * @return string the generated HTML
2926 function PMA_generateCopyLink($copy_url, $copy_str, $where_clause, $where_clause_html, $class)
2929 if (! empty($copy_url)) {
2931 if (! empty($class)) {
2932 $ret .= 'class="' . $class . '" ';
2934 $ret .= 'align="center" ' . ' ><span class="nowrap">'
2935 . PMA_linkOrButton($copy_url, $copy_str, array(), false);
2937 * Where clause for selecting this row uniquely is provided as
2938 * a hidden input. Used by jQuery scripts for handling grid editing
2940 if (! empty($where_clause)) {
2941 $ret .= '<input type="hidden" class="where_clause" value ="' . $where_clause_html . '" />';
2943 $ret .= '</span></td>';
2949 * Generates a Delete link
2951 * @param string $del_url delete url
2952 * @param string $del_str text for the delete link
2953 * @param string $js_conf text for the JS confirmation
2954 * @param string $class css classes for the td element
2956 * @return string the generated HTML
2958 function PMA_generateDeleteLink($del_url, $del_str, $js_conf, $class)
2961 if (! empty($del_url)) {
2963 if (! empty($class)) {
2964 $ret .= 'class="' . $class . '" ';
2966 $ret .= 'align="center" ' . ' >'
2967 . PMA_linkOrButton($del_url, $del_str, $js_conf, false)
2974 * Generates checkbox and links at some position (left or right)
2975 * (only called for horizontal mode)
2977 * @param string $position the position of the checkbox and links
2978 * @param string $del_url delete url
2979 * @param array $is_display array with explicit indexes for all the display elements
2980 * @param string $row_no row number
2981 * @param string $where_clause where clause
2982 * @param string $where_clause_html url encoded where cluase
2983 * @param array $condition_array array of conditions in the where cluase
2984 * @param string $del_query delete query
2985 * @param string $id_suffix suffix for the id
2986 * @param string $edit_url edit url
2987 * @param string $copy_url copy url
2988 * @param string $class css classes for the td elements
2989 * @param string $edit_str text for the edit link
2990 * @param string $copy_str text for the copy link
2991 * @param string $del_str text for the delete link
2992 * @param string $js_conf text for the JS confirmation
2994 * @return string the generated HTML
2996 function PMA_generateCheckboxAndLinks($position, $del_url, $is_display, $row_no, $where_clause, $where_clause_html, $condition_array, $del_query, $id_suffix, $edit_url, $copy_url, $class, $edit_str, $copy_str, $del_str, $js_conf)
3000 if ($position == 'left') {
3001 $ret .= PMA_generateCheckboxForMulti($del_url, $is_display, $row_no, $where_clause_html, $condition_array, $del_query, $id_suffix = '_left', '', '', '');
3003 $ret .= PMA_generateEditLink($edit_url, $class, $edit_str, $where_clause, $where_clause_html, '');
3005 $ret .= PMA_generateCopyLink($copy_url, $copy_str, $where_clause, $where_clause_html, '');
3007 $ret .= PMA_generateDeleteLink($del_url, $del_str, $js_conf, '', '');
3009 } elseif ($position == 'right') {
3010 $ret .= PMA_generateDeleteLink($del_url, $del_str, $js_conf, '', '');
3012 $ret .= PMA_generateCopyLink($copy_url, $copy_str, $where_clause, $where_clause_html, '');
3014 $ret .= PMA_generateEditLink($edit_url, $class, $edit_str, $where_clause, $where_clause_html, '');
3016 $ret .= PMA_generateCheckboxForMulti($del_url, $is_display, $row_no, $where_clause_html, $condition_array, $del_query, $id_suffix = '_right', '', '', '');
3017 } else { // $position == 'none'
3018 $ret .= PMA_generateCheckboxForMulti($del_url, $is_display, $row_no, $where_clause_html, $condition_array, $del_query, $id_suffix = '_left', '', '', '');