From 5f0c2433dbdb21007650f6c08221537cd231103c Mon Sep 17 00:00:00 2001 From: jengo Date: Tue, 6 Feb 2001 20:13:06 +0000 Subject: [PATCH] Returned cvs to how it was last night (with including the class.accounts.inc.php) file first --- phpgwapi/inc/class.accounts.inc.php | 11 +++ phpgwapi/inc/class.accounts_ldap.inc.php | 2 +- phpgwapi/inc/class.accounts_shared.inc.php | 87 ++++++++++++++++++++++ phpgwapi/inc/class.accounts_sql.inc.php | 2 +- phpgwapi/inc/class.auth.inc.php | 4 + phpgwapi/inc/class.common.inc.php | 4 +- phpgwapi/inc/class.phpgw.inc.php | 16 +--- phpgwapi/inc/class.preferences.inc.php | 6 +- phpgwapi/inc/functions.inc.php | 11 +-- 9 files changed, 117 insertions(+), 26 deletions(-) create mode 100644 phpgwapi/inc/class.accounts.inc.php create mode 100644 phpgwapi/inc/class.accounts_shared.inc.php create mode 100644 phpgwapi/inc/class.auth.inc.php diff --git a/phpgwapi/inc/class.accounts.inc.php b/phpgwapi/inc/class.accounts.inc.php new file mode 100644 index 0000000000..1be82c966f --- /dev/null +++ b/phpgwapi/inc/class.accounts.inc.php @@ -0,0 +1,11 @@ + \ No newline at end of file diff --git a/phpgwapi/inc/class.accounts_ldap.inc.php b/phpgwapi/inc/class.accounts_ldap.inc.php index 3091d4aa97..67f340526b 100644 --- a/phpgwapi/inc/class.accounts_ldap.inc.php +++ b/phpgwapi/inc/class.accounts_ldap.inc.php @@ -24,7 +24,7 @@ /* $Id$ */ - class accounts + class accounts_ { var $db; var $account_id; diff --git a/phpgwapi/inc/class.accounts_shared.inc.php b/phpgwapi/inc/class.accounts_shared.inc.php new file mode 100644 index 0000000000..9db9ff4d7f --- /dev/null +++ b/phpgwapi/inc/class.accounts_shared.inc.php @@ -0,0 +1,87 @@ + * + * shared functions for other account repository managers * + * Copyright (C) 2000, 2001 Joseph Engo * + * -------------------------------------------------------------------------* + * This library is part of the phpGroupWare API * + * http://www.phpgroupware.org/api * + * ------------------------------------------------------------------------ * + * This library is free software; you can redistribute it and/or modify it * + * under the terms of the GNU Lesser General Public License as published by * + * the Free Software Foundation; either version 2.1 of the License, * + * or any later version. * + * This library is distributed in the hope that it will be useful, but * + * WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * + * See the GNU Lesser General Public License for more details. * + * You should have received a copy of the GNU Lesser General Public License * + * along with this library; if not, write to the Free Software Foundation, * + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * + \**************************************************************************/ + + /* $Id$ */ + + class accounts extends accounts_ + { + /**************************************************************************\ + * Standard constructor for setting $this->account_id * + * This constructor sets the account id, if string is sent, converts to id * + * I might move this to the accounts_shared if it stays around * + \**************************************************************************/ + function accounts($account_id = False) + { + global $phpgw, $phpgw_info; + $this->db = $phpgw->db; + if ($account_id == False){ $this->account_id = $account_id; } + } + + function read() + { + if (count($this->data) == 0){ $this->read_repository(); } + reset($this->data); + return $this->data; + } + + function update_data($data) { + reset($data); + $this->data = Array(); + $this->data = $data; + reset($this->data); + return $this->data; + } + + function memberships($account_id = False) + { + global $phpgw_info, $phpgw; + if ($account_id == ""){ $account_id = $phpgw_info["user"]["account_id"]; } + elseif (gettype($account_id) == "string") { $account_id = $this->name2id($account_id); } + + $security_equals = Array(); + $security_equals = $phpgw->acl->get_location_list_for_id("phpgw_group", 1, intval($account_id)); + if (!$security_equals) { return False; } + for ($idx=0; $idxname2id($security_equals[$idx]); + $this->memberships[] = Array("account_id" => $security_equals[$idx], "account_name" => "$name"); + } + return $this->memberships; + } + + function members ($account_id = False) + { + global $phpgw_info, $phpgw; + if ($account_id == ""){ $account_id = $phpgw_info["user"]["account_id"]; } + elseif (gettype($account_id) == "string") { $account_id = $this->name2id($account_id); } + + $security_equals = Array(); + $security_equals = $phpgw->acl->get_ids_for_location(intval($account_id), 1, "phpgw_group"); + if (!$security_equals) { return False; } + for ($idx=0; $idxname2id($security_equals[$idx]); + $this->members[] = Array("account_id" => $security_equals[$idx], "account_name" => "$name"); + } + return $this->members; + } + } +?> \ No newline at end of file diff --git a/phpgwapi/inc/class.accounts_sql.inc.php b/phpgwapi/inc/class.accounts_sql.inc.php index d03dded9e3..a3c1d5d126 100644 --- a/phpgwapi/inc/class.accounts_sql.inc.php +++ b/phpgwapi/inc/class.accounts_sql.inc.php @@ -24,7 +24,7 @@ /* $Id$ */ - class accounts + class accounts_ { var $db; var $account_id; diff --git a/phpgwapi/inc/class.auth.inc.php b/phpgwapi/inc/class.auth.inc.php new file mode 100644 index 0000000000..a9946ab3b3 --- /dev/null +++ b/phpgwapi/inc/class.auth.inc.php @@ -0,0 +1,4 @@ + \ No newline at end of file diff --git a/phpgwapi/inc/class.common.inc.php b/phpgwapi/inc/class.common.inc.php index c0af6e515a..14dc99e97a 100644 --- a/phpgwapi/inc/class.common.inc.php +++ b/phpgwapi/inc/class.common.inc.php @@ -414,9 +414,9 @@ . $phpgw_info["server"]["template_set"]; $tpldir_default = PHPGW_SERVER_ROOT . "/".$appname . "/templates/default"; - if (is_dir ($tpldir)) { + if (is_dir($tpldir)) { return $tpldir; - } elseif (is_dir ($tpldir_default)) { + } elseif (is_dir($tpldir_default)) { return $tpldir_default; } else { return False; diff --git a/phpgwapi/inc/class.phpgw.inc.php b/phpgwapi/inc/class.phpgw.inc.php index b22afa12c5..65b37a44aa 100644 --- a/phpgwapi/inc/class.phpgw.inc.php +++ b/phpgwapi/inc/class.phpgw.inc.php @@ -100,21 +100,9 @@ $this->common = CreateObject("phpgwapi.common"); $this->hooks = CreateObject("phpgwapi.hooks"); - if (! $phpgw_info["server"]["auth_type"]) { - $phpgw_info["server"]["auth_type"] = "sql"; - } - $this->auth = create_specialobject("phpgwapi.auth",$phpgw_info["server"]["auth_type"]); + $this->auth = createobject("phpgwapi.auth"); $this->acl = CreateObject("phpgwapi.acl"); - - if (! $phpgw_info["server"]["account_repository"]) { - if ($phpgw_info["server"]["auth_type"]) { - $phpgw_info["server"]["account_repository"] = $phpgw_info["server"]["auth_type"]; - } else { - $phpgw_info["server"]["account_repository"] = "sql"; - } - } - $this->accounts = create_specialobject("phpgwapi.accounts",$phpgw_info["server"]["auth_type"]); - + $this->accounts = createobject("phpgwapi.accounts"); $this->session = CreateObject("phpgwapi.sessions"); $this->preferences = CreateObject("phpgwapi.preferences"); $this->applications = CreateObject("phpgwapi.applications"); diff --git a/phpgwapi/inc/class.preferences.inc.php b/phpgwapi/inc/class.preferences.inc.php index 64a085e09d..ef4f736507 100644 --- a/phpgwapi/inc/class.preferences.inc.php +++ b/phpgwapi/inc/class.preferences.inc.php @@ -93,7 +93,7 @@ { global $phpgw, $phpgw_info; $this->db->lock("preferences"); - $this->db->query('delete from preferences where preference_owner=' . $this->account_id,__LINE__,__FILE__); + $this->db->query("delete from preferences where preference_owner='" . $this->account_id . "'",__LINE__,__FILE__); if ($PHP_VERSION < "4.0.0") { $pref_info = addslashes(serialize($this->data)); @@ -101,8 +101,8 @@ $pref_info = serialize($this->data); } - $this->db->query('insert into preferences (preference_owner,preference_value) values (' - . $this->account_id . ",'" . $pref_info . "')",__LINE__,__FILE__); + $this->db->query("insert into preferences (preference_owner,preference_value) values ('" + . $this->account_id . "','" . $pref_info . "')",__LINE__,__FILE__); $this->db->unlock(); return $this->data; diff --git a/phpgwapi/inc/functions.inc.php b/phpgwapi/inc/functions.inc.php index 59bddc240f..af1708b372 100644 --- a/phpgwapi/inc/functions.inc.php +++ b/phpgwapi/inc/functions.inc.php @@ -233,11 +233,6 @@ define("PHPGW_ACL_EDIT",4); define("PHPGW_ACL_DELETE",8); - //incase we are dealing with a fresh login - if (! isset($phpgw_info["user"]["preferences"]["common"]["template_set"])) { - $phpgw_info["user"]["preferences"]["common"]["template_set"] = "default"; - } - // Since LDAP will return system accounts, there are a few we don't want to login. $phpgw_info["server"]["global_denied_users"] = array('root' => True, 'bin' => True, @@ -268,6 +263,12 @@ \****************************************************************************/ $phpgw = CreateObject("phpgwapi.phpgw"); $phpgw->phpgw_(); + //incase we are dealing with a fresh login + if (! isset($phpgw_info["user"]["preferences"]["common"]["template_set"])) { + $phpgw_info["user"]["preferences"]["common"]["template_set"] = "default"; + } + + if ($phpgw_info["flags"]["currentapp"] != "login" && $phpgw_info["flags"]["currentapp"] != "logout") { //if (! $phpgw->session->verify()) { // Header("Location: " . $phpgw->link($phpgw_info["server"]["webserver_url"] . "/login.php", "cd=10"));