summaryrefslogtreecommitdiffstats
path: root/web/html/pkgedit.php
diff options
context:
space:
mode:
authorsimo <simo>2005-06-08 01:07:55 +0000
committersimo <simo>2005-06-08 01:07:55 +0000
commit6adf639a341b8954e911fce2d2bd3e7443a1426c (patch)
tree5e4c0d686db1569ec4c64784e0be5f05c4b68d22 /web/html/pkgedit.php
parent9c004010e3251d8d1b4f7430db22d3d721623577 (diff)
downloadaurweb-6adf639a341b8954e911fce2d2bd3e7443a1426c.tar.xz
SQL CHANGES: New table CommentNotify with fields:
PkgID UserID This implements emailing comment notifications, including a user option to enable/disable it on the package page. It uses php's mail() function to do it and sends to everyone on the notify list as BCC. This needs some more testing before public consumption.
Diffstat (limited to 'web/html/pkgedit.php')
-rw-r--r--web/html/pkgedit.php24
1 files changed, 24 insertions, 0 deletions
diff --git a/web/html/pkgedit.php b/web/html/pkgedit.php
index 6a3f9ff..ae0170b 100644
--- a/web/html/pkgedit.php
+++ b/web/html/pkgedit.php
@@ -76,6 +76,30 @@ if ($_REQUEST["add_Comment"]) {
print __("Comment has been added.")."<br />&nbsp;<br />\n";
pkgdetails_link($_REQUEST["ID"]);
+ # Send email notifications
+ #
+ $q = "SELECT CommentNotify.*, Users.Email ";
+ $q.= "FROM CommentNotify, Users ";
+ $q.= "WHERE Users.ID = CommentNotify.UserID ";
+ $q.= "AND CommentNotify.PkgID = ".intval($_REQUEST["ID"]);
+ $result = db_query($q, $dbh);
+ $bcc = array();
+ if (mysql_num_rows($result)) {
+ while ($row = mysql_fetch_assoc($result)) {
+ array_push($bcc, $row['Email']);
+ }
+ $q = "SELECT Packages.Name ";
+ $q.= "FROM Packages ";
+ $q.= "WHERE Packages.ID = ".intval($_REQUEST["ID"]);
+ $result = db_query($q, $dbh);
+ $row = mysql_fetch_assoc($result);
+ $body = __("A comment has been added to %s, you may view it at:\nhttp://aur.archlinux.org/packages.php?do_Details=1&ID=%s\n\nYou recieved this e-mail because you chose to recieve notifications of new comments on this package, if you no longer wish to recieve notifications about this package, please go the the above package page and click the appropriate control.",array($row['Name'],$_REQUEST["ID"]));
+ $body = wordwrap($body, 70);
+ $bcc = implode(', ', $bcc);
+ $headers = "Bcc: $bcc\nReply-to: nobody@archlinux.org\nFrom:aur-notify@archlinux.org\nX-Mailer: PHP\nX-MimeOLE: Produced By AUR\n";
+ @mail(' ', __("AUR Comment Notification for %s",array($row['Name'])), $body, $headers);
+ }
+
} else {
# Prompt visitor for comment
#