diff --git a/ChangeLog b/ChangeLog
index 535b7e3a03..61e8b941c3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -43,6 +43,8 @@ phpMyAdmin - ChangeLog
- bug Honor proxy settings when getting Git commit information
- bug Missing title on link
- bug #4512 ForceSSL Redirect Check
+- bug Undefined index collation_connection
+- bug Error when the reporting server is down
4.4.6.0 (2015-05-07)
- bug #4890 webkitStorageInfo and webkitIndexedDB is deprecated
diff --git a/libraries/Config.class.php b/libraries/Config.class.php
index d14b5c2793..1de82c2f18 100644
--- a/libraries/Config.class.php
+++ b/libraries/Config.class.php
@@ -1045,8 +1045,9 @@ class PMA_Config
if (!PMA_DRIZZLE) {
// just to shorten the lines
$collation = 'collation_connection';
- if (isset($_COOKIE['pma_collation_connection'])
- || isset($_POST[$collation])
+ if (isset($GLOBALS[$collation])
+ && (isset($_COOKIE['pma_collation_connection'])
+ || isset($_POST[$collation]))
) {
if ((! isset($config_data[$collation])
&& $GLOBALS[$collation] != 'utf8_general_ci')
diff --git a/libraries/DisplayResults.class.php b/libraries/DisplayResults.class.php
index d7f364b12e..9b623dbe00 100644
--- a/libraries/DisplayResults.class.php
+++ b/libraries/DisplayResults.class.php
@@ -738,6 +738,56 @@ class PMA_DisplayResults
} // end function _getTableNavigationButton()
+ /**
+ * Possibly return a page selector for table navigation
+ *
+ * @param string $table_navigation_html the current navigation HTML
+ *
+ * @return array ($table_navigation_html, $nbTotalPage)
+ *
+ * @access private
+ *
+ */
+ private function _getHtmlPageSelector($table_navigation_html)
+ {
+ $pageNow = @floor(
+ $_SESSION['tmpval']['pos']
+ / $_SESSION['tmpval']['max_rows']
+ ) + 1;
+
+ $nbTotalPage = @ceil(
+ $this->__get('unlim_num_rows')
+ / $_SESSION['tmpval']['max_rows']
+ );
+
+ if ($nbTotalPage > 1) {
+ $table_navigation_html .= '
';
+ $_url_params = array(
+ 'db' => $this->__get('db'),
+ 'table' => $this->__get('table'),
+ 'sql_query' => $this->__get('sql_query'),
+ 'goto' => $this->__get('goto'),
+ 'is_browse_distinct' => $this->__get('is_browse_distinct'),
+ );
+
+ //'
+ . ' | ';
+ }
+ return array($table_navigation_html, $nbTotalPage);
+ }
+
/**
* Get a navigation bar to browse among the results of a SQL query
*
@@ -781,45 +831,12 @@ class PMA_DisplayResults
$nbTotalPage = 1;
//page redirection
// (unless we are showing all records)
- if ($_SESSION['tmpval']['max_rows'] != self::ALL_ROWS) { //if1
-
- $pageNow = @floor(
- $_SESSION['tmpval']['pos']
- / $_SESSION['tmpval']['max_rows']
- ) + 1;
-
- $nbTotalPage = @ceil(
- $this->__get('unlim_num_rows')
- / $_SESSION['tmpval']['max_rows']
- );
-
- if ($nbTotalPage > 1) { //if2
-
- $table_navigation_html .= '';
- $_url_params = array(
- 'db' => $this->__get('db'),
- 'table' => $this->__get('table'),
- 'sql_query' => $this->__get('sql_query'),
- 'goto' => $this->__get('goto'),
- 'is_browse_distinct' => $this->__get('is_browse_distinct'),
- );
-
- //'
- . ' | ';
- } //_if2
- } //_if1
+ if ($_SESSION['tmpval']['max_rows'] != self::ALL_ROWS) {
+ list(
+ $table_navigation_html,
+ $nbTotalPage
+ ) = $this->_getHtmlPageSelector($table_navigation_html);
+ }
$showing_all = false;
if ($_SESSION['tmpval']['max_rows'] == self::ALL_ROWS) {
@@ -1110,6 +1127,112 @@ class PMA_DisplayResults
} // end of the '_getAdditionalFieldsForTableNavigation()' function
+ /**
+ * Get the headers of the results table, for all of the columns
+ *
+ * @param array $displayParts which elements to display
+ * @param array $analyzed_sql the analyzed query
+ * @param string $sort_expression sort expression
+ * @param string $sort_expression_nodirection sort expression
+ * without direction
+ * @param string $sort_direction sort direction
+ * @param boolean $is_limited_display with limited operations
+ * or not
+ * @param string $unsorted_sql_query query without the sort part
+ *
+ * @return string html content
+ *
+ * @access private
+ *
+ * @see getTableHeaders()
+ */
+ private function _getTableHeadersForColumns(
+ $displayParts, $analyzed_sql,
+ $sort_expression, $sort_expression_nodirection,
+ $sort_direction, $is_limited_display, $unsorted_sql_query
+ ) {
+ $html = '';
+
+ // required to generate sort links that will remember whether the
+ // "Show all" button has been clicked
+ $sql_md5 = md5($this->__get('sql_query'));
+ $session_max_rows = $is_limited_display
+ ? 0
+ : $_SESSION['tmpval']['query'][$sql_md5]['max_rows'];
+
+ // Following variable are needed for use in isset/empty or
+ // use with array indexes/safe use in the for loop
+ $highlight_columns = $this->__get('highlight_columns');
+ $fields_meta = $this->__get('fields_meta');
+
+ // Prepare Display column comments if enabled
+ // ($GLOBALS['cfg']['ShowBrowseComments']).
+ $comments_map = $this->_getTableCommentsArray($analyzed_sql);
+
+ list($col_order, $col_visib) = $this->_getColumnParams($analyzed_sql);
+
+ // optimize: avoid calling a method on each iteration
+ $number_of_columns = $this->__get('fields_cnt');
+
+ for ($j = 0; $j < $number_of_columns; $j++) {
+
+ // assign $i with the appropriate column order
+ $i = $col_order ? $col_order[$j] : $j;
+
+ // See if this column should get highlight because it's used in the
+ // where-query.
+ $condition_field = (isset($highlight_columns[$fields_meta[$i]->name])
+ || isset(
+ $highlight_columns[PMA_Util::backquote($fields_meta[$i]->name)])
+ )
+ ? true
+ : false;
+
+ // Prepare comment-HTML-wrappers for each row, if defined/enabled.
+ $comments = $this->_getCommentForRow($comments_map, $fields_meta[$i]);
+ $display_params = $this->__get('display_params');
+
+ if (($displayParts['sort_lnk'] == '1') && ! $is_limited_display) {
+
+ list($order_link, $sorted_header_html)
+ = $this->_getOrderLinkAndSortedHeaderHtml(
+ $fields_meta[$i], $sort_expression,
+ $sort_expression_nodirection, $i, $unsorted_sql_query,
+ $session_max_rows, $comments,
+ $sort_direction, $col_visib,
+ $col_visib[$j]
+ );
+
+ $html .= $sorted_header_html;
+
+ $display_params['desc'][] = ' ' . "\n" . $order_link . $comments . ' | ' . "\n";
+ } else {
+ // Results can't be sorted
+ $html
+ .= $this->_getDraggableClassForNonSortableColumns(
+ $col_visib, $col_visib[$j], $condition_field,
+ $fields_meta[$i], $comments
+ );
+
+ $display_params['desc'][] = ' ' . ' '
+ . htmlspecialchars($fields_meta[$i]->name)
+ . $comments . ' | ';
+ } // end else
+
+ $this->__set('display_params', $display_params);
+
+ } // end for
+ return $html;
+ }
+
/**
* Get the headers of the results table
*
@@ -1135,20 +1258,11 @@ class PMA_DisplayResults
) {
$table_headers_html = '';
- // Following variable are needed for use in isset/empty or
+ // Needed for use in isset/empty or
// use with array indexes/safe use in foreach
- $fields_meta = $this->__get('fields_meta');
- $highlight_columns = $this->__get('highlight_columns');
$printview = $this->__get('printview');
$display_params = $this->__get('display_params');
- // required to generate sort links that will remember whether the
- // "Show all" button has been clicked
- $sql_md5 = md5($this->__get('sql_query'));
- $session_max_rows = $is_limited_display
- ? 0
- : $_SESSION['tmpval']['query'][$sql_md5]['max_rows'];
-
if ($analyzed_sql == '') {
$analyzed_sql = array();
}
@@ -1163,6 +1277,8 @@ class PMA_DisplayResults
$table_headers_html .= $drop_down_html;
+ } else {
+ $unsorted_sql_query = '';
}
// Output data needed for grid editing
@@ -1213,74 +1329,16 @@ class PMA_DisplayResults
// 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']).
- $comments_map = $this->_getTableCommentsArray($analyzed_sql);
-
// See if we have to highlight any header fields of a WHERE query.
// Uses SQL-Parser results.
$this->_setHighlightedColumnGlobalField($analyzed_sql);
- list($col_order, $col_visib) = $this->_getColumnParams($analyzed_sql);
-
- for ($j = 0; $j < $this->__get('fields_cnt'); $j++) {
-
- // assign $i with appropriate column order
- $i = $col_order ? $col_order[$j] : $j;
-
- // See if this column should get highlight because it's used in the
- // where-query.
- $condition_field = (isset($highlight_columns[$fields_meta[$i]->name])
- || isset(
- $highlight_columns[PMA_Util::backquote($fields_meta[$i]->name)])
- )
- ? true
- : false;
-
- // 2.0 Prepare comment-HTML-wrappers for each row, if defined/enabled.
- $comments = $this->_getCommentForRow($comments_map, $fields_meta[$i]);
-
- $display_params = $this->__get('display_params');
-
- if (($displayParts['sort_lnk'] == '1') && ! $is_limited_display) {
-
- list($order_link, $sorted_header_html)
- = $this->_getOrderLinkAndSortedHeaderHtml(
- $fields_meta[$i], $sort_expression,
- $sort_expression_nodirection, $i, $unsorted_sql_query,
- $session_max_rows, $comments,
- $sort_direction, $col_visib,
- $col_visib[$j]
- );
-
- $table_headers_html .= $sorted_header_html;
-
- $display_params['desc'][] = ' ' . "\n" . $order_link . $comments . ' | ' . "\n";
- } else {
- // 2.2 Results can't be sorted
-
- $table_headers_html
- .= $this->_getDraggableClassForNonSortableColumns(
- $col_visib, $col_visib[$j], $condition_field,
- $fields_meta[$i], $comments
- );
-
- $display_params['desc'][] = ' ' . "\n" . ' '
- . htmlspecialchars($fields_meta[$i]->name)
- . "\n" . $comments . ' | ';
- } // end else (2.2)
-
- $this->__set('display_params', $display_params);
-
- } // end for
+ // Get the headers for all of the columns
+ $table_headers_html .= $this->_getTableHeadersForColumns(
+ $displayParts, $analyzed_sql, $sort_expression,
+ $sort_expression_nodirection, $sort_direction,
+ $is_limited_display, $unsorted_sql_query
+ );
// Display column at rightside - checkboxes or empty column
if (! $printview) {
@@ -1877,13 +1935,13 @@ class PMA_DisplayResults
* Prepare parameters and html for sorted table header fields
*
* @param array $fields_meta set of field properties
- * @param array $sort_expression sort expression
- * @param array $sort_expression_nodirection sort expression without direction
+ * @param string $sort_expression sort expression
+ * @param string $sort_expression_nodirection sort expression without direction
* @param integer $column_index the index of the column
* @param string $unsorted_sql_query the unsorted sql query
* @param integer $session_max_rows maximum rows resulted by sql
* @param string $comments comment for row
- * @param array $sort_direction sort direction
+ * @param string $sort_direction sort direction
* @param boolean $col_visib column is visible(false)
* array column isn't visible(string array)
* @param string $col_visib_j element of $col_visib array
@@ -1974,13 +2032,13 @@ class PMA_DisplayResults
/**
* Prepare parameters and html for sorted table header fields
*
- * @param array $sort_expression sort expression
- * @param array $sort_expression_nodirection sort expression without direction
+ * @param string $sort_expression sort expression
+ * @param string $sort_expression_nodirection sort expression without direction
* @param string $sort_tbl The name of the table to which
* the current column belongs to
* @param string $name_to_use_in_sort The current column under
* consideration
- * @param array $sort_direction sort direction
+ * @param string $sort_direction sort direction
* @param array $fields_meta set of field properties
* @param integer $column_index The index number to current column
*
@@ -2769,7 +2827,7 @@ class PMA_DisplayResults
}
$table_body_html .= $this->_getRowValues(
$dt_result, $row, $row_no, $col_order, $map,
- $grid_edit_class, $col_visib, $where_clause,
+ $grid_edit_class, $col_visib,
$url_sql_query, $analyzed_sql
);
@@ -2879,7 +2937,6 @@ class PMA_DisplayResults
* @param string $grid_edit_class the class for all editable columns
* @param boolean $col_visib column is visible(false)
* array column isn't visible(string array)
- * @param string $where_clause where clause
* @param string $url_sql_query the analyzed sql query
* @param array $analyzed_sql the analyzed query
*
@@ -2891,7 +2948,7 @@ class PMA_DisplayResults
*/
private function _getRowValues(
&$dt_result, $row, $row_no, $col_order, $map,
- $grid_edit_class, $col_visib, $where_clause,
+ $grid_edit_class, $col_visib,
$url_sql_query, $analyzed_sql
) {
diff --git a/libraries/error_report.lib.php b/libraries/error_report.lib.php
index fbef2101c8..619886f72a 100644
--- a/libraries/error_report.lib.php
+++ b/libraries/error_report.lib.php
@@ -197,7 +197,7 @@ function PMA_sendErrorReport($report)
)
);
$context = PMA_Util::handleContext($context);
- $response = file_get_contents(
+ $response = @file_get_contents(
SUBMISSION_URL,
false,
stream_context_create($context)