Changeset 524
- Timestamp:
- Apr 20, 2013, 8:51:15 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 1 deleted
- 31 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/Common/AppModule.php
r469 r524 24 24 $this->System = &$System; 25 25 $this->Database = &$System->Database; 26 $this->Installed = false; 26 27 } 27 28 … … 86 87 unset($this->Modules[array_search($Module, $this->Modules)]); 87 88 } 89 90 /* @return Module */ 91 function SearchModuleById($Id) 92 { 93 foreach($this->Modules as $Module) 94 { 95 //DebugLog($Module->Name.' '.$Module->Id); 96 if($Module->Id == $Id) return($Module->Name); 97 } 98 return(''); 99 } 100 88 101 } 89 102 -
trunk/Common/Database.php
r503 r524 71 71 $this->Error = $this->Error[2]; 72 72 if(($this->Error != '') and ($this->ShowSQLError == true)) 73 //echo('<div><strong>SQL Error: </strong>'.$this->Error.'<br />'.$Query.'</div>');73 echo('<div><strong>SQL Error: </strong>'.$this->Error.'<br />'.$Query.'</div>'); 74 74 throw new Exception('SQL Error: </strong>'.$this->Error.', Query: '.$Query); 75 75 } -
trunk/Common/Global.php
r522 r524 15 15 include_once(dirname(__FILE__).'/Database.php'); 16 16 include_once(dirname(__FILE__).'/Code.php'); 17 include_once(dirname(__FILE__).'/System.php'); 17 18 include_once(dirname(__FILE__).'/Mail.php'); 18 include_once(dirname(__FILE__).'/Log.php');19 include_once(dirname(__FILE__).'/User.php');20 19 include_once(dirname(__FILE__).'/Page.php'); 21 20 include_once(dirname(__FILE__).'/Form/Form.php'); … … 23 22 24 23 // Application modules 24 include_once(dirname(__FILE__).'/../Modules/System/System.php'); 25 25 include_once(dirname(__FILE__).'/../Modules/Error/Error.php'); 26 include_once(dirname(__FILE__).'/../Modules/Log/Log.php'); 26 27 include_once(dirname(__FILE__).'/../Modules/File/File.php'); 27 28 include_once(dirname(__FILE__).'/../Modules/Meteostation/Meteostation.php'); … … 45 46 include_once(dirname(__FILE__).'/../Modules/NetworkConfigRouterOS/NetworkConfigRouterOS.php'); 46 47 47 class System extends Module48 {49 var $Modules;50 /** @var Type */51 var $Type;52 var $Pages;53 /** @var AppModuleManager */54 var $ModuleManager;55 var $PathItems;56 var $RootURLFolder;57 58 function __construct()59 {60 parent::__construct();61 $this->Modules = array();62 $this->Pages = array();63 $this->ModuleManager = new AppModuleManager();64 $this->Database = new Database();65 $this->FormManager = new FormManager($this->Database);66 }67 68 function RegisterPage($Path, $Handler)69 {70 if(is_array($Path))71 {72 $Page = &$this->Pages;73 $LastKey = array_pop($Path);74 foreach($Path as $PathItem)75 {76 $Page = &$Page[$PathItem];77 }78 if(!is_array($Page)) $Page = array('' => $Page);79 $Page[$LastKey] = $Handler;80 } else $this->Pages[$Path] = $Handler;81 }82 83 function SearchPage($PathItems, $Pages)84 {85 if(count($PathItems) > 0) $PathItem = $PathItems[0];86 else $PathItem = '';87 if(array_key_exists($PathItem, $Pages))88 {89 if(is_array($Pages[$PathItem]))90 {91 array_shift($PathItems);92 return($this->SearchPage($PathItems, $Pages[$PathItem]));93 } else return($Pages[$PathItem]);94 } else return('');95 }96 97 function PageNotFound()98 {99 return('Page '.implode('/', $this->PathItems).' not found.');100 }101 102 function ShowPage()103 {104 /* @var $Page Page */105 $ClassName = $this->SearchPage($this->PathItems, $this->Pages);106 if($ClassName != '')107 {108 $Page = new $ClassName();109 $Page->System = &$this;110 $Page->Database = &$this->Database;111 $Page->GetOutput();112 } else echo($this->PageNotFound());113 }114 115 function ModulePresent($Name)116 {117 return(array_key_exists($Name, $this->Modules));118 }119 120 function AddModule($Module)121 {122 //echo('Přidávám modul '.get_class($Module).'<br />');123 $Module->System = &$this;124 $Module->Database = &$this->Database;125 $this->Modules[get_class($Module)] = $Module;126 }127 128 function AddEmailToQueue($To, $Subject, $Content, $From, $AttachmentFileId = '')129 {130 $Values = array('To' => $To,131 'Subject' => $Subject, 'Content' => $Content, 'Time' => 'NOW()',132 'From' => $From);133 if($AttachmentFileId != '') $Values['AttachmentFile'] = $AttachmentFileId;134 $this->Database->insert('EmailQueue', $Values);135 }136 137 function ProcessEmailQueue()138 {139 $Output = '';140 $DbResult = $this->Database->select('EmailQueue', '*', 'Archive=0');141 while($DbRow = $DbResult->fetch_assoc())142 {143 $Mail = new Mail();144 $Mail->AddToCombined($DbRow['To']);145 $Mail->Subject = $DbRow['Subject'];146 $Mail->From = $DbRow['From'];147 $Mail->AddBody(strip_tags($DbRow['Content']), 'text/plain');148 $Mail->AddBody($DbRow['Content'], 'text/html');149 if($DbRow['AttachmentFile'] != '')150 {151 $DbResult2 = $this->Database->select('File', '*', 'Id='.$DbRow['AttachmentFile']);152 while($File = $DbResult2->fetch_assoc())153 $Mail->AttachFile($this->Config['Web']['FileRootFolder'].$File['DrivePath'], $File['MimeType']);154 }155 $Mail->Send();156 $this->Database->update('EmailQueue', 'Id='.$DbRow['Id'], array('Archive' => 1));157 $this->Modules['Log']->NewRecord('System', 'SendEmail', $DbRow['Id']);158 $Output .= 'To: '.$DbRow['To'].' Subject: '.$DbRow['Subject'].'<br />';159 }160 return($Output);161 }162 163 function HumanDate($Time)164 {165 return(date('j.n.Y', $Time));166 }167 168 function Link($Target)169 {170 return($this->RootURLFolder.$Target);171 }172 }173 174 48 function GlobalInit() 175 49 { … … 204 78 if(!$UpdateManager->IsUpToDate()) die('Systém vyžaduje aktualizaci databáze.'); 205 79 206 // Init old modules 207 $System->AddModule(new Log()); 208 $System->AddModule(new User()); 209 if(isset($_SERVER['REMOTE_ADDR'])) $System->Modules['User']->Check(); 210 $System->AddModule(new Bill()); 211 $System->AddModule(new Finance()); 212 $System->Modules['Finance']->MainSubject = $Config['Finance']['MainSubjectId']; 213 $System->Modules['Finance']->DirectoryId = $Config['Finance']['DirectoryId']; 214 $System->Modules['Finance']->LoadMonthParameters(0); 215 $System->Modules['Log']->Database->LastQuery = 'ssd'; 216 RegisterFormClasses($System->FormManager); 217 80 $Database = $System->Database; 81 RegisterFormClasses($System->FormManager); 218 82 219 83 // Register new modules 220 84 $System->ModuleManager->RegisterModule(new ModuleError($System)); 85 $System->ModuleManager->RegisterModule(new ModuleSystem($System)); 86 $System->ModuleManager->RegisterModule(new ModuleLog($System)); 221 87 $System->ModuleManager->RegisterModule(new ModuleFile($System)); 222 88 $System->ModuleManager->RegisterModule(new ModuleMeteostation($System)); … … 236 102 $System->ModuleManager->RegisterModule(new ModuleMeals($System)); 237 103 $System->ModuleManager->RegisterModule(new ModuleNetworkTopology($System)); 104 $System->ModuleManager->RegisterModule(new ModuleNetworkConfig($System)); 105 $System->ModuleManager->RegisterModule(new ModuleNetworkConfigRouterOS($System)); 106 $System->ModuleManager->RegisterModule(new ModuleNetworkConfigLinux($System)); 238 107 $System->ModuleManager->StartAll(); 239 108 } -
trunk/Common/Module.php
r438 r524 11 11 var $CurrentPath = '/'; 12 12 13 function __construct( )13 function __construct($System) 14 14 { 15 $this->System = &$System; 16 $this->Database = &$System->Database; 15 17 } 16 18 } -
trunk/Common/Page.php
r521 r524 67 67 if($this->System->Config['Web']['UserSupport'] == 1) 68 68 { 69 if($this->System-> Modules['User']->User['Id'] == null)69 if($this->System->User->User['Id'] == null) 70 70 $Output .= '<a href="'.$this->System->Link('/?Action=LoginForm').'">Přihlášení</a> <a href="'.$this->System->Link('/?Action=UserRegister').'">Registrace</a>'; 71 else $Output .= $this->System-> Modules['User']->User['Name'].' <a href="'.$this->System->Link('/?Action=Logout').'">Odhlásit</a>';71 else $Output .= $this->System->User->User['Name'].' <a href="'.$this->System->Link('/?Action=Logout').'">Odhlásit</a>'; 72 72 } else $Output .= ' '; 73 73 // <a href="'.$this->System->Config['Web']['RootFolder'].'/?Action=UserOptions">Nastavení</a>'; … … 78 78 function ShowFooter() 79 79 { 80 global $ScriptTimeStart;80 global $ScriptTimeStart; 81 81 $Time = round(GetMicrotime() - $ScriptTimeStart, 2); 82 82 $Output = '<div id="Footer"> 83 83 <i>| Správa webu: '.$this->System->Config['Web']['Admin'].' | e-mail: '.$this->System->Config['Web']['AdminEmail'].' |'; 84 84 if($this->ShowRuntimeInfo == true) $Output .= ' Doba generování: '.$Time.' s / '.ini_get('max_execution_time').' s | Použitá paměť: '.HumanSize(memory_get_peak_usage(FALSE)).' / '.ini_get('memory_limit').'B |'; 85 $Output .= '</i></div></body></html>';85 $Output .= '</i></div></body></html>'; 86 86 return($Output); 87 87 } -
trunk/Common/Version.php
r522 r524 1 1 <?php 2 2 3 $Revision = 52 2; // Subversion revision3 $Revision = 524; // Subversion revision 4 4 $DatabaseRevision = 517; // SQL structure revision 5 $ReleaseTime = '2013-04- 15';5 $ReleaseTime = '2013-04-20'; 6 6 7 7 ?> -
trunk/Modules/Chat/Chat.php
r519 r524 21 21 global $MonthNames; 22 22 23 if(!$this->System-> Modules['User']->CheckPermission('Chat', 'Display')) return('Nemáte oprávnění');23 if(!$this->System->User->CheckPermission('Chat', 'Display')) return('Nemáte oprávnění'); 24 24 25 25 if(array_key_exists('date', $_GET)) $Date = $_GET['date']; -
trunk/Modules/File/File.php
r514 r524 7 7 var $FilesDir; 8 8 9 function __construct($ Database)9 function __construct($System) 10 10 { 11 $this->Database = $Database;11 parent::__construct($System); 12 12 $this->FilesDir = ''; 13 13 } … … 118 118 parent::Start(); 119 119 $this->System->RegisterPage('file', 'PageFile'); 120 $File = new File($this->System->Database); 121 $File->FilesDir = dirname(__FILE__).'/../../'.$Config['Web']['UploadFileFolder']; 122 $this->System->AddModule($File); 120 $this->System->AddModule(new File($this->System)); 121 $this->System->Modules['File']->FilesDir = dirname(__FILE__).'/../../'.$Config['Web']['UploadFileFolder']; 123 122 } 124 123 -
trunk/Modules/Finance/Customers.php
r521 r524 11 11 $Finance = $this->System->Modules['Finance']; 12 12 $this->System->Modules['Finance']->LoadTariffs(); 13 if(!$this->System-> Modules['User']->CheckPermission('Finance', 'SubjectList')) return('Nemáte oprávnění');13 if(!$this->System->User->CheckPermission('Finance', 'SubjectList')) return('Nemáte oprávnění'); 14 14 15 15 $Output = 'Seznam účastníků:<br/>'; -
trunk/Modules/Finance/Finance.php
r521 r524 37 37 function Start() 38 38 { 39 global $Config; 40 39 41 parent::Start(); 40 42 $this->System->RegisterPage('finance', 'PageFinance'); … … 48 50 $this->System->RegisterPage(array('finance', 'import'), 'PageFinanceImportPayment'); 49 51 $this->System->RegisterPage(array('finance', 'zivnost'), 'PageFinanceTaxFiling'); 52 53 $this->System->AddModule(new Bill($this->System)); 54 $this->System->AddModule(new Finance($this->System)); 55 $this->System->Modules['Finance']->MainSubject = $Config['Finance']['MainSubjectId']; 56 $this->System->Modules['Finance']->DirectoryId = $Config['Finance']['DirectoryId']; 57 $this->System->Modules['Finance']->LoadMonthParameters(0); 50 58 } 51 59 -
trunk/Modules/Finance/Import.php
r523 r524 9 9 function Show() 10 10 { 11 if(!$this->System-> Modules['User']->CheckPermission('Finance', 'SubjectList')) return('Nemáte oprávnění');11 if(!$this->System->User->CheckPermission('Finance', 'SubjectList')) return('Nemáte oprávnění'); 12 12 if(array_key_exists('Operation', $_GET)) 13 13 { -
trunk/Modules/Finance/Manage.php
r521 r524 9 9 function Show() 10 10 { 11 if(!$this->System-> Modules['User']->CheckPermission('Finance', 'Manage'))11 if(!$this->System->User->CheckPermission('Finance', 'Manage')) 12 12 return('Nemáte oprávnění'); 13 13 … … 203 203 $Form->SaveValuesToDatabase(0); 204 204 $Output = $this->SystemMessage('Finance', 'Zařízení vloženo.'); 205 $this->System->Module s['Log']->NewRecord('Finance', 'NewDeviceInserted');205 $this->System->ModuleManager->Modules['Log']->NewRecord('Finance', 'NewDeviceInserted'); 206 206 return($Output); 207 207 } … … 223 223 $Form->SaveValuesToDatabase(0); 224 224 $Output = $this->SystemMessage('Finance', 'Záznam historie zařízení vložen.'); 225 $this->System->Module s['Log']->NewRecord('Finance', 'NewDeviceHistoryInserted');225 $this->System->ModuleManager->Modules['Log']->NewRecord('Finance', 'NewDeviceHistoryInserted'); 226 226 return($Output); 227 227 } … … 246 246 $DbRow = $DbResult->fetch_assoc(); 247 247 $Output = $this->SystemMessage('Finance', 'Platba vložena '.$DbRow['BillCode'].'.'); 248 $this->System->Module s['Log']->NewRecord('Finance', 'NewPaymentInserted');248 $this->System->ModuleManager->Modules['Log']->NewRecord('Finance', 'NewPaymentInserted'); 249 249 return($Output); 250 250 } … … 272 272 $DbRow = $DbResult->fetch_assoc(); 273 273 $Output = $this->SystemMessage('Finance', 'Faktura vložena '.$DbRow['BillCode'].'.'); 274 $this->System->Module s['Log']->NewRecord('Finance', 'NewInvoiceInserted');274 $this->System->ModuleManager->Modules['Log']->NewRecord('Finance', 'NewInvoiceInserted'); 275 275 return($Output); 276 276 } … … 308 308 function ShowMonthlyPayment() 309 309 { 310 if(!$this->System-> Modules['User']->CheckPermission('Finance', 'Manage')) return('Nemáte oprávnění');310 if(!$this->System->User->CheckPermission('Finance', 'Manage')) return('Nemáte oprávnění'); 311 311 $SQL = 'SELECT Member.*, MemberPayment.MonthlyTotal AS Monthly, '. 312 312 'MemberPayment.Cash AS Cash, '. … … 450 450 function ProcessMonthlyPayment() 451 451 { 452 if(!$this->System-> Modules['User']->CheckPermission('Finance', 'Manage')) return('Nemáte oprávnění');452 if(!$this->System->User->CheckPermission('Finance', 'Manage')) return('Nemáte oprávnění'); 453 453 $Output = ''; 454 454 -
trunk/Modules/Finance/Overview.php
r521 r524 15 15 $Output .= '<a href="'.$this->System->Link('/finance/sluzby/').'">Přehled nabízených služeb</a><br />'; 16 16 $Output .= '<a href="'.$this->System->Link('/finance/zarizeni/').'">Výpis zařízení</a><br />'; 17 if($this->System-> Modules['User']->CheckPermission('Finance', 'SubjectList'))17 if($this->System->User->CheckPermission('Finance', 'SubjectList')) 18 18 $Output .= '<a href="'.$this->System->Link('/finance/zakaznici/').'">Seznam zákazníků</a><br />'; 19 19 $Output .= '<a href="'.$this->System->Link('/finance/spotreba/').'">Spotřeba energie</a><br />'; -
trunk/Modules/Finance/UserState.php
r521 r524 14 14 if(array_key_exists('Subject', $_GET)) 15 15 { 16 if(!$this->System-> Modules['User']->CheckPermission('Finance', 'Manage')) return('Nemáte oprávnění');16 if(!$this->System->User->CheckPermission('Finance', 'Manage')) return('Nemáte oprávnění'); 17 17 $DbResult = $this->Database->query('SELECT * FROM Subject WHERE Id='.$_GET['Subject']); 18 18 $Subject = $DbResult->fetch_assoc(); 19 19 } else 20 20 { 21 if(!$this->System-> Modules['User']->CheckPermission('Finance', 'DisplaySubjectState')) return('Nemáte oprávnění');22 $UserId = $this->System-> Modules['User']->User['Id'];21 if(!$this->System->User->CheckPermission('Finance', 'DisplaySubjectState')) return('Nemáte oprávnění'); 22 $UserId = $this->System->User->User['Id']; 23 23 $DbResult = $this->Database->query('SELECT Customer FROM UserCustomerRel WHERE User='.$UserId.' LIMIT 1'); 24 24 if($DbResult->num_rows > 0) -
trunk/Modules/Finance/Zivnost.php
r521 r524 55 55 function Show() 56 56 { 57 if(!$this->System-> Modules['User']->CheckPermission('Finance', 'TradingStatus')) return('Nemáte oprávnění');57 if(!$this->System->User->CheckPermission('Finance', 'TradingStatus')) return('Nemáte oprávnění'); 58 58 $this->System->Modules['Finance']->LoadTariffs(1); 59 59 //TransformFinance(); -
trunk/Modules/FinanceBankAPI/FileImport.php
r523 r524 29 29 function Show() 30 30 { 31 if(!$this->System-> Modules['User']->CheckPermission('Finance', 'SubjectList')) return('Nemáte oprávnění');31 if(!$this->System->User->CheckPermission('Finance', 'SubjectList')) return('Nemáte oprávnění'); 32 32 33 33 $DbResult = $this->Database->select('FinanceBankAccount', '*', 'Id='.$_GET['id']); … … 56 56 { 57 57 $Output = ''; 58 if(!$this->System-> Modules['User']->CheckPermission('Finance', 'SubjectList')) return('Nemáte oprávnění');58 if(!$this->System->User->CheckPermission('Finance', 'SubjectList')) return('Nemáte oprávnění'); 59 59 if(array_key_exists('Operation', $_GET)) 60 60 { -
trunk/Modules/IS/IS.php
r519 r524 12 12 function Show() 13 13 { 14 if(!$this->System-> Modules['User']->CheckPermission('IS', 'Manage'))14 if(!$this->System->User->CheckPermission('IS', 'Manage')) 15 15 return('Nemáte oprávnění'); 16 16 … … 107 107 $_SESSION['Id'] = $Id; 108 108 //$this->Database->update($Table, 'Id='.$Id, 109 // array('UserCreate' => $this->System-> Modules['User']->User['Id'],109 // array('UserCreate' => $this->System->User->User['Id'], 110 110 // 'TimeCreate' => 'NOW()')); 111 111 $Output .= $this->ShowView($Table, $Id); -
trunk/Modules/Log/Log.php
r523 r524 37 37 { 38 38 if(array_key_exists('User', $this->System->Modules) and 39 array_key_exists('Id', $this->System-> Modules['User']->User))40 $UserId = $this->System-> Modules['User']->User['Id'];39 array_key_exists('Id', $this->System->User->User)) 40 $UserId = $this->System->User->User['Id']; 41 41 else $UserId = NULL; 42 42 $this->Database->insert('Log', array('Time' => 'NOW()', -
trunk/Modules/Network/Administration.php
r519 r524 13 13 function Show() 14 14 { 15 if(!$this->System-> Modules['User']->CheckPermission('Network', 'Administration')) return('Nemáte oprávnění');15 if(!$this->System->User->CheckPermission('Network', 'Administration')) return('Nemáte oprávnění'); 16 16 $Output = ''; 17 17 if(array_key_exists('Action', $_GET)) -
trunk/Modules/Network/UserHosts.php
r519 r524 17 17 $Output = '<div align="center" style="font-size: small;"><table class="WideTable">'; 18 18 $Output .= '<tr><th>Jméno počítače</th><th>Místní adresa</th><th>Veřejná adresa</th><th>Fyzická adresa</th><th>Typ</th><th>Naposledy online</th></tr>'; 19 $DbResult = $this->Database->query('SELECT NetworkDevice.*, NetworkDeviceType.Name AS HostType FROM NetworkDevice LEFT JOIN NetworkDeviceType ON NetworkDeviceType.Id = NetworkDevice.Type WHERE NetworkDevice.Used = 1 AND NetworkDevice.Member = (SELECT Customer FROM UserCustomerRel WHERE User='.$this->System-> Modules['User']->User['Id'].') ORDER BY NetworkDevice.Name');19 $DbResult = $this->Database->query('SELECT NetworkDevice.*, NetworkDeviceType.Name AS HostType FROM NetworkDevice LEFT JOIN NetworkDeviceType ON NetworkDeviceType.Id = NetworkDevice.Type WHERE NetworkDevice.Used = 1 AND NetworkDevice.Member = (SELECT Customer FROM UserCustomerRel WHERE User='.$this->System->User->User['Id'].') ORDER BY NetworkDevice.Name'); 20 20 while($Device = $DbResult->fetch_assoc()) 21 21 { -
trunk/Modules/NetworkShare/SharePage.php
r523 r524 68 68 function Show() 69 69 { 70 if(!$this->System-> Modules['User']->CheckPermission('Share', 'Display')) return('Nemáte oprávnění');70 if(!$this->System->User->CheckPermission('Share', 'Display')) return('Nemáte oprávnění'); 71 71 72 72 // If not only online checkbox checked -
trunk/Modules/News/News.php
r506 r524 51 51 $Output = '<div class="NewsPanel"><div class="Title">'.$Row['Caption']; 52 52 $Output .= '<div class="Action"><a href="aktuality/?category='.$Category.'">Zobrazit</a>'; 53 if($this->System-> Modules['User']->CheckPermission('News', 'Insert', 'Group', $Category))53 if($this->System->User->CheckPermission('News', 'Insert', 'Group', $Category)) 54 54 $Output .= ' <a href="aktuality/?action=add&category='.$Category.'">Přidat</a>'; 55 55 $Output .= '</div></div><div class="Content">'; -
trunk/Modules/News/NewsPage.php
r523 r524 38 38 { 39 39 case 'view': 40 if(!$this->System-> Modules['User']->CheckPermission('News', 'Display', 'Item')) $Output .= 'Nemáte oprávnění';40 if(!$this->System->User->CheckPermission('News', 'Display', 'Item')) $Output .= 'Nemáte oprávnění'; 41 41 else 42 42 { … … 49 49 else $Author = $Row['Name']; 50 50 $Output .= '<div class="Panel"><div class="Title">'.$Row['Title'].' ('.HumanDate($Row['Date']).', '.$Author.')'; 51 if($this->System-> Modules['User']->User['Id'] == $Row['User'])51 if($this->System->User->User['Id'] == $Row['User']) 52 52 { 53 53 $Output .= '<div class="Action">'; … … 79 79 while($DbRow = $DbResult->fetch_array()) 80 80 { 81 if($this->System-> Modules['User']->CheckPermission('News', 'Insert', 'Group', $DbRow['Id']))81 if($this->System->User->CheckPermission('News', 'Insert', 'Group', $DbRow['Id'])) 82 82 { 83 83 if($DbRow['Id'] == $Category) $Selected = ' selected="1"'; else $Selected = ''; … … 98 98 case 'add2': 99 99 $RemoteAddr = GetRemoteAddress(); 100 if($this->System-> Modules['User']->CheckPermission('News', 'Insert', 'Group', $Category))100 if($this->System->User->CheckPermission('News', 'Insert', 'Group', $Category)) 101 101 { 102 102 // Process uploaded file … … 121 121 $this->Database->insert('News', array('Category' => $Category, 'Title' => $_POST['title'], 122 122 'Content' => $_POST['content'], 'Date' => 'NOW()', 'IP' => $RemoteAddr, 123 'Enclosure' => $Enclosures, 'Author' => $this->System-> Modules['User']->User['Name'], 'User' => $this->System->Modules['User']->User['Id'], 'Link' => $_POST['link']));123 'Enclosure' => $Enclosures, 'Author' => $this->System->User->User['Name'], 'User' => $this->System->User->User['Id'], 'Link' => $_POST['link'])); 124 124 $Output .= 'Aktualita přidána!<br />Pokud budete chtít vaši aktualitu smazat, klikněte na odkaz Smazat v seznamu všech aktualit v kategorii.<br /><br />'; 125 125 $Output .= '<a href="?category='.$_POST['category'].'">Zpět na seznam aktualit</a>'; … … 130 130 $DbResult = $this->Database->query('SELECT * FROM News WHERE Id='.$_GET['id']); 131 131 $Row = $DbResult->fetch_array(); 132 if($this->System-> Modules['User']->User['Id'] == $Row['User'])132 if($this->System->User->User['Id'] == $Row['User']) 133 133 { 134 134 $Row['Content'] = str_replace('<br />', '', $Row['Content']); … … 151 151 { 152 152 $Row = $DbResult->fetch_array(); 153 if($this->System-> Modules['User']->User['Id'] == $Row['User'])153 if($this->System->User->User['Id'] == $Row['User']) 154 154 { 155 155 $_POST['content'] = str_replace("\n", '<br />', $_POST['content']); -
trunk/Modules/OpeningHours/OpeningHours.php
r507 r524 35 35 function EditSubject($Id) 36 36 { 37 if($this->System-> Modules['User']->CheckPermission('SubjectOpenTime', 'Edit'))37 if($this->System->User->CheckPermission('SubjectOpenTime', 'Edit')) 38 38 { 39 39 $Output = '<div class="Centred">'; … … 77 77 78 78 $Output = ''; 79 if($this->System-> Modules['User']->CheckPermission('SubjectOpenTime', 'Edit'))79 if($this->System->User->CheckPermission('SubjectOpenTime', 'Edit')) 80 80 { 81 81 $this->Database->delete('SubjectOpenTimeDay', 'Subject='.$Id); … … 189 189 if($Subject['Photo'] != 0) $Output .= '<a href="file?id='.$Subject['Photo'].'">Fotka</a> '; 190 190 191 if($this->System-> Modules['User']->CheckPermission('SubjectOpenTime', 'Edit'))191 if($this->System->User->CheckPermission('SubjectOpenTime', 'Edit')) 192 192 $Output .= '<a href="edit?Subject='.$Subject['Id'].'">Editovat</a><br />'; 193 193 $Output .= '<br />'; -
trunk/Modules/Portal/Portal.php
r523 r524 16 16 if($HyperLink['IconFile'] == '') $HyperLink['IconFile'] = 'clear.png'; 17 17 if(substr($HyperLink['URL'], 0, 4) != 'http') $HyperLink['URL'] = $this->System->Config['Web']['RootFolder'].$HyperLink['URL']; 18 if(($HyperLink['PermissionModule'] == '') or (($HyperLink['PermissionModule'] != '') and $this->System-> Modules['User']->Modules['User']->CheckPermission($HyperLink['PermissionModule'], $HyperLink['PermissionOperation'])))18 if(($HyperLink['PermissionModule'] == '') or (($HyperLink['PermissionModule'] != '') and $this->System->User->User->CheckPermission($HyperLink['PermissionModule'], $HyperLink['PermissionOperation']))) 19 19 $Output .= '<img alt="'.$HyperLink['Name'].'" src="images/favicons/'.$HyperLink['IconFile'].'" width="16" height="16" /> <a href="'.$HyperLink['URL'].'">'.$HyperLink['Name'].'</a><br />'; 20 20 } … … 55 55 //$Output .= 'Server běží: '.$this->GetServerUptime().' '; 56 56 57 if($this->System-> Modules['User']->CheckPermission('Finance', 'DisplaySubjectState'))58 { 59 $DbResult = $this->Database->select('MemberPayment', 'Cash', 'Member=(SELECT Customer FROM UserCustomerRel WHERE Id='.$this->System-> Modules['User']->User['Id'].')');57 if($this->System->User->CheckPermission('Finance', 'DisplaySubjectState')) 58 { 59 $DbResult = $this->Database->select('MemberPayment', 'Cash', 'Member=(SELECT Customer FROM UserCustomerRel WHERE Id='.$this->System->User->User['Id'].')'); 60 60 if($DbResult->num_rows > 0) 61 61 { … … 72 72 { 73 73 $Output = '<a href="'.$this->System->Link('/?Action=UserOptions').'">Profil</a><br />'; 74 if($this->System-> Modules['User']->CheckPermission('Finance', 'MemberOptions'))74 if($this->System->User->CheckPermission('Finance', 'MemberOptions')) 75 75 $Output .= '<a href="'.$this->System->Link('/?Action=MemberOptions').'">Domácnost</a><br />'; 76 if($this->System-> Modules['User']->CheckPermission('Finance', 'DisplaySubjectState'))76 if($this->System->User->CheckPermission('Finance', 'DisplaySubjectState')) 77 77 $Output .= '<a href="'.$this->System->Link('/finance/platby/').'">Finance</a><br />'; 78 if($this->System-> Modules['User']->CheckPermission('Network', 'RegistredHostList'))78 if($this->System->User->CheckPermission('Network', 'RegistredHostList')) 79 79 $Output .= '<a href="'.$this->System->Link('/network/user-hosts/').'">Počítače</a><br />'; 80 if($this->System-> Modules['User']->CheckPermission('News', 'Insert'))80 if($this->System->User->CheckPermission('News', 'Insert')) 81 81 $Output .= '<a href="'.$this->System->Link('/aktuality/?action=add').'">Vložení aktuality</a><br />'; 82 if($this->System-> Modules['User']->CheckPermission('EatingPlace', 'Edit'))82 if($this->System->User->CheckPermission('EatingPlace', 'Edit')) 83 83 $Output .= '<a href="'.$this->System->Link('/jidelna/menuedit.php').'">Úprava jídelníčků</a><br />'; 84 if($this->System-> Modules['User']->CheckPermission('Finance', 'Manage'))84 if($this->System->User->CheckPermission('Finance', 'Manage')) 85 85 $Output .= '<a href="'.$this->System->Link('/finance/sprava/').'">Správa financí</a><br />'; 86 if($this->System-> Modules['User']->CheckPermission('Network', 'Administration'))86 if($this->System->User->CheckPermission('Network', 'Administration')) 87 87 $Output .= '<a href="'.$this->System->Link('/network/administration/').'">Správa sítě</a><br />'; 88 if($this->System-> Modules['User']->CheckPermission('IS', 'Manage'))88 if($this->System->User->CheckPermission('IS', 'Manage')) 89 89 $Output .= '<a href="'.$this->System->Link('/is/').'">Správa dat</a><br />'; 90 90 return($Output); … … 156 156 $Form->SetClass('UserLogin'); 157 157 $Form->OnSubmit = '?Action=Login'; 158 $Result = $this->System-> Modules['User']->Login($_POST['Username'], $_POST['Password']);158 $Result = $this->System->User->Login($_POST['Username'], $_POST['Password']); 159 159 $Output .= $this->SystemMessage('Přihlášení', $Result); 160 160 if($Result <> USER_LOGGED_IN) … … 170 170 if($_GET['Action'] == 'Logout') 171 171 { 172 if($this->System-> Modules['User']->User['Id'] != null)173 { 174 $Output .= $this->SystemMessage('Odhlášení', $this->System-> Modules['User']->Logout());172 if($this->System->User->User['Id'] != null) 173 { 174 $Output .= $this->SystemMessage('Odhlášení', $this->System->User->Logout()); 175 175 } else $Output .= $this->SystemMessage('Nastavení uživatele', 'Nejste přihlášen'); 176 176 } else 177 177 if($_GET['Action'] == 'UserOptions') 178 178 { 179 if($this->System-> Modules['User']->User['Id'] != null)179 if($this->System->User->User['Id'] != null) 180 180 { 181 181 $UserOptions = new Form($this->System->FormManager); 182 182 $UserOptions->SetClass('UserOptions'); 183 $UserOptions->LoadValuesFromDatabase($this->System-> Modules['User']->User['Id']);183 $UserOptions->LoadValuesFromDatabase($this->System->User->User['Id']); 184 184 $UserOptions->OnSubmit = '?Action=UserOptionsSave'; 185 185 $Output .= $UserOptions->ShowEditForm(); … … 191 191 $UserOptions->SetClass('UserOptions'); 192 192 $UserOptions->LoadValuesFromForm(); 193 $UserOptions->SaveValuesToDatabase($this->System-> Modules['User']->User['Id']);193 $UserOptions->SaveValuesToDatabase($this->System->User->User['Id']); 194 194 $Output .= $this->SystemMessage('Nastavení', 'Nastavení uloženo.'); 195 195 $this->System->ModuleManager->Modules['Log']->NewRecord('User', 'Nastavení uživatele změněno', $UserOptions->Values['Name']); 196 $UserOptions->LoadValuesFromDatabase($this->System-> Modules['User']->User['Id']);196 $UserOptions->LoadValuesFromDatabase($this->System->User->User['Id']); 197 197 $UserOptions->OnSubmit = '?Action=UserOptionsSave'; 198 198 $Output .= $UserOptions->ShowEditForm(); … … 209 209 { 210 210 $Output .= $this->SystemMessage('Potvrzení registrace', 211 $this->System-> Modules['User']->RegisterConfirm($_GET['User'], $_GET['H']));211 $this->System->User->RegisterConfirm($_GET['User'], $_GET['H'])); 212 212 } else 213 213 if($_GET['Action'] == 'PasswordRecovery') … … 223 223 $Form->SetClass('PasswordRecovery'); 224 224 $Form->LoadValuesFromForm(); 225 $Result = $this->System-> Modules['User']->PasswordRecoveryRequest($Form->Values['Name'], $Form->Values['Email']);225 $Result = $this->System->User->PasswordRecoveryRequest($Form->Values['Name'], $Form->Values['Email']); 226 226 $Output .= $this->SystemMessage('Obnova hesla', $Result); 227 227 if($Result <> USER_PASSWORD_RECOVERY_SUCCESS) … … 232 232 if($_GET['Action'] == 'PasswordRecoveryConfirm') 233 233 { 234 $Output .= $this->SystemMessage('Obnova hesla', $this->System-> Modules['User']->PasswordRecoveryConfirm($_GET['User'], $_GET['H'], $_GET['P']));234 $Output .= $this->SystemMessage('Obnova hesla', $this->System->User->PasswordRecoveryConfirm($_GET['User'], $_GET['H'], $_GET['P'])); 235 235 } else 236 236 if($_GET['Action'] == 'UserRegisterSave') … … 239 239 $Form->SetClass('UserRegister'); 240 240 $Form->LoadValuesFromForm(); 241 $Result = $this->System-> Modules['User']->Register($Form->Values['Login'], $Form->Values['Password'], $Form->Values['Password2'], $Form->Values['Email'], $Form->Values['Name'], $Form->Values['PhoneNumber'], $Form->Values['ICQ']);241 $Result = $this->System->User->Register($Form->Values['Login'], $Form->Values['Password'], $Form->Values['Password2'], $Form->Values['Email'], $Form->Values['Name'], $Form->Values['PhoneNumber'], $Form->Values['ICQ']); 242 242 $Output .= $this->SystemMessage('Registrace nového účtu', $Result); 243 243 if($Result <> USER_REGISTRATED) … … 251 251 $Form = new Form($this->System->FormManager); 252 252 $Form->SetClass('MemberOptions'); 253 $DbResult = $this->Database->query('SELECT Customer FROM UserCustomerRel WHERE User='.$this->System-> Modules['User']->User['Id']);253 $DbResult = $this->Database->query('SELECT Customer FROM UserCustomerRel WHERE User='.$this->System->User->User['Id']); 254 254 if($DbResult->num_rows > 0) 255 255 { … … 278 278 $Form->Values['BillingPeriodNext'] = 2; 279 279 280 $DbResult = $this->Database->update('Member', 'Id='.$this->System-> Modules['User']->User['Member'],280 $DbResult = $this->Database->update('Member', 'Id='.$this->System->User->User['Member'], 281 281 array('FamilyMemberCount' => $Form->Values['FamilyMemberCount'], 282 282 'BillingPeriodNext' => $Form->Values['BillingPeriodNext'])); 283 $DbResult = $this->Database->query('SELECT Subject FROM Member WHERE Id='.$this->System-> Modules['User']->User['Member']);283 $DbResult = $this->Database->query('SELECT Subject FROM Member WHERE Id='.$this->System->User->User['Member']); 284 284 $Member = $DbResult->fetch_assoc(); 285 285 $DbResult = $this->Database->update('Subject', 'Id='.$Member['Subject'], … … 294 294 'Subject.Name, Subject.AddressStreet, Subject.AddressTown, Subject.AddressPSC, '. 295 295 'Subject.AddressCountry, Subject.IC, Subject.DIC FROM Member JOIN Subject '. 296 'ON Subject.Id = Member.Subject WHERE Member.Id='.$this->System-> Modules['User']->User['Member']);296 'ON Subject.Id = Member.Subject WHERE Member.Id='.$this->System->User->User['Member']); 297 297 $DbRow = $DbResult->fetch_array(); 298 298 foreach($Form->Definition['Items'] as $Index => $Item) … … 326 326 else if($Panel['Module'] == 'UserOptions') 327 327 { 328 if($this->System-> Modules['User']->User['Id'] != null) $Output .= $this->Panel('Přihlášený uživatel', $this->UserPanel());328 if($this->System->User->User['Id'] != null) $Output .= $this->Panel('Přihlášený uživatel', $this->UserPanel()); 329 329 } else 330 330 if($Panel['Module'] == 'Webcam') $Output .= $this->Panel('Kamery', $this->WebcamPanel()); -
trunk/Modules/TV/tkr.php
r438 r524 23 23 } 24 24 25 $System->AddModule(new CableTVChennelListPage( ));25 $System->AddModule(new CableTVChennelListPage($System)); 26 26 $System->Modules['CableTVChennelListPage']->GetOutput(); 27 27 -
trunk/Modules/User/User.php
r521 r524 1 1 <?php 2 3 include_once(dirname(__FILE__).'/UserList.php'); 2 4 3 5 define('LOGIN_USED', 'Přihlašovací jméno již použito.'); … … 47 49 class User extends Module 48 50 { 49 var $Dependencies = array('Log');50 51 var $Roles = array(); 51 52 var $User = array(); 52 var $DefaultRole = 2;53 53 var $OnlineStateTimeout = 600; // in seconds 54 54 var $PermissionCache = array(); … … 58 58 var $PasswordHash; 59 59 60 function __construct() 61 { 60 function __construct($System) 61 { 62 parent::__construct($System); 62 63 $this->PasswordHash = new PasswordHash(); 63 64 } … … 97 98 { 98 99 $this->Database->delete('UserOnline', 'Id='.$DbRow['Id']); 99 if($DbRow['User'] != null) $this->System->Module s['Log']->NewRecord('User', 'Logout');100 if($DbRow['User'] != null) $this->System->ModuleManager->Modules['Log']->NewRecord('User', 'Logout'); 100 101 } 101 102 //$this->LoadPermission($this->User['Role']); … … 107 108 function Register($Login, $Password, $Password2, $Email, $Name, $PhoneNumber, $ICQ) 108 109 { 109 global $ Options, $Config;110 global $Config; 110 111 111 112 if(($Email == '') || ($Login == '') || ($Password == '') || ($Password2 == '') || ($Name == '')) $Result = DATA_MISSING; … … 155 156 156 157 $Result = USER_REGISTRATED; 157 $this->System->Module s['Log']->NewRecord('User', 'NewRegistration', $Login);158 $this->System->ModuleManager->Modules['Log']->NewRecord('User', 'NewRegistration', $Login); 158 159 } 159 160 } … … 174 175 $this->Database->update('User', 'Id='.$Row['Id'], array('Locked' => 0)); 175 176 $Output = USER_REGISTRATION_CONFIRMED; 176 $this->System->Module s['Log']->NewRecord('User', 'RegisterConfirm', 'Login='.177 $this->System->ModuleManager->Modules['Log']->NewRecord('User', 'RegisterConfirm', 'Login='. 177 178 $Row['Login'].', Id='.$Row['Id']); 178 179 } else $Output = PASSWORDS_UNMATCHED; … … 198 199 $Result = USER_LOGGED_IN; 199 200 $this->Check(); 200 $this->System->Module s['Log']->NewRecord('User', 'Login', 'Login='.$Login.',Host='.gethostbyaddr(GetRemoteAddress()));201 $this->System->ModuleManager->Modules['Log']->NewRecord('User', 'Login', 'Login='.$Login.',Host='.gethostbyaddr(GetRemoteAddress())); 201 202 } 202 203 } else $Result = USER_NOT_REGISTRED; … … 208 209 $SID = session_id(); 209 210 $this->Database->update('UserOnline', 'SessionId="'.$SID.'"', array('User' => null)); 210 $this->System->Module s['Log']->NewRecord('User', 'Logout', $this->User['Login']);211 $this->System->ModuleManager->Modules['Log']->NewRecord('User', 'Logout', $this->User['Login']); 211 212 $this->Check(); 212 213 return(USER_LOGGED_OUT); … … 354 355 355 356 $Output = USER_PASSWORD_RECOVERY_SUCCESS; 356 $this->System->Module s['Log']->NewRecord('User', 'PasswordRecoveryRequest', 'Login='.$Login.',Email='.$Email);357 $this->System->ModuleManager->Modules['Log']->NewRecord('User', 'PasswordRecoveryRequest', 'Login='.$Login.',Email='.$Email); 357 358 } else $Output = USER_PASSWORD_RECOVERY_FAIL; 358 359 return($Output); … … 373 374 'Salt' => $Salt, 'Locked' => 0)); 374 375 $Output = USER_PASSWORD_RECOVERY_CONFIRMED; 375 $this->System->Module s['Log']->NewRecord('User', 'PasswordRecoveryConfirm', 'Login='.$Row['Login']);376 $this->System->ModuleManager->Modules['Log']->NewRecord('User', 'PasswordRecoveryConfirm', 'Login='.$Row['Login']); 376 377 } else $Output = PASSWORDS_UNMATCHED; 377 378 } else $Output = USER_NOT_FOUND; … … 380 381 } 381 382 383 class ModuleUser extends AppModule 384 { 385 function __construct($System) 386 { 387 parent::__construct($System); 388 $this->Name = 'User'; 389 $this->Version = '1.0'; 390 $this->Creator = 'Chronos'; 391 $this->License = 'GNU/GPLv3'; 392 $this->Description = 'User management'; 393 $this->Dependencies = array(); 394 } 395 396 function Install() 397 { 398 } 399 400 function Uninstall() 401 { 402 } 403 404 function Start() 405 { 406 parent::Start(); 407 $this->System->User = new User($this->System); 408 if(isset($_SERVER['REMOTE_ADDR'])) $this->System->User->Check(); 409 $this->System->RegisterPage('userlist', 'PageUserList'); 410 } 411 412 function Stop() 413 { 414 } 415 } 416 382 417 ?> -
trunk/Modules/WebCam/WebCam.php
r523 r524 68 68 global $Config; 69 69 $Output = ''; 70 //$Output = '<a href="http://www.zdechov.net/kamery/?id=1"><img alt="Webkamera školní hřiště" width="140" height="105" src="http://www.zdechov.net/images/webcam/webcam.jpg" /></a>';71 //$Output .= '<a href="http://www.zdechov.net/kamery/?id=2"><img alt="Webkamera střed obce obloha" width="140" height="105" src="http://www.zdechov.net/images/webcam/webcam2.jpg" /></a>';72 //$Output .= '<a href="http://www.zdechov.net/kamery/?id=3"><img alt="Skiareál, motokrosová grapa" width="140" height="79" src="http://www.zdechov.net/images/webcam/webcam3.jpg" /></a>';73 //$Output .= '<a href="http://www.zdechov.net/kamery/?id=4"><img alt="Fotbalové hřiště" width="140" height="79" src="http://www.zdechov.net/images/webcam/webcam4.jpg" /></a>';70 $Output = '<a href="http://www.zdechov.net/kamery/?id=1"><img alt="Webkamera školní hřiště" width="140" height="105" src="http://www.zdechov.net/images/webcam/webcam.jpg" /></a>'; 71 $Output .= '<a href="http://www.zdechov.net/kamery/?id=2"><img alt="Webkamera střed obce obloha" width="140" height="105" src="http://www.zdechov.net/images/webcam/webcam2.jpg" /></a>'; 72 $Output .= '<a href="http://www.zdechov.net/kamery/?id=3"><img alt="Skiareál, motokrosová grapa" width="140" height="79" src="http://www.zdechov.net/images/webcam/webcam3.jpg" /></a>'; 73 $Output .= '<a href="http://www.zdechov.net/kamery/?id=4"><img alt="Fotbalové hřiště" width="140" height="79" src="http://www.zdechov.net/images/webcam/webcam4.jpg" /></a>'; 74 74 return($Output); 75 75 } -
trunk/block/index.php
r438 r524 41 41 } 42 42 43 $System->AddModule(new BlockPage( ));43 $System->AddModule(new BlockPage($System)); 44 44 $System->Modules['BlockPage']->GetOutput(); 45 45 -
trunk/missing.php
r438 r524 13 13 } 14 14 15 $System->AddModule(new MissingPage( ));15 $System->AddModule(new MissingPage($System)); 16 16 $System->Modules['MissingPage']->GetOutput(); 17 17 -
trunk/temp/renumbering.php
r457 r524 55 55 } 56 56 57 $System->AddModule(new Renumbering( ));57 $System->AddModule(new Renumbering($System)); 58 58 $System->Modules['Renumbering']->GetOutput(); 59 59 -
trunk/temp/user_mail.php
r457 r524 36 36 } 37 37 38 $System->AddModule(new Transform( ));38 $System->AddModule(new Transform($System)); 39 39 $System->Modules['Transform']->GetOutput(); 40 40
Note:
See TracChangeset
for help on using the changeset viewer.