Formatting, and merged expires field into sql

This commit is contained in:
Miles Lott 2001-05-02 09:38:37 +00:00
parent 99ff1cb575
commit cee6081e38
2 changed files with 132 additions and 119 deletions

View File

@ -45,17 +45,18 @@
$this->db->query("select * from phpgw_accounts where account_id='" . $this->account_id . "'",__LINE__,__FILE__); $this->db->query("select * from phpgw_accounts where account_id='" . $this->account_id . "'",__LINE__,__FILE__);
$this->db->next_record(); $this->db->next_record();
$this->data["userid"] = $this->db->f("account_lid"); $this->data['userid'] = $this->db->f('account_lid');
$this->data["account_id"] = $this->db->f("account_id"); $this->data['account_id'] = $this->db->f('account_id');
$this->data["account_lid"] = $this->db->f("account_lid"); $this->data['account_lid'] = $this->db->f('account_lid');
$this->data["firstname"] = $this->db->f("account_firstname"); $this->data['firstname'] = $this->db->f('account_firstname');
$this->data["lastname"] = $this->db->f("account_lastname"); $this->data['lastname'] = $this->db->f('account_lastname');
$this->data["fullname"] = $this->db->f("account_firstname")." ".$this->db->f("account_lastname"); $this->data['fullname'] = $this->db->f('account_firstname').' '.$this->db->f('account_lastname');
$this->data["lastlogin"] = $this->db->f("account_lastlogin"); $this->data['lastlogin'] = $this->db->f('account_lastlogin');
$this->data["lastloginfrom"] = $this->db->f("account_lastloginfrom"); $this->data['lastloginfrom'] = $this->db->f('account_lastloginfrom');
$this->data["lastpasswd_change"] = $this->db->f("account_lastpwd_change"); $this->data['lastpasswd_change'] = $this->db->f('account_lastpwd_change');
$this->data["account_type"] = $this->db->f("account_type"); $this->data['account_type'] = $this->db->f('account_type');
$this->data["status"] = $this->db->f("account_status"); $this->data['status'] = $this->db->f('account_status');
$this->data['expires'] = $this->db->f('account_expires');
return $this->data; return $this->data;
} }
@ -63,11 +64,12 @@
{ {
$this->db->query("update phpgw_accounts set account_lid='" . $this->data["account_lid"] $this->db->query("update phpgw_accounts set account_lid='" . $this->data["account_lid"]
. "', account_firstname='" . $this->data['firstname'] . "', account_firstname='" . $this->data['firstname']
. "', account_lastname='" . $this->data['lastname'] . "', account_lastname='" . $this->data['lastname'] . "', account_status='"
. "', account_status='" . $this->data['status'] . $this->data['status'] . "', account_expires='" . $this->data['expires'] . "' where account_id='"
. "' where account_id='" . $this->account_id . "'",__LINE__,__FILE__); . $this->account_id . "'",__LINE__,__FILE__);
} }
function delete($accountid = '') function delete($accountid = '')
{ {
global $phpgw, $phpgw_info; global $phpgw, $phpgw_info;
@ -138,19 +140,19 @@
{ {
$whereclause .= ' ) '; $whereclause .= ' ) ';
} }
} }
$sql = "select * from phpgw_accounts $whereclause $orderclause $limitclause"; $sql = "select * from phpgw_accounts $whereclause $orderclause $limitclause";
$this->db->query($sql,__LINE__,__FILE__); $this->db->query($sql,__LINE__,__FILE__);
while ($this->db->next_record()) { while ($this->db->next_record()) {
$accounts[] = Array( $accounts[] = Array(
"account_id" => $this->db->f("account_id"), 'account_id' => $this->db->f('account_id'),
"account_lid" => $this->db->f("account_lid"), 'account_lid' => $this->db->f('account_lid'),
"account_type" => $this->db->f("account_type"), 'account_type' => $this->db->f('account_type'),
"account_firstname" => $this->db->f("account_firstname"), 'account_firstname' => $this->db->f('account_firstname'),
"account_lastname" => $this->db->f("account_lastname"), 'account_lastname' => $this->db->f('account_lastname'),
"account_status" => $this->db->f("account_status") 'account_status' => $this->db->f('account_status',
'account_expires' => $this->db->f('account_expires')
); );
} }
return $accounts; return $accounts;
@ -161,10 +163,13 @@
global $phpgw, $phpgw_info; global $phpgw, $phpgw_info;
$this->db->query("SELECT account_id FROM phpgw_accounts WHERE account_lid='".$account_lid."'",__LINE__,__FILE__); $this->db->query("SELECT account_id FROM phpgw_accounts WHERE account_lid='".$account_lid."'",__LINE__,__FILE__);
if($this->db->num_rows()) { if($this->db->num_rows())
{
$this->db->next_record(); $this->db->next_record();
return $this->db->f('account_id'); return $this->db->f('account_id');
}else{ }
else
{
return False; return False;
} }
} }
@ -174,10 +179,13 @@
global $phpgw, $phpgw_info; global $phpgw, $phpgw_info;
$this->db->query("SELECT account_lid FROM phpgw_accounts WHERE account_id='".$account_id."'",__LINE__,__FILE__); $this->db->query("SELECT account_lid FROM phpgw_accounts WHERE account_id='".$account_id."'",__LINE__,__FILE__);
if($this->db->num_rows()) { if($this->db->num_rows())
{
$this->db->next_record(); $this->db->next_record();
return $this->db->f('account_lid'); return $this->db->f('account_lid');
}else{ }
else
{
return False; return False;
} }
} }
@ -188,10 +196,13 @@
$account_id = get_account_id($accountid); $account_id = get_account_id($accountid);
$this->db->query("SELECT account_type FROM phpgw_accounts WHERE account_id='".$account_id."'",__LINE__,__FILE__); $this->db->query("SELECT account_type FROM phpgw_accounts WHERE account_id='".$account_id."'",__LINE__,__FILE__);
if ($this->db->num_rows()) { if ($this->db->num_rows())
{
$this->db->next_record(); $this->db->next_record();
return $this->db->f('account_type'); return $this->db->f('account_type');
} else { }
else
{
return False; return False;
} }
} }
@ -210,6 +221,8 @@
return $this->db->f(0) > 0; return $this->db->f(0) > 0;
} }
// !! NOTE: We should pass an array to this to make updates easier, plus I need to add account_expires
// I didn't want to risk breaking too much code at once, I will do this soon. (jengo)
function create($account_type, $account_lid, $account_pwd, $account_firstname, $account_lastname, $account_status, $account_id='', $account_home='',$account_shell='') function create($account_type, $account_lid, $account_pwd, $account_firstname, $account_lastname, $account_status, $account_id='', $account_home='',$account_shell='')
{ {
//echo '<br>in create for account_lid: "'.$account_lid.'"'; //echo '<br>in create for account_lid: "'.$account_lid.'"';