summaryrefslogtreecommitdiff
path: root/lib/router.php
diff options
context:
space:
mode:
authorEvan Prodromou <evan@controlyourself.ca>2009-02-21 07:10:33 -0800
committerEvan Prodromou <evan@controlyourself.ca>2009-02-21 07:10:33 -0800
commitda532bae9131b6dec8f5c0d67ce77c4ad1736f7d (patch)
tree5d284399ad661ddb2821c17f091de789cd69c910 /lib/router.php
parent3a999af4d905d3cd23ea9163f47b6ed5c35f606c (diff)
parentb9f3e1e01e68dec2924746baeae1dba984a85f73 (diff)
Merge branch '0.7.x' of git@gitorious.org:laconica/dev into 0.7.x
Diffstat (limited to 'lib/router.php')
-rw-r--r--lib/router.php50
1 files changed, 36 insertions, 14 deletions
diff --git a/lib/router.php b/lib/router.php
index 85425bed2..e842604e9 100644
--- a/lib/router.php
+++ b/lib/router.php
@@ -228,20 +228,31 @@ class Router
// direct messages
- $m->connect('api/direct_messages/:method',
- array('action' => 'api',
- 'apiaction' => 'direct_messages'),
- array('method' => '(sent|new)(\.(xml|json|atom|rss))?'));
+ foreach (array('xml', 'json') as $e) {
+ $m->connect('api/direct_messages/new.'.$e,
+ array('action' => 'api',
+ 'apiaction' => 'direct_messages',
+ 'method' => 'create.'.$e));
+ }
+
+ foreach (array('xml', 'json', 'rss', 'atom') as $e) {
+ $m->connect('api/direct_messages.'.$e,
+ array('action' => 'api',
+ 'apiaction' => 'direct_messages',
+ 'method' => 'direct_messages.'.$e));
+ }
+
+ foreach (array('xml', 'json', 'rss', 'atom') as $e) {
+ $m->connect('api/direct_message/sent.'.$e,
+ array('action' => 'api',
+ 'apiaction' => 'direct_messages',
+ 'method' => 'sent.'.$e));
+ }
$m->connect('api/direct_messages/destroy/:argument',
array('action' => 'api',
'apiaction' => 'direct_messages'));
- $m->connect('api/:method',
- array('action' => 'api',
- 'apiaction' => 'direct_messages'),
- array('method' => 'direct_messages(\.(xml|json|atom|rss))?'));
-
// friendships
$m->connect('api/friendships/:method/:argument',
@@ -271,10 +282,12 @@ class Router
'apiaction' => 'favorites',
'method' => 'favorites'));
- $m->connect('api/:method',
- array('action' => 'api',
- 'apiaction' => 'favorites'),
- array('method' => 'favorites(\.(xml|json|rss|atom))?'));
+ foreach (array('xml', 'json', 'rss', 'atom') as $e) {
+ $m->connect('api/favorites.'.$e,
+ array('action' => 'api',
+ 'apiaction' => 'favorites',
+ 'method' => 'favorites.'.$e));
+ }
// notifications
@@ -347,7 +360,16 @@ class Router
function map($path)
{
- return $this->m->match($path);
+ try {
+ $match = $this->m->match($path);
+ } catch (Net_URL_Mapper_InvalidException $e) {
+ common_log(LOG_ERR, "Problem getting route for $path - " .
+ $e->getMessage());
+ $cac = new ClientErrorAction("Page not found.", 404);
+ $cac->showPage();
+ }
+
+ return $match;
}
function build($action, $args=null, $params=null, $fragment=null)