-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdashboard.php
More file actions
138 lines (127 loc) · 3.33 KB
/
Copy pathdashboard.php
File metadata and controls
138 lines (127 loc) · 3.33 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
<?php
session_start();
require('auth.php');
enforceLogin();
$xml_names = array();
$xml_type = array();
$xml_registry = array();
$xml_material = array();
function parse($data, $request) {
$xml = simplexml_load_file($data);
if(!$xml) {
foreach(libxml_get_errors() as $err) {
echo $err->message . '<br>';
}
}
if($request == 'img'){
echo '<img src="logo.png"/>' . "\n";
//echo ' block: ' . $xml->block->registryname . '<br>';
} else if($request == 'array'){
global $xml_names;
if($xml->block[0] == null && $xml->item[0] != null){
array_push($xml_names, $xml->item[0]->englishname);
} else if($xml->block[0] != null && $xml->item[0] == null){
array_push($xml_names, $xml->block[0]->englishname);
}else{
fancyDie('XML File Error', 'An XML file does not have the main node of eather "Block" or "Item"');
}
}
}
function discoverAndParseAll($request) {
$files = scandir('../nosemod');
if(count($files) > 0) {
foreach($files as $i) {
/*
if($i == '_dirlist.html') {
continue;
} else if($i == 'NoseRes.zip') {
continue;
} else if($i == 'options.txt') {
continue;
}
*/
$subs = explode('.', $i);
if($subs[count($subs) - 1] != 'xml') {
continue;
}
//echo $i . '<br>';
parse('../nosemod/' . $i, 'img');
parse('../nosemod/' . $i, 'array');
}
}
}
function printArray($title, $array){
echo 'var ' . $title . ' = [';
foreach($array as $i){
if($i != null){
print_r("'" . $i . "'" . ', ');
}
}
echo '"ending"];' . "\n";
}
function fancyDie($title, $subtitle){
if($_POST['ignore'] == null){
die('<html>
<head>
<link rel = "stylesheet" href="css/main.css" type="text/css">
</head>
<body>
<div class="fancydie">
<h1>'. $title . '</h1>
<p>' . $subtitle . '</p>
<p color="red">Please contact technical support to help with this issue</p>
<form action="dashboard.php" method="POST">
<input type="submit" value="Ignore Errors" name="ignore">
</form>
</div>
</body>
</html>
');
}
}
?>
<!DOCTYPE HTML>
<html>
<head>
<meta charset = 'utf-8'>
<title>NOSE Dashboard</title>
<link rel = 'icon' type = 'image/png' href = 'logo.png'>
<link rel = 'stylesheet' href = 'css/coverflow.css'>
<link rel = 'stylesheet' href = 'css/main.css' type = 'text/css'>
<script src = 'https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js'></script>
</head>
<body style = 'background-image: url("img/playstation-pattern.png");' >
<a href = 'logout.php' class = 'btn btn-neutral' id='logout'>Logout</a>
<div>
<div id='coverflow'>
<?php
discoverAndParseAll();
?>
</div><br>
</div>
<div id='info'></div>
<form action = 'create.php' method = 'GET'>
<div id = 'edit'></div>
</form>
<script src = 'js/coverflow.js'></script>
<script>
<?php printArray('titles' , $xml_names); ?>
$(function() {
$('#coverflow').coverflow({
select: function(event, ui){
document.getElementById('info').innerHTML = titles[ui.index];
document.getElementById('edit').innerHTML = "<button type = 'submit' name = 'edit' value = '" + titles[ui.index] + "'>Edit</button>";
}
});
});
$(function(){
for(i = titles.length - 1; i > 0; i--) {
setTimeout(function(num) {
//console.log(num);
$('#coverflow').coverflow('select', num);
}, 200 * (i ** -1.5), i - 1);
}
});
</script>
</body>
</html>