From e42de1ccc12351ac301ed97ef3f7c9d46b41f688 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Wed, 17 Sep 2008 14:02:44 -0400 Subject: [PATCH] fancy urls for show message, new message darcs-hash:20080917180244-5ed1f-06e2ac2d8f094eacd12b316794b0599b57d76596.gz --- actions/showstream.php | 2 +- classes/User.php | 2 +- htaccess.sample | 3 +++ lib/util.php | 4 ++++ 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/actions/showstream.php b/actions/showstream.php index af0bcb8097..9d871e41bf 100644 --- a/actions/showstream.php +++ b/actions/showstream.php @@ -150,7 +150,7 @@ class ShowstreamAction extends StreamAction { $user = User::staticGet('id', $profile->id); 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')); } diff --git a/classes/User.php b/classes/User.php index 4305c15411..1168406ef8 100644 --- a/classes/User.php +++ b/classes/User.php @@ -117,7 +117,7 @@ class User extends DB_DataObject static $blacklist = array('rss', 'xrds', 'doc', 'main', 'settings', 'notice', 'user', 'search', 'avatar', 'tag', 'tags', - 'api'); + 'api', 'message'); $merged = array_merge($blacklist, common_config('nickname', 'blacklist')); return !in_array($nickname, $merged); } diff --git a/htaccess.sample b/htaccess.sample index ce380666ec..de920de982 100644 --- a/htaccess.sample +++ b/htaccess.sample @@ -54,6 +54,9 @@ RewriteRule ^notice/(\d+)$ index.php?action=shownotice¬ice=$1 [L,QSA] RewriteRule ^notice/delete/((\d+))?$ index.php?action=deletenotice¬ice=$2 [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 ^tags/?$ index.php?action=tag [L,QSA] diff --git a/lib/util.php b/lib/util.php index ac2f9af360..2fdcb37e39 100644 --- a/lib/util.php +++ b/lib/util.php @@ -934,6 +934,10 @@ function common_fancy_url($action, $args=NULL) { } else { 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: return common_simple_url($action, $args); } -- 2.39.5