]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/router.php
Merge branch '0.9.x' into pluginize-twitter-bridge
[quix0rs-gnu-social.git] / lib / router.php
index 5e0fcfc9465e0cc2feac4d5e5b612271e3b7ee88..f122c2b6475290fdae4c3ca1a1db3bc30eacfe70 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * Laconica, the distributed open-source microblogging tool
+ * StatusNet, the distributed open-source microblogging tool
  *
  * URL routing utilities
  *
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  *
  * @category  URL
- * @package   Laconica
- * @author    Evan Prodromou <evan@controlyourself.ca>
- * @copyright 2009 Control Yourself, Inc.
+ * @package   StatusNet
+ * @author    Evan Prodromou <evan@status.net>
+ * @copyright 2009 StatusNet, Inc.
  * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
- * @link      http://laconi.ca/
+ * @link      http://status.net/
  */
 
-if (!defined('LACONICA')) {
+if (!defined('STATUSNET') && !defined('LACONICA')) {
     exit(1);
 }
 
@@ -39,10 +39,10 @@ require_once 'Net/URL/Mapper.php';
  * Cheap wrapper around Net_URL_Mapper
  *
  * @category URL
- * @package  Laconica
- * @author   Evan Prodromou <evan@controlyourself.ca>
+ * @package  StatusNet
+ * @author   Evan Prodromou <evan@status.net>
  * @license  http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
- * @link     http://laconi.ca/
+ * @link     http://status.net/
  */
 
 class Router
@@ -50,8 +50,7 @@ class Router
     var $m = null;
     static $inst = null;
     static $bare = array('requesttoken', 'accesstoken', 'userauthorization',
-                         'postnotice', 'updateprofile', 'finishremotesubscribe',
-                         'finishopenidlogin', 'finishaddopenid');
+                         'postnotice', 'updateprofile', 'finishremotesubscribe');
 
     static function get()
     {
@@ -76,7 +75,6 @@ class Router
 
         $m->connect('', array('action' => 'public'));
         $m->connect('rss', array('action' => 'publicrss'));
-        $m->connect('xrds', array('action' => 'publicxrds'));
         $m->connect('featuredrss', array('action' => 'featuredrss'));
         $m->connect('favoritedrss', array('action' => 'favoritedrss'));
         $m->connect('opensearch/people', array('action' => 'opensearch',
@@ -113,6 +111,9 @@ class Router
 
         $m->connect('main/tagother/:id', array('action' => 'tagother'));
 
+        $m->connect('main/oembed',
+                    array('action' => 'oembed'));
+
         // these take a code
 
         foreach (array('register', 'confirmaddress', 'recoverpassword') as $c) {
@@ -121,7 +122,6 @@ class Router
 
         // exceptional
 
-        $m->connect('main/openid', array('action' => 'openidlogin'));
         $m->connect('main/remote', array('action' => 'remotesubscribe'));
         $m->connect('main/remote?nickname=:nickname', array('action' => 'remotesubscribe'), array('nickname' => '[A-Za-z0-9_-]+'));
 
@@ -129,15 +129,10 @@ class Router
             $m->connect('index.php?action=' . $action, array('action' => $action));
         }
 
-        $m->connect('main/:method',
-                    array('action' => 'api',
-                          'method' => 'oembed(.xml|.json)?',
-                          'apiaction' => 'oembed'));
-
         // settings
 
-        foreach (array('profile', 'avatar', 'password', 'openid', 'im',
-                       'email', 'sms', 'twitter', 'userdesign', 'other') as $s) {
+        foreach (array('profile', 'avatar', 'password', 'im',
+                       'email', 'sms', 'userdesign', 'other') as $s) {
             $m->connect('settings/'.$s, array('action' => $s.'settings'));
         }
 
@@ -211,7 +206,7 @@ class Router
                     array('tag' => '[a-zA-Z0-9]+'));
         $m->connect('tag/:tag',
                     array('action' => 'tag'),
-                    array('tag' => '[a-zA-Z0-9]+'));
+                    array('tag' => '[\pL\pN_\-\.]{1,64}'));
 
         $m->connect('peopletag/:tag',
                     array('action' => 'peopletag'),
@@ -393,31 +388,59 @@ class Router
                     array('action' => 'api',
                           'apiaction' => 'help'));
 
-        // laconica
+        // statusnet
 
-        $m->connect('api/laconica/:method',
+        $m->connect('api/statusnet/:method',
                     array('action' => 'api',
-                          'apiaction' => 'laconica'));
+                          'apiaction' => 'statusnet'));
+
+        // For older methods, we provide "laconica" base action
 
         $m->connect('api/laconica/:method',
                     array('action' => 'api',
-                          'apiaction' => 'laconica'));
+                          'apiaction' => 'statusnet'));
+
+        // Groups and tags are newer than 0.8.1 so no backward-compatibility
+        // necessary
 
         // Groups
-        $m->connect('api/laconica/groups/:method/:argument',
+        //'list' has to be handled differently, as php will not allow a method to be named 'list'
+        $m->connect('api/statusnet/groups/list/:argument',
+                    array('action' => 'api',
+                          'method' => 'list_groups',
+                          'apiaction' => 'groups'));
+
+        foreach (array('xml', 'json', 'rss', 'atom') as $e) {
+            $m->connect('api/statusnet/groups/list.' . $e,
+                    array('action' => 'api',
+                          'method' => 'list_groups.' . $e,
+                          'apiaction' => 'groups'));
+        }
+
+        $m->connect('api/statusnet/groups/:method',
+                    array('action' => 'api',
+                          'apiaction' => 'statuses'),
+                    array('method' => '(list_all|)(\.(atom|rss|xml|json))?'));
+
+        $m->connect('api/statuses/:method/:argument',
+                    array('action' => 'api',
+                          'apiaction' => 'statuses'),
+                    array('method' => '(|user_timeline|friends_timeline|replies|mentions|show|destroy|friends|followers)'));
+
+        $m->connect('api/statusnet/groups/:method/:argument',
                     array('action' => 'api',
                           'apiaction' => 'groups'));
 
-        $m->connect('api/laconica/groups/:method',
+        $m->connect('api/statusnet/groups/:method',
                     array('action' => 'api',
                           'apiaction' => 'groups'));
 
         // Tags
-        $m->connect('api/laconica/tags/:method/:argument',
+        $m->connect('api/statusnet/tags/:method/:argument',
                     array('action' => 'api',
                           'apiaction' => 'tags'));
 
-        $m->connect('api/laconica/tags/:method',
+        $m->connect('api/statusnet/tags/:method',
                     array('action' => 'api',
                           'apiaction' => 'tags'));
 
@@ -429,7 +452,7 @@ class Router
         // user stuff
 
         foreach (array('subscriptions', 'subscribers',
-                       'nudge', 'xrds', 'all', 'foaf',
+                       'nudge', 'all', 'foaf', 'xrds',
                        'replies', 'inbox', 'outbox', 'microsummary') as $a) {
             $m->connect(':nickname/'.$a,
                         array('action' => $a),