summaryrefslogtreecommitdiff
path: root/lib
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
parent3a999af4d905d3cd23ea9163f47b6ed5c35f606c (diff)
parentb9f3e1e01e68dec2924746baeae1dba984a85f73 (diff)
Merge branch '0.7.x' of git@gitorious.org:laconica/dev into 0.7.x
Diffstat (limited to 'lib')
-rw-r--r--lib/action.php7
-rw-r--r--lib/router.php50
2 files changed, 42 insertions, 15 deletions
diff --git a/lib/action.php b/lib/action.php
index b1e700b67..455ebeff0 100644
--- a/lib/action.php
+++ b/lib/action.php
@@ -474,7 +474,10 @@ class Action extends HTMLOutputter // lawsuit
function showCore()
{
$this->elementStart('div', array('id' => 'core'));
- $this->showLocalNavBlock();
+ if (Event::handle('StartShowLocalNavBlock', array($this))) {
+ $this->showLocalNavBlock();
+ Event::handle('EndShowLocalNavBlock', array($this));
+ }
if (Event::handle('StartShowContentBlock', array($this))) {
$this->showContentBlock();
Event::handle('EndShowContentBlock', array($this));
@@ -657,6 +660,8 @@ class Action extends HTMLOutputter // lawsuit
_('Source'));
$this->menuItem(common_local_url('doc', array('title' => 'contact')),
_('Contact'));
+ $this->menuItem(common_local_url('doc', array('title' => 'badge')),
+ _('Badge'));
Event::handle('EndSecondaryNav', array($this));
}
$this->elementEnd('ul');
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)