diff --git a/db_search.php b/db_search.php index 8d5d80f346..dba5c4416b 100644 --- a/db_search.php +++ b/db_search.php @@ -59,5 +59,5 @@ $response->addHTML( . '
' ); $response->addHTML($db_search->getSelectionForm($url_params)); -$response->addHTML($db_search->_getResultDivs()); +$response->addHTML($db_search->getResultDivs()); ?> diff --git a/js/messages.php b/js/messages.php index d210c56e85..4374336196 100644 --- a/js/messages.php +++ b/js/messages.php @@ -531,7 +531,8 @@ PMA_printJsValue("$.datepicker.regional['']['weekHeader']", __('Wk')); PMA_printJsValue( "$.datepicker.regional['']['showMonthAfterYear']", /* l10n: Month-year order for calendar, use either "calendar-month-year" - * or "calendar-year-month". */ + * or "calendar-year-month". + */ (__('calendar-month-year') == 'calendar-year-month') ); /* l10n: Year suffix for calendar, "none" is empty. */ diff --git a/libraries/DBQbe.class.php b/libraries/DBQbe.class.php index 3912ac3c9e..00dffb1cb4 100644 --- a/libraries/DBQbe.class.php +++ b/libraries/DBQbe.class.php @@ -1176,8 +1176,8 @@ class PMA_DbQbe list($candidate_columns, $needsort) = $this->_getLeftJoinColumnCandidatesBest( - $all_tables, $where_clause_columns, $unique_columns, $index_columns - ); + $all_tables, $where_clause_columns, $unique_columns, $index_columns + ); // If we came up with $unique_columns (very good) or $index_columns (still // good) as $candidate_columns we want to check if we have any 'Y' there diff --git a/libraries/DbSearch.class.php b/libraries/DbSearch.class.php index ccd8b18d3c..384d95bda7 100644 --- a/libraries/DbSearch.class.php +++ b/libraries/DbSearch.class.php @@ -476,7 +476,7 @@ class PMA_DbSearch * * @return string div tags */ - public function _getResultDivs() + public function getResultDivs() { $html_output = ''; diff --git a/libraries/Footer.class.php b/libraries/Footer.class.php index 218878f55f..855ff2355e 100644 --- a/libraries/Footer.class.php +++ b/libraries/Footer.class.php @@ -142,13 +142,15 @@ class PMA_Footer $params['viewing_mode'] = $_REQUEST['viewing_mode']; } if (isset($_REQUEST['checkprivsdb']) - //TODO: coming from server_privileges.php, here $db is not set, uncomment below line when that is fixed + //TODO: coming from server_privileges.php, here $db is not set, + //uncomment below line when that is fixed //&& $_REQUEST['checkprivsdb'] == $db ) { $params['checkprivsdb'] = $_REQUEST['checkprivsdb']; } if (isset($_REQUEST['checkprivstable']) - //TODO: coming from server_privileges.php, here $table is not set, uncomment below line when that is fixed + //TODO: coming from server_privileges.php, here $table is not set, + //uncomment below line when that is fixed //&& $_REQUEST['checkprivstable'] == $table ) { $params['checkprivstable'] = $_REQUEST['checkprivstable']; @@ -157,7 +159,7 @@ class PMA_Footer && in_array($_REQUEST['single_table'], array(true, false)) ) { $params['single_table'] = $_REQUEST['single_table']; - } + } return basename(PMA_getenv('SCRIPT_NAME')) . PMA_URL_getCommon( $params, $encoding diff --git a/libraries/plugins/import/ImportOds.class.php b/libraries/plugins/import/ImportOds.class.php index 2b07e88eea..28356b847d 100644 --- a/libraries/plugins/import/ImportOds.class.php +++ b/libraries/plugins/import/ImportOds.class.php @@ -206,104 +206,107 @@ class ImportOds extends ImportPlugin /* Iterate over rows */ foreach ($sheet as $row) { $type = $row->getName(); - if (! strcmp('table-row', $type)) { - /* Iterate over columns */ - foreach ($row as $cell) { - $text = $cell->children('text', true); - $cell_attrs = $cell->attributes('office', true); + if (strcmp('table-row', $type)) { + continue; + } + /* Iterate over columns */ + foreach ($row as $cell) { + $text = $cell->children('text', true); + $cell_attrs = $cell->attributes('office', true); - if (count($text) != 0) { - $attr = $cell->attributes('table', true); - $num_repeat = (int) $attr['number-columns-repeated']; - $num_iterations = $num_repeat ? $num_repeat : 1; + if (count($text) != 0) { + $attr = $cell->attributes('table', true); + $num_repeat = (int) $attr['number-columns-repeated']; + $num_iterations = $num_repeat ? $num_repeat : 1; - for ($k = 0; $k < $num_iterations; $k++) { - if ($_REQUEST['ods_recognize_percentages'] - && ! strcmp( - 'percentage', - $cell_attrs['value-type'] - ) - ) { - $value = (double)$cell_attrs['value']; - } elseif ($_REQUEST['ods_recognize_currency'] - && !strcmp('currency', $cell_attrs['value-type']) - ) { - $value = (double)$cell_attrs['value']; - } else { - /* We need to concatenate all paragraphs */ - $values = array(); - foreach ($text as $paragraph) { - $values[] = (string)$paragraph; - } - $value = implode("\n", $values); - } - if (! $col_names_in_first_row) { - $tempRow[] = $value; - } else { - $col_names[] = $value; + for ($k = 0; $k < $num_iterations; $k++) { + if ($_REQUEST['ods_recognize_percentages'] + && ! strcmp( + 'percentage', + $cell_attrs['value-type'] + ) + ) { + $value = (double)$cell_attrs['value']; + } elseif ($_REQUEST['ods_recognize_currency'] + && !strcmp('currency', $cell_attrs['value-type']) + ) { + $value = (double)$cell_attrs['value']; + } else { + /* We need to concatenate all paragraphs */ + $values = array(); + foreach ($text as $paragraph) { + $values[] = (string)$paragraph; } + $value = implode("\n", $values); + } + if (! $col_names_in_first_row) { + $tempRow[] = $value; + } else { + $col_names[] = $value; + } + ++$col_count; + } + continue; + } + + /* Number of blank columns repeated */ + if ($col_count >= count($row->children('table', true)) - 1) { + continue; + } + + $attr = $cell->attributes('table', true); + $num_null = (int)$attr['number-columns-repeated']; + + if ($num_null) { + if (! $col_names_in_first_row) { + for ($i = 0; $i < $num_null; ++$i) { + $tempRow[] = 'NULL'; ++$col_count; } } else { - /* Number of blank columns repeated */ - if ($col_count < count($row->children('table', true)) - 1 - ) { - $attr = $cell->attributes('table', true); - $num_null = (int)$attr['number-columns-repeated']; - - if ($num_null) { - if (! $col_names_in_first_row) { - for ($i = 0; $i < $num_null; ++$i) { - $tempRow[] = 'NULL'; - ++$col_count; - } - } else { - for ($i = 0; $i < $num_null; ++$i) { - $col_names[] = PMA_getColumnAlphaName( - $col_count + 1 - ); - ++$col_count; - } - } - } else { - if (! $col_names_in_first_row) { - $tempRow[] = 'NULL'; - } else { - $col_names[] = PMA_getColumnAlphaName( - $col_count + 1 - ); - } - - ++$col_count; - } + for ($i = 0; $i < $num_null; ++$i) { + $col_names[] = PMA_getColumnAlphaName( + $col_count + 1 + ); + ++$col_count; } } - } - - /* Find the widest row */ - if ($col_count > $max_cols) { - $max_cols = $col_count; - } - - /* Don't include a row that is full of NULL values */ - if (! $col_names_in_first_row) { - if ($_REQUEST['ods_empty_rows']) { - foreach ($tempRow as $cell) { - if (strcmp('NULL', $cell)) { - $tempRows[] = $tempRow; - break; - } - } + } else { + if (! $col_names_in_first_row) { + $tempRow[] = 'NULL'; } else { - $tempRows[] = $tempRow; + $col_names[] = PMA_getColumnAlphaName( + $col_count + 1 + ); } - } - $col_count = 0; - $col_names_in_first_row = false; - $tempRow = array(); + ++$col_count; + } + } //Endforeach + + /* Find the widest row */ + if ($col_count > $max_cols) { + $max_cols = $col_count; } + + /* Don't include a row that is full of NULL values */ + if (! $col_names_in_first_row) { + if ($_REQUEST['ods_empty_rows']) { + foreach ($tempRow as $cell) { + if (strcmp('NULL', $cell)) { + $tempRows[] = $tempRow; + break; + } + } + } else { + $tempRows[] = $tempRow; + } + } + + $col_count = 0; + $col_names_in_first_row = false; + $tempRow = array(); } /* Skip over empty sheets */ @@ -356,13 +359,15 @@ class ImportOds extends ImportPlugin $num_tbls = count($tables); for ($i = 0; $i < $num_tbls; ++$i) { for ($j = 0; $j < count($rows); ++$j) { - if (! strcmp($tables[$i][TBL_NAME], $rows[$j][TBL_NAME])) { - if (! isset($tables[$i][COL_NAMES])) { - $tables[$i][] = $rows[$j][COL_NAMES]; - } - - $tables[$i][ROWS] = $rows[$j][ROWS]; + if (strcmp($tables[$i][TBL_NAME], $rows[$j][TBL_NAME])) { + continue; } + + if (! isset($tables[$i][COL_NAMES])) { + $tables[$i][] = $rows[$j][COL_NAMES]; + } + + $tables[$i][ROWS] = $rows[$j][ROWS]; } } diff --git a/test/classes/PMA_DbSearch_test.php b/test/classes/PMA_DbSearch_test.php index fd087390a7..dc647fa258 100644 --- a/test/classes/PMA_DbSearch_test.php +++ b/test/classes/PMA_DbSearch_test.php @@ -234,7 +234,7 @@ class PMA_DbSearch_Test extends PHPUnit_Framework_TestCase } /** - * Test for _getResultDivs + * Test for getResultDivs * * @return void */ @@ -250,7 +250,7 @@ class PMA_DbSearch_Test extends PHPUnit_Framework_TestCase . ' delete form in the db search -->' . '', $this->_callProtectedFunction( - '_getResultDivs', + 'getResultDivs', array() ) );