From d1a50c119db7356671af310cf04a046e2be2fc90 Mon Sep 17 00:00:00 2001 From: emkael Date: Thu, 15 Nov 2018 01:30:14 +0100 Subject: Documentation updated --- tdd/tdd-protocol.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'tdd/tdd-protocol.php') 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'); -- cgit v1.2.3