Example #1
0
        //=== Member ++
    //=== Member ++
    case $user['class'] == UC_VIP || $user['class'] == UC_UPLOADER || $user['class'] == UC_MODERATOR || $user['class'] == UC_ADMINISTRATOR || $user['class'] == UC_SYSOP:
        $days = 0.5;
        break;
}
$avg_time_ratio = $cache_share_ratio['seed_time_total'] / $cache_share_ratio['total_number'] / 86400 / $days;
$avg_time_seeding = mkprettytime($cache_share_ratio['seed_time_total'] / $cache_share_ratio['total_number']);
if ($user["id"] == $CURUSER["id"] || $CURUSER['class'] >= UC_STAFF) {
    $HTMLOUT .= '<tr><td class="clearalt5" align="right"><b>Time Ratio:</b></td><td align="left" class="clearalt5">' . ($user['downloaded'] > 0 || $user['uploaded'] > 2147483648 ? '<font color="' . get_ratio_color(number_format($avg_time_ratio, 3)) . '">' . number_format($avg_time_ratio, 3) . '</font>     ' . ratio_image_machine(number_format($avg_time_ratio, 3)) . '     [<font color="' . get_ratio_color(number_format($avg_time_ratio, 3)) . '"> ' . $avg_time_seeding . '</font> per torrent average ]  Ratio based on the assumption that all torrents were New. ' : 'inf.') . '</td></tr>';
}
$HTMLOUT .= "<tr><td class='rowhead'>{$lang['userdetails_bonus_points']}</td><td align='left'><a class='altlink' href='{$INSTALLER09['baseurl']}/mybonus.php'>" . (int) $user['seedbonus'] . "</a></td></tr>";
if ($user['onirc'] == 'yes') {
    $ircbonus = !empty($user['irctotal']) ? number_format($user["irctotal"] / $INSTALLER09['autoclean_interval'], 1) : '0.0';
    $HTMLOUT .= "<tr><td class='rowhead' valign='top' align='right'>Irc Bonus</td><td align='left'>{$ircbonus}</td></tr>";
    $irctotal = !empty($user['irctotal']) ? calctime($user['irctotal']) : $user['username'] . ' has never been on IRC!';
    $HTMLOUT .= "<tr><td class='rowhead' valign='top' align='right'>Irc Idle Time</td><td align='left'>{$irctotal}</td></tr>";
}
//==Connectable and port shit
if ($user['paranoia'] < 1 || $CURUSER['id'] == $id || $CURUSER['class'] >= UC_STAFF) {
    $port_data = $mc1->get_value('port_data_' . $id);
    if ($port_data === false) {
        $q1 = sql_query('SELECT connectable, port,agent FROM peers WHERE userid = ' . $id . ' LIMIT 1') or sqlerr(__FILE__, __LINE__);
        $port_data = mysql_fetch_row($q1);
        $mc1->cache_value('port_data_' . $id, $port_data, $INSTALLER09['expires']['port_data']);
    }
    if ($port_data > 0) {
        $connect = $port_data[0];
        $port = $port_data[1];
        $agent = $port_data[2];
        if ($connect == "yes") {
Example #2
0
<?php

function calctime($val)
{
    global $lang;
    $days = intval($val / 86400);
    $val -= $days * 86400;
    $hours = intval($val / 3600);
    $val -= $hours * 3600;
    $mins = intval($val / 60);
    $secs = $val - $mins * 60;
    return "&nbsp;{$days} {$lang['userdetails_irc_days']}, {$hours} {$lang['userdetails_irc_hrs']}, {$mins} {$lang['userdetails_irc_min']}";
}
//==Irc
if ($user['onirc'] == 'yes') {
    $ircbonus = !empty($user['irctotal']) ? number_format($user["irctotal"] / $INSTALLER09['autoclean_interval'], 1) : '0.0';
    $HTMLOUT .= "<tr><td class='rowhead' valign='top' align='right'>{$lang['userdetails_irc_bonus']}</td><td align='left'>{$ircbonus}</td></tr>";
    $irctotal = !empty($user['irctotal']) ? calctime($user['irctotal']) : htmlsafechars($user['username']) . $lang['userdetails_irc_never'];
    $HTMLOUT .= "<tr><td class='rowhead' valign='top' align='right'>{$lang['userdetails_irc_idle']}</td><td align='left'>{$irctotal}</td></tr>";
}
//==end
// End Class
// End File
Example #3
0
                        $config .= ($add ? "define ('" : '') . $oval[3] . ($add ? "'," : ' = ') . $q . addcslashes(stripslashes($val), "..\"\$\\..ΓΏ") . $q . ($add ? ')' : '') . ";\n";
                    }
                }
            }
        }
        $config .= "?>\n";
        fwrite($fh, $config);
        fclose($fh);
    }
}
// add some extra info to some options
// final processing for form display
foreach ($pdef as $key => $val) {
    switch ($ptyp[$key]) {
        case 'sec':
            $options[$key][4] .= calctime($pdef[$key]);
            break;
        case 'bytes':
            $options[$key][4] .= calcbytes($pdef[$key]);
            break;
        case 'aurl':
            $options[$key][4] .= '<br >&nbsp;<strong>One per line.</strong>';
            $pdef[$key] = implode("\n", $pdef[$key]);
    }
}
// OMG, Finally the Output Portion of the script
begin_main_frame();
begin_frame('Site Settings');
?>
	<CENTER><H1><b><?php 
echo TBVERSION;
Example #4
0
while ($arr = mysql_fetch_assoc($res)) {
    switch ($arr['arg']) {
        case 'lastcleantime':
            $arg = $TBDEV['autoclean_interval'];
            break;
        case 'lastslowcleantime':
            $arg = $TBDEV['autoslowclean_interval'];
            break;
        case 'lastslowcleantime2':
            $arg = $TBDEV['autoslowclean_interval2'];
            break;
        case 'lastoptimizedbtime':
            $arg = $TBDEV['optimizedb_interval'];
            break;
    }
    $HTMLOUT .= "<tr><td>" . $arr['arg'] . "</td>\r\n    <td>" . get_date($arr['value_u'], 'DATE', 1, 0) . " (" . get_date($arr['value_u'], 'DATE', 1, 0) . ")</td>\r\n    <td>" . calctime($arg) . "</td>\r\n    <td>" . calctime($arr['value_u'] - (time() - $arg)) . "</td>\r\n    </tr>";
}
$HTMLOUT .= end_table();
$HTMLOUT .= "<form action='admin.php?action=docleanup' method='post'>\r\n<table align='center'>\r\n<tr>\r\n<td class='table'>\r\n<input type='checkbox' name='docleanup' />Do Cleanup\r\n&nbsp;&nbsp;&nbsp;&nbsp;\r\n<input type='checkbox' name='doslowcleanup' />Do Slow Cleanup\r\n&nbsp;&nbsp;&nbsp;&nbsp;\r\n<input type='checkbox' name='doslowcleanup2' />Do Slow Cleanup 2\r\n&nbsp;&nbsp;&nbsp;&nbsp;\r\n<input type='checkbox' name='dooptimization' />Do Optimization\r\n<input type='submit' value='Submit' />\r\n</td></tr></table>\r\n</form>";
$now = time();
if (isset($_POST['docleanup'])) {
    mysql_query("UPDATE avps SET value_u = " . sqlesc($now) . " WHERE arg = 'lastcleantime'") or sqlerr(__FILE__, __LINE__);
    require_once "include/cleanup.php";
    docleanup();
    header('Refresh: 2; url=' . $TBDEV['baseurl'] . '/admin.php?action=docleanup');
    $HTMLOUT .= "<br /><h1>Cleanup Done</h1>";
}
if (isset($_POST['doslowcleanup'])) {
    mysql_query("UPDATE avps SET value_u = " . sqlesc($now) . " WHERE arg = 'lastslowcleantime'") or sqlerr(__FILE__, __LINE__);
    require_once "include/cleanup.php";
    doslowcleanup();
Example #5
0
	return "Check All Remove"; }
	}
	//]]>
	</script>';
    $pager = pager($perpage, $count, "staffpanel.php?tool=deathrow&amp;", array('lastpagedefault' => 1));
    //
    $query = "SELECT * FROM deathrow {$orderby} {$pager['limit']}";
    $res = sql_query($query) or sqlerr(__FILE__, __LINE__);
    $b = "<div class='row'><div class='col-md-12'><p><b>{$count} {$lang['deathrow_title']}</b>" . "</p><form action='' method='post'><table class='table table-bordered'>" . "<thead><tr><th class='colhead' align='center'>{$lang['deathrow_uname']}</th><th class='colhead' align='center'>{$lang['deathrow_tname']}</th><th class='colhead'>{$lang['deathrow_del_resn']}</th><th class='colhead'>{$lang['deathrow_del_torr']}</th></tr></thead>\n";
    while ($queued = mysqli_fetch_assoc($res)) {
        if ($queued['reason'] == 1) {
            $reason = $lang['deathrow_nopeer'] . calctime($x_time);
        } elseif ($queued['reason'] == 2) {
            $reason = $lang['deathrow_no_peers'] . calctime($y_time);
        } else {
            $reason = $lang['deathrow_no_seed'] . calctime($z_time) . $lang['deathrow_new_torr'];
        }
        $id = 0 + $queued['tid'];
        $b .= "<tr>" . ($CURUSER["class"] >= UC_STAFF ? "<td align='center'><a href='userdetails.php?id=" . $queued["uid"] . "&amp;hit=1'><b>" . htmlsafechars($queued["username"]) . "</b></a></td>" : "<td align='center'><strong>{$lang['deathrow_hidden']}</strong></td>") . "<td align='center'><a href='details.php?id=" . $id . "&amp;hit=1'>" . htmlsafechars($queued["torrent_name"]) . "</a></td><td align='center'>" . $reason . "</td><td align='center'>" . ($queued["username"] == $CURUSER["username"] || $CURUSER["class"] >= UC_STAFF ? "<input type=\"checkbox\" name=\"remove[]\" value=\"" . $id . "\" /><b>" . ($queued["username"] == $CURUSER["username"] ? '&nbsp;&nbsp;<font color="#800000">' . $lang['deathrow_delete'] . '</font>' : '' . $lang['deathrow_delete1'] . '') . "</b>" : "{$lang['deathrow_ownstaff']}") . "</td></tr>";
    }
    $b .= '<tr><td class="table" colspan="11" align="right"><input type="button" value="' . $lang['deathrow_checkall'] . '" onclick="this.value=check(this.form.elements[\'remove[]\'])"/>
<input type="submit" name="submit" value="' . $lang['deathrow_apply'] . '" /></td></tr></table></form></div></div>';
    $HTMLOUT .= $pager['pagertop'];
    $HTMLOUT = $b;
    $HTMLOUT .= $pager['pagerbottom'];
    echo stdhead($lang['deathrow_stdhead']) . $HTMLOUT . stdfoot();
} else {
    $HTMLOUT .= '<br /><strong>' . $lang['deathrow_msg'] . '</strong>' . $lang['deathrow_msg1'] . '
    <br /><br /><br /><strong>' . $lang['deathrow_msg2'] . '</strong>' . $lang['deathrow_msg3'] . ' ' . $CURUSER['username'] . '' . $lang['deathrow_msg4'] . '.
    <br /><br /><br /><strong>' . $lang['deathrow_msg'] . '</strong>' . $lang['deathrow_msg33'] . ' ' . $CURUSER['username'] . '' . $lang['deathrow_msg4'] . '.
    <br /><br /><br /><strong>' . $lang['deathrow_msg2'] . '</strong>' . $lang['deathrow_msg5'] . '
Example #6
0
            $arg = $autoslowclean_interval;
            break;
        case 's2slowcleantime':
            $arg = $s2autoslowclean_interval;
            break;
        case 'lastoptimizedbtime':
            $arg = $optimizedb_interval;
            break;
        case 'lastbackupdbtime':
            $arg = $backupdb_interval;
            break;
        case 'lastautohitruntime':
            $arg = $autohitrun_interval;
            break;
    }
    echo '<tr>' . '<td>' . $arr['arg'] . '</td>' . '<td>' . get_date_time($arr['value_u']) . ' (' . get_elapsed_time(sql_timestamp_to_unix_timestamp(get_date_time($arr['value_u']))) . ' ago)</td>' . '<td>' . calctime($arg) . '</td>' . '<td>' . calctime($arr['value_u'] - (gmtime() - $arg)) . '</td>' . '</tr>';
}
end_table();
?>
<br><form action="<?php 
echo $_SERVER["SCRIPT_NAME"];
?>
" method="post">
<table align="center"><tr><td class="chs">
<input type="checkbox" name="docleanup">Do Cleanup
&nbsp;&nbsp;&nbsp;&nbsp;
<input type="checkbox" name="doslowcleanup">Do Slow Cleanup
&nbsp;&nbsp;&nbsp;&nbsp;
<input type="checkbox" name="dos2slowcleanup">Do Slow Cleanup2
&nbsp;&nbsp;&nbsp;&nbsp;
<input type="checkbox" name="dooptimization">Do Optimization
Example #7
0
<?php

function calctime($val)
{
    $days = intval($val / 86400);
    $val -= $days * 86400;
    $hours = intval($val / 3600);
    $val -= $hours * 3600;
    $mins = intval($val / 60);
    $secs = $val - $mins * 60;
    return "&nbsp;{$days} days, {$hours} hrs, {$mins} minutes";
}
//==Irc
if ($user['onirc'] == 'yes') {
    $ircbonus = !empty($user['irctotal']) ? number_format($user["irctotal"] / $INSTALLER09['autoclean_interval'], 1) : '0.0';
    $HTMLOUT .= "<tr><td class='rowhead' valign='top' align='right'>Irc Bonus</td><td align='left'>{$ircbonus}</td></tr>";
    $irctotal = !empty($user['irctotal']) ? calctime($user['irctotal']) : htmlsafechars($user['username']) . ' has never been on IRC!';
    $HTMLOUT .= "<tr><td class='rowhead' valign='top' align='right'>Irc Idle Time</td><td align='left'>{$irctotal}</td></tr>";
}
//==end
// End Class
// End File
function getStats($user, $forced = false)
{
    global $_settings, $countries;
    if (!file_exists($_settings . $user . ".set") || !is_array($var = unserialize(file_get_contents($_settings . $user . ".set")))) {
        return false;
    }
    $query = mysqli_query($GLOBALS["___mysqli_ston"], "SELECT u.id, u.irctotal, u.last_login, u.onlinetime, u.reputation, u.hits, u.uploaded, u.downloaded, u.country, u.browser, count(p.id) as posts ,count(c.id) as comments FROM users as u LEFT JOIN posts as p ON u.id = p.user_id LEFT JOIN comments as c ON c.user = u.id WHERE u.username = "******" GROUP BY u.id") or sqlerr(__FILE__, __LINE__);
    //or die('Error Error Error! 1');
    if (mysqli_num_rows($query) != 1) {
        die('Error Error Error! 2');
    }
    $a = mysqli_fetch_assoc($query);
    $ops = array($var['line1']['value'], $var['line2']['value'], $var['line3']['value']);
    $i = 1;
    foreach ($ops as $op) {
        switch ($op) {
            case 1:
                $var['line' . $i]['value_p'] = $a['posts'] . " post" . ($a['posts'] > 1 ? "s" : "");
                break;
            case 2:
                //$var['line'.$i]['value_p'] = mksize($a['downloaded']) . " - " . mksize($a['uploaded']);
                $var['line' . $i]['value_p'] = mksize($a['downloaded']) . " - " . mksize($a['uploaded']);
                break;
            case 3:
                list($days, $hours, $mins) = explode(",", calctime($a['irctotal']));
                $var['line' . $i]['value_p'] = "{$days} - {$hours}";
                //$var['line'.$i]['value_p'] = "not yet";
                break;
            case 4:
                $var['line' . $i]['value_p'] = $a['reputation'] . " point" . ($a['reputation'] > 1 ? "s" : "");
                break;
            case 5:
                foreach ($countries as $c) {
                    if ($c['id'] == $a['country']) {
                        $var['line' . $i]['value_p'] = $c;
                    }
                }
                break;
            case 6:
                $var['line' . $i]['value_p'] = $a['comments'] . " comment" . ($a['comments'] > 1 ? "s" : "");
                break;
            case 7:
                $var['line' . $i]['value_p'] = $a['browser'];
                break;
            case 8:
                $var['line' . $i]['value_p'] = $a['hits'] . " hit" . ($a['hits'] > 1 ? "s" : "");
                break;
                /*
                      case 9:
                          $lapsetime = ((($lapsetime = time() - sql_timestamp_to_unix_timestamp($a["last_login"])) / 3600) % 24) . ' h ' . (($lapsetime / 60) % 60) . ' min ' . ($lapsetime % 60) . ' s';
                          $var['line'.$i]['value_p'] = $lapsetime;
                          break;
                */
            /*
                  case 9:
                      $lapsetime = ((($lapsetime = time() - sql_timestamp_to_unix_timestamp($a["last_login"])) / 3600) % 24) . ' h ' . (($lapsetime / 60) % 60) . ' min ' . ($lapsetime % 60) . ' s';
                      $var['line'.$i]['value_p'] = $lapsetime;
                      break;
            */
            case 9:
                $var['line' . $i]['value_p'] = time_return($a['onlinetime']);
                break;
        }
        $i++;
    }
    if (is_writable($_settings . $user . ".set")) {
        file_put_contents($_settings . $user . ".set", serialize($var));
    } else {
        exit("Can't write user setting");
    }
    if (file_exists($_settings . $user . ".png")) {
        unlink($_settings . $user . ".png");
    }
    return $var;
}
Example #9
0
    } elseif ($_do == "top") {
        switch ($_type) {
            case "idle":
                $_q = "select username,irctotal FROM users ORDER BY irctotal DESC LIMIT 10";
                $txt = "Top 10 idle\n";
                break;
            case "uploaders":
                $_q = "select username, uploaded FROM users WHERE status = 'confirmed' ORDER BY uploaded DESC LIMIT 10";
                $txt = "Best uploaders (selected after uploaded amount)\n";
                break;
            case "torrents":
                $_q = "select count(t.id) as c, u.username FROM torrents as t LEFT JOIN users as u ON t.owner = u.id WHERE u.username <> '' GROUP  BY u.id ORDER BY c DESC LIMIT 10";
                $txt = "Best uploaders (selected after the torrents uploaded)\n";
                break;
            case "posters":
                $_q = "select count(p.id) as c, u.username FROM posts as p LEFT JOIN users as u ON p.user_id = u.id WHERE u.username <> '' GROUP  BY u.id ORDER BY c DESC LIMIT 10";
                $txt = "Best posters (selected after number of posts)\n";
                break;
        }
        $i = 1;
        $q = sql_query($_q) or exit(is_object($GLOBALS["___mysqli_ston"]) ? mysqli_error($GLOBALS["___mysqli_ston"]) : (($___mysqli_res = mysqli_connect_error()) ? $___mysqli_res : false));
        while ($a = mysqli_fetch_assoc($q)) {
            $txt .= $i . " - " . $a["username"] . " with " . ($_type == "idle" ? calctime($a["irctotal"]) . " idle" : ($_type == "uploaders" ? mksize($a["uploaded"]) . " uploaded" : ($_type == "torrents" ? $a["c"] . " torrents" : $a["c"] . " posts"))) . "\n";
            $i++;
        }
        echo $txt;
        unset($a);
        unset($q);
        unset($txt);
    }
}
Example #10
0
File: lib.php Project: philum/cms
function timetravel()
{
    $r = define_digr();
    $n = max(array_flip($r)) / 365;
    unset($r[1]);
    unset($r[7]);
    unset($r[30]);
    unset($r[90]);
    foreach ($r as $k => $v) {
        $tim = calctime($k);
        $t = date('Y', $tim);
        $ret[$t] = $tim;
    }
    return $ret;
}