Changeset 47 for trunk


Ignore:
Timestamp:
Jul 27, 2014, 9:14:56 PM (10 years ago)
Author:
chronos
Message:
  • Odstraněno: Zbytečná PHP ukončovací značka "?>" z konce všech souborů.
Location:
trunk
Files:
64 edited

Legend:

Unmodified
Added
Removed
  • trunk

    • Property svn:ignore
      •  

        old new  
        1 
        21config.php
         2.project
  • trunk/Application/Application.php

    r42 r47  
    99{
    1010  var $DefaultModule = 'Main';
    11  
     11
    1212  function __construct()
    1313  {
    1414    parent::__construct();
    1515    $this->Output = new CustomOutput($this);
    16    
     16
    1717/*    $this->Type->RegisterType('YesNo', 'Enumeration', array('Ano', 'Ne'));
    1818    $this->Type->RegisterType('NoYes', 'Enumeration', array('Ne', 'Ano'));
     
    2727    //$this->AddModule('Log');
    2828    //$this->AddModule('UserList');
    29    
     29
    3030    //if(isset($_SERVER['REMOTE_ADDR'])) $this->Modules['UserList']->Check();
    3131    //  else $this->Modules['UserList']->CurrentUser = new User(0);
     
    3434  }
    3535}
    36 
    37 ?>
  • trunk/Application/Config/ConfigSample.php

    r46 r47  
    2424  ),
    2525);
    26 
    27 ?>
  • trunk/Application/Controller/Add.php

    r45 r47  
    2222  }
    2323}
    24 
    25 ?>
  • trunk/Application/Controller/Client.php

    r45 r47  
    1010    $MeasureClient = new MeasureClient($this->System);
    1111    $MeasureClient->Process();
    12    
     12
    1313    //$View = new MeasureView($this->System);
    1414    //return($View->Add());
    1515  }
    1616}
    17 
    18 ?>
  • trunk/Application/Controller/Graph.php

    r45 r47  
    99  {
    1010    $this->System->Output->FullPage = false;
    11    
     11
    1212    $View = new GraphView($this->System);
    1313    return($View->Render());
    1414  }
    1515}
    16 
    17 ?>
  • trunk/Application/Controller/Main.php

    r42 r47  
    1212  }
    1313}
    14 
    15 ?>
  • trunk/Application/Controller/Measure.php

    r40 r47  
    99  }
    1010}
    11 
    12 ?>
  • trunk/Application/Controller/User.php

    r40 r47  
    88    $View = new UserView($this->System);
    99    return($Page->GetOutput($View->Login()));
    10   } 
    11  
     10  }
     11
    1212  function LoginFinish()
    1313  {
     
    1515    $View = new UserView($this->System);
    1616    return($Page->GetOutput($View->LoginFinish()));
    17   } 
     17  }
    1818
    1919  function Logout()
     
    2222    $View = new UserView($this->System);
    2323    return($Page->GetOutput($View->Logout()));
    24   } 
     24  }
    2525
    2626  function Options()
     
    2929    $View = new UserView($this->System);
    3030    return($Page->GetOutput($View->Options()));
    31   } 
    32  
     31  }
     32
    3333  function OptionsSave()
    3434  {
     
    3636    $View = new UserView($this->System);
    3737    return($Page->GetOutput($View->OptionsSave()));
    38   } 
     38  }
    3939
    4040  function Register()
     
    4343    $View = new UserView($this->System);
    4444    return($Page->GetOutput($View->Register()));
    45   } 
     45  }
    4646
    4747  function RegisterConfirm()
     
    5050    $View = new UserView($this->System);
    5151    return($Page->GetOutput($View->Confirm()));
    52   } 
     52  }
    5353
    5454  function PasswordRecovery()
     
    5757    $View = new UserView($this->System);
    5858    return($Page->GetOutput($View->PasswordRecovery()));
    59   } 
     59  }
    6060
    6161  function PasswordRecoveryFinish()
     
    6464    $View = new UserView($this->System);
    6565    return($Page->GetOutput($View->PasswordRecovery()));
    66   } 
     66  }
    6767
    6868  function PasswordRecoveryConfirm()
     
    7171    $View = new UserView($this->System);
    7272    return($Page->GetOutput($View->PasswordRecoveryConfirm()));
    73   } 
     73  }
    7474
    7575  function RegisterSave()
     
    7878    $View = new UserView($this->System);
    7979    return($Page->GetOutput($View->RegisterSave()));
    80   }   
     80  }
    8181}
    82 
    83 ?>
  • trunk/Application/CustomOutput.php

    r46 r47  
    7474  }
    7575}
    76 
    77 ?>
  • trunk/Application/Locale/cs_CZ.php

    r42 r47  
    2626  'UserPasswordRecoveryConfirmed' => 'Nové heslo bylo aktivováno.',
    2727  'UserBadRole' => 'Nemáte dostatečná oprávnění',
    28  
     28
    2929  'AccessDenied' => 'K provedení požadované akce nemáte dostatečné oprávnění',
    3030);
    31 
    32 ?>
  • trunk/Application/Model/Measure.php

    r46 r47  
    467467  }
    468468}
    469 
    470 ?>
  • trunk/Application/Model/Measurement/MeasureClient.php

    r44 r47  
    2626      } else echo('Třída '.$MeasureMethod['MeasureClass'].' neexistuje.');
    2727    }
    28   } 
     28  }
    2929}
    30 
    31 ?>
  • trunk/Application/Model/Measurement/Measurement.php

    r43 r47  
    66{
    77}
    8 
    9 ?>
  • trunk/Application/Model/Measurement/System.php

    r44 r47  
    2424
    2525  function Ping($Host = 'nix.cz')
    26   { 
     26  {
     27    $Row = array();
    2728    exec('ping '.$Host.' -c 1 -W 1|grep time=', $Row);
    2829    // W - timeout in seconds
     
    5556    $LastCpuUsage = unserialize(file_get_contents($CpuStateFileName));
    5657    //$cpuIDLEprev, $cpuSYSTprev, $cpuUSERprev;
    57  
     58
    5859    // get processor usage seconds for pct stats ###
    5960    $File = fopen('/proc/stat', 'r');
     
    6970    $CpuUsageDiffTotal = (($CpuUsageDiff['User'] + $CpuUsageDiff['System']) + $CpuUsageDiff['Idle']);
    7071    if ($CpuUsageDiffTotal > 0)
    71     { 
     72    {
    7273      $CpuUsagePercent['User'] = ($CpuUsageDiff['User'] / $CpuUsageDiffTotal) * 100;
    7374      $CpuUsagePercent['System'] = ($CpuUsageDiff['System'] / $CpuUsageDiffTotal) * 100;
     
    9394    array_shift($Output); // Skip header
    9495    foreach($Output as $Item)
    95     { 
     96    {
    9697      while(strpos($Item, '  ') !== false) $Item = str_replace('  ', ' ', $Item);  // Rrmove multiple spaces
    9798      $Item = explode(':', $Item);
     
    108109        $NetworkState[$Interface]['DownAverage'] = 0;
    109110        $NetworkState[$Interface]['UpAverage'] = 0;
    110       } 
     111      }
    111112      if($NetworkState[$Interface]['DownAverage'] < 0) $NetworkState[$Interface]['DownAverage'] = 0;
    112113      if($NetworkState[$Interface]['UpAverage'] < 0) $NetworkState[$Interface]['UpAverage'] = 0;
     
    121122    return($NetworkState['Interface']['DownAverage']);
    122123  }
    123  
     124
    124125  function NetworkSpeedUpload($Interface)
    125126  {
     
    177178  }
    178179}
    179 
    180 ?>
  • trunk/Application/Model/Permission.php

    r40 r47  
    1111      if($DbRow['SubGroup'] > 0) $Result = array_merge($Result, $this->LoadForGroup($DbRow['SubGroup']));
    1212      if($DbRow['Operation'] > 0)
    13       { 
     13      {
    1414        $DbResult2 = $this->Database->query('SELECT `PermissionOperation`.*, `Module`.`Name` FROM `PermissionOperation` JOIN `Module` ON `Module`.`Id` = `PermissionOperation`.`Module` WHERE `PermissionOperation`.`Id`='.$DbRow['Operation']);
    1515        $DbRow2 = $DbResult2->fetch_assoc();
     
    1919    $this->Data = $Result;
    2020  }
    21    
     21
    2222  function LoadForGroup($Group)
    2323  {
     
    2828      if($DbRow['SubGroup'] > 0) $Result = array_merge($Result, $this->LoadForGroup($DbRow['SubGroup']));
    2929      if($DbRow['Operation'] > 0)
    30       { 
     30      {
    3131        $DbResult2 = $this->Database->query('SELECT `PermissionOperation`.*, `Module`.`Name` FROM `PermissionOperation` JOIN `Module` ON `Module`.`Id` = `PermissionOperation`.`Module` WHERE `PermissionOperation`.`Id`='.$DbRow['Operation']);
    3232        $DbRow2 = $DbResult2->fetch_assoc();
     
    3636    return($Result);
    3737  }
    38  
     38
    3939  function Check($Module, $Action, $Item = 0)
    4040  {
     
    4444  }
    4545}
    46 
    47 ?>
  • trunk/Application/Model/User.php

    r46 r47  
    267267  }
    268268}
    269 
    270 ?>
  • trunk/Application/Model/stat_functions.php

    r43 r47  
    4343  if($Unit == '') return(TruncateDigits($Value, $Digits));
    4444  $I = 8;
    45   if($Value > 0) $II = 1; 
     45  if($Value > 0) $II = 1;
    4646  else if($Value < 0) $II = -1;
    4747  else $II = 0;
     
    9999  $Result = $Database->select($Measure['DataTable'], '*', 'measure='.$Measure['Id'].' AND level='.$Level.' ORDER BY time DESC LIMIT 2');
    100100  //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));
    104104     //echo($Database->LastQuery."\n");
    105105  } else if($Result->num_rows == 1)
     
    237237        }
    238238      }
    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>');
    242242        if($Values[$I + 1]['continuity'] == $Measure['ContinuityEnabled'])
    243243        {
     
    258258    $NewValue[$ValueType] = $NewValue[$ValueType];
    259259  }
    260   //if(($RightTime - $LeftTime) > 0) 
    261   if($Measure['Cumulative'] == 0) 
     260  //if(($RightTime - $LeftTime) > 0)
     261  if($Measure['Cumulative'] == 0)
    262262  {
    263263    $NewValue['avg'] = $NewValue['avg'] / ($RightTime - $LeftTime);
     
    273273
    274274  // Get first and last time
    275   //echo($Measure['Id'].','.$Level.','.StatTableName($Level)."\n"); 
     275  //echo($Measure['Id'].','.$Level.','.StatTableName($Level)."\n");
    276276  $Result = $Database->select($Measure['DataTable'], '*', 'measure='.$Measure['Id'].' AND level='.$Level.' ORDER BY time LIMIT 1');
    277277  if($Result->num_rows > 0)
     
    288288  } else $AbsoluteRightTime = 0;
    289289
    290   if($Debug) 
     290  if($Debug)
    291291  {
    292292    echo('AbsoluteLeftTime: '.$AbsoluteLeftTime.'('.TimeToMysqlDateTime($AbsoluteLeftTime).')<br>');
     
    297297
    298298function LoadRightSideValue($Level, $Measure, $Time)
    299 { 
     299{
    300300  global $Debug, $Database;
    301301  $Result = array();
     
    362362  //$AbsoluteTime = GetTimeRange($MeasureId);
    363363
    364 //  if(($TimeFrom > $AbsoluteLeftTime) and ($TimeStart < $AbsoluteRightTime) and 
     364//  if(($TimeFrom > $AbsoluteLeftTime) and ($TimeStart < $AbsoluteRightTime) and
    365365//    ($TimeTo > $AbsoluteLeftTime) and ($TimeTo < $AbsoluteRightTime))
    366366//  {
     
    480480      // Load values in time range
    481481      //array_pop($NextValues);
    482     } 
     482    }
    483483    echo("Uroven dokoncena<br>\n");
    484484    $DbResult = $Database->select($Measure['DataTable'], 'COUNT(*)', 'level='.$Level.' AND measure='.$Measure['Id']);
     
    525525) ENGINE = MYISAM ;');
    526526}
    527 
    528 ?>
  • trunk/Application/Version.php

    r46 r47  
    11<?php
    22
    3 $Revision = 46; // Subversion revision
     3$Revision = 47; // Subversion revision
    44$DatabaseRevision = 46; // SQL structure revision
    55$ReleaseTime = strtotime('2014-07-27');
  • trunk/Application/View/Graph.php

    r46 r47  
    222222  }
    223223}
    224 
    225 ?>
  • trunk/Application/View/Main.php

    r46 r47  
    223223  }
    224224}
    225 
    226 ?>
  • trunk/Application/View/Page.php

    r46 r47  
    6565  }
    6666}
    67 
    68 ?>
  • trunk/Application/View/User.php

    r42 r47  
    3838      'Email' => array('Type' => 'String', 'Caption' => 'E-mail', 'Default' => ''),
    3939    ),
    40   ); 
     40  );
    4141  var $LoginFormClass = array(
    4242    'Title' => 'Přihlášení uživatele',
     
    4848    ),
    4949  );
    50  
     50
    5151  function Login()
    5252  {
    5353    global $Config;
    54    
     54
    5555    $Form = new Form($this->System, $this->LoginFormClass);
    5656    $Form->OnSubmit = '?Module=User&amp;Action=LoginFinish';
    5757    $Output = $Form->ShowEditForm();
    5858    $Output .= '<div class="Centred">';
    59     if($Config['System']['UserRegistrationEnabled']) 
     59    if($Config['System']['UserRegistrationEnabled'])
    6060      $Output .= '<a href="?Module=User&amp;Action=Register">Registrovat se</a> ';
    6161    $Output .= '<a href="?Module=User&amp;Action=PasswordRecovery">Obnova zapomenutého hesla</a></div>';
    6262    return($Output);
    6363  }
    64  
     64
    6565  function LoginFinish()
    6666  {
     
    8080    return($Output);
    8181  }
    82  
     82
    8383  function RegisterSave()
    8484  {
    8585    global $Config;
    86    
    87     if($Config['System']['UserRegistrationEnabled']) 
     86
     87    if($Config['System']['UserRegistrationEnabled'])
    8888    {
    8989      $Form = new Form($this->System, $this->RegisterFormClass, array());
     
    100100    return($Output);
    101101  }
    102  
     102
    103103  function PasswordRecoveryConfirm()
    104104  {
     
    108108    return($Output);
    109109  }
    110  
     110
    111111  function PasswordRecoveryFinish()
    112112  {
     
    119119    {
    120120      $Output .= $Form->ShowEditForm();
    121     }       
     121    }
    122122    return($Output);
    123123  }
    124  
     124
    125125  function PasswordRecovery()
    126126  {
     
    130130    return($Output);
    131131  }
    132  
     132
    133133  function Logout()
    134134  {
     
    138138    return($Output);
    139139  }
    140  
     140
    141141  function Options()
    142142  {
     
    147147    return($Output);
    148148  }
    149  
     149
    150150  function OptionsSave()
    151151  {
     
    161161    return($Output);
    162162  }
    163  
     163
    164164  function Register()
    165165  {
    166166    global $Config;
    167    
    168     if($Config['System']['UserRegistrationEnabled']) 
     167
     168    if($Config['System']['UserRegistrationEnabled'])
    169169    {
    170170      $Form = new Form($this->System, $this->RegisterFormClass);
     
    176176    return($Output);
    177177  }
    178  
     178
    179179  function RegisterConfirm()
    180180  {
    181181    global $Config;
    182    
    183     if($Config['System']['UserRegistrationEnabled']) 
     182
     183    if($Config['System']['UserRegistrationEnabled'])
    184184    {
    185185      $Page = new PageView($this->System);
     
    190190  }
    191191}
    192 
    193 ?>
  • trunk/Base/Config/ConfigSample.php

    r46 r47  
    2727    'ShowRuntimeInfo' => false,
    2828    'FormatHTML' => false,
    29     'ErrorLogFile' => 'php_script_error.log',   
     29    'ErrorLogFile' => 'php_script_error.log',
    3030    'TableRowPerPage' => 30,
    3131    'Style' => 'Basic',
     
    3434  ),
    3535);
    36 
    37 ?>
  • trunk/Base/Controller.php

    r45 r47  
    44
    55class Controller extends Module
    6 { 
     6{
    77  function OnAccessDenied($Action, $Id)
    88  {
    99    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.'"'));
    1010  }
    11  
     11
    1212  function Process()
    1313  {
     
    2929  }
    3030}
    31 
    32 ?>
  • trunk/Base/Database.php

    r46 r47  
    106106  }
    107107}
    108 
    109 ?>
  • trunk/Base/Error.php

    r42 r47  
    44{
    55  global $Config;
    6  
     6
    77  $Date = date('Y-m-d H:i:s');    // časové razítko položky
    88  $ErrorType = array
     
    2121  );
    2222  $UserErrors = E_ALL;  //E_ERROR | E_WARNING | E_PARSE;
    23  
     23
    2424  if(($UserErrors & $Number))
    2525  {
     
    3232    //$First = array_shift($Backtrace);
    3333    //print_r($First);
    34    
     34
    3535    //array_unshift($Backtrace, $First);
    3636    //array_shift($Backtrace);
     
    4848      if(strlen($Arguments) > 0) $Error .= '('.substr($Arguments, 0, -1).')';
    4949      $Error .= "\n";
    50      
     50
    5151    }
    5252    $Error .= "\n";
     
    6363      '<head>'.
    6464      '<meta http-equiv="content-type" content="application/xhtml+xml; charset=utf-8" />'.
    65       '</head><body>'.   
     65      '</head><body>'.
    6666      'Došlo k vnitřní chybě!<br /> O chybě byl uvědoměn správce webu a chybu brzy odstraní.<br /><br />');
    6767      echo('<pre>'.$Error.'</pre><br />');      // V případě ladění chybu i zobraz
    6868      echo('</body></html>');
    6969    }
    70     if((E_ERROR | E_PARSE) & $Number) die(); 
     70    if((E_ERROR | E_PARSE) & $Number) die();
    7171  }
    7272}
    7373
    7474set_error_handler('CustomErrorHandler');
    75 
    76 ?>
  • trunk/Base/HTML/Form.php

    r42 r47  
    88  var $Values = array();
    99  var $OnSubmit = '';
    10  
     10
    1111  function __construct($System, $FormClass)
    1212  {
     
    1616    {
    1717      $this->Values[$Index] = '';
    18     }   
     18    }
    1919  }
    2020
     
    3636      if($Item['Type'] != 'Hidden')
    3737      {
    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'];
    3939        $Edit = $this->System->Type->ExecuteTypeEvent($Item['Type'], 'OnView',
    4040          array('Name' => $Index, 'Value' => $this->Values[$Index], 'Type' => $Item['Type']));
     
    4343    }
    4444    $Output = '<div style="text-align: center">'.$this->Definition['Title'].'</div>'.$this->Table($Table, 'WideTable');
    45     return($Output); 
     45    return($Output);
    4646  }
    4747
     
    6262    foreach($this->Definition['Items'] as $Index => $Item)
    6363    {
    64       if($Item['Type'] != 'Hidden') 
     64      if($Item['Type'] != 'Hidden')
    6565      {
    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'];
    6767        $Edit = $this->System->Type->ExecuteTypeEvent($Item['Type'], 'OnEdit', array('Name' => $Index, 'Value' => $this->Values[$Index], 'Type' => $Item['Type']));
    6868        array_push($Table['Rows'], array($Item['Caption'].':', $Edit));
     
    7373    foreach($this->Definition['Items'] as $Index => $Item)
    7474      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);
    7676  }
    7777
     
    119119  }
    120120}
    121 
    122 ?>
  • trunk/Base/HTML/HTML.php

    r42 r47  
    1616  {
    1717    $Indentation = 2;
    18    
     18
    1919    $Output = '';
    2020    $Indent = 0;
     
    3030      }
    3131      $Line = trim(substr($Text, $Start, $End + 1));
    32       if(strlen($Line) > 0) 
     32      if(strlen($Line) > 0)
    3333      if($Line[0] == '<')
    3434      {
    35         if($Text[$Start + 1] == '/') 
     35        if($Text[$Start + 1] == '/')
    3636        {
    3737          $IndentNew = $IndentNew - $Indentation;
    3838          $Indent = $IndentNew;
    39         } else 
     39        } else
    4040        {
    4141          if(strpos($Line, ' ')) $Command = substr($Line, 1, strpos($Line, ' ') - 1);
    4242          else $Command = substr($Line, 1, strlen($Line) - $Indentation);
    4343          if(strpos($Text, '</'.$Command.'>')) $IndentNew = $IndentNew + $Indentation;
    44         }   
     44        }
    4545      }
    4646      if($Line != '') $Output .= (str_repeat(' ', $Indent).$Line."\n");
     
    5959  function MakeLink($Title, $Target)
    6060  {
    61     return('<a href="'.$Target.'">'.$Title.'</a>'); 
     61    return('<a href="'.$Target.'">'.$Title.'</a>');
    6262  }
    6363
     
    8989  // Zobrazení číselný seznamu stránek
    9090  function PageList($QueryStringVar, $Page, $TotalCount, $CountPerPage, $Around = 10)
    91   { 
     91  {
    9292    $QueryStringArray = $this->System->HTTP->GetQueryStringArray();
    9393    $Count = ceil($TotalCount / $CountPerPage);
     
    9595    if($Count > 1)
    9696    {
    97       if($Page > 0) 
     97      if($Page > 0)
    9898      {
    9999        $QueryStringArray[$QueryStringVar] = 0;
     
    118118      }
    119119      if($PagesMax < ($Count - 1)) $Result .= ' .. ';
    120       if($Page < ($Count - 1)) 
     120      if($Page < ($Count - 1))
    121121      {
    122122        $QueryStringArray[$QueryStringVar] = $Page + 1;
     
    138138  }
    139139}
    140 
    141 ?>
  • trunk/Base/HTML/Table.php

    r42 r47  
    1414  var $TotalRowCount;
    1515  var $RowPerPage = 20;
    16  
     16
    1717  function __construct($System, $FormClass)
    1818  {
    1919    $this->System = $System;
    20     $this->Definition = $FormClass;   
     20    $this->Definition = $FormClass;
    2121    $this->QueryParameters = array();
    2222  }
    23  
     23
    2424  function CheckOrder()
    2525  {
     
    3333    {
    3434      if(array_key_exists('DefaultOrderColumn', $this->Definition)) $_GET['Column'] = $this->Definition['DefaultOrderColumn'];
    35       else 
     35      else
    3636      {
    3737        $Keys = array_keys($this->Definition['Items']);
     
    6464    $Output .= '<div class="Pager">'.$this->PageList('Page', $this->Page, $this->TotalRowCount, $this->RowPerPage).'</div>';
    6565    return($Output);
    66   } 
    67  
     66  }
     67
    6868  function LoadValuesFromDatabase($Database)
    69   {   
     69  {
    7070    $this->CheckOrder();
    7171    $OrderType = array('ASC', 'DESC');
     
    103103      $this->Values[] = $Row;
    104104    }
    105   } 
     105  }
    106106}
    107 
    108 ?>
  • trunk/Base/HTML/XHTML.php

    r42 r47  
    3434  }
    3535}
    36 
    37 ?>
  • trunk/Base/HTTP.php

    r44 r47  
    2828  }
    2929}
    30 
    31 ?>
  • trunk/Base/Mail.php

    r42 r47  
    3030  }
    3131}
    32 
    33 ?>
  • trunk/Base/Model.php

    r42 r47  
    66{
    77}
    8 
    9 ?>
  • trunk/Base/Module.php

    r40 r47  
    77  var $Config;
    88
    9   function __construct($System) 
     9  function __construct($System)
    1010  {
    1111    $this->Database = $System->Database;
     
    1414  }
    1515}
    16 
    17 ?>
  • trunk/Base/Output.php

    r42 r47  
    2121  }
    2222}
    23 
    24 ?>
  • trunk/Base/Permission.php

    r42 r47  
    99  function Check($Module, $Action, $Item = '')
    1010  {
     11    // TODO: Use permission check
    1112    return(true);
    1213    if($this->BuildCache)
     
    7677  }
    7778}
    78 
    79 ?>
  • trunk/Base/System.php

    r45 r47  
    8484{
    8585}
    86  
     86
    8787class System
    8888{
    89   var $Model = array(); 
    90   var $View = array(); 
    91   var $Controller = array(); 
     89  var $Model = array();
     90  var $View = array();
     91  var $Controller = array();
    9292  var $Config;
    9393  var $Database;
     
    106106
    107107    $TimeStart = $this->GetMicrotime();
    108    
     108
    109109    // Change base dir to index. Helpfull if script is executed from command line with related path.
    110110    chdir(dirname(__FILE__));
     
    119119      }
    120120
     121    $Config = array();
     122
    121123    $FileName = dirname(__FILE__).'/../Application/Config/Config.php';
    122124    if(file_exists($FileName)) include($FileName);
    123    
     125
    124126    $this->Config = $Config;
    125    
     127
    126128    $ShowPHPError = $this->Config['System']['ShowPHPError'];
    127129
     130    $Translation = array();
    128131    $FileName = dirname(__FILE__).'/../Application/Locale/'.$this->Config['System']['Locale'].'.php';
    129132    if(file_exists($FileName)) include($FileName);
     
    142145    $this->Database->Prefix = $this->Config['Database']['Prefix'];
    143146    $this->Database->charset($this->Config['Database']['Charset']);
    144      
     147
    145148    $this->HTTP = new HTTP();
    146149    $this->HTML = new HTML($this);
     
    152155  {
    153156    $this->TimeStart = $this->GetMicrotime();
    154    
     157
    155158    // SQL injection hack protection
    156159    foreach($_POST as $Index => $Item) $_POST[$Index] = addslashes($Item);
     
    183186    $this->Modules[$Name] = new $Name($this);
    184187  }
    185  
     188
    186189  function HumanDate($Time)
    187190  {
     
    214217    $I = $PrefixMultipliers[$PrefixType]['BaseIndex'];
    215218    if($Value == 0) return($Value.' '.$PrefixMultipliers[$PrefixType]['Definition'][$I][0].$Unit);
    216      
    217     if($Value > 1) 
     219
     220    if($Value > 1)
    218221    {
    219222      while((($I + 1) <= count($PrefixMultipliers[$PrefixType]['Definition'])) and (($Value / $PrefixMultipliers[$PrefixType]['Definition'][$I + 1][2]) > 1))
    220223        $I = $I + 1;
    221     } else 
     224    } else
    222225    if($Value < 1)
    223226    {
     
    226229    }
    227230    $Value = $Value / $PrefixMultipliers[$PrefixType]['Definition'][$I][2];
    228    
     231
    229232    // Truncate digits count
    230233    $Value = $this->TruncateDigits($Value, $Digits);
     
    232235    return($Value.' '.$PrefixMultipliers[$PrefixType]['Definition'][$I][0].$Unit);
    233236  }
    234  
     237
    235238  function NetworkPortState($Address, $Port, $Timeout = 1)
    236239  {
     
    281284  }
    282285}
    283 
    284 ?>
  • trunk/Base/Types/Base.php

    r42 r47  
    3131  }
    3232}
    33 
    34 ?>
  • trunk/Base/Types/Boolean.php

    r42 r47  
    2121  function OnLoad($Item)
    2222  {
    23     if(array_key_exists($Item['Name'], $_POST)) return(1); 
     23    if(array_key_exists($Item['Name'], $_POST)) return(1);
    2424      else return(0);
    2525  }
    2626}
    27 
    28 ?>
  • trunk/Base/Types/Date.php

    r42 r47  
    6060  }
    6161}
    62 
    63 ?>
  • trunk/Base/Types/DateTime.php

    r42 r47  
    1010  {
    1111    global $MonthNames;
    12    
     12
    1313    if($Item['Value'] != '')
    1414    {
     
    9292  }
    9393}
    94 
    95 ?>
  • trunk/Base/Types/Enumeration.php

    r42 r47  
    3232  }
    3333}
    34 
    35 ?>
  • trunk/Base/Types/File/File.php

    r40 r47  
    4343  }
    4444}
    45 
    46 ?>
  • trunk/Base/Types/File/FileDownload.php

    r40 r47  
    2020  echo(file_get_contents($Config['UploadFileFolder'].'/'.$DbRow['Id']));
    2121} else echo('Soubor nenalezen!');
    22 
    23 ?>
  • trunk/Base/Types/Float.php

    r42 r47  
    2424  }
    2525}
    26 
    27 ?>
  • trunk/Base/Types/GPS.php

    r42 r47  
    7070  }
    7171}
    72 
    73 ?>
  • trunk/Base/Types/Hidden.php

    r42 r47  
    2222  }
    2323}
    24 
    25 ?>
  • trunk/Base/Types/Hyperlink.php

    r42 r47  
    2222  }
    2323}
    24 
    25 ?>
  • trunk/Base/Types/IPv4Address.php

    r42 r47  
    2222  }
    2323}
    24 
    25 ?>
  • trunk/Base/Types/Integer.php

    r42 r47  
    2424  }
    2525}
    26 
    27 ?>
  • trunk/Base/Types/Password.php

    r42 r47  
    2727    $Result = $_POST[$Item['Name']];
    2828    /*
    29     if(!array_key_exists('SourceItemId', $Item)) $Result = sha1($_POST[$Item['Name']]);   
     29    if(!array_key_exists('SourceItemId', $Item)) $Result = sha1($_POST[$Item['Name']]);
    3030    else
    3131    {
     
    4242  }
    4343}
    44 
    45 ?>
  • trunk/Base/Types/PointerOneToMany.php

    r42 r47  
    77  function OnView($Item)
    88  {
     9    $Type = $this->System->Type->TypeDefinitionList[$Item['Type']];
    910    $Output = '<a href="?Action=ShowList&amp;TableId='.$Type['TypeDefinition'].'&amp;ParentTable='.$Item['SourceTable'].'&amp;ParentColumn='.$Item['SourceItemId'].'">Seznam</a>';
    1011    return($Output);
     
    1314  function OnEdit($Item)
    1415  {
     16    $Type = $this->System->Type->TypeDefinitionList[$Item['Type']];
    1517    $Output = '<a href="?Action=ShowList&amp;TableId='.$Type['TypeDefinition'].'&amp;ParentTable='.$Item['SourceTable'].'&amp;ParentColumn='.$Item['SourceItemId'].'">Seznam</a>';
    1618    return($Output);
     
    2224  }
    2325}
    24 
    25 ?>
  • trunk/Base/Types/PointerOneToOne.php

    r42 r47  
    3737  }
    3838}
    39 
    40 ?>
  • trunk/Base/Types/String.php

    r42 r47  
    2929  }
    3030}
    31 
    32 ?>
  • trunk/Base/Types/Text.php

    r42 r47  
    2929  }
    3030}
    31 
    32 ?>
  • trunk/Base/Types/Time.php

    r42 r47  
    5656  }
    5757}
    58 
    59 ?>
  • trunk/Base/Types/Type.php

    r42 r47  
    6868      $Type = $this->TypeDefinitionList[$ParentType];
    6969    } else $Type = array();
    70  
     70
    7171    $Type['Name'] = $Name;
    7272    $Type['Parameters'] = array_merge($Type['Parameters'], $Parameters);
     
    7979  }
    8080}
    81 
    82 
    83 ?>
  • trunk/Base/UTF8.php

    r40 r47  
    2121  ISO8859-1: iso1
    2222  Windows1257: win1257
    23  
     23
    2424  example:  $new_string=to_utf8($some_string,"win1250");
    2525*/
     
    2828/*
    2929  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
    3131*/
    3232
     
    527527
    528528  $Result = '';
    529   for($I = 0; $I < strlen($String); $I++) 
     529  for($I = 0; $I < strlen($String); $I++)
    530530  {
    531531     if(ord($String[$I]) < 128) $Result .= $String[$I];
     
    563563  return($Result);
    564564}
    565 
    566 ?>
  • trunk/Base/View.php

    r42 r47  
    66{
    77}
    8 
    9 ?>
  • trunk/Base/XML.php

    r42 r47  
    4848  var $Content;
    4949  var $Indentation;
    50  
     50
    5151  function __construct()
    5252  {
     
    5656    $this->Indentation = 2;
    5757  }
    58  
     58
    5959  function GetOutput()
    6060  {
     
    104104  }
    105105}
    106 
    107 ?>
  • trunk/index.php

    r45 r47  
    1818$Application = new Application();
    1919$Application->Run();
    20 
    21 ?>
  • trunk/measure_scripts/monitor_sample.php

    r39 r47  
    1212
    1313$NetworkState = GetNetworkState();
    14 file_get_contents($Config['AddNewValueUrl'].'?MeasureId=3&Value='.MemoryUsage()); 
     14file_get_contents($Config['AddNewValueUrl'].'?MeasureId=3&Value='.MemoryUsage());
    1515file_get_contents($Config['AddNewValueUrl'].'?MeasureId=4&Value='.CpuUsage());
    1616file_get_contents($Config['AddNewValueUrl'].'?MeasureId=5&Value='.WoWPlayersOnline());
     
    2020file_get_contents($Config['AddNewValueUrl'].'?MeasureId=10&Value='.WoWGMOnline());
    2121file_get_contents($Config['AddNewValueUrl'].'?MeasureId=11&Value='.round($NetworkState['eth1']['DownAverage']));
    22 file_get_contents($Config['AddNewValueUrl'].'?MeasureId=12&Value='.round($NetworkState['eth1']['UpAverage'])); 
     22file_get_contents($Config['AddNewValueUrl'].'?MeasureId=12&Value='.round($NetworkState['eth1']['UpAverage']));
    2323file_get_contents($Config['AddNewValueUrl'].'?MeasureId=13&Value='.WoWCharacterCount());
    2424file_get_contents($Config['AddNewValueUrl'].'?MeasureId=14&Value='.WoWGuildCount());
     
    3131file_put_contents('/tmp/LastNetworkState', serialize($LastNetworkState));
    3232file_put_contents('/tmp/LastCpuUsage', serialize($LastCpuUsage));
    33 
    34 ?>
  • trunk/measure_scripts/system.php

    r39 r47  
    55function ErrorHandler($errno,$errmsg,$filename,$linenum,$vars)
    66{
    7 } 
     7}
    88
    99function CheckPortStatus($Ip, $Port, $Timeout = 0.5)
     
    2424
    2525function Ping($Host = 'nix.cz')
    26 { 
     26{
    2727  exec('ping '.$Host.' -c 1 -W 1|grep time=', $Row);
    2828  // W - timeout in seconds
     
    8585{
    8686  global $LastNetworkState;
    87  
     87
    8888  if(!isset($LastNetworkState)) $LastNetworkState = array();
    8989  $NetworkState = array('Time' => time());
     
    9393  array_shift($Output); // Skip header
    9494  foreach($Output as $Item)
    95   { 
     95  {
    9696    while(strpos($Item, '  ') !== false) $Item = str_replace('  ', ' ', $Item);  // Rrmove multiple spaces
    9797    $Item = explode(':', $Item);
     
    164164  return($UptimeParts[0]);
    165165}
    166 
    167 
    168 ?>
Note: See TracChangeset for help on using the changeset viewer.