code for New Posts:
[syntaxhighlighter brush=php,first-line=1,highlight=0,collapse=false,html-script=false]<?php
if (!defined("IN_FUSION"
) { die("Access Denied"
; }
$cdn='http://cdn.dimitech.net/v7/';
global $lastvisited;
if (!isset($lastvisited) || !isnum($lastvisited)) { $lastvisited = time(); }
$data = dbarray(dbquery(
"SELECT tt.thread_lastpost
FROM ".DB_FORUMS." tf
INNER JOIN ".DB_THREADS." tt ON tf.forum_id = tt.forum_id
WHERE ".groupaccess('tf.forum_access'
." AND thread_hidden='0'
ORDER BY tt.thread_lastpost DESC LIMIT ".($settings['numofthreads']-1).", 8"
);
$timeframe = empty($data['thread_lastpost']) ? 0 : $data['thread_lastpost'];
$result = dbquery(
"SELECT user_avatar, tt.thread_id, tt.thread_subject, tt.thread_views, tt.thread_lastuser, tt.thread_lastpost,
tt.thread_poll, tf.forum_id, tf.forum_name, tf.forum_access, tt.thread_lastpostid, tt.thread_postcount, tu.user_id, tu.user_avatar, tu.user_name,
tu.user_status
FROM ".DB_THREADS." tt
INNER JOIN ".DB_FORUMS." tf ON tt.forum_id=tf.forum_id
INNER JOIN ".DB_USERS." tu ON tt.thread_lastuser=tu.user_id
WHERE ".groupaccess('tf.forum_access'
." AND tt.thread_lastpost >= ".$timeframe." AND tt.thread_hidden='0'
ORDER BY tt.thread_lastpost DESC LIMIT 0,10"
;
if (dbrows($result)) {
openside("New posts"
;
$counter = 1; $columns = 2;
echo" <table width='100%' border='0' cellpadding='0' cellspacing='0' id='table-mneniq'>";
while ($data = dbarray($result)) {
echo "<tr>";
if ($counter == "1"
{ } else { echo "<td colspan='2' style='height:1px;background-color:#b8bcc5;'></td></tr><tr>";}
if ($data['user_avatar'] && file_exists(IMAGES."avatars/".$data['user_avatar'])) {
$avatar = "<img src='".IMAGES."avatars/".$data['user_avatar']."' alt='Avatar' width='34' style='vertical-align:middle;background:#FFF;border:1px solid #e4e8e9;border-collapse:separate;' height='34'/>\n";
} else {
$avatar = "<img src='http://www.dimitech.eu/images/avatars/noavatar100.png' alt='' style='vertical-align:middle;background:#FFF;border:1px solid #e4e8e9;border-collapse:separate;' width='34' height='34' />";
}
$padding="padding-top:3px;padding-bottom:3px;"; if ($counter == "1"
{ $padding= "padding-bottom:3px;"; } else { }
$otgovor = "posts";
if (($data['thread_postcount']-1)==1) { $otgovor = "post"; }
echo"
<td width='12' style='".$padding."padding-right:2px;vertical-align:middle;' valign='middle' align='right'><a href='".BASEDIR."profile.php?lookup=".$data['thread_lastuser']."' title='".$data['user_name']."'>".$avatar."</a></td>
<td style='".$padding."vertical-align:middle;' width='100%' align='left'>
<img src='".$cdn."images/bullet.gif' border='0' style='padding-left:2px;vertical-align:middle;' alt='-'/> <a href='".FORUM."viewthread.php?thread_id=".$data['thread_id']."&pid=".$data['thread_lastpostid']."#post_".$data['thread_lastpostid']."' title='".$data['thread_subject']."'><span style='font-size:13px;font-weight:bold;'>".trimlink($data['thread_subject'], 36)."</span></a>
<br/><img src='".$cdn."images/downloads.gif' alt='-' style='vertical-align:middle;' /><span style='font-size:10px;'> ".($data['thread_postcount']-1)." <span class='info_text'>".$otgovor.", last: </span>".profile_link($data['thread_lastuser'], $data['user_name'], $data['user_status'])."</span></td>
</tr>";
$counter++;
}
echo "</table>";
closeside();
}
?>[/syntaxhighlighter]
Merged on Jun 02 2012 at 12:58:14:
code for Latest posts:
[syntaxhighlighter brush=php,first-line=1,highlight=0,collapse=false,html-script=false]openside("Latest posts"
;
echo "<table width='100%' cellspacing='0' cellpadding='0'>";
echo "<tr><td class='forum-caption'></td></tr>";
$result = dbquery("
SELECT tt.*, tf.*, u.user_name FROM " . DB_THREADS . " tt
INNER JOIN " . DB_FORUMS . " tf ON tt.forum_id=tf.forum_id
INNER JOIN " . DB_USERS . " u ON tt.thread_lastuser=u.user_id
WHERE " . groupaccess('tf.forum_access'
. "
ORDER BY thread_lastpost DESC LIMIT 5
"
;
if (dbrows($result))
{
$count = 1;
while ($data = dbarray($result))
{
$class = ($count % 2 == 0 ? "tbl1" : "tbl1"
;
$itemsubject = trimlink($data['thread_subject'], 50);
echo "<tr><td class='{$class}'>";
echo "<a href='viewthread.php?thread_id=" . $data['thread_id'] . "'>{$itemsubject}</a><br />";
echo "<small>by: " . profile_link($data['thread_lastuser'], $data['user_name'], "0", ""
. "<br />";
echo ago($data['thread_lastpost']);
echo "</small></td></tr>";
echo"<tr><td style='height:1px;background-color:#ccc' colspan='6'></td></tr>";
$count++;
}
}
echo "</table>";
closeside();[/syntaxhighlighter]
Merged on Jun 02 2012 at 12:59:03:
code for Top 5 posters:
[syntaxhighlighter brush=php,first-line=1,highlight=0,collapse=false,html-script=false]openside("Top 5 posters"
;
echo "<table width='100%' cellspacing='0' cellpadding='0'>";
$result = dbquery("SELECT * FROM " . DB_USERS .
" WHERE user_posts != 0 AND user_status !=6 AND user_status !=5 ORDER BY user_posts DESC LIMIT 5
"
;
if (dbrows($result))
{
$count = 1;
while ($data = dbarray($result))
{
$class = ($count % 2 == 0 ? "tbl1" : "tbl1"
;
$fcount = dbcount("(thread_author)", DB_THREADS, "thread_author='".$data['user_id']."'"
;
echo "<tr><td class='{$class}'>";
// echo "<div style='float:right;'>#{$count}</div>";
if (!empty($data['user_avatar']) && file_exists(IMAGES."avatars/".$data['user_avatar'])) {
echo "<img src='".IMAGES."avatars/".$data['user_avatar']."' alt='' align='left' style='width:40px; height:40px; padding-right:6px;' /> \n";
} else {
echo "<img src='".IMAGES."avatars/noavatar100.png' alt='' align='left' style='width:40px; height:40px; padding-right:6px;' /> \n";
}
echo profile_link($data['user_id'], $data['user_name'], $data['user_status']);
echo "<br /><small>".number_format($data['user_posts'])." posts<br />";
echo "". number_format($fcount)." threads</small>";
echo "</td></tr>";
echo"<tr><td style='height:1px;background-color:#ccc' colspan='6'></td></tr>";
$count++;
}
}
echo "</table>";
closeside();[/syntaxhighlighter]