-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathadminFunctions.php
More file actions
215 lines (203 loc) · 4.93 KB
/
Copy pathadminFunctions.php
File metadata and controls
215 lines (203 loc) · 4.93 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
<?php
function sendConfig($option) {
global $xmlArr;
$msg = "";
if (!$option || $option == "all") {
foreach ($xmlArr["config"] as $key => $value) {
$msg .= "$key: $value\n";
}
$msg = substr($msg, 0, -1);
}
elseif (key_exists($option, $xmlArr["coinfig"])) {
$msg = "$option: " . $xmlArr["config"][$option];
}
else {
$msg = "$option is not a cofig setting";
}
sendMsg($msg);
}
function setCommand($options) {
if (!$options) {
sendMsg("no command specified");
return;
}
global $xmlArr;
$command = $options[0];
$options = array_slice($options, 1);
$setWorked = false;
if (array_key_exists($command, $xmlArr)) {
if ($command == "config") {
$setWorked = setConfig($options);
}
elseif ($command == "info") {
$setWorked = setInfo($options);
}
elseif ($command == "rings") {
$setWorked = setRings($options);
}
elseif ($command == "youtube") {
$setWorked = setYoutube($options);
}
elseif ($command == "custom") {
$setWorked = setCustom($options);
}
elseif ($command == "img") {
$setWorked = setImg($options);
}
elseif ($command == "alias") {
$setWorked = setAlias($options);
}
elseif ($command == "emoji") {
$setWorked = setEmoji($options);
}
elseif ($command == "twitch") {
$setWorked = setTwitch($options);
}
}
}
function setConfig($options) {
global $xml, $xmlFile;
if (count($options) > 1) {
$options[1] = join(" ", array_slice($options, 1));
$xml->config->{strtolower($options[0])} = htmlspecialchars($options[1], ENT_XML1, 'UTF-8');
}
else {
unset($xml->config->{strtolower($options[0])});
}
if ($xml->asXml($xmlFile)) {
sendMsg("Config update successful");
}
else {
sendMsg("Config update unsuccessful");
}
}
function setInfo($options) {
global $xml, $xmlFile;
if (count($options) > 1) {
$options[1] = join(" ", array_slice($options, 1));
$xml->info->{strtolower($options[0])} = htmlspecialchars($options[1], ENT_XML1, 'UTF-8');
}
else {
unset($xml->info->{strtolower($options[0])});
};
if ($xml->asXml($xmlFile)) {
sendMsg("Info update successful");
}
else {
sendMsg("Info update unsuccessful");
}
}
function setRings($options) {
global $xml, $xmlFile;
if (count($options) > 1) {
$options[1] = join(" ", array_slice($options, 1));
$xml->rings->{strtolower($options[0])} = htmlspecialchars($options[1], ENT_XML1, 'UTF-8');
}
else {
unset($xml->rings->{strtolower($options[0])});
};
if ($xml->asXml($xmlFile)) {
sendMsg("Ring update successful");
}
else {
sendMsg("Ring update unsuccessful");
}
}
function setImg($options) {
global $xml, $xmlFile;
if (count($options) > 1) {
$options[1] = join(" ", array_slice($options, 1));
$xml->img->{strtolower($options[0])} = htmlspecialchars($options[1], ENT_XML1, 'UTF-8');
}
else {
unset($xml->img->{strtolower($options[0])});
};
if ($xml->asXml($xmlFile)) {
sendMsg("Img update successful");
}
else {
sendMsg("Img update unsuccessful");
}
}
function setYoutube($options) {
global $xml, $xmlFile;
if (count($options) > 1) {
$options[1] = join(" ", array_slice($options, 1));
$xml->youtube->{strtolower($options[0])} = htmlspecialchars($options[1], ENT_XML1, 'UTF-8');
}
else {
unset($xml->youtube->{strtolower($options[0])});
};
if ($xml->asXml($xmlFile)) {
sendMsg("Youtube info update successful");
}
else {
sendMsg("Youtube info update unsuccessful");
}
}
function setCustom($options) {
global $xml, $xmlFile;
if (count($options) > 1) {
$options[1] = join(" ", array_slice($options, 1));
$xml->custom->{strtolower($options[0])} = htmlspecialchars($options[1], ENT_XML1, 'UTF-8');
}
else {
unset($xml->custom->{strtolower($options[0])});
};
if ($xml->asXml($xmlFile)) {
sendMsg("Custom info update successful");
}
else {
sendMsg("Custom info update unsuccessful");
}
}
function setAlias($options) {
global $xml, $xmlFile;
if (count($options) > 1) {
$options[1] = join(" ", array_slice($options, 1));
$xml->alias->{strtolower($options[0])} = htmlspecialchars($options[1], ENT_XML1, 'UTF-8');
}
else {
unset($xml->alias->{strtolower($options[0])});
};
if ($xml->asXml($xmlFile)) {
sendMsg("Alias update successful");
}
else {
sendMsg("Alias info update unsuccessful");
}
}
function setEmoji($options) {
global $xml, $xmlFile;
if (count($options) > 1) {
$options[1] = join(" ", array_slice($options, 1));
$xml->emoji->{strtolower($options[0])} = htmlspecialchars($options[1], ENT_XML1, 'UTF-8');
}
else {
unset($xml->emoji->{strtolower($options[0])});
};
if ($xml->asXml($xmlFile)) {
sendMsg("Emoji update successful");
}
else {
sendMsg("Emoji update unsuccessful");
}
}
function setTwitch($options) {
global $xml, $xmlFile;
$team = "";
$origiTeam;
$team = getTeam(strtolower($options[0]));
$origiTeam = $options[0];
if (!$team) {
return;
}
$xml->twitch->{$team} = htmlspecialchars($options[1], ENT_XML1, 'UTF-8');
if ($xml->asXml($xmlFile)) {
sendMsg("Twitch update successful");
}
else {
sendMsg("Twitch update unsuccessful");
}
}
?>