From cea1e5d3d0a7c45568a1539f9ecb6cf36c7f7f6c Mon Sep 17 00:00:00 2001
From: tbrehm <t.brehm@ispconfig.org>
Date: Wed, 15 Aug 2012 09:43:27 +0000
Subject: [PATCH] Fixed: FS#2346 - doveadm request disabledoveadm column in
 mail_user table - Added missing sys_tpl table to ispconfig3.sql and moved the
 definition of the table to the upd_0035.sql file as new tables cant be added
 in existing update files. - added new ssl_key field to web_domain table. -
 cleaned up unused code from apache plugin.

---
 install/sql/incremental/upd_0034.sql          | 19 +-------------
 install/sql/incremental/upd_0035.sql          | 25 +++++++++++++++++++
 install/sql/ispconfig3.sql                    | 25 +++++++++++++++++++
 interface/web/mail/mail_user_edit.php         |  4 +--
 server/lib/classes/system.inc.php             |  6 ++---
 .../plugins-available/apache2_plugin.inc.php  | 19 ++------------
 6 files changed, 58 insertions(+), 40 deletions(-)
 create mode 100644 install/sql/incremental/upd_0035.sql

diff --git a/install/sql/incremental/upd_0034.sql b/install/sql/incremental/upd_0034.sql
index fce86f77a3..58b53c70b3 100644
--- a/install/sql/incremental/upd_0034.sql
+++ b/install/sql/incremental/upd_0034.sql
@@ -67,20 +67,6 @@ CREATE TABLE IF NOT EXISTS `aps_settings` (
 
 -- --------------------------------------------------------
 
---
--- Table structure for table `sys_theme`
---
-
-CREATE TABLE IF NOT EXISTS `sys_theme` (
-  `var_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
-  `tpl_name` varchar(32) NOT NULL,
-  `username` varchar(64) NOT NULL,
-  `logo_url` varchar(255) NOT NULL,
-  PRIMARY KEY (`var_id`)
-) ENGINE=MyISAM DEFAULT CHARSET=utf8 ;
-
--- --------------------------------------------------------
-
 --
 -- Dumping data for table `aps_settings`
 --
@@ -90,7 +76,4 @@ INSERT INTO `aps_settings` (`id`, `name`, `value`) VALUES(2, 'ignore-php-configu
 INSERT INTO `aps_settings` (`id`, `name`, `value`) VALUES(3, 'ignore-webserver-module', '');
 
 ALTER TABLE  `client` ADD  `limit_aps` int(11) NOT NULL DEFAULT '0' AFTER  `limit_webdav_user`;
-ALTER TABLE  `client_template` ADD  `limit_aps` int(11) NOT NULL DEFAULT '0' AFTER  `limit_webdav_user`;
-
-INSERT INTO `dbispconfig`.`sys_theme` (`var_id`, `tpl_name`, `username`, `logo_url`) VALUES (NULL, 'default', 'global', 'themes/default/images/header_logo.png');
-INSERT INTO `dbispconfig`.`sys_theme` (`var_id`, `tpl_name`, `username`, `logo_url`) VALUES (NULL, 'default-v2', 'global', 'themes/default-v2/images/header_logo.png');
\ No newline at end of file
+ALTER TABLE  `client_template` ADD  `limit_aps` int(11) NOT NULL DEFAULT '0' AFTER  `limit_webdav_user`;
\ No newline at end of file
diff --git a/install/sql/incremental/upd_0035.sql b/install/sql/incremental/upd_0035.sql
new file mode 100644
index 0000000000..aeaf821038
--- /dev/null
+++ b/install/sql/incremental/upd_0035.sql
@@ -0,0 +1,25 @@
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `sys_theme`
+--
+
+CREATE TABLE IF NOT EXISTS `sys_theme` (
+  `var_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
+  `tpl_name` varchar(32) NOT NULL,
+  `username` varchar(64) NOT NULL,
+  `logo_url` varchar(255) NOT NULL,
+  PRIMARY KEY (`var_id`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 ;
+
+-- --------------------------------------------------------
+
+INSERT INTO `sys_theme` (`var_id`, `tpl_name`, `username`, `logo_url`) VALUES (NULL, 'default', 'global', 'themes/default/images/header_logo.png');
+INSERT INTO `sys_theme` (`var_id`, `tpl_name`, `username`, `logo_url`) VALUES (NULL, 'default-v2', 'global', 'themes/default-v2/images/header_logo.png');
+
+-- --------------------------------------------------------
+
+ALTER TABLE  `web_domain` ADD  `ssl_key` MEDIUMTEXT NOT NULL AFTER  `ssl_bundle`;
+ALTER TABLE  `mail_user` ADD  `disabledoveadm` enum('n','y') NOT NULL default 'n' AFTER  `disablelda`
+
+
diff --git a/install/sql/ispconfig3.sql b/install/sql/ispconfig3.sql
index f4e3f28dee..a7ac059a32 100644
--- a/install/sql/ispconfig3.sql
+++ b/install/sql/ispconfig3.sql
@@ -789,6 +789,7 @@ CREATE TABLE `mail_user` (
   `disablesmtp` enum('n','y') NOT NULL default 'n',
   `disablesieve` enum('n','y') NOT NULL default 'n',
   `disablelda` enum('n','y') NOT NULL default 'n',
+  `disabledoveadm` enum('n','y') NOT NULL default 'n',
   PRIMARY KEY  (`mailuser_id`),
   KEY `server_id` (`server_id`,`email`),
   KEY `email_access` (`email`,`access`)
@@ -1500,6 +1501,20 @@ CREATE TABLE `sys_session` (
 
 -- --------------------------------------------------------
 
+--
+-- Table structure for table `sys_theme`
+--
+
+CREATE TABLE IF NOT EXISTS `sys_theme` (
+  `var_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
+  `tpl_name` varchar(32) NOT NULL,
+  `username` varchar(64) NOT NULL,
+  `logo_url` varchar(255) NOT NULL,
+  PRIMARY KEY (`var_id`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 ;
+
+-- --------------------------------------------------------
+
 -- 
 -- Table structure for table  `sys_user`
 -- 
@@ -1641,6 +1656,7 @@ CREATE TABLE `web_domain` (
   `ssl_request` mediumtext NULL,
   `ssl_cert` mediumtext NULL,
   `ssl_bundle` mediumtext NULL,
+  `ssl_key` mediumtext NULL,
   `ssl_action` varchar(16) NULL,
   `stats_password` varchar(255) default NULL,
   `stats_type` varchar(255) default 'webalizer',
@@ -2057,6 +2073,15 @@ INSERT INTO `sys_ini` (`sysini_id`, `config`) VALUES (1, '');
 -- Dumping data for table `sys_user`
 -- 
 
+INSERT INTO `sys_theme` (`var_id`, `tpl_name`, `username`, `logo_url`) VALUES (NULL, 'default', 'global', 'themes/default/images/header_logo.png');
+INSERT INTO `sys_theme` (`var_id`, `tpl_name`, `username`, `logo_url`) VALUES (NULL, 'default-v2', 'global', 'themes/default-v2/images/header_logo.png');
+
+-- --------------------------------------------------------
+
+-- 
+-- Dumping data for table `sys_user`
+-- 
+
 INSERT INTO `sys_user` (`userid`, `sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `username`, `passwort`, `modules`, `startmodule`, `app_theme`, `typ`, `active`, `language`, `groups`, `default_group`, `client_id`) VALUES (1, 1, 0, 'riud', 'riud', '', 'admin', '21232f297a57a5a743894a0e4a801fc3', 'dashboard,admin,client,mail,monitor,sites,dns,vm,tools,help', 'dashboard', 'default', 'admin', 1, 'en', '1,2', 1, 0);
 
 -- --------------------------------------------------------
diff --git a/interface/web/mail/mail_user_edit.php b/interface/web/mail/mail_user_edit.php
index 2c1ee3e063..cfb6592a20 100644
--- a/interface/web/mail/mail_user_edit.php
+++ b/interface/web/mail/mail_user_edit.php
@@ -251,7 +251,7 @@ class page_action extends tform_actions {
 			$disabledeliver = ($this->dataRecord["postfix"] == 'y')?'n':'y';
 			$disablesmtp = ($this->dataRecord["postfix"] == 'y')?'n':'y';
 		
-			$sql = "UPDATE mail_user SET disableimap = '$disableimap', disablesieve = '$disableimap', disablepop3 = '$disablepop3', disablesmtp = '$disablesmtp', disabledeliver = '$disabledeliver', disablelda = '$disabledeliver' WHERE mailuser_id = ".$this->id;
+			$sql = "UPDATE mail_user SET disableimap = '$disableimap', disablesieve = '$disableimap', disablepop3 = '$disablepop3', disablesmtp = '$disablesmtp', disabledeliver = '$disabledeliver', disablelda = '$disabledeliver', disabledoveadm = '$disableimap' WHERE mailuser_id = ".$this->id;
 			$app->db->query($sql);
 		}
 	}
@@ -292,7 +292,7 @@ class page_action extends tform_actions {
 			$disabledeliver = ($this->dataRecord["postfix"] == 'y')?'n':'y';
 			$disablesmtp = ($this->dataRecord["postfix"] == 'y')?'n':'y';
 		
-			$sql = "UPDATE mail_user SET disableimap = '$disableimap', disablesieve = '$disableimap', disablepop3 = '$disablepop3', disablesmtp = '$disablesmtp', disabledeliver = '$disabledeliver', disablelda = '$disabledeliver' WHERE mailuser_id = ".$this->id;
+			$sql = "UPDATE mail_user SET disableimap = '$disableimap', disablesieve = '$disableimap', disablepop3 = '$disablepop3', disablesmtp = '$disablesmtp', disabledeliver = '$disabledeliver', disablelda = '$disabledeliver', disabledoveadm = '$disableimap' WHERE mailuser_id = ".$this->id;
 			$app->db->query($sql);
 		}
 		
diff --git a/server/lib/classes/system.inc.php b/server/lib/classes/system.inc.php
index 14b9413c2a..b1f9103309 100644
--- a/server/lib/classes/system.inc.php
+++ b/server/lib/classes/system.inc.php
@@ -41,9 +41,9 @@ class system{
 	 * @return system
 	 */
 	public function system(){
-		global $go_info;
-	  	$this->server_id = $go_info['isp']['server_id'];
-	  	$this->server_conf = $go_info['isp']['server_conf'];
+		//global $go_info;
+	  	//$this->server_id = $go_info['isp']['server_id'];
+	  	//$this->server_conf = $go_info['isp']['server_conf'];
 	  	$this->server_conf['passwd_datei'] = '/etc/passwd';
 	  	$this->server_conf['shadow_datei'] = '/etc/shadow';
 	  	$this->server_conf['group_datei'] = '/etc/group';
diff --git a/server/plugins-available/apache2_plugin.inc.php b/server/plugins-available/apache2_plugin.inc.php
index ed2405a52a..29672730a1 100644
--- a/server/plugins-available/apache2_plugin.inc.php
+++ b/server/plugins-available/apache2_plugin.inc.php
@@ -1,7 +1,7 @@
 <?php
 
 /*
-Copyright (c) 2007 - 2009, Till Brehm, projektfarm Gmbh
+Copyright (c) 2007 - 2012, Till Brehm, projektfarm Gmbh
 All rights reserved.
 
 Redistribution and use in source and binary forms, with or without modification,
@@ -458,21 +458,6 @@ class apache2_plugin {
 			if(is_link($data['old']['document_root'].'/log')) $app->system->unlink($data['old']['document_root'].'/log');
 		}
 		
-		/*
-		// Create the symlink for the logfiles
-		if(!is_dir('/var/log/ispconfig/httpd/'.$data['new']['domain'])) $app->system->mkdirpath('/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");
-			if ($web_config["website_symlinks_rel"] == 'y') {
-				$this->create_relative_link("/var/log/ispconfig/httpd/".$data["new"]["domain"], $data["new"]["document_root"]."/log");
-			} else {
-				exec("ln -s /var/log/ispconfig/httpd/".$data["new"]["domain"]." ".$data["new"]["document_root"]."/log");
-			}
-
-			$app->log('Creating symlink: ln -s /var/log/ispconfig/httpd/'.$data['new']['domain'].' '.$data['new']['document_root'].'/log',LOGLEVEL_DEBUG);
-		}
-		*/
-		
 		//* Create the log dir if nescessary and mount it
 		if(!is_dir($data['new']['document_root'].'/log') || is_link($data['new']['document_root'].'/log')) {
 			if(is_link($data['new']['document_root'].'/log')) unlink($data['new']['document_root'].'/log');
@@ -651,7 +636,7 @@ class apache2_plugin {
 				// make tmp directory writable for Apache and the website users
 				$app->system->chmod($data['new']['document_root'].'/tmp',0777);
 			
-				// Set Log symlink to 755 to make the logs accessible by the FTP user
+				// Set Log directory to 755 to make the logs accessible by the FTP user
 				if(realpath($data['new']['document_root'].'/log') == '/var/log/ispconfig/httpd/'.$data['new']['domain'].'/error.log') {
 					$app->system->chmod($data['new']['document_root'].'/log',0755);
 				}
-- 
GitLab