aboutsummaryrefslogtreecommitdiffstats
path: root/include/functions_url.inc.php
diff options
context:
space:
mode:
authorrvelices <rv-github@modusoptimus.com>2007-02-27 01:56:16 +0000
committerrvelices <rv-github@modusoptimus.com>2007-02-27 01:56:16 +0000
commit47512ce6a64fa356214c162a8313480c6aed41d2 (patch)
treea0e35e2f89ef789f380adc5b8951444c189de4e7 /include/functions_url.inc.php
parentbfb4b15d2f75835033d9bbb865edd77dcb282bb6 (diff)
- refactoring page['category'] before 1.7 release
page['category'] is not an id anymore, but an associative array of category info all of page['cat_xxx'] or page['uppercats'] merged into one simplifies calls to make_index_url give plugins a clean start for page variables for version 1.7 git-svn-id: http://piwigo.org/svn/trunk@1861 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'include/functions_url.inc.php')
-rw-r--r--include/functions_url.inc.php34
1 files changed, 18 insertions, 16 deletions
diff --git a/include/functions_url.inc.php b/include/functions_url.inc.php
index 4f9b15b4b..b96ed82b7 100644
--- a/include/functions_url.inc.php
+++ b/include/functions_url.inc.php
@@ -3,7 +3,6 @@
// | PhpWebGallery - a PHP based picture gallery |
// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
// +-----------------------------------------------------------------------+
-// | branch : BSF (Best So Far)
// | file : $Id$
// | last update : $Date$
// | last modifier : $Author$
@@ -133,9 +132,11 @@ function make_index_url($params = array())
* build an index URL with current page parameters, but with redefinitions
* and removes.
*
- * duplicate_index_url(array('category' => 12), array('start')) will create
- * an index URL on the current section (categories), but on a redefined
- * category and without the start URL parameter.
+ * duplicate_index_url( array(
+ * 'category' => array('id'=>12, 'name'=>'toto'),
+ * array('start')
+ * ) will create an index URL on the current section (categories), but on
+ * a redefined category and without the start URL parameter.
*
* @param array redefined keys
* @param array removed keys
@@ -325,19 +326,20 @@ function make_section_in_url($params)
}
else
{
- $section_string.= '/category/'.$params['category'];
- if ($conf['category_url_style']=='id-name' and isset($params['cat_name']) )
+ is_array($params['category']) or trigger_error(
+ 'make_section_in_url wrong type for category', E_USER_WARNING
+ );
+ is_numeric($params['category']['id']) or trigger_error(
+ 'make_section_in_url category id not numeric', E_USER_WARNING
+ );
+ isset($params['category']['name']) or trigger_error(
+ 'make_section_in_url category name not set', E_USER_WARNING
+ );
+
+ $section_string.= '/category/'.$params['category']['id'];
+ if ( $conf['category_url_style']=='id-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']]);
- }
+ $section_string.= '-'.str2url($params['category']['name']);
}
}