Example #1
1
/**
 *   http://btdev.net:1337/svn/test/Installer09_Beta
 *   Licence Info: GPL
 *   Copyright (C) 2010 BTDev Installer v.1
 *   A bittorrent tracker source based on TBDev.net/tbsource/bytemonsoon.
 *   Project Leaders: Mindless,putyn.
 **/
function stdhead($title = "", $msgalert = true, $stdhead = false)
{
    global $CURUSER, $TBDEV, $lang, $free, $_NO_COMPRESS, $mc;
    if (!$TBDEV['site_online']) {
        die("Site is down for maintenance, please check back again later... thanks<br />");
    }
    header('Content-Type: text/html; charset=utf-8');
    header('Content-Language content="en-us"');
    if ($title == "") {
        $title = $TBDEV['site_name'] . (isset($_GET['tbv']) ? " (" . TBVERSION . ")" : '');
    } else {
        $title = $TBDEV['site_name'] . (isset($_GET['tbv']) ? " (" . TBVERSION . ")" : '') . " :: " . htmlspecialchars($title);
    }
    if ($CURUSER) {
        $TBDEV['stylesheet'] = isset($CURUSER['stylesheet']) ? "{$CURUSER['stylesheet']}.css" : $TBDEV['stylesheet'];
    }
    if ($TBDEV['msg_alert'] && $msgalert && $CURUSER) {
        $res = sql_query("SELECT count(id) FROM messages WHERE receiver=" . $CURUSER["id"] . " && unread='yes'") or sqlerr(__FILE__, __LINE__);
        $arr = mysql_fetch_row($res);
        $unread = $arr[0];
    }
    /** ZZZZZZZZZZZZZZZZZZZZZZZZZZip it! **/
    if (!isset($_NO_COMPRESS)) {
        if (!ob_start('ob_gzhandler')) {
            ob_start();
        }
    }
    /** include js files needed only for the page being used by pdq **/
    $js_incl = '<!-- javascript goes here or in footer -->';
    if ($stdhead['js'] != false) {
        foreach ($stdhead['js'] as $JS) {
            $js_incl .= "<script type='text/javascript' src='" . $TBDEV['baseurl'] . "/scripts/" . $JS . ".js'></script>";
        }
    }
    $htmlout = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n \t  \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n \t  <html xmlns='http://www.w3.org/1999/xhtml'>\n \t  <head>\n \t\t<meta name='generator' content='TBDev.net' />\n \t\t<meta http-equiv='Content-Language' content='en-us' />\n \t\t<meta http-equiv='Content-Type' content='text/html; charset=utf-8' />\n \t\t<meta name='MSSmartTagsPreventParsing' content='TRUE' />\n    <title>{$title}</title>\n\t  <link rel='stylesheet' href='templates/1/itunes.css' type='text/css' />\n   \t<script type='text/javascript' src='./scripts/jquery.js'></script>\n\t\t<script type='text/javascript' src='image-resize/core-resize.js'></script>\n    <link type='text/css' rel='stylesheet' href='image-resize/resize.css'  />\n\t\t<link rel='alternate' type='application/rss+xml' title='Latest Torrents' href='./rss.php?passkey={$CURUSER['passkey']}' />\n\t\t" . $js_incl . "\n\t\t</head> \n    <body>\n    <div class='itunes'>\n\t  <table class='maincont'>\n\t  <tr><td class='haus' colspan='2'>\n\t  <div class='play'>\n\t  <div class='play1'></div>\n\t  <div class='play3'></div>\n\t  <div class='play2'>{$TBDEV['site_name']}</div>\n\t  </div>\n\t  </td></tr>";
    $htmlout .= StatusBar();
    $htmlout .= "\n\t  <tr valign='top'><td class='hlid'>";
    if ($CURUSER) {
        $htmlout .= "<ul class='nav'>\n\t  <li><a href='index.php'>{$lang['gl_home']}</a></li>\n\t  <li><a href='browse.php'>{$lang['gl_browse']}</a></li>\n\t  <li><a href='upload.php'>{$lang['gl_upload']}</a></li>\n\t  <li><a href='getrss.php'>{$lang['gl_getrss']}</a></li>\n\t  " . (isset($CURUSER) ? "<li><a href='usercp.php'>{$lang['gl_profile']}</a></li>" : "<li><a href='login.php'>{$lang['gl_login']}</a></li><li><a href='signup.php'>{$lang['gl_signup']}</a></li>") . "\n\t  <li><a href='forums.php'>{$lang['gl_forums']}</a></li>\n\t  <li><a href='staff.php'>{$lang['gl_staff']}</a></li>\n\t  <li><a href='contactstaff.php'>{$lang['gl_help']}</a></li>\n\t  <li><a href='donate.php'>{$lang['gl_donate']}</a></li>\n\t  <li><a href='topten.php'>{$lang['gl_top_10']}</a></li>\n\t  <li><a href='catalogue.php'>{$lang['gl_catalogue']}</a></li>\n\t  <li><a href='viewrequests.php'>{$lang['gl_request']}</a></li>\n\t  " . (isset($CURUSER) && $CURUSER['class'] >= UC_MODERATOR ? "<li><a href='staffpanel.php'>{$lang['gl_admin']}</a></li>" : "") . "\n\t  </ul>";
    }
    $htmlout .= "</td><td class='sida' align='center'>";
    //=== free addon start
    if ($CURUSER) {
        if (isset($free)) {
            foreach ($free as $fl) {
                switch ($fl['modifier']) {
                    case 1:
                        $mode = 'All Torrents Free';
                        break;
                    case 2:
                        $mode = 'All Double Upload';
                        break;
                    case 3:
                        $mode = 'All Torrents Free and Double Upload';
                        break;
                    default:
                        $mode = 0;
                }
                $htmlout .= $fl['modifier'] != 0 && $fl['expires'] > TIME_NOW ? '<table width="50%"><tr>
     <td class="colhead" colspan="3" align="center">' . $fl['title'] . '<br />' . $mode . '</td>
   </tr>
   <tr>
     <td width="42" align="center">
     <img src="' . $TBDEV['baseurl'] . '/pic/cat_free.gif" alt="FREE!" /></td>
     <td align="center">' . $fl['message'] . ' set by ' . $fl['setby'] . '<br />' . ($fl['expires'] != 1 ? 'Until ' . get_date($fl['expires'], 'DATE') . ' (' . mkprettytime($fl['expires'] - time()) . ' to go)' : '') . '</td>
     <td width="42" align="center">
     <img src="' . $TBDEV['baseurl'] . '/pic/cat_free.gif" alt="FREE!" /></td>
</tr></table>
<br />' : '';
            }
        }
    }
    //=== free addon end
    //==Temp demotion
    if ($CURUSER['override_class'] != 255 && $CURUSER) {
        $htmlout .= "<table border='0' cellspacing='0' cellpadding='10' bgcolor='green'>\n   <tr><td style='padding: 10px; background: green'><b><a href='./restoreclass.php'>\n   <font color='white'>{$lang['gl_tempdemotion']}</font></a></b></td></tr></table><br />\n";
    }
    //==End
    if ($TBDEV['msg_alert'] && isset($unread) && !empty($unread)) {
        $htmlout .= "<table border='0' cellspacing='0' cellpadding='10' bgcolor='red'>\n                  <tr><td style='padding: 10px; background: red'>\n\n                  <b><a href='./messages.php'><font color='white'>" . sprintf($lang['gl_msg_alert'], $unread) . ($unread > 1 ? "s" : "") . "!</font></a></b>\n                  </td></tr></table><br />\n";
    }
    //==Big red staffmess thingy box:
    if ($TBDEV['staffmsg_alert'] && $CURUSER['class'] >= UC_MODERATOR) {
        $num = mysql_result(sql_query('SELECT count(id) FROM staffmessages WHERE answeredby = 0'), 0);
        if ($num > 0) {
            $htmlout .= "<table border='0' cellspacing='0' cellpadding='10'>\n                  <tr><td style='padding: 10px; background: #ccc'>\n\n                  <b><a href='staffbox.php'>" . sprintf($lang['gl_staffmsg_alert'], $num) . "!</a></b>\n                  </td></tr></table><br />";
        }
    }
    //==End
    //==Big red report thingy box:
    if ($TBDEV['report_alert'] && $CURUSER['class'] >= UC_MODERATOR) {
        $num = mysql_result(sql_query('SELECT COUNT(id) FROM reports WHERE delt_with = 0'), 0);
        if ($num > 0) {
            $htmlout .= "<table border='0' cellspacing='0' cellpadding='10'>\n                  <tr><td style='padding: 10px; background: #ccc'>\n\n                  <b><a href='admin.php?action=reports'>" . sprintf($lang['gl_reportmsg_alert'], $num) . "!</a></b>\n                  </td></tr></table><br />";
        }
    }
    //==End
    //Big red uploadapp thingy box:
    if ($TBDEV['uploadapp_alert'] && $CURUSER['class'] >= UC_MODERATOR) {
        $num = mysql_result(sql_query('SELECT count(id) FROM uploadapp WHERE status = "pending"'), 0);
        if ($num > 0) {
            $htmlout .= "<table border='0' cellspacing='0' cellpadding='10'>\n                  <tr><td style='padding: 10px; background: #ccc'>\n\n                  <b><a href='uploadapps.php'>" . sprintf($lang['gl_uploadapp_alert'], $num) . "!</a></b>\n                  </td></tr></table><br />";
        }
    }
    //==End
    // happy hour
    if ($CURUSER) {
        if (happyHour("check")) {
            $htmlout .= "<table border='0' cellspacing='0' cellpadding='10'  ><tr><td align='center' style=\"background:#CCCCCC;color:#222222; padding:10px\">\n\n        <b>Hey its now happy hour ! " . (happyCheck("check") == 255 ? "Every torrent downloaded in the happy hour is free" : "Only <a href=\"browse.php?cat=" . happyCheck("check") . "\">this category</a> is free this happy hour") . "<br /><font color='red'>" . happyHour("time") . " </font> remaining from this happy hour!</b>";
            $htmlout .= "</td></tr></table><br />\n";
        }
    }
    //==pdq crazyhour
    if (isset($CURUSER)) {
        $transfer_filename = $TBDEV['cache'] . '/transfer_crazyhour.txt';
        $crazyhour_filename = $TBDEV['cache'] . '/crazy_hour.txt';
        $crazyhour_cache = fopen($crazyhour_filename, 'r+');
        $crazyhour_var = fread($crazyhour_cache, filesize($TBDEV['cache'] . '/crazy_hour.txt'));
        fclose($crazyhour_cache);
        $cimg = '<img src=\'' . $TBDEV["pic_base_url"] . 'cat_free.gif\' alt=\'FREE!\' />';
        if ($crazyhour_var >= TIME_NOW && $crazyhour_var < TIME_NOW + 3600) {
            // is crazyhour
            $htmlout .= "<table width='50%'><tr><td class='colhead' colspan='3' align='center'>\n       " . $TBDEV['crazy_title'] . " Ends in " . mkprettytime($crazyhour_var - TIME_NOW) . "</td></tr>\n       <tr><td width='42px' align='center' valign='middle'>" . $cimg . "</td>\n       <td><div align='center'>" . $TBDEV['crazy_message'] . "</div></td>\n       <td width='42px' align='center' valign='middle'>" . $cimg . "</td></tr></table><br />";
            if (is_file($transfer_filename)) {
                unlink($transfer_filename);
            }
        } elseif ($crazyhour_var < TIME_NOW + 3600 && !is_file($transfer_filename)) {
            //== crazyhour over
            $transfer_file_created = fopen($transfer_filename, 'w') or die('no perms?');
            fclose($transfer_file_created);
            $crazyhour['crazyhour_new'] = mktime(23, 59, 59, date('m'), date('d'), date('y'));
            $crazyhour['crazyhour']['var'] = mt_rand($crazyhour['crazyhour_new'], $crazyhour['crazyhour_new'] + 86400);
            $fp = fopen($crazyhour_filename, 'w');
            fwrite($fp, $crazyhour['crazyhour']['var']);
            fclose($fp);
            write_log('Next Crazyhour is at ' . date('F j, g:i a T', $crazyhour['crazyhour']['var']));
            $htmlout .= "<table cellpadding='3'><tr><td class='colhead' colspan='3' align='center'>" . " Crazyhour will be " . get_date($crazyhour['crazyhour']['var'], '') . "  " . mkprettytime($crazyhour['crazyhour']['var'] - TIME_NOW) . " remaining till Crazyhour</td></tr></table><br />";
        } else {
            // make date look prettier with countdown etc even :]
            $htmlout .= "<table cellpadding='3'><tr><td class='colhead' colspan='3' align='center'>" . " Crazyhour will be " . get_date($crazyhour_var, '') . "  " . mkprettytime($crazyhour_var - TIME_NOW) . " remaining till Crazyhour</td></tr></table><br />";
        }
    }
    // crazyhour end
    return $htmlout;
}
function happyHour($action)
{
    global $CACHE;
    //generate happy hour
    if ($action == "generate") {
        $nextDay = date("Y-m-d", time() + 86400);
        $nextHoura = mt_rand(0, 2);
        if ($nextHoura == 2) {
            $nextHourb = mt_rand(0, 3);
        } else {
            $nextHourb = mt_rand(0, 9);
        }
        $nextHour = $nextHoura . $nextHourb;
        $nextMina = mt_rand(0, 5);
        $nextMinb = mt_rand(0, 9);
        $nextMin = $nextMina . $nextMinb;
        $happyHour = $nextDay . " " . $nextHour . ":" . $nextMin . "";
        return $happyHour;
    }
    $file = "{$CACHE}/happyhour.txt";
    //==linux
    //$file = "C://AppServ/www/cache/happyhour.txt"; //==windows *change* appserv if you use xammp
    $happy = unserialize(file_get_contents($file));
    $happyHour = strtotime($happy["time"]);
    $happyDate = $happyHour;
    $curDate = time();
    $nextDate = $happyHour + 3600;
    //action check
    if ($action == "check") {
        if ($happyDate < $curDate && $nextDate >= $curDate) {
            return true;
        }
    }
    //action time left
    if ($action == "time") {
        $timeLeft = mkprettytime($happyHour + 3600 - time());
        $timeLeft = explode(":", $timeLeft);
        $time = $timeLeft[0] . " min : " . $timeLeft[1] . " sec";
        return $time;
    }
    //this will set all torrent free or just one category
    if ($action == "todo") {
        $act = rand(1, 2);
        if ($act == 1) {
            $todo = 255;
        } elseif ($act == 2) {
            $todo = rand(1, 16);
        }
        // only one cat will be free || remember to change the number of categories i have 16 but you may have more
        return $todo;
    }
    //this will generate the multiplier so every torrent downloaded in the happy hour will have upload multiplied but this
    if ($action == "multiplier") {
        $multiplier = rand(11, 55) / 10;
        //max value of the multiplier will be 5,5 || you could change it to a higher or a lower value
        return $multiplier;
    }
}
Example #3
0
function dltable($name, $arr, $torrent)
{
    global $CURUSER, $lang;
    $htmlout = '';
    if (!count($arr)) {
        return $htmlout = "<div align='left'><b>{$lang['peerslist_no']} {$name} {$lang['peerslist_data_available']}</b></div>\n";
    }
    $htmlout = "\n";
    $htmlout .= "<table width='100%' class='main' border='1' cellspacing='0' cellpadding='5'>\n";
    $htmlout .= "<tr><td colspan='11' class='colhead'>" . count($arr) . " {$name}</td></tr>" . "<tr><td class='colhead'>{$lang['peerslist_user_ip']}</td>" . "<td class='colhead' align='center'>{$lang['peerslist_connectable']}</td>" . "<td class='colhead' align='right'>{$lang['peerslist_uploaded']}</td>" . "<td class='colhead' align='right'>{$lang['peerslist_rate']}</td>" . "<td class='colhead' align='right'>{$lang['peerslist_downloaded']}</td>" . "<td class='colhead' align='right'>{$lang['peerslist_rate']}</td>" . "<td class='colhead' align='right'>{$lang['peerslist_ratio']}</td>" . "<td class='colhead' align='right'>{$lang['peerslist_complete']}</td>" . "<td class='colhead' align='right'>{$lang['peerslist_connected']}</td>" . "<td class='colhead' align='right'>{$lang['peerslist_idle']}</td>" . "<td class='colhead' align='left'>{$lang['peerslist_client']}</td></tr>\n";
    $now = time();
    //$moderator = (isset($CURUSER) && get_user_class() >= UC_MODERATOR);
    //$mod = get_user_class() >= UC_MODERATOR;
    foreach ($arr as $e) {
        // user/ip/port
        // check if anyone has this ip
        //($unr = mysql_query("SELECT username, privacy FROM users WHERE id=$e[userid] ORDER BY last_access DESC LIMIT 1")) or die;
        //$una = mysql_fetch_assoc($unr);
        if ($e["privacy"] == "strong") {
            continue;
        }
        $htmlout .= "<tr>\n";
        if ($e["username"]) {
            $htmlout .= "<td><a href='userdetails.php?id={$e['userid']}'><b>{$e['username']}</b></a></td>\n";
        } else {
            $htmlout .= "<td>" . ($mod ? $e["ip"] : preg_replace('/\\.\\d+$/', ".xxx", $e["ip"])) . "</td>\n";
        }
        $secs = max(1, $now - $e["st"] - ($now - $e["la"]));
        //$revived = $e["revived"] == "yes";
        $htmlout .= "<td align='center'>" . ($e['connectable'] == "yes" ? "{$lang['peerslist_yes']}" : "<font color='red'>{$lang['peerslist_no']}</font>") . "</td>\n";
        $htmlout .= "<td align='right'>" . mksize($e["uploaded"]) . "</td>\n";
        $htmlout .= "<td align='right'><span style=\"white-space: nowrap;\">" . mksize(($e["uploaded"] - $e["uploadoffset"]) / $secs) . "/s</span></td>\n";
        $htmlout .= "<td align='right'>" . mksize($e["downloaded"]) . "</td>\n";
        if ($e["seeder"] == "no") {
            $htmlout .= "<td align='right'><span style=\"white-space: nowrap;\">" . mksize(($e["downloaded"] - $e["downloadoffset"]) / $secs) . "/s</span></td>\n";
        } else {
            $htmlout .= "<td align='right'><span style=\"white-space: nowrap;\">" . mksize(($e["downloaded"] - $e["downloadoffset"]) / max(1, $e["finishedat"] - $e['st'])) . "/s</span></td>\n";
        }
        if ($e["downloaded"]) {
            $ratio = floor($e["uploaded"] / $e["downloaded"] * 1000) / 1000;
            $htmlout .= "<td align=\"right\"><font color='" . get_ratio_color($ratio) . "'>" . number_format($ratio, 3) . "</font></td>\n";
        } else {
            if ($e["uploaded"]) {
                $htmlout .= "<td align='right'>{$lang['peerslist_inf']}</td>\n";
            } else {
                $htmlout .= "<td align='right'>---</td>\n";
            }
        }
        $htmlout .= "<td align='right'>" . sprintf("%.2f%%", 100 * (1 - $e["to_go"] / $torrent["size"])) . "</td>\n";
        $htmlout .= "<td align='right'>" . mkprettytime($now - $e["st"]) . "</td>\n";
        $htmlout .= "<td align='right'>" . mkprettytime($now - $e["la"]) . "</td>\n";
        $htmlout .= "<td align='left'>" . htmlspecialchars(getagent($e["agent"], $e['peer_id'])) . "</td>\n";
        $htmlout .= "</tr>\n";
    }
    $htmlout .= "</table>\n";
    return $htmlout;
}
Example #4
0
function snatchtable_staff($res)
{
    global $INSTALLER09, $lang, $CURUSER, $id;
    $htmlout_snatch = '';
    $count2 = 0;
    //    $htmlout_snatch .= "<tr><td class='one' align='right' valign='top'><b>{$lang['userdetails_snatched']}</b></td><td class='one'>";
    $htmlout_snatch .= "<table border='1' cellspacing='0' cellpadding='5' align='center'><tr><td class='colhead' align='center'>{$lang['userdetails_s_cat']}</td><td class='colhead' align='left'>{$lang['userdetails_s_torr']}</td>" . "<td class='colhead' align='center'>{$lang['userdetails_s_sl']}</td><td class='colhead' align='center'>{$lang['userdetails_s_up']}" . ($INSTALLER09['ratio_free'] ? "" : "{$lang['userdetails_s_down']}") . "</td><td class='colhead' align='center'>{$lang['userdetails_s_tsize']}</td>" . "<td class='colhead' align='center'>{$lang['userdetails_ratio']}</td><td class='colhead' align='center'>{$lang['userdetails_client']}</td></tr>";
    while ($arr = mysqli_fetch_assoc($res)) {
        //=======change colors
        $count2 = ++$count2 % 2;
        $class = $count2 == 0 ? 'one' : 'two';
        //=== speed color red fast green slow ;)
        if ($arr["upspeed"] > 0) {
            $ul_speed = $arr["upspeed"] > 0 ? mksize($arr["upspeed"]) : ($arr["seedtime"] > 0 ? mksize($arr["uploaded"] / ($arr["seedtime"] + $arr["leechtime"])) : mksize(0));
        } else {
            $ul_speed = mksize($arr["uploaded"] / ($arr['l_a'] - $arr['s'] + 1));
        }
        if ($arr["downspeed"] > 0) {
            $dl_speed = $arr["downspeed"] > 0 ? mksize($arr["downspeed"]) : ($arr["leechtime"] > 0 ? mksize($arr["downloaded"] / $arr["leechtime"]) : mksize(0));
        } else {
            $dl_speed = mksize($arr["downloaded"] / ($arr['c'] - $arr['s'] + 1));
        }
        switch (true) {
            case $dl_speed > 600:
                $dlc = 'red';
                break;
            case $dl_speed > 300:
                $dlc = 'orange';
                break;
            case $dl_speed > 200:
                $dlc = 'yellow';
                break;
            case $dl_speed < 100:
                $dlc = 'Chartreuse';
                break;
        }
        if ($arr["downloaded"] > 0) {
            $ratio = number_format($arr["uploaded"] / $arr["downloaded"], 3);
            $ratio = "<font color='" . get_ratio_color($ratio) . "'><b>{$lang['userdetails_s_ratio']}</b><br />{$ratio}</font>";
        } else {
            if ($arr["uploaded"] > 0) {
                $ratio = $lang['userdetails_inf'];
            } else {
                $ratio = "N/A";
            }
        }
        if (XBT_TRACKER === false) {
            $htmlout_snatch .= "<tr><td class='{$class}' align='center'>" . ($arr['owner'] == $id ? "<b><font color='orange'>{$lang['userdetails_s_towner']}</font></b><br />" : "" . ($arr['complete_date'] != '0' ? "<b><font color='lightgreen'>{$lang['userdetails_s_fin']}</font></b><br />" : "<b><font color='red'>{$lang['userdetails_s_nofin']}</font></b><br />") . "") . "<img src='{$INSTALLER09['pic_base_url']}caticons/{$CURUSER['categorie_icon']}/" . htmlsafechars($arr['image']) . "' alt='" . htmlsafechars($arr['name']) . "' title='" . htmlsafechars($arr['name']) . "' /></td>" . "\n    <td class='{$class}'><a class='altlink' href='{$INSTALLER09['baseurl']}/details.php?id=" . (int) $arr['torrentid'] . "'><b>" . htmlsafechars($arr['torrent_name']) . "</b></a>" . ($arr['complete_date'] != '0' ? "<br /><font color='yellow'>{$lang['userdetails_s_started']}" . get_date($arr['start_date'], 0, 1) . "</font><br />" : "<font color='yellow'>{$lang['userdetails_s_started']}" . get_date($arr['start_date'], 0, 1) . "</font><br /><font color='orange'>{$lang['userdetails_s_laction']}" . get_date($arr['last_action'], 0, 1) . "</font>" . get_date($arr['complete_date'], 0, 1) . " " . ($arr['complete_date'] == '0' ? "" . ($arr['owner'] == $id ? "" : "[ " . mksize($arr["size"] - $arr["downloaded"]) . "{$lang['userdetails_s_still']}]") . "" : "") . "") . $lang['userdetails_s_finished'] . get_date($arr['complete_date'], 0, 1) . "" . ($arr['complete_date'] != '0' ? "<br /><font color='silver'>{$lang['userdetails_s_ttod']}" . ($arr['leechtime'] != '0' ? mkprettytime($arr['leechtime']) : mkprettytime($arr['c'] - $arr['s']) . "") . "</font> <font color='{$dlc}'>[ {$lang['userdetails_s_dled']} {$dl_speed} ]</font><br />" : "<br />") . "<font color='lightblue'>" . ($arr['seedtime'] != '0' ? $lang['userdetails_s_tseed'] . mkprettytime($arr['seedtime']) . " </font><font color='{$dlc}'> " : $lang['userdetails_s_tseedn']) . "</font><font color='lightgreen'> [ {$lang['userdetails_s_uspeed']} " . $ul_speed . " ] </font>" . ($arr['complete_date'] == '0' ? "<br /><font color='{$dlc}'>{$lang['userdetails_s_dspeed']}{$dl_speed}</font>" : "") . "</td>" . "\n    <td align='center' class='{$class}'>{$lang['userdetails_s_seed']}" . (int) $arr['seeders'] . "<br />{$lang['userdetails_s_leech']}" . (int) $arr['leechers'] . "</td><td align='center' class='{$class}'><font color='lightgreen'>{$lang['userdetails_s_upld']}<br /><b>" . mksize($arr["uploaded"]) . "</b></font>" . ($INSTALLER09['ratio_free'] ? "" : "<br /><font color='orange'>{$lang['userdetails_s_dld']}<br /><b>" . mksize($arr["downloaded"]) . "</b></font>") . "</td><td align='center' class='{$class}'>" . mksize($arr["size"]) . "" . ($INSTALLER09['ratio_free'] ? "" : "<br />{$lang['userdetails_s_diff']}<br /><font color='orange'><b>" . mksize($arr['size'] - $arr["downloaded"]) . "</b></font>") . "</td><td align='center' class='{$class}'>" . $ratio . "<br />" . ($arr['seeder'] == 'yes' ? "<font color='lightgreen'><b>{$lang['userdetails_s_seeding']}</b></font>" : "<font color='red'><b>{$lang['userdetails_s_nseeding']}</b></font>") . "</td><td align='center' class='{$class}'>" . htmlsafechars($arr["agent"]) . "<br />{$lang['userdetails_s_port']}" . (int) $arr["port"] . "<br />" . ($arr["connectable"] == 'yes' ? "<b>{$lang['userdetails_s_conn']}</b> <font color='lightgreen'>{$lang['userdetails_yes']}</font>" : "<b>{$lang['userdetails_s_conn']}</b> <font color='red'><b>{$lang['userdetails_no']}</b></font>") . "</td></tr>\n";
        } else {
            $htmlout_snatch .= "<tr><td class='{$class}' align='center'>" . ($arr['owner'] == $id ? "<b><font color='orange'>{$lang['userdetails_s_towner']}</font></b><br />" : "" . ($arr['completedtime'] != '0' ? "<b><font color='lightgreen'>{$lang['userdetails_s_fin']}</font></b><br />" : "<b><font color='red'>{$lang['userdetails_s_nofin']}</font></b><br />") . "") . "<img src='{$INSTALLER09['pic_base_url']}caticons/{$CURUSER['categorie_icon']}/" . htmlsafechars($arr['image']) . "' alt='" . htmlsafechars($arr['name']) . "' title='" . htmlsafechars($arr['name']) . "' /></td>" . "\n    <td class='{$class}'><a class='altlink' href='{$INSTALLER09['baseurl']}/details.php?id=" . (int) $arr['fid'] . "'><b>" . htmlsafechars($arr['torrent_name']) . "</b></a>" . ($arr['completedtime'] != '0' ? "<br /><font color='yellow'>{$lang['userdetails_s_started']}" . get_date($arr['started'], 0, 1) . "</font><br />" : "<font color='yellow'>started:" . get_date($arr['started'], 0, 1) . "</font><br /><font color='orange'>{$lang['userdetails_s_laction']}" . get_date($arr['mtime'], 0, 1) . "</font>" . get_date($arr['completedtime'], 0, 1) . " " . ($arr['completedtime'] == '0' ? "" . ($arr['owner'] == $id ? "" : "[ " . mksize($arr["size"] - $arr["downloaded"]) . "{$lang['userdetails_s_still']}]") . "" : "") . "") . "{$lang['userdetails_s_finished']}" . get_date($arr['completedtime'], 0, 1) . "" . ($arr['completedtime'] != '0' ? "<br /><font color='silver'>{$lang['userdetails_s_ttod']}" . ($arr['leechtime'] != '0' ? mkprettytime($arr['leechtime']) : mkprettytime($arr['c'] - $arr['s']) . "") . "</font> <font color='{$dlc}'>[ {$lang['userdetails_s_dled']} {$dl_speed} ]</font><br />" : "<br />") . "<font color='lightblue'>" . ($arr['seedtime'] != '0' ? "{$lang['userdetails_s_tseed']}" . mkprettytime($arr['seedtime']) . " </font><font color='{$dlc}'> " : "{$lang['userdetails_s_tseedn']}") . "</font><font color='lightgreen'> [{$lang['userdetails_s_uspeed']}" . $ul_speed . " ] </font>" . ($arr['completedtime'] == '0' ? "<br /><font color='{$dlc}'>{$lang['userdetails_s_dspeed']} {$dl_speed}</font>" : "") . "</td>" . "\n    <td align='center' class='{$class}'>{$lang['userdetails_s_seed']}" . (int) $arr['seeders'] . "<br />{$lang['userdetails_s_leech']}" . (int) $arr['leechers'] . "</td><td align='center' class='{$class}'><font color='lightgreen'>{$lang['userdetails_s_upld']}<br /><b>" . mksize($arr["uploaded"]) . "</b></font>" . ($INSTALLER09['ratio_free'] ? "" : "<br /><font color='orange'>{$lang['userdetails_s_dld']}<br /><b>" . mksize($arr["downloaded"]) . "</b></font>") . "</td><td align='center' class='{$class}'>" . mksize($arr["size"]) . "" . ($INSTALLER09['ratio_free'] ? "" : "<br />{$lang['userdetails_s_diff']}<br /><font color='orange'><b>" . mksize($arr['size'] - $arr["downloaded"]) . "</b></font>") . "</td><td align='center' class='{$class}'>" . $ratio . "<br />" . ($arr['active'] == 1 ? "<font color='lightgreen'><b>{$lang['userdetails_s_seeding']}</b></font>" : "<font color='red'><b>{$lang['userdetails_s_nseeding']}</b></font>") . "</td><td align='center' class='{$class}'>" . htmlsafechars($arr["peer_id"]) . "<br />" . ($arr["connectable"] == 1 ? "<b>{$lang['userdetails_s_conn']}</b> <font color='lightgreen'>{$lang['userdetails_yes']}</font>" : "<b>{$lang['userdetails_s_conn']}</b> <font color='red'><b>{$lang['userdetails_no']}</b></font>") . "</td></tr>\n";
        }
    }
    $htmlout_snatch .= "</table>\n";
    return $htmlout_snatch;
}
Example #5
0
function dltable($name, $arr, $torrent)
{
    global $CURUSER, $lang;
    $htmlout = '';
    if (!count($arr)) {
        return $htmlout = "<div align='left'><b>{$lang['peerslist_no']} {$name} {$lang['peerslist_data_available']}</b></div>\n";
    }
    $htmlout = "\n";
    $htmlout .= "<table width='100%' class='main' border='1' cellspacing='0' cellpadding='5'>\n";
    $htmlout .= "<tr><td colspan='11' class='colhead'>" . count($arr) . " {$name}</td></tr>" . "<tr><td class='colhead'>{$lang['peerslist_user_ip']}</td>" . "<td class='colhead' align='center'>{$lang['peerslist_connectable']}</td>" . "<td class='colhead' align='right'>{$lang['peerslist_uploaded']}</td>" . "<td class='colhead' align='right'>{$lang['peerslist_rate']}</td>" . "<td class='colhead' align='right'>{$lang['peerslist_downloaded']}</td>" . "<td class='colhead' align='right'>{$lang['peerslist_rate']}</td>" . "<td class='colhead' align='right'>{$lang['peerslist_ratio']}</td>" . "<td class='colhead' align='right'>{$lang['peerslist_complete']}</td>" . "<td class='colhead' align='right'>{$lang['peerslist_connected']}</td>" . "<td class='colhead' align='right'>{$lang['peerslist_idle']}</td>" . "<td class='colhead' align='left'>{$lang['peerslist_client']}</td></tr>\n";
    $now = time();
    $mod = $CURUSER['class'] >= UC_MODERATOR;
    foreach ($arr as $e) {
        if ($e["privacy"] == "strong") {
            continue;
        }
        $htmlout .= "<tr>\n";
        if ($e['username']) {
            if (($e['tanonymous'] == 'yes' && $e['owner'] == $e['userid'] || $e['anonymous'] == 'yes' && $CURUSER['id'] != $e['userid']) && $CURUSER['class'] < UC_MODERATOR) {
                $htmlout .= "<td><b>Anonymous</b></td>\n";
            } else {
                $htmlout .= "<td><a href='userdetails.php?id=" . $e['userid'] . "'><b>" . $e['username'] . "</b></a></td>\n";
            }
        } else {
            $htmlout .= "<td>" . ($mod ? $e["ip"] : preg_replace('/\\.\\d+$/', ".xxx", $e["ip"])) . "</td>\n";
        }
        $secs = max(1, $now - $e["st"] - ($now - $e["la"]));
        $htmlout .= "<td align='center'>" . ($e['connectable'] == "yes" ? "{$lang['peerslist_yes']}" : "<font color='red'>{$lang['peerslist_no']}</font>") . "</td>\n";
        $htmlout .= "<td align='right'>" . mksize($e["uploaded"]) . "</td>\n";
        $htmlout .= "<td align='right'><span style=\"white-space: nowrap;\">" . mksize(($e["uploaded"] - $e["uploadoffset"]) / $secs) . "/s</span></td>\n";
        $htmlout .= "<td align='right'>" . mksize($e["downloaded"]) . "</td>\n";
        if ($e["seeder"] == "no") {
            $htmlout .= "<td align='right'><span style=\"white-space: nowrap;\">" . mksize(($e["downloaded"] - $e["downloadoffset"]) / $secs) . "/s</span></td>\n";
        } else {
            $htmlout .= "<td align='right'><span style=\"white-space: nowrap;\">" . mksize(($e["downloaded"] - $e["downloadoffset"]) / max(1, $e["finishedat"] - $e['st'])) . "/s</span></td>\n";
        }
        if ($e["downloaded"]) {
            $ratio = floor($e["uploaded"] / $e["downloaded"] * 1000) / 1000;
            $htmlout .= "<td align=\"right\"><font color='" . get_ratio_color($ratio) . "'>" . number_format($ratio, 3) . "</font></td>\n";
        } else {
            if ($e["uploaded"]) {
                $htmlout .= "<td align='right'>{$lang['peerslist_inf']}</td>\n";
            } else {
                $htmlout .= "<td align='right'>---</td>\n";
            }
        }
        $htmlout .= "<td align='right'>" . sprintf("%.2f%%", 100 * (1 - $e["to_go"] / $torrent["size"])) . "</td>\n";
        $htmlout .= "<td align='right'>" . mkprettytime($now - $e["st"]) . "</td>\n";
        $htmlout .= "<td align='right'>" . mkprettytime($now - $e["la"]) . "</td>\n";
        $htmlout .= "<td align='left'>" . htmlspecialchars(getagent($e["agent"], $e['peer_id'])) . "</td>\n";
        $htmlout .= "</tr>\n";
    }
    $htmlout .= "</table>\n";
    return $htmlout;
}
Example #6
0
function snatchtable($res)
{
    $table = "<table class=main border=1 cellspacing=0 cellpadding=5>\r\n<tr>\r\n<td class=colhead>Category</td>\r\n<td class=colhead>Torrent</td>\r\n<td class=colhead>S.id</td>\r\n<td class=colhead>Up.</td>\r\n<td class=colhead>Rate</td>\r\n<td class=colhead>Downl.</td>\r\n<td class=colhead>Rate</td>\r\n<td class=colhead>Ratio</td>\r\n<td class=colhead>Activity</td>\r\n<td class=colhead>Finished</td>\r\n</tr>";
    while ($arr = mysql_fetch_assoc($res)) {
        $upspeed = $arr["upspeed"] > 0 ? prefixed($arr["upspeed"]) : ($arr["seedtime"] > 0 ? prefixed($arr["uploaded"] / ($arr["seedtime"] + $arr["leechtime"])) : prefixed(0));
        $downspeed = $arr["downspeed"] > 0 ? prefixed($arr["downspeed"]) : ($arr["leechtime"] > 0 ? prefixed($arr["downloaded"] / $arr["leechtime"]) : prefixed(0));
        $ratio = $arr["downloaded"] > 0 ? number_format($arr["uploaded"] / $arr["downloaded"], 3) : ($arr["uploaded"] > 0 ? "Inf." : "---");
        $id = $arr["id"];
        $table .= "<tr>\r\n<td style='padding: 0px'><img src='pic/" . safeChar($arr["catimg"]) . "' alt='" . safeChar($arr["catname"]) . "' width=42 height=42></td>\r\n<td><a href=details.php?id={$arr['torrentid']}><b>" . (strlen($arr["name"]) > 50 ? substr($arr["name"], 0, 50 - 3) . "..." : $arr["name"]) . "</b></a></td>\r\n<td>" . $arr["id"] . "</td>\r\n<td>" . prefixed($arr["uploaded"]) . "</td>\r\n<td>{$upspeed}/s</td>\r\n<td>" . prefixed($arr["downloaded"]) . "</td>\r\n<td>{$downspeed}/s</td>\r\n<td>{$ratio}</td>\r\n<td>" . mkprettytime($arr["seedtime"] + $arr["leechtime"]) . "</td>\r\n<td>" . ($arr["complete_date"] != "0000-00-00 00:00:00" ? "<font color=green><b>Yes</b></font>" : "<font color=red><b>No</b></font>") . "</td>\r\n</tr>\n";
    }
    $table .= "</table>\n";
    return $table;
}
Example #7
0
function snatchtable($res)
{
    global $INSTALLER09, $lang;
    $htmlout = '';
    $htmlout = "<table class='main' border='1' cellspacing='0' cellpadding='5'>\r\n <tr>\r\n <td class='colhead'>Category</td>\r\n <td class='colhead'>Torrent</td>\r\n <td class='colhead'>Up.</td>\r\n <td class='colhead'>Rate</td>\r\n <td class='colhead'>Downl.</td>\r\n <td class='colhead'>Rate</td>\r\n <td class='colhead'>Ratio</td>\r\n <td class='colhead'>Activity</td>\r\n <td class='colhead'>Finished</td>\r\n </tr>";
    while ($arr = mysql_fetch_assoc($res)) {
        $upspeed = $arr["upspeed"] > 0 ? mksize($arr["upspeed"]) : ($arr["seedtime"] > 0 ? mksize($arr["uploaded"] / ($arr["seedtime"] + $arr["leechtime"])) : mksize(0));
        $downspeed = $arr["downspeed"] > 0 ? mksize($arr["downspeed"]) : ($arr["leechtime"] > 0 ? mksize($arr["downloaded"] / $arr["leechtime"]) : mksize(0));
        $ratio = $arr["downloaded"] > 0 ? number_format($arr["uploaded"] / $arr["downloaded"], 3) : ($arr["uploaded"] > 0 ? "Inf." : "---");
        $htmlout .= "<tr>\r\n <td style='padding: 0px'><img src='pic/" . htmlspecialchars($arr["catimg"]) . "' alt='" . htmlspecialchars($arr["catname"]) . "' width='42' height='42' /></td>\r\n <td><a href='details.php?id={$arr['torrentid']}'><b>" . (strlen($arr["name"]) > 50 ? substr($arr["name"], 0, 50 - 3) . "..." : $arr["name"]) . "</b></a></td>\r\n <td>" . mksize($arr["uploaded"]) . "</td>\r\n <td>{$upspeed}/s</td>\r\n <td>" . mksize($arr["downloaded"]) . "</td>\r\n <td>{$downspeed}/s</td>\r\n <td>{$ratio}</td>\r\n <td>" . mkprettytime($arr["seedtime"] + $arr["leechtime"]) . "</td>\r\n <td>" . ($arr["complete_date"] != "0" ? "<font color='green'><b>Yes</b></font>" : "<font color='red'><b>No</b></font>") . "</td>\r\n </tr>\n";
    }
    $htmlout .= "</table>\n";
    return $htmlout;
}
Example #8
0
function snatchtable($res)
{
    global $INSTALLER09, $lang, $CURUSER;
    $htmlout = '';
    $htmlout = "<table class='main' border='1' cellspacing='0' cellpadding='5'>\n <tr>\n<td class='colhead'>{$lang['userdetails_s_cat']}</td>\n<td class='colhead'>{$lang['userdetails_s_torr']}</td>\n<td class='colhead'>{$lang['userdetails_s_up']}</td>\n<td class='colhead'>{$lang['userdetails_rate']}</td>\n" . ($INSTALLER09['ratio_free'] ? "" : "<td class='colhead'>{$lang['userdetails_downl']}</td>") . "\n" . ($INSTALLER09['ratio_free'] ? "" : "<td class='colhead'>{$lang['userdetails_rate']}</td>") . "\n<td class='colhead'>{$lang['userdetails_ratio']}</td>\n<td class='colhead'>{$lang['userdetails_activity']}</td>\n<td class='colhead'>{$lang['userdetails_s_fin']}</td>\n</tr>";
    while ($arr = mysqli_fetch_assoc($res)) {
        $upspeed = $arr["upspeed"] > 0 ? mksize($arr["upspeed"]) : ($arr["seedtime"] > 0 ? mksize($arr["uploaded"] / ($arr["seedtime"] + $arr["leechtime"])) : mksize(0));
        $downspeed = $arr["downspeed"] > 0 ? mksize($arr["downspeed"]) : ($arr["leechtime"] > 0 ? mksize($arr["downloaded"] / $arr["leechtime"]) : mksize(0));
        $ratio = $arr["downloaded"] > 0 ? number_format($arr["uploaded"] / $arr["downloaded"], 3) : ($arr["uploaded"] > 0 ? "Inf." : "---");
        $XBT_or_PHP = XBT_TRACKER == true ? $arr['fid'] : $arr['torrentid'];
        $XBT_or_PHP_TIME = XBT_TRACKER == true ? $arr["completedtime"] : $arr["complete_date"];
        $htmlout .= "<tr>\n <td style='padding: 0px'><img src='{$INSTALLER09['pic_base_url']}caticons/{$CURUSER['categorie_icon']}/" . htmlsafechars($arr["catimg"]) . "' alt='" . htmlsafechars($arr["catname"]) . "' width='42' height='42' /></td>\n <td><a href='details.php?id=" . (int) $XBT_or_PHP . "'><b>" . (strlen($arr["name"]) > 50 ? substr($arr["name"], 0, 50 - 3) . "..." : htmlsafechars($arr["name"])) . "</b></a></td>\n <td>" . mksize($arr["uploaded"]) . "</td>\n <td>{$upspeed}/s</td>\n " . ($INSTALLER09['ratio_free'] ? "" : "<td>" . mksize($arr["downloaded"]) . "</td>") . "\n " . ($INSTALLER09['ratio_free'] ? "" : "<td>{$downspeed}/s</td>") . "\n <td>{$ratio}</td>\n <td>" . mkprettytime($arr["seedtime"] + $arr["leechtime"]) . "</td>\n <td>" . ($XBT_or_PHP_TIME != 0 ? "<font color='green'><b>{$lang['userdetails_yes']}</b></font>" : "<font color='red'><b>{$lang['userdetails_no']}</b></font>") . "</td>\n </tr>\n";
    }
    $htmlout .= "</table>\n";
    return $htmlout;
}
function dltable($name, $arr, $torrent)
{
    global $CURUSER, $lang, $INSTALLER09;
    $htmlout = '';
    if (!count($arr)) {
        return $htmlout = "<div align='left'><b>{$lang['peerslist_no']} {$name} {$lang['peerslist_data_available']}</b></div>\n";
    }
    $htmlout = "\n";
    $htmlout .= "<table width='100%' class='main' border='1' cellspacing='0' cellpadding='5'>\n";
    $htmlout .= "<tr><td colspan='11' class='colhead'>" . count($arr) . " {$name}</td></tr>" . "<tr><td class='colhead'>{$lang['peerslist_user_ip']}</td>" . "<td class='colhead' align='center'>{$lang['peerslist_connectable']}</td>" . "<td class='colhead' align='right'>{$lang['peerslist_uploaded']}</td>" . "<td class='colhead' align='right'>{$lang['peerslist_rate']}</td>" . "" . ($INSTALLER09['ratio_free'] ? "" : "<td class='colhead' align='right'>{$lang['peerslist_downloaded']}</td>") . "" . "" . ($INSTALLER09['ratio_free'] ? "" : "<td class='colhead' align='right'>{$lang['peerslist_rate']}</td>") . "" . "<td class='colhead' align='right'>{$lang['peerslist_ratio']}</td>" . "<td class='colhead' align='right'>{$lang['peerslist_complete']}</td>" . "<td class='colhead' align='right'>{$lang['peerslist_connected']}</td>" . "<td class='colhead' align='right'>{$lang['peerslist_idle']}</td>" . "<td class='colhead' align='left'>{$lang['peerslist_client']}</td></tr>\n";
    $now = TIME_NOW;
    $mod = $CURUSER['class'] >= UC_STAFF;
    foreach ($arr as $e) {
        $htmlout .= "<tr>\n";
        if ($e['username']) {
            if (($e['tanonymous'] == 'yes' && $e['owner'] == $e['userid'] || $e['anonymous'] == 'yes' or $e['paranoia'] >= 2) && $CURUSER['id'] != $e['userid'] && $CURUSER['class'] < UC_STAFF) {
                $htmlout .= "<td><b>Kezer Soze</b></td>\n";
            } else {
                $htmlout .= "<td><a href='userdetails.php?id=" . (int) $e['userid'] . "'><b>" . htmlsafechars($e['username']) . "</b></a></td>\n";
            }
        } else {
            $htmlout .= "<td>" . ($mod ? $e["ip"] : preg_replace('/\\.\\d+$/', ".xxx", $e["ip"])) . "</td>\n";
        }
        $secs = max(1, $now - $e["st"] - ($now - $e["la"]));
        $htmlout .= "<td align='center'>" . ($e['connectable'] == "yes" ? "{$lang['peerslist_yes']}" : "<font color='red'>{$lang['peerslist_no']}</font>") . "</td>\n";
        $htmlout .= "<td align='right'>" . mksize($e["uploaded"]) . "</td>\n";
        $htmlout .= "<td align='right'><span style=\"white-space: nowrap;\">" . mksize(($e["uploaded"] - $e["uploadoffset"]) / $secs) . "/s</span></td>\n";
        $htmlout .= "" . ($INSTALLER09['ratio_free'] ? "" : "<td align='right'>" . mksize($e["downloaded"]) . "</td>") . "\n";
        if ($e["seeder"] == "no") {
            $htmlout .= "" . ($INSTALLER09['ratio_free'] ? "" : "<td align='right'><span style=\"white-space: nowrap;\">" . mksize(($e["downloaded"] - $e["downloadoffset"]) / $secs) . "/s</span></td>") . "\n";
        } else {
            $htmlout .= "" . ($INSTALLER09['ratio_free'] ? "" : "<td align='right'><span style=\"white-space: nowrap;\">" . mksize(($e["downloaded"] - $e["downloadoffset"]) / max(1, $e["finishedat"] - $e['st'])) . "/s</span></td>") . "\n";
        }
        $htmlout .= "<td align=\"right\">" . member_ratio($e['uploaded'], $INSTALLER09['ratio_free'] ? "0" : $e['downloaded']) . "</td>\n";
        $htmlout .= "<td align='right'>" . sprintf("%.2f%%", 100 * (1 - $e["to_go"] / $torrent["size"])) . "</td>\n";
        $htmlout .= "<td align='right'>" . mkprettytime($now - $e["st"]) . "</td>\n";
        $htmlout .= "<td align='right'>" . mkprettytime($now - $e["la"]) . "</td>\n";
        $htmlout .= "<td align='left'>" . htmlsafechars(getagent($e["agent"], $e['peer_id'])) . "</td>\n";
        $htmlout .= "</tr>\n";
    }
    $htmlout .= "</table>\n";
    return $htmlout;
}
Example #10
0
function dltable($name, $arr, $torrent)
{
    global $CURUSER, $lang, $INSTALLER09;
    $htmlout = '';
    if (!count($arr)) {
        return $htmlout = "<div align='left'><b>{$lang['peerslist_no']} {$name} {$lang['peerslist_data_available']}</b></div>\n";
    }
    $htmlout = "\n";
    $htmlout .= "<table class='table table-bordered'>\n";
    $htmlout .= "<tr><td colspan='11' class='colhead'>" . count($arr) . " {$name}</td></tr>" . "<tr><td class='colhead'>{$lang['peerslist_user_ip']}</td>" . "<td class='colhead' align='right'>{$lang['peerslist_uploaded']}</td>" . "<td class='colhead' align='right'>{$lang['peerslist_rate']}</td>" . "" . ($INSTALLER09['ratio_free'] ? "" : "<td class='colhead' align='right'>{$lang['peerslist_downloaded']}</td>") . "" . "" . ($INSTALLER09['ratio_free'] ? "" : "<td class='colhead' align='right'>{$lang['peerslist_rate']}</td>") . "" . "<td class='colhead' align='right'>{$lang['peerslist_ratio']}</td>" . "<td class='colhead' align='right'>{$lang['peerslist_complete']}</td>" . "<td class='colhead' align='right'>{$lang['peerslist_idle']}</td>" . "<td class='colhead' align='left'>{$lang['peerslist_client']}</td></tr>\n";
    $now = TIME_NOW;
    $mod = $CURUSER['class'] >= UC_STAFF;
    foreach ($arr as $e) {
        $htmlout .= "<tr>\n";
        $upspeed = $e["upspeed"] > 0 ? mksize($e["upspeed"]) : ($e["seedtime"] > 0 ? mksize($e["uploaded"] / ($e["seedtime"] + $e["leechtime"])) : mksize(0));
        $downspeed = $e["downspeed"] > 0 ? mksize($e["downspeed"]) : ($e["leechtime"] > 0 ? mksize($e["downloaded"] / $e["leechtime"]) : mksize(0));
        if ($e['username']) {
            if (($e['tanonymous'] == 'yes' && $e['owner'] == $e['uid'] || $e['anonymous'] == 'yes' or $e['paranoia'] >= 2 && $CURUSER['id'] != $e['uid']) && $CURUSER['class'] < UC_STAFF) {
                $htmlout .= "<td><b>Kezer Soze</b></td>\n";
            } else {
                $htmlout .= "<td><a href='userdetails.php?id=" . (int) $e['uid'] . "'><b>" . htmlsafechars($e['username']) . "</b></a></td>\n";
            }
        } else {
            $htmlout .= "<td>" . ($mod ? XBT_IP_CONVERT($e["ipa"]) : preg_replace('/\\.\\d+$/', ".xxx", XBT_IP_CONVERT($e["ipa"]))) . "</td>\n";
        }
        $htmlout .= "<td align='right'>" . mksize($e["uploaded"]) . "</td>\n";
        $htmlout .= "<td align='right'><span style=\"white-space: nowrap;\">" . htmlsafechars($upspeed) . "/s</span></td>\n";
        $htmlout .= "" . ($INSTALLER09['ratio_free'] ? "" : "<td align='right'>" . mksize($e["downloaded"]) . "</td>") . "\n";
        $htmlout .= "" . ($INSTALLER09['ratio_free'] ? "" : "<td align='right'><span style=\"white-space: nowrap;\">" . htmlsafechars($downspeed) . "/s</span></td>") . "\n";
        $htmlout .= "<td align=\"right\">" . member_ratio($e['uploaded'], $INSTALLER09['ratio_free'] ? "0" : $e['downloaded']) . "</td>\n";
        $htmlout .= "<td align='right'>" . sprintf("%.2f%%", 100 * (1 - $e["left"] / $torrent["size"])) . "</td>\n";
        $htmlout .= "<td align='right'>" . mkprettytime($now - $e["la"]) . "</td>\n";
        $htmlout .= "<td align='left'>" . htmlsafechars(getagent($e["peer_id"], $e['peer_id'])) . "</td>\n";
        $htmlout .= "</tr>\n";
    }
    $htmlout .= "</table>\n";
    return $htmlout;
}
Example #11
0
    if (isset($free) && count($free) >= 1) {
        foreach ($free as $fl) {
            switch ($fl['modifier']) {
                case 1:
                    $mode = 'All Torrents Free';
                    break;
                case 2:
                    $mode = 'All Double Upload';
                    break;
                case 3:
                    $mode = 'All Torrents Free and Double Upload';
                    break;
                case 4:
                    $mode = 'All Torrents Silver';
                    break;
                default:
                    $mode = 0;
            }
            $htmlout .= $fl['modifier'] != 0 && $fl['expires'] > TIME_NOW ? '
     <li>
     <a class="sa-tooltip" href="#"><b class="btn btn-info btn-sm">' . $lang['gl_freeleech'] . '</b>
	 <span class="custom info alert alert-info"><em>' . $fl['title'] . '</em>
     ' . $mode . '<br />
     ' . $fl['message'] . ' ' . $lang['gl_freeleech_sb'] . ' ' . $fl['setby'] . '<br />' . ($fl['expires'] != 1 ? '' . $lang['gl_freeleech_u'] . ' ' . get_date($fl['expires'], 'DATE') . ' (' . mkprettytime($fl['expires'] - TIME_NOW) . ' ' . $lang['gl_freeleech_tg'] . ')' : '') . '  
     </span></a></li>' : '';
        }
    }
}
//=== free addon end
// End Class
// End File
Example #12
0
<?php

//==Freeleech info
$HTMLOUT .= "<tr><td class='rowhead'>Freeleech Slots</td><td align='left'>" . (int) $user['freeslots'] . "</td></tr>";
$HTMLOUT .= "<tr><td class='rowhead'>Freeleech Status</td><td align='left'>" . ($user['free_switch'] != 0 ? 'FREE Status ' . ($user['free_switch'] > 1 ? 'Expires: ' . get_date($user['free_switch'], 'DATE') . ' (' . mkprettytime($user['free_switch'] - TIME_NOW) . ' to go) <br />' : 'Unlimited<br />') : 'None') . "</td></tr>";
//==end
// End Class
// End File
function torrenttable($res, $variant = "index")
{
    global $TBDEV, $CURUSER, $lang, $free;
    $htmlout = '';
    /** ALL FREE/DOUBLE **/
    foreach ($free as $fl) {
        switch ($fl['modifier']) {
            case 1:
                $free_display = '[Free]';
                break;
            case 2:
                $free_display = '[Double]';
                break;
            case 3:
                $free_display = '[Free and Double]';
                break;
        }
        $all_free_tag = $fl['modifier'] != 0 && ($fl['expires'] > TIME_NOW || $fl['expires'] == 1) ? ' <a class="info" href="#">
            <b>' . $free_display . '</b> 
            <span>' . ($fl['expires'] != 1 ? '
            Expires: ' . get_date($fl['expires'], 'DATE') . '<br />
            (' . mkprettytime($fl['expires'] - time()) . ' to go)</span></a><br />' : 'Unlimited</span></a><br />') : '';
    }
    $prevdate = "";
    $count_get = 0;
    $oldlink = $char = $description = $type = $sort = $row = '';
    foreach ($_GET as $get_name => $get_value) {
        $get_name = strip_tags(str_replace(array("\"", "'"), array("", ""), $get_name));
        $get_value = strip_tags(str_replace(array("\"", "'"), array("", ""), $get_value));
        if ($get_name != "sort" && $get_name != "type") {
            if ($count_get > 0) {
                $oldlink = $oldlink . "&amp;" . $get_name . "=" . $get_value;
            } else {
                $oldlink = $oldlink . $get_name . "=" . $get_value;
            }
            $count_get++;
        }
    }
    if ($count_get > 0) {
        $oldlink = $oldlink . "&amp;";
    }
    $links = array('link1', 'link2', 'link3', 'link4', 'link5', 'link6', 'link7', 'link8', 'link9');
    $i = 1;
    foreach ($links as $link) {
        if (isset($_GET['sort']) && $_GET['sort'] == $i) {
            ${$link} = isset($_GET['type']) && $_GET['type'] == 'desc' ? 'asc' : 'desc';
        } else {
            ${$link} = 'desc';
        }
        $i++;
    }
    $htmlout .= "<table border='1' cellspacing='0' cellpadding='5'>\r\n   <tr>\r\n   <td class='colhead' align='center'>{$lang["torrenttable_type"]}</td>\r\n   <td class='colhead' align='left'><a href='{$TBDEV['baseurl']}/browse.php?{$oldlink}sort=1&amp;type={$link1}'>{$lang["torrenttable_name"]}</a></td>\r\n   <td class='colhead' align='left'><img src='" . $TBDEV['pic_base_url'] . "zip.gif' border='0' alt='Download' title='Download' /></td>";
    $htmlout .= $variant == 'index' ? "<td class='colhead' align='center'><a href='" . $TBDEV['baseurl'] . "/bookmarks.php'><img src='" . $TBDEV['pic_base_url'] . "bookmark.gif'  border='0' alt='Bookmark' title='Go To My Bookmarks' /></a></td>" : '';
    if ($variant == "mytorrents") {
        $htmlout .= "<td class='colhead' align='center'>{$lang["torrenttable_edit"]}</td>\n";
        $htmlout .= "<td class='colhead' align='center'>{$lang["torrenttable_visible"]}</td>\n";
    }
    $htmlout .= "<td class='colhead' align='right'><a href='{$TBDEV['baseurl']}/browse.php?{$oldlink}sort=2&amp;type={$link2}'>{$lang["torrenttable_files"]}</a></td>\r\n   <td class='colhead' align='right'><a href='{$TBDEV['baseurl']}/browse.php?{$oldlink}sort=3&amp;type={$link3}'>{$lang["torrenttable_comments"]}</a></td>\r\n   <td class='colhead' align='center'><a href='{$TBDEV['baseurl']}/browse.php?{$oldlink}sort=4&amp;type={$link4}'>{$lang["torrenttable_added"]}</a></td>\r\n   <td class='colhead' align='center'><a href='{$TBDEV['baseurl']}/browse.php?{$oldlink}sort=5&amp;type={$link5}'>{$lang["torrenttable_size"]}</a></td>\r\n   <td class='colhead' align='center'><a href='{$TBDEV['baseurl']}/browse.php?{$oldlink}sort=6&amp;type={$link6}'>{$lang["torrenttable_snatched"]}</a></td>\r\n   <td class='colhead' align='right'><a href='{$TBDEV['baseurl']}/browse.php?{$oldlink}sort=7&amp;type={$link7}'>{$lang["torrenttable_seeders"]}</a></td>\r\n   <td class='colhead' align='right'><a href='{$TBDEV['baseurl']}/browse.php?{$oldlink}sort=8&amp;type={$link8}'>{$lang["torrenttable_leechers"]}</a></td>";
    if ($variant == 'index') {
        $htmlout .= "<td class='colhead' align='center'><a href='{$TBDEV['baseurl']}/browse.php?{$oldlink}sort=9&amp;type={$link9}'>{$lang["torrenttable_uppedby"]}</a></td>\n";
    }
    $htmlout .= "</tr>\n";
    while ($row = mysql_fetch_assoc($res)) {
        $id = $row["id"];
        if ($row["sticky"] == "yes") {
            $htmlout .= "<tr class='highlight'>\n";
        } else {
            $htmlout .= "<tr>\n";
        }
        $htmlout .= "<td align='center' style='padding: 0px'>";
        if (isset($row["cat_name"])) {
            $htmlout .= "<a href='browse.php?cat={$row['category']}'>";
            if (isset($row["cat_pic"]) && $row["cat_pic"] != "") {
                $htmlout .= "<img border='0' src='{$TBDEV['pic_base_url']}caticons/{$row['cat_pic']}' alt='{$row['cat_name']}' />";
            } else {
                $htmlout .= $row["cat_name"];
            }
            $htmlout .= "</a>";
        } else {
            $htmlout .= "-";
        }
        $htmlout .= "</td>\n";
        $dispname = htmlspecialchars($row["name"]);
        $checked = !empty($row['checked_by']) && $CURUSER['class'] >= UC_USER ? "&nbsp;<img src='{$TBDEV['pic_base_url']}mod.gif' width='15' border='0' alt='Checked - by " . htmlspecialchars($row['checked_by']) . "' title='Checked - by " . htmlspecialchars($row['checked_by']) . "' />" : "";
        $poster = empty($row["poster"]) ? "<img src=\\'{$TBDEV['pic_base_url']}noposter.png\\' width=\\'150\\' height=\\'220\\' border=\\'0\\' alt=\\'Poster\\' title=\\'poster\\' />" : "<img src=\\'" . htmlspecialchars($row['poster']) . "\\' width=\\'150\\' height=\\'220\\' border=\\'0\\' alt=\\'Poster\\' title=\\'poster\\' />";
        if ($row["descr"]) {
            $descr = str_replace("\"", "&quot;", readMore($row["descr"], 350, "details.php?id=" . $row["id"] . "&amp;hit=1"));
        }
        $htmlout .= "<td align='left'><a href='details.php?";
        $htmlout .= "<td align='left'><a href='details.php?";
        if ($variant == "mytorrents") {
            $htmlout .= "returnto=" . urlencode($_SERVER["REQUEST_URI"]) . "&amp;";
        }
        $htmlout .= "id={$id}";
        if ($variant == "index") {
            $htmlout .= "&amp;hit=1";
        }
        $sticky = $row['sticky'] == "yes" ? "<img src='{$TBDEV['pic_base_url']}sticky.gif' border='0' alt='Sticky' title='Sticky !' />" : "";
        $nuked = $row["nuked"] == "yes" ? "<img src='{$TBDEV['pic_base_url']}nuked.gif' style='border:none' alt='Nuked'  align='right' title='Reason :" . htmlspecialchars($row["nukereason"]) . "' />" : "";
        /** FREE Torrent **/
        $free_tag = $row['free'] != 0 ? ' <a class="info" href="#"><b>[FREE]</b> <span>' . ($row['free'] > 1 ? 'Expires: ' . get_date($row['free'], 'DATE') . '<br />(' . mkprettytime($row['free'] - TIME_NOW) . ' to go)<br />' : 'Unlimited<br />') . '</span></a>' : $all_free_tag;
        /** Freeslot Slot in Use **/
        $isdlfree = $row['tid'] == $id && $row['uid'] == $CURUSER['id'] && $row['freeslot'] != 0 ? '<a class="info" href="#"><img src="' . $TBDEV['baseurl'] . '/pic/freedownload.gif" alt="" /><span>Freeleech slot in use<br />' . ($row['freeslot'] != 0 ? $row['freeslot'] > 1 ? 'Expires: ' . get_date($row['freeslot'], 'DATE') . '<br />(' . mkprettytime($row['freeslot'] - TIME_NOW) . ' to go)<br />' : 'Unlimited<br />' : '') . '</span></a>' : '';
        /** Double Upload Slot in Use **/
        $isdouble = $row['tid'] == $id && $row['uid'] == $CURUSER['id'] && $row['doubleup'] != 0 ? ' <a class="info" href="#"><img src="' . $TBDEV['baseurl'] . '/pic/doubleseed.gif" alt="" /><span>Double Upload slot in use<br />' . ($row['doubleup'] != 0 ? $row['doubleup'] > 1 ? 'Expires: ' . get_date($row['doubleup'], 'DATE') . '<br />(' . mkprettytime($row['doubleup'] - TIME_NOW) . ' to go)<br />' : 'Unlimited<br />' : '') . '</span></a>' : '';
        $htmlout .= "' onmouseover=\"Tip('<b>" . CutName($dispname, 80) . "</b><br /><b>Added:&nbsp;" . get_date($row['added'], 'DATE', 0, 1) . "</b><br /><b>Size:&nbsp;" . mksize(htmlspecialchars($row["size"])) . "</b><br /><b>Seeders:&nbsp;" . htmlspecialchars($row["seeders"]) . "</b><br /><b>Leechers:&nbsp;" . htmlspecialchars($row["leechers"]) . "</b><br />{$poster}');\" onmouseout=\"UnTip();\"><b>" . CutName($dispname, 45) . "</b></a>&nbsp;&nbsp;<a href=\"javascript:klappe_descr('descr" . $row["id"] . "');\" ><img src=\"/pic/plus.gif\" border=\"0\" alt=\"Show torrent info in this page\" title=\"Show torrent info in this page\" /></a>&nbsp;&nbsp;{$sticky}&nbsp;" . ($row['added'] >= $CURUSER['last_browse'] ? " <img src='{$TBDEV['pic_base_url']}newb.png' border='0' alt='New !' title='New !' />" : "") . "&nbsp;{$checked}&nbsp;{$free_tag}&nbsp;{$nuked}<br />\n" . $isdlfree . $isdouble . "</td>\n";
        if ($variant == "mytorrents") {
            $htmlout .= "<td align='center'><a href=\"download.php?torrent=" . $id . "\"><img src='" . $TBDEV['pic_base_url'] . "zip.gif' border='0' alt='Download This Torrent!' title='Download This Torrent!' /></a></td>\n";
        }
        if ($variant == "mytorrents") {
            $htmlout .= "<td align='center'><a href='edit.php?returnto=" . urlencode($_SERVER["REQUEST_URI"]) . "&amp;id={$row['id']}'>" . $lang["torrenttable_edit"] . "</a></td>\n";
        }
        $htmlout .= $variant == "index" ? "<td align='center'><a href=\"download.php?torrent=" . $id . "\"><img src='" . $TBDEV['pic_base_url'] . "zip.gif' border='0' alt='Download This Torrent!' title='Download This Torrent!' /></a></td>" : "";
        if ($variant == "mytorrents") {
            $htmlout .= "<td align='right'>";
            if ($row["visible"] == "no") {
                $htmlout .= "<b>" . $lang["torrenttable_not_visible"] . "</b>";
            } else {
                $htmlout .= "" . $lang["torrenttable_visible"] . "";
            }
            $htmlout .= "</td>\n";
        }
        $bookmarked = !isset($row["bookmark"]) ? "<a href='bookmark.php?torrent=" . $id . "&amp;action=add'><img src='" . $TBDEV['pic_base_url'] . "bookmark.gif' border='0' alt='Bookmark it!' title='Bookmark it!' /></a>" : "<a href='bookmark.php?torrent=" . $id . "&amp;action=delete'><img src='" . $TBDEV['pic_base_url'] . "plus2.gif' border='0' alt='Delete Bookmark!' title='Delete Bookmark!' /></a>";
        if ($variant == "index") {
            $htmlout .= "<td align='right'>{$bookmarked}</td>";
        }
        if ($row["type"] == "single") {
            $htmlout .= "<td align='right'>{$row["numfiles"]}</td>\n";
        } else {
            if ($variant == "index") {
                $htmlout .= "<td align='right'><b><a href='filelist.php?id={$id}'>" . $row["numfiles"] . "</a></b></td>\n";
            } else {
                $htmlout .= "<td align='right'><b><a href='filelist.php?id={$id}'>" . $row["numfiles"] . "</a></b></td>\n";
            }
        }
        if (!$row["comments"]) {
            $htmlout .= "<td align='right'>{$row["comments"]}</td>\n";
        } else {
            if ($variant == "index") {
                $htmlout .= "<td align='right'><b><a href='details.php?id={$id}&amp;hit=1&amp;tocomm=1'>" . $row["comments"] . "</a></b></td>\n";
            } else {
                $htmlout .= "<td align='right'><b><a href='details.php?id={$id}&amp;page=0#startcomments'>" . $row["comments"] . "</a></b></td>\n";
            }
        }
        $htmlout .= "<td align='center'><span style='white-space: nowrap;'>" . str_replace(",", "<br />", get_date($row['added'], '')) . "</span></td>\n";
        $htmlout .= "<td align='center'>" . str_replace(" ", "<br />", mksize($row["size"])) . "</td>\n";
        if ($row["times_completed"] != 1) {
            $_s = "" . $lang["torrenttable_time_plural"] . "";
        } else {
            $_s = "" . $lang["torrenttable_time_singular"] . "";
        }
        $htmlout .= "<td align='center'><a href='snatches.php?id={$id}'>" . number_format($row["times_completed"]) . "<br />{$_s}</a></td>\n";
        if ($row["seeders"]) {
            if ($variant == "index") {
                if ($row["leechers"]) {
                    $ratio = $row["seeders"] / $row["leechers"];
                } else {
                    $ratio = 1;
                }
                $htmlout .= "<td align='right'><b><a href='peerlist.php?id={$id}#seeders'>\r\n                <font color='" . get_slr_color($ratio) . "'>{$row["seeders"]}</font></a></b></td>\n";
            } else {
                $htmlout .= "<td align='right'><b><a class='" . linkcolor($row["seeders"]) . "' href='peerlist.php?id={$id}#seeders'>{$row["seeders"]}</a></b></td>\n";
            }
        } else {
            $htmlout .= "<td align='right'><span class='" . linkcolor($row["seeders"]) . "'>" . $row["seeders"] . "</span></td>\n";
        }
        if ($row["leechers"]) {
            if ($variant == "index") {
                $htmlout .= "<td align='right'><b><a href='peerlist.php?id={$id}#leechers'>" . number_format($row["leechers"]) . "</a></b></td>\n";
            } else {
                $htmlout .= "<td align='right'><b><a class='" . linkcolor($row["leechers"]) . "' href='peerlist.php?id={$id}#leechers'>{$row["leechers"]}</a></b></td>\n";
            }
        } else {
            $htmlout .= "<td align='right'>0</td>\n";
        }
        if ($variant == "index") {
            if ($row["anonymous"] == "yes") {
                $htmlout .= "<td align='center'><i>Anonymous</i></td>\n";
            } else {
                $htmlout .= "<td align='center'>" . (isset($row["username"]) ? "<a href='{$TBDEV['baseurl']}/userdetails.php?id=" . $row["owner"] . "'><b>" . htmlspecialchars($row["username"]) . "</b></a>" : "<i>(" . $lang["torrenttable_unknown_uploader"] . ")</i>") . "</td>\n";
            }
        }
        $htmlout .= "</tr>\n";
    }
    $htmlout .= "</table>\n";
    return $htmlout;
}
Example #14
0
    $HTMLOUT .= "<div class='col-sm-10'><input class='form-control' placeholder='Nuke Reason' type='text' name='nukereason' value='" . htmlsafechars($row["nukereason"]) . "' /></div></div>";
}
$HTMLOUT .= "<br><div class='row'><div class='col-sm-12'></div></div>";
$HTMLOUT .= "<br><div class='row'>\n<div class='col-sm-4'>";
if ($CURUSER['class'] >= UC_STAFF && XBT_TRACKER == false) {
    $HTMLOUT .= tr("Free Leech", $row['free'] != 0 ? "<input type='checkbox' name='fl' value='1' /> Remove Freeleech" : "\n    <select name='free_length'>\n    <option value='0'>------</option>\n    <option value='42'>Free for 1 day</option>\n    <option value='1'>Free for 1 week</option>\n    <option value='2'>Free for 2 weeks</option>\n    <option value='4'>Free for 4 weeks</option>\n    <option value='8'>Free for 8 weeks</option>\n    <option value='255'>Unlimited</option>\n    </select>", 1);
    if ($row['free'] != 0) {
        $HTMLOUT .= "<br>";
        $HTMLOUT .= tr("Free Leech Duration", $row['free'] != 1 ? "Until " . get_date($row['free'], 'DATE') . " \n\t\t (" . mkprettytime($row['free'] - TIME_NOW) . " to go)" : 'Unlimited', 1);
    }
}
$HTMLOUT .= "</div>";
$HTMLOUT .= "<div class='col-sm-4'>";
$HTMLOUT .= tr("Silver torrent ", $row['silver'] != 0 ? "<input type='checkbox' name='slvr' value='1' /> Remove Silver torrent" : "\n    <select name='half_length'>\n    <option value='0'>------</option>\n    <option value='42'>Silver for 1 day</option>\n    <option value='1'>Silver for 1 week</option>\n    <option value='2'>Silver for 2 weeks</option>\n    <option value='4'>Silver for 4 weeks</option>\n    <option value='8'>Silver for 8 weeks</option>\n    <option value='255'>Unlimited</option>\n    </select>", 1);
if ($row['silver'] != 0) {
    $HTMLOUT .= tr("Silver Torrent Duration", $row['silver'] != 1 ? "Until " . get_date($row['silver'], 'DATE') . " \n\t\t (" . mkprettytime($row['silver'] - TIME_NOW) . " to go)" : 'Unlimited', 1);
}
$HTMLOUT .= "</div>";
// ===09 Allow Comments
if ($CURUSER['class'] >= UC_STAFF && $CURUSER['class'] == UC_MAX) {
    if ($row["allow_comments"] == "yes") {
        $messc = "&nbsp;<br>Comments are allowed for everyone on this torrent!";
    } else {
        $messc = "&nbsp;<br>Only staff members are able to comment on this torrent!";
    }
    $HTMLOUT .= "<div class='col-sm-4'><font color='red'>&nbsp;*&nbsp;</font><b>&nbsp;{$lang['edit_comment']}</b>\n    <select name='allow_comments'>\n    <option value='" . htmlsafechars($row["allow_comments"]) . "'>" . htmlsafechars($row["allow_comments"]) . "</option>\n    <option value='yes'>Yes</option><option value='no'>No</option></select>{$messc}\n";
}
// ===end
$HTMLOUT .= "</div></div>";
$HTMLOUT .= "<br><div class='row'><div class='col-sm-12'></div></div>";
$HTMLOUT .= "<div class='row'>";
     <option value="8">' . $lang['userdetails_warn8'] . '</option>
     <option value="255">' . $lang['userdetails_warninf'] . '</option>
     </select></td></tr>
     <tr><td colspan="2" align="left">' . $lang['userdetails_pm_comm'] . '<input type="text" size="60" name="warned_pm" /></td></tr>';
     }
 }
 //==End
 //==Games disable
 if ($CURUSER['class'] >= UC_STAFF) {
     $game_access = $user['game_access'] != 1;
     $HTMLOUT .= "<tr><td class='rowhead'" . (!$game_access ? ' rowspan="2"' : '') . ">{$lang['userdetails_games']}</td>\n           <td align='left' width='20%'>" . ($game_access ? "<input name='game_access' value='42' type='radio' />{$lang['userdetails_remove_game_d']}" : $lang['userdetails_no_disablement']) . "</td>\n";
     if ($game_access) {
         if ($user['game_access'] == 0) {
             $HTMLOUT .= '<td align="center">(' . $lang['userdetails_unlimited_d'] . ')</td></tr>';
         } else {
             $HTMLOUT .= "<td align='center'>{$lang['userdetails_until']} " . get_date($user['game_access'], 'DATE') . " (" . mkprettytime($user['game_access'] - TIME_NOW) . " {$lang['userdetails_togo']})</td></tr>";
         }
     } else {
         $HTMLOUT .= '<td>' . $lang['userdetails_disable_for'] . ' <select name="game_access">
     <option value="0">------</option>
     <option value="1">1 ' . $lang['userdetails_week'] . '</option>
     <option value="2">2 ' . $lang['userdetails_weeks'] . '</option>
     <option value="4">4 ' . $lang['userdetails_weeks'] . '</option>
     <option value="8">8 ' . $lang['userdetails_weeks'] . '</option>
     <option value="255">' . $lang['userdetails_unlimited'] . '</option>
     </select></td></tr>
     <tr><td colspan="2" align="left">' . $lang['userdetails_pm_comment'] . ':<input type="text" size="60" name="game_disable_pm" /></td></tr>';
     }
 }
 if (XBT_TRACKER == true) {
     // == Wait time
Example #16
0
 *   Copyright (C) 2010 U-232 v.3
 *   A bittorrent tracker source based on TBDev.net/tbsource/bytemonsoon.
 *   Project Leaders: Mindless, putyn.
 *
 */
if (!defined('IN_LOTTERY')) {
    die('You can\'t access this file directly!');
}
ini_set('display_errors', 1);
//get config from database
$lconf = sql_query('SELECT * FROM lottery_config') or sqlerr(__FILE__, __LINE__);
while ($ac = mysqli_fetch_assoc($lconf)) {
    $lottery_config[$ac['name']] = $ac['value'];
}
if (!$lottery_config['enable']) {
    stderr('Sorry', 'Lottery is closed');
}
$html = begin_main_frame() . begin_frame('Lottery stats');
$html .= "<h2>Lottery started on <b>" . get_date($lottery_config['start_date'], 'LONG') . "</b> and ends on <b>" . get_date($lottery_config['end_date'], 'LONG') . "</b> remaining <span style='color:#ff0000;'>" . mkprettytime($lottery_config['end_date'] - TIME_NOW) . "</span></h2>";
$qs = sql_query('SELECT count(t.id) as tickets , u.username, u.id, u.seedbonus FROM tickets as t LEFT JOIN users as u ON u.id = t.user GROUP BY u.id ORDER BY tickets DESC, username ASC') or sqlerr(__FILE__, __LINE__);
if (!mysqli_num_rows($qs)) {
    $html .= "<h2>Not tickets were bought</h2>";
} else {
    $html .= "<table width='80%' cellpadding='5' cellspacing='0' border='1' align='center'>\r\n    <tr>\r\n      <td width='100%'>Username</td>\r\n      <td style='white-space:nowrap;'>tickets</td>\r\n      <td style='white-space:nowrap;'>seedbonus</td>\r\n    </tr>";
    while ($ar = mysqli_fetch_assoc($qs)) {
        $html .= "<tr>\r\n                  <td align='left'><a href='userdetails.php?id=" . (int) $ar['id'] . "'>" . htmlsafechars($ar['username']) . "</a></td>\r\n                  <td align='center'>" . (int) $ar['tickets'] . "</td>\r\n                  <td align='center'>" . (double) $ar['seedbonus'] . "</td>\r\n        </tr>";
    }
    $html .= "</table>";
}
$html .= end_frame() . end_main_frame();
echo stdhead('Lottery tickets') . $html . stdfoot();
function torrenttable($res, $variant = "index")
{
    global $INSTALLER09, $CURUSER, $lang, $free, $mc1;
    require_once INCL_DIR . 'bbcode_functions.php';
    $htmlout = $prevdate = $free_slot = $free_color = $slots_check = $double_slot = $private = $newgenre = $oldlink = $char = $description = $type = $sort = $row = $youtube = '';
    $count_get = 0;
    /** ALL FREE/DOUBLE **/
    foreach ($free as $fl) {
        switch ($fl['modifier']) {
            case 1:
                $free_display = '[Free]';
                break;
            case 2:
                $free_display = '[Double]';
                break;
            case 3:
                $free_display = '[Free and Double]';
                break;
            case 4:
                $free_display = '[Silver]';
                break;
        }
        $slot = make_freeslots($CURUSER['id'], 'fllslot_');
        $book = make_bookmarks($CURUSER['id'], 'bookmm_');
        $all_free_tag = $fl['modifier'] != 0 && ($fl['expires'] > TIME_NOW || $fl['expires'] == 1) ? ' <a class="info" href="#">
            <b>' . $free_display . '</b> 
            <span>' . ($fl['expires'] != 1 ? '
            Expires: ' . get_date($fl['expires'], 'DATE') . '<br />
            (' . mkprettytime($fl['expires'] - TIME_NOW) . ' to go)</span></a><br />' : 'Unlimited</span></a><br />') : '';
    }
    $oldlink = array();
    foreach ($_GET as $key => $var) {
        if (in_array($key, array('sort', 'type'))) {
            continue;
        }
        if (is_array($var)) {
            foreach ($var as $s_var) {
                $oldlink[] = sprintf('%s=%s', urlencode($key) . '%5B%5D', urlencode($s_var));
            }
        } else {
            $oldlink[] = sprintf('%s=%s', urlencode($key), urlencode($var));
        }
    }
    $oldlink = !empty($oldlink) ? join('&amp;', array_map('htmlsafechars', $oldlink)) . '&amp;' : '';
    $links = array('link1', 'link2', 'link3', 'link4', 'link5', 'link6', 'link7', 'link8', 'link9');
    $i = 1;
    foreach ($links as $link) {
        if (isset($_GET['sort']) && $_GET['sort'] == $i) {
            ${$link} = isset($_GET['type']) && $_GET['type'] == 'desc' ? 'asc' : 'desc';
        } else {
            ${$link} = 'desc';
        }
        $i++;
    }
    $htmlout .= "<!--<div class='global_icon'><img src='images/global.design/torrents.png' alt='' title='Categorys' class='global_image' width='25'/></div>\n    <div class='global_head'>Torrents</div><br />\n    <div class='global_text'><br />-->\n   <table border='1' cellspacing='0' cellpadding='5'>\n   <tr>\n   <td class='colhead' align='center'>{$lang["torrenttable_type"]}</td>\n   <td class='colhead' align='left'><a href='{$_SERVER["PHP_SELF"]}?{$oldlink}sort=1&amp;type={$link1}'>{$lang["torrenttable_name"]}</a></td>\n   <td class='colhead' align='left'><img src='{$INSTALLER09['pic_base_url']}zip.gif' border='0' alt='Download' title='Download' /></td>";
    $htmlout .= $variant == 'index' ? "<td class='colhead' align='center'><a href='{$INSTALLER09['baseurl']}/bookmarks.php'><img src='{$INSTALLER09['pic_base_url']}bookmarks.png'  border='0' alt='Bookmark' title='Go To My Bookmarks' /></a></td>" : '';
    if ($variant == "mytorrents") {
        $htmlout .= "<td class='colhead' align='center'>{$lang["torrenttable_edit"]}</td>\n";
        $htmlout .= "<td class='colhead' align='center'>{$lang["torrenttable_visible"]}</td>\n";
    }
    $htmlout .= "<td class='colhead' align='right'><a href='{$_SERVER["PHP_SELF"]}?{$oldlink}sort=2&amp;type={$link2}'>{$lang["torrenttable_files"]}</a></td>\n   <td class='colhead' align='right'><a href='{$_SERVER["PHP_SELF"]}?{$oldlink}sort=3&amp;type={$link3}'>{$lang["torrenttable_comments"]}</a></td>\n   <td class='colhead' align='center'><a href='{$_SERVER["PHP_SELF"]}?{$oldlink}sort=4&amp;type={$link4}'>{$lang["torrenttable_added"]}</a></td>\n   <td class='colhead' align='center'><a href='{$_SERVER["PHP_SELF"]}?{$oldlink}sort=5&amp;type={$link5}'>{$lang["torrenttable_size"]}</a></td>\n   <td class='colhead' align='center'><a href='{$_SERVER["PHP_SELF"]}?{$oldlink}sort=6&amp;type={$link6}'>{$lang["torrenttable_snatched"]}</a></td>\n   <td class='colhead' align='right'><a href='{$_SERVER["PHP_SELF"]}?{$oldlink}sort=7&amp;type={$link7}'>{$lang["torrenttable_seeders"]}</a></td>\n   <td class='colhead' align='right'><a href='{$_SERVER["PHP_SELF"]}?{$oldlink}sort=8&amp;type={$link8}'>{$lang["torrenttable_leechers"]}</a></td>";
    if ($variant == 'index') {
        $htmlout .= "<td class='colhead' align='center'><a href='{$_SERVER["PHP_SELF"]}?{$oldlink}sort=9&amp;type={$link9}'>{$lang["torrenttable_uppedby"]}</a></td>\n";
    }
    $htmlout .= "</tr>\n";
    $categories = genrelist();
    foreach ($categories as $key => $value) {
        $change[$value['id']] = array('id' => $value['id'], 'name' => $value['name'], 'image' => $value['image']);
    }
    while ($row = mysqli_fetch_assoc($res)) {
        //== @author StarionTurbo @copyright 2007 @modname Show torrents by day @version v1.0
        if ($CURUSER['split'] == 'yes') {
            if (get_date($row['added'], 'DATE') == $prevdate) {
                $cleandate = '';
            } else {
                $htmlout .= "<tr><td colspan='12' class='colhead' align='left'><b>{$lang['torrenttable_upped']} " . get_date($row['added'], 'DATE') . "</b></td></tr>";
            }
            $prevdate = get_date($row['added'], 'DATE');
        }
        $row['cat_name'] = htmlsafechars($change[$row['category']]['name']);
        $row['cat_pic'] = htmlsafechars($change[$row['category']]['image']);
        /** Freeslot/doubleslot in Use **/
        $id = $row["id"];
        foreach ($slot as $sl) {
            $slots_check = ($sl['torrentid'] == $id && $sl['free'] == 'yes' or $sl['doubleup'] == 'yes');
        }
        if ($row["sticky"] == "yes") {
            $htmlout .= "<tr class='highlight'>\n";
        } else {
            $htmlout .= '<tr class="' . ($free_color && $all_free_tag != '' || $row['free'] != 0 || $slots_check ? 'freeleech_color' : 'browse_color') . '">';
        }
        $htmlout .= "<td align='center' style='padding: 0px'>";
        if (isset($row["cat_name"])) {
            $htmlout .= "<a href='browse.php?cat=" . (int) $row['category'] . "'>";
            if (isset($row["cat_pic"]) && $row["cat_pic"] != "") {
                $htmlout .= "<img border='0' src='{$INSTALLER09['pic_base_url']}caticons/{$CURUSER['categorie_icon']}/{$row['cat_pic']}' alt='{$row['cat_name']}' />";
            } else {
                $htmlout .= htmlsafechars($row["cat_name"]);
            }
            $htmlout .= "</a>";
        } else {
            $htmlout .= "-";
        }
        $htmlout .= "</td>\n";
        $dispname = htmlsafechars($row["name"]);
        $smalldescr = !empty($row['description']) ? "<i>[" . htmlsafechars($row['description']) . "]</i>" : "";
        $checked = !empty($row['checked_by']) && $CURUSER['class'] >= UC_USER ? "&nbsp;<img src='{$INSTALLER09['pic_base_url']}mod.gif' width='15' border='0' alt='Checked - by " . htmlsafechars($row['checked_by']) . "' title='Checked - by " . htmlsafechars($row['checked_by']) . "' />" : "";
        $poster = empty($row["poster"]) ? "<img src=\\'{$INSTALLER09['pic_base_url']}noposter.png\\' width=\\'150\\' height=\\'220\\' border=\\'0\\' alt=\\'Poster\\' title=\\'poster\\' />" : "<img src=\\'" . htmlsafechars($row['poster']) . "\\' width=\\'150\\' height=\\'220\\' border=\\'0\\' alt=\\'Poster\\' title=\\'poster\\' />";
        //$rating = empty($row["rating"]) ? "No votes yet":"".ratingpic($row["rating"])."";
        $youtube = !empty($row['youtube']) ? "<a href='" . htmlsafechars($row['youtube']) . "' target='_blank'><img src='{$INSTALLER09['pic_base_url']}youtube.png' width='14' height='14' border='0' alt='Youtube Trailer' title='Youtube Trailer' /></a>" : "";
        if (isset($row["descr"])) {
            $descr = str_replace("\"", "&quot;", readMore($row["descr"], 350, "details.php?id=" . (int) $row["id"] . "&amp;hit=1"));
        }
        $descr = str_replace('&', '&amp;', $descr);
        $htmlout .= "<td align='left'><a href='details.php?";
        if ($variant == "mytorrents") {
            $htmlout .= "returnto=" . urlencode($_SERVER["REQUEST_URI"]) . "&amp;";
        }
        $htmlout .= "id={$id}";
        if ($variant == "index") {
            $htmlout .= "&amp;hit=1";
        }
        $newgenre = '';
        if (!empty($row['newgenre'])) {
            $newgenre = array();
            $row['newgenre'] = explode(',', $row['newgenre']);
            foreach ($row['newgenre'] as $foo) {
                $newgenre[] = '<a href="browse.php?search=' . trim(strtolower($foo)) . '&amp;searchin=genre">' . $foo . '</a>';
            }
            $newgenre = '<i>' . join(', ', $newgenre) . '</i>';
        }
        $sticky = $row['sticky'] == "yes" ? "<img src='{$INSTALLER09['pic_base_url']}sticky.gif' style='border:none' alt='Sticky' title='Sticky !' />" : "";
        $nuked = $row["nuked"] == "yes" ? "<img src='{$INSTALLER09['pic_base_url']}nuked.gif' style='border:none' alt='Nuked'  align='right' title='Reason :" . htmlsafechars($row["nukereason"]) . "' />" : "";
        $release_group = $row['release_group'] == "scene" ? "&nbsp;<img src='{$INSTALLER09['pic_base_url']}scene.gif' title='Scene' alt='Scene' style='border:none' />" : ($row['release_group'] == "p2p" ? "&nbsp;<img src='{$INSTALLER09['pic_base_url']}p2p.gif' title='P2P' alt='P2P' />" : "");
        $viponly = $row["vip"] == "1" ? "<img src='{$INSTALLER09['pic_base_url']}star.png' border='0' alt='Vip Torrent' title='Vip Torrent' />" : "";
        $bump = $row['bump'] == "yes" ? "<img src='{$INSTALLER09['pic_base_url']}up.gif' width='12px' alt='Re-Animated torrent' title='This torrent was ReAnimated!' />" : "";
        /** FREE Torrent **/
        $free_tag = $row['free'] != 0 ? ' <a class="info" href="#"><b>[FREE]</b> <span>' . ($row['free'] > 1 ? 'Expires: ' . get_date($row['free'], 'DATE') . '<br />(' . mkprettytime($row['free'] - TIME_NOW) . ' to go)<br />' : 'Unlimited<br />') . '</span></a>' : $all_free_tag;
        /** Silver Torrent **/
        $silver_tag = $row['silver'] != 0 ? ' <a class="info" href="#"><b>[SILVER]</b> <span>' . ($row['silver'] > 1 ? 'Expires: ' . get_date($row['silver'], 'DATE') . '<br />(' . mkprettytime($row['silver'] - TIME_NOW) . ' to go)<br />' : 'Unlimited<br />') . '</span></a>' : '';
        if (!empty($slot)) {
            foreach ($slot as $sl) {
                if ($sl['torrentid'] == $id && $sl['free'] == 'yes') {
                    $free_slot = 1;
                }
                if ($sl['torrentid'] == $id && $sl['doubleup'] == 'yes') {
                    $double_slot = 1;
                }
                if ($free_slot && $double_slot) {
                    break;
                }
            }
        }
        $free_slot = $free_slot == 1 ? '&nbsp;<img src="' . $INSTALLER09['pic_base_url'] . 'freedownload.gif" width="12px" alt="Free Slot" title="Free Slot in Use" />&nbsp;<small>Free Slot</small>' : '';
        $double_slot = $double_slot == 1 ? '&nbsp;<img src="' . $INSTALLER09['pic_base_url'] . 'doubleseed.gif" width="12px" alt="Double Upload Slot" title="Double Upload Slot in Use" />&nbsp;<small>Double Slot</small>' : '';
        //==
        $Subs = '';
        if (in_array($row["category"], $INSTALLER09['movie_cats']) && !empty($row["subs"])) {
            $subs_array = explode(",", $row["subs"]);
            require_once CACHE_DIR . 'subs.php';
            foreach ($subs_array as $k => $sid) {
                foreach ($subs as $sub) {
                    if ($sub["id"] == $sid) {
                        $Subs = "<img border=\\'0\\' width=\\'16px\\' style=\\'padding:3px;\\' src=\\'{$sub["pic"]}\\' alt=\\'{$sub["name"]}\\' title=\\'{$sub["name"]}\\' />";
                    }
                }
            }
        } else {
            $Subs = "---";
        }
        $htmlout .= "' onmouseover=\"Tip('<b>" . CutName($dispname, 80) . "</b><br /><b>Added:&nbsp;" . get_date($row['added'], 'DATE', 0, 1) . "</b><br /><b>Size:&nbsp;" . mksize(htmlsafechars($row["size"])) . "</b><br /><b>Subtitle:&nbsp;{$Subs}</b><br /><b>Seeders:&nbsp;" . htmlsafechars($row["seeders"]) . "</b><br /><b>Leechers:&nbsp;" . htmlsafechars($row["leechers"]) . "</b><br />{$poster}');\" onmouseout=\"UnTip();\"><b>" . CutName($dispname, 45) . "</b></a>&nbsp;&nbsp;<a href=\"javascript:klappe_descr('descr" . (int) $row["id"] . "');\" ><img src=\"{$INSTALLER09['pic_base_url']}plus.png\" border=\"0\" alt=\"Show torrent info in this page\" title=\"Show torrent info in this page\" /></a>&nbsp;&nbsp;{$youtube}&nbsp;{$viponly}&nbsp;{$release_group}&nbsp;{$sticky}&nbsp;" . ($row['added'] >= $CURUSER['last_browse'] ? " <img src='{$INSTALLER09['pic_base_url']}newb.png' border='0' alt='New !' title='New !' />" : "") . "&nbsp;{$checked}&nbsp;{$free_tag}&nbsp;{$silver_tag}&nbsp;{$nuked}<br />{$free_slot}&nbsp;{$double_slot}&nbsp;{$newgenre}&nbsp;{$bump}&nbsp;{$smalldescr}</td>\n";
        if ($variant == "mytorrents") {
            $htmlout .= "<td align='center'><a href=\"download.php?torrent={$id}" . ($CURUSER['ssluse'] == 3 ? "&amp;ssl=1" : "") . "\"><img src='{$INSTALLER09['pic_base_url']}zip.gif' border='0' alt='Download This Torrent!' title='Download This Torrent!' /></a></td>\n";
        }
        if ($variant == "mytorrents") {
            $htmlout .= "<td align='center'><a href='edit.php?id=" . (int) $row['id'] . "amp;returnto=" . urlencode($_SERVER["REQUEST_URI"]) . "'>{$lang["torrenttable_edit"]}</a></td>\n";
        }
        $htmlout .= $variant == "index" ? "<td align='center'><a href=\"download.php?torrent={$id}" . ($CURUSER['ssluse'] == 3 ? "&amp;ssl=1" : "") . "\"><img src='{$INSTALLER09['pic_base_url']}zip.gif' border='0' alt='Download This Torrent!' title='Download This Torrent!' /></a></td>" : "";
        if ($variant == "mytorrents") {
            $htmlout .= "<td align='right'>";
            if ($row["visible"] == "no") {
                $htmlout .= "<b>{$lang["torrenttable_not_visible"]}</b>";
            } else {
                $htmlout .= "{$lang["torrenttable_visible"]}";
            }
            $htmlout .= "</td>\n";
        }
        /** pdq bookmarks **/
        $booked = '';
        if (!empty($book)) {
            foreach ($book as $bk) {
                if ($bk['torrentid'] == $id) {
                    $booked = 1;
                }
            }
        }
        $rm_status = !$booked ? ' style="display:none;"' : ' style="display:inline;"';
        $bm_status = $booked ? ' style="display:none;"' : ' style="display:inline;"';
        $bookmark = '<span id="bookmark' . $id . '"' . $bm_status . '>
                    <a href="bookmark.php?torrent=' . $id . '&amp;action=add" class="bookmark" name="' . $id . '">
                    <span title="Bookmark it!" class="add_bookmark_b">
                    <img src="' . $INSTALLER09['pic_base_url'] . 'aff_tick.gif" align="top" width="14px" alt="Bookmark it!" title="Bookmark it!" />
                    </span>
                    </a>
                    </span>
                    
                    <span id="remove' . $id . '"' . $rm_status . '>
                    <a href="bookmark.php?torrent=' . $id . '&amp;action=delete" class="remove" name="' . $id . '">
                    <span class="remove_bookmark_b">
                    <img src="' . $INSTALLER09['pic_base_url'] . 'aff_cross.gif" align="top" width="14px" alt="Delete Bookmark!" title="Delete Bookmark!" />
                    </span>
                    </a>
                    </span>';
        if ($variant == "index") {
            $htmlout .= "<td align='right'>{$bookmark}</td>";
        }
        if ($row["type"] == "single") {
            $htmlout .= "<td align='right'>" . (int) $row["numfiles"] . "</td>\n";
        } else {
            if ($variant == "index") {
                $htmlout .= "<td align='right'><b><a href='filelist.php?id={$id}'>" . (int) $row["numfiles"] . "</a></b></td>\n";
            } else {
                $htmlout .= "<td align='right'><b><a href='filelist.php?id={$id}'>" . (int) $row["numfiles"] . "</a></b></td>\n";
            }
        }
        if (!$row["comments"]) {
            $htmlout .= "<td align='right'>" . (int) $row["comments"] . "</td>\n";
        } else {
            if ($variant == "index") {
                $htmlout .= "<td align='right'><b><a href='details.php?id={$id}&amp;hit=1&amp;tocomm=1'>" . (int) $row["comments"] . "</a></b></td>\n";
            } else {
                $htmlout .= "<td align='right'><b><a href='details.php?id={$id}&amp;page=0#startcomments'>" . (int) $row["comments"] . "</a></b></td>\n";
            }
        }
        $htmlout .= "<td align='center'><span style='white-space: nowrap;'>" . str_replace(",", "<br />", get_date($row['added'], '')) . "</span></td>\n";
        $htmlout .= "<td align='center'>" . str_replace(" ", "<br />", mksize($row["size"])) . "</td>\n";
        if ($row["times_completed"] != 1) {
            $_s = "" . $lang["torrenttable_time_plural"] . "";
        } else {
            $_s = "" . $lang["torrenttable_time_singular"] . "";
        }
        $htmlout .= "<td align='center'><a href='snatches.php?id={$id}'>" . number_format($row["times_completed"]) . "<br />{$_s}</a></td>\n";
        if ($row["seeders"]) {
            if ($variant == "index") {
                if ($row["leechers"]) {
                    $ratio = $row["seeders"] / $row["leechers"];
                } else {
                    $ratio = 1;
                }
                $htmlout .= "<td align='right'><b><a href='peerlist.php?id={$id}#seeders'><font color='" . get_slr_color($ratio) . "'>" . (int) $row["seeders"] . "</font></a></b></td>\n";
            } else {
                $htmlout .= "<td align='right'><b><a class='" . linkcolor($row["seeders"]) . "' href='peerlist.php?id={$id}#seeders'>" . (int) $row["seeders"] . "</a></b></td>\n";
            }
        } else {
            $htmlout .= "<td align='right'><span class='" . linkcolor($row["seeders"]) . "'>" . (int) $row["seeders"] . "</span></td>\n";
        }
        if ($row["leechers"]) {
            if ($variant == "index") {
                $htmlout .= "<td align='right'><b><a href='peerlist.php?id={$id}#leechers'>" . number_format($row["leechers"]) . "</a></b></td>\n";
            } else {
                $htmlout .= "<td align='right'><b><a class='" . linkcolor($row["leechers"]) . "' href='peerlist.php?id={$id}#leechers'>" . (int) $row["leechers"] . "</a></b></td>\n";
            }
        } else {
            $htmlout .= "<td align='right'>0</td>\n";
        }
        if ($variant == "index") {
            $htmlout .= "<td align='center'>" . (isset($row["username"]) ? $row["anonymous"] == "yes" && $CURUSER['class'] < UC_STAFF && $row['owner'] != $CURUSER['id'] ? "<i>" . $lang['torrenttable_anon'] . "</i>" : "<a href='userdetails.php?id=" . (int) $row["owner"] . "'><b>" . htmlsafechars($row["username"]) . "</b></a>" : "<i>(" . $lang["torrenttable_unknown_uploader"] . ")</i>") . "</td>\n";
        }
        $htmlout .= "</tr>\n";
        $htmlout .= "<tr id=\"kdescr" . (int) $row["id"] . "\" style=\"display:none;\"><td width=\"100%\" colspan=\"12\">" . format_comment($descr, false) . "</td></tr>\n";
    }
    $htmlout .= "</table><!--</div>-->\n";
    return $htmlout;
}
function flood_limit($table)
{
    global $CURUSER, $INSTALLER09, $lang;
    if (!file_exists($INSTALLER09['flood_file']) || !is_array($max = unserialize(file_get_contents($INSTALLER09['flood_file'])))) {
        return;
    }
    if (!isset($max[$CURUSER['class']])) {
        return;
    }
    $tb = array('posts' => 'posts.userid', 'comments' => 'comments.user', 'messages' => 'messages.sender');
    $q = sql_query('SELECT min(' . $table . '.added) as first_post, count(' . $table . '.id) as how_many FROM ' . $table . ' WHERE ' . $tb[$table] . ' = ' . $CURUSER['id'] . ' AND ' . TIME_NOW . ' - ' . $table . '.added < ' . $INSTALLER09['flood_time']);
    $a = mysqli_fetch_assoc($q);
    if ($a['how_many'] > $max[$CURUSER['class']]) {
        stderr($lang['gl_sorry'], $lang['gl_flood_msg'] . '' . mkprettytime($INSTALLER09['flood_time'] - (TIME_NOW - $a['first_post'])));
    }
}
Example #19
0
if (isset($free) && count($free) < 1) {
    $HTMLOUT .= '<h1>Current Freeleech Status</h1>
                 <p align="center"><b>Nothing found</b></p>';
} else {
    $HTMLOUT .= "<br /><table border='1' cellspacing='0' cellpadding='5'>\r\n        <tr><td class='colhead' align='left'>Free All Torrents</td>\r\n\t\t<td class='colhead' align='left'>Expires</td>\r\n        <td class='colhead' align='left'>Set By</td>\r\n\t\t<td class='colhead' align='left'>Title</td>\r\n\t\t<td class='colhead' align='left'>Message</td>\r\n\t\t<td class='colhead' align='left'>Remove</td></tr>";
    $checked1 = $checked2 = $checked3 = '';
    foreach ($free as $fl) {
        switch ($fl['modifier']) {
            case 1:
                $checked1 = 'checked=\'checked\'';
                $mode = 'All Torrents Free';
                break;
            case 2:
                $mode = 'All Double Upload';
                $checked2 = 'checked=\'checked\'';
                break;
            case 3:
                $mode = 'All Torrents Free and Double Upload';
                $checked3 = 'checked=\'checked\'';
                break;
            default:
                $mode = 'Not Enabled';
        }
        $HTMLOUT .= "<tr><td>{$mode}\r\n\t\t     </td><td align='left'>" . ($fl['expires'] != 'Inf.' && $fl['expires'] != 1 ? "Until " . get_date($fl['expires'], 'DATE') . " (" . mkprettytime($fl['expires'] - time()) . " to go)" : 'Unlimited') . " </td>\r\n\t\t\t <td align='left'>{$fl['setby']}</td>\r\n\t\t\t <td align='left'>{$fl['title']}</td>\r\n\t\t\t <td align='left'>{$fl['message']}</td>\r\n\t\t     <td><a href='admin.php?action=freeleech&amp;remove'>Remove</a>\r\n\t\t\t </td></tr>";
    }
    $HTMLOUT .= '</table>';
}
$checked = 'checked=\'checked\'';
$HTMLOUT .= "<h2>Set Freeleech</h2>\r\n\t<form method='post' action='admin.php?action=freeleech'>\r\n\t<table border='1' cellspacing='0' cellpadding='5'>\r\n\t<tr><td class='rowhead'>Mode</td>\r\n\t<td> <table width='100%'>\r\n <tr>\r\n <td align='left'>All Torrents Free</td>\r\n <td><input name=\"modifier\" type=\"radio\" {$checked1} value=\"1\" /></td>\r\n </tr>\r\n <tr>\r\n <td>All Torrents Double Upload</td>\r\n <td><input name=\"modifier\" type=\"radio\" {$checked2} value=\"2\" /></td>\r\n </tr>\r\n <tr>\r\n <td >All Torrents Free and Double Upload</td>\r\n <td><input name=\"modifier\" type=\"radio\" {$checked3} value=\"3\" /></td></tr>\r\n </table>\r\n    </td></tr>\r\n\t<tr><td class='rowhead'>Expires in\r\n\t</td><td>\r\n\t<select name='expires'>\r\n    <option value='1'>1 day</option>\r\n    <option value='2'>2 days</option>\r\n    <option value='5'>5 days</option>\r\n    <option value='7'>7 days</option>\r\n    <option value='255'>Unlimited</option>\r\n    </select></td></tr>\r\n\t<tr><td class='rowhead'>Title</td>\r\n\t<td><input type='text' size='40' name='title' value='{$fl['title']}' />\r\n\t</td></tr>\r\n\t\t<tr><td class='rowhead'>Message</td>\r\n\t<td><input type='text' size='40' name='message' value='{$fl['message']}' />\r\n\t</td></tr>\r\n\t\t\t<tr><td class='rowhead'>Set By</td>\r\n\t<td><input type='text' size='40' value ='" . $CURUSER['username'] . "' name='setby' />\r\n\t</td></tr>\r\n\t<tr><td colspan='2' align='center'>\r\n\t<input type='submit' name='okay' value='Do it!' class='btn' />\r\n\t</td></tr>\r\n\t<tr><td colspan='2' align='center'>\r\n\t<input type='hidden' name='cacheit' value='Cache' class='btn' />\r\n\t</td></tr>\r\n\t</table></form>";
echo stdhead('Freeleech Status') . $HTMLOUT . stdfoot();
die;
Example #20
0
 <option value="8">' . $lang['userdetails_warn8'] . '</option>
 <option value="90">' . $lang['userdetails_warninf'] . '</option>
 </select></div>
 <div class="col-sm-6"><input placeholder="Comments" class="form-control" type="text" name="warned_pm"></div></div>';
     }
 }
 //==End
 //==Games disable
 if ($CURUSER['class'] >= UC_STAFF) {
     $game_access = $user['game_access'] != 1;
     $HTMLOUT .= "<br><div class='row'><div class='col-sm-2'" . (!$game_access ? ' rowspan="2"' : '') . ">{$lang['userdetails_games']}</div>\n           <div class='col-sm-2'>" . ($game_access ? "<input name='game_access' value='42' type='radio'>{$lang['userdetails_remove_game_d']}" : $lang['userdetails_no_disablement']) . "</div>";
     if ($game_access) {
         if ($user['game_access'] == 0) {
             $HTMLOUT .= '<td align="center">(' . $lang['userdetails_unlimited_d'] . ')</td></tr>';
         } else {
             $HTMLOUT .= "<div class='col-sm-2'>{$lang['userdetails_until']} " . get_date($user['game_access'], 'DATE') . " (" . mkprettytime($user['game_access'] - TIME_NOW) . " {$lang['userdetails_togo']})</div><div class='col-sm-6'><!--<input placeholder='Comments' class='form-control' type='text' name='game_disable_pm'>--></div></div>";
         }
     } else {
         $HTMLOUT .= '<div class="col-sm-2">' . $lang['userdetails_disable_for'] . '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<select name="game_access">
 <option value="0">------</option>
 <option value="1">1 ' . $lang['userdetails_week'] . '</option>
 <option value="2">2 ' . $lang['userdetails_weeks'] . '</option>
 <option value="4">4 ' . $lang['userdetails_weeks'] . '</option>
 <option value="8">8 ' . $lang['userdetails_weeks'] . '</option>
 <option value="90">' . $lang['userdetails_unlimited'] . '</option>
 </select></div>
 <div class="col-sm-6"><input placeholder="Comments" class="form-control" type="text" name="game_disable_pm"></div></div>';
     }
 }
 $HTMLOUT .= "<div style='display:inline-block;height:100px;'></div>";
 //Adjust up/down
Example #21
0
} else {
    $freeslot = $CURUSER['freeslots'] >= 1 ? "&nbsp;&nbsp;or&nbsp;<b>Use:</b> \r\n<a class=\"index\" href=\"download.php?torrent={$id}&amp;slot=free\" rel='balloon1' onclick=\"return confirm('Are you sure you want to use a freeleech slot?')\">\r\n<font color='" . $clr . "'><b>Freeleech Slot</b></font></a>&nbsp;or&nbsp;<b>Use:</b> \r\n<a class=\"index\" href=\"download.php?torrent={$id}&amp;slot=double\" rel='balloon2' onclick=\"return confirm('Are you sure you want to use a doubleseed slot?')\">\r\n<font color='" . $clr . "'><b>Doubleseed Slot</b></font></a>&nbsp;- " . (int) $CURUSER['freeslots'] . " Slots Remaining. " : '';
}
/** free addon start **/
$is = $fl = '';
$isfree['yep'] = $isfree['expires'] = 0;
if (isset($free)) {
    foreach ($free as $fl) {
        switch ($fl['modifier']) {
            case 1:
                $mode = 'All Torrents Free';
                break;
            case 2:
                $mode = 'All Double Upload';
                break;
            case 3:
                $mode = 'All Torrents Free and Double Upload';
                break;
            default:
                $mode = 0;
        }
        $isfree['yep'] = $fl['modifier'] != 0 && ($fl['expires'] > TIME_NOW || $fl['expires'] == 1);
        $isfree['expires'] = $fl['expires'];
    }
}
$HTMLOUT .= ($row['free'] != 0 || $CURUSER['free_switch'] != 0 || $isfree['yep'] ? '
<tr><td align="right" class="heading">Free Status</td><td align="left">' . ($row['free'] != 0 ? $freeimg . '<b><font color="' . $clr . '">Torrent FREE</font></b> ' . ($row['free'] > 1 ? 'Expires: ' . get_date($row['free'], 'DATE') . ' 
(' . mkprettytime($row['free'] - time()) . ' to go)<br />' : 'Unlimited<br />') : '') : '') . ($CURUSER['free_switch'] != 0 ? $freeimg . '<b><font color="' . $clr . '">Personal FREE Status</font></b> ' . ($CURUSER['free_switch'] > 1 ? 'Expires: ' . get_date($CURUSER['free_switch'], 'DATE') . ' 
(' . mkprettytime($CURUSER['free_switch'] - time()) . ' to go)<br />' : 'Unlimited<br />') : '') . ($isfree['yep'] ? $freeimg . '<b><font color="' . $clr . '">' . $mode . '</font></b> ' . ($isfree['expires'] != 1 ? 'Expires: ' . get_date($isfree['expires'], 'DATE') . ' 
(' . mkprettytime($isfree['expires'] - time()) . ' to go)<br />' : 'Unlimited<br />') : '') . ($row['free'] != 0 || $CURUSER['free_switch'] != 0 || $isfree['yep'] ? '</td></tr>' : '') . '<tr><td align=\'right\' class=\'heading\' width=\'1%\'>Torrent</td><td align=\'left\'>
<a rel=\'balloon3\' class="index" href="download.php?torrent=' . $id . '' . ($CURUSER['ssluse'] == 3 ? '&amp;ssl=1' : '') . '">&nbsp;<u>' . htmlspecialchars($row["filename"]) . '</u></a>' . $freeslot . '</td></tr>';
Example #22
0
    $downspeed = $arr["downspeed"] > 0 ? prefixed($arr["downspeed"]) : ($arr["leechtime"] > 0 ? prefixed($arr["downloaded"] / $arr["leechtime"]) : prefixed(0));
    $ratio = $arr["downloaded"] > 0 ? number_format($arr["uploaded"] / $arr["downloaded"], 3) : ($arr["uploaded"] > 0 ? "Inf." : "---");
    $completed = sprintf("%.2f%%", 100 * (1 - $arr["to_go"] / $arr["size"]));
    $res9 = mysql_query("SELECT seeder FROM peers WHERE torrent={$_GET['id']} AND userid={$arr['userid']}");
    $arr9 = mysql_fetch_assoc($res9);
    echo "<tr>\n";
    echo "<td align=left><a href=userdetails.php?id={$arr['userid']}>{$arr['username']}</a>" . get_user_icons($arr) . "</td>\n";
    echo "<td align=right>" . safeChar($arr["id"]) . "</td>\n";
    echo "<td align=center>" . ($arr["connectable"] == "yes" ? "<img src=/pic/online.gif>" : "<img src=/pic/offline.gif>") . "</td>\n";
    echo "<td align=right>" . prefixed($arr["uploaded"]) . "</td>\n";
    echo "<td align=right>{$upspeed}/s</td>\n";
    echo "<td align=right>" . prefixed($arr["downloaded"]) . "</td>\n";
    echo "<td align=right>{$downspeed}/s</td>\n";
    echo "<td align=right>{$ratio}</td>\n";
    echo "<td align=right>{$completed}</td>\n";
    echo "<td align=right>" . safeChar($arr["hit_and_run"]) . "</td>\n";
    echo "<td align=right>" . safeChar($arr["mark_of_cain"]) . "</td>\n";
    echo "<td align=right><center><b>" . get_snatched_color($arr["seedtime"]) . "</b></center></td>\n";
    echo "<td align=right>" . mkprettytime($arr["leechtime"]) . "</td>\n";
    echo "<td align=center>{$arr['last_action']}</td>\n";
    echo "<td align=center>" . safeChar($arr["complete_date"] == "0000-00-00 00:00:00" ? "Not Complete Yet" : $arr["complete_date"]) . "</td>\n";
    echo "<td align=center>" . safeChar($arr[port]) . "</td>\n";
    echo "<td align=center>" . ($arr9["seeder"] == "yes" ? "<img src=" . $pic_base_url . "online.gif border=0 alt=\"active Seeder\">" : "<img src=" . $pic_base_url . "offline.gif border=0 alt=\"Not seeding!\">") . "</td>\n";
    echo "<td align=right>" . safeChar($arr["timesann"]) . "</td>\n";
    echo "</tr>\n";
}
echo "</table>\n";
if ($count > $perpage) {
    echo "{$pagerbottom}";
}
stdfoot();
Example #23
0
<?php

//=== free addon start
if ($CURUSER) {
    if (isset($free)) {
        foreach ($free as $fl) {
            switch ($fl['modifier']) {
                case 1:
                    $mode = 'All Torrents Free';
                    break;
                case 2:
                    $mode = 'All Double Upload';
                    break;
                case 3:
                    $mode = 'All Torrents Free and Double Upload';
                    break;
                default:
                    $mode = 0;
            }
            $htmlout .= $fl['modifier'] != 0 && $fl['expires'] > TIME_NOW ? '
     <li>
     <a class="tooltip" href="#"><b>FreeLeech ON</b><span class="custom info"><img src="./templates/1/images/Info.png" alt="Freeleech" height="48" width="48" />
     <em>' . $fl['title'] . '</em>
     ' . $mode . '<br />
     ' . $fl['message'] . ' set by ' . $fl['setby'] . '<br />' . ($fl['expires'] != 1 ? 'Until ' . get_date($fl['expires'], 'DATE') . ' (' . mkprettytime($fl['expires'] - time()) . ' to go)' : '') . '  
     </span></a></li>' : '';
        }
    }
}
//=== free addon end
Example #24
0
         $arr = mysql_fetch_assoc($res);
         $warnedby = "<br />[" . $lang_userdetails['text_by'] . "<u>" . get_username($arr['id']) . "</u></a>]";
     } else {
         $warnedby = "<br />[" . $lang_userdetails['text_by_system'] . "]";
         print "<tr><td class=\"rowfollow\">" . $lang_userdetails['text_last_warning'] . "</td><td align=\"left\" class=\"rowfollow\"> {$user['lastwarned']} .(" . $lang_userdetails['text_until'] . "{$elapsedlw})   {$warnedby}</td></tr>\n";
     }
     print "<tr><td class=\"rowfollow\">" . $lang_userdetails['text_last_warning'] . "</td><td align=\"left\" class=\"rowfollow\"> {$user['lastwarned']} ({$elapsedlw}" . $lang_userdetails['text_ago'] . ")   " . $warnedby . "</td></tr>\n";
 }
 $leechwarn = $user["leechwarn"] == "yes";
 print "<tr><td class=\"rowfollow\">" . $lang_userdetails['row_auto_warning'] . "<br /><i>(" . $lang_userdetails['text_low_ratio'] . ")</i></td>";
 if ($leechwarn) {
     print "<td align=\"left\" class=\"rowfollow\"><font color=\"red\">" . $lang_userdetails['text_leech_warned'] . "</font> ";
     $leechwarnuntil = $user['leechwarnuntil'];
     if ($leechwarnuntil != '0000-00-00 00:00:00') {
         print $lang_userdetails['text_until'] . $leechwarnuntil;
         print "<br />(" . mkprettytime(strtotime($leechwarnuntil) - strtotime(date("Y-m-d H:i:s"))) . $lang_userdetails['text_to_go'] . ")";
     } else {
         print "<i>" . $lang_userdetails['text_for_unlimited_time'] . "</i>";
     }
     print "</td></tr>";
 } else {
     print "<td class=\"rowfollow\">" . $lang_userdetails['text_no_warned'] . "</td></tr>\n";
 }
 print "</table></td></tr>";
 tr($lang_userdetails['row_enabled'], "<input name=\"enabled\" value=\"yes\" type=\"radio\"" . ($enabled ? " checked=\"checked\"" : "") . " />" . $lang_userdetails['radio_yes'] . "<input name=\"enabled\" value=\"no\" type=\"radio\"" . (!$enabled ? " checked=\"checked\"" : "") . " />" . $lang_userdetails['radio_no'], 1);
 tr($lang_userdetails['row_forum_post_possible'], "<input type=\"radio\" name=\"forumpost\" value=\"yes\"" . ($user["forumpost"] == "yes" ? " checked=\"checked\"" : "") . " />" . $lang_userdetails['radio_yes'] . "<input type=\"radio\" name=\"forumpost\" value=\"no\"" . ($user["forumpost"] == "no" ? " checked=\"checked\"" : "") . " />" . $lang_userdetails['radio_no'], 1);
 tr($lang_userdetails['row_upload_possible'], "<input type=\"radio\" name=\"uploadpos\" value=\"yes\"" . ($user["uploadpos"] == "yes" ? " checked=\"checked\"" : "") . " />" . $lang_userdetails['radio_yes'] . "<input type=\"radio\" name=\"uploadpos\" value=\"no\"" . ($user["uploadpos"] == "no" ? " checked=\"checked\"" : "") . " />" . $lang_userdetails['radio_no'], 1);
 tr($lang_userdetails['row_download_possible'], "<input type=\"radio\" name=\"downloadpos\" value=\"yes\"" . ($user["downloadpos"] == "yes" ? " checked=\"checked\"" : "") . " />" . $lang_userdetails['radio_yes'] . "<input type=\"radio\" name=\"downloadpos\" value=\"no\"" . ($user["downloadpos"] == "no" ? " checked=\"checked\"" : "") . " />" . $lang_userdetails['radio_no'], 1);
 tr($lang_userdetails['row_show_ad'], "<input type=\"radio\" name=\"noad\" value=\"no\"" . ($user["noad"] == "no" ? " checked=\"checked\"" : "") . " />" . $lang_userdetails['radio_yes'] . "<input type=\"radio\" name=\"noad\" value=\"yes\"" . ($user["noad"] == "yes" ? " checked=\"checked\"" : "") . " />" . $lang_userdetails['radio_no'], 1);
 tr($lang_userdetails['row_no_ad_until'], "<input type=\"text\" name=\"noaduntil\" value=\"" . htmlspecialchars($user["noaduntil"]) . "\" /> " . $lang_userdetails['text_no_ad_until_note'], 1);
 if (get_user_class() >= $cruprfmanage_class) {
Example #25
0
$count = $row[0];
$snatchedperpage = 15;
$pager = pager($snatchedperpage, $count, "staffpanel.php?tool=snatched_torrents&amp;action=snatched_torrents&amp;");
if ($count > $snatchedperpage) {
    $HTMLOUT .= $pager['pagertop'];
}
$sql = "SELECT sn.userid, sn.id, sn.torrentid, sn.timesann, sn.hit_and_run, sn.mark_of_cain, sn.uploaded, sn.downloaded, sn.start_date, sn.complete_date, sn.seeder, sn.leechtime, sn.seedtime, u.username, t.name " . "FROM snatched AS sn " . "LEFT JOIN users AS u ON u.id=sn.userid " . "LEFT JOIN torrents AS t ON t.id=sn.torrentid WHERE complete_date != '0'" . "ORDER BY sn.complete_date DESC " . $pager['limit'] . "";
$result = sql_query($sql) or print mysql_error();
if (mysql_num_rows($result) != 0) {
    $HTMLOUT .= "<table width='100%' border='1' cellspacing='0' cellpadding='5' align='center'>\r\n<tr>\r\n<td class='colhead' align='center' width='1%'>{$lang['ad_snatched_torrents_name']}</td>\r\n<td class='colhead' align='center' width='1%'>{$lang['ad_snatched_torrents_torname']}</td>\r\n<td class='colhead' align='center' width='1%'>{$lang['ad_snatched_torrents_hnr']}</td>\r\n<td class='colhead' align='center' width='1%'>{$lang['ad_snatched_torrents_marked']}</td>\r\n<td class='colhead' align='center' width='1%'>{$lang['ad_snatched_torrents_announced']}</td>\r\n<td class='colhead' align='center' width='1%'>{$lang['ad_snatched_torrents_upload']}</td>\r\n<td class='colhead' align='center' width='1%'>{$lang['ad_snatched_torrents_download']}</td>\r\n<td class='colhead' align='center' width='1%'>{$lang['ad_snatched_torrents_seedtime']}</td>\r\n<td class='colhead' align='center' width='1%'>{$lang['ad_snatched_torrents_leechtime']}</td>\r\n<td class='colhead' align='center' width='1%'>{$lang['ad_snatched_torrents_startdate']}</td>\r\n<td class='colhead' align='center' width='1%'>{$lang['ad_snatched_torrents_enddate']}</td>\r\n<td class='colhead' align='center' width='1%'>{$lang['ad_snatched_torrents_seeding']}</td>\r\n</tr>";
    while ($row = mysql_fetch_assoc($result)) {
        $smallname = substr(htmlspecialchars($row["name"]), 0, 25);
        if ($smallname != htmlspecialchars($row["name"])) {
            $smallname .= '...';
        }
        $HTMLOUT .= "<tr><td><a href='/userdetails.php?id=" . $row['userid'] . "'><b>" . $row['username'] . "</b></a></td>\r\n<td align='center'><a href='/details.php?id=" . $row['torrentid'] . "'><b>" . $smallname . "</b></a></td>\r\n<td align='center'><b>" . get_date($row['hit_and_run'], 'LONG', 0, 1) . "</b></td>\r\n<td align='center'><b>" . $row['mark_of_cain'] . "</b></td>\r\n<td align='center'><b>" . $row['timesann'] . "</b></td>\r\n<td align='center'><b>" . mksize($row['uploaded']) . "</b></td>\r\n<td align='center'><b>" . mksize($row['downloaded']) . "</b></td>\r\n<td align='center'><b>" . get_snatched_color($row["seedtime"]) . "</b></td>\r\n<td align='center'><b>" . mkprettytime($row["leechtime"]) . "</b></td>\r\n<td align='center'><b>" . get_date($row['start_date'], 'LONG', 0, 1) . "</b></td>";
        if ($row['complete_date'] > 0) {
            $HTMLOUT .= "<td align='center'><b>" . get_date($row['complete_date'], 'LONG', 0, 1) . "</b></td>";
        } else {
            $HTMLOUT .= "<td align='center'><b><font color='red'>{$lang['ad_snatched_torrents_ncomplete']}</font></b></td></tr>";
        }
        $HTMLOUT .= "<td align='center'><b>" . ($row['seeder'] == 'yes' ? "<img src='" . $INSTALLER09['pic_base_url'] . "aff_tick.gif' alt='Yes' title='Yes' />" : "<img src='" . $INSTALLER09['pic_base_url'] . "aff_cross.gif' alt='No' title='No' />") . "</b></td></tr>";
    }
    $HTMLOUT .= "</table>";
} else {
    $HTMLOUT .= "{$lang['ad_snatched_torrents_nothing']}";
}
if ($count > $snatchedperpage) {
    $HTMLOUT .= $pager['pagerbottom'];
}
$HTMLOUT .= end_main_frame();
Example #26
0
 print "<tr><td class=colhead align=center>" . $lang_viewsnatches['col_username'] . "</td>" . (get_user_class() >= $userprofile_class ? "<td class=colhead align=center>" . $lang_viewsnatches['col_ip'] . "</td>" : "") . "<td class=colhead align=center>" . $lang_viewsnatches['col_uploaded'] . "/" . $lang_viewsnatches['col_downloaded'] . "</td><td class=colhead align=center>" . $lang_viewsnatches['col_ratio'] . "</td><td class=colhead align=center>" . $lang_viewsnatches['col_se_time'] . "</td><td class=colhead align=center>" . $lang_viewsnatches['col_le_time'] . "</td><td class=colhead align=center>" . $lang_viewsnatches['col_when_completed'] . "</td><td class=colhead align=center>" . $lang_viewsnatches['col_last_action'] . "</td><td class=colhead align=center>" . $lang_viewsnatches['col_report_user'] . "</td></tr>";
 $res = sql_query("SELECT * FROM snatched WHERE finished='yes' AND torrentid =" . sqlesc($id) . " ORDER BY completedat DESC {$limit}");
 while ($arr = mysql_fetch_assoc($res)) {
     //start torrent
     if ($arr["downloaded"] > 0) {
         $ratio = number_format($arr["uploaded"] / $arr["downloaded"], 3);
         $ratio = "<font color=" . get_ratio_color($ratio) . ">{$ratio}</font>";
     } elseif ($arr["uploaded"] > 0) {
         $ratio = $lang_viewsnatches['text_inf'];
     } else {
         $ratio = "---";
     }
     $uploaded = mksize($arr["uploaded"]);
     $downloaded = mksize($arr["downloaded"]);
     $seedtime = mkprettytime($arr["seedtime"]);
     $leechtime = mkprettytime($arr["leechtime"]);
     $uprate = $arr["seedtime"] > 0 ? mksize($arr["uploaded"] / ($arr["seedtime"] + $arr["leechtime"])) : mksize(0);
     $downrate = $arr["leechtime"] > 0 ? mksize($arr["downloaded"] / $arr["leechtime"]) : mksize(0);
     //end
     $highlight = $CURUSER["id"] == $arr["userid"] ? " bgcolor=#00A527" : "";
     $userrow = get_user_row($arr['userid']);
     if ($userrow['privacy'] == 'strong') {
         $username = $lang_viewsnatches['text_anonymous'];
         if (get_user_class() >= $viewanonymous_class || $arr["id"] == $CURUSER['id']) {
             $username .= "<br />(" . get_username($arr[userid]) . ")";
         }
     } else {
         $username = get_username($arr[userid]);
     }
     $reportImage = "<img class=\"f_report\" src=\"pic/trans.gif\" alt=\"Report\" title=\"" . $lang_viewsnatches['title_report'] . "\" />";
     print "<tr{$highlight}><td class=rowfollow align=center>" . $username . "</td>" . (get_user_class() >= $userprofile_class ? "<td class=rowfollow align=center>" . $arr[ip] . "</td>" : "") . "<td class=rowfollow align=center>" . $uploaded . "@" . $uprate . $lang_viewsnatches['text_per_second'] . "<br />" . $downloaded . "@" . $downrate . $lang_viewsnatches['text_per_second'] . "</td><td class=rowfollow align=center>{$ratio}</td><td class=rowfollow align=center>{$seedtime}</td><td class=rowfollow align=center>{$leechtime}</td><td class=rowfollow align=center>" . gettime($arr[completedat], true, false) . "</td><td class=rowfollow align=center>" . gettime($arr[last_action], true, false) . "</td><td class=rowfollow align=center style='padding: 0px'>" . ($userrow['privacy'] != 'strong' || get_user_class() >= $viewanonymous_class ? "<a href=report.php?user={$arr['userid']}>{$reportImage}</a>" : $reportImage) . "</td></tr>\n";
Example #27
0
function maketable($res, $mode = 'seeding')
{
    global $lang_getusertorrentlistajax, $CURUSER, $smalldescription_main;
    switch ($mode) {
        case 'uploaded':
            $showsize = true;
            $showsenum = true;
            $showlenum = true;
            $showuploaded = true;
            $showdownloaded = false;
            $showratio = false;
            $showsetime = true;
            $showletime = false;
            $showcotime = false;
            $showanonymous = true;
            $columncount = 8;
            break;
        case 'seeding':
            $showsize = true;
            $showsenum = true;
            $showlenum = true;
            $showuploaded = true;
            $showdownloaded = true;
            $showratio = true;
            $showsetime = false;
            $showletime = false;
            $showcotime = false;
            $showanonymous = false;
            $columncount = 8;
            break;
        case 'leeching':
            $showsize = true;
            $showsenum = true;
            $showlenum = true;
            $showuploaded = true;
            $showdownloaded = true;
            $showratio = true;
            $showsetime = false;
            $showletime = false;
            $showcotime = false;
            $showanonymous = false;
            $columncount = 8;
            break;
        case 'completed':
            $showsize = false;
            $showsenum = false;
            $showlenum = false;
            $showuploaded = true;
            $showdownloaded = false;
            $showratio = false;
            $showsetime = true;
            $showletime = true;
            $showcotime = true;
            $showanonymous = false;
            $columncount = 8;
            break;
        case 'incomplete':
            $showsize = false;
            $showsenum = false;
            $showlenum = false;
            $showuploaded = true;
            $showdownloaded = true;
            $showratio = true;
            $showsetime = false;
            $showletime = true;
            $showcotime = false;
            $showanonymous = false;
            $columncount = 7;
            break;
        default:
            break;
    }
    $ret = "<table border=\"1\" cellspacing=\"0\" cellpadding=\"5\" width=\"800\"><tr><td class=\"colhead\" style=\"padding: 0px\">" . $lang_getusertorrentlistajax['col_type'] . "</td><td class=\"colhead\" align=\"center\">" . $lang_getusertorrentlistajax['col_name'] . "</td>" . ($showsize ? "<td class=\"colhead\" align=\"center\"><img class=\"size\" src=\"pic/trans.gif\" alt=\"size\" title=\"" . $lang_getusertorrentlistajax['title_size'] . "\" /></td>" : "") . ($showsenum ? "<td class=\"colhead\" align=\"center\"><img class=\"seeders\" src=\"pic/trans.gif\" alt=\"seeders\" title=\"" . $lang_getusertorrentlistajax['title_seeders'] . "\" /></td>" : "") . ($showlenum ? "<td class=\"colhead\" align=\"center\"><img class=\"leechers\" src=\"pic/trans.gif\" alt=\"leechers\" title=\"" . $lang_getusertorrentlistajax['title_leechers'] . "\" /></td>" : "") . ($showuploaded ? "<td class=\"colhead\" align=\"center\">" . $lang_getusertorrentlistajax['col_uploaded'] . "</td>" : "") . ($showdownloaded ? "<td class=\"colhead\" align=\"center\">" . $lang_getusertorrentlistajax['col_downloaded'] . "</td>" : "") . ($showratio ? "<td class=\"colhead\" align=\"center\">" . $lang_getusertorrentlistajax['col_ratio'] . "</td>" : "") . ($showsetime ? "<td class=\"colhead\" align=\"center\">" . $lang_getusertorrentlistajax['col_se_time'] . "</td>" : "") . ($showletime ? "<td class=\"colhead\" align=\"center\">" . $lang_getusertorrentlistajax['col_le_time'] . "</td>" : "") . ($showcotime ? "<td class=\"colhead\" align=\"center\">" . $lang_getusertorrentlistajax['col_time_completed'] . "</td>" : "") . ($showanonymous ? "<td class=\"colhead\" align=\"center\">" . $lang_getusertorrentlistajax['col_anonymous'] . "</td>" : "") . "</tr>\n";
    while ($arr = mysql_fetch_assoc($res)) {
        $catimage = htmlspecialchars($arr["image"]);
        $catname = htmlspecialchars($arr["catname"]);
        $sphighlight = get_torrent_bg_color($arr['sp_state']);
        $sp_torrent = get_torrent_promotion_append($arr['sp_state']);
        //torrent name
        $dispname = $nametitle = htmlspecialchars($arr["torrentname"]);
        $count_dispname = mb_strlen($dispname, "UTF-8");
        $max_lenght_of_torrent_name = $CURUSER['fontsize'] == 'large' ? 70 : 80;
        if ($count_dispname > $max_lenght_of_torrent_name) {
            $dispname = mb_substr($dispname, 0, $max_lenght_of_torrent_name, "UTF-8") . "..";
        }
        if ($smalldescription_main == 'yes') {
            //small description
            $dissmall_descr = htmlspecialchars(trim($arr["small_descr"]));
            $count_dissmall_descr = mb_strlen($dissmall_descr, "UTF-8");
            $max_lenght_of_small_descr = 80;
            // maximum length
            if ($count_dissmall_descr > $max_lenght_of_small_descr) {
                $dissmall_descr = mb_substr($dissmall_descr, 0, $max_lenght_of_small_descr, "UTF-8") . "..";
            }
        } else {
            $dissmall_descr == "";
        }
        $ret .= "<tr" . $sphighlight . "><td class=\"rowfollow nowrap\" valign=\"middle\" style='padding: 0px'>" . return_category_image($arr['category'], "torrents.php?allsec=1&amp;") . "</td>\n" . "<td class=\"rowfollow\" width=\"100%\" align=\"left\"><a href=\"" . htmlspecialchars("details.php?id=" . $arr[torrent] . "&hit=1") . "\" title=\"" . $nametitle . "\"><b>" . $dispname . "</b></a>" . $sp_torrent . ($dissmall_descr == "" ? "" : "<br />" . $dissmall_descr) . "</td>";
        //size
        if ($showsize) {
            $ret .= "<td class=\"rowfollow\" align=\"center\">" . mksize_compact($arr['size']) . "</td>";
        }
        //number of seeders
        if ($showsenum) {
            $ret .= "<td class=\"rowfollow\" align=\"center\">" . $arr['seeders'] . "</td>";
        }
        //number of leechers
        if ($showlenum) {
            $ret .= "<td class=\"rowfollow\" align=\"center\">" . $arr['leechers'] . "</td>";
        }
        //uploaded amount
        if ($showuploaded) {
            $uploaded = mksize_compact($arr["uploaded"]);
            $ret .= "<td class=\"rowfollow\" align=\"center\">" . $uploaded . "</td>";
        }
        //downloaded amount
        if ($showdownloaded) {
            $downloaded = mksize_compact($arr["downloaded"]);
            $ret .= "<td class=\"rowfollow\" align=\"center\">" . $downloaded . "</td>";
        }
        //ratio
        if ($showratio) {
            if ($arr['downloaded'] > 0) {
                $ratio = number_format($arr['uploaded'] / $arr['downloaded'], 3);
                $ratio = "<font color=\"" . get_ratio_color($ratio) . "\">" . $ratio . "</font>";
            } elseif ($arr['uploaded'] > 0) {
                $ratio = "Inf.";
            } else {
                $ratio = "---";
            }
            $ret .= "<td class=\"rowfollow\" align=\"center\">" . $ratio . "</td>";
        }
        if ($showsetime) {
            $ret .= "<td class=\"rowfollow\" align=\"center\">" . mkprettytime($arr['seedtime']) . "</td>";
        }
        if ($showletime) {
            $ret .= "<td class=\"rowfollow\" align=\"center\">" . mkprettytime($arr['leechtime']) . "</td>";
        }
        if ($showcotime) {
            $ret .= "<td class=\"rowfollow\" align=\"center\">" . "" . str_replace("&nbsp;", "<br />", gettime($arr['completedat'], false)) . "</td>";
        }
        if ($showanonymous) {
            $ret .= "<td class=\"rowfollow\" align=\"center\">" . $arr['anonymous'] . "</td>";
        }
        $ret .= "</tr>\n";
    }
    $ret .= "</table>\n";
    return $ret;
}
Example #28
0
     $biatch_arr = mysql_fetch_assoc($biatch_rez);
     $solved_by_rez = sql_query("SELECT username FROM users WHERE id =" . $arr['solved_by']) or sqlerr(__FILE__, __LINE__);
     $solved_by_arr = mysql_fetch_assoc($solved_by_rez);
     echo '<table align=center border=1 cellpadding=5 cellspacing=0>' . '<tr><td align=center colspan=2 class=colhead>' . htmlentities($arr['title']) . '</td></tr>' . '<tr><td align=right class=clearalt6><b>Added</b></td><td align=left class=clearalt6>On&nbsp;<b>' . $arr['added'] . '</b>' . '&nbsp;by&nbsp;<a class=altlink href=userdetails.php?id=' . $arr['added_by'] . '><b>' . ($biatch_arr['username'] == '' ? 'Deleted member' : $biatch_arr['username']) . '</b></a></td></tr>';
     if ($arr['solved'] === 'yes') {
         echo '<tr><td align=right class=clearalt6><b>Problem</b></td><td align=left class=clearalt6><textarea name=msg_problem cols=80 rows=15 READONLY style="background-color:#332831; color:#f5f0c1;">' . $arr['msg_problem'] . '</textarea></td></tr>' . '<tr><td align=right class=colhead><b>Solved</b></td><td align=left class=colhead><font color=green><b>Yes</b></font>&nbsp;on&nbsp;<b>' . $arr['solved_date'] . '</b>&nbsp;by&nbsp;<a class=altlink href=userdetails.php?id=' . $arr['solved_by'] . '><b>' . ($solved_by_arr['username'] == '' ? 'Deleted Staff' : $solved_by_arr['username']) . '</b></a></td></tr>' . '<tr><td align=right class=clearalt7><b>Answer</b></td><td align=left class=clearalt7><textarea name=msg_answer cols=80 rows=15 READONLY style="background-color:#241a28; color:#f5f0c1;">' . $arr['msg_answer'] . '</textarea></td></tr></table>';
     }
     if ($arr['solved'] === 'ignored') {
         echo '<tr><td align=right class=clearalt6><b>Problem</b></td><td align=left class=clearalt6><textarea name=msg_problem cols=80 rows=15>' . $arr['msg_problem'] . '</textarea></td></tr>' . '<tr><td align=right class=colhead><b>Solved</b></td><td align=left class=colhead><font color=orange><b>Ignored</b></font>&nbsp;on&nbsp;<b>' . $arr['solved_date'] . '</b>&nbsp;by&nbsp;<a class=altlink href=userdetails.php?id=' . $arr['solved_by'] . '><b>' . ($solved_by_arr['username'] == '' ? 'Deleted Staff' : $solved_by_arr['username']) . '</b></a></td></tr>' . '</table>';
     }
     if ($arr['solved'] === 'no') {
         // === Standard HelpDesk Replies
         $hd_reply['1'] = array('Answer Is In The FAQ', 'First Read The FAQ!!! Your question is answered in the FAQ!');
         $hd_reply['2'] = array('Answer Is In The Forums', 'Search the FORUMS!!! Your question has been answered in the FORUMS!');
         $hd_reply['3'] = array('Allowed / Banned clients', 'A list of Allowed AND banned clients can be found listed HERE in the FAQ!');
         $hd_reply['4'] = array('Stats Not Updating / Counting', 'Sometimes there is a delay in Stats updating ' . $SITENAME . '\'s stats are generally updated every ' . mkprettytime($autoclean_interval) . ' min. however sometimes the site is slower to respond... Give it a while, and the site will catch up.');
         $hd_reply['5'] = array('Die n00b', 'Die n00b! Such a thing is known even by my grandma!');
         $hd_answer = $_POST['hd_answer'];
         $body = $_POST['hd_answer'] !== '' ? $hd_reply[$hd_answer][1] : '';
         $addedbyid = 0 + $arr['added_by'];
         echo '<form method=post name=compose action=helpdesk.php><tr><td align=right class=clearalt6><b>Problem</b></td><td align=left class=clearalt6><textarea name=msg_problem cols=80 rows=15 READONLY style="background-color:#332831; color:#f5f0c1;">' . $arr['msg_problem'] . '</textarea></td></tr>' . '<tr><td align=right class=colhead><b>Solved</b></td><td align=center class=colhead align=left><font color=red><b>No</b></font><tr><td align=center class=clearalt7><b>Answer:</b></td><td align=center class=clearalt7>';
         textbbcode('compose', 'body', $body);
         echo '<input type=hidden name=id value=' . $id . '><input type=hidden name=addedbyid value=' . $addedbyid . '></td></tr>' . '<tr><td colspan=2 align=center class=clearalt7> <script language="javascript" src="spellmessage.js"></script> ' . '<input type=button class=button value="Spell Check" onclick="return openspell(1);"> <input type=submit value="Answer question" class=button> ' . ' <a class=altlink2 href=helpdesk.php?action=solve&pid=' . $id . '&solved=ignored><input type=submit value="Ignore question" class=button></a></form></td></tr>' . '<tr><td align=center colspan=2 class=colhead><form method=post action=helpdesk.php?action=problems&id=' . $id . '><b>General Help Desk Replies:</b> <select name=hd_answer>';
         // === add the standerd answers drop down
         for ($i = 1; $i <= count($hd_reply); $i++) {
             echo "<option value={$i} " . ($hd_answer == $i ? "selected" : "") . ">" . $hd_reply[$i][0] . "</option>\n";
         }
         echo '</select> <input type=submit value="Use the answer" class=button></form></td></tr></table>';
     }
 } else {
     // === add some javascript to make mass deleting fun and painless :P
Example #29
0
    exit;
}
switch ($do) {
    case "disabled":
        $query = "SELECT id,username, class, downloaded, uploaded, IF(downloaded>0, round((uploaded/downloaded),2), '---') as ratio, disable_reason, added, last_access FROM users WHERE enabled='no' ORDER BY last_access DESC ";
        $title = "Disabled users";
        $link = "<a href=\"staffpanel.php?tool=warn&amp;action=warn&amp;?do=warned\">warned users</a>";
        break;
    case "warned":
        $query = "SELECT id, username, class, downloaded, uploaded, IF(downloaded>0, round((uploaded/downloaded),2), '---') as ratio, warn_reason, warned, added, last_access FROM users WHERE warned>='1' ORDER BY last_access DESC, warned DESC ";
        $title = "Warned users";
        $link = "<a href=\"staffpanel.php?tool=warn&amp;action=warn&amp;do=disabled\">disabled users</a>";
        break;
}
$g = sql_query($query) or print mysql_error();
$count = mysql_num_rows($g);
$HTMLOUT .= begin_main_frame();
$HTMLOUT .= begin_frame($title . "&nbsp;[<font class=\"small\">total - " . $count . " user" . ($count > 1 ? "s" : "") . "</font>] - " . $link);
if ($count == 0) {
    $HTMLOUT .= stdmsg("hey", "There is no " . strtolower($title));
} else {
    $HTMLOUT .= "<form action='staffpanel.php?tool=warn&amp;action=warn' method='post'>\r\n\t\t<table width='600' cellpadding='3' cellspacing='2' style='border-collapse:separate;' align='center'>\r\n\t\t<tr>    \t\r\n\t\t\t<td class='colhead' align='left' width='100%' >User</td>\r\n\t\t\t<td class='colhead' align='center' nowrap='nowrap'>Ratio</td>\r\n\t\t\t<td class='colhead' align='center' nowrap='nowrap'>Class</td>\r\n\t\t\t<td class='colhead' align='center' nowrap='nowrap'>Last access</td>\r\n\t\t\t<td class='colhead' align='center' nowrap='nowrap'>Joined</td>\r\n\t\t\t<td class='colhead' align='center' nowrap='nowrap'><input type='checkbox' name='checkall' /></td>\r\n\t\t</tr>";
    while ($a = mysql_fetch_assoc($g)) {
        $tip = $do == "warned" ? "Warned for : " . $a["warn_reason"] . "<br />" . " Warned till " . get_date($a["warned"], 'DATE', 1) . " - " . mkprettytime($a['warned'] - time()) : "Disabled for " . $a["disable_reason"];
        $HTMLOUT .= "<tr>\r\n\t\t\t\t  <td align='left' width='100%'><a href='userdetails.php?id={$a["id"]}' onmouseover=\"Tip('({$tip})')\" onmouseout=\"UnTip()\">{$a["username"]}</a></td>\r\n\t\t\t\t  <td align='left' nowrap='nowrap'>{$a["ratio"]}<br /><font class='small'><b>D: </b>" . mksize($a["downloaded"]) . "&nbsp;<b>U:</b> " . mksize($a["uploaded"]) . "</font></td>\r\n\t\t\t\t  <td align='center' nowrap='nowrap'>" . get_user_class_name($a["class"]) . "</td>\r\n\t\t\t\t  <td align='center' nowrap='nowrap'>" . get_date($a["last_access"], 'LONG', 0, 1) . "</td>\r\n\t\t\t\t  <td align='center' nowrap='nowrap'>" . get_date($a["added"], 'DATE', 1) . "</td>\r\n\t\t\t\t  <td align='center' nowrap='nowrap'><input type='checkbox' name='users[]' value='{$a["id"]}' /></td>\r\n\t\t\t\t</tr>";
    }
    $HTMLOUT .= "<tr>\r\n\t\t\t<td colspan='6' class='colhead' align='center'>\r\n\t\t\t\t<select name='action'>\r\n\t\t\t\t\t<option value='unwarn'>Unwarn</option>\r\n\t\t\t\t\t<option value='disable'>Disable</option>\r\n\t\t\t\t\t<option value='delete'>Delete</option>\r\n\t\t\t\t</select>\r\n\t\t\t\t&raquo;\r\n\t\t\t\t<input type='submit' value='Apply' />\r\n\t\t\t\t<input type='hidden' value='" . htmlspecialchars($_SERVER["REQUEST_URI"]) . "' name='ref' />\r\n\t\t\t</td>\r\n\t\t\t</tr>\r\n\t\t\t</table>\r\n\t\t\t</form>";
}
$HTMLOUT .= end_frame();
$HTMLOUT .= end_main_frame();
echo stdhead($title) . $HTMLOUT . stdfoot($stdfoot);
Example #30
0
    stderr("Error", "It appears that you have entered an invalid id.");
}
$res = mysql_query("SELECT id, name FROM torrents WHERE id = " . sqlesc($id) . "") or sqlerr();
$arr = mysql_fetch_assoc($res);
if (!$arr) {
    stderr("Error", "It appears that there is no torrent with that id.");
}
$res = sql_query("SELECT COUNT(*) FROM snatched WHERE torrentid =" . sqlesc($id) . "") or sqlerr();
$row = mysql_fetch_row($res);
$count = $row[0];
$perpage = 15;
$pager = pager($perpage, $count, "snatches.php?id={$id}&amp;");
if (!$count) {
    stderr("No snatches", "It appears that there are currently no snatches for the torrent <a href=details.php?id={$arr['id']}>{$arr['name']}</a>.");
}
$HTMLOUT .= "<h1>Snatches for torrent <a href='{$TBDEV['baseurl']}/details.php?id={$arr['id']}'>{$arr['name']}</a></h1>\n";
$HTMLOUT .= "<h2>Currently {$row['0']} snatch" . ($row[0] == 1 ? "" : "es") . "</h2>\n";
$HTMLOUT .= $pager['pagertop'];
$HTMLOUT .= "<table width='80%'border='0' cellspacing='0' cellpadding='5'>\r\n<tr>\r\n<td class='colhead' align='left'>{$lang['snatches_username']}</td>\r\n<td class='colhead' align='center'>{$lang['snatches_connectable']}</td>\r\n<td class='colhead' align='right'>{$lang['snatches_uploaded']}</td>\r\n<td class='colhead' align='right'>{$lang['snatches_upspeed']}</td>\r\n<td class='colhead' align='right'>{$lang['snatches_downloaded']}</td>\r\n<td class='colhead' align='right'>{$lang['snatches_downspeed']}</td>\r\n<td class='colhead' align='right'>{$lang['snatches_ratio']}</td>\r\n<td class='colhead' align='right'>{$lang['snatches_completed']}</td>\r\n<td class='colhead' align='right'>{$lang['snatches_seedtime']}</td>\r\n<td class='colhead' align='right'>{$lang['snatches_leechtime']}</td>\r\n<td class='colhead' align='center'>{$lang['snatches_lastaction']}</td>\r\n<td class='colhead' align='center'>{$lang['snatches_completedat']}</td>\r\n<td class='colhead' align='center'>{$lang['snatches_client']}</td>\r\n<td class='colhead' align='center'>{$lang['snatches_port']}</td>\r\n<td class='colhead' align='center'>{$lang['snatches_announced']}</td>\r\n</tr>\n";
$res = sql_query("SELECT s.*, size, username, parked, warned, enabled, class, chatpost, leechwarn, timesann, donor FROM snatched AS s INNER JOIN users ON s.userid = users.id INNER JOIN torrents ON s.torrentid = torrents.id WHERE torrentid = {$id} ORDER BY complete_date DESC " . $pager['limit'] . "") or sqlerr();
while ($arr = mysql_fetch_assoc($res)) {
    $upspeed = $arr["upspeed"] > 0 ? mksize($arr["upspeed"]) : ($arr["seedtime"] > 0 ? mksize($arr["uploaded"] / ($arr["seedtime"] + $arr["leechtime"])) : mksize(0));
    $downspeed = $arr["downspeed"] > 0 ? mksize($arr["downspeed"]) : ($arr["leechtime"] > 0 ? mksize($arr["downloaded"] / $arr["leechtime"]) : mksize(0));
    $ratio = $arr["downloaded"] > 0 ? number_format($arr["uploaded"] / $arr["downloaded"], 3) : ($arr["uploaded"] > 0 ? "Inf." : "---");
    $completed = sprintf("%.2f%%", 100 * (1 - $arr["to_go"] / $arr["size"]));
    $HTMLOUT .= "<tr>\r\n  <td align='left'><a href='{$TBDEV['baseurl']}/userdetails.php?id={$arr['userid']}'>{$arr['username']}</a></td>\r\n  <td align='center'>" . ($arr["connectable"] == "yes" ? "<font color='green'>Yes</font>" : "<font color='red'>No</font>") . "</td>\r\n  <td align='right'>" . mksize($arr["uploaded"]) . "</td>\r\n  <td align='right'>{$upspeed}/s</td>\r\n  <td align='right'>" . mksize($arr["downloaded"]) . "</td>\r\n  <td align='right'>{$downspeed}/s</td>\r\n  <td align='right'>{$ratio}</td>\r\n  <td align='right'>{$completed}</td>\r\n  <td align='right'>" . mkprettytime($arr["seedtime"]) . "</td>\r\n  <td align='right'>" . mkprettytime($arr["leechtime"]) . "</td>\r\n  <td align='center'>" . get_date($arr["last_action"], '', 0, 1) . "</td>\r\n  <td align='center'>" . get_date($arr["complete_date"], '', 0, 1) . "</td>\r\n  <td align='center'>" . $arr["agent"] . "</td>\r\n  <td align='center'>" . $arr["port"] . "</td>\r\n  <td align='center'>" . $arr["timesann"] . "</td>\r\n  </tr>\n";
}
$HTMLOUT .= "</table>\n";
$HTMLOUT .= $pager['pagerbottom'];
print stdhead('Snatches') . $HTMLOUT . stdfoot();
die;