Marius Cramer
2014-08-13 42539643c396f9d8865dcf9a51b13dc869709d16
commit | author | age
18341e 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).
7fe908 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
18341e 37
T 38
39 */
40
7fe908 41 $form["title"]    = "FTP User";
MC 42 $form["description"]  = "";
43 $form["name"]    = "ftp_user";
44 $form["action"]   = "ftp_user_edit.php";
45 $form["db_table"]  = "ftp_user";
46 $form["db_table_idx"] = "ftp_user_id";
47 $form["db_history"]  = "yes";
48 $form["tab_default"] = "ftp";
49 $form["list_default"] = "ftp_user_list.php";
50 $form["auth"]   = 'yes'; // yes / no
18341e 51
T 52 $form["auth_preset"]["userid"]  = 0; // 0 = id of the user, > 0 id must match with id of current user
53 $form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user
54 $form["auth_preset"]["perm_user"] = 'riud'; //r = read, i = insert, u = update, d = delete
55 $form["auth_preset"]["perm_group"] = 'riud'; //r = read, i = insert, u = update, d = delete
56 $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
57
58 $form["tabs"]['ftp'] = array (
7fe908 59     'title'  => "FTP User",
MC 60     'width'  => 100,
61     'template'  => "templates/ftp_user_edit.htm",
62     'fields'  => array (
63         //#################################
64         // Begin Datatable fields
65         //#################################
18341e 66         'server_id' => array (
7fe908 67             'datatype' => 'INTEGER',
MC 68             'formtype' => 'SELECT',
69             'default' => '',
70             'datasource' => array (  'type' => 'SQL',
71                 'querystring' => 'SELECT server_id,server_name FROM server WHERE mirror_server_id = 0 AND {AUTHSQL} ORDER BY server_name',
72                 'keyfield'=> 'server_id',
73                 'valuefield'=> 'server_name'
74             ),
75             'value'  => ''
18341e 76         ),
T 77         'parent_domain_id' => array (
7fe908 78             'datatype' => 'INTEGER',
MC 79             'formtype' => 'SELECT',
80             'default' => '',
81             'datasource' => array (  'type' => 'SQL',
82                 'querystring' => "SELECT web_domain.domain_id, CONCAT(web_domain.domain, ' :: ', server.server_name) AS parent_domain FROM web_domain, server WHERE web_domain.type = 'vhost' AND web_domain.server_id = server.server_id AND {AUTHSQL::web_domain} ORDER BY web_domain.domain",
83                 'keyfield'=> 'domain_id',
84                 'valuefield'=> 'parent_domain'
85             ),
86             'value'  => ''
18341e 87         ),
T 88         'username' => array (
7fe908 89             'datatype' => 'VARCHAR',
MC 90             'formtype' => 'TEXT',
91             'validators' => array (  0 => array ( 'type' => 'UNIQUE',
92                     'errmsg'=> 'username_error_unique'),
93                 1 => array ( 'type' => 'REGEX',
9d5753 94                     'regex' => '/^[\w\.\-@\+]{0,64}$/',
7fe908 95                     'errmsg'=> 'username_error_regex'),
MC 96             ),
97             'default' => '',
98             'value'  => '',
99             'width'  => '30',
100             'maxlength' => '255',
4c28d9 101             'searchable' => 1
18341e 102         ),
10b4c8 103         'username_prefix' => array (
7fe908 104             'datatype' => 'VARCHAR',
MC 105             'formtype' => 'TEXT',
106             'default' => '',
107             'value'  => '',
108             'width'  => '30',
109             'maxlength' => '25'
10b4c8 110         ),
18341e 111         'password' => array (
7fe908 112             'datatype' => 'VARCHAR',
7b9388 113             'validators' => array(
MC 114                 0 => array(
115                     'type' => 'CUSTOM',
116                     'class' => 'validate_password',
117                     'function' => 'password_check',
118                     'errmsg' => 'weak_password_txt'
119                 )
120             ),
7fe908 121             'formtype' => 'PASSWORD',
e2d6ed 122             'encryption' => 'CRYPT',
7fe908 123             'default' => '',
MC 124             'value'  => '',
125             'width'  => '30',
126             'maxlength' => '255'
18341e 127         ),
T 128         'quota_size' => array (
7fe908 129             'datatype' => 'INTEGER',
MC 130             'formtype' => 'TEXT',
131             'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
132                     'errmsg'=> 'quota_size_error_empty'),
133                 1 => array ( 'type' => 'REGEX',
134                     'regex' => '/^(\-1|[0-9]{1,10})$/',
135                     'errmsg'=> 'quota_size_error_regex'),
136             ),
137             'default' => '-1',
138             'value'  => '',
139             'width'  => '7',
140             'maxlength' => '7'
18341e 141         ),
T 142         'active' => array (
7fe908 143             'datatype' => 'VARCHAR',
MC 144             'formtype' => 'CHECKBOX',
145             'default' => 'y',
146             'value'  => array(0 => 'n', 1 => 'y')
18341e 147         ),
7fe908 148         //#################################
MC 149         // ENDE Datatable fields
150         //#################################
18341e 151     )
T 152 );
153
03bca9 154 if($app->auth->is_admin()) {
18341e 155
7fe908 156     $form["tabs"]['advanced'] = array (
MC 157         'title'     => "Options",
158         'width'     => 100,
159         'template'  => "templates/ftp_user_advanced.htm",
160         'fields'    => array (
161             //#################################
162             // Begin Datatable fields
163             //#################################
164             'uid' => array (
165                 'datatype'  => 'VARCHAR',
166                 'formtype'  => 'TEXT',
167                 'validators'    => array (  0 => array (    'type'  => 'NOTEMPTY',
168                         'errmsg'=> 'uid_error_empty'),
e98a15 169                         1 => array(
TB 170                             'type' => 'CUSTOM',
171                             'class' => 'validate_systemuser',
172                             'function' => 'check_sysuser',
173                             'check_names' => true,
174                             'errmsg' => 'invalid_system_user_or_group_txt'
175                         ),
7fe908 176                 ),
MC 177                 'default'   => '0',
178                 'value'     => '',
179                 'width'     => '30',
180                 'maxlength' => '255'
181             ),
182             'gid' => array (
183                 'datatype'  => 'VARCHAR',
184                 'formtype'  => 'TEXT',
185                 'validators'    => array (  0 => array (    'type'  => 'NOTEMPTY',
186                         'errmsg'=> 'gid_error_empty'),
e98a15 187                         1 => array(
TB 188                             'type' => 'CUSTOM',
189                             'class' => 'validate_systemuser',
190                             'function' => 'check_sysgroup',
191                             'check_names' => true,
192                             'errmsg' => 'invalid_system_user_or_group_txt'
193                         ),
7fe908 194                 ),
MC 195                 'default'   => '0',
196                 'value'     => '',
197                 'width'     => '30',
198                 'maxlength' => '255'
199             ),
200             'dir' => array (
201                 'datatype'  => 'VARCHAR',
202                 'formtype'  => 'TEXT',
203                 'validators'    => array (  0 => array (    'type'  => 'NOTEMPTY',
f2fc77 204                                                             'errmsg'=> 'directory_error_empty'),
TB 205                                             1 => array (     'type' => 'REGEX',
206                                                             'regex' => '/^\/[a-zA-Z0-9\ \.\-\_\/]{10,128}$/',
207                                                             'errmsg'=> 'directory_error_regex'),
7fe908 208                 ),
MC 209                 'default'   => '',
210                 'value'     => '',
211                 'width'     => '30',
212                 'maxlength' => '255'
213             ),
214             'quota_files' => array (
215                 'datatype'  => 'INTEGER',
216                 'formtype'  => 'TEXT',
217                 'default'   => '0',
218                 'value'     => '',
219                 'width'     => '7',
220                 'maxlength' => '7'
221             ),
222             'ul_ratio' => array (
223                 'datatype'  => 'INTEGER',
224                 'formtype'  => 'TEXT',
225                 'default'   => '0',
226                 'value'     => '',
227                 'width'     => '7',
228                 'maxlength' => '7'
229             ),
230             'dl_ratio' => array (
231                 'datatype'  => 'INTEGER',
232                 'formtype'  => 'TEXT',
233                 'default'   => '0',
234                 'value'     => '',
235                 'width'     => '7',
236                 'maxlength' => '7'
237             ),
238             'ul_bandwidth' => array (
239                 'datatype'  => 'INTEGER',
240                 'formtype'  => 'TEXT',
241                 'default'   => '0',
242                 'value'     => '',
243                 'width'     => '7',
244                 'maxlength' => '7'
245             ),
246             'dl_bandwidth' => array (
247                 'datatype'  => 'INTEGER',
248                 'formtype'  => 'TEXT',
249                 'default'   => '0',
250                 'value'     => '',
251                 'width'     => '7',
252                 'maxlength' => '7'
253             ),
254             //#################################
255             // ENDE Datatable fields
256             //#################################
257         )
258     );
086696 259
M 260 } else {
261
7fe908 262     $form["tabs"]['advanced'] = array (
MC 263         'title'     => "Options",
264         'width'     => 100,
265         'template'  => "templates/ftp_user_advanced_client.htm",
266         'fields'    => array (
267             //#################################
268             // Begin Datatable fields
269             //#################################
270             'dir' => array (
271                 'datatype'  => 'VARCHAR',
272                 'formtype'  => 'TEXT',
273                 'validators'    => array (  0 => array (    'type'  => 'NOTEMPTY',
274                         'errmsg'=> 'directory_error_empty'),
275                     1 => array (    'type'  => 'CUSTOM',
276                         'class' => 'validate_ftpuser',
277                         'function' => 'ftp_dir',
278                         'errmsg' => 'directory_error_notinweb'),
279                 ),
280                 'default'   => '',
281                 'value'     => '',
282                 'width'     => '30',
283                 'maxlength' => '255'
284             ),
285             //#################################
286             // ENDE Datatable fields
287             //#################################
288         )
289     );
18341e 290
T 291 }
292
293
086696 294
7fe908 295 ?>