Changeset 47
- Timestamp:
- Jul 27, 2014, 9:14:56 PM (10 years ago)
- Location:
- trunk
- Files:
-
- 64 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:ignore
-
old new 1 2 1 config.php 2 .project
-
- Property svn:ignore
-
trunk/Application/Application.php
r42 r47 9 9 { 10 10 var $DefaultModule = 'Main'; 11 11 12 12 function __construct() 13 13 { 14 14 parent::__construct(); 15 15 $this->Output = new CustomOutput($this); 16 16 17 17 /* $this->Type->RegisterType('YesNo', 'Enumeration', array('Ano', 'Ne')); 18 18 $this->Type->RegisterType('NoYes', 'Enumeration', array('Ne', 'Ano')); … … 27 27 //$this->AddModule('Log'); 28 28 //$this->AddModule('UserList'); 29 29 30 30 //if(isset($_SERVER['REMOTE_ADDR'])) $this->Modules['UserList']->Check(); 31 31 // else $this->Modules['UserList']->CurrentUser = new User(0); … … 34 34 } 35 35 } 36 37 ?> -
trunk/Application/Config/ConfigSample.php
r46 r47 24 24 ), 25 25 ); 26 27 ?> -
trunk/Application/Controller/Add.php
r45 r47 22 22 } 23 23 } 24 25 ?> -
trunk/Application/Controller/Client.php
r45 r47 10 10 $MeasureClient = new MeasureClient($this->System); 11 11 $MeasureClient->Process(); 12 12 13 13 //$View = new MeasureView($this->System); 14 14 //return($View->Add()); 15 15 } 16 16 } 17 18 ?> -
trunk/Application/Controller/Graph.php
r45 r47 9 9 { 10 10 $this->System->Output->FullPage = false; 11 11 12 12 $View = new GraphView($this->System); 13 13 return($View->Render()); 14 14 } 15 15 } 16 17 ?> -
trunk/Application/Controller/Main.php
r42 r47 12 12 } 13 13 } 14 15 ?> -
trunk/Application/Controller/Measure.php
r40 r47 9 9 } 10 10 } 11 12 ?> -
trunk/Application/Controller/User.php
r40 r47 8 8 $View = new UserView($this->System); 9 9 return($Page->GetOutput($View->Login())); 10 } 11 10 } 11 12 12 function LoginFinish() 13 13 { … … 15 15 $View = new UserView($this->System); 16 16 return($Page->GetOutput($View->LoginFinish())); 17 } 17 } 18 18 19 19 function Logout() … … 22 22 $View = new UserView($this->System); 23 23 return($Page->GetOutput($View->Logout())); 24 } 24 } 25 25 26 26 function Options() … … 29 29 $View = new UserView($this->System); 30 30 return($Page->GetOutput($View->Options())); 31 } 32 31 } 32 33 33 function OptionsSave() 34 34 { … … 36 36 $View = new UserView($this->System); 37 37 return($Page->GetOutput($View->OptionsSave())); 38 } 38 } 39 39 40 40 function Register() … … 43 43 $View = new UserView($this->System); 44 44 return($Page->GetOutput($View->Register())); 45 } 45 } 46 46 47 47 function RegisterConfirm() … … 50 50 $View = new UserView($this->System); 51 51 return($Page->GetOutput($View->Confirm())); 52 } 52 } 53 53 54 54 function PasswordRecovery() … … 57 57 $View = new UserView($this->System); 58 58 return($Page->GetOutput($View->PasswordRecovery())); 59 } 59 } 60 60 61 61 function PasswordRecoveryFinish() … … 64 64 $View = new UserView($this->System); 65 65 return($Page->GetOutput($View->PasswordRecovery())); 66 } 66 } 67 67 68 68 function PasswordRecoveryConfirm() … … 71 71 $View = new UserView($this->System); 72 72 return($Page->GetOutput($View->PasswordRecoveryConfirm())); 73 } 73 } 74 74 75 75 function RegisterSave() … … 78 78 $View = new UserView($this->System); 79 79 return($Page->GetOutput($View->RegisterSave())); 80 } 80 } 81 81 } 82 83 ?> -
trunk/Application/CustomOutput.php
r46 r47 74 74 } 75 75 } 76 77 ?> -
trunk/Application/Locale/cs_CZ.php
r42 r47 26 26 'UserPasswordRecoveryConfirmed' => 'Nové heslo bylo aktivováno.', 27 27 'UserBadRole' => 'Nemáte dostatečná oprávnění', 28 28 29 29 'AccessDenied' => 'K provedení požadované akce nemáte dostatečné oprávnění', 30 30 ); 31 32 ?> -
trunk/Application/Model/Measure.php
r46 r47 467 467 } 468 468 } 469 470 ?> -
trunk/Application/Model/Measurement/MeasureClient.php
r44 r47 26 26 } else echo('Třída '.$MeasureMethod['MeasureClass'].' neexistuje.'); 27 27 } 28 } 28 } 29 29 } 30 31 ?> -
trunk/Application/Model/Measurement/Measurement.php
r43 r47 6 6 { 7 7 } 8 9 ?> -
trunk/Application/Model/Measurement/System.php
r44 r47 24 24 25 25 function Ping($Host = 'nix.cz') 26 { 26 { 27 $Row = array(); 27 28 exec('ping '.$Host.' -c 1 -W 1|grep time=', $Row); 28 29 // W - timeout in seconds … … 55 56 $LastCpuUsage = unserialize(file_get_contents($CpuStateFileName)); 56 57 //$cpuIDLEprev, $cpuSYSTprev, $cpuUSERprev; 57 58 58 59 // get processor usage seconds for pct stats ### 59 60 $File = fopen('/proc/stat', 'r'); … … 69 70 $CpuUsageDiffTotal = (($CpuUsageDiff['User'] + $CpuUsageDiff['System']) + $CpuUsageDiff['Idle']); 70 71 if ($CpuUsageDiffTotal > 0) 71 { 72 { 72 73 $CpuUsagePercent['User'] = ($CpuUsageDiff['User'] / $CpuUsageDiffTotal) * 100; 73 74 $CpuUsagePercent['System'] = ($CpuUsageDiff['System'] / $CpuUsageDiffTotal) * 100; … … 93 94 array_shift($Output); // Skip header 94 95 foreach($Output as $Item) 95 { 96 { 96 97 while(strpos($Item, ' ') !== false) $Item = str_replace(' ', ' ', $Item); // Rrmove multiple spaces 97 98 $Item = explode(':', $Item); … … 108 109 $NetworkState[$Interface]['DownAverage'] = 0; 109 110 $NetworkState[$Interface]['UpAverage'] = 0; 110 } 111 } 111 112 if($NetworkState[$Interface]['DownAverage'] < 0) $NetworkState[$Interface]['DownAverage'] = 0; 112 113 if($NetworkState[$Interface]['UpAverage'] < 0) $NetworkState[$Interface]['UpAverage'] = 0; … … 121 122 return($NetworkState['Interface']['DownAverage']); 122 123 } 123 124 124 125 function NetworkSpeedUpload($Interface) 125 126 { … … 177 178 } 178 179 } 179 180 ?> -
trunk/Application/Model/Permission.php
r40 r47 11 11 if($DbRow['SubGroup'] > 0) $Result = array_merge($Result, $this->LoadForGroup($DbRow['SubGroup'])); 12 12 if($DbRow['Operation'] > 0) 13 { 13 { 14 14 $DbResult2 = $this->Database->query('SELECT `PermissionOperation`.*, `Module`.`Name` FROM `PermissionOperation` JOIN `Module` ON `Module`.`Id` = `PermissionOperation`.`Module` WHERE `PermissionOperation`.`Id`='.$DbRow['Operation']); 15 15 $DbRow2 = $DbResult2->fetch_assoc(); … … 19 19 $this->Data = $Result; 20 20 } 21 21 22 22 function LoadForGroup($Group) 23 23 { … … 28 28 if($DbRow['SubGroup'] > 0) $Result = array_merge($Result, $this->LoadForGroup($DbRow['SubGroup'])); 29 29 if($DbRow['Operation'] > 0) 30 { 30 { 31 31 $DbResult2 = $this->Database->query('SELECT `PermissionOperation`.*, `Module`.`Name` FROM `PermissionOperation` JOIN `Module` ON `Module`.`Id` = `PermissionOperation`.`Module` WHERE `PermissionOperation`.`Id`='.$DbRow['Operation']); 32 32 $DbRow2 = $DbResult2->fetch_assoc(); … … 36 36 return($Result); 37 37 } 38 38 39 39 function Check($Module, $Action, $Item = 0) 40 40 { … … 44 44 } 45 45 } 46 47 ?> -
trunk/Application/Model/User.php
r46 r47 267 267 } 268 268 } 269 270 ?> -
trunk/Application/Model/stat_functions.php
r43 r47 43 43 if($Unit == '') return(TruncateDigits($Value, $Digits)); 44 44 $I = 8; 45 if($Value > 0) $II = 1; 45 if($Value > 0) $II = 1; 46 46 else if($Value < 0) $II = -1; 47 47 else $II = 0; … … 99 99 $Result = $Database->select($Measure['DataTable'], '*', 'measure='.$Measure['Id'].' AND level='.$Level.' ORDER BY time DESC LIMIT 2'); 100 100 //echo($Database->LastQuery."\n"); 101 if($Result->num_rows == 0) 102 { 103 $Database->insert($Measure['DataTable'], array('min' => $Value['min'], 'avg' => $Value['avg'], 'max' => $Value['max'], 'level' => $Level, 'measure' => $Measure['Id'], 'time' => TimeToMysqlDateTime($Time), 'continuity' => 0)); 101 if($Result->num_rows == 0) 102 { 103 $Database->insert($Measure['DataTable'], array('min' => $Value['min'], 'avg' => $Value['avg'], 'max' => $Value['max'], 'level' => $Level, 'measure' => $Measure['Id'], 'time' => TimeToMysqlDateTime($Time), 'continuity' => 0)); 104 104 //echo($Database->LastQuery."\n"); 105 105 } else if($Result->num_rows == 1) … … 237 237 } 238 238 } 239 else if($ValueType == 'min') 240 { 241 //echo($Values[$I+1]['continuity'].'=='.$Measure['ContinuityEnabled'].'<br>'); 239 else if($ValueType == 'min') 240 { 241 //echo($Values[$I+1]['continuity'].'=='.$Measure['ContinuityEnabled'].'<br>'); 242 242 if($Values[$I + 1]['continuity'] == $Measure['ContinuityEnabled']) 243 243 { … … 258 258 $NewValue[$ValueType] = $NewValue[$ValueType]; 259 259 } 260 //if(($RightTime - $LeftTime) > 0) 261 if($Measure['Cumulative'] == 0) 260 //if(($RightTime - $LeftTime) > 0) 261 if($Measure['Cumulative'] == 0) 262 262 { 263 263 $NewValue['avg'] = $NewValue['avg'] / ($RightTime - $LeftTime); … … 273 273 274 274 // Get first and last time 275 //echo($Measure['Id'].','.$Level.','.StatTableName($Level)."\n"); 275 //echo($Measure['Id'].','.$Level.','.StatTableName($Level)."\n"); 276 276 $Result = $Database->select($Measure['DataTable'], '*', 'measure='.$Measure['Id'].' AND level='.$Level.' ORDER BY time LIMIT 1'); 277 277 if($Result->num_rows > 0) … … 288 288 } else $AbsoluteRightTime = 0; 289 289 290 if($Debug) 290 if($Debug) 291 291 { 292 292 echo('AbsoluteLeftTime: '.$AbsoluteLeftTime.'('.TimeToMysqlDateTime($AbsoluteLeftTime).')<br>'); … … 297 297 298 298 function LoadRightSideValue($Level, $Measure, $Time) 299 { 299 { 300 300 global $Debug, $Database; 301 301 $Result = array(); … … 362 362 //$AbsoluteTime = GetTimeRange($MeasureId); 363 363 364 // if(($TimeFrom > $AbsoluteLeftTime) and ($TimeStart < $AbsoluteRightTime) and 364 // if(($TimeFrom > $AbsoluteLeftTime) and ($TimeStart < $AbsoluteRightTime) and 365 365 // ($TimeTo > $AbsoluteLeftTime) and ($TimeTo < $AbsoluteRightTime)) 366 366 // { … … 480 480 // Load values in time range 481 481 //array_pop($NextValues); 482 } 482 } 483 483 echo("Uroven dokoncena<br>\n"); 484 484 $DbResult = $Database->select($Measure['DataTable'], 'COUNT(*)', 'level='.$Level.' AND measure='.$Measure['Id']); … … 525 525 ) ENGINE = MYISAM ;'); 526 526 } 527 528 ?> -
trunk/Application/Version.php
r46 r47 1 1 <?php 2 2 3 $Revision = 4 6; // Subversion revision3 $Revision = 47; // Subversion revision 4 4 $DatabaseRevision = 46; // SQL structure revision 5 5 $ReleaseTime = strtotime('2014-07-27'); -
trunk/Application/View/Graph.php
r46 r47 222 222 } 223 223 } 224 225 ?> -
trunk/Application/View/Main.php
r46 r47 223 223 } 224 224 } 225 226 ?> -
trunk/Application/View/Page.php
r46 r47 65 65 } 66 66 } 67 68 ?> -
trunk/Application/View/User.php
r42 r47 38 38 'Email' => array('Type' => 'String', 'Caption' => 'E-mail', 'Default' => ''), 39 39 ), 40 ); 40 ); 41 41 var $LoginFormClass = array( 42 42 'Title' => 'Přihlášení uživatele', … … 48 48 ), 49 49 ); 50 50 51 51 function Login() 52 52 { 53 53 global $Config; 54 54 55 55 $Form = new Form($this->System, $this->LoginFormClass); 56 56 $Form->OnSubmit = '?Module=User&Action=LoginFinish'; 57 57 $Output = $Form->ShowEditForm(); 58 58 $Output .= '<div class="Centred">'; 59 if($Config['System']['UserRegistrationEnabled']) 59 if($Config['System']['UserRegistrationEnabled']) 60 60 $Output .= '<a href="?Module=User&Action=Register">Registrovat se</a> '; 61 61 $Output .= '<a href="?Module=User&Action=PasswordRecovery">Obnova zapomenutého hesla</a></div>'; 62 62 return($Output); 63 63 } 64 64 65 65 function LoginFinish() 66 66 { … … 80 80 return($Output); 81 81 } 82 82 83 83 function RegisterSave() 84 84 { 85 85 global $Config; 86 87 if($Config['System']['UserRegistrationEnabled']) 86 87 if($Config['System']['UserRegistrationEnabled']) 88 88 { 89 89 $Form = new Form($this->System, $this->RegisterFormClass, array()); … … 100 100 return($Output); 101 101 } 102 102 103 103 function PasswordRecoveryConfirm() 104 104 { … … 108 108 return($Output); 109 109 } 110 110 111 111 function PasswordRecoveryFinish() 112 112 { … … 119 119 { 120 120 $Output .= $Form->ShowEditForm(); 121 } 121 } 122 122 return($Output); 123 123 } 124 124 125 125 function PasswordRecovery() 126 126 { … … 130 130 return($Output); 131 131 } 132 132 133 133 function Logout() 134 134 { … … 138 138 return($Output); 139 139 } 140 140 141 141 function Options() 142 142 { … … 147 147 return($Output); 148 148 } 149 149 150 150 function OptionsSave() 151 151 { … … 161 161 return($Output); 162 162 } 163 163 164 164 function Register() 165 165 { 166 166 global $Config; 167 168 if($Config['System']['UserRegistrationEnabled']) 167 168 if($Config['System']['UserRegistrationEnabled']) 169 169 { 170 170 $Form = new Form($this->System, $this->RegisterFormClass); … … 176 176 return($Output); 177 177 } 178 178 179 179 function RegisterConfirm() 180 180 { 181 181 global $Config; 182 183 if($Config['System']['UserRegistrationEnabled']) 182 183 if($Config['System']['UserRegistrationEnabled']) 184 184 { 185 185 $Page = new PageView($this->System); … … 190 190 } 191 191 } 192 193 ?> -
trunk/Base/Config/ConfigSample.php
r46 r47 27 27 'ShowRuntimeInfo' => false, 28 28 'FormatHTML' => false, 29 'ErrorLogFile' => 'php_script_error.log', 29 'ErrorLogFile' => 'php_script_error.log', 30 30 'TableRowPerPage' => 30, 31 31 'Style' => 'Basic', … … 34 34 ), 35 35 ); 36 37 ?> -
trunk/Base/Controller.php
r45 r47 4 4 5 5 class Controller extends Module 6 { 6 { 7 7 function OnAccessDenied($Action, $Id) 8 8 { 9 9 return($this->System->Output->SystemMessage('Nemáte oprávnění provést akci "'.$Action.'" modulu "'.substr(get_class($this), 0, -10).'" na položce "'.$Id.'"')); 10 10 } 11 11 12 12 function Process() 13 13 { … … 29 29 } 30 30 } 31 32 ?> -
trunk/Base/Database.php
r46 r47 106 106 } 107 107 } 108 109 ?> -
trunk/Base/Error.php
r42 r47 4 4 { 5 5 global $Config; 6 6 7 7 $Date = date('Y-m-d H:i:s'); // časové razítko položky 8 8 $ErrorType = array … … 21 21 ); 22 22 $UserErrors = E_ALL; //E_ERROR | E_WARNING | E_PARSE; 23 23 24 24 if(($UserErrors & $Number)) 25 25 { … … 32 32 //$First = array_shift($Backtrace); 33 33 //print_r($First); 34 34 35 35 //array_unshift($Backtrace, $First); 36 36 //array_shift($Backtrace); … … 48 48 if(strlen($Arguments) > 0) $Error .= '('.substr($Arguments, 0, -1).')'; 49 49 $Error .= "\n"; 50 50 51 51 } 52 52 $Error .= "\n"; … … 63 63 '<head>'. 64 64 '<meta http-equiv="content-type" content="application/xhtml+xml; charset=utf-8" />'. 65 '</head><body>'. 65 '</head><body>'. 66 66 'Došlo k vnitřní chybě!<br /> O chybě byl uvědoměn správce webu a chybu brzy odstraní.<br /><br />'); 67 67 echo('<pre>'.$Error.'</pre><br />'); // V případě ladění chybu i zobraz 68 68 echo('</body></html>'); 69 69 } 70 if((E_ERROR | E_PARSE) & $Number) die(); 70 if((E_ERROR | E_PARSE) & $Number) die(); 71 71 } 72 72 } 73 73 74 74 set_error_handler('CustomErrorHandler'); 75 76 ?> -
trunk/Base/HTML/Form.php
r42 r47 8 8 var $Values = array(); 9 9 var $OnSubmit = ''; 10 10 11 11 function __construct($System, $FormClass) 12 12 { … … 16 16 { 17 17 $this->Values[$Index] = ''; 18 } 18 } 19 19 } 20 20 … … 36 36 if($Item['Type'] != 'Hidden') 37 37 { 38 if(!array_key_exists($Index, $this->Values) and isset($Item['Default'])) $this->Values[$Index] = $Item['Default']; 38 if(!array_key_exists($Index, $this->Values) and isset($Item['Default'])) $this->Values[$Index] = $Item['Default']; 39 39 $Edit = $this->System->Type->ExecuteTypeEvent($Item['Type'], 'OnView', 40 40 array('Name' => $Index, 'Value' => $this->Values[$Index], 'Type' => $Item['Type'])); … … 43 43 } 44 44 $Output = '<div style="text-align: center">'.$this->Definition['Title'].'</div>'.$this->Table($Table, 'WideTable'); 45 return($Output); 45 return($Output); 46 46 } 47 47 … … 62 62 foreach($this->Definition['Items'] as $Index => $Item) 63 63 { 64 if($Item['Type'] != 'Hidden') 64 if($Item['Type'] != 'Hidden') 65 65 { 66 if(!array_key_exists($Index, $this->Values) and isset($Item['Default'])) $this->Values[$Index] = $Item['Default']; 66 if(!array_key_exists($Index, $this->Values) and isset($Item['Default'])) $this->Values[$Index] = $Item['Default']; 67 67 $Edit = $this->System->Type->ExecuteTypeEvent($Item['Type'], 'OnEdit', array('Name' => $Index, 'Value' => $this->Values[$Index], 'Type' => $Item['Type'])); 68 68 array_push($Table['Rows'], array($Item['Caption'].':', $Edit)); … … 73 73 foreach($this->Definition['Items'] as $Index => $Item) 74 74 if($Item['Type'] == 'Hidden') $Output .= $this->System->Type->ExecuteTypeEvent($Item['Type'], 'OnEdit', array('Name' => $Index, 'Value' => $this->Values[$Index], 'Type' => $Item['Type'])); 75 return($Output); 75 return($Output); 76 76 } 77 77 … … 119 119 } 120 120 } 121 122 ?> -
trunk/Base/HTML/HTML.php
r42 r47 16 16 { 17 17 $Indentation = 2; 18 18 19 19 $Output = ''; 20 20 $Indent = 0; … … 30 30 } 31 31 $Line = trim(substr($Text, $Start, $End + 1)); 32 if(strlen($Line) > 0) 32 if(strlen($Line) > 0) 33 33 if($Line[0] == '<') 34 34 { 35 if($Text[$Start + 1] == '/') 35 if($Text[$Start + 1] == '/') 36 36 { 37 37 $IndentNew = $IndentNew - $Indentation; 38 38 $Indent = $IndentNew; 39 } else 39 } else 40 40 { 41 41 if(strpos($Line, ' ')) $Command = substr($Line, 1, strpos($Line, ' ') - 1); 42 42 else $Command = substr($Line, 1, strlen($Line) - $Indentation); 43 43 if(strpos($Text, '</'.$Command.'>')) $IndentNew = $IndentNew + $Indentation; 44 } 44 } 45 45 } 46 46 if($Line != '') $Output .= (str_repeat(' ', $Indent).$Line."\n"); … … 59 59 function MakeLink($Title, $Target) 60 60 { 61 return('<a href="'.$Target.'">'.$Title.'</a>'); 61 return('<a href="'.$Target.'">'.$Title.'</a>'); 62 62 } 63 63 … … 89 89 // Zobrazení číselný seznamu stránek 90 90 function PageList($QueryStringVar, $Page, $TotalCount, $CountPerPage, $Around = 10) 91 { 91 { 92 92 $QueryStringArray = $this->System->HTTP->GetQueryStringArray(); 93 93 $Count = ceil($TotalCount / $CountPerPage); … … 95 95 if($Count > 1) 96 96 { 97 if($Page > 0) 97 if($Page > 0) 98 98 { 99 99 $QueryStringArray[$QueryStringVar] = 0; … … 118 118 } 119 119 if($PagesMax < ($Count - 1)) $Result .= ' .. '; 120 if($Page < ($Count - 1)) 120 if($Page < ($Count - 1)) 121 121 { 122 122 $QueryStringArray[$QueryStringVar] = $Page + 1; … … 138 138 } 139 139 } 140 141 ?> -
trunk/Base/HTML/Table.php
r42 r47 14 14 var $TotalRowCount; 15 15 var $RowPerPage = 20; 16 16 17 17 function __construct($System, $FormClass) 18 18 { 19 19 $this->System = $System; 20 $this->Definition = $FormClass; 20 $this->Definition = $FormClass; 21 21 $this->QueryParameters = array(); 22 22 } 23 23 24 24 function CheckOrder() 25 25 { … … 33 33 { 34 34 if(array_key_exists('DefaultOrderColumn', $this->Definition)) $_GET['Column'] = $this->Definition['DefaultOrderColumn']; 35 else 35 else 36 36 { 37 37 $Keys = array_keys($this->Definition['Items']); … … 64 64 $Output .= '<div class="Pager">'.$this->PageList('Page', $this->Page, $this->TotalRowCount, $this->RowPerPage).'</div>'; 65 65 return($Output); 66 } 67 66 } 67 68 68 function LoadValuesFromDatabase($Database) 69 { 69 { 70 70 $this->CheckOrder(); 71 71 $OrderType = array('ASC', 'DESC'); … … 103 103 $this->Values[] = $Row; 104 104 } 105 } 105 } 106 106 } 107 108 ?> -
trunk/Base/HTML/XHTML.php
r42 r47 34 34 } 35 35 } 36 37 ?> -
trunk/Base/HTTP.php
r44 r47 28 28 } 29 29 } 30 31 ?> -
trunk/Base/Mail.php
r42 r47 30 30 } 31 31 } 32 33 ?> -
trunk/Base/Model.php
r42 r47 6 6 { 7 7 } 8 9 ?> -
trunk/Base/Module.php
r40 r47 7 7 var $Config; 8 8 9 function __construct($System) 9 function __construct($System) 10 10 { 11 11 $this->Database = $System->Database; … … 14 14 } 15 15 } 16 17 ?> -
trunk/Base/Output.php
r42 r47 21 21 } 22 22 } 23 24 ?> -
trunk/Base/Permission.php
r42 r47 9 9 function Check($Module, $Action, $Item = '') 10 10 { 11 // TODO: Use permission check 11 12 return(true); 12 13 if($this->BuildCache) … … 76 77 } 77 78 } 78 79 ?> -
trunk/Base/System.php
r45 r47 84 84 { 85 85 } 86 86 87 87 class System 88 88 { 89 var $Model = array(); 90 var $View = array(); 91 var $Controller = array(); 89 var $Model = array(); 90 var $View = array(); 91 var $Controller = array(); 92 92 var $Config; 93 93 var $Database; … … 106 106 107 107 $TimeStart = $this->GetMicrotime(); 108 108 109 109 // Change base dir to index. Helpfull if script is executed from command line with related path. 110 110 chdir(dirname(__FILE__)); … … 119 119 } 120 120 121 $Config = array(); 122 121 123 $FileName = dirname(__FILE__).'/../Application/Config/Config.php'; 122 124 if(file_exists($FileName)) include($FileName); 123 125 124 126 $this->Config = $Config; 125 127 126 128 $ShowPHPError = $this->Config['System']['ShowPHPError']; 127 129 130 $Translation = array(); 128 131 $FileName = dirname(__FILE__).'/../Application/Locale/'.$this->Config['System']['Locale'].'.php'; 129 132 if(file_exists($FileName)) include($FileName); … … 142 145 $this->Database->Prefix = $this->Config['Database']['Prefix']; 143 146 $this->Database->charset($this->Config['Database']['Charset']); 144 147 145 148 $this->HTTP = new HTTP(); 146 149 $this->HTML = new HTML($this); … … 152 155 { 153 156 $this->TimeStart = $this->GetMicrotime(); 154 157 155 158 // SQL injection hack protection 156 159 foreach($_POST as $Index => $Item) $_POST[$Index] = addslashes($Item); … … 183 186 $this->Modules[$Name] = new $Name($this); 184 187 } 185 188 186 189 function HumanDate($Time) 187 190 { … … 214 217 $I = $PrefixMultipliers[$PrefixType]['BaseIndex']; 215 218 if($Value == 0) return($Value.' '.$PrefixMultipliers[$PrefixType]['Definition'][$I][0].$Unit); 216 217 if($Value > 1) 219 220 if($Value > 1) 218 221 { 219 222 while((($I + 1) <= count($PrefixMultipliers[$PrefixType]['Definition'])) and (($Value / $PrefixMultipliers[$PrefixType]['Definition'][$I + 1][2]) > 1)) 220 223 $I = $I + 1; 221 } else 224 } else 222 225 if($Value < 1) 223 226 { … … 226 229 } 227 230 $Value = $Value / $PrefixMultipliers[$PrefixType]['Definition'][$I][2]; 228 231 229 232 // Truncate digits count 230 233 $Value = $this->TruncateDigits($Value, $Digits); … … 232 235 return($Value.' '.$PrefixMultipliers[$PrefixType]['Definition'][$I][0].$Unit); 233 236 } 234 237 235 238 function NetworkPortState($Address, $Port, $Timeout = 1) 236 239 { … … 281 284 } 282 285 } 283 284 ?> -
trunk/Base/Types/Base.php
r42 r47 31 31 } 32 32 } 33 34 ?> -
trunk/Base/Types/Boolean.php
r42 r47 21 21 function OnLoad($Item) 22 22 { 23 if(array_key_exists($Item['Name'], $_POST)) return(1); 23 if(array_key_exists($Item['Name'], $_POST)) return(1); 24 24 else return(0); 25 25 } 26 26 } 27 28 ?> -
trunk/Base/Types/Date.php
r42 r47 60 60 } 61 61 } 62 63 ?> -
trunk/Base/Types/DateTime.php
r42 r47 10 10 { 11 11 global $MonthNames; 12 12 13 13 if($Item['Value'] != '') 14 14 { … … 92 92 } 93 93 } 94 95 ?> -
trunk/Base/Types/Enumeration.php
r42 r47 32 32 } 33 33 } 34 35 ?> -
trunk/Base/Types/File/File.php
r40 r47 43 43 } 44 44 } 45 46 ?> -
trunk/Base/Types/File/FileDownload.php
r40 r47 20 20 echo(file_get_contents($Config['UploadFileFolder'].'/'.$DbRow['Id'])); 21 21 } else echo('Soubor nenalezen!'); 22 23 ?> -
trunk/Base/Types/Float.php
r42 r47 24 24 } 25 25 } 26 27 ?> -
trunk/Base/Types/GPS.php
r42 r47 70 70 } 71 71 } 72 73 ?> -
trunk/Base/Types/Hidden.php
r42 r47 22 22 } 23 23 } 24 25 ?> -
trunk/Base/Types/Hyperlink.php
r42 r47 22 22 } 23 23 } 24 25 ?> -
trunk/Base/Types/IPv4Address.php
r42 r47 22 22 } 23 23 } 24 25 ?> -
trunk/Base/Types/Integer.php
r42 r47 24 24 } 25 25 } 26 27 ?> -
trunk/Base/Types/Password.php
r42 r47 27 27 $Result = $_POST[$Item['Name']]; 28 28 /* 29 if(!array_key_exists('SourceItemId', $Item)) $Result = sha1($_POST[$Item['Name']]); 29 if(!array_key_exists('SourceItemId', $Item)) $Result = sha1($_POST[$Item['Name']]); 30 30 else 31 31 { … … 42 42 } 43 43 } 44 45 ?> -
trunk/Base/Types/PointerOneToMany.php
r42 r47 7 7 function OnView($Item) 8 8 { 9 $Type = $this->System->Type->TypeDefinitionList[$Item['Type']]; 9 10 $Output = '<a href="?Action=ShowList&TableId='.$Type['TypeDefinition'].'&ParentTable='.$Item['SourceTable'].'&ParentColumn='.$Item['SourceItemId'].'">Seznam</a>'; 10 11 return($Output); … … 13 14 function OnEdit($Item) 14 15 { 16 $Type = $this->System->Type->TypeDefinitionList[$Item['Type']]; 15 17 $Output = '<a href="?Action=ShowList&TableId='.$Type['TypeDefinition'].'&ParentTable='.$Item['SourceTable'].'&ParentColumn='.$Item['SourceItemId'].'">Seznam</a>'; 16 18 return($Output); … … 22 24 } 23 25 } 24 25 ?> -
trunk/Base/Types/PointerOneToOne.php
r42 r47 37 37 } 38 38 } 39 40 ?> -
trunk/Base/Types/String.php
r42 r47 29 29 } 30 30 } 31 32 ?> -
trunk/Base/Types/Text.php
r42 r47 29 29 } 30 30 } 31 32 ?> -
trunk/Base/Types/Time.php
r42 r47 56 56 } 57 57 } 58 59 ?> -
trunk/Base/Types/Type.php
r42 r47 68 68 $Type = $this->TypeDefinitionList[$ParentType]; 69 69 } else $Type = array(); 70 70 71 71 $Type['Name'] = $Name; 72 72 $Type['Parameters'] = array_merge($Type['Parameters'], $Parameters); … … 79 79 } 80 80 } 81 82 83 ?> -
trunk/Base/UTF8.php
r40 r47 21 21 ISO8859-1: iso1 22 22 Windows1257: win1257 23 23 24 24 example: $new_string=to_utf8($some_string,"win1250"); 25 25 */ … … 28 28 /* 29 29 translation table - actually, it's array where key is hexadecimal number of 30 character in ISO8859-2/Windows1250 and value is its two byte representation in UTF-8 30 character in ISO8859-2/Windows1250 and value is its two byte representation in UTF-8 31 31 */ 32 32 … … 527 527 528 528 $Result = ''; 529 for($I = 0; $I < strlen($String); $I++) 529 for($I = 0; $I < strlen($String); $I++) 530 530 { 531 531 if(ord($String[$I]) < 128) $Result .= $String[$I]; … … 563 563 return($Result); 564 564 } 565 566 ?> -
trunk/Base/View.php
r42 r47 6 6 { 7 7 } 8 9 ?> -
trunk/Base/XML.php
r42 r47 48 48 var $Content; 49 49 var $Indentation; 50 50 51 51 function __construct() 52 52 { … … 56 56 $this->Indentation = 2; 57 57 } 58 58 59 59 function GetOutput() 60 60 { … … 104 104 } 105 105 } 106 107 ?> -
trunk/index.php
r45 r47 18 18 $Application = new Application(); 19 19 $Application->Run(); 20 21 ?> -
trunk/measure_scripts/monitor_sample.php
r39 r47 12 12 13 13 $NetworkState = GetNetworkState(); 14 file_get_contents($Config['AddNewValueUrl'].'?MeasureId=3&Value='.MemoryUsage()); 14 file_get_contents($Config['AddNewValueUrl'].'?MeasureId=3&Value='.MemoryUsage()); 15 15 file_get_contents($Config['AddNewValueUrl'].'?MeasureId=4&Value='.CpuUsage()); 16 16 file_get_contents($Config['AddNewValueUrl'].'?MeasureId=5&Value='.WoWPlayersOnline()); … … 20 20 file_get_contents($Config['AddNewValueUrl'].'?MeasureId=10&Value='.WoWGMOnline()); 21 21 file_get_contents($Config['AddNewValueUrl'].'?MeasureId=11&Value='.round($NetworkState['eth1']['DownAverage'])); 22 file_get_contents($Config['AddNewValueUrl'].'?MeasureId=12&Value='.round($NetworkState['eth1']['UpAverage'])); 22 file_get_contents($Config['AddNewValueUrl'].'?MeasureId=12&Value='.round($NetworkState['eth1']['UpAverage'])); 23 23 file_get_contents($Config['AddNewValueUrl'].'?MeasureId=13&Value='.WoWCharacterCount()); 24 24 file_get_contents($Config['AddNewValueUrl'].'?MeasureId=14&Value='.WoWGuildCount()); … … 31 31 file_put_contents('/tmp/LastNetworkState', serialize($LastNetworkState)); 32 32 file_put_contents('/tmp/LastCpuUsage', serialize($LastCpuUsage)); 33 34 ?> -
trunk/measure_scripts/system.php
r39 r47 5 5 function ErrorHandler($errno,$errmsg,$filename,$linenum,$vars) 6 6 { 7 } 7 } 8 8 9 9 function CheckPortStatus($Ip, $Port, $Timeout = 0.5) … … 24 24 25 25 function Ping($Host = 'nix.cz') 26 { 26 { 27 27 exec('ping '.$Host.' -c 1 -W 1|grep time=', $Row); 28 28 // W - timeout in seconds … … 85 85 { 86 86 global $LastNetworkState; 87 87 88 88 if(!isset($LastNetworkState)) $LastNetworkState = array(); 89 89 $NetworkState = array('Time' => time()); … … 93 93 array_shift($Output); // Skip header 94 94 foreach($Output as $Item) 95 { 95 { 96 96 while(strpos($Item, ' ') !== false) $Item = str_replace(' ', ' ', $Item); // Rrmove multiple spaces 97 97 $Item = explode(':', $Item); … … 164 164 return($UptimeParts[0]); 165 165 } 166 167 168 ?>
Note:
See TracChangeset
for help on using the changeset viewer.