Пример #1
0
    $Pie = new PIE_CHART(750, 400, array('Other' => 1, 'Percentage' => 1));
    foreach ($Platforms as $Platform) {
        list($Label, $Users) = $Platform;
        $Pie->add($Label, $Users);
    }
    $Pie->transparent();
    $Pie->color('8A00B8');
    $Pie->generate();
    $PlatformDistribution = $Pie->url();
    $Cache->cache_value('platform_distribution', $PlatformDistribution, 3600 * 24 * 14);
}
if (!($BrowserDistribution = $Cache->get_value('browser_distribution'))) {
    include_once SERVER_ROOT . '/classes/charts.class.php';
    $DB->query("\n\t\tSELECT Browser, COUNT(UserID) AS Users\n\t\tFROM users_sessions\n\t\tGROUP BY Browser\n\t\tORDER BY Users DESC");
    $Browsers = $DB->to_array();
    $Pie = new PIE_CHART(750, 400, array('Other' => 1, 'Percentage' => 1));
    foreach ($Browsers as $Browser) {
        list($Label, $Users) = $Browser;
        $Pie->add($Label, $Users);
    }
    $Pie->transparent();
    $Pie->color('008AB8');
    $Pie->generate();
    $BrowserDistribution = $Pie->url();
    $Cache->cache_value('browser_distribution', $BrowserDistribution, 3600 * 24 * 14);
}
//Timeline generation
if (!(list($Labels, $InFlow, $OutFlow, $Max) = $Cache->get_value('users_timeline'))) {
    $DB->query("\n\t\tSELECT DATE_FORMAT(JoinDate,'%b \\'%y') AS Month, COUNT(UserID)\n\t\tFROM users_info\n\t\tGROUP BY Month\n\t\tORDER BY JoinDate DESC\n\t\tLIMIT 1, 12");
    $TimelineIn = array_reverse($DB->to_array());
    $DB->query("\n\t\tSELECT DATE_FORMAT(BanDate,'%b \\'%y') AS Month, COUNT(UserID)\n\t\tFROM users_info\n\t\tGROUP BY Month\n\t\tORDER BY BanDate DESC\n\t\tLIMIT 1, 12");
Пример #2
0
    }
    foreach ($TimelineOut as $Month) {
        list($Label, $Amount) = $Month;
        $OutFlow[] = number_format($Amount / $Max * 100, 4);
    }
    foreach ($TimelineNet as $Month) {
        list($Label, $Amount) = $Month;
        $NetFlow[] = number_format($Amount / $Max * 100, 4);
    }
    $Cache->cache_value('torrents_timeline', array($Labels, $InFlow, $OutFlow, $NetFlow, $Max), mktime(0, 0, 0, date('n') + 1, 2));
    //Tested: fine for dec -> jan
}
include_once SERVER_ROOT . '/classes/charts.class.php';
$DB->query("\n\tSELECT tg.CategoryID, COUNT(t.ID) AS Torrents\n\tFROM torrents AS t\n\t\tJOIN torrents_group AS tg ON tg.ID = t.GroupID\n\tGROUP BY tg.CategoryID\n\tORDER BY Torrents DESC");
$Groups = $DB->to_array();
$Pie = new PIE_CHART(750, 400, array('Other' => 1, 'Percentage' => 1));
foreach ($Groups as $Group) {
    list($CategoryID, $Torrents) = $Group;
    $CategoryName = $Categories[$CategoryID - 1];
    $Pie->add($CategoryName, $Torrents);
}
$Pie->transparent();
$Pie->color('FF33CC');
$Pie->generate();
$Categories = $Pie->url();
View::show_header();
?>

<div class="box pad center">
	<h1>Uploads by month</h1>
	<img src="https://chart.googleapis.com/chart?cht=lc&amp;chs=880x160&amp;chco=000D99,99000D,00990D&amp;chg=0,-1,1,1&amp;chxt=y,x&amp;chxs=0,h&amp;chxl=1:|<?php 
Пример #3
0
    if (!in_array($_GET['table'], $Tables)) {
        error(0);
    }
    $DB->query('SHOW CREATE TABLE ' . db_string($_GET['table']));
    list(, $Schema) = $DB->next_record(MYSQLI_NUM, false);
    header('Content-type: text/plain');
    die($Schema);
}
//Cache the tables for 4 hours, makes sorting faster
if (!($Tables = $Cache->get_value('database_table_stats'))) {
    $DB->query('SHOW TABLE STATUS');
    $Tables = $DB->to_array();
    $Cache->cache_value('database_table_stats', $Tables, 3600 * 4);
}
require SERVER_ROOT . '/classes/class_charts.php';
$Pie = new PIE_CHART(750, 400, array('Other' => 1, 'Percentage' => 1, 'Sort' => 1));
//Begin sorting
$Sort = array();
switch (empty($_GET['order_by']) ? '' : $_GET['order_by']) {
    case 'name':
        foreach ($Tables as $Key => $Value) {
            $Pie->add($Value[0], $Value[6] + $Value[8]);
            $Sort[$Key] = $Value[0];
        }
        break;
    case 'engine':
        foreach ($Tables as $Key => $Value) {
            $Pie->add($Value[0], $Value[6] + $Value[8]);
            $Sort[$Key] = $Value[1];
        }
        break;