Beispiel #1
0
function fs_echo_footer()
{
    $FS_PATH = fs_get_firestats_path();
    if (!$FS_PATH) {
        return;
    }
    require_once $FS_PATH . '/php/db-sql.php';
    $stats = get_option('firestats_show_footer_stats') == 'true';
    if ($stats) {
        $count = fs_get_hit_count();
        $unique = fs_get_unique_hit_count();
        $last_24h_count = fs_get_hit_count(1);
        $last_24h_unique = fs_get_unique_hit_count(1);
        echo $count . ' ' . fs_r('pages viewed') . ", {$last_24h_count} " . fs_r('today') . "<br/>";
        echo $unique . ' ' . fs_r('visits') . ", {$last_24h_unique} " . fs_r('today') . "<br/>";
    }
    echo fs_get_powered_by('fs_powered_by');
}
Beispiel #2
0
function fs_api_get_visits($days_ago = NULL, $site_id = true, $url = null)
{
    require_once dirname(__FILE__) . '/db-sql.php';
    $url_id = null;
    if ($url) {
        $url_id = fs_get_url_id($url);
        if ($url_id === null) {
            return 0;
        }
    }
    return fs_get_unique_hit_count($days_ago, $site_id, $url_id);
}
Beispiel #3
0
function fs_ajax_send_update(&$response)
{
    if (!isset($_POST['update'])) {
        return;
    }
    $update_blocks = explode(';', $_POST['update']);
    // if we have no more blocks return.
    if (count($update_blocks) == 0) {
        return;
    }
    // pop the first block.
    $update = array_shift($update_blocks);
    if (count($update_blocks) > 0) {
        // push the remaining items to the response, so the client will be able to send antoher request with the rest.
        $response['send_request'] = "action=updateFields&update=" . implode(";", $update_blocks);
    }
    $updates = explode(',', $update);
    foreach ($updates as $update) {
        switch ($update) {
            case 'popular_pages':
                $response['fields'][$update] = addslashes(fs_get_popular_pages_tree());
                break;
            case 'records_table':
                $response['fields'][$update] = fs_get_records_table();
                break;
            case 'countries_list':
                $response['fields'][$update] = fs_get_countries_list();
                break;
            case 'fs_recent_referers':
                $response['fields'][$update] = addslashes(fs_get_recent_referers_tree());
                $response['type'][$update] = 'tree';
                break;
            case 'fs_browsers_tree':
                $response['fields'][$update] = fs_get_browsers_tree();
                $response['type'][$update] = 'tree';
                break;
            case 'fs_os_tree':
                $response['fields'][$update] = fs_get_os_tree();
                $response['type'][$update] = 'tree';
                break;
            case 'fs_search_terms':
                $response['fields'][$update] = fs_get_search_terms_tree();
                $response['type'][$update] = 'tree';
                break;
            case 'botlist_placeholder':
                $response['fields']['botlist_placeholder'] = addslashes(fs_get_bot_list());
                break;
            case 'num_excluded':
                $response['fields']['num_excluded'] = fs_get_num_excluded();
                break;
            case 'stats_total_count':
                $response['fields']['stats_total_count'] = fs_get_hit_count();
                break;
            case 'stats_total_unique':
                $response['fields']['stats_total_unique'] = fs_get_unique_hit_count();
                break;
            case 'stats_total_count_last_day':
                $response['fields']['stats_total_count_last_day'] = fs_get_hit_count(1);
                break;
            case 'stats_total_unique_last_day':
                $response['fields']['stats_total_unique_last_day'] = fs_get_unique_hit_count(1);
                break;
            case 'fs_sites_table':
                $response['fields']['fs_sites_table'] = fs_get_sites_manage_table();
                break;
            case 'fs_users_table':
                $response['fields']['fs_users_table'] = fs_get_users_manage_table();
                break;
            case 'sites_filter_span':
                $response['fields']['sites_filter_span'] = fs_get_sites_list();
                break;
            case 'fs_archive_status':
                $response['fields']['fs_archive_status'] = sprintf(fs_r("%s days can be compacted, database size %s"), fs_get_num_old_days(), sprintf("%.1f MB", fs_get_database_size() / (1024 * 1024)));
                break;
            default:
                ajax_error($response, sprintf("AJAX:" . fs_r('Unkown field: %s'), $update));
        }
    }
}