1+ <?php
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).
32+
33+
34+ */
35+
36+ $ form ["title " ] = "Shell User " ;
37+ $ form ["description " ] = "" ;
38+ $ form ["name " ] = "shell_user " ;
39+ $ form ["action " ] = "shell_user_edit.php " ;
40+ $ form ["db_table " ] = "shell_user " ;
41+ $ form ["db_table_idx " ] = "shell_user_id " ;
42+ $ form ["db_history " ] = "yes " ;
43+ $ form ["tab_default " ] = "shell " ;
44+ $ form ["list_default " ] = "shell_user_list.php " ;
45+ $ form ["auth " ] = 'yes ' ; // yes / no
46+
47+ $ form ["auth_preset " ]["userid " ] = 0 ; // 0 = id of the user, > 0 id must match with id of current user
48+ $ form ["auth_preset " ]["groupid " ] = 0 ; // 0 = default groupid of the user, > 0 id must match with groupid of current user
49+ $ form ["auth_preset " ]["perm_user " ] = 'riud ' ; //r = read, i = insert, u = update, d = delete
50+ $ form ["auth_preset " ]["perm_group " ] = 'riud ' ; //r = read, i = insert, u = update, d = delete
51+ $ form ["auth_preset " ]["perm_other " ] = '' ; //r = read, i = insert, u = update, d = delete
52+
53+ $ form ["tabs " ]['shell ' ] = array (
54+ 'title ' => "Shell User " ,
55+ 'width ' => 100 ,
56+ 'template ' => "templates/shell_user_edit.htm " ,
57+ 'fields ' => array (
58+ ##################################
59+ # Begin Datatable fields
60+ ##################################
61+ 'server_id ' => array (
62+ 'datatype ' => 'INTEGER ' ,
63+ 'formtype ' => 'SELECT ' ,
64+ 'default ' => '' ,
65+ 'datasource ' => array ( 'type ' => 'SQL ' ,
66+ 'querystring ' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name ' ,
67+ 'keyfield ' => 'server_id ' ,
68+ 'valuefield ' => 'server_name '
69+ ),
70+ 'value ' => ''
71+ ),
72+ 'parent_domain_id ' => array (
73+ 'datatype ' => 'INTEGER ' ,
74+ 'formtype ' => 'SELECT ' ,
75+ 'default ' => '' ,
76+ 'datasource ' => array ( 'type ' => 'SQL ' ,
77+ 'querystring ' => "SELECT domain_id,domain FROM web_domain WHERE type = 'vhost' AND {AUTHSQL} ORDER BY domain " ,
78+ 'keyfield ' => 'domain_id ' ,
79+ 'valuefield ' => 'domain '
80+ ),
81+ 'value ' => ''
82+ ),
83+ 'username ' => array (
84+ 'datatype ' => 'VARCHAR ' ,
85+ 'formtype ' => 'TEXT ' ,
86+ 'validators ' => array ( 0 => array ( 'type ' => 'NOTEMPTY ' ,
87+ 'errmsg ' => 'username_error_empty ' ),
88+ 1 => array ( 'type ' => 'UNIQUE ' ,
89+ 'errmsg ' => 'username_error_unique ' ),
90+ 2 => array ( 'type ' => 'REGEX ' ,
91+ 'regex ' => '/^[\w\.\-]{1,64}$/ ' ,
92+ 'errmsg ' => 'username_error_regex ' ),
93+ ),
94+ 'default ' => '' ,
95+ 'value ' => '' ,
96+ 'width ' => '30 ' ,
97+ 'maxlength ' => '255 '
98+ ),
99+ 'password ' => array (
100+ 'datatype ' => 'VARCHAR ' ,
101+ 'formtype ' => 'PASSWORD ' ,
102+ 'encryption ' => 'CRYPT ' ,
103+ 'default ' => '' ,
104+ 'value ' => '' ,
105+ 'width ' => '30 ' ,
106+ 'maxlength ' => '255 '
107+ ),
108+ 'quota_size ' => array (
109+ 'datatype ' => 'INTEGER ' ,
110+ 'formtype ' => 'TEXT ' ,
111+ 'validators ' => array ( 0 => array ( 'type ' => 'NOTEMPTY ' ,
112+ 'errmsg ' => 'quota_size_error_empty ' ),
113+ ),
114+ 'default ' => '-1 ' ,
115+ 'value ' => '' ,
116+ 'width ' => '7 ' ,
117+ 'maxlength ' => '7 '
118+ ),
119+ 'active ' => array (
120+ 'datatype ' => 'VARCHAR ' ,
121+ 'formtype ' => 'CHECKBOX ' ,
122+ 'default ' => 'y ' ,
123+ 'value ' => array (0 => 'n ' ,1 => 'y ' )
124+ ),
125+ ##################################
126+ # ENDE Datatable fields
127+ ##################################
128+ )
129+ );
130+
131+ if ($ _SESSION ["s " ]["user " ]["typ " ] == 'admin ' ) {
132+
133+ $ form ["tabs " ]['advanced ' ] = array (
134+ 'title ' => "Options " ,
135+ 'width ' => 100 ,
136+ 'template ' => "templates/shell_user_advanced.htm " ,
137+ 'fields ' => array (
138+ ##################################
139+ # Begin Datatable fields
140+ ##################################
141+ 'uid ' => array (
142+ 'datatype ' => 'VARCHAR ' ,
143+ 'formtype ' => 'TEXT ' ,
144+ 'validators ' => array ( 0 => array ( 'type ' => 'NOTEMPTY ' ,
145+ 'errmsg ' => 'uid_error_empty ' ),
146+ ),
147+ 'default ' => '0 ' ,
148+ 'value ' => '' ,
149+ 'width ' => '30 ' ,
150+ 'maxlength ' => '255 '
151+ ),
152+ 'gid ' => array (
153+ 'datatype ' => 'VARCHAR ' ,
154+ 'formtype ' => 'TEXT ' ,
155+ 'validators ' => array ( 0 => array ( 'type ' => 'NOTEMPTY ' ,
156+ 'errmsg ' => 'uid_error_empty ' ),
157+ ),
158+ 'default ' => '0 ' ,
159+ 'value ' => '' ,
160+ 'width ' => '30 ' ,
161+ 'maxlength ' => '255 '
162+ ),
163+ 'shell ' => array (
164+ 'datatype ' => 'VARCHAR ' ,
165+ 'formtype ' => 'TEXT ' ,
166+ 'default ' => '/bin/bash ' ,
167+ 'value ' => '' ,
168+ 'width ' => '30 ' ,
169+ 'maxlength ' => '255 '
170+ ),
171+ 'dir ' => array (
172+ 'datatype ' => 'VARCHAR ' ,
173+ 'formtype ' => 'TEXT ' ,
174+ 'validators ' => array ( 0 => array ( 'type ' => 'NOTEMPTY ' ,
175+ 'errmsg ' => 'directory_error_empty ' ),
176+ ),
177+ 'default ' => '' ,
178+ 'value ' => '' ,
179+ 'width ' => '30 ' ,
180+ 'maxlength ' => '255 '
181+ ),
182+ ##################################
183+ # ENDE Datatable fields
184+ ##################################
185+ )
186+ );
187+
188+ }
189+
190+
191+ ?>
0 commit comments