Ignore:
Timestamp:
Apr 6, 2020, 11:17:40 PM (5 years ago)
Author:
chronos
Message:
  • Modified: Improved code format.
Location:
trunk/Modules/TimeMeasure
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Modules/TimeMeasure/Graph.php

    r738 r873  
    2020  {
    2121    $this->ClearPage = true;
    22     return($this->Render());
     22    return ($this->Render());
    2323  }
    2424
     
    2727    $PrefixMultiplier = new PrefixMultiplier();
    2828
    29     if(array_key_exists('Debug', $_GET)) $Debug = $_GET['Debug'];
     29    if (array_key_exists('Debug', $_GET)) $Debug = $_GET['Debug'];
    3030      else $Debug = 0;
    3131
    32     if(!array_key_exists('From', $_GET)) die('Musíte zadat čas počátku');
     32    if (!array_key_exists('From', $_GET)) die('Musíte zadat čas počátku');
    3333    $StartTime = addslashes($_GET['From']);
    34     if(!array_key_exists('To', $_GET)) die('Musíte zadat čas konce');
     34    if (!array_key_exists('To', $_GET)) die('Musíte zadat čas konce');
    3535    $EndTime = addslashes($_GET['To']);
    36     if($EndTime < $StartTime) $EndTime = $StartTime + 60;
     36    if ($EndTime < $StartTime) $EndTime = $StartTime + 60;
    3737    $TimeDifference = $EndTime - $StartTime;
    38     if(!array_key_exists('Measure', $_GET)) die('Musíte zadat měřenou veličinu');
     38    if (!array_key_exists('Measure', $_GET)) die('Musíte zadat měřenou veličinu');
    3939    $MeasureId = addslashes($_GET['Measure']);
    40     if(!array_key_exists('Width', $_GET)) $Width = $this->DefaultWidth;
     40    if (!array_key_exists('Width', $_GET)) $Width = $this->DefaultWidth;
    4141      else $Width = addslashes($_GET['Width']);
    42     if(!array_key_exists('Height', $_GET)) $Height = $this->DefaultHeight;
     42    if (!array_key_exists('Height', $_GET)) $Height = $this->DefaultHeight;
    4343      else $Height = addslashes($_GET['Height']);
    44     if(!array_key_exists('Differential', $_GET)) $Differential = $this->Config['Application']['DefaultVariables']['Differential'];
     44    if (!array_key_exists('Differential', $_GET)) $Differential = $this->Config['Application']['DefaultVariables']['Differential'];
    4545      else $Differential = addslashes($_GET['Differential']);
    4646    $VerticalLinesCount = round($Height / ($this->FontSize + 4));
     
    6363
    6464    $Level = floor(log(($EndTime - $StartTime) / $Measure->DivisionCount / 60) / log($Measure->LevelReducing)) - 1;
    65     if($Level < 0) $Level = 0;
    66     if($Level > $Measure->MaxLevel) $Level = $Measure->MaxLevel;
     65    if ($Level < 0) $Level = 0;
     66    if ($Level > $Measure->MaxLevel) $Level = $Measure->MaxLevel;
    6767    //$Level = 0;
    6868
    6969    $Points = $Measure->GetValues($StartTime, $EndTime, $Level);
    7070
    71     if($Debug) echo('Points count: '.count($Points).'<br/>');
    72     //if($Debug) foreach($Points as $Index => $Item)
     71    if ($Debug) echo('Points count: '.count($Points).'<br/>');
     72    //if ($Debug) foreach ($Points as $Index => $Item)
    7373    // echo($Index.': '.$Item['min'].'<br>');
    7474
     
    7777    $AvgValue = 0;
    7878    $MinValue = 1000000000000000000;
    79     foreach($Points as $Index => $Item)
     79    foreach ($Points as $Index => $Item)
    8080    {
    8181      //$Points[$Index]['min'] =  $Points[$Index]['min'] / $Measure['Divider'];
    8282      //$Points[$Index]['avg'] =  $Points[$Index]['avg'] / $Measure['Divider'];
    8383      //$Points[$Index]['max'] =  $Points[$Index]['max'] / $Measure['Divider'];
    84       if($Points[$Index]['Avg'] > $MaxValue) $MaxValue = $Points[$Index]['Avg'];
    85       if($Points[$Index]['Avg'] < $MinValue) $MinValue = $Points[$Index]['Avg'];
    86       if($Points[$Index]['Max'] > $MaxValue) $MaxValue = $Points[$Index]['Max'];
    87       if($Points[$Index]['Min'] < $MinValue) $MinValue = $Points[$Index]['Min'];
     84      if ($Points[$Index]['Avg'] > $MaxValue) $MaxValue = $Points[$Index]['Avg'];
     85      if ($Points[$Index]['Avg'] < $MinValue) $MinValue = $Points[$Index]['Avg'];
     86      if ($Points[$Index]['Max'] > $MaxValue) $MaxValue = $Points[$Index]['Max'];
     87      if ($Points[$Index]['Min'] < $MinValue) $MinValue = $Points[$Index]['Min'];
    8888      $AvgValue = $AvgValue + $Points[$Index]['Avg'];
    8989    }
     
    9696    $PointsAvg = array(0, $Height - 1);
    9797    $PointsMax = array(0, $Height - 1);
    98     if(($MaxValue - $MinValue) == 0) $MaxValue = $MinValue + 1;
     98    if (($MaxValue - $MinValue) == 0) $MaxValue = $MinValue + 1;
    9999    {
    100       foreach($Points as $Index => $Item)
     100      foreach ($Points as $Index => $Item)
    101101      {
    102102        $PointsMin[] = $Index * $Width / $Measure->DivisionCount;
     
    128128
    129129    // Generate image
    130     if(!$Debug)
     130    if (!$Debug)
    131131    {
    132132      Header('Content-type: image/png');
     
    153153      $TimeRange = $EndTime - $StartTime;
    154154      $TimeMarksIndex = 0;
    155       while(($TimeRange / $TimeMarks[$TimeMarksIndex]) > 1) $TimeMarksIndex += 1;
    156       if($TimeMarksIndex < 2) $TimeMarksIndex = 2;
     155      while (($TimeRange / $TimeMarks[$TimeMarksIndex]) > 1) $TimeMarksIndex += 1;
     156      if ($TimeMarksIndex < 2) $TimeMarksIndex = 2;
    157157      $MajorTimeMarks = $TimeMarks[$TimeMarksIndex - 1];
    158158      $MinorTimeMarks = $TimeMarks[$TimeMarksIndex - 2];
     
    163163      // Zobraz měřítko Y
    164164      $VerticalLinesDistance = $Height / $VerticalLinesCount;
    165       for($I = 1; $I <= $VerticalLinesCount; $I++)
     165      for ($I = 1; $I <= $VerticalLinesCount; $I++)
    166166      {
    167167        $Y = $Height - 1 - ($VerticalLinesDistance * $I);
    168         for($X = 1; $X < $Width; $X = $X + 3) imagesetpixel($Image, $X, $Y, $Gray);
     168        for ($X = 1; $X < $Width; $X = $X + 3) imagesetpixel($Image, $X, $Y, $Gray);
    169169        //imageline($Image, 30, $Y, $Width-1, $Y, IMG_COLOR_STYLED);
    170170      }
     
    174174      // Zobraz měřítko X
    175175      $LastTextEnd = 0;
    176       for($Time = $StartTime; $Time < $EndTime; $Time += $MajorTimeMarks)
     176      for ($Time = $StartTime; $Time < $EndTime; $Time += $MajorTimeMarks)
    177177      {
    178178        $X = round(($Time - $StartTime + $TimeShift) / $TimeRange * $Width) % $Width;
    179179        //imageline($Image, 30, $Y, $Width-1, $Y, IMG_COLOR_STYLED);
    180         if(($MajorTimeMarks > 60 * 60 * 24)) $Text = date('j.n.Y', $Time + $TimeShift);
     180        if (($MajorTimeMarks > 60 * 60 * 24)) $Text = date('j.n.Y', $Time + $TimeShift);
    181181          else $Text = date('j.n.Y G:i', $Time + $TimeShift);
    182182        $BoundBox = imagettfbbox($FontSize, 0, $FontFile, $Text);
    183         if($LastTextEnd < ($X - ($BoundBox[2] - $BoundBox[0] + 20) / 2))
     183        if ($LastTextEnd < ($X - ($BoundBox[2] - $BoundBox[0] + 20) / 2))
    184184        {
    185           for($Y = 0; $Y < $Height; $Y = $Y + 1) imagesetpixel($Image, $X, $Y, $Gray);
     185          for ($Y = 0; $Y < $Height; $Y = $Y + 1) imagesetpixel($Image, $X, $Y, $Gray);
    186186          imagettftext($Image, $FontSize, 0, $X - ($BoundBox[2] - $BoundBox[0]) / 2,  $Height - 2, $Black, $FontFile, $Text);
    187187          $LastTextEnd = $X + ($BoundBox[2] - $BoundBox[0]) / 2;
    188188        }
    189         else for($Y = 0; $Y < $Height; $Y = $Y + 3) imagesetpixel($Image, $X, $Y, $Gray);
     189        else for ($Y = 0; $Y < $Height; $Y = $Y + 3) imagesetpixel($Image, $X, $Y, $Gray);
    190190      }
    191191
    192192      // Popisky osy Y
    193       for($I = 1; $I <= $VerticalLinesCount; $I++)
     193      for ($I = 1; $I <= $VerticalLinesCount; $I++)
    194194      {
    195195        $Y = $Height - 1 - ($VerticalLinesDistance * $I);
     
    199199          $this->ValueToImageHeigthCoefficient * ($MaxValue - $MinValue) + $MinValue)), $MeasureMethod['Unit'], 3);
    200200        $BoundBox = imagettfbbox($FontSize, 0, $FontFile, $Text);
    201         if(($Y - ($BoundBox[5] - $BoundBox[1]) / 2) > 10)
     201        if (($Y - ($BoundBox[5] - $BoundBox[1]) / 2) > 10)
    202202          imagettftext($Image, $FontSize, 0, 2,  $Y - ($BoundBox[5] - $BoundBox[1]) / 2, $Black, $FontFile, $Text);
    203203      }
  • trunk/Modules/TimeMeasure/Main.php

    r825 r873  
    6262    // Day selection
    6363    $Output .= '<select name="Day">';
    64     for($I = 1; $I < 32; $I++)
    65     {
    66       if($I == $TimeParts['mday']) $Selected = ' selected="1"'; else $Selected = '';
     64    for ($I = 1; $I < 32; $I++)
     65    {
     66      if ($I == $TimeParts['mday']) $Selected = ' selected="1"'; else $Selected = '';
    6767      $Output .= '<option value="'.$I.'"'.$Selected.'>'.$I.'</option>';
    6868    }
     
    7171    // Month selection
    7272    $Output .= '<select name="Month">';
    73     foreach($MonthNames as $Index => $Month)
    74     {
    75       if($Index == $TimeParts['mon']) $Selected = ' selected="1"'; else $Selected = '';
    76       if($Index > 0) $Output .= '<option value="'.$Index.'"'.$Selected.'>'.$Month.'</option>';
     73    foreach ($MonthNames as $Index => $Month)
     74    {
     75      if ($Index == $TimeParts['mon']) $Selected = ' selected="1"'; else $Selected = '';
     76      if ($Index > 0) $Output .= '<option value="'.$Index.'"'.$Selected.'>'.$Month.'</option>';
    7777    }
    7878    $Output .= '</select>. ';
     
    8080    // Day selection
    8181    $Output .= '<select name="Year">';
    82     for($I = 2000; $I < 2010; $I++)
    83     {
    84       if($I == $TimeParts['year']) $Selected = ' selected="1"'; else $Selected = '';
     82    for ($I = 2000; $I < 2010; $I++)
     83    {
     84      if ($I == $TimeParts['year']) $Selected = ' selected="1"'; else $Selected = '';
    8585      $Output .= '<option value="'.$I.'"'.$Selected.'>'.$I.'</option>';
    8686    }
     
    8989    // Hour selection
    9090    $Output .= '<select name="Hour">';
    91     for($I = 0; $I < 24; $I++)
    92     {
    93       if($I == $TimeParts['hours']) $Selected = ' selected="1"'; else $Selected = '';
     91    for ($I = 0; $I < 24; $I++)
     92    {
     93      if ($I == $TimeParts['hours']) $Selected = ' selected="1"'; else $Selected = '';
    9494      $Output .= '<option value="'.$I.'"'.$Selected.'>'.$I.'</option>';
    9595    }
     
    9898    // Minute selection
    9999    $Output .= '<select name="Minute">';
    100     for($I = 0; $I < 60; $I++)
    101     {
    102       if($I == $TimeParts['minutes']) $Selected = ' selected="1"'; else $Selected = '';
     100    for ($I = 0; $I < 60; $I++)
     101    {
     102      if ($I == $TimeParts['minutes']) $Selected = ' selected="1"'; else $Selected = '';
    103103      $Output .= '<option value="'.$I.'"'.$Selected.'>'.$I.'</option>';
    104104    }
     
    111111    $Output .= '</form>';
    112112
    113     return($Output);
     113    return ($Output);
    114114  }
    115115
     
    118118    $Debug = 0;
    119119
    120     foreach($this->DefaultVariables as $Index => $Variable)
    121     {
    122       if(!array_key_exists($Index, $_SESSION)) $_SESSION[$Index] = $Variable;
    123       if(array_key_exists($Index, $_GET)) $_SESSION[$Index] = $_GET[$Index];
    124       if(array_key_exists($Index, $_POST)) $_SESSION[$Index] = $_POST[$Index];
     120    foreach ($this->DefaultVariables as $Index => $Variable)
     121    {
     122      if (!array_key_exists($Index, $_SESSION)) $_SESSION[$Index] = $Variable;
     123      if (array_key_exists($Index, $_GET)) $_SESSION[$Index] = $_GET[$Index];
     124      if (array_key_exists($Index, $_POST)) $_SESSION[$Index] = $_POST[$Index];
    125125      //$$Index = $_SESSION[$Index];
    126126    }
    127127
    128     if($_SESSION['TimeSpecify'] == 0)
     128    if ($_SESSION['TimeSpecify'] == 0)
    129129    {
    130130      $_SESSION['TimeEnd'] = time() - 60;
     
    134134    $Output = '<div style="text-align: center;">';
    135135
    136     if(!array_key_exists('Operation', $_GET)) $_GET['Operation'] = '';
    137     switch($_GET['Operation'])
     136    if (!array_key_exists('Operation', $_GET)) $_GET['Operation'] = '';
     137    switch ($_GET['Operation'])
    138138    {
    139139      case 'SetTime':
    140         if(array_key_exists('Time', $_GET) and array_key_exists('Month', $_POST) and array_key_exists('Day', $_POST) and
     140        if (array_key_exists('Time', $_GET) and array_key_exists('Month', $_POST) and array_key_exists('Day', $_POST) and
    141141          array_key_exists('Year', $_POST) and array_key_exists('Hour', $_POST) and array_key_exists('Minute', $_POST))
    142142        {
    143           if(($_GET['Time'] == 'TimeStart') or ($_GET['Time'] == 'TimeEnd'))
     143          if (($_GET['Time'] == 'TimeStart') or ($_GET['Time'] == 'TimeEnd'))
    144144          {
    145145            $_SESSION[$_GET['Time']] = mktime($_POST['Hour'], $_POST['Minute'], 0, $_POST['Month'],
     
    150150        break;
    151151      case 'SetTimeNow':
    152         if(array_key_exists('Time', $_GET))
     152        if (array_key_exists('Time', $_GET))
    153153        {
    154           if(($_GET['Time'] == 'TimeStart') or ($_GET['Time'] == 'TimeEnd'))
     154          if (($_GET['Time'] == 'TimeStart') or ($_GET['Time'] == 'TimeEnd'))
    155155          {
    156156            $_SESSION[$_GET['Time']] = time();
     
    162162    $Output .= '<strong>Časový úsek:</strong><br>';
    163163    // Show graf time range menu
    164     if($_SESSION['TimeSpecify'] == 0)
     164    if ($_SESSION['TimeSpecify'] == 0)
    165165    {
    166166      $Output .= 'Délka úseku: ';
    167       foreach($this->GraphTimeRanges as $Index => $Item)
     167      foreach ($this->GraphTimeRanges as $Index => $Item)
    168168        $Output .= '<a href="?Period='.$Index.'">'.$Item['caption'].'</a>&nbsp;';
    169169      $Output .= '<br/>';
     
    179179
    180180    $Output .= '<br/>'.$this->MeasureTable();
    181     return($Output);
     181    return ($Output);
    182182  }
    183183
     
    191191    $Output .= '<a href="?Measure='.$_SESSION['Measure'].'&amp;TimeStart='.
    192192      $_SESSION['TimeStart'].'&amp;TimeEnd='.$_SESSION['TimeEnd'].'&amp;TimeSpecify=1&amp;Differential='.$_SESSION['Differential'].'">Odkaz na vybraný graf</a><br>';
    193     return($Output);
     193    return ($Output);
    194194  }
    195195
     
    212212      array('Name' => 'Description', 'Title' => 'Popis'),
    213213    );
    214     if(array_key_exists('Debug', $_GET))
     214    if (array_key_exists('Debug', $_GET))
    215215    {
    216216      $TableColumns[] = array('Name' => 'ItemCount', 'Title' => 'Počet položek');
     
    221221
    222222    $Result = $this->Database->select('Measure', '*', '`Enabled`=1 '.$Order['SQL'].$PageList['SQLLimit']);
    223     while($Measure = $Result->fetch_array())
     223    while ($Measure = $Result->fetch_array())
    224224    {
    225225      $DbResult2 = $this->Database->select('MeasureMethod', '*', '`Id`='.$Measure['Method']);
    226226      $MeasureMethod = $DbResult2->fetch_assoc();
    227227      $StopWatchStart = GetMicrotime();
    228       if(array_key_exists('Debug', $_GET))
     228      if (array_key_exists('Debug', $_GET))
    229229      {
    230230        $DbResult = $this->Database->select($Measure['DataTable'], 'COUNT(*)', 'Measure='.$Measure['Id']);
     
    233233      }
    234234      $Result2 = $this->Database->select($Measure['DataTable'], 'Time, Avg', 'Measure='.$Measure['Id'].' AND Level=0 ORDER BY Time DESC LIMIT 1');
    235       if($Result2->num_rows > 0)
     235      if ($Result2->num_rows > 0)
    236236      {
    237237        $Row = $Result2->fetch_array();
     
    243243        $LastMeasureValue = '&nbsp;';
    244244      }
    245       if($Measure['Continuity'] == 1) $Interpolate = 'Ano';
     245      if ($Measure['Continuity'] == 1) $Interpolate = 'Ano';
    246246        else $Interpolate = 'Ne';
    247       //if($Measure['Description'] == '') $Measure['Description'] = '&nbsp;';
     247      //if ($Measure['Description'] == '') $Measure['Description'] = '&nbsp;';
    248248      $GenerationTime = floor((GetMicrotime() - $StopWatchStart) * 1000  ) / 1000;
    249249      $Output .= '<tr><td><a href="?Measure='.$Measure['Id'].'&amp;Differential=0">'.$Measure['Name'].'</a></td><td align="center">'.$LastMeasureValue.'</td><td align="center">'.$LastMeasureTime.'</td><td align="center">'.$Interpolate.'</td><td>'.$Measure['Description'].'</td>';
    250       if(array_key_exists('Debug', $_GET)) $Output .= '<td>'.$RowCount.'</td><td>'.$GenerationTime.'</td>';
     250      if (array_key_exists('Debug', $_GET)) $Output .= '<td>'.$RowCount.'</td><td>'.$GenerationTime.'</td>';
    251251      $Output .= '</tr>';
    252252    }
     
    260260    //echo($PrefixMultiplier->Add('-0.000000071112345', 'B'));
    261261    $Output .= '</div>';
    262     return($Output);
     262    return ($Output);
    263263  }
    264264}
     
    271271
    272272    $Output = '';
    273     if(!array_key_exists('MeasureId', $_GET)) return('Nebylo zadáno Id měření.');
    274     if(!array_key_exists('Value', $_GET)) return('Nebyla zadána hodnota.');
     273    if (!array_key_exists('MeasureId', $_GET)) return ('Nebylo zadáno Id měření.');
     274    if (!array_key_exists('Value', $_GET)) return ('Nebyla zadána hodnota.');
    275275    $Measure = new Measure($this->System);
    276276    $Measure->Load($_GET['MeasureId']);
    277     if(!isset($Measure->Data['Id'])) return('Měření s Id '.$_GET['MeasureId'].' nenalezeno.');
     277    if (!isset($Measure->Data['Id'])) return ('Měření s Id '.$_GET['MeasureId'].' nenalezeno.');
    278278    $Measure->AddValue(array('Min' => $_GET['Value'], 'Avg' => $_GET['Value'], 'Max' => $_GET['Value']));
    279     return($Output);
     279    return ($Output);
    280280  }
    281281}
  • trunk/Modules/TimeMeasure/Measure.php

    r790 r873  
    1515  {
    1616    $Result = $this->Database->select('Measure', '*', 'Id='.$Id);
    17     if($Result->num_rows > 0)
     17    if ($Result->num_rows > 0)
    1818    {
    1919      $this->Data = $Result->fetch_assoc();
    20       if($this->Data['Continuity'] == 0) $this->Data['ContinuityEnabled'] = 0;  // non continuous
     20      if ($this->Data['Continuity'] == 0) $this->Data['ContinuityEnabled'] = 0;  // non continuous
    2121        else $this->Data['ContinuityEnabled'] = 2;    // continuous graph
    2222    } else throw new Exception('Measure not found');
     
    2525  function TimeSegment($Base, $Level)
    2626  {
    27     return(pow($this->LevelReducing, $Level) * $Base);
     27    return (pow($this->LevelReducing, $Level) * $Base);
    2828  }
    2929
    3030  function StatTableName($Level)
    3131  {
    32     if($Level == 0) return('Data');
    33       else return('DataCache');
     32    if ($Level == 0) return ('Data');
     33      else return ('DataCache');
    3434  }
    3535
    3636  function AlignTime($Time, $TimeSegment)
    3737  {
    38     return(round(($Time - $this->ReferenceTime) / $TimeSegment) * $TimeSegment + $this->ReferenceTime);
     38    return (round(($Time - $this->ReferenceTime) / $TimeSegment) * $TimeSegment + $this->ReferenceTime);
    3939  }
    4040
    4141  function AddValue($Value = array('Min' => 0, 'Avg' => 0, 'Max' => 0), $Level = 0, $Time = 0)
    4242  {
    43     if($Time == 0) $Time = time();
     43    if ($Time == 0) $Time = time();
    4444
    4545    $Result = $this->Database->select($this->Data['DataTable'], '*', 'Measure='.
    4646      $this->Data['Id'].' AND Level='.$Level.' ORDER BY Time DESC LIMIT 2');
    47     if($Result->num_rows == 0)
     47    if ($Result->num_rows == 0)
    4848    {
    4949       $this->Database->insert($this->Data['DataTable'], array('Min' => $Value['Min'],
    5050         'Avg' => $Value['Avg'], 'Max' => $Value['Max'], 'Level' => $Level,
    5151         'Measure' => $this->Data['Id'], 'Time' => TimeToMysqlDateTime($Time), 'Continuity' => 0));
    52     } else if($Result->num_rows == 1)
     52    } else if ($Result->num_rows == 1)
    5353    {
    5454      $this->Database->insert($this->Data['DataTable'], array('Min' => $Value['Min'],
     
    5959      $LastValue = $Result->fetch_assoc();
    6060      $NextToLastValue = $Result->fetch_assoc();
    61       if((($Time - MysqlDateTimeToTime($LastValue['Time'])) < 0.75 * $this->Data['Period']) and ($Level == 0))
     61      if ((($Time - MysqlDateTimeToTime($LastValue['Time'])) < 0.75 * $this->Data['Period']) and ($Level == 0))
    6262      {
    6363        echo('Too short period. Minimal period is '.(0.75 * $this->Data['Period'])." seconds\n");
    6464      } else
    6565      {
    66         if(($Time - MysqlDateTimeToTime($LastValue['Time'])) < 1.25 * $this->Data['Period']) $Continuity = 1;
     66        if (($Time - MysqlDateTimeToTime($LastValue['Time'])) < 1.25 * $this->Data['Period']) $Continuity = 1;
    6767          else $Continuity = 0;
    68         if(($LastValue['Min'] == $NextToLastValue['Min']) and ($LastValue['Min'] ==
     68        if (($LastValue['Min'] == $NextToLastValue['Min']) and ($LastValue['Min'] ==
    6969          $Value['Min']) and ($LastValue['Avg'] == $NextToLastValue['Avg']) and
    7070          ($LastValue['Avg'] == $Value['Avg']) and ($LastValue['Max'] == $NextToLastValue['Max'])
     
    8282
    8383      // Update next level
    84       if($Level < $this->MaxLevel)
     84      if ($Level < $this->MaxLevel)
    8585      {
    8686        $Level = $Level + 1;
    8787        $TimeSegment = $this->TimeSegment($this->Data['Period'], 1);
    8888        $EndTime = $this->AlignTime($Time, $TimeSegment);
    89         //if($EndTime < $Time) $EndTime = $EndTime + $TimeSegment;
     89        //if ($EndTime < $Time) $EndTime = $EndTime + $TimeSegment;
    9090        $StartTime = $EndTime - $TimeSegment;
    9191
     
    9696          TimeToMysqlDateTime($StartTime).'") AND (Time < "'.TimeToMysqlDateTime($EndTime).
    9797            '") AND (Measure='.$this->Data['Id'].') AND (Level='.($Level - 1).') ORDER BY Time');
    98         while($Row = $Result->fetch_assoc())
     98        while ($Row = $Result->fetch_assoc())
    9999        {
    100100          $Row['Time'] = MysqlDateTimeToTime($Row['Time']);
    101101          $Values[] = $Row;
    102102        }
    103         //if(count($Values) > 2)
     103        //if (count($Values) > 2)
    104104        {
    105105          //array_pop($Values);
     
    124124  {
    125125    $Y = ($Y2 - $Y1) / ($X2 - $X1) * ($X - $X1) + $Y1;
    126     return($Y);
     126    return ($Y);
    127127  }
    128128
     
    132132
    133133    // Trim outside parts
    134     foreach($this->ValueTypes as $ValueType)
     134    foreach ($this->ValueTypes as $ValueType)
    135135    {
    136136      $Values[0][$ValueType] = $this->Interpolation($Values[0]['Time'], $Values[0][$ValueType], $Values[1]['Time'], $Values[1][$ValueType], $LeftTime);
    137137    }
    138138    $Values[0]['Time'] = $LeftTime;
    139     foreach($this->ValueTypes as $ValueType)
     139    foreach ($this->ValueTypes as $ValueType)
    140140    {
    141141        $Values[count($Values) - 1][$ValueType] = $this->Interpolation($Values[count($Values) - 2]['Time'], $Values[count($Values) - 2][$ValueType],
     
    145145
    146146    // Perform computation
    147     foreach($this->ValueTypes as $ValueType)
     147    foreach ($this->ValueTypes as $ValueType)
    148148    {
    149149      // Compute new value
    150       for($I = 0; $I < (count($Values) - 1); $I++)
    151       {
    152         if($ValueType == 'Avg')
    153         {
    154           if($Values[$I + 1]['Continuity'] == $this->Data['ContinuityEnabled']);
    155           else if($this->Differential == 0)
     150      for ($I = 0; $I < (count($Values) - 1); $I++)
     151      {
     152        if ($ValueType == 'Avg')
     153        {
     154          if ($Values[$I + 1]['Continuity'] == $this->Data['ContinuityEnabled']);
     155          else if ($this->Differential == 0)
    156156          {
    157157            $NewValue[$ValueType] = $NewValue[$ValueType] + ($Values[$I + 1]['Time'] - $Values[$I]['Time']) *
     
    163163          }
    164164        }
    165         else if($ValueType == 'Max')
    166         {
    167           if($Values[$I + 1]['Continuity'] == $this->Data['ContinuityEnabled'])
    168           {
    169             if(0 > $NewValue[$ValueType]) $NewValue[$ValueType] = 0;
     165        else if ($ValueType == 'Max')
     166        {
     167          if ($Values[$I + 1]['Continuity'] == $this->Data['ContinuityEnabled'])
     168          {
     169            if (0 > $NewValue[$ValueType]) $NewValue[$ValueType] = 0;
    170170          } else
    171171          {
    172             if($this->Differential == 0)
     172            if ($this->Differential == 0)
    173173            {
    174               if($Values[$I + 1][$ValueType] > $NewValue[$ValueType]) $NewValue[$ValueType] = $Values[$I + 1][$ValueType];
     174              if ($Values[$I + 1][$ValueType] > $NewValue[$ValueType]) $NewValue[$ValueType] = $Values[$I + 1][$ValueType];
    175175            } else {
    176176              $Difference = $Values[$I + 1][$ValueType] - $Values[$I][$ValueType];
    177               if($Difference > $NewValue[$ValueType]) $NewValue[$ValueType] = $Difference;
     177              if ($Difference > $NewValue[$ValueType]) $NewValue[$ValueType] = $Difference;
    178178            }
    179179          }
    180180        }
    181         else if($ValueType == 'Min')
    182         {
    183           if($Values[$I + 1]['Continuity'] == $this->Data['ContinuityEnabled'])
    184           {
    185             if(0 < $NewValue[$ValueType]) $NewValue[$ValueType] = 0;
     181        else if ($ValueType == 'Min')
     182        {
     183          if ($Values[$I + 1]['Continuity'] == $this->Data['ContinuityEnabled'])
     184          {
     185            if (0 < $NewValue[$ValueType]) $NewValue[$ValueType] = 0;
    186186          } else
    187187          {
    188             if($this->Differential == 0)
     188            if ($this->Differential == 0)
    189189            {
    190               if($Values[$I + 1][$ValueType] < $NewValue[$ValueType]) $NewValue[$ValueType] = $Values[$I + 1][$ValueType];
     190              if ($Values[$I + 1][$ValueType] < $NewValue[$ValueType]) $NewValue[$ValueType] = $Values[$I + 1][$ValueType];
    191191            } else {
    192192              $Difference = $Values[$I + 1][$ValueType] - $Values[$I][$ValueType];
    193               if($Difference < $NewValue[$ValueType]) $NewValue[$ValueType] = $Difference;
     193              if ($Difference < $NewValue[$ValueType]) $NewValue[$ValueType] = $Difference;
    194194            }
    195195          }
     
    198198      $NewValue[$ValueType] = $NewValue[$ValueType];
    199199    }
    200     //if(($RightTime - $LeftTime) > 0)
    201     if($this->Data['Cumulative'] == 0)
     200    //if (($RightTime - $LeftTime) > 0)
     201    if ($this->Data['Cumulative'] == 0)
    202202    {
    203203      $NewValue['Avg'] = $NewValue['Avg'] / ($RightTime - $LeftTime);
    204204    }
    205     return($NewValue);
     205    return ($NewValue);
    206206  }
    207207
     
    210210    // Get first and last time
    211211    $Result = $this->Database->select($this->Data['DataTable'], '*', 'Measure='.$this->Data['Id'].' AND Level='.$Level.' ORDER BY Time LIMIT 1');
    212     if($Result->num_rows > 0)
     212    if ($Result->num_rows > 0)
    213213    {
    214214      $Row = $Result->fetch_assoc();
     
    217217
    218218    $Result = $this->Database->select($this->Data['DataTable'], '*', 'Measure='.$this->Data['Id'].' AND Level='.$Level.' ORDER BY Time DESC LIMIT 1');
    219     if($Result->num_rows > 0)
     219    if ($Result->num_rows > 0)
    220220    {
    221221      $Row = $Result->fetch_assoc();
     
    223223    } else $AbsoluteRightTime = 0;
    224224
    225     if($this->Debug)
     225    if ($this->Debug)
    226226    {
    227227      echo('AbsoluteLeftTime: '.$AbsoluteLeftTime.'('.TimeToMysqlDateTime($AbsoluteLeftTime).')<br>');
    228228      echo('AbsoluteRightTime: '.$AbsoluteRightTime.'('.TimeToMysqlDateTime($AbsoluteRightTime).')<br>');
    229229    }
    230     return(array('Left' => $AbsoluteLeftTime, 'Right' => $AbsoluteRightTime));
     230    return (array('Left' => $AbsoluteLeftTime, 'Right' => $AbsoluteRightTime));
    231231  }
    232232
     
    235235    $Result = array();
    236236    $DbResult = $this->Database->select($this->Data['DataTable'], '*', 'Time > "'.TimeToMysqlDateTime($Time).'" AND Measure='.$this->Data['Id'].' AND Level='.$Level.' ORDER BY Time ASC LIMIT 1');
    237     if($DbResult->num_rows > 0)
     237    if ($DbResult->num_rows > 0)
    238238    {
    239239      $Row = $DbResult->fetch_assoc();
    240240      $Row['Time'] = MysqlDateTimeToTime($Row['Time']);
    241       return(array($Row));
     241      return (array($Row));
    242242    } else
    243243    {
     
    247247      $DbResult = $this->Database->select($this->Data['DataTable'], '*', 'Time < "'.
    248248        TimeToMysqlDateTime($Time).'" AND Measure='.$this->Data['Id'].' AND Level='.$Level.' ORDER BY Time DESC LIMIT 1');
    249       if($DbResult->num_rows > 0)
     249      if ($DbResult->num_rows > 0)
    250250      {
    251251        $Row = $DbResult->fetch_assoc();
    252252        array_unshift($Result, array('Time' => (MysqlDateTimeToTime($Row['Time']) + 10), 'Min' => 0, 'Avg' => 0, 'Max' => 0, 'Continuity' => 0));
    253253      }
    254      // if($Debug) print_r($Result);
    255       return($Result);
     254     // if ($Debug) print_r($Result);
     255      return ($Result);
    256256    }
    257257  }
     
    262262    $DbResult = $this->Database->select($this->Data['DataTable'], '*', '(Time < "'.
    263263      TimeToMysqlDateTime($Time).'") AND (Measure='.$this->Data['Id'].') AND (Level='.$Level.') ORDER BY Time DESC LIMIT 1');
    264     if($DbResult->num_rows > 0)
     264    if ($DbResult->num_rows > 0)
    265265    {
    266266      $Row = $DbResult->fetch_assoc();
    267267      $Row['Time'] = MysqlDateTimeToTime($Row['Time']);
    268       return(array($Row));
     268      return (array($Row));
    269269    } else
    270270    {
    271271      //$Time = $Values[0]['Time'] - 60;
    272272      //array_unshift($Values, array('Time' => $Time, 'Min' => 0, 'Avg' => 0, 'Max' => 0, 'Continuity' => 0));
    273       if($this->Debug) echo($this->TimeSegment($this->Data['Period'], $Level));
     273      if ($this->Debug) echo($this->TimeSegment($this->Data['Period'], $Level));
    274274      $Result[] = array('Time' => ($Time - $this->TimeSegment($this->Data['Period'], $Level)), 'Min' => 0, 'Avg' => 0, 'Max' => 0, 'Continuity' => 0);
    275275
    276276      $DbResult = $this->Database->select($this->Data['DataTable'], '*', 'Time > "'.TimeToMysqlDateTime($Time).'" AND Measure='.$this->Data['Id'].' AND Level='.$Level.' ORDER BY Time ASC LIMIT 1');
    277       if($DbResult->num_rows > 0)
     277      if ($DbResult->num_rows > 0)
    278278      {
    279279        $Row = $DbResult->fetch_assoc();
    280280        array_push($Result, array('Time' => (MysqlDateTimeToTime($Row['Time']) - 10), 'Min' => 0, 'Avg' => 0, 'Max' => 0, 'Continuity' => 0));
    281281      }
    282       return($Result);
     282      return ($Result);
    283283    }
    284284  }
     
    286286  function GetValues($TimeFrom, $TimeTo, $Level)
    287287  {
    288     if($this->Debug) echo('TimeFrom: '.$TimeFrom.'('.TimeToMysqlDateTime($TimeFrom).')<br>');
    289     if($this->Debug) echo('TimeTo: '.$TimeTo.'('.TimeToMysqlDateTime($TimeTo).')<br>');
     288    if ($this->Debug) echo('TimeFrom: '.$TimeFrom.'('.TimeToMysqlDateTime($TimeFrom).')<br>');
     289    if ($this->Debug) echo('TimeTo: '.$TimeTo.'('.TimeToMysqlDateTime($TimeTo).')<br>');
    290290
    291291    //$AbsoluteTime = GetTimeRange($MeasureId);
    292292
    293     //  if(($TimeFrom > $AbsoluteLeftTime) and ($TimeStart < $AbsoluteRightTime) and
     293    //  if (($TimeFrom > $AbsoluteLeftTime) and ($TimeStart < $AbsoluteRightTime) and
    294294    //    ($TimeTo > $AbsoluteLeftTime) and ($TimeTo < $AbsoluteRightTime))
    295295    //  {
     
    304304    //  echo(DB_NumRows());
    305305    //  $III = 0;
    306     while($Row = $Result->fetch_assoc())
     306    while ($Row = $Result->fetch_assoc())
    307307    {
    308308      //    echo($III.' '.$Row['Time'].' '.memory_get_usage().',');
     
    314314    //  echo('abc');
    315315    //  die();
    316     if($this->Debug) echo('Item count: '.count($Values));
     316    if ($this->Debug) echo('Item count: '.count($Values));
    317317
    318318    $Points = array();
    319     if(count($Values) > 0)
     319    if (count($Values) > 0)
    320320    {
    321321      $Values = array_merge($this->LoadLeftSideValue($Level, $TimeFrom), $Values, $this->LoadRightSideValue($Level, $TimeTo));
    322322      $StartIndex = 0;
    323323      $Points = array();
    324       if($this->Debug) print_r($Values);
    325       for($I = 0; $I < $this->DivisionCount; $I++)
     324      if ($this->Debug) print_r($Values);
     325      for ($I = 0; $I < $this->DivisionCount; $I++)
    326326      {
    327327        $TimeStart = $TimeFrom + (($TimeTo - $TimeFrom) / $this->DivisionCount) * $I;
    328328        $TimeEnd = $TimeFrom + (($TimeTo - $TimeFrom) / $this->DivisionCount) * ($I + 1);
    329         if($this->Debug) echo('TimeEnd '.$I.': '.$TimeEnd.'('.TimeToMysqlDateTime($TimeEnd).')<br>');
     329        if ($this->Debug) echo('TimeEnd '.$I.': '.$TimeEnd.'('.TimeToMysqlDateTime($TimeEnd).')<br>');
    330330
    331331        $EndIndex = $StartIndex;
    332         while(($Values[$EndIndex]['Time'] < $TimeEnd) and ($EndIndex < count($Values))) $EndIndex = $EndIndex + 1;
    333         //while(($Values[$EndIndex]['Time'] < $TimeEnd)) $EndIndex = $EndIndex + 1;
     332        while (($Values[$EndIndex]['Time'] < $TimeEnd) and ($EndIndex < count($Values))) $EndIndex = $EndIndex + 1;
     333        //while (($Values[$EndIndex]['Time'] < $TimeEnd)) $EndIndex = $EndIndex + 1;
    334334        $SubValues = array_slice($Values, $StartIndex, $EndIndex - $StartIndex + 1);
    335335        $Points[] = $this->ComputeOneValue($TimeStart, $TimeEnd, $SubValues, $Level);
    336336        $StartIndex = $EndIndex - 1;
    337337      }
    338       if($this->Debug) print_r($Points);
     338      if ($this->Debug) print_r($Points);
    339339    } else $Points[] = array('Min' => 0, 'Avg' => 0, 'Max' => 0);
    340     return($Points);
     340    return ($Points);
    341341  }
    342342
     
    344344  {
    345345    echo('Veličina '.$this->Data['Name']."<br>\n");
    346     if($this->Data['Continuity'] == 0) $this->Data['ContinuityEnabled'] = 0;  // non continuous
     346    if ($this->Data['Continuity'] == 0) $this->Data['ContinuityEnabled'] = 0;  // non continuous
    347347      else $this->Data['ContinuityEnabled'] = 2;    // continuous graph
    348348
     
    354354    echo("<br>\n");
    355355
    356     for($Level = 1; $Level <= $this->MaxLevel; $Level++)
     356    for ($Level = 1; $Level <= $this->MaxLevel; $Level++)
    357357    {
    358358      echo('Uroven '.$Level."<br>\n");
     
    363363      $BurstCount = 500;
    364364      echo('For 0 to '.round(($EndTime - $StartTime) / $TimeSegment / $BurstCount)."<br>\n");
    365       for($I = 0; $I <= round(($EndTime - $StartTime) / $TimeSegment / $BurstCount); $I++)
     365      for ($I = 0; $I <= round(($EndTime - $StartTime) / $TimeSegment / $BurstCount); $I++)
    366366      {
    367367        echo($I.' ');
     
    371371        $DbResult = $this->Database->select($this->Data['DataTable'], '*', 'Time > "'.
    372372          TimeToMysqlDateTime($StartTime2).'" AND Time < "'.TimeToMysqlDateTime($EndTime2).'" AND Measure='.$this->Data['Id'].' AND Level='.($Level - 1).' ORDER BY Time');
    373         while($Row = $DbResult->fetch_assoc())
     373        while ($Row = $DbResult->fetch_assoc())
    374374        {
    375375          $Row['Time'] = MysqlDateTimeToTime($Row['Time']);
     
    377377        }
    378378
    379         if(count($Values) > 0)
     379        if (count($Values) > 0)
    380380        {
    381381          $Values = array_merge($this->LoadLeftSideValue($Level - 1, $StartTime2),
     
    383383
    384384          $StartIndex = 0;
    385           for($B = 0; $B < $BurstCount; $B++)
     385          for ($B = 0; $B < $BurstCount; $B++)
    386386          {
    387387            echo('.');
     
    390390
    391391            $EndIndex = $StartIndex;
    392             while($Values[$EndIndex]['Time'] < $EndTime3) $EndIndex = $EndIndex + 1;
     392            while ($Values[$EndIndex]['Time'] < $EndTime3) $EndIndex = $EndIndex + 1;
    393393            $SubValues = array_slice($Values, $StartIndex, $EndIndex - $StartIndex + 1);
    394             if(count($SubValues) > 2)
     394            if (count($SubValues) > 2)
    395395            {
    396396              $Point = $this->ComputeOneValue($StartTime3, $EndTime3, $SubValues, $Level);
     
    420420    $Measures = array();
    421421    $Result = $Database->select('Measure', '*');
    422     while($Row = $Result->fetch_assoc())
     422    while ($Row = $Result->fetch_assoc())
    423423    {
    424424      $Measures = new Measure();
     
    426426    }
    427427
    428     foreach($Measures as $Measure)
     428    foreach ($Measures as $Measure)
    429429    {
    430430      $Measure->RebuildMeasureCache();
  • trunk/Modules/TimeMeasure/Measurement/MeasureClient.php

    r738 r873  
    88  {
    99    $DbResult = $this->Database->select('MeasureClient', '*');
    10     while($MeasureClient = $DbResult->fetch_assoc())
     10    while ($MeasureClient = $DbResult->fetch_assoc())
    1111    {
    1212      $DbResult2 = $this->Database->select('MeasureMethod', '*', 'Id='.$MeasureClient['Method']);
     
    1515      include_once(dirname(__FILE__).'/'.$MeasureMethod['MeasureClass'].'.php');
    1616      $MeasureMethod['MeasureClass'] .= 'Measurement';
    17       if(class_exists($MeasureMethod['MeasureClass']))
     17      if (class_exists($MeasureMethod['MeasureClass']))
    1818      {
    1919        $MeasureClass = new $MeasureMethod['MeasureClass']($this->System);
    20         if(method_exists($MeasureClass, $MeasureMethod['Method']))
     20        if (method_exists($MeasureClass, $MeasureMethod['Method']))
    2121        {
    22           if($MeasureClient['Parameter'] != '') $Value = $Measure->$MeasureMethod['Method']($MeasureClient['Parameter']);
     22          if ($MeasureClient['Parameter'] != '') $Value = $Measure->$MeasureMethod['Method']($MeasureClient['Parameter']);
    2323            else $Value = $MeasureClass->$MeasureMethod['Method']();
    2424          echo(file_get_contents('http://'.$MeasureClient['Host'].$MeasureClient['Path'].'/?M=Add&MeasureId='.$MeasureClient['MeasureId'].'&Value='.addslashes($Value)));
  • trunk/Modules/TimeMeasure/Measurement/System.php

    r660 r873  
    1111    set_error_handler('ErrorHandler');
    1212    //error_reporting(0);
    13     if($Fp1 = fsockopen($Ip, $Port, $ERROR_NO, $ERROR_STR, (float)$Timeout))
     13    if ($Fp1 = fsockopen($Ip, $Port, $ERROR_NO, $ERROR_STR, (float)$Timeout))
    1414    {
    1515      fclose($Fp1);
    16       return(TRUE);
     16      return (TRUE);
    1717    } else
    1818    {
    1919      //echo($ERROR_NO.','.$ERROR_STR);
    20       return(FALSE);
     20      return (FALSE);
    2121    }
    2222    restore_error_handler();
     
    3030    // c - ping count
    3131    $Parts = explode(' ', $Row[0]);
    32     if(count($Parts) > 6)
     32    if (count($Parts) > 6)
    3333    {
    3434      $Time = $Parts[7];
    3535      $TimeParts = explode('=', $Time);
    36       return($TimeParts[1]);
    37     } else return(0);
     36      return ($TimeParts[1]);
     37    } else return (0);
    3838  }
    3939
     
    4343    exec('free -b', $Output);
    4444    $Row = $Output[2];
    45     while(strpos($Row, '  ') !== false) $Row = str_replace('  ', ' ', $Row);
     45    while (strpos($Row, '  ') !== false) $Row = str_replace('  ', ' ', $Row);
    4646    $RowParts = explode(' ', $Row);
    4747    $Row = $Output[3];
    48     while(strpos($Row, '  ') !== false) $Row = str_replace('  ', ' ', $Row);
     48    while (strpos($Row, '  ') !== false) $Row = str_replace('  ', ' ', $Row);
    4949    $RowParts2 = explode(' ', $Row);
    50     return($RowParts[2] + $RowParts2[2]);
     50    return ($RowParts[2] + $RowParts2[2]);
    5151  }
    5252
     
    8181    }
    8282    file_put_contents($CpuStateFileName, serialize($CpuUsage));
    83     return(100 - round($CpuUsagePercent['Idle'], 2));
     83    return (100 - round($CpuUsagePercent['Idle'], 2));
    8484  }
    8585
     
    9393    array_shift($Output); // Skip header
    9494    array_shift($Output); // Skip header
    95     foreach($Output as $Item)
     95    foreach ($Output as $Item)
    9696    {
    97       while(strpos($Item, '  ') !== false) $Item = str_replace('  ', ' ', $Item);  // Rrmove multiple spaces
     97      while (strpos($Item, '  ') !== false) $Item = str_replace('  ', ' ', $Item);  // Rrmove multiple spaces
    9898      $Item = explode(':', $Item);
    9999      $Interface = trim($Item[0]);
    100100      $Item = explode(' ', trim($Item[1]));
    101101      $NetworkState[$Interface] = array('Down' => $Item[0], 'Up' => $Item[8]);
    102       if(array_key_exists($Interface, $LastNetworkState))
     102      if (array_key_exists($Interface, $LastNetworkState))
    103103      {
    104104        $Period = time() - $LastNetworkState['Time'];
     
    110110        $NetworkState[$Interface]['UpAverage'] = 0;
    111111      }
    112       if($NetworkState[$Interface]['DownAverage'] < 0) $NetworkState[$Interface]['DownAverage'] = 0;
    113       if($NetworkState[$Interface]['UpAverage'] < 0) $NetworkState[$Interface]['UpAverage'] = 0;
     112      if ($NetworkState[$Interface]['DownAverage'] < 0) $NetworkState[$Interface]['DownAverage'] = 0;
     113      if ($NetworkState[$Interface]['UpAverage'] < 0) $NetworkState[$Interface]['UpAverage'] = 0;
    114114    }
    115115    file_put_contents($NetworkStateFile, serialize($NetworkState));
    116     return($NetworkState);
     116    return ($NetworkState);
    117117  }
    118118
     
    120120  {
    121121    $NetworkState = $this->GetNetworkState();
    122     return($NetworkState['Interface']['DownAverage']);
     122    return ($NetworkState['Interface']['DownAverage']);
    123123  }
    124124
     
    126126  {
    127127    $NetworkState = $this->GetNetworkState();
    128     return($NetworkState['Interface']['UpAverage']);
     128    return ($NetworkState['Interface']['UpAverage']);
    129129  }
    130130
     
    134134    $Output = array();
    135135    exec('cat /proc/net/nf_conntrack|grep "dst='.$HostIP.' "|grep "dport='.$Port.' "|grep "ASSURED"', $Output);
    136     return(count($Output));
     136    return (count($Output));
    137137  }
    138138
     
    142142    exec('iostat -d '.$Device.' -x -m 2 2', $Output);   // 2 second measure delay
    143143    $Row = $Output[6];
    144     while(strpos($Row, '  ') !== false) $Row = str_replace('  ', ' ', $Row);
     144    while (strpos($Row, '  ') !== false) $Row = str_replace('  ', ' ', $Row);
    145145    $Parts = explode(' ', $Row);
    146146    $Value = str_replace(',', '.', $Parts[11]);
    147     return($Value);
     147    return ($Value);
    148148  }
    149149
    150150  function DiskFree($Path)
    151151  {
    152     return(disk_free_space($Path));
     152    return (disk_free_space($Path));
    153153  }
    154154
     
    157157    $Output = array();
    158158    exec('/usr/bin/sensors', $Output);
    159     foreach($Output as $Line)
     159    foreach ($Output as $Line)
    160160    {
    161       if(substr($Line, 0, strlen($Sensor)) == $Sensor)
     161      if (substr($Line, 0, strlen($Sensor)) == $Sensor)
    162162      {
    163163        $Line = substr($Line, strpos($Line, '+') + 1);
    164164        $Line = substr($Line, 0, strpos($Line, '°'));
    165         return($Line);
     165        return ($Line);
    166166      }
    167167    }
    168     return(0);
     168    return (0);
    169169  }
    170170
     
    175175    fclose($File);
    176176    $UptimeParts = explode(' ', $Uptime);
    177     return($UptimeParts[0]);
     177    return ($UptimeParts[0]);
    178178  }
    179179}
  • trunk/Modules/TimeMeasure/Measurement/WoW.php

    r738 r873  
    1212    $DbResult = $Database->query('SELECT COUNT(*) FROM account WHERE online=1');
    1313    $Row = $DbResult->fetch_array();
    14     return($Row[0]);
     14    return ($Row[0]);
    1515  }
    1616
     
    2020    $DbResult = $Database->query('SELECT COUNT(*) FROM account WHERE online=1 AND gmlevel > 0');
    2121    $Row = $DbResult->fetch_array();
    22     return($Row[0]);
     22    return ($Row[0]);
    2323  }
    2424
     
    2828    $DbResult = $Database->query('SELECT COUNT(*) FROM account');
    2929    $Row = $DbResult->fetch_array();
    30     return($Row[0]);
     30    return ($Row[0]);
    3131  }
    3232
     
    3636    $DbResult = $Database->query('SELECT COUNT(*) FROM guild');
    3737    $Row = $DbResult->fetch_array();
    38     return($Row[0]);
     38    return ($Row[0]);
    3939  }
    4040
     
    4444    $DbResult = $Database->query('SELECT COUNT(*) FROM `characters`');
    4545    $Row = $DbResult->fetch_array();
    46     return($Row[0]);
     46    return ($Row[0]);
    4747  }
    4848
     
    5252    $DbResult = $Database->query('SELECT COUNT(*) FROM uptime');
    5353    $Row = $DbResult->fetch_array();
    54     return($Row[0]);
     54    return ($Row[0]);
    5555  }
    5656
    5757  function WoWEmulatorAvailability()
    5858  {
    59     if(CheckPortStatus('localhost', 8085)) return(100); else return(0);
     59    if (CheckPortStatus('localhost', 8085)) return (100); else return (0);
    6060  }
    6161
     
    6969    $Row = $DbResult->fetch_array();
    7070    $Value = $Row[0];
    71     return($Value);
     71    return ($Value);
    7272  }
    7373}
Note: See TracChangeset for help on using the changeset viewer.