From df52d4b33c0267ef9be6d68864d1f14aaad9ab59 Mon Sep 17 00:00:00 2001
From: tbrehm <t.brehm@ispconfig.org>
Date: Wed, 19 Sep 2007 15:46:42 +0000
Subject: [PATCH] Fixed some bugs in the website module.

---
 install/lib/installer_base.lib.php            |  2 +-
 install/sql/ispconfig3.sql                    | 11 +++++++++--
 interface/lib/classes/tform.inc.php           |  4 ++--
 interface/web/sites/web_aliasdomain_edit.php  |  2 +-
 interface/web/sites/web_domain_edit.php       |  6 +++---
 interface/web/sites/web_subdomain_edit.php    |  4 ++--
 server/plugins-enabled/apache2_plugin.inc.php |  1 +
 7 files changed, 19 insertions(+), 11 deletions(-)

diff --git a/install/lib/installer_base.lib.php b/install/lib/installer_base.lib.php
index 1bffeb8e8a..b5f0617cca 100644
--- a/install/lib/installer_base.lib.php
+++ b/install/lib/installer_base.lib.php
@@ -646,7 +646,7 @@ class installer_base {
 		exec('crontab -u root -l > crontab.txt');
 		$existing_root_cron_jobs = file('crontab.txt');
 		
-		$root_cron_jobs = array('* * * * * /usr/bin/php -q /usr/local/ispconfig/server/server.php &> /dev/null');
+		$root_cron_jobs = array('* * * * * /usr/bin/php -q /usr/local/ispconfig/server/server.sh &> /dev/null');
 		foreach($root_cron_jobs as $cron_job) {
 			if(!in_array($cron_job."\n", $existing_root_cron_jobs)) {
 				$existing_root_cron_jobs[] = $cron_job."\n";
diff --git a/install/sql/ispconfig3.sql b/install/sql/ispconfig3.sql
index d96333f649..afca0ece6a 100644
--- a/install/sql/ispconfig3.sql
+++ b/install/sql/ispconfig3.sql
@@ -50,8 +50,15 @@ CREATE TABLE `client` (
   `limit_spamfilter_wblist` int(11) NOT NULL default '0',
   `limit_spamfilter_user` int(11) NOT NULL default '0',
   `limit_spamfilter_policy` int(11) NOT NULL default '0',
-  `default_webserver` int(11) NOT NULL,
-  `limit_web_ip` text NOT NULL,
+  `default_webserver` int(11) NOT NULL default '1',
+  `limit_web_ip` text,
+  `limit_web_domain` int(11) NOT NULL default '-1',
+  `limit_web_subdomain` int(11) NOT NULL default '-1',
+  `limit_web_aliasdomain` int(11) NOT NULL default '-1',
+  `limit_ftp_user` int(11) NOT NULL default '-1',
+  `default_dnsserver` int(10) unsigned NOT NULL default '1',
+  `limit_dns_zone` int(11) NOT NULL default '-1',
+  `limit_dns_record` int(11) NOT NULL default '-1',
   `username` varchar(255) default NULL,
   `password` varchar(255) default NULL,
   `language` varchar(255) NOT NULL default 'en',
diff --git a/interface/lib/classes/tform.inc.php b/interface/lib/classes/tform.inc.php
index 0cb58c7498..c190512cff 100644
--- a/interface/lib/classes/tform.inc.php
+++ b/interface/lib/classes/tform.inc.php
@@ -889,9 +889,9 @@ class tform {
 				
                 if(is_array($record_new) && count($record_new) > 0) {
                         foreach($record_new as $key => $val) {
-                                if($record_old[$key] != $val) {
+                                if(@$record_old[$key] != $val) {
 										// Record has changed
-                                        $diffrec[$key] = array('old' => $record_old[$key],
+                                        $diffrec[$key] = array('old' => @$record_old[$key],
                                                                'new' => $val);
                                 }
                         }
diff --git a/interface/web/sites/web_aliasdomain_edit.php b/interface/web/sites/web_aliasdomain_edit.php
index 67e7421f1d..2aefe52185 100644
--- a/interface/web/sites/web_aliasdomain_edit.php
+++ b/interface/web/sites/web_aliasdomain_edit.php
@@ -94,7 +94,7 @@ class page_action extends tform_actions {
 		global $app, $conf;
 		
 		// Get the record of the parent domain
-		$parent_domain = $app->db->queryOneRecord("select * FROM web_domain WHERE domain_id = ".intval($this->dataRecord["parent_domain_id"]));
+		$parent_domain = $app->db->queryOneRecord("select * FROM web_domain WHERE domain_id = ".intval(@$this->dataRecord["parent_domain_id"]));
 		
 		// Set a few fixed values
 		$this->dataRecord["type"] = 'alias';
diff --git a/interface/web/sites/web_domain_edit.php b/interface/web/sites/web_domain_edit.php
index cb3d57e444..7b1bc6df0d 100644
--- a/interface/web/sites/web_domain_edit.php
+++ b/interface/web/sites/web_domain_edit.php
@@ -122,7 +122,7 @@ class page_action extends tform_actions {
 			$client_select = "<option value='0'></option>";
 			if(is_array($clients)) {
 				foreach( $clients as $client) {
-					$selected = ($client["groupid"] == $this->dataRecord["sys_groupid"])?'SELECTED':'';
+					$selected = @($client["groupid"] == $this->dataRecord["sys_groupid"])?'SELECTED':'';
 					$client_select .= "<option value='$client[groupid]' $selected>$client[name]</option>\r\n";
 				}
 			}
@@ -235,8 +235,8 @@ class page_action extends tform_actions {
 			$client = $app->db->queryOneRecord("SELECT client_id FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
 			$client_id = intval($client["client_id"]);
 		} else {
-			$client_id = intval($web_rec["client_group_id"]);
-			$client = $app->db->queryOneRecord("SELECT client_id FROM sys_group WHERE sys_group.groupid = ".intval($this->dataRecord["client_group_id"]));
+			$client_id = intval(@$web_rec["client_group_id"]);
+			$client = $app->db->queryOneRecord("SELECT client_id FROM sys_group WHERE sys_group.groupid = ".intval(@$this->dataRecord["client_group_id"]));
 			$client_id = intval($client["client_id"]);
 		}
 		
diff --git a/interface/web/sites/web_subdomain_edit.php b/interface/web/sites/web_subdomain_edit.php
index 0fb1cfe663..91a84d1d3c 100644
--- a/interface/web/sites/web_subdomain_edit.php
+++ b/interface/web/sites/web_subdomain_edit.php
@@ -79,7 +79,7 @@ class page_action extends tform_actions {
 		global $app, $conf;
 		
 		// Get the record of the parent domain
-		$parent_domain = $app->db->queryOneRecord("select * FROM web_domain WHERE domain_id = ".intval($this->dataRecord["parent_domain_id"]));
+		$parent_domain = $app->db->queryOneRecord("select * FROM web_domain WHERE domain_id = ".intval(@$this->dataRecord["parent_domain_id"]));
 		
 		// remove the parent domain part of the domain name before we show it in the text field.
 		$this->dataRecord["domain"] = str_replace('.'.$parent_domain["domain"],'',$this->dataRecord["domain"]);
@@ -93,7 +93,7 @@ class page_action extends tform_actions {
 		global $app, $conf;
 		
 		// Get the record of the parent domain
-		$parent_domain = $app->db->queryOneRecord("select * FROM web_domain WHERE domain_id = ".intval($this->dataRecord["parent_domain_id"]));
+		$parent_domain = $app->db->queryOneRecord("select * FROM web_domain WHERE domain_id = ".intval(@$this->dataRecord["parent_domain_id"]));
 		
 		// Set a few fixed values
 		$this->dataRecord["type"] = 'subdomain';
diff --git a/server/plugins-enabled/apache2_plugin.inc.php b/server/plugins-enabled/apache2_plugin.inc.php
index 3db946ee50..a068fe5930 100644
--- a/server/plugins-enabled/apache2_plugin.inc.php
+++ b/server/plugins-enabled/apache2_plugin.inc.php
@@ -97,6 +97,7 @@ class apache2_plugin {
 		if(!is_dir($data["new"]["document_root"]."/cgi-bin")) exec("mkdir -p ".$data["new"]["document_root"]."/cgi-bin");
 		
 		// Create the symlink for the logfiles
+		if(!is_dir('/var/log/ispconfig/httpd/'.$data["new"]["domain"])) exec('mkdir -p /var/log/ispconfig/httpd/'.$data["new"]["domain"]);
 		if(!is_link($data["new"]["document_root"]."/log")) exec("ln -s /var/log/ispconfig/httpd/".$data["new"]["domain"]." ".$data["new"]["document_root"]."/log");
 		
 		// TODO: Create the symlinks
-- 
GitLab