From e11a04bad0ae1d47918436227a9dff78469b6d17 Mon Sep 17 00:00:00 2001 From: nanosimbiot Date: Wed, 13 Jul 2011 11:04:15 +0000 Subject: [PATCH] r101 git-svn-id: https://torrentpier2.googlecode.com/svn/trunk@101 a8ac35ab-4ca4-ca47-4c2d-a49a94f06293 --- upload/attach_mod/posting_attachments.php | 2 +- upload/config.php | 4 +-- upload/includes/functions.php | 3 +- upload/posting.php | 5 ++- upload/search.php | 40 +++++++++++------------ 5 files changed, 28 insertions(+), 26 deletions(-) diff --git a/upload/attach_mod/posting_attachments.php b/upload/attach_mod/posting_attachments.php index 88f6b71c1..d93199ae7 100644 --- a/upload/attach_mod/posting_attachments.php +++ b/upload/attach_mod/posting_attachments.php @@ -1002,7 +1002,7 @@ class attach_parent { $error_msg .= '
'; } - $error_msg .= $lang['Allowed_only_1st_post_attach']; + $error_msg .= $lang['ALLOWED_ONLY_1ST_POST_ATTACH']; } //bt end diff --git a/upload/config.php b/upload/config.php index 6fe58402a..5574cb684 100644 --- a/upload/config.php +++ b/upload/config.php @@ -57,7 +57,7 @@ $bb_cfg['css_ver'] = 1; // Increase number of revision after update $bb_cfg['tp_version'] = '2.0.2'; -$bb_cfg['tp_release_state'] = 'TP II r100'; +$bb_cfg['tp_release_state'] = 'TP II r101'; $bb_cfg['tp_release_date'] = '13-07-2011'; $bb_cfg['board_disabled_msg'] = 'форум временно отключен'; // 'forums temporarily disabled'; // show this msg if board has been disabled via ON/OFF trigger @@ -408,7 +408,7 @@ $bb_cfg['posts_cache_days_keep'] = 14; $bb_cfg['max_post_length'] = 120000; // bytes // Search -$bb_cfg['search_engine_type'] = 'sphinx'; // none, mysql, sphinx +$bb_cfg['search_engine_type'] = 'mysql'; // none, mysql, sphinx $bb_cfg['sphinx_topic_titles_host'] = '127.0.0.1'; $bb_cfg['sphinx_topic_titles_port'] = 3312; $bb_cfg['disable_ft_search_in_posts'] = false; // disable searching in post bodies diff --git a/upload/includes/functions.php b/upload/includes/functions.php index 6d6359e0b..b62a18b0b 100644 --- a/upload/includes/functions.php +++ b/upload/includes/functions.php @@ -2852,7 +2852,7 @@ function get_title_match_topics ($title_match_sql, $limit = 500, $forum_ids = ar if ($bb_cfg['search_engine_type'] == 'sphinx') { - global $user; + global $user, $title_match; //$title_match - для поиска по постам и топикам (ещё не реализовано) init_sphinx(); @@ -2889,7 +2889,6 @@ function get_title_match_topics ($title_match_sql, $limit = 500, $forum_ids = ar } else if ($bb_cfg['search_engine_type'] == 'mysql') { - $bool_mode = (true) ? " IN BOOLEAN MODE" : ''; $in_forums = ($forum_ids) ? "AND forum_id IN(". join(',', $forum_ids) .")" : ''; $sql = " SELECT topic_id diff --git a/upload/posting.php b/upload/posting.php index 91446f75f..434016390 100644 --- a/upload/posting.php +++ b/upload/posting.php @@ -535,7 +535,10 @@ else if ( ($submit || $confirm) && !$topic_has_new_posts ) if (defined('TORRENT_ATTACH_ID') && $bb_cfg['bt_newtopic_auto_reg'] && !$error_msg) { include(INC_DIR .'functions_torrent.php'); - tracker_register(TORRENT_ATTACH_ID, 'newtopic'); + if(!get_torrent_info(TORRENT_ATTACH_ID)) + { + tracker_register(TORRENT_ATTACH_ID, 'newtopic'); + } } if ($mode == 'reply' && $post_info['topic_status'] == TOPIC_LOCKED) diff --git a/upload/search.php b/upload/search.php index cd1b7177b..683f2d7d9 100644 --- a/upload/search.php +++ b/upload/search.php @@ -453,16 +453,16 @@ if ($post_mode) if ($text_match_sql) { - $field_match = ($title_match) ? "t.topic_title" : "ps.search_words" ; - $tmp_text_match_sql = $text_match_sql; - if (mb_substr($tmp_text_match_sql, 0, 1) == '+') $tmp_text_match_sql = mb_substr($tmp_text_match_sql, 1); - $tmp_text_match_sql = str_replace(' +', ' ', $tmp_text_match_sql); - $tmp_text_match_sql = extract_search_words($tmp_text_match_sql, true); - $tmp_text_match_sql = str_replace(' ', '%', $tmp_text_match_sql); - $tmp_text_match_sql = str_replace('%%%', '%', $tmp_text_match_sql); - $tmp_text_match_sql = str_replace('%%', '%', $tmp_text_match_sql); - if ($tmp_text_match_sql == '' || $tmp_text_match_sql == '%') bb_die($lang['NO_SEARCH_MATCH']); - $SQL['WHERE'][] = "$field_match LIKE '%$tmp_text_match_sql%'"; + $search_match_topics_csv = ''; + if(!$forum_selected[0]) $forum_selected = array(); + $title_match_topics = get_title_match_topics($text_match_sql, 500, $forum_selected); + + if (!$search_match_topics_csv = join(',', $title_match_topics)) + { + bb_die($lang['NO_SEARCH_MATCH']); + } + + $SQL['WHERE'][] = "$tbl.topic_id IN($search_match_topics_csv)"; prevent_huge_searches($SQL); } @@ -626,16 +626,16 @@ else if ($text_match_sql) { - $field_match = ($title_match) ? "t.topic_title" : "ps.search_words" ; - $tmp_text_match_sql = $text_match_sql; - if (mb_substr($tmp_text_match_sql, 0, 1) == '+') $tmp_text_match_sql = mb_substr($tmp_text_match_sql, 1); - $tmp_text_match_sql = str_replace(' +', ' ', $tmp_text_match_sql); - $tmp_text_match_sql = extract_search_words($tmp_text_match_sql, true); - $tmp_text_match_sql = str_replace(' ', '%', $tmp_text_match_sql); - $tmp_text_match_sql = str_replace('%%%', '%', $tmp_text_match_sql); - $tmp_text_match_sql = str_replace('%%', '%', $tmp_text_match_sql); - if ($tmp_text_match_sql == '' || $tmp_text_match_sql == '%') bb_die($lang['NO_SEARCH_MATCH']); - $SQL['WHERE'][] = "$field_match LIKE '%$tmp_text_match_sql%'"; + $search_match_topics_csv = ''; + if(!$forum_selected[0]) $forum_selected = array(); + $title_match_topics = get_title_match_topics($text_match_sql, 500, $forum_selected); + + if (!$search_match_topics_csv = join(',', $title_match_topics)) + { + bb_die($lang['NO_SEARCH_MATCH']); + } + + $SQL['WHERE'][] = "$tbl.topic_id IN($search_match_topics_csv)"; prevent_huge_searches($SQL); }