コード例 #1
0
 /**
  * Initiate this module
  *
  * @access	public
  * @return	void
  */
 public function init()
 {
     $this->tab_name = ipsRegistry::getClass('class_localization')->words['tab__core'];
     /* Facebook? */
     if (IPSLib::fbc_enabled() === TRUE and $this->memberData['fb_uid']) {
         require_once IPS_ROOT_PATH . 'sources/classes/facebook/connect.php';
         $facebook = new facebook_connect($this->registry);
         /* Test connection */
         $facebook->testConnectSession();
         try {
             $fbuid = $facebook->FB()->get_loggedin_user();
         } catch (Exception $e) {
         }
         if ($fbuid) {
             $this->_isFBUser = true;
         }
     }
 }
コード例 #2
0
 /**
  * Show the member form
  *
  * @access	public
  * @author	Matt Mecham
  * @param	string		Any inline message to show
  * @return	string		Processed HTML
  */
 public function formFacebook($inlineMsg = '')
 {
     //-----------------------------------------
     // INIT
     //-----------------------------------------
     $fbUserData = array(0 => array());
     if (!IPSLib::fbc_enabled()) {
         $this->registry->getClass('output')->showError('fbc_disabled', 1005);
     }
     //-----------------------------------------
     // FB user logged in?
     //-----------------------------------------
     require_once IPS_ROOT_PATH . 'sources/classes/facebook/connect.php';
     $facebook = new facebook_connect($this->registry);
     /* Test connection */
     $facebook->testConnectSession();
     try {
         $fbuid = $facebook->FB()->get_loggedin_user();
     } catch (Exception $e) {
     }
     if ($fbuid) {
         /* Now get the linked user */
         $linkedMemberData = IPSMember::load($fbuid, 'all', 'fb_uid');
         try {
             $fbUserData = $facebook->API()->users_getInfo($fbuid, array('first_name', 'last_name', 'name', 'status'));
         } catch (Exception $e) {
         }
     }
     //-----------------------------------------
     // Thaw bitfield options
     //-----------------------------------------
     $bwOptions = IPSBWOptions::thaw($this->memberData['fb_bwoptions'], 'facebook');
     //-----------------------------------------
     // Merge..
     //-----------------------------------------
     if (is_array($bwOptions)) {
         foreach ($bwOptions as $k => $v) {
             $this->memberData[$k] = $v;
         }
     }
     return $this->registry->getClass('output')->getTemplate('ucp')->membersFacebookConnect($fbuid, $fbUserData[0], $linkedMemberData);
 }