diff options
author | emkael <emkael@tlen.pl> | 2018-11-14 00:46:11 +0100 |
---|---|---|
committer | emkael <emkael@tlen.pl> | 2018-11-14 01:10:35 +0100 |
commit | 030773982c27583086bf93182b122fc5cefb8ad7 (patch) | |
tree | 57d10d47aaab5f212c68f135e1ee126e52065d5c /tdd/tdd-protocol.php | |
parent | e80a2610d5b29b35fa7a787bb5e8ae72c856c2c8 (diff) |
Encapsulation of board database
Diffstat (limited to 'tdd/tdd-protocol.php')
-rw-r--r-- | tdd/tdd-protocol.php | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/tdd/tdd-protocol.php b/tdd/tdd-protocol.php index f8a6e3e..7d9abc2 100644 --- a/tdd/tdd-protocol.php +++ b/tdd/tdd-protocol.php @@ -2,8 +2,6 @@ require_once('tdd-bootstrap.php'); -refresh_board_database(); - // parsing URI parts from full request string $uri = explode('b-', basename($_SERVER['REQUEST_URI'])); if (count($uri) < 2) { @@ -14,16 +12,16 @@ $board = (int)(array_pop($uri)); $roundPrefix = implode('b-', $uri); try { + $database = new BoardDB(); // GET parameters pre-parsed by mod_rewrite are used for HTML fallback // in case {$prefix}{$round} combo is not matched against board DB $protocol = new Protocol($_GET['prefix'], $_GET['round'], $board); $html_filename = $protocol->get_filename(); - foreach ($board_database as $prefix => $rounds) { + foreach ($database->getDB() as $prefix => $rounds) { foreach ($rounds as $round => $boards) { if ($prefix . $round === $roundPrefix) { - $deals_by_tables = load_deals_for_tables($board_database, $prefix, $round, $board); - if (count($deals_by_tables) > 0) { - foreach($deals_by_tables as $table => $deal) { + if (isset($boards[$board])) { + foreach($boards[$board] as $table => $deal) { $protocol->set_deal($table, $deal); } echo $protocol->output(); |