Changeset 7 for trunk/Global.php


Ignore:
Timestamp:
Apr 14, 2020, 11:13:32 PM (5 years ago)
Author:
chronos
Message:
  • Modified: Improved code formatting.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Global.php

    r1 r7  
    33function HumanDate($Time)
    44{
    5   return(date('j.n.Y', $Time));
     5  return date('j.n.Y', $Time);
    66}
    77
     
    99{
    1010  list($Usec, $Sec) = explode(" ", microtime());
    11   return ((float)$Usec + (float)$Sec);
     11  return (float)$Usec + (float)$Sec;
    1212}
    1313
    1414function MakeLink($Target, $Title)
    1515{
    16   return('<a href="'.$Target.'">'.$Title.'</a>');
     16  return '<a href="'.$Target.'">'.$Title.'</a>';
    1717}
    1818
     
    2121  $Result = '<table cellspacing="0" class="BasicTable">';
    2222  $Result .= '<tr>';
    23   foreach($Table['Header'] as $Item)
     23  foreach ($Table['Header'] as $Item)
    2424    $Result .= '<th>'.$Item.'</th>';
    2525  $Result .= '</tr>';
    26   foreach($Table['Rows'] as $Row)
     26  foreach ($Table['Rows'] as $Row)
    2727  {
    2828    $Result .= '<tr>';
    29     foreach($Row as $Item)
     29    foreach ($Row as $Item)
    3030      $Result .= '<td>'.$Item.'</td>';
    3131    $Result .= '</tr>';
    3232  }
    3333  $Result .= '</table>';
    34   return($Result);
     34  return $Result;
    3535}
    3636
     
    4444  );
    4545
    46   foreach($Class as $Index => $Item)
     46  foreach ($Class as $Index => $Item)
    4747  {
    48     if(!array_key_exists($Index, $Values)) $Values[$Index] = $Item['Default'];
    49     switch($Item['Type'])
     48    if (!array_key_exists($Index, $Values)) $Values[$Index] = $Item['Default'];
     49    switch ($Item['Type'])
    5050    {
    5151      case 'Boolean':
    52         if($Values[$Index] == 0) $Checked = ''; else $Checked = ' checked="yes"';
     52        if ($Values[$Index] == 0) $Checked = ''; else $Checked = ' checked="yes"';
    5353        $Edit = '<input type="checkbox" name="'.$Index.'"'.$Checked.'>';
    5454        break;
     
    6565  }
    6666  $Output = '<h3>Tabulka '.$ClassName.'</h3>'.Table($Table).MakeLink('?Operation=Add2', 'Přidat');
    67   return($Output);
     67  return $Output;
    6868}
    6969
    7070function ProcessURL()
    7171{
    72   if(array_key_exists('REDIRECT_QUERY_STRING', $_SERVER))
     72  if (array_key_exists('REDIRECT_QUERY_STRING', $_SERVER))
    7373    $PathString = $_SERVER['REDIRECT_QUERY_STRING'];
    7474    else $PathString = '';
    75   if(substr($PathString, -1, 1) == '/') $PathString = substr($PathString, 0, -1);
     75  if (substr($PathString, -1, 1) == '/') $PathString = substr($PathString, 0, -1);
    7676  $PathItems = explode('/', $PathString);
    77   if(array_key_exists('REQUEST_URI', $_SERVER) and (strpos($_SERVER['REQUEST_URI'], '?') !== false))
     77  if (array_key_exists('REQUEST_URI', $_SERVER) and (strpos($_SERVER['REQUEST_URI'], '?') !== false))
    7878    $_SERVER['QUERY_STRING'] = substr($_SERVER['REQUEST_URI'], strpos($_SERVER['REQUEST_URI'], '?') + 1);
    7979    else $_SERVER['QUERY_STRING'] = '';
    8080  parse_str($_SERVER['QUERY_STRING'], $_GET);
    81   return($PathItems);
     81  return $PathItems;
    8282}
    8383
     
    8686  $Result = array();
    8787  $Parts = explode('&', $QueryString);
    88   foreach($Parts as $Part)
     88  foreach ($Parts as $Part)
    8989  {
    90     if($Part != '')
     90    if ($Part != '')
    9191    {
    92       if(!strpos($Part, '=')) $Part .= '=';
     92      if (!strpos($Part, '=')) $Part .= '=';
    9393      $Item = explode('=', $Part);
    9494      $Result[$Item[0]] = $Item[1];
    9595    }
    9696  }
    97   return($Result);
     97  return $Result;
    9898}
    9999
     
    101101{
    102102  $Parts = array();
    103   foreach($QueryStringArray as $Index => $Item)
     103  foreach ($QueryStringArray as $Index => $Item)
    104104  {
    105105    $Parts[] = $Index.'='.$Item;
    106106  }
    107   return(implode('&amp;', $Parts));
     107  return implode('&amp;', $Parts);
    108108}
    109109
    110110function GetRemoteAddress()
    111111{
    112   if(array_key_exists('REMOTE_ADDR', $_SERVER)) $IP = $_SERVER['REMOTE_ADDR'];
     112  if (array_key_exists('REMOTE_ADDR', $_SERVER)) $IP = $_SERVER['REMOTE_ADDR'];
    113113  else $IP = '0.0.0.0';
    114   return($IP);
     114  return $IP;
    115115}
Note: See TracChangeset for help on using the changeset viewer.