Wednesday, September 26, 2012

Re: function beforeFilter

 if($this->Session->check('user'))
      $this->user = $this->Session->read('user');
    
    if(!$this->is_user())


if u use Auth Component...than this will not work 4 sure...:)
--
Lep pozdrav, Tilen Majerle



2012/9/26 Jeremy Burns | Class Outfit <jeremyburns@classoutfit.com>
Why not describe your problem?

Jeremy Burns
Class Outfit

http://www.classoutfit.com

On 26 Sep 2012, at 13:10:17, Chris <chris69m@yahoo.com> wrote:

function beforeFilter working on a 1.2,... trying to migrate whole script to 1.3,... 
having problem,... what can be wrong,... ??? please help,... thanks 

  
  function beforeFilter()
  {
    if($this->Session->check('user'))
      $this->user = $this->Session->read('user');
    
    if(!$this->is_user())
    {
      $username = $this->Cookie->read('User.username');
      $hashed_password = $this->Cookie->read('User.hashed_password');
      
      if($username && $hashed_password)
      {
        if(!class_exists('User'))
          loadModel('user');
          
        $User = new User();
        
        if($user = $User->findByUsernameAndHashedPassword($username, $hashed_password))
        {
          $this->Session->write('user', array('id' => $user['User']['id'], 'username' => $user['User']['username'], 'rank' => $user['User']['rank'], 'gender' => $user['User']['gender'], 'firstname' => $user['User']['firstname'], 'lastname' => $user['User']['lastname']));
          $this->set_language($user['User']['language']);
          if($this->Session->check('user'))
            $this->user = $this->Session->read('user');
        }
      }
    }
    



--
Like Us on FacekBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
 
 

--
Like Us on FacekBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
 
 

--
Like Us on FacekBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
 
 

No comments: