%s" %s:') * @uses __('%s match(es) inside table %s') * @uses __('Browse') * @uses __('Delete') * @uses __('Total: %s match(es)') * @uses __('Search in database') * @uses __('Word(s) or value(s) to search for (wildcard: "%"):') * @uses __('Find:') * @uses __('Words are separated by a space character (" ").') * @uses __('Inside table(s):') * @uses __('Unselect All') * @uses __('Select All') * @uses PMA_DBI_get_tables() * @uses PMA_sqlAddslashes() * @uses PMA_getSearchSqls() * @uses PMA_DBI_fetch_value() * @uses PMA_linkOrButton() * @uses PMA_generate_common_url() * @uses PMA_generate_common_hidden_inputs() * @uses PMA_showMySQLDocu() * @uses $_REQUEST['search_str'] * @uses $_REQUEST['submit_search'] * @uses $_REQUEST['search_option'] * @uses $_REQUEST['table_select'] * @uses $_REQUEST['unselectall'] * @uses $_REQUEST['selectall'] * @uses $_REQUEST['field_str'] * @uses is_string() * @uses htmlspecialchars() * @uses array_key_exists() * @uses is_array() * @uses array_intersect() * @uses sprintf() * @uses in_array() * @version $Id$ * @package phpMyAdmin */ /** * */ require_once './libraries/common.inc.php'; $GLOBALS['js_include'][] = 'jquery/jquery-1.4.2.js'; $GLOBALS['js_include'][] = 'db_search.js'; /** * Gets some core libraries and send headers */ require './libraries/db_common.inc.php'; /** * init */ // If config variable $GLOBALS['cfg']['Usedbsearch'] is on false : exit. if (! $GLOBALS['cfg']['UseDbSearch']) { PMA_mysqlDie(__('Access denied'), '', false, $err_url); } // end if $url_query .= '&goto=db_search.php'; $url_params['goto'] = 'db_search.php'; /** * @global array list of tables from the current database * but do not clash with $tables coming from db_info.inc.php */ $tables_names_only = PMA_DBI_get_tables($GLOBALS['db']); $search_options = 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)) { $search_option = 1; unset($_REQUEST['submit_search']); } else { $search_option = (int) $_REQUEST['search_option']; $option_str = $search_options[$_REQUEST['search_option']]; } if (empty($_REQUEST['search_str']) || ! is_string($_REQUEST['search_str'])) { unset($_REQUEST['submit_search']); $searched = ''; } else { $searched = htmlspecialchars($_REQUEST['search_str']); // For "as regular expression" (search option 4), we should not treat // this as an expression that contains a LIKE (second parameter of // PMA_sqlAddslashes()). // // Usage example: If user is seaching for a literal $ in a regexp search, // he should enter \$ as the value. $search_str = PMA_sqlAddslashes($_REQUEST['search_str'], ($search_option == 4 ? false : true)); } $tables_selected = array(); if (empty($_REQUEST['table_select']) || ! is_array($_REQUEST['table_select'])) { unset($_REQUEST['submit_search']); } elseif (! isset($_REQUEST['selectall']) && ! isset($_REQUEST['unselectall'])) { $tables_selected = array_intersect($_REQUEST['table_select'], $tables_names_only); } if (isset($_REQUEST['selectall'])) { $tables_selected = $tables_names_only; } elseif (isset($_REQUEST['unselectall'])) { $tables_selected = array(); } if (empty($_REQUEST['field_str']) || ! is_string($_REQUEST['field_str'])) { unset($field_str); } else { $field_str = PMA_sqlAddslashes($_REQUEST['field_str'], true); } /** * Displays top links */ $sub_part = ''; if( $GLOBALS['is_ajax_request'] != true) { require './libraries/db_info.inc.php'; echo '
' . sprintf(__('%s match(es) inside table %s'), $res_cnt, htmlspecialchars($each_table)) . " | \n"; if ($res_cnt > 0) { $this_url_params['sql_query'] = $newsearchsqls['select_fields']; echo '' . PMA_linkOrButton( 'sql.php' . PMA_generate_common_url($this_url_params), __('Browse'), '') . " | \n"; $this_url_params['sql_query'] = $newsearchsqls['delete']; echo '' . PMA_linkOrButton( 'sql.php' . PMA_generate_common_url($this_url_params), __('Delete'), $newsearchsqls['delete']) . " | \n"; } else { echo '' . "\n" .' | ' . "\n"; }// end if else $odd_row = ! $odd_row; echo ' |
' . sprintf(__('Total: %s match(es)'), $num_search_result_total) . '
' . "\n"; } } // end 1. if($GLOBALS['is_ajax_request'] == true) { exit; } else { echo '