
Kod: Tümünü seç
#
#-----[ AÇ ]-----
#
includes/functions_color_groups.php
#
#-----[ BUL ]-----
#
function color_group_colorize_name($user_id, $no_profile = false)
{
global $board_config, $phpEx, $db, $phpbb_root_path;
static $cacheUsers;
// First see if the user is Anon
if ($user_id != ANONYMOUS)
{
if (!isset($cacheUsers[$user_id]))
{
// Get the user info and see if they are assigned a color_group //
$sql = 'SELECT u.user_color_group, u.username, c.* FROM ' . USERS_TABLE . ' u, ' . COLOR_GROUPS_TABLE . " c
WHERE u.user_id = $user_id
AND u.user_color_group = c.group_id";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
if (!isset($row['username']))
{
//If there was a problem before, we don't want a blank username!
$sql = 'SELECT username FROM ' . USERS_TABLE . "
WHERE user_id = $user_id";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
}
$cacheUsers[$user_id]['username'] = $row['username'];
if (isset($row['group_color']))
{
// WE found the highest level color, head out now //
$cacheUsers[$user_id]['group_color'] = stripslashes($row['group_color']);
}
else
{
// Now start looking for user group memberships //
$sql = 'SELECT c.* FROM ' . USER_GROUP_TABLE . ' ug, ' . USERS_TABLE . ' u, ' . COLOR_GROUPS_TABLE . ' c, ' . GROUPS_TABLE . ' g
WHERE ug.user_id = ' . $user_id . '
AND u.user_id = ug.user_id
AND ug.group_id = g.group_id
AND g.group_color_group = c.group_id
AND g.group_single_user = 0
ORDER BY c.order_num ASC LIMIT 1';
//print $sql;
$result = $db->sql_query($sql);
$curr = 10000000000000;
$style_color = '';
while ($row = $db->sql_fetchrow($result))
{
// If our new group in the list is a higher order number, it's color takes precedence //
if ($row['order_num'] < $curr)
{
$curr = $row['order_num'];
$cacheUsers[$user_id]['group_color'] = stripslashes($row['group_color']);
}
}
}
}
$style_color = 'style="font-weight:bold;color:' . $cacheUsers[$user_id]['group_color'] . '"';
$username = $cacheUsers[$user_id]['username'];
// Make the profile link or no and return it //
if ($no_profile)
{
$user_link = "<span $style_color>$username</span>";
}
else
{
$user_link = '<a href="' . append_sid($phpbb_root_path."profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=$user_id") . '"' . $style_color .'>' . $username . '</a>';
}
return($user_link);
}
else
{
return false;
}
}
#
#-----[ BUNUNLA DEGISTIR ]-----
#
function color_group_colorize_name($user_id, $no_profile = false)
{
global $board_config, $phpEx, $db, $phpbb_root_path, $colorusers, $coloruname, $colorgroup;
// First see if the user is Anon
if ($user_id != ANONYMOUS)
{
$username = $coloruname[$user_id];
if ( $colorusers[$user_id] != 0 )
{
// Get the user info and see if they are assigned a color_group //
$sql = 'SELECT u.user_color_group, u.username, c.* FROM ' . USERS_TABLE . ' u, ' . COLOR_GROUPS_TABLE . " c
WHERE u.user_id = $user_id
AND u.user_color_group = c.group_id";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
}
if (isset($row['group_color']))
{
// WE found the highest level color, head out now //
$style_color = 'style="font-weight:bold;color:' . $row['group_color'] . '"';
}
else
{
if ( in_array($user_id, $colorgroup) )
{
// Now start looking for user group memberships //
$sql = 'SELECT c.* FROM ' . USER_GROUP_TABLE . ' ug, ' . USERS_TABLE . ' u, ' . COLOR_GROUPS_TABLE . ' c, ' . GROUPS_TABLE . ' g
WHERE ug.user_id = ' . $user_id . '
AND u.user_id = ug.user_id
AND ug.group_id = g.group_id
AND g.group_color_group = c.group_id
AND g.group_single_user = 0';
//print $sql;
$result = $db->sql_query($sql);
$curr = 10000000000000;
$style_color = '';
while ($row = $db->sql_fetchrow($result))
{
// If our new group in the list is a higher order number, it's color takes precedence //
if ($row['order_num'] < $curr)
{
$curr = $row['order_num'];
$style_color = 'style="font-weight:bold;color:' . $row['group_color'] . '"';
}
}
}
}
// Make the profile link or no and return it //
if ($no_profile)
{
$user_link = "<span $style_color>$username</span>";
}
else
{
$user_link = '<a href="' . append_sid($phpbb_root_path."profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=$user_id") . '"' . $style_color .'>' . $username . '</a>';
}
return($user_link);
}
else
{
$username = $coloruname[$user_id];
if ($no_profile)
{
$user_link = "<span $style_color>$username</span>";
}
else
{
$user_link = '<a href="' . append_sid($phpbb_root_path."profile.php?mode=viewprofile&" . POST_USERS_URL . "=$user_id") . '"' . $style_color .'>' . $username . '</a>';
}
return $username;
}
}
#
#-----[ AÇ ]-----
#
common.php
#
#-----[ BUL ]-----
#
//
// Show 'Board is disabled' message if needed.
//
#
#-----[ ÖNCESINE EKLE ]-----
#
$sql = "SELECT user_id, user_color_group, username FROM " . USERS_TABLE;
if( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not read user color groups', '', __LINE__, __FILE__, $sql);
}
$colorusers = array();
$coloruname = array();
while ( $row = $db->sql_fetchrow($result) )
{
$userid = $row['user_id'];
$colorusers[$userid] = $row['user_color_group'];
$coloruname[$userid] = $row['username'];
}
$colorgroup = array();
$sql = "SELECT ug.user_id FROM " . USER_GROUP_TABLE . " ug, " . GROUPS_TABLE . " g
WHERE g.group_single_user = 0
AND g.group_id = ug.group_id
GROUP BY ug.user_id
ORDER BY ug.user_id";
if( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not read user color groups', '', __LINE__, __FILE__, $sql);
}
while ( $row = $db->sql_fetchrow($result) )
{
$colorgroup[] = $row['user_id'];
}
#
#-----[ TÜM DOSYALARI KAPAT/KAYDET ]-----
#
SoN