forked from ormestad/publications
-
Notifications
You must be signed in to change notification settings - Fork 4
/
_selftest.php
38 lines (27 loc) · 865 Bytes
/
_selftest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php
require 'lib/global.php';
require 'lib/config.php';
ini_set('default_socket_timeout', 120);
if($USER->auth>1) {
if (isset($_GET['test'])) {
$test = $_GET['test'];
$test_url = $CONFIG['publications']['parse_url'].'/selftest/'.$test;
$response_json = file_get_contents($test_url);
$response = json_decode($response_json);
echo('errors: '.$response->errors.'<br>');
echo('failures: '.$response->failures.'<br>');
echo('<pre>'.$response->output.'</pre>');
} else {
$test_url = $CONFIG['publications']['parse_url'].'/selftest';
$response_json = file_get_contents($test_url);
$response = json_decode($response_json);
$out = [];
foreach ($response->subresource_uris as $name => $value) {
if ($value != "all") {
array_push($out, $value);
}
}
echo(json_encode($out));
}
}
?>