Changeset 2430 for trunk/include/section_init.inc.php
- Timestamp:
- Jul 12, 2008, 2:33:12 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/section_init.inc.php
r2424 r2430 94 94 { 95 95 $page['image_id'] = $token; 96 if ($page['image_id']==0) 97 { 98 bad_request('invalid picture identifier'); 99 } 96 100 } 97 101 else … … 526 530 and !isset($page['image_id']) ) 527 531 { 528 if ( !empty($page['items']) ) 529 { 530 $query = ' 531 SELECT id,file 532 FROM '.IMAGES_TABLE .' 533 WHERE file LIKE "' . $page['image_file'] . '.%" ESCAPE "|"'; 534 if ( count($page['items']) < 500) 535 {// for very large item sets do not add IN - because slow 536 $query .= ' 537 AND id IN ('.implode(',',$page['items']).') 538 LIMIT 0,1'; 539 } 540 $result = pwg_query($query); 541 switch (mysql_num_rows($result)) 542 { 543 case 0: break; 544 case 1: 545 list($page['image_id'], $page['image_file']) = mysql_fetch_row($result); 546 break; 547 default: // more than 1 file name match 548 while ($row = mysql_fetch_row($result) ) 549 { 550 if ( in_array($row[0], $page['items']) ) 551 { 552 list($page['image_id'], $page['image_file']) = $row; 553 break; 554 } 555 } 556 } 557 } 558 if ( !isset($page['image_id']) ) 559 { 560 $page['image_id'] = -1; // will fail in picture.php 561 } 532 $page['image_id'] = 0; // more work in picture.php 562 533 } 563 534
Note: See TracChangeset
for help on using the changeset viewer.