require_once './include/sql.inc'; require_once './include/util.inc'; /* * Main Function */ // Check for cached file if (file_exists(GUS_cachefile()) and date('Yn') !== $year . $month) { $display = GUS_getcache(); } else { // no cached version found - generate page if (SEC_inGroup('Root') or SEC_hasRights('gus.view')) { $T = GUS_template_start('daily.thtml'); } else { $T = GUS_template_start('daily-a.thtml'); } $T->set_var('additional_nav', GUS_make_nav($day, $month, $year)); $T->set_block('page', 'ROW', 'ABlock'); $T->set_var(array('stats_name' => 'gus', 'site_url' => $_CONF['site_url'], 'period_title' => $LANG_GUS00['day_title'], 'anon_title' => $LANG_GUS00['anon_title'], 'reg_title' => $LANG_GUS00['reg_title'], 'page_title' => $LANG_GUS00['page_title'], 'story_title' => $LANG_GUS00['new_stories'], 'comm_title' => $LANG_GUS00['new_comments'], 'link_title' => $LANG_GUS00['link_title'])); $anon = 0; $reg = 0; $pages = 0; $stories = 0; $comments = 0; $linksf = 0; $days = Date('t', mktime(0, 0, 0, $month, 1, $year)); // special case for this month - don't show days in the future $today = getdate(); if ($today['year'] == $year and $today['mon'] == $month) { $days = min($days, $today['mday']); } $num_pages = ceil($days / $_GUS_days);
if (!isset($_GET['page']) or empty($_GET['page'])) { $curpage = 1; } else { $curpage = (int) $_GET['page']; } $header_url = GUS_create_url('sort'); $base_url = GUS_create_url(''); $navigation_URLs = COM_printPageNavigation($base_url, $curpage, $num_pages); // limit to the sql $offset = ($curpage - 1) * $_GUS_limit; $sql .= " LIMIT " . $offset . ', ' . $_GUS_limit; $rec = DB_query($sql); $nrows = DB_numRows($rec); // set template $T = GUS_template_start(); $T->set_var('additional_nav', GUS_make_nav($day, $month, $year, "ip_addr={$ip_addr}")); //---------------------- // IP info block $block_title = "{$ip_addr} [" . $_GUS_Whois_URL_start . $ip_addr . $_GUS_Whois_URL_end . 'whois</a>]'; // Check to see if collect stats on this IP $result = DB_query("SELECT COUNT(*) AS ignored\n\t\t\t\t\t\tFROM {$_TABLES['gus_ignore_ip']}\n\t\t\t\t\t\tWHERE '{$ip_addr}' LIKE ip\n\t\t\t\t\t\tLIMIT 1", 1); $row = DB_fetchArray($result, FALSE); $actionURL = $_SERVER['PHP_SELF'] . '?' . htmlentities($_SERVER['QUERY_STRING']); $data = "<table width=\"100%\" cellspacing=0 cellpadding=0><tr class=header><td>{$block_title}</td></tr><tr><td>" . '<table cellspacing=0 cellpadding=0 style="border: 0px;"><tr>' . '<td class=col_right>Stats collection:</td>'; if ($row['ignored'] == '1') { $data .= '<td><span style="font-weight: bold;">off</span></td>' . "<td><form method='POST' action='" . $actionURL . "'>" . "<input type=submit value='Turn On'>" . "<input type='hidden' value='1' name='gus_ip_collect_data'>" . '</form></td>'; } else { $data .= '<td><span style="font-weight: bold;">on</span></td>' . "<td><form method='POST' action='" . $actionURL . "'>" . "<input type=submit value='Turn Off'>" . "<input type='hidden' value='0' name='gus_ip_collect_data'>" . '</form></td>'; } $data .= '</tr><tr>' . '<td class=col_right>Ban IP:</td>'; // check for the Ban plugin