aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--phpBB/adm/style/acp_search.html6
-rw-r--r--phpBB/includes/acp/acp_search.php10
-rw-r--r--phpBB/includes/search/fulltext_mysql.php1
-rwxr-xr-xphpBB/includes/search/fulltext_native.php36
-rwxr-xr-xphpBB/includes/search/search.php57
-rw-r--r--phpBB/includes/ucp/ucp_main.php2
-rw-r--r--phpBB/install/schemas/firebird_schema.sql1
-rw-r--r--phpBB/install/schemas/mssql_schema.sql1
-rw-r--r--phpBB/install/schemas/mysql_schema.sql1
-rw-r--r--phpBB/install/schemas/oracle_schema.sql1
-rw-r--r--phpBB/install/schemas/postgres_schema.sql1
-rw-r--r--phpBB/install/schemas/schema_data.sql2
-rw-r--r--phpBB/install/schemas/sqlite_schema.sql1
-rw-r--r--phpBB/language/en/acp/search.php6
-rw-r--r--phpBB/language/en/search.php1
-rw-r--r--phpBB/language/en/search_ignore_words.php266
-rwxr-xr-xphpBB/language/en/search_ignore_words.txt251
-rw-r--r--phpBB/language/en/search_synonyms.php186
-rw-r--r--phpBB/language/en/search_synonyms.txt149
-rw-r--r--phpBB/memberlist.php2
-rw-r--r--phpBB/search.php44
21 files changed, 553 insertions, 472 deletions
diff --git a/phpBB/adm/style/acp_search.html b/phpBB/adm/style/acp_search.html
index a4f0a7b1f0..281ede19a8 100644
--- a/phpBB/adm/style/acp_search.html
+++ b/phpBB/adm/style/acp_search.html
@@ -20,6 +20,10 @@
<dd><input id="search_interval" type="text" size="4" maxlength="4" name="config[search_interval]" value="{SEARCH_INTERVAL}" /></dd>
</dl>
<dl>
+ <dt><label for="search_anonymous_interval">{L_SEARCH_GUEST_INTERVAL}:</label><br /><span>{L_SEARCH_GUEST_INTERVAL_EXPLAIN}</span></dt>
+ <dd><input id="search_anonymous_interval" type="text" size="4" maxlength="4" name="config[search_anonymous_interval]" value="{SEARCH_GUEST_INTERVAL}" /></dd>
+ </dl>
+ <dl>
<dt><label for="limit_search_load">{L_LIMIT_SEARCH_LOAD}:</label><br /><span>{L_LIMIT_SEARCH_LOAD_EXPLAIN}</span></dt>
<dd><input id="limit_search_load" type="text" size="4" maxlength="4" name="config[limit_search_load]" value="{LIMIT_SEARCH_LOAD}" /></dd>
</dl>
@@ -63,7 +67,7 @@
function popup_progress_bar(progress_type)
{
close_waitscreen = 0;
- window.open('{UA_PROGRESS_BAR}&type=' + progress_type, '_index', 'HEIGHT=300,resizable=yes,scrollbars=no,WIDTH=400');
+ window.open('{UA_PROGRESS_BAR}&type=' + progress_type, '_index', 'HEIGHT=240,resizable=yes,scrollbars=no,WIDTH=400');
}
//-->
</script>
diff --git a/phpBB/includes/acp/acp_search.php b/phpBB/includes/acp/acp_search.php
index f9726a7df8..c6bbbf18f7 100644
--- a/phpBB/includes/acp/acp_search.php
+++ b/phpBB/includes/acp/acp_search.php
@@ -47,11 +47,12 @@ class acp_search
$search_types = $this->get_search_types();
$settings = array(
- 'search_interval' => 'float',
- 'load_search' => 'bool',
- 'limit_search_load' => 'float',
+ 'search_interval' => 'float',
+ 'search_anonymous_interval' => 'float',
+ 'load_search' => 'bool',
+ 'limit_search_load' => 'float',
'min_search_author_chars' => 'integer',
- 'search_store_results' => 'integer',
+ 'search_store_results' => 'integer',
);
$search = null;
@@ -168,6 +169,7 @@ class acp_search
'LIMIT_SEARCH_LOAD' => (float) $config['limit_search_load'],
'MIN_SEARCH_AUTHOR_CHARS' => (int) $config['min_search_author_chars'],
'SEARCH_INTERVAL' => (float) $config['search_interval'],
+ 'SEARCH_GUEST_INTERVAL' => (float) $config['search_anonymous_interval'],
'SEARCH_STORE_RESULTS' => (int) $config['search_store_results'],
'S_SEARCH_TYPES' => $search_options,
diff --git a/phpBB/includes/search/fulltext_mysql.php b/phpBB/includes/search/fulltext_mysql.php
index 8b2abde4f5..bd619a9ffe 100644
--- a/phpBB/includes/search/fulltext_mysql.php
+++ b/phpBB/includes/search/fulltext_mysql.php
@@ -160,6 +160,7 @@ class fulltext_mysql extends search_backend
if (sizeof($this->split_words))
{
$this->split_words = array_values($this->split_words);
+ sort($this->split_words);
return true;
}
return false;
diff --git a/phpBB/includes/search/fulltext_native.php b/phpBB/includes/search/fulltext_native.php
index 2593136f10..34a832d6ef 100755
--- a/phpBB/includes/search/fulltext_native.php
+++ b/phpBB/includes/search/fulltext_native.php
@@ -88,14 +88,17 @@ class fulltext_native extends search_backend
$this->split_words = array_diff($this->split_words, $this->ignore_words);
}
- if (sizeof($this->replace_synonym))
+ if (sizeof($this->match_synonym))
{
- $this->split_words = str_replace($this->replace_synonym, $this->match_synonym, $this->split_words);
+ $this->split_words = str_replace($this->match_synonym, $this->replace_synonym, $this->split_words);
}
$prefixes = array('+', '-', '|');
$prefixed = false;
$in_words = '';
+
+ $lengths = $this->get_word_lengths($this->split_words);
+
foreach ($this->split_words as $i => $word)
{
if (in_array($word, $prefixes))
@@ -105,8 +108,7 @@ class fulltext_native extends search_backend
}
// check word length
- $clean_len = $this->word_length($word);
- if (($clean_len < $config['fulltext_native_min_chars']) || ($clean_len > $config['fulltext_native_max_chars']))
+ if (($lengths[$i] < $config['fulltext_native_min_chars']) || ($lengths[$i] > $config['fulltext_native_max_chars']))
{
if ($prefixed)
{
@@ -124,6 +126,8 @@ class fulltext_native extends search_backend
$prefixed = false;
}
+ unset($lengths);
+
if ($in_words)
{
// identify common words and ignore them
@@ -151,17 +155,23 @@ class fulltext_native extends search_backend
if (sizeof($this->split_words))
{
$this->split_words = array_values($this->split_words);
+ sort($this->split_words);
return true;
}
return false;
}
/**
- * Returns the string length but it counts multibyte characters as single characters and ignores "*"
+ * Returns any array of string lengths for the given array of strings
+ * It counts multibyte entities as single characters and ignores "*"
+ *
+ * @param array $words an array of strings
+ *
+ * @return Array of string lengths
*/
- function word_length($word)
+ function get_word_lengths($words)
{
- return strlen(str_replace('*', '', preg_replace('#&\#[0-9]+;#', 'x', $word)));
+ return array_map('strlen', str_replace('*', '', preg_replace('#&\#[0-9]+;#', 'x', $words)));
}
/**
@@ -210,17 +220,19 @@ class fulltext_native extends search_backend
$text = array_diff($text, $this->ignore_words);
}
- if (sizeof($this->replace_synonym))
+ if (sizeof($this->match_synonym))
{
- $text = str_replace($this->replace_synonym, $this->match_synonym, $text);
+ $text = str_replace($this->match_synonym, $this->replace_synonym, $text);
}
// remove too short or too long words
- $text = array_values($text);
+ $text = array_map('trim', array_values($text));
+
+ $lengths = $this->get_word_lengths($text);
+
for ($i = 0, $n = sizeof($text); $i < $n; $i++)
{
- $text[$i] = trim($text[$i]);
- if ($this->word_length($text[$i]) < $config['fulltext_native_min_chars'] || $this->word_length($text[$i]) > $config['fulltext_native_max_chars'])
+ if ($lengths[$i] < $config['fulltext_native_min_chars'] || $lengths[$i] > $config['fulltext_native_max_chars'])
{
unset($text[$i]);
}
diff --git a/phpBB/includes/search/search.php b/phpBB/includes/search/search.php
index 16d87947d2..28f805bca5 100755
--- a/phpBB/includes/search/search.php
+++ b/phpBB/includes/search/search.php
@@ -43,31 +43,21 @@ class search_backend
}
/**
- * Stores a list of common words that should be ignored in $this->ignore_words and caches them
+ * Retrieves a language dependend list of words that should be ignored by the search
*/
function get_ignore_words()
{
if (!sizeof($this->ignore_words))
{
- global $user, $cache;
+ global $user, $phpEx;
- $ignore_words = $cache->get('_ignore_words');
+ $words = array();
- if (!$ignore_words)
- {
- $ignore_words = array();
- }
-
- if (!isset($ignore_words[$user->lang_name]))
- {
- $ignore_words[$user->lang_name] = explode("\n", str_replace("\n\n", "\n", str_replace("\r", "\n", file_get_contents($user->lang_path . '/search_ignore_words.txt'))));
-
- $cache->put('_ignore_words', $ignore_words, 7200);
- }
-
- $this->ignore_words = $ignore_words[$user->lang_name];
+ // include the file containing ignore words
+ include("{$user->lang_path}/search_ignore_words.$phpEx");
- unset($ignore_words);
+ $this->ignore_words = $words;
+ unset($words);
}
}
@@ -78,28 +68,17 @@ class search_backend
{
if (!sizeof($this->match_synonym))
{
- global $user, $cache;
+ global $user, $phpEx;
- $match_synonym = $cache->get('_match_synonym');
+ $synonyms = array();
- if (!$match_synonym)
- {
- $match_synonym = array();
- }
+ // include the file containing synonyms
+ include("{$user->lang_path}/search_synonyms.$phpEx");
- if (!isset($match_synonym[$user->lang_name]))
- {
- preg_match_all('#^\s*(\S+)\s+(\S+)\s*$#m', file_get_contents($user->lang_path . '/search_synonyms.txt'), $match);
- $match_synonym[$user->lang_name]['replace']= &$match[1];
- $match_synonym[$user->lang_name]['match'] = &$match[2];
+ $this->match_synonym = array_keys($synonyms);
+ $this->replace_synonym = array_values($synonyms);
- $cache->put('_match_synonym', $match_synonym, 7200);
- }
-
- $this->replace_synonym = $match_synonym[$user->lang_name]['replace'];
- $this->match_synonym = $match_synonym[$user->lang_name]['match'];
-
- unset($match_synonym);
+ unset($synonyms);
}
}
@@ -173,7 +152,7 @@ class search_backend
*/
function save_ids($search_key, $keywords, $author_ary, $result_count, &$id_ary, $start, $sort_dir)
{
- global $cache, $config, $db;
+ global $cache, $config, $db, $user;
$length = min(sizeof($id_ary), $config['search_block_size']);
@@ -211,7 +190,11 @@ class search_backend
}
$db->sql_freeresult($result);
}
- set_config('last_search_time', time());
+ //set_config('last_search_time', time());
+ $sql = 'UPDATE ' . USERS_TABLE . '
+ SET user_last_search = ' . time() . '
+ WHERE user_id = ' . $user->data['user_id'];
+ $db->sql_query($sql);
$store = array(-1 => $result_count, -2 => $sort_dir);
$id_range = range($start, $start + $length - 1);
diff --git a/phpBB/includes/ucp/ucp_main.php b/phpBB/includes/ucp/ucp_main.php
index 7421cdd53f..336c050fad 100644
--- a/phpBB/includes/ucp/ucp_main.php
+++ b/phpBB/includes/ucp/ucp_main.php
@@ -173,7 +173,7 @@ class ucp_main
// 'S_GROUP_OPTIONS' => $group_options,
'S_SHOW_ACTIVITY' => ($config['load_user_activity']) ? true : false,
- 'U_SEARCH_USER' => ($auth->acl_get('u_search')) ? "{$phpbb_root_path}search.$phpEx$SID&amp;author=" . urlencode($user->data['username']) . "&amp;sr=posts" : '',
+ 'U_SEARCH_USER' => ($auth->acl_get('u_search')) ? "{$phpbb_root_path}search.$phpEx$SID&amp;author_id=" . $user->data['user_id'] . "&amp;sr=posts" : '',
)
);
break;
diff --git a/phpBB/install/schemas/firebird_schema.sql b/phpBB/install/schemas/firebird_schema.sql
index d4b58a4e7c..93c0340fc7 100644
--- a/phpBB/install/schemas/firebird_schema.sql
+++ b/phpBB/install/schemas/firebird_schema.sql
@@ -1331,6 +1331,7 @@ CREATE TABLE phpbb_users (
user_lastpost_time INTEGER DEFAULT 0 NOT NULL,
user_lastpage VARCHAR(200) DEFAULT '' NOT NULL,
user_last_confirm_key VARCHAR(10) DEFAULT '',
+ user_last_search INTEGER DEFAULT 0 NOT NULL,
user_warnings INTEGER DEFAULT 0,
user_last_warning INTEGER DEFAULT 0,
user_login_attempts INTEGER DEFAULT 0,
diff --git a/phpBB/install/schemas/mssql_schema.sql b/phpBB/install/schemas/mssql_schema.sql
index 5c15794f9e..2756815c97 100644
--- a/phpBB/install/schemas/mssql_schema.sql
+++ b/phpBB/install/schemas/mssql_schema.sql
@@ -2128,6 +2128,7 @@ CREATE TABLE [phpbb_users] (
[user_lastpost_time] [int] NOT NULL ,
[user_lastpage] [varchar] (200) NOT NULL ,
[user_last_confirm_key] [varchar] (10) NULL ,
+ [user_last_search] [int] NOT NULL ,
[user_warnings] [int] NULL ,
[user_last_warning] [int] NULL ,
[user_login_attempts] [int] NULL ,
diff --git a/phpBB/install/schemas/mysql_schema.sql b/phpBB/install/schemas/mysql_schema.sql
index b234f48b96..bd00968c39 100644
--- a/phpBB/install/schemas/mysql_schema.sql
+++ b/phpBB/install/schemas/mysql_schema.sql
@@ -887,6 +887,7 @@ CREATE TABLE phpbb_users (
user_lastmark int(11) DEFAULT '0' NOT NULL,
user_lastpost_time int(11) DEFAULT '0' NOT NULL,
user_lastpage varchar(200) DEFAULT '' NOT NULL,
+ user_last_search int(11) DEFAULT '0' NOT NULL,
user_last_confirm_key varchar(10) DEFAULT '' NULL,
user_warnings tinyint(4) DEFAULT '0' NULL,
user_last_warning int(11) DEFAULT '0' NULL,
diff --git a/phpBB/install/schemas/oracle_schema.sql b/phpBB/install/schemas/oracle_schema.sql
index 16a22bef59..b58407fd82 100644
--- a/phpBB/install/schemas/oracle_schema.sql
+++ b/phpBB/install/schemas/oracle_schema.sql
@@ -1729,6 +1729,7 @@ CREATE TABLE phpbb_users (
user_lastpost_time number(11) DEFAULT '0' NOT NULL,
user_lastpage varchar2(200) DEFAULT '' NOT NULL,
user_last_confirm_key varchar2(10) DEFAULT '' NULL,
+ user_last_search number(11) DEFAULT '0' NOT NULL,
user_warnings number(4) DEFAULT '0' NULL,
user_last_warning number(11) DEFAULT '0' NULL,
user_login_attempts number(4) DEFAULT '0' NULL,
diff --git a/phpBB/install/schemas/postgres_schema.sql b/phpBB/install/schemas/postgres_schema.sql
index 0d9f1d9e78..9b3b3f20b5 100644
--- a/phpBB/install/schemas/postgres_schema.sql
+++ b/phpBB/install/schemas/postgres_schema.sql
@@ -1305,6 +1305,7 @@ CREATE TABLE phpbb_users (
user_lastpost_time INT4 DEFAULT '0' NOT NULL,
user_lastpage varchar(200) DEFAULT '' NOT NULL,
user_last_confirm_key varchar(10) DEFAULT '' NULL,
+ user_last_search INT4 DEFAULT '0' NOT NULL,
user_warnings INT2 DEFAULT '0' NULL,
user_last_warning INT4 DEFAULT '0' NULL,
user_login_attempts INT2 DEFAULT '0' NULL,
diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql
index d9ded29751..cf50db3f13 100644
--- a/phpBB/install/schemas/schema_data.sql
+++ b/phpBB/install/schemas/schema_data.sql
@@ -181,6 +181,7 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('search_block_size'
INSERT INTO phpbb_config (config_name, config_value) VALUES ('search_gc', '7200');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('search_indexing_state', '');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('search_interval', '0');
+INSERT INTO phpbb_config (config_name, config_value) VALUES ('search_anonymous_interval', '0');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('search_type', 'fulltext_native');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('search_store_results', '1800');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('secure_allow_deny', '1');
@@ -211,7 +212,6 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('warnings_gc', '144
INSERT INTO phpbb_config (config_name, config_value, is_dynamic) VALUES ('cache_last_gc', '0', 1);
INSERT INTO phpbb_config (config_name, config_value, is_dynamic) VALUES ('database_last_gc', '0', 1);
INSERT INTO phpbb_config (config_name, config_value, is_dynamic) VALUES ('last_queue_run', '0', 1);
-INSERT INTO phpbb_config (config_name, config_value, is_dynamic) VALUES ('last_search_time', '0', 1);
INSERT INTO phpbb_config (config_name, config_value, is_dynamic) VALUES ('newest_user_id', '2', 1);
INSERT INTO phpbb_config (config_name, config_value, is_dynamic) VALUES ('newest_username', '', 1);
INSERT INTO phpbb_config (config_name, config_value, is_dynamic) VALUES ('num_files', '0', 1);
diff --git a/phpBB/install/schemas/sqlite_schema.sql b/phpBB/install/schemas/sqlite_schema.sql
index bc0f72df0a..3bf6ac0c36 100644
--- a/phpBB/install/schemas/sqlite_schema.sql
+++ b/phpBB/install/schemas/sqlite_schema.sql
@@ -950,6 +950,7 @@ CREATE TABLE phpbb_users (
user_lastpost_time int(11) NOT NULL DEFAULT '0',
user_lastpage varchar(200) NOT NULL DEFAULT '',
user_last_confirm_key varchar(10) NULL DEFAULT '',
+ user_last_search int(11) NOT NULL DEFAULT '0',
user_warnings tinyint(4) NULL DEFAULT '0',
user_last_warning int(11) NULL DEFAULT '0',
user_login_attempts smallint(4) NULL DEFAULT '0',
diff --git a/phpBB/language/en/acp/search.php b/phpBB/language/en/acp/search.php
index 480e56e1ec..cfb3f19504 100644
--- a/phpBB/language/en/acp/search.php
+++ b/phpBB/language/en/acp/search.php
@@ -68,10 +68,12 @@ $lang = array_merge($lang, array(
'PROGRESS_BAR' => 'Progress bar',
+ 'SEARCH_GUEST_INTERVAL' => 'Guest search flood interval',
+ 'SEARCH_GUEST_INTERVAL_EXPLAIN' => 'Number of seconds guests must wait between searches. If one guest searches all others have to wait until the time interval passed.',
'SEARCH_INDEX_CREATED' => 'Successfully indexed all posts in the board database',
'SEARCH_INDEX_REMOVED' => 'Successfully deleted the search index for this backend',
- 'SEARCH_INTERVAL' => 'Search Flood Interval',
- 'SEARCH_INTERVAL_EXPLAIN' => 'Number of seconds users must wait between searches.',
+ 'SEARCH_INTERVAL' => 'User search flood interval',
+ 'SEARCH_INTERVAL_EXPLAIN' => 'Number of seconds users must wait between searches. This interval is checked independendly for each user.',
'SEARCH_STORE_RESULTS' => 'Search result cache length',
'SEARCH_STORE_RESULTS_EXPLAIN' => 'Cached search results will expire after this time, in seconds. Set to 0 if you want to disable search cache.',
'SEARCH_TYPE' => 'Search Backend',
diff --git a/phpBB/language/en/search.php b/phpBB/language/en/search.php
index 3a80fb5c01..a1d7b77d29 100644
--- a/phpBB/language/en/search.php
+++ b/phpBB/language/en/search.php
@@ -41,6 +41,7 @@ $lang = array_merge($lang, array(
'GLOBAL' => 'Global topic',
'IGNORED_TERMS' => 'ignored',
+ 'IGNORED_TERMS_EXPLAIN' => 'The following words in your search query were ignored: <b>%s</b>',
'NO_KEYWORDS' => 'You must specify at least one word to search for. Each word must consist of at least %d characters and must not contain more than %d characters excluding wildcards.',
'NO_RECENT_SEARCHES' => 'No searches have been carried out recently',
diff --git a/phpBB/language/en/search_ignore_words.php b/phpBB/language/en/search_ignore_words.php
new file mode 100644
index 0000000000..0ef17669fa
--- /dev/null
+++ b/phpBB/language/en/search_ignore_words.php
@@ -0,0 +1,266 @@
+<?php
+/**
+*
+* search_ignore_words [English]
+*
+* @package language
+* @version $Id$
+* @copyright (c) 2005 phpBB Group
+* @license http://opensource.org/licenses/gpl-license.php GNU Public License
+*
+*/
+
+$words = array(
+ 'a',
+ 'about',
+ 'after',
+ 'ago',
+ 'all',
+ 'almost',
+ 'along',
+ 'alot',
+ 'also',
+ 'am',
+ 'an',
+ 'and',
+ 'answer',
+ 'any',
+ 'anybody',
+ 'anybodys',
+ 'anywhere',
+ 'are',
+ 'arent',
+ 'around',
+ 'as',
+ 'ask',
+ 'askd',
+ 'at',
+ 'bad',
+ 'be',
+ 'because',
+ 'been',
+ 'before',
+ 'being',
+ 'best',
+ 'better',
+ 'between',
+ 'big',
+ 'btw',
+ 'but',
+ 'by',
+ 'can',
+ 'cant',
+ 'come',
+ 'could',
+ 'couldnt',
+ 'day',
+ 'days',
+ 'days',
+ 'did',
+ 'didnt',
+ 'do',
+ 'does',
+ 'doesnt',
+ 'dont',
+ 'down',
+ 'each',
+ 'etc',
+ 'either',
+ 'else',
+ 'even',
+ 'ever',
+ 'every',
+ 'everybody',
+ 'everybodys',
+ 'everyone',
+ 'far',
+ 'find',
+ 'for',
+ 'found',
+ 'from',
+ 'get',
+ 'go',
+ 'going',
+ 'gone',
+ 'good',
+ 'got',
+ 'gotten',
+ 'had',
+ 'has',
+ 'have',
+ 'havent',
+ 'having',
+ 'her',
+ 'here',
+ 'hers',
+ 'him',
+ 'his',
+ 'home',
+ 'how',
+ 'hows',
+ 'href',
+ 'I',
+ 'Ive',
+ 'if',
+ 'in',
+ 'ini',
+ 'into',
+ 'is',
+ 'isnt',
+ 'it',
+ 'its',
+ 'its',
+ 'just',
+ 'know',
+ 'large',
+ 'less',
+ 'like',
+ 'liked',
+ 'little',
+ 'looking',
+ 'look',
+ 'looked',
+ 'looking',
+ 'lot',
+ 'maybe',
+ 'many',
+ 'me',
+ 'more',
+ 'most',
+ 'much',
+ 'must',
+ 'mustnt',
+ 'my',
+ 'near',
+ 'need',
+ 'never',
+ 'new',
+ 'news',
+ 'no',
+ 'none',
+ 'not',
+ 'nothing',
+ 'now',
+ 'of',
+ 'off',
+ 'often',
+ 'old',
+ 'on',
+ 'once',
+ 'only',
+ 'oops',
+ 'or',
+ 'other',
+ 'our',
+ 'ours',
+ 'out',
+ 'over',
+ 'page',
+ 'please',
+ 'put',
+ 'question',
+ 'questions',
+ 'questioned',
+ 'quote',
+ 'rather',
+ 'really',
+ 'recent',
+ 'said',
+ 'saw',
+ 'say',
+ 'says',
+ 'she',
+ 'see',
+ 'sees',
+ 'should',
+ 'sites',
+ 'small',
+ 'so',
+ 'some',
+ 'something',
+ 'sometime',
+ 'somewhere',
+ 'soon',
+ 'take',
+ 'than',
+ 'true',
+ 'thank',
+ 'that',
+ 'thatd',
+ 'thats',
+ 'the',
+ 'their',
+ 'theirs',
+ 'theres',
+ 'theirs',
+ 'them',
+ 'then',
+ 'there',
+ 'these',
+ 'they',
+ 'theyll',
+ 'theyd',
+ 'theyre',
+ 'this',
+ 'those',
+ 'though',
+ 'through',
+ 'thus',
+ 'time',
+ 'times',
+ 'to',
+ 'too',
+ 'under',
+ 'until',
+ 'untrue',
+ 'up',
+ 'upon',
+ 'use',
+ 'users',
+ 'version',
+ 'very',
+ 'via',
+ 'want',
+ 'was',
+ 'way',
+ 'we',
+ 'well',
+ 'went',
+ 'were',
+ 'werent',
+ 'what',
+ 'when',
+ 'where',
+ 'which',
+ 'who',
+ 'whom',
+ 'whose',
+ 'why',
+ 'wide',
+ 'will',
+ 'with',
+ 'within',
+ 'without',
+ 'wont',
+ 'world',
+ 'worse',
+ 'worst',
+ 'would',
+ 'wrote',
+ 'www',
+ 'yes',
+ 'yet',
+ 'you',
+ 'youd',
+ 'youll',
+ 'your',
+ 'youre',
+ 'yours',
+ 'AFAIK',
+ 'IIRC',
+ 'LOL',
+ 'ROTF',
+ 'ROTFLMAO',
+ 'YMMV',
+);
+ \ No newline at end of file
diff --git a/phpBB/language/en/search_ignore_words.txt b/phpBB/language/en/search_ignore_words.txt
deleted file mode 100755
index 131cf67622..0000000000
--- a/phpBB/language/en/search_ignore_words.txt
+++ /dev/null
@@ -1,251 +0,0 @@
-a
-about
-after
-ago
-all
-almost
-along
-alot
-also
-am
-an
-and
-answer
-any
-anybody
-anybodys
-anywhere
-are
-arent
-around
-as
-ask
-askd
-at
-bad
-be
-because
-been
-before
-being
-best
-better
-between
-big
-btw
-but
-by
-can
-cant
-come
-could
-couldnt
-day
-days
-days
-did
-didnt
-do
-does
-doesnt
-dont
-down
-each
-etc
-either
-else
-even
-ever
-every
-everybody
-everybodys
-everyone
-far
-find
-for
-found
-from
-get
-go
-going
-gone
-good
-got
-gotten
-had
-has
-have
-havent
-having
-her
-here
-hers
-him
-his
-home
-how
-hows
-href
-I
-Ive
-if
-in
-ini
-into
-is
-isnt
-it
-its
-its
-just
-know
-large
-less
-like
-liked
-little
-looking
-look
-looked
-looking
-lot
-maybe
-many
-me
-more
-most
-much
-must
-mustnt
-my
-near
-need
-never
-new
-news
-no
-none
-not
-nothing
-now
-of
-off
-often
-old
-on
-once
-only
-oops
-or
-other
-our
-ours
-out
-over
-page
-please
-put
-question
-questions
-questioned
-quote
-rather
-really
-recent
-said
-saw
-say
-says
-she
-see
-sees
-should
-sites
-small
-so
-some
-something
-sometime
-somewhere
-soon
-take
-than
-true
-thank
-that
-thatd
-thats
-the
-their
-theirs
-theres
-theirs
-them
-then
-there
-these
-they
-theyll
-theyd
-theyre
-this
-those
-though
-through
-thus
-time
-times
-to
-too
-under
-until
-untrue
-up
-upon
-use
-users
-version
-very
-via
-want
-was
-way
-we
-well
-went
-were
-werent
-what
-when
-where
-which
-who
-whom
-whose
-why
-wide
-will
-with
-within
-without
-wont
-world
-worse
-worst
-would
-wrote
-www
-yes
-yet
-you
-youd
-youll
-your
-youre
-yours
-AFAIK
-IIRC
-LOL
-ROTF
-ROTFLMAO
-YMMV \ No newline at end of file
diff --git a/phpBB/language/en/search_synonyms.php b/phpBB/language/en/search_synonyms.php
new file mode 100644
index 0000000000..18f0ba40f8
--- /dev/null
+++ b/phpBB/language/en/search_synonyms.php
@@ -0,0 +1,186 @@
+<?php
+/**
+*
+* search_synonyms [English]
+*
+* @package language
+* @version $Id$
+* @copyright (c) 2005 phpBB Group
+* @license http://opensource.org/licenses/gpl-license.php GNU Public License
+*
+*/
+
+$synonyms = array(
+ 'abcense' => 'absence',
+ 'abridgement' => 'abridgment',
+ 'accomodate' => 'accommodate',
+ 'acknowledgment' => 'acknowledgement',
+ 'airplane' => 'aeroplane',
+ 'allright' => 'alright ',
+ 'andy' => 'andrew',
+ 'anemia' => 'anaemia',
+ 'anemic' => 'anaemic',
+ 'anesthesia' => 'anaesthesia',
+ 'appologize' => 'appologise',
+ 'archean' => 'archaean',
+ 'archeology' => 'archaeology',
+ 'archeozoic' => 'archaeozoic',
+ 'armor' => 'armour',
+ 'artic' => 'arctic',
+ 'attachment' => 'attachement',
+ 'attendence' => 'attendance',
+
+ 'barbecue' => 'barbeque',
+ 'behavior' => 'behaviour',
+ 'biassed' => 'biased',
+ 'biol' => 'biology',
+ 'buletin' => 'bulletin',
+
+ 'calender' => 'calendar',
+ 'canceled' => 'cancelled',
+ 'car' => 'automobile',
+ 'catalog' => 'catalogue',
+ 'cenozoic' => 'caenozoic',
+ 'center' => 'centre',
+ 'check' => 'cheque',
+ 'color' => 'colour',
+ 'comission' => 'commission',
+ 'comittee' => 'committee',
+ 'commitee' => 'committee',
+ 'conceed' => 'concede',
+ 'creating' => 'createing',
+ 'curiculum' => 'curriculum',
+
+ 'defense' => 'defence',
+ 'develope' => 'develop',
+ 'discription' => 'description',
+ 'dulness' => 'dullness',
+
+ 'encyclopedia' => 'encyclopaedia',
+ 'enroll' => 'enrol',
+ 'esthetic' => 'aesthetic',
+ 'etiology' => 'aetiology',
+ 'exhorbitant' => 'exorbitant',
+ 'exhuberant' => 'exuberant',
+ 'existance' => 'existence',
+
+ 'favorite' => 'favourite',
+ 'fetus' => 'foetus',
+ 'ficticious' => 'fictitious',
+ 'flavor' => 'flavour',
+ 'flourescent' => 'fluorescent',
+ 'foriegn' => 'foreign',
+ 'fourty' => 'forty',
+
+ 'gage' => 'guage',
+ 'geneology' => 'genealogy',
+ 'grammer' => 'grammar',
+ 'gray' => 'grey',
+ 'guerilla' => 'guerrilla',
+ 'gynecology' => 'gynaecology',
+
+ 'harbor' => 'harbour',
+ 'heighth' => 'height',
+ 'hemaglobin' => 'haemaglobin',
+ 'hematin' => 'haematin',
+ 'hematite' => 'haematite',
+ 'hematology' => 'haematology',
+ 'honor' => 'honour',
+
+ 'innoculate' => 'inoculate',
+ 'installment' => 'instalment',
+ 'irrelevent' => 'irrelevant',
+ 'irrevelant' => 'irrelevant',
+
+ 'jeweler' => 'jeweller',
+ 'judgement' => 'judgment',
+
+ 'labeled' => 'labelled',
+ 'labor' => 'labour',
+ 'laborer' => 'labourer',
+ 'laborers' => 'labourers',
+ 'laboring' => 'labouring',
+ 'licence' => 'license',
+ 'liesure' => 'leisure',
+ 'liquify' => 'liquefy',
+
+ 'maintainance' => 'maintenance',
+ 'maintenence' => 'maintenance',
+ 'medieval' => 'mediaeval',
+ 'meter' => 'metre',
+ 'milage' => 'mileage',
+ 'millipede' => 'millepede',
+ 'miscelaneous' => 'miscellaneous',
+ 'morgage' => 'mortgage',
+
+ 'noticable' => 'noticeable',
+
+ 'occurence' => 'occurrence',
+ 'offense' => 'offence',
+ 'ommision' => 'omission',
+ 'ommission' => 'omission',
+ 'optimize' => 'optimize',
+ 'organise' => 'organize',
+
+ 'pajamas' => 'pyjamas',
+ 'paleography' => 'palaeography',
+ 'paleolithic' => 'palaeolithic',
+ 'paleontological' => 'palaeontological',
+ 'paleontologist' => 'palaeontologist',
+ 'paleontology' => 'palaeontology',
+ 'paleozoic' => 'palaeozoic',
+ 'pamplet' => 'pamphlet',
+ 'paralell' => 'parallel',
+ 'parl' => 'parliament',
+ 'parlt' => 'parliament',
+ 'pediatric' => 'paediatric',
+ 'pediatrician' => 'paediatrician',
+ 'pediatrics' => 'paediatrics',
+ 'pedodontia' => 'paedodontia',
+ 'pedodontics' => 'paedodontics',
+ 'personel' => 'personnel',
+ 'practise' => 'practice',
+ 'program' => 'programme',
+ 'psych' => 'psychology',
+
+ 'questionaire' => 'questionnaire',
+
+ 'rarify' => 'rarefy',
+ 'reccomend' => 'recommend',
+ 'recieve' => 'receive',
+ 'resistence' => 'resistance',
+ 'restaraunt' => 'restaurant',
+
+ 'savior' => 'saviour',
+ 'sep' => 'september',
+ 'seperate' => 'separate',
+ 'sept' => 'september',
+ 'sieze' => 'seize',
+ 'summarize' => 'summarise',
+ 'summerize' => 'summarise',
+ 'superceed' => 'supercede',
+ 'superintendant' => 'superintendent',
+ 'supersede' => 'supercede',
+ 'suprise' => 'surprise',
+ 'surprize' => 'surprise',
+ 'synchronise' => 'synchronize',
+
+ 'temperary' => 'temporary',
+ 'theater' => 'theatre',
+ 'threshhold' => 'threshold',
+ 'transfered' => 'transferred',
+ 'truely' => 'truly',
+ 'truley' => 'truly',
+
+ 'useable' => 'usable',
+
+ 'valor' => 'valour',
+ 'vigor' => 'vigour',
+ 'vol' => 'volume',
+
+ 'whack' => 'wack',
+ 'withold' => 'withhold',
+
+ 'yeild' => 'yield',
+);
+?> \ No newline at end of file
diff --git a/phpBB/language/en/search_synonyms.txt b/phpBB/language/en/search_synonyms.txt
deleted file mode 100644
index 0359039e0e..0000000000
--- a/phpBB/language/en/search_synonyms.txt
+++ /dev/null
@@ -1,149 +0,0 @@
-abcense absence
-abridgement abridgment
-accomodate accommodate
-acknowledgment acknowledgement
-airplane aeroplane
-allright alright
-andy andrew
-anemia anaemia
-anemic anaemic
-anesthesia anaesthesia
-appologize appologise
-archean archaean
-archeology archaeology
-archeozoic archaeozoic
-armor armour
-artic arctic
-attachment attachement
-attendence attendance
-barbecue barbeque
-behavior behaviour
-biassed biased
-biol biology
-buletin bulletin
-calender calendar
-canceled cancelled
-car automobile
-catalog catalogue
-cenozoic caenozoic
-center centre
-check cheque
-color colour
-comission commission
-comittee committee
-commitee committee
-conceed concede
-creating createing
-curiculum curriculum
-defense defence
-develope develop
-discription description
-dulness dullness
-encyclopedia encyclopaedia
-enroll enrol
-esthetic aesthetic
-etiology aetiology
-exhorbitant exorbitant
-exhuberant exuberant
-existance existence
-favorite favourite
-fetus foetus
-ficticious fictitious
-flavor flavour
-flourescent fluorescent
-foriegn foreign
-fourty forty
-gage guage
-geneology genealogy
-grammer grammar
-gray grey
-guerilla guerrilla
-gynecology gynaecology
-harbor harbour
-heighth height
-hemaglobin haemaglobin
-hematin haematin
-hematite haematite
-hematology haematology
-honor honour
-innoculate inoculate
-installment instalment
-irrelevent irrelevant
-irrevelant irrelevant
-jeweler jeweller
-judgement judgment
-labeled labelled
-labor labour
-laborer labourer
-laborers labourers
-laboring labouring
-licence license
-liesure leisure
-liquify liquefy
-maintainance maintenance
-maintenence maintenance
-medieval mediaeval
-meter metre
-milage mileage
-millipede millepede
-miscelaneous miscellaneous
-morgage mortgage
-noticable noticeable
-occurence occurrence
-offense offence
-ommision omission
-ommission omission
-optimize optimize
-organise organize
-pajamas pyjamas
-paleography palaeography
-paleolithic palaeolithic
-paleontological palaeontological
-paleontologist palaeontologist
-paleontology palaeontology
-paleozoic palaeozoic
-pamplet pamphlet
-paralell parallel
-parl parliament
-parlt parliament
-pediatric paediatric
-pediatrician paediatrician
-pediatrics paediatrics
-pedodontia paedodontia
-pedodontics paedodontics
-personel personnel
-practise practice
-program programme
-psych psychology
-questionaire questionnaire
-rarify rarefy
-reccomend recommend
-recieve receive
-resistence resistance
-restaraunt restaurant
-savior saviour
-sep september
-seperate separate
-sept september
-sieze seize
-summarize summarise
-summerize summarise
-superceed supercede
-superintendant superintendent
-supersede supercede
-suprise surprise
-surprize surprise
-synchronise synchronize
-temperary temporary
-theater theatre
-threshhold threshold
-transfered transferred
-truely truly
-truley truly
-useable usable
-valor valour
-vigor vigour
-vol volume
-whack wack
-withold withhold
-yeild yield
diff --git a/phpBB/memberlist.php b/phpBB/memberlist.php
index 17560b2517..2d94958238 100644
--- a/phpBB/memberlist.php
+++ b/phpBB/memberlist.php
@@ -1224,7 +1224,7 @@ function show_profile($data)
'S_JABBER_ENABLED' => ($config['jab_enable']) ? true : false,
'U_PROFILE' => "{$phpbb_root_path}memberlist.$phpEx$SID&amp;mode=viewprofile&amp;u=$user_id",
- 'U_SEARCH_USER' => ($auth->acl_get('u_search')) ? "{$phpbb_root_path}search.$phpEx$SID&amp;author=" . urlencode($username) . "&amp;sr=posts" : '',
+ 'U_SEARCH_USER' => ($auth->acl_get('u_search')) ? "{$phpbb_root_path}search.$phpEx$SID&amp;author_id=$user_id&amp;sr=posts" : '',
'U_NOTES' => $auth->acl_gets('m_', 'a_') ? "{$phpbb_root_path}mcp.$phpEx$SID&amp;i=notes&amp;mode=user_notes&amp;u=$user_id" : '',
'U_WARN' => $auth->acl_gets('m_', 'a_') ? "{$phpbb_root_path}mcp.$phpEx$SID&amp;i=warn&amp;mode=warn_user&amp;u=$user_id" : '',
'U_PM' => ($auth->acl_get('u_sendpm')) ? "{$phpbb_root_path}ucp.$phpEx$SID&amp;i=pm&amp;mode=compose&amp;u=$user_id" : '',
diff --git a/phpBB/search.php b/phpBB/search.php
index 3475f33bb6..5e5c9573c0 100644
--- a/phpBB/search.php
+++ b/phpBB/search.php
@@ -33,6 +33,7 @@ $submit = request_var('submit', false);
$keywords = request_var('keywords', '', true);
$add_keywords = request_var('add_keywords', '', true);
$author = request_var('author', '');
+$author_id = request_var('author_id', 0);
$show_results = ($topic_id) ? 'posts' : request_var('sr', 'posts');
$show_results = ($show_results == 'posts') ? 'posts' : 'topics';
$search_terms = request_var('terms', 'all');
@@ -63,10 +64,11 @@ if ($user->load && $config['limit_search_load'] && ($user->load > doubleval($con
trigger_error($user->lang['NO_SEARCH_TIME']);
}
-// Check last search time ... if applicable
-if ($config['search_interval'])
+// Check flood limit ... if applicable
+$interval = ($user->data['user_id'] == ANONYMOUS) ? $config['search_anonymous_interval'] : $config['search_interval'];
+if ($interval && !$auth->acl_get('u_ignoreflood'))
{
- if ($config['last_search_time'] > time() - $config['search_interval'])
+ if ($user->data['user_last_search'] > time() - $interval)
{
trigger_error($user->lang['NO_SEARCH_TIME']);
}
@@ -79,7 +81,7 @@ $sort_by_text = array('a' => $user->lang['SORT_AUTHOR'], 't' => $user->lang['SOR
$s_limit_days = $s_sort_key = $s_sort_dir = $u_sort_param = '';
gen_sort_selects($limit_days, $sort_by_text, $sort_days, $sort_key, $sort_dir, $s_limit_days, $s_sort_key, $s_sort_dir, $u_sort_param);
-if ($keywords || $author || $search_id || $submit)
+if ($keywords || $author || $author_id || $search_id || $submit)
{
// clear arrays
$id_ary = array();
@@ -91,7 +93,7 @@ if ($keywords || $author || $search_id || $submit)
$sql = 'SELECT f.forum_id, f.forum_name, f.parent_id, f.forum_type, f.right_id, f.forum_password, fa.user_id
FROM ' . FORUMS_TABLE . ' f
LEFT JOIN ' . FORUMS_ACCESS_TABLE . " fa ON (fa.forum_id = f.forum_id
- AND fa.session_id = '" . $db->sql_escape($user->data['session_id']) . "')
+ AND fa.session_id = '" . $db->sql_escape($user->session_id) . "')
WHERE $not_in_fid(f.forum_password <> '' AND fa.user_id <> " . (int) $user->data['user_id'] . ')
ORDER BY f.left_id';
$result = $db->sql_query($sql);
@@ -159,14 +161,18 @@ if ($keywords || $author || $search_id || $submit)
// If we are looking for authors get their ids
$author_id_ary = array();
- if ($author)
+ if ($author_id)
{
- if ((strstr($author, '*') !== false) && (str_replace(array('*', '%'), '', $author) < $config['min_search_author_chars']))
+ $author_id_ary[] = $author_id;
+ }
+ elseif ($author)
+ {
+ if ((strpos($author, '*') !== false) && (str_replace(array('*', '%'), '', $author) < $config['min_search_author_chars']))
{
trigger_error(sprintf($user->lang['TOO_FEW_AUTHOR_CHARS'], $config['min_search_author_chars']));
}
- $sql_where = (strstr($author, '*') !== false) ? ' LIKE ' : ' = ';
+ $sql_where = (strpos($author, '*') !== false) ? ' LIKE ' : ' = ';
$sql = 'SELECT user_id
FROM ' . USERS_TABLE . "
WHERE username $sql_where '" . $db->sql_escape(preg_replace('#\*+#', '%', $author)) . "'
@@ -226,19 +232,19 @@ if ($keywords || $author || $search_id || $submit)
$search->split_keywords($keywords, $search_terms);
if (!sizeof($search->split_words) && !sizeof($author_id_ary) && !$search_id)
{
- trigger_error(sprintf($user->lang['NO_KEYWORDS'], $search->word_length['min'], $search->word_length['max']));
+ $ignored = (sizeof($search->common_words)) ? sprintf($user->lang['IGNORED_TERMS_EXPLAIN'], htmlspecialchars(implode(' ', $search->common_words))) . '<br />' : '';
+ trigger_error($ignored . sprintf($user->lang['NO_KEYWORDS'], $search->word_length['min'], $search->word_length['max']));
}
}
if (!$keywords && sizeof($author_id_ary))
{
- // default to showing results as posts when performing an author search
+ // if it is an author search we want to show topics by default
$show_results = ($topic_id) ? 'posts' : request_var('sr', ($search_id == 'egosearch') ? 'topics' : 'posts');
$show_results = ($show_results == 'posts') ? 'posts' : 'topics';
}
// define some variables needed for retrieving post_id/topic_id information
- $per_page = ($show_results == 'posts') ? $config['posts_per_page'] : $config['topics_per_page'];
$sort_by_sql = array('a' => 'u.username', 't' => (($show_results == 'posts') ? 'p.post_time' : 't.topic_last_post_time'), 'f' => 'f.forum_id', 'i' => 't.topic_title', 's' => (($show_results == 'posts') ? 'p.post_subject' : 't.topic_title'));
// pre-made searches
@@ -356,7 +362,13 @@ if ($keywords || $author || $search_id || $submit)
}
break;
}
+ }
+ // show_results should not change after this
+ $per_page = ($show_results == 'posts') ? $config['posts_per_page'] : $config['topics_per_page'];
+
+ if ($search_id)
+ {
if ($sql)
{
// only return up to 1000 ids (the last one will be removed later)
@@ -377,6 +389,11 @@ if ($keywords || $author || $search_id || $submit)
}
}
+ // make sure that some arrays are always in the same order
+ sort($ex_fid_ary);
+ sort($m_approve_fid_ary);
+ sort($author_id_ary);
+
if (sizeof($search->split_words))
{
$total_match_count = $search->keyword_search($show_results, $search_fields, $search_terms, $sort_by_sql, $sort_key, $sort_dir, $sort_days, $ex_fid_ary, $m_approve_fid_ary, $topic_id, $author_id_ary, $id_ary, $start, $per_page);
@@ -432,6 +449,7 @@ if ($keywords || $author || $search_id || $submit)
$u_search .= ($u_hilit) ? '&amp;keywords=' . $u_hilit : '';
$u_search .= ($topic_id) ? '&amp;ch=' . $topic_id : '';
$u_search .= ($author) ? '&amp;author=' . urlencode($author) : '';
+ $u_search .= ($author_id) ? '&amp;author_id=' . $author_id : '';
$u_search .= ($u_search_forum) ? '&amp;fid%5B%5D=' . $u_search_forum : '';
$u_search .= (!$search_child) ? '&amp;sc=0' : '';
$u_search .= ($search_fields != 'all') ? '&amp;sf=' . $search_fields : '';
@@ -459,7 +477,7 @@ if ($keywords || $author || $search_id || $submit)
'REPORTED_IMG' => $user->img('icon_reported', 'TOPIC_REPORTED'),
'UNAPPROVED_IMG' => $user->img('icon_unapproved', 'TOPIC_UNAPPROVED'),
- 'U_SEARCH_WORDS' => "{$phpbb_root_path}search.$phpEx$SID$u_show_results&amp;keywords=$u_hilit" . (($author) ? '&amp;author=' . urlencode($author) : ''))
+ 'U_SEARCH_WORDS' => "{$phpbb_root_path}search.$phpEx$SID$u_show_results&amp;keywords=$u_hilit" . (($author) ? '&amp;author=' . urlencode($author) : '') . (($author_id) ? '&amp;author_id=' . $author_id : ''))
);
if ($sql_where)
@@ -722,7 +740,7 @@ $s_forums = '';
$sql = 'SELECT f.forum_id, f.forum_name, f.parent_id, f.forum_type, f.left_id, f.right_id, f.forum_password, fa.user_id
FROM ' . FORUMS_TABLE . ' f
LEFT JOIN ' . FORUMS_ACCESS_TABLE . " fa ON (fa.forum_id = f.forum_id
- AND fa.session_id = '" . $db->sql_escape($user->data['session_id']) . "')
+ AND fa.session_id = '" . $db->sql_escape($user->session_id) . "')
ORDER BY f.left_id ASC";
$result = $db->sql_query($sql);