forked from fosm/Freemap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
175 lines (140 loc) · 4.05 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
<?php
require_once('lib/functionsnew.php');
require_once('common/defines.php');
session_start();
$loggedIn = (isset($_SESSION['gatekeeper'])) ? "true": "false";
?>
<!DOCTYPE html>
<html>
<head>
<title>FREEMAP</title>
<link rel='stylesheet' type='text/css' href='fm/css/style.css' />
<script type='text/javascript'
src='javascript/leaflet-0.7/leaflet.js'></script>
<?php
// Performance on Chrome of new kothic is significantly less good than old
if(strpos($_SERVER["HTTP_USER_AGENT"], "Chrome") !== false ||
(isset($_GET["kv"]) && $_GET["kv"]=="11"))
{
?>
<!-- old kothic-->
<script type='text/javascript' src='../javascript/kothic/dist/kothic.js'>
</script>
<script type='text/javascript'
src='../javascript/kothic/dist/kothic-leaflet.js'></script>
<?php
}
else
{
?>
<!-- new kothic-->
<script type='text/javascript' src='javascript/kothic-js/dist/kothic.js'>
</script>
<script type='text/javascript'
src='javascript/kothic-js/dist/kothic-leaflet.js'></script>
<?php
}
?>
<link rel='stylesheet' type='text/css'
href='javascript/leaflet-0.7/leaflet.css' />
<script type='text/javascript'
src='javascript/Leaflet.draw/dist/leaflet.draw.js'></script>
<link rel='stylesheet' type='text/css'
href='javascript/Leaflet.draw/dist/leaflet.draw.css' />
<!--
<script type='text/javascript'
src='http://leaflet.github.io/Leaflet.draw/leaflet.draw.js'></script>
<link rel='stylesheet' type='text/css'
href='http://leaflet.github.io/Leaflet.draw/leaflet.draw.css' />
-->
<script type='text/javascript' src='fm/style.js'></script>
<script type='text/javascript' src='fm/js/lib/Dialog.js'></script>
<script type='text/javascript' src='fm/js/lib/SearchWidget.js'></script>
<script type='text/javascript'>
var loggedIn=<?php echo $loggedIn;?>;
</script>
<script type='text/javascript' src='fm/js/main.js'></script>
<script type='text/javascript' src='fm/js/FeatureLoader.js'> </script>
<script type='text/javascript' src='fm/js/WRViewMgr.js'> </script>
<link rel='alternate' type='application/rss+xml'
title='The Freemap blog, revisited' href='/wordpress/' />
</head>
<?php
if(file_exists(POPULATE_LOCK))
{
?>
<body>
<p>The Freemap database is updated at 2am UK time every Wednesday and
Freemap is unavailable while the update takes place. The update is
taking place right now.
It typically takes no more than 1hr30 so should be over by 4am....
so please return later!</p>
</body>
<?php
}
else
{
?>
<body onload='init(<?php echo $loggedIn;?>)'>
<?php write_sidebar(true); ?>
<div id='main'>
<div id="map"></div>
</div>
</body>
<?php
}
?>
</html>
<?php
function write_sidebar($homepage=false)
{
?>
<div id='sidebar'>
<!-- filled in by js using matchMedia() -->
<div id='title'> </div>
<p id='intro'>Welcome to <em>Freemap 0.7 (preview)</em>,
with kothic-js client-side rendering.
<a href='fm/about.html'>More...</a> </p>
<div id='appmsg'>
<a href='/common/opentrail.html'>Android app</a>
now available!</div>
<?php
write_login();
?>
<div id='searchdiv'></div>
</div>
<?php
}
function write_login()
{
echo "<div id='logindiv'>";
if(!isset($_SESSION['gatekeeper']))
{
?>
<p>
<label for="username">Username</label> <br/>
<input name="username" id="username" /> <br/>
<label for="password">Password</label> <br/>
<input name="password" id="password" type="password" /> <br/>
<input type='button' value='go' id='loginbtn'/>
</p>
<p>
<a href='fm/user.php?action=signup'>Sign up</a>
</p>
<!--
<p><em>Please note that logging in will place a cookie on your
machine to identify you to the server. Please only proceed if
you are happy with this.</em></p>
-->
<?php
}
else
{
echo "<em>Logged in as $_SESSION[gatekeeper]</em>\n";
echo "<a href='#' id='myroutes'>My routes</a> | ".
"<a href='/fm/user.php?action=logout&redirect=".
htmlentities($_SERVER['PHP_SELF'])."'>Log out</a> ";
}
echo "</div>";
}
?>