diff options
author | rvelices <rv-github@modusoptimus.com> | 2008-07-12 00:38:52 +0000 |
---|---|---|
committer | rvelices <rv-github@modusoptimus.com> | 2008-07-12 00:38:52 +0000 |
commit | be7bb150c2157948cc6e00324166059d03b14e16 (patch) | |
tree | b8b11368ef647e528b06a8134a743bb478a9fd0e /include | |
parent | 9a18da34fd6e48b814d966792a2629f47c3fe59b (diff) |
- merge -r2430 from trunk bug 600: Page not found after a strong rating revise (and extended to most cases when the image is not in the requested section)
git-svn-id: http://piwigo.org/svn/branches/branch-1_7@2431 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'include')
-rw-r--r-- | include/section_init.inc.php | 39 |
1 files changed, 5 insertions, 34 deletions
diff --git a/include/section_init.inc.php b/include/section_init.inc.php index 8a54bd864..6f03cb193 100644 --- a/include/section_init.inc.php +++ b/include/section_init.inc.php @@ -96,6 +96,10 @@ if (script_basename() == 'picture') // basename without file extention if ( is_numeric($token) ) { $page['image_id'] = $token; + if ($page['image_id']==0) + { + bad_request('invalid picture identifier'); + } } else { @@ -525,40 +529,7 @@ if (isset($page['chronology_field'])) if (script_basename() == 'picture' and !isset($page['image_id']) ) { - if ( !empty($page['items']) ) - { - $query = ' -SELECT id,file - FROM '.IMAGES_TABLE .' - WHERE file LIKE "' . $page['image_file'] . '.%" ESCAPE "|"'; - if ( count($page['items']) < 500) - {// for very large item sets do not add IN - because slow - $query .= ' - AND id IN ('.implode(',',$page['items']).') - LIMIT 0,1'; - } - $result = pwg_query($query); - switch (mysql_num_rows($result)) - { - case 0: break; - case 1: - list($page['image_id'], $page['image_file']) = mysql_fetch_row($result); - break; - default: // more than 1 file name match - while ($row = mysql_fetch_row($result) ) - { - if ( in_array($row[0], $page['items']) ) - { - list($page['image_id'], $page['image_file']) = $row; - break; - } - } - } - } - if ( !isset($page['image_id']) ) - { - $page['image_id'] = -1; // will fail in picture.php - } + $page['image_id'] = 0; // more work in picture.php } // add meta robots noindex, nofollow to avoid unnecesary robot crawls |