Beispiel #1
0
$theme = 'themes/default/';
$powerlevels = array(0 => 'Banned', 1 => 'Guest', 5 => 'Member', 15 => 'Moderator', 20 => 'Administrator', 50 => 'Owner');
$guest_user = array('userid' => 0, 'username' => 'Guest', 'powerlevel' => '1');
$avatarpath = '/data/www/tb2010/avatars/';
// connect to SQL
function dump_sql_error()
{
    print '<html><head><style type=\'text/css\'>body { font-family: Arial, sans-serif; text-align: center; }</style></head><body><b>Error occurred while connecting to the database:</b><br />' . mysql_error() . '<br /><br />We hope to have it fixed shortly.</body></html>';
    exit;
}
$sql_conn = @mysql_connect($sql_host, $sql_user, $sql_pass) or dump_sql_error();
@mysql_select_db($sql_db) or dump_sql_error();
session_start();
ob_start();
// authenticate the user
do_auth();
$s[user][groups_raw] = $s[user][groups];
$s[user][groups] = explode(',', $s[user][groups]);
if ($s[user][powerlevel] == 0) {
    print '<html><head><style type=\'text/css\'>body { font-family: Arial, sans-serif; text-align: center; }</style></head><body>Your account is banned. :)</body></html>';
    ob_end_flush();
    exit;
}
// update last activity
if ($s[logged_in]) {
    $currenttime = time();
    $ip = $_SERVER['REMOTE_ADDR'];
    dbquery("UPDATE users SET lastactive = {$currenttime}, lastip = '{$ip}' WHERE userid = {$s[user][userid]}");
}
// quick shortcuts
if (isset($_GET['showuser']) && $_GET['showuser'] != '') {
Beispiel #2
0
    curl_close($ch);
    list($headers, $body) = explode("\r\n\r\n", $response, 2);
    $lines = explode("\n", $headers);
    $auth = array();
    $grab = array("X-Storage-Token", "X-Storage-Url", "X-Auth-Token");
    foreach ($lines as $line) {
        $parts = explode(" ", $line);
        $name = $parts[0];
        $name = trim($name, ": ");
        if (in_array($name, $grab)) {
            $auth[$name] = trim($parts[1]);
        }
    }
    return $auth;
}
$auth = do_auth();
printf(" \n **** parsed auth headers for PUT **** \n");
print_r($auth);
$ch2 = curl_init();
// get all files in css dir
$files = array();
// load everything from local css folder into
// <storage-url>/asset/css/local-file-path
foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator('css')) as $path) {
    $filename = sprintf("%s", $path);
    $pos = strrpos($filename, "/");
    if ($pos !== false) {
        $last = substr($filename, $pos + 1);
        if ($last == '.' || $last == '..') {
            printf(" ignore file :: %s \n", $filename);
        } else {
        $matches = array();
        if (preg_match('!' . $directory . '/[0-9]+_(.*).mp4!', $file, $matches)) {
            $existing[] = $matches[1];
        }
    }
} else {
    p('Not downloads found');
}
$authed = false;
if (file_exists(LD_COOKIEJAR)) {
    p('Checking if our previous session is still active ... ');
    $authed = check_session($email);
}
if (!$authed) {
    p('Authenticating .. ');
    $session = do_auth($email, $password);
    if ($session === false) {
        die('failed to auth, dying' . PHP_EOL);
    }
    p('We are authenticated!');
}
p('Grab list from /all');
$casts = grab_all();
if ($casts === false) {
    die('Failed to grab all casts' . PHP_EOL);
}
// Find existing casts and unset them
// this is a bit ghetto, but who has the time
$casts_tmp = array();
$pre_count = count($casts);
foreach ($casts as $cast) {