Beispiel #1
0
 public function __construct()
 {
     $this->app = JFactory::getApplication();
     $this->input = $this->app->input;
     $this->config = EB::config();
     $this->apiKey = $this->config->get('integrations_linkedin_api_key');
     $this->apiSecret = $this->config->get('integrations_linkedin_secret_key');
     // Default redirection url
     $this->redirect = rtrim(JURI::root(), '/') . '/administrator/index.php?option=com_easyblog&task=linkedin.grant';
     if ($this->input->get('system', false, 'bool')) {
         $this->redirect .= '&system=1';
     }
     $options = array('appKey' => $this->apiKey, 'appSecret' => $this->apiSecret, 'callbackUrl' => $this->redirect);
     parent::__construct($options);
 }
Beispiel #2
0
 public function __construct($key, $secret, $callback)
 {
     $config = array('appKey' => $key, 'appSecret' => $secret, 'callbackUrl' => $callback);
     parent::__construct($config);
     $this->callback = $callback;
 }
Beispiel #3
0
 public function __construct($key, $secret, $callback)
 {
     parent::__construct(array('appKey' => $key, 'appSecret' => $secret, 'callbackUrl' => $callback));
 }
 /**
  * 1. In_connect class constructor
  *    Checks if we have access or request tokens in session
  */
 public function In_connect()
 {
     /* load configuration from /application/config/linkedin.php file */
     $ci =& get_instance();
     $ci->config->load('linkedin', true);
     $config = $ci->config->item('linkedin');
     $config['callbackUrl'] = site_url($config['callbackUrl']);
     parent::__construct($config);
     $this->in_config = $config;
     $this->setResponseFormat(self::_RESPONSE_JSON);
     /* Save CodeIgniter instance for future use */
     $this->in_ci = $ci;
     /* getting linkedin state from user session data */
     $this->in_authorised = $ci->session->userdata('in_authorised');
     if ($this->in_authorised) {
         // get access token from session
         $this->in_access_token = $ci->session->userdata('in_access_token');
         if (isset($this->in_access_token['oauth_token']) && isset($this->in_access_token['oauth_token_secret'])) {
             // we have access token - we set them for LinkedIn object
             $this->setTokenAccess($this->in_access_token);
             // retrieving user information from session in case we have it
             $this->in_user = $ci->session->userdata('in_user');
         } else {
             // we do not have access token, it means we are not authorised...
             $this->in_authorised = false;
             $ci->session->set_userdata('in_authorised', false);
             // ... and we clear access token whatever it was
             $this->in_access_token = null;
             $ci->session->unset_userdata('in_access_token');
         }
     } else {
         // we are not authorised - set in into session, maybe it was empty
         $ci->session->set_userdata('in_authorised', false);
         // maybe we have request token? getting it from session
         $this->in_request_token = $ci->session->userdata('in_request_token');
         if (!(isset($this->in_request_token['oauth_token']) && isset($this->in_request_token['oauth_token_secret']))) {
             // we do not have request token, we clear it whatever it was
             $this->in_request_token = null;
             $ci->session->unset_userdata('in_request_token');
         }
     }
 }