From 4548b0d08b592180bd4cd66ec127d0069f27c792 Mon Sep 17 00:00:00 2001 From: tardo Date: Sat, 22 Sep 2007 18:08:14 -0400 Subject: Notify by email when package is flagged out of date. FS 3231. In addition to the above, it does not notify if the user that flags package out of date is the same as the owner of the package. The body of the email could use work as well I suppose. Signed-off-by: tardo --- web/html/packages.php | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'web/html') diff --git a/web/html/packages.php b/web/html/packages.php index 4cb8c478..0559060c 100644 --- a/web/html/packages.php +++ b/web/html/packages.php @@ -66,6 +66,27 @@ if (isset($_REQUEST["do_Flag"])) { print "

\n"; print __("The selected packages have been flagged out-of-date."); print "

\n"; + + # notification by tardo. + $f_name = username_from_sid($_COOKIE['AURSID']); + $f_email = email_from_sid($_COOKIE['AURSID']); + $f_uid = uid_from_sid($_COOKIE['AURSID']); + $q = "SELECT Packages.Name, Users.Email, Packages.ID "; + $q.= "FROM Packages, Users "; + $q.= "WHERE Packages.ID IN (" . $flag .") "; + $q.= "AND Users.ID = Packages.MaintainerUID "; + $q.= "AND Users.ID != " . $f_uid; + $result = db_query($q, $dbh); + if (mysql_num_rows($result)) { + while ($row = mysql_fetch_assoc($result)) { + # construct email + $body = "Your package " . $row['Name'] . " has been flagged out of date by " . $f_name . ". You may view your package at:\nhttp://aur.archlinux.org/packages.php?do_Details=1&ID=" . $row['ID']; + $body = wordwrap($body, 70); + $headers = "To: ".$row['Email']."\nReply-to: nobody@archlinux.org\nFrom:aur-notify@archlinux.org\nX-Mailer: PHP\nX-MimeOLE: Produced By AUR\n"; + @mail(' ', "AUR Out-of-date Notification for ".$row['Name'], $body, $headers); + } + } + } else { print "

\n"; print __("You did not select any packages to flag."); -- cgit v1.2.3-24-g4f1b