diff --git a/README b/README
index 84ae300..d5e7917 100644
--- a/README
+++ b/README
@@ -37,7 +37,7 @@ To install locally for testing/hacking:
# An AppDB admin user has been automatically created while running
the create_tables script
- username: admin
+ email: admin@localhost
password: testing
You should change the password as soon as possible!
diff --git a/TODO b/TODO
index 0bccda7..986cb6d 100644
--- a/TODO
+++ b/TODO
@@ -3,8 +3,6 @@ WineHQ Application Database TODO List
# incorporate templates into appdb to simplify code, Jeremy says we can
borrow from lostwages(winehq.org/cvsweb/lostwages) for this
-# make email address the users username
-
# check for existing email when user is creating a new account
# setup a cron job in a new /bin directory, put a deny all .htaccess
diff --git a/account.php b/account.php
index 37cdbe5..0349233 100644
--- a/account.php
+++ b/account.php
@@ -76,16 +76,10 @@ function retry($cmd, $msg)
function cmd_do_new()
{
- if(ereg("^.+@.+\\..+$", $_POST['ext_username']))
+ if(!ereg("^.+@.+\\..+$", $_POST['ext_email']))
{
- $_POST['ext_username'] = "";
- retry("new", "Invalid Username, must not contain special characters");
- return;
- }
- if(strlen($_POST['ext_username']) < 3)
- {
- $_POST['ext_username'] = "";
- retry("new", "Username must be at least 3 characters");
+ $_POST['ext_email'] = "";
+ retry("new", "Invalid email address");
return;
}
if(strlen($_POST['ext_password']) < 5)
@@ -103,28 +97,22 @@ function cmd_do_new()
retry("new", "You don't have a Real name?");
return;
}
- if(!ereg("^.+@.+\\..+$", $_POST['ext_email']))
- {
- $_POST['ext_email'] = "";
- retry("new", "Invalid email address");
- return;
- }
-
+
$user = new User();
- if($user->exists($_POST['ext_username']))
+ if($user->exists($_POST['ext_email']))
{
- $_POST['ext_username'] = "";
- retry("new", "That username is already in use");
+ $_POST['ext_email'] = "";
+ retry("new", "An account with this e-mail is already in use");
return;
}
- $result = $user->create($_POST['ext_username'], $_POST['ext_password'], $_POST['ext_realname'], $_POST['ext_email'], $_POST['CVSrelease'] );
+ $result = $user->create($_POST['ext_email'], $_POST['ext_password'], $_POST['ext_realname'], $_POST['CVSrelease'] );
if($result == null)
{
- $user->login($_POST['ext_username'], $_POST['ext_password']);
- addmsg("Account created! (".$_POST['ext_username'].")", "green");
+ $user->login($_POST['ext_email'], $_POST['ext_password']);
+ addmsg("Account created! (".$_POST['ext_email'].")", "green");
redirect(apidb_fullurl());
}
else
@@ -139,7 +127,7 @@ function cmd_send_passwd()
{
$user = new User();
- $userid = $user->lookup_userid($_POST['ext_username']);
+ $userid = $user->lookup_userid($_POST['ext_email']);
$passwd = generate_passwd();
if ($userid)
@@ -169,7 +157,7 @@ function cmd_send_passwd()
}
else
{
- addmsg("Sorry, that username (". urlencode($_POST['ext_username']) .") does not exist.", "red");
+ addmsg("Sorry, that user (". urlencode($_POST['ext_email']) .") does not exist.", "red");
}
redirect(apidb_fullurl("account.php?cmd=login"));
@@ -182,12 +170,12 @@ function cmd_send_passwd()
function cmd_do_login()
{
$user = new User();
- $result = $user->login($_POST['ext_username'], $_POST['ext_password']);
+ $result = $user->login($_POST['ext_email'], $_POST['ext_password']);
if($result == null)
{
$_SESSION['current'] = $user;
- addmsg("You are successfully logged in as '$user->username'.", "green");
+ addmsg("You are successfully logged in as '$user->realname'.", "green");
redirect(apidb_fullurl("index.php"));
} else
{
diff --git a/addcomment.php b/addcomment.php
index 7e83b48..c83a869 100644
--- a/addcomment.php
+++ b/addcomment.php
@@ -59,7 +59,7 @@ if(isset($_REQUEST['body']))
$fullAppName = "Application: ".lookupAppName($_REQUEST['appId'])." Version: ".lookupVersionName($_REQUEST['appId'], $_REQUEST['versionId']);
$ms .= APPDB_ROOT."appview.php?appId=".$_REQUEST['appId']."&versionId=".$_REQUEST['versionId'].".\n";
$ms .= "\n";
- $ms .= ($_SESSION['current']->username ? $_SESSION['current']->username : "Anonymous")." added comment to ".$fullAppName."\n";
+ $ms .= ($_SESSION['current']->realname ? $_SESSION['current']->realname : "Anonymous")." added comment to ".$fullAppName."\n";
$ms .= "\n";
$ms .= "Subject: ".$subject."\n";
$ms .= "\n";
@@ -80,7 +80,7 @@ if(isset($_REQUEST['body']))
$fullAppName = "Application: ".lookupAppName($_REQUEST['appId'])." Version: ".lookupVersionName($_REQUEST['appId'], $_REQUEST['versionId']);
$ms = APPDB_ROOT."appview.php?appId=".$_REQUEST['appId']."&versionId=".$_REQUEST['versionId'].".\n";
$ms .= "\n";
- $ms .= $_SESSION['current']->username." added comment to ".$fullAppName."\n";
+ $ms .= $_SESSION['current']->realname." added comment to ".$fullAppName."\n";
$ms .= "\n";
$ms .= "Subject: ".$subject."\n";
$ms .= "\n";
@@ -129,7 +129,7 @@ else if(loggedin())
echo '
',"\n";
echo "| From: | \n";
- echo " ".$_SESSION['current']->username." |
\n";
+ echo " ".$_SESSION['current']->realname." | \n";
echo "| Subject: | \n";
echo " |
\n";
echo " |
\n";
diff --git a/admin/addAppNote.php b/admin/addAppNote.php
index 1e98058..058c9d0 100644
--- a/admin/addAppNote.php
+++ b/admin/addAppNote.php
@@ -45,7 +45,7 @@ if($_REQUEST['sub'] == "Submit")
$fullAppName .= " Version: ".lookupVersionName($_REQUEST['appId'], $_REQUEST['versionId']);
$ms = APPDB_ROOT."appview.php?appId=".$_REQUEST['appId']."&versionId=".$_REQUEST['versionId']."\n";
$ms .= "\n";
- $ms .= ($_SESSION['current']->username ? $_SESSION['current']->username : "Anonymous")." added note to ".$fullAppName."\n";
+ $ms .= ($_SESSION['current']->realname ? $_SESSION['current']->realname : "Anonymous")." added note to ".$fullAppName."\n";
$ms .= "\n";
$ms .= "title: ".$_REQUEST['noteTitle']."\n";
$ms .= "\n";
diff --git a/admin/adminAppDataQueue.php b/admin/adminAppDataQueue.php
index ebea38d..5f48db3 100644
--- a/admin/adminAppDataQueue.php
+++ b/admin/adminAppDataQueue.php
@@ -48,7 +48,7 @@ if (!$_REQUEST['queueId'])
echo "\n";
echo " | Submission Date | \n";
echo " Queue Id | \n";
- echo " Username (e-mail) | \n";
+ echo " Name (e-mail) | \n";
echo " Application Name | \n";
echo " Version | \n";
echo " Type | \n";
@@ -66,7 +66,7 @@ if (!$_REQUEST['queueId'])
echo " ".date("Y-n-t h:i:sa", $ob->submitTime)." | \n";
echo " ".$ob->queueId." | \n";
if($ob->userId)
- echo " ".lookupUsername($ob->userId)." (".lookupEmail($ob->userId).") | \n";
+ echo " ".lookupRealname($ob->userId)." (".lookupEmail($ob->userId).") | \n";
else
echo " Anonymous | \n";
echo "".appIdToName($ob->appId)." | \n";
diff --git a/admin/adminMaintainerQueue.php b/admin/adminMaintainerQueue.php
index 8ff8b48..e6cae25 100644
--- a/admin/adminMaintainerQueue.php
+++ b/admin/adminMaintainerQueue.php
@@ -67,11 +67,11 @@ if ($_REQUEST['sub'])
{
if($firstDisplay)
{
- echo "".lookupUsername($userIdValue)." |
\n";
+ echo "".lookupRealname($userIdValue)." | \n";
$firstDisplay = false;
} else
{
- echo " | ".lookupUsername($userIdValue)." |
\n";
+ echo " | ".lookupRealname($userIdValue)." |
\n";
}
}
}
@@ -84,11 +84,11 @@ if ($_REQUEST['sub'])
{
if($firstDisplay)
{
- echo "".lookupUsername($userIdValue)."* | \n";
+ echo "".lookupRealname($userIdValue)."* | \n";
$firstDisplay = false;
} else
{
- echo " | ".lookupUsername($userIdValue)."* |
\n";
+ echo " | ".lookupRealname($userIdValue)."* |
\n";
}
}
}
@@ -283,7 +283,7 @@ if ($_REQUEST['sub'])
echo "\n";
echo " | Submission Date | \n";
echo " Queue Id | \n";
- echo " Username | \n";
+ echo " Name | \n";
echo " Application Name | \n";
echo " Version | \n";
echo " Super maintainer? | \n";
@@ -298,7 +298,7 @@ if ($_REQUEST['sub'])
echo "
\n";
echo " | ".date("Y-n-t h:i:sa", $ob->submitTime)." | \n";
echo " $ob->queueId | \n";
- echo " ".lookupUsername($ob->userId)." | \n";
+ echo " ".lookupRealname($ob->userId)." | \n";
echo " ".appIdToName($ob->appId)." | \n";
if($ob->superMaintainer)
diff --git a/admin/adminMaintainers.php b/admin/adminMaintainers.php
index b8b7d36..4506ea9 100644
--- a/admin/adminMaintainers.php
+++ b/admin/adminMaintainers.php
@@ -56,7 +56,7 @@ if ($_REQUEST['sub'])
echo "
\n";
echo " | Submission Date | \n";
- echo " Username | \n";
+ echo " Name | \n";
echo " Application Name | \n";
echo " Version | \n";
echo " Super maintainer? | \n";
@@ -71,7 +71,7 @@ if ($_REQUEST['sub'])
if ($c % 2 == 1) { $bgcolor = 'color0'; } else { $bgcolor = 'color1'; }
echo "
\n";
echo " | ".date("Y-n-t h:i:sa", $ob->submitTime)." | \n";
- echo " ".lookupUsername($ob->userId)." | \n";
+ echo " ".lookupRealname($ob->userId)." | \n";
if($ob->superMaintainer)
{
diff --git a/admin/editAppNote.php b/admin/editAppNote.php
index 265b748..c53b230 100644
--- a/admin/editAppNote.php
+++ b/admin/editAppNote.php
@@ -45,7 +45,7 @@ if(isset($_REQUEST['sub']))
if($sEmail)
{
- $ms .= ($_SESSION['current']->username ? $_SESSION['current']->username : "Anonymous")." deleted note from ".$sFullAppName."\n";
+ $ms .= ($_SESSION['current']->realname ? $_SESSION['current']->realname : "Anonymous")." deleted note from ".$sFullAppName."\n";
$ms .= "\n";
$ms .= "title: ".$sOldNoteTitle."\n";
$ms .= "\n";
@@ -72,7 +72,7 @@ if(isset($_REQUEST['sub']))
if($sEmail)
{
- $ms .= ($_SESSION['current']->username ? $_SESSION['current']->username : "Anonymous")." changed note for ".$sFullAppName."\n";
+ $ms .= ($_SESSION['current']->realname ? $_SESSION['current']->realname : "Anonymous")." changed note for ".$sFullAppName."\n";
$ms .= "From --------------------------\n";
$ms .= "title: ".$sOldNoteTitle."\n";
$ms .= "\n";
diff --git a/admin/editAppVersion.php b/admin/editAppVersion.php
index 6ca34be..c1312bd 100644
--- a/admin/editAppVersion.php
+++ b/admin/editAppVersion.php
@@ -110,7 +110,7 @@ if(isset($_REQUEST['submit1']))
$fullAppName = "Application: ".lookupAppName($_REQUEST['appId'])." Version: ".lookupVersionName($_REQUEST['appId'], $_REQUEST['versionId']);
$ms .= APPDB_ROOT."appview.php?appId=".$_REQUEST['appId']."&versionId=".$_REQUEST['versionId']."\n";
$ms .= "\n";
- $ms .= ($_SESSION['current']->username ? $_SESSION['current']->username : "Anonymous")." changed ".$fullAppName."\n";
+ $ms .= ($_SESSION['current']->realname ? $_SESSION['current']->realname : "Anonymous")." changed ".$fullAppName."\n";
$ms .= "\n";
$ms .= $WhatChanged."\n";
$ms .= "\n";
diff --git a/appview.php b/appview.php
index cfebb76..f99f799 100644
--- a/appview.php
+++ b/appview.php
@@ -314,7 +314,7 @@ if($appId && !$versionId)
while(list($index, list($userIdValue)) = each($other_maintainers))
{
echo "
| \n";
- echo " ".lookupUsername($userIdValue)." |
\n";
+ echo " ".lookupRealname($userIdValue)."\n";
}
} else
{
@@ -449,7 +449,7 @@ else if($appId && $versionId)
while(list($index, list($userIdValue)) = each($other_maintainers))
{
echo "| ";
- echo "".lookupUsername($userIdValue)." |
\n";
+ echo "".lookupRealname($userIdValue)."\n";
}
} else
{
diff --git a/deletecomment.php b/deletecomment.php
index 5fedc02..d35e4f5 100644
--- a/deletecomment.php
+++ b/deletecomment.php
@@ -99,16 +99,16 @@ if($_SESSION['current']->getpref("confirm_comment_deletion") != "no" &&
{
$email = getNotifyEmailAddressList($_REQUEST['appId'], $_REQUEST['versionId']);
$notify_user_email=lookupEmail($ob->userId);
- $notify_user_username=lookupUsername($ob->userId);
+ $notify_user_realname=lookupRealname($ob->userId);
$email .= $notify_user_email;
if($email)
{
$fullAppName = "Application: ".lookupAppName($_REQUEST['appId'])." Version: ".lookupVersionName($_REQUEST['appId'], $_REQUEST['versionId']);
$ms = APPDB_ROOT."appview.php?appId=".$_REQUEST['appId']."&versionId=".$_REQUEST['versionId']."\n";
$ms .= "\n";
- $ms .= $_SESSION['current']->username." deleted comment from ".$fullAppName."\n";
+ $ms .= $_SESSION['current']->realname." deleted comment from ".$fullAppName."\n";
$ms .= "\n";
- $ms .= "This comment was made on ".substr($ob->time,0,10)." by $notify_user_username \n";
+ $ms .= "This comment was made on ".substr($ob->time,0,10)." by $notify_user_realname \n";
$ms .= "\n";
$ms .= "Subject: ".$subject."\n";
$ms .= "\n";
diff --git a/edituser.php b/edituser.php
index 713e326..e84a0fa 100644
--- a/edituser.php
+++ b/edituser.php
@@ -20,7 +20,7 @@ if(!havepriv("admin"))
exit;
}
$user = new User();
- $result = query_appdb("SELECT stamp, userid, username, realname, ".
+ $result = query_appdb("SELECT stamp, userid, realname, ".
"created, status, perm FROM user_list WHERE ".
"userid = '$userid'", $user->link);
if(!$result)
@@ -30,11 +30,9 @@ if(!havepriv("admin"))
}
- list($user->stamp, $user->userid, $user->username, $user->realname,
+ list($user->stamp, $user->userid, $user->realname,
$user->created, $status, $perm) = mysql_fetch_row($result);
- global $ext_username, $ext_password1, $ext_password2, $ext_realname, $ext_email, $ext_hasadmin;
-
if($_POST)
{
if ($ext_password == $ext_password2)
@@ -70,9 +68,6 @@ if($_POST)
echo html_frame_start("Data for user ID $userid", "80%");
echo html_table_begin("width='100%' border=0 align=left cellspacing=0 class='box-body'");
-
-
- $ext_username = $user->lookup_username($userid);
$ext_realname = $user->lookup_realname($userid);
$ext_email = $user->lookup_email($userid);
if($user->checkpriv("admin"))
@@ -84,8 +79,8 @@ if($_POST)
?>
- | User Name |
- |
+ Email Address |
+ |
| Password |
@@ -99,10 +94,6 @@ if($_POST)
Real Name |
|
-
- | Email Address |
- |
-
| Administrator |
"> |
diff --git a/include/comments.php b/include/comments.php
index c67d7c3..b309645 100644
--- a/include/comments.php
+++ b/include/comments.php
@@ -8,17 +8,10 @@ function forum_lookup_user ($userid)
$mailto = '';
if ($userid > 0)
{
- $qstring = "SELECT email,username FROM user_list WHERE userid = '".$userid."' LIMIT 1";
+ $qstring = "SELECT email FROM user_list WHERE userid = '".$userid."' LIMIT 1";
$result = mysql_query($qstring);
$usr = mysql_fetch_object($result);
- if ($usr->email)
- {
- $mailto = '' . $usr->username . '';
- }
- else
- {
- $mailto = $usr->username;
- }
+ $mailto = '' . $usr->realname . '';
unset($qstring, $result, $usr);
}
else
diff --git a/include/form_edit.php b/include/form_edit.php
index 3581cc2..3f30e44 100644
--- a/include/form_edit.php
+++ b/include/form_edit.php
@@ -6,8 +6,8 @@
- | User Name |
- |
+ Email Address |
+ |
| Password |
@@ -21,10 +21,6 @@
Real Name |
|
-
- | Email Address |
- |
-
| |
diff --git a/include/form_login.php b/include/form_login.php
index d6c8c50..f410faa 100644
--- a/include/form_login.php
+++ b/include/form_login.php
@@ -18,8 +18,8 @@ function cmd_send_passwd() {
- | User Name |
- '> |
+ E-mail |
+ '> |
| Password |
diff --git a/include/form_new.php b/include/form_new.php
index 4ff1041..18f70e2 100644
--- a/include/form_new.php
+++ b/include/form_new.php
@@ -10,8 +10,8 @@ echo html_frame_start("Create New Application DB Account","400","",0)
- | User Name |
- '> |
+ E-mail |
+ '> |
| Password |
@@ -25,11 +25,6 @@ echo html_frame_start("Create New Application DB Account","400","",0)
Real Name |
'> |
-
- | Email Address |
- '> |
-
-
Wine version | ";
diff --git a/include/incl.php b/include/incl.php
index 332e5e1..6c21095 100644
--- a/include/incl.php
+++ b/include/incl.php
@@ -46,7 +46,7 @@ function apidb_fullpath($path)
*/
function apidb_header($title = 0)
{
- $username = isset($_SESSION['current'])?$_SESSION['current']->username:"";
+ $realname = isset($_SESSION['current'])?$_SESSION['current']->realname:"";
// Set Page Title
$page_title = $title;
diff --git a/include/query_users.php b/include/query_users.php
index 7d5a499..60447b5 100644
--- a/include/query_users.php
+++ b/include/query_users.php
@@ -36,9 +36,8 @@ echo html_frame_start("List Users","400","",0)
|
-
+
-
diff --git a/include/tableve.php b/include/tableve.php
index 1130a4a..a24817f 100644
--- a/include/tableve.php
+++ b/include/tableve.php
@@ -302,7 +302,7 @@ class TableVE {
if($field->name == "lastmodby")
{
$user = new user();
- $name = $user->lookup_username($value);
+ $name = $user->lookup_realname($value);
if(!$name)
$name = "system";
echo "$name ($value)";
diff --git a/include/user.php b/include/user.php
index e63b860..b156696 100644
--- a/include/user.php
+++ b/include/user.php
@@ -7,7 +7,6 @@ class User {
var $stamp;
var $userid;
- var $username;
var $realname;
var $created;
var $status;
@@ -27,23 +26,17 @@ class User {
* check if a user exists
* returns TRUE if the user exists
*/
- function exists($username)
+ function exists($sEmail)
{
- $result = mysql_query("SELECT * FROM user_list WHERE username = '$username'");
+ $result = mysql_query("SELECT * FROM user_list WHERE email = '$sEmail'");
if(!$result || mysql_num_rows($result) != 1)
return 0;
return 1;
}
-
- function lookup_username($userid)
+ function lookup_userid($sEmail)
{
- return lookupUsername($userId);
- }
-
- function lookup_userid($username)
- {
- $result = mysql_query("SELECT userid FROM user_list WHERE username = '$username'");
+ $result = mysql_query("SELECT userid FROM user_list WHERE email = '$sEmail'");
if(!$result || mysql_num_rows($result) != 1)
return null;
$ob = mysql_fetch_object($result);
@@ -79,28 +72,28 @@ class User {
* restore a user from the database
* returns 0 on success and an error msg on failure
*/
- function restore($username, $password)
+ function restore($sEmail, $sPassword)
{
- $result = mysql_query("SELECT stamp, userid, username, realname, ".
+ $result = mysql_query("SELECT stamp, userid, realname, ".
"created, status, perm FROM user_list WHERE ".
- "username = '$username' AND ".
- "password = password('$password')");
+ "email = '$sEmail' AND ".
+ "password = password('$sPassword')");
if(!$result)
return "Error: ".mysql_error();
if(mysql_num_rows($result) == 0)
- return "Invalid username or password";
+ return "Invalid e-mail or password";
- list($this->stamp, $this->userid, $this->username, $this->realname,
+ list($this->stamp, $this->userid, $this->realname,
$this->created, $status, $perm) = mysql_fetch_row($result);
return 0;
}
- function login($username, $password)
+ function login($sEmail, $sPassword)
{
- $result = $this->restore($username, $password);
+ $result = $this->restore($sEmail, $sPassword);
/* if our result is non-null then we must have had an error */
if($result != null)
@@ -108,7 +101,7 @@ class User {
/* update the 'stamp' field in the users account to reflect the last time */
/* they logged in */
- $myUserId = $this->lookup_userid($username);
+ $myUserId = $this->lookup_userid($sEmail);
$result = mysql_query("UPDATE user_list SET stamp=null WHERE userid=$myUserId;");
return 0;
}
@@ -176,12 +169,12 @@ class User {
* remove the current, or specified user from the database
* returns 0 on success and an error msg on failure
*/
- function remove($username = 0)
+ function remove($sEmail = 0)
{
- if($username == 0)
- $username = $this->username;
+ if($sEmail == 0)
+ $sEmail = $this->email;
- $result = mysql_query("DELETE FROM user_list WHERE username = '$username'");
+ $result = mysql_query("DELETE FROM user_list WHERE email = '$sEmail'");
if(!$result)
return mysql_error();
@@ -348,16 +341,6 @@ function generate_passwd($pass_len = 10)
}
-function lookupUsername($userid)
-{
- $result = mysql_query("SELECT username FROM user_list WHERE userid = $userid");
- if(!$result || mysql_num_rows($result) != 1)
- return null;
- $ob = mysql_fetch_object($result);
- return $ob->username;
-}
-
-
function lookupEmail($userid)
{
$result = mysql_query("SELECT email FROM user_list WHERE userid = $userid");
@@ -367,6 +350,14 @@ function lookupEmail($userid)
return $ob->email;
}
+function lookupRealname($userid)
+{
+ $result = mysql_query("SELECT realname FROM user_list WHERE userid = $userid");
+ if(!$result || mysql_num_rows($result) != 1)
+ return null;
+ $ob = mysql_fetch_object($result);
+ return $ob->realname;
+}
function UserWantsEmail($userid)
{
diff --git a/preferences.php b/preferences.php
index 415d7e6..6b64165 100644
--- a/preferences.php
+++ b/preferences.php
@@ -51,7 +51,6 @@ function show_user_fields()
$user = new User();
- $ext_username = $_SESSION['current']->username;
$ext_realname = $user->lookup_realname($_SESSION['current']->userid);
$ext_email = $user->lookup_email($_SESSION['current']->userid);
$CVSrelease = $user->lookup_CVSrelease($_SESSION['current']->userid);
@@ -97,7 +96,7 @@ if($_POST)
apidb_header("User Preferences");
echo "