1 | <?php
|
---|
2 |
|
---|
3 | include('global.php');
|
---|
4 |
|
---|
5 | class Index extends Page
|
---|
6 | {
|
---|
7 | var $FullTitle = 'Seznam serverů';
|
---|
8 | var $ShortTitle = 'Seznam serverů';
|
---|
9 |
|
---|
10 | function ShowServerListOnRow($Row)
|
---|
11 | {
|
---|
12 | $Row['NetworkPortRealmd'] = '<a href="realmlist.php?Id='.$Row['Id'].'">'.$Row['NetworkPortRealmd'].'</a>';
|
---|
13 | if($Row['Homepage'] != '') $Row['Name'] = '<a href="'.$Row['Homepage'].'">'.$Row['Name'].'</a>';
|
---|
14 | unset($Row['Homepage']);
|
---|
15 | return($Row);
|
---|
16 | }
|
---|
17 |
|
---|
18 | function ShowServerList()
|
---|
19 | {
|
---|
20 | global $Config;
|
---|
21 |
|
---|
22 | $Server = new Server($this->Database, 0);
|
---|
23 | $Server->UpdateServerList();
|
---|
24 | $Output = '<h4>Seznam serverů</h4>';
|
---|
25 | $Table = new Table('ServerList');
|
---|
26 | $Table->OnRow = array($this, 'ShowServerListOnRow');
|
---|
27 | $Table->Definition['Items']['Id'] = array('Type' => 'Hidden', 'Caption' => '', 'Default' => '');
|
---|
28 | $Table->LoadValuesFromDatabase($this->Database);
|
---|
29 | $Table->Definition['Items']['Actions'] = array('Type' => 'String', 'Caption' => '', 'Default' => '');
|
---|
30 | foreach($Table->Values as $Index => $Item)
|
---|
31 | {
|
---|
32 | $Table->Values[$Index]['Actions'] = '<a href="?Action=ServerShow&Id='.$Item['Id'].'">Podrobnosti</a>';
|
---|
33 | unset($Table->Values[$Index]['Id']);
|
---|
34 | }
|
---|
35 | $Output .= $Table->Show();
|
---|
36 | if($this->System->Modules['User']->User['Role'] >= USER_ROLE_USER)
|
---|
37 | {
|
---|
38 | $DbResult = $this->Database->query('SELECT COUNT(*) FROM Server');
|
---|
39 | $DbRow = $DbResult->fetch_row();
|
---|
40 | $ServerCount = $DbRow[0];
|
---|
41 | $DbResult = $this->Database->query('SELECT COUNT(*) FROM Server WHERE User='.$this->System->Modules['User']->User['Id']);
|
---|
42 | $DbRow = $DbResult->fetch_row();
|
---|
43 | if(($ServerCount < $Config['MaxServerCount']) and ($DbRow[0] == 0))
|
---|
44 | $Output .= '<br /><div style="text-align: center;"><a href="?Action=ServerAdd">Vytvořit nový server</a></dev>';
|
---|
45 | }
|
---|
46 | return($Output);
|
---|
47 | }
|
---|
48 |
|
---|
49 | function ShowServer($Id)
|
---|
50 | {
|
---|
51 | global $Config;
|
---|
52 |
|
---|
53 | $Server = new Server($this->Database, $Id);
|
---|
54 | $Output = '<h4>Podrobnosti serveru</h4>';
|
---|
55 | $Form = new Form('ServerView');
|
---|
56 | $Form->LoadValuesFromDatabase($Id);
|
---|
57 | $Form->Definition['Items']['Realmlist'] = array('Type' => 'String', 'Caption' => 'Adresa k připojení', 'Default' => '');
|
---|
58 | $Form->Definition['Items']['Uptime'] = array('Type' => 'String', 'Caption' => 'Doba běhu', 'Default' => '');
|
---|
59 | $Form->Definition['Items']['UsedMemory'] = array('Type' => 'String', 'Caption' => 'Použitá paměť', 'Default' => '');
|
---|
60 | $Form->Definition['Items']['AccountCount'] = array('Type' => 'String', 'Caption' => 'Počet účtů', 'Default' => '');
|
---|
61 | $Form->Definition['Items']['CharacterCount'] = array('Type' => 'String', 'Caption' => 'Počet postav', 'Default' => '');
|
---|
62 | $Form->Definition['Items']['CharacterOnlineCount'] = array('Type' => 'String', 'Caption' => 'Počet hráčů online', 'Default' => '');
|
---|
63 | $ServerStatus = $Server->GetState();
|
---|
64 | $Form->Values['Realmlist'] = $Config['Web']['Host'].':'.$Form->Values['NetworkPortRealmd'];
|
---|
65 | unset($Form->Values['NetworkPortRealmd']);
|
---|
66 | $Form->Values['Uptime'] = $this->System->AddPrefixMultipliers($ServerStatus['Uptime'], '', 4, 'Time');
|
---|
67 | $Form->Values['UsedMemory'] = $this->System->AddPrefixMultipliers($ServerStatus['UsedMemory'] * 1024, 'B', 4, 'Binary');
|
---|
68 | $Form->Values['AccountCount'] = $ServerStatus['AccountCount'];
|
---|
69 | $Form->Values['CharacterCount'] = $ServerStatus['CharacterCount'];
|
---|
70 | $Form->Values['CharacterOnlineCount'] = $ServerStatus['CharacterOnlineCount'];
|
---|
71 | $Output .= $Form->ShowTable();
|
---|
72 | $Output .= '<div style="text-align: center">';
|
---|
73 | if((($this->System->Modules['User']->User['Role'] >= USER_ROLE_USER) and ($this->System->Modules['User']->User['Id'] == $Server->Server['User'])) or ($this->System->Modules['User']->User['Role'] >= USER_ROLE_ADMINISTRATOR))
|
---|
74 | {
|
---|
75 | $Output .= '<br /><a href="http://'.$this->System->Config['Web']['Host'].'/mysql/">Správa databáze</a> ';
|
---|
76 | if(array_key_exists('Id', $Server->Server['Database']) and ($Server->Server['Lock'] == 0))
|
---|
77 | {
|
---|
78 | if($ServerStatus['RealmdPortState'] == true) $Output .= ' <a href="?Action=ServerStop&Id='.$Server->Id.'">Zastavit</a> <a href="?Action=ServerRestart&Id='.$Server->Id.'">Restartovat</a>';
|
---|
79 | else $Output .= ' <a href="?Action=ServerStart&Id='.$Server->Id.'">Spustit</a>';
|
---|
80 | }
|
---|
81 | if($Server->Server['Lock'] == 0) $Output .= ' <a href="?Action=ServerEdit&Id='.$Server->Id.'">Upravit</a>';
|
---|
82 | //$Output .= ' <a href="?Action=ServerDatabaseImport&Id='.$Server->Id.'">Načtení čisté databáze</a>';
|
---|
83 | }
|
---|
84 | $Output .= ' <a href="?Action=GameAccountRegister&Id='.$Server->Id.'">Vytvoření herního účtu</a>';
|
---|
85 | $Output .= '</div>';
|
---|
86 | return($Output);
|
---|
87 | }
|
---|
88 |
|
---|
89 | function ShowEmulatorList()
|
---|
90 | {
|
---|
91 | global $Config;
|
---|
92 |
|
---|
93 | $Output = '<h4>Seznam verzí emulátoru</h4>';
|
---|
94 | $Table = new Table('EmulatorList');
|
---|
95 | $Table->Definition['Items']['Id'] = array('Type' => 'Hidden', 'Caption' => '', 'Default' => '');
|
---|
96 | $Table->LoadValuesFromDatabase($this->Database);
|
---|
97 | $Table->Definition['Items']['Actions'] = array('Type' => 'String', 'Caption' => '', 'Default' => '');
|
---|
98 | foreach($Table->Values as $Index => $Item)
|
---|
99 | {
|
---|
100 | $Table->Values[$Index]['Actions'] = '<a href="?Action=EmulatorShow&Id='.$Item['Id'].'">Podrobnosti</a>';
|
---|
101 | unset($Table->Values[$Index]['Id']);
|
---|
102 | }
|
---|
103 | $Output .= $Table->Show();
|
---|
104 | if($this->System->Modules['User']->User['Role'] >= USER_ROLE_ADMINISTRATOR)
|
---|
105 | {
|
---|
106 | $Output .= '<br /><div style="text-align: center;"><a href="?Action=EmulatorAdd">Přidat emulátor</a></dev>';
|
---|
107 | }
|
---|
108 | return($Output);
|
---|
109 | }
|
---|
110 |
|
---|
111 | function ShowUpdateList($ServerId)
|
---|
112 | {
|
---|
113 | global $Config;
|
---|
114 |
|
---|
115 | if($this->System->Modules['User']->User['Role'] >= USER_ROLE_USER)
|
---|
116 | {
|
---|
117 | $Server = new Server($this->Database, $_GET['Id']);
|
---|
118 | if(($this->System->Modules['User']->User['Id'] == $Server->Server['User']) or ($this->System->Modules['User']->User['Role'] >= USER_ROLE_ADMINISTRATOR))
|
---|
119 | {
|
---|
120 | $Server = new Server($this->Database, $ServerId);
|
---|
121 | $Output = '<h4>Seznam dostupných aktulizací</h4>';
|
---|
122 | $Output .= 'Před provedením aktualizace bude server zastaven a provedena záloha databáze.';
|
---|
123 | $Table = new Table('EmulatorList');
|
---|
124 | $Table->Definition['Table'] = substr($Table->Definition['Table'], 0, -1).' WHERE Revision > '.$Server->Server['Database']['Emulator']['Revision'].' ORDER BY Revision)';
|
---|
125 | $Table->Definition['Items']['Id'] = array('Type' => 'Hidden', 'Caption' => '', 'Default' => '');
|
---|
126 | $Table->LoadValuesFromDatabase($this->Database);
|
---|
127 | $Table->Definition['Items']['Actions'] = array('Type' => 'String', 'Caption' => '', 'Default' => '');
|
---|
128 | foreach($Table->Values as $Index => $Item)
|
---|
129 | {
|
---|
130 | $Table->Values[$Index]['Actions'] = '<a href="?Action=EmulatorShow&Id='.$Item['Id'].'">Podrobnosti</a>';
|
---|
131 | if($Server->Server['Lock'] == 0) $Table->Values[$Index]['Actions'] .= ' <a href="?Action=Update&Server='.$ServerId.'&Update='.$Item['Id'].'">Aktualizovat</a>';
|
---|
132 | unset($Table->Values[$Index]['Id']);
|
---|
133 | }
|
---|
134 | $Output .= $Table->Show();
|
---|
135 | } else $this->SystemMessage('Dostupné aktualizace', 'Nemáte oprávnění');
|
---|
136 | } else $Output .= USER_BAD_ROLE;
|
---|
137 | return($Output);
|
---|
138 | }
|
---|
139 |
|
---|
140 | function EmulatorShow($Id)
|
---|
141 | {
|
---|
142 | //$Server = new Server($this->Database, $Id);
|
---|
143 | $Output = '<h4>Podrobnosti emulátoru</h4>';
|
---|
144 | $Form = new Form('EmulatorItem');
|
---|
145 | $Form->LoadValuesFromDatabase($Id);
|
---|
146 | $Output .= $Form->ShowTable();
|
---|
147 | $Output .= '<div style="text-align: center">';
|
---|
148 | $Emulator = new Emulator($this->Database, $Id);
|
---|
149 | if($this->System->Modules['User']->User['Role'] >= USER_ROLE_ADMINISTRATOR)
|
---|
150 | {
|
---|
151 | if($Emulator->Emulator['Lock'] == 0) $Output .= ' <a href="?Action=EmulatorDownload&Id='.$Id.'">Stáhnout</a>';
|
---|
152 | if($Emulator->Emulator['Lock'] == 0) $Output .= ' <a href="?Action=EmulatorCompile&Id='.$Id.'">Přeložit</a>';
|
---|
153 | }
|
---|
154 | $Output .= '</div>';
|
---|
155 | return($Output);
|
---|
156 | }
|
---|
157 |
|
---|
158 | function ShowBackupListOnRow($Row)
|
---|
159 | {
|
---|
160 | //$Row['Name'] = '<a href="?Action=EmulatorShow&Id='.$Row['Id'].'">'.$Row['Name'].'</a>';
|
---|
161 | return($Row);
|
---|
162 | }
|
---|
163 |
|
---|
164 | function ShowBackupList($ServerId)
|
---|
165 | {
|
---|
166 | global $Config;
|
---|
167 |
|
---|
168 | if($this->System->Modules['User']->User['Role'] >= USER_ROLE_USER)
|
---|
169 | {
|
---|
170 | $Server = new Server($this->Database, $_GET['Id']);
|
---|
171 | if(($this->System->Modules['User']->User['Id'] == $Server->Server['User']) or ($this->System->Modules['User']->User['Role'] >= USER_ROLE_ADMINISTRATOR))
|
---|
172 | {
|
---|
173 | $Output = '<h4>Dostupné zálohy</h4>';
|
---|
174 | $Table = new Table('BackupList');
|
---|
175 | $Table->OnRow = array($this, 'ShowBackupListOnRow');
|
---|
176 | $Table->Definition['Table'] = '(SELECT * FROM `Backup` WHERE `Server` = '.$Server->Id.')';
|
---|
177 | $Table->Definition['Items']['Id'] = array('Type' => 'Hidden', 'Caption' => 'Id', 'Default' => '');
|
---|
178 | $Table->Definition['Items']['Lock'] = array('Type' => 'Hidden', 'Caption' => 'Zámek', 'Default' => '');
|
---|
179 | $Table->LoadValuesFromDatabase($this->Database);
|
---|
180 | $Table->Definition['Items']['Actions'] = array('Type' => 'String', 'Caption' => '', 'Default' => '');
|
---|
181 | foreach($Table->Values as $Index => $Value)
|
---|
182 | {
|
---|
183 | $Table->Values[$Index]['Actions'] = '';
|
---|
184 | if($Value['Lock'] == 0) $Table->Values[$Index]['Actions'] = '<a href="?Action=BackupDownload&Id='.$Value['Id'].'">Stáhnout</a>';
|
---|
185 | if(($Server->Server['Lock'] == 0) and ($Value['Lock'] == 0)) $Table->Values[$Index]['Actions'] .= ' <a href="?Action=BackupRestore&Id='.$Value['Id'].'">Obnovit</a>';
|
---|
186 | unset($Table->Values[$Index]['Id']);
|
---|
187 | unset($Table->Values[$Index]['Lock']);
|
---|
188 | }
|
---|
189 | $Output .= $Table->Show();
|
---|
190 | if($this->System->Modules['User']->User['Role'] >= USER_ROLE_ADMINISTRATOR)
|
---|
191 | {
|
---|
192 | if($Server->Server['Lock'] == 0) $Output .= '<br /><div style="text-align: center;"><a href="?Action=BackupAdd&Id='.$ServerId.'">Zálohovat</a></dev>';
|
---|
193 | }
|
---|
194 | } else $Output = $this->SystemMessage('Zastavení serveru', 'Nemáte oprávnění');
|
---|
195 | } else $Output = USER_BAD_ROLE;
|
---|
196 | return($Output);
|
---|
197 | }
|
---|
198 |
|
---|
199 | function ShowClientListOnRow($Row)
|
---|
200 | {
|
---|
201 | $Row['Version'] = '<a href="http://www.wowwiki.com/Patch_'.$Row['Version'].'">'.$Row['Version'].'</a>';
|
---|
202 | return($Row);
|
---|
203 | }
|
---|
204 |
|
---|
205 | function ShowClientList()
|
---|
206 | {
|
---|
207 | global $Config;
|
---|
208 |
|
---|
209 | $Output = '<h4>Verze herního klienta</h4>';
|
---|
210 | $Table = new Table('ClientList');
|
---|
211 | $Table->OnRow = array($this, 'ShowClientListOnRow');
|
---|
212 | $Table->LoadValuesFromDatabase($this->Database);
|
---|
213 | $Output .= $Table->Show();
|
---|
214 | if($this->System->Modules['User']->User['Role'] >= USER_ROLE_ADMINISTRATOR)
|
---|
215 | {
|
---|
216 | //$Output .= '<br /><div style="text-align: center;"><a href="?Action=BackupAdd">Zálohovat</a></dev>';
|
---|
217 | }
|
---|
218 | return($Output);
|
---|
219 | }
|
---|
220 |
|
---|
221 | function ShowTaskListOnRow($Row)
|
---|
222 | {
|
---|
223 | $Row['Duration'] = $this->System->AddPrefixMultipliers($Row['Duration'], '', 4, 'Time');
|
---|
224 | return($Row);
|
---|
225 | }
|
---|
226 |
|
---|
227 | function ShowTaskList()
|
---|
228 | {
|
---|
229 | global $Config;
|
---|
230 |
|
---|
231 | if($this->System->Modules['User']->User['Role'] >= USER_ROLE_USER)
|
---|
232 | {
|
---|
233 | $Output = '<h4>Fronta úloh</h4>';
|
---|
234 | $Table = new Table('TaskList');
|
---|
235 | $Table->OnRow = array($this, 'ShowTaskListOnRow');
|
---|
236 | $Table->Definition['Table'] = '(SELECT (COALESCE(UNIX_TIMESTAMP(TimeEnd), UNIX_TIMESTAMP(NOW())) - UNIX_TIMESTAMP(TimeStart)) AS Duration, TimeCreate, Title, State FROM Task WHERE User='.$this->System->Modules['User']->User['Id'].' ORDER BY Id DESC)';
|
---|
237 | $Table->LoadValuesFromDatabase($this->Database);
|
---|
238 | $Output .= $Table->Show();
|
---|
239 | $Output .= '<br /><div style="text-align: center;"><a href="?Action=TaskList">Obnovit pohled</a></dev>';
|
---|
240 | } else $Output .= USER_BAD_ROLE;
|
---|
241 | return($Output);
|
---|
242 | }
|
---|
243 |
|
---|
244 | function ShowDebugListOnRow($Row)
|
---|
245 | {
|
---|
246 | $Row['Time'] = '<a href="?Action=ServerDebug&Id='.$Row['Id'].'&Show=Backtrace">'.str_replace(' ', ' ', $Row['Time']).'</a>';
|
---|
247 | $Row['Uptime'] = TimeToHumanTime($Row['Uptime']);
|
---|
248 | return($Row);
|
---|
249 | }
|
---|
250 |
|
---|
251 | function ShowDebugList()
|
---|
252 | {
|
---|
253 | global $Config;
|
---|
254 |
|
---|
255 | if($this->System->Modules['User']->User['Role'] >= USER_ROLE_USER)
|
---|
256 | {
|
---|
257 | $Server = new Server($this->Database, $_GET['Id']);
|
---|
258 | if(($this->System->Modules['User']->User['Id'] == $Server->Server['User']) or ($this->System->Modules['User']->User['Role'] >= USER_ROLE_ADMINISTRATOR))
|
---|
259 | {
|
---|
260 | $Output = '<h4>Ladící záznamy restartů</h4>';
|
---|
261 | $Table = new Table('DebugList');
|
---|
262 | $Table->OnRow = array($this, 'ShowDebugListOnRow');
|
---|
263 | $Table->Definition['Table'] = '(SELECT * FROM Debug WHERE Server='.$_GET['Id'].')';
|
---|
264 | $Table->LoadValuesFromDatabase($this->Database);
|
---|
265 | $Output .= $Table->Show();
|
---|
266 | if($this->System->Modules['User']->User['Role'] >= USER_ROLE_ADMINISTRATOR)
|
---|
267 | {
|
---|
268 | //$Output .= '<br /><div style="text-align: center;"><a href="?Action=BackupAdd">Zálohovat</a></dev>';
|
---|
269 | }
|
---|
270 | } else $this->SystemMessage('Ladící záznamy', 'Nemáte oprávnění');
|
---|
271 | } else $Output .= USER_BAD_ROLE;
|
---|
272 | return($Output);
|
---|
273 | }
|
---|
274 |
|
---|
275 | function ShowLoginForm()
|
---|
276 | {
|
---|
277 | $Form = new Form('UserLogin');
|
---|
278 | $Form->OnSubmit = '?Action=Login';
|
---|
279 | $Output = $Form->ShowEditForm();
|
---|
280 | $Output .= '<div class="Centred"><a href="?Action=UserRegister">Registrovat se</a> '.
|
---|
281 | '<a href="?Action=PasswordRecovery">Obnova zapomenutého hesla</a></div>';
|
---|
282 | return($Output);
|
---|
283 | }
|
---|
284 |
|
---|
285 | function ImportDatabase()
|
---|
286 | {
|
---|
287 | if($this->System->Modules['User']->User['Role'] >= USER_ROLE_USER)
|
---|
288 | {
|
---|
289 | $Server = new Server($this->Database, $_GET['Id']);
|
---|
290 | if(($this->System->Modules['User']->User['Id'] == $Server->Server['User']) or ($this->System->Modules['User']->User['Role'] >= USER_ROLE_ADMINISTRATOR))
|
---|
291 | {
|
---|
292 | $Server->ImportDatabase(true);
|
---|
293 | $Output .= $this->SystemMessage('Import čisté databáze', 'Úloha zařazena do fronty');
|
---|
294 | $Output .= $this->ShowTaskList();
|
---|
295 | } else $this->SystemMessage('Import databáze', 'Nemáte oprávnění');
|
---|
296 | } else $Output .= USER_BAD_ROLE;
|
---|
297 | }
|
---|
298 |
|
---|
299 | function ShowWelcome()
|
---|
300 | {
|
---|
301 | $Output = '<p>Vítejte v projektu zaměřeném na free hosting WoW serverů.</p>'.
|
---|
302 | '<strong>Použité technologie:</strong><br />'.
|
---|
303 | '<ul>'.
|
---|
304 | '<li><a href="http://www.worldofwarcraft.com/">World of Warcraft</a> - fantasy MMORPG</li>'.
|
---|
305 | '<li><a href="http://www.getmangos.com/">MaNGOS</a> - MMORPG server</li>'.
|
---|
306 | '<li><a href="http://www.udbforums.org/">UDB</a> - databáze pro MaNGOS</li>'.
|
---|
307 | '<li><a href="http://www.scriptdev2.com/">ScriptDev2</a> - doplňkový skriptovací systém pro MaNGOS</li>'.
|
---|
308 | '</ul>';
|
---|
309 | return($Output);
|
---|
310 | }
|
---|
311 |
|
---|
312 | function UserMenu()
|
---|
313 | {
|
---|
314 | $Output = '<strong>Uživatelské menu</strong><br />';
|
---|
315 | if($this->System->Modules['User']->User['Id'] != $this->System->Modules['User']->AnonymousUserId)
|
---|
316 | {
|
---|
317 | $DbResult = $this->Database->query('SELECT COUNT(*) FROM Server WHERE User='.$this->System->Modules['User']->User['Id']);
|
---|
318 | $DbRow = $DbResult->fetch_row();
|
---|
319 | if($DbRow[0] > 0)
|
---|
320 | {
|
---|
321 | $DbResult = $this->Database->query('SELECT Id FROM Server WHERE User='.$this->System->Modules['User']->User['Id']);
|
---|
322 | $Server = $DbResult->fetch_assoc();
|
---|
323 | $Output .= '<div><a href="?Action=ServerShow&Id='.$Server['Id'].'">Můj server</a></div>';
|
---|
324 | $Output .= '<div><a href="?Action=DebugList&Id='.$Server['Id'].'">Ladící záznamy</a></div>';
|
---|
325 | $Output .= '<div><a href="?Action=BackupList&Id='.$Server['Id'].'">Zálohy</a></div>';
|
---|
326 | $Output .= '<div><a href="?Action=TaskList">Fronta úloh</a></div>';
|
---|
327 | $Output .= '<div><a href="?Action=UpdateList&Id='.$Server['Id'].'">Dostupné aktualizace</a></div>';
|
---|
328 | } else $Output .= '<div><a href="?Action=ServerAdd">Vytvořit vlastní server</a></div>';
|
---|
329 | if($this->System->Modules['User']->User['Role'] == USER_ROLE_ADMINISTRATOR)
|
---|
330 | {
|
---|
331 | $Output .= '<div><a href="?Action=NewsAdd">Přidat aktualitu</a></div>';
|
---|
332 | }
|
---|
333 | }
|
---|
334 | return($Output);
|
---|
335 | }
|
---|
336 |
|
---|
337 | function ShowInfo()
|
---|
338 | {
|
---|
339 | global $Config;
|
---|
340 |
|
---|
341 | $Output = '<h4>Informace</h4>'.
|
---|
342 | '<p>Tento free hosting WoW serverů vám nabízí zdarma vytvoření vlastního malého serveru. Vytvoření a správa serveru nikdy nebyly jednodušší.</p>'.
|
---|
343 | '<strong>Pro koho je hosting určen?</strong>'.
|
---|
344 | '<ul>'.
|
---|
345 | '<li>Pro ty, kteří se chtějí starat o vlastní server, ale nemají dostatek financí nebo prostoru pro jeho provozování.</li>'.
|
---|
346 | '<li>Pro ty, kteří si chtějí vyzkoušet, jaké je to být administrátorem či GM na svém serveru.</li>'.
|
---|
347 | '</ul><br />'.
|
---|
348 | '<strong>Co získáte registrací?</strong>'.
|
---|
349 | '<ul>'.
|
---|
350 | '<li>Přístup k vlastnímu nepřetržitě běžícímu WoW serveru.</li>'.
|
---|
351 | '<li>Možnost si vybrat jednu z nabízených kombinací verze emulátoru, databáze a klienta.</li>'.
|
---|
352 | '<li>Možnost provádět aktualizace serveru na pár kliknutí.</li>'.
|
---|
353 | '<li>Periodické noční zálohování a možnost ruční obnovy.</li>'.
|
---|
354 | '<li>Max. 50 online hrajících hráčů.</li>'.
|
---|
355 | '<li>Neomezený počet účtů a postav.</li>'.
|
---|
356 | '<li>Možnost stáhnout si celou databázi serveru a v případě zájmů hráčů tak přejít na vlastní výkonější vyhrazený server.</li>'.
|
---|
357 | '<li>Automatické restartování serveru při selhání a automatický záznam ladících informací o pádu.</li>'.
|
---|
358 | '</ul><br />'.
|
---|
359 | '<p>Vámi vytvořený server může být bez předchozího upozornění smazán, např. pokud nebude již využíván nebo bude potřeba snížit vytížení hostingu.</p>'.
|
---|
360 | 'Technická podpora: '.$Config['Web']['AdminEmail'];
|
---|
361 | return($Output);
|
---|
362 | }
|
---|
363 |
|
---|
364 | function Show()
|
---|
365 | {
|
---|
366 | global $Config;
|
---|
367 |
|
---|
368 | $Output = '';
|
---|
369 | if(array_key_exists('Action', $_GET))
|
---|
370 | {
|
---|
371 | if($_GET['Action'] == 'LoginForm')
|
---|
372 | {
|
---|
373 | $Output .= $this->ShowLoginForm();
|
---|
374 | } else
|
---|
375 | if($_GET['Action'] == 'Login')
|
---|
376 | {
|
---|
377 | $Form = new Form('UserLogin');
|
---|
378 | $Form->OnSubmit = '?Action=Login';
|
---|
379 | $Form->LoadValuesFromForm();
|
---|
380 | $Result = $this->System->Modules['User']->Login($Form->Values['Username'], $Form->Values['Password']);
|
---|
381 | $Output = $this->SystemMessage('Přihlášení', $Result);
|
---|
382 | if($Result <> USER_LOGGED_IN)
|
---|
383 | {
|
---|
384 | $Form->Values['Password'] = '';
|
---|
385 | $Output .= $Form->ShowEditForm();
|
---|
386 | $Output .= '<div class="Centred"><a href="?Action=UserRegister">Registrovat se</a> '.
|
---|
387 | '<a href="?Action=PasswordRecovery">Obnova zapomenutého hesla</a></div>';
|
---|
388 | }
|
---|
389 | } else
|
---|
390 | if($_GET['Action'] == 'Logout')
|
---|
391 | {
|
---|
392 | $Output .= $this->SystemMessage('Odhlášení', $this->System->Modules['User']->Logout());
|
---|
393 | $Output .= $this->ShowLoginForm();
|
---|
394 | } else
|
---|
395 | if($_GET['Action'] == 'UserOptions')
|
---|
396 | {
|
---|
397 | $UserOptions = new Form('UserOptions');
|
---|
398 | $UserOptions->LoadValuesFromDatabase($this->System->Modules['User']->User['Id']);
|
---|
399 | $UserOptions->OnSubmit = '?Action=UserOptionsSave';
|
---|
400 | $Output .= $UserOptions->ShowEditForm();
|
---|
401 | } else
|
---|
402 | if($_GET['Action'] == 'UserOptionsSave')
|
---|
403 | {
|
---|
404 | $UserOptions = new Form('UserOptions', array());
|
---|
405 | $UserOptions->LoadValuesFromForm();
|
---|
406 | $UserOptions->SaveValuesToDatabase($this->System->Modules['User']->User['Id']);
|
---|
407 | $Output .= $this->SystemMessage('Nastavení', 'Nastavení uloženo.');
|
---|
408 | $this->System->Modules['Log']->NewRecord('User', 'Nastavení uživatele změněno', $UserOptions->Values['Name']);
|
---|
409 | $UserOptions->LoadValuesFromDatabase($this->System->Modules['User']->User['Id']);
|
---|
410 | $UserOptions->OnSubmit = '?Action=UserOptionsSave';
|
---|
411 | $Output .= $UserOptions->ShowEditForm();
|
---|
412 | } else
|
---|
413 | if($_GET['Action'] == 'UserRegister')
|
---|
414 | {
|
---|
415 | $Form = new Form('UserRegister');
|
---|
416 | $Form->LoadValuesFromForm();
|
---|
417 | $Form->OnSubmit = '?Action=UserRegisterSave';
|
---|
418 | $Output = 'Vyplňte správně požadované údaje. Na zadaný email vám bude zaslán aktivační email.';
|
---|
419 | $Output .= $Form->ShowEditForm();
|
---|
420 | } else
|
---|
421 | if($_GET['Action'] == 'UserRegisterConfirm')
|
---|
422 | {
|
---|
423 | $Output .= $this->SystemMessage('Potvrzení registrace', $this->System->Modules['User']->RegisterConfirm($_GET['User'], $_GET['H']));
|
---|
424 | $Output .= $this->ShowLoginForm();
|
---|
425 | } else
|
---|
426 | if($_GET['Action'] == 'PasswordRecovery')
|
---|
427 | {
|
---|
428 | $Form = new Form('PasswordRecovery');
|
---|
429 | $Form->OnSubmit = '?Action=PasswordRecovery2';
|
---|
430 | $Output .= $Form->ShowEditForm();
|
---|
431 | } else
|
---|
432 | if($_GET['Action'] == 'PasswordRecovery2')
|
---|
433 | {
|
---|
434 | $Form = new Form('PasswordRecovery');
|
---|
435 | $Form->LoadValuesFromForm();
|
---|
436 | $Result = $this->System->Modules['User']->PasswordRecoveryRequest($Form->Values['Name'], $Form->Values['Email']);
|
---|
437 | $Output .= $this->SystemMessage('Obnova hesla', $Result);
|
---|
438 | if($Result <> USER_PASSWORD_RECOVERY_SUCCESS)
|
---|
439 | {
|
---|
440 | $Output .= $Form->ShowEditForm();
|
---|
441 | }
|
---|
442 | } else
|
---|
443 | if($_GET['Action'] == 'PasswordRecoveryConfirm')
|
---|
444 | {
|
---|
445 | $Output .= $this->SystemMessage('Obnova hesla', $this->System->Modules['User']->PasswordRecoveryConfirm($_GET['User'], $_GET['H'], $_GET['P']));
|
---|
446 | $Output .= $this->ShowLoginForm();
|
---|
447 | } else
|
---|
448 | if($_GET['Action'] == 'UserRegisterSave')
|
---|
449 | {
|
---|
450 | $Form = new Form('UserRegister', array());
|
---|
451 | $Form->LoadValuesFromForm();
|
---|
452 | $Result = $this->System->Modules['User']->Register($Form->Values['Login'], $Form->Values['Password'], $Form->Values['Password2'], $Form->Values['Email'], $Form->Values['Name']);
|
---|
453 | $Output .= $this->SystemMessage('Registrace nového účtu', $Result);
|
---|
454 | if($Result <> USER_REGISTRATED)
|
---|
455 | {
|
---|
456 | $Form->OnSubmit = '?Action=UserRegisterSave';
|
---|
457 | $Output .= $Form->ShowEditForm();
|
---|
458 | }
|
---|
459 | } else
|
---|
460 | if($_GET['Action'] == 'ServerAdd')
|
---|
461 | {
|
---|
462 | if($this->System->Modules['User']->User['Role'] >= USER_ROLE_USER)
|
---|
463 | {
|
---|
464 | $DbResult = $this->Database->query('SELECT COUNT(*) FROM Server');
|
---|
465 | $DbRow = $DbResult->fetch_row();
|
---|
466 | $ServerCount = $DbRow[0];
|
---|
467 | if($ServerCount < $Config['MaxServerCount'])
|
---|
468 | {
|
---|
469 | $DbResult = $this->Database->query('SELECT COUNT(*) FROM Server WHERE User='.$this->System->Modules['User']->User['Id']);
|
---|
470 | $DbRow = $DbResult->fetch_row();
|
---|
471 | if($DbRow[0] > 0) $Output .= $this->SystemMessage('Nový server', 'Lze vytvořit pouze jeden server pro každý uživatelský účet.');
|
---|
472 | else
|
---|
473 | {
|
---|
474 | $Form = new Form('ServerCreate');
|
---|
475 | $Form->LoadValuesFromForm();
|
---|
476 | $Form->OnSubmit = '?Action=ServerCreate';
|
---|
477 | $Output .= 'Tento formulář vám umožní si vytvořit nový server. Pečlivě vyplňte požadované údaje.';
|
---|
478 | $Output .= $Form->ShowEditForm();
|
---|
479 | }
|
---|
480 | } else $Output .= $this->SystemMessage('Nový serve', 'Nelze vytvářet další servery');
|
---|
481 | } else $Output .= USER_BAD_ROLE;
|
---|
482 | } else
|
---|
483 | if($_GET['Action'] == 'ServerCreate')
|
---|
484 | {
|
---|
485 | if($this->System->Modules['User']->User['Role'] >= USER_ROLE_USER)
|
---|
486 | {
|
---|
487 | $DbResult = $this->Database->query('SELECT COUNT(*) FROM Server WHERE User='.$this->System->Modules['User']->User['Id']);
|
---|
488 | $DbRow = $DbResult->fetch_row();
|
---|
489 | if($DbRow[0] > 0) $Output .= $this->SystemMessage('Nový server', 'Lze vytvořit pouze jeden server pro každý uživatelský účet.');
|
---|
490 | else
|
---|
491 | {
|
---|
492 | $DbResult = $this->Database->query('SELECT MAX(NetworkPortRealmd), MAX(NetworkPortWorldd) FROM Server');
|
---|
493 | $DbRow = $DbResult->fetch_row();
|
---|
494 | $NewPortRealmd = $DbRow[0] + 1;
|
---|
495 | if($NewPortRealmd < $Config['BaseNetworkPortRealmd']) $NewPortRealmd = $Config['BaseNetworkPortRealmd'];
|
---|
496 | $NewPortWorldd = $DbRow[1] + 1;
|
---|
497 | if($NewPortWorldd < $Config['BaseNetworkPortWorldd']) $NewPortWorldd = $Config['BaseNetworkPortWorldd'];
|
---|
498 |
|
---|
499 | $Form = new Form('ServerCreate', array());
|
---|
500 | $Form->LoadValuesFromForm();
|
---|
501 | $this->Database->insert('Server', array('Name' => $Form->Values['Name'], 'Description' => $Form->Values['Description'], 'User' => $this->System->Modules['User']->User['Id'], 'Motd' => $Form->Values['Motd'], 'Homepage' => $Form->Values['Homepage'], 'Type' => $Form->Values['Type'], 'Database' => 1, 'NetworkPortWorldd' => $NewPortWorldd, 'NetworkPortRealmd' => $NewPortRealmd, 'Lock' => 1, 'TimeCreate' => 'NOW()'));
|
---|
502 | $LastInsertId = $this->Database->insert_id;
|
---|
503 | $Server = new Server($this->Database, $LastInsertId);
|
---|
504 | $Server->CreateDatabase();
|
---|
505 | $Output .= $this->SystemMessage('Vytvoření serveru', $Server->ImportDatabase(true));
|
---|
506 | $Output .= $this->ShowTaskList();
|
---|
507 | //$UserOptions->LoadValuesFromDatabase($this->System->Modules['User']->User['Id']);
|
---|
508 | //$Form->OnSubmit = '?Action=ServerCreate';
|
---|
509 | //$Output .= $Form->ShowEditForm();
|
---|
510 | }
|
---|
511 | } else $Output .= USER_BAD_ROLE;
|
---|
512 | } else
|
---|
513 | if($_GET['Action'] == 'ServerShow')
|
---|
514 | {
|
---|
515 | if(array_key_exists('Id', $_GET)) $Output .= $this->ShowServer($_GET['Id']);
|
---|
516 | else $this->SystemMessage('Zobrazení serveru', 'Nebylo zadáno Id');
|
---|
517 | } else
|
---|
518 | if($_GET['Action'] == 'ServerEdit')
|
---|
519 | {
|
---|
520 | $Server = new Server($this->Database, $_GET['Id']);
|
---|
521 | if(($this->System->Modules['User']->User['Id'] == $Server->Server['User']) or ($this->System->Modules['User']->User['Role'] >= USER_ROLE_ADMINISTRATOR))
|
---|
522 | {
|
---|
523 | $Form = new Form('ServerEdit');
|
---|
524 | $Form->LoadValuesFromDatabase($_GET['Id']);
|
---|
525 | $Form->Values['ServerId'] = $_GET['Id'];
|
---|
526 | $Form->OnSubmit = '?Action=ServerSave';
|
---|
527 | $Output .= $Form->ShowEditForm();
|
---|
528 | } else $this->SystemMessage('Nastavení serveru', 'Nemáte oprávnění');
|
---|
529 | } else
|
---|
530 | if($_GET['Action'] == 'ServerSave')
|
---|
531 | {
|
---|
532 | $Server = new Server($this->Database, $_POST['ServerId']);
|
---|
533 | if(($this->System->Modules['User']->User['Id'] == $Server->Server['User']) or ($this->System->Modules['User']->User['Role'] >= USER_ROLE_ADMINISTRATOR))
|
---|
534 | {
|
---|
535 | $Form = new Form('ServerEdit', array());
|
---|
536 | $Form->LoadValuesFromForm();
|
---|
537 | $ServerId = $_POST['ServerId'];
|
---|
538 | unset($Form->Values['ServerId']);
|
---|
539 | $Output .= $this->SystemMessage('Upravit server', 'Nastavení serveru uloženo.');
|
---|
540 | $Form->SaveValuesToDatabase($_POST['ServerId']);
|
---|
541 | $Form->OnSubmit = '?Action=ServerSave';
|
---|
542 |
|
---|
543 | $Server = new Server($this->Database, $_POST['ServerId']);
|
---|
544 | $Server->SaveConfiguration();
|
---|
545 | $Form->Values['ServerId'] = $ServerId;
|
---|
546 | $Output .= $Form->ShowEditForm();
|
---|
547 | } else $this->SystemMessage('Nastavení serveru', 'Nemáte oprávnění');
|
---|
548 | } else
|
---|
549 | if($_GET['Action'] == 'ServerStart')
|
---|
550 | {
|
---|
551 | if($this->System->Modules['User']->User['Role'] >= USER_ROLE_USER)
|
---|
552 | {
|
---|
553 | $Server = new Server($this->Database, $_GET['Id']);
|
---|
554 | if(($this->System->Modules['User']->User['Id'] == $Server->Server['User']) or ($this->System->Modules['User']->User['Role'] >= USER_ROLE_ADMINISTRATOR))
|
---|
555 | {
|
---|
556 | $Output .= $this->SystemMessage('Spuštění serveru', $Server->Start());
|
---|
557 | $Output .= $this->ShowTaskList();
|
---|
558 | } else $this->SystemMessage('Spuštění serveru', 'Nemáte oprávnění');
|
---|
559 | } else $Output .= USER_BAD_ROLE;
|
---|
560 | } else
|
---|
561 | if($_GET['Action'] == 'ServerStop')
|
---|
562 | {
|
---|
563 | if($this->System->Modules['User']->User['Role'] >= USER_ROLE_USER)
|
---|
564 | {
|
---|
565 | $Server = new Server($this->Database, $_GET['Id']);
|
---|
566 | if(($this->System->Modules['User']->User['Id'] == $Server->Server['User']) or ($this->System->Modules['User']->User['Role'] >= USER_ROLE_ADMINISTRATOR))
|
---|
567 | {
|
---|
568 | $Output .= $this->SystemMessage('Zastavení serveru', $Server->Stop());
|
---|
569 | $Output .= $this->ShowTaskList();
|
---|
570 | } else $this->SystemMessage('Zastavení serveru', 'Nemáte oprávnění');
|
---|
571 | } else $Output .= USER_BAD_ROLE;
|
---|
572 | } else
|
---|
573 | if($_GET['Action'] == 'ServerDatabaseImport')
|
---|
574 | {
|
---|
575 | $this->ImportDatabase();
|
---|
576 | } else
|
---|
577 | if($_GET['Action'] == 'EmulatorShow')
|
---|
578 | {
|
---|
579 | if(array_key_exists('Id', $_GET))
|
---|
580 | {
|
---|
581 | $Output .= $this->EmulatorShow($_GET['Id']);
|
---|
582 | } else $Output .= $this->SystemMessage('Překlad emulátoru', 'Nebylo zadáno Id');
|
---|
583 | } else
|
---|
584 | if($_GET['Action'] == 'EmulatorList')
|
---|
585 | {
|
---|
586 | $Output .= $this->ShowEmulatorList();
|
---|
587 | } else
|
---|
588 | if($_GET['Action'] == 'EmulatorCompile')
|
---|
589 | {
|
---|
590 | if(array_key_exists('Id', $_GET))
|
---|
591 | {
|
---|
592 | $Emulator = new Emulator($this->Database, $_GET['Id']);
|
---|
593 | $Emulator->Compile();
|
---|
594 | $Output .= $this->SystemMessage('Překlad emulátoru', 'Úloha zařazena do fronty');
|
---|
595 | $Output .= $this->ShowTaskList();
|
---|
596 | } else $Output .= $this->SystemMessage('Překlad emulátoru', 'Nebylo zadáno Id');
|
---|
597 | } else
|
---|
598 | if($_GET['Action'] == 'EmulatorDownload')
|
---|
599 | {
|
---|
600 | if(array_key_exists('Id', $_GET))
|
---|
601 | {
|
---|
602 | $Emulator = new Emulator($this->Database, $_GET['Id']);
|
---|
603 | $Emulator->Download();
|
---|
604 | $Output .= $this->SystemMessage('Stažení emulátoru', 'Úloha zařazena do fronty');
|
---|
605 | $Output .= $this->ShowTaskList();
|
---|
606 | } else $Output .= $this->SystemMessage('Stažení emulátoru', 'Nebylo zadáno Id');
|
---|
607 | } else
|
---|
608 | if($_GET['Action'] == 'ServerDebug')
|
---|
609 | {
|
---|
610 | if($this->System->Modules['User']->User['Role'] >= USER_ROLE_USER)
|
---|
611 | {
|
---|
612 | $Server = new Server($this->Database, $_GET['Id']);
|
---|
613 | if(($this->System->Modules['User']->User['Id'] == $Server->Server['User']) or ($this->System->Modules['User']->User['Role'] >= USER_ROLE_ADMINISTRATOR))
|
---|
614 | {
|
---|
615 | $Output .= '<div>Ladící informace serveru</div>';
|
---|
616 | $MangosDebug = new MangosDebug($this->Database);
|
---|
617 | $Output .= $MangosDebug->Show($Server->Id);
|
---|
618 | } else $this->SystemMessage('Ladící informace', 'Nemáte oprávnění');
|
---|
619 | } else $Output .= USER_BAD_ROLE;
|
---|
620 | } else
|
---|
621 | if($_GET['Action'] == 'ClientList')
|
---|
622 | {
|
---|
623 | $Output .= $this->ShowClientList();
|
---|
624 | } else
|
---|
625 | if($_GET['Action'] == 'BackupList')
|
---|
626 | {
|
---|
627 | $Output .= $this->ShowBackupList($_GET['Id']);
|
---|
628 | } else
|
---|
629 | if($_GET['Action'] == 'DebugList')
|
---|
630 | {
|
---|
631 | $Output .= $this->ShowDebugList($_GET['Id']);
|
---|
632 | } else
|
---|
633 | if($_GET['Action'] == 'UpdateList')
|
---|
634 | {
|
---|
635 | $Output .= $this->ShowUpdateList($_GET['Id']);
|
---|
636 | } else
|
---|
637 | if($_GET['Action'] == 'GameAccountRegister')
|
---|
638 | {
|
---|
639 | $Form = new Form('GameAccountNew', $_GET['Id']);
|
---|
640 | $Form->LoadValuesFromForm();
|
---|
641 | $Form->Values['ServerId'] = $_GET['Id'];
|
---|
642 | $Form->OnSubmit = '?Action=GameAccountRegister2';
|
---|
643 | $Output .= $Form->ShowEditForm();
|
---|
644 | } else
|
---|
645 | if($_GET['Action'] == 'GameAccountRegister2')
|
---|
646 | {
|
---|
647 | $Form = new Form('GameAccountNew');
|
---|
648 | $Form->LoadValuesFromForm();
|
---|
649 | $Server = new Server($this->Database, $Form->Values['ServerId']);
|
---|
650 | $Output .= $this->SystemMessage('Vytvoření herního účtu', $Server->NewAccount($Form->Values['Name'], $Form->Values['Password'], $Form->Values['Password2'], $Form->Values['Email'], $Form->Values['Expansion']));
|
---|
651 | $Output .= '<a href="?Action=GameAccountRegister&Id='.$Form->Values['ServerId'].'">Zpět k zadání údajů</a>';
|
---|
652 | } else
|
---|
653 | if($_GET['Action'] == 'Info')
|
---|
654 | {
|
---|
655 | $Output = $this->ShowInfo();
|
---|
656 | } else
|
---|
657 | if($_GET['Action'] == 'BackupAdd')
|
---|
658 | {
|
---|
659 | if(!array_key_exists('Id', $_GET)) $Output .= $this->SystemMessage('Ladící informace', 'Nebylo zadáno Id serveru');
|
---|
660 | else if($this->System->Modules['User']->User['Role'] >= USER_ROLE_USER)
|
---|
661 | {
|
---|
662 | $Server = new Server($this->Database, $_GET['Id']);
|
---|
663 | if(($this->System->Modules['User']->User['Id'] == $Server->Server['User']) or ($this->System->Modules['User']->User['Role'] >= USER_ROLE_ADMINISTRATOR))
|
---|
664 | {
|
---|
665 | $Backup = new Backup($this->Database, 0);
|
---|
666 | $Output .= $this->SystemMessage('Ruční zálohování', $Backup->Create($Server->Id));
|
---|
667 | $Output .= $this->ShowTaskList();
|
---|
668 | } else $this->SystemMessage('Ladící informace', 'Nemáte oprávnění');
|
---|
669 | } else $Output .= USER_BAD_ROLE;
|
---|
670 | } else
|
---|
671 | if($_GET['Action'] == 'BackupRestore')
|
---|
672 | {
|
---|
673 | if(!array_key_exists('Id', $_GET)) $Output .= $this->SystemMessage('Obnovení ze zálohy', 'Nebylo zadáno Id zálohy');
|
---|
674 | else if($this->System->Modules['User']->User['Role'] >= USER_ROLE_USER)
|
---|
675 | {
|
---|
676 | $Backup = new Backup($this->Database, $_GET['Id']);
|
---|
677 | $Server = new Server($this->Database, $Backup->Backup['Server']);
|
---|
678 | if(($this->System->Modules['User']->User['Id'] == $Server->Server['User']) or ($this->System->Modules['User']->User['Role'] >= USER_ROLE_ADMINISTRATOR))
|
---|
679 | {
|
---|
680 | $Output .= $this->SystemMessage('Obnovení ze zálohy', $Backup->Restore());
|
---|
681 | $Output .= $this->ShowTaskList();
|
---|
682 | } else $this->SystemMessage('Obnovení ze zálohy', 'Nemáte oprávnění');
|
---|
683 | } else $Output .= USER_BAD_ROLE;
|
---|
684 | } else
|
---|
685 | if($_GET['Action'] == 'BackupDownload')
|
---|
686 | {
|
---|
687 | if(!array_key_exists('Id', $_GET)) $Output .= $this->SystemMessage('Stažení souboru zálohy', 'Nebylo zadáno Id zálohy');
|
---|
688 | else if($this->System->Modules['User']->User['Role'] >= USER_ROLE_USER)
|
---|
689 | {
|
---|
690 | $Backup = new Backup($this->Database, $_GET['Id']);
|
---|
691 | $Server = new Server($this->Database, $Backup->Backup['Server']);
|
---|
692 | if(($this->System->Modules['User']->User['Id'] == $Server->Server['User']) or ($this->System->Modules['User']->User['Role'] >= USER_ROLE_ADMINISTRATOR))
|
---|
693 | {
|
---|
694 | Header('Content-Type: application/x-tar-gz');
|
---|
695 | Header('Content-Disposition: attachment; filename="wowhosting-'.$Backup->Id.'.tar.bz2"');
|
---|
696 | echo(file_get_contents('../backup/wowhosting-'.$Backup->Id.'.tar.bz2'));
|
---|
697 | exit;
|
---|
698 | } else $this->SystemMessage('Stažení souboru zálohy', 'Nemáte oprávnění');
|
---|
699 | } else $Output .= USER_BAD_ROLE;
|
---|
700 | } else
|
---|
701 | if($_GET['Action'] == 'TaskList')
|
---|
702 | {
|
---|
703 | $Output .= $this->ShowTaskList();
|
---|
704 | } else
|
---|
705 | if($_GET['Action'] == 'Update')
|
---|
706 | {
|
---|
707 | if(!array_key_exists('Server', $_GET)) $Output .= $this->SystemMessage('Aktualizace serveru', 'Nebylo zadáno Id serveru');
|
---|
708 | else if(!array_key_exists('Update', $_GET)) $Output .= $this->SystemMessage('Aktualizace serveru', 'Nebylo zadáno Id aktualizace');
|
---|
709 | else if($this->System->Modules['User']->User['Role'] >= USER_ROLE_USER)
|
---|
710 | {
|
---|
711 | $Server = new Server($this->Database, $_GET['Server']);
|
---|
712 | if(($this->System->Modules['User']->User['Id'] == $Server->Server['User']) or ($this->System->Modules['User']->User['Role'] >= USER_ROLE_ADMINISTRATOR))
|
---|
713 | {
|
---|
714 | $Output .= $this->SystemMessage('Aktualizace serveru', $Server->Update($_GET['Update']));
|
---|
715 | $Output .= $this->ShowTaskList();
|
---|
716 | } else $this->SystemMessage('Aktualizace serveru', 'Nemáte oprávnění');
|
---|
717 | } else $Output .= USER_BAD_ROLE;
|
---|
718 | } else
|
---|
719 | if($_GET['Action'] == 'NewsAdd')
|
---|
720 | {
|
---|
721 | if($this->System->Modules['User']->User['Role'] >= USER_ROLE_ADMINISTRATOR)
|
---|
722 | {
|
---|
723 | $Form = new Form('News');
|
---|
724 | $Form->OnSubmit = '?Action=NewsAdd2';
|
---|
725 | $Output = $Form->ShowEditForm();
|
---|
726 | } else $Output .= USER_BAD_ROLE;
|
---|
727 | } else
|
---|
728 | if($_GET['Action'] == 'NewsAdd2')
|
---|
729 | {
|
---|
730 | if($this->System->Modules['User']->User['Role'] >= USER_ROLE_ADMINISTRATOR)
|
---|
731 | {
|
---|
732 | $Form = new Form('News');
|
---|
733 | $Form->LoadValuesFromForm();
|
---|
734 | $Form->Values['Time'] = 'NOW()';
|
---|
735 | $Form->Values['User'] = $this->System->Modules['User']->User['Id'];
|
---|
736 | $Form->SaveValuesToDatabase(0);
|
---|
737 | $Output = $this->SystemMessage('Nová aktualita', 'Přidáno');
|
---|
738 | } else $Output .= USER_BAD_ROLE;
|
---|
739 | } else
|
---|
740 | if($_GET['Action'] == 'State')
|
---|
741 | {
|
---|
742 | $Platform = new Platform($this->Database);
|
---|
743 | $State = $Platform->State();
|
---|
744 | $Output = '<h4>Stav systému</h4>'.
|
---|
745 | '<table class="WideTable">'.
|
---|
746 | '<tr><th>Veličina</th><th>Hodnota</th></tr>'.
|
---|
747 | '<tr><td>Doba běhu serveru</td><td>'.$this->System->AddPrefixMultipliers($State['Uptime'], '', 4, 'Time').'</td></tr>'.
|
---|
748 | '<tr><td>Použitá/celková paměť</td><td>'.$this->System->AddPrefixMultipliers($State['MemoryUsed'], 'B', 4, 'Binary').' / '.$this->System->AddPrefixMultipliers($State['MemoryTotal'], 'B', 4, 'Binary').'</td></tr>'.
|
---|
749 | '<tr><td>Počet serverů aktivních/všech/maxiální</td><td>'.$State['ServerOnlineCount'].' / '.$State['ServerCount'].' / '.$State['ServerMaxCount'].'</td></tr>'.
|
---|
750 | '<tr><td>Počet emulátorů</td><td>'.$State['EmulatorCount'].'</td></tr>'.
|
---|
751 | '<tr><td>Počet uživatelů</td><td>'.$State['UserCount'].'</td></tr>'.
|
---|
752 | '<tr><td>Počet záloh</td><td>'.$State['BackupCount'].'</td></tr>'.
|
---|
753 | '<tr><td>Čekajících/všech úloh ve frontě</td><td>'.$State['TaskQueued'].' / '.$State['TaskCount'].'</td></tr>'.
|
---|
754 | '</table>';
|
---|
755 | } else
|
---|
756 | if($_GET['Action'] == 'ServerList')
|
---|
757 | {
|
---|
758 | $Output .= $this->ShowServerList();
|
---|
759 | } else
|
---|
760 | if($_GET['Action'] == 'Test')
|
---|
761 | {
|
---|
762 | //$Emulator = new Emulator($this->Database, 2);
|
---|
763 | // $Emulator->Compile();
|
---|
764 | //$Server = new Server($this->Database, 1);
|
---|
765 | //$Output .= $Server->ImportDatabase();
|
---|
766 | //$Config = new MangosConfigurationFile($this->Database);
|
---|
767 | //$Config->Load('../emu/mangos/7681/etc/mangosd.conf');
|
---|
768 | //$Config->Save('../server/1/etc/mangosd.conf');
|
---|
769 | } else
|
---|
770 | {
|
---|
771 | $Output .= $this->ShowWelcome();
|
---|
772 | }
|
---|
773 | } else
|
---|
774 | {
|
---|
775 | $Output .= $this->ShowWelcome();
|
---|
776 | }
|
---|
777 | $Content = $Output;
|
---|
778 | $Output = '<table class="BasicTable"><tr>';
|
---|
779 | if($this->System->Modules['User']->User['Id'] != $this->System->Modules['User']->AnonymousUserId)
|
---|
780 | $Output .= '<td class="UserMenu">'.$this->UserMenu().'</td>';
|
---|
781 | $Output .= '<td class="Content">'.$Content.'</td>';
|
---|
782 | if(!array_key_exists('Action', $_GET))
|
---|
783 | {
|
---|
784 | $Output .= '<td class="News"><strong>Aktuálně:</strong><br />';
|
---|
785 | $DbResult = $this->Database->query('SELECT * FROM News');
|
---|
786 | while($DbRow = $DbResult->fetch_assoc())
|
---|
787 | {
|
---|
788 | $Output .= '<div><strong>'.$DbRow['Title'].'</strong>('.HumanDate($DbRow['Time']).')<br />'.$DbRow['Content'].'</div>';
|
---|
789 | }
|
---|
790 | $Output .= '</td>';
|
---|
791 | }
|
---|
792 | $Output .= '</tr></table>';
|
---|
793 | return($Output);
|
---|
794 | }
|
---|
795 | }
|
---|
796 |
|
---|
797 | $System->AddModule(new Index());
|
---|
798 | $System->Modules['Index']->GetOutput();
|
---|
799 |
|
---|
800 | ?>
|
---|