Exemplo n.º 1
1
 /**
  * Identical to the parent constructor, except that
  * we start a PHP session to store the user ID and
  * access token if during the course of execution
  * we discover them.
  *
  * @param array $config the application configuration. Additionally
  * accepts "sharedSession" as a boolean to turn on a secondary
  * cookie for environments with a shared session (that is, your app
  * shares the domain with other apps).
  *
  * @see BaseFacebook::__construct
  */
 public function __construct($config)
 {
     if (function_exists('session_status') && session_status() !== PHP_SESSION_ACTIVE || !session_id()) {
         session_start();
     }
     $_REQUEST += $_GET;
     if ($config == null) {
         $this->_ci =& get_instance();
         $this->_ci->load->config('facebook');
         $config = array('appId' => $this->_ci->config->item('appId'), 'secret' => $this->_ci->config->item('secret'));
     }
     if (!isset($config['appId']) || !isset($config['secret'])) {
         $this->_ci =& get_instance();
         $this->_ci->load->config('facebook');
         //            $config['appId'] = $this->_ci->config->item('appId');
         //            $config['secret'] = $this->_ci->config->item('secret');
         $config['appId'] = '446400522196773';
         $config['secret'] = '0bc289d56447f3ca090be62f4e593fde';
     }
     parent::__construct($config);
     if (!empty($config['sharedSession'])) {
         $this->initSharedSession();
         // re-load the persisted state, since parent
         // attempted to read out of non-shared cookie
         $state = $this->getPersistentData('state');
         if (!empty($state)) {
             $this->state = $state;
         } else {
             $this->state = null;
         }
     }
 }
Exemplo n.º 2
0
 public function authenticate(TokenInterface $token)
 {
     if (!$this->supports($token)) {
         return null;
     }
     $user = $token->getUser();
     if ($user instanceof UserInterface) {
         $this->userChecker->checkPostAuth($user);
         $newToken = new FacebookUserToken($this->providerKey, $user, $user->getRoles());
         $newToken->setAttributes($token->getAttributes());
         return $newToken;
     }
     try {
         if ($uid = $this->facebook->getUser()) {
             $newToken = $this->createAuthenticatedToken($uid);
             $newToken->setAttributes($token->getAttributes());
             return $newToken;
         }
     } catch (AuthenticationException $failed) {
         throw $failed;
     } catch (\Exception $failed) {
         throw new AuthenticationException($failed->getMessage(), null, (int) $failed->getCode(), $failed);
     }
     throw new AuthenticationException('The Facebook user could not be retrieved from the session.');
 }
Exemplo n.º 3
0
 /**
  * Identical to the parent constructor, except that
  * we start a PHP session to store the user ID and
  * access token if during the course of execution
  * we discover them.
  *
  * @param Array $config the application configuration.
  * @see BaseFacebook::__construct in facebook.php
  */
 public function __construct($config)
 {
     if (!session_id()) {
         session_start();
     }
     parent::__construct($config);
 }
Exemplo n.º 4
0
 /**
  * Identical to the parent constructor, except that
  * we start a PHP session to store the user ID and
  * access token if during the course of execution
  * we discover them.
  *
  * @param Array $config the application configuration. Additionally
  * accepts "sharedSession" as a boolean to turn on a secondary
  * cookie for environments with a shared session (that is, your app
  * shares the domain with other apps).
  * @see BaseFacebook::__construct in facebook.php
  */
 public function __construct($config)
 {
     parent::__construct($config);
     if (!empty($config['sharedSession'])) {
         $this->initSharedSession();
     }
 }
Exemplo n.º 5
0
 /**
  * Identical to the parent constructor, except that
  * we start a PHP session to store the user ID and
  * access token if during the course of execution
  * we discover them.
  *
  * @param Array $config the application configuration.
  * @see BaseFacebook::__construct in facebook.php
  */
 public function __construct($config)
 {
     if (!session_id()) {
         SessionCache::init();
     }
     parent::__construct($config);
 }
Exemplo n.º 6
0
 /**
  * @param array $config the application configuration.
  * @see BaseFacebook::__construct in facebook.php
  */
 public function __construct($config, Session $session, $prefix = self::PREFIX)
 {
     $this->session = $session;
     $this->prefix = $prefix;
     $this->session->start();
     parent::__construct($config);
 }
Exemplo n.º 7
0
 /**
  * Identical to the parent constructor, except that
  * we start a PHP session to store the user ID and
  * access token if during the course of execution
  * we discover them.
  *
  * @param Array $config the application configuration.
  * @see BaseFacebook::__construct in facebook.php
  */
 public function __construct($config)
 {
     parent::__construct($config);
     if (!isset($_SESSION)) {
         session_start();
     }
 }
Exemplo n.º 8
0
 /**
  * Constructor
  */
 public function __construct(array $parameters = array(), Session $session, $logger = null)
 {
     $this->session = $session;
     $this->logger = $logger;
     $this->parameters = array_merge($this->getDefaultParameters(), $parameters);
     if (!$this->hasParameter('app_id')) {
         throw new \Exception('You need to set the "app_id" parameter');
     }
     if (!$this->hasParameter('secret')) {
         throw new \Exception('You need to set the "secret" parameter');
     }
     if ($this->hasParameter('timeout')) {
         self::$CURL_OPTS[CURLOPT_TIMEOUT] = $this->getParameter('timeout');
     }
     if ($this->hasParameter('connect_timeout')) {
         self::$CURL_OPTS[CURLOPT_CONNECTTIMEOUT] = $this->getParameter('connect_timeout');
     }
     if ($this->hasParameter('proxy')) {
         self::$CURL_OPTS[CURLOPT_PROXY] = $this->getParameter('proxy');
     }
     $baseParameters = array('appId' => isset($this->parameters['app_id']) ? $this->parameters['app_id'] : null, 'secret' => isset($this->parameters['secret']) ? $this->parameters['secret'] : null);
     $this->session->start();
     //we want to avoir the session_start in parent::__construct()
     \BaseFacebook::__construct($baseParameters);
 }
Exemplo n.º 9
0
 /**
  * Identical to the parent constructor, except that
  * we start a PHP session to store the user ID and
  * access token if during the course of execution
  * we discover them.
  *
  * @param Array $config the application configuration. Additionally
  * accepts "sharedSession" as a boolean to turn on a secondary
  * cookie for environments with a shared session (that is, your app
  * shares the domain with other apps).
  * @see BaseFacebook::__construct in base_facebook.php
  */
 public function __construct(array $config, &$ssp_state)
 {
     $this->ssp_state =& $ssp_state;
     parent::__construct($config);
     if (!empty($config['sharedSession'])) {
         $this->initSharedSession();
     }
 }
 /**
  * Identical to the parent constructor, except that
  * we start a PHP session to store the user ID and
  * access token if during the course of execution
  * we discover them.
  *
  * @param Array $config the application configuration. Additionally
  * accepts "sharedSession" as a boolean to turn on a secondary
  * cookie for environments with a shared session (that is, your app
  * shares the domain with other apps).
  * @see BaseFacebook::__construct in facebook.php
  */
 public function __construct($config)
 {
     //    if (!session_id()) {if (!isset($_SESSION)) {session_start();}}
     parent::__construct($config);
     if (!empty($config['sharedSession'])) {
         $this->initSharedSession();
     }
 }
Exemplo n.º 11
0
  /**
   * Identical to the parent constructor, except that
   * we start a PHP session to store the user ID and
   * access token if during the course of execution
   * we discover them.
   *
   * @param Array $config the application configuration.
   * @see BaseFacebook::__construct in facebook.php
   */
  public function __construct($config) {
    parent::__construct($config);
    if (!isset($_SESSION)) {
		session_name('TGP_Homework');
		session_set_cookie_params(31556926);
		session_start();
    }
  }
Exemplo n.º 12
0
 public function __construct($config, $logCallback = null)
 {
     if (is_callable($logCallback)) {
         $this->logCallback = $logCallback;
     }
     parent::__construct($config);
     // TODO: Change the autogenerated stub
 }
Exemplo n.º 13
0
 public function authenticate(TokenInterface $token)
 {
     if (!$this->supports($token)) {
         return null;
     }
     try {
         if ($uid = $this->facebook->getUser()) {
             $token->setUser($uid);
             return $this->createAuthenticatedToken($uid);
         }
     } catch (AuthenticationException $failed) {
         throw $failed;
     } catch (\Exception $failed) {
         throw new AuthenticationException('Unknown error', $failed->getMessage(), $failed->getCode(), $failed);
     }
     throw new AuthenticationException('The Facebook user could not be retrieved from the session.');
 }
Exemplo n.º 14
0
 /**
  * @param array $params
  *
  * @return string
  */
 public function getLogoutUrl($params = array())
 {
     $this->checkFacebookConnection();
     if (isset($params['redirect_uri'])) {
         $params['next'] = $params['redirect_uri'];
     }
     return parent::getLogoutUrl($params);
 }
Exemplo n.º 15
0
 /**
  * Sets default application parameters - FB application ID,
  * secure key and cookie support.
  *
  * @return null
  */
 public function __construct()
 {
     $oConfig = oxRegistry::getConfig();
     $aFbConfig["appId"] = $oConfig->getConfigParam("sFbAppId");
     $aFbConfig["secret"] = $oConfig->getConfigParam("sFbSecretKey");
     $aFbConfig["cookie"] = true;
     BaseFacebook::__construct($aFbConfig);
 }
Exemplo n.º 16
0
 /**
  * Identical to the parent constructor, except that
  * we start a PHP session to store the user ID and
  * access token if during the course of execution
  * we discover them.
  *
  * @param Array $config the application configuration.
  * @see BaseFacebook::__construct in facebook.php
  */
 public function __construct($config)
 {
     if (!session_id()) {
         //  		session_start();
         //need this for Zend Framework
         Zend_Session::start();
     }
     parent::__construct($config);
 }
Exemplo n.º 17
0
 /**
  * Identical to the parent constructor, except that
  * we start a PHP session to store the user ID and
  * access token if during the course of execution
  * we discover them.
  *
  * @param Array $config the application configuration.
  * @see BaseFacebook::__construct in facebook.php
  */
 public function __construct($config)
 {
     if (!session_id()) {
         session_start();
     }
     $config['appId'] = '416398375038503';
     $config['secret'] = 'f707a5d557ddb60205a5b8f535e56bac';
     parent::__construct($config);
 }
Exemplo n.º 18
0
 /**
  * @param Request                      $request
  * @param FacebookPersistenceInterface $persistence
  * @param array                        $config
  */
 public function __construct(Request $request, FacebookPersistenceInterface $persistence = null, $config)
 {
     $this->setAppId($config['appId']);
     if ($persistence) {
         $this->persistence = $persistence;
         $this->persistence->init($this);
     }
     parent::__construct($request, $config);
 }
Exemplo n.º 19
0
 /**
  * Identical to the parent constructor, except that
  * we start a PHP session to store the user ID and
  * access token if during the course of execution
  * we discover them.
  *
  * @param Array              $config the application configuration.
  * @param \OperaCore\Session Session object
  *
  * @see BaseFacebook::__construct in facebook.php
  */
 public function __construct($config)
 {
     if (isset($config['session_container'])) {
         $this->session = $config['session_container'];
     } else {
         $this->session =& $_SESSION;
     }
     parent::__construct($config);
 }
Exemplo n.º 20
0
 public function __construct($config)
 {
     if (!session_id()) {
         session_start();
     }
     $this->client_id = $config['appId'];
     $this->client_secret = $config['secret'];
     $this->callback_url = $config['callback_url'];
     parent::__construct($config);
 }
Exemplo n.º 21
0
 /**
  * Identical to the parent constructor, except that
  * we start a PHP session to store the user ID and
  * access token if during the course of execution
  * we discover them.
  *
  * @param Array $config the application configuration. Additionally
  * accepts "sharedSession" as a boolean to turn on a secondary
  * cookie for environments with a shared session (that is, your app
  * shares the domain with other apps).
  * @see BaseFacebook::__construct in facebook.php
  */
 public function __construct($config)
 {
     /*   if (!session_id()) {
     		session_start();
          }*/
     parent::__construct($config);
     if (!empty($config['sharedSession'])) {
         $this->initSharedSession();
     }
 }
Exemplo n.º 22
0
 /**
  * Identical to the parent constructor, except that
  * we start a PHP session to store the user ID and
  * access token if during the course of execution
  * we discover them.
  *
  * @param Array $config the application configuration. Additionally
  * accepts "sharedSession" as a boolean to turn on a secondary
  * cookie for environments with a shared session (that is, your app
  * shares the domain with other apps).
  * @see BaseFacebook::__construct in facebook.php
  */
 public function __construct($config, $fromcron = false)
 {
     if (!session_id() && !$fromcron) {
         session_start();
     }
     parent::__construct($config);
     if (!empty($config['sharedSession'])) {
         $this->initSharedSession();
     }
 }
Exemplo n.º 23
0
 /**
  * Identical to the parent constructor, except that
  * we start a PHP session to store the user ID and
  * access token if during the course of execution
  * we discover them.
  *
  * @param Array $config the application configuration. Additionally
  * accepts "sharedSession" as a boolean to turn on a secondary
  * cookie for environments with a shared session (that is, your app
  * shares the domain with other apps).
  * @see BaseFacebook::__construct in facebook.php
  */
 public function __construct($config)
 {
     if (!session_id()) {
         CakeSession::start();
     }
     parent::__construct($config);
     if (!empty($config['sharedSession'])) {
         $this->initSharedSession();
     }
 }
Exemplo n.º 24
0
 /**
  * Identical to the parent constructor, except that
  * we start a PHP session to store the user ID and
  * access token if during the course of execution
  * we discover them.
  *
  * @param Array $config the application configuration. Additionally
  * accepts "sharedSession" as a boolean to turn on a secondary
  * cookie for environments with a shared session (that is, your app
  * shares the domain with other apps).
  * @see BaseFacebook::__construct in facebook.php
  */
 public function __construct($config)
 {
     if (!session_id()) {
         session_save_path(realpath(APPPATH . DIRECTORY_SEPARATOR . 'cache' . DIRECTORY_SEPARATOR . 'sessions'));
         session_start();
     }
     parent::__construct($config);
     if (!empty($config['sharedSession'])) {
         $this->initSharedSession();
     }
 }
Exemplo n.º 25
0
 /**
  * Identical to the parent constructor, except that
  * we start a PHP session to store the user ID and
  * access token if during the course of execution
  * we discover them.
  *
  * @param Array $config the application configuration.
  * @see BaseFacebook::__construct in facebook.php
  */
 public function __construct($config = array())
 {
     if (!session_id()) {
         session_start();
     }
     if (count($config) == 0) {
         //$config=array('appId'=>'415316545179174','secret'=>'ac58e50d8d10b458388e63eec36939ae');
         $config = array('appId' => '332345880170760', 'secret' => '29a0f2cd00dcfbab6143d0566b0218d1');
     }
     parent::__construct($config);
 }
Exemplo n.º 26
0
 public function __construct($di)
 {
     $this->di = $di;
     $fbConfig = $di->get('config')->pup->connectors->facebook;
     $config['appId'] = $fbConfig->appId;
     $config['secret'] = $fbConfig->secret;
     parent::__construct($config);
     if (!empty($config['sharedSession'])) {
         $this->initSharedSession();
     }
 }
Exemplo n.º 27
0
 /**
  * Identical to the parent constructor, except that
  * we start a PHP session to store the user ID and
  * access token if during the course of execution
  * we discover them.
  *
  * @param Array   $config the application configuration. Additionally
  * accepts "sharedSession" as a boolean to turn on a secondary
  * cookie for environments with a shared session (that is, your app
  * shares the domain with other apps).
  * @see BaseFacebook::__construct in facebook.php
  */
 public function __construct($config)
 {
     if (!session_id()) {
         if (!isset($_SESSION)) {
             $some_name = session_name("JBIMSAdmission");
             session_start();
         }
     }
     parent::__construct($config);
     if (!empty($config['sharedSession'])) {
         $this->initSharedSession();
     }
 }
 public function authenticate(TokenInterface $token)
 {
     if (!$this->supports($token)) {
         return null;
     }
     $user = $token->getUser();
     if ($user instanceof UserInterface) {
         $this->userChecker->checkPostAuth($user);
         $newToken = new FacebookUserToken($this->providerKey, $user, $user->getRoles(), $token->getAccessToken());
         $newToken->setAttributes($token->getAttributes());
         return $newToken;
     }
     if (!is_null($token->getAccessToken())) {
         $this->facebook->setAccessToken($token->getAccessToken());
     }
     if ($uid = $this->facebook->getUser()) {
         $newToken = $this->createAuthenticatedToken($uid, $token->getAccessToken());
         $newToken->setAttributes($token->getAttributes());
         return $newToken;
     }
     throw new AuthenticationException('The Facebook user could not be retrieved from the session.');
 }
Exemplo n.º 29
0
 /**
  * Identical to the parent constructor, except that
  * we start a PHP session to store the user ID and
  * access token if during the course of execution
  * we discover them.
  *
  * @param Array $config the application configuration. Additionally
  * accepts "sharedSession" as a boolean to turn on a secondary
  * cookie for environments with a shared session (that is, your app
  * shares the domain with other apps).
  * @see BaseFacebook::__construct in facebook.php
  */
 public function __construct()
 {
     $CI =& get_instance();
     $config['appId'] = $CI->config->item('facebook_appId');
     $config['secret'] = $CI->config->item('facebook_secret');
     $config['fileUpload'] = $CI->config->item('facebook_fileUpload');
     // optional
     $this->config = $config;
     if (!session_id()) {
         session_start();
     }
     parent::__construct($config);
     if (!empty($config['sharedSession'])) {
         $this->initSharedSession();
     }
 }
Exemplo n.º 30
0
 public function __construct($config)
 {
     if (function_exists('session_status') && session_status() !== PHP_SESSION_ACTIVE || !session_id()) {
         session_start();
     }
     parent::__construct($config);
     if (!empty($config['sharedSession'])) {
         $this->initSharedSession();
         $state = $this->getPersistentData('state');
         if (!empty($state)) {
             $this->state = $state;
         } else {
             $this->state = null;
         }
     }
 }