X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=lib%2Frouter.php;h=5a51f3d7d425bb54d02a48978fb73d79c4888b23;hb=9b613029e65f97b41f9b2708bf7f5dfaee03beb1;hp=b13c51c32834c92fb24facdbfeccc59454699871;hpb=c10a4cf6d2ea3f45622674a555898229ea99962c;p=quix0rs-gnu-social.git diff --git a/lib/router.php b/lib/router.php index b13c51c328..5a51f3d7d4 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 @@ -766,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')); @@ -827,7 +832,7 @@ class Router foreach (array('subscriptions', 'subscribers', 'all', 'foaf', 'replies', - 'microsummary') as $a) { + ) as $a) { $m->connect($a, array('action' => $a, 'nickname' => $nickname)); @@ -921,6 +926,7 @@ class Router $m->connect('all/:tag', array('action' => 'showprofiletag', + 'nickname' => $nickname, 'tag' => self::REGEX_TAG)); foreach (array('subscriptions', 'subscribers') as $a) { @@ -938,7 +944,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)); @@ -1003,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) { @@ -1095,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)