From daff5cb75bce6d6b0cbed092c3b807bb04fade9b Mon Sep 17 00:00:00 2001 From: tbrehm <t.brehm@ispconfig.org> Date: Thu, 31 May 2007 11:15:12 -0400 Subject: [PATCH] diverse updates. --- server/plugins-enabled/getmail_plugin.inc.php | 14 +++++++++++--- 1 files changed, 11 insertions(+), 3 deletions(-) diff --git a/server/plugins-enabled/getmail_plugin.inc.php b/server/plugins-enabled/getmail_plugin.inc.php index cc18d2d..b65a087 100644 --- a/server/plugins-enabled/getmail_plugin.inc.php +++ b/server/plugins-enabled/getmail_plugin.inc.php @@ -34,7 +34,7 @@ var $class_name = 'getmail_plugin'; - var $getmail_config_dir = '/etc/getmail'; + var $getmail_config_dir = ''; /* This function is called when the plugin is loaded @@ -51,6 +51,8 @@ $app->plugins->registerEvent('mail_get_update','getmail_plugin','update'); $app->plugins->registerEvent('mail_get_delete','getmail_plugin','delete'); + + } function insert($event_name,$data) { @@ -62,6 +64,11 @@ function update($event_name,$data) { global $app, $conf; + + // load the server specific configuration options for getmail + $app->uses("getconf"); + $getmail_config = $app->getconf->get_server_config($conf["server_id"], 'getmail'); + $this->getmail_config_dir = $getmail_config["getmail_config_dir"]; // Check if the config directory exists. if(!is_dir($this->getmail_config_dir)) { @@ -79,7 +86,7 @@ } - if($data["new"]["source_active"] == 'y') { + if($data["new"]["active"] == 'y') { // Open master template $tpl = file_get_contents($conf["rootpath"].'/conf/getmail.conf.master'); @@ -101,11 +108,12 @@ $tpl = str_replace('{SERVER}',$data["new"]["source_server"],$tpl); $tpl = str_replace('{USERNAME}',$data["new"]["source_username"],$tpl); $tpl = str_replace('{PASSWORD}',$data["new"]["source_password"],$tpl); - $tpl = str_replace('{DESTINATION}',$data["new"]["source_destination"],$tpl); + $tpl = str_replace('{DESTINATION}',$data["new"]["destination"],$tpl); // Write the config file. file_put_contents($config_file_path,$tpl); $app->log("Writing Getmail config file: $config_file_path",LOGLEVEL_DEBUG); + exec("chmod 400 $config_file_path"); unset($tpl); unset($config_file_path); -- Gitblit v1.9.1