[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gforge-commits] gforge/common/include User.class,1.28,1.29
From: |
tperdue |
Subject: |
[Gforge-commits] gforge/common/include User.class,1.28,1.29 |
Date: |
Thu, 25 Mar 2004 11:21:37 -0600 |
Update of /cvsroot/gforge/gforge/common/include
In directory db.perdue.net:/home/tperdue/share/dev.gforge.org/common/include
Modified Files:
User.class
Log Message:
changes for new fields in database
Index: User.class
===================================================================
RCS file: /cvsroot/gforge/gforge/common/include/User.class,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -d -r1.28 -r1.29
--- User.class 15 Mar 2004 23:24:47 -0000 1.28
+++ User.class 25 Mar 2004 17:21:34 -0000 1.29
@@ -192,7 +192,8 @@
* create() - Create a new user
*
* @param string The unix username
- * @param string The real username
+ * @param string The real firstname
+ * @param string The real lastname
* @param string The first password
* @param string The confirmation password
* @param string The users email address
@@ -204,19 +205,30 @@
* @param string The users preferred timezone
* @param string The users Jabber address
* @param int The users Jabber preference
+ * @param string The users unix_box.
+ * @param string The users address.
+ * @param string The users address part 2.
+ * @param string The users phone.
+ * @param string The users fax.
+ * @param string The users title.
+ * @param char(2) The users ISO country_code.
* @returns The newly created user ID
*
*/
- function create($unix_name,$realname,$password1,$password2,$email,
+ function
create($unix_name,$firstname,$lastname,$password1,$password2,$email,
$mail_site,$mail_va,$language_id,$timezone,$jabber_address,$jabber_only,
- $unix_box='shell',$address='',$phone='',$fax='',$title='') {
+
$unix_box='shell',$address='',$address2,$phone='',$fax='',$title='',$ccode='US')
{
global $Language;
if (!$unix_name) {
$this->setError($Language->getText('account_register','err_username'));
return false;
}
- if (!$realname) {
-
$this->setError($Language->getText('account_register','err_realname'));
+ if (!$firstname) {
+
$this->setError($Language->getText('account_register','err_firstname'));
+ return false;
+ }
+ if (!$lastname) {
+
$this->setError($Language->getText('account_register','err_lastname'));
return false;
}
if (!$password1) {
@@ -262,13 +274,15 @@
// if we got this far, it must be good
$confirm_hash = substr(md5($session_hash . $password1 .
time()),0,16);
db_begin();
- $sql="INSERT INTO users
(user_name,user_pw,unix_pw,realname,email,add_date,
+ $sql="INSERT INTO users
(user_name,user_pw,unix_pw,realname,firstname,lastname,email,add_date,
status,confirm_hash,mail_siteupdates,mail_va,language,timezone,jabber_address,jabber_only,
- unix_box,address,phone,fax,title)
+ unix_box,address,address2,phone,fax,title,ccode)
VALUES ('$unix_name',
'". md5($password1) . "',
'". account_genunixpw($password1) . "',
- '". htmlspecialchars($realname). "',
+ '". htmlspecialchars($firstname.' '.$lastname). "',
+ '". htmlspecialchars($firstname). "',
+ '". htmlspecialchars($lastname). "',
'$email',
'" . time() . "',
'P',
@@ -281,9 +295,11 @@
'$jabber_only',
'$unix_box',
'". htmlspecialchars($address) ."',
+ '". htmlspecialchars($address2) ."',
'". htmlspecialchars($phone) ."',
'". htmlspecialchars($fax) ."',
- '". htmlspecialchars($title) ."')";
+ '". htmlspecialchars($title) ."',
+ '$ccode')";
$result=db_query($sql);
@@ -331,21 +347,28 @@
}
/**
- * update() - update *common* properties of User object
+ * update() - update *common* properties of User object.
*
- * Use specific setter to change other properties
+ * Use specific setter to change other properties.
*
- * @param string The users real name
- * @param int The ID of the users language preference
- * @param string The useres timezone preference
- * @param string The users preference for receiving site updates
by email
- * @param string The users preference for receiving community
updates by email
- * @param string The users preference for being participating in
"peer ratings"
- * @param string The users Jabber account address
- * @param int The users Jabber preference
+ * @param string The users first name.
+ * @param string The users last name.
+ * @param int The ID of the users language preference.
+ * @param string The useres timezone preference.
+ * @param string The users preference for receiving site updates
by email.
+ * @param string The users preference for receiving community
updates by email.
+ * @param string The users preference for being participating in
"peer ratings".
+ * @param string The users Jabber account address.
+ * @param int The users Jabber preference.
+ * @param string The users address.
+ * @param string The users address2.
+ * @param string The users phone.
+ * @param string The users fax.
+ * @param string The users title.
+ * @param string The users ccode.
*/
- function
update($realname,$language_id,$timezone,$mail_site,$mail_va,$use_ratings,
- $jabber_address,$jabber_only,$address,$phone,$fax,$title) {
+ function
update($firstname,$lastname,$language_id,$timezone,$mail_site,$mail_va,$use_ratings,
+
$jabber_address,$jabber_only,$address,$address2,$phone,$fax,$title,$ccode) {
global $Language;
$mail_site = $mail_site ? 1 : 0;
$mail_va = $mail_va ? 1 : 0;
@@ -366,7 +389,9 @@
$res = db_query("
UPDATE users
SET
- realname='".htmlspecialchars($realname)."',
+ realname='".htmlspecialchars($firstname . ' '
.$lastname)."',
+ firstname='".htmlspecialchars($firstname)."',
+ lastname='".htmlspecialchars($lastname)."',
language='$language_id',
timezone='$timezone',
mail_siteupdates=$mail_site,
@@ -375,9 +400,11 @@
jabber_address='$jabber_address',
jabber_only='$jabber_only',
address='". htmlspecialchars($address) ."',
+ address2='". htmlspecialchars($address2) ."',
phone='". htmlspecialchars($phone) ."',
fax='". htmlspecialchars($fax) ."',
- title='". htmlspecialchars($title) ."'
+ title='". htmlspecialchars($title) ."',
+ ccode='$ccode'
WHERE user_id='".$this->getID()."'
");
@@ -684,7 +711,25 @@
* @return string This user's real name.
*/
function getRealName() {
- return $this->data_array['realname'];
+ return $this->getFirstName(). ' ' .$this->getLastName();
+ }
+
+ /**
+ * getFirstName - get the user's first name.
+ *
+ * @return string This user's first name.
+ */
+ function getFirstName() {
+ return $this->data_array['firstname'];
+ }
+
+ /**
+ * getLastName - get the user's last name.
+ *
+ * @return string This user's last name.
+ */
+ function getLastName() {
+ return $this->data_array['lastname'];
}
/**
@@ -706,6 +751,15 @@
}
/**
+ * getCountryCode - this user's ccode setting.
+ *
+ * @return string This user's ccode setting.
+ */
+ function getCountryCode() {
+ return $this->data_array['ccode'];
+ }
+
+ /**
* getShell - this user's preferred shell.
*
* @return string This user's preferred shell.
@@ -802,13 +856,22 @@
/**
* getAddress - get this user's address.
*
- * @return text This user's address..
+ * @return text This user's address.
*/
function getAddress() {
return $this->data_array['address'];
}
/**
+ * getAddress2 - get this user's address2.
+ *
+ * @return text This user's address2.
+ */
+ function getAddress2() {
+ return $this->data_array['address2'];
+ }
+
+ /**
* getPhone - get this person's phone number.
*
* @return text This user's phone number.
@@ -1012,11 +1075,11 @@
$this->setError('ERROR - Could Not Get Next Unix UID');
return false;
} else {
- $res=db_query("
- UPDATE users
+ $sql="UPDATE users
SET unix_status='A',unix_uid='$unixid'
- WHERE user_id='". $this->getID()."'
- ");
+ WHERE user_id='". $this->getID()."'";
+//echo "\n<br>$sql";
+ $res=db_query($sql);
if (!$res || db_affected_rows($res) < 1) {
$this->setError('ERROR - Could Not Update User
Account Flags: '.db_error());
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gforge-commits] gforge/common/include User.class,1.28,1.29,
tperdue <=