summaryrefslogtreecommitdiffstats
path: root/web
diff options
context:
space:
mode:
authorLukas Fleischer <lfleischer@archlinux.org>2015-11-10 20:18:13 +0100
committerLukas Fleischer <lfleischer@archlinux.org>2016-02-07 10:54:20 +0100
commit64072461dfcc74857087b23c9ba7d9812b6afe40 (patch)
tree753980782ed91c694fe583495627a5dc8b8b7f4b /web
parentaa5e58db81b8a243e03d0f08925c2d1f34c82304 (diff)
downloadaurweb-64072461dfcc74857087b23c9ba7d9812b6afe40.tar.xz
Add support for package update notifications
Introduce a new notification option to receive notifications when a new commit is pushed to a package repository. Implements FS#30109. Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
Diffstat (limited to 'web')
-rw-r--r--web/html/account.php10
-rw-r--r--web/html/register.php4
-rw-r--r--web/lib/acctfuncs.inc.php7
-rw-r--r--web/template/account_edit_form.php4
4 files changed, 16 insertions, 9 deletions
diff --git a/web/html/account.php b/web/html/account.php
index 2f85a8a..9007ace 100644
--- a/web/html/account.php
+++ b/web/html/account.php
@@ -35,8 +35,8 @@ if ($action == "UpdateAccount") {
in_request("E"), in_request("H"), in_request("P"),
in_request("C"), in_request("R"), in_request("L"),
in_request("I"), in_request("K"), in_request("PK"),
- in_request("J"), in_request("CN"), in_request("ID"),
- $row["Username"]);
+ in_request("J"), in_request("CN"), in_request("UN"),
+ in_request("ID"), $row["Username"]);
}
}
@@ -83,7 +83,7 @@ if (isset($_COOKIE["AURSID"])) {
$row["HideEmail"], "", "", $row["RealName"],
$row["LangPreference"], $row["IRCNick"], $row["PGPKey"], $PK,
$row["InactivityTS"] ? 1 : 0, $row["CommentNotify"],
- $row["ID"], $row["Username"]);
+ $row["UpdateNotify"], $row["ID"], $row["Username"]);
} else {
print __("You do not have permission to edit this account.");
}
@@ -123,8 +123,8 @@ if (isset($_COOKIE["AURSID"])) {
in_request("R"), in_request("L"),
in_request("I"), in_request("K"),
in_request("PK"), in_request("J"),
- in_request("CN"), in_request("ID"),
- $row["Username"]);
+ in_request("CN"), in_request("UN"),
+ in_request("ID"), $row["Username"]);
}
} else {
diff --git a/web/html/register.php b/web/html/register.php
index f58fb25..3155449 100644
--- a/web/html/register.php
+++ b/web/html/register.php
@@ -23,7 +23,7 @@ if (in_request("Action") == "NewAccount") {
"new", "NewAccount", in_request("U"), 1, 0,
in_request("E"), in_request("H"), '', '', in_request("R"),
in_request("L"), in_request("I"), in_request("K"),
- in_request("PK"), 0, in_request("CN"));
+ in_request("PK"), 0, in_request("CN"), in_request("UN"));
print $message;
@@ -31,7 +31,7 @@ if (in_request("Action") == "NewAccount") {
display_account_form("NewAccount", in_request("U"), 1, 0,
in_request("E"), in_request("H"), '', '', in_request("R"),
in_request("L"), in_request("I"), in_request("K"),
- in_request("PK"), 0, in_request("CN"));
+ in_request("PK"), 0, in_request("CN"), in_request("UN"));
}
} else {
print '<p>' . __("Use this form to create an account.") . '</p>';
diff --git a/web/lib/acctfuncs.inc.php b/web/lib/acctfuncs.inc.php
index 796b82b..b39420f 100644
--- a/web/lib/acctfuncs.inc.php
+++ b/web/lib/acctfuncs.inc.php
@@ -57,13 +57,14 @@ function html_format_pgp_fingerprint($fingerprint) {
* @param string $PK The list of SSH public keys
* @param string $J The inactivity status of the displayed user
* @param string $CN Whether to notify of new comments
+ * @param string $UN Whether to notify of package updates
* @param string $UID The user ID of the displayed user
* @param string $N The username as present in the database
*
* @return void
*/
function display_account_form($A,$U="",$T="",$S="",$E="",$H="",$P="",$C="",$R="",
- $L="",$I="",$K="",$PK="",$J="",$CN="",$UID=0,$N="") {
+ $L="",$I="",$K="",$PK="",$J="",$CN="",$UN="",$UID=0,$N="") {
global $SUPPORTED_LANGS;
include("account_edit_form.php");
@@ -90,13 +91,14 @@ function display_account_form($A,$U="",$T="",$S="",$E="",$H="",$P="",$C="",$R=""
* @param string $PK The list of public SSH keys
* @param string $J The inactivity status of the user
* @param string $CN Whether to notify of new comments
+ * @param string $UN Whether to notify of package updates
* @param string $UID The user ID of the modified account
* @param string $N The username as present in the database
*
* @return array Boolean indicating success and message to be printed
*/
function process_account_form($TYPE,$A,$U="",$T="",$S="",$E="",$H="",$P="",$C="",
- $R="",$L="",$I="",$K="",$PK="",$J="",$CN="",$UID=0,$N="") {
+ $R="",$L="",$I="",$K="",$PK="",$J="",$CN="",$UN="",$UID=0,$N="") {
global $SUPPORTED_LANGS;
$error = '';
@@ -344,6 +346,7 @@ function process_account_form($TYPE,$A,$U="",$T="",$S="",$E="",$H="",$P="",$C=""
$q.= ", PGPKey = " . $dbh->quote(str_replace(" ", "", $K));
$q.= ", InactivityTS = " . $inactivity_ts;
$q.= ", CommentNotify = " . ($CN ? "1" : "0");
+ $q.= ", UpdateNotify = " . ($UN ? "1" : "0");
$q.= " WHERE ID = ".intval($UID);
$result = $dbh->exec($q);
diff --git a/web/template/account_edit_form.php b/web/template/account_edit_form.php
index 4f92f69..b9affd6 100644
--- a/web/template/account_edit_form.php
+++ b/web/template/account_edit_form.php
@@ -139,6 +139,10 @@
<label for="id_commentnotify"><?= __("Notify of new comments") ?>:</label>
<input type="checkbox" name="CN" id="id_commentnotify" <?= $CN ? 'checked="checked"' : '' ?> />
</p>
+ <p>
+ <label for="id_updatenotify"><?= __("Notify of package updates") ?>:</label>
+ <input type="checkbox" name="UN" id="id_updatenotify" <?= $UN ? 'checked="checked"' : '' ?> />
+ </p>
</fieldset>
<fieldset>