]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/router.php
Resend confirm_address stuff, please read its NOTE first
[quix0rs-gnu-social.git] / lib / router.php
index 249e5e882397128e96ff76544fb2b70aaf41c34f..f66d928bcd98e2361bccbb5b62c7a44667dfbad3 100644 (file)
@@ -27,9 +27,7 @@
  * @link      http://status.net/
  */
 
-if (!defined('STATUSNET') && !defined('LACONICA')) {
-    exit(1);
-}
+if (!defined('GNUSOCIAL')) { exit(1); }
 
 /**
  * URL Router
@@ -244,12 +242,10 @@ class Router
                         array('action' => 'shownotice'),
                         array('notice' => '[0-9]+'));
 
-            $m->connect('notice/delete/:notice',
+            $m->connect('notice/:notice/delete',
                         array('action' => 'deletenotice'),
                         array('notice' => '[0-9]+'));
 
-            $m->connect('notice/delete', array('action' => 'deletenotice'));
-
             // conversation
 
             $m->connect('conversation/:id',
@@ -768,6 +764,13 @@ class Router
                 'api/statuses/update_with_media.json',
                 array('action' => 'ApiMediaUpload')
             );
+            // Twitter Media upload API v1.1
+            $m->connect(
+                'api/media/upload.:format',
+                array('action' => 'ApiMediaUpload',
+                      'format' => '(xml|json)',
+                      )
+            );
 
             // search
             $m->connect('api/search.atom', array('action' => 'ApiSearchAtom'));
@@ -923,6 +926,7 @@ class Router
 
                 $m->connect('all/:tag',
                                 array('action' => 'showprofiletag',
+                                      'nickname' => $nickname,
                                       'tag' => self::REGEX_TAG));
 
                 foreach (array('subscriptions', 'subscribers') as $a) {
@@ -1005,9 +1009,9 @@ class Router
                                   'tagger_id' => '[0-9]+',
                                   'id' => '[0-9]+'));
 
-            $m->connect(':tagger/all/:tag',
-                            array('action' => 'showprofiletag',
-                                  'tagger' => Nickname::DISPLAY_FMT,
+            $m->connect(':nickname/all/:tag',
+                            array('action' => 'showprofiletag'),
+                            array('nickname' => Nickname::DISPLAY_FMT,
                                   'tag' => self::REGEX_TAG));
 
             foreach (array('subscriptions', 'subscribers') as $a) {
@@ -1097,16 +1101,12 @@ class Router
     function map($path)
     {
         try {
-            $match = $this->m->match($path);
-        } catch (Exception $e) {
-            common_log(LOG_ERR, "Problem getting route for $path - " .
-                       $e->getMessage());
+            return $this->m->match($path);
+        } catch (NoRouteMapException $e) {
+            common_debug($e->getMessage());
             // TRANS: Client error on action trying to visit a non-existing page.
-            $cac = new ClientErrorAction(_('Page not found.'), 404);
-            $cac->showPage();
+            throw new ClientException(_('Page not found.'), 404);
         }
-
-        return $match;
     }
 
     function build($action, $args=null, $params=null, $fragment=null)