Esempio n. 1
0
function getMonthlyHits()
{
    $timestamp = convertToStamp(getNow());
    $mn = substr($timestamp, 4, 2);
    $yr = substr($timestamp, 0, 4);
    $months = array('this month', 'last month', '2 months ago', '3 months ago', '4 months ago', '5 months ago', '6 months ago', '7 months ago', '8 months ago', '9 months ago', '10 months ago', '11 months ago');
    $i = 0;
    foreach ($months as $d) {
        $out['first'] = date('Y-m', mktime('00', '00', '00', $mn - $i, '01', $yr));
        $id = $i <= 1 ? $d : $out['first'];
        $arr[$id] = array($out['first']);
        $i++;
    }
    return $arr;
}
Esempio n. 2
0
 function page_hits()
 {
     global $go;
     // default/validate $_GET
     $go['page'] = getURI('page', 0, 'digit', 5);
     $this->template->location = $this->lang->word('main');
     // sub-locations
     $this->template->sub_location[] = array($this->lang->word('referrers'), "?a={$go['a']}&amp;q=refer");
     $this->template->sub_location[] = array($this->lang->word('main'), "?a={$go['a']}");
     load_module_helper('files', $go['a']);
     $today = convertToStamp(getNow());
     $day = substr($today, 6, 2);
     $mn = substr($today, 4, 2);
     $yr = substr($today, 0, 4);
     $thirtydays = date('Y-m-d', mktime('00', '00', '00', $mn - 1, $day, $yr));
     $rs = $this->db->fetchArray("SELECT hit_page, \n            COUNT(hit_page) AS 'total' \n            FROM " . PX . "stats \n            GROUP by hit_page \n            ORDER BY total DESC");
     // ++++++++++++++++++++++++++++++++++++++++++++++++++++
     // table for all our results
     $body = "<table cellpadding='0' cellspacing='0' border='0'>\n";
     $body .= "<tr class='top'>\n";
     $body .= "<th width='90%' class='toptext'><strong>" . $this->lang->word('page') . "</strong></th>\n";
     $body .= "<th width='10%' class='toptext'><strong>" . $this->lang->word('visits') . "</strong></th>\n";
     $body .= "</tr>\n";
     $body .= "</table>\n";
     // dynamic output for table
     $body .= "<table cellpadding='0' cellspacing='0' border='0'>\n";
     if (!$rs) {
         $body .= tr(td('No hits yet', "colspan='2'"));
     } else {
         foreach ($rs as $ar) {
             $body .= tr(td($ar['hit_page'], "width='90%' class='cell-doc'") . td($ar['total'], "width='10%' class='cell-mid'"), row_color(" class='color'"));
         }
     }
     // end dynamic rows output
     $body .= "</table>\n";
     $this->template->body = $body;
     return;
 }