Ignore:
Timestamp:
Apr 6, 2020, 11:56:19 PM (4 years ago)
Author:
chronos
Message:
  • Modified: Do not use parenthesis around returned value.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Common/Global.php

    r873 r874  
    3030    $UnitIndex++;
    3131  }
    32   return ($Value.' '.$UnitNames[$UnitIndex]);
     32  return $Value.' '.$UnitNames[$UnitIndex];
    3333}
    3434
     
    3636{
    3737  list($Usec, $Sec) = explode(' ', microtime());
    38   return ((float)$Usec + (float)$Sec);
     38  return (float)$Usec + (float)$Sec;
    3939}
    4040
     
    4848function HumanDate($Time)
    4949{
    50   if ($Time != '') {
     50  if ($Time != '')
     51  {
    5152    $Date = explode(' ', $Time);
    5253    $Parts = explode('-', $Date[0]);
    53     if ($Date != '0000-00-00') return (($Parts[2]*1).'.'.($Parts[1]*1).'.'.$Parts[0]);
    54     else return (' ');
    55   } else return (' ');
     54    if ($Date != '0000-00-00') return ($Parts[2] * 1).'.'.($Parts[1] * 1).'.'.$Parts[0];
     55    else return ' ';
     56  } else return ' ';
    5657}
    5758
     
    6263  $Around = 10;
    6364  $Result = '';
    64   if ($Count>1)
    65   {
    66     if ($Page>0)
     65  if ($Count > 1)
     66  {
     67    if ($Page > 0)
    6768    {
    6869      $Result.= '<a href="'.$URL.'0">&lt;&lt;</a> ';
    69       $Result.= '<a href="'.$URL.($Page-1).'">&lt;</a> ';
    70     }
    71     $PagesMax = $Count-1;
     70      $Result.= '<a href="'.$URL.($Page - 1).'">&lt;</a> ';
     71    }
     72    $PagesMax = $Count - 1;
    7273    $PagesMin = 0;
    73     if ($PagesMax>($Page+$Around)) $PagesMax = $Page+$Around;
    74     if ($PagesMin<($Page-$Around))
     74    if ($PagesMax > ($Page + $Around)) $PagesMax = $Page + $Around;
     75    if ($PagesMin < ($Page - $Around))
    7576    {
    7677      $Result.= ' .. ';
    77       $PagesMin = $Page-$Around;
    78     }
    79     for ($i=$PagesMin;$i<=$PagesMax;$i++)
    80     {
    81       if ($i==$Page) $Result.= '<strong>';
    82       $Result.= '<a href="'.$URL.$i.'">'.($i+1).'</a> ';
    83       if ($i==$Page) $Result.= '</strong>';
    84     }
    85     if ($PagesMax<($Count-1)) $Result .= ' .. ';
    86     if ($Page<($Count-1))
    87     {
    88       $Result.= '<a href="'.$URL.($Page+1).'">&gt;</a> ';
    89       $Result.= '<a href="'.$URL.($Count-1).'">&gt;&gt;</a>';
    90     }
    91   }
    92   return ($Result);
     78      $PagesMin = $Page - $Around;
     79    }
     80    for ($i = $PagesMin; $i <= $PagesMax; $i++)
     81    {
     82      if ($i == $Page) $Result.= '<strong>';
     83      $Result .= '<a href="'.$URL.$i.'">'.($i + 1).'</a> ';
     84      if ($i == $Page) $Result.= '</strong>';
     85    }
     86    if ($PagesMax < ($Count - 1)) $Result .= ' .. ';
     87    if ($Page < ($Count - 1))
     88    {
     89      $Result .= '<a href="'.$URL.($Page + 1).'">&gt;</a> ';
     90      $Result .= '<a href="'.$URL.($Count - 1).'">&gt;&gt;</a>';
     91    }
     92  }
     93  return $Result;
    9394}
    9495
    9596function ExtractTime($Time)
    9697{
    97   return (array(
     98  return array(
    9899    'Year' => date('Y', $Time),
    99100    'Month' => date('n', $Time),
     
    102103    'Minute' => date('i', $Time),
    103104    'Second' => date('s', $Time)
    104   ));
     105  );
    105106}
    106107
     
    118119    }
    119120  }
    120   return ($Result);
     121  return $Result;
    121122}
    122123
     
    128129    $Parts[] = $Index.'='.$Item;
    129130  }
    130   return (implode('&amp;', $Parts));
     131  return implode('&amp;', $Parts);
    131132}
    132133
     
    199200
    200201  $Result = '<div style="text-align: center">'.$Result.'</div>';
    201   return (array('SQLLimit' => ' LIMIT '.$CurrentPage * $ItemPerPage.', '.$ItemPerPage,
     202  return array('SQLLimit' => ' LIMIT '.$CurrentPage * $ItemPerPage.', '.$ItemPerPage,
    202203    'Page' => $CurrentPage,
    203204    'Output' => $Result,
    204   ));
     205  );
    205206}
    206207
     
    253254      else $Result .= '<th><a href="?'.SetQueryStringArray($QueryItems).'">'.$Column['Title'].$ArrowImage.'</a></th>';
    254255  }
    255   return (array(
     256  return array(
    256257    'SQL' => ' ORDER BY `'.$_SESSION[$ObjectName.'OrderCol'].'` '.$OrderDirSQL[$_SESSION[$ObjectName.'OrderDir']],
    257258    'Output' => '<tr>'.$Result.'</tr>',
    258259    'Column' => $_SESSION[$ObjectName.'OrderCol'],
    259260    'Direction' => $_SESSION[$ObjectName.'OrderDir'],
    260   ));
     261  );
    261262}
    262263
     
    265266  if (array_key_exists('REMOTE_ADDR', $_SERVER)) $IP = $_SERVER['REMOTE_ADDR'];
    266267  else $IP = '0.0.0.0';
    267   return ($IP);
     268  return $IP;
    268269}
    269270
     
    282283    }
    283284  }
    284   return ($Result);
     285  return $Result;
    285286}
    286287
     
    295296  {
    296297    $DbRow = $DbResult->fetch_assoc();
    297     return ($DbRow['Id']);
    298   } else return ('');
     298    return $DbRow['Id'];
     299  } else return '';
    299300}
    300301
     
    302303{
    303304  $Result = shell_exec('which '.$Command);
    304   return (!empty($Result));
     305  return !empty($Result);
    305306}
    306307
    307308function RemoveDiacritic($Text)
    308309{
    309   return (str_replace(
     310  return str_replace(
    310311    array('á', 'č', 'ď', 'é', 'ě', 'í', 'ľ', 'ň', 'ó', 'ř', 'š', 'ť', 'ú', 'ů',
    311312      'ý', 'ž', 'Á', 'Č', 'Ď', 'É', 'Ě', 'Í', 'Ľ', 'Ň', 'Ó', 'Ř', 'Š', 'Ť', 'Ú', 'Ů', 'Ý', 'Ž'),
    312313    array('a', 'c', 'd', 'e', 'e', 'i', 'l', 'n', 'o', 'r', 's', 't', 'u', 'u',
    313314      'y', 'z', 'A', 'C', 'D', 'E', 'E', 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U', 'U', 'Y', 'Z'),
    314     $Text));
     315    $Text);
    315316}
    316317
    317318function RouterOSIdent($Name)
    318319{
    319   return (strtr(strtolower(trim($Name)), array(' ' => '-', '.' => '', '(' => '-', ')' => '-', ',' => '-',
     320  return strtr(strtolower(trim($Name)), array(' ' => '-', '.' => '', '(' => '-', ')' => '-', ',' => '-',
    320321  'č' => 'c', 'š' => 's', 'ě' => 'e', 'ř' => 'r', 'ž' => 'z', 'ý' => 'y',
    321322  'á' => 'a', 'í' => 'i', 'é' => 'e', 'ů' => 'u', 'ú' => 'u', 'ď' => 'd',
     
    324325  'Á' => 'a', 'Í' => 'i', 'É' => 'e', 'Ů' => 'u', 'Ú' => 'u', 'Ď' => 'd',
    325326  'Ť' => 't', 'Ň' => 'n', 'Ó' => 'o',
    326 )));
     327  ));
    327328}
    328329
    329330function NotBlank($Text)
    330331{
    331   if ($Text == '') return ('&nbsp');
    332     else return ($Text);
     332  if ($Text == '') return '&nbsp';
     333    else return $Text;
    333334}
    334335
     
    361362    else $_SERVER['QUERY_STRING'] = '';
    362363  parse_str($_SERVER['QUERY_STRING'], $_GET);
    363   return ($PathItems);
     364  return $PathItems;
    364365}
    365366
Note: See TracChangeset for help on using the changeset viewer.