]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Merge branch '0.9.x' into schema
authorEvan Prodromou <evan@status.net>
Thu, 1 Oct 2009 15:30:04 +0000 (11:30 -0400)
committerEvan Prodromou <evan@status.net>
Thu, 1 Oct 2009 15:30:04 +0000 (11:30 -0400)
71 files changed:
EVENTS.txt
actions/allrss.php
actions/api.php
actions/avatarsettings.php
actions/deletenotice.php
actions/editgroup.php
actions/favoritesrss.php
actions/foafgroup.php [new file with mode: 0644]
actions/grouprss.php
actions/newnotice.php
actions/publicrss.php
actions/repliesrss.php
actions/showgroup.php
actions/showstream.php
actions/twitapigroups.php
actions/twitapistatuses.php
actions/userrss.php
classes/File.php
classes/File_redirection.php
classes/Notice.php
classes/User.php
db/sms_carrier.sql
doc-src/bookmarklet
doc-src/im
extlib/Auth/OpenID/BigMath.php
extlib/Auth/Yadis/XML.php
extlib/OAuth.php
extlib/PEAR.php
index.php
install.php
lib/action.php
lib/clienterroraction.php
lib/common.php
lib/default.php [new file with mode: 0644]
lib/deleteaction.php [deleted file]
lib/designsettings.php
lib/error.php
lib/facebookaction.php
lib/htmloutputter.php
lib/mail.php
lib/noticeform.php
lib/noticelist.php
lib/oauthstore.php
lib/right.php [new file with mode: 0644]
lib/router.php
lib/rssaction.php
lib/servererroraction.php
lib/twitterapi.php
lib/util.php
plugins/Autocomplete/Autocomplete.js
plugins/Autocomplete/AutocompletePlugin.php
plugins/Autocomplete/autocomplete.php [new file with mode: 0644]
plugins/Autocomplete/readme.txt
plugins/InfiniteScroll/InfiniteScrollPlugin.php
plugins/InfiniteScroll/infinitescroll.js
plugins/InfiniteScroll/jquery.infinitescroll.js
plugins/Meteor/meteorupdater.js
plugins/PiwikAnalyticsPlugin.php
plugins/PubSubHubBub/PubSubHubBubPlugin.php
plugins/Realtime/RealtimePlugin.php
plugins/Realtime/icon_external.gif [new file with mode: 0644]
plugins/Realtime/realtimeupdate.js
plugins/recaptcha/README
scripts/createsim.php
scripts/maildaemon.php
scripts/xmppdaemon.php
tests/HashTagDetectionTests.php
tests/URLDetectionTest.php
tests/UserRightsTest.php [new file with mode: 0644]
theme/base/css/display.css
theme/cloudy/css/display.css

index 2b16d43c07ef9fff852035782e3b9049a6ab839e..e0d4bbd06107d591dd2d66c286ba73ba6f8d9395 100644 (file)
@@ -87,6 +87,12 @@ StartShowContentBlock: Showing before the content container
 EndShowContentBlock: Showing after the content container
 - $action: the current action
 
+StartShowAside: Showing before the Aside container
+- $action: the current action
+
+EndShowAside: Showing after the Aside container
+- $action: the current action
+
 StartNoticeSave: before inserting a notice (good place for content filters)
 - $notice: notice being saved (no ID or URI)
 
@@ -170,12 +176,6 @@ StartShowBody: called before showing the <body> element and children
 EndShowBody: called after showing the <body> element (and </body>)
 - $action: action object being shown
 
-StartHeadChildren: called before showing the children of <head> element (after <head> tag)
-- $action: action object being shown
-
-EndHeadChildren: called after showing the children of <head> element (before </head>)
-- $action: action object being shown
-
 StartPersonalGroupNav: beginning of personal group nav menu
 - $action: action object being shown
 
@@ -200,6 +200,12 @@ StartShowExportData: just before showing the <div> with export data (feeds)
 EndShowExportData: just after showing the <div> with export data (feeds)
 - $action: action object being shown
 
+StartShowNoticeItem: just before showing the notice item
+- $action: action object being shown
+
+EndShowNoticeItem: just after showing the notice item
+- $action: action object being shown
+
 StartShowPageNotice: just before showing the page notice (instructions or error)
 - $action: action object being shown
 
@@ -271,3 +277,9 @@ GetValidDaemons: Just before determining which daemons to run
 
 HandleQueuedNotice: Handle a queued notice at queue time (or immediately if no queue)
 - &$notice: notice to handle
+
+StartShowHeadElements: Right after the <head> tag
+- $action: the current action
+
+EndShowHeadElements: Right before the </head> tag; put <script>s here if you need them in <head>
+- $action: the current action
index 57efb73f0e85275df28109accaabd2aae2cc110a..28b1be27d82a254d82bebca9943138576b9e3927 100644 (file)
@@ -68,6 +68,7 @@ class AllrssAction extends Rss10Action
             $this->clientError(_('No such user.'));
             return false;
         } else {
+            $this->notices = $this->getNotices($this->limit);
             return true;
         }
     }
index d570bb0174a093297f4fc2e6e903e32ccd2f224a..1bc90de1108cb2f385eb97c8ffbb145dc5e0d946 100644 (file)
@@ -160,6 +160,7 @@ class ApiAction extends Action
 
         static $bareauth = array('statuses/user_timeline',
                                  'statuses/friends_timeline',
+                                'statuses/home_timeline',
                                  'statuses/friends',
                                  'statuses/replies',
                                  'statuses/mentions',
index 02a684b38f2649c5e8d45a3d096114e631a8bf6d..ded419dd797a7c88d012a2b9b4a6ca6d0d4a9e25 100644 (file)
@@ -362,13 +362,13 @@ class AvatarsettingsAction extends AccountSettingsAction
         $profile = $user->getProfile();
         
         $avatar = $profile->getOriginalAvatar();
-        $avatar->delete();
+        if($avatar) $avatar->delete();
         $avatar = $profile->getAvatar(AVATAR_PROFILE_SIZE);
-        $avatar->delete();
+        if($avatar) $avatar->delete();
         $avatar = $profile->getAvatar(AVATAR_STREAM_SIZE);
-        $avatar->delete();
+        if($avatar) $avatar->delete();
         $avatar = $profile->getAvatar(AVATAR_MINI_SIZE);
-        $avatar->delete();
+        if($avatar) $avatar->delete();
 
         $this->showForm(_('Avatar deleted.'), true);
     }
index 3d040f2fa91ed7b7e736c5be7d744d61667aeaea..4a48a9c346cba2b9714e30184c65273d8ae56632 100644 (file)
@@ -32,15 +32,45 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
     exit(1);
 }
 
-require_once INSTALLDIR.'/lib/deleteaction.php';
-
-class DeletenoticeAction extends DeleteAction
+class DeletenoticeAction extends Action
 {
-    var $error = null;
+    var $error        = null;
+    var $user         = null;
+    var $notice       = null;
+    var $profile      = null;
+    var $user_profile = null;
+
+    function prepare($args)
+    {
+        parent::prepare($args);
+
+        $this->user   = common_current_user();
+        $notice_id    = $this->trimmed('notice');
+        $this->notice = Notice::staticGet($notice_id);
+
+        if (!$this->notice) {
+            common_user_error(_('No such notice.'));
+            exit;
+        }
+
+        $this->profile      = $this->notice->getProfile();
+        $this->user_profile = $this->user->getProfile();
+
+        return true;
+    }
 
     function handle($args)
     {
         parent::handle($args);
+
+        if (!common_logged_in()) {
+            common_user_error(_('Not logged in.'));
+            exit;
+        } else if ($this->notice->profile_id != $this->user_profile->id &&
+                   !$this->user->hasRight(Right::deleteOthersNotice)) {
+            common_user_error(_('Can\'t delete this notice.'));
+            exit;
+        }
         // XXX: Ajax!
 
         if ($_SERVER['REQUEST_METHOD'] == 'POST') {
index 0c2dc8bdf89ef027141d09d38ae1de434696bfc7..5dd039f8a30c3dc55d4d64f9994890e5e1bfe8c2 100644 (file)
@@ -250,7 +250,6 @@ class EditgroupAction extends GroupDesignAction
         $this->group->homepage    = $homepage;
         $this->group->description = $description;
         $this->group->location    = $location;
-        $this->group->created     = common_sql_now();
 
         $result = $this->group->update($orig);
 
index 2d5ce985416d9e9d83f32b9f9d1a55082d7f6ebe..62f06e841b193ddd2cb4f94fbb47a3c6c151050e 100644 (file)
@@ -50,11 +50,11 @@ require_once INSTALLDIR.'/lib/rssaction.php';
  */
 class FavoritesrssAction extends Rss10Action
 {
-    
+
     /** The user whose favorites to display */
-    
+
     var $user = null;
-        
+
     /**
      * Find the user to display by supplied nickname
      *
@@ -66,7 +66,7 @@ class FavoritesrssAction extends Rss10Action
     function prepare($args)
     {
         parent::prepare($args);
-        
+
         $nickname   = $this->trimmed('nickname');
         $this->user = User::staticGet('nickname', $nickname);
 
@@ -74,10 +74,11 @@ class FavoritesrssAction extends Rss10Action
             $this->clientError(_('No such user.'));
             return false;
         } else {
+            $this->notices = $this->getNotices($this->limit);
             return true;
         }
     }
-    
+
     /**
      * Get notices
      *
diff --git a/actions/foafgroup.php b/actions/foafgroup.php
new file mode 100644 (file)
index 0000000..f5fd7fe
--- /dev/null
@@ -0,0 +1,173 @@
+<?php
+/*
+ * 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
+ * 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  Mail
+ * @package   StatusNet
+ * @author    Evan Prodromou <evan@status.net>
+ * @author    Toby Inkster <mail@tobyinkster.co.uk>
+ * @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://status.net/
+ */
+
+if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); }
+
+class FoafGroupAction extends Action
+{
+    function isReadOnly($args)
+    {
+        return true;
+    }
+
+    function prepare($args)
+    {
+        parent::prepare($args);
+
+        $nickname_arg = $this->arg('nickname');
+
+        if (empty($nickname_arg)) {
+            $this->clientError(_('No such group.'), 404);
+            return false;
+        }
+
+        $this->nickname = common_canonical_nickname($nickname_arg);
+
+        // Permanent redirect on non-canonical nickname
+
+        if ($nickname_arg != $this->nickname) {
+            common_redirect(common_local_url('foafgroup',
+                                             array('nickname' => $this->nickname)),
+                            301);
+            return false;
+        }
+
+        $this->group = User_group::staticGet('nickname', $this->nickname);
+
+        if (!$this->group) {
+            $this->clientError(_('No such group.'), 404);
+            return false;
+        }
+
+        common_set_returnto($this->selfUrl());
+
+        return true;
+    }
+
+    function handle($args)
+    {
+        parent::handle($args);
+
+        header('Content-Type: application/rdf+xml');
+
+        $this->startXML();
+        $this->elementStart('rdf:RDF', array('xmlns:rdf' =>
+                                              'http://www.w3.org/1999/02/22-rdf-syntax-ns#',
+                                              'xmlns:dcterms' =>
+                                              'http://purl.org/dc/terms/',
+                                              'xmlns:sioc' =>
+                                              'http://rdfs.org/sioc/ns#',
+                                              'xmlns:foaf' =>
+                                              'http://xmlns.com/foaf/0.1/',
+                                              'xmlns:statusnet' =>
+                                              'http://status.net/ont/',
+                                              'xmlns' => 'http://xmlns.com/foaf/0.1/'));
+
+        $this->showPpd(common_local_url('foafgroup', array('nickname' => $this->nickname)), $this->group->permalink());
+
+        $this->elementStart('Group', array('rdf:about' =>
+                                             $this->group->permalink()));
+        if ($this->group->fullname) {
+            $this->element('name', null, $this->group->fullname);
+        }
+        if ($this->group->description) {
+            $this->element('dcterms:description', null, $this->group->description);
+        }
+        if ($this->group->nickname) {
+            $this->element('dcterms:identifier', null, $this->group->nickname);
+            $this->element('nick', null, $this->group->nickname);
+        }
+        foreach ($this->group->getAliases() as $alias) {
+            $this->element('nick', null, $alias);
+        }
+        if ($this->group->homeUrl()) {
+            $this->element('weblog', array('rdf:resource' => $this->group->homeUrl()));
+        }
+        if ($this->group->homepage) {
+            $this->element('page', array('rdf:resource' => $this->group->homepage));
+        }
+        if ($this->group->homepage_logo) {
+            $this->element('depiction', array('rdf:resource' => $this->group->homepage_logo));
+        }
+        
+        $members = $this->group->getMembers();
+        $member_details = array();
+        while ($members->fetch()) {
+            $member_uri = common_local_url('userbyid', array('id'=>$members->id));
+            $member_details[$member_uri] = array(
+                                        'nickname' => $members->nickname
+                                        );
+            $this->element('member', array('rdf:resource' => $member_uri));
+        }
+        
+        $admins = $this->group->getAdmins();
+        while ($admins->fetch()) {
+            $admin_uri = common_local_url('userbyid', array('id'=>$admins->id));
+            $member_details[$admin_uri]['is_admin'] = true;
+            $this->element('statusnet:groupAdmin', array('rdf:resource' => $admin_uri));
+        }
+
+        $this->elementEnd('Group');
+        
+        ksort($member_details);
+        foreach ($member_details as $uri => $details) {
+            if ($details['is_admin'])
+            {
+                $this->elementStart('Agent', array('rdf:about' => $uri));
+                $this->element('nick', null, $details['nickname']);
+                $this->elementStart('holdsAccount');
+                $this->elementStart('sioc:User', array('rdf:about'=>$uri.'#acct'));
+                $this->elementStart('sioc:has_function');
+                $this->elementStart('statusnet:GroupAdminRole');
+                $this->element('sioc:scope', array('rdf:resource' => $this->group->permalink()));
+                $this->elementEnd('statusnet:GroupAdminRole');
+                $this->elementEnd('sioc:has_function');
+                $this->elementEnd('sioc:User');
+                $this->elementEnd('holdsAccount');
+                $this->elementEnd('Agent');
+            }
+            else
+            {
+                $this->element('Agent', array(
+                                        'foaf:nick' => $details['nickname'],
+                                        'rdf:about' => $uri,
+                                        ));
+            }
+        }
+        
+        $this->elementEnd('rdf:RDF');
+        $this->endXML();
+    }
+
+    function showPpd($foaf_url, $person_uri)
+    {
+        $this->elementStart('Document', array('rdf:about' => $foaf_url));
+        $this->element('primaryTopic', array('rdf:resource' => $person_uri));
+        $this->elementEnd('Document');
+    }
+
+}
\ No newline at end of file
index 70c1ded488e89c46ff9397b5a3da65f27b30e923..6a6b55e78f73a98096a5f289ae5625e4ebde9583 100644 (file)
@@ -104,6 +104,7 @@ class groupRssAction extends Rss10Action
             return false;
         }
 
+        $this->notices = $this->getNotices($this->limit);
         return true;
     }
 
index 4c6372c2bb96eac658aa94be085ee05c29ce4d49..d5b0332f4878bd58984b0425614a802beb0d04f6 100644 (file)
@@ -255,13 +255,6 @@ class NewnoticeAction extends Action
         $notice = Notice::saveNew($user->id, $content_shortened, 'web', 1,
                                   ($replyto == 'false') ? null : $replyto);
 
-        if (is_string($notice)) {
-            if (isset($filename)) {
-                $this->deleteFile($filename);
-            }
-            $this->clientError($notice);
-        }
-
         if (isset($mimetype)) {
             $this->attachFile($notice, $fileRecord);
         }
@@ -433,13 +426,14 @@ class NewnoticeAction extends Action
         $content = $this->trimmed('status_textarea');
         if (!$content) {
             $replyto = $this->trimmed('replyto');
+            $inreplyto = $this->trimmed('inreplyto');
             $profile = Profile::staticGet('nickname', $replyto);
             if ($profile) {
                 $content = '@' . $profile->nickname . ' ';
             }
         }
 
-        $notice_form = new NoticeForm($this, '', $content);
+        $notice_form = new NoticeForm($this, '', $content, null, $inreplyto);
         $notice_form->show();
     }
 
index 593888b9f66fd6fee0bd0f59333f4c174fc51dec..0c5d061cb65614148b6711eb0c2b60e24f1c25c9 100644 (file)
@@ -49,9 +49,23 @@ require_once INSTALLDIR.'/lib/rssaction.php';
  */
 class PublicrssAction extends Rss10Action
 {
+    /**
+     * Read arguments and initialize members
+     *
+     * @param array $args Arguments from $_REQUEST
+     * @return boolean success
+     */
+
+    function prepare($args)
+    {
+        parent::prepare($args);
+        $this->notices = $this->getNotices($this->limit);
+        return true;
+    }
+
     /**
      * Initialization.
-     * 
+     *
      * @return boolean true
      */
     function init()
@@ -73,7 +87,7 @@ class PublicrssAction extends Rss10Action
         while ($notice->fetch()) {
             $notices[] = clone($notice);
         }
-        
+
         return $notices;
     }
 
index c71c9226fb59dbc0e9cba5d8c5c23ad2f1a30a99..76aae21adb994652a0fd16e8bbc090aeb95ccea3 100644 (file)
@@ -38,6 +38,7 @@ class RepliesrssAction extends Rss10Action
             $this->clientError(_('No such user.'));
             return false;
         } else {
+            $this->notices = $this->getNotices($this->limit);
             return true;
         }
     }
index ff994976215263447b6151d5f65b131873c1039f..a67765ce583c94b39f6cab9d967217ba7d4c65a6 100644 (file)
@@ -345,7 +345,12 @@ class ShowgroupAction extends GroupDesignAction
                                                      'method' => 'timeline',
                                                      'argument' => $this->group->nickname.'.atom')),
                               sprintf(_('Notice feed for %s group (Atom)'),
-                                      $this->group->nickname)));
+                                      $this->group->nickname)),
+                     new Feed(Feed::FOAF,
+                              common_local_url('foafgroup',
+                                               array('nickname' => $this->group->nickname)),
+                              sprintf(_('FOAF for %s group'),
+                                       $this->group->nickname)));
     }
 
     /**
index 2e9679faed5444a6f4af302b0c0af0dcc2d7979d..cdac4f47bc732c9c8ad5522441009f70bb550859 100644 (file)
@@ -378,8 +378,13 @@ class ShowstreamAction extends ProfileAction
             $this->showEmptyListMessage();
         }
 
+        $args = array('nickname' => $this->user->nickname);
+        if (!empty($this->tag))
+        {
+            $args['tag'] = $this->tag;
+        }
         $this->pagination($this->page>1, $cnt>NOTICES_PER_PAGE, $this->page,
-                          'showstream', array('nickname' => $this->user->nickname));
+                          'showstream', $args);
     }
 
     function showAnonymousMessage()
index 4deb1b764adb7ba6d8bebbef666b8e314a22c82d..493144e77e588a0030a1b0c671d728b2ae5315c0 100644 (file)
@@ -293,6 +293,105 @@ require_once INSTALLDIR.'/lib/twitterapi.php';
          }
      }
 
+     function join($args, $apidata)
+     {
+         parent::handle($args);
+
+         common_debug("in groups api action");
+
+         $this->auth_user = $apidata['user'];
+         $group = $this->get_group($apidata['api_arg'], $apidata);
+
+         if (empty($group)) {
+             $this->clientError('Not Found', 404, $apidata['content-type']);
+             return false;
+         }
+
+         if($this->auth_user->isMember($group)){
+            $this->clientError(_('You are already a member of that group'), $code = 403);
+            return false;
+         }
+
+         if (Group_block::isBlocked($group, $this->auth_user->getProfile())) {
+            $this->clientError(_('You have been blocked from that group by the admin.'), 403);
+            return false;
+         }
+
+         $member = new Group_member();
+
+         $member->group_id   = $group->id;
+         $member->profile_id = $this->auth_user->id;
+         $member->created    = common_sql_now();
+
+         $result = $member->insert();
+
+         if (!$result) {
+            common_log_db_error($member, 'INSERT', __FILE__);
+            $this->serverError(sprintf(_('Could not join user %s to group %s'),
+                                       $this->auth_user->nickname, $group->nickname));
+         }
+
+         switch($apidata['content-type']) {
+          case 'xml':
+             $this->show_single_xml_group($group);
+             break;
+          case 'json':
+             $this->show_single_json_group($group);
+             break;
+          default:
+             $this->clientError(_('API method not found!'), $code = 404);
+         }
+     }
+
+     function leave($args, $apidata)
+     {
+         parent::handle($args);
+
+         common_debug("in groups api action");
+
+         $this->auth_user = $apidata['user'];
+         $group = $this->get_group($apidata['api_arg'], $apidata);
+
+         if (empty($group)) {
+             $this->clientError('Not Found', 404, $apidata['content-type']);
+             return false;
+         }
+
+         if(! $this->auth_user->isMember($group)){
+            $this->clientError(_('You are not a member of that group'), $code = 403);
+            return false;
+         }
+
+         $member = new Group_member();
+
+         $member->group_id   = $group->id;
+         $member->profile_id = $this->auth_user->id;
+
+         if (!$member->find(true)) {
+            $this->serverError(_('Could not find membership record.'));
+            return;
+         }
+
+         $result = $member->delete();
+
+         if (!$result) {
+            common_log_db_error($member, 'INSERT', __FILE__);
+            $this->serverError(sprintf(_('Could not remove user %s to group %s'),
+                                       $this->auth_user->nickname, $group->nickname));
+         }
+
+         switch($apidata['content-type']) {
+          case 'xml':
+             $this->show_single_xml_group($group);
+             break;
+          case 'json':
+             $this->show_single_json_group($group);
+             break;
+          default:
+             $this->clientError(_('API method not found!'), $code = 404);
+         }
+     }
+
      function is_member($args, $apidata)
      {
          parent::handle($args);
@@ -326,4 +425,29 @@ require_once INSTALLDIR.'/lib/twitterapi.php';
              $this->clientError(_('API method not found!'), $code = 404);
          }
      }
+
+     function create($args, $apidata)
+     {
+        die("todo");
+     }
+
+     function update($args, $apidata)
+     {
+        die("todo");
+     }
+
+     function update_group_logo($args, $apidata)
+     {
+        die("todo");
+     }
+
+     function destroy($args, $apidata)
+     {
+        die("todo");
+     }
+
+     function tag($args, $apidata)
+     {
+        die("todo");
+     }
 }
index 2f10ff966c8113a34477e4b7e2832945f447b385..87043b1821cb47672af710706b63c901014cd9bc 100644 (file)
@@ -297,11 +297,6 @@ class TwitapistatusesAction extends TwitterapiAction
                 html_entity_decode($status, ENT_NOQUOTES, 'UTF-8'),
                     $source, 1, $reply_to);
 
-            if (is_string($notice)) {
-                $this->serverError($notice);
-                return;
-            }
-
             common_broadcast_notice($notice);
             $apidata['api_arg'] = $notice->id;
         }
index fa6d588cdf4358f7c2f99f37853bb10b7e3de8b7..19e610551d4bca2ec9cf65defde29b7e003a76de 100644 (file)
@@ -25,7 +25,6 @@ require_once(INSTALLDIR.'/lib/rssaction.php');
 
 class UserrssAction extends Rss10Action
 {
-    var $user = null;
     var $tag  = null;
 
     function prepare($args)
@@ -39,6 +38,7 @@ class UserrssAction extends Rss10Action
             $this->clientError(_('No such user.'));
             return false;
         } else {
+            $this->notices = $this->getNotices($this->limit);
             return true;
         }
     }
@@ -64,9 +64,8 @@ class UserrssAction extends Rss10Action
 
     function getNotices($limit=0)
     {
-
         $user = $this->user;
-
+        
         if (is_null($user)) {
             return null;
         }
index 9758cf7f5576a5db08150740032ba276994de0a1..e04a9d5255ad50c85c840e3563e58ed0017610b9 100644 (file)
@@ -94,7 +94,13 @@ class File extends Memcached_DataObject
             $file_redir = File_redirection::staticGet('url', $given_url);
             if (empty($file_redir)) {
                 $redir_data = File_redirection::where($given_url);
-                $redir_url = $redir_data['url'];
+                if (is_array($redir_data)) {
+                    $redir_url = $redir_data['url'];
+                } elseif (is_string($redir_data)) {
+                    $redir_url = $redir_data;
+                } else {
+                    throw new ServerException("Can't process url '$given_url'");
+                }
                 // TODO: max field length
                 if ($redir_url === $given_url || strlen($redir_url) > 255) {
                     $x = File::saveNew($redir_data, $given_url);
index 76b18f672d3e23d969b50f69052e29f6f08acf81..79052bf7d3e80ca6e5b9347ee2062e5e9cc8ad22 100644 (file)
@@ -79,6 +79,9 @@ class File_redirection extends Memcached_DataObject
             }
         }
 
+        if(strpos($short_url,'://') === false){
+            return $short_url;
+        }
         $curlh = File_redirection::_commonCurl($short_url, $redirs);
         // Don't include body in output
         curl_setopt($curlh, CURLOPT_NOBODY, true);
index 2138e0561299094cb34bb6c1a2dc6407399fe034..93d5de79081d7395efc71e256e0d5cf4d8f29267 100644 (file)
@@ -153,30 +153,30 @@ class Notice extends Memcached_DataObject
         $final = common_shorten_links($content);
 
         if (Notice::contentTooLong($final)) {
-            common_log(LOG_INFO, 'Rejecting notice that is too long.');
-            return _('Problem saving notice. Too long.');
+            throw new ClientException(_('Problem saving notice. Too long.'));
         }
 
         if (!$profile) {
-            common_log(LOG_ERR, 'Problem saving notice. Unknown user.');
-            return _('Problem saving notice. Unknown user.');
+            throw new ClientException(_('Problem saving notice. Unknown user.'));
         }
 
         if (common_config('throttle', 'enabled') && !Notice::checkEditThrottle($profile_id)) {
             common_log(LOG_WARNING, 'Excessive posting by profile #' . $profile_id . '; throttled.');
-            return _('Too many notices too fast; take a breather and post again in a few minutes.');
+            throw new ClientException(_('Too many notices too fast; take a breather '.
+                                        'and post again in a few minutes.'));
         }
 
         if (common_config('site', 'dupelimit') > 0 && !Notice::checkDupes($profile_id, $final)) {
             common_log(LOG_WARNING, 'Dupe posting by profile #' . $profile_id . '; throttled.');
-                       return _('Too many duplicate messages too quickly; take a breather and post again in a few minutes.');
+                       throw new ClientException(_('Too many duplicate messages too quickly;'.
+                                        ' take a breather and post again in a few minutes.'));
         }
 
                $banned = common_config('profile', 'banned');
 
         if ( in_array($profile_id, $banned) || in_array($profile->nickname, $banned)) {
             common_log(LOG_WARNING, "Attempted post from banned user: $profile->nickname (user id = $profile_id).");
-            return _('You are banned from posting notices on this site.');
+            throw new ClientException(_('You are banned from posting notices on this site.'));
         }
 
         $notice = new Notice();
@@ -222,7 +222,7 @@ class Notice extends Memcached_DataObject
 
             if (!$id) {
                 common_log_db_error($notice, 'INSERT', __FILE__);
-                return _('Problem saving notice.');
+                throw new ServerException(_('Problem saving notice.'));
             }
 
             // Update ID-dependent columns: URI, conversation
@@ -247,7 +247,7 @@ class Notice extends Memcached_DataObject
             if ($changed) {
                 if (!$notice->update($orig)) {
                     common_log_db_error($notice, 'UPDATE', __FILE__);
-                    return _('Problem saving notice.');
+                    throw new ServerException(_('Problem saving notice.'));
                 }
             }
 
@@ -909,7 +909,8 @@ class Notice extends Memcached_DataObject
                 $qry .= '('.$id.', '.$this->id.', '.$source.", '".$this->created. "') ";
                 $cnt++;
                 if (rand() % NOTICE_INBOX_SOFT_LIMIT == 0) {
-                    Notice_inbox::gc($id);
+                    // FIXME: Causes lag in replicated servers
+                    // Notice_inbox::gc($id);
                 }
                 if ($cnt >= MAX_BOXCARS) {
                     $inbox = new Notice_inbox();
index 11cb4f08b4b5a70132ee4581238aee392960f628..3f7ed09bb7ae508c324ebec07f436060d6f40ca1 100644 (file)
@@ -117,11 +117,15 @@ class User extends Memcached_DataObject
     function allowed_nickname($nickname)
     {
         // XXX: should already be validated for size, content, etc.
-        static $blacklist = array('rss', 'xrds', 'doc', 'main',
-                                  'settings', 'notice', 'user',
-                                  'search', 'avatar', 'tag', 'tags',
-                                  'api', 'message', 'group', 'groups',
-                                  'local');
+
+        $blacklist = array();
+
+        //all directory and file names should be blacklisted
+        $d = dir(INSTALLDIR);
+        while (false !== ($entry = $d->read())) {
+            $blacklist[]=$entry;
+        }
+        $d->close();
         $merged = array_merge($blacklist, common_config('nickname', 'blacklist'));
         return !in_array($nickname, $merged);
     }
@@ -707,4 +711,33 @@ class User extends Memcached_DataObject
 
         return true;
     }
+
+    /**
+     * Does this user have the right to do X?
+     *
+     * With our role-based authorization, this is merely a lookup for whether the user
+     * has a particular role. The implementation currently uses a switch statement
+     * to determine if the user has the pre-defined role to exercise the right. Future
+     * implementations may allow per-site roles, and different mappings of roles to rights.
+     *
+     * @param $right string Name of the right, usually a constant in class Right
+     * @return boolean whether the user has the right in question
+     */
+
+    function hasRight($right)
+    {
+        $result = false;
+        if (Event::handle('UserRightsCheck', array($this, $right, &$result))) {
+            switch ($right)
+            {
+             case Right::deleteOthersNotice:
+                $result = $this->hasRole('moderator');
+                break;
+             default:
+                $result = false;
+                break;
+            }
+        }
+        return $result;
+    }
 }
index 055606f58213b59ef71aad70c727c142651102be..0e94df296e4f4dab912b13702f35ceb75712e660 100644 (file)
@@ -61,4 +61,5 @@ VALUES
     (100113, 'T-Mobile Germany', '%s@t-mobile-sms.de', now()),
     (100114, 'Vodafone Germany', '%s@vodafone-sms.de', now()),
     (100115, 'E-Plus', '%s@smsmail.eplus.de', now()),
-    (100116, 'Cellular South', '%s@csouth1.com', now());
+    (100116, 'Cellular South', '%s@csouth1.com', now()),
+    (100117, 'ChinaMobile (139)', '%s@139.com', now());
index 6cd2c08f90e74a73b6d9d7fd22c557624992a1a2..e5ded770234bbbfcc3b2494375ef1622b1d10cb5 100644 (file)
@@ -2,6 +2,4 @@ A bookmarklet is a small piece of javascript code used as a bookmark. This one w
 
 Drag-and-drop the following link to your bookmarks bar or right-click it and add it to your browser favorites to keep it handy.
 
-<MTMarkdownOptions output='raw'>
-<a href="javascript:var%20d=document,w=window,e=w.getSelection,k=d.getSelection,x=d.selection,s=(e?e():(k)?k():(x?x.createRange().text:0)),f='http://%%site.server%%/%%site.path%%/index.php?action=newnotice',l=d.location,e=encodeURIComponent,g=f+'&status_textarea=%22'+((e(s))?e(s):e(document.title))+'%22 from '+l.href;function%20a(){if(!w.open(g,'t','toolbar=0,resizable=0,scrollbars=1,status=1,width=800,height=570')){l.href=g;}}a();void(0);">Post to %%site.name%%</a>
-</MTMarkdownOptions>
+<a href="javascript:var%20d=document,w=window,e=w.getSelection,k=d.getSelection,x=d.selection,s=(e?e():(k)?k():(x?x.createRange().text:0)),f='http://%%site.server%%/%%site.path%%/index.php?action=newnotice',l=d.location,e=encodeURIComponent,g=f+'&amp;status_textarea=%22'+((e(s))?e(s):e(document.title))+'%22 from '+l.href;function%20a(){if(!w.open(g,'t','toolbar=0,resizable=0,scrollbars=1,status=1,width=800,height=570')){l.href=g;}}a();void(0);">Post to %%site.name%%</a>
index c722a4e2cb8fcbf5ca59a4cdb2710ee05d13ec4b..631f6d9bb7c36212d935e451dc294f6f7c91f20d 100644 (file)
@@ -37,10 +37,10 @@ currently-implemented commands:
 * **help**: Show this help. List available Jabber/XMPP commands
 * **follow &lt;nickname&gt;**: Subscribe to &lt;nickname&gt;
 * **sub &lt;nickname&gt;**: Same as follow
-* **leave &lt;nickname&gt;**: Subscribe to &lt;nickname&gt;
+* **leave &lt;nickname&gt;**: Unsubscribe from &lt;nickname&gt;
 * **unsub &lt;nickname&gt;**: Same as leave
 * **d &lt;nickname&gt; &lt;text&gt;**: Send direct message to &lt;nickname&gt; with message body &lt;text&gt;
 * **get &lt;nickname&gt;**: Get last notice from &lt;nickname&gt;
 * **last &lt;nickname&gt;**: Same as 'get'
 * **whois &lt;nickname&gt;**: Get Profile info on &lt;nickname&gt;
-* **fav &lt;nickname&gt;**: Add user's last notice as a favorite
\ No newline at end of file
+* **fav &lt;nickname&gt;**: Add user's last notice as a favorite
index 45104947d6da44412671f6e319f0dcf817131893..b5fc627a096cee6247daaf495b2d9b1e29d86e61 100644 (file)
@@ -376,7 +376,7 @@ function Auth_OpenID_detectMathLibrary($exts)
         // Try to load dynamic modules.
         if (!$loaded) {
             foreach ($extension['modules'] as $module) {
-                if (@dl($module . "." . PHP_SHLIB_SUFFIX)) {
+                if (function_exists('dl') && ini_get('enable_dl') && !ini_get('safe_mode') && @dl($module . "." . PHP_SHLIB_SUFFIX)) {
                     $loaded = true;
                     break;
                 }
index 4854f12bbcd2e3ca5d4f382a16e9491da0ee611b..7232d6cbdd85dbcfe140b0d70818aecf9645cdd2 100644 (file)
@@ -349,7 +349,7 @@ function &Auth_Yadis_getXMLParser()
     foreach ($extensions as $name => $params) {
         if (!extension_loaded($name)) {
             foreach ($params['libname'] as $libname) {
-                if (@dl($libname)) {
+                if (function_exists('dl') && ini_get('enable_dl') && !ini_get('safe_mode') && @dl($libname)) {
                     $classname = $params['classname'];
                 }
             }
index fd485355459843c2bbf41d6240d687423d56d6f9..648627b57637f34ed93ea66d226c9244cc396931 100644 (file)
@@ -327,7 +327,7 @@ class OAuthRequest {/*{{{*/
   public function get_normalized_http_url() {/*{{{*/
     $parts = parse_url($this->http_url);
 
-    $port = @$parts['port'];
+    $port = isset($parts['port']) ? $parts['port'] : null;
     $scheme = $parts['scheme'];
     $host = $parts['host'];
     $path = @$parts['path'];
index 4c24c6006a398f8f8ade714a87e67db58b9c7619..fcefa964a3299e5832339ce04fe2e7a1165bbf33 100644 (file)
@@ -746,7 +746,7 @@ class PEAR
     {
         if (!extension_loaded($ext)) {
             // if either returns true dl() will produce a FATAL error, stop that
-            if ((ini_get('enable_dl') != 1) || (ini_get('safe_mode') == 1)) {
+            if ((ini_get('enable_dl') != 1) || (ini_get('safe_mode') == 1) || !function_exists('dl')) {
                 return false;
             }
             if (OS_WINDOWS) {
index 8ff67d19d9165def2675d5c6955b435f8b884d8d..51e30f57821ffd5c1053174759e6944ec63248f3 100644 (file)
--- a/index.php
+++ b/index.php
@@ -49,7 +49,13 @@ function getPath($req)
     ) {
         return $req['p'];
     } else if (array_key_exists('PATH_INFO', $_SERVER)) {
-        return $_SERVER['PATH_INFO'];
+        $path = $_SERVER['PATH_INFO'];
+        $script = $_SERVER['SCRIPT_NAME'];
+        if (substr($path, 0, mb_strlen($script)) == $script) {
+            return substr($path, mb_strlen($script));
+        } else {
+            return $path;
+        }
     } else {
         return null;
     }
index 46248c7891b2ab503f4d5faff524e09d183da6fd..c2a5bb29ee394f392abe062ebf355f6d64b5fecc 100644 (file)
@@ -244,7 +244,7 @@ function main()
  */
 function haveExternalLibrary($external_library)
 {
-    if (isset($external_library['include']) && ! @include_once $external_library['include'] ) {
+    if (isset($external_library['include']) && !haveIncludeFile($external_library['include'])) {
         return false;
     }
     if (isset($external_library['check_function']) && ! function_exists($external_library['check_function'])) {
@@ -256,6 +256,15 @@ function haveExternalLibrary($external_library)
     return true;
 }
 
+// Attempt to include a PHP file and report if it worked, while
+// suppressing the annoying warning messages on failure.
+function haveIncludeFile($filename) {
+    $old = error_reporting(error_reporting() & ~E_WARNING);
+    $ok = include_once($filename);
+    error_reporting($old);
+    return $ok;
+}
+
 /**
  * Check if all is ready for installation
  *
@@ -328,12 +337,19 @@ function checkPrereqs()
  */
 function checkExtension($name)
 {
-    if (!extension_loaded($name)) {
-        if (!@dl($name.'.so')) {
-            return false;
-        }
+    if (extension_loaded($name)) {
+        return true;
+    } elseif (function_exists('dl') && ini_get('enable_dl') && !ini_get('safe_mode')) {
+       // dl will throw a fatal error if it's disabled or we're in safe mode.
+       // More fun, it may not even exist under some SAPIs in 5.3.0 or later...
+       $soname = $name . '.' . PHP_SHLIB_SUFFIX;
+       if (PHP_SHLIB_SUFFIX == 'dll') {
+               $soname = "php_" . $soname;
+       }
+       return @dl($soname);
+    } else {
+        return false;
     }
-    return true;
 }
 
 /**
@@ -390,7 +406,7 @@ E_O_T;
 E_O_T;
     foreach ($present_libraries as $library) {
         echo '<li>';
-        if ($library['url']) {
+        if (isset($library['url'])) {
             echo '<a href=">'.$library['url'].'">'.htmlentities($library['name']).'</a>';
         } else {
             echo htmlentities($library['name']);
index 8056cb9ecb375f92d7a0e1235027f6e5f2a37575..71ceffe20dbf9a5d2b033814567e99a188547c64 100644 (file)
@@ -120,17 +120,14 @@ class Action extends HTMLOutputter // lawsuit
     {
         // XXX: attributes (profile?)
         $this->elementStart('head');
-        if (Event::handle('StartHeadChildren', array($this))) {
-            $this->showTitle();
-            $this->showShortcutIcon();
-            $this->showStylesheets();
-            $this->showScripts();
-            $this->showOpenSearch();
-            $this->showFeeds();
-            $this->showDescription();
-            $this->extraHead();
-            Event::handle('EndHeadChildren', array($this));
-        }
+        $this->showTitle();
+        $this->showShortcutIcon();
+        $this->showStylesheets();
+        $this->showScripts();
+        $this->showOpenSearch();
+        $this->showFeeds();
+        $this->showDescription();
+        $this->extraHead();
         $this->elementEnd('head');
     }
 
@@ -528,7 +525,10 @@ class Action extends HTMLOutputter // lawsuit
             $this->showContentBlock();
             Event::handle('EndShowContentBlock', array($this));
         }
-        $this->showAside();
+        if (Event::handle('StartShowAside', array($this))) {
+            $this->showAside();
+            Event::handle('EndShowAside', array($this));
+        }
         $this->elementEnd('div');
     }
 
@@ -879,6 +879,7 @@ class Action extends HTMLOutputter // lawsuit
      */
     function handle($argarray=null)
     {
+        header('Vary: Accept-Encoding,Cookie');
         $lm   = $this->lastModified();
         $etag = $this->etag();
         if ($etag) {
index 7d007a75675775ee35fa67dc89ea79acb2774426..1b98a1064570d6472bfc2c553925be5d15efb3a8 100644 (file)
@@ -46,28 +46,28 @@ require_once INSTALLDIR.'/lib/error.php';
  */
 class ClientErrorAction extends ErrorAction
 {
+    static $status = array(400 => 'Bad Request',
+                           401 => 'Unauthorized',
+                           402 => 'Payment Required',
+                           403 => 'Forbidden',
+                           404 => 'Not Found',
+                           405 => 'Method Not Allowed',
+                           406 => 'Not Acceptable',
+                           407 => 'Proxy Authentication Required',
+                           408 => 'Request Timeout',
+                           409 => 'Conflict',
+                           410 => 'Gone',
+                           411 => 'Length Required',
+                           412 => 'Precondition Failed',
+                           413 => 'Request Entity Too Large',
+                           414 => 'Request-URI Too Long',
+                           415 => 'Unsupported Media Type',
+                           416 => 'Requested Range Not Satisfiable',
+                           417 => 'Expectation Failed');
+
     function __construct($message='Error', $code=400)
     {
         parent::__construct($message, $code);
-
-        $this->status  = array(400 => 'Bad Request',
-                               401 => 'Unauthorized',
-                               402 => 'Payment Required',
-                               403 => 'Forbidden',
-                               404 => 'Not Found',
-                               405 => 'Method Not Allowed',
-                               406 => 'Not Acceptable',
-                               407 => 'Proxy Authentication Required',
-                               408 => 'Request Timeout',
-                               409 => 'Conflict',
-                               410 => 'Gone',
-                               411 => 'Length Required',
-                               412 => 'Precondition Failed',
-                               413 => 'Request Entity Too Large',
-                               414 => 'Request-URI Too Long',
-                               415 => 'Unsupported Media Type',
-                               416 => 'Requested Range Not Satisfiable',
-                               417 => 'Expectation Failed');
         $this->default = 400;
     }
 
@@ -91,9 +91,4 @@ class ClientErrorAction extends ErrorAction
 
         $this->showPage();
     }
-
-    function title()
-    {
-        return $this->status[$this->code];
-    }
 }
index 194eb568f7d1a0ff2b7525599fd196443ee0bd78..58e208a4e92b98620fb540c7ffbafb67904d21d3 100644 (file)
@@ -53,6 +53,7 @@ require_once('DB/DataObject/Cast.php'); # for dates
 if (!function_exists('gettext')) {
     require_once("php-gettext/gettext.inc");
 }
+
 require_once(INSTALLDIR.'/lib/language.php');
 
 // This gets included before the config file, so that admin code and plugins
@@ -93,214 +94,17 @@ if (isset($path)) {
     null;
 }
 
-// default configuration, overwritten in config.php
+require_once(INSTALLDIR.'/lib/default.php');
+
+// Set config values initially to default values
 
-$config =
-  array('site' =>
-        array('name' => 'Just another StatusNet microblog',
-              'server' => $_server,
-              'theme' => 'default',
-              'path' => $_path,
-              'logfile' => null,
-              'logo' => null,
-              'logdebug' => false,
-              'fancy' => false,
-              'locale_path' => INSTALLDIR.'/locale',
-              'language' => 'en_US',
-              'languages' => get_all_languages(),
-              'email' =>
-              array_key_exists('SERVER_ADMIN', $_SERVER) ? $_SERVER['SERVER_ADMIN'] : null,
-              'broughtby' => null,
-              'timezone' => 'UTC',
-              'broughtbyurl' => null,
-              'closed' => false,
-              'inviteonly' => false,
-              'private' => false,
-              'ssl' => 'never',
-              'sslserver' => null,
-              'shorturllength' => 30,
-              'dupelimit' => 60, # default for same person saying the same thing
-              'textlimit' => 140,
-              ),
-        'syslog' =>
-        array('appname' => 'statusnet', # for syslog
-              'priority' => 'debug', # XXX: currently ignored
-              'facility' => LOG_USER),
-        'queue' =>
-        array('enabled' => false,
-              'subsystem' => 'db', # default to database, or 'stomp'
-              'stomp_server' => null,
-              'queue_basename' => 'statusnet',
-              'stomp_username' => null,
-              'stomp_password' => null,
-              ),
-        'license' =>
-        array('url' => 'http://creativecommons.org/licenses/by/3.0/',
-              'title' => 'Creative Commons Attribution 3.0',
-              'image' => 'http://i.creativecommons.org/l/by/3.0/80x15.png'),
-        'mail' =>
-        array('backend' => 'mail',
-              'params' => null),
-        'nickname' =>
-        array('blacklist' => array(),
-              'featured' => array()),
-        'profile' =>
-        array('banned' => array(),
-              'biolimit' => null),
-        'avatar' =>
-        array('server' => null,
-              'dir' => INSTALLDIR . '/avatar/',
-              'path' => $_path . '/avatar/'),
-        'background' =>
-        array('server' => null,
-              'dir' => INSTALLDIR . '/background/',
-              'path' => $_path . '/background/'),
-        'public' =>
-        array('localonly' => true,
-              'blacklist' => array(),
-              'autosource' => array()),
-        'theme' =>
-        array('server' => null,
-              'dir' => null,
-              'path'=> null),
-        'throttle' =>
-        array('enabled' => false, // whether to throttle edits; false by default
-              'count' => 20, // number of allowed messages in timespan
-              'timespan' => 600), // timespan for throttling
-        'xmpp' =>
-        array('enabled' => false,
-              'server' => 'INVALID SERVER',
-              'port' => 5222,
-              'user' => 'update',
-              'encryption' => true,
-              'resource' => 'uniquename',
-              'password' => 'blahblahblah',
-              'host' => null, # only set if != server
-              'debug' => false, # print extra debug info
-              'public' => array()), # JIDs of users who want to receive the public stream
-        'invite' =>
-        array('enabled' => true),
-        'sphinx' =>
-        array('enabled' => false,
-              'server' => 'localhost',
-              'port' => 3312),
-        'tag' =>
-        array('dropoff' => 864000.0),
-        'popular' =>
-        array('dropoff' => 864000.0),
-        'daemon' =>
-        array('piddir' => '/var/run',
-              'user' => false,
-              'group' => false),
-        'emailpost' =>
-        array('enabled' => true),
-        'sms' =>
-        array('enabled' => true),
-        'twitter' =>
-        array('enabled' => true),
-        'twitterbridge' =>
-        array('enabled' => false),
-        'integration' =>
-        array('source' => 'StatusNet', # source attribute for Twitter
-              'taguri' => $_server.',2009'), # base for tag URIs
-       'twitter' =>
-       array('consumer_key'    => null,
-             'consumer_secret' => null),
-        'memcached' =>
-        array('enabled' => false,
-              'server' => 'localhost',
-              'base' => null,
-              'port' => 11211),
-               'ping' =>
-        array('notify' => array()),
-        'inboxes' =>
-        array('enabled' => true), # on by default for new sites
-        'newuser' =>
-        array('default' => null,
-              'welcome' => null),
-        'snapshot' =>
-        array('run' => 'web',
-              'frequency' => 10000,
-              'reporturl' => 'http://status.net/stats/report'),
-        'attachments' =>
-        array('server' => null,
-              'dir' => INSTALLDIR . '/file/',
-              'path' => $_path . '/file/',
-              'supported' => array('image/png',
-                                   'image/jpeg',
-                                   'image/gif',
-                                   'image/svg+xml',
-                                   'audio/mpeg',
-                                   'audio/x-speex',
-                                   'application/ogg',
-                                   'application/pdf',
-                                   'application/vnd.oasis.opendocument.text',
-                                   'application/vnd.oasis.opendocument.text-template',
-                                   'application/vnd.oasis.opendocument.graphics',
-                                   'application/vnd.oasis.opendocument.graphics-template',
-                                   'application/vnd.oasis.opendocument.presentation',
-                                   'application/vnd.oasis.opendocument.presentation-template',
-                                   'application/vnd.oasis.opendocument.spreadsheet',
-                                   'application/vnd.oasis.opendocument.spreadsheet-template',
-                                   'application/vnd.oasis.opendocument.chart',
-                                   'application/vnd.oasis.opendocument.chart-template',
-                                   'application/vnd.oasis.opendocument.image',
-                                   'application/vnd.oasis.opendocument.image-template',
-                                   'application/vnd.oasis.opendocument.formula',
-                                   'application/vnd.oasis.opendocument.formula-template',
-                                   'application/vnd.oasis.opendocument.text-master',
-                                   'application/vnd.oasis.opendocument.text-web',
-                                   'application/x-zip',
-                                   'application/zip',
-                                   'text/plain',
-                                   'video/mpeg',
-                                   'video/mp4',
-                                   'video/quicktime',
-                                   'video/mpeg'),
-        'file_quota' => 5000000,
-        'user_quota' => 50000000,
-        'monthly_quota' => 15000000,
-        'uploads' => true,
-        'filecommand' => '/usr/bin/file',
-        ),
-        'group' =>
-        array('maxaliases' => 3,
-              'desclimit' => null),
-        'oohembed' => array('endpoint' => 'http://oohembed.com/oohembed/'),
-        'search' =>
-        array('type' => 'fulltext'),
-        'sessions' =>
-        array('handle' => false, // whether to handle sessions ourselves
-              'debug' => false), // debugging output for sessions
-        'design' =>
-        array('backgroundcolor' => null, // null -> 'use theme default'
-              'contentcolor' => null,
-              'sidebarcolor' => null,
-              'textcolor' => null,
-              'linkcolor' => null,
-              'backgroundimage' => null,
-              'disposition' => null),
-        'notice' =>
-        array('contentlimit' => null),
-        'message' =>
-        array('contentlimit' => null),
-        'http' =>
-        array('client' => 'curl'), // XXX: should this be the default?
-        );
+$config = $default;
+
+// default configuration, overwritten in config.php
 
 $config['db'] = &PEAR::getStaticProperty('DB_DataObject','options');
 
-$config['db'] =
-  array('database' => 'YOU HAVE TO SET THIS IN config.php',
-        'schema_location' => INSTALLDIR . '/classes',
-        'class_location' => INSTALLDIR . '/classes',
-        'require_prefix' => 'classes/',
-        'class_prefix' => '',
-        'mirror' => null,
-        'utf8' => true,
-        'db_driver' => 'DB', # XXX: JanRain libs only work with DB
-        'quote_identifiers' => false,
-        'type' => 'mysql' );
+$config['db'] = $default['db'];
 
 // Backward compatibility
 
diff --git a/lib/default.php b/lib/default.php
new file mode 100644 (file)
index 0000000..7af94d2
--- /dev/null
@@ -0,0 +1,232 @@
+<?php
+/**
+ * StatusNet, the distributed open-source microblogging tool
+ *
+ * Default settings for core configuration
+ *
+ * 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  Config
+ * @package   StatusNet
+ * @author    Evan Prodromou <evan@status.net>
+ * @copyright 2008-9 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/
+ */
+
+$default =
+  array('site' =>
+        array('name' => 'Just another StatusNet microblog',
+              'server' => $_server,
+              'theme' => 'default',
+              'path' => $_path,
+              'logfile' => null,
+              'logo' => null,
+              'logdebug' => false,
+              'fancy' => false,
+              'locale_path' => INSTALLDIR.'/locale',
+              'language' => 'en_US',
+              'languages' => get_all_languages(),
+              'email' =>
+              array_key_exists('SERVER_ADMIN', $_SERVER) ? $_SERVER['SERVER_ADMIN'] : null,
+              'broughtby' => null,
+              'timezone' => 'UTC',
+              'broughtbyurl' => null,
+              'closed' => false,
+              'inviteonly' => false,
+              'private' => false,
+              'ssl' => 'never',
+              'sslserver' => null,
+              'shorturllength' => 30,
+              'dupelimit' => 60, # default for same person saying the same thing
+              'textlimit' => 140,
+              ),
+        'db' =>
+        array('database' => 'YOU HAVE TO SET THIS IN config.php',
+              'schema_location' => INSTALLDIR . '/classes',
+              'class_location' => INSTALLDIR . '/classes',
+              'require_prefix' => 'classes/',
+              'class_prefix' => '',
+              'mirror' => null,
+              'utf8' => true,
+              'db_driver' => 'DB', # XXX: JanRain libs only work with DB
+              'quote_identifiers' => false,
+              'type' => 'mysql' ),
+        'syslog' =>
+        array('appname' => 'statusnet', # for syslog
+              'priority' => 'debug', # XXX: currently ignored
+              'facility' => LOG_USER),
+        'queue' =>
+        array('enabled' => false,
+              'subsystem' => 'db', # default to database, or 'stomp'
+              'stomp_server' => null,
+              'queue_basename' => 'statusnet',
+              'stomp_username' => null,
+              'stomp_password' => null,
+              ),
+        'license' =>
+        array('url' => 'http://creativecommons.org/licenses/by/3.0/',
+              'title' => 'Creative Commons Attribution 3.0',
+              'image' => 'http://i.creativecommons.org/l/by/3.0/80x15.png'),
+        'mail' =>
+        array('backend' => 'mail',
+              'params' => null),
+        'nickname' =>
+        array('blacklist' => array(),
+              'featured' => array()),
+        'profile' =>
+        array('banned' => array(),
+              'biolimit' => null),
+        'avatar' =>
+        array('server' => null,
+              'dir' => INSTALLDIR . '/avatar/',
+              'path' => $_path . '/avatar/'),
+        'background' =>
+        array('server' => null,
+              'dir' => INSTALLDIR . '/background/',
+              'path' => $_path . '/background/'),
+        'public' =>
+        array('localonly' => true,
+              'blacklist' => array(),
+              'autosource' => array()),
+        'theme' =>
+        array('server' => null,
+              'dir' => null,
+              'path'=> null),
+        'throttle' =>
+        array('enabled' => false, // whether to throttle edits; false by default
+              'count' => 20, // number of allowed messages in timespan
+              'timespan' => 600), // timespan for throttling
+        'xmpp' =>
+        array('enabled' => false,
+              'server' => 'INVALID SERVER',
+              'port' => 5222,
+              'user' => 'update',
+              'encryption' => true,
+              'resource' => 'uniquename',
+              'password' => 'blahblahblah',
+              'host' => null, # only set if != server
+              'debug' => false, # print extra debug info
+              'public' => array()), # JIDs of users who want to receive the public stream
+        'invite' =>
+        array('enabled' => true),
+        'sphinx' =>
+        array('enabled' => false,
+              'server' => 'localhost',
+              'port' => 3312),
+        'tag' =>
+        array('dropoff' => 864000.0),
+        'popular' =>
+        array('dropoff' => 864000.0),
+        'daemon' =>
+        array('piddir' => '/var/run',
+              'user' => false,
+              'group' => false),
+        'emailpost' =>
+        array('enabled' => true),
+        'sms' =>
+        array('enabled' => true),
+        'twitter' =>
+        array('enabled' => true),
+        'twitterbridge' =>
+        array('enabled' => false),
+        'integration' =>
+        array('source' => 'StatusNet', # source attribute for Twitter
+              'taguri' => $_server.',2009'), # base for tag URIs
+       'twitter' =>
+       array('consumer_key'    => null,
+             'consumer_secret' => null),
+        'memcached' =>
+        array('enabled' => false,
+              'server' => 'localhost',
+              'base' => null,
+              'port' => 11211),
+               'ping' =>
+        array('notify' => array()),
+        'inboxes' =>
+        array('enabled' => true), # on by default for new sites
+        'newuser' =>
+        array('default' => null,
+              'welcome' => null),
+        'snapshot' =>
+        array('run' => 'web',
+              'frequency' => 10000,
+              'reporturl' => 'http://status.net/stats/report'),
+        'attachments' =>
+        array('server' => null,
+              'dir' => INSTALLDIR . '/file/',
+              'path' => $_path . '/file/',
+              'supported' => array('image/png',
+                                   'image/jpeg',
+                                   'image/gif',
+                                   'image/svg+xml',
+                                   'audio/mpeg',
+                                   'audio/x-speex',
+                                   'application/ogg',
+                                   'application/pdf',
+                                   'application/vnd.oasis.opendocument.text',
+                                   'application/vnd.oasis.opendocument.text-template',
+                                   'application/vnd.oasis.opendocument.graphics',
+                                   'application/vnd.oasis.opendocument.graphics-template',
+                                   'application/vnd.oasis.opendocument.presentation',
+                                   'application/vnd.oasis.opendocument.presentation-template',
+                                   'application/vnd.oasis.opendocument.spreadsheet',
+                                   'application/vnd.oasis.opendocument.spreadsheet-template',
+                                   'application/vnd.oasis.opendocument.chart',
+                                   'application/vnd.oasis.opendocument.chart-template',
+                                   'application/vnd.oasis.opendocument.image',
+                                   'application/vnd.oasis.opendocument.image-template',
+                                   'application/vnd.oasis.opendocument.formula',
+                                   'application/vnd.oasis.opendocument.formula-template',
+                                   'application/vnd.oasis.opendocument.text-master',
+                                   'application/vnd.oasis.opendocument.text-web',
+                                   'application/x-zip',
+                                   'application/zip',
+                                   'text/plain',
+                                   'video/mpeg',
+                                   'video/mp4',
+                                   'video/quicktime',
+                                   'video/mpeg'),
+        'file_quota' => 5000000,
+        'user_quota' => 50000000,
+        'monthly_quota' => 15000000,
+        'uploads' => true,
+        'filecommand' => '/usr/bin/file',
+        ),
+        'group' =>
+        array('maxaliases' => 3,
+              'desclimit' => null),
+        'oohembed' => array('endpoint' => 'http://oohembed.com/oohembed/'),
+        'search' =>
+        array('type' => 'fulltext'),
+        'sessions' =>
+        array('handle' => false, // whether to handle sessions ourselves
+              'debug' => false), // debugging output for sessions
+        'design' =>
+        array('backgroundcolor' => null, // null -> 'use theme default'
+              'contentcolor' => null,
+              'sidebarcolor' => null,
+              'textcolor' => null,
+              'linkcolor' => null,
+              'backgroundimage' => null,
+              'disposition' => null),
+        'notice' =>
+        array('contentlimit' => null),
+        'message' =>
+        array('contentlimit' => null),
+        'http' =>
+        array('client' => 'curl'), // XXX: should this be the default?
+        );
diff --git a/lib/deleteaction.php b/lib/deleteaction.php
deleted file mode 100644 (file)
index f702820..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-<?php
-/**
- * StatusNet, the distributed open-source microblogging tool
- *
- * Base class for deleting things
- *
- * 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  Personal
- * @package   StatusNet
- * @author    Evan Prodromou <evan@status.net>
- * @author    Sarven Capadisli <csarven@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://status.net/
- */
-
-if (!defined('STATUSNET') && !defined('LACONICA')) {
-     exit(1);
-}
-
-class DeleteAction extends Action
-{
-    var $user         = null;
-    var $notice       = null;
-    var $profile      = null;
-    var $user_profile = null;
-
-    function prepare($args)
-    {
-        parent::prepare($args);
-
-        $this->user   = common_current_user();
-        $notice_id    = $this->trimmed('notice');
-        $this->notice = Notice::staticGet($notice_id);
-
-        if (!$this->notice) {
-            common_user_error(_('No such notice.'));
-            exit;
-        }
-
-        $this->profile      = $this->notice->getProfile();
-        $this->user_profile = $this->user->getProfile();
-
-        return true;
-    }
-
-    function handle($args)
-    {
-        parent::handle($args);
-
-        if (!common_logged_in()) {
-            common_user_error(_('Not logged in.'));
-            exit;
-        } else if ($this->notice->profile_id != $this->user_profile->id) {
-            common_user_error(_('Can\'t delete this notice.'));
-            exit;
-        }
-    }
-
-}
index fdc05562e08fbfafd13ef12223ce626fba000288..820d534f23eadc4d9ecb60d8a3d54e7067c6611e 100644 (file)
@@ -325,7 +325,6 @@ class DesignSettingsAction extends AccountSettingsAction
         parent::showScripts();
 
         $this->script('js/farbtastic/farbtastic.js');
-        $this->script('js/farbtastic/farbtastic.go.js');
         $this->script('js/userdesign.go.js');
 
         $this->autofocus('design_background-image_file');
index 0c521db08124a29d77259ae3dfb25df5dadb0f49..6a9b76be11b97391f41ac13292ed76f38bdeba2a 100644 (file)
@@ -44,9 +44,10 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
  */
 class ErrorAction extends Action
 {
+    static $status = array();
+
     var $code    = null;
     var $message = null;
-    var $status  = null;
     var $default = null;
 
     function __construct($message, $code, $output='php://output', $indent=true)
@@ -88,9 +89,10 @@ class ErrorAction extends Action
      *
      * @return page title
      */
+
     function title()
     {
-        return $this->message;
+        return self::$status[$this->code];
     }
 
     function isReadOnly($args)
index 411f795945a7de10737cbb3eab89a0dce2e5af41..3f3a8d3b094b44cde2f94385d60247e49257eef1 100644 (file)
@@ -468,11 +468,11 @@ class FacebookAction extends Action
 
         $replyto = $this->trimmed('inreplyto');
 
-        $notice = Notice::saveNew($user->id, $content,
-            'web', 1, ($replyto == 'false') ? null : $replyto);
-
-        if (is_string($notice)) {
-            $this->showPage($notice);
+        try {
+            $notice = Notice::saveNew($user->id, $content,
+                                      'web', 1, ($replyto == 'false') ? null : $replyto);
+        } catch (Exception $e) {
+            $this->showPage($e->getMessage());
             return;
         }
 
index aa01f6b1d9d268e5855864efe428027cf4aa5916..c70f965376af91bea815d604b765ca469b9e2484 100644 (file)
@@ -109,11 +109,13 @@ class HTMLOutputter extends XMLOutputter
         header('Content-Type: '.$type);
 
         $this->extraHeaders();
-        if( ! substr($type,0,strlen('text/html'))=='text/html' ){
-            // Browsers don't like it when <?xml it output for non-xhtml documents
+        if (preg_match("/.*\/.*xml/", $type)) {
+            // Required for XML documents
             $this->xw->startDocument('1.0', 'UTF-8');
         }
-        $this->xw->writeDTD('html');
+        $this->xw->writeDTD('html',
+                            '-//W3C//DTD XHTML 1.0 Strict//EN',
+                            'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd');
 
         $language = $this->getLanguage();
 
index df585406cc87f11744e6bd98b81557f9c52689b7..5bf4d7425693e0ce6a59b5559ed3c9254c2e90df 100644 (file)
@@ -551,9 +551,9 @@ function mail_notify_fave($other, $user, $notice)
 
     common_init_locale($other->language);
 
-    $subject = sprintf(_('%s added your notice as a favorite'), $bestname);
+    $subject = sprintf(_('%s (@%s) added your notice as a favorite'), $bestname, $user->nickname);
 
-    $body = sprintf(_("%1\$s just added your notice from %2\$s".
+    $body = sprintf(_("%1\$s (@%7\$s) just added your notice from %2\$s".
                       " as one of their favorites.\n\n" .
                       "The URL of your notice is:\n\n" .
                       "%3\$s\n\n" .
@@ -570,7 +570,8 @@ function mail_notify_fave($other, $user, $notice)
                     $notice->content,
                     common_local_url('showfavorites',
                                      array('nickname' => $user->nickname)),
-                    common_config('site', 'name'));
+                    common_config('site', 'name'),
+                    $user->nickname);
 
     common_init_locale();
     mail_to_user($other, $subject, $body);
@@ -607,9 +608,9 @@ function mail_notify_attn($user, $notice)
                $conversationUrl = null;
        }
        
-    $subject = sprintf(_('%s sent a notice to your attention'), $bestname);
+    $subject = sprintf(_('%s (@%s) sent a notice to your attention'), $bestname, $sender->nickname);
        
-       $body = sprintf(_("%1\$s just sent a notice to your attention (an '@-reply') on %2\$s.\n\n".
+       $body = sprintf(_("%1\$s (@%9\$s) just sent a notice to your attention (an '@-reply') on %2\$s.\n\n".
                       "The notice is here:\n\n".
                       "\t%3\$s\n\n" .
                       "It reads:\n\n".
@@ -629,10 +630,11 @@ function mail_notify_attn($user, $notice)
                     $notice->content,//%4
                                        $conversationUrl,//%5
                     common_local_url('newnotice',
-                                     array('replyto' => $sender->nickname)),//%6
+                                     array('replyto' => $sender->nickname, 'inreplyto' => $notice->id)),//%6
                     common_local_url('replies',
                                      array('nickname' => $user->nickname)),//%7
-                    common_local_url('emailsettings'));//%8
+                    common_local_url('emailsettings'), //%8
+                    $sender->nickname); //%9
        
     common_init_locale();
     mail_to_user($user, $subject, $body);
index cee46709e1f045d485e65ebe46124ea18d41e15b..186330bf1c783f430449ff046b0f2d79d1ada9ca 100644 (file)
@@ -69,6 +69,12 @@ class NoticeForm extends Form
 
     var $user = null;
 
+    /**
+     * The notice being replied to
+     */
+
+    var $inreplyto = null;
+
     /**
      * Constructor
      *
@@ -77,12 +83,13 @@ class NoticeForm extends Form
      * @param string        $content content to pre-fill
      */
 
-    function __construct($out=null, $action=null, $content=null, $user=null)
+    function __construct($out=null, $action=null, $content=null, $user=null, $inreplyto=null)
     {
         parent::__construct($out);
 
         $this->action  = $action;
         $this->content = $content;
+        $this->inreplyto = $inreplyto;
 
         if ($user) {
             $this->user = $user;
@@ -168,7 +175,7 @@ class NoticeForm extends Form
         if ($this->action) {
             $this->out->hidden('notice_return-to', $this->action, 'returnto');
         }
-        $this->out->hidden('notice_in-reply-to', $this->action, 'inreplyto');
+        $this->out->hidden('notice_in-reply-to', $this->inreplyto, 'inreplyto');
     }
 
     /**
index ec85e4a5c1aec5c3448b3650c2dc2b88117f9512..6c296f82a7bfb154db87c28686b3a3592236de74 100644 (file)
@@ -178,9 +178,12 @@ class NoticeListItem extends Widget
     function show()
     {
         $this->showStart();
-        $this->showNotice();
-        $this->showNoticeInfo();
-        $this->showNoticeOptions();
+        if (Event::handle('StartShowNoticeItem', array($this))) {
+            $this->showNotice();
+            $this->showNoticeInfo();
+            $this->showNoticeOptions();
+            Event::handle('EndShowNoticeItem', array($this));
+        }
         $this->showEnd();
     }
 
@@ -261,7 +264,7 @@ class NoticeListItem extends Widget
         $attrs = array('href' => $this->profile->profileurl,
                        'class' => 'url');
         if (!empty($this->profile->fullname)) {
-            $attrs['title'] = $this->profile->fullname . ' (' . $this->profile->nickname . ') ';
+            $attrs['title'] = $this->profile->fullname . ' (' . $this->profile->nickname . ')';
         }
         $this->out->elementStart('a', $attrs);
         $this->showAvatar();
@@ -418,9 +421,17 @@ class NoticeListItem extends Widget
 
     function showContext()
     {
-        // XXX: also show context if there are replies to this notice
-        if (!empty($this->notice->conversation)
-            && $this->notice->conversation != $this->notice->id) {
+        $hasConversation = false;
+        if( !empty($this->notice->conversation)
+            && $this->notice->conversation != $this->notice->id){
+            $hasConversation = true;
+        }else{
+            $conversation = Notice::conversationStream($this->notice->id, 1, 1);
+            if($conversation->N > 0){
+                $hasConversation = true;
+            }
+        }
+        if ($hasConversation){
             $convurl = common_local_url('conversation',
                                          array('id' => $this->notice->conversation));
             $this->out->element('a', array('href' => $convurl.'#notice-'.$this->notice->id,
@@ -442,7 +453,7 @@ class NoticeListItem extends Widget
     {
         if (common_logged_in()) {
             $reply_url = common_local_url('newnotice',
-                                          array('replyto' => $this->profile->nickname));
+                                          array('replyto' => $this->profile->nickname, 'inreplyto' => $this->notice->id));
             $this->out->elementStart('a', array('href' => $reply_url,
                                                 'class' => 'notice_reply',
                                                 'title' => _('Reply to this notice')));
@@ -461,7 +472,10 @@ class NoticeListItem extends Widget
     function showDeleteLink()
     {
         $user = common_current_user();
-        if ($user && $this->notice->profile_id == $user->id) {
+
+        if (!empty($user) &&
+            ($this->notice->profile_id == $user->id || $user->hasRight(Right::deleteOthersNotice))) {
+
             $deleteurl = common_local_url('deletenotice',
                                           array('notice' => $this->notice->id));
             $this->out->element('a', array('href' => $deleteurl,
index e69a00f55f2ab61e588a763e882e926d2c962c06..d617a7df7e6216f52d72d0beec8892487256f94b 100644 (file)
@@ -156,7 +156,6 @@ class StatusNetOAuthDataStore extends OAuthDataStore
         return $this->new_access_token($consumer);
     }
 
-
     /**
      * Revoke specified OAuth token
      *
@@ -363,9 +362,7 @@ class StatusNetOAuthDataStore extends OAuthDataStore
                                   false,
                                   null,
                                   $omb_notice->getIdentifierURI());
-        if (is_string($notice)) {
-            throw new Exception($notice);
-        }
+
         common_broadcast_notice($notice, true);
     }
 
diff --git a/lib/right.php b/lib/right.php
new file mode 100644 (file)
index 0000000..4e0096d
--- /dev/null
@@ -0,0 +1,50 @@
+<?php
+/**
+ * StatusNet, the distributed open-source microblogging tool
+ *
+ * Class for user rights
+ *
+ * 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  Authorization
+ * @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://status.net/
+ */
+
+if (!defined('STATUSNET') && !defined('LACONICA')) {
+    exit(1);
+}
+
+/**
+ * class for rights
+ *
+ * Mostly for holding the rights constants
+ *
+ * @category Authorization
+ * @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://status.net/
+ */
+
+class Right
+{
+    const deleteOthersNotice = 'deleteothersnotice';
+}
+
index 2c4d63b0d794df6a1973d7c26dd77c8373576f3f..91f886bce1111eebe3b990118811b4822ab0eb5c 100644 (file)
@@ -172,6 +172,10 @@ class Router
         $m->connect('notice/new?replyto=:replyto',
                     array('action' => 'newnotice'),
                     array('replyto' => '[A-Za-z0-9_-]+'));
+        $m->connect('notice/new?replyto=:replyto&inreplyto=:inreplyto',
+                    array('action' => 'newnotice'),
+                    array('replyto' => '[A-Za-z0-9_-]+'),
+                    array('inreplyto' => '[0-9]+'));
 
         $m->connect('notice/:notice/file',
             array('action' => 'file'),
@@ -237,6 +241,10 @@ class Router
                         array('nickname' => '[a-zA-Z0-9]+'));
         }
 
+        $m->connect('group/:nickname/foaf',
+                    array('action' => 'foafgroup'),
+                    array('nickname' => '[a-zA-Z0-9]+'));
+
         $m->connect('group/:nickname/blocked',
                     array('action' => 'blockedfromgroup'),
                     array('nickname' => '[a-zA-Z0-9]+'));
index dd0f1005af3ce4eea0433fd38a69521b6223c66e..faf6bec7dec4618d8ebc4888c4e55353f8aff99a 100644 (file)
@@ -78,25 +78,12 @@ class Rss10Action extends Action
     function prepare($args)
     {
         parent::prepare($args);
+
         $this->limit = (int) $this->trimmed('limit');
+
         if ($this->limit == 0) {
             $this->limit = DEFAULT_RSS_LIMIT;
         }
-        return true;
-    }
-
-    /**
-     * Handle a request
-     *
-     * @param array $args Arguments from $_REQUEST
-     *
-     * @return void
-     */
-
-    function handle($args)
-    {
-        // Parent handling, including cache check
-        parent::handle($args);
 
         if (common_config('site', 'private')) {
             if (!isset($_SERVER['PHP_AUTH_USER'])) {
@@ -122,8 +109,21 @@ class Rss10Action extends Action
             }
         }
 
-        // Get the list of notices
-        $this->notices = $this->getNotices($this->limit);
+        return true;
+    }
+
+    /**
+     * Handle a request
+     *
+     * @param array $args Arguments from $_REQUEST
+     *
+     * @return void
+     */
+
+    function handle($args)
+    {
+        // Parent handling, including cache check
+        parent::handle($args);
         $this->showRss();
     }
 
@@ -140,7 +140,7 @@ class Rss10Action extends Action
     }
 
     /**
-     * Get the notices to output in this stream
+     * Get the notices to output in this stream.
      *
      * @return array an array of Notice objects sorted in reverse chron
      */
index c6400605ea9bdc1936829b8e2d92e19c3350159c..0993a63bca506149dcecddf892b6d264d4b1cd8e 100644 (file)
@@ -55,17 +55,17 @@ require_once INSTALLDIR.'/lib/error.php';
 
 class ServerErrorAction extends ErrorAction
 {
+    static $status = array(500 => 'Internal Server Error',
+                           501 => 'Not Implemented',
+                           502 => 'Bad Gateway',
+                           503 => 'Service Unavailable',
+                           504 => 'Gateway Timeout',
+                           505 => 'HTTP Version Not Supported');
+
     function __construct($message='Error', $code=500)
     {
         parent::__construct($message, $code);
 
-        $this->status  = array(500 => 'Internal Server Error',
-                               501 => 'Not Implemented',
-                               502 => 'Bad Gateway',
-                               503 => 'Service Unavailable',
-                               504 => 'Gateway Timeout',
-                               505 => 'HTTP Version Not Supported');
-
         $this->default = 500;
 
         // Server errors must be logged.
@@ -93,9 +93,4 @@ class ServerErrorAction extends ErrorAction
 
         $this->showPage();
     }
-
-    function title()
-    {
-        return $this->status[$this->code];
-    }
 }
index d199e4dee27d657e05bcadf20c3b07200706068c..4a5de6ab3af99573badeac5441c88055db71580a 100644 (file)
@@ -502,7 +502,7 @@ class TwitterapiAction extends Action
             $enclosure = $entry['enclosures'][0];
             $this->element('enclosure', array('url'=>$enclosure['url'],'type'=>$enclosure['mimetype'],'length'=>$enclosure['size']), null);
         }
-        
+
         if(array_key_exists('tags', $entry)){
             foreach($entry['tags'] as $tag){
                 $this->element('category', null,$tag);
@@ -936,35 +936,16 @@ class TwitterapiAction extends Action
 
     function clientError($msg, $code = 400, $content_type = 'json')
     {
-
-        static $status = array(400 => 'Bad Request',
-                               401 => 'Unauthorized',
-                               402 => 'Payment Required',
-                               403 => 'Forbidden',
-                               404 => 'Not Found',
-                               405 => 'Method Not Allowed',
-                               406 => 'Not Acceptable',
-                               407 => 'Proxy Authentication Required',
-                               408 => 'Request Timeout',
-                               409 => 'Conflict',
-                               410 => 'Gone',
-                               411 => 'Length Required',
-                               412 => 'Precondition Failed',
-                               413 => 'Request Entity Too Large',
-                               414 => 'Request-URI Too Long',
-                               415 => 'Unsupported Media Type',
-                               416 => 'Requested Range Not Satisfiable',
-                               417 => 'Expectation Failed');
-
         $action = $this->trimmed('action');
 
         common_debug("User error '$code' on '$action': $msg", __FILE__);
 
-        if (!array_key_exists($code, $status)) {
+        if (!array_key_exists($code, ClientErrorAction::$status)) {
             $code = 400;
         }
 
-        $status_string = $status[$code];
+        $status_string = ClientErrorAction::$status[$code];
+
         header('HTTP/1.1 '.$code.' '.$status_string);
 
         if ($content_type == 'xml') {
@@ -983,6 +964,35 @@ class TwitterapiAction extends Action
 
     }
 
+    function serverError($msg, $code = 500, $content_type = 'json')
+    {
+        $action = $this->trimmed('action');
+
+        common_debug("Server error '$code' on '$action': $msg", __FILE__);
+
+        if (!array_key_exists($code, ServerErrorAction::$status)) {
+            $code = 400;
+        }
+
+        $status_string = ServerErrorAction::$status[$code];
+
+        header('HTTP/1.1 '.$code.' '.$status_string);
+
+        if ($content_type == 'xml') {
+            $this->init_document('xml');
+            $this->elementStart('hash');
+            $this->element('error', null, $msg);
+            $this->element('request', null, $_SERVER['REQUEST_URI']);
+            $this->elementEnd('hash');
+            $this->end_document('xml');
+        } else {
+            $this->init_document('json');
+            $error_array = array('error' => $msg, 'request' => $_SERVER['REQUEST_URI']);
+            print(json_encode($error_array));
+            $this->end_document('json');
+        }
+    }
+
     function init_twitter_rss()
     {
         $this->startXML();
index 37744fc5b7f5e598f8b4dcc5fa852355493b74c9..d249b154fc7b17bbf5135438c30e93f4ccfcceb3 100644 (file)
@@ -391,10 +391,10 @@ function common_render_content($text, $notice)
 {
     $r = common_render_text($text);
     $id = $notice->profile_id;
-    $r = preg_replace('/(^|\s+)@([A-Za-z0-9]{1,64})/e', "'\\1@'.common_at_link($id, '\\2')", $r);
+    $r = preg_replace('/(^|[\s\.\,\:\;]+)@([A-Za-z0-9]{1,64})/e', "'\\1@'.common_at_link($id, '\\2')", $r);
     $r = preg_replace('/^T ([A-Z0-9]{1,64}) /e', "'T '.common_at_link($id, '\\1').' '", $r);
-    $r = preg_replace('/(^|\s+)@#([A-Za-z0-9]{1,64})/e', "'\\1@#'.common_at_hash_link($id, '\\2')", $r);
-    $r = preg_replace('/(^|\s)!([A-Za-z0-9]{1,64})/e', "'\\1!'.common_group_link($id, '\\2')", $r);
+    $r = preg_replace('/(^|[\s\.\,\:\;]+)@#([A-Za-z0-9]{1,64})/e', "'\\1@#'.common_at_hash_link($id, '\\2')", $r);
+    $r = preg_replace('/(^|[\s\.\,\:\;]+)!([A-Za-z0-9]{1,64})/e', "'\\1!'.common_group_link($id, '\\2')", $r);
     return $r;
 }
 
@@ -442,9 +442,9 @@ function common_replace_urls_callback($text, $callback, $notice_id = null) {
         ')'.
         '(?:'.
             '(?:\:\d+)?'. //:port
-            '(?:/[\pN\pL$\[\]\,\!\(\)\.\:\-\_\+\/\=\&\;\%\~\*\$\+\'\"]*)?'. // /path
-            '(?:\?[\pN\pL\$\[\]\,\!\(\)\.\:\-\_\+\/\=\&\;\%\~\*\$\+\'\"\/]*)?'. // ?query string
-            '(?:\#[\pN\pL$\[\]\,\!\(\)\.\:\-\_\+\/\=\&\;\%\~\*\$\+\'\"\/\?\#]*)?'. // #fragment
+            '(?:/[\pN\pL$\[\]\,\!\(\)\.\:\-\_\+\/\=\&\;\%\~\*\$\+\'\"@]*)?'. // /path
+            '(?:\?[\pN\pL\$\[\]\,\!\(\)\.\:\-\_\+\/\=\&\;\%\~\*\$\+\'\"@\/]*)?'. // ?query string
+            '(?:\#[\pN\pL$\[\]\,\!\(\)\.\:\-\_\+\/\=\&\;\%\~\*\$\+\'\"\@/\?\#]*)?'. // #fragment
         ')(?<![\?\.\,\#\,])'.
     ')'.
     '#ixu';
@@ -522,21 +522,22 @@ function common_linkify($url) {
 
    if(strpos($url, '@') !== false && strpos($url, ':') === false) {
        //url is an email address without the mailto: protocol
-       return XMLStringer::estring('a', array('href' => "mailto:$url", 'rel' => 'external'), $url);
-   }
+       $canon = "mailto:$url";
+       $longurl = "mailto:$url";
+   }else{
 
-    $canon = File_redirection::_canonUrl($url);
+        $canon = File_redirection::_canonUrl($url);
 
-    $longurl_data = File_redirection::where($url);
-    if (is_array($longurl_data)) {
-        $longurl = $longurl_data['url'];
-    } elseif (is_string($longurl_data)) {
-        $longurl = $longurl_data;
-    } else {
-        throw new ServerException("Can't linkify url '$url'");
+        $longurl_data = File_redirection::where($canon);
+        if (is_array($longurl_data)) {
+            $longurl = $longurl_data['url'];
+        } elseif (is_string($longurl_data)) {
+            $longurl = $longurl_data;
+        } else {
+            throw new ServerException("Can't linkify url '$url'");
+        }
     }
-
-    $attrs = array('href' => $canon, 'rel' => 'external');
+    $attrs = array('href' => $canon, 'title' => $longurl, 'rel' => 'external');
 
     $is_attachment = false;
     $attachment_id = null;
@@ -552,12 +553,13 @@ function common_linkify($url) {
     }
 
     if (!empty($f)) {
-        if (isset($f->filename)) {
+        if ($f->isEnclosure()) {
             $is_attachment = true;
             $attachment_id = $f->id;
-        } else { // if it has OEmbed info, it's an attachment, too
+        } else {
             $foe = File_oembed::staticGet('file_id', $f->id);
             if (!empty($foe)) {
+                // if it has OEmbed info, it's an attachment, too
                 $is_attachment = true;
                 $attachment_id = $f->id;
 
@@ -1393,9 +1395,6 @@ function common_shorten_url($long_url)
     $short_url_service = $reflectionObj->newInstanceArgs($_shorteners[$svc]['callInfo'][1]);
     $short_url = $short_url_service->shorten($long_url);
 
-    if(substr($short_url,0,7)=='http://'){
-        $short_url = substr($short_url,7);
-    }
     return $short_url;
 }
 
index dfadea0045c0887a2078f8f68bb00e7e116a995b..3eff685a8dff5c002e5a161f48de506764992760 100644 (file)
@@ -1,38 +1,37 @@
 $(document).ready(function(){
-    $.getJSON($('address .url')[0].href+'/api/statuses/friends.json?user_id=' + current_user['id'] + '&lite=true&callback=?',
-        function(friends){
-            $('#notice_data-text').autocomplete(friends, {
+            $('#notice_data-text').autocomplete($('address .url')[0].href+'/plugins/Autocomplete/autocomplete.json', {
                 multiple: true,
                 multipleSeparator: " ",
                 minChars: 1,
                 formatItem: function(row, i, max){
-                    return '@' + row.screen_name + ' (' + row.name + ')';
+                    row = eval("(" + row + ")");
+                    switch(row.type)
+                    {
+                        case 'user':
+                            return row.nickname + ' (' + row.fullname + ')';
+                        case 'group':
+                            return row.nickname + ' (' + row.fullname + ')';
+                    }
                 },
                 formatMatch: function(row, i, max){
-                    return '@' + row.screen_name;
+                    row = eval("(" + row + ")");
+                    switch(row.type)
+                    {
+                        case 'user':
+                            return row.nickname;
+                        case 'group':
+                            return row.nickname;
+                    }
                 },
                 formatResult: function(row){
-                    return '@' + row.screen_name;
+                    row = eval("(" + row + ")");
+                    switch(row.type)
+                    {
+                        case 'user':
+                            return '@' + row.nickname;
+                        case 'group':
+                            return '!' + row.nickname;
+                    }
                 }
             });
-        }
-    );
-    $.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,
-                multipleSeparator: " ",
-                minChars: 1,
-                formatItem: function(row, i, max){
-                    return '!' + row.nickname + ' (' + row.fullname + ')';
-                },
-                formatMatch: function(row, i, max){
-                    return '!' + row.nickname;
-                },
-                formatResult: function(row){
-                    return '!' + row.nickname;
-                }
-            });
-        }
-    );
 });
index b7539727030c76d83d309c655e1d0c24fb835eec..baaec73c1672f770e83798946456af1788d3a52d 100644 (file)
@@ -31,6 +31,8 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
     exit(1);
 }
 
+require_once(INSTALLDIR.'/plugins/Autocomplete/autocomplete.php');
+
 class AutocompletePlugin extends Plugin
 {
     function __construct()
@@ -40,13 +42,6 @@ class AutocompletePlugin extends Plugin
 
     function onEndShowScripts($action){
         if (common_logged_in()) {
-            $current_user = common_current_user();
-            $js_string = <<<EOT
-<script type="text/javascript">
-var current_user = { id: '$current_user->id' };
-</script>
-EOT;
-            $action->raw($js_string);
             $action->script('plugins/Autocomplete/jquery-autocomplete/jquery.autocomplete.pack.js');
             $action->script('plugins/Autocomplete/Autocomplete.js');
         }
@@ -59,5 +54,12 @@ EOT;
         }
     }
 
+    function onRouterInitialized($m)
+    {
+        if (common_logged_in()) {
+            $m->connect('plugins/Autocomplete/autocomplete.json', array('action'=>'autocomplete'));
+        }
+    }
+
 }
 ?>
diff --git a/plugins/Autocomplete/autocomplete.php b/plugins/Autocomplete/autocomplete.php
new file mode 100644 (file)
index 0000000..aa57b39
--- /dev/null
@@ -0,0 +1,136 @@
+<?php
+/**
+ * StatusNet, the distributed open-source microblogging tool
+ *
+ * List users for autocompletion
+ *
+ * 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 2008-2009 StatusNet, Inc.
+ * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link      http://status.net/
+ */
+
+if (!defined('STATUSNET') && !defined('LACONICA')) {
+    exit(1);
+}
+
+/**
+ * List users for autocompletion
+ *
+ * This is the form for adding a new g
+ *
+ * @category Plugin
+ * @package  StatusNet
+ * @author   Craig Andrews <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/
+ */
+
+class AutocompleteAction extends Action
+{
+    private $result;
+
+    /**
+     * Last-modified date for page
+     *
+     * When was the content of this page last modified? Based on notice,
+     * profile, avatar.
+     *
+     * @return int last-modified date as unix timestamp
+     */
+    function lastModified()
+    {
+        $max=0;
+        foreach($this->users as $user){
+            $max = max($max,strtotime($user->modified),strtotime($user->profile->modified));
+        }
+        foreach($this->groups as $group){
+            $max = max($max,strtotime($group->modified));
+        }
+        return $max;
+    }
+
+    /**
+     * An entity tag for this page
+     *
+     * Shows the ETag for the page, based on the notice ID and timestamps
+     * for the notice, profile, and avatar. It's weak, since we change
+     * the date text "one hour ago", etc.
+     *
+     * @return string etag
+     */
+    function etag()
+    {
+        return '"' . implode(':', array($this->arg('action'),
+            crc32($this->arg('q')), //the actual string can have funny characters in we don't want showing up in the etag
+            $this->arg('limit'),
+            $this->lastModified())) . '"';
+    }
+
+    function prepare($args)
+    {
+        parent::prepare($args);
+        $this->groups=array();
+        $this->users=array();
+        $q = $this->arg('q');
+        $limit = $this->arg('limit');
+        if($limit > 200) $limit=200; //prevent DOS attacks
+        if(substr($q,0,1)=='@'){
+            //user search
+            $q=substr($q,1);
+            $user = new User();
+            $user->limit($limit);
+            $user->whereAdd('nickname like \'' . trim($user->escape($q), '\'') . '%\'');
+            $user->find();
+            while($user->fetch()) {
+                $profile = Profile::staticGet($user->id);
+                $user->profile=$profile;
+                $this->users[]=$user;
+            }
+        }
+        if(substr($q,0,1)=='!'){
+            //group search
+            $q=substr($q,1);
+            $group = new User_group();
+            $group->limit($limit);
+            $group->whereAdd('nickname like \'' . trim($group->escape($q), '\'') . '%\'');
+            $group->find();
+            while($group->fetch()) {
+                $this->groups[]=$group;
+            }
+        }
+        return true;
+    }
+
+    function handle($args)
+    {
+        parent::handle($args);
+        $results = array();
+        foreach($this->users as $user){
+            $results[]=array('nickname' => $user->nickname, 'fullname'=> $user->profile->fullname, 'type'=>'user');
+        }
+        foreach($this->groups as $group){
+            $results[]=array('nickname' => $group->nickname, 'fullname'=> $group->fullname, 'type'=>'group');
+        }
+        foreach($results as $result) {
+            print json_encode($result) . "\n";
+        }
+    }
+}
index 3272aa1eefb24cf9710b711e43bf525538987948..1db4c65658b256dd1e39def966b8cf633e528e5b 100644 (file)
@@ -1,5 +1,7 @@
 Autocomplete allows users to autocomplete screen names in @ replies. When an "@" is typed into the notice text area, an autocomplete box is displayed populated with the user's friends' screen names.
 
+Note: This plugin doesn't work if the site is in Private mode, i.e. when $config['site']['private'] is set to true.
+
 Installation
 ============
 Add "addPlugin('Autocomplete');" to the bottom of your config.php
index c955298cb934f4d1b9f27c146fa3e03e0e8a28bc..5928c007fe1a3991f8fa64290bace4c496329c2b 100644 (file)
@@ -40,7 +40,7 @@ class InfiniteScrollPlugin extends Plugin
 
     function onEndShowScripts($action)
     {
-        $action->script('plugins/InfiniteScroll/jquery.infinitescroll.min.js');
+        $action->script('plugins/InfiniteScroll/jquery.infinitescroll.js');
         $action->script('plugins/InfiniteScroll/infinitescroll.js');
     }
 }
index 6513072d0655e9e7fe3971402ab846bec8c73fa8..ae4d53d09593fc215e65f9f4353e1b71289dd7d5 100644 (file)
@@ -1,6 +1,7 @@
 jQuery(document).ready(function($){
   $('notices_primary').infinitescroll({
     debug: true,
+    infiniteScroll  : false,
     nextSelector    : "li.nav_next a",
     loadingImg      : $('address .url')[0].href+'plugins/InfiniteScroll/ajax-loader.gif',
     text            : "<em>Loading the next set of posts...</em>",
@@ -12,4 +13,3 @@ jQuery(document).ready(function($){
         NoticeAttachments();
     });
 });
-
index 670686b0e69578aa2989dc92998ad6bd281d5bb5..ec31bb0863af40b06a27f6ab18ef408f7dceab8f 100644 (file)
     
         if (props.isDuringAjax || props.isInvalidPage || props.isDone) return; 
     
-               if ( !isNearBottom(opts,props) ) return; 
+               if ( opts.infiniteScroll && !isNearBottom(opts,props) ) return; 
                  
                // we dont want to fire the ajax multiple times
                props.isDuringAjax = true; 
                
                // show the loading message and hide the previous/next links
                props.loadingMsg.appendTo( opts.contentSelector ).show();
-               $( opts.navSelector ).hide(); 
+               if(opts.infiniteScroll) $( opts.navSelector ).hide(); 
                
                // increment the URL bit. e.g. /page/3/
                props.currPage++;
       } 
     });
     
-    // bind scroll handler to element (if its a local scroll) or window  
-    $(opts.localMode ? this : window)
-      .bind('scroll.infscr', function(){ infscrSetup(path,opts,props,callback); } )
-      .trigger('scroll.infscr'); // trigger the event, in case it's a short page
+    if(opts.infiniteScroll){
+      // bind scroll handler to element (if its a local scroll) or window  
+      $(opts.localMode ? this : window)
+        .bind('scroll.infscr', function(){ infscrSetup(path,opts,props,callback); } )
+        .trigger('scroll.infscr'); // trigger the event, in case it's a short page
+    }else{
+      $(opts.nextSelector).click(
+        function(){
+          infscrSetup(path,opts,props,callback);
+          return false;
+        }
+      );
+    }
     
     
     return this;
   $.infinitescroll = {     
         defaults      : {
                           debug           : false,
+                          infiniteScroll  : true,
                           preload         : false,
                           nextSelector    : "div.navigation a:first",
                           loadingImg      : "http://www.infinite-scroll.com/loading.gif",
index 2e688336f1d19624590d47ddeac6f65117907e2f..9ce68775bf8ba1ebd89efc05f90605a753487231 100644 (file)
@@ -1,5 +1,6 @@
-// update the local timeline from a Meteor server
-//
+// Update the local timeline from a Meteor server
+// XXX: If @a is subscribed to @b, @a should get @b's notices in @a's Personal timeline.
+//      Do Replies timeline.
 
 var MeteorUpdater = function()
 {
index 85a24c132019ca07964f21fb88c9f562660375bc..54faa0bdbefee085216495efbef62a1e825dcf33 100644 (file)
@@ -38,30 +38,24 @@ if (!defined('STATUSNET')) {
  * This plugin will spoot out the correct JavaScript spell to invoke
  * Piwik Analytics on a page.
  *
- * To use this plugin please add the following three lines to your config.php
+ * To use this plugin add the following to your config.php
  *
- *     require_once('plugins/PiwikAnalyticsPlugin.php');
- *     $pa = new PiwikAnalyticsPlugin("example.com/piwik/","id");
+ *  addPlugin('PiwikAnalytics', array('piwikroot' => 'example.com/piwik/',
+ *                                    'piwikId' => 'id'));
  *
- * 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 statusnet installation has in your Piwik analytics
+ * Replace 'example.com/piwik/' with the URL to your Piwik installation and
+ * make sure you don't forget the final /.
+ * Replace 'id' with the ID your statusnet installation has in your Piwik
+ * analytics setup - for example '8'.
  *
- * @category Plugin
- * @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://status.net/
- *
- * @see      Event
  */
 
 class PiwikAnalyticsPlugin extends Plugin
 {
     /** the base of your Piwik installation */
-    var $piwikroot = null;
+    public $piwikroot = null;
     /** the Piwik Id of your statusnet installation */
-    var $piwikId   = null;
+    public $piwikId   = null;
 
     /**
      * constructor
@@ -73,7 +67,7 @@ class PiwikAnalyticsPlugin extends Plugin
     function __construct($root=null, $id=null)
     {
         $this->piwikroot = $root;
-        $this->piwikid   = $id;
+        $this->piwikId   = $id;
         parent::__construct();
     }
 
@@ -96,7 +90,7 @@ document.write(unescape("%3Cscript src='" + pkBaseURL + "piwik.js' type='text/ja
 </script>
 <script type="text/javascript">
 try {
-    var piwikTracker = Piwik.getTracker(pkBaseURL + "piwik.php", 4);
+    var piwikTracker = Piwik.getTracker(pkBaseURL + "piwik.php", {$this->piwikId});
     piwikTracker.trackPageView();
     piwikTracker.enableLinkTracking();
 } catch( err ) {}
@@ -108,4 +102,4 @@ ENDOFPIWIK;
         $action->raw($piwikCode);
         return true;
     }
-}
\ No newline at end of file
+}
index 013a234d73dece6d48750474717c71dd255306d6..e1e82e352c58e56ed704387daf490e78be6a639f 100644 (file)
@@ -31,7 +31,7 @@ if (!defined('STATUSNET')) {
     exit(1);
 }
 
-define('DEFAULT_HUB','http://2pubsubhubbub.appspot.com');
+define('DEFAULT_HUB','http://pubsubhubbub.appspot.com');
 
 require_once(INSTALLDIR.'/plugins/PubSubHubBub/publisher.php');
 
@@ -59,7 +59,7 @@ class PubSubHubBubPlugin extends Plugin
         $action->element('atom:link',array('rel'=>'hub','href'=>$this->hub),null);
     }
 
-    function onEndNoticeSave($notice){
+    function onHandleQueuedNotice($notice){
         $publisher = new Publisher($this->hub);
 
         $feeds = array();
index 82eca3d08c0d1cd67700ee69394563af534d5a73..0f0d0f9f42309b134298220d3fc1d148e3ae2ed7 100644 (file)
@@ -50,6 +50,11 @@ class RealtimePlugin extends Plugin
     protected $favorurl = null;
     protected $deleteurl = null;
 
+    /**
+     * When it's time to initialize the plugin, calculate and
+     * pass the URLs we need.
+     */
+
     function onInitializePlugin()
     {
         $this->replyurl = common_local_url('newnotice');
@@ -57,29 +62,26 @@ class RealtimePlugin extends Plugin
         // FIXME: need to find a better way to pass this pattern in
         $this->deleteurl = common_local_url('deletenotice',
                                             array('notice' => '0000000000'));
+        return true;
     }
 
     function onEndShowScripts($action)
     {
-        $path = null;
+        $timeline = $this->_getTimeline($action);
 
-        switch ($action->trimmed('action')) {
-         case 'public':
-            $path = array('public');
-            break;
-         case 'tag':
-            $tag = $action->trimmed('tag');
-            if (!empty($tag)) {
-                $path = array('tag', $tag);
-            } else {
-                return true;
-            }
-            break;
-         default:
+        // If there's not a timeline on this page,
+        // just return true
+
+        if (empty($timeline)) {
             return true;
         }
 
-        $timeline = $this->_pathToChannel($path);
+        $base = $action->selfUrl();
+        if (mb_strstr($base, '?')) {
+            $url = $base . '&realtime=1';
+        } else {
+            $url = $base . '?realtime=1';
+        }
 
         $scripts = $this->_getScripts();
 
@@ -95,10 +97,22 @@ class RealtimePlugin extends Plugin
             $user_id = 0;
         }
 
+        if ($action->boolean('realtime')) {
+            $realtimeUI = ' RealtimeUpdate.initPopupWindow();';
+        }
+        else {
+            $iconurl = common_path('plugins/Realtime/icon_external.gif');
+            $realtimeUI = ' RealtimeUpdate.addPopup("'.$url.'", "'.$timeline.'", "'. $iconurl .'");';
+        }
+
         $action->elementStart('script', array('type' => 'text/javascript'));
-        $action->raw("$(document).ready(function() { ");
-        $action->raw($this->_updateInitialize($timeline, $user_id));
-        $action->raw(" });");
+
+        $script = ' $(document).ready(function() { '.
+          $realtimeUI.
+          $this->_updateInitialize($timeline, $user_id).
+          '}); ';
+        $action->raw($script);
+
         $action->elementEnd('script');
 
         return true;
@@ -108,13 +122,23 @@ class RealtimePlugin extends Plugin
     {
         $paths = array();
 
-        // XXX: Add other timelines; this is just for the public one
+        // Add to the author's timeline
+
+        $user = User::staticGet('id', $notice->profile_id);
+
+        if (!empty($user)) {
+            $paths[] = array('showstream', $user->nickname);
+        }
+
+        // Add to the public timeline
 
         if ($notice->is_local ||
             ($notice->is_local == 0 && !common_config('public', 'localonly'))) {
             $paths[] = array('public');
         }
 
+        // Add to the tags timeline
+
         $tags = $this->getNoticeTags($notice);
 
         if (!empty($tags)) {
@@ -123,6 +147,46 @@ class RealtimePlugin extends Plugin
             }
         }
 
+        // Add to inbox timelines
+        // XXX: do a join
+
+        $inbox = new Notice_inbox();
+        $inbox->notice_id = $notice->id;
+
+        if ($inbox->find()) {
+            while ($inbox->fetch()) {
+                $user = User::staticGet('id', $inbox->user_id);
+                $paths[] = array('all', $user->nickname);
+            }
+        }
+
+        // Add to the replies timeline
+
+        $reply = new Reply();
+        $reply->notice_id = $notice->id;
+
+        if ($reply->find()) {
+            while ($reply->fetch()) {
+                $user = User::staticGet('id', $reply->profile_id);
+                if (!empty($user)) {
+                    $paths[] = array('replies', $user->nickname);
+                }
+            }
+        }
+
+        // Add to the group timeline
+        // XXX: join
+
+        $gi = new Group_inbox();
+        $gi->notice_id = $notice->id;
+
+        if ($gi->find()) {
+            while ($gi->fetch()) {
+                $ug = User_group::staticGet('id', $gi->group_id);
+                $paths[] = array('showgroup', $ug->nickname);
+            }
+        }
+
         if (count($paths) > 0) {
 
             $json = $this->noticeAsJson($notice);
@@ -140,6 +204,36 @@ class RealtimePlugin extends Plugin
         return true;
     }
 
+    function onStartShowBody($action)
+    {
+        $realtime = $action->boolean('realtime');
+        if (!$realtime) {
+            return true;
+        }
+
+        $action->elementStart('body',
+                              (common_current_user()) ? array('id' => $action->trimmed('action'),
+                                                              'class' => 'user_in')
+                              : array('id' => $action->trimmed('action')));
+
+        // XXX hack to deal with JS that tries to get the
+        // root url from page output
+
+        $action->elementStart('address');
+        $action->element('a', array('class' => 'url',
+                                  'href' => common_local_url('public')),
+                         '');
+        $action->elementEnd('address');
+
+        if (common_logged_in()) {
+            $action->showNoticeForm();
+        }
+
+        $action->showContentBlock();
+        $action->elementEnd('body');
+        return false; // No default processing
+    }
+
     function noticeAsJson($notice)
     {
         // FIXME: this code should be abstracted to a neutral third
@@ -224,4 +318,41 @@ class RealtimePlugin extends Plugin
     {
         return '';
     }
+
+    function _getTimeline($action)
+    {
+        $path = null;
+        $timeline = null;
+
+        $action_name = $action->trimmed('action');
+
+        switch ($action_name) {
+         case 'public':
+            $path = array('public');
+            break;
+         case 'tag':
+            $tag = $action->trimmed('tag');
+            if (!empty($tag)) {
+                $path = array('tag', $tag);
+            }
+            break;
+         case 'showstream':
+         case 'all':
+         case 'replies':
+         case 'showgroup':
+            $nickname = common_canonical_nickname($action->trimmed('nickname'));
+            if (!empty($nickname)) {
+                $path = array($action_name, $nickname);
+            }
+            break;
+         default:
+            break;
+        }
+
+        if (!empty($path)) {
+            $timeline = $this->_pathToChannel($path);
+        }
+
+        return $timeline;
+    }
 }
diff --git a/plugins/Realtime/icon_external.gif b/plugins/Realtime/icon_external.gif
new file mode 100644 (file)
index 0000000..c4118d5
Binary files /dev/null and b/plugins/Realtime/icon_external.gif differ
index d55db585922a10dedb8c83bbbdce9cb946f0d2f9..11e466325ebad553a71c4bdb2c8b373c31289c7e 100644 (file)
@@ -1,8 +1,8 @@
 // add a notice encoded as JSON into the current timeline
 //
+// TODO: i18n
 
 RealtimeUpdate = {
-
      _userid: 0,
      _replyurl: '',
      _favorurl: '',
@@ -10,27 +10,40 @@ RealtimeUpdate = {
 
      init: function(userid, replyurl, favorurl, deleteurl)
      {
-          RealtimeUpdate._userid = userid;
-          RealtimeUpdate._replyurl = replyurl;
-          RealtimeUpdate._favorurl = favorurl;
-          RealtimeUpdate._deleteurl = deleteurl;
+        RealtimeUpdate._userid = userid;
+        RealtimeUpdate._replyurl = replyurl;
+        RealtimeUpdate._favorurl = favorurl;
+        RealtimeUpdate._deleteurl = deleteurl;
+
+        $(window).blur(function() {
+          $('#notices_primary .notice').css({
+            'border-top-color':$('#notices_primary .notice:last').css('border-top-color'),
+            'border-top-style':'dotted'
+          });
+
+          $('#notices_primary .notice:first').css({
+            'border-top-color':'#AAAAAA',
+            'border-top-style':'solid'
+          });
+        });
      },
 
      receive: function(data)
      {
-          id = data.id;
-
-          // Don't add it if it already exists
-
-          if ($("#notice-"+id).length > 0) {
-               return;
-          }
-
-          var noticeItem = RealtimeUpdate.makeNoticeItem(data);
-          $("#notices_primary .notices").prepend(noticeItem, true);
-          $("#notices_primary .notice:first").css({display:"none"});
-          $("#notices_primary .notice:first").fadeIn(1000);
-          NoticeReply();
+          setTimeout(function() {
+              id = data.id;
+
+              // Don't add it if it already exists
+              if ($("#notice-"+id).length > 0) {
+                   return;
+              }
+    
+              var noticeItem = RealtimeUpdate.makeNoticeItem(data);
+              $("#notices_primary .notices").prepend(noticeItem);
+              $("#notices_primary .notice:first").css({display:"none"});
+              $("#notices_primary .notice:first").fadeIn(1000);
+              NoticeReply();
+          }, 500);
      },
 
      makeNoticeItem: function(data)
@@ -50,30 +63,19 @@ RealtimeUpdate = {
                "<p class=\"entry-content\">"+html+"</p>"+
                "</div>"+
                "<div class=\"entry-content\">"+
-               "<dl class=\"timestamp\">"+
-               "<dt>Published</dt>"+
-               "<dd>"+
-               "<a rel=\"bookmark\" href=\""+data['url']+"\" >"+
+               "<a class=\"timestamp\" rel=\"bookmark\" href=\""+data['url']+"\" >"+
                "<abbr class=\"published\" title=\""+data['created_at']+"\">a few seconds ago</abbr>"+
                "</a> "+
-               "</dd>"+
-               "</dl>"+
-               "<dl class=\"device\">"+
-               "<dt>From</dt> "+
-               "<dd>"+source+"</dd>"+ // may have a link, I think
-               "</dl>";
-
+               "<span class=\"source\">"+
+               "from "+
+                "<span class=\"device\">"+source+"</span>"+ // may have a link
+               "</span>";
           if (data['in_reply_to_status_id']) {
-               ni = ni+" <dl class=\"response\">"+
-                    "<dt>To</dt>"+
-                    "<dd>"+
-                    "<a href=\""+data['in_reply_to_status_url']+"\" rel=\"in-reply-to\">in reply to</a>"+
-                    "</dd>"+
-                    "</dl>";
+               ni = ni+" <a class=\"response\" href=\""+data['in_reply_to_status_url']+"\">in context</a>";
           }
 
           ni = ni+"</div>"+
-               "<div class=\"notice-options\">";
+            "<div class=\"notice-options\">";
 
           if (RealtimeUpdate._userid != 0) {
                var input = $("form#form_notice fieldset input#token");
@@ -95,12 +97,12 @@ RealtimeUpdate = {
           var ff;
 
           ff = "<form id=\"favor-"+id+"\" class=\"form_favor\" method=\"post\" action=\""+RealtimeUpdate._favorurl+"\">"+
-               "<fieldset>"+
-               "<legend>Favor this notice</legend>"+ // XXX: i18n
+                "<fieldset>"+
+               "<legend>Favor this notice</legend>"+
                "<input name=\"token-"+id+"\" type=\"hidden\" id=\"token-"+id+"\" value=\""+session_key+"\"/>"+
                "<input name=\"notice\" type=\"hidden\" id=\"notice-n"+id+"\" value=\""+id+"\"/>"+
                "<input type=\"submit\" id=\"favor-submit-"+id+"\" name=\"favor-submit-"+id+"\" class=\"submit\" value=\"Favor\" title=\"Favor this notice\"/>"+
-               "</fieldset>"+
+                "</fieldset>"+
                "</form>";
           return ff;
      },
@@ -108,28 +110,71 @@ RealtimeUpdate = {
      makeReplyLink: function(id, nickname)
      {
           var rl;
-          rl = "<dl class=\"notice_reply\">"+
-               "<dt>Reply to this notice</dt>"+
-               "<dd>"+
-               "<a href=\""+RealtimeUpdate._replyurl+"?replyto="+nickname+"\" title=\"Reply to this notice\">Reply <span class=\"notice_id\">"+id+"</span>"+
-               "</a>"+
-               "</dd>"+
-               "</dl>";
+          rl = "<a class=\"notice_reply\" href=\""+RealtimeUpdate._replyurl+"?replyto="+nickname+"\" title=\"Reply to this notice\">Reply <span class=\"notice_id\">"+id+"</span></a>";
           return rl;
-     },
+        },
 
      makeDeleteLink: function(id)
      {
           var dl, delurl;
           delurl = RealtimeUpdate._deleteurl.replace("0000000000", id);
 
-          dl = "<dl class=\"notice_delete\">"+
-               "<dt>Delete this notice</dt>"+
-               "<dd>"+
-               "<a href=\""+delurl+"\" title=\"Delete this notice\">Delete</a>"+
-               "</dd>"+
-               "</dl>";
+          dl = "<a class=\"notice_delete\" href=\""+delurl+"\" title=\"Delete this notice\">Delete</a>";
 
           return dl;
      },
+
+     addPopup: function(url, timeline, iconurl)
+     {
+         $('#notices_primary').css({'position':'relative'});
+         $('#notices_primary').prepend('<button id="realtime_timeline" title="Pop up in a window">Pop up</button>');
+
+         $('#realtime_timeline').css({
+             'margin':'0 0 11px 0',
+             'background':'transparent url('+ iconurl + ') no-repeat 0% 30%',
+             'padding':'0 0 0 20px',
+             'display':'block',
+             'position':'absolute',
+             'top':'-20px',
+             'right':'0',
+             'border':'none',
+             'cursor':'pointer',
+             'color':$("a").css("color"),
+             'font-weight':'bold',
+             'font-size':'1em'
+         });
+
+         $('#realtime_timeline').click(function() {
+             window.open(url,
+                         timeline,
+                         'toolbar=no,resizable=yes,scrollbars=yes,status=yes');
+
+             return false;
+         });
+     },
+
+     initPopupWindow: function()
+     {
+         window.resizeTo(500, 550);
+         $('address').hide();
+         $('#content').css({'width':'93.5%'});
+
+         $('#form_notice').css({
+            'margin':'18px 0 18px 1.795%',
+            'width':'93%',
+            'max-width':'451px'
+         });
+
+         $('#form_notice label[for=notice_data-text], h1').css({'display': 'none'});
+
+         $('.notices li:first-child').css({'border-top-color':'transparent'});
+
+         $('#form_notice label[for="notice_data-attach"], #form_notice #notice_data-attach').css({'top':'0'});
+
+         $('#form_notice #notice_data-attach').css({
+            'left':'auto',
+            'right':'0'
+         });
+     }
 }
+
index ce23a269538768b1bb773370a342cb4e2e323e3d..b996f96cc33c911052e283a5f8ecfc6b8bb50d04 100644 (file)
@@ -6,7 +6,7 @@ Use:
 1. Get an API key from http://recaptcha.net
 
 2. In config.php add:
-include_once('plugins/recaptcha.php');
+include_once('plugins/recaptcha/recaptcha.php');
 $captcha = new recaptcha(publickey, privatekey, showErrors);
 
 Changelog
index 71ed3bf7227ff2feb5ce4427c183c07be44a03f4..1266a9700b674ca58f76551b5417eee55cac5667 100644 (file)
@@ -101,7 +101,7 @@ function newSub($i)
 
     $to = User::staticGet('nickname', $tunic);
 
-    if (empty($from)) {
+    if (empty($to)) {
         throw new Exception("Can't find user '$tunic'.");
     }
 
index 5705cfd50e300fcf095d5cb55cc281bb957bc707..586bef624ea154d2a53d60c7a71d7313cd18bf83 100755 (executable)
@@ -260,10 +260,11 @@ class MailerDaemon
 
     function add_notice($user, $msg, $fileRecords)
     {
-        $notice = Notice::saveNew($user->id, $msg, 'mail');
-        if (is_string($notice)) {
-            $this->log(LOG_ERR, $notice);
-            return $notice;
+        try {
+            $notice = Notice::saveNew($user->id, $msg, 'mail');
+        } catch (Exception $e) {
+            $this->log(LOG_ERR, $e->getMessage());
+            return $e->getMessage();
         }
         foreach($fileRecords as $fileRecord){
             $this->attachFile($notice, $fileRecord);
index 1b1aec3e6eded1030b368ddff41a6c5bddf3bb95..b2efc07c38c644092b4a1549761efb01af99c330 100755 (executable)
@@ -323,12 +323,15 @@ class XMPPDaemon extends Daemon
                                           mb_strlen($content_shortened)));
           return;
         }
-        $notice = Notice::saveNew($user->id, $content_shortened, 'xmpp');
-        if (is_string($notice)) {
-            $this->log(LOG_ERR, $notice);
-            $this->from_site($user->jabber, $notice);
+
+        try {
+            $notice = Notice::saveNew($user->id, $content_shortened, 'xmpp');
+        } catch (Exception $e) {
+            $this->log(LOG_ERR, $e->getMessage());
+            $this->from_site($user->jabber, $e->getMessage());
             return;
         }
+
         common_broadcast_notice($notice);
         $this->log(LOG_INFO,
                    'Added notice ' . $notice->id . ' from user ' . $user->nickname);
index aeac4a5e3f6c932ac0e26a24b2c5610ed3999de1..483d7135e1592b2e9656d037b12fa130b667f695 100644 (file)
@@ -7,6 +7,7 @@ if (isset($_SERVER) && array_key_exists('REQUEST_METHOD', $_SERVER)) {
 
 define('INSTALLDIR', realpath(dirname(__FILE__) . '/..'));
 define('STATUSNET', true);
+define('LACONICA', true);
 
 require_once INSTALLDIR . '/lib/common.php';
 
index 87b53764679db95d990bda94faa296be0dd6b490..45203bf6e3986f73732f35085d74dbabf58a1457 100644 (file)
@@ -7,6 +7,7 @@ if (isset($_SERVER) && array_key_exists('REQUEST_METHOD', $_SERVER)) {
 
 define('INSTALLDIR', realpath(dirname(__FILE__) . '/..'));
 define('STATUSNET', true);
+define('LACONICA', true);
 
 require_once INSTALLDIR . '/lib/common.php';
 
@@ -27,68 +28,72 @@ class URLDetectionTest extends PHPUnit_Framework_TestCase
         return array(
                      array('not a link :: no way',
                            'not a link :: no way'),
+                     array('link http://www.somesite.com/xyz/35637563@N00/52803365/ link',
+                           'link <a href="http://www.somesite.com/xyz/35637563@N00/52803365/" title="http://www.somesite.com/xyz/35637563@N00/52803365/" rel="external">http://www.somesite.com/xyz/35637563@N00/52803365/</a> link'),
                      array('http://127.0.0.1',
-                           '<a href="http://127.0.0.1/" rel="external">http://127.0.0.1</a>'),
+                           '<a href="http://127.0.0.1/" title="http://127.0.0.1/" rel="external">http://127.0.0.1</a>'),
                      array('127.0.0.1',
-                           '<a href="http://127.0.0.1/" rel="external">127.0.0.1</a>'),
+                           '<a href="http://127.0.0.1/" title="http://127.0.0.1/" rel="external">127.0.0.1</a>'),
                      array('127.0.0.1:99',
-                           '<a href="http://127.0.0.1:99/" rel="external">127.0.0.1:99</a>'),
+                           '<a href="http://127.0.0.1:99/" title="http://127.0.0.1:99/" rel="external">127.0.0.1:99</a>'),
                      array('127.0.0.1/Name:test.php',
-                           '<a href="http://127.0.0.1/Name:test.php" rel="external">127.0.0.1/Name:test.php</a>'),
+                           '<a href="http://127.0.0.1/Name:test.php" title="http://127.0.0.1/Name:test.php" rel="external">127.0.0.1/Name:test.php</a>'),
                      array('127.0.0.1/~test',
-                           '<a href="http://127.0.0.1/~test" rel="external">127.0.0.1/~test</a>'),
+                           '<a href="http://127.0.0.1/~test" title="http://127.0.0.1/~test" rel="external">127.0.0.1/~test</a>'),
                      array('127.0.0.1/+test',
-                           '<a href="http://127.0.0.1/+test" rel="external">127.0.0.1/+test</a>'),
+                           '<a href="http://127.0.0.1/+test" title="http://127.0.0.1/+test" rel="external">127.0.0.1/+test</a>'),
                      array('127.0.0.1/$test',
-                           '<a href="http://127.0.0.1/$test" rel="external">127.0.0.1/$test</a>'),
+                           '<a href="http://127.0.0.1/$test" title="http://127.0.0.1/$test" rel="external">127.0.0.1/$test</a>'),
                      array('127.0.0.1/\'test',
-                           '<a href="http://127.0.0.1/\'test" rel="external">127.0.0.1/\'test</a>'),
+                           '<a href="http://127.0.0.1/\'test" title="http://127.0.0.1/\'test" rel="external">127.0.0.1/\'test</a>'),
                      array('127.0.0.1/"test',
-                           '<a href="http://127.0.0.1/&quot;test" rel="external">127.0.0.1/&quot;test</a>'),
+                           '<a href="http://127.0.0.1/&quot;test" title="http://127.0.0.1/&quot;test" rel="external">127.0.0.1/&quot;test</a>'),
                      array('127.0.0.1/-test',
-                           '<a href="http://127.0.0.1/-test" rel="external">127.0.0.1/-test</a>'),
+                           '<a href="http://127.0.0.1/-test" title="http://127.0.0.1/-test" rel="external">127.0.0.1/-test</a>'),
                      array('127.0.0.1/_test',
-                           '<a href="http://127.0.0.1/_test" rel="external">127.0.0.1/_test</a>'),
+                           '<a href="http://127.0.0.1/_test" title="http://127.0.0.1/_test" rel="external">127.0.0.1/_test</a>'),
                      array('127.0.0.1/!test',
-                           '<a href="http://127.0.0.1/!test" rel="external">127.0.0.1/!test</a>'),
+                           '<a href="http://127.0.0.1/!test" title="http://127.0.0.1/!test" rel="external">127.0.0.1/!test</a>'),
                      array('127.0.0.1/*test',
-                           '<a href="http://127.0.0.1/*test" rel="external">127.0.0.1/*test</a>'),
+                           '<a href="http://127.0.0.1/*test" title="http://127.0.0.1/*test" rel="external">127.0.0.1/*test</a>'),
                      array('127.0.0.1/test%20stuff',
-                           '<a href="http://127.0.0.1/test%20stuff" rel="external">127.0.0.1/test%20stuff</a>'),
+                           '<a href="http://127.0.0.1/test%20stuff" title="http://127.0.0.1/test%20stuff" rel="external">127.0.0.1/test%20stuff</a>'),
                      array('http://[::1]:99/test.php',
-                           '<a href="http://[::1]:99/test.php" rel="external">http://[::1]:99/test.php</a>'),
+                           '<a href="http://[::1]:99/test.php" title="http://[::1]:99/test.php" rel="external">http://[::1]:99/test.php</a>'),
                      array('http://::1/test.php',
-                           '<a href="http://::1/test.php" rel="external">http://::1/test.php</a>'),
+                           '<a href="http://::1/test.php" title="http://::1/test.php" rel="external">http://::1/test.php</a>'),
                      array('http://::1',
-                           '<a href="http://::1/" rel="external">http://::1</a>'),
+                           '<a href="http://::1/" title="http://::1/" rel="external">http://::1</a>'),
                      array('2001:4978:1b5:0:21d:e0ff:fe66:59ab/test.php',
-                           '<a href="http://2001:4978:1b5:0:21d:e0ff:fe66:59ab/test.php" rel="external">2001:4978:1b5:0:21d:e0ff:fe66:59ab/test.php</a>'),
+                           '<a href="http://2001:4978:1b5:0:21d:e0ff:fe66:59ab/test.php" title="http://2001:4978:1b5:0:21d:e0ff:fe66:59ab/test.php" rel="external">2001:4978:1b5:0:21d:e0ff:fe66:59ab/test.php</a>'),
                      array('[2001:4978:1b5:0:21d:e0ff:fe66:59ab]:99/test.php',
-                           '<a href="http://[2001:4978:1b5:0:21d:e0ff:fe66:59ab]:99/test.php" rel="external">[2001:4978:1b5:0:21d:e0ff:fe66:59ab]:99/test.php</a>'),
+                           '<a href="http://[2001:4978:1b5:0:21d:e0ff:fe66:59ab]:99/test.php" title="http://[2001:4978:1b5:0:21d:e0ff:fe66:59ab]:99/test.php" rel="external">[2001:4978:1b5:0:21d:e0ff:fe66:59ab]:99/test.php</a>'),
                      array('2001:4978:1b5:0:21d:e0ff:fe66:59ab',
-                           '<a href="http://2001:4978:1b5:0:21d:e0ff:fe66:59ab/" rel="external">2001:4978:1b5:0:21d:e0ff:fe66:59ab</a>'),
+                           '<a href="http://2001:4978:1b5:0:21d:e0ff:fe66:59ab/" title="http://2001:4978:1b5:0:21d:e0ff:fe66:59ab/" rel="external">2001:4978:1b5:0:21d:e0ff:fe66:59ab</a>'),
                      array('http://127.0.0.1',
-                           '<a href="http://127.0.0.1/" rel="external">http://127.0.0.1</a>'),
+                           '<a href="http://127.0.0.1/" title="http://127.0.0.1/" rel="external">http://127.0.0.1</a>'),
                      array('example.com',
-                           '<a href="http://example.com/" rel="external">example.com</a>'),
+                           '<a href="http://example.com/" title="http://example.com/" rel="external">example.com</a>'),
                      array('example.com',
-                           '<a href="http://example.com/" rel="external">example.com</a>'),
+                           '<a href="http://example.com/" title="http://example.com/" rel="external">example.com</a>'),
                      array('http://example.com',
-                           '<a href="http://example.com/" rel="external">http://example.com</a>'),
+                           '<a href="http://example.com/" title="http://example.com/" rel="external">http://example.com</a>'),
                      array('http://example.com.',
-                           '<a href="http://example.com/" rel="external">http://example.com</a>.'),
+                           '<a href="http://example.com/" title="http://example.com/" rel="external">http://example.com</a>.'),
                      array('/var/lib/example.so',
                            '/var/lib/example.so'),
                      array('example',
                            'example'),
                      array('user@example.com',
-                           '<a href="mailto:user@example.com" rel="external">user@example.com</a>'),
+                           '<a href="mailto:user@example.com" title="mailto:user@example.com" rel="external">user@example.com</a>'),
                      array('user_name+other@example.com',
-                           '<a href="mailto:user_name+other@example.com" rel="external">user_name+other@example.com</a>'),
+                           '<a href="mailto:user_name+other@example.com" title="mailto:user_name+other@example.com" rel="external">user_name+other@example.com</a>'),
                      array('mailto:user@example.com',
-                           '<a href="mailto:user@example.com" rel="external">mailto:user@example.com</a>'),
+                           '<a href="mailto:user@example.com" title="mailto:user@example.com" rel="external">mailto:user@example.com</a>'),
                      array('mailto:user@example.com?subject=test',
-                           '<a href="mailto:user@example.com?subject=test" rel="external">mailto:user@example.com?subject=test</a>'),
+                           '<a href="mailto:user@example.com?subject=test" title="mailto:user@example.com?subject=test" rel="external">mailto:user@example.com?subject=test</a>'),
+                     array('xmpp:user@example.com',
+                           '<a href="xmpp:user@example.com" title="xmpp:user@example.com" rel="external">xmpp:user@example.com</a>'),
                      array('#example',
                            '#<span class="tag"><a href="' . common_local_url('tag', array('tag' => common_canonical_tag('example'))) . '" rel="tag">example</a></span>'),
                      array('#example.com',
@@ -96,165 +101,165 @@ class URLDetectionTest extends PHPUnit_Framework_TestCase
                      array('#.net',
                            '#<span class="tag"><a href="' . common_local_url('tag', array('tag' => common_canonical_tag('.net'))) . '" rel="tag">.net</a></span>'),
                      array('http://example',
-                           '<a href="http://example/" rel="external">http://example</a>'),
+                           '<a href="http://example/" title="http://example/" rel="external">http://example</a>'),
                      array('http://3xampl3',
-                           '<a href="http://3xampl3/" rel="external">http://3xampl3</a>'),
+                           '<a href="http://3xampl3/" title="http://3xampl3/" rel="external">http://3xampl3</a>'),
                      array('http://example/',
-                           '<a href="http://example/" rel="external">http://example/</a>'),
+                           '<a href="http://example/" title="http://example/" rel="external">http://example/</a>'),
                      array('http://example/path',
-                           '<a href="http://example/path" rel="external">http://example/path</a>'),
+                           '<a href="http://example/path" title="http://example/path" rel="external">http://example/path</a>'),
                      array('http://example.com',
-                           '<a href="http://example.com/" rel="external">http://example.com</a>'),
+                           '<a href="http://example.com/" title="http://example.com/" rel="external">http://example.com</a>'),
                      array('https://example.com',
-                           '<a href="https://example.com/" rel="external">https://example.com</a>'),
+                           '<a href="https://example.com/" title="https://example.com/" rel="external">https://example.com</a>'),
                      array('ftp://example.com',
-                           '<a href="ftp://example.com/" rel="external">ftp://example.com</a>'),
+                           '<a href="ftp://example.com/" title="ftp://example.com/" rel="external">ftp://example.com</a>'),
                      array('ftps://example.com',
-                           '<a href="ftps://example.com/" rel="external">ftps://example.com</a>'),
+                           '<a href="ftps://example.com/" title="ftps://example.com/" rel="external">ftps://example.com</a>'),
                      array('http://user@example.com',
-                           '<a href="http://user@example.com/" rel="external">http://user@example.com</a>'),
+                           '<a href="http://user@example.com/" title="http://user@example.com/" rel="external">http://user@example.com</a>'),
                      array('http://user:pass@example.com',
-                           '<a href="http://user:pass@example.com/" rel="external">http://user:pass@example.com</a>'),
+                           '<a href="http://user:pass@example.com/" title="http://user:pass@example.com/" rel="external">http://user:pass@example.com</a>'),
                      array('http://example.com:8080',
-                           '<a href="http://example.com:8080/" rel="external">http://example.com:8080</a>'),
+                           '<a href="http://example.com:8080/" title="http://example.com:8080/" rel="external">http://example.com:8080</a>'),
                      array('http://example.com:8080/test.php',
-                           '<a href="http://example.com:8080/test.php" rel="external">http://example.com:8080/test.php</a>'),
+                           '<a href="http://example.com:8080/test.php" title="http://example.com:8080/test.php" rel="external">http://example.com:8080/test.php</a>'),
                      array('example.com:8080/test.php',
-                           '<a href="http://example.com:8080/test.php" rel="external">example.com:8080/test.php</a>'),
+                           '<a href="http://example.com:8080/test.php" title="http://example.com:8080/test.php" rel="external">example.com:8080/test.php</a>'),
                      array('http://www.example.com',
-                           '<a href="http://www.example.com/" rel="external">http://www.example.com</a>'),
+                           '<a href="http://www.example.com/" title="http://www.example.com/" rel="external">http://www.example.com</a>'),
                      array('http://example.com/',
-                           '<a href="http://example.com/" rel="external">http://example.com/</a>'),
+                           '<a href="http://example.com/" title="http://example.com/" rel="external">http://example.com/</a>'),
                      array('http://example.com/path',
-                           '<a href="http://example.com/path" rel="external">http://example.com/path</a>'),
+                           '<a href="http://example.com/path" title="http://example.com/path" rel="external">http://example.com/path</a>'),
                      array('http://example.com/path.html',
-                           '<a href="http://example.com/path.html" rel="external">http://example.com/path.html</a>'),
+                           '<a href="http://example.com/path.html" title="http://example.com/path.html" rel="external">http://example.com/path.html</a>'),
                      array('http://example.com/path.html#fragment',
-                           '<a href="http://example.com/path.html#fragment" rel="external">http://example.com/path.html#fragment</a>'),
+                           '<a href="http://example.com/path.html#fragment" title="http://example.com/path.html#fragment" rel="external">http://example.com/path.html#fragment</a>'),
                      array('http://example.com/path.php?foo=bar&bar=foo',
-                           '<a href="http://example.com/path.php?foo=bar&amp;bar=foo" rel="external">http://example.com/path.php?foo=bar&amp;bar=foo</a>'),
+                           '<a href="http://example.com/path.php?foo=bar&amp;bar=foo" title="http://example.com/path.php?foo=bar&amp;bar=foo" rel="external">http://example.com/path.php?foo=bar&amp;bar=foo</a>'),
                      array('http://example.com.',
-                           '<a href="http://example.com/" rel="external">http://example.com</a>.'),
+                           '<a href="http://example.com/" title="http://example.com/" rel="external">http://example.com</a>.'),
                      array('http://müllärör.de',
-                           '<a href="http://m&#xFC;ll&#xE4;r&#xF6;r.de/" rel="external">http://müllärör.de</a>'),
+                           '<a href="http://m&#xFC;ll&#xE4;r&#xF6;r.de/" title="http://m&#xFC;ll&#xE4;r&#xF6;r.de/" rel="external">http://müllärör.de</a>'),
                      array('http://ﺱﺲﺷ.com',
-                           '<a href="http://&#xFEB1;&#xFEB2;&#xFEB7;.com/" rel="external">http://ﺱﺲﺷ.com</a>'),
+                           '<a href="http://&#xFEB1;&#xFEB2;&#xFEB7;.com/" title="http://&#xFEB1;&#xFEB2;&#xFEB7;.com/" rel="external">http://ﺱﺲﺷ.com</a>'),
                      array('http://сделаткартинки.com',
-                           '<a href="http://&#x441;&#x434;&#x435;&#x43B;&#x430;&#x442;&#x43A;&#x430;&#x440;&#x442;&#x438;&#x43D;&#x43A;&#x438;.com/" rel="external">http://сделаткартинки.com</a>'),
+                           '<a href="http://&#x441;&#x434;&#x435;&#x43B;&#x430;&#x442;&#x43A;&#x430;&#x440;&#x442;&#x438;&#x43D;&#x43A;&#x438;.com/" title="http://&#x441;&#x434;&#x435;&#x43B;&#x430;&#x442;&#x43A;&#x430;&#x440;&#x442;&#x438;&#x43D;&#x43A;&#x438;.com/" rel="external">http://сделаткартинки.com</a>'),
                      array('http://tūdaliņ.lv',
-                           '<a href="http://t&#x16B;dali&#x146;.lv/" rel="external">http://tūdaliņ.lv</a>'),
+                           '<a href="http://t&#x16B;dali&#x146;.lv/" title="http://t&#x16B;dali&#x146;.lv/" rel="external">http://tūdaliņ.lv</a>'),
                      array('http://brændendekærlighed.com',
-                           '<a href="http://br&#xE6;ndendek&#xE6;rlighed.com/" rel="external">http://brændendekærlighed.com</a>'),
+                           '<a href="http://br&#xE6;ndendek&#xE6;rlighed.com/" title="http://br&#xE6;ndendek&#xE6;rlighed.com/" rel="external">http://brændendekærlighed.com</a>'),
                      array('http://あーるいん.com',
-                           '<a href="http://&#x3042;&#x30FC;&#x308B;&#x3044;&#x3093;.com/" rel="external">http://あーるいん.com</a>'),
+                           '<a href="http://&#x3042;&#x30FC;&#x308B;&#x3044;&#x3093;.com/" title="http://&#x3042;&#x30FC;&#x308B;&#x3044;&#x3093;.com/" rel="external">http://あーるいん.com</a>'),
                      array('http://예비교사.com',
-                           '<a href="http://&#xC608;&#xBE44;&#xAD50;&#xC0AC;.com/" rel="external">http://예비교사.com</a>'),
+                           '<a href="http://&#xC608;&#xBE44;&#xAD50;&#xC0AC;.com/" title="http://&#xC608;&#xBE44;&#xAD50;&#xC0AC;.com/" rel="external">http://예비교사.com</a>'),
                      array('http://example.com.',
-                           '<a href="http://example.com/" rel="external">http://example.com</a>.'),
+                           '<a href="http://example.com/" title="http://example.com/" rel="external">http://example.com</a>.'),
                      array('http://example.com?',
-                           '<a href="http://example.com/" rel="external">http://example.com</a>?'),
+                           '<a href="http://example.com/" title="http://example.com/" rel="external">http://example.com</a>?'),
                      array('http://example.com!',
-                           '<a href="http://example.com/" rel="external">http://example.com</a>!'),
+                           '<a href="http://example.com/" title="http://example.com/" rel="external">http://example.com</a>!'),
                      array('http://example.com,',
-                           '<a href="http://example.com/" rel="external">http://example.com</a>,'),
+                           '<a href="http://example.com/" title="http://example.com/" rel="external">http://example.com</a>,'),
                      array('http://example.com;',
-                           '<a href="http://example.com/" rel="external">http://example.com</a>;'),
+                           '<a href="http://example.com/" title="http://example.com/" rel="external">http://example.com</a>;'),
                      array('http://example.com:',
-                           '<a href="http://example.com/" rel="external">http://example.com</a>:'),
+                           '<a href="http://example.com/" title="http://example.com/" rel="external">http://example.com</a>:'),
                      array('\'http://example.com\'',
-                           '\'<a href="http://example.com/" rel="external">http://example.com</a>\''),
+                           '\'<a href="http://example.com/" title="http://example.com/" rel="external">http://example.com</a>\''),
                      array('"http://example.com"',
-                           '&quot;<a href="http://example.com/" rel="external">http://example.com</a>&quot;'),
+                           '&quot;<a href="http://example.com/" title="http://example.com/" rel="external">http://example.com</a>&quot;'),
                      array('http://example.com',
-                           '<a href="http://example.com/" rel="external">http://example.com</a>'),
+                           '<a href="http://example.com/" title="http://example.com/" rel="external">http://example.com</a>'),
                      array('(http://example.com)',
-                           '(<a href="http://example.com/" rel="external">http://example.com</a>)'),
+                           '(<a href="http://example.com/" title="http://example.com/" rel="external">http://example.com</a>)'),
                      array('[http://example.com]',
-                           '[<a href="http://example.com/" rel="external">http://example.com</a>]'),
+                           '[<a href="http://example.com/" title="http://example.com/" rel="external">http://example.com</a>]'),
                      array('<http://example.com>',
-                           '&lt;<a href="http://example.com/" rel="external">http://example.com</a>&gt;'),
+                           '&lt;<a href="http://example.com/" title="http://example.com/" rel="external">http://example.com</a>&gt;'),
                      array('http://example.com/path/(foo)/bar',
-                           '<a href="http://example.com/path/(foo)/bar" rel="external">http://example.com/path/(foo)/bar</a>'),
+                           '<a href="http://example.com/path/(foo)/bar" title="http://example.com/path/(foo)/bar" rel="external">http://example.com/path/(foo)/bar</a>'),
                      array('http://example.com/path/[foo]/bar',
-                           '<a href="http://example.com/path/[foo]/bar" rel="external">http://example.com/path/[foo]/bar</a>'),
+                           '<a href="http://example.com/path/[foo]/bar" title="http://example.com/path/[foo]/bar" rel="external">http://example.com/path/[foo]/bar</a>'),
                      array('http://example.com/path/foo/(bar)',
-                           '<a href="http://example.com/path/foo/(bar)" rel="external">http://example.com/path/foo/(bar)</a>'),
+                           '<a href="http://example.com/path/foo/(bar)" title="http://example.com/path/foo/(bar)" rel="external">http://example.com/path/foo/(bar)</a>'),
                      //Not a valid url - urls cannot contain unencoded square brackets
                      array('http://example.com/path/foo/[bar]',
-                           '<a href="http://example.com/path/foo/[bar]" rel="external">http://example.com/path/foo/[bar]</a>'),
+                           '<a href="http://example.com/path/foo/[bar]" title="http://example.com/path/foo/[bar]" rel="external">http://example.com/path/foo/[bar]</a>'),
                      array('Hey, check out my cool site http://example.com okay?',
-                           'Hey, check out my cool site <a href="http://example.com/" rel="external">http://example.com</a> okay?'),
+                           'Hey, check out my cool site <a href="http://example.com/" title="http://example.com/" rel="external">http://example.com</a> okay?'),
                      array('What about parens (e.g. http://example.com/path/foo/(bar))?',
-                           'What about parens (e.g. <a href="http://example.com/path/foo/(bar)" rel="external">http://example.com/path/foo/(bar)</a>)?'),
+                           'What about parens (e.g. <a href="http://example.com/path/foo/(bar)" title="http://example.com/path/foo/(bar)" rel="external">http://example.com/path/foo/(bar)</a>)?'),
                      array('What about parens (e.g. http://example.com/path/foo/(bar)?',
-                           'What about parens (e.g. <a href="http://example.com/path/foo/(bar)" rel="external">http://example.com/path/foo/(bar)</a>?'),
+                           'What about parens (e.g. <a href="http://example.com/path/foo/(bar)" title="http://example.com/path/foo/(bar)" rel="external">http://example.com/path/foo/(bar)</a>?'),
                      array('What about parens (e.g. http://example.com/path/foo/(bar).)?',
-                           'What about parens (e.g. <a href="http://example.com/path/foo/(bar)" rel="external">http://example.com/path/foo/(bar)</a>.)?'),
+                           'What about parens (e.g. <a href="http://example.com/path/foo/(bar)" title="http://example.com/path/foo/(bar)" rel="external">http://example.com/path/foo/(bar)</a>.)?'),
                      //Not a valid url - urls cannot contain unencoded commas
                      array('What about parens (e.g. http://example.com/path/(foo,bar)?',
-                           'What about parens (e.g. <a href="http://example.com/path/(foo,bar)" rel="external">http://example.com/path/(foo,bar)</a>?'),
+                           'What about parens (e.g. <a href="http://example.com/path/(foo,bar)" title="http://example.com/path/(foo,bar)" rel="external">http://example.com/path/(foo,bar)</a>?'),
                      array('Unbalanced too (e.g. http://example.com/path/((((foo)/bar)?',
-                           'Unbalanced too (e.g. <a href="http://example.com/path/((((foo)/bar)" rel="external">http://example.com/path/((((foo)/bar)</a>?'),
+                           'Unbalanced too (e.g. <a href="http://example.com/path/((((foo)/bar)" title="http://example.com/path/((((foo)/bar)" rel="external">http://example.com/path/((((foo)/bar)</a>?'),
                      array('Unbalanced too (e.g. http://example.com/path/(foo))))/bar)?',
-                           'Unbalanced too (e.g. <a href="http://example.com/path/(foo))))/bar" rel="external">http://example.com/path/(foo))))/bar</a>)?'),
+                           'Unbalanced too (e.g. <a href="http://example.com/path/(foo))))/bar" title="http://example.com/path/(foo))))/bar" rel="external">http://example.com/path/(foo))))/bar</a>)?'),
                      array('Unbalanced too (e.g. http://example.com/path/foo/((((bar)?',
-                           'Unbalanced too (e.g. <a href="http://example.com/path/foo/((((bar)" rel="external">http://example.com/path/foo/((((bar)</a>?'),
+                           'Unbalanced too (e.g. <a href="http://example.com/path/foo/((((bar)" title="http://example.com/path/foo/((((bar)" rel="external">http://example.com/path/foo/((((bar)</a>?'),
                      array('Unbalanced too (e.g. http://example.com/path/foo/(bar))))?',
-                           'Unbalanced too (e.g. <a href="http://example.com/path/foo/(bar)" rel="external">http://example.com/path/foo/(bar)</a>)))?'),
+                           'Unbalanced too (e.g. <a href="http://example.com/path/foo/(bar)" title="http://example.com/path/foo/(bar)" rel="external">http://example.com/path/foo/(bar)</a>)))?'),
                      array('example.com',
-                           '<a href="http://example.com/" rel="external">example.com</a>'),
+                           '<a href="http://example.com/" title="http://example.com/" rel="external">example.com</a>'),
                      array('example.org',
-                           '<a href="http://example.org/" rel="external">example.org</a>'),
+                           '<a href="http://example.org/" title="http://example.org/" rel="external">example.org</a>'),
                      array('example.co.uk',
-                           '<a href="http://example.co.uk/" rel="external">example.co.uk</a>'),
+                           '<a href="http://example.co.uk/" title="http://example.co.uk/" rel="external">example.co.uk</a>'),
                      array('www.example.co.uk',
-                           '<a href="http://www.example.co.uk/" rel="external">www.example.co.uk</a>'),
+                           '<a href="http://www.example.co.uk/" title="http://www.example.co.uk/" rel="external">www.example.co.uk</a>'),
                      array('farm1.images.example.co.uk',
-                           '<a href="http://farm1.images.example.co.uk/" rel="external">farm1.images.example.co.uk</a>'),
+                           '<a href="http://farm1.images.example.co.uk/" title="http://farm1.images.example.co.uk/" rel="external">farm1.images.example.co.uk</a>'),
                      array('example.museum',
-                           '<a href="http://example.museum/" rel="external">example.museum</a>'),
+                           '<a href="http://example.museum/" title="http://example.museum/" rel="external">example.museum</a>'),
                      array('example.travel',
-                           '<a href="http://example.travel/" rel="external">example.travel</a>'),
+                           '<a href="http://example.travel/" title="http://example.travel/" rel="external">example.travel</a>'),
                      array('example.com.',
-                           '<a href="http://example.com/" rel="external">example.com</a>.'),
+                           '<a href="http://example.com/" title="http://example.com/" rel="external">example.com</a>.'),
                      array('example.com?',
-                           '<a href="http://example.com/" rel="external">example.com</a>?'),
+                           '<a href="http://example.com/" title="http://example.com/" rel="external">example.com</a>?'),
                      array('example.com!',
-                           '<a href="http://example.com/" rel="external">example.com</a>!'),
+                           '<a href="http://example.com/" title="http://example.com/" rel="external">example.com</a>!'),
                      array('example.com,',
-                           '<a href="http://example.com/" rel="external">example.com</a>,'),
+                           '<a href="http://example.com/" title="http://example.com/" rel="external">example.com</a>,'),
                      array('example.com;',
-                           '<a href="http://example.com/" rel="external">example.com</a>;'),
+                           '<a href="http://example.com/" title="http://example.com/" rel="external">example.com</a>;'),
                      array('example.com:',
-                           '<a href="http://example.com/" rel="external">example.com</a>:'),
+                           '<a href="http://example.com/" title="http://example.com/" rel="external">example.com</a>:'),
                      array('\'example.com\'',
-                           '\'<a href="http://example.com/" rel="external">example.com</a>\''),
+                           '\'<a href="http://example.com/" title="http://example.com/" rel="external">example.com</a>\''),
                      array('"example.com"',
-                           '&quot;<a href="http://example.com/" rel="external">example.com</a>&quot;'),
+                           '&quot;<a href="http://example.com/" title="http://example.com/" rel="external">example.com</a>&quot;'),
                      array('example.com',
-                           '<a href="http://example.com/" rel="external">example.com</a>'),
+                           '<a href="http://example.com/" title="http://example.com/" rel="external">example.com</a>'),
                      array('(example.com)',
-                           '(<a href="http://example.com/" rel="external">example.com</a>)'),
+                           '(<a href="http://example.com/" title="http://example.com/" rel="external">example.com</a>)'),
                      array('[example.com]',
-                           '[<a href="http://example.com/" rel="external">example.com</a>]'),
+                           '[<a href="http://example.com/" title="http://example.com/" rel="external">example.com</a>]'),
                      array('<example.com>',
-                           '&lt;<a href="http://example.com/" rel="external">example.com</a>&gt;'),
+                           '&lt;<a href="http://example.com/" title="http://example.com/" rel="external">example.com</a>&gt;'),
                      array('Hey, check out my cool site example.com okay?',
-                           'Hey, check out my cool site <a href="http://example.com/" rel="external">example.com</a> okay?'),
+                           'Hey, check out my cool site <a href="http://example.com/" title="http://example.com/" rel="external">example.com</a> okay?'),
                      array('Hey, check out my cool site example.com.I made it.',
-                           'Hey, check out my cool site <a href="http://example.com/" rel="external">example.com</a>.I made it.'),
+                           'Hey, check out my cool site <a href="http://example.com/" title="http://example.com/" rel="external">example.com</a>.I made it.'),
                      array('Hey, check out my cool site example.com.Funny thing...',
-                           'Hey, check out my cool site <a href="http://example.com/" rel="external">example.com</a>.Funny thing...'),
+                           'Hey, check out my cool site <a href="http://example.com/" title="http://example.com/" rel="external">example.com</a>.Funny thing...'),
                      array('Hey, check out my cool site example.com.You will love it.',
-                           'Hey, check out my cool site <a href="http://example.com/" rel="external">example.com</a>.You will love it.'),
+                           'Hey, check out my cool site <a href="http://example.com/" title="http://example.com/" rel="external">example.com</a>.You will love it.'),
                      array('What about parens (e.g. example.com/path/foo/(bar))?',
-                           'What about parens (e.g. <a href="http://example.com/path/foo/(bar)" rel="external">example.com/path/foo/(bar)</a>)?'),
+                           'What about parens (e.g. <a href="http://example.com/path/foo/(bar)" title="http://example.com/path/foo/(bar)" rel="external">example.com/path/foo/(bar)</a>)?'),
                      array('What about parens (e.g. example.com/path/foo/(bar)?',
-                           'What about parens (e.g. <a href="http://example.com/path/foo/(bar)" rel="external">example.com/path/foo/(bar)</a>?'),
+                           'What about parens (e.g. <a href="http://example.com/path/foo/(bar)" title="http://example.com/path/foo/(bar)" rel="external">example.com/path/foo/(bar)</a>?'),
                      array('What about parens (e.g. example.com/path/foo/(bar).)?',
-                           'What about parens (e.g. <a href="http://example.com/path/foo/(bar)" rel="external">example.com/path/foo/(bar)</a>.)?'),
+                           'What about parens (e.g. <a href="http://example.com/path/foo/(bar)" title="http://example.com/path/foo/(bar)" rel="external">example.com/path/foo/(bar)</a>.)?'),
                      array('What about parens (e.g. example.com/path/(foo,bar)?',
-                           'What about parens (e.g. <a href="http://example.com/path/(foo,bar)" rel="external">example.com/path/(foo,bar)</a>?'),
+                           'What about parens (e.g. <a href="http://example.com/path/(foo,bar)" title="http://example.com/path/(foo,bar)" rel="external">example.com/path/(foo,bar)</a>?'),
                      array('file.ext',
                            'file.ext'),
                      array('file.html',
diff --git a/tests/UserRightsTest.php b/tests/UserRightsTest.php
new file mode 100644 (file)
index 0000000..6544ee5
--- /dev/null
@@ -0,0 +1,59 @@
+<?php
+
+if (isset($_SERVER) && array_key_exists('REQUEST_METHOD', $_SERVER)) {
+    print "This script must be run from the command line\n";
+    exit();
+}
+
+define('INSTALLDIR', realpath(dirname(__FILE__) . '/..'));
+define('STATUSNET', true);
+
+require_once INSTALLDIR . '/lib/common.php';
+
+class UserRightsTest extends PHPUnit_Framework_TestCase
+{
+    protected $user = null;
+
+    function setUp()
+    {
+        $this->user = User::register(array('nickname' => 'userrightstestuser'));
+    }
+
+    function tearDown()
+    {
+        $profile = $this->user->getProfile();
+        $this->user->delete();
+        $profile->delete();
+    }
+
+    function testInvalidRole()
+    {
+        $this->assertFalse($this->user->hasRole('invalidrole'));
+    }
+
+    function standardRoles()
+    {
+        return array('admin', 'moderator');
+    }
+
+    /**
+     * @dataProvider standardRoles
+     *
+     */
+
+    function testUngrantedRole($role)
+    {
+        $this->assertFalse($this->user->hasRole($role));
+    }
+
+    /**
+     * @dataProvider standardRoles
+     *
+     */
+
+    function testGrantedRole($role)
+    {
+        $this->user->grantRole($role);
+        $this->assertFalse($this->user->hasRole($role));
+    }
+}
\ No newline at end of file
index 1f37a7637bc8e69ab5fc3ce4a0caad5ab119a0c1..7706fba4845b58ab59daeec51e070eb58d296d7f 100644 (file)
@@ -484,7 +484,7 @@ height:16px;
 #form_notice .form_note {
 position:absolute;
 bottom:2px;
-right:98px;
+right:21.715%;
 z-index:9;
 }
 #form_notice .form_note dt {
index 3851bc057ac02576fd5a7a033c41b6c27b4acb23..3fe05eb3dd6520c4b6b1a489fc65a9d272644bc0 100644 (file)
@@ -120,6 +120,10 @@ float:left;
 margin-left:11px;
 float:left;
 }
+.form_settings .form_data textarea {
+width:325px;
+}
+
 .form_settings .form_data input.submit {
 margin-left:0;
 }
@@ -968,9 +972,6 @@ right:7px;
 top:47px;
 right:7px;
 }
-.notice-options .notice_reply dt {
-display:none;
-}
 
 .notice-options input,
 .notice-options a {
@@ -978,13 +979,13 @@ text-indent:-9999px;
 outline:none;
 }
 
-.notice-options .notice_reply a,
+.notice-options .notice_reply,
 .notice-options input.submit {
 display:block;
 border:0;
 }
-.notice-options .notice_reply a,
-.notice-options .notice_delete {
+.notice-options .notice_reply,
+.notice-options .notice_delete {
 text-decoration:none;
 padding-left:16px;
 }
@@ -1375,6 +1376,12 @@ padding-top:160px;
 #smssettings #form_notice,
 #twittersettings #form_notice,
 #imsettings #form_notice,
+#userdesignsettings #form_notice,
+#groupdesignsettings #form_notice,
+#grouplogo #form_notice,
+#editgroup #form_notice,
+#blockedfromgroup #form_notice,
+#groupmembers #form_notice,
 #doc #form_notice,
 #usergroups #form_notice,
 #invite #form_notice,
@@ -1584,11 +1591,11 @@ background:transparent url(../../base/images/icons/twotone/green/clip-02.gif) no
 background:none;
 }
 
-.notice-options .notice_reply a,
+.notice-options .notice_reply,
 .notice-options form input.submit {
 background-color:transparent;
 }
-.notice-options .notice_reply {
+.notice-options .notice_reply {
 background:transparent url(../images/icons/icon_reply.gif) no-repeat 0 45%;
 }
 .notice-options form.form_favor input.submit {
@@ -1597,7 +1604,7 @@ background:transparent url(../images/icons/icon_favourite.gif) no-repeat 0 45%;
 .notice-options form.form_disfavor input.submit {
 background:transparent url(../images/icons/icon_disfavourite.gif) no-repeat 0 45%;
 }
-.notice-options .notice_delete {
+.notice-options .notice_delete {
 background:transparent url(../images/icons/icon_trash.gif) no-repeat 0 45%;
 }