Changeset 880 for trunk/includes


Ignore:
Timestamp:
Apr 7, 2020, 10:15:48 PM (5 years ago)
Author:
chronos
Message:
  • Modified: Improved code formatting.
Location:
trunk/includes
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/includes/FileStream.php

    r815 r880  
    1515  function __destruct()
    1616  {
    17     if($this->Handle)
     17    if ($this->Handle)
    1818      fclose($this->Handle);
    1919  }
     
    2424    $this->CloseFile();
    2525    $this->Handle = fopen($FileName, 'rb');
    26     if(!$this->Handle) die(str_replace('%s', $FileName, FILE_NOT_FOUND));
     26    if (!$this->Handle) die(str_replace('%s', $FileName, FILE_NOT_FOUND));
    2727  }
    2828
     
    3232    $this->CloseFile();
    3333    $this->Handle = fopen($FileName, 'wb+');
    34     if(!$this->Handle) die(str_replace('%s', $FileName, FILE_NOT_FOUND));
     34    if (!$this->Handle) die(str_replace('%s', $FileName, FILE_NOT_FOUND));
    3535  }
    3636
    3737  public function CloseFile()
    3838  {
    39     if($this->Handle)
     39    if ($this->Handle)
    4040      fclose($this->Handle);
    4141  }
     
    4343  public function ReadBlock($Count)
    4444  {
    45     return(fread($this->Handle, $Count));
     45    return fread($this->Handle, $Count);
    4646  }
    4747
    4848  public function ReadByte()
    4949  {
    50     return(fread($this->Handle, 1));
     50    return fread($this->Handle, 1);
    5151  }
    5252
     
    5454  {
    5555    $val = unpack('V*', fread($this->Handle, 4));
    56     return($val[1]);
     56    return $val[1];
    5757  }
    5858
     
    6060  {
    6161    $val = unpack('I*', fread($this->Handle, 4));
    62     return($val[1]);
     62    return $val[1];
    6363  }
    6464
     
    6666  {
    6767    $val = unpack('f*', fread($this->Handle, 4));
    68     return($val[1]);
     68    return $val[1];
    6969  }
    7070
    7171  public function ReadChar()
    7272  {
    73     return(fread($this->Handle, 1));
     73    return fread($this->Handle, 1);
    7474  }
    7575
    7676  public function ReadLine()
    7777  {
    78     return(fgets($this->Handle));
     78    return fgets($this->Handle);
    7979  }
    8080
    8181  public function ReadTextLine()
    8282  {
    83     return(fgets($this->Handle));
     83    return fgets($this->Handle);
    8484  }
    8585
     
    131131  public function GetPosition()
    132132  {
    133     return(ftell($this->Handle));
     133    return ftell($this->Handle);
    134134  }
    135135
    136136  public function GetSize()
    137137  {
    138     return(filesize($this->FileName));
     138    return filesize($this->FileName);
    139139  }
    140140
    141141  public function SetSize($Size)
    142142  {
    143     return(ftruncate($this->Handle, $Size));
     143    return ftruncate($this->Handle, $Size);
    144144  }
    145145
    146146  public function EOF()
    147147  {
    148     return(feof($this->Handle));
     148    return feof($this->Handle);
    149149  }
    150150}
  • trunk/includes/Global.php

    r879 r880  
    22
    33include_once(dirname(__FILE__).'/../Packages/Common/Common.php');
    4 if(file_exists(dirname(__FILE__).'/../Config/Config.php'))
     4if (file_exists(dirname(__FILE__).'/../Config/Config.php'))
    55  include_once(dirname(__FILE__).'/../Config/Config.php');
    66include_once(dirname(__FILE__).'/../Application/Core.php');
     
    1313
    1414// Back compatibility, will be removed
    15 if(isset($InitSystem) and $InitSystem)
     15if (isset($InitSystem) and $InitSystem)
    1616{
    1717  $System = new Core();
     
    2525  {
    2626    global $TempPageContent;
    27     return($TempPageContent);
     27    return $TempPageContent;
    2828  }
    2929}
     
    5454{
    5555  list($Usec, $Sec) = explode(' ', microtime());
    56   return ((float)$Usec + (float)$Sec);
     56  return (float)$Usec + (float)$Sec;
    5757}
    5858
     
    6464
    6565  $UnitIndex = 0;
    66   while($Value > 1024)
     66  while ($Value > 1024)
    6767  {
    6868    $Value = round($Value / 1024, 3);
    6969    $UnitIndex++;
    7070  }
    71   return($Value.' '.$UnitNames[$UnitIndex]);
     71  return $Value.' '.$UnitNames[$UnitIndex];
    7272}
    7373
     
    7676  $Result = array();
    7777  $Parts = explode('&', $QueryString);
    78   foreach($Parts as $Part)
    79   {
    80     if($Part != '')
    81     {
    82       if(!strpos($Part, '=')) $Part .= '=';
     78  foreach ($Parts as $Part)
     79  {
     80    if ($Part != '')
     81    {
     82      if (!strpos($Part, '=')) $Part .= '=';
    8383      $Item = explode('=', $Part);
    8484      $Result[$Item[0]] = $Item[1];
    8585    }
    8686  }
    87   return($Result);
     87  return $Result;
    8888}
    8989
     
    9191{
    9292  $Parts = array();
    93   foreach($QueryStringArray as $Index => $Item)
     93  foreach ($QueryStringArray as $Index => $Item)
    9494  {
    9595    $Parts[] = $Index.'='.$Item;
    9696  }
    97   return(implode('&', $Parts));
     97  return implode('&', $Parts);
    9898}
    9999
     
    107107  //$return = Str_Replace(Array("(",")",".","!",",","\"","'"), "", $return); //odstraní ().!,"'
    108108  //$return = StrToLower($return); // velká písmena nahradí malými.
    109   return($return);
     109  return $return;
    110110}
    111111
     
    116116  $Days = floor($Days - $month * 30);
    117117  $month = $month - $year * 12;
    118   return($year.'r '.$month.'m '.$Days.'d');
     118  return $year.'r '.$month.'m '.$Days.'d';
    119119}
    120120
     
    137137
    138138  error_reporting(E_ALL ^ E_WARNING);
    139   if (($handle = @fopen($url, "r")) === FALSE) return(false);
     139  if (($handle = @fopen($url, "r")) === FALSE) return false;
    140140
    141141  $data = stream_get_contents($handle);
     
    164164  $data = strip_tags($data);
    165165
    166   return($data);
     166  return $data;
    167167}
    168168
     
    178178  $PageCount = floor($TotalCount / $ItemPerPage) + 1;
    179179
    180   if(!array_key_exists('Page', $_SESSION)) $_SESSION['Page'] = 0;
    181   if(array_key_exists('page', $_GET)) $_SESSION['Page'] = $_GET['page'] * 1;
    182   if($_SESSION['Page'] < 0) $_SESSION['Page'] = 0;
    183   if($_SESSION['Page'] >= $PageCount) $_SESSION['Page'] = $PageCount - 1;
     180  if (!array_key_exists('Page', $_SESSION)) $_SESSION['Page'] = 0;
     181  if (array_key_exists('page', $_GET)) $_SESSION['Page'] = $_GET['page'] * 1;
     182  if ($_SESSION['Page'] < 0) $_SESSION['Page'] = 0;
     183  if ($_SESSION['Page'] >= $PageCount) $_SESSION['Page'] = $PageCount - 1;
    184184  $CurrentPage = $_SESSION['Page'];
    185185
     
    188188
    189189  $Result = '';
    190   if($PageCount > 1)
    191   {
    192     if($CurrentPage > 0)
     190  if ($PageCount > 1)
     191  {
     192    if ($CurrentPage > 0)
    193193    {
    194194      $QueryItems['page'] = 0;
     
    199199    $PagesMax = $PageCount - 1;
    200200    $PagesMin = 0;
    201     if($PagesMax > ($CurrentPage + $Around)) $PagesMax = $CurrentPage + $Around;
    202     if($PagesMin < ($CurrentPage - $Around))
     201    if ($PagesMax > ($CurrentPage + $Around)) $PagesMax = $CurrentPage + $Around;
     202    if ($PagesMin < ($CurrentPage - $Around))
    203203    {
    204204      $Result.= ' ... ';
    205205      $PagesMin = $CurrentPage - $Around;
    206206    }
    207     for($i = $PagesMin; $i <= $PagesMax; $i++)
    208     {
    209       if($i == $CurrentPage) $Result.= '<strong>'.($i + 1).'</strong> ';
     207    for ($i = $PagesMin; $i <= $PagesMax; $i++)
     208    {
     209      if ($i == $CurrentPage) $Result.= '<strong>'.($i + 1).'</strong> ';
    210210      else {
    211211       $QueryItems['page'] = $i;
     
    213213      }
    214214    }
    215     if($PagesMax < ($PageCount - 1)) $Result .= ' ... ';
    216     if($CurrentPage < ($PageCount - 1))
     215    if ($PagesMax < ($PageCount - 1)) $Result .= ' ... ';
     216    if ($CurrentPage < ($PageCount - 1))
    217217    {
    218218      $QueryItems['page'] = ($CurrentPage + 1);
     
    223223  }
    224224  $Result = '<div style="text-align: center">'.$Result.'</div>';
    225   return(array('SQLLimit' => ' LIMIT '.$CurrentPage * $ItemPerPage.', '.$ItemPerPage,
     225  return array('SQLLimit' => ' LIMIT '.$CurrentPage * $ItemPerPage.', '.$ItemPerPage,
    226226    'Page' => $CurrentPage,
    227227    'Output' => $Result,
    228   ));
     228  );
    229229}
    230230
     
    236236  global $OrderDirSQL, $OrderArrowImage, $Config, $System;
    237237
    238   if(array_key_exists('OrderCol', $_GET)) $_SESSION['OrderCol'] = $_GET['OrderCol'];
    239   if(array_key_exists('OrderDir', $_GET) and (array_key_exists($_GET['OrderDir'], $OrderArrowImage)))
     238  if (array_key_exists('OrderCol', $_GET)) $_SESSION['OrderCol'] = $_GET['OrderCol'];
     239  if (array_key_exists('OrderDir', $_GET) and (array_key_exists($_GET['OrderDir'], $OrderArrowImage)))
    240240    $_SESSION['OrderDir'] = $_GET['OrderDir'];
    241   if(!array_key_exists('OrderCol', $_SESSION)) $_SESSION['OrderCol'] = $DefaultColumn;
    242   if(!array_key_exists('OrderDir', $_SESSION)) $_SESSION['OrderDir'] = $DefaultOrder;
     241  if (!array_key_exists('OrderCol', $_SESSION)) $_SESSION['OrderCol'] = $DefaultColumn;
     242  if (!array_key_exists('OrderDir', $_SESSION)) $_SESSION['OrderDir'] = $DefaultOrder;
    243243
    244244  // Check OrderCol
    245245  $Found = false;
    246   foreach($Columns as $Column)
    247   {
    248     if($Column['Name'] == $_SESSION['OrderCol'])
     246  foreach ($Columns as $Column)
     247  {
     248    if ($Column['Name'] == $_SESSION['OrderCol'])
    249249    {
    250250      $Found = true;
     
    252252    }
    253253  }
    254   if($Found == false)
     254  if ($Found == false)
    255255  {
    256256    $_SESSION['OrderCol'] = $DefaultColumn;
     
    258258  }
    259259  // Check OrderDir
    260   if(($_SESSION['OrderDir'] != 0) and ($_SESSION['OrderDir'] != 1)) $_SESSION['OrderDir'] = 0;
     260  if (($_SESSION['OrderDir'] != 0) and ($_SESSION['OrderDir'] != 1)) $_SESSION['OrderDir'] = 0;
    261261
    262262  $Result = '';
    263263  $QueryItems = GetQueryStringArray($_SERVER['QUERY_STRING']);
    264   foreach($Columns as $Index => $Column)
     264  foreach ($Columns as $Index => $Column)
    265265  {
    266266    $QueryItems['OrderCol'] = $Column['Name'];
    267267    $QueryItems['OrderDir'] = 1 - $_SESSION['OrderDir'];
    268     if($Column['Name'] == $_SESSION['OrderCol']) $ArrowImage = '<img style="vertical-align: middle; border: 0px;" src="'.
     268    if ($Column['Name'] == $_SESSION['OrderCol']) $ArrowImage = '<img style="vertical-align: middle; border: 0px;" src="'.
    269269      $System->Link('/images/'.$OrderArrowImage[$_SESSION['OrderDir']]).'" alt="order arrow"/>';
    270270      else $ArrowImage = '';
    271     if($Column['Name'] == '') $Result .= '<th>'.$Column['Title'].'</th>';
     271    if ($Column['Name'] == '') $Result .= '<th>'.$Column['Title'].'</th>';
    272272      else $Result .= '<th><a href="?'.SetQueryStringArray($QueryItems).'">'.$Column['Title'].$ArrowImage.'</a></th>';
    273273  }
    274   return(array(
     274  return array(
    275275    'SQL' => ' ORDER BY `'.$_SESSION['OrderCol'].'` '.$OrderDirSQL[$_SESSION['OrderDir']],
    276276    'Output' => '<tr>'.$Result.'</tr>',
    277277    'Column' => $_SESSION['OrderCol'],
    278278    'Direction' => $_SESSION['OrderDir'],
    279   ));
     279  );
    280280}
    281281
     
    287287  $DbResult = $System->Database->select('ClientVersion', '`Id`, `Version`', '`Imported` = 1');
    288288  $Output .= '<option value=""';
    289   if($Selected == '')
     289  if ($Selected == '')
    290290    $Output .= ' selected="selected"';
    291291  $Output .= '>'.T('None').'</option>';
    292   while($ClientVersion = $DbResult->fetch_assoc())
     292  while ($ClientVersion = $DbResult->fetch_assoc())
    293293  {
    294294    $Output .= '<option value="'.$ClientVersion['Id'].'"';
    295     if($Selected == $ClientVersion['Id'])
     295    if ($Selected == $ClientVersion['Id'])
    296296      $Output .= ' selected="selected"';
    297297    $Output .= '>'.$ClientVersion['Version'].'</option>';
    298298  }
    299299  $Output .= '</select>';
    300   return($Output);
     300  return $Output;
    301301}
    302302
     
    307307  $Result = array();
    308308  $DbResult = $System->Database->query('SELECT * FROM `Language` WHERE `Enabled` = 1');
    309   while($DbRow = $DbResult->fetch_assoc())
     309  while ($DbRow = $DbResult->fetch_assoc())
    310310    $Result[$DbRow['Id']] = $DbRow;
    311   return($Result);
     311  return $Result;
    312312}
    313313
     
    316316function HumanDate($SQLDateTime)
    317317{
    318   if($SQLDateTime == '') return('&nbsp;');
     318  if ($SQLDateTime == '') return '&nbsp;';
    319319  $DateTimeParts = explode(' ', $SQLDateTime);
    320   if($DateTimeParts[0] != '0000-00-00')
     320  if ($DateTimeParts[0] != '0000-00-00')
    321321  {
    322322    $DateParts = explode('-', $DateTimeParts[0]);
    323     return(($DateParts[2] * 1).'.'.($DateParts[1] * 1).'.'.($DateParts[0] * 1));
    324   } else return('&nbsp;');
     323    return ($DateParts[2] * 1).'.'.($DateParts[1] * 1).'.'.($DateParts[0] * 1);
     324  } else return '&nbsp;';
    325325}
    326326
    327327function HumanDateTime($SQLDateTime)
    328328{
    329   if($SQLDateTime == '') return('&nbsp;');
     329  if ($SQLDateTime == '') return '&nbsp;';
    330330  $DateTimeParts = explode(' ', $SQLDateTime);
    331   if($DateTimeParts[0] != '0000-00-00' and $SQLDateTime <> '')
     331  if ($DateTimeParts[0] != '0000-00-00' and $SQLDateTime <> '')
    332332  {
    333333    $DateParts = explode('-', $DateTimeParts[0]);
    334334    $Output = ($DateParts[2] * 1).'.'.($DateParts[1] * 1).'.'.($DateParts[0] * 1);
    335335  } else $Output = '&nbsp;';
    336   if(count($DateTimeParts) > 1)
    337   if($DateTimeParts[1] != '00:00:00')
     336  if (count($DateTimeParts) > 1)
     337  if ($DateTimeParts[1] != '00:00:00')
    338338  {
    339339    $TimeParts = explode(':', $DateTimeParts[1]);
    340340    $Output .= ' '.($TimeParts[0] * 1).':'.($TimeParts[1] * 1).':'.($TimeParts[2] * 1);
    341341  };
    342   return($Output);
     342  return $Output;
    343343}
    344344
     
    347347  global $System, $Config;
    348348
    349   if($Prev)
     349  if ($Prev)
    350350    $sql = 'SELECT `ID` FROM `'.$Table.'` AS `item` WHERE '.
    351351      '(`Language` = '.$Config['OriginalLanguage'].') AND NOT EXISTS(SELECT `entry` '.
     
    359359  $DbResult = $System->Database->query($sql);
    360360  $Next = $DbResult->fetch_assoc();
    361   if($Next)
    362   {
    363     if($Prev) $Output = '<a href="form.php?group='.$GroupId.'&amp;ID='.$Next['ID'].'">Předcházející '.$Next['ID'].'</a> ';
     361  if ($Next)
     362  {
     363    if ($Prev) $Output = '<a href="form.php?group='.$GroupId.'&amp;ID='.$Next['ID'].'">Předcházející '.$Next['ID'].'</a> ';
    364364    else $Output = '<a href="form.php?group='.$GroupId.'&amp;ID='.$Next['ID'].'">Následující '.$Next['ID'].'</a> ';
    365       return('form.php?group='.$GroupId.'&amp;ID='.$Next['ID']);
     365      return 'form.php?group='.$GroupId.'&amp;ID='.$Next['ID'];
    366366  }
    367367}
     
    371371  global $System, $BuildNumbers;
    372372
    373   if(isset($BuildNumbers[$Version]) == false)
     373  if (isset($BuildNumbers[$Version]) == false)
    374374  {
    375375    $sql = 'SELECT `BuildNumber` FROM `ClientVersion` WHERE `Version` = "'.$Version.'"';
     
    378378    $BuildNumbers[$Version] = $DbRow['BuildNumber'];
    379379  }
    380   return($BuildNumbers[$Version]);
     380  return $BuildNumbers[$Version];
    381381}
    382382
     
    386386  global $System, $VersionsWOW;
    387387
    388   if(isset($VersionsWOW[$BuildNumber]) == false)
     388  if (isset($VersionsWOW[$BuildNumber]) == false)
    389389  {
    390390    $sql = 'SELECT `Version` FROM `ClientVersion` WHERE `BuildNumber` = "'.$BuildNumber.'"';
     
    393393    $VersionsWOW[$BuildNumber] = $Version['Version'];
    394394  }
    395   return($VersionsWOW[$BuildNumber]);
     395  return $VersionsWOW[$BuildNumber];
    396396}
    397397
     
    401401  global $System, $VersionsWOWId;
    402402
    403   if(isset($VersionsWOWId[$BuildNumber]) == false)
     403  if (isset($VersionsWOWId[$BuildNumber]) == false)
    404404  {
    405405    $sql = 'SELECT `Id` FROM `ClientVersion` WHERE `BuildNumber` = "'.$BuildNumber.'"';
     
    408408    $VersionsWOWId[$BuildNumber] = $Version['Id'];
    409409  }
    410   return($VersionsWOWId[$BuildNumber]);
     410  return $VersionsWOWId[$BuildNumber];
    411411}
    412412
     
    416416  $TranslationTree = $System->ModuleManager->Modules['Translation']->GetTranslationTree();
    417417
    418   if(array_key_exists('group', $_GET)) $GroupId = $_GET['group'] * 1;
     418  if (array_key_exists('group', $_GET)) $GroupId = $_GET['group'] * 1;
    419419    else $GroupId = 1;
    420420
    421   if(isset($TranslationTree[$GroupId]) == false) ErrorMessage('Překladová skupina dle zadaného Id neexistuje.');
    422   return($GroupId);
     421  if (isset($TranslationTree[$GroupId]) == false) ErrorMessage('Překladová skupina dle zadaného Id neexistuje.');
     422  return $GroupId;
    423423}
    424424
    425425function LoadCommandLineParameters()
    426426{
    427   if(!array_key_exists('REMOTE_ADDR', $_SERVER))
    428   {
    429     foreach($_SERVER['argv'] as $Parameter)
    430     {
    431       if(strpos($Parameter, '=') !== false)
     427  if (!array_key_exists('REMOTE_ADDR', $_SERVER))
     428  {
     429    foreach ($_SERVER['argv'] as $Parameter)
     430    {
     431      if (strpos($Parameter, '=') !== false)
    432432      {
    433433        $Index = substr($Parameter, 0, strpos($Parameter, '='));
     
    444444  $QueryItems = GetQueryStringArray($_SERVER['QUERY_STRING']);
    445445
    446   if(array_key_exists('Tab', $_GET)) $_SESSION['Tab'] = $_GET['Tab'];
    447   if(!array_key_exists('Tab', $_SESSION)) $_SESSION['Tab'] = 0;
    448   if(($_SESSION['Tab'] < 0) or ($_SESSION['Tab'] > (count($Tabs) - 1))) $_SESSION['Tab'] = 0;
     446  if (array_key_exists('Tab', $_GET)) $_SESSION['Tab'] = $_GET['Tab'];
     447  if (!array_key_exists('Tab', $_SESSION)) $_SESSION['Tab'] = 0;
     448  if (($_SESSION['Tab'] < 0) or ($_SESSION['Tab'] > (count($Tabs) - 1))) $_SESSION['Tab'] = 0;
    449449  $Output = '<div id="header">'.
    450450    '<ul>';
    451   foreach($Tabs as $Index => $Tab)
     451  foreach ($Tabs as $Index => $Tab)
    452452  {
    453453    $QueryItems['Tab'] = $Index;
    454     if($Index == $_SESSION['Tab']) $Selected = ' id="selected"';
     454    if ($Index == $_SESSION['Tab']) $Selected = ' id="selected"';
    455455      else $Selected = '';
    456456    $Output .= '<li'.$Selected.'><a href="?'.SetQueryStringArray($QueryItems).'">'.$Tab.'</a></li>';
    457457  }
    458458  $Output .= '</ul></div>';
    459   return($Output);
     459  return $Output;
    460460}
    461461
    462462function CheckBox($Name, $Checked = false, $Id = '', $Class = '', $Disabled = false)
    463463{
    464   if($Id) $Id = ' id="'.$Id.'"'; else $Id = '';
    465   if($Class) $Class = ' class="'.$Class.'"'; else $Class = '';
    466   if($Checked) $Checked = ' checked="checked"'; else $Checked = '';
    467   if($Disabled) $Disabled = ' disabled="disabled"'; else $Disabled = '';
    468   return('<input type="checkbox" value="checked" name="'.$Name.'"'.$Checked.$Disabled.$Id.$Class.' />');
     464  if ($Id) $Id = ' id="'.$Id.'"'; else $Id = '';
     465  if ($Class) $Class = ' class="'.$Class.'"'; else $Class = '';
     466  if ($Checked) $Checked = ' checked="checked"'; else $Checked = '';
     467  if ($Disabled) $Disabled = ' disabled="disabled"'; else $Disabled = '';
     468  return '<input type="checkbox" value="checked" name="'.$Name.'"'.$Checked.$Disabled.$Id.$Class.' />';
    469469}
    470470
    471471function RadioButton($Name, $Value, $Checked = false, $OnClick = '', $Disabled = false)
    472472{
    473   if($Checked) $Checked = ' checked="checked"'; else $Checked = '';
    474   if($OnClick != '') $OnClick = ' onclick="'.$OnClick.'"'; else $OnClick = '';
    475   if($Disabled) $Disabled = ' disabled="disabled"'; else $Disabled = '';
    476   return('<input type="radio" name="'.$Name.'" value="'.$Value.'"'.$Checked.$Disabled.$OnClick.'/>');
     473  if ($Checked) $Checked = ' checked="checked"'; else $Checked = '';
     474  if ($OnClick != '') $OnClick = ' onclick="'.$OnClick.'"'; else $OnClick = '';
     475  if ($Disabled) $Disabled = ' disabled="disabled"'; else $Disabled = '';
     476  return '<input type="radio" name="'.$Name.'" value="'.$Value.'"'.$Checked.$Disabled.$OnClick.'/>';
    477477}
    478478
    479479function SelectOption($Name, $Text, $Selected = false)
    480480{
    481   if($Selected) $Selected = ' selected="selected"'; else $Selected = '';
    482   return('<option value="'.$Name.'"'.$Selected.'>'.$Text.'</option>');
     481  if ($Selected) $Selected = ' selected="selected"'; else $Selected = '';
     482  return '<option value="'.$Name.'"'.$Selected.'>'.$Text.'</option>';
    483483}
    484484
    485485function DeleteDirectory($dirname)
    486486{
    487   if(is_dir($dirname))
     487  if (is_dir($dirname))
    488488  {
    489489    $dir_handle = opendir($dirname);
    490     if(!$dir_handle) return(false);
    491     while($file = readdir($dir_handle))
    492     {
    493       if(($file != '.') and ($file != '..'))
     490    if (!$dir_handle) return false;
     491    while ($file = readdir($dir_handle))
     492    {
     493      if (($file != '.') and ($file != '..'))
    494494      {
    495         if(!is_dir($dirname.'/'.$file)) unlink($dirname.'/'.$file);
     495        if (!is_dir($dirname.'/'.$file)) unlink($dirname.'/'.$file);
    496496          else DeleteDirectory($dirname.'/'.$file);
    497497      }
     
    500500    rmdir($dirname);
    501501  }
    502   return(true);
     502  return true;
    503503}
    504504
     
    515515  $TranslationTree = $System->ModuleManager->Modules['Translation']->GetTranslationTree();
    516516
    517   foreach($TranslationTree as $TableID => $Value)
    518   {
    519     if($Value['TablePrefix'] == $Table) return $TableID;
     517  foreach ($TranslationTree as $TableID => $Value)
     518  {
     519    if ($Value['TablePrefix'] == $Table) return $TableID;
    520520  }
    521521}
     
    540540    'Dictionary' => 'Text',
    541541  );
    542   return($TablesColumn);
     542  return $TablesColumn;
    543543}
    544544
     
    578578  $sqlall = '';
    579579
    580   foreach($TablesColumn as $Table => $Column)
     580  foreach ($TablesColumn as $Table => $Column)
    581581  {
    582582    $orderinby = ' ORDER BY ID DESC ';
     
    588588
    589589    $where = '(`Language` = '.$Config['OriginalLanguage'].') ';
    590     if ($mode == 1) 
     590    if ($mode == 1)
    591591    {
    592592      $where .= ' AND EXISTS(SELECT 1 FROM `'.$Table.
     
    594594      ') AND (`Sub`.`Entry` = `O`.`Entry`))';
    595595    }
    596     if ($mode == 2) 
     596    if ($mode == 2)
    597597    {
    598598      $where .= ' AND NOT EXISTS(SELECT 1 FROM `'.$Table.
     
    601601    }
    602602    $where .= ' AND (';
    603     if (array_search('the', $ArrStr)) 
     603    if (array_search('the', $ArrStr))
    604604    {
    605605      $where .= '(`O`.`'.$Column.'` LIKE "The %") OR ';
     
    607607
    608608    $SqlOK = false;
    609     if (count($ArrStr) > 0) 
     609    if (count($ArrStr) > 0)
    610610    {
    611611      for ($i = 0; $i < count($ArrStr); $i++)
     
    614614        if ((strlen($ArrStr[$i]) > 3) or ( ((count($ArrStr) < 6) or ($i == 0)) and (strlen($ArrStr[$i]) > 0) ) )  //length
    615615          if ((!$FirstBig) or (ctype_upper(substr($ArrStr[$i], 0, 1))) or (count($ArrStr) < 6) )  //first big
    616             if (array_search($ArrStr[$i], $ArrStr) == $i) 
     616            if (array_search($ArrStr[$i], $ArrStr) == $i)
    617617            {  // first in array
    618618              $where .= '(`O`.`'.$Column.'` LIKE "'.addslashes($ArrStr[$i]).'%") OR ';
     
    623623      $where .= ')';
    624624    }
    625     if ($SqlOK) 
     625    if ($SqlOK)
    626626    {
    627627        //$sql.$where.$groupby.$orderby
    628628//          $buff[] = array($Line['ID'], GetIDbyName($Table), $Line['Orig'], $Line['Tran']);
    629       if ($sqlall <> '') 
    630       { 
    631         $sqlall .= ' UNION ALL ( '.$sql.$where.$groupby.' )';     
     629      if ($sqlall <> '')
     630      {
     631        $sqlall .= ' UNION ALL ( '.$sql.$where.$groupby.' )';
    632632      } else {
    633         $sqlall .= ' ( '.$sql.$where.$groupby.' )';             
     633        $sqlall .= ' ( '.$sql.$where.$groupby.' )';
    634634      }
    635635    }
    636636  }
    637   if ($SqlOK) 
     637  if ($SqlOK)
    638638  {
    639639    $orderby = ' ORDER BY LENGTH(Orig) DESC ';
     
    641641    $DbResult = $System->Database->query($sqlall.$orderby);
    642642    //  echo ($sql.'|'.$where.'|'.$groupby);
    643     while($Line = $DbResult->fetch_assoc())
     643    while ($Line = $DbResult->fetch_assoc())
    644644    {
    645645      $buff[] = array($Line['ID'], $Line['GroupId'], $Line['Orig'], $Line['Tran']);
     
    652652{
    653653  $Pixels = $Width * ($Percent / 100);
    654   if($Pixels > $Width) $Pixels = $Width;
    655   if($Text == '') $Text = $Percent;
    656 
    657   return('<div class="progressbar" style="width: '.$Width.'px">'.
     654  if ($Pixels > $Width) $Pixels = $Width;
     655  if ($Text == '') $Text = $Percent;
     656
     657  return '<div class="progressbar" style="width: '.$Width.'px">'.
    658658    '<div class="bar" style="width: '.$Pixels.'px;"></div>'.
    659659    '<div class="text" style="width: '.$Width.'px">'.$Text.'</div>'.
    660     '</div>');
     660    '</div>';
    661661}
    662662
     
    665665  $IndexLevel = 100;
    666666
    667   if($XP > 0) $Level = floor(sqrt($XP / $IndexLevel));
     667  if ($XP > 0) $Level = floor(sqrt($XP / $IndexLevel));
    668668    else $Level = 0;
    669669  $MinXP = $Level * $Level * $IndexLevel;
     
    671671  $MaxXP = $MaxXP - $MinXP;
    672672  $XP = $XP - $MinXP;
    673   return(array('Level' => $Level, 'XP' => $XP, 'MaxXP' => $MaxXP));
     673  return array('Level' => $Level, 'XP' => $XP, 'MaxXP' => $MaxXP);
    674674}
    675675
     
    677677{
    678678  $Result = $Default;
    679   if(array_key_exists($Name, $_GET)) $Result = $_GET[$Name];
    680   else if(array_key_exists($Name, $_POST)) $Result = $_POST[$Name];
    681   else if($Session and array_key_exists($Name, $_SESSION)) $Result = $_SESSION[$Name];
    682   if($Numeric and !is_numeric($Result)) $Result = $Default;
    683   if($Session) $_SESSION[$Name] = $Result;
    684   return($Result);
     679  if (array_key_exists($Name, $_GET)) $Result = $_GET[$Name];
     680  else if (array_key_exists($Name, $_POST)) $Result = $_POST[$Name];
     681  else if ($Session and array_key_exists($Name, $_SESSION)) $Result = $_SESSION[$Name];
     682  if ($Numeric and !is_numeric($Result)) $Result = $Default;
     683  if ($Session) $_SESSION[$Name] = $Result;
     684  return $Result;
    685685}
    686686
     
    693693  $Result = '';
    694694  $I = 0;
    695   while((strpos($Content, 'http://') !== false) or (strpos($Content, 'https://') !== false))
    696   {
    697     if(strpos($Content, 'http://') !== false) $I = strpos($Content, 'http://');
    698     if(strpos($Content, 'https://') !== false) $I = strpos($Content, 'https://');
     695  while ((strpos($Content, 'http://') !== false) or (strpos($Content, 'https://') !== false))
     696  {
     697    if (strpos($Content, 'http://') !== false) $I = strpos($Content, 'http://');
     698    if (strpos($Content, 'https://') !== false) $I = strpos($Content, 'https://');
    699699    $Result .= substr($Content, 0, $I);
    700700    $Content = substr($Content, $I);
    701701    $SpacePos = strpos($Content, ' ');
    702     if($SpacePos !== false) $URL = substr($Content, 0, strpos($Content, ' '));
     702    if ($SpacePos !== false) $URL = substr($Content, 0, strpos($Content, ' '));
    703703      else $URL = substr($Content, 0);
    704704
     
    707707  }
    708708  $Result .= $Content;
    709   return($Result);
     709  return $Result;
    710710}
    711711
     
    729729  );
    730730
    731   return('<div class="message" style="background-color: '.$BackgroundColor[$Type].
     731  return '<div class="message" style="background-color: '.$BackgroundColor[$Type].
    732732    ';"><table><tr><td class="icon"><img src="'.
    733733    $System->Link('/images/message/'.$IconName[$Type].'.png').'" alt="'.
    734     $IconName[$Type].'"><td>'.$Text.'</td></tr></table></div>');
     734    $IconName[$Type].'"><td>'.$Text.'</td></tr></table></div>';
    735735}
    736736
    737737function ProcessURL()
    738738{
    739   if(array_key_exists('REDIRECT_QUERY_STRING', $_SERVER))
     739  if (array_key_exists('REDIRECT_QUERY_STRING', $_SERVER))
    740740    $PathString = $_SERVER['REDIRECT_QUERY_STRING'];
    741741  else $PathString = '';
    742   if(substr($PathString, -1, 1) == '/') $PathString = substr($PathString, 0, -1);
     742  if (substr($PathString, -1, 1) == '/') $PathString = substr($PathString, 0, -1);
    743743  $PathItems = explode('/', $PathString);
    744   if(strpos(GetRequestURI(), '?') !== false)
     744  if (strpos(GetRequestURI(), '?') !== false)
    745745    $_SERVER['QUERY_STRING'] = substr(GetRequestURI(), strpos(GetRequestURI(), '?') + 1);
    746746  else $_SERVER['QUERY_STRING'] = '';
    747747  parse_str($_SERVER['QUERY_STRING'], $_GET);
    748748  // SQL injection hack protection
    749   foreach($_GET as $Index => $Item) $_GET[$Index] = addslashes($_GET[$Index]);
    750   return($PathItems);
     749  foreach ($_GET as $Index => $Item) $_GET[$Index] = addslashes($_GET[$Index]);
     750  return $PathItems;
    751751}
    752752
     
    757757  $Output = '<select name="Language">';
    758758  $DbResult = $System->Database->select('Language', '`Id`, `Name`', '`Enabled` = 1');
    759   while($Language = $DbResult->fetch_assoc())
     759  while ($Language = $DbResult->fetch_assoc())
    760760  {
    761761    $Output .= '<option value="'.$Language['Id'].'"';
    762     if($Selected == $Language['Id'])
     762    if ($Selected == $Language['Id'])
    763763      $Output .= ' selected="selected"';
    764764    $Output .= '>'.T($Language['Name']).'</option>';
    765765  }
    766766  $Output .= '</select>';
    767   return($Output);
     767  return $Output;
    768768}
    769769
    770770function GetClientProxyAddresses()
    771771{
    772   if(array_key_exists('HTTP_X_FORWARDED_FOR',$_SERVER)) $IP = $_SERVER['HTTP_X_FORWARDED_FOR'];
     772  if (array_key_exists('HTTP_X_FORWARDED_FOR',$_SERVER)) $IP = $_SERVER['HTTP_X_FORWARDED_FOR'];
    773773    else $IP = array();
    774774}
     
    776776function GetRemoteAddress()
    777777{
    778   if(array_key_exists('REMOTE_ADDR', $_SERVER)) $IP = $_SERVER['REMOTE_ADDR'];
     778  if (array_key_exists('REMOTE_ADDR', $_SERVER)) $IP = $_SERVER['REMOTE_ADDR'];
    779779    else $IP = '';
    780   return($IP);
     780  return $IP;
    781781}
    782782
    783783function GetRequestURI()
    784784{
    785   if(array_key_exists('REQUEST_URI', $_SERVER)) return($_SERVER['REQUEST_URI']);
    786     else return($_SERVER['PHP_SELF']);
    787 }
     785  if (array_key_exists('REQUEST_URI', $_SERVER)) return $_SERVER['REQUEST_URI'];
     786    else return $_SERVER['PHP_SELF'];
     787}
  • trunk/includes/MemoryStream.php

    r815 r880  
    2020    $Result = substr($this->Data, $this->Position, $Count);
    2121    $this->Position = $this->Position + $Count;
    22     return($Result);
     22    return $Result;
    2323  }
    2424
     
    2727    $Result = $this->Data[$this->Position];
    2828    $this->Position = $this->Position + 1;
    29     return($Result);
     29    return $Result;
    3030  }
    3131
     
    3434    $val = unpack('V*', substr($this->Data, $this->Position, 4));
    3535    $this->Position = $this->Position + 4;
    36     return($val[1]);
     36    return $val[1];
    3737  }
    3838
     
    4141    $val = unpack('I*', substr($this->Data, $this->Position, 4));
    4242    $this->Position = $this->Position + 4;
    43     return($val[1]);
     43    return $val[1];
    4444  }
    4545
     
    4848    $val = unpack('f*', substr($this->Data, $this->Position, 4));
    4949    $this->Position = $this->Position + 4;
    50     return($val[1]);
     50    return $val[1];
    5151  }
    5252
     
    5555    $Result = $this->Data[$this->Position];
    5656    $this->Position = $this->Position + 1;
    57     return($Result);
     57    return $Result;
    5858  }
    5959
     
    6262    $Length = 0;
    6363    $StartPosition = $this->Position;
    64     while(!$this->EOF())
     64    while (!$this->EOF())
    6565    {
    6666      $Char = $this->ReadChar();
    67       if($Char == $EndSymbol) break;
     67      if ($Char == $EndSymbol) break;
    6868    }
    6969    $Result = substr($this->Data, $StartPosition, $this->Position - $StartPosition);
    70     return($Result);
     70    return $Result;
    7171  }
    7272
     
    116116  public function GetPosition()
    117117  {
    118     return($this->Position);
     118    return $this->Position;
    119119  }
    120120
    121121  public function GetSize()
    122122  {
    123     return(strlen($this->Data));
     123    return strlen($this->Data);
    124124  }
    125125
    126126  public function SetSize($Size)
    127127  {
    128     return($this->Data = substr($this->Data, 0, $Size));
     128    return $this->Data = substr($this->Data, 0, $Size);
    129129  }
    130130
    131131  public function EOF()
    132132  {
    133     return($this->Position >= strlen($this->Data));
     133    return $this->Position >= strlen($this->Data);
    134134  }
    135135}
  • trunk/includes/PageEdit.php

    r838 r880  
    1616    );
    1717    $this->AllowEdit = false;
    18     if($this->AllowEdit) $this->ItemActions[] = array('Name' => T('Delete'), 'URL' => '?action=remove&amp;id=#Id');
     18    if ($this->AllowEdit) $this->ItemActions[] = array('Name' => T('Delete'), 'URL' => '?action=remove&amp;id=#Id');
    1919  }
    2020
     
    2222  {
    2323    $Output = '';
    24     if(array_key_exists('action', $_GET))
     24    if (array_key_exists('action', $_GET))
    2525    {
    26       if($_GET['action'] == 'add') $Output .= $this->AddItem();
    27       else if($_GET['action'] == 'view') $Output .= $this->ViewItem();
    28       else if($_GET['action'] == 'edit') $Output .= $this->ModifyItem();
    29       else if($_GET['action'] == 'remove') $Output .= $this->RemoveItem();
    30       else if($_GET['action'] == 'delete') $Output .= $this->DeleteItem();
     26      if ($_GET['action'] == 'add') $Output .= $this->AddItem();
     27      else if ($_GET['action'] == 'view') $Output .= $this->ViewItem();
     28      else if ($_GET['action'] == 'edit') $Output .= $this->ModifyItem();
     29      else if ($_GET['action'] == 'remove') $Output .= $this->RemoveItem();
     30      else if ($_GET['action'] == 'delete') $Output .= $this->DeleteItem();
    3131      else $Output .= ShowMessage(T('Unknown action'), MESSAGE_CRITICAL);
    3232    } else $Output .= $this->ViewList();
    33     return($Output);
     33    return $Output;
    3434  }
    3535
     
    3737  {
    3838    $DbResult = $this->Database->query('SELECT * FROM ('.$this->TableSQL.') AS `T` WHERE `Id`='.$_GET['id']);
    39     if($DbResult->num_rows > 0)
     39    if ($DbResult->num_rows > 0)
    4040    {
    4141      $DbRow = $DbResult->fetch_assoc();
     
    4343      $Output = T('Item').
    4444        '<table>';
    45       foreach($this->Definition as $DefIndex => $Def)
     45      foreach ($this->Definition as $DefIndex => $Def)
    4646      {
    4747        $Output .= '<tr><td>'.$Def['Title'].':</td><td>'.$this->ViewControl($Def['Type'], $DefIndex, $DbRow[$DefIndex]).'</tr>';
     
    5050        '</table>';
    5151    } else $Output = ShowMessage(T('Item not found'), MESSAGE_CRITICAL);
    52     if($this->AllowEdit)
     52    if ($this->AllowEdit)
    5353    {
    5454      $Output .= '<a href="?action=add">'.T('Add').'</a> ';
     
    5757    }
    5858    $Output .= '<a href="?">'.T('List').'</a><br/>';
    59     return($Output);
     59    return $Output;
    6060  }
    6161
     
    6969    $Output .= '<table class="BaseTable">';
    7070    $TableColumns = array();
    71     foreach($this->Definition as $Index => $Def)
    72       if($Def['InList'])
     71    foreach ($this->Definition as $Index => $Def)
     72      if ($Def['InList'])
    7373        $TableColumns[] = array('Name' => $Index, 'Title' => $Def['Title']);
    74     if(count($this->ItemActions) > 0)
     74    if (count($this->ItemActions) > 0)
    7575      $TableColumns[] = array('Name' => '', 'Title' => 'Akce');
    7676
     
    7979
    8080    $DbResult = $this->Database->query('SELECT * FROM ('.$this->Table.') '.$Order['SQL'].$PageList['SQLLimit']);
    81     while($Item = $DbResult->fetch_assoc())
     81    while ($Item = $DbResult->fetch_assoc())
    8282    {
    8383      $Output .= '<tr>';
    84       foreach($this->Definition as $Index => $Def)
    85       if($Def['InList'])
     84      foreach ($this->Definition as $Index => $Def)
     85      if ($Def['InList'])
    8686      {
    87         if($Def['Type'] == 'URL') $Output .= '<td><a href="'.$Item[$Index].'">'.$Item[$Index].'</a></td>';
     87        if ($Def['Type'] == 'URL') $Output .= '<td><a href="'.$Item[$Index].'">'.$Item[$Index].'</a></td>';
    8888          else $Output .= '<td>'.$Item[$Index].'</td>';
    8989      }
    90       if(count($this->ItemActions) > 0)
     90      if (count($this->ItemActions) > 0)
    9191      {
    9292        $Output .= '<td>';
    93         foreach($this->ItemActions as $Index => $Action)
     93        foreach ($this->ItemActions as $Index => $Action)
    9494        {
    9595          $URL = $Action['URL'];
    96           if(strpos($URL, '#Id')) $URL = str_replace('#Id', $Item['Id'], $URL);
     96          if (strpos($URL, '#Id')) $URL = str_replace('#Id', $Item['Id'], $URL);
    9797          $Output .= '<a href="'.$URL.'">'.$Action['Name'].'</a> ';
    9898        }
     
    102102    }
    103103    $Output .= '</table>';
    104     if($this->AllowEdit) $Output .= '<a href="?action=add">'.T('Add').'</a><br/>';
    105     return($Output);
     104    if ($this->AllowEdit) $Output .= '<a href="?action=add">'.T('Add').'</a><br/>';
     105    return $Output;
    106106  }
    107107
     
    109109  {
    110110    $Output = '';
    111     if($this->System->User->Licence(LICENCE_USER))
     111    if ($this->System->User->Licence(LICENCE_USER))
    112112    {
    113       if(array_key_exists('finish', $_GET))
     113      if (array_key_exists('finish', $_GET))
    114114      {
    115115        $Items = array();
    116         foreach($this->Definition as $Index => $Def)
     116        foreach ($this->Definition as $Index => $Def)
    117117        {
    118118          $Items[$Index] = $_POST[$Index];
     
    125125          '<fieldset><legend>'.T('New item').'</legend>'.
    126126          '<table>';
    127         foreach($this->Definition as $DefIndex => $Def)
     127        foreach ($this->Definition as $DefIndex => $Def)
    128128        {
    129129          $Output .= '<tr><td>'.$Def['Title'].':</td><td>'.$this->GetControl($Def['Type'], $DefIndex, '').'</tr>';
     
    135135      }
    136136    } else $Output .= ShowMessage(T('Access denied'), MESSAGE_CRITICAL);
    137     return($Output);
     137    return $Output;
    138138  }
    139139
    140140  function DeleteItem()
    141141  {
    142     if($this->System->User->Licence(LICENCE_USER))
     142    if ($this->System->User->Licence(LICENCE_USER))
    143143    {
    144144      $this->Database->query('DELETE FROM `'.$this->Table.'` WHERE (`User`='.$this->System->User->Id.') AND (`Id`='.($_GET['id'] * 1).')');
    145145      $Output = ShowMessage(T('Record removed'));
    146146    } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL);
    147     return($Output);
     147    return $Output;
    148148  }
    149149
    150150  function GetControl($Type, $Name, $Value)
    151151  {
    152     if($Type == 'Text') $Output = '<input type="text" name="'.$Name.'" value="'.$Value.'"/>';
    153     else if($Type == 'Boolean') $Output = '<input type="checkbox" name="'.$Name.'"/>';
     152    if ($Type == 'Text') $Output = '<input type="text" name="'.$Name.'" value="'.$Value.'"/>';
     153    else if ($Type == 'Boolean') $Output = '<input type="checkbox" name="'.$Name.'"/>';
    154154    else $Output = '<input type="text" name="'.$Name.'" value="'.$Value.'"/>';
    155     return($Output);
     155    return $Output;
    156156  }
    157157
    158158  function ViewControl($Type, $Name, $Value)
    159159  {
    160     if($Type == 'Text') $Output = $Value;
    161     else if($Type == 'URL') $Output = '<a href="'.$Value.'">'.$Value.'</a>';
    162     else if($Type == 'Boolean') $Output = $Value;
     160    if ($Type == 'Text') $Output = $Value;
     161    else if ($Type == 'URL') $Output = '<a href="'.$Value.'">'.$Value.'</a>';
     162    else if ($Type == 'Boolean') $Output = $Value;
    163163    else $Output = $Value;
    164     return($Output);
     164    return $Output;
    165165  }
    166166}
  • trunk/includes/dbc.php

    r815 r880  
    3535
    3636    $this->ColumnFormat = $ColumnFormat;
    37     if($this->ReadUint() != DBC_SIGNATURE) die(NOT_DBC_FILE);
     37    if ($this->ReadUint() != DBC_SIGNATURE) die(NOT_DBC_FILE);
    3838
    3939    $this->RecordCount = $this->ReadUint();
     
    4343
    4444    $this->GenerateOffsetTable();
    45     if($this->EndOffset != $this->RecordSize)
     45    if ($this->EndOffset != $this->RecordSize)
    4646    die(RECORD_SIZE_NOT_MATCH.$this->EndOffset.' <> '.$this->RecordSize);
    4747  }
     
    7171  {
    7272    // Preallocate array
    73     if($this->FieldCount > 0) $this->Offsets = array_fill(0, $this->FieldCount, 0);
     73    if ($this->FieldCount > 0) $this->Offsets = array_fill(0, $this->FieldCount, 0);
    7474      else $this->Offsets = array();
    7575
    7676    $Offset = 0;
    7777    $I = 0;
    78     while($I < $this->FieldCount)
     78    while ($I < $this->FieldCount)
    7979    {
    8080      $this->Offsets[$I] = $Offset;
    81       if(array_key_exists($I, $this->ColumnFormat)) $Format = $this->ColumnFormat[$I];
     81      if (array_key_exists($I, $this->ColumnFormat)) $Format = $this->ColumnFormat[$I];
    8282        else $Format = FORMAT_UINT32;
    83       switch($Format)
     83      switch ($Format)
    8484      {
    8585        case FORMAT_BYTE:
     
    100100  private function CellPos($Row, $Column)
    101101  {
    102     return($this->HeaderSize + $Row * $this->RecordSize + $this->Offsets[$Column]);
     102    return $this->HeaderSize + $Row * $this->RecordSize + $this->Offsets[$Column];
    103103  }
    104104
     
    106106  {
    107107    $this->SetPosition($this->CellPos($Row, $Column));
    108     return($this->ReadByte());
     108    return $this->ReadByte();
    109109  }
    110110
     
    112112  {
    113113    $this->SetPosition($this->CellPos($Row, $Column));
    114     return($this->ReadUint());
     114    return $this->ReadUint();
    115115  }
    116116
     
    118118  {
    119119    $this->SetPosition($this->CellPos($Row, $Column));
    120     return($this->ReadInt());
     120    return $this->ReadInt();
    121121  }
    122122
     
    124124  {
    125125    $this->SetPosition($this->CellPos($Row, $Column));
    126     return($this->ReadFloat());
     126    return $this->ReadFloat();
    127127  }
    128128
     
    156156
    157157    $Position = $this->HeaderSize + $this->RecordCount * $this->RecordSize + $Offset;
    158     if($Position >= $this->GetSize()) return('');
     158    if ($Position >= $this->GetSize()) return '';
    159159    $this->SetPosition($Position);
    160160
    161161    $String = '';
    162     while(($Char = $this->ReadChar()) != "\0")
     162    while (($Char = $this->ReadChar()) != "\0")
    163163    {
    164164      $String .= $Char;
    165165    }
    166     return($String);
     166    return $String;
    167167  }
    168168
    169169  public function SetString($Row, $Column, $Value)
    170170  {
    171     if(in_array($Value, $this->StringList))
     171    if (in_array($Value, $this->StringList))
    172172    {
    173173      $this->SetUint($Row, $Column, $this->StringListOffset[array_search($Value, $this->StringList)]);
     
    192192    $this->SetPosition($this->HeaderSize + $this->RecordCount * $this->RecordSize);
    193193    $this->WriteByte(0);
    194     foreach($this->StringList as $Index => $Item)
     194    foreach ($this->StringList as $Index => $Item)
    195195    {
    196196      $this->WriteString($Item."\0");
     
    206206
    207207    // Preallocate array
    208     if($this->FieldCount > 0) $Line = array_fill(0, $this->FieldCount, 0);
     208    if ($this->FieldCount > 0) $Line = array_fill(0, $this->FieldCount, 0);
    209209      else $Line = array();
    210     for($I = 0; $I < $this->FieldCount; $I++)
    211     {
    212       if(array_key_exists($I, $this->ColumnFormat)) $Format = $this->ColumnFormat[$I];
     210    for ($I = 0; $I < $this->FieldCount; $I++)
     211    {
     212      if (array_key_exists($I, $this->ColumnFormat)) $Format = $this->ColumnFormat[$I];
    213213        else $Format = FORMAT_UINT32;
    214214      $Record->SetPosition($this->Offsets[$I]);
    215       switch($Format)
     215      switch ($Format)
    216216      {
    217217        case FORMAT_BYTE:
     
    231231
    232232          $Position = $this->HeaderSize + $this->RecordCount * $this->RecordSize + $Offset;
    233           if($Position >= $this->GetSize()) $String = '';
     233          if ($Position >= $this->GetSize()) $String = '';
    234234          else
    235235          {
    236236            $this->SetPosition($Position);
    237237            $String = '';
    238             while(($Char = $this->ReadChar()) != "\0")
     238            while (($Char = $this->ReadChar()) != "\0")
    239239              $String .= $Char;
    240240          }
     
    245245      }
    246246    }
    247     return($Line);
     247    return $Line;
    248248  }
    249249
     
    253253    $Record = new MemoryStream();
    254254
    255     for($I = 0; $I < $this->FieldCount; $I++)
    256     {
    257       if(array_key_exists($I, $this->ColumnFormat)) $Format = $this->ColumnFormat[$I];
     255    for ($I = 0; $I < $this->FieldCount; $I++)
     256    {
     257      if (array_key_exists($I, $this->ColumnFormat)) $Format = $this->ColumnFormat[$I];
    258258        else $Format = FORMAT_UINT32;
    259259      $Record->SetPosition($this->Offsets[$I]);
    260       switch($Format)
     260      switch ($Format)
    261261      {
    262262        case FORMAT_BYTE:
     
    273273          break;
    274274        case FORMAT_STRING:
    275           if(in_array($Line[$I], $this->StringList))
     275          if (in_array($Line[$I], $this->StringList))
    276276          {
    277277            $Record->WriteUint($this->StringListOffset[array_search($Line[$I], $this->StringList)]);
     
    291291    $this->SetPosition($this->CellPos($Row, 0));
    292292    $this->WriteBlock($Record->Data, $this->RecordSize);
    293     return($Line);
     293    return $Line;
    294294  }
    295295
    296296  public function GetRecordCount()
    297297  {
    298     return($this->RecordCount);
     298    return $this->RecordCount;
    299299  }
    300300
     
    306306  public function GetFieldCount()
    307307  {
    308     return($this->FieldCount);
     308    return $this->FieldCount;
    309309  }
    310310
Note: See TracChangeset for help on using the changeset viewer.