summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorZach Copley <zach@status.net>2010-03-03 00:54:35 +0000
committerZach Copley <zach@status.net>2010-03-03 00:54:35 +0000
commit097e3f89b630b7a28f27c96f5e9a036df3ed7710 (patch)
treeb34602a5fcd9cc9474737379ddafde3976c0cb96 /plugins
parent6c1321b108206d05b75703da22ea8abab82071bf (diff)
parent08422dfa17a5c52d51f21087be0f1d8d602ed0af (diff)
Merge branch 'testing' of git@gitorious.org:statusnet/mainline into testing
Diffstat (limited to 'plugins')
-rw-r--r--plugins/Facebook/README84
-rw-r--r--plugins/OStatus/OStatusPlugin.php16
-rw-r--r--plugins/OStatus/actions/ostatussub.php2
-rw-r--r--plugins/OStatus/classes/Ostatus_profile.php12
-rw-r--r--plugins/OStatus/theme/base/css/ostatus.css6
-rw-r--r--plugins/SphinxSearch/sphinxsearch.php2
-rw-r--r--plugins/TwitterBridge/README17
-rw-r--r--plugins/TwitterBridge/TwitterBridgePlugin.php98
-rw-r--r--plugins/TwitterBridge/twitteroauthclient.php21
9 files changed, 186 insertions, 72 deletions
diff --git a/plugins/Facebook/README b/plugins/Facebook/README
index bf2f4a180..14c1d3241 100644
--- a/plugins/Facebook/README
+++ b/plugins/Facebook/README
@@ -1,6 +1,9 @@
-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 Plugin
+===============
+
+This plugin allows you to use Facebook Connect with StatusNet, provides
+a Facebook canvas application for your users, and allows them to update
+their Facebook statuses from StatusNet.
Facebook Connect
----------------
@@ -15,12 +18,12 @@ Facebook credentials. With Facebook Connect, your users can:
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.
+The plugin also installs a StatusNet Facebook canvas application that
+allows your users to automatically update their Facebook status 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*
-------------------------
@@ -29,13 +32,9 @@ 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';
+Use it to create a new application and generate an API key and secret.
+You will need the key and secret so cut-n-paste them into your text
+editor or write them down.
In Facebook's application editor, specify the following URLs for your app:
@@ -67,11 +66,36 @@ can be left with default values.
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:
+Finally you must activate the plugin by adding it in your config.php
+(this is where you'll need the API key and secret generated earlier):
+
+ addPlugin(
+ 'Facebook',
+ array(
+ 'apikey' => 'YOUR_APIKEY',
+ 'secret' => 'YOUR_SECRET'
+ )
+ );
+
+Administration Panel
+--------------------
+
+As of StatusNet 0.9.0 you can alternatively specify the key and secret
+via a Facebook administration panel from within StatusNet, in which case
+you can just add:
addPlugin('Facebook');
+to activate the plugin.
+
+NOTE: To enable the administration panel you'll need to add it to the
+list of active administration panels, e.g.:
+
+ $config['admin']['panels'][] = 'facebook';
+
+and of course you'll need a user with the administrative role to access
+it and input the API key and secret (see: scripts/userrole.php).
+
Testing It Out
--------------
@@ -81,11 +105,11 @@ 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
+ http://example.net/mublog/main/facebooklogin
or, if you do not have fancy URLs turned on:
- http://SITE/PATH_TO_STATUSNET/index.php/main/facebooklogin
+ http://example.net/mublog/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.
@@ -101,7 +125,7 @@ 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
+ 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.
@@ -109,16 +133,20 @@ StatusNet.
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.
+For larger sites needing better performance it's possible to enable
+queuing and have users' notices posted to Facebook via a separate
+"offline" process -- FacebookQueueHandler (facebookqueuhandler.php in
+the Facebook plugin directory). It will run automatically if you have
+enabled StatusNet's offline queueing subsystem. See the "Queues and
+daemons" section in the StatusNet README for more about queuing.
+
TODO
----
+- Make Facebook Connect work for authentication for multi-site setups
+ (e.g.: *.status.net)
+- Posting to Facebook user streams using only Facebook Connect
- Invite Facebook friends to use your StatusNet installation via Facebook
Connect
- Auto-subscribe Facebook friends already using StatusNet
@@ -126,4 +154,4 @@ TODO
- 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
+- Import a user's Facebook updates into StatusNet
diff --git a/plugins/OStatus/OStatusPlugin.php b/plugins/OStatus/OStatusPlugin.php
index 4ffbba45b..7b6d22acf 100644
--- a/plugins/OStatus/OStatusPlugin.php
+++ b/plugins/OStatus/OStatusPlugin.php
@@ -706,6 +706,20 @@ class OStatusPlugin extends Plugin
function onStartShowSubscriptionsContent($action)
{
+ $this->showEntityRemoteSubscribe($action);
+
+ return true;
+ }
+
+ function onStartShowAllContent($action)
+ {
+ $this->showEntityRemoteSubscribe($action);
+
+ return true;
+ }
+
+ function showEntityRemoteSubscribe($action)
+ {
$user = common_current_user();
if ($user && ($user->id == $action->profile->id)) {
$action->elementStart('div', 'entity_actions');
@@ -717,8 +731,6 @@ class OStatusPlugin extends Plugin
$action->elementEnd('p');
$action->elementEnd('div');
}
-
- return true;
}
/**
diff --git a/plugins/OStatus/actions/ostatussub.php b/plugins/OStatus/actions/ostatussub.php
index f45e6a8d1..e318701a2 100644
--- a/plugins/OStatus/actions/ostatussub.php
+++ b/plugins/OStatus/actions/ostatussub.php
@@ -112,7 +112,7 @@ class OStatusSubAction extends Action
$this->submit('submit', _m('Join'), 'submit', null,
_m('Join this group'));
} else {
- $this->submit('submit', _m('Subscribe'), 'submit', null,
+ $this->submit('submit', _m('Confirm'), 'submit', null,
_m('Subscribe to this user'));
}
$this->elementEnd('fieldset');
diff --git a/plugins/OStatus/classes/Ostatus_profile.php b/plugins/OStatus/classes/Ostatus_profile.php
index a33e95d93..059c19e7c 100644
--- a/plugins/OStatus/classes/Ostatus_profile.php
+++ b/plugins/OStatus/classes/Ostatus_profile.php
@@ -550,7 +550,8 @@ class Ostatus_profile extends Memcached_DataObject
'rendered' => $rendered,
'replies' => array(),
'groups' => array(),
- 'tags' => array());
+ 'tags' => array(),
+ 'urls' => array());
// Check for optional attributes...
@@ -595,6 +596,12 @@ class Ostatus_profile extends Memcached_DataObject
}
}
+ // Atom enclosures -> attachment URLs
+ foreach ($activity->enclosures as $href) {
+ // @fixme save these locally or....?
+ $options['urls'][] = $href;
+ }
+
try {
$saved = Notice::saveNew($oprofile->profile_id,
$content,
@@ -620,7 +627,8 @@ class Ostatus_profile extends Memcached_DataObject
protected function purify($html)
{
require_once INSTALLDIR.'/extlib/htmLawed/htmLawed.php';
- $config = array('safe' => 1);
+ $config = array('safe' => 1,
+ 'deny_attribute' => 'id,style,on*');
return htmLawed($html, $config);
}
diff --git a/plugins/OStatus/theme/base/css/ostatus.css b/plugins/OStatus/theme/base/css/ostatus.css
index feeeb47d3..13e30ef5d 100644
--- a/plugins/OStatus/theme/base/css/ostatus.css
+++ b/plugins/OStatus/theme/base/css/ostatus.css
@@ -38,11 +38,11 @@ display:none;
min-width:96px;
}
-#subscriptions #entity_remote_subscribe {
+#entity_remote_subscribe {
padding:0;
float:right;
}
-#subscriptions .entity_remote_subscribe {
-float:right;
+#all #entity_remote_subscribe {
+margin-top:-52px;
}
diff --git a/plugins/SphinxSearch/sphinxsearch.php b/plugins/SphinxSearch/sphinxsearch.php
index 71f330828..654b9c9d5 100644
--- a/plugins/SphinxSearch/sphinxsearch.php
+++ b/plugins/SphinxSearch/sphinxsearch.php
@@ -75,7 +75,7 @@ class SphinxSearch extends SearchEngine
{
if ('chron' === $mode) {
$this->sphinx->SetSortMode(SPH_SORT_ATTR_DESC, 'created_ts');
- return $this->target->orderBy('created desc');
+ return $this->target->orderBy('id desc');
}
}
diff --git a/plugins/TwitterBridge/README b/plugins/TwitterBridge/README
index 72278b32e..d0d34b7ef 100644
--- a/plugins/TwitterBridge/README
+++ b/plugins/TwitterBridge/README
@@ -20,7 +20,7 @@ on Twitter (http://twitter.com/apps). During the application
registration process your application will be assigned a "consumer" key
and secret, which the plugin will use to make OAuth requests to Twitter.
You can either pass the consumer key and secret in when you enable the
-plugin, or set it using the Twitter administration panel.
+plugin, or set it using the Twitter administration panel**.
When registering your application with Twitter set the type to "Browser"
and your Callback URL to:
@@ -42,11 +42,26 @@ To enable the plugin, add the following to your config.php:
)
);
+or just:
+
+ addPlugin('TwitterBridge');
+
+if you want to set the consumer key and secret from the Twitter bridge
+administration panel. (The Twitter bridge wont work at all
+unless you configure it with a consumer key and secret.)
+
* Note: The plugin will still push notices to Twitter for users who
have previously set up the Twitter bridge using their Twitter name and
password under an older version of StatusNet, but all new Twitter
bridge connections will use OAuth.
+** For multi-site setups you can also set a global consumer key and
+ secret. The Twitter bridge will fall back on the global key pair if
+ it can't find a local pair, e.g.:
+
+ $config['twitter']['global_consumer_key'] = 'YOUR_CONSUMER_KEY'
+ $config['twitter']['global_consumer_secret'] = 'YOUR_CONSUMER_SECRET'
+
Administration panel
--------------------
diff --git a/plugins/TwitterBridge/TwitterBridgePlugin.php b/plugins/TwitterBridge/TwitterBridgePlugin.php
index 6ce69d5e2..bc702e745 100644
--- a/plugins/TwitterBridge/TwitterBridgePlugin.php
+++ b/plugins/TwitterBridge/TwitterBridgePlugin.php
@@ -80,6 +80,30 @@ class TwitterBridgePlugin extends Plugin
}
/**
+ * Check to see if there is a consumer key and secret defined
+ * for Twitter integration.
+ *
+ * @return boolean result
+ */
+
+ static function hasKeys()
+ {
+ $key = common_config('twitter', 'consumer_key');
+ $secret = common_config('twitter', 'consumer_secret');
+
+ if (empty($key) && empty($secret)) {
+ $key = common_config('twitter', 'global_consumer_key');
+ $secret = common_config('twitter', 'global_consumer_secret');
+ }
+
+ if (!empty($key) && !empty($secret)) {
+ return true;
+ }
+
+ return false;
+ }
+
+ /**
* Add Twitter-related paths to the router table
*
* Hook for RouterInitialized event.
@@ -91,14 +115,22 @@ class TwitterBridgePlugin extends Plugin
function onRouterInitialized($m)
{
- $m->connect(
- 'twitter/authorization',
- array('action' => 'twitterauthorization')
- );
- $m->connect('settings/twitter', array('action' => 'twittersettings'));
-
- if (common_config('twitter', 'signin')) {
- $m->connect('main/twitterlogin', array('action' => 'twitterlogin'));
+ if (self::hasKeys()) {
+ $m->connect(
+ 'twitter/authorization',
+ array('action' => 'twitterauthorization')
+ );
+ $m->connect(
+ 'settings/twitter', array(
+ 'action' => 'twittersettings'
+ )
+ );
+ if (common_config('twitter', 'signin')) {
+ $m->connect(
+ 'main/twitterlogin',
+ array('action' => 'twitterlogin')
+ );
+ }
}
$m->connect('admin/twitter', array('action' => 'twitteradminpanel'));
@@ -117,7 +149,7 @@ class TwitterBridgePlugin extends Plugin
{
$action_name = $action->trimmed('action');
- if (common_config('twitter', 'signin')) {
+ if (self::hasKeys() && common_config('twitter', 'signin')) {
$action->menuItem(
common_local_url('twitterlogin'),
_m('Twitter'),
@@ -138,15 +170,16 @@ class TwitterBridgePlugin extends Plugin
*/
function onEndConnectSettingsNav(&$action)
{
- $action_name = $action->trimmed('action');
-
- $action->menuItem(
- common_local_url('twittersettings'),
- _m('Twitter'),
- _m('Twitter integration options'),
- $action_name === 'twittersettings'
- );
+ if (self::hasKeys()) {
+ $action_name = $action->trimmed('action');
+ $action->menuItem(
+ common_local_url('twittersettings'),
+ _m('Twitter'),
+ _m('Twitter integration options'),
+ $action_name === 'twittersettings'
+ );
+ }
return true;
}
@@ -188,12 +221,12 @@ class TwitterBridgePlugin extends Plugin
*/
function onStartEnqueueNotice($notice, &$transports)
{
- // Avoid a possible loop
-
- if ($notice->source != 'twitter') {
- array_push($transports, 'twitter');
+ if (self::hasKeys()) {
+ // Avoid a possible loop
+ if ($notice->source != 'twitter') {
+ array_push($transports, 'twitter');
+ }
}
-
return true;
}
@@ -206,18 +239,19 @@ class TwitterBridgePlugin extends Plugin
*/
function onGetValidDaemons($daemons)
{
- array_push(
- $daemons,
- INSTALLDIR
- . '/plugins/TwitterBridge/daemons/synctwitterfriends.php'
- );
-
- if (common_config('twitterimport', 'enabled')) {
+ if (self::hasKeys()) {
array_push(
$daemons,
INSTALLDIR
- . '/plugins/TwitterBridge/daemons/twitterstatusfetcher.php'
+ . '/plugins/TwitterBridge/daemons/synctwitterfriends.php'
);
+ if (common_config('twitterimport', 'enabled')) {
+ array_push(
+ $daemons,
+ INSTALLDIR
+ . '/plugins/TwitterBridge/daemons/twitterstatusfetcher.php'
+ );
+ }
}
return true;
@@ -232,7 +266,9 @@ class TwitterBridgePlugin extends Plugin
*/
function onEndInitializeQueueManager($manager)
{
- $manager->connect('twitter', 'TwitterQueueHandler');
+ if (self::hasKeys()) {
+ $manager->connect('twitter', 'TwitterQueueHandler');
+ }
return true;
}
diff --git a/plugins/TwitterBridge/twitteroauthclient.php b/plugins/TwitterBridge/twitteroauthclient.php
index ba45b533d..93f6aadd1 100644
--- a/plugins/TwitterBridge/twitteroauthclient.php
+++ b/plugins/TwitterBridge/twitteroauthclient.php
@@ -22,7 +22,7 @@
* @category Integration
* @package StatusNet
* @author Zach Copley <zach@status.net>
- * @copyright 2009 StatusNet, Inc.
+ * @copyright 2009-2010 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/
*/
@@ -61,8 +61,23 @@ class TwitterOAuthClient extends OAuthClient
$consumer_key = common_config('twitter', 'consumer_key');
$consumer_secret = common_config('twitter', 'consumer_secret');
- parent::__construct($consumer_key, $consumer_secret,
- $oauth_token, $oauth_token_secret);
+ if (empty($consumer_key) && empty($consumer_secret)) {
+ $consumer_key = common_config(
+ 'twitter',
+ 'global_consumer_key'
+ );
+ $consumer_secret = common_config(
+ 'twitter',
+ 'global_consumer_secret'
+ );
+ }
+
+ parent::__construct(
+ $consumer_key,
+ $consumer_secret,
+ $oauth_token,
+ $oauth_token_secret
+ );
}
// XXX: the following two functions are to support the horrible hack