summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Denhardt <ian@zenhack.net>2010-08-13 18:01:33 -0400
committerIan Denhardt <ian@zenhack.net>2010-08-13 18:01:33 -0400
commit70c3532996b4239880607e705ffb4e9f9aaa692a (patch)
tree84ec2edd51de37e7c5922e6f1e573ec8ed55cb42
parentb1c5cb9db99993fcea7c060bffa6d5d50f22a41f (diff)
parent341b935acc0111bc2bfa69be5687c4e6f255d8ce (diff)
Merge branch '1.0.x' of git://gitorious.org/statusnet/mainline
-rw-r--r--README4
-rw-r--r--actions/newnotice.php2
-rw-r--r--classes/File_redirection.php8
-rw-r--r--classes/Notice.php2
-rw-r--r--lib/util.php5
-rw-r--r--plugins/EchoPlugin.php154
-rw-r--r--plugins/OStatus/actions/groupsalmon.php4
-rw-r--r--plugins/OStatus/actions/usersalmon.php12
-rw-r--r--plugins/OStatus/classes/Ostatus_profile.php43
-rw-r--r--plugins/OStatus/lib/discoveryhints.php5
-rw-r--r--plugins/OStatus/lib/feeddiscovery.php5
-rw-r--r--plugins/OStatus/lib/salmonaction.php20
-rw-r--r--plugins/SubMirror/actions/basemirror.php8
-rwxr-xr-xscripts/update_po_templates.php8
14 files changed, 233 insertions, 47 deletions
diff --git a/README b/README
index f2a2d2c51..393008f5d 100644
--- a/README
+++ b/README
@@ -43,6 +43,10 @@ on status.net is identical to the software available for download, so
you can move back and forth between a hosted version or a version
installed on your own servers.
+A commercial software subscription is available from StatusNet Inc. It
+includes 24-hour technical support and developer support. More
+information at http://status.net/contact or email sales@status.net.
+
License
=======
diff --git a/actions/newnotice.php b/actions/newnotice.php
index 8f1fb1c40..61b38786b 100644
--- a/actions/newnotice.php
+++ b/actions/newnotice.php
@@ -161,7 +161,7 @@ class NewnoticeAction extends Action
$replyto = intval($this->trimmed('inreplyto'));
if ($replyto) {
- $options['replyto'] = $replyto;
+ $options['reply_to'] = $replyto;
}
$upload = null;
diff --git a/classes/File_redirection.php b/classes/File_redirection.php
index 00ec75309..6a86197d9 100644
--- a/classes/File_redirection.php
+++ b/classes/File_redirection.php
@@ -240,6 +240,14 @@ class File_redirection extends Memcached_DataObject
} else if (is_string($redir_data)) {
// The file is a known redirect target.
$file = File::staticGet('url', $redir_data);
+ if (empty($file)) {
+ // @fixme should we save a new one?
+ // this case was triggering sometimes for redirects
+ // with unresolvable targets; found while fixing
+ // "can't linkify" bugs with shortened links to
+ // SSL sites with cert issues.
+ return null;
+ }
$file_id = $file->id;
}
} else {
diff --git a/classes/Notice.php b/classes/Notice.php
index 0eeebfadf..fe014b942 100644
--- a/classes/Notice.php
+++ b/classes/Notice.php
@@ -245,6 +245,8 @@ class Notice extends Memcached_DataObject
if (!empty($options)) {
$options = $options + $defaults;
extract($options);
+ } else {
+ extract($defaults);
}
if (!isset($is_local)) {
diff --git a/lib/util.php b/lib/util.php
index 8eff4e568..f187926b5 100644
--- a/lib/util.php
+++ b/lib/util.php
@@ -845,7 +845,10 @@ function common_linkify($url) {
} elseif (is_string($longurl_data)) {
$longurl = $longurl_data;
} else {
- throw new ServerException("Can't linkify url '$url'");
+ // Unable to reach the server to verify contents, etc
+ // Just pass the link on through for now.
+ common_log(LOG_ERR, "Can't linkify url '$url'");
+ $longurl = $url;
}
}
$attrs = array('href' => $canon, 'title' => $longurl, 'rel' => 'external');
diff --git a/plugins/EchoPlugin.php b/plugins/EchoPlugin.php
new file mode 100644
index 000000000..2ebfbceb3
--- /dev/null
+++ b/plugins/EchoPlugin.php
@@ -0,0 +1,154 @@
+<?php
+/**
+ * StatusNet, the distributed open-source microblogging tool
+ *
+ * Plugin to add Echo/JS-Kit commenting to notice pages
+ *
+ * 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 Zach Copley <zach@status.net>
+ * @copyright 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/
+ */
+
+if (!defined('STATUSNET')) {
+ exit(1);
+}
+
+/**
+ * Plugin to use Echo (formerly JS-Kit)
+ *
+ * This plugin adds an Echo commenting widget to each notice page on
+ * your site. To get it to work, first you'll have to sign up for Echo
+ * (a commercial service) and register your site's URL.
+ *
+ * http://aboutecho.com/
+ *
+ * Once you've done that it's pretty straight forward to turn the
+ * plugin on, just add:
+ *
+ * addPlugin('Echo');
+ *
+ * to your config.php. The defaults should work OK with the default
+ * theme, but there are a lot of options to customize the look and
+ * feel of the comment widget. You can control both the CSS for the
+ * div that contains the widget, as well as the CSS for the widget
+ * itself via config parameters that can be passed into the plugin.
+ * See below for a more complex example:
+ *
+ * // Custom stylesheet for Echo commenting widget
+ * // See: http://wiki.js-kit.com/Skinning-Guide#UsingCSSnbsptocustomizefontsandcolors
+ * $stylesheet = <<<ENDOFCSS
+ * .js-CommentsArea { width: 400px; }
+ * .jsk-HeaderWrapper { display: none; }
+ * .jsk-ItemUserAvatar { display: none; }
+ * .jsk-ItemBody { margin-left: -48px; }
+ * .js-kit-avatars-wrapper { display: none; }
+ * .js-kit-nonLoggedUserInfo { margin-left: -75px; }
+ * .js-singleViaLinkWrapper { display: none; }
+ * .js-CommentsSkin-echo div.jsk-ThreadWrapper { padding: 0px; }
+ * .js-singleCommentAdminStar { display: none !important; }
+ * .js-singleCommentName { margin-right: 1em; }
+ * .js-kit-miniProfile { background-color:#FFFFFF; }
+ * .jskit-MenuContainer { background-color:#FFFFFF; }
+ * .jskit-MenuItemMO { background-color: #EDEDED; }
+ * .jsk-CommentFormButton { display: none; }
+ * .js-singleCommentReplyable { display: none; }
+ * .jsk-CommentFormSurface { display: none; }
+ * .js-kit-tab-follow { display: none; }
+ * ENDOFCSS;
+ *
+ * addPlugin(
+ * 'Echo',
+ * array
+ * (
+ * // div_css is the css for the div containing the comment widget
+ * 'div_css' => 'width:675px; padding-top:10px; position:relative; float:left;',
+ * // stylesheet is the CSS for the comment widget itself
+ * 'stylesheet' => $stylesheet
+ * )
+ * );
+ *
+ * @category Plugin
+ * @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://status.net/
+ *
+ * @see Event
+ */
+
+class EchoPlugin extends Plugin
+{
+ // NOTE: The Echo documentation says that this script will change on
+ // a per site basis, but I think that's incorrect. It always seems to
+ // be the same.
+ public $script = 'http://cdn.js-kit.com/scripts/comments.js';
+
+ function onEndShowScripts($action)
+ {
+ if (get_class($action) == 'ShownoticeAction') {
+ $action->script($this->script);
+ }
+
+ return true;
+ }
+
+ function onEndShowContentBlock($action)
+ {
+ if (get_class($action) == 'ShownoticeAction') {
+
+ $attrs = array();
+ $attrs['class'] = 'js-kit-comments';
+ $attrs['permalink'] = $action->notice->uri;
+ $attrs['uniq'] = $action->notice->id;
+
+ // NOTE: there are some other attributes that could be useful
+ // http://wiki.js-kit.com/Echo-Behavior
+
+ if (empty($this->div_css)) {
+ // This CSS seems to work OK with the default theme
+ $attrs['style'] = 'width:675px; padding-top:10px; position:relative; float:left;';
+ } else {
+ $attrs['style'] = $this->css;
+ }
+
+ $action->element('div', $attrs, null);
+ }
+ }
+
+ function onEndShowStyles($action)
+ {
+ if (get_class($action) == 'ShownoticeAction' && !empty($this->stylesheet)) {
+ $action->style($this->stylesheet);
+ }
+ }
+
+ function onPluginVersion(&$versions)
+ {
+ $versions[] = array('name' => 'Echo',
+ 'version' => STATUSNET_VERSION,
+ 'author' => 'Zach Copley',
+ 'homepage' => 'http://status.net/wiki/Plugin:Echo',
+ 'rawdescription' =>
+ _m('Use <a href="http://aboutecho.com/">Echo</a>'.
+ ' to add commenting to notice pages.'));
+ return true;
+ }
+}
diff --git a/plugins/OStatus/actions/groupsalmon.php b/plugins/OStatus/actions/groupsalmon.php
index d60725a71..5094dccf0 100644
--- a/plugins/OStatus/actions/groupsalmon.php
+++ b/plugins/OStatus/actions/groupsalmon.php
@@ -61,7 +61,7 @@ class GroupsalmonAction extends SalmonAction
function handlePost()
{
// @fixme process all objects?
- switch ($this->act->objects[0]->type) {
+ switch ($this->activity->objects[0]->type) {
case ActivityObject::ARTICLE:
case ActivityObject::BLOGENTRY:
case ActivityObject::NOTE:
@@ -74,7 +74,7 @@ class GroupsalmonAction extends SalmonAction
// Notice must be to the attention of this group
- $context = $this->act->context;
+ $context = $this->activity->context;
if (empty($context->attention)) {
throw new ClientException("Not to the attention of anyone.");
diff --git a/plugins/OStatus/actions/usersalmon.php b/plugins/OStatus/actions/usersalmon.php
index 6c360c49f..641e131ab 100644
--- a/plugins/OStatus/actions/usersalmon.php
+++ b/plugins/OStatus/actions/usersalmon.php
@@ -55,10 +55,10 @@ class UsersalmonAction extends SalmonAction
*/
function handlePost()
{
- common_log(LOG_INFO, "Received post of '{$this->act->objects[0]->id}' from '{$this->act->actor->id}'");
+ common_log(LOG_INFO, "Received post of '{$this->activity->objects[0]->id}' from '{$this->activity->actor->id}'");
// @fixme: process all activity objects?
- switch ($this->act->objects[0]->type) {
+ switch ($this->activity->objects[0]->type) {
case ActivityObject::ARTICLE:
case ActivityObject::BLOGENTRY:
case ActivityObject::NOTE:
@@ -72,7 +72,7 @@ class UsersalmonAction extends SalmonAction
// Notice must either be a) in reply to a notice by this user
// or b) to the attention of this user
- $context = $this->act->context;
+ $context = $this->activity->context;
if (!empty($context->replyToID)) {
$notice = Notice::staticGet('uri', $context->replyToID);
@@ -92,7 +92,7 @@ class UsersalmonAction extends SalmonAction
throw new ClientException("Not to anyone in reply to anything!");
}
- $existing = Notice::staticGet('uri', $this->act->objects[0]->id);
+ $existing = Notice::staticGet('uri', $this->activity->objects[0]->id);
if (!empty($existing)) {
common_log(LOG_ERR, "Not saving notice '{$existing->uri}'; already exists.");
@@ -143,7 +143,7 @@ class UsersalmonAction extends SalmonAction
function handleFavorite()
{
- $notice = $this->getNotice($this->act->objects[0]);
+ $notice = $this->getNotice($this->activity->objects[0]);
$profile = $this->ensureProfile()->localProfile();
$old = Fave::pkeyGet(array('user_id' => $profile->id,
@@ -164,7 +164,7 @@ class UsersalmonAction extends SalmonAction
*/
function handleUnfavorite()
{
- $notice = $this->getNotice($this->act->objects[0]);
+ $notice = $this->getNotice($this->activity->objects[0]);
$profile = $this->ensureProfile()->localProfile();
$fave = Fave::pkeyGet(array('user_id' => $profile->id,
diff --git a/plugins/OStatus/classes/Ostatus_profile.php b/plugins/OStatus/classes/Ostatus_profile.php
index 8f8eb773f..cc4307b14 100644
--- a/plugins/OStatus/classes/Ostatus_profile.php
+++ b/plugins/OStatus/classes/Ostatus_profile.php
@@ -445,26 +445,32 @@ class Ostatus_profile extends Memcached_DataObject
* @param DOMElement $feed for context
* @param string $source identifier ("push" or "salmon")
*/
+
public function processEntry($entry, $feed, $source)
{
$activity = new Activity($entry, $feed);
- // @todo process all activity objects
- switch ($activity->objects[0]->type) {
- case ActivityObject::ARTICLE:
- case ActivityObject::BLOGENTRY:
- case ActivityObject::NOTE:
- case ActivityObject::STATUS:
- case ActivityObject::COMMENT:
- break;
- default:
- throw new ClientException("Can't handle that kind of post.");
- }
+ if (Event::handle('StartHandleFeedEntry', array($activity))) {
+
+ // @todo process all activity objects
+ switch ($activity->objects[0]->type) {
+ case ActivityObject::ARTICLE:
+ case ActivityObject::BLOGENTRY:
+ case ActivityObject::NOTE:
+ case ActivityObject::STATUS:
+ case ActivityObject::COMMENT:
+ case null:
+ if ($activity->verb == ActivityVerb::POST) {
+ $this->processPost($activity, $source);
+ } else {
+ common_log(LOG_INFO, "Ignoring activity with unrecognized verb $activity->verb");
+ }
+ break;
+ default:
+ throw new ClientException("Can't handle that kind of post.");
+ }
- if ($activity->verb == ActivityVerb::POST) {
- $this->processPost($activity, $source);
- } else {
- common_log(LOG_INFO, "Ignoring activity with unrecognized verb $activity->verb");
+ Event::handle('EndHandleFeedEntry', array($activity));
}
}
@@ -496,8 +502,11 @@ class Ostatus_profile extends Memcached_DataObject
} else if ($actor->id) {
// We have an ActivityStreams actor with an explicit ID that doesn't match the feed owner.
// This isn't what we expect from mainline OStatus person feeds!
- // Group feeds go down another path, with different validation.
- throw new Exception("Got an actor '{$actor->title}' ({$actor->id}) on single-user feed for {$this->uri}");
+ // Group feeds go down another path, with different validation...
+ // Most likely this is a plain ol' blog feed of some kind which
+ // doesn't match our expectations. We'll take the entry, but ignore
+ // the <author> info.
+ common_log(LOG_WARNING, "Got an actor '{$actor->title}' ({$actor->id}) on single-user feed for {$this->uri}");
} else {
// Plain <author> without ActivityStreams actor info.
// We'll just ignore this info for now and save the update under the feed's identity.
diff --git a/plugins/OStatus/lib/discoveryhints.php b/plugins/OStatus/lib/discoveryhints.php
index 34c9be277..fa2ead732 100644
--- a/plugins/OStatus/lib/discoveryhints.php
+++ b/plugins/OStatus/lib/discoveryhints.php
@@ -114,9 +114,10 @@ class DiscoveryHints {
static function _hcard($body, $url)
{
- // DOMDocument::loadHTML may throw warnings on unrecognized elements.
+ // DOMDocument::loadHTML may throw warnings on unrecognized elements,
+ // and notices on unrecognized namespaces.
- $old = error_reporting(error_reporting() & ~E_WARNING);
+ $old = error_reporting(error_reporting() & ~(E_WARNING | E_NOTICE));
$doc = new DOMDocument();
$doc->loadHTML($body);
diff --git a/plugins/OStatus/lib/feeddiscovery.php b/plugins/OStatus/lib/feeddiscovery.php
index a55399d7c..8a166a0be 100644
--- a/plugins/OStatus/lib/feeddiscovery.php
+++ b/plugins/OStatus/lib/feeddiscovery.php
@@ -196,8 +196,9 @@ class FeedDiscovery
*/
function discoverFromHTML($url, $body)
{
- // DOMDocument::loadHTML may throw warnings on unrecognized elements.
- $old = error_reporting(error_reporting() & ~E_WARNING);
+ // DOMDocument::loadHTML may throw warnings on unrecognized elements,
+ // and notices on unrecognized namespaces.
+ $old = error_reporting(error_reporting() & ~(E_WARNING | E_NOTICE));
$dom = new DOMDocument();
$ok = $dom->loadHTML($body);
error_reporting($old);
diff --git a/plugins/OStatus/lib/salmonaction.php b/plugins/OStatus/lib/salmonaction.php
index fa9dc3b1d..9d6c6b269 100644
--- a/plugins/OStatus/lib/salmonaction.php
+++ b/plugins/OStatus/lib/salmonaction.php
@@ -47,7 +47,6 @@ class SalmonAction extends Action
$xml = file_get_contents('php://input');
-
// Check the signature
$salmon = new Salmon;
if (!$salmon->verifyMagicEnv($xml)) {
@@ -58,7 +57,6 @@ class SalmonAction extends Action
$env = $magic_env->parse($xml);
$xml = $magic_env->unfold($env);
}
-
$dom = DOMDocument::loadXML($xml);
if ($dom->documentElement->namespaceURI != Activity::ATOM ||
@@ -67,7 +65,7 @@ class SalmonAction extends Action
$this->clientError(_m('Salmon post must be an Atom entry.'));
}
- $this->act = new Activity($dom->documentElement);
+ $this->activity = new Activity($dom->documentElement);
return true;
}
@@ -79,9 +77,9 @@ class SalmonAction extends Action
{
StatusNet::setApi(true); // Send smaller error pages
- common_log(LOG_DEBUG, "Got a " . $this->act->verb);
+ common_log(LOG_DEBUG, "Got a " . $this->activity->verb);
if (Event::handle('StartHandleSalmon', array($this->activity))) {
- switch ($this->act->verb)
+ switch ($this->activity->verb)
{
case ActivityVerb::POST:
$this->handlePost();
@@ -164,12 +162,12 @@ class SalmonAction extends Action
*/
function handleUpdateProfile()
{
- $oprofile = Ostatus_profile::getActorProfile($this->act);
+ $oprofile = Ostatus_profile::getActorProfile($this->activity);
if ($oprofile) {
common_log(LOG_INFO, "Got a profile-update ping from $oprofile->uri");
- $oprofile->updateFromActivityObject($this->act->actor);
+ $oprofile->updateFromActivityObject($this->activity->actor);
} else {
- common_log(LOG_INFO, "Ignoring profile-update ping from unknown " . $this->act->actor->id);
+ common_log(LOG_INFO, "Ignoring profile-update ping from unknown " . $this->activity->actor->id);
}
}
@@ -178,10 +176,10 @@ class SalmonAction extends Action
*/
function ensureProfile()
{
- $actor = $this->act->actor;
+ $actor = $this->activity->actor;
if (empty($actor->id)) {
common_log(LOG_ERR, "broken actor: " . var_export($actor, true));
- common_log(LOG_ERR, "activity with no actor: " . var_export($this->act, true));
+ common_log(LOG_ERR, "activity with no actor: " . var_export($this->activity, true));
throw new Exception("Received a salmon slap from unidentified actor.");
}
@@ -191,6 +189,6 @@ class SalmonAction extends Action
function saveNotice()
{
$oprofile = $this->ensureProfile();
- return $oprofile->processPost($this->act, 'salmon');
+ return $oprofile->processPost($this->activity, 'salmon');
}
}
diff --git a/plugins/SubMirror/actions/basemirror.php b/plugins/SubMirror/actions/basemirror.php
index 5be0699f0..be6942efa 100644
--- a/plugins/SubMirror/actions/basemirror.php
+++ b/plugins/SubMirror/actions/basemirror.php
@@ -92,7 +92,13 @@ abstract class BaseMirrorAction extends Action
*/
protected function profileForFeed($url)
{
- $oprofile = Ostatus_profile::ensureProfileURL($url);
+ try {
+ // Maybe we got a web page?
+ $oprofile = Ostatus_profile::ensureProfileURL($url);
+ } catch (Exception $e) {
+ // Direct feed URL?
+ $oprofile = Ostatus_profile::ensureFeedURL($url);
+ }
if ($oprofile->isGroup()) {
$this->clientError(_m("Can't mirror a StatusNet group at this time."));
}
diff --git a/scripts/update_po_templates.php b/scripts/update_po_templates.php
index af9ed8d20..f10f20842 100755
--- a/scripts/update_po_templates.php
+++ b/scripts/update_po_templates.php
@@ -94,15 +94,15 @@ function do_translatewiki_plugin($basedir, $plugin)
BASIC:
id: out-statusnet-{$pluginlc}
label: StatusNet - {$plugin}
- description: "{{int:bw-desc-statusnet-plugin-{$pluginlc}}}"
namespace: NS_STATUSNET
+ description: "{{int:bw-desc-statusnet-plugin}}"
+ class: FileBasedMessageGroup
display: out/statusnet/{$pluginlc}
- class: GettextMessageGroup
FILES:
class: GettextFFS
- sourcePattern: %GROUPROOT%/plugins/{$plugin}/locale/%CODE%/LC_MESSAGES/{$plugin}.po
- targetPattern: plugins/{$plugin}/locale/%CODE%/LC_MESSAGES/{$plugin}.po
+ sourcePattern: %GROUPROOT%/statusnet/plugins/{$plugin}/locale/{$plugin}.pot
+ targetPattern: statusnet/plugins/{$plugin}/locale/%CODE%/LC_MESSAGES/{$plugin}.po
codeMap:
en-gb: en_GB
no: nb