From b9a3ef486ebcde18a5ade37865ff8f397185d24f Mon Sep 17 00:00:00 2001 From: Till Brehm <tbrehm@ispconfig.org> Date: Sun, 24 Jul 2016 05:30:59 -0400 Subject: [PATCH] Fixed #3979 Mailbox users unable to save autoresponders --- server/plugins-available/webmail_symlink_plugin.inc.php | 92 +++++++++++++++++++++++----------------------- 1 files changed, 46 insertions(+), 46 deletions(-) diff --git a/server/plugins-available/webmail_symlink_plugin.inc.php b/server/plugins-available/webmail_symlink_plugin.inc.php index 8530fc4..c64b706 100644 --- a/server/plugins-available/webmail_symlink_plugin.inc.php +++ b/server/plugins-available/webmail_symlink_plugin.inc.php @@ -3,7 +3,7 @@ /* Copyright (c) 2007 - 2009, Till Brehm, projektfarm Gmbh All rights reserved. -Modification (c) 2009, Marius Cramer, pixcept KG +Modification (c) 2009, Marius Cramer, pixcept KG Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: @@ -30,91 +30,91 @@ */ class webmail_symlink_plugin { - + var $plugin_name = 'webmail_symlink_plugin'; var $class_name = 'webmail_symlink_plugin'; - - var $action; - + + var $action; + //* This function is called during ispconfig installation to determine // if a symlink shall be created for this plugin. function onInstall() { global $conf; - - return false; - + + return false; + } - - + + /* This function is called when the plugin is loaded */ - + function onLoad() { global $app; - + /* Register for the events */ - - $app->plugins->registerEvent('web_domain_insert',$this->plugin_name,'insert'); - $app->plugins->registerEvent('web_domain_update',$this->plugin_name,'update'); + + $app->plugins->registerEvent('web_domain_insert', $this->plugin_name, 'insert'); + $app->plugins->registerEvent('web_domain_update', $this->plugin_name, 'update'); } - - function insert($event_name,$data) { + + function insert($event_name, $data) { global $app, $conf; - + $this->action = 'insert'; // just run the update function - $this->update($event_name,$data); + $this->update($event_name, $data); } - - function update($event_name,$data) { + + function update($event_name, $data) { global $app, $conf; - + if($this->action != 'insert') $this->action = 'update'; - + if($data["new"]["type"] != "vhost" && $data["new"]["parent_domain_id"] > 0) { - + $old_parent_domain_id = intval($data["old"]["parent_domain_id"]); $new_parent_domain_id = intval($data["new"]["parent_domain_id"]); - + // If the parent_domain_id has been chenged, we will have to update the old site as well. if($this->action == 'update' && $data["new"]["parent_domain_id"] != $data["old"]["parent_domain_id"]) { - $tmp = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".$old_parent_domain_id." AND active = 'y'"); + $tmp = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ? AND active = 'y'", $old_parent_domain_id); $data["new"] = $tmp; $data["old"] = $tmp; $this->action = 'update'; - $this->update($event_name,$data); + $this->update($event_name, $data); } - + // This is not a vhost, so we need to update the parent record instead. - $tmp = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".$new_parent_domain_id." AND active = 'y'"); + $tmp = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ? AND active = 'y'", $new_parent_domain_id); $data["new"] = $tmp; $data["old"] = $tmp; $this->action = 'update'; } - + if($data["new"]["document_root"] == '') { - $app->log("document_root not set",LOGLEVEL_WARN); + $app->log("document_root not set", LOGLEVEL_WARN); return 0; } - - $symlink = true; - if($data["new"]["php"] == "suphp") $symlink = false; - elseif($data["new"]["php"] == "cgi" && $data["new"]["suexec"] == "y") $symlink = false; - elseif($data["new"]["php"] == "fast-cgi" && $data["new"]["suexec"] == "y") $symlink = false; - - - if(!is_dir($data["new"]["document_root"]."/web")) mkdir($data["new"]["document_root"].'/web', 0755, true); - if($symlink == false) { - if(is_link($data["new"]["document_root"].'/web/webmail')) unlink($data["new"]["document_root"].'/web/webmail'); - } else { - if(!is_link($data["new"]["document_root"]."/web/webmail")) symlink('/var/www/webmail',$data["new"]["document_root"].'/web/webmail'); - else symlink('/var/www/webmail',$data["new"]["document_root"].'/web/webmail'); - } + + $symlink = true; + if($data["new"]["php"] == "suphp") $symlink = false; + elseif($data["new"]["php"] == "cgi" && $data["new"]["suexec"] == "y") $symlink = false; + elseif($data["new"]["php"] == "fast-cgi" && $data["new"]["suexec"] == "y") $symlink = false; + + + if(!is_dir($data["new"]["document_root"]."/web")) mkdir($data["new"]["document_root"].'/web', 0755, true); + if($symlink == false) { + if(is_link($data["new"]["document_root"].'/web/webmail')) unlink($data["new"]["document_root"].'/web/webmail'); + } else { + if(!is_link($data["new"]["document_root"]."/web/webmail")) symlink('/var/www/webmail', $data["new"]["document_root"].'/web/webmail'); + else symlink('/var/www/webmail', $data["new"]["document_root"].'/web/webmail'); + } } - + } // end class -- Gitblit v1.9.1