tbrehm
2012-01-27 b0711a41c9cd3628507c424aba889d94b0c2cef2
Implemented: FS#350 - Mailuser interface
31 files added
5 files modified
1614 ■■■■■ changed files
interface/lib/lang/en.lng 1 ●●●● patch | view | raw | blame | history
interface/lib/plugins/mail_user_filter_plugin.inc.php 3 ●●●●● patch | view | raw | blame | history
interface/web/admin/form/users.tform.php 2 ●●● patch | view | raw | blame | history
interface/web/login/index.php 77 ●●●●● patch | view | raw | blame | history
interface/web/mailuser/form/mail_user_autoresponder.tform.php 109 ●●●●● patch | view | raw | blame | history
interface/web/mailuser/form/mail_user_cc.tform.php 80 ●●●●● patch | view | raw | blame | history
interface/web/mailuser/form/mail_user_filter.tform.php 136 ●●●●● patch | view | raw | blame | history
interface/web/mailuser/form/mail_user_password.tform.php 77 ●●●●● patch | view | raw | blame | history
interface/web/mailuser/form/mail_user_spamfilter.tform.php 69 ●●●●● patch | view | raw | blame | history
interface/web/mailuser/index.php 43 ●●●●● patch | view | raw | blame | history
interface/web/mailuser/lib/admin.conf.php 2 ●●●●● patch | view | raw | blame | history
interface/web/mailuser/lib/lang/en_index.lng 11 ●●●●● patch | view | raw | blame | history
interface/web/mailuser/lib/lang/en_mail_user_autoresponder.lng 12 ●●●●● patch | view | raw | blame | history
interface/web/mailuser/lib/lang/en_mail_user_cc.lng 7 ●●●●● patch | view | raw | blame | history
interface/web/mailuser/lib/lang/en_mail_user_filter.lng 20 ●●●●● patch | view | raw | blame | history
interface/web/mailuser/lib/lang/en_mail_user_filter_list.lng 8 ●●●●● patch | view | raw | blame | history
interface/web/mailuser/lib/lang/en_mail_user_password.lng 6 ●●●●● patch | view | raw | blame | history
interface/web/mailuser/lib/lang/en_mail_user_spamfilter.lng 6 ●●●●● patch | view | raw | blame | history
interface/web/mailuser/lib/module.conf.php 50 ●●●●● patch | view | raw | blame | history
interface/web/mailuser/lib/remote.conf.php 3 ●●●●● patch | view | raw | blame | history
interface/web/mailuser/list/mail_user_filter.list.php 60 ●●●●● patch | view | raw | blame | history
interface/web/mailuser/mail_user_autoresponder_edit.php 93 ●●●●● patch | view | raw | blame | history
interface/web/mailuser/mail_user_cc_edit.php 89 ●●●●● patch | view | raw | blame | history
interface/web/mailuser/mail_user_filter_del.php 59 ●●●●● patch | view | raw | blame | history
interface/web/mailuser/mail_user_filter_edit.php 107 ●●●●● patch | view | raw | blame | history
interface/web/mailuser/mail_user_filter_list.php 32 ●●●●● patch | view | raw | blame | history
interface/web/mailuser/mail_user_password_edit.php 75 ●●●●● patch | view | raw | blame | history
interface/web/mailuser/mail_user_spamfilter_edit.php 130 ●●●●● patch | view | raw | blame | history
interface/web/mailuser/templates/index.htm 32 ●●●●● patch | view | raw | blame | history
interface/web/mailuser/templates/mail_user_autoresponder_edit.htm 42 ●●●●● patch | view | raw | blame | history
interface/web/mailuser/templates/mail_user_cc_edit.htm 26 ●●●●● patch | view | raw | blame | history
interface/web/mailuser/templates/mail_user_filter_edit.htm 38 ●●●●● patch | view | raw | blame | history
interface/web/mailuser/templates/mail_user_filter_list.htm 46 ●●●●● patch | view | raw | blame | history
interface/web/mailuser/templates/mail_user_password_edit.htm 31 ●●●●● patch | view | raw | blame | history
interface/web/mailuser/templates/mail_user_spamfilter_edit.htm 28 ●●●●● patch | view | raw | blame | history
interface/web/themes/default/css/navigation/nav_top.css 4 ●●●● patch | view | raw | blame | history
interface/lib/lang/en.lng
@@ -34,6 +34,7 @@
$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';
interface/lib/plugins/mail_user_filter_plugin.inc.php
@@ -47,6 +47,9 @@
        $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');
        
    }
    
interface/web/admin/form/users.tform.php
@@ -87,7 +87,7 @@
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;
            }
        }
interface/web/login/index.php
@@ -60,7 +60,7 @@
        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 @@
                        $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) {
                            $saved_password = stripslashes($user['passwort']);
                            if(substr($saved_password,0,3) == '$1$') {
                                //* The password is crypt-md5 encrypted
                        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).'$';
                                if(crypt(stripslashes($passwort),$salt) != $saved_password) {
                                    $user = false;
                                }
                            } else {
                                //* The password is md5 encrypted
                                if(md5($passwort) != $saved_password) {
                                    $user = false;
                                //* 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'];
                                }
                            }
                        } else {
                            $user = false;
                            //* normal cp user login
                            $sql = "SELECT * FROM sys_user WHERE USERNAME = '$username'";
                            $user = $app->db->queryOneRecord($sql);
                            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 {
                                    //* The password is md5 encrypted
                                    if(md5($passwort) != $saved_password) {
                                        $user = false;
                                    }
                                }
                            } else {
                                $user = false;
                            }
                        }
                    }
                    
@@ -143,12 +171,13 @@
                            $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')) {
interface/web/mailuser/form/mail_user_autoresponder.tform.php
New file
@@ -0,0 +1,109 @@
<?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
    ##################################
    )
);
?>
interface/web/mailuser/form/mail_user_cc.tform.php
New file
@@ -0,0 +1,80 @@
<?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
    ##################################
    )
);
?>
interface/web/mailuser/form/mail_user_filter.tform.php
New file
@@ -0,0 +1,136 @@
<?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
    ##################################
    )
);
?>
interface/web/mailuser/form/mail_user_password.tform.php
New file
@@ -0,0 +1,77 @@
<?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
    ##################################
    )
);
?>
interface/web/mailuser/form/mail_user_spamfilter.tform.php
New file
@@ -0,0 +1,69 @@
<?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
    ##################################
    )
);
?>
interface/web/mailuser/index.php
New file
@@ -0,0 +1,43 @@
<?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 = '';
//* 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();
?>
interface/web/mailuser/lib/admin.conf.php
New file
@@ -0,0 +1,2 @@
<?php
?>
interface/web/mailuser/lib/lang/en_index.lng
New file
@@ -0,0 +1,11 @@
<?php
$wb["page_head_txt"] = 'Mailbox settings';
$wb["page_desc_txt"] = 'Here you can edit the settings for the email account.';
$wb["email_txt"] = 'Email address';
$wb["login_txt"] = 'Login';
$wb["cc_txt"] = 'Send copy to';
$wb["quota_txt"] = 'Mailbox size';
$wb["unlimited_txt"] = 'Unlimited';
$wb["mb_txt"] = 'MB';
$wb["none_txt"] = 'None';
?>
interface/web/mailuser/lib/lang/en_mail_user_autoresponder.lng
New file
@@ -0,0 +1,12 @@
<?php
$wb["mailbox_autoresponder_txt"] = 'Autoresponder';
$wb["autoresponder_subject"] = 'Out of office reply';
$wb["autoresponder_text_txt"] = 'Text';
$wb["autoresponder_txt"] = 'Active';
$wb["autoresponder_start_date_txt"] = 'Start on';
$wb["autoresponder_start_date_isfuture"] = 'Start date cannot be in the past.';
$wb["autoresponder_end_date_txt"] = 'End by';
$wb["autoresponder_end_date_isgreater"] = 'End date must be set and be later than start date.';
$wb['autoresponder_active'] = 'Enable the autoresponder';
$wb['now_txt']='Now';
?>
interface/web/mailuser/lib/lang/en_mail_user_cc.lng
New file
@@ -0,0 +1,7 @@
<?php
$wb["mailbox_cc_txt"] = 'Send copy to email address';
$wb["cc_txt"] = 'Send copy to';
$wb["email_txt"] = 'Email';
$wb["cc_error_isemail"] = 'Email address invalid in -Send copy to- field';
$wb["email_is_cc_error"] = 'Email address and send copy to address can not be the same.';
?>
interface/web/mailuser/lib/lang/en_mail_user_filter.lng
New file
@@ -0,0 +1,20 @@
<?php
$wb["rulename_txt"] = 'Name';
$wb["action_txt"] = 'Action';
$wb["target_txt"] = 'Folder';
$wb["active_txt"] = 'Active';
$wb["rulename_error_empty"] = 'Name is empty.';
$wb["searchterm_is_empty"] = 'Search term is empty.';
$wb["source_txt"] = 'Source';
$wb["target_error_regex"] = 'The target may only contain these characters: a-z, 0-9, -, ., _, and {space}';
$wb["limit_mailfilter_txt"] = 'The max. number of mailfilters is reached.';
$wb['subject_txt'] = 'Subject';
$wb['from_txt'] = 'From';
$wb['to_txt'] = 'To';
$wb['contains_txt'] = 'Contains';
$wb['is_txt'] = 'Is';
$wb['begins_with_txt'] = 'Begins with';
$wb['ends_with_txt'] = 'Ends with';
$wb['move_to_txt'] = 'Move to';
$wb['delete_txt'] = 'Delete';
?>
interface/web/mailuser/lib/lang/en_mail_user_filter_list.lng
New file
@@ -0,0 +1,8 @@
<?php
$wb["list_head_txt"] = 'Email filter rules';
$wb["rulename_txt"] = 'Name';
$wb["add_new_record_txt"] = 'Add new Filter';
$wb["page_txt"] = 'Page';
$wb["page_of_txt"] = 'of';
$wb["delete_confirmation"] = 'Do you really want to Delete the mailfilter?';
?>
interface/web/mailuser/lib/lang/en_mail_user_password.lng
New file
@@ -0,0 +1,6 @@
<?php
$wb["mailbox_password_txt"] = 'Mailbox password';
$wb["password_txt"] = 'Password';
$wb["password_strength_txt"] = 'Password strength';
$wb["email_txt"] = 'Email';
?>
interface/web/mailuser/lib/lang/en_mail_user_spamfilter.lng
New file
@@ -0,0 +1,6 @@
<?php
$wb["mailbox_spamfilter_txt"] = 'Spamfilter';
$wb["spamfilter_txt"] = 'Spamfilter';
$wb["email_txt"] = 'Email';
$wb["no_policy"] = '- not enabled -';
?>
interface/web/mailuser/lib/module.conf.php
New file
@@ -0,0 +1,50 @@
<?php
$userid=$app->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);
}
?>
interface/web/mailuser/lib/remote.conf.php
New file
@@ -0,0 +1,3 @@
<?php
?>
interface/web/mailuser/list/mail_user_filter.list.php
New file
@@ -0,0 +1,60 @@
<?php
/*
    Datatypes:
    - INTEGER
    - DOUBLE
    - CURRENCY
    - VARCHAR
    - TEXT
    - DATE
*/
// Name of the list
$liste["name"]                 = "mail_user_filter";
// Database table
$liste["table"]             = "mail_user_filter";
// Index index field of the database table
$liste["table_idx"]            = "filter_id";
// Search Field Prefix
$liste["search_prefix"]     = "search_";
// Records per page
$liste["records_per_page"]     = "15";
// Script File of the list
$liste["file"]                = "mail_user_list.php";
// Script file of the edit form
$liste["edit_file"]            = "mail_user_filter_edit.php";
// Script File of the delete script
$liste["delete_file"]        = "mail_user_filter_del.php";
// Paging Template
$liste["paging_tpl"]        = "templates/paging.tpl.htm";
// Enable auth
$liste["auth"]                = "no";
/*****************************************************
* Suchfelder
*****************************************************/
$liste["item"][] = array(    'field'        => "rulename",
                            'datatype'    => "VARCHAR",
                            'formtype'    => "TEXT",
                            'op'        => "like",
                            'prefix'    => "%",
                            'suffix'    => "%",
                            'width'        => "",
                            'value'        => "");
?>
interface/web/mailuser/mail_user_autoresponder_edit.php
New file
@@ -0,0 +1,93 @@
<?php
/*
Copyright (c) 2012, Till Brehm, ISPConfig UG
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
    * Redistributions of source code must retain the above copyright notice,
      this list of conditions and the following disclaimer.
    * Redistributions in binary form must reproduce the above copyright notice,
      this list of conditions and the following disclaimer in the documentation
      and/or other materials provided with the distribution.
    * Neither the name of ISPConfig nor the names of its contributors
      may be used to endorse or promote products derived from this software without
      specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/******************************************
* Begin Form configuration
******************************************/
$tform_def_file = "form/mail_user_autoresponder.tform.php";
/******************************************
* End Form configuration
******************************************/
require_once('../../lib/config.inc.php');
require_once('../../lib/app.inc.php');
//* Check permissions for module
$app->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();
?>
interface/web/mailuser/mail_user_cc_edit.php
New file
@@ -0,0 +1,89 @@
<?php
/*
Copyright (c) 2012, Till Brehm, ISPConfig UG
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
    * Redistributions of source code must retain the above copyright notice,
      this list of conditions and the following disclaimer.
    * Redistributions in binary form must reproduce the above copyright notice,
      this list of conditions and the following disclaimer in the documentation
      and/or other materials provided with the distribution.
    * Neither the name of ISPConfig nor the names of its contributors
      may be used to endorse or promote products derived from this software without
      specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/******************************************
* Begin Form configuration
******************************************/
$tform_def_file = "form/mail_user_cc.tform.php";
/******************************************
* End Form configuration
******************************************/
require_once('../../lib/config.inc.php');
require_once('../../lib/app.inc.php');
//* Check permissions for module
$app->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();
?>
interface/web/mailuser/mail_user_filter_del.php
New file
@@ -0,0 +1,59 @@
<?php
/*
Copyright (c) 2012, Till Brehm, ISPConfig UG
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
    * Redistributions of source code must retain the above copyright notice,
      this list of conditions and the following disclaimer.
    * Redistributions in binary form must reproduce the above copyright notice,
      this list of conditions and the following disclaimer in the documentation
      and/or other materials provided with the distribution.
    * Neither the name of ISPConfig nor the names of its contributors
      may be used to endorse or promote products derived from this software without
      specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/******************************************
* Begin Form configuration
******************************************/
$list_def_file = "list/mail_user_filter.list.php";
$tform_def_file = "form/mail_user_filter.tform.php";
/******************************************
* End Form configuration
******************************************/
require_once('../../lib/config.inc.php');
require_once('../../lib/app.inc.php');
//* Check permissions for module
$app->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();
?>
interface/web/mailuser/mail_user_filter_edit.php
New file
@@ -0,0 +1,107 @@
<?php
/*
Copyright (c) 2008, Till Brehm, projektfarm Gmbh
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
    * Redistributions of source code must retain the above copyright notice,
      this list of conditions and the following disclaimer.
    * Redistributions in binary form must reproduce the above copyright notice,
      this list of conditions and the following disclaimer in the documentation
      and/or other materials provided with the distribution.
    * Neither the name of ISPConfig nor the names of its contributors
      may be used to endorse or promote products derived from this software without
      specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/******************************************
* Begin Form configuration
******************************************/
$tform_def_file = "form/mail_user_filter.tform.php";
/******************************************
* End Form configuration
******************************************/
require_once('../../lib/config.inc.php');
require_once('../../lib/app.inc.php');
//* Check permissions for module
$app->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")."<br>";
                }
                unset($tmp);
            }
        } // end if user is not admin
        parent::onSubmit();
    }
}
$page = new page_action;
$page->onLoad();
?>
interface/web/mailuser/mail_user_filter_list.php
New file
@@ -0,0 +1,32 @@
<?php
require_once('../../lib/config.inc.php');
require_once('../../lib/app.inc.php');
/******************************************
* Begin Form configuration
******************************************/
$list_def_file = "list/mail_user_filter.list.php";
/******************************************
* End Form configuration
******************************************/
//* Check permissions for module
$app->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();
?>
interface/web/mailuser/mail_user_password_edit.php
New file
@@ -0,0 +1,75 @@
<?php
/*
Copyright (c) 2012, Till Brehm, ISPConfig UG
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
    * Redistributions of source code must retain the above copyright notice,
      this list of conditions and the following disclaimer.
    * Redistributions in binary form must reproduce the above copyright notice,
      this list of conditions and the following disclaimer in the documentation
      and/or other materials provided with the distribution.
    * Neither the name of ISPConfig nor the names of its contributors
      may be used to endorse or promote products derived from this software without
      specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/******************************************
* Begin Form configuration
******************************************/
$tform_def_file = "form/mail_user_password.tform.php";
/******************************************
* End Form configuration
******************************************/
require_once('../../lib/config.inc.php');
require_once('../../lib/app.inc.php');
//* Check permissions for module
$app->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();
?>
interface/web/mailuser/mail_user_spamfilter_edit.php
New file
@@ -0,0 +1,130 @@
<?php
/*
Copyright (c) 2012, Till Brehm, ISPConfig UG
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
    * Redistributions of source code must retain the above copyright notice,
      this list of conditions and the following disclaimer.
    * Redistributions in binary form must reproduce the above copyright notice,
      this list of conditions and the following disclaimer in the documentation
      and/or other materials provided with the distribution.
    * Neither the name of ISPConfig nor the names of its contributors
      may be used to endorse or promote products derived from this software without
      specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/******************************************
* Begin Form configuration
******************************************/
$tform_def_file = "form/mail_user_spamfilter.tform.php";
/******************************************
* End Form configuration
******************************************/
require_once('../../lib/config.inc.php');
require_once('../../lib/app.inc.php');
//* Check permissions for module
$app->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 = "<option value='0'>".$app->tform->lng("no_policy")."</option>";
        if(is_array($policys)) {
            foreach( $policys as $p) {
                $selected = ($p["id"] == $tmp_user["policy_id"])?'SELECTED':'';
                $policy_select .= "<option value='$p[id]' $selected>$p[policy_name]</option>\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();
?>
interface/web/mailuser/templates/index.htm
New file
@@ -0,0 +1,32 @@
<h2><tmpl_var name="page_head_txt"></h2>
<p><tmpl_var name="page_desc_txt"></p>
<div class="panel panel_mail_user">
  <div class="pnl_formsarea">
    <fieldset class="inlineLabels">
      <div class="ctrlHolder">
          <label for="password"><b>{tmpl_var name='email_txt'}</b></label>
        {tmpl_var name='email'}
      </div>
      <div class="ctrlHolder">
          <label for="password"><b>{tmpl_var name='login_txt'}</b></label>
        {tmpl_var name='login'}
      </div>
      <div class="ctrlHolder">
          <label for="password"><b>{tmpl_var name='quota_txt'}</b></label>
        {tmpl_var name='quota'}
      </div>
      <div class="ctrlHolder">
          <label for="password"><b>{tmpl_var name='cc_txt'}</b></label>
        {tmpl_var name='cc'}
      </div>
      <div class="buttonHolder buttons">
            &nbsp;
        </div>
    </fieldset>
  </div>
</div>
interface/web/mailuser/templates/mail_user_autoresponder_edit.htm
New file
@@ -0,0 +1,42 @@
<h2><tmpl_var name="list_head_txt"></h2>
<p><tmpl_var name="list_desc_txt"></p>
<div class="panel panel_mail_user">
    <div class="pnl_formsarea">
        <fieldset class="inlineLabels">
            <div class="ctrlHolder">
                <label for="autoresponder_subject">{tmpl_var name='autoresponder_subject_txt'}</label>
                <input type="text" name="autoresponder_subject" id="autoresponder_subject" maxlength='250' value="{tmpl_var name='autoresponder_subject'}" />
            </div>
            <div class="ctrlHolder">
                <label for="autoresponder_text">{tmpl_var name='autoresponder_text_txt'}</label>
                <textarea name="autoresponder_text" id="autoresponder_text" rows='15' cols='30'>{tmpl_var name='autoresponder_text'}</textarea>
            </div>
            <div class="ctrlHolder">
                <label for="autoresponder">{tmpl_var name='autoresponder_active'}</label>
                <input type="checkbox" value="y" id="autoresponder" name="autoresponder"
                    onclick="AR_ResetDates();" {tmpl_var name='ar_active'} />
            </div>
            <div class="ctrlHolder">
                <label for="autoresponder_start_date">{tmpl_var name='autoresponder_start_date_txt'}</label>
                {tmpl_var name='autoresponder_start_date'}&nbsp;
                <a href="javascript:AR_SetNow();">{tmpl_var name='now_txt'}</a>
            </div>
            <div class="ctrlHolder">
                <label for="autoresponder_end_date">{tmpl_var name='autoresponder_end_date_txt'}</label>
                {tmpl_var name='autoresponder_end_date'}
            </div>
        </fieldset>
        <input type="hidden" name="id" value="{tmpl_var name='id'}">
        <div class="buttonHolder buttons">
            <button class="positive iconstxt icoPositive" type="button"
                value="{tmpl_var name='btn_save_txt'}" onClick="submitForm('pageForm','mailuser/mail_user_autoresponder_edit.php');">
                <span>{tmpl_var name='btn_save_txt'}</span>
            </button>
            <button class="negative iconstxt icoNegative" type="button" value="{tmpl_var name='btn_cancel_txt'}"
                onClick="loadContent('mailuser/index.php');">
                <span>{tmpl_var name='btn_cancel_txt'}</span>
            </button>
        </div>
    </div>
</div>
interface/web/mailuser/templates/mail_user_cc_edit.htm
New file
@@ -0,0 +1,26 @@
<h2><tmpl_var name="list_head_txt"></h2>
<p><tmpl_var name="list_desc_txt"></p>
<div class="panel panel_mail_user">
  <div class="pnl_formsarea">
    <fieldset class="inlineLabels">
      <div class="ctrlHolder">
          <label for="password">{tmpl_var name='email_txt'}</label>
        {tmpl_var name='email'}
      </div>
      <div class="ctrlHolder">
          <label for="name">{tmpl_var name='cc_txt'}</label>
        <input name="cc" id="cc" value="{tmpl_var name='cc'}" size="30" maxlength="255" type="text" class="textInput" /> &nbsp; {tmpl_var name='name_optional_txt'}
      </div>
    </fieldset>
    <input type="hidden" name="id" value="{tmpl_var name='id'}">
    <div class="buttonHolder buttons">
      <button class="positive iconstxt icoPositive" type="button" value="{tmpl_var name='btn_save_txt'}" onClick="submitForm('pageForm','mailuser/mail_user_cc_edit.php');"><span>{tmpl_var name='btn_save_txt'}</span></button>
      <button class="negative iconstxt icoNegative" type="button" value="{tmpl_var name='btn_cancel_txt'}" onClick="loadContent('mailuser/index.php');"><span>{tmpl_var name='btn_cancel_txt'}</span></button>
    </div>
  </div>
</div>
interface/web/mailuser/templates/mail_user_filter_edit.htm
New file
@@ -0,0 +1,38 @@
<h2><tmpl_var name="list_head_txt"></h2>
<p><tmpl_var name="list_desc_txt"></p>
<div class="panel panel_mail_user_filter">
  <div class="pnl_formsarea">
    <fieldset class="inlineLabels">
      <div class="ctrlHolder">
        <label for="rulename" class="wf_preField">{tmpl_var name='rulename_txt'}</label>
        <input type="text" id="rulename" name="rulename" value="{tmpl_var name='rulename'}" size="30" maxlength="255"  class="textInput">
      </div>
      <div class="ctrlHolder">
        <label for="source" class="wf_preField">{tmpl_var name='source_txt'}</label>
        <select id="source" name="source"  class="textInput formLengthHalf">{tmpl_var name='source'}</select>
        <select id="op" name="op"  class="textInput formLengthHalf">{tmpl_var name='op'}</select>
        <input type="text" id="searchterm" name="searchterm" value="{tmpl_var name='searchterm'}" size="30" maxlength="255"  class="textInput">
      </div>
      <div class="ctrlHolder">
        <label for="action" class="wf_preField">{tmpl_var name='action_txt'}</label>
        <select id="action" name="action" class="textInput formLengthHalf">{tmpl_var name='action'}</select>
        <input type="text" id="target" name="target" value="{tmpl_var name='target'}" size="30" maxlength="255"  class="textInput formLengthHalf">
      </div>
      <div class="ctrlHolder">
        <label for="active" class="wf_preField">{tmpl_var name='active_txt'}</label>
        <span class="">{tmpl_var name='active'}</span>
      </div>
    </fieldset>
    <input type="hidden" name="id" value="{tmpl_var name='id'}">
    <input name="mailuser_id" type="hidden" value="{tmpl_var name='mailuser_id'}">
    <div class="buttonHolder buttons">
      <button class="positive iconstxt icoPositive" type="button" value="{tmpl_var name='btn_save_txt'}" onClick="submitForm('pageForm','mailuser/mail_user_filter_edit.php');"><span>{tmpl_var name='btn_save_txt'}</span></button>
      <button class="negative iconstxt icoNegative" type="button" value="{tmpl_var name='btn_cancel_txt'}" onClick="loadContent('mailuser/mail_user_edit.php?id={tmpl_var name='mailuser_id'}');"><span>{tmpl_var name='btn_cancel_txt'}</span></button>
    </div>
  </div>
</div>
interface/web/mailuser/templates/mail_user_filter_list.htm
New file
@@ -0,0 +1,46 @@
<h2><tmpl_var name="list_head_txt"></h2>
  <div class="pnl_toolsarea">
    <fieldset><legend>{tmpl_var name="toolsarea_head_txt"}</legend>
      <div class="buttons">
        <button class="iconstxt icoAdd" type="button" onClick="loadContent('mailuser/mail_user_filter_edit.php');">
          <span>{tmpl_var name="add_new_record_txt"}</span>
        </button>
      </div>
    </fieldset>
  </div>
  <div class="pnl_listarea">
    <fieldset><legend><tmpl_var name="list_head_txt"></legend>
      <table class="list">
        <thead>
          <tr>
            <th class="tbl_col_rulename" scope="col"><tmpl_var name="rulename_txt"></th>
            <th class="tbl_col_buttons" scope="col">&nbsp;</th>
          </tr>
          <tr>
            <td class="tbl_col_rulename"><input type="text" name="search_rulename" value="{tmpl_var name='search_rulename'}" /></td>
            <td class="tbl_col_buttons"><div class="buttons"><button type="button" class="icons16 icoFilter" name="Filter" id="Filter" value="{tmpl_var name="filter_txt"}" onClick="submitForm('pageForm','mail/mail_user_edit.php');"><span>{tmpl_var name="filter_txt"}</span></button></div></td>
          </tr>
        </thead>
        <tbody>
          <tmpl_loop name="records">
          <tr class="tbl_row_<tmpl_if name='__EVEN__'}even<tmpl_else>uneven</tmpl_if>">
            <td class="tbl_col_rulename"><a href="#" onClick="loadContent('mailuser/mail_user_filter_edit.php?id={tmpl_var name='id'}');">{tmpl_var name="rulename"}</a></td>
            <td class="tbl_col_buttons">
              <div class="buttons icons16">
                <a class="icons16 icoDelete" href="javascript: del_record('mailuser/mail_user_filter_del.php?id={tmpl_var name='id'}&phpsessid={tmpl_var name='phpsessid'}','{tmpl_var name='delete_confirmation'}');"><span>{tmpl_var name='delete_txt'}</span></a>
              </div>
            </td>
          </tr>
          </tmpl_loop>
        </tbody>
        <tfoot>
          <tr>
            <td class="tbl_footer tbl_paging" colspan="3"><tmpl_var name="paging"></td>
          </tr>
        </tfoot>
      </table>
    </fieldset>
  </div>
interface/web/mailuser/templates/mail_user_password_edit.htm
New file
@@ -0,0 +1,31 @@
<h2><tmpl_var name="list_head_txt"></h2>
<p><tmpl_var name="list_desc_txt"></p>
<div class="panel panel_mail_user">
  <div class="pnl_formsarea">
    <fieldset class="inlineLabels">
      <div class="ctrlHolder">
          <label for="password">{tmpl_var name='email_txt'}</label>
        {tmpl_var name='email'}
      </div>
      <div class="ctrlHolder">
          <label for="password">{tmpl_var name='password_txt'}</label>
        <input name="password" id="password" value="{tmpl_var name='password'}" size="30" maxlength="255" type="password" class="textInput" onkeyup="pass_check(this.value)" />
      </div>
      <div class="ctrlHolder">
                <p class="label">{tmpl_var name='password_strength_txt'}</p>
                <div id="passBar"></div>
                <p class="formHint"><span id="passText">&nbsp;</span></p>
      </div>
    </fieldset>
    <input type="hidden" name="id" value="{tmpl_var name='id'}">
    <div class="buttonHolder buttons">
      <button class="positive iconstxt icoPositive" type="button" value="{tmpl_var name='btn_save_txt'}" onClick="submitForm('pageForm','mailuser/mail_user_password_edit.php');"><span>{tmpl_var name='btn_save_txt'}</span></button>
      <button class="negative iconstxt icoNegative" type="button" value="{tmpl_var name='btn_cancel_txt'}" onClick="loadContent('mailuser/index.php');"><span>{tmpl_var name='btn_cancel_txt'}</span></button>
    </div>
  </div>
</div>
interface/web/mailuser/templates/mail_user_spamfilter_edit.htm
New file
@@ -0,0 +1,28 @@
<h2><tmpl_var name="list_head_txt"></h2>
<p><tmpl_var name="list_desc_txt"></p>
<div class="panel panel_mail_user">
  <div class="pnl_formsarea">
    <fieldset class="inlineLabels">
      <div class="ctrlHolder">
          <label for="password">{tmpl_var name='email_txt'}</label>
        {tmpl_var name='email'}
      </div>
      <div class="ctrlHolder">
          <label for="policy">{tmpl_var name='policy_txt'}</label>
        <select name="policy" id="policy" class="selectInput">
                    {tmpl_var name='policy'}
                </select>
            </div>
    </fieldset>
    <input type="hidden" name="id" value="{tmpl_var name='id'}">
    <div class="buttonHolder buttons">
      <button class="positive iconstxt icoPositive" type="button" value="{tmpl_var name='btn_save_txt'}" onClick="submitForm('pageForm','mailuser/mail_user_spamfilter_edit.php');"><span>{tmpl_var name='btn_save_txt'}</span></button>
      <button class="negative iconstxt icoNegative" type="button" value="{tmpl_var name='btn_cancel_txt'}" onClick="loadContent('mailuser/index.php');"><span>{tmpl_var name='btn_cancel_txt'}</span></button>
    </div>
  </div>
</div>
interface/web/themes/default/css/navigation/nav_top.css
@@ -66,6 +66,10 @@
    .topnav-mail {
        background-image: url('../../icons/x32/email.png') !important;
    }
    .topnav-mailuser {
        background-image: url('../../icons/x32/email.png') !important;
    }
    .topnav-monitor {
        background-image: url('../../icons/x32/monitor.png') !important;