Login
Username: Password:
Remember me

[Sign Up] / [Recover Password]

Theme / Language

Popular
New Torrents
new name
Size: 18.40 MB
Most active
new name
S: 74 L: 3
New Posters
Class Colors Function for 2.08
Controls ·  Search New posts · Mark unread

You are in: Forum / Forum / v2.08 / v2.08 Mods Completed

Unknown User
2013-08-29 00:34:07
Hmm, that breaks user names from displaying, no worires tho.. I have just adjusted the ".shoutUser a" sty;e atribute to make suer names bold, and have underline, etc in chat. Thx for help..
Unknown User
2013-08-29 00:39:57
oh i see i think

  if ($classy[0]==7)
 return unesc('<span style="color:'.$col.'; text-shadow: 1px #3520fd;">'.$name.'</span>'.$star.''.$warn.''.$disabled.'');
 elseif ($classy[0]==6)
 return unesc('<span style="color:'.$col.'; text-shadow: 1px #3520fd;">'.$name.'</span>'.$star.''.$warn.''.$disabled.'');
 else
 return unesc("<font color='".$col."'>".$name."".$star."".$warn."".$disabled."</font>");

if you really want then can make classes in css lol but that way beyond me
Unknown User
2014-07-27 08:36:50
I've moved the definition of the colors to the CSS, which allows to asign different colours depending on the Theme (e.g. Dark or Light Theme as well as other styles (bold, underline, font ...).

In addition, I've added a "title" to the element, which takes the translation of the user class from the language files and will show when the mose hover the user name. So for example it will show "Member" with English language and "Membre" with french language.

Here my code example.

In backend/functions.php

case 1: // Member
$col = "member"; $title = T_("MEMBER");
break;

and

return unesc("<span class='".$col."' title='".$title."'>".$name."".$star."".$warn."".$disabled."</span>");

in the CSS for the class:

.member {
color: #00AA00; /* Green */
}

Which in my case just defines a colour (I've tried a loat with shadows to enhance contrast, but the results were not satisfying. CSS experts certainly can make a lot with that).

Finally I want to express a big thank you to the contributors here MVP, BigMax, Tiloup, TorrentialStorm, ArcticWolf and all those I've forgotten to name, which with their modifications allow me to adapt my site to what I've in mind for it. I'm currently in the middle of it and as a side effect learn PHP (the trial, error, google, correct, ... way).
Unknown User
2014-12-17 04:13:34
I'm missing it - just want to put shoutbox in color, and don't know how.

TT-svn

modded shoutbox

this line I think:


echo    '</td><td style="font-size: 12px; padding-left: 5px"><a href="'.$site_config['SITEURL'].'/account-details.php?id='.$row['userid'].'" target="_parent"><b>'.$row['user'].':</b></a>&nbsp;&nbsp;'.nl2br(format_comment($row['message']));
Unknown User
2014-12-17 15:23:30
read and follow the 1st post!! then once you have a class_user function change

$row['user']
to


class_user($row['user'])
Unknown User
2014-12-18 02:17:50
Thanks for the help ArticWolf - tried it - followed 1st post and changed:

$row['user']

to

class_user($row['user'])

and still have no luck - played around with the code for 5 hours with no luck


<?php
//
//  TorrentTrader v2.x
//      $LastChangedDate: 2012-06-14 17:31:26 +0100 (Thu, 14 Jun 2012) $
//      $LastChangedBy: torrenttrader $
//
//      http://www.torrenttrader.org
//
//
require_once("backend/functions.php");
dbconn();

if ($site_config['SHOUTBOX']){

//DELETE MESSAGES
if (isset($_GET['del'])){

if (is_numeric($_GET['del'])){
$query = "SELECT * FROM shoutbox WHERE msgid=".$_GET['del'] ;
$result = SQL_Query_exec($query);
}else{
echo "invalid msg id STOP TRYING TO INJECT SQL";
exit;
}

$row = mysql_fetch_row($result);

if ($row && ($CURUSER["edit_users"]=="yes" || $CURUSER['username'] == $row[1])) {
$query = "DELETE FROM shoutbox WHERE msgid=".$_GET['del'] ;
write_log("<b><font color='orange'>Shout Deleted: </font> Deleted by   ".$CURUSER['username']."</b>");
SQL_Query_exec($query);
}
}

//INSERT MESSAGE
if (!empty($_POST['message']) && $CURUSER) {
$_POST['message'] = sqlesc($_POST['message']);
$query = "SELECT COUNT(*) FROM shoutbox WHERE message=".$_POST['message']." AND user='".$CURUSER['username']."' AND UNIX_TIMESTAMP('".get_date_time()."')-UNIX_TIMESTAMP(date) < 30";
$result = SQL_Query_exec($query);
$row = mysql_fetch_row($result);

if ($row[0] == '0') {
$query = "INSERT INTO shoutbox (msgid, user, message, date, userid) VALUES (NULL, '".$CURUSER['username']."', ".$_POST['message'].", '".get_date_time()."', '".$CURUSER['id']."')";
SQL_Query_exec($query);
}
}

//GET CURRENT USERS THEME AND LANGUAGE
if ($CURUSER){
$ss_a = @mysql_fetch_assoc(@SQL_Query_exec("select uri from stylesheets where id=" . $CURUSER["stylesheet"]));
if ($ss_a)
$THEME = $ss_a["uri"];
}else{//not logged in so get default theme/language
$ss_a = mysql_fetch_assoc(SQL_Query_exec("select uri from stylesheets where id='" . $site_config['default_theme'] . "'"));
if ($ss_a)
$THEME = $ss_a["uri"];
}

if(!isset($_GET['history'])){
?>
<html>
<head>
<title><?php echo $site_config['SITENAME'] . T_("SHOUTBOX"); ?></title>
<?php /* If you do change the refresh interval, you should also change index.php printf(T_("SHOUTBOX_REFRESH"), 5) the 5 is in minutes */ ?>
<meta http-equiv="refresh" content="120" />
<link rel="stylesheet" type="text/css" href="<?php echo $site_config['SITEURL']?>/themes/<?php echo $THEME; ?>/theme.css" />
<script type="text/javascript" src="<?php echo $site_config['SITEURL']; ?>/backend/java_klappe.js"></script>
</head>
<body class="shoutbox_body">
<?php
echo '<div class="shoutbox_contain"><table border="0" style="width: 99%; table-layout:fixed">';
}else{
   
   if ($site_config["MEMBERSONLY"]) {
       loggedinonly();
   }
   
stdhead();
begin_frame(T_("SHOUTBOX_HISTORY"));
echo '<div class="shoutbox_history">';

$query = 'SELECT COUNT(*) FROM shoutbox';
$result = SQL_Query_exec($query);
$row = mysql_fetch_row($result);
echo '<div align="center">Pages: ';
$pages = round($row[0] / 100) + 1;
$i = 1;
while ($pages > 0){
echo "<a href='".$site_config['SITEURL']."/shoutbox.php?history=1&amp;page=".$i."'>[".$i."]</a>&nbsp;";
$i++;
$pages--;
}

echo '</div><br /><table border="0" style="width: 99%; table-layout:fixed">';
}

if (isset($_GET['history'])) {
if (isset($_GET['page'])) {
if($_GET['page'] > '1') {
$lowerlimit = $_GET['page'] * 100 - 100;
$upperlimit = $_GET['page'] * 100;
}else{
$lowerlimit = 0;
$upperlimit = 100;
}
}else{
$lowerlimit = 0;
$upperlimit = 100;
}
$query = 'SELECT * FROM shoutbox ORDER BY msgid DESC LIMIT '.$lowerlimit.','.$upperlimit;
}else{
$query = 'SELECT * FROM shoutbox ORDER BY msgid DESC LIMIT 40';
}
if ($CURUSER) {
//check for new pm's
$res = SQL_Query_exec("SELECT COUNT(*) FROM messages WHERE receiver=" . $CURUSER["id"] . " and unread='yes' AND location IN ('in','both')");
$arr = mysql_fetch_row($res);
$unreadmail = $arr[0];
if ($unreadmail)
print("<font color='#ff0000' size='3'><b><center><blink>You Got A New PM </font>[<a href='mailbox.php?inbox' target='_blank'>$unreadmail</a>]</blink></center></b></a></font>&nbsp;&nbsp;");
}


$result = SQL_Query_exec($query);
$alt = false;

while ($row = mysql_fetch_assoc($result)) {
if ($alt){
echo '<tr class="shoutbox_noalt">';
$alt = false;
}else{
echo '<tr class="shoutbox_alt">';
$alt = true;
}

echo '<td style="font-size: 9px; width: 118px;">';
echo "<div align='left' style='float: left'>";

echo date('jS M, g:ia', utc_to_tz_time($row['date']));


echo "</div>";

if ( ($CURUSER["edit_users"]=="yes") || ($CURUSER['username'] == class_user($row['user'])) ){
echo "<div align='right' style='float: right'><a href='".$site_config['SITEURL']."/shoutedit.php?action=edit&msgid=".$row['msgid']."' style='font-size: 8px'>[E]</a>&nbsp;&nbsp;<a href='".$site_config['SITEURL']."/shoutbox.php?del=".$row['msgid']."' style='font-size: 8px'>[D]</a><div>";
}

echo '</td><td style="font-size: 12px; padding-left: 5px"><a href="'.$site_config['SITEURL'].'/account-details.php?id='.$row['userid'].'" target="_parent"><b>'.class_user($row['user']).':</b></a>&nbsp;&nbsp;'.nl2br(format_comment($row['message']));
echo '</td></tr>';
}
?>

</table>
</div>
<br />

<?php

//if the user is logged in, show the shoutbox, if not, dont.
if(!isset($_GET['history'])) {
if (isset($_COOKIE["pass"])){
echo "<form name='shoutboxform' action='shoutbox.php' method='post'>";
echo "<center><table width='100%' border='0' cellpadding='1' cellspacing='1'>";
echo "<tr class='shoutbox_messageboxback'>";
echo "<td width='75%' align='center'>";
echo "<input type='text' name='message' class='shoutbox_msgbox' />";
echo "</td>";
echo "<td>";
echo "<input type='submit' name='submit' value='".T_("SHOUT")."' class='shoutbox_shoutbtn' />";
echo "</td>";
echo "<td>";
       echo '<a href="javascript:PopMoreSmiles('shoutboxform', 'message');"><small>'.T_("MORE_SMILIES").'</small></a>';
       echo ' <small>-</small> <a href="javascript:PopMoreTags();"><small>'.T_("TAGS").'</small></a>';
echo "<br />";
echo "<a href='shoutbox.php'><small>".T_("REFRESH")."</small></a>";              
echo " <small>-</small> <a href='".$site_config['SITEURL']."/shoutbox.php?history=1' target='_blank'><small>".T_("HISTORY")."</small></a>";
echo "</td>";
echo "</tr>";
echo "</table></center>";
echo "</form>";
}else{
echo "<br /><div class='shoutbox_error'>".T_("SHOUTBOX_MUST_LOGIN")."</div>";
}
}

if(!isset($_GET['history'])){
echo "</body></html>";
}else{
end_frame();
stdfoot();
}


}//END IF $SHOUTBOX
else{
echo T_("SHOUTBOX_DISABLED");
}
?>

Unknown User
2014-12-18 03:41:56
my only guess is cause 1st post was all messed up with the constant changing of the forums lol..

config.php part was wrong..

Try this, I edited the 1st post to fix the layout issues again...

And in backend/config.php add this code:

// class colors
$site_config['administrator_color'] = '#009AFF'; // Administrator
$site_config['super_moderator_color'] = '#00C000'; // Super Moderator
$site_config['moderator_color'] = '#007F00'; // Moderator
$site_config['uploader_color'] = '#00A49E'; // Uploader
$site_config['vip_color'] = '#7FB600'; // VIP
$site_config['power_user_color'] = '#BD8B00'; // Power User
$site_config['user_color'] = '#856A00'; // User
Unknown User
2014-12-18 05:32:58
A Million Thanks ArticWolf - I'm in color now
Users online

No users online

Search



Statistics

    Torrents

  • Tracking: 3
  • Todays torrents: 0
  • Seeders: 0
  • Leechers: 0
  • Peers: 0
  • Downloaded: 89.96 GB
  • Uploaded: 9.86 GB

  • Members

  • We have: 838
  • New today: 0
  • Guest today: 9

  • Online

  • Total online: 1
  • Members: 0
  • Guests online: 1
  • Comments: 3
  • Messages: 1,728