Changeset 738


Ignore:
Timestamp:
Apr 14, 2015, 10:20:16 PM (9 years ago)
Author:
chronos
Message:
  • Removed: Spaces on end of line.
  • Modified: Tabs converted to spaces.
Location:
trunk
Files:
128 edited

Legend:

Unmodified
Added
Removed
  • trunk/Application/FormClasses.php

    r736 r738  
    311311    'Filter' => '1',
    312312  ),
    313         'TFinanceInvoiceItemListInvoice' => array(
     313  'TFinanceInvoiceItemListInvoice' => array(
    314314    'Type' => 'ManyToOne',
    315315    'Table' => 'FinanceInvoiceItem',
  • trunk/Application/System.php

    r737 r738  
    8383  function ShowPage()
    8484  {
    85         /* @var $Page Page */
     85    /* @var $Page Page */
    8686    $ClassName = $this->SearchPage($this->PathItems, $this->Pages);
    8787    if($ClassName != '')
     
    118118  function ShowAction($Id)
    119119  {
    120         $Output = '';
     120    $Output = '';
    121121    $DbResult = $this->Database->query('SELECT *, `ActionIcon`.`Name` AS `Icon` FROM `Action` '.
    122122      'LEFT JOIN `ActionIcon` ON `ActionIcon`.`Id` = `Action`.`Icon` '.
     
    136136  function RunCommon()
    137137  {
    138         global $Database, $ScriptTimeStart, $ConfigFileName, $Mail, $Type,
     138    global $Database, $ScriptTimeStart, $ConfigFileName, $Mail, $Type,
    139139      $DatabaseRevision, $Config;
    140140
     
    195195  function RunCommandLine()
    196196  {
    197         global $argv;
    198 
    199         $this->RunCommon();
    200         if(count($argv) > 1)
    201         {
     197    global $argv;
     198
     199    $this->RunCommon();
     200    if(count($argv) > 1)
     201    {
    202202      if(array_key_exists($argv[1], $this->CommandLine))
    203203      {
    204         $Command = $this->CommandLine[$argv[1]];
    205         if(is_string($Command['Callback'][0]))
    206               {
    207                 $Class = new $Command['Callback'][0]($this);
    208                 $Output = $Class->$Command['Callback'][1]();
    209               } else $Output = call_user_func($Command['Callback']);
    210               echo($Output);
     204        $Command = $this->CommandLine[$argv[1]];
     205        if(is_string($Command['Callback'][0]))
     206        {
     207          $Class = new $Command['Callback'][0]($this);
     208          $Output = $Class->$Command['Callback'][1]();
     209        } else $Output = call_user_func($Command['Callback']);
     210        echo($Output);
    211211      } else echo('Command "'.$argv[1].'" not supported.'."\n");
    212         } else echo('No command was given as parameter'."\n");
     212    } else echo('No command was given as parameter'."\n");
    213213  }
    214214
    215215  function RegisterCommandLine($Name, $Callback)
    216216  {
    217         $this->CommandLine[$Name] = array('Name' => $Name, 'Callback' => $Callback);
     217    $this->CommandLine[$Name] = array('Name' => $Name, 'Callback' => $Callback);
    218218  }
    219219
    220220  function RegisterPageBar($Name)
    221221  {
    222         $this->Bars[$Name] = array();
     222    $this->Bars[$Name] = array();
    223223  }
    224224
    225225  function UnregisterPageBar($Name)
    226226  {
    227         unset($this->Bars[$Name]);
     227    unset($this->Bars[$Name]);
    228228  }
    229229
    230230  function RegisterPageBarItem($BarName, $ItemName, $Callback)
    231231  {
    232         $this->Bars[$BarName][$ItemName] = $Callback;
     232    $this->Bars[$BarName][$ItemName] = $Callback;
    233233  }
    234234}
  • trunk/Application/Version.php

    r736 r738  
    11<?php
    22
    3 $Revision = 736; // Subversion revision
     3$Revision = 738; // Subversion revision
    44$DatabaseRevision = 736; // SQL structure revision
    5 $ReleaseTime = strtotime('2015-04-06');
     5$ReleaseTime = strtotime('2015-04-14');
  • trunk/Common/AppModule.php

    r731 r738  
    11<?php
    22
    3 /* This implementation will not support installation from remote source. Just 
     3/* This implementation will not support installation from remote source. Just
    44 * installation of already presented modules mainly to persistence preparation.
    55 */
     
    77class ModuleType
    88{
    9         const System = 0;
    10         const Normal = 1;
    11         const Application = 2;
     9  const System = 0;
     10  const Normal = 1;
     11  const Application = 2;
    1212}
    1313
     
    4040  var $Title;
    4141  var $Version;
    42   var $License; 
     42  var $License;
    4343  var $Creator;
    4444  var $HomePage;
     
    5858  var $Manager;
    5959  var $OnChange;
    60  
     60
    6161  function __construct(System $System)
    6262  {
     
    7474    $this->Type = ModuleType::Normal;
    7575  }
    76  
     76
    7777  function Install()
    7878  {
     
    8282    $this->Manager->Perform($List, array(ModuleAction::Install), array(ModuleCondition::NotInstalled));
    8383    $this->DoInstall();
    84         $this->Installed = true;
    85         $this->InstalledVersion = $this->Version;
    86         $this->Manager->Modules[$this->Name] = $this;
    87   }
    88  
     84    $this->Installed = true;
     85    $this->InstalledVersion = $this->Version;
     86    $this->Manager->Modules[$this->Name] = $this;
     87  }
     88
    8989  function Uninstall()
    9090  {
     
    9797    $this->DoUninstall();
    9898  }
    99  
     99
    100100  function Upgrade()
    101101  {
     
    106106    $this->DoUpgrade();
    107107  }
    108  
     108
    109109  function Reinstall()
    110110  {
     
    113113    $this->Install();
    114114  }
    115  
     115
    116116  function Start()
    117117  {
    118118    if($this->Running) return;
    119     if(!$this->Installed) return; 
     119    if(!$this->Installed) return;
    120120    $List = array();
    121121    $this->Manager->EnumDependenciesCascade($this, $List, array(ModuleCondition::NotRunning));
    122122    $this->Manager->Perform($List, array(ModuleAction::Start), array(ModuleCondition::NotRunning));
    123123    $this->DoStart();
    124         $this->Running = true;
    125   }
    126  
     124    $this->Running = true;
     125  }
     126
    127127  function Stop()
    128128  {
    129         if(!$this->Running) return;
     129    if(!$this->Running) return;
    130130    $this->Running = false;
    131         $List = array();
    132         $this->Manager->EnumSuperiorDependenciesCascade($this, $List, array(ModuleCondition::Running));
     131    $List = array();
     132    $this->Manager->EnumSuperiorDependenciesCascade($this, $List, array(ModuleCondition::Running));
    133133    $this->Manager->Perform($List, array(ModuleAction::Stop), array(ModuleCondition::Running));
    134         $this->DoStop(); 
    135   }   
    136  
     134    $this->DoStop();
     135  }
     136
    137137  function Restart()
    138138  {
     
    140140    $this->Start();
    141141  }
    142  
     142
    143143  function Enable()
    144144  {
     
    150150    $this->Enabled = true;
    151151  }
    152  
     152
    153153  function Disable()
    154154  {
     
    160160    $this->Manager->Perform($List, array(ModuleAction::Disable), array(ModuleCondition::Enabled));
    161161  }
    162  
     162
    163163  protected function DoStart()
    164164  {
    165165  }
    166  
     166
    167167  protected function DoStop()
    168   {   
     168  {
    169169  }
    170170
     
    172172  {
    173173  }
    174  
     174
    175175  protected function DoUninstall()
    176176  {
     
    179179
    180180/* Manage installed modules */
    181 class AppModuleManager 
     181class AppModuleManager
    182182{
    183183  var $Modules;
     
    185185  var $FileName;
    186186  var $OnLoadModules;
    187  
     187
    188188  function __construct(System $System)
    189189  {
    190190    $this->Modules = array();
    191191    $this->System = &$System;
    192     $this->FileName = 'Config/Modules.php';     
    193   }
    194  
     192    $this->FileName = 'Config/Modules.php';
     193  }
     194
    195195  function Perform($List, $Actions, $Conditions = array(ModuleCondition::All))
    196196  {
     
    217217    }
    218218  }
    219  
     219
    220220  function EnumDependenciesCascade($Module, &$List, $Conditions = array(ModuleCondition::All))
    221221  {
     
    236236    }
    237237  }
    238  
     238
    239239  function EnumSuperiorDependenciesCascade($Module, &$List, $Conditions = array(ModuleCondition::All))
    240240  {
    241241    foreach($this->Modules as $RefModule)
    242242    {
    243       if(in_array($Module->Name, $RefModule->Dependencies) and 
     243      if(in_array($Module->Name, $RefModule->Dependencies) and
    244244          (in_array(ModuleCondition::All, $Conditions) or
    245245          ($Module->Running and in_array(ModuleCondition::Running, $Conditions)) or
     
    255255    }
    256256  }
    257  
     257
    258258  function Start()
    259259  {
     
    262262    $this->StartEnabled();
    263263  }
    264  
     264
    265265  function StartAll()
    266266  {
    267267    $this->Perform($this->Modules, array(ModuleAction::Start));
    268268  }
    269  
     269
    270270  function StartEnabled()
    271271  {
     
    277277    $this->Perform($this->Modules, array(ModuleAction::Stop));
    278278  }
    279  
     279
    280280  function UninstallAll()
    281281  {
     
    283283    $this->SaveState();
    284284  }
    285  
     285
    286286  function ModulePresent($Name)
    287287  {
    288288    return(array_key_exists($Name, $this->Modules));
    289289  }
    290  
     290
    291291  /* @return Module */
    292292  function SearchModuleById($Id)
     
    299299    return('');
    300300  }
    301  
     301
    302302  function LoadState()
    303303  {
    304         $ConfigModules = array();
     304    $ConfigModules = array();
    305305    include($this->FileName);
    306306    foreach($ConfigModules as $Mod)
     
    312312        $this->Modules[$Mod['Name']]->Installed = $Mod['Installed'];
    313313        $this->Modules[$Mod['Name']]->InstalledVersion = $Mod['Version'];
    314       } 
    315     }
    316   }
    317  
     314      }
     315    }
     316  }
     317
    318318  function SaveState()
    319319  {
     
    321321    foreach($this->Modules as $Module)
    322322    {
    323       $Data[] = array('Name' => $Module->Name, 'Enabled' => $Module->Enabled, 
     323      $Data[] = array('Name' => $Module->Name, 'Enabled' => $Module->Enabled,
    324324        'Version' => $Module->Version, 'Installed' => $Module->Installed);
    325325    }
    326326    file_put_contents($this->FileName, "<?php \n\n\$ConfigModules = ".var_export($Data, true).";\n");
    327327  }
    328  
     328
    329329  function RegisterModule(AppModule $Module)
    330330  {
     
    333333    $Module->OnChange = &$this->OnModuleChange;
    334334  }
    335  
     335
    336336  function UnregisterModule(AppModule $Module)
    337337  {
    338338    unset($this->Modules[array_search($Module, $this->Modules)]);
    339339  }
    340  
     340
    341341  function LoadModulesFromDir($Directory)
    342342  {
    343         $List = scandir($Directory);     
     343    $List = scandir($Directory);
    344344    foreach($List as $Item)
    345345    {
     
    352352    }
    353353  }
    354  
     354
    355355  function LoadModules()
    356356  {
    357         if(method_exists($this->OnLoadModules[0], $this->OnLoadModules[1]))
     357    if(method_exists($this->OnLoadModules[0], $this->OnLoadModules[1]))
    358358      $this->OnLoadModules();
    359359    else $this->LoadModulesFromDir(dirname(__FILE__).'/../Modules');
  • trunk/Common/Application.php

    r578 r738  
    33class Application
    44{
    5         var $Name;
    6         var $System;
    7        
    8         function Run()
    9         {
    10                
    11         }
     5  var $Name;
     6  var $System;
     7
     8  function Run()
     9  {
     10
     11  }
    1212}
  • trunk/Common/Base.php

    r565 r738  
    1111  {
    1212    $this->System = &$System;
    13     $this->Database = &$System->Database;   
     13    $this->Database = &$System->Database;
    1414  }
    1515}
     
    1717class Model extends Base
    1818{
    19  
     19
    2020}
    2121
    2222class View extends Base
    2323{
    24  
     24
    2525}
    2626
    2727class Controller extends Base
    2828{
    29  
     29
    3030}
  • trunk/Common/Config.php

    r593 r738  
    11<?php
    22
    3 class Config 
     3class Config
    44{
    55  var $Data;
    6  
     6
    77  function __construct()
    88  {
    9         $this->Data = array();
     9    $this->Data = array();
    1010  }
    11  
     11
    1212  function ReadValue($Name)
    1313  {
    14         if(!is_array($Name)) $Name = explode('/', $Name);
    15         $Last = array_pop($Name);
    16         $Data = &$this->Data;
    17         foreach($Name as $Item)
    18         {
    19                 $Data = &$Data[$Item];
    20         }
    21     return($Data[$Last]); 
     14    if(!is_array($Name)) $Name = explode('/', $Name);
     15    $Last = array_pop($Name);
     16    $Data = &$this->Data;
     17    foreach($Name as $Item)
     18    {
     19      $Data = &$Data[$Item];
     20    }
     21    return($Data[$Last]);
    2222  }
    23  
     23
    2424  function WriteValue($Name, $Value)
    2525  {
    26         if(!is_array($Name)) $Name = explode('/', $Name);
    27         $Last = array_pop($Name);
    28         $Data = &$this->Data;
    29         foreach($Name as $Item)
    30         {
    31                 $Data = &$Data[$Item];
    32         }
     26    if(!is_array($Name)) $Name = explode('/', $Name);
     27    $Last = array_pop($Name);
     28    $Data = &$this->Data;
     29    foreach($Name as $Item)
     30    {
     31      $Data = &$Data[$Item];
     32    }
    3333    $Data[$Item] = $Value;
    3434  }
    35  
     35
    3636  function LoadFromFile($FileName)
    3737  {
    38         $ConfigData = array();
     38    $ConfigData = array();
    3939    include $FileName;
    4040    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    }
    45   } 
    46  
     45  }
     46
    4747  function SaveToFile($FileName)
    4848  {
    4949    file_put_contents($FileName, "<?php \n\n\$ConfigData = ".var_export($this->Data, true).";\n");
    5050  }
    51  
     51
    5252  function GetAsArray()
    5353  {
    54         return($this->Data);
     54    return($this->Data);
    5555  }
    5656}
  • trunk/Common/Form/Form.php

    r737 r738  
    5050    {
    5151      if(!array_key_exists($Index, $this->Values) and isset($Item['Default']))
    52         $this->Values[$Index] = $Item['Default'];
     52        $this->Values[$Index] = $Item['Default'];
    5353    }
    5454  }
     
    6262  function GetValue($Index, $Event = 'OnView')
    6363  {
    64         $Item = $this->Definition['Items'][$Index];
    65         if(array_key_exists($Item['Type'], $this->FormManager->FormTypes))
    66         {
    67                 if(!array_key_exists($Item['Type'], $this->FormManager->Type->TypeDefinitionList))
    68                         $this->FormManager->Type->RegisterType($Item['Type'], '', $this->FormManager->FormTypes[$Item['Type']]);
    69                 if($this->FormManager->FormTypes[$Item['Type']]['Type'] == 'Reference')
    70                         $UseType = 'OneToMany';
    71                 else if($this->FormManager->FormTypes[$Item['Type']]['Type'] == 'Enumeration')
    72                         $UseType = 'Enumeration';
    73         } else $UseType = $Item['Type'];
    74         return $this->FormManager->Type->ExecuteTypeEvent($UseType, $Event,
     64    $Item = $this->Definition['Items'][$Index];
     65    if(array_key_exists($Item['Type'], $this->FormManager->FormTypes))
     66    {
     67      if(!array_key_exists($Item['Type'], $this->FormManager->Type->TypeDefinitionList))
     68        $this->FormManager->Type->RegisterType($Item['Type'], '', $this->FormManager->FormTypes[$Item['Type']]);
     69      if($this->FormManager->FormTypes[$Item['Type']]['Type'] == 'Reference')
     70        $UseType = 'OneToMany';
     71      else if($this->FormManager->FormTypes[$Item['Type']]['Type'] == 'Enumeration')
     72        $UseType = 'Enumeration';
     73    } else $UseType = $Item['Type'];
     74    return $this->FormManager->Type->ExecuteTypeEvent($UseType, $Event,
    7575        array('Value' => $this->Values[$Index], 'Name' => $Index,
    7676        'Type' => $Item['Type'], 'Values' => $this->Values,
     
    163163      if(array_key_exists($Index, $this->ValuesValidate) and
    164164        $this->ValuesValidate[$Index]) {
    165                 $Format = $this->FormManager->Type->ExecuteTypeEvent($UseType, 'GetValidationFormat', array());
    166                 if($Format != '') $Caption .= '<br/><small>'.$Format.'</small>';
    167                 $Caption = '<span style="color:red;">'.$Caption.'</span>';
     165          $Format = $this->FormManager->Type->ExecuteTypeEvent($UseType, 'GetValidationFormat', array());
     166          if($Format != '') $Caption .= '<br/><small>'.$Format.'</small>';
     167          $Caption = '<span style="color:red;">'.$Caption.'</span>';
    168168        }
    169169      if(!$this->FormManager->Type->IsHidden($UseType))
     
    305305    {
    306306      if(isset($Item['Default'])) {
    307         if(isset($Item['Null']) and ($Item['Null'] == true))
    308                 $Values[$Index] = null;
    309         else $Values[$Index] = $Item['Default'];
     307        if(isset($Item['Null']) and ($Item['Null'] == true))
     308          $Values[$Index] = null;
     309        else $Values[$Index] = $Item['Default'];
    310310      }
    311311    }
     
    342342        if(!$this->FormManager->Type->ExecuteTypeEvent($UseType, 'Validate',
    343343          $Parameters)) {
    344                 $this->ValuesValidate[$Index] = true;
    345                 $Valid = false;
     344            $this->ValuesValidate[$Index] = true;
     345            $Valid = false;
    346346          }
    347347    }
  • trunk/Common/Form/Types/Base.php

    r606 r738  
    4444    return(addslashes($Value));
    4545  }
    46  
     46
    4747  function OnFilterName($Item)
    4848  {
    49     if(array_key_exists('SQL', $Item) and ($Item['SQL'] != '')) 
     49    if(array_key_exists('SQL', $Item) and ($Item['SQL'] != ''))
    5050      $SQL = '('.$Item['SQL'].') AS ';
    5151      else $SQL = '';
     
    5555  function OnFilterNameQuery($Item)
    5656  {
    57     if(array_key_exists('SQL', $Item) and ($Item['SQL'] != '')) 
     57    if(array_key_exists('SQL', $Item) and ($Item['SQL'] != ''))
    5858      $Output = '('.$Item['SQL'].') AS `'.$Item['Name'].'`, ('.$Item['SQL'].') AS `'.$Item['Name'].'_Filter`';
    5959      else $Output = '`'.$Item['Name'].'`, `'.$Item['Name'].'` AS `'.$Item['Name'].'_Filter`';
    6060    return($Output);
    6161  }
    62  
     62
    6363  function Validate($Item)
    6464  {
    65         return(true);
     65    return(true);
    6666  }
    6767
    6868  function GetValidationFormat()
    6969  {
    70         return('');
     70    return('');
    7171  }
    7272}
  • trunk/Common/Form/Types/Boolean.php

    r548 r738  
    2121  function OnLoad($Item)
    2222  {
    23     if(array_key_exists($Item['Name'], $_POST)) return(1); 
     23    if(array_key_exists($Item['Name'], $_POST)) return(1);
    2424      else return(0);
    2525  }
  • trunk/Common/Form/Types/Enumeration.php

    r548 r738  
    1818    $Type = $this->FormManager->Type->GetTypeDefinition($Item['Type']);
    1919    $Output = '<select name="'.$Item['Name'].'">';
    20       if(array_key_exists('Null', $Item) and $Item['Null']) 
     20      if(array_key_exists('Null', $Item) and $Item['Null'])
    2121    {
    2222      if($Item['Value'] == NULL) $Selected = ' selected="1"'; else $Selected = '';
     
    3737    return($_POST[$Item['Name']]);
    3838  }
    39  
     39
    4040  function OnLoadDb($Item)
    4141  {
  • trunk/Common/Form/Types/Hidden.php

    r548 r738  
    1010    $this->Hidden = true;
    1111  }
    12  
     12
    1313  function OnView($Item)
    1414  {
  • trunk/Common/Form/Types/IPv4Address.php

    r606 r738  
    2121    return($_POST[$Item['Name']]);
    2222  }
    23  
     23
    2424  function Validate($Item)
    2525  {
    26         if($Item['Null'] and ($Item['Value'] == '')) return(true);
    27         return(filter_var($Item['Value'], FILTER_VALIDATE_IP, array('flags' => FILTER_FLAG_IPV4)));
     26    if($Item['Null'] and ($Item['Value'] == '')) return(true);
     27    return(filter_var($Item['Value'], FILTER_VALIDATE_IP, array('flags' => FILTER_FLAG_IPV4)));
    2828  }
    29  
     29
    3030  function GetValidationFormat()
    3131  {
    32         return('x.x.x.x kde x je hodnota 0..255');
    33   } 
     32    return('x.x.x.x kde x je hodnota 0..255');
     33  }
    3434}
  • trunk/Common/Form/Types/IPv6Address.php

    r606 r738  
    2121    return($_POST[$Item['Name']]);
    2222  }
    23  
     23
    2424  function Validate($Item)
    2525  {
    26         if($Item['Null'] and ($Item['Value'] == '')) return(true);
    27         return(filter_var($Item['Value'], FILTER_VALIDATE_IP, array('flags' => FILTER_FLAG_IPV6)));
     26    if($Item['Null'] and ($Item['Value'] == '')) return(true);
     27    return(filter_var($Item['Value'], FILTER_VALIDATE_IP, array('flags' => FILTER_FLAG_IPV6)));
    2828  }
    2929
    3030  function GetValidationFormat()
    3131  {
    32         return('xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx kde x je hexa hodnota 0..f');
     32    return('xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx kde x je hexa hodnota 0..f');
    3333  }
    3434}
  • trunk/Common/Form/Types/Image.php

    r631 r738  
    22
    33class TypeImage extends TypeString
    4 { 
     4{
    55  function OnView($Item)
    66  {
    77    global $System;
    8    
     8
    99    return('<img src="'.$System->Link('/images/favicons/'.$Item['Value']).'"/> '.$Item['Value']);
    1010  }
  • trunk/Common/Form/Types/Integer.php

    r611 r738  
    2323    return($_POST[$Item['Name']]);
    2424  }
    25  
     25
    2626  function Validate($Item)
    2727  {
    28         if($Item['Null'] and ($Item['Value'] == '')) return(true);
    29         return(preg_match('/^\-*[0-9\.]+$/', $Item['Value']));
     28    if($Item['Null'] and ($Item['Value'] == '')) return(true);
     29    return(preg_match('/^\-*[0-9\.]+$/', $Item['Value']));
    3030  }
    31  
     31
    3232  function GetValidationFormat()
    3333  {
    34         return('číselná hodnota');
    35   } 
     34    return('číselná hodnota');
     35  }
    3636}
  • trunk/Common/Form/Types/MacAddress.php

    r683 r738  
    3232  function Validate($Item)
    3333  {
    34         if($Item['Null'] and ($Item['Value'] == '')) return(true);
    35         return(preg_match('/^([0-9A-F]{2}[:]){5}([0-9A-F]{2})$/', $Item['Value']));
     34    if($Item['Null'] and ($Item['Value'] == '')) return(true);
     35    return(preg_match('/^([0-9A-F]{2}[:]){5}([0-9A-F]{2})$/', $Item['Value']));
    3636  }
    3737
    3838  function GetValidationFormat()
    3939  {
    40         return('XX:XX:XX:XX:XX:XX kde X je hexa hodnota 0..F');
     40    return('XX:XX:XX:XX:XX:XX kde X je hexa hodnota 0..F');
    4141  }
    4242}
  • trunk/Common/Form/Types/Password.php

    r548 r738  
    2727    $Result = $_POST[$Item['Name']];
    2828    /*
    29     if(!array_key_exists('SourceItemId', $Item)) $Result = sha1($_POST[$Item['Name']]);   
     29    if(!array_key_exists('SourceItemId', $Item)) $Result = sha1($_POST[$Item['Name']]);
    3030    else
    3131    {
     
    4141    return($Result);
    4242  }
    43  
     43
    4444  function OnSaveDb($Item)
    4545  {
    46     if($Item['Value'] == '') return(''); 
     46    if($Item['Value'] == '') return('');
    4747    else {
    4848      $PasswordHash = new PasswordHash();
     
    5050    }
    5151  }
    52    
     52
    5353  function OnLoadDb($Item)
    5454  {
  • trunk/Common/Form/Types/RandomHash.php

    r548 r738  
    1010    $this->Hidden = true;
    1111  }
    12  
     12
    1313  function OnView($Item)
    1414  {
  • trunk/Common/Global.php

    r729 r738  
    2525
    2626$MonthNames = array('', 'Leden', 'Únor', 'Březen', 'Duben', 'Květen', 'Červen',
    27         'Červenec', 'Srpen', 'Září', 'Říjen', 'Listopad', 'Prosinec');
     27  'Červenec', 'Srpen', 'Září', 'Říjen', 'Listopad', 'Prosinec');
    2828
    2929$UnitNames = array('B', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB');
     
    5858function HumanDate($Time)
    5959{
    60         if($Time != '') {
     60  if($Time != '') {
    6161    $Date = explode(' ', $Time);
    6262    $Parts = explode('-', $Date[0]);
    6363    if($Date != '0000-00-00') return(($Parts[2]*1).'.'.($Parts[1]*1).'.'.$Parts[0]);
    6464    else return('&nbsp;');
    65         } else return('&nbsp;');
     65  } else return('&nbsp;');
    6666}
    6767
     
    106106{
    107107  return(array(
    108         'Year' => date('Y', $Time),
    109         'Month' => date('n', $Time),
    110         'Day' => date('j', $Time),
    111         'Hour' => date('h', $Time),
    112         'Minute' => date('i', $Time),
    113         'Second' => date('s', $Time)
     108    'Year' => date('Y', $Time),
     109    'Month' => date('n', $Time),
     110    'Day' => date('j', $Time),
     111    'Hour' => date('h', $Time),
     112    'Minute' => date('i', $Time),
     113    'Second' => date('s', $Time)
    114114  ));
    115115}
     
    143143class Paging
    144144{
    145         var $TotalCount;
    146         var $ItemPerPage;
    147         var $Around;
    148         var $SQLLimit;
    149         var $Page;
    150 
    151         function __construct()
    152         {
    153                 global $System;
    154 
    155                 $this->ItemPerPage = $System->Config['Web']['ItemsPerPage'];
    156                 $this->Around = $System->Config['Web']['VisiblePagingItems'];
    157         }
     145  var $TotalCount;
     146  var $ItemPerPage;
     147  var $Around;
     148  var $SQLLimit;
     149  var $Page;
     150
     151  function __construct()
     152  {
     153    global $System;
     154
     155    $this->ItemPerPage = $System->Config['Web']['ItemsPerPage'];
     156    $this->Around = $System->Config['Web']['VisiblePagingItems'];
     157  }
    158158
    159159  function Show()
     
    356356function IsInternetAddr()
    357357{
    358         global $Config;
    359 
    360         $Result = true;
     358  global $Config;
     359
     360  $Result = true;
    361361  $RemoteAddr = GetRemoteAddress();
    362362  foreach($Config['Web']['IntranetSubnets'] as $Subnet)
     
    364364    if(substr($RemoteAddr, 0, strlen($Subnet)) == $Subnet)
    365365    {
    366         $Result = false;
    367         break;
     366      $Result = false;
     367      break;
    368368    }
    369369  }
     
    467467function pack_array($v, $a)
    468468{
    469         return call_user_func_array('pack', array_merge(array($v), (array)$a));
    470 }
    471 
     469  return call_user_func_array('pack', array_merge(array($v), (array)$a));
     470}
     471
  • trunk/Common/Image.php

    r548 r738  
    1212  var $FileName;
    1313  var $Color;
    14  
    15   function __construct() 
     14
     15  function __construct()
    1616  {
    1717    $this->Color = COLOR_BLACK;
     
    2727  var $Y;
    2828
    29   function __construct() 
     29  function __construct()
    3030  {
    3131    $this->Color = COLOR_BLACK;
     
    4040  var $Color;
    4141
    42   function __construct() 
     42  function __construct()
    4343  {
    4444    $this->Color = COLOR_BLACK;
     
    4747}
    4848
    49 class Image 
     49class Image
    5050{
    51   var $Image; 
     51  var $Image;
    5252  var $Type;
    5353  var $Font;
    5454  var $Pen;
    55  
     55
    5656  function __construct()
    5757  {
     
    5959    $this->Type = IMAGETYPE_PNG;
    6060    $this->Pen = new Pen();
    61     $this->Font = new Font();   
    62     $this->Brush = new Brush();   
     61    $this->Font = new Font();
     62    $this->Brush = new Brush();
    6363  }
    64  
     64
    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    {
    7373      imagegif($this->Image, $FileName);
    7474    } else
    75     if($this->Type == IMAGETYPE_PNG) 
     75    if($this->Type == IMAGETYPE_PNG)
    7676    {
    7777      imagepng($this->Image, $FileName);
    7878    }
    7979  }
    80  
     80
    8181  function LoadFromFile($FileName)
    8282  {
    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    {
    9191      $this->Image = imagecreatefromgif($FileName);
    9292    } else
    93     if( $this->Type == IMAGETYPE_PNG) 
     93    if( $this->Type == IMAGETYPE_PNG)
    9494    {
    9595      $this->Image = imagecreatefrompng($FileName);
    96     } 
     96    }
    9797  }
    98  
     98
    9999  function Output()
    100100  {
     
    103103
    104104  function SetSize($Width, $Height)
    105   {     
     105  {
    106106    $NewImage = imagecreatetruecolor($Width, $Height);
    107     imagecopy($NewImage, $this->Image, 0, 0, 0, 0, $this->GetWidth(), $this->GetHeight());     
     107    imagecopy($NewImage, $this->Image, 0, 0, 0, 0, $this->GetWidth(), $this->GetHeight());
    108108    imagedestroy($this->Image);
    109109    $this->Image = $NewImage;
    110110  }
    111111
    112   function GetWidth() 
    113   { 
     112  function GetWidth()
     113  {
    114114    return(imagesx($this->Image));
    115115  }
    116  
    117   function GetHeight() 
     116
     117  function GetHeight()
    118118  {
    119119    return(imagesy($this->Image));
    120120  }
    121  
     121
    122122  function TextOut($X, $Y, $Text)
    123123  {
    124124    imagettftext($this->Image, $this->Font->Size, 0, $X, $Y, $this->ConvertColor($this->Font->Color), $this->Font->FileName, $Text);
    125125  }
    126  
     126
    127127  function ConvertColor($Color)
    128128  {
    129129    return(imagecolorallocate($this->Image, ($Color >> 16) & 0xff, ($Color >> 8) & 0xff, $Color & 0xff));
    130130  }
    131  
     131
    132132  function FillRect($X1, $Y1, $X2, $Y2)
    133133  {
    134134    imagefilledrectangle($this->Image, $X1, $Y1, $X2, $Y2, $this->ConvertColor($this->Brush->Color));
    135135  }
    136  
     136
    137137  function Line($X1, $Y1, $X2, $Y2)
    138138  {
  • trunk/Common/Mail.php

    r579 r738  
    1313  var $From;
    1414  var $Recipients;
    15   var $Bodies; 
     15  var $Bodies;
    1616  var $Attachments;
    1717  var $AgentIdent;
     
    1919  var $ReplyTo;
    2020  var $Headers;
    21  
     21
    2222  function __construct()
    2323  {
    24     $this->Priorities = array('1 (Highest)', '2 (High)', '3 (Normal)', '4 (Low)', '5 (Lowest)');           
     24    $this->Priorities = array('1 (Highest)', '2 (High)', '3 (Normal)', '4 (Low)', '5 (Lowest)');
    2525    $this->Boundary = md5(date('r', time()));
    2626    $this->AgentIdent = 'PHP/Mail';
    2727    $this->Clear();
    2828  }
    29  
     29
    3030  function Clear()
    3131  {
     
    6363  function AddBody($Content, $MimeType = 'text/plain', $Charset = 'utf-8')
    6464  {
    65     $this->Bodies[] = array('Content' => $Content, 'Type' => strtolower($MimeType), 
     65    $this->Bodies[] = array('Content' => $Content, 'Type' => strtolower($MimeType),
    6666      'Charset' => strtolower($Charset));
    6767  }
     
    7575  {
    7676    if(!intval($Priority)) return(false);
    77                
     77
    7878    if(!isset($this->priorities[$Priority - 1])) return(false);
    7979
    80     $this->xheaders['X-Priority'] = $this->priorities[$Priority - 1];   
     80    $this->xheaders['X-Priority'] = $this->priorities[$Priority - 1];
    8181    return(true);
    8282  }
    8383
    8484  function AttachFile($FileName, $FileType, $Disposition = DISPOSITION_ATTACHMENT)
    85   {     
    86     $this->Attachments[] = array('FileName' => $FileName, 'FileType' => $FileType, 
     85  {
     86    $this->Attachments[] = array('FileName' => $FileName, 'FileType' => $FileType,
    8787      'Disposition' => $Disposition, 'Type' => 'File');
    8888  }
     
    9090  function AttachData($FileName, $FileType, $Data, $Disposition = DISPOSITION_ATTACHMENT)
    9191  {
    92     $this->Attachments[] = array('FileName' => $FileName, 'FileType' => $FileType, 
     92    $this->Attachments[] = array('FileName' => $FileName, 'FileType' => $FileType,
    9393      'Disposition' => $Disposition, 'Type' => 'Data', 'Data' => $Data);
    9494  }
     
    9797  {
    9898    if(count($this->Bodies) == 0) throw new Exception('Mail: Need at least one text body');
    99    
     99
    100100    $Body = $this->BuildAttachment($this->BuildBody());
    101    
     101
    102102    $To = '';
    103103    $this->Headers['CC'] = '';
    104104    $this->Headers['BCC'] = '';
    105     foreach($this->Recipients as $Index => $Recipient)     
     105    foreach($this->Recipients as $Index => $Recipient)
    106106    {
    107107      if($Recipient['Type'] == 'SendCombined')
     
    127127    }
    128128    if($To == '') throw new Exception('Mail: Need at least one recipient address');
    129    
     129
    130130    $this->Headers['Mime-Version'] = '1.0';
    131    
     131
    132132    if($this->AgentIdent != '') $this->Headers['X-Mailer'] = $this->AgentIdent;
    133133    if($this->ReplyTo != '') $this->Headers['Reply-To'] = $this->ReplyTo;
     
    135135
    136136    $Headers = '';
    137     foreach($this->Headers as $Header => $Value) 
     137    foreach($this->Headers as $Header => $Value)
    138138    {
    139139      if(($Header != 'Subject') and ($Value != '')) $Headers .= $Header.': '.$Value."\n";
    140     }   
     140    }
    141141
    142142    $this->Subject = strtr($this->Subject, "\r\n", '  ');
    143143
    144144    if($this->Subject == '') throw new Exception('Mail: Missing Subject');
    145    
     145
    146146
    147147    $res = mail($To, $this->Subject, $Body, $Headers);
     
    152152  {
    153153    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)) 
     154    if(ereg("^[^@  ]+@([a-zA-Z0-9\-]+\.)+([a-zA-Z0-9\-]{2}|net|com|gov|mil|org|edu|int)\$", $Address))
    155155      return(true);
    156156      else return(false);
     
    159159  function CheckAdresses($Addresses)
    160160  {
    161     foreach($Addresses as $Address) 
    162     {
    163       if(!$this->ValidEmail($Address)) 
    164         throw new Exception('Mail: Invalid address '.$Address);
    165     }
    166   } 
    167  
     161    foreach($Addresses as $Address)
     162    {
     163      if(!$this->ValidEmail($Address))
     164  throw new Exception('Mail: Invalid address '.$Address);
     165    }
     166  }
     167
    168168  private function ContentEncoding($Charset)
    169169  {
     
    175175  {
    176176    if(count($this->Attachments) > 0)
    177     {       
     177    {
    178178      $this->Headers['Content-Type'] = "multipart/mixed;\n boundary=\"PHP-mixed-".$this->Boundary."\"";
    179179      $Result = "This is a multi-part message in MIME format.\n".
    180         "--PHP-mixed-".$this->Boundary."\n";   
     180        "--PHP-mixed-".$this->Boundary."\n";
    181181      $Result .= $Body;
    182    
    183       foreach($this->Attachments as $Attachment) 
     182
     183      foreach($this->Attachments as $Attachment)
    184184      {
    185185        $FileName = $Attachment['FileName'];
     
    189189        if($Attachment['Type'] == 'File')
    190190        {
    191           if(!file_exists($FileName)) 
     191          if(!file_exists($FileName))
    192192            throw new Exception('Mail: Attached file '.$FileName.' can\'t be found');
    193193          $Data = file_get_contents($FileName);
    194         } else 
     194        } else
    195195        if($Attachment['Type'] == 'Data') $Data = $Attachment['Data'];
    196196          else $Data = '';
    197                
     197
    198198        $Result .= "\n".'--PHP-mixed-'.$this->Boundary."\n".
    199199          "Content-Type: ".$ContentType."; name=\"".$BaseName."\"\n".
     
    203203      }
    204204    } else $Result = $Body;
    205     return($Result);   
    206   }
    207  
     205    return($Result);
     206  }
     207
    208208  private function BuildBody()
    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.'"';
    214214      $Result .= 'Content-Type: multipart/alternative; boundary="PHP-alt-'.$this->Boundary.'"'.
    215215        "\n\n";
    216     } else 
     216    } else
    217217    {
    218218      $this->Headers['Content-Type'] = $this->Bodies[0]['Type'].'; charset='.$this->Bodies[0]['Charset'];
     
    220220    }
    221221
    222        
     222
    223223    foreach($this->Bodies as $Body)
    224224    {
    225       if(count($this->Bodies) > 1) $Result .= "\n\n".'--PHP-alt-'.$this->Boundary."\n";           
     225      if(count($this->Bodies) > 1) $Result .= "\n\n".'--PHP-alt-'.$this->Boundary."\n";
    226226      $Result .= 'Content-Type: '.$Body['Type'].'; charset='.$Body['Charset'].
    227         "\nContent-Transfer-Encoding: ".$this->ContentEncoding($Body['Charset'])."\n\n".$Body['Content']."\n";         
     227        "\nContent-Transfer-Encoding: ".$this->ContentEncoding($Body['Charset'])."\n\n".$Body['Content']."\n";
    228228    }
    229229    return($Result);
    230   } 
     230  }
    231231}
    232232
  • trunk/Common/NetworkAddress.php

    r705 r738  
    6060class NetworkAddressIPv6
    6161{
    62         var $Address;
    63         var $Prefix;
     62  var $Address;
     63  var $Prefix;
    6464
    65         function __construct()
    66         {
    67                 $this->Address = 0;
    68                 $this->Prefix = 0;
    69         }
     65  function __construct()
     66  {
     67    $this->Address = 0;
     68    $this->Prefix = 0;
     69  }
    7070
    7171  function AddressToString()
    7272  {
    73         return(inet_ntop($this->Address));
     73    return(inet_ntop($this->Address));
    7474  }
    7575
    7676  function AddressFromString($Value)
    7777  {
    78         $this->Address = inet_pton($Value);
     78    $this->Address = inet_pton($Value);
    7979  }
    8080
    8181  function GetOctets()
    8282  {
    83         $Result = array();
    84         $Data = array_reverse(unpack('C*', $this->Address));
    85         foreach($Data as $Item)
    86         {
     83    $Result = array();
     84    $Data = array_reverse(unpack('C*', $this->Address));
     85    foreach($Data as $Item)
     86    {
    8787
    88                 $Result[] = dechex($Item & 15);
    89                 $Result[] = dechex(($Item >> 4) & 15);
    90         }
    91         return($Result);
     88      $Result[] = dechex($Item & 15);
     89      $Result[] = dechex(($Item >> 4) & 15);
     90    }
     91    return($Result);
    9292  }
    9393
    9494  function EncodeMAC($MAC)
    9595  {
    96         $MAC = explode(':', $MAC);
    97         $Data = unpack('C*', $this->Address);
    98         $Data[9] = hexdec($MAC[0]) ^ 0x02;
    99         $Data[10] = hexdec($MAC[1]);
    100         $Data[11] = hexdec($MAC[2]);
    101         $Data[12] = 0xff;
    102         $Data[13] = 0xfe;
    103         $Data[14] = hexdec($MAC[3]);
    104         $Data[15] = hexdec($MAC[4]);
    105         $Data[16] = hexdec($MAC[5]);
    106         $this->Address = pack_array('C*', $Data);
     96    $MAC = explode(':', $MAC);
     97    $Data = unpack('C*', $this->Address);
     98    $Data[9] = hexdec($MAC[0]) ^ 0x02;
     99    $Data[10] = hexdec($MAC[1]);
     100    $Data[11] = hexdec($MAC[2]);
     101    $Data[12] = 0xff;
     102    $Data[13] = 0xfe;
     103    $Data[14] = hexdec($MAC[3]);
     104    $Data[15] = hexdec($MAC[4]);
     105    $Data[16] = hexdec($MAC[5]);
     106    $this->Address = pack_array('C*', $Data);
    107107  }
    108108
  • trunk/Common/Page.php

    r729 r738  
    1515  var $Encoding;
    1616  var $Style;
    17  
     17
    1818  function __construct($System)
    1919  {
    2020    parent::__construct($System);
    21    
     21
    2222    $this->FormatHTML = false;
    2323    $this->ShowRuntimeInfo = false;
    2424    $this->Encoding = 'utf-8';
    2525    $this->Style = 'new';
    26    
     26
    2727    // TODO: Move to external code
    2828    if(isset($this->System->Config['Web']['FormatHTML']))
     
    3535      $this->Style = $this->System->Config['Web']['Style'];
    3636  }
    37  
     37
    3838  function Show()
    3939  {
    40         return('');
     40    return('');
    4141  }
    4242
    4343  function SystemMessage($Title, $Text)
    44   { 
     44  {
    4545    return('<table align="center"><tr><td><div class="SystemMessage"><h3>'.$Title.'</h3><div>'.$Text.'</div></div></td></tr></table>');
    4646    //ShowFooter();
     
    5050  function ShowHeader($Title, $Path)
    5151  {
    52         if(array_key_exists('REQUEST_URI', $_SERVER))
     52    if(array_key_exists('REQUEST_URI', $_SERVER))
    5353      $ScriptName = $_SERVER['REQUEST_URI'];
    54           else $ScriptName = '';
     54      else $ScriptName = '';
    5555    while(strpos($ScriptName, '//') !== false)
    5656      $ScriptName = str_replace('//', '/', $ScriptName);
     
    6262    $Navigation = '';
    6363    while($Page)
    64     { 
     64    {
    6565      $Navigation = ' &gt; <a href="'.$this->System->Link($ScriptName).'/">'.$Page->ShortTitle.'</a>'.$Navigation;
    66      
     66
    6767      if(class_exists($Page->ParentClass))
    6868      {
     
    7171        $ScriptName = substr($ScriptName, 0, strrpos($ScriptName, '/'));
    7272      } else $Page = null;
    73     } 
     73    }
    7474    $Navigation = substr($Navigation, 6);
    7575
     
    8989      //$Output .= '<div class="MainTitle">'.$Title.'</div>';
    9090      $Output .= '<div class="MainTitle"><span class="MenuItem"><strong>Navigace :: </strong> '.$Navigation.'</span><div class="MenuItem2">';
    91         foreach($this->System->Bars['Top'] as $BarItem)
    92         $Output .= call_user_func($BarItem);
     91      foreach($this->System->Bars['Top'] as $BarItem)
     92        $Output .= call_user_func($BarItem);
    9393      $Output .= '</div></div>';
    9494    }
     
    9999  {
    100100    global $ScriptTimeStart, $Revision, $ReleaseTime;
    101    
     101
    102102    $Time = round(GetMicrotime() - $ScriptTimeStart, 2);
    103103    $Output = '';
     
    112112    }
    113113    $Output .= '</body></html>';
    114     return($Output); 
     114    return($Output);
    115115  }
    116116
     
    122122    //  $Output = 'Chyba: '.$E->getMessage();
    123123    //}
    124     if($this->ClearPage == false) 
     124    if($this->ClearPage == false)
    125125    {
    126126      $Output = $this->ShowHeader($this->FullTitle, $this->ShortTitle).$Output;
     
    130130    echo($Output);
    131131  }
    132  
     132
    133133  function NewPage($ClassName)
    134134  {
     
    156156      }
    157157      $line = trim(substr($s, $start, $end + 1));
    158       if(strlen($line) > 0) 
     158      if(strlen($line) > 0)
    159159      if($line[0] == '<')
    160160      {
    161         if($s[$start + 1] == '/') 
     161        if($s[$start + 1] == '/')
    162162        {
    163163          $n = $n - 2;
    164164          $nn = $n;
    165         } else 
     165        } else
    166166        {
    167167          if(strpos($line, ' ')) $cmd = substr($line, 1, strpos($line, ' ') - 1);
     
    169169          //echo('['.$cmd.']');
    170170          if(strpos($s, '</'.$cmd.'>')) $n = $n + 2;
    171         }   
     171        }
    172172      }// else $line = '['.$line.']';
    173173      //if($line != '') echo(htmlspecialchars(str_repeat(' ',$nn).$line."\n"));
  • trunk/Common/RSS.php

    r548 r738  
    11<?php
    22
    3 class RSS 
     3class RSS
    44{
    55  var $Charset;
     
    99  var $WebmasterEmail;
    1010  var $Items;
    11  
     11
    1212  function __construct()
    1313  {
     
    1717
    1818  function Generate()
    19   { 
     19  {
    2020    $Result = '<?xml version="1.0" encoding="'.$this->Charset.'" ?>'."\n". //<?
    2121  '<rss version="2.0">'."\n".
     
    2626  "    <language>cs</language>\n".
    2727  "    <webMaster>".$this->WebmasterEmail."</webMaster>\n".
    28   "    <pubDate>".date('r')."</pubDate>\n". 
     28  "    <pubDate>".date('r')."</pubDate>\n".
    2929  "    <ttl>20</ttl>\n";
    3030    foreach($this->Items as $Item)
     
    3333        '      <title>'.htmlspecialchars($Item['Title'])."</title>\n".
    3434        '      <description>'.htmlspecialchars($Item['Description'])."</description>\n".
    35         '      <pubDate>'.date('r',$Item['Time'])."</pubDate>\n".
    36         '      <link>'.$Item['Link']."</link>\n".
     35  '      <pubDate>'.date('r',$Item['Time'])."</pubDate>\n".
     36  '      <link>'.$Item['Link']."</link>\n".
    3737        "    </item>\n";
    3838    }
  • trunk/Common/Setup/FullInstall.php

    r592 r738  
    99CREATE DEFINER=`centrala`@`localhost` FUNCTION `CompareNetworkPrefix`(Address1 INT(11) UNSIGNED, Address2 INT(11) UNSIGNED, Size INT(11)) RETURNS tinyint(1)
    1010RETURN Address1 & (-1 << (32 - Size)) = Address2 & (-1 << (32 - Size));
    11      
     11
    1212--
    1313-- Struktura tabulky `ChatHistory`
     
    20332033  $Manager->Execute("INSERT INTO `SystemVersion` (`Id`, `Revision`) VALUES
    20342034(1, 495);");
    2035  
     2035
    20362036}
    20372037
  • trunk/Common/Setup/Setup.php

    r737 r738  
    6969  function Show()
    7070  {
    71           global $ConfigDefinition, $DatabaseRevision, $Config, $Updates;
    72 
    73           $this->UpdateManager = $this->System->Setup->UpdateManager;
    74           $DefaultConfig = new DefaultConfig();
    75           $this->ConfigDefinition = $DefaultConfig->Get();
    76           $this->DatabaseRevision = $DatabaseRevision;
    77           $this->Config = &$Config;
    78 
    79           $Output = '';
     71    global $ConfigDefinition, $DatabaseRevision, $Config, $Updates;
     72
     73    $this->UpdateManager = $this->System->Setup->UpdateManager;
     74    $DefaultConfig = new DefaultConfig();
     75    $this->ConfigDefinition = $DefaultConfig->Get();
     76    $this->DatabaseRevision = $DatabaseRevision;
     77    $this->Config = &$Config;
     78
     79    $Output = '';
    8080    if(isset($this->Config))
    8181    {
     
    105105            $Output .= $this->System->Setup->Upgrade();
    106106          } catch (Exception $E) {
    107                   $Output .= $this->SystemMessage('Chyba aktualizace', 'Došlo k chybě v SQL dotazu při aktualizaci: <br/>'.$E->getMessage());
    108             }
    109                 $Output .= $this->ControlPanel();
     107            $Output .= $this->SystemMessage('Chyba aktualizace', 'Došlo k chybě v SQL dotazu při aktualizaci: <br/>'.$E->getMessage());
     108          }
     109          $Output .= $this->ControlPanel();
    110110        } else
    111111        if($Action == 'install')
     
    353353class PageSetupRedirect extends Page
    354354{
    355         function Show()
    356         {
    357           $Output = '';
    358           if(!$this->Database->Connected()) $Output .= 'Nelze se připojit k databázi.<br>';
    359           else {
    360             if(!$this->System->Setup->UpdateManager->IsInstalled())
    361               $Output .= 'Systém vyžaduje instalaci databáze.<br>';
    362             else
    363             if(!$this->System->Setup->UpdateManager->IsUpToDate())
    364               $Output .= 'Systém vyžaduje aktualizaci databáze.<br>';
    365           }
    366           $Output .= 'Pokračujte <a href="'.$this->System->Link('/setup/').'">zde</a>';
    367                 return($Output);
    368         }
     355  function Show()
     356  {
     357    $Output = '';
     358    if(!$this->Database->Connected()) $Output .= 'Nelze se připojit k databázi.<br>';
     359    else {
     360      if(!$this->System->Setup->UpdateManager->IsInstalled())
     361        $Output .= 'Systém vyžaduje instalaci databáze.<br>';
     362      else
     363      if(!$this->System->Setup->UpdateManager->IsUpToDate())
     364        $Output .= 'Systém vyžaduje aktualizaci databáze.<br>';
     365    }
     366    $Output .= 'Pokračujte <a href="'.$this->System->Link('/setup/').'">zde</a>';
     367    return($Output);
     368  }
    369369}
    370370
     
    404404  function Install()
    405405  {
    406         global $DatabaseRevision;
     406    global $DatabaseRevision;
    407407
    408408    $this->Database->query('CREATE TABLE IF NOT EXISTS `SystemVersion` (
  • trunk/Common/Setup/Update.php

    r725 r738  
    99  var $Database;
    1010  var $InstallMethod;
    11  
     11
    1212  function __construct()
    1313  {
    14           $this->Revision = 0;
    15           $this->Trace = array();
    16           $this->VersionTable = 'SystemVersion';
    17           $this->InstallMethod = 'FullInstall';
    18           $this->InsertSampleDataMethod = 'InsertSampleData';
     14    $this->Revision = 0;
     15    $this->Trace = array();
     16    $this->VersionTable = 'SystemVersion';
     17    $this->InstallMethod = 'FullInstall';
     18    $this->InsertSampleDataMethod = 'InsertSampleData';
    1919  }
    20  
     20
    2121  function GetDbVersion()
    2222  {
    23           $DbResult = $this->Database->select($this->VersionTable, '*', 'Id=1');
    24           $Version = $DbResult->fetch_assoc();   
     23    $DbResult = $this->Database->select($this->VersionTable, '*', 'Id=1');
     24    $Version = $DbResult->fetch_assoc();
    2525    return($Version['Revision']);
    2626  }
    27  
     27
    2828  function IsInstalled()
    29   {     
     29  {
    3030    debug_backtrace();
    31           $DbResult = $this->Database->query('SHOW TABLES LIKE "'.$this->VersionTable.'"');
    32     return($DbResult->num_rows > 0);   
     31    $DbResult = $this->Database->query('SHOW TABLES LIKE "'.$this->VersionTable.'"');
     32    return($DbResult->num_rows > 0);
    3333  }
    3434
    3535  function IsUpToDate()
    3636  {
    37           return($this->Revision <= $this->GetDbVersion());
     37    return($this->Revision <= $this->GetDbVersion());
    3838  }
    39  
     39
    4040  function Upgrade()
    4141  {
    42           $DbRevision = $this->GetDbVersion();
    43         $Output = 'Počáteční revize databáze: '.$DbRevision.'<br/>';
    44           while($this->Revision > $DbRevision)
     42    $DbRevision = $this->GetDbVersion();
     43    $Output = 'Počáteční revize databáze: '.$DbRevision.'<br/>';
     44    while($this->Revision > $DbRevision)
    4545    {
    46             $TraceItem = $this->Trace[$DbRevision];
    47             $Output .= 'Aktualizace na verzi '.$TraceItem['Revision'].':<br/>';
    48             // Show applied SQL queries immediatelly
    49             echo($Output);
    50             $Output = '';
    51             $RevUpdate = $TraceItem['Function'];
     46      $TraceItem = $this->Trace[$DbRevision];
     47      $Output .= 'Aktualizace na verzi '.$TraceItem['Revision'].':<br/>';
     48      // Show applied SQL queries immediatelly
     49      echo($Output);
     50      $Output = '';
     51      $RevUpdate = $TraceItem['Function'];
    5252      $RevUpdate($this);
    53             $DbRevision = $TraceItem['Revision'];
    54             $this->Database->query('UPDATE `'.$this->VersionTable.'` SET `Revision`= '.
    55                 $TraceItem['Revision'].' WHERE `Id`=1');
    56           }
    57           return($Output);       
     53      $DbRevision = $TraceItem['Revision'];
     54      $this->Database->query('UPDATE `'.$this->VersionTable.'` SET `Revision`= '.
     55        $TraceItem['Revision'].' WHERE `Id`=1');
     56    }
     57    return($Output);
    5858  }
    59  
     59
    6060  function Install()
    61   {     
    62         $InstallMethod = $this->InstallMethod;
    63         $InstallMethod($this);
    64         $this->Update();
     61  {
     62    $InstallMethod = $this->InstallMethod;
     63    $InstallMethod($this);
     64    $this->Update();
    6565  }
    66  
     66
    6767  function Uninstall()
    6868  {
    69    
     69
    7070  }
    71  
     71
    7272  function InsertSampleData()
    73   {     
    74         $InstallMethod = $this->InsertSampleDataMethod;
    75         $InstallMethod($this);
     73  {
     74    $InstallMethod = $this->InsertSampleDataMethod;
     75    $InstallMethod($this);
    7676  }
    77  
     77
    7878  function Execute($Query)
    7979  {
    80           echo($Query.';<br/>');
    81           flush();
    82           return($this->Database->query($Query));
     80    echo($Query.';<br/>');
     81    flush();
     82    return($this->Database->query($Query));
    8383  }
    8484}
  • trunk/Common/Setup/Updates.php

    r736 r738  
    538538function UpdateTo627($Manager)
    539539{
    540         $Manager->Execute('ALTER TABLE `FinanceInvoice` CHANGE `TimeCreation` `Time` DATETIME NOT NULL DEFAULT "0000-00-00 00:00:00";');
    541         $Manager->Execute('ALTER TABLE `FinanceYear` ADD `Closed` INT NOT NULL ;');
     540  $Manager->Execute('ALTER TABLE `FinanceInvoice` CHANGE `TimeCreation` `Time` DATETIME NOT NULL DEFAULT "0000-00-00 00:00:00";');
     541  $Manager->Execute('ALTER TABLE `FinanceYear` ADD `Closed` INT NOT NULL ;');
    542542}
    543543
    544544function UpdateTo632($Manager)
    545545{
    546         $Manager->Execute('CREATE TABLE IF NOT EXISTS `FinanceInvoiceOperationRel` (
     546  $Manager->Execute('CREATE TABLE IF NOT EXISTS `FinanceInvoiceOperationRel` (
    547547  `Id` int(11) NOT NULL AUTO_INCREMENT,
    548548  `Invoice` int(11) NOT NULL,
     
    559559function UpdateTo633($Manager)
    560560{
    561         $Manager->Execute('ALTER TABLE `UserOnline` ADD `StayLoggedHash` VARCHAR( 40 ) NOT NULL ;');
     561  $Manager->Execute('ALTER TABLE `UserOnline` ADD `StayLoggedHash` VARCHAR( 40 ) NOT NULL ;');
    562562}
    563563
    564564function UpdateTo645($Manager)
    565565{
    566         $Manager->Execute('CREATE TABLE IF NOT EXISTS `FinanceVATType` (
     566  $Manager->Execute('CREATE TABLE IF NOT EXISTS `FinanceVATType` (
    567567  `Id` int(11) NOT NULL,
    568568  `Name` varchar(255) NOT NULL,
     
    578578function UpdateTo646($Manager)
    579579{
    580         $Manager->Execute('CREATE TABLE IF NOT EXISTS `Contract` (
     580  $Manager->Execute('CREATE TABLE IF NOT EXISTS `Contract` (
    581581  `Id` int(11) NOT NULL AUTO_INCREMENT,
    582582  `BillCode` varchar(255) NOT NULL,
     
    614614function UpdateTo647($Manager)
    615615{
    616         $Manager->Execute('ALTER TABLE `EmployeeSalary` ADD FOREIGN KEY ( `Employee` ) REFERENCES `Employee` (
     616  $Manager->Execute('ALTER TABLE `EmployeeSalary` ADD FOREIGN KEY ( `Employee` ) REFERENCES `Employee` (
    617617`Id`
    618618) ON DELETE RESTRICT ON UPDATE RESTRICT ;');
     
    649649function UpdateTo656($Manager)
    650650{
    651         $Manager->Execute('CREATE TABLE IF NOT EXISTS `Measure` (
     651  $Manager->Execute('CREATE TABLE IF NOT EXISTS `Measure` (
    652652  `Id` int(11) NOT NULL AUTO_INCREMENT,
    653653  `Name` varchar(255) NOT NULL,
     
    708708function UpdateTo657($Manager)
    709709{
    710         $Manager->Execute('CREATE TABLE IF NOT EXISTS `NetworkInterfaceUpDown` (
     710  $Manager->Execute('CREATE TABLE IF NOT EXISTS `NetworkInterfaceUpDown` (
    711711  `Id` int(11) NOT NULL AUTO_INCREMENT,
    712712  `Time` datetime NOT NULL,
     
    873873  if($DbResult->num_rows > 0)
    874874  {
    875         $DbRow = $DbResult->fetch_assoc();
     875    $DbRow = $DbResult->fetch_assoc();
    876876    $Manager->Execute("INSERT INTO `MenuItem` (`Id` ,`Name` ,`Parent` ,`Action` ,`Menu`) ".
    877877      "VALUES (NULL , 'Oblíbené položky nabídky', ".$DbRow['Id'].", '".$ActionId."', '1');");
     
    887887function UpdateTo688($Manager)
    888888{
    889         // Convert monthly plus payment for consumption to regular service
     889  // Convert monthly plus payment for consumption to regular service
    890890  $DbResult = $Manager->Execute('SELECT `MonthlyPlus`, `Member` FROM `MemberPayment` WHERE `MonthlyPlus` > 0');
    891891  while($DbRow = $DbResult->fetch_assoc)
     
    935935
    936936function UpdateTo710($Manager)
    937 {       
     937{
    938938  $Manager->Execute('RENAME TABLE `StockItem` TO `StockSerialNumber`;');
    939939  $Manager->Execute('UPDATE `Action` SET `URL`="/is/?t=StockSerialNumber&a=list",`Title`="Sériová čísla" WHERE `URL`="/is/?t=StockItem&a=list";');
    940  
     940
    941941  // StockMove
    942942  $Manager->Execute('CREATE TABLE IF NOT EXISTS `StockMove` (
     
    949949  `File` int(11) DEFAULT NULL
    950950  ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;');
    951    
     951
    952952  $Manager->Execute('ALTER TABLE `StockMove`
    953953  ADD PRIMARY KEY (`Id`), ADD KEY `DocumentLine` (`DocumentLine`), ADD KEY `StockFrom` (`StockFrom`), ADD KEY `StockTo` (`StockTo`), ADD KEY `File` (`File`);');
    954    
     954
    955955  $Manager->Execute('ALTER TABLE `StockMove`
    956956  MODIFY `Id` int(11) NOT NULL AUTO_INCREMENT;');
    957  
     957
    958958  $Manager->Execute('ALTER TABLE `StockMove`
    959959  ADD CONSTRAINT `StockMove_ibfk_1` FOREIGN KEY (`StockFrom`) REFERENCES `Stock` (`Id`),
    960960  ADD CONSTRAINT `StockMove_ibfk_2` FOREIGN KEY (`StockTo`) REFERENCES `Stock` (`Id`),
    961961  ADD CONSTRAINT `StockMove_ibfk_3` FOREIGN KEY (`DocumentLine`) REFERENCES `DocumentLine` (`Id`);');
    962  
     962
    963963  // StockMoveItem
    964964  $Manager->Execute('CREATE TABLE IF NOT EXISTS `StockMoveItem` (
     
    970970  `UnitPrice` int(11) NOT NULL
    971971  ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;');
    972  
     972
    973973  $Manager->Execute('ALTER TABLE `StockMoveItem`
    974974  ADD PRIMARY KEY (`Id`), ADD KEY `Product` (`Product`), ADD KEY `StockMove` (`StockMove`);');
    975  
     975
    976976  $Manager->Execute('ALTER TABLE `StockMoveItem`
    977977  MODIFY `Id` int(11) NOT NULL AUTO_INCREMENT;');
     
    979979  $Manager->Execute('ALTER TABLE `StockMoveItem`
    980980  ADD CONSTRAINT `StockMoveItem_ibfk_2` FOREIGN KEY (`Product`) REFERENCES `Product` (`Id`),
    981   ADD CONSTRAINT `StockMoveItem_ibfk_1` FOREIGN KEY (`StockMove`) REFERENCES `StockMove` (`Id`);'); 
     981  ADD CONSTRAINT `StockMoveItem_ibfk_1` FOREIGN KEY (`StockMove`) REFERENCES `StockMove` (`Id`);');
    982982
    983983  // IS menu item
     
    989989  if($DbResult->num_rows > 0)
    990990  {
    991         $DbRow = $DbResult->fetch_assoc();
     991    $DbRow = $DbResult->fetch_assoc();
    992992    $Manager->Execute("INSERT INTO `MenuItem` (`Id` ,`Name` ,`Parent` ,`Action` ,`Menu`) ".
    993993      "VALUES (NULL , 'Skladové pohyby', ".$DbRow['Id'].", '".$ActionId."', '1');");
     
    997997function UpdateTo715($Manager)
    998998{
    999         $Manager->Execute('ALTER TABLE `StockSerialNumber` DROP FOREIGN KEY `StockSerialNumber_ibfk_6`;');
    1000         $Manager->Execute('ALTER TABLE `StockSerialNumber` DROP `Segment`');
    1001         $Manager->Execute('ALTER TABLE `Member` DROP `NetworkSegment`');
    1002         $Manager->Execute('DROP TABLE `NetworkSegment`');
    1003         $Manager->Execute('DELETE FROM `MenuItem` WHERE `Name`="Úseky sítě"');
    1004         $Manager->Execute('DELETE FROM `Action` WHERE `Title`="Úseky sítě"');
     999  $Manager->Execute('ALTER TABLE `StockSerialNumber` DROP FOREIGN KEY `StockSerialNumber_ibfk_6`;');
     1000  $Manager->Execute('ALTER TABLE `StockSerialNumber` DROP `Segment`');
     1001  $Manager->Execute('ALTER TABLE `Member` DROP `NetworkSegment`');
     1002  $Manager->Execute('DROP TABLE `NetworkSegment`');
     1003  $Manager->Execute('DELETE FROM `MenuItem` WHERE `Name`="Úseky sítě"');
     1004  $Manager->Execute('DELETE FROM `Action` WHERE `Title`="Úseky sítě"');
    10051005}
    10061006
    10071007function UpdateTo718($Manager)
    1008 {       
     1008{
    10091009  $Manager->Execute('CREATE TABLE IF NOT EXISTS `Company` (
    10101010`Id` int(11) NOT NULL,
     
    10271027  if($DbResult->num_rows > 0)
    10281028  {
    1029         $DbRow = $DbResult->fetch_assoc();
     1029    $DbRow = $DbResult->fetch_assoc();
    10301030    $Manager->Execute("INSERT INTO `MenuItem` (`Id` ,`Name` ,`Parent` ,`Action` ,`Menu`) ".
    10311031      "VALUES (NULL , 'Firmy', ".$DbRow['Id'].", '".$ActionId."', '1');");
     
    10341034
    10351035function UpdateTo719($Manager)
    1036 {       
     1036{
    10371037  $Manager->Execute('ALTER TABLE `FinanceOperation` ADD `Direction` INT NOT NULL AFTER `Cash`;');
    10381038  $Manager->Execute('UPDATE `FinanceOperation` SET `Direction` = 1 WHERE `Value` >= 0 ;');
    10391039  $Manager->Execute('UPDATE `FinanceOperation` SET `Direction` = -1 WHERE `Value` < 0 ;');
    10401040  $Manager->Execute('UPDATE `FinanceOperation` SET `Value` = -`Value` WHERE `Value` < 0 ;');
    1041   // Set missing FinanceOperation DocumentLine according BillCode 
     1041  // Set missing FinanceOperation DocumentLine according BillCode
    10421042  $Manager->Execute('UPDATE `FinanceOperation` SET `DocumentLine` = 1 WHERE (`BillCode` LIKE "PP%") AND (`DocumentLine` IS NULL)');
    10431043  $Manager->Execute('UPDATE `FinanceOperation` SET `DocumentLine` = 2 WHERE (`BillCode` LIKE "VP%") AND (`DocumentLine` IS NULL)');
    10441044  $Manager->Execute('UPDATE `FinanceOperation` SET `DocumentLine` = 3 WHERE (`BillCode` LIKE "BV%") AND (`DocumentLine` IS NULL)');
    10451045  $Manager->Execute('UPDATE `FinanceOperation` SET `DocumentLine` = 4 WHERE (`BillCode` LIKE "PR%") AND (`DocumentLine` IS NULL)');
    1046  
     1046
    10471047  // IS menu item
    10481048  $DbResult = $Manager->Execute('SELECT `Id` FROM `MenuItem` WHERE `Name`="Příjmy a výdaje"');
    10491049  if($DbResult->num_rows > 0)
    10501050  {
    1051         $DbRow = $DbResult->fetch_assoc();
     1051    $DbRow = $DbResult->fetch_assoc();
    10521052    $Manager->Execute('INSERT INTO `Action` (`Id` ,`Name` ,`Title` ,`Type` ,`URL` ,
    10531053    `Group` ,`Icon` ,`PermissionOperation` ,`Enable`) VALUES (
    10541054    NULL , "", "Příjem do pokladny", "1", "/is/?t=FinanceTreasuryIn&a=list", NULL , NULL , NULL , "1");');
    10551055    $ActionId = $Manager->Database->insert_id;
    1056         $Manager->Execute("INSERT INTO `MenuItem` (`Id` ,`Name` ,`Parent` ,`Action` ,`Menu`) ".
     1056    $Manager->Execute("INSERT INTO `MenuItem` (`Id` ,`Name` ,`Parent` ,`Action` ,`Menu`) ".
    10571057      "VALUES (NULL , 'Příjem do pokladny', ".$DbRow['Id'].", '".$ActionId."', '1');");
    10581058    $Manager->Execute('INSERT INTO `Action` (`Id` ,`Name` ,`Title` ,`Type` ,`URL` ,
     
    10601060    NULL , "", "Výdej z pokladny", "1", "/is/?t=FinanceTreasuryOut&a=list", NULL , NULL , NULL , "1");');
    10611061    $ActionId = $Manager->Database->insert_id;
    1062         $Manager->Execute("INSERT INTO `MenuItem` (`Id` ,`Name` ,`Parent` ,`Action` ,`Menu`) ".
     1062    $Manager->Execute("INSERT INTO `MenuItem` (`Id` ,`Name` ,`Parent` ,`Action` ,`Menu`) ".
    10631063      "VALUES (NULL , 'Výdej z pokladny', ".$DbRow['Id'].", '".$ActionId."', '1');");
    10641064    $Manager->Execute('INSERT INTO `Action` (`Id` ,`Name` ,`Title` ,`Type` ,`URL` ,
     
    10661066    NULL , "", "Příjem na účet", "1", "/is/?t=FinanceAccountIn&a=list", NULL , NULL , NULL , "1");');
    10671067    $ActionId = $Manager->Database->insert_id;
    1068         $Manager->Execute("INSERT INTO `MenuItem` (`Id` ,`Name` ,`Parent` ,`Action` ,`Menu`) ".
     1068    $Manager->Execute("INSERT INTO `MenuItem` (`Id` ,`Name` ,`Parent` ,`Action` ,`Menu`) ".
    10691069      "VALUES (NULL , 'Příjem na účet', ".$DbRow['Id'].", '".$ActionId."', '1');");
    10701070    $Manager->Execute('INSERT INTO `Action` (`Id` ,`Name` ,`Title` ,`Type` ,`URL` ,
     
    10721072    NULL , "", "Výdej z účtu", "1", "/is/?t=FinanceAccountOut&a=list", NULL , NULL , NULL , "1");');
    10731073    $ActionId = $Manager->Database->insert_id;
    1074         $Manager->Execute("INSERT INTO `MenuItem` (`Id` ,`Name` ,`Parent` ,`Action` ,`Menu`) ".
     1074    $Manager->Execute("INSERT INTO `MenuItem` (`Id` ,`Name` ,`Parent` ,`Action` ,`Menu`) ".
    10751075      "VALUES (NULL , 'Výdej z účtu', ".$DbRow['Id'].", '".$ActionId."', '1');");
    10761076  }
     
    10791079function UpdateTo720($Manager)
    10801080{
    1081         $Manager->Execute('ALTER TABLE `FinanceInvoice` ADD `Direction` INT NOT NULL AFTER `TimePayment`;');
    1082         $Manager->Execute('UPDATE `FinanceInvoice` SET `Direction` = 1 WHERE `Value` >= 0 ;');
    1083         $Manager->Execute('UPDATE `FinanceInvoice` SET `Direction` = -1 WHERE `Value` < 0 ;');
    1084         $Manager->Execute('UPDATE `FinanceInvoice` SET `Value` = -`Value` WHERE `Value` < 0 ;');
    1085         // Set missing FinanceInvoice DocumentLine according BillCode
    1086         $Manager->Execute('UPDATE `FinanceInvoice` SET `DocumentLine` = 5 WHERE (`BillCode` LIKE "PF%") AND (`DocumentLine` IS NULL)');
    1087         $Manager->Execute('UPDATE `FinanceInvoice` SET `DocumentLine` = 6 WHERE (`BillCode` LIKE "VF%") AND (`DocumentLine` IS NULL)');
    1088        
    1089         // IS menu item
    1090         $DbResult = $Manager->Execute('SELECT `Id` FROM `MenuItem` WHERE `Name`="Závazky a pohledávky"');
    1091         if($DbResult->num_rows > 0)
    1092         {
    1093                 $DbRow = $DbResult->fetch_assoc();
    1094                 $Manager->Execute('INSERT INTO `Action` (`Id` ,`Name` ,`Title` ,`Type` ,`URL` ,
     1081  $Manager->Execute('ALTER TABLE `FinanceInvoice` ADD `Direction` INT NOT NULL AFTER `TimePayment`;');
     1082  $Manager->Execute('UPDATE `FinanceInvoice` SET `Direction` = 1 WHERE `Value` >= 0 ;');
     1083  $Manager->Execute('UPDATE `FinanceInvoice` SET `Direction` = -1 WHERE `Value` < 0 ;');
     1084  $Manager->Execute('UPDATE `FinanceInvoice` SET `Value` = -`Value` WHERE `Value` < 0 ;');
     1085  // Set missing FinanceInvoice DocumentLine according BillCode
     1086  $Manager->Execute('UPDATE `FinanceInvoice` SET `DocumentLine` = 5 WHERE (`BillCode` LIKE "PF%") AND (`DocumentLine` IS NULL)');
     1087  $Manager->Execute('UPDATE `FinanceInvoice` SET `DocumentLine` = 6 WHERE (`BillCode` LIKE "VF%") AND (`DocumentLine` IS NULL)');
     1088
     1089  // IS menu item
     1090  $DbResult = $Manager->Execute('SELECT `Id` FROM `MenuItem` WHERE `Name`="Závazky a pohledávky"');
     1091  if($DbResult->num_rows > 0)
     1092  {
     1093    $DbRow = $DbResult->fetch_assoc();
     1094    $Manager->Execute('INSERT INTO `Action` (`Id` ,`Name` ,`Title` ,`Type` ,`URL` ,
    10951095    `Group` ,`Icon` ,`PermissionOperation` ,`Enable`) VALUES (
    10961096    NULL , "", "Příjaté", "1", "/is/?t=FinanceInvoiceIn&a=list", NULL , NULL , NULL , "1");');
    1097                 $ActionId = $Manager->Database->insert_id;
    1098                 $Manager->Execute("INSERT INTO `MenuItem` (`Id` ,`Name` ,`Parent` ,`Action` ,`Menu`) ".
    1099                                 "VALUES (NULL , 'Přijaté', ".$DbRow['Id'].", '".$ActionId."', '1');");
    1100                
    1101                 $Manager->Execute('INSERT INTO `Action` (`Id` ,`Name` ,`Title` ,`Type` ,`URL` ,
     1097    $ActionId = $Manager->Database->insert_id;
     1098    $Manager->Execute("INSERT INTO `MenuItem` (`Id` ,`Name` ,`Parent` ,`Action` ,`Menu`) ".
     1099        "VALUES (NULL , 'Přijaté', ".$DbRow['Id'].", '".$ActionId."', '1');");
     1100
     1101    $Manager->Execute('INSERT INTO `Action` (`Id` ,`Name` ,`Title` ,`Type` ,`URL` ,
    11021102    `Group` ,`Icon` ,`PermissionOperation` ,`Enable`) VALUES (
    11031103    NULL , "", "Vydané", "1", "/is/?t=FinanceInvoiceOut&a=list", NULL , NULL , NULL , "1");');
    1104                 $ActionId = $Manager->Database->insert_id;
    1105                 $Manager->Execute("INSERT INTO `MenuItem` (`Id` ,`Name` ,`Parent` ,`Action` ,`Menu`) ".
    1106                                 "VALUES (NULL , 'Vydané', ".$DbRow['Id'].", '".$ActionId."', '1');");
    1107         }
     1104    $ActionId = $Manager->Database->insert_id;
     1105    $Manager->Execute("INSERT INTO `MenuItem` (`Id` ,`Name` ,`Parent` ,`Action` ,`Menu`) ".
     1106        "VALUES (NULL , 'Vydané', ".$DbRow['Id'].", '".$ActionId."', '1');");
     1107  }
    11081108}
    11091109
    11101110function UpdateTo722($Manager)
    11111111{
    1112         $Manager->Execute('ALTER TABLE `Service` DROP `CustomerCount`;');
     1112  $Manager->Execute('ALTER TABLE `Service` DROP `CustomerCount`;');
    11131113}
    11141114
    11151115function UpdateTo725($Manager)
    11161116{
    1117         // Text column of invoices is not used. Text from invoice items is taken instead.
    1118         $DbResult = $Manager->Execute('ALTER TABLE `FinanceInvoice` DROP `Text`;');
    1119        
    1120         $SearchText = 'Připojení k síti';
    1121         $DbResult = $Manager->Execute('SELECT * FROM `FinanceInvoiceItem` WHERE `Description` LIKE "'.$SearchText.' za období%";');
    1122         while($DbRow = $DbResult->fetch_assoc())
    1123         {
    1124                 $Text = trim(substr($DbRow['Description'], strlen($SearchText.' za období') + 1));
    1125                 $Text = explode('-', $Text);           
    1126                 $PeriodFrom = explode('.', trim($Text[0]));
    1127                 $PeriodFrom = $PeriodFrom[2].'-'.$PeriodFrom[1].'-'.$PeriodFrom[0];
    1128                 $PeriodTo = explode('.', trim($Text[1]));
    1129                 $PeriodTo = $PeriodTo[2].'-'.$PeriodTo[1].'-'.$PeriodTo[0];
    1130                 $Manager->Execute('UPDATE `FinanceInvoice` SET `PeriodFrom`="'.$PeriodFrom.'", `PeriodTo`="'.$PeriodTo.'" WHERE `Id`='.$DbRow['FinanceInvoice']);
    1131         }
    1132         $DbResult = $Manager->Execute('UPDATE `FinanceInvoiceItem` SET `Description` = "'.$SearchText.'" WHERE `Description` LIKE "'.$SearchText.' za období%";');
    1133        
    1134         $SearchText = 'Připojení k Internetu';
    1135         $DbResult = $Manager->Execute('SELECT * FROM `FinanceInvoiceItem` WHERE `Description` LIKE "'.$SearchText.' za období%";');
    1136         while($DbRow = $DbResult->fetch_assoc())
    1137         {
    1138                 $Text = trim(substr($DbRow['Description'], strlen($SearchText.' za období') + 1));
    1139                 $Text = explode('-', $Text);           
    1140                 $PeriodFrom = explode('.', trim($Text[0]));
    1141                 $PeriodFrom = $PeriodFrom[2].'-'.$PeriodFrom[1].'-'.$PeriodFrom[0];
    1142                 $Text[1] = trim($Text[1]);
    1143                 if(strpos($Text[1], ' ') !== false) $Text[1] = substr($Text[1], 0, strpos($Text[1], ' '));
    1144                 $PeriodTo = explode('.', trim($Text[1]));
    1145                 $PeriodTo = $PeriodTo[2].'-'.$PeriodTo[1].'-'.$PeriodTo[0];
    1146                 $Manager->Execute('UPDATE `FinanceInvoice` SET `PeriodFrom`="'.$PeriodFrom.'", `PeriodTo`="'.$PeriodTo.'" WHERE `Id`='.$DbRow['FinanceInvoice']);
    1147         }
    1148         $DbResult = $Manager->Execute('UPDATE `FinanceInvoiceItem` SET `Description` = "'.$SearchText.'" WHERE `Description` LIKE "'.$SearchText.' za období%";');
     1117  // Text column of invoices is not used. Text from invoice items is taken instead.
     1118  $DbResult = $Manager->Execute('ALTER TABLE `FinanceInvoice` DROP `Text`;');
     1119
     1120  $SearchText = 'Připojení k síti';
     1121  $DbResult = $Manager->Execute('SELECT * FROM `FinanceInvoiceItem` WHERE `Description` LIKE "'.$SearchText.' za období%";');
     1122  while($DbRow = $DbResult->fetch_assoc())
     1123  {
     1124    $Text = trim(substr($DbRow['Description'], strlen($SearchText.' za období') + 1));
     1125    $Text = explode('-', $Text);
     1126    $PeriodFrom = explode('.', trim($Text[0]));
     1127    $PeriodFrom = $PeriodFrom[2].'-'.$PeriodFrom[1].'-'.$PeriodFrom[0];
     1128    $PeriodTo = explode('.', trim($Text[1]));
     1129    $PeriodTo = $PeriodTo[2].'-'.$PeriodTo[1].'-'.$PeriodTo[0];
     1130    $Manager->Execute('UPDATE `FinanceInvoice` SET `PeriodFrom`="'.$PeriodFrom.'", `PeriodTo`="'.$PeriodTo.'" WHERE `Id`='.$DbRow['FinanceInvoice']);
     1131  }
     1132  $DbResult = $Manager->Execute('UPDATE `FinanceInvoiceItem` SET `Description` = "'.$SearchText.'" WHERE `Description` LIKE "'.$SearchText.' za období%";');
     1133
     1134  $SearchText = 'Připojení k Internetu';
     1135  $DbResult = $Manager->Execute('SELECT * FROM `FinanceInvoiceItem` WHERE `Description` LIKE "'.$SearchText.' za období%";');
     1136  while($DbRow = $DbResult->fetch_assoc())
     1137  {
     1138    $Text = trim(substr($DbRow['Description'], strlen($SearchText.' za období') + 1));
     1139    $Text = explode('-', $Text);
     1140    $PeriodFrom = explode('.', trim($Text[0]));
     1141    $PeriodFrom = $PeriodFrom[2].'-'.$PeriodFrom[1].'-'.$PeriodFrom[0];
     1142    $Text[1] = trim($Text[1]);
     1143    if(strpos($Text[1], ' ') !== false) $Text[1] = substr($Text[1], 0, strpos($Text[1], ' '));
     1144    $PeriodTo = explode('.', trim($Text[1]));
     1145    $PeriodTo = $PeriodTo[2].'-'.$PeriodTo[1].'-'.$PeriodTo[0];
     1146    $Manager->Execute('UPDATE `FinanceInvoice` SET `PeriodFrom`="'.$PeriodFrom.'", `PeriodTo`="'.$PeriodTo.'" WHERE `Id`='.$DbRow['FinanceInvoice']);
     1147  }
     1148  $DbResult = $Manager->Execute('UPDATE `FinanceInvoiceItem` SET `Description` = "'.$SearchText.'" WHERE `Description` LIKE "'.$SearchText.' za období%";');
    11491149}
    11501150
    11511151function UpdateTo726($Manager)
    11521152{
    1153         $Manager->Execute('ALTER TABLE `ServiceCustomerRel` CHANGE `Action` `ChangeAction` ENUM("add","modify","remove") CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL;');
    1154         $Manager->Execute('ALTER TABLE `ServiceCustomerRel` ADD `ChangeTime` DATETIME NULL AFTER `ChangeAction`;');
    1155         $Manager->Execute('ALTER TABLE `ServiceCustomerRel` DROP FOREIGN KEY `ServiceCustomerRel_ibfk_4`;');
    1156         $Manager->Execute('ALTER TABLE `ServiceCustomerRel` CHANGE `ReplaceId` `ChangeReplaceId` INT(11) NULL DEFAULT NULL;');
    1157         $Manager->Execute('ALTER TABLE `ServiceCustomerRel` ADD FOREIGN KEY (`ChangeReplaceId`) REFERENCES `ServiceCustomerRel`(`Id`) ON DELETE RESTRICT ON UPDATE RESTRICT;');
    1158 
    1159         $Manager->Execute('ALTER TABLE `Service` CHANGE `Action` `ChangeAction` ENUM("add","modify","remove") CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL;');
    1160         $Manager->Execute('ALTER TABLE `Service` ADD `ChangeTime` DATETIME NULL AFTER `ChangeAction`;');
    1161         $Manager->Execute('ALTER TABLE `Service` DROP FOREIGN KEY `Service_ibfk_2`;');
    1162         $Manager->Execute('ALTER TABLE `Service` CHANGE `ReplaceId` `ChangeReplaceId` INT(11) NULL DEFAULT NULL;');
    1163         $Manager->Execute('ALTER TABLE `Service` ADD FOREIGN KEY (`ChangeReplaceId`) REFERENCES `Service`(`Id`) ON DELETE RESTRICT ON UPDATE RESTRICT;');
    1164 
    1165         $Manager->Execute('ALTER TABLE `FinanceCharge` CHANGE `Action` `ChangeAction` ENUM("add","modify","remove") CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL;');
    1166         $Manager->Execute('ALTER TABLE `FinanceCharge` ADD `ChangeTime` DATETIME NULL AFTER `ChangeAction`;');
    1167         $Manager->Execute('ALTER TABLE `FinanceCharge` DROP FOREIGN KEY `FinanceCharge_ibfk_1`;');
    1168         $Manager->Execute('ALTER TABLE `FinanceCharge` CHANGE `ReplaceId` `ChangeReplaceId` INT(11) NULL DEFAULT NULL;');
    1169         $Manager->Execute('ALTER TABLE `FinanceCharge` ADD FOREIGN KEY (`ChangeReplaceId`) REFERENCES `FinanceCharge`(`Id`) ON DELETE RESTRICT ON UPDATE RESTRICT;');
    1170        
    1171         $Manager->Execute('ALTER TABLE `MemberPayment` DROP `NetworkDevice`;');
     1153  $Manager->Execute('ALTER TABLE `ServiceCustomerRel` CHANGE `Action` `ChangeAction` ENUM("add","modify","remove") CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL;');
     1154  $Manager->Execute('ALTER TABLE `ServiceCustomerRel` ADD `ChangeTime` DATETIME NULL AFTER `ChangeAction`;');
     1155  $Manager->Execute('ALTER TABLE `ServiceCustomerRel` DROP FOREIGN KEY `ServiceCustomerRel_ibfk_4`;');
     1156  $Manager->Execute('ALTER TABLE `ServiceCustomerRel` CHANGE `ReplaceId` `ChangeReplaceId` INT(11) NULL DEFAULT NULL;');
     1157  $Manager->Execute('ALTER TABLE `ServiceCustomerRel` ADD FOREIGN KEY (`ChangeReplaceId`) REFERENCES `ServiceCustomerRel`(`Id`) ON DELETE RESTRICT ON UPDATE RESTRICT;');
     1158
     1159  $Manager->Execute('ALTER TABLE `Service` CHANGE `Action` `ChangeAction` ENUM("add","modify","remove") CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL;');
     1160  $Manager->Execute('ALTER TABLE `Service` ADD `ChangeTime` DATETIME NULL AFTER `ChangeAction`;');
     1161  $Manager->Execute('ALTER TABLE `Service` DROP FOREIGN KEY `Service_ibfk_2`;');
     1162  $Manager->Execute('ALTER TABLE `Service` CHANGE `ReplaceId` `ChangeReplaceId` INT(11) NULL DEFAULT NULL;');
     1163  $Manager->Execute('ALTER TABLE `Service` ADD FOREIGN KEY (`ChangeReplaceId`) REFERENCES `Service`(`Id`) ON DELETE RESTRICT ON UPDATE RESTRICT;');
     1164
     1165  $Manager->Execute('ALTER TABLE `FinanceCharge` CHANGE `Action` `ChangeAction` ENUM("add","modify","remove") CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL;');
     1166  $Manager->Execute('ALTER TABLE `FinanceCharge` ADD `ChangeTime` DATETIME NULL AFTER `ChangeAction`;');
     1167  $Manager->Execute('ALTER TABLE `FinanceCharge` DROP FOREIGN KEY `FinanceCharge_ibfk_1`;');
     1168  $Manager->Execute('ALTER TABLE `FinanceCharge` CHANGE `ReplaceId` `ChangeReplaceId` INT(11) NULL DEFAULT NULL;');
     1169  $Manager->Execute('ALTER TABLE `FinanceCharge` ADD FOREIGN KEY (`ChangeReplaceId`) REFERENCES `FinanceCharge`(`Id`) ON DELETE RESTRICT ON UPDATE RESTRICT;');
     1170
     1171  $Manager->Execute('ALTER TABLE `MemberPayment` DROP `NetworkDevice`;');
    11721172}
    11731173
     
    11751175{
    11761176 $Manager->Execute('ALTER TABLE `FinanceBankAccount` ADD `AutoImport` INT NOT NULL ;');
    1177  
     1177
    11781178  $Manager->Execute('CREATE TABLE IF NOT EXISTS `Scheduler` (
    11791179  `Id` int(11) NOT NULL,
     
    11891189  $Manager->Execute('ALTER TABLE `Scheduler`
    11901190 ADD PRIMARY KEY (`Id`);');
    1191  
     1191
    11921192  $Manager->Execute('ALTER TABLE `Scheduler`
    11931193MODIFY `Id` int(11) NOT NULL AUTO_INCREMENT;');
     
    12011201  if($DbResult->num_rows > 0)
    12021202  {
    1203         $DbRow = $DbResult->fetch_assoc();
     1203    $DbRow = $DbResult->fetch_assoc();
    12041204    $Manager->Execute("INSERT INTO `MenuItem` (`Id` ,`Name` ,`Parent` ,`Action` ,`Menu`) ".
    12051205      "VALUES (NULL , 'Plánovač', ".$DbRow['Id'].", '".$ActionId."', '1');");
    12061206  }
    1207  
     1207
    12081208  $Manager->Execute('INSERT INTO `Module` (`Id`, `Name`, `Title`) VALUES (NULL, "Plánovač", "Scheduler");');
    12091209}
     
    12111211function UpdateTo730($Manager)
    12121212{
    1213         $Manager->Execute('CREATE TABLE IF NOT EXISTS `SchedulerAction` (
     1213  $Manager->Execute('CREATE TABLE IF NOT EXISTS `SchedulerAction` (
    12141214  `Id` int(11) NOT NULL AUTO_INCREMENT,
    12151215  `Name` varchar(255) NOT NULL,
    12161216  `Class` varchar(255) NOT NULL,
    1217         PRIMARY KEY (`Id`)
    1218 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;');     
     1217  PRIMARY KEY (`Id`)
     1218) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;');
    12191219  $Manager->Execute('ALTER TABLE `Scheduler` CHANGE `Class` `Action` INT(11) NOT NULL;');
    12201220  $Manager->Execute("ALTER TABLE `Scheduler` ADD INDEX ( `Action` ) ");
     
    12261226function UpdateTo731($Manager)
    12271227{
    1228         // NetworkDomain
    1229         $Manager->Execute('CREATE TABLE IF NOT EXISTS `NetworkDomain` (
     1228  // NetworkDomain
     1229  $Manager->Execute('CREATE TABLE IF NOT EXISTS `NetworkDomain` (
    12301230`Id` int(11) NOT NULL,
    12311231`Name` varchar(255) NOT NULL,
     
    12521252  if($DbResult->num_rows > 0)
    12531253  {
    1254         $DbRow = $DbResult->fetch_assoc();
    1255         $Manager->Execute("INSERT INTO `MenuItem` (`Id` ,`Name` ,`Parent` ,`Action` ,`Menu`) ".
    1256                 "VALUES (NULL , 'Síťová doména', ".$DbRow['Id'].", '".$ActionId."', '1');");
    1257   } 
    1258        
    1259         // Model additions
    1260         $Manager->Execute('ALTER TABLE `Model` ADD `Title` VARCHAR(255) NOT NULL , '.
    1261                 'ADD `Query` VARCHAR(255) NOT NULL , '.
    1262                 'ADD `DefaultSortColumn` VARCHAR(255) NOT NULL , '.
    1263                 'ADD `DefaultSortOrder` INT NOT NULL ;');
    1264        
    1265         // ModelField
    1266         $Manager->Execute('CREATE TABLE IF NOT EXISTS `ModelField` (
    1267         `Id` int(11) NOT NULL,
    1268         `Name` varchar(255) NOT NULL,
    1269         `Model` int(11) NOT NULL,
    1270         `Query` varchar(255) NOT NULL,
    1271         `Type` varchar(255) NOT NULL,
    1272         `Title` varchar(255) NOT NULL,
    1273         `DefaultValue` varchar(255) NOT NULL,
    1274         `IsNull` int(11) NOT NULL,
    1275         `Suffix` varchar(255) NOT NULL
    1276         ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;');
    1277        
    1278         $Manager->Execute('ALTER TABLE `ModelField`
    1279         ADD PRIMARY KEY (`Id`), ADD KEY `Model` (`Model`);');
    1280        
    1281         $Manager->Execute('ALTER TABLE `ModelField`
    1282         MODIFY `Id` int(11) NOT NULL AUTO_INCREMENT;');
    1283        
    1284         $Manager->Execute('ALTER TABLE `ModelField`
    1285         ADD CONSTRAINT `ModelField_ibfk_1` FOREIGN KEY (`Model`) REFERENCES `Model` (`Id`);');
    1286        
    1287         // Module additions
    1288         $Manager->Execute('ALTER TABLE `Module` ADD `Version` VARCHAR(255) NOT NULL , '.
    1289                 'ADD `Creator` VARCHAR(255) NOT NULL , '.
    1290                 'ADD `License` VARCHAR(255) NOT NULL , '.
    1291                 'ADD `Installed` INT NOT NULL , '.
    1292                 'ADD `HomePage` VARCHAR(255) NOT NULL , '.
    1293                 'ADD `Description` TEXT NOT NULL ;');
    1294        
    1295         // ModuleLink
    1296         $Manager->Execute('CREATE TABLE IF NOT EXISTS `ModuleLink` (
     1254    $DbRow = $DbResult->fetch_assoc();
     1255    $Manager->Execute("INSERT INTO `MenuItem` (`Id` ,`Name` ,`Parent` ,`Action` ,`Menu`) ".
     1256      "VALUES (NULL , 'Síťová doména', ".$DbRow['Id'].", '".$ActionId."', '1');");
     1257  }
     1258
     1259  // Model additions
     1260  $Manager->Execute('ALTER TABLE `Model` ADD `Title` VARCHAR(255) NOT NULL , '.
     1261    'ADD `Query` VARCHAR(255) NOT NULL , '.
     1262    'ADD `DefaultSortColumn` VARCHAR(255) NOT NULL , '.
     1263    'ADD `DefaultSortOrder` INT NOT NULL ;');
     1264
     1265  // ModelField
     1266  $Manager->Execute('CREATE TABLE IF NOT EXISTS `ModelField` (
     1267  `Id` int(11) NOT NULL,
     1268  `Name` varchar(255) NOT NULL,
     1269  `Model` int(11) NOT NULL,
     1270  `Query` varchar(255) NOT NULL,
     1271  `Type` varchar(255) NOT NULL,
     1272  `Title` varchar(255) NOT NULL,
     1273  `DefaultValue` varchar(255) NOT NULL,
     1274  `IsNull` int(11) NOT NULL,
     1275  `Suffix` varchar(255) NOT NULL
     1276  ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;');
     1277
     1278  $Manager->Execute('ALTER TABLE `ModelField`
     1279  ADD PRIMARY KEY (`Id`), ADD KEY `Model` (`Model`);');
     1280
     1281  $Manager->Execute('ALTER TABLE `ModelField`
     1282  MODIFY `Id` int(11) NOT NULL AUTO_INCREMENT;');
     1283
     1284  $Manager->Execute('ALTER TABLE `ModelField`
     1285  ADD CONSTRAINT `ModelField_ibfk_1` FOREIGN KEY (`Model`) REFERENCES `Model` (`Id`);');
     1286
     1287  // Module additions
     1288  $Manager->Execute('ALTER TABLE `Module` ADD `Version` VARCHAR(255) NOT NULL , '.
     1289    'ADD `Creator` VARCHAR(255) NOT NULL , '.
     1290    'ADD `License` VARCHAR(255) NOT NULL , '.
     1291    'ADD `Installed` INT NOT NULL , '.
     1292    'ADD `HomePage` VARCHAR(255) NOT NULL , '.
     1293    'ADD `Description` TEXT NOT NULL ;');
     1294
     1295  // ModuleLink
     1296  $Manager->Execute('CREATE TABLE IF NOT EXISTS `ModuleLink` (
    12971297`Id` int(11) NOT NULL,
    12981298  `Module` int(11) NOT NULL,
     
    13051305
    13061306  $Manager->Execute('ALTER TABLE `ModuleLink`
    1307         MODIFY `Id` int(11) NOT NULL AUTO_INCREMENT;');
     1307    MODIFY `Id` int(11) NOT NULL AUTO_INCREMENT;');
    13081308}
    13091309
    13101310function UpdateTo735($Manager)
    13111311{
    1312         $Manager->Execute('CREATE TABLE IF NOT EXISTS `NetworkFreeAccess` (
     1312  $Manager->Execute('CREATE TABLE IF NOT EXISTS `NetworkFreeAccess` (
    13131313`Id` int(11) NOT NULL,
    13141314`IPAddress` varchar(255) NOT NULL,
    13151315`Time` datetime NOT NULL
    13161316) ENGINE=InnoDB DEFAULT CHARSET=utf8;');
    1317        
    1318         $Manager->Execute('ALTER TABLE `NetworkFreeAccess`
    1319         ADD PRIMARY KEY (`Id`);');
    1320        
    1321         $Manager->Execute('ALTER TABLE `NetworkFreeAccess`
    1322         MODIFY `Id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=1;');
    1323        
    1324         $Manager->Execute('ALTER TABLE `NetworkFreeAccess` ADD `Configured` INT NOT NULL ;');
    1325         $DbResult = $Manager->Execute('INSERT INTO `SchedulerAction` (`Id`, `Name`, `Class`) VALUES '.
    1326                 '(NULL, "Konfigurace internetu zdarma", "ScheduleConfigureFreeAccess");');
    1327         $ActionId = $Manager->Database->insert_id;
    1328         $Manager->Execute('INSERT INTO `Scheduler` (`Id`, `Name`, `Enabled`, `Action`,
    1329                 `Log`, `LastExecutedTime`, `ScheduledTime`, `Period`) VALUES (NULL, "Internet zdarma",
    1330                 1, '.$ActionId.', "", NULL, "", 5);');
    1331         $Manager->Execute('ALTER TABLE `Scheduler` CHANGE `ScheduledTime` `ScheduledTime` DATETIME NULL;');
     1317
     1318  $Manager->Execute('ALTER TABLE `NetworkFreeAccess`
     1319  ADD PRIMARY KEY (`Id`);');
     1320
     1321  $Manager->Execute('ALTER TABLE `NetworkFreeAccess`
     1322  MODIFY `Id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=1;');
     1323
     1324  $Manager->Execute('ALTER TABLE `NetworkFreeAccess` ADD `Configured` INT NOT NULL ;');
     1325  $DbResult = $Manager->Execute('INSERT INTO `SchedulerAction` (`Id`, `Name`, `Class`) VALUES '.
     1326    '(NULL, "Konfigurace internetu zdarma", "ScheduleConfigureFreeAccess");');
     1327  $ActionId = $Manager->Database->insert_id;
     1328  $Manager->Execute('INSERT INTO `Scheduler` (`Id`, `Name`, `Enabled`, `Action`,
     1329    `Log`, `LastExecutedTime`, `ScheduledTime`, `Period`) VALUES (NULL, "Internet zdarma",
     1330    1, '.$ActionId.', "", NULL, "", 5);');
     1331  $Manager->Execute('ALTER TABLE `Scheduler` CHANGE `ScheduledTime` `ScheduledTime` DATETIME NULL;');
    13321332}
    13331333
    13341334function UpdateTo736($Manager)
    13351335{
    1336         $Manager->Execute('CREATE TABLE IF NOT EXISTS `NetworkLinkType` (
     1336  $Manager->Execute('CREATE TABLE IF NOT EXISTS `NetworkLinkType` (
    13371337`Id` int(11) NOT NULL,
    13381338`Name` varchar(255) NOT NULL
     
    13991399      697 => array('Revision' => 707, 'Function' => 'UpdateTo707'),
    14001400      707 => array('Revision' => 710, 'Function' => 'UpdateTo710'),
    1401         710 => array('Revision' => 715, 'Function' => 'UpdateTo715'),
     1401      710 => array('Revision' => 715, 'Function' => 'UpdateTo715'),
    14021402      715 => array('Revision' => 718, 'Function' => 'UpdateTo718'),
    14031403      718 => array('Revision' => 719, 'Function' => 'UpdateTo719'),
    1404         719 => array('Revision' => 720, 'Function' => 'UpdateTo720'),
    1405         720 => array('Revision' => 722, 'Function' => 'UpdateTo722'),
    1406         722 => array('Revision' => 725, 'Function' => 'UpdateTo725'),
    1407         725 => array('Revision' => 726, 'Function' => 'UpdateTo726'),
    1408         726 => array('Revision' => 729, 'Function' => 'UpdateTo729'),
    1409         729 => array('Revision' => 730, 'Function' => 'UpdateTo730'),
    1410         730 => array('Revision' => 731, 'Function' => 'UpdateTo731'),
    1411         731 => array('Revision' => 735, 'Function' => 'UpdateTo735'),
    1412         735 => array('Revision' => 736, 'Function' => 'UpdateTo736'),
     1404      719 => array('Revision' => 720, 'Function' => 'UpdateTo720'),
     1405      720 => array('Revision' => 722, 'Function' => 'UpdateTo722'),
     1406      722 => array('Revision' => 725, 'Function' => 'UpdateTo725'),
     1407      725 => array('Revision' => 726, 'Function' => 'UpdateTo726'),
     1408      726 => array('Revision' => 729, 'Function' => 'UpdateTo729'),
     1409      729 => array('Revision' => 730, 'Function' => 'UpdateTo730'),
     1410      730 => array('Revision' => 731, 'Function' => 'UpdateTo731'),
     1411      731 => array('Revision' => 735, 'Function' => 'UpdateTo735'),
     1412      735 => array('Revision' => 736, 'Function' => 'UpdateTo736'),
    14131413    ));
    14141414  }
  • trunk/Common/Table.php

    r636 r738  
    11<?php
    22
    3 class Control 
     3class Control
    44{
    5         var $Name;
    6        
     5  var $Name;
     6
    77  function Show()
    88  {
    9           return('');
     9    return('');
    1010  }
    1111}
     
    1313class Table
    1414{
    15         function GetCell($Y, $X)
    16         {
    17                 return('');
    18         }
     15  function GetCell($Y, $X)
     16  {
     17    return('');
     18  }
    1919
    20         function BeginRead()
    21         {
    22         }
    23        
    24         function EndRead()
    25         {
    26         }
    27        
     20  function BeginRead()
     21  {
     22  }
     23
     24  function EndRead()
     25  {
     26  }
     27
    2828  function RowsCount()
    2929  {
    30         return(0);
     30    return(0);
    3131  }
    3232}
     
    3434class TableMemory extends Table
    3535{
    36         var $Cells;
    37        
    38         function GetCell($Y, $X)
    39         {
    40                 return($this->Cells[$Y][$X]);
    41         }
     36  var $Cells;
     37
     38  function GetCell($Y, $X)
     39  {
     40    return($this->Cells[$Y][$X]);
     41  }
    4242
    4343  function RowsCount()
    4444  {
    45         return(count($this->Cells));
     45    return(count($this->Cells));
    4646  }
    4747}
     
    4949class TableSQL extends Table
    5050{
    51         var $Query;
    52         var $Database;
    53         var $Cells;     
    54        
    55         function GetCell($Y, $X)
    56         {
    57                 return($this->Cells[$Y][$X]);
    58         }
    59        
    60         function BeginRead()
    61         {
    62                 $this->Cells = array();
    63                 $DbResult = $this->Database->query($this->Query);
    64                 while($DbRow = $DbResult->fetch_row())
    65                 {
    66                         $this->Cells[] = $DbRow;
    67                 }
    68         }
    69        
    70         function EndRead()
    71         {
    72                 $this->Cells = array();
    73         }
     51  var $Query;
     52  var $Database;
     53  var $Cells;
     54
     55  function GetCell($Y, $X)
     56  {
     57    return($this->Cells[$Y][$X]);
     58  }
     59
     60  function BeginRead()
     61  {
     62    $this->Cells = array();
     63    $DbResult = $this->Database->query($this->Query);
     64    while($DbRow = $DbResult->fetch_row())
     65    {
     66      $this->Cells[] = $DbRow;
     67    }
     68  }
     69
     70  function EndRead()
     71  {
     72    $this->Cells = array();
     73  }
    7474
    7575  function RowsCount()
    7676  {
    77         return(count($this->Cells));
     77    return(count($this->Cells));
    7878  }
    7979}
     
    8181class TableColumn
    8282{
    83         var $Name;
    84         var $Title;
     83  var $Name;
     84  var $Title;
    8585}
    8686
     
    9696  var $DefaultOrder;
    9797  var $Table;
    98  
     98
    9999  function __construct()
    100100  {
    101         global $System;
    102        
    103         $this->Columns = array();
    104         $this->Table = new TableMemory();
     101    global $System;
     102
     103    $this->Columns = array();
     104    $this->Table = new TableMemory();
    105105    $this->OrderDirSQL = array('ASC', 'DESC');
    106     $this->OrderArrowImage = array($System->Link('/images/sort_asc.png'), 
     106    $this->OrderArrowImage = array($System->Link('/images/sort_asc.png'),
    107107      $System->Link('/images/sort_desc.png'));
    108108    $this->DefaultOrder = 0;
    109109  }
    110  
     110
    111111  function SetColumns($Columns)
    112112  {
    113         $this->Columns = array();
    114         foreach($Columns as $Column)
    115         {
    116                 $NewCol = new TableColumn();
    117                 $NewCol->Name = $Column['Name'];
    118                 $NewCol->Title = $Column['Title'];
    119                 $this->Columns[] = $NewCol;
    120         }
    121         if(count($this->Columns) > 0)
    122           $this->DefaultColumn = $this->Columns[0]->Name;
    123           else $this->DefaultColumn = '';
     113    $this->Columns = array();
     114    foreach($Columns as $Column)
     115    {
     116      $NewCol = new TableColumn();
     117      $NewCol->Name = $Column['Name'];
     118      $NewCol->Title = $Column['Title'];
     119      $this->Columns[] = $NewCol;
     120    }
     121    if(count($this->Columns) > 0)
     122      $this->DefaultColumn = $this->Columns[0]->Name;
     123      else $this->DefaultColumn = '';
    124124  }
    125  
     125
    126126  function Show()
    127127  {
    128           $Output = '<table class="WideTable">';
    129           $Output .= $this->GetOrderHeader();
    130           $this->Table->BeginRead();
    131         for($Y = 0; $Y < $this->Table->RowsCount(); $Y++)
    132         {
    133             $Output .= '<tr>';
    134            
    135             for($X = 0; $X < count($this->Columns); $X++)
    136             {
    137                 $Cell = $this->Table->GetCell($Y, $X);
    138                 if($Cell == '') $Output .= '<td>&nbsp;</td>';
    139                     else $Output .= '<td>'.$Cell.'</td>';
    140             }       
    141             $Output .= '</tr>';
    142           }
    143           $this->Table->EndRead();
    144           $Output .= '</table>';
     128    $Output = '<table class="WideTable">';
     129    $Output .= $this->GetOrderHeader();
     130    $this->Table->BeginRead();
     131    for($Y = 0; $Y < $this->Table->RowsCount(); $Y++)
     132    {
     133      $Output .= '<tr>';
     134
     135      for($X = 0; $X < count($this->Columns); $X++)
     136      {
     137        $Cell = $this->Table->GetCell($Y, $X);
     138        if($Cell == '') $Output .= '<td>&nbsp;</td>';
     139          else $Output .= '<td>'.$Cell.'</td>';
     140      }
     141      $Output .= '</tr>';
     142    }
     143    $this->Table->EndRead();
     144    $Output .= '</table>';
    145145    return($Output);
    146146  }
    147  
     147
    148148  function GetOrderHeader()
    149149  {
     
    152152    if(!array_key_exists('OrderCol', $_SESSION)) $_SESSION['OrderCol'] = $this->DefaultColumn;
    153153    if(!array_key_exists('OrderDir', $_SESSION)) $_SESSION['OrderDir'] = $this->DefaultOrder;
    154  
     154
    155155    // Check OrderCol
    156156    $Found = false;
     
    159159      if($Column->Name == $_SESSION['OrderCol'])
    160160      {
    161         $Found = true;   
     161        $Found = true;
    162162        break;
    163163      }
     
    169169    }
    170170    // Check OrderDir
    171     if(($_SESSION['OrderDir'] != 0) and ($_SESSION['OrderDir'] != 1)) 
     171    if(($_SESSION['OrderDir'] != 0) and ($_SESSION['OrderDir'] != 1))
    172172      $_SESSION['OrderDir'] = 0;
    173  
     173
    174174    $Result = '';
    175175    $QueryItems = GetQueryStringArray($_SERVER['QUERY_STRING']);
     
    178178      $QueryItems['OrderCol'] = $Column->Name;
    179179      $QueryItems['OrderDir'] = 1 - $_SESSION['OrderDir'];
    180       if($Column->Name == $_SESSION['OrderCol']) 
     180      if($Column->Name == $_SESSION['OrderCol'])
    181181        $ArrowImage = '<img style="vertical-align: middle; border: 0px;" src="'.$this->OrderArrowImage[$_SESSION['OrderDir']].'" alt="order arrow">';
    182182        else $ArrowImage = '';
     
    187187    $this->OrderColumn = $_SESSION['OrderCol'];
    188188    $this->OrderDirection = $_SESSION['OrderDir'];
    189  
     189
    190190    return($Result);
    191191  }
  • trunk/Common/UTF8.php

    r635 r738  
    2121  ISO8859-1: iso1
    2222  Windows1257: win1257
    23  
     23
    2424  example:  $new_string=to_utf8($some_string,"win1250");
    2525*/
     
    2828/*
    2929  translation table - actually, it's array where key is hexadecimal number of
    30   character in ISO8859-2/Windows1250 and value is its two byte representation in UTF-8 
     30  character in ISO8859-2/Windows1250 and value is its two byte representation in UTF-8
    3131*/
    3232
    33 class Encoding 
     33class Encoding
    3434{
    3535  function __construct()
    3636  {
    37         $this->CharTable = array(
     37    $this->CharTable = array(
    3838  'iso2' => array(
    39         0x80=>"\xc2\x80",
    40         0x81=>"\xc2\x81",
    41         0x82=>"\xc2\x82",
    42         0x83=>"\xc2\x83",
    43         0x84=>"\xc2\x84",
    44         0x85=>"\xc2\x85",
    45         0x86=>"\xc2\x86",
    46         0x87=>"\xc2\x87",
    47         0x88=>"\xc2\x88",
    48         0x89=>"\xc2\x89",
    49         0x8A=>"\xc2\x8a",
    50         0x8B=>"\xc2\x8b",
    51         0x8C=>"\xc2\x8c",
    52         0x8D=>"\xc2\x8d",
    53         0x8E=>"\xc2\x8e",
    54         0x8F=>"\xc2\x8f",
    55         0x90=>"\xc2\x90",
    56         0x91=>"\xc2\x91",
    57         0x92=>"\xc2\x92",
    58         0x93=>"\xc2\x93",
    59         0x94=>"\xc2\x94",
    60         0x95=>"\xc2\x95",
    61         0x96=>"\xc2\x96",
    62         0x97=>"\xc2\x97",
    63         0x98=>"\xc2\x98",
    64         0x99=>"\xc2\x99",
    65         0x9A=>"\xc2\x9a",
    66         0x9B=>"\xc2\x9b",
    67         0x9C=>"\xc2\x9c",
    68         0x9D=>"\xc2\x9d",
    69         0x9E=>"\xc2\x9e",
    70         0x9F=>"\xc2\x9f",
    71         0xA0=>"\xc2\xa0",
    72         0xA1=>"\xc4\x84",
    73         0xA2=>"\xcb\x98",
    74         0xA3=>"\xc5\x81",
    75         0xA4=>"\xc2\xa4",
    76         0xA5=>"\xc4\xbd",
    77         0xA6=>"\xc5\x9a",
    78         0xA7=>"\xc2\xa7",
    79         0xA8=>"\xc2\xa8",
    80         0xA9=>"\xc5\xa0",
    81         0xAA=>"\xc5\x9e",
    82         0xAB=>"\xc5\xa4",
    83         0xAC=>"\xc5\xb9",
    84         0xAD=>"\xc2\xad",
    85         0xAE=>"\xc5\xbd",
    86         0xAF=>"\xc5\xbb",
    87         0xB0=>"\xc2\xb0",
    88         0xB1=>"\xc4\x85",
    89         0xB2=>"\xcb\x9b",
    90         0xB3=>"\xc5\x82",
    91         0xB4=>"\xc2\xb4",
    92         0xB5=>"\xc4\xbe",
    93         0xB6=>"\xc5\x9b",
    94         0xB7=>"\xcb\x87",
    95         0xB8=>"\xc2\xb8",
    96         0xB9=>"\xc5\xa1",
    97         0xBA=>"\xc5\x9f",
    98         0xBB=>"\xc5\xa5",
    99         0xBC=>"\xc5\xba",
    100         0xBD=>"\xcb\x9d",
    101         0xBE=>"\xc5\xbe",
    102         0xBF=>"\xc5\xbc",
    103         0xC0=>"\xc5\x94",
    104         0xC1=>"\xc3\x81",
    105         0xC2=>"\xc3\x82",
    106         0xC3=>"\xc4\x82",
    107         0xC4=>"\xc3\x84",
    108         0xC5=>"\xc4\xb9",
    109         0xC6=>"\xc4\x86",
    110         0xC7=>"\xc3\x87",
    111         0xC8=>"\xc4\x8c",
    112         0xC9=>"\xc3\x89",
    113         0xCA=>"\xc4\x98",
    114         0xCB=>"\xc3\x8b",
    115         0xCC=>"\xc4\x9a",
    116         0xCD=>"\xc3\x8d",
    117         0xCE=>"\xc3\x8e",
    118         0xCF=>"\xc4\x8e",
    119         0xD0=>"\xc4\x90",
    120         0xD1=>"\xc5\x83",
    121         0xD2=>"\xc5\x87",
    122         0xD3=>"\xc3\x93",
    123         0xD4=>"\xc3\x94",
    124         0xD5=>"\xc5\x90",
    125         0xD6=>"\xc3\x96",
    126         0xD7=>"\xc3\x97",
    127         0xD8=>"\xc5\x98",
    128         0xD9=>"\xc5\xae",
    129         0xDA=>"\xc3\x9a",
    130         0xDB=>"\xc5\xb0",
    131         0xDC=>"\xc3\x9c",
    132         0xDD=>"\xc3\x9d",
    133         0xDE=>"\xc5\xa2",
    134         0xDF=>"\xc3\x9f",
    135         0xE0=>"\xc5\x95",
    136         0xE1=>"\xc3\xa1",
    137         0xE2=>"\xc3\xa2",
    138         0xE3=>"\xc4\x83",
    139         0xE4=>"\xc3\xa4",
    140         0xE5=>"\xc4\xba",
    141         0xE6=>"\xc4\x87",
    142         0xE7=>"\xc3\xa7",
    143         0xE8=>"\xc4\x8d",
    144         0xE9=>"\xc3\xa9",
    145         0xEA=>"\xc4\x99",
    146         0xEB=>"\xc3\xab",
    147         0xEC=>"\xc4\x9b",
    148         0xED=>"\xc3\xad",
    149         0xEE=>"\xc3\xae",
    150         0xEF=>"\xc4\x8f",
    151         0xF0=>"\xc4\x91",
    152         0xF1=>"\xc5\x84",
    153         0xF2=>"\xc5\x88",
    154         0xF3=>"\xc3\xb3",
    155         0xF4=>"\xc3\xb4",
    156         0xF5=>"\xc5\x91",
    157         0xF6=>"\xc3\xb6",
    158         0xF7=>"\xc3\xb7",
    159         0xF8=>"\xc5\x99",
    160         0xF9=>"\xc5\xaf",
    161         0xFA=>"\xc3\xba",
    162         0xFB=>"\xc5\xb1",
    163         0xFC=>"\xc3\xbc",
    164         0xFD=>"\xc3\xbd",
    165         0xFE=>"\xc5\xa3",
    166         0xFF=>"\xcb\x99"
     39  0x80=>"\xc2\x80",
     40  0x81=>"\xc2\x81",
     41  0x82=>"\xc2\x82",
     42  0x83=>"\xc2\x83",
     43  0x84=>"\xc2\x84",
     44  0x85=>"\xc2\x85",
     45  0x86=>"\xc2\x86",
     46  0x87=>"\xc2\x87",
     47  0x88=>"\xc2\x88",
     48  0x89=>"\xc2\x89",
     49  0x8A=>"\xc2\x8a",
     50  0x8B=>"\xc2\x8b",
     51  0x8C=>"\xc2\x8c",
     52  0x8D=>"\xc2\x8d",
     53  0x8E=>"\xc2\x8e",
     54  0x8F=>"\xc2\x8f",
     55  0x90=>"\xc2\x90",
     56  0x91=>"\xc2\x91",
     57  0x92=>"\xc2\x92",
     58  0x93=>"\xc2\x93",
     59  0x94=>"\xc2\x94",
     60  0x95=>"\xc2\x95",
     61  0x96=>"\xc2\x96",
     62  0x97=>"\xc2\x97",
     63  0x98=>"\xc2\x98",
     64  0x99=>"\xc2\x99",
     65  0x9A=>"\xc2\x9a",
     66  0x9B=>"\xc2\x9b",
     67  0x9C=>"\xc2\x9c",
     68  0x9D=>"\xc2\x9d",
     69  0x9E=>"\xc2\x9e",
     70  0x9F=>"\xc2\x9f",
     71  0xA0=>"\xc2\xa0",
     72  0xA1=>"\xc4\x84",
     73  0xA2=>"\xcb\x98",
     74  0xA3=>"\xc5\x81",
     75  0xA4=>"\xc2\xa4",
     76  0xA5=>"\xc4\xbd",
     77  0xA6=>"\xc5\x9a",
     78  0xA7=>"\xc2\xa7",
     79  0xA8=>"\xc2\xa8",
     80  0xA9=>"\xc5\xa0",
     81  0xAA=>"\xc5\x9e",
     82  0xAB=>"\xc5\xa4",
     83  0xAC=>"\xc5\xb9",
     84  0xAD=>"\xc2\xad",
     85  0xAE=>"\xc5\xbd",
     86  0xAF=>"\xc5\xbb",
     87  0xB0=>"\xc2\xb0",
     88  0xB1=>"\xc4\x85",
     89  0xB2=>"\xcb\x9b",
     90  0xB3=>"\xc5\x82",
     91  0xB4=>"\xc2\xb4",
     92  0xB5=>"\xc4\xbe",
     93  0xB6=>"\xc5\x9b",
     94  0xB7=>"\xcb\x87",
     95  0xB8=>"\xc2\xb8",
     96  0xB9=>"\xc5\xa1",
     97  0xBA=>"\xc5\x9f",
     98  0xBB=>"\xc5\xa5",
     99  0xBC=>"\xc5\xba",
     100  0xBD=>"\xcb\x9d",
     101  0xBE=>"\xc5\xbe",
     102  0xBF=>"\xc5\xbc",
     103  0xC0=>"\xc5\x94",
     104  0xC1=>"\xc3\x81",
     105  0xC2=>"\xc3\x82",
     106  0xC3=>"\xc4\x82",
     107  0xC4=>"\xc3\x84",
     108  0xC5=>"\xc4\xb9",
     109  0xC6=>"\xc4\x86",
     110  0xC7=>"\xc3\x87",
     111  0xC8=>"\xc4\x8c",
     112  0xC9=>"\xc3\x89",
     113  0xCA=>"\xc4\x98",
     114  0xCB=>"\xc3\x8b",
     115  0xCC=>"\xc4\x9a",
     116  0xCD=>"\xc3\x8d",
     117  0xCE=>"\xc3\x8e",
     118  0xCF=>"\xc4\x8e",
     119  0xD0=>"\xc4\x90",
     120  0xD1=>"\xc5\x83",
     121  0xD2=>"\xc5\x87",
     122  0xD3=>"\xc3\x93",
     123  0xD4=>"\xc3\x94",
     124  0xD5=>"\xc5\x90",
     125  0xD6=>"\xc3\x96",
     126  0xD7=>"\xc3\x97",
     127  0xD8=>"\xc5\x98",
     128  0xD9=>"\xc5\xae",
     129  0xDA=>"\xc3\x9a",
     130  0xDB=>"\xc5\xb0",
     131  0xDC=>"\xc3\x9c",
     132  0xDD=>"\xc3\x9d",
     133  0xDE=>"\xc5\xa2",
     134  0xDF=>"\xc3\x9f",
     135  0xE0=>"\xc5\x95",
     136  0xE1=>"\xc3\xa1",
     137  0xE2=>"\xc3\xa2",
     138  0xE3=>"\xc4\x83",
     139  0xE4=>"\xc3\xa4",
     140  0xE5=>"\xc4\xba",
     141  0xE6=>"\xc4\x87",
     142  0xE7=>"\xc3\xa7",
     143  0xE8=>"\xc4\x8d",
     144  0xE9=>"\xc3\xa9",
     145  0xEA=>"\xc4\x99",
     146  0xEB=>"\xc3\xab",
     147  0xEC=>"\xc4\x9b",
     148  0xED=>"\xc3\xad",
     149  0xEE=>"\xc3\xae",
     150  0xEF=>"\xc4\x8f",
     151  0xF0=>"\xc4\x91",
     152  0xF1=>"\xc5\x84",
     153  0xF2=>"\xc5\x88",
     154  0xF3=>"\xc3\xb3",
     155  0xF4=>"\xc3\xb4",
     156  0xF5=>"\xc5\x91",
     157  0xF6=>"\xc3\xb6",
     158  0xF7=>"\xc3\xb7",
     159  0xF8=>"\xc5\x99",
     160  0xF9=>"\xc5\xaf",
     161  0xFA=>"\xc3\xba",
     162  0xFB=>"\xc5\xb1",
     163  0xFC=>"\xc3\xbc",
     164  0xFD=>"\xc3\xbd",
     165  0xFE=>"\xc5\xa3",
     166  0xFF=>"\xcb\x99"
    167167  ),
    168168  'win1250' => array(
    169         0x80=>"\xc2\x80",
    170         0x81=>"\xc2\x81",
    171         0x82=>"\xe2\x80\x9a",
    172         0x83=>"\xc2\x83",
    173         0x84=>"\xe2\x80\x9e",
    174         0x85=>"\xe2\x80\xa6",
    175         0x86=>"\xe2\x80\xa0",
    176         0x87=>"\xe2\x80\xa1",
    177         0x88=>"\xc2\x88",
    178         0x89=>"\xe2\x80\xb0",
    179         0x8a=>"\xc5\xa0",
    180         0x8b=>"\xe2\x80\xb9",
    181         0x8c=>"\xc5\x9a",
    182         0x8d=>"\xc5\xa4",
    183         0x8e=>"\xc5\xbd",
    184         0x8f=>"\xc5\xb9",
    185         0x90=>"\xc2\x90",
    186         0x91=>"\xe2\x80\x98",
    187         0x92=>"\xe2\x80\x99",
    188         0x93=>"\xe2\x80\x9c",
    189         0x94=>"\xe2\x80\x9d",
    190         0x95=>"\xe2\x80\xa2",
    191         0x96=>"\xe2\x80\x93",
    192         0x97=>"\xe2\x80\x94",
    193         0x98=>"\xe2\x80\x98",
    194         0x99=>"\xe2\x84\xa2",
    195         0x9a=>"\xc5\xa1",
    196         0x9b=>"\xe2\x80\xba",
    197         0x9c=>"\xc5\x9b",
    198         0x9d=>"\xc5\xa5",
    199         0x9e=>"\xc5\xbe",
    200         0x9f=>"\xc5\xba",
    201         0xa0=>"\xc2\xa0",
    202         0xa1=>"\xcb\x87",
    203         0xa2=>"\xcb\x98",
    204         0xa3=>"\xc5\x81",
    205         0xa4=>"\xc2\xa4",
    206         0xa5=>"\xc4\x84",
    207         0xa6=>"\xc2\xa6",
    208         0xa7=>"\xc2\xa7",
    209         0xa8=>"\xc2\xa8",
    210         0xa9=>"\xc2\xa9",
    211         0xaa=>"\xc5\x9e",
    212         0xab=>"\xc2\xab",
    213         0xac=>"\xc2\xac",
    214         0xad=>"\xc2\xad",
    215         0xae=>"\xc2\xae",
    216         0xaf=>"\xc5\xbb",
    217         0xb0=>"\xc2\xb0",
    218         0xb1=>"\xc2\xb1",
    219         0xb2=>"\xcb\x9b",
    220         0xb3=>"\xc5\x82",
    221         0xb4=>"\xc2\xb4",
    222         0xb5=>"\xc2\xb5",
    223         0xb6=>"\xc2\xb6",
    224         0xb7=>"\xc2\xb7",
    225         0xb8=>"\xc2\xb8",
    226         0xb9=>"\xc4\x85",
    227         0xba=>"\xc5\x9f",
    228         0xbb=>"\xc2\xbb",
    229         0xbc=>"\xc4\xbd",
    230         0xbd=>"\xcb\x9d",
    231         0xbe=>"\xc4\xbe",
    232         0xbf=>"\xc5\xbc",
    233         0xc0=>"\xc5\x94",
    234         0xc1=>"\xc3\x81",
    235         0xc2=>"\xc3\x82",
    236         0xc3=>"\xc4\x82",
    237         0xc4=>"\xc3\x84",
    238         0xc5=>"\xc4\xb9",
    239         0xc6=>"\xc4\x86",
    240         0xc7=>"\xc3\x87",
    241         0xc8=>"\xc4\x8c",
    242         0xc9=>"\xc3\x89",
    243         0xca=>"\xc4\x98",
    244         0xcb=>"\xc3\x8b",
    245         0xcc=>"\xc4\x9a",
    246         0xcd=>"\xc3\x8d",
    247         0xce=>"\xc3\x8e",
    248         0xcf=>"\xc4\x8e",
    249         0xd0=>"\xc4\x90",
    250         0xd1=>"\xc5\x83",
    251         0xd2=>"\xc5\x87",
    252         0xd3=>"\xc3\x93",
    253         0xd4=>"\xc3\x94",
    254         0xd5=>"\xc5\x90",
    255         0xd6=>"\xc3\x96",
    256         0xd7=>"\xc3\x97",
    257         0xd8=>"\xc5\x98",
    258         0xd9=>"\xc5\xae",
    259         0xda=>"\xc3\x9a",
    260         0xdb=>"\xc5\xb0",
    261         0xdc=>"\xc3\x9c",
    262         0xdd=>"\xc3\x9d",
    263         0xde=>"\xc5\xa2",
    264         0xdf=>"\xc3\x9f",
    265         0xe0=>"\xc5\x95",
    266         0xe1=>"\xc3\xa1",
    267         0xe2=>"\xc3\xa2",
    268         0xe3=>"\xc4\x83",
    269         0xe4=>"\xc3\xa4",
    270         0xe5=>"\xc4\xba",
    271         0xe6=>"\xc4\x87",
    272         0xe7=>"\xc3\xa7",
    273         0xe8=>"\xc4\x8d",
    274         0xe9=>"\xc3\xa9",
    275         0xea=>"\xc4\x99",
    276         0xeb=>"\xc3\xab",
    277         0xec=>"\xc4\x9b",
    278         0xed=>"\xc3\xad",
    279         0xee=>"\xc3\xae",
    280         0xef=>"\xc4\x8f",
    281         0xf0=>"\xc4\x91",
    282         0xf1=>"\xc5\x84",
    283         0xf2=>"\xc5\x88",
    284         0xf3=>"\xc3\xb3",
    285         0xf4=>"\xc3\xb4",
    286         0xf5=>"\xc5\x91",
    287         0xf6=>"\xc3\xb6",
    288         0xf7=>"\xc3\xb7",
    289         0xf8=>"\xc5\x99",
    290         0xf9=>"\xc5\xaf",
    291         0xfa=>"\xc3\xba",
    292         0xfb=>"\xc5\xb1",
    293         0xfc=>"\xc3\xbc",
    294         0xfd=>"\xc3\xbd",
    295         0xfe=>"\xc5\xa3",
    296         0xff=>"\xcb\x99"
     169  0x80=>"\xc2\x80",
     170  0x81=>"\xc2\x81",
     171  0x82=>"\xe2\x80\x9a",
     172  0x83=>"\xc2\x83",
     173  0x84=>"\xe2\x80\x9e",
     174  0x85=>"\xe2\x80\xa6",
     175  0x86=>"\xe2\x80\xa0",
     176  0x87=>"\xe2\x80\xa1",
     177  0x88=>"\xc2\x88",
     178  0x89=>"\xe2\x80\xb0",
     179  0x8a=>"\xc5\xa0",
     180  0x8b=>"\xe2\x80\xb9",
     181  0x8c=>"\xc5\x9a",
     182  0x8d=>"\xc5\xa4",
     183  0x8e=>"\xc5\xbd",
     184  0x8f=>"\xc5\xb9",
     185  0x90=>"\xc2\x90",
     186  0x91=>"\xe2\x80\x98",
     187  0x92=>"\xe2\x80\x99",
     188  0x93=>"\xe2\x80\x9c",
     189  0x94=>"\xe2\x80\x9d",
     190  0x95=>"\xe2\x80\xa2",
     191  0x96=>"\xe2\x80\x93",
     192  0x97=>"\xe2\x80\x94",
     193  0x98=>"\xe2\x80\x98",
     194  0x99=>"\xe2\x84\xa2",
     195  0x9a=>"\xc5\xa1",
     196  0x9b=>"\xe2\x80\xba",
     197  0x9c=>"\xc5\x9b",
     198  0x9d=>"\xc5\xa5",
     199  0x9e=>"\xc5\xbe",
     200  0x9f=>"\xc5\xba",
     201  0xa0=>"\xc2\xa0",
     202  0xa1=>"\xcb\x87",
     203  0xa2=>"\xcb\x98",
     204  0xa3=>"\xc5\x81",
     205  0xa4=>"\xc2\xa4",
     206  0xa5=>"\xc4\x84",
     207  0xa6=>"\xc2\xa6",
     208  0xa7=>"\xc2\xa7",
     209  0xa8=>"\xc2\xa8",
     210  0xa9=>"\xc2\xa9",
     211  0xaa=>"\xc5\x9e",
     212  0xab=>"\xc2\xab",
     213  0xac=>"\xc2\xac",
     214  0xad=>"\xc2\xad",
     215  0xae=>"\xc2\xae",
     216  0xaf=>"\xc5\xbb",
     217  0xb0=>"\xc2\xb0",
     218  0xb1=>"\xc2\xb1",
     219  0xb2=>"\xcb\x9b",
     220  0xb3=>"\xc5\x82",
     221  0xb4=>"\xc2\xb4",
     222  0xb5=>"\xc2\xb5",
     223  0xb6=>"\xc2\xb6",
     224  0xb7=>"\xc2\xb7",
     225  0xb8=>"\xc2\xb8",
     226  0xb9=>"\xc4\x85",
     227  0xba=>"\xc5\x9f",
     228  0xbb=>"\xc2\xbb",
     229  0xbc=>"\xc4\xbd",
     230  0xbd=>"\xcb\x9d",
     231  0xbe=>"\xc4\xbe",
     232  0xbf=>"\xc5\xbc",
     233  0xc0=>"\xc5\x94",
     234  0xc1=>"\xc3\x81",
     235  0xc2=>"\xc3\x82",
     236  0xc3=>"\xc4\x82",
     237  0xc4=>"\xc3\x84",
     238  0xc5=>"\xc4\xb9",
     239  0xc6=>"\xc4\x86",
     240  0xc7=>"\xc3\x87",
     241  0xc8=>"\xc4\x8c",
     242  0xc9=>"\xc3\x89",
     243  0xca=>"\xc4\x98",
     244  0xcb=>"\xc3\x8b",
     245  0xcc=>"\xc4\x9a",
     246  0xcd=>"\xc3\x8d",
     247  0xce=>"\xc3\x8e",
     248  0xcf=>"\xc4\x8e",
     249  0xd0=>"\xc4\x90",
     250  0xd1=>"\xc5\x83",
     251  0xd2=>"\xc5\x87",
     252  0xd3=>"\xc3\x93",
     253  0xd4=>"\xc3\x94",
     254  0xd5=>"\xc5\x90",
     255  0xd6=>"\xc3\x96",
     256  0xd7=>"\xc3\x97",
     257  0xd8=>"\xc5\x98",
     258  0xd9=>"\xc5\xae",
     259  0xda=>"\xc3\x9a",
     260  0xdb=>"\xc5\xb0",
     261  0xdc=>"\xc3\x9c",
     262  0xdd=>"\xc3\x9d",
     263  0xde=>"\xc5\xa2",
     264  0xdf=>"\xc3\x9f",
     265  0xe0=>"\xc5\x95",
     266  0xe1=>"\xc3\xa1",
     267  0xe2=>"\xc3\xa2",
     268  0xe3=>"\xc4\x83",
     269  0xe4=>"\xc3\xa4",
     270  0xe5=>"\xc4\xba",
     271  0xe6=>"\xc4\x87",
     272  0xe7=>"\xc3\xa7",
     273  0xe8=>"\xc4\x8d",
     274  0xe9=>"\xc3\xa9",
     275  0xea=>"\xc4\x99",
     276  0xeb=>"\xc3\xab",
     277  0xec=>"\xc4\x9b",
     278  0xed=>"\xc3\xad",
     279  0xee=>"\xc3\xae",
     280  0xef=>"\xc4\x8f",
     281  0xf0=>"\xc4\x91",
     282  0xf1=>"\xc5\x84",
     283  0xf2=>"\xc5\x88",
     284  0xf3=>"\xc3\xb3",
     285  0xf4=>"\xc3\xb4",
     286  0xf5=>"\xc5\x91",
     287  0xf6=>"\xc3\xb6",
     288  0xf7=>"\xc3\xb7",
     289  0xf8=>"\xc5\x99",
     290  0xf9=>"\xc5\xaf",
     291  0xfa=>"\xc3\xba",
     292  0xfb=>"\xc5\xb1",
     293  0xfc=>"\xc3\xbc",
     294  0xfd=>"\xc3\xbd",
     295  0xfe=>"\xc5\xa3",
     296  0xff=>"\xcb\x99"
    297297  ),
    298298  'iso1' => array(
    299         0xA0=>"\xc2\xa0",
    300         0xA1=>"\xc2\xa1",
    301         0xA2=>"\xc2\xa2",
    302         0xA3=>"\xc2\xa3",
    303         0xA4=>"\xc2\xa4",
    304         0xA5=>"\xc2\xa5",
    305         0xA6=>"\xc2\xa6",
    306         0xA7=>"\xc2\xa7",
    307         0xA8=>"\xc2\xa8",
    308         0xA9=>"\xc2\xa9",
    309         0xAA=>"\xc2\xaa",
    310         0xAB=>"\xc2\xab",
    311         0xAC=>"\xc2\xac",
    312         0xAD=>"\xc2\xad",
    313         0xAE=>"\xc2\xae",
    314         0xAF=>"\xc2\xaf",
    315         0xB0=>"\xc2\xb0",
    316         0xB1=>"\xc2\xb1",
    317         0xB2=>"\xc2\xb2",
    318         0xB3=>"\xc2\xb3",
    319         0xB4=>"\xc2\xb4",
    320         0xB5=>"\xc2\xb5",
    321         0xB6=>"\xc2\xb6",
    322         0xB7=>"\xc2\xb7",
    323         0xB8=>"\xc2\xb8",
    324         0xB9=>"\xc2\xb9",
    325         0xBA=>"\xc2\xba",
    326         0xBB=>"\xc2\xbb",
    327         0xBC=>"\xc2\xbc",
    328         0xBD=>"\xc2\xbd",
    329         0xBE=>"\xc2\xbe",
    330         0xBF=>"\xc2\xbf",
    331         0xC0=>"\xc3\x80",
    332         0xC1=>"\xc3\x81",
    333         0xC2=>"\xc3\x82",
    334         0xC3=>"\xc3\x83",
    335         0xC4=>"\xc3\x84",
    336         0xC5=>"\xc3\x85",
    337         0xC6=>"\xc3\x86",
    338         0xC7=>"\xc3\x87",
    339         0xC8=>"\xc3\x88",
    340         0xC9=>"\xc3\x89",
    341         0xCA=>"\xc3\x8a",
    342         0xCB=>"\xc3\x8b",
    343         0xCC=>"\xc3\x8c",
    344         0xCD=>"\xc3\x8d",
    345         0xCE=>"\xc3\x8e",
    346         0xCF=>"\xc3\x8f",
    347         0xD0=>"\xc3\x90",
    348         0xD1=>"\xc3\x91",
    349         0xD2=>"\xc3\x92",
    350         0xD3=>"\xc3\x93",
    351         0xD4=>"\xc3\x94",
    352         0xD5=>"\xc3\x95",
    353         0xD6=>"\xc3\x96",
    354         0xD7=>"\xc3\x97",
    355         0xD8=>"\xc3\x98",
    356         0xD9=>"\xc3\x99",
    357         0xDA=>"\xc3\x9a",
    358         0xDB=>"\xc3\x9b",
    359         0xDC=>"\xc3\x9c",
    360         0xDD=>"\xc3\x9d",
    361         0xDE=>"\xc3\x9e",
    362         0xDF=>"\xc3\x9f",
    363         0xE0=>"\xc3\xa0",
    364         0xE1=>"\xc3\xa1",
    365         0xE2=>"\xc3\xa2",
    366         0xE3=>"\xc3\xa3",
    367         0xE4=>"\xc3\xa4",
    368         0xE5=>"\xc3\xa5",
    369         0xE6=>"\xc3\xa6",
    370         0xE7=>"\xc3\xa7",
    371         0xE8=>"\xc3\xa8",
    372         0xE9=>"\xc3\xa9",
    373         0xEA=>"\xc3\xaa",
    374         0xEB=>"\xc3\xab",
    375         0xEC=>"\xc3\xac",
    376         0xED=>"\xc3\xad",
    377         0xEE=>"\xc3\xae",
    378         0xEF=>"\xc3\xaf",
    379         0xF0=>"\xc3\xb0",
    380         0xF1=>"\xc3\xb1",
    381         0xF2=>"\xc3\xb2",
    382         0xF3=>"\xc3\xb3",
    383         0xF4=>"\xc3\xb4",
    384         0xF5=>"\xc3\xb5",
    385         0xF6=>"\xc3\xb6",
    386         0xF7=>"\xc3\xb7",
    387         0xF8=>"\xc3\xb8",
    388         0xF9=>"\xc3\xb9",
    389         0xFA=>"\xc3\xba",
    390         0xFB=>"\xc3\xbb",
    391         0xFC=>"\xc3\xbc",
    392         0xFD=>"\xc3\xbd",
    393         0xFE=>"\xc3\xbe"
     299  0xA0=>"\xc2\xa0",
     300  0xA1=>"\xc2\xa1",
     301  0xA2=>"\xc2\xa2",
     302  0xA3=>"\xc2\xa3",
     303  0xA4=>"\xc2\xa4",
     304  0xA5=>"\xc2\xa5",
     305  0xA6=>"\xc2\xa6",
     306  0xA7=>"\xc2\xa7",
     307  0xA8=>"\xc2\xa8",
     308  0xA9=>"\xc2\xa9",
     309  0xAA=>"\xc2\xaa",
     310  0xAB=>"\xc2\xab",
     311  0xAC=>"\xc2\xac",
     312  0xAD=>"\xc2\xad",
     313  0xAE=>"\xc2\xae",
     314  0xAF=>"\xc2\xaf",
     315  0xB0=>"\xc2\xb0",
     316  0xB1=>"\xc2\xb1",
     317  0xB2=>"\xc2\xb2",
     318  0xB3=>"\xc2\xb3",
     319  0xB4=>"\xc2\xb4",
     320  0xB5=>"\xc2\xb5",
     321  0xB6=>"\xc2\xb6",
     322  0xB7=>"\xc2\xb7",
     323  0xB8=>"\xc2\xb8",
     324  0xB9=>"\xc2\xb9",
     325  0xBA=>"\xc2\xba",
     326  0xBB=>"\xc2\xbb",
     327  0xBC=>"\xc2\xbc",
     328  0xBD=>"\xc2\xbd",
     329  0xBE=>"\xc2\xbe",
     330  0xBF=>"\xc2\xbf",
     331  0xC0=>"\xc3\x80",
     332  0xC1=>"\xc3\x81",
     333  0xC2=>"\xc3\x82",
     334  0xC3=>"\xc3\x83",
     335  0xC4=>"\xc3\x84",
     336  0xC5=>"\xc3\x85",
     337  0xC6=>"\xc3\x86",
     338  0xC7=>"\xc3\x87",
     339  0xC8=>"\xc3\x88",
     340  0xC9=>"\xc3\x89",
     341  0xCA=>"\xc3\x8a",
     342  0xCB=>"\xc3\x8b",
     343  0xCC=>"\xc3\x8c",
     344  0xCD=>"\xc3\x8d",
     345  0xCE=>"\xc3\x8e",
     346  0xCF=>"\xc3\x8f",
     347  0xD0=>"\xc3\x90",
     348  0xD1=>"\xc3\x91",
     349  0xD2=>"\xc3\x92",
     350  0xD3=>"\xc3\x93",
     351  0xD4=>"\xc3\x94",
     352  0xD5=>"\xc3\x95",
     353  0xD6=>"\xc3\x96",
     354  0xD7=>"\xc3\x97",
     355  0xD8=>"\xc3\x98",
     356  0xD9=>"\xc3\x99",
     357  0xDA=>"\xc3\x9a",
     358  0xDB=>"\xc3\x9b",
     359  0xDC=>"\xc3\x9c",
     360  0xDD=>"\xc3\x9d",
     361  0xDE=>"\xc3\x9e",
     362  0xDF=>"\xc3\x9f",
     363  0xE0=>"\xc3\xa0",
     364  0xE1=>"\xc3\xa1",
     365  0xE2=>"\xc3\xa2",
     366  0xE3=>"\xc3\xa3",
     367  0xE4=>"\xc3\xa4",
     368  0xE5=>"\xc3\xa5",
     369  0xE6=>"\xc3\xa6",
     370  0xE7=>"\xc3\xa7",
     371  0xE8=>"\xc3\xa8",
     372  0xE9=>"\xc3\xa9",
     373  0xEA=>"\xc3\xaa",
     374  0xEB=>"\xc3\xab",
     375  0xEC=>"\xc3\xac",
     376  0xED=>"\xc3\xad",
     377  0xEE=>"\xc3\xae",
     378  0xEF=>"\xc3\xaf",
     379  0xF0=>"\xc3\xb0",
     380  0xF1=>"\xc3\xb1",
     381  0xF2=>"\xc3\xb2",
     382  0xF3=>"\xc3\xb3",
     383  0xF4=>"\xc3\xb4",
     384  0xF5=>"\xc3\xb5",
     385  0xF6=>"\xc3\xb6",
     386  0xF7=>"\xc3\xb7",
     387  0xF8=>"\xc3\xb8",
     388  0xF9=>"\xc3\xb9",
     389  0xFA=>"\xc3\xba",
     390  0xFB=>"\xc3\xbb",
     391  0xFC=>"\xc3\xbc",
     392  0xFD=>"\xc3\xbd",
     393  0xFE=>"\xc3\xbe"
    394394  ),
    395395  'win1257' => array(
    396         0x80=>"\xe2\x82\xac",
    397         0x81=>"\xc0\x4",
    398         0x82=>"\xe2\x80\x9a",
    399         0x83=>"\xc0\x4",
    400         0x84=>"\xe2\x80\x9e",
    401         0x85=>"\xe2\x80\xa6",
    402         0x86=>"\xe2\x80\xa0",
    403         0x87=>"\xe2\x80\xa1",
    404         0x88=>"\xc0\x4",
    405         0x89=>"\xe2\x80\xb0",
    406         0x8A=>"\xc0\x4",
    407         0x8B=>"\xe2\x80\xb9",
    408         0x8C=>"\xc0\x4",
    409         0x8D=>"\xc2\xa8",
    410         0x8E=>"\xcb\x87",
    411         0x8F=>"\xc2\xb8",
    412         0x90=>"\xc0\x4",
    413         0x91=>"\xe2\x80\x98",
    414         0x92=>"\xe2\x80\x99",
    415         0x93=>"\xe2\x80\x9c",
    416         0x94=>"\xe2\x80\x9d",
    417         0x95=>"\xe2\x80\xa2",
    418         0x96=>"\xe2\x80\x93",
    419         0x97=>"\xe2\x80\x94",
    420         0x98=>"\xc0\x4",
    421         0x99=>"\xe2\x84\xa2",
    422         0x9A=>"\xc0\x4",
    423         0x9B=>"\xe2\x80\xba",
    424         0x9C=>"\xc0\x4",
    425         0x9D=>"\xc2\xaf",
    426         0x9E=>"\xcb\x9b",
    427         0x9F=>"\xc0\x4",
    428         0xA0=>"\xc2\xa0",
    429         0xA1=>"\xc0\x4",
    430         0xA2=>"\xc2\xa2",
    431         0xA3=>"\xc2\xa3",
    432         0xA4=>"\xc2\xa4",
    433         0xA5=>"\xc0\x4",
    434         0xA6=>"\xc2\xa6",
    435         0xA7=>"\xc2\xa7",
    436         0xA8=>"\xc3\x98",
    437         0xA9=>"\xc2\xa9",
    438         0xAA=>"\xc5\x96",
    439         0xAB=>"\xc2\xab",
    440         0xAC=>"\xc2\xac",
    441         0xAD=>"\xc2\xad",
    442         0xAE=>"\xc2\xae",
    443         0xAF=>"\xc3\x86",
    444         0xB0=>"\xc2\xb0",
    445         0xB1=>"\xc2\xb1",
    446         0xB2=>"\xc2\xb2",
    447         0xB3=>"\xc2\xb3",
    448         0xB4=>"\xc2\xb4",
    449         0xB5=>"\xc2\xb5",
    450         0xB6=>"\xc2\xb6",
    451         0xB7=>"\xc2\xb7",
    452         0xB8=>"\xc3\xb8",
    453         0xB9=>"\xc2\xb9",
    454         0xBA=>"\xc5\x97",
    455         0xBB=>"\xc2\xbb",
    456         0xBC=>"\xc2\xbc",
    457         0xBD=>"\xc2\xbd",
    458         0xBE=>"\xc2\xbe",
    459         0xBF=>"\xc3\xa6",
    460         0xC0=>"\xc4\x84",
    461         0xC1=>"\xc4\xae",
    462         0xC2=>"\xc4\x80",
    463         0xC3=>"\xc4\x86",
    464         0xC4=>"\xc3\x84",
    465         0xC5=>"\xc3\x85",
    466         0xC6=>"\xc4\x98",
    467         0xC7=>"\xc4\x92",
    468         0xC8=>"\xc4\x8c",
    469         0xC9=>"\xc3\x89",
    470         0xCA=>"\xc5\xb9",
    471         0xCB=>"\xc4\x96",
    472         0xCC=>"\xc4\xa2",
    473         0xCD=>"\xc4\xb6",
    474         0xCE=>"\xc4\xaa",
    475         0xCF=>"\xc4\xbb",
    476         0xD0=>"\xc5\xa0",
    477         0xD1=>"\xc5\x83",
    478         0xD2=>"\xc5\x85",
    479         0xD3=>"\xc3\x93",
    480         0xD4=>"\xc5\x8c",
    481         0xD5=>"\xc3\x95",
    482         0xD6=>"\xc3\x96",
    483         0xD7=>"\xc3\x97",
    484         0xD8=>"\xc5\xb2",
    485         0xD9=>"\xc5\x81",
    486         0xDA=>"\xc5\x9a",
    487         0xDB=>"\xc5\xaa",
    488         0xDC=>"\xc3\x9c",
    489         0xDD=>"\xc5\xbb",
    490         0xDE=>"\xc5\xbd",
    491         0xDF=>"\xc3\x9f",
    492         0xE0=>"\xc4\x85",
    493         0xE1=>"\xc4\xaf",
    494         0xE2=>"\xc4\x81",
    495         0xE3=>"\xc4\x87",
    496         0xE4=>"\xc3\xa4",
    497         0xE5=>"\xc3\xa5",
    498         0xE6=>"\xc4\x99",
    499         0xE7=>"\xc4\x93",
    500         0xE8=>"\xc4\x8d",
    501         0xE9=>"\xc3\xa9",
    502         0xEA=>"\xc5\xba",
    503         0xEB=>"\xc4\x97",
    504         0xEC=>"\xc4\xa3",
    505         0xED=>"\xc4\xb7",
    506         0xEE=>"\xc4\xab",
    507         0xEF=>"\xc4\xbc",
    508         0xF0=>"\xc5\xa1",
    509         0xF1=>"\xc5\x84",
    510         0xF2=>"\xc5\x86",
    511         0xF3=>"\xc3\xb3",
    512         0xF4=>"\xc5\x8d",
    513         0xF5=>"\xc3\xb5",
    514         0xF6=>"\xc3\xb6",
    515         0xF7=>"\xc3\xb7",
    516         0xF8=>"\xc5\xb3",
    517         0xF9=>"\xc5\x82",
    518         0xFA=>"\xc5\x9b",
    519         0xFB=>"\xc5\xab",
    520         0xFC=>"\xc3\xbc",
    521         0xFD=>"\xc5\xbc",
    522         0xFE=>"\xc5\xbe",
    523         0xFF=>"\xcb\x99"
     396  0x80=>"\xe2\x82\xac",
     397  0x81=>"\xc0\x4",
     398  0x82=>"\xe2\x80\x9a",
     399  0x83=>"\xc0\x4",
     400  0x84=>"\xe2\x80\x9e",
     401  0x85=>"\xe2\x80\xa6",
     402  0x86=>"\xe2\x80\xa0",
     403  0x87=>"\xe2\x80\xa1",
     404  0x88=>"\xc0\x4",
     405  0x89=>"\xe2\x80\xb0",
     406  0x8A=>"\xc0\x4",
     407  0x8B=>"\xe2\x80\xb9",
     408  0x8C=>"\xc0\x4",
     409  0x8D=>"\xc2\xa8",
     410  0x8E=>"\xcb\x87",
     411  0x8F=>"\xc2\xb8",
     412  0x90=>"\xc0\x4",
     413  0x91=>"\xe2\x80\x98",
     414  0x92=>"\xe2\x80\x99",
     415  0x93=>"\xe2\x80\x9c",
     416  0x94=>"\xe2\x80\x9d",
     417  0x95=>"\xe2\x80\xa2",
     418  0x96=>"\xe2\x80\x93",
     419  0x97=>"\xe2\x80\x94",
     420  0x98=>"\xc0\x4",
     421  0x99=>"\xe2\x84\xa2",
     422  0x9A=>"\xc0\x4",
     423  0x9B=>"\xe2\x80\xba",
     424  0x9C=>"\xc0\x4",
     425  0x9D=>"\xc2\xaf",
     426  0x9E=>"\xcb\x9b",
     427  0x9F=>"\xc0\x4",
     428  0xA0=>"\xc2\xa0",
     429  0xA1=>"\xc0\x4",
     430  0xA2=>"\xc2\xa2",
     431  0xA3=>"\xc2\xa3",
     432  0xA4=>"\xc2\xa4",
     433  0xA5=>"\xc0\x4",
     434  0xA6=>"\xc2\xa6",
     435  0xA7=>"\xc2\xa7",
     436  0xA8=>"\xc3\x98",
     437  0xA9=>"\xc2\xa9",
     438  0xAA=>"\xc5\x96",
     439  0xAB=>"\xc2\xab",
     440  0xAC=>"\xc2\xac",
     441  0xAD=>"\xc2\xad",
     442  0xAE=>"\xc2\xae",
     443  0xAF=>"\xc3\x86",
     444  0xB0=>"\xc2\xb0",
     445  0xB1=>"\xc2\xb1",
     446  0xB2=>"\xc2\xb2",
     447  0xB3=>"\xc2\xb3",
     448  0xB4=>"\xc2\xb4",
     449  0xB5=>"\xc2\xb5",
     450  0xB6=>"\xc2\xb6",
     451  0xB7=>"\xc2\xb7",
     452  0xB8=>"\xc3\xb8",
     453  0xB9=>"\xc2\xb9",
     454  0xBA=>"\xc5\x97",
     455  0xBB=>"\xc2\xbb",
     456  0xBC=>"\xc2\xbc",
     457  0xBD=>"\xc2\xbd",
     458  0xBE=>"\xc2\xbe",
     459  0xBF=>"\xc3\xa6",
     460  0xC0=>"\xc4\x84",
     461  0xC1=>"\xc4\xae",
     462  0xC2=>"\xc4\x80",
     463  0xC3=>"\xc4\x86",
     464  0xC4=>"\xc3\x84",
     465  0xC5=>"\xc3\x85",
     466  0xC6=>"\xc4\x98",
     467  0xC7=>"\xc4\x92",
     468  0xC8=>"\xc4\x8c",
     469  0xC9=>"\xc3\x89",
     470  0xCA=>"\xc5\xb9",
     471  0xCB=>"\xc4\x96",
     472  0xCC=>"\xc4\xa2",
     473  0xCD=>"\xc4\xb6",
     474  0xCE=>"\xc4\xaa",
     475  0xCF=>"\xc4\xbb",
     476  0xD0=>"\xc5\xa0",
     477  0xD1=>"\xc5\x83",
     478  0xD2=>"\xc5\x85",
     479  0xD3=>"\xc3\x93",
     480  0xD4=>"\xc5\x8c",
     481  0xD5=>"\xc3\x95",
     482  0xD6=>"\xc3\x96",
     483  0xD7=>"\xc3\x97",
     484  0xD8=>"\xc5\xb2",
     485  0xD9=>"\xc5\x81",
     486  0xDA=>"\xc5\x9a",
     487  0xDB=>"\xc5\xaa",
     488  0xDC=>"\xc3\x9c",
     489  0xDD=>"\xc5\xbb",
     490  0xDE=>"\xc5\xbd",
     491  0xDF=>"\xc3\x9f",
     492  0xE0=>"\xc4\x85",
     493  0xE1=>"\xc4\xaf",
     494  0xE2=>"\xc4\x81",
     495  0xE3=>"\xc4\x87",
     496  0xE4=>"\xc3\xa4",
     497  0xE5=>"\xc3\xa5",
     498  0xE6=>"\xc4\x99",
     499  0xE7=>"\xc4\x93",
     500  0xE8=>"\xc4\x8d",
     501  0xE9=>"\xc3\xa9",
     502  0xEA=>"\xc5\xba",
     503  0xEB=>"\xc4\x97",
     504  0xEC=>"\xc4\xa3",
     505  0xED=>"\xc4\xb7",
     506  0xEE=>"\xc4\xab",
     507  0xEF=>"\xc4\xbc",
     508  0xF0=>"\xc5\xa1",
     509  0xF1=>"\xc5\x84",
     510  0xF2=>"\xc5\x86",
     511  0xF3=>"\xc3\xb3",
     512  0xF4=>"\xc5\x8d",
     513  0xF5=>"\xc3\xb5",
     514  0xF6=>"\xc3\xb6",
     515  0xF7=>"\xc3\xb7",
     516  0xF8=>"\xc5\xb3",
     517  0xF9=>"\xc5\x82",
     518  0xFA=>"\xc5\x9b",
     519  0xFB=>"\xc5\xab",
     520  0xFC=>"\xc3\xbc",
     521  0xFD=>"\xc5\xbc",
     522  0xFE=>"\xc5\xbe",
     523  0xFF=>"\xcb\x99"
    524524  ),
    525525);
     
    529529  {
    530530    $Result = '';
    531     for($I = 0; $I < strlen($String); $I++) 
     531    for($I = 0; $I < strlen($String); $I++)
    532532    {
    533533       if(ord($String[$I]) < 128) $Result .= $String[$I];
  • trunk/Common/VCL/Database.php

    r666 r738  
    5858      if(method_exists($this->OnRowDraw[0], $this->OnRowDraw[1]))
    5959        $DbRow = call_user_func($this->OnRowDraw, $DbRow);
    60         $this->Rows[] = $DbRow;
     60      $this->Rows[] = $DbRow;
    6161      $VisibleItemCount = $VisibleItemCount + 1;
    6262    }
  • trunk/Modules/Chat/Chat.php

    r586 r738  
    1010    $this->ParentClass = 'PagePortal';
    1111  }
    12  
     12
    1313  function dechexr($Num)
    1414  {
     
    2020  {
    2121    global $MonthNames;
    22    
     22
    2323    if(!$this->System->User->CheckPermission('Chat', 'Display')) return('Nemáte oprávnění');
    2424
    25     if(array_key_exists('date', $_GET)) $Date = $_GET['date']; 
     25    if(array_key_exists('date', $_GET)) $Date = $_GET['date'];
    2626      else $Date = date('Y-m-d');
    2727    $DateParts = explode('-', $Date);
     
    5656            if(($Year == $StartDateParts[0]) and ($Month == $StartDateParts[1])) $StartDay = ($StartDateParts[2]+0); else $StartDay = 1;
    5757            if(($Year == $EndDateParts[0]) and ($Month == $EndDateParts[1])) $EndDay = ($EndDateParts[2]+0); else $EndDay = date('t',mktime(0,0,0,$Month,0,$Year));
    58             for($Day = $StartDay; $Day <= $EndDay; $Day++) 
    59             { 
     58            for($Day = $StartDay; $Day <= $EndDay; $Day++)
     59            {
    6060              $Text = '<a href="?date='.$Year.'-'.$Month.'-'.$Day.'">'.$Day.'</a> ';
    6161              if(($DateParts[0] == $Year) and ($DateParts[1] == $Month) and ($DateParts[2] == $Day)) $Text = '<strong>'.$Text.'</strong>';
     
    7676    {
    7777      $Text = $Row['Text'];;
    78       // StrTr($Row['text'], "\x8A\x8D\x8E\x9A\x9D\x9E", "\xA9\xAB\xAE\xB9\xBB\xBE"); 
     78      // StrTr($Row['text'], "\x8A\x8D\x8E\x9A\x9D\x9E", "\xA9\xAB\xAE\xB9\xBB\xBE");
    7979      $Output .= '['.date('d.m.Y H:i:s',$Row['UNIX_TIMESTAMP(Time)']).'] <span style="color: #'.$this->dechexr($Row['Color']).'"><strong>&lt;'.$Row['Nick'].'&gt;</strong> '.(htmlspecialchars($Text)).'</span><br>';
    8080    }
     
    9797    $this->Dependencies = array();
    9898  }
    99  
     99
    100100  function DoStart()
    101101  {
    102102    $this->System->Pages['chat'] = 'PageChatHistory';
    103   } 
     103  }
    104104}
  • trunk/Modules/Chat/irc_bot.php

    r577 r738  
    1313  var $File;
    1414
    15   function __construct() 
     15  function __construct()
    1616  {
    1717    $this->Jokes = file($this->JokeFileName);
     
    7474      $Line = substr($Line, strlen($Commands[0]));
    7575      $Commands[1] = substr($Line, 0, strpos($Line, ':') + 1);
    76       $Commands[2] = substr($Line, strlen($Commands[1]));     
     76      $Commands[2] = substr($Line, strlen($Commands[1]));
    7777      //print_r($Commands);
    7878
     
    8989      }
    9090
    91      
     91
    9292      explode(':', $Line);
    9393      foreach($Commands as $Index => $Item)
     
    185185
    186186        // hjoke - Posle nahodny vtip
    187         if($Command == 'hjoke') 
     187        if($Command == 'hjoke')
    188188        {
    189189          $Joke = ($this->Jokes[rand(0, (sizeof($this->Jokes) - 1))]);
  • trunk/Modules/Customer/Customer.php

    r727 r738  
    1313    $this->Dependencies = array('User');
    1414  }
    15  
     15
    1616  function DoStart()
    1717  {
     
    3636        'Consumption' => array('Type' => 'TCustomerStockSerialNumber', 'Caption' => 'Spotřeba zařízení', 'Default' => ''),
    3737      ),
    38         'ItemActions' => array(
    39         array('Caption' => 'Klientská sekce', 'URL' => '/finance/platby/?i=#RowId'),
     38      'ItemActions' => array(
     39        array('Caption' => 'Klientská sekce', 'URL' => '/finance/platby/?i=#RowId'),
    4040      ),
    41     ));   
     41    ));
    4242    $this->System->FormManager->RegisterClass('MemberPayment', array(
    4343      'Title' => 'Placení zákazníků',
     
    5656    ));
    5757    $this->System->FormManager->RegisterFormType('TMember', array(
    58         'Type' => 'Reference',
    59         'Table' => 'Member',
    60         'Id' => 'Id',
    61         'Name' => 'Name',
    62         'Filter' => '1',
     58      'Type' => 'Reference',
     59      'Table' => 'Member',
     60      'Id' => 'Id',
     61      'Name' => 'Name',
     62      'Filter' => '1',
    6363    ));
    6464    $this->System->FormManager->RegisterClass('Service', array(
    65         'Title' => 'Služby',
    66         'Table' => 'Service',
    67         'DefaultSortColumn' => 'Name',
    68         'Items' => array(
    69                 'Name' => array('Type' => 'String', 'Caption' => 'Jméno', 'Default' => ''),
    70                 'Category' => array('Type' => 'TServiceCategory', 'Caption' => 'Skupina', 'Default' => '', 'Null' => true),
    71                 'Price' => array('Type' => 'Integer', 'Caption' => 'Cena', 'Default' => '0', 'Suffix' => 'Kč'),
    72                 'VAT' => array('Type' => 'TFinanceVATType', 'Caption' => 'Sazba DPH', 'Default' => '0', 'Suffix' => ''),
    73                 'CustomerCount' => array('Type' => 'Integer', 'Caption' => 'Počet zákazníků', 'Default' => '', 'ReadOnly' => true,
    74                         'SQL' => '(SELECT COUNT(*) FROM `ServiceCustomerRel` LEFT JOIN `Member` ON `Member`.`Id`=`ServiceCustomerRel`.`Customer` WHERE (`ServiceCustomerRel`.`Service`=#Id) AND (`Member`.`Blocked`=0))'),
    75                 'Public' => array('Type' => 'Boolean', 'Caption' => 'Veřejné', 'Default' => ''),
    76                 'InternetSpeedMin' => array('Type' => 'Integer', 'Caption' => 'Min. rychlost internetu', 'Default' => '0', 'Suffix' => 'kbit/s'),
    77                 'InternetSpeedMax' => array('Type' => 'Integer', 'Caption' => 'Max. rychlost internetu', 'Default' => '0', 'Suffix' => 'kbit/s'),
    78                 'UploadAsymmetry' => array('Type' => 'Integer', 'Caption' => 'Asymetrie odesílání', 'Default' => '1'),
    79                 'Memory' => array('Type' => 'Integer', 'Caption' => 'Paměť', 'Default' => '0', 'Suffix' => 'GB'),
    80                 'MemorySwap' => array('Type' => 'Integer', 'Caption' => 'Odkládací oddíl', 'Default' => '0', 'Suffix' => 'GB'),
    81                 'Storage' => array('Type' => 'Integer', 'Caption' => 'Úložiště', 'Default' => '0', 'Suffix' => 'GB'),
    82                 'CPUCount' => array('Type' => 'Integer', 'Caption' => 'Počet jader', 'Default' => '0', 'Suffix' => ''),
    83                 'ChangeAction' => array('Type' => 'TActionEnum', 'Caption' => 'Změna - akce', 'Default' => '', 'Null' => true),
    84                 'ChangeTime' => array('Type' => 'DateTime', 'Caption' => 'Změna - čas', 'Default' => '', 'Null' => true),
    85                 'ChangeReplaceId' => array('Type' => 'TService', 'Caption' => 'Změna - položka', 'Default' => '', 'Null' => true),
    86                 'CustomerRel' => array('Type' => 'TServiceCustomerRelListService', 'Caption' => 'Placení zákazníky', 'Default' => ''),
    87         ),
     65      'Title' => 'Služby',
     66      'Table' => 'Service',
     67      'DefaultSortColumn' => 'Name',
     68      'Items' => array(
     69        'Name' => array('Type' => 'String', 'Caption' => 'Jméno', 'Default' => ''),
     70        'Category' => array('Type' => 'TServiceCategory', 'Caption' => 'Skupina', 'Default' => '', 'Null' => true),
     71        'Price' => array('Type' => 'Integer', 'Caption' => 'Cena', 'Default' => '0', 'Suffix' => 'Kč'),
     72        'VAT' => array('Type' => 'TFinanceVATType', 'Caption' => 'Sazba DPH', 'Default' => '0', 'Suffix' => ''),
     73        'CustomerCount' => array('Type' => 'Integer', 'Caption' => 'Počet zákazníků', 'Default' => '', 'ReadOnly' => true,
     74          'SQL' => '(SELECT COUNT(*) FROM `ServiceCustomerRel` LEFT JOIN `Member` ON `Member`.`Id`=`ServiceCustomerRel`.`Customer` WHERE (`ServiceCustomerRel`.`Service`=#Id) AND (`Member`.`Blocked`=0))'),
     75        'Public' => array('Type' => 'Boolean', 'Caption' => 'Veřejné', 'Default' => ''),
     76        'InternetSpeedMin' => array('Type' => 'Integer', 'Caption' => 'Min. rychlost internetu', 'Default' => '0', 'Suffix' => 'kbit/s'),
     77        'InternetSpeedMax' => array('Type' => 'Integer', 'Caption' => 'Max. rychlost internetu', 'Default' => '0', 'Suffix' => 'kbit/s'),
     78        'UploadAsymmetry' => array('Type' => 'Integer', 'Caption' => 'Asymetrie odesílání', 'Default' => '1'),
     79        'Memory' => array('Type' => 'Integer', 'Caption' => 'Paměť', 'Default' => '0', 'Suffix' => 'GB'),
     80        'MemorySwap' => array('Type' => 'Integer', 'Caption' => 'Odkládací oddíl', 'Default' => '0', 'Suffix' => 'GB'),
     81        'Storage' => array('Type' => 'Integer', 'Caption' => 'Úložiště', 'Default' => '0', 'Suffix' => 'GB'),
     82        'CPUCount' => array('Type' => 'Integer', 'Caption' => 'Počet jader', 'Default' => '0', 'Suffix' => ''),
     83        'ChangeAction' => array('Type' => 'TActionEnum', 'Caption' => 'Změna - akce', 'Default' => '', 'Null' => true),
     84        'ChangeTime' => array('Type' => 'DateTime', 'Caption' => 'Změna - čas', 'Default' => '', 'Null' => true),
     85        'ChangeReplaceId' => array('Type' => 'TService', 'Caption' => 'Změna - položka', 'Default' => '', 'Null' => true),
     86        'CustomerRel' => array('Type' => 'TServiceCustomerRelListService', 'Caption' => 'Placení zákazníky', 'Default' => ''),
     87      ),
    8888    ));
    8989    $this->System->FormManager->RegisterClass('ServiceCategory', array(
    90         'Title' => 'Kategorie služeb',
    91         'Table' => 'ServiceCategory',
    92         'Items' => array(
    93                 'Name' => array('Type' => 'String', 'Caption' => 'Jméno', 'Default' => ''),
    94                 'Items' => array('Type' => 'TServiceListServiceCategory', 'Caption' => 'Služby', 'Default' => ''),
    95         ),
     90      'Title' => 'Kategorie služeb',
     91      'Table' => 'ServiceCategory',
     92      'Items' => array(
     93        'Name' => array('Type' => 'String', 'Caption' => 'Jméno', 'Default' => ''),
     94        'Items' => array('Type' => 'TServiceListServiceCategory', 'Caption' => 'Služby', 'Default' => ''),
     95      ),
    9696    ));
    9797    $this->System->FormManager->RegisterClass('ServiceCustomerRel', array(
     
    102102        'Customer' => array('Type' => 'TMember', 'Caption' => 'Zákazník', 'Default' => ''),
    103103        'ChangeAction' => array('Type' => 'TActionEnum', 'Caption' => 'Změna - akce', 'Default' => '', 'Null' => true),
    104                 'ChangeTime' => array('Type' => 'DateTime', 'Caption' => 'Změna - čas', 'Default' => '', 'Null' => true),
    105         'ChangeReplaceId' => array('Type' => 'TServiceCustomerRel', 'Caption' => 'Změna - položka', 'Default' => '', 'Null' => true),
     104        'ChangeTime' => array('Type' => 'DateTime', 'Caption' => 'Změna - čas', 'Default' => '', 'Null' => true),
     105        'ChangeReplaceId' => array('Type' => 'TServiceCustomerRel', 'Caption' => 'Změna - položka', 'Default' => '', 'Null' => true),
    106106      ),
    107107    ));
    108108    $this->System->FormManager->RegisterFormType('TServiceCategory', array(
    109         'Type' => 'Reference',
    110         'Table' => 'ServiceCategory',
    111         'Id' => 'Id',
    112         'Name' => 'Name',
    113         'Filter' => '1',
     109      'Type' => 'Reference',
     110      'Table' => 'ServiceCategory',
     111      'Id' => 'Id',
     112      'Name' => 'Name',
     113      'Filter' => '1',
    114114    ));
    115115    $this->System->FormManager->RegisterFormType('TService', array(
    116         'Type' => 'Reference',
    117         'Table' => 'Service',
    118         'Id' => 'Id',
    119         'Name' => 'Name',
    120         'Filter' => '1',
     116      'Type' => 'Reference',
     117      'Table' => 'Service',
     118      'Id' => 'Id',
     119      'Name' => 'Name',
     120      'Filter' => '1',
    121121    ));
    122122    $this->System->FormManager->RegisterFormType('TServiceCustomerRel', array(
    123         'Type' => 'Reference',
    124         'Table' => 'ServiceCustomerRel',
    125         'Id' => 'Id',
    126         'Name' => 'Id',
    127         'Filter' => '1',
    128     ));   
     123      'Type' => 'Reference',
     124      'Table' => 'ServiceCustomerRel',
     125      'Id' => 'Id',
     126      'Name' => 'Id',
     127      'Filter' => '1',
     128    ));
    129129    $this->System->FormManager->RegisterFormType('TServiceCustomerRelListCustomer', array(
    130130      'Type' => 'ManyToOne',
     
    148148      'Filter' => '1',
    149149    ));
    150   } 
     150  }
    151151}
  • trunk/Modules/EmailQueue/EmailQueue.php

    r689 r738  
    5252        'Title' => 'Fronta e-mailů',
    5353        'Table' => 'EmailQueue',
    54                 'DefaultSortColumn' => 'Time',
    55                 'DefaultSortOrder' => 1,
     54        'DefaultSortColumn' => 'Time',
     55        'DefaultSortOrder' => 1,
    5656        'Items' => array(
    5757            'Time' => array('Type' => 'DateTime', 'Caption' => 'Vytvořeno'),
  • trunk/Modules/Employee/Employee.php

    r736 r738  
    3737        'Contract' => array('Type' => 'TContract', 'Caption' => 'Smlouva', 'Default' => ''),
    3838      ),
    39     ));         
    40         $this->System->FormManager->RegisterFormType('TEmployee', array(
     39    ));
     40    $this->System->FormManager->RegisterFormType('TEmployee', array(
    4141      'Type' => 'Reference',
    42         'Table' => 'Employee',
    43         'Id' => 'Id',
    44         'Name' => 'CONCAT_WS(" ", NULLIF(`FirstName`, ""), NULLIF(`SecondName`, ""))',
    45         'Filter' => '1',
    46     ));   
     42      'Table' => 'Employee',
     43      'Id' => 'Id',
     44      'Name' => 'CONCAT_WS(" ", NULLIF(`FirstName`, ""), NULLIF(`SecondName`, ""))',
     45      'Filter' => '1',
     46    ));
    4747    $this->System->FormManager->RegisterFormType('TEmployeeSalaryList', array(
    48         'Type' => 'ManyToOne',
    49         'Table' => 'EmployeeSalary',
    50         'Id' => 'Id',
    51         'Ref' => 'Employee',
    52         'Filter' => '1',
     48      'Type' => 'ManyToOne',
     49      'Table' => 'EmployeeSalary',
     50      'Id' => 'Id',
     51      'Ref' => 'Employee',
     52      'Filter' => '1',
    5353    ));
    5454  }
  • trunk/Modules/Error/Error.php

    r682 r738  
    3232  function DoStart()
    3333  {
    34         $this->ShowError = $this->System->Config['Web']['ShowPHPError'];
     34    $this->ShowError = $this->System->Config['Web']['ShowPHPError'];
    3535    set_error_handler(array($this, 'ErrorHandler'));
    3636    set_exception_handler(array($this, 'ExceptionHandler'));
     
    3939  function Stop()
    4040  {
    41         restore_error_handler();
    42         restore_exception_handler();
    43         parent::Stop();
     41    restore_error_handler();
     42    restore_exception_handler();
     43    parent::Stop();
    4444  }
    4545
     
    128128          '<meta http-equiv="Content-Type" content="text/html; charset='.$this->Encoding.'"></head><body>'."\n".
    129129          'Došlo k vnitřní chybě!<br/> O chybě byl uvědoměn správce webu a chybu brzy odstraní.<br/><br/>');
    130         echo('<pre>'.$Error.'</pre><br/>');                     // V případě ladění chybu i zobraz
     130        echo('<pre>'.$Error.'</pre><br/>');     // V případě ladění chybu i zobraz
    131131        echo('</body></html>');
    132132      } else
    133133      {
    134         echo($Error);
     134        echo($Error);
    135135      }
    136136    }
  • trunk/Modules/File/File.php

    r737 r738  
    4343  function DetectMimeType($FileName)
    4444  {
    45         global $MimeTypes;
     45    global $MimeTypes;
    4646
    4747    $Result = $MimeTypes[pathinfo($FileName, PATHINFO_EXTENSION)][0];
     
    140140       'Parent' => array('Type' => 'TDirectory', 'Caption' => 'Nadřazený adresář', 'Default' => '', 'Null' => true),
    141141        'Subdirectories' => array('Type' => 'TDirectoryList', 'Caption' => 'Podadresáře', 'Default' => ''),
    142         'Files' => array('Type' => 'TFileList', 'Caption' => 'Soubory', 'Default' => ''),
     142        'Files' => array('Type' => 'TFileList', 'Caption' => 'Soubory', 'Default' => ''),
    143143      ),
    144144    ));
     
    151151    ));
    152152    $this->System->FormManager->RegisterFormType('TFile', array(
    153                 'Type' => 'Reference',
    154                 'Table' => 'File',
    155                 'Id' => 'Id',
    156                 'Name' => 'Name',
    157                 'Filter' => '1',
     153      'Type' => 'Reference',
     154      'Table' => 'File',
     155      'Id' => 'Id',
     156      'Name' => 'Name',
     157      'Filter' => '1',
    158158    ));
    159159    $this->System->FormManager->RegisterFormType('TFileList', array(
    160         'Type' => 'ManyToOne',
    161         'Table' => 'File',
    162         'Id' => 'Id',
    163         'Ref' => 'Directory',
    164         'Filter' => '1',
     160      'Type' => 'ManyToOne',
     161      'Table' => 'File',
     162      'Id' => 'Id',
     163      'Ref' => 'Directory',
     164      'Filter' => '1',
    165165    ));
    166166    $this->System->FormManager->RegisterFormType('TDirectoryList', array(
    167                 'Type' => 'ManyToOne',
    168                 'Table' => 'FileDirectory',
    169                 'Id' => 'Id',
    170                 'Ref' => 'Parent',
    171                 'Filter' => '1',
     167      'Type' => 'ManyToOne',
     168      'Table' => 'FileDirectory',
     169      'Id' => 'Id',
     170      'Ref' => 'Parent',
     171      'Filter' => '1',
    172172    ));
    173173  }
  • trunk/Modules/File/MimeTypes.php

    r548 r738  
    4343  'jpe'   => array('image/jpeg', 'image/pjpeg'),
    4444  'js'    => array('application/x-javascript'),
    45   'json'  => array('application/json'), 
     45  'json'  => array('application/json'),
    4646  'lha'   => array('application/octet-stream'),
    4747  'log'   => array('text/plain', 'text/x-log'),
  • trunk/Modules/Finance/Bill.php

    r727 r738  
    44{
    55  var $SpecificSymbol = 1; // počítačová sít
    6   var $Checked; 
    7  
     6  var $Checked;
     7
    88  function GenerateHTML()
    99  {
     
    2121  function HtmlToPdf($HtmlCode)
    2222  {
    23         $Encoding = new Encoding();
    24         if($this->Checked == false) {
    25                 if(CommandExist('htmldoc')) {
    26                         $this->Checked = true;
    27                 } else throw new Exception('htmldoc is not installed.');
    28         }
     23    $Encoding = new Encoding();
     24    if($this->Checked == false) {
     25      if(CommandExist('htmldoc')) {
     26        $this->Checked = true;
     27      } else throw new Exception('htmldoc is not installed.');
     28    }
    2929    $Output = shell_exec('echo "'.addslashes($Encoding->FromUTF8($HtmlCode)).
    3030      '"|htmldoc --no-numbered --webpage --no-embedfonts --charset 8859-2 -t pdf -');
     
    3939  function ShowSubjectInfo($Subject)
    4040  {
    41         $BooleanText = array('Ne', 'Ano');
    42         $Output = $Subject['Name'].'<br>'.
     41    $BooleanText = array('Ne', 'Ano');
     42    $Output = $Subject['Name'].'<br>'.
    4343      $Subject['AddressStreet'].'<br>'.
    4444      $Subject['AddressPSC'].' '.$Subject['AddressTown'].'<br>';
     
    4747    if($Subject['Account'] != '') $Output .= 'Účet: '.$Subject['Account'].'<br>';
    4848    if($Subject['PayVAT'] != '') $Output .= 'Plátce DPH: '.$BooleanText[$Subject['PayVAT']].'<br>';
    49         return($Output);
     49    return($Output);
    5050  }
    5151
     
    8181    if($Invoice['Direction'] == -1)
    8282    {
    83         $Subject = $SubjectTo;
    84         $SubjectTo = $SubjectFrom;
    85         $SubjectFrom = $Subject;
     83      $Subject = $SubjectTo;
     84      $SubjectTo = $SubjectFrom;
     85      $SubjectFrom = $Subject;
    8686    }
    8787
  • trunk/Modules/Finance/Finance.php

    r737 r738  
    159159  function GetVATByType($TypeId)
    160160  {
    161         $Time = time();
    162         $DbResult = $this->Database->select('FinanceVAT', 'Value', '(Type='.$TypeId.
     161    $Time = time();
     162    $DbResult = $this->Database->select('FinanceVAT', 'Value', '(Type='.$TypeId.
    163163      ') AND (ValidFrom <= "'.TimeToMysqlDate($Time).'") AND ((ValidTo >= "'.
    164164      TimeToMysqlDate($Time).'") OR (ValidTo IS NULL)) LIMIT 1');
     
    204204      'DefaultSortOrder' => 1,
    205205      'Items' => array(
    206         'Direction' => array('Type' => 'TFinanceOperationDirection', 'Caption' => 'Směr', 'Default' => '1'),
    207         'DocumentLine' => array('Type' => 'TDocumentLine', 'Caption' => 'Dokladová řada', 'Default' => ''),
     206        'Direction' => array('Type' => 'TFinanceOperationDirection', 'Caption' => 'Směr', 'Default' => '1'),
     207        'DocumentLine' => array('Type' => 'TDocumentLine', 'Caption' => 'Dokladová řada', 'Default' => ''),
    208208        'BillCode' => array('Type' => 'String', 'Caption' => 'Označení', 'Default' => ''),
    209209        'Subject' => array('Type' => 'TSubject', 'Caption' => 'Subjekt', 'Default' => ''),
     
    274274      'DefaultSortOrder' => 1,
    275275      'Items' => array(
    276         'Direction' => array('Type' => 'TFinanceInvoiceDirection', 'Caption' => 'Směr', 'Default' => '1'),
    277         'DocumentLine' => array('Type' => 'TDocumentLine', 'Caption' => 'Dokladová řada', 'Default' => ''),
     276        'Direction' => array('Type' => 'TFinanceInvoiceDirection', 'Caption' => 'Směr', 'Default' => '1'),
     277        'DocumentLine' => array('Type' => 'TDocumentLine', 'Caption' => 'Dokladová řada', 'Default' => ''),
    278278        'BillCode' => array('Type' => 'String', 'Caption' => 'Označení', 'Default' => ''),
    279279        'Subject' => array('Type' => 'TSubject', 'Caption' => 'Subjekt', 'Default' => ''),
     
    286286        'PeriodFrom' => array('Type' => 'Date', 'Caption' => 'Období od', 'Default' => '', 'Null' => true),
    287287        'PeriodTo' => array('Type' => 'Date', 'Caption' => 'Období do', 'Default' => '', 'Null' => true),
    288         'Cash' => array('Type' => 'Boolean', 'Caption' => 'Platit hotově', 'Default' => ''),
     288        'Cash' => array('Type' => 'Boolean', 'Caption' => 'Platit hotově', 'Default' => ''),
    289289        'Items' => array('Type' => 'TFinanceInvoiceItemListInvoice', 'Caption' => 'Položky', 'Default' => ''),
    290290        'OperationRel' => array('Type' => 'TFinanceInvoiceOperationRelListInvoice', 'Caption' => 'Platba', 'Default' => ''),
     
    314314
    315315    $this->System->FormManager->RegisterFormType('TFinanceInvoiceDirection', array(
    316                 'Type' => 'Enumeration',
    317                 'States' => array(-1 => 'Příjem', 1 => 'Výdej'),
     316        'Type' => 'Enumeration',
     317        'States' => array(-1 => 'Příjem', 1 => 'Výdej'),
    318318    ));
    319319
     
    323323      'Items' => array(
    324324        'Name' => array('Type' => 'String', 'Caption' => 'Název', 'Default' => '0'),
    325         'Subject' => array('Type' => 'TSubject', 'Caption' => 'Subjekt', 'Default' => '0'),
     325        'Subject' => array('Type' => 'TSubject', 'Caption' => 'Subjekt', 'Default' => '0'),
    326326      ),
    327327    ));
     
    353353    ));
    354354    $this->System->FormManager->RegisterFormType('TFinanceTreasury', array(
    355         'Type' => 'Reference',
    356         'Table' => 'FinanceTreasury',
    357         'Id' => 'Id',
    358         'Name' => 'Name',
    359         'Filter' => '1',
     355      'Type' => 'Reference',
     356      'Table' => 'FinanceTreasury',
     357      'Id' => 'Id',
     358      'Name' => 'Name',
     359      'Filter' => '1',
    360360    ));
    361361    $this->System->FormManager->RegisterClass('FinanceBankAccount', array(
     
    374374        'LoginPassword' => array('Type' => 'String', 'Caption' => 'Přihlašovací heslo', 'Default' => ''),
    375375        'Operations' => array('Type' => 'TFinanceOperationListAccount', 'Caption' => 'Operace', 'Default' => ''),
    376         'Use' => array('Type' => 'Boolean', 'Caption' => 'Používat', 'Default' => '0'),
     376        'Use' => array('Type' => 'Boolean', 'Caption' => 'Používat', 'Default' => '0'),
    377377        'LastImportDate' => array('Type' => 'Date', 'Caption' => 'Datum posledního importu', 'Default' => ''),
    378378        'LastImportId' => array('Type' => 'String', 'Caption' => 'Id posledního importu', 'Default' => ''),
     
    380380          'ReadOnly' => true, 'Suffix' => 'Kč', 'SQL' => '(SELECT SUM(`FinanceOperation`.`Value` * `FinanceOperation`.`Direction`) FROM `FinanceOperation` '.
    381381          'WHERE `FinanceOperation`.`BankAccount`=#Id)'),
    382         'AutoImport' => array('Type' => 'Boolean', 'Caption' => 'Automaticky stahovat z banky', 'Default' => ''),
     382        'AutoImport' => array('Type' => 'Boolean', 'Caption' => 'Automaticky stahovat z banky', 'Default' => ''),
    383383      ),
    384384      'ItemActions' => array(
     
    388388    ));
    389389    $this->System->FormManager->RegisterFormType('TFinanceBankAccount', array(
    390         'Type' => 'Reference',
    391         'Table' => 'FinanceBankAccount',
    392         'Id' => 'Id',
    393         'Name' => 'Comment',
    394         'Filter' => '1',
     390      'Type' => 'Reference',
     391      'Table' => 'FinanceBankAccount',
     392      'Id' => 'Id',
     393      'Name' => 'Comment',
     394      'Filter' => '1',
    395395    ));
    396396    $this->System->FormManager->RegisterClass('FinanceBank', array(
     
    433433        'TopTariffPrice' => array('Type' => 'Integer', 'Caption' => 'Nejvyšší cena tarifu', 'Default' => '0', 'Suffix' => 'Kč'),
    434434        'ChangeAction' => array('Type' => 'TActionEnum', 'Caption' => 'Změna - akce', 'Default' => '', 'Null' => true),
    435                 'ChangeTime' => array('Type' => 'DateTime', 'Caption' => 'Změna - čas', 'Default' => '', 'Null' => true),
    436         'ChangeReplaceId' => array('Type' => 'TFinanceCharge', 'Caption' => 'Změna - položka', 'Default' => '0', 'Null' => true),
     435        'ChangeTime' => array('Type' => 'DateTime', 'Caption' => 'Změna - čas', 'Default' => '', 'Null' => true),
     436        'ChangeReplaceId' => array('Type' => 'TFinanceCharge', 'Caption' => 'Změna - položka', 'Default' => '0', 'Null' => true),
    437437      ),
    438438    ));
     
    475475    ));
    476476    $this->System->FormManager->RegisterFormType('TFinanceVAT', array(
    477         'Type' => 'Reference',
    478         'Table' => 'FinanceVAT',
    479         'Id' => 'Id',
    480         'Name' => 'Name',
    481         'Filter' => '1',
     477      'Type' => 'Reference',
     478      'Table' => 'FinanceVAT',
     479      'Id' => 'Id',
     480      'Name' => 'Name',
     481      'Filter' => '1',
    482482    ));
    483483    $this->System->FormManager->RegisterFormType('TFinanceVATType', array(
    484                 'Type' => 'Reference',
    485                 'Table' => 'FinanceVATType',
    486                 'Id' => 'Id',
    487                 'Name' => 'Name',
    488                 'Filter' => '1',
     484      'Type' => 'Reference',
     485      'Table' => 'FinanceVATType',
     486      'Id' => 'Id',
     487      'Name' => 'Name',
     488      'Filter' => '1',
    489489    ));
    490490    $this->System->FormManager->RegisterFormType('TBankAccount', array(
    491         'Type' => 'Reference',
    492         'Table' => 'FinanceBankAccount',
    493         'Id' => 'Id',
    494         'Name' => 'CONCAT(`Comment`, " (", `Number`, "/", '.
    495         '(SELECT `FinanceBank`.`Code` FROM `FinanceBank` WHERE `FinanceBank`.`Id`=`FinanceBankAccount`.`Bank`), ")")',
    496         'Filter' => '1',
     491      'Type' => 'Reference',
     492      'Table' => 'FinanceBankAccount',
     493      'Id' => 'Id',
     494      'Name' => 'CONCAT(`Comment`, " (", `Number`, "/", '.
     495      '(SELECT `FinanceBank`.`Code` FROM `FinanceBank` WHERE `FinanceBank`.`Id`=`FinanceBankAccount`.`Bank`), ")")',
     496      'Filter' => '1',
    497497    ));
    498498
     
    509509  function BeforeInsertFinanceOperation($Form)
    510510  {
    511         if(array_key_exists('Time', $Form->Values)) $Year = date("Y", $Form->Values['Time']);
    512           else $Year = date("Y", $Form->Values['ValidFrom']);
     511    if(array_key_exists('Time', $Form->Values)) $Year = date("Y", $Form->Values['Time']);
     512      else $Year = date("Y", $Form->Values['ValidFrom']);
    513513    $DocumentLine = $Form->Values['DocumentLine'];
    514514    $Form->Values['BillCode'] = $this->System->Modules['Finance']->GetNextDocumentLineNumber($DocumentLine, $Year);
  • trunk/Modules/Finance/Import.php

    r719 r738  
    2525    }
    2626  }
    27  
     27
    2828  function Prepare()
    29   {   
     29  {
    3030    $Finance = $this->System->Modules['Finance'];
    3131    $Finance->LoadMonthParameters(0);
     
    3939      {
    4040        if(substr($Data[$Key][$Key2], 0, 2) == '\"')
    41           $Data[$Key][$Key2] = substr($Data[$Key][$Key2], 2, -2); 
     41          $Data[$Key][$Key2] = substr($Data[$Key][$Key2], 2, -2);
    4242      }
    4343    }
    4444    $Header = array(
    45       0 => 'datum zaúčtování',         
     45      0 => 'datum zaúčtování',
    4646      1 => 'částka',
    4747      2 => 'měna',
     
    6060    //print_r($_POST['Source']);
    6161    //print_r($Data);
    62  
     62
    6363    if($Header != $Data[0]) $Output = 'Nekompatibilní struktura CSV';
    64     else 
     64    else
    6565    {
    6666      array_shift($Data);
     
    8585          $Subject = '? ('.$Value[5].')';
    8686        }
    87         if(!is_numeric($Subject)) 
     87        if(!is_numeric($Subject))
    8888        {
    8989          $Mode = 'Ručně';
    9090          $Style = 'style="background-color: LightPink;" ';
    91         } else 
     91        } else
    9292        {
    9393          $Mode = 'Automaticky';
    9494          $Style = '';
    9595        }
    96    
     96
    9797        if($Money < 0) $Text = 'Platba převodem';
    9898          else $Text = 'Přijatá platba';
     
    106106            '<td><input type="text" name="Taxable'.$I.'" value="1"/></td>'.
    107107            '<td><input type="text" name="Network'.$I.'" value="1"/></td>'.
    108             '</tr><tr><td colspan="7">'.implode(', ', $Value).'</td></tr>'; 
     108            '</tr><tr><td colspan="7">'.implode(', ', $Value).'</td></tr>';
    109109        $I++;
    110110      }
     
    114114        '<th>Datum</th><th>Var. symbol</th><th>Protiúčet</th><th>Částka [Kč]</th><th>Text</th><th>Zdanitelné</th><th>Síť</th></tr>';
    115115      $Output .= $Automatic.'</table>';
    116       $Output .= '<input type="hidden" name="ItemCount" value="'.$I.'"/>'; 
    117       $Output .= '<input type="submit" value="Zpracovat"/></form>';     
     116      $Output .= '<input type="hidden" name="ItemCount" value="'.$I.'"/>';
     117      $Output .= '<input type="submit" value="Zpracovat"/></form>';
    118118    }
    119119    return($Output);
    120120  }
    121  
     121
    122122  function InsertMoney($Subject, $Value, $Direction, $Cash, $Taxable, $Time, $Text, $DocumentLine)
    123123  {
     
    125125    $BillCode = $this->System->Modules['Finance']->GetNextDocumentLineNumber($DocumentLine, $Year);
    126126    // TODO: Fixed BankAccount=1, allow to select bank account for import
    127     $this->Database->insert('FinanceOperation', array('Text' => $Text, 
    128       'Subject' => $Subject, 'Cash' => $Cash, 'Value' => $Value, 'Direction' => $Direction, 
     127    $this->Database->insert('FinanceOperation', array('Text' => $Text,
     128      'Subject' => $Subject, 'Cash' => $Cash, 'Value' => $Value, 'Direction' => $Direction,
    129129      'Time' => TimeToMysqlDateTime($Time), 'Taxable' => $Taxable, 'BillCode' => $BillCode,
    130130      'BankAccount' => 1));
     
    136136    $Finance->LoadMonthParameters(0);
    137137    $Output = '';
    138    
     138
    139139    for($I = $_POST['ItemCount'] - 1; $I >= 0 ; $I--)
    140140    {
    141         // TODO: Use links to database records instead of contants
     141      // TODO: Use links to database records instead of contants
    142142      if($_POST['Money'.$I] < 0) {
    143         $DocumentLine = 4;
    144         $Direction = -1;
     143        $DocumentLine = 4;
     144        $Direction = -1;
    145145      } else {
    146         $DocumentLine = 3;
    147         $Direction = 1;
     146        $DocumentLine = 3;
     147        $Direction = 1;
    148148      }
    149149      $Date = explode('-', $_POST['Date'.$I]);
  • trunk/Modules/Finance/Manage.php

    r727 r738  
    109109    $SumValue = 0;
    110110    foreach($Items as $Item)
    111       $SumValue = $SumValue + ceil($Item['Price'] * $Item['Quantity']);   
     111      $SumValue = $SumValue + ceil($Item['Price'] * $Item['Quantity']);
    112112    $this->Database->insert('FinanceInvoice', array(
    113113      'Subject' => $Subject, 'Time' => TimeToMysqlDateTime($TimeCreation),
    114       'TimeDue' => TimeToMysqlDateTime($TimeDue), 'Value' => $SumValue, 
    115         'Direction' => $Direction, 'BillCode' => $BillCode,
     114      'TimeDue' => TimeToMysqlDateTime($TimeDue), 'Value' => $SumValue,
     115      'Direction' => $Direction, 'BillCode' => $BillCode,
    116116      'PeriodFrom' => TimeToMysqlDate($PeriodFrom), 'PeriodTo' => TimeToMysqlDate($PeriodTo),
    117117      'Generate' => 1, 'DocumentLine' => $DocumentLine));
     
    163163          $MonthlyTotal += $Service['Price'];
    164164        }
    165         $PayPerPeriod = $MonthlyTotal * $Period['MonthCount'];               
     165        $PayPerPeriod = $MonthlyTotal * $Period['MonthCount'];
    166166        // We can't produce negative invoice except storno invoice.
    167         // TODO: In case of negative invoice it is not sufficient to reverse invoicing direction 
    168         // Other subject should invoice only possitive items. Negative items should be somehow removed. 
     167        // TODO: In case of negative invoice it is not sufficient to reverse invoicing direction
     168        // Other subject should invoice only possitive items. Negative items should be somehow removed.
    169169        if($MonthlyTotal >= 0) {
    170                 $DocumentLine = DOC_LINE_INVOICE_OUT;       
    171                 $Direction = 1; // Standard out invoice
     170          $DocumentLine = DOC_LINE_INVOICE_OUT;
     171          $Direction = 1; // Standard out invoice
    172172        } else {
    173                 $DocumentLine = DOC_LINE_INVOICE_IN;
     173          $DocumentLine = DOC_LINE_INVOICE_IN;
    174174          $Direction = -1; // In case of negative total value generate reverse invoice for other subject
    175175          foreach($InvoiceItems as $Index => $Item)
    176                 $InvoiceItems[$Index]['Price'] = -$Item['Price'];
    177         }       
    178        
     176          $InvoiceItems[$Index]['Price'] = -$Item['Price'];
     177        }
     178
    179179        if($PayPerPeriod != 0)
    180180        {
     
    195195  function TableUpdateChanges($Table)
    196196  {
    197         $Time = time();
     197    $Time = time();
    198198    $DbResult = $this->Database->select($Table, '*', '(`ChangeAction` IS NOT NULL) AND '.
    199         '(`ChangeTime` <= "'.TimeToMysqlDateTime($Time).'") ORDER BY `ChangeTime` ASC');
     199      '(`ChangeTime` <= "'.TimeToMysqlDateTime($Time).'") ORDER BY `ChangeTime` ASC');
    200200    while($Service = $DbResult->fetch_array())
    201201    {
     
    225225  function ProcessTableUpdates()
    226226  {
    227         // Update finance charge
    228         $Output = 'Měním aktuální parametry sítě...<br>';
    229         $this->TableUpdateChanges('FinanceCharge');
    230        
    231         // Update services
    232         $Output .= 'Aktualizuji služby....<br>';
    233         $this->TableUpdateChanges('Service');
    234        
    235         // Update customer service selections
    236         $Output .= 'Aktualizuji výběr služeb zákazníků....<br>';
    237         $this->TableUpdateChanges('ServiceCustomerRel');
    238 
    239         return($Output);
    240   }
    241  
     227    // Update finance charge
     228    $Output = 'Měním aktuální parametry sítě...<br>';
     229    $this->TableUpdateChanges('FinanceCharge');
     230
     231    // Update services
     232    $Output .= 'Aktualizuji služby....<br>';
     233    $this->TableUpdateChanges('Service');
     234
     235    // Update customer service selections
     236    $Output .= 'Aktualizuji výběr služeb zákazníků....<br>';
     237    $this->TableUpdateChanges('ServiceCustomerRel');
     238
     239    return($Output);
     240  }
     241
    242242  function ProcessMonthlyPayment()
    243243  {
     
    246246
    247247    $Output .= $this->ProcessTableUpdates();
    248    
     248
    249249    $Finance = &$this->System->Modules['Finance'];
    250250    $Finance->LoadMonthParameters(0);
     
    282282      $Output .= 'Odečítám měsíční poplatek...<br />';
    283283      $Output .= $this->ProduceInvoices();
    284      
     284
    285285      $Output .= 'Přidávám měsíční přehled...<br />';
    286286      $DbResult = $this->Database->query('SELECT * FROM `FinanceCharge` WHERE (`ChangeAction` IS NULL) LIMIT 1');
     
    327327
    328328    $DbResult = $this->Database->query('SELECT `FinanceBankAccount`.*, '.
    329                 'CONCAT(`FinanceBankAccount`.`Number`, "/", `FinanceBank`.`Code`) AS `NumberFull` FROM `FinanceBankAccount` '.
     329      'CONCAT(`FinanceBankAccount`.`Number`, "/", `FinanceBank`.`Code`) AS `NumberFull` FROM `FinanceBankAccount` '.
    330330      'JOIN `FinanceBank` ON `FinanceBank`.`Id`=`FinanceBankAccount`.`Bank` '.
    331331      'WHERE (`FinanceBankAccount`.`Subject`='.$Config['Finance']['MainSubjectId'].') '.
    332         'AND (`FinanceBankAccount`.`Use`=1)');
     332      'AND (`FinanceBankAccount`.`Use`=1)');
    333333    $MainSubjectAccount = $DbResult->fetch_assoc();
    334334
     
    356356      $DbResult = $this->Database->query('SELECT T1.* FROM ((SELECT `Text`, `Time`, (`Value`*`Direction`) AS `Value`, `File` FROM `FinanceOperation` WHERE (`Subject`='.$Member['Subject'].')) UNION ALL '.
    357357        '(SELECT (SELECT GROUP_CONCAT(`Description` SEPARATOR ", ") FROM `FinanceInvoiceItem` '.
    358         'WHERE `FinanceInvoiceItem`.`FinanceInvoice` = `FinanceInvoice`.`Id`) AS `Text`, '.
    359         '`Time`, -(`Value`*`Direction`) AS `Value`, `File` FROM `FinanceInvoice` WHERE (`Subject`='.
     358        'WHERE `FinanceInvoiceItem`.`FinanceInvoice` = `FinanceInvoice`.`Id`) AS `Text`, '.
     359        '`Time`, -(`Value`*`Direction`) AS `Value`, `File` FROM `FinanceInvoice` WHERE (`Subject`='.
    360360        $Member['Subject'].')) ORDER BY `Time` DESC) AS `T1` WHERE (`T1`.`Time` > "'.$Member['BillingPeriodLastDate'].'")');
    361361      while($DbRow = $DbResult->fetch_assoc())
  • trunk/Modules/Finance/UserState.php

    r728 r738  
    99  function ShowFinanceOperation($Subject)
    1010  {
    11         $UserOperationTableQuery = '((SELECT `Text`, `Time`, (`Value`*`Direction`) AS `Value`, `File`, `BillCode`, NULL AS `PeriodFrom`, NULL AS `PeriodTo` '.
    12           'FROM `FinanceOperation` WHERE (`Subject`='.$Subject['Id'].')) UNION ALL '.
    13                 '(SELECT (SELECT GROUP_CONCAT(`Description` SEPARATOR ",") FROM `FinanceInvoiceItem` WHERE `FinanceInvoice`=`FinanceInvoice`.`Id`) AS `Text`, '.
    14                 '`Time`, -(`Value`*`Direction`) AS `Value`, `File`, `BillCode`, `PeriodFrom`, `PeriodTo` FROM `FinanceInvoice` WHERE (`Subject`='.$Subject['Id'].')))';
     11    $UserOperationTableQuery = '((SELECT `Text`, `Time`, (`Value`*`Direction`) AS `Value`, `File`, `BillCode`, NULL AS `PeriodFrom`, NULL AS `PeriodTo` '.
     12      'FROM `FinanceOperation` WHERE (`Subject`='.$Subject['Id'].')) UNION ALL '.
     13      '(SELECT (SELECT GROUP_CONCAT(`Description` SEPARATOR ",") FROM `FinanceInvoiceItem` WHERE `FinanceInvoice`=`FinanceInvoice`.`Id`) AS `Text`, '.
     14      '`Time`, -(`Value`*`Direction`) AS `Value`, `File`, `BillCode`, `PeriodFrom`, `PeriodTo` FROM `FinanceInvoice` WHERE (`Subject`='.$Subject['Id'].')))';
    1515
    1616    $Output = '<div style="text-align:center">Výpis finančních operací</div>';
    17         $DbResult = $this->Database->query('SELECT COUNT(*) FROM '.$UserOperationTableQuery.' AS `T1`');
    18         $DbRow = $DbResult->fetch_row();
    19         $PageList = GetPageList($DbRow[0]);
     17    $DbResult = $this->Database->query('SELECT COUNT(*) FROM '.$UserOperationTableQuery.' AS `T1`');
     18    $DbRow = $DbResult->fetch_row();
     19    $PageList = GetPageList($DbRow[0]);
    2020
    21         $Output .= $PageList['Output'];
    22         $Output .= '<table class="WideTable" style="font-size: small;">';
     21    $Output .= $PageList['Output'];
     22    $Output .= '<table class="WideTable" style="font-size: small;">';
    2323
    24         $TableColumns = array(
    25                         array('Name' => 'Time', 'Title' => 'Datum'),
    26                         array('Name' => 'Text', 'Title' => 'Popis'),
    27                         array('Name' => 'Value', 'Title' => 'Změna [Kč]'),
    28                         array('Name' => 'State', 'Title' => 'Zůstatek [Kč]'),
    29                         array('Name' => 'PeriodFrom', 'Title' => 'Období'),
    30                         array('Name' => 'BillCode', 'Title' => 'Doklad'),
    31         );
    32         $Order = GetOrderTableHeader($TableColumns, 'Time', 1);
    33         $Output .= $Order['Output'];
     24    $TableColumns = array(
     25        array('Name' => 'Time', 'Title' => 'Datum'),
     26        array('Name' => 'Text', 'Title' => 'Popis'),
     27        array('Name' => 'Value', 'Title' => 'Změna [Kč]'),
     28        array('Name' => 'State', 'Title' => 'Zůstatek [Kč]'),
     29        array('Name' => 'PeriodFrom', 'Title' => 'Období'),
     30        array('Name' => 'BillCode', 'Title' => 'Doklad'),
     31    );
     32    $Order = GetOrderTableHeader($TableColumns, 'Time', 1);
     33    $Output .= $Order['Output'];
    3434
    35         $StateQuery = 'SELECT SUM(`T2`.`Value`) FROM '.$UserOperationTableQuery.
    36           ' AS `T2` WHERE `T2`.`Time` <= `T1`.`Time` ';
    37         $Query = 'SELECT *, ('.$StateQuery.') AS `State` FROM '.$UserOperationTableQuery.' AS `T1` '.$Order['SQL'].$PageList['SQLLimit'];
     35    $StateQuery = 'SELECT SUM(`T2`.`Value`) FROM '.$UserOperationTableQuery.
     36      ' AS `T2` WHERE `T2`.`Time` <= `T1`.`Time` ';
     37    $Query = 'SELECT *, ('.$StateQuery.') AS `State` FROM '.$UserOperationTableQuery.' AS `T1` '.$Order['SQL'].$PageList['SQLLimit'];
    3838
    39         $DbResult = $this->Database->query($Query);
     39    $DbResult = $this->Database->query($Query);
    4040    $SumValue = 0;
    41         while($Row = $DbResult->fetch_assoc())
    42         {
    43                 $Row['State'] = round($Row['State'], 2);
    44                 if($Row['State'] > 0) $Row['State'] = '<span style="color:green;">'.$Row['State'].'</span>';
    45                 if($Row['State'] < 0) $Row['State'] = '<span style="color:red;">'.$Row['State'].'</span>';
    46                 if($Row['Value'] == -0) $Row['Value'] = 0;
    47                 if($Row['Value'] > 0) $Row['Value'] = '+'.$Row['Value'];
    48                 if($Row['BillCode'] == '') $Row['BillCode'] = 'PDF';
    49                 if($Row['File'] > 0) $Invoice = '<a href="'.$this->System->Link('/file?id='.$Row['File']).'">'.$Row['BillCode'].'</a>';
    50                 else $Invoice = NotBlank($Row['BillCode']);
    51                 if($Row['PeriodFrom'] != '') $Period = HumanDate($Row['PeriodFrom']).' - '.HumanDate($Row['PeriodTo']);
    52                 else $Period = '&nbsp;';
    53                 $Output .= '<tr><td style="text-align: right;">'.HumanDate($Row['Time']).'</td>'.
    54                                 '<td style="text-align: left;">'.$Row['Text'].'</td>'.
    55                                 '<td style="text-align: right;">'.round($Row['Value'], 2).'</td>'.
    56                                 '<td style="text-align: right;">'.$Row['State'].'</td>'.
    57                                 '<td>'.$Period.'</td>'.
    58                                 '<td>'.$Invoice.'</td></tr>';
    59                 $SumValue = $SumValue + $Row['Value'];
    60         }
    61         $Output .= '</table>';
    62         $Output .= $PageList['Output'];
    63         return($Output);
     41    while($Row = $DbResult->fetch_assoc())
     42    {
     43      $Row['State'] = round($Row['State'], 2);
     44      if($Row['State'] > 0) $Row['State'] = '<span style="color:green;">'.$Row['State'].'</span>';
     45      if($Row['State'] < 0) $Row['State'] = '<span style="color:red;">'.$Row['State'].'</span>';
     46      if($Row['Value'] == -0) $Row['Value'] = 0;
     47      if($Row['Value'] > 0) $Row['Value'] = '+'.$Row['Value'];
     48      if($Row['BillCode'] == '') $Row['BillCode'] = 'PDF';
     49      if($Row['File'] > 0) $Invoice = '<a href="'.$this->System->Link('/file?id='.$Row['File']).'">'.$Row['BillCode'].'</a>';
     50      else $Invoice = NotBlank($Row['BillCode']);
     51      if($Row['PeriodFrom'] != '') $Period = HumanDate($Row['PeriodFrom']).' - '.HumanDate($Row['PeriodTo']);
     52      else $Period = '&nbsp;';
     53      $Output .= '<tr><td style="text-align: right;">'.HumanDate($Row['Time']).'</td>'.
     54          '<td style="text-align: left;">'.$Row['Text'].'</td>'.
     55          '<td style="text-align: right;">'.round($Row['Value'], 2).'</td>'.
     56          '<td style="text-align: right;">'.$Row['State'].'</td>'.
     57          '<td>'.$Period.'</td>'.
     58          '<td>'.$Invoice.'</td></tr>';
     59      $SumValue = $SumValue + $Row['Value'];
     60    }
     61    $Output .= '</table>';
     62    $Output .= $PageList['Output'];
     63    return($Output);
    6464  }
    6565
     
    8585      } else return($this->SystemMessage('Chyba', 'Nejste zákazníkem'));
    8686    }
    87        
     87
    8888    // Load customer info
    8989    $DbResult = $this->Database->query('SELECT * FROM `Member` WHERE `Id`='.$CustomerId);
    9090    if($DbResult->num_rows == 1)
    9191    {
    92         $Customer = $DbResult->fetch_assoc();     
     92      $Customer = $DbResult->fetch_assoc();
    9393    } else return($this->SystemMessage('Položka nenalezena', 'Zákazník nenalezen'));
    94    
    95    
     94
     95
    9696    // Load subject info
    9797    $DbResult = $this->Database->query('SELECT * FROM `Subject` WHERE `Id`='.$Customer['Subject']);
    9898    if($DbResult->num_rows == 1)
    99     {   
    100       $Subject = $DbResult->fetch_assoc();     
     99    {
     100      $Subject = $DbResult->fetch_assoc();
    101101    } else return($this->SystemMessage('Položka nenalezena', 'Subjekt nenalezen'));
    102    
    103    
    104     $Output = '<table width="100%" border="0" cellspacing="0" cellpadding="3"><tr><td valign="top">';       
     102
     103
     104    $Output = '<table width="100%" border="0" cellspacing="0" cellpadding="3"><tr><td valign="top">';
    105105
    106106    // Account state
     
    120120
    121121    $DbResult = $this->Database->query('SELECT FinanceBankAccount.*, CONCAT(FinanceBankAccount.Number, "/", FinanceBank.Code) AS NumberFull FROM FinanceBankAccount '.
    122                 'JOIN FinanceBank ON FinanceBank.Id=FinanceBankAccount.Bank '.
    123                 'WHERE (FinanceBankAccount.`Subject`='.$this->System->Config['Finance']['MainSubjectId'].') AND (FinanceBankAccount.`Use`=1)');
     122        'JOIN FinanceBank ON FinanceBank.Id=FinanceBankAccount.Bank '.
     123        'WHERE (FinanceBankAccount.`Subject`='.$this->System->Config['Finance']['MainSubjectId'].') AND (FinanceBankAccount.`Use`=1)');
    124124    $SubjectFromAccount = $DbResult->fetch_assoc();
    125125    $Account = $SubjectFromAccount['NumberFull'];
     
    138138    while($DbRow = $DbResult->fetch_assoc())
    139139    {
    140             $Output .= '<tr><td>'.$DbRow['Name'].'</td><td>'.$DbRow['Price'].'</td></tr>';
     140      $Output .= '<tr><td>'.$DbRow['Name'].'</td><td>'.$DbRow['Price'].'</td></tr>';
    141141      $Total += $DbRow['Price'];
    142142    }
  • trunk/Modules/Finance/Zivnost.php

    r724 r738  
    5050    $Balance['SmallAssets']['End'] = $Row[0] + 0;
    5151    return($Balance);
    52   } 
     52  }
    5353
    5454  function Show()
     
    142142        $Output .= '<strong>Příjmy za rok '.$Year['Year'].'</strong>';
    143143        $Output .= '<table style="font-size: smaller;" class="WideTable">';
    144         $Output .= '<tr><th>Čas</th><th>Kód</th><th>Subjekt</th><th>Text</th><th>Hodnota [Kč]</th><th>Daňový</th><th>Hotovost</th></tr>';       
     144        $Output .= '<tr><th>Čas</th><th>Kód</th><th>Subjekt</th><th>Text</th><th>Hodnota [Kč]</th><th>Daňový</th><th>Hotovost</th></tr>';
    145145        $DbResult = $this->Database->query('SELECT * FROM FinanceOperation LEFT JOIN Subject ON Subject.Id = FinanceOperation.Subject '.
    146146          'WHERE (Direction = 1) AND (FinanceOperation.Time >= "'.$Year['DateStart'].'") AND (FinanceOperation.Time <= "'.$Year['DateEnd'].'") ORDER BY Time');
     
    172172        $Output .= '<strong>Výdaje za rok '.$Year['Year'].'</strong>';
    173173        $Output .= '<table style="font-size: smaller;" class="WideTable">';
    174         $Output .= '<tr><th>Čas</th><th>Kód</th><th>Subjekt</th><th>Text</th><th>Hodnota [Kč]</th><th>Daňový</th><th>Hotovost</th></tr>';       
     174        $Output .= '<tr><th>Čas</th><th>Kód</th><th>Subjekt</th><th>Text</th><th>Hodnota [Kč]</th><th>Daňový</th><th>Hotovost</th></tr>';
    175175        $DbResult = $this->Database->query('SELECT * FROM FinanceOperation LEFT JOIN Subject ON Subject.Id = FinanceOperation.Subject '.
    176176          'WHERE (Direction = -1) AND (FinanceOperation.Time >= "'.$Year['DateStart'].'") AND (FinanceOperation.Time <= "'.$Year['DateEnd'].'") ORDER BY Time');
     
    197197        $DbResult = $this->Database->select('FinanceYear', '*', 'Id='.$_GET['year']);
    198198        $Year = $DbResult->fetch_assoc();
    199        
     199
    200200        $Total = 0;
    201201        $Output .= '<strong>Pohledávky za rok '.$Year['Year'].'</strong>';
     
    234234          $Row['Value'] = $Row['Value'] * -1;
    235235          $Output .= '<tr><td>'.HumanDate($Row['Time']).'</td><td>'.$Row['BillCode'].
    236             '</td><td>'.$Row['Name'].'</td><td>'.$Row['Text'].'</td><td>'.($Row['Value'] * $Row['Direction']).'</td></tr>';         
     236            '</td><td>'.$Row['Name'].'</td><td>'.$Row['Text'].'</td><td>'.($Row['Value'] * $Row['Direction']).'</td></tr>';
    237237          $Total += $Row['Value'];
    238238        }
     
    288288        $Output .= '<tr><th>Datum vytvoření</th><th>Datum zaplacení</th><th>Název</th><th>Hodnota [Kč]</th><th>Doklad</th></tr>';
    289289        $DbResult = $this->Database->select('FinanceInvoice', '*, (SELECT GROUP_CONCAT(Description SEPARATOR ",") '.
    290                 'FROM FinanceInvoiceItem WHERE FinanceInvoiceItem.FinanceInvoice = FinanceInvoice.Id) AS Text',
    291                 'Subject='.$_GET['Id'].' ORDER BY Time');
     290          'FROM FinanceInvoiceItem WHERE FinanceInvoiceItem.FinanceInvoice = FinanceInvoice.Id) AS Text',
     291          'Subject='.$_GET['Id'].' ORDER BY Time');
    292292        while($Row = $DbResult->fetch_array())
    293293        {
     
    317317          'WHERE (FinanceInvoice.Subject = Subject.Id) AND (FinanceInvoice.Direction = -1) '.
    318318          'AND (TimePayment IS NULL)) AS OpenedLiabilities, '.
    319                 '(SELECT SUM(FinanceOperation.Value*FinanceOperation.Direction) '.
     319          '(SELECT SUM(FinanceOperation.Value*FinanceOperation.Direction) '.
    320320          'FROM FinanceOperation WHERE FinanceOperation.Subject = Subject.Id AND FinanceOperation.Direction = 1) '.
    321321          'AS Gains, (SELECT SUM(FinanceOperation.Value*FinanceOperation.Direction) FROM FinanceOperation WHERE '.
     
    341341        $Output .= '<strong>Roční přehledy</strong><br/>';
    342342        $Output .= $this->ShowFinanceYears();
    343         if(array_key_exists('year', $_GET)) 
     343        if(array_key_exists('year', $_GET))
    344344        {
    345345          $Year = $_GET['year'] * 1;
     
    353353    return($Output);
    354354  }
    355  
     355
    356356  function ShowFinanceYears()
    357357  {
  • trunk/Modules/FinanceBankAPI/FileImport.php

    r719 r738  
    88  var $Database;
    99  var $BankAccount;
    10  
     10
    1111  function __construct($System)
    1212  {
     
    1414    $this->System = &$System;
    1515  }
    16      
     16
    1717  function Import()
    1818  {
    1919  }
    20  
     20
    2121  function ImportFile($Content, $Ext)
    22   {   
     22  {
    2323  }
    24  
     24
    2525  function PairOperations()
    2626  {
     
    3232        $DbResult2 = $this->Database->select('Subject', 'Id', 'Id='.$DbRow['VariableSymbol']);
    3333        if($DbResult2->num_rows == 1)
    34         { 
     34        {
    3535          $DbRow2 = $DbResult2->fetch_assoc();
    36           // TODO: Replace constants by links to real database numbers 
     36          // TODO: Replace constants by links to real database numbers
    3737          if($DbRow['Value'] >= 0) {
    38                 $DocumentLine = 3; // Receive money
    39                 $Direction = 1;                 
     38            $DocumentLine = 3; // Receive money
     39            $Direction = 1;
    4040          } else {
    41                 $DocumentLine = 4; // Send money
    42                 $Direction = -1;
     41            $DocumentLine = 4; // Send money
     42            $Direction = -1;
    4343          }
    4444          $Year = date('Y', MysqlDateToTime($DbRow['Time']));
    4545          $BillCode = $this->System->Modules['Finance']->GetNextDocumentLineNumber($DocumentLine, $Year);
    46           $DbResult3 = $this->Database->insert('FinanceOperation', array('Subject' => $DbRow2['Id'], 'Cash' => 0, 
     46          $DbResult3 = $this->Database->insert('FinanceOperation', array('Subject' => $DbRow2['Id'], 'Cash' => 0,
    4747            'Value' => Abs($DbRow['Value']), 'Direction' => $Direction, 'Taxable' => 1, 'BankAccount' => $DbRow['BankAccount'], 'Network' => 1,
    4848            'Time' => $DbRow['Time'], 'Text' => $DbRow['Description'], 'BillCode' => $BillCode, 'DocumentLine' => $DocumentLine));
     
    6161
    6262  function Show()
    63   {   
     63  {
    6464    $Output = '';
    6565    if(!$this->System->User->CheckPermission('Finance', 'SubjectList')) return('Nemáte oprávnění');
    66      
     66
    6767    $DbResult = $this->Database->select('FinanceBankAccount', '*', 'Id='.$_GET['i']);
    6868    $BankAccount = $DbResult->fetch_assoc();
    69    
     69
    7070    $DbResult = $this->Database->select('FinanceBank', '*', 'Id='.$BankAccount['Bank']);
    7171    $Bank = $DbResult->fetch_assoc();
    7272    $Output .= 'Účet: '.$BankAccount['Number'].'/'.$Bank['Code'].' ('.$Bank['Name'].')';
    73    
     73
    7474    if($Bank['Code'] == '2010') $Import = new ImportFio($this->System);
    7575      else if($Bank['Code'] == '0300') $Import = new ImportPS($this->System);
     
    8080      $Output .= $Import->Import();
    8181      $Import->PairOperations();
    82     } 
     82    }
    8383    return($Output);
    8484  }
    8585}
    86  
     86
    8787class PageImportFile extends Page
    8888{
     
    9090  var $ShortTitle = 'Import plateb ze souboru';
    9191  var $ParentClass = 'PageFinance';
    92  
     92
    9393  function Show()
    9494  {
     
    103103    return($Output);
    104104  }
    105  
     105
    106106  function ShowForm()
    107107  {
     
    113113    return($Output);
    114114  }
    115  
     115
    116116  function Prepare()
    117   {   
     117  {
    118118    $Form = new Form($this->System->FormManager);
    119119    $Form->SetClass('ImportBankFile');
     
    125125    $DbResult = $this->Database->select('FinanceBankAccount', '*', 'Id='.$Form->Values['BankAccount']);
    126126    $BankAccount = $DbResult->fetch_assoc();
    127    
     127
    128128    $DbResult = $this->Database->select('FinanceBank', '*', 'Id='.$BankAccount['Bank']);
    129129    $Bank = $DbResult->fetch_assoc();
    130130    $Output .= 'Účet: '.$BankAccount['Number'].'/'.$Bank['Code'].' ('.$Bank['Name'].')';
    131    
     131
    132132    if($Bank['Code'] == '2010') $Import = new ImportFio($this->System);
    133133      else if($Bank['Code'] == '0300') $Import = new ImportPS($this->System);
     
    135135    $Import->BankAccount = $BankAccount;
    136136    $Output .= $Import->ImportFile($File->GetContent(), $File->GetExt());
    137    
     137
    138138    return($Output);
    139139  }
    140  
     140
    141141  function InsertMoney($Subject, $Value, $Direction, $Cash, $Taxable, $Time, $Text, $DocumentLine)
    142142  {
    143     $Year = date('Y', $Time);     
     143    $Year = date('Y', $Time);
    144144    $BillCode = $this->System->Modules['Finance']->GetNextDocumentLineNumber($DocumentLine, $Year);
    145     $this->Database->insert('FinanceOperation', array('Text' => $Text, 
    146         'Subject' => $Subject, 'Cash' => $Cash, 'Value' => $Value, 'Direction' => $Direction,
    147         'Time' => TimeToMysqlDateTime($Time), 'Taxable' => $Taxable, 'BillCode' => $BillCode));
     145    $this->Database->insert('FinanceOperation', array('Text' => $Text,
     146      'Subject' => $Subject, 'Cash' => $Cash, 'Value' => $Value, 'Direction' => $Direction,
     147      'Time' => TimeToMysqlDateTime($Time), 'Taxable' => $Taxable, 'BillCode' => $BillCode));
    148148  }
    149149
     
    152152    $Finance = $this->System->Modules['Finance'];
    153153    $Output = '';
    154    
     154
    155155    for($I = $_POST['ItemCount'] - 1; $I >= 0 ; $I--)
    156156    {
    157157      // TODO: Use links to database records instead of contants
    158158      if($_POST['Money'.$I] < 0) {
    159         $DocumentLine = 4;
    160         $Direction = -1;
     159        $DocumentLine = 4;
     160        $Direction = -1;
    161161      } else {
    162         $DocumentLine = 3;
    163         $Direction = 1;
     162        $DocumentLine = 3;
     163        $Direction = 1;
    164164      }
    165         $Date = explode('-', $_POST['Date'.$I]);
     165      $Date = explode('-', $_POST['Date'.$I]);
    166166      $Date = mktime(0, 0, 0, $Date[1], $Date[2], $Date[0]);
    167167      $this->InsertMoney($_POST['Subject'.$I], Abs($_POST['Money'.$I]), $Direction, 0, $_POST['Taxable'.$I], $Date, $_POST['Text'.$I], $DocumentLine);
  • trunk/Modules/FinanceBankAPI/FinanceBankAPI.php

    r735 r738  
    5959
    6060    $this->System->RegisterPage(array('finance', 'import-api'), 'PageImportAPI');
    61     $this->System->RegisterPage(array('finance', 'import-soubor'), 'PageImportFile');   
     61    $this->System->RegisterPage(array('finance', 'import-soubor'), 'PageImportFile');
    6262  }
    6363
     
    7979      'presetBankAccount' => $Item['BankAccount'],
    8080      'presetDocumentLine' => $DocumentLine);
    81         return($Preset);
     81    return($Preset);
    8282  }
    8383}
     
    8585class ScheduleBankImport extends SchedulerTask
    8686{
    87         function Execute()
    88         {
    89                 $Output = '';
    90                 $DbResult = $this->Database->select('FinanceBankAccount', 'Id, Comment',
    91                         '(`AutoImport`=1) AND ((`TimeEnd` IS NULL) OR (`TimeEnd` > NOW()))');
    92                 while($DbRow = $DbResult->fetch_assoc())
    93                 {                       
    94                         echo($DbRow['Comment']."\n");
    95                         $Page = new PageImportAPI($this->System);
    96                         $Output .= $Page->Show();
    97                 }
    98                 return($Output);
    99         }
     87  function Execute()
     88  {
     89    $Output = '';
     90    $DbResult = $this->Database->select('FinanceBankAccount', 'Id, Comment',
     91      '(`AutoImport`=1) AND ((`TimeEnd` IS NULL) OR (`TimeEnd` > NOW()))');
     92    while($DbRow = $DbResult->fetch_assoc())
     93    {
     94      echo($DbRow['Comment']."\n");
     95      $Page = new PageImportAPI($this->System);
     96      $Output .= $Page->Show();
     97    }
     98    return($Output);
     99  }
    100100}
  • trunk/Modules/FinanceBankAPI/Fio.php

    r550 r738  
    11<?php
    2  
     2
    33include('GPC.php');
    4  
    5 class Fio 
     4
     5class Fio
    66{
    77  var $UserName;
    88  var $Password;
    9   var $Account; 
    10  
     9  var $Account;
     10
    1111  function Import($TimeFrom, $TimeTo)
    1212  {
     
    1414    if($this->Password == '') throw new Exception('Missing value for Password property.');
    1515    if(!is_numeric($this->Account)) throw new Exception('Missing or not numeric value for Account property.');
    16  
     16
    1717    $fp = fsockopen('ssl://www.fio.cz', 443, $errno, $errstr, 30);
    18     if(!$fp) 
     18    if(!$fp)
    1919    {
    2020      throw new Exception('Connection error: '.$errstr);
    21     } else 
     21    } else
    2222    {
    2323      // Send request
     
    3232      $Request .= "Connection: Close\r\n\r\n";
    3333      fwrite($fp, $Request);
    34  
     34
    3535      // Read response
    3636      $Response = array();
    37       while(!feof($fp)) 
     37      while(!feof($fp))
    3838      {
    3939        $Response[] = trim(fgets($fp, 1024));
    4040      }
    4141      fclose($fp);
    42  
     42
    4343      // Strip HTTP header
    4444      while($Response[0] != '') array_shift($Response);
    4545      array_shift($Response); // Remove empty line
    4646      //echo(implode("\n", $Response));
    47  
     47
    4848      // Parse all GPC lines
    4949      $GPC = new GPC();
     
    5858    }
    5959  }
    60  
     60
    6161  function NoValidDataError($Response)
    6262  {
    6363    // Try to get error message
    6464    // If something go wrong fio show HTML login page and display error message
    65         $Response = implode('', $Response);
     65  $Response = implode('', $Response);
    6666    $ErrorMessageStart = '<div id="oldform_warning">';
    67     if(strpos($Response, $ErrorMessageStart) !== false) 
    68         {
    69           $Response = substr($Response, strpos($Response, $ErrorMessageStart) + strlen($ErrorMessageStart));
    70           $ErrorMessage = trim(substr($Response, 0, strpos($Response, '</div>')));
    71         } else $ErrorMessage = '';
    72         throw new Exception('No valid GPC data: '.$ErrorMessage);
     67    if(strpos($Response, $ErrorMessageStart) !== false)
     68  {
     69    $Response = substr($Response, strpos($Response, $ErrorMessageStart) + strlen($ErrorMessageStart));
     70    $ErrorMessage = trim(substr($Response, 0, strpos($Response, '</div>')));
     71  } else $ErrorMessage = '';
     72  throw new Exception('No valid GPC data: '.$ErrorMessage);
    7373  }
    7474}
  • trunk/Modules/FinanceBankAPI/FioAPI.php

    r628 r738  
    11<?php
    2  
     2
    33// Specifikace API: http://www.fio.cz/docs/cz/API_Bankovnictvi.pdf
    44
     
    1010    else return($Text);
    1111}
    12  
     12
    1313class FioAPI
    1414{
     
    1616  var $Encoding;
    1717  var $Format;
    18  
     18
    1919  function __construct()
    2020  {
     
    2222    $this->Format = 'csv';
    2323  }
    24  
     24
    2525  function Import($TimeFrom, $TimeTo)
    2626  {
    2727    if($this->Token == '') throw new Exception('Missing value for Token property.');
    28  
     28
    2929    // URL format: https://www.fio.cz/ib_api/rest/periods/{token}/{datum od}/{datum do}/transactions.{format}
    3030    // Send request
     
    3232      date('Y-m-d', $TimeFrom).'/'.date('Y-m-d', $TimeTo).'/transactions.'.$this->Format;
    3333    $Response = file_get_contents('https://www.fio.cz'.$RequestURL);
    34     if($Response == FALSE) 
     34    if($Response == FALSE)
    3535    {
    3636      throw new Exception('Connection error');
    37     } else 
     37    } else
    3838    {
    3939      if($this->Format == 'gpc') $Response = iconv('windows-1250', $this->Encoding, $Response);
    4040      $Response = explode("\n", $Response);
    41      
     41
    4242      if($this->Format == 'gpc')
    43       {       
     43      {
    4444        // Parse all GPC lines
    4545        $GPC = new GPC();
     
    5757          'Items' => array(),
    5858        );
    59        
     59
    6060        // CVS header
    61         while($Response[0] != '') 
     61        while($Response[0] != '')
    6262        {
    6363          $Line = explode(';', $Response[0]);
    6464          if($Line[0] == 'accountId') $Result['AccountNumber'] = $Line[0];
    65           else if($Line[0] == 'bankId') $Result['BankId'] = $Line[0]; 
     65          else if($Line[0] == 'bankId') $Result['BankId'] = $Line[0];
    6666          else if($Line[0] == 'currency') $Result['Currency'] = $Line[0];
    6767          else if($Line[0] == 'iban') $Result['IBAN'] = $Line[0];
     
    7272          else if($Line[0] == 'dateEnd') $Result['DateEnd'] = $Line[0];
    7373          else if($Line[0] == 'idFrom') $Result['IdFrom'] = $Line[0];
    74           else if($Line[0] == 'idTo') $Result['IdTo'] = $Line[0];           
     74          else if($Line[0] == 'idTo') $Result['IdTo'] = $Line[0];
    7575          array_shift($Response);
    7676        }
     
    8686          $Date = explode('.', $Line[1]);
    8787          $Date = mktime(0, 0, 0, $Date[1], $Date[0], $Date[2]);
    88           $NewRecord = array('ID' => $Line[0], 'Date' => $Date, 'Value' => $Line[2], 'CurrencyCode' => $Line[3], 
     88          $NewRecord = array('ID' => $Line[0], 'Date' => $Date, 'Value' => $Line[2], 'CurrencyCode' => $Line[3],
    8989            'OffsetAccount' => $Line[4], 'OffsetAccountName' => $Line[5], 'BankCode' => $Line[6], 'BankName' => RemoveComma($Line[7]),
    9090            'ConstantSymbol' => $Line[8], 'VariableSymbol' => $Line[9], 'SpecificSymbol' => $Line[10],
    91             'UserIdent' => RemoveComma($Line[11]), 'Message' => RemoveComma($Line[12]), 'Type' => RemoveComma($Line[13]), 
    92             'User' => RemoveComma($Line[14]), 'Details' => RemoveComma($Line[15]), 'Comment' => RemoveComma($Line[16]), 
     91            'UserIdent' => RemoveComma($Line[11]), 'Message' => RemoveComma($Line[12]), 'Type' => RemoveComma($Line[13]),
     92            'User' => RemoveComma($Line[14]), 'Details' => RemoveComma($Line[15]), 'Comment' => RemoveComma($Line[16]),
    9393            'BIC' => $Line[17], 'OrderID' => $Line[18]);
    94           $Result['Items'][] = $NewRecord;         
     94          $Result['Items'][] = $NewRecord;
    9595        }
    9696      }
     
    9898    }
    9999  }
    100  
     100
    101101  function NoValidDataError($Response)
    102102  {
     
    105105    $Response = implode('', $Response);
    106106    $ErrorMessageStart = '<div id="oldform_warning">';
    107     if(strpos($Response, $ErrorMessageStart) !== false) 
     107    if(strpos($Response, $ErrorMessageStart) !== false)
    108108    {
    109109      $Response = substr($Response, strpos($Response, $ErrorMessageStart) + strlen($ErrorMessageStart));
  • trunk/Modules/FinanceBankAPI/FioDemo.php

    r548 r738  
    11<?php
    2  
     2
    33include('FioAPI.php');
    4  
     4
    55$Fio = new FioAPI();
    66$Fio->Token = '';
     
    1414{
    1515  echo('<tr>');
    16   if($Record['Type'] == GPC_TYPE_REPORT) 
     16  if($Record['Type'] == GPC_TYPE_REPORT)
    1717  {
    1818    echo('<td>Jméno účtu: '.$Record['AccountName'].'</td>');
     
    2222    echo('<td>Suma příjmů: '.$Record['CreditValue'].' Kč</td>');
    2323    echo('<td>Suma výdajů: '.$Record['DebitValue'].' Kč</td>');
    24  
     24
    2525    echo('</tr></table><br><br>');
    2626    echo('<table border="1"><tr>');
    27  
     27
    2828    echo('<th>Datum</th>');
    2929    echo('<th>Částka</th>');
     
    3535    echo('<th>Uživatelská identifikace</th>');
    3636  } else
    37   if($Record['Type'] == GPC_TYPE_ITEM) 
     37  if($Record['Type'] == GPC_TYPE_ITEM)
    3838  {
    3939    echo('<td>'.date('j.n.Y', $Record['DueDate']).'</td>');
     
    4545    echo('<td>'.$Record['SpecificSymbol'].'</td>');
    4646    echo('<td>'.$Record['ClientName'].'</td>');
    47   }         
     47  }
    4848  echo('</tr>');
    49  
     49
    5050}
    5151echo('</table>');
  • trunk/Modules/FinanceBankAPI/GPC.php

    r550 r738  
    11<?php
    2  
     2
    33define('GPC_TYPE_REPORT', '074');
    44define('GPC_TYPE_ITEM', '075');
    5  
     5
    66class GPC
    77{
    88  function ParseLine($Line)
    9   { 
     9  {
    1010    $Line = ' '.$Line;
    11     $Type = mb_substr($Line, 1, 3);                                                   
    12  
     11    $Type = mb_substr($Line, 1, 3);
     12
    1313    if($Type == GPC_TYPE_REPORT)
    1414    {
     
    1919        'AccountName' => trim(mb_substr($Line, 20, 20)),
    2020        'OldBalanceDate' => mktime(0, 0, 0, mb_substr($Line, 42, 2), mb_substr($Line, 40, 2), '20'.mb_substr($Line, 44, 2)),
    21         'OldBalanceValue' => (mb_substr($Line, 60, 1).mb_substr($Line, 46, 14)) / 100, 
     21        'OldBalanceValue' => (mb_substr($Line, 60, 1).mb_substr($Line, 46, 14)) / 100,
    2222        'NewBalanceValue' => (mb_substr($Line, 75, 1).mb_substr($Line, 61, 14)) / 100,
    23         'DebitValue' => (mb_substr($Line, 90, 1).mb_substr($Line, 76, 14)) / 100,   
    24         'CreditValue' => (mb_substr($Line, 105, 1).mb_substr($Line, 91, 14)) / 100,   
     23        'DebitValue' => (mb_substr($Line, 90, 1).mb_substr($Line, 76, 14)) / 100,
     24        'CreditValue' => (mb_substr($Line, 105, 1).mb_substr($Line, 91, 14)) / 100,
    2525        'SequenceNumber' => intval(mb_substr($Line, 106, 3)),
    2626        'Date' => mktime(0, 0, 0, mb_substr($Line, 111, 2), mb_substr($Line, 109, 2), '20'.mb_substr($Line, 113, 2)),
     
    2828        'CheckSum' => sha1(md5($Line).$Line),
    2929      );
    30     } else   
     30    } else
    3131    if($Type == GPC_TYPE_ITEM)
    32     {   
     32    {
    3333      $GPCLine = array
    3434      (
    3535        'Type' => GPC_TYPE_ITEM,
    3636        'AccountNumber' => mb_substr($Line, 4, 16),
    37         'OffsetAccount' => mb_substr($Line, 20, 16), 
    38         'RecordNumber' => mb_substr($Line, 36, 13), 
     37        'OffsetAccount' => mb_substr($Line, 20, 16),
     38        'RecordNumber' => mb_substr($Line, 36, 13),
    3939        'Value' => mb_substr($Line, 49, 12) / 100,
    40         'Code' => mb_substr($Line, 61, 1),   
     40        'Code' => mb_substr($Line, 61, 1),
    4141        'VariableSymbol' => intval(mb_substr($Line, 62, 10)),
    4242        'BankCode' => mb_substr($Line, 74, 4),
    4343        'ConstantSymbol' => intval(mb_substr($Line, 78, 4)),
    44         'SpecificSymbol' => intval(mb_substr($Line, 82, 10)), 
     44        'SpecificSymbol' => intval(mb_substr($Line, 82, 10)),
    4545        'Valut' => mb_substr($Line, 92, 6),
    46         'ClientName' => mb_substr($Line, 98, 20), 
     46        'ClientName' => mb_substr($Line, 98, 20),
    4747        //'Zero' => substr($Line, 118, 1),
    4848        'CurrencyCode' => mb_substr($Line, 119, 4),
     
    5050        'CheckSum' => sha1(md5($Line).$Line),
    5151      );
    52     } else 
     52    } else
    5353    $GPCLine = NULL;
    54  
     54
    5555    return($GPCLine);
    5656  }
  • trunk/Modules/FinanceBankAPI/ImportFio.php

    r715 r738  
    11<?php
    2  
     2
    33include('FioAPI.php');
    4  
     4
    55class ImportFio extends BankImport
    66{
    77  function Import()
    8   {   
     8  {
    99    $Fio = new FioAPI();
    1010    $Fio->Token = $this->BankAccount['LoginName'];
     
    2020        //$Output .= '<td>Ke dni '.date('j.n.Y', $Records['DateEnd']).' je stav účtu '.$Records['ClosingBalance'].' Kč</td>';
    2121        //$Output .= '<td>Suma příjmů: '.$Records['CreditValue'].' Kč</td>';
    22         //$Output .= '<td>Suma výdajů: '.$Records['DebitValue'].' Kč</td>';     
     22        //$Output .= '<td>Suma výdajů: '.$Records['DebitValue'].' Kč</td>';
    2323      //$Output .= '</tr>';
    2424    foreach($Records['Items'] as $Record)
     
    2626      $DbResult = $this->Database->select('FinanceBankImport', 'ID', 'Identification='.$Record['ID']);
    2727      if($DbResult->num_rows == 0)
    28       {     
     28      {
    2929        $Output .= '<tr>';
    3030        $this->Database->insert('FinanceBankImport', array('Time' => TimeToMysqlDate($Record['Date']),
    31           'BankAccount' => $this->BankAccount['Id'], 'Value' => $Record['Value'], 
     31          'BankAccount' => $this->BankAccount['Id'], 'Value' => $Record['Value'],
    3232          'SpecificSymbol' => $Record['SpecificSymbol'], 'VariableSymbol' => $Record['VariableSymbol'],
    3333          'ConstantSymbol' => $Record['ConstantSymbol'], 'Currency' => $this->BankAccount['Currency'],
     
    4141      }
    4242    }
    43     $Output .= '</table>';   
    44     $this->Database->update('FinanceBankAccount', 'Id='.$this->BankAccount['Id'], 
    45         array('LastImportDate' => TimeToMysqlDate($PeriodEnd)));
     43    $Output .= '</table>';
     44    $this->Database->update('FinanceBankAccount', 'Id='.$this->BankAccount['Id'],
     45      array('LastImportDate' => TimeToMysqlDate($PeriodEnd)));
    4646    return($Output);
    4747  }
  • trunk/Modules/FinanceBankAPI/ImportPS.php

    r550 r738  
    1414    $Data = explode("\n", $Content);
    1515  }
    16  
     16
    1717  function ImportCVS($Content)
    1818  {
    1919    $Finance = &$this->System->Modules['Finance'];
    20    
     20
    2121    $Data = explode("\n", $Content);
    2222    foreach($Data as $Key => $Value)
     
    4545        11 => '',
    4646    );
    47    
     47
    4848    if($Header != $Data[0]) $Output = 'Nekompatibilní struktura CSV';
    4949    else
     
    7979          $Style = '';
    8080        }
    81    
     81
    8282        if($Money < 0) $Text = 'Platba převodem';
    8383        else $Text = 'Přijatá platba';
     
    102102      $Output .= '<input type="submit" value="Zpracovat"/></form>';
    103103    }
    104   } 
     104  }
    105105}
  • trunk/Modules/IS/IS.php

    r736 r738  
    3232    if(array_key_exists('t', $_GET)) $Table = $_GET['t'];
    3333      else $Table = '';
    34     // i - index of item 
     34    // i - index of item
    3535    if(array_key_exists('i', $_GET)) $ItemId = $_GET['i'];
    3636      else $ItemId = 0;
    37     // fc - preset colum 
     37    // fc - preset colum
    3838    if(array_key_exists('fn', $_GET)) $FilterName = $_GET['fn'];
    3939      else $FilterName = '';
     
    4646
    4747    if($Action == 'list') {
    48         if($FilterName == '') $Content = $this->ShowList($Table);
    49           else $Content = $this->ShowList($Table, '', '', $FilterName, $FilterValue);
     48      if($FilterName == '') $Content = $this->ShowList($Table);
     49        else $Content = $this->ShowList($Table, '', '', $FilterName, $FilterValue);
    5050    }
    5151    else if($Action == 'select') $Content = $this->ShowSelect($Table);
     
    8484    $DbRow = $DbResult->fetch_row();
    8585    $Output .= 'Nedokončených úkolů: '.$DbRow['0'].'<br/>';
    86    
     86
    8787    $DbResult = $this->Database->select('Member', 'COUNT(*)', '1');
    8888    $DbRow = $DbResult->fetch_row();
    8989    $Output .= 'Zákazníků: '.$DbRow['0'].'<br/>';
    90    
     90
    9191    $DbResult = $this->Database->select('Subject', 'COUNT(*)', '1');
    9292    $DbRow = $DbResult->fetch_row();
    9393    $Output .= 'Subjektů: '.$DbRow['0'].'<br/>';
    94    
     94
    9595    $DbResult = $this->Database->select('User', 'COUNT(*)', '1');
    9696    $DbRow = $DbResult->fetch_row();
    9797    $Output .= 'Uživatelů: '.$DbRow['0'].'<br/>';
    98    
     98
    9999    $DbResult = $this->Database->select('NetworkDevice', 'COUNT(*)', '1');
    100100    $DbRow = $DbResult->fetch_row();
    101101    $Output .= 'Registrovaných zařízení: '.$DbRow['0'].'<br/>';
    102    
     102
    103103    $DbResult = $this->Database->select('FinanceOperation', 'SUM(`Value` * `Direction`)', '1');
    104104    $DbRow = $DbResult->fetch_row();
    105105    $Output .= 'Stav placení: '.$DbRow['0'].'<br/>';
    106    
     106
    107107    $DbResult = $this->Database->select('FinanceBankImport', 'COUNT(*)', '`FinanceOperation` IS NULL');
    108108    $DbRow = $DbResult->fetch_row();
     
    142142  function LogChange($Form, $Action, $NewId, $OldId)
    143143  {
    144         $Values = $Form->Definition['Table'].' (Id: '.$OldId.' => '.$NewId.'):'."\n";
    145         // Compare old values loaded from database with new values in Form variable
    146         $NewValues = $Form->Values;
    147         if($OldId != 0)
    148         {
    149           $FormOld = new Form($this->System->FormManager);
    150           $FormOld->SetClass($Form->Definition['Table']);
    151           $FormOld->LoadValuesFromDatabase($OldId);
    152                 $OldValues = $FormOld->Values;
    153                 // Keep only changes values
    154           foreach($NewValues as $Index => $Value)
    155           {
    156                 if($OldValues[$Index] != $NewValues[$Index])
    157                 {
    158                 $Values .= $Index.': '.$FormOld->GetValue($Index);
    159                 if($NewId != 0) $Values .= ' => '.$Form->GetValue($Index);
    160                 $Values .= "\n";
    161                 }
    162         }
    163         } else {
    164                 foreach($NewValues as $Index => $Value)
    165                 {
    166                         $Values .= $Index.': '.$Form->GetValue($Index)."\n";
    167                 }
    168         }
    169         $this->System->ModuleManager->Modules['Log']->NewRecord('IS', $Action, $Values);
     144    $Values = $Form->Definition['Table'].' (Id: '.$OldId.' => '.$NewId.'):'."\n";
     145    // Compare old values loaded from database with new values in Form variable
     146    $NewValues = $Form->Values;
     147    if($OldId != 0)
     148    {
     149      $FormOld = new Form($this->System->FormManager);
     150      $FormOld->SetClass($Form->Definition['Table']);
     151      $FormOld->LoadValuesFromDatabase($OldId);
     152      $OldValues = $FormOld->Values;
     153      // Keep only changes values
     154      foreach($NewValues as $Index => $Value)
     155      {
     156        if($OldValues[$Index] != $NewValues[$Index])
     157        {
     158          $Values .= $Index.': '.$FormOld->GetValue($Index);
     159          if($NewId != 0) $Values .= ' => '.$Form->GetValue($Index);
     160          $Values .= "\n";
     161        }
     162      }
     163    } else {
     164      foreach($NewValues as $Index => $Value)
     165      {
     166        $Values .= $Index.': '.$Form->GetValue($Index)."\n";
     167      }
     168    }
     169    $this->System->ModuleManager->Modules['Log']->NewRecord('IS', $Action, $Values);
    170170  }
    171171
     
    179179      if($_GET['o'] == 'save')
    180180      {
    181         if(!array_key_exists('submit', $_POST))
    182                 return($this->SystemMessage('Formulář', 'Formulář nebyl řádně odeslán. Vraťte se zpět a odešlete formulář znovu.'));
     181        if(!array_key_exists('submit', $_POST))
     182          return($this->SystemMessage('Formulář', 'Formulář nebyl řádně odeslán. Vraťte se zpět a odešlete formulář znovu.'));
    183183        $Form = new Form($this->System->FormManager);
    184184        $Form->SetClass($Table);
     
    193193        } catch (Exception $E)
    194194        {
    195                 $Output .= $this->SystemMessage('Úprava položky', 'Položku se nepodařilo uložit. Opravte problém a opakujte akci.<br/>'.$E->getMessage());
     195          $Output .= $this->SystemMessage('Úprava položky', 'Položku se nepodařilo uložit. Opravte problém a opakujte akci.<br/>'.$E->getMessage());
    196196          $Form->OnSubmit = '?a=edit&amp;t='.$Table.'&amp;i='.$_GET['i'].'&amp;o=save';
    197197          $Output .= $Form->ShowEditForm();
     
    230230    $Output = '';
    231231    if(defined('NEW_PERMISSION') and !$this->System->User->CheckPermission($this->TableToModule($Table), 'Write'))
    232       return('Nemáte oprávnění');   
     232      return('Nemáte oprávnění');
    233233    $DbResult = $this->Database->select($Table, '*', '`Id`='.$Id);
    234234    if($DbResult->num_rows > 0)
    235235    {
    236         $DbRow = $DbResult->fetch_assoc();
    237         try {
     236      $DbRow = $DbResult->fetch_assoc();
     237      try {
    238238        $Form = new Form($this->System->FormManager);
    239239        $this->ShortTitle .= ' - '.$Form->Definition['Title'].' odstranění';
     
    244244      } catch (Exception $E)
    245245      {
    246         $Output .= $this->SystemMessage('Smazání položky', 'Položku se nepodařilo smazat. Pravděpodobně na ni závisejí další položky.');
     246        $Output .= $this->SystemMessage('Smazání položky', 'Položku se nepodařilo smazat. Pravděpodobně na ni závisejí další položky.');
    247247      }
    248248    } else $Output .= $this->SystemMessage('Smazání položky', 'Položka nenalezena');
     
    301301        } catch (Exception $E)
    302302        {
    303                 $Output .= $this->SystemMessage('Přidání položky', 'Položku se nepodařilo přidat. Opravte problém a opakujte akci.<br/>'.$E->getMessage());
    304                 $Form->OnSubmit = '?a=add&amp;t='.$Table.'&amp;o=save';
     303          $Output .= $this->SystemMessage('Přidání položky', 'Položku se nepodařilo přidat. Opravte problém a opakujte akci.<br/>'.$E->getMessage());
     304          $Form->OnSubmit = '?a=add&amp;t='.$Table.'&amp;o=save';
    305305          $Output .= $Form->ShowEditForm();
    306306          $Actions[] = '<a href="?a=list&amp;t='.$Table.'"><img alt="Seznam" title="Seznam" src="'.
     
    353353    if(defined('NEW_PERMISSION') and !$this->System->User->CheckPermission($this->TableToModule($Table), 'Read'))
    354354      return('Nemáte oprávnění');
    355    
     355
    356356    $FormClass = $this->System->FormManager->Classes[$Table];
    357357    if(array_key_exists('BaseTable', $FormClass)) $TableModify = $FormClass['BaseTable'];
    358358      else $TableModify = $Table;
    359    
     359
    360360    $Form = new Form($this->System->FormManager);
    361361    $Form->SetClass($Table);
     
    407407  function ShowTable($Table, $Filter = '', $Title = '', $RowActions = array(), $ExcludeColumn = '')
    408408  {
    409         if($Table != '') $FormClass = $this->System->FormManager->Classes[$Table];
     409    if($Table != '') $FormClass = $this->System->FormManager->Classes[$Table];
    410410      else return($this->SystemMessage('Chyba', 'Tabulka nenalezena'));
    411411
     
    416416    // Build form type filter
    417417    $TypeFilter = '';
    418     foreach($FormClass['Items'] as $ItemIndex => $FormItem)   
     418    foreach($FormClass['Items'] as $ItemIndex => $FormItem)
    419419    if(!array_key_exists($FormItem['Type'], $this->System->FormManager->FormTypes) or
    420420    (array_key_exists($FormItem['Type'], $this->System->FormManager->FormTypes) and
     
    422422    if(array_key_exists('Filter', $FormItem) and ($FormItem['Filter'] == true))
    423423    {
    424         if($TypeFilter != '') $TypeFilter .= ' AND ';           
    425         $TypeFilter .= '('.$ItemIndex.' = "'.$FormItem['Default'].'")';
    426     }     
     424      if($TypeFilter != '') $TypeFilter .= ' AND ';
     425      $TypeFilter .= '('.$ItemIndex.' = "'.$FormItem['Default'].'")';
     426    }
    427427    if($TypeFilter != '')
    428428    {
    429         if($Filter != '') $Filter = ' AND';
    430         $Filter .= ' '.$TypeFilter;
    431     }
    432    
     429      if($Filter != '') $Filter = ' AND';
     430      $Filter .= ' '.$TypeFilter;
     431    }
     432
    433433    // Build user filter
    434434    $UserFilter = '';
     
    470470    if($Filter != '') $Filter = ' HAVING '.$Filter;
    471471
    472     foreach($FormClass['Items'] as $ItemIndex => $FormItem)     
     472    foreach($FormClass['Items'] as $ItemIndex => $FormItem)
    473473      if(!array_key_exists($FormItem['Type'], $this->System->FormManager->FormTypes) or
    474474      (array_key_exists($FormItem['Type'], $this->System->FormManager->FormTypes) and
    475475      ($this->System->FormManager->FormTypes[$FormItem['Type']]['Type'] != 'ManyToOne')))
    476476      {
    477         if($ExcludeColumn != $ItemIndex)
    478         if(!array_key_exists('Hidden', $FormItem) or ($FormItem['Hidden'] == false))
     477        if($ExcludeColumn != $ItemIndex)
     478        if(!array_key_exists('Hidden', $FormItem) or ($FormItem['Hidden'] == false))
    479479          $TableColumns[] = array('Name' => $ItemIndex, 'Title' => $FormItem['Caption']);
    480480        $UseType = $UseType = $FormItem['Type'];
     
    563563      ($ExcludeColumn != $ItemIndex))
    564564      {
    565         //$Output .= '<td>'.$Row[$ItemIndex].'</td>';
     565        //$Output .= '<td>'.$Row[$ItemIndex].'</td>';
    566566        $UseType = $UseType = $FormItem['Type'];
    567567        if(array_key_exists($FormItem['Type'], $this->System->FormManager->FormTypes))
     
    632632    if(array_key_exists('BaseTable', $FormClass)) $TableModify = $FormClass['BaseTable'];
    633633      else $TableModify = $Table;
    634    
     634
    635635    $RowActions = '<a href="?a=view&amp;t='.$Table.'&amp;i=#RowId"><img alt="Ukázat" title="Ukázat" src="'.
    636636      $this->System->Link('/images/view.png').'"/></a>'.
     
    755755      $Confirm = ' onclick="return confirmAction(\''.$Confirm.'\');"';
    756756    $Output = '<a href="'.$Target.'"'.$Confirm.'>'.$Output.'</a>';
    757         return($Output);
     757    return($Output);
    758758  }
    759759}
  • trunk/Modules/Map/Map.php

    r721 r738  
    1515    if(count($this->System->PathItems) > 1)
    1616    {
    17       if($this->System->PathItems[1] == 'show-position') return($this->ShowPosition()); 
     17      if($this->System->PathItems[1] == 'show-position') return($this->ShowPosition());
    1818      else return(PAGE_NOT_FOUND);
    1919    } else return($this->ShowMain());
    2020  }
    21  
     21
    2222  function ShowPosition()
    2323  {
     
    3737    } else return('Položka nenalezena');
    3838  }
    39  
     39
    4040  function ShowMain()
    4141  {
     
    4949    var tinyIcon;
    5050
    51     function initialize() 
    52     {
    53       if (GBrowserIsCompatible()) 
     51    function initialize()
     52    {
     53      if (GBrowserIsCompatible())
    5454      {
    5555        map = new GMap2(document.getElementById("map_canvas"));
     
    5858        map.setUIToDefault();
    5959        map.addControl(new GOverviewMapControl(new GSize(128, 96)));
    60        
     60
    6161
    6262// Create our "tiny" marker icon
     
    6868tinyIcon.iconAnchor = new GPoint(5, 5);
    6969tinyIcon.infoWindowAnchor = new GPoint(5, 1);
    70    
    71         toggleLabel(\'NetworkLinks\');
    72         toggleLabel(\'NetworkDevices\');';
    73    
    74             $Output .= '   
    75        }     
    76     }
    77    
    78 function toggleLabel(id) 
    79 {
    80         var ele = document.getElementById(id);
    81         ele.checked = !ele.checked;
    82         ele.onclick( );
    83 }
    84 
    85     function UpdateNetworkLinks() 
    86     {
    87             if ((document.getElementById("NetworkLinks")).checked == true)
    88       {
    89                     NetworkLinks = [';
     70
     71  toggleLabel(\'NetworkLinks\');
     72  toggleLabel(\'NetworkDevices\');';
     73
     74      $Output .= '
     75       }
     76    }
     77
     78function toggleLabel(id)
     79{
     80  var ele = document.getElementById(id);
     81  ele.checked = !ele.checked;
     82  ele.onclick( );
     83}
     84
     85    function UpdateNetworkLinks()
     86    {
     87      if ((document.getElementById("NetworkLinks")).checked == true)
     88      {
     89        NetworkLinks = [';
    9090    $DbResult = $this->Database->query('SELECT * FROM NetworkLink WHERE Interface1 <> 0 AND Interface2 <> 0');
    9191    while($Link = $DbResult->fetch_assoc())
     
    114114                }
    115115
    116         } else { //checkbox turned off
    117                 for (var i in NetworkLinks)
    118     {
    119                         map.removeOverlay(NetworkLinks[i]);
    120                         NetworkLinks[i] = null;
    121                 }
    122         }
    123 }
    124 
    125 function toggleLabel(id) 
    126 {
    127         var ele = document.getElementById(id);
    128         ele.checked = !ele.checked;
    129         ele.onclick( );
    130 }
    131 
    132     function UpdateNetworkDevices() 
    133     {
    134             if ((document.getElementById("NetworkDevices")).checked == true)
    135       {
    136                     NetworkDevices = [';
     116  } else { //checkbox turned off
     117    for (var i in NetworkLinks)
     118    {
     119      map.removeOverlay(NetworkLinks[i]);
     120      NetworkLinks[i] = null;
     121    }
     122  }
     123}
     124
     125function toggleLabel(id)
     126{
     127  var ele = document.getElementById(id);
     128  ele.checked = !ele.checked;
     129  ele.onclick( );
     130}
     131
     132    function UpdateNetworkDevices()
     133    {
     134      if ((document.getElementById("NetworkDevices")).checked == true)
     135      {
     136        NetworkDevices = [';
    137137
    138138    $DbResult = $this->Database->query('SELECT GROUP_CONCAT(NetworkDevice.Name SEPARATOR ",") AS Name, '.
     
    153153                }
    154154
    155         } else { //checkbox turned off
    156                 for (var i in NetworkDevices)
    157     {
    158                         map.removeOverlay(NetworkDevices[i]);
    159                         NetworkDevices[i] = null;
    160                 }
    161         }       
     155  } else { //checkbox turned off
     156    for (var i in NetworkDevices)
     157    {
     158      map.removeOverlay(NetworkDevices[i]);
     159      NetworkDevices[i] = null;
     160    }
     161  }
    162162}
    163163
     
    165165    $Output .= '<table style="margin-left: auto; margin-right: auto; width: 100%; height: 80%;">
    166166                  <tr>
    167                     <td style="width: 80%; height: 100%;"> 
     167                    <td style="width: 80%; height: 100%;">
    168168    <div id="map_canvas" style="width: 100%; height: 100%;"></div></td>
    169169    <td style="width: 20%">
     
    208208    $this->SupportedModels = array();
    209209  }
    210  
     210
    211211  function DoStart()
    212212  {
     
    225225    ));
    226226    $this->System->FormManager->RegisterFormType('TMapPosition', array(
    227         'Type' => 'Reference',
    228         'Table' => 'MapPosition',
    229         'Id' => 'Id',
    230         'Name' => 'Name',
    231         'Filter' => '1',
     227      'Type' => 'Reference',
     228      'Table' => 'MapPosition',
     229      'Id' => 'Id',
     230      'Name' => 'Name',
     231      'Filter' => '1',
    232232    ));
    233    
    234   } 
    235 }
     233
     234  }
     235}
  • trunk/Modules/Map/MapAPI.php

    r574 r738  
    11<?php
    22
    3 class MapApi extends Model 
     3class MapApi extends Model
    44{
    55  var $Position;
     
    99  var $ShowMarker;
    1010  var $MarkerText;
    11  
     11
    1212  function __construct($System)
    1313  {
    1414    parent::__construct($System);
    15     $this->Zoom = 2; 
     15    $this->Zoom = 2;
    1616    $this->Position = array('Lat' => 40.178873, 'Lng' => 65.039062);
    1717    $this->Key = '';
    1818    $this->ShowMarker = false;
    19     $this->MarkerText = ''; 
     19    $this->MarkerText = '';
    2020  }
    21  
     21
    2222  function Show()
    2323  {
     
    3939      </script>';
    4040    $Output .= '<script type="text/javascript">
    41    
     41
    4242    var map;
    4343    var tinyIcon;
    44    
     44
    4545    function initialize()
    4646    {
     
    5252        map.setUIToDefault();
    5353        map.addControl(new GOverviewMapControl(new GSize(128, 96)));
    54    
     54
    5555        GEvent.addListener(map,"click",function(overlay, point)
    5656        {
     
    6161        });
    6262      }
    63    
     63
    6464    // Create our "tiny" marker icon
    6565    var tinyIcon = new GIcon();
     
    8484class MapApiSeznam extends MapApi
    8585{
    86  
     86
    8787}
  • trunk/Modules/Meals/Meals.php

    r586 r738  
    44{
    55  var $FullTitle = 'Jídleníček jídelny Na kopečku';
    6   var $ShortTitle = 'Jídelníček'; 
     6  var $ShortTitle = 'Jídelníček';
    77  var $ParentClass = 'PagePortal';
    88  var $DayNames = array('Neděle', 'Pondělí', 'Úterý', 'Středa', 'Čtvrtek', 'Pátek', 'Sobota');
     
    1414  {
    1515    if(count($this->System->PathItems) > 1)
    16     { 
     16    {
    1717      if($this->System->PathItems[1] == 'tisk') return($this->ShowPrint());
    1818        else if($this->System->PathItems[1] == 'menuedit.php') return($this->ShowEdit());
     
    4242    return($Output);
    4343  }
    44  
     44
    4545  function ShowPrint()
    4646  {
    4747    $this->ClearPage = true;
    48    
     48
    4949    $Output = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    5050<html>
     
    7979      {
    8080        $Output .= '<br>'.$this->Status[$Row['Status']].'<br>&nbsp;';
    81       } 
     81      }
    8282      $Output .= '</td></tr>';
    8383    }
     
    9191
    9292    $Output .= '</body></html>';
    93     return($Output);   
     93    return($Output);
    9494  }
    9595
     
    109109        '">Tisk</a></td>';
    110110      else $WeekRowSpan = '';
    111     if($Week == 0) $Color = ' style="color: #ff0000;" '; else $Color = ''; 
     111    if($Week == 0) $Color = ' style="color: #ff0000;" '; else $Color = '';
    112112    $Output = '<tr><td'.$Color.'>'.$this->DayNames[$Week].'</td><td>'.HumanDate($Row['Date']).'</td>'.$WeekRowSpan.'
    113113    <td><input name="soup_'.$Row['Date'].'" size="30" value="'.$Row['Soup'].'"></td>
     
    190190    $this->SupportedModels = array('Meals', 'MealsInfo');
    191191  }
    192  
     192
    193193  function DoInstall()
    194194  {
    195195  }
    196  
     196
    197197  function DoUnInstall()
    198198  {
  • trunk/Modules/Meteostation/Meteostation.php

    r586 r738  
    99  var $ShortTitle = 'Meteostanice';
    1010  var $ParentClass = 'PagePortal';
    11  
     11
    1212  function Show()
    1313  {
     
    2424  var $Period;
    2525  var $URL;
    26  
     26
    2727  function DownloadData()
    2828  {
    2929    $XmlData = simplexml_load_file($this->URL);
    3030
    31     $Data = array('MeteoStation' => $this->Id, 
     31    $Data = array('MeteoStation' => $this->Id,
    3232      'WindSpeed' => trim($XmlData->windspeed),
    3333      'WindDir' => trim($XmlData->winddir),
     
    4343    );
    4444    $this->Database->insert('MeteoStationMeasure', array(
    45       'Time' => TimeToMysqlDateTime(time()), 'MeteoStation' => $Data['MeteoStation'], 
    46       'WindSpeed' => $Data['WindSpeed'], 'WindDir' => $Data['WindDir'], 
    47       'WindGust' => $Data['WindGust'], 'Pressure' => $Data['Pressure'], 
     45      'Time' => TimeToMysqlDateTime(time()), 'MeteoStation' => $Data['MeteoStation'],
     46      'WindSpeed' => $Data['WindSpeed'], 'WindDir' => $Data['WindDir'],
     47      'WindGust' => $Data['WindGust'], 'Pressure' => $Data['Pressure'],
    4848      'SysTemp' => $Data['SysTemp'], 'Temperature' => $Data['Temperature'],
    4949      'BarAltitude' => $Data['BarAltitude'], 'WindChill' => $Data['WindChill'],
     
    5252    $this->Data = $Data;
    5353  }
    54  
     54
    5555  function CreateImage($FileName)
    5656  {
     
    6565    $Image->SaveToFile($FileName);
    6666  }
    67  
     67
    6868  function LoadFromDb()
    6969  {
     
    7979{
    8080  var $Data;
    81  
     81
    8282  function __construct($System)
    8383  {
     
    9090    $this->Dependencies = array();
    9191  }
    92  
     92
    9393  function DownloadAll()
    9494  {
     
    9898      $MeteoStation = new MeteoStation();
    9999      $MeteoStation->Id = $DbRow['Id'];
    100       $MeteoStation->LoadFromDb();     
     100      $MeteoStation->LoadFromDb();
    101101      $MeteoStation->DownloadData();
    102102      $MeteoStation->CreateImage('cache/'.$DbRow['Id'].'.png');
    103103    }
    104104  }
    105  
    106  
     105
     106
    107107  function DoInstall()
    108108  {
    109109  }
    110  
     110
    111111  function DoUninstall()
    112   {     
     112  {
    113113  }
    114  
     114
    115115  function DoStart()
    116116  {
    117117    $this->System->RegisterPage('meteo', 'PageMeteo');
    118   } 
    119  
     118  }
     119
    120120  function DoStop()
    121   { 
     121  {
    122122  }
    123123}
  • trunk/Modules/Network/HostList.php

    r717 r738  
    88  var $ShortTitle = 'Seznam počítačů';
    99  var $ParentClass = 'PageNetwork';
    10  
     10
    1111  function Show()
    1212  {
     
    4545          if($Interface['Name'] != '') $InterfaceName .= '-'.$Interface['Name'];
    4646          $Output .= '<tr><td style="text-align: left; '.$Style.'">&nbsp;&nbsp;'.$InterfaceName.'</td><td>'.$Interface['LocalIP'].'</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr>';
    47         }     
     47        }
    4848      }
    49     } 
     49    }
    5050    $Output .= '</table></div>';
    5151    return($Output);
  • trunk/Modules/Network/Network.php

    r736 r738  
    6565          $Output .= '<td style="background-color: '.$Color.';">&nbsp;</td>';
    6666        }
    67                    
    68         $Output .= '</tr>';       
     67
     68        $Output .= '</tr>';
    6969      }
    7070    }
     
    186186        'Online' => array('Type' => 'TOnlineState', 'Caption' => 'Běží', 'Default' => '0', 'ReadOnly' => true),
    187187        'LastOnline' => array('Type' => 'DateTime', 'Caption' => 'Naposledy běželo', 'Default' => '', 'ReadOnly' => true),
    188         'Links' => array('Type' => 'TNetworkLinkListInterface', 'Caption' => 'Propojení', 'Default' => ''),
     188        'Links' => array('Type' => 'TNetworkLinkListInterface', 'Caption' => 'Propojení', 'Default' => ''),
    189189        'UpDown' => array('Type' => 'TNetworkInterfaceUpDown', 'Caption' => 'Změny stavu', 'Default' => ''),
    190190        'Signal' => array('Type' => 'TNetworkSignalListInterface', 'Caption' => 'Signál', 'Default' => ''),
     
    192192
    193193      ),
    194     ));   
     194    ));
    195195    $this->System->FormManager->RegisterClass('NetworkInterfaceType', array(
    196196      'Title' => 'Typ síťového rozhraní',
     
    235235    $this->System->FormManager->RegisterClass('NetworkLinkUnion', array(
    236236      'Title' => 'Síťové propojení',
    237         'BaseTable' => 'NetworkLink',
     237      'BaseTable' => 'NetworkLink',
    238238      'SQL' => '(SELECT `Id`, `Type`, `Interface1` AS `Interface`, `Interface2` AS `InterfaceOther` FROM `NetworkLink`) '.
    239                 'UNION (SELECT `Id`, `Type`, `Interface2` AS `Interface`, `Interface1` AS `InterfaceOther` FROM `NetworkLink`)',
     239        'UNION (SELECT `Id`, `Type`, `Interface2` AS `Interface`, `Interface1` AS `InterfaceOther` FROM `NetworkLink`)',
    240240      'Items' => array(
    241241        'Type' => array('Type' => 'TNetworkLinkType', 'Caption' => 'Typ', 'Default' => '1', 'ReadOnly' => true),
    242242        'Interface' => array('Type' => 'TNetworkInterface', 'Caption' => 'Rozhraní 1', 'Default' => '', 'ReadOnly' => true),
    243                 'InterfaceOther' => array('Type' => 'TNetworkInterface', 'Caption' => 'Rozhraní 2', 'Default' => '', 'ReadOnly' => true),
    244       ),
    245     ));
    246    
     243        'InterfaceOther' => array('Type' => 'TNetworkInterface', 'Caption' => 'Rozhraní 2', 'Default' => '', 'ReadOnly' => true),
     244      ),
     245    ));
     246
    247247    $this->System->FormManager->RegisterClass('NetworkLinkType', array(
    248248      'Title' => 'Typ síťového propojení',
     
    371371    ));
    372372    $this->System->FormManager->RegisterFormType('TNetworkDevice', array(
    373         'Type' => 'Reference',
    374         'Table' => 'NetworkDevice',
    375         'Id' => 'Id',
    376         'Name' => 'Name',
    377         'Filter' => '1',
     373      'Type' => 'Reference',
     374      'Table' => 'NetworkDevice',
     375      'Id' => 'Id',
     376      'Name' => 'Name',
     377      'Filter' => '1',
    378378    ));
    379379    $this->System->FormManager->RegisterFormType('TNetworkDeviceType', array(
    380         'Type' => 'Reference',
    381         'Table' => 'NetworkDeviceType',
    382         'Id' => 'Id',
    383         'Name' => 'Name',
    384         'Filter' => '1',
     380      'Type' => 'Reference',
     381      'Table' => 'NetworkDeviceType',
     382      'Id' => 'Id',
     383      'Name' => 'Name',
     384      'Filter' => '1',
    385385    ));
    386386    $this->System->FormManager->RegisterFormType('TNetworkInterface', array(
    387         'Type' => 'Reference',
    388         'Table' => 'NetworkInterface',
    389         'View' => '(SELECT NetworkInterface.*, CONCAT_WS("-", NetworkDevice.Name, NULLIF(NetworkInterface.Name, "")) AS DeviceName FROM NetworkInterface '.
    390         'LEFT JOIN NetworkDevice ON NetworkDevice.Id = NetworkInterface.Device) AS T',
    391         'Id' => 'Id',
    392         'Name' => 'DeviceName',
    393         'Filter' => '1',
     387      'Type' => 'Reference',
     388      'Table' => 'NetworkInterface',
     389      'View' => '(SELECT NetworkInterface.*, CONCAT_WS("-", NetworkDevice.Name, NULLIF(NetworkInterface.Name, "")) AS DeviceName FROM NetworkInterface '.
     390      'LEFT JOIN NetworkDevice ON NetworkDevice.Id = NetworkInterface.Device) AS T',
     391      'Id' => 'Id',
     392      'Name' => 'DeviceName',
     393      'Filter' => '1',
    394394    ));
    395395    $this->System->FormManager->RegisterFormType('TNetworkInterfaceType', array(
    396         'Type' => 'Reference',
    397         'Table' => 'NetworkInterfaceType',
    398         'Id' => 'Id',
    399         'Name' => 'Name',
    400         'Filter' => '1',
     396      'Type' => 'Reference',
     397      'Table' => 'NetworkInterfaceType',
     398      'Id' => 'Id',
     399      'Name' => 'Name',
     400      'Filter' => '1',
    401401    ));
    402402    $this->System->FormManager->RegisterFormType('TDeviceList', array(
     
    416416    $this->System->FormManager->RegisterFormType('TNetworkLinkType', array(
    417417      'Type' => 'Reference',
    418         'Table' => 'NetworkLinkType',
    419         'Id' => 'Id',
    420         'Name' => 'Name',
    421         'Filter' => '1',
    422     ));   
     418      'Table' => 'NetworkLinkType',
     419      'Id' => 'Id',
     420      'Name' => 'Name',
     421      'Filter' => '1',
     422    ));
    423423    $this->System->FormManager->RegisterFormType('TDeviceAPIType', array(
    424424      'Type' => 'Reference',
    425         'Table' => 'DeviceAPIType',
    426         'Id' => 'Id',
    427         'Name' => 'Name',
    428         'Filter' => '1',
    429     ));   
     425      'Table' => 'DeviceAPIType',
     426      'Id' => 'Id',
     427      'Name' => 'Name',
     428      'Filter' => '1',
     429    ));
    430430    $this->System->FormManager->RegisterFormType('TNetworkInterfaceWirelessListInterface', array(
    431431      'Type' => 'ManyToOne',
     
    445445      'Type' => 'ManyToOne',
    446446      'Table' => 'NetworkLinkUnion',
    447         'Id' => 'Id',
    448         'Ref' => 'Interface',
    449         'Filter' => '1',
     447      'Id' => 'Id',
     448      'Ref' => 'Interface',
     449      'Filter' => '1',
    450450    ));
    451451    $this->System->FormManager->RegisterFormType('TNetworkLinkListInterface1', array(
    452         'Type' => 'ManyToOne',
    453         'Table' => 'NetworkLink',
    454         'Id' => 'Id',
    455         'Ref' => 'Interface1',
    456         'Filter' => '1',
     452      'Type' => 'ManyToOne',
     453      'Table' => 'NetworkLink',
     454      'Id' => 'Id',
     455      'Ref' => 'Interface1',
     456      'Filter' => '1',
    457457    ));
    458458    $this->System->FormManager->RegisterFormType('TNetworkLinkListInterface2', array(
    459         'Type' => 'ManyToOne',
    460         'Table' => 'NetworkLink',
    461         'Id' => 'Id',
    462         'Ref' => 'Interface2',
    463         'Filter' => '1',
     459      'Type' => 'ManyToOne',
     460      'Table' => 'NetworkLink',
     461      'Id' => 'Id',
     462      'Ref' => 'Interface2',
     463      'Filter' => '1',
    464464    ));
    465465    $this->System->FormManager->RegisterFormType('TNetworkInterfaceUpDown', array(
    466         'Type' => 'ManyToOne',
    467         'Table' => 'NetworkInterfaceUpDown',
    468         'Id' => 'Id',
    469         'Ref' => 'Interface',
    470         'Filter' => '1',
    471     ));
    472    
     466      'Type' => 'ManyToOne',
     467      'Table' => 'NetworkInterfaceUpDown',
     468      'Id' => 'Id',
     469      'Ref' => 'Interface',
     470      'Filter' => '1',
     471    ));
     472
    473473  }
    474474
  • trunk/Modules/Network/Subnet.php

    r548 r738  
    1515    $DbResult = $this->Database->query('SELECT COUNT(*) FROM `NetworkSubnet`');
    1616    $DbRow = $DbResult->fetch_row();
    17     $PageList = GetPageList($DbRow[0]);   
     17    $PageList = GetPageList($DbRow[0]);
    1818
    1919    $Output = $PageList['Output'];
    2020    $Output .= '<table class="WideTable" style="font-size: small;">';
    21    
     21
    2222    $TableColumns = array(
    23       array('Name' => 'Name', 'Title' => 'Název'), 
    24       array('Name' => 'AddressRange', 'Title' => 'IP rozsah'), 
    25       array('Name' => 'DHCP', 'Title' => 'Adresa DHCP'), 
    26       array('Name' => 'Gateway', 'Title' => 'Výchozí brána'), 
    27       array('Name' => '', 'Title' => 'Max. adres'), 
    28       array('Name' => '', 'Title' => 'Registrovaných adres'), 
    29       array('Name' => '', 'Title' => 'Využití'), 
    30       array('Name' => 'SubjectName', 'Title' => 'Účastník'), 
     23      array('Name' => 'Name', 'Title' => 'Název'),
     24      array('Name' => 'AddressRange', 'Title' => 'IP rozsah'),
     25      array('Name' => 'DHCP', 'Title' => 'Adresa DHCP'),
     26      array('Name' => 'Gateway', 'Title' => 'Výchozí brána'),
     27      array('Name' => '', 'Title' => 'Max. adres'),
     28      array('Name' => '', 'Title' => 'Registrovaných adres'),
     29      array('Name' => '', 'Title' => 'Využití'),
     30      array('Name' => 'SubjectName', 'Title' => 'Účastník'),
    3131    );
    3232    $Order = GetOrderTableHeader($TableColumns, 'AddressRange', 0);
     
    3434
    3535    $Query = 'SELECT NetworkSubnet.*, Subject.Name AS SubjectName FROM NetworkSubnet LEFT JOIN Member ON Member.Id = NetworkSubnet.Member LEFT JOIN Subject ON Subject.Id = Member.Subject '.$Order['SQL'].$PageList['SQLLimit'];
    36    
     36
    3737    $DbResult = $this->Database->query($Query);
    38     while($Subnet = $DbResult->fetch_assoc()) 
    39     { 
     38    while($Subnet = $DbResult->fetch_assoc())
     39    {
    4040      $DbResult2 = $this->Database->query('SELECT COUNT(*) FROM NetworkInterface WHERE CompareNetworkPrefix(INET_ATON("'.$Subnet['AddressRange'].'"), INET_ATON(LocalIP), '.$Subnet['Mask'].')');
    4141      $DbRow = $DbResult2->fetch_row();
  • trunk/Modules/Network/UserHosts.php

    r558 r738  
    1414  {
    1515    global $Config;
    16    
     16
    1717    if($this->System->User->User['Id'] == '') return($this->SystemMessage('Nepovolený přístup', 'Nemáte oprávnění pro tuto operaci'));
    1818    $Output = '<div align="center" style="font-size: small;"><table class="WideTable">';
     
    3636          NotBlank($Interface['ExternalIP']).'</td><td>'.
    3737          NotBlank($Interface['MAC']).'</td><td>&nbsp;</td><td>&nbsp;</td></tr>';
    38       }     
     38      }
    3939    }
    4040    $Output .= '</table></div>';
  • trunk/Modules/NetworkConfig/Generate.php

    r621 r738  
    1919    $Output = array();
    2020    foreach($ExecuteParts as $Command)
    21       if($Command != '') 
     21      if($Command != '')
    2222      {
    23         exec($Command, $Output);       
     23        exec($Command, $Output);
    2424        //echo($Command."\n");
    2525        //sleep(5);
  • trunk/Modules/NetworkConfig/NetworkConfig.php

    r721 r738  
    1313    $this->Dependencies = array('Network');
    1414  }
    15  
     15
    1616  function DoInstall()
    1717  {
    1818  }
    19  
     19
    2020  function DoUnInstall()
    2121  {
     
    4848      ),
    4949    ));
    50    
     50
    5151  }
    5252}
  • trunk/Modules/NetworkConfigLinux/Generators/DHCP.php

    r548 r738  
    3636    fputs($File, "  host ".$Data."\t{ fixed-address ".$Row['IP'].";\thardware ethernet ".$Row['MAC']."; }\n");
    3737  }
    38  
     38
    3939  fputs($File, "}\n\n");
    4040}
  • trunk/Modules/NetworkConfigLinux/Generators/DNS.php

    r699 r738  
    137137    if(array_key_exists('IPv6', $Host) and ($Host['IPv6'] != ''))
    138138    {
    139         $Addr = new NetworkAddressIPv6();
    140         $Addr->AddressFromString($Host['IPv6']);
    141         $Octets = $Addr->GetOctets();
    142         $Octets = array_slice($Octets, 0, (128 - $Prefix) / 4);
    143         $Octets = implode('.', $Octets);
     139      $Addr = new NetworkAddressIPv6();
     140      $Addr->AddressFromString($Host['IPv6']);
     141      $Octets = $Addr->GetOctets();
     142      $Octets = array_slice($Octets, 0, (128 - $Prefix) / 4);
     143      $Octets = implode('.', $Octets);
    144144
    145145      $Host['Name'] = strtolower($Host['Name']);
     
    175175  'Alias' => array(),
    176176  'Network' => array('10.145.64', '10.145.65', '10.145.66', '10.145.67', '10.145.68',
    177         '10.145.69', '10.145.70', '10.145.71', '77.92.221', '172.16.0', '172.16.1'),
    178         'IPv6Network' => array('2a00:e580:244::/48'),
     177    '10.145.69', '10.145.70', '10.145.71', '77.92.221', '172.16.0', '172.16.1'),
     178  'IPv6Network' => array('2a00:e580:244::/48'),
    179179);
    180180
     
    237237  'Alias' => array(),
    238238  'Network' => array('81.2.194', '193.86.238', '212.111.4', '77.92.221'),
    239         'IPv6Network' => array('2a00:e580:244::/48'),
     239  'IPv6Network' => array('2a00:e580:244::/48'),
    240240);
    241241
     
    278278  'Network' => array('10.145.64', '10.145.65', '10.145.66', '10.145.67',
    279279    '10.145.68', '10.145.69', '10.145.70', '10.145.71'),
    280         'IPv6Network' => array(),
     280  'IPv6Network' => array(),
    281281);
    282282
     
    317317  'Alias' => array(),
    318318  'Network' => array('10.145.64', '10.145.65', '10.145.66', '10.145.67',
    319         '10.145.68', '10.145.69', '10.145.70', '10.145.71'),
    320         'IPv6Network' => array(),
     319    '10.145.68', '10.145.69', '10.145.70', '10.145.71'),
     320  'IPv6Network' => array(),
    321321);
    322322
  • trunk/Modules/NetworkConfigLinux/Generators/IPTables.php

    r548 r738  
    1313/*
    1414// Blocking according IP address
    15 $DbResult = $Database->select('users', '*', 'inet = 0'); 
     15$DbResult = $Database->select('users', '*', 'inet = 0');
    1616while($User = $DbResult->fetch_array())
    1717{
     
    4848      //    else exec('/sbin/iptables -t nat -A Block -m mac --mac-source '.$Row['MAC']." -j Local");
    4949    } else {
    50       if($Row['vpn'] == 0) 
     50      if($Row['vpn'] == 0)
    5151      {
    52         $CZFreeLocalIP = $Row['IP'];
     52  $CZFreeLocalIP = $Row['IP'];
    5353        //echo($Row['external_ip']."\n");
    54         //if($Row['name'] == 'TBC')
    55         //{
     54  //if($Row['name'] == 'TBC')
     55  //{
    5656        //  exec('/sbin/iptables -t nat -A PreroutingDNAT -m tcp -p tcp --dport 3724 -d '.$Row['external_ip'].' -j DNAT --to-destination '.$Row['IP'].':3725');
    5757        //  exec('/sbin/iptables -t nat -A POSTROUTING -m tcp -p tcp -s '.$Row['IP'].' --sport 3725 -o '.$InetInterface.' -j SNAT --to-source '.$Row['external_ip'].':3724');
    58         //}
     58  //}
    5959        if(strtolower($Row['name']) != 'gate')
    60         {
    61           if($Row['external_ip'] != '')
     60  {
     61      if($Row['external_ip'] != '')
    6262          {
    6363            echo($Row['name'].'='.$Row['external_ip']."\n");
    64            
     64
    6565            exec('/sbin/iptables -t nat -A PreroutingDNAT -i '.$InetInterface.' -d '.$Row['external_ip'].' -j DNAT --to-destination '.$Row['IP']);
    6666            exec('/sbin/iptables -t nat -A PreroutingDNAT -i '.$InetInterface.' -d '.$Row['external_ip'].' -j ACCEPT');
    6767            exec('/sbin/iptables -t nat -A POSTROUTING -s '.$Row['IP'].' -o '.$InetInterface.' -j SNAT --to-source '.$Row['external_ip']);
    68           }
     68      }
    6969          //exec('/sbin/iptables -t nat -A Block -m mac --mac-source '.$Row['MAC']." -j Proxy");
    70         }
     70  }
    7171      }
    7272      else
    7373      {
    74         $CZFreeLocalIP = $Row['external_ip'];
     74  $CZFreeLocalIP = $Row['external_ip'];
    7575 //echo('vpn');
    7676        //exec('/sbin/iptables -t nat -A PreroutingDNAT -s '.$Row['IP'].' -p udp -m udp --dport 55556 -j DROP');
     
    7979
    8080        //if($Row['vpn'] == 1)
    81         //{
    82           //exec('/sbin/iptables -t nat -A Block -m mac --mac-source '.$Row['MAC']." -j Local");
     81  //{
     82    //exec('/sbin/iptables -t nat -A Block -m mac --mac-source '.$Row['MAC']." -j Local");
    8383        //} else if($Row['vpn'] == 2) exec('/sbin/iptables -t nat -A Block -m mac --mac-source '.$Row['MAC']." -j Proxy");
    8484      }
  • trunk/Modules/NetworkConfigLinux/Generators/NAT.php

    r548 r738  
    1313/*
    1414// Blocking according IP address
    15 $DbResult = $Database->select('users', '*', 'inet = 0'); 
     15$DbResult = $Database->select('users', '*', 'inet = 0');
    1616while($User = $DbResult->fetch_array())
    1717{
     
    4848      //    else exec('/sbin/iptables -t nat -A Block -m mac --mac-source '.$Row['MAC']." -j Local");
    4949    } else {
    50       if($Row['vpn'] == 0) 
     50      if($Row['vpn'] == 0)
    5151      {
    52         $CZFreeLocalIP = $Row['IP'];
     52  $CZFreeLocalIP = $Row['IP'];
    5353        //echo($Row['external_ip']."\n");
    54         //if($Row['name'] == 'TBC')
    55         //{
     54  //if($Row['name'] == 'TBC')
     55  //{
    5656        //  exec('/sbin/iptables -t nat -A PreroutingDNAT -m tcp -p tcp --dport 3724 -d '.$Row['external_ip'].' -j DNAT --to-destination '.$Row['IP'].':3725');
    5757        //  exec('/sbin/iptables -t nat -A POSTROUTING -m tcp -p tcp -s '.$Row['IP'].' --sport 3725 -o eth1 -j SNAT --to-source '.$Row['external_ip'].':3724');
    58         //}
     58  //}
    5959        if(strtolower($Row['name']) != 'centrala')
    60         {
    61           if($Row['external_ip'] != '')
     60  {
     61      if($Row['external_ip'] != '')
    6262          {
    6363            echo($Row['name'].'='.$Row['external_ip']."\n");
    64            
     64
    6565            exec('/sbin/iptables -t nat -A PreroutingDNAT -i eth1 -d '.$Row['external_ip'].' -j DNAT --to-destination '.$Row['IP']);
    6666            exec('/sbin/iptables -t nat -A PreroutingDNAT -i eth1 -d '.$Row['external_ip'].' -j ACCEPT');
    6767            exec('/sbin/iptables -t nat -A POSTROUTING -s '.$Row['IP'].' -o eth1 -j SNAT --to-source '.$Row['external_ip']);
    68           }
     68      }
    6969          //exec('/sbin/iptables -t nat -A Block -m mac --mac-source '.$Row['MAC']." -j Proxy");
    70         }
     70  }
    7171      }
    7272      else
    7373      {
    74         $CZFreeLocalIP = $Row['external_ip'];
     74  $CZFreeLocalIP = $Row['external_ip'];
    7575 //echo('vpn');
    7676        //exec('/sbin/iptables -t nat -A PreroutingDNAT -s '.$Row['IP'].' -p udp -m udp --dport 55556 -j DROP');
     
    7979
    8080        //if($Row['vpn'] == 1)
    81         //{
    82           //exec('/sbin/iptables -t nat -A Block -m mac --mac-source '.$Row['MAC']." -j Local");
     81  //{
     82    //exec('/sbin/iptables -t nat -A Block -m mac --mac-source '.$Row['MAC']." -j Local");
    8383        //} else if($Row['vpn'] == 2) exec('/sbin/iptables -t nat -A Block -m mac --mac-source '.$Row['MAC']." -j Proxy");
    8484      }
  • trunk/Modules/NetworkConfigLinux/Generators/TrafficShaping.php

    r548 r738  
    1010// Generate traffic shaping rules
    1111//$TotalMaxSpeedIn = 4048; //$RealMaxSpeed; //1536;
    12 //TotalMaxSpeedOut = 3048; //$RealMaxSpeed; //1536; 
     12//TotalMaxSpeedOut = 3048; //$RealMaxSpeed; //1536;
    1313//$UsersMaxSpeedIn = 1900; //$MaxSpeed;
    1414//$UsersMaxSpeedOut = 1900; //$MaxSpeed;
     
    4545
    4646  $FreeInetClass = 2;
    47  
     47
    4848  // In going traffic
    4949  fputs($File, "/sbin/tc qdisc del dev ".$InInterface." root\n");
    5050  if($Enabled)
    51   { 
     51  {
    5252    fputs($File, "/sbin/tc qdisc add dev ".$InInterface." root handle 1:0 htb default 2\n");
    5353    fputs($FileClassInfo, "1:1 Základní\n");
     
    6868    fputs($File, "/sbin/tc qdisc add dev ".$OutInterface." parent 1:".$FreeInetClass." handle ".$FreeInetClass.": sfq perturb 10\n");
    6969  }
    70  
     70
    7171  if(!$Enabled) die("Traffic shaping disabled\n");
    7272
    73   if($ClassesEnabled) 
     73  if($ClassesEnabled)
    7474  {
    7575  $ClassId = 3;
     
    9898  //$SpeedOut = round($UsersMaxSpeedOut / $InetUserCount);
    9999  $Prio = 1;
    100  
    101  
     100
     101
    102102  $AllUsersClassId = $ClassId;
    103103  $ClassId = $ClassId + 1;
     
    123123  fputs($FileClassInfo, '1:'.$TorrentClassId." Torrent\n");
    124124
    125   $DbResult = $Database->select('users', '*, CONCAT(second_name, " ", first_name) as fullname', '(inet=1)'); 
     125  $DbResult = $Database->select('users', '*, CONCAT(second_name, " ", first_name) as fullname', '(inet=1)');
    126126  while($User = $DbResult->fetch_array())
    127127  {
     
    144144
    145145    //echo('User class id: '.$UserClassId."\n");
    146  
     146
    147147    $DbResult2 = $Database->select('hosts', 'COUNT(*)', "block=0 AND MAC!='' AND user=".$User['id']);
    148148    $Row = $DbResult2->fetch_array();
     
    150150    $HostSpeedIn = round($SpeedIn / $HostCount);
    151151    $HostSpeedOut = round($SpeedOut / $HostCount);
    152  
     152
    153153    $DbResult2 = $Database->select('hosts','*',"block=0 AND MAC!='' AND user=".$User['id']);
    154154    while($Host = $DbResult2->fetch_array())
     
    164164        $Prio = 1;
    165165        if($Host['vpn'] == 1)
    166               {
    167                 if($Host['external_ip'] != '') $Host['IP'] = $Host['external_ip'];
    168                 else $Host['IP'] = ToVpnIp($Host);
    169               }
    170        
    171               //if($Host['name'] == 'TERMINAL') $SpeedDivider = 0.5;
    172                 //else
     166        {
     167          if($Host['external_ip'] != '') $Host['IP'] = $Host['external_ip'];
     168          else $Host['IP'] = ToVpnIp($Host);
     169        }
     170
     171        //if($Host['name'] == 'TERMINAL') $SpeedDivider = 0.5;
     172          //else
    173173        $SpeedDivider = 1;
    174174
    175               if($Host['name'] == 'centrala')
    176               {
    177                 $Host['IP'] = $Host['external_ip'];
    178                 $TableOut = 'OUTPUT';
    179                 $TableIn = 'INPUT';
    180                } else
     175        if($Host['name'] == 'centrala')
     176        {
     177          $Host['IP'] = $Host['external_ip'];
     178          $TableOut = 'OUTPUT';
     179          $TableIn = 'INPUT';
     180         } else
    181181         {
    182                  $TableOut = 'FORWARD';
    183                  $TableIn = 'FORWARD';
    184                }
    185               //if($Row['name'] == 'TERMINAL2') $Prio = 0;
    186         //      if($Row['name'] = 'TERMINAL2') $Prio = 0;
    187         if($Host['name'] == 'voip-hajda') $Protocol = ' -p tcp'; 
    188           else $Protocol = '';
    189         //      if($Host['name'] == 'KARLOS') $UserMaxSpeedIn = 128000;
     182           $TableOut = 'FORWARD';
     183           $TableIn = 'FORWARD';
     184         }
     185        //if($Row['name'] == 'TERMINAL2') $Prio = 0;
     186        //  if($Row['name'] = 'TERMINAL2') $Prio = 0;
     187        if($Host['name'] == 'voip-hajda') $Protocol = ' -p tcp';
     188        else $Protocol = '';
     189        //  if($Host['name'] == 'KARLOS') $UserMaxSpeedIn = 128000;
    190190        /*
    191 if($Host['name'] == 'GAME') 
    192         {
    193           exec('/sbin/iptables -t mangle -F game-server');       
    194                 $TableOut = 'game-server';
    195                 $TableIn = 'game-server';
    196         }*/
     191if($Host['name'] == 'GAME')
     192        {
     193          exec('/sbin/iptables -t mangle -F game-server');
     194          $TableOut = 'game-server';
     195          $TableIn = 'game-server';
     196        }*/
    197197        //if($Host['name'] == 'TBC') continue;
    198198
    199199        // In going traffic
    200         //exec('/sbin/iptables -t mangle -A '.$TableIn.' -i eth1 -d '.$Host['IP'].$Protocol." -j MARK --set-mark ".$HostClassId); 
    201               fputs($File, "/sbin/tc class add dev ".$InInterface." parent 1:".$UserClassId." classid 1:".$HostClassId." htb rate ".$HostSpeedIn."bit ceil ".$UserMaxSpeedIn."bit prio ".$Prio." quantum ".$Quantum."\n");
    202               fputs($File, "/sbin/tc qdisc add dev ".$InInterface." parent 1:".$HostClassId." handle ".$HostClassId.":0 sfq perturb 10\n");
    203             //fputs($File, "/sbin/tc filter add dev ".$InInterface." parent 1:0 protocol ip handle ".$HostClassId." fw flowid 1:".$UserClassId."\n");
    204             fputs($File, "/sbin/tc filter add dev ".$InInterface." parent 1:0 protocol ip prio 1 u32 match ip dst ".$Host['external_ip']."/32 flowid 1:".$HostClassId."\n");
    205        
     200        //exec('/sbin/iptables -t mangle -A '.$TableIn.' -i eth1 -d '.$Host['IP'].$Protocol." -j MARK --set-mark ".$HostClassId);
     201        fputs($File, "/sbin/tc class add dev ".$InInterface." parent 1:".$UserClassId." classid 1:".$HostClassId." htb rate ".$HostSpeedIn."bit ceil ".$UserMaxSpeedIn."bit prio ".$Prio." quantum ".$Quantum."\n");
     202        fputs($File, "/sbin/tc qdisc add dev ".$InInterface." parent 1:".$HostClassId." handle ".$HostClassId.":0 sfq perturb 10\n");
     203        //fputs($File, "/sbin/tc filter add dev ".$InInterface." parent 1:0 protocol ip handle ".$HostClassId." fw flowid 1:".$UserClassId."\n");
     204        fputs($File, "/sbin/tc filter add dev ".$InInterface." parent 1:0 protocol ip prio 1 u32 match ip dst ".$Host['external_ip']."/32 flowid 1:".$HostClassId."\n");
     205
    206206        // Out going traffic
    207207        //exec('/sbin/iptables -t mangle -A '.$TableOut.' -o eth1 -s '.$Host['IP'].$Protocol." -j MARK --set-mark ".$HostClassId);
    208         fputs($File, "/sbin/tc class add dev ".$OutInterface." parent 1:".$UserClassId." classid 1:".$HostClassId." htb rate ".$HostSpeedOut."bit ceil ".$UserMaxSpeedOut."bit prio ".$Prio." quantum ".$Quantum."\n");
    209               fputs($File, "/sbin/tc qdisc add dev ".$OutInterface." parent 1:".$HostClassId." handle ".$HostClassId.":0 sfq perturb 10\n");
    210               //fputs($File, "/sbin/tc filter add dev ".$OutInterface." parent 1:0 protocol ip handle ".$HostClassId." fw flowid 1:".$UserClassId."\n");
    211               fputs($File, "/sbin/tc filter add dev ".$OutInterface." parent 1:0 protocol ip prio 1 u32 match ip src ".$Host['external_ip']."/32 flowid 1:".$HostClassId."\n");
    212                //echo($Row['id'].',');
     208        fputs($File, "/sbin/tc class add dev ".$OutInterface." parent 1:".$UserClassId." classid 1:".$HostClassId." htb rate ".$HostSpeedOut."bit ceil ".$UserMaxSpeedOut."bit prio ".$Prio." quantum ".$Quantum."\n");
     209        fputs($File, "/sbin/tc qdisc add dev ".$OutInterface." parent 1:".$HostClassId." handle ".$HostClassId.":0 sfq perturb 10\n");
     210        //fputs($File, "/sbin/tc filter add dev ".$OutInterface." parent 1:0 protocol ip handle ".$HostClassId." fw flowid 1:".$UserClassId."\n");
     211        fputs($File, "/sbin/tc filter add dev ".$OutInterface." parent 1:0 protocol ip prio 1 u32 match ip src ".$Host['external_ip']."/32 flowid 1:".$HostClassId."\n");
     212         //echo($Row['id'].',');
    213213      }
    214214      // Free inet
    215215      if($Tarify[$User['inet_tarif_now']]['group_id'] == 3)
    216216      {
    217         //exec('/sbin/iptables -t mangle -A '.$TableIn.' -i eth1 -d '.$Host['IP'].$Protocol." -j MARK --set-mark ".$FreeInetClass); 
     217        //exec('/sbin/iptables -t mangle -A '.$TableIn.' -i eth1 -d '.$Host['IP'].$Protocol." -j MARK --set-mark ".$FreeInetClass);
    218218        //exec('/sbin/iptables -t mangle -A '.$TableOut.' -o eth1 -s '.$Host['IP'].$Protocol." -j MARK --set-mark ".$FreeInetClass);
    219219      }
    220220      // VoIP devices
    221221/*
    222       if(($Host['name'] == 'HAJDA-VOIP') || ($Host['name'] == 'NAVRATIL-VOIP')) 
     222      if(($Host['name'] == 'HAJDA-VOIP') || ($Host['name'] == 'NAVRATIL-VOIP'))
    223223      {
    224224        exec('/sbin/iptables -t mangle -A '.$TableIn." -i eth1 -d ".$Host['IP']." -p udp -j MARK --set-mark ".$VoipClassId);
    225225        exec('/sbin/iptables -t mangle -A '.$TableOut." -o eth1 -s ".$Host['IP']." -p udp -j MARK --set-mark ".$VoipClassId);
    226       } else 
     226      } else
    227227      if($Host['name'] == 'GAME')
    228228      {
    229         exec('/sbin/iptables -t mangle -A FORWARD -o eth1 -s '.$Host['IP']." -j game-server"); 
    230         exec('/sbin/iptables -t mangle -A FORWARD -i eth1 -d '.$Host['IP']." -j game-server"); 
    231    
     229        exec('/sbin/iptables -t mangle -A FORWARD -o eth1 -s '.$Host['IP']." -j game-server");
     230        exec('/sbin/iptables -t mangle -A FORWARD -i eth1 -d '.$Host['IP']." -j game-server");
     231
    232232        exec('/sbin/iptables -t mangle -A game-server -o eth1 -s '.$Host['IP']." -j MARK --set-mark ".$TorrentClassId);
    233233        exec('/sbin/iptables -t mangle -A game-server -i eth1 -d '.$Host['IP']." -j MARK --set-mark ".$TorrentClassId);
     
    237237
    238238        // Local services
    239               exec('/sbin/iptables -t mangle -A game-server -o eth1 -s '.$Host['IP']." -p icmp -j MARK --set-mark ".$HostClassId); // ICMP
     239        exec('/sbin/iptables -t mangle -A game-server -o eth1 -s '.$Host['IP']." -p icmp -j MARK --set-mark ".$HostClassId); // ICMP
    240240        exec('/sbin/iptables -t mangle -A game-server -i eth1 -d '.$Host['IP']." -p icmp -j MARK --set-mark ".$HostClassId);
    241241        exec('/sbin/iptables -t mangle -A game-server -o eth1 -s '.$Host['IP']." -p tcp --sport 6969 -j MARK --set-mark ".$HostClassId); // web torrent
    242242        exec('/sbin/iptables -t mangle -A game-server -i eth1 -d '.$Host['IP']." -p tcp --dport 6969 -j MARK --set-mark ".$HostClassId);
    243243        exec('/sbin/iptables -t mangle -A game-server -o eth1 -s '.$Host['IP']." -p tcp --sport 80 -j MARK --set-mark ".$HostClassId);   // web
    244         exec('/sbin/iptables -t mangle -A game-server -i eth1 -d '.$Host['IP']." -p tcp --dport 80 -j MARK --set-mark ".$HostClassId); 
     244        exec('/sbin/iptables -t mangle -A game-server -i eth1 -d '.$Host['IP']." -p tcp --dport 80 -j MARK --set-mark ".$HostClassId);
    245245        exec('/sbin/iptables -t mangle -A game-server -o eth1 -s '.$Host['IP']." -p tcp --sport 21 -j MARK --set-mark ".$HostClassId);    // FTP
    246246        exec('/sbin/iptables -t mangle -A game-server -i eth1 -d '.$Host['IP']." -p tcp --dport 21 -j MARK --set-mark ".$HostClassId);
     
    252252        exec('/sbin/iptables -t mangle -A game-server -i eth1 -d '.$Host['IP']." -p tcp --dport 22 -j MARK --set-mark ".$HostClassId);
    253253        exec('/sbin/iptables -t mangle -A game-server -o eth1 -s '.$Host['IP']." -p tcp --sport 443 -j MARK --set-mark ".$HostClassId);   // https
    254               exec('/sbin/iptables -t mangle -A game-server -i eth1 -d '.$Host['IP']." -p tcp --dport 443 -j MARK --set-mark ".$HostClassId);
     254        exec('/sbin/iptables -t mangle -A game-server -i eth1 -d '.$Host['IP']." -p tcp --dport 443 -j MARK --set-mark ".$HostClassId);
    255255        exec('/sbin/iptables -t mangle -A game-server -o eth1 -s '.$Host['IP']." -p tcp --sport 27015 -j MARK --set-mark ".$HostClassId); // Counter Strike
    256256        exec('/sbin/iptables -t mangle -A game-server -i eth1 -d '.$Host['IP']." -p tcp --dport 27015 -j MARK --set-mark ".$HostClassId);
     
    259259        exec('/sbin/iptables -t mangle -A game-server -o eth1 -s '.$Host['IP']." -p tcp --sport 5906 -j MARK --set-mark ".$HostClassId);  // VNC
    260260        exec('/sbin/iptables -t mangle -A game-server -i eth1 -d '.$Host['IP']." -p tcp --dport 5906 -j MARK --set-mark ".$HostClassId);
    261        
    262         // Remote services
     261
     262  // Remote services
    263263        exec('/sbin/iptables -t mangle -A game-server -o eth1 -s '.$Host['IP']." -p tcp --dport 443 -j MARK --set-mark ".$HostClassId);   // https
    264         exec('/sbin/iptables -t mangle -A game-server -i eth1 -d '.$Host['IP']." -p tcp --sport 443 -j MARK --set-mark ".$HostClassId);
     264  exec('/sbin/iptables -t mangle -A game-server -i eth1 -d '.$Host['IP']." -p tcp --sport 443 -j MARK --set-mark ".$HostClassId);
    265265        exec('/sbin/iptables -t mangle -A game-server -o eth1 -s '.$Host['IP']." -p tcp --dport 80 -j MARK --set-mark ".$HostClassId);   // http
    266         exec('/sbin/iptables -t mangle -A game-server -i eth1 -d '.$Host['IP']." -p tcp --sport 80 -j MARK --set-mark ".$HostClassId);
    267        
     266  exec('/sbin/iptables -t mangle -A game-server -i eth1 -d '.$Host['IP']." -p tcp --sport 80 -j MARK --set-mark ".$HostClassId);
     267
    268268      }
    269269*/
  • trunk/Modules/NetworkConfigLinux/NetworkConfigLinux.php

    r586 r738  
    1313    $this->Dependencies = array('NetworkConfig');
    1414  }
    15  
     15
    1616  function DoInstall()
    1717  {
    1818  }
    19  
     19
    2020  function DoUnInstall()
    2121  {
  • trunk/Modules/NetworkConfigRouterOS/Generators/AddressPortability.php

    r548 r738  
    66$Path = array('ip', 'dhcp-server', 'lease');
    77
    8 $Host = array(); 
     8$Host = array();
    99
    1010function ConvertExpireTime2($Time)
  • trunk/Modules/NetworkConfigRouterOS/Generators/Common.php

    r548 r738  
    66{
    77  global $Database;
    8  
     8
    99  $DbResult = $Database->query('SELECT `Id` FROM `NetworkMark` WHERE `Comment`="'.$Comment.'"');
    1010  if($DbResult->num_rows > 0)
     
    1616    $DbResult = $Database->query('INSERT INTO `NetworkMark` (`Comment`) VALUES ("'.$Comment.'")');
    1717    return($Database->insert_id);
    18   } 
     18  }
    1919}
    2020
     
    2222{
    2323  global $Database;
    24  
     24
    2525  $DbResult = $Database->query('SELECT `Id` FROM `NetworkMangleSubgroup` WHERE `AddressRange`="'.$AddressRange.'"');
    2626  if($DbResult->num_rows > 0)
     
    3232    $DbResult = $Database->query('INSERT INTO `NetworkMangleSubgroup` (`AddressRange`) VALUES ("'.$AddressRange.'")');
    3333    return($Database->insert_id);
    34   } 
     34  }
    3535}
    3636
     
    3838{
    3939  global $Config;
    40  
     40
    4141  $Found = false;
    4242  foreach($Tree['Items'] as $Index => $Node)
     
    5050  if($Found == false)
    5151  {
    52     if($InterSubnets and ($Tree['Address']->Prefix < $Config['MainRouter']['MangleRuleSubgroupMinPrefix']) and 
     52    if($InterSubnets and ($Tree['Address']->Prefix < $Config['MainRouter']['MangleRuleSubgroupMinPrefix']) and
    5353    ($Address->Prefix > ($Tree['Address']->Prefix + 1)))
    5454    {
     
    6161    } else
    6262    {
    63      
     63
    6464      $NewNode = array('Address' => $Address, 'Name' => $Name, 'Items' => array(), 'ForceMark' => $ForceMark);
    65      
     65
    6666      // Should be existed items placed under new node?
    6767      $Found = false;
    6868      foreach($Tree['Items'] as $Index => $Node)
    6969      {
    70         if(($Node['Address']->Address == $NewNode['Address']->Address) and 
    71         ($Node['Address']->Prefix == $NewNode['Address']->Prefix)) $Found = true;       
    72        
     70        if(($Node['Address']->Address == $NewNode['Address']->Address) and
     71        ($Node['Address']->Prefix == $NewNode['Address']->Prefix)) $Found = true;
     72
    7373        //echo($Index.',');
    7474        if($Address->Contain($Node['Address']))
     
    7878        }
    7979      }
    80       if($Found == false) $Tree['Items'][] = $NewNode;     
     80      if($Found == false) $Tree['Items'][] = $NewNode;
    8181    }
    8282  }
     
    8989  {
    9090    ShowSubnetNode($Item, $Indent + 1);
    91   } 
     91  }
    9292}
    9393
  • trunk/Modules/NetworkConfigRouterOS/Generators/DHCP.php

    r617 r738  
    2929    $Items[] = array('mac-address' => $Interface['MAC'], 'address' => $Interface['LocalIP'], 'server' => $Server, 'comment' => $Name);
    3030  }
    31  
    32   print_r($Routerboard->ListUpdate($Path, array('mac-address', 'address', 'server', 'comment'), $Items, array('server' => $Server, 'dynamic' => 'no')));   
     31
     32  print_r($Routerboard->ListUpdate($Path, array('mac-address', 'address', 'server', 'comment'), $Items, array('server' => $Server, 'dynamic' => 'no')));
    3333  echo("\n");
    3434}
  • trunk/Modules/NetworkConfigRouterOS/Generators/FirewallFilter.php

    r617 r738  
    2424
    2525// Inet traffic groups
    26 //$Items[] = array('chain' => 'forward', 'out-interface' => $InetInterface, 'action' => 'jump', 'jump-target' => 'inet-out', 'comment' => 'inet-out');     
     26//$Items[] = array('chain' => 'forward', 'out-interface' => $InetInterface, 'action' => 'jump', 'jump-target' => 'inet-out', 'comment' => 'inet-out');
    2727//$Items[] = array('chain' => 'forward', 'in-interface' => $InetInterface, 'action' => 'jump', 'jump-target' => 'inet-in', 'comment' => 'inet-in');
    2828
     
    6363  $DbResult2 = $System->Database->select('NetworkSubnet', '*', 'Member='.$Member['Id']);
    6464  while($Subnet = $DbResult2->fetch_assoc())
    65   {   
     65  {
    6666    $Subnet['Name'] = RouterOSIdent('subnet-'.$Subnet['Name']);
    6767    echo($Subnet['Name'].'('.$Subnet['AddressRange'].'/'.$Subnet['Mask'].'), ');
     
    7575        else $Src = $Subnet['AddressRange'].'/'.$Subnet['Mask'];
    7676      $Items[] = array('chain' => 'forward', 'out-interface' => $InetInterface, 'src-address' => $Src, 'action' => 'drop','comment' => $Subnet['Name'].'-out-drop');
    77    
     77
    7878      $NewAddress = new NetworkAddressIPv4();
    7979      $NewAddress->AddressFromString($Subnet['AddressRange']);
  • trunk/Modules/NetworkConfigRouterOS/Generators/FirewallMangle.php

    r735 r738  
    3030  $NewAddress->AddressFromString($Subnet['AddressRange']);
    3131  $NewAddress->Prefix = $Subnet['Mask'];
    32   InsertToAddressTree($AddressTree, $NewAddress, 'subnet-'.RouterOSIdent($Subnet['Name'])); 
     32  InsertToAddressTree($AddressTree, $NewAddress, 'subnet-'.RouterOSIdent($Subnet['Name']));
    3333}
    3434
     
    5858    }
    5959  }
    60  
     60
    6161  $DbResult2 = $System->Database->select('NetworkSubnet', '*', '`Member`='.$Member['Id']);
    6262  while($Subnet = $DbResult2->fetch_assoc())
     
    8080{
    8181  global $InetInterface, $ItemsFirewall;
    82  
     82
    8383  foreach($Node['Items'] as $Index => $Item)
    8484  {
     
    8989      $Address = $Item['Address']->AddressToString();
    9090      if($Item['Address']->Prefix != 32) $Address .= '/'.$Item['Address']->Prefix;
    91      
     91
    9292      $PacketMark = GetMarkByComment($Item['Name'].'-out');
    9393      $ItemsFirewall[] = array('chain' => 'inet-'.$ParentSubnetId.'-out', 'src-address' => $Address, 'out-interface' =>  $InetInterface, 'action' => 'mark-packet', 'new-packet-mark' => $PacketMark, 'passthrough' => 'no', 'comment' => $Item['Name'].'-out');
     
    100100      $SubnetId = GetSubgroupByRange($Item['Address']->AddressToString().'/'.$Item['Address']->Prefix);
    101101      $PacketMark = GetMarkByComment($Item['Name'].'-out');
    102      
     102
    103103      $Address = $Item['Address']->AddressToString();
    104104      if($Item['Address']->Prefix != 32) $Address .= '/'.$Item['Address']->Prefix;
    105      
    106       $ItemsFirewall[] = array('chain' => 'inet-'.$ParentSubnetId.'-out', 'src-address' => $Address, 'out-interface' => $InetInterface, 'action' => 'jump', 'jump-target' => 'inet-'.$SubnetId.'-out', 'comment' => $Item['Name'].'-out');   
    107       $ItemsFirewall[] = array('chain' => 'inet-'.$ParentSubnetId.'-in', 'dst-address' => $Address, 'in-interface' => $InetInterface, 'action' => 'jump', 'jump-target' => 'inet-'.$SubnetId.'-in', 'comment' => $Item['Name'].'-in');   
    108      
    109       ProcessNode($Item);     
    110     }   
     105
     106      $ItemsFirewall[] = array('chain' => 'inet-'.$ParentSubnetId.'-out', 'src-address' => $Address, 'out-interface' => $InetInterface, 'action' => 'jump', 'jump-target' => 'inet-'.$SubnetId.'-out', 'comment' => $Item['Name'].'-out');
     107      $ItemsFirewall[] = array('chain' => 'inet-'.$ParentSubnetId.'-in', 'dst-address' => $Address, 'in-interface' => $InetInterface, 'action' => 'jump', 'jump-target' => 'inet-'.$SubnetId.'-in', 'comment' => $Item['Name'].'-in');
     108
     109      ProcessNode($Item);
     110    }
    111111  }
    112112  if($Node['ForceMark'] == true)
     
    133133// Slow free internet
    134134$PacketMark = GetMarkByComment('free-out');
    135 $ItemsFirewall[] = array('chain' => 'inet-1-out', 'out-interface' => $InetInterface, 
     135$ItemsFirewall[] = array('chain' => 'inet-1-out', 'out-interface' => $InetInterface,
    136136  'action' => 'mark-packet', 'new-packet-mark' => $PacketMark, 'comment' => 'free-out', 'passthrough' => 'yes');
    137137$PacketMark = GetMarkByComment('free-in');
    138 $ItemsFirewall[] = array('chain' => 'inet-1-in', 'in-interface' => $InetInterface, 
    139         'action' => 'mark-packet', 'new-packet-mark' => $PacketMark, 'comment' => 'free-in', 'passthrough' => 'no');
     138$ItemsFirewall[] = array('chain' => 'inet-1-in', 'in-interface' => $InetInterface,
     139  'action' => 'mark-packet', 'new-packet-mark' => $PacketMark, 'comment' => 'free-in', 'passthrough' => 'no');
    140140// Unregistred clients add to address list
    141 $ItemsFirewall[] = array('chain' => 'inet-1-out', 'out-interface' => $InetInterface, 'src-address' => '10.145.0.0/16', 
    142         'action' => 'add-src-to-address-list', 'address-list' => 'unregistred', 'timeout' => '1d',
    143         'comment' => 'unregistred-clients');
     141$ItemsFirewall[] = array('chain' => 'inet-1-out', 'out-interface' => $InetInterface, 'src-address' => '10.145.0.0/16',
     142  'action' => 'add-src-to-address-list', 'address-list' => 'unregistred', 'timeout' => '1d',
     143  'comment' => 'unregistred-clients');
    144144
    145145//print_r($ItemsFirewall);
  • trunk/Modules/NetworkConfigRouterOS/Generators/FirewallNAT.php

    r735 r738  
    3434
    3535// Skip local subnet
    36 //$Items[] = array('chain' => 'inet-out', 'dst-address' => '172.16.1.1/30', 'action' => 'accept', 'comment' => 'Local_subnet');     
     36//$Items[] = array('chain' => 'inet-out', 'dst-address' => '172.16.1.1/30', 'action' => 'accept', 'comment' => 'Local_subnet');
    3737//$Items[] = array('chain' => 'inet-in', 'dst-address' => '172.16.1.1/30', 'action' => 'accept', 'comment' => 'Local_subnet');
    3838
     
    4646  $DbResult2 = $System->Database->query('SELECT `NetworkInterface`.*, `NetworkDevice`.`Name` AS `DeviceName`, `NetworkDevice`.`InboundNATPriority` FROM `NetworkInterface`'.
    4747  ' LEFT JOIN `NetworkDevice` ON `NetworkDevice`.`Id` = `NetworkInterface`.`Device` WHERE (`NetworkInterface`.`ExternalIP` <> "")'.
    48   ' AND (`NetworkInterface`.`LocalIP` <> "")'. 
     48  ' AND (`NetworkInterface`.`LocalIP` <> "")'.
    4949  ' AND (`NetworkDevice`.`Member` = '.$Member['Id'].') AND (`NetworkInterface`.`LocalIP` != `NetworkInterface`.`ExternalIP`) ORDER BY `id` DESC');
    5050  while($Interface = $DbResult2->fetch_assoc())
     
    5757    {
    5858      $Items[] = array('chain' => 'inet-out', 'src-address' => $Interface['LocalIP'], 'action' => 'src-nat',  'to-addresses' => $Interface['ExternalIP'], 'comment' => $Name.'-out');
    59       if($Interface['InboundNATPriority'] > 0) 
     59      if($Interface['InboundNATPriority'] > 0)
    6060        $Items[] = array('chain' => 'inet-in', 'dst-address' => $Interface['ExternalIP'], 'action' => 'dst-nat', 'to-addresses' => $Interface['LocalIP'], 'comment' => $Name.'-in');
    61     } else 
     61    } else
    6262    {
    6363      $Items[] = array('chain' => 'dstnat', 'src-address' => $Interface['LocalIP'], 'protocol' => 'tcp', 'dst-port' => 80, 'action' => 'dst-nat',  'to-addresses' => $IPCentrala, 'to-ports' => 81, 'comment' => $Name.'-out');
     
    6868  $DbResult2 = $System->Database->select('NetworkSubnet', '*', '`Member`='.$Member['Id']);
    6969  while($Subnet = $DbResult2->fetch_assoc())
    70   {   
     70  {
    7171    $Subnet['Name'] = RouterOSIdent('subnet-'.$Subnet['Name']);
    7272    echo($Subnet['Name'].'('.$Subnet['AddressRange'].'/'.$Subnet['Mask'].'), ');
     
    8282        else $Src = $Subnet['AddressRange'].'/'.$Subnet['Mask'];
    8383      $Items[] = array('chain' => 'inet-out', 'src-address' => $Src, 'action' => 'src-nat', 'to-addresses' => $Range, 'comment' => $Subnet['Name'].'-out');
    84    
     84
    8585      $NewAddress = new NetworkAddressIPv4();
    8686      $NewAddress->AddressFromString($Subnet['AddressRange']);
     
    114114
    115115// Accept free-access clients
    116 $Items[] = array('chain' => 'dstnat', 'dst-address' => '!10.145.0.0/16', 
    117         'src-address-list' => 'free-access', 'in-interface' => $LocalInterface,
    118         'action' => 'accept', 'comment' => 'Free_access');
     116$Items[] = array('chain' => 'dstnat', 'dst-address' => '!10.145.0.0/16',
     117  'src-address-list' => 'free-access', 'in-interface' => $LocalInterface,
     118  'action' => 'accept', 'comment' => 'Free_access');
    119119// Redirect unregistred clients to free access activation page
    120 $Items[] = array('chain' => 'dstnat', 'dst-address' => '!10.145.0.0/16', 
    121         'src-address-list' => 'unregistred', 'in-interface' => $LocalInterface,
    122         'action' => 'dst-nat', 'to-addresses' => '10.145.64.8', 'to-ports' => 82, 'comment' => 'Redirect_unregistred');
     120$Items[] = array('chain' => 'dstnat', 'dst-address' => '!10.145.0.0/16',
     121  'src-address-list' => 'unregistred', 'in-interface' => $LocalInterface,
     122  'action' => 'dst-nat', 'to-addresses' => '10.145.64.8', 'to-ports' => 82, 'comment' => 'Redirect_unregistred');
    123123
    124124/*
  • trunk/Modules/NetworkConfigRouterOS/Generators/Netwatch.php

    r617 r738  
    3535    }
    3636  }
    37   $Routerboard->ListUpdate($Path, array('host', 'interval', 'comment'), $Items);   
     37  $Routerboard->ListUpdate($Path, array('host', 'interval', 'comment'), $Items);
    3838  echo("\n");
    3939}
  • trunk/Modules/NetworkConfigRouterOS/Generators/NetwatchImport.php

    r697 r738  
    2121  // Load netwatch status from all DHCP routers
    2222  $DbResult3 = $System->Database->query('SELECT `DHCP`, `AddressRange`, `Mask` FROM `NetworkSubnet` '.
    23                 'WHERE (`Configure` = 1) AND (`Member` IS NULL) GROUP BY DHCP');
     23    'WHERE (`Configure` = 1) AND (`Member` IS NULL) GROUP BY DHCP');
    2424  while($Subnet = $DbResult3->fetch_assoc())
    2525  {
     
    5454        array('LastOnline' => TimeToMysqlDateTime($StartTime)));
    5555
    56         if($Interface['Online'] != $Interface['NewOnline'])
     56    if($Interface['Online'] != $Interface['NewOnline'])
    5757    {
    58         // Online state changed
     58      // Online state changed
    5959      $DbResult = $System->Database->query('INSERT INTO `NetworkInterfaceUpDown` (`Interface`,
    60         `State`, `Time`, `Duration`) VALUES ('.$Interface['Id'].', '.$Interface['NewOnline'].', "'.
     60        `State`, `Time`, `Duration`) VALUES ('.$Interface['Id'].', '.$Interface['NewOnline'].', "'.
    6161         TimeToMysqlDateTime($StartTime).'", NULL)');
    6262      // Update previous record duration in UpDown table
     
    6464      '`TM`.`Time`, (SELECT `Time` FROM (SELECT * FROM `NetworkInterfaceUpDown`) AS `TA` WHERE (`TA`.`Time` > `TM`.`Time`) '.
    6565      'AND (`TA`.`Interface`=`TM`.`Interface`) ORDER BY `TA`.`Time` ASC LIMIT 1)) '.
    66         'WHERE (`TM`.`Duration` IS NULL) AND (`TM`.`Interface` ='.$Interface['Id'].')');
     66      'WHERE (`TM`.`Duration` IS NULL) AND (`TM`.`Interface` ='.$Interface['Id'].')');
    6767      $System->Database->update('NetworkInterface', '`Id` = "'.$Interface['Id'].'"',
    6868        array('Online' => $Interface['NewOnline']));
     
    7575  while($DbRow = $DbResult->fetch_assoc())
    7676  {
    77         echo('IP '.$DbRow['LocalIP'].' online but time not updated.'."\n");
     77    echo('IP '.$DbRow['LocalIP'].' online but time not updated.'."\n");
    7878  }
    7979  $DbResult = $System->Database->select('NetworkInterface', '*', '(`Online` = 0) AND '.
  • trunk/Modules/NetworkConfigRouterOS/Generators/Queue.php

    r726 r738  
    2222{
    2323  global $UsedNames;
    24  
     24
    2525  if(in_array($Name, $UsedNames)) die("\n".'Duplicate name: '.$Name);
    2626  else $UsedNames[] = $Name;
     
    5353if($DbResult->num_rows == 1)
    5454{
    55         $Service = $DbResult->fetch_array();
     55  $Service = $DbResult->fetch_array();
    5656  $FreeInetSpeed = $Service['InternetSpeedMax'] * 1000;
    5757} else $FreeInetSpeed = 0;
     
    128128      }
    129129    }
    130  
     130
    131131    $DbResult2 = $System->Database->select('NetworkSubnet', '*', '`Service`='.$Service['RelId']);
    132132    while($Subnet = $DbResult2->fetch_assoc())
  • trunk/Modules/NetworkConfigRouterOS/Generators/Signal.php

    r682 r738  
    3535      if($DbResult->num_rows > 0)
    3636      {
    37         $DbRow = $DbResult->fetch_assoc();
     37        $DbRow = $DbResult->fetch_assoc();
    3838        $Interface = $DbRow['Id'];
    3939      } else $Interface = null;
  • trunk/Modules/NetworkConfigRouterOS/NetworkConfigRouterOS.php

    r735 r738  
    2828  function DoStart()
    2929  {
    30         $this->System->Pages['zdarma'] = 'PageFreeAccess';
     30    $this->System->Pages['zdarma'] = 'PageFreeAccess';
    3131    $this->System->FormManager->RegisterClass('NetworkInterfaceUpDown', array(
    3232      'Title' => 'Změny stavu rozhraní',
     
    4444}
    4545
    46 class PageFreeAccess extends Page 
     46class PageFreeAccess extends Page
    4747{
    4848  var $FullTitle = 'Přístup zdarma k Internetu';
     
    5151  var $AddressList = 'free-access';
    5252  var $Timeout;
    53  
     53
    5454  function __construct($System)
    5555  {
    56         parent::__construct($System);
    57         $this->Timeout = 24 * 60 * 60;
     56    parent::__construct($System);
     57    $this->Timeout = 24 * 60 * 60;
    5858  }
    59  
    60         function Show()
    61         {
    62                 $IPAddress = GetRemoteAddress();
    63                 if(IsInternetAddr($IPAddress))
    64                         return('<p>Internet zdarma je dostupný pouze z vnitřní sítě.</p>'); 
    65                 $Time = time();
    66        
    67                 $DbResult = $this->Database->select('NetworkFreeAccess', '*', '(IPAddress="'.$IPAddress.
    68                         '") ORDER BY Time DESC LIMIT 1');
    69                 if($DbResult->num_rows > 0)
    70                 {
    71                         $DbRow = $DbResult->fetch_assoc();
    72                         $ActivationTime = MysqlDateTimeToTime($DbRow['Time']);
    73       if(($ActivationTime + $this->Timeout) < $Time) 
     59
     60  function Show()
     61  {
     62    $IPAddress = GetRemoteAddress();
     63    if(IsInternetAddr($IPAddress))
     64      return('<p>Internet zdarma je dostupný pouze z vnitřní sítě.</p>');
     65    $Time = time();
     66
     67    $DbResult = $this->Database->select('NetworkFreeAccess', '*', '(IPAddress="'.$IPAddress.
     68      '") ORDER BY Time DESC LIMIT 1');
     69    if($DbResult->num_rows > 0)
     70    {
     71      $DbRow = $DbResult->fetch_assoc();
     72      $ActivationTime = MysqlDateTimeToTime($DbRow['Time']);
     73      if(($ActivationTime + $this->Timeout) < $Time)
    7474      {
    75         $Activated = false;
    76       } else $Activated = true;                 
    77                 } else $Activated = false;
    78                
    79                 if(array_key_exists('a', $_GET))
    80                 {
    81                   if($_GET['a'] == 'activate')
    82                   {
    83                         if($Activated == false)
    84                         {
    85                                 $DbResult = $this->Database->insert('NetworkFreeAccess',
    86                                         array('IPAddress' => $IPAddress, 'Time' => TimeToMysqlDateTime(time()),
    87                                         'Configured' => 0));
    88                                 $ActivationTime = $Time;
    89                                 $Activated = true;
    90                         }
    91                   }     
    92                 }
    93                 $Output = '<div style="text-align:center;"><h3>Vítejte v síti ZděchovNET</h3></div>';
    94                 //$Output .= 'Vaše adresa IP je: '.GetRemoteAddress().'<br/>';         
    95                 $Output .= '<p>Pro přístup k Internetu zdarma sdílenou rychlostí 128/128 kbit/s klikněte na odkaz níže.
    96                         Internet bude zpřístupněn po dobu 24 hodin. Po uplynutí této doby je potřeba provést novou aktivaci.</p>';
    97                 $Output .= '<p>Pokud jste platícím zákazníkem a přesto se vám zobrazuje tato stránka, tak pravděpodobně nemáte registrovano v síti vaše klientské zařízení.</p>';
    98                
    99                 $PrefixMultiplier = new PrefixMultiplier();
    100                 if($Activated) $Output .= 'Aktivováno. Vyprší za '.$PrefixMultiplier->Add($ActivationTime + $this->Timeout - $Time, '', 4, 'Time');
    101                   else $Output .= '<a href="?a=activate">Aktivovat</a>';
    102                
    103                 return($Output);
     75        $Activated = false;
     76      } else $Activated = true;
     77    } else $Activated = false;
     78
     79    if(array_key_exists('a', $_GET))
     80    {
     81      if($_GET['a'] == 'activate')
     82      {
     83        if($Activated == false)
     84        {
     85          $DbResult = $this->Database->insert('NetworkFreeAccess',
     86            array('IPAddress' => $IPAddress, 'Time' => TimeToMysqlDateTime(time()),
     87            'Configured' => 0));
     88          $ActivationTime = $Time;
     89          $Activated = true;
     90        }
     91      }
     92    }
     93    $Output = '<div style="text-align:center;"><h3>Vítejte v síti ZděchovNET</h3></div>';
     94    //$Output .= 'Vaše adresa IP je: '.GetRemoteAddress().'<br/>';
     95    $Output .= '<p>Pro přístup k Internetu zdarma sdílenou rychlostí 128/128 kbit/s klikněte na odkaz níže.
     96      Internet bude zpřístupněn po dobu 24 hodin. Po uplynutí této doby je potřeba provést novou aktivaci.</p>';
     97    $Output .= '<p>Pokud jste platícím zákazníkem a přesto se vám zobrazuje tato stránka, tak pravděpodobně nemáte registrovano v síti vaše klientské zařízení.</p>';
     98
     99    $PrefixMultiplier = new PrefixMultiplier();
     100    if($Activated) $Output .= 'Aktivováno. Vyprší za '.$PrefixMultiplier->Add($ActivationTime + $this->Timeout - $Time, '', 4, 'Time');
     101      else $Output .= '<a href="?a=activate">Aktivovat</a>';
     102
     103    return($Output);
    104104  }
    105105}
     
    107107class ScheduleConfigureFreeAccess extends SchedulerTask
    108108{
    109         function Execute()
    110         {
    111                 $Output = '';
    112                 $Commands = array();
    113                 $DbResult = $this->Database->select('NetworkFreeAccess', '`Id`, `IPAddress`', '(`Configured`=0)');
    114                 while($DbRow = $DbResult->fetch_assoc())
    115                 {
    116                         $Commands[] = '/ip firewall address-list add address='.$DbRow['IPAddress'].
    117                         ' list=free-access timeout=1d';
    118                 }
    119                 $DbResult = $this->Database->update('NetworkFreeAccess', '`Configured`=0', array('Configured' => 1));
    120                
    121                 $Routerboard = new Routerboard($this->System->Config['MainRouter']['HostName']);
    122                 $Routerboard->UserName = $this->System->Config['MainRouter']['UserName'];
    123                 $Routerboard->Timeout = $this->System->Config['MainRouter']['ConnectTimeout'];
    124                 $Routerboard->Debug = true;
    125                 $Routerboard->ExecuteBatch(implode(';', $Commands));
    126                                        
    127                 return($Output);
    128         }
     109  function Execute()
     110  {
     111    $Output = '';
     112    $Commands = array();
     113    $DbResult = $this->Database->select('NetworkFreeAccess', '`Id`, `IPAddress`', '(`Configured`=0)');
     114    while($DbRow = $DbResult->fetch_assoc())
     115    {
     116      $Commands[] = '/ip firewall address-list add address='.$DbRow['IPAddress'].
     117      ' list=free-access timeout=1d';
     118    }
     119    $DbResult = $this->Database->update('NetworkFreeAccess', '`Configured`=0', array('Configured' => 1));
     120
     121    $Routerboard = new Routerboard($this->System->Config['MainRouter']['HostName']);
     122    $Routerboard->UserName = $this->System->Config['MainRouter']['UserName'];
     123    $Routerboard->Timeout = $this->System->Config['MainRouter']['ConnectTimeout'];
     124    $Routerboard->Debug = true;
     125    $Routerboard->ExecuteBatch(implode(';', $Commands));
     126
     127    return($Output);
     128  }
    129129}
  • trunk/Modules/NetworkConfigRouterOS/Routerboard2.php

    r548 r738  
    6767  function GetDHCPServerLeasesList()
    6868  {
    69     return($this->GetList('/ip dhcp-server lease', array('address', 'active-address', 'comment', 'lease-time', 'status', 'host-name'))); 
     69    return($this->GetList('/ip dhcp-server lease', array('address', 'active-address', 'comment', 'lease-time', 'status', 'host-name')));
    7070  }
    7171}
  • trunk/Modules/NetworkConfigRouterOS/RouterboardAPI.php

    r704 r738  
    4848    if($this->SSL)
    4949    {
    50         $IP = 'ssl://'.$IP;
     50      $IP = 'ssl://'.$IP;
    5151    }
    5252    $this->Socket = @fsockopen($IP, $this->Port, $this->ErrorNo, $this->ErrorStr, $this->Timeout);
  • trunk/Modules/NetworkConfigRouterOS/SSH.php

    r548 r738  
    3737            /*
    3838            //echo(') '.strlen($Buffer).' '.ord($Buffer{0}).'(');
    39             for($I = 0; $I < strlen($Buffer); $I++) 
     39            for($I = 0; $I < strlen($Buffer); $I++)
    4040            {
    4141              if(((ord($Buffer{$I}) >= 32) and (ord($Buffer{$I}) <= 128)) or ($Buffer{$I} = "\n") or ($Buffer{$I} = "\r")) echo($Buffer{$I});
     
    5555    echo($Response);
    5656    return(explode("\n", substr($Response, 0, -1)));
    57   } 
     57  }
    5858}
  • trunk/Modules/NetworkShare/NetworkShare.php

    r586 r738  
    1717    $this->Dependencies = array('Network');
    1818  }
    19  
     19
    2020  function DoInstall()
    2121  {
    2222  }
    23  
     23
    2424  function DoUnInstall()
    2525  {
  • trunk/Modules/NetworkShare/SharePage.php

    r584 r738  
    7474
    7575    // Default host list view
    76     if((count($_POST) == 0) and (count($_GET) == 0)) 
     76    if((count($_POST) == 0) and (count($_GET) == 0))
    7777    {
    7878      $_POST['view'] = 1;
    79       $_POST['page'] = 0; 
     79      $_POST['page'] = 0;
    8080    }
    8181
     
    101101
    102102    // Log search
    103     if(array_key_exists('keyword', $_POST) or array_key_exists('keyword', $_GET)) 
     103    if(array_key_exists('keyword', $_POST) or array_key_exists('keyword', $_GET))
    104104      $this->System->ModuleManager->Modules['Log']->NewRecord('Share', 'Hledaný výraz', $_SESSION['keyword']);
    105105
     
    218218    $Pocet = $Row[0];
    219219
    220     if($Pocet > 0) 
     220    if($Pocet > 0)
    221221    {
    222222      $Output .= 'Nalezeno celkem: '.$Pocet.' položek<br />';
    223     } else 
     223    } else
    224224    $Output .= 'Podle zadaných podmínek nic nenalezeno';
    225225    if(($Pocet > 0) || ($upstr))
     
    228228      <tr><th bgcolor="#E0E0FF"><a href="index.php?order=name">Soubor</a></th><th bgcolor="#E0E0FF"><a href="index.php?order=ext">Přípona</a></th><th bgcolor="#E0E0FF"><a href="index.php?order=size">Velikost</a></th><th bgcolor="#E0E0FF"><a href="index.php?order=date">Datum</a></th><th bgcolor="#E0E0FF">Umístění</th></tr>';
    229229      $Output .= $upstr;
    230       if($Pocet > 0) 
     230      if($Pocet > 0)
    231231      {
    232232        // Zobrazení tabulky s výsledky
     
    260260      }
    261261    }
    262     if($Pocet > 0) 
     262    if($Pocet > 0)
    263263    {
    264264      // Celkový přehled
  • trunk/Modules/NetworkShare/browse.php

    r548 r738  
    44$SambaSbinDir = '/usr/sbin/';
    55$Database->select_db('share');
    6 $ZanoreniMax = 8;                  // Maximální úroven zanoreni
    7 $MaxProgress = 70;              // Pocet casti stavu prubehu operace
     6$ZanoreniMax = 8;      // Maximální úroven zanoreni
     7$MaxProgress = 70;    // Pocet casti stavu prubehu operace
    88$StartTime = time();
    9 $MountDir = '/tmp/browse/host'; // Složka, kde se dočasně připojují síťové disky
    10 $TempDir = '/tmp/browse/';      // Složka, kde se dočasně připojují síťové disky
     9$MountDir = '/tmp/browse/host'; // Složka, kde se dočasně připojují síťové disky
     10$TempDir = '/tmp/browse/';  // Složka, kde se dočasně připojují síťové disky
    1111if(!is_dir($TempDir)) mkdir($TempDir, 0777);
    1212if(!is_dir($MountDir)) mkdir($MountDir, 0777);
     
    4444{
    4545  global $Citac, $Soubor, $Host, $HostID, $Share, $ZanoreniMax, $Pocet, $Hotovo, $MountDir, $TempDir, $FileSize, $MaxProgress, $Database;
    46  
     46
    4747  $VelikostSlozky = 0;
    4848  //$Vlozit = '';
     
    9393    $Nazev = ltrim(substr($Radek,strlen($Time)+1));
    9494    //echo($Date.','.$Time.','.$Radek.' ');
    95    
     95
    9696    if((strpos($Nazev,'.') > 0) && ($Type != 2))
    9797    {
     
    101101    //$Vlozit .= "INSERT INTO NetworkShareItem (name,size,date,ext,parent,type,host) ".
    102102    //"VALUES ('$Nazev','$Velikost',NOW(),'$Ext','$Parent','$Type','$HostID'); ";
    103    
     103
    104104    $Database->insert('NetworkShareItem', array(
    105105      'name' => $Nazev,
     
    114114    $Citac = $Citac + 1;
    115115    // Pokud jde o sloľku, tak projdi jeji obsah a aktualizuj velikost
    116     if($Type == 2) 
     116    if($Type == 2)
    117117    {
    118118      //echo($Vlozit);
     
    120120    //  $Vlozit = '';
    121121      $VelikostSlozky += Vetev($Cesta.$Nazev.'/',$Zanoreni+1);
    122     } 
     122    }
    123123  }
    124124  //echo($Vlozit);
    125125  //if($Vlozit!='') DB_Query($Vlozit);  // Vloz vsechny polozky
    126  
     126
    127127  // Aktualizuj velikost
    128128  //DB_Query("SELECT SUM(size) FROM NetworkShareItem WHERE (parent=".$Parent.")");
     
    134134
    135135// Proskenuj jednotlive sdileni
    136 $Database->query('DELETE FROM NetworkShareItem WHERE host='.$HostID);   // Smaz predchozi polozky
     136$Database->query('DELETE FROM NetworkShareItem WHERE host='.$HostID); // Smaz predchozi polozky
    137137
    138138// Zapis nazev pocitace
     
    185185      $Soubor = fopen($TempDir.$Host.'.list','r');
    186186      $Citac = 0;
    187       Vetev('/', 0);            // Skenuj sdileni
    188       fclose($Soubor);                  // Uzavřít soubor
    189       unlink($TempDir.$Host.'.list');           // Smazat soubor stromu adresářové struktury
     187      Vetev('/', 0);    // Skenuj sdileni
     188      fclose($Soubor);      // Uzavřít soubor
     189      unlink($TempDir.$Host.'.list');   // Smazat soubor stromu adresářové struktury
    190190      //echo(str_repeat('#',40-$Pocet));
    191191      echo("] $Citac\n");
    192192    //} else echo("CHYBA\n");
    193193  } else echo('Soubor sdílení nenalezen!');
    194   passthru('umount '.$MountDir);        // Odpojit sitovy disk
     194  passthru('umount '.$MountDir);  // Odpojit sitovy disk
    195195}
    196196
     
    215215$DbResult = $Database->query('SELECT id FROM hosts');
    216216$Vyber = '';
    217 while($Row = $DbResult->fetch_array()) 
     217while($Row = $DbResult->fetch_array())
    218218  $Vyber .= $Row['id'].',';
    219  
     219
    220220$Database->select_db('share');
    221221$DbResult = $Database->query("SELECT SUM(size) FROM NetworkShareItem WHERE ((parent=1) AND (host IN (".substr($Vyber,0,-1).')))');
     
    226226echo("Chyby sdílení...\n");
    227227$Database->delete('NetworkShareError', 'host="'.$Host.'"');
    228 if(is_dir($TempDir.'errors')) 
     228if(is_dir($TempDir.'errors'))
    229229{
    230230  $Dir = scandir($TempDir.'errors');
    231231  foreach($Dir as $File)
    232   { 
     232  {
    233233    if(substr($File, 0, strpos($File, '_')) == $Host)
    234234    {
     
    241241        {
    242242          $Row = fgets($ErrorFile);
    243           if($Row != '') 
     243          if($Row != '')
    244244          {
    245245            $Row = substr($ShareFull.'/'.substr($Row, 39), 0, -1);
     
    249249        }
    250250        fclose($ErrorFile);
    251       } 
     251      }
    252252    }
    253253  }
  • trunk/Modules/NetworkShare/firefox.php

    r548 r738  
    88<!--
    99function addSearchEngine(engineURL, iconURL, suggestedTitle, suggestedCategory){
    10         var msg="Přidání vyhledávacího modulu selhalo - ";
     10  var msg="Přidání vyhledávacího modulu selhalo - ";
    1111
    12         if((typeof window.sidebar == "object") && (typeof window.sidebar.addSearchEngine == "function")){
    13                 if(engineURL == null || engineURL == ""){
    14                         alert(msg + "nebyla zadána jeho URL.");
    15                         return false;
    16                 }
    17                 if(iconURL == null || iconURL == ""){
    18                         alert(msg + "nebyla zadána URL ikony.");
    19                         return false;
    20                 }
    21                 if(engineURL.search(/^http:\/\//i) == -1 || engineURL.search(/\.src$/i) == -1){
    22                         alert(msg + "nebyla zadána platná URL.");
    23                         return false;
    24                 }
    25                 if(iconURL.search(/^http:\/\//i) == -1 || iconURL.search(/\.(gif|jpg|jpeg|png)$/i) == -1){
    26                         alert(msg + " nebyla platná URL ikony.");
    27                         return false;
    28                 }
    29                 if(suggestedTitle == null) suggestedTitle = "";
    30                 if(suggestedCategory == null) suggestedCategory = "";
    31                 window.sidebar.addSearchEngine(engineURL, iconURL, suggestedTitle, suggestedCategory);
    32         }else{
    33                 alert("Váš prohlížeč nepodporuje tuto funkci. Zkuste Mozillu.");
    34         }
    35         return false;
    36 } 
     12  if((typeof window.sidebar == "object") && (typeof window.sidebar.addSearchEngine == "function")){
     13    if(engineURL == null || engineURL == ""){
     14      alert(msg + "nebyla zadána jeho URL.");
     15      return false;
     16    }
     17    if(iconURL == null || iconURL == ""){
     18      alert(msg + "nebyla zadána URL ikony.");
     19      return false;
     20    }
     21    if(engineURL.search(/^http:\/\//i) == -1 || engineURL.search(/\.src$/i) == -1){
     22      alert(msg + "nebyla zadána platná URL.");
     23      return false;
     24    }
     25    if(iconURL.search(/^http:\/\//i) == -1 || iconURL.search(/\.(gif|jpg|jpeg|png)$/i) == -1){
     26      alert(msg + " nebyla platná URL ikony.");
     27      return false;
     28    }
     29    if(suggestedTitle == null) suggestedTitle = "";
     30    if(suggestedCategory == null) suggestedCategory = "";
     31    window.sidebar.addSearchEngine(engineURL, iconURL, suggestedTitle, suggestedCategory);
     32  }else{
     33    alert("Váš prohlížeč nepodporuje tuto funkci. Zkuste Mozillu.");
     34  }
     35  return false;
     36}
    3737//-->
    3838</script>');
    39 echo(' 
     39echo('
    4040Pomocí <a href="http://centrala/share/prohledavac_sdileni8.src" onclick="return addSearchEngine(\'http://centrala/share/prohledavac_sdileni8.src\', \'http://centrala/share/prohledavac_sdileni8.gif\', \'Prohledávač sdílení sítě ZděchovNET\', \'Web\')">tohoto odkazu</a> přidáte tento prohledávač sdílení do políčka Hledat ve vašem internetovém prohlížeči Mozilla Firefox. Pak můžete vyhledávat zjednodušeně zadáím hesel do tohoto políčka.<br><br>
    4141<div align="center"><img src="firefox.png" alt="Firefox"></div>');
  • trunk/Modules/NetworkShare/online.php

    r548 r738  
    1212  echo("OK\n\nSeznam online pocitacu:\n");
    1313  array_shift($Output);
    14   $Online = array();            // Seznam online pocitacu
     14  $Online = array();    // Seznam online pocitacu
    1515  foreach($Output as $Radek)
    1616  {
     
    3535    {
    3636      $Output = array();
    37      
     37
    3838      //echo('arping -c 1 '.$Host);
    3939      exec('arping -c 1 '.$Host,$Output);
    4040      if(count($Output)!=4)
    41       { 
     41      {
    4242        $Output = array();
    4343        exec('arping -I wlan0 -c 1 '.$Host,$Output);
    4444        if(count($Output)!=4)
    45         { 
     45        {
    4646          $Output = array();
    4747          exec('arping -I wlan1 -c 1 '.$Host,$Output);
    4848          if(count($Output)!=4)
    49           { 
     49          {
    5050            $Output = array();
    5151            exec('arping -I wlan2 -c 1 '.$Host,$Output);
    52             if(count($Output)!=4) 
     52            if(count($Output)!=4)
    5353            {
    5454              $Output = array();
     
    7171  // Deaktivuj predchozi online pocitace
    7272  $Database->update('hosts', 1, array('online' => 0));
    73  
     73
    7474  //print_r($Online);
    7575  // Aktivuj online pocitace
     
    8282    } else $Database->insert('hosts',array('name' => $Item['host'], 'IP' => $Item['IP'], 'MAC' => $Item['MAC'], 'online' => 1,'date' => 'NOW()','lastdate' => 'NOW()', 'section' => $Section));
    8383  }
    84  
     84
    8585  echo("\nSeznam offline pocitacu:\n");
    8686  $DbResult = $Database->query("SELECT * FROM hosts WHERE online=0");
  • trunk/Modules/NetworkShare/playlist.php

    r548 r738  
    66$Vyber = '';
    77$Podminka = '';
    8 while($Row = $DbResult->fetch_array()) 
     8while($Row = $DbResult->fetch_array())
    99  $Vyber .= $Row['id'].',';
    1010$Podminka .= ' AND (host IN ('.substr($Vyber,0,-1).'))';
     
    2020{
    2121  global $MaxNesting, $Database;
    22  
     22
    2323  // Vyhled�n� cesty
    2424  $Otec = $Row['parent'];
  • trunk/Modules/NetworkShare/update.php

    r548 r738  
    11<?php
    22
    3 //$Perioda = 3600*3;    // prochazet po tech hodinach
     3//$Perioda = 3600*3;  // prochazet po tech hodinach
    44
    55$Dnes = date('Y-m-d');
     
    1212  {
    1313    //echo('Host: '.$Host."...\n");
    14    
     14
    1515    //echo(.','.$Row['date']."\n");
    1616    $HostID = 100;
    1717    $StartTime2 = GetMicrotime();
    18     if($Dnes != $Row['last_share_check']) 
     18    if($Dnes != $Row['last_share_check'])
    1919    {
    2020      echo("Kontroluji ".$Row['Name']."...\n");
     
    2222    }
    2323    else echo("Vynechavam ".$Row['Name']."...\n");
    24     // Aktualizuj datum prochazeni   
     24    // Aktualizuj datum prochazeni
    2525    $Database->update('Hosts', "name='".$Row['name']."'",array('last_share_check' => $Dnes));
    2626  }
    2727  $Rozdil = GetMicrotime()-$StartTime+10;
    28  
     28
    2929  // Oprav a zoptimalizuj tabulku
    3030  //$Database->select_db('share');
     
    3333  echo("\nOptimalizuji tabulku...");
    3434  $Database->query('OPTIMIZE TABLE NetworkShareItem');
    35  
     35
    3636  echo("\nDoba procháení ".date("H:i:s",$Rozdil-3600)."\n\n");
    3737  //$Cekat = $Perioda-$Rozdil;
  • trunk/Modules/NetworkTopology/NetworkTopology.php

    r586 r738  
    77  var $ParentClass = 'PagePortal';
    88  var $TopHostName = 'NIX-ROUTER';
    9  
     9
    1010  function Show()
    1111  {
    1212    if(count($this->System->PathItems) > 1)
    13     { 
     13    {
    1414      if($this->System->PathItems[1] == 'topologie.png') return($this->ShowImage());
    1515        else return(PAGE_NOT_FOUND);
    16      
     16
    1717    } else return($this->ShowOverview());
    1818  }
    19  
     19
    2020  function ShowImage()
    2121  {
     
    3131    $width = $item[0];
    3232    $height = $item[1];
    33  
     33
    3434    $spacex = 32;
    3535    $spacey = 68;
    3636    $halfx = $spacex / 2;
    3737    $halfy = $spacey / 2;
    38     // Načtení pomocných obrázků 
     38    // Načtení pomocných obrázků
    3939    $im_comp = imagecreatefrompng(dirname(__FILE__).'/images/comp.png');
    4040    $im_dev = imagecreatefrompng(dirname(__FILE__).'/images/device.png');
     
    4747    $blue = imagecolorallocate($im, 100, 100, 255);
    4848    $gray = imagecolorallocate($im, 160, 160, 160);
    49    
     49
    5050    //$DbResult = $Database->query("SELECT * FROM hosts, NetworkTopology WHERE host = id AND used=1");
    5151    $DbResult = $this->Database->query('SELECT NetworkTopology.*, NetworkTopology.Host AS Id, '.
     
    9898      }
    9999    }
    100    
     100
    101101    // === Sestavení výsledného souboru ============================================
    102102    if($debug == 0)
    103103    {
    104104      Header("Content-type: image/png");
    105       Header("Cache-Control: no-cache");        // Dynamický graf, nekešovat
     105      Header("Cache-Control: no-cache");  // Dynamický graf, nekešovat
    106106      imagepng($im);
    107107      imagedestroy($im);
     
    111111    return('');
    112112  }
    113  
     113
    114114  function ShowOverview()
    115115  {
     
    142142    $this->Dependencies = array('Network');
    143143  }
    144  
     144
    145145  function DoInstall()
    146146  {
    147147  }
    148  
     148
    149149  function DoUnInstall()
    150150  {
  • trunk/Modules/NetworkTopology/topologie-img.php

    r548 r738  
    99
    1010// === Zpětné vyvážení stromu do hloubky =======================================
    11 function balance($id, $level, &$vlast, &$vleft, &$vpred, &$vfirst, &$vnext, &$tbound, &$width, $limit) 
     11function balance($id, $level, &$vlast, &$vleft, &$vpred, &$vfirst, &$vnext, &$tbound, &$width, $limit)
    1212{
    1313  global $debug, $bbound;
    14  
     14
    1515  if(!array_key_exists($id, $vfirst)) $vfirst[$id] = 0;
    16   if($i = $vfirst[$id]) 
     16  if($i = $vfirst[$id])
    1717  {
    1818    //if ($debug==2) echo $id.':'.@$i.','.@$vpred[$i].'-'.@$vleft[@$vpred[$i]]."\n";
    19     if (($vlast[$id] > 0) && ($vleft[$id] > $vleft[$vlast[$id]])) 
     19    if (($vlast[$id] > 0) && ($vleft[$id] > $vleft[$vlast[$id]]))
    2020    {
    2121      $diff=$vleft[$id]-$vleft[$vlast[$id]];
    2222      $i=$vfirst[$id];
    23       if ($vleft[$id] >= $tbound[$level]) 
     23      if ($vleft[$id] >= $tbound[$level])
    2424      {
    2525        $tbound[$level] = $vleft[$id] + 2;
     
    2828    } else {
    2929      $diff=0;
    30       if ($vpred[$i]&&($vleft[$i]<=$vleft[$vpred[$i]])) 
     30      if ($vpred[$i]&&($vleft[$i]<=$vleft[$vpred[$i]]))
    3131      {
    3232        $diff=$vleft[$i]-$vleft[$vpred[$i]]+2;
    3333      } else $i = 0;
    3434    }
    35     while ($i>0) 
     35    while ($i>0)
    3636    {
    3737      $vleft[$i]+=$diff;
     
    4545// === Generování rovinné stromové struktury ===================================
    4646function gentree($mode)                         // depth-first algorithm
    47 {                       
     47{
    4848  global $debug, $TopHostName, $Database;
    49  
     49
    5050  // --- Inicializace ----------------------------------------------------------
    5151  $tbound = array();                               // Hranice pozic jednotlivých úrovní
     
    5858  $vtop = array();                                 // Pozice prvku shora
    5959  $vpred = array();                                // Vedlejsi prvek na řádku
    60  
     60
    6161  $index = 0;                                    // Index aktuálního prvku
    6262  $curr = 0;                                     // Aktuální prvek
     
    6868  $position[$level] = 0;                           // Aktuální pozice prvku na dané úrovni
    6969  $count[$level] = 0;                              // Počet prvků na dané úrovni
    70  
     70
    7171  $maxindex = 0;
    7272  $tbound[$level] = 0;
    7373  $tranger[$level] = 0;
    74    
     74
    7575  // --- Hlavní cyklus ---------------------------------------------------------
    76   do 
     76  do
    7777  {
    7878  // --- Proveď databázový dotaz -----------------------------------------------
    7979    $query = 'SELECT * FROM hosts WHERE used=1 AND ';
    80     if ($level == 0) 
    81     { 
    82       $query .= 'name = "'.$TopHostName.'" ORDER BY id'; 
    83     } else 
     80    if ($level == 0)
     81    {
     82      $query .= 'name = "'.$TopHostName.'" ORDER BY id';
     83    } else
    8484    {
    8585      $query .= ' parent = '.$parent[$level].' ORDER BY id';
     
    9191    $item = $DbResult->fetch_array();
    9292    //print_r($item);
    93     if($item) 
     93    if($item)
    9494    {
    9595  // --- Zpracování položky z DB -----------------------------------------------
    96       if($position[$level] > 0) 
     96      if($position[$level] > 0)
    9797      {
    9898        $vnext[$curr] = $item['id']; // Neprvní položka, nastav předchozí
     
    114114      $DbResult = $Database->query('SELECT COUNT(*) FROM hosts WHERE used=1 AND parent = '.$curr);
    115115      $childcnt = $DbResult->fetch_array();
    116       if ($childcnt[0] > 0) 
    117       {   
     116      if ($childcnt[0] > 0)
     117      {
    118118        // Uzelový vrchol
    119         if(array_key_exists($level + 1, $tbound))                 
     119        if(array_key_exists($level + 1, $tbound))
    120120          if($tbound[$level + 1] > $vleft[$curr]) $vleft[$curr] = $tbound[$level + 1];
    121121      }
    122122      $tbound[$level] = $vleft[$curr] + 2;
    123123      if ($vleft[$curr] > $width) $width = $vleft[$curr];
    124       if ($childcnt[0] > 0) 
     124      if ($childcnt[0] > 0)
    125125      {
    126126        $level++;
     
    130130        $count[$level] = 0;
    131131      } else $index++;                            // Listový vrchol
    132     } else 
     132    } else
    133133    {
    134134  // --- Zarovnávání prvků kvůli vzhledu
    135135      if(!array_key_exists($vfirst[$parent[$level]], $vleft)) $vleft[$vfirst[$parent[$level]]] = 0;
    136136      if(!array_key_exists($parent[$level], $vleft)) $vleft[$parent[$level]] = 0;
    137       if ($vleft[$vfirst[$parent[$level]]] > $vleft[$parent[$level]]) 
     137      if ($vleft[$vfirst[$parent[$level]]] > $vleft[$parent[$level]])
    138138      {
    139139        $vleft[$parent[$level]] = $vleft[$vfirst[$parent[$level]]];
     
    141141      }
    142142      balance($parent[$level],$level, $vlast,$vleft,$vpred,$vfirst,$vnext,$tbound, $width, 0);
    143       if ($position[$level]==1) 
     143      if ($position[$level]==1)
    144144      {
    145145        $vleft[$vfirst[$parent[$level]]] = $vleft[$parent[$level]];
     
    149149      if(!array_key_exists($parent[$level], $vlast)) $vlast[$parent[$level]] = 0;
    150150      $curr = $vlast[$parent[$level]];
    151      
     151
    152152      if(!array_key_exists($level, $tbound)) $tbound[$level] = 0;
    153153      if(!array_key_exists($level + 1, $tbound)) $tbound[$level + 1] = 0;
     
    165165$datawidth = $data['width'];
    166166for($i = 0; $i <= $maxindex; $i++)
    167 { 
     167{
    168168  if(!array_key_exists($i, $vleft)) $vleft[$i] = 0;
    169169  if(!array_key_exists($i, $data['vleft'])) $data['vleft'][$i] = 0;
     
    179179$IconList = array();
    180180$DbResult = $Database->query('SELECT * FROM HostType');
    181 while($HostType = $DbResult->fetch_assoc()) 
     181while($HostType = $DbResult->fetch_assoc())
    182182  $IconList[$HostType['Id']] = imagecreatefrompng('images/'.$HostType['IconName'].'.png');
    183183
     
    191191$gray = imagecolorallocate($im, 160, 160, 160);
    192192
    193 function xpos($id) 
     193function xpos($id)
    194194{
    195195  global $vleft, $spacex;
     
    198198
    199199$DbResult = $Database->query('SELECT * FROM hosts JOIN HostType ON HostType.Id = hosts.type WHERE hosts.used=1');
    200 while($item = $DbResult->fetch_array()) 
     200while($item = $DbResult->fetch_array())
    201201{
    202202  $id = $item['id'];
    203203  if(!array_key_exists($id, $vtop)) $vtop[$id] = 0;
    204   if(($vtop[$id] > 0) || ($item['name'] == $TopHostName)) 
     204  if(($vtop[$id] > 0) || ($item['name'] == $TopHostName))
    205205  {
    206206    if($vtop[$id] > 0) imageline($im, xpos($id) + $halfx, $vtop[$id] * $spacey, xpos($id) + $halfx, $vtop[$id] * $spacey + 8, $black);
    207207    if(!array_key_exists($id, $vfirst)) $vfirst[$id] = 0;
    208     if($vfirst[$id] > 0) 
     208    if($vfirst[$id] > 0)
    209209    {
    210210      imageline($im, xpos($vfirst[$id]) + $halfx, $vtop[$id] * $spacey + $spacey, xpos($vlast[$id]) + $halfx, $vtop[$id] * $spacey + $spacey, $black);
    211211      imageline($im, xpos($id) + $halfx, ($vtop[$id] + 1) * $spacey - 10, xpos($id) + $halfx, ($vtop[$id] + 1) * $spacey, $black);
    212212    }
    213    
     213
    214214    $image = $IconList[$item['type']];
    215215    if($item['IP'] == '')
     
    228228    imagecopy($im, $image, xpos($id) + $halfx - 15, $vtop[$id] * $spacey + 12, 0, 0, 30, 30);
    229229//    imagerectangle($im,xpos($id)+$halfx-6,$vtop[$id]*$spacey+16,xpos($id)+$halfx+6,$vtop[$id]*$spacey+28,$color);
    230     if($debug) 
     230    if($debug)
    231231    {
    232232      imagestring($im, 2, xpos($id) + ($spacex - strlen($item['id']) * imagefontwidth(2)) / 2, $vtop[$id] * $spacey + 31 + imagefontheight(2), $item['id'], $color);
    233     } else 
     233    } else
    234234      imagestring($im, 2, xpos($id) + ($spacex - strlen($item['name']) * imagefontwidth(2)) / 2, $vtop[$id] * $spacey + 31 + imagefontheight(2), strtoupper($item['name']), $color);
    235235  }
  • trunk/Modules/NetworkTopology/topologie2.php

    r577 r738  
    3838    }
    3939
    40     $this->Tree = $Hosts[$this->TopHostId]; 
     40    $this->Tree = $Hosts[$this->TopHostId];
    4141  }
    42  
     42
    4343  function CalculateDimension(&$Host)
    4444  {
     
    6666
    6767  function MoveNode(&$Host, $Displacement)
    68   { 
     68  {
    6969    $Host['displacement'] = $Host['displacement'] + $Displacement;
    7070    foreach($Host['subitems'] as $Index => $SubHost)
     
    9292          $II = 0;
    9393          while($RightHost['parent_node']['subitems'][$II]['id'] != $RightHost['id']) $II++;
    94           while($II < count($RightHost['parent_node']['subitems'])) 
     94          while($II < count($RightHost['parent_node']['subitems']))
    9595          {
    9696            $this->MoveNode($RightHost['parent_node']['subitems'][$II], $Level[$I]['displacement'] - $Level[$I + 1]['displacement']);
     
    100100    }
    101101  }
    102  
     102
    103103  function BuildLevels(&$Host)
    104104  {
     
    116116    {
    117117      $HostPos = array('x' => -$this->RelPos['min'] + $SubHost['displacement'], 'y' => $SubHost['level'] * $this->HostHeight);
    118       imageline($this->Image, $ParentHostPos['x'], $ParentHostPos['y'], $ParentHostPos['x'], $ParentHostPos['y'] + $this->HostHeight * 0.5,   $this->LineColor); 
    119       imageline($this->Image, $ParentHostPos['x'], $ParentHostPos['y'] + $this->HostHeight * 0.5, $HostPos['x'], $ParentHostPos['y']  + $this->HostHeight * 0.5, $this->LineColor); 
    120       imageline($this->Image, $HostPos['x'], $ParentHostPos['y'] + $this->HostHeight * 0.5, $HostPos['x'], $HostPos['y'], $this->LineColor); 
     118      imageline($this->Image, $ParentHostPos['x'], $ParentHostPos['y'], $ParentHostPos['x'], $ParentHostPos['y'] + $this->HostHeight * 0.5,   $this->LineColor);
     119      imageline($this->Image, $ParentHostPos['x'], $ParentHostPos['y'] + $this->HostHeight * 0.5, $HostPos['x'], $ParentHostPos['y']  + $this->HostHeight * 0.5, $this->LineColor);
     120      imageline($this->Image, $HostPos['x'], $ParentHostPos['y'] + $this->HostHeight * 0.5, $HostPos['x'], $HostPos['y'], $this->LineColor);
    121121      $this->DrawNode(&$Host['subitems'][$Index]);
    122122      imagecopy($this->Image, $this->ImageComputer, $HostPos['x'] - imagesx($this->ImageComputer) * 0.5, $HostPos['y'] - imagesy($this->ImageComputer) * 0.5, 0, 0, 30, 30);
  • trunk/Modules/News/ImportKinoVatra.php

    r622 r738  
    1616$doc = new DOMDocument();
    1717$doc->load($SourceURL);
    18 foreach($doc->getElementsByTagName('item') as $node) 
     18foreach($doc->getElementsByTagName('item') as $node)
    1919{
    2020  $Title = $node->getElementsByTagName('title')->item(0)->nodeValue;
    2121  $Description = $node->getElementsByTagName('description')->item(0)->nodeValue;
    22   $Link = $node->getElementsByTagName('link')->item(0)->nodeValue; 
     22  $Link = $node->getElementsByTagName('link')->item(0)->nodeValue;
    2323  $Date = $node->getElementsByTagName('pubDate')->item(0)->nodeValue;
    24  
     24
    2525  $Description = strip_tags($Description);
    2626  $Description = str_replace("\r", '', $Description);
     
    2929  //  $Date = substr($Date, $CommaPos + 1);
    3030  $Date = TimeToMysqlDateTime(strtotime($Date));
    31  
     31
    3232  $Query = 'SELECT Id FROM News WHERE (`Title`="'.$System->Database->real_escape_string($Title).'") AND (`Category`='.$Category.') AND (`Content` = "'.$System->Database->real_escape_string($Description).'") AND (`Link` = "'.$System->Database->real_escape_string($Link).'")';
    3333  $DbResult = $System->Database->query($Query);
  • trunk/Modules/News/News.php

    r711 r738  
    6767    ));
    6868    $this->System->FormManager->RegisterFormType('TNewsCategory', array(
    69         'Type' => 'Reference',
    70         'Table' => 'NewsCategory',
    71         'Id' => 'Id',
    72         'Name' => 'Caption',
    73         'Filter' => '1',
     69      'Type' => 'Reference',
     70      'Table' => 'NewsCategory',
     71      'Id' => 'Id',
     72      'Name' => 'Caption',
     73      'Filter' => '1',
    7474    ));
    7575    $this->System->FormManager->RegisterFormType('TNewsList', array(
    76         'Type' => 'ManyToOne',
    77         'Table' => 'News',
    78         'Id' => 'Id',
    79         'Ref' => 'Category',
    80         'Filter' => '1',
    81     ));
    82    
     76      'Type' => 'ManyToOne',
     77      'Table' => 'News',
     78      'Id' => 'Id',
     79      'Ref' => 'Category',
     80      'Filter' => '1',
     81    ));
     82
    8383    if($this->System->ModuleManager->ModulePresent('Search'))
    8484    {
  • trunk/Modules/OpeningHours/OpeningHours.php

    r586 r738  
    1010  var $EventType = array('Žádný', 'Otevřeno', 'Zavřeno');
    1111  var $ParentClass = 'PagePortal';
    12  
     12
    1313  function ToHumanTime($Time)
    1414  {
    1515    $Hours = floor($Time / 60);
    1616    $Minutes = $Time - $Hours * 60;
    17     if($Minutes < 10) $Minutes = '0'.$Minutes;   
     17    if($Minutes < 10) $Minutes = '0'.$Minutes;
    1818    $Hours = $Hours % 24;
    1919    return($Hours.':'.$Minutes);
    20   } 
     20  }
    2121
    2222  function ToHumanTime2($Time)
     
    3333    return($Output);
    3434  }
    35  
     35
    3636  function EditSubject($Id)
    3737  {
     
    7272    return($Output);
    7373  }
    74  
     74
    7575  function SaveSubject($Id)
    7676  {
    7777    global $Config;
    78    
     78
    7979    $Output = '';
    8080    if($this->System->User->CheckPermission('OpeningHours', 'Edit'))
     
    9797        $Day['Close2'] = $_POST['day'.$Index.'_close2_m'] + $_POST['day'.$Index.'_close2_h'] * 60;
    9898        $this->Database->insert('SubjectOpenTimeDay', $Day);
    99       }   
    100       $Output .= 'Uloženo'; 
    101      
     99      }
     100      $Output .= 'Uloženo';
     101
    102102      $File = new File($this->Database);
    103103
     
    112112    } else $Output = 'Nemáte oprávnění';
    113113    return($Output);
    114   } 
    115  
     114  }
     115
    116116  function ShowAll()
    117117  {
     
    121121    {
    122122      $Output .= '<strong>'.$Subject['Name'].':</strong><br />';
    123    
     123
    124124      // Load time event list
    125125      $Events = array();
     
    139139      }
    140140      //print_r($Events);
    141      
     141
    142142      // Calculate time to next event
    143143      if(count($Events) > 0)
    144144      {
    145145        $CurrentTime = ((date('w') + 6) % 7) * 24 * 60 + date('G') * 60 + date('i');
    146      
     146
    147147        $I = 0;
    148         while(($I < count($Events)) and ($Events[$I]['Time'] < $CurrentTime)) 
     148        while(($I < count($Events)) and ($Events[$I]['Time'] < $CurrentTime))
    149149          $I++;
    150150        if($I < count($Events))
     
    152152          $NextTime = $Events[$I]['Time'];
    153153          $NextEventType = $Events[$I]['Type'];
    154         } else 
     154        } else
    155155        {
    156156          $NextTime = $Events[0]['Time'] + 7 * 24 * 60;
    157157          $NextEventType = $Events[0]['Type'];
    158158        }
    159      
     159
    160160        $TimeDelta = $NextTime - $CurrentTime;
    161161        //$Output .= $CurrentTime.' '.$NextTime;
     
    163163          else $Output .= 'Otevírá za '.$this->ToHumanTime2($TimeDelta);
    164164      }
    165      
    166       // Show time inteval table 
     165
     166      // Show time inteval table
    167167      $Output .= '<table class="WideTable"><tr><th>Den</th><th>Čas</th></tr>';
    168168      foreach($this->DaysOfWeek as $DayIndex => $DayOfWeek)
     
    187187      $Output .= '</table>Aktualizováno: '.$Subject['UpdateTime'].'<br />';
    188188      if($Subject['Notice'] != '') $Output .= 'Poznámka: '.$Subject['Notice'].'<br />';
    189      
     189
    190190      if($Subject['Photo'] != 0) $Output .= '<a href="file?id='.$Subject['Photo'].'">Fotka</a> ';
    191      
     191
    192192      if($this->System->User->CheckPermission('SubjectOpenTime', 'Edit'))
    193193        $Output .= '<a href="edit?Subject='.$Subject['Id'].'">Editovat</a><br />';
     
    197197    return($Output);
    198198  }
    199  
     199
    200200  function Show()
    201201  {
    202202    if(count($this->System->PathItems) > 1)
    203     { 
     203    {
    204204      if($this->System->PathItems[1] == 'edit') $Output = $this->EditSubject($_GET['Subject']);
    205       else if($this->System->PathItems[1] == 'save') 
     205      else if($this->System->PathItems[1] == 'save')
    206206      {
    207207        $Output = $this->SaveSubject($_GET['Subject']);
    208208        $Output .= $this->ShowAll();
    209       } else $Output = PAGE_NOT_FOUND;       
    210     } else $Output = $this->ShowAll();   
     209      } else $Output = PAGE_NOT_FOUND;
     210    } else $Output = $this->ShowAll();
    211211    return($Output);
    212212  }
     
    225225    $this->Dependencies = array();
    226226  }
    227  
     227
    228228  function DoStart()
    229229  {
    230230    $this->System->Pages['otviraci-doby'] = 'PageSubjectOpenTime';
    231231  }
    232  
     232
    233233  function DoInstall()
    234234  {
  • trunk/Modules/Portal/Portal.php

    r737 r738  
    6363    while($Action = $DbResult->fetch_assoc())
    6464    {
    65         $Output .= $this->System->ShowAction($Action['Id']).'<br/>';
     65      $Output .= $this->System->ShowAction($Action['Id']).'<br/>';
    6666    }
    6767    return($this->Panel($ActionGroup['Name'], $Output));
  • trunk/Modules/RSS/RSS.php

    r670 r738  
    1919  function Start()
    2020  {
    21         $this->System->RegisterPage('rss', 'PageRSS');
     21    $this->System->RegisterPage('rss', 'PageRSS');
    2222  }
    2323
     
    4242    $Output = '';
    4343    foreach($this->RSSChannels as $Channel)
    44                 {
    45                   if($this->System->User->Licence($Channel['Permission']))
    46                           $Output .= ' <link rel="alternate" title="'.$Channel['Title'].'" href="'.
    47                         $this->System->Link('/rss/?channel='.$Channel['Channel']).'" type="application/rss+xml" />';
    48                 }
     44    {
     45      if($this->System->User->Licence($Channel['Permission']))
     46        $Output .= ' <link rel="alternate" title="'.$Channel['Title'].'" href="'.
     47          $this->System->Link('/rss/?channel='.$Channel['Channel']).'" type="application/rss+xml" />';
     48    }
    4949    return($Output);
    5050  }
     
    5353class PageRSS extends Page
    5454{
    55         function Show()
    56         {
    57           $this->ClearPage = true;
     55  function Show()
     56  {
     57    $this->ClearPage = true;
    5858
    59           if(array_key_exists('channel', $_GET)) $ChannelName = $_GET['channel'];
    60             else $ChannelName = '';
    61           if(array_key_exists('token', $_GET)) $Token = $_GET['token'];
    62             else $Token = '';
    63           if(array_key_exists($ChannelName, $this->System->ModuleManager->Modules['RSS']->RSSChannels))
    64           {
    65             $Channel = $this->System->ModuleManager->Modules['RSS']->RSSChannels[$ChannelName];
    66             if($this->System->User->CheckPermission($Channel['Permission']['Module'], $Channel['Permission']['Operation']) or
    67             $this->System->User->CheckToken($Channel['Permission']['Module'], $Channel['Permission']['Operation'], $Token))
    68             {
    69             if(is_string($Channel['Callback'][0]))
    70               {
    71                 $Class = new $Channel['Callback'][0]($this->System);
    72                 $Output = $Class->$Channel['Callback'][1]();
    73               } else $Output = call_user_func($Channel['Callback']);
    74             } else $Output = 'Nemáte oprávnění';
    75           } else $Output = 'Kanál nenalezen';
     59    if(array_key_exists('channel', $_GET)) $ChannelName = $_GET['channel'];
     60      else $ChannelName = '';
     61    if(array_key_exists('token', $_GET)) $Token = $_GET['token'];
     62      else $Token = '';
     63    if(array_key_exists($ChannelName, $this->System->ModuleManager->Modules['RSS']->RSSChannels))
     64    {
     65      $Channel = $this->System->ModuleManager->Modules['RSS']->RSSChannels[$ChannelName];
     66      if($this->System->User->CheckPermission($Channel['Permission']['Module'], $Channel['Permission']['Operation']) or
     67      $this->System->User->CheckToken($Channel['Permission']['Module'], $Channel['Permission']['Operation'], $Token))
     68      {
     69        if(is_string($Channel['Callback'][0]))
     70        {
     71          $Class = new $Channel['Callback'][0]($this->System);
     72          $Output = $Class->$Channel['Callback'][1]();
     73        } else $Output = call_user_func($Channel['Callback']);
     74      } else $Output = 'Nemáte oprávnění';
     75    } else $Output = 'Kanál nenalezen';
    7676    return($Output);
    77         }
     77  }
    7878}
  • trunk/Modules/Scheduler/Scheduler.php

    r735 r738  
    1313    $this->Dependencies = array();
    1414  }
    15  
     15
    1616  function DoStart()
    1717  {
     
    3434      'Table' => 'SchedulerAction',
    3535      'DefaultSortColumn' => 'Name',
    36         'ReadOnly' => true,
     36      'ReadOnly' => true,
    3737      'Items' => array(
    3838        'Name' => array('Type' => 'String', 'Caption' => 'Jméno', 'Default' => '', 'ReadOnly' => true),
     
    4141    ));
    4242    $this->System->FormManager->RegisterFormType('TSchedulerAction', array(
    43         'Type' => 'Reference',
    44         'Table' => 'SchedulerAction',
    45         'Id' => 'Id',
    46         'Name' => 'Name',
    47         'Filter' => '1',
     43      'Type' => 'Reference',
     44      'Table' => 'SchedulerAction',
     45      'Id' => 'Id',
     46      'Name' => 'Name',
     47      'Filter' => '1',
    4848    ));
    4949    $this->System->RegisterCommandLine('run-scheduler', array('ModuleScheduler', 'Run'));
    5050  }
    51  
     51
    5252  function DoInstall()
    5353  {
     
    5555
    5656  function DoUnInstall()
    57   { 
     57  {
    5858  }
    59  
     59
    6060  function Run()
    61   {     
    62         while(true)
    63         {
    64           $DbResult = $this->Database->query('SELECT `Scheduler`.*, `SchedulerAction`.`Class` AS `Class` FROM `Scheduler` '.
    65                 'LEFT JOIN `SchedulerAction` ON `SchedulerAction`.`Id` = `Scheduler`.`Action` '.
    66                 'WHERE (`Scheduler`.`Enabled`=1) AND (((`Scheduler`.`ScheduledTime` < "'.TimeToMysqlDateTime(time()).'") AND '.
    67                 ' (`Scheduler`.`LastExecutedTime` < `Scheduler`.`ScheduledTime`)) OR '.
    68                 '(`Scheduler`.`ScheduledTime` IS NULL))');
    69           while($DbRow = $DbResult->fetch_assoc())
    70           {
    71                 echo('Executing '.$DbRow['Name']."\n");
    72                 $Output = '';
    73             if(class_exists($DbRow['Class']))
    74             {
    75                 $Class = new $DbRow['Class']($this->System);
    76               $Output = $Class->Execute();
    77             } else echo('Class '.$DbRow['Class'].' not found'."\n");
    78                           $this->Database->update('Scheduler', 'Id='.$DbRow['Id'],
    79                           array('Log' => $Output, 'LastExecutedTime' => 'NOW()'));
    80                           if($DbRow['ScheduledTime'] == '') $NewScheduledTime = time() + $DbRow['Period'];
    81                             else $NewScheduledTime = MysqlDateTimeToTime($DbRow['ScheduledTime']) + $DbRow['Period']; 
    82                         if($DbRow['Period'] != '') $this->Database->update('Scheduler', 'Id='.$DbRow['Id'],
    83                                 array('ScheduledTime' => TimeToMysqlDateTime($NewScheduledTime)));                       
    84           }     
    85           echo('.');
    86           sleep(1);
    87         }
     61  {
     62    while(true)
     63    {
     64      $DbResult = $this->Database->query('SELECT `Scheduler`.*, `SchedulerAction`.`Class` AS `Class` FROM `Scheduler` '.
     65        'LEFT JOIN `SchedulerAction` ON `SchedulerAction`.`Id` = `Scheduler`.`Action` '.
     66        'WHERE (`Scheduler`.`Enabled`=1) AND (((`Scheduler`.`ScheduledTime` < "'.TimeToMysqlDateTime(time()).'") AND '.
     67        ' (`Scheduler`.`LastExecutedTime` < `Scheduler`.`ScheduledTime`)) OR '.
     68        '(`Scheduler`.`ScheduledTime` IS NULL))');
     69      while($DbRow = $DbResult->fetch_assoc())
     70      {
     71        echo('Executing '.$DbRow['Name']."\n");
     72        $Output = '';
     73        if(class_exists($DbRow['Class']))
     74        {
     75          $Class = new $DbRow['Class']($this->System);
     76          $Output = $Class->Execute();
     77        } else echo('Class '.$DbRow['Class'].' not found'."\n");
     78        $this->Database->update('Scheduler', 'Id='.$DbRow['Id'],
     79          array('Log' => $Output, 'LastExecutedTime' => 'NOW()'));
     80        if($DbRow['ScheduledTime'] == '') $NewScheduledTime = time() + $DbRow['Period'];
     81          else $NewScheduledTime = MysqlDateTimeToTime($DbRow['ScheduledTime']) + $DbRow['Period'];
     82        if($DbRow['Period'] != '') $this->Database->update('Scheduler', 'Id='.$DbRow['Id'],
     83          array('ScheduledTime' => TimeToMysqlDateTime($NewScheduledTime)));
     84      }
     85      echo('.');
     86      sleep(1);
     87    }
    8888  }
    8989}
     
    9191class SchedulerTask extends Model
    9292{
    93         function Execute()
    94         {
    95         }
     93  function Execute()
     94  {
     95  }
    9696}
  • trunk/Modules/Search/Search.php

    r586 r738  
    1010    $this->ParentClass = 'PagePortal';
    1111  }
    12  
     12
    1313  function Show()
    1414  {
     
    2929        $Columns .= ', `'.$Column.'`';
    3030        $Condition .= ' OR (`'.$Column.'` LIKE "%'.$Text.'%")';
    31       } 
     31      }
    3232      $Columns = substr($Columns, 2);
    3333      $Condition = substr($Condition, 3);
     
    5151  var $Items;
    5252  var $MaxItemCount;
    53  
     53
    5454  function __construct($System)
    5555  {
     
    6464    $this->Items = array();
    6565  }
    66  
     66
    6767  function DoStart()
    6868  {
    6969    $this->System->Pages['search'] = 'PageSearch';
    7070  }
    71  
     71
    7272  function DoInstall()
    7373  {
     
    7575
    7676  function DoUnInstall()
    77   { 
     77  {
    7878  }
    79  
     79
    8080  function RegisterSearch($Title, $TableName, $Columns)
    8181  {
  • trunk/Modules/SpeedTest/SpeedTest.php

    r615 r738  
    2424    $this->Dependencies = array();
    2525  }
    26  
     26
    2727  function DoStart()
    2828  {
    2929    $this->System->Pages['speedtest'] = 'PageSpeedTest';
    30   } 
     30  }
    3131}
    3232
     
    3636  var $ShortTitle = 'Test rychlosti';
    3737  var $ParentClass = 'PagePortal';
    38  
     38
    3939  function Show()
    4040  {
     
    4646    } else return($this->ShowMain());
    4747  }
    48  
     48
    4949  function ShowDownload()
    5050  {
    5151    global $config;
    5252    require_once(dirname(__FILE__)."/download.php");
    53    
     53
    5454  }
    55  
     55
    5656  function ShowMain()
    57   {   
     57  {
    5858    global $config;
    59    
     59
    6060    require_once(dirname(__FILE__)."/common.php");
    6161    ReadConfig(dirname(__FILE__)."/speedtest.cfg");
    62    
     62
    6363## Redirect immediately to download.php if auto_start = 1
    6464if($config->{'general'}->{'auto_start'}) {
     
    7070<head>
    7171<title>'.$config->{'general'}->{'page_title'}.' - Fancy Speed Test</title>
    72 <meta http-equiv="Expires" CONTENT="Fri, Jan 1 1980 00:00:00 GMT" /> 
    73 <meta http-equiv="Pragma" CONTENT="no-cache" /> 
    74 <meta http-equiv="Cache-Control" CONTENT="no-cache" /> 
     72<meta http-equiv="Expires" CONTENT="Fri, Jan 1 1980 00:00:00 GMT" />
     73<meta http-equiv="Pragma" CONTENT="no-cache" />
     74<meta http-equiv="Cache-Control" CONTENT="no-cache" />
    7575<link rel="stylesheet" href="style.css" />
    7676</head>
     
    8989    ## Include "welcome.html" for a custom welcome page, if the file exists
    9090    include("welcome.html");
    91 } else { 
     91} else {
    9292    ## Else print a standard welcome message
    9393
  • trunk/Modules/SpeedTest/download.php

    r560 r738  
    3838        ## Intial test is done.  Set down/upload sizes to the same as
    3939        ## our initial measured speeds.   That way the test should take
    40         ## about 8 seconds for each test (up/down) making it about a 
     40        ## about 8 seconds for each test (up/down) making it about a
    4141        ## 16 second test
    4242        $down_kbytes = $_GET['downspeed'];
     
    4646        $down_kbytes = $config->{'download'}->{'initial_kbytes'};
    4747        $up_kbytes = $config->{'upload'}->{'initial_kbytes'};
    48    } 
     48   }
    4949} else {
    5050    ## auto_size is off.  Just to the default sizes
     
    8484<head>
    8585<title><?php print $config->{'general'}->{'page_title'}; ?> - Fancy Speed Test</title>
    86 <meta http-equiv="Expires" CONTENT="Fri, Jan 1 1980 00:00:00 GMT" /> 
    87 <meta http-equiv="Pragma" CONTENT="no-cache" /> 
    88 <meta http-equiv="Cache-Control" CONTENT="no-cache" /> 
     86<meta http-equiv="Expires" CONTENT="Fri, Jan 1 1980 00:00:00 GMT" />
     87<meta http-equiv="Pragma" CONTENT="no-cache" />
     88<meta http-equiv="Cache-Control" CONTENT="no-cache" />
    8989<link rel="stylesheet" href="style.css" />
    9090</head>
    9191<body>
    9292
    93 <?php 
     93<?php
    9494if(file_exists("header.html")) {
    9595    ## Include "header.html" for a custom header, if the file exists
    9696    include("header.html");
    97 } else { 
     97} else {
    9898    ## Else just print a plain header
    9999    print "<br /><br /><br /><br />\n";
     
    102102<div id="speedtest_contents">
    103103
    104 <?php 
    105 if( ($config_auto_size) && (! isset($_GET['auto_size'])) ) { 
     104<?php
     105if( ($config_auto_size) && (! isset($_GET['auto_size'])) ) {
    106106    ## auto_size is performing the initial, small test
    107107    print "<div>Calculating appropriate file sizes for testing</div>\n";
    108     ob_flush(); 
     108    ob_flush();
    109109} else {
    110110?>
     
    190190    }
    191191}
    192    
     192
    193193
    194194// -->
     
    218218
    219219    ## Read some stuff from our payload file
    220         $data_file = "payload.js";
    221         $fd = fopen ($data_file, "r");
     220  $data_file = "payload.js";
     221  $fd = fopen ($data_file, "r");
    222222    $data = fread ($fd, $each_chunk * 1024);
    223223
     
    281281    CompleteDownloadBar();
    282282
    283         time          = new Date();
    284         endtime       = time.getTime();
    285         if (endtime == starttime)
    286                 {downloadtime = 0
    287         } else {
    288             downloadtime = (endtime - starttime)/1000;
    289         }
     283  time          = new Date();
     284  endtime       = time.getTime();
     285  if (endtime == starttime)
     286    {downloadtime = 0
     287  } else {
     288      downloadtime = (endtime - starttime)/1000;
     289  }
    290290    <?php if(! $config->{'upload'}->{'skip_upload'}){ ?> StartUpload(); <?php } ?>
    291291
    292         down_size = <?php echo $total_kbytes; ?>;
    293         downspeed     = down_size/downloadtime;
    294         downspeed          = (Math.round((downspeed*8)*10*1.024))/10;
     292  down_size = <?php echo $total_kbytes; ?>;
     293  downspeed     = down_size/downloadtime;
     294  downspeed          = (Math.round((downspeed*8)*10*1.024))/10;
    295295
    296296    formElement = document.getElementById('upload_test_form');
    297297
    298 <?php 
     298<?php
    299299if($config_auto_size && (! isset($_GET['auto_size'])) ) {
    300300    $params_auto_size = "&auto_size=1";
  • trunk/Modules/SpeedTest/results.php

    r331 r738  
    4949<head>
    5050<title><?php print $config->{'general'}->{'page_title'}; ?> - Fancy  Speed Test</title>
    51 <meta http-equiv="Expires" CONTENT="Fri, Jan 1 1980 00:00:00 GMT" /> 
    52 <meta http-equiv="Pragma" CONTENT="no-cache" /> 
    53 <meta http-equiv="Cache-Control" CONTENT="no-cache" /> 
     51<meta http-equiv="Expires" CONTENT="Fri, Jan 1 1980 00:00:00 GMT" />
     52<meta http-equiv="Pragma" CONTENT="no-cache" />
     53<meta http-equiv="Cache-Control" CONTENT="no-cache" />
    5454<link rel="stylesheet" href="style.css" />
    5555</head>
    5656<body>
    5757
    58 <?php 
     58<?php
    5959if(file_exists("header.html")) {
    6060    ## Include "header.html" for a custom header, if the file exists
    6161    include("header.html");
    62 } else { 
     62} else {
    6363    ## Else just print a plain header
    6464    print "<center>\n";
     
    118118        print "</table>\n";
    119119        }
    120        
     120
    121121?>
    122122
  • trunk/Modules/Stock/Stock.php

    r736 r738  
    6868          'ReadOnly' => true, 'SQL' => '(SELECT SUM(`SellPrice`) FROM `StockSerialNumber` WHERE '.
    6969          '(`StockSerialNumber`.`Stock`=#Id) AND (`StockSerialNumber`.`TimeElimination` IS NULL))', 'Suffix' => 'Kč'),
    70         'Moves' => array('Type' => 'TStockMoveStock', 'Caption' => 'Pohyby', 'Default' => ''),
     70        'Moves' => array('Type' => 'TStockMoveStock', 'Caption' => 'Pohyby', 'Default' => ''),
    7171      ),
    7272    ));
     
    7878        'DocumentLine' => array('Type' => 'TDocumentLine', 'Caption' => 'Dokladová řada', 'Default' => ''),
    7979        'BillCode' => array('Type' => 'String', 'Caption' => 'Označení', 'Default' => ''),
    80         'Time' => array('Type' => 'DateTime', 'Caption' => 'Čas', 'Default' => ''),
    81         'StockFrom' => array('Type' => 'TStock', 'Caption' => 'Zdrojový sklad', 'Default' => '', 'Null' => true),
    82         'StockTo' => array('Type' => 'TStock', 'Caption' => 'Cílový sklad', 'Default' => '', 'Null' => true),
     80        'Time' => array('Type' => 'DateTime', 'Caption' => 'Čas', 'Default' => ''),
     81        'StockFrom' => array('Type' => 'TStock', 'Caption' => 'Zdrojový sklad', 'Default' => '', 'Null' => true),
     82        'StockTo' => array('Type' => 'TStock', 'Caption' => 'Cílový sklad', 'Default' => '', 'Null' => true),
    8383        'File' => array('Type' => 'TFile', 'Caption' => 'Doklad', 'Default' => '', 'Null' => true),
    8484        'Price' => array('Type' => 'Float', 'Caption' => 'Cena', 'Default' => '',
    8585          'ReadOnly' => true, 'Suffix' => 'Kč', 'SQL' => '(SELECT SUM(`StockMoveItem`.`UnitPrice` * `StockMoveItem`.`Amount`) FROM `StockMoveItem` '.
    8686          'WHERE `StockMoveItem`.`StockMove`=#Id)'),
    87         'Items' => array('Type' => 'TStockMoveItemListStockMove', 'Caption' => 'Položky', 'Default' => ''),
    88       ),       
     87        'Items' => array('Type' => 'TStockMoveItemListStockMove', 'Caption' => 'Položky', 'Default' => ''),
     88      ),
    8989      'BeforeInsert' => array($this, 'BeforeInsertStockMove'),
    9090    ));
     
    9393      'BaseTable' => 'StockMove',
    9494      'DefaultSortColumn' => 'Time',
    95         'SQL' => '(SELECT *, -1 AS `Direction`, `StockFrom` AS `Stock`, `StockTo` AS `StockOther` FROM `StockMove`) '.
    96                 'UNION (SELECT *, 1 AS `Direction`, `StockTo` AS `Stock`, `StockFrom` AS `StockOther` FROM `StockMove`)',
     95      'SQL' => '(SELECT *, -1 AS `Direction`, `StockFrom` AS `Stock`, `StockTo` AS `StockOther` FROM `StockMove`) '.
     96        'UNION (SELECT *, 1 AS `Direction`, `StockTo` AS `Stock`, `StockFrom` AS `StockOther` FROM `StockMove`)',
    9797      'Items' => array(
    9898        'DocumentLine' => array('Type' => 'TDocumentLine', 'Caption' => 'Dokladová řada', 'Default' => ''),
    9999        'BillCode' => array('Type' => 'String', 'Caption' => 'Označení', 'Default' => ''),
    100         'Time' => array('Type' => 'DateTime', 'Caption' => 'Čas', 'Default' => ''),
    101         'Stock' => array('Type' => 'TStock', 'Caption' => 'První sklad', 'Default' => '', 'Null' => true),
    102         'StockOther' => array('Type' => 'TStock', 'Caption' => 'Druhý sklad', 'Default' => '', 'Null' => true),
     100        'Time' => array('Type' => 'DateTime', 'Caption' => 'Čas', 'Default' => ''),
     101        'Stock' => array('Type' => 'TStock', 'Caption' => 'První sklad', 'Default' => '', 'Null' => true),
     102        'StockOther' => array('Type' => 'TStock', 'Caption' => 'Druhý sklad', 'Default' => '', 'Null' => true),
    103103        'File' => array('Type' => 'TFile', 'Caption' => 'Doklad', 'Default' => '', 'Null' => true),
    104104        'Price' => array('Type' => 'Float', 'Caption' => 'Cena', 'Default' => '',
    105105          'ReadOnly' => true, 'Suffix' => 'Kč', 'SQL' => '(SELECT `TX`.`Direction` * SUM(`StockMoveItem`.`UnitPrice` * `StockMoveItem`.`Amount`) FROM `StockMoveItem` '.
    106106          'WHERE `StockMoveItem`.`StockMove`=#Id)'),
    107         'Items' => array('Type' => 'TStockMoveItemListStockMove', 'Caption' => 'Položky', 'Default' => ''),
    108       ),       
     107        'Items' => array('Type' => 'TStockMoveItemListStockMove', 'Caption' => 'Položky', 'Default' => ''),
     108      ),
    109109      'BeforeInsert' => array($this, 'BeforeInsertStockMove'),
    110110    ));
     
    116116        'StockMove' => array('Type' => 'TStockMove', 'Caption' => 'Skladový pohyb', 'Default' => ''),
    117117        'Product' => array('Type' => 'TProduct', 'Caption' => 'Produkt', 'Default' => ''),
    118         'Amount' => array('Type' => 'Integer', 'Caption' => 'Množství', 'Default' => '1'),
    119         'Text' => array('Type' => 'String', 'Caption' => 'Text', 'Default' => ''),
     118        'Amount' => array('Type' => 'Integer', 'Caption' => 'Množství', 'Default' => '1'),
     119        'Text' => array('Type' => 'String', 'Caption' => 'Text', 'Default' => ''),
    120120        'UnitPrice' => array('Type' => 'Integer', 'Caption' => 'Jednotková cena', 'Default' => '0', 'Suffix' => 'Kč'),
    121       ),       
     121      ),
    122122    ));
    123123    $this->System->FormManager->RegisterFormType('TStockMoveItemListStockMove', array(
     
    127127      'Ref' => 'StockMove',
    128128      'Filter' => '1',
    129     )); 
     129    ));
    130130    $this->System->FormManager->RegisterFormType('TStockMoveStock', array(
    131131      'Type' => 'ManyToOne',
     
    134134      'Ref' => 'Stock',
    135135      'Filter' => '1',
    136     ));     
     136    ));
    137137    $this->System->FormManager->RegisterFormType('TStockMove', array(
    138138      'Type' => 'Reference',
     
    167167  function BeforeInsertStockMove($Form)
    168168  {
    169         if(array_key_exists('Time', $Form->Values)) $Year = date("Y", $Form->Values['Time']);
    170           else $Year = date("Y", $Form->Values['ValidFrom']);
     169    if(array_key_exists('Time', $Form->Values)) $Year = date("Y", $Form->Values['Time']);
     170      else $Year = date("Y", $Form->Values['ValidFrom']);
    171171    $DocumentLine = $Form->Values['DocumentLine'];
    172172    $Form->Values['BillCode'] = $this->System->Modules['Finance']->GetNextDocumentLineNumber($DocumentLine, $Year);
  • trunk/Modules/Subject/Subject.php

    r727 r738  
    2828        'AddressCountry' => array('Type' => 'TCountry', 'Caption' => 'Země', 'Default' => ''),
    2929        'IC' => array('Type' => 'String', 'Caption' => 'IČ', 'Default' => ''),
    30         'DIC' => array('Type' => 'String', 'Caption' => 'DIČ', 'Default' => ''),       
     30        'DIC' => array('Type' => 'String', 'Caption' => 'DIČ', 'Default' => ''),
    3131        'MapPosition' => array('Type' => 'TMapPosition', 'Caption' => 'Pozice na mapě', 'Default' => '', 'Null' => true),
    3232        'WWW' => array('Type' => 'Hyperlink', 'Caption' => 'WWW', 'Default' => ''),
     
    3939          'WHERE `FinanceOperation`.`Subject`=#Id), 0) - IFNULL((SELECT SUM(`FinanceInvoice`.`Value` * `FinanceInvoice`.`Direction`) FROM `FinanceInvoice` '.
    4040          'WHERE `FinanceInvoice`.`Subject`=#Id), 0)'),
    41         'BankAccounts' => array('Type' => 'TFinanceBankAccountListSubject', 'Caption' => 'Bankovní účety', 'Default' => ''),
     41        'BankAccounts' => array('Type' => 'TFinanceBankAccountListSubject', 'Caption' => 'Bankovní účety', 'Default' => ''),
    4242      ),
    4343    ));
  • trunk/Modules/System/System.php

    r731 r738  
    22
    33class PageModules extends Page
    4 { 
     4{
    55  function __construct($System)
    66  {
     
    1010    $this->ParentClass = 'PagePortal';
    1111  }
    12  
     12
    1313  function ShowList()
    1414  {
     
    1717    $DbRow = $DbResult->fetch_row();
    1818    $PageList = GetPageList($DbRow[0]);
    19    
     19
    2020    $Output .= $PageList['Output'];
    2121    $Output .= '<table class="WideTable" style="font-size: small;">';
    22      
     22
    2323    $TableColumns = array(
    2424      array('Name' => 'Name', 'Title' => 'Jméno'),
     
    3737        'WHERE `ModuleLink`.`Module` = `Module`.`Id`) AS `Dependencies` '.
    3838        'FROM `Module` '.$Order['SQL'].$PageList['SQLLimit'];
    39    
     39
    4040    $DbResult = $this->Database->query($Query);
    4141    while($Module = $DbResult->fetch_assoc())
     
    5959    $Output .= $PageList['Output'];
    6060    $Output .= '<p><a href="?A=SaveToDb">Uložit do databáze</a></p>';
    61     return($Output);   
    62   }
    63  
     61    return($Output);
     62  }
     63
    6464  function Show()
    65   {   
     65  {
    6666    $Output = '';
    6767    if(array_key_exists('A', $_GET))
    6868    {
    69       if($_GET['A'] == 'SaveToDb') 
     69      if($_GET['A'] == 'SaveToDb')
    7070      {
    7171        $Output .= $this->System->ModuleManager->Modules['System']->SaveToDatabase();
    72         $Output .= $this->SystemMessage('Načtení modulů', 'Seznam modulů v databázi zaktualizován');   
     72        $Output .= $this->SystemMessage('Načtení modulů', 'Seznam modulů v databázi zaktualizován');
    7373      } else
    74       if($_GET['A'] == 'Install') 
     74      if($_GET['A'] == 'Install')
    7575      {
    7676        $this->System->ModuleManager->LoadModules(false);
    7777        $ModuleName = $this->System->ModuleManager->SearchModuleById($_GET['Id']);
    78         if($ModuleName != '') 
     78        if($ModuleName != '')
    7979        {
    8080          $this->System->Modules[$ModuleName]->Install();
    8181          $this->System->ModuleManager->Init();
    8282        } else $Output .= 'Modul id '.$_GET['Id'].' nenalezen';
    83        
     83
    8484      } else
    85       if($_GET['A'] == 'Uninstall') 
     85      if($_GET['A'] == 'Uninstall')
    8686      {
    8787        $ModuleName = $this->System->ModuleManager->SearchModuleById($_GET['Id']);
    88         if($ModuleName != '') 
     88        if($ModuleName != '')
    8989        {
    9090          $this->System->ModuleManager->Modules[$ModuleName]->UnInstall();
    9191          $this->System->ModuleManager->Init();
    9292        } else $Output .= 'Modul id '.$_GET['Id'].' nenalezen';
    93       } else $Output .= 'Neplatná akce';         
     93      } else $Output .= 'Neplatná akce';
    9494    }
    9595    $Output .= $this->ShowList();
    96     return($Output);   
    97   }
    98 } 
     96    return($Output);
     97  }
     98}
    9999
    100100class ModuleSystem extends AppModule
    101101{
    102102  var $InstalledChecked;
    103        
     103
    104104  function __construct($System)
    105105  {
     
    112112    $this->Dependencies = array();
    113113  }
    114  
     114
    115115  function DoInstall()
    116116  {
     
    131131  PRIMARY KEY (`Id`)
    132132) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=1;');
    133    
     133
    134134    $this->Database->query('CREATE TABLE IF NOT EXISTS `SystemModuleDependency` (
    135135  `Id` int(11) NOT NULL AUTO_INCREMENT,
     
    143143    $this->Database->query('ALTER TABLE `SystemModuleDependency` ADD CONSTRAINT `SystemModuleDependency_ibfk_1` FOREIGN KEY ( `Module` ) REFERENCES `SystemModule` (`Id`)');
    144144    $this->Database->query('ALTER TABLE `SystemModuleDependency` ADD CONSTRAINT `SystemModuleDependency_ibfk_2` FOREIGN KEY ( `DependencyModule` ) REFERENCES `SystemModule` (`Id`)');
    145    
     145
    146146    $this->Database->query('CREATE TABLE IF NOT EXISTS `SystemModel` (
    147147  `Id` int(11) NOT NULL AUTO_INCREMENT,
     
    152152) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=1;');
    153153    $this->Database->query('ALTER TABLE `SystemModel` ADD CONSTRAINT `SystemModel_ibfk_1` FOREIGN KEY ( `Module` ) REFERENCES `SystemModule` (`Id`)');
    154    
     154
    155155    $this->Database->query('CREATE TABLE IF NOT EXISTS `SystemModelProperty` (
    156156  `Id` int(11) NOT NULL AUTO_INCREMENT,
     
    163163    $this->Database->query('ALTER TABLE `SystemModelProperty` ADD CONSTRAINT `SystemModelProperty_ibfk_1` FOREIGN KEY ( `Model` ) REFERENCES `SystemModel` (`Id`)');
    164164  }
    165  
     165
    166166  function DoUnInstall()
    167167  {
     
    220220    ));
    221221    $this->System->FormManager->RegisterClass('Module', array(
    222         'Title' => 'Moduly',
    223           'Table' => 'Module',
    224           'Items' => array(
    225                 'Name' => array('Type' => 'String', 'Caption' => 'Systémové jméno', 'Default' => ''),
    226                   'Title' => array('Type' => 'String', 'Caption' => 'Název', 'Default' => ''),
    227                 'Description' => array('Type' => 'Text', 'Caption' => 'Popis', 'Default' => ''),
    228                 'Version' => array('Type' => 'String', 'Caption' => 'Verze', 'Default' => ''),
    229                 'License' => array('Type' => 'String', 'Caption' => 'Licence', 'Default' => ''),
    230                 'Creator' => array('Type' => 'String', 'Caption' => 'Tvůrce', 'Default' => ''),
    231         'HomePage' => array('Type' => 'Hyperlink', 'Caption' => 'Domovské stránky', 'Default' => ''),           
    232                 'Installed' => array('Type' => 'Boolean', 'Caption' => 'Instalováno', 'Default' => '', 'ReadOnly' => true),
    233                 'Models' => array('Type' => 'TModelListModule', 'Caption' => 'Modely', 'Default' => ''),
    234                 'Links' => array('Type' => 'TModuleLinkListModule', 'Caption' => 'Vazby', 'Default' => ''),
    235           ),
    236         'Actions' => array(
    237                 array('Caption' => 'Aktualizovat z disku', 'URL' => '/module/?A=SaveToDb'),
    238           ),
     222      'Title' => 'Moduly',
     223      'Table' => 'Module',
     224      'Items' => array(
     225        'Name' => array('Type' => 'String', 'Caption' => 'Systémové jméno', 'Default' => ''),
     226        'Title' => array('Type' => 'String', 'Caption' => 'Název', 'Default' => ''),
     227        'Description' => array('Type' => 'Text', 'Caption' => 'Popis', 'Default' => ''),
     228        'Version' => array('Type' => 'String', 'Caption' => 'Verze', 'Default' => ''),
     229        'License' => array('Type' => 'String', 'Caption' => 'Licence', 'Default' => ''),
     230        'Creator' => array('Type' => 'String', 'Caption' => 'Tvůrce', 'Default' => ''),
     231        'HomePage' => array('Type' => 'Hyperlink', 'Caption' => 'Domovské stránky', 'Default' => ''),
     232        'Installed' => array('Type' => 'Boolean', 'Caption' => 'Instalováno', 'Default' => '', 'ReadOnly' => true),
     233        'Models' => array('Type' => 'TModelListModule', 'Caption' => 'Modely', 'Default' => ''),
     234        'Links' => array('Type' => 'TModuleLinkListModule', 'Caption' => 'Vazby', 'Default' => ''),
     235      ),
     236      'Actions' => array(
     237        array('Caption' => 'Aktualizovat z disku', 'URL' => '/module/?A=SaveToDb'),
     238      ),
    239239    ));
    240240    $this->System->FormManager->RegisterFormType('TModule', array(
    241         'Type' => 'Reference',
    242         'Table' => 'Module',
    243         'Id' => 'Id',
    244         'Name' => 'Title',
    245         'Filter' => '1',
     241      'Type' => 'Reference',
     242      'Table' => 'Module',
     243      'Id' => 'Id',
     244      'Name' => 'Title',
     245      'Filter' => '1',
    246246    ));
    247247    $this->System->FormManager->RegisterFormType('TModelListModule', array(
     
    253253    ));
    254254    $this->System->FormManager->RegisterClass('Model', array(
    255         'Title' => 'Modely',
    256           'Table' => 'Model',
    257           'Items' => array(
    258                 'Name' => array('Type' => 'String', 'Caption' => 'Systémové jméno', 'Default' => ''),
    259                   'Title' => array('Type' => 'String', 'Caption' => 'Název', 'Default' => ''),
    260                 'Module' => array('Type' => 'TModule', 'Caption' => 'Module', 'Default' => ''),
    261             'Query' => array('Type' => 'String', 'Caption' => 'SQL dotaz', 'Default' => ''),
    262                 'DefaultSortColumn' => array('Type' => 'String', 'Caption' => 'Výchozí sloupce řazení', 'Default' => ''),
    263                 'DefaultSortOrder' => array('Type' => 'Text', 'Caption' => 'Výchozí směr řazení', 'Default' => ''),
    264                 'Fields' => array('Type' => 'TModelFieldListModel', 'Caption' => 'Pole', 'Default' => ''),
    265           ),
     255      'Title' => 'Modely',
     256      'Table' => 'Model',
     257      'Items' => array(
     258        'Name' => array('Type' => 'String', 'Caption' => 'Systémové jméno', 'Default' => ''),
     259        'Title' => array('Type' => 'String', 'Caption' => 'Název', 'Default' => ''),
     260        'Module' => array('Type' => 'TModule', 'Caption' => 'Module', 'Default' => ''),
     261        'Query' => array('Type' => 'String', 'Caption' => 'SQL dotaz', 'Default' => ''),
     262        'DefaultSortColumn' => array('Type' => 'String', 'Caption' => 'Výchozí sloupce řazení', 'Default' => ''),
     263        'DefaultSortOrder' => array('Type' => 'Text', 'Caption' => 'Výchozí směr řazení', 'Default' => ''),
     264        'Fields' => array('Type' => 'TModelFieldListModel', 'Caption' => 'Pole', 'Default' => ''),
     265      ),
    266266    ));
    267267    $this->System->FormManager->RegisterFormType('TModel', array(
    268         'Type' => 'Reference',
    269         'Table' => 'Model',
    270         'Id' => 'Id',
    271         'Name' => 'Title',
    272         'Filter' => '1',
     268      'Type' => 'Reference',
     269      'Table' => 'Model',
     270      'Id' => 'Id',
     271      'Name' => 'Title',
     272      'Filter' => '1',
    273273    ));
    274274    $this->System->FormManager->RegisterFormType('TModelFieldListModel', array(
     
    280280    ));
    281281    $this->System->FormManager->RegisterClass('ModelField', array(
    282         'Title' => 'Pole modelu',
    283           'Table' => 'ModelField',
    284           'Items' => array(
    285                 'Name' => array('Type' => 'String', 'Caption' => 'Systémové jméno', 'Default' => ''),
    286                   'Title' => array('Type' => 'String', 'Caption' => 'Název', 'Default' => ''),
    287                 'Model' => array('Type' => 'TModel', 'Caption' => 'Model', 'Default' => ''),
    288             'Query' => array('Type' => 'String', 'Caption' => 'SQL dotaz', 'Default' => ''),
    289                 'Type' => array('Type' => 'String', 'Caption' => 'Typ', 'Default' => ''),
    290                 'DefaultValue' => array('Type' => 'String', 'Caption' => 'Výchozí hodnota', 'Default' => ''),
    291                 'IsNull' => array('Type' => 'Boolean', 'Caption' => 'Také nulová hodnota', 'Default' => ''),
    292                 'Suffix' => array('Type' => 'String', 'Caption' => 'Text za', 'Default' => ''),
    293           ),
     282      'Title' => 'Pole modelu',
     283      'Table' => 'ModelField',
     284      'Items' => array(
     285        'Name' => array('Type' => 'String', 'Caption' => 'Systémové jméno', 'Default' => ''),
     286        'Title' => array('Type' => 'String', 'Caption' => 'Název', 'Default' => ''),
     287        'Model' => array('Type' => 'TModel', 'Caption' => 'Model', 'Default' => ''),
     288        'Query' => array('Type' => 'String', 'Caption' => 'SQL dotaz', 'Default' => ''),
     289        'Type' => array('Type' => 'String', 'Caption' => 'Typ', 'Default' => ''),
     290        'DefaultValue' => array('Type' => 'String', 'Caption' => 'Výchozí hodnota', 'Default' => ''),
     291        'IsNull' => array('Type' => 'Boolean', 'Caption' => 'Také nulová hodnota', 'Default' => ''),
     292        'Suffix' => array('Type' => 'String', 'Caption' => 'Text za', 'Default' => ''),
     293      ),
    294294    ));
    295295    $this->System->FormManager->RegisterFormType('TModuleLink', array(
    296         'Type' => 'Reference',
    297         'Table' => 'ModuleLink',
    298         'Id' => 'Id',
    299         'Name' => 'Module',
    300         'Filter' => '1',
     296      'Type' => 'Reference',
     297      'Table' => 'ModuleLink',
     298      'Id' => 'Id',
     299      'Name' => 'Module',
     300      'Filter' => '1',
    301301    ));
    302302    $this->System->FormManager->RegisterFormType('TModuleLinkListModule', array(
     
    308308    ));
    309309    $this->System->FormManager->RegisterClass('ModuleLink', array(
    310         'Title' => 'Vazby modulu',
    311           'Table' => 'ModuleLink',
    312           'Items' => array(
    313                 'Module' => array('Type' => 'TModule', 'Caption' => 'Modul', 'Default' => ''),
    314                 'LinkedModule' => array('Type' => 'TModule', 'Caption' => 'Vázaný modul', 'Default' => ''),
    315             'Type' => array('Type' => 'String', 'Caption' => 'Typ vazby', 'Default' => ''),
    316           ),
     310      'Title' => 'Vazby modulu',
     311      'Table' => 'ModuleLink',
     312      'Items' => array(
     313        'Module' => array('Type' => 'TModule', 'Caption' => 'Modul', 'Default' => ''),
     314        'LinkedModule' => array('Type' => 'TModule', 'Caption' => 'Vázaný modul', 'Default' => ''),
     315        'Type' => array('Type' => 'String', 'Caption' => 'Typ vazby', 'Default' => ''),
     316      ),
    317317    ));
    318318    $this->System->FormManager->RegisterClass('Language', array(
    319         'Title' => 'Jazyky',
    320           'Table' => 'Language',
    321           'DefaultSortColumn' => 'Name',
    322           'Items' => array(
    323                 'Name' => array('Type' => 'String', 'Caption' => 'Jméno', 'Default' => ''),                     
    324           ),
     319      'Title' => 'Jazyky',
     320      'Table' => 'Language',
     321      'DefaultSortColumn' => 'Name',
     322      'Items' => array(
     323        'Name' => array('Type' => 'String', 'Caption' => 'Jméno', 'Default' => ''),
     324      ),
    325325    ));
    326326    $this->System->FormManager->RegisterClass('UnitOfMeasure', array(
    327         'Title' => 'Měrné jednotky',
    328           'Table' => 'UnitOfMeasure',
    329           'DefaultSortColumn' => 'Name',
    330           'Items' => array(
    331                         'Name' => array('Type' => 'String', 'Caption' => 'Jméno', 'Default' => ''),
    332                         'Unit' => array('Type' => 'String', 'Caption' => 'Jednotka', 'Default' => ''),
    333           ),
     327      'Title' => 'Měrné jednotky',
     328      'Table' => 'UnitOfMeasure',
     329      'DefaultSortColumn' => 'Name',
     330      'Items' => array(
     331        'Name' => array('Type' => 'String', 'Caption' => 'Jméno', 'Default' => ''),
     332        'Unit' => array('Type' => 'String', 'Caption' => 'Jednotka', 'Default' => ''),
     333      ),
    334334    ));
    335335    $this->System->FormManager->RegisterClass('Country', array(
    336         'Title' => 'Země',
    337           'Table' => 'Country',
    338           'DefaultSortColumn' => 'Name',
    339           'Items' => array(
    340                 'Name' => array('Type' => 'String', 'Caption' => 'Jméno', 'Default' => ''),
    341           ),
     336      'Title' => 'Země',
     337      'Table' => 'Country',
     338      'DefaultSortColumn' => 'Name',
     339      'Items' => array(
     340        'Name' => array('Type' => 'String', 'Caption' => 'Jméno', 'Default' => ''),
     341      ),
    342342    ));
    343343    $this->System->FormManager->RegisterFormType('TCountry', array(
    344         'Type' => 'Reference',
    345         'Table' => 'Country',
    346         'Id' => 'Id',
    347         'Name' => 'Name',
    348         'Filter' => '1',
     344      'Type' => 'Reference',
     345      'Table' => 'Country',
     346      'Id' => 'Id',
     347      'Name' => 'Name',
     348      'Filter' => '1',
    349349    ));
    350350    $this->System->FormManager->RegisterFormType('TUnitOfMeasure', array(
    351         'Type' => 'Reference',
    352         'Table' => 'UnitOfMeasure',
    353         'Id' => 'Id',
    354         'Name' => 'Name',
    355         'Filter' => '1',
     351      'Type' => 'Reference',
     352      'Table' => 'UnitOfMeasure',
     353      'Id' => 'Id',
     354      'Name' => 'Name',
     355      'Filter' => '1',
    356356    ));
    357357    $this->System->FormManager->RegisterFormType('TLanguage', array(
    358         'Type' => 'Reference',
    359         'Table' => 'Language',
    360         'Id' => 'Id',
    361         'Name' => 'Name',
    362         'Filter' => '1',
     358      'Type' => 'Reference',
     359      'Table' => 'Language',
     360      'Id' => 'Id',
     361      'Name' => 'Name',
     362      'Filter' => '1',
    363363    ));
    364364    $this->System->FormManager->RegisterFormType('TAction', array(
    365         'Type' => 'Reference',
    366         'Table' => 'Action',
    367         'Id' => 'Id',
    368         'Name' => 'Title',
    369         'Filter' => '1',
     365      'Type' => 'Reference',
     366      'Table' => 'Action',
     367      'Id' => 'Id',
     368      'Name' => 'Title',
     369      'Filter' => '1',
    370370    ));
    371371    $this->System->FormManager->RegisterFormType('TActionIcon', array(
    372         'Type' => 'Reference',
    373         'Table' => 'ActionIcon',
    374         'Id' => 'Id',
    375         'Name' => 'Name',
    376         'Filter' => '1',
     372      'Type' => 'Reference',
     373      'Table' => 'ActionIcon',
     374      'Id' => 'Id',
     375      'Name' => 'Name',
     376      'Filter' => '1',
    377377    ));
    378378    $this->System->FormManager->RegisterFormType('TActionType', array(
    379         'Type' => 'Reference',
    380         'Table' => 'ActionType',
    381         'Id' => 'Id',
    382         'Name' => 'Name',
    383         'Filter' => '1',
     379      'Type' => 'Reference',
     380      'Table' => 'ActionType',
     381      'Id' => 'Id',
     382      'Name' => 'Name',
     383      'Filter' => '1',
    384384    ));
    385385    $this->System->FormManager->RegisterFormType('TActionGroup', array(
    386         'Type' => 'Reference',
    387         'Table' => 'ActionGroup',
    388         'Id' => 'Id',
    389         'Name' => 'Name',
    390         'Filter' => '1',
    391     ));   
     386      'Type' => 'Reference',
     387      'Table' => 'ActionGroup',
     388      'Id' => 'Id',
     389      'Name' => 'Name',
     390      'Filter' => '1',
     391    ));
    392392    $this->System->FormManager->RegisterFormType('TModule', array(
    393         'Type' => 'Reference',
    394         'Table' => 'Module',
    395         'Id' => 'Id',
    396         'Name' => 'Name',
    397         'Filter' => '1',
    398     ));
    399    
     393      'Type' => 'Reference',
     394      'Table' => 'Module',
     395      'Id' => 'Id',
     396      'Name' => 'Name',
     397      'Filter' => '1',
     398    ));
     399
    400400    //$this->Manager->OnModuleChange = array($this, 'ModuleChange');
    401401    //$this->LoadFromDatabase();
    402402  }
    403  
     403
    404404  function DoStop()
    405405  {
    406406  }
    407  
     407
    408408  function IsInstalled()
    409409  {
     
    411411    {
    412412      $DbResult = $this->Database->query('SELECT table_name FROM information_schema.tables
    413 WHERE table_schema = "'.$this->Database->Database.'" AND table_name = "SystemVersion";');   
     413WHERE table_schema = "'.$this->Database->Database.'" AND table_name = "SystemVersion";');
    414414      if($DbResult->num_rows > 0) $this->Installed = true;
    415415        else $this->Installed = false;
    416416      $this->InstalledChecked = true;
    417417    }
    418     return($this->Installed); 
    419   }
    420  
     418    return($this->Installed);
     419  }
     420
    421421  function ModuleChange($Module)
    422422  {
    423423    //if($this->IsInstalled())
    424424    {
    425        
     425
    426426      if($Module->IsInstalled()) $Installed = 1;
    427         else $Installed = 0; 
     427        else $Installed = 0;
    428428      $this->Database->query('UPDATE `Module` SET `Installed`=1 WHERE `Name`="'.$Module->Name.'"');
    429429    }
    430430  }
    431  
     431
    432432  function LoadFromDatabase()
    433433  {
     
    441441      include_once('Modules/'.$Module['Name'].'/'.$Module['Name'].'.php');
    442442      $ModuleClassName = 'Module'.$Module['Name'];
    443       $NewModule = new $ModuleClassName($this->Database, $this->Manager);     
     443      $NewModule = new $ModuleClassName($this->Database, $this->Manager);
    444444      $NewModule->Id = $Module['Id'];
    445       $NewModule->Installed = $Module['Installed'];     
     445      $NewModule->Installed = $Module['Installed'];
    446446      $this->Manager->RegisterModule($NewModule);
    447     }     
    448   }
    449  
     447    }
     448  }
     449
    450450  function SaveToDatabase()
    451451  {
    452         $Output = '';
     452    $Output = '';
    453453    $Modules = array();
    454454    $DbResult = $this->Database->query('SELECT * FROM `Module`');
     
    461461
    462462    // Add missing
    463     foreach($this->System->ModuleManager->Modules as $Module)   
    464     {     
     463    foreach($this->System->ModuleManager->Modules as $Module)
     464    {
    465465      if(!array_key_exists($Module->Name, $Modules))
    466466      {
    467         $this->Database->insert('Module', array('Name' => $Module->Name, 
     467        $this->Database->insert('Module', array('Name' => $Module->Name,
    468468          'Version' => $Module->Version, 'Creator' => $Module->Creator,
    469                 'HomePage' => $Module->HomePage, 'Title' => $Module->Title,
     469          'HomePage' => $Module->HomePage, 'Title' => $Module->Title,
    470470          'Description' => $Module->Description, 'License' => $Module->License,
    471471          'Installed' => $Module->Installed));
     
    474474      else $this->Database->update('Module', 'Name = "'.$Module->Name.'"', array(
    475475        'Version' => $Module->Version, 'Creator' => $Module->Creator,
    476         'HomePage' => $Module->HomePage, 'Title' => $Module->Title,
     476        'HomePage' => $Module->HomePage, 'Title' => $Module->Title,
    477477        'Description' => $Module->Description, 'License' => $Module->License,
    478478        'Installed' => $Module->Installed));
    479479    }
    480    
     480
    481481    // Remove exceeding
    482     foreach($Modules as $Module)   
     482    foreach($Modules as $Module)
    483483    if(!$this->System->ModuleManager->ModulePresent($Module['Name']))
    484484    {
     
    487487      $this->Database->query('DELETE FROM `ModuleLink` WHERE `LinkedModule` = '.$Module['Id']);
    488488      $DbResult = $this->Database->query('SELECT Id FROM `PermissionOperation` WHERE `Module` = '.$Module['Id']);
    489       while($DbRow = $DbResult->fetch_assoc()) 
     489      while($DbRow = $DbResult->fetch_assoc())
    490490      {
    491491        $this->Database->query('DELETE FROM `PermissionGroupAssignment` WHERE `AssignedOperation` = '.$DbRow['Id']);
     
    498498        $this->Database->query('DELETE FROM `ModelField` WHERE `Model` = '.$DbRow['Id']);
    499499      $this->Database->query('DELETE FROM `Module` WHERE `Id` = '.$Module['Id']);
    500     }   
    501    
     500    }
     501
    502502    // Reload dependencies
    503503    $DbDependency = array();
     
    505505    while($DbRow = $DbResult->fetch_assoc())
    506506      $DbDependency[$DbRow['Module']][] = $DbRow['LinkedModule'];
    507    
     507
    508508    foreach($this->System->ModuleManager->Modules as $Module)
    509509    {
     
    517517            $DependencyId = $this->System->ModuleManager->Modules[$Dependency]->Id;
    518518            else throw new Exception('Dependent module '.$Dependency.' not found');
    519           $this->Database->insert('ModuleLink', array('Module' => $Module->Id, 
     519          $this->Database->insert('ModuleLink', array('Module' => $Module->Id,
    520520            'LinkedModule' => $DependencyId, 'Type' => 'DependOn'));
    521         }       
     521        }
    522522      }
    523      
     523
    524524      // Remove exceeding
    525525      if(array_key_exists($Module->Id, $DbDependency))
     
    530530        $this->Database->query('DELETE FROM `ModuleLink` WHERE `Module` = '.
    531531          $Module->Id.' AND LinkedModule='.$Dep);
    532       }     
     532      }
    533533    }
    534534    return($Output);
    535   } 
     535  }
    536536}
  • trunk/Modules/TV/TV.php

    r712 r738  
    88  var $ShortTitle = 'IPTV';
    99  var $ParentClass = 'PagePortal';
    10  
     10
    1111  function Show()
    12   {   
     12  {
    1313    if(count($this->System->PathItems) > 1)
    14     { 
     14    {
    1515      if($this->System->PathItems[1] == 'playlist.m3u') return($this->ShowPlayList());
    1616        else return(PAGE_NOT_FOUND);
    1717    } else return($this->ShowChannelList());
    1818  }
    19  
     19
    2020  function ShowChannelList()
    2121  {
    2222    global $Channels;
    23    
     23
    2424    $Output = 'Stažení přehrávače: <a href="http://www.videolan.org/vlc/">VLC Media Player</a><br/>'.
    2525    'Seznam všech kanálů do přehrávače: <a href="playlist.m3u">Playlist</a><br/>'.
     
    2828    '<div align="center"><strong>Výpis kanálů:</strong><br>';
    2929
    30     $Where = 
     30    $Where =
    3131    $DbResult = $this->Database->query('SELECT COUNT(*) FROM `TV` LEFT JOIN `TVGroup` ON `TVGroup`.`Id` = `TV`.`Category` '.
    3232      ' LEFT JOIN `Language` ON `Language`.`Id` = `TV`.`Language` WHERE (`TV`.`Stream` <> "") OR (`TV`.`StreamWeb` <> "")');
    3333    $DbRow = $DbResult->fetch_row();
    34     $PageList = GetPageList($DbRow[0]);   
     34    $PageList = GetPageList($DbRow[0]);
    3535
    3636    $Output .= $PageList['Output'];
    3737    $Output .= '<table class="WideTable">';
    38    
     38
    3939    $TableColumns = array(
    40       array('Name' => 'Name', 'Title' => 'Jméno stanice'), 
    41       array('Name' => 'Language', 'Title' => 'Jazyk'), 
    42       array('Name' => 'Category', 'Title' => 'Zaměření'), 
    43       array('Name' => 'SourceType', 'Title' => 'Zdroj'), 
    44       array('Name' => '', 'Title' => 'Ladění'), 
     40      array('Name' => 'Name', 'Title' => 'Jméno stanice'),
     41      array('Name' => 'Language', 'Title' => 'Jazyk'),
     42      array('Name' => 'Category', 'Title' => 'Zaměření'),
     43      array('Name' => 'SourceType', 'Title' => 'Zdroj'),
     44      array('Name' => '', 'Title' => 'Ladění'),
    4545    );
    4646    $Order = GetOrderTableHeader($TableColumns, 'Name', 0);
     
    5151
    5252    $DbResult = $this->Database->query($Query);
    53     while($Line = $DbResult->fetch_assoc()) 
    54     { 
     53    while($Line = $DbResult->fetch_assoc())
     54    {
    5555      if($Line['Stream'] <> '') $Line['Show'] = '<a href="playlist.m3u?id='.$Line['ShortName'].'">Naladit</a>';
    5656      else
    5757      if($Line['StreamWeb'] <> '') $Line['Show'] = '<a href="'.$Line['StreamWeb'].'">Naladit</a>';
    5858        else $Line['Show'] = '&nbsp;';
    59      
     59
    6060      $Output .= '<tr><td><a href="'.$Line['Homepage'].'">'.$Line['Name'].'</a></td>'.
    6161      '<td>'.$Line['Language'].'</td>'.
     
    6666    $Output .= '</table>';
    6767    $Output .= $PageList['Output'];
    68    
     68
    6969    $Output .= '</div><br/>';
    70    
     70
    7171    $Output .= 'Další online TV na webu: <a href="http://spustit.cz">Spustit.cz</a><br/>';
    7272    $Output .= 'Další online TV na webu: <a href="http://www.tvinfo.cz/live/televize/evropa/cz">TV info</a><br/>';
    73    
     73
    7474    return($Output);
    7575  }
     
    7878  {
    7979    $this->ClearPage = true;
    80        
     80
    8181    Header("Content-Type: audio/mpegurl");
    8282    Header("Content-Disposition: attachment; filename=playlist.m3u");
     
    101101      }
    102102    }
    103   } 
     103  }
    104104}
    105105
     
    115115    $this->Description = 'Television channels management';
    116116    $this->Dependencies = array();
    117   } 
     117  }
    118118
    119119  function DoInstall()
    120120  {
    121121  }
    122  
     122
    123123  function DoUninstall()
    124   {     
     124  {
    125125  }
    126  
     126
    127127  function DoStart()
    128128  {
     
    155155    ));
    156156    $this->System->FormManager->RegisterFormType('TTVGroup', array(
    157         'Type' => 'Reference',
    158         'Table' => 'TVGroup',
    159         'Id' => 'Id',
    160         'Name' => 'Name',
    161         'Filter' => '1',
     157      'Type' => 'Reference',
     158      'Table' => 'TVGroup',
     159      'Id' => 'Id',
     160      'Name' => 'Name',
     161      'Filter' => '1',
    162162    ));
    163163    $this->System->FormManager->RegisterFormType('TTVListCategory', array(
    164         'Type' => 'ManyToOne',
    165         'Table' => 'TV',
    166         'Id' => 'Id',
    167         'Ref' => 'Category',
    168         'Filter' => '1',
    169     ));   
    170   } 
    171  
     164      'Type' => 'ManyToOne',
     165      'Table' => 'TV',
     166      'Id' => 'Id',
     167      'Ref' => 'Category',
     168      'Filter' => '1',
     169    ));
     170  }
     171
    172172  function DoStop()
    173   { 
    174   } 
     173  {
     174  }
    175175}
  • trunk/Modules/Task/Task.php

    r712 r738  
    6868    ));
    6969    $this->System->FormManager->RegisterFormType('TWorkListTask', array(
    70         'Type' => 'ManyToOne',
    71         'Table' => 'Work',
    72         'Id' => 'Id',
    73         'Ref' => 'Task',
    74         'Filter' => '1',
     70      'Type' => 'ManyToOne',
     71      'Table' => 'Work',
     72      'Id' => 'Id',
     73      'Ref' => 'Task',
     74      'Filter' => '1',
    7575    ));
    7676    $this->System->FormManager->RegisterFormType('TTaskList', array(
    77         'Type' => 'ManyToOne',
    78         'Table' => 'Task',
    79         'Id' => 'Id',
    80         'Ref' => 'Group',
    81         'Filter' => '1',
     77      'Type' => 'ManyToOne',
     78      'Table' => 'Task',
     79      'Id' => 'Id',
     80      'Ref' => 'Group',
     81      'Filter' => '1',
    8282    ));
    8383    $this->System->FormManager->RegisterFormType('TTaskGroup', array(
    84         'Type' => 'Reference',
    85         'Table' => 'TaskGroup',
    86         'Id' => 'Id',
    87         'Name' => 'Name',
    88         'Filter' => '1',
     84      'Type' => 'Reference',
     85      'Table' => 'TaskGroup',
     86      'Id' => 'Id',
     87      'Name' => 'Name',
     88      'Filter' => '1',
    8989    ));
    90    
     90
    9191  }
    9292}
  • trunk/Modules/TimeMeasure/Graph.php

    r656 r738  
    2020  {
    2121    $this->ClearPage = true;
    22         return($this->Render());
     22    return($this->Render());
    2323  }
    2424
  • trunk/Modules/TimeMeasure/Main.php

    r656 r738  
    1616    $this->ImageHeight = 200;
    1717    $this->ParentClass = 'PagePortal';
    18         $this->DefaultVariables = array(
     18    $this->DefaultVariables = array(
    1919      'TimeSpecify' => 0,
    2020      'Period' => 'day',
  • trunk/Modules/TimeMeasure/Measurement/MeasureClient.php

    r548 r738  
    2626      } else echo('Třída '.$MeasureMethod['MeasureClass'].' neexistuje.');
    2727    }
    28   } 
     28  }
    2929}
  • trunk/Modules/TimeMeasure/Measurement/WoW.php

    r536 r738  
    2828    $DbResult = $Database->query('SELECT COUNT(*) FROM account');
    2929    $Row = $DbResult->fetch_array();
    30     return($Row[0]); 
     30    return($Row[0]);
    3131  }
    3232
     
    5757  function WoWEmulatorAvailability()
    5858  {
    59     if(CheckPortStatus('localhost', 8085)) return(100); else return(0); 
     59    if(CheckPortStatus('localhost', 8085)) return(100); else return(0);
    6060  }
    6161
  • trunk/Modules/User/User.php

    r729 r738  
    434434class ModuleUser extends AppModule
    435435{
    436         var $UserPanel;
     436  var $UserPanel;
    437437
    438438  function __construct($System)
     
    659659    ));
    660660    $this->System->FormManager->RegisterFormType('TUser', array(
    661         'Type' => 'Reference',
    662         'Table' => 'User',
    663         'Id' => 'Id',
    664         'Name' => 'Name',
    665         'Filter' => '1',
     661      'Type' => 'Reference',
     662      'Table' => 'User',
     663      'Id' => 'Id',
     664      'Name' => 'Name',
     665      'Filter' => '1',
    666666    ));
    667667    $this->System->FormManager->RegisterFormType('TPermissionGroup', array(
    668         'Type' => 'Reference',
    669         'Table' => 'PermissionGroup',
    670         'Id' => 'Id',
    671         'Name' => 'Description',
    672         'Filter' => '1',
     668      'Type' => 'Reference',
     669      'Table' => 'PermissionGroup',
     670      'Id' => 'Id',
     671      'Name' => 'Description',
     672      'Filter' => '1',
    673673    ));
    674674    $this->System->FormManager->RegisterFormType('TPermissionGroupAssignment', array(
    675         'Type' => 'Reference',
    676         'Table' => 'PermissionGroupAssignment',
    677         'Id' => 'Id',
    678         'Name' => 'Id',
    679         'Filter' => '1',
     675      'Type' => 'Reference',
     676      'Table' => 'PermissionGroupAssignment',
     677      'Id' => 'Id',
     678      'Name' => 'Id',
     679      'Filter' => '1',
    680680    ));
    681681    $this->System->FormManager->RegisterFormType('TPermissionOperation', array(
    682         'Type' => 'Reference',
    683         'Table' => 'PermissionOperation',
    684         'Id' => 'Id',
    685         'Name' => 'Id',
    686         'Filter' => '1',
    687     ));
    688    
     682      'Type' => 'Reference',
     683      'Table' => 'PermissionOperation',
     684      'Id' => 'Id',
     685      'Name' => 'Id',
     686      'Filter' => '1',
     687    ));
     688
    689689  }
    690690
     
    695695  function TopBarCallback()
    696696  {
    697     if($this->System->User->User['Id'] == null) 
     697    if($this->System->User->User['Id'] == null)
    698698    {
    699699      $Output = '<a href="'.$this->System->Link('/user/?Action=LoginForm').'">Přihlášení</a> '.
    700700        '<a href="'.$this->System->Link('/user/?Action=UserRegister').'">Registrace</a>';
    701     } else 
    702     {
    703         $Output = $this->System->User->User['Name'].
     701    } else
     702    {
     703      $Output = $this->System->User->User['Name'].
    704704        ' <a href="'.$this->System->Link('/user/?Action=UserMenu').'">Nabídka</a>'.
    705705        ' <a href="'.$this->System->Link('/user/?Action=Logout').'">Odhlásit</a>';
    706         //   <a href="'.$this->System->Link('/?Action=UserOptions').'">Nastavení</a>';
     706      //   <a href="'.$this->System->Link('/?Action=UserOptions').'">Nastavení</a>';
    707707    }
    708708    return($Output);
  • trunk/Modules/User/UserPage.php

    r694 r738  
    5454    if($this->System->User->User['Id'] != null)
    5555    {
    56         $Actions = '';
    57         foreach($this->System->ModuleManager->Modules['User']->UserPanel as $Action)
    58         {
    59                 if(is_string($Action[0]))
    60           {
    61                   $Class = new $Action[0]($this->System);
    62                   $Actions .= $Class->$Action[1]();
    63           } else $Actions .= call_user_func($Action).'<br/>';
    64         }
     56      $Actions = '';
     57      foreach($this->System->ModuleManager->Modules['User']->UserPanel as $Action)
     58      {
     59        if(is_string($Action[0]))
     60        {
     61          $Class = new $Action[0]($this->System);
     62          $Actions .= $Class->$Action[1]();
     63        } else $Actions .= call_user_func($Action).'<br/>';
     64      }
    6565      $Output .= '<div class="Centred"><table id="MainTable"><tr><td style="vertical-align:top;">';
    6666      $Output .= $this->Panel('Nabídka uživatele', $Actions);
     
    8383  }
    8484
    85         function Show()
    86         {
    87                 $Output = '';
     85  function Show()
     86  {
     87    $Output = '';
    8888    if(array_key_exists('Action', $_GET))
    8989    {
     
    209209    } else $Output = $this->ShowMain();
    210210    return($Output);
    211         }
    212 
    213         function ShowMain()
    214         {
    215                 $Output = 'Nebyla vybrána akce';
    216                 return($Output);
    217         }
     211  }
     212
     213  function ShowMain()
     214  {
     215    $Output = 'Nebyla vybrána akce';
     216    return($Output);
     217  }
    218218}
  • trunk/Modules/VPS/VPS.php

    r731 r738  
    1515    $this->Modules = array();
    1616  }
    17  
     17
    1818  function DoStart()
    1919  {
    20    
    21   } 
     20
     21  }
    2222}
  • trunk/Modules/WebCam/WebCam.php

    r586 r738  
    66  var $ShortTitle = 'Kamera';
    77  var $ParentClass = 'PagePortal';
    8  
     8
    99  function Show()
    1010  {
     
    1717      var theTimer = setTimeout("reloadImage()", 1);
    1818
    19       function reloadImage() 
     19      function reloadImage()
    2020      {
    2121        theDate = new Date();
     
    5757    $this->SupportedModels = array();
    5858  }
    59  
     59
    6060  function DoStart()
    6161  {
    6262    $this->System->Pages['webcam'] = 'PageWebcam';
    63   } 
     63  }
    6464
    6565 function ShowImage()
     
    7171    $Output .= '<a href="http://www.zdechov.net/kamery/?id=3"><img alt="Skiareál, motokrosová grapa" width="140" height="79" src="http://www.zdechov.net/images/webcam/webcam3.jpg" /></a>';
    7272    $Output .= '<a href="http://www.zdechov.net/kamery/?id=4"><img alt="Fotbalové hřiště" width="140" height="79" src="http://www.zdechov.net/images/webcam/webcam4.jpg" /></a>';
    73           return($Output);   
    74   } 
     73    return($Output);
     74  }
    7575}
  • trunk/Modules/WebCam/webcam_refresh.php

    r579 r738  
    1010//    $Output = shell_exec('wget "http://kamera-stred/Webcam.jpg?MobilePass='.$Config['Web']['WebcamPassword'].'&V=2&Q=2&B=2&U=0" -O webcam_cache.jpg -T '.($Config['Web']['WebcamRefresh']).' --limit-rate=200k');
    1111    $Output = shell_exec('wget "http://kamera-knihovna/cgi-bin/viewer/video.jpg" -O webcam_cache.jpg -T '.($Config['Web']['WebcamRefresh']).' --limit-rate=200k');
    12    
    13     if((strpos($Output, 'failed') === false) and (strpos($Output, 'error') === false)) 
     12
     13    if((strpos($Output, 'failed') === false) and (strpos($Output, 'error') === false))
    1414      shell_exec('mv -f webcam_cache.jpg webcam.jpg');
    1515  }
  • trunk/Modules/Wiki/Wiki.php

    r586 r738  
    1414    $this->Revision = 1;
    1515  }
    16  
     16
    1717  function DoInstall()
    1818  {
    1919    parent::Install();
    2020    $this->Database->Query("'CREATE TABLE IF NOT EXISTS `WikiPage` (
    21                 `Id` int(11) NOT NULL AUTO_INCREMENT,
    22                 `Name` varchar(255) NOT NULL,
    23                 `NormalizedName` varchar(255) NOT NULL,
    24                 `VisibleInMenu` int(11) NOT NULL,
    25                 PRIMARY KEY (`Id`),
    26                 UNIQUE KEY `Name` (`Name`),
    27                 KEY `VisibleInMenu` (`VisibleInMenu`)
     21    `Id` int(11) NOT NULL AUTO_INCREMENT,
     22    `Name` varchar(255) NOT NULL,
     23    `NormalizedName` varchar(255) NOT NULL,
     24    `VisibleInMenu` int(11) NOT NULL,
     25    PRIMARY KEY (`Id`),
     26    UNIQUE KEY `Name` (`Name`),
     27    KEY `VisibleInMenu` (`VisibleInMenu`)
    2828) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
    2929    CREATE TABLE IF NOT EXISTS `WikiPageContent` (
    30                 `Id` int(11) NOT NULL AUTO_INCREMENT,
    31                 `Page` int(11) NOT NULL,
    32                 `Time` datetime NOT NULL,
    33                 `Content` text NOT NULL,
    34                 `User` int(11) NOT NULL,
    35                 PRIMARY KEY (`Id`),
    36                 KEY `User` (`User`),
    37                 KEY `Page` (`Page`)
     30    `Id` int(11) NOT NULL AUTO_INCREMENT,
     31    `Page` int(11) NOT NULL,
     32    `Time` datetime NOT NULL,
     33    `Content` text NOT NULL,
     34    `User` int(11) NOT NULL,
     35    PRIMARY KEY (`Id`),
     36    KEY `User` (`User`),
     37    KEY `Page` (`Page`)
    3838) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
    3939    ALTER TABLE `WikiPageContent`
     
    4747      'DELETE TABLE `WikiPage`;");
    4848    parent::UnInstall();
    49   } 
    50  
     49  }
     50
    5151  function DoStart()
    5252  {
    5353    $this->LoadPages();
    5454  }
    55  
     55
    5656  function DoStop()
    5757  {
    5858  }
    59  
     59
    6060  function LoadPages()
    6161  {
    62         $DbResult = $this->Database->select('WikiPage', '*', 'VisibleInMenu=1');
    63         while($DbRow = $DbResult->fetch_assoc())
    64         {
    65                 $this->System->RegisterPage($DbRow['NormalizedName'], 'PageWiki');
    66                 $this->System->RegisterMenuItem(array(
    67                                 'Title' => $DbRow['Name'],
    68                                 'Hint' => '',
    69                                 'Link' => $this->System->Link('/'.$DbRow['NormalizedName'].'/'),
    70                                 'Permission' => LICENCE_ANONYMOUS,
    71                                 'Icon' => '',
    72                 ), 2);
    73         }
     62    $DbResult = $this->Database->select('WikiPage', '*', 'VisibleInMenu=1');
     63    while($DbRow = $DbResult->fetch_assoc())
     64    {
     65      $this->System->RegisterPage($DbRow['NormalizedName'], 'PageWiki');
     66      $this->System->RegisterMenuItem(array(
     67          'Title' => $DbRow['Name'],
     68          'Hint' => '',
     69          'Link' => $this->System->Link('/'.$DbRow['NormalizedName'].'/'),
     70          'Permission' => LICENCE_ANONYMOUS,
     71          'Icon' => '',
     72      ), 2);
     73    }
    7474  }
    7575}
     
    8080  var $ShortTitle = 'Wiki';
    8181  var $ParentClass = 'PagePortal';
    82  
     82
    8383  function Show()
    84         {
    85                 if(array_key_exists('Action', $_GET))
    86                 {
    87                         if($_GET['Action'] == 'Edit') $Output = $this->EditContent();
    88                         else if($_GET['Action'] == 'EditSave') $Output = $this->SaveContent();
    89                         else if($_GET['Action'] == 'History') $Output = $this->ShowHistory();
    90                         else $Output = $this->ShowContent();
    91                 } else $Output = $this->ShowContent();
    92                 return($Output);
    93         }
    94        
    95         function ShowContent()
    96         {
    97                 $PageName = $this->System->PathItems[count($this->System->PathItems) - 1];
    98                 $DbResult = $this->Database->select('WikiPage', 'Name, Id', 'NormalizedName="'.$PageName.'"');
    99                 if($DbResult->num_rows > 0)
    100                 {
    101                         $DbRow = $DbResult->fetch_assoc();
    102                         if(array_key_exists('ver', $_GET))
    103                         {
    104                                 $DbResult2 = $this->Database->select('WikiPageContent', '*', 'Page='.$DbRow['Id'].' AND Id='.$_GET['ver']*1);
    105                           if($DbResult2->num_rows > 0)
    106                           {
    107                                   $DbRow2 = $DbResult2->fetch_assoc();
    108                                 $Output = '<h3>Archív stránky '.$DbRow['Name'].' ('.HumanDateTime($DbRow2['Time']).')</h3>';
    109                                   $Output .= $DbRow2['Content'];
    110                       if($this->System->User->Licence(LICENCE_MODERATOR))
    111                         $Output .= '<div><a href="?Action=Edit">Upravit nejnovější</a> <a href="?Action=History">Historie</a></div>';
    112                           } else $Output = ShowMessage('Wiki stránka nenalezena', MESSAGE_CRITICAL);
    113                         } else
    114                         {
    115                           $DbResult2 = $this->Database->select('WikiPageContent', '*', 'Page='.$DbRow['Id'].' ORDER BY Time DESC LIMIT 1');
    116                           if($DbResult2->num_rows > 0)
    117                           {
    118                                   $DbRow2 = $DbResult2->fetch_assoc();
    119                             $Output = '<h3>'.$DbRow['Name'].'</h3>';
    120                                   $Output .= $DbRow2['Content'];
    121                       if($this->System->User->Licence(LICENCE_MODERATOR))
    122                         $Output .= '<div><a href="?Action=Edit">Upravit</a> <a href="?Action=History">Historie</a></div>';
    123                           } else $Output = ShowMessage('Wiki stránka nenalezena', MESSAGE_CRITICAL);
    124                         }
    125                 } else $Output = ShowMessage('Wiki stránka nenalezena', MESSAGE_CRITICAL);
    126                 return($Output);
    127         }
    128 
    129         function EditContent()
    130         {
    131                 if($this->System->User->Licence(LICENCE_MODERATOR))
    132                 {
    133                 $PageName = $this->System->PathItems[count($this->System->PathItems) - 1];
    134                 $DbResult = $this->Database->select('WikiPage', 'Name, Id', 'NormalizedName="'.$PageName.'"');
    135                 if($DbResult->num_rows > 0)
    136                 {
    137                         $DbRow = $DbResult->fetch_assoc();
    138                         $Output = '<h3>Úprava '.$DbRow['Name'].'</h3>';
    139                         $DbResult2 = $this->Database->select('WikiPageContent', '*', 'Page='.$DbRow['Id'].' ORDER BY Time DESC LIMIT 1');
    140                         if($DbResult2->num_rows > 0)
    141                         {
    142                                 $DbRow2 = $DbResult2->fetch_assoc();
    143                     $Output .= '<form action="?Action=EditSave" method="post">'.
    144                     '<textarea name="content" rows="8" cols="80" onkeydown="ResizeTextArea(this)" class="textedit">'.$DbRow2['Content'].'</textarea><br/>'.
    145                     '<input type="submit" name="save" value="Uložit"/> '.
    146                     '<input type="button" name="cancel" value="Zrušit" onclick="location.href=\'?\'"/>'.
    147                     '</form>';
    148                         } else $Output = ShowMessage('Wiki stránka nenalezena', MESSAGE_CRITICAL);
    149                 } else $Output = ShowMessage('Wiki stránka nenalezena', MESSAGE_CRITICAL);
    150                 } else $Output = ShowMessage('Nemáte oprávnění', MESSAGE_CRITICAL);
    151                 return($Output);
    152         }
    153        
    154         function SaveContent()
    155         {
    156                 if($this->System->User->Licence(LICENCE_MODERATOR))
    157                 {
    158                 $PageName = $this->System->PathItems[count($this->System->PathItems) - 1];
    159                 $DbResult = $this->Database->select('WikiPage', 'Name, Id', 'NormalizedName="'.$PageName.'"');
    160                 if($DbResult->num_rows > 0)
    161                 {
    162                         $DbRow = $DbResult->fetch_assoc();
    163                         if(array_key_exists('content', $_POST) and array_key_exists('save', $_POST))
    164                         {
    165                           $DbResult2 = $this->Database->insert('WikiPageContent', array('Content' => stripslashes($_POST['content']),
    166                                 'User' => $this->System->User->Id, 'Time' => 'NOW()', 'Page' => $DbRow['Id']));
    167                           $Output = ShowMessage('Wiki stránka uložena', MESSAGE_INFORMATION);                     
    168                         } else $Output = ShowMessage('Nezadána platná data', MESSAGE_CRITICAL);
    169                         $Output .= $this->ShowContent();
    170                 } else $Output = ShowMessage('Wiki stránka nenalezena', MESSAGE_CRITICAL);
    171                 } else $Output = ShowMessage('Nemáte oprávnění', MESSAGE_CRITICAL);
    172                 return($Output);
    173         }
    174        
    175         function ShowHistory()
    176         {               
    177                 if($this->System->User->Licence(LICENCE_MODERATOR))
    178                 {
    179                   $PageName = $this->System->PathItems[count($this->System->PathItems) - 1];
    180                   $DbResult = $this->Database->select('WikiPage', 'Name, Id', 'NormalizedName="'.$PageName.'"');
    181                   if($DbResult->num_rows > 0)
    182                   {
    183                           $DbRow = $DbResult->fetch_assoc();
    184                        
    185                           $Output = '<h3>Historie stránky '.$DbRow['Name'].'</h3>';
    186                           $DbResult2 = $this->Database->query('SELECT COUNT(*) FROM `WikiPageContent` WHERE Page='.$DbRow['Id']);
    187                         $DbRow2 = $DbResult2->fetch_row();
    188                         $PageList = GetPageList($DbRow2[0]);
    189                        
    190                         $Output .= $PageList['Output'];
    191                         $Output .= '<table class="BaseTable">';
    192                        
    193                           $TableColumns = array(
    194                                         array('Name' => 'Time', 'Title' => 'Čas'),
    195                                         array('Name' => 'User', 'Title' => 'Uživatel'),
    196                                         array('Name' => 'Action', 'Title' => 'Akce'),
    197                           );
    198                          
    199                           $Order = GetOrderTableHeader($TableColumns, 'Time', 1);
    200                           $Output .= $Order['Output'];
    201                          
    202                           $DbResult2 = $this->Database->query('SELECT *, (SELECT `Name` FROM `User` WHERE `User`.`ID`=`WikiPageContent`.`User`) AS `UserName` '.
    203                                 ' FROM `WikiPageContent` WHERE Page='.
    204                         $DbRow['Id'].' '.$Order['SQL'].$PageList['SQLLimit']);
    205                           while($PageContent = $DbResult2->fetch_assoc())
    206                           {
    207                                 $Output .= '<tr>'.
    208                                         '<td>'.HumanDateTime($PageContent['Time']).'</td>'.
    209                                 '<td><a href="'.$this->System->Link('/user.php?user='.$PageContent['User']).'">'.$PageContent['UserName'].'</a></td>'.                                                                                         
    210                                         '<td><a href="?id='.$PageContent['Id'].'&amp;ver='.$PageContent['Id'].'">Zobrazit</a></td>';
    211                                 $Output .= '</tr>';
    212                           }                     
    213                      
    214                           $Output .= '</table>'.
    215                                   $PageList['Output'];
    216                   } else $Output = ShowMessage('Wiki stránka nenalezena', MESSAGE_CRITICAL);
    217                 } else $Output = ShowMessage('Nemáte oprávnění', MESSAGE_CRITICAL);
    218                 return($Output);
    219   }
    220        
     84  {
     85    if(array_key_exists('Action', $_GET))
     86    {
     87      if($_GET['Action'] == 'Edit') $Output = $this->EditContent();
     88      else if($_GET['Action'] == 'EditSave') $Output = $this->SaveContent();
     89      else if($_GET['Action'] == 'History') $Output = $this->ShowHistory();
     90      else $Output = $this->ShowContent();
     91    } else $Output = $this->ShowContent();
     92    return($Output);
     93  }
     94
     95  function ShowContent()
     96  {
     97    $PageName = $this->System->PathItems[count($this->System->PathItems) - 1];
     98    $DbResult = $this->Database->select('WikiPage', 'Name, Id', 'NormalizedName="'.$PageName.'"');
     99    if($DbResult->num_rows > 0)
     100    {
     101      $DbRow = $DbResult->fetch_assoc();
     102      if(array_key_exists('ver', $_GET))
     103      {
     104        $DbResult2 = $this->Database->select('WikiPageContent', '*', 'Page='.$DbRow['Id'].' AND Id='.$_GET['ver']*1);
     105        if($DbResult2->num_rows > 0)
     106        {
     107          $DbRow2 = $DbResult2->fetch_assoc();
     108          $Output = '<h3>Archív stránky '.$DbRow['Name'].' ('.HumanDateTime($DbRow2['Time']).')</h3>';
     109          $Output .= $DbRow2['Content'];
     110          if($this->System->User->Licence(LICENCE_MODERATOR))
     111            $Output .= '<div><a href="?Action=Edit">Upravit nejnovější</a> <a href="?Action=History">Historie</a></div>';
     112        } else $Output = ShowMessage('Wiki stránka nenalezena', MESSAGE_CRITICAL);
     113      } else
     114      {
     115        $DbResult2 = $this->Database->select('WikiPageContent', '*', 'Page='.$DbRow['Id'].' ORDER BY Time DESC LIMIT 1');
     116        if($DbResult2->num_rows > 0)
     117        {
     118          $DbRow2 = $DbResult2->fetch_assoc();
     119          $Output = '<h3>'.$DbRow['Name'].'</h3>';
     120          $Output .= $DbRow2['Content'];
     121          if($this->System->User->Licence(LICENCE_MODERATOR))
     122            $Output .= '<div><a href="?Action=Edit">Upravit</a> <a href="?Action=History">Historie</a></div>';
     123        } else $Output = ShowMessage('Wiki stránka nenalezena', MESSAGE_CRITICAL);
     124      }
     125    } else $Output = ShowMessage('Wiki stránka nenalezena', MESSAGE_CRITICAL);
     126    return($Output);
     127  }
     128
     129  function EditContent()
     130  {
     131    if($this->System->User->Licence(LICENCE_MODERATOR))
     132    {
     133    $PageName = $this->System->PathItems[count($this->System->PathItems) - 1];
     134    $DbResult = $this->Database->select('WikiPage', 'Name, Id', 'NormalizedName="'.$PageName.'"');
     135    if($DbResult->num_rows > 0)
     136    {
     137      $DbRow = $DbResult->fetch_assoc();
     138      $Output = '<h3>Úprava '.$DbRow['Name'].'</h3>';
     139      $DbResult2 = $this->Database->select('WikiPageContent', '*', 'Page='.$DbRow['Id'].' ORDER BY Time DESC LIMIT 1');
     140      if($DbResult2->num_rows > 0)
     141      {
     142        $DbRow2 = $DbResult2->fetch_assoc();
     143        $Output .= '<form action="?Action=EditSave" method="post">'.
     144        '<textarea name="content" rows="8" cols="80" onkeydown="ResizeTextArea(this)" class="textedit">'.$DbRow2['Content'].'</textarea><br/>'.
     145        '<input type="submit" name="save" value="Uložit"/> '.
     146        '<input type="button" name="cancel" value="Zrušit" onclick="location.href=\'?\'"/>'.
     147        '</form>';
     148      } else $Output = ShowMessage('Wiki stránka nenalezena', MESSAGE_CRITICAL);
     149    } else $Output = ShowMessage('Wiki stránka nenalezena', MESSAGE_CRITICAL);
     150    } else $Output = ShowMessage('Nemáte oprávnění', MESSAGE_CRITICAL);
     151    return($Output);
     152  }
     153
     154  function SaveContent()
     155  {
     156    if($this->System->User->Licence(LICENCE_MODERATOR))
     157    {
     158    $PageName = $this->System->PathItems[count($this->System->PathItems) - 1];
     159    $DbResult = $this->Database->select('WikiPage', 'Name, Id', 'NormalizedName="'.$PageName.'"');
     160    if($DbResult->num_rows > 0)
     161    {
     162      $DbRow = $DbResult->fetch_assoc();
     163      if(array_key_exists('content', $_POST) and array_key_exists('save', $_POST))
     164      {
     165        $DbResult2 = $this->Database->insert('WikiPageContent', array('Content' => stripslashes($_POST['content']),
     166          'User' => $this->System->User->Id, 'Time' => 'NOW()', 'Page' => $DbRow['Id']));
     167        $Output = ShowMessage('Wiki stránka uložena', MESSAGE_INFORMATION);
     168      } else $Output = ShowMessage('Nezadána platná data', MESSAGE_CRITICAL);
     169      $Output .= $this->ShowContent();
     170    } else $Output = ShowMessage('Wiki stránka nenalezena', MESSAGE_CRITICAL);
     171    } else $Output = ShowMessage('Nemáte oprávnění', MESSAGE_CRITICAL);
     172    return($Output);
     173  }
     174
     175  function ShowHistory()
     176  {
     177    if($this->System->User->Licence(LICENCE_MODERATOR))
     178    {
     179      $PageName = $this->System->PathItems[count($this->System->PathItems) - 1];
     180      $DbResult = $this->Database->select('WikiPage', 'Name, Id', 'NormalizedName="'.$PageName.'"');
     181      if($DbResult->num_rows > 0)
     182      {
     183        $DbRow = $DbResult->fetch_assoc();
     184
     185        $Output = '<h3>Historie stránky '.$DbRow['Name'].'</h3>';
     186        $DbResult2 = $this->Database->query('SELECT COUNT(*) FROM `WikiPageContent` WHERE Page='.$DbRow['Id']);
     187        $DbRow2 = $DbResult2->fetch_row();
     188        $PageList = GetPageList($DbRow2[0]);
     189
     190        $Output .= $PageList['Output'];
     191        $Output .= '<table class="BaseTable">';
     192
     193        $TableColumns = array(
     194            array('Name' => 'Time', 'Title' => 'Čas'),
     195            array('Name' => 'User', 'Title' => 'Uživatel'),
     196            array('Name' => 'Action', 'Title' => 'Akce'),
     197        );
     198
     199        $Order = GetOrderTableHeader($TableColumns, 'Time', 1);
     200        $Output .= $Order['Output'];
     201
     202        $DbResult2 = $this->Database->query('SELECT *, (SELECT `Name` FROM `User` WHERE `User`.`ID`=`WikiPageContent`.`User`) AS `UserName` '.
     203          ' FROM `WikiPageContent` WHERE Page='.
     204          $DbRow['Id'].' '.$Order['SQL'].$PageList['SQLLimit']);
     205        while($PageContent = $DbResult2->fetch_assoc())
     206        {
     207          $Output .= '<tr>'.
     208            '<td>'.HumanDateTime($PageContent['Time']).'</td>'.
     209            '<td><a href="'.$this->System->Link('/user.php?user='.$PageContent['User']).'">'.$PageContent['UserName'].'</a></td>'.
     210            '<td><a href="?id='.$PageContent['Id'].'&amp;ver='.$PageContent['Id'].'">Zobrazit</a></td>';
     211          $Output .= '</tr>';
     212        }
     213
     214        $Output .= '</table>'.
     215          $PageList['Output'];
     216      } else $Output = ShowMessage('Wiki stránka nenalezena', MESSAGE_CRITICAL);
     217    } else $Output = ShowMessage('Nemáte oprávnění', MESSAGE_CRITICAL);
     218    return($Output);
     219  }
     220
    221221  function ToHtml($text)
    222222  {
  • trunk/temp/Bills.php

    r627 r738  
    1515  if(strpos($Invoice['Text'], 'Poplatek za měsíc') !== false)
    1616  {
    17         $Time = MysqlDateTimeToTime($Invoice['Time']);
    18         $TimeParts = ExtractTime($Time);
    19         $PeriodFrom = mktime($TimeParts['Hour'], $TimeParts['Minute'], $TimeParts['Second'],
    20                         $TimeParts['Month'], 1, $TimeParts['Year']);
    21         $PeriodTo = mktime($TimeParts['Hour'], $TimeParts['Minute'], $TimeParts['Second'],
    22                         $TimeParts['Month'], date('t', $Time), $TimeParts['Year']);
    23         $System->Database->query('UPDATE FinanceInvoice SET PeriodFrom = "'.TimeToMysqlDate($PeriodFrom).
     17    $Time = MysqlDateTimeToTime($Invoice['Time']);
     18    $TimeParts = ExtractTime($Time);
     19    $PeriodFrom = mktime($TimeParts['Hour'], $TimeParts['Minute'], $TimeParts['Second'],
     20        $TimeParts['Month'], 1, $TimeParts['Year']);
     21    $PeriodTo = mktime($TimeParts['Hour'], $TimeParts['Minute'], $TimeParts['Second'],
     22        $TimeParts['Month'], date('t', $Time), $TimeParts['Year']);
     23    $System->Database->query('UPDATE FinanceInvoice SET PeriodFrom = "'.TimeToMysqlDate($PeriodFrom).
    2424      '", PeriodTo ="'.TimeToMysqlDate($PeriodTo).'" WHERE Id='.$Invoice['Id']);
    2525  }
    2626  if(strpos($Invoice['Text'], 'za období') !== false)
    2727  {
    28         $Period = substr($Invoice['Text'], strpos($Invoice['Text'], 'za období') + 10);
    29         $PeriodFrom = strtotime(substr($Period, 0, strpos($Period, '-')));
    30         $PeriodTo = strtotime(substr($Period, strpos($Period, '-') + 1));
    31         $System->Database->query('UPDATE FinanceInvoice SET PeriodFrom = "'.TimeToMysqlDate($PeriodFrom).
    32                         '", PeriodTo ="'.TimeToMysqlDate($PeriodTo).'" WHERE Id='.$Invoice['Id']);
    33          
     28    $Period = substr($Invoice['Text'], strpos($Invoice['Text'], 'za období') + 10);
     29    $PeriodFrom = strtotime(substr($Period, 0, strpos($Period, '-')));
     30    $PeriodTo = strtotime(substr($Period, strpos($Period, '-') + 1));
     31    $System->Database->query('UPDATE FinanceInvoice SET PeriodFrom = "'.TimeToMysqlDate($PeriodFrom).
     32        '", PeriodTo ="'.TimeToMysqlDate($PeriodTo).'" WHERE Id='.$Invoice['Id']);
     33
    3434  }
    35  
     35
    3636  // SELECT * FROM (SELECT FinanceInvoice.Id, FinanceInvoice.Subject, FinanceInvoice.Value, (SELECT SUM(FinanceBillsItems.Price) FROM FinanceBillsItems WHERE FinanceBillsItems.Bill = FinanceBills.Id) AS BillPrice, (SELECT COUNT(FinanceBillsItems.Price) FROM FinanceBillsItems WHERE FinanceBillsItems.Bill = FinanceBills.Id) AS BillCount, (SELECT GROUP_CONCAT(FinanceBillsItems.Description SEPARATOR ",") FROM FinanceBillsItems WHERE FinanceBillsItems.Bill = FinanceBills.Id GROUP BY FinanceBillsItems.Bill) AS Items, FinanceInvoice.Text FROM `FinanceInvoice` LEFT JOIN FinanceBills ON FinanceBills.Id = FinanceInvoice.Bill WHERE FinanceInvoice.Bill IS NOT NULL) AS T WHERE Text <> Items AND Items <> "Poplatek za připojení k síti"
    37  
     37
    3838  while($BillItem = $DbResult3->fetch_assoc())
    3939  {
  • trunk/temp/FioCVSToSQL.php

    r572 r738  
    2121  $Value = str_replace(' ', '', $Value);
    2222  $Text = $Line[9];
    23   if($Value > 0) 
     23  if($Value > 0)
    2424  {
    2525    $BillCode = 'BV'.$BVId.'/2013';
     
    3131  }
    3232  if($Subject == '0094579415') $Subject = 72;
    33  
     33
    3434  $Output .= "INSERT INTO `FinanceOperation` (`Id`, `Time`, `Subject`, `Cash`, `Value`, `BillCode`, `Taxable`, `File`, `Text`, `Network`, `BankAccount`, `Treasury`) VALUES
    3535(NULL, '".TimeToMySQLDateTime($Date)."', ".$Subject.", 0, '".$Value."', '".$BillCode."', 1, NULL, '".$Text."', 1, 2, NULL);\n";
  • trunk/temp/meteo/Image.php

    r548 r738  
    1212  var $FileName;
    1313  var $Color;
    14  
    15   function __construct() 
     14
     15  function __construct()
    1616  {
    1717    $this->Color = COLOR_BLACK;
     
    2727  var $Y;
    2828
    29   function __construct() 
     29  function __construct()
    3030  {
    3131    $this->Color = COLOR_BLACK;
     
    4040  var $Color;
    4141
    42   function __construct() 
     42  function __construct()
    4343  {
    4444    $this->Color = COLOR_BLACK;
     
    4747}
    4848
    49 class Image 
     49class Image
    5050{
    51   var $Image; 
     51  var $Image;
    5252  var $Type;
    5353  var $Font;
    5454  var $Pen;
    55  
     55
    5656  function __construct()
    5757  {
     
    5959    $this->Type = IMAGETYPE_PNG;
    6060    $this->Pen = new Pen();
    61     $this->Font = new Font();   
    62     $this->Brush = new Brush();   
     61    $this->Font = new Font();
     62    $this->Brush = new Brush();
    6363  }
    64  
     64
    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    {
    7373      imagegif($this->Image, $FileName);
    7474    } else
    75     if($this->Type == IMAGETYPE_PNG) 
     75    if($this->Type == IMAGETYPE_PNG)
    7676    {
    7777      imagepng($this->Image, $FileName);
    7878    }
    7979  }
    80  
     80
    8181  function LoadFromFile($FileName)
    8282  {
    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    {
    9191      $this->Image = imagecreatefromgif($FileName);
    9292    } else
    93     if( $this->Type == IMAGETYPE_PNG) 
     93    if( $this->Type == IMAGETYPE_PNG)
    9494    {
    9595      $this->Image = imagecreatefrompng($FileName);
    96     } 
     96    }
    9797  }
    98  
     98
    9999  function Output()
    100100  {
     
    103103
    104104  function SetSize($Width, $Height)
    105   {     
     105  {
    106106    $NewImage = imagecreatetruecolor($Width, $Height);
    107     imagecopy($NewImage, $this->Image, 0, 0, 0, 0, $this->GetWidth(), $this->GetHeight());     
     107    imagecopy($NewImage, $this->Image, 0, 0, 0, 0, $this->GetWidth(), $this->GetHeight());
    108108    imagedestroy($this->Image);
    109109    $this->Image = $NewImage;
    110110  }
    111111
    112   function GetWidth() 
    113   { 
     112  function GetWidth()
     113  {
    114114    return(imagesx($this->Image));
    115115  }
    116  
    117   function GetHeight() 
     116
     117  function GetHeight()
    118118  {
    119119    return(imagesy($this->Image));
    120120  }
    121  
     121
    122122  function TextOut($X, $Y, $Text)
    123123  {
    124124    imagettftext($this->Image, $this->Font->Size, 0, $X, $Y, $this->ConvertColor($this->Font->Color), $this->Font->FileName, $Text);
    125125  }
    126  
     126
    127127  function TextWidth($Text)
    128128  {
     
    130130    return(abs($Box[4] - $Box[0]));
    131131  }
    132  
     132
    133133  function TextHeight($Text)
    134134  {
     
    136136    return(abs($Box[5] - $Box[1]));
    137137  }
    138  
     138
    139139  function ConvertColor($Color)
    140140  {
    141141    return(imagecolorallocate($this->Image, ($Color >> 16) & 0xff, ($Color >> 8) & 0xff, $Color & 0xff));
    142142  }
    143  
     143
    144144  function FillRect($X1, $Y1, $X2, $Y2)
    145145  {
    146146    imagefilledrectangle($this->Image, $X1, $Y1, $X2, $Y2, $this->ConvertColor($this->Brush->Color));
    147147  }
    148  
     148
    149149  function Line($X1, $Y1, $X2, $Y2)
    150150  {
  • trunk/temp/meteo/load_meteo.php

    r737 r738  
    33include('Image.php');
    44
    5 class MeteoStation 
     5class MeteoStation
    66{
    77  var $Id;
     
    2828    $this->Data = $Data;
    2929  }
    30  
     30
    3131  function DownloadData()
    3232  {
    3333    $XmlData = simplexml_load_file($this->URL);
    3434
    35     $Data = array('MeteoStation' => $this->Id, 
     35    $Data = array('MeteoStation' => $this->Id,
    3636      'WindSpeed' => trim($XmlData->windspeed),
    3737      'WindDir' => trim($XmlData->winddir),
     
    6161      'DewPoint' => $this->Data['DewPoint']));
    6262  }
    63  
     63
    6464  function CreateImage($FileName)
    6565  {
     
    9595    $Image->SaveToFile($FileName);
    9696  }
    97  
     97
    9898  function LoadFromDb()
    9999  {
     
    124124  foreach($Meteo->Data as $Index => $Item)
    125125  {
    126     $Collect[$Index][] = $Item; 
     126    $Collect[$Index][] = $Item;
    127127  }
    128   if(($I % 6) == 0) 
     128  if(($I % 6) == 0)
    129129  {
    130130    foreach($Collect as $Index => $Item)
  • trunk/temp/product.php

    r548 r738  
    1313{
    1414  echo($DbRow['Name'].', ');
    15  
    16   $System->Database->insert('Product', array('Name' => $DbRow['Name'], 
     15
     16  $System->Database->insert('Product', array('Name' => $DbRow['Name'],
    1717    'SellPrice' => $DbRow['Price'], 'BuyPrice' => $DbRow['Price'],
    1818    'Consumption' => $DbRow['Consumption'], 'UnitOfMeasure' => 1, 'VAT' => 20));
     
    2525    case 2: $Elimination = NULL; break;
    2626  }
    27        
     27
    2828  //  else $Elimination = $DbRow['TimeElimination'];
    2929  if($DbRow['Used'] == 2) $DbRow['User'] = NULL;
    3030  echo($DbRow['Used'].'"'.$Elimination.'"<br/>');
    3131//  print_r(array('Stock' => 1, 'Product' => $ProductId, 'Amount' => $DbRow['Count'],
    32 //    'Segment' => $DbRow['Segment'], 'TimeEnlistment' => $DbRow['Date'], 'TimeElimination' => $Elimination, 
     32//    'Segment' => $DbRow['Segment'], 'TimeEnlistment' => $DbRow['Date'], 'TimeElimination' => $Elimination,
    3333//    'SerialNumber' => $DbRow['DeviceId'], 'BuyPrice' => $DbRow['Price'], 'SellPrice' => $DbRow['Price'],
    3434//    'Location' => $DbRow['User'], 'Info' => $DbRow['Info']));
    3535  $Database->insert('StockItem', array('Stock' => 1, 'Product' => $ProductId, 'Amount' => $DbRow['Count'],
    36     'Segment' => $DbRow['Segment'], 'TimeEnlistment' => $DbRow['Date'], 'TimeElimination' => $Elimination, 
     36    'Segment' => $DbRow['Segment'], 'TimeEnlistment' => $DbRow['Date'], 'TimeElimination' => $Elimination,
    3737    'SerialNumber' => $DbRow['DeviceId'], 'BuyPrice' => $DbRow['Price'], 'SellPrice' => $DbRow['Price'],
    3838    'Location' => $DbRow['User'], 'Info' => $DbRow['Info']));
  • trunk/temp/renumbering.php

    r548 r738  
    2929    16 => array('AddressRange' => '10.145.66.160', 'Mask' => 27),
    3030  );
    31  
     31
    3232  function Show()
    3333  {
    3434    global $Config;
    35    
     35
    3636    $Output = '';
    3737
     
    4747        $Output .= '-- '.$Interface['Name'].': '.$Interface['LocalIP'].' => '.Int32ToIPv4($NextIP).'<br>';
    4848        $Output .= 'UPDATE NetworkInterface SET LocalIP = "'.Int32ToIPv4($NextIP).'" WHERE Id='.$Interface['Id'].';<br>';
    49         $NextIP++;       
     49        $NextIP++;
    5050      }
    5151      $Output .= '<hr>';
  • trunk/temp/test.php

    r705 r738  
    1111while($DbRow = $DbResult->fetch_assoc())
    1212{
    13         $DbResult2 = $System->Database->select('NetworkSubnet', 'AddressRangeIPv6',
    14                 'CompareNetworkPrefix(INET_ATON(AddressRange), INET_ATON("'.$DbRow['LocalIP'].'"), Mask) AND
    15                         (AddressRangeIPv6 != "")');
    16         if($DbResult2->num_rows > 0)
    17         {
    18                 $Subnet = $DbResult2->fetch_assoc();
    19                 $SubnetParts = explode('/', $Subnet['AddressRangeIPv6']);
     13  $DbResult2 = $System->Database->select('NetworkSubnet', 'AddressRangeIPv6',
     14    'CompareNetworkPrefix(INET_ATON(AddressRange), INET_ATON("'.$DbRow['LocalIP'].'"), Mask) AND
     15      (AddressRangeIPv6 != "")');
     16  if($DbResult2->num_rows > 0)
     17  {
     18    $Subnet = $DbResult2->fetch_assoc();
     19    $SubnetParts = explode('/', $Subnet['AddressRangeIPv6']);
    2020
    21           $Addr->AddressFromString($SubnetParts[0]);
     21    $Addr->AddressFromString($SubnetParts[0]);
    2222    $Addr->EncodeMAC($DbRow['MAC']);
    2323    echo($Addr->AddressToString().' '.$DbRow['MAC']."\n");
    2424
    25           $System->Database->update('NetworkInterface', 'Id='.$DbRow['Id'], array('IPv6' => $Addr->AddressToString()));
    26         }
     25    $System->Database->update('NetworkInterface', 'Id='.$DbRow['Id'], array('IPv6' => $Addr->AddressToString()));
     26  }
    2727}
  • trunk/temp/user_mail.php

    r548 r738  
    1414  {
    1515    global $Config;
    16    
     16
    1717    $Output = '';
    1818
Note: See TracChangeset for help on using the changeset viewer.