phpgroupware-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpgroupware-cvs] phpgwapi/inc/accounts/class.accounts_sql.inc.php, 1.


From: nomail
Subject: [Phpgroupware-cvs] phpgwapi/inc/accounts/class.accounts_sql.inc.php, 1.1.2.2
Date: Tue, 14 Dec 2004 21:11:01 +0100

Update of /phpgwapi/inc/accounts
Modified Files:
        Branch: proposed-0_9_18-branch
          class.accounts_sql.inc.php

date: 2004/12/14 20:11:01;  author: fipsfuchs;  state: Exp;  lines: +4 -109

Log Message:
moved common stuff from childs to parent
smarter rdn handling for ldap
=====================================================================
Index: phpgwapi/inc/accounts/class.accounts_sql.inc.php
diff -u phpgwapi/inc/accounts/class.accounts_sql.inc.php:1.1.2.1 
phpgwapi/inc/accounts/class.accounts_sql.inc.php:1.1.2.2
--- phpgwapi/inc/accounts/class.accounts_sql.inc.php:1.1.2.1    Fri Dec 10 
15:28:40 2004
+++ phpgwapi/inc/accounts/class.accounts_sql.inc.php    Tue Dec 14 20:11:01 2004
@@ -370,9 +370,9 @@
                        return true;
                }
                        
-               function create($account_info,$default_prefs = true)
+               function create($account_info, $default_prefs = true)
                {
-                       parent::create($account_info, $default_prefs);
+                       $this->set_data($account_info, $default_prefs);
                        $fields = array('account_lid',
                                        'account_type',
                                        'account_pwd',
@@ -402,99 +402,8 @@
                                                             'VALUES 
('.implode($values, ',').')',
                                         __LINE__,__FILE__);
 
-                       $accountid = 
$this->db->get_last_insert_id('phpgw_accounts','account_id');
-                       if($accountid && 
is_object($GLOBALS['phpgw']->preferences) && $default_prefs)
-                       {
-                               
$GLOBALS['phpgw']->preferences->create_defaults($accountid);
-                       }
-                       return $accountid;
-               }
-
-               function auto_add($accountname, $passwd, $default_prefs = 
False, $default_acls = False, $expiredate = 0, $account_status = 'A')
-               {
-                       if ($expiredate)
-                       {
-                               $expires = mktime(2,0,0,date('n',$expiredate), 
intval(date('d',$expiredate)), date('Y',$expiredate));
-                       }
-                       else
-                       {
-                               
if($GLOBALS['phpgw_info']['server']['auto_create_expire'])
-                               {
-                                       
if($GLOBALS['phpgw_info']['server']['auto_create_expire'] == 'never')
-                                       {
-                                               $expires = -1;
-                                       }
-                                       else
-                                       {
-                                               $expiredate = time() + 
$GLOBALS['phpgw_info']['server']['auto_create_expire'];
-                                               $expires   = 
mktime(2,0,0,date('n',$expiredate), intval(date('d',$expiredate)), 
date('Y',$expiredate));
-                                       }
-                               }
-                               else
-                               {
-                                       /* expire in 30 days by default */
-                                       $expiredate = time() + ( ( 60 * 60 ) * 
(30 * 24) );
-                                       $expires   = 
mktime(2,0,0,date('n',$expiredate), intval(date('d',$expiredate)), 
date('Y',$expiredate));
-                               }
-                       }
-
-                       $acct_info = array(
-                               'account_lid'       => $accountname,
-                               'account_type'      => 'u',
-                               'account_passwd'    => $passwd,
-                               'account_firstname' => '',
-                               'account_lastname'  => '',
-                               'account_status'    => $account_status,
-                               'account_expires'   => $expires,
-                               'person_id'                     => 'NULL'
-                       );
-
-                       $this->db->transaction_begin();
-                       $this->create($acct_info,$default_prefs);
-                       $accountid = $this->name2id($accountname);
-
-                       // this should be done via the acl class not direct db 
calls
-                       if ($default_acls == False)
-                       {
-                               $default_group_lid = 
intval($GLOBALS['phpgw_info']['server']['default_group_lid']);
-                               $default_group_id  = 
$this->name2id($default_group_lid);
-                               $defaultgroupid = $default_group_id ? 
$default_group_id : $this->name2id('Default');
-                               if ($defaultgroupid)
-                               {
-                                       $this->db->query('INSERT INTO phpgw_acl 
(acl_appname, acl_location, acl_account, acl_rights)'
-                                               . "VALUES('phpgw_group', " . 
$defaultgroupid . ', ' 
-                                               .       intval($accountid) . ', 
1'
-                                               . ')',__LINE__,__FILE__);
-                                       $this->db->query('INSERT INTO phpgw_acl 
(acl_appname, acl_location, acl_account, acl_rights)'
-                                               . "VALUES('preferences' , 
'changepassword', " 
-                                               .       intval($accountid) . ', 
1'
-                                               . ')',__LINE__,__FILE__);
-                               }
-                               else
-                               {
-                                       // If they don't have a default group, 
they need some sort of permissions.
-                                       // This generally doesn't / shouldn't 
happen, but will (jengo)
-                                       $this->db->query("insert into phpgw_acl 
(acl_appname, acl_location, acl_account, acl_rights) values('preferences', 
'changepassword', " . $accountid . ', 1)',__LINE__,__FILE__);
-
-                                       $apps = Array(
-                                               'addressbook',
-                                               'calendar',
-                                               'email',
-                                               'notes',
-                                               'todo',
-                                               'phpwebhosting',
-                                               'manual'
-                                       );
-
-                                       @reset($apps);
-                                       while(list($key,$app) = each($apps))
-                                       {
-                                               $this->db->query("INSERT INTO 
phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) VALUES ('" . 
$app . "', 'run', " . intval($accountid) . ', 1)',__LINE__,__FILE__);
-                                       }
-                               }
-                       }
-                       $this->db->transaction_commit();
-                       return $accountid;
+                       $account_info['account_id'] = 
$this->db->get_last_insert_id('phpgw_accounts','account_id');
+                       return parent::create($account_info, $default_prefs);
                }
 
                function get_account_name($accountid,&$lid,&$fname,&$lname)
@@ -521,20 +430,6 @@
                        return;
                }
 
-               function get_account_data($account_id)
-               {
-                       $this->account_id = $account_id;
-                       $this->read_repository();
-
-                       $data[$this->data['account_id']]['lid']       = 
$this->data['account_lid'];
-                       $data[$this->data['account_id']]['firstname'] = 
$this->data['firstname'];
-                       $data[$this->data['account_id']]['lastname']  = 
$this->data['lastname'];
-                       $data[$this->data['account_id']]['fullname']  = 
$this->data['fullname'];
-                       $data[$this->data['account_id']]['type']      = 
$this->data['account_type'];
-                       $data[$this->data['account_id']]['person_id']      = 
$this->data['person_id'];
-                       return $data;
-               }
-               
                function get_account_with_contact()
                {
                        $sql = 'SELECT account_id, person_id FROM 
phpgw_accounts '




reply via email to

[Prev in Thread] Current Thread [Next in Thread]