Changeset 874 for trunk/Packages/Common


Ignore:
Timestamp:
Apr 6, 2020, 11:56:19 PM (5 years ago)
Author:
chronos
Message:
  • Modified: Do not use parenthesis around returned value.
Location:
trunk/Packages/Common
Files:
16 edited

Legend:

Unmodified
Added
Removed
  • trunk/Packages/Common/AppModule.php

    r873 r874  
    315315  function ModulePresent($Name)
    316316  {
    317     return (array_key_exists($Name, $this->Modules));
     317    return array_key_exists($Name, $this->Modules);
    318318  }
    319319
    320320  function ModuleEnabled($Name)
    321321  {
    322     return (array_key_exists($Name, $this->Modules) and $this->Modules[$Name]->Enabled);
     322    return array_key_exists($Name, $this->Modules) and $this->Modules[$Name]->Enabled;
    323323  }
    324324
    325325  function ModuleRunning($Name)
    326326  {
    327     return (array_key_exists($Name, $this->Modules) and $this->Modules[$Name]->Running);
     327    return array_key_exists($Name, $this->Modules) and $this->Modules[$Name]->Running;
    328328  }
    329329
     
    334334    {
    335335      //DebugLog($Module->Name.' '.$Module->Id);
    336       if ($Module->Id == $Id) return ($Module->Name);
    337     }
    338     return ('');
     336      if ($Module->Id == $Id) return $Module->Name;
     337    }
     338    return '';
    339339  }
    340340
  • trunk/Packages/Common/Common.php

    r873 r874  
    125125    $this->SQLLimit = ' LIMIT '.$CurrentPage * $ItemPerPage.', '.$ItemPerPage;
    126126    $this->Page = $CurrentPage;
    127     return ($Result);
     127    return $Result;
    128128  }
    129129}
  • trunk/Packages/Common/Config.php

    r873 r874  
    1919      $Data = &$Data[$Item];
    2020    }
    21     return ($Data[$Last]);
     21    return $Data[$Last];
    2222  }
    2323
     
    5252  function GetAsArray()
    5353  {
    54     return ($this->Data);
     54    return $this->Data;
    5555  }
    5656}
  • trunk/Packages/Common/Database.php

    r873 r874  
    77{
    88  list($usec, $sec) = explode(" ", microtime());
    9   return ((float)$usec + (float)$sec);
     9  return (float)$usec + (float)$sec;
    1010}
    1111
     
    1717  function fetch_assoc()
    1818  {
    19     return ($this->PDOStatement->fetch(PDO::FETCH_ASSOC));
     19    return $this->PDOStatement->fetch(PDO::FETCH_ASSOC);
    2020  }
    2121
    2222  function fetch_array()
    2323  {
    24     return ($this->PDOStatement->fetch(PDO::FETCH_BOTH));
     24    return $this->PDOStatement->fetch(PDO::FETCH_BOTH);
    2525  }
    2626
    2727  function fetch_row()
    2828  {
    29     return ($this->PDOStatement->fetch(PDO::FETCH_NUM));
     29    return $this->PDOStatement->fetch(PDO::FETCH_NUM);
    3030  }
    3131}
     
    8181  function Connected()
    8282  {
    83     return (isset($this->PDO));
     83    return isset($this->PDO);
    8484  }
    8585
     
    119119        throw new Exception('SQL Error: '.$this->Error.', Query: '.$Query);
    120120    }
    121     return ($Result);
     121    return $Result;
    122122  }
    123123
    124124  function select($Table, $What = '*', $Condition = 1)
    125125  {
    126     return ($this->query('SELECT '.$What.' FROM `'.$this->Prefix.$Table.'` WHERE '.$Condition));
     126    return $this->query('SELECT '.$What.' FROM `'.$this->Prefix.$Table.'` WHERE '.$Condition);
    127127  }
    128128
     
    154154    $Name = substr($Name, 1);
    155155    $Values = substr($Values, 1);
    156     return ('INSERT INTO `'.$this->Prefix.$Table.'` ('.$Name.') VALUES('.$Values.')');
     156    return 'INSERT INTO `'.$this->Prefix.$Table.'` ('.$Name.') VALUES('.$Values.')';
    157157  }
    158158
     
    175175    }
    176176    $Values = substr($Values, 2);
    177     return ('UPDATE `'.$this->Prefix.$Table.'` SET '.$Values.' WHERE ('.$Condition.')');
     177    return 'UPDATE `'.$this->Prefix.$Table.'` SET '.$Values.' WHERE ('.$Condition.')';
    178178  }
    179179
     
    206206  function real_escape_string($Text)
    207207  {
    208     return (addslashes($Text));
     208    return addslashes($Text);
    209209  }
    210210
    211211  function quote($Text)
    212212  {
    213     return ($this->PDO->quote($Text));
     213    return $this->PDO->quote($Text);
    214214  }
    215215
     
    239239function TimeToMysqlDateTime($Time)
    240240{
    241   if ($Time == NULL) return (NULL);
    242     else return (date('Y-m-d H:i:s', $Time));
     241  if ($Time == NULL) return NULL;
     242    else return date('Y-m-d H:i:s', $Time);
    243243}
    244244
    245245function TimeToMysqlDate($Time)
    246246{
    247   if ($Time == NULL) return (NULL);
    248     else return (date('Y-m-d', $Time));
     247  if ($Time == NULL) return NULL;
     248    else return date('Y-m-d', $Time);
    249249}
    250250
    251251function TimeToMysqlTime($Time)
    252252{
    253   if ($Time == NULL) return (NULL);
    254     else return (date('H:i:s', $Time));
     253  if ($Time == NULL) return NULL;
     254    else return date('H:i:s', $Time);
    255255}
    256256
    257257function MysqlDateTimeToTime($DateTime)
    258258{
    259   if ($DateTime == '') return (NULL);
     259  if ($DateTime == '') return NULL;
    260260  $Parts = explode(' ', $DateTime);
    261261  $DateParts = explode('-', $Parts[0]);
    262262  $TimeParts = explode(':', $Parts[1]);
    263263  $Result = mktime($TimeParts[0], $TimeParts[1], $TimeParts[2], $DateParts[1], $DateParts[2], $DateParts[0]);
    264   return ($Result);
     264  return $Result;
    265265}
    266266
    267267function MysqlDateToTime($Date)
    268268{
    269   if ($Date == '') return (NULL);
    270   return (MysqlDateTimeToTime($Date.' 0:0:0'));
     269  if ($Date == '') return NULL;
     270  return MysqlDateTimeToTime($Date.' 0:0:0');
    271271}
    272272
    273273function MysqlTimeToTime($Time)
    274274{
    275   if ($Time == '') return (NULL);
    276   return (MysqlDateTimeToTime('0000-00-00 '.$Time));
    277 }
     275  if ($Time == '') return NULL;
     276  return MysqlDateTimeToTime('0000-00-00 '.$Time);
     277}
  • trunk/Packages/Common/Image.php

    r873 r874  
    112112  function GetWidth()
    113113  {
    114     return (imagesx($this->Image));
     114    return imagesx($this->Image);
    115115  }
    116116
    117117  function GetHeight()
    118118  {
    119     return (imagesy($this->Image));
     119    return imagesy($this->Image);
    120120  }
    121121
     
    127127  function ConvertColor($Color)
    128128  {
    129     return (imagecolorallocate($this->Image, ($Color >> 16) & 0xff, ($Color >> 8) & 0xff, $Color & 0xff));
     129    return imagecolorallocate($this->Image, ($Color >> 16) & 0xff, ($Color >> 8) & 0xff, $Color & 0xff);
    130130  }
    131131
  • trunk/Packages/Common/Locale.php

    r873 r874  
    2121  {
    2222    if (array_key_exists($Text, $this->Data[$Group]) and ($this->Data[$Group][$Text] != ''))
    23       return ($this->Data[$Group][$Text]);
    24       else return ($Text);
     23      return $this->Data[$Group][$Text];
     24      else return $Text;
    2525  }
    2626
     
    2828  {
    2929    $Key = array_search($Text, $this->Data[$Group]);
    30     if (($Key === FALSE) or ($this->Data[$Group][$Key] == '')) return ($Text);
    31       else return ($Key);
     30    if (($Key === FALSE) or ($this->Data[$Group][$Key] == '')) return $Text;
     31      else return $Key;
    3232  }
    3333}
     
    245245  global $GlobalLocaleManager;
    246246
    247   if (isset($GlobalLocaleManager)) return ($GlobalLocaleManager->CurrentLocale->Texts->Translate($Text, $Group));
    248     else return ($Text);
    249 }
     247  if (isset($GlobalLocaleManager)) return $GlobalLocaleManager->CurrentLocale->Texts->Translate($Text, $Group);
     248    else return $Text;
     249}
  • trunk/Packages/Common/Mail.php

    r873 r874  
    7474  function Priority($Priority)
    7575  {
    76     if (!intval($Priority)) return (false);
    77 
    78     if (!isset($this->priorities[$Priority - 1])) return (false);
     76    if (!intval($Priority)) return false;
     77
     78    if (!isset($this->priorities[$Priority - 1])) return false;
    7979
    8080    $this->xheaders['X-Priority'] = $this->priorities[$Priority - 1];
    81     return (true);
     81    return true;
    8282  }
    8383
     
    146146
    147147    $res = mail($To, $this->Subject, $Body, $Headers);
    148     return ($res);
     148    return $res;
    149149  }
    150150
     
    153153    if (ereg(".*<(.+)>", $Address, $regs)) $Address = $regs[1];
    154154    if (ereg("^[^@  ]+@([a-zA-Z0-9\-]+\.)+([a-zA-Z0-9\-]{2}|net|com|gov|mil|org|edu|int)\$", $Address))
    155       return (true);
    156       else return (false);
     155      return true;
     156      else return false;
    157157  }
    158158
     
    168168  private function ContentEncoding($Charset)
    169169  {
    170     if ($Charset != CHARSET_ASCII) return ('8bit');
    171       else return ('7bit');
     170    if ($Charset != CHARSET_ASCII) return '8bit';
     171      else return '7bit';
    172172  }
    173173
     
    203203      }
    204204    } else $Result = $Body;
    205     return ($Result);
     205    return $Result;
    206206  }
    207207
     
    227227        "\nContent-Transfer-Encoding: ".$this->ContentEncoding($Body['Charset'])."\n\n".$Body['Content']."\n";
    228228    }
    229     return ($Result);
     229    return $Result;
    230230  }
    231231}
  • trunk/Packages/Common/NetworkAddress.php

    r873 r874  
    1616  function GetNetMask()
    1717  {
    18     return (((1 << IPV4_BIT_WIDTH) - 1) ^ ((1 << (IPV4_BIT_WIDTH - $this->Prefix)) - 1));
     18    return ((1 << IPV4_BIT_WIDTH) - 1) ^ ((1 << (IPV4_BIT_WIDTH - $this->Prefix)) - 1);
    1919  }
    2020
    2121  function AddressToString()
    2222  {
    23     return (implode('.', array(($this->Address >> 24) & 255, ($this->Address >> 16) & 255, ($this->Address >> 8) & 255, ($this->Address & 255))));
     23    return implode('.', array(($this->Address >> 24) & 255, ($this->Address >> 16) & 255, ($this->Address >> 8) & 255, ($this->Address & 255)));
    2424  }
    2525
     
    3939    $To->Address = $From->Address + $HostMask;
    4040    $To->Prefix = IPV4_BIT_WIDTH;
    41     return (array('From' => $From, 'To' => $To));
     41    return array('From' => $From, 'To' => $To);
    4242  }
    4343
     
    5555    if (($this->Prefix < $Address->Prefix) and (($Address->Address & $UpperNetmask) == ($this->Address & $UpperNetmask))) $Result = true;
    5656      else $Result = false;
    57     return ($Result);
     57    return $Result;
    5858  }
    5959}
     
    7474  function GetNetMask()
    7575  {
    76     return (Int128Xor(Int128Sub(Int128Shl(IntToInt128(1), IntToInt128(IPV6_BIT_WIDTH)), IntToInt128(1)),
    77       Int128Sub(Int128Shl(IntToInt128(1), IntToInt128(IPV6_BIT_WIDTH - $this->Prefix)), IntToInt128(1))));
     76    return Int128Xor(Int128Sub(Int128Shl(IntToInt128(1), IntToInt128(IPV6_BIT_WIDTH)), IntToInt128(1)),
     77      Int128Sub(Int128Shl(IntToInt128(1), IntToInt128(IPV6_BIT_WIDTH - $this->Prefix)), IntToInt128(1)));
    7878  }
    7979
    8080  function AddressToString()
    8181  {
    82     return (inet_ntop($this->Address));
     82    return inet_ntop($this->Address);
    8383  }
    8484
     
    106106      $Result[] = dechex(($Item >> 4) & 15);
    107107    }
    108     return ($Result);
     108    return $Result;
    109109  }
    110110
     
    129129    if (($this->Prefix < $Address->Prefix) and ((Int128Equal(Int128And($Address->Address, $UpperNetmask), Int128And($this->Address, $UpperNetmask))))) $Result = true;
    130130      else $Result = false;
    131     return ($Result);
     131    return $Result;
    132132  }
    133133}
  • trunk/Packages/Common/Page.php

    r873 r874  
    2020  function Show()
    2121  {
    22     return ('');
     22    return '';
    2323  }
    2424
     
    2626  {
    2727    $Output = $this->Show();
    28     return ($Output);
     28    return $Output;
    2929  }
    3030
    3131  function SystemMessage($Title, $Text)
    3232  {
    33     return (call_user_func_array($this->OnSystemMessage, array($Title, $Text)));
     33    return call_user_func_array($this->OnSystemMessage, array($Title, $Text));
    3434  }
    3535}
  • trunk/Packages/Common/PrefixMultiplier.php

    r873 r874  
    8484      }
    8585    }
    86     return ($Value);
     86    return $Value;
    8787  }
    8888
     
    9494    $Value = abs($Value);
    9595    if (($Unit == '') and ($PrefixType != 'Time'))
    96       return ($this->TruncateDigits($Value, $Digits));
     96      return $this->TruncateDigits($Value, $Digits);
    9797
    9898    $I = $PrefixMultipliers[$PrefixType]['BaseIndex'];
    99     if ($Value == 0) return ($Value.' '.$PrefixMultipliers[$PrefixType]['Definition'][$I][0].$Unit);
     99    if ($Value == 0) return $Value.' '.$PrefixMultipliers[$PrefixType]['Definition'][$I][0].$Unit;
    100100
    101101    if ($Value > 1)
     
    114114    $Value = $this->TruncateDigits($Value, $Digits);
    115115    if ($Negative) $Value = -$Value;
    116     return ($Value.' '.$PrefixMultipliers[$PrefixType]['Definition'][$I][0].$Unit);
     116    return $Value.' '.$PrefixMultipliers[$PrefixType]['Definition'][$I][0].$Unit;
    117117  }
    118118}
  • trunk/Packages/Common/Process.php

    r873 r874  
    4747  function IsRunning()
    4848  {
    49     return (is_resource($this->Handle));
     49    return is_resource($this->Handle);
    5050  }
    5151}
  • trunk/Packages/Common/RSS.php

    r873 r874  
    3939    $Result .= "  </channel>\n".
    4040    "</rss>";
    41     return ($Result);
     41    return $Result;
    4242  }
    4343}
  • trunk/Packages/Common/Setup.php

    r873 r874  
    2929      '<input type="submit" name="login" value="'.T('Login').'"/>'.
    3030      '</form>';
    31     return ($Output);
     31    return $Output;
    3232  }
    3333
     
    5959    $Output .= '<a href="'.$this->System->Link('/').'">'.T('Go to main page').'</a> ';
    6060    $Output .= '';
    61     return ($Output);
     61    return $Output;
    6262  }
    6363
     
    160160      }
    161161    }
    162     return ($Output);
     162    return $Output;
    163163  }
    164164
     
    200200    $Output .= '<h3>Správa modulů</h3>';
    201201    $Output .= $this->ShowList();
    202     return ($Output);
     202    return $Output;
    203203  }
    204204
     
    244244    $Output .= $Pageing->Show();
    245245    //$Output .= '<p><a href="?A=SaveToDb">Uložit do databáze</a></p>';
    246     return ($Output);
     246    return $Output;
    247247  }
    248248
     
    281281        '</table>'.
    282282        '</form>';
    283     return ($Output);
     283    return $Output;
    284284  }
    285285
     
    319319    file_put_contents($this->ConfigDir.'/Config.php', $ConfigText);
    320320    $Output = 'Konfigurace nastavena<br/>';
    321     return ($Output);
     321    return $Output;
    322322  }
    323323
     
    353353    }
    354354    $Output .= "\n\n";
    355     return ($Output);
     355    return $Output;
    356356  }
    357357}
     
    371371    }
    372372    $Output .= sprintf(T('Front page was not configured. Continue to %s'), '<a href="'.$this->System->Link('/setup/').'">'.T('setup').'</a>');
    373     return ($Output);
     373    return $Output;
    374374  }
    375375}
     
    402402  function CheckState()
    403403  {
    404     return ($this->Database->Connected() and $this->UpdateManager->IsInstalled() and
    405       $this->UpdateManager->IsUpToDate());
     404    return $this->Database->Connected() and $this->UpdateManager->IsInstalled() and
     405      $this->UpdateManager->IsUpToDate();
    406406  }
    407407
     
    435435  {
    436436    $DbResult = $this->Database->query('SHOW TABLES LIKE "'.$this->UpdateManager->VersionTable.'"');
    437     return ($DbResult->num_rows > 0);
     437    return $DbResult->num_rows > 0;
    438438  }
    439439
     
    443443    $this->UpdateManager->Trace = $Updates->Get();
    444444    $Output = $this->UpdateManager->Upgrade();
    445     return ($Output);
     445    return $Output;
    446446  }
    447447}
  • trunk/Packages/Common/Table.php

    r873 r874  
    77  function Show()
    88  {
    9     return ('');
     9    return '';
    1010  }
    1111}
     
    1515  function GetCell($Y, $X)
    1616  {
    17     return ('');
     17    return '';
    1818  }
    1919
     
    2828  function RowsCount()
    2929  {
    30     return (0);
     30    return 0;
    3131  }
    3232}
     
    3838  function GetCell($Y, $X)
    3939  {
    40     return ($this->Cells[$Y][$X]);
     40    return $this->Cells[$Y][$X];
    4141  }
    4242
    4343  function RowsCount()
    4444  {
    45     return (count($this->Cells));
     45    return count($this->Cells);
    4646  }
    4747}
     
    5555  function GetCell($Y, $X)
    5656  {
    57     return ($this->Cells[$Y][$X]);
     57    return $this->Cells[$Y][$X];
    5858  }
    5959
     
    7575  function RowsCount()
    7676  {
    77     return (count($this->Cells));
     77    return count($this->Cells);
    7878  }
    7979}
     
    145145    $this->Table->EndRead();
    146146    $Output .= '</table>';
    147     return ($Output);
     147    return $Output;
    148148  }
    149149
     
    190190    $this->OrderDirection = $_SESSION['OrderDir'];
    191191
    192     return ('<tr>'.$Result.'</tr>');
     192    return '<tr>'.$Result.'</tr>';
    193193  }
    194194}
  • trunk/Packages/Common/UTF8.php

    r873 r874  
    537537       }
    538538    }
    539     return ($Result);
     539    return $Result;
    540540  }
    541541
     
    561561      }
    562562    }
    563     return ($Result);
     563    return $Result;
    564564  }
    565565}
  • trunk/Packages/Common/Update.php

    r873 r874  
    2323    $DbResult = $this->Database->select($this->VersionTable, '*', 'Id=1');
    2424    $Version = $DbResult->fetch_assoc();
    25     return ($Version['Revision']);
     25    return $Version['Revision'];
    2626  }
    2727
     
    2929  {
    3030    $DbResult = $this->Database->query('SHOW TABLES LIKE "'.$this->VersionTable.'"');
    31     return ($DbResult->num_rows > 0);
     31    return $DbResult->num_rows > 0;
    3232  }
    3333
    3434  function IsUpToDate()
    3535  {
    36     return ($this->Revision <= $this->GetDbVersion());
     36    return $this->Revision <= $this->GetDbVersion();
    3737  }
    3838
     
    5656        $TraceItem['Revision'].' WHERE `Id`=1');
    5757    }
    58     return ($Output);
     58    return $Output;
    5959  }
    6060
     
    8181    echo($Query.';<br/>');
    8282    flush();
    83     return ($this->Database->query($Query));
     83    return $this->Database->query($Query);
    8484  }
    8585}
Note: See TracChangeset for help on using the changeset viewer.