This repository has been archived by the owner on Dec 17, 2023. It is now read-only.
forked from 2000jedi/SAM
-
Notifications
You must be signed in to change notification settings - Fork 0
/
admin.php
executable file
·216 lines (208 loc) · 9.65 KB
/
admin.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
<?php
/**
* Created by IntelliJ IDEA.
* User: Sam
* Date: 9/21/15
* Time: 18:51
*/
require $_SERVER['DOCUMENT_ROOT']."/modules/user/checkValid.php";
$result = checkForceQuit();
$admin = $result->username;
if ($admin != "t001"){
die("Permission Denied!");
}else {
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title><?= $appName ?> - Admin</title>
<meta content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0' name='viewport'/>
<link rel="shortcut icon" href="/favicon.ico"/>
<script src="/framework/js/jq.js"></script>
<script src="/framework/js/form.js"></script>
<script src="/framework/js/material.js"></script>
<style>
<?php
require $_SERVER['DOCUMENT_ROOT']."/framework/material/material.min.css";
require $_SERVER['DOCUMENT_ROOT']."/framework/material/material-dashboard-styles.css";
require $_SERVER['DOCUMENT_ROOT']."/framework/geodesic/base.css";
require $_SERVER['DOCUMENT_ROOT']."/framework/geodesic/settings.css";
?>
</style>
</head>
<body>
<script>
function toggleModules(id) {
$('#right-part').hide();
$('#mStatistics').hide();
$('#left-tab-Statistics').css("background","").css("color","#eceff1");
$('#mCreateUsers').hide();
$('#left-tab-CreateUsers').css("background","").css("color","#eceff1");
$('#mClasses').hide();
$('#left-tab-Classes').css("background","").css("color","#eceff1");
$('#mPresentations').hide();
$('#left-tab-Presentations').css("background","").css("color","#eceff1");
$('#m' + id).css("display", "");
$('#left-tab-' + id).css("background","#00BCD4").css("color","#37474F");
$('#title').html(id);
$('.demo-drawer').removeClass("is-visible")
}
</script>
<div class="demo-layout mdl-layout mdl-js-layout mdl-layout--fixed-drawer mdl-layout--fixed-header">
<header class="demo-header mdl-layout__header mdl-color--white mdl-color--grey-100 mdl-color-text--grey-600">
<div class="mdl-layout__header-row">
<span id="title" class="mdl-layout-title">Home</span>
</div>
</header>
<div class="demo-drawer mdl-layout__drawer mdl-color--blue-grey-900 mdl-color-text--blue-grey-50">
<header class="demo-drawer-header">
<img src="/framework/material-images/user.png" class="demo-avatar">
<div class="demo-avatar-dropdown">
<span style="display: block; margin-top: 0.5em">t001</span>
</div>
</header>
<nav class="demo-navigation mdl-navigation mdl-color--blue-grey-800">
<a id="left-tab-Statistics" onclick="toggleModules('Statistics')" class="mdl-navigation__link" href="#"><i class="mdl-color-text--blue-grey-400 material-icons" role="presentation">school</i>Statistics</a>
<a id="left-tab-CreateUsers" onclick="toggleModules('CreateUsers')" class="mdl-navigation__link" href="#"><i class="mdl-color-text--blue-grey-400 material-icons" role="presentation">settings</i>Create Users</a>
<a id="left-tab-Classes" onclick="toggleModules('Classes')" class="mdl-navigation__link" href="#"><i class="mdl-color-text--blue-grey-400 material-icons" role="presentation">settings</i>Classes</a>
<a id="left-tab-Presentations" onclick="toggleModules('Presentations')" class="mdl-navigation__link" href="#"><i class="mdl-color-text--blue-grey-400 material-icons" role="presentation">message</i>Presentations</a>
</nav>
</div>
<main class="mdl-layout__content mdl-color--grey-100">
<div id="loading" class="mdl-progress mdl-js-progress mdl-progress__indeterminate" style="width: auto;"></div>
<div id="mStatistics">
<div class="card">
<a href="/modules/user/listUserInfo.php" target="_blank">List User Info</a>
</div>
<div class="card">
<a href="/modules/user/listUserWithDefaultPassword.php" target="_blank">List User With Default Password</a>
</div>
<div class="card">
<a href="/modules/user/studentInClass.php" target="_blank">Student In Class</a>
</div>
<div class="card">
<a href="/modules/statistics/loadActiveUsers.php" target="_blank">Active Users</a>
</div>
<div class="card">
<a href="/modules/statistics/loadIPAddresses.php" target="_blank">IP Address List</a>
</div>
<div class="card">
<a href="/recruit/listSignedUpMembers.php" target="_blank">List Signed Up Members</a>
</div>
</div>
<div id="mCreateUsers">
<div class="card">
<div style="text-align: center">Create A User</div>
<form action='/modules/user/create.php' method="post" style="margin: 0.5em">
<div>
<label>username</label>
<input name="username" />
</div>
<div>
<label>type</label>
<input name="type" />
</div>
<div>
<label>subject</label>
<input name="subject" />
</div>
<div style="text-align: center; margin: 1em">
<input type="submit" class="mdl-button mdl-js-button mdl-button--raised mdl-button--colored" style="background: #3f51b5" />
</div>
</form>
</div>
<!--
<div class="card">
<div style="text-align: center">Mass-produce Users</div>
<form action='/modules/user/massiveCreateUser.php' method="post" style="margin: 0.5em">
<div>
<label>classprefix</label>
<input name="classprefix" />
</div>
<div style="text-align: center; margin: 1em">
<input type="submit" class="mdl-button mdl-js-button mdl-button--raised mdl-button--colored" style="background: #3f51b5" />
</div>
</form>
</div>
<div class="card">
<div style="text-align: center">Destroy A User</div>
<form action='/modules/user/destroy.php' method="post" style="margin: 0.5em">
<div>
<label>username</label>
<input name="username" />
</div>
<div>
<label>type</label>
<input name="type" />
</div>
<div style="text-align: center; margin: 1em">
<input type="submit" class="mdl-button mdl-js-button mdl-button--raised mdl-button--colored" style="background: #3f51b5" />
</div>
</form>
</div>
<div class="card">
<div style="text-align: center">Users Massacre</div>
<form action='/modules/user/massiveDestroyUser.php' method="post" style="margin: 0.5em">
<div>
<label>classprefix</label>
<input name="classprefix" />
</div>
<div style="text-align: center; margin: 1em">
<input type="submit" class="mdl-button mdl-js-button mdl-button--raised mdl-button--colored" style="background: #3f51b5" />
</div>
</form>
</div>
-->
</div>
<div id="mClasses" class="mdl-grid demo-content"></div>
<div id="mPresentations">
<div class="card">
<div style="text-align: center">Add Presentation</div>
<form action='/modules/presentation/addPresentation.php' method="post" enctype="multipart/form-data" style="margin: 0.5em">
<div>
<label>Name</label>
<input name="name" />
</div>
<div>
<label>Attachment</label>
<input name="attachment[]" type="file" multiple />
</div>
<div style="text-align: center; margin: 1em">
<input type="submit" class="mdl-button mdl-js-button mdl-button--raised mdl-button--colored" style="background: #3f51b5" />
</div>
</form>
</div>
<div id="presentationList" class="mdl-grid demo-content"></div>
</div>
</main>
</div>
</body>
<script>
<?php
require $_SERVER['DOCUMENT_ROOT']."/template/scripts/base.js";
require $_SERVER['DOCUMENT_ROOT']."/template/scripts/class.js";
require $_SERVER['DOCUMENT_ROOT']."/template/scripts/settings.js";
require $_SERVER['DOCUMENT_ROOT']."/template/scripts/presentation.js";
?>
toggleModules("Statistics");
function loadClass(func){
$.get("/modules/class/loadClass.php?inAdmin=true",function(data){
func();
data = JSON.parse(data);
for ( var i = 0; i < data.length; i++){
var id = data[i].id;
var teacher = data[i].teacher;
var name = data[i].name;
var subject = convertSubject(data[i].subject);
var oneClass = new ClassAdmin(id, teacher, name, subject);
$('#mClasses').append(oneClass.getHTML());
}
})
}
loadClass(function(){});
new ManipulatePresentation().loadPresentations(2);
</script>
<?php
}
?>