if($thread_id = (isset($_GET['thread_id']) && isnum
($_GET['thread_id']) ?
$_GET['thread_id'] : 0)){ list($thread_subject) = dbarraynum
(dbquery
("SELECT thread_subject from ".DB_THREADS
." WHERE thread_id=".$thread_id.""));
$rel_thread_res = dbquery("
SELECT tt.thread_id, tt.thread_subject, tf.forum_id, tf.forum_name,
tf.forum_access, tt.thread_postcount, tt.thread_views, tt.thread_lastpost, tt.thread_lastpostid
FROM ".DB_THREADS." tt
INNER JOIN ".DB_FORUMS." tf ON tt.forum_id=tf.forum_id
WHERE MATCH (thread_subject) AGAINST ('".$thread_subject."' IN BOOLEAN MODE) AND thread_id != ".$thread_id." AND ".groupaccess('tf.forum_access')."
ORDER BY tt.thread_lastpost DESC LIMIT 10");
if(dbrows($rel_thread_res)){
opentable('Похожие темы');
echo "<table cellpadding='0' cellspacing='1' width='100%' class='tbl-border'>
<tr>
<th class='forum-caption' nowrap='nowrap'>".$locale['global_044']."</th>
<th class='forum-caption' nowrap='nowrap'>".$locale['global_048']."</th>
<th class='forum-caption' nowrap='nowrap'>".$locale['global_046'].' / '.$locale['global_045']."</th>
<th class='forum-caption' nowrap='nowrap'>".$locale['global_047']."</th>
</tr>";
$i = 0;
while($thread = dbarray($rel_thread_res)){
$row = ($i % 2 == 0 ? "tbl1" : "tbl2");
echo "<tr>
<td class='".$row."'><a href='".FORUM."viewthread.php?thread_id=".$thread['thread_id']."' title='".$thread['thread_subject']."'>".$thread['thread_subject']."</a>
<a href='".FORUM."viewthread.php?thread_id=".$thread['thread_id']."&pid=".$thread['thread_lastpostid']."#post_".$thread['thread_lastpostid']."' title='К последнему сообщению'> → </a></td>
<td class='".$row."'>".'<a href="'.FORUM.'viewforum.php?forum_id='.$thread['forum_id'].'">'.$thread['forum_name']."</a></td>
<td width='1%' style='text-align:center;white-space:nowrap' class='".$row."'><b>".($thread['thread_postcount']-1).'</b> / '.$thread['thread_views']."</td>
<td width='1%' style='text-align:center;white-space:nowrap' class='".$row."'>".showdate("forumdate", $thread['thread_lastpost'])."</td>
</tr>";
$i++;
}
echo '</table>';
closetable();
}
}