-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.php
209 lines (180 loc) · 9.45 KB
/
index.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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<meta name="description" content="">
<meta name="author" content="Samuel Navas Medrano">
<meta name="author" content="Nicholas Schiestel">
<link rel="icon" href="favicon.ico">
<title>GEO-C</title>
<link rel="stylesheet" href="lib/bootstrap/dist/css/bootstrap.min.css">
<!-- Custom styles for this template -->
<link href="css/jumbotron-narrow.css" rel="stylesheet">
<!-- Font Awesome -->
<link rel="stylesheet" href="lib/font-awesome/css/font-awesome.min.css">
<!-- JQuery -->
<script src="lib/jquery/dist/jquery.min.js"></script>
<!-- Just for debugging purposes. Don't actually copy these 2 lines! -->
<!--[if lt IE 9]><script src="assets/js/ie8-responsive-file-warning.js"></script><![endif]-->
<!-- <script src="assets/js/ie-emulation-modes-warning.js"></script> -->
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<div class="container">
<div class="header clearfix">
<nav>
<!--
<ul class="nav nav-pills pull-right">
<li role="presentation" class="active"><a href="#">Servers</a></li>
<li role="presentation"><a href="http://giv-oct.uni-muenster.de:5000">Dataset</a></li>
</ul> -->
<ul class="nav nav-pills pull-right" id="pills">
<li class="active"><a role="tab" data-toggle="tab" href="#servers">Servers</a></li>
<li id="resources-tab"><a role="tab" data-toggle="tab" href="#resources">Resources</a></li>
<li id="ckan-link"><a href="http://giv-oct.uni-muenster.de:5000" target="_blank">CKAN</a></li>
<li><a href="/dev-corner" target="_blank">Dev-Corner</a></li>
<li><a role="tab" style="cursor:no-drop;">Help</a></li>
</ul>
</nav>
<h3 class="text-muted">The Open City Toolkit</h3>
</div>
<?php
include 'php/get_url.php';
$online = '<span class="label label-success">ONLINE</span>';
$offline = '<span class="label label-danger">OFFLINE</span>';
$run = '<span style="color:green">RUNNING</span>';
$notrun = '<span style="color:red">NOT RUNNING</span>';
// We dont need to check GIV-OCT, if this code is running the server is online
$statusOCT = $online;
exec ( "ps -e | grep -e apache2 -e postgres -e paster | awk '{print $4}' | sort | uniq 2>&1", $servicesOCT);
array_unshift($servicesOCT,"avoid first element with index = 0");
if(@fsockopen ('giv-lodumdata.uni-muenster.de', 80, $errno, $errstr, 10)){
$statusLOD = $online;
$request_url = 'http://giv-lodum.uni-muenster.de/servicesPOST.php';
$servicesLOD = array("apache2","postgres");
$servicesLOD = json_decode(curl_post($request_url,$servicesLOD));
array_unshift($servicesLOD,"avoid first element with index = 0");
} else {
$statusLOD = $offline;
$servicesLOD = [];
}
if(@fsockopen ('giv-lodumdata.uni-muenster.de', 80, $errno, $errstr, 10)){
$statusDAT = $online;
$request_url = 'http://giv-lodumdata.uni-muenster.de/servicesPOST.php';
$servicesDAT = array("apache2","postgres");
$servicesDAT = json_decode(curl_post($request_url,$servicesDAT));
array_unshift($servicesDAT,"avoid first element with index = 0");
} else {
$statusDAT = $offline;
$servicesDAT = [];
}
?>
<div class="tab-content">
<!-- SERVERS TAB -->
<div id="servers" class="tab-pane fade in active">
<div class="row marketing">
<div class="col-xs-4">
<h4>GIV-OCT</h4>
<p><i>giv-oct.uni-muenster.de</i></p>
<p><?=$statusOCT?></p> <a href="uptime2.log">Uptime log</a>
<h4>Services:</h4>
<ul style="list-style-type:square">
<?php $apacheOCT = (!array_search('apache2', $servicesOCT) ? $notrun : $run) ?>
<li>Apache2: <?=$apacheOCT?></li>
<?php $postOCT = (!array_search('postgres', $servicesOCT) ? $notrun : $run) ?>
<li>Postgres: <?=$postOCT?></li>
<?php $ckanOCT = (!array_search('paster', $servicesOCT) ? $notrun : $run) ?>
<li>CKAN: <?=$ckanOCT?></li>
</ul><br>
</div>
<div class="col-xs-4">
<h4>GIV-LODUM</h4>
<p><i>giv-lodum.uni-muenster.de</i></p>
<p><?=$statusLOD?></p>
<a href="http://giv-lodum.uni-muenster.de/uptime2.log">Uptime log</a>
<h4>Services:</h4>
<ul style="list-style-type:square">
<?php $apacheLOD = (!array_search('apache2', $servicesLOD) ? $notrun : $run) ?>
<li>Apache2: <?=$apacheLOD?></li>
<?php $postLOD = (!array_search('postgres', $servicesLOD) ? $notrun : $run) ?>
<li>Postgres: <?=$postLOD?></li>
</ul><br>
</div>
<div class="col-xs-4">
<h4>GIV-LODUMDATA</h4>
<p><i>giv-lodumdata.uni-muenster.de</i></p>
<p><?=$statusDAT?></p>
<a href="http://giv-lodumdata.uni-muenster.de/uptime2.log">Uptime log</a>
<h4>Services:</h4>
<ul style="list-style-type:square">
<?php $apacheDAT = (!array_search('apache2', $servicesDAT) ? $notrun : $run) ?>
<li>Apache2: <?=$apacheDAT?></li>
<?php $postDAT = (!array_search('postgres', $servicesDAT) ? $notrun : $run) ?>
<li>Postgres: <?=$postDAT?></li>
</ul><br>
</div>
</div>
</div>
<!-- RESOURCES TAB -->
<div id="resources" class="tab-pane fade marketing">
<div class="row marketing" id="results"></div>
<div class="row marketing">
<div id="buttons" class="btn-group" data-toggle="buttons"></div>
<div id="urls"></div>
</div>
</div>
<!-- HELP TAB-->
<div id="help" class="tab-pane fade marketing"></div>
</div>
<footer class="footer container">
<center>
<a href="http://geo-c.eu/"><img src="http://giv-oct.uni-muenster.de/oct/images/logo-geoc.png" width="145px" height="auto" style="float:left;"></a>
<div align="right">
<a href="https://github.com/geo-c/Open-City-Toolkit"><i class="fa fa-github-square fa-2x"></i></a>
<a href="https://twitter.com/geoc_eu"><i class="fa fa-twitter-square fa-2x"></i></a>
<a href="https://www.facebook.com/geo.c.opencities"><i class="fa fa-facebook-square fa-2x"></i></a>
<span style="position: relative; right: 0; top: 0;">
<a href="http://giv-oct.uni-muenster.de:5000/">
<i class="fa fa-square fa-2x" style="position: relative; top: 0; left: 0;"></i>
</a>
<a href="http://giv-oct.uni-muenster.de:5000/">
<img src="images/ckan-logo-footer-white.png" width="18px" height="auto" style="position: absolute; top: -6px; left: 3px; pointer-events:none;">
</a>
</span>
</div>
</center>
</footer>
</div>
<!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
<!-- <script src="assets/js/ie10-viewport-bug-workaround.js"></script> -->
<!-- Bootstrap -->
<script src="lib/bootstrap/dist/js/bootstrap.min.js"></script>
<!-- Custom JS -->
<script src="js/Parser.js"></script>
<script src="js/Querier.js"></script>
<script>
initParser();
query("http://giv-oct.uni-muenster.de:5000", "results");
</script>
<script>
if( '<?php echo $ckanOCT; ?>' == '<span style="color:red">NOT RUNNING</span>'){
document.getElementById('resources-tab').innerHTML = '<a role="tab" style="cursor:no-drop;">Resources</a>';
document.getElementById('ckan-link').innerHTML = '<a style="cursor:no-drop;" disabled>CKAN</a>';
}
$(function() {
var hash = window.location.hash;
// do some validation on the hash here
//if(hash=="severs" || hash=="resources"){
$('#pills a[href="'+hash+'"]').tab('show');
//}
});
</script>
</body>
</html>