Marius Burkard
2016-04-20 4569cae57f127afd093794310ccd290d2d9fdf36
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             ),
e22f1e 131             'encryption'=> 'CRYPT',
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         ),
ac3b1f 206         'homedir' => array (
b1a6a5 207             'datatype' => 'VARCHAR',
MC 208             'formtype' => 'TEXT',
209             'default' => '',
210             'value'  => '',
211             'width'  => '30',
212             'maxlength' => '255'
ac3b1f 213         ),
T 214         'uid' => array (
b1a6a5 215             'datatype' => 'INTEGER',
MC 216             'formtype' => 'TEXT',
217             'default' => '',
218             'value'  => '',
219             'width'  => '10',
220             'maxlength' => '10'
ac3b1f 221         ),
T 222         'gid' => array (
b1a6a5 223             'datatype' => 'INTEGER',
MC 224             'formtype' => 'TEXT',
225             'default' => '',
226             'value'  => '',
227             'width'  => '10',
228             'maxlength' => '10'
ac3b1f 229         ),
T 230         'postfix' => array (
b1a6a5 231             'datatype' => 'VARCHAR',
MC 232             'formtype' => 'CHECKBOX',
233             'default' => 'y',
234             'value'  => array(1 => 'y', 0 => 'n')
ac3b1f 235         ),
75722e 236         'greylisting' => array (
D 237             'datatype' => 'VARCHAR',
238             'formtype' => 'CHECKBOX',
239             'default' => 'n',
240             'value'  => array(1 => 'y', 0 => 'n')
241         ),
4c0bc2 242         /*
ac3b1f 243         'access' => array (
45f11e 244             'datatype'    => 'VARCHAR',
e22f1e 245             'formtype'    => 'CHECKBOX',
3edf9d 246             'default'    => 'y',
45f11e 247             'value'        => array(1 => 'y',0 => 'n')
e22f1e 248         ),
4c0bc2 249         */
44c2dd 250         'disablesmtp' => array (
MC 251             'datatype' => 'VARCHAR',
252             'formtype' => 'CHECKBOX',
253             'default' => 'n',
254             'value'  => array(1 => 'y', 0 => 'n')
255         ),
4c0bc2 256         'disableimap' => array (
b1a6a5 257             'datatype' => 'VARCHAR',
MC 258             'formtype' => 'CHECKBOX',
259             'default' => 'n',
260             'value'  => array(1 => 'y', 0 => 'n')
4c0bc2 261         ),
T 262         'disablepop3' => array (
b1a6a5 263             'datatype' => 'VARCHAR',
MC 264             'formtype' => 'CHECKBOX',
265             'default' => 'n',
266             'value'  => array(1 => 'y', 0 => 'n')
4c0bc2 267         ),
b1a6a5 268         //#################################
MC 269         // END Datatable fields
270         //#################################
e22f1e 271     )
T 272 );
273
c99650 274 if($global_config['mail']['mail_password_onlyascii'] == 'y') {
MC 275     $form['tabs']['mailuser']['fields']['password']['validators'] = array( 0 => array( 'type' => 'ISASCII',
276         'errmsg' => 'email_error_isascii')
277     );
278 }
279
bd68aa 280 if ($global_config['mail']['mailbox_show_autoresponder_tab'] === 'y') {
MC 281     $form["tabs"]['autoresponder'] = array (
b1a6a5 282         'title'  => "Autoresponder",
MC 283         'width'  => 100,
284         'template'  => "templates/mail_user_autoresponder_edit.htm",
285         'fields'  => array (
286             //#################################
287             // Begin Datatable fields
288             //#################################
bd68aa 289             'autoresponder_subject' => array (
MC 290                 'datatype'  => 'VARCHAR',
291                 'formtype'  => 'TEXT',
292                 'default'   => 'Out of office reply',
293                 'value'     => '',
b1a6a5 294                 'width'  => '30',
MC 295                 'maxlength' => '255'
bd68aa 296             ),
MC 297             'autoresponder_text' => array (
b1a6a5 298                 'datatype' => 'TEXT',
MC 299                 'formtype' => 'TEXTAREA',
300                 'default' => '',
301                 'value'  => '',
302                 'cols'  => '30',
303                 'rows'  => '15'
bd68aa 304             ),
MC 305             'autoresponder' => array (
b1a6a5 306                 'datatype' => 'VARCHAR',
MC 307                 'formtype' => 'CHECKBOX',
308                 'default' => 'n',
309                 'value'  => array(1 => 'y', 0 => 'n')
bd68aa 310             ),
MC 311             'autoresponder_start_date' => array (
b1a6a5 312                 'datatype' => 'DATETIME',
MC 313                 'formtype' => 'DATETIME',
96ae77 314                 'validators'=> array ( 
TB 315                     0 => array ( 'type' => 'ISDATETIME',
316                         'allowempty' => 'y',
317                         'errmsg'=> 'autoresponder_start_date_is_no_date'),
318                     1 => array ( 'type' => 'CUSTOM',
b1a6a5 319                         'class' => 'validate_autoresponder',
MC 320                         'function' => 'start_date',
321                         'errmsg'=> 'autoresponder_start_date_is_required'),
bd68aa 322                 )
MC 323             ),
324             'autoresponder_end_date' => array (
b1a6a5 325                 'datatype' => 'DATETIME',
MC 326                 'formtype' => 'DATETIME',
96ae77 327                 'validators'=> array (  
TB 328                     0 => array ( 'type' => 'ISDATETIME',
329                         'allowempty' => 'y',
330                         'errmsg'=> 'autoresponder_end_date_is_no_date'),
331                     1 => array ( 'type' => 'CUSTOM',
b1a6a5 332                         'class' => 'validate_autoresponder',
MC 333                         'function' => 'end_date',
334                         'errmsg'=> 'autoresponder_end_date_isgreater'),
335                 ),
bd68aa 336             ),
b1a6a5 337             //#################################
MC 338             // END Datatable fields
339             //#################################
bd68aa 340         )
MC 341     );
d097c7 342 }
C 343
344
bd68aa 345 if ($global_config['mail']['mailbox_show_mail_filter_tab'] === 'y') {
MC 346     $form["tabs"]['filter_records'] = array (
b1a6a5 347         'title'  => "Mail Filter",
MC 348         'width'  => 100,
349         'template'  => "templates/mail_user_mailfilter_edit.htm",
350         'fields'  => array (
351             //#################################
352             // Begin Datatable fields
353             //#################################
bd68aa 354             'move_junk' => array (
b1a6a5 355                 'datatype' => 'VARCHAR',
MC 356                 'formtype' => 'CHECKBOX',
357                 'default' => 'n',
358                 'value'  => array(0 => 'n', 1 => 'y')
bd68aa 359             ),
b1a6a5 360             //#################################
MC 361             // END Datatable fields
362             //#################################
bd68aa 363         ),
MC 364         'plugins' => array (
365             'filter_records' => array (
366                 'class'   => 'plugin_listview',
367                 'options' => array(
b1a6a5 368                     'listdef' => 'list/mail_user_filter.list.php',
MC 369                     'sqlextwhere' => "mailuser_id = ".@$app->functions->intval(@$_REQUEST['id']),
370                     'sql_order_by' => "ORDER BY rulename"
371                 )
bd68aa 372             )
MC 373         )
374     );
375 }
376
377
378 if ($_SESSION["s"]["user"]["typ"] == 'admin' && $global_config['mail']['mailbox_show_custom_rules_tab'] === 'y') {
379     $form["tabs"]['mailfilter'] = array (
b1a6a5 380         'title'  => "Custom Rules",
MC 381         'width'  => 100,
382         'template'  => "templates/mail_user_custom_rules_edit.htm",
383         'fields'  => array (
384             //#################################
385             // Begin Datatable fields
386             //#################################
bd68aa 387             'custom_mailfilter' => array (
b1a6a5 388                 'datatype' => 'TEXT',
MC 389                 'formtype' => 'TEXTAREA',
390                 'default' => '',
391                 'value'  => '',
392                 'cols'  => '30',
393                 'rows'  => '15'
bd68aa 394             ),
b1a6a5 395             //#################################
MC 396             // END Datatable fields
397             //#################################
bd68aa 398         )
MC 399     );
400 }
401
f17718 402 //* Backup
FS 403 $form["tabs"]['backup'] = array (
404     'title'         => "Backup",
405     'width'         => 100,
406     'template'      => "templates/mail_user_backup.htm",
407     'readonly'      => false,
408     'fields'        => array (
409     ##################################
410     # Begin Datatable fields
411     ##################################
412         'backup_interval' => array (
413             'datatype'      => 'VARCHAR',
414             'formtype'      => 'SELECT',
415             'default'       => '',
416              'value'         => array('none' => 'no_backup_txt', 'daily' => 'daily_backup_txt', 'weekly' => 'weekly_backup_txt', 'monthly' => 'monthly_backup_txt')
417         ),
418         'backup_copies' => array (
419             'datatype'      => 'INTEGER',
420             'formtype'      => 'SELECT',
421             'default'       => '',
422             'value'         => array('1' => '1', '2' => '2', '3' => '3', '4' => '4', '5' => '5', '6' => '6', '7' => '7', '8' => '8', '9' => '9', '10' => '10')
423         ),
424     ##################################
425     # ENDE Datatable fields
426     ##################################
427     ),
428     'plugins' => array (
429         'backup_records' => array (
430             'class'   => 'plugin_backuplist_mail',
431             'options' => array(
432             )
433         )
434     )
435 );
d097c7 436
bd68aa 437 ?>