private function show_day_information($type, $date) { $filter = new filter($this->db, $this->output, $this->user); $filter->to_output($this->model->table, $this->model->hostnames); if (($stats = $this->model->get_day_statistics($type, $date, $filter->hostname, $filter->webserver)) === false) { $this->output->add_tag("result", "Database error."); return false; } $graph = new graph($this->output); $graph->title = $this->graphs[$type] . " for " . date("l j F Y", strtotime($date)); $graph->width = 960; $graph->height = GRAPH_HEIGHT; foreach ($stats as $hour => $count) { $graph->add_bar("Hour " . $hour, $count, "hour"); } $graph->to_output(); if (($stats = $this->model->get_day_information($type, $date, $filter->hostname, $filter->webserver)) === false) { $this->output->add_tag("result", "Database error."); return false; } $this->output->open_tag("day", array("hostnames" => show_boolean($this->model->hostnames), "label" => $this->graphs[$type])); foreach ($stats as $stat) { if ($type == "requests" || $type == "bytes_sent") { $stat["count"] = $this->model->readable_number($stat["count"]); } $this->output->record($stat, "stat"); } $this->output->close_tag(); }
public function execute() { if (isset($_SERVER["hide_ss"]) == false) { $_SERVER["hide_ss"] = true; } if ($_SERVER["REQUEST_METHOD"] == "POST" && $_POST["submit_button"] == "hidess") { $_SERVER["hide_ss"] = is_true($_POST["hide_ss"]); } $this->output->add_css("banshee/filter.css"); $filter = new filter($this->db, $this->output, $this->user); $filter->to_output($this->model->table, false); if (($count = $this->model->count_events($filter->webserver, $_SERVER["hide_ss"])) === false) { $this->output->add_tag("result", "Database error."); return; } $paging = new pagination($this->output, "events", $this->settings->event_page_size, $count); if ($_SERVER["REQUEST_METHOD"] == "POST") { $paging->reset(); } if (($events = $this->model->get_events($paging->offset, $paging->size, $filter->webserver, $_SERVER["hide_ss"])) === false) { $this->output->add_tag("result", "Database error."); return; } $this->output->open_tag("events", array("hide_ss" => show_boolean($_SERVER["hide_ss"]))); foreach ($events as $event) { $event["timestamp"] = date("j F Y, H:i:s", $event["timestamp"]); $event["event"] = $this->output->secure_string($event["event"], "_"); $this->output->record($event, "event"); } $paging->show_browse_links(); $this->output->close_tag(); }