blob: 5bdbb00c938d9aadccd013c4e64770070d43a62f [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 {
5 public static function do($json) {
6 print_r(json_encode($json));
7 exit();
8 }
9
10 public static function error($n, $msg) {
11 self::do(["error" => $n, "msg" => $msg]);
12 }
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?>