]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Merge branch 'master' into social-master
authorRoland Häder <haeder@hmmdeutschland.de>
Fri, 9 Jan 2015 08:13:14 +0000 (09:13 +0100)
committerRoland Häder <haeder@hmmdeutschland.de>
Fri, 9 Jan 2015 08:13:14 +0000 (09:13 +0100)
Conflicts:
lib/menu.php
plugins/AccountManager/AccountManagerPlugin.php
plugins/ActivitySpam/ActivitySpamPlugin.php
plugins/BitlyUrl/BitlyUrlPlugin.php
plugins/Blacklist/BlacklistPlugin.php
plugins/Blog/BlogPlugin.php
plugins/Bookmark/BookmarkPlugin.php
plugins/Directory/DirectoryPlugin.php
plugins/Event/EventPlugin.php
plugins/FacebookBridge/FacebookBridgePlugin.php
plugins/GroupPrivateMessage/GroupPrivateMessagePlugin.php
plugins/OStatus/OStatusPlugin.php
plugins/Poll/PollPlugin.php
plugins/QnA/QnAPlugin.php
plugins/Realtime/RealtimePlugin.php
plugins/Sample/SamplePlugin.php
plugins/SearchSub/SearchSubPlugin.php
plugins/Sitemap/SitemapPlugin.php
plugins/SlicedFavorites/SlicedFavoritesPlugin.php
plugins/SubMirror/SubMirrorPlugin.php
plugins/TagSub/TagSubPlugin.php
plugins/TwitterBridge/TwitterBridgePlugin.php
plugins/UserFlag/UserFlagPlugin.php
plugins/YammerImport/YammerImportPlugin.php

Signed-off-by: Roland Häder <haeder@hmmdeutschland.de>
36 files changed:
1  2 
actions/apisearchatom.php
actions/apitimelineuser.php
actions/deleteuser.php
classes/Notice.php
lib/menu.php
lib/router.php
plugins/AccountManager/AccountManagerPlugin.php
plugins/ActivitySpam/ActivitySpamPlugin.php
plugins/BitlyUrl/BitlyUrlPlugin.php
plugins/Blacklist/BlacklistPlugin.php
plugins/Blog/BlogPlugin.php
plugins/Bookmark/BookmarkPlugin.php
plugins/DirectMessage/actions/apidirectmessage.php
plugins/DirectMessage/actions/showmessage.php
plugins/DirectMessage/lib/inboxmessagelist.php
plugins/Directory/DirectoryPlugin.php
plugins/Directory/actions/userdirectory.php
plugins/Event/EventPlugin.php
plugins/ExtendedProfile/ExtendedProfilePlugin.php
plugins/FacebookBridge/FacebookBridgePlugin.php
plugins/GroupPrivateMessage/GroupPrivateMessagePlugin.php
plugins/LinkPreview/LinkPreviewPlugin.php
plugins/ModPlus/ModPlusPlugin.php
plugins/OStatus/OStatusPlugin.php
plugins/OStatus/classes/Ostatus_profile.php
plugins/OpenID/OpenIDPlugin.php
plugins/Poll/PollPlugin.php
plugins/QnA/QnAPlugin.php
plugins/Sample/SamplePlugin.php
plugins/SearchSub/SearchSubPlugin.php
plugins/Sitemap/SitemapPlugin.php
plugins/SlicedFavorites/SlicedFavoritesPlugin.php
plugins/SubMirror/SubMirrorPlugin.php
plugins/TagSub/TagSubPlugin.php
plugins/TwitterBridge/TwitterBridgePlugin.php
plugins/UserFlag/UserFlagPlugin.php

Simple merge
Simple merge
Simple merge
Simple merge
diff --cc lib/menu.php
index 46e160562ac922f1f83f366195bc6fdde97378ad,27503aa06bf59d4e48dc67e1dd57909342031680..b9dfb88c7327570bfb8dac300aaa84cb686cf5c3
@@@ -107,8 -103,8 +107,8 @@@ class Menu extends Widge
              Event::handle('EndNav', array($this, $tag, $items));
          }
      }
 -    
 +
-     function item($actionName, $args, $label, $description, $id=null, $cls=null)
+     function item($actionName, array $args, $label, $description, $id=null, $cls=null)
      {
          if (empty($id)) {
              $id = $this->menuItemID($actionName, $args);
  
          return true;
      }
--    
++
      function menuItemID($actionName, $args = null)
      {
          $id = sprintf('nav_%s', $actionName);
--        
++
          if (!is_null($args)) {
              foreach ($args as $key => $value) {
                  $id .= '_' . $key . '_' . $value;
diff --cc lib/router.php
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
index 0000000000000000000000000000000000000000,c18559f49daaf1a4419e7ff53923c1b9e11f99cb..294f600deff3467c751e0cbdda5cf9370af9b5e6
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,463 +1,463 @@@
 -    function prepare($args)
+ <?php
+ /**
+  * StatusNet, the distributed open-source microblogging tool
+  *
+  * Show a the direct messages from or to a user
+  *
+  * 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  API
+  * @package   StatusNet
+  * @author    Adrian Lang <mail@adrianlang.de>
+  * @author    Evan Prodromou <evan@status.net>
+  * @author    Robin Millette <robin@millette.info>
+  * @author    Zach Copley <zach@status.net>
+  * @copyright 2009 StatusNet, Inc.
+  * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+  * @link      http://status.net/
+  */
+ if (!defined('STATUSNET')) {
+     exit(1);
+ }
+ /**
+  * Show a list of direct messages from or to the authenticating user
+  *
+  * @category API
+  * @package  StatusNet
+  * @author   Adrian Lang <mail@adrianlang.de>
+  * @author   Evan Prodromou <evan@status.net>
+  * @author   Robin Millette <robin@millette.info>
+  * @author   Zach Copley <zach@status.net>
+  * @license  http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+  * @link     http://status.net/
+  */
+ class ApiDirectMessageAction extends ApiAuthAction
+ {
+     var $messages     = null;
+     var $title        = null;
+     var $subtitle     = null;
+     var $link         = null;
+     var $selfuri_base = null;
+     var $id           = null;
+     /**
+      * Take arguments for running
+      *
+      * @param array $args $_REQUEST args
+      *
+      * @return boolean success flag
+      */
 -    function handle($args)
++    function prepare(array $args=array())
+     {
+         parent::prepare($args);
+         $this->user = $this->auth_user;
+         if (empty($this->user)) {
+             // TRANS: Client error given when a user was not found (404).
+             $this->clientError(_('No such user.'), 404);
+         }
+         $server   = common_root_url();
+         $taguribase = TagURI::base();
+         if ($this->arg('sent')) {
+             // Action was called by /api/direct_messages/sent.format
+             $this->title = sprintf(
+                 // TRANS: Title. %s is a user nickname.
+                 _("Direct messages from %s"),
+                 $this->user->nickname
+             );
+             $this->subtitle = sprintf(
+                 // TRANS: Subtitle. %s is a user nickname.
+                 _("All the direct messages sent from %s"),
+                 $this->user->nickname
+             );
+             $this->link = $server . $this->user->nickname . '/outbox';
+             $this->selfuri_base = common_root_url() . 'api/direct_messages/sent';
+             $this->id = "tag:$taguribase:SentDirectMessages:" . $this->user->id;
+         } else {
+             $this->title = sprintf(
+                 // TRANS: Title. %s is a user nickname.
+                 _("Direct messages to %s"),
+                 $this->user->nickname
+             );
+             $this->subtitle = sprintf(
+                 // TRANS: Subtitle. %s is a user nickname.
+                 _("All the direct messages sent to %s"),
+                 $this->user->nickname
+             );
+             $this->link = $server . $this->user->nickname . '/inbox';
+             $this->selfuri_base = common_root_url() . 'api/direct_messages';
+             $this->id = "tag:$taguribase:DirectMessages:" . $this->user->id;
+         }
+         $this->messages = $this->getMessages();
+         return true;
+     }
+     /**
+      * Handle the request
+      *
+      * Show the messages
+      *
+      * @param array $args $_REQUEST data (unused)
+      *
+      * @return void
+      */
 -    function isReadOnly($args)
++    function handle(array $args=array())
+     {
+         parent::handle($args);
+         $this->showMessages();
+     }
+     /**
+      * Show the messages
+      *
+      * @return void
+      */
+     function showMessages()
+     {
+         switch($this->format) {
+         case 'xml':
+             $this->showXmlDirectMessages();
+             break;
+         case 'rss':
+             $this->showRssDirectMessages();
+             break;
+         case 'atom':
+             $this->showAtomDirectMessages();
+             break;
+         case 'json':
+             $this->showJsonDirectMessages();
+             break;
+         default:
+             // TRANS: Client error displayed when coming across a non-supported API method.
+             $this->clientError(_('API method not found.'), $code = 404);
+             break;
+         }
+     }
+     /**
+      * Get notices
+      *
+      * @return array notices
+      */
+     function getMessages()
+     {
+         $message  = new Message();
+         if ($this->arg('sent')) {
+             $message->from_profile = $this->user->id;
+         } else {
+             $message->to_profile = $this->user->id;
+         }
+         if (!empty($this->max_id)) {
+             $message->whereAdd('id <= ' . $this->max_id);
+         }
+         if (!empty($this->since_id)) {
+             $message->whereAdd('id > ' . $this->since_id);
+         }
+         $message->orderBy('created DESC, id DESC');
+         $message->limit((($this->page - 1) * $this->count), $this->count);
+         $message->find();
+         $messages = array();
+         while ($message->fetch()) {
+             $messages[] = clone($message);
+         }
+         return $messages;
+     }
+     /**
+      * Is this action read only?
+      *
+      * @param array $args other arguments
+      *
+      * @return boolean true
+      */
++    function isReadOnly(array $args=array())
+     {
+         return true;
+     }
+     /**
+      * When was this notice last modified?
+      *
+      * @return string datestamp of the latest notice in the stream
+      */
+     function lastModified()
+     {
+         if (!empty($this->messages)) {
+             return strtotime($this->messages[0]->created);
+         }
+         return null;
+     }
+     // BEGIN import from lib/apiaction.php
+     function showSingleXmlDirectMessage($message)
+     {
+         $this->initDocument('xml');
+         $dmsg = $this->directMessageArray($message);
+         $this->showXmlDirectMessage($dmsg, true);
+         $this->endDocument('xml');
+     }
+     function showSingleJsonDirectMessage($message)
+     {
+         $this->initDocument('json');
+         $dmsg = $this->directMessageArray($message);
+         $this->showJsonObjects($dmsg);
+         $this->endDocument('json');
+     }
+     function showXmlDirectMessage($dm, $namespaces=false)
+     {
+         $attrs = array();
+         if ($namespaces) {
+             $attrs['xmlns:statusnet'] = 'http://status.net/schema/api/1/';
+         }
+         $this->elementStart('direct_message', $attrs);
+         foreach($dm as $element => $value) {
+             switch ($element) {
+             case 'sender':
+             case 'recipient':
+                 $this->showTwitterXmlUser($value, $element);
+                 break;
+             case 'text':
+                 $this->element($element, null, common_xml_safe_str($value));
+                 break;
+             default:
+                 $this->element($element, null, $value);
+                 break;
+             }
+         }
+         $this->elementEnd('direct_message');
+     }
+     function directMessageArray($message)
+     {
+         $dmsg = array();
+         $from_profile = $message->getFrom();
+         $to_profile = $message->getTo();
+         $dmsg['id'] = intval($message->id);
+         $dmsg['sender_id'] = intval($from_profile->id);
+         $dmsg['text'] = trim($message->content);
+         $dmsg['recipient_id'] = intval($to_profile->id);
+         $dmsg['created_at'] = $this->dateTwitter($message->created);
+         $dmsg['sender_screen_name'] = $from_profile->nickname;
+         $dmsg['recipient_screen_name'] = $to_profile->nickname;
+         $dmsg['sender'] = $this->twitterUserArray($from_profile, false);
+         $dmsg['recipient'] = $this->twitterUserArray($to_profile, false);
+         return $dmsg;
+     }
+     function rssDirectMessageArray($message)
+     {
+         $entry = array();
+         $from = $message->getFrom();
+         $entry['title'] = sprintf('Message from %1$s to %2$s',
+             $from->nickname, $message->getTo()->nickname);
+         $entry['content'] = common_xml_safe_str($message->rendered);
+         $entry['link'] = common_local_url('showmessage', array('message' => $message->id));
+         $entry['published'] = common_date_iso8601($message->created);
+         $taguribase = TagURI::base();
+         $entry['id'] = "tag:$taguribase:$entry[link]";
+         $entry['updated'] = $entry['published'];
+         $entry['author-name'] = $from->getBestName();
+         $entry['author-uri'] = $from->homepage;
+         $entry['avatar'] = $from->avatarUrl(AVATAR_STREAM_SIZE);
+         try {
+             $avatar = $from->getAvatar(AVATAR_STREAM_SIZE);
+             $entry['avatar-type'] = $avatar->mediatype;
+         } catch (Exception $e) {
+             $entry['avatar-type'] = 'image/png';
+         }
+         // RSS item specific
+         $entry['description'] = $entry['content'];
+         $entry['pubDate'] = common_date_rfc2822($message->created);
+         $entry['guid'] = $entry['link'];
+         return $entry;
+     }
+     // END import from lib/apiaction.php
+     /**
+      * Shows a list of direct messages as Twitter-style XML array
+      *
+      * @return void
+      */
+     function showXmlDirectMessages()
+     {
+         $this->initDocument('xml');
+         $this->elementStart('direct-messages', array('type' => 'array',
+                                                      'xmlns:statusnet' => 'http://status.net/schema/api/1/'));
+         foreach ($this->messages as $m) {
+             $dm_array = $this->directMessageArray($m);
+             $this->showXmlDirectMessage($dm_array);
+         }
+         $this->elementEnd('direct-messages');
+         $this->endDocument('xml');
+     }
+     /**
+      * Shows a list of direct messages as a JSON encoded array
+      *
+      * @return void
+      */
+     function showJsonDirectMessages()
+     {
+         $this->initDocument('json');
+         $dmsgs = array();
+         foreach ($this->messages as $m) {
+             $dm_array = $this->directMessageArray($m);
+             array_push($dmsgs, $dm_array);
+         }
+         $this->showJsonObjects($dmsgs);
+         $this->endDocument('json');
+     }
+     /**
+      * Shows a list of direct messages as RSS items
+      *
+      * @return void
+      */
+     function showRssDirectMessages()
+     {
+         $this->initDocument('rss');
+         $this->element('title', null, $this->title);
+         $this->element('link', null, $this->link);
+         $this->element('description', null, $this->subtitle);
+         $this->element('language', null, 'en-us');
+         $this->element(
+             'atom:link',
+             array(
+                 'type' => 'application/rss+xml',
+                 'href' => $this->selfuri_base . '.rss',
+                 'rel' => self
+                 ),
+             null
+         );
+         $this->element('ttl', null, '40');
+         foreach ($this->messages as $m) {
+             $entry = $this->rssDirectMessageArray($m);
+             $this->showTwitterRssItem($entry);
+         }
+         $this->endTwitterRss();
+     }
+     /**
+      * Shows a list of direct messages as Atom entries
+      *
+      * @return void
+      */
+     function showAtomDirectMessages()
+     {
+         $this->initDocument('atom');
+         $this->element('title', null, $this->title);
+         $this->element('id', null, $this->id);
+         $selfuri = common_root_url() . 'api/direct_messages.atom';
+         $this->element(
+             'link', array(
+             'href' => $this->link,
+             'rel' => 'alternate',
+             'type' => 'text/html'),
+             null
+         );
+         $this->element(
+             'link', array(
+             'href' => $this->selfuri_base . '.atom', 'rel' => 'self',
+             'type' => 'application/atom+xml'),
+             null
+         );
+         $this->element('updated', null, common_date_iso8601('now'));
+         $this->element('subtitle', null, $this->subtitle);
+         foreach ($this->messages as $m) {
+             $entry = $this->rssDirectMessageArray($m);
+             $this->showTwitterAtomEntry($entry);
+         }
+         $this->endDocument('atom');
+     }
+     /**
+      * An entity tag for this notice
+      *
+      * Returns an Etag based on the action name, language, and
+      * timestamps of the notice
+      *
+      * @return string etag
+      */
+     function etag()
+     {
+         if (!empty($this->messages)) {
+             $last = count($this->messages) - 1;
+             return '"' . implode(
+                 ':',
+                 array($this->arg('action'),
+                       common_user_cache_hash($this->auth_user),
+                       common_language(),
+                       strtotime($this->messages[0]->created),
+                       strtotime($this->messages[$last]->created)
+                 )
+             )
+             . '"';
+         }
+         return null;
+     }
+ }
index 0000000000000000000000000000000000000000,86fbee8b73f95c303ac21f477da1a474d997b00c..0987ee3aa76d7d0f799c76ed9c2e4ec6bf4610a3
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,163 +1,163 @@@
 -    function prepare($args)
+ <?php
+ /**
+  * StatusNet, the distributed open-source microblogging tool
+  *
+  * Show a single message
+  *
+  * 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>
+  * @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);
+ }
+ /**
+  * Show a single message
+  *
+  * @category Personal
+  * @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 ShowmessageAction extends Action
+ {
+     /**
+      * Message object to show
+      */
+     var $message = null;
+     /**
+      * The current user
+      */
+     var $user = null;
+     /**
+      * Load attributes based on database arguments
+      *
+      * Loads all the DB stuff
+      *
+      * @param array $args $_REQUEST array
+      *
+      * @return success flag
+      */
 -    function handle($args)
++    function prepare(array $args=array())
+     {
+         parent::prepare($args);
+         $this->page = 1;
+         $id            = $this->trimmed('message');
+         $this->message = Message::getKV('id', $id);
+         if (!$this->message) {
+             // TRANS: Client error displayed requesting a single message that does not exist.
+             $this->clientError(_('No such message.'), 404);
+         }
+         $this->user = common_current_user();
+         if (empty($this->user) ||
+             ($this->user->id != $this->message->from_profile &&
+              $this->user->id != $this->message->to_profile)) {
+             // TRANS: Client error displayed requesting a single direct message the requesting user was not a party in.
+             throw new ClientException(_('Only the sender and recipient ' .
+                                         'may read this message.'), 403);
+         }
+         return true;
+     }
 -    function isReadOnly($args)
++    function handle(array $args=array())
+     {
+         $this->showPage();
+     }
+     function title()
+     {
+         if ($this->user->id == $this->message->from_profile) {
+             $to = $this->message->getTo();
+             // @todo FIXME: Might be nice if the timestamp could be localised.
+             // TRANS: Page title for single direct message display when viewing user is the sender.
+             // TRANS: %1$s is the addressed user's nickname, $2$s is a timestamp.
+             return sprintf(_('Message to %1$s on %2$s'),
+                              $to->nickname,
+                              common_exact_date($this->message->created));
+         } else if ($this->user->id == $this->message->to_profile) {
+             $from = $this->message->getFrom();
+             // @todo FIXME: Might be nice if the timestamp could be localised.
+             // TRANS: Page title for single message display.
+             // TRANS: %1$s is the sending user's nickname, $2$s is a timestamp.
+             return sprintf(_('Message from %1$s on %2$s'),
+                              $from->nickname,
+                              common_exact_date($this->message->created));
+         }
+     }
+     function showContent()
+     {
+         $this->elementStart('ul', 'notices messages');
+         $ml = new ShowMessageListItem($this, $this->message, $this->user);
+         $ml->show();
+         $this->elementEnd('ul');
+     }
++    function isReadOnly(array $args=array())
+     {
+         return true;
+     }
+     /**
+      * Don't show aside
+      *
+      * @return void
+      */
+     function showAside() {
+     }
+ }
+ class ShowMessageListItem extends MessageListItem
+ {
+     var $user;
+     function __construct($out, $message, $user)
+     {
+         parent::__construct($out, $message);
+         $this->user = $user;
+     }
+     function getMessageProfile()
+     {
+         if ($this->user->id == $this->message->from_profile) {
+             return $this->message->getTo();
+         } else if ($this->user->id == $this->message->to_profile) {
+             return $this->message->getFrom();
+         } else {
+             // This shouldn't happen
+             return null;
+         }
+     }
+ }
index 0000000000000000000000000000000000000000,3c7281e9852121d2b948b39eac803d092058e313..bc5ff76661a67925f47538d52cdcbcc0362effc3
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,167 +1,167 @@@
 -    function prepare($args)
+ <?php
+ /**
+  * StatusNet, the distributed open-source microblogging tool
+  *
+  * common superclass for direct messages inbox and outbox
+  *
+  * 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  Message
+  * @package   StatusNet
+  * @author    Evan Prodromou <evan@status.net>
+  * @copyright 2008 StatusNet, Inc.
+  * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+  * @link      http://status.net/
+  */
+ if (!defined('STATUSNET') && !defined('LACONICA')) {
+     exit(1);
+ }
+ /**
+  * common superclass for direct messages inbox and outbox
+  *
+  * @category Message
+  * @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/
+  * @see      InboxAction
+  * @see      OutboxAction
+  */
+ class MailboxAction extends Action
+ {
+     var $page = null;
 -    function handle($args)
++    function prepare(array $args=array())
+     {
+         parent::prepare($args);
+         $nickname   = common_canonical_nickname($this->arg('nickname'));
+         $this->user = User::getKV('nickname', $nickname);
+         $this->page = $this->trimmed('page');
+         if (!$this->page) {
+             $this->page = 1;
+         }
+         common_set_returnto($this->selfUrl());
+         return true;
+     }
+     /**
+      * output page based on arguments
+      *
+      * @param array $args HTTP arguments (from $_REQUEST)
+      *
+      * @return void
+      */
 -    function isReadOnly($args)
++    function handle(array $args=array())
+     {
+         parent::handle($args);
+         if (!$this->user) {
+             // TRANS: Client error displayed when trying to access a mailbox without providing a user.
+             $this->clientError(_('No such user.'), 404);
+         }
+         $cur = common_current_user();
+         if (!$cur || $cur->id != $this->user->id) {
+             // TRANS: Client error displayed when trying to access a mailbox that is not of the logged in user.
+             $this->clientError(_('Only the user can read their own mailboxes.'), 403);
+         }
+         $this->showPage();
+     }
+     function showNoticeForm()
+     {
+         $message_form = new MessageForm($this);
+         $message_form->show();
+     }
+     function showContent()
+     {
+         $message = $this->getMessages();
+         if ($message) {
+             $ml = $this->getMessageList($message);
+             $cnt = $ml->show();
+             $this->pagination($this->page > 1,
+                               $cnt > MESSAGES_PER_PAGE,
+                               $this->page,
+                               $this->trimmed('action'),
+                               array('nickname' => $this->user->nickname));
+         } else {
+             $this->element('p',
+                            'guide',
+                            // TRANS: Message displayed when there are no private messages in the inbox of a user.
+                            _('You have no private messages. '.
+                              'You can send private message to engage other users in conversation. '.
+                              'People can send you messages for your eyes only.'));
+         }
+     }
+     function getMessages()
+     {
+         return null;
+     }
+     function getMessageList($message)
+     {
+         return null;
+     }
+     /**
+      * Show the page notice
+      *
+      * Shows instructions for the page
+      *
+      * @return void
+      */
+     function showPageNotice()
+     {
+         $instr  = $this->getInstructions();
+         $output = common_markup_to_html($instr);
+         $this->elementStart('div', 'instructions');
+         $this->raw($output);
+         $this->elementEnd('div');
+     }
+     /**
+      * Mailbox actions are read only
+      *
+      * @param array $args other arguments
+      *
+      * @return boolean
+      */
++    function isReadOnly(array $args=array())
+     {
+          return true;
+     }
+     function showObjectNav()
+     {
+         $mm = new MailboxMenu($this);
+         $mm->show();
+     }
+ }
index 5e1388f19fc22cf1733b328404f30e55177600de,7ac0f9326588684d1dc61b9d383f7db513f7251c..bb4101139f15e9de459876c1b88591aa980a2fc5
@@@ -76,15 -76,44 +76,43 @@@ class DirectoryPlugin extends Plugi
       * @return boolean hook value; true means continue processing,
       *         false means stop.
       */
-     function onRouterInitialized(URLMapper $m)
+     public function onRouterInitialized(URLMapper $m)
      {
  
 -            array('filter' => '[0-9a-zA-Z]|(0-9)'),            
+         $m->connect(
+             'directory/users/:filter/sort_by/:sort/reverse/:reverse',
+             array('action' => 'userdirectory'),
 -            array('reverse' => '[0-9]')                        
++            array('filter' => '[0-9a-zA-Z]|(0-9)'),
+             array('sort' => '[a-z]+'),
 -            array('filter' => '[0-9a-zA-Z]|(0-9)'),            
 -            array('sort' => '[a-z]+')            
 -        );  
 -
++            array('reverse' => '[0-9]')
+         );
+         $m->connect(
+             'directory/users/:filter/sort_by/:sort',
+             array('action' => 'userdirectory'),
++            array('filter' => '[0-9a-zA-Z]|(0-9)'),
++            array('sort' => '[a-z]+')
++        );
          $m->connect(
              'directory/users/:filter',
              array('action' => 'userdirectory'),
              array('filter' => '[0-9a-zA-Z]|(0-9)')
          );
 -        
 +
+         $m->connect(
+             'directory/users/sort_by/:sort/reverse/:reverse',
+             array('action' => 'userdirectory'),
+             array('sort' => '[a-z]+'),
 -            array('reverse' => '[0-9]')                        
++            array('reverse' => '[0-9]')
+         );
+         $m->connect(
+             'directory/users/sort_by/:sort',
+             array('action' => 'userdirectory'),
 -            array('sort' => '[a-z]+')            
 -        );        
++            array('sort' => '[a-z]+')
++        );
          $m->connect(
              'directory/users',
              array('action' => 'userdirectory')
              array('action' => 'groupdirectory')
          );
  
 -
+         $m->connect(
+             'groups/all',
+             array('action' => 'groupdirectory')
+         );
          return true;
      }
  
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge