Links in Color Groups
Forumsregeln
phpBB 2.0 hat das Ende seiner Lebenszeit überschritten
phpBB 2.0 wird nicht mehr aktiv unterstützt. Insbesondere werden - auch bei Sicherheitslücken - keine Patches mehr bereitgestellt. Der Einsatz von phpBB 2.0 erfolgt daher auf eigene Gefahr. Wir empfehlen einen Umstieg auf phpBB 3.0, welches aktiv weiterentwickelt wird und für welches regelmäßig Updates zur Verfügung gestellt werden.
phpBB 2.0 hat das Ende seiner Lebenszeit überschritten
phpBB 2.0 wird nicht mehr aktiv unterstützt. Insbesondere werden - auch bei Sicherheitslücken - keine Patches mehr bereitgestellt. Der Einsatz von phpBB 2.0 erfolgt daher auf eigene Gefahr. Wir empfehlen einen Umstieg auf phpBB 3.0, welches aktiv weiterentwickelt wird und für welches regelmäßig Updates zur Verfügung gestellt werden.
Links in Color Groups
Hallo wollt mal Fragen ob es das schon gibt oder ob es sich machen lässt.
Ich habe in meinem Forum den MOD Color Groups. Ist ja alles gut und schön aber eine Sache stört mich die warscheinlich noch keinem aufgefallen ist: Wenn man auf Mitglieder geht dann sind die verschiedenen User (Admin) (Modertoren) farblich hervorgehoben, wenn man mit der Maus daraufzeigt (Ist ja ein Link zu Profil) dann wird der Name untertrichen, so aber die Linie die das ganze unterstreicht ist nicht in der Farbe wie die Schrift und diese wenn man mit der Maus daraufzeigt sondern die normale Linkfarbe wie bei allen anderen Namen auch. Dies möchte ich gern ändern, sodass wenn der Admin z.B. die Farbe Orange hat das dann auch der unterstrichene Strich in Orange ist.
Das ganze könnt Ihr euch hier anschauen, um es genauer zu verstehen: http://www.sfv-gruiten.de/php/phpBB2/me ... d546ffe1de
Ich habe in meinem Forum den MOD Color Groups. Ist ja alles gut und schön aber eine Sache stört mich die warscheinlich noch keinem aufgefallen ist: Wenn man auf Mitglieder geht dann sind die verschiedenen User (Admin) (Modertoren) farblich hervorgehoben, wenn man mit der Maus daraufzeigt (Ist ja ein Link zu Profil) dann wird der Name untertrichen, so aber die Linie die das ganze unterstreicht ist nicht in der Farbe wie die Schrift und diese wenn man mit der Maus daraufzeigt sondern die normale Linkfarbe wie bei allen anderen Namen auch. Dies möchte ich gern ändern, sodass wenn der Admin z.B. die Farbe Orange hat das dann auch der unterstrichene Strich in Orange ist.
Das ganze könnt Ihr euch hier anschauen, um es genauer zu verstehen: http://www.sfv-gruiten.de/php/phpBB2/me ... d546ffe1de
-
Eoleon
öffne die "functions_color_groups.php"
wenn du gestern alle 3 Teile geändert hast, dann müsste es heut so ausschaun ...
suche
ersetze mit:
jetzt sind die User der Color Groups in der "who is online" mit der jeweiligen Farbe unterstrichen.
suche
ersetze mit
Damit sind die User u.A. in der Memberliste farblich unterstrichen.
suche
ersetze mit
Die User sind jetzt permanent unterstrichen. Du wirst auch im .css nix mehr daran ändern können. Der "hover" ist somit ebenfalls ausgeschaltet.
wenn du gestern alle 3 Teile geändert hast, dann müsste es heut so ausschaun ...
suche
Code: Alles auswählen
if (!function_exists('color_groups_setup_list'))
{
function color_groups_setup_list()
{
global $lang, $template, $db;
$sql = 'SELECT * FROM ' . COLOR_GROUPS_TABLE . '
WHERE hidden = 0
ORDER BY order_num ASC';
if (!$result = $db->sql_query($sql)) message_die(GENERAL_ERROR, $lang['Error_Group_Table'], '', __LINE__, __FILE__, $sql);
$list = '';
while ($row = $db->sql_fetchrow($result))
{
$list .= ' [ <span style="color:' . $row['group_color'] . '">' . $row['group_name'] . '</span> ] ';
}Code: Alles auswählen
if (!function_exists('color_groups_setup_list'))
{
function color_groups_setup_list()
{
global $lang, $template, $db;
$sql = 'SELECT * FROM ' . COLOR_GROUPS_TABLE . '
WHERE hidden = 0
ORDER BY order_num ASC';
if (!$result = $db->sql_query($sql)) message_die(GENERAL_ERROR, $lang['Error_Group_Table'], '', __LINE__, __FILE__, $sql);
$list = '';
while ($row = $db->sql_fetchrow($result))
{
$list .= ' [ <span style="text-decoration: underline;color:' . $row['group_color'] . '">' . $row['group_name'] . '</span> ] ';
}suche
Code: Alles auswählen
// WE found the highest level color, head out now //
$style_color = 'style="color:' . $row['group_color'] . '"';
}Code: Alles auswählen
// WE found the highest level color, head out now //
$style_color = 'style="text-decoration: underline;color:' . $row['group_color'] . '"';
}
suche
Code: Alles auswählen
// 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 = 'color:' . $row['group_color'] . '"';
}Code: Alles auswählen
// 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="text-decoration: underline;color:' . $row['group_color'] . '"';
}Hi,
versuchs mal hiermit:
Öffne die "functions_color_groups.php"
Suche:
Ersetzen mit:
Damit werden die User der einzelnen Farbgruppen in der Statistik in "dicker" Größe angezeigt.
Suche:
Ersetzen mit:
jetzt erscheinen diese User auch im Index in "normaler" Schriftgröße.
Suche:
Ersetzen mit:
Ich hoffe das hilft dir weiter.
Julian
versuchs mal hiermit:
Öffne die "functions_color_groups.php"
Suche:
Code: Alles auswählen
if (!function_exists('color_groups_setup_list'))
{
function color_groups_setup_list()
{
global $lang, $template, $db;
$sql = 'SELECT * FROM ' . COLOR_GROUPS_TABLE . '
WHERE hidden = 0
ORDER BY order_num ASC';
if (!$result = $db->sql_query($sql)) message_die(GENERAL_ERROR, $lang['Error_Group_Table'], '', __LINE__, __FILE__, $sql);
$list = '';
while ($row = $db->sql_fetchrow($result))
{
$list .= ' [ <span style="color:' . $row['group_color'] . '">' . $row['group_name'] . '</span> ] ';
}
Ersetzen mit:
Code: Alles auswählen
if (!function_exists('color_groups_setup_list'))
{
function color_groups_setup_list()
{
global $lang, $template, $db;
$sql = 'SELECT * FROM ' . COLOR_GROUPS_TABLE . '
WHERE hidden = 0
ORDER BY order_num ASC';
if (!$result = $db->sql_query($sql)) message_die(GENERAL_ERROR, $lang['Error_Group_Table'], '', __LINE__, __FILE__, $sql);
$list = '';
while ($row = $db->sql_fetchrow($result))
{
$list .= ' [ <span style="font-weight:bold;color:' . $row['group_color'] . '">' . $row['group_name'] . '</span> ] ';
}
Damit werden die User der einzelnen Farbgruppen in der Statistik in "dicker" Größe angezeigt.
Suche:
Code: Alles auswählen
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);
}
$username = $row['username'];
if (isset($row['group_color']))
{
// WE found the highest level color, head out now //
$style_color = 'style="color:' . $row['group_color'] . '"';
}
Code: Alles auswählen
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);
}
$username = $row['username'];
if (isset($row['group_color']))
{
// WE found the highest level color, head out now //
$style_color = 'style="font-weight:bold;color:' . $row['group_color'] . '"';
}
Suche:
Code: Alles auswählen
// 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 = 'color:' . $row['group_color'] . '"';
}
}
}
Ersetzen mit:
Code: Alles auswählen
// 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'] . '"';
}
}
}
Julian
Hi danke erstmal
aber irgendwie finde ich die sachen nicht in meiner
functions_color_groups.php
Ich denke ich finde die sachen nicht weil ich das danach eingebaut habe!
Reduzierung der Queryanzahl
functions_color_groups.php
functions_color_groups.php
Code: Alles auswählen
<?php
/***************************************************************************
* $RCSfile: functions_color_groups.php,v $
* -------------------
* copyright : (C) 2002-2003 Nivisec.com
* email : support@nivisec.com
*
* $Id: functions_color_groups.php,v 1.3 2003/09/03 02:52:46 nivisec Exp $
*
*
***************************************************************************/
/***************************************************************************
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
***************************************************************************/
if (!defined('IN_PHPBB') || !IN_PHPBB) die('Invalid Function Include, Hacking Attempt?');
define('RGB_COLOR_LIST', 'aqua,black,blue,fuchsia,gray,green,lime,maroon,navy,olive,purple,red,silver,teal,white,yellow');
define('COPYRIGHT_NIVISEC_FORMAT',
'<br /><span class="copyright"><center>
%s
© %s
<a href="http://www.nivisec.com" class="copyright">Nivisec.com</a>.
</center></span>'
);
if (!function_exists('copyright_nivisec'))
{
/**
* @return void
* @desc Prints a sytlized line of copyright for module
*/
function copyright_nivisec($name, $year)
{
printf(COPYRIGHT_NIVISEC_FORMAT, $name, $year);
}
}
if (!function_exists('check_font_color_nivisec'))
{
/**
* @return boolean
* @param item string
* @desc Checks for a valid color entry in the form of one of default words or #rrggbb. Assumes $colors is defined already.
*/
function check_font_color_nivisec($item)
{
global $colors;
//Find out if it's a valid hex or valid word
if (!preg_match("/#[0-9,A-F,a-f]{6}/", $item) && !in_array($item, explode(",", RGB_COLOR_LIST)))
{
return false;
}
//If we get this far, it exists and/or is valid
return true;
}
}
if (!function_exists('find_lang_file_nivisec'))
{
/**
* @return boolean
* @param filename string
* @desc Tries to locate and include the specified language file. Do not include the .php extension!
*/
function find_lang_file_nivisec($filename)
{
global $lang, $phpbb_root_path, $board_config, $phpEx;
if (file_exists($phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . "/$filename.$phpEx"))
{
include_once($phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . "/$filename.$phpEx");
}
elseif (file_exists($phpbb_root_path . "language/lang_english/$filename.$phpEx"))
{
include_once($phpbb_root_path . "language/lang_english/$filename.$phpEx");
}
else
{
message_die(GENERAL_ERROR, "Unable to find a suitable language file for $filename!", '');
}
return true;
}
}
if (!function_exists('set_filename_nivisec'))
{
/**
* @return boolean
* @param filename string
* @param handle string
* @desc Sets the filename to handle in the $template class. Saves typing for me :)
*/
function set_filename_nivisec($handle, $filename)
{
global $template;
$template->set_filenames(array(
$handle => $filename
));
return true;
}
}
if (!function_exists('do_query_nivisec'))
{
/**
* @return void
* @param sql string
* @param $result_list array
* @param error string
* @desc Does $sql query. If error, prints $error and modifies reference $result_list to be a row set
*/
function do_query_nivisec($sql, &$result_list, $error)
{
global $db;
if (!$result = $db->sql_query($sql))
{
message_die(GENERAL_ERROR, $error, '', __LINE__, __FILE__, $sql);
}
$result_list = $db->sql_fetchrowset($result);
}
}
if (!function_exists('do_fast_query_nivisec'))
{
/**
* @return void
* @param sql string
* @param error string
* @desc Does $sql query and doesn't bother with results. If error, prints $error
*/
function do_fast_query_nivisec($sql, $error)
{
global $db;
if (!$db->sql_query($sql))
{
message_die(GENERAL_ERROR, $error, '', __LINE__, __FILE__, $sql);
}
}
}
if (!function_exists('get_color_group_order_max'))
{
function get_color_group_order_max()
{
global $db, $lang;
$sql = 'SELECT max(order_num) as max FROM ' . COLOR_GROUPS_TABLE;
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
return $row['max'];
}
}
if (!function_exists('get_color_group_order_min'))
{
function get_color_group_order_min()
{
global $db, $lang;
$sql = 'SELECT MIN(order_num) as min FROM ' . COLOR_GROUPS_TABLE;
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
return $row['min'];
}}
/**
* @return void
* @param new string
* @param orig string
* @param type int
* @desc Updates user levels of type based on the difference between new and orig string lists
*/
if (!function_exists('color_groups_update_group_id'))
{
function color_groups_update_group_id($group_list, $user_list, $group_id)
{
global $lang, $db, $status_message;
/* Debugging for this function */
$debug = false;
$sql = array();
// Set all old user's and groups to "NO COLOR GROUP" to take care of any deletions //
$sql[] = 'UPDATE ' . USERS_TABLE . "
SET user_color_group = 0
WHERE user_color_group = $group_id";
$sql[] = 'UPDATE ' . GROUPS_TABLE . "
SET group_color_group = 0
WHERE group_color_group = $group_id";
// Set all new list items to have the color group, if we were given a list //
if (!empty($user_list))
{
$sql[] = 'UPDATE ' . USERS_TABLE . "
SET user_color_group = $group_id
WHERE user_id IN ($user_list)";
}
if (!empty($group_list))
{
$sql[] = 'UPDATE ' . GROUPS_TABLE . "
SET group_color_group = $group_id
WHERE group_id IN ($group_list)";
}
// DO the actual SQL commands now //
foreach($sql as $command)
{
if (!$db->sql_query($command))
{
message_die(GENERAL_ERROR, $lang['Error_Group_Table'], '', __LINE__, __FILE__, $sql);
}
}
$status_message .= $lang['Updated_Group'];
}}
if (!function_exists('color_groups_setup_list'))
{
function color_groups_setup_list()
{
global $lang, $template, $db;
$sql = 'SELECT * FROM ' . COLOR_GROUPS_TABLE . '
WHERE hidden = 0
ORDER BY order_num ASC';
if (!$result = $db->sql_query($sql)) message_die(GENERAL_ERROR, $lang['Error_Group_Table'], '', __LINE__, __FILE__, $sql);
$list = '';
while ($row = $db->sql_fetchrow($result))
{
$list .= ' [ <span style="font-weight:bold;color:' . $row['group_color'] . '">' . $row['group_name'] . '</span> ] ';
}
$template->assign_var('COLOR_GROUPS_LIST', $list);
}}
if (!function_exists('color_group_colorize_name'))
{
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;
}
}
}
?>Reduzierung der Queryanzahl
functions_color_groups.php
Code: Alles auswählen
###################################################################################
##
## Ab einer grösseren Anzahl an Usern und eingestellten Farbgruppen kann es zu
## einer sehr hohen Anzahl an Queries (Datenbankabfragen) kommen, was das Board
## verlangsamen könnte.
## Mit der folgenden Änderung kann man die Querieanzahl deutlich verringern.
##
## Autor dieser Änderung/Anpassung: oxpus
##
###################################################################################
#
#-----[ ÖFFNE ]-----
#
# includes/functions_color_groups.php
#
#-----[ FINDE (die komplette Funktion) ]-----
#
function color_group_colorize_name($user_id, $no_profile = false)
{
.
.
.
}
#
#-----[ MIT FOLGENDEM ERSETZEN ]-----
#
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;
}
}
#
#-----[ ÖFFNE ]------------------------------------------
#
# common.php
#
#-----[ FINDE ]------------------------------------------
#
?>
#
#-----[ DARÜBER EINFÜGEN ]------------------------------------------
#
$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'];
}