Example #1
0
<?php

////////////////////////////////////////////////////////////////////////////////
//   Copyright (C) ReloadCMS Development Team                                 //
//   http://reloadcms.com                                                     //
//   This product released under GNU General Public License v2                //
////////////////////////////////////////////////////////////////////////////////
if (!empty($_POST['cleanstats'])) {
    statistic_clean();
}
if ($stats = statistic_get()) {
    $frm = new InputForm('', 'post', __('Clean stats'));
    $frm->addbreak(__('Site statistics'));
    $frm->addrow(__('Total hits'), $stats['totalhits']);
    $frm->addrow(__('Today hits'), $stats['todayhits']);
    $frm->addrow(__('Today hosts'), sizeof($stats['todayhosts']));
    $frm->addbreak(__('Popular pages'));
    arsort($stats['popular']);
    array_splice($stats['popular'], 20);
    foreach ($stats['popular'] as $page => $count) {
        $frm->addrow('<a href="' . htmlspecialchars($page) . '" target="_blank">' . htmlspecialchars($page) . '</a>', $count);
    }
    $frm->addbreak(__('Today users'));
    arsort($stats['todayhosts']);
    foreach ($stats['todayhosts'] as $ip => $count) {
        $frm->addrow($ip, $count);
    }
    $frm->addbreak(__('Today referers'));
    arsort($stats['ref']);
    foreach ($stats['ref'] as $ref => $count) {
        $frm->addrow(htmlspecialchars($ref), $count);
Example #2
0
<?php

if (empty($system->config['disable_stats']) && ($stats = statistic_get())) {
    $guests_count = 0;
    foreach ($stats['online'] as $ip => $data) {
        if ($data['name'] == 'guest') {
            $guests_count++;
        }
    }
    $result = '
<table border="0" cellpadding="0" cellspacing="1" width="100%">
<tr>';
    if (!empty($stats['online']) || !empty($stats['guests_online'])) {
        $result .= '
    <td align="left" class="row1" colspan="2">' . __('Online') . ' - ' . sizeof($stats['online']) . ' (' . (sizeof($stats['online']) - $guests_count) . ' ' . __('registered') . ')</td>
</tr>';
    }
    if (!empty($stats['online'])) {
        $result .= '
<tr>
    <td align="right" class="row2" colspan="2">';
        $i = 0;
        foreach ($stats['online'] as $ip => $data) {
            if ($data['name'] !== 'guest') {
                if ($i != 0) {
                    $result .= ', ';
                }
                $result .= user_create_link($data['name'], $data['nick']);
                $i++;
            }
        }