Пример #1
0
                }
                break;
        }
    }
}
// Only registered users can see the chat messages
if ($current_user->user_id > 0 && empty($_REQUEST['nochat'])) {
    check_chat();
    get_chat();
}
$db->barrier();
if ($last_timestamp == 0) {
    $last_timestamp = $now_f;
}
if (intval($_REQUEST['r']) % 10 == 0) {
    update_sneakers();
}
$ccntu = $db->get_var("select count(*) from sneakers where sneaker_user > 0 and sneaker_id not like 'jabber/%'");
$ccntj = $db->get_var("select count(*) from sneakers where sneaker_user > 0 and sneaker_id like 'jabber/%'");
$ccnta = $db->get_var("select count(*) from sneakers where sneaker_user = 0");
$ccnt = $ccntu + $ccnta + $ccntj . " ({$ccntu}+{$ccntj}+{$ccnta})";
$data['ts'] = $last_timestamp;
$data['ccnt'] = $ccnt;
$data['v'] = $sneak_version;
if (count($events) > 0) {
    krsort($events);
}
$counter = 0;
$data['events'] = array_values($events);
echo json_encode($data);
function check_chat()
Пример #2
0
                }
                break;
        }
    }
}
// Only registered users can see the chat messages
if ($current_user->user_id > 0 && empty($_REQUEST['nochat'])) {
    check_chat();
    get_chat();
}
$db->barrier();
if ($last_timestamp == 0) {
    $last_timestamp = $now_f;
}
if (intval($_REQUEST['r']) % 10 == 0) {
    update_sneakers($data);
}
$data['ts'] = $last_timestamp;
$data['v'] = $globals['sneak_version'];
if (count($events) > 0) {
    krsort($events);
}
$counter = 0;
$data['events'] = array_values($events);
echo json_encode($data);
exit(0);
function check_chat()
{
    global $db, $current_user, $now, $now_f, $globals, $events;
    if (empty($_POST['chat'])) {
        return;
Пример #3
0
$client_version = $_GET['v'];
if (empty($client_version) || $client_version != $sneak_version) {
	echo "window.location.reload(true);";
	exit();
}
$now = time();

$last_timestamp = $time;

if (empty($_GET['nochat'])) {
	check_chat();
	get_chat($time);
}

if($_GET['r'] % 5 == 0) update_sneakers();

if (empty($_GET['novote']) || empty($_GET['noproblem'])) get_votes($time);
if (empty($_GET['nonew'])) get_new_stories($time);
if (empty($_GET['nopublished'])) get_new_published($time);
if (empty($_GET['nocomment'])) get_comments($time);

if($last_timestamp == 0) $last_timestamp = $now;

$ccnt = $db->get_var("select count(*) from sneakers");
echo "ts=$last_timestamp;ccnt=$ccnt;\n";
if(count($events) < 1) exit;
ksort($events);
$keys = array_reverse(array_keys($events));
$lines = min(count($keys), $max_items);