diff --git a/contrib/numeric_score/main.php b/contrib/numeric_score/main.php index 4eb5973d..a1228b97 100644 --- a/contrib/numeric_score/main.php +++ b/contrib/numeric_score/main.php @@ -58,6 +58,11 @@ class NumericScore extends Extension { } } + if(is_a($event, 'ImageDeletionEvent')) { + global $database; + $database->execute("DELETE FROM numeric_score_votes WHERE image_id=?", array($event->image->id)); + } + if(is_a($event, 'SetupBuildingEvent')) { $sb = new SetupBlock("Numeric Score"); $sb->add_bool_option("numeric_score_anon", "Allow anonymous votes: "); diff --git a/contrib/text_score/main.php b/contrib/text_score/main.php index d706ef87..a96850b1 100644 --- a/contrib/text_score/main.php +++ b/contrib/text_score/main.php @@ -32,7 +32,7 @@ class TextScore extends Extension { } if(is_a($event, 'PageRequestEvent') && $event->page_name == "text_score" && - $event->get_arg(0) == "vote" + $event->get_arg(0) == "vote" && isset($_POST['score']) && isset($_POST['image_id'])) { $i_score = int_escape($_POST['score']); $i_image_id = int_escape($_POST['image_id']); @@ -58,6 +58,11 @@ class TextScore extends Extension { } } + if(is_a($event, 'ImageDeletionEvent')) { + global $database; + $database->execute("DELETE FROM text_score_votes WHERE image_id=?", array($event->image->id)); + } + if(is_a($event, 'SetupBuildingEvent')) { $sb = new SetupBlock("Text Score"); $sb->add_bool_option("text_score_anon", "Allow anonymous votes: ");