diff options
author | rvelices <rv-github@modusoptimus.com> | 2007-06-28 02:16:03 +0000 |
---|---|---|
committer | rvelices <rv-github@modusoptimus.com> | 2007-06-28 02:16:03 +0000 |
commit | 12af0a00794d4624c4804eeef74fd207f474b002 (patch) | |
tree | 53aa23bc197f399f7d6069766630af02e213cdf2 /include/functions_url.inc.php | |
parent | 009970bb9250bd72936beb000d1a578897287153 (diff) |
feature 713: allow permalinks to contain the slash ("/") character
git-svn-id: http://piwigo.org/svn/trunk@2047 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r-- | include/functions_url.inc.php | 39 |
1 files changed, 27 insertions, 12 deletions
diff --git a/include/functions_url.inc.php b/include/functions_url.inc.php index 3c0138136..9e81a72cf 100644 --- a/include/functions_url.inc.php +++ b/include/functions_url.inc.php @@ -457,29 +457,44 @@ function parse_section_url( $tokens, &$next_token) $next_token++; } else - { - if ( strpos($tokens[$next_token], 'created-')!==0 - and strpos($tokens[$next_token], 'posted-')!==0 + {// try a permalink + $maybe_permalinks = array(); + $current_token = $next_token; + while ( isset($tokens[$current_token]) + and strpos($tokens[$current_token], 'created-')!==0 + and strpos($tokens[$current_token], 'posted-')!==0 and strpos($tokens[$next_token], 'start-')!==0 - and $tokens[$next_token] != 'flat') - {// try a permalink - $cat_id = get_cat_id_from_permalink($tokens[$next_token]); - if ( !isset($cat_id) ) - {//try old permalink - $cat_id = get_cat_id_from_old_permalink($tokens[$next_token], true); + and $tokens[$current_token] != 'flat') + { + if (empty($maybe_permalinks)) + { + array_push($maybe_permalinks, $tokens[$current_token]); + } + else + { + array_push($maybe_permalinks, + $maybe_permalinks[count($maybe_permalinks)-1] + . '/' . $tokens[$current_token] + ); } + $current_token++; + } + + if ( count($maybe_permalinks) ) + { + $cat_id = get_cat_id_from_permalinks($maybe_permalinks, $perma_index); if ( isset($cat_id) ) { + $next_token += $perma_index+1; $page['category'] = $cat_id; - $page['hit_by']['cat_permalink'] = $tokens[$next_token]; + $page['hit_by']['cat_permalink'] = $maybe_permalinks[$perma_index]; } else { page_not_found('Permalink for album not found'); } - $next_token++; } - } + } } if (isset($page['category'])) |