Changeset 493 for trunk/Common


Ignore:
Timestamp:
Mar 1, 2013, 9:20:14 PM (12 years ago)
Author:
chronos
Message:
  • Přidáno: Zprovozněna kontrola aktuálnosti webu a automatické aktualizace.
  • Přidáno: Plná instalace výchozí databáze.
  • Upraveno: Anonymní uživatel je nyní reprezentován null hodnotou.
Location:
trunk/Common
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Common/Page.php

    r485 r493  
    158158    if($this->System->Config['Web']['UserSupport'] == 1)
    159159    {
    160       if($this->System->Modules['User']->User['Id'] == $this->System->Modules['User']->AnonymousUserId)
     160      if($this->System->Modules['User']->User['Id'] == null)
    161161        $Output .= '<a href="'.$this->System->Config['Web']['RootFolder'].'/?Action=LoginForm">Přihlášení</a> <a href="'.$this->System->Config['Web']['RootFolder'].'/?Action=UserRegister">Registrace</a>';
    162162        else $Output .= $this->System->Modules['User']->User['Name'].' <a href="'.$this->System->Config['Web']['RootFolder'].'/?Action=Logout">Odhlásit</a>';
  • trunk/Common/Update.php

    r491 r493  
    88  var $Trace;
    99  var $VersionTable;
     10  /* @var Database */
    1011  var $Database;
    1112  var $InstallMethod;
     
    1617          $this->Trace = array();
    1718          $this->VersionTable = 'SystemVersion';
     19          $this->InstallMethod = 'FullInstall';
     20          $this->InsertSampleDataMethod = 'InsertSampleData';
    1821  }
    1922 
     
    2831  {     
    2932          $DbResult = $this->Database->query('SHOW TABLES LIKE "'.$this->VersionTable.'"');
    30     return($DbResult->num_rows > 0);
     33    return($DbResult->num_rows > 0);   
    3134  }
    3235
     
    6366  }
    6467 
     68  function InsertSampleData()
     69  {     
     70        $InstallMethod = $this->InsertSampleDataMethod;
     71        $InstallMethod($this);
     72  }
     73 
    6574  function Execute($Query)
    6675  {
    67           echo($Query.'<br/>');
     76          echo($Query.';<br/>');
    6877          flush();
    6978          $this->Database->query($Query);
     
    110119      if(!$this->UpdateManager->IsUpToDate())
    111120        $Output .= '<input type="submit" name="update" value="Aktualizovat"/> ';
     121      $Output .= '<input type="submit" name="insert_sample_data" value="Vložit vzorová data"/> ';
    112122      $Output .= '<input type="submit" name="uninstall" value="Odinstalovat"/> ';
    113123    } else $Output .= '<input type="submit" name="install" value="Instalovat"/> ';
     
    120130  function Show()
    121131  {
    122     session_start();
    123    
    124132    $Output = '<?xml version="1.0" encoding="utf-8"?>
    125133    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
     
    167175        {
    168176          $Output .= '<h3>Aktualizace</h3>';
    169           $UpdateManager->Update();
     177          $this->UpdateManager->Update();
    170178          $Output .= $this->ControlPanel();
    171179        } else
     
    173181        {
    174182          $Output .= '<h3>Instalace</h3>';
    175           $UpdateManager->Install();
     183          $this->UpdateManager->Install();
     184          $this->UpdateManager->Update();
    176185          $Output .= $this->ControlPanel();
    177186        } else
     
    179188        {
    180189          $Output .= '<h3>Odinstalace</h3>';
    181           $UpdateManager->Uninstall();
     190          $this->UpdateManager->Uninstall();
     191          $Output .= $this->ControlPanel();
     192        } else
     193        if(array_key_exists('insert_sample_data', $_POST))
     194        {
     195          $Output .= '<h3>Vložení vzorových dat</h3>';
     196          $this->UpdateManager->InsertSampleData();
    182197          $Output .= $this->ControlPanel();
    183198        } else
  • trunk/Common/User.php

    r439 r493  
    5151  var $User = array();
    5252  var $DefaultRole = 2;
    53   var $AnonymousUserId = 98;
    5453  var $OnlineStateTimeout = 600; // in seconds
    5554  var $PermissionCache = array();
     
    7473      $this->Database->update('UserOnline', 'SessionId="'.$SID.'"', array('ActivityTime' => 'NOW()'));
    7574    } else $this->Database->insert('UserOnline', array('SessionId' => $SID,
    76       'User' => $this->AnonymousUserId, 'LoginTime' => 'NOW()', 'ActivityTime' => 'NOW()',
     75      'User' => null, 'LoginTime' => 'NOW()', 'ActivityTime' => 'NOW()',
    7776      'IpAddress' => GetRemoteAddress(), 'HostName' => gethostbyaddr(GetRemoteAddress()),
    7877      'ScriptName' => $_SERVER['PHP_SELF']));
    79     //echo($this->Database->LastQuery);
    8078
    8179    // Check login
    8280    $Query = $this->Database->select('UserOnline', '*', 'SessionId="'.$SID.'"');
    8381    $Row = $Query->fetch_assoc();
    84     if($Row['User'] != $this->AnonymousUserId)
     82    if($Row['User'] != '')
    8583    {
    8684      $Query = $this->Database->query('SELECT User.*, UserCustomerRel.Customer AS Member FROM User LEFT JOIN UserCustomerRel ON UserCustomerRel.User=User.Id WHERE User.Id='.$Row['User']);     
     
    8987    } else
    9088    {
    91       $Query = $this->Database->select('User', '*', 'Id='.$this->AnonymousUserId);
    92       $this->User = $Query->fetch_assoc();
     89      $Query = $this->Database->select('User', '*', 'Id IS NULL');
     90      $this->User = array('Id' => null, 'Member' => null);
    9391      $Result = USER_NOT_LOGGED;
    9492    }
     
    9997    {
    10098      $this->Database->delete('UserOnline', 'Id='.$DbRow['Id']);
    101       if($DbRow['User'] != $this->AnonymousUserId) $this->System->Modules['Log']->NewRecord('User', 'Logout');
     99      if($DbRow['User'] != null) $this->System->Modules['Log']->NewRecord('User', 'Logout');
    102100    }
    103101    //$this->LoadPermission($this->User['Role']);
     
    198196        // načtení stavu stromu
    199197        $Result = USER_LOGGED_IN;
     198        $this->Check();
    200199        $this->System->Modules['Log']->NewRecord('User', 'Login', 'Login='.$Login.',Host='.gethostbyaddr(GetRemoteAddress()));
    201200      }
    202201    } else $Result = USER_NOT_REGISTRED;
    203     $this->Check();
    204202    return($Result);
    205203  }
     
    208206  {
    209207    $SID = session_id();
    210     $this->Database->update('UserOnline', 'SessionId="'.$SID.'"', array('User' => $this->AnonymousUserId));
     208    $this->Database->update('UserOnline', 'SessionId="'.$SID.'"', array('User' => null));
    211209    $this->System->Modules['Log']->NewRecord('User', 'Logout', $this->User['Login']);
    212210    $this->Check();
  • trunk/Common/Version.php

    r491 r493  
    11<?php
    22
    3 $Revision = 491; // Subversion revision
    4 $DatabaseRevision = 491;
    5 $ReleaseTime = '2013-02-25';
     3$Revision = 493; // Subversion revision
     4$DatabaseRevision = 493;
     5$ReleaseTime = '2013-03-01';
    66
    77?>
Note: See TracChangeset for help on using the changeset viewer.