X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=lib%2Frouter.php;h=be87afd88d647ab8187b4a53c26f8a2b941a326b;hb=d1fc7c0774b4b8883f90c0202c67285ef34be322;hp=28ee42662df5e3ec966f9400c38d422d9b1d1c35;hpb=edd62e58fdf2a2b0bd4010ec80e6428c92572cb8;p=quix0rs-gnu-social.git diff --git a/lib/router.php b/lib/router.php index 28ee42662d..be87afd88d 100644 --- a/lib/router.php +++ b/lib/router.php @@ -27,9 +27,7 @@ * @link http://status.net/ */ -if (!defined('STATUSNET') && !defined('LACONICA')) { - exit(1); -} +if (!defined('GNUSOCIAL')) { exit(1); } /** * URL Router @@ -225,6 +223,10 @@ class Router array('action' => 'attachment'), array('attachment' => '[0-9]+')); + $m->connect('attachment/:attachment/download', + array('action' => 'attachment_download'), + array('attachment' => '[0-9]+')); + $m->connect('attachment/:attachment/thumbnail', array('action' => 'attachment_thumbnail'), array('attachment' => '[0-9]+')); @@ -258,12 +260,6 @@ class Router array('action' => 'userbyid'), array('id' => '[0-9]+')); - 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)); @@ -424,7 +420,7 @@ class Router $m->connect('api/statuses/update.:format', array('action' => 'ApiStatusesUpdate', - 'format' => '(xml|json)')); + 'format' => '(xml|json|atom)')); $m->connect('api/statuses/destroy/:id.:format', array('action' => 'ApiStatusesDestroy', @@ -766,6 +762,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')); @@ -827,7 +830,7 @@ class Router foreach (array('subscriptions', 'subscribers', 'all', 'foaf', 'replies', - 'microsummary') as $a) { + ) as $a) { $m->connect($a, array('action' => $a, 'nickname' => $nickname)); @@ -921,7 +924,7 @@ class Router $m->connect('all/:tag', array('action' => 'showprofiletag', - 'nickname' => $nickname, + 'tagger' => $nickname, 'tag' => self::REGEX_TAG)); foreach (array('subscriptions', 'subscribers') as $a) { @@ -939,7 +942,7 @@ class Router foreach (array('subscriptions', 'subscribers', 'nudge', 'all', 'foaf', 'replies', - 'inbox', 'outbox', 'microsummary') as $a) { + 'inbox', 'outbox') as $a) { $m->connect(':nickname/'.$a, array('action' => $a), array('nickname' => Nickname::DISPLAY_FMT)); @@ -1096,16 +1099,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)