From 3234d5723e471230ab432d991f347f9826674716 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Wed, 7 Jun 2006 05:16:56 +0000 Subject: [PATCH] - fixed a view error in working together with setup - quitent (hopefully) all debug messages --- phpgwapi/inc/class.accounts.inc.php | 5 ++--- phpgwapi/inc/class.accounts_ldap.inc.php | 6 +++--- phpgwapi/inc/class.accounts_sql.inc.php | 11 ++++++++++- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/phpgwapi/inc/class.accounts.inc.php b/phpgwapi/inc/class.accounts.inc.php index e4be2f59f7..f0faec20ed 100644 --- a/phpgwapi/inc/class.accounts.inc.php +++ b/phpgwapi/inc/class.accounts.inc.php @@ -300,7 +300,7 @@ class accounts extends accounts_backend } } } - if (($id = parent::save($data)) && $data['account_primary_group'] && + if (($id = parent::save($data)) && $data['account_type'] == 'u' && $data['account_primary_group'] && (!($memberships = $this->memberships($id,true)) || !in_array($data['account_primary_group'],$memberships))) { $memberships[] = $data['account_primary_group']; @@ -343,8 +343,7 @@ class accounts extends accounts_backend if (is_null($data)) $data = $this->data; // depricated use $expires = isset($data['account_expires']) ? $data['account_expires'] : $data['expires']; -echo "

is_expired(".print_r($data,true).") expires=$expires --> ".(int)($expires != -1 && $expires < time())."

\n"; -echo function_backtrace(); + return $expires != -1 && $expires < time(); } diff --git a/phpgwapi/inc/class.accounts_ldap.inc.php b/phpgwapi/inc/class.accounts_ldap.inc.php index 6a0d918f6a..c8d6a5c7b2 100644 --- a/phpgwapi/inc/class.accounts_ldap.inc.php +++ b/phpgwapi/inc/class.accounts_ldap.inc.php @@ -136,7 +136,7 @@ class accounts_backend */ function save(&$data) { - $is_group = $data['account_id'] < 0 || $data['type'] == 'g'; + $is_group = $data['account_id'] < 0 || $data['account_type'] === 'g'; $data_utf8 = $this->translation->convert($data,$this->translation->charset(),'utf-8'); @@ -211,12 +211,12 @@ class accounts_backend $to_write = $this->_merge_user($to_write,$data_utf8,!$old); $data['account_type'] = 'u'; } - echo "

ldap_".($old ? 'modify' : 'add')."(,$dn,".print_r($to_write,true).")

\n"; + //echo "

ldap_".($old ? 'modify' : 'add')."(,$dn,".print_r($to_write,true).")

\n"; // modifying or adding the entry if ($old && !ldap_modify($this->ds,$dn,$to_write) || !$old && !ldap_add($this->ds,$dn,$to_write)) { - echo ldap_error($this->ds); exit; + //echo ldap_error($this->ds); exit; return false; } if ($memberships) // setting the previous memberships of the renamed account diff --git a/phpgwapi/inc/class.accounts_sql.inc.php b/phpgwapi/inc/class.accounts_sql.inc.php index fb40981c62..1e2e6152a5 100644 --- a/phpgwapi/inc/class.accounts_sql.inc.php +++ b/phpgwapi/inc/class.accounts_sql.inc.php @@ -64,6 +64,11 @@ class accounts_backend $this->db = clone($GLOBALS['egw']->db); } $this->db->set_app('phpgwapi'); // to load the right table-definitions for insert, select, update, ... + + if (!is_object($GLOBALS['egw']->acl)) + { + $GLOBALS['egw']->acl =& CreateObject('phpgwapi.acl'); + } } /** @@ -100,7 +105,7 @@ class accounts_backend */ function save(&$data) { - echo "

accounts_sql::save(".print_r($data,true).")

\n"; + //echo "

accounts_sql::save(".print_r($data,true).")

\n"; $to_write = $data; unset($to_write['account_id']); unset($to_write['account_passwd']); @@ -108,6 +113,10 @@ class accounts_backend // encrypt password if given or unset it if not if ($data['account_passwd']) { + if (!is_object($GLOBALS['egw']->auth)) + { + $GLOBALS['egw']->auth =& CreateObject('phpgwapi.auth'); + } $to_write['account_pwd'] = $GLOBALS['egw']->auth->encrypt_sql($data['account_passwd']); } if (!(int)$data['account_id'])