Changeset 95 for trunk/Application
- Timestamp:
- Dec 6, 2021, 11:33:48 AM (3 years ago)
- Location:
- trunk/Application
- Files:
-
- 4 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/Application/BaseView.php
r94 r95 3 3 class BaseView extends View 4 4 { 5 function ShowPage( $Content)5 function ShowPage(string $Content): string 6 6 { 7 7 global $ReleaseTime, $Revision; … … 22 22 ' <a href="https://app.zdechov.net/estetistic/">Zdrojový kód</a></div>'; 23 23 $Output .= '</body></html>'; 24 echo($Output);24 return $Output; 25 25 } 26 26 27 function GetOutput( $Page)27 function GetOutput(Page $Page): string 28 28 { 29 29 $Output = $this->ShowPage($Page->Show()); -
trunk/Application/Core.php
r92 r95 6 6 include_once(dirname(__FILE__).'/../Global.php'); 7 7 include_once(dirname(__FILE__).'/Version.php'); 8 include_once(dirname(__FILE__).'/ View.php');8 include_once(dirname(__FILE__).'/BaseView.php'); 9 9 include_once(dirname(__FILE__).'/UpdateTrace.php'); 10 10 include_once(dirname(__FILE__).'/DefaultConfig.php'); 11 11 12 class Core extends Application12 class Core extends System 13 13 { 14 var$Pages;15 var$ShowPage;16 var$BaseURL;17 var$UseSession;14 public array $Pages; 15 public bool $ShowPage; 16 public string $BaseURL; 17 public bool $UseSession; 18 18 19 19 function __construct() … … 28 28 } 29 29 30 function RunCommon() 30 function RunCommon(): void 31 31 { 32 32 global $Config, $DatabaseRevision, $WithoutSessionStart; … … 38 38 //$ErrorHandler->Start(); 39 39 40 try { 40 try 41 { 41 42 $this->Database = new Database(); 42 43 $this->Database->Connect($Config['Database']['Host'], $Config['Database']['User'], … … 55 56 $this->Config = &$Config; 56 57 57 // Register and start existing modules 58 $this->Setup = new Setup($this); 59 $this->Setup->Start(); 60 if ($this->Setup->CheckState()) 58 $this->StartModules(); 59 } 60 61 function StartModules(): void 62 { 63 $ModuleSetup = $this->ModuleManager->LoadModule(dirname(__FILE__).'/../Packages/Common/Modules/Setup.php'); 64 $ModuleSetup->Install(); 65 $ModuleSetup->Start(); 66 $this->ModuleManager->LoadModules(); 67 $this->ModuleManager->LoadModule(dirname(__FILE__).'/../Packages/Common/Modules/ModuleManager.php'); 68 if (file_exists($this->ModuleManager->FileName)) $this->ModuleManager->LoadState(); 69 if (ModuleSetup::Cast($ModuleSetup)->CheckState()) 61 70 { 62 $this->ModuleManager->Start ();71 $this->ModuleManager->StartAll(array(ModuleCondition::Enabled)); 63 72 } 64 73 } 65 74 66 function Run() 75 function Run(): void 67 76 { 68 77 $this->RunCommon(); … … 74 83 } 75 84 76 function ShowPage() 85 static function Cast(System $System): Core 86 { 87 if ($System instanceof Core) 88 { 89 return $System; 90 } 91 throw new Exception('Expected Core type but '.gettype($System)); 92 } 93 94 function ShowPage(): void 77 95 { 78 96 $this->BaseView = new BaseView($this); … … 89 107 } 90 108 91 function RegisterPage($Path, $Handler) 92 { 93 if (is_array($Path)) 94 { 95 $Page = &$this->Pages; 96 $LastKey = array_pop($Path); 97 foreach ($Path as $PathItem) 98 { 99 $Page = &$Page[$PathItem]; 100 } 101 if (!is_array($Page)) $Page = array('' => $Page); 102 $Page[$LastKey] = $Handler; 103 } else $this->Pages[$Path] = $Handler; 104 } 105 106 function UnregisterPage($Path) 107 { 108 unset($this->Pages[$Path]); 109 } 110 111 function SearchPage($PathItems, $Pages) 109 function SearchPage(array $PathItems, array $Pages): string 112 110 { 113 111 if (count($PathItems) > 0) $PathItem = $PathItems[0]; … … 123 121 } 124 122 125 function Link( $Target)123 function Link(string $Target): string 126 124 { 127 125 return $this->BaseURL.$Target; … … 138 136 } 139 137 140 function Show() 138 function Show(): string 141 139 { 142 140 Header($_SERVER['SERVER_PROTOCOL'].' 404 Not Found'); -
trunk/Application/DefaultConfig.php
r92 r95 3 3 class DefaultConfig 4 4 { 5 function Get() 5 function Get(): array 6 6 { 7 7 $IsDeveloper = in_array($_SERVER['REMOTE_ADDR'], array('127.0.0.1')); -
trunk/Application/UpdateTrace.php
r92 r95 1 1 <?php 2 2 3 function FullInstall($Manager) 3 function FullInstall($Manager): void 4 4 { 5 5 $Manager->Execute('CREATE TABLE IF NOT EXISTS `SystemVersion` ( … … 29 29 } 30 30 31 function UpdateTo67($Manager) 31 function UpdateTo67($Manager): void 32 32 { 33 33 $Manager->Execute('RENAME TABLE `measure` TO `Measure`;'); … … 58 58 } 59 59 60 function UpdateTo79($Manager) 60 function UpdateTo79($Manager): void 61 61 { 62 62 $DbResult = $Manager->Execute('SELECT `DataTable`,`DataType` FROM `Measure`;'); … … 78 78 class Updates 79 79 { 80 function Get() 80 function Get(): array 81 81 { 82 82 return array( -
trunk/Application/Version.php
r94 r95 6 6 // and system will need database update. 7 7 8 $Revision = 9 4;8 $Revision = 95; 9 9 $DatabaseRevision = 79; 10 $ReleaseTime = strtotime('202 0-05-25');10 $ReleaseTime = strtotime('2021-12-06');
Note:
See TracChangeset
for help on using the changeset viewer.