W includes/functions.php znajdż :
Kod:
function top_posters($str_input, $show_admin, $show_mod)
{
global $db, $phpEx, $theme;
// Show All
if ( ( $show_admin == '1' ) && ( $show_mod == '1' ) )
{
$sql = "SELECT u.user_id, u.username, u.user_posts, u.user_level, count(u.user_id) as user_posts
FROM " . USERS_TABLE . " u, " . POSTS_TABLE . " p
WHERE (u.user_id <> " . ANONYMOUS . ") AND (u.user_id = p.poster_id)
GROUP BY user_id, username
ORDER BY user_posts DESC
LIMIT $str_input";
}
// Show Admin But Not Moderators
elseif ( ( $show_admin == '1' ) && ( $show_mod == '0' ) )
{
$sql = "SELECT u.user_id, u.username, u.user_posts, u.user_level, count(u.user_id) as user_posts
FROM " . USERS_TABLE . " u, " . POSTS_TABLE . " p
WHERE (u.user_id <> " . ANONYMOUS . ") AND (u.user_id = p.poster_id) AND (u.user_level != " . MOD . ")
GROUP BY user_id, username
ORDER BY user_posts DESC
LIMIT $str_input";
}
// Show Moderators But Not Admins
elseif ( ( $show_admin == '0' ) && ( $show_mod == '1' ) )
{
$sql = "SELECT u.user_id, u.username, u.user_posts, u.user_level, count(u.user_id) as user_posts
FROM " . USERS_TABLE . " u, " . POSTS_TABLE . " p
WHERE (u.user_id <> " . ANONYMOUS . ") AND (u.user_id = p.poster_id) AND (u.user_level != " . ADMIN . ")
GROUP BY user_id, username
ORDER BY user_posts DESC
LIMIT $str_input";
}
// Show Neither Admins Nor Moderators
else/// ( ( $show_admin == '0' ) && ( $show_mod == '0' ) )
{
$sql = "SELECT u.user_id, u.username, u.user_posts, u.user_level, count(u.user_id) as user_posts
FROM " . USERS_TABLE . " u, " . POSTS_TABLE . " p
WHERE (u.user_id <> " . ANONYMOUS . ") AND (u.user_id = p.poster_id) AND (u.user_level != " . ADMIN . ") AND (u.user_level != " . MOD . ")
GROUP BY user_id, username
ORDER BY user_posts DESC
LIMIT $str_input";
}
//
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not query forum top poster information', '', __LINE__, __FILE__, $sql);
}
// $top_posters = array();
while( $row = $db->sql_fetchrow($result) )
{
$style_color = '';
if ( $row['user_level'] == ADMIN )
{
$row['username'] = '<b>' . $row['username'] . '</b>';
$style_color = 'style="color:#' . $theme['fontcolor3'] . '"';
}
else if ( $row['user_level'] == MOD )
{
$row['username'] = '<b>' . $row['username'] . '</b>';
$style_color = 'style="color:#' . $theme['fontcolor2'] . '"';
}
$top_posters .= '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=" . $row['user_id']) . '"' . $style_color .'>' . $row['username'] . '</a>(' . $row['user_posts'] . '), ';
}
return $top_posters;
}
zamień na:
Kod:
function top_posters($str_input, $show_admin, $show_mod)
{
global $db, $phpEx, $theme;
// Show All
if ( ( $show_admin == '1' ) && ( $show_mod == '1' ) )
{
$sql = "SELECT u.user_id, u.username, u.user_posts, u.user_level, u.user_rank, count(u.user_id) as user_posts
FROM " . USERS_TABLE . " u, " . POSTS_TABLE . " p
WHERE (u.user_id <> " . ANONYMOUS . ") AND (u.user_id = p.poster_id)
GROUP BY user_id, username
ORDER BY user_posts DESC
LIMIT $str_input";
}
// Show Admin But Not Moderators
elseif ( ( $show_admin == '1' ) && ( $show_mod == '0' ) )
{
$sql = "SELECT u.user_id, u.username, u.user_posts, u.user_level, u.user_rank, count(u.user_id) as user_posts
FROM " . USERS_TABLE . " u, " . POSTS_TABLE . " p
WHERE (u.user_id <> " . ANONYMOUS . ") AND (u.user_id = p.poster_id) AND (u.user_level != " . MOD . ")
GROUP BY user_id, username
ORDER BY user_posts DESC
LIMIT $str_input";
}
// Show Moderators But Not Admins
elseif ( ( $show_admin == '0' ) && ( $show_mod == '1' ) )
{
$sql = "SELECT u.user_id, u.username, u.user_posts, u.user_level, u.user_rank, count(u.user_id) as user_posts
FROM " . USERS_TABLE . " u, " . POSTS_TABLE . " p
WHERE (u.user_id <> " . ANONYMOUS . ") AND (u.user_id = p.poster_id) AND (u.user_level != " . ADMIN . ")
GROUP BY user_id, username
ORDER BY user_posts DESC
LIMIT $str_input";
}
// Show Neither Admins Nor Moderators
else/// ( ( $show_admin == '0' ) && ( $show_mod == '0' ) )
{
$sql = "SELECT u.user_id, u.username, u.user_posts, u.user_level, u.user_rank, count(u.user_id) as user_posts
FROM " . USERS_TABLE . " u, " . POSTS_TABLE . " p
WHERE (u.user_id <> " . ANONYMOUS . ") AND (u.user_id = p.poster_id) AND (u.user_level != " . ADMIN . ") AND (u.user_level != " . MOD . ")
GROUP BY user_id, username
ORDER BY user_posts DESC
LIMIT $str_input";
}
//
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not query forum top poster information', '', __LINE__, __FILE__, $sql);
}
// $top_posters = array();
while( $row = $db->sql_fetchrow($result) )
{
$username = color_username($row['user_id'],$row['username'],$row['user_rank'],$row['user_posts']);
$top_posters .= '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=" . $row['user_id']) . '">' . $username . '</a>(' . $row['user_posts'] . '), ';
}
return $top_posters;
}
Autor postu otrzymał pochwałę
Sennik - interpretacja snów!, Laliki - moje miejsce!