Changeset 634
- Timestamp:
- Jan 19, 2014, 2:28:30 PM (11 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Application/System.php
r599 r634 17 17 var $Type; 18 18 var $Pages; 19 var $Bars; 19 20 /** @var AppModuleManager */ 20 21 var $ModuleManager; … … 166 167 $this->FormManager->Root = $this->RootURLFolder; 167 168 169 $this->RegisterPageBar('Top'); 170 168 171 $Database = $this->Database; 169 172 RegisterFormClasses($this->FormManager); … … 182 185 } 183 186 } 187 188 function RegisterPageBar($Name) 189 { 190 $this->Bars[$Name] = array(); 191 } 192 193 function UnregisterPageBar($Name) 194 { 195 unset($this->Bars[$Name]); 196 } 197 198 function RegisterPageBarItem($BarName, $ItemName, $Callback) 199 { 200 $this->Bars[$BarName][$ItemName] = $Callback; 201 } 184 202 } 185 203 -
trunk/Application/Version.php
r633 r634 1 1 <?php 2 2 3 $Revision = 63 3; // Subversion revision3 $Revision = 634; // Subversion revision 4 4 $DatabaseRevision = 633; // SQL structure revision 5 $ReleaseTime = 0;//mktime(0, 0, 0, 2, 5, 2014);5 $ReleaseTime = strtotime('2014-01-19'); -
trunk/Common/Database.php
r590 r634 174 174 return(addslashes($Text)); 175 175 } 176 177 public function __sleep() 178 { 179 return array('LastQuery'); 180 } 181 182 public function __wakeup() 183 { 184 } 176 185 } 177 186 -
trunk/Common/Page.php
r627 r634 87 87 $Output .= '<div class="MainTitle">'.$Title.'</div> 88 88 <div class="Navigation"><span class="MenuItem"><strong>Navigace :: </strong> '.$Navigation.'</span><div class="MenuItem2">'; 89 if(isset($this->System->User) and ($this->System->Config['Web']['UserSupport'] == 1)) 90 { 91 if($this->System->User->User['Id'] == null) 92 $Output .= '<a href="'.$this->System->Link('/?Action=LoginForm').'">Přihlášení</a> '. 93 '<a href="'.$this->System->Link('/?Action=UserRegister').'">Registrace</a>'; 94 else $Output .= $this->System->User->User['Name']. 95 ' <a href="'.$this->System->Link('/?Action=UserMenu').'">Nabídka</a>'. 96 ' <a href="'.$this->System->Link('/?Action=Logout').'">Odhlásit</a>'; 97 } else $Output .= ' '; 98 // <a href="'.$this->System->Link('/?Action=UserOptions').'">Nastavení</a>'; 89 foreach($this->System->Bars['Top'] as $BarItem) 90 $Output .= call_user_func($BarItem); 99 91 $Output .= '</div></div>'; 100 92 } -
trunk/Common/Setup/DefaultConfig.php
r592 r634 27 27 array('Name' => 'Web/WebcamPassword', 'Type' => 'Password', 'Default' => '', 'Title' => 'Heslo web kamery'), 28 28 array('Name' => 'Web/WebcamRefresh', 'Type' => 'Integer', 'Default' => '5', 'Title' => 'Interval obnovení'), 29 array('Name' => 'Web/UserSupport', 'Type' => 'Boolean', 'Default' => '1', 'Title' => 'Podpora uživatelů'),30 29 array('Name' => 'Web/UploadFileFolder', 'Type' => 'String', 'Default' => 'files', 'Title' => 'Složka načtených souborů'), 31 30 array('Name' => 'Web/News/DaysAgo', 'Type' => 'Integer', 'Default' => '30', 'Title' => 'Stáří zobrazovaných aktualit'), -
trunk/Modules/Portal/Portal.php
r630 r634 42 42 ), 43 43 )); 44 $this->System->FormManager->RegisterClass('UserOptions', array( 45 'Title' => 'Základní nastavení', 46 'Table' => 'User', 47 'SubmitText' => 'Uložit', 48 'Items' => array( 49 'Login' => array('Type' => 'String', 'Caption' => 'Přihlašovací jméno', 'Default' => ''), 50 'Salt' => array('Type' => 'RandomHash', 'Caption' => 'Sůl', 'Default' => ''), 51 'Password' => array('Type' => 'Password', 'Caption' => 'Heslo', 'Default' => ''), 52 'Name' => array('Type' => 'String', 'Caption' => 'Zobrazované jméno', 'Default' => ''), 53 'Email' => array('Type' => 'String', 'Caption' => 'E-mail', 'Default' => ''), 54 'PhoneNumber' => array('Type' => 'String', 'Caption' => 'Telefón', 'Default' => ''), 55 'ICQ' => array('Type' => 'String', 'Caption' => 'ICQ', 'Default' => ''), 56 ), 57 )); 58 $this->System->FormManager->RegisterClass('UserRegister', array( 59 'Title' => 'Registrace uživatele', 60 'SubmitText' => 'Registrovat', 61 'Table' => 'User', 62 'Items' => array( 63 'Login' => array('Type' => 'String', 'Caption' => 'Přihlašovací jméno', 'Default' => ''), 64 'Password' => array('Type' => 'Password', 'Caption' => 'Heslo', 'Default' => ''), 65 'Password2' => array('Type' => 'Password', 'Caption' => 'Potvrzení hesla', 'Default' => ''), 66 'Name' => array('Type' => 'String', 'Caption' => 'Zobrazované jméno', 'Default' => ''), 67 'Email' => array('Type' => 'String', 'Caption' => 'E-mail', 'Default' => ''), 68 'PhoneNumber' => array('Type' => 'String', 'Caption' => 'Telefón', 'Default' => ''), 69 'ICQ' => array('Type' => 'String', 'Caption' => 'ICQ', 'Default' => ''), 70 ), 71 )); 72 $this->System->FormManager->RegisterClass('PasswordRecovery', array( 73 'Title' => 'Obnova hesla', 74 'SubmitText' => 'Obnovit', 75 'Table' => '', 76 'Items' => array( 77 'Name' => array('Type' => 'String', 'Caption' => 'Přihlašovací jméno', 'Default' => ''), 78 'Email' => array('Type' => 'String', 'Caption' => 'E-mail', 'Default' => ''), 79 ), 80 )); 81 $this->System->FormManager->RegisterClass('UserLogin', array( 82 'Title' => 'Přihlášení uživatele', 83 'SubmitText' => 'Přihlásit', 84 'Table' => '', 85 'Items' => array( 86 'Username' => array('Type' => 'String', 'Caption' => 'Přihlašovací jméno', 'Default' => ''), 87 'Password' => array('Type' => 'Password', 'Caption' => 'Heslo', 'Default' => ''), 88 'StayLogged' => array('Type' => 'Boolean', 'Caption' => 'Zůstat přihlášen', 'Default' => '0'), 89 ), 90 )); 91 44 $this->System->ModuleManager->Modules['User']->UserPanel[] = array('PagePortal', 'UserPanel'); 92 45 } 93 46 … … 161 114 function UserPanel() 162 115 { 163 $Output = '<a href="'.$this->System->Link('/ ?Action=UserOptions').'">Profil</a><br />';116 $Output = '<a href="'.$this->System->Link('/user/?Action=UserOptions').'">Profil</a><br />'; 164 117 if($this->System->User->CheckPermission('Finance', 'MemberOptions')) 165 118 $Output .= '<a href="'.$this->System->Link('/?Action=MemberOptions').'">Domácnost</a><br />'; … … 226 179 { 227 180 $Output .= $this->System->ModuleManager->Modules['News']->CustomizeSave(); 228 } else229 if($Action == 'LoginForm')230 {231 $Form = new Form($this->System->FormManager);232 $Form->SetClass('UserLogin');233 $Form->OnSubmit = '?Action=Login';234 $Output .= $Form->ShowEditForm();235 $Output .= '<div class="Centred"><a href="?Action=UserRegister">Registrovat se</a> '.236 '<a href="?Action=PasswordRecovery">Obnova zapomenutého hesla</a></div>';237 } else238 if($Action == 'Login')239 {240 if(array_key_exists('Username', $_POST) and array_key_exists('Password', $_POST))241 {242 $Form = new Form($this->System->FormManager);243 $Form->SetClass('UserLogin');244 $Form->OnSubmit = '?Action=Login';245 if(array_key_exists('StayLogged', $_POST) and ($_POST['StayLogged'] == 'on')) $StayLogged = true;246 else $StayLogged = false;247 $Result = $this->System->User->Login($_POST['Username'], $_POST['Password'], $StayLogged);248 $Output .= $this->SystemMessage('Přihlášení', $Result);249 if($Result <> USER_LOGGED_IN)250 {251 $Form->LoadValuesFromForm();252 $Form->Values['Password'] = '';253 $Output .= $Form->ShowEditForm();254 $Output .= '<div class="Centred"><a href="?Action=UserRegister">Registrovat se</a> '.255 '<a href="?Action=PasswordRecovery">Obnova zapomenutého hesla</a></div>';256 } else {257 //$Output .= '<div class="Centred">Za 5 sekund budete přesměrováni na <a href="?Action=UserMenu">nabídku uživatele</a></div>';258 //Header('refresh:5;url=?Action=UserMenu');259 Header('Location: ?Action=UserMenu');260 }261 } else $Output .= $this->SystemMessage('Přihlášení', 'Nezadány přihlašovací údaje');262 } else263 if($Action == 'Logout')264 {265 if($this->System->User->User['Id'] != null)266 {267 $Output .= $this->SystemMessage('Odhlášení', $this->System->User->Logout());268 } else $Output .= $this->SystemMessage('Nastavení uživatele', 'Nejste přihlášen');269 } else270 if($Action == 'UserOptions')271 {272 if($this->System->User->User['Id'] != null)273 {274 $Form = new Form($this->System->FormManager);275 $Form->SetClass('UserOptions');276 $Form->LoadValuesFromDatabase($this->System->User->User['Id']);277 $Form->OnSubmit = '?Action=UserOptionsSave';278 $Output .= $Form->ShowEditForm();279 } else $Output .= $this->SystemMessage('Nastavení uživatele', 'Nejste přihlášen');280 } else281 if($Action == 'UserOptionsSave')282 {283 $Form = new Form($this->System->FormManager);284 $Form->SetClass('UserOptions');285 $Form->LoadValuesFromForm();286 $Form->SaveValuesToDatabase($this->System->User->User['Id']);287 $Output .= $this->SystemMessage('Nastavení', 'Nastavení uloženo.');288 $this->System->ModuleManager->Modules['Log']->NewRecord('User', 'Nastavení uživatele změněno', $Form->Values['Name']);289 $Form->LoadValuesFromDatabase($this->System->User->User['Id']);290 $Form->OnSubmit = '?Action=UserOptionsSave';291 $Output .= $Form->ShowEditForm();292 } else293 if($Action == 'UserRegister')294 {295 $Form = new Form($this->System->FormManager);296 $Form->SetClass('UserRegister');297 //$Form->LoadValuesFromForm();298 $Form->OnSubmit = '?Action=UserRegisterSave';299 $Output .= $Form->ShowEditForm();300 } else301 if($Action == 'UserRegisterConfirm')302 {303 $Output .= $this->SystemMessage('Potvrzení registrace',304 $this->System->User->RegisterConfirm($_GET['User'], $_GET['H']));305 } else306 if($Action == 'PasswordRecovery')307 {308 $Form = new Form($this->System->FormManager);309 $Form->SetClass('PasswordRecovery');310 $Form->OnSubmit = '?Action=PasswordRecovery2';311 $Output .= $Form->ShowEditForm();312 } else313 if($Action == 'PasswordRecovery2')314 {315 $Form = new Form($this->System->FormManager);316 $Form->SetClass('PasswordRecovery');317 $Form->LoadValuesFromForm();318 $Result = $this->System->User->PasswordRecoveryRequest($Form->Values['Name'], $Form->Values['Email']);319 $Output .= $this->SystemMessage('Obnova hesla', $Result);320 if($Result <> USER_PASSWORD_RECOVERY_SUCCESS)321 {322 $Output .= $Form->ShowEditForm();323 }324 } else325 if($Action == 'PasswordRecoveryConfirm')326 {327 $Output .= $this->SystemMessage('Obnova hesla', $this->System->User->PasswordRecoveryConfirm($_GET['User'], $_GET['H'], $_GET['P']));328 } else329 if($Action == 'UserRegisterSave')330 {331 $Form = new Form($this->System->FormManager);332 $Form->SetClass('UserRegister');333 $Form->LoadValuesFromForm();334 $Result = $this->System->User->Register($Form->Values['Login'], $Form->Values['Password'],335 $Form->Values['Password2'], $Form->Values['Email'], $Form->Values['Name'], $Form->Values['PhoneNumber'], $Form->Values['ICQ']);336 $Output .= $this->SystemMessage('Registrace nového účtu', $Result);337 if($Result <> USER_REGISTRATED)338 {339 $Form->OnSubmit = '?Action=UserRegisterSave';340 $Output .= $Form->ShowEditForm();341 }342 181 } else 343 182 if($Action == 'MemberOptions') … … 396 235 $Form->OnSubmit = '?Action=MemberOptionsSave'; 397 236 $Output .= $Form->ShowEditForm(); 398 } else 399 if($Action == 'UserMenu') 400 { 401 $Output = $this->ShowUserPanel(); 402 } else $Output = $this->ShowMain(); 237 } 403 238 } else $Output = $this->ShowMain(); 404 239 return($Output); … … 439 274 $Output .= '</tr></table>'; 440 275 return($Output); 441 } 442 443 function ShowUserPanel() 444 { 445 $Output = ''; 446 if($this->System->User->User['Id'] != null) 447 { 448 $Output .= '<div class="Centred"><table id="MainTable"><tr><td>'; 449 $Output .= $this->Panel('Nabídka uživatele', $this->UserPanel()); 450 $Output .= '</td><td>'; 451 //$Output .= $this->Panel('Přehled', $this->UserPanel()); 452 $Output .= '</td></tr></table></div>'; 453 } else $Output .= $this->SystemMessage('Oprávnění', 'Nejste přihlášen'); 454 return($Output); 455 } 276 } 456 277 } -
trunk/Modules/User/User.php
r633 r634 2 2 3 3 include_once(dirname(__FILE__).'/UserList.php'); 4 include_once(dirname(__FILE__).'/UserPage.php'); 4 5 5 6 define('LOGIN_USED', 'Přihlašovací jméno již použito.'); … … 164 165 '<br/>\nPokud jste tak neučinili, měli by jste tento email ignorovat.<br/><br/>\n\n'. 165 166 'Váš účet je: '.$Login."\n<br/>Pro dokončení registrace klikněte na tento odkaz: ".'<a href="'. 166 $ServerURL.'/ ?Action=UserRegisterConfirm&User='.167 $ServerURL.'/user/?Action=UserRegisterConfirm&User='. 167 168 $UserId.'&H='.$NewPassword.'">'.$ServerURL.'/?Action=UserRegisterConfirm&User='. 168 169 $UserId.'&H='.$NewPassword.'</a>.'."\n<br> \n\n'. … … 384 385 "Pokud jste tak neučinili, měli by jste tento email ignorovat.<br /><br />\n\nVaše nové heslo k účtu ". 385 386 $Row['Login'].' je: '.$NewPassword."\n<br/>". 386 'Pro aktivaci tohoto hesla klikněte na <a href="'.$ServerURL.'/ ?Action=PasswordRecoveryConfirm&User='.387 'Pro aktivaci tohoto hesla klikněte na <a href="'.$ServerURL.'/user/?Action=PasswordRecoveryConfirm&User='. 387 388 $Row['Id'].'&H='.$Row['Password'].'&P='.$NewPassword.'">tento odkaz</a>.'."\n<br />". 388 389 "Po přihlášení si prosím změňte heslo na nové.\n\n<br><br>Na tento email neodpovídejte.", 'text/html'); … … 418 419 class ModuleUser extends AppModule 419 420 { 421 var $UserPanel; 422 420 423 function __construct($System) 421 424 { … … 427 430 $this->Description = 'User management'; 428 431 $this->Dependencies = array(); 432 $this->UserPanel = array(); 429 433 } 430 434 … … 531 535 if(isset($_SERVER['REMOTE_ADDR'])) $this->System->User->Check(); 532 536 $this->System->RegisterPage('userlist', 'PageUserList'); 537 $this->System->RegisterPage('user', 'PageUser'); 538 $this->System->RegisterPageBarItem('Top', 'User', array($this, 'TopBarCallback')); 539 $this->System->FormManager->RegisterClass('UserLogin', array( 540 'Title' => 'Přihlášení uživatele', 541 'SubmitText' => 'Přihlásit', 542 'Table' => '', 543 'Items' => array( 544 'Username' => array('Type' => 'String', 'Caption' => 'Přihlašovací jméno', 'Default' => ''), 545 'Password' => array('Type' => 'Password', 'Caption' => 'Heslo', 'Default' => ''), 546 'StayLogged' => array('Type' => 'Boolean', 'Caption' => 'Zůstat přihlášen', 'Default' => '0'), 547 ), 548 )); 549 $this->System->FormManager->RegisterClass('UserOptions', array( 550 'Title' => 'Základní nastavení', 551 'Table' => 'User', 552 'SubmitText' => 'Uložit', 553 'Items' => array( 554 'Login' => array('Type' => 'String', 'Caption' => 'Přihlašovací jméno', 'Default' => ''), 555 'Salt' => array('Type' => 'RandomHash', 'Caption' => 'Sůl', 'Default' => ''), 556 'Password' => array('Type' => 'Password', 'Caption' => 'Heslo', 'Default' => ''), 557 'Name' => array('Type' => 'String', 'Caption' => 'Zobrazované jméno', 'Default' => ''), 558 'Email' => array('Type' => 'String', 'Caption' => 'E-mail', 'Default' => ''), 559 'PhoneNumber' => array('Type' => 'String', 'Caption' => 'Telefón', 'Default' => ''), 560 'ICQ' => array('Type' => 'String', 'Caption' => 'ICQ', 'Default' => ''), 561 ), 562 )); 563 $this->System->FormManager->RegisterClass('UserRegister', array( 564 'Title' => 'Registrace uživatele', 565 'SubmitText' => 'Registrovat', 566 'Table' => 'User', 567 'Items' => array( 568 'Login' => array('Type' => 'String', 'Caption' => 'Přihlašovací jméno', 'Default' => ''), 569 'Password' => array('Type' => 'Password', 'Caption' => 'Heslo', 'Default' => ''), 570 'Password2' => array('Type' => 'Password', 'Caption' => 'Potvrzení hesla', 'Default' => ''), 571 'Name' => array('Type' => 'String', 'Caption' => 'Zobrazované jméno', 'Default' => ''), 572 'Email' => array('Type' => 'String', 'Caption' => 'E-mail', 'Default' => ''), 573 'PhoneNumber' => array('Type' => 'String', 'Caption' => 'Telefón', 'Default' => ''), 574 'ICQ' => array('Type' => 'String', 'Caption' => 'ICQ', 'Default' => ''), 575 ), 576 )); 577 $this->System->FormManager->RegisterClass('PasswordRecovery', array( 578 'Title' => 'Obnova hesla', 579 'SubmitText' => 'Obnovit', 580 'Table' => '', 581 'Items' => array( 582 'Name' => array('Type' => 'String', 'Caption' => 'Přihlašovací jméno', 'Default' => ''), 583 'Email' => array('Type' => 'String', 'Caption' => 'E-mail', 'Default' => ''), 584 ), 585 )); 533 586 $this->System->FormManager->RegisterClass('User', array( 534 587 'Title' => 'Uživatelé', … … 595 648 { 596 649 } 650 651 function TopBarCallback() 652 { 653 if($this->System->User->User['Id'] == null) 654 $Output = '<a href="'.$this->System->Link('/user/?Action=LoginForm').'">Přihlášení</a> '. 655 '<a href="'.$this->System->Link('/user/?Action=UserRegister').'">Registrace</a>'; 656 else $Output = $this->System->User->User['Name']. 657 ' <a href="'.$this->System->Link('/user/?Action=UserMenu').'">Nabídka</a>'. 658 ' <a href="'.$this->System->Link('/user/?Action=Logout').'">Odhlásit</a>'; 659 // <a href="'.$this->System->Link('/?Action=UserOptions').'">Nastavení</a>'; 660 return($Output); 661 } 597 662 }
Note:
See TracChangeset
for help on using the changeset viewer.