summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--actions/facebookhome.php3
-rw-r--r--lib/facebookutil.php15
2 files changed, 13 insertions, 5 deletions
diff --git a/actions/facebookhome.php b/actions/facebookhome.php
index 5946e6c98..4c2b26355 100644
--- a/actions/facebookhome.php
+++ b/actions/facebookhome.php
@@ -138,9 +138,6 @@ class FacebookhomeAction extends FacebookAction
function setDefaults()
{
- // A default prefix string for notices
- $this->facebook->api_client->data_setUserPreference(
- FACEBOOK_NOTICE_PREFIX, 'dented: ');
$this->facebook->api_client->data_setUserPreference(
FACEBOOK_PROMPTED_UPDATE_PREF, 'false');
}
diff --git a/lib/facebookutil.php b/lib/facebookutil.php
index ec3987273..242d2e06f 100644
--- a/lib/facebookutil.php
+++ b/lib/facebookutil.php
@@ -27,9 +27,21 @@ define("FACEBOOK_PROMPTED_UPDATE_PREF", 2);
function getFacebook()
{
+ static $facebook = null;
+
$apikey = common_config('facebook', 'apikey');
$secret = common_config('facebook', 'secret');
- return new Facebook($apikey, $secret);
+
+ if ($facebook === null) {
+ $facebook = new Facebook($apikey, $secret);
+ }
+
+ if (!$facebook) {
+ common_log(LOG_ERR, 'Could not make new Facebook client obj!',
+ __FILE__);
+ }
+
+ return $facebook;
}
function updateProfileBox($facebook, $flink, $notice) {
@@ -92,7 +104,6 @@ function isFacebookBound($notice, $flink) {
}
-
function facebookBroadcastNotice($notice)
{
$facebook = getFacebook();