View Single Post
  #1  
Old 29th November 2018, 17:07
Napon Napon is offline
Banned
 
Join Date: Feb 2016
P2P
Posts: 522
Thumbs up Browse & details Anonymous Colours
So here we go


@include torrenttable


we need to add the class Colours you will need to change this part to


Code:
if ($variant == "index")
if ($row['anonymous'] == 'yes') {
    $htmlout.= "<td align='center'>
    ".(isset($row["username"]) ? (($row["anonymous"] == "yes" && $CURUSER['class'] < UC_STAFF && $row['owner'] != $CURUSER['id']) ? "&nbsp;<i>".$lang['torrenttable_anon']."</i>" : "<b><font color='#" . get_user_class_color($row['class']) . "'> " . htmlspecialchars($row['username']) . "</b></a>") : "<i>(".$lang["torrenttable_unknown_uploader"].")</i>") . "
    </td>\n";
    }else{
    $htmlout .= "<td align='center'>
    " . (isset($row["username"]) ? ("<a href='userdetails.php?id=" . $row["owner"] . "'><b><font color='#" . get_user_class_color($row['class']) . "'> " . htmlspecialchars($row['username']) . "</b></a>") : "<i>(".$lang["torrenttable_unknown_uploader"].")</i>") . "
    </td>\n";
}
Now @browse.php


Find


Code:
users.username,
Add so it looks like this



Code:
users.username, users.class FROM
@details.php change too
@ the query add



Code:
torrents.anonymous,
Also so it looks like this


Code:
users.username, users.class FROM
Change too



Code:
if ($row['anonymous'] == 'yes')
    $uprow = "<i>Anonymous</i>";
    $uprow = (isset($row["username"]) ? (($row["anonymous"] == "yes" && $CURUSER['class'] < UC_STAFF && $row['owner'] != $CURUSER['id']) ? "&nbsp;<i>".$lang['details_anon']."</i>" : "<b><font color='#" . get_user_class_color($row['class']) . "'> " . htmlspecialchars($row['username']) . "</b></a>") : "<i>{$lang['details_unknown']}</i>");
  if ($owned)
Now for UC_STAFF

@include
@config.php




Before the End Tag Replace with


Code:
define ('UC_USER', 0);
define ('UC_POWER_USER', 1);
define ('UC_VIP', 2);
define ('UC_UPLOADER', 3);
define ('UC_MODERATOR', 4);
define ('UC_ADMINISTRATOR', 5);
define ('UC_SYSOP', 6);
define('UC_MIN', 0);
define('UC_MAX', 6);
define('UC_STAFF', 4);
Now @user_functions.php


Replace with


Code:
function get_user_class(){
global $CURUSER;
    return $CURUSER["class"];
}
$class_names = array(
    UC_USER                 => 'User',
    UC_POWER_USER           => 'Power User',
    UC_VIP                  => 'VIP',
    UC_UPLOADER             => 'Uploader',
    UC_MODERATOR            => 'Moderator',
    UC_ADMINISTRATOR        => 'Administrator',
    UC_SYSOP                => 'SysOp');
$class_colors = array(
    UC_USER                 => '8E35EF',
    UC_POWER_USER           => 'f9a200',
    UC_VIP                  => '009F00',
    UC_UPLOADER             => '0000FF',
    UC_MODERATOR            => 'FE2E2E',
    UC_ADMINISTRATOR        => 'B000B0',
    UC_SYSOP                => '4080B0');
$class_images = array(
    UC_USER                 => $TBDEV['pic_base_url'].'class/user.png',
    UC_POWER_USER           => $TBDEV['pic_base_url'].'class/power_user.png',
    UC_VIP                  => $TBDEV['pic_base_url'].'class/vip.png',
    UC_UPLOADER             => $TBDEV['pic_base_url'].'class/uploader.png',
    UC_MODERATOR            => $TBDEV['pic_base_url'].'class/moderator.png',
    UC_ADMINISTRATOR        => $TBDEV['pic_base_url'].'class/admin.png',
    UC_SYSOP                => $TBDEV['pic_base_url'].'class/sysop.png');
function get_user_class_name($class) {
global $class_names;
    $class = (int)$class;
if (!valid_class($class))
    return '';
if (isset($class_names[$class]))
    return $class_names[$class];
    else
    return '';
}
function get_user_class_color($class) {
global $class_colors;
    $class = (int)$class;
if (!valid_class($class))
    return '';
if (isset($class_colors[$class]))
    return $class_colors[$class];
    else
    return '';
}
function get_user_class_image($class) {
global $class_images;
    $class = (int)$class;
if (!valid_class($class))
    return '';
if (isset($class_images[$class]))
    return $class_images[$class];
    else
    return '';
}
function valid_class($class) {
    $class = (int)$class;
    return (bool)($class >= UC_MIN && $class <= UC_MAX);
}
function min_class($min = UC_MIN, $max = UC_MAX) {
global $CURUSER;
    $minclass = (int)$min;
    $maxclass = (int)$max;
if (!isset($CURUSER))
    return false;
if (!valid_class($minclass) || !valid_class($maxclass))
    return false;
if ($maxclass < $minclass)
    return false;
    return (bool)($CURUSER['class'] >= $minclass && $CURUSER['class'] <= $maxclass);
}
function is_valid_user_class($class){
  return is_numeric($class) && floor($class) == $class && $class >= UC_USER && $class <= UC_SYSOP;
}
now @userdetails.php


Replace for user bars class


Code:
    $HTMLOUT .= "<tr><td class='rowhead'>{$lang['userdetails_class']}</td>
    <td class='col1' align='left'>
    <img src=" . get_user_class_image($user["class"]) . " " . get_user_class_name($user["class"]) . "</td></tr>\n";
     $HTMLOUT .= "<tr>
now every tbdev site will have this mod so good luck all my mod i made easy for class Colours


And thanks to bigjoos for the function get_user_class

Just a side Note this will also work on u232 v1 v2 v3 v4 and v5
Attached Files
File Type: rar class.rar (58.4 KB, 3 views)

Last edited by Napon; 30th November 2018 at 00:33.
Reply With Quote
The Following User Says Thank You to Napon For This Useful Post:
elvira (29th November 2018)