fancy urls for show message, new message

darcs-hash:20080917180244-5ed1f-06e2ac2d8f094eacd12b316794b0599b57d76596.gz
This commit is contained in:
Evan Prodromou 2008-09-17 14:02:44 -04:00
parent ae6ba61d43
commit e42de1ccc1
4 changed files with 9 additions and 2 deletions

View File

@ -150,7 +150,7 @@ class ShowstreamAction extends StreamAction {
$user = User::staticGet('id', $profile->id); $user = User::staticGet('id', $profile->id);
if ($cur->id != $user->id && $cur->mutuallySubscribed($user)) { if ($cur->id != $user->id && $cur->mutuallySubscribed($user)) {
common_element('a', array('href' => common_local_url('newmessage', array('nickname' => $user->nickname))), common_element('a', array('href' => common_local_url('newmessage', array('to' => $user->id))),
_('Send a message')); _('Send a message'));
} }

View File

@ -117,7 +117,7 @@ class User extends DB_DataObject
static $blacklist = array('rss', 'xrds', 'doc', 'main', static $blacklist = array('rss', 'xrds', 'doc', 'main',
'settings', 'notice', 'user', 'settings', 'notice', 'user',
'search', 'avatar', 'tag', 'tags', 'search', 'avatar', 'tag', 'tags',
'api'); 'api', 'message');
$merged = array_merge($blacklist, common_config('nickname', 'blacklist')); $merged = array_merge($blacklist, common_config('nickname', 'blacklist'));
return !in_array($nickname, $merged); return !in_array($nickname, $merged);
} }

View File

@ -54,6 +54,9 @@ RewriteRule ^notice/(\d+)$ index.php?action=shownotice&notice=$1 [L,QSA]
RewriteRule ^notice/delete/((\d+))?$ index.php?action=deletenotice&notice=$2 [L,QSA] RewriteRule ^notice/delete/((\d+))?$ index.php?action=deletenotice&notice=$2 [L,QSA]
RewriteRule ^notice/delete$ index.php?action=deletenotice [L,QSA] RewriteRule ^notice/delete$ index.php?action=deletenotice [L,QSA]
RewriteRule ^message/new$ index.php?action=newmessage [L,QSA]
RewriteRule ^message/(\d+)$ index.php?action=showmessage&id=$1 [L,QSA]
RewriteRule ^user/(\d+)$ index.php?action=userbyid&id=$1 [L,QSA] RewriteRule ^user/(\d+)$ index.php?action=userbyid&id=$1 [L,QSA]
RewriteRule ^tags/?$ index.php?action=tag [L,QSA] RewriteRule ^tags/?$ index.php?action=tag [L,QSA]

View File

@ -934,6 +934,10 @@ function common_fancy_url($action, $args=NULL) {
} else { } else {
return common_path($args['nickname'].'/favorites'); return common_path($args['nickname'].'/favorites');
} }
case 'showmessage':
return common_path('message/' . $args['id']);
case 'newmessage':
return common_path('message/new' . (($args) ? ('?' . http_build_query($args)) : ''));
default: default:
return common_simple_url($action, $args); return common_simple_url($action, $args);
} }