diff --git a/libraries/display_tbl.lib.php b/libraries/display_tbl.lib.php index a2ece5d3d8..cb2b80fa11 100644 --- a/libraries/display_tbl.lib.php +++ b/libraries/display_tbl.lib.php @@ -55,6 +55,7 @@ require_once './libraries/Index.class.php'; */ function PMA_setDisplayMode(&$the_disp_mode, &$the_total) { + global $db, $table; global $unlim_num_rows, $fields_meta; global $err_url; @@ -85,7 +86,7 @@ function PMA_setDisplayMode(&$the_disp_mode, &$the_total) $do_display['pview_lnk'] = (string) '0'; } elseif ($GLOBALS['is_count'] || $GLOBALS['is_analyse'] || $GLOBALS['is_maint'] || $GLOBALS['is_explain'] - ) { + ) { // 2.1 Statement is a "SELECT COUNT", a // "CHECK/ANALYZE/REPAIR/OPTIMIZE", an "EXPLAIN" one or // contains a "PROC ANALYSE" part @@ -101,6 +102,7 @@ function PMA_setDisplayMode(&$the_disp_mode, &$the_total) $do_display['text_btn'] = (string) '0'; } $do_display['pview_lnk'] = (string) '1'; + } elseif ($GLOBALS['is_show']) { // 2.2 Statement is a "SHOW..." /** @@ -113,7 +115,7 @@ function PMA_setDisplayMode(&$the_disp_mode, &$the_total) $GLOBALS['sql_query'], $which ); if (isset($which[1]) - && strpos(' ' . strtoupper($which[1]), 'PROCESSLIST') > 0 + && (strpos(' ' . strtoupper($which[1]), 'PROCESSLIST') > 0) ) { $do_display['edit_lnk'] = 'nn'; // no edit link $do_display['del_lnk'] = 'kp'; // "kill process" type edit link @@ -136,14 +138,14 @@ function PMA_setDisplayMode(&$the_disp_mode, &$the_total) $prev_table = $fields_meta[0]->table; $do_display['text_btn'] = (string) '1'; for ($i = 0; $i < $GLOBALS['fields_cnt']; $i++) { - $is_link = $do_display['edit_lnk'] != 'nn' - || $do_display['del_lnk'] != 'nn' - || $do_display['sort_lnk'] != '0' - || $do_display['ins_row'] != '0'; + $is_link = ($do_display['edit_lnk'] != 'nn') + || ($do_display['del_lnk'] != 'nn') + || ($do_display['sort_lnk'] != '0') + || ($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'; @@ -167,8 +169,9 @@ function PMA_setDisplayMode(&$the_disp_mode, &$the_total) // 3. Gets the total number of rows if it is unknown if (isset($unlim_num_rows) && $unlim_num_rows != '') { $the_total = $unlim_num_rows; - } elseif (($do_display['nav_bar'] == '1' || $do_display['sort_lnk'] == '1') - && (strlen($db) && !empty($table))) { + } elseif ((($do_display['nav_bar'] == '1') || ($do_display['sort_lnk'] == '1')) + && (strlen($db) && !empty($table)) + ) { $the_total = PMA_Table::countRecords($db, $table); } @@ -195,6 +198,7 @@ function PMA_setDisplayMode(&$the_disp_mode, &$the_total) $the_disp_mode = join('', $do_display); return $do_display; + } // end of the 'PMA_setDisplayMode()' function @@ -241,6 +245,7 @@ function PMA_isSelect() function PMA_getTableNavigationButton($caption, $title, $pos, $html_sql_query, $onsubmit = '', $input_for_real_end = '', $onclick = '' ) { + global $db, $table, $goto; $caption_output = ''; @@ -248,9 +253,10 @@ function PMA_getTableNavigationButton($caption, $title, $pos, $html_sql_query, if ($GLOBALS['cfg']['NavigationBarIconic']) { $caption_output .= $caption; } + // for false or 'both' - if (false === $GLOBALS['cfg']['NavigationBarIconic'] - || 'both' === $GLOBALS['cfg']['NavigationBarIconic'] + if (($GLOBALS['cfg']['NavigationBarIconic'] === false) + || ($GLOBALS['cfg']['NavigationBarIconic'] === 'both') ) { $caption_output .= ' ' . $title; } @@ -268,7 +274,7 @@ function PMA_getTableNavigationButton($caption, $title, $pos, $html_sql_query, . 'value="' . $caption_output . '" ' . $title_output . $onclick . ' />' . '' . ''; - + } // end function PMA_getTableNavigationButton() /** @@ -298,6 +304,7 @@ function PMA_getTableNavigationButton($caption, $title, $pos, $html_sql_query, function PMA_getTableNavigation($pos_next, $pos_prev, $sql_query, $id_for_direction_dropdown ) { + global $db, $table, $goto; global $num_rows, $unlim_num_rows; global $is_innodb; @@ -322,7 +329,7 @@ function PMA_getTableNavigation($pos_next, $pos_prev, $sql_query, // Move to the beginning or to the previous page if ($_SESSION['tmp_user_values']['pos'] - && $_SESSION['tmp_user_values']['max_rows'] != 'all' + && ($_SESSION['tmp_user_values']['max_rows'] != 'all') ) { $table_navigation_html .= PMA_getTableNavigationButton( '<<', _pgettext('First page', 'Begin'), 0, $html_sql_query @@ -331,17 +338,18 @@ function PMA_getTableNavigation($pos_next, $pos_prev, $sql_query, '<', _pgettext('Previous page', 'Previous'), $pos_prev, $html_sql_query ); - } // end move back $nbTotalPage = 1; //page redirection // (unless we are showing all records) - if ('all' != $_SESSION['tmp_user_values']['max_rows']) { //if1 + if ($_SESSION['tmp_user_values']['max_rows'] != 'all') { //if1 + $pageNow = @floor( $_SESSION['tmp_user_values']['pos'] / $_SESSION['tmp_user_values']['max_rows'] ) + 1; + $nbTotalPage = @ceil( $unlim_num_rows / $_SESSION['tmp_user_values']['max_rows'] @@ -356,6 +364,7 @@ function PMA_getTableNavigation($pos_next, $pos_prev, $sql_query, 'sql_query' => $sql_query, 'goto' => $goto, ); + //