Ejemplo n.º 1
0
 public static function getClientId()
 {
     $client_id = intval(API::getParam('client_id'));
     if (!$client_id) {
         http_response_code(400);
         API::printJSON(["error" => "Please specify a valid client_id"]);
         return;
     }
     return User::getMasterClientId($client_id);
 }
Ejemplo n.º 2
0
<?php

require_once __DIR__ . '/../API.php';
API::init();
$limit = API::getParam('limit', 10);
$offset = API::getParam('offset', 0);
$log = LogVisualizer::getLastLog($limit, $offset);
API::printJSON($log);
Ejemplo n.º 3
0
<?php

require_once __DIR__ . '/../API.php';
API::init();
if (!Config::get("realtime.enabled")) {
    http_response_code(403);
    API::printJSON(array('error' => 'Realtime disabled'));
}
try {
    $ts3 = new Ts3ServerQuery(Config::get("realtime.host"), Config::get("realtime.port", 10011), Config::get("realtime.username", "serveradmin"), Config::get("realtime.password"));
    $users = RealtimeUsers::getOnlineUsers($ts3);
    $channels = RealtimeChannels::getChannels($ts3);
} catch (Exception $e) {
    http_response_code(500);
    API::printJSON(array('error' => 'Boh...'));
}
API::printJSON(RealtimeFormatter::getRealtime($users, $channels));
Ejemplo n.º 4
0
<?php

require_once __DIR__ . '/../API.php';
API::init();
$client_id = API::getClientId();
$daily = DailyUserUptimeVisualizer::getDailyUserUptime($client_id);
API::printJSON($daily);
Ejemplo n.º 5
0
<?php

require_once __DIR__ . '/../API.php';
API::init();
$client_id = API::getClientId();
$streak = StreakVisualizer::getStreak($client_id);
API::printJSON($streak);
Ejemplo n.º 6
0
<?php

require_once __DIR__ . '/../API.php';
API::init();
$lastDate = FooterVisualizer::getLastDate();
API::printJSON($lastDate);
Ejemplo n.º 7
0
<?php

require_once __DIR__ . '/../API.php';
API::init();
$counts = CounterVisualizer::getCounters();
API::printJSON($counts);
Ejemplo n.º 8
0
<?php

require_once __DIR__ . '/../API.php';
API::init();
$channels = ChannelVisualizer::getChannels();
API::printJSON($channels);
Ejemplo n.º 9
0
<?php

require_once __DIR__ . '/../API.php';
API::init();
$client_id = API::getClientId();
$username = ProbableUsernameVisualizer::getProbableUsername($client_id);
$online = OnlineRange::getOnlineRanges();
$is_online = isset($online[$client_id]);
if ($is_online) {
    $online_since = $online[$client_id]->start;
    $online_for = (new DateTime())->getTimestamp() - $online_since->getTimestamp();
} else {
    $online_since = null;
    $online_for = 0;
}
$info = ["client_id" => $client_id, "username" => $username, "online" => $is_online, "online_since" => $online_since, "online_for" => $online_for];
API::printJSON($info);
Ejemplo n.º 10
0
<?php

require_once __DIR__ . '/../API.php';
API::init();
$limit = API::getParam('limit', 50);
$offset = API::getParam('offset', 0);
$scoreboard = UptimeVisualizer::getUptimeScoreboard($limit, $offset);
API::printJSON($scoreboard);
Ejemplo n.º 11
0
<?php

require_once __DIR__ . '/../API.php';
API::init();
$averages = DailyVisualizer::getGrid();
API::printJSON($averages);
Ejemplo n.º 12
0
<?php

require_once __DIR__ . '/../API.php';
API::init();
$client_id = API::getClientId();
$limit = API::getParam('limit', 10);
$offset = API::getParam('offset', 0);
$usernames = UsernameUptimeVisualizer::getUsernameUptime($client_id, $limit, $offset);
API::printJSON($usernames);