Changeset 548 for trunk/phpgwapi


Ignore:
Timestamp:
11/06/08 17:27:54 (15 years ago)
Author:
eduardoalex
Message:

Desenvolvimento da tarefa #371

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/phpgwapi/inc/class.sessions.inc.php

    r370 r548  
    520520                        } 
    521521 
     522                        if($this->account_id!=null) { 
     523                                $last_access = $this->get_last_access_on_history($this->account_id); 
     524                                //echo $last_access+($current_config["time_to_account_expires"]*86400); 
     525                                //exit(0); 
     526                                 
     527                                $this->read_repositories(False); 
     528                                if((isset($GLOBALS['phpgw_info']['server']['time_to_account_expires'])) && ($last_access) && ($this->account_lid!="expresso-admin")) { 
     529                                        if ($last_access+($GLOBALS['phpgw_info']['server']['time_to_account_expires']*86400) < time()) 
     530                                        { 
     531                                                if(is_object($GLOBALS['phpgw']->log)) 
     532                                                { 
     533                                                        $GLOBALS['phpgw']->log->message(array( 
     534                                                                'text' => 'W-LoginFailure, account loginid %1 is expired for innativity', 
     535                                                                'p1'   => $this->account_lid, 
     536                                                                'line' => __LINE__, 
     537                                                                'file' => __FILE__ 
     538                                                        )); 
     539                                                        $GLOBALS['phpgw']->log->commit(); 
     540                                                } 
     541                                                $this->reason = 'account is expired'; 
     542                                                $this->cd_reason = 98; 
     543                 
     544                                                return False; 
     545                                        } 
     546                                } 
     547                        } 
     548 
    522549                        /* jakjr: Expresso does not use auto-create account. 
    523550                        if (!$this->account_id && $GLOBALS['phpgw_info']['server']['auto_create_acct'] == True) 
     
    597624 
    598625                        return $this->sessionid; 
     626                } 
     627 
     628                /** 
     629                  * Retorna o UNIX DATE do ultimo acesso dessa conta, baseado na tabela de histórico. 
     630                  */ 
     631                function get_last_access_on_history($account_id) { 
     632                        $GLOBALS['phpgw']->db->query("select li from phpgw_access_log where account_id='$account_id' order by li desc limit 1",__LINE__,__FILE__); 
     633                        if(!$GLOBALS['phpgw']->db->next_record()) 
     634                                return false; 
     635                        return $GLOBALS['phpgw']->db->f('li'); 
    599636                } 
    600637 
Note: See TracChangeset for help on using the changeset viewer.