Changeset 493 for trunk/Common/User.php


Ignore:
Timestamp:
Mar 1, 2013, 9:20:14 PM (11 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.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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();
Note: See TracChangeset for help on using the changeset viewer.