Returned cvs to how it was last night (with including the class.accounts.inc.php) file first

This commit is contained in:
jengo 2001-02-06 20:13:06 +00:00
parent e4955703cf
commit 5f0c2433db
9 changed files with 117 additions and 26 deletions

View File

@ -0,0 +1,11 @@
<?php
if (empty($phpgw_info["server"]["account_repository"])){
if (!empty($phpgw_info["server"]["auth_type"])){
$phpgw_info["server"]["account_repository"] = $phpgw_info["server"]["auth_type"];
}else{
$phpgw_info["server"]["account_repository"] = "sql";
}
}
include(PHPGW_API_INC."/class.accounts_".$phpgw_info["server"]["account_repository"].".inc.php");
include(PHPGW_API_INC."/class.accounts_shared.inc.php");
?>

View File

@ -24,7 +24,7 @@
/* $Id$ */
class accounts
class accounts_
{
var $db;
var $account_id;

View File

@ -0,0 +1,87 @@
<?php
/**************************************************************************\
* phpGroupWare API - Accounts manager shared functions *
* This file written by Joseph Engo <jengo@phpgroupware.org> *
* 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; $idx<count($security_equals); $idx++){
$name = $this->name2id($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; $idx<count($security_equals); $idx++){
$name = $this->name2id($security_equals[$idx]);
$this->members[] = Array("account_id" => $security_equals[$idx], "account_name" => "$name");
}
return $this->members;
}
}
?>

View File

@ -24,7 +24,7 @@
/* $Id$ */
class accounts
class accounts_
{
var $db;
var $account_id;

View File

@ -0,0 +1,4 @@
<?php
if (empty($phpgw_info["server"]["auth_type"])){$phpgw_info["server"]["auth_type"] = "sql";}
include(PHPGW_API_INC."/class.auth_".$phpgw_info["server"]["auth_type"].".inc.php");
?>

View File

@ -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;

View File

@ -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");

View File

@ -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;

View File

@ -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"));