This commit is contained in:
ruan 2015-09-10 20:07:15 +02:00
parent a83db5dd6f
commit 8e99801af6
2 changed files with 1531 additions and 25 deletions

File diff suppressed because it is too large Load Diff

View File

@ -16,16 +16,6 @@ abstract class Info {
$this->table = $page->table; $this->table = $page->table;
} }
function name() {
return ucfirst($this->page->type);
}
function permanent() {
return $this->row['until'] <= 0;
}
abstract function basic_info($row, $player_name);
static function create($row, $page, $type) { static function create($row, $page, $type) {
switch ($type) { switch ($type) {
case "ban": case "ban":
@ -39,6 +29,16 @@ abstract class Info {
} }
return null; return null;
} }
function name() {
return ucfirst($this->page->type);
}
function permanent() {
return $this->row['until'] <= 0;
}
abstract function basic_info($row, $player_name);
} }
class BanInfo extends Info { class BanInfo extends Info {
@ -120,7 +120,7 @@ if ($st->execute(array($id))) {
die("Error: $type not found in database."); die("Error: $type not found in database.");
} }
$player_name = $page->get_name($row['uuid']); $player_name = $page->get_name($row['uuid']);
if ($player_name == null) { if ($player_name === null) {
die("Error: Player name not found."); die("Error: Player name not found.");
} }
@ -150,18 +150,18 @@ if ($st->execute(array($id))) {
<div class="row" style="margin-bottom:60px;"> <div class="row" style="margin-bottom:60px;">
<?php $page->print_page_header(); ?> <?php $page->print_page_header(); ?>
<div style="text-align: center;" class="col-lg-12"> <div style="text-align: center;" class="col-lg-12">
<?php <?php
$page->table_begin(); $page->table_begin();
$map = $info->basic_info($row, $player_name); $map = $info->basic_info($row, $player_name);
$permanent_val = $info->page->permanent[$type]; $permanent_val = $info->page->permanent[$type];
foreach ($map as $key => $val) { foreach ($map as $key => $val) {
if ($permanent && $key === "Expires" && $val === $permanent_val) { if ($permanent && $key === "Expires" && $val === $permanent_val) {
continue; continue;
}
echo "<tr><td>$key</td><td>$val</td></tr>";
} }
$page->table_end(false); echo "<tr><td>$key</td><td>$val</td></tr>";
?> }
$page->table_end(false);
?>
</div> </div>
</div> </div>
<?php <?php