From 65dbf485e401cfd04c32acd7e635b377928e4fab Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Thu, 24 Feb 2011 12:52:31 -0800 Subject: [PATCH] FacebookBridge - make a huge fuss if we can't create a valid Facebookclient --- plugins/FacebookBridge/lib/facebookclient.php | 25 ++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/plugins/FacebookBridge/lib/facebookclient.php b/plugins/FacebookBridge/lib/facebookclient.php index 030a75caed..80e3331824 100644 --- a/plugins/FacebookBridge/lib/facebookclient.php +++ b/plugins/FacebookBridge/lib/facebookclient.php @@ -51,7 +51,14 @@ class Facebookclient function __construct($notice) { $this->facebook = self::getFacebook(); - $this->notice = $notice; + + if (empty($this->facebook)) { + throw new FacebookApiException( + "Could not create Facebook client! Bad application ID or secret?" + ); + } + + $this->notice = $notice; $this->flink = Foreign_link::getByUserID( $notice->profile_id, @@ -89,6 +96,22 @@ class Facebookclient $secret = common_config('facebook', 'global_secret'); } + if (empty($appId)) { + common_log( + LOG_WARNING, + "Couldn't find Facebook application ID!", + __FILE__ + ); + } + + if (empty($secret)) { + common_log( + LOG_WARNING, + "Couldn't find Facebook application ID!", + __FILE__ + ); + } + return new Facebook( array( 'appId' => $appId, -- 2.39.5