From f6430b723b3fdcd427a4400dfd7af39c6fa89335 Mon Sep 17 00:00:00 2001 From: seek3r Date: Tue, 6 Feb 2001 11:58:39 +0000 Subject: [PATCH] need sleep, you guys are stuck with what I have so far --- phpgwapi/inc/class.accounts_sql.inc.php | 1 - phpgwapi/inc/class.acl.inc.php | 14 +++---- phpgwapi/inc/class.phpgw.inc.php | 6 ++- phpgwapi/inc/class.preferences.inc.php | 5 +-- phpgwapi/inc/class.sessions.inc.php | 50 +++++++++++++------------ 5 files changed, 38 insertions(+), 38 deletions(-) diff --git a/phpgwapi/inc/class.accounts_sql.inc.php b/phpgwapi/inc/class.accounts_sql.inc.php index 8a944766e2..02f919ca11 100644 --- a/phpgwapi/inc/class.accounts_sql.inc.php +++ b/phpgwapi/inc/class.accounts_sql.inc.php @@ -76,7 +76,6 @@ $this->db->query("SELECT account_id FROM phpgw_accounts WHERE account_lid='".$account_name."'",__LINE__,__FILE__); if($this->db->num_rows()) { $this->db->next_record(); - return $this->db->f("account_id"); }else{ return False; diff --git a/phpgwapi/inc/class.acl.inc.php b/phpgwapi/inc/class.acl.inc.php index 8da875481f..4e47cf38eb 100644 --- a/phpgwapi/inc/class.acl.inc.php +++ b/phpgwapi/inc/class.acl.inc.php @@ -34,18 +34,14 @@ * Standard constructor for setting $this->account_id * \**************************************************************************/ - function acl($account_id = "") + function acl($account_id = False) { global $phpgw, $phpgw_info; - $this->db = $phpgw->db; - if (! $account_id) { - $this->account_id = $phpgw_info["user"]["account_id"]; - } elseif (is_long($account_id)) { - $this->account_id = $account_id; - } elseif(is_string($account_id)) { - $this->account_id = $phpgw->accounts->name2id($account_id); - } +// if ($account_id == False) { $this->account_id = $phpgw_info["user"]["account_id"]; +// }elseif (gettype($account_id) == "string") { $account_id = $phpgw->accounts->name2id($account_id); } + + $this->account_id = $account_id; } /**************************************************************************\ diff --git a/phpgwapi/inc/class.phpgw.inc.php b/phpgwapi/inc/class.phpgw.inc.php index a3dc439a3c..668f9b7ab3 100644 --- a/phpgwapi/inc/class.phpgw.inc.php +++ b/phpgwapi/inc/class.phpgw.inc.php @@ -103,12 +103,14 @@ $this->accounts = CreateObject("phpgwapi.accounts"); $this->session = CreateObject("phpgwapi.sessions"); $this->preferences = CreateObject("phpgwapi.preferences"); + $this->applications = CreateObject("phpgwapi.applications"); if ($phpgw_info["flags"]["currentapp"] == "login") { if ($login != ""){ $login_array = explode("@",$login); - $this->accounts->accounts($login_array[0]); - $this->preferences->preferences($login_array[0]); + $login_id = $phpgw->accounts->name2id($login_array[0]); + $this->accounts->accounts($login_id); + $this->preferences->preferences($login_id); } }elseif (! $this->session->verify()) { $this->db->query("select config_value from config where config_name='webserver_url'",__LINE__,__FILE__); diff --git a/phpgwapi/inc/class.preferences.inc.php b/phpgwapi/inc/class.preferences.inc.php index 61e5030a5a..53fdb64cb7 100644 --- a/phpgwapi/inc/class.preferences.inc.php +++ b/phpgwapi/inc/class.preferences.inc.php @@ -39,10 +39,9 @@ { global $phpgw, $phpgw_info; $this->db = $phpgw->db; - if ($account_id == ""){ $account_id = $phpgw_info["user"]["account_id"]; } - elseif (gettype($account_id) == "string") { $account_id = $phpgw->accounts->name2id($account_id); } +// if ($account_id == ""){ $account_id = $phpgw_info["user"]["account_id"]; } +// elseif (gettype($account_id) == "string") { $account_id = $phpgw->accounts->name2id($account_id); } $this->account_id = $account_id; -//echo "prefs loaded for: ".$this->account_id."
"; } /**************************************************************************\ diff --git a/phpgwapi/inc/class.sessions.inc.php b/phpgwapi/inc/class.sessions.inc.php index c774c8f2f0..495753d6ab 100644 --- a/phpgwapi/inc/class.sessions.inc.php +++ b/phpgwapi/inc/class.sessions.inc.php @@ -61,44 +61,41 @@ global $phpgw, $phpgw_info, $sessionid, $kp3; $db = $phpgw->db; $db2 = $phpgw->db; + $this->sessionid .= $sessionid; + $this->kp3 .= $kp3; // PHP 3 complains that these are not defined when the already are defined. $phpgw->common->key = $phpgw_info["server"]["encryptkey"]; - $phpgw->common->key .= $sessionid; - $phpgw->common->key .= $kp3; + $phpgw->common->key .= $this->sessionid; + $phpgw->common->key .= $this->kp3; $phpgw->common->iv = $phpgw_info["server"]["mcrypt_iv"]; $cryptovars[0] = $phpgw->common->key; $cryptovars[1] = $phpgw->common->iv; $phpgw->crypto = CreateObject("phpgwapi.crypto", $cryptovars); - $db->query("select * from phpgw_sessions where session_id='$sessionid'",__LINE__,__FILE__); + $db->query("select * from phpgw_sessions where session_id='$this->sessionid'",__LINE__,__FILE__); $db->next_record(); if ($db->f("session_info") == "" || $db->f("session_info") == "NULL") { - $phpgw_info["user"]["account_lid"] = $db->f("session_lid"); - $phpgw_info["user"]["sessionid"] = $sessionid; + $this->account_lid = $db->f("session_lid"); + $phpgw_info["user"]["sessionid"] = $this->sessionid; $phpgw_info["user"]["session_ip"] = $db->f("session_ip"); $t = explode("@",$db->f("session_lid")); - $phpgw_info["user"]["account_lid"] = $t[0]; - -// $this->read_repositories(); -// $phpgw->accounts->account_id = $phpgw->accounts->name2id($phpgw_info["user"]["account_lid"]); -// $phpgw_info["user"] = $phpgw->accounts->read_repository(); + $this->account_lid = $t[0]; // Now we need to re-read eveything - $db->query("select * from phpgw_sessions where session_id='$sessionid'",__LINE__,__FILE__); + $db->query("select * from phpgw_sessions where session_id='$this->sessionid'",__LINE__,__FILE__); $db->next_record(); } - $phpgw_info["user"]["kp3"] = $kp3; - + $phpgw_info["user"]["kp3"] = $this->kp3; $phpgw_info_flags = $phpgw_info["flags"]; $phpgw_info = $phpgw->crypto->decrypt($db->f("session_info")); $phpgw_info["flags"] = $phpgw_info_flags; $userid_array = explode("@",$db->f("session_lid")); - $phpgw_info["user"]["account_lid"] = $userid_array[0]; + $this->account_lid = $userid_array[0]; if ($userid_array[1] != $phpgw_info["user"]["domain"]) { // return False; @@ -108,8 +105,15 @@ } $this->update_dla(); +echo "account_lid: ".$this->account_lid."
"; + $this->account_id = $phpgw->accounts->name2id($this->account_lid); +echo "account_id: ".$this->account_id."
"; + $phpgw->acl->acl($this->account_id); + $phpgw->accounts->accounts($this->account_id); + $phpgw->preferences->preferences($this->account_id); + $phpgw->applications->applications($this->account_id); - if (! $phpgw_info["user"]["account_lid"] ) { + if (! $this->account_lid ) { return False; } else { // PHP 3 complains that these are not defined when the already are defined. @@ -130,17 +134,16 @@ } } - function read_repositories($account_id) + function read_repositories() { global $phpgw_info, $phpgw; - if (gettype($account_id) == "string") { $account_id = $phpgw->accounts->name2id($account_id); } - $this->account_id = $account_id; - +// if (gettype($account_id) == "string") { $account_id = $phpgw->accounts->name2id($account_id); } +// $this->account_id = $account_id; +echo "step 1
"; + $phpgw->acl->acl($this->account_id); $phpgw->accounts->accounts($this->account_id); $phpgw->preferences->preferences($this->account_id); $phpgw->applications->applications($this->account_id); - $phpgw->acl->acl($this->account_id); - $phpgw_info["user"] = $phpgw->accounts->read_repository(); $phpgw_info["user"]["acl"] = $phpgw->acl->read_repository(); $phpgw_info["user"]["preferences"] = $phpgw->preferences->read_repository(); @@ -169,10 +172,10 @@ { global $phpgw_info, $phpgw; $this->login = $login; - $this->passwd = $phpgw->common->encrypt($passwd); $this->clean_sessions(); $login_array = explode("@", $login); $this->account_lid = $login_array[0]; + if ($login_array[1]!=""){ $this->account_domain = $login_array[1]; }else{ @@ -219,6 +222,7 @@ unset ($phpgw_info["server"]["default_domain"]); // we kill this for security reasons } + $this->passwd = $phpgw->common->encrypt($passwd); $this->read_repositories($this->account_id); if ($PHP_VERSION < "4.0.0") { @@ -234,7 +238,7 @@ . "$login','" . $this->getuser_ip() . "','" . time() . "','') ",__LINE__,__FILE__); - $phpgw->auth->update_lastlogin($login,$this->getuser_ip()); + //$phpgw->auth->update_lastlogin($login,$this->getuser_ip()); return $this->sessionid; }