fancier urls for tagged subscriptions/subscribers

darcs-hash:20081121025749-84dde-9fd9a98c23ecabd1c1615dec938edbd4be884aec.gz
This commit is contained in:
Evan Prodromou 2008-11-20 21:57:49 -05:00
parent ca8f45fc6e
commit 75f107823e
2 changed files with 9 additions and 2 deletions

View File

@ -76,6 +76,9 @@ RewriteRule ^featured/?$ index.php?action=featured [L,QSA]
RewriteRule ^favorited/?$ index.php?action=favorited [L,QSA]
RewriteRule ^(\w+)/subscriptions$ index.php?action=subscriptions&nickname=$1 [L,QSA]
RewriteRule ^(\w+)/subscriptions/([a-zA-Z0-9]+)$ index.php?action=subscriptions&nickname=$1&tag=$2 [L,QSA]
RewriteRule ^(\w+)/subscribers$ index.php?action=subscribers&nickname=$1 [L,QSA]
RewriteRule ^(\w+)/subscribers/([a-zA-Z0-9]+)$ index.php?action=subscribers&nickname=$1&tag=$2 [L,QSA]
RewriteRule ^(\w+)/subscribers$ index.php?action=subscribers&nickname=$1 [L,QSA]
RewriteRule ^(\w+)/xrds$ index.php?action=xrds&nickname=$1 [L,QSA]
RewriteRule ^(\w+)/rss$ index.php?action=userrss&nickname=$1 [L,QSA]

View File

@ -1045,11 +1045,15 @@ function common_fancy_url($action, $args=NULL) {
case 'subscribers':
$nickname = $args['nickname'];
unset($args['nickname']);
if (isset($args['tag'])) {
$tag = $args['tag'];
unset($args['tag']);
}
$params = http_build_query($args);
if ($params) {
return common_path($nickname.'/'.$action . '?' . $params);
return common_path($nickname.'/'.$action . (($tag) ? '/' . tag : '') . '?' . $params);
} else {
return common_path($nickname.'/'.$action);
return common_path($nickname.'/'.$action . (($tag) ? '/' . tag : ''));
}
case 'allrss':
return common_path($args['nickname'].'/all/rss');