-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.php
executable file
·234 lines (206 loc) · 8.18 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
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
<?php
/**
* Raspberry Pi Bike Camera
*
* For a quick run through, the packages required for the WebGUI are:
* lighttpd (I have version 1.4.31-2 installed via apt)
* php5-cgi (I have version 5.4.4-12 installed via apt)
* along with their supporting packages, php5 will also need to be enabled.
*
* @author Nathan Kotzur
* @license GNU General Public License, version 3 (GPL-3.0)
* @version 1.0
* @link https://github.com/njkeng/BikeCamera
* @see https://instructables.com
*/
include_once( 'includes/config.php' );
include_once( RASPI_CONFIG.'/bikecamera.php' );
include_once( 'includes/functions.php' );
include_once( 'includes/authenticate.php' );
include_once( 'includes/admin.php' );
include_once( 'includes/hostapd.php' );
include_once( 'includes/dhcp.php' );
include_once( 'includes/system.php' );
include_once( 'includes/configure_client.php' );
include_once( 'includes/video_settings.php' );
include_once( 'includes/time.php' );
include_once( 'includes/video_files.php' );
if(isset($_GET['page'])) {
$page = $_GET['page'];
} else {
$page = "";
}
session_start();
if (empty($_SESSION['csrf_token'])) {
if (function_exists('mcrypt_create_iv')) {
$_SESSION['csrf_token'] = bin2hex(mcrypt_create_iv(32, MCRYPT_DEV_URANDOM));
} else {
$_SESSION['csrf_token'] = bin2hex(openssl_random_pseudo_bytes(32));
}
}
$csrf_token = $_SESSION['csrf_token'];
?>
<!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">
<meta name="description" content="">
<meta name="author" content="">
<title>
<?php echo RASPI_PAGETITLE_NAME; ?>
</title>
<!-- Bootstrap Core CSS -->
<link href="vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet">
<!-- MetisMenu CSS -->
<link href="vendor/metisMenu/metisMenu.min.css" rel="stylesheet">
<!-- Timeline CSS -->
<link href="dist/css/timeline.css" rel="stylesheet">
<!-- Custom CSS -->
<link href="dist/css/sb-admin-2.min.css" rel="stylesheet">
<!-- Morris Charts CSS -->
<link href="vendor/morrisjs/morris.css" rel="stylesheet">
<!-- Custom Fonts -->
<link href="vendor/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">
<!-- Custom CSS -->
<link href="dist/css/custom.css" title="main" rel="stylesheet">
<link rel="shortcut icon" type="image/png" href="../img/favicon.png">
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<div id="wrapper">
<!-- Navigation -->
<nav class="navbar navbar-default navbar-static-top" role="navigation" style="margin-bottom: 0">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="index.php"><?php echo RASPI_NAVBAR_NAME; ?></a>
</div>
<!-- /.navbar-header -->
<!-- Navigation -->
<div class="navbar-default sidebar" role="navigation">
<div class="sidebar-nav navbar-collapse">
<ul class="nav" id="side-menu">
<?php if ( RASPI_VIDEOSETTINGS_ENABLED ) : ?>
<li>
<a href="index.php?page=videosettings_conf"><i class="fa fa-video-camera fa-fw"></i> Video settings</a>
</li>
<?php endif; ?>
<?php if ( RASPI_VIDEOFILES_ENABLED ) : ?>
<li>
<a href="index.php?page=video_files_conf"><i class="fa fa-file-movie-o fa-fw"></i> Manage video files</a>
</li>
<?php endif; ?>
<?php if ( RASPI_CLIENT_ENABLED ) : ?>
<li>
<a href="index.php?page=wpa_conf"><i class="fa fa-signal fa-fw"></i> WiFi networks</a>
</li>
<?php endif; ?>
<?php if ( RASPI_HOTSPOT_ENABLED ) : ?>
<li>
<a href="index.php?page=hostapd_conf"><i class="fa fa-dot-circle-o fa-fw"></i> WiFi Hotspot</a>
</li>
<?php endif; ?>
<?php if ( RASPI_DHCP_ENABLED ) : ?>
<li>
<a href="index.php?page=dhcpd_conf"><i class="fa fa-exchange fa-fw"></i> Configure DHCP Server</a>
</li>
<?php endif; ?>
<?php if ( RASPI_TIME_ENABLED ) : ?>
<li>
<a href="index.php?page=time_conf"><i class="fa fa-clock-o fa-fw"></i> Time and date</a>
</li>
<?php endif; ?>
<?php if ( RASPI_CONFAUTH_ENABLED ) : ?>
<li>
<a href="index.php?page=auth_conf"><i class="fa fa-lock fa-fw"></i> BikeCamera login</a>
</li>
<?php endif; ?>
<?php if ( RASPI_SYSTEM_ENABLED ) : ?>
<li>
<a href="index.php?page=system_info"><i class="fa fa-cube fa-fw"></i> System</a>
</li>
<?php endif; ?>
<li>
<a target="_blank" rel="noopener noreferrer" href="https://github.com/njkeng/bikecamera/blob/master/README.md"><i class="fa fa-question-circle fa-fw"></i> Software README</a>
</li>
<li>
<a target="_blank" rel="noopener noreferrer" href="https://www.instructables.com/id/BikeCamera-Video-Camera"><i class="fa fa-info-circle fa-fw"></i> BikeCamera Instructable</a>
</li>
</ul>
</div><!-- /.navbar-collapse -->
</div><!-- /.navbar-default -->
</nav>
<div id="page-wrapper">
<!-- Page Heading -->
<div class="row">
<div class="col-lg-12">
<h1 class="page-header">
<img class="logo" src="img/BikeCamera_logo_simple.png" width="120" height="49"> BikeCamera
</h1>
</div>
</div><!-- /.row -->
<?php
// handle page actions
switch( $page ) {
case "videosettings_conf":
DisplayVideoSettings();
break;
case "video_files_conf":
DisplayVideoFiles();
break;
case "dhcpd_conf":
DisplayDHCPConfig();
break;
case "wpa_conf":
DisplayWPAConfig();
break;
case "hostapd_conf":
DisplayHostAPDConfig();
break;
case "time_conf":
DisplayTime();
break;
case "auth_conf":
DisplayAuthConfig($config['admin_user'], $config['admin_pass']);
break;
case "video_files":
DisplayVideoFiles();
break;
case "system_info":
DisplaySystem();
break;
default:
DisplayVideoSettings();
}
?>
</div><!-- /#page-wrapper -->
</div><!-- /#wrapper -->
<!-- BikeCamera JavaScript -->
<script src="dist/js/functions.js"></script>
<!-- jQuery -->
<script src="vendor/jquery/jquery.min.js"></script>
<!-- Bootstrap Core JavaScript -->
<script src="vendor/bootstrap/js/bootstrap.min.js"></script>
<!-- Metis Menu Plugin JavaScript -->
<script src="vendor/metisMenu/metisMenu.min.js"></script>
<!-- Morris Charts JavaScript -->
<!--script src="vendor/raphael/raphael-min.js"></script-->
<!--script src="vendor/morrisjs/morris.min.js"></script-->
<!--script src="js/morris-data.js"></script-->
<!-- Custom Theme JavaScript -->
<script src="dist/js/sb-admin-2.js"></script>
<!-- Custom BikeCamera JS -->
<script src="js/custom.js"></script>
</body>
</html>