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

git-svn-id: http://piwigo.org/svn/trunk@1681 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
rub
2006-12-27 20:26:36 +00:00
parent a6fcfa3474
commit cc96fca4c5

View File

@@ -247,13 +247,24 @@ else if ('list' == $tokens[$next_token])
$next_token++;
$page['list'] = array();
if (!preg_match('/^\d+(,\d+)*$/', $tokens[$next_token]))
// No pictures
if (empty($tokens[$next_token]))
{
die('wrong format on list GET parameter');
// Add dummy element list
array_push($page['list'], -1);
}
foreach (explode(',', $tokens[$next_token]) as $image_id)
// With pictures list
else
{
array_push($page['list'], $image_id);
if (!preg_match('/^\d+(,\d+)*$/', $tokens[$next_token]))
{
die('wrong format on list GET parameter');
}
foreach (explode(',', $tokens[$next_token]) as $image_id)
{
array_push($page['list'], $image_id);
}
}
$next_token++;
}