| 1 | <?php
|
|---|
| 2 |
|
|---|
| 3 | include_once(dirname(__FILE__).'/../../Base/View.php');
|
|---|
| 4 |
|
|---|
| 5 | class ServerView extends View
|
|---|
| 6 | {
|
|---|
| 7 | var $ItemFormClass = array(
|
|---|
| 8 | 'Title' => 'Nastavení',
|
|---|
| 9 | 'Table' => 'Server',
|
|---|
| 10 | 'SubmitText' => 'Uložit',
|
|---|
| 11 | 'Items' => array(
|
|---|
| 12 | 'Name' => array('Type' => 'String', 'Caption' => 'Název', 'Default' => 'WoW server'),
|
|---|
| 13 | 'Description' => array('Type' => 'Text', 'Caption' => 'Popis', 'Default' => ''),
|
|---|
| 14 | 'Homepage' => array('Type' => 'Hyperlink', 'Caption' => 'Webové stránky', 'Default' => ''),
|
|---|
| 15 | 'Database' => array('Type' => 'Database', 'Caption' => 'Databáze', 'Default' => 0),
|
|---|
| 16 | 'ServerId' => array('Type' => 'Hidden', 'Caption' => 'Id', 'Default' => 0),
|
|---|
| 17 | 'TimeCreate' => array('Type' => 'DateTime', 'Caption' => 'Datum založení', 'Default' => 'NOW()'),
|
|---|
| 18 | 'NetworkPortRealmd' => array('Type' => 'Integer', 'Caption' => 'Port realmd', 'Default' => ''),
|
|---|
| 19 | ),
|
|---|
| 20 | );
|
|---|
| 21 | var $ItemListFormClass = array(
|
|---|
| 22 | 'Title' => 'Server',
|
|---|
| 23 | 'Table' => '(SELECT `Client`.`Version`, `Server`.`Name`, `Server`.`Homepage`, `Server`.`Id`, `Server`.`NetworkPortRealmd`, `User`.`Name` AS `UserName`, Server.Online, Server.CharacterOnlineCount, Server.CharacterCount, Server.AccountCount FROM `Server` JOIN `User` ON `User`.`Id` = `Server`.`User` JOIN `Database` ON `Database`.`Id` = `Server`.`Database` JOIN `Emulator` ON `Emulator`.`Id` = `Database`.`Emulator` JOIN `Client` ON `Client`.`Id` = `Emulator`.`Client`)',
|
|---|
| 24 | 'Items' => array(
|
|---|
| 25 | 'Name' => array('Type' => 'String', 'Caption' => 'Název', 'Default' => ''),
|
|---|
| 26 | 'NetworkPortRealmd' => array('Type' => 'Integer', 'Caption' => 'Realmlist', 'Default' => ''),
|
|---|
| 27 | 'Version' => array('Type' => 'Integer', 'Caption' => 'Verze', 'Default' => 0),
|
|---|
| 28 | 'Online' => array('Type' => 'OnlineState', 'Caption' => 'Stav', 'Default' => 0),
|
|---|
| 29 | 'CharacterOnlineCount' => array('Type' => 'Integer', 'Caption' => 'Hráčů online', 'Default' => 0),
|
|---|
| 30 | 'AccountCount' => array('Type' => 'Integer', 'Caption' => 'Účtů', 'Default' => 0),
|
|---|
| 31 | 'CharacterCount' => array('Type' => 'Integer', 'Caption' => 'Postav', 0),
|
|---|
| 32 | 'UserName' => array('Type' => 'String', 'Caption' => 'Správce', 'Default' => ''),
|
|---|
| 33 | ),
|
|---|
| 34 | );
|
|---|
| 35 | var $CreateFormClass = array(
|
|---|
| 36 | 'Title' => 'Nový server',
|
|---|
| 37 | 'Table' => 'Server',
|
|---|
| 38 | 'SubmitText' => 'Registrovat',
|
|---|
| 39 | 'Items' => array(
|
|---|
| 40 | 'Name' => array('Type' => 'String', 'Caption' => 'Název', 'Default' => 'WoW server'),
|
|---|
| 41 | 'Description' => array('Type' => 'Text', 'Caption' => 'Popis', 'Default' => ''),
|
|---|
| 42 | 'Homepage' => array('Type' => 'Hyperlink', 'Caption' => 'Webové stránky', 'Default' => ''),
|
|---|
| 43 | //'Type' => array('Type' => 'ServerType', 'Caption' => 'Typ', 'Default' => 0),
|
|---|
| 44 | 'Database' => array('Type' => 'Database', 'Caption' => 'Databáze', 'Default' => 0),
|
|---|
| 45 | //'Motd' => array('Type' => 'String', 'Caption' => 'Zpráva dne', 'Default' => 'Vítejte na free WoW serveru'),
|
|---|
| 46 | ),
|
|---|
| 47 | );
|
|---|
| 48 | var $EditFormClass = array(
|
|---|
| 49 | 'Title' => 'Nastavení',
|
|---|
| 50 | 'Table' => 'Server',
|
|---|
| 51 | 'SubmitText' => 'Uložit',
|
|---|
| 52 | 'Items' => array(
|
|---|
| 53 | 'Name' => array('Type' => 'String', 'Caption' => 'Název', 'Default' => 'WoW server'),
|
|---|
| 54 | 'Description' => array('Type' => 'Text', 'Caption' => 'Popis', 'Default' => ''),
|
|---|
| 55 | 'Homepage' => array('Type' => 'Hyperlink', 'Caption' => 'Webové stránky', 'Default' => ''),
|
|---|
| 56 | //'Type' => array('Type' => 'ServerType', 'Caption' => 'Typ', 'Default' => 0),
|
|---|
| 57 | 'Database' => array('Type' => 'Database', 'Caption' => 'Databáze', 'Default' => 0),
|
|---|
| 58 | //'Motd' => array('Type' => 'String', 'Caption' => 'Zpráva dne', 'Default' => 'Vítejte na free WoW serveru'),
|
|---|
| 59 | 'ServerId' => array('Type' => 'Hidden', 'Caption' => 'Id', 'Default' => 0),
|
|---|
| 60 | //'TimeCreation' => array('Type' => 'DateTime', 'Caption' => 'Datum založení', 'Default' => 'NOW()'),
|
|---|
| 61 | ),
|
|---|
| 62 | );
|
|---|
| 63 | var $GameAccountNewFormClass = array(
|
|---|
| 64 | 'Title' => 'Vytvoření nového herního účtu',
|
|---|
| 65 | 'Table' => '',
|
|---|
| 66 | 'Items' => array(
|
|---|
| 67 | 'Name' => array('Type' => 'String', 'Caption' => 'Přihlašovací jméno', 'Default' => ''),
|
|---|
| 68 | 'Password' => array('Type' => 'Password', 'Caption' => 'Heslo', 'Default' => ''),
|
|---|
| 69 | 'Password2' => array('Type' => 'Password', 'Caption' => 'Potvrzení hesla', 'Default' => ''),
|
|---|
| 70 | 'Email' => array('Type' => 'String', 'Caption' => 'E-mail', 'Default' => ''),
|
|---|
| 71 | 'Expansion' => array('Type' => 'ServerExpansion', 'Caption' => 'Rozšíření', 'Default' => 2),
|
|---|
| 72 | 'ServerId' => array('Type' => 'Hidden', 'Caption' => 'Id', 'Default' => 0),
|
|---|
| 73 | ),
|
|---|
| 74 | );
|
|---|
| 75 |
|
|---|
| 76 | function ShowListOnRow($Row)
|
|---|
| 77 | {
|
|---|
| 78 | $Row['NetworkPortRealmd'] = '<a href="?Module=Server&Action=RealmList&Id='.$Row['Id'].'">'.$Row['NetworkPortRealmd'].'</a>';
|
|---|
| 79 | if($Row['Homepage'] != '') $Row['Name'] = '<a href="'.$Row['Homepage'].'">'.$Row['Name'].'</a>';
|
|---|
| 80 | unset($Row['Homepage']);
|
|---|
| 81 | return($Row);
|
|---|
| 82 | }
|
|---|
| 83 |
|
|---|
| 84 | function ItemList()
|
|---|
| 85 | {
|
|---|
| 86 | $Output = '<h4>Seznam serverů</h4>';
|
|---|
| 87 | $Table = new Table($this->ItemListFormClass, $this->System);
|
|---|
| 88 | if(array_key_exists('Filter', $_GET))
|
|---|
| 89 | {
|
|---|
| 90 | if($_GET['Filter'] == 'User')
|
|---|
| 91 | $Table->Definition['Table'] = substr($Table->Definition['Table'], 0, -1).' WHERE User='.$this->System->Modules['User']->Data['Id'].')';
|
|---|
| 92 | }
|
|---|
| 93 | $Table->OnRow = array($this, 'ShowListOnRow');
|
|---|
| 94 | $Table->Definition['Items']['Id'] = array('Type' => 'Hidden', 'Caption' => '', 'Default' => '');
|
|---|
| 95 | $Table->LoadValuesFromDatabase($this->Database);
|
|---|
| 96 | $Table->Definition['Items']['Actions'] = array('Type' => 'String', 'Caption' => '', 'Default' => '');
|
|---|
| 97 | foreach($Table->Values as $Index => $Item)
|
|---|
| 98 | {
|
|---|
| 99 | $Table->Values[$Index]['Actions'] = '<a href="?Module=Server&Action=Show&Id='.$Item['Id'].'">Podrobnosti</a>';
|
|---|
| 100 | unset($Table->Values[$Index]['Id']);
|
|---|
| 101 | }
|
|---|
| 102 | $Output .= $Table->Show();
|
|---|
| 103 | if($this->System->Modules['Permission']->Check('Server', 'Add'))
|
|---|
| 104 | {
|
|---|
| 105 | $DbResult = $this->Database->query('SELECT COUNT(*) FROM Server');
|
|---|
| 106 | $DbRow = $DbResult->fetch_row();
|
|---|
| 107 | $ServerCount = $DbRow[0];
|
|---|
| 108 | $DbResult = $this->Database->query('SELECT COUNT(*) FROM Server WHERE User='.$this->System->Modules['User']->Data['Id']);
|
|---|
| 109 | $DbRow = $DbResult->fetch_row();
|
|---|
| 110 | if(($ServerCount < $this->Config['MaxServerCount']) and ($DbRow[0] < $this->Config['MaxServerCountPerUser']))
|
|---|
| 111 | $Output .= '<br /><div style="text-align: center;"><a href="?Module=Server&Action=Add">Vytvořit nový server</a></div>';
|
|---|
| 112 | }
|
|---|
| 113 | return($Output);
|
|---|
| 114 | }
|
|---|
| 115 |
|
|---|
| 116 | function Item()
|
|---|
| 117 | {
|
|---|
| 118 | $Id = $_GET['Id'];
|
|---|
| 119 | $Server = new Server($this->System, $Id);
|
|---|
| 120 | if(isset($Server->Server))
|
|---|
| 121 | {
|
|---|
| 122 | $Output = '<h4>Podrobnosti serveru</h4>';
|
|---|
| 123 | $Form = new Form($this->System, $this->ItemFormClass);
|
|---|
| 124 | $Form->LoadValuesFromDatabase($Id);
|
|---|
| 125 | $Form->Definition['Items']['Realmlist'] = array('Type' => 'String', 'Caption' => 'Adresa k připojení', 'Default' => '');
|
|---|
| 126 | $Form->Definition['Items']['Uptime'] = array('Type' => 'String', 'Caption' => 'Doba běhu', 'Default' => '');
|
|---|
| 127 | $Form->Definition['Items']['UsedMemory'] = array('Type' => 'String', 'Caption' => 'Použitá paměť', 'Default' => '');
|
|---|
| 128 | $Form->Definition['Items']['AccountCount'] = array('Type' => 'String', 'Caption' => 'Počet účtů', 'Default' => '');
|
|---|
| 129 | $ServerStatus = $Server->GetState();
|
|---|
| 130 | $Form->Values['Realmlist'] = $this->Config['Web']['Host'].':'.$Form->Values['NetworkPortRealmd'];
|
|---|
| 131 | unset($Form->Definition['Items']['NetworkPortRealmd']);
|
|---|
| 132 | $Form->Values['Uptime'] = $this->System->AddPrefixMultipliers($ServerStatus['Uptime'], '', 4, 'Time');
|
|---|
| 133 | $Form->Values['UsedMemory'] = $this->System->AddPrefixMultipliers($ServerStatus['UsedMemory'] * 1024, 'B', 4, 'Binary');
|
|---|
| 134 | $Form->Values['AccountCount'] = $ServerStatus['AccountCount'];
|
|---|
| 135 | $Output .= $Form->ShowTable();
|
|---|
| 136 | $Output .= '<div style="text-align: center">';
|
|---|
| 137 | if($this->System->Modules['Permission']->Check('Server', 'Edit'))
|
|---|
| 138 | {
|
|---|
| 139 | $Output .= '<br /><a href="http://'.$this->System->Config['Web']['Host'].'/mysql/">Správa databáze</a> ';
|
|---|
| 140 | if(array_key_exists('Id', $Server->Server['Database']) and ($Server->Server['Lock'] == 0))
|
|---|
| 141 | {
|
|---|
| 142 | if($ServerStatus['RealmdPortState'] == true) $Output .= ' <a href="?Module=Server&Action=Stop&Id='.$Server->Id.'">Zastavit</a> <a href="?Module=Server&Action=Restart&Id='.$Server->Id.'">Restartovat</a>';
|
|---|
| 143 | else $Output .= ' <a href="?Module=Server&Action=Start&Id='.$Server->Id.'">Spustit</a>';
|
|---|
| 144 | }
|
|---|
| 145 | if($Server->Server['Lock'] == 0)
|
|---|
| 146 | {
|
|---|
| 147 | $Output .= ' <a href="?Module=Server&Action=Edit&Id='.$Server->Id.'">Upravit základní nastavení</a>';
|
|---|
| 148 | }
|
|---|
| 149 | //$Output .= ' <a href="?Action=ServerDatabaseImport&Id='.$Server->Id.'">Načtení čisté databáze</a>';
|
|---|
| 150 | $Output .= ' <a href="?Module=Realm&Action=Add&Id='.$Server->Id.'">Vytvořit nový svět</a>';
|
|---|
| 151 | $Output .= ' <a href="?Module=Realm&Action=UpdateCharacters&Id='.$Server->Id.'">Aktualizovat počty postav</a>';
|
|---|
| 152 | }
|
|---|
| 153 | $Output .= ' <a href="?Module=Server&Action=GameAccountRegister&Id='.$Server->Id.'">Vytvoření herního účtu</a>';
|
|---|
| 154 | $Output .= '</div>';
|
|---|
| 155 |
|
|---|
| 156 | // Show realmlist
|
|---|
| 157 | $RealmView = new RealmView($this->System);
|
|---|
| 158 | $Output .= $RealmView->ItemList();
|
|---|
| 159 | } else $Output = $this->System->SystemMessage('Zobrazení serveru', 'Server se zadaným id nenalezen.');
|
|---|
| 160 | return($Output);
|
|---|
| 161 | }
|
|---|
| 162 |
|
|---|
| 163 | function Add()
|
|---|
| 164 | {
|
|---|
| 165 | $Output = '';
|
|---|
| 166 | if($this->System->Modules['Permission']->Check('Server', 'Add'))
|
|---|
| 167 | {
|
|---|
| 168 | $DbResult = $this->Database->query('SELECT COUNT(*) FROM Server');
|
|---|
| 169 | $DbRow = $DbResult->fetch_row();
|
|---|
| 170 | $ServerCount = $DbRow[0];
|
|---|
| 171 | if($ServerCount < $this->Config['MaxServerCount'])
|
|---|
| 172 | {
|
|---|
| 173 | $DbResult = $this->Database->query('SELECT COUNT(*) FROM Server WHERE User='.$this->System->Modules['User']->Data['Id']);
|
|---|
| 174 | $DbRow = $DbResult->fetch_row();
|
|---|
| 175 | if($DbRow[0] >= $this->Config['MaxServerCountPerUser'])
|
|---|
| 176 | $Output .= $this->System->SystemMessage('Nový server', 'Na jeden účet lze vytvořit maximálně '.
|
|---|
| 177 | $this->Config['MaxServerCountPerUser'].' serverů');
|
|---|
| 178 | else
|
|---|
| 179 | {
|
|---|
| 180 | $Form = new Form($this->System, $this->CreateFormClass);
|
|---|
| 181 | $Form->LoadValuesFromForm();
|
|---|
| 182 | $Form->OnSubmit = '?Action=ServerCreate';
|
|---|
| 183 | $Output .= 'Tento formulář vám umožní si vytvořit nový server. Pečlivě vyplňte požadované údaje.';
|
|---|
| 184 | $Output .= $Form->ShowEditForm();
|
|---|
| 185 | }
|
|---|
| 186 | } else $Output .= $this->System->SystemMessage('Nový server', 'Nelze vytvářet další servery');
|
|---|
| 187 | } else $Output = $this->System->SystemMessage('Vytvoření serveru', 'Nemáte oprávnění');
|
|---|
| 188 | return($Output);
|
|---|
| 189 | }
|
|---|
| 190 |
|
|---|
| 191 | function Create()
|
|---|
| 192 | {
|
|---|
| 193 | $Output = '';
|
|---|
| 194 | if($this->System->Modules['Permission']->Check('Server', 'Add'))
|
|---|
| 195 | {
|
|---|
| 196 | $DbResult = $this->Database->query('SELECT COUNT(*) FROM Server WHERE User='.$this->System->Modules['User']->Data['Id']);
|
|---|
| 197 | $DbRow = $DbResult->fetch_row();
|
|---|
| 198 | if($DbRow[0] >= $this->Config['MaxServerCountPerUser'])
|
|---|
| 199 | $Output .= $this->System->SystemMessage('Nový server', 'Na jeden účet lze vytvořit maximálně '.
|
|---|
| 200 | $this->Config['MaxServerCountPerUser'].' serverů');
|
|---|
| 201 | else
|
|---|
| 202 | {
|
|---|
| 203 | $DbResult = $this->Database->query('SELECT MAX(NetworkPortRealmd) FROM Server');
|
|---|
| 204 | $DbRow = $DbResult->fetch_row();
|
|---|
| 205 | $NewPortRealmd = $DbRow[0] + 1;
|
|---|
| 206 | if($NewPortRealmd < $this->Config['BaseNetworkPortRealmd']) $NewPortRealmd = $this->Config['BaseNetworkPortRealmd'];
|
|---|
| 207 |
|
|---|
| 208 | $Form = new Form($this->System, $this->CreateFormClass, array());
|
|---|
| 209 | $Form->LoadValuesFromForm();
|
|---|
| 210 | $this->Database->insert('Server', array('Name' => $Form->Values['Name'], 'Description' => $Form->Values['Description'], 'User' => $this->System->Modules['User']->Data['Id'], 'Homepage' => $Form->Values['Homepage'], 'Database' => $Form->Values['Database'], 'NetworkPortRealmd' => $NewPortRealmd, 'Lock' => 1, 'TimeCreate' => 'NOW()'));
|
|---|
| 211 | $LastInsertId = $this->Database->insert_id;
|
|---|
| 212 | $Server = new Server($this->System, $LastInsertId);
|
|---|
| 213 | $Server->CreateDatabase();
|
|---|
| 214 | $Output .= $this->System->SystemMessage('Vytvoření serveru', $Server->ImportDatabase(true));
|
|---|
| 215 | $TaskView = new TaskView($this->System);
|
|---|
| 216 | $Output .= $TaskView->ItemList();
|
|---|
| 217 | //$UserOptions->LoadValuesFromDatabase($this->System->Modules['User']->User['Id']);
|
|---|
| 218 | //$Form->OnSubmit = '?Action=ServerCreate';
|
|---|
| 219 | //$Output .= $Form->ShowEditForm();
|
|---|
| 220 | }
|
|---|
| 221 | } else $Output = $this->System->SystemMessage('Vytvoření serveru', 'Nemáte oprávnění');
|
|---|
| 222 | return($Output);
|
|---|
| 223 | }
|
|---|
| 224 |
|
|---|
| 225 | function Save()
|
|---|
| 226 | {
|
|---|
| 227 | $Output = '';
|
|---|
| 228 | $Server = new Server($this->System, $_POST['ServerId']);
|
|---|
| 229 | if(($this->System->Modules['User']->Data['Id'] == $Server->Server['User']) or
|
|---|
| 230 | ($this->System->Modules['Permission']->Check('Server', 'Modify')))
|
|---|
| 231 | {
|
|---|
| 232 | $Form = new Form($this->System, $this->EditFormClass, array());
|
|---|
| 233 | $Form->LoadValuesFromForm();
|
|---|
| 234 | $ServerId = $_POST['ServerId'];
|
|---|
| 235 | unset($Form->Values['ServerId']);
|
|---|
| 236 | $Output .= $this->System->SystemMessage('Upravit server', 'Nastavení serveru uloženo.');
|
|---|
| 237 | $Form->SaveValuesToDatabase($_POST['ServerId']);
|
|---|
| 238 | $Form->OnSubmit = '?Action=ServerSave';
|
|---|
| 239 |
|
|---|
| 240 | $Server = new Server($this->System, $_POST['ServerId']);
|
|---|
| 241 | $Server->SaveConfiguration();
|
|---|
| 242 | $Form->Values['ServerId'] = $ServerId;
|
|---|
| 243 | $Output .= $Form->ShowEditForm();
|
|---|
| 244 | } else $Output = $this->System->SystemMessage('Nastavení serveru', 'Nemáte oprávnění');
|
|---|
| 245 | return($Output);
|
|---|
| 246 | }
|
|---|
| 247 |
|
|---|
| 248 | function Edit()
|
|---|
| 249 | {
|
|---|
| 250 | $Output = '';
|
|---|
| 251 | $Server = new Server($this->System, $_GET['Id']);
|
|---|
| 252 | if(($this->System->Modules['User']->Data['Id'] == $Server->Server['User']) or
|
|---|
| 253 | ($this->System->Modules['Permission']->Check('Server', 'Modify')))
|
|---|
| 254 | {
|
|---|
| 255 | $Form = new Form($this->System, $this->EditFormClass);
|
|---|
| 256 | $Form->LoadValuesFromDatabase($_GET['Id']);
|
|---|
| 257 | $Form->Values['ServerId'] = $_GET['Id'];
|
|---|
| 258 | $Form->OnSubmit = '?Module=Server&Action=Save';
|
|---|
| 259 | $Output .= $Form->ShowEditForm();
|
|---|
| 260 | } else $Output = $this->System->SystemMessage('Nastavení serveru', 'Nemáte oprávnění');
|
|---|
| 261 | return($Output);
|
|---|
| 262 | }
|
|---|
| 263 |
|
|---|
| 264 | function Start()
|
|---|
| 265 | {
|
|---|
| 266 | $Output = '';
|
|---|
| 267 | if($this->System->Modules['Permission']->Check('Server', 'OwnerControl'))
|
|---|
| 268 | {
|
|---|
| 269 | $Server = new Server($this->System, $_GET['Id']);
|
|---|
| 270 | if(($this->System->Modules['User']->User['Id'] == $Server->Server['User']) or
|
|---|
| 271 | ($this->System->Modules['Permission']->Check('Server', 'Control')))
|
|---|
| 272 | {
|
|---|
| 273 | $Output .= $this->System->SystemMessage('Spuštění serveru', $Server->Start());
|
|---|
| 274 | $TaskView = new TaskView($this->System);
|
|---|
| 275 | $Output .= $TaskView->ItemList();;
|
|---|
| 276 | } else $this->System->SystemMessage('Spuštění serveru', 'Nemáte oprávnění');
|
|---|
| 277 | } else $this->System->SystemMessage('Spuštění serveru', 'Nemáte oprávnění');
|
|---|
| 278 | return($Output);
|
|---|
| 279 | }
|
|---|
| 280 |
|
|---|
| 281 | function Stop()
|
|---|
| 282 | {
|
|---|
| 283 | $Output = '';
|
|---|
| 284 | if($this->System->Modules['Permission']->Check('Server', 'OwnerControl'))
|
|---|
| 285 | {
|
|---|
| 286 | $Server = new Server($this->System, $_GET['Id']);
|
|---|
| 287 | if(($this->System->Modules['User']->Data['Id'] == $Server->Server['User']) or
|
|---|
| 288 | ($this->System->Modules['Permission']->Check('Server', 'Control')))
|
|---|
| 289 | {
|
|---|
| 290 | $Output .= $this->System->SystemMessage('Zastavení serveru', $Server->Stop());
|
|---|
| 291 | $TaskView = new TaskView($this->System);
|
|---|
| 292 | $Output .= $TaskView->ItemList();;
|
|---|
| 293 | } else $this->System->SystemMessage('Zastavení serveru', 'Nemáte oprávnění');
|
|---|
| 294 | } else $this->System->SystemMessage('Zastavení serveru', 'Nemáte oprávnění');
|
|---|
| 295 | return($Output);
|
|---|
| 296 | }
|
|---|
| 297 |
|
|---|
| 298 | function AccountCreate()
|
|---|
| 299 | {
|
|---|
| 300 | $Form = new Form($this->System, $this->GameAccountNewFormClass);
|
|---|
| 301 | $Form->LoadValuesFromForm();
|
|---|
| 302 | $Form->Values['ServerId'] = $_GET['Id'];
|
|---|
| 303 | $Form->OnSubmit = '?Module=Server&Action=GameAccountRegisterFinish';
|
|---|
| 304 | $Output = $Form->ShowEditForm();
|
|---|
| 305 | return($Output);
|
|---|
| 306 | }
|
|---|
| 307 |
|
|---|
| 308 | function AccountCreateFinish()
|
|---|
| 309 | {
|
|---|
| 310 | $Form = new Form($this->System, $this->GameAccountNewFormClass);
|
|---|
| 311 | $Form->LoadValuesFromForm();
|
|---|
| 312 | $Server = new Server($this->System, $Form->Values['ServerId']);
|
|---|
| 313 | $Output = $this->System->SystemMessage('Vytvoření herního účtu', $Server->NewAccount($Form->Values['Name'], $Form->Values['Password'], $Form->Values['Password2'], $Form->Values['Email'], $Form->Values['Expansion']));
|
|---|
| 314 | $Output .= '<a href="?Module=Server&Action=GameAccountRegister&Id='.$Form->Values['ServerId'].'">Zpět k zadání údajů</a>';
|
|---|
| 315 | return($Output);
|
|---|
| 316 | }
|
|---|
| 317 |
|
|---|
| 318 | function RealmListFile()
|
|---|
| 319 | {
|
|---|
| 320 | if(array_key_exists('Id', $_GET))
|
|---|
| 321 | {
|
|---|
| 322 | Header('Content-Type: text/plain');
|
|---|
| 323 | Header('Content-Disposition: attachment; filename="realmlist.wtf"');
|
|---|
| 324 | $Server = new Server($this->System, $_GET['Id']);
|
|---|
| 325 | $Output = array(
|
|---|
| 326 | 'set realmlist '.$this->Config['Web']['Host'].':'.$Server->Server['NetworkPortRealmd'],
|
|---|
| 327 | 'set patchlist '.$this->Config['Web']['Host'].':'.$Server->Server['NetworkPortRealmd'],
|
|---|
| 328 | 'set portal eu',
|
|---|
| 329 | );
|
|---|
| 330 | echo(implode("\n", $Output));
|
|---|
| 331 | } else echo('Musíte zadat Id serveru');
|
|---|
| 332 | }
|
|---|
| 333 |
|
|---|
| 334 | function PatchList()
|
|---|
| 335 | {
|
|---|
| 336 | Header('Content-type: text/plain');
|
|---|
| 337 | if(array_key_exists('Id', $_GET))
|
|---|
| 338 | {
|
|---|
| 339 | $Server = new Server($this->System, $_GET['Id'] * 1);
|
|---|
| 340 | echo($Server->GetPatchList());
|
|---|
| 341 | } else echo('Zadané id serveru nenalezeno.');
|
|---|
| 342 | }
|
|---|
| 343 |
|
|---|
| 344 | function XMLExport()
|
|---|
| 345 | {
|
|---|
| 346 | Header('Content-Type: application/xml');
|
|---|
| 347 |
|
|---|
| 348 | $Output = '<?xml version="1.0" encoding="utf-8"?>';
|
|---|
| 349 | if(array_key_exists('File', $_GET))
|
|---|
| 350 | {
|
|---|
| 351 | Header('Content-Disposition: filename="'.$_GET['File'].'.xml"');
|
|---|
| 352 | if($_GET['File'] == 'ServerList')
|
|---|
| 353 | {
|
|---|
| 354 | $Output .= '<serverlist version="1.0">';
|
|---|
| 355 | $DbResult = $this->Database->query('SELECT * FROM Server');
|
|---|
| 356 | while($Server = $DbResult->fetch_assoc())
|
|---|
| 357 | {
|
|---|
| 358 | $Output .= '<server>'.
|
|---|
| 359 | '<name>'.$Server['Name'].'</name>'.
|
|---|
| 360 | //'<playermaxcount>'.$Server['PlayerMaxCount'].'</playermaxcount>'.
|
|---|
| 361 | //'<playeronlinecount>'.$Server['PlayerOnlineCount'].'</playeronlinecount>'.
|
|---|
| 362 | '<homepage>'.$Server['Homepage'].'</homepage>'.
|
|---|
| 363 | '</server>';
|
|---|
| 364 | }
|
|---|
| 365 | $Output .= '</serverlist>';
|
|---|
| 366 | }
|
|---|
| 367 | } else $Output .= '<document/>';
|
|---|
| 368 | $Html = new Html();
|
|---|
| 369 | if($this->Config['Web']['FormatHTML'] == true) echo($Html->FormatOutput($Output));
|
|---|
| 370 | else echo($Output);
|
|---|
| 371 | }
|
|---|
| 372 | }
|
|---|