Exemplo n.º 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();
    }
Exemplo n.º 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_googledocs');
     }
     // we now have our auth token, get a session token..
     $gauth = new google_authsub(false, $params['token']);
     $this->sessiontoken = $gauth->get_sessiontoken();
     google_docs::set_sesskey($this->sessiontoken, $this->get('user')->id);
 }
 public function __construct($repositoryid, $context = SITEID, $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_docs::set_sesskey($gauth->get_sessiontoken(), $USER->id);
     }
     # fixme - we are not checking login before all functions in the repo api.. eg search
     # MDL-17474
     $this->check_login();
 }