From 355efb9a7f74a2035f595bbd0d03375710d08587 Mon Sep 17 00:00:00 2001
From: tbrehm <t.brehm@ispconfig.org>
Date: Wed, 25 Jan 2012 09:43:56 -0500
Subject: [PATCH] Merged revisions 2886-2909 from stable branch.
---
interface/web/dns/lib/lang/en_dns_soa.lng | 1
interface/web/dns/form/dns_soa.tform.php | 4
interface/web/sites/templates/web_subdomain_edit.htm | 4
interface/web/dns/form/dns_ns.tform.php | 2
interface/web/dns/templates/dns_slave_edit.htm | 14 ++
interface/web/mail/lib/lang/en_mail_get.lng | 1
server/plugins-available/mailman_plugin.inc.php | 6 +
install/update.php | 2
server/conf/awstats_index.php.master | 7 +
remoting_client/examples/soap_config.php | 4
remoting_client/examples/mail_forward_get.php | 1
interface/web/admin/software_update_list.php | 2
server/conf/vhost.conf.master | 2
interface/web/sites/templates/web_aliasdomain_edit.htm | 4
server/plugins-available/apache2_plugin.inc.php | 8 +
interface/lib/classes/remoting.inc.php | 30 ++++--
interface/lib/classes/remoting_lib.inc.php | 17 ++
server/plugins-available/mail_plugin.inc.php | 45 +++++----
interface/web/sites/templates/web_domain_redirect.htm | 3
server/plugins-available/nginx_plugin.inc.php | 20 +++
interface/web/dns/dns_soa_edit.php | 33 +++++
server/cron_daily.php | 2
server/plugins-available/bind_plugin.inc.php | 10 ++
server/lib/classes/system.inc.php | 18 +++
interface/web/dns/templates/dns_soa_edit.htm | 14 ++
interface/web/dns/form/dns_cname.tform.php | 2
interface/web/dns/form/dns_srv.tform.php | 2
interface/web/dns/form/dns_rp.tform.php | 2
interface/web/dns/dns_slave_edit.php | 8 +
interface/web/sites/web_domain_edit.php | 2
interface/web/dns/form/dns_slave.tform.php | 2
remoting_client/examples/sites_database_add.php | 10 +-
interface/web/sites/tools.inc.php | 4
interface/web/dns/form/dns_alias.tform.php | 2
interface/web/mail/mail_get_edit.php | 6 +
interface/lib/classes/functions.inc.php | 2
interface/web/dns/form/dns_txt.tform.php | 2
37 files changed, 219 insertions(+), 79 deletions(-)
diff --git a/install/update.php b/install/update.php
index 8786658..8e00a87 100644
--- a/install/update.php
+++ b/install/update.php
@@ -96,7 +96,7 @@
$conf["mysql"]["ispconfig_password"] = $conf_old["db_password"];
$conf['language'] = $conf_old['language'];
if($conf['language'] == '{language}') $conf['language'] = 'en';
-$conf['timezone'] = $conf_old['timezone'];
+$conf['timezone'] = (isset($conf_old['timezone']))?$conf_old['timezone']:'UTC';
if($conf['timezone'] == '{timezone}' or trim($conf['timezone']) == '') $conf['timezone'] = 'UTC';
if(isset($conf_old["dbmaster_host"])) $conf["mysql"]["master_host"] = $conf_old["dbmaster_host"];
diff --git a/interface/lib/classes/functions.inc.php b/interface/lib/classes/functions.inc.php
index 3e926ae..b744e35 100644
--- a/interface/lib/classes/functions.inc.php
+++ b/interface/lib/classes/functions.inc.php
@@ -45,6 +45,7 @@
$content = file_get_contents($filepath);
$content = chunk_split(base64_encode($content));
$uid = strtoupper(md5(uniqid(time())));
+ $subject = "=?utf-8?B?".base64_encode($subject)."?=";
if($filename == '') {
$path_parts = pathinfo($filepath);
@@ -75,6 +76,7 @@
$header = "From: $from\nReply-To: $from\n";
$header .= "Content-Type: text/plain;\n\tcharset=\"UTF-8\"\n";
$header .= "Content-Transfer-Encoding: 8bit\n\n";
+ $subject = "=?utf-8?B?".base64_encode($subject)."?=";
mail($to, $subject, $text, $header);
}
diff --git a/interface/lib/classes/remoting.inc.php b/interface/lib/classes/remoting.inc.php
index cfdc227..9f88cfc 100644
--- a/interface/lib/classes/remoting.inc.php
+++ b/interface/lib/classes/remoting.inc.php
@@ -348,8 +348,8 @@
$this->server->fault('permission_denied','You do not have the permissions to access this function.');
return false;
}
- $affected_rows = $this->deleteQuery('../mail/form/mail_user_filter.tform.php', $primary_id);
- $app->plugin->raiseEvent('mail:mail_user_filter:on_after_delete',$this);
+ $affected_rows = $this->deleteQuery('../mail/form/mail_user_filter.tform.php', $primary_id,'mail:mail_user_filter:on_after_delete');
+ // $app->plugin->raiseEvent('mail:mail_user_filter:on_after_delete',$this);
return $affected_rows;
}
@@ -2180,19 +2180,28 @@
//* Get the SQL query
$sql = $app->remoting_lib->getSQL($params,'INSERT',0);
- $app->db->query($sql);
//* Check if no system user with that username exists
$username = $app->db->quote($params["username"]);
- $tmp = $app->db->queryOneRecord("SELECT count(userid) as number FROm sys_user WHERE username = '$username'");
+ $tmp = $app->db->queryOneRecord("SELECT count(userid) as number FROM sys_user WHERE username = '$username'");
if($tmp['number'] > 0) $app->remoting_lib->errorMessage .= "Duplicate username<br />";
+ //* Stop on error while preparing the sql query
if($app->remoting_lib->errorMessage != '') {
$this->server->fault('data_processing_error', $app->remoting_lib->errorMessage);
return false;
}
+ //* Execute the SQL query
+ $app->db->query($sql);
$insert_id = $app->db->insertID();
+
+
+ //* Stop on error while executing the sql query
+ if($app->remoting_lib->errorMessage != '') {
+ $this->server->fault('data_processing_error', $app->remoting_lib->errorMessage);
+ return false;
+ }
$this->id = $insert_id;
$this->dataRecord = $params;
@@ -2332,22 +2341,23 @@
// set a few values for compatibility with tform actions, mostly used by plugins
$this->oldDataRecord = $old_rec;
$this->id = $primary_id;
- $this->dataRecord = $params;
+ $this->dataRecord = $old_rec;
+ //$this->dataRecord = $params;
//* Get the SQL query
$sql = $app->remoting_lib->getDeleteSQL($primary_id);
-
+ $app->db->errorMessage = '';
$app->db->query($sql);
+ $affected_rows = $app->db->affectedRows();
if($app->db->errorMessage != '') {
-
- if($event_identifier != '') $app->plugin->raiseEvent($event_identifier,$this);
-
$this->server->fault('database_error', $app->db->errorMessage . ' '.$sql);
return false;
}
- $affected_rows = $app->db->affectedRows();
+ if($event_identifier != '') {
+ $app->plugin->raiseEvent($event_identifier,$this);
+ }
//* Save changes to Datalog
if($app->remoting_lib->formDef["db_history"] == 'yes') {
diff --git a/interface/lib/classes/remoting_lib.inc.php b/interface/lib/classes/remoting_lib.inc.php
index 06d5dfd..1d732af 100644
--- a/interface/lib/classes/remoting_lib.inc.php
+++ b/interface/lib/classes/remoting_lib.inc.php
@@ -536,11 +536,16 @@
if($field['formtype'] == 'PASSWORD') {
$sql_insert_key .= "`$key`, ";
if($field['encryption'] == 'CRYPT') {
- $record[$key] = $app->auth->crypt_password(stripslashes($record[$key]));
+ $record[$key] = $app->auth->crypt_password(stripslashes($record[$key]));
+ $sql_insert_val .= "'".$app->db->quote($record[$key])."', ";
+ } elseif ($field['encryption'] == 'MYSQL') {
+ $sql_insert_val .= "PASSWORD('".$app->db->quote($record[$key])."'), ";
+ } elseif ($field['encryption'] == 'CLEARTEXT') {
+ $sql_insert_val .= "'".$app->db->quote($record[$key])."', ";
} else {
- $record[$key] = md5($record[$key]);
+ $record[$key] = md5(stripslashes($record[$key]));
+ $sql_insert_val .= "'".$app->db->quote($record[$key])."', ";
}
- $sql_insert_val .= "'".$record[$key]."', ";
} elseif ($field['formtype'] == 'CHECKBOX') {
$sql_insert_key .= "`$key`, ";
if($record[$key] == '') {
@@ -645,7 +650,11 @@
foreach($primary_id as $key => $val) {
$key = $app->db->quote($key);
$val = $app->db->quote($val);
- $sql_where .= "$key = '$val' AND ";
+ if(stristr($val,'%')) {
+ $sql_where .= "$key like '$val' AND ";
+ } else {
+ $sql_where .= "$key = '$val' AND ";
+ }
}
$sql_where = substr($sql_where,0,-5);
$sql = "SELECT * FROM ".$escape.$this->formDef['db_table'].$escape." WHERE ".$sql_where;
diff --git a/interface/web/admin/software_update_list.php b/interface/web/admin/software_update_list.php
index 03d2658..734f369 100644
--- a/interface/web/admin/software_update_list.php
+++ b/interface/web/admin/software_update_list.php
@@ -161,7 +161,7 @@
foreach($installed_packages as $ip) {
// Get version number of the latest installed version
- $sql = "SELECT v1, v2, v3, v4 FROM software_update, software_update_inst WHERE software_update.software_update_id = software_update_inst.software_update_id AND server_id = 1 ORDER BY v1 DESC , v2 DESC , v3 DESC , v4 DESC LIMIT 0,1";
+ $sql = "SELECT v1, v2, v3, v4 FROM software_update, software_update_inst WHERE software_update.software_update_id = software_update_inst.software_update_id AND server_id = ".$server_id." ORDER BY v1 DESC , v2 DESC , v3 DESC , v4 DESC LIMIT 0,1";
$lu = $app->db->queryOneRecord($sql);
// Get all installable updates
diff --git a/interface/web/dns/dns_slave_edit.php b/interface/web/dns/dns_slave_edit.php
index dc43a4b..4564da1 100644
--- a/interface/web/dns/dns_slave_edit.php
+++ b/interface/web/dns/dns_slave_edit.php
@@ -106,6 +106,14 @@
}
+ if($this->id > 0) {
+ //* we are editing a existing record
+ $app->tpl->setVar("edit_disabled", 1);
+ $app->tpl->setVar("server_id_value", $this->dataRecord["server_id"]);
+ } else {
+ $app->tpl->setVar("edit_disabled", 0);
+ }
+
parent::onShowEnd();
}
diff --git a/interface/web/dns/dns_soa_edit.php b/interface/web/dns/dns_soa_edit.php
index 7ec0278..173ec7b 100644
--- a/interface/web/dns/dns_soa_edit.php
+++ b/interface/web/dns/dns_soa_edit.php
@@ -116,6 +116,14 @@
}
+ if($this->id > 0) {
+ //* we are editing a existing record
+ $app->tpl->setVar("edit_disabled", 1);
+ $app->tpl->setVar("server_id_value", $this->dataRecord["server_id"]);
+ } else {
+ $app->tpl->setVar("edit_disabled", 0);
+ }
+
parent::onShowEnd();
}
@@ -180,17 +188,34 @@
// make sure that the record belongs to the client group and not the admin group when a dmin inserts it
if($_SESSION["s"]["user"]["typ"] == 'admin' && isset($this->dataRecord["client_group_id"])) {
$client_group_id = intval($this->dataRecord["client_group_id"]);
- $app->db->query("UPDATE dns_soa SET sys_groupid = $client_group_id WHERE id = ".$this->id);
+ $app->db->query("UPDATE dns_soa SET sys_groupid = $client_group_id, sys_perm_group = 'ru' WHERE id = ".$this->id);
// And we want to update all rr records too, that belong to this record
$app->db->query("UPDATE dns_rr SET sys_groupid = $client_group_id WHERE zone = ".$this->id);
}
if($app->auth->has_clients($_SESSION['s']['user']['userid']) && isset($this->dataRecord["client_group_id"])) {
$client_group_id = intval($this->dataRecord["client_group_id"]);
- $app->db->query("UPDATE dns_soa SET sys_groupid = $client_group_id WHERE id = ".$this->id);
+ $app->db->query("UPDATE dns_soa SET sys_groupid = $client_group_id, sys_perm_group = 'riud' WHERE id = ".$this->id);
// And we want to update all rr records too, that belong to this record
$app->db->query("UPDATE dns_rr SET sys_groupid = $client_group_id WHERE zone = ".$this->id);
}
+ }
+
+ function onBeforeUpdate () {
+ global $app, $conf;
+
+ //* Check if the server has been changed
+ // We do this only for the admin or reseller users, as normal clients can not change the server ID anyway
+ if($_SESSION["s"]["user"]["typ"] != 'admin' && !$app->auth->has_clients($_SESSION['s']['user']['userid'])) {
+ //* We do not allow users to change a domain which has been created by the admin
+ $rec = $app->db->queryOneRecord("SELECT origin from dns_soa WHERE id = ".$this->id);
+ if(isset($this->dataRecord["origin"]) && $rec['origin'] != $this->dataRecord["origin"] && $app->tform->checkPerm($this->id,'u')) {
+ //* Add a error message and switch back to old server
+ $app->tform->errorMessage .= $app->lng('The Zone (soa) can not be changed. Please ask your Administrator if you want to change the Zone name.');
+ $this->dataRecord["origin"] = $rec['origin'];
+ }
+ unset($rec);
+ }
}
function onAfterUpdate() {
@@ -206,13 +231,13 @@
// make sure that the record belongs to the client group and not the admin group when a dmin inserts it
if($_SESSION["s"]["user"]["typ"] == 'admin' && isset($this->dataRecord["client_group_id"])) {
$client_group_id = intval($this->dataRecord["client_group_id"]);
- $app->db->query("UPDATE dns_soa SET sys_groupid = $client_group_id WHERE id = ".$this->id);
+ $app->db->query("UPDATE dns_soa SET sys_groupid = $client_group_id, sys_perm_group = 'ru' WHERE id = ".$this->id);
// And we want to update all rr records too, that belong to this record
$app->db->query("UPDATE dns_rr SET sys_groupid = $client_group_id WHERE zone = ".$this->id);
}
if($app->auth->has_clients($_SESSION['s']['user']['userid']) && isset($this->dataRecord["client_group_id"])) {
$client_group_id = intval($this->dataRecord["client_group_id"]);
- $app->db->query("UPDATE dns_soa SET sys_groupid = $client_group_id WHERE id = ".$this->id);
+ $app->db->query("UPDATE dns_soa SET sys_groupid = $client_group_id, sys_perm_group = 'riud' WHERE id = ".$this->id);
// And we want to update all rr records too, that belong to this record
$app->db->query("UPDATE dns_rr SET sys_groupid = $client_group_id WHERE zone = ".$this->id);
}
diff --git a/interface/web/dns/form/dns_alias.tform.php b/interface/web/dns/form/dns_alias.tform.php
index 2108982..8d103f6 100644
--- a/interface/web/dns/form/dns_alias.tform.php
+++ b/interface/web/dns/form/dns_alias.tform.php
@@ -80,7 +80,7 @@
'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY',
'errmsg'=> 'name_error_empty'),
1 => array ( 'type' => 'REGEX',
- 'regex' => '/^[\w\.\-]{1,64}$/',
+ 'regex' => '/^[\w\.\-]{1,255}$/',
'errmsg'=> 'name_error_regex'),
),
'default' => '',
diff --git a/interface/web/dns/form/dns_cname.tform.php b/interface/web/dns/form/dns_cname.tform.php
index 48ac925..aedadc6 100644
--- a/interface/web/dns/form/dns_cname.tform.php
+++ b/interface/web/dns/form/dns_cname.tform.php
@@ -78,7 +78,7 @@
'datatype' => 'VARCHAR',
'formtype' => 'TEXT',
'validators' => array ( 0 => array ( 'type' => 'REGEX',
- 'regex' => '/^[\w\.\-\*]{0,64}$/',
+ 'regex' => '/^[\w\.\-\*]{0,255}$/',
'errmsg'=> 'name_error_regex'),
),
'default' => '',
diff --git a/interface/web/dns/form/dns_ns.tform.php b/interface/web/dns/form/dns_ns.tform.php
index 8fbb157..6fcc7a5 100644
--- a/interface/web/dns/form/dns_ns.tform.php
+++ b/interface/web/dns/form/dns_ns.tform.php
@@ -78,7 +78,7 @@
'datatype' => 'VARCHAR',
'formtype' => 'TEXT',
'validators' => array ( 0 => array ( 'type' => 'REGEX',
- 'regex' => '/^[\w\.\-]{0,64}$/',
+ 'regex' => '/^[\w\.\-]{0,255}$/',
'errmsg'=> 'name_error_regex'),
),
'default' => '',
diff --git a/interface/web/dns/form/dns_rp.tform.php b/interface/web/dns/form/dns_rp.tform.php
index 938aa61..aa94b55 100644
--- a/interface/web/dns/form/dns_rp.tform.php
+++ b/interface/web/dns/form/dns_rp.tform.php
@@ -78,7 +78,7 @@
'datatype' => 'VARCHAR',
'formtype' => 'TEXT',
'validators' => array ( 0 => array ( 'type' => 'REGEX',
- 'regex' => '/^[\w\.\-]{0,64}$/',
+ 'regex' => '/^[\w\.\-]{0,255}$/',
'errmsg'=> 'name_error_regex'),
),
'default' => '',
diff --git a/interface/web/dns/form/dns_slave.tform.php b/interface/web/dns/form/dns_slave.tform.php
index 1094e7c..097602e 100644
--- a/interface/web/dns/form/dns_slave.tform.php
+++ b/interface/web/dns/form/dns_slave.tform.php
@@ -94,7 +94,7 @@
'datatype' => 'VARCHAR',
'formtype' => 'TEXT',
'validators' => array ( 0 => array ( 'type' => 'REGEX',
- 'regex' => '/^[\w\.\-]{1,64}$/',
+ 'regex' => '/^[\w\.\-]{1,255}$/',
'errmsg'=> 'ns_error_regex'),
),
'default' => '',
diff --git a/interface/web/dns/form/dns_soa.tform.php b/interface/web/dns/form/dns_soa.tform.php
index 4490d55..53b408e 100644
--- a/interface/web/dns/form/dns_soa.tform.php
+++ b/interface/web/dns/form/dns_soa.tform.php
@@ -94,7 +94,7 @@
'datatype' => 'VARCHAR',
'formtype' => 'TEXT',
'validators' => array ( 0 => array ( 'type' => 'REGEX',
- 'regex' => '/^[\w\.\-]{1,64}$/',
+ 'regex' => '/^[\w\.\-]{1,255}$/',
'errmsg'=> 'ns_error_regex'),
),
'default' => '',
@@ -108,7 +108,7 @@
'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY',
'errmsg'=> 'mbox_error_empty'),
1 => array ( 'type' => 'REGEX',
- 'regex' => '/^[[a-zA-Z0-9\.\-\_]{0,64}\.$/',
+ 'regex' => '/^[[a-zA-Z0-9\.\-\_]{0,255}\.$/',
'errmsg'=> 'mbox_error_regex'),
),
'default' => '',
diff --git a/interface/web/dns/form/dns_srv.tform.php b/interface/web/dns/form/dns_srv.tform.php
index 0de4616..a30f6f3 100644
--- a/interface/web/dns/form/dns_srv.tform.php
+++ b/interface/web/dns/form/dns_srv.tform.php
@@ -78,7 +78,7 @@
'datatype' => 'VARCHAR',
'formtype' => 'TEXT',
'validators' => array ( 0 => array ( 'type' => 'REGEX',
- 'regex' => '/^[\w\.\-]{0,64}$/',
+ 'regex' => '/^[\w\.\-]{0,255}$/',
'errmsg'=> 'name_error_regex'),
),
'default' => '',
diff --git a/interface/web/dns/form/dns_txt.tform.php b/interface/web/dns/form/dns_txt.tform.php
index a198d4e..e9d616d 100644
--- a/interface/web/dns/form/dns_txt.tform.php
+++ b/interface/web/dns/form/dns_txt.tform.php
@@ -78,7 +78,7 @@
'datatype' => 'VARCHAR',
'formtype' => 'TEXT',
'validators' => array ( 0 => array ( 'type' => 'REGEX',
- 'regex' => '/^[\w\.\-]{0,64}$/',
+ 'regex' => '/^[\w\.\-]{0,255}$/',
'errmsg'=> 'name_error_regex'),
),
'default' => '',
diff --git a/interface/web/dns/lib/lang/en_dns_soa.lng b/interface/web/dns/lib/lang/en_dns_soa.lng
index 5d45f34..95afad4 100644
--- a/interface/web/dns/lib/lang/en_dns_soa.lng
+++ b/interface/web/dns/lib/lang/en_dns_soa.lng
@@ -28,4 +28,5 @@
$wb['eg_domain_tld'] = 'e.g. domain.tld';
$wb['eg_ns1_domain_tld'] = 'e.g. ns1.domain.tld';
$wb['eg_webmaster_domain_tld'] = 'e.g. webmaster@domain.tld';
+$wb['The Domain can not be changed. Please ask your Administrator if you want to change the domain name.'] = 'The Domain can not be changed. Please ask your Administrator if you want to change the domain name.';
?>
diff --git a/interface/web/dns/templates/dns_slave_edit.htm b/interface/web/dns/templates/dns_slave_edit.htm
index 3305e63..4cc0fde 100644
--- a/interface/web/dns/templates/dns_slave_edit.htm
+++ b/interface/web/dns/templates/dns_slave_edit.htm
@@ -7,10 +7,18 @@
<fieldset class="inlineLabels"><legend>Secondary DNS Zone</legend>
<tmpl_if name="is_admin">
<div class="ctrlHolder">
- <label for="server_id">{tmpl_var name='server_id_txt'}</label>
+ <tmpl_if name="edit_disabled">
+ <label for="server_id_disabled">{tmpl_var name='server_id_txt'}</label>
+ <select name="server_id_disabled" id="server_id_disabled" class="selectInput" disabled="disabled">
+ {tmpl_var name='server_id'}
+ </select>
+ <input type="hidden" name="server_id" value="{tmpl_var name='server_id_value'}" />
+ <tmpl_else>
+ <label for="server_id">{tmpl_var name='server_id_txt'}</label>
<select name="server_id" id="server_id" class="selectInput">
- {tmpl_var name='server_id'}
- </select>
+ {tmpl_var name='server_id'}
+ </select>
+ </tmpl_if>
</div>
<div class="ctrlHolder">
<label for="client_group_id">{tmpl_var name='client_txt'}</label>
diff --git a/interface/web/dns/templates/dns_soa_edit.htm b/interface/web/dns/templates/dns_soa_edit.htm
index 82e8fc2..fa83123 100644
--- a/interface/web/dns/templates/dns_soa_edit.htm
+++ b/interface/web/dns/templates/dns_soa_edit.htm
@@ -7,10 +7,18 @@
<fieldset class="inlineLabels"><legend>DNS Zone</legend>
<tmpl_if name="is_admin">
<div class="ctrlHolder">
- <label for="server_id">{tmpl_var name='server_id_txt'}</label>
+ <tmpl_if name="edit_disabled">
+ <label for="server_id_disabled">{tmpl_var name='server_id_txt'}</label>
+ <select name="server_id_disabled" id="server_id_disabled" class="selectInput" disabled="disabled">
+ {tmpl_var name='server_id'}
+ </select>
+ <input type="hidden" name="server_id" value="{tmpl_var name='server_id_value'}" />
+ <tmpl_else>
+ <label for="server_id">{tmpl_var name='server_id_txt'}</label>
<select name="server_id" id="server_id" class="selectInput">
- {tmpl_var name='server_id'}
- </select>
+ {tmpl_var name='server_id'}
+ </select>
+ </tmpl_if>
</div>
<div class="ctrlHolder">
<label for="client_group_id">{tmpl_var name='client_txt'}</label>
diff --git a/interface/web/mail/lib/lang/en_mail_get.lng b/interface/web/mail/lib/lang/en_mail_get.lng
index efb9628..85bf147 100644
--- a/interface/web/mail/lib/lang/en_mail_get.lng
+++ b/interface/web/mail/lib/lang/en_mail_get.lng
@@ -14,4 +14,5 @@
$wb["source_password_error_isempty"] = 'Password is empty.';
$wb["destination_error_isemail"] = 'No destination selected.';
$wb["source_server_error_regex"] = 'Pop3/Imap Server is not a valid domain name.';
+$wb["error_delete_read_all_combination"] = 'Illegal combination of options. You can not use "Delete emails after retrieval" = no together with "Retrieve all emails" = yes';
?>
\ No newline at end of file
diff --git a/interface/web/mail/mail_get_edit.php b/interface/web/mail/mail_get_edit.php
index 5bc512a..41434c0 100644
--- a/interface/web/mail/mail_get_edit.php
+++ b/interface/web/mail/mail_get_edit.php
@@ -85,11 +85,17 @@
}
} // end if user is not admin
+
// Set the server ID according to the selected destination
$tmp = $app->db->queryOneRecord("SELECT server_id FROM mail_user WHERE email = '".$app->db->quote($this->dataRecord["destination"])."'");
$this->dataRecord["server_id"] = $tmp["server_id"];
unset($tmp);
+ //* Check that no illegal combination of options is set
+ if((!isset($this->dataRecord['source_delete']) || @$this->dataRecord['source_delete'] == 'n') && $this->dataRecord['source_read_all'] == 'y') {
+ $app->tform->errorMessage .= $app->tform->lng('error_delete_read_all_combination')."<br>";
+ }
+
parent::onSubmit();
}
diff --git a/interface/web/sites/templates/web_aliasdomain_edit.htm b/interface/web/sites/templates/web_aliasdomain_edit.htm
index e4f5cd1..9d8cd9d 100644
--- a/interface/web/sites/templates/web_aliasdomain_edit.htm
+++ b/interface/web/sites/templates/web_aliasdomain_edit.htm
@@ -78,6 +78,7 @@
jQuery('#redirect_type option[value="R"]').hide();
jQuery('#redirect_type option[value="L"]').hide();
jQuery('#redirect_type option[value="R,L"]').hide();
+ jQuery('#redirect_type option[value="R=301,L"]').hide();
jQuery('#redirect_type option[value="last"]').show();
jQuery('#redirect_type option[value="break"]').show();
@@ -94,8 +95,9 @@
jQuery('#redirect_type option[value="R"]').show();
jQuery('#redirect_type option[value="L"]').show();
jQuery('#redirect_type option[value="R,L"]').show();
+ jQuery('#redirect_type option[value="R=301,L"]').show();
- if(selected != "no" && selected != "" && selected != "R" && selected != "L" && selected != "R,L") jQuery('#redirect_type option[value="no"]').attr('selected', 'selected');
+ if(selected != "no" && selected != "" && selected != "R" && selected != "L" && selected != "R,L" && selected != "R=301,L") jQuery('#redirect_type option[value="no"]').attr('selected', 'selected');
}
});
}
diff --git a/interface/web/sites/templates/web_domain_redirect.htm b/interface/web/sites/templates/web_domain_redirect.htm
index d3d8637..1c78b41 100644
--- a/interface/web/sites/templates/web_domain_redirect.htm
+++ b/interface/web/sites/templates/web_domain_redirect.htm
@@ -51,13 +51,14 @@
jQuery('#redirect_type option[value="R"]').hide();
jQuery('#redirect_type option[value="L"]').hide();
jQuery('#redirect_type option[value="R,L"]').hide();
+ jQuery('#redirect_type option[value="R=301,L"]').hide();
if(selected != "no" && selected != "" && selected != "last" && selected != "break" && selected != "redirect" && selected != "permanent") jQuery('#redirect_type option[value="no"]').attr('selected', 'selected');
} else {
jQuery('#redirect_type option[value="last"]').hide();
jQuery('#redirect_type option[value="break"]').hide();
jQuery('#redirect_type option[value="redirect"]').hide();
jQuery('#redirect_type option[value="permanent"]').hide();
- if(selected != "no" && selected != "" && selected != "R" && selected != "L" && selected != "R,L") jQuery('#redirect_type option[value="no"]').attr('selected', 'selected');
+ if(selected != "no" && selected != "" && selected != "R" && selected != "L" && selected != "R,L" && selected != "R=301,L") jQuery('#redirect_type option[value="no"]').attr('selected', 'selected');
}
});
}
diff --git a/interface/web/sites/templates/web_subdomain_edit.htm b/interface/web/sites/templates/web_subdomain_edit.htm
index f25cc6e..85f35c7 100644
--- a/interface/web/sites/templates/web_subdomain_edit.htm
+++ b/interface/web/sites/templates/web_subdomain_edit.htm
@@ -65,6 +65,7 @@
jQuery('#redirect_type option[value="R"]').hide();
jQuery('#redirect_type option[value="L"]').hide();
jQuery('#redirect_type option[value="R,L"]').hide();
+ jQuery('#redirect_type option[value="R=301,L"]').hide();
jQuery('#redirect_type option[value="last"]').show();
jQuery('#redirect_type option[value="break"]').show();
@@ -81,8 +82,9 @@
jQuery('#redirect_type option[value="R"]').show();
jQuery('#redirect_type option[value="L"]').show();
jQuery('#redirect_type option[value="R,L"]').show();
+ jQuery('#redirect_type option[value="R=301,L"]').show();
- if(selected != "no" && selected != "" && selected != "R" && selected != "L" && selected != "R,L") jQuery('#redirect_type option[value="no"]').attr('selected', 'selected');
+ if(selected != "no" && selected != "" && selected != "R" && selected != "L" && selected != "R,L" && selected != "R=301,L") jQuery('#redirect_type option[value="no"]').attr('selected', 'selected');
}
});
}
diff --git a/interface/web/sites/tools.inc.php b/interface/web/sites/tools.inc.php
index 11285e6..38e8804 100644
--- a/interface/web/sites/tools.inc.php
+++ b/interface/web/sites/tools.inc.php
@@ -55,9 +55,7 @@
function getClientName($dataRecord) {
global $app, $conf;
- /* FS#1234 - CLIENTNAME value when in reseller account - need check this workarround impact */
- //if($_SESSION["s"]["user"]["typ"] != 'admin' || $app->auth->has_clients($_SESSION['s']['user']['userid'])) {
- if($_SESSION["s"]["user"]["typ"] != 'admin' && ! $app->auth->has_clients($_SESSION['s']['user']['userid'])) {
+ if($_SESSION["s"]["user"]["typ"] != 'admin' || $app->auth->has_clients($_SESSION['s']['user']['userid'])) {
// Get the group-id of the user
$client_group_id = $_SESSION["s"]["user"]["default_group"];
} else {
diff --git a/interface/web/sites/web_domain_edit.php b/interface/web/sites/web_domain_edit.php
index 1664364..b6236bd 100644
--- a/interface/web/sites/web_domain_edit.php
+++ b/interface/web/sites/web_domain_edit.php
@@ -537,7 +537,7 @@
function onAfterUpdate() {
global $app, $conf;
- // make sure that the record belongs to the clinet group and not the admin group when a admin inserts it
+ // make sure that the record belongs to the client group and not the admin group when a admin inserts it
// also make sure that the user can not delete domain created by a admin
if($_SESSION["s"]["user"]["typ"] == 'admin' && isset($this->dataRecord["client_group_id"])) {
$client_group_id = intval($this->dataRecord["client_group_id"]);
diff --git a/remoting_client/examples/mail_forward_get.php b/remoting_client/examples/mail_forward_get.php
index e47d578..31c35ca 100644
--- a/remoting_client/examples/mail_forward_get.php
+++ b/remoting_client/examples/mail_forward_get.php
@@ -18,6 +18,7 @@
$forwarding_id = 1;
$mail_forwarding_record = $client->mail_forward_get($session_id, $forwarding_id);
+ // $mail_forwarding_record = $client->mail_forward_get($session_id, array('source' => '%@test.int'));
print_r($mail_forwarding_record);
diff --git a/remoting_client/examples/sites_database_add.php b/remoting_client/examples/sites_database_add.php
index 2d2ee33..0337dad 100644
--- a/remoting_client/examples/sites_database_add.php
+++ b/remoting_client/examples/sites_database_add.php
@@ -18,12 +18,12 @@
$client_id = 1;
$params = array(
'server_id' => 1,
- 'type' => 'y',
- 'database_name' => 'db_o',
- 'database_user' => 'test',
- 'database_password' => 'test',
+ 'type' => 'mysql',
+ 'database_name' => 'db_name1',
+ 'database_user' => 'db_name1',
+ 'database_password' => 'db_name1',
'database_charset' => 'UTF8',
- 'remote_access' => 'y',
+ 'remote_access' => 'n',
'remote_ips' => '',
'active' => 'y'
);
diff --git a/remoting_client/examples/soap_config.php b/remoting_client/examples/soap_config.php
index b3c282d..3487677 100644
--- a/remoting_client/examples/soap_config.php
+++ b/remoting_client/examples/soap_config.php
@@ -8,7 +8,7 @@
$soap_uri = 'http://localhost:8080/ispconfig3/interface/web/remote/';
*/
-$soap_location = 'http://192.168.0.110:8080/remote/index.php';
-$soap_uri = 'http://192.168.0.110:8080/remote/';
+$soap_location = 'http://192.168.0.105:8080/remote/index.php';
+$soap_uri = 'http://192.168.0.105:8080/remote/';
?>
diff --git a/server/conf/awstats_index.php.master b/server/conf/awstats_index.php.master
index f3867d3..f7222c9 100644
--- a/server/conf/awstats_index.php.master
+++ b/server/conf/awstats_index.php.master
@@ -32,9 +32,12 @@
}
$current = $year.$month;
- $awprev[$current] = $year."-".$month;
+ if ( $month < 10 ) {
+ $current = $year."0".$month;
+ }
+ $awprev[$current] = $year."-".$month;
- closedir($handle);
+ closedir($handle);
}
arsort($awprev);
diff --git a/server/conf/vhost.conf.master b/server/conf/vhost.conf.master
index 11bc4bc..1d29d07 100644
--- a/server/conf/vhost.conf.master
+++ b/server/conf/vhost.conf.master
@@ -26,7 +26,7 @@
ErrorLog /var/log/ispconfig/httpd/<tmpl_var name='domain'>/error.log
<tmpl_if name='errordocs'>
-
+ Alias /error/ "<tmpl_var name='web_document_root_www'>/error/"
ErrorDocument 400 /error/400.html
ErrorDocument 401 /error/401.html
ErrorDocument 403 /error/403.html
diff --git a/server/cron_daily.php b/server/cron_daily.php
index 3f86a26..67d9945 100644
--- a/server/cron_daily.php
+++ b/server/cron_daily.php
@@ -180,7 +180,7 @@
if(is_file($awstats_website_conf_file)) unlink($awstats_website_conf_file);
- $sql = "SELECT domain FROM web_domain WHERE (type = 'alias' OR type = 'subdomain') server_id = ".$conf['server_id'];
+ $sql = "SELECT domain FROM web_domain WHERE (type = 'alias' OR type = 'subdomain') AND server_id = ".$conf['server_id'];
$aliases = $app->db->queryAllRecords($sql);
$aliasdomain = '';
diff --git a/server/lib/classes/system.inc.php b/server/lib/classes/system.inc.php
index 5de2f81..7537ef4 100644
--- a/server/lib/classes/system.inc.php
+++ b/server/lib/classes/system.inc.php
@@ -1253,6 +1253,24 @@
$app->log('Created Maildir '.$maildir_path.' with subfolder: '.$subfolder,LOGLEVEL_DEBUG);
}
+
+ //* Function to create directory paths and chown them to a user and group
+ function mkdirpath($path, $mode = 0755, $user = '', $group = '') {
+ $path_parts = explode('/',$path);
+ $new_path = '';
+ if(is_array($path_parts)) {
+ foreach($path_parts as $part) {
+ $new_path .= '/'.$part;
+ if(!@is_dir($new_path)) {
+ mkdir($new_path);
+ chmod($new_path,$mode);
+ if($user != '') chown($new_path,$user);
+ if($group != '') chgrp($new_path,$group);
+ }
+ }
+ }
+
+ }
}
?>
diff --git a/server/plugins-available/apache2_plugin.inc.php b/server/plugins-available/apache2_plugin.inc.php
index 935fc9e..66940a5 100644
--- a/server/plugins-available/apache2_plugin.inc.php
+++ b/server/plugins-available/apache2_plugin.inc.php
@@ -363,7 +363,13 @@
unset($tmp_docroot[count($tmp_docroot)-1]);
$old_dir = implode('/',$tmp_docroot);
- exec('rm -rf '.$data['new']['document_root']);
+ //* Check if there is already some data in the new docroot and rename it as we need a clean path to move the existing site to the new path
+ if(@is_dir($data['new']['document_root'])) {
+ rename($data['new']['document_root'],$data['new']['document_root'].'_bak_'.date('Y_m_d'));
+ $app->log('Renaming existing directory in new docroot location. mv '.$data['new']['document_root'].' '.$data['new']['document_root'].'_bak_'.date('Y_m_d'),LOGLEVEL_DEBUG);
+ }
+
+ //* Create new base directory, if it does not exist yet
if(!is_dir($new_dir)) exec('mkdir -p '.$new_dir);
exec('mv '.$data['old']['document_root'].' '.$new_dir);
$app->log('Moving site to new document root: mv '.$data['old']['document_root'].' '.$new_dir,LOGLEVEL_DEBUG);
diff --git a/server/plugins-available/bind_plugin.inc.php b/server/plugins-available/bind_plugin.inc.php
index e5a7120..bb98f36 100644
--- a/server/plugins-available/bind_plugin.inc.php
+++ b/server/plugins-available/bind_plugin.inc.php
@@ -208,6 +208,16 @@
if(is_file($filename)) unset($filename);
}
+ //* Ensure that the named slave directory is writable by the named user
+ if (file_exists('/etc/gentoo-release')) {
+ $slave_record_dir = $dns_config['bind_zonefiles_dir'].'/sec';
+ } else {
+ $slave_record_dir = $dns_config['bind_zonefiles_dir'].'/slave';
+ }
+ if(!@is_dir($slave_record_dir)) mkdir($slave_record_dir,0770);
+ chown($slave_record_dir,$dns_config['bind_user']);
+ chgrp($slave_record_dir,$dns_config['bind_group']);
+
//* Reload bind nameserver
$app->services->restartServiceDelayed('bind','reload');
diff --git a/server/plugins-available/mail_plugin.inc.php b/server/plugins-available/mail_plugin.inc.php
index 6781fb6..4c6912f 100644
--- a/server/plugins-available/mail_plugin.inc.php
+++ b/server/plugins-available/mail_plugin.inc.php
@@ -91,18 +91,18 @@
$tmp_basepath_parts = explode('/',$tmp_basepath);
unset($tmp_basepath_parts[count($tmp_basepath_parts)-1]);
$base_path = implode('/',$tmp_basepath_parts);
-
-
//* Create the mail domain directory, if it does not exist
if(!empty($base_path) && !is_dir($base_path)) {
- exec("su -c 'mkdir -p ".escapeshellcmd($base_path)."' ".$mail_config['mailuser_name']);
+ //exec("su -c 'mkdir -p ".escapeshellcmd($base_path)."' ".$mail_config['mailuser_name']);
+ $app->system->mkdirpath($base_path, 0700, $mail_config['mailuser_name'], $mail_config['mailuser_group']);
$app->log('Created Directory: '.$base_path,LOGLEVEL_DEBUG);
}
// Dovecot uses a different mail layout with a separate 'Maildir' subdirectory.
if($mail_config['pop3_imap_daemon'] == 'dovecot') {
- exec("su -c 'mkdir -p ".escapeshellcmd($maildomain_path)."' ".$mail_config['mailuser_name']);
+ //exec("su -c 'mkdir -p ".escapeshellcmd($maildomain_path)."' ".$mail_config['mailuser_name']);
+ $app->system->mkdirpath($maildomain_path, 0700, $mail_config['mailuser_name'], $mail_config['mailuser_group']);
$app->log('Created Directory: '.$maildomain_path,LOGLEVEL_DEBUG);
$maildomain_path .= '/Maildir';
}
@@ -160,24 +160,30 @@
//* Send the welcome email message
if(file_exists($conf['rootpath'].'/conf-custom/mail/welcome_email_'.$conf['language'].'.txt')) {
- $tmp = file($conf['rootpath'].'/conf-custom/mail/welcome_email_'.$conf['language'].'.txt');
+ $lines = file($conf['rootpath'].'/conf-custom/mail/welcome_email_'.$conf['language'].'.txt');
} elseif(file_exists($conf['rootpath'].'/conf-custom/mail/welcome_email_en.txt')) {
- $tmp = file($conf['rootpath'].'/conf-custom/mail/welcome_email_en.txt');
+ $lines = file($conf['rootpath'].'/conf-custom/mail/welcome_email_en.txt');
} elseif(file_exists($conf['rootpath'].'/conf/mail/welcome_email_'.$conf['language'].'.txt')) {
- $tmp = file($conf['rootpath'].'/conf/mail/welcome_email_'.$conf['language'].'.txt');
+ $lines = file($conf['rootpath'].'/conf/mail/welcome_email_'.$conf['language'].'.txt');
} else {
- $tmp = file($conf['rootpath'].'/conf/mail/welcome_email_en.txt');
+ $lines = file($conf['rootpath'].'/conf/mail/welcome_email_en.txt');
}
- $welcome_mail_from = trim(substr($tmp[0],5));
- $welcome_mail_subject = trim(substr($tmp[1],8));
- unset($tmp[0]);
- unset($tmp[1]);
- $welcome_mail_message = trim(implode($tmp));
- unset($tmp);
+ //* Get from address
+ $parts = explode(':',trim($lines[0]));
+ unset($parts[0]);
+ $welcome_mail_from = implode(':',$parts);
+ unset($lines[0]);
- $welcomeFromEmail = $mail_config['admin_mail'];
- $welcomeFromName = $mail_config['admin_name'];
+ //* Get subject
+ $parts = explode(':',trim($lines[1]));
+ unset($parts[0]);
+ $welcome_mail_subject = implode(':',$parts);
+ unset($lines[1]);
+
+ //* Get message
+ $welcome_mail_message = trim(implode($lines));
+ unset($tmp);
$mailHeaders = "MIME-Version: 1.0" . "\n";
$mailHeaders .= "Content-type: text/plain; charset=utf-8" . "\n";
@@ -185,11 +191,9 @@
$mailHeaders .= "From: $welcome_mail_from" . "\n";
$mailHeaders .= "Reply-To: $welcome_mail_from" . "\n";
$mailTarget = $data["new"]["email"];
- // $mailSubject = "=?utf-8?Q?" . imap_8bit($welcome_mail_subject) . "?=";
$mailSubject = "=?utf-8?B?".base64_encode($welcome_mail_subject)."?=";
mail($mailTarget, $mailSubject, $welcome_mail_message, $mailHeaders);
-
}
@@ -221,13 +225,14 @@
//* Create the mail domain directory, if it does not exist
if(!empty($base_path) && !is_dir($base_path)) {
- exec("su -c 'mkdir -p ".escapeshellcmd($base_path)."' ".$mail_config['mailuser_name']);
+ //exec("su -c 'mkdir -p ".escapeshellcmd($base_path)."' ".$mail_config['mailuser_name']);
+ $app->system->mkdirpath($base_path, 0700, $mail_config['mailuser_name'], $mail_config['mailuser_group']);
$app->log('Created Directory: '.$base_path,LOGLEVEL_DEBUG);
}
// Dovecot uses a different mail layout with a separate 'Maildir' subdirectory.
if($mail_config['pop3_imap_daemon'] == 'dovecot') {
- exec("su -c 'mkdir -p ".escapeshellcmd($maildomain_path)."' ".$mail_config['mailuser_name']);
+ $app->system->mkdirpath($maildomain_path, 0700, $mail_config['mailuser_name'], $mail_config['mailuser_group']);
$app->log('Created Directory: '.$base_path,LOGLEVEL_DEBUG);
$maildomain_path .= '/Maildir';
}
diff --git a/server/plugins-available/mailman_plugin.inc.php b/server/plugins-available/mailman_plugin.inc.php
index fd2fa7a..ac36070 100644
--- a/server/plugins-available/mailman_plugin.inc.php
+++ b/server/plugins-available/mailman_plugin.inc.php
@@ -113,7 +113,11 @@
$server_config = $app->getconf->get_server_config($conf['server_id'], 'server');
// load files
- $content = file_get_contents($conf["rootpath"]."/conf/mm_cfg.py.master");
+ if(file_exists($conf["rootpath"]."/conf/mm_cfg.py.master")) {
+ $content = file_get_contents($conf["rootpath"]."/conf-custom/mm_cfg.py.master");
+ } else {
+ $content = file_get_contents($conf["rootpath"]."/conf/mm_cfg.py.master");
+ }
$old_file = file_get_contents($this->mailman_config_dir."/mm_cfg.py");
$old_options = array();
diff --git a/server/plugins-available/nginx_plugin.inc.php b/server/plugins-available/nginx_plugin.inc.php
index 79fa68d..149a4d1 100644
--- a/server/plugins-available/nginx_plugin.inc.php
+++ b/server/plugins-available/nginx_plugin.inc.php
@@ -41,7 +41,7 @@
function onInstall() {
global $conf;
- if($conf['services']['web'] == true) {
+ if($conf['services']['web'] == true && !@is_link('/usr/local/ispconfig/server/plugins-enabled/apache2_plugin.inc.php')) {
return true;
} else {
return false;
@@ -256,7 +256,13 @@
function update($event_name,$data) {
global $app, $conf;
-
+
+ //* Check if the apache plugin is enabled
+ if(@is_link('/usr/local/ispconfig/server/plugins-enabled/apache2_plugin.inc.php')) {
+ $app->log('The nginx plugin can not be used together with the apache2 plugin..',LOGLEVEL_WARN);
+ return 0;
+ }
+
if($this->action != 'insert') $this->action = 'update';
if($data['new']['type'] != 'vhost' && $data['new']['parent_domain_id'] > 0) {
@@ -333,8 +339,14 @@
$tmp_docroot = explode('/',$data['old']['document_root']);
unset($tmp_docroot[count($tmp_docroot)-1]);
$old_dir = implode('/',$tmp_docroot);
-
- exec('rm -rf '.$data['new']['document_root']);
+
+ //* Check if there is already some data in the new docroot and rename it as we need a clean path to move the existing site to the new path
+ if(@is_dir($data['new']['document_root'])) {
+ rename($data['new']['document_root'],$data['new']['document_root'].'_bak_'.date('Y_m_d'));
+ $app->log('Renaming existing directory in new docroot location. mv '.$data['new']['document_root'].' '.$data['new']['document_root'].'_bak_'.date('Y_m_d'),LOGLEVEL_DEBUG);
+ }
+
+ //* Create new base directory, if it does not exist yet
if(!is_dir($new_dir)) exec('mkdir -p '.$new_dir);
exec('mv '.$data['old']['document_root'].' '.$new_dir);
$app->log('Moving site to new document root: mv '.$data['old']['document_root'].' '.$new_dir,LOGLEVEL_DEBUG);
--
Gitblit v1.9.1