...
 
Commits (20)
......@@ -1253,11 +1253,11 @@ class installer_dist extends installer_base {
$content = str_replace('{vhost_port}', $conf['nginx']['vhost_port'], $content);
if(is_file($install_dir.'/interface/ssl/ispserver.crt') && is_file($install_dir.'/interface/ssl/ispserver.key')) {
$content = str_replace('{ssl_on}', ' on', $content);
$content = str_replace('{ssl_on}', 'ssl', $content);
$content = str_replace('{ssl_comment}', '', $content);
$content = str_replace('{fastcgi_ssl}', 'on', $content);
} else {
$content = str_replace('{ssl_on}', ' off', $content);
$content = str_replace('{ssl_on}', '', $content);
$content = str_replace('{ssl_comment}', '#', $content);
$content = str_replace('{fastcgi_ssl}', 'off', $content);
}
......
......@@ -785,7 +785,7 @@ class installer extends installer_base
$content = str_replace('{cgi_socket}', $cgi_socket, $content);
// SSL in apps vhost is off by default. Might change later.
$content = str_replace('{ssl_on}', 'off', $content);
$content = str_replace('{ssl_on}', 'ssl', $content);
$content = str_replace('{ssl_comment}', '#', $content);
wf($vhost_conf_dir.'/apps.vhost', $content);
......@@ -1139,11 +1139,11 @@ class installer extends installer_base
$content = str_replace('{vhost_port}', $conf['nginx']['vhost_port'], $content);
if(is_file($install_dir.'/interface/ssl/ispserver.crt') && is_file($install_dir.'/interface/ssl/ispserver.key')) {
$content = str_replace('{ssl_on}', ' on', $content);
$content = str_replace('{ssl_on}', 'ssl', $content);
$content = str_replace('{ssl_comment}', '', $content);
$content = str_replace('{fastcgi_ssl}', 'on', $content);
} else {
$content = str_replace('{ssl_on}', ' off', $content);
$content = str_replace('{ssl_on}', '', $content);
$content = str_replace('{ssl_comment}', '#', $content);
$content = str_replace('{fastcgi_ssl}', 'off', $content);
}
......
......@@ -1264,11 +1264,11 @@ class installer_dist extends installer_base {
$content = str_replace('{vhost_port}', $conf['nginx']['vhost_port'], $content);
if(is_file($install_dir.'/interface/ssl/ispserver.crt') && is_file($install_dir.'/interface/ssl/ispserver.key')) {
$content = str_replace('{ssl_on}', ' on', $content);
$content = str_replace('{ssl_on}', 'ssl', $content);
$content = str_replace('{ssl_comment}', '', $content);
$content = str_replace('{fastcgi_ssl}', 'on', $content);
} else {
$content = str_replace('{ssl_on}', ' off', $content);
$content = str_replace('{ssl_on}', '', $content);
$content = str_replace('{ssl_comment}', '#', $content);
$content = str_replace('{fastcgi_ssl}', 'off', $content);
}
......
......@@ -2047,8 +2047,8 @@ class installer_base {
//copy('tpl/apache_ispconfig.vhost.master', "$vhost_conf_dir/ispconfig.vhost");
//* and create the symlink
if(@is_link($vhost_conf_enabled_dir.'/apps.vhost')) unlink($vhost_conf_enabled_dir.'/apps.vhost');
if(!@is_link($vhost_conf_enabled_dir.'/000-apps.vhost')) {
symlink($vhost_conf_dir.'/apps.vhost', $vhost_conf_enabled_dir.'/000-apps.vhost');
if(!@is_link($vhost_conf_enabled_dir.'/000-apps.vhost') && @is_file($vhost_conf_dir.'/apps.vhost')) {
@symlink($vhost_conf_dir.'/apps.vhost', $vhost_conf_enabled_dir.'/000-apps.vhost');
}
if(!is_file($conf['web']['website_basedir'].'/php-fcgi-scripts/apps/.php-fcgi-starter')) {
......@@ -2131,7 +2131,7 @@ class installer_base {
$content = str_replace('{use_socket}', $use_socket, $content);
// SSL in apps vhost is off by default. Might change later.
$content = str_replace('{ssl_on}', 'off', $content);
$content = str_replace('{ssl_on}', '', $content);
$content = str_replace('{ssl_comment}', '#', $content);
// Fix socket path on PHP 7 systems
......@@ -2564,11 +2564,11 @@ class installer_base {
$content = str_replace('{vhost_port}', $conf['nginx']['vhost_port'], $content);
if(is_file($install_dir.'/interface/ssl/ispserver.crt') && is_file($install_dir.'/interface/ssl/ispserver.key')) {
$content = str_replace('{ssl_on}', 'on', $content);
$content = str_replace('{ssl_on}', 'ssl', $content);
$content = str_replace('{ssl_comment}', '', $content);
$content = str_replace('{fastcgi_ssl}', 'on', $content);
} else {
$content = str_replace('{ssl_on}', 'off', $content);
$content = str_replace('{ssl_on}', '', $content);
$content = str_replace('{ssl_comment}', '#', $content);
$content = str_replace('{fastcgi_ssl}', 'off', $content);
}
......
......@@ -78,3 +78,6 @@ INSERT IGNORE INTO `dns_ssl_ca` (`id`, `sys_userid`, `sys_groupid`, `sys_perm_us
(NULL, 1, 1, 'riud', 'riud', '', 'Y', 'WISeKey', 'wisekey.com', 'Y', '', 0),
(NULL, 1, 1, 'riud', 'riud', '', 'Y', 'WoSign', 'wosign.com', 'Y', '', 0);
ALTER TABLE `dns_soa` CHANGE `xfer` `xfer` TEXT NOT NULL DEFAULT '';
ALTER TABLE `dns_soa` CHANGE `also_notify` `also_notify` TEXT NOT NULL DEFAULT '';
ALTER TABLE `dns_slave` CHANGE `xfer` `xfer` TEXT NOT NULL DEFAULT '';
\ No newline at end of file
......@@ -516,7 +516,7 @@ CREATE TABLE `dns_slave` (
`origin` varchar(255) NOT NULL DEFAULT '',
`ns` varchar(255) NOT NULL DEFAULT '',
`active` enum('N','Y') NOT NULL DEFAULT 'N',
`xfer` varchar(255) NOT NULL DEFAULT '',
`xfer` TEXT NOT NULL DEFAULT '',
PRIMARY KEY (`id`),
UNIQUE KEY `slave` (`origin`,`server_id`),
KEY `active` (`active`)
......@@ -620,8 +620,8 @@ CREATE TABLE `dns_soa` (
`minimum` int(11) unsigned NOT NULL default '3600',
`ttl` int(11) unsigned NOT NULL default '3600',
`active` enum('N','Y') NOT NULL DEFAULT 'N',
`xfer` varchar(255) NOT NULL DEFAULT '',
`also_notify` varchar(255) default NULL,
`xfer` TEXT NOT NULL DEFAULT '',
`also_notify` TEXT NOT NULL DEFAULT '',
`update_acl` varchar(255) default NULL,
`dnssec_initialized` ENUM('Y','N') NOT NULL DEFAULT 'N',
`dnssec_wanted` ENUM('Y','N') NOT NULL DEFAULT 'N',
......
server {
listen {apps_vhost_port};
listen [::]:{apps_vhost_port} ipv6only=on;
ssl {ssl_on};
listen {apps_vhost_port} {ssl_on};
listen [::]:{apps_vhost_port} {ssl_on} ipv6only=on;
{ssl_comment}ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
{ssl_comment}ssl_certificate /usr/local/ispconfig/interface/ssl/ispserver.crt;
{ssl_comment}ssl_certificate_key /usr/local/ispconfig/interface/ssl/ispserver.key;
......
server {
listen {vhost_port};
listen [::]:{vhost_port} ipv6only=on;
ssl {ssl_on};
listen {vhost_port} {ssl_on};
listen [::]:{vhost_port} {ssl_on} ipv6only=on;
{ssl_comment}ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
{ssl_comment}ssl_certificate /usr/local/ispconfig/interface/ssl/ispserver.crt;
{ssl_comment}ssl_certificate_key /usr/local/ispconfig/interface/ssl/ispserver.key;
......
......@@ -88,6 +88,7 @@ class app {
public function initialize_session() {
//* Start the session
if($this->_conf['start_session'] == true) {
session_name('ISPCSESS');
$this->uses('session');
$sess_timeout = $this->conf('interface', 'session_timeout');
$cookie_domain = $this->get_cookie_domain();
......
......@@ -249,6 +249,15 @@ class ApsGUIController extends ApsBase
$settings['main_database_host'] = 'localhost';
$mysql_db_remote_access = 'n';
$mysql_db_remote_ips = '';
// If we are dealing with chrooted PHP-FPM, use a network connection instead because the MySQL socket file
// does not exist within the chroot.
$php_fpm_chroot = $app->db->queryOneRecord("SELECT php_fpm_chroot FROM web_domain WHERE domain_id = ?", $websrv['domain_id']);
if ($php_fpm_chroot['php_fpm_chroot'] === 'y') {
$settings['main_database_host'] = '127.0.0.1';
$mysql_db_remote_access = 'y';
$mysql_db_remote_ips = '127.0.0.1';
}
} else {
//* get the default database server of the client
$client = $app->db->queryOneRecord("SELECT default_dbserver FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = ?", $websrv['sys_groupid']);
......@@ -558,6 +567,16 @@ class ApsGUIController extends ApsBase
}
else $error[] = $app->lng('error_main_domain');
if(isset($postinput['admin_password']))
{
$app->uses('validate_password');
$passwordError = $app->validate_password->password_check('', $postinput['admin_password'], '');
if ($passwordError) {
$error[] = $passwordError;
}
}
// Main location (not obligatory but must be supplied)
if(isset($postinput['main_location']))
{
......
......@@ -26,6 +26,8 @@ class mail_mail_domain_plugin {
*/
function mail_mail_domain_edit($event_name, $page_form) {
global $app, $conf;
$domain = $app->functions->idn_encode($page_form->dataRecord['domain']);
// make sure that the record belongs to the client group and not the admin group when a dmin inserts it
// also make sure that the user can not delete entry created by an admin
......@@ -57,7 +59,7 @@ class mail_mail_domain_plugin {
}
//** If the domain name or owner has been changed, change the domain and owner in all mailbox records
if($page_form->oldDataRecord && ($page_form->oldDataRecord['domain'] != $page_form->dataRecord['domain'] ||
if($page_form->oldDataRecord && ($page_form->oldDataRecord['domain'] != $domain ||
(isset($page_form->dataRecord['client_group_id']) && $page_form->oldDataRecord['sys_groupid'] != $page_form->dataRecord['client_group_id']))) {
$app->uses('getconf');
$mail_config = $app->getconf->get_server_config($page_form->dataRecord["server_id"], 'mail');
......@@ -71,9 +73,9 @@ class mail_mail_domain_plugin {
foreach($mailusers as $rec) {
// setting Maildir, Homedir, UID and GID
$mail_parts = explode("@", $rec['email']);
$maildir = str_replace("[domain]", $page_form->dataRecord['domain'], $mail_config["maildir_path"]);
$maildir = str_replace("[domain]", $domain, $mail_config["maildir_path"]);
$maildir = str_replace("[localpart]", $mail_parts[0], $maildir);
$email = $mail_parts[0].'@'.$page_form->dataRecord['domain'];
$email = $mail_parts[0].'@'.$domain;
$app->db->datalogUpdate('mail_user', array("maildir" => $maildir, "email" => $email, "sys_userid" => $client_user_id, "sys_groupid" => $sys_groupid), 'mailuser_id', $rec['mailuser_id']);
}
}
......@@ -82,8 +84,8 @@ class mail_mail_domain_plugin {
$forwardings = $app->db->queryAllRecords("SELECT * FROM mail_forwarding WHERE source LIKE ? OR destination LIKE ?", "%@" . $page_form->oldDataRecord['domain'], "%@" . $page_form->oldDataRecord['domain']);
if(is_array($forwardings)) {
foreach($forwardings as $rec) {
$destination = str_replace($page_form->oldDataRecord['domain'], $page_form->dataRecord['domain'], $rec['destination']);
$source = str_replace($page_form->oldDataRecord['domain'], $page_form->dataRecord['domain'], $rec['source']);
$destination = str_replace($page_form->oldDataRecord['domain'], $domain, $rec['destination']);
$source = str_replace($page_form->oldDataRecord['domain'], $domain, $rec['source']);
$app->db->datalogUpdate('mail_forwarding', array("source" => $source, "destination" => $destination, "sys_userid" => $client_user_id, "sys_groupid" => $sys_groupid), 'forwarding_id', $rec['forwarding_id']);
}
}
......@@ -100,18 +102,18 @@ class mail_mail_domain_plugin {
$mail_gets = $app->db->queryAllRecords("SELECT mailget_id, destination FROM mail_get WHERE destination LIKE ?", "%@" . $page_form->oldDataRecord['domain']);
if(is_array($mail_gets)) {
foreach($mail_gets as $rec) {
$destination = str_replace($page_form->oldDataRecord['domain'], $page_form->dataRecord['domain'], $rec['destination']);
$destination = str_replace($page_form->oldDataRecord['domain'], $domain, $rec['destination']);
$app->db->datalogUpdate('mail_get', array("destination" => $destination, "sys_userid" => $client_user_id, "sys_groupid" => $sys_groupid), 'mailget_id', $rec['mailget_id']);
}
}
if ($page_form->oldDataRecord["domain"] != $page_form->dataRecord['domain']) {
if ($page_form->oldDataRecord["domain"] != $domain) {
//* Delete the old spamfilter record
$tmp = $app->db->queryOneRecord("SELECT id FROM spamfilter_users WHERE email = ?", "@" . $page_form->oldDataRecord["domain"]);
$app->db->datalogDelete('spamfilter_users', 'id', $tmp["id"]);
unset($tmp);
}
$app->db->query("UPDATE spamfilter_users SET email=REPLACE(email, ?, ?), sys_userid = ?, sys_groupid = ? WHERE email LIKE ?", $page_form->oldDataRecord['domain'], $page_form->dataRecord['domain'], $client_user_id, $sys_groupid, "%@" . $page_form->oldDataRecord['domain']);
$app->db->query("UPDATE spamfilter_users SET email=REPLACE(email, ?, ?), sys_userid = ?, sys_groupid = ? WHERE email LIKE ?", $page_form->oldDataRecord['domain'], $domain, $client_user_id, $sys_groupid, "%@" . $page_form->oldDataRecord['domain']);
} // end if domain name changed
}
......
......@@ -83,8 +83,10 @@ class page_action extends tform_actions {
function onShowEnd() {
global $app;
$app->tpl->setVar('server_name', $app->functions->htmlentities($app->db->queryOneRecord("SELECT server_name FROM server WHERE server_id = ? AND ((SELECT COUNT(*) FROM server) > 1)", $this->id)['server_name']));
$tmp = $app->db->queryOneRecord("SELECT server_name FROM server WHERE server_id = ? AND ((SELECT COUNT(*) FROM server) > 1)", $this->id);
$app->tpl->setVar('server_name', $app->functions->htmlentities($tmp['server_name']));
unset($tmp);
parent::onShowEnd();
}
......
......@@ -3,4 +3,5 @@ $wb['name_txt'] = 'Name';
$wb['fields_txt'] = 'Fields';
$wb['template_txt'] = 'Template';
$wb['visible_txt'] = 'Visible';
$wb['placeholder_txt'] = 'Placeholder';
?>
......@@ -3,4 +3,5 @@ $wb['name_txt'] = 'Име';
$wb['fields_txt'] = 'Полета';
$wb['template_txt'] = 'Шаблон';
$wb['visible_txt'] = 'Видим';
$wb['placeholder_txt'] = 'Placeholder';
?>
......@@ -3,4 +3,5 @@ $wb['name_txt'] = 'Nome';
$wb['fields_txt'] = 'Campos';
$wb['template_txt'] = 'Gabarito';
$wb['visible_txt'] = 'Visível';
$wb['placeholder_txt'] = 'Placeholder';
?>
......@@ -3,4 +3,5 @@ $wb['name_txt'] = 'Nom';
$wb['fields_txt'] = 'Champs';
$wb['template_txt'] = 'Modèle';
$wb['visible_txt'] = 'Visible';
$wb['placeholder_txt'] = 'Placeholder';
?>
......@@ -3,4 +3,5 @@ $wb['name_txt'] = 'Název';
$wb['fields_txt'] = 'Pole';
$wb['template_txt'] = 'Šablona';
$wb['visible_txt'] = 'Viditelný';
$wb['placeholder_txt'] = 'Placeholder';
?>
......@@ -3,4 +3,5 @@ $wb['name_txt'] = 'Name';
$wb['fields_txt'] = 'Felder';
$wb['template_txt'] = 'Vorlage';
$wb['visible_txt'] = 'Sichtbar';
$wb['placeholder_txt'] = 'Platzhalter';
?>
......@@ -3,4 +3,5 @@ $wb['name_txt'] = 'Navn';
$wb['fields_txt'] = 'Felter';
$wb['template_txt'] = 'Skabelon';
$wb['visible_txt'] = 'Synlig';
$wb['placeholder_txt'] = 'Placeholder';
?>
......@@ -3,4 +3,5 @@ $wb['name_txt'] = 'Όνομα';
$wb['fields_txt'] = 'Πεδία';
$wb['template_txt'] = 'Πρότυπο';
$wb['visible_txt'] = 'Ενεργό';
$wb['placeholder_txt'] = 'Placeholder';
?>
......@@ -3,4 +3,5 @@ $wb["name_txt"] = 'Name';
$wb["fields_txt"] = 'Fields';
$wb["template_txt"] = 'Template';
$wb["visible_txt"] = 'Visible';
$wb['placeholder_txt'] = 'Placeholder';
?>
\ No newline at end of file
......@@ -3,4 +3,5 @@ $wb['fields_txt'] = 'Campos';
$wb['name_txt'] = 'Nombre';
$wb['template_txt'] = 'Plantilla';
$wb['visible_txt'] = 'Visible';
$wb['placeholder_txt'] = 'Placeholder';
?>
......@@ -3,4 +3,5 @@ $wb['name_txt'] = 'Nimi';
$wb['fields_txt'] = 'Kentät';
$wb['template_txt'] = 'Malli';
$wb['visible_txt'] = 'Näkyvissä';
$wb['placeholder_txt'] = 'Placeholder';
?>
......@@ -3,4 +3,5 @@ $wb['name_txt'] = 'Nom';
$wb['fields_txt'] = 'Champs';
$wb['template_txt'] = 'Modèle';
$wb['visible_txt'] = 'Visible';
$wb['placeholder_txt'] = 'Placeholder';
?>
......@@ -3,4 +3,5 @@ $wb['name_txt'] = 'Naziv';
$wb['fields_txt'] = 'Polja';
$wb['template_txt'] = 'Predložak';
$wb['visible_txt'] = 'Vidljivo';
$wb['placeholder_txt'] = 'Placeholder';
?>
......@@ -3,4 +3,5 @@ $wb['name_txt'] = 'Név';
$wb['fields_txt'] = 'Mezők';
$wb['template_txt'] = 'Template';
$wb['visible_txt'] = 'Látható';
$wb['placeholder_txt'] = 'Placeholder';
?>
......@@ -3,4 +3,5 @@ $wb['name_txt'] = 'Nama';
$wb['fields_txt'] = 'Kolom';
$wb['template_txt'] = 'Template';
$wb['visible_txt'] = 'Terlihat';
$wb['placeholder_txt'] = 'Placeholder';
?>
......@@ -3,4 +3,5 @@ $wb['name_txt'] = 'Nome';
$wb['fields_txt'] = 'Fields';
$wb['template_txt'] = 'Template';
$wb['visible_txt'] = 'Visible';
$wb['placeholder_txt'] = 'Placeholder';
?>
......@@ -3,4 +3,5 @@ $wb['name_txt'] = '名前';
$wb['fields_txt'] = 'フィールド';
$wb['template_txt'] = 'テンプレート';
$wb['visible_txt'] = '公開する';
$wb['placeholder_txt'] = 'Placeholder';
?>
......@@ -3,4 +3,5 @@ $wb['name_txt'] = 'Naam';
$wb['fields_txt'] = 'Velden';
$wb['template_txt'] = 'Template';
$wb['visible_txt'] = 'Zichtbaar';
$wb['placeholder_txt'] = 'Placeholder';
?>
......@@ -3,4 +3,5 @@ $wb['name_txt'] = 'Nazwa';
$wb['fields_txt'] = 'Pola';
$wb['template_txt'] = 'Szablon';
$wb['visible_txt'] = 'Widoczność';
$wb['placeholder_txt'] = 'Placeholder';
?>
......@@ -3,4 +3,5 @@ $wb['name_txt'] = 'Nome';
$wb['fields_txt'] = 'Campos';
$wb['template_txt'] = 'Template';
$wb['visible_txt'] = 'Visível';
$wb['placeholder_txt'] = 'Placeholder';
?>
......@@ -3,4 +3,5 @@ $wb['name_txt'] = 'Nume';
$wb['fields_txt'] = 'Campuri';
$wb['template_txt'] = 'Template';
$wb['visible_txt'] = 'Vizibil';
$wb['placeholder_txt'] = 'Placeholder';
?>
......@@ -3,4 +3,5 @@ $wb['name_txt'] = 'Имя';
$wb['fields_txt'] = 'Поля';
$wb['template_txt'] = 'Шаблон';
$wb['visible_txt'] = 'Видимый';
$wb['placeholder_txt'] = 'Placeholder';
?>
......@@ -3,4 +3,5 @@ $wb['name_txt'] = 'Namn';
$wb['fields_txt'] = 'Fält';
$wb['template_txt'] = 'Mall';
$wb['visible_txt'] = 'Synlig';
$wb['placeholder_txt'] = 'Placeholder';
?>
......@@ -3,4 +3,5 @@ $wb['name_txt'] = 'Meno';
$wb['fields_txt'] = 'Polia';
$wb['template_txt'] = 'Šablóna';
$wb['visible_txt'] = 'Viditeľné';
$wb['placeholder_txt'] = 'Placeholder';
?>
......@@ -3,4 +3,5 @@ $wb['name_txt'] = 'Ad';
$wb['fields_txt'] = 'Alanlar';
$wb['template_txt'] = 'Kalıp';
$wb['visible_txt'] = 'Görünür';
$wb['placeholder_txt'] = 'Placeholder';
?>
......@@ -16,7 +16,10 @@
</div>
<div class="form-group">
<label for="template" class="col-sm-3 control-label">{tmpl_var name='template_txt'}</label>
<div class="col-sm-9"><textarea class="form-control" name="template" id="template" rows='15' cols='40'>{tmpl_var name='template'}</textarea></div>
<div class="col-sm-9"><textarea class="form-control" name="template" id="template" rows='15' cols='40'>{tmpl_var name='template'}</textarea>
&nbsp; DNS {tmpl_var name='placeholder_txt'}: <a href="javascript:void(0);" class="addPlaceholder">{DOMAIN}</a>, <a href="javascript:void(0);" class="addPlaceholder">{IP}</a>, <a href="javascript:void(0);" class="addPlaceholder">{IPV6}</a>, <a href="javascript:void(0);" class="addPlaceholder">{NS1}</a>, <a href="javascript:void(0);" class="addPlaceholder">{NS2}</a>, <a href="javascript:void(0);" class="addPlaceholder">{EMAIL}</a>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">{tmpl_var name='visible_txt'}</label>
......@@ -31,4 +34,4 @@
<div class="clear"><div class="right">
<button class="btn btn-default formbutton-success" type="button" value="{tmpl_var name='btn_save_txt'}" data-submit-form="pageForm" data-form-action="dns/dns_template_edit.php">{tmpl_var name='btn_save_txt'}</button>
<button class="btn btn-default formbutton-default" type="button" value="{tmpl_var name='btn_cancel_txt'}" data-load-content="dns/dns_template_list.php">{tmpl_var name='btn_cancel_txt'}</button>
</div></div>
\ No newline at end of file
</div></div>
......@@ -281,11 +281,13 @@ class page_action extends tform_actions {
function onAfterInsert() {
global $app, $conf;
$domain = $app->functions->idn_encode($this->dataRecord["domain"]);
// Spamfilter policy
$policy_id = $app->functions->intval($this->dataRecord["policy"]);
if($policy_id > 0) {
$tmp_user = $app->db->queryOneRecord("SELECT id FROM spamfilter_users WHERE email = ?", '@' . $this->dataRecord["domain"]);
$tmp_user = $app->db->queryOneRecord("SELECT id FROM spamfilter_users WHERE email = ?", '@' . $domain);
if($tmp_user["id"] > 0) {
// There is already a record that we will update
$app->db->datalogUpdate('spamfilter_users', array("policy_id" => $policy_id), 'id', $tmp_user["id"]);
......@@ -301,8 +303,8 @@ class page_action extends tform_actions {
"server_id" => $this->dataRecord["server_id"],
"priority" => 5,
"policy_id" => $policy_id,
"email" => '@' . $this->dataRecord["domain"],
"fullname" => '@' . $this->dataRecord["domain"],
"email" => '@' . $domain,
"fullname" => '@' . $domain,
"local" => 'Y'
);
$app->db->datalogInsert('spamfilter_users', $insert_data, 'id');
......@@ -324,6 +326,8 @@ class page_action extends tform_actions {
function onBeforeUpdate() {
global $app, $conf;
$domain = $app->functions->idn_encode($this->dataRecord["domain"]);
//* 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
......@@ -339,7 +343,7 @@ class page_action extends tform_actions {
} else {
//* We do not allow users to change a domain which has been created by the admin
$rec = $app->db->queryOneRecord("SELECT domain from mail_domain WHERE domain_id = ?", $this->id);
if($rec['domain'] != $this->dataRecord["domain"] && !$app->tform->checkPerm($this->id, 'u')) {
if($rec['domain'] != $domain && !$app->tform->checkPerm($this->id, 'u')) {
//* Add a error message and switch back to old server
$app->tform->errorMessage .= $app->lng('The Domain can not be changed. Please ask your Administrator if you want to change the domain name.');
$this->dataRecord["domain"] = $rec['domain'];
......@@ -352,9 +356,11 @@ class page_action extends tform_actions {
function onAfterUpdate() {
global $app, $conf;
$domain = $app->functions->idn_encode($this->dataRecord["domain"]);
// Spamfilter policy
$policy_id = $app->functions->intval($this->dataRecord["policy"]);
$tmp_user = $app->db->queryOneRecord("SELECT id FROM spamfilter_users WHERE email = ?", '@' . $this->dataRecord["domain"]);
$tmp_user = $app->db->queryOneRecord("SELECT id FROM spamfilter_users WHERE email = ?", '@' . $domain);
if($policy_id > 0) {
if($tmp_user["id"] > 0) {
// There is already a record that we will update
......@@ -371,8 +377,8 @@ class page_action extends tform_actions {
"server_id" => $this->dataRecord["server_id"],
"priority" => 5,
"policy_id" => $policy_id,
"email" => '@' . $this->dataRecord["domain"],
"fullname" => '@' . $this->dataRecord["domain"],
"email" => '@' . $domain,
"fullname" => '@' . $domain,
"local" => 'Y'
);
$app->db->datalogInsert('spamfilter_users', $insert_data, 'id');
......@@ -385,7 +391,7 @@ class page_action extends tform_actions {
}
} // endif spamfilter policy
//** If the domain name or owner has been changed, change the domain and owner in all mailbox records
if($this->oldDataRecord['domain'] != $this->dataRecord['domain'] || (isset($this->dataRecord['client_group_id']) && $this->oldDataRecord['sys_groupid'] != $this->dataRecord['client_group_id'])) {
if($this->oldDataRecord['domain'] != $domain || (isset($this->dataRecord['client_group_id']) && $this->oldDataRecord['sys_groupid'] != $this->dataRecord['client_group_id'])) {
$app->uses('getconf');
$mail_config = $app->getconf->get_server_config($this->dataRecord["server_id"], 'mail');
......@@ -398,7 +404,7 @@ class page_action extends tform_actions {
foreach($mailusers as $rec) {
// setting Maildir, Homedir, UID and GID
$mail_parts = explode("@", $rec['email']);
$maildir = str_replace("[domain]", $this->dataRecord['domain'], $mail_config["maildir_path"]);
$maildir = str_replace("[domain]", $domain, $mail_config["maildir_path"]);
$maildir = str_replace("[localpart]", $mail_parts[0], $maildir);
$email = $mail_parts[0].'@'.$this->dataRecord['domain'];
$app->db->datalogUpdate('mail_user', array("maildir" => $maildir, "email" => $email, "sys_userid" => $client_user_id, "sys_groupid" => $sys_groupid), 'mailuser_id', $rec['mailuser_id']);
......@@ -409,8 +415,8 @@ class page_action extends tform_actions {
$forwardings = $app->db->queryAllRecords("SELECT * FROM mail_forwarding WHERE source like ? OR destination like ?", '%@' . $this->oldDataRecord['domain'], '%@' . $this->oldDataRecord['domain']);
if(is_array($forwardings)) {
foreach($forwardings as $rec) {
$destination = str_replace($this->oldDataRecord['domain'], $this->dataRecord['domain'], $rec['destination']);
$source = str_replace($this->oldDataRecord['domain'], $this->dataRecord['domain'], $rec['source']);
$destination = str_replace($this->oldDataRecord['domain'], $domain, $rec['destination']);
$source = str_replace($this->oldDataRecord['domain'], $domain, $rec['source']);
$app->db->datalogUpdate('mail_forwarding', array("source" => $source, "destination" => $destination, "sys_userid" => $client_user_id, "sys_groupid" => $sys_groupid), 'forwarding_id', $rec['forwarding_id']);
}
}
......@@ -422,7 +428,7 @@ class page_action extends tform_actions {
$fetchmail = $app->db->queryAllRecords("SELECT * FROM mail_get WHERE destination like ?", '%@' . $this->oldDataRecord['domain']);
if(is_array($fetchmail)) {
foreach($fetchmail as $rec) {
$destination = str_replace($this->oldDataRecord['domain'], $this->dataRecord['domain'], $rec['destination']);
$destination = str_replace($this->oldDataRecord['domain'], $domain, $rec['destination']);
$app->db->datalogUpdate('mail_get', array("destination" => $destination, "sys_userid" => $client_user_id, "sys_groupid" => $sys_groupid), 'mailget_id', $rec['mailget_id']);
}
}
......@@ -436,15 +442,15 @@ class page_action extends tform_actions {
//* update dns-record when the dkim record was changed
// NOTE: only if the domain-name was not changed
if ( $this->dataRecord['active'] == 'y' && $this->dataRecord['domain'] == $this->oldDataRecord['domain'] ) {
if ( $this->dataRecord['active'] == 'y' && $domain == $this->oldDataRecord['domain'] ) {
$dkim_active = @($this->dataRecord['dkim'] == 'y') ? true : false;
$selector = @($this->dataRecord['dkim_selector'] != $this->oldDataRecord['dkim_selector']) ? true : false;
$dkim_private = @($this->dataRecord['dkim_private'] != $this->oldDataRecord['dkim_private']) ? true : false;
$soaDomain = $this->dataRecord['domain'].'.';
$soaDomain = $domain.'.';
while ((!isset($soa) && (substr_count($soaDomain,'.') > 1))) {
$soa = $app->db->queryOneRecord("SELECT id AS zone, sys_userid, sys_groupid, sys_perm_user, sys_perm_group, sys_perm_other, server_id, ttl, serial FROM dns_soa WHERE active = 'Y' AND origin = ?", $soaDomain);
$soaDomain = preg_replace("/^\w+\./","",$soaDomain);
$soaDomain = preg_replace("/^[\w\-]+\./","",$soaDomain);
}
if ( ($selector || $dkim_private || $dkim_active) && $dkim_active )
......@@ -455,7 +461,7 @@ class page_action extends tform_actions {
if (! $dkim_active) {
// updated existing dmarc-record to policy 'none'
$sql = "SELECT * from dns_rr WHERE name = ? AND data LIKE 'v=DMARC1%' AND " . $app->tform->getAuthSQL('r');
$rec = $app->db->queryOneRecord($sql, '_dmarc.'.$this->dataRecord['domain'].'.');
$rec = $app->db->queryOneRecord($sql, '_dmarc.'.$domain.'.');
if (is_array($rec))
if (strpos($rec['data'], 'p=none=') === false) {
$rec['data'] = str_replace(array('quarantine', 'reject'), 'none', $rec['data']);
......
<?php
/*
Form Definition
Tabledefinition
Datatypes:
- INTEGER (Forces the input to Int)
- DOUBLE
- CURRENCY (Formats the values to currency notation)
- VARCHAR (no format check, maxlength: 255)
- TEXT (no format check)
- DATE (Dateformat, automatic conversion to timestamps)
Formtype:
- TEXT (Textfield)
- TEXTAREA (Textarea)
- PASSWORD (Password textfield, input is not shown when edited)
- SELECT (Select option field)
- RADIO
- CHECKBOX
- CHECKBOXARRAY
- FILE
VALUE:
- Wert oder Array
Hint:
The ID field of the database table is not part of the datafield definition.
The ID field must be always auto incement (int or bigint).
*/
$form["title"] = "mailbox_autoresponder_txt";
$form["description"] = "";
$form["name"] = "mail_user_autoresponder";
$form["action"] = "mail_user_autoresponder_edit.php";
$form["db_table"] = "mail_user";
$form["db_table_idx"] = "mailuser_id";
$form["db_history"] = "yes";
$form["tab_default"] = "autoresponder";
$form["list_default"] = "index.php";
$form["auth"] = 'no'; // yes / no
$form["auth_preset"]["userid"] = 0; // 0 = id of the user, > 0 id must match with id of current user
$form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user
$form["auth_preset"]["perm_user"] = 'riud'; //r = read, i = insert, u = update, d = delete
$form["auth_preset"]["perm_group"] = 'riud'; //r = read, i = insert, u = update, d = delete
$form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
$form["tabs"]['autoresponder'] = array (
'title' => "Autoresponder",
'width' => 100,
'template' => "templates/mail_user_autoresponder_edit.htm",
'fields' => array (
//#################################
// Begin Datatable fields
//#################################
'autoresponder_subject' => array (
'datatype' => 'VARCHAR',
'formtype' => 'TEXT',
'filters' => array(
0 => array( 'event' => 'SAVE',
'type' => 'STRIPTAGS'),
1 => array( 'event' => 'SAVE',
'type' => 'STRIPNL')
),
'default' => 'Out of office reply',
'value' => '',
'width' => '30',
'maxlength' => '255'
),
'autoresponder_text' => array (
'datatype' => 'TEXT',
'formtype' => 'TEXTAREA',
'filters' => array(
0 => array( 'event' => 'SAVE',
'type' => 'STRIPTAGS')
),
'default' => '',
'value' => '',
'cols' => '30',
'rows' => '15'
),
'autoresponder' => array (
'datatype' => 'VARCHAR',
'formtype' => 'CHECKBOX',
'default' => 'n',
'value' => array(1 => 'y', 0 => 'n')
),
'autoresponder_start_date' => array (
'datatype' => 'DATETIME',
'formtype' => 'DATETIME',
'validators'=> array ( 0 => array ( 'type' => 'CUSTOM',
'class' => 'validate_autoresponder',
'function' => 'start_date',
'errmsg'=> 'autoresponder_start_date_isfuture'),
),
),
'autoresponder_end_date' => array (
'datatype' => 'DATETIME',
'formtype' => 'DATETIME',
'validators' => array ( 0 => array ( 'type' => 'CUSTOM',
'class' => 'validate_autoresponder',
'function' => 'end_date',
'errmsg'=> 'autoresponder_end_date_isgreater'),
),
),
//#################################
// END Datatable fields
//#################################
)
);
?>
<?php
/*
Form Definition
Tabledefinition
Datatypes:
- INTEGER (Forces the input to Int)
- DOUBLE
- CURRENCY (Formats the values to currency notation)
- VARCHAR (no format check, maxlength: 255)
- TEXT (no format check)
- DATE (Dateformat, automatic conversion to timestamps)
Formtype:
- TEXT (Textfield)
- TEXTAREA (Textarea)
- PASSWORD (Password textfield, input is not shown when edited)
- SELECT (Select option field)
- RADIO
- CHECKBOX
- CHECKBOXARRAY
- FILE
VALUE:
- Wert oder Array
Hint:
The ID field of the database table is not part of the datafield definition.
The ID field must be always auto incement (int or bigint).
*/
$form["title"] = "mailbox_cc_txt";
$form["description"] = "";
$form["name"] = "mail_user_cc";
$form["action"] = "mail_user_cc_edit.php";
$form["db_table"] = "mail_user";
$form["db_table_idx"] = "mailuser_id";
$form["db_history"] = "yes";
$form["tab_default"] = "mailuser";
$form["list_default"] = "index.php";
$form["auth"] = 'no'; // yes / no
$form["auth_preset"]["userid"] = 0; // 0 = id of the user, > 0 id must match with id of current user
$form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user
$form["auth_preset"]["perm_user"] = 'riud'; //r = read, i = insert, u = update, d = delete
$form["auth_preset"]["perm_group"] = 'riud'; //r = read, i = insert, u = update, d = delete
$form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
$form["tabs"]['mailuser'] = array (
'title' => "cc_txt",
'width' => 100,
'template' => "templates/mail_user_cc_edit.htm",
'fields' => array (
//#################################
// Begin Datatable fields
//#################################
'cc' => array (
'datatype' => 'VARCHAR',
'formtype' => 'TEXT',
'filters' => array( 0 => array( 'event' => 'SAVE',
'type' => 'IDNTOASCII'),
1 => array( 'event' => 'SHOW',
'type' => 'IDNTOUTF8'),
2 => array( 'event' => 'SAVE',
'type' => 'TOLOWER')
),
'validators' => array (
0 => array ( 'type' => 'REGEX',
'regex' => '/^(\w+[\w\.\-\+]*\w{0,}@\w+[\w.-]*\.[a-z\-]{2,10}){0,1}(,\s*\w+[\w\.\-\+]*\w{0,}@\w+[\w.-]*\.[a-z\-]{2,10}){0,}$/i',
'errmsg'=> 'cc_error_isemail'),
),
'default' => '',
'value' => '',
'width' => '30',
'maxlength' => '255'
),
//#################################
// END Datatable fields
//#################################
)
);
?>
<?php
/*
Form Definition
Tabledefinition
Datatypes:
- INTEGER (Forces the input to Int)
- DOUBLE
- CURRENCY (Formats the values to currency notation)
- VARCHAR (no format check, maxlength: 255)
- TEXT (no format check)
- DATE (Dateformat, automatic conversion to timestamps)
Formtype:
- TEXT (Textfield)
- TEXTAREA (Textarea)
- PASSWORD (Password textfield, input is not shown when edited)
- SELECT (Select option field)
- RADIO
- CHECKBOX
- CHECKBOXARRAY
- FILE
VALUE:
- Wert oder Array
Hint:
The ID field of the database table is not part of the datafield definition.
The ID field must be always auto incement (int or bigint).
*/
global $app;
$form["title"] = "mailbox_filter_txt";
$form["description"] = "";
$form["name"] = "mail_user_filter";
$form["action"] = "mail_user_filter_edit.php";
$form["db_table"] = "mail_user_filter";
$form["db_table_idx"] = "filter_id";
$form["db_history"] = "no";
$form["tab_default"] = "filter";
$form["list_default"] = "mail_user_filter_list.php";
$form["auth"] = 'yes'; // yes / no
$form["auth_preset"]["userid"] = 0; // 0 = id of the user, > 0 id must match with id of current user
$form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user
$form["auth_preset"]["perm_user"] = 'riud'; //r = read, i = insert, u = update, d = delete
$form["auth_preset"]["perm_group"] = 'riud'; //r = read, i = insert, u = update, d = delete
$form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
$form["tabs"]['filter'] = array (
'title' => "Filter",
'width' => 100,
'template' => "templates/mail_user_filter_edit.htm",
'fields' => array (
//#################################
// Begin Datatable fields
//#################################
'mailuser_id' => array (
'datatype' => 'INTEGER',
'formtype' => 'TEXT',
'default' => @$app->functions->intval($_REQUEST["mailuser_id"]),
'value' => '',
'width' => '30',
'maxlength' => '255'
),
'rulename' => array (
'datatype' => 'VARCHAR',
'formtype' => 'TEXT',
'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY',
'errmsg'=> 'rulename_error_empty'),
),
'default' => '',
'value' => '',
'width' => '30',
'maxlength' => '255'
),
'source' => array (
'datatype' => 'VARCHAR',
'formtype' => 'SELECT',
'default' => '',
'value' => array('Subject' => 'subject_txt', 'From'=>'from_txt', 'To'=>'to_txt')
),
'op' => array (
'datatype' => 'VARCHAR',
'formtype' => 'SELECT',
'default' => '',
//'value' => array('contains'=>'contains_txt','is' => 'Is','begins'=>'Begins with','ends'=>'Ends with')
'value' => array('contains'=>'contains_txt', 'is' => 'is_txt', 'begins'=>'begins_with_txt', 'ends'=>'ends_with_txt')
),
'searchterm' => array (
'datatype' => 'VARCHAR',
'formtype' => 'TEXT',
'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY',
'errmsg'=> 'searchterm_is_empty'),
),
'default' => '',
'value' => '',
'width' => '30',
'maxlength' => '255'
),
'action' => array (
'datatype' => 'VARCHAR',
'formtype' => 'SELECT',
'default' => '',
'value' => array('move' => 'move_to_txt', 'delete'=>'delete_txt')
),
'target' => array (
'datatype' => 'VARCHAR',
'formtype' => 'TEXT',
'validators' => array ( 0 => array ( 'type' => 'REGEX',
'regex' => '/^[a-zA-Z0-9\.\-\_\ ]{0,100}$/',
'errmsg'=> 'target_error_regex'),
),
'default' => '',
'value' => '',
'width' => '30',
'maxlength' => '255'
),
'active' => array (
'datatype' => 'VARCHAR',
'formtype' => 'CHECKBOX',
'default' => 'y',
'value' => array(0 => 'n', 1 => 'y')
),
//#################################
// ENDE Datatable fields
//#################################
)
);
?>
<?php
/*
Form Definition
Tabledefinition
Datatypes:
- INTEGER (Forces the input to Int)
- DOUBLE
- CURRENCY (Formats the values to currency notation)
- VARCHAR (no format check, maxlength: 255)
- TEXT (no format check)
- DATE (Dateformat, automatic conversion to timestamps)
Formtype:
- TEXT (Textfield)
- TEXTAREA (Textarea)
- PASSWORD (Password textfield, input is not shown when edited)
- SELECT (Select option field)
- RADIO
- CHECKBOX
- CHECKBOXARRAY
- FILE
VALUE:
- Wert oder Array
Hint:
The ID field of the database table is not part of the datafield definition.
The ID field must be always auto incement (int or bigint).
*/
$form["title"] = "mailbox_password_txt";
$form["description"] = "";
$form["name"] = "mail_user_password";
$form["action"] = "mail_user_password_edit.php";
$form["db_table"] = "mail_user";
$form["db_table_idx"] = "mailuser_id";
$form["db_history"] = "yes";
$form["tab_default"] = "mailuser";
$form["list_default"] = "index.php";
$form["auth"] = 'no'; // yes / no
$form["auth_preset"]["userid"] = 0; // 0 = id of the user, > 0 id must match with id of current user
$form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user
$form["auth_preset"]["perm_user"] = 'riud'; //r = read, i = insert, u = update, d = delete
$form["auth_preset"]["perm_group"] = 'riud'; //r = read, i = insert, u = update, d = delete
$form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
$form["tabs"]['mailuser'] = array (
'title' => "password_txt",
'width' => 100,
'template' => "templates/mail_user_password_edit.htm",
'fields' => array (
//#################################
// Begin Datatable fields
//#################################
'password' => array (
'datatype' => 'VARCHAR',
'formtype' => 'PASSWORD',
'validators' => array(
0 => array(
'type' => 'CUSTOM',
'class' => 'validate_password',
'function' => 'password_check',
'errmsg' => 'weak_password_txt'
)
),
'encryption' => 'CRYPT',
'default' => '',
'value' => '',
'width' => '30',
'maxlength' => '255'
),
//#################################
// END Datatable fields
//#################################
)
);
?>
<?php
/*
Form Definition
Tabledefinition
Datatypes:
- INTEGER (Forces the input to Int)
- DOUBLE
- CURRENCY (Formats the values to currency notation)
- VARCHAR (no format check, maxlength: 255)
- TEXT (no format check)
- DATE (Dateformat, automatic conversion to timestamps)
Formtype:
- TEXT (Textfield)
- TEXTAREA (Textarea)
- PASSWORD (Password textfield, input is not shown when edited)
- SELECT (Select option field)
- RADIO
- CHECKBOX
- CHECKBOXARRAY
- FILE
VALUE:
- Wert oder Array
Hint:
The ID field of the database table is not part of the datafield definition.
The ID field must be always auto incement (int or bigint).
*/
$form["title"] = "mailbox_spamfilter_txt";
$form["description"] = "";
$form["name"] = "mail_user_spamfilter";
$form["action"] = "mail_user_spamfilter_edit.php";
$form["db_table"] = "mail_user";
$form["db_table_idx"] = "mailuser_id";
$form["db_history"] = "yes";
$form["tab_default"] = "mailuser";
$form["list_default"] = "index.php";
$form["auth"] = 'no'; // yes / no
$form["auth_preset"]["userid"] = 0; // 0 = id of the user, > 0 id must match with id of current user
$form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user
$form["auth_preset"]["perm_user"] = 'riud'; //r = read, i = insert, u = update, d = delete
$form["auth_preset"]["perm_group"] = 'riud'; //r = read, i = insert, u = update, d = delete
$form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
$form["tabs"]['mailuser'] = array (
'title' => "spamfilter_txt",
'width' => 100,
'template' => "templates/mail_user_spamfilter_edit.htm",
'fields' => array (
//#################################
// Begin Datatable fields
//#################################
//#################################
// END Datatable fields
//#################################
)
);
?>
<?php
require_once '../../lib/config.inc.php';
require_once '../../lib/app.inc.php';
//* Check permissions for module
$app->auth->check_module_permissions('mailuser');
$app->uses('tpl');
$app->tpl->newTemplate('form.tpl.htm');
$app->tpl->setInclude('content_tpl', 'templates/index.htm');
$msg = '';
$error = '';