From: Evan Prodromou Date: Fri, 21 Nov 2008 02:57:49 +0000 (-0500) Subject: fancier urls for tagged subscriptions/subscribers X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=75f107823e4227225791e1807a3b7b56092beaa9;p=quix0rs-gnu-social.git fancier urls for tagged subscriptions/subscribers darcs-hash:20081121025749-84dde-9fd9a98c23ecabd1c1615dec938edbd4be884aec.gz --- diff --git a/htaccess.sample b/htaccess.sample index 28da7b66f6..4779f18b19 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 ce9e312b69..b8e482eef8 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');