diff --git a/interface/lib/lang/en.lng b/interface/lib/lang/en.lng
index 302b3e8907f2361ee9ce9b3b5a4931ff86a38c9e..511ff5acf8e9d171fa793997f105451152832ab2 100644
--- a/interface/lib/lang/en.lng
+++ b/interface/lib/lang/en.lng
@@ -34,6 +34,7 @@ $wb['top_menu_dns'] = 'DNS';
$wb['top_menu_tools'] = 'Tools';
$wb['top_menu_help'] = 'Help';
$wb['top_menu_billing'] = 'Billing';
+$wb['top_menu_mailuser'] = 'Mailuser';
$wb['top_menu_domain'] = 'Domains';
$wb['top_menu_dashboard'] = 'Home';
$wb['top_menu_vm'] = 'VServer';
diff --git a/interface/lib/plugins/mail_user_filter_plugin.inc.php b/interface/lib/plugins/mail_user_filter_plugin.inc.php
index 7b22da89dc177e45fb606c3b727ed7aff93c0bd1..99db65f23bf4175ff438f2aede7308586f5eb35e 100644
--- a/interface/lib/plugins/mail_user_filter_plugin.inc.php
+++ b/interface/lib/plugins/mail_user_filter_plugin.inc.php
@@ -47,6 +47,9 @@ class mail_user_filter_plugin {
$app->plugin->registerEvent('mail:mail_user_filter:on_after_insert','mail_user_filter_plugin','mail_user_filter_edit');
$app->plugin->registerEvent('mail:mail_user_filter:on_after_update','mail_user_filter_plugin','mail_user_filter_edit');
$app->plugin->registerEvent('mail:mail_user_filter:on_after_delete','mail_user_filter_plugin','mail_user_filter_del');
+ $app->plugin->registerEvent('mailuser:mail_user_filter:on_after_insert','mail_user_filter_plugin','mail_user_filter_edit');
+ $app->plugin->registerEvent('mailuser:mail_user_filter:on_after_update','mail_user_filter_plugin','mail_user_filter_edit');
+ $app->plugin->registerEvent('mailuser:mail_user_filter:on_after_delete','mail_user_filter_plugin','mail_user_filter_del');
}
diff --git a/interface/web/admin/form/users.tform.php b/interface/web/admin/form/users.tform.php
index afe5956310d3b88bb1df985a630774538dc29937..86b20bdcc879e5311da2a3aee941805a9d7adc7f 100644
--- a/interface/web/admin/form/users.tform.php
+++ b/interface/web/admin/form/users.tform.php
@@ -87,7 +87,7 @@ $handle = @opendir(ISPC_WEB_PATH);
while ($file = @readdir ($handle)) {
if ($file != '.' && $file != '..') {
if(@is_dir(ISPC_WEB_PATH."/$file")) {
- if(is_file(ISPC_WEB_PATH."/$file/lib/module.conf.php") and $file != 'login' && $file != 'designer') {
+ if(is_file(ISPC_WEB_PATH."/$file/lib/module.conf.php") and $file != 'login' && $file != 'designer' && $file != 'mailuser') {
$modules_list[$file] = $file;
}
}
diff --git a/interface/web/login/index.php b/interface/web/login/index.php
index 1c5dc91a2a3b1c44187a7b37af49f4737c3957dd..fce04c720f09edd86c3664b4b0a7ac702e49dae6 100644
--- a/interface/web/login/index.php
+++ b/interface/web/login/index.php
@@ -60,7 +60,7 @@ class login_index {
if(count($_POST) > 0) {
//** Check variables
- if(!preg_match("/^[\w\.\-\_]{1,64}$/", $_POST['username'])) $error = $app->lng('user_regex_error');
+ if(!preg_match("/^[\w\.\-\_\@]{1,128}$/", $_POST['username'])) $error = $app->lng('user_regex_error');
if(!preg_match("/^.{1,64}$/i", $_POST['passwort'])) $error = $app->lng('pw_error_length');
//** iporting variables
@@ -111,29 +111,57 @@ class login_index {
$sql = "SELECT * FROM sys_user WHERE USERNAME = '$username' and PASSWORT = '". $passwort. "'";
$user = $app->db->queryOneRecord($sql);
} else {
- $sql = "SELECT * FROM sys_user WHERE USERNAME = '$username'";
- $user = $app->db->queryOneRecord($sql);
-
- if($user) {
+ if(stristr($username,'@')) {
+ //* mailuser login
+ $sql = "SELECT * FROM mail_user WHERE login = '$username'";
+ $mailuser = $app->db->queryOneRecord($sql);
+ $user = false;
+ if($mailuser) {
+ $saved_password = stripslashes($mailuser['password']);
+ $salt = '$1$'.substr($saved_password,3,8).'$';
+ //* Check if mailuser password is correct
+ if(crypt(stripslashes($passwort),$salt) == $saved_password) {
+ //* we build a fake user here which has access to the mailuser module only and userid 0
+ $user = array();
+ $user['userid'] = 0;
+ $user['active'] = 1;
+ $user['startmodule'] = 'mailuser';
+ $user['modules'] = 'mailuser';
+ $user['typ'] = 'user';
+ $user['email'] = $mailuser['email'];
+ $user['username'] = $username;
+ $user['language'] = $conf['language'];
+ $user['theme'] = $conf['theme'];
+ $user['mailuser_id'] = $mailuser['mailuser_id'];
+ $user['default_group'] = $mailuser['sys_groupid'];
+ }
+ }
- $saved_password = stripslashes($user['passwort']);
+ } else {
+ //* normal cp user login
+ $sql = "SELECT * FROM sys_user WHERE USERNAME = '$username'";
+ $user = $app->db->queryOneRecord($sql);
- if(substr($saved_password,0,3) == '$1$') {
- //* The password is crypt-md5 encrypted
- $salt = '$1$'.substr($saved_password,3,8).'$';
+ if($user) {
+ $saved_password = stripslashes($user['passwort']);
+
+ if(substr($saved_password,0,3) == '$1$') {
+ //* The password is crypt-md5 encrypted
+ $salt = '$1$'.substr($saved_password,3,8).'$';
- if(crypt(stripslashes($passwort),$salt) != $saved_password) {
- $user = false;
- }
- } else {
+ if(crypt(stripslashes($passwort),$salt) != $saved_password) {
+ $user = false;
+ }
+ } else {
- //* The password is md5 encrypted
- if(md5($passwort) != $saved_password) {
- $user = false;
+ //* The password is md5 encrypted
+ if(md5($passwort) != $saved_password) {
+ $user = false;
+ }
}
+ } else {
+ $user = false;
}
- } else {
- $user = false;
}
}
@@ -143,12 +171,13 @@ class login_index {
$sql = "DELETE FROM `attempts_login` WHERE `ip`='{$ip}'";
$app->db->query($sql);
$user = $app->db->toLower($user);
+
if ($loginAs) $oldSession = $_SESSION['s'];
- $_SESSION = array();
+ $_SESSION = array();
if ($loginAs) $_SESSION['s_old'] = $oldSession; // keep the way back!
- $_SESSION['s']['user'] = $user;
- $_SESSION['s']['user']['theme'] = isset($user['app_theme']) ? $user['app_theme'] : 'default';
- $_SESSION['s']['language'] = $user['language'];
+ $_SESSION['s']['user'] = $user;
+ $_SESSION['s']['user']['theme'] = isset($user['app_theme']) ? $user['app_theme'] : 'default';
+ $_SESSION['s']['language'] = $user['language'];
$_SESSION["s"]['theme'] = $_SESSION['s']['user']['theme'];
if(is_file($_SESSION['s']['user']['startmodule'].'/lib/module.conf.php')) {
diff --git a/interface/web/mailuser/form/mail_user_autoresponder.tform.php b/interface/web/mailuser/form/mail_user_autoresponder.tform.php
new file mode 100644
index 0000000000000000000000000000000000000000..0db87f1b40ccfb89037c38dd30c95677eb2fc8f1
--- /dev/null
+++ b/interface/web/mailuser/form/mail_user_autoresponder.tform.php
@@ -0,0 +1,109 @@
+ 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',
+ 'default' => 'Out of office reply',
+ 'value' => '',
+ 'width' => '30',
+ 'maxlength' => '255'
+ ),
+ 'autoresponder_text' => array (
+ 'datatype' => 'TEXT',
+ 'formtype' => 'TEXTAREA',
+ '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
+ ##################################
+ )
+);
+
+
+?>
\ No newline at end of file
diff --git a/interface/web/mailuser/form/mail_user_cc.tform.php b/interface/web/mailuser/form/mail_user_cc.tform.php
new file mode 100644
index 0000000000000000000000000000000000000000..f1e90c24344a3c57acb86f7d8530e421c731dcf0
--- /dev/null
+++ b/interface/web/mailuser/form/mail_user_cc.tform.php
@@ -0,0 +1,80 @@
+ 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',
+ 'validators' => array ( 0 => array ( 'type' => 'REGEX',
+ 'regex' => '/^(\w+[\w\.\-\+]*\w{0,}@\w+[\w.-]*\w+\.[a-z\-]{2,10}){0,1}$/i',
+ 'errmsg'=> 'cc_error_isemail'),
+ ),
+ 'default' => '',
+ 'value' => '',
+ 'width' => '30',
+ 'maxlength' => '255'
+ ),
+ ##################################
+ # END Datatable fields
+ ##################################
+ )
+);
+
+
+?>
\ No newline at end of file
diff --git a/interface/web/mailuser/form/mail_user_filter.tform.php b/interface/web/mailuser/form/mail_user_filter.tform.php
new file mode 100644
index 0000000000000000000000000000000000000000..76566851119edfe5ad49388ec13546c344228505
--- /dev/null
+++ b/interface/web/mailuser/form/mail_user_filter.tform.php
@@ -0,0 +1,136 @@
+ 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' => @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
+ ##################################
+ )
+);
+
+
+
+?>
diff --git a/interface/web/mailuser/form/mail_user_password.tform.php b/interface/web/mailuser/form/mail_user_password.tform.php
new file mode 100644
index 0000000000000000000000000000000000000000..65212b39669bb4b7ef7d1cc8e84d086a6a047bd2
--- /dev/null
+++ b/interface/web/mailuser/form/mail_user_password.tform.php
@@ -0,0 +1,77 @@
+ 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',
+ 'encryption'=> 'CRYPT',
+ 'default' => '',
+ 'value' => '',
+ 'width' => '30',
+ 'maxlength' => '255'
+ ),
+ ##################################
+ # END Datatable fields
+ ##################################
+ )
+);
+
+
+?>
\ No newline at end of file
diff --git a/interface/web/mailuser/form/mail_user_spamfilter.tform.php b/interface/web/mailuser/form/mail_user_spamfilter.tform.php
new file mode 100644
index 0000000000000000000000000000000000000000..cb16645dae7171e9b3b5616c91e0b3e85dcb0ea8
--- /dev/null
+++ b/interface/web/mailuser/form/mail_user_spamfilter.tform.php
@@ -0,0 +1,69 @@
+ 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
+ ##################################
+ )
+);
+
+
+?>
\ No newline at end of file
diff --git a/interface/web/mailuser/index.php b/interface/web/mailuser/index.php
new file mode 100644
index 0000000000000000000000000000000000000000..0b1a0f59fc31787cf51c09f4334cc0842d688b08
--- /dev/null
+++ b/interface/web/mailuser/index.php
@@ -0,0 +1,43 @@
+auth->check_module_permissions('mailuser');
+
+$app->uses('tpl');
+
+$app->tpl->newTemplate('form.tpl.htm');
+$app->tpl->setInclude('content_tpl', 'templates/index.htm');
+$msg = '';
+$error = '';
+
+//* load language file
+$lng_file = 'lib/lang/'.$_SESSION['s']['language'].'_index.lng';
+include($lng_file);
+$app->tpl->setVar($wb);
+
+$sql = "SELECT * FROM mail_user WHERE mailuser_id = ".$_SESSION['s']['user']['mailuser_id'];
+$rec = $app->db->queryOneRecord($sql);
+
+if($rec['quota'] == 0) {
+ $rec['quota'] = $wb['unlimited_txt'];
+} else {
+ $rec['quota'] = ($rec['quota'] / 1024 / 1024).' '.$wb['mb_txt'];
+}
+
+if($rec['cc'] == '') $rec['cc'] = $wb['none_txt'];
+
+$app->tpl->setVar($rec);
+
+$app->tpl->setVar('msg',$msg);
+$app->tpl->setVar('error',$error);
+
+
+
+
+$app->tpl_defaults();
+$app->tpl->pparse();
+
+
+?>
\ No newline at end of file
diff --git a/interface/web/mailuser/lib/admin.conf.php b/interface/web/mailuser/lib/admin.conf.php
new file mode 100644
index 0000000000000000000000000000000000000000..67c94a5742572786e8c7c2ae67750c31231a4b64
--- /dev/null
+++ b/interface/web/mailuser/lib/admin.conf.php
@@ -0,0 +1,2 @@
+
\ No newline at end of file
diff --git a/interface/web/mailuser/lib/lang/en_index.lng b/interface/web/mailuser/lib/lang/en_index.lng
new file mode 100644
index 0000000000000000000000000000000000000000..1b60c2aef3fdbf4f02cbd2edc0a57e731903a0a8
--- /dev/null
+++ b/interface/web/mailuser/lib/lang/en_index.lng
@@ -0,0 +1,11 @@
+
\ No newline at end of file
diff --git a/interface/web/mailuser/lib/lang/en_mail_user_autoresponder.lng b/interface/web/mailuser/lib/lang/en_mail_user_autoresponder.lng
new file mode 100644
index 0000000000000000000000000000000000000000..f97a4c289e7115e28668438b144ec9507415b89c
--- /dev/null
+++ b/interface/web/mailuser/lib/lang/en_mail_user_autoresponder.lng
@@ -0,0 +1,12 @@
+
diff --git a/interface/web/mailuser/lib/lang/en_mail_user_cc.lng b/interface/web/mailuser/lib/lang/en_mail_user_cc.lng
new file mode 100644
index 0000000000000000000000000000000000000000..0073c71647eb0196b2be0aebc83018484100d7cd
--- /dev/null
+++ b/interface/web/mailuser/lib/lang/en_mail_user_cc.lng
@@ -0,0 +1,7 @@
+
\ No newline at end of file
diff --git a/interface/web/mailuser/lib/lang/en_mail_user_filter.lng b/interface/web/mailuser/lib/lang/en_mail_user_filter.lng
new file mode 100644
index 0000000000000000000000000000000000000000..296a47ec579fa2003a3614b0f3545623480524ce
--- /dev/null
+++ b/interface/web/mailuser/lib/lang/en_mail_user_filter.lng
@@ -0,0 +1,20 @@
+
diff --git a/interface/web/mailuser/lib/lang/en_mail_user_filter_list.lng b/interface/web/mailuser/lib/lang/en_mail_user_filter_list.lng
new file mode 100644
index 0000000000000000000000000000000000000000..4eaa5cdade0d2e97026f1940add0baa0ab2192fd
--- /dev/null
+++ b/interface/web/mailuser/lib/lang/en_mail_user_filter_list.lng
@@ -0,0 +1,8 @@
+
\ No newline at end of file
diff --git a/interface/web/mailuser/lib/lang/en_mail_user_password.lng b/interface/web/mailuser/lib/lang/en_mail_user_password.lng
new file mode 100644
index 0000000000000000000000000000000000000000..77e68419d3dc1d831c41f2d0a3049e88af04230f
--- /dev/null
+++ b/interface/web/mailuser/lib/lang/en_mail_user_password.lng
@@ -0,0 +1,6 @@
+
\ No newline at end of file
diff --git a/interface/web/mailuser/lib/lang/en_mail_user_spamfilter.lng b/interface/web/mailuser/lib/lang/en_mail_user_spamfilter.lng
new file mode 100644
index 0000000000000000000000000000000000000000..bceb153496d83e14818783c5cd5c32980600b94b
--- /dev/null
+++ b/interface/web/mailuser/lib/lang/en_mail_user_spamfilter.lng
@@ -0,0 +1,6 @@
+
\ No newline at end of file
diff --git a/interface/web/mailuser/lib/module.conf.php b/interface/web/mailuser/lib/module.conf.php
new file mode 100644
index 0000000000000000000000000000000000000000..3b8e25ced1fe7d9ee9aaebb6902cfbf54f0bab7d
--- /dev/null
+++ b/interface/web/mailuser/lib/module.conf.php
@@ -0,0 +1,50 @@
+auth->get_user_id();
+
+$module['name'] = 'mailuser';
+$module['title'] = 'top_menu_mailuser';
+$module['template'] = 'module.tpl.htm';
+$module['startpage'] = 'mailuser/index.php';
+$module['tab_width'] = '';
+
+
+//**** menu
+$items = array();
+
+
+$items[] = array( 'title' => 'Password',
+ 'target' => 'content',
+ 'link' => 'mailuser/mail_user_password_edit.php',
+ 'html_id' => 'mail_user_password');
+
+$items[] = array( 'title' => 'Autoresponder',
+ 'target' => 'content',
+ 'link' => 'mailuser/mail_user_autoresponder_edit.php',
+ 'html_id' => 'mail_user_autoresponder');
+
+$items[] = array( 'title' => 'Send copy',
+ 'target' => 'content',
+ 'link' => 'mailuser/mail_user_cc_edit.php',
+ 'html_id' => 'mail_user_cc');
+
+$items[] = array( 'title' => 'Spamfilter',
+ 'target' => 'content',
+ 'link' => 'mailuser/mail_user_spamfilter_edit.php',
+ 'html_id' => 'mail_user_cc');
+
+$items[] = array( 'title' => 'Email Filters',
+ 'target' => 'content',
+ 'link' => 'mailuser/mail_user_filter_list.php',
+ 'html_id' => 'mail_user_filter_list');
+
+
+if(count($items)) {
+ $module['nav'][] = array( 'title' => 'Email Account',
+ 'open' => 1,
+ 'items' => $items);
+}
+
+
+
+?>
\ No newline at end of file
diff --git a/interface/web/mailuser/lib/remote.conf.php b/interface/web/mailuser/lib/remote.conf.php
new file mode 100644
index 0000000000000000000000000000000000000000..15c5adc7fae9b7dab7ba2410a6cabc4361f76852
--- /dev/null
+++ b/interface/web/mailuser/lib/remote.conf.php
@@ -0,0 +1,3 @@
+
\ No newline at end of file
diff --git a/interface/web/mailuser/list/mail_user_filter.list.php b/interface/web/mailuser/list/mail_user_filter.list.php
new file mode 100644
index 0000000000000000000000000000000000000000..445fe6faa38cf1143d66aafab3ebb0ec4f99a2fa
--- /dev/null
+++ b/interface/web/mailuser/list/mail_user_filter.list.php
@@ -0,0 +1,60 @@
+ "rulename",
+ 'datatype' => "VARCHAR",
+ 'formtype' => "TEXT",
+ 'op' => "like",
+ 'prefix' => "%",
+ 'suffix' => "%",
+ 'width' => "",
+ 'value' => "");
+
+
+?>
\ No newline at end of file
diff --git a/interface/web/mailuser/mail_user_autoresponder_edit.php b/interface/web/mailuser/mail_user_autoresponder_edit.php
new file mode 100644
index 0000000000000000000000000000000000000000..5fac5b9c7f8a50e3b3392e1c55c34db4b0f37f20
--- /dev/null
+++ b/interface/web/mailuser/mail_user_autoresponder_edit.php
@@ -0,0 +1,93 @@
+auth->check_module_permissions('mailuser');
+
+// Loading classes
+$app->uses('tpl,tform,tform_actions');
+$app->load('tform_actions');
+
+class page_action extends tform_actions {
+
+ function onShow() {
+
+ $this->id = $_SESSION['s']['user']['mailuser_id'];
+
+ parent::onShow();
+
+ }
+
+ function onSubmit() {
+
+ $this->id = $_SESSION['s']['user']['mailuser_id'];
+
+ //* if autoresponder checkbox not selected, do not save dates
+ if (!isset($_POST['autoresponder']) && array_key_exists('autoresponder_start_date', $_POST)) {
+ $this->dataRecord['autoresponder_start_date'] = array_map(create_function('$item','return 0;'), $this->dataRecord['autoresponder_start_date']);
+ $this->dataRecord['autoresponder_end_date'] = array_map(create_function('$item','return 0;'), $this->dataRecord['autoresponder_end_date']);
+ }
+
+ parent::onSubmit();
+
+ }
+
+ function onShowEnd() {
+ global $app;
+ // Is autoresponder set?
+ if ($this->dataRecord['autoresponder'] == 'y') {
+ $app->tpl->setVar("ar_active", 'checked="checked"');
+ } else {
+ $app->tpl->setVar("ar_active", '');
+ }
+
+ parent::onShowEnd();
+ }
+
+
+}
+
+$app->tform_actions = new page_action;
+$app->tform_actions->onLoad();
+
+?>
diff --git a/interface/web/mailuser/mail_user_cc_edit.php b/interface/web/mailuser/mail_user_cc_edit.php
new file mode 100644
index 0000000000000000000000000000000000000000..2c001c22b848007ce4f6ebc3b2453737cd0edc3f
--- /dev/null
+++ b/interface/web/mailuser/mail_user_cc_edit.php
@@ -0,0 +1,89 @@
+auth->check_module_permissions('mailuser');
+
+// Loading classes
+$app->uses('tpl,tform,tform_actions');
+$app->load('tform_actions');
+
+class page_action extends tform_actions {
+
+ function onShow() {
+
+ $this->id = $_SESSION['s']['user']['mailuser_id'];
+
+ parent::onShow();
+
+ }
+
+ function onSubmit() {
+ global $app;
+
+ $this->id = $_SESSION['s']['user']['mailuser_id'];
+ $rec = $app->tform->getDataRecord($this->id);
+ if(isset($_POST['cc']) && trim($_POST['cc']) == $rec['email']) {
+ $app->tform->errorMessage .= $app->tform->lng('email_is_cc_error');
+ }
+
+ parent::onSubmit();
+
+ }
+
+function onShowEnd() {
+ global $app, $conf;
+
+ $rec = $app->tform->getDataRecord($this->id);
+ $app->tpl->setVar("email", $rec['email']);
+
+ parent::onShowEnd();
+ }
+
+
+}
+
+$app->tform_actions = new page_action;
+$app->tform_actions->onLoad();
+
+?>
diff --git a/interface/web/mailuser/mail_user_filter_del.php b/interface/web/mailuser/mail_user_filter_del.php
new file mode 100644
index 0000000000000000000000000000000000000000..f1696d974da0676e9f3fabfa2dd4982eee7cabb1
--- /dev/null
+++ b/interface/web/mailuser/mail_user_filter_del.php
@@ -0,0 +1,59 @@
+auth->check_module_permissions('mailuser');
+
+// Loading classes
+$app->uses('tpl,tform,tform_actions');
+$app->load('tform_actions');
+
+class page_action extends tform_actions {
+
+}
+
+$page = new page_action;
+$page->onDelete();
+
+?>
\ No newline at end of file
diff --git a/interface/web/mailuser/mail_user_filter_edit.php b/interface/web/mailuser/mail_user_filter_edit.php
new file mode 100644
index 0000000000000000000000000000000000000000..afbfb7dc596d38ff546093233f750d1a67a9cf5d
--- /dev/null
+++ b/interface/web/mailuser/mail_user_filter_edit.php
@@ -0,0 +1,107 @@
+auth->check_module_permissions('mailuser');
+
+// Loading classes
+$app->uses('tpl,tform,tform_actions');
+$app->load('tform_actions');
+
+class page_action extends tform_actions {
+
+ function onShowNew() {
+ global $app, $conf;
+
+ // we will check the limits only when the email address belongs to a client and not the admin
+ if($_SESSION["s"]["user"]["default_group"] > 0) {
+ if(!$app->tform->checkClientLimit('limit_mailfilter',"")) {
+ $app->error($app->tform->lng("limit_mailfilter_txt"));
+ }
+ if(!$app->tform->checkResellerLimit('limit_mailfilter',"")) {
+ $app->error('Reseller: '.$app->tform->lng("limit_mailfilter_txt"));
+ }
+ }
+
+ parent::onShowNew();
+ }
+
+
+ function onSubmit() {
+ global $app, $conf;
+
+ // Get the parent mail_user record
+ $mailuser = $app->db->queryOneRecord("SELECT * FROM mail_user WHERE mailuser_id = '".intval($_SESSION['s']['user']['mailuser_id'])."'");
+
+ // Set the mailuser_id
+ $this->dataRecord["mailuser_id"] = $mailuser["mailuser_id"];
+
+ // Remove leading dots
+ if(substr($this->dataRecord['target'],0,1) == '.') $this->dataRecord['target'] = substr($this->dataRecord['target'],1);
+
+
+ // Check the client limits if the email address is assigned to a client
+ if($_SESSION["s"]["user"]["default_group"] > 0) { // if user is not admin
+ // Get the limits of the client
+ $client_group_id = $_SESSION["s"]["user"]["default_group"];
+ $client = $app->db->queryOneRecord("SELECT limit_mailfilter FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
+
+ // Check if the user may add another filter
+ if($this->id == 0 && $client["limit_mailfilter"] >= 0) {
+ $tmp = $app->db->queryOneRecord("SELECT count(filter_id) as number FROM mail_user_filter WHERE sys_groupid = $client_group_id");
+ if($tmp["number"] >= $client["limit_mailfilter"]) {
+ $app->tform->errorMessage .= $app->tform->lng("limit_mailfilter_txt")."
";
+ }
+ unset($tmp);
+ }
+ } // end if user is not admin
+
+ parent::onSubmit();
+ }
+
+}
+
+$page = new page_action;
+$page->onLoad();
+
+?>
\ No newline at end of file
diff --git a/interface/web/mailuser/mail_user_filter_list.php b/interface/web/mailuser/mail_user_filter_list.php
new file mode 100644
index 0000000000000000000000000000000000000000..43d7eecb2263fc269902942ec63ebbb7cf618404
--- /dev/null
+++ b/interface/web/mailuser/mail_user_filter_list.php
@@ -0,0 +1,32 @@
+auth->check_module_permissions('mailuser');
+
+$app->load('listform_actions');
+
+
+class list_action extends listform_actions {
+
+}
+
+$list = new list_action;
+
+$list->SQLExtWhere = "mailuser_id = ".$_SESSION['s']['user']['mailuser_id'];
+
+$list->onLoad();
+
+
+?>
\ No newline at end of file
diff --git a/interface/web/mailuser/mail_user_password_edit.php b/interface/web/mailuser/mail_user_password_edit.php
new file mode 100644
index 0000000000000000000000000000000000000000..22eea896fc29141f617be9eb4ee3b93e648c5f00
--- /dev/null
+++ b/interface/web/mailuser/mail_user_password_edit.php
@@ -0,0 +1,75 @@
+auth->check_module_permissions('mailuser');
+
+// Loading classes
+$app->uses('tpl,tform,tform_actions');
+$app->load('tform_actions');
+
+class page_action extends tform_actions {
+
+ function onSubmit() {
+
+ $this->id = $_SESSION['s']['user']['mailuser_id'];
+
+ parent::onSubmit();
+
+ }
+
+ function onShowEnd() {
+ global $app, $conf;
+
+ $rec = $app->tform->getDataRecord($_SESSION['s']['user']['mailuser_id']);
+ $app->tpl->setVar("email", $rec['email']);
+
+ parent::onShowEnd();
+ }
+
+}
+
+$app->tform_actions = new page_action;
+$app->tform_actions->onLoad();
+
+?>
diff --git a/interface/web/mailuser/mail_user_spamfilter_edit.php b/interface/web/mailuser/mail_user_spamfilter_edit.php
new file mode 100644
index 0000000000000000000000000000000000000000..e226b3bd260a36e67b3a42a981bce7200cce5c99
--- /dev/null
+++ b/interface/web/mailuser/mail_user_spamfilter_edit.php
@@ -0,0 +1,130 @@
+auth->check_module_permissions('mailuser');
+
+// Loading classes
+$app->uses('tpl,tform,tform_actions');
+$app->load('tform_actions');
+
+class page_action extends tform_actions {
+
+ function onShow() {
+
+ $this->id = $_SESSION['s']['user']['mailuser_id'];
+
+ parent::onShow();
+
+ }
+
+ function onSubmit() {
+ global $app;
+
+ $this->id = $_SESSION['s']['user']['mailuser_id'];
+
+ parent::onSubmit();
+
+ }
+
+ function onAfterUpdate() {
+ global $app, $conf;
+
+ $rec = $app->tform->getDataRecord($this->id);
+ $email_parts = explode('@',$rec['email']);
+ $email_domain = $email_parts[1];
+ $domain = $app->db->queryOneRecord("SELECT sys_userid, sys_groupid, server_id FROM mail_domain WHERE domain = '".$app->db->quote($email_domain)."'");
+
+ // Spamfilter policy
+ $policy_id = intval($this->dataRecord["policy"]);
+ $tmp_user = $app->db->queryOneRecord("SELECT id FROM spamfilter_users WHERE email = '".$app->db->quote($rec["email"])."'");
+ if($policy_id > 0) {
+ if($tmp_user["id"] > 0) {
+ // There is already a record that we will update
+ $app->db->datalogUpdate('spamfilter_users', "policy_id = $policy_id", 'id', $tmp_user["id"]);
+ } else {
+ // We create a new record
+ $insert_data = "(`sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `server_id`, `priority`, `policy_id`, `email`, `fullname`, `local`)
+ VALUES (".$domain["sys_userid"].", ".$domain["sys_groupid"].", 'riud', 'riud', '', ".$domain["server_id"].", 10, ".$policy_id.", '".$app->db->quote($rec["email"])."', '".$app->db->quote($rec["email"])."', 'Y')";
+ $app->db->datalogInsert('spamfilter_users', $insert_data, 'id');
+ }
+ }else {
+ if($tmp_user["id"] > 0) {
+ // There is already a record but the user shall have no policy, so we delete it
+ $app->db->datalogDelete('spamfilter_users', 'id', $tmp_user["id"]);
+ }
+ } // endif spamfilter policy
+ }
+
+ function onShowEnd() {
+ global $app, $conf;
+
+ $rec = $app->tform->getDataRecord($this->id);
+ $app->tpl->setVar("email", $rec['email']);
+
+ // Get the spamfilter policys for the user
+ $tmp_user = $app->db->queryOneRecord("SELECT policy_id FROM spamfilter_users WHERE email = '".$rec['email']."'");
+ $sql = "SELECT id, policy_name FROM spamfilter_policy WHERE ".$app->tform->getAuthSQL('r');
+ $policys = $app->db->queryAllRecords($sql);
+ $policy_select = "";
+ if(is_array($policys)) {
+ foreach( $policys as $p) {
+ $selected = ($p["id"] == $tmp_user["policy_id"])?'SELECTED':'';
+ $policy_select .= "\r\n";
+ }
+ }
+ $app->tpl->setVar("policy",$policy_select);
+ unset($policys);
+ unset($policy_select);
+ unset($tmp_user);
+
+ parent::onShowEnd();
+ }
+
+
+}
+
+$app->tform_actions = new page_action;
+$app->tform_actions->onLoad();
+
+?>
diff --git a/interface/web/mailuser/templates/index.htm b/interface/web/mailuser/templates/index.htm
new file mode 100644
index 0000000000000000000000000000000000000000..2ae24bffe87e9ccfd541e8877a0fb2c53ead0d3c
--- /dev/null
+++ b/interface/web/mailuser/templates/index.htm
@@ -0,0 +1,32 @@
+