summaryrefslogtreecommitdiff
path: root/web.php
diff options
context:
space:
mode:
Diffstat (limited to 'web.php')
-rw-r--r--web.php29
1 files changed, 29 insertions, 0 deletions
diff --git a/web.php b/web.php
index 48539b9..e34672d 100644
--- a/web.php
+++ b/web.php
@@ -476,6 +476,35 @@ if($c !== 0){
}
/*
+ Prepend Oracle output, if applicable
+*/
+include_once("oracles/encoder.php");
+include_once("oracles/calc.php");
+include_once("oracles/time.php");
+include_once("oracles/numerics.php");
+$oracles = [new calculator(), new encoder(), new time(), new numerics()];
+$fortune = "";
+foreach ($oracles as $oracle) {
+ if ($oracle->check_query($_GET["s"])) {
+ $resp = $oracle->generate_response($_GET["s"]);
+ if ($resp != "") {
+ $fortune .= "<div class=\"infobox\">";
+ foreach ($resp as $title => $r) {
+ if ($title) {
+ $fortune .= "<h3>".htmlspecialchars($title)."</h3><div class=\"code\">".htmlspecialchars($r)."</div>";
+ }
+ else {
+ $fortune .= "<i>".$r."</i><br>";
+ }
+ }
+ $fortune .= "<small>Answer provided by oracle: ".$oracle->info["name"]."</small></div>";
+ }
+ break;
+ }
+}
+$payload["left"] = $fortune . $payload["left"];
+
+/*
Load next page
*/
if($results["npt"] !== null){