mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 06:08:52 +00:00
Altered for constant table names
git-svn-id: file:///svn/phpbb/trunk@1297 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
16a20599ff
commit
4e0ec70803
3 changed files with 17 additions and 26 deletions
|
@ -20,10 +20,6 @@
|
||||||
*
|
*
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
//
|
|
||||||
// Constants
|
|
||||||
//
|
|
||||||
|
|
||||||
// Debug Level
|
// Debug Level
|
||||||
define(DEBUG, 1); // Debugging on
|
define(DEBUG, 1); // Debugging on
|
||||||
//define(DEBUG, 0); // Debugging off
|
//define(DEBUG, 0); // Debugging off
|
||||||
|
@ -89,7 +85,6 @@ define(CRITICAL_ERROR, 204);
|
||||||
define(PRIVMSGS_READ_MAIL, 0);
|
define(PRIVMSGS_READ_MAIL, 0);
|
||||||
define(PRIVMSGS_NEW_MAIL, 1);
|
define(PRIVMSGS_NEW_MAIL, 1);
|
||||||
define(PRIVMSGS_SENT_MAIL, 2);
|
define(PRIVMSGS_SENT_MAIL, 2);
|
||||||
define(PRIVMSGS_SAVED_MAIL, 3);
|
|
||||||
define(PRIVMSGS_SAVED_IN_MAIL, 3);
|
define(PRIVMSGS_SAVED_IN_MAIL, 3);
|
||||||
define(PRIVMSGS_SAVED_OUT_MAIL, 4);
|
define(PRIVMSGS_SAVED_OUT_MAIL, 4);
|
||||||
|
|
||||||
|
@ -160,6 +155,8 @@ define('PRIVMSGS_IGNORE_TABLE', $table_prefix.'privmsgs_ignore');
|
||||||
define('PRUNE_TABLE', $table_prefix.'forum_prune');
|
define('PRUNE_TABLE', $table_prefix.'forum_prune');
|
||||||
define('RANKS_TABLE', $table_prefix.'ranks');
|
define('RANKS_TABLE', $table_prefix.'ranks');
|
||||||
define('SEARCH_TABLE', $table_prefix.'search_results');
|
define('SEARCH_TABLE', $table_prefix.'search_results');
|
||||||
|
define('SEARCH_WORD_TABLE', $table_prefix.'search_wordlist');
|
||||||
|
define('SEARCH_MATCH_TABLE', $table_prefix.'search_wordmatch');
|
||||||
define('SESSIONS_TABLE', $table_prefix.'sessions');
|
define('SESSIONS_TABLE', $table_prefix.'sessions');
|
||||||
define('SMILIES_TABLE', $table_prefix.'smilies');
|
define('SMILIES_TABLE', $table_prefix.'smilies');
|
||||||
define('THEMES_TABLE', $table_prefix.'themes');
|
define('THEMES_TABLE', $table_prefix.'themes');
|
||||||
|
|
|
@ -123,13 +123,13 @@ function remove_common($percent, $word_id_list = array())
|
||||||
}
|
}
|
||||||
$word_id_sql .= $word_id_list[$i]['word_id'];
|
$word_id_sql .= $word_id_list[$i]['word_id'];
|
||||||
}
|
}
|
||||||
$word_id_sql = " AND sl.word_id IN ($word_id_sql)";
|
$word_id_sql = " AND w.word_id IN ($word_id_sql)";
|
||||||
|
|
||||||
$sql = "SELECT sl.word_id, SUM(sm.word_count) AS post_occur_count
|
$sql = "SELECT w.word_id, SUM(m.word_count) AS post_occur_count
|
||||||
FROM phpbb_search_wordlist sl, phpbb_search_wordmatch sm
|
FROM " . SEARCH_WORD_TABLE . " w, " . SEARCH_MATCH_TABLE . " m
|
||||||
WHERE sl.word_id = sm.word_id
|
WHERE w.word_id = m.word_id
|
||||||
$word_id_sql
|
$word_id_sql
|
||||||
GROUP BY sl.word_id
|
GROUP BY w.word_id
|
||||||
ORDER BY post_occur_count DESC";
|
ORDER BY post_occur_count DESC";
|
||||||
if( !$result = $db->sql_query($sql) )
|
if( !$result = $db->sql_query($sql) )
|
||||||
{
|
{
|
||||||
|
@ -156,7 +156,7 @@ function remove_common($percent, $word_id_list = array())
|
||||||
{
|
{
|
||||||
if( ( $rowset[$i]['post_occur_count'] / $row['total_posts'] ) >= $percent )
|
if( ( $rowset[$i]['post_occur_count'] / $row['total_posts'] ) >= $percent )
|
||||||
{
|
{
|
||||||
$sql = "DELETE FROM phpbb_search_wordlist
|
$sql = "DELETE FROM " . SEARCH_WORD_TABLE . "
|
||||||
WHERE word_id = " . $rowset[$i]['word_id'];
|
WHERE word_id = " . $rowset[$i]['word_id'];
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
if( !$result )
|
if( !$result )
|
||||||
|
@ -164,7 +164,7 @@ function remove_common($percent, $word_id_list = array())
|
||||||
message_die(GENERAL_ERROR, "Couldn't delete word list entry", "", __LINE__, __FILE__, $sql);
|
message_die(GENERAL_ERROR, "Couldn't delete word list entry", "", __LINE__, __FILE__, $sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = "DELETE FROM phpbb_search_wordmatch
|
$sql = "DELETE FROM " . SEARCH_MATCH_TABLE . "
|
||||||
WHERE word_id = " . $rowset[$i]['word_id'];
|
WHERE word_id = " . $rowset[$i]['word_id'];
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
if( !$result )
|
if( !$result )
|
||||||
|
@ -194,7 +194,6 @@ function remove_old_words($post_id)
|
||||||
if( $result = $db->sql_query($sql) )
|
if( $result = $db->sql_query($sql) )
|
||||||
{
|
{
|
||||||
$row = $db->sql_fetchrow($result);
|
$row = $db->sql_fetchrow($result);
|
||||||
// print_r($row);
|
|
||||||
|
|
||||||
$search_text = clean_words($row['post_text'], $stopword_array, $synonym_array);
|
$search_text = clean_words($row['post_text'], $stopword_array, $synonym_array);
|
||||||
$search_matches = split_words($search_text);
|
$search_matches = split_words($search_text);
|
||||||
|
@ -244,7 +243,7 @@ function remove_old_words($post_id)
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = "SELECT word_id, word_text
|
$sql = "SELECT word_id, word_text
|
||||||
FROM phpbb_search_wordlist
|
FROM " . SEARCH_WORD_TABLE . "
|
||||||
WHERE word_text IN ($sql_in)";
|
WHERE word_text IN ($sql_in)";
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
if( !$result )
|
if( !$result )
|
||||||
|
@ -256,8 +255,6 @@ function remove_old_words($post_id)
|
||||||
{
|
{
|
||||||
$check_words = $db->sql_fetchrowset($result);
|
$check_words = $db->sql_fetchrowset($result);
|
||||||
|
|
||||||
// print_r($check_words);
|
|
||||||
|
|
||||||
$word_id_sql = "";
|
$word_id_sql = "";
|
||||||
for($i = 0; $i < count($check_words); $i++ )
|
for($i = 0; $i < count($check_words); $i++ )
|
||||||
{
|
{
|
||||||
|
@ -270,7 +267,7 @@ function remove_old_words($post_id)
|
||||||
$word_id_sql = "word_id IN ($word_id_sql)";
|
$word_id_sql = "word_id IN ($word_id_sql)";
|
||||||
|
|
||||||
$sql = "SELECT word_id, COUNT(post_id) AS post_occur_count
|
$sql = "SELECT word_id, COUNT(post_id) AS post_occur_count
|
||||||
FROM phpbb_search_wordmatch
|
FROM " . SEARCH_MATCH_TABLE . "
|
||||||
WHERE $word_id_sql
|
WHERE $word_id_sql
|
||||||
GROUP BY word_id
|
GROUP BY word_id
|
||||||
ORDER BY post_occur_count DESC";
|
ORDER BY post_occur_count DESC";
|
||||||
|
@ -283,14 +280,11 @@ function remove_old_words($post_id)
|
||||||
{
|
{
|
||||||
$rowset = $db->sql_fetchrowset($result);
|
$rowset = $db->sql_fetchrowset($result);
|
||||||
|
|
||||||
// print_r($rowset);
|
|
||||||
|
|
||||||
for($i = 0; $i < $post_count; $i++)
|
for($i = 0; $i < $post_count; $i++)
|
||||||
{
|
{
|
||||||
// echo $rowset[$i]['post_occur_count'] . "<BR>";
|
|
||||||
if( $rowset[$i]['post_occur_count'] == 1 )
|
if( $rowset[$i]['post_occur_count'] == 1 )
|
||||||
{
|
{
|
||||||
$sql = "DELETE FROM phpbb_search_wordlist
|
$sql = "DELETE FROM " . SEARCH_WORD_TABLE . "
|
||||||
WHERE word_id = " . $rowset[$i]['word_id'];
|
WHERE word_id = " . $rowset[$i]['word_id'];
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
if( !$result )
|
if( !$result )
|
||||||
|
@ -301,7 +295,7 @@ function remove_old_words($post_id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = "DELETE FROM phpbb_search_wordmatch
|
$sql = "DELETE FROM " . SEARCH_MATCH_TABLE . "
|
||||||
WHERE post_id = $post_id";
|
WHERE post_id = $post_id";
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
if( !$result )
|
if( !$result )
|
||||||
|
@ -374,7 +368,7 @@ function add_search_words($post_id, $text)
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = "SELECT word_id, word_text
|
$sql = "SELECT word_id, word_text
|
||||||
FROM phpbb_search_wordlist
|
FROM " . SEARCH_WORD_TABLE . "
|
||||||
WHERE word_text IN ($sql_in)";
|
WHERE word_text IN ($sql_in)";
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
if( !$result )
|
if( !$result )
|
||||||
|
@ -407,7 +401,7 @@ function add_search_words($post_id, $text)
|
||||||
|
|
||||||
if( $new_match )
|
if( $new_match )
|
||||||
{
|
{
|
||||||
$sql = "INSERT INTO phpbb_search_wordlist (word_text)
|
$sql = "INSERT INTO " . SEARCH_WORD_TABLE . " (word_text)
|
||||||
VALUES ('". addslashes($word[$j]) . "')";
|
VALUES ('". addslashes($word[$j]) . "')";
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
if( !$result )
|
if( !$result )
|
||||||
|
@ -418,7 +412,7 @@ function add_search_words($post_id, $text)
|
||||||
$word_id = $db->sql_nextid();
|
$word_id = $db->sql_nextid();
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = "INSERT INTO phpbb_search_wordmatch (post_id, word_id, word_count, title_match)
|
$sql = "INSERT INTO " . SEARCH_MATCH_TABLE . " (post_id, word_id, word_count, title_match)
|
||||||
VALUES ($post_id, $word_id, " . $word_count[$word[$j]] . ", 0)";
|
VALUES ($post_id, $word_id, " . $word_count[$word[$j]] . ", 0)";
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
if( !$result )
|
if( !$result )
|
||||||
|
|
|
@ -307,7 +307,7 @@ else if( $query_keywords != "" || $query_author != "" || $search_id )
|
||||||
$match_word = str_replace("*", "%", $match_word_list[$i]);
|
$match_word = str_replace("*", "%", $match_word_list[$i]);
|
||||||
|
|
||||||
$sql = "SELECT m.post_id, m.word_count
|
$sql = "SELECT m.post_id, m.word_count
|
||||||
FROM phpbb_search_wordlist w, phpbb_search_wordmatch m
|
FROM " . SEARCH_WORD_TABLE . " w, " . SEARCH_MATCH_TABLE . " m
|
||||||
WHERE w.word_text LIKE '$match_word'
|
WHERE w.word_text LIKE '$match_word'
|
||||||
AND m.word_id = w.word_id
|
AND m.word_id = w.word_id
|
||||||
ORDER BY m.post_id, m.word_count DESC";
|
ORDER BY m.post_id, m.word_count DESC";
|
||||||
|
|
Loading…
Add table
Reference in a new issue