-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathutils.php
68 lines (47 loc) · 1.22 KB
/
utils.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<?php
function api($op, $params = array()){
$url = api_link($op, $params);
return api_get($url);
}
function api_link($op, $params = array()){
//Configure this!
$API_ENDPOINT = "http://localhost:8080/";
$url = $API_ENDPOINT . "?op=".urlencode($op);
foreach ($params as $key => $value) {
//so that we can just pass $_REQUEST
if(strcmp($key, "op") != 0){
$url = $url."&".urlencode($key)."=".urlencode($value);
}
}
return $url;
}
function api_get($url){
$data = file_get_contents($url);
if($data === FALSE){
die("(Could not contact webcontrol API (<a href='".$url."'>request</a>)");
}
return json_decode($data);
}
function makeHeader(){
?>
<html>
<head>
<title>Symphony - ClusterGL WebControl</title>
<link type="text/css" rel="stylesheet" href="css/main.css" />
</head>
<body>
<div id="header">
<b>ClusterGL Status:</b>
<?php
$request = api("status");
echo $request->status;
?>
( <a href="invoke.php?op=stop">stop</a> )
<div id="rightheader">
<a href="http://code.google.com/p/clustergl2">ClusterGL</a> and WebControl made by <a href="emailto:[email protected]">Paul Hunkin</a><br>
However, all questions should be directed to <a href="emailto:[email protected]">Donald Neal</a>
</div>
</div>
<?php
}
?>