]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/router.php
Qvitter API changes (thanks hannes2peer)
[quix0rs-gnu-social.git] / lib / router.php
index fa34b17537f335e50b9c4ab21d73ff318e7ee58e..0d38d448359f9320b0b76b286a4651d905bd7957 100644 (file)
@@ -124,6 +124,20 @@ class Router
                         array('user_id' => '[0-9]+',
                               'token' => '.+'));
 
+            // these take a code; before the main part
+
+            foreach (array('register', 'confirmaddress', 'recoverpassword') as $c) {
+                $m->connect('main/'.$c.'/:code', array('action' => $c));
+            }
+
+            // Also need a block variant accepting ID on URL for mail links
+            $m->connect('main/block/:profileid',
+                        array('action' => 'block'),
+                        array('profileid' => '[0-9]+'));
+
+            $m->connect('main/sup/:seconds', array('action' => 'sup'),
+                        array('seconds' => '[0-9]+'));
+
             // main stuff is repetitive
 
             $main = array('login', 'logout', 'register', 'subscribe',
@@ -142,39 +156,23 @@ class Router
                           'backupaccount',
                           'deleteaccount',
                           'restoreaccount',
+                          'top',
             );
 
             foreach ($main as $a) {
                 $m->connect('main/'.$a, array('action' => $a));
             }
 
-            // Also need a block variant accepting ID on URL for mail links
-            $m->connect('main/block/:profileid',
-                        array('action' => 'block'),
-                        array('profileid' => '[0-9]+'));
-
-            $m->connect('main/sup/:seconds', array('action' => 'sup'),
-                        array('seconds' => '[0-9]+'));
-
-            $m->connect('main/tagprofile', array('action' => 'tagprofile'));
             $m->connect('main/tagprofile/:id', array('action' => 'tagprofile'),
                                                array('id' => '[0-9]+'));
 
+            $m->connect('main/tagprofile', array('action' => 'tagprofile'));
+
             $m->connect('main/oembed',
                         array('action' => 'oembed'));
 
             $m->connect('main/xrds',
                         array('action' => 'publicxrds'));
-            $m->connect('.well-known/host-meta',
-                        array('action' => 'hostmeta'));
-            $m->connect('main/xrd',
-                        array('action' => 'userxrd'));
-
-            // these take a code
-
-            foreach (array('register', 'confirmaddress', 'recoverpassword') as $c) {
-                $m->connect('main/'.$c.'/:code', array('action' => $c));
-            }
 
             // settings
 
@@ -183,6 +181,10 @@ class Router
                 $m->connect('settings/'.$s, array('action' => $s.'settings'));
             }
 
+            if (common_config('oldschool', 'enabled')) {
+                $m->connect('settings/oldschool', array('action' => 'oldschoolsettings'));
+            }
+
             $m->connect('settings/oauthapps/show/:id',
                         array('action' => 'showapplication'),
                         array('id' => '[0-9]+')
@@ -202,18 +204,18 @@ class Router
             // search
 
             foreach (array('group', 'people', 'notice') as $s) {
-                $m->connect('search/'.$s, array('action' => $s.'search'));
                 $m->connect('search/'.$s.'?q=:q',
                             array('action' => $s.'search'),
                             array('q' => '.+'));
+                $m->connect('search/'.$s, array('action' => $s.'search'));
             }
 
             // The second of these is needed to make the link work correctly
             // when inserted into the page. The first is needed to match the
             // route on the way in. Seems to be another Net_URL_Mapper bug to me.
-            $m->connect('search/notice/rss', array('action' => 'noticesearchrss'));
             $m->connect('search/notice/rss?q=:q', array('action' => 'noticesearchrss'),
                         array('q' => '.+'));
+            $m->connect('search/notice/rss', array('action' => 'noticesearchrss'));
 
             $m->connect('attachment/:attachment',
                         array('action' => 'attachment'),
@@ -273,10 +275,12 @@ class Router
                         array('action' => 'userbyid'),
                         array('id' => '[0-9]+'));
 
-            $m->connect('tags/', array('action' => 'publictagcloud'));
-            $m->connect('tag/', array('action' => 'publictagcloud'));
-            $m->connect('tags', array('action' => 'publictagcloud'));
-            $m->connect('tag', array('action' => 'publictagcloud'));
+            if (!common_config('performance', 'high')) {
+                $m->connect('tags/', array('action' => 'publictagcloud'));
+                $m->connect('tag/', array('action' => 'publictagcloud'));
+                $m->connect('tags', array('action' => 'publictagcloud'));
+                $m->connect('tag', array('action' => 'publictagcloud'));
+            }
             $m->connect('tag/:tag/rss',
                         array('action' => 'tagrss'),
                         array('tag' => self::REGEX_TAG));
@@ -327,6 +331,10 @@ class Router
                         array('action' => 'showgroup'),
                         array('nickname' => Nickname::DISPLAY_FMT));
 
+            $m->connect('group/:nickname/',
+                        array('action' => 'showgroup'),
+                        array('nickname' => Nickname::DISPLAY_FMT));
+
             $m->connect('group/', array('action' => 'groups'));
             $m->connect('group', array('action' => 'groups'));
             $m->connect('groups/', array('action' => 'groups'));
@@ -452,6 +460,41 @@ class Router
                               'id' => '[0-9]+',
                               'format' => '(xml|json)'));
 
+            // START qvitter API additions
+
+            $m->connect('api/statuses/favs/:id.json',
+                array('action' => 'ApiStatusesFavs',
+                'id' => '[0-9]+'));
+            
+            $m->connect('api/attachment/:id.json',
+                array('action' => 'ApiAttachment',
+                'id' => '[0-9]+'));
+            
+            $m->connect('api/checkhub.json',
+                array('action' => 'ApiCheckHub'));
+            
+            $m->connect('api/externalprofile/show.json',
+                array('action' => 'ApiExternalProfileShow'));
+
+            $m->connect('api/statusnet/groups/admins/:id.:format',
+                array('action' => 'ApiGroupAdmins',
+                    'id' => Nickname::INPUT_FMT,
+                    'format' => '(xml|json)'));
+            
+            $m->connect('api/account/update_link_color.json',
+                array('action' => 'ApiAccountUpdateLinkColor'));
+                
+            $m->connect('api/account/update_background_color.json',
+                array('action' => 'ApiAccountUpdateBackgroundColor'));
+
+            $m->connect('api/account/register.json',
+                array('action' => 'ApiAccountRegister'));
+            
+            $m->connect('api/check_nickname.json',
+                array('action' => 'ApiCheckNickname'));
+
+            // END qvitter API additions
+
             // users
 
             $m->connect('api/users/show/:id.:format',
@@ -765,6 +808,7 @@ class Router
             // Tags
             $m->connect('api/statusnet/tags/timeline/:tag.:format',
                         array('action' => 'ApiTimelineTag',
+                              'tag'    => self::REGEX_TAG,
                               'format' => '(xml|json|rss|atom|as)'));
 
             // media related
@@ -779,13 +823,13 @@ class Router
             $m->connect('api/trends.json', array('action' => 'ApiTrends'));
 
             $m->connect('api/oauth/request_token',
-                        array('action' => 'ApiOauthRequestToken'));
+                        array('action' => 'ApiOAuthRequestToken'));
 
             $m->connect('api/oauth/access_token',
-                        array('action' => 'ApiOauthAccessToken'));
+                        array('action' => 'ApiOAuthAccessToken'));
 
             $m->connect('api/oauth/authorize',
-                        array('action' => 'ApiOauthAuthorize'));
+                        array('action' => 'ApiOAuthAuthorize'));
 
             // Admin
 
@@ -810,6 +854,22 @@ class Router
                         array('action' => 'getfile'),
                         array('filename' => '[A-Za-z0-9._-]+'));
 
+            // Common people-tag stuff
+
+            $m->connect('peopletag/:tag', array('action' => 'peopletag',
+                                                'tag'    => self::REGEX_TAG));
+
+            $m->connect('selftag/:tag', array('action' => 'selftag',
+                                              'tag'    => self::REGEX_TAG));
+
+            $m->connect('main/addpeopletag', array('action' => 'addpeopletag'));
+
+            $m->connect('main/removepeopletag', array('action' => 'removepeopletag'));
+
+            $m->connect('main/profilecompletion', array('action' => 'profilecompletion'));
+
+            $m->connect('main/peopletagautocomplete', array('action' => 'peopletagautocomplete'));
+
             // In the "root"
 
             if (common_config('singleuser', 'enabled')) {
@@ -818,7 +878,7 @@ class Router
 
                 foreach (array('subscriptions', 'subscribers',
                                'all', 'foaf', 'replies',
-                               'microsummary', 'hcard') as $a) {
+                               'microsummary') as $a) {
                     $m->connect($a,
                                 array('action' => $a,
                                       'nickname' => $nickname));
@@ -851,10 +911,13 @@ class Router
                             array('action' => 'showfavorites',
                                   'nickname' => $nickname));
 
+                $m->connect('avatar',
+                            array('action' => 'avatarbynickname',
+                                  'nickname' => $nickname));
                 $m->connect('avatar/:size',
                             array('action' => 'avatarbynickname',
                                   'nickname' => $nickname),
-                            array('size' => '(original|96|48|24)'));
+                            array('size' => '(|original|\d+)'));
 
                 $m->connect('tag/:tag/rss',
                             array('action' => 'userrss',
@@ -873,6 +936,57 @@ class Router
                 $m->connect('',
                             array('action' => 'showstream',
                                   'nickname' => $nickname));
+
+                // peopletags
+
+                $m->connect('peopletags',
+                            array('action' => 'peopletagsbyuser'));
+
+                $m->connect('peopletags/private',
+                            array('action' => 'peopletagsbyuser',
+                                  'private' => 1));
+
+                $m->connect('peopletags/public',
+                            array('action' => 'peopletagsbyuser',
+                                  'public' => 1));
+
+                $m->connect('othertags',
+                            array('action' => 'peopletagsforuser'));
+
+                $m->connect('peopletagsubscriptions',
+                            array('action' => 'peopletagsubscriptions'));
+
+                $m->connect('all/:tag/subscribers',
+                            array('action' => 'peopletagsubscribers',
+                                  'tag' => self::REGEX_TAG));
+
+                $m->connect('all/:tag/tagged',
+                                array('action' => 'peopletagged',
+                                      'tag' => self::REGEX_TAG));
+
+                $m->connect('all/:tag/edit',
+                                array('action' => 'editpeopletag',
+                                      'tag' => self::REGEX_TAG));
+
+                foreach(array('subscribe', 'unsubscribe') as $v) {
+                    $m->connect('peopletag/:id/'.$v,
+                                    array('action' => $v.'peopletag',
+                                          'id' => '[0-9]{1,64}'));
+                }
+                $m->connect('user/:tagger_id/profiletag/:id/id',
+                                array('action' => 'profiletagbyid',
+                                      'tagger_id' => '[0-9]+',
+                                      'id' => '[0-9]+'));
+
+                $m->connect('all/:tag',
+                                array('action' => 'showprofiletag',
+                                      'tag' => self::REGEX_TAG));
+
+                foreach (array('subscriptions', 'subscribers') as $a) {
+                    $m->connect($a.'/:tag',
+                                array('action' => $a),
+                                array('tag' => self::REGEX_TAG));
+                }
             } else {
                 $m->connect('', array('action' => 'public'));
                 $m->connect('rss', array('action' => 'publicrss'));
@@ -886,7 +1000,7 @@ class Router
 
                 foreach (array('subscriptions', 'subscribers',
                                'nudge', 'all', 'foaf', 'replies',
-                               'inbox', 'outbox', 'microsummary', 'hcard') as $a) {
+                               'inbox', 'outbox', 'microsummary') as $a) {
                     $m->connect(':nickname/'.$a,
                                 array('action' => $a),
                                 array('nickname' => Nickname::DISPLAY_FMT));
@@ -897,22 +1011,6 @@ class Router
 
                 // people tags
 
-                $m->connect('peopletags', array('action' => 'publicpeopletagcloud'));
-
-                $m->connect('peopletag/:tag', array('action' => 'peopletag',
-                                                    'tag'    => self::REGEX_TAG));
-
-                $m->connect('selftag/:tag', array('action' => 'selftag',
-                                                  'tag'    => self::REGEX_TAG));
-
-                $m->connect('main/addpeopletag', array('action' => 'addpeopletag'));
-
-                $m->connect('main/removepeopletag', array('action' => 'removepeopletag'));
-
-                $m->connect('main/profilecompletion', array('action' => 'profilecompletion'));
-
-                $m->connect('main/peopletagautocomplete', array('action' => 'peopletagautocomplete'));
-
                 $m->connect(':nickname/peopletags',
                                 array('action' => 'peopletagsbyuser',
                                       'nickname' => Nickname::DISPLAY_FMT));
@@ -988,9 +1086,12 @@ class Router
                             array('action' => 'showfavorites'),
                             array('nickname' => Nickname::DISPLAY_FMT));
 
+                $m->connect(':nickname/avatar',
+                            array('action' => 'avatarbynickname'),
+                            array('nickname' => Nickname::DISPLAY_FMT));
                 $m->connect(':nickname/avatar/:size',
                             array('action' => 'avatarbynickname'),
-                            array('size' => '(original|96|48|24)',
+                            array('size' => '(|original|\d+)',
                                   'nickname' => Nickname::DISPLAY_FMT));
 
                 $m->connect(':nickname/tag/:tag/rss',
@@ -1010,6 +1111,10 @@ class Router
                 $m->connect(':nickname',
                             array('action' => 'showstream'),
                             array('nickname' => Nickname::DISPLAY_FMT));
+
+                $m->connect(':nickname/',
+                            array('action' => 'showstream'),
+                            array('nickname' => Nickname::DISPLAY_FMT));
             }
 
             // AtomPub API