From 29e8dbaeeadd00abf3db558adef0356639644d7a Mon Sep 17 00:00:00 2001 From: "Michael J. Rubinsky" Date: Thu, 12 Aug 2010 12:27:06 -0400 Subject: [PATCH] Don't initialize the facebook javascript if we are not connected to fb. --- horde/lib/Block/fb_stream.php | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/horde/lib/Block/fb_stream.php b/horde/lib/Block/fb_stream.php index 156fd1422..a8de74341 100644 --- a/horde/lib/Block/fb_stream.php +++ b/horde/lib/Block/fb_stream.php @@ -117,6 +117,13 @@ class Horde_Block_Horde_fb_stream extends Horde_Block $endpoint = Horde::url('services/facebook.php', true); $html = ''; + /* Init facebook driver, exit early if no prefs exist */ + $facebook = $this->_facebook; + $fbp = $this->_fbp; + if (empty($fbp['sid'])) { + return sprintf(_("You have not properly connected your Facebook account with Horde. You should check your Facebook settings in your %s."), Horde::getServiceLink('options', 'horde')->add('group', 'facebook')->link() . _("preferences") . ''); + } + /* Add the client javascript / initialize it */ Horde::addScriptFile('facebookclient.js'); $script = <<_facebook; - $fbp = $this->_fbp; - if (empty($fbp['sid'])) { - return sprintf(_("You have not properly connected your Facebook account with Horde. You should check your Facebook settings in your %s."), Horde::getServiceLink('options', 'horde')->add('group', 'facebook')->link() . _("preferences") . ''); - } - /* Build the UI */ $html .= ''; $html .= '
'; @@ -173,7 +172,7 @@ EOT; . '
' . $status['status']['message'] . '
'; - + try { if ($facebook->users->hasAppPermission(Horde_Service_Facebook_Auth::EXTEND_PERMS_PUBLISHSTREAM)) { $html .= '' -- 2.11.0