-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
321 lines (247 loc) · 12.2 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
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
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
<?php
// Working directory of first executing file
$lcwd = dirname(__FILE__);
require_once $lcwd."/assets/page_rsc/load.php";
// check if we are logged in or not
if(testConn() != "Success") {
header("Location: auth.php");
} else {
// see if we linked a DB and TBL here
if(isset($_GET["db"]) && isset($_GET["tbl"])) {
$dbl = $_GET["db"];
$tbl = $_GET["tbl"];
$new = "'".$dbl."', '".$tbl."'";
$cls = "";
} else {
$dbl = "";
$tbl = "";
$new = "";
$cls = "style='display:none;'";
}
// See if there is an error that redirected to here
if(isset($_GET["msg"])) {
$script = 'oh("'.$_GET["msg"].'", "PHP");';
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<?php require_once "assets/page_rsc/head.php"; ?>
</head>
<body onload="tableInit();">
<?php
// require navigation bar
require_once $lcwd."/assets/page_rsc/navbar.php";
?>
<!-- text prompt -->
<div id="txtprompt" class="modal v0lture-modal">
<div class="modal-content">
<h4 id="txttitle"><?= $lang["impromptu_title"]; ?></h4>
<div class="input-field">
<input type="text" id="txtfield">
<label for="txtfield"><?= $lang["impromptu_field"]; ?></label>
</div>
</div>
<div class="modal-footer v0lture-modal">
<a href="#!" class="modal-action modal-close waves-effect waves-light btn-flat v0lture-action"><?= $lang["btn_close"]; ?></a>
<a href="#!" id="txtbtn" onclick="impromptuCallback()" class="modal-action modal-close waves-effect waves-light btn-flat v0lture-action"><?= $lang["btn_submit"]; ?></a>
</div>
</div>
<!-- Run query prompt -->
<div id="queryprompt" class="modal v0lture-modal">
<div class="modal-content">
<h4><?= $lang["modal_query_title"]; ?></h4>
<p><?= $lang["modal_query_info"]; ?></p>
<!-- progress bar -->
<div class="center-align" id="queryrunning">
<div class="progress v0lture-progress-bg">
<div class="indeterminate v0lture-progress"></div>
</div>
<h5 class="v0lture-action"><?= $lang["modal_query_running"]; ?></h5>
</div>
<!-- response states -->
<div class="center-align" id="queryresponse">
<h5 class="v0lture-action" id="queryresponsefailed"><?= $lang["modal_query_failed"]; ?></h5>
<h5 class="v0lture-action" id="queryresponsesuccess"><?= $lang["modal_query_success"]; ?></h5>
<p id="queryresponsetext"><?= $lang["modal_query_waiting"]; ?></p>
</div>
<div class="input-field" id="queryfieldbox">
<input type="text" id="queryfield">
<label for="queryfield"><?= $lang["modal_query_field"]; ?></label>
</div>
</div>
<div class="modal-footer v0lture-modal" id="queryaction">
<a href="#" class="modal-action modal-close waves-effect waves-ligh btn-flat v0lture-cancel"><?= $lang["btn_close"]; ?></a>
<a href="javascript:runQuery(true)" class="waves-effect waves-light btn-flat v0lture-action"><?= $lang["modal_query_btn"]; ?></a>
</div>
</div>
<!-- Error modal -->
<div id="errormodal" class="modal v0lture-modal">
<div class="modal-content">
<h4><?= $lang["modal_error_title"]; ?></h4>
<p><?= $lang["modal_error_action"]; ?></p>
<p>
<?= $lang["modal_error_response"]; ?> <code id="errorresponse"></code><br />
<?= $lang["modal_error_src"]; ?> <code id="errorsrc"></code>
</p>
</div>
<div class="modal-footer v0lture-modal">
<a href="#!" class="modal-action modal-close waves-effect waves-light btn-flat v0lture-action"><?= $lang["modal_error_dismiss"]; ?></a>
</div>
</div>
<!-- Warning modal -->
<div id="warnmodal" class="modal v0lture-modal">
<div class="modal-content">
<h4><?= $lang["modal_warn_title"]; ?></h4>
<p><?= $lang["modal_warn_action"]; ?></p>
<p>
<?= $lang["modal_warn_response"]; ?> <code id="warnresponse"></code><br />
<?= $lang["modal_warn_src"]; ?> <code id="warnsrc"></code>
</p>
</div>
<div class="modal-footer v0lture-modal">
<a href="#!" class="modal-action modal-close waves-effect waves-light btn-flat v0lture-action"><?= $lang["modal_error_dismiss"]; ?></a>
</div>
</div>
<!-- new database prompt -->
<div id="newdb" class="modal bottom-sheet v0lture-modal">
<div class="modal-content">
<h4><?= $lang["db_create"]; ?></h4>
<div class="input-field">
<input id="createdbinline" type="text">
<label for="createdbinline"><?= $lang["db_create_popover_ph"]; ?></label>
</div>
</div>
<div class="modal-footer v-bg-grey">
<a href="javascript:newDB()" class="waves-effect waves-light btn-flat v0lture-action"><?= $lang["db_create_popover"]; ?></a>
</div>
</div>
<div id="editorModal" class="modal modal-fixed-footer v0lture-modal">
<form method="POST" action="assets/page_rsc/editor.php?do=edit">
<div class="modal-content">
<h4><?= $lang["editor_title"]; ?></h4>
<div id="editor-xhr">
<!-- To be filled based off an Ajax request -->
</div>
</div>
<div class="modal-footer v-bg-grey">
<button type="submit" class="waves-effect waves-light btn-flat v0lture-action"><?= $lang["editor_save_changes"]; ?></button>
<a href="#!" class="modal-action modal-close waves-effect waves-light btn-flat v0lture-cancel"><?= $lang["btn_close"]; ?></a>
</div>
</form>
</div>
<div id="newModal" class="modal modal-fixed-footer v0lture-modal">
<form method="POST" action="assets/page_rsc/editor.php?do=insert">
<div class="modal-content">
<h4><?= $lang["editor_new_title"]; ?></h4>
<div id="new-xhr">
<!-- To be filled based off an Ajax request -->
</div>
</div>
<div class="modal-footer v-bg-grey">
<button type="submit" class="waves-effect waves-light btn-flat v0lture-action"><?= $lang["editor_new"]; ?></button>
<a href="#!" class="modal-action modal-close waves-effect waves-light btn-flat v0lture-cancel"><?= $lang["btn_close"]; ?></a>
</div>
</form>
</div>
<!-- New.. fab -->
<div class="fixed-action-btn horizontal" style="bottom: 45px; right: 24px;">
<a class="btn-floating btn-large v0lture-btn-light tooltipped" data-position="top" data-delay="50" data-tooltip="<?= $lang["tooltip_new"]; ?>" onclick="$('.fixed-action-btn').openFAB();">
<i class="large material-icons">add</i>
</a>
<ul>
<li>
<a href="javascript:runQuery(false)" class="btn-floating black tooltipped" data-position="top" data-delay="50" data-tooltip="<?= $lang["tooltip_run_query"]; ?>">
<i class="material-icons">code</i>
</a>
</li>
<li>
<a href="javascript:$('#newdb').modal('open');" class="btn-floating v0lture-btn-dark tooltipped" data-position="top" data-delay="50" data-tooltip="<?= $lang["tooltip_new_db"]; ?>">
<i class="material-icons">dns</i>
</a>
</li>
<li>
<a class="btn-floating v0lture-btn-dark tooltipped" href="new.php" id="newtable" data-position="top" data-delay="50" data-tooltip="<?= $lang["tooltip_new_tbl"]; ?>">
<i class="material-icons">border_all</i>
</a>
</li>
<li>
<a class="btn-floating v0lture-btn-dark tooltipped" data-position="top" data-delay="50" id="newrow" data-tooltip="<?= $lang["tooltip_new_row"]; ?>" onclick="loadInsert(<?= $new; ?>)">
<i class="large material-icons">drag_handle</i>
</a>
</li>
</ul>
</div>
<div class="row" id="fullview" style="height: calc(100vh - 64px);">
<!-- side bar -->
<div class="col s3 scrollbar" style="height: calc(100vh - 64px); padding-top: 25px; overflow: auto;" id="dbview">
<div class="progress v0lture-progress-bg" id="db-loading" style="margin-top: -25px; margin-bottom: 25px; display:none;">
<div class="indeterminate v0lture-progress"></div>
</div>
<div style="color: white; padding-left: 25px; padding-right: 25px;">
<!-- view switcher -->
<?php if(configItem('view_switcher') == "true"): ?>
<div class="input-field" style="width: 50%;">
<select onchange="view(this)">
<option value="databases"><?= $lang["view_db"]; ?></option>
<option value="users"><?= $lang["view_users"]; ?></option>
</select>
</div>
<div class="right" style="margin-top: -55px;">
<a href="javascript:fetchDatabases()" class="btn waves-effect waves-light v-bg-blue" id="db-refresh"><i class="material-icons">refresh</i></a>
<a href="javascript:createUser()" class="btn waves-effect waves-light v-bg-blue" id="users-new" style="display:none;"><i class="material-icons">person_add</i></a>
</div>
<!-- just show databases -->
<?php else: ?>
<h5><?= $lang["view_db"]; ?></h5>
<div class="right" style="margin-top: -40px;">
<a href="javascript:fetchDatabases()" class="btn waves-effect waves-light v-bg-blue" ><i class="material-icons">refresh</i></a>
</div>
<?php endif; ?>
</div>
<div id="db-xhr">
<?php include "assets/page_rsc/databases.php"; ?>
</div>
</div>
<div class="col s9" style="padding: 0px;" id="dataview">
<div class="progress v0lture-progress-bg" id="main-loading" style="margin-top: -0.5px; margin-bottom: 0px; display: none;">
<div class="indeterminate v0lture-progress"></div>
</div>
<!-- error bar -->
<div class="errorbar" onclick="$('.errorbar').slideUp()" style="display: none;">
<p><span><b>-</b></span><br />-</p>
</div>
<!-- control nav -->
<nav style="margin-bottom: -5px;">
<div class="nav-wrapper v0lture-btn-light">
<div class="col s12">
<a href="#!" class="breadcrumb"><?= $h; ?></a>
<a href="#!" class="breadcrumb" <?= $cls; ?> id="bc-db"><?= $dbl; ?></a>
<a href="#!" class="breadcrumb" id="bc-tbl" <?= $cls; ?>><?= $tbl; ?></a>
</div>
</div>
</nav>
<div id="main-xhr" class="scrollbar" style="height: calc(100vh - 139px); overflow: auto; width: 100%;">
<?php
if($dbl != "" || $tbl != "") {
include "assets/page_rsc/table_data.php";
}
?>
</div>
</div>
</div>
<!-- idle time out -->
<?php if(configItem('enable_idle_timeout') == "true"): ?>
<script src="assets/bootstrap/idletimeout.js"></script>
<?php endif; ?>
<!-- handle ?msg= errors -->
<script>
<?php
if(isset($script)) {
echo $script;
}
?>
</script>
</body>
</html>