diff --git a/db_operations.php b/db_operations.php index 778cc6e95c..d58a8d2f84 100644 --- a/db_operations.php +++ b/db_operations.php @@ -135,6 +135,7 @@ if (strlen($db) && (! empty($db_rename) || ! empty($db_copy))) { $tables_full = PMA_DBI_get_tables_full($db); $views = array(); + require_once "libraries/plugin_interface.lib.php"; // remove all foreign key constraints, otherwise we can get errors $export_sql_plugin = PMA_getPlugin( "export", diff --git a/db_search.php b/db_search.php index f6606ba910..458a45b881 100644 --- a/db_search.php +++ b/db_search.php @@ -12,6 +12,7 @@ * */ require_once 'libraries/common.inc.php'; +require_once 'libraries/db_search.lib.php'; $response = PMA_Response::getInstance(); $header = $response->getHeader(); @@ -43,57 +44,65 @@ $url_params['goto'] = 'db_search.php'; */ $tables_names_only = PMA_DBI_get_tables($GLOBALS['db']); -$search_options = array( +$searchTypes = array( '1' => __('at least one of the words'), '2' => __('all words'), '3' => __('the exact phrase'), '4' => __('as regular expression'), ); -if (empty($_REQUEST['search_option']) - || ! is_string($_REQUEST['search_option']) - || ! array_key_exists($_REQUEST['search_option'], $search_options) +if (empty($_REQUEST['criteriaSearchType']) + || ! is_string($_REQUEST['criteriaSearchType']) + || ! array_key_exists($_REQUEST['criteriaSearchType'], $searchTypes) ) { - $search_option = 1; + $criteriaSearchType = 1; unset($_REQUEST['submit_search']); } else { - $search_option = (int) $_REQUEST['search_option']; - $option_str = $search_options[$_REQUEST['search_option']]; + $criteriaSearchType = (int) $_REQUEST['criteriaSearchType']; + $option_str = $searchTypes[$_REQUEST['criteriaSearchType']]; } -if (empty($_REQUEST['search_str']) || ! is_string($_REQUEST['search_str'])) { +if (empty($_REQUEST['criteriaSearchString']) + || ! is_string($_REQUEST['criteriaSearchString']) +) { unset($_REQUEST['submit_search']); $searched = ''; } else { - $searched = htmlspecialchars($_REQUEST['search_str']); + $searched = htmlspecialchars($_REQUEST['criteriaSearchString']); // For "as regular expression" (search option 4), we should not treat // this as an expression that contains a LIKE (second parameter of // sqlAddSlashes()). // // Usage example: If user is seaching for a literal $ in a regexp search, // he should enter \$ as the value. - $search_str = $common_functions->sqlAddSlashes( - $_REQUEST['search_str'], ($search_option == 4 ? false : true) + $criteriaSearchString = $common_functions->sqlAddSlashes( + $_REQUEST['criteriaSearchString'], ($criteriaSearchType == 4 ? false : true) ); } -$tables_selected = array(); -if (empty($_REQUEST['table_select']) || ! is_array($_REQUEST['table_select'])) { +$criteriaTables = array(); +if (empty($_REQUEST['criteriaTables']) || ! is_array($_REQUEST['criteriaTables'])) { unset($_REQUEST['submit_search']); } elseif (! isset($_REQUEST['selectall']) && ! isset($_REQUEST['unselectall'])) { - $tables_selected = array_intersect($_REQUEST['table_select'], $tables_names_only); + $criteriaTables = array_intersect( + $_REQUEST['criteriaTables'], $tables_names_only + ); } if (isset($_REQUEST['selectall'])) { - $tables_selected = $tables_names_only; + $criteriaTables = $tables_names_only; } elseif (isset($_REQUEST['unselectall'])) { - $tables_selected = array(); + $criteriaTables = array(); } -if (empty($_REQUEST['field_str']) || ! is_string($_REQUEST['field_str'])) { - unset($field_str); +if (empty($_REQUEST['criteriaColumnName']) + || ! is_string($_REQUEST['criteriaColumnName']) +) { + unset($criteriaColumnName); } else { - $field_str = $common_functions->sqlAddSlashes($_REQUEST['field_str'], true); + $criteriaColumnName = $common_functions->sqlAddSlashes( + $_REQUEST['criteriaColumnName'], true + ); } /** @@ -107,226 +116,16 @@ if ( $GLOBALS['is_ajax_request'] != true) { } /** - * 1. Main search form has been submitted + * Main search form has been submitted */ if (isset($_REQUEST['submit_search'])) { - - /** - * Builds the SQL search query - * - * @param string $table the table name - * @param string $field restrict the search to this field - * @param string $search_str the string to search - * @param integer $search_option type of search - * (1 -> 1 word at least, 2 -> all words, - * 3 -> exact string, 4 -> regexp) - * - * @return array 3 SQL querys (for count, display and delete results) - * - * @todo can we make use of fulltextsearch IN BOOLEAN MODE for this? - * PMA_CommonFunctions::backquote - * PMA_DBI_free_result - * PMA_DBI_fetch_assoc - * $GLOBALS['db'] - * explode - * count - * strlen - */ - function PMA_getSearchSqls($table, $field, $search_str, $search_option) - { - // Statement types - $sqlstr_select = 'SELECT'; - $sqlstr_delete = 'DELETE'; - - // Fields to select - $tblfields = PMA_DBI_get_columns($GLOBALS['db'], $table); - - // Table to use - $sqlstr_from = ' FROM ' . $common_functions->backquote($GLOBALS['db']) . '.' . $common_functions->backquote($table); - - $search_words = (($search_option > 2) ? array($search_str) : explode(' ', $search_str)); - - $like_or_regex = (($search_option == 4) ? 'REGEXP' : 'LIKE'); - $automatic_wildcard = (($search_option < 3) ? '%' : ''); - - $fieldslikevalues = array(); - foreach ($search_words as $search_word) { - // Eliminates empty values - if (strlen($search_word) === 0) { - continue; - } - - $thefieldlikevalue = array(); - foreach ($tblfields as $tblfield) { - if (! isset($field) || strlen($field) == 0 || $tblfield['Field'] == $field) { - // Drizzle has no CONVERT and all text columns are UTF-8 - if (PMA_DRIZZLE) { - $thefieldlikevalue[] = $common_functions->backquote($tblfield['Field']) - . ' ' . $like_or_regex . ' ' - . "'" . $automatic_wildcard - . $search_word - . $automatic_wildcard . "'"; - } else { - $thefieldlikevalue[] = 'CONVERT(' . $common_functions->backquote($tblfield['Field']) . ' USING utf8)' - . ' ' . $like_or_regex . ' ' - . "'" . $automatic_wildcard - . $search_word - . $automatic_wildcard . "'"; - } - } - } // end for - - if (count($thefieldlikevalue) > 0) { - $fieldslikevalues[] = implode(' OR ', $thefieldlikevalue); - } - } // end for - - $implode_str = ($search_option == 1 ? ' OR ' : ' AND '); - if ( empty($fieldslikevalues)) { - // this could happen when the "inside field" does not exist - // in any selected tables - $sqlstr_where = ' WHERE FALSE'; - } else { - $sqlstr_where = ' WHERE (' . implode(') ' . $implode_str . ' (', $fieldslikevalues) . ')'; - } - unset($fieldslikevalues); - - // Builds complete queries - $sql['select_fields'] = $sqlstr_select . ' * ' . $sqlstr_from . $sqlstr_where; - // here, I think we need to still use the COUNT clause, even for - // VIEWs, anyway we have a WHERE clause that should limit results - $sql['select_count'] = $sqlstr_select . ' COUNT(*) AS `count`' . $sqlstr_from . $sqlstr_where; - $sql['delete'] = $sqlstr_delete . $sqlstr_from . $sqlstr_where; - - return $sql; - } // end of the "PMA_getSearchSqls()" function $response->addHTML( PMA_dbSearchGetSearchResults( - $tables_selected, $searched, $option_str, - $search_str, $search_option, (! empty($field_str) ? $field_str : '') + $criteriaTables, $searched, $option_str, + $criteriaSearchString, $criteriaSearchType, + (! empty($criteriaColumnName) ? $criteriaColumnName : '') ) ); -} // end 1. - -/** - * Displays database search results - * - * @param array $tables_selected Tables on which search is to be performed - * @param string $searched The search word/phrase/regexp - * @param string $option_str Type of search - * @param string $search_str the string to search - * @param integer $search_option type of search - * (1 -> 1 word at least, 2 -> all words, - * 3 -> exact string, 4 -> regexp) - * @param string $field_str Restrict the search to this field - * - * @return string HTML for search results - */ -function PMA_dbSearchGetSearchResults($tables_selected, $searched, $option_str, - $search_str, $search_option, $field_str = null -) { - $this_url_params = array( - 'db' => $GLOBALS['db'], - 'goto' => 'db_sql.php', - 'pos' => 0, - 'is_js_confirmed' => 0, - ); - $html_output = ''; - // Displays search string - $html_output .= '
' - . '' - . ''; - - $num_search_result_total = 0; - $odd_row = true; - // For each table selected as search criteria - foreach ($tables_selected as $each_table) { - // Gets the SQL statements - $newsearchsqls = PMA_getSearchSqls( - $each_table, (! empty($field_str) ? $field_str : ''), - $search_str, $search_option - ); - // Executes the "COUNT" statement - $res_cnt = PMA_DBI_fetch_value($newsearchsqls['select_count']); - $num_search_result_total += $res_cnt; - $html_output .= PMA_dbSearchGetResultsRow( - $each_table, $newsearchsqls, $odd_row - ); - $odd_row = ! $odd_row; - } // end for - $html_output .= '
' - . sprintf( - __('Search results for "%s" %s:'), - $searched, $option_str - ) - . '
'; - - if (count($tables_selected) > 1) { - $html_output .= '

'; - $html_output .= sprintf( - _ngettext( - 'Total: %s match', - 'Total: %s matches', - $num_search_result_total - ), - $num_search_result_total - ); - $html_output .= '

'; - } - return $html_output; -} - -/** - * Provides search results row with browse/delete links. - * (for a table) - * - * @param string $each_table Tables on which search is to be performed - * @param array $newsearchsqls Contains SQL queries - * @param bool $odd_row For displaying contrasting table rows - * - * @return string HTML row - */ -function PMA_dbSearchGetResultsRow($each_table, $newsearchsqls, $odd_row) -{ - $res_cnt = PMA_DBI_fetch_value($newsearchsqls['select_count']); - // Start forming search results row - $html_output = ''; - $html_output .= ''; - $html_output .= sprintf( - _ngettext( - '%1$s match in %2$s', - '%1$s matches in %2$s', $res_cnt - ), - $res_cnt, htmlspecialchars($each_table) - ); - $html_output .= ''; - - if ($res_cnt > 0) { - $this_url_params['sql_query'] = $newsearchsqls['select_fields']; - $browse_result_path = 'sql.php' . PMA_generate_common_url($this_url_params); - $html_output .= '' - . __('Browse') . ''; - $this_url_params['sql_query'] = $newsearchsqls['delete']; - $delete_result_path = 'sql.php' . PMA_generate_common_url($this_url_params); - $html_output .= '' - . __('Delete') . ''; - } else { - $html_output .= ' ' - .' '; - }// end if else - $html_output .= ''; - return $html_output; } /** @@ -338,131 +137,11 @@ if ($GLOBALS['is_ajax_request'] == true) { $response->addHTML('');//end searchresults div } -/** - * Provides the main search form's html - * - * @param string $searched Keyword/Regular expression to be searched - * @param integer $search_option Type of search (one word, phrase etc.) - * @param array $tables_names_only Names of all tables - * @param array $tables_selected Tables on which search is to be performed - * @param array $url_params URL parameters - * @param string $field_str Restrict the search to this field - * - * @return string HTML for selection form - */ -function PMA_dbSearchGetSelectionForm($searched, $search_option, $tables_names_only, - $tables_selected, $url_params, $field_str = null -) { - - $common_functions = PMA_CommonFunctions::getInstance(); - - $html_output = ''; - $html_output .= '
'; - $html_output .= PMA_generate_common_hidden_inputs($GLOBALS['db']); - $html_output .= '
'; - // set legend caption - $html_output .= '' . __('Search in database') . ''; - $html_output .= ''; - // inputbox for search phrase - $html_output .= ''; - $html_output .= ''; - $html_output .= ''; - $html_output .= ''; - // choices for types of search - $html_output .= ''; - $html_output .= ''; - $html_output .= ''; - // displays table names as select options - $html_output .= ''; - $html_output .= ''; - $html_output .= ''; - $html_output .= ''; - $html_output .= ''; - $html_output .= ''; - $html_output .= ''; - $html_output .= ''; - $html_output .= '
' . __('Words or values to search for (wildcard: "%"):') - . '
' . __('Find:') . ''; - $choices = array( - '1' => __('at least one of the words') . $common_functions->showHint(__('Words are separated by a space character (" ").')), - '2' => __('all words') . $common_functions->showHint(__('Words are separated by a space character (" ").')), - '3' => __('the exact phrase'), - '4' => __('as regular expression') . ' ' . $common_functions->showMySQLDocu('Regexp', 'Regexp') - ); - // 4th parameter set to true to add line breaks - // 5th parameter set to false to avoid htmlspecialchars() escaping in the label - // since we have some HTML in some labels - $html_output .= $common_functions->getRadioFields( - 'search_option', $choices, $search_option, true, false - ); - $html_output .= '
' . __('Inside tables:') . ''; - $html_output .= ''; - $alter_select - = '' . __('Select All') . '' - . ' / ' - . '' . __('Unselect All') . ''; - $html_output .= '
' . $alter_select . '
' . __('Inside column:') . '
'; - $html_output .= '
'; - $html_output .= '
'; - $html_output .= ''; - $html_output .= '
'; - $html_output .= '
'; - $html_output .= getResultDivs(); - - return $html_output; -} - -/** - * Provides div tags for browsing search results and sql query form. - * - * @return string div tags - */ -function getResultDivs() -{ - $html_output = ''; - $html_output .= '
'; - $html_output .= ''; - $html_output .= '
'; - // div for browsing results - $html_output .= '
'; - $html_output .= ''; - $html_output .= '
'; - $html_output .= '
'; - $html_output .= '
'; - $html_output .= ''; - $html_output .= '
'; - $html_output .= ''; - $html_output .= ''; - return $html_output; -} - +// Add search form $response->addHTML( PMA_dbSearchGetSelectionForm( - $searched, $search_option, $tables_names_only, $tables_selected, $url_params, - (! empty($field_str) ? $field_str : '') + $searched, $criteriaSearchType, $tables_names_only, $criteriaTables, + $url_params, (! empty($criteriaColumnName) ? $criteriaColumnName : '') ) ); ?> diff --git a/libraries/db_search.lib.php b/libraries/db_search.lib.php new file mode 100644 index 0000000000..14032db9dd --- /dev/null +++ b/libraries/db_search.lib.php @@ -0,0 +1,363 @@ + 1 word at least, 2 -> all words, + * 3 -> exact string, 4 -> regexp) + * + * @return array 3 SQL querys (for count, display and delete results) + * + * @todo can we make use of fulltextsearch IN BOOLEAN MODE for this? + * PMA_backquote + * PMA_DBI_free_result + * PMA_DBI_fetch_assoc + * $GLOBALS['db'] + * explode + * count + * strlen + */ +function PMA_getSearchSqls($table, $criteriaColumnName, $criteriaSearchString, + $criteriaSearchType +) { + // Statement types + $sqlstr_select = 'SELECT'; + $sqlstr_delete = 'DELETE'; + // Table to use + $sqlstr_from = ' FROM ' + . PMA_backquote($GLOBALS['db']) . '.' . PMA_backquote($table); + // Search words or pattern + $search_words = (($criteriaSearchType > 2) + ? array($criteriaSearchString) : explode(' ', $criteriaSearchString)); + + $like_or_regex = (($criteriaSearchType == 4) ? 'REGEXP' : 'LIKE'); + $automatic_wildcard = (($criteriaSearchType < 3) ? '%' : ''); + + $where_clause = PMA_dbSearchGetWhereClause( + $table, $search_words, $criteriaSearchType, $criteriaColumnName, + $like_or_regex, $automatic_wildcard + ); + + // Builds complete queries + $sql['select_columns'] = $sqlstr_select . ' * ' . $sqlstr_from . $where_clause; + // here, I think we need to still use the COUNT clause, even for + // VIEWs, anyway we have a WHERE clause that should limit results + $sql['select_count'] = $sqlstr_select . ' COUNT(*) AS `count`' + . $sqlstr_from . $where_clause; + $sql['delete'] = $sqlstr_delete . $sqlstr_from . $where_clause; + + return $sql; +} + +/** + * Provides where clause for bulding SQL query + * + * @param string $table the table name + * @param integer $search_words Search words or pattern + * @param integer $criteriaSearchType Type of search + * (1 -> 1 word at least, 2 -> all words, + * 3 -> exact string, 4 -> regexp) + * @param string $criteriaColumnName Restrict the search to this column + * @param string $like_or_regex Whether to use 'LIKE' or 'REGEXP' + * @param string $automatic_wildcard Use automatic wildcard + * + * @return string The generated where clause + */ +function PMA_dbSearchGetWhereClause($table, $search_words, $criteriaSearchType, + $criteriaColumnName, $like_or_regex, $automatic_wildcard +) { + $where_clause = ''; + // Columns to select + $allColumns = PMA_DBI_get_columns($GLOBALS['db'], $table); + $likeClauses = array(); + + foreach ($search_words as $search_word) { + // Eliminates empty values + if (strlen($search_word) === 0) { + continue; + } + $likeClausesPerColumn = array(); + // for each column in the table + foreach ($allColumns as $column) { + if (! isset($criteriaColumnName) + || strlen($criteriaColumnName) == 0 + || $column['Field'] == $criteriaColumnName + ) { + // Drizzle has no CONVERT and all text columns are UTF-8 + $column = ((PMA_DRIZZLE) + ? PMA_backquote($column['Field']) + : 'CONVERT(' . PMA_backquote($column['Field']) . ' USING utf8)'); + $likeClausesPerColumn[] = $column . ' ' . $like_or_regex . ' ' + . "'" + . $automatic_wildcard . $search_word . $automatic_wildcard + . "'"; + } + } // end for + if (count($likeClausesPerColumn) > 0) { + $likeClauses[] = implode(' OR ', $likeClausesPerColumn); + } + } // end for + + $implode_str = ($criteriaSearchType == 1 ? ' OR ' : ' AND '); + if ( empty($likeClauses)) { + // this could happen when the "inside column" does not exist + // in any selected tables + $where_clause = ' WHERE FALSE'; + } else { + $where_clause = ' WHERE (' . implode(') ' . $implode_str . ' (', $likeClauses) . ')'; + } + return $where_clause; +} + +/** + * Displays database search results + * + * @param array $criteriaTables Tables on which search is to be performed + * @param string $searched The search word/phrase/regexp + * @param string $option_str Type of search + * @param string $criteriaSearchString The string to search + * @param integer $criteriaSearchType Type of search + * (1 -> 1 word at least, 2 -> all words, + * 3 -> exact string, 4 -> regexp) + * @param string $criteriaColumnName Restrict the search to this column + * + * @return string HTML for search results + */ +function PMA_dbSearchGetSearchResults($criteriaTables, $searched, $option_str, + $criteriaSearchString, $criteriaSearchType, $criteriaColumnName = null +) { + $html_output = ''; + // Displays search string + $html_output .= '
' + . '' + . ''; + + $num_search_result_total = 0; + $odd_row = true; + // For each table selected as search criteria + foreach ($criteriaTables as $each_table) { + // Gets the SQL statements + $newsearchsqls = PMA_getSearchSqls( + $each_table, (! empty($criteriaColumnName) ? $criteriaColumnName : ''), + $criteriaSearchString, $criteriaSearchType + ); + // Executes the "COUNT" statement + $res_cnt = PMA_DBI_fetch_value($newsearchsqls['select_count']); + $num_search_result_total += $res_cnt; + $html_output .= PMA_dbSearchGetResultsRow( + $each_table, $newsearchsqls, $odd_row + ); + $odd_row = ! $odd_row; + } // end for + $html_output .= '
' + . sprintf( + __('Search results for "%s" %s:'), + $searched, $option_str + ) + . '
'; + + if (count($criteriaTables) > 1) { + $html_output .= '

'; + $html_output .= sprintf( + _ngettext( + 'Total: %s match', + 'Total: %s matches', + $num_search_result_total + ), + $num_search_result_total + ); + $html_output .= '

'; + } + return $html_output; +} + +/** + * Provides search results row with browse/delete links. + * (for a table) + * + * @param string $each_table Tables on which search is to be performed + * @param array $newsearchsqls Contains SQL queries + * @param bool $odd_row For displaying contrasting table rows + * + * @return string HTML row + */ +function PMA_dbSearchGetResultsRow($each_table, $newsearchsqls, $odd_row) +{ + $this_url_params = array( + 'db' => $GLOBALS['db'], + 'goto' => 'db_sql.php', + 'pos' => 0, + 'is_js_confirmed' => 0, + ); + $res_cnt = PMA_DBI_fetch_value($newsearchsqls['select_count']); + // Start forming search results row + $html_output = ''; + $html_output .= ''; + $html_output .= sprintf( + _ngettext( + '%1$s match in %2$s', + '%1$s matches in %2$s', $res_cnt + ), + $res_cnt, htmlspecialchars($each_table) + ); + $html_output .= ''; + + if ($res_cnt > 0) { + $this_url_params['sql_query'] = $newsearchsqls['select_columns']; + $browse_result_path = 'sql.php' . PMA_generate_common_url($this_url_params); + $html_output .= '' + . __('Browse') . ''; + $this_url_params['sql_query'] = $newsearchsqls['delete']; + $delete_result_path = 'sql.php' . PMA_generate_common_url($this_url_params); + $html_output .= '' + . __('Delete') . ''; + } else { + $html_output .= ' ' + .' '; + }// end if else + $html_output .= ''; + return $html_output; +} + +/** + * Provides the main search form's html + * + * @param string $searched Keyword/Regular expression to be searched + * @param integer $criteriaSearchType Type of search (one word, phrase etc.) + * @param array $tables_names_only Names of all tables + * @param array $criteriaTables Tables on which search is to be performed + * @param array $url_params URL parameters + * @param string $criteriaColumnName Restrict the search to this column + * + * @return string HTML for selection form + */ +function PMA_dbSearchGetSelectionForm($searched, $criteriaSearchType, + $tables_names_only, $criteriaTables, $url_params, $criteriaColumnName = null +) { + $html_output = ''; + $html_output .= '
'; + $html_output .= PMA_generate_common_hidden_inputs($GLOBALS['db']); + $html_output .= '
'; + // set legend caption + $html_output .= '' . __('Search in database') . ''; + $html_output .= ''; + // inputbox for search phrase + $html_output .= ''; + $html_output .= ''; + $html_output .= ''; + $html_output .= ''; + // choices for types of search + $html_output .= ''; + $html_output .= ''; + $html_output .= ''; + // displays table names as select options + $html_output .= ''; + $html_output .= ''; + $html_output .= ''; + $html_output .= ''; + $html_output .= ''; + $html_output .= ''; + $html_output .= ''; + $html_output .= ''; + $html_output .= '
' . __('Words or values to search for (wildcard: "%"):') + . '
' . __('Find:') . ''; + $choices = array( + '1' => __('at least one of the words') . PMA_showHint(__('Words are separated by a space character (" ").')), + '2' => __('all words') . PMA_showHint(__('Words are separated by a space character (" ").')), + '3' => __('the exact phrase'), + '4' => __('as regular expression') . ' ' . PMA_showMySQLDocu('Regexp', 'Regexp') + ); + // 4th parameter set to true to add line breaks + // 5th parameter set to false to avoid htmlspecialchars() escaping in the label + // since we have some HTML in some labels + $html_output .= PMA_getRadioFields( + 'criteriaSearchType', $choices, $criteriaSearchType, true, false + ); + $html_output .= '
' . __('Inside tables:') . ''; + $html_output .= ''; + $alter_select + = '' . __('Select All') . '' + . ' / ' + . '' . __('Unselect All') . ''; + $html_output .= '
' . $alter_select . '
' . __('Inside column:') . '
'; + $html_output .= '
'; + $html_output .= '
'; + $html_output .= ''; + $html_output .= '
'; + $html_output .= '
'; + $html_output .= getResultDivs(); + + return $html_output; +} + +/** + * Provides div tags for browsing search results and sql query form. + * + * @return string div tags + */ +function getResultDivs() +{ + $html_output = ''; + $html_output .= '
'; + $html_output .= ''; + $html_output .= '
'; + // div for browsing results + $html_output .= '
'; + $html_output .= ''; + $html_output .= '
'; + $html_output .= '
'; + $html_output .= '
'; + $html_output .= ''; + $html_output .= '
'; + $html_output .= ''; + $html_output .= ''; + return $html_output; +} +?> diff --git a/libraries/display_import_ajax.lib.php b/libraries/display_import_ajax.lib.php index 8d0d4156e3..4948ac2189 100644 --- a/libraries/display_import_ajax.lib.php +++ b/libraries/display_import_ajax.lib.php @@ -121,6 +121,6 @@ function PMA_import_nopluginCheck() function PMA_importAjaxStatus($id) { header('Content-type: application/json'); - echo json_encode(PMA_getUploadStatus($id)); + echo json_encode($_SESSION[$SESSION_KEY]["handler"]::getUploadStatus($id)); } ?> diff --git a/po/pt_BR.po b/po/pt_BR.po index 43243f4058..e95a27dce1 100644 --- a/po/pt_BR.po +++ b/po/pt_BR.po @@ -4,7 +4,7 @@ msgstr "" "Project-Id-Version: phpMyAdmin 4.0.0-dev\n" "Report-Msgid-Bugs-To: phpmyadmin-devel@lists.sourceforge.net\n" "POT-Creation-Date: 2012-06-28 09:04+0200\n" -"PO-Revision-Date: 2012-06-28 13:50+0200\n" +"PO-Revision-Date: 2012-06-28 16:25+0200\n" "Last-Translator: Alexsandro Preis Dubinski \n" "Language-Team: brazilian_portuguese \n" "Language: pt_BR\n" @@ -2489,13 +2489,11 @@ msgid "Start row" msgstr "Linha inicial" #: libraries/DisplayResults.class.php:677 -#, fuzzy #| msgid "Number of fields" msgid "Number of rows" msgstr "Número de linhas" #: libraries/DisplayResults.class.php:686 -#, fuzzy #| msgid "More" msgid "Mode" msgstr "Modo" @@ -2553,14 +2551,12 @@ msgstr "Opções" #: libraries/DisplayResults.class.php:1329 #: libraries/DisplayResults.class.php:1435 -#, fuzzy #| msgid "Partial Texts" msgid "Partial texts" msgstr "Textos parciais" #: libraries/DisplayResults.class.php:1330 #: libraries/DisplayResults.class.php:1439 -#, fuzzy #| msgid "Full Texts" msgid "Full texts" msgstr "Textos completos" @@ -2578,7 +2574,6 @@ msgid "Show binary contents" msgstr "Mostrar conteúdo binário" #: libraries/DisplayResults.class.php:1362 -#, fuzzy msgid "Show BLOB contents" msgstr "Exibir conteúdo BLOB" @@ -6186,14 +6181,13 @@ msgid "possible deep recursion attack" msgstr "possível ataque de recursão profunda" #: libraries/database_interface.lib.php:1939 -#, fuzzy #| msgid " the local MySQL server's socket is not correctly configured)" msgid "" "The server is not responding (or the local server's socket is not correctly " "configured)." msgstr "" "O servidor não está respondendo (ou o soquete do servidor local não está " -"configurado corretamente)" +"configurado corretamente)." #: libraries/database_interface.lib.php:1942 msgid "The server is not responding." @@ -6291,7 +6285,6 @@ msgid "Exporting rows from \"%s\" table" msgstr "Exportar linhas da tabela \"%s\"" #: libraries/display_export.lib.php:104 -#, fuzzy #| msgid "Export type" msgid "Export Method:" msgstr "Método de exportação:" @@ -6391,16 +6384,15 @@ msgid "zipped" msgstr "compactado" #: libraries/display_export.lib.php:336 -#, fuzzy #| msgid "\"gzipped\"" msgid "gzipped" -msgstr "\"compactado com gzip\"" +msgstr "compactado com gzip" #: libraries/display_export.lib.php:338 #, fuzzy #| msgid "\"bzipped\"" msgid "bzipped" -msgstr "\"compactado com bzip\"" +msgstr "compactado com bzip" #: libraries/display_export.lib.php:347 msgid "View output as text" @@ -6777,9 +6769,8 @@ msgid "" msgstr "" #: libraries/engines/pbxt.lib.php:38 -#, fuzzy msgid "Log cache size" -msgstr "Tamanho do buffer de ordenação" +msgstr "Tamanho do cache do log" #: libraries/engines/pbxt.lib.php:39 msgid "" @@ -6840,9 +6831,8 @@ msgid "" msgstr "" #: libraries/engines/pbxt.lib.php:68 -#, fuzzy msgid "Log buffer size" -msgstr "Tamanho do buffer de ordenação" +msgstr "Tamanho do buffer do log" #: libraries/engines/pbxt.lib.php:69 msgid "" @@ -6887,10 +6877,9 @@ msgid "" msgstr "" #: libraries/engines/pbxt.lib.php:133 -#, fuzzy #| msgid "Relations" msgid "Related Links" -msgstr "Relações" +msgstr "Links relatados" #: libraries/engines/pbxt.lib.php:135 msgid "The PrimeBase XT Blog by Paul McCullagh" @@ -6924,26 +6913,26 @@ msgid "Edit structure by following the \"Structure\" link" msgstr "" #: libraries/import.lib.php:1175 -#, fuzzy, php-format +#, php-format msgid "Go to database: %s" -msgstr "Sem bases" +msgstr "Ir para bando de dados: %s" #: libraries/import.lib.php:1178 libraries/import.lib.php:1206 -#, fuzzy, php-format +#, php-format #| msgid "Missing data for %s" msgid "Edit settings for %s" -msgstr "dado faltante para %s" +msgstr "Editar configurações para %s" #: libraries/import.lib.php:1201 -#, fuzzy, php-format +#, php-format msgid "Go to table: %s" -msgstr "Sem bases" +msgstr "Ir para tabela: %s" #: libraries/import.lib.php:1204 -#, fuzzy, php-format +#, php-format #| msgid "Structure only" msgid "Structure of %s" -msgstr "Somente estrutura" +msgstr "Estrutura do %s" #: libraries/import.lib.php:1212 #, php-format @@ -7028,11 +7017,10 @@ msgid "Inserted row id: %1$d" msgstr "Id da linha inserida: %1$d" #: libraries/kanji-encoding.lib.php:147 -#, fuzzy #| msgid "None" msgctxt "None encoding conversion" msgid "None" -msgstr "Nenhum" +msgstr "Nenhuma" #. l10n: This is currently used only in Japanese locales #: libraries/kanji-encoding.lib.php:153 @@ -7040,10 +7028,9 @@ msgid "Convert to Kana" msgstr "" #: libraries/mult_submits.inc.php:277 -#, fuzzy #| msgid "Fri" msgid "From" -msgstr "Sex" +msgstr "Do" #: libraries/mult_submits.inc.php:280 msgid "To" @@ -7059,7 +7046,6 @@ msgid "Add table prefix" msgstr "" #: libraries/mult_submits.inc.php:293 -#, fuzzy #| msgid "Add index" msgid "Add prefix" msgstr "Adicionar índice" @@ -7277,7 +7263,6 @@ msgid "Reload navigation frame" msgstr "" #: libraries/plugin_interface.lib.php:350 -#, fuzzy #| msgid "This format has no options" msgid "This format has no options" msgstr "Esse formato não tem opções" @@ -7405,10 +7390,9 @@ msgstr "Colunas delimitadas por:" #: libraries/plugins/export/ExportCsv.class.php:112 #: libraries/plugins/import/ImportCsv.class.php:92 -#, fuzzy #| msgid "Fields escaped by" msgid "Columns escaped with:" -msgstr "Campos pulados por:" +msgstr "Campos escapou com:" #: libraries/plugins/export/ExportCsv.class.php:117 #: libraries/plugins/import/ImportCsv.class.php:99 @@ -7439,7 +7423,6 @@ msgstr "Edição do Excel:" #: libraries/plugins/export/ExportSql.class.php:375 #: libraries/plugins/export/ExportTexytext.class.php:68 #: libraries/plugins/export/ExportXml.class.php:132 -#, fuzzy msgid "Data dump options" msgstr "Opções de exportação do Banco de Dados" @@ -7462,10 +7445,9 @@ msgstr "Evento" #: libraries/plugins/export/ExportTexytext.class.php:427 #: libraries/rte/rte_events.lib.php:469 libraries/rte/rte_routines.lib.php:967 #: libraries/rte/rte_triggers.lib.php:362 -#, fuzzy #| msgid "Description" msgid "Definition" -msgstr "Descrição" +msgstr "Definição" #: libraries/plugins/export/ExportHtmlword.class.php:544 #: libraries/plugins/export/ExportOdt.class.php:632 @@ -7489,58 +7471,51 @@ msgid "Stand-in structure for view" msgstr "Estrutura stand-in para visualizar" #: libraries/plugins/export/ExportLatex.class.php:42 -#, fuzzy #| msgid "Content of table __TABLE__" msgid "Content of table @TABLE@" -msgstr "Conteúdo da tabela __TABLE__" +msgstr "Conteúdo da tabela @TABLE@" #: libraries/plugins/export/ExportLatex.class.php:43 msgid "(continued)" msgstr "(continuação)" #: libraries/plugins/export/ExportLatex.class.php:44 -#, fuzzy #| msgid "Structure of table __TABLE__" msgid "Structure of table @TABLE@" -msgstr "Estrutura da tabela __TABLE__" +msgstr "Estrutura da tabela @TABLE@" #: libraries/plugins/export/ExportLatex.class.php:109 #: libraries/plugins/export/ExportOdt.class.php:82 #: libraries/plugins/export/ExportSql.class.php:277 -#, fuzzy #| msgid "Transformation options" msgid "Object creation options" -msgstr "Opções de transformação" +msgstr "Opções de criação de objetos" #: libraries/plugins/export/ExportLatex.class.php:121 #: libraries/plugins/export/ExportLatex.class.php:175 -#, fuzzy #| msgid "Table caption" msgid "Table caption (continued)" -msgstr "Leganda da Tabela" +msgstr "Legenda da tabela(continuação)" #: libraries/plugins/export/ExportLatex.class.php:134 #: libraries/plugins/export/ExportOdt.class.php:89 #: libraries/plugins/export/ExportSql.class.php:174 -#, fuzzy #| msgid "Disable foreign key checks" msgid "Display foreign key relationships" msgstr "Desabilitar verificação de chaves estrangeiras" #: libraries/plugins/export/ExportLatex.class.php:140 #: libraries/plugins/export/ExportOdt.class.php:95 -#, fuzzy #| msgid "Displaying Column Comments" msgid "Display comments" -msgstr "Exibindo comentários da coluna" +msgstr "Exibir comentários" #: libraries/plugins/export/ExportLatex.class.php:146 #: libraries/plugins/export/ExportOdt.class.php:101 #: libraries/plugins/export/ExportSql.class.php:181 -#, fuzzy #| msgid "Available MIME types" msgid "Display MIME types" -msgstr "MIME-type disponíveis" +msgstr "Mostrar os MIME-type" #: libraries/plugins/export/ExportLatex.class.php:223 #: libraries/plugins/export/ExportSql.class.php:691 @@ -7611,12 +7586,9 @@ msgid "" msgstr "" #: libraries/plugins/export/ExportSql.class.php:160 -#, fuzzy #| msgid "Add custom comment into header (\\n splits lines)" msgid "Additional custom header comment (\\n splits lines):" -msgstr "" -"Adicionar comentário pessoal no cabeçalho (\n" -" quebra linhas)" +msgstr "Adicionar comentário pessoal no cabeçalho (\\n quebras de linha):" #: libraries/plugins/export/ExportSql.class.php:166 msgid "" @@ -7632,10 +7604,10 @@ msgstr "" #: libraries/plugins/export/ExportSql.class.php:242 #: libraries/plugins/export/ExportSql.class.php:310 #: libraries/plugins/export/ExportSql.class.php:318 -#, fuzzy, php-format +#, php-format #| msgid "Statements" msgid "Add %s statement" -msgstr "Comandos" +msgstr "Adicionar comando %s" #: libraries/plugins/export/ExportSql.class.php:287 msgid "Add statements:" @@ -7737,10 +7709,9 @@ msgid "RELATIONS FOR TABLE" msgstr "RELAÇÕES PARA A TABELA" #: libraries/plugins/export/ExportSql.class.php:1512 -#, fuzzy #| msgid "Allows reading data." msgid "Error reading data:" -msgstr "Permitir leitura dos dados." +msgstr "Erro ao ler dados:" #: libraries/plugins/export/ExportXml.class.php:68 #: libraries/plugins/import/ImportXml.class.php:49 @@ -7752,15 +7723,13 @@ msgid "Object creation options (all are recommended)" msgstr "" #: libraries/plugins/export/ExportXml.class.php:121 -#, fuzzy #| msgid "View" msgid "Views" -msgstr "Visão" +msgstr "Visualizações" #: libraries/plugins/export/ExportXml.class.php:137 -#, fuzzy msgid "Export contents" -msgstr "Tipo de exportação" +msgstr "Exportar conteúdo" #: libraries/plugins/import/ImportCsv.class.php:109 #: libraries/plugins/import/ImportOds.class.php:63 @@ -7777,10 +7746,9 @@ msgid "" msgstr "" #: libraries/plugins/import/ImportCsv.class.php:126 -#, fuzzy #| msgid "Column names" msgid "Column names: " -msgstr "Nome das colunas" +msgstr "Nome das colunas:" #: libraries/plugins/import/ImportCsv.class.php:169 #: libraries/plugins/import/ImportCsv.class.php:184 @@ -7804,7 +7772,7 @@ msgid "Invalid format of CSV input on line %d." msgstr "Formato inválido na linha %d da entrada CSV." #: libraries/plugins/import/ImportCsv.class.php:473 -#, fuzzy, php-format +#, php-format #| msgid "Invalid field count in CSV input on line %d." msgid "Invalid column count in CSV input on line %d." msgstr "Contador de campo inválido na linha %d da entrada CSV." @@ -7871,10 +7839,9 @@ msgid "MySQL Spatial Extension does not support ESRI type \"%s\"." msgstr "" #: libraries/plugins/import/ImportShp.class.php:256 -#, fuzzy #| msgid "File %s does not contain any key id" msgid "The imported file does not contain any data" -msgstr "Arquivo %s não contém qualquer identificação da chave" +msgstr "Os arquivos importados não contém dados válidos" #: libraries/plugins/import/ImportSql.class.php:57 msgid "SQL compatibility mode:" @@ -8098,10 +8065,9 @@ msgid "SQL history" msgstr "Histórico SQL" #: libraries/relation.lib.php:214 -#, fuzzy #| msgid "Persistent connections" msgid "Persistent recently used tables" -msgstr "Conexões persistentes" +msgstr "Tabelas persistentes recentemente usadas" #: libraries/relation.lib.php:225 msgid "Persistent tables' UI preferences" @@ -8169,14 +8135,12 @@ msgid "Port" msgstr "Porta" #: libraries/replication_gui.lib.php:107 -#, fuzzy msgid "Master status" -msgstr "Exibir status dos escravos" +msgstr "Status principal" #: libraries/replication_gui.lib.php:109 -#, fuzzy msgid "Slave status" -msgstr "Exibir status dos escravos" +msgstr "Status dos secundários" #: libraries/replication_gui.lib.php:118 libraries/sql_query_form.lib.php:415 #: server_status.php:1501 server_variables.php:123 @@ -8246,10 +8210,9 @@ msgid "The following query has failed: \"%s\"" msgstr "A seguinte consulta falhou: \"%s\"" #: libraries/rte/rte_events.lib.php:116 -#, fuzzy #| msgid "Sorry, we failed to restore the dropped routine." msgid "Sorry, we failed to restore the dropped event." -msgstr "Desculpa, mas falhamos ao restaurar a rotina." +msgstr "Desculpe, mas falhamos ao restaurar o evento caído." #: libraries/rte/rte_events.lib.php:117 libraries/rte/rte_routines.lib.php:298 #: libraries/rte/rte_triggers.lib.php:90 @@ -8257,16 +8220,16 @@ msgid "The backed up query was:" msgstr "A consulta de backup foi:" #: libraries/rte/rte_events.lib.php:121 -#, fuzzy, php-format +#, php-format #| msgid "Routine %1$s has been modified." msgid "Event %1$s has been modified." -msgstr "A rotina %1$s foi modificada." +msgstr "O evento %1$s foi modificado." #: libraries/rte/rte_events.lib.php:133 -#, fuzzy, php-format +#, php-format #| msgid "Table %1$s has been created." msgid "Event %1$s has been created." -msgstr "A tabela %1$s foi criada." +msgstr "O evento %1$s foi criada." #: libraries/rte/rte_events.lib.php:141 libraries/rte/rte_routines.lib.php:329 #: libraries/rte/rte_triggers.lib.php:114 @@ -8275,10 +8238,9 @@ msgstr "" "Um ou mais erros ocorreram durante o processamento de sua requisição:" #: libraries/rte/rte_events.lib.php:186 -#, fuzzy #| msgid "Edit server" msgid "Edit event" -msgstr "Editar servidor" +msgstr "Editar evento" #: libraries/rte/rte_events.lib.php:213 libraries/rte/rte_routines.lib.php:409 #: libraries/rte/rte_routines.lib.php:1336 @@ -8293,51 +8255,45 @@ msgid "Details" msgstr "Detalhes" #: libraries/rte/rte_events.lib.php:378 -#, fuzzy #| msgid "Event type" msgid "Event name" -msgstr "Tipo de evento" +msgstr "Nome do evento" #: libraries/rte/rte_events.lib.php:399 server_binlog.php:177 msgid "Event type" msgstr "Tipo de evento" #: libraries/rte/rte_events.lib.php:420 libraries/rte/rte_routines.lib.php:893 -#, fuzzy, php-format +#, php-format #| msgid "Change" msgid "Change to %s" -msgstr "Alterar" +msgstr "Alterar para %s" #: libraries/rte/rte_events.lib.php:426 -#, fuzzy #| msgid "Execute" msgid "Execute at" -msgstr "Executar" +msgstr "Executar em" #: libraries/rte/rte_events.lib.php:434 -#, fuzzy #| msgid "Execute" msgid "Execute every" -msgstr "Executar" +msgstr "Executar sempre" #: libraries/rte/rte_events.lib.php:453 -#, fuzzy msgctxt "Start of recurring event" msgid "Start" -msgstr "Status" +msgstr "Início" #: libraries/rte/rte_events.lib.php:461 -#, fuzzy #| msgid "End" msgctxt "End of recurring event" msgid "End" -msgstr "Fim" +msgstr "Final" #: libraries/rte/rte_events.lib.php:475 -#, fuzzy #| msgid "Complete inserts" msgid "On completion preserve" -msgstr "Inserções completas" +msgstr "Após a conclusão manter" #: libraries/rte/rte_events.lib.php:479 libraries/rte/rte_routines.lib.php:977 #: libraries/rte/rte_triggers.lib.php:368 @@ -8387,10 +8343,9 @@ msgid "Event scheduler status" msgstr "" #: libraries/rte/rte_list.lib.php:55 -#, fuzzy #| msgid "Return type" msgid "Returns" -msgstr "Tipo de returno" +msgstr "Retornos" #: libraries/rte/rte_routines.lib.php:69 #, fuzzy @@ -8434,62 +8389,55 @@ msgid "Edit routine" msgstr "Editar rotina" #: libraries/rte/rte_routines.lib.php:875 -#, fuzzy #| msgid "Routines" msgid "Routine name" -msgstr "Rotinas" +msgstr "Nome das rotinas" #: libraries/rte/rte_routines.lib.php:898 msgid "Parameters" msgstr "" #: libraries/rte/rte_routines.lib.php:903 -#, fuzzy #| msgid "Direct links" msgid "Direction" -msgstr "Links diretos" +msgstr "Diração" #: libraries/rte/rte_routines.lib.php:906 libraries/tbl_properties.inc.php:87 msgid "Length/Values" msgstr "Tamanho/Definir*" #: libraries/rte/rte_routines.lib.php:921 -#, fuzzy #| msgid "Add index" msgid "Add parameter" msgstr "Adicionar índice" #: libraries/rte/rte_routines.lib.php:925 -#, fuzzy #| msgid "Remove database" msgid "Remove last parameter" -msgstr "Remover Banco de Dados" +msgstr "Remover último índice" #: libraries/rte/rte_routines.lib.php:930 msgid "Return type" msgstr "Tipo de returno" #: libraries/rte/rte_routines.lib.php:936 -#, fuzzy #| msgid "Length/Values" msgid "Return length/values" -msgstr "Tamanho/Definir*" +msgstr "Retornar comprimento/valores" #: libraries/rte/rte_routines.lib.php:942 -#, fuzzy #| msgid "Table options" msgid "Return options" -msgstr "Opções da tabela" +msgstr "Opções de retorno" #: libraries/rte/rte_routines.lib.php:973 msgid "Is deterministic" msgstr "" #: libraries/rte/rte_routines.lib.php:982 -#, fuzzy #| msgid "Security" msgid "Security type" -msgstr "Segurança" +msgstr "Tipo de segurança" #: libraries/rte/rte_routines.lib.php:989 msgid "SQL data access" @@ -8542,43 +8490,38 @@ msgstr "Executar rotina" #: libraries/rte/rte_routines.lib.php:1425 #: libraries/rte/rte_routines.lib.php:1428 -#, fuzzy #| msgid "Routines" msgid "Routine parameters" -msgstr "Rotinas" +msgstr "Parâmetros da rotina" #: libraries/rte/rte_triggers.lib.php:89 -#, fuzzy #| msgid "Sorry, we failed to restore the dropped routine." msgid "Sorry, we failed to restore the dropped trigger." msgstr "Desculpa, mas falhamos ao restaurar a rotina." #: libraries/rte/rte_triggers.lib.php:94 -#, fuzzy, php-format +#, php-format #| msgid "Routine %1$s has been modified." msgid "Trigger %1$s has been modified." msgstr "A rotina %1$s foi modificada." #: libraries/rte/rte_triggers.lib.php:106 -#, fuzzy, php-format +#, php-format #| msgid "Table %1$s has been created." msgid "Trigger %1$s has been created." -msgstr "A tabela %1$s foi criada." +msgstr "A rotina %1$s foi criada." #: libraries/rte/rte_triggers.lib.php:166 -#, fuzzy #| msgid "Add a new server" msgid "Edit trigger" -msgstr "Adicionar novo servidor" +msgstr "Editar rotina" #: libraries/rte/rte_triggers.lib.php:313 -#, fuzzy #| msgid "Triggers" msgid "Trigger name" -msgstr "Gatilhos" +msgstr "Nome da rotina" #: libraries/rte/rte_triggers.lib.php:334 -#, fuzzy #| msgid "Time" msgctxt "Trigger action time" msgid "Time" @@ -8597,17 +8540,15 @@ msgid "You must provide a valid event for the trigger" msgstr "" #: libraries/rte/rte_triggers.lib.php:429 -#, fuzzy #| msgid "Invalid table name" msgid "You must provide a valid table name" -msgstr "Nome de tabela inválida" +msgstr "Você precisa colocar um nome de tabela válido" #: libraries/rte/rte_triggers.lib.php:435 msgid "You must provide a trigger definition." msgstr "" #: libraries/rte/rte_words.lib.php:22 -#, fuzzy #| msgid "Add index" msgid "Add routine" msgstr "Adicionar índice" @@ -8618,16 +8559,14 @@ msgid "Export of routine %s" msgstr "Exportação de rotina %s" #: libraries/rte/rte_words.lib.php:25 -#, fuzzy #| msgid "Routines" msgid "routine" -msgstr "Rotinas" +msgstr "rotina" #: libraries/rte/rte_words.lib.php:26 -#, fuzzy #| msgid " do not have the necessary privileges to create a new routine" msgid "You do not have the necessary privileges to create a routine" -msgstr "Você não tem direitos suficientes para criar uma nova rotina" +msgstr "Você não tem privilégios suficientes para criar uma nova rotina" #: libraries/rte/rte_words.lib.php:27 #, php-format @@ -8639,62 +8578,55 @@ msgid "There are no routines to display." msgstr "Não existem rotinas para mostrar." #: libraries/rte/rte_words.lib.php:34 -#, fuzzy #| msgid "Add a new server" msgid "Add trigger" -msgstr "Adicionar novo servidor" +msgstr "Adicionar gatilho" #: libraries/rte/rte_words.lib.php:36 -#, fuzzy, php-format +#, php-format msgid "Export of trigger %s" -msgstr "Tipo de exportação" +msgstr "Exportação do gatilho %s" #: libraries/rte/rte_words.lib.php:37 -#, fuzzy #| msgid "Triggers" msgid "trigger" -msgstr "Gatilhos" +msgstr "Gatilho" #: libraries/rte/rte_words.lib.php:38 -#, fuzzy #| msgid " do not have the necessary privileges to create a new routine" msgid "You do not have the necessary privileges to create a trigger" -msgstr "Você não tem direitos suficientes para criar uma nova rotina" +msgstr "Você não tem permissões suficientes para criar um novo gatilho" #: libraries/rte/rte_words.lib.php:39 -#, fuzzy, php-format +#, php-format #| msgid "No routine with name %1$s found in database %2$s" msgid "No trigger with name %1$s found in database %2$s" -msgstr "Nenhuma rotina com o nome %1$s encontrada no banco de dados %2$s" +msgstr "Nenhum gatilho com o nome %1$s encontrado no banco de dados %2$s" #: libraries/rte/rte_words.lib.php:40 -#, fuzzy #| msgid "There are no files to upload" msgid "There are no triggers to display." -msgstr "Não existem triggers para mostrar" +msgstr "Não existem gatilhos para mostrar." #: libraries/rte/rte_words.lib.php:46 -#, fuzzy #| msgid "Add a new server" msgid "Add event" -msgstr "Adicionar novo servidor" +msgstr "Adicionar evento" #: libraries/rte/rte_words.lib.php:48 -#, fuzzy, php-format +#, php-format msgid "Export of event %s" -msgstr "Tipo de exportação" +msgstr "Exportação do evento %s" #: libraries/rte/rte_words.lib.php:49 -#, fuzzy #| msgid "Event" msgid "event" -msgstr "Evento" +msgstr "evento" #: libraries/rte/rte_words.lib.php:50 -#, fuzzy #| msgid " do not have the necessary privileges to create a new routine" msgid "You do not have the necessary privileges to create an event" -msgstr "Você não tem direitos suficientes para criar uma nova rotina" +msgstr "Você não tem permissões suficientes para criar um novo evento" #: libraries/rte/rte_words.lib.php:51 #, fuzzy, php-format diff --git a/po/sk.po b/po/sk.po index 42cc651e14..543d1491b0 100644 --- a/po/sk.po +++ b/po/sk.po @@ -4,15 +4,15 @@ msgstr "" "Project-Id-Version: phpMyAdmin 4.0.0-dev\n" "Report-Msgid-Bugs-To: phpmyadmin-devel@lists.sourceforge.net\n" "POT-Creation-Date: 2012-06-28 09:04+0200\n" -"PO-Revision-Date: 2012-05-17 14:52+0200\n" -"Last-Translator: Michal Čihař \n" +"PO-Revision-Date: 2012-06-29 16:10+0200\n" +"Last-Translator: Michal Remiš \n" "Language-Team: slovak \n" "Language: sk\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;\n" -"X-Generator: Weblate 1.0\n" +"X-Generator: Weblate 1.1\n" #: browse_foreigners.php:36 browse_foreigners.php:60 js/messages.php:354 #: libraries/DisplayResults.class.php:577 server_privileges.php:1838 @@ -1532,10 +1532,9 @@ msgid "From general log" msgstr "Z všeobecného logu" #: js/messages.php:172 -#, fuzzy #| msgid "Loading logs" msgid "Analysing logs" -msgstr "Načítavam záznamy" +msgstr "Analyzujem záznamy" #: js/messages.php:173 msgid "Analysing & loading logs. This may take a while." @@ -1704,16 +1703,14 @@ msgid "Import" msgstr "Import" #: js/messages.php:213 -#, fuzzy #| msgid "Could not import configuration" msgid "Import monitor configuration" -msgstr "Nepodarilo sa načítať konfiguráciu" +msgstr "Importovať konfiguráciu monitora" #: js/messages.php:214 -#, fuzzy #| msgid "Please select the primary key or a unique key" msgid "Please select the file you want to import" -msgstr "Zoľte, prosím, primárny alebo unikátny kľúč" +msgstr "Zvoľte súbor, ktorý chcete importovať" #: js/messages.php:216 msgid "Analyse Query" @@ -1951,7 +1948,7 @@ msgstr "Pohybom myši nad bodom zobrazíte jeho názov." #: js/messages.php:304 msgid "To zoom in, select a section of the plot with the mouse." -msgstr "" +msgstr "Pre priblíženie kliknite na sekciu grafu." #: js/messages.php:306 #, fuzzy @@ -1965,7 +1962,7 @@ msgstr "Kliknite na dátový bod pre zobrazenie a prípadnú úpravu dát." #: js/messages.php:310 msgid "The plot can be resized by dragging it along the bottom right corner." -msgstr "Graf môžete zvúčšiť potiahnutím za pravý dolný roh." +msgstr "Graf môžete zväčšiť potiahnutím za pravý dolný roh." #: js/messages.php:312 msgid "Select two columns" diff --git a/test/classes/PMA_DisplayResults_test.php b/test/classes/PMA_DisplayResults_test.php new file mode 100644 index 0000000000..e1c1be64f0 --- /dev/null +++ b/test/classes/PMA_DisplayResults_test.php @@ -0,0 +1,369 @@ +object = $this->getMockForAbstractClass('PMA_DisplayResults', array('as', '','','')); + + } + + /** + * Tears down the fixture, for example, closes a network connection. + * This method is called after a test is executed. + * + * @access protected + * @return void + */ + protected function tearDown() + { + unset($this->object); + } + + /** + * Call private functions by making the visibitlity to public. + * + * @param string $name method name + * @param array $params parameters for the invocation + * + * @return the output from the private method. + */ + private function _callPrivateFunction($name, $params) + { + $class = new ReflectionClass('PMA_DisplayResults'); + $method = $class->getMethod($name); + $method->setAccessible(true); + return $method->invokeArgs($this->object, $params); + } + + /** + * @param $the_disp_mode string the synthetic value for display_mode (see a few lines above for explanations) + * @param $the_total the total number of rows returned by the SQL + * query without any programmatically appended + * LIMIT clause + * (just a copy of $unlim_num_rows if it exists, + * elsecomputed inside this function) + * + * @param $output output from the _setDisplayMode method + * + * @dataProvider providerForTestSetDisplayModeCase1 + */ + public function testSetDisplayModeCase1($the_disp_mode, $the_total, $output){ + + $GLOBALS['is_count'] = true; + $GLOBALS['is_maint'] = true; + + $this->assertEquals( + $this->_callPrivateFunction( + '_setDisplayMode', + array(&$the_disp_mode, &$the_total) + ), + $output + ); + } + + /** + * @return array data for testSetDisplayModeCase1 + */ + public function providerForTestSetDisplayModeCase1() + { + return array( + array( + 'urkp111111', + 5, + array( + 'edit_lnk' => 'nn', + 'del_lnk' => 'nn', + 'sort_lnk' => 0, + 'nav_bar' => 0, + 'ins_row' => 0, + 'bkm_form' => 1, + 'text_btn' => 1, + 'pview_lnk' => 1 + ) + ), + array( + 'nnnn000000', + 5, + array( + 'edit_lnk' => 'nn', + 'del_lnk' => 'nn', + 'sort_lnk' => 0, + 'nav_bar' => 0, + 'ins_row' => 0, + 'bkm_form' => 0, + 'text_btn' => 0, + 'pview_lnk' => 0 + ) + ) + ); + } + + /** + * @param $the_disp_mode string the synthetic value for display_mode (see a few lines above for explanations) + * @param $the_total the total number of rows returned by the SQL + * query without any programmatically appended + * LIMIT clause + * (just a copy of $unlim_num_rows if it exists, + * elsecomputed inside this function) + * + * @param $output output from the _setDisplayMode method + * + * @dataProvider providerForTestSetDisplayModeCase2 + */ + public function testSetDisplayModeCase2($the_disp_mode, $the_total, $output){ + + + $GLOBALS['is_count'] = false; + $GLOBALS['is_maint'] = false; + $GLOBALS['is_analyse'] = false; + $GLOBALS['is_explain'] = false; + $GLOBALS['is_show'] = true; + $GLOBALS['sql_query'] = 'SELECT * FROM `pma_bookmark` WHERE 1'; + $GLOBALS['unlim_num_rows'] = 1; + + $this->assertEquals( + $this->_callPrivateFunction( + '_setDisplayMode', + array(&$the_disp_mode, &$the_total) + ), + $output + ); + } + + /** + * @return array data for testSetDisplayModeCase2 + */ + public function providerForTestSetDisplayModeCase2() + { + return array( + array( + 'urkp111111', + 5, + array( + 'edit_lnk' => 'nn', + 'del_lnk' => 'nn', + 'sort_lnk' => 0, + 'nav_bar' => 0, + 'ins_row' => 0, + 'bkm_form' => 1, + 'text_btn' => 1, + 'pview_lnk' => 1 + ) + ), + array( + 'nnnn000000', + 5, + array( + 'edit_lnk' => 'nn', + 'del_lnk' => 'nn', + 'sort_lnk' => 0, + 'nav_bar' => 0, + 'ins_row' => 0, + 'bkm_form' => 0, + 'text_btn' => 0, + 'pview_lnk' => 0 + ) + ) + ); + } + + /** + * @param $the_disp_mode string the synthetic value for display_mode (see a few lines above for explanations) + * @param $the_total the total number of rows returned by the SQL + * query without any programmatically appended + * LIMIT clause + * (just a copy of $unlim_num_rows if it exists, + * elsecomputed inside this function) + * + * @param $output output from the _setDisplayMode method + * + * @dataProvider providerForTestSetDisplayModeCase3 + */ + public function testSetDisplayModeCase3($the_disp_mode, $the_total, $output){ + + $GLOBALS['is_count'] = false; + $GLOBALS['is_maint'] = false; + $GLOBALS['is_analyse'] = false; + $GLOBALS['is_explain'] = false; + $GLOBALS['printview'] = '1'; + + $this->assertEquals( + $this->_callPrivateFunction( + '_setDisplayMode', + array(&$the_disp_mode, &$the_total) + ), + $output + ); + } + + /** + * @return array data for testSetDisplayModeCase3 + */ + public function providerForTestSetDisplayModeCase3() + { + return array( + array( + 'urkp111111', + 5, + array( + 'edit_lnk' => 'nn', + 'del_lnk' => 'nn', + 'sort_lnk' => 0, + 'nav_bar' => 0, + 'ins_row' => 0, + 'bkm_form' => 0, + 'text_btn' => 0, + 'pview_lnk' => 0 + ) + ), + array( + 'nnnn000000', + 5, + array( + 'edit_lnk' => 'nn', + 'del_lnk' => 'nn', + 'sort_lnk' => 0, + 'nav_bar' => 0, + 'ins_row' => 0, + 'bkm_form' => 0, + 'text_btn' => 0, + 'pview_lnk' => 0 + ) + ) + ); + } + + /** + * Test for _isSelect function + */ + public function testisSelect(){ + + $GLOBALS['is_count'] = false; + $GLOBALS['is_export'] = false; + $GLOBALS['is_func'] = false; + $GLOBALS['is_analyse'] = false; + $GLOBALS['analyzed_sql'][0]['select_expr'] = array(); + $GLOBALS['analyzed_sql'][0]['queryflags']['select_from'] = 'pma'; + $GLOBALS['analyzed_sql'][0]['table_ref'] = array('table_ref'); + + $this->assertTrue( + $this->_callPrivateFunction( + '_isSelect', + array() + ) + ); + } + + /** + * @param string $caption iconic caption for button + * @param string $title text for button + * @param integer $pos position for next query + * @param string $html_sql_query query ready for display + * @param $output output from the _getTableNavigationButton method + * + * @dataProvider providerForTestGetTableNavigationButton + */ + public function testGetTableNavigationButton($caption, $title, $pos, $html_sql_query, $output){ + + $GLOBALS['cfg']['NavigationBarIconic'] = true; + $GLOBALS['cfg']['AjaxEnable'] = true; + $_SESSION[' PMA_token '] = 'token'; + + $this->assertEquals( + $this->_callPrivateFunction( + '_getTableNavigationButton', + array(&$caption, $title, $pos, $html_sql_query) + ), + $output + ); + } + + /** + * @return array array data for testGetTableNavigationButton + */ + public function providerForTestGetTableNavigationButton() + { + return array( + array( + 'btn', + 'Submit', + 1, + 'SELECT * FROM `pma_bookmark` WHERE 1', + '
' + ) + ); + } + + /** + * @param integer $pos_next the offset for the "next" page + * @param integer $pos_prev the offset for the "previous" page + * @param string $id_for_direction_dropdown the id for the direction dropdown + * @param $output output from the _getTableNavigation method + * + * @dataProvider providerForTestGetTableNavigation + */ + public function testGetTableNavigation($pos_next, $pos_prev, $id_for_direction_dropdown, $output){ + + $_SESSION['tmp_user_values']['max_rows'] = '20'; + $GLOBALS['cfg']['AjaxEnable'] = true; + $_SESSION['tmp_user_values']['pos'] = true; + $GLOBALS['num_rows'] = '20'; + $GLOBALS['unlim_num_rows'] = '50'; + $GLOBALS['cfg']['ShowAll'] = true; + $GLOBALS['cfg']['ShowDisplayDirection'] = true; + $_SESSION['tmp_user_values']['repeat_cells'] = '1'; + $_SESSION['tmp_user_values']['disp_direction'] = '1'; + + $this->assertEquals( + str_word_count($this->_callPrivateFunction( + '_getTableNavigation', + array($pos_next, $pos_prev, $id_for_direction_dropdown) + )), + $output + ); + } + + /** + * @return array array data for testGetTableNavigation + */ + public function providerForTestGetTableNavigation() + { + return array( + array( + 21, + 41, + '123', + '526' + ) + ); + } + +} diff --git a/test/classes/PMA_Error_test.php b/test/classes/PMA_Error_test.php new file mode 100644 index 0000000000..518a4e369f --- /dev/null +++ b/test/classes/PMA_Error_test.php @@ -0,0 +1,105 @@ +object = $this->getMockForAbstractClass('PMA_Error', array('2', 'Compile Error', 'error.txt', 15)); + } + + /** + * Tears down the fixture, for example, closes a network connection. + * This method is called after a test is executed. + * + * @access protected + * @return void + */ + protected function tearDown() + { + unset($this->object); + } + + /** + * Test for setBacktrace + */ + public function testSetBacktrace(){ + $this->object->setBacktrace(array('bt1','bt2')); + $this->assertEquals($this->object->getBacktrace(),array('bt1','bt2')); + } + + /** + * Test for setLine + */ + public function testSetLine(){ + $this->object->setLine(15); + $this->assertEquals($this->object->getLine(),15); + } + + /** + * Test for setFile + */ + public function testSetFile(){ + $this->object->setFile('/var/www/pma.txt'); + $this->assertEquals($this->object->getFile(),'./../../..'); + } + + /** + * Test for getHash + */ + public function testGetHash(){ + $this->assertEquals(1, preg_match('/^([a-z0-9]*)$/', $this->object->getHash())); + } + + /** + * Test for getBacktraceDisplay + */ + public function testGetBacktraceDisplay(){ + $this->assertTrue((strpos($this->object->getBacktraceDisplay(),'/usr/share/php/PHPUnit/Framework/TestCase.php#751: PHPUnit_Framework_TestResult->run(object)
') !== false)); + } + + /** + * Test for getDisplay + */ + public function testGetDisplay(){ + $this->assertTrue((strpos($this->object->getDisplay(),'
Warning') !== false)); + } + + /** + * Test for getHtmlTitle + */ + public function testGetHtmlTitle(){ + $this->assertEquals($this->object->getHtmlTitle(),'Warning: Compile Error'); + } + + /** + * Test for getTitle + */ + public function testGetTitle(){ + $this->assertEquals($this->object->getTitle(),'Warning: Compile Error'); + } +} diff --git a/test/classes/PMA_Message_test.php b/test/classes/PMA_Message_test.php index d95594e65a..19db79edfd 100644 --- a/test/classes/PMA_Message_test.php +++ b/test/classes/PMA_Message_test.php @@ -479,7 +479,7 @@ class PMA_Message_test extends PHPUnit_Framework_TestCase return array( array(1, '
1 row affected.
'), array(2, '
2 rows affected.
'), - array(50000000000000, '
50000000000000 rows affected.
'), + array(10000, '
10000 rows affected.
'), ); } @@ -505,7 +505,7 @@ class PMA_Message_test extends PHPUnit_Framework_TestCase return array( array(1, '
1 row inserted.
'), array(2, '
2 rows inserted.
'), - array(50000000000000, '
50000000000000 rows inserted.
'), + array(100000, '
100000 rows inserted.
'), ); } @@ -531,7 +531,7 @@ class PMA_Message_test extends PHPUnit_Framework_TestCase return array( array(1, '
1 row deleted.
'), array(2, '
2 rows deleted.
'), - array(50000000000000, '
50000000000000 rows deleted.
'), + array(500000, '
500000 rows deleted.
'), ); } diff --git a/test/libraries/core/PMA_getTableCount_test_dis.php b/test/libraries/core/PMA_getTableCount_test_dis.php index b638fb52b5..a66f506d7b 100644 --- a/test/libraries/core/PMA_getTableCount_test_dis.php +++ b/test/libraries/core/PMA_getTableCount_test_dis.php @@ -10,12 +10,23 @@ /* * Include to test. */ + +require_once 'libraries/vendor_config.php'; +require_once 'libraries/Theme.class.php'; require_once 'libraries/core.lib.php'; require_once 'libraries/CommonFunctions.class.php'; + +require_once 'libraries/js_escape.lib.php'; +require_once 'libraries/select_lang.lib.php'; +require_once 'libraries/sanitizing.lib.php'; require_once 'libraries/config.default.php'; require_once 'libraries/Config.class.php'; + +require_once 'libraries/url_generating.lib.php'; + +require_once 'libraries/Table.class.php'; require_once 'libraries/database_interface.lib.php'; -require_once 'libraries/vendor_config.php'; +require_once 'libraries/php-gettext/gettext.inc'; require_once 'config.sample.inc.php'; @@ -24,6 +35,20 @@ class PMA_getTableCount_test extends PHPUnit_Framework_TestCase public function setUp() { $GLOBALS['PMA_Config'] = new PMA_Config(); + $GLOBALS['PMA_Config']->enableBc(); +// $GLOBALS['cfg']['Server'] = array( +// 'host' => 'host', +// 'verbose' => 'verbose', +// 'extension' => 'mysql' +// ); + $GLOBALS['cfg']['OBGzip'] = false; + $_SESSION['PMA_Theme'] = new PMA_Theme(); + $_SESSION[' PMA_token '] = 'token'; + $GLOBALS['pmaThemeImage'] = 'theme/'; + $GLOBALS['pmaThemePath'] = $_SESSION['PMA_Theme']->getPath(); + $GLOBALS['server'] = 1; + $GLOBALS['db'] = ''; + $GLOBALS['table'] = ''; } function testTableCount() diff --git a/test/libraries/core/PMA_headerLocation_test_disabled.php b/test/libraries/core/PMA_headerLocation_test_disabled.php index 161adad8a0..4db5f5a5ea 100644 --- a/test/libraries/core/PMA_headerLocation_test_disabled.php +++ b/test/libraries/core/PMA_headerLocation_test_disabled.php @@ -10,9 +10,16 @@ * Include to test. */ require_once 'libraries/CommonFunctions.class.php'; -require_once 'libraries/url_generating.lib.php'; +require_once 'libraries/vendor_config.php'; require_once 'libraries/core.lib.php'; +require_once 'libraries/js_escape.lib.php'; require_once 'libraries/select_lang.lib.php'; +require_once 'libraries/sanitizing.lib.php'; +require_once 'libraries/Config.class.php'; +require_once 'libraries/url_generating.lib.php'; +require_once 'libraries/Theme.class.php'; +require_once 'libraries/Table.class.php'; +require_once 'libraries/php-gettext/gettext.inc'; /** * Test function sending headers.