[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] phpgwapi/inc/class.accounts_sql.inc.php, 1.95
From: |
nomail |
Subject: |
[Phpgroupware-cvs] phpgwapi/inc/class.accounts_sql.inc.php, 1.95 |
Date: |
Fri, 25 Jun 2004 10:17:38 +0200 |
Update of /phpgwapi/inc
Modified Files:
Branch:
class.accounts_sql.inc.php
date: 2004/06/25 08:17:38; author: fipsfuchs; state: Exp; lines: +43 -36
Log Message:
inheritance like in 0.9.16
fields for accounts data generalized
=====================================================================
Index: phpgwapi/inc/class.accounts_sql.inc.php
diff -u phpgwapi/inc/class.accounts_sql.inc.php:1.94
phpgwapi/inc/class.accounts_sql.inc.php:1.95
--- phpgwapi/inc/class.accounts_sql.inc.php:1.94 Wed Jun 23 15:00:38 2004
+++ phpgwapi/inc/class.accounts_sql.inc.php Fri Jun 25 08:17:38 2004
@@ -29,7 +29,7 @@
@class_start accounts
@abstract Class for handling user and group accounts
*/
- class accounts_
+ class accounts extends accounts_
{
var $db;
var $account_id;
@@ -37,9 +37,9 @@
var $total;
var $account_type;
- function accounts_()
+ function accounts($account_id = '', $account_type='')
{
- /* Don't think this ever gets called */
+ parent::accounts_($account_id, $account_type);
$this->db = $GLOBALS['phpgw']->db;
}
@@ -49,23 +49,28 @@
*/
function read_repository()
{
- $this->db->query('SELECT * FROM phpgw_accounts WHERE
account_id=' . intval($this->account_id),__LINE__,__FILE__);
- $this->db->next_record();
-
- $this->data['userid'] =
$this->db->f('account_lid');
- $this->data['account_id'] =
$this->db->f('account_id');
- $this->data['account_lid'] =
$this->db->f('account_lid');
- $this->data['firstname'] =
$this->db->f('account_firstname');
- $this->data['lastname'] =
$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['lastloginfrom'] =
$this->db->f('account_lastloginfrom');
- $this->data['lastpasswd_change'] =
$this->db->f('account_lastpwd_change');
- $this->data['status'] =
$this->db->f('account_status');
- $this->data['expires'] =
$this->db->f('account_expires');
- $this->data['account_type'] =
$this->db->f('account_type');
-
- return $this->data;
+ if((int) $this->account_id)
+ {
+ $this->data[$this->fields[0]] =
$this->account_id;
+ }
+ if((int) $this->data[$this->fields[0]])
+ {
+ $this->db->query('SELECT * FROM phpgw_accounts
WHERE account_id=' . intval($this->data[$this->fields[0]]),__LINE__,__FILE__);
+ $this->db->next_record();
+
+ $this->data[$this->fields[1]] =
$this->db->f('account_lid');
+ $this->data[$this->fields[2]] =
$this->db->f('account_firstname');
+ $this->data[$this->fields[3]] =
$this->db->f('account_lastname');
+ $this->data[$this->fields[6]] =
$this->db->f('account_status');
+ $this->data[$this->fields[7]] =
$this->db->f('account_expires');
+ $this->data[$this->fields[5]] =
$this->db->f('account_type');
+ $this->data['fullname'] =
$this->db->f('account_firstname') . ' ' . $this->db->f('account_lastname');
+ $this->data['lastlogin'] =
$this->db->f('account_lastlogin');
+ $this->data['lastloginfrom'] =
$this->db->f('account_lastloginfrom');
+ $this->data['lastpasswd_change'] =
$this->db->f('account_lastpwd_change');
+ return $this->data;
+ }
+ return false;
}
/*!
@@ -74,11 +79,12 @@
*/
function save_repository()
{
- $this->db->query("UPDATE phpgw_accounts SET
account_firstname='" . $this->data['firstname']
- . "', account_lastname='" .
$this->data['lastname'] . "', account_status='"
- . $this->data['status'] . "', account_expires="
. $this->data['expires']
- . ($this->data['account_lid']?",
account_lid='".$this->data['account_lid']."'":'')
- . ' WHERE account_id=' .
intval($this->account_id),__LINE__,__FILE__);
+ $this->db->query("UPDATE phpgw_accounts SET
account_firstname='" . $this->data[$this->fields[2]]
+ . "', account_lastname='" .
$this->data[$this->fields[3]] . "', account_status='"
+ . $this->data[$this->fields[6]] . "',
account_expires=" . $this->data[$this->fields[7]]
+ . ($this->data[$this->fields[1]]?",
account_lid='".$this->data[$this->fields[1]]."'":'')
+ . ' WHERE account_id=' .
intval($this->data[$this->fields[0]]), __LINE__,__FILE__);
+ return true;
}
function delete($accountid = '')
@@ -156,13 +162,13 @@
while($this->db->next_record())
{
$accounts[] = Array(
- 'account_id' =>
$this->db->f('account_id'),
- 'account_lid' =>
$this->db->f('account_lid'),
- 'account_type' =>
$this->db->f('account_type'),
- 'account_firstname' =>
$this->db->f('account_firstname'),
- 'account_lastname' =>
$this->db->f('account_lastname'),
- 'account_status' =>
$this->db->f('account_status'),
- 'account_expires' =>
$this->db->f('account_expires')
+ $this->fields[0] =>
$this->db->f('account_id'),
+ $this->fields[1] =>
$this->db->f('account_lid'),
+ $this->fields[5] =>
$this->db->f('account_type'),
+ $this->fields[2] =>
$this->db->f('account_firstname'),
+ $this->fields[3] =>
$this->db->f('account_lastname'),
+ $this->fields[6] =>
$this->db->f('account_status'),
+ $this->fields[7] =>
$this->db->f('account_expires')
);
}
$this->total = count($accounts);
@@ -296,12 +302,13 @@
{
$this->db->query('insert into phpgw_accounts
(account_lid, account_type, account_pwd, '
. "account_firstname, account_lastname,
account_status, account_expires) values ('"
- . $account_info['account_lid'] . "','" .
$account_info['account_type'] . "','"
- . md5($account_info['account_passwd']) . "','"
. $account_info['account_firstname']
- . "','" . $account_info['account_lastname'] .
"','" . $account_info['account_status']
- . "'," . $account_info['account_expires'] .
')',__LINE__,__FILE__);
+ . $account_info[$this->fields[1]] . "','" .
$account_info[$this->fields[5]] . "','"
+ . md5($account_info[$this->fields[4]]) . "','"
. $account_info[$this->fields[2]]
+ . "','" . $account_info[$this->fields[3]] .
"','" . $account_info[$this->fields[6]]
+ . "'," . $account_info[$this->fields[7]] .
')',__LINE__,__FILE__);
$accountid =
$this->db->get_last_insert_id('phpgw_accounts','account_id');
+ // this should move to admin
if($accountid &&
is_object($GLOBALS['phpgw']->preferences) && $default_prefs)
{
$GLOBALS['phpgw']->preferences->create_defaults($accountid);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] phpgwapi/inc/class.accounts_sql.inc.php, 1.95,
nomail <=