diff --git a/libraries/display_tbl.lib.php b/libraries/display_tbl.lib.php index 4b9358dd0a..4a10773fc2 100644 --- a/libraries/display_tbl.lib.php +++ b/libraries/display_tbl.lib.php @@ -34,7 +34,7 @@ require_once './libraries/Index.class.php'; * @param string &$the_disp_mode the synthetic value for display_mode (see a few * lines above for explanations) * @param integer &$the_total the total number of rows returned by the SQL query - * without any programmatically appended "LIMIT" clause + * without any programmatically appended LIMIT clause * (just a copy of $unlim_num_rows if it exists, else * computed inside this function) * @@ -107,8 +107,12 @@ function PMA_setDisplayMode(&$the_disp_mode, &$the_total) * 2.2.1 * @todo defines edit/delete links depending on show statement */ - $tmp = preg_match('@^SHOW[[:space:]]+(VARIABLES|(FULL[[:space:]]+)?PROCESSLIST|STATUS|TABLE|GRANTS|CREATE|LOGS|DATABASES|FIELDS)@i', $GLOBALS['sql_query'], $which); - if (isset($which[1]) && strpos(' ' . strtoupper($which[1]), 'PROCESSLIST') > 0) { + $tmp = preg_match( + '@^SHOW[[:space:]]+(VARIABLES|(FULL[[:space:]]+)?' + . 'PROCESSLIST|STATUS|TABLE|GRANTS|CREATE|LOGS|DATABASES|FIELDS)@i', + $GLOBALS['sql_query'], $which); + if (isset($which[1]) + && strpos(' ' . strtoupper($which[1]), 'PROCESSLIST') > 0) { $do_display['edit_lnk'] = 'nn'; // no edit link $do_display['del_lnk'] = 'kp'; // "kill process" type edit link } else { @@ -136,12 +140,14 @@ function PMA_setDisplayMode(&$the_disp_mode, &$the_total) || $do_display['ins_row'] != '0'); // 2.3.2 Displays edit/delete/sort/insert links? if ($is_link - && ($fields_meta[$i]->table == '' || $fields_meta[$i]->table != $prev_table) + && ($fields_meta[$i]->table == '' + || $fields_meta[$i]->table != $prev_table) ) { $do_display['edit_lnk'] = 'nn'; // don't display links $do_display['del_lnk'] = 'nn'; /** - * @todo May be problematic with same fields names in two joined table. + * @todo May be problematic with same field names + * in two joined table. */ // $do_display['sort_lnk'] = (string) '0'; $do_display['ins_row'] = (string) '0'; @@ -173,7 +179,9 @@ function PMA_setDisplayMode(&$the_disp_mode, &$the_total) // - For a VIEW we (probably) did not count the number of rows // so don't test this number here, it would remove the possibility // of sorting VIEW results. - if (isset($unlim_num_rows) && $unlim_num_rows < 2 && ! PMA_Table::isView($db, $table)) { + if (isset($unlim_num_rows) + && $unlim_num_rows < 2 + && ! PMA_Table::isView($db, $table)) { // force display of navbar for vertical/horizontal display-choice. // $do_display['nav_bar'] = (string) '0'; $do_display['sort_lnk'] = (string) '0'; @@ -227,7 +235,8 @@ function PMA_isSelect() * * @see PMA_displayTableNavigation() */ -function PMA_displayTableNavigationOneButton($caption, $title, $pos, $html_sql_query, $onsubmit = '', $input_for_real_end = '', $onclick = '') +function PMA_displayTableNavigationOneButton($caption, $title, $pos, $html_sql_query, + $onsubmit = '', $input_for_real_end = '', $onclick = '') { global $db, $table, $goto; @@ -238,7 +247,8 @@ function PMA_displayTableNavigationOneButton($caption, $title, $pos, $html_sql_q $caption_output .= $caption; } // for false or 'both' - if (false === $GLOBALS['cfg']['NavigationBarIconic'] || 'both' === $GLOBALS['cfg']['NavigationBarIconic']) { + if (false === $GLOBALS['cfg']['NavigationBarIconic'] + || 'both' === $GLOBALS['cfg']['NavigationBarIconic']) { $caption_output .= ' ' . $title; } $title_output = ' title="' . $title . '"'; @@ -246,11 +256,15 @@ function PMA_displayTableNavigationOneButton($caption, $title, $pos, $html_sql_q
> - + - value="" /> + value="" />
1) { //if2 ?> @@ -330,7 +351,8 @@ function PMA_displayTableNavigation($pos_next, $pos_prev, $sql_query, $id_for_di ); //
to keep the form alignment of button < and << // and also to know what to execute when the selector changes - echo ''; + echo ''; echo PMA_pageselector( $_SESSION['tmp_user_values']['max_rows'], $pageNow, @@ -349,24 +371,29 @@ function PMA_displayTableNavigation($pos_next, $pos_prev, $sql_query, $id_for_di } //_if1 // Display the "Show all" button if allowed - if (($num_rows < $unlim_num_rows) && ($GLOBALS['cfg']['ShowAll'] || ($GLOBALS['cfg']['MaxRows'] * 5 >= $unlim_num_rows))) { + if (($num_rows < $unlim_num_rows) + && ($GLOBALS['cfg']['ShowAll'] + || ($GLOBALS['cfg']['MaxRows'] * 5 >= $unlim_num_rows))) { echo "\n"; ?> - + - +
= $_SESSION['tmp_user_values']['max_rows'] && $_SESSION['tmp_user_values']['max_rows'] != 'all' ) { @@ -380,7 +407,8 @@ function PMA_displayTableNavigation($pos_next, $pos_prev, $sql_query, $id_for_di // prepare some options for the End button if ($is_innodb && $unlim_num_rows > $GLOBALS['cfg']['MaxExactCount']) { - $input_for_real_end = ''; + $input_for_real_end = ''; // no backquote around this message $onclick = ''; } else { @@ -391,9 +419,15 @@ function PMA_displayTableNavigation($pos_next, $pos_prev, $sql_query, $id_for_di PMA_displayTableNavigationOneButton( '>>', _pgettext('Last page', 'End'), - @((ceil($unlim_num_rows / $_SESSION['tmp_user_values']['max_rows'])- 1) * $_SESSION['tmp_user_values']['max_rows']), + @((ceil($unlim_num_rows / $_SESSION['tmp_user_values']['max_rows'])- 1) + * $_SESSION['tmp_user_values']['max_rows']), $html_sql_query, - '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') . '"', + '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') . '"', $input_for_real_end, $onclick ); @@ -423,15 +457,28 @@ function PMA_displayTableNavigation($pos_next, $pos_prev, $sql_query, $id_for_di // (this means we can't validate the upper limit ?>
+ onsubmit="return (checkFormElementInRange(this, 'session_max_rows', '', 1) && checkFormElementInRange(this, 'pos', '', 0 0 ? ',' . $unlim_num_rows - 1 : ''; ?>))"> - + - value=" :" /> + value=" :" /> - + - + __('horizontal'), 'horizontalflipped' => __('horizontal (rotated headers)'), 'vertical' => __('vertical')); - echo PMA_generate_html_dropdown('disp_direction', $choices, $_SESSION['tmp_user_values']['disp_direction'], $id_for_direction_dropdown); + echo PMA_generate_html_dropdown('disp_direction', $choices, + $_SESSION['tmp_user_values']['disp_direction'], + $id_for_direction_dropdown); unset($choices); } printf( __('Headers every %s rows'), - '' + '' ); echo "\n"; ?> @@ -465,7 +516,8 @@ function PMA_displayTableNavigation($pos_next, $pos_prev, $sql_query, $id_for_di * * @param array &$is_display which elements to display * @param array &$fields_meta the list of fields properties - * @param integer $fields_cnt the total number of fields returned by the SQL query + * @param integer $fields_cnt the total number of fields returned by + * the SQL query * @param array $analyzed_sql the analyzed query * @param string $sort_expression sort expression * @param string $sort_expression_nodirection sort expression without direction @@ -486,7 +538,9 @@ function PMA_displayTableNavigation($pos_next, $pos_prev, $sql_query, $id_for_di * * @see PMA_displayTable() */ -function PMA_displayTableHeaders(&$is_display, &$fields_meta, $fields_cnt = 0, $analyzed_sql = '', $sort_expression, $sort_expression_nodirection, $sort_direction) +function PMA_displayTableHeaders(&$is_display, &$fields_meta, $fields_cnt = 0, + $analyzed_sql = '', $sort_expression, $sort_expression_nodirection, + $sort_direction) { global $db, $table, $goto; global $sql_query, $num_rows; @@ -530,7 +584,8 @@ function PMA_displayTableHeaders(&$is_display, &$fields_meta, $fields_cnt = 0, $ if ($indexes) { if ($_SESSION['tmp_user_values']['disp_direction'] == 'horizontal' - || $_SESSION['tmp_user_values']['disp_direction'] == 'horizontalflipped' + || $_SESSION['tmp_user_values']['disp_direction'] + == 'horizontalflipped' ) { $span = $fields_cnt; if ($is_display['edit_lnk'] != 'nn') { @@ -539,23 +594,34 @@ function PMA_displayTableHeaders(&$is_display, &$fields_meta, $fields_cnt = 0, $ if ($is_display['del_lnk'] != 'nn') { $span++; } - if ($is_display['del_lnk'] != 'kp' && $is_display['del_lnk'] != 'nn') { + if ($is_display['del_lnk'] != 'kp' + && $is_display['del_lnk'] != 'nn') { $span++; } } else { - $span = $num_rows + floor($num_rows/$_SESSION['tmp_user_values']['repeat_cells']) + 1; + $span = $num_rows + floor($num_rows + / $_SESSION['tmp_user_values']['repeat_cells']) + 1; } echo '' . "\n"; echo PMA_generate_common_hidden_inputs($db, $table); - echo __('Sort by key') . ': ' . "\n"; $used_index = false; $local_order = (isset($sort_expression) ? $sort_expression : ''); foreach ($indexes as $index) { - $asc_sort = '`' . implode('` ASC, `', array_keys($index->getColumns())) . '` ASC'; - $desc_sort = '`' . implode('` DESC, `', array_keys($index->getColumns())) . '` DESC'; - $used_index = $used_index || $local_order == $asc_sort || $local_order == $desc_sort; - if (preg_match('@(.*)([[:space:]](LIMIT (.*)|PROCEDURE (.*)|FOR UPDATE|LOCK IN SHARE MODE))@is', $unsorted_sql_query, $my_reg)) { + $asc_sort = '`' + . implode('` ASC, `', array_keys($index->getColumns())) + . '` ASC'; + $desc_sort = '`' + . implode('` DESC, `', array_keys($index->getColumns())) + . '` DESC'; + $used_index = $used_index + || $local_order == $asc_sort + || $local_order == $desc_sort; + if (preg_match('@(.*)([[:space:]](LIMIT (.*)|PROCEDURE (.*)|' + . 'FOR UPDATE|LOCK IN SHARE MODE))@is', + $unsorted_sql_query, $my_reg)) { $unsorted_sql_query_first_part = $my_reg[1]; $unsorted_sql_query_second_part = $my_reg[2]; } else { @@ -563,17 +629,27 @@ function PMA_displayTableHeaders(&$is_display, &$fields_meta, $fields_cnt = 0, $ $unsorted_sql_query_second_part = ''; } echo ''; echo ''; } - echo ''; + echo ''; echo '' . "\n"; echo '
' . "\n"; } @@ -582,7 +658,8 @@ function PMA_displayTableHeaders(&$is_display, &$fields_meta, $fields_cnt = 0, $ // Output data needed for grid editing - echo ''; + echo ''; echo '
'; echo PMA_generate_common_hidden_inputs($db, $table); echo '
'; @@ -592,16 +669,19 @@ function PMA_displayTableHeaders(&$is_display, &$fields_meta, $fields_cnt = 0, $ $pmatable = new PMA_Table($GLOBALS['table'], $GLOBALS['db']); $col_order = $pmatable->getUiProp(PMA_Table::PROP_COLUMN_ORDER); if ($col_order) { - echo ''; + echo ''; } $col_visib = $pmatable->getUiProp(PMA_Table::PROP_COLUMN_VISIB); if ($col_visib) { - echo ''; + echo ''; } // generate table create time if (! PMA_Table::isView($GLOBALS['table'], $GLOBALS['db'])) { - echo ''; + echo ''; } } @@ -612,7 +692,8 @@ function PMA_displayTableHeaders(&$is_display, &$fields_meta, $fields_cnt = 0, $ // Display options (if we are not in print view) if (! (isset($GLOBALS['printview']) && $GLOBALS['printview'] == '1')) { - echo '
__('Partial texts'), 'F' => __('Full texts') ); - PMA_display_html_radio('display_text', $choices, $_SESSION['tmp_user_values']['display_text']); + PMA_display_html_radio('display_text', $choices, + $_SESSION['tmp_user_values']['display_text']); echo ''; // prepare full/partial text button or link @@ -657,28 +739,36 @@ function PMA_displayTableHeaders(&$is_display, &$fields_meta, $fields_cnt = 0, $ $url_params_full_text['display_text'] = 'F'; } - $tmp_image = '' . $tmp_txt . ''; + $tmp_image = '' 
+            . $tmp_txt . ''; $tmp_url = 'sql.php' . PMA_generate_common_url($url_params_full_text); - $full_or_partial_text_link = PMA_linkOrButton($tmp_url, $tmp_image, array(), false); + $full_or_partial_text_link + = PMA_linkOrButton($tmp_url, $tmp_image, array(), false); unset($tmp_image_file, $tmp_txt, $tmp_url, $tmp_image); - if ($GLOBALS['cfgRelation']['relwork'] && $GLOBALS['cfgRelation']['displaywork']) { + if ($GLOBALS['cfgRelation']['relwork'] + && $GLOBALS['cfgRelation']['displaywork']) { echo '
'; $choices = array( 'K' => __('Relational key'), 'D' => __('Relational display column') ); - PMA_display_html_radio('relational_display', $choices, $_SESSION['tmp_user_values']['relational_display']); + PMA_display_html_radio('relational_display', $choices, + $_SESSION['tmp_user_values']['relational_display']); echo '
'; } echo '
'; - PMA_display_html_checkbox('display_binary', __('Show binary contents'), ! empty($_SESSION['tmp_user_values']['display_binary']), false); + PMA_display_html_checkbox('display_binary', __('Show binary contents'), + ! empty($_SESSION['tmp_user_values']['display_binary']), false); echo '
'; - PMA_display_html_checkbox('display_blob', __('Show BLOB contents'), ! empty($_SESSION['tmp_user_values']['display_blob']), false); + PMA_display_html_checkbox('display_blob', __('Show BLOB contents'), + ! empty($_SESSION['tmp_user_values']['display_blob']), false); echo '
'; - PMA_display_html_checkbox('display_binary_as_hex', __('Show binary contents as HEX'), ! empty($_SESSION['tmp_user_values']['display_binary_as_hex']), false); + PMA_display_html_checkbox('display_binary_as_hex', + __('Show binary contents as HEX'), + ! empty($_SESSION['tmp_user_values']['display_binary_as_hex']), false); echo '
'; // I would have preferred to name this "display_transformation". @@ -686,7 +776,9 @@ function PMA_displayTableHeaders(&$is_display, &$fields_meta, $fields_cnt = 0, $ // per SQL query, and at the same time have a default that displays // the transformations. echo '
'; - PMA_display_html_checkbox('hide_transformation', __('Hide browser transformation'), ! empty($_SESSION['tmp_user_values']['hide_transformation']), false); + PMA_display_html_checkbox('hide_transformation', + __('Hide browser transformation'), + ! empty($_SESSION['tmp_user_values']['hide_transformation']), false); echo '
'; if (! PMA_DRIZZLE) { @@ -696,7 +788,8 @@ function PMA_displayTableHeaders(&$is_display, &$fields_meta, $fields_cnt = 0, $ 'WKT' => __('Well Known Text'), 'WKB' => __('Well Known Binary') ); - PMA_display_html_radio('geometry_display', $choices, $_SESSION['tmp_user_values']['geometry_display']); + PMA_display_html_radio('geometry_display', $choices, + $_SESSION['tmp_user_values']['geometry_display']); echo ''; } @@ -713,13 +806,14 @@ function PMA_displayTableHeaders(&$is_display, &$fields_meta, $fields_cnt = 0, $ // Start of form for multi-rows edit/delete/export if ($is_display['del_lnk'] == 'dr' || $is_display['del_lnk'] == 'kp') { - echo '' . "\n"; echo PMA_generate_common_hidden_inputs($db, $table, 1); - echo '' . "\n"; + echo '' . "\n"; } echo ' - + - + ' . "\n" - . ' ' . "\n" - . ' ' . "\n"; + $vertical_display['textbtn'] = + ' ' . "\n"; } // end vertical mode } // ... elseif no button, displays empty(ies) col(s) if required - elseif (($GLOBALS['cfg']['RowActionLinks'] == 'left' || $GLOBALS['cfg']['RowActionLinks'] == 'both') - && ($is_display['edit_lnk'] != 'nn' || $is_display['del_lnk'] != 'nn')) { - $vertical_display['emptypre'] = ($is_display['edit_lnk'] != 'nn' && $is_display['del_lnk'] != 'nn') ? 4 : 0; + elseif (($GLOBALS['cfg']['RowActionLinks'] == 'left' + || $GLOBALS['cfg']['RowActionLinks'] == 'both') + && ($is_display['edit_lnk'] != 'nn' || $is_display['del_lnk'] != 'nn')) { + $vertical_display['emptypre'] = ($is_display['edit_lnk'] != 'nn' + && $is_display['del_lnk'] != 'nn') ? 4 : 0; if ($_SESSION['tmp_user_values']['disp_direction'] == 'horizontal' || $_SESSION['tmp_user_values']['disp_direction'] == 'horizontalflipped' ) { @@ -805,9 +909,11 @@ function PMA_displayTableHeaders(&$is_display, &$fields_meta, $fields_cnt = 0, $ } // end vertical mode } - // ... elseif display an empty column if the actions links are disabled to match the rest of the table + // ... elseif display an empty column if the actions links are disabled to + // match the rest of the table elseif ($GLOBALS['cfg']['RowActionLinks'] == 'none' - && ($_SESSION['tmp_user_values']['disp_direction'] == 'horizontal' || $_SESSION['tmp_user_values']['disp_direction'] == 'horizontalflipped') + && ($_SESSION['tmp_user_values']['disp_direction'] == 'horizontal' + || $_SESSION['tmp_user_values']['disp_direction'] == 'horizontalflipped') ) { echo ''; } @@ -816,8 +922,10 @@ function PMA_displayTableHeaders(&$is_display, &$fields_meta, $fields_cnt = 0, $ // 2.0 If sorting links should be used, checks if the query is a "JOIN" // statement (see 2.1.3) - // 2.0.1 Prepare Display column comments if enabled ($GLOBALS['cfg']['ShowBrowseComments']). - // Do not show comments, if using horizontalflipped mode, because of space usage + // 2.0.1 Prepare Display column comments if enabled + // ($GLOBALS['cfg']['ShowBrowseComments']). + // Do not show comments, if using horizontalflipped mode, + // because of space usage if ($GLOBALS['cfg']['ShowBrowseComments'] && $_SESSION['tmp_user_values']['disp_direction'] != 'horizontalflipped' ) { @@ -831,7 +939,10 @@ function PMA_displayTableHeaders(&$is_display, &$fields_meta, $fields_cnt = 0, $ } } - if ($GLOBALS['cfgRelation']['commwork'] && $GLOBALS['cfgRelation']['mimework'] && $GLOBALS['cfg']['BrowseMIME'] && ! $_SESSION['tmp_user_values']['hide_transformation']) { + if ($GLOBALS['cfgRelation']['commwork'] + && $GLOBALS['cfgRelation']['mimework'] + && $GLOBALS['cfg']['BrowseMIME'] + && ! $_SESSION['tmp_user_values']['hide_transformation']) { include_once './libraries/transformations.lib.php'; $GLOBALS['mime_map'] = PMA_getMIME($db, $table); } @@ -844,8 +955,10 @@ function PMA_displayTableHeaders(&$is_display, &$fields_meta, $fields_cnt = 0, $ ) { $wi = 0; - if (isset($analyzed_sql[0]['where_clause_identifiers']) && is_array($analyzed_sql[0]['where_clause_identifiers'])) { - foreach ($analyzed_sql[0]['where_clause_identifiers'] AS $wci_nr => $wci) { + if (isset($analyzed_sql[0]['where_clause_identifiers']) + && is_array($analyzed_sql[0]['where_clause_identifiers'])) { + foreach ($analyzed_sql[0]['where_clause_identifiers'] + as $wci_nr => $wci) { $highlight_columns[$wci] = 'true'; } } @@ -866,7 +979,8 @@ function PMA_displayTableHeaders(&$is_display, &$fields_meta, $fields_cnt = 0, $ $i = $col_order ? $col_order[$j] : $j; // See if this column should get highlight because it's used in the // where-query. - if (isset($highlight_columns[$fields_meta[$i]->name]) || isset($highlight_columns[PMA_backquote($fields_meta[$i]->name)])) { + if (isset($highlight_columns[$fields_meta[$i]->name]) + || isset($highlight_columns[PMA_backquote($fields_meta[$i]->name)])) { $condition_field = true; } else { $condition_field = false; @@ -877,7 +991,9 @@ function PMA_displayTableHeaders(&$is_display, &$fields_meta, $fields_cnt = 0, $ && isset($comments_map[$fields_meta[$i]->table]) && isset($comments_map[$fields_meta[$i]->table][$fields_meta[$i]->name]) ) { - $comments = '' . htmlspecialchars($comments_map[$fields_meta[$i]->table][$fields_meta[$i]->name]) . ''; + $comments = '' . htmlspecialchars( + $comments_map[$fields_meta[$i]->table][$fields_meta[$i]->name]) + . ''; } else { $comments = ''; } @@ -903,7 +1019,8 @@ function PMA_displayTableHeaders(&$is_display, &$fields_meta, $fields_cnt = 0, $ // but if found, it's the one on which to sort $name_to_use_in_sort = $fields_meta[$i]->name; $is_orgname = false; - if (isset($fields_meta[$i]->orgname) && strlen($fields_meta[$i]->orgname)) { + if (isset($fields_meta[$i]->orgname) + && strlen($fields_meta[$i]->orgname)) { $name_to_use_in_sort = $fields_meta[$i]->orgname; $is_orgname = true; } @@ -928,15 +1045,18 @@ function PMA_displayTableHeaders(&$is_display, &$fields_meta, $fields_cnt = 0, $ && strpos($sort_expression_nodirection, $sort_tbl) === false && strpos($sort_expression_nodirection, '(') === false ) { - $new_sort_expression_nodirection = $sort_tbl . $sort_expression_nodirection; + $new_sort_expression_nodirection = $sort_tbl + . $sort_expression_nodirection; } else { $new_sort_expression_nodirection = $sort_expression_nodirection; } $is_in_sort = false; $sort_name = str_replace('`', '', $sort_tbl) . $name_to_use_in_sort; - if ($sort_name == str_replace('`', '', $new_sort_expression_nodirection) - || $sort_name == str_replace('`', '', $sort_expression_nodirection) + if ($sort_name == str_replace('`', '', + $new_sort_expression_nodirection) + || $sort_name == str_replace('`', '', + $sort_expression_nodirection) ) { $is_in_sort = true; } @@ -949,7 +1069,8 @@ function PMA_displayTableHeaders(&$is_display, &$fields_meta, $fields_cnt = 0, $ if (strpos($name_to_use_in_sort, '(') !== false && ! $is_orgname) { $sort_order = "\n" . 'ORDER BY ' . $name_to_use_in_sort . ' '; } else { - $sort_order = "\n" . 'ORDER BY ' . $sort_tbl . PMA_backquote($name_to_use_in_sort) . ' '; + $sort_order = "\n" . 'ORDER BY ' . $sort_tbl + . PMA_backquote($name_to_use_in_sort) . ' '; } unset($name_to_use_in_sort); unset($is_orgname); @@ -959,22 +1080,28 @@ function PMA_displayTableHeaders(&$is_display, &$fields_meta, $fields_cnt = 0, $ // patch #455484 ("Smart" order) $GLOBALS['cfg']['Order'] = strtoupper($GLOBALS['cfg']['Order']); if ($GLOBALS['cfg']['Order'] === 'SMART') { - $sort_order .= (preg_match('@time|date@i', $fields_meta[$i]->type)) ? 'DESC' : 'ASC'; + $sort_order .= (preg_match('@time|date@i', + $fields_meta[$i]->type)) ? 'DESC' : 'ASC'; } else { $sort_order .= $GLOBALS['cfg']['Order']; } $order_img = ''; } elseif ('DESC' == $sort_direction) { $sort_order .= ' ASC'; - $order_img = ' ' . PMA_getImage('s_desc.png', __('Descending'), array('class' => "soimg$i", 'title' => '')); - $order_img .= ' ' . PMA_getImage('s_asc.png', __('Ascending'), array('class' => "soimg$i hide", 'title' => '')); + $order_img = ' ' . PMA_getImage('s_desc.png', __('Descending'), + array('class' => "soimg$i", 'title' => '')); + $order_img .= ' ' . PMA_getImage('s_asc.png', __('Ascending'), + array('class' => "soimg$i hide", 'title' => '')); } else { $sort_order .= ' DESC'; - $order_img = ' ' . PMA_getImage('s_asc.png', __('Ascending'), array('class' => "soimg$i", 'title' => '')); - $order_img .= ' ' . PMA_getImage('s_desc.png', __('Descending'), array('class' => "soimg$i hide", 'title' => '')); + $order_img = ' ' . PMA_getImage('s_asc.png', __('Ascending'), + array('class' => "soimg$i", 'title' => '')); + $order_img .= ' ' . PMA_getImage('s_desc.png', __('Descending'), + array('class' => "soimg$i hide", 'title' => '')); } - if (preg_match('@(.*)([[:space:]](LIMIT (.*)|PROCEDURE (.*)|FOR UPDATE|LOCK IN SHARE MODE))@is', $unsorted_sql_query, $regs3)) { + if (preg_match('@(.*)([[:space:]](LIMIT (.*)|PROCEDURE (.*)|FOR UPDATE|' + . 'LOCK IN SHARE MODE))@is', $unsorted_sql_query, $regs3)) { $sorted_sql_query = $regs3[1] . $sort_order . $regs3[2]; } else { $sorted_sql_query = $unsorted_sql_query . $sort_order; @@ -1012,11 +1139,18 @@ function PMA_displayTableHeaders(&$is_display, &$fields_meta, $fields_cnt = 0, $ $order_link_params['style'] = 'direction: ltr; writing-mode: tb-rl;'; } $order_link_params['title'] = __('Sort'); - $order_link_content = ($_SESSION['tmp_user_values']['disp_direction'] == 'horizontalflipped' && $GLOBALS['cfg']['HeaderFlipType'] == 'fake' ? PMA_flipstring(htmlspecialchars($fields_meta[$i]->name), "
\n") : htmlspecialchars($fields_meta[$i]->name)); - $order_link = PMA_linkOrButton($order_url, $order_link_content . $order_img, $order_link_params, false, true); + $order_link_content = ($_SESSION['tmp_user_values']['disp_direction'] + == 'horizontalflipped' + && $GLOBALS['cfg']['HeaderFlipType'] == 'fake' + ? PMA_flipstring(htmlspecialchars($fields_meta[$i]->name), + "
\n") + : htmlspecialchars($fields_meta[$i]->name)); + $order_link = PMA_linkOrButton($order_url, + $order_link_content . $order_img, $order_link_params, false, true); if ($_SESSION['tmp_user_values']['disp_direction'] == 'horizontal' - || $_SESSION['tmp_user_values']['disp_direction'] == 'horizontalflipped' + || $_SESSION['tmp_user_values']['disp_direction'] + == 'horizontalflipped' ) { echo '' - . $order_link . $comments . ''; + echo '" data-column="' . htmlspecialchars($fields_meta[$i]->name) + . '">' . $order_link . $comments . ''; } $vertical_display['desc'][] = ' ' . "\n"; + . '" data-column="' . htmlspecialchars($fields_meta[$i]->name) + . '">' . "\n" . $order_link . $comments . ' ' . "\n"; } // end if (2.1) // 2.2 Results can't be sorted else { if ($_SESSION['tmp_user_values']['disp_direction'] == 'horizontal' - || $_SESSION['tmp_user_values']['disp_direction'] == 'horizontalflipped' + || $_SESSION['tmp_user_values']['disp_direction'] + == 'horizontalflipped' ) { echo ''; - if ($_SESSION['tmp_user_values']['disp_direction'] == 'horizontalflipped' + echo ' data-column="' . htmlspecialchars($fields_meta[$i]->name) + . '">'; + if ($_SESSION['tmp_user_values']['disp_direction'] + == 'horizontalflipped' && $GLOBALS['cfg']['HeaderFlipType'] == 'fake' ) { - echo PMA_flipstring(htmlspecialchars($fields_meta[$i]->name), '
'); + echo PMA_flipstring(htmlspecialchars($fields_meta[$i]->name), + '
'); } else { echo htmlspecialchars($fields_meta[$i]->name); } @@ -1086,19 +1227,23 @@ function PMA_displayTableHeaders(&$is_display, &$fields_meta, $fields_cnt = 0, $ $vertical_display['desc'][] = '
'; + . '" data-column="' . htmlspecialchars($fields_meta[$i]->name) + . '">' . "\n" . ' ' . htmlspecialchars($fields_meta[$i]->name) + . "\n" . $comments . ' '; } // end else (2.2) } // end for // 3. Displays the needed checkboxes at the right // column of the result table header if possible and required... - if (($GLOBALS['cfg']['RowActionLinks'] == 'right' || $GLOBALS['cfg']['RowActionLinks'] == 'both') + if (($GLOBALS['cfg']['RowActionLinks'] == 'right' + || $GLOBALS['cfg']['RowActionLinks'] == 'both') && ($is_display['edit_lnk'] != 'nn' || $is_display['del_lnk'] != 'nn') && $is_display['text_btn'] == '1' ) { - $vertical_display['emptyafter'] = ($is_display['edit_lnk'] != 'nn' && $is_display['del_lnk'] != 'nn') ? 4 : 1; + $vertical_display['emptyafter'] = + ($is_display['edit_lnk'] != 'nn' && $is_display['del_lnk'] != 'nn') + ? 4 + : 1; if ($_SESSION['tmp_user_values']['disp_direction'] == 'horizontal' || $_SESSION['tmp_user_values']['disp_direction'] == 'horizontalflipped' ) { @@ -1109,19 +1254,24 @@ function PMA_displayTableHeaders(&$is_display, &$fields_meta, $fields_cnt = 0, $ ' . "\n" - . ' ' . "\n" - . ' ' . "\n"; + $vertical_display['textbtn'] = ' ' . "\n"; } // end vertical mode } // ... elseif no button, displays empty columns if required // (unless coming from Browse mode print view) - elseif (($GLOBALS['cfg']['RowActionLinks'] == 'left' || $GLOBALS['cfg']['RowActionLinks'] == 'both') + elseif (($GLOBALS['cfg']['RowActionLinks'] == 'left' + || $GLOBALS['cfg']['RowActionLinks'] == 'both') && ($is_display['edit_lnk'] == 'nn' && $is_display['del_lnk'] == 'nn') && (! isset($GLOBALS['is_header_sent']) || ! $GLOBALS['is_header_sent']) ) { - $vertical_display['emptyafter'] = ($is_display['edit_lnk'] != 'nn' && $is_display['del_lnk'] != 'nn') ? 4 : 1; + $vertical_display['emptyafter'] = + ($is_display['edit_lnk'] != 'nn' && $is_display['del_lnk'] != 'nn') + ? 4 + : 1; if ($_SESSION['tmp_user_values']['disp_direction'] == 'horizontal' || $_SESSION['tmp_user_values']['disp_direction'] == 'horizontalflipped' ) { @@ -1159,7 +1309,8 @@ function PMA_displayTableHeaders(&$is_display, &$fields_meta, $fields_cnt = 0, $ */ function PMA_buildValueDisplay($class, $condition_field, $value) { - return ''; + return ''; } /** @@ -1175,7 +1326,8 @@ function PMA_buildValueDisplay($class, $condition_field, $value) function PMA_buildNullDisplay($class, $condition_field, $meta, $align = '') { // the null class is needed for grid editing - return ''; + return ''; } /** @@ -1191,7 +1343,8 @@ function PMA_buildNullDisplay($class, $condition_field, $meta, $align = '') function PMA_buildEmptyDisplay($class, $condition_field, $meta, $align = '') { $nowrap = ' nowrap'; - return ''; + return ''; } /** @@ -1207,7 +1360,8 @@ function PMA_buildEmptyDisplay($class, $condition_field, $meta, $align = '') * * @return string the list of classes */ -function PMA_addClass($class, $condition_field, $meta, $nowrap, $is_field_truncated = false, $transform_function = '', $default_function = '') +function PMA_addClass($class, $condition_field, $meta, $nowrap, + $is_field_truncated = false, $transform_function = '', $default_function = '') { // Define classes to be added to this data field based on the type of data $enum_class = ''; @@ -1240,8 +1394,8 @@ function PMA_addClass($class, $condition_field, $meta, $nowrap, $is_field_trunca /** * Displays the body of the results table * - * @param integer &$dt_result the link id associated to the query which results have - * to be displayed + * @param integer &$dt_result the link id associated to the query + * which results have to be displayed * @param array &$is_display which elements to display * @param array $map the list of relations * @param array $analyzed_sql the analyzed query @@ -1269,7 +1423,8 @@ function PMA_displayTableBody(&$dt_result, &$is_display, $map, $analyzed_sql) global $db, $table, $goto; global $sql_query, $fields_meta, $fields_cnt; global $vertical_display, $highlight_columns; - global $row; // mostly because of browser transformations, to make the row-data accessible in a plugin + global $row; // mostly because of browser transformations, + // to make the row-data accessible in a plugin $url_sql_query = $sql_query; @@ -1337,8 +1492,8 @@ function PMA_displayTableBody(&$dt_result, &$is_display, $map, $analyzed_sql) ) { echo '' . "\n"; if ($vertical_display['emptypre'] > 0) { - echo ' ' . "\n"; + echo ' ' . "\n"; } else if ($GLOBALS['cfg']['RowActionLinks'] == 'none') { echo ' ' . "\n"; } @@ -1348,8 +1503,8 @@ function PMA_displayTableBody(&$dt_result, &$is_display, $map, $analyzed_sql) } if ($vertical_display['emptyafter'] > 0) { - echo ' ' . "\n"; + echo ' ' . "\n"; } echo '' . "\n"; } // end if @@ -1373,13 +1528,15 @@ function PMA_displayTableBody(&$dt_result, &$is_display, $map, $analyzed_sql) * with only one field and it's a BLOB; in this case, * avoid to display the delete and edit links */ - list($where_clause, $clause_is_unique, $condition_array) = PMA_getUniqueCondition($dt_result, $fields_cnt, $fields_meta, $row); + list($where_clause, $clause_is_unique, $condition_array) + = PMA_getUniqueCondition($dt_result, $fields_cnt, $fields_meta, $row); $where_clause_html = urlencode($where_clause); // 1.2 Defines the URLs for the modify/delete link(s) if ($is_display['edit_lnk'] != 'nn' || $is_display['del_lnk'] != 'nn') { - // We need to copy the value or else the == 'both' check will always return true + // We need to copy the value + // or else the == 'both' check will always return true if ($GLOBALS['cfg']['PropertiesIconic'] === 'both') { $iconic_spacer = '
'; @@ -1397,8 +1554,10 @@ function PMA_displayTableBody(&$dt_result, &$is_display, $map, $analyzed_sql) 'sql_query' => $url_sql_query, 'goto' => 'sql.php', ); - $edit_url = 'tbl_change.php' . PMA_generate_common_url($_url_params + array('default_action' => 'update')); - $copy_url = 'tbl_change.php' . PMA_generate_common_url($_url_params + array('default_action' => 'insert')); + $edit_url = 'tbl_change.php' . PMA_generate_common_url( + $_url_params + array('default_action' => 'update')); + $copy_url = 'tbl_change.php' . PMA_generate_common_url( + $_url_params + array('default_action' => 'insert')); $edit_str = PMA_getIcon('b_edit.png', __('Edit')); $copy_str = PMA_getIcon('b_insrow.png', __('Copy')); @@ -1421,8 +1580,12 @@ function PMA_displayTableBody(&$dt_result, &$is_display, $map, $analyzed_sql) ); $lnk_goto = 'sql.php' . PMA_generate_common_url($_url_params, 'text'); - $del_query = 'DELETE FROM ' . PMA_backquote($db) . '.' . PMA_backquote($table) - . ' WHERE ' . $where_clause . ($clause_is_unique ? '' : ' LIMIT 1'); + $del_query = 'DELETE FROM ' . PMA_backquote($db) . '.' + . PMA_backquote($table) + . ' WHERE ' . $where_clause . + ($clause_is_unique + ? '' + : ' LIMIT 1'); $_url_params = array( 'db' => $db, @@ -1433,7 +1596,8 @@ function PMA_displayTableBody(&$dt_result, &$is_display, $map, $analyzed_sql) ); $del_url = 'sql.php' . PMA_generate_common_url($_url_params); - $js_conf = 'DELETE FROM ' . PMA_jsFormat($db) . '.' . PMA_jsFormat($table) + $js_conf = 'DELETE FROM ' . PMA_jsFormat($db) . '.' + . PMA_jsFormat($table) . ' WHERE ' . PMA_jsFormat($where_clause, false) . ($clause_is_unique ? '' : ' LIMIT 1'); $del_str = PMA_getIcon('b_drop.png', __('Delete')); @@ -1445,7 +1609,8 @@ function PMA_displayTableBody(&$dt_result, &$is_display, $map, $analyzed_sql) 'sql_query' => $url_sql_query, 'goto' => 'main.php', ); - $lnk_goto = 'sql.php' . PMA_generate_common_url($_url_params, 'text'); + $lnk_goto = 'sql.php' . PMA_generate_common_url( + $_url_params, 'text'); $_url_params = array( 'db' => 'mysql', @@ -1459,22 +1624,31 @@ function PMA_displayTableBody(&$dt_result, &$is_display, $map, $analyzed_sql) } // end if (1.2.2) // 1.3 Displays the links at left if required - if (($GLOBALS['cfg']['RowActionLinks'] == 'left' || $GLOBALS['cfg']['RowActionLinks'] == 'both') + if (($GLOBALS['cfg']['RowActionLinks'] == 'left' + || $GLOBALS['cfg']['RowActionLinks'] == 'both') && ($_SESSION['tmp_user_values']['disp_direction'] == 'horizontal' - || $_SESSION['tmp_user_values']['disp_direction'] == 'horizontalflipped') + || $_SESSION['tmp_user_values']['disp_direction'] + == 'horizontalflipped') ) { if (! isset($js_conf)) { $js_conf = ''; } - 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); + 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); } elseif (($GLOBALS['cfg']['RowActionLinks'] == 'none') && ($_SESSION['tmp_user_values']['disp_direction'] == 'horizontal' - || $_SESSION['tmp_user_values']['disp_direction'] == 'horizontalflipped') + || $_SESSION['tmp_user_values']['disp_direction'] + == 'horizontalflipped') ) { if (! isset($js_conf)) { $js_conf = ''; } - 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); + 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); } // end if (1.3) } // end if (1) @@ -1488,10 +1662,14 @@ function PMA_displayTableBody(&$dt_result, &$is_display, $map, $analyzed_sql) $not_null_class = $meta->not_null ? 'not_null' : ''; $relation_class = isset($map[$meta->name]) ? 'relation' : ''; $hide_class = ($col_visib && !$col_visib[$j] && - // hide per
' . "\n"; if ($GLOBALS['cfg']['RowActionLinks'] == 'none') { - // if we are not showing the RowActionLinks, then we need to show the Multi-Row-Action checkboxes + // if we are not showing the RowActionLinks, then we need to show + // the Multi-Row-Action checkboxes echo '' . "\n"; } echo $vertical_display['textbtn']; $cell_displayed = 0; foreach ($vertical_display['row_delete'] as $val) { - if (($cell_displayed != 0) && ($_SESSION['tmp_user_values']['repeat_cells'] != 0) && !($cell_displayed % $_SESSION['tmp_user_values']['repeat_cells'])) { + if (($cell_displayed != 0) + && ($_SESSION['tmp_user_values']['repeat_cells'] != 0) + && !($cell_displayed % $_SESSION['tmp_user_values'] + ['repeat_cells'])) { echo '' . "\n"; } echo str_replace('[%_PMA_CHECKBOX_DIR_%]', '_left', $val); @@ -1878,9 +2175,11 @@ function PMA_displayVerticalTable() } // end if // Displays "edit" link at top if required - if (($GLOBALS['cfg']['RowActionLinks'] == 'left' || $GLOBALS['cfg']['RowActionLinks'] == 'both') + if (($GLOBALS['cfg']['RowActionLinks'] == 'left' + || $GLOBALS['cfg']['RowActionLinks'] == 'both') && is_array($vertical_display['edit']) - && (count($vertical_display['edit']) > 0 || !empty($vertical_display['textbtn'])) + && (count($vertical_display['edit']) > 0 + || !empty($vertical_display['textbtn'])) ) { echo '' . "\n"; if (! is_array($vertical_display['row_delete'])) { @@ -1893,9 +2192,11 @@ function PMA_displayVerticalTable() } // end if // Displays "copy" link at top if required - if (($GLOBALS['cfg']['RowActionLinks'] == 'left' || $GLOBALS['cfg']['RowActionLinks'] == 'both') + if (($GLOBALS['cfg']['RowActionLinks'] == 'left' + || $GLOBALS['cfg']['RowActionLinks'] == 'both') && is_array($vertical_display['copy']) - && (count($vertical_display['copy']) > 0 || !empty($vertical_display['textbtn'])) + && (count($vertical_display['copy']) > 0 + || !empty($vertical_display['textbtn'])) ) { echo '' . "\n"; if (! is_array($vertical_display['row_delete'])) { @@ -1908,12 +2209,15 @@ function PMA_displayVerticalTable() } // end if // Displays "delete" link at top if required - if (($GLOBALS['cfg']['RowActionLinks'] == 'left' || $GLOBALS['cfg']['RowActionLinks'] == 'both') + if (($GLOBALS['cfg']['RowActionLinks'] == 'left' + || $GLOBALS['cfg']['RowActionLinks'] == 'both') && is_array($vertical_display['delete']) - && (count($vertical_display['delete']) > 0 || !empty($vertical_display['textbtn'])) + && (count($vertical_display['delete']) > 0 + || !empty($vertical_display['textbtn'])) ) { echo '' . "\n"; - if (! is_array($vertical_display['edit']) && ! is_array($vertical_display['row_delete'])) { + if (! is_array($vertical_display['edit']) + && ! is_array($vertical_display['row_delete'])) { echo $vertical_display['textbtn']; } foreach ($vertical_display['delete'] as $val) { @@ -1937,12 +2241,16 @@ function PMA_displayVerticalTable() // assign appropriate key with current column order $key = $col_order ? $col_order[$j] : $j; - echo '' . "\n"; + echo '' . "\n"; echo $val; $cell_displayed = 0; foreach ($vertical_display['rowdata'][$key] as $subval) { - if (($cell_displayed != 0) && ($_SESSION['tmp_user_values']['repeat_cells'] != 0) and !($cell_displayed % $_SESSION['tmp_user_values']['repeat_cells'])) { + if (($cell_displayed != 0) + && ($_SESSION['tmp_user_values']['repeat_cells'] != 0) + && !($cell_displayed % $_SESSION['tmp_user_values'] + ['repeat_cells'])) { echo $val; } @@ -1954,17 +2262,23 @@ function PMA_displayVerticalTable() } // end while // Displays "multi row delete" link at bottom if required - if (($GLOBALS['cfg']['RowActionLinks'] == 'right' || $GLOBALS['cfg']['RowActionLinks'] == 'both') + if (($GLOBALS['cfg']['RowActionLinks'] == 'right' + || $GLOBALS['cfg']['RowActionLinks'] == 'both') && is_array($vertical_display['row_delete']) - && (count($vertical_display['row_delete']) > 0 || !empty($vertical_display['textbtn'])) + && (count($vertical_display['row_delete']) > 0 + || !empty($vertical_display['textbtn'])) ) { echo '' . "\n"; echo $vertical_display['textbtn']; $cell_displayed = 0; foreach ($vertical_display['row_delete'] as $val) { - if (($cell_displayed != 0) && ($_SESSION['tmp_user_values']['repeat_cells'] != 0) && !($cell_displayed % $_SESSION['tmp_user_values']['repeat_cells'])) { + if (($cell_displayed != 0) + && ($_SESSION['tmp_user_values']['repeat_cells'] != 0) + && !($cell_displayed % $_SESSION['tmp_user_values'] + ['repeat_cells'])) { echo '' . "\n"; } @@ -1975,9 +2289,11 @@ function PMA_displayVerticalTable() } // end if // Displays "edit" link at bottom if required - if (($GLOBALS['cfg']['RowActionLinks'] == 'right' || $GLOBALS['cfg']['RowActionLinks'] == 'both') + if (($GLOBALS['cfg']['RowActionLinks'] == 'right' + || $GLOBALS['cfg']['RowActionLinks'] == 'both') && is_array($vertical_display['edit']) - && (count($vertical_display['edit']) > 0 || !empty($vertical_display['textbtn'])) + && (count($vertical_display['edit']) > 0 + || !empty($vertical_display['textbtn'])) ) { echo '' . "\n"; if (! is_array($vertical_display['row_delete'])) { @@ -1990,9 +2306,11 @@ function PMA_displayVerticalTable() } // end if // Displays "copy" link at bottom if required - if (($GLOBALS['cfg']['RowActionLinks'] == 'right' || $GLOBALS['cfg']['RowActionLinks'] == 'both') + if (($GLOBALS['cfg']['RowActionLinks'] == 'right' + || $GLOBALS['cfg']['RowActionLinks'] == 'both') && is_array($vertical_display['copy']) - && (count($vertical_display['copy']) > 0 || !empty($vertical_display['textbtn'])) + && (count($vertical_display['copy']) > 0 + || !empty($vertical_display['textbtn'])) ) { echo '' . "\n"; if (! is_array($vertical_display['row_delete'])) { @@ -2005,12 +2323,15 @@ function PMA_displayVerticalTable() } // end if // Displays "delete" link at bottom if required - if (($GLOBALS['cfg']['RowActionLinks'] == 'right' || $GLOBALS['cfg']['RowActionLinks'] == 'both') + if (($GLOBALS['cfg']['RowActionLinks'] == 'right' + || $GLOBALS['cfg']['RowActionLinks'] == 'both') && is_array($vertical_display['delete']) - && (count($vertical_display['delete']) > 0 || !empty($vertical_display['textbtn'])) + && (count($vertical_display['delete']) > 0 + || !empty($vertical_display['textbtn'])) ) { echo '' . "\n"; - if (! is_array($vertical_display['edit']) && ! is_array($vertical_display['row_delete'])) { + if (! is_array($vertical_display['edit']) + && ! is_array($vertical_display['row_delete'])) { echo $vertical_display['textbtn']; } foreach ($vertical_display['delete'] as $val) { @@ -2039,18 +2360,25 @@ function PMA_displayTable_checkConfigParams() $_SESSION['tmp_user_values']['query'][$sql_md5]['sql'] = $GLOBALS['sql_query']; - if (PMA_isValid($_REQUEST['disp_direction'], array('horizontal', 'vertical', 'horizontalflipped'))) { - $_SESSION['tmp_user_values']['query'][$sql_md5]['disp_direction'] = $_REQUEST['disp_direction']; + if (PMA_isValid($_REQUEST['disp_direction'], + array('horizontal', 'vertical', 'horizontalflipped'))) { + $_SESSION['tmp_user_values']['query'][$sql_md5]['disp_direction'] + = $_REQUEST['disp_direction']; unset($_REQUEST['disp_direction']); - } elseif (empty($_SESSION['tmp_user_values']['query'][$sql_md5]['disp_direction'])) { - $_SESSION['tmp_user_values']['query'][$sql_md5]['disp_direction'] = $GLOBALS['cfg']['DefaultDisplay']; + } elseif (empty($_SESSION['tmp_user_values']['query'][$sql_md5] + ['disp_direction'])) { + $_SESSION['tmp_user_values']['query'][$sql_md5]['disp_direction'] + = $GLOBALS['cfg']['DefaultDisplay']; } if (PMA_isValid($_REQUEST['repeat_cells'], 'numeric')) { - $_SESSION['tmp_user_values']['query'][$sql_md5]['repeat_cells'] = $_REQUEST['repeat_cells']; + $_SESSION['tmp_user_values']['query'][$sql_md5]['repeat_cells'] + = $_REQUEST['repeat_cells']; unset($_REQUEST['repeat_cells']); - } elseif (empty($_SESSION['tmp_user_values']['query'][$sql_md5]['repeat_cells'])) { - $_SESSION['tmp_user_values']['query'][$sql_md5]['repeat_cells'] = $GLOBALS['cfg']['RepeatCells']; + } elseif (empty($_SESSION['tmp_user_values']['query'][$sql_md5] + ['repeat_cells'])) { + $_SESSION['tmp_user_values']['query'][$sql_md5]['repeat_cells'] + = $GLOBALS['cfg']['RepeatCells']; } // as this is a form value, the type is always string so we cannot @@ -2059,10 +2387,12 @@ function PMA_displayTable_checkConfigParams() && (int) $_REQUEST['session_max_rows'] == $_REQUEST['session_max_rows']) || $_REQUEST['session_max_rows'] == 'all' ) { - $_SESSION['tmp_user_values']['query'][$sql_md5]['max_rows'] = $_REQUEST['session_max_rows']; + $_SESSION['tmp_user_values']['query'][$sql_md5]['max_rows'] + = $_REQUEST['session_max_rows']; unset($_REQUEST['session_max_rows']); } elseif (empty($_SESSION['tmp_user_values']['query'][$sql_md5]['max_rows'])) { - $_SESSION['tmp_user_values']['query'][$sql_md5]['max_rows'] = $GLOBALS['cfg']['MaxRows']; + $_SESSION['tmp_user_values']['query'][$sql_md5]['max_rows'] + = $GLOBALS['cfg']['MaxRows']; } if (PMA_isValid($_REQUEST['pos'], 'numeric')) { @@ -2073,23 +2403,29 @@ function PMA_displayTable_checkConfigParams() } if (PMA_isValid($_REQUEST['display_text'], array('P', 'F'))) { - $_SESSION['tmp_user_values']['query'][$sql_md5]['display_text'] = $_REQUEST['display_text']; + $_SESSION['tmp_user_values']['query'][$sql_md5]['display_text'] + = $_REQUEST['display_text']; unset($_REQUEST['display_text']); - } elseif (empty($_SESSION['tmp_user_values']['query'][$sql_md5]['display_text'])) { + } elseif (empty($_SESSION['tmp_user_values']['query'][$sql_md5] + ['display_text'])) { $_SESSION['tmp_user_values']['query'][$sql_md5]['display_text'] = 'P'; } if (PMA_isValid($_REQUEST['relational_display'], array('K', 'D'))) { - $_SESSION['tmp_user_values']['query'][$sql_md5]['relational_display'] = $_REQUEST['relational_display']; + $_SESSION['tmp_user_values']['query'][$sql_md5]['relational_display'] + = $_REQUEST['relational_display']; unset($_REQUEST['relational_display']); - } elseif (empty($_SESSION['tmp_user_values']['query'][$sql_md5]['relational_display'])) { + } elseif (empty($_SESSION['tmp_user_values']['query'][$sql_md5] + ['relational_display'])) { $_SESSION['tmp_user_values']['query'][$sql_md5]['relational_display'] = 'K'; } if (PMA_isValid($_REQUEST['geometry_display'], array('WKT', 'WKB', 'GEOM'))) { - $_SESSION['tmp_user_values']['query'][$sql_md5]['geometry_display'] = $_REQUEST['geometry_display']; + $_SESSION['tmp_user_values']['query'][$sql_md5]['geometry_display'] = + $_REQUEST['geometry_display']; unset($_REQUEST['geometry_display']); - } elseif (empty($_SESSION['tmp_user_values']['query'][$sql_md5]['geometry_display'])) { + } elseif (empty($_SESSION['tmp_user_values']['query'][$sql_md5] + ['geometry_display'])) { $_SESSION['tmp_user_values']['query'][$sql_md5]['geometry_display'] = 'GEOM'; } @@ -2109,17 +2445,21 @@ function PMA_displayTable_checkConfigParams() } if (isset($_REQUEST['display_binary_as_hex'])) { - $_SESSION['tmp_user_values']['query'][$sql_md5]['display_binary_as_hex'] = true; + $_SESSION['tmp_user_values']['query'][$sql_md5]['display_binary_as_hex'] + = true; unset($_REQUEST['display_binary_as_hex']); } elseif (isset($_REQUEST['display_options_form'])) { // we know that the checkbox was unchecked - unset($_SESSION['tmp_user_values']['query'][$sql_md5]['display_binary_as_hex']); + unset($_SESSION['tmp_user_values']['query'][$sql_md5] + ['display_binary_as_hex']); } elseif (isset($_REQUEST['full_text_button'])) { // do nothing to keep the value that is there in the session } else { // display_binary_as_hex config option - if (isset($GLOBALS['cfg']['DisplayBinaryAsHex']) && true === $GLOBALS['cfg']['DisplayBinaryAsHex']) { - $_SESSION['tmp_user_values']['query'][$sql_md5]['display_binary_as_hex'] = true; + if (isset($GLOBALS['cfg']['DisplayBinaryAsHex']) + && true === $GLOBALS['cfg']['DisplayBinaryAsHex']) { + $_SESSION['tmp_user_values']['query'][$sql_md5]['display_binary_as_hex'] + = true; } } @@ -2132,11 +2472,13 @@ function PMA_displayTable_checkConfigParams() } if (isset($_REQUEST['hide_transformation'])) { - $_SESSION['tmp_user_values']['query'][$sql_md5]['hide_transformation'] = true; + $_SESSION['tmp_user_values']['query'][$sql_md5]['hide_transformation'] + = true; unset($_REQUEST['hide_transformation']); } elseif (isset($_REQUEST['display_options_form'])) { // we know that the checkbox was unchecked - unset($_SESSION['tmp_user_values']['query'][$sql_md5]['hide_transformation']); + unset($_SESSION['tmp_user_values']['query'][$sql_md5] + ['hide_transformation']); } // move current query to the last position, to be removed last @@ -2153,32 +2495,46 @@ function PMA_displayTable_checkConfigParams() } // populate query configuration - $_SESSION['tmp_user_values']['display_text'] = $_SESSION['tmp_user_values']['query'][$sql_md5]['display_text']; - $_SESSION['tmp_user_values']['relational_display'] = $_SESSION['tmp_user_values']['query'][$sql_md5]['relational_display']; - $_SESSION['tmp_user_values']['geometry_display'] = $_SESSION['tmp_user_values']['query'][$sql_md5]['geometry_display']; - $_SESSION['tmp_user_values']['display_binary'] = isset($_SESSION['tmp_user_values']['query'][$sql_md5]['display_binary']) ? true : false; - $_SESSION['tmp_user_values']['display_binary_as_hex'] = isset($_SESSION['tmp_user_values']['query'][$sql_md5]['display_binary_as_hex']) ? true : false; - $_SESSION['tmp_user_values']['display_blob'] = isset($_SESSION['tmp_user_values']['query'][$sql_md5]['display_blob']) ? true : false; - $_SESSION['tmp_user_values']['hide_transformation'] = isset($_SESSION['tmp_user_values']['query'][$sql_md5]['hide_transformation']) ? true : false; - $_SESSION['tmp_user_values']['pos'] = $_SESSION['tmp_user_values']['query'][$sql_md5]['pos']; - $_SESSION['tmp_user_values']['max_rows'] = $_SESSION['tmp_user_values']['query'][$sql_md5]['max_rows']; - $_SESSION['tmp_user_values']['repeat_cells'] = $_SESSION['tmp_user_values']['query'][$sql_md5]['repeat_cells']; - $_SESSION['tmp_user_values']['disp_direction'] = $_SESSION['tmp_user_values']['query'][$sql_md5]['disp_direction']; - - /* - * debugging - echo '
';
-    var_dump($_SESSION['tmp_user_values']);
-    echo '
'; - */ + $_SESSION['tmp_user_values']['display_text'] + = $_SESSION['tmp_user_values']['query'][$sql_md5]['display_text']; + $_SESSION['tmp_user_values']['relational_display'] + = $_SESSION['tmp_user_values']['query'][$sql_md5]['relational_display']; + $_SESSION['tmp_user_values']['geometry_display'] + = $_SESSION['tmp_user_values']['query'][$sql_md5]['geometry_display']; + $_SESSION['tmp_user_values']['display_binary'] + = isset($_SESSION['tmp_user_values']['query'][$sql_md5]['display_binary']) + ? true + : false; + $_SESSION['tmp_user_values']['display_binary_as_hex'] + = isset($_SESSION['tmp_user_values']['query'][$sql_md5] + ['display_binary_as_hex']) + ? true + : false; + $_SESSION['tmp_user_values']['display_blob'] + = isset($_SESSION['tmp_user_values']['query'][$sql_md5]['display_blob']) + ? true + : false; + $_SESSION['tmp_user_values']['hide_transformation'] + = isset($_SESSION['tmp_user_values']['query'][$sql_md5] + ['hide_transformation']) + ? true + : false; + $_SESSION['tmp_user_values']['pos'] + = $_SESSION['tmp_user_values']['query'][$sql_md5]['pos']; + $_SESSION['tmp_user_values']['max_rows'] + = $_SESSION['tmp_user_values']['query'][$sql_md5]['max_rows']; + $_SESSION['tmp_user_values']['repeat_cells'] + = $_SESSION['tmp_user_values']['query'][$sql_md5]['repeat_cells']; + $_SESSION['tmp_user_values']['disp_direction'] + = $_SESSION['tmp_user_values']['query'][$sql_md5]['disp_direction']; } /** * Displays a table of results returned by a SQL query. * This function is called by the "sql.php" script. * - * @param integer &$dt_result the link id associated to the query which results have - * to be displayed + * @param integer &$dt_result the link id associated to the query + * which results have to be displayed * @param array &$the_disp_mode the display mode * @param array $analyzed_sql the analyzed query * @@ -2228,11 +2584,13 @@ function PMA_displayTable(&$dt_result, &$the_disp_mode, $analyzed_sql) if ($is_innodb && ! isset($analyzed_sql[0]['queryflags']['union']) && ! isset($analyzed_sql[0]['table_ref'][1]['table_name']) - && (empty($analyzed_sql[0]['where_clause']) || $analyzed_sql[0]['where_clause'] == '1 ') + && (empty($analyzed_sql[0]['where_clause']) + || $analyzed_sql[0]['where_clause'] == '1 ') ) { // "j u s t b r o w s i n g" $pre_count = '~'; - $after_count = PMA_showHint(PMA_sanitize(__('May be approximate. See [a@./Documentation.html#faq3_11@Documentation]FAQ 3.11[/a]'))); + $after_count = PMA_showHint(PMA_sanitize(__( + 'May be approximate. See [a@./Documentation.html#faq3_11@Documentation]FAQ 3.11[/a]'))); } else { $pre_count = ''; $after_count = ''; @@ -2251,8 +2609,10 @@ function PMA_displayTable(&$dt_result, &$the_disp_mode, $analyzed_sql) $pos_next = 0; $pos_prev = 0; } else { - $pos_next = $_SESSION['tmp_user_values']['pos'] + $_SESSION['tmp_user_values']['max_rows']; - $pos_prev = $_SESSION['tmp_user_values']['pos'] - $_SESSION['tmp_user_values']['max_rows']; + $pos_next = $_SESSION['tmp_user_values']['pos'] + + $_SESSION['tmp_user_values']['max_rows']; + $pos_prev = $_SESSION['tmp_user_values']['pos'] + - $_SESSION['tmp_user_values']['max_rows']; if ($pos_prev < 0) { $pos_prev = 0; } @@ -2264,12 +2624,15 @@ function PMA_displayTable(&$dt_result, &$the_disp_mode, $analyzed_sql) // we need $sort_expression and $sort_expression_nodirection // even if there are many table references if (! empty($analyzed_sql[0]['order_by_clause'])) { - $sort_expression = trim(str_replace(' ', ' ', $analyzed_sql[0]['order_by_clause'])); + $sort_expression = trim(str_replace(' ', ' ', + $analyzed_sql[0]['order_by_clause'])); /** * Get rid of ASC|DESC */ preg_match('@(.*)([[:space:]]*(ASC|DESC))@si', $sort_expression, $matches); - $sort_expression_nodirection = isset($matches[1]) ? trim($matches[1]) : $sort_expression; + $sort_expression_nodirection = isset($matches[1]) + ? trim($matches[1]) + : $sort_expression; $sort_direction = isset($matches[2]) ? trim($matches[2]) : ''; unset($matches); } else { @@ -2283,7 +2646,8 @@ function PMA_displayTable(&$dt_result, &$the_disp_mode, $analyzed_sql) $sort_table = $table; $sort_column = $sort_expression_nodirection; } else { - list($sort_table, $sort_column) = explode('.', $sort_expression_nodirection); + list($sort_table, $sort_column) + = explode('.', $sort_expression_nodirection); } $sort_table = PMA_unQuote($sort_table); $sort_column = PMA_unQuote($sort_column); @@ -2306,27 +2670,36 @@ function PMA_displayTable(&$dt_result, &$the_disp_mode, $analyzed_sql) // check for non printable sorted row data $meta = $fields_meta[$sorted_column_index]; if (stristr($meta->type, 'BLOB') || $meta->type == 'geometry') { - $column_for_first_row = PMA_handle_non_printable_contents($meta->type, $row[$sorted_column_index], $transform_function, $transform_options, $default_function, $meta, null); + $column_for_first_row = PMA_handle_non_printable_contents( + $meta->type, $row[$sorted_column_index], $transform_function, + $transform_options, $default_function, $meta, null); } else { $column_for_first_row = $row[$sorted_column_index]; } - $column_for_first_row = strtoupper(substr($column_for_first_row, 0, $GLOBALS['cfg']['LimitChars'])); + $column_for_first_row = strtoupper(substr($column_for_first_row, 0, + $GLOBALS['cfg']['LimitChars'])); // fetch last row of the result set PMA_DBI_data_seek($dt_result, $num_rows - 1); $row = PMA_DBI_fetch_row($dt_result); // check for non printable sorted row data $meta = $fields_meta[$sorted_column_index]; if (stristr($meta->type, 'BLOB') || $meta->type == 'geometry') { - $column_for_last_row = PMA_handle_non_printable_contents($meta->type, $row[$sorted_column_index], $transform_function, $transform_options, $default_function, $meta, null); + $column_for_last_row = PMA_handle_non_printable_contents($meta->type, + $row[$sorted_column_index], $transform_function, + $transform_options, $default_function, $meta, null); } else { $column_for_last_row = $row[$sorted_column_index]; } - $column_for_last_row = strtoupper(substr($column_for_last_row, 0, $GLOBALS['cfg']['LimitChars'])); + $column_for_last_row = strtoupper(substr($column_for_last_row, 0, + $GLOBALS['cfg']['LimitChars'])); // reset to first row for the loop in PMA_displayTableBody() PMA_DBI_data_seek($dt_result, 0); // we could also use here $sort_expression_nodirection - $sorted_column_message = ' [' . htmlspecialchars($sort_column) . ': ' . htmlspecialchars($column_for_first_row) . ' - ' . htmlspecialchars($column_for_last_row) . ']'; - unset($row, $column_for_first_row, $column_for_last_row, $meta, $default_function, $transform_function, $transform_options); + $sorted_column_message = ' [' . htmlspecialchars($sort_column) + . ': ' . htmlspecialchars($column_for_first_row) . ' - ' + . htmlspecialchars($column_for_last_row) . ']'; + unset($row, $column_for_first_row, $column_for_last_row, $meta, + $default_function, $transform_function, $transform_options); } unset($sorted_column_index, $sort_table, $sort_column); } @@ -2349,7 +2722,8 @@ function PMA_displayTable(&$dt_result, &$the_disp_mode, $analyzed_sql) } else { $last_shown_rec = $limit_data['start'] + $total - 1; } - } elseif ($_SESSION['tmp_user_values']['max_rows'] == 'all' || $pos_next > $total) { + } elseif ($_SESSION['tmp_user_values']['max_rows'] == 'all' + || $pos_next > $total) { $first_shown_rec = $_SESSION['tmp_user_values']['pos']; $last_shown_rec = $total - 1; } else { @@ -2360,7 +2734,8 @@ function PMA_displayTable(&$dt_result, &$the_disp_mode, $analyzed_sql) if (PMA_Table::isView($db, $table) && $total == $GLOBALS['cfg']['MaxExactCountViews'] ) { - $message = PMA_Message::notice(__('This view has at least this number of rows. Please refer to %sdocumentation%s.')); + $message = PMA_Message::notice(__( + 'This view has at least this number of rows. Please refer to %sdocumentation%s.')); $message->addParam('[a@./Documentation.html#cfg_MaxExactCount@_blank]'); $message->addParam('[/a]'); $message_view_warning = PMA_showHint($message); @@ -2397,7 +2772,8 @@ function PMA_displayTable(&$dt_result, &$the_disp_mode, $analyzed_sql) PMA_showMessage($message, $sql_query, 'success'); } elseif (! isset($GLOBALS['printview']) || $GLOBALS['printview'] != '1') { - PMA_showMessage(__('Your SQL query has been executed successfully'), $sql_query, 'success'); + PMA_showMessage(__('Your SQL query has been executed successfully'), + $sql_query, 'success'); } // 2.3 Displays the navigation bars @@ -2415,7 +2791,8 @@ function PMA_displayTable(&$dt_result, &$the_disp_mode, $analyzed_sql) } if ($is_display['nav_bar'] == '1' && empty($analyzed_sql[0]['limit_clause'])) { - PMA_displayTableNavigation($pos_next, $pos_prev, $sql_query, 'top_direction_dropdown'); + PMA_displayTableNavigation($pos_next, $pos_prev, $sql_query, + 'top_direction_dropdown'); echo "\n"; } elseif (! isset($GLOBALS['printview']) || $GLOBALS['printview'] != '1') { echo "\n" . '

' . "\n"; @@ -2429,9 +2806,12 @@ function PMA_displayTable(&$dt_result, &$the_disp_mode, $analyzed_sql) // find tables $target=array(); - if (isset($analyzed_sql[0]['table_ref']) && is_array($analyzed_sql[0]['table_ref'])) { - foreach ($analyzed_sql[0]['table_ref'] AS $table_ref_position => $table_ref) { - $target[] = $analyzed_sql[0]['table_ref'][$table_ref_position]['table_true_name']; + if (isset($analyzed_sql[0]['table_ref']) + && is_array($analyzed_sql[0]['table_ref'])) { + foreach ($analyzed_sql[0]['table_ref'] + as $table_ref_position => $table_ref) { + $target[] = $analyzed_sql[0]['table_ref'][$table_ref_position] + ['table_true_name']; } } $tabs = '(\'' . join('\',\'', $target) . '\')'; @@ -2447,8 +2827,9 @@ function PMA_displayTable(&$dt_result, &$the_disp_mode, $analyzed_sql) // the name related to a numeric id). $exist_rel = PMA_getForeigners($db, $table, '', 'both'); if ($exist_rel) { - foreach ($exist_rel AS $master_field => $rel) { - $display_field = PMA_getDisplayField($rel['foreign_db'], $rel['foreign_table']); + foreach ($exist_rel as $master_field => $rel) { + $display_field = PMA_getDisplayField($rel['foreign_db'], + $rel['foreign_table']); $map[$master_field] = array($rel['foreign_table'], $rel['foreign_field'], $display_field, @@ -2459,10 +2840,12 @@ function PMA_displayTable(&$dt_result, &$the_disp_mode, $analyzed_sql) // end 2b // 3. ----- Displays the results table ----- - PMA_displayTableHeaders($is_display, $fields_meta, $fields_cnt, $analyzed_sql, $sort_expression, $sort_expression_nodirection, $sort_direction); + PMA_displayTableHeaders($is_display, $fields_meta, $fields_cnt, $analyzed_sql, + $sort_expression, $sort_expression_nodirection, $sort_direction); $url_query = ''; echo '' . "\n"; - $clause_is_unique = PMA_displayTableBody($dt_result, $is_display, $map, $analyzed_sql); + $clause_is_unique = PMA_displayTableBody($dt_result, $is_display, $map, + $analyzed_sql); // vertical output case if ($_SESSION['tmp_user_values']['disp_direction'] == 'vertical') { PMA_displayVerticalTable(); @@ -2491,17 +2874,24 @@ function PMA_displayTable(&$dt_result, &$the_disp_mode, $analyzed_sql) $checkall_url = 'sql.php' . PMA_generate_common_url($_url_params); if ($_SESSION['tmp_user_values']['disp_direction'] == 'vertical') { - $checkall_params['onclick'] = 'if (setCheckboxes(\'resultsForm\', true)) return false;'; - $uncheckall_params['onclick'] = 'if (setCheckboxes(\'resultsForm\', false)) return false;'; + $checkall_params['onclick'] + = 'if (setCheckboxes(\'resultsForm\', true)) return false;'; + $uncheckall_params['onclick'] + = 'if (setCheckboxes(\'resultsForm\', false)) return false;'; } else { - $checkall_params['onclick'] = 'if (markAllRows(\'resultsForm\')) return false;'; - $uncheckall_params['onclick'] = 'if (unMarkAllRows(\'resultsForm\')) return false;'; + $checkall_params['onclick'] + = 'if (markAllRows(\'resultsForm\')) return false;'; + $uncheckall_params['onclick'] + = 'if (unMarkAllRows(\'resultsForm\')) return false;'; } - $checkall_link = PMA_linkOrButton($checkall_url, __('Check All'), $checkall_params, false); - $uncheckall_link = PMA_linkOrButton($uncheckall_url, __('Uncheck All'), $uncheckall_params, false); + $checkall_link = PMA_linkOrButton($checkall_url, __('Check All'), + $checkall_params, false); + $uncheckall_link = PMA_linkOrButton($uncheckall_url, __('Uncheck All'), + $uncheckall_params, false); if ($_SESSION['tmp_user_values']['disp_direction'] != 'vertical') { echo '' . __('With selected:') . ''; } echo $checkall_link . "\n" @@ -2543,7 +2933,8 @@ function PMA_displayTable(&$dt_result, &$the_disp_mode, $analyzed_sql) if ($is_display['nav_bar'] == '1' && empty($analyzed_sql[0]['limit_clause'])) { echo '
' . "\n"; - PMA_displayTableNavigation($pos_next, $pos_prev, $sql_query, 'bottom_direction_dropdown'); + PMA_displayTableNavigation($pos_next, $pos_prev, $sql_query, + 'bottom_direction_dropdown'); } elseif (! isset($GLOBALS['printview']) || $GLOBALS['printview'] != '1') { echo "\n" . '

' . "\n"; } @@ -2557,7 +2948,10 @@ function PMA_displayTable(&$dt_result, &$the_disp_mode, $analyzed_sql) function default_function($buffer) { $buffer = htmlspecialchars($buffer); - $buffer = str_replace("\011", '    ', str_replace(' ', '  ', $buffer)); + $buffer = str_replace( + "\011", + '    ', + str_replace(' ', '  ', $buffer)); $buffer = preg_replace("@((\015\012)|(\015)|(\012))@", '
', $buffer); return $buffer; @@ -2618,7 +3012,8 @@ function PMA_displayResultsOperations($the_disp_mode, $analyzed_sql) $_url_params['display_text'] = 'F'; echo PMA_linkOrButton( 'sql.php' . PMA_generate_common_url($_url_params), - PMA_getIcon('b_print.png', __('Print view (with full texts)'), true), + PMA_getIcon('b_print.png', __('Print view (with full texts)'), + true), '', true, true, 'print_view' ) . "\n"; unset($_url_params['display_text']); @@ -2633,8 +3028,12 @@ function PMA_displayResultsOperations($the_disp_mode, $analyzed_sql) // If the parser found a PROCEDURE clause // (most probably PROCEDURE ANALYSE()) it makes no sense to // display the Export link). - if (isset($analyzed_sql[0]) && $analyzed_sql[0]['querytype'] == 'SELECT' && ! isset($printview) && ! isset($analyzed_sql[0]['queryflags']['procedure'])) { - if (isset($analyzed_sql[0]['table_ref'][0]['table_true_name']) && ! isset($analyzed_sql[0]['table_ref'][1]['table_true_name'])) { + if (isset($analyzed_sql[0]) + && $analyzed_sql[0]['querytype'] == 'SELECT' + && ! isset($printview) + && ! isset($analyzed_sql[0]['queryflags']['procedure'])) { + if (isset($analyzed_sql[0]['table_ref'][0]['table_true_name']) + && ! isset($analyzed_sql[0]['table_ref'][1]['table_true_name'])) { $_url_params['single_table'] = 'true'; } if (!$header_shown) { @@ -2730,7 +3129,8 @@ function PMA_displayResultsOperations($the_disp_mode, $analyzed_sql) * * @return mixed string or float */ -function PMA_handle_non_printable_contents($category, $content, $transform_function, $transform_options, $default_function, $meta, $url_params = array()) +function PMA_handle_non_printable_contents($category, $content, $transform_function, + $transform_options, $default_function, $meta, $url_params = array()) { $result = '[' . $category; if (is_null($content)) { @@ -2751,13 +3151,15 @@ function PMA_handle_non_printable_contents($category, $content, $transform_funct $result = $transform_function($result, $transform_options, $meta); } else { $result = $default_function($result, array(), $meta); - if (stristr($meta->type, 'BLOB') && $_SESSION['tmp_user_values']['display_blob']) { + if (stristr($meta->type, 'BLOB') + && $_SESSION['tmp_user_values']['display_blob']) { // in this case, restart from the original $content $result = htmlspecialchars(PMA_replace_binary_contents($content)); } /* Create link to download */ if (count($url_params) > 0) { - $result = '' . $result . ''; + $result = '' . $result . ''; } } } @@ -2783,18 +3185,24 @@ function PMA_handle_non_printable_contents($category, $content, $transform_funct * * @return string formatted data */ -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 ) +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 ) { global $db; - $result = ' class="' . PMA_addClass($class, $condition_field, $meta, $nowrap, $is_field_truncated, $transform_function, $default_function) . '">'; + $result = ' class="' . PMA_addClass($class, $condition_field, $meta, $nowrap, + $is_field_truncated, $transform_function, $default_function) . '">'; - if (isset($analyzed_sql[0]['select_expr']) && is_array($analyzed_sql[0]['select_expr'])) { - foreach ($analyzed_sql[0]['select_expr'] AS $select_expr_position => $select_expr) { + if (isset($analyzed_sql[0]['select_expr']) + && is_array($analyzed_sql[0]['select_expr'])) { + foreach ($analyzed_sql[0]['select_expr'] + as $select_expr_position => $select_expr) { $alias = $analyzed_sql[0]['select_expr'][$select_expr_position]['alias']; if (isset($alias) && strlen($alias)) { - $true_column = $analyzed_sql[0]['select_expr'][$select_expr_position]['column']; + $true_column = $analyzed_sql[0]['select_expr'][$select_expr_position] + ['column']; if ($alias == $meta->name) { // this change in the parameter does not matter // outside of the function @@ -2824,13 +3232,17 @@ function PMA_prepare_row_data($class, $condition_field, $analyzed_sql, $meta, $m } // end if... else... if (isset($GLOBALS['printview']) && $GLOBALS['printview'] == '1') { - $result .= ($transform_function != $default_function ? $transform_function($data, $transform_options, $meta) : $transform_function($data, array(), $meta)) . ' [->' . $dispval . ']'; + $result .= ($transform_function != $default_function + ? $transform_function($data, $transform_options, $meta) + : $transform_function($data, array(), $meta)) + . ' [->' . $dispval . ']'; } else { if ('K' == $_SESSION['tmp_user_values']['relational_display']) { // user chose "relational key" in the display options, so // the title contains the display field - $title = (! empty($dispval))? ' title="' . htmlspecialchars($dispval) . '"' : ''; + $title = (! empty($dispval))? ' title="' . htmlspecialchars($dispval) + . '"' : ''; } else { $title = ' title="' . htmlspecialchars($data) . '"'; } @@ -2840,7 +3252,8 @@ function PMA_prepare_row_data($class, $condition_field, $analyzed_sql, $meta, $m 'table' => $map[$meta->name][0], 'pos' => '0', 'sql_query' => 'SELECT * FROM ' - . PMA_backquote($map[$meta->name][3]) . '.' . PMA_backquote($map[$meta->name][0]) + . PMA_backquote($map[$meta->name][3]) . '.' + . PMA_backquote($map[$meta->name][0]) . ' WHERE ' . PMA_backquote($map[$meta->name][1]) . $where_comparison, ); @@ -2864,7 +3277,9 @@ function PMA_prepare_row_data($class, $condition_field, $analyzed_sql, $meta, $m $result .= ''; } } else { - $result .= ($transform_function != $default_function ? $transform_function($data, $transform_options, $meta) : $transform_function($data, array(), $meta)); + $result .= ($transform_function != $default_function + ? $transform_function($data, $transform_options, $meta) + : $transform_function($data, array(), $meta)); } // create hidden field if results from structure table @@ -2877,12 +3292,15 @@ function PMA_prepare_row_data($class, $condition_field, $analyzed_sql, $meta, $m 'table' => $meta->orgtable, 'pos' => '0', 'sql_query' => 'SELECT * FROM ' - . PMA_backquote($db) . '.' . PMA_backquote($meta->orgtable) - . ' WHERE ' . PMA_backquote($meta->orgname) + . PMA_backquote($db) . '.' + . PMA_backquote($meta->orgtable) + . ' WHERE ' + . PMA_backquote($meta->orgname) . $where_comparison, ); - $result .= ''; + $result .= ''; } @@ -2895,7 +3313,8 @@ function PMA_prepare_row_data($class, $condition_field, $analyzed_sql, $meta, $m * Generates a checkbox for multi-row submits * * @param string $del_url delete url - * @param array $is_display array with explicit indexes for all the display elements + * @param array $is_display array with explicit indexes for all + * the display elements * @param string $row_no the row number * @param string $where_clause_html url encoded where cluase * @param array $condition_array array of conditions in the where cluase @@ -2906,7 +3325,8 @@ function PMA_prepare_row_data($class, $condition_field, $analyzed_sql, $meta, $m * @return string the generated HTML */ -function PMA_generateCheckboxForMulti($del_url, $is_display, $row_no, $where_clause_html, $condition_array, $del_query, $id_suffix, $class) +function PMA_generateCheckboxForMulti($del_url, $is_display, $row_no, + $where_clause_html, $condition_array, $del_query, $id_suffix, $class) { $ret = ''; if (! empty($del_url) && $is_display['del_lnk'] != 'kp') { @@ -2915,10 +3335,15 @@ function PMA_generateCheckboxForMulti($del_url, $is_display, $row_no, $where_cla $ret .= 'class="' . $class . '"'; } $ret .= ' class="center">' - . '' - . '' + . ' value="' . $where_clause_html . '" ' + . (isset($GLOBALS['checkall']) + ? 'checked="checked"' + : '') . ' />' + . '' . ' '; } return $ret; @@ -2935,7 +3360,8 @@ function PMA_generateCheckboxForMulti($del_url, $is_display, $row_no, $where_cla * * @return string the generated HTML */ -function PMA_generateEditLink($edit_url, $class, $edit_str, $where_clause, $where_clause_html) +function PMA_generateEditLink($edit_url, $class, $edit_str, $where_clause, + $where_clause_html) { $ret = ''; if (! empty($edit_url)) { @@ -2946,7 +3372,8 @@ function PMA_generateEditLink($edit_url, $class, $edit_str, $where_clause, $wher * a hidden input. Used by jQuery scripts for handling grid editing */ if (! empty($where_clause)) { - $ret .= ''; + $ret .= ''; } $ret .= ''; } @@ -2964,7 +3391,8 @@ function PMA_generateEditLink($edit_url, $class, $edit_str, $where_clause, $wher * * @return string the generated HTML */ -function PMA_generateCopyLink($copy_url, $copy_str, $where_clause, $where_clause_html, $class) +function PMA_generateCopyLink($copy_url, $copy_str, $where_clause, + $where_clause_html, $class) { $ret = ''; if (! empty($copy_url)) { @@ -2979,7 +3407,8 @@ function PMA_generateCopyLink($copy_url, $copy_str, $where_clause, $where_clause * a hidden input. Used by jQuery scripts for handling grid editing */ if (! empty($where_clause)) { - $ret .= ''; + $ret .= ''; } $ret .= ''; } @@ -3034,29 +3463,41 @@ function PMA_generateDeleteLink($del_url, $del_str, $js_conf, $class) * * @return string the generated HTML */ -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) +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) { $ret = ''; if ($position == 'left') { - $ret .= PMA_generateCheckboxForMulti($del_url, $is_display, $row_no, $where_clause_html, $condition_array, $del_query, $id_suffix = '_left', '', '', ''); + $ret .= PMA_generateCheckboxForMulti($del_url, $is_display, $row_no, + $where_clause_html, $condition_array, $del_query, $id_suffix = '_left', + '', '', ''); - $ret .= PMA_generateEditLink($edit_url, $class, $edit_str, $where_clause, $where_clause_html, ''); + $ret .= PMA_generateEditLink($edit_url, $class, $edit_str, $where_clause, + $where_clause_html, ''); - $ret .= PMA_generateCopyLink($copy_url, $copy_str, $where_clause, $where_clause_html, ''); + $ret .= PMA_generateCopyLink($copy_url, $copy_str, $where_clause, + $where_clause_html, ''); $ret .= PMA_generateDeleteLink($del_url, $del_str, $js_conf, '', ''); } elseif ($position == 'right') { $ret .= PMA_generateDeleteLink($del_url, $del_str, $js_conf, '', ''); - $ret .= PMA_generateCopyLink($copy_url, $copy_str, $where_clause, $where_clause_html, ''); + $ret .= PMA_generateCopyLink($copy_url, $copy_str, $where_clause, + $where_clause_html, ''); - $ret .= PMA_generateEditLink($edit_url, $class, $edit_str, $where_clause, $where_clause_html, ''); + $ret .= PMA_generateEditLink($edit_url, $class, $edit_str, $where_clause, + $where_clause_html, ''); - $ret .= PMA_generateCheckboxForMulti($del_url, $is_display, $row_no, $where_clause_html, $condition_array, $del_query, $id_suffix = '_right', '', '', ''); + $ret .= PMA_generateCheckboxForMulti($del_url, $is_display, $row_no, + $where_clause_html, $condition_array, $del_query, $id_suffix = '_right', + '', '', ''); } else { // $position == 'none' - $ret .= PMA_generateCheckboxForMulti($del_url, $is_display, $row_no, $where_clause_html, $condition_array, $del_query, $id_suffix = '_left', '', '', ''); + $ret .= PMA_generateCheckboxForMulti($del_url, $is_display, $row_no, + $where_clause_html, $condition_array, $del_query, $id_suffix = '_left', + '', '', ''); } return $ret; }
>> ' . "\n" + . ' ' . "\n" + . ' ' . "\n" - . $order_link . $comments . ' ' . "\n" - . ' ' . htmlspecialchars($fields_meta[$i]->name) . "\n" - . $comments . ' ' . "\n" + . ' ' . "\n" + . ' ' . $value . '' . $value . 'NULLNULL
' . "\n" - .'  ' + . "\n".'  ' . "\n" - .'  ' + . "\n" . '  
only if the display direction is not vertical - $_SESSION['tmp_user_values']['disp_direction'] != 'vertical') ? 'hide' : ''; + // hide per only if the display dir is not vertical + $_SESSION['tmp_user_values']['disp_direction'] + != 'vertical') + ? 'hide' + : ''; // handle datetime-related class, for grid editing - if (substr($meta->type, 0, 9) == 'timestamp' || $meta->type == 'datetime') { + if (substr($meta->type, 0, 9) == 'timestamp' + || $meta->type == 'datetime') { $field_type_class = 'datetimefield'; } else if ($meta->type == 'date') { $field_type_class = 'datefield'; @@ -1502,17 +1680,22 @@ function PMA_displayTableBody(&$dt_result, &$is_display, $map, $analyzed_sql) $is_field_truncated = false; //If the previous column had blob data, we need to reset the class // to $inline_edit_class - $class = 'data ' . $grid_edit_class . ' ' . $not_null_class . ' ' . $relation_class . ' ' . $hide_class . ' ' . $field_type_class; //' ' . $alternating_color_class . + $class = 'data ' . $grid_edit_class . ' ' . $not_null_class . ' ' + . $relation_class . ' ' . $hide_class . ' ' . $field_type_class; + //' ' . $alternating_color_class . // See if this column should get highlight because it's used in the // where-query. - if (isset($highlight_columns) && (isset($highlight_columns[$meta->name]) || isset($highlight_columns[PMA_backquote($meta->name)]))) { + if (isset($highlight_columns) && (isset($highlight_columns[$meta->name]) + || isset($highlight_columns[PMA_backquote($meta->name)]))) { $condition_field = true; } else { $condition_field = false; } - if ($_SESSION['tmp_user_values']['disp_direction'] == 'vertical' && (! isset($GLOBALS['printview']) || ($GLOBALS['printview'] != '1'))) { + if ($_SESSION['tmp_user_values']['disp_direction'] == 'vertical' + && (! isset($GLOBALS['printview']) + || ($GLOBALS['printview'] != '1'))) { // the row number corresponds to a data row, not HTML table row $class .= ' row_' . $row_no; if ($GLOBALS['cfg']['BrowsePointerEnable'] == true) { @@ -1528,20 +1711,37 @@ function PMA_displayTableBody(&$dt_result, &$is_display, $map, $analyzed_sql) $transform_function = $default_function; $transform_options = array(); - if ($GLOBALS['cfgRelation']['mimework'] && $GLOBALS['cfg']['BrowseMIME']) { + if ($GLOBALS['cfgRelation']['mimework'] + && $GLOBALS['cfg']['BrowseMIME']) { - if (isset($GLOBALS['mime_map'][$meta->name]['mimetype']) && isset($GLOBALS['mime_map'][$meta->name]['transformation']) && !empty($GLOBALS['mime_map'][$meta->name]['transformation'])) { - $include_file = PMA_securePath($GLOBALS['mime_map'][$meta->name]['transformation']); + if (isset($GLOBALS['mime_map'][$meta->name]['mimetype']) + && isset($GLOBALS['mime_map'][$meta->name]['transformation']) + && !empty($GLOBALS['mime_map'][$meta->name] + ['transformation'])) { + $include_file = PMA_securePath( + $GLOBALS['mime_map'][$meta->name]['transformation']); - if (file_exists('./libraries/transformations/' . $include_file)) { - $transformfunction_name = str_replace('.inc.php', '', $GLOBALS['mime_map'][$meta->name]['transformation']); + if (file_exists('./libraries/transformations/' + . $include_file)) { + $transformfunction_name = str_replace( + '.inc.php', '', + $GLOBALS['mime_map'][$meta->name]['transformation']); include_once './libraries/transformations/' . $include_file; - if (function_exists('PMA_transformation_' . $transformfunction_name)) { - $transform_function = 'PMA_transformation_' . $transformfunction_name; - $transform_options = PMA_transformation_getOptions((isset($GLOBALS['mime_map'][$meta->name]['transformation_options']) ? $GLOBALS['mime_map'][$meta->name]['transformation_options'] : '')); - $meta->mimetype = str_replace('_', '/', $GLOBALS['mime_map'][$meta->name]['mimetype']); + if (function_exists('PMA_transformation_' + . $transformfunction_name)) { + $transform_function = 'PMA_transformation_' + . $transformfunction_name; + $transform_options = PMA_transformation_getOptions( + (isset($GLOBALS['mime_map'][$meta->name] + ['transformation_options']) + ? $GLOBALS['mime_map'][$meta->name] + ['transformation_options'] + : '')); + $meta->mimetype = str_replace( + '_', '/', + $GLOBALS['mime_map'][$meta->name]['mimetype']); } } // end if file_exists } // end if transformation is set @@ -1558,7 +1758,8 @@ function PMA_displayTableBody(&$dt_result, &$is_display, $map, $analyzed_sql) $_url_params['sql_query'] = $url_sql_query; } - $transform_options['wrapper_link'] = PMA_generate_common_url($_url_params); + $transform_options['wrapper_link'] + = PMA_generate_common_url($_url_params); // n u m e r i c if ($meta->numeric == 1) { @@ -1569,15 +1770,24 @@ function PMA_displayTableBody(&$dt_result, &$is_display, $map, $analyzed_sql) // so use the $pointer if (! isset($row[$i]) || is_null($row[$i])) { - $vertical_display['data'][$row_no][$i] = PMA_buildNullDisplay('right '.$class, $condition_field, $meta, ''); + $vertical_display['data'][$row_no][$i] = + PMA_buildNullDisplay('right '.$class, $condition_field, $meta, + ''); } elseif ($row[$i] != '') { $nowrap = ' nowrap'; $where_comparison = ' = ' . $row[$i]; - $vertical_display['data'][$row_no][$i] = ' $GLOBALS['cfg']['LimitChars'] && $_SESSION['tmp_user_values']['display_text'] == 'P') { - $row[$i] = PMA_substr($row[$i], 0, $GLOBALS['cfg']['LimitChars']) . '...'; + // if a transform function for blob is set, none of these + // replacements will be made + if (PMA_strlen($row[$i]) > $GLOBALS['cfg']['LimitChars'] + && $_SESSION['tmp_user_values']['display_text'] == 'P') { + $row[$i] = PMA_substr($row[$i], 0, + $GLOBALS['cfg']['LimitChars']) . '...'; $is_field_truncated = true; } // displays all space characters, 4 space // characters for tabulations and / - $row[$i] = ($default_function != $transform_function ? $transform_function($row[$i], $transform_options, $meta) : $default_function($row[$i], array(), $meta)); + $row[$i] = ($default_function != $transform_function + ? $transform_function($row[$i], $transform_options, + $meta) + : $default_function($row[$i], array(), $meta)); if ($is_field_truncated) { $class .= ' truncated'; } - $vertical_display['data'][$row_no][$i] = PMA_buildValueDisplay($class, $condition_field, $row[$i]); + $vertical_display['data'][$row_no][$i] + = PMA_buildValueDisplay($class, $condition_field, + $row[$i]); } else { - $vertical_display['data'][$row_no][$i] = PMA_buildEmptyDisplay($class, $condition_field, $meta); + $vertical_display['data'][$row_no][$i] + = PMA_buildEmptyDisplay($class, $condition_field, $meta); } } // g e o m e t r y } elseif ($meta->type == 'geometry') { - // Remove 'grid_edit' from $class as we do not allow to inline-edit geometry data. + // Remove 'grid_edit' from $class as we do not allow to inline-edit + // geometry data. $class = str_replace('grid_edit', '', $class); if (! isset($row[$i]) || is_null($row[$i])) { - $vertical_display['data'][$row_no][$i] = PMA_buildNullDisplay($class, $condition_field, $meta); + $vertical_display['data'][$row_no][$i] + = PMA_buildNullDisplay($class, $condition_field, $meta); } elseif ($row[$i] != '') { // Display as [GEOMETRY - (size)] if ('GEOM' == $_SESSION['tmp_user_values']['geometry_display']) { $geometry_text = PMA_handle_non_printable_contents( - 'GEOMETRY', (isset($row[$i]) ? $row[$i] : ''), $transform_function, - $transform_options, $default_function, $meta - ); - $vertical_display['data'][$row_no][$i] = PMA_buildValueDisplay( - $class, $condition_field, $geometry_text + 'GEOMETRY', (isset($row[$i]) ? $row[$i] : ''), + $transform_function, $transform_options, + $default_function, $meta ); + $vertical_display['data'][$row_no][$i] + = PMA_buildValueDisplay($class, $condition_field, + $geometry_text); // Display in Well Known Text(WKT) format. - } elseif ('WKT' == $_SESSION['tmp_user_values']['geometry_display']) { + } elseif ('WKT' + == $_SESSION['tmp_user_values']['geometry_display']) { $where_comparison = ' = ' . $row[$i]; // Convert to WKT format @@ -1651,14 +1881,17 @@ function PMA_displayTableBody(&$dt_result, &$is_display, $map, $analyzed_sql) if (PMA_strlen($wktval) > $GLOBALS['cfg']['LimitChars'] && $_SESSION['tmp_user_values']['display_text'] == 'P' ) { - $wktval = PMA_substr($wktval, 0, $GLOBALS['cfg']['LimitChars']) . '...'; + $wktval = PMA_substr($wktval, 0, + $GLOBALS['cfg']['LimitChars']) . '...'; $is_field_truncated = true; } - $vertical_display['data'][$row_no][$i] = ' $GLOBALS['cfg']['LimitChars'] - && $_SESSION['tmp_user_values']['display_text'] == 'P' + && $_SESSION['tmp_user_values']['display_text'] + == 'P' ) { - $wkbval = PMA_substr($wkbval, 0, $GLOBALS['cfg']['LimitChars']) . '...'; + $wkbval = PMA_substr($wkbval, 0, + $GLOBALS['cfg']['LimitChars']) . '...'; $is_field_truncated = true; } - $vertical_display['data'][$row_no][$i] = ' $GLOBALS['cfg']['LimitChars'] && $_SESSION['tmp_user_values']['display_text'] == 'P' && !strpos($transform_function, 'link') === true) { - $row[$i] = PMA_substr($row[$i], 0, $GLOBALS['cfg']['LimitChars']) . '...'; + if (PMA_strlen($row[$i]) > $GLOBALS['cfg']['LimitChars'] + && $_SESSION['tmp_user_values']['display_text'] == 'P' + && !strpos($transform_function, 'link') === true) { + $row[$i] = PMA_substr($row[$i], 0, + $GLOBALS['cfg']['LimitChars']) . '...'; $is_field_truncated = true; } @@ -1714,67 +1960,98 @@ function PMA_displayTableBody(&$dt_result, &$is_display, $map, $analyzed_sql) $field_flags = PMA_DBI_field_flags($dt_result, $i); $formatted = false; if (isset($meta->_type) && $meta->_type === MYSQLI_TYPE_BIT) { - $row[$i] = PMA_printable_bit_value($row[$i], $meta->length); + $row[$i] = PMA_printable_bit_value( + $row[$i], $meta->length); // some results of PROCEDURE ANALYSE() are reported as // being BINARY but they are quite readable, // so don't treat them as BINARY - } elseif (stristr($field_flags, 'BINARY') && $meta->type == 'string' && !(isset($GLOBALS['is_analyse']) && $GLOBALS['is_analyse'])) { + } elseif (stristr($field_flags, 'BINARY') + && $meta->type == 'string' + && !(isset($GLOBALS['is_analyse']) + && $GLOBALS['is_analyse'])) { if ($_SESSION['tmp_user_values']['display_binary']) { // user asked to see the real contents of BINARY // fields - if ($_SESSION['tmp_user_values']['display_binary_as_hex'] && PMA_contains_nonprintable_ascii($row[$i])) { + if ($_SESSION['tmp_user_values']['display_binary_as_hex'] + && PMA_contains_nonprintable_ascii($row[$i])) { $row[$i] = bin2hex($row[$i]); } else { - $row[$i] = htmlspecialchars(PMA_replace_binary_contents($row[$i])); + $row[$i] = htmlspecialchars( + PMA_replace_binary_contents($row[$i])); } } else { // we show the BINARY message and field's size // (or maybe use a transformation) - $row[$i] = PMA_handle_non_printable_contents('BINARY', $row[$i], $transform_function, $transform_options, $default_function, $meta, $_url_params); + $row[$i] = PMA_handle_non_printable_contents('BINARY', + $row[$i], $transform_function, $transform_options, + $default_function, $meta, $_url_params); $formatted = true; } } if ($formatted) { - $vertical_display['data'][$row_no][$i] = PMA_buildValueDisplay($class, $condition_field, $row[$i]); + $vertical_display['data'][$row_no][$i] + = PMA_buildValueDisplay($class, $condition_field, + $row[$i]); } else { // transform functions may enable no-wrapping: $function_nowrap = $transform_function . '_nowrap'; - $bool_nowrap = (($default_function != $transform_function && function_exists($function_nowrap)) ? $function_nowrap($transform_options) : false); + $bool_nowrap = (($default_function != $transform_function + && function_exists($function_nowrap)) + ? $function_nowrap($transform_options) + : false); // do not wrap if date field type - $nowrap = ((preg_match('@DATE|TIME@i', $meta->type) || $bool_nowrap) ? ' nowrap' : ''); - $where_comparison = ' = \'' . PMA_sqlAddSlashes($row[$i]) . '\''; - $vertical_display['data'][$row_no][$i] = 'type) + || $bool_nowrap) + ? ' nowrap' + : ''); + $where_comparison = ' = \'' . PMA_sqlAddSlashes($row[$i]) + . '\''; + $vertical_display['data'][$row_no][$i] = ' 0 || !empty($vertical_display['textbtn'])) + && (count($vertical_display['row_delete']) > 0 + || !empty($vertical_display['textbtn'])) ) { echo '