Changeset 1094 for trunk/include/section_init.inc.php
- Timestamp:
- Mar 23, 2006, 2:49:04 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/section_init.inc.php
r1092 r1094 84 84 85 85 $next_token = 0; 86 if (basename($_SERVER['SCRIPT_ NAME']) == 'picture.php')86 if (basename($_SERVER['SCRIPT_FILENAME']) == 'picture.php') 87 87 { // the last token must be the identifier for the picture 88 88 $token = array_pop($tokens); … … 94 94 { 95 95 preg_match('/^(\d+-)?((.*)[_\.]html?)?$/', $token, $matches); 96 if ( isset($matches[1]) and is_numeric($matches[1]) )96 if (isset($matches[1]) and is_numeric($matches[1]=rtrim($matches[1],'-')) ) 97 97 { 98 98 $page['image_id'] = $matches[1]; … … 101 101 $page['image_file'] = $matches[3]; 102 102 } 103 103 104 } 104 105 else … … 508 509 } 509 510 510 if (basename($_SERVER['SCRIPT_ NAME']) == 'picture.php'511 if (basename($_SERVER['SCRIPT_FILENAME']) == 'picture.php' 511 512 and !isset($page['image_id']) ) 512 513 { 513 $query = ' 514 if ( !empty($page['items']) ) 515 { 516 $query = ' 514 517 SELECT id,file 515 518 FROM '.IMAGES_TABLE .' … … 517 520 AND file LIKE "' . $page['image_file'] . '.%" ESCAPE "|"' 518 521 ; 519 $result = pwg_query($query); 520 if (mysql_num_rows($result)>0) 521 { 522 list($page['image_id'], $page['image_file']) = mysql_fetch_row($result); 522 $result = pwg_query($query); 523 if (mysql_num_rows($result)>0) 524 { 525 list($page['image_id'], $page['image_file']) = mysql_fetch_row($result); 526 } 527 } 528 if ( !isset($page['image_id']) ) 529 { 530 $page['image_id'] = -1; // will fail in picture.php 523 531 } 524 532 }
Note: See TracChangeset
for help on using the changeset viewer.