Changeset 657
- Timestamp:
- May 25, 2014, 8:29:03 PM (10 years ago)
- Location:
- trunk
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Application/FormClasses.php
r647 r657 760 760 'Filter' => '1', 761 761 ), 762 'TFinanceInvoiceItemListInvoice' => array( 762 'TNetworkInterfaceUpDown' => array( 763 'Type' => 'ManyToOne', 764 'Table' => 'NetworkInterfaceUpDown', 765 'Id' => 'Id', 766 'Ref' => 'Interface', 767 'Filter' => '1', 768 ), 769 'TFinanceInvoiceItemListInvoice' => array( 763 770 'Type' => 'ManyToOne', 764 771 'Table' => 'FinanceInvoiceItem', -
trunk/Application/System.php
r634 r657 13 13 /** @var Database */ 14 14 var $Database; 15 var $Modules; 15 var $Modules; 16 16 /** @var Type */ 17 17 var $Type; … … 38 38 if(substr($this->RootURLFolder, -10, 10) == '/index.php') 39 39 $this->RootURLFolder = substr($this->RootURLFolder, 0, -10); 40 } 41 40 } 41 42 42 function RegisterPage($Path, $Handler) 43 43 { … … 48 48 foreach($Path as $PathItem) 49 49 { 50 $Page = &$Page[$PathItem]; 50 $Page = &$Page[$PathItem]; 51 51 } 52 52 if(!is_array($Page)) $Page = array('' => $Page); … … 54 54 } else $this->Pages[$Path] = $Handler; 55 55 } 56 56 57 57 function UnregisterPage($Path) 58 58 { 59 unset($this->Pages[$Path]); 60 } 61 59 unset($this->Pages[$Path]); 60 } 61 62 62 function SearchPage($PathItems, $Pages) 63 63 { … … 66 66 if(array_key_exists($PathItem, $Pages)) 67 67 { 68 if(is_array($Pages[$PathItem])) 68 if(is_array($Pages[$PathItem])) 69 69 { 70 70 array_shift($PathItems); … … 73 73 } else return(''); 74 74 } 75 75 76 76 function PageNotFound() 77 77 { 78 78 return('Page '.implode('/', $this->PathItems).' not found.'); 79 79 } 80 80 81 81 function ShowPage() 82 82 { 83 83 /* @var $Page Page */ 84 $ClassName = $this->SearchPage($this->PathItems, $this->Pages); 85 if($ClassName != '') 84 $ClassName = $this->SearchPage($this->PathItems, $this->Pages); 85 if($ClassName != '') 86 86 { 87 87 $Page = new $ClassName($this); … … 92 92 } 93 93 } 94 94 95 95 function ModulePresent($Name) 96 96 { … … 103 103 $this->Modules[get_class($Module)] = $Module; 104 104 } 105 105 106 106 function HumanDate($Time) 107 107 { 108 108 return(date('j.n.Y', $Time)); 109 109 } 110 110 111 111 function Link($Target) 112 112 { 113 113 return($this->RootURLFolder.$Target); 114 114 } 115 115 116 116 function ShowAction($Id) 117 117 { … … 136 136 global $Database, $ScriptTimeStart, $ConfigFileName, $Mail, $Type, 137 137 $DatabaseRevision, $Config; 138 138 139 139 date_default_timezone_set('Europe/Prague'); 140 140 mb_internal_encoding("UTF-8"); 141 141 $ScriptTimeStart = GetMicrotime(); 142 142 143 143 // SQL injection hack protection 144 144 foreach($_POST as $Index => $Item) $_POST[$Index] = addslashes($Item); … … 147 147 if(isset($_SERVER['REMOTE_ADDR'])) session_start(); 148 148 149 $ConfigFileName = dirname(__FILE__).'/../config.php'; 150 if(file_exists($ConfigFileName)) 149 $ConfigFileName = dirname(__FILE__).'/../config.php'; 150 if(file_exists($ConfigFileName)) 151 151 $this->ConfigManager->LoadFromFile($ConfigFileName); 152 152 //$this->Config = $this->ConfigManager->GetAsArray(); 153 153 $this->Config = &$Config; 154 155 try { 156 $this->Database->Connect($this->Config['Database']['Host'], $this->Config['Database']['User'], 154 155 try { 156 $this->Database->Connect($this->Config['Database']['Host'], $this->Config['Database']['User'], 157 157 $this->Config['Database']['Password'], $this->Config['Database']['Database']); 158 158 $this->Database->Prefix = $this->Config['Database']['Prefix']; … … 166 166 $this->RootURLFolder = $this->Config['Web']['RootFolder']; 167 167 $this->FormManager->Root = $this->RootURLFolder; 168 168 169 169 $this->RegisterPageBar('Top'); 170 171 $Database = $this->Database; 172 RegisterFormClasses($this->FormManager); 173 170 171 $Database = $this->Database; 172 RegisterFormClasses($this->FormManager); 173 174 174 // Register and start existing modules 175 175 $this->Setup = new Setup($this); … … 183 183 $this->PathItems = ProcessURL(); 184 184 $this->ShowPage(); 185 } 186 } 187 185 } 186 } 187 188 188 function RegisterPageBar($Name) 189 189 { … … 206 206 var $FullTitle = 'Stránka nenalezena'; 207 207 var $ShortTitle = 'Stránka nenalezena'; 208 208 209 209 function __construct($System) 210 210 { … … 215 215 function Show() 216 216 { 217 Header($_SERVER['SERVER_PROTOCOL'].' 404 Not Found'); 217 Header($_SERVER['SERVER_PROTOCOL'].' 404 Not Found'); 218 218 return('<h3 align="center">Požadovaná stránka neexistuje.</h3>'); 219 219 } -
trunk/Application/Version.php
r656 r657 1 1 <?php 2 2 3 $Revision = 65 6; // Subversion revision4 $DatabaseRevision = 65 6; // SQL structure revision5 $ReleaseTime = strtotime('2014-05- 16');3 $Revision = 657; // Subversion revision 4 $DatabaseRevision = 657; // SQL structure revision 5 $ReleaseTime = strtotime('2014-05-25'); -
trunk/Common/AppModule.php
r613 r657 335 335 function LoadModulesFromDir($Directory) 336 336 { 337 $List = scandir($Directory);337 $List = scandir($Directory); 338 338 foreach($List as $Item) 339 339 { … … 349 349 function LoadModules() 350 350 { 351 351 if(method_exists($this->OnLoadModules[0], $this->OnLoadModules[1])) 352 352 $this->OnLoadModules(); 353 353 else $this->LoadModulesFromDir(dirname(__FILE__).'/../Modules'); -
trunk/Common/Setup/Updates.php
r656 r657 706 706 } 707 707 708 function UpdateTo657($Manager) 709 { 710 $Manager->Execute('CREATE TABLE IF NOT EXISTS `NetworkInterfaceUpDown` ( 711 `Id` int(11) NOT NULL AUTO_INCREMENT, 712 `Time` datetime NOT NULL, 713 `Interface` int(11) NOT NULL, 714 `State` int(11) NOT NULL, 715 PRIMARY KEY (`Id`), 716 KEY `Interface` (`Interface`) 717 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=1 ;'); 718 $Manager->Execute('ALTER TABLE `NetworkInterfaceUpDown` 719 ADD CONSTRAINT `NetworkInterfaceUpDown_ibfk_1` FOREIGN KEY (`Interface`) REFERENCES `NetworkInterface` (`Id`);'); 720 $Manager->Execute("INSERT INTO `Action` ( 721 `Id` ,`Name` ,`Title` ,`Type` ,`URL` ,`Group` ,`Icon` ,`PermissionOperation` , 722 `Enable`) VALUES (NULL , '', 'Změny stavu rozhraní', '1', '/is/?t=NetworkInterfaceUpDown&a=list', NULL , NULL , NULL , '1' 723 );"); 724 $ActionId = $Manager->Database->insert_id; 725 $Manager->Execute("INSERT INTO `MenuItem` (`Id` ,`Name` ,`Parent` ,`Action` ,`Menu`) ". 726 "VALUES (NULL , 'Změny stavu rozhraní', 4, '".$ActionId."', '1');"); 727 } 728 708 729 class Updates 709 730 { … … 745 766 645 => array('Revision' => 646, 'Function' => 'UpdateTo646'), 746 767 646 => array('Revision' => 647, 'Function' => 'UpdateTo647'), 768 647 => array('Revision' => 657, 'Function' => 'UpdateTo657'), 747 769 )); 748 770 } -
trunk/Modules/Network/Network.php
r647 r657 230 230 'Links1' => array('Type' => 'TNetworkLinkListInterface1', 'Caption' => 'Propojení 1', 'Default' => ''), 231 231 'Links2' => array('Type' => 'TNetworkLinkListInterface2', 'Caption' => 'Propojení 2', 'Default' => ''), 232 'UpDown' => array('Type' => 'TNetworkInterfaceUpDown', 'Caption' => 'Změny stavu', 'Default' => ''), 232 233 ), 233 234 )); -
trunk/Modules/NetworkConfigRouterOS/Generators/NetwatchImport.php
r626 r657 15 15 16 16 // Load netwatch status from all DHCP routers 17 $DbResult3 = $System->Database->query('SELECT DHCP, AddressRange, Mask FROM `NetworkSubnet` WHERE (`Configure` = 1) AND (`Member` IS NULL) GROUP BY DHCP'); 17 $DbResult3 = $System->Database->query('SELECT `DHCP`, `AddressRange`, `Mask` FROM `NetworkSubnet` '. 18 'WHERE (`Configure` = 1) AND (`Member` IS NULL) GROUP BY DHCP'); 18 19 while($Subnet = $DbResult3->fetch_assoc()) 19 20 { … … 26 27 foreach($List as $Properties) 27 28 { 28 if($Properties['status'] == 'up') 29 if($Properties['status'] == 'up') $Online = 1; 30 else $Online = 0; 31 32 $DbResult = $System->Database->select('NetworkInterface', 'Online', '`LocalIP` = "'.$Properties['host'].'";'); 33 while($DbRow = $DbResult->fetch_assoc()) 34 { 35 $LastOnline = $DbRow['Online']; 36 $Interface = $DbRow['NetworkInterface']; 37 38 // Record state changes 39 if($Online != $LastOnline) 40 { 41 $System->Database->insert('NetworkInterfaceUpDown', array( 42 'Interface' => $Interface, 'State' => $Online, 'Time' => TimeToMysqlDateTime($StartTime))); 43 } 44 }; 45 46 if($Online) 29 47 { 30 48 $DbResult = $System->Database->update('NetworkInterface', '`LocalIP` = "'.$Properties['host'].'"', -
trunk/Modules/NetworkConfigRouterOS/NetworkConfigRouterOS.php
r617 r657 27 27 function DoStart() 28 28 { 29 $this->System->FormManager->RegisterClass('NetworkInterfaceUpDown', array( 30 'Title' => 'Změny stavu rozhraní', 31 'Table' => 'NetworkInterfaceUpDown', 32 'Items' => array( 33 'Time' => array('Type' => 'DateTime', 'Caption' => 'Čas', 'Default' => '', 'ReadOnly' => true), 34 'Interface' => array('Type' => 'TNetworkInterface', 'Caption' => 'Rozhraní', 'Default' => '', 'ReadOnly' => true), 35 'State' => array('Type' => 'Boolean', 'Caption' => 'Stav', 'Default' => '', 'ReadOnly' => true), 36 ), 37 )); 29 38 } 30 39 }
Note:
See TracChangeset
for help on using the changeset viewer.