Changeset 505


Ignore:
Timestamp:
Apr 1, 2013, 12:29:37 AM (12 years ago)
Author:
chronos
Message:
  • Upraveno: Procházení sdílení přetvořeno na aplikační modul.
  • Ukládání a udržování souborů na disku bude nyní samostatný modul. Na tomto modulu zavisí moduly Finance a News.
Location:
trunk
Files:
4 added
6 deleted
12 edited
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/Common/Global.php

    r501 r505  
    2222include_once(dirname(__FILE__).'/Page.php');
    2323include_once(dirname(__FILE__).'/Form/Form.php');
    24 include_once(dirname(__FILE__).'/File.php');
    2524include_once(dirname(__FILE__).'/../aktuality/news.php');
    2625include_once(dirname(__FILE__).'/../finance/bills.php');
     
    3029 
    3130// Application modules
     31include_once(dirname(__FILE__).'/../Modules/File/File.php');
    3232include_once(dirname(__FILE__).'/../Modules/Meteostation/Meteostation.php');
    3333include_once(dirname(__FILE__).'/../Modules/Portal/Portal.php');
     
    4242include_once(dirname(__FILE__).'/../Modules/Finance/Finance.php');
    4343include_once(dirname(__FILE__).'/../Modules/FinanceBankAPI/FinanceBankAPI.php');
     44include_once(dirname(__FILE__).'/../Modules/NetworkShare/NetworkShare.php');
    4445
    4546class System extends Module
     
    5253  var $ModuleManager;
    5354  var $PathItems;
    54   var $FilesDir;
    5555
    5656  function __construct()
     
    6060    $this->Pages = array();
    6161    $this->ModuleManager = new AppModuleManager();
    62     $this->FilesDir = '';
    6362    $this->Database = new Database();
    6463    $this->FormManager = new FormManager($this->Database);
     
    175174  $System = new System();
    176175  $System->Config = $Config;
    177   $System->FilesDir = dirname(__FILE__).'/../'.$Config['Web']['UploadFileFolder'].'/';
    178176  $System->Database->Connect($Config['Database']['Host'], $Config['Database']['User'], $Config['Database']['Password'], $Config['Database']['Database']);
    179177  $System->Database->Prefix = $Config['Database']['Prefix'];
     
    203201 
    204202  // Register new modules
     203  $System->ModuleManager->RegisterModule(new ModuleFile($System));
    205204  $System->ModuleManager->RegisterModule(new ModuleMeteostation($System));
    206205  $System->ModuleManager->RegisterModule(new ModulePortal($System));
     
    215214  $System->ModuleManager->RegisterModule(new ModuleFinance($System));
    216215  $System->ModuleManager->RegisterModule(new ModuleFinanceBankAPI($System));
     216  $System->ModuleManager->RegisterModule(new ModuleNetworkShare($System));
    217217  $System->ModuleManager->StartAll();
    218218}
  • trunk/Common/Update.php

    r501 r505  
    176176        {
    177177          $Output .= '<h3>Aktualizace</h3>';
    178           $this->UpdateManager->Update();
     178          $Output .= $this->UpdateManager->Update();
    179179          $Output .= $this->ControlPanel();
    180180        } else
     
    183183          $Output .= '<h3>Instalace</h3>';
    184184          $this->UpdateManager->Install();
    185           $this->UpdateManager->Update();
     185          $Output .= $this->UpdateManager->Update();
    186186          $Output .= $this->ControlPanel();
    187187        } else
  • trunk/Common/Version.php

    r503 r505  
    11<?php
    22
    3 $Revision = 503; // Subversion revision
    4 $DatabaseRevision = 502;
    5 $ReleaseTime = '2013-03-10';
     3$Revision = 505; // Subversion revision
     4$DatabaseRevision = 505;
     5$ReleaseTime = '2013-03-31';
    66
    77?>
  • trunk/Modules/Finance/Finance.php

    r500 r505  
    1111    $this->License = 'GNU/GPLv3';
    1212    $this->Description = 'Base module for finance management';
    13     $this->Dependencies = array();
     13    $this->Dependencies = array('File');
    1414  } 
    1515
  • trunk/Modules/FinanceBankAPI/FioDemo.php

    r500 r505  
    44 
    55$Fio = new FioAPI();
    6 $Fio->Token = '';
     6$Fio->Token = 'YEEd9LlZ5SJ5VcxFcdbAwCji6UTtxve2ns5sClfCbii8Taq63uP7JNsa7OeN1Oum';
    77$Records = $Fio->Import(time() - 3600 * 24 * 31 * 2, time());
    88//print_r($Records);
  • trunk/Modules/FinanceBankAPI/ImportFio.php

    r502 r505  
    2727      if($Record['Type'] == GPC_TYPE_ITEM)
    2828      {
    29         $this->Database->insert('FinanceBankImport', array('Time' => $Record['DueDate'],
    30            'BankAccount' => $this->BankAccount, 'Value' => $Record['Value'],
    31             'SpecificSymbol' => $Record['SpecificSymbol'], 'VariableSymbol' => $Record['VariableSymbol'],
    32             'ConstantSymbol' => $Record['ConstantSymbol'], 'Currency' => $this->Currency,
    33             ));
     29        $this->Database->insert('FinanceBankImport', array('Time' => TimeToMysqlDate($Record['DueDate']),
     30          'BankAccount' => $this->BankAccount, 'Value' => $Record['Value'],
     31          'SpecificSymbol' => $Record['SpecificSymbol'], 'VariableSymbol' => $Record['VariableSymbol'],
     32          'ConstantSymbol' => $Record['ConstantSymbol'], 'Currency' => $this->Currency,
     33          ));
    3434        echo('<td>'.$Record['OffsetAccount'].'</td>');
    3535        echo('<td>'.$Record['BankCode'].'</td>');
  • trunk/Modules/NetworkShare/browse.php

    r129 r505  
    4848  //$Vlozit = '';
    4949  // Nacti parent ID
    50   $DbResult = $Database->query('SELECT LAST_INSERT_ID() FROM items LIMIT 0,1');
     50  $DbResult = $Database->query('SELECT LAST_INSERT_ID() FROM NetworkShareItem LIMIT 0,1');
    5151  //echo(DB_NumRows());
    5252  $Row = $DbResult->fetch_array();
     
    9999      $Nazev = substr($Nazev,0,strrpos($Nazev,'.'));
    100100    } else $Ext = '';
    101     //$Vlozit .= "INSERT INTO items (name,size,date,ext,parent,type,host) ".
     101    //$Vlozit .= "INSERT INTO NetworkShareItem (name,size,date,ext,parent,type,host) ".
    102102    //"VALUES ('$Nazev','$Velikost',NOW(),'$Ext','$Parent','$Type','$HostID'); ";
    103103   
    104     $Database->insert('items', array(
     104    $Database->insert('NetworkShareItem', array(
    105105      'name' => $Nazev,
    106106      'size' => $Velikost,
     
    126126 
    127127  // Aktualizuj velikost
    128   //DB_Query("SELECT SUM(size) FROM items WHERE (parent=".$Parent.")");
     128  //DB_Query("SELECT SUM(size) FROM NetworkShareItem WHERE (parent=".$Parent.")");
    129129  //$Row = DB_Row();
    130   $Database->update('items', 'id='.$Parent, array('size' => $VelikostSlozky));
     130  $Database->update('NetworkShareItem', 'id='.$Parent, array('size' => $VelikostSlozky));
    131131  //closedir($Dir);
    132132  return($VelikostSlozky);
     
    134134
    135135// Proskenuj jednotlive sdileni
    136 $Database->query('DELETE FROM items WHERE host='.$HostID);      // Smaz predchozi polozky
     136$Database->query('DELETE FROM NetworkShareItem WHERE host='.$HostID);   // Smaz predchozi polozky
    137137
    138138// Zapis nazev pocitace
    139 $Database->insert('items',array(
     139$Database->insert('NetworkShareItem',array(
    140140  'name' => $Host,
    141141  'size' => 0,
     
    148148
    149149// Nacti Parent ID
    150 $DbResult = $Database->query('SELECT LAST_INSERT_ID() FROM items LIMIT 0,1');
     150$DbResult = $Database->query('SELECT LAST_INSERT_ID() FROM NetworkShareItem LIMIT 0,1');
    151151$Row = $DbResult->fetch_array();
    152152$Parent = $Row[0];
     
    170170    {
    171171      // Přidej poloľku sdílení do datanáze
    172       $Database->insert('items',array(
     172      $Database->insert('NetworkShareItem',array(
    173173        'name' => $Share,
    174174        'size' => 0,
     
    196196
    197197// Aktualizuj velikost dat pocitace
    198 $DbResult = $Database->query("SELECT SUM(size) FROM items WHERE parent=".$Parent);
    199 $Row = $DbResult->fetch_array();
    200 $Database->update('items','id='.$Parent,array('size' => $Row[0]));
     198$DbResult = $Database->query("SELECT SUM(size) FROM NetworkShareItem WHERE parent=".$Parent);
     199$Row = $DbResult->fetch_array();
     200$Database->update('NetworkShareItem','id='.$Parent,array('size' => $Row[0]));
    201201
    202202// Zaktivuj strom
     
    207207$NewID = $Row['id'];
    208208$Database->select_db('share');
    209 $Database->query("DELETE FROM items WHERE host=".$NewID);
    210 $Database->update('items','host='.$HostID,array('host' => $NewID));
     209$Database->query("DELETE FROM NetworkShareItem WHERE host=".$NewID);
     210$Database->update('NetworkShareItem','host='.$HostID,array('host' => $NewID));
    211211echo("OK\n");
    212212
     
    219219 
    220220$Database->select_db('share');
    221 $DbResult = $Database->query("SELECT SUM(size) FROM items WHERE ((parent=1) AND (host IN (".substr($Vyber,0,-1).')))');
    222 $Row = $DbResult->fetch_array();
    223 $Database->update('items','id=1',array('size' => $Row[0]));
     221$DbResult = $Database->query("SELECT SUM(size) FROM NetworkShareItem WHERE ((parent=1) AND (host IN (".substr($Vyber,0,-1).')))');
     222$Row = $DbResult->fetch_array();
     223$Database->update('NetworkShareItem','id=1',array('size' => $Row[0]));
    224224
    225225// Zapiš chyby do databáze
    226226echo("Chyby sdílení...\n");
    227 $Database->delete('errors', 'host="'.$Host.'"');
     227$Database->delete('NetworkShareError', 'host="'.$Host.'"');
    228228if(is_dir($TempDir.'errors'))
    229229{
     
    244244          {
    245245            $Row = substr($ShareFull.'/'.substr($Row, 39), 0, -1);
    246             $Database->insert('errors', array('host' => $Host, 'message' => $Row));
     246            $Database->insert('NetworkShareError', array('host' => $Host, 'message' => $Row));
    247247            echo($Row."\n");
    248248          }
  • trunk/Modules/NetworkShare/online.php

    r438 r505  
    11<?php
    2 
    3 include_once('../Common/Global.php');
    4 
     2include('../global.php');
    53//$Database->select_db('share');
    64echo("\n====================== Kontrola online pocitacu ============================\n\n");
  • trunk/Modules/NetworkShare/playlist.php

    r438 r505  
    11<?php
    2 
    3 include_once('../Common/Global.php');
    4 
    5 // Omezení na online/offline uľivatele
     2include('../global.php');
     3// Omezení na online/offline uµivatele
    64
    75$DbResult = $Database->query('SELECT id FROM hosts WHERE online=1 AND block=0 AND user>0');
     
    1513$Database->select_db('share');
    1614
    17 // Maximální vnoření
     15// Maximální vnoøení
    1816$MaxNesting = 20;
    1917
    20 // Najde cestu ke keřenu
     18// Najde cestu ke keøenu
    2119function PlnaCesta($Row)
    2220{
  • trunk/Modules/NetworkShare/update.php

    r40 r505  
    11<?php
    2 include('../style.php');
    32
    43//$Perioda = 3600*3;    // prochazet po tech hodinach
     
    98  $Hosts = array();
    109  $StartTime = GetMicrotime();
    11   $DbResult = $Database->query("SELECT * FROM hosts WHERE online=1 AND (block=0 OR name='centrala') AND (name!='GATE') AND user>0");
     10  $DbResult = $Database->query("SELECT * FROM NetworkDevice WHERE Online=1 AND (Block=0 OR Name='centrala') AND (Name!='GATE') AND User>0");
    1211  while($Row = $DbResult->fetch_array())
    1312  {
     
    1918    if($Dnes != $Row['last_share_check'])
    2019    {
    21       echo("Kontroluji ".$Row['name']."...\n");
    22       passthru('env browse_host='.$Row['name'].' browse_id='.$HostID.' php -q -c php.ini -f browse.php');
     20      echo("Kontroluji ".$Row['Name']."...\n");
     21      passthru('env browse_host='.$Row['Name'].' browse_id='.$HostID.' php -q -c php.ini -f browse.php');
    2322    }
    24     else echo("Vynechavam ".$Row['name']."...\n");
     23    else echo("Vynechavam ".$Row['Name']."...\n");
    2524    // Aktualizuj datum prochazeni   
    26     $Database->update('hosts',"name='".$Row['name']."'",array('last_share_check' => $Dnes));
     25    $Database->update('Hosts', "name='".$Row['name']."'",array('last_share_check' => $Dnes));
    2726  }
    2827  $Rozdil = GetMicrotime()-$StartTime+10;
    2928 
    3029  // Oprav a zoptimalizuj tabulku
    31   $Database->select_db('share');
     30  //$Database->select_db('share');
    3231  echo('Opravuji tabulku...');
    33   $Database->query('REPAIR TABLE items');
     32  $Database->query('REPAIR TABLE NetworkShareItem');
    3433  echo("\nOptimalizuji tabulku...");
    35   $Database->query('OPTIMIZE TABLE items');
     34  $Database->query('OPTIMIZE TABLE NetworkShareItem');
    3635 
    3736  echo("\nDoba procháení ".date("H:i:s",$Rozdil-3600)."\n\n");
  • trunk/admin/Updates.php

    r503 r505  
    5656  $Manager->Execute("INSERT INTO `ISMenuItem` (`Id` ,`Name` ,`Parent` ,`Table` ,`IconName`) ".
    5757    "VALUES (NULL , 'Sítové služby', '1', 'NetworkConfiguration', '');");
    58   $Manager->Execute("INSERT INTO `centrala`.`ISMenuItem` (`Id` ,`Name` ,`Parent` ,`Table` ,`IconName`) ".
     58  $Manager->Execute("INSERT INTO `ISMenuItem` (`Id` ,`Name` ,`Parent` ,`Table` ,`IconName`) ".
    5959    "VALUES (NULL , 'Fronta e-mailů', '23', 'EmailQueue', '');");
    6060  $Manager->Execute("CREATE TABLE IF NOT EXISTS `FinanceVAT` (
     
    154154    "VALUES (NULL , 'Banka', '2', '', '');");
    155155  $Id = $Manager->Database->insert_id;
    156   $Manager->Execute("UPDATE `ISMenuItem` SET `Parent` = '".$Id."' WHERE `ISMenuItem`.`Id` =10; ".
    157     "UPDATE `ISMenuItem` SET `Parent` = '".$Id."' WHERE `ISMenuItem`.`Id` =48;".
    158     "UPDATE `ISMenuItem` SET `Parent` = '".$Id."' WHERE `ISMenuItem`.`Id` =50;");
     156  $Manager->Execute("UPDATE `ISMenuItem` SET `Parent` = '".$Id."' WHERE `ISMenuItem`.`Id` =''Bankovní účty'; ".
     157    "UPDATE `ISMenuItem` SET `Parent` = '".$Id."' WHERE `ISMenuItem`.`Id` ='Import z účtu';".
     158    "UPDATE `ISMenuItem` SET `Parent` = '".$Id."' WHERE `ISMenuItem`.`Name` ='Banky';");
     159}
     160
     161function UpdateTo505($Manager)
     162{
     163  $Manager->Execute("UPDATE `ISMenuItem` SET `Name` = 'Služby', `Table` = 'Service' WHERE `ISMenuItem`.`Name` ='Tarify';");
     164  $Manager->Execute("INSERT INTO `ISMenuItem` (`Id` ,`Name` ,`Parent` ,`Table` ,`IconName`) ".
     165      "VALUES (NULL , 'Kategorie služeb', '2', 'ServiceCategory', '');");
     166  $Manager->Execute("CREATE TABLE IF NOT EXISTS `NetworkShareItem` (
     167  `Id` int(11) NOT NULL AUTO_INCREMENT,
     168  `Name` varchar(255) NOT NULL DEFAULT '',
     169  `Parent` int(11) NOT NULL DEFAULT '0',
     170  `Host` int(11) NOT NULL DEFAULT '0',
     171  `Size` bigint(20) NOT NULL DEFAULT '0',
     172  `Ext` varchar(64) NOT NULL DEFAULT '',
     173  `Date` date NOT NULL DEFAULT '0000-00-00',
     174  `Type` int(11) NOT NULL DEFAULT '0',
     175  PRIMARY KEY (`Id`),
     176  KEY `Parent` (`Parent`),
     177  KEY `Search` (`Name`,`Size`),
     178  KEY `Name` (`Name`)
     179) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;");
     180  $Manager->Execute("CREATE TABLE IF NOT EXISTS `NetworkShareError` (
     181  `Id` int(11) NOT NULL AUTO_INCREMENT,
     182  `Host` varchar(16) NOT NULL DEFAULT '',
     183  `Message` varchar(255) NOT NULL DEFAULT '',
     184  PRIMARY KEY (`Id`)
     185) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;");
     186 
    159187}
    160188
     
    168196  499 => array('Revision' => 500, 'Function' => 'UpdateTo500'),
    169197  500 => array('Revision' => 502, 'Function' => 'UpdateTo502'),
     198  502 => array('Revision' => 505, 'Function' => 'UpdateTo505'),
    170199);
    171200
  • trunk/finance/manage.php

    r501 r505  
    617617      $Bill->System = &$this->System;
    618618      $Bill->InvoiceId = $Row['Id'];
    619       $FullFileName = $this->System->FilesDir.$FileName;
     619      $FullFileName = $this->System->Modules['File']->FilesDir.$FileName;
    620620      $Bill->SaveToFile($FullFileName);
    621621      $this->Database->update('File', 'Id='.$FileId, array('Name' => $FileName, 'Size' => filesize($FullFileName)));
Note: See TracChangeset for help on using the changeset viewer.