Changeset 71
- Timestamp:
- Aug 23, 2009, 6:14:01 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Readme.txt
r54 r71 15 15 16 16 17 2) Konfigurační soubory17 2) Soubory nastavení 18 18 19 Zkopírovat soubor www/ config.sample.php na www/config.phpa vyplnit údaje.19 Zkopírovat soubor www/Application/Config/ConfigSample.php na Config.php ve stejné složce a vyplnit údaje. 20 20 Uživatelský účet pro přístup do databáze MySQL musí mít plný přístup, aby mohl vytvářet databáze pro servery. 21 21 -
trunk/www/Application/Config
-
Property svn:ignore
set to
Config.php
-
Property svn:ignore
set to
-
trunk/www/Application/Controller/HomePage.php
r69 r71 8 8 $View = new HomePageView($this->System); 9 9 return($Page->GetOutput($View->Welcome())); 10 } 11 12 function Info() 13 { 14 $Page = new PageView($this->System); 15 $View = new HomePageView($this->System); 16 return($Page->GetOutput($View->Info())); 17 } 18 19 function State() 20 { 21 $Page = new PageView($this->System); 22 $View = new HomePageView($this->System); 23 return($Page->GetOutput($View->State())); 10 24 } 11 25 … … 23 37 if(array_key_exists('Action', $_GET)) 24 38 { 25 if($_GET['Action'] == 'LoginForm')26 {27 $UserView = new UserView($this->Database, $this->System);28 $Output .= $UserView->LoginForm();29 } else30 if($_GET['Action'] == 'Login')31 {32 $UserView = new UserView($this->Database, $this->System);33 $Output .= $UserView->LoginResult();34 } else35 if($_GET['Action'] == 'Logout')36 {37 $UserView = new UserView($this->Database, $this->System);38 $Output .= $UserView->Logout();39 } else40 if($_GET['Action'] == 'UserOptions')41 {42 $UserView = new UserView($this->Database, $this->System);43 $Output .= $UserView->Options();44 } else45 if($_GET['Action'] == 'UserOptionsSave')46 {47 $UserView = new UserView($this->Database, $this->System);48 $Output .= $UserView->OptionsSave();49 } else50 if($_GET['Action'] == 'UserRegister')51 {52 $UserView = new UserView($this->Database, $this->System);53 $Output .= $UserView->Register();54 } else55 if($_GET['Action'] == 'UserRegisterConfirm')56 {57 $UserView = new UserView($this->Database, $this->System);58 $Output .= $UserView->RegisterConfirm();59 } else60 if($_GET['Action'] == 'PasswordRecovery')61 {62 $UserView = new UserView($this->Database, $this->System);63 $Output .= $UserView->PasswordRecovery();64 } else65 if($_GET['Action'] == 'PasswordRecoveryFinish')66 {67 $UserView = new UserView($this->Database, $this->System);68 $Output .= $UserView->PasswordRecoveryFinish();69 } else70 if($_GET['Action'] == 'PasswordRecoveryConfirm')71 {72 $UserView = new UserView($this->Database, $this->System);73 $Output .= $UserView->PasswordRecoveryConfirm();74 } else75 if($_GET['Action'] == 'UserRegisterSave')76 {77 $UserView = new UserView($this->Database, $this->System);78 $Output .= $UserView->RegisterSave();79 } else80 if($_GET['Action'] == 'ServerAdd')81 {82 $ServerView = new ServerView($this->Database, $this->System);83 $Output .= $ServerView->Add();84 } else85 if($_GET['Action'] == 'ServerCreate')86 {87 $ServerView = new ServerView($this->Database, $this->System);88 $Output .= $ServerView->Create();89 } else90 if($_GET['Action'] == 'ServerShow')91 {92 $ServerView = new ServerView($this->Database, $this->System);93 $Output .= $ServerView->Item();94 //if(array_key_exists('Id', $_GET)) $Output .= $this->ShowServer($_GET['Id']);95 //else $this->SystemMessage('Zobrazení serveru', 'Nebylo zadáno Id');96 } else97 if($_GET['Action'] == 'ServerEdit')98 {99 $ServerView = new ServerView($this->Database, $this->System);100 $Output .= $ServerView->Edit();101 } else102 if($_GET['Action'] == 'ServerSave')103 {104 $ServerView = new ServerView($this->Database, $this->System);105 $Output .= $ServerView->Save();106 } else107 if($_GET['Action'] == 'ServerStart')108 {109 $ServerView = new ServerView($this->Database, $this->System);110 $Output .= $ServerView->Start();111 } else112 if($_GET['Action'] == 'ServerStop')113 {114 $ServerView = new ServerView($this->Database, $this->System);115 $Output .= $ServerView->Stop();116 } else117 if($_GET['Action'] == 'ServerDatabaseImport')118 {119 $DatabaseView = new DatabaseView($this->Database, $this->System);120 $Output .= $DatabaseView->Import();121 } else122 39 if($_GET['Action'] == 'EmulatorShow') 123 40 { … … 175 92 $Output .= $UpdateView->ItemList(); 176 93 } else 177 if($_GET['Action'] == 'GameAccountRegister')178 {179 $ServerView = new ServerView($this->Database, $this->System);180 $Output .= $ServerView->AccountCreate();181 } else182 if($_GET['Action'] == 'GameAccountRegister2')183 {184 $ServerView = new ServerView($this->Database, $this->System);185 $Output .= $ServerView->AccountCreateFinish();186 } else187 if($_GET['Action'] == 'Info')188 {189 $BaseView = new BaseView($this->Database, $this->System);190 $Output .= $BaseView->Info();191 } else192 94 if($_GET['Action'] == 'BackupAdd') 193 95 { … … 244 146 $BaseView = new BaseView($this->Database, $this->System); 245 147 $Output .= $BaseView->State(); 246 } else247 if($_GET['Action'] == 'ServerList')248 {249 $ServerView = new ServerView($this->Database, $this->System);250 $Output .= $ServerView->ItemList();251 148 } else 252 149 if($_GET['Action'] == 'RealmList') -
trunk/www/Application/Controller/Include.php
r69 r71 4 4 include('Application/Controller/Realm.php'); 5 5 include('Application/Controller/Server.php'); 6 include('Application/Controller/User.php'); 6 7 7 8 ?> -
trunk/www/Application/Controller/Server.php
r69 r71 3 3 class ServerController extends Controller 4 4 { 5 function Add() 6 { 7 $Page = new PageView($this->System); 8 $View = new ServerView($this->System); 9 return($Page->GetOutput($View->Add())); 10 } 5 11 12 function Create() 13 { 14 $Page = new PageView($this->System); 15 $View = new ServerView($this->System); 16 return($Page->GetOutput($View->Create())); 17 } 18 19 function Show() 20 { 21 $Page = new PageView($this->System); 22 $View = new ServerView($this->System); 23 return($Page->GetOutput($View->Item())); 24 } 25 26 function Edit() 27 { 28 $Page = new PageView($this->System); 29 $View = new ServerView($this->System); 30 return($Page->GetOutput($View->Edit())); 31 } 32 33 function Save() 34 { 35 $Page = new PageView($this->System); 36 $View = new ServerView($this->System); 37 return($Page->GetOutput($View->Save())); 38 } 39 40 function Start() 41 { 42 $Page = new PageView($this->System); 43 $View = new ServerView($this->System); 44 return($Page->GetOutput($View->Start())); 45 } 46 47 function Stop() 48 { 49 $Page = new PageView($this->System); 50 $View = new ServerView($this->System); 51 return($Page->GetOutput($View->Stop())); 52 } 53 54 function DatabaseImport() 55 { 56 $Page = new PageView($this->System); 57 $View = new DatabaseView($this->System); 58 return($Page->GetOutput($View->Import())); 59 } 60 61 function ItemList() 62 { 63 $Page = new PageView($this->System); 64 $View = new ServerView($this->System); 65 return($Page->GetOutput($View->ItemList())); 66 } 67 68 function GameAccountRegister() 69 { 70 $Page = new PageView($this->System); 71 $View = new ServerView($this->System); 72 return($Page->GetOutput($View->AccountCreate())); 73 } 74 75 function GameAccountRegisterFinish() 76 { 77 $Page = new PageView($this->System); 78 $View = new ServerView($this->System); 79 return($Page->GetOutput($View->AccountCreateFinish())); 80 } 6 81 } 7 82 -
trunk/www/Application/Include.php
r69 r71 2 2 3 3 include('Application/CustomTypes.php'); 4 include('Application/Config/Config.php'); 4 if(file_exists('Application/Config/Config.php')) include('Application/Config/Config.php'); 5 else die('Nenalezen soubor Application/Config/Config.php. Vytvořte jej kopií ze souboru Application/Config/ConfigSample.php.'); 5 6 include('Application/Model/Include.php'); 6 7 include('Application/View/Include.php'); -
trunk/www/Application/Style/Style.css
r69 r71 69 69 } 70 70 71 #Footer71 .Footer 72 72 { 73 73 border-style: solid; … … 78 78 font-size: 10px; 79 79 text-align: center; 80 } 81 82 .Footer ul li 83 { 84 display: inline; 85 padding-left: 5px; 86 padding-right: 5px; 80 87 } 81 88 -
trunk/www/Application/View/Page.php
r69 r71 29 29 { 30 30 $Output = '<div class="Navigation"><span class="MenuItem">'. 31 '<a href="? Action=Info">Informace</a>'.32 ' <a href="?Module= System&Action=State">Stav systému</a>'.33 ' <a href="?Module=Server&Action= List">Seznam serverů</a>'.34 ' <a href="?Module=Client&Action= List">Verze klienta</a>'.35 ' <a href="?Module=Emulator&Action= List">Verze emulátoru</a>'.31 '<a href="?Module=HomePage&Action=Info">Informace</a>'. 32 ' <a href="?Module=HomePage&Action=State">Stav systému</a>'. 33 ' <a href="?Module=Server&Action=ItemList">Seznam serverů</a>'. 34 ' <a href="?Module=Client&Action=ItemList">Verze klienta</a>'. 35 ' <a href="?Module=Emulator&Action=ItemList">Verze emulátoru</a>'. 36 36 '</span><div class="MenuItem2">'; 37 37 if($this->System->Modules['User']->User['Id'] == $this->System->Modules['User']->AnonymousUserId) … … 40 40 if($this->Config['Web']['UserRegistrationEnabled']) $Output .= ' <a href="'.$this->System->Config['Web']['RootFolder'].'/?Module=User&Action=Register">Registrace</a>'; 41 41 } else $Output .= $this->System->Modules['User']->User['Name'].' <a href="'.$this->Config['Web']['RootFolder'].'/?Module=User&Action=Logout">Odhlásit</a>'. 42 ' <a href="'.$this->Config['Web']['RootFolder'].'/?Module=User r&Action=Options">Nastavení</a>';42 ' <a href="'.$this->Config['Web']['RootFolder'].'/?Module=User&Action=Options">Nastavení</a>'; 43 43 $Output .= '</div></div>'; 44 44 return($Output); … … 50 50 51 51 $Time = round($this->System->GetMicrotime() - $ScriptTimeStart, 2); 52 $Output = '<div id="Footer">53 < i>| Založeno na projektu <a href="http://svn.zdechov.net/trac/wowhosting/">WoW hosting</a>'.54 ' | <a href="http://svn.zdechov.net/trac/wowhosting/browser">Zdrojové kódy</a>'.55 ' | <a href="http://svn.zdechov.net/trac/wowhosting/log?verbose=on">Novinky</a>'.56 ' | Správce: '.$this->Config['Web']['Admin'].57 ' | E-mail: '.$this->Config['Web']['AdminEmail'].' |';58 if($this->Config['Web']['ShowRuntimeInfo'] == true) $Output .= ' Doba generování: '.$Time.' s / '.ini_get('max_execution_time').' s | Použitá paměť: '.HumanSize(memory_get_peak_usage(FALSE)).' / '.ini_get('memory_limit').'B |';59 $Output .= '</ i></div></body></html>';52 $Output = '<div class="Footer"> 53 <ul><li>Založeno na projektu <a href="http://svn.zdechov.net/trac/wowhosting/">WoW hosting</a></li>'. 54 '<li><a href="http://svn.zdechov.net/trac/wowhosting/browser">Zdrojové kódy</a></li>'. 55 '<li><a href="http://svn.zdechov.net/trac/wowhosting/log?verbose=on">Novinky</a></li>'. 56 '<li>Správce: '.$this->Config['Web']['Admin'].'</li>'. 57 '<li>E-mail: '.$this->Config['Web']['AdminEmail'].'</li>'; 58 if($this->Config['Web']['ShowRuntimeInfo'] == true) $Output .= '<li>Doba generování: '.$Time.' s / '.ini_get('max_execution_time').' s</li><li>Použitá paměť: '.HumanSize(memory_get_peak_usage(FALSE)).' / '.ini_get('memory_limit').'B</li>'; 59 $Output .= '</ul></div></body></html>'; 60 60 return($Output); 61 61 } -
trunk/www/Application/View/Server.php
r69 r71 97 97 foreach($Table->Values as $Index => $Item) 98 98 { 99 $Table->Values[$Index]['Actions'] = '<a href="? Action=ServerShow&Id='.$Item['Id'].'">Podrobnosti</a>';99 $Table->Values[$Index]['Actions'] = '<a href="?Module=Server&Action=Show&Id='.$Item['Id'].'">Podrobnosti</a>'; 100 100 unset($Table->Values[$Index]['Id']); 101 101 } … … 109 109 $DbRow = $DbResult->fetch_row(); 110 110 if(($ServerCount < $Config['MaxServerCount']) and ($DbRow[0] < $Config['MaxServerCountPerUser'])) 111 $Output .= '<br /><div style="text-align: center;"><a href="? Action=ServerAdd">Vytvořit nový server</a></dev>';111 $Output .= '<br /><div style="text-align: center;"><a href="?Module=Server&Action=Add">Vytvořit nový server</a></dev>'; 112 112 } 113 113 return($Output); … … 123 123 { 124 124 $Output = '<h4>Podrobnosti serveru</h4>'; 125 $Form = new Form($this-> ItemFormClass);125 $Form = new Form($this->System, $this->ItemFormClass); 126 126 $Form->LoadValuesFromDatabase($Id); 127 127 $Form->Definition['Items']['Realmlist'] = array('Type' => 'String', 'Caption' => 'Adresa k připojení', 'Default' => ''); … … 142 142 if(array_key_exists('Id', $Server->Server['Database']) and ($Server->Server['Lock'] == 0)) 143 143 { 144 if($ServerStatus['RealmdPortState'] == true) $Output .= ' <a href="?Action=ServerStop&Id='.$Server->Id.'">Zastavit</a> <a href="? Action=ServerRestart&Id='.$Server->Id.'">Restartovat</a>';145 else $Output .= ' <a href="? Action=ServerStart&Id='.$Server->Id.'">Spustit</a>';144 if($ServerStatus['RealmdPortState'] == true) $Output .= ' <a href="?Action=ServerStop&Id='.$Server->Id.'">Zastavit</a> <a href="?Module=Server&Action=Restart&Id='.$Server->Id.'">Restartovat</a>'; 145 else $Output .= ' <a href="?Module=Server&Action=Start&Id='.$Server->Id.'">Spustit</a>'; 146 146 } 147 147 if($Server->Server['Lock'] == 0) 148 148 { 149 $Output .= ' <a href="? Action=ServerEdit&Id='.$Server->Id.'">Upravit základní nastavení</a>';149 $Output .= ' <a href="?Module=Server&Action=Edit&Id='.$Server->Id.'">Upravit základní nastavení</a>'; 150 150 } 151 151 //$Output .= ' <a href="?Action=ServerDatabaseImport&Id='.$Server->Id.'">Načtení čisté databáze</a>'; 152 $Output .= ' <a href="? Action=RealmAdd&Id='.$Server->Id.'">Vytvořit nový svět</a>';153 $Output .= ' <a href="? Action=UpdateRealmCharacters&Id='.$Server->Id.'">Aktualizovat počty postav</a>';152 $Output .= ' <a href="?Module=Realm&Action=Add&Id='.$Server->Id.'">Vytvořit nový svět</a>'; 153 $Output .= ' <a href="?Module=Realm&Action=UpdateCharacters&Id='.$Server->Id.'">Aktualizovat počty postav</a>'; 154 154 } 155 $Output .= ' <a href="? Action=GameAccountRegister&Id='.$Server->Id.'">Vytvoření herního účtu</a>';155 $Output .= ' <a href="?Module=Server&Action=GameAccountRegister&Id='.$Server->Id.'">Vytvoření herního účtu</a>'; 156 156 $Output .= '</div>'; 157 157 158 158 // Show realmlist 159 $RealmView = new RealmView($this-> Database, $this->System);159 $RealmView = new RealmView($this->System); 160 160 $Output .= $RealmView->ItemList(); 161 161 } else $Output = $this->System->SystemMessage('Zobrazení serveru', 'Server se zadaným id nenalezen.'); … … 180 180 else 181 181 { 182 $Form = new Form($this-> CreateFormClass);182 $Form = new Form($this->System, $this->CreateFormClass); 183 183 $Form->LoadValuesFromForm(); 184 184 $Form->OnSubmit = '?Action=ServerCreate'; … … 208 208 if($NewPortRealmd < $Config['BaseNetworkPortRealmd']) $NewPortRealmd = $Config['BaseNetworkPortRealmd']; 209 209 210 $Form = new Form($this-> CreateFormClass, array());210 $Form = new Form($this->System, $this->CreateFormClass, array()); 211 211 $Form->LoadValuesFromForm(); 212 212 $this->Database->insert('Server', array('Name' => $Form->Values['Name'], 'Description' => $Form->Values['Description'], 'User' => $this->System->Modules['User']->User['Id'], 'Homepage' => $Form->Values['Homepage'], 'Database' => $Form->Values['Database'], 'NetworkPortRealmd' => $NewPortRealmd, 'Lock' => 1, 'TimeCreate' => 'NOW()')); … … 215 215 $Server->CreateDatabase(); 216 216 $Output .= $this->System->SystemMessage('Vytvoření serveru', $Server->ImportDatabase(true)); 217 $TaskView = new TaskView($this-> Database, $this->System);217 $TaskView = new TaskView($this->System); 218 218 $Output .= $TaskView->ItemList(); 219 219 //$UserOptions->LoadValuesFromDatabase($this->System->Modules['User']->User['Id']); … … 231 231 if(($this->System->Modules['User']->User['Id'] == $Server->Server['User']) or ($this->System->Modules['User']->User['Role'] >= USER_ROLE_ADMINISTRATOR)) 232 232 { 233 $Form = new Form($this-> EditFormClass, array());233 $Form = new Form($this->System, $this->EditFormClass, array()); 234 234 $Form->LoadValuesFromForm(); 235 235 $ServerId = $_POST['ServerId']; … … 253 253 if(($this->System->Modules['User']->User['Id'] == $Server->Server['User']) or ($this->System->Modules['User']->User['Role'] >= USER_ROLE_ADMINISTRATOR)) 254 254 { 255 $Form = new Form($this-> EditFormClass);255 $Form = new Form($this->System, $this->EditFormClass); 256 256 $Form->LoadValuesFromDatabase($_GET['Id']); 257 257 $Form->Values['ServerId'] = $_GET['Id']; … … 271 271 { 272 272 $Output .= $this->System->SystemMessage('Spuštění serveru', $Server->Start()); 273 $TaskView = new TaskView($this-> Database, $this->System);273 $TaskView = new TaskView($this->System); 274 274 $Output .= $TaskView->ItemList();; 275 275 } else $this->System->SystemMessage('Spuštění serveru', 'Nemáte oprávnění'); … … 287 287 { 288 288 $Output .= $this->System->SystemMessage('Zastavení serveru', $Server->Stop()); 289 $TaskView = new TaskView($this-> Database, $this->System);289 $TaskView = new TaskView($this->System); 290 290 $Output .= $TaskView->ItemList();; 291 291 } else $this->System->SystemMessage('Zastavení serveru', 'Nemáte oprávnění'); … … 296 296 function AccountCreate() 297 297 { 298 $Form = new Form($this-> GameAccountNewFormClass);298 $Form = new Form($this->System, $this->GameAccountNewFormClass); 299 299 $Form->LoadValuesFromForm(); 300 300 $Form->Values['ServerId'] = $_GET['Id']; 301 $Form->OnSubmit = '? Action=GameAccountRegister2';301 $Form->OnSubmit = '?Module=Server&Action=GameAccountRegisterFinish'; 302 302 $Output = $Form->ShowEditForm(); 303 303 return($Output); … … 306 306 function AccountCreateFinish() 307 307 { 308 $Form = new Form($this-> GameAccountNewFormClass);308 $Form = new Form($this->System, $this->GameAccountNewFormClass); 309 309 $Form->LoadValuesFromForm(); 310 310 $Server = new Server($this->Database, $Form->Values['ServerId']); 311 311 $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'])); 312 $Output .= '<a href="? Action=GameAccountRegister&Id='.$Form->Values['ServerId'].'">Zpět k zadání údajů</a>';312 $Output .= '<a href="?Module=Server&Action=GameAccountRegister&Id='.$Form->Values['ServerId'].'">Zpět k zadání údajů</a>'; 313 313 return($Output); 314 314 } -
trunk/www/Application/View/User.php
r69 r71 49 49 ); 50 50 51 function Login Form()51 function Login() 52 52 { 53 53 global $Config; 54 54 55 $Form = new Form($this-> LoginFormClass);56 $Form->OnSubmit = '? Action=Login';55 $Form = new Form($this->System, $this->LoginFormClass); 56 $Form->OnSubmit = '?Module=User&Action=LoginFinish'; 57 57 $Output = $Form->ShowEditForm(); 58 58 $Output .= '<div class="Centred">'; 59 59 if($Config['Web']['UserRegistrationEnabled']) 60 $Output .= '<a href="? Action=UserRegister">Registrovat se</a> ';61 $Output .= '<a href="? Action=PasswordRecovery">Obnova zapomenutého hesla</a></div>';60 $Output .= '<a href="?Module=User&Action=Register">Registrovat se</a> '; 61 $Output .= '<a href="?Module=User&Action=PasswordRecovery">Obnova zapomenutého hesla</a></div>'; 62 62 return($Output); 63 63 } 64 64 65 function Login Result()65 function LoginFinish() 66 66 { 67 $Form = new Form($this-> LoginFormClass);68 $Form->OnSubmit = '? Action=Login';67 $Form = new Form($this->System, $this->LoginFormClass); 68 $Form->OnSubmit = '?Module=User&Action=LoginFinish'; 69 69 $Form->LoadValuesFromForm(); 70 70 $Result = $this->System->Modules['User']->Login($Form->Values['Username'], $Form->Values['Password']); … … 74 74 $Form->Values['Password'] = ''; 75 75 $Output .= $Form->ShowEditForm(); 76 $Output .= '<div class="Centred"><a href="? Action=UserRegister">Registrovat se</a> '.77 '<a href="? Action=PasswordRecovery">Obnova zapomenutého hesla</a></div>';76 $Output .= '<div class="Centred"><a href="?Module=User&Action=UserRegister">Registrovat se</a> '. 77 '<a href="?Module=User&Action=PasswordRecovery">Obnova zapomenutého hesla</a></div>'; 78 78 } 79 79 return($Output); … … 86 86 if($Config['Web']['UserRegistrationEnabled']) 87 87 { 88 $Form = new Form($this-> RegisterFormClass, array());88 $Form = new Form($this->System, $this->RegisterFormClass, array()); 89 89 $Form->LoadValuesFromForm(); 90 90 $Result = $this->System->Modules['User']->Register($Form->Values['Login'], $Form->Values['Password'], $Form->Values['Password2'], $Form->Values['Email'], $Form->Values['Name']); … … 92 92 if($Result <> USER_REGISTRATED) 93 93 { 94 $Form->OnSubmit = '? Action=UserRegisterSave';94 $Form->OnSubmit = '?Module=User&Action=UserRegisterSave'; 95 95 $Output = $Form->ShowEditForm(); 96 96 } … … 108 108 function PasswordRecoveryFinish() 109 109 { 110 $Form = new Form($this-> PasswordRecoveryFormClass);110 $Form = new Form($this->System, $this->PasswordRecoveryFormClass); 111 111 $Form->LoadValuesFromForm(); 112 112 $Result = $this->System->Modules['User']->PasswordRecoveryRequest($Form->Values['Name'], $Form->Values['Email']); … … 121 121 function PasswordRecovery() 122 122 { 123 $Form = new Form($this-> PasswordRecoveryFormClass);124 $Form->OnSubmit = '? Action=PasswordRecovery2';123 $Form = new Form($this->System, $this->PasswordRecoveryFormClass); 124 $Form->OnSubmit = '?Module=User&Action=PasswordRecovery2'; 125 125 $Output = $Form->ShowEditForm(); 126 126 return($Output); … … 130 130 { 131 131 $Output = $this->System->SystemMessage('Odhlášení', $this->System->Modules['User']->Logout()); 132 $Output .= $this->Login Form();132 $Output .= $this->Login(); 133 133 return($Output); 134 134 } … … 136 136 function Options() 137 137 { 138 $UserOptions = new Form($this-> OptionsFormClass);138 $UserOptions = new Form($this->System, $this->OptionsFormClass); 139 139 $UserOptions->LoadValuesFromDatabase($this->System->Modules['User']->User['Id']); 140 $UserOptions->OnSubmit = '? Action=UserOptionsSave';140 $UserOptions->OnSubmit = '?Module=User&Action=UserOptionsSave'; 141 141 $Output = $UserOptions->ShowEditForm(); 142 142 return($Output); … … 145 145 function OptionsSave() 146 146 { 147 $UserOptions = new Form($this-> OptionsFormClass, array());147 $UserOptions = new Form($this->System, $this->OptionsFormClass, array()); 148 148 $UserOptions->LoadValuesFromForm(); 149 149 $UserOptions->SaveValuesToDatabase($this->System->Modules['User']->User['Id']); … … 151 151 $this->System->Modules['Log']->NewRecord('User', 'Nastavení uživatele změněno', $UserOptions->Values['Name']); 152 152 $UserOptions->LoadValuesFromDatabase($this->System->Modules['User']->User['Id']); 153 $UserOptions->OnSubmit = '? Action=UserOptionsSave';153 $UserOptions->OnSubmit = '?Module=User&Action=UserOptionsSave'; 154 154 $Output .= $UserOptions->ShowEditForm(); 155 155 return($Output); … … 162 162 if($Config['Web']['UserRegistrationEnabled']) 163 163 { 164 $Form = new Form($this-> RegisterFormClass);164 $Form = new Form($this->System, $this->RegisterFormClass); 165 165 $Form->LoadValuesFromForm(); 166 $Form->OnSubmit = '? Action=UserRegisterSave';166 $Form->OnSubmit = '?Module=User&Action=UserRegisterSave'; 167 167 $Output = 'Vyplňte správně požadované údaje. Na zadaný email vám bude zaslán aktivační email.'; 168 168 $Output .= $Form->ShowEditForm(); -
trunk/www/Base/Form.php
r69 r71 1 1 <?php 2 2 3 class Form 3 class Form extends Module 4 4 { 5 5 var $Definition = array(); … … 7 7 var $OnSubmit = ''; 8 8 9 function __construct($ FormClass)9 function __construct($System, $FormClass) 10 10 { 11 11 $this->Definition = $FormClass; … … 14 14 $this->Values[$Index] = ''; 15 15 } 16 $this->System = $System; 17 $this->Database = $System->Database; 18 $this->Config = $System->Config; 16 19 } 17 20 … … 24 27 function ShowTableBlock($Context = '') 25 28 { 26 global $ Database, $FormTypes;29 global $FormTypes; 27 30 28 31 $Table = array( … … 41 44 } 42 45 } 43 $Output = '<div style="text-align: center">'.$this->Definition['Title'].'</div>'.Table($Table, 'WideTable'); 46 $Html = new Html(); 47 $Output = '<div style="text-align: center">'.$this->Definition['Title'].'</div>'.$Html->Table($Table, 'WideTable'); 44 48 return($Output); 45 49 } … … 54 58 function ShowEditBlock($Context = '') 55 59 { 56 global $ Database, $FormTypes;60 global $FormTypes; 57 61 58 62 $Table = array( … … 70 74 } 71 75 } 72 $Output = '<fieldset><legend>'.$this->Definition['Title'].'</legend>'.Table($Table, 'BasicTable'). 76 $Html = new Html(); 77 $Output = '<fieldset><legend>'.$this->Definition['Title'].'</legend>'.$Html->Table($Table, 'BasicTable'). 73 78 '</fieldset>'; 74 79 foreach($this->Definition['Items'] as $Index => $Item) … … 79 84 function LoadValuesFromDatabase($Id) 80 85 { 81 global $Database; 82 83 $DbResult = $Database->query('SELECT T.* FROM '.$this->Definition['Table'].' AS T WHERE T.Id='.$Id); 86 $DbResult = $this->Database->query('SELECT T.* FROM '.$this->Definition['Table'].' AS T WHERE T.Id='.$Id); 84 87 if($DbResult->num_rows > 0) $DbRow = $DbResult->fetch_assoc(); 85 88 foreach($this->Definition['Items'] as $Index => $Item) … … 94 97 function SaveValuesToDatabase($Id) 95 98 { 96 global $Database;97 98 99 if($Id == 0) 99 100 { 100 101 $this->Values['Id'] = $Id; 101 $DbResult = $ Database->replace($this->Definition['Table'], $this->Values);102 $DbResult = $this->Database->replace($this->Definition['Table'], $this->Values); 102 103 } else 103 $DbResult = $ Database->update($this->Definition['Table'], 'Id='.$Id, $this->Values);104 $DbResult = $this->Database->update($this->Definition['Table'], 'Id='.$Id, $this->Values); 104 105 } 105 106 -
trunk/www/Base/Html.php
r69 r71 1 1 <?php 2 2 3 class HTML extends Module3 class HTML 4 4 { 5 5 function ShowArray($Value) -
trunk/www/Base/Table.php
r69 r71 57 57 'Rows' => $this->Values, 58 58 ); 59 $Output = Table($Table, 'WideTable'); 60 $Output .= '<div class="Pager">'.PageList('Page', $this->Page, $this->TotalRowCount, $Config['Web']['TableRowPerPage']).'</div>'; 59 $Html = new Html(); 60 $Output = $Html->Table($Table, 'WideTable'); 61 $Output .= '<div class="Pager">'.$Html->PageList('Page', $this->Page, $this->TotalRowCount, $Config['Web']['TableRowPerPage']).'</div>'; 61 62 return($Output); 62 63 } -
trunk/www/Base/Types/Base.php
r69 r71 1 1 <?php 2 2 3 class TypeBase 3 class TypeBase extends Module 4 4 { 5 5 var $DatabaseCompareOperators = array(); -
trunk/www/Base/Types/Include.php
r69 r71 42 42 function ExecuteTypeEvent($TypeName, $Event, $Parameters = array()) 43 43 { 44 global $TypeDefinitionList ;44 global $TypeDefinitionList, $System; 45 45 46 46 if(array_key_exists($TypeName, $TypeDefinitionList)) … … 48 48 $Type = $TypeDefinitionList[$TypeName]; 49 49 $TypeClass = 'Type'.$Type['Class']; 50 $TypeObject = new $TypeClass ;50 $TypeObject = new $TypeClass($System); 51 51 if(is_callable(array($TypeObject, $Event))) return($TypeObject->$Event($Parameters)); 52 52 else return($TypeName.'->'.$Event.'('.serialize($Parameters).')'); -
trunk/www/Base/Types/PointerOneToOne.php
r69 r71 5 5 function OnView($Item) 6 6 { 7 global $ Database, $TypeDefinitionList;7 global $TypeDefinitionList; 8 8 9 9 $Type = $TypeDefinitionList[$Item['Type']]; 10 $DbResult = $ Database->query('SELECT '.$Type['Parameters']['Name'].' AS Name FROM `'.$Type['Parameters']['Table'].'` WHERE `'.$Type['Parameters']['Id'].'`='.$Item['Value']);10 $DbResult = $this->Database->query('SELECT '.$Type['Parameters']['Name'].' AS Name FROM `'.$Type['Parameters']['Table'].'` WHERE `'.$Type['Parameters']['Id'].'`='.$Item['Value']); 11 11 $DbRow = $DbResult->fetch_assoc(); 12 12 $Output = $DbRow['Name']; … … 24 24 function OnEdit($Item) 25 25 { 26 global $ Database, $TypeDefinitionList;26 global $TypeDefinitionList; 27 27 28 28 $Output = '<select name="'.$Item['Name'].'">'; … … 30 30 if(array_key_exists('Condition', $Type['Parameters'])) $Where = ' WHERE '.$Type['Parameters']['Condition']; 31 31 else $Where = ''; 32 $DbResult = $ Database->query('SELECT '.$Type['Parameters']['Name'].' AS Name,'.$Type['Parameters']['Id'].' AS Id FROM `'.$Type['Parameters']['Table'].'`'.$Where.' ORDER BY Name DESC');32 $DbResult = $this->Database->query('SELECT '.$Type['Parameters']['Name'].' AS Name,'.$Type['Parameters']['Id'].' AS Id FROM `'.$Type['Parameters']['Table'].'`'.$Where.' ORDER BY Name DESC'); 33 33 while($DbRow = $DbResult->fetch_assoc()) 34 34 {
Note:
See TracChangeset
for help on using the changeset viewer.