Changeset 1681 for trunk/include


Ignore:
Timestamp:
Dec 27, 2006, 9:26:36 PM (18 years ago)
Author:
rub
Message:

Fix Feature Issue ID 0000608: crash when asking random images with no images are allowed

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/section_init.inc.php

    r1677 r1681  
    248248
    249249  $page['list'] = array();
    250   if (!preg_match('/^\d+(,\d+)*$/', $tokens[$next_token]))
    251   {
    252     die('wrong format on list GET parameter');
    253   }
    254   foreach (explode(',', $tokens[$next_token]) as $image_id)
    255   {
    256     array_push($page['list'], $image_id);
     250 
     251  // No pictures
     252  if (empty($tokens[$next_token]))
     253  {
     254    // Add dummy element list
     255    array_push($page['list'], -1);
     256  }
     257  // With pictures list
     258  else
     259  {
     260    if (!preg_match('/^\d+(,\d+)*$/', $tokens[$next_token]))
     261    {
     262      die('wrong format on list GET parameter');
     263    }
     264    foreach (explode(',', $tokens[$next_token]) as $image_id)
     265    {
     266      array_push($page['list'], $image_id);
     267    }
    257268  }
    258269  $next_token++;
Note: See TracChangeset for help on using the changeset viewer.