aboutsummaryrefslogtreecommitdiffstats
path: root/include/functions_url.inc.php
diff options
context:
space:
mode:
authorrvelices <rv-github@modusoptimus.com>2006-04-06 02:23:54 +0000
committerrvelices <rv-github@modusoptimus.com>2006-04-06 02:23:54 +0000
commitd700a5917233fb8049589a9e0aef3d94e87fb320 (patch)
tree81f8c53ccf908e900638abd117f3dc8719ca67a1 /include/functions_url.inc.php
parentb9a37cd6f06a19fd48d4a8e546b10c8fb3ff5b33 (diff)
improvement: urls for tags can contain now only the tag or the id and tag
improvement: urls for category can be now id and category names (instead of only id) improvement: added 2 indexes (#image_tag.tag_id and #tags.url_name) improvement: identification, register, search pages automatically set focus on first form input improvement: focus, nofocus css class now valid for all forms fix: category comment is tag stripped in category_subcats.inc.php (otherwise issues with html/scripts inside category comment) git-svn-id: http://piwigo.org/svn/trunk@1131 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'include/functions_url.inc.php')
-rw-r--r--include/functions_url.inc.php34
1 files changed, 30 insertions, 4 deletions
diff --git a/include/functions_url.inc.php b/include/functions_url.inc.php
index a50f789c8..63316d4d5 100644
--- a/include/functions_url.inc.php
+++ b/include/functions_url.inc.php
@@ -256,6 +256,7 @@ function add_well_known_params_in_url($url, $params)
*/
function make_section_in_URL($params)
{
+ global $conf;
$section_string = '';
$section_of = array(
@@ -289,6 +290,19 @@ function make_section_in_URL($params)
else
{
$section_string.= '/category/'.$params['category'];
+ if ($conf['category_url_style']=='id-name' and isset($params['cat_name']) )
+ {
+ if ( is_string($params['cat_name']) )
+ {
+ $section_string.= '-'.str2url($params['cat_name']);
+ }
+ elseif ( is_array( $params['cat_name'] ) and
+ isset( $params['cat_name'][$params['category']] ) )
+ {
+ $section_string.= '-'
+ .str2url($params['cat_name'][$params['category']]);
+ }
+ }
}
break;
@@ -304,11 +318,23 @@ function make_section_in_URL($params)
foreach ($params['tags'] as $tag)
{
- $section_string.= '/'.$tag['id'];
-
- if (isset($tag['url_name']))
+ switch ( $conf['tag_url_style'] )
{
- $section_string.= '-'.$tag['url_name'];
+ case 'id':
+ $section_string.= '/'.$tag['id'];
+ break;
+ case 'tag':
+ if (isset($tag['url_name']) and !is_numeric($tag['url_name']) )
+ {
+ $section_string.= '/'.$tag['url_name'];
+ break;
+ }
+ default:
+ $section_string.= '/'.$tag['id'];
+ if (isset($tag['url_name']))
+ {
+ $section_string.= '-'.$tag['url_name'];
+ }
}
}