From a8938827898ed40d35f25b055a72a41a2c1567ef Mon Sep 17 00:00:00 2001 From: rvelices Date: Sat, 18 Feb 2012 20:46:46 +0000 Subject: - multisize thumb longest side can be smaller than the square size - remove unused css, shorten/optimize php called very often (at least theoretically should be faster) git-svn-id: http://piwigo.org/svn/trunk@13240 68402e56-0260-453c-a942-63ccdbb3a9ee --- include/functions_url.inc.php | 68 ++++++++++++++++++++----------------------- 1 file changed, 32 insertions(+), 36 deletions(-) (limited to 'include/functions_url.inc.php') diff --git a/include/functions_url.inc.php b/include/functions_url.inc.php index 1b6c1daff..fdaaca589 100644 --- a/include/functions_url.inc.php +++ b/include/functions_url.inc.php @@ -30,22 +30,15 @@ function get_root_url() { global $page; - if ( isset($page['root_path']) ) - { - $root_url = $page['root_path']; - } - else + if ( ($root_url = @$page['root_path']) == null ) {// TODO - add HERE the possibility to call PWG functions from external scripts $root_url = PHPWG_ROOT_PATH; + if ( strncmp($root_url, './', 2) == 0 ) + { + return substr($root_url, 2); + } } - if ( strncmp($root_url, './', 2) != 0 ) - { - return $root_url; - } - else - { - return (string)substr($root_url, 2); - } + return $root_url; } /** @@ -307,28 +300,31 @@ function make_section_in_url($params) { global $conf; $section_string = ''; - - $section_of = array( - 'category' => 'categories', - 'tags' => 'tags', - 'list' => 'list', - 'search' => 'search', - ); - - foreach ($section_of as $param => $section) - { - if (isset($params[$param])) - { - $params['section'] = $section; - } - } - - if (!isset($params['section'])) - { - $params['section'] = 'none'; - } - - switch($params['section']) + $section = @$params['section']; + if (!isset($section)) + { + $section_of = array( + 'category' => 'categories', + 'tags' => 'tags', + 'list' => 'list', + 'search' => 'search', + ); + + foreach ($section_of as $param => $s) + { + if (isset($params[$param])) + { + $section = $s; + } + } + + if (!isset($section)) + { + $section = 'none'; + } + } + + switch($section) { case 'categories' : { @@ -420,7 +416,7 @@ function make_section_in_url($params) } default : { - $section_string.= '/'.$params['section']; + $section_string.= '/'.$section; } } -- cgit v1.2.3