From cdd1abffb1e859a89c0e739197dc51040166467c Mon Sep 17 00:00:00 2001 From: jengo Date: Tue, 20 Feb 2001 08:29:31 +0000 Subject: [PATCH] Create a shared function for checking weather to use the system defaults or the users preference for mail settings --- phpgwapi/inc/class.common.inc.php | 66 +++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/phpgwapi/inc/class.common.inc.php b/phpgwapi/inc/class.common.inc.php index 8b9448dc0c..e55228ee1f 100644 --- a/phpgwapi/inc/class.common.inc.php +++ b/phpgwapi/inc/class.common.inc.php @@ -752,6 +752,72 @@ return "$h12:$min$sec$ampm"; } + + // This is not the best place for it, but it needs to be shared bewteen Aeromail and SM + function create_emailpreferences() + { + global $phpgw_info; + + /* Add default preferences info */ + if (!isset($phpgw_info["user"]["preferences"]["email"]["userid"])) + { + if ($phpgw_info["server"]["mail_login_type"] == "vmailmgr") + { + $phpgw_info["user"]["preferences"]["email"]["userid"] = $phpgw_info["user"]["userid"] + . "@" . $phpgw_info[server][mail_suffix]; + } + else + { + $phpgw_info["user"]["preferences"]["email"]["userid"] = $phpgw_info["user"]["userid"]; + } + } + /* Set Server Mail Type if not defined */ + if (empty($phpgw_info["server"]["mail_server_type"])) + { + $phpgw_info["server"]["mail_server_type"] = "imap"; + } + + if (!isset($phpgw_info["user"]["preferences"]["email"]["passwd"])) + { + $phpgw_info["user"]["preferences"]["email"]["passwd"] = $phpgw_info["user"]["passwd"]; + } + if (!isset($phpgw_info["user"]["preferences"]["email"]["address"])) + { + $phpgw_info["user"]["preferences"]["email"]["address"] = $phpgw_info["user"]["userid"] + . "@" . $phpgw_info["server"]["mail_suffix"]; + } + if (!isset($phpgw_info["user"]["preferences"]["email"]["mail_server"])) + { + $phpgw_info["user"]["preferences"]["email"]["mail_server"] = $phpgw_info["server"]["mail_server"]; + } + if (!isset($phpgw_info["user"]["preferences"]["email"]["mail_server_type"])) + { + $phpgw_info["user"]["preferences"]["email"]["mail_server_type"] = $phpgw_info["server"]["mail_server_type"]; + } + if (!isset($phpgw_info["user"]["preferences"]["email"]["imap_server_type"])) + { + $phpgw_info["user"]["preferences"]["email"]["imap_server_type"] = $phpgw_info["server"]["imap_server_type"]; + } + + /* These sets the mail_port server variable */ + if ($phpgw_info["user"]["preferences"]["email"]["mail_server_type"]=="imap") + { + $phpgw_info["user"]["preferences"]["email"]["mail_port"] = "143"; + } + elseif ($phpgw_info["user"]["preferences"]["email"]["mail_server_type"]=="pop3") + { + $phpgw_info["user"]["preferences"]["email"]["mail_port"] = "110"; + } + + /* This is going to be used to switch to the nntp class */ + if ($phpgw_info["flags"]["newsmode"]) + { + $phpgw_info["user"]["preferences"]["email"]["mail_server_type"] = "nntp"; + } + } + + + // This will be moved into the applications area. function check_code($code) {