summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvan Prodromou <evan@prodromou.name>2008-11-20 21:57:49 -0500
committerEvan Prodromou <evan@prodromou.name>2008-11-20 21:57:49 -0500
commit75f107823e4227225791e1807a3b7b56092beaa9 (patch)
tree41dbe8d65fd979bd93c92fd6f80fe4161d38694d
parentca8f45fc6ea609450de75afc3438d9c43c42a7bb (diff)
fancier urls for tagged subscriptions/subscribers
darcs-hash:20081121025749-84dde-9fd9a98c23ecabd1c1615dec938edbd4be884aec.gz
-rw-r--r--htaccess.sample3
-rw-r--r--lib/util.php8
2 files changed, 9 insertions, 2 deletions
diff --git a/htaccess.sample b/htaccess.sample
index 28da7b66f..4779f18b1 100644
--- a/htaccess.sample
+++ b/htaccess.sample
@@ -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]
diff --git a/lib/util.php b/lib/util.php
index ce9e312b6..b8e482eef 100644
--- a/lib/util.php
+++ b/lib/util.php
@@ -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');