mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-22 14:23:57 -07:00
r476
Начинаем фиксить поиск по постам. git-svn-id: https://torrentpier2.googlecode.com/svn/trunk@476 a8ac35ab-4ca4-ca47-4c2d-a49a94f06293
This commit is contained in:
parent
b73027fc20
commit
7027a207b2
4 changed files with 16 additions and 7 deletions
|
@ -139,7 +139,9 @@ switch($this->request['type'])
|
|||
}
|
||||
}
|
||||
DB()->query("UPDATE ". BB_POSTS_TEXT ." SET post_text = '". DB()->escape($text) ."' WHERE post_id = $post_id LIMIT 1");
|
||||
add_search_words($post_id, stripslashes($text), stripslashes($post['topic_title']));
|
||||
$s_text = str_replace('\n', "\n", $text);
|
||||
$s_topic_title = str_replace('\n', "\n", $post['topic_title']);
|
||||
add_search_words($post_id, stripslashes($s_text), stripslashes($s_topic_title));
|
||||
update_post_html(array(
|
||||
'post_id' => $post_id,
|
||||
'post_text' => $text,
|
||||
|
@ -285,7 +287,9 @@ switch($this->request['type'])
|
|||
|
||||
update_post_stats('reply', $post, $post['forum_id'], $topic_id, $post_id, $userdata['user_id']);
|
||||
|
||||
add_search_words($post_id, stripslashes($message), stripslashes($post['topic_title']));
|
||||
$s_message = str_replace('\n', "\n", $message);
|
||||
$s_topic_title = str_replace('\n', "\n", $post['topic_title']);
|
||||
add_search_words($post_id, stripslashes($s_message), stripslashes($s_topic_title));
|
||||
update_post_html(array(
|
||||
'post_id' => $post_id,
|
||||
'post_text' => $message,
|
||||
|
|
|
@ -58,7 +58,7 @@ $domain_name = (!empty($_SERVER['SERVER_NAME'])) ? $_SERVER['SERVER_NAME'] : $do
|
|||
$bb_cfg['tp_version'] = '2.5 Beta';
|
||||
|
||||
$bb_cfg['tp_release_date'] = '14-11-2012';
|
||||
$bb_cfg['tp_release_state'] = 'R475';
|
||||
$bb_cfg['tp_release_state'] = 'R476';
|
||||
|
||||
// Database
|
||||
$charset = 'utf8';
|
||||
|
|
|
@ -343,7 +343,7 @@ function strip_bbcode ($message, $stripquotes = true, $fast_and_dirty = false, $
|
|||
$message = str_replace($m[0], $m[2], $message);
|
||||
}
|
||||
|
||||
$replace = array('[*]', '[hr]', '[br]');
|
||||
$replace = array('[*]', '[hr]', '[br]', '[align=center]', '[align=left]', '[align=right]');
|
||||
$message = str_replace($replace, ' ', $message);
|
||||
}
|
||||
|
||||
|
@ -365,6 +365,9 @@ function extract_search_words ($text)
|
|||
$text = preg_replace('/(\w*?)&#?[0-9a-z]+;(\w*?)/iu', '', $text);
|
||||
// Remove URL's ((www|ftp)\.[\w\#!$%&~/.\-;:=,?@а-яА-Я\[\]+]*?)
|
||||
$text = preg_replace('#\b[a-z0-9]+://[\w\#!$%&~/.\-;:=,?@а-яА-Я\[\]+]+(/[0-9a-z\?\.%_\-\+=&/]+)?#u', ' ', $text);
|
||||
$text = str_replace('[url=', ' ', $text);
|
||||
$text = str_replace('?', ' ', $text);
|
||||
$text = str_replace('!', ' ', $text);
|
||||
|
||||
$text = strip_bbcode($text);
|
||||
|
||||
|
@ -372,7 +375,7 @@ function extract_search_words ($text)
|
|||
$text = preg_replace('#[.,:;]#u', ' ', $text);
|
||||
|
||||
// short & long words
|
||||
$text = preg_replace('#(?<=^|\s)(\S{1,'.$min_word_len.'}|\S{'.$max_word_len.',}|\W*)(?=$|\s)#', ' ', $text);
|
||||
$text = preg_replace('#(?<=^|\s)(\S{1,'.$min_word_len.'}|\S{'.$max_word_len.',}|\W*)(?=$|\s)#u', ' ', $text);
|
||||
|
||||
$text = remove_stopwords($text);
|
||||
# $text = replace_synonyms($text);
|
||||
|
@ -508,7 +511,7 @@ class bbcode
|
|||
"#\[url\](www\.$url_exp)\[/url\]#isu" => '<a href="http://$1" class="postLink">$1</a>',
|
||||
"#\[url=(https?://$url_exp)\]([^?\n\t].*?)\[/url\]#isu" => '<a href="$1" class="postLink">$2</a>',
|
||||
"#\[url=(www\.$url_exp)\]([^?\n\t].*?)\[/url\]#isu" => '<a href="http://$1" class="postLink">$2</a>',
|
||||
"#\[email\]($email_exp)\[/email\]#isu" => '<a href="mailto:$1">$1</a>',
|
||||
"#\[email\]($email_exp)\[/email\]#isu" => '<a href="mailto:$1">$1</a>',
|
||||
"#\[qpost=([0-9]*)\]#isu" => '<u class="q-post">$1</u>',
|
||||
);
|
||||
|
||||
|
|
|
@ -206,7 +206,9 @@ function submit_post($mode, &$post_data, &$message, &$meta, &$forum_id, &$topic_
|
|||
|
||||
if ($userdata['user_id'] != BOT_UID)
|
||||
{
|
||||
add_search_words($post_id, stripslashes($post_message), stripslashes($post_subject));
|
||||
$s_post_message = str_replace('\n', "\n", $post_message);
|
||||
$s_post_subject = str_replace('\n', "\n", $post_subject);
|
||||
add_search_words($post_id, stripslashes($s_post_message), stripslashes($s_post_subject));
|
||||
}
|
||||
|
||||
update_post_html(array(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue