clean up votes when images are deleted
git-svn-id: file:///home/shish/svn/shimmie2/trunk@547 7f39781d-f577-437e-ae19-be835c7a54ca
This commit is contained in:
parent
c11d39f5b7
commit
2c43a4f420
2 changed files with 11 additions and 1 deletions
|
@ -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: ");
|
||||
|
|
|
@ -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: ");
|
||||
|
|
Reference in a new issue