From 2b8e44357604446365c61f19e5e11cbef4c59ef0 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jonas=20H=C3=A4ggqvist?= Date: Tue, 17 Mar 2009 23:16:43 +0100 Subject: [PATCH] Mail the uploader when a theme is hidden/deleted. Also store the reason given for hidden themes. --- private/templates/TODO | 2 -- private/themesite.class.php | 30 +++++++++++++++++++++++------- 2 files changed, 23 insertions(+), 9 deletions(-) diff --git a/private/templates/TODO b/private/templates/TODO index 7acf6ce..bcf5685 100644 --- a/private/templates/TODO +++ b/private/templates/TODO @@ -1,6 +1,4 @@ SHORT TERM (needed before going live) - - Implement deleting themes - - Mail people when hiding/deleting their theme. - Store hidden/unverified .zip files in the private dir, with an option for admins to download them. MID TERM (add as soon as possible) diff --git a/private/themesite.class.php b/private/themesite.class.php index 1f5be13..ec755fb 100644 --- a/private/themesite.class.php +++ b/private/themesite.class.php @@ -177,14 +177,16 @@ class themesite { public function changestatus($themeid, $newstatus, $oldstatus, $reason) { $status_text = array('1' => 'Approved', '0' => 'hidden', '-1' => 'deleted'); - $this->log(sprintf("Changing status of theme %d from %s to %s", + $this->log(sprintf("Changing status of theme %d from %s to %s - Reason: %s", $themeid, $status_text[$oldstatus], - $status_text[$newstatus] + $status_text[$newstatus], + $reason )); + $sql = sprintf("SELECT shortname, mainlcd, email, name, author FROM themes WHERE RowID='%d'", db::quote($themeid)); + $theme = $this->db->query($sql)->next(); if ($newstatus == -1) { - $theme = $this->db->query(sprintf("SELECT shortname, mainlcd FROM themes WHERE RowID='%d'", db::quote($themeid)))->next(); $sql = sprintf("DELETE FROM themes WHERE RowID='%d'", db::quote($themeid) ); @@ -203,17 +205,31 @@ class themesite { } } else { - $sql = sprintf("UPDATE themes SET approved='%d' WHERE RowID='%d'", + $sql = sprintf("UPDATE themes SET approved='%d', reason='%s' WHERE RowID='%d'", db::quote($newstatus), + db::quote($reason), db::quote($themeid) ); } if ($oldstatus == 1 && $newstatus < 1) { // Send a mail to notify the user that his theme has been - // hidden/deleted - print("Yeah hi we deleted your themz lol"); + // hidden/deleted. No reason to distinguish, since the result + // for him is the same. + $to = sprintf("%s <%s>", $theme['author'], $theme['email']); + $subject = sprintf("Your theme '%s' has been removed from %s", $theme['name'], config::hostname); + $msg = <<send_mail($subject, $to, $msg); } - print("SQL: $sql
\n"); $this->db->query($sql); } -- 2.11.4.GIT