diff options
Diffstat (limited to 'tdd/tdd-protocol.php')
-rw-r--r-- | tdd/tdd-protocol.php | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/tdd/tdd-protocol.php b/tdd/tdd-protocol.php index 7d9abc2..a7ab513 100644 --- a/tdd/tdd-protocol.php +++ b/tdd/tdd-protocol.php @@ -4,11 +4,13 @@ require_once('tdd-bootstrap.php'); // parsing URI parts from full request string $uri = explode('b-', basename($_SERVER['REQUEST_URI'])); +// if "b-" is not found in the string, it's a direct call, all mod_rewrite requests do have it if (count($uri) < 2) { die('This script cannot be called directly!'); } - +// last part of URI is board number $board = (int)(array_pop($uri)); +// the rest is compiled back to separate prefix from round later on $roundPrefix = implode('b-', $uri); try { @@ -19,6 +21,7 @@ try { $html_filename = $protocol->get_filename(); foreach ($database->getDB() as $prefix => $rounds) { foreach ($rounds as $round => $boards) { + // matching each prefix and round in DB to URI if ($prefix . $round === $roundPrefix) { if (isset($boards[$board])) { foreach($boards[$board] as $table => $deal) { @@ -30,6 +33,7 @@ try { } } } + // here's the fallback readfile($html_filename); } catch (Exception $e) { header('HTTP/1.0 404 Not Found'); |