// We may or may not have this data based on a $_GET or $_COOKIE based session. // // If we get a session here, it means we found a correctly signed session using // the Application Secret only Facebook and the Application know. We dont know // if it is still valid until we make an API call using the session. A session // can become invalid if it has already expired (should not be getting the // session back in this case) or if the user logged out of Facebook. $me = null; // Session based API call. $uid = 0; if ($session) { try { $uid = $facebook->getUser(); $me = $facebook->api('/me'); } catch (FacebookApiException $e) { error_log($e); } } // login or logout url will be needed depending on current user state. if ($me) { $logoutUrl = $facebook->getLogoutUrl(); } else { $loginUrl = $facebook->getLoginUrl(); } // This call will always work since we are fetching public data. $naitik = $facebook->api('/naitik');
***/ /*** * Facebook made installed=1 available again. We are going to take advantage of that. */ if(isset($_GET['installed']) && !isset($_GET['request_ids'])){ $kt->track_install($uid); } // //Acquire User Info // $capture_user_info_key = $kt->gen_kt_capture_user_info_key(FB_ID, $uid); if(!isset($_COOKIE[$capture_user_info_key])) { $user_info = $facebook->api('/me'); $friends_info = $facebook->api('/me/friends'); $kt->track_user_info($uid, $user_info, $friends_info); if( !headers_sent() ){ setcookie( $capture_user_info_key, 'done', time()+1209600); // 2 weeks } } } } // // Track other messages // if(isset($_GET['kt_type']))