Marius Burkard
2016-04-20 4569cae57f127afd093794310ccd290d2d9fdf36
commit | author | age
73c2f2 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).
bd68aa 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
73c2f2 37
T 38
39 */
40
b1a6a5 41 $form["title"]    = "Database";
MC 42 $form["description"]  = "";
43 $form["name"]    = "database";
44 $form["action"]   = "database_edit.php";
45 $form["db_table"]  = "web_database";
46 $form["db_table_idx"] = "database_id";
47 $form["db_history"]  = "yes";
48 $form["tab_default"] = "database";
49 $form["list_default"] = "database_list.php";
50 $form["auth"]   = 'yes'; // yes / no
73c2f2 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"]['database'] = array (
b1a6a5 59     'title'  => "Database",
MC 60     'width'  => 100,
61     'template'  => "templates/database_edit.htm",
62     'fields'  => array (
63         //#################################
64         // Begin Datatable fields
65         //#################################
73c2f2 66         'server_id' => array (
b1a6a5 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} AND db_server = 1 ORDER BY server_name',
72                 'keyfield'=> 'server_id',
73                 'valuefield'=> 'server_name'
74             ),
75             'value'  => ''
73c2f2 76         ),
5a43e7 77         'parent_domain_id' => array (
b1a6a5 78             'datatype' => 'INTEGER',
MC 79             'formtype' => 'SELECT',
80             'default' => '',
81             'datasource' => array (  'type' => 'SQL',
5b3d2c 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",
b1a6a5 83                 'keyfield'=> 'domain_id',
MC 84                 'valuefield'=> 'parent_domain'
85             ),
86             'value'  => array('0' => 'select_site_txt')
5a43e7 87         ),
73c2f2 88         'type' => array (
b1a6a5 89             'datatype' => 'VARCHAR',
MC 90             'formtype' => 'SELECT',
99d6a5 91             'default' => 'mysql',
b1a6a5 92             'value'  => array(
d22277 93                 /*'mongo' => 'MongoDB',*/
b1a6a5 94                 'mysql' => 'MySQL'
MC 95             )
73c2f2 96         ),
T 97         'database_name' => array (
b1a6a5 98             'datatype' => 'VARCHAR',
MC 99             'formtype' => 'TEXT',
100             'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
101                     'errmsg'=> 'database_name_error_empty'),
102                 1 => array ( 'type' => 'REGEX',
103                     'regex' => '/^[a-zA-Z0-9_]{2,64}$/',
104                     'errmsg'=> 'database_name_error_regex'),
105             ),
106             'default' => '',
107             'value'  => '',
108             'width'  => '30',
109             'maxlength' => '255',
4c28d9 110             'searchable' => 1
73c2f2 111         ),
10b4c8 112         'database_name_prefix' => array (
b1a6a5 113             'datatype' => 'VARCHAR',
MC 114             'formtype' => 'TEXT',
115             'default' => '',
116             'value'  => '',
117             'width'  => '30',
118             'maxlength' => '25'
10b4c8 119         ),
0543b2 120         'database_quota' => array (
F 121             'datatype' => 'INTEGER',
122             'formtype' => 'TEXT',
123             'validators' => array (  0 => array ( 'type' => 'ISINT',
124                 'errmsg'=> 'limit_database_quota_error_notint'),
125             ),
126             'default' => '-1',
127             'value'  => '',
128             'separator' => '',
129             'width'  => '10',
130             'maxlength' => '10',
131             'rows'  => '',
132             'cols'  => ''
133         ),
381520 134         'database_user_id' => array (
b1a6a5 135             'datatype' => 'INTEGER',
MC 136             'formtype' => 'SELECT',
137             'default' => '',
138             'datasource' => array (  'type' => 'SQL',
139                 'querystring' => "SELECT database_user_id,database_user FROM web_database_user WHERE {AUTHSQL} ORDER BY database_user",
140                 'keyfield'=> 'database_user_id',
141                 'valuefield'=> 'database_user'
142             ),
143             'value'  => array('0' => 'select_dbuser_txt')
73c2f2 144         ),
381520 145         'database_ro_user_id' => array (
b1a6a5 146             'datatype' => 'INTEGER',
MC 147             'formtype' => 'SELECT',
148             'default' => '',
149             'datasource' => array (  'type' => 'SQL',
150                 'querystring' => "SELECT database_user_id,database_user FROM web_database_user WHERE {AUTHSQL} ORDER BY database_user",
151                 'keyfield'=> 'database_user_id',
152                 'valuefield'=> 'database_user'
153             ),
154             'value'  => array('0' => 'no_dbuser_txt')
73c2f2 155         ),
be9816 156         'database_charset' => array (
b1a6a5 157             'datatype' => 'VARCHAR',
MC 158             'formtype' => 'SELECT',
99d6a5 159             'default' => '',
b1a6a5 160             'value'  => array('' => 'DB-Default', 'latin1' => 'Latin 1', 'utf8' => 'UTF-8')
be9816 161         ),
73c2f2 162         'remote_access' => array (
b1a6a5 163             'datatype' => 'VARCHAR',
MC 164             'formtype' => 'CHECKBOX',
165             'default' => 'n',
166             'value'  => array(0 => 'n', 1 => 'y')
73c2f2 167         ),
T 168         'active' => array (
b1a6a5 169             'datatype' => 'VARCHAR',
MC 170             'formtype' => 'CHECKBOX',
171             'default' => 'y',
172             'value'  => array(0 => 'n', 1 => 'y')
73c2f2 173         ),
b1a6a5 174         'remote_ips' => array (
MC 175             'datatype'  => 'TEXT',
176             'formtype'  => 'TEXT',
177             'validators'  => array (  0 => array (  'type' => 'CUSTOM',
178                     'class' => 'validate_database',
179                     'function' => 'valid_ip_list',
180                     'errmsg' => 'database_remote_error_ips'),
181             ),
182             'default' => '',
183             'value'   => '',
184             'width'   => '60',
185             'searchable' => 2
186         ),
187         //#################################
188         // ENDE Datatable fields
189         //#################################
73c2f2 190     )
T 191 );
192
193
b1a6a5 194 ?>