diff options
author | rub <rub@piwigo.org> | 2006-12-27 20:26:36 +0000 |
---|---|---|
committer | rub <rub@piwigo.org> | 2006-12-27 20:26:36 +0000 |
commit | cc96fca4c5fa560b10dc7d6faf85cb7160aa475e (patch) | |
tree | b81df15cad5356e9621a950e96a89eb0c4f29190 /include | |
parent | a6fcfa34743a0f636a7995d1538902aea6485d0f (diff) |
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
Diffstat (limited to 'include')
-rw-r--r-- | include/section_init.inc.php | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/include/section_init.inc.php b/include/section_init.inc.php index d5bbce645..68fe8d452 100644 --- a/include/section_init.inc.php +++ b/include/section_init.inc.php @@ -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++; } |