Commit ee45b993 authored by Marius Burkard's avatar Marius Burkard
Browse files

Merge branch 'develop' into 'develop'

allow custom rspamd url (Implements #6010) use idn_decode for mailuser and login fails for mail-users with IDN domains (Fixes #6021) wrong server-id in admin/server_config_edit.php (Fixes #6022)

Closes #6022, #6021, and #6010

See merge request ispconfig/ispconfig3!1386
parents 3118c93b bd660233
......@@ -146,7 +146,6 @@ include_once 'dist/conf/'.$dist['confid'].'.conf.php';
//** Installer Interface
//****************************************************************************************************
$inst = new installer();
if (!$inst->get_php_version()) die('ISPConfig requires PHP '.$inst->min_php."\n");
$retval=shell_exec("which which");
if (empty($retval)) die ("ISPConfig requires which \n");
......
......@@ -35,7 +35,6 @@ class installer_base {
var $db;
public $install_ispconfig_interface = true;
public $is_update = false; // true if it is an update, false if it is a new install
public $min_php = '5.4'; // minimal php-version for update / install
protected $mailman_group = 'list';
......@@ -160,12 +159,6 @@ class installer_base {
}
}
//** Detect PHP-Version
public function get_php_version() {
if(version_compare(PHP_VERSION, $this->min_php, '<')) return false;
else return true;
}
public function crypt_password($cleartext_password, $charset = 'UTF-8') {
if($charset != 'UTF-8') {
$cleartext_password = mb_convert_encoding($cleartext_password, $charset, 'UTF-8');
......
......@@ -59,6 +59,7 @@ overquota_notify_client=y
overquota_notify_freq=7
overquota_notify_onok=n
sendmail_path=/usr/sbin/sendmail
rspamd_url=
[getmail]
getmail_config_dir=/etc/getmail
......
......@@ -185,7 +185,6 @@ $conf['server_id'] = intval($conf_old["server_id"]);
$conf['ispconfig_log_priority'] = $conf_old["log_priority"];
$inst = new installer();
if (!$inst->get_php_version()) die('ISPConfig requieres PHP '.$inst->min_php."\n");
$inst->is_update = true;
$inst->check_prerequisites();
......
......@@ -717,6 +717,18 @@ $form["tabs"]['mail'] = array(
'default' => 'n',
'value' => array(0 => 'n', 1 => 'y')
),
'rspamd_url' => array(
'datatype' => 'VARCHAR',
'formtype' => 'TEXT',
'default' => '',
'filters' => array(
0 => array( 'event' => 'SAVE', 'type' => 'IDNTOASCII'),
1 => array( 'event' => 'SHOW', 'type' => 'IDNTOUTF8')
),
'value' => '',
'width' => '40',
'maxlength' => '255'
),
//#################################
// END Datatable fields
//#################################
......
......@@ -57,7 +57,7 @@ class page_action extends tform_actions {
// get the config
$app->uses('getconf');
$web_config = $app->getconf->get_server_config($conf['server_id'], 'web');
$web_config = $app->getconf->get_server_config($this->id, 'web');
if($web_config['server_type'] == 'nginx'){
unset($app->tform->formDef["tabs"]["fastcgi"]);
......@@ -90,8 +90,12 @@ class page_action extends tform_actions {
$this->dataRecord = $app->getconf->get_server_config($server_id, $section);
if($section == 'mail'){
$server_config = $app->getconf->get_server_config($server_id, 'server');
$rspamd_url = 'https://'.$server_config['hostname'].':8081/rspamd/';
if(trim($this->dataRecord['rspamd_url'] == '')) {
$server_config = $app->getconf->get_server_config($server_id, 'server');
$rspamd_url = 'https://'.$server_config['hostname'].':8081/rspamd/';
} else {
$rspamd_url = $this->dataRecord['rspamd_url'];
}
}
}
......
......@@ -49,7 +49,13 @@
</div>
<div class="form-group rspamd">
<label for="rspamd_url" class="col-sm-3 control-label col-text">{tmpl_var name='rspamd_url_txt'}</label>
<div class="col-sm-6"><a href="{tmpl_var name='rspamd_url'}" target="_blank">{tmpl_var name='rspamd_url'}</a><a href="{tmpl_var name='rspamd_url'}" target="_blank" class="btn btn-default formbutton-default formbutton-narrow" style="margin-left:20px"><span class="icon icon-link"></span></a></div>
<div class="col-sm-8"><div class="input-group">
<input type="text" name="rspamd_url" id="rspamd_url" value="{tmpl_var name='rspamd_url'}" class="form-control" />
<span class="input-group-btn">
<a href="{tmpl_var name='rspamd_url'}" target="_blank" class="btn btn-default formbutton-default formbutton-narrow" style="margin-left:20px"><span class="icon icon-link"></span></a>
</span>
</div></div>
</div>
</div>
<div class="form-group rspamd">
<label for="rspamd_password" class="col-sm-3 control-label">{tmpl_var name='rspamd_password_txt'}</label>
......
......@@ -58,7 +58,7 @@ if($app->is_under_maintenance()) {
if(count($_POST) > 0) {
//** Check variables
if(!preg_match("/^[\w\.\-\_\@]{1,128}$/", $_POST['username'])) $error = $app->lng('user_regex_error');
if(!preg_match("/^[\w\.\-\_\@]{1,128}$/", $app->functions->idn_encode($_POST['username']))) $error = $app->lng('user_regex_error');
if(!preg_match("/^.{1,256}$/i", $_POST['password'])) $error = $app->lng('pw_error_length');
//** importing variables
......@@ -152,7 +152,7 @@ if(count($_POST) > 0) {
if(stristr($username, '@')) {
//* mailuser login
$sql = "SELECT * FROM mail_user WHERE login = ? or email = ?";
$mailuser = $app->db->queryOneRecord($sql, $username, $username);
$mailuser = $app->db->queryOneRecord($sql, $username, $app->functions->idn_encode($username));
$user = false;
if($mailuser) {
$saved_password = stripslashes($mailuser['password']);
......
......@@ -28,8 +28,10 @@ if($rec['quota'] == 0) {
if($rec['cc'] == '') $rec['cc'] = $wb['none_txt'];
$app->tpl->setVar($rec);
$rec['email'] = $app->functions->idn_decode($rec['email']);
$rec['login'] = $app->functions->idn_decode($rec['login']);
$app->tpl->setVar($rec);
$sql2 = "SELECT * FROM server WHERE server_id = ?";
$rec2 = $app->db->queryOneRecord($sql2, $rec['server_id']);
......
......@@ -75,7 +75,7 @@ class page_action extends tform_actions {
global $app, $conf;
$rec = $app->tform->getDataRecord($this->id);
$app->tpl->setVar("email", $rec['email'], true);
$app->tpl->setVar("email", $app->functions->idn_decode($rec['email']), true);
parent::onShowEnd();
}
......
......@@ -63,7 +63,7 @@ class page_action extends tform_actions {
global $app, $conf;
$rec = $app->tform->getDataRecord($_SESSION['s']['user']['mailuser_id']);
$app->tpl->setVar("email", $rec['email'], true);
$app->tpl->setVar("email", $app->functions->idn_decode($rec['email']), true);
parent::onShowEnd();
}
......
......@@ -112,7 +112,7 @@ class page_action extends tform_actions {
global $app, $conf;
$rec = $app->tform->getDataRecord($this->id);
$app->tpl->setVar("email", $rec['email'], true);
$app->tpl->setVar("email", $app->functions->idn_decode($rec['email']), true);
// Get the spamfilter policys for the user
$tmp_user = $app->db->queryOneRecord("SELECT policy_id FROM spamfilter_users WHERE email = ?", $rec['email']);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment