Till Brehm
2016-07-24 b9a3ef486ebcde18a5ade37865ff8f397185d24f
commit | author | age
e22f1e 1 <?php
T 2
3 /*
4     Form Definition
5
6     Tabledefinition
7
8     Datatypes:
9     - INTEGER (Forces the input to Int)
10     - DOUBLE
11     - CURRENCY (Formats the values to currency notation)
12     - VARCHAR (no format check, maxlength: 255)
13     - TEXT (no format check)
14     - DATE (Dateformat, automatic conversion to timestamps)
15
16     Formtype:
17     - TEXT (Textfield)
18     - TEXTAREA (Textarea)
19     - PASSWORD (Password textfield, input is not shown when edited)
20     - SELECT (Select option field)
21     - RADIO
22     - CHECKBOX
23     - CHECKBOXARRAY
24     - FILE
25
26     VALUE:
27     - Wert oder Array
28
29     Hint:
30     The ID field of the database table is not part of the datafield definition.
31     The ID field must be always auto incement (int or bigint).
b1a6a5 32
4c28d9 33     Search:
F 34     - searchable = 1 or searchable = 2 include the field in the search
35     - searchable = 1: this field will be the title of the search result
36     - searchable = 2: this field will be included in the description of the search result
e22f1e 37
T 38
39 */
65ea2e 40 global $app;
bd68aa 41 $app->uses('getconf');
MC 42 $global_config = $app->getconf->get_global_config();
e22f1e 43
b1a6a5 44 $form["title"]    = "Mailbox";
MC 45 $form["description"]  = "";
46 $form["name"]    = "mail_user";
47 $form["action"]   = "mail_user_edit.php";
48 $form["db_table"]  = "mail_user";
49 $form["db_table_idx"] = "mailuser_id";
50 $form["db_history"]  = "yes";
51 $form["tab_default"] = "mailuser";
52 $form["list_default"] = "mail_user_list.php";
53 $form["auth"]   = 'yes'; // yes / no
e22f1e 54
T 55 $form["auth_preset"]["userid"]  = 0; // 0 = id of the user, > 0 id must match with id of current user
56 $form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user
57 $form["auth_preset"]["perm_user"] = 'riud'; //r = read, i = insert, u = update, d = delete
58 $form["auth_preset"]["perm_group"] = 'riud'; //r = read, i = insert, u = update, d = delete
59 $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
60
c99650 61 $form["tabs"]['mailuser'] = array(
b1a6a5 62     'title'  => "Mailbox",
MC 63     'width'  => 100,
64     'template'  => "templates/mail_user_mailbox_edit.htm",
65     'fields'  => array (
66         //#################################
67         // Begin Datatable fields
68         //#################################
e22f1e 69         'server_id' => array (
b1a6a5 70             'datatype' => 'INTEGER',
MC 71             'formtype' => 'TEXT',
72             'default' => '',
73             'value'  => '',
74             'width'  => '30',
75             'maxlength' => '255'
e22f1e 76         ),
T 77         'email' => array (
b1a6a5 78             'datatype' => 'VARCHAR',
MC 79             'formtype' => 'TEXT',
80             'filters'   => array( 0 => array( 'event' => 'SAVE',
81                     'type' => 'IDNTOASCII'),
82                 1 => array( 'event' => 'SHOW',
83                     'type' => 'IDNTOUTF8'),
84                 2 => array( 'event' => 'SAVE',
85                     'type' => 'TOLOWER')
86             ),
87             'validators' => array (  0 => array ( 'type' => 'ISEMAIL',
88                     'errmsg'=> 'email_error_isemail'),
89                 1 => array ( 'type' => 'UNIQUE',
90                     'errmsg'=> 'email_error_unique'),
91             ),
92             'default' => '',
93             'value'  => '',
94             'width'  => '30',
95             'maxlength' => '255',
4c28d9 96             'searchable' => 1
e22f1e 97         ),
b1a6a5 98         'login' => array (
MC 99             'datatype'  => 'VARCHAR',
100             'formtype'  => 'TEXT',
101             'filters'   => array( 0 => array( 'event' => 'SAVE',
102                     'type' => 'IDNTOASCII'),
103                 1 => array( 'event' => 'SHOW',
104                     'type' => 'IDNTOUTF8'),
105                 2 => array( 'event' => 'SAVE',
106                     'type' => 'TOLOWER')
107             ),
108             'validators'  => array (
109                 0 => array (  'type'  => 'UNIQUE',
110                     'errmsg'=> 'login_error_unique'),
111                 1 => array (  'type'  => 'REGEX',
1272df 112                     'regex' => '/^[_a-z0-9][\w\.\-_\+@]{1,63}$/',
b1a6a5 113                     'errmsg'=> 'login_error_regex'),
MC 114             ),
115             'default' => '',
116             'value'   => '',
117             'width'   => '30',
118             'maxlength' => '255'
119         ),
ac3b1f 120         'password' => array (
b1a6a5 121             'datatype' => 'VARCHAR',
MC 122             'formtype' => 'PASSWORD',
7b9388 123             'validators' => array(
MC 124                 0 => array(
125                     'type' => 'CUSTOM',
126                     'class' => 'validate_password',
127                     'function' => 'password_check',
128                     'errmsg' => 'weak_password_txt'
129                 )
130             ),
aad102 131             'encryption'=> 'CRYPTMAIL',
b1a6a5 132             'default' => '',
MC 133             'value'  => '',
134             'width'  => '30',
135             'maxlength' => '255'
e22f1e 136         ),
fd7b50 137         'name' => array (
b1a6a5 138             'datatype' => 'VARCHAR',
MC 139             'formtype' => 'TEXT',
140             'default' => '',
141             'value'  => '',
142             'width'  => '30',
143             'maxlength' => '255',
4c28d9 144             'searchable' => 2
fd7b50 145         ),
e22f1e 146         'quota' => array (
b1a6a5 147             'datatype' => 'VARCHAR',
MC 148             'formtype' => 'TEXT',
149             'validators' => array (  1 => array ( 'type' => 'ISINT',
150                     'errmsg'=> 'quota_error_isint'),
151                 0 => array ( 'type' => 'REGEX',
152                     'regex' => '/^([0-9]{1,})$/',
153                     'errmsg'=> 'quota_error_value'),
154             ),
155             'default' => '-1',
156             'value'  => '',
157             'width'  => '30',
158             'maxlength' => '255'
e22f1e 159         ),
2a704f 160         'cc' => array (
b1a6a5 161             'datatype' => 'VARCHAR',
MC 162             'formtype' => 'TEXT',
163             'filters'   => array( 0 => array( 'event' => 'SAVE',
164                     'type' => 'IDNTOASCII'),
165                 1 => array( 'event' => 'SHOW',
166                     'type' => 'IDNTOUTF8'),
167                 2 => array( 'event' => 'SAVE',
168                     'type' => 'TOLOWER')
169             ),
170             'validators' => array (  0 => array ( 'type' => 'REGEX',
f798aa 171                     'regex' => '/^(\w+[\w\.\-\+]*\w{0,}@\w+[\w.-]*\.[a-z\-]{2,10}){0,1}(,\s*\w+[\w\.\-\+]*\w{0,}@\w+[\w.-]*\.[a-z\-]{2,10}){0,}$/i',
b1a6a5 172                     'errmsg'=> 'cc_error_isemail'),
MC 173             ),
174             'default' => '',
175             'value'  => '',
176             'width'  => '30',
177             'maxlength' => '255'
2a704f 178         ),
f2d9d0 179         'sender_cc' => array (
R 180             'datatype' => 'VARCHAR',
181             'formtype' => 'TEXT',
182             'filters'   => array( 0 => array( 'event' => 'SAVE',
183                     'type' => 'IDNTOASCII'),
184                 1 => array( 'event' => 'SHOW',
185                     'type' => 'IDNTOUTF8'),
186                 2 => array( 'event' => 'SAVE',
187                     'type' => 'TOLOWER')
188             ),
189             'validators' => array (  0 => array ( 'type' => 'REGEX',
190                     'regex'=>'/^(\w+[\w\.\-\+]*\w{0,}@\w+[\w.-]*\.[a-z\-]{2,10}){0,1}(,\s*\w+[\w\.\-\+]*\w{0,}@\w+[\w.-]*\.[a-z\-]{2,10}){0,}$/i',
191                     'errmsg'=> 'sender_cc_error_isemail'),
192             ),
193             'default' => '',
194             'value'  => '',
195             'width'  => '30',
196             'maxlength' => '255'
197         ),
e22f1e 198         'maildir' => array (
b1a6a5 199             'datatype' => 'VARCHAR',
MC 200             'formtype' => 'TEXT',
201             'default' => '',
202             'value'  => '',
203             'width'  => '30',
204             'maxlength' => '255'
e22f1e 205         ),
315cd6 206         'maildir_format' => array (
TB 207             'datatype' => 'VARCHAR',
208             'formtype' => 'TEXT',
209             'default' => '',
210             'value'  => '',
211             'width'  => '30',
212             'maxlength' => '255'
213         ),
ac3b1f 214         'homedir' => array (
b1a6a5 215             'datatype' => 'VARCHAR',
MC 216             'formtype' => 'TEXT',
217             'default' => '',
218             'value'  => '',
219             'width'  => '30',
220             'maxlength' => '255'
ac3b1f 221         ),
T 222         'uid' => array (
b1a6a5 223             'datatype' => 'INTEGER',
MC 224             'formtype' => 'TEXT',
225             'default' => '',
226             'value'  => '',
227             'width'  => '10',
228             'maxlength' => '10'
ac3b1f 229         ),
T 230         'gid' => array (
b1a6a5 231             'datatype' => 'INTEGER',
MC 232             'formtype' => 'TEXT',
233             'default' => '',
234             'value'  => '',
235             'width'  => '10',
236             'maxlength' => '10'
ac3b1f 237         ),
T 238         'postfix' => array (
b1a6a5 239             'datatype' => 'VARCHAR',
MC 240             'formtype' => 'CHECKBOX',
241             'default' => 'y',
242             'value'  => array(1 => 'y', 0 => 'n')
ac3b1f 243         ),
75722e 244         'greylisting' => array (
D 245             'datatype' => 'VARCHAR',
246             'formtype' => 'CHECKBOX',
247             'default' => 'n',
248             'value'  => array(1 => 'y', 0 => 'n')
249         ),
4c0bc2 250         /*
ac3b1f 251         'access' => array (
45f11e 252             'datatype'    => 'VARCHAR',
e22f1e 253             'formtype'    => 'CHECKBOX',
3edf9d 254             'default'    => 'y',
45f11e 255             'value'        => array(1 => 'y',0 => 'n')
e22f1e 256         ),
4c0bc2 257         */
44c2dd 258         'disablesmtp' => array (
MC 259             'datatype' => 'VARCHAR',
260             'formtype' => 'CHECKBOX',
261             'default' => 'n',
262             'value'  => array(1 => 'y', 0 => 'n')
263         ),
4c0bc2 264         'disableimap' => array (
b1a6a5 265             'datatype' => 'VARCHAR',
MC 266             'formtype' => 'CHECKBOX',
267             'default' => 'n',
268             'value'  => array(1 => 'y', 0 => 'n')
4c0bc2 269         ),
T 270         'disablepop3' => array (
b1a6a5 271             'datatype' => 'VARCHAR',
MC 272             'formtype' => 'CHECKBOX',
273             'default' => 'n',
274             'value'  => array(1 => 'y', 0 => 'n')
4c0bc2 275         ),
b1a6a5 276         //#################################
MC 277         // END Datatable fields
278         //#################################
e22f1e 279     )
T 280 );
281
c99650 282 if($global_config['mail']['mail_password_onlyascii'] == 'y') {
MC 283     $form['tabs']['mailuser']['fields']['password']['validators'] = array( 0 => array( 'type' => 'ISASCII',
284         'errmsg' => 'email_error_isascii')
285     );
286 }
287
bd68aa 288 if ($global_config['mail']['mailbox_show_autoresponder_tab'] === 'y') {
MC 289     $form["tabs"]['autoresponder'] = array (
b1a6a5 290         'title'  => "Autoresponder",
MC 291         'width'  => 100,
292         'template'  => "templates/mail_user_autoresponder_edit.htm",
293         'fields'  => array (
294             //#################################
295             // Begin Datatable fields
296             //#################################
bd68aa 297             'autoresponder_subject' => array (
MC 298                 'datatype'  => 'VARCHAR',
299                 'formtype'  => 'TEXT',
300                 'default'   => 'Out of office reply',
301                 'value'     => '',
b1a6a5 302                 'width'  => '30',
MC 303                 'maxlength' => '255'
bd68aa 304             ),
MC 305             'autoresponder_text' => array (
b1a6a5 306                 'datatype' => 'TEXT',
MC 307                 'formtype' => 'TEXTAREA',
308                 'default' => '',
309                 'value'  => '',
310                 'cols'  => '30',
311                 'rows'  => '15'
bd68aa 312             ),
MC 313             'autoresponder' => array (
b1a6a5 314                 'datatype' => 'VARCHAR',
MC 315                 'formtype' => 'CHECKBOX',
316                 'default' => 'n',
317                 'value'  => array(1 => 'y', 0 => 'n')
bd68aa 318             ),
MC 319             'autoresponder_start_date' => array (
b1a6a5 320                 'datatype' => 'DATETIME',
MC 321                 'formtype' => 'DATETIME',
96ae77 322                 'validators'=> array ( 
TB 323                     0 => array ( 'type' => 'ISDATETIME',
324                         'allowempty' => 'y',
325                         'errmsg'=> 'autoresponder_start_date_is_no_date'),
326                     1 => array ( 'type' => 'CUSTOM',
b1a6a5 327                         'class' => 'validate_autoresponder',
MC 328                         'function' => 'start_date',
329                         'errmsg'=> 'autoresponder_start_date_is_required'),
bd68aa 330                 )
MC 331             ),
332             'autoresponder_end_date' => array (
b1a6a5 333                 'datatype' => 'DATETIME',
MC 334                 'formtype' => 'DATETIME',
96ae77 335                 'validators'=> array (  
TB 336                     0 => array ( 'type' => 'ISDATETIME',
337                         'allowempty' => 'y',
338                         'errmsg'=> 'autoresponder_end_date_is_no_date'),
339                     1 => array ( 'type' => 'CUSTOM',
b1a6a5 340                         'class' => 'validate_autoresponder',
MC 341                         'function' => 'end_date',
342                         'errmsg'=> 'autoresponder_end_date_isgreater'),
343                 ),
bd68aa 344             ),
b1a6a5 345             //#################################
MC 346             // END Datatable fields
347             //#################################
bd68aa 348         )
MC 349     );
d097c7 350 }
C 351
352
bd68aa 353 if ($global_config['mail']['mailbox_show_mail_filter_tab'] === 'y') {
MC 354     $form["tabs"]['filter_records'] = array (
b1a6a5 355         'title'  => "Mail Filter",
MC 356         'width'  => 100,
357         'template'  => "templates/mail_user_mailfilter_edit.htm",
358         'fields'  => array (
359             //#################################
360             // Begin Datatable fields
361             //#################################
bd68aa 362             'move_junk' => array (
b1a6a5 363                 'datatype' => 'VARCHAR',
MC 364                 'formtype' => 'CHECKBOX',
365                 'default' => 'n',
366                 'value'  => array(0 => 'n', 1 => 'y')
bd68aa 367             ),
b1a6a5 368             //#################################
MC 369             // END Datatable fields
370             //#################################
bd68aa 371         ),
MC 372         'plugins' => array (
373             'filter_records' => array (
374                 'class'   => 'plugin_listview',
375                 'options' => array(
b1a6a5 376                     'listdef' => 'list/mail_user_filter.list.php',
MC 377                     'sqlextwhere' => "mailuser_id = ".@$app->functions->intval(@$_REQUEST['id']),
378                     'sql_order_by' => "ORDER BY rulename"
379                 )
bd68aa 380             )
MC 381         )
382     );
383 }
384
385
386 if ($_SESSION["s"]["user"]["typ"] == 'admin' && $global_config['mail']['mailbox_show_custom_rules_tab'] === 'y') {
387     $form["tabs"]['mailfilter'] = array (
b1a6a5 388         'title'  => "Custom Rules",
MC 389         'width'  => 100,
390         'template'  => "templates/mail_user_custom_rules_edit.htm",
391         'fields'  => array (
392             //#################################
393             // Begin Datatable fields
394             //#################################
bd68aa 395             'custom_mailfilter' => array (
b1a6a5 396                 'datatype' => 'TEXT',
MC 397                 'formtype' => 'TEXTAREA',
398                 'default' => '',
399                 'value'  => '',
400                 'cols'  => '30',
401                 'rows'  => '15'
bd68aa 402             ),
b1a6a5 403             //#################################
MC 404             // END Datatable fields
405             //#################################
bd68aa 406         )
MC 407     );
408 }
409
f17718 410 //* Backup
FS 411 $form["tabs"]['backup'] = array (
412     'title'         => "Backup",
413     'width'         => 100,
414     'template'      => "templates/mail_user_backup.htm",
415     'readonly'      => false,
416     'fields'        => array (
417     ##################################
418     # Begin Datatable fields
419     ##################################
420         'backup_interval' => array (
421             'datatype'      => 'VARCHAR',
422             'formtype'      => 'SELECT',
423             'default'       => '',
424              'value'         => array('none' => 'no_backup_txt', 'daily' => 'daily_backup_txt', 'weekly' => 'weekly_backup_txt', 'monthly' => 'monthly_backup_txt')
425         ),
426         'backup_copies' => array (
427             'datatype'      => 'INTEGER',
428             'formtype'      => 'SELECT',
429             'default'       => '',
430             'value'         => array('1' => '1', '2' => '2', '3' => '3', '4' => '4', '5' => '5', '6' => '6', '7' => '7', '8' => '8', '9' => '9', '10' => '10')
431         ),
432     ##################################
433     # ENDE Datatable fields
434     ##################################
435     ),
436     'plugins' => array (
437         'backup_records' => array (
438             'class'   => 'plugin_backuplist_mail',
439             'options' => array(
440             )
441         )
442     )
443 );
d097c7 444
bd68aa 445 ?>