Changeset 55


Ignore:
Timestamp:
Apr 7, 2020, 12:55:39 AM (5 years ago)
Author:
chronos
Message:
  • Modified: Improved code formatting.
Location:
trunk
Files:
29 edited

Legend:

Unmodified
Added
Removed
  • trunk/Global.php

    r54 r55  
    33function HumanDate($Time)
    44{
    5   return(date('j.n.Y', $Time));
     5  return date('j.n.Y', $Time);
    66}
    77
    88function HumanTime($Time)
    99{
    10   return(date('H:i:s', $Time));
     10  return date('H:i:s', $Time);
    1111}
    1212
     
    1616  $Time = HumanTime($Time);
    1717  if ($Time != '00:00:00') $Output .= ' '.$Time;
    18   return($Output);
     18  return $Output;
    1919}
    2020
     
    2828function ProcessURL()
    2929{
    30   if(array_key_exists('REDIRECT_QUERY_STRING', $_SERVER))
     30  if (array_key_exists('REDIRECT_QUERY_STRING', $_SERVER))
    3131    $PathString = $_SERVER['REDIRECT_QUERY_STRING'];
    3232    else $PathString = '';
    33   if(substr($PathString, -1, 1) == '/') $PathString = substr($PathString, 0, -1);
     33  if (substr($PathString, -1, 1) == '/') $PathString = substr($PathString, 0, -1);
    3434  $PathItems = explode('/', $PathString);
    35   if(array_key_exists('REQUEST_URI', $_SERVER) and (strpos($_SERVER['REQUEST_URI'], '?') !== false))
     35  if (array_key_exists('REQUEST_URI', $_SERVER) and (strpos($_SERVER['REQUEST_URI'], '?') !== false))
    3636    $_SERVER['QUERY_STRING'] = substr($_SERVER['REQUEST_URI'], strpos($_SERVER['REQUEST_URI'], '?') + 1);
    3737    else $_SERVER['QUERY_STRING'] = '';
    3838  parse_str($_SERVER['QUERY_STRING'], $_GET);
    39   return($PathItems);
     39  return $PathItems;
    4040}
    4141
     
    4444  $Result = array();
    4545  $Parts = explode('&', $QueryString);
    46   foreach($Parts as $Part)
    47   {
    48     if($Part != '')
    49     {
    50       if(!strpos($Part, '=')) $Part .= '=';
     46  foreach ($Parts as $Part)
     47  {
     48    if ($Part != '')
     49    {
     50      if (!strpos($Part, '=')) $Part .= '=';
    5151      $Item = explode('=', $Part);
    5252      $Result[$Item[0]] = $Item[1];
    5353    }
    5454  }
    55   return($Result);
     55  return $Result;
    5656}
    5757
     
    5959{
    6060  $Parts = array();
    61   foreach($QueryStringArray as $Index => $Item)
     61  foreach ($QueryStringArray as $Index => $Item)
    6262  {
    6363    if ($Index != 'lvm') $Parts[] = $Index.'='.$Item;
    6464  }
    65   return(implode('&', $Parts));
     65  return implode('&', $Parts);
    6666}
    6767
     
    7777  $PageCount = floor($TotalCount / $ItemPerPage) + 1;
    7878
    79   if(!array_key_exists('Page', $_SESSION)) $_SESSION['Page'] = 0;
    80   if(array_key_exists('page', $_GET)) $_SESSION['Page'] = $_GET['page'] * 1;
    81   if($_SESSION['Page'] < 0) $_SESSION['Page'] = 0;
    82   if($_SESSION['Page'] >= $PageCount) $_SESSION['Page'] = $PageCount - 1;
     79  if (!array_key_exists('Page', $_SESSION)) $_SESSION['Page'] = 0;
     80  if (array_key_exists('page', $_GET)) $_SESSION['Page'] = $_GET['page'] * 1;
     81  if ($_SESSION['Page'] < 0) $_SESSION['Page'] = 0;
     82  if ($_SESSION['Page'] >= $PageCount) $_SESSION['Page'] = $PageCount - 1;
    8383  $CurrentPage = $_SESSION['Page'];
    8484
     
    8787
    8888  $Result = '';
    89   if($PageCount > 1)
    90   {
    91     if($CurrentPage > 0)
     89  if ($PageCount > 1)
     90  {
     91    if ($CurrentPage > 0)
    9292    {
    9393      $QueryItems['page'] = 0;
     
    9898    $PagesMax = $PageCount - 1;
    9999    $PagesMin = 0;
    100     if($PagesMax > ($CurrentPage + $Around)) $PagesMax = $CurrentPage + $Around;
    101     if($PagesMin < ($CurrentPage - $Around))
     100    if ($PagesMax > ($CurrentPage + $Around)) $PagesMax = $CurrentPage + $Around;
     101    if ($PagesMin < ($CurrentPage - $Around))
    102102    {
    103103      $Result.= ' ... ';
    104104      $PagesMin = $CurrentPage - $Around;
    105105    }
    106     for($i = $PagesMin; $i <= $PagesMax; $i++)
    107     {
    108       if($i == $CurrentPage) $Result.= '<strong>'.($i + 1).'</strong> ';
     106    for ($i = $PagesMin; $i <= $PagesMax; $i++)
     107    {
     108      if ($i == $CurrentPage) $Result.= '<strong>'.($i + 1).'</strong> ';
    109109      else {
    110110       $QueryItems['page'] = $i;
     
    112112      }
    113113    }
    114     if($PagesMax < ($PageCount - 1)) $Result .= ' ... ';
    115     if($CurrentPage < ($PageCount - 1))
     114    if ($PagesMax < ($PageCount - 1)) $Result .= ' ... ';
     115    if ($CurrentPage < ($PageCount - 1))
    116116    {
    117117      $QueryItems['page'] = ($CurrentPage + 1);
     
    122122  }
    123123  $Result = '<div style="text-align: center">'.$Result.'</div>';
    124   return(array('SQLLimit' => ' LIMIT '.$CurrentPage * $ItemPerPage.', '.$ItemPerPage,
     124  return array('SQLLimit' => ' LIMIT '.$CurrentPage * $ItemPerPage.', '.$ItemPerPage,
    125125    'Page' => $CurrentPage,
    126126    'Output' => $Result,
    127   ));
     127  );
    128128}
    129129
     
    135135  global $OrderDirSQL, $OrderArrowImage, $Config;
    136136
    137   if(array_key_exists('OrderCol', $_GET)) $_SESSION['OrderCol'] = $_GET['OrderCol'];
    138   if(array_key_exists('OrderDir', $_GET) and (array_key_exists($_GET['OrderDir'], $OrderArrowImage)))
     137  if (array_key_exists('OrderCol', $_GET)) $_SESSION['OrderCol'] = $_GET['OrderCol'];
     138  if (array_key_exists('OrderDir', $_GET) and (array_key_exists($_GET['OrderDir'], $OrderArrowImage)))
    139139    $_SESSION['OrderDir'] = $_GET['OrderDir'];
    140   if(!array_key_exists('OrderCol', $_SESSION)) $_SESSION['OrderCol'] = $DefaultColumn;
    141   if(!array_key_exists('OrderDir', $_SESSION)) $_SESSION['OrderDir'] = $DefaultOrder;
     140  if (!array_key_exists('OrderCol', $_SESSION)) $_SESSION['OrderCol'] = $DefaultColumn;
     141  if (!array_key_exists('OrderDir', $_SESSION)) $_SESSION['OrderDir'] = $DefaultOrder;
    142142
    143143  // Check OrderCol
    144144  $Found = false;
    145   foreach($Columns as $Column)
    146   {
    147     if($Column['Name'] == $_SESSION['OrderCol'])
     145  foreach ($Columns as $Column)
     146  {
     147    if ($Column['Name'] == $_SESSION['OrderCol'])
    148148    {
    149149      $Found = true;
     
    151151    }
    152152  }
    153   if($Found == false)
     153  if ($Found == false)
    154154  {
    155155    $_SESSION['OrderCol'] = $DefaultColumn;
     
    157157  }
    158158  // Check OrderDir
    159   if(($_SESSION['OrderDir'] != 0) and ($_SESSION['OrderDir'] != 1)) $_SESSION['OrderDir'] = 0;
     159  if (($_SESSION['OrderDir'] != 0) and ($_SESSION['OrderDir'] != 1)) $_SESSION['OrderDir'] = 0;
    160160
    161161  $Result = '';
    162162  $QueryItems = GetQueryStringArray($_SERVER['QUERY_STRING']);
    163   foreach($Columns as $Index => $Column)
     163  foreach ($Columns as $Index => $Column)
    164164  {
    165165    $QueryItems['OrderCol'] = $Column['Name'];
    166166    $QueryItems['OrderDir'] = 1 - $_SESSION['OrderDir'];
    167     if($Column['Name'] == $_SESSION['OrderCol']) $ArrowImage = '<img style="vertical-align: middle; border: 0px;" src="'.
     167    if ($Column['Name'] == $_SESSION['OrderCol']) $ArrowImage = '<img style="vertical-align: middle; border: 0px;" src="'.
    168168      Link2('/images/'.$OrderArrowImage[$_SESSION['OrderDir']]).'" alt="order arrow"/>';
    169169      else $ArrowImage = '';
    170     if($Column['Name'] == '') $Result .= '<th>'.$Column['Title'].'</th>';
     170    if ($Column['Name'] == '') $Result .= '<th>'.$Column['Title'].'</th>';
    171171      else $Result .= '<th><a href="?'.SetQueryStringArray($QueryItems).'">'.$Column['Title'].$ArrowImage.'</a></th>';
    172172  }
    173   return(array(
     173  return array(
    174174    'SQL' => ' ORDER BY `'.$_SESSION['OrderCol'].'` '.$OrderDirSQL[$_SESSION['OrderDir']],
    175175    'Output' => '<tr>'.$Result.'</tr>',
    176176    'Column' => $_SESSION['OrderCol'],
    177177    'Direction' => $_SESSION['OrderDir'],
    178   ));
     178  );
    179179}
    180180
     
    182182{
    183183  list($Usec, $Sec) = explode(' ', microtime());
    184   return ((float)$Usec + (float)$Sec);
     184  return (float)$Usec + (float)$Sec;
    185185}
    186186
     
    322322          $Output .= '<div class="filter-num-box">'.
    323323            '<div class="label-box">'.$Item['Title'].'</div>'.
    324             '<input value="'.$_SESSION[$Item['Name']].'" onkeyup="if(event.keyCode!=9) upf(\''.$Item['Name'].'\',$(this).val(),(event.keyCode==13?0:1)); '.
     324            '<input value="'.$_SESSION[$Item['Name']].'" onkeyup="if (event.keyCode!=9) upf(\''.$Item['Name'].'\',$(this).val(),(event.keyCode==13?0:1)); '.
    325325            '" id="'.$Item['Name'].'" autocomplete="off" type="text"/>'.
    326326            '</div> ';
     
    350350          $Output .= '<div class="filter-num-box">'.
    351351            '<div class="label-box">'.$Item['Title'].'</div>'.
    352             '<input value="'.$_SESSION[$Item['Name'].'od'].'" onkeyup="if(event.keyCode!=9) upf(\''.$Item['Name'].'od\',$(this).val(),(event.keyCode==13?0:1)); '.
     352            '<input value="'.$_SESSION[$Item['Name'].'od'].'" onkeyup="if (event.keyCode!=9) upf(\''.$Item['Name'].'od\',$(this).val(),(event.keyCode==13?0:1)); '.
    353353            '" id="'.$Item['Name'].'od" autocomplete="off" type="text"/>'.
    354354            '<div class="label-box">-</div>'.
    355355            '<input value="'.$_SESSION[$Item['Name'].'do'].'" onkeyup="'.
    356             'if(event.keyCode!=9) upf(\''.$Item['Name'].'do\',$(this).val(),(event.keyCode==13?0:1));" '.
     356            'if (event.keyCode!=9) upf(\''.$Item['Name'].'do\',$(this).val(),(event.keyCode==13?0:1));" '.
    357357            'id="'.$Item['Name'].'do" autocomplete="off" type="text"/>'.
    358358            '<div class="label-box">'.$Item['Units'].'</div>'.
     
    368368  {
    369369    $Where = '';
    370     foreach($this->Items as $Item)
     370    foreach ($this->Items as $Item)
    371371    {
    372372      if ($Item['DbName'] != '')
  • trunk/Modules/Dance/Dance.php

    r40 r55  
    3939    $this->Title = 'Tanec - Tance - '.$this->Title;
    4040    $Output = '';
    41     if(count($this->System->PathItems) > 1)
     41    if (count($this->System->PathItems) > 1)
    4242    {
    4343      $id = $this->System->PathItems[1] * 1;
     
    6060    $Output .= '<tr><th>Český název</th><th>Anglický název</th><th>Detail</th></tr>';
    6161    $DbResult = $this->Database->select('DanceFigure', '*', '(`Dance`='.$id.')');
    62     while($DanceFigure = $DbResult->fetch_assoc())
     62    while ($DanceFigure = $DbResult->fetch_assoc())
    6363    {
    6464      $Output .= '<tr>'.
     
    7474    $Output .= '<tr><th>Název</th><th>Skupina</th><th>Odkaz</th></tr>';
    7575    $DbResult = $this->Database->select('Resource', '*, (SELECT Name FROM ResourceGroup WHERE ResourceGroup.Id=Resource.Group) AS GroupName', '(`Dance`='.$id.')');
    76     while($DbRow = $DbResult->fetch_assoc())
     76    while ($DbRow = $DbResult->fetch_assoc())
    7777    {
    7878      $Output .= '<tr>'.
     
    8686      /*
    8787          $DbResult2 = $this->Database->select('ResourceGroup', '*');
    88     while($ResourceGroup = $DbResult2->fetch_assoc())
     88    while ($ResourceGroup = $DbResult2->fetch_assoc())
    8989    {
    9090      $Output .= '<th>'.$ResourceGroup['Name'].'</th>';
     
    9292
    9393      $DbResult2 = $this->Database->select('ResourceGroup', '*');
    94       while($ResourceGroup = $DbResult2->fetch_assoc())
     94      while ($ResourceGroup = $DbResult2->fetch_assoc())
    9595      {
    9696        $Output .= '<td>';
    97         while($Resource = $DbResult3->fetch_assoc())
     97        while ($Resource = $DbResult3->fetch_assoc())
    9898        {
    9999          $Output .= '<a href="'.$Resource['URL'].'">'.$Resource['Name'].'</a> ';
     
    122122    $Output .= '<tr><th>Název</th><th>Skupina</th><th>Detail</th></tr>';
    123123    $DbResult = $this->Database->select('Dance', '*, (SELECT Name FROM DanceGroup WHERE DanceGroup.Id=Dance.Group) AS GroupName', '1 ORDER BY `Name`');
    124     while($Dance = $DbResult->fetch_assoc())
     124    while ($Dance = $DbResult->fetch_assoc())
    125125    {
    126126      $Output .= '<tr>'.
     
    132132    $Output .= '</table>';
    133133
    134     return($Output);
     134    return $Output;
    135135  }
    136136}
     
    149149    $this->Title = 'Taneční figura - Tance - '.$this->Title;
    150150    $Output = '';
    151     if(count($this->System->PathItems) > 1)
     151    if (count($this->System->PathItems) > 1)
    152152    {
    153153      $id = $this->System->PathItems[1] * 1;
     
    169169    $Output .= '<tr><th>Skupina videí</th><th></th><th>Detail</th></tr>';
    170170    $DbResult = $this->Database->select('DanceFigure', '*', '(`Dance`='.$id.')');
    171     while($DanceFigure = $DbResult->fetch_assoc())
     171    while ($DanceFigure = $DbResult->fetch_assoc())
    172172    {
    173173      $Output .= '<tr>'.
     
    181181      /*
    182182          $DbResult2 = $this->Database->select('ResourceGroup', '*');
    183     while($ResourceGroup = $DbResult2->fetch_assoc())
     183    while ($ResourceGroup = $DbResult2->fetch_assoc())
    184184    {
    185185      $Output .= '<th>'.$ResourceGroup['Name'].'</th>';
     
    187187
    188188      $DbResult2 = $this->Database->select('ResourceGroup', '*');
    189       while($ResourceGroup = $DbResult2->fetch_assoc())
     189      while ($ResourceGroup = $DbResult2->fetch_assoc())
    190190      {
    191191        $Output .= '<td>';
    192         while($Resource = $DbResult3->fetch_assoc())
     192        while ($Resource = $DbResult3->fetch_assoc())
    193193        {
    194194          $Output .= '<a href="'.$Resource['URL'].'">'.$Resource['Name'].'</a> ';
     
    217217    $Output .= '<tr><th>Název</th><th>Skupina</th><th>Tanec</th><th>Detail</th></tr>';
    218218    $DbResult = $this->Database->select('DanceFigure', '*, (SELECT Dance.Name FROM Dance WHERE Dance.Id=DanceFigure.Dance) AS DanceName', '1 ORDER BY `NameCz`');
    219     while($DbRow = $DbResult->fetch_assoc())
     219    while ($DbRow = $DbResult->fetch_assoc())
    220220    {
    221221      $Output .= '<tr>'.
     
    228228    $Output .= '</table>';
    229229
    230     return($Output);
    231   }
    232 }
     230    return $Output;
     231  }
     232}
  • trunk/Modules/Event/Event.php

    r52 r55  
    117117      $Result = 1;
    118118    } else $Result = 0;
    119     return($Result);
     119    return $Result;
    120120  }
    121121}
  • trunk/Modules/Event/EventPage.php

    r52 r55  
    7979      '(SELECT EventSource.URL FROM EventSource WHERE EventSource.Id = Event.Source) AS SourceURL FROM Event) AS T WHERE (T.Hidden=0) AND '.
    8080      $Where.$Order['SQL'].$PageList['SQLLimit']);
    81     while($Event = $DbResult->fetch_assoc())
     81    while ($Event = $DbResult->fetch_assoc())
    8282    {
    8383      $Output .= '<tr>'.
     
    102102      $Output .= '<div><a href="'.$this->System->Link('/udalosti/rss/').'"><img src="'.$this->System->Link('/images/rss20.png').'" alt="rss20"/></a></div>';
    103103    }
    104     return($Output);
     104    return $Output;
    105105  }
    106106}
     
    138138    $this->Title = 'Událost - Události - '.$this->Title;
    139139    $Output = '';
    140     if(count($this->System->PathItems) > 2)
     140    if (count($this->System->PathItems) > 2)
    141141    {
    142142      $id = $this->System->PathItems[2] * 1;
     
    199199    $DbResult = $this->Database->select('Event', '*, (SELECT EventSource.Name FROM EventSource WHERE EventSource.Id = Event.Source) AS SourceName, '.
    200200      '(SELECT EventSource.URL FROM EventSource WHERE EventSource.Id = Event.Source) AS SourceURL', '`Hidden`=0 ORDER BY `TimeFrom` DESC LIMIT 30');
    201     while($Event = $DbResult->fetch_assoc())
     201    while ($Event = $DbResult->fetch_assoc())
    202202    {
    203203      $Title = $Event['Title'];
  • trunk/Modules/Event/Import/JoeClub.php

    r52 r55  
    4545  {
    4646    $Output = '';
    47     if ($Event->Link == '') return($Output);
     47    if ($Event->Link == '') return $Output;
    4848    $Content = file_get_contents($Event->Link);
    4949
     
    7272      $Time = substr($Time, 0, strpos($Time, '–'));
    7373
    74     if($Time == '') return(NULL);
     74    if ($Time == '') return NULL;
    7575    $Time = str_replace('@', '', $Time);
    7676
  • trunk/Modules/Meet/Meet.php

    r47 r55  
    3434function HumanDateTimeToTime($DateTime)
    3535{
    36   if($DateTime == '') return(NULL);
     36  if ($DateTime == '') return NULL;
    3737  $DateTime = str_replace('. ', '.', $DateTime);
    3838  $Parts = explode(' ', $DateTime);
     
    4444  } else $TimeParts = array(0, 0, 0);
    4545  $Result = mktime($TimeParts[0], $TimeParts[1], $TimeParts[2], $DateParts[1], $DateParts[0], $DateParts[2]);
    46   return($Result);
     46  return $Result;
    4747}
    4848
    4949function HumanDateToTime($Date)
    5050{
    51   if($Date == '') return(NULL);
    52   return(HumanDateTimeToTime($Date.' 0:0:0'));
     51  if ($Date == '') return NULL;
     52  return HumanDateTimeToTime($Date.' 0:0:0');
    5353}
    5454
     
    6060  $ret = html_entity_decode($str, ENT_COMPAT, 'UTF-8');
    6161  $p2 = 0;
    62   for(;;)
     62  for (;;)
    6363  {
    6464    $p = strpos($ret, $prefix, $p2);
     
    105105function is_alpha($Char)
    106106{
    107   return ((($Char >= 'a') and ($Char <= 'z')) or (($Char >= 'A') and ($Char <= 'Z')));
     107  return (($Char >= 'a') and ($Char <= 'z')) or (($Char >= 'A') and ($Char <= 'Z'));
    108108}
    109109
     
    116116{
    117117  $Result = '';
    118   for(;;)
     118  for (;;)
    119119  {
    120120    $Pos = strpos($Text, $Needle);
     
    142142{
    143143  $Result = '';
    144   for(;;)
     144  for (;;)
    145145  {
    146146    $Pos = strpos($Text, $Needle);
     
    432432      $Result = 1;
    433433    } else $Result = 0;
    434     return($Result);
    435   }
    436 }
     434    return $Result;
     435  }
     436}
  • trunk/Modules/Meet/MeetPage.php

    r49 r55  
    8484      '(SELECT MeetSource.URL FROM MeetSource WHERE MeetSource.Id = MeetItem.Source) AS SourceURL FROM MeetItem) AS T WHERE (T.Hidden=0) AND '.
    8585      $Where.$Order['SQL'].$PageList['SQLLimit']);
    86     while($MeetItem = $DbResult->fetch_assoc())
     86    while ($MeetItem = $DbResult->fetch_assoc())
    8787    {
    8888      $Output .= '<tr>'.
     
    109109      $Output .= '<div><a href="'.$this->System->Link('/seznamka/rss/').'"><img src="'.$this->System->Link('/images/rss20.png').'" alt="rss20"/></a></div>';
    110110    }
    111     return($Output);
     111    return $Output;
    112112  }
    113113}
     
    145145    $this->Title = 'Inzerát - Seznamka - '.$this->Title;
    146146    $Output = '';
    147     if(count($this->System->PathItems) > 2)
     147    if (count($this->System->PathItems) > 2)
    148148    {
    149149      $id = $this->System->PathItems[2] * 1;
     
    211211    $DbResult = $this->Database->select('MeetItem', '*, (SELECT MeetSource.Name FROM MeetSource WHERE MeetSource.Id = MeetItem.Source) AS SourceName, '.
    212212      '(SELECT MeetSource.URL FROM MeetSource WHERE MeetSource.Id = MeetItem.Source) AS SourceURL', '`Hidden`=0 ORDER BY `Time` DESC LIMIT 30');
    213     while($MeetItem = $DbResult->fetch_assoc())
     213    while ($MeetItem = $DbResult->fetch_assoc())
    214214    {
    215215      $Title = $MeetItem['Name'];
  • trunk/Modules/Movie/Movie.php

    r46 r55  
    6666    $Output .= '</tr>';
    6767    $DbResult = $this->Database->select('Movie', '*', $Where.$Order['SQL'].$PageList['SQLLimit']);
    68     while($Movie = $DbResult->fetch_assoc())
     68    while ($Movie = $DbResult->fetch_assoc())
    6969    {
    7070      $Output .= '<tr>'.
     
    8080    $Output .= $PageList['Output'];
    8181
    82     return($Output);
     82    return $Output;
    8383  }
    8484}
  • trunk/Modules/RSS/RSS.php

    r37 r55  
    2727    $this->RSSChannels[$Channel['Channel']] = $Channel;
    2828
    29     if(is_null($Pos)) $this->RSSChannelsPos[] = $Channel['Channel'];
     29    if (is_null($Pos)) $this->RSSChannelsPos[] = $Channel['Channel'];
    3030    else {
    3131      array_splice($this->RSSChannelsPos, $Pos, 0, $Channel['Channel']);
     
    4242  {
    4343    $Output = '';
    44     foreach($this->RSSChannels as $Channel)
     44    foreach ($this->RSSChannels as $Channel)
    4545    {
    46       //if($this->System->User->Licence($Channel['Permission']))
     46      //if ($this->System->User->Licence($Channel['Permission']))
    4747        $Output .= ' <link rel="alternate" title="'.$Channel['Title'].'" href="'.
    4848          $this->System->Link('/rss/?channel='.$Channel['Channel']).'" type="application/rss+xml" />';
    4949    }
    50     return($Output);
     50    return $Output;
    5151  }
    5252}
     
    5858    $this->ClearPage = true;
    5959
    60     if(array_key_exists('channel', $_GET)) $ChannelName = $_GET['channel'];
     60    if (array_key_exists('channel', $_GET)) $ChannelName = $_GET['channel'];
    6161      else $ChannelName = '';
    62     if(array_key_exists('token', $_GET)) $Token = $_GET['token'];
     62    if (array_key_exists('token', $_GET)) $Token = $_GET['token'];
    6363      else $Token = '';
    64     if(array_key_exists($ChannelName, $this->System->ModuleManager->Modules['RSS']->RSSChannels))
     64    if (array_key_exists($ChannelName, $this->System->ModuleManager->Modules['RSS']->RSSChannels))
    6565    {
    6666      $Channel = $this->System->ModuleManager->Modules['RSS']->RSSChannels[$ChannelName];
    67       if($this->System->User->CheckPermission($Channel['Permission']['Module'], $Channel['Permission']['Operation']) or
     67      if ($this->System->User->CheckPermission($Channel['Permission']['Module'], $Channel['Permission']['Operation']) or
    6868      $this->System->User->CheckToken($Channel['Permission']['Module'], $Channel['Permission']['Operation'], $Token))
    6969      {
    70         if(is_string($Channel['Callback'][0]))
     70        if (is_string($Channel['Callback'][0]))
    7171        {
    7272          $Class = new $Channel['Callback'][0]($this->System);
     
    7676      } else $Output = 'Nemáte oprávnění';
    7777    } else $Output = 'Kanál nenalezen';
    78     return($Output);
     78    return $Output;
    7979  }
    8080}
  • trunk/Modules/School/School.php

    r37 r55  
    3939    $Output .= '</tr>';
    4040    $DbResult = $this->Database->select('School', '*', '1 ORDER BY `Name`');
    41     while($School = $DbResult->fetch_assoc())
     41    while ($School = $DbResult->fetch_assoc())
    4242    {
    4343      $Output .= '<tr>'.
     
    4949    $Output .= '</table>';
    5050
    51     return($Output);
     51    return $Output;
    5252  }
    5353}
  • trunk/Packages/Common/AppModule.php

    r37 r55  
    7777  function Install()
    7878  {
    79     if($this->Installed) return;
     79    if ($this->Installed) return;
    8080    $List = array();
    8181    $this->Manager->EnumDependenciesCascade($this, $List, array(ModuleCondition::NotInstalled));
     
    8989  function Uninstall()
    9090  {
    91     if(!$this->Installed) return;
     91    if (!$this->Installed) return;
    9292    $this->Stop();
    9393    $this->Installed = false;
     
    100100  function Upgrade()
    101101  {
    102     if(!$this->Installed) return;
    103     if($this->InstalledVersion == $this->Version) return;
     102    if (!$this->Installed) return;
     103    if ($this->InstalledVersion == $this->Version) return;
    104104    $List = array();
    105105    $this->Manager->EnumSuperiorDependenciesCascade($this, $List, array(ModuleCondition::Installed));
     
    117117  function Start()
    118118  {
    119     if($this->Running) return;
    120     if(!$this->Installed) return;
     119    if ($this->Running) return;
     120    if (!$this->Installed) return;
    121121    $List = array();
    122122    $this->Manager->EnumDependenciesCascade($this, $List, array(ModuleCondition::NotRunning));
     
    128128  function Stop()
    129129  {
    130     if(!$this->Running) return;
     130    if (!$this->Running) return;
    131131    $this->Running = false;
    132132    $List = array();
     
    144144  function Enable()
    145145  {
    146     if($this->Enabled) return;
    147     if(!$this->Installed) return;
     146    if ($this->Enabled) return;
     147    if (!$this->Installed) return;
    148148    $List = array();
    149149    $this->Manager->EnumDependenciesCascade($this, $List, array(ModuleCondition::NotEnabled));
     
    154154  function Disable()
    155155  {
    156     if(!$this->Enabled) return;
     156    if (!$this->Enabled) return;
    157157    $this->Stop();
    158158    $this->Enabled = false;
     
    203203  function Perform($List, $Actions, $Conditions = array(ModuleCondition::All))
    204204  {
    205     foreach($List as $Index => $Module)
    206     {
    207       if(in_array(ModuleCondition::All, $Conditions) or
     205    foreach ($List as $Index => $Module)
     206    {
     207      if (in_array(ModuleCondition::All, $Conditions) or
    208208        ($Module->Running and in_array(ModuleCondition::Running, $Conditions)) or
    209209        (!$Module->Running and in_array(ModuleCondition::NotRunning, $Conditions)) or
     
    213213        (!$Module->Enabled and in_array(ModuleCondition::NotEnabled, $Conditions)))
    214214      {
    215         foreach($Actions as $Action)
     215        foreach ($Actions as $Action)
    216216        {
    217           if($Action == ModuleAction::Start) $Module->Start();
    218           if($Action == ModuleAction::Stop) $Module->Stop();
    219           if($Action == ModuleAction::Install) $Module->Install();
    220           if($Action == ModuleAction::Uninstall) $Module->Uninstall();
    221           if($Action == ModuleAction::Enable) $Module->Enable();
    222           if($Action == ModuleAction::Disable) $Module->Disable();
    223           if($Action == ModuleAction::Upgrade) $Module->Upgrade();
     217          if ($Action == ModuleAction::Start) $Module->Start();
     218          if ($Action == ModuleAction::Stop) $Module->Stop();
     219          if ($Action == ModuleAction::Install) $Module->Install();
     220          if ($Action == ModuleAction::Uninstall) $Module->Uninstall();
     221          if ($Action == ModuleAction::Enable) $Module->Enable();
     222          if ($Action == ModuleAction::Disable) $Module->Disable();
     223          if ($Action == ModuleAction::Upgrade) $Module->Upgrade();
    224224        }
    225225      }
     
    229229  function EnumDependenciesCascade($Module, &$List, $Conditions = array(ModuleCondition::All))
    230230  {
    231     foreach($Module->Dependencies as $Dependency)
    232     {
    233       if(!array_key_exists($Dependency, $this->Modules))
     231    foreach ($Module->Dependencies as $Dependency)
     232    {
     233      if (!array_key_exists($Dependency, $this->Modules))
    234234        throw new Exception(sprintf(T('Module "%s" dependency "%s" not found'), $Module->Name, $Dependency));
    235235      $DepModule = $this->Modules[$Dependency];
    236       if(in_array(ModuleCondition::All, $Conditions) or
     236      if (in_array(ModuleCondition::All, $Conditions) or
    237237        ($Module->Running and in_array(ModuleCondition::Running, $Conditions)) or
    238238        (!$Module->Running and in_array(ModuleCondition::NotRunning, $Conditions)) or
     
    250250  function EnumSuperiorDependenciesCascade($Module, &$List, $Conditions = array(ModuleCondition::All))
    251251  {
    252     foreach($this->Modules as $RefModule)
    253     {
    254       if(in_array($Module->Name, $RefModule->Dependencies) and
     252    foreach ($this->Modules as $RefModule)
     253    {
     254      if (in_array($Module->Name, $RefModule->Dependencies) and
    255255          (in_array(ModuleCondition::All, $Conditions) or
    256256          ($Module->Running and in_array(ModuleCondition::Running, $Conditions)) or
     
    270270  {
    271271    $this->LoadModules();
    272     if(file_exists($this->FileName)) $this->LoadState();
     272    if (file_exists($this->FileName)) $this->LoadState();
    273273    $this->StartEnabled();
    274274  }
     
    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
     
    331331  function SearchModuleById($Id)
    332332  {
    333     foreach($this->Modules as $Module)
     333    foreach ($this->Modules as $Module)
    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
     
    343343    $ConfigModules = array();
    344344    include($this->FileName);
    345     foreach($ConfigModules as $Mod)
    346     {
    347       if(array_key_exists($Mod['Name'], $this->Modules))
     345    foreach ($ConfigModules as $Mod)
     346    {
     347      if (array_key_exists($Mod['Name'], $this->Modules))
    348348      {
    349349        $this->Modules[$Mod['Name']] = $this->Modules[$Mod['Name']];
     
    358358  {
    359359    $Data = array();
    360     foreach($this->Modules as $Module)
     360    foreach ($this->Modules as $Module)
    361361    {
    362362      $Data[] = array('Name' => $Module->Name, 'Enabled' => $Module->Enabled,
     
    381381  {
    382382    $List = scandir($Directory);
    383     foreach($List as $Item)
    384     {
    385       if(is_dir($Directory.'/'.$Item) and ($Item != '.') and ($Item != '..') and ($Item != '.svn'))
     383    foreach ($List as $Item)
     384    {
     385      if (is_dir($Directory.'/'.$Item) and ($Item != '.') and ($Item != '..') and ($Item != '.svn'))
    386386      {
    387387        include_once($Directory.'/'.$Item.'/'.$Item.'.php');
     
    394394  function LoadModules()
    395395  {
    396     if(method_exists($this->OnLoadModules[0], $this->OnLoadModules[1]))
     396    if (method_exists($this->OnLoadModules[0], $this->OnLoadModules[1]))
    397397      $this->OnLoadModules();
    398398    else $this->LoadModulesFromDir($this->ModulesDir);
  • trunk/Packages/Common/Common.php

    r37 r55  
    6161
    6262    $Result = '';
    63     if(array_key_exists('all', $QueryItems))
     63    if (array_key_exists('all', $QueryItems))
    6464    {
    6565      $PageCount = 1;
     
    7272    }
    7373
    74     if(!array_key_exists('Page', $_SESSION)) $_SESSION['Page'] = 0;
    75     if(array_key_exists('page', $_GET)) $_SESSION['Page'] = $_GET['page'] * 1;
    76     if($_SESSION['Page'] < 0) $_SESSION['Page'] = 0;
    77     if($_SESSION['Page'] >= $PageCount) $_SESSION['Page'] = $PageCount - 1;
     74    if (!array_key_exists('Page', $_SESSION)) $_SESSION['Page'] = 0;
     75    if (array_key_exists('page', $_GET)) $_SESSION['Page'] = $_GET['page'] * 1;
     76    if ($_SESSION['Page'] < 0) $_SESSION['Page'] = 0;
     77    if ($_SESSION['Page'] >= $PageCount) $_SESSION['Page'] = $PageCount - 1;
    7878    $CurrentPage = $_SESSION['Page'];
    7979
     
    8181
    8282    $Result = '';
    83     if($PageCount > 1)
     83    if ($PageCount > 1)
    8484    {
    85       if($CurrentPage > 0)
     85      if ($CurrentPage > 0)
    8686      {
    8787        $QueryItems['page'] = 0;
     
    9292      $PagesMax = $PageCount - 1;
    9393      $PagesMin = 0;
    94       if($PagesMax > ($CurrentPage + $Around)) $PagesMax = $CurrentPage + $Around;
    95       if($PagesMin < ($CurrentPage - $Around))
     94      if ($PagesMax > ($CurrentPage + $Around)) $PagesMax = $CurrentPage + $Around;
     95      if ($PagesMin < ($CurrentPage - $Around))
    9696      {
    9797        $Result.= ' ... ';
    9898        $PagesMin = $CurrentPage - $Around;
    9999      }
    100       for($i = $PagesMin; $i <= $PagesMax; $i++)
     100      for ($i = $PagesMin; $i <= $PagesMax; $i++)
    101101      {
    102         if($i == $CurrentPage) $Result.= '<strong>'.($i + 1).'</strong> ';
     102        if ($i == $CurrentPage) $Result.= '<strong>'.($i + 1).'</strong> ';
    103103        else {
    104104         $QueryItems['page'] = $i;
     
    106106        }
    107107      }
    108       if($PagesMax < ($PageCount - 1)) $Result .= ' ... ';
    109       if($CurrentPage < ($PageCount - 1))
     108      if ($PagesMax < ($PageCount - 1)) $Result .= ' ... ';
     109      if ($CurrentPage < ($PageCount - 1))
    110110      {
    111111        $QueryItems['page'] = ($CurrentPage + 1);
     
    116116    }
    117117    $QueryItems['all'] = '1';
    118     if($PageCount > 1) $Result.= ' <a href="?'.SetQueryStringArray($QueryItems).'">Vše</a>';
     118    if ($PageCount > 1) $Result.= ' <a href="?'.SetQueryStringArray($QueryItems).'">Vše</a>';
    119119
    120120    $Result = '<div style="text-align: center">'.$Result.'</div>';
    121121    $this->SQLLimit = ' LIMIT '.$CurrentPage * $ItemPerPage.', '.$ItemPerPage;
    122122    $this->Page = $CurrentPage;
    123     return($Result);
     123    return $Result;
    124124  }
    125125}
  • trunk/Packages/Common/Config.php

    r37 r55  
    1212  function ReadValue($Name)
    1313  {
    14     if(!is_array($Name)) $Name = explode('/', $Name);
     14    if (!is_array($Name)) $Name = explode('/', $Name);
    1515    $Last = array_pop($Name);
    1616    $Data = &$this->Data;
    17     foreach($Name as $Item)
     17    foreach ($Name as $Item)
    1818    {
    1919      $Data = &$Data[$Item];
    2020    }
    21     return($Data[$Last]);
     21    return $Data[$Last];
    2222  }
    2323
    2424  function WriteValue($Name, $Value)
    2525  {
    26     if(!is_array($Name)) $Name = explode('/', $Name);
     26    if (!is_array($Name)) $Name = explode('/', $Name);
    2727    $Last = array_pop($Name);
    2828    $Data = &$this->Data;
    29     foreach($Name as $Item)
     29    foreach ($Name as $Item)
    3030    {
    3131      $Data = &$Data[$Item];
     
    3838    $ConfigData = array();
    3939    include $FileName;
    40     foreach($this->Data as $Index => $Item)
     40    foreach ($this->Data as $Index => $Item)
    4141    {
    42       if(array_key_exits($Index, $ConfigData))
     42      if (array_key_exits($Index, $ConfigData))
    4343        $this->Data[$Index] = $ConfigData[$Index];
    4444    }
     
    5252  function GetAsArray()
    5353  {
    54     return($this->Data);
     54    return $this->Data;
    5555  }
    5656}
  • trunk/Packages/Common/Database.php

    r37 r55  
    1111  function fetch_assoc()
    1212  {
    13     return($this->PDOStatement->fetch(PDO::FETCH_ASSOC));
     13    return $this->PDOStatement->fetch(PDO::FETCH_ASSOC);
    1414  }
    1515
    1616  function fetch_array()
    1717  {
    18     return($this->PDOStatement->fetch(PDO::FETCH_BOTH));
     18    return $this->PDOStatement->fetch(PDO::FETCH_BOTH);
    1919  }
    2020
    2121  function fetch_row()
    2222  {
    23     return($this->PDOStatement->fetch(PDO::FETCH_NUM));
     23    return $this->PDOStatement->fetch(PDO::FETCH_NUM);
    2424  }
    2525}
     
    5454  function Connect($Host, $User, $Password, $Database)
    5555  {
    56     if($this->Type == 'mysql') $ConnectionString = 'mysql:host='.$Host.';dbname='.$Database;
    57       else if($this->Type == 'pgsql') $ConnectionString = 'pgsql:dbname='.$Database.';host='.$Host;
     56    if ($this->Type == 'mysql') $ConnectionString = 'mysql:host='.$Host.';dbname='.$Database;
     57      else if ($this->Type == 'pgsql') $ConnectionString = 'pgsql:dbname='.$Database.';host='.$Host;
    5858      else $ConnectionString = '';
    5959    try {
     
    7474  function Connected()
    7575  {
    76     return(isset($this->PDO));
     76    return isset($this->PDO);
    7777  }
    7878
     
    8484  function query($Query)
    8585  {
    86     if(!$this->Connected()) throw new Exception(T('Not connected to database'));
    87     if(($this->ShowSQLQuery == true) or ($this->LogSQLQuery == true)) $QueryStartTime = microtime();
     86    if (!$this->Connected()) throw new Exception(T('Not connected to database'));
     87    if (($this->ShowSQLQuery == true) or ($this->LogSQLQuery == true)) $QueryStartTime = microtime();
    8888    $this->LastQuery = $Query;
    89     if(($this->ShowSQLQuery == true) or ($this->LogSQLQuery == true))
     89    if (($this->ShowSQLQuery == true) or ($this->LogSQLQuery == true))
    9090      $Duration = ' ; '.round(microtime() - $QueryStartTime, 4). ' s';
    91     if($this->LogSQLQuery == true)
     91    if ($this->LogSQLQuery == true)
    9292      file_put_contents($this->LogFile, $Query.$Duration."\n", FILE_APPEND);
    93     if($this->ShowSQLQuery == true)
     93    if ($this->ShowSQLQuery == true)
    9494      echo('<div style="border-bottom-width: 1px; border-bottom-style: solid; '.
    9595      'padding-bottom: 3px; padding-top: 3px; font-size: 12px; font-family: Arial;">'.$Query.$Duration.'</div>'."\n");
    9696    $Result = new DatabaseResult();
    9797    $Result->PDOStatement = $this->PDO->query($Query);
    98     if($Result->PDOStatement)
     98    if ($Result->PDOStatement)
    9999    {
    100100      $Result->num_rows = $Result->PDOStatement->rowCount();
     
    104104      $this->Error = $this->PDO->errorInfo();
    105105      $this->Error = $this->Error[2];
    106       if(($this->Error != '') and ($this->ShowSQLError == true))
     106      if (($this->Error != '') and ($this->ShowSQLError == true))
    107107        echo('<div><strong>SQL Error: </strong>'.$this->Error.'<br />'.$Query.'</div>');
    108108        throw new Exception('SQL Error: '.$this->Error.', Query: '.$Query);
    109109    }
    110     return($Result);
     110    return $Result;
    111111  }
    112112
    113113  function select($Table, $What = '*', $Condition = 1)
    114114  {
    115     return($this->query('SELECT '.$What.' FROM `'.$this->Prefix.$Table.'` WHERE '.$Condition));
     115    return $this->query('SELECT '.$What.' FROM `'.$this->Prefix.$Table.'` WHERE '.$Condition);
    116116  }
    117117
     
    125125    $Name = '';
    126126    $Values = '';
    127     foreach($Data as $Key => $Value)
     127    foreach ($Data as $Key => $Value)
    128128    {
    129129      $Name .= ',`'.$Key.'`';
    130       if(!in_array($Value, $this->Functions))
     130      if (!in_array($Value, $this->Functions))
    131131      {
    132         if(is_null($Value)) $Value = 'NULL';
     132        if (is_null($Value)) $Value = 'NULL';
    133133        else $Value = $this->PDO->quote($Value);
    134134      }
     
    144144  {
    145145    $Values = '';
    146     foreach($Data as $Key => $Value)
    147     {
    148       if(!in_array($Value, $this->Functions))
     146    foreach ($Data as $Key => $Value)
     147    {
     148      if (!in_array($Value, $this->Functions))
    149149      {
    150         if(is_null($Value)) $Value = 'NULL';
     150        if (is_null($Value)) $Value = 'NULL';
    151151        else $Value = $this->PDO->quote($Value);
    152152      }
     
    161161    $Name = '';
    162162    $Values = '';
    163     foreach($Data as $Key => $Value)
    164     {
    165       if(!in_array($Value, $this->Functions))
     163    foreach ($Data as $Key => $Value)
     164    {
     165      if (!in_array($Value, $this->Functions))
    166166      {
    167         if(is_null($Value)) $Value = 'NULL';
     167        if (is_null($Value)) $Value = 'NULL';
    168168        else $Value = $this->PDO->quote($Value);
    169169      }
     
    185185  function real_escape_string($Text)
    186186  {
    187     return(addslashes($Text));
     187    return addslashes($Text);
    188188  }
    189189
    190190  function quote($Text)
    191191  {
    192     return($this->PDO->quote($Text));
     192    return $this->PDO->quote($Text);
    193193  }
    194194
     
    205205function TimeToMysqlDateTime($Time)
    206206{
    207   if($Time == NULL) return(NULL);
    208     else return(date('Y-m-d H:i:s', $Time));
     207  if ($Time == NULL) return NULL;
     208    else return date('Y-m-d H:i:s', $Time);
    209209}
    210210
    211211function TimeToMysqlDate($Time)
    212212{
    213   if($Time == NULL) return(NULL);
    214     else return(date('Y-m-d', $Time));
     213  if ($Time == NULL) return NULL;
     214    else return date('Y-m-d', $Time);
    215215}
    216216
    217217function TimeToMysqlTime($Time)
    218218{
    219   if($Time == NULL) return(NULL);
    220     else return(date('H:i:s', $Time));
     219  if ($Time == NULL) return NULL;
     220    else return date('H:i:s', $Time);
    221221}
    222222
    223223function MysqlDateTimeToTime($DateTime)
    224224{
    225   if($DateTime == '') return(NULL);
     225  if ($DateTime == '') return NULL;
    226226  $Parts = explode(' ', $DateTime);
    227227  $DateParts = explode('-', $Parts[0]);
    228228  $TimeParts = explode(':', $Parts[1]);
    229229  $Result = mktime($TimeParts[0], $TimeParts[1], $TimeParts[2], $DateParts[1], $DateParts[2], $DateParts[0]);
    230   return($Result);
     230  return $Result;
    231231}
    232232
    233233function MysqlDateToTime($Date)
    234234{
    235   if($Date == '') return(NULL);
    236   return(MysqlDateTimeToTime($Date.' 0:0:0'));
     235  if ($Date == '') return NULL;
     236  return MysqlDateTimeToTime($Date.' 0:0:0');
    237237}
    238238
    239239function MysqlTimeToTime($Time)
    240240{
    241   if($Time == '') return(NULL);
    242   return(MysqlDateTimeToTime('0000-00-00 '.$Time));
    243 }
     241  if ($Time == '') return NULL;
     242  return MysqlDateTimeToTime('0000-00-00 '.$Time);
     243}
  • trunk/Packages/Common/Error.php

    r37 r55  
    4545    );
    4646
    47     if(($this->UserErrors & $Number))
     47    if (($this->UserErrors & $Number))
    4848    {
    4949      // Error was suppressed with the @-operator
    50       if(0 === error_reporting())
     50      if (0 === error_reporting())
    5151      {
    5252        return false;
     
    5858      $Backtrace[0]['line'] = $LineNumber;
    5959      $this->Report($Backtrace);
    60       //if((E_ERROR | E_PARSE) & $Number)
     60      //if ((E_ERROR | E_PARSE) & $Number)
    6161      die();
    6262    }
     
    8282      'An internal error occurred!<br/>'.
    8383      'Administrator will be notified and the problem will be investigated and fixed soon.'.'<br/><br/>';
    84     if($this->ShowError == true)
     84    if ($this->ShowError == true)
    8585      $Output .= '<pre>'.$Message.'</pre><br/>';
    8686    $Output .= '</body></html>';
     
    9292    $Date = date('Y-m-d H:i:s');
    9393    $Error = '# '.$Date."\n";
    94     foreach($Backtrace as $Item)
     94    foreach ($Backtrace as $Item)
    9595    {
    96       if(!array_key_exists('line', $Item)) $Item['line'] = '';
    97       if(!array_key_exists('file', $Item)) $Item['file'] = '';
     96      if (!array_key_exists('line', $Item)) $Item['line'] = '';
     97      if (!array_key_exists('file', $Item)) $Item['file'] = '';
    9898
    9999      $Error .= ' '.$Item['file'].'('.$Item['line'].")\t".$Item['function'];
    100100      $Arguments = '';
    101       if(array_key_exists('args', $Item) and is_array($Item['args']))
    102         foreach($Item['args'] as $Item)
     101      if (array_key_exists('args', $Item) and is_array($Item['args']))
     102        foreach ($Item['args'] as $Item)
    103103        {
    104           if(is_object($Item)) ;
    105           else if(is_array($Item)) $Arguments .= "'".serialize($Item)."',";
     104          if (is_object($Item)) ;
     105          else if (is_array($Item)) $Arguments .= "'".serialize($Item)."',";
    106106          else $Arguments .= "'".$Item."',";
    107107        }
    108         if(strlen($Arguments) > 0) $Error .= '('.substr($Arguments, 0, -1).')';
     108        if (strlen($Arguments) > 0) $Error .= '('.substr($Arguments, 0, -1).')';
    109109        $Error .= "\n";
    110110    }
    111111    $Error .= "\n";
    112112
    113     foreach($this->OnError as $OnError)
     113    foreach ($this->OnError as $OnError)
    114114      call_user_func($OnError, $Error);
    115115  }
  • trunk/Packages/Common/Image.php

    r37 r55  
    6565  function SaveToFile($FileName)
    6666  {
    67     if($this->Type == IMAGETYPE_JPEG)
     67    if ($this->Type == IMAGETYPE_JPEG)
    6868    {
    6969      imagejpeg($this->Image, $FileName);
    7070    } else
    71     if($this->Type == IMAGETYPE_GIF)
     71    if ($this->Type == IMAGETYPE_GIF)
    7272    {
    73       imagegif($this->Image, $FileName);
     73      imagegif ($this->Image, $FileName);
    7474    } else
    75     if($this->Type == IMAGETYPE_PNG)
     75    if ($this->Type == IMAGETYPE_PNG)
    7676    {
    7777      imagepng($this->Image, $FileName);
     
    8383    $ImageInfo = getimagesize($FileName);
    8484    $this->Type = $ImageInfo[2];
    85     if($this->Type == IMAGETYPE_JPEG)
     85    if ($this->Type == IMAGETYPE_JPEG)
    8686    {
    8787      $this->Image = imagecreatefromjpeg($FileName);
    8888    } else
    89     if($this->Type == IMAGETYPE_GIF)
     89    if ($this->Type == IMAGETYPE_GIF)
    9090    {
    91       $this->Image = imagecreatefromgif($FileName);
     91      $this->Image = imagecreatefromgif ($FileName);
    9292    } else
    93     if( $this->Type == IMAGETYPE_PNG)
     93    if ( $this->Type == IMAGETYPE_PNG)
    9494    {
    9595      $this->Image = imagecreatefrompng($FileName);
     
    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

    r37 r55  
    2020  function Translate($Text, $Group = '')
    2121  {
    22     if(array_key_exists($Text, $this->Data[$Group]) and ($this->Data[$Group][$Text] != ''))
    23       return($this->Data[$Group][$Text]);
    24       else return($Text);
     22    if (array_key_exists($Text, $this->Data[$Group]) and ($this->Data[$Group][$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}
     
    4747  {
    4848    $FileName = $this->Dir.'/'.$Language.'.php';
    49     if(file_exists($FileName)) {
     49    if (file_exists($FileName)) {
    5050      include_once($FileName);
    5151      $ClassName = 'LocaleText'.$Language;
     
    5959    // Search for php files
    6060    $FileList = scandir($Path);
    61     foreach($FileList as $FileName)
     61    foreach ($FileList as $FileName)
    6262    {
    6363      $FullName = $Path.'/'.$FileName;
    64       if(($FileName == '.') or ($FileName == '..')) ; // Skip virtual items
    65       else if(substr($FileName, 0, 1) == '.') ; // Skip Linux hidden files
    66       else if(is_dir($FullName)) $this->AnalyzeCode($FullName);
    67       else if(file_exists($FullName))
    68       {
    69         if(substr($FullName, -4) == '.php')
     64      if (($FileName == '.') or ($FileName == '..')) ; // Skip virtual items
     65      else if (substr($FileName, 0, 1) == '.') ; // Skip Linux hidden files
     66      else if (is_dir($FullName)) $this->AnalyzeCode($FullName);
     67      else if (file_exists($FullName))
     68      {
     69        if (substr($FullName, -4) == '.php')
    7070        {
    7171          $Content = file_get_contents($FullName);
    7272          // Search occurence of T() function
    73           while(strpos($Content, 'T(') !== false)
     73          while (strpos($Content, 'T(') !== false)
    7474          {
    7575            $Previous = strtolower(substr($Content, strpos($Content, 'T(') - 1, 1));
     
    7777            $Ord = ord($Previous);
    7878            //echo($Ord.',');
    79             if(!(($Ord >= ord('a')) and ($Ord <= ord('z'))))
     79            if (!(($Ord >= ord('a')) and ($Ord <= ord('z'))))
    8080            {
    8181              // Do for non-alpha previous character
    8282              $Original = substr($Content, 0, strpos($Content, ')'));
    8383              $Original2 = '';
    84               if((substr($Original, 0, 1) == "'") and (substr($Original, -1, 1) == "'"))
     84              if ((substr($Original, 0, 1) == "'") and (substr($Original, -1, 1) == "'"))
    8585                $Original2 = substr($Original, 1, -1);
    86               if((substr($Original, 0, 1) == '"') and (substr($Original, -1, 1) == '"'))
     86              if ((substr($Original, 0, 1) == '"') and (substr($Original, -1, 1) == '"'))
    8787                $Original2 = substr($Original, 1, -1);
    88               if($Original2 != '')
     88              if ($Original2 != '')
    8989              {
    90                 if(!array_key_exists($Original2, $this->Texts->Data))
     90                if (!array_key_exists($Original2, $this->Texts->Data))
    9191                  $this->Texts->Data[$Original2] = '';
    9292              }
     
    109109    '    $this->Title = \''.$this->Texts->Title.'\';'."\n".
    110110    '    $this->Data = array('."\n";
    111     foreach($this->Texts->Data as $Index => $Item)
     111    foreach ($this->Texts->Data as $Index => $Item)
    112112    {
    113113      $Content .= "      '".$Index."' => '".$Item."',\n";
     
    122122  {
    123123    $DbResult = $Database->select('Language', '*', 'Code='.$Database->quote($LangCode));
    124     if($DbResult->num_rows > 0)
     124    if ($DbResult->num_rows > 0)
    125125    {
    126126      $Language = $DbResult->fetch_assoc();
    127127      $this->Texts->Data = array();
    128128      $DbResult = $Database->select('Locale', '`Original`, `Translated`', '`Language`='.$Language['Id']);
    129       while($DbRow = $DbResult->fetch_assoc())
     129      while ($DbRow = $DbResult->fetch_assoc())
    130130        $this->Texts->Data[$DbRow['Original']] = $DbRow['Translated'];
    131131    }
     
    135135  {
    136136    $DbResult = $Database->select('Language', '*', 'Code='.$Database->quote($LangCode));
    137     if($DbResult->num_rows > 0)
     137    if ($DbResult->num_rows > 0)
    138138    {
    139139      $Language = $DbResult->fetch_assoc();
    140140      $Database->delete('Locale', '`Language`='.$Language['Id']);
    141       foreach($this->Texts->Data as $Index => $Item)
     141      foreach ($this->Texts->Data as $Index => $Item)
    142142        $Database->query('INSERT INTO `Locale` (`Language`,`Original`,`Translated`) '.
    143143        'VALUES('.$Language['Id'].','.$Database->quote($Index).','.$Database->quote($Item).')');
     
    148148  {
    149149    $DbResult = $Database->select('Language', '*', '`Code`='.$Database->quote($LangCode));
    150     if($DbResult->num_rows > 0)
     150    if ($DbResult->num_rows > 0)
    151151    {
    152152      $Language = $DbResult->fetch_assoc();
    153       foreach($this->Texts->Data as $Index => $Item)
     153      foreach ($this->Texts->Data as $Index => $Item)
    154154      {
    155155        $DbResult = $Database->select('Locale', '*', '(`Original` ='.$Database->quote($Index).
    156156          ') AND (`Language`='.($Language['Id']).')');
    157         if($DbResult->num_rows > 0)
     157        if ($DbResult->num_rows > 0)
    158158        $Database->update('Locale', '(`Language`='.($Language['Id']).') AND '.
    159159          '(`Original` ='.$Database->quote($Index).')', array('Translated' => $Item));
     
    188188    $this->Available = array();
    189189    $FileList = scandir($this->Dir);
    190     foreach($FileList as $FileName)
    191     {
    192       if(substr($FileName, -4) == '.php')
     190    foreach ($FileList as $FileName)
     191    {
     192      if (substr($FileName, -4) == '.php')
    193193      {
    194194        $Code = substr($FileName, 0, -4);
     
    206206    $Locale->AnalyzeCode($Directory);
    207207    $FileList = scandir($this->Dir);
    208     foreach($FileList as $FileName)
    209     {
    210       if(substr($FileName, -4) == '.php')
     208    foreach ($FileList as $FileName)
     209    {
     210      if (substr($FileName, -4) == '.php')
    211211      {
    212212        $FileLocale = new LocaleFile($this->System);
     
    215215
    216216        // Add new
    217         foreach($Locale->Texts->Data as $Index => $Item)
    218           if(!array_key_exists($Index, $FileLocale->Texts->Data))
     217        foreach ($Locale->Texts->Data as $Index => $Item)
     218          if (!array_key_exists($Index, $FileLocale->Texts->Data))
    219219            $FileLocale->Texts->Data[$Index] = $Item;
    220220        // Remove old
    221         foreach($FileLocale->Texts->Data as $Index => $Item)
    222           if(!array_key_exists($Index, $Locale->Texts->Data))
     221        foreach ($FileLocale->Texts->Data as $Index => $Item)
     222          if (!array_key_exists($Index, $Locale->Texts->Data))
    223223            unset($FileLocale->Texts->Data[$Index]);
    224224        $FileLocale->UpdateToDatabase($this->System->Database, $FileLocale->Texts->Code);
     
    232232  function LoadLocale($Code)
    233233  {
    234     if(array_key_exists($Code, $this->Available))
     234    if (array_key_exists($Code, $this->Available))
    235235    {
    236236      $this->CurrentLocale->Dir = $this->Dir;
     
    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

    r37 r55  
    6969  function Organization($org)
    7070  {
    71     if(trim($org != '')) $this->xheaders['Organization'] = $org;
     71    if (trim($org != '')) $this->xheaders['Organization'] = $org;
    7272  }
    7373
    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
     
    9696  function Send()
    9797  {
    98     if(count($this->Bodies) == 0) throw new Exception(T('Mail message need at least one text body'));
     98    if (count($this->Bodies) == 0) throw new Exception(T('Mail message need at least one text body'));
    9999
    100100    $Body = $this->BuildAttachment($this->BuildBody());
     
    103103    $this->Headers['CC'] = '';
    104104    $this->Headers['BCC'] = '';
    105     foreach($this->Recipients as $Index => $Recipient)
    106     {
    107       if($Recipient['Type'] == 'SendCombined')
    108       {
    109         if($Index > 0) $To .= ', ';
     105    foreach ($this->Recipients as $Index => $Recipient)
     106    {
     107      if ($Recipient['Type'] == 'SendCombined')
     108      {
     109        if ($Index > 0) $To .= ', ';
    110110        $To .= $Recipient['Address'];
    111111      } else
    112       if($Recipient['Type'] == 'Send')
    113       {
    114         if($Index > 0) $To .= ', ';
     112      if ($Recipient['Type'] == 'Send')
     113      {
     114        if ($Index > 0) $To .= ', ';
    115115        $To .= $Recipient['Name'].' <'.$Recipient['Address'].'>';
    116116      } else
    117       if($Recipient['Type'] == 'Copy')
    118       {
    119         if($Index > 0) $this->Headers['CC'] .= ', ';
     117      if ($Recipient['Type'] == 'Copy')
     118      {
     119        if ($Index > 0) $this->Headers['CC'] .= ', ';
    120120        $this->Headers['CC'] .= $Recipient['Name'].' <'.$To['Address'].'>';
    121121      } else
    122       if($Recipient['Type'] == 'HiddenCopy')
    123       {
    124         if($Index > 0) $this->Headers['BCC'] .= ', ';
     122      if ($Recipient['Type'] == 'HiddenCopy')
     123      {
     124        if ($Index > 0) $this->Headers['BCC'] .= ', ';
    125125        $this->Headers['BCC'] .= $Recipient['Name'].' <'.$To['Address'].'>';
    126126      }
    127127    }
    128     if($To == '') throw new Exception(T('Mail message need at least one recipient address'));
     128    if ($To == '') throw new Exception(T('Mail message need at least one recipient address'));
    129129
    130130    $this->Headers['Mime-Version'] = '1.0';
    131131
    132     if($this->AgentIdent != '') $this->Headers['X-Mailer'] = $this->AgentIdent;
    133     if($this->ReplyTo != '') $this->Headers['Reply-To'] = $this->ReplyTo;
    134     if($this->From != '') $this->Headers['From'] = $this->From;
     132    if ($this->AgentIdent != '') $this->Headers['X-Mailer'] = $this->AgentIdent;
     133    if ($this->ReplyTo != '') $this->Headers['Reply-To'] = $this->ReplyTo;
     134    if ($this->From != '') $this->Headers['From'] = $this->From;
    135135
    136136    $Headers = '';
    137     foreach($this->Headers as $Header => $Value)
    138     {
    139       if(($Header != 'Subject') and ($Value != '')) $Headers .= $Header.': '.$Value."\n";
     137    foreach ($this->Headers as $Header => $Value)
     138    {
     139      if (($Header != 'Subject') and ($Value != '')) $Headers .= $Header.': '.$Value."\n";
    140140    }
    141141
    142142    $this->Subject = strtr($this->Subject, "\r\n", '  ');
    143143
    144     if($this->Subject == '') throw new Exception(T('Mail message missing Subject'));
     144    if ($this->Subject == '') throw new Exception(T('Mail message missing Subject'));
    145145
    146146
    147147    $res = mail($To, $this->Subject, $Body, $Headers);
    148     return($res);
     148    return $res;
    149149  }
    150150
    151151  function ValidEmail($Address)
    152152  {
    153     if(ereg(".*<(.+)>", $Address, $regs)) $Address = $regs[1];
    154     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);
     153    if (ereg(".*<(.+)>", $Address, $regs)) $Address = $regs[1];
     154    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;
    157157  }
    158158
    159159  function CheckAdresses($Addresses)
    160160  {
    161     foreach($Addresses as $Address)
    162     {
    163       if(!$this->ValidEmail($Address))
     161    foreach ($Addresses as $Address)
     162    {
     163      if (!$this->ValidEmail($Address))
    164164  throw new Exception(sprintf(T('Mail message invalid address %s'), $Address));
    165165    }
     
    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
    174174  private function BuildAttachment($Body)
    175175  {
    176     if(count($this->Attachments) > 0)
     176    if (count($this->Attachments) > 0)
    177177    {
    178178      $this->Headers['Content-Type'] = "multipart/mixed;\n boundary=\"PHP-mixed-".$this->Boundary."\"";
     
    181181      $Result .= $Body;
    182182
    183       foreach($this->Attachments as $Attachment)
     183      foreach ($this->Attachments as $Attachment)
    184184      {
    185185        $FileName = $Attachment['FileName'];
     
    187187        $ContentType = $Attachment['FileType'];
    188188        $Disposition = $Attachment['Disposition'];
    189         if($Attachment['Type'] == 'File')
     189        if ($Attachment['Type'] == 'File')
    190190        {
    191           if(!file_exists($FileName))
     191          if (!file_exists($FileName))
    192192            throw new Exception(sprintf(T('Mail message attached file %s can\'t be found'), $FileName));
    193193          $Data = file_get_contents($FileName);
    194194        } else
    195         if($Attachment['Type'] == 'Data') $Data = $Attachment['Data'];
     195        if ($Attachment['Type'] == 'Data') $Data = $Attachment['Data'];
    196196          else $Data = '';
    197197
     
    203203      }
    204204    } else $Result = $Body;
    205     return($Result);
     205    return $Result;
    206206  }
    207207
     
    209209  {
    210210    $Result = '';
    211     if(count($this->Bodies) > 1)
     211    if (count($this->Bodies) > 1)
    212212    {
    213213      $this->Headers['Content-Type'] = 'multipart/alternative; boundary="PHP-alt-'.$this->Boundary.'"';
     
    221221
    222222
    223     foreach($this->Bodies as $Body)
    224     {
    225       if(count($this->Bodies) > 1) $Result .= "\n\n".'--PHP-alt-'.$this->Boundary."\n";
     223    foreach ($this->Bodies as $Body)
     224    {
     225      if (count($this->Bodies) > 1) $Result .= "\n\n".'--PHP-alt-'.$this->Boundary."\n";
    226226      $Result .= 'Content-Type: '.$Body['Type'].'; charset='.$Body['Charset'].
    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

    r37 r55  
    1414  function GetNetMask()
    1515  {
    16     return(0xffffffff ^ ((1 << (32 - $this->Prefix)) - 1));
     16    return 0xffffffff ^ ((1 << (32 - $this->Prefix)) - 1);
    1717  }
    1818
    1919  function AddressToString()
    2020  {
    21     return(implode('.', array(($this->Address >> 24) & 255, ($this->Address >> 16) & 255, ($this->Address >> 8) & 255, ($this->Address & 255))));
     21    return implode('.', array(($this->Address >> 24) & 255, ($this->Address >> 16) & 255, ($this->Address >> 8) & 255, ($this->Address & 255)));
    2222  }
    2323
     
    3737    $To->Address = $From->Address + $HostMask;
    3838    $To->Prefix = 32;
    39     return(array('From' => $From, 'To' => $To));
     39    return array('From' => $From, 'To' => $To);
    4040  }
    4141
     
    4343  {
    4444    $this->Prefix = $NewPrefix;
    45     if($this->Prefix > 32) $this->Prefix = 32;
    46     if($this->Prefix < 0) $this->Prefix = 0;
     45    if ($this->Prefix > 32) $this->Prefix = 32;
     46    if ($this->Prefix < 0) $this->Prefix = 0;
    4747    $this->Address = $this->Address & $this->GetNetMask();
    4848  }
     
    5151  {
    5252    $UpperNetmask = $this->GetNetMask();
    53     if(($this->Prefix < $Address->Prefix) and (($Address->Address & $UpperNetmask) == ($this->Address & $UpperNetmask))) $Result = true;
     53    if (($this->Prefix < $Address->Prefix) and (($Address->Address & $UpperNetmask) == ($this->Address & $UpperNetmask))) $Result = true;
    5454      else $Result = false;
    5555    //echo($Address->AddressToString().'/'.$Address->Prefix.' in '.$this->AddressToString().'/'.$this->Prefix.' '.$Result."\n");
    56     return($Result);
     56    return $Result;
    5757  }
    5858}
     
    7171  function AddressToString()
    7272  {
    73     return(inet_ntop($this->Address));
     73    return inet_ntop($this->Address);
    7474  }
    7575
     
    8383    $Result = array();
    8484    $Data = array_reverse(unpack('C*', $this->Address));
    85     foreach($Data as $Item)
     85    foreach ($Data as $Item)
    8686    {
    8787
     
    8989      $Result[] = dechex(($Item >> 4) & 15);
    9090    }
    91     return($Result);
     91    return $Result;
    9292  }
    9393
  • trunk/Packages/Common/Page.php

    r37 r55  
    1818  function Show()
    1919  {
    20     return('');
     20    return '';
    2121  }
    2222
     
    2424  {
    2525    $Output = $this->Show();
    26     return($Output);
     26    return $Output;
    2727  }
    2828
    2929  function SystemMessage($Title, $Text)
    3030  {
    31     return(call_user_func_array($this->OnSystemMessage, array($Title, $Text)));
     31    return call_user_func_array($this->OnSystemMessage, array($Title, $Text));
    3232  }
    3333}
  • trunk/Packages/Common/PrefixMultiplier.php

    r37 r55  
    7474  function TruncateDigits($Value, $Digits = 4)
    7575  {
    76     for($II = 2; $II > -6; $II--)
     76    for ($II = 2; $II > -6; $II--)
    7777    {
    78       if($Value >= pow(10, $II))
     78      if ($Value >= pow(10, $II))
    7979      {
    80         if($Digits < ($II + 1)) $RealDigits = $II + 1;
     80        if ($Digits < ($II + 1)) $RealDigits = $II + 1;
    8181          else $RealDigits = $Digits;
    8282        $Value = round($Value / pow(10, $II - $RealDigits + 1)) * pow(10, $II - $RealDigits + 1);
     
    8484      }
    8585    }
    86     return($Value);
     86    return $Value;
    8787  }
    8888
     
    9393    $Negative = ($Value < 0);
    9494    $Value = abs($Value);
    95     if(($Unit == '') and ($PrefixType != 'Time'))
    96       return($this->TruncateDigits($Value, $Digits));
     95    if (($Unit == '') and ($PrefixType != 'Time'))
     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
    101     if($Value > 1)
     101    if ($Value > 1)
    102102    {
    103       while((($I + 1) <= count($PrefixMultipliers[$PrefixType]['Definition'])) and (($Value / $PrefixMultipliers[$PrefixType]['Definition'][$I + 1][2]) > 1))
     103      while ((($I + 1) <= count($PrefixMultipliers[$PrefixType]['Definition'])) and (($Value / $PrefixMultipliers[$PrefixType]['Definition'][$I + 1][2]) > 1))
    104104        $I = $I + 1;
    105105    } else
    106     if($Value < 1)
     106    if ($Value < 1)
    107107    {
    108       while((($I - 1) >= 0) and (($Value / $PrefixMultipliers[$PrefixType]['Definition'][$I][2]) < 1))
     108      while ((($I - 1) >= 0) and (($Value / $PrefixMultipliers[$PrefixType]['Definition'][$I][2]) < 1))
    109109        $I = $I - 1;
    110110    }
     
    113113    // Truncate digits count
    114114    $Value = $this->TruncateDigits($Value, $Digits);
    115     if($Negative) $Value = -$Value;
    116     return($Value.' '.$PrefixMultipliers[$PrefixType]['Definition'][$I][0].$Unit);
     115    if ($Negative) $Value = -$Value;
     116    return $Value.' '.$PrefixMultipliers[$PrefixType]['Definition'][$I][0].$Unit;
    117117  }
    118118}
  • trunk/Packages/Common/RSS.php

    r37 r55  
    2929      "    <pubDate>".date('r')."</pubDate>\n".
    3030      "    <ttl>20</ttl>\n";
    31     foreach($this->Items as $Item)
     31    foreach ($this->Items as $Item)
    3232    {
    3333      $Result .= "    <item>\n".
     
    4040    $Result .= "  </channel>\n".
    4141    "</rss>";
    42     return($Result);
     42    return $Result;
    4343  }
    4444}
  • trunk/Packages/Common/Setup.php

    r37 r55  
    2929      '<input type="submit" name="login" value="'.T('Login').'"/>'.
    3030      '</form>';
    31     return($Output);
     31    return $Output;
    3232  }
    3333
     
    3737
    3838    $Output .= 'Je připojení k databázi: '.$this->YesNo[$this->UpdateManager->Database->Connected()].'<br/>';
    39     if($this->UpdateManager->Database->Connected())
     39    if ($this->UpdateManager->Database->Connected())
    4040    {
    4141      $Output .= 'Je instalováno: '.$this->YesNo[$this->UpdateManager->IsInstalled()].'<br/>';
    42       if($this->UpdateManager->IsInstalled())
     42      if ($this->UpdateManager->IsInstalled())
    4343        $Output .= 'Je aktuální: '.$this->YesNo[$this->UpdateManager->IsUpToDate()].'<br/>'.
    4444        'Verze databáze: '.$this->UpdateManager->GetDbVersion().'<br/>';
    4545      $Output .= 'Verze databáze kódu: '.$this->UpdateManager->Revision.'<br/>';
    46       if($this->UpdateManager->IsInstalled())
    47       {
    48         if(!$this->UpdateManager->IsUpToDate())
     46      if ($this->UpdateManager->IsInstalled())
     47      {
     48        if (!$this->UpdateManager->IsUpToDate())
    4949          $Output .= '<a href="?action=upgrade">'.T('Upgrade').'</a> ';
    5050        $Output .= '<a href="?action=insert_sample_data">Vložit vzorová data</a> ';
     
    5959    $Output .= '<a href="'.$this->System->Link('/').'">'.T('Go to main page').'</a> ';
    6060    $Output .= '';
    61     return($Output);
     61    return $Output;
    6262  }
    6363
     
    7373
    7474    $Output = '';
    75     if(isset($this->Config))
    76     {
    77       if(!array_key_exists('SystemPassword', $_SESSION)) $_SESSION['SystemPassword'] = '';
    78       if(array_key_exists('login', $_POST)) $_SESSION['SystemPassword'] = $_POST['SystemPassword'];
    79       if(sha1($_SESSION['SystemPassword']) != $this->Config['SystemPassword'])
     75    if (isset($this->Config))
     76    {
     77      if (!array_key_exists('SystemPassword', $_SESSION)) $_SESSION['SystemPassword'] = '';
     78      if (array_key_exists('login', $_POST)) $_SESSION['SystemPassword'] = $_POST['SystemPassword'];
     79      if (sha1($_SESSION['SystemPassword']) != $this->Config['SystemPassword'])
    8080      {
    8181        $Output .= $this->LoginPanel();
    8282      } else
    8383      {
    84         if(array_key_exists('action', $_GET)) $Action = $_GET['action'];
     84        if (array_key_exists('action', $_GET)) $Action = $_GET['action'];
    8585          else $Action = '';
    86         if($Action == 'logout')
     86        if ($Action == 'logout')
    8787        {
    8888          $_SESSION['SystemPassword'] = '';
     
    9090          $Output .= $this->LoginPanel();
    9191        } else
    92         if($Action == 'models')
     92        if ($Action == 'models')
    9393        {
    9494          $this->System->FormManager->UpdateSQLMeta();
    9595        } else
    96         if($Action == 'upgrade')
     96        if ($Action == 'upgrade')
    9797        {
    9898          $Output .= '<h3>Povýšení</h3>';
     
    105105          $Output .= $this->ControlPanel();
    106106        } else
    107         if($Action == 'install')
     107        if ($Action == 'install')
    108108        {
    109109          $Output .= '<h3>Instalace</h3>';
     
    114114          $Output .= $this->ControlPanel();
    115115        } else
    116         if($Action == 'uninstall')
     116        if ($Action == 'uninstall')
    117117        {
    118118          $Output .= '<h3>Odinstalace</h3>';
     
    120120          $Output .= $this->ControlPanel();
    121121        } else
    122         if($Action == 'reload_modules')
     122        if ($Action == 'reload_modules')
    123123        {
    124124          $Output .= '<h3>Znovunačtení seznamu modulů</h3>';
     
    127127          $Output .= $this->ControlPanel();
    128128        } else
    129         if($Action == 'insert_sample_data')
     129        if ($Action == 'insert_sample_data')
    130130        {
    131131          $Output .= '<h3>Vložení vzorových dat</h3>';
     
    133133          $Output .= $this->ControlPanel();
    134134        } else
    135         if($Action == 'modules')
     135        if ($Action == 'modules')
    136136        {
    137137          $Output .= $this->ShowModules();
    138138        } else
    139         if($Action == 'configure_save')
     139        if ($Action == 'configure_save')
    140140        {
    141141           $Output .= $this->ConfigSave($this->Config);
    142142           $Output .= $this->ControlPanel();
    143143        } else
    144         if($Action == 'configure')
     144        if ($Action == 'configure')
    145145        {
    146146          $Output .= $this->PrepareConfig($this->Config);
     
    152152    } else
    153153    {
    154       if(array_key_exists('configure_save', $_POST))
     154      if (array_key_exists('configure_save', $_POST))
    155155      {
    156156        $Output .= $this->ConfigSave(array());
     
    160160      }
    161161    }
    162     return($Output);
     162    return $Output;
    163163  }
    164164
     
    166166  {
    167167    $Output = '';
    168     if(array_key_exists('op', $_GET)) $Operation = $_GET['op'];
     168    if (array_key_exists('op', $_GET)) $Operation = $_GET['op'];
    169169      else $Operation = '';
    170     if($Operation == 'install')
     170    if ($Operation == 'install')
    171171    {
    172172      $this->System->ModuleManager->Modules[$_GET['name']]->Install();
     
    174174      $Output .= 'Modul '.$_GET['name'].' instalován<br/>';
    175175    } else
    176     if($Operation == 'uninstall')
     176    if ($Operation == 'uninstall')
    177177    {
    178178      $this->System->ModuleManager->Modules[$_GET['name']]->Uninstall();
     
    180180      $Output .= 'Modul '.$_GET['name'].' odinstalován<br/>';
    181181    } else
    182     if($Operation == 'enable')
     182    if ($Operation == 'enable')
    183183    {
    184184      $this->System->ModuleManager->Modules[$_GET['name']]->Enable();
     
    186186      $Output .= 'Modul '.$_GET['name'].' povolen<br/>';
    187187    } else
    188     if($Operation == 'disable')
     188    if ($Operation == 'disable')
    189189    {
    190190      $this->System->ModuleManager->Modules[$_GET['name']]->Disable();
     
    192192      $Output .= 'Modul '.$_GET['name'].' zakázán<br/>';
    193193    } else
    194     if($Operation == 'upgrade')
     194    if ($Operation == 'upgrade')
    195195    {
    196196      $this->System->ModuleManager->Modules[$_GET['name']]->Upgrade();
     
    200200    $Output .= '<h3>Správa modulů</h3>';
    201201    $Output .= $this->ShowList();
    202     return($Output);
     202    return $Output;
    203203  }
    204204
     
    221221      array('Name' => '', 'Title' => 'Akce'),
    222222    ));
    223     foreach($this->System->ModuleManager->Modules as $Module)
    224     {
    225       if(($Module->Dependencies) > 0) $Dependencies = implode(',', $Module->Dependencies);
     223    foreach ($this->System->ModuleManager->Modules as $Module)
     224    {
     225      if (($Module->Dependencies) > 0) $Dependencies = implode(',', $Module->Dependencies);
    226226       else $Dependencies = '&nbsp;';
    227227      $Actions = '';
    228       if($Module->Installed == true)
     228      if ($Module->Installed == true)
    229229      {
    230230        $Actions .= ' <a href="?action=modules&amp;op=uninstall&amp;name='.$Module->Name.'">Odinstalovat</a>';
    231         if($Module->Enabled == true) $Actions .= ' <a href="?action=modules&amp;op=disable&amp;name='.$Module->Name.'">Zakázat</a>';
     231        if ($Module->Enabled == true) $Actions .= ' <a href="?action=modules&amp;op=disable&amp;name='.$Module->Name.'">Zakázat</a>';
    232232        else $Actions .= ' <a href="?action=modules&amp;op=enable&amp;name='.$Module->Name.'">Povolit</a>';
    233         if($Module->InstalledVersion != $Module->Version) $Actions .= ' <a href="?action=modules&amp;op=upgrade&amp;name='.$Module->Name.'">Povýšit</a>';
     233        if ($Module->InstalledVersion != $Module->Version) $Actions .= ' <a href="?action=modules&amp;op=upgrade&amp;name='.$Module->Name.'">Povýšit</a>';
    234234      } else $Actions .= ' <a href="?action=modules&amp;op=install&amp;name='.$Module->Name.'">Instalovat</a>';
    235235
     
    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
     
    250250  {
    251251    $Output = '';
    252     if(!file_exists($this->ConfigDir.'/Config.php') and !is_writable($this->ConfigDir))
     252    if (!file_exists($this->ConfigDir.'/Config.php') and !is_writable($this->ConfigDir))
    253253      $Output .= 'Varování: Konfigurační soubor nebude možné zapsat, protože složka "'.$this->ConfigDir.'" není povolená pro zápis!';
    254     if(file_exists($this->ConfigDir.'/Config.php') and !is_writable($this->ConfigDir.'/Config.php'))
     254    if (file_exists($this->ConfigDir.'/Config.php') and !is_writable($this->ConfigDir.'/Config.php'))
    255255      $Output .= 'Varování: Konfigurační soubor nebude možné zapsat, protože soubor "'.$this->ConfigDir.'/Config.php" není povolen pro zápis!';
    256256    $Output .= '<h3>Nastavení systému</h3>'.
    257257        '<form action="?action=configure_save" method="post">'.
    258258        '<table>';
    259     foreach($this->ConfigDefinition as $Def)
     259    foreach ($this->ConfigDefinition as $Def)
    260260    {
    261261      $PathParts = explode('/', $Def['Name']);
    262262      $TempConfig = &$Config;
    263       foreach($PathParts as $Part)
    264         if(array_key_exists($Part, $TempConfig))
     263      foreach ($PathParts as $Part)
     264        if (array_key_exists($Part, $TempConfig))
    265265        {
    266266          $TempConfig = &$TempConfig[$Part];
    267267        }
    268       if(!is_array($TempConfig)) $Value = $TempConfig;
     268      if (!is_array($TempConfig)) $Value = $TempConfig;
    269269        else $Value = $Def['Default'];
    270270      $Output .= '<tr><td>'.$Def['Title'].'</td><td>';
    271       if($Def['Type'] == 'String') $Output .= '<input type="text" name="'.$Def['Name'].'" value="'.$Value.'"/>';
    272       if($Def['Type'] == 'Password') $Output .= '<input type="password" name="'.$Def['Name'].'"/>';
    273       if($Def['Type'] == 'PasswordEncoded') $Output .= '<input type="password" name="'.$Def['Name'].'"/>';
    274       if($Def['Type'] == 'Integer') $Output .= '<input type="text" name="'.$Def['Name'].'" value="'.$Value.'"/>';
    275       if($Def['Type'] == 'Float') $Output .= '<input type="text" name="'.$Def['Name'].'" value="'.$Value.'"/>';
    276       if($Def['Type'] == 'Boolean') $Output .= '<input type="text" name="'.$Def['Name'].'" value="'.$Value.'"/>';
    277       if($Def['Type'] == 'Array') $Output .= '<input type="text" name="'.$Def['Name'].'" value="'.implode(',', $Value).'"/>';
     271      if ($Def['Type'] == 'String') $Output .= '<input type="text" name="'.$Def['Name'].'" value="'.$Value.'"/>';
     272      if ($Def['Type'] == 'Password') $Output .= '<input type="password" name="'.$Def['Name'].'"/>';
     273      if ($Def['Type'] == 'PasswordEncoded') $Output .= '<input type="password" name="'.$Def['Name'].'"/>';
     274      if ($Def['Type'] == 'Integer') $Output .= '<input type="text" name="'.$Def['Name'].'" value="'.$Value.'"/>';
     275      if ($Def['Type'] == 'Float') $Output .= '<input type="text" name="'.$Def['Name'].'" value="'.$Value.'"/>';
     276      if ($Def['Type'] == 'Boolean') $Output .= '<input type="text" name="'.$Def['Name'].'" value="'.$Value.'"/>';
     277      if ($Def['Type'] == 'Array') $Output .= '<input type="text" name="'.$Def['Name'].'" value="'.implode(',', $Value).'"/>';
    278278    }
    279279    $Output .= '</td></tr>'.
     
    281281        '</table>'.
    282282        '</form>';
    283     return($Output);
     283    return $Output;
    284284  }
    285285
     
    287287  {
    288288    $Config = $DefaultConfig;
    289     foreach($this->ConfigDefinition as $Def)
     289    foreach ($this->ConfigDefinition as $Def)
    290290    {
    291291      $Value = null;
    292       if($Def['Type'] == 'String') if(array_key_exists($Def['Name'], $_POST))
     292      if ($Def['Type'] == 'String') if (array_key_exists($Def['Name'], $_POST))
    293293        $Value = $_POST[$Def['Name']];
    294       if($Def['Type'] == 'Password') if(array_key_exists($Def['Name'], $_POST) and ($_POST[$Def['Name']] != ''))
     294      if ($Def['Type'] == 'Password') if (array_key_exists($Def['Name'], $_POST) and ($_POST[$Def['Name']] != ''))
    295295        $Value = $_POST[$Def['Name']];
    296       if($Def['Type'] == 'PasswordEncoded') if(array_key_exists($Def['Name'], $_POST) and ($_POST[$Def['Name']] != ''))
     296      if ($Def['Type'] == 'PasswordEncoded') if (array_key_exists($Def['Name'], $_POST) and ($_POST[$Def['Name']] != ''))
    297297        $Value = sha1($_POST[$Def['Name']]);
    298       if($Def['Type'] == 'Integer') if(array_key_exists($Def['Name'], $_POST))
     298      if ($Def['Type'] == 'Integer') if (array_key_exists($Def['Name'], $_POST))
    299299        $Value = $_POST[$Def['Name']];
    300       if($Def['Type'] == 'Float') if(array_key_exists($Def['Name'], $_POST))
     300      if ($Def['Type'] == 'Float') if (array_key_exists($Def['Name'], $_POST))
    301301        $Value = $_POST[$Def['Name']];
    302       if($Def['Type'] == 'Boolean') if(array_key_exists($Def['Name'], $_POST))
     302      if ($Def['Type'] == 'Boolean') if (array_key_exists($Def['Name'], $_POST))
    303303        $Value = $_POST[$Def['Name']];
    304       if($Def['Type'] == 'Array') if(array_key_exists($Def['Name'], $_POST))
     304      if ($Def['Type'] == 'Array') if (array_key_exists($Def['Name'], $_POST))
    305305        $Value = explode(',', $_POST[$Def['Name']]);
    306       if(!is_null($Value))
     306      if (!is_null($Value))
    307307      {
    308308        $PathParts = explode('/', $Def['Name']);
    309309        $TempConfig = &$Config;
    310         foreach($PathParts as $Part)
     310        foreach ($PathParts as $Part)
    311311        {
    312312          $TempConfig = &$TempConfig[$Part];
    313313        }
    314         if(!is_array($TempConfig)) $TempConfig = $Value;
     314        if (!is_array($TempConfig)) $TempConfig = $Value;
    315315        else $Value = $Def['Default'];
    316316      }
     
    319319    file_put_contents($this->ConfigDir.'/Config.php', $ConfigText);
    320320    $Output = 'Konfigurace nastavena<br/>';
    321     return($Output);
     321    return $Output;
    322322  }
    323323
     
    327327      "\$IsDeveloper = array_key_exists('REMOTE_ADDR', \$_SERVER) and  in_array(\$_SERVER['REMOTE_ADDR'], array('127.0.0.1'));\n\n";
    328328
    329     foreach($this->ConfigDefinition as $Def)
     329    foreach ($this->ConfigDefinition as $Def)
    330330    {
    331331      $PathParts = explode('/', $Def['Name']);
    332332      $Output .= "\$Config";
    333       foreach($PathParts as $Part)
     333      foreach ($PathParts as $Part)
    334334        $Output .= "['".$Part."']";
    335335      $TempConfig = &$Config;
    336336      $Output .= ' = ';
    337       foreach($PathParts as $Part)
    338         if(array_key_exists($Part, $TempConfig))
     337      foreach ($PathParts as $Part)
     338        if (array_key_exists($Part, $TempConfig))
    339339        {
    340340          $TempConfig = &$TempConfig[$Part];
    341341        }
    342       if(!is_array($TempConfig)) $Value = $TempConfig;
     342      if (!is_array($TempConfig)) $Value = $TempConfig;
    343343        else $Value = $Def['Default'];
    344       if($Def['Type'] == 'Array')
     344      if ($Def['Type'] == 'Array')
    345345      {
    346346        $Output .= ' array(';
    347         foreach($Value as $Index => $Item)
     347        foreach ($Value as $Index => $Item)
    348348          $Output .= '\''.$Item.'\', ';
    349349        $Output .= ')';
     
    353353    }
    354354    $Output .= "\n\n";
    355     return($Output);
     355    return $Output;
    356356  }
    357357}
     
    362362  {
    363363    $Output = '';
    364     if(!$this->Database->Connected()) $Output .= T('Can\'t connect to database').'<br>';
     364    if (!$this->Database->Connected()) $Output .= T('Can\'t connect to database').'<br>';
    365365    else {
    366       if(!$this->System->Setup->UpdateManager->IsInstalled())
     366      if (!$this->System->Setup->UpdateManager->IsInstalled())
    367367        $Output .= T('System requires database initialization').'<br>';
    368368      else
    369       if(!$this->System->Setup->UpdateManager->IsUpToDate())
     369      if (!$this->System->Setup->UpdateManager->IsUpToDate())
    370370        $Output .= T('System requires database upgrade').'<br>';
    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    $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

    r37 r55  
    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
     
    6262    $this->Cells = array();
    6363    $DbResult = $this->Database->query($this->Query);
    64     while($DbRow = $DbResult->fetch_row())
     64    while ($DbRow = $DbResult->fetch_row())
    6565    {
    6666      $this->Cells[] = $DbRow;
     
    7575  function RowsCount()
    7676  {
    77     return(count($this->Cells));
     77    return count($this->Cells);
    7878  }
    7979}
     
    114114  {
    115115    $this->Columns = array();
    116     foreach($Columns as $Column)
     116    foreach ($Columns as $Column)
    117117    {
    118118      $NewCol = new TableColumn();
     
    121121      $this->Columns[] = $NewCol;
    122122    }
    123     if(count($this->Columns) > 0)
     123    if (count($this->Columns) > 0)
    124124      $this->DefaultColumn = $this->Columns[0]->Name;
    125125      else $this->DefaultColumn = '';
     
    131131    $Output .= $this->GetOrderHeader();
    132132    $this->Table->BeginRead();
    133     for($Y = 0; $Y < $this->Table->RowsCount(); $Y++)
     133    for ($Y = 0; $Y < $this->Table->RowsCount(); $Y++)
    134134    {
    135135      $Output .= '<tr>';
    136136
    137       for($X = 0; $X < count($this->Columns); $X++)
     137      for ($X = 0; $X < count($this->Columns); $X++)
    138138      {
    139139        $Cell = $this->Table->GetCell($Y, $X);
    140         if($Cell == '') $Output .= '<td>&nbsp;</td>';
     140        if ($Cell == '') $Output .= '<td>&nbsp;</td>';
    141141          else $Output .= '<td>'.$Cell.'</td>';
    142142      }
     
    145145    $this->Table->EndRead();
    146146    $Output .= '</table>';
    147     return($Output);
     147    return $Output;
    148148  }
    149149
    150150  function GetOrderHeader()
    151151  {
    152     if(array_key_exists('OrderCol', $_GET)) $_SESSION['OrderCol'] = $_GET['OrderCol'];
    153     if(array_key_exists('OrderDir', $_GET)) $_SESSION['OrderDir'] = $_GET['OrderDir'];
    154     if(!array_key_exists('OrderCol', $_SESSION)) $_SESSION['OrderCol'] = $this->DefaultColumn;
    155     if(!array_key_exists('OrderDir', $_SESSION)) $_SESSION['OrderDir'] = $this->DefaultOrder;
     152    if (array_key_exists('OrderCol', $_GET)) $_SESSION['OrderCol'] = $_GET['OrderCol'];
     153    if (array_key_exists('OrderDir', $_GET)) $_SESSION['OrderDir'] = $_GET['OrderDir'];
     154    if (!array_key_exists('OrderCol', $_SESSION)) $_SESSION['OrderCol'] = $this->DefaultColumn;
     155    if (!array_key_exists('OrderDir', $_SESSION)) $_SESSION['OrderDir'] = $this->DefaultOrder;
    156156
    157157    // Check OrderCol
    158158    $Found = false;
    159     foreach($this->Columns as $Column)
     159    foreach ($this->Columns as $Column)
    160160    {
    161       if($Column->Name == $_SESSION['OrderCol'])
     161      if ($Column->Name == $_SESSION['OrderCol'])
    162162      {
    163163        $Found = true;
     
    165165      }
    166166    }
    167     if($Found == false)
     167    if ($Found == false)
    168168    {
    169169      $_SESSION['OrderCol'] = $this->DefaultColumn;
     
    171171    }
    172172    // Check OrderDir
    173     if(($_SESSION['OrderDir'] != 0) and ($_SESSION['OrderDir'] != 1))
     173    if (($_SESSION['OrderDir'] != 0) and ($_SESSION['OrderDir'] != 1))
    174174      $_SESSION['OrderDir'] = 0;
    175175
    176176    $Result = '';
    177177    $QueryItems = GetQueryStringArray($_SERVER['QUERY_STRING']);
    178     foreach($this->Columns as $Index => $Column)
     178    foreach ($this->Columns as $Index => $Column)
    179179    {
    180180      $QueryItems['OrderCol'] = $Column->Name;
    181181      $QueryItems['OrderDir'] = 1 - $_SESSION['OrderDir'];
    182       if($Column->Name == $_SESSION['OrderCol'])
     182      if ($Column->Name == $_SESSION['OrderCol'])
    183183        $ArrowImage = '<img style="vertical-align: middle; border: 0px;" src="'.$this->OrderArrowImage[$_SESSION['OrderDir']].'" alt="order arrow">';
    184184        else $ArrowImage = '';
    185       if($Column->Name == '') $Result .= '<th>'.$Column->Title.'</th>';
     185      if ($Column->Name == '') $Result .= '<th>'.$Column->Title.'</th>';
    186186        else $Result .= '<th><a href="?'.SetQueryStringArray($QueryItems).'">'.$Column->Title.$ArrowImage.'</a></th>';
    187187    }
     
    190190    $this->OrderDirection = $_SESSION['OrderDir'];
    191191
    192     return('<tr>'.$Result.'</tr>');
     192    return '<tr>'.$Result.'</tr>';
    193193  }
    194194}
  • trunk/Packages/Common/UTF8.php

    r37 r55  
    529529  {
    530530    $Result = '';
    531     for($I = 0; $I < strlen($String); $I++)
     531    for ($I = 0; $I < strlen($String); $I++)
    532532    {
    533        if(ord($String[$I]) < 128) $Result .= $String[$I];
    534        else if(ord($String[$I]) > 127)
     533       if (ord($String[$I]) < 128) $Result .= $String[$I];
     534       else if (ord($String[$I]) > 127)
    535535       {
    536536         $Result .= $this->CharTable[$Charset][ord($String[$I])];
    537537       }
    538538    }
    539     return($Result);
     539    return $Result;
    540540  }
    541541
     
    544544    $Result = '';
    545545    $UTFPrefix = '';
    546     for($I = 0; $I < strlen($String); $I++)
     546    for ($I = 0; $I < strlen($String); $I++)
    547547    {
    548       if(ord($String{$I}) & 0x80) // UTF control character
     548      if (ord($String{$I}) & 0x80) // UTF control character
    549549      {
    550         if(ord($String{$I}) & 0x40) // First
     550        if (ord($String{$I}) & 0x40) // First
    551551        {
    552           if($UTFPrefix != '') $Result .= chr(array_search($UTFPrefix, $this->CharTable[$Charset]));
     552          if ($UTFPrefix != '') $Result .= chr(array_search($UTFPrefix, $this->CharTable[$Charset]));
    553553          $UTFPrefix = $String{$I};
    554554        }
     
    556556      } else
    557557      {
    558         if($UTFPrefix != '') $Result .= chr(array_search($UTFPrefix, $this->CharTable[$Charset]));
     558        if ($UTFPrefix != '') $Result .= chr(array_search($UTFPrefix, $this->CharTable[$Charset]));
    559559        $UTFPrefix = '';
    560560        $Result .= $String{$I};
    561561      }
    562562    }
    563     return($Result);
     563    return $Result;
    564564  }
    565565}
  • trunk/Packages/Common/Update.php

    r37 r55  
    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
     
    4141    $DbRevision = $this->GetDbVersion();
    4242    $Output = 'Počáteční revize databáze: '.$DbRevision.'<br/>';
    43     while($this->Revision > $DbRevision)
     43    while ($this->Revision > $DbRevision)
    4444    {
    4545      $TraceItem = $this->Trace[$DbRevision];
     
    5454        $TraceItem['Revision'].' WHERE `Id`=1');
    5555    }
    56     return($Output);
     56    return $Output;
    5757  }
    5858
     
    7979    echo($Query.';<br/>');
    8080    flush();
    81     return($this->Database->query($Query));
     81    return $this->Database->query($Query);
    8282  }
    8383}
  • trunk/Packages/Common/VarDumper.php

    r37 r55  
    4949                self::$_depth=$depth;
    5050                self::dumpInternal($var,0);
    51                 if($highlight)
     51                if ($highlight)
    5252                {
    5353                        $result=highlight_string("<?php\n".self::$_output,true);
     
    6060        private static function dumpInternal($var,$level)
    6161        {
    62                 switch(gettype($var))
     62                switch (gettype($var))
    6363                {
    6464                        case 'boolean':
     
    8484                                break;
    8585                        case 'array':
    86                                 if(self::$_depth<=$level)
     86                                if (self::$_depth<=$level)
    8787                                        self::$_output.='array(...)';
    88                                 else if(empty($var))
     88                                else if (empty($var))
    8989                                        self::$_output.='array()';
    9090                                else
     
    9393                                        $spaces=str_repeat(' ',$level*4);
    9494                                        self::$_output.="array\n".$spaces.'(';
    95                                         foreach($keys as $key)
     95                                        foreach ($keys as $key)
    9696                                        {
    9797                                                self::$_output.="\n".$spaces."    [$key] => ";
     
    102102                                break;
    103103                        case 'object':
    104                                 if(($id=array_search($var,self::$_objects,true))!==false)
     104                                if (($id=array_search($var,self::$_objects,true))!==false)
    105105                                        self::$_output.=get_class($var).'#'.($id+1).'(...)';
    106                                 else if(self::$_depth<=$level)
     106                                else if (self::$_depth<=$level)
    107107                                        self::$_output.=get_class($var).'(...)';
    108108                                else
     
    114114                                        $spaces=str_repeat(' ',$level*4);
    115115                                        self::$_output.="$className#$id\n".$spaces.'(';
    116                                         foreach($keys as $key)
     116                                        foreach ($keys as $key)
    117117                                        {
    118118                                                $keyDisplay=strtr(trim($key),array("\0"=>':'));
  • trunk/View.php

    r39 r55  
    2727
    2828    // TODO: Move to external code
    29     if(isset($this->System->Config['Web']['FormatHTML']))
     29    if (isset($this->System->Config['Web']['FormatHTML']))
    3030      $this->FormatHTML = $this->System->Config['Web']['FormatHTML'];
    31     if(isset($this->System->Config['Web']['ShowRuntimeInfo']))
     31    if (isset($this->System->Config['Web']['ShowRuntimeInfo']))
    3232      $this->ShowRuntimeInfo = $this->System->Config['Web']['ShowRuntimeInfo'];
    33     if(isset($this->System->Config['Web']['Charset']))
     33    if (isset($this->System->Config['Web']['Charset']))
    3434      $this->Encoding = $this->System->Config['Web']['Charset'];
    35     if(isset($this->System->Config['Web']['Style']))
     35    if (isset($this->System->Config['Web']['Style']))
    3636      $this->Style = $this->System->Config['Web']['Style'];
    3737  }
     
    3939  function SystemMessage($Title, $Text)
    4040  {
    41     return('<table align="center"><tr><td><div class="SystemMessage"><h3>'.$Title.'</h3><div>'.$Text.'</div></div></td></tr></table>');
     41    return '<table align="center"><tr><td><div class="SystemMessage"><h3>'.$Title.'</h3><div>'.$Text.'</div></div></td></tr></table>';
    4242    //ShowFooter();
    4343    //die();
     
    4646  function ShowNavigation($Page)
    4747  {
    48     if(array_key_exists('REQUEST_URI', $_SERVER))
     48    if (array_key_exists('REQUEST_URI', $_SERVER))
    4949      $ScriptName = $_SERVER['REQUEST_URI'];
    5050      else $ScriptName = '';
    51     while(strpos($ScriptName, '//') !== false)
     51    while (strpos($ScriptName, '//') !== false)
    5252      $ScriptName = str_replace('//', '/', $ScriptName);
    53     if(strpos($ScriptName, '?') !== false)
     53    if (strpos($ScriptName, '?') !== false)
    5454      $ScriptName = substr($ScriptName, 0, strrpos($ScriptName, '?'));
    5555    $ScriptName = substr($ScriptName, strlen($this->System->Link('')));
    56     if(substr($ScriptName, -1, 1) == '/') $ScriptName = substr($ScriptName, 0, -1);
     56    if (substr($ScriptName, -1, 1) == '/') $ScriptName = substr($ScriptName, 0, -1);
    5757
    5858    $Output = '';
    59     while($Page)
     59    while ($Page)
    6060    {
    6161      $Output = ' &gt; <a href="'.$this->System->Link($ScriptName).'/">'.$Page->ShortTitle.'</a>'.$Output;
    6262
    63       if(class_exists($Page->ParentClass))
     63      if (class_exists($Page->ParentClass))
    6464      {
    6565        $PageClass = $Page->ParentClass;
     
    6969    }
    7070    $Output = substr($Output, 6);
    71     return($Output);
     71    return $Output;
    7272  }
    7373
     
    8080
    8181    $BodyParam = '';
    82     if(isset($Page->Load)) $BodyParam .= ' onload="'.$Page->Load.'"';
    83     if(isset($Page->Unload)) $BodyParam .= ' onunload="'.$Page->Unload.'"';
     82    if (isset($Page->Load)) $BodyParam .= ' onload="'.$Page->Load.'"';
     83    if (isset($Page->Unload)) $BodyParam .= ' onunload="'.$Page->Unload.'"';
    8484    $Output = '<?xml version="1.0" encoding="'.$this->Encoding.'"?>'."\n".
    8585    '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">'.
     
    9696    // Show page headers
    9797    $Bar = '';
    98     foreach($this->System->PageHeaders as $Item)
     98    foreach ($this->System->PageHeaders as $Item)
    9999      $Output .= call_user_func($Item);
    100100
    101101    $Output .= '</head><body'.$BodyParam.'>';
    102102    $Output .= $this->System->ShowMenu();
    103     if($this->BasicHTML == false)
     103    if ($this->BasicHTML == false)
    104104    {
    105105      //$Output .= '<div class="MainTitle">'.$Title.'</div>';
     
    107107        $Output .= '<div class="MainTitle"><span class="MenuItem"><strong>Navigace :: </strong> '.$Navigation.'</span><div class="MenuItem2">';
    108108      $Bar = '';
    109       foreach($this->System->Bars['Top'] as $BarItem)
     109      foreach ($this->System->Bars['Top'] as $BarItem)
    110110        $Bar .= call_user_func($BarItem);
    111       if(trim($Bar) != '') $Output .= $Bar;
     111      if (trim($Bar) != '') $Output .= $Bar;
    112112        else $Output .= '&nbsp;';
    113113      $Output .= '</div></div>';
    114114    }
    115     return($Output);
     115    return $Output;
    116116  }
    117117
     
    122122    $Time = round(GetMicrotime() - $ScriptTimeStart, 2);
    123123    $Output = '';
    124     if($this->BasicHTML == false)
     124    if ($this->BasicHTML == false)
    125125    {           
    126126      $Output .= '<div class="Footer">'.
     
    129129      $Output .= ' <a href="https://app.zdechov.net/tanec/">Zdrojový kód</a> ';
    130130      //$Output .= ' Verze: '.$Revision.' ('.HumanDate($ReleaseTime).') ';
    131       if($this->ShowRuntimeInfo == true)
     131      if ($this->ShowRuntimeInfo == true)
    132132      {
    133133        $Output .= ' Doba generování: '.$Time.' s / '.ini_get('max_execution_time').' s '.
     
    137137    }
    138138    $Output .= '</body></html>';
    139     return($Output);
     139    return $Output;
    140140  }
    141141
     
    145145
    146146    $Output = $Page->Show();
    147     if($Page->ClearPage == false)
     147    if ($Page->ClearPage == false)
    148148    {
    149149      $Output = $this->ShowHeader($Page).$Output.$this->ShowFooter();
    150       if($this->FormatHTML == true) $Output = $this->FormatOutput($Output);
    151     }
    152     return($Output);
     150      if ($this->FormatHTML == true) $Output = $this->FormatOutput($Output);
     151    }
     152    return $Output;
    153153  }
    154154
     
    159159    $Page->Database = $this->Database;
    160160    $Page->FormatHTML = $this->FormatHTML;
    161     return($Page);
     161    return $Page;
    162162  }
    163163
     
    168168    $nn = 0;
    169169    $n = 0;
    170     while($s != '')
     170    while ($s != '')
    171171    {
    172172      $start = strpos($s, '<');
    173173      $end = strpos($s, '>');
    174       if($start != 0)
     174      if ($start != 0)
    175175      {
    176176        $end = $start - 1;
     
    178178      }
    179179      $line = trim(substr($s, $start, $end + 1));
    180       if(strlen($line) > 0)
    181       if($line[0] == '<')
    182       {
    183         if($s[$start + 1] == '/')
     180      if (strlen($line) > 0)
     181      if ($line[0] == '<')
     182      {
     183        if ($s[$start + 1] == '/')
    184184        {
    185185          $n = $n - 2;
     
    187187        } else
    188188        {
    189           if(strpos($line, ' ')) $cmd = substr($line, 1, strpos($line, ' ') - 1);
     189          if (strpos($line, ' ')) $cmd = substr($line, 1, strpos($line, ' ') - 1);
    190190          else $cmd = substr($line, 1, strlen($line) - 2);
    191191          //echo('['.$cmd.']');
    192           if(strpos($s, '</'.$cmd.'>')) $n = $n + 2;
     192          if (strpos($s, '</'.$cmd.'>')) $n = $n + 2;
    193193        }
    194194      }// else $line = '['.$line.']';
    195       //if($line != '') echo(htmlspecialchars(str_repeat(' ',$nn).$line."\n"));
    196       if($line != '') $out .= (str_repeat(' ', $nn).$line."\n");
     195      //if ($line != '') echo(htmlspecialchars(str_repeat(' ',$nn).$line."\n"));
     196      if ($line != '') $out .= (str_repeat(' ', $nn).$line."\n");
    197197      $s = substr($s, $end + 1, strlen($s));
    198198      $nn = $n;
    199199    }
    200     return($out);
     200    return $out;
    201201  }
    202202}
  • trunk/index.php

    r54 r55  
    1616require_once('Modules/Event/EventPage.php');
    1717
    18 if(isset($_SERVER['REMOTE_ADDR'])) session_start();
     18if (isset($_SERVER['REMOTE_ADDR'])) session_start();
    1919
    2020class ApplicationTanec extends Application
     
    4040  function IsAdmin()
    4141  {
    42     return (array_key_exists('IsAdmin', $_SESSION) and ($_SESSION['IsAdmin'] == 1));
     42    return array_key_exists('IsAdmin', $_SESSION) and ($_SESSION['IsAdmin'] == 1);
    4343  }
    4444
    4545  function Link($URL)
    4646  {
    47     return($this->Config['BaseURL'].$URL);
     47    return $this->Config['BaseURL'].$URL;
    4848  }
    4949
    5050  function AbsoluteLink($URL)
    5151  {
    52     return($this->Config['HostName'].$this->Config['BaseURL'].$URL);
     52    return $this->Config['HostName'].$this->Config['BaseURL'].$URL;
    5353  }
    5454
     
    5656  {
    5757    $Output = '<div>';
    58     foreach($this->MainMenu as $MenuItem)
     58    foreach ($this->MainMenu as $MenuItem)
    5959    {
    6060      $Output .= '<a href="'.$this->Link($MenuItem['Link']).'">'.$MenuItem['Title'].'</a> ';
    6161    }
    6262    $Output .= '</div>';
    63     return($Output);
     63    return $Output;
    6464  }
    6565
    6666  function ProcessURL()
    6767  {
    68     if(array_key_exists('REDIRECT_QUERY_STRING', $_SERVER))
     68    if (array_key_exists('REDIRECT_QUERY_STRING', $_SERVER))
    6969      $PathString = $_SERVER['REDIRECT_QUERY_STRING'];
    7070    else $PathString = '';
    71     if(substr($PathString, -1, 1) == '/') $PathString = substr($PathString, 0, -1);
     71    if (substr($PathString, -1, 1) == '/') $PathString = substr($PathString, 0, -1);
    7272    $PathItems = explode('/', $PathString);
    73     if(array_key_exists('REQUEST_URI', $_SERVER) and (strpos($_SERVER['REQUEST_URI'], '?') !== false))
     73    if (array_key_exists('REQUEST_URI', $_SERVER) and (strpos($_SERVER['REQUEST_URI'], '?') !== false))
    7474      $_SERVER['QUERY_STRING'] = substr($_SERVER['REQUEST_URI'], strpos($_SERVER['REQUEST_URI'], '?') + 1);
    7575    else $_SERVER['QUERY_STRING'] = '';
    7676    parse_str($_SERVER['QUERY_STRING'], $_GET);
    77     return($PathItems);
     77    return $PathItems;
    7878  }
    7979
    8080  function RegisterPage($Path, $Handler)
    8181  {
    82     if(is_array($Path))
     82    if (is_array($Path))
    8383    {
    8484      $Page = &$this->Pages;
    8585      $LastKey = array_pop($Path);
    86       foreach($Path as $PathItem)
     86      foreach ($Path as $PathItem)
    8787      {
    8888        $Page = &$Page[$PathItem];
    8989      }
    90       if(!is_array($Page)) $Page = array('' => $Page);
     90      if (!is_array($Page)) $Page = array('' => $Page);
    9191      $Page[$LastKey] = $Handler;
    9292    } else $this->Pages[$Path] = $Handler;
     
    115115  function SearchPage($PathItems, $Pages)
    116116  {
    117     if(count($PathItems) > 0) $PathItem = $PathItems[0];
     117    if (count($PathItems) > 0) $PathItem = $PathItems[0];
    118118      else $PathItem = '';
    119     if(array_key_exists($PathItem, $Pages))
    120     {
    121       if(is_array($Pages[$PathItem]))
     119    if (array_key_exists($PathItem, $Pages))
     120    {
     121      if (is_array($Pages[$PathItem]))
    122122      {
    123123        array_shift($PathItems);
    124         return($this->SearchPage($PathItems, $Pages[$PathItem]));
    125       } else return($Pages[$PathItem]);
    126     } else return('');
     124        return $this->SearchPage($PathItems, $Pages[$PathItem]);
     125      } else return $Pages[$PathItem];
     126    } else return '';
    127127  }
    128128
    129129  function PageNotFound()
    130130  {
    131     return('Page '.implode('/', $this->PathItems).' not found.');
     131    return 'Page '.implode('/', $this->PathItems).' not found.';
    132132  }
    133133
     
    138138    /* @var $Page Page */
    139139    $ClassName = $this->SearchPage($this->PathItems, $this->Pages);
    140     if($ClassName != '')
     140    if ($ClassName != '')
    141141    {
    142142      $Page = new $ClassName($this);
     
    150150  {
    151151    $this->RunCommon();
    152     if($this->ShowPage)
     152    if ($this->ShowPage)
    153153    {
    154154      $this->PathItems = ProcessURL();
     
    191191  {
    192192    Header($_SERVER['SERVER_PROTOCOL'].' 404 Not Found');
    193     return('<h3 align="center">Požadovaná stránka neexistuje.</h3>');
     193    return '<h3 align="center">Požadovaná stránka neexistuje.</h3>';
    194194  }
    195195}
     
    208208      'Disallow: /*?'."\n".
    209209      'Sitemap: '.$this->System->AbsoluteLink('/sitemap.xml');
    210     return($Result);
     210    return $Result;
    211211  }
    212212}
     
    259259
    260260    $Result .= '</urlset>';
    261     return($Result);
     261    return $Result;
    262262  }
    263263}
Note: See TracChangeset for help on using the changeset viewer.