/** * Test that a MemberID was set on MultiFormSession if * a member is logged in. */ function testMemberLogging() { $session = new MultiFormSession(); $session->write(); if($memberID = Member::currentUserID()) { $this->assertEquals($memberID, $session->SubmitterID); } }
/** * Set up the session. * * If MultiFormSessionID isn't set, we assume that this is a new * multiform that requires a new session record to be created. * * @TODO Fix the fact you can continually refresh and create new records * if MultiFormSessionID isn't set. * * @TODO Not sure if we should bake the session stuff directly into MultiForm. * Perhaps it would be best dealt with on a separate class? */ protected function setSession() { $this->session = $this->getCurrentSession(); // If there was no session found, create a new one instead if (!$this->session) { $this->session = new MultiFormSession(); } // Create encrypted identification to the session instance if it doesn't exist if (!$this->session->Hash) { $this->session->Hash = sha1($this->session->ID . '-' . microtime()); $this->session->write(); } }
/** * Set up the session. * * If MultiFormSessionID isn't set, we assume that this is a new * multiform that requires a new session record to be created. * * @TODO Fix the fact you can continually refresh and create new records * if MultiFormSessionID isn't set. * * @TODO Not sure if we should bake the session stuff directly into MultiForm. * Perhaps it would be best dealt with on a separate class? */ protected function setSession() { // If there's a MultiFormSessionID variable set, find that, otherwise create a new session if(isset($_GET['MultiFormSessionID'])) { $this->session = $this->getSessionRecord($_GET['MultiFormSessionID']); } // If there was no session found, create a new one instead if(!$this->session) { $this->session = new MultiFormSession(); $this->session->write(); } // Create encrypted identification to the session instance if it doesn't exist if(!$this->session->Hash) { $this->session->Hash = sha1($this->session->ID . '-' . microtime()); $this->session->write(); } }