From 80c8300172bdae4f0cf9a589da3fcf1898ebb174 Mon Sep 17 00:00:00 2001 From: seek3r Date: Mon, 29 Jan 2001 02:17:08 +0000 Subject: [PATCH] corrected contrustor problem --- phpgwapi/inc/class.applications.inc.php | 30 +++++++++++++++++-------- phpgwapi/inc/class.phpgw.inc.php | 3 ++- 2 files changed, 23 insertions(+), 10 deletions(-) diff --git a/phpgwapi/inc/class.applications.inc.php b/phpgwapi/inc/class.applications.inc.php index 1affaf717f..b2e8a8267a 100755 --- a/phpgwapi/inc/class.applications.inc.php +++ b/phpgwapi/inc/class.applications.inc.php @@ -29,18 +29,31 @@ var $account_apps = Array(); var $db; - function applications($account_id = "", $account_type = "u") + function applications($params) { global $phpgw, $phpgw_info; $this->db = $phpgw->db; - if ($account_id == ""){ + if (is_array($params)) { + if (isset($app_params[1])){ + $this->account_type = $app_params[1]; + }else{ + $this->account_type = "u"; + } + if ($params[0] == ""){ + $this->account_id = $phpgw_info["user"]["account_id"]; + }elseif (is_long($params[0])) { + $this->account_id = $params[0]; + } elseif(is_string($params[0])) { + if ($this->account_type = "u"){ + $this->account_id = $phpgw->accounts->username2userid($params[0]); + }else{ + $this->account_id = $phpgw->accounts->groupname2groupid($params[0]); + } + } + }else{ $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->username2userid($account_id); + $this->account_type = "u"; } - $this->account_type = $account_type; //echo "Account ID (Initializing applications) = ".$this->account_id."
\n"; } @@ -84,9 +97,8 @@ if ($phpgw->acl->check_specific("run",1,$app, $this->account_id, $this->account_type)) { $this->account_apps[$app] = array("title" => $phpgw_info["apps"][$app]["title"], "name" => $app, "enabled" => True, "status" => $phpgw_info["apps"][$app]["status"]); } - return $this->account_apps; } - return False; + return $this->account_apps; } function add_app($apps) { diff --git a/phpgwapi/inc/class.phpgw.inc.php b/phpgwapi/inc/class.phpgw.inc.php index ef574f32d8..07b38941f8 100644 --- a/phpgwapi/inc/class.phpgw.inc.php +++ b/phpgwapi/inc/class.phpgw.inc.php @@ -127,7 +127,8 @@ exit; } $this->preferences = CreateObject("phpgwapi.preferences", intval($phpgw_info["user"]["account_id"])); - $this->applications = CreateObject("phpgwapi.applications", intval($phpgw_info["user"]["account_id"])); + $app_params[] = intval($phpgw_info["user"]["account_id"]); + $this->applications = CreateObject("phpgwapi.applications", $app_params); $phpgw_info["user"]["preferences"] = $this->preferences->get_saved_preferences(); $phpgw_info["user"]["apps"] = $this->applications->enabled_apps(); }