aboutsummaryrefslogtreecommitdiffstats
path: root/include/section_init.inc.php
diff options
context:
space:
mode:
authorrvelices <rv-github@modusoptimus.com>2006-03-28 02:16:34 +0000
committerrvelices <rv-github@modusoptimus.com>2006-03-28 02:16:34 +0000
commit8b3328e7ed8ae8936ce816b2eed69b422381d30b (patch)
tree3d708e73b9435a37edf1e307f4586db35eea04b3 /include/section_init.inc.php
parent2ea96d5a96abfdacec319836051070f9016d7b95 (diff)
moved category.php to index.php
split url functions from functions.inc.php to functions_url.inc.php git-svn-id: http://piwigo.org/svn/trunk@1109 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'include/section_init.inc.php')
-rw-r--r--include/section_init.inc.php32
1 files changed, 19 insertions, 13 deletions
diff --git a/include/section_init.inc.php b/include/section_init.inc.php
index 73f11105d..12e720d2d 100644
--- a/include/section_init.inc.php
+++ b/include/section_init.inc.php
@@ -84,29 +84,40 @@ $tokens = explode(
$next_token = 0;
if (basename($_SERVER['SCRIPT_FILENAME']) == 'picture.php')
-{ // the last token must be the identifier for the picture
- $token = array_pop($tokens);
+{ // the first token must be the identifier for the picture
+ if ( isset($_GET['image_id'])
+ and isset($_GET['cat']) and is_numeric($_GET['cat']) )
+ {// url compatibility with versions below 1.6
+ $url = make_picture_url( array(
+ 'section' => 'categories',
+ 'category' => $_GET['cat'],
+ 'image_id' => $_GET['image_id']
+ ) );
+ redirect($url);
+ }
+ $token = $tokens[$next_token];
+ $next_token++;
if ( is_numeric($token) )
{
$page['image_id'] = $token;
}
else
{
- preg_match('/^(\d+-)?((.*)[_\.]html?)?$/', $token, $matches);
+ preg_match('/^(\d+-)?(.*)?$/', $token, $matches);
if (isset($matches[1]) and is_numeric($matches[1]=rtrim($matches[1],'-')) )
{
$page['image_id'] = $matches[1];
- if ( !empty($matches[3]) )
+ if ( !empty($matches[2]) )
{
- $page['image_file'] = $matches[3];
+ $page['image_file'] = $matches[2];
}
}
else
{
- if ( !empty($matches[3]) )
+ if ( !empty($matches[2]) )
{
- $page['image_file'] = $matches[3];
+ $page['image_file'] = $matches[2];
}
else
{
@@ -116,7 +127,7 @@ if (basename($_SERVER['SCRIPT_FILENAME']) == 'picture.php')
}
}
-if (0 === strpos($tokens[$next_token], 'cat'))
+if (0 === strpos($tokens[$next_token], 'categor'))
{
$page['section'] = 'categories';
$next_token++;
@@ -213,11 +224,6 @@ else if ('list' == $tokens[$next_token])
}
$next_token++;
}
-else
-{
- $page['section'] = 'categories';
- $next_token++;
-}
for ($i = $next_token; ; $i++)
{