summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--support/schema/aur-schema.sql9
-rw-r--r--web/html/packages.php57
-rw-r--r--web/html/pkgedit.php24
-rw-r--r--web/lang/account_po.inc2
-rw-r--r--web/lang/acctfuncs_po.inc2
-rw-r--r--web/lang/aur_po.inc2
-rw-r--r--web/lang/common_po.inc2
-rw-r--r--web/lang/hacker_po.inc2
-rw-r--r--web/lang/index_po.inc2
-rw-r--r--web/lang/logout_po.inc2
-rw-r--r--web/lang/pkgedit_po.inc12
-rw-r--r--web/lang/pkgfuncs_po.inc12
-rw-r--r--web/lang/search_po.inc52
-rw-r--r--web/lang/submit_po.inc2
-rw-r--r--web/lang/template_po.inc2
-rw-r--r--web/lang/test_po.inc2
-rw-r--r--web/lang/timeout_po.inc2
-rw-r--r--web/lib/pkgfuncs.inc15
18 files changed, 188 insertions, 15 deletions
diff --git a/support/schema/aur-schema.sql b/support/schema/aur-schema.sql
index 0b6d5e5f..490a5ed2 100644
--- a/support/schema/aur-schema.sql
+++ b/support/schema/aur-schema.sql
@@ -198,3 +198,12 @@ CREATE TABLE PackageComments (
FOREIGN KEY (PackageID) REFERENCES Packages(ID) ON DELETE CASCADE
);
+-- Comment addition notifications
+--
+CREATE TABLE CommentNotify (
+ PkgID INTEGER UNSIGNED NOT NULL,
+ UserID INTEGER UNSIGNED NOT NULL,
+ FOREIGN KEY (PkgID) REFERENCES Packages(ID) ON DELETE CASCADE,
+ FOREIGN KEY (UserID) REFERENCES Users(ID) ON DELETE CASCADE
+);
+
diff --git a/web/html/packages.php b/web/html/packages.php
index 4ea4b012..791837f4 100644
--- a/web/html/packages.php
+++ b/web/html/packages.php
@@ -243,6 +243,10 @@ if (isset($_REQUEST["do_Flag"])) {
$q = "DELETE FROM Packages WHERE ID = " . $id;
$result = db_query($q, $dbh);
+ # 7) delete from CommentNotify
+ $q = "DELETE FROM CommentNotify WHERE ID = " . $id;
+ $result = db_query($q, $dbh);
+
# TODO question: Now that the package as been deleted, does
# the unsupported repo need to be regenerated?
# ANSWER: No, there is no actual repo for unsupported, so no worries! (PJM)
@@ -458,6 +462,59 @@ if (isset($_REQUEST["do_Flag"])) {
pkgsearch_results_link();
+} elseif (isset($_REQUEST["do_Notify"])) {
+ # I realize that the implementation here seems a bit convoluted, but we want to
+ # ensure that everything happens as it should, even if someone called this page
+ # without having clicked a button somewhere (naughty naughty). This also leaves
+ # room to someday expand and allow to add oneself to multiple lists at once. -SL
+ if (!$atype) {
+ print __("You must be logged in before you can get notifications on comments.");
+ print "<br />\n";
+ } else {
+ if (!empty($ids)) {
+ $dbh = db_connect();
+ $uid = uid_from_sid($_COOKIE["AURSID"]);
+ # There currently shouldn't be multiple requests here, but the format in which
+ # it's sent requires this
+ while (list($pid, $v) = each($ids)) {
+ $q = "INSERT INTO CommentNotify (PkgID, UserID) VALUES (".$pid.', '.$uid.')';
+ db_query($q, $dbh);
+ print '<p>';
+ print __("You have been added to the comment notification list.");
+ print '<br /></p>';
+ pkgdetails_link($pid);
+ }
+ } else {
+ print '<p>';
+ print __("Couldn't add to notification list.");
+ print '<br /></p>';
+ }
+ }
+} elseif (isset($_REQUEST["do_UnNotify"])) {
+ if (!$atype) {
+ print __("You must be logged in before you can cancel notification on comments.");
+ print "<br />\n";
+ } else {
+ if (!empty($ids)) {
+ $dbh = db_connect();
+ $uid = uid_from_sid($_COOKIE["AURSID"]);
+ # There currently shouldn't be multiple requests here, but the format in which
+ # it's sent requires this
+ while (list($pid, $v) = each($ids)) {
+ $q = "DELETE FROM CommentNotify WHERE PkgID = ".$pid;
+ $q.= " AND UserID = ".$uid;
+ db_query($q, $dbh);
+ print '<p>';
+ print __("You have been removed from the comment notification list.");
+ print '<br /></p>';
+ pkgdetails_link($pid);
+ }
+ } else {
+ print '<p>';
+ print __("Couldn't remove from notification list.");
+ print '<br /></p>';
+ }
+ }
} else {
# do_More/do_Less/do_Search/do_MyPackages - just do a search
#
diff --git a/web/html/pkgedit.php b/web/html/pkgedit.php
index 6a3f9ffd..ae0170bd 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
#
diff --git a/web/lang/account_po.inc b/web/lang/account_po.inc
index 833e68fd..c246dcad 100644
--- a/web/lang/account_po.inc
+++ b/web/lang/account_po.inc
@@ -327,4 +327,4 @@ $_t["en"]["You do not have permission to edit this account."] = "You do not have
$_t["de"]["You do not have permission to edit this account."] = "Zugriff für das Bearbeiten dieses Benutzerkontos verweigert.";
$_t["pl"]["You do not have permission to edit this account."] = "Nie masz uprawnień do edycji tego konta.";
-?>
+?> \ No newline at end of file
diff --git a/web/lang/acctfuncs_po.inc b/web/lang/acctfuncs_po.inc
index 2c070aa5..862fc78b 100644
--- a/web/lang/acctfuncs_po.inc
+++ b/web/lang/acctfuncs_po.inc
@@ -233,4 +233,4 @@ $_t["en"]["A Trusted User cannot assign Developer status."] = "A Trusted User ca
# $_t["de"]["A Trusted User cannot assign Developer status."] = "--> Deutsche Übersetzung hier. <--";
$_t["pl"]["A Trusted User cannot assign Developer status."] = "Zaufany użytkownik nie może nadać statusu developera.";
-?>
+?> \ No newline at end of file
diff --git a/web/lang/aur_po.inc b/web/lang/aur_po.inc
index 197ca587..8d32378b 100644
--- a/web/lang/aur_po.inc
+++ b/web/lang/aur_po.inc
@@ -89,4 +89,4 @@ $_t["en"]["Developer"] = "Developer";
$_t["de"]["Developer"] = "Entwickler";
$_t["pl"]["Developer"] = "Developer";
-?>
+?> \ No newline at end of file
diff --git a/web/lang/common_po.inc b/web/lang/common_po.inc
index 617a9c32..871d477b 100644
--- a/web/lang/common_po.inc
+++ b/web/lang/common_po.inc
@@ -77,4 +77,4 @@ $_t["en"]["Username"] = "Username";
$_t["de"]["Username"] = "Benutzername";
$_t["pl"]["Username"] = "Użytkownik";
-?>
+?> \ No newline at end of file
diff --git a/web/lang/hacker_po.inc b/web/lang/hacker_po.inc
index 1af174d4..5798d114 100644
--- a/web/lang/hacker_po.inc
+++ b/web/lang/hacker_po.inc
@@ -23,4 +23,4 @@ $_t["en"]["If this problem persists, please contact the site administrator."] =
# $_t["de"]["If this problem persists, please contact the site administrator."] = "--> Deutsche Übersetzung hier. <--";
$_t["pl"]["If this problem persists, please contact the site administrator."] = "Jeżeli ten problem się powtarza, skontaktuj się z administratorem strony.";
-?>
+?> \ No newline at end of file
diff --git a/web/lang/index_po.inc b/web/lang/index_po.inc
index d13e9d5a..be5ee66b 100644
--- a/web/lang/index_po.inc
+++ b/web/lang/index_po.inc
@@ -155,4 +155,4 @@ $_t["en"]["Though we can't vouch for their contents, we provide a %hlist of user
# $_t["de"]["Though we can't vouch for their contents, we provide a %hlist of user repositories%h for your convenience."] = "--> Deutsche Übersetzung hier. <--";
$_t["pl"]["Though we can't vouch for their contents, we provide a %hlist of user repositories%h for your convenience."] = "Dla Twojej wygody podajemy %hlistę repozytoriów użytkowników%h, ale uwaga - nie odpowiadamy za ich zawartość.";
-?>
+?> \ No newline at end of file
diff --git a/web/lang/logout_po.inc b/web/lang/logout_po.inc
index d52c1d55..4b3332f1 100644
--- a/web/lang/logout_po.inc
+++ b/web/lang/logout_po.inc
@@ -23,4 +23,4 @@ $_t["en"]["You have been successfully logged out."] = "You have been successfull
# $_t["de"]["You have been successfully logged out."] = "--> Deutsche Übersetzung hier. <--";
$_t["pl"]["You have been successfully logged out."] = "Zostałeś pomyślnie wylogowany.";
-?>
+?> \ No newline at end of file
diff --git a/web/lang/pkgedit_po.inc b/web/lang/pkgedit_po.inc
index 0d67cc83..30cdc15c 100644
--- a/web/lang/pkgedit_po.inc
+++ b/web/lang/pkgedit_po.inc
@@ -89,4 +89,14 @@ $_t["en"]["You've found a bug if you see this...."] = "You've found a bug if you
# $_t["de"]["Category"] = "--> Deutsche Übersetzung hier. <--";
$_t["pl"]["You've found a bug if you see this...."] = "Jeżeli to widzisz, to znalazłeś błąd...";
-?>
+$_t["en"]["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."] = "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 have 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.";
+# $_t["es"]["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 have 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."] = "--> Traducci�n espa�ola aqu�. <--";
+# $_t["fr"]["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 have 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."] = "--> Traduction fran�aise ici. <--";
+# $_t["de"]["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 have 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."] = "--> Deutsche �bersetzung hier. <--";
+
+$_t["en"]["AUR Comment Notification for %s"] = "AUR Comment Notification for %s";
+# $_t["es"]["AUR Comment Notification for %s"] = "--> Traducci�n espa�ola aqu�. <--";
+# $_t["fr"]["AUR Comment Notification for %s"] = "--> Traduction fran�aise ici. <--";
+# $_t["de"]["AUR Comment Notification for %s"] = "--> Deutsche �bersetzung hier. <--";
+
+?> \ No newline at end of file
diff --git a/web/lang/pkgfuncs_po.inc b/web/lang/pkgfuncs_po.inc
index d0251178..3a9d4299 100644
--- a/web/lang/pkgfuncs_po.inc
+++ b/web/lang/pkgfuncs_po.inc
@@ -308,4 +308,14 @@ $_t["en"]["Package Listing"] = "Package Listing";
# $_t["de"]["Package Listing"] = "--> Deutsche Übersetzung hier. <--";
$_t["pl"]["Package Listing"] = "Lista pakietów";
-?>
+$_t["en"]["UnNotify"] = "UnNotify";
+# $_t["es"]["UnNotify"] = "--> Traducci�n espa�ola aqu�. <--";
+# $_t["fr"]["UnNotify"] = "--> Traduction fran�aise ici. <--";
+# $_t["de"]["UnNotify"] = "--> Deutsche �bersetzung hier. <--";
+
+$_t["en"]["Notify"] = "Notify";
+# $_t["es"]["Notify"] = "--> Traducci�n espa�ola aqu�. <--";
+# $_t["fr"]["Notify"] = "--> Traduction fran�aise ici. <--";
+# $_t["de"]["Notify"] = "--> Deutsche �bersetzung hier. <--";
+
+?> \ No newline at end of file
diff --git a/web/lang/search_po.inc b/web/lang/search_po.inc
index ebb8ee07..2af586e3 100644
--- a/web/lang/search_po.inc
+++ b/web/lang/search_po.inc
@@ -143,4 +143,54 @@ $_t["en"]["Your votes have been cast for the selected packages."] = "Your votes
# $_t["de"]["Your votes have been cast for the selected packages."] = "--> Deutsche Übersetzung hier. <--";
$_t["pl"]["Your votes have been cast for the selected packages."] = "Twoje głosy zostały przyznane wybranym pakietom.";
-?>
+$_t["en"]["None of the selected packages could be deleted."] = "None of the selected packages could be deleted.";
+# $_t["es"]["None of the selected packages could be deleted."] = "--> Traducci�n espa�ola aqu�. <--";
+# $_t["fr"]["None of the selected packages could be deleted."] = "--> Traduction fran�aise ici. <--";
+# $_t["de"]["None of the selected packages could be deleted."] = "--> Deutsche �bersetzung hier. <--";
+
+$_t["en"]["You must be logged in before you can get notifications on comments."] = "You must be logged in before you can get notifications on comments.";
+# $_t["es"]["You must be logged in before you can get notifications on comments."] = "--> Traducci�n espa�ola aqu�. <--";
+# $_t["fr"]["You must be logged in before you can get notifications on comments."] = "--> Traduction fran�aise ici. <--";
+# $_t["de"]["You must be logged in before you can get notifications on comments."] = "--> Deutsche �bersetzung hier. <--";
+
+$_t["en"]["The selected packages have been deleted."] = "The selected packages have been deleted.";
+# $_t["es"]["The selected packages have been deleted."] = "--> Traducci�n espa�ola aqu�. <--";
+# $_t["fr"]["The selected packages have been deleted."] = "--> Traduction fran�aise ici. <--";
+# $_t["de"]["The selected packages have been deleted."] = "--> Deutsche �bersetzung hier. <--";
+
+$_t["en"]["You have been removed from the comment notification list."] = "You have been removed from the comment notification list.";
+# $_t["es"]["You have been removed from the comment notification list."] = "--> Traducci�n espa�ola aqu�. <--";
+# $_t["fr"]["You have been removed from the comment notification list."] = "--> Traduction fran�aise ici. <--";
+# $_t["de"]["You have been removed from the comment notification list."] = "--> Deutsche �bersetzung hier. <--";
+
+$_t["en"]["You must be logged in before you can cancel notification on comments."] = "You must be logged in before you can cancel notification on comments.";
+# $_t["es"]["You must be logged in before you can cancel notification on comments."] = "--> Traducci�n espa�ola aqu�. <--";
+# $_t["fr"]["You must be logged in before you can cancel notification on comments."] = "--> Traduction fran�aise ici. <--";
+# $_t["de"]["You must be logged in before you can cancel notification on comments."] = "--> Deutsche �bersetzung hier. <--";
+
+$_t["en"]["You have been added to the comment notification list."] = "You have been added to the comment notification list.";
+# $_t["es"]["You have been added to the comment notification list."] = "--> Traducci�n espa�ola aqu�. <--";
+# $_t["fr"]["You have been added to the comment notification list."] = "--> Traduction fran�aise ici. <--";
+# $_t["de"]["You have been added to the comment notification list."] = "--> Deutsche �bersetzung hier. <--";
+
+$_t["en"]["You did not select any packages to disown."] = "You did not select any packages to disown.";
+# $_t["es"]["You did not select any packages to disown."] = "--> Traducci�n espa�ola aqu�. <--";
+# $_t["fr"]["You did not select any packages to disown."] = "--> Traduction fran�aise ici. <--";
+# $_t["de"]["You did not select any packages to disown."] = "--> Deutsche �bersetzung hier. <--";
+
+$_t["en"]["You did not select any packages to delete."] = "You did not select any packages to delete.";
+# $_t["es"]["You did not select any packages to delete."] = "--> Traducci�n espa�ola aqu�. <--";
+# $_t["fr"]["You did not select any packages to delete."] = "--> Traduction fran�aise ici. <--";
+# $_t["de"]["You did not select any packages to delete."] = "--> Deutsche �bersetzung hier. <--";
+
+$_t["en"]["Couldn't add to notification list."] = "Couldn't add to notification list.";
+# $_t["es"]["Couldn't add to notification list."] = "--> Traducci�n espa�ola aqu�. <--";
+# $_t["fr"]["Couldn't add to notification list."] = "--> Traduction fran�aise ici. <--";
+# $_t["de"]["Couldn't add to notification list."] = "--> Deutsche �bersetzung hier. <--";
+
+$_t["en"]["Couldn't remove from notification list."] = "Couldn't remove from notification list.";
+# $_t["es"]["Couldn't remove from notification list."] = "--> Traducci�n espa�ola aqu�. <--";
+# $_t["fr"]["Couldn't remove from notification list."] = "--> Traduction fran�aise ici. <--";
+# $_t["de"]["Couldn't remove from notification list."] = "--> Deutsche �bersetzung hier. <--";
+
+?> \ No newline at end of file
diff --git a/web/lang/submit_po.inc b/web/lang/submit_po.inc
index 4dd00ce6..de7c942c 100644
--- a/web/lang/submit_po.inc
+++ b/web/lang/submit_po.inc
@@ -244,4 +244,4 @@ $_t["en"]["Error - No file uploaded"] = "Error - No file uploaded";
# $_t["fr"]["Package upload successful"] = "--> Traduction française ici. <--";
# $_t["de"]["Package upload successful"] = "--> Deutsche Übersetzung hier. <--";
-?>
+?> \ No newline at end of file
diff --git a/web/lang/template_po.inc b/web/lang/template_po.inc
index 8cdc85fa..eb021e94 100644
--- a/web/lang/template_po.inc
+++ b/web/lang/template_po.inc
@@ -17,4 +17,4 @@ $_t["en"]["Hi, this is worth reading!"] = "Hi, this is worth reading!";
# $_t["de"]["Hi, this is worth reading!"] = "--> Deutsche Übersetzung hier. <--";
$_t["pl"]["Hi, this is worth reading!"] = "Witaj, warto to przeczytać!";
-?>
+?> \ No newline at end of file
diff --git a/web/lang/test_po.inc b/web/lang/test_po.inc
index f54f06bc..390dc6bc 100644
--- a/web/lang/test_po.inc
+++ b/web/lang/test_po.inc
@@ -35,4 +35,4 @@ $_t["fr"]["My current language tag is: '%s'."] = "Ma étiquette de langue couran
$_t["de"]["My current language tag is: '%s'."] = "Meine gegenwärtige Sprachflagge ist: '%s'.";
$_t["pl"]["My current language tag is: '%s'."] = "Etykieta mojego obecnego języka to: '%s'.";
-?>
+?> \ No newline at end of file
diff --git a/web/lang/timeout_po.inc b/web/lang/timeout_po.inc
index 71ea1d7f..06bc528c 100644
--- a/web/lang/timeout_po.inc
+++ b/web/lang/timeout_po.inc
@@ -23,4 +23,4 @@ $_t["en"]["Your session has timed out. You must log in again."] = "Your session
# $_t["de"]["Your session has timed out. You must log in again."] = "--> Deutsche Übersetzung hier. <--";
$_t["pl"]["Your session has timed out. You must log in again."] = "Twoja sesja wygasła. Musisz zalogować się ponownie.";
-?>
+?> \ No newline at end of file
diff --git a/web/lib/pkgfuncs.inc b/web/lib/pkgfuncs.inc
index 16da5b9e..451467f9 100644
--- a/web/lib/pkgfuncs.inc
+++ b/web/lib/pkgfuncs.inc
@@ -434,6 +434,8 @@ function package_details($id=0, $SID="") {
print "<td><form action='/packages.php' method='post'>\n";
print "<input type='hidden' name='IDs[".$row["ID"]."]' value='1'>\n";
print "<input type='hidden' name='ID' value='".$row["ID"]."'>\n";
+ # Voting Button
+ #
$q = "SELECT * FROM PackageVotes WHERE UsersID = ".uid_from_sid($SID);
$q.= " AND PackageID = ".$row["ID"];
if (!mysql_num_rows(db_query($q, $dbh))) {
@@ -443,7 +445,18 @@ function package_details($id=0, $SID="") {
print "<input type='submit' class='button' name='do_UnVote'";
print " value='".__("Un-Vote")."'>";
}
- print "</form></td>\n";
+ # Comment Nofify Button
+ #
+ $q = "SELECT * FROM CommentNotify WHERE UserID = ".uid_from_sid($SID);
+ $q.= " AND PkgID = ".$row["ID"];
+ if (!mysql_num_rows(db_query($q, $dbh))) {
+ print "<input type='submit' class='button' name='do_Notify'";
+ print " value='".__("Notify")."'>";
+ } else {
+ print "<input type='submit' class='button' name='do_UnNotify'";
+ print " value='".__("UnNotify")."'>";
+ }
+ print "</form></td>\n";
}
print "</tr>\n";