diff --git a/web/html/account.php b/web/html/account.php
index c07d2f9..383b62a 100644
--- a/web/html/account.php
+++ b/web/html/account.php
@@ -62,7 +62,7 @@ if (isset($_COOKIE["AURSID"])) {
display_account_form($atype, "UpdateAccount", $row["Username"],
$row["AccountType"], $row["Suspended"], $row["Email"],
"", "", $row["RealName"], $row["LangPreference"],
- $row["IRCNick"], $row["NewPkgNotify"], $row["ID"]);
+ $row["IRCNick"], $row["NewPkgNotify"], $row["DisplayEmail"], $row["ID"]);
}
}
@@ -80,7 +80,7 @@ if (isset($_COOKIE["AURSID"])) {
$row = mysql_fetch_assoc($result);
display_account_info($row["Username"],
$row["AccountType"], $row["Email"], $row["RealName"],
- $row["IRCNick"]);
+ $row["IRCNick"], $row["DisplayEmail"]);
}
} elseif ($_REQUEST["Action"] == "UpdateAccount") {
@@ -90,7 +90,7 @@ if (isset($_COOKIE["AURSID"])) {
$_REQUEST["U"], $_REQUEST["T"], $_REQUEST["S"],
$_REQUEST["E"], $_REQUEST["P"], $_REQUEST["C"],
$_REQUEST["R"], $_REQUEST["L"], $_REQUEST["I"],
- $_REQUEST["N"], $_REQUEST["ID"]);
+ $_REQUEST["N"], $_REQUEST["D"], $_REQUEST["ID"]);
} else {
@@ -125,7 +125,7 @@ if (isset($_COOKIE["AURSID"])) {
display_account_form($atype, "UpdateAccount", $row["Username"],
$row["AccountType"], $row["Suspended"], $row["Email"],
"", "", $row["RealName"], $row["LangPreference"],
- $row["IRCNick"], $row["NewPkgNotify"], $row["ID"]);
+ $row["IRCNick"], $row["NewPkgNotify"], $row["DisplayEmail"], $row["ID"]);
}
}
}
@@ -141,7 +141,7 @@ if (isset($_COOKIE["AURSID"])) {
process_account_form("","new", "NewAccount",
$_REQUEST["U"], 1, 0, $_REQUEST["E"],
$_REQUEST["P"], $_REQUEST["C"], $_REQUEST["R"],
- $_REQUEST["L"], $_REQUEST["I"], $_REQUEST["N"]);
+ $_REQUEST["L"], $_REQUEST["I"], $_REQUEST["N"], $_REQUEST["D"]);
} else {
# display the account request form
diff --git a/web/lib/acctfuncs.inc b/web/lib/acctfuncs.inc
index 1c15af0..cb2223d 100644
--- a/web/lib/acctfuncs.inc
+++ b/web/lib/acctfuncs.inc
@@ -3,7 +3,7 @@
# Display the standard Account form, pass in default values if any
#
function display_account_form($UTYPE,$A,$U="",$T="",$S="",
- $E="",$P="",$C="",$R="",$L="",$I="",$N="",$UID=0) {
+ $E="",$P="",$C="",$R="",$L="",$I="",$N="", $D="", $UID=0) {
# UTYPE: what user type the form is being displayed for
# A: what "form" name to use
# U: value to display for username
@@ -16,6 +16,7 @@ function display_account_form($UTYPE,$A,$U="",$T="",$S="",
# L: value to display for Language preference
# I: value to display for IRC nick
# N: new package notify value
+ # D: display email publicly
# UID: Users.ID value in case form is used for editing
global $SUPPORTED_LANGS;
@@ -128,6 +129,16 @@ function display_account_form($UTYPE,$A,$U="",$T="",$S="",
print ">";
}
print "\n";
+
+ print "
";
+ print "| ".__("Display Email Publicly").": | ";
+ print "";
+ } else {
+ print ">";
+ }
+ print " |
\n";
print "| |
\n";
print "";
@@ -155,7 +166,7 @@ function display_account_form($UTYPE,$A,$U="",$T="",$S="",
# process form input from a new/edit account form
#
function process_account_form($UTYPE,$TYPE,$A,$U="",$T="",$S="",$E="",
- $P="",$C="",$R="",$L="",$I="",$N="",$UID=0) {
+ $P="",$C="",$R="",$L="",$I="",$N="", $D="", $UID=0) {
# UTYPE: The user's account type
# TYPE: either "edit" or "new"
# A: what parent "form" name to use
@@ -169,6 +180,7 @@ function process_account_form($UTYPE,$TYPE,$A,$U="",$T="",$S="",$E="",
# L: value to display for Language preference
# I: value to display for IRC nick
# N: new package notify value
+ # D: display email publicly
# UID: database Users.ID value
# error check and process request for a new/modified account
@@ -262,7 +274,7 @@ function process_account_form($UTYPE,$TYPE,$A,$U="",$T="",$S="",$E="",
if ($error) {
print "".$error."
\n";
display_account_form($UTYPE, $A, $U, $T, $S, $E, "", "",
- $R, $L, $I, $N, $UID);
+ $R, $L, $I, $N, $D, $UID);
} else {
if ($TYPE == "new") {
# no errors, go ahead and create the unprivileged user
@@ -271,18 +283,17 @@ function process_account_form($UTYPE,$TYPE,$A,$U="",$T="",$S="",$E="",
#md5hash the password
$P = md5($P);
$q = "INSERT INTO Users (AccountTypeID, Suspended, Username, Email, ";
- $q.= "Passwd, RealName, LangPreference, IRCNick, NewPkgNotify) ";
+ $q.= "Passwd, RealName, LangPreference, IRCNick, NewPkgNotify, DisplayEmail) ";
$q.= "VALUES (1, 0, '".mysql_real_escape_string($U)."'";
$q.= ", '".mysql_real_escape_string($E)."'";
$q.= ", '".mysql_real_escape_string($P)."'";
$q.= ", '".mysql_real_escape_string($R)."'";
$q.= ", '".mysql_real_escape_string($L)."'";
$q.= ", '".mysql_real_escape_string($I)."'";
- if ($N) {
- $q.= ", 1)";
- } else {
- $q.= ", 0)";
- }
+ $q.= $N ? ", 1" : ", 0";
+ $q.= $D ? ", 1" : ", 0";
+ $q.= ")";
+
$result = db_query($q, $dbh);
if (!$result) {
print __("Error trying to create account, %h%s%h: %s.",
@@ -319,12 +330,9 @@ function process_account_form($UTYPE,$TYPE,$A,$U="",$T="",$S="",$E="",
$q.= ", RealName = '".mysql_real_escape_string($R)."'";
$q.= ", LangPreference = '".mysql_real_escape_string($L)."'";
$q.= ", IRCNick = '".mysql_real_escape_string($I)."'";
- $q.= ", NewPkgNotify = ";
- if ($N) {
- $q.= "1 ";
- } else {
- $q.= "0 ";
- }
+ $q.= ", NewPkgNotify = ".($N? "1 " : "0 ");
+ $q.= ", DisplayEmail = ".($D? "1 " : "0 ");
+
$q.= "WHERE ID = ".intval($UID);
$result = db_query($q, $dbh);
if (!$result) {
@@ -546,13 +554,14 @@ function search_results_page($UTYPE,$O=0,$SB="",$U="",$T="",
# Display non-editable account info
#
function display_account_info($U="",$T="",
- $E="",$R="",$I="") {
+ $E="",$R="",$I="",$D="") {
# U: value to display for username
# T: value to display for account type
# E: value to display for email address
# R: value to display for RealName
# I: value to display for IRC nick
-
+ # D: should display email address
+
global $SUPPORTED_LANGS;
print "\n";
@@ -578,11 +587,13 @@ function display_account_info($U="",$T="",
}
print "\n";
- print " \n";
- print " | ".__("Email Address").": | \n";
- print " ".$E." | \n";
- print "
\n";
-
+ if ($D){
+ print " \n";
+ print " | ".__("Email Address").": | \n";
+ print " ".$E." | \n";
+ print "
\n";
+ }
+
print " \n";
print " | ".__("Real Name").": | \n";
print " ".$R." | \n";