summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README49
-rw-r--r--classes/Profile.php5
-rw-r--r--lib/api.php20
-rw-r--r--lib/mail.php72
-rw-r--r--lib/omb.php2
-rw-r--r--lib/router.php8
-rw-r--r--lib/unqueuemanager.php8
-rw-r--r--lib/util.php2
-rw-r--r--plugins/FBConnect/README76
-rw-r--r--plugins/Facebook/FBCLoginGroupNav.php (renamed from plugins/FBConnect/FBCLoginGroupNav.php)0
-rw-r--r--plugins/Facebook/FBCSettingsNav.php (renamed from plugins/FBConnect/FBCSettingsNav.php)0
-rw-r--r--plugins/Facebook/FBC_XDReceiver.php (renamed from plugins/FBConnect/FBC_XDReceiver.php)0
-rw-r--r--plugins/Facebook/FBConnect.css (renamed from plugins/FBConnect/FBConnectPlugin.css)0
-rw-r--r--plugins/Facebook/FBConnectAuth.php (renamed from plugins/FBConnect/FBConnectAuth.php)2
-rw-r--r--plugins/Facebook/FBConnectLogin.php (renamed from plugins/FBConnect/FBConnectLogin.php)3
-rw-r--r--plugins/Facebook/FBConnectSettings.php (renamed from plugins/FBConnect/FBConnectSettings.php)0
-rw-r--r--plugins/Facebook/FacebookPlugin.php (renamed from plugins/FBConnect/FBConnectPlugin.php)252
-rw-r--r--plugins/Facebook/README129
-rw-r--r--plugins/Facebook/facebook/facebook.php (renamed from extlib/facebook/facebook.php)0
-rw-r--r--plugins/Facebook/facebook/facebook_desktop.php (renamed from extlib/facebook/facebook_desktop.php)0
-rwxr-xr-xplugins/Facebook/facebook/facebookapi_php5_restlib.php (renamed from extlib/facebook/facebookapi_php5_restlib.php)0
-rw-r--r--plugins/Facebook/facebook/jsonwrapper/JSON/JSON.php (renamed from extlib/facebook/jsonwrapper/JSON/JSON.php)0
-rw-r--r--plugins/Facebook/facebook/jsonwrapper/JSON/LICENSE (renamed from extlib/facebook/jsonwrapper/JSON/LICENSE)0
-rw-r--r--plugins/Facebook/facebook/jsonwrapper/jsonwrapper.php (renamed from extlib/facebook/jsonwrapper/jsonwrapper.php)0
-rw-r--r--plugins/Facebook/facebook/jsonwrapper/jsonwrapper_inner.php (renamed from extlib/facebook/jsonwrapper/jsonwrapper_inner.php)0
-rw-r--r--plugins/Facebook/facebookaction.php (renamed from lib/facebookaction.php)44
-rw-r--r--plugins/Facebook/facebookhome.php (renamed from actions/facebookhome.php)6
-rw-r--r--plugins/Facebook/facebookinvite.php (renamed from actions/facebookinvite.php)2
-rw-r--r--plugins/Facebook/facebooklogin.php (renamed from actions/facebooklogin.php)34
-rwxr-xr-xplugins/Facebook/facebookqueuehandler.php (renamed from scripts/facebookqueuehandler.php)7
-rw-r--r--plugins/Facebook/facebookremove.php (renamed from actions/facebookremove.php)6
-rw-r--r--plugins/Facebook/facebooksettings.php (renamed from actions/facebooksettings.php)24
-rw-r--r--plugins/Facebook/facebookutil.php (renamed from lib/facebookutil.php)41
-rw-r--r--plugins/Facebook/fbfavicon.ico (renamed from plugins/FBConnect/fbfavicon.ico)bin1150 -> 1150 bytes
-rw-r--r--plugins/TwitterBridge/twitter.php37
-rwxr-xr-xscripts/getvaliddaemons.php1
-rw-r--r--tests/URLDetectionTest.php6
37 files changed, 503 insertions, 333 deletions
diff --git a/README b/README
index ee75b802e..03064ba18 100644
--- a/README
+++ b/README
@@ -526,8 +526,6 @@ This will run eight (for now) queue handlers:
of registered users.
* xmppconfirmhandler.php - sends confirmation messages to registered
users.
-* facebookqueuehandler.php - sends queued notices to Facebook for users
- of the built-in Facebook application.
Note that these queue daemons are pretty raw, and need your care. In
particular, they leak memory, and you may want to restart them on a
@@ -545,53 +543,6 @@ our kind of hacky home-grown DB-based queue solution. See the "queues"
config section below for how to configure to use STOMP. As of this
writing, the software has been tested with ActiveMQ (
-Built-in Facebook Application
------------------------------
-
-StatusNet's Facebook application allows your users to automatically
-update their Facebook statuses with their latest notices, invite
-their friends to use the app (and thus your site), view their notice
-timelines, and post notices -- all from within Facebook. The application
-is built into StatusNet and runs on your host. For automatic Facebook
-status updating to work you will need to enable queuing and run the
-facebookqueuehandler.php daemon (see the "Queues and daemons" section
-above).
-
-Quick setup instructions*:
-
-Install the Facebook Developer application on Facebook:
-
- http://www.facebook.com/developers/
-
-Use it to create a new application and generate an API key and secret.
-Uncomment the Facebook app section of your config.php and copy in the
-key and secret, e.g.:
-
- # Config section for the built-in Facebook application
- $config['facebook']['apikey'] = 'APIKEY';
- $config['facebook']['secret'] = 'SECRET';
-
-In Facebook's application editor, specify the following URLs for your app:
-
-- Canvas Callback URL: http://example.net/mublog/facebook/
-- Post-Remove Callback URL: http://example.net/mublog/facebook/remove
-- Post-Add Redirect URL: http://apps.facebook.com/yourapp/
-- Canvas Page URL: http://apps.facebook.com/yourapp/
-
-(Replace 'example.net' with your host's URL, 'mublog' with the path
-to your StatusNet installation, and 'yourapp' with the name of the
-Facebook application you created.)
-
-Additionally, Choose "Web" for Application type in the Advanced tab.
-In the "Canvas setting" section, choose the "FBML" for Render Method,
-"Smart Size" for IFrame size, and "Full width (760px)" for Canvas Width.
-Everything else can be left with default values.
-
-*For more detailed instructions please see the installation guide on the
-StatusNet wiki:
-
- http://status.net/trac/wiki/FacebookApplication
-
Sitemaps
--------
diff --git a/classes/Profile.php b/classes/Profile.php
index 5fb7bb678..53d07fb2f 100644
--- a/classes/Profile.php
+++ b/classes/Profile.php
@@ -52,6 +52,11 @@ class Profile extends Memcached_DataObject
/* the code above is auto generated do not remove the tag below */
###END_AUTOCODE
+ function getUser()
+ {
+ return User::staticGet('id', $this->id);
+ }
+
function getAvatar($width, $height=null)
{
if (is_null($height)) {
diff --git a/lib/api.php b/lib/api.php
index 7a63a4a78..9bd2083de 100644
--- a/lib/api.php
+++ b/lib/api.php
@@ -134,11 +134,19 @@ class ApiAction extends Action
$twitter_user['protected'] = false; # not supported by StatusNet yet
$twitter_user['followers_count'] = $profile->subscriberCount();
- // To be supported soon...
- $twitter_user['profile_background_color'] = '';
- $twitter_user['profile_text_color'] = '';
- $twitter_user['profile_link_color'] = '';
- $twitter_user['profile_sidebar_fill_color'] = '';
+ // Need to pull up the user for some of this
+ $user = $profile->getUser();
+ $design = $user->getDesign();
+ $defaultDesign = Design::siteDesign();
+ if (!$design) $design = $defaultDesign;
+ $color = Design::toWebColor(empty($design->backgroundcolor) ? $defaultDesign->backgroundcolor : $design->backgroundcolor);
+ $twitter_user['profile_background_color'] = ($color == null) ? '' : '#'.$color->hexValue();
+ $color = Design::toWebColor(empty($design->textcolor) ? $defaultDesign->textcolor : $design->textcolor);
+ $twitter_user['profile_text_color'] = ($color == null) ? '' : '#'.$color->hexValue();
+ $color = Design::toWebColor(empty($design->linkcolor) ? $defaultDesign->linkcolor : $design->linkcolor);
+ $twitter_user['profile_link_color'] = ($color == null) ? '' : '#'.$color->hexValue();
+ $color = Design::toWebColor(empty($design->sidebarcolor) ? $defaultDesign->sidebarcolor : $design->sidebarcolor);
+ $twitter_user['profile_sidebar_fill_color'] = ($color == null) ? '' : '#'.$color->hexValue();
$twitter_user['profile_sidebar_border_color'] = '';
$twitter_user['friends_count'] = $profile->subscriptionCount();
@@ -147,8 +155,6 @@ class ApiAction extends Action
$twitter_user['favourites_count'] = $profile->faveCount(); // British spelling!
- // Need to pull up the user for some of this
- $user = User::staticGet($profile->id);
$timezone = 'UTC';
diff --git a/lib/mail.php b/lib/mail.php
index 5bf4d7425..5218059e9 100644
--- a/lib/mail.php
+++ b/lib/mail.php
@@ -640,75 +640,3 @@ function mail_notify_attn($user, $notice)
mail_to_user($user, $subject, $body);
}
-/**
- * Send a mail message to notify a user that her Twitter bridge link
- * has stopped working, and therefore has been removed. This can
- * happen when the user changes her Twitter password, or otherwise
- * revokes access.
- *
- * @param User $user user whose Twitter bridge link has been removed
- *
- * @return boolean success flag
- */
-
-function mail_twitter_bridge_removed($user)
-{
- common_init_locale($user->language);
-
- $profile = $user->getProfile();
-
- $subject = sprintf(_('Your Twitter bridge has been disabled.'));
-
- $site_name = common_config('site', 'name');
-
- $body = sprintf(_('Hi, %1$s. We\'re sorry to inform you that your ' .
- 'link to Twitter has been disabled. We no longer seem to have ' .
- 'permission to update your Twitter status. (Did you revoke ' .
- '%3$s\'s access?)' . "\n\n" .
- 'You can re-enable your Twitter bridge by visiting your ' .
- "Twitter settings page:\n\n\t%2\$s\n\n" .
- "Regards,\n%3\$s\n"),
- $profile->getBestName(),
- common_local_url('twittersettings'),
- common_config('site', 'name'));
-
- common_init_locale();
- return mail_to_user($user, $subject, $body);
-}
-
-/**
- * Send a mail message to notify a user that her Facebook Application
- * access has been removed.
- *
- * @param User $user user whose Facebook app link has been removed
- *
- * @return boolean success flag
- */
-
-function mail_facebook_app_removed($user)
-{
- common_init_locale($user->language);
-
- $profile = $user->getProfile();
-
- $site_name = common_config('site', 'name');
-
- $subject = sprintf(
- _('Your %1$s Facebook application access has been disabled.',
- $site_name));
-
- $body = sprintf(_("Hi, %1\$s. We're sorry to inform you that we are " .
- 'unable to update your Facebook status from %2$s, and have disabled ' .
- 'the Facebook application for your account. This may be because ' .
- 'you have removed the Facebook application\'s authorization, or ' .
- 'have deleted your Facebook account. You can re-enable the ' .
- 'Facebook application and automatic status updating by ' .
- "re-installing the %2\$s Facebook application.\n\nRegards,\n\n%2\$s"),
- $user->nickname, $site_name);
-
- common_init_locale();
- return mail_to_user($user, $subject, $body);
-
-}
-
-
diff --git a/lib/omb.php b/lib/omb.php
index 0566701ff..cd6d6e1b2 100644
--- a/lib/omb.php
+++ b/lib/omb.php
@@ -87,7 +87,7 @@ function omb_broadcast_notice($notice)
common_debug('Posting to ' . $rp->postnoticeurl, __FILE__);
/* Post notice. */
- $service = new Laconica_OMB_Service_Consumer(
+ $service = new StatusNet_OMB_Service_Consumer(
array(OMB_ENDPOINT_POSTNOTICE => $rp->postnoticeurl));
try {
$service->setToken($rp->token, $rp->secret);
diff --git a/lib/router.php b/lib/router.php
index a5b6a9a30..4fb0834fd 100644
--- a/lib/router.php
+++ b/lib/router.php
@@ -86,14 +86,6 @@ class Router
$m->connect('doc/:title', array('action' => 'doc'));
- // facebook
-
- $m->connect('facebook', array('action' => 'facebookhome'));
- $m->connect('facebook/index.php', array('action' => 'facebookhome'));
- $m->connect('facebook/settings.php', array('action' => 'facebooksettings'));
- $m->connect('facebook/invite.php', array('action' => 'facebookinvite'));
- $m->connect('facebook/remove', array('action' => 'facebookremove'));
-
// main stuff is repetitive
$main = array('login', 'logout', 'register', 'subscribe',
diff --git a/lib/unqueuemanager.php b/lib/unqueuemanager.php
index 51261bcd7..72dbc4eed 100644
--- a/lib/unqueuemanager.php
+++ b/lib/unqueuemanager.php
@@ -48,12 +48,6 @@ class UnQueueManager
jabber_public_notice($notice);
}
break;
- case 'facebook':
- if ($this->_isLocal($notice)) {
- require_once INSTALLDIR . '/lib/facebookutil.php';
- return facebookBroadcastNotice($notice);
- }
- break;
case 'ping':
if ($this->_isLocal($notice)) {
require_once INSTALLDIR . '/lib/ping.php';
@@ -72,7 +66,7 @@ class UnQueueManager
break;
default:
if (Event::handle('UnqueueHandleNotice', array(&$notice, $queue))) {
- throw ServerException("UnQueueManager: Unknown queue: $queue");
+ throw new ServerException("UnQueueManager: Unknown queue: $queue");
}
}
}
diff --git a/lib/util.php b/lib/util.php
index e641afd4d..b6e89f0bd 100644
--- a/lib/util.php
+++ b/lib/util.php
@@ -906,8 +906,6 @@ function common_broadcast_notice($notice, $remote=false)
function common_enqueue_notice($notice)
{
static $localTransports = array('omb',
- 'twitter',
- 'facebook',
'ping');
static $allTransports = array('sms', 'plugin');
diff --git a/plugins/FBConnect/README b/plugins/FBConnect/README
deleted file mode 100644
index 77d57eff9..000000000
--- a/plugins/FBConnect/README
+++ /dev/null
@@ -1,76 +0,0 @@
-This plugin allows you to utilize Facebook Connect with StatusNet.
-Supported Facebook Connect features:
-
-- Authenticate (register/login/logout -- works similar to OpenID)
-- Associate an existing StatusNet account with a Facebook account
-- Disconnect a Facebook account from a StatusNet account
-
-Future planned functionality:
-
-- Invite Facebook friends to use your StatusNet installation
-- Auto-subscribe Facebook friends already using StatusNet
-- Share StatusNet favorite notices to your Facebook stream
-
-To use the plugin you will need to configure a Facebook application
-to point to your StatusNet installation (see the Installation section
-below).
-
-Installation
-============
-
-If you don't already have the built-in Facebook application configured,
-you'll need to log into Facebook and create/configure a new application.
-Please follow the instructions in the section titled, "Setting Up Your
-Application and Getting an API Key," on the following page of the
-Facebook developer wiki:
-
- http://wiki.developers.facebook.com/index.php/Connect/Setting_Up_Your_Site
-
-If you already are using the build-in StatusNet Facebook application,
-you can modify your existing application's configuration using the
-Facebook Developer Application on Facebook. Use it to edit your
-application settings, and under the 'Connect' tab, change the 'Connect
-URL' to be the main URL for your StatusNet site. E.g.:
-
- http://SITE/PATH_TO_STATUSNET/
-
-After you application is created and configured, you'll need to add its
-API key and secret to your StatusNet config.php file:
-
- $config['facebook']['apikey'] = 'APIKEY';
- $config['facebook']['secret'] = 'SECRET';
-
-Finally, to enable the plugin, add the following stanza to your
-config.php:
-
- addPlugin('FBConnect');
-
-To try out the plugin, fire up your browser and connect to:
-
- http://SITE/PATH_TO_STATUSNET/main/facebooklogin
-
-or, if you do not have fancy URLs turned on:
-
- http://SITE/PATH_TO_STATUSNET/index.php/main/facebooklogin
-
-You should see a page with a blue button that says: "Connect with
-Facebook".
-
-Connect/Disconnect existing account
-===================================
-
-If the Facebook Connect plugin is enabled, there will be a new Facebook
-Connect Settings tab under each user's Connect menu. Users can connect
-and disconnect to their Facebook accounts from it. Note: Before a user
-can disconnect from Facebook, she must set a normal StatusNet password.
-Otherwise, she might not be able to login in to her account in the
-future. This is usually only required for users who have used Facebook
-Connect to register their StatusNet account, and therefore haven't
-already set a local password.
-
-Helpful links
-=============
-
-Facebook Connect Homepage:
-http://developers.facebook.com/connect.php
-
diff --git a/plugins/FBConnect/FBCLoginGroupNav.php b/plugins/Facebook/FBCLoginGroupNav.php
index 81b2520a4..81b2520a4 100644
--- a/plugins/FBConnect/FBCLoginGroupNav.php
+++ b/plugins/Facebook/FBCLoginGroupNav.php
diff --git a/plugins/FBConnect/FBCSettingsNav.php b/plugins/Facebook/FBCSettingsNav.php
index ed02371e2..ed02371e2 100644
--- a/plugins/FBConnect/FBCSettingsNav.php
+++ b/plugins/Facebook/FBCSettingsNav.php
diff --git a/plugins/FBConnect/FBC_XDReceiver.php b/plugins/Facebook/FBC_XDReceiver.php
index 2bc790d5a..2bc790d5a 100644
--- a/plugins/FBConnect/FBC_XDReceiver.php
+++ b/plugins/Facebook/FBC_XDReceiver.php
diff --git a/plugins/FBConnect/FBConnectPlugin.css b/plugins/Facebook/FBConnect.css
index 49217bf13..49217bf13 100644
--- a/plugins/FBConnect/FBConnectPlugin.css
+++ b/plugins/Facebook/FBConnect.css
diff --git a/plugins/FBConnect/FBConnectAuth.php b/plugins/Facebook/FBConnectAuth.php
index 647d5def8..b909a4977 100644
--- a/plugins/FBConnect/FBConnectAuth.php
+++ b/plugins/Facebook/FBConnectAuth.php
@@ -27,7 +27,7 @@
* @link http://status.net/
*/
-require_once INSTALLDIR . '/plugins/FBConnect/FBConnectPlugin.php';
+require_once INSTALLDIR . '/plugins/Facebook/FacebookPlugin.php';
class FBConnectauthAction extends Action
{
diff --git a/plugins/FBConnect/FBConnectLogin.php b/plugins/Facebook/FBConnectLogin.php
index 5696d8848..f146bef7d 100644
--- a/plugins/FBConnect/FBConnectLogin.php
+++ b/plugins/Facebook/FBConnectLogin.php
@@ -21,7 +21,8 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
exit(1);
}
-require_once INSTALLDIR . '/plugins/FBConnect/FBConnectPlugin.php';
+
+require_once INSTALLDIR . '/plugins/Facebook/FacebookPlugin.php';
class FBConnectLoginAction extends Action
{
diff --git a/plugins/FBConnect/FBConnectSettings.php b/plugins/Facebook/FBConnectSettings.php
index 911c56787..911c56787 100644
--- a/plugins/FBConnect/FBConnectSettings.php
+++ b/plugins/Facebook/FBConnectSettings.php
diff --git a/plugins/FBConnect/FBConnectPlugin.php b/plugins/Facebook/FacebookPlugin.php
index 0dacf9012..fc3adcfad 100644
--- a/plugins/FBConnect/FBConnectPlugin.php
+++ b/plugins/Facebook/FacebookPlugin.php
@@ -2,7 +2,7 @@
/**
* StatusNet, the distributed open-source microblogging tool
*
- * Plugin to enable Facebook Connect
+ * Plugin to add a StatusNet Facebook application
*
* PHP version 5
*
@@ -27,22 +27,16 @@
* @link http://status.net/
*/
-if (!defined('STATUSNET') && !defined('LACONICA')) {
+if (!defined('STATUSNET')) {
exit(1);
}
define("FACEBOOK_CONNECT_SERVICE", 3);
-require_once INSTALLDIR . '/lib/facebookutil.php';
-require_once INSTALLDIR . '/plugins/FBConnect/FBConnectAuth.php';
-require_once INSTALLDIR . '/plugins/FBConnect/FBConnectLogin.php';
-require_once INSTALLDIR . '/plugins/FBConnect/FBConnectSettings.php';
-require_once INSTALLDIR . '/plugins/FBConnect/FBCLoginGroupNav.php';
-require_once INSTALLDIR . '/plugins/FBConnect/FBCSettingsNav.php';
-require_once INSTALLDIR . '/plugins/FBConnect/FBC_XDReceiver.php';
+require_once INSTALLDIR . '/plugins/Facebook/facebookutil.php';
/**
- * Plugin to enable Facebook Connect
+ * Facebook plugin to add a StatusNet Facebook application
*
* @category Plugin
* @package StatusNet
@@ -51,22 +45,88 @@ require_once INSTALLDIR . '/plugins/FBConnect/FBC_XDReceiver.php';
* @link http://status.net/
*/
-class FBConnectPlugin extends Plugin
+class FacebookPlugin extends Plugin
{
- function __construct()
+
+ /**
+ * Add Facebook app actions to the router table
+ *
+ * Hook for RouterInitialized event.
+ *
+ * @param Net_URL_Mapper &$m path-to-action mapper
+ *
+ * @return boolean hook return
+ */
+
+ function onRouterInitialized(&$m)
{
- parent::__construct();
- }
- // Hook in new actions
- function onRouterInitialized(&$m) {
+ // Facebook App stuff
+
+ $m->connect('facebook/app', array('action' => 'facebookhome'));
+ $m->connect('facebook/app/index.php', array('action' => 'facebookhome'));
+ $m->connect('facebook/app/settings.php',
+ array('action' => 'facebooksettings'));
+ $m->connect('facebook/app/invite.php', array('action' => 'facebookinvite'));
+ $m->connect('facebook/app/remove', array('action' => 'facebookremove'));
+
+ // Facebook Connect stuff
+
$m->connect('main/facebookconnect', array('action' => 'FBConnectAuth'));
$m->connect('main/facebooklogin', array('action' => 'FBConnectLogin'));
$m->connect('settings/facebook', array('action' => 'FBConnectSettings'));
$m->connect('xd_receiver.html', array('action' => 'FBC_XDReceiver'));
- }
- // Add in xmlns:fb
+ return true;
+ }
+
+ /**
+ * Automatically load the actions and libraries used by the Facebook app
+ *
+ * @param Class $cls the class
+ *
+ * @return boolean hook return
+ *
+ */
+
+ function onAutoload($cls)
+ {
+ switch ($cls) {
+ case 'FacebookAction':
+ case 'FacebookhomeAction':
+ case 'FacebookinviteAction':
+ case 'FacebookremoveAction':
+ case 'FacebooksettingsAction':
+ include_once INSTALLDIR . '/plugins/Facebook/' .
+ strtolower(mb_substr($cls, 0, -6)) . '.php';
+ return false;
+ case 'FBConnectAuthAction':
+ case 'FBConnectLoginAction':
+ case 'FBConnectSettingsAction':
+ case 'FBC_XDReceiverAction':
+ include_once INSTALLDIR . '/plugins/Facebook/' .
+ mb_substr($cls, 0, -6) . '.php';
+ return false;
+ case 'FBCLoginGroupNav':
+ include_once INSTALLDIR . '/plugins/Facebook/FBCLoginGroupNav.php';
+ return false;
+ case 'FBCSettingsNav':
+ include_once INSTALLDIR . '/plugins/Facebook/FBCSettingsNav.php';
+ return false;
+ default:
+ return true;
+ }
+ }
+
+ /**
+ * Override normal HTML output to force the content type to
+ * text/html and add in xmlns:fb
+ *
+ * @param Action $action the current action
+ *
+ * @return void
+ */
+
function onStartShowHTML($action)
{
@@ -78,6 +138,7 @@ class FBConnectPlugin extends Plugin
// text/html even though Facebook Connect uses XHTML. This is
// A bug in Facebook Connect, and this is a temporary solution
// until they fix their JavaScript libs.
+
header('Content-Type: text/html');
$action->extraHeaders();
@@ -100,22 +161,31 @@ class FBConnectPlugin extends Plugin
}
}
- // Note: this script needs to appear in the <body>
+ /**
+ * Add in the Facebook Connect JavaScript stuff
+ *
+ * Note: this script needs to appear in the <body>
+ *
+ * @param Action $action the current action
+ *
+ * @return void
+ *
+ */
function onEndShowScripts($action)
{
if ($this->reqFbScripts($action)) {
- $apikey = common_config('facebook', 'apikey');
- $plugin_path = common_path('plugins/FBConnect');
+ $apikey = common_config('facebook', 'apikey');
+ $plugin_path = common_path('plugins/Facebook');
- $login_url = common_local_url('FBConnectAuth');
+ $login_url = common_local_url('FBConnectAuth');
$logout_url = common_local_url('logout');
// XXX: Facebook says we don't need this FB_RequireFeatures(),
// but we actually do, for IE and Safari. Gar.
- $js = '<script type="text/javascript">';
+ $js = '<script type="text/javascript">';
$js .= ' $(document).ready(function () {';
$js .= ' FB_RequireFeatures(';
$js .= ' ["XFBML"], function() {';
@@ -154,6 +224,7 @@ class FBConnectPlugin extends Plugin
$js = sprintf($js, $apikey, $login_url, $logout_url);
// Compress the bugger down a bit
+
$js = str_replace(' ', '', $js);
$action->raw(" $js"); // leading two spaces to make it line up
@@ -161,19 +232,37 @@ class FBConnectPlugin extends Plugin
}
- // Note: this script needs to appear as close as possible to </body>
+ /**
+ * Add in an additional Facebook Connect script that's supposed to
+ * appear as close as possible to </body>
+ *
+ * @param Action $action the current action
+ *
+ * @return void
+ *
+ */
function onEndShowFooter($action)
{
if ($this->reqFbScripts($action)) {
- $action->script('http://static.ak.connect.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php');
+ $action->script('http://static.ak.connect.facebook.com' .
+ '/js/api_lib/v0.4/FeatureLoader.js.php');
}
}
+ /**
+ * Output Facebook Connect specific CSS link
+ *
+ * @param Action $action the current action
+ *
+ * @return void
+ *
+ */
+
function onEndShowStatusNetStyles($action)
{
if ($this->reqFbScripts($action)) {
- $action->cssLink('plugins/FBConnect/FBConnectPlugin.css');
+ $action->cssLink('plugins/Facebook/FBConnect.css');
}
}
@@ -182,12 +271,13 @@ class FBConnectPlugin extends Plugin
* want to output FB namespace, scripts, CSS, etc. on the pages that
* really need them.
*
- * @param Action the action in question
+ * @param Action $action the current action
*
* @return boolean true
*/
- function reqFbScripts($action) {
+ function reqFbScripts($action)
+ {
// If you're logged in w/FB Connect, you always need the FB stuff
@@ -249,10 +339,19 @@ class FBConnectPlugin extends Plugin
return null;
}
+ /**
+ * Add in a Facebook Connect avatar to the primary nav menu
+ *
+ * @param Action $action the current action
+ *
+ * @return void
+ *
+ */
+
function onStartPrimaryNav($action)
{
-
$user = common_current_user();
+
$connect = 'FBConnectSettings';
if (common_config('xmpp', 'enabled')) {
$connect = 'imsettings';
@@ -283,7 +382,7 @@ class FBConnectPlugin extends Plugin
'alt' => 'Facebook Connect User',
'width' => '16'), '');
- $iconurl = common_path('plugins/FBConnect/fbfavicon.ico');
+ $iconurl = common_path('plugins/Facebook/fbfavicon.ico');
$action->element('img', array('id' => 'fb_favicon',
'src' => $iconurl));
@@ -295,9 +394,19 @@ class FBConnectPlugin extends Plugin
return true;
}
+ /**
+ * Alter the local nav menu to have a Facebook Connect login and
+ * settings pages
+ *
+ * @param Action $action the current action
+ *
+ * @return void
+ *
+ */
+
function onStartShowLocalNavBlock($action)
{
- $action_name = get_class($action);
+ $action_name = get_class($action);
$login_actions = array('LoginAction', 'RegisterAction',
'OpenidloginAction', 'FBConnectLoginAction');
@@ -320,6 +429,14 @@ class FBConnectPlugin extends Plugin
return true;
}
+ /**
+ * Have the logout process do some Facebook Connect cookie cleanup
+ *
+ * @param Action $action the current action
+ *
+ * @return void
+ */
+
function onStartLogout($action)
{
$action->logout();
@@ -339,9 +456,16 @@ class FBConnectPlugin extends Plugin
return true;
}
+ /**
+ * Get the URL of the user's Facebook avatar
+ *
+ * @param int $fbuid the Facebook user ID
+ *
+ * @return string $url the url for the user's Facebook avatar
+ */
+
function getProfilePicURL($fbuid)
{
-
$facebook = getFacebook();
$url = null;
@@ -360,8 +484,70 @@ class FBConnectPlugin extends Plugin
"Facebook client failure requesting profile pic!");
}
- return $url;
+ return $url;
+ }
+
+ /**
+ * Add a Facebook queue item for each notice
+ *
+ * @param Notice $notice the notice
+ * @param array &$transports the list of transports (queues)
+ *
+ * @return boolean hook return
+ */
+
+ function onStartEnqueueNotice($notice, &$transports)
+ {
+ array_push($transports, 'facebook');
+ return true;
+ }
+
+ /**
+ * broadcast the message when not using queuehandler
+ *
+ * @param Notice &$notice the notice
+ * @param array $queue destination queue
+ *
+ * @return boolean hook return
+ */
+
+ function onUnqueueHandleNotice(&$notice, $queue)
+ {
+ if (($queue == 'facebook') && ($this->_isLocal($notice))) {
+ facebookBroadcastNotice($notice);
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * Determine whether the notice was locally created
+ *
+ * @param Notice $notice the notice
+ *
+ * @return boolean locality
+ */
+
+ function _isLocal($notice)
+ {
+ return ($notice->is_local == Notice::LOCAL_PUBLIC ||
+ $notice->is_local == Notice::LOCAL_NONPUBLIC);
+ }
+
+ /**
+ * Add Facebook queuehandler to the list of daemons to start
+ *
+ * @param array $daemons the list fo daemons to run
+ *
+ * @return boolean hook return
+ *
+ */
+ function onGetValidDaemons($daemons)
+ {
+ array_push($daemons, INSTALLDIR .
+ '/plugins/Facebook/facebookqueuehandler.php');
+ return true;
}
}
diff --git a/plugins/Facebook/README b/plugins/Facebook/README
new file mode 100644
index 000000000..bf2f4a180
--- /dev/null
+++ b/plugins/Facebook/README
@@ -0,0 +1,129 @@
+This plugin allows you to use Facebook Connect with StatusNet, provides a
+Facebook application for your users, and allows them to update their
+Facebook statuses from StatusNet.
+
+Facebook Connect
+----------------
+
+Facebook connect allows users to register and login using nothing but their
+Facebook credentials. With Facebook Connect, your users can:
+
+- Authenticate (register/login/logout -- works similar to OpenID)
+- Associate an existing StatusNet account with a Facebook account
+- Disconnect a Facebook account from a StatusNet account
+
+Built-in Facebook Application
+-----------------------------
+
+The plugin also installs a StatusNet Facebook application that allows your
+users to automatically update their Facebook statuses with their latest
+notices, invite their friends to use the app (and thus your site), view
+their notice timelines, and post notices -- all from within Facebook. The
+application is built into the StatusNet Facebook plugin and runs on your
+host.
+
+Quick setup instructions*
+-------------------------
+
+Install the Facebook Developer application on Facebook:
+
+ http://www.facebook.com/developers/
+
+Use it to create a new application and generate an API key and secret. Add a
+Facebook app section of your config.php and copy in the key and secret,
+e.g.:
+
+ // Config section for the built-in Facebook application
+ $config['facebook']['apikey'] = 'APIKEY';
+ $config['facebook']['secret'] = 'SECRET';
+
+In Facebook's application editor, specify the following URLs for your app:
+
+- Canvas Callback URL : http://example.net/mublog/facebook/app/
+- Post-Remove Callback URL: http://example.net/mublog/facebook/app/remove
+- Post-Add Redirect URL : http://apps.facebook.com/yourapp/
+- Canvas Page URL : http://apps.facebook.com/yourapp/
+- Connect URL : http://example.net/mublog/
+
+ *** ATTENTION ***
+ These URLs have changed slightly since StatusNet version 0.8.1,
+ so if you have been using the Facebook app previously, you will
+ need to update your configuration!
+
+Replace "example.net" with your host's URL, "mublog" with the path to your
+StatusNet installation, and 'yourapp' with the name of the Facebook
+application you created. (If you don't have "Fancy URLs" on, you'll need to
+change http://example.net/mublog/ to http://example.net/mublog/index.php/).
+
+Additionally, Choose "Web" for Application type in the Advanced tab. In the
+"Canvas setting" section, choose the "FBML" for Render Method, "Smart Size"
+for IFrame size, and "Full width (760px)" for Canvas Width. Everything else
+can be left with default values.
+
+* NOTE: For more under-the-hood detailed instructions about setting up a
+ Facebook application and getting an API key, check out the
+ following pages on the Facebook wiki:
+
+ http://wiki.developers.facebook.com/index.php/Connect/Setting_Up_Your_Site
+ http://wiki.developers.facebook.com/index.php/Creating_your_first_application
+
+Finally you must activate the plugin by adding the following line to your
+config.php:
+
+ addPlugin('Facebook');
+
+Testing It Out
+--------------
+
+If the Facebook plugin is enabled and working, there will be a new Facebook
+Connect Settings tab under each user's Connect menu. Users can connect and
+disconnect* to their Facebook accounts from it.
+
+To try out the plugin, fire up your browser and connect to:
+
+ http://SITE/PATH_TO_STATUSNET/main/facebooklogin
+
+or, if you do not have fancy URLs turned on:
+
+ http://SITE/PATH_TO_STATUSNET/index.php/main/facebooklogin
+
+You should see a page with a blue button that says: "Connect with Facebook"
+and you should be able to login or register.
+
+From within Facebook, you should also be able to get to the Facebook
+application, and run it by hitting the link you specified above when
+configuring it:
+
+ http://apps.facebook.com/yourapp/
+
+That link should be present you with a login screen. After logging in to
+the app, you are given the option to update their Facebook status via
+StatusNet.
+
+* Note: Before a user can disconnect from Facebook, she must set a normal
+ StatusNet password. Otherwise, she might not be able to login in to her
+ account in the future. This is usually only required for users who have
+ used Facebook Connect to register their StatusNet account, and therefore
+ haven't already set a local password.
+
+Offline Queue Handling
+----------------------
+
+For larger sites needing better performance it's possible to enable queuing
+and have users' notices posted to Facebook via a separate "offline"
+FacebookQueueHandler (facebookqueuhandler.php in the Facebook plugin
+directory), which will be started by the plugin along with their other
+daemons when you run scripts/startdaemons.sh. See the StatusNet README for
+more about queuing and daemons.
+
+TODO
+----
+
+- Invite Facebook friends to use your StatusNet installation via Facebook
+ Connect
+- Auto-subscribe Facebook friends already using StatusNet
+- Share StatusNet favorite notices to your Facebook stream
+- Allow users to update their Facebook statuses once they have authenticated
+ with Facebook Connect (no need for them to use the Facebook app if they
+ don't want to).
+- Re-design the whole thing to support multiple instances of StatusNet
diff --git a/extlib/facebook/facebook.php b/plugins/Facebook/facebook/facebook.php
index 016e8e8e0..016e8e8e0 100644
--- a/extlib/facebook/facebook.php
+++ b/plugins/Facebook/facebook/facebook.php
diff --git a/extlib/facebook/facebook_desktop.php b/plugins/Facebook/facebook/facebook_desktop.php
index e79a2ca34..e79a2ca34 100644
--- a/extlib/facebook/facebook_desktop.php
+++ b/plugins/Facebook/facebook/facebook_desktop.php
diff --git a/extlib/facebook/facebookapi_php5_restlib.php b/plugins/Facebook/facebook/facebookapi_php5_restlib.php
index 55cb7fb86..55cb7fb86 100755
--- a/extlib/facebook/facebookapi_php5_restlib.php
+++ b/plugins/Facebook/facebook/facebookapi_php5_restlib.php
diff --git a/extlib/facebook/jsonwrapper/JSON/JSON.php b/plugins/Facebook/facebook/jsonwrapper/JSON/JSON.php
index 0cddbddb4..0cddbddb4 100644
--- a/extlib/facebook/jsonwrapper/JSON/JSON.php
+++ b/plugins/Facebook/facebook/jsonwrapper/JSON/JSON.php
diff --git a/extlib/facebook/jsonwrapper/JSON/LICENSE b/plugins/Facebook/facebook/jsonwrapper/JSON/LICENSE
index 4ae6bef55..4ae6bef55 100644
--- a/extlib/facebook/jsonwrapper/JSON/LICENSE
+++ b/plugins/Facebook/facebook/jsonwrapper/JSON/LICENSE
diff --git a/extlib/facebook/jsonwrapper/jsonwrapper.php b/plugins/Facebook/facebook/jsonwrapper/jsonwrapper.php
index 29509deba..29509deba 100644
--- a/extlib/facebook/jsonwrapper/jsonwrapper.php
+++ b/plugins/Facebook/facebook/jsonwrapper/jsonwrapper.php
diff --git a/extlib/facebook/jsonwrapper/jsonwrapper_inner.php b/plugins/Facebook/facebook/jsonwrapper/jsonwrapper_inner.php
index 36a3f2863..36a3f2863 100644
--- a/extlib/facebook/jsonwrapper/jsonwrapper_inner.php
+++ b/plugins/Facebook/facebook/jsonwrapper/jsonwrapper_inner.php
diff --git a/lib/facebookaction.php b/plugins/Facebook/facebookaction.php
index 3f3a8d3b0..f5ad3d06b 100644
--- a/lib/facebookaction.php
+++ b/plugins/Facebook/facebookaction.php
@@ -2,7 +2,7 @@
/**
* StatusNet, the distributed open-source microblogging tool
*
- * Low-level generator for HTML
+ * Base Facebook Action
*
* PHP version 5
*
@@ -22,18 +22,17 @@
* @category Faceboook
* @package StatusNet
* @author Zach Copley <zach@status.net>
- * @copyright 2008 StatusNet, Inc.
+ * @copyright 2008-2009 StatusNet, Inc.
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
-if (!defined('STATUSNET') && !defined('LACONICA'))
-{
+if (!defined('STATUSNET') && !defined('LACONICA')) {
exit(1);
}
-require_once INSTALLDIR.'/lib/facebookutil.php';
-require_once INSTALLDIR.'/lib/noticeform.php';
+require_once INSTALLDIR . '/plugins/Facebook/facebookutil.php';
+require_once INSTALLDIR . '/lib/noticeform.php';
class FacebookAction extends Action
{
@@ -45,17 +44,6 @@ class FacebookAction extends Action
var $app_uri = null;
var $app_name = null;
- /**
- * Constructor
- *
- * Just wraps the HTMLOutputter constructor.
- *
- * @param string $output URI to output to, default = stdout
- * @param boolean $indent Whether to indent output, default true
- *
- * @see XMLOutputter::__construct
- * @see HTMLOutputter::__construct
- */
function __construct($output='php://output', $indent=true, $facebook=null, $flink=null)
{
parent::__construct($output, $indent);
@@ -107,10 +95,8 @@ class FacebookAction extends Action
/**
* Start an Facebook ready HTML document
*
- * For Facebook we don't want to actually output any headers,
- * DTD info, etc. Just Stylesheet and JavaScript links.
- *
- * If $type isn't specified, will attempt to do content negotiation.
+ * For Facebook we don't want to actually output any headers,
+ * DTD info, etc. Just Stylesheet and JavaScript links.
*
* @param string $type MIME type to use; default is to do negotation.
*
@@ -139,8 +125,6 @@ class FacebookAction extends Action
/**
* Show notice form.
*
- * MAY overload if no notice form needed... or direct message box????
- *
* @return nothing
*/
function showNoticeForm()
@@ -157,10 +141,6 @@ class FacebookAction extends Action
$this->elementEnd('div');
}
- function showAside()
- {
- }
-
function showHead($error, $success)
{
@@ -214,8 +194,6 @@ class FacebookAction extends Action
/**
* Show header of the page.
*
- * Calls template methods
- *
* @return nothing
*/
function showHeader()
@@ -257,7 +235,7 @@ class FacebookAction extends Action
$this->element('a',
array('href' => common_local_url('register')), _('Register'));
$this->text($loginmsg_part2);
- $this->elementEnd('p');
+ $this->elementEnd('p');
$this->elementEnd('dd');
$this->elementEnd('dl');
@@ -295,7 +273,7 @@ class FacebookAction extends Action
$this->elementEnd('ul');
$this->submit('submit', _('Login'));
- $this->elementEnd('fieldset');
+ $this->elementEnd('fieldset');
$this->elementEnd('form');
$this->elementStart('p');
@@ -313,8 +291,8 @@ class FacebookAction extends Action
// Need to include inline CSS for styling the Profile box
- $app_props = $this->facebook->api_client->Admin_getAppProperties(array('icon_url'));
- $icon_url = $app_props['icon_url'];
+ $app_props = $this->facebook->api_client->Admin_getAppProperties(array('icon_url'));
+ $icon_url = $app_props['icon_url'];
$style = '<style>
.entry-title *,
diff --git a/actions/facebookhome.php b/plugins/Facebook/facebookhome.php
index 70f205205..91c0cc6b8 100644
--- a/actions/facebookhome.php
+++ b/plugins/Facebook/facebookhome.php
@@ -17,9 +17,11 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); }
+if (!defined('STATUSNET') && !defined('LACONICA')) {
+ exit(1);
+}
-require_once INSTALLDIR.'/lib/facebookaction.php';
+require_once INSTALLDIR . '/plugins/Facebook/facebookaction.php';
class FacebookhomeAction extends FacebookAction
{
diff --git a/actions/facebookinvite.php b/plugins/Facebook/facebookinvite.php
index 6dfc9d688..ecda1717c 100644
--- a/actions/facebookinvite.php
+++ b/plugins/Facebook/facebookinvite.php
@@ -21,7 +21,7 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
exit(1);
}
-require_once(INSTALLDIR.'/lib/facebookaction.php');
+require_once INSTALLDIR . '/plugins/Facebook/facebookaction.php';
class FacebookinviteAction extends FacebookAction
{
diff --git a/actions/facebooklogin.php b/plugins/Facebook/facebooklogin.php
index 8ac2477ab..f77aecca3 100644
--- a/actions/facebooklogin.php
+++ b/plugins/Facebook/facebooklogin.php
@@ -17,9 +17,11 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); }
+if (!defined('STATUSNET') && !defined('LACONICA')) {
+ exit(1);
+}
-require_once(INSTALLDIR.'/lib/facebookaction.php');
+require_once INSTALLDIR . '/plugins/Facebook/facebookaction.php';
class FacebookinviteAction extends FacebookAction
{
@@ -27,25 +29,24 @@ class FacebookinviteAction extends FacebookAction
function handle($args)
{
parent::handle($args);
-
+
$this->error = $error;
-
+
if ($this->flink) {
if (!$this->facebook->api_client->users_hasAppPermission('publish_stream') &&
$this->facebook->api_client->data_getUserPreference(
FACEBOOK_PROMPTED_UPDATE_PREF) == 'true') {
-
+
echo '<h1>REDIRECT TO HOME</h1>';
}
- } else {
+ } else {
$this->showPage();
}
}
-
function showContent()
{
-
+
// If the user has opted not to initially allow the app to have
// Facebook status update permission, store that preference. Only
// promt the user the first time she uses the app
@@ -68,34 +69,31 @@ class FacebookinviteAction extends FacebookAction
return;
}
}
-
+
} else {
$this->showLoginForm();
}
-
+
}
function showSuccessContent()
{
-
-
}
function showFormContent()
{
-
}
-
- function title()
+
+ function title()
{
return sprintf(_('Login'));
}
-
- function redirectHome()
+
+ function redirectHome()
{
-
+
}
}
diff --git a/scripts/facebookqueuehandler.php b/plugins/Facebook/facebookqueuehandler.php
index e13ac4e85..e4ae7d4ee 100755
--- a/scripts/facebookqueuehandler.php
+++ b/plugins/Facebook/facebookqueuehandler.php
@@ -18,7 +18,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-define('INSTALLDIR', realpath(dirname(__FILE__) . '/..'));
+define('INSTALLDIR', realpath(dirname(__FILE__) . '/../..'));
$shortoptions = 'i::';
$longoptions = array('id::');
@@ -30,9 +30,8 @@ Daemon script for pushing new notices to Facebook.
END_OF_FACEBOOK_HELP;
-require_once INSTALLDIR.'/scripts/commandline.inc';
-
-require_once INSTALLDIR . '/lib/facebookutil.php';
+require_once INSTALLDIR . '/scripts/commandline.inc';
+require_once INSTALLDIR . '/plugins/Facebook/facebookutil.php';
require_once INSTALLDIR . '/lib/queuehandler.php';
class FacebookQueueHandler extends QueueHandler
diff --git a/actions/facebookremove.php b/plugins/Facebook/facebookremove.php
index ae231c0fb..8531a8e6e 100644
--- a/actions/facebookremove.php
+++ b/plugins/Facebook/facebookremove.php
@@ -17,9 +17,11 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); }
+if (!defined('STATUSNET') && !defined('LACONICA')) {
+ exit(1);
+}
-require_once INSTALLDIR.'/lib/facebookaction.php';
+require_once INSTALLDIR . '/plugins/Facebook/facebookaction.php';
class FacebookremoveAction extends FacebookAction
{
diff --git a/actions/facebooksettings.php b/plugins/Facebook/facebooksettings.php
index b2b1d6807..2f182e368 100644
--- a/actions/facebooksettings.php
+++ b/plugins/Facebook/facebooksettings.php
@@ -17,9 +17,11 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); }
+if (!defined('STATUSNET') && !defined('LACONICA')) {
+ exit(1);
+}
-require_once INSTALLDIR.'/lib/facebookaction.php';
+require_once INSTALLDIR . '/plugins/Facebook/facebookaction.php';
class FacebooksettingsAction extends FacebookAction
{
@@ -91,16 +93,16 @@ class FacebooksettingsAction extends FacebookAction
'id' => 'facebook_settings'));
$this->elementStart('ul', 'form_data');
-
+
$this->elementStart('li');
-
+
$this->checkbox('noticesync', _('Automatically update my Facebook status with my notices.'),
($this->flink) ? ($this->flink->noticesync & FOREIGN_NOTICE_SEND) : true);
$this->elementEnd('li');
-
+
$this->elementStart('li');
-
+
$this->checkbox('replysync', _('Send "@" replies to Facebook.'),
($this->flink) ? ($this->flink->noticesync & FOREIGN_NOTICE_SEND_REPLY) : true);
@@ -115,15 +117,15 @@ class FacebooksettingsAction extends FacebookAction
_('A string to prefix notices with.'));
$this->elementEnd('li');
-
+
$this->elementStart('li');
-
+
$this->submit('save', _('Save'));
$this->elementEnd('li');
$this->elementEnd('ul');
-
+
$this->elementEnd('form');
} else {
@@ -148,8 +150,8 @@ class FacebooksettingsAction extends FacebookAction
}
}
-
- function title()
+
+ function title()
{
return _('Sync preferences');
}
diff --git a/lib/facebookutil.php b/plugins/Facebook/facebookutil.php
index c991c5439..6f50c173a 100644
--- a/lib/facebookutil.php
+++ b/plugins/Facebook/facebookutil.php
@@ -17,9 +17,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-require_once INSTALLDIR.'/extlib/facebook/facebook.php';
-require_once INSTALLDIR.'/lib/facebookaction.php';
-require_once INSTALLDIR.'/lib/noticelist.php';
+require_once INSTALLDIR . '/plugins/Facebook/facebook/facebook.php';
+require_once INSTALLDIR . '/plugins/Facebook/facebookaction.php';
+require_once INSTALLDIR . '/lib/noticelist.php';
define("FACEBOOK_SERVICE", 2); // Facebook is foreign_service ID 2
define("FACEBOOK_NOTICE_PREFIX", 1);
@@ -258,3 +258,38 @@ function remove_facebook_app($flink)
}
}
+
+/**
+ * Send a mail message to notify a user that her Facebook Application
+ * access has been removed.
+ *
+ * @param User $user user whose Facebook app link has been removed
+ *
+ * @return boolean success flag
+ */
+
+function mail_facebook_app_removed($user)
+{
+ common_init_locale($user->language);
+
+ $profile = $user->getProfile();
+
+ $site_name = common_config('site', 'name');
+
+ $subject = sprintf(
+ _('Your %1$s Facebook application access has been disabled.',
+ $site_name));
+
+ $body = sprintf(_("Hi, %1\$s. We're sorry to inform you that we are " .
+ 'unable to update your Facebook status from %2$s, and have disabled ' .
+ 'the Facebook application for your account. This may be because ' .
+ 'you have removed the Facebook application\'s authorization, or ' .
+ 'have deleted your Facebook account. You can re-enable the ' .
+ 'Facebook application and automatic status updating by ' .
+ "re-installing the %2\$s Facebook application.\n\nRegards,\n\n%2\$s"),
+ $user->nickname, $site_name);
+
+ common_init_locale();
+ return mail_to_user($user, $subject, $body);
+
+}
diff --git a/plugins/FBConnect/fbfavicon.ico b/plugins/Facebook/fbfavicon.ico
index c57c0342f..c57c0342f 100644
--- a/plugins/FBConnect/fbfavicon.ico
+++ b/plugins/Facebook/fbfavicon.ico
Binary files differ
diff --git a/plugins/TwitterBridge/twitter.php b/plugins/TwitterBridge/twitter.php
index ac1f49c36..1a5248a9b 100644
--- a/plugins/TwitterBridge/twitter.php
+++ b/plugins/TwitterBridge/twitter.php
@@ -312,3 +312,40 @@ function remove_twitter_link($flink)
}
}
+
+/**
+ * Send a mail message to notify a user that her Twitter bridge link
+ * has stopped working, and therefore has been removed. This can
+ * happen when the user changes her Twitter password, or otherwise
+ * revokes access.
+ *
+ * @param User $user user whose Twitter bridge link has been removed
+ *
+ * @return boolean success flag
+ */
+
+function mail_twitter_bridge_removed($user)
+{
+ common_init_locale($user->language);
+
+ $profile = $user->getProfile();
+
+ $subject = sprintf(_('Your Twitter bridge has been disabled.'));
+
+ $site_name = common_config('site', 'name');
+
+ $body = sprintf(_('Hi, %1$s. We\'re sorry to inform you that your ' .
+ 'link to Twitter has been disabled. We no longer seem to have ' .
+ 'permission to update your Twitter status. (Did you revoke ' .
+ '%3$s\'s access?)' . "\n\n" .
+ 'You can re-enable your Twitter bridge by visiting your ' .
+ "Twitter settings page:\n\n\t%2\$s\n\n" .
+ "Regards,\n%3\$s\n"),
+ $profile->getBestName(),
+ common_local_url('twittersettings'),
+ common_config('site', 'name'));
+
+ common_init_locale();
+ return mail_to_user($user, $subject, $body);
+}
+
diff --git a/scripts/getvaliddaemons.php b/scripts/getvaliddaemons.php
index 7caea1bb7..99ad41b37 100755
--- a/scripts/getvaliddaemons.php
+++ b/scripts/getvaliddaemons.php
@@ -39,7 +39,6 @@ $daemons = array();
$daemons[] = INSTALLDIR.'/scripts/pluginqueuehandler.php';
$daemons[] = INSTALLDIR.'/scripts/ombqueuehandler.php';
-$daemons[] = INSTALLDIR.'/scripts/facebookqueuehandler.php';
$daemons[] = INSTALLDIR.'/scripts/pingqueuehandler.php';
if(common_config('xmpp','enabled')) {
diff --git a/tests/URLDetectionTest.php b/tests/URLDetectionTest.php
index 45203bf6e..0cc03ccce 100644
--- a/tests/URLDetectionTest.php
+++ b/tests/URLDetectionTest.php
@@ -47,7 +47,9 @@ class URLDetectionTest extends PHPUnit_Framework_TestCase
array('127.0.0.1/\'test',
'<a href="http://127.0.0.1/\'test" title="http://127.0.0.1/\'test" rel="external">127.0.0.1/\'test</a>'),
array('127.0.0.1/"test',
- '<a href="http://127.0.0.1/&quot;test" title="http://127.0.0.1/&quot;test" rel="external">127.0.0.1/&quot;test</a>'),
+ '<a href="http://127.0.0.1/" title="http://127.0.0.1/" rel="external">127.0.0.1/</a>&quot;test'),
+ array('127.0.0.1/test"test',
+ '<a href="http://127.0.0.1/test" title="http://127.0.0.1/test" rel="external">127.0.0.1/test</a>&quot;test'),
array('127.0.0.1/-test',
'<a href="http://127.0.0.1/-test" title="http://127.0.0.1/-test" rel="external">127.0.0.1/-test</a>'),
array('127.0.0.1/_test',
@@ -170,6 +172,8 @@ class URLDetectionTest extends PHPUnit_Framework_TestCase
'\'<a href="http://example.com/" title="http://example.com/" rel="external">http://example.com</a>\''),
array('"http://example.com"',
'&quot;<a href="http://example.com/" title="http://example.com/" rel="external">http://example.com</a>&quot;'),
+ array('"http://example.com/"',
+ '&quot;<a href="http://example.com/" title="http://example.com/" rel="external">http://example.com/</a>&quot;'),
array('http://example.com',
'<a href="http://example.com/" title="http://example.com/" rel="external">http://example.com</a>'),
array('(http://example.com)',