Changeset 10
- Timestamp:
- Jun 1, 2023, 1:31:28 AM (18 months ago)
- Location:
- trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Application/BaseView.php
r8 r10 12 12 global $ReleaseTime, $Revision; 13 13 14 $Output = '<?xml version="1.0" encoding="'. $this->System->Config['Web']['Charset'].'"?>'."\n".14 $Output = '<?xml version="1.0" encoding="'.Core::Cast($this->System)->Config['Web']['Charset'].'"?>'."\n". 15 15 '<!DOCTYPE html>'. 16 16 '<html>'. 17 17 '<head>'. 18 18 '<meta http-equiv="Content-Language" content="cs"/>'. 19 '<meta http-equiv="content-type" content="text/html; charset='. $this->System->Config['Web']['Charset'].'" />'.19 '<meta http-equiv="content-type" content="text/html; charset='.Core::Cast($this->System)->Config['Web']['Charset'].'" />'. 20 20 '<meta name="robots" content="all" />'. 21 '<title>'. $this->System->Config['Web']['Title'].'</title>'.21 '<title>'.Core::Cast($this->System)->Config['Web']['Title'].'</title>'. 22 22 '<link rel="StyleSheet" href="'.$this->System->Link('/style/basic/style.css').'" type="text/css" media="all"/>'. 23 implode("\n", $this->System->HeadItems).23 implode("\n", Core::Cast($this->System)->HeadItems). 24 24 '</head><body>'; 25 25 $Output .= $this->ShowHeader(); 26 26 $Output .= $Content; 27 27 $Output .= '<br/><div style="text-align: center; font-size: small;">Verze: '.$Revision.' ('.HumanDate($ReleaseTime).')'. 28 ' <a href="https:// svn.zdechov.net/trac/open2ride/browser/trunk">Zdrojový kód</a> '.29 '<a href="https:// svn.zdechov.net/trac/open2ride/log/trunk?verbose=on">Historie změn</a></div>';28 ' <a href="https://app.zdechov.net/open2ride/browser/trunk">Zdrojový kód</a> '. 29 '<a href="https://app.zdechov.net/open2ride/log/trunk?verbose=on">Historie změn</a></div>'; 30 30 $Output .= '</body></html>'; 31 31 echo($Output); … … 37 37 $Output .= '<div class="MenuItem">'; 38 38 $Bar = ''; 39 foreach ( $this->System->Bars['TopLeft'] as $BarItem)39 foreach (Core::Cast($this->System)->Bars['TopLeft'] as $BarItem) 40 40 $Bar .= call_user_func($BarItem); 41 41 if (trim($Bar) != '') $Output .= $Bar; 42 42 else $Output .= ' '; 43 43 $Output .= '</div><div class="MenuItem2">'; 44 44 $Bar = ''; 45 foreach ( $this->System->Bars['Top'] as $BarItem)45 foreach (Core::Cast($this->System)->Bars['Top'] as $BarItem) 46 46 $Bar .= call_user_func($BarItem); 47 47 if (trim($Bar) != '') $Output .= $Bar; 48 48 else $Output .= ' '; 49 49 $Output .= '</div></div>'; … … 53 53 function GetOutput($Page) 54 54 { 55 $Page->OnSystemMessage = array( $this->System->BaseView, 'SystemMessage');55 $Page->OnSystemMessage = array(Core::Cast($this->System)->BaseView, 'SystemMessage'); 56 56 $Output = $this->ShowPage($Page->Show()); 57 57 return $Output; -
trunk/Application/Core.php
r8 r10 23 23 public FormManager $FormManager; 24 24 public BaseView $BaseView; 25 public User $User; 25 26 26 27 function __construct() -
trunk/Application/Version.php
r9 r10 6 6 // and system will need database update. 7 7 8 $Revision = 9;8 $Revision = 10; 9 9 $DatabaseRevision = 7; 10 10 $ReleaseTime = strtotime('2023-06-01'); -
trunk/Modules/Ride/PageNewRide.php
r8 r10 61 61 'LEFT JOIN CarModel ON CarModel.Id=Car.Model '. 62 62 'LEFT JOIN CarManufacturer ON CarManufacturer.Id = CarModel.Manufacturer '. 63 'WHERE Car.Owner='. $this->System->User->User['Id']);63 'WHERE Car.Owner='.Core::Cast($this->System)->User->User['Id']); 64 64 while ($DbRow = $DbResult->fetch_assoc()) 65 65 { … … 115 115 if ($_GET['step'] == '3') { 116 116 $this->Database->insert('Ride', array( 117 'Driver' => $this->System->User->User['Id'],117 'Driver' => Core::Cast($this->System)->User->User['Id'], 118 118 'SeatCount' => $_POST['seats'], 119 119 'Car' => $_POST['car'], -
trunk/Modules/Ride/PageRideDetail.php
r8 r10 108 108 $this->System->Database->insert('Passenger', array( 109 109 'Ride' => $_POST['id'], 110 'User' => $this->System->User->User['Id'],110 'User' => Core::Cast($this->System)->User->User['Id'], 111 111 'SeatCount' => $_POST['seats'], 112 112 'RideStopFrom' => $_POST['fromid'], -
trunk/Modules/User/ModuleUser.php
r9 r10 131 131 function DoStart(): void 132 132 { 133 $this->System->User = new User($this->System);134 if (isset($_SERVER['REMOTE_ADDR'])) $this->System->User->Check();133 Core::Cast($this->System)->User = new User($this->System); 134 if (isset($_SERVER['REMOTE_ADDR'])) Core::Cast($this->System)->User->Check(); 135 135 $this->System->RegisterPage(['userlist'], 'PageUserList'); 136 136 $this->System->RegisterPage(['user'], 'PageUser'); 137 $this->System->RegisterPageBarItem('Top', 'User', array($this, 'TopBarCallback'));138 $this->System->FormManager->RegisterClass('UserLogin', array(137 Core::Cast($this->System)->RegisterPageBarItem('Top', 'User', array($this, 'TopBarCallback')); 138 Core::Cast($this->System)->FormManager->RegisterClass('UserLogin', array( 139 139 'Title' => 'Přihlášení uživatele', 140 140 'SubmitText' => 'Přihlásit', … … 146 146 ), 147 147 )); 148 $this->System->FormManager->RegisterClass('UserOptions', array(148 Core::Cast($this->System)->FormManager->RegisterClass('UserOptions', array( 149 149 'Title' => 'Základní nastavení', 150 150 'Table' => 'User', … … 158 158 ), 159 159 )); 160 $this->System->FormManager->RegisterClass('UserRegister', array(160 Core::Cast($this->System)->FormManager->RegisterClass('UserRegister', array( 161 161 'Title' => 'Registrace uživatele', 162 162 'SubmitText' => 'Registrovat', … … 170 170 ), 171 171 )); 172 $this->System->FormManager->RegisterClass('PasswordRecovery', array(172 Core::Cast($this->System)->FormManager->RegisterClass('PasswordRecovery', array( 173 173 'Title' => 'Obnova hesla', 174 174 'SubmitText' => 'Obnovit', … … 179 179 ), 180 180 )); 181 $this->System->FormManager->RegisterClass('APIToken', array(181 Core::Cast($this->System)->FormManager->RegisterClass('APIToken', array( 182 182 'Title' => 'Přístupový token', 183 183 'Table' => 'APIToken', … … 187 187 ), 188 188 )); 189 $this->System->FormManager->RegisterClass('User', array(189 Core::Cast($this->System)->FormManager->RegisterClass('User', array( 190 190 'Title' => 'Uživatelé', 191 191 'Table' => 'User', … … 206 206 ), 207 207 )); 208 $this->System->FormManager->RegisterClass('PermissionUserAssignment', array(208 Core::Cast($this->System)->FormManager->RegisterClass('PermissionUserAssignment', array( 209 209 'Title' => 'Oprávnění uživatelů', 210 210 'Table' => 'PermissionUserAssignment', … … 215 215 ), 216 216 )); 217 $this->System->FormManager->RegisterClass('PermissionGroup', array(217 Core::Cast($this->System)->FormManager->RegisterClass('PermissionGroup', array( 218 218 'Title' => 'Skupiny oprávnění', 219 219 'Table' => 'PermissionGroup', … … 224 224 ), 225 225 )); 226 $this->System->FormManager->RegisterClass('PermissionGroupAssignment', array(226 Core::Cast($this->System)->FormManager->RegisterClass('PermissionGroupAssignment', array( 227 227 'Title' => 'Přiřazení skupin oprávnění', 228 228 'Table' => 'PermissionGroupAssignment', … … 233 233 ), 234 234 )); 235 $this->System->FormManager->RegisterClass('PermissionOperation', array(235 Core::Cast($this->System)->FormManager->RegisterClass('PermissionOperation', array( 236 236 'Title' => 'Operace oprávnění', 237 237 'Table' => 'PermissionOperation', … … 244 244 ), 245 245 )); 246 $this->System->FormManager->RegisterFormType('TUser', array(246 Core::Cast($this->System)->FormManager->RegisterFormType('TUser', array( 247 247 'Type' => 'Reference', 248 248 'Table' => 'User', … … 251 251 'Filter' => '1', 252 252 )); 253 $this->System->FormManager->RegisterFormType('TPermissionGroup', array(253 Core::Cast($this->System)->FormManager->RegisterFormType('TPermissionGroup', array( 254 254 'Type' => 'Reference', 255 255 'Table' => 'PermissionGroup', … … 258 258 'Filter' => '1', 259 259 )); 260 $this->System->FormManager->RegisterFormType('TPermissionGroupAssignment', array(260 Core::Cast($this->System)->FormManager->RegisterFormType('TPermissionGroupAssignment', array( 261 261 'Type' => 'Reference', 262 262 'Table' => 'PermissionGroupAssignment', … … 265 265 'Filter' => '1', 266 266 )); 267 $this->System->FormManager->RegisterFormType('TPermissionOperation', array(267 Core::Cast($this->System)->FormManager->RegisterFormType('TPermissionOperation', array( 268 268 'Type' => 'Reference', 269 269 'Table' => 'PermissionOperation', … … 288 288 function TopBarCallback() 289 289 { 290 if ( $this->System->User->User['Id'] == null)290 if (Core::Cast($this->System)->User->User['Id'] == null) 291 291 { 292 292 $Output = '<a href="'.$this->System->Link('/user/?Action=LoginForm').'">Přihlášení</a> '. … … 294 294 } else 295 295 { 296 $Output = $this->System->User->User['Name'].296 $Output = Core::Cast($this->System)->User->User['Name']. 297 297 ' <a href="'.$this->System->Link('/user/?Action=UserMenu').'">Nabídka</a>'. 298 298 ' <a href="'.$this->System->Link('/user/?Action=Logout').'">Odhlásit</a>'; -
trunk/Modules/User/PageUser.php
r8 r10 23 23 $Query = 'SELECT `Contact`.`Value`, `Contact`.`Description`, (SELECT `Name` FROM `ContactCategory` WHERE `ContactCategory`.`Id` = `Contact`.`Category`) AS `Category` '. 24 24 'FROM `Contact` WHERE `User` = '. 25 $this->System->User->User['Id'];25 Core::Cast($this->System)->User->User['Id']; 26 26 $DbResult = $this->Database->query('SELECT COUNT(*) FROM ('.$Query.') AS T'); 27 27 $DbRow = $DbResult->fetch_row(); … … 60 60 { 61 61 $Output = ''; 62 if ( $this->System->User->User['Id'] != null)62 if (Core::Cast($this->System)->User->User['Id'] != null) 63 63 { 64 64 $Actions = ''; … … 75 75 $Output .= $this->Panel('Nabídka uživatele', $Actions); 76 76 $Output .= '</td><td style="vertical-align:top;">'; 77 if ( $this->System->User->User['Id'] != null)78 { 79 $Form = new Form( $this->System->FormManager);77 if (Core::Cast($this->System)->User->User['Id'] != null) 78 { 79 $Form = new Form(Core::Cast($this->System)->FormManager); 80 80 $Form->SetClass('UserOptions'); 81 $Form->LoadValuesFromDatabase( $this->System->User->User['Id']);81 $Form->LoadValuesFromDatabase(Core::Cast($this->System)->User->User['Id']); 82 82 $Form->OnSubmit = '?Action=UserOptionsSave'; 83 83 $Output .= $Form->ShowViewForm(); … … 100 100 if ($Action == 'LoginForm') 101 101 { 102 $Form = new Form( $this->System->FormManager);102 $Form = new Form(Core::Cast($this->System)->FormManager); 103 103 $Form->SetClass('UserLogin'); 104 104 $Form->OnSubmit = '?Action=Login'; … … 111 111 if (array_key_exists('Username', $_POST) and array_key_exists('Password', $_POST)) 112 112 { 113 $Form = new Form( $this->System->FormManager);113 $Form = new Form(Core::Cast($this->System)->FormManager); 114 114 $Form->SetClass('UserLogin'); 115 115 $Form->OnSubmit = '?Action=Login'; 116 116 if (array_key_exists('StayLogged', $_POST) and ($_POST['StayLogged'] == 'on')) $StayLogged = true; 117 117 else $StayLogged = false; 118 $Result = $this->System->User->Login($_POST['Username'], $_POST['Password'], $StayLogged);118 $Result = Core::Cast($this->System)->User->Login($_POST['Username'], $_POST['Password'], $StayLogged); 119 119 $Output .= $this->SystemMessage('Přihlášení', $Result); 120 120 if ($Result <> USER_LOGGED_IN) … … 134 134 if ($Action == 'Logout') 135 135 { 136 if ( $this->System->User->User['Id'] != null)137 { 138 $Output .= $this->SystemMessage('Odhlášení', $this->System->User->Logout());136 if (Core::Cast($this->System)->User->User['Id'] != null) 137 { 138 $Output .= $this->SystemMessage('Odhlášení', Core::Cast($this->System)->User->Logout()); 139 139 } else $Output .= $this->SystemMessage('Nastavení uživatele', 'Nejste přihlášen'); 140 140 } else 141 141 if ($Action == 'UserOptions') 142 142 { 143 if ( $this->System->User->User['Id'] != null)144 { 145 $Form = new Form( $this->System->FormManager);143 if (Core::Cast($this->System)->User->User['Id'] != null) 144 { 145 $Form = new Form(Core::Cast($this->System)->FormManager); 146 146 $Form->SetClass('UserOptions'); 147 $Form->LoadValuesFromDatabase( $this->System->User->User['Id']);147 $Form->LoadValuesFromDatabase(Core::Cast($this->System)->User->User['Id']); 148 148 $Form->OnSubmit = '?Action=UserOptionsSave'; 149 149 $Output .= $Form->ShowEditForm(); … … 152 152 if ($Action == 'UserOptionsSave') 153 153 { 154 $Form = new Form( $this->System->FormManager);154 $Form = new Form(Core::Cast($this->System)->FormManager); 155 155 $Form->SetClass('UserOptions'); 156 156 $Form->LoadValuesFromForm(); 157 $Form->SaveValuesToDatabase( $this->System->User->User['Id']);157 $Form->SaveValuesToDatabase(Core::Cast($this->System)->User->User['Id']); 158 158 $Output .= $this->SystemMessage('Nastavení', 'Nastavení uloženo.'); 159 159 $this->System->ModuleManager->Modules['Log']->NewRecord('User', 'Nastavení uživatele změněno', $Form->Values['Name']); 160 $Form->LoadValuesFromDatabase( $this->System->User->User['Id']);160 $Form->LoadValuesFromDatabase(Core::Cast($this->System)->User->User['Id']); 161 161 $Form->OnSubmit = '?Action=UserOptionsSave'; 162 162 $Output .= $Form->ShowEditForm(); … … 164 164 if ($Action == 'UserRegister') 165 165 { 166 $Form = new Form( $this->System->FormManager);166 $Form = new Form(Core::Cast($this->System)->FormManager); 167 167 $Form->SetClass('UserRegister'); 168 168 //$Form->LoadValuesFromForm(); … … 173 173 { 174 174 $Output .= $this->SystemMessage('Potvrzení registrace', 175 $this->System->User->RegisterConfirm($_GET['User'], $_GET['H']));175 Core::Cast($this->System)->User->RegisterConfirm($_GET['User'], $_GET['H'])); 176 176 } else 177 177 if ($Action == 'PasswordRecovery') 178 178 { 179 $Form = new Form( $this->System->FormManager);179 $Form = new Form(Core::Cast($this->System)->FormManager); 180 180 $Form->SetClass('PasswordRecovery'); 181 181 $Form->OnSubmit = '?Action=PasswordRecovery2'; … … 184 184 if ($Action == 'PasswordRecovery2') 185 185 { 186 $Form = new Form( $this->System->FormManager);186 $Form = new Form(Core::Cast($this->System)->FormManager); 187 187 $Form->SetClass('PasswordRecovery'); 188 188 $Form->LoadValuesFromForm(); 189 $Result = $this->System->User->PasswordRecoveryRequest($Form->Values['Name'], $Form->Values['Email']);189 $Result = Core::Cast($this->System)->User->PasswordRecoveryRequest($Form->Values['Name'], $Form->Values['Email']); 190 190 $Output .= $this->SystemMessage('Obnova hesla', $Result); 191 191 if ($Result <> USER_PASSWORD_RECOVERY_SUCCESS) … … 196 196 if ($Action == 'PasswordRecoveryConfirm') 197 197 { 198 $Output .= $this->SystemMessage('Obnova hesla', $this->System->User->PasswordRecoveryConfirm($_GET['User'], $_GET['H'], $_GET['P']));198 $Output .= $this->SystemMessage('Obnova hesla', Core::Cast($this->System)->User->PasswordRecoveryConfirm($_GET['User'], $_GET['H'], $_GET['P'])); 199 199 } else 200 200 if ($Action == 'UserRegisterSave') 201 201 { 202 $Form = new Form( $this->System->FormManager);202 $Form = new Form(Core::Cast($this->System)->FormManager); 203 203 $Form->SetClass('UserRegister'); 204 204 $Form->LoadValuesFromForm(); 205 $Result = $this->System->User->Register($Form->Values['Login'], $Form->Values['Password'],205 $Result = Core::Cast($this->System)->User->Register($Form->Values['Login'], $Form->Values['Password'], 206 206 $Form->Values['Password2'], $Form->Values['Email'], $Form->Values['Name']); 207 207 $Output .= $this->SystemMessage('Registrace nového účtu', $Result);
Note:
See TracChangeset
for help on using the changeset viewer.