Marius Cramer
2014-08-13 42539643c396f9d8865dcf9a51b13dc869709d16
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).
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
73c2f2 37
T 38
39 */
40
7fe908 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 (
7fe908 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 (
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} 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 (
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'  => array('0' => 'select_site_txt')
5a43e7 87         ),
73c2f2 88         'type' => array (
7fe908 89             'datatype' => 'VARCHAR',
MC 90             'formtype' => 'SELECT',
99d6a5 91             'default' => 'mysql',
7fe908 92             'value'  => array('mysql' => 'MySQL')
73c2f2 93         ),
T 94         'database_name' => array (
7fe908 95             'datatype' => 'VARCHAR',
MC 96             'formtype' => 'TEXT',
97             'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
98                     'errmsg'=> 'database_name_error_empty'),
99                 1 => array ( 'type' => 'REGEX',
100                     'regex' => '/^[a-zA-Z0-9_]{2,64}$/',
101                     'errmsg'=> 'database_name_error_regex'),
102             ),
103             'default' => '',
104             'value'  => '',
105             'width'  => '30',
106             'maxlength' => '255',
4c28d9 107             'searchable' => 1
73c2f2 108         ),
10b4c8 109         'database_name_prefix' => array (
7fe908 110             'datatype' => 'VARCHAR',
MC 111             'formtype' => 'TEXT',
112             'default' => '',
113             'value'  => '',
114             'width'  => '30',
115             'maxlength' => '25'
10b4c8 116         ),
381520 117         'database_user_id' => array (
7fe908 118             'datatype' => 'INTEGER',
MC 119             'formtype' => 'SELECT',
120             'default' => '',
121             'datasource' => array (  'type' => 'SQL',
122                 'querystring' => "SELECT database_user_id,database_user FROM web_database_user WHERE {AUTHSQL} ORDER BY database_user",
123                 'keyfield'=> 'database_user_id',
124                 'valuefield'=> 'database_user'
125             ),
126             'value'  => array('0' => 'select_dbuser_txt')
73c2f2 127         ),
381520 128         'database_ro_user_id' => array (
7fe908 129             'datatype' => 'INTEGER',
MC 130             'formtype' => 'SELECT',
131             'default' => '',
132             'datasource' => array (  'type' => 'SQL',
133                 'querystring' => "SELECT database_user_id,database_user FROM web_database_user WHERE {AUTHSQL} ORDER BY database_user",
134                 'keyfield'=> 'database_user_id',
135                 'valuefield'=> 'database_user'
136             ),
137             'value'  => array('0' => 'no_dbuser_txt')
73c2f2 138         ),
be9816 139         'database_charset' => array (
7fe908 140             'datatype' => 'VARCHAR',
MC 141             'formtype' => 'SELECT',
99d6a5 142             'default' => '',
7fe908 143             'value'  => array('' => 'DB-Default', 'latin1' => 'Latin 1', 'utf8' => 'UTF-8')
be9816 144         ),
73c2f2 145         'remote_access' => array (
7fe908 146             'datatype' => 'VARCHAR',
MC 147             'formtype' => 'CHECKBOX',
148             'default' => 'n',
149             'value'  => array(0 => 'n', 1 => 'y')
73c2f2 150         ),
T 151         'active' => array (
7fe908 152             'datatype' => 'VARCHAR',
MC 153             'formtype' => 'CHECKBOX',
154             'default' => 'y',
155             'value'  => array(0 => 'n', 1 => 'y')
73c2f2 156         ),
7fe908 157         'remote_ips' => array (
MC 158             'datatype'  => 'TEXT',
159             'formtype'  => 'TEXT',
160             'validators'  => array (  0 => array (  'type' => 'CUSTOM',
161                     'class' => 'validate_database',
162                     'function' => 'valid_ip_list',
163                     'errmsg' => 'database_remote_error_ips'),
164             ),
165             'default' => '',
166             'value'   => '',
167             'width'   => '60',
168             'searchable' => 2
169         ),
170         //#################################
171         // ENDE Datatable fields
172         //#################################
73c2f2 173     )
T 174 );
175
176
7fe908 177 ?>