Похожие темы / Similar Topics

Oblom

Пользователь
Название релиза: Любовь / Love (Уильям Юбэнк) [2011 г., фантастика, драма, HDRip] , а нашел много чего в разных разделах. Можно ли как -то сделать, чтобы искал по разделам. Если это кино, то пусть похожие ищет в разделе кино а не по всему трекеру. Заранее спасибо.

30.07.png
 

Basilevs

Пользователь
Найти.
PHP:
if ($poster_id != BOT_UID)

и после } в этом куске

PHP:
// Similar Topics [START]
    if(!$start && ($postrow[$i]['post_id'] == $t_data['topic_first_post_id']) && $t_data['allow_reg_tracker'])
    {
        $title = (strlen($topic_title) > 10) ? (substr($topic_title, 0, 10) . '') : $topic_title;
        $sgl_search = "t.topic_title LIKE '%" . addslashes($title) . "%'";
        //$sgl_search = "MATCH (t.topic_title) AGAINST ('". addslashes($topic_title) ."')"; // Для полноценного поиска
 
        $trash_forums = $bb_cfg['trash_forum_id'] ? $bb_cfg['trash_forum_id'] : '0';
 
        /*
        if (!$similar = $bb_cache->get("similar$topic_id"))
        {
        */
            $similar = DB()->fetch_rowset("SELECT t.*,
                    f.forum_name, u.username, u.user_id,       
                    tor.attach_id, tor.size, tor.tor_status
                FROM ". BB_TOPICS ." t
                    LEFT JOIN ". BB_USERS ."          u  ON(u.user_id = t.topic_poster)
                    LEFT JOIN ". BB_FORUMS ."          f  ON(f.forum_id = t.forum_id)
                    LEFT JOIN ". BB_BT_TORRENTS ."    tor ON(tor.topic_id = t.topic_id)
                    LEFT JOIN ". BB_BT_TRACKER_SNAP ." ts  ON(ts.topic_id = t.topic_id)
                WHERE t.topic_id != $topic_id
                    AND $sgl_search
                    AND f.allow_reg_tracker = 1
                    AND t.forum_id not in (1)
                    AND tor.topic_id = t.topic_id
                GROUP BY t.topic_id
                ORDER BY t.topic_last_post_time DESC LIMIT 50");
            /*$bb_cache->set("similar$topic_id", $similar, 7200);
        }*/
        if (!CACHE('bb_cache')->get('similar'.$topic_id)){
        $row = DB()->fetch_row($sql);
        CACHE('bb_cache')->set('similar'.$topic_id, $row, 7200);
        $row = CACHE('bb_cache')->get('similar'.$topic_id);
        }
        else
        {
        $row = CACHE('bb_cache')->get('similar'.$topic_id);
        }
 
        if(!$similar)
        {
            $template->assign_vars(array(
                'SIMILAR' => false,
            ));
        }
        else
        {
            $page_cfg['usesorter'] = true;
 
            $template->assign_vars(array(
                'SIMILAR' => true,
            ));
 
            foreach ($similar as $row)
            {
                $poster_url = PROFILE_URL . $row['user_id'];
                $username = wbr($row['username']);                                   
 
                $is_unread = is_unread($row['topic_last_post_time'], $row['topic_id'], $row['forum_id']);
 
                $template->assign_block_vars('postrow.similar', array(
                    'POST_ID'          => $row['topic_first_post_id'],
 
                    'TOPIC_ID'          => $row['topic_id'],
                    'TOPIC_TITLE'      => wbr(str_short($row['topic_title'], 138)),
                    'FULL_TOPIC_TITLE'  => wbr($row['topic_title']),
 
                    'FORUM_NAME'        => wbr($row['forum_name']),
                    'U_FORUM'          => FORUM_URL . $row['forum_id'],                           
 
                    'POSTER'            => $username,
                    'POSTER_URL'        => $poster_url,                               
               
                    'IS_UNREAD'        => $is_unread,
                    'TOPIC_ICON'        => get_topic_icon($row, $is_unread),
                    'PAGINATION'        => ($row['topic_status'] == TOPIC_MOVED) ? '' : build_topic_pagination(TOPIC_URL . $row['topic_id'], $row['topic_replies'], $bb_cfg['posts_per_page']),
               
                    'TOR_STATUS'        => $row['tor_status'],               
                    'TOR_SIZE'          => humn_size($row['size']),               
                    'ATTACH_ID'        => $row['attach_id'],
                    'TOR_FROZEN'        => ($row['tor_status'] == TOR_STATUS_FROZEN || $row['tor_status'] == 3 || $row['tor_status'] == 4 || $row['tor_status'] == 7),
                ));
            }
        }
    }
    // Similar Topics [END]


Вывод во viewtopic.tpl

PHP:
<!-- IF SIMILAR -->
            <div class="sp-wrap"><div class="sp-body" title="Альтернативные раздачи">
 
<style type="text/css">
.post_similar_wrap { border: 1px #A5AFB4 solid; margin: 8px 8px 6px; overflow: auto; }
.post_links { margin: 6px; }
.unfolded2, .folded2 { display: block; }
</style>
 
<table id="post-row" style="display: none;">
<tr>
    <td class="row2" colspan="8">
        <div class="post_similar_wrap row1">
            <div class="post_body pad_6"></div>
            <div class="clear"></div>
        </div>
        <div class="post_links med bold tCenter"><a class="tLink">{L_OPEN_TOPIC}</a> &nbsp;&#0183;&nbsp; <a class="dLink">{L_DL_TORRENT}</a></div>
    </td>
</tr>
</table>
<div class="spacer_10"></div>
<table width="100%" class="forumline tablesorter">
<thead>
<tr>
    <th class="{sorter: 'text'}"></th>
    <th class="{sorter: 'text'}"></th>
    <th width="25%" class="{sorter: 'text'}"><b class="tbs-text">{L_FORUM}</b></th>
    <th width="75%" class="{sorter: 'text'}"><b class="tbs-text">{L_TOPIC}</b></th>
    <th width="100" class="{sorter: 'text'}"><b class="tbs-text">{L_AUTHOR}</b></th>
    <!-- IF LOGGED_IN --><th class="{sorter: false}">{L_TORRENT}</th><!-- ENDIF -->
</tr>
</thead>
<!-- BEGIN similar -->

Очень жёсткая бэта флая. :eek:
 

Lange

Легенда
Basilevs, if ($poster_id != BOT_UID)
{
$prev_post_time = $postrow[$i]['post_time'];
}
} После этого?
PS В виевтопик аттач, после чего код вставлять?
 
Сверху