aboutsummaryrefslogtreecommitdiffstats
path: root/include/section_init.inc.php
diff options
context:
space:
mode:
authorrvelices <rv-github@modusoptimus.com>2006-03-23 01:49:04 +0000
committerrvelices <rv-github@modusoptimus.com>2006-03-23 01:49:04 +0000
commit5c7d65500573ed52ea2fb1aff8a3218b524ea982 (patch)
tree1a658831f2a515a3e4210d7c9c9ff6ddfcad7f1e /include/section_init.inc.php
parent4cb765e78362f36073bd490248b1f870095b5c40 (diff)
URL rewrite: 3 options in the config file define behaviour (question mark
removal, file name for picture and .php extension removal) fix: added unsigned for column in install sql - for the sake of uniformization change: add_url_param is now add_url_params and takes an array as parameter instead of a string git-svn-id: http://piwigo.org/svn/trunk@1094 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r--include/section_init.inc.php22
1 files changed, 15 insertions, 7 deletions
diff --git a/include/section_init.inc.php b/include/section_init.inc.php
index 80f853d17..73f11105d 100644
--- a/include/section_init.inc.php
+++ b/include/section_init.inc.php
@@ -83,7 +83,7 @@ $tokens = explode(
// );
$next_token = 0;
-if (basename($_SERVER['SCRIPT_NAME']) == 'picture.php')
+if (basename($_SERVER['SCRIPT_FILENAME']) == 'picture.php')
{ // the last token must be the identifier for the picture
$token = array_pop($tokens);
if ( is_numeric($token) )
@@ -93,13 +93,14 @@ if (basename($_SERVER['SCRIPT_NAME']) == 'picture.php')
else
{
preg_match('/^(\d+-)?((.*)[_\.]html?)?$/', $token, $matches);
- if ( isset($matches[1]) and is_numeric($matches[1]) )
+ if (isset($matches[1]) and is_numeric($matches[1]=rtrim($matches[1],'-')) )
{
$page['image_id'] = $matches[1];
if ( !empty($matches[3]) )
{
$page['image_file'] = $matches[3];
}
+
}
else
{
@@ -507,19 +508,26 @@ if (isset($page['chronology_field']))
initialize_calendar();
}
-if (basename($_SERVER['SCRIPT_NAME']) == 'picture.php'
+if (basename($_SERVER['SCRIPT_FILENAME']) == 'picture.php'
and !isset($page['image_id']) )
{
- $query = '
+ if ( !empty($page['items']) )
+ {
+ $query = '
SELECT id,file
FROM '.IMAGES_TABLE .'
WHERE id IN ('.implode(',',$page['items']).')
AND file LIKE "' . $page['image_file'] . '.%" ESCAPE "|"'
;
- $result = pwg_query($query);
- if (mysql_num_rows($result)>0)
+ $result = pwg_query($query);
+ if (mysql_num_rows($result)>0)
+ {
+ list($page['image_id'], $page['image_file']) = mysql_fetch_row($result);
+ }
+ }
+ if ( !isset($page['image_id']) )
{
- list($page['image_id'], $page['image_file']) = mysql_fetch_row($result);
+ $page['image_id'] = -1; // will fail in picture.php
}
}
?> \ No newline at end of file