public function fbLocationSearch(Request $request) { $term = $request->term; $fb = \FacebookHelper::fb_init(); $response = $fb->get("/search?q={$term}&type=place¢er=15.8700,100.992&limit=5"); return $fb_response = $response->getDecodedBody(); }
public static function userFriend($fb_id) { if (!empty($fb_id)) { $fb = \FacebookHelper::fb_init(); $response = $fb->get("/me/friends", \Auth::user()->access_token); if (!empty($response)) { $fb_response = $response->getDecodedBody(); $x = 0; foreach ($fb_response['data'] as $friend) { $fb_data[$x] = $friend['id']; $x++; } $user_friends = DB::table('users')->whereIn('fb_id', $fb_data)->select('users.fb_id', 'users.username', 'users.avatar')->get(); return $user_friends; } } }
public function ajaxCheckin() { if (isset(\Auth::user()->id)) { $location = Location::get(); $city = $location->cityName; $lat = $location->latitude; $lng = $location->longitude; $distance = 2000; //meters $limit = 8; //QUERY $term = Input::get('term'); $fb = \FacebookHelper::fb_init(); $response = $fb->get("/search?q={$term}&type=place¢er={$lat},{$lng}&distance={$distance}&limit={$limit}", \Auth::user()->access_token); $fb_response = $response->getDecodedBody(); $response_array = \FacebookHelper::fbResponse($fb_response['data']); return $response_array; } else { return "err: need login"; } }
require BASEDIR . '/fpb-includes/smarty/Smarty.class.php'; require BASEDIR . '/fpb-includes/auth.php'; require BASEDIR . '/fpb-includes/database.php'; require BASEDIR . '/fpb-includes/functions.php'; require BASEDIR . '/fpb-includes/fbhelper.php'; require BASEDIR . '/fpb-includes/spyc.php'; require BASEDIR . '/fpb-includes/plugins.php'; Plugins::Instance()->Load(); $config = FPBDatabase::Instance()->GetConfigArray(); /** * The 'core_loaded' hook is executed after we load up the classes and templates, * prior to any other code being executed * @see Hooks */ Plugins::RunHook('core_loaded'); $fb_helper = new FacebookHelper(); FPBAuth::GetInstance()->CheckFBStatus(); /** * The 'auth_completed' hook is executed after the authentication module has run * @see Hooks */ Plugins::RunHook('auth_completed'); $site_theme = strlen($config["Theme"]) > 0 ? $config["Theme"] : 'coolblue'; $smarty = new Smarty(); $smarty->template_dir = BASEDIR . '/themes/' . $site_theme; $smarty->compile_dir = BASEDIR . '/cache/'; $smarty->assign('theme_path', '/themes/' . $site_theme); if (FPBAuth::GetInstance()->IsLoggedIn()) { $smarty->assign_by_ref('user', FPBAuth::GetInstance()->GetUser()); } require BASEDIR . '/fpb-includes/toolbar.php';