page = $page;
if ($page->settings->header_show_totals) {
$t = $page->settings->table;
$t_bans = $t['bans'];
$t_mutes = $t['mutes'];
$t_warnings = $t['warnings'];
$t_kicks = $t['kicks'];
try {
$st = $page->conn->query("SELECT
(SELECT COUNT(*) FROM $t_bans),
(SELECT COUNT(*) FROM $t_mutes),
(SELECT COUNT(*) FROM $t_warnings),
(SELECT COUNT(*) FROM $t_kicks)");
($row = $st->fetch(PDO::FETCH_NUM)) or die('Failed to fetch row counts.');
$st->closeCursor();
$this->count = array(
'bans.php' => $row[0],
'mutes.php' => $row[1],
'warnings.php' => $row[2],
'kicks.php' => $row[3],
);
} catch (PDOException $ex) {
Settings::handle_error($page->settings, $ex);
}
}
}
function navbar($links) {
echo '
';
$request = $this->page->get_requested_page();
foreach ($links as $page => $title) {
$li = "li";
$class = "nav-item";
if ($this->page->settings->simple_urls) {
if ("$request.php" === $page) {
$class .= " active navbar-active";
}
} else if ((substr($_SERVER['SCRIPT_NAME'], -strlen($page))) === $page) {
$class .= " active navbar-active";
}
$li .= " class=\"$class\"";
if ($this->page->settings->header_show_totals && isset($this->count[$page])) {
$title .= ' ';
$title .= $this->count[$page];
$title .= "";
}
$page = $this->page->link($page);
echo "<$li>$title";
}
echo '
';
}
function print_header() {
$settings = $this->page->settings;
?>
name; ?>
navbar(array(
"index.php" => $this->page->t("title.index"),
"bans.php" => $this->page->t("title.bans"),
"mutes.php" => $this->page->t("title.mutes"),
"warnings.php" => $this->page->t("title.warnings"),
"kicks.php" => $this->page->t("title.kicks"),
));
?>