forked from GNUsocial/gnu-social
Merge branch 'testing' of gitorious.org:statusnet/mainline into testing
* 'testing' of gitorious.org:statusnet/mainline: Merge StatusNet core localization updates from 0.9.x branch Fix update_po_templates.php to support the plural and context variants of _m() in plugins Drop HTMLPurifier; we don't need its extra capabilities and we're already using htmLawed which is lighter-weight. OStatus: handle update-profile Salmon pings Revert "Updated jQuery Form Plugin from v2.17 to v2.36" OStatus: disable HTMLPurify cache unless we've configured a writable path for it.
This commit is contained in:
@@ -2,23 +2,33 @@ Plugin to support importing updates from external RSS and Atom feeds into your t
|
||||
|
||||
Uses PubSubHubbub for push feed updates; currently non-PuSH feeds cannot be subscribed.
|
||||
|
||||
Configuration options available:
|
||||
|
||||
$config['ostatus']['hub']
|
||||
(default internal hub)
|
||||
Set to URL of an external PuSH hub to use it instead of our internal hub.
|
||||
|
||||
$config['ostatus']['hub_retries']
|
||||
(default 0)
|
||||
Number of times to retry a PuSH send to consumers if using internal hub
|
||||
|
||||
|
||||
For testing, shouldn't be used in production:
|
||||
|
||||
$config['ostatus']['skip_signatures']
|
||||
(default use signatures)
|
||||
Disable generation and validation of Salmon magicenv signatures
|
||||
|
||||
$config['feedsub']['nohub']
|
||||
(default require hub)
|
||||
Allow low-level feed subscription setup for feeds without hubs.
|
||||
Not actually usable at this stage, OStatus will check for hubs too
|
||||
and we have no polling backend.
|
||||
|
||||
|
||||
Todo:
|
||||
* set feed icon avatar for actual profiles as well as for preview
|
||||
* use channel image and/or favicon for avatar?
|
||||
* garbage-collect subscriptions that are no longer being used
|
||||
* administrative way to kill feeds?
|
||||
* functional l10n
|
||||
* clean up subscription form look and workflow
|
||||
* use ajax for test/preview in subscription form
|
||||
* rssCloud support? (Does anything use it that doesn't support PuSH as well?)
|
||||
* possibly a polling daemon to support non-PuSH feeds?
|
||||
* likely problems with multiple feeds from the same site, such as category feeds on a blog
|
||||
(currently each feed would publish a separate notice on a separate profile, but pointing to the same post URI.)
|
||||
(could use the local URI I guess, but that's so icky!)
|
||||
* problems with Atom feeds that list <link rel="alternate" href="..."/> but don't have the type
|
||||
(such as http://atomgen.appspot.com/feed/5 demo feed); currently it's not recognized and we end up with the feed's master URI
|
||||
* make it easier to see what you're subscribed to and unsub from things
|
||||
* saner treatment of fullname/nickname?
|
||||
* fully functional l10n
|
||||
* redo non-OStatus feed support
|
||||
** rssCloud support?
|
||||
** possibly a polling daemon to support non-PuSH feeds?
|
||||
* make use of tags/categories from feeds
|
||||
* update feed profile data when it changes
|
||||
* XML_Feed_Parser has major problems with category and link tags; consider replacing?
|
||||
|
@@ -668,10 +668,9 @@ class Ostatus_profile extends Memcached_DataObject
|
||||
*/
|
||||
protected function purify($html)
|
||||
{
|
||||
// @fixme disable caching or set a sane temp dir
|
||||
require_once(INSTALLDIR.'/extlib/HTMLPurifier/HTMLPurifier.auto.php');
|
||||
$purifier = new HTMLPurifier();
|
||||
return $purifier->purify($html);
|
||||
require_once INSTALLDIR.'/extlib/htmLawed/htmLawed.php';
|
||||
$config = array('safe' => 1);
|
||||
return htmLawed($html, $config);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -953,7 +952,7 @@ class Ostatus_profile extends Memcached_DataObject
|
||||
* @param Activity $activity
|
||||
* @return mixed matching Ostatus_profile or false if none known
|
||||
*/
|
||||
protected static function getActorProfile($activity)
|
||||
public static function getActorProfile($activity)
|
||||
{
|
||||
return self::getActivityObjectProfile($activity->actor);
|
||||
}
|
||||
@@ -1091,7 +1090,7 @@ class Ostatus_profile extends Memcached_DataObject
|
||||
* @param ActivityObject $object
|
||||
* @param array $hints
|
||||
*/
|
||||
protected function updateFromActivityObject($object, $hints=array())
|
||||
public function updateFromActivityObject($object, $hints=array())
|
||||
{
|
||||
if ($this->isGroup()) {
|
||||
$group = $this->localGroup();
|
||||
|
@@ -38,11 +38,11 @@ class SalmonAction extends Action
|
||||
parent::prepare($args);
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] != 'POST') {
|
||||
$this->clientError(_('This method requires a POST.'));
|
||||
$this->clientError(_m('This method requires a POST.'));
|
||||
}
|
||||
|
||||
if (empty($_SERVER['CONTENT_TYPE']) || $_SERVER['CONTENT_TYPE'] != 'application/atom+xml') {
|
||||
$this->clientError(_('Salmon requires application/atom+xml'));
|
||||
$this->clientError(_m('Salmon requires application/atom+xml'));
|
||||
}
|
||||
|
||||
$xml = file_get_contents('php://input');
|
||||
@@ -76,8 +76,7 @@ class SalmonAction extends Action
|
||||
{
|
||||
StatusNet::setApi(true); // Send smaller error pages
|
||||
|
||||
// TODO : Insert new $xml -> notice code
|
||||
|
||||
common_log(LOG_DEBUG, "Got a " . $this->act->verb);
|
||||
if (Event::handle('StartHandleSalmon', array($this->activity))) {
|
||||
switch ($this->act->verb)
|
||||
{
|
||||
@@ -106,8 +105,11 @@ class SalmonAction extends Action
|
||||
case ActivityVerb::LEAVE:
|
||||
$this->handleLeave();
|
||||
break;
|
||||
case ActivityVerb::UPDATE_PROFILE:
|
||||
$this->handleUpdateProfile();
|
||||
break;
|
||||
default:
|
||||
throw new ClientException(_("Unimplemented."));
|
||||
throw new ClientException(_m("Unrecognized activity type."));
|
||||
}
|
||||
Event::handle('EndHandleSalmon', array($this->activity));
|
||||
}
|
||||
@@ -115,56 +117,57 @@ class SalmonAction extends Action
|
||||
|
||||
function handlePost()
|
||||
{
|
||||
throw new ClientException(_("Unimplemented!"));
|
||||
throw new ClientException(_m("This target doesn't understand posts."));
|
||||
}
|
||||
|
||||
function handleFollow()
|
||||
{
|
||||
throw new ClientException(_("Unimplemented!"));
|
||||
throw new ClientException(_m("This target doesn't understand follows."));
|
||||
}
|
||||
|
||||
function handleUnfollow()
|
||||
{
|
||||
throw new ClientException(_("Unimplemented!"));
|
||||
throw new ClientException(_m("This target doesn't understand unfollows."));
|
||||
}
|
||||
|
||||
function handleFavorite()
|
||||
{
|
||||
throw new ClientException(_("Unimplemented!"));
|
||||
throw new ClientException(_m("This target doesn't understand favorites."));
|
||||
}
|
||||
|
||||
/**
|
||||
* Remote user doesn't like one of our posts after all!
|
||||
* Confirm the post is ours, and delete a local favorite event.
|
||||
*/
|
||||
|
||||
function handleUnfavorite()
|
||||
{
|
||||
throw new ClientException(_("Unimplemented!"));
|
||||
throw new ClientException(_m("This target doesn't understand unfavorites."));
|
||||
}
|
||||
|
||||
/**
|
||||
* Hmmmm
|
||||
*/
|
||||
function handleShare()
|
||||
{
|
||||
throw new ClientException(_("Unimplemented!"));
|
||||
throw new ClientException(_m("This target doesn't understand share events."));
|
||||
}
|
||||
|
||||
/**
|
||||
* Hmmmm
|
||||
*/
|
||||
function handleJoin()
|
||||
{
|
||||
throw new ClientException(_("Unimplemented!"));
|
||||
throw new ClientException(_m("This target doesn't understand joins."));
|
||||
}
|
||||
|
||||
function handleLeave()
|
||||
{
|
||||
throw new ClientException(_m("This target doesn't understand leave events."));
|
||||
}
|
||||
|
||||
/**
|
||||
* Hmmmm
|
||||
* Remote user sent us an update to their profile.
|
||||
* If we already know them, accept the updates.
|
||||
*/
|
||||
function handleLeave()
|
||||
function handleUpdateProfile()
|
||||
{
|
||||
throw new ClientException(_("Unimplemented!"));
|
||||
$oprofile = Ostatus_profile::getActorProfile($this->act);
|
||||
if ($oprofile) {
|
||||
common_log(LOG_INFO, "Got a profile-update ping from $oprofile->uri");
|
||||
$oprofile->updateFromActivityObject($this->act->actor);
|
||||
} else {
|
||||
common_log(LOG_INFO, "Ignoring profile-update ping from unknown " . $this->act->actor->id);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user