From 656ac54090c1cc516955c59ac752bf99ac7abf6f Mon Sep 17 00:00:00 2001 From: rvelices Date: Sun, 16 Feb 2014 07:39:19 +0000 Subject: more query2array and remove unnecessary tests in often called url functions git-svn-id: http://piwigo.org/svn/trunk@27388 68402e56-0260-453c-a942-63ccdbb3a9ee --- include/functions_url.inc.php | 25 +++++-------------------- 1 file changed, 5 insertions(+), 20 deletions(-) (limited to 'include/functions_url.inc.php') diff --git a/include/functions_url.inc.php b/include/functions_url.inc.php index d8c49f372..5a471bc10 100644 --- a/include/functions_url.inc.php +++ b/include/functions_url.inc.php @@ -132,7 +132,7 @@ function make_index_url($params = array()) } $url_before_params = $url; - + $url.= make_section_in_url($params); $url = add_well_known_params_in_url($url, $params); @@ -140,7 +140,7 @@ function make_index_url($params = array()) { $url = get_absolute_root_url( url_is_remote($url) ); } - + return $url; } @@ -216,8 +216,6 @@ function make_picture_url($params) { global $conf; - isset($params['image_id']) or fatal_error('make_picture_url: image_id is a required parameter'); - $url = get_root_url().'picture'; if ($conf['php_extension_in_urls']) { @@ -337,12 +335,6 @@ function make_section_in_url($params) } else { - 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 ); @@ -370,11 +362,6 @@ function make_section_in_url($params) } case 'tags' : { - if (!isset($params['tags']) or count($params['tags']) == 0) - { - fatal_error('make_section_in_url: require at least one tag'); - } - $section_string.= '/tags'; foreach ($params['tags'] as $tag) @@ -403,13 +390,11 @@ function make_section_in_url($params) } case 'search' : { - isset($params['search']) or fatal_error('make_section_in_url: require a search identifier'); $section_string.= '/search/'.$params['search']; break; } case 'list' : { - isset($params['list']) or fatal_error('make_section_in_url: require a list of items'); $section_string.= '/list/'.implode(',', $params['list']); break; } @@ -470,7 +455,7 @@ function parse_section_url( $tokens, &$next_token) } else { - $maybe_permalinks[] = + $maybe_permalinks[] = $maybe_permalinks[count($maybe_permalinks)-1] . '/' . $tokens[$current_token]; } @@ -678,7 +663,7 @@ function get_action_url($id, $what_part, $download) { $params['download'] = null; } - + return add_url_params(get_root_url().'action.php', $params); } @@ -812,7 +797,7 @@ function get_query_string_diff($rejects=array(), $escape=true) parse_str($_SERVER['QUERY_STRING'], $vars); $vars = array_diff_key($vars, array_flip($rejects)); - + return '?' . http_build_query($vars, '', $escape ? '&' : '&'); } -- cgit v1.2.3