/**
  * Check for auth tokens
  * @return mixed
  */
 public function init()
 {
     parent::init();
     if (!Summit::get_active()->isInDB()) {
         return $this->httpError(404, 'There is no active summit');
     }
     /**
      * On the existing tokenauthentication system, this is a fairly trivialmatter, and I'm not so sure it's anything to navigate right now.
      * Thiswas implemented to provide the video upload people a simple API foradding videos. It's a very specific use c
      * ase, and general users shouldnot be using it. If they can and they are, then that needs to bechanged.
      */
     $result = $this->checkAuthenticationToken();
     if (!$result && !Member::currentUser()) {
         //check if speaker registration token is present..
         $speaker_registration_token = $this->request->getVar(SpeakerRegistrationRequest::ConfirmationTokenParamName);
         if (!is_null($speaker_registration_token)) {
             $request = $this->speaker_registration_request_repository->getByConfirmationToken($speaker_registration_token);
             if (is_null($request) || $request->alreadyConfirmed()) {
                 return SummitSecurity::permission_failure($this);
             }
             // redirect to register member speaker
             $url = Controller::join_links(Director::baseURL(), 'summit-login', 'registration');
             return $this->redirect($url . '?BackURL=' . urlencode($this->request->getURL()) . '&' . SpeakerRegistrationRequest::ConfirmationTokenParamName . '=' . $speaker_registration_token);
         }
         return SummitSecurity::permission_failure($this);
     }
     $speaker = Member::currentUser()->getCurrentSpeakerProfile();
     if (!$speaker) {
         $speaker = PresentationSpeaker::create(array('MemberID' => Member::currentUserID(), 'SummitID' => Summit::get_active()->ID, 'FirstName' => Member::currentUser()->FirstName, 'LastName' => Member::currentUser()->Surname));
         $speaker->write();
     }
 }
 /**
  * Check for auth tokens
  * @return mixed
  */
 public function init()
 {
     parent::init();
     if (!Summit::get_active()->isInDB()) {
         return $this->httpError(404, 'There is no active summit');
     }
     /**
      * On the existing tokenauthentication system, this is a fairly trivialmatter, and I'm not so sure it's anything to navigate right now.
      * Thiswas implemented to provide the video upload people a simple API foradding videos. It's a very specific use c
      * ase, and general users shouldnot be using it. If they can and they are, then that needs to bechanged.
      */
     $result = $this->checkAuthenticationToken();
     if (!$result && !Member::currentUser()) {
         //check if speaker registration token is present..
         $speaker_registration_token = $this->request->getVar(SpeakerRegistrationRequest::ConfirmationTokenParamName);
         if (!is_null($speaker_registration_token)) {
             // send it to SummitSecurity Controller to complete speaker registration
             $request = $this->speaker_registration_request_repository->getByConfirmationToken($speaker_registration_token);
             if (is_null($request) || $request->alreadyConfirmed()) {
                 return $this->httpError(404);
             }
             // redirect to register member speaker
             $url = Controller::join_links(Director::baseURL(), 'summit-login', 'registration');
             Session::set(SpeakerRegistrationRequest::ConfirmationTokenParamName, $speaker_registration_token);
             Session::set('BackURL', $this->request->getURL());
             return $this->redirect($url);
         }
         return SummitSecurity::permission_failure($this);
     }
     $this->speaker_manager->ensureSpeakerProfile(Member::currentUser());
 }