Changeset 9
- Timestamp:
- Jun 1, 2023, 1:01:38 AM (18 months ago)
- Location:
- trunk
- Files:
-
- 1 deleted
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Application/Version.php
r8 r9 6 6 // and system will need database update. 7 7 8 $Revision = 8;9 $DatabaseRevision = 8;8 $Revision = 9; 9 $DatabaseRevision = 7; 10 10 $ReleaseTime = strtotime('2023-06-01'); -
trunk/Global.php
r7 r9 1 1 <?php 2 2 3 function HumanDate( $Time)3 function HumanDate(?string $Time): string 4 4 { 5 5 return date('j.n.Y', $Time); 6 6 } 7 7 8 function GetMicrotime() 8 function GetMicrotime(): float 9 9 { 10 list($Usec, $Sec) = explode( " ", microtime());10 list($Usec, $Sec) = explode(' ', microtime()); 11 11 return (float)$Usec + (float)$Sec; 12 } 12 } 13 13 14 function MakeLink( $Target, $Title)14 function MakeLink(string $Target, string $Title): string 15 15 { 16 16 return '<a href="'.$Target.'">'.$Title.'</a>'; 17 17 } 18 18 19 function Table( $Table)19 function Table(array $Table): string 20 20 { 21 $Result = '<table cellspacing="0" class="BasicTable">'; 22 $Result .= '<tr>'; 23 foreach ($Table['Header'] as $Item) 24 $Result .= '<th>'.$Item.'</th>'; 25 $Result .= '</tr>'; 21 $Result = '<table class="BasicTable">'; 22 if (array_key_exists('Header', $Table)) 23 { 24 $Result .= '<tr>'; 25 foreach ($Table['Header'] as $Item) 26 $Result .= '<th>'.$Item.'</th>'; 27 $Result .= '</tr>'; 28 } 26 29 foreach ($Table['Rows'] as $Row) 27 30 { 28 31 $Result .= '<tr>'; 29 foreach ($Row as $Item) 30 $Result .= '<td>'.$Item.'</td>'; 32 foreach ($Row as $Index => $Item) 33 { 34 if ($Index == 0) $Class = ' class="Header"'; else $Class = ''; 35 $Result .= '<td'.$Class.' style="width: '.(floor(100 / count($Row))).'%">'.$Item.'</td>'; 36 } 31 37 $Result .= '</tr>'; 32 38 } … … 35 41 } 36 42 37 function ShowEditTable( $ClassName, $Values)43 function ShowEditTable(string $ClassName, array $Values): string 38 44 { 39 45 global $Classes, $Types; … … 68 74 } 69 75 70 function ProcessURL() 76 function ProcessURL(): array 71 77 { 72 78 if (array_key_exists('REDIRECT_QUERY_STRING', $_SERVER)) … … 82 88 } 83 89 84 function GetQueryStringArray( $QueryString)90 function GetQueryStringArray(string $QueryString): array 85 91 { 86 92 $Result = array(); … … 98 104 } 99 105 100 function SetQueryStringArray( $QueryStringArray)106 function SetQueryStringArray(array $QueryStringArray): string 101 107 { 102 108 $Parts = array(); … … 108 114 } 109 115 110 function GetRemoteAddress() 116 function GetRemoteAddress(): string 111 117 { 112 118 if (array_key_exists('REMOTE_ADDR', $_SERVER)) $IP = $_SERVER['REMOTE_ADDR']; -
trunk/Modules/Map/ModuleMap.php
r8 r9 1 1 <?php 2 3 include_once(dirname(__FILE__).'/Map.php'); 4 include_once(dirname(__FILE__).'/MapGoogle.php'); 5 include_once(dirname(__FILE__).'/MapOSM.php'); 6 include_once(dirname(__FILE__).'/MapSeznam.php'); 2 7 3 8 class ModuleMap extends Module -
trunk/Modules/User/ModuleUser.php
r8 r9 133 133 $this->System->User = new User($this->System); 134 134 if (isset($_SERVER['REMOTE_ADDR'])) $this->System->User->Check(); 135 $this->System->RegisterPage( 'userlist', 'PageUserList');136 $this->System->RegisterPage( 'user', 'PageUser');135 $this->System->RegisterPage(['userlist'], 'PageUserList'); 136 $this->System->RegisterPage(['user'], 'PageUser'); 137 137 $this->System->RegisterPageBarItem('Top', 'User', array($this, 'TopBarCallback')); 138 138 $this->System->FormManager->RegisterClass('UserLogin', array( -
trunk/Modules/User/PasswordHash.php
r8 r9 1 1 <?php 2 2 3 3 4 class PasswordHash 4 5 { 5 function Hash( $Password, $Salt)6 function Hash(string $Password, string $Salt): string 6 7 { 7 8 return sha1(sha1($Password).$Salt); 8 9 } 9 10 10 function Verify( $Password, $Salt, $StoredHash)11 function Verify(string $Password, string $Salt, string $StoredHash): bool 11 12 { 12 13 return $this->Hash($Password, $Salt) == $StoredHash; 13 14 } 14 15 15 function GetSalt() 16 function GetSalt(): string 16 17 { 17 mt_srand( microtime(true) * 100000 + memory_get_usage(true));18 mt_srand(intval(microtime(true)) * 100000 + memory_get_usage(true)); 18 19 return sha1(uniqid(mt_rand(), true)); 19 20 } -
trunk/Modules/User/User.php
r8 r9 143 143 144 144 // Send activation mail to user email 145 $ServerURL = 'http://'. $this->System->Config['Web']['Host'].$this->System->Config['Web']['RootFolder'];145 $ServerURL = 'http://'.Core::Cast($this->System)->Config['Web']['Host'].Core::Cast($this->System)->Config['Web']['RootFolder']; 146 146 $Mail = new Mail(); 147 147 $Mail->Subject = 'Registrace nového účtu'; … … 154 154 '<br/><br/>Na tento email neodpovídejte.", 'text/html'); 155 155 $Mail->AddTo($Email, $Name); 156 $Mail->From = $this->System->Config['Web']['Title'].' <noreplay@zdechov.net>';156 $Mail->From = Core::Cast($this->System)->Config['Web']['Title'].' <noreplay@zdechov.net>'; 157 157 $Mail->Send(); 158 158 … … 368 368 $NewPassword = substr(sha1(strtoupper($Row['Login'])), 0, 7); 369 369 370 $ServerURL = 'http://'. $this->System->Config['Web']['Host'].$this->System->Config['Web']['RootFolder'];370 $ServerURL = 'http://'.Core::Cast($this->System)->Config['Web']['Host'].Core::Cast($this->System)->Config['Web']['RootFolder']; 371 371 $Mail = new Mail(); 372 372 $Mail->Subject = 'Obnova hesla'; 373 $Mail->From = $this->System->Config['Web']['Title'].' <noreplay@zdechov.net>';373 $Mail->From = Core::Cast($this->System)->Config['Web']['Title'].' <noreplay@zdechov.net>'; 374 374 $Mail->AddTo($Row['Email'], $Row['Name']); 375 375 $Mail->AddBody('Požádali jste o zaslání nového hesla na serveru <a href="'.$ServerURL.'">'.$ServerURL.'"</a>.<br />\n'. -
trunk/Packages/Common/Modules/ModuleAdmin.php
r8 r9 8 8 { 9 9 parent::__construct($System); 10 $this->Name = ' ModuleManager';10 $this->Name = 'Admin'; 11 11 $this->Version = '1.0'; 12 12 $this->Creator = 'Chronos'; … … 49 49 ), 50 50 )); 51 $this->System->FormManager->RegisterFormType('TModule', array(51 Core::Cast($this->System)->FormManager->RegisterFormType('TModule', array( 52 52 'Type' => 'Reference', 53 53 'Table' => 'Module', … … 56 56 'Filter' => '1', 57 57 )); 58 $this->System->FormManager->RegisterFormType('TModelListModule', array(58 Core::Cast($this->System)->FormManager->RegisterFormType('TModelListModule', array( 59 59 'Type' => 'ManyToOne', 60 60 'Table' => 'Model', … … 63 63 'Filter' => '1', 64 64 )); 65 $this->System->FormManager->RegisterClass('Model', array(65 Core::Cast($this->System)->FormManager->RegisterClass('Model', array( 66 66 'Title' => 'Modely', 67 67 'Table' => 'Model', … … 76 76 ), 77 77 )); 78 $this->System->FormManager->RegisterFormType('TModel', array(78 Core::Cast($this->System)->FormManager->RegisterFormType('TModel', array( 79 79 'Type' => 'Reference', 80 80 'Table' => 'Model', … … 83 83 'Filter' => '1', 84 84 )); 85 $this->System->FormManager->RegisterFormType('TModelFieldListModel', array(85 Core::Cast($this->System)->FormManager->RegisterFormType('TModelFieldListModel', array( 86 86 'Type' => 'ManyToOne', 87 87 'Table' => 'ModelField', … … 90 90 'Filter' => '1', 91 91 )); 92 $this->System->FormManager->RegisterClass('ModelField', array(92 Core::Cast($this->System)->FormManager->RegisterClass('ModelField', array( 93 93 'Title' => 'Pole modelu', 94 94 'Table' => 'ModelField', … … 104 104 ), 105 105 )); 106 $this->System->FormManager->RegisterFormType('TModuleLink', array(106 Core::Cast($this->System)->FormManager->RegisterFormType('TModuleLink', array( 107 107 'Type' => 'Reference', 108 108 'Table' => 'ModuleLink', … … 111 111 'Filter' => '1', 112 112 )); 113 $this->System->FormManager->RegisterFormType('TModuleLinkListModule', array(113 Core::Cast($this->System)->FormManager->RegisterFormType('TModuleLinkListModule', array( 114 114 'Type' => 'ManyToOne', 115 115 'Table' => 'ModuleLink', … … 118 118 'Filter' => '1', 119 119 )); 120 $this->System->FormManager->RegisterClass('ModuleLink', array(120 Core::Cast($this->System)->FormManager->RegisterClass('ModuleLink', array( 121 121 'Title' => 'Vazby modulu', 122 122 'Table' => 'ModuleLink', … … 127 127 ), 128 128 )); 129 $this->System->FormManager->RegisterFormType('TModule', array(129 Core::Cast($this->System)->FormManager->RegisterFormType('TModule', array( 130 130 'Type' => 'Reference', 131 131 'Table' => 'Module', … … 250 250 'Type' => ModelColumnType::GetName($Field->Type), 'Nullable' => (int)$Field->Nullable)); 251 251 } 252 if ($ModelDesc->DefaultValues != null)253 { 254 $Values = call_user_func('self::'.$ModelDesc->DefaultValues );252 if ($ModelDesc->DefaultValuesMethod != null) 253 { 254 $Values = call_user_func('self::'.$ModelDesc->DefaultValuesMethod); 255 255 foreach ($Values as $Value) 256 256 { … … 303 303 { 304 304 //DebugLog('Loading modules...'); 305 $this->Modules = array();306 305 $Query = 'SELECT `Id`, `Name`,`Installed` FROM `Module`'; 307 306 $DbResult = $this->Database->query($Query); … … 492 491 $Output = ''; 493 492 494 $Pageing = new Paging( );493 $Pageing = new Paging($this->System); 495 494 $Pageing->TotalCount = count($this->System->ModuleManager->Modules); 496 $Table = new VisualTable( );495 $Table = new VisualTable($this->System); 497 496 $Table->SetColumns(array( 498 497 array('Name' => 'Name', 'Title' => T('Name')), -
trunk/Packages/Common/Paging.php
r8 r9 8 8 public string $SQLLimit; 9 9 public int $Page; 10 private System $System; 10 11 11 function __construct( )12 function __construct(System $System) 12 13 { 13 global $System; 14 15 $this->ItemPerPage = $System->Config['Web']['ItemsPerPage']; 16 $this->Around = $System->Config['Web']['VisiblePagingItems']; 14 $this->System = $System; 15 $this->ItemPerPage = Core::Cast($this->System)->Config['Web']['ItemsPerPage']; 16 $this->Around = Core::Cast($this->System)->Config['Web']['VisiblePagingItems']; 17 17 } 18 18 -
trunk/Packages/Common/System.php
r8 r9 39 39 { 40 40 if (array_key_exists($Name, $this->ModuleManager->Modules)) 41 { 41 42 return $this->ModuleManager->Modules[$Name]; 42 else return null; 43 } 44 else 45 { 46 echo('Module '.$Name.' not registered.'); 47 } 43 48 } 44 49 -
trunk/Packages/Common/Table.php
r8 r9 99 99 private array $OrderDirSQL; 100 100 101 function __construct( )101 function __construct(System $System) 102 102 { 103 global $System;104 105 103 $this->Columns = array(); 106 104 $this->Table = new TableMemory(); 107 105 $this->OrderDirSQL = array('ASC', 'DESC'); 108 $this->OrderArrowImage = array( $System->Link('/images/sort_asc.png'),106 $this->OrderArrowImage = array(Core::Cast($System)->Link('/images/sort_asc.png'), 109 107 $System->Link('/images/sort_desc.png')); 110 108 $this->DefaultOrder = 0;
Note:
See TracChangeset
for help on using the changeset viewer.