blob: 176fdfebb1e2495a1a48c17da282c44f78f3affa [file] [log] [blame]
avm99963f0d15212017-10-08 17:03:22 +02001<?php
avm99963658fae52017-10-08 23:09:16 +02002require_once("config.php");
3
avm99963f0d15212017-10-08 17:03:22 +02004class write {
avm99963a00c43e2018-09-26 20:16:07 +02005 public static function output($json) {
avm99963f0d15212017-10-08 17:03:22 +02006 print_r(json_encode($json));
7 exit();
8 }
9
10 public static function error($n, $msg) {
avm99963a00c43e2018-09-26 20:16:07 +020011 self::output(["error" => $n, "msg" => $msg]);
avm99963f0d15212017-10-08 17:03:22 +020012 }
13}
14
avm99963cbcae352018-09-26 16:16:37 +020015function get_graph() {
16 global $conf;
17 return json_decode(file_get_contents($conf["apiurl"]), true);
18}
19
avm99963f0d15212017-10-08 17:03:22 +020020if (!isset($_GET["action"])) {
21 write::error(1, "No action provided");
22}
23
24switch ($_GET["action"]) {
25 case "getgraf":
avm99963cbcae352018-09-26 16:16:37 +020026 $graf = file_get_contents($conf["apiurl"]);
avm99963f0d15212017-10-08 17:03:22 +020027 echo $graf;
28 break;
29
30 default:
31 write::error(2, "Unknown action");
32}
33?>