Changeset 47 for trunk/Application
- Timestamp:
- Jul 27, 2014, 9:14:56 PM (10 years ago)
- Location:
- trunk
- Files:
-
- 23 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 ?>
Note:
See TracChangeset
for help on using the changeset viewer.