if ($tor_status != -1) { $where_tor_sql = "AND tor.tor_status = {$tor_status}"; } $select_tor_sql = ', bt.auth_key, tor.info_hash, tor.size AS tor_size, tor.reg_time, tor.complete_count, tor.seeder_last_seen, tor.attach_id, tor.tor_status, tor.tor_type, sn.seeders, sn.leechers '; $select_tor_sql .= $join_dl ? ', dl.user_status AS dl_status' : ''; $join_tor_sql = "\n\t\tLEFT JOIN " . BB_BT_TORRENTS . " tor ON(t.topic_id = tor.topic_id)\n\t\tLEFT JOIN " . BB_BT_USERS . " bt ON(bt.user_id = {$userdata['user_id']})\n\t\tLEFT JOIN " . BB_BT_TRACKER_SNAP . " sn ON(tor.topic_id = sn.topic_id)\n\t"; $join_tor_sql .= $join_dl ? " LEFT JOIN " . BB_BT_DLSTATUS . " dl ON(dl.user_id = {$userdata['user_id']} AND dl.topic_id = t.topic_id)" : ''; } // Title match $title_match_sql = ''; if ($title_match =& $_REQUEST[$title_match_key]) { if ($tmp = mb_substr(trim($title_match), 0, $title_match_max_len)) { $title_match_val = clean_text_match($tmp, true, false, false); $title_match_topics = get_title_match_topics($title_match_val, array(0 => $forum_id)); if ($search_match_topics_csv = join(',', $title_match_topics)) { $title_match_sql = "AND t.topic_id IN({$search_match_topics_csv})"; } } } // Get topics $topic_ids = $topic_rowset = array(); // IDs $sql = "\n\tSELECT t.topic_id\n\tFROM " . BB_TOPICS . " t\n\tWHERE t.forum_id = {$forum_id}\n\t\t{$only_new_sql}\n\t\t{$title_match_sql}\n\t\t{$limit_topics_time_sql}\n\t{$order_sql}\n\tLIMIT {$start}, {$topics_per_page}\n"; foreach (DB()->fetch_rowset($sql) as $row) { $topic_ids[] = $row['topic_id']; } // Titles, posters etc. if ($topics_csv = join(',', $topic_ids)) {
} } } if (isset($_REQUEST[$hash_key])) { hash_search($_REQUEST[$hash_key]); } if ($tm =& $_REQUEST[$title_match_key] and is_string($tm)) { if ($tmp = mb_substr(trim($tm), 0, $title_match_max_len)) { if ($bb_cfg['autocorrect_wkl']) { // Autocorrect wrong keyboard layout $tlc = new Text_LangCorrect(); $title_match_val = $tlc->parse($tlc->parse($tmp, 1), 2); } else { $title_match_val = $tmp; } $title_match_sql = clean_text_match($title_match_val, true, false, false); } } } $dl_status = array(); if ($dl_cancel_val) { $dl_status[] = DL_STATUS_CANCEL; } if ($dl_compl_val) { $dl_status[] = DL_STATUS_COMPLETE; } if ($dl_down_val) { $dl_status[] = DL_STATUS_DOWN; } if ($dl_will_val) { $dl_status[] = DL_STATUS_WILL;
if (!($poster_id_val = get_user_id($poster_name_sql))) { bb_die($lang['USER_NOT_EXIST']); } } } // Search words if ($var =& $_REQUEST[$text_match_key]) { if ($tmp = mb_substr(trim($var), 0, $text_match_max_len)) { if ($bb_cfg['autocorrect_wkl']) { // Autocorrect wrong keyboard layout $tlc = new Text_LangCorrect(); $title_match_val = $tlc->parse($tlc->parse($tmp, 1), 2); } else { $title_match_val = $tmp; } $text_match_sql = clean_text_match($title_match_val, $all_words_val, false, true); } } } $dl_status = array(); if ($dl_cancel_val) { $dl_status[] = DL_STATUS_CANCEL; } if ($dl_compl_val) { $dl_status[] = DL_STATUS_COMPLETE; } if ($dl_down_val) { $dl_status[] = DL_STATUS_DOWN; } if ($dl_will_val) { $dl_status[] = DL_STATUS_WILL;