Rewind arrays before foreach loops over all the elements.

(fixed a small typo as well)
This commit is contained in:
green-ponies (jgen)
2012-02-04 15:35:21 -05:00
parent cd1f5d9ed0
commit 3b028696a0
7 changed files with 23 additions and 2 deletions

View File

@@ -40,6 +40,9 @@ class Ratings implements Extension {
while(true) {
$images = Image::find_images($n, 100, Tag::explode($_POST["query"]));
if(count($images) == 0) break;
reset($images); // rewind to first element in array.
foreach($images as $image) {
send_event(new RatingSetEvent($image, $user, $_POST['rating']));
}