Merge branch '0.9.x' into pluginize-twitter-bridge

Conflicts:
	plugins/TwitterBridge/twitterauthorization.php
This commit is contained in:
Zach Copley
2009-09-08 16:02:57 -07:00
453 changed files with 7348 additions and 3899 deletions

View File

@@ -17,7 +17,7 @@ $(document).ready(function(){
});
}
);
$.getJSON($('address .url')[0].href+'/api/laconica/groups/list.json?user_id=' + current_user['id'] + '&callback=?',
$.getJSON($('address .url')[0].href+'/api/statusnet/groups/list.json?user_id=' + current_user['id'] + '&callback=?',
function(groups){
$('#notice_data-text').autocomplete(groups, {
multiple: true,

View File

@@ -1,6 +1,6 @@
<?php
/**
* Laconica, the distributed open-source microblogging tool
* StatusNet, the distributed open-source microblogging tool
*
* Plugin to enable nickname completion in the enter status box
*
@@ -20,14 +20,14 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @category Plugin
* @package Laconica
* @package StatusNet
* @author Craig Andrews <candrews@integralblue.com>
* @copyright 2009 Craig Andrews http://candrews.integralblue.com
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://laconi.ca/
* @link http://status.net/
*/
if (!defined('LACONICA')) {
if (!defined('STATUSNET') && !defined('LACONICA')) {
exit(1);
}
@@ -52,7 +52,7 @@ EOT;
}
}
function onEndShowLaconicaStyles($action)
function onEndShowStatusNetStyles($action)
{
if (common_logged_in()) {
$action->cssLink('plugins/Autocomplete/jquery-autocomplete/jquery.autocomplete.css');

View File

@@ -1,6 +1,6 @@
<?php
/**
* Laconica, the distributed open-source microblogging tool
* StatusNet, the distributed open-source microblogging tool
*
* Plugin to check submitted notices with blogspam.net
*
@@ -20,14 +20,14 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @category Plugin
* @package Laconica
* @author Evan Prodromou <evan@controlyourself.ca>
* @copyright 2009 Control Yourself, Inc.
* @package StatusNet
* @author Evan Prodromou <evan@status.net>
* @copyright 2009 StatusNet, Inc.
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://laconi.ca/
* @link http://status.net/
*/
if (!defined('LACONICA')) {
if (!defined('STATUSNET')) {
exit(1);
}
@@ -45,10 +45,10 @@ define('BLOGSPAMNETPLUGIN_VERSION', '0.1');
* hits, but it's better than nothing.
*
* @category Plugin
* @package Laconica
* @author Evan Prodromou <evan@controlyourself.ca>
* @package StatusNet
* @author Evan Prodromou <evan@status.net>
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://laconi.ca/
* @link http://status.net/
*
* @see Event
*/
@@ -139,6 +139,6 @@ class BlogspamNetPlugin extends Plugin
function userAgent()
{
return 'BlogspamNetPlugin/'.BLOGSPAMNETPLUGIN_VERSION . ' Laconica/' . LACONICA_VERSION;
return 'BlogspamNetPlugin/'.BLOGSPAMNETPLUGIN_VERSION . ' StatusNet/' . STATUSNET_VERSION;
}
}

View File

@@ -1,6 +1,6 @@
<?php
/**
* Laconica, the distributed open-source microblogging tool
* StatusNet, the distributed open-source microblogging tool
*
* Plugin to do "real time" updates using Comet/Bayeux
*
@@ -20,14 +20,14 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @category Plugin
* @package Laconica
* @author Evan Prodromou <evan@controlyourself.ca>
* @copyright 2009 Control Yourself, Inc.
* @package StatusNet
* @author Evan Prodromou <evan@status.net>
* @copyright 2009 StatusNet, Inc.
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://laconi.ca/
* @link http://status.net/
*/
if (!defined('LACONICA')) {
if (!defined('STATUSNET') && !defined('LACONICA')) {
exit(1);
}
@@ -37,10 +37,10 @@ require_once INSTALLDIR.'/plugins/Realtime/RealtimePlugin.php';
* Plugin to do realtime updates using Comet
*
* @category Plugin
* @package Laconica
* @author Evan Prodromou <evan@controlyourself.ca>
* @package StatusNet
* @author Evan Prodromou <evan@status.net>
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://laconi.ca/
* @link http://status.net/
*/
class CometPlugin extends RealtimePlugin

View File

@@ -1,6 +1,6 @@
<?php
/**
* Laconica, the distributed open-source microblogging tool
* StatusNet, the distributed open-source microblogging tool
*
* Menu for login group of actions
*
@@ -20,15 +20,15 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @category Menu
* @package Laconica
* @author Evan Prodromou <evan@controlyourself.ca>
* @author Zach Copley <zach@controlyourself.ca>
* @copyright 2009 Control Yourself, Inc.
* @package StatusNet
* @author Evan Prodromou <evan@status.net>
* @author Zach Copley <zach@status.net>
* @copyright 2009 StatusNet, Inc.
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://laconi.ca/
* @link http://status.net/
*/
if (!defined('LACONICA')) {
if (!defined('STATUSNET') && !defined('LACONICA')) {
exit(1);
}
@@ -38,11 +38,11 @@ require_once INSTALLDIR . '/lib/widget.php';
* Menu for login group of actions
*
* @category Output
* @package Laconica
* @author Evan Prodromou <evan@controlyourself.ca>
* @author Zach Copley <zach@controlyourself.ca>
* @package StatusNet
* @author Evan Prodromou <evan@status.net>
* @author Zach Copley <zach@status.net>
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://laconi.ca/
* @link http://status.net/
*
* @see Widget
*/

View File

@@ -1,6 +1,6 @@
<?php
/**
* Laconica, the distributed open-source microblogging tool
* StatusNet, the distributed open-source microblogging tool
*
* Menu for login group of actions
*
@@ -20,15 +20,15 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @category Menu
* @package Laconica
* @author Evan Prodromou <evan@controlyourself.ca>
* @author Zach Copley <zach@controlyourself.ca>
* @copyright 2009 Control Yourself, Inc.
* @package StatusNet
* @author Evan Prodromou <evan@status.net>
* @author Zach Copley <zach@status.net>
* @copyright 2009 StatusNet, Inc.
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://laconi.ca/
* @link http://status.net/
*/
if (!defined('LACONICA')) {
if (!defined('STATUSNET') && !defined('LACONICA')) {
exit(1);
}
@@ -38,11 +38,11 @@ require_once INSTALLDIR . '/lib/widget.php';
* A widget for showing the connect group local nav menu
*
* @category Output
* @package Laconica
* @author Evan Prodromou <evan@controlyourself.ca>
* @author Zach Copley <zach@controlyourself.ca>
* @package StatusNet
* @author Evan Prodromou <evan@status.net>
* @author Zach Copley <zach@status.net>
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://laconi.ca/
* @link http://status.net/
*
* @see Widget
*/

View File

@@ -1,6 +1,6 @@
<?php
if (!defined('LACONICA')) {
if (!defined('STATUSNET') && !defined('LACONICA')) {
exit(1);
}

View File

@@ -1,6 +1,6 @@
<?php
/**
* Laconica, the distributed open-source microblogging tool
* StatusNet, the distributed open-source microblogging tool
*
* Plugin to enable Facebook Connect
*
@@ -20,11 +20,11 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @category Plugin
* @package Laconica
* @author Zach Copley <zach@controlyourself.ca>
* @copyright 2009 Control Yourself, Inc.
* @package StatusNet
* @author Zach Copley <zach@status.net>
* @copyright 2009 StatusNet, Inc.
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://laconi.ca/
* @link http://status.net/
*/
require_once INSTALLDIR . '/plugins/FBConnect/FBConnectPlugin.php';

View File

@@ -1,6 +1,6 @@
<?php
/*
* Laconica - a distributed open-source microblogging tool
* StatusNet - a distributed open-source microblogging tool
* Copyright (C) 2008, Controlez-Vous, Inc.
*
* This program is free software: you can redistribute it and/or modify
@@ -17,7 +17,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
if (!defined('LACONICA')) {
if (!defined('STATUSNET') && !defined('LACONICA')) {
exit(1);
}

View File

@@ -1,10 +1,10 @@
/** Styles for Facebook logo and Facebook user profile avatar.
*
* @package Laconica
* @author Sarven Capadisli <csarven@controlyourself.ca>
* @copyright 2009 Control Yourself, Inc.
* @package StatusNet
* @author Sarven Capadisli <csarven@status.net>
* @copyright 2009 StatusNet, Inc.
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://laconi.ca/
* @link http://status.net/
*/
#site_nav_global_primary #nav_fb {

View File

@@ -1,6 +1,6 @@
<?php
/**
* Laconica, the distributed open-source microblogging tool
* StatusNet, the distributed open-source microblogging tool
*
* Plugin to enable Facebook Connect
*
@@ -20,14 +20,14 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @category Plugin
* @package Laconica
* @author Zach Copley <zach@controlyourself.ca>
* @copyright 2009 Control Yourself, Inc.
* @package StatusNet
* @author Zach Copley <zach@status.net>
* @copyright 2009 StatusNet, Inc.
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://laconi.ca/
* @link http://status.net/
*/
if (!defined('LACONICA')) {
if (!defined('STATUSNET') && !defined('LACONICA')) {
exit(1);
}
@@ -45,10 +45,10 @@ require_once INSTALLDIR . '/plugins/FBConnect/FBC_XDReceiver.php';
* Plugin to enable Facebook Connect
*
* @category Plugin
* @package Laconica
* @author Zach Copley <zach@controlyourself.ca>
* @package StatusNet
* @author Zach Copley <zach@status.net>
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://laconi.ca/
* @link http://status.net/
*/
class FBConnectPlugin extends Plugin
@@ -148,7 +148,7 @@ class FBConnectPlugin extends Plugin
}
}
function onEndShowLaconicaStyles($action)
function onEndShowStatusNetStyles($action)
{
if ($this->reqFbScripts($action)) {

View File

@@ -1,6 +1,6 @@
<?php
/**
* Laconica, the distributed open-source microblogging tool
* StatusNet, the distributed open-source microblogging tool
*
* Facebook Connect settings
*
@@ -20,14 +20,14 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @category Settings
* @package Laconica
* @author Zach Copley <zach@controlyourself.ca>
* @copyright 2009 Control Yourself, Inc.
* @package StatusNet
* @author Zach Copley <zach@status.net>
* @copyright 2009 StatusNet, Inc.
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://laconi.ca/
* @link http://status.net/
*/
if (!defined('LACONICA')) {
if (!defined('STATUSNET') && !defined('LACONICA')) {
exit(1);
}
@@ -37,10 +37,10 @@ require_once INSTALLDIR.'/lib/connectsettingsaction.php';
* Facebook Connect settings action
*
* @category Settings
* @package Laconica
* @author Zach Copley <zach@controlyourself.ca>
* @package StatusNet
* @author Zach Copley <zach@status.net>
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://laconi.ca/
* @link http://status.net/
*/
class FBConnectSettingsAction extends ConnectSettingsAction

View File

@@ -1,18 +1,18 @@
This plugin allows you to utilize Facebook Connect with Laconica.
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 Laconica account with a Facebook account
- Disconnect a Facebook account from a Laconica account
- 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 Laconica installation
- Auto-subscribe Facebook friends already using Laconica
- Share Laconica favorite notices to your Facebook stream
- 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 Laconica installation (see the Installation section
to point to your StatusNet installation (see the Installation section
below).
Installation
@@ -26,16 +26,16 @@ Facebook developer wiki:
http://wiki.developers.facebook.com/index.php/Connect/Setting_Up_Your_Site
If you already are using the build-in Laconica Facebook application,
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 Laconica site. E.g.:
URL' to be the main URL for your StatusNet site. E.g.:
http://SITE/PATH_TO_LACONICA/
http://SITE/PATH_TO_STATUSNET/
After you application is created and configured, you'll need to add its
API key and secret to your Laconica config.php file:
API key and secret to your StatusNet config.php file:
$config['facebook']['apikey'] = 'APIKEY';
$config['facebook']['secret'] = 'SECRET';
@@ -47,11 +47,11 @@ config.php:
To try out the plugin, fire up your browser and connect to:
http://SITE/PATH_TO_LACONICA/main/facebooklogin
http://SITE/PATH_TO_STATUSNET/main/facebooklogin
or, if you do not have fancy URLs turned on:
http://SITE/PATH_TO_LACONICA/index.php/main/facebooklogin
http://SITE/PATH_TO_STATUSNET/index.php/main/facebooklogin
You should see a page with a blue button that says: "Connect with
Facebook".
@@ -62,10 +62,10 @@ 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 Laconica password.
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 Laconica account, and therefore haven't
Connect to register their StatusNet account, and therefore haven't
already set a local password.
Helpful links

View File

@@ -1,6 +1,6 @@
<?php
/**
* Laconica, the distributed open-source microblogging tool
* StatusNet, the distributed open-source microblogging tool
*
* Plugin to use Google Analytics
*
@@ -20,14 +20,14 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @category Plugin
* @package Laconica
* @author Evan Prodromou <evan@controlyourself.ca>
* @copyright 2008 Control Yourself, Inc.
* @package StatusNet
* @author Evan Prodromou <evan@status.net>
* @copyright 2008 StatusNet, Inc.
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://laconi.ca/
* @link http://status.net/
*/
if (!defined('LACONICA')) {
if (!defined('STATUSNET')) {
exit(1);
}
@@ -40,10 +40,10 @@ if (!defined('LACONICA')) {
* Piwik (http://www.piwik.org/) instead!
*
* @category Plugin
* @package Laconica
* @author Evan Prodromou <evan@controlyourself.ca>
* @package StatusNet
* @author Evan Prodromou <evan@status.net>
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://laconi.ca/
* @link http://status.net/
*
* @see Event
*/

View File

@@ -1,6 +1,6 @@
<?php
/**
* Laconica, the distributed open-source microblogging tool
* StatusNet, the distributed open-source microblogging tool
*
* Plugin to enable Infinite Scrolling
*
@@ -20,14 +20,14 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @category Plugin
* @package Laconica
* @package StatusNet
* @author Craig Andrews <candrews@integralblue.com>
* @copyright 2009 Craig Andrews http://candrews.integralblue.com
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://laconi.ca/
* @link http://status.net/
*/
if (!defined('LACONICA')) {
if (!defined('STATUSNET') && !defined('LACONICA')) {
exit(1);
}

View File

@@ -1,4 +1,4 @@
Infinite Scroll adds the following functionality to your Laconica installation: When a user scrolls towards the bottom of the page, the next page of notices is automatically retrieved and appended. This means they never need to click "Next Page", which dramatically increases stickiness.
Infinite Scroll adds the following functionality to your StatusNet installation: When a user scrolls towards the bottom of the page, the next page of notices is automatically retrieved and appended. This means they never need to click "Next Page", which dramatically increases stickiness.
Installation
============

View File

@@ -0,0 +1,64 @@
<?php
/**
* StatusNet, the distributed open-source microblogging tool
*
* Plugin to push RSS/Atom updates to a PubSubHubBub hub
*
* PHP version 5
*
* LICENCE: This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @category Plugin
* @package StatusNet
* @author Craig Andrews <candrews@integralblue.com>
* @copyright 2009 Craig Andrews http://candrews.integralblue.com
* @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')) {
exit(1);
}
require_once(INSTALLDIR.'/lib/Shorturl_api.php');
class LilUrlPlugin extends Plugin
{
function __construct()
{
parent::__construct();
}
function onInitializePlugin(){
$this->registerUrlShortener(
'ur1.ca',
array('freeService'=>true),
array('LilUrl',array('http://ur1.ca/'))
);
}
}
class LilUrl extends ShortUrlApi
{
protected function shorten_imp($url) {
$data['longurl'] = $url;
$response = $this->http_post($data);
if (!$response) return $url;
$y = @simplexml_load_string($response);
if (!isset($y->body)) return $url;
$x = $y->body->p[0]->a->attributes();
if (isset($x['href'])) return $x['href'];
return $url;
}
}

View File

@@ -1,6 +1,6 @@
<?php
/**
* Laconica, the distributed open-source microblogging tool
* StatusNet, the distributed open-source microblogging tool
*
* Plugin to do linkbacks for notices containing links
*
@@ -20,14 +20,14 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @category Plugin
* @package Laconica
* @author Evan Prodromou <evan@controlyourself.ca>
* @copyright 2009 Control Yourself, Inc.
* @package StatusNet
* @author Evan Prodromou <evan@status.net>
* @copyright 2009 StatusNet, Inc.
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://laconi.ca/
* @link http://status.net/
*/
if (!defined('LACONICA')) {
if (!defined('STATUSNET')) {
exit(1);
}
@@ -42,10 +42,10 @@ define('LINKBACKPLUGIN_VERSION', '0.1');
* are URLs, we test each URL to see if it supports any
*
* @category Plugin
* @package Laconica
* @author Evan Prodromou <evan@controlyourself.ca>
* @package StatusNet
* @author Evan Prodromou <evan@status.net>
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://laconi.ca/
* @link http://status.net/
*
* @see Event
*/
@@ -225,6 +225,6 @@ class LinkbackPlugin extends Plugin
function userAgent()
{
return 'LinkbackPlugin/'.LINKBACKPLUGIN_VERSION .
' Laconica/' . LACONICA_VERSION;
' StatusNet/' . STATUSNET_VERSION;
}
}

View File

@@ -1,6 +1,6 @@
<?php
/**
* Laconica, the distributed open-source microblogging tool
* StatusNet, the distributed open-source microblogging tool
*
* Plugin to do "real time" updates using Comet/Bayeux
*
@@ -20,14 +20,14 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @category Plugin
* @package Laconica
* @author Evan Prodromou <evan@controlyourself.ca>
* @copyright 2009 Control Yourself, Inc.
* @package StatusNet
* @author Evan Prodromou <evan@status.net>
* @copyright 2009 StatusNet, Inc.
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://laconi.ca/
* @link http://status.net/
*/
if (!defined('LACONICA')) {
if (!defined('STATUSNET') && !defined('LACONICA')) {
exit(1);
}
@@ -37,10 +37,10 @@ require_once INSTALLDIR.'/plugins/Realtime/RealtimePlugin.php';
* Plugin to do realtime updates using Meteor
*
* @category Plugin
* @package Laconica
* @author Evan Prodromou <evan@controlyourself.ca>
* @package StatusNet
* @author Evan Prodromou <evan@status.net>
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://laconi.ca/
* @link http://status.net/
*/
class MeteorPlugin extends RealtimePlugin

View File

@@ -1,6 +1,6 @@
<?php
/**
* Laconica, the distributed open-source microblogging tool
* StatusNet, the distributed open-source microblogging tool
*
* Complete adding an OpenID
*
@@ -20,14 +20,14 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @category Settings
* @package Laconica
* @author Evan Prodromou <evan@controlyourself.ca>
* @copyright 2008-2009 Control Yourself, Inc.
* @package StatusNet
* @author Evan Prodromou <evan@status.net>
* @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://laconi.ca/
* @link http://status.net/
*/
if (!defined('LACONICA')) {
if (!defined('STATUSNET') && !defined('LACONICA')) {
exit(1);
}
@@ -39,10 +39,10 @@ require_once INSTALLDIR.'/plugins/OpenID/openid.php';
* Handle the return from an OpenID verification
*
* @category Settings
* @package Laconica
* @author Evan Prodromou <evan@controlyourself.ca>
* @package StatusNet
* @author Evan Prodromou <evan@status.net>
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://laconi.ca/
* @link http://status.net/
*/
class FinishaddopenidAction extends Action

View File

@@ -1,7 +1,7 @@
<?php
/*
* Laconica - a distributed open-source microblogging tool
* Copyright (C) 2008, 2009, Control Yourself, Inc.
* StatusNet - the distributed open-source microblogging tool
* Copyright (C) 2008, 2009, StatusNet, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
@@ -17,7 +17,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
if (!defined('LACONICA')) { exit(1); }
if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); }
require_once INSTALLDIR.'/plugins/OpenID/openid.php';
@@ -410,7 +410,7 @@ class FinishopenidloginAction extends Action
}
}
# We try to use an OpenID URL as a legal Laconica user name in this order
# We try to use an OpenID URL as a legal StatusNet user name in this order
# 1. Plain hostname, like http://evanp.myopenid.com/
# 2. One element in path, like http://profile.typekey.com/EvanProdromou/
# or http://getopenid.com/evanprodromou

View File

@@ -1,7 +1,7 @@
<?php
/*
* Laconica - a distributed open-source microblogging tool
* Copyright (C) 2008, 2009, Control Yourself, Inc.
* StatusNet - the distributed open-source microblogging tool
* Copyright (C) 2008, 2009, StatusNet, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
@@ -17,7 +17,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
if (!defined('LACONICA')) { exit(1); }
if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); }
require_once(INSTALLDIR.'/plugins/OpenID/User_openid.php');

View File

@@ -1,7 +1,7 @@
<?php
/*
* Laconica - a distributed open-source microblogging tool
* Copyright (C) 2008, 2009, Control Yourself, Inc.
* StatusNet - the distributed open-source microblogging tool
* Copyright (C) 2008, 2009, StatusNet, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
@@ -17,7 +17,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
if (!defined('LACONICA')) { exit(1); }
if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); }
require_once INSTALLDIR.'/plugins/OpenID/openid.php';

View File

@@ -1,6 +1,6 @@
<?php
/**
* Laconica, the distributed open-source microblogging tool
* StatusNet, the distributed open-source microblogging tool
*
* Settings for OpenID
*
@@ -20,14 +20,14 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @category Settings
* @package Laconica
* @author Evan Prodromou <evan@controlyourself.ca>
* @copyright 2008-2009 Control Yourself, Inc.
* @package StatusNet
* @author Evan Prodromou <evan@status.net>
* @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://laconi.ca/
* @link http://status.net/
*/
if (!defined('LACONICA')) {
if (!defined('STATUSNET') && !defined('LACONICA')) {
exit(1);
}
@@ -40,10 +40,10 @@ require_once INSTALLDIR.'/plugins/OpenID/openid.php';
* Lets users add, edit and delete OpenIDs from their account
*
* @category Settings
* @package Laconica
* @author Evan Prodromou <evan@controlyourself.ca>
* @package StatusNet
* @author Evan Prodromou <evan@status.net>
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://laconi.ca/
* @link http://status.net/
*/
class OpenidsettingsAction extends AccountSettingsAction

View File

@@ -6,14 +6,14 @@
* PHP version 5
*
* @category Action
* @package Laconica
* @author Evan Prodromou <evan@controlyourself.ca>
* @author Robin Millette <millette@controlyourself.ca>
* @package StatusNet
* @author Evan Prodromou <evan@status.net>
* @author Robin Millette <millette@status.net>
* @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
* @link http://laconi.ca/
* @link http://status.net/
*
* Laconica - a distributed open-source microblogging tool
* Copyright (C) 2008, 2009, Control Yourself, Inc.
* StatusNet - the distributed open-source microblogging tool
* Copyright (C) 2008, 2009, StatusNet, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
@@ -29,7 +29,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
if (!defined('LACONICA')) {
if (!defined('STATUSNET') && !defined('LACONICA')) {
exit(1);
}
@@ -39,11 +39,11 @@ require_once INSTALLDIR.'/plugins/OpenID/openid.php';
* Public XRDS for OpenID
*
* @category Action
* @package Laconica
* @author Evan Prodromou <evan@controlyourself.ca>
* @author Robin Millette <millette@controlyourself.ca>
* @package StatusNet
* @author Evan Prodromou <evan@status.net>
* @author Robin Millette <millette@status.net>
* @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
* @link http://laconi.ca/
* @link http://status.net/
*
* @todo factor out similarities with XrdsAction
*/

View File

@@ -1,6 +1,6 @@
<?php
/**
* Laconica, the distributed open-source microblogging tool
* StatusNet, the distributed open-source microblogging tool
*
* Plugin to use Piwik Analytics
*
@@ -20,15 +20,15 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @category Plugin
* @package Laconica
* @author Evan Prodromou <evan@controlyourself.ca>
* @package StatusNet
* @author Evan Prodromou <evan@status.net>
* @author Tobias Diekershoff <tobias.diekershoff@gmx.net>
* @copyright 2008 Control Yourself, Inc.
* @copyright 2008 StatusNet, Inc.
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://laconi.ca/
* @link http://status.net/
*/
if (!defined('LACONICA')) {
if (!defined('STATUSNET')) {
exit(1);
}
@@ -45,13 +45,13 @@ if (!defined('LACONICA')) {
*
* exchange example.com/piwik/ with the url to your piwik installation and
* make sure you don't forget the final /
* exchange id with the ID your laconica installation has in your Piwik analytics
* exchange id with the ID your statusnet installation has in your Piwik analytics
*
* @category Plugin
* @package Laconica
* @package StatusNet
* @author Tobias Diekershoff <tobias.diekershoff@gmx.net>
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://laconi.ca/
* @link http://status.net/
*
* @see Event
*/
@@ -60,7 +60,7 @@ class PiwikAnalyticsPlugin extends Plugin
{
/** the base of your Piwik installation */
var $piwikroot = null;
/** the Piwik Id of your laconica installation */
/** the Piwik Id of your statusnet installation */
var $piwikId = null;
/**

View File

@@ -0,0 +1,62 @@
<?php
/**
* StatusNet, the distributed open-source microblogging tool
*
* Plugin to push RSS/Atom updates to a PubSubHubBub hub
*
* PHP version 5
*
* LICENCE: This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @category Plugin
* @package StatusNet
* @author Craig Andrews <candrews@integralblue.com>
* @copyright 2009 Craig Andrews http://candrews.integralblue.com
* @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')) {
exit(1);
}
class PtitUrlPlugin extends Plugin
{
function __construct()
{
parent::__construct();
}
function onInitializePlugin(){
$this->registerUrlShortener(
'ptiturl.com',
array(),
array('PtitUrl',array('http://ptiturl.com/?creer=oui&action=Reduire&url='))
);
}
}
class PtitUrl extends ShortUrlApi
{
protected function shorten_imp($url) {
$response = $this->http_get($url);
if (!$response) return $url;
$response = $this->tidy($response);
$y = @simplexml_load_string($response);
if (!isset($y->body)) return $url;
$xml = $y->body->center->table->tr->td->pre->a->attributes();
if (isset($xml['href'])) return $xml['href'];
return $url;
}
}

View File

@@ -0,0 +1,122 @@
<?php
/**
* StatusNet, the distributed open-source microblogging tool
*
* Plugin to push RSS/Atom updates to a PubSubHubBub hub
*
* PHP version 5
*
* LICENCE: This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @category Plugin
* @package StatusNet
* @author Craig Andrews <candrews@integralblue.com>
* @copyright 2009 Craig Andrews http://candrews.integralblue.com
* @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')) {
exit(1);
}
define('DEFAULT_HUB','http://2pubsubhubbub.appspot.com');
require_once(INSTALLDIR.'/plugins/PubSubHubBub/publisher.php');
class PubSubHubBubPlugin extends Plugin
{
private $hub;
function __construct()
{
parent::__construct();
}
function onInitializePlugin(){
$this->hub = common_config('PubSubHubBub', 'hub');
if(empty($this->hub)){
$this->hub = DEFAULT_HUB;
}
}
function onStartApiAtom($action){
$action->element('link',array('rel'=>'hub','href'=>$this->hub),null);
}
function onStartApiRss($action){
$action->element('atom:link',array('rel'=>'hub','href'=>$this->hub),null);
}
function onEndNoticeSave($notice){
$publisher = new Publisher($this->hub);
$feeds = array();
//public timeline feeds
$feeds[]=common_local_url('api',array('apiaction' => 'statuses','method' => 'public_timeline.rss'));
$feeds[]=common_local_url('api',array('apiaction' => 'statuses','method' => 'public_timeline.atom'));
//author's own feeds
$user = User::staticGet('id',$notice->profile_id);
$feeds[]=common_local_url('api',array('apiaction' => 'statuses','method' => 'user_timeline','argument' => $user->nickname.'.rss'));
$feeds[]=common_local_url('api',array('apiaction' => 'statuses','method' => 'user_timeline','argument' => $user->nickname.'.atom'));
//tag feeds
$tag = new Notice_tag();
$tag->notice_id = $notice->id;
if ($tag->find()) {
while ($tag->fetch()) {
$feeds[]=common_local_url('api',array('apiaction' => 'tags','method' => 'timeline', 'argument'=>$tag->tag.'.atom'));
$feeds[]=common_local_url('api',array('apiaction' => 'tags','method' => 'timeline', 'argument'=>$tag->tag.'.rss'));
}
}
//group feeds
$group_inbox = new Group_inbox();
$group_inbox->notice_id = $notice->id;
if ($group_inbox->find()) {
while ($group_inbox->fetch()) {
$group = User_group::staticGet('id',$group_inbox->group_id);
$feeds[]=common_local_url('api',array('apiaction' => 'groups','method' => 'timeline','argument' => $group->nickname.'.rss'));
$feeds[]=common_local_url('api',array('apiaction' => 'groups','method' => 'timeline','argument' => $group->nickname.'.atom'));
}
}
//feed of each user that subscribes to the notice's author
$notice_inbox = new Notice_inbox();
$notice_inbox->notice_id = $notice->id;
if ($notice_inbox->find()) {
while ($notice_inbox->fetch()) {
$user = User::staticGet('id',$notice_inbox->user_id);
$feeds[]=common_local_url('api',array('apiaction' => 'statuses','method' => 'user_timeline','argument' => $user->nickname.'.rss'));
$feeds[]=common_local_url('api',array('apiaction' => 'statuses','method' => 'user_timeline','argument' => $user->nickname.'.atom'));
}
}
/* TODO: when the reply page gets RSS and ATOM feeds, implement this
//feed of user replied to
if($notice->reply_to){
$user = User::staticGet('id',$notice->reply_to);
$feeds[]=common_local_url('api',array('apiaction' => 'statuses','method' => 'user_timeline','argument' => $user->nickname.'.rss'));
$feeds[]=common_local_url('api',array('apiaction' => 'statuses','method' => 'user_timeline','argument' => $user->nickname.'.atom'));
}*/
foreach(array_unique($feeds) as $feed){
if(! $publisher->publish_update($feed)){
common_log_line(LOG_WARNING,$feed.' was not published to hub at '.$this->hub.':'.$publisher->last_response());
}
}
}
}

View File

@@ -0,0 +1,86 @@
<?php
// a PHP client library for pubsubhubbub
// as defined at http://code.google.com/p/pubsubhubbub/
// written by Josh Fraser | joshfraser.com | josh@eventvue.com
// Released under Apache License 2.0
class Publisher {
protected $hub_url;
protected $last_response;
// create a new Publisher
public function __construct($hub_url) {
if (!isset($hub_url))
throw new Exception('Please specify a hub url');
if (!preg_match("|^https?://|i",$hub_url))
throw new Exception('The specified hub url does not appear to be valid: '.$hub_url);
$this->hub_url = $hub_url;
}
// accepts either a single url or an array of urls
public function publish_update($topic_urls, $http_function = false) {
if (!isset($topic_urls))
throw new Exception('Please specify a topic url');
// check that we're working with an array
if (!is_array($topic_urls)) {
$topic_urls = array($topic_urls);
}
// set the mode to publish
$post_string = "hub.mode=publish";
// loop through each topic url
foreach ($topic_urls as $topic_url) {
// lightweight check that we're actually working w/ a valid url
if (!preg_match("|^https?://|i",$topic_url))
throw new Exception('The specified topic url does not appear to be valid: '.$topic_url);
// append the topic url parameters
$post_string .= "&hub.url=".urlencode($topic_url);
}
// make the http post request and return true/false
// easy to over-write to use your own http function
if ($http_function)
return $http_function($this->hub_url,$post_string);
else
return $this->http_post($this->hub_url,$post_string);
}
// returns any error message from the latest request
public function last_response() {
return $this->last_response;
}
// default http function that uses curl to post to the hub endpoint
private function http_post($url, $post_string) {
// add any additional curl options here
$options = array(CURLOPT_URL => $url,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => $post_string,
CURLOPT_USERAGENT => "PubSubHubbub-Publisher-PHP/1.0");
$ch = curl_init();
curl_setopt_array($ch, $options);
$response = curl_exec($ch);
$this->last_response = $response;
$info = curl_getinfo($ch);
curl_close($ch);
// all good
if ($info['http_code'] == 204)
return true;
return false;
}
}
?>

View File

@@ -1,6 +1,6 @@
<?php
/**
* Laconica, the distributed open-source microblogging tool
* StatusNet, the distributed open-source microblogging tool
*
* Superclass for plugins that do "real time" updates of timelines using Ajax
*
@@ -20,14 +20,14 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @category Plugin
* @package Laconica
* @author Evan Prodromou <evan@controlyourself.ca>
* @copyright 2009 Control Yourself, Inc.
* @package StatusNet
* @author Evan Prodromou <evan@status.net>
* @copyright 2009 StatusNet, Inc.
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://laconi.ca/
* @link http://status.net/
*/
if (!defined('LACONICA')) {
if (!defined('STATUSNET') && !defined('LACONICA')) {
exit(1);
}
@@ -38,10 +38,10 @@ if (!defined('LACONICA')) {
* this superclass extracts out some of the common functionality
*
* @category Plugin
* @package Laconica
* @author Evan Prodromou <evan@controlyourself.ca>
* @package StatusNet
* @author Evan Prodromou <evan@status.net>
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://laconi.ca/
* @link http://status.net/
*/
class RealtimePlugin extends Plugin

View File

@@ -0,0 +1,79 @@
<?php
/**
* StatusNet, the distributed open-source microblogging tool
*
* Plugin to push RSS/Atom updates to a PubSubHubBub hub
*
* PHP version 5
*
* LICENCE: This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @category Plugin
* @package StatusNet
* @author Craig Andrews <candrews@integralblue.com>
* @copyright 2009 Craig Andrews http://candrews.integralblue.com
* @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')) {
exit(1);
}
class SimpleUrlPlugin extends Plugin
{
function __construct()
{
parent::__construct();
}
function onInitializePlugin(){
$this->registerUrlShortener(
'is.gd',
array(),
array('SimpleUrl',array('http://is.gd/api.php?longurl='))
);
$this->registerUrlShortener(
'snipr.com',
array(),
array('SimpleUrl',array('http://snipr.com/site/snip?r=simple&link='))
);
$this->registerUrlShortener(
'metamark.net',
array(),
array('SimpleUrl',array('http://metamark.net/api/rest/simple?long_url='))
);
$this->registerUrlShortener(
'tinyurl.com',
array(),
array('SimpleUrl',array('http://tinyurl.com/api-create.php?url='))
);
}
}
class SimpleUrl extends ShortUrlApi
{
protected function shorten_imp($url) {
$curlh = curl_init();
curl_setopt($curlh, CURLOPT_CONNECTTIMEOUT, 20); // # seconds to wait
curl_setopt($curlh, CURLOPT_USERAGENT, 'StatusNet');
curl_setopt($curlh, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curlh, CURLOPT_URL, $this->service_url.urlencode($url));
$short_url = curl_exec($curlh);
curl_close($curlh);
return $short_url;
}
}

View File

@@ -8,14 +8,14 @@
* The method is disabled unless the user is #1, the first user of the system
*
* @category Plugin
* @package Laconica
* @package StatusNet
* @author Brian Hendrickson <brian@megapump.com>
* @copyright 2009 Megapump, Inc.
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://megapump.com/
*/
if (!defined('LACONICA')) {
if (!defined('STATUSNET')) {
exit(1);
}
@@ -195,16 +195,16 @@ class TemplatePlugin extends Plugin {
);
// use the PHP template
// unless laconica config:
// unless statusnet config:
// $config['template']['mode'] = 'html';
if (!(common_config('template', 'mode') == 'html')) {
$tpl_file = 'tpl/index.php';
$tpl_file = $this->templateFolder() . '/index.php';
$tags = array_merge($vars,$this->blocks);
include $tpl_file;
return;
}
$tpl_file = 'tpl/index.html';
$tpl_file = $this->templateFolder() . '/index.html';
// read the static template
$output = file_get_contents( $tpl_file );
@@ -236,6 +236,9 @@ class TemplatePlugin extends Plugin {
return true;
}
function templateFolder() {
return 'tpl';
}
// catching the StartShowHTML event to halt the rendering
function onStartShowHTML( &$act ) {
@@ -258,7 +261,7 @@ class TemplatePlugin extends Plugin {
* parameter "template", containing the new template code
*
* @category Plugin
* @package Laconica
* @package StatusNet
* @author Brian Hendrickson <brian@megapump.com>
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://megapump.com/
@@ -280,7 +283,7 @@ class TemplateAction extends Action
if (!isset($_SERVER['PHP_AUTH_USER'])) {
// not authenticated, show login form
header('WWW-Authenticate: Basic realm="Laconica API"');
header('WWW-Authenticate: Basic realm="StatusNet API"');
// cancelled the browser login form
$this->clientError(_('Authentication error!'), $code = 401);
@@ -300,7 +303,7 @@ class TemplateAction extends Action
$this->clientError(_('only User #1 can update the template'), $code = 401);
// open the old template
$tpl_file = 'tpl/index.html';
$tpl_file = $this->templateFolder() . '/index.html';
$fp = fopen( $tpl_file, 'w+' );
// overwrite with the new template
@@ -323,13 +326,13 @@ class TemplateAction extends Action
}
/**
* Function for retrieving a laconica display section
* Function for retrieving a statusnet display section
*
* requires one parameter, the name of the section
* section names are listed in the comments of the TemplatePlugin class
*
* @category Plugin
* @package Laconica
* @package StatusNet
* @author Brian Hendrickson <brian@megapump.com>
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://megapump.com/

View File

@@ -0,0 +1,62 @@
<?php
/**
* StatusNet, the distributed open-source microblogging tool
*
* Plugin to push RSS/Atom updates to a PubSubHubBub hub
*
* PHP version 5
*
* LICENCE: This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @category Plugin
* @package StatusNet
* @author Craig Andrews <candrews@integralblue.com>
* @copyright 2009 Craig Andrews http://candrews.integralblue.com
* @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')) {
exit(1);
}
class TightUrlPlugin extends Plugin
{
function __construct()
{
parent::__construct();
}
function onInitializePlugin(){
$this->registerUrlShortener(
'2tu.us',
array('freeService'=>true),
array('TightUrl',array('http://2tu.us/?save=y&url='))
);
}
}
class TightUrl extends ShortUrlApi
{
protected function shorten_imp($url) {
$response = $this->http_get($url);
if (!$response) return $url;
$response = $this->tidy($response);
$y = @simplexml_load_string($response);
if (!isset($y->body)) return $url;
$xml = $y->body->p[0]->code[0]->a->attributes();
if (isset($xml['href'])) return $xml['href'];
return $url;
}
}

View File

@@ -1,8 +1,8 @@
#!/usr/bin/env php
<?php
/*
* Laconica - a distributed open-source microblogging tool
* Copyright (C) 2008, 2009, Control Yourself, Inc.
* StatusNet - the distributed open-source microblogging tool
* Copyright (C) 2008, 2009, StatusNet, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
@@ -38,11 +38,11 @@ require_once INSTALLDIR . '/plugins/TwitterBridge/twitter.php';
* Daemon to sync local friends with Twitter friends
*
* @category Twitter
* @package Laconica
* @author Zach Copley <zach@controlyourself.ca>
* @author Evan Prodromou <evan@controlyourself.ca>
* @package StatusNet
* @author Zach Copley <zach@status.net>
* @author Evan Prodromou <evan@status.net>
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://laconi.ca/
* @link http://status.net/
*/
$helptext = <<<END_OF_TWITTER_HELP
@@ -143,13 +143,20 @@ class SyncTwitterFriendsDaemon extends ParallelizingDaemon
{
$friends = array();
$token = TwitterOAuthClient::unpackToken($flink->credentials);
$client = null;
$client = new TwitterOAuthClient($token->key, $token->secret);
if (TwitterOAuthClient::isPackedToken($flink->credentials)) {
$token = TwitterOAuthClient::unpackToken($flink->credentials);
$client = new TwitterOAuthClient($token->key, $token->secret);
common_debug($this->name() . '- Grabbing friends IDs with OAuth.');
} else {
$client = new TwitterBasicAuthClient($flink);
common_debug($this->name() . '- Grabbing friends IDs with basic auth.');
}
try {
$friends_ids = $client->friendsIds();
} catch (OAuthCurlException $e) {
} catch (Exception $e) {
common_log(LOG_WARNING, $this->name() .
' - cURL error getting friend ids ' .
$e->getCode() . ' - ' . $e->getMessage());
@@ -178,7 +185,7 @@ class SyncTwitterFriendsDaemon extends ParallelizingDaemon
try {
$more_friends = $client->statusesFriends(null, null, null, $i);
} catch (OAuthCurlException $e) {
} catch (Exception $e) {
common_log(LOG_WARNING, $this->name() .
' - cURL error getting Twitter statuses/friends ' .
"page $i - " . $e->getCode() . ' - ' .

View File

@@ -1,8 +1,8 @@
#!/usr/bin/env php
<?php
/*
* Laconica - a distributed open-source microblogging tool
* Copyright (C) 2008, 2009, Control Yourself, Inc.
* StatusNet - the distributed open-source microblogging tool
* Copyright (C) 2008, 2009, StatusNet, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by

View File

@@ -1,8 +1,8 @@
#!/usr/bin/env php
<?php
/**
* Laconica - a distributed open-source microblogging tool
* Copyright (C) 2008, 2009, Control Yourself, Inc.
* StatusNet - the distributed open-source microblogging tool
* Copyright (C) 2008, 2009, StatusNet, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
@@ -47,15 +47,15 @@ require_once INSTALLDIR . '/plugins/TwitterBridge/twitter.php';
* system.
*
* @category Twitter
* @package Laconica
* @author Zach Copley <zach@controlyourself.ca>
* @author Evan Prodromou <evan@controlyourself.ca>
* @package StatusNet
* @author Zach Copley <zach@status.net>
* @author Evan Prodromou <evan@status.net>
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://laconi.ca/
* @link http://status.net/
*/
// NOTE: an Avatar path MUST be set in config.php for this
// script to work: e.g.: $config['avatar']['path'] = '/laconica/avatar';
// script to work: e.g.: $config['avatar']['path'] = '/statusnet/avatar';
class TwitterStatusFetcher extends ParallelizingDaemon
{
@@ -149,9 +149,9 @@ class TwitterStatusFetcher extends ParallelizingDaemon
function getTimeline($flink)
{
if (empty($flink)) {
if (empty($flink)) {
common_log(LOG_WARNING, $this->name() .
" - Can't retrieve Foreign_link for foreign ID $fid");
" - Can't retrieve Foreign_link for foreign ID $fid");
return;
}
@@ -162,17 +162,24 @@ class TwitterStatusFetcher extends ParallelizingDaemon
// to start importing? How many statuses? Right now I'm going
// with the default last 20.
$token = TwitterOAuthClient::unpackToken($flink->credentials);
$client = null;
$client = new TwitterOAuthClient($token->key, $token->secret);
if (TwitterOAuthClient::isPackedToken($flink->credentials)) {
$token = TwitterOAuthClient::unpackToken($flink->credentials);
$client = new TwitterOAuthClient($token->key, $token->secret);
common_debug($this->name() . ' - Grabbing friends timeline with OAuth.');
} else {
$client = new TwitterBasicAuthClient($flink);
common_debug($this->name() . ' - Grabbing friends timeline with basic auth.');
}
$timeline = null;
try {
$timeline = $client->statusesFriendsTimeline();
} catch (OAuthClientCurlException $e) {
} catch (Exception $e) {
common_log(LOG_WARNING, $this->name() .
' - OAuth client unable to get friends timeline for user ' .
' - Twitter client unable to get friends timeline for user ' .
$flink->user_id . ' - code: ' .
$e->getCode() . 'msg: ' . $e->getMessage());
}
@@ -186,7 +193,7 @@ class TwitterStatusFetcher extends ParallelizingDaemon
foreach (array_reverse($timeline) as $status) {
// Hacktastic: filter out stuff coming from this Laconica
// Hacktastic: filter out stuff coming from this StatusNet
$source = mb_strtolower(common_config('integration', 'source'));
@@ -479,7 +486,7 @@ class TwitterStatusFetcher extends ParallelizingDaemon
default:
// Note: Twitter's big avatars are a different size than
// Laconica's (Laconica's = 96)
// StatusNet's (StatusNet's = 96)
$avatar->width = 73;
$avatar->height = 73;

View File

@@ -1,7 +1,7 @@
<?php
/*
* Laconica - a distributed open-source microblogging tool
* Copyright (C) 2008, 2009, Control Yourself, Inc.
* StatusNet - the distributed open-source microblogging tool
* Copyright (C) 2008, 2009, StatusNet, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
@@ -17,7 +17,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
if (!defined('LACONICA')) {
if (!defined('STATUSNET') && !defined('LACONICA')) {
exit(1);
}
@@ -154,80 +154,134 @@ function broadcast_twitter($notice)
TWITTER_SERVICE);
if (is_twitter_bound($notice, $flink)) {
$user = $flink->getUser();
// XXX: Hack to get around PHP cURL's use of @ being a a meta character
$statustxt = preg_replace('/^@/', ' @', $notice->content);
$token = TwitterOAuthClient::unpackToken($flink->credentials);
$client = new TwitterOAuthClient($token->key, $token->secret);
$status = null;
try {
$status = $client->statusesUpdate($statustxt);
} catch (OAuthClientCurlException $e) {
if ($e->getMessage() == 'The requested URL returned error: 401') {
$errmsg = sprintf('User %1$s (user id: %2$s) has an invalid ' .
'Twitter OAuth access token.',
$user->nickname, $user->id);
common_log(LOG_WARNING, $errmsg);
// Bad auth token! We need to delete the foreign_link
// to Twitter and inform the user.
remove_twitter_link($flink);
return true;
} else {
// Some other error happened, so we should probably
// try to send again later.
$errmsg = sprintf('cURL error trying to send notice to Twitter ' .
'for user %1$s (user id: %2$s) - ' .
'code: %3$s message: $4$s.',
$user->nickname, $user->id,
$e->getCode(), $e->getMessage());
common_log(LOG_WARNING, $errmsg);
return false;
}
if (TwitterOAuthClient::isPackedToken($flink->credentials)) {
return broadcast_oauth($notice, $flink);
} else {
return broadcast_basicauth($notice, $flink);
}
if (empty($status)) {
// This could represent a failure posting,
// or the Twitter API might just be behaving flakey.
$errmsg = sprint('No data returned by Twitter API when ' .
'trying to send update for %1$s (user id %2$s).',
$user->nickname, $user->id);
common_log(LOG_WARNING, $errmsg);
return false;
}
// Notice crossed the great divide
$msg = sprintf('Twitter bridge posted notice %s to Twitter.',
$notice->id);
common_log(LOG_INFO, $msg);
}
return true;
}
function broadcast_oauth($notice, $flink) {
$user = $flink->getUser();
$statustxt = format_status($notice);
// Convert !groups to #hashes
$statustxt = preg_replace('/(^|\s)!([A-Za-z0-9]{1,64})/', "\\1#\\2", $statustxt);
$token = TwitterOAuthClient::unpackToken($flink->credentials);
$client = new TwitterOAuthClient($token->key, $token->secret);
$status = null;
try {
$status = $client->statusesUpdate($statustxt);
} catch (OAuthClientCurlException $e) {
return process_error($e, $flink);
}
if (empty($status)) {
// This could represent a failure posting,
// or the Twitter API might just be behaving flakey.
$errmsg = sprintf('Twitter bridge - No data returned by Twitter API when ' .
'trying to send update for %1$s (user id %2$s).',
$user->nickname, $user->id);
common_log(LOG_WARNING, $errmsg);
return false;
}
// Notice crossed the great divide
$msg = sprintf('Twitter bridge - posted notice %s to Twitter using OAuth.',
$notice->id);
common_log(LOG_INFO, $msg);
return true;
}
function broadcast_basicauth($notice, $flink)
{
$user = $flink->getUser();
$statustxt = format_status($notice);
$client = new TwitterBasicAuthClient($flink);
$status = null;
try {
$status = $client->statusesUpdate($statustxt);
} catch (BasicAuthCurlException $e) {
return process_error($e, $flink);
}
if (empty($status)) {
$errmsg = sprintf('Twitter bridge - No data returned by Twitter API when ' .
'trying to send update for %1$s (user id %2$s).',
$user->nickname, $user->id);
common_log(LOG_WARNING, $errmsg);
$errmsg = sprintf('No data returned by Twitter API when ' .
'trying to send update for %1$s (user id %2$s).',
$user->nickname, $user->id);
common_log(LOG_WARNING, $errmsg);
return false;
}
$msg = sprintf('Twitter bridge - posted notice %s to Twitter using basic auth.',
$notice->id);
common_log(LOG_INFO, $msg);
return true;
}
function process_error($e, $flink)
{
$user = $flink->getUser();
$errmsg = $e->getMessage();
$delivered = false;
switch($errmsg) {
case 'The requested URL returned error: 401':
$logmsg = sprintf('Twiter bridge - User %1$s (user id: %2$s) has an invalid ' .
'Twitter screen_name/password combo or an invalid acesss token.',
$user->nickname, $user->id);
$delivered = true;
remove_twitter_link($flink);
break;
case 'The requested URL returned error: 403':
$logmsg = sprintf('Twitter bridge - User %1$s (user id: %2$s) has exceeded ' .
'his/her Twitter request limit.',
$user->nickname, $user->id);
break;
default:
$logmsg = sprintf('Twitter bridge - cURL error trying to send notice to Twitter ' .
'for user %1$s (user id: %2$s) - ' .
'code: %3$s message: %4$s.',
$user->nickname, $user->id,
$e->getCode(), $e->getMessage());
break;
}
common_log(LOG_WARNING, $logmsg);
return $delivered;
}
function format_status($notice)
{
// XXX: Hack to get around PHP cURL's use of @ being a a meta character
return preg_replace('/^@/', ' @', $notice->content);
}
function remove_twitter_link($flink)
{
$user = $flink->getUser();
common_log(LOG_INFO, 'Removing Twitter bridge Foreign link for ' .
"user $user->nickname (user id: $user->id).");
"user $user->nickname (user id: $user->id).");
$result = $flink->delete();
@@ -255,4 +309,3 @@ function remove_twitter_link($flink)
}
}

View File

@@ -1,6 +1,6 @@
<?php
/**
* Laconica, the distributed open-source microblogging tool
* StatusNet, the distributed open-source microblogging tool
*
* Class for doing OAuth authentication against Twitter
*
@@ -19,15 +19,15 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @category Twitter
* @package Laconica
* @author Zach Copely <zach@controlyourself.ca>
* @copyright 2009 Control Yourself, Inc.
* @category TwitterauthorizationAction
* @package StatusNet
* @author Zach Copely <zach@status.net>
* @copyright 2009 StatusNet, Inc.
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://laconi.ca/
* @link http://status.net/
*/
if (!defined('LACONICA')) {
if (!defined('STATUSNET') && !defined('LACONICA')) {
exit(1);
}
@@ -36,14 +36,14 @@ require_once INSTALLDIR . '/plugins/TwitterBridge/twitter.php';
/**
* Class for doing OAuth authentication against Twitter
*
* Peforms the OAuth "dance" between Laconica and Twitter -- requests a token,
* Peforms the OAuth "dance" between StatusNet and Twitter -- requests a token,
* authorizes it, and exchanges it for an access token. It also creates a link
* (Foreign_link) between the Laconica user and Twitter user and stores the
* (Foreign_link) between the StatusNet user and Twitter user and stores the
* access token and secret in the link.
*
* @category Twitter
* @package Laconica
* @author Zach Copley <zach@controlyourself.ca>
* @package StatusNet
* @author Zach Copley <zach@status.net>
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://laconi.ca/
*

View File

@@ -1,6 +1,6 @@
<?php
/**
* Laconica, the distributed open-source microblogging tool
* StatusNet, the distributed open-source microblogging tool
*
* Class for doing OAuth calls against Twitter
*
@@ -20,14 +20,14 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @category Integration
* @package Laconica
* @author Zach Copley <zach@controlyourself.ca>
* @copyright 2008 Control Yourself, Inc.
* @package StatusNet
* @author Zach Copley <zach@status.net>
* @copyright 2009 StatusNet, Inc.
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://laconi.ca/
* @link http://status.net/
*/
if (!defined('LACONICA')) {
if (!defined('STATUSNET') && !defined('LACONICA')) {
exit(1);
}
@@ -35,10 +35,10 @@ if (!defined('LACONICA')) {
* Class for talking to the Twitter API with OAuth.
*
* @category Integration
* @package Laconica
* @author Zach Copley <zach@controlyourself.ca>
* @package StatusNet
* @author Zach Copley <zach@status.net>
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://laconi.ca/
* @link http://status.net/
*
*/
class TwitterOAuthClient extends OAuthClient
@@ -81,6 +81,15 @@ class TwitterOAuthClient extends OAuthClient
return new OAuthToken($vals[0], $vals[1]);
}
static function isPackedToken($str)
{
if (strpos($str, chr(0)) === false) {
return false;
} else {
return true;
}
}
/**
* Builds a link to Twitter's endpoint for authorizing a request token
*
@@ -109,7 +118,7 @@ class TwitterOAuthClient extends OAuthClient
}
/**
* Calls Twitter's /stutuses/update API method
* Calls Twitter's /statuses/update API method
*
* @param string $status text of the status
* @param int $in_reply_to_status_id optional id of the status it's
@@ -128,7 +137,7 @@ class TwitterOAuthClient extends OAuthClient
}
/**
* Calls Twitter's /stutuses/friends_timeline API method
* Calls Twitter's /statuses/friends_timeline API method
*
* @param int $since_id show statuses after this id
* @param int $max_id show statuses before this id
@@ -158,7 +167,7 @@ class TwitterOAuthClient extends OAuthClient
}
/**
* Calls Twitter's /stutuses/friends API method
* Calls Twitter's /statuses/friends API method
*
* @param int $id id of the user whom you wish to see friends of
* @param int $user_id numerical user id
@@ -188,7 +197,7 @@ class TwitterOAuthClient extends OAuthClient
}
/**
* Calls Twitter's /stutuses/friends/ids API method
* Calls Twitter's /statuses/friends/ids API method
*
* @param int $id id of the user whom you wish to see friends of
* @param int $user_id numerical user id

View File

@@ -1,6 +1,6 @@
<?php
/**
* Laconica, the distributed open-source microblogging tool
* StatusNet, the distributed open-source microblogging tool
*
* Settings for Twitter integration
*
@@ -20,14 +20,14 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @category Settings
* @package Laconica
* @author Evan Prodromou <evan@controlyourself.ca>
* @copyright 2008-2009 Control Yourself, Inc.
* @package StatusNet
* @author Evan Prodromou <evan@status.net>
* @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://laconi.ca/
* @link http://status.net/
*/
if (!defined('LACONICA')) {
if (!defined('STATUSNET') && !defined('LACONICA')) {
exit(1);
}
@@ -38,10 +38,10 @@ require_once INSTALLDIR . '/plugins/TwitterBridge/twitter.php';
* Settings for Twitter integration
*
* @category Settings
* @package Laconica
* @author Evan Prodromou <evan@controlyourself.ca>
* @package StatusNet
* @author Evan Prodromou <evan@status.net>
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://laconi.ca/
* @link http://status.net/
*
* @see SettingsAction
*/
@@ -75,7 +75,7 @@ class TwittersettingsAction extends ConnectSettingsAction
* Content area of the page
*
* Shows a form for associating a Twitter account with this
* Laconica account. Also lets the user set preferences.
* StatusNet account. Also lets the user set preferences.
*
* @return void
*/
@@ -160,7 +160,7 @@ class TwittersettingsAction extends ConnectSettingsAction
($flink->noticesync & FOREIGN_NOTICE_RECV) :
false);
$this->elementEnd('li');
} else {
// preserve setting even if bidrection bridge toggled off
if ($flink && ($flink->noticesync & FOREIGN_NOTICE_RECV)) {

View File

@@ -1,6 +1,6 @@
<?php
/**
* Laconica, the distributed open-source microblogging tool
* StatusNet, the distributed open-source microblogging tool
*
* Plugin to show WikiHashtags content in the sidebar
*
@@ -20,14 +20,14 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @category Plugin
* @package Laconica
* @author Evan Prodromou <evan@controlyourself.ca>
* @copyright 2008 Control Yourself, Inc.
* @package StatusNet
* @author Evan Prodromou <evan@status.net>
* @copyright 2008 StatusNet, Inc.
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://laconi.ca/
* @link http://status.net/
*/
if (!defined('LACONICA')) {
if (!defined('STATUSNET')) {
exit(1);
}
@@ -37,10 +37,10 @@ define('WIKIHASHTAGSPLUGIN_VERSION', '0.1');
* Plugin to use WikiHashtags
*
* @category Plugin
* @package Laconica
* @author Evan Prodromou <evan@controlyourself.ca>
* @package StatusNet
* @author Evan Prodromou <evan@status.net>
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://laconi.ca/
* @link http://status.net/
*
* @see Event
*/
@@ -104,6 +104,6 @@ class WikiHashtagsPlugin extends Plugin
function userAgent()
{
return 'WikiHashtagsPlugin/'.WIKIHASHTAGSPLUGIN_VERSION .
' Laconica/' . LACONICA_VERSION;
' StatusNet/' . STATUSNET_VERSION;
}
}

View File

@@ -1,4 +1,4 @@
Laconica reCAPTCHA plugin 0.2 8/3/09
StatusNet reCAPTCHA plugin 0.2 8/3/09
====================================
Adds a captcha to your registration page to reduce automated spam bots registering.

View File

@@ -1,6 +1,6 @@
<?php
/**
* Laconica, the distributed open-source microblogging tool
* StatusNet, the distributed open-source microblogging tool
*
* Plugin to show reCaptcha when a user registers
*
@@ -20,14 +20,14 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @category Plugin
* @package Laconica
* @package StatusNet
* @author Eric Helgeson <erichelgeson@gmail.com>
* @copyright 2009
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://laconi.ca/
* @link http://status.net/
*/
if (!defined('LACONICA')) {
if (!defined('STATUSNET') && !defined('LACONICA')) {
exit(1);
}