From aa5e58db81b8a243e03d0f08925c2d1f34c82304 Mon Sep 17 00:00:00 2001 From: Lukas Fleischer Date: Tue, 10 Nov 2015 19:49:13 +0100 Subject: Add global comment notification setting Add a configuration option to the account edit page that allows for globally enabling/disabling package base comment notifications. Signed-off-by: Lukas Fleischer --- web/html/account.php | 18 ++++++++++++------ web/html/register.php | 4 ++-- web/lib/acctfuncs.inc.php | 7 +++++-- web/template/account_edit_form.php | 8 ++++++++ 4 files changed, 27 insertions(+), 10 deletions(-) (limited to 'web') diff --git a/web/html/account.php b/web/html/account.php index b2886fc..2f85a8a 100644 --- a/web/html/account.php +++ b/web/html/account.php @@ -35,7 +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("ID"), $row["Username"]); + in_request("J"), in_request("CN"), in_request("ID"), + $row["Username"]); } } @@ -81,7 +82,8 @@ if (isset($_COOKIE["AURSID"])) { $row["AccountTypeID"], $row["Suspended"], $row["Email"], $row["HideEmail"], "", "", $row["RealName"], $row["LangPreference"], $row["IRCNick"], $row["PGPKey"], $PK, - $row["InactivityTS"] ? 1 : 0, $row["ID"], $row["Username"]); + $row["InactivityTS"] ? 1 : 0, $row["CommentNotify"], + $row["ID"], $row["Username"]); } else { print __("You do not have permission to edit this account."); } @@ -114,10 +116,14 @@ if (isset($_COOKIE["AURSID"])) { print $update_account_message; if (!$success) { - display_account_form("UpdateAccount", in_request("U"), in_request("T"), - in_request("S"), 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("ID"), + display_account_form("UpdateAccount", in_request("U"), + in_request("T"), in_request("S"), + 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"]); } diff --git a/web/html/register.php b/web/html/register.php index f8400a3..f58fb25 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")); + in_request("PK"), 0, in_request("CN")); 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")); + in_request("PK"), 0, in_request("CN")); } } else { print '

' . __("Use this form to create an account.") . '

'; diff --git a/web/lib/acctfuncs.inc.php b/web/lib/acctfuncs.inc.php index 0c6388a..796b82b 100644 --- a/web/lib/acctfuncs.inc.php +++ b/web/lib/acctfuncs.inc.php @@ -56,13 +56,14 @@ function html_format_pgp_fingerprint($fingerprint) { * @param string $K The PGP key fingerprint of the displayed user * @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 $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="",$UID=0,$N="") { + $L="",$I="",$K="",$PK="",$J="",$CN="",$UID=0,$N="") { global $SUPPORTED_LANGS; include("account_edit_form.php"); @@ -88,13 +89,14 @@ function display_account_form($A,$U="",$T="",$S="",$E="",$H="",$P="",$C="",$R="" * @param string $K The PGP fingerprint of the user * @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 $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="",$UID=0,$N="") { + $R="",$L="",$I="",$K="",$PK="",$J="",$CN="",$UID=0,$N="") { global $SUPPORTED_LANGS; $error = ''; @@ -341,6 +343,7 @@ function process_account_form($TYPE,$A,$U="",$T="",$S="",$E="",$H="",$P="",$C="" $q.= ", IRCNick = " . $dbh->quote($I); $q.= ", PGPKey = " . $dbh->quote(str_replace(" ", "", $K)); $q.= ", InactivityTS = " . $inactivity_ts; + $q.= ", CommentNotify = " . ($CN ? "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 cb0fa33..4f92f69 100644 --- a/web/template/account_edit_form.php +++ b/web/template/account_edit_form.php @@ -133,6 +133,14 @@

+
+ : +

+ + /> +

+
+

-- cgit v1.2.3-70-g09d2