Repository navigation
Expand file tree
/
Copy pathadmin.php
More file actions
273 lines (239 loc) · 11.9 KB
/
Copy pathadmin.php
File metadata and controls
273 lines (239 loc) · 11.9 KB
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
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
<?php
/*
Bandmaster
admin.php
authors: David Lordan, Paul Karcher, Dean Marsinelli
last updated: 5/1/2015
Page that loads for an admin that is logged in.
*/
header("Expires: Tue, 01 Jan 2000 00:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
require 'login_assets/auth.php';
require 'assets/php/chromePHP.php';
ChromePhp::log('Chrome PHP is working.');
if (isset($_POST["username"]) == false) {
header("Location: index.html");
die();
};
$name = $_POST["username"];
date_default_timezone_set('America/New_York');
$log = fopen("user_log.txt", "a");
fwrite($log, "\n\n" . date("m/d/Y @ g:i:sA") . " - User " . $name . " attemping to log in\n");
fwrite($log, date("m/d/Y @ g:i:sA") . " - User " . $name . " logged in successfully");
fclose($log);
// open up the settings json file for this user
$file = file_get_contents('./users/' . $name . '/JSON/settings.json', true);
$settings = json_decode($file, true);
unset($file);
/*
Successful login will show the admin page for the user
*/
$html = <<<HTML
<!DOCTYPE html>
<html ng-app="bandmaster">
<head>
<title>Bandmaster Hub</title>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Expires" content="-1">
<meta http-equiv="CACHE-CONTROL" content="NO-CACHE">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!--
Bandmaster
admin.php
authors: David Lordan, Paul Karcher, Dean Marsinelli
last updated: 5/1/2015
This page serves as the admin page for bands where users
can upload content, add tasks, and add calendar events for
their band.
-->
<link rel="icon" type="image/png" sizes="32x32" href="assets/img/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="96x96" href="assets/img/favicon-96x96.png">
<link rel="icon" type="image/png" sizes="16x16" href="assets/img/favicon-16x16.png">
<script>
var username = "users/$name";
console.log(username);
</script>
<!-- Links to include bootstrap and jQuery -->
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.1/js/bootstrap.min.js"></script>
<!-- Link to load the AngularJS framework.-->
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.27/angular.min.js"></script>
<!-- jQuery File Upload Dependencies -->
<script src="assets/js/jquery.ui.widget.js"></script>
<script src="assets/js/jquery.fileupload.js"></script>
<script src="assets/js/jquery.knob.js"></script>
<!-- External Javascript file containing custom functions and the AngularJS
model and controller that allow the page to function -->
<script src="assets/js/Bandmaster.js"></script>
<script src="assets/js/uploadScript.js"></script>
<script src="assets/js/dialog.js"></script>
<!-- START JQuery fullcalendar dependencies-->
<!-- jqueryui library and styling -->
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.3/themes/smoothness/jquery-ui.css" />
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.3/jquery-ui.min.js"></script>
<!-- jquery.form.js -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.form/3.51/jquery.form.min.js" type="text/javascript"></script>
<!-- required libraries for fullcalendar -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.10.2/moment.min.js" type="text/javascript"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/fullcalendar/2.3.1/fullcalendar.min.js" type="text/javascript"></script>
<!-- calendar styling -->
<link href="https://cdnjs.cloudflare.com/ajax/libs/fullcalendar/2.3.1/fullcalendar.css" rel="stylesheet" type="text/css"/>
<link href="https://cdnjs.cloudflare.com/ajax/libs/fullcalendar/2.3.1/fullcalendar.print.css" rel='stylesheet' type="text/css" media='print' />
<link href="assets/css/calendarWidgetHub.css" rel="stylesheet" type="text/css"/>
<!-- timepicker assets !-->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-timepicker/1.6.10/jquery.timepicker.min.js" type="text/javascript"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/jquery-timepicker/1.6.10/jquery.timepicker.css" rel="stylesheet" type="text/css"/>
<!-- datepicker bootstrap assets -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.4.0/js/bootstrap-datepicker.js" type="text/javascript"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.4.0/css/bootstrap-datepicker.standalone.css" rel="stylesheet" type="text/css"/>
<!-- datepair library requirements -->
<script src="assets/js/Datepair.js" type="text/javascript"></script>
<script src="assets/js/jquery.datepair.js" type="text/javascript"></script>
<!-- jquery-validate library -->
<script src="http://ajax.aspnetcdn.com/ajax/jquery.validate/1.9/jquery.validate.min.js"></script>
<!-- verification of input for adding an event -->
<script src="assets/js/eventValidation.js" type="text/javascript"></script>
<link href="assets/css/validation.css" rel="stylesheet" type="text/css"/>
<!-- calendar rendering -->
<script src="assets/js/generateCalendar.js" type="text/javascript"></script>
<!-- END JQuery fullcalendar dependencies -->
<!-- CSS styling links -->
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css">
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap-theme.min.css">
<link href="assets/css/style.css" rel="stylesheet">
<script>
$(document).ready(function() {
// random number between 0 and 3
var num = Math.floor((Math.random() * 4));
$('body').css('background', '#000 url(backgrounds/' + num + '.jpg) no-repeat');
$('body').css('background-size', '100%');
});
</script>
</head>
<!-- Directive which says this page will use the bandmasterCtrl ng-controller -->
<body id="mainbody" ng-controller="bandmasterCtrl" ng-init='load("admin", "$name")'>
<div id="top">
<p id="beta">Bandmaster - $name - Administrator Dashboard Beta - <a href="users/$name" target="_blank">Click here to go to your public page</a><span id="logout"><a href="index.html">Logout</a></span></p>
</div>
<!-- Bootstrap wrapper for the entire body.-->
<div class="container-fluid">
<!-- band name will be based off of json data -->
<div id="header">
<h1 id="bandname">{{bandname}}</h1>
<form id="changeNameBox" class="hidden">
<input id="nameInput" type="text" name="nameInput" value="{{bandname}}"><br>
<button ng-click="changeName()">Save</button>
<button onclick="closeChangeName()">Cancel</button>
</form>
</div>
<!-- panes are ordered "incorrect" in the html to make it work with bootstrap -->
<!-- MIDDLE pane containing the audio player -->
<div class="col-md-4 col-md-push-4 hubPane">
<audio id="my-audio" ng-src="{{audioActive|audioFilter}}"></audio>
<div id="controls">
<!-- custom play and pause buttons -->
<input type="image" ng-src="{{playbackIcon}}" alt="UP" ng-click="togglePlayback()">
<p id="nowPlaying"> {{nowPlaying}} </p>
<div id="time">
<span id="timeSpent">{{timeSpent| number:0|timeFilter}}</span>
<span id="timeRemaining">-{{timeRemaining| number:0 |timeFilter}}</span>
</div> <!-- end time div -->
<div id="progress">
<span id="circle2"></span>
<span id="bar"></span>
<span id="circle1"></span>
</div><!-- end progress bar-->
</div><!-- end controls div-->
<div id="infoPanel">
<!-- dynamic content goes here -->
</div><!-- end infoPanel div -->
</div> <!-- end of middle pane -->
<!-- LEFT pane containing the song list -->
<div class="col-md-4 col-md-pull-4" id="setlist">
<form id="upload" method="post" action="users/$name/upload.php" enctype="multipart/form-data">
<input name="songname" id="invisibleName">
<input name="fileType" id="invisibleFileType">
<!-- File Upload section -->
<div id="uploadDiv">
<p id="uploadType">
Upload a File
</p>
<!-- drop zone div -->
<div id="drop">
<p id="uploadTitle">Drag and Drop a File or Press Browse</p>
<div id="green_circle"></div>
<div id="uploadLeft">
<a>Browse</a>
</div>
<div id="uploadRight">
<div id="mainProgBar" class="progress hidden">
<div class="progress-bar progress-bar-success progress-bar-striped active" role="progressbar" aria-valuemin="0" aria-valuemax="100" style="width:{{uploadProg}}%"></div>
</div> <!-- end of mainProgBar div -->
</div>
<input type="file" name="upl" multiple>
</div> <!-- end of drop div -->
</div> <!-- end of file upload -->
</form>
<!-- jQuery tabs content -->
<div id="my-tab-content" class="tab-content">
<!-- songs -->
<div class="tab-pane active" id="songs">
<!-- table for song list -->
<table class="leftTable">
<tr>
<th class="numHeader">#</th>
<th>Songs</th>
<th></th>
</tr>
<tr ng-class="{activeSongClass: i.name === audioActive}" ng-repeat="i in myList" >
<td>{{\$index + 1}}</td>
<td>
<button id="songname" ng-click="updateActive(i)">{{i.name}}</button>
</td>
<td>
<button type="button" data-toggle="modal" data-target="#delModal" ng-click="delModal(i, \$index)">X</button>
</td>
</tr>
</table> <!-- end of song table -->
</div> <!-- end of songs tab -->
</div> <!-- end of jQuery tab content -->
</div> <!-- end of left pane -->
<!-- RIGHT pane containing task list and calendar-->
<div class="col-md-4 hubPane">
<div id="calendar"></div>
<button type="button" class="eventButton" data-toggle="modal" data-target="#eventModal" ng-click="eventModal()">Add Event</button>
<div id="eventDialog" title="" style="display:none;"></div>
<!-- end of calendar -->
<div id="toDoList">
<!-- table for task list -->
<table id="taskTable">
<tr>
<th><h2>To Do List</h2></th>
</tr>
<tr ng-class="{activeTaskClass: i.task === activeTask}" ng-repeat="i in taskList" >
<td> <button ng-click="updateActiveTask(\$index, i)">{{i.task}}</button></td>
</tr>
</table> <!-- end of task list table -->
<!-- add/remove task section -->
<div id="newTaskButton">
<button onclick="showNewTaskBox()">Add New Task</button>
<button ng-click="removeActiveTask()">Remove Selected Task</button>
</div> <!-- end of add/remove task div -->
<div id="newTaskBox" class="hidden">
New Task: <input id="taskInput" type="text" name="NewTask" value=""><br>
<button ng-click="addTask()">Add Task</button>
<button onclick="closeNewTaskBox()">Close</button>
</div>
</div> <!-- end of toDoList div -->
</div> <!-- end of right pane -->
</div> <!-- end of bootstrap container -->
</body>
</html>
HTML;
echo $html;
?>