Parašė MAnjack· 2008 Rugp. 16 15:08:20
#2
Šitą kodą keisk:
$result = dbquery(
"SELECT tf.*, tt.*, tu.user_id,user_name FROM ".$db_prefix."forums tf
INNER JOIN ".$db_prefix."threads tt USING(forum_id)
INNER JOIN ".$db_prefix."users tu ON tt.thread_lastuser=tu.user_id
".$usr_grps." ORDER BY thread_views DESC LIMIT 0,15");
if (dbrows($result) != 0) {
$i=0;
if ($theme_width == "70%") echo "\n";
while ($data = dbarray($result)) {
if ($i % 2 == 0) { $row_color = "tbl1"; } else { $row_color = "tbl1"; }
$new_posts = dbcount("(thread_id)", "posts", "thread_id='".$data['thread_id']."' and post_datestamp>'".(isset($lastvisited) ? $lastvisited : 0)."'");
//$thread_replies = dbcount("(thread_id)", "posts", "thread_id='".$data['thread_id']."'") - 1;
$thread_replies = $data['thread_replies'];
$forum_id = $data['forum_id'];
if ($new_posts > 0) {
$folder123 = "<img src='".THEME."forum/foldernew.gif' height='11'>";
} else if ($new_posts > 19) {
$folder123 = "<img src='".THEME."forum/folderhot.gif' height='11'>";
} else {
if ($data['thread_locked'] == 1) {
$folder123 = "<img src='".THEME."forum/folderlock.gif' height='11'>";
} else if ($data['thread_locked'] == 0) {
$folder123 = "<img src='".THEME."forum/folder.gif' height='11'>";
}
}
//$reply_count = dbcount("(thread_id)", "posts", "thread_id='".$data['thread_id']."'");
$reply_count = $data['thread_replies']+1;
$data2 = dbarray(dbquery("SELECT post_id FROM ".$db_prefix."posts WHERE thread_id='".$data['thread_id']."' ORDER BY post_id DESC LIMIT 1"));
$rstart = ($reply_count > 20 ? "rowstart=".((ceil($reply_count / 20)-1)*20)."&" : "");
echo "<table width=\"70%\" cellpadding=\"0\" cellspacing=\"0\"><tr><td align=\"left\" class='small' width='70%'>";
if ($theme_width == "70%") {
echo "$folder123 <a href='posts/ziureti-".$rstart."".$data['forum_id']."-tema".$data['thread_id']."#".$data2['post_id']."' onMouseover=\"ddrivetip('$start<center><b>° ".$locale['XXX_017']." °</b></center><hr><b>".$locale['XXX_019']."</b>: ".trimlink(str_replace("'", "", $data['thread_subject']), 45)."<hr><b>".$locale['XXX_020']."</b>: ".($reply_count - 1)."/".$data['thread_views']."<br><b>".$locale['XXX_021']."</b>: ".$data['user_name']."<br><b>".$locale['XXX_022']."</b>: ".showdate("forumdate", $data['thread_lastpost'])."$end')\"' onMouseout=\"hideddrivetip()\" >".trimlink($data['thread_subject'], 16)."</a><br></td>\n";
echo "<td align=\"right\" width='25%'>[".$data['thread_views']."]</td>";
} else {
echo "$folder123 <a href='posts/ziureti-".$rstart."".$data['forum_id']."-tema-".$data['thread_id']."#".$data2['post_id']."' onMouseover=\"ddrivetip('$start<center><b>° ".$locale['XXX_017']." °</b></center><hr><b>".$locale['XXX_019']."</b> ".trimlink(str_replace("'", "", $data['thread_subject']), 45)."<hr><b>".$locale['XXX_020']."</b>: ".($reply_count - 1)."/".$data['thread_views']."<br><b>".$locale['XXX_021']."</b>: ".$data['user_name']."<br><b>".$locale['XXX_022']."</b>: ".showdate("forumdate", $data['thread_lastpost'])."$end')\" (".$data['forum_name'].")' onMouseout=\"hideddrivetip()\">".trimlink($data['thread_subject'], 16)."</a><br></td>\n";
echo "<td align=\"right\" width='25%'>[".$data['thread_views']."] </td>";
}
echo "</tr></table>";
$i++;
}