From: Michael J. Rubinsky Date: Thu, 12 Aug 2010 16:27:06 +0000 (-0400) Subject: Don't initialize the facebook javascript if we are not connected to fb. X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=29e8dbaeeadd00abf3db558adef0356639644d7a;p=horde.git Don't initialize the facebook javascript if we are not connected to fb. --- 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 .= ''