Example #1
0
    public function __construct($repositoryid, $context = SYSCONTEXTID, $options = array()) {
        global $USER;
        parent::__construct($repositoryid, $context, $options);

        // TODO: I wish there was somewhere we could explicitly put this outside of constructor..
        $googletoken = optional_param('token', false, PARAM_RAW);
        if($googletoken){
            $gauth = new google_authsub(false, $googletoken); // will throw exception if fails
            google_picasa::set_sesskey($gauth->get_sessiontoken(), $USER->id);
        }
        $this->check_login();
    }
Example #2
0
 public function post_control($stage, $params)
 {
     if ($stage != PORTFOLIO_STAGE_CONFIG) {
         return;
     }
     if (!array_key_exists('token', $params)) {
         throw new portfolio_plugin_exception('noauthtoken', 'portfolio_picasa');
     }
     // we now have our auth token, get a session token..
     $gauth = new google_authsub(false, $params['token']);
     $this->sessionkey = $gauth->get_sessiontoken();
     google_picasa::set_sesskey($this->sessionkey, $this->get('user')->id);
 }