From 5f97596d275792a7fdea23f132d83e121b931d35 Mon Sep 17 00:00:00 2001
From: tbrehm <t.brehm@ispconfig.org>
Date: Sat, 29 Apr 2006 08:22:27 +0000
Subject: [PATCH] updatded server part

---
 interface/lib/classes/tform.inc.php      |  7 ++-
 server/lib/app.inc.php                   | 27 +++++----
 server/lib/classes/mod_mail_base.inc.php | 76 ++++++++++++++++++++++++
 server/server.php                        | 30 ++++++++--
 4 files changed, 121 insertions(+), 19 deletions(-)
 create mode 100644 server/lib/classes/mod_mail_base.inc.php

diff --git a/interface/lib/classes/tform.inc.php b/interface/lib/classes/tform.inc.php
index 9c9bafb316..0336e11be7 100644
--- a/interface/lib/classes/tform.inc.php
+++ b/interface/lib/classes/tform.inc.php
@@ -810,7 +810,12 @@ class tform {
 				$server_id = ($record_old["server_id"] > 0)?$record_old["server_id"]:0;
 
                 if(count($diffrec) > 0) {
-                        $diffstr = $app->db->quote(serialize($diffrec));
+                        
+						// We need the full records in ISPConfig, not only the diffs
+						$diffrec = array(	'old' => $record_old,
+											'new' => $record_new);
+						
+						$diffstr = $app->db->quote(serialize($diffrec));
                         $username = $app->db->quote($_SESSION["s"]["user"]["username"]);
                         $dbidx = $this->formDef['db_table_idx'].":".$primary_id;
                         $action = ($action == 'INSERT')?'i':'u';
diff --git a/server/lib/app.inc.php b/server/lib/app.inc.php
index 49da38400b..1394b1e0c0 100644
--- a/server/lib/app.inc.php
+++ b/server/lib/app.inc.php
@@ -41,18 +41,19 @@ class app {
         }
 
         function uses($classes) {
-                global $conf;
-
-                $cl = explode(',',$classes);
-                if(is_array($cl)) {
-                        foreach($cl as $classname) {
-                                if(!is_object($this->$classname)) {
-                                        include_once($conf['classpath'] . "/".$classname.".inc.php");
-                                        $this->$classname = new $classname;
-                                }
-                        }
-                }
-
+			global $conf;
+
+			$cl = explode(',',$classes);
+			if(is_array($cl)) {
+				foreach($cl as $classname) {
+					if(!is_object($this->$classname)) {
+						if(is_file($conf['classpath'] . "/".$classname.".inc.php") && !is_link($conf['classpath'] . "/".$classname.".inc.php")) {
+							include_once($conf['classpath'] . "/".$classname.".inc.php");
+							$this->$classname = new $classname;
+						}
+					}
+				}
+			}
         }
 
         function load($files) {
@@ -61,7 +62,9 @@ class app {
                 $fl = explode(',',$files);
                 if(is_array($fl)) {
                         foreach($fl as $file) {
+							if(is_file($conf['classpath'] . "/".$classname.".inc.php") && !is_link($conf['classpath'] . "/".$classname.".inc.php")) {
                                 include_once($conf['classpath'] . "/".$file.".inc.php");
+							}
                         }
                 }
 
diff --git a/server/lib/classes/mod_mail_base.inc.php b/server/lib/classes/mod_mail_base.inc.php
new file mode 100644
index 0000000000..b169193566
--- /dev/null
+++ b/server/lib/classes/mod_mail_base.inc.php
@@ -0,0 +1,76 @@
+<?php
+
+/*
+Copyright (c) 2006, Till Brehm, projektfarm Gmbh
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+    * Redistributions of source code must retain the above copyright notice,
+      this list of conditions and the following disclaimer.
+    * Redistributions in binary form must reproduce the above copyright notice,
+      this list of conditions and the following disclaimer in the documentation
+      and/or other materials provided with the distribution.
+    * Neither the name of ISPConfig nor the names of its contributors
+      may be used to endorse or promote products derived from this software without
+      specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+class mail_base {
+	
+	var $current_record = array();
+	
+	function write_config() {
+		
+		
+		
+	}
+	
+	/*
+		Domain Alias
+	*/
+	
+	function domain_add($domain) {
+		
+	}
+	
+	function domain_update($domain_old, $domain_new) {
+		
+	}
+	
+	function domain_delete($domain) {
+		
+	}
+	
+	/*
+		Domain Alias
+	*/
+	
+	function domain_alias_add($domain, $destination) {
+		
+	}
+	
+	function domain_alias_update($domain_old, $domain_new) {
+		
+	}
+	
+	function domain_alias_delete($domain) {
+		
+	}
+	
+	
+}
+
+?>
\ No newline at end of file
diff --git a/server/server.php b/server/server.php
index 300e02fa92..d4b0565036 100644
--- a/server/server.php
+++ b/server/server.php
@@ -68,27 +68,45 @@ $conf["serverconfig"] = $app->ini_parser->parse_ini_string(stripslashes($server_
 
 // Run the configuration modules
 if($server_db_record["mail_server"] == 1) {
-	$app->uses('mod_mail_'.$conf["serverconfig"]["mail"]["module"]);
+	$app->load('mod_mail_base');
+	$mail_module_name = 'mod_mail_'.$conf["serverconfig"]["mail"]["module"];
+	$app->uses($mail_module_name);
+	$app->$mail_module_name->write_config();
 }
 
 if($server_db_record["web_server"] == 1) {
-	$app->uses('mod_web_'.$conf["serverconfig"]["web"]["module"]);
+	$app->load('mod_web_base');
+	$web_module_name = 'mod_web_'.$conf["serverconfig"]["web"]["module"];
+	$app->uses($web_module_name);
+	$app->$web_module_name->write_config();
 }
 
 if($server_db_record["dns_server"] == 1) {
-	$app->uses('mod_dns_'.$conf["serverconfig"]["dns"]["module"]);
+	$app->load('mod_dns_base');
+	$dns_module_name = 'mod_dns_'.$conf["serverconfig"]["dns"]["module"];
+	$app->uses($dns_module_name);
+	$app->$dns_module_name->write_config();
 }
 
 if($server_db_record["file_server"] == 1) {
-	$app->uses('mod_file_'.$conf["serverconfig"]["file"]["module"]);
+	$app->load('mod_file_base');
+	$file_module_name = 'mod_file_'.$conf["serverconfig"]["file"]["module"];
+	$app->uses($file_module_name);
+	$app->$file_module_name->write_config();
 }
 
 if($server_db_record["db_server"] == 1) {
-	$app->uses('mod_db_'.$conf["serverconfig"]["db"]["module"]);
+	$app->load('mod_db_base');
+	$db_module_name = 'mod_db_'.$conf["serverconfig"]["db"]["module"];
+	$app->uses($db_module_name);
+	$app->$db_module_name->write_config();
 }
 
 if($server_db_record["vserver_server"] == 1) {
-	$app->uses('mod_vserver_'.$conf["serverconfig"]["vserver"]["module"]);
+	$app->load('mod_vserver_base');
+	$vserver_module_name = 'mod_vserver_'.$conf["serverconfig"]["vserver"]["module"];
+	$app->uses($vserver_module_name);
+	$app->$vserver_module_name->write_config();
 }
 
 // Remove lock
-- 
GitLab