Commit b0711a41 authored by tbrehm's avatar tbrehm
Browse files

Implemented: FS#350 - Mailuser interface

parent 31e0d151
......@@ -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';
......
......@@ -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');
}
......
......@@ -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;
}
}
......
......@@ -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')) {
......
<?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',
'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
<?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',
'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
<?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"] = "Email filter";
$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' => @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',
'encryption'=> 'CRYPT',
'default' => '',
'value' => '',
'width' => '30',
'maxlength' => '255'
),
##################################
# END Datatable fields
##################################
)
);
?>
\ No newline at end of file
<?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",