1
<?php
2
/**
3
 * @file
4
 * Install, update and uninstall functions for the guifi module.
5
 */
6
7
function guifi_uninstall() {
8
9
  drupal_uninstall_schema('guifi');
10
11
  variable_del('guifi_license');
12
  variable_del('guifi_title');
13
  variable_del('guifi_root');
14
  variable_del('guifi_forums');
15
  variable_del('guifi_contact');
16
  variable_del('hotspot_ssid');
17
  variable_del('guifi_loglevel');
18
  variable_del('guifi_maps');
19
  variable_del('guifi_decimal');
20
  variable_del('guifi_thousand');
21
}
22
23
function guifi_schema() {
24
  $schema['guifi_notify'] = array(
25
    'fields' => array(
26
         'id' => array('type' => 'int', 'size' => 'small', 'unsigned' => TRUE, 'not null' => TRUE),
27
         'timestamp' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE),
28
         'who_id' => array('type' => 'int', 'size' => 'medium', 'unsigned' => TRUE, 'not null' => TRUE),
29
         'who_name' => array('type' => 'varchar', 'length' => '255', 'not null' => TRUE),
30
         'to_array' => array('type' => 'varchar', 'length' => '1024', 'not null' => TRUE),
31
         'subject' => array('type' => 'varchar', 'length' => '255', 'not null' => TRUE),
32
         'body' => array('type' => 'text', 'size' => 'big', 'not null' => TRUE)
33
         ),
34
    'primary key' => array('id'),
35
  );
36
37
  $schema['guifi_location'] = array(
38
    'fields' => array(
39
         'id' => array('type' => 'serial',  'size' => 'medium', 'not null' => TRUE),
40
         'nick' => array('type' => 'varchar', 'length' => '40', 'not null' => TRUE, 'default' => ''),
41
         'zone_id' => array('type' => 'int',  'size' => 'medium', 'not null' => FALSE, 'comment' => 'foreign key to guifi_zone(id)'),
42
         'zone_description' => array('type' => 'varchar', 'length' => '255', 'not null' => FALSE),
43
         'lat' => array('type' => 'numeric', 'precision' => '10', 'scale' => '6', 'not null' => FALSE),
44
         'lon' => array('type' => 'numeric', 'precision' => '10', 'scale' => '6', 'not null' => FALSE),
45
         'elevation' => array('type' => 'int', 'size' => 'tiny', 'not null' => FALSE),
46
         'notification' => array('type' => 'varchar', 'length' => '1024', 'not null' => TRUE),
47
         'status_flag' => array('type' => 'varchar', 'length' => '40', 'not null' => TRUE, 'default' => 'Planned'),
48
         'stable' => array('type' => 'varchar', 'length' => '25', 'not null' => TRUE, 'default' => 'Yes', 'comment' => 'Yes,No'),
49
         'graph_server' => array('type' => 'int', 'size' => 'medium', 'not null' => TRUE, 'default' => 0, 'comment' => 'FK to guifi_services (SNPGraphs)'),
50
         'user_created' => array('type' => 'int', 'size' => 'medium', 'not null' => TRUE, 'default' => 0),
51
         'user_changed' => array('type' => 'int', 'size' => 'medium',' not null' => FALSE),
52
         'timestamp_created' => array('type' => 'int', 'not null' => TRUE, 'default' => 0),
53
         'timestamp_changed' => array('type' => 'int', 'not null' => FALSE)),
54
    'primary key' => array('id'),
55
  );
56
57
  $schema['guifi_networks'] = array(
58
    'comment' => 'allocates ipv4 address ranges to zones',
59
    'fields' => array(
60
         'id' => array('type' => 'serial', 'size' => 'small', 'unsigned' => TRUE, 'not null' => TRUE),
61
         'base' => array('type' => 'varchar', 'length' => '255', 'not null' => TRUE, 'default' => ''),
62
         'mask' => array('type' => 'varchar', 'length' => '255', 'not null' => TRUE, 'default' => '255.255.255.0'),
63
         'zone' => array('type' => 'int',  'size' => 'medium', 'unsigned' => TRUE, 'not null' => TRUE),
64
         'network_type' => array('type' => 'varchar', 'length' => '10', 'not null' => TRUE, 'default' => 'public', 'comment' => 'public, backbone'),
65
         'user_created' => array('type' => 'int',  'size' => 'medium', 'not null' => TRUE, 'default' => 0),
66
         'user_changed' => array('type' => 'int',  'size' => 'medium', 'not null' => TRUE, 'default' => 0),
67
         'timestamp_created' => array('type' => 'int', 'not null' => TRUE, 'default' => 0),
68
         'timestamp_changed' => array('type' => 'int', 'not null' => TRUE, 'default' => 0)),
69
    'primary key' => array('id'),
70
    'unique keys' => array(
71
         'networks' => array(array('base', 16), array('mask', 16))),
72
    'indexes' => array(
73
         'net_zone' => array('zone')),
74
  );
75
76
  $schema['guifi_zone'] = array(
77
    'comment' => 'zone information, zones have a self hierarchy and group node locations',
78
    'fields' => array(
79
         'id' => array('type' => 'serial',  'size' => 'medium', 'unsigned' => TRUE, 'not null' => TRUE),
80
         'title' => array('type' => 'varchar', 'length' => '255', 'not null' => TRUE, 'default' => ''),
81
         'nick' => array('type' => 'varchar', 'length' => '10', 'not null' => FALSE),
82
         'body' => array('type' => 'text', 'size' => 'big', 'not null' => TRUE),
83
         'master' => array('type' => 'int', 'size' => 'medium', 'unsigned' => TRUE, 'not null' => TRUE, 'comment' => 'references parent zone guifi_zone(id)'),
84
         'zone_mode' => array('type' => 'varchar', 'length' => 25, 'not null' => TRUE, 'default' => 'infrastructure', 'comment' => 'infrastructure/ad-hoc'),
85
         'graph_server' => array('type' => 'int',  'size' => 'medium', 'not null' => TRUE, 'default' => '0', 'comment' => 'FK to guifi_services (SNPGraphs)'),
86
         'proxy_id' => array('type' => 'int', 'size' => 'medium', 'not null' => TRUE, 'default' => 0, 'comment' => 'FK to guifi_services (proxy)'),
87
         'voip_id' => array('type' => 'int',  'size' => 'medium', 'not null' => TRUE, 'default' => 0, 'comment' => 'FK to guifi_services (VoIP)'),
88
         'time_zone' => array('type' => 'varchar', 'length' => '15', 'not null' => TRUE),
89
         'dns_servers' => array('type' => 'varchar', 'length' => '255', 'not null' => FALSE),
90
         'ntp_servers' => array('type' => 'varchar', 'length' => '255', 'not null' => FALSE),
91
         'graph_server' => array('type' => 'varchar', 'length' => '40', 'not null' => FALSE),
92
         'homepage' => array('type' => 'varchar', 'length' => '255', 'not null' => FALSE),
93
         'notification' => array('type' => 'varchar', 'length' => '1024', 'not null' => TRUE),
94
         'ospf_zone' => array('type' => 'varchar', 'length' => '255', 'not null' => FALSE),
95
         'minx' => array('type' => 'numeric', 'precision' => '10', 'scale' => '6', 'not null' => FALSE),
96
         'miny' => array('type' => 'numeric', 'precision' => '10', 'scale' => '6', 'not null' => FALSE),
97
         'maxx' => array('type' => 'numeric', 'precision' => '10', 'scale' => '6', 'not null' => FALSE),
98
         'maxy' => array('type' => 'numeric', 'precision' => '10', 'scale' => '6', 'not null' => FALSE),
99
         'local' => array('comment' => 'Yes, No', 'type' => 'varchar', 'length' => '5', 'not null' => TRUE, 'default' => 'Yes'),
100
         'nodexchange_url' => array('type' => 'varchar', 'length' => '255', 'not null' => FALSE),
101
         'refresh' => array('type' => 'int', 'not null' => FALSE),
102
         'remote_server_id' => array('type' => 'int',  'size' => 'medium', 'not null' => FALSE),
103
         'weight' => array('type' => 'int', 'size' => 'tiny', 'not null' => TRUE, 'default' => 0),
104
         'user_created' => array('type' => 'int',  'size' => 'medium', 'not null' => TRUE, 'default' => 0),
105
         'user_changed' => array('type' => 'int',  'size' => 'medium', 'not null' => TRUE, 'default' => 0),
106
         'timestamp_created' => array('type' => 'int', 'not null' => TRUE, 'default' => 0),
107
         'timestamp_changed' => array('type' => 'int', 'not null' => TRUE, 'default' => 0)),
108
    'primary key' => array('id'),
109
    'indexes' => array(
110
         'name' => array(array('title', 10))),
111
  );
112
113
  $schema['guifi_devices'] = array(
114
    'fields' => array(
115
         'id' => array('type' => 'serial', 'size' => 'medium', 'not null' => TRUE),
116
         'nid' => array('type' => 'int', 'size' => 'medium', 'not null' => TRUE, 'comment' => 'foreign key to guifi_location(id)'),
117
         'nick' => array('type' => 'varchar', 'length' => '40', 'not null' => TRUE),
118
         'type' => array('type' => 'varchar', 'length' => '40', 'not null' => TRUE),
119
         'notification' => array('type' => 'varchar', 'length' => '1024', 'not null' => TRUE),
120
         'mac' => array('type' => 'varchar', 'length' => '20', 'not null' => TRUE, 'default' => '00:00:00:00:00:00'),
121
         'comment' => array('type' => 'text', 'size' => 'big', 'not null' => FALSE),
122
         'flag' => array('type' => 'varchar', 'length' => '40', 'not null' => TRUE, 'default' => 'Planned'),
123
         'extra' => array('type' => 'text', 'size' => 'big', 'not null' => FALSE, 'comment' => 'store variable data depending on guifi_devices(type)'),
124
         'graph_server' => array('type' => 'int',  'size' => 'medium' , 'not null' => TRUE, 'default' => 0, 'comment' => 'FK to guifi_services (SNPGraphs)'),
125
	 'logserver' => array('type' => 'varchar','length' => '60', 'not null' => TRUE, 'comment' => 'Ip Server Logs'), 
126
	 'last_online' => array('type' => 'int', 'not null' => TRUE, 'default' => 0, 'comment' => 'Last time that this device has been seen online'),
127
         'last_flag' => array('type' => 'varchar', 'length' => '40', 'not null' => TRUE, 'default' => 'N/A', 'comment' => 'N/A, Online, Offline...'),
128
         'ly_availability' => array('type' => 'numeric', 'precision' => '11', 'scale' => '2', 'not null' => FALSE, 'default' => NULL),
129
         'last_stats' => array('type' => 'int', 'not null' => TRUE, 'default' => 0, 'comment' => 'Last time that this device has been loaded with statistics'),
130
         'latency_avg' => array('type' => 'int',  'size' => 'small', 'not null' => TRUE, 'default' => 0, 'comment' => 'Average latency'),
131
         'latency_max' => array('type' => 'int',  'size' => 'small', 'not null' => TRUE, 'default' => 0, 'comment' => 'Maximum latency'),
132
         'user_created' => array('type' => 'int', 'not null' => TRUE, 'default' => 0),
133
         'user_changed' => array('type' => 'int', 'not null' => TRUE, 'default' => 0),
134
         'timestamp_created' => array('type' => 'int', 'not null' => TRUE, 'default' => 0),
135
         'timestamp_changed' => array('type' => 'int', 'not null' => TRUE, 'default' => 0)),
136
    'primary key' => array('id'),
137
    'unique keys' => array(
138
         'nick' => array('nick')),
139
  );
140
141
  $schema['guifi_links'] = array(
142
    'comment' => 'devices/interfaces linked, one row per peer joined by guifi_links(id)',
143
    'fields' => array(
144
         'id' => array('type' => 'int', 'size' => 'medium', 'not null' => TRUE),
145
         'nid' => array('type' => 'int', 'size' => 'medium', 'not null' => TRUE),
146
         'device_id' => array('type' => 'int', 'size' => 'medium', 'not null' => TRUE),
147
         'interface_id' => array('type' => 'int', 'size' => 'medium', 'not null' => TRUE),
148
         'ipv4_id' => array('type' => 'int', 'size' => 'tiny', 'not null' => TRUE),
149
         'link_type' => array('type' => 'varchar', 'length' => '40', 'not null' => TRUE),
150
         'routing' => array('type' => 'varchar', 'length' => '40', 'not null' => FALSE),
151
         'flag' => array('type' => 'varchar', 'length' => '40', 'not null' => TRUE, 'default' => 'Planned')),
152
    'primary key' => array('device_id', 'id'),
153
    'indexes' => array(
154
         'id' => array('id')),
155
  );
156
157
  $schema['guifi_interfaces'] = array(
158
    'comment' => 'describes interfaces (network connectors) at the devices',
159
    'fields' => array(
160
         'id' => array('type' => 'serial', 'size' => 'medium', 'not null' => TRUE),
161
         'device_id' => array('type' => 'int', 'size' => 'medium', 'not null' => TRUE, 'comment' => 'foreign key to guifi_devices(id)'),
162
         'radiodev_counter' => array('type' => 'int', 'size' => 'tiny', 'not null' => FALSE, 'comment' => 'if not NULL, foreign key to guifi_radios(radiodev_counter)'),
163
         'etherdev_counter' => array('type' => 'int', 'size' => 'tiny', 'not null' => FALSE, 'comment' => 'if not NULL, foreign key to guifi_radios(etherdev_counter)'),
164
         'interface_type' => array('type' => 'varchar', 'length' => '40', 'not null' => TRUE),
165
         'mac' => array('type' => 'varchar', 'length' => '20', 'not null' => TRUE, 'default' => '00:00:00:00:00:00')),
166
    'primary key' => array('device_id', 'id'),
167
    'indexes' =>  array('id' => array('id'))
168
  );
169
170
  $schema['guifi_radios'] = array(
171
    'comment' => 'describes wireless radios available on the guifi_devices',
172
    'fields' => array(
173
         'id' => array('type' => 'serial', 'size' => 'medium', 'not null' => TRUE,'comment' => 'primary key 1st column and foreign key to guifi_devices(id)'),
174
         'radiodev_counter' => array('type' => 'int', 'size' => 'tiny', 'not null' => TRUE, 'default' => 0, 'comment' => 'primary key 2nd column'),
175
         'etherdev_counter' => array('type' => 'int', 'size' => 'tiny', 'not null' => FALSE, 'comment' => ''),
176
         'nid' => array('comment' => 'foreign key to guifi_location(id)', 'type' => 'int', 'not null' => TRUE),
177
         'model_id' => array('type' => 'int', 'size' => 'small', 'not null' => TRUE),
178
         'ssid' => array('type' => 'varchar', 'length' => '128', 'not null' => TRUE, 'default' => ''),
179
         'mode' => array('type' => 'varchar', 'length' => '40', 'not null' => TRUE),
180
         'protocol' => array('type' => 'varchar', 'length' => '40', 'not null' => TRUE, 'default' => '802.11bg'),
181
         'channel' => array('type' => 'int',  'size' => 'small',  'not null' => FALSE),
182
         'antenna_angle' => array('type' => 'int', 'size' => 'small', 'not null' => FALSE, 'default' => 0),
183
         'antenna_gain' => array('type' => 'int', 'size' => 'tiny', 'not null' => FALSE),
184
         'antenna_azimuth' => array('type' => 'int', 'size' => 'small', 'not null' => FALSE, 'default' => 360),
185
         'antenna_mode' => array('type' => 'varchar', 'length' => '5', 'not null' => TRUE),
186
         'ly_mb_in' => array('type' => 'numeric', 'precision' => '10', 'scale' => '6', 'not null' => FALSE, 'default' => NULL),
187
         'ly_mb_out' => array('type' => 'numeric', 'precision' => '10', 'scale' => '6', 'not null' => FALSE, 'default' => NULL),
188
         'clients_accepted' => array('comment' => 'Yes, No', 'type' => 'varchar', 'length' => '5', 'not null' => TRUE, 'default' => 'Yes'),
189
        ),
190
    'primary key' => array('id', 'radiodev_counter'),
191
    'indexes' => array(
192
         'nid' => array('nid')),
193
  );
194
195
  $schema['guifi_types'] = array(
196
    'comment' => 'used on web dialogs to decode values or validate values',
197
    'fields' => array(
198
         'id' => array('type' => 'serial',  'size' => 'small', 'not null' => TRUE),
199
         'type' => array('type' => 'varchar', 'length' => '15', 'not null' => TRUE),
200
         'text' => array('type' => 'varchar', 'length' => '24', 'not null' => TRUE),
201
         'description' => array('type' => 'text', 'size' => 'big', 'not null' => TRUE),
202
         'relations' => array('type' => 'text', 'size' => 'big', 'not null' => FALSE)),
203
    'primary key' => array('type', 'id'),
204
    'indexes' => array(
205
         'text' => array('text')),
206
  );
207
208
  $schema['guifi_services'] = array(
209
    'comment' => 'store guifi services',
210
    'fields' => array(
211
         'id' => array('type' => 'serial', 'size' => 'medium', 'not null' => TRUE),
212
         'nick' => array('type' => 'varchar', 'length' => '40', 'not null' => TRUE, 'default' => ''),
213
         'service_type' => array('type' => 'varchar', 'length' => '40', 'not null' => TRUE, 'default' => ''),
214
         'zone_id' => array('type' => 'int', 'size' => 'medium', 'not null' => FALSE, 'comment' => 'foreign key to guifi_zone(id)'),
215
         'device_id' => array('type' => 'int', 'size' => 'medium', 'not null' => FALSE, 'comment' => 'foreign key to guifi_device(id)'),
216
         'notification' => array('type' => 'varchar', 'length' => '1024', 'not null' => FALSE),
217
         'status_flag' => array('type' => 'varchar', 'length' => '40', 'not null' => TRUE, 'default' => 'Planned'),
218
         'extra' => array('type' => 'text', 'size' => 'big', 'not null' => FALSE),
219
         'user_created' => array('type' => 'int', 'not null' => TRUE, 'default' => 0),
220
         'user_changed' => array('type' => 'int', 'not null' => FALSE),
221
         'timestamp_created' => array('type' => 'int', 'not null' => TRUE, 'default' => 0),
222
         'timestamp_changed' => array('type' => 'int', 'not null' => FALSE)),
223
    'primary key' => array('id'),
224
  );
225
226
  $schema['guifi_users'] = array(
227
    'comment' => 'stores user credentials assigned to nodes for proxy servers, or any other service',
228
    'fields' => array(
229
         'id' => array('type' => 'serial', 'size' => 'medium', 'unsigned' => TRUE, 'not null' => TRUE),
230
         'nid' => array('type' => 'int', 'size' => 'medium', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, 'comment' => 'foreign key to guifi_location(id)'),
231
         'services' => array('type' => 'text', 'size' => 'big', 'not null' => TRUE),
232
         'firstname' => array('type' => 'varchar', 'length' => '60', 'not null' => TRUE, 'default' => ''),
233
         'lastname' => array('type' => 'varchar', 'length' => '60', 'not null' => TRUE, 'default' => ''),
234
         'username' => array('type' => 'varchar', 'length' => '40', 'not null' => TRUE, 'default' => ''),
235
         'password' => array('type' => 'varchar', 'length' => '128', 'not null' => TRUE, 'default' => ''),
236
         'notification' => array('type' => 'varchar', 'length' => '1024', 'not null' => FALSE),
237
         'extra' => array('type' => 'text', 'size' => 'big', 'not null' => FALSE),
238
         'user_created' => array('type' => 'int', 'size' => 'medium', 'not null' => TRUE, 'default' => 0),
239
         'user_changed' => array('type' => 'int', 'size' => 'medium', 'not null' => TRUE, 'default' => 0),
240
         'timestamp_created' => array('type' => 'int', 'not null' => TRUE, 'default' => 0),
241
         'timestamp_changed' => array('type' => 'int', 'not null' => TRUE, 'default' => 0),
242
         'status' => array('type' => 'varchar', 'length' => 25, 'not null' => TRUE, 'default' => 'new', 'comment' => 'pending/approved/rejected'),
243
         'content_filters' => array('type' => 'text', 'size' => 'big', 'not null' => FALSE, 'default' => NULL)),
244
    'primary key' => array('id'),
245
    'unique keys' => array(
246
         'username' => array('username')),
247
  );
248
249
  $schema['guifi_ipv4'] = array(
250
    'fields' => array(
251
         'id' => array('type' => 'int', 'size' => 'tiny', 'not null' => TRUE, 'comment' => 'primary key 1st column, numbers the sequential order of each address into the same interface'),
252
         'interface_id' => array('type' => 'int', 'size' => 'medium', 'not null' => TRUE, 'default' => 0, 'comment' => 'primary key 2nd column and foreign key to guifi_interfaces(id)'),
253
         'ipv4' => array('type' => 'varchar', 'length' => '16', 'not null' => FALSE),
254
         'netmask' => array('type' => 'varchar', 'length' => '16', 'not null' => TRUE, 'default' => '255.255.255.0'),
255
         'ipv4_type' => array('type' => 'int', 'size' => 'tiny', 'not null' => TRUE, 'default' => 0),
256
         'zone_id' => array('type' => 'int', 'size' => 'medium', 'not null' => TRUE, 'default' => 0)),
257
    'primary key' => array('interface_id', 'id'),
258
    'unique keys' => array(
259
         'ipv4' => array('ipv4')),
260
  );
261
262
  $schema['guifi_manufacturer'] = array(
263
    'comment' => 'device manufacturers',
264
    'fields' => array(
265
         'fid' => array('type' => 'int',  'size' => 'small', 'not null' => TRUE),
266
         'name' => array('type' => 'varchar', 'length' => '40', 'not null' => TRUE, 'default' => ''),
267
         'url' => array('type' => 'varchar', 'length' => '40', 'not null' => FALSE),
268
         'notification' => array('type' => 'varchar', 'length' => '1024', 'not null' => TRUE, 'default' => ''),
269
         'user_created' => array('type' => 'int',  'size' => 'medium', 'not null' => TRUE, 'default' => 0),
270
         'user_changed' => array('type' => 'int',  'size' => 'medium', 'not null' => TRUE, 'default' => 0),
271
         'timestamp_created' => array('type' => 'int', 'not null' => TRUE, 'default' => 0),
272
         'timestamp_changed' => array('type' => 'int', 'not null' => TRUE, 'default' => 0)),
273
    'primary key' => array('fid'),
274
  );
275
276
  $schema['guifi_model'] = array(
277
    'comment' => 'device models',
278
    'fields' => array(
279
         'mid' => array('type' => 'int', 'size' => 'small', 'not null' => TRUE),
280
         'fid' => array('type' => 'int', 'size' => 'small', 'not null' => TRUE, 'default' => 0, 'comment' => 'foreign key to guifi_manufacturer(fid)'),
281
         'model' => array('type' => 'varchar', 'length' => '40', 'not null' => TRUE, 'default' => ''),
282
         'type' => array('type' => 'varchar', 'length' => '10', 'not null' => FALSE, 'comment' => 'Extern, PCI, PCMCIA'),
283
         'radiodev_max' => array('type' => 'int', 'size' => 'tiny', 'not null' => TRUE, 'default' => 1),
284
         'etherdev_max' => array('type' => 'int', 'size' => 'tiny', 'not null' => TRUE, 'default' => 1),
285
         'AP' => array('type' => 'varchar', 'length' => '5', 'not null' => FALSE, 'comment' => 'Si, No'),
286
         'virtualAP' => array('type' => 'varchar', 'length' => '5', 'not null' => TRUE, 'default' => 'No', 'comment' => 'Yes, No'),
287
         'client' => array('type' => 'varchar', 'length' => '5', 'not null' => FALSE, 'comment' => 'Si, No, Hack'),
288
         'interfaces' => array('type' => 'varchar', 'length' => '240', 'not null' => FALSE),
289
         'url' => array('type' => 'varchar', 'length' => '240', 'not null' => FALSE),
290
         'comments' => array('type' => 'varchar', 'length' => '240', 'not null' => FALSE),
291
         'supported' => array('type' => 'varchar', 'length' => '25', 'not null' => TRUE, 'default' => 'Yes', 'comment' => 'Yes, No'),
292
         'notification' => array('type' => 'varchar', 'length' => '1024', 'not null' => TRUE, 'default' => ''),
293
         'user_created' => array('type' => 'int',  'size' => 'medium', 'not null' => TRUE, 'default' => 0),
294
         'user_changed' => array('type' => 'int',  'size' => 'medium', 'not null' => TRUE, 'default' => 0),
295
         'timestamp_created' => array('type' => 'int', 'not null' => TRUE, 'default' => 0),
296
         'timestamp_changed' => array('type' => 'int', 'not null' => TRUE, 'default' => 0)),
297
    'primary key' => array('mid'),
298
  );
299
300
  $schema['guifi_dns_domains'] = array(
301
    'comment' => 'store guifi dns domains',
302
    'fields' => array(
303
      'id' => array('type' => 'int', 'size' => 'medium', 'not null' => TRUE),
304
      'sid' => array('type' => 'int', 'size' => 'medium', 'not null' => TRUE),
305
      'name' => array('type' => 'varchar', 'length' => '40', 'not null' => TRUE, 'default' => ''),
306
      'type' => array('type' => 'varchar', 'length' => '16', 'not null' => TRUE, 'default' => ''),
307
      'public' => array('type' => 'varchar', 'length' => '5', 'not null' => TRUE, 'default' => 'yes'),
308
      'ipv4' => array('type' => 'varchar', 'length' => '16', 'not null' => TRUE, 'default' => ''),
309
      'defipv4' => array('type' => 'varchar', 'length' => '16', 'not null' => TRUE, 'default' => ''),
310
      'defipv6' => array('type' => 'varchar', 'length' => '128', 'not null' => TRUE, 'default' => ''),
311
      'mname' => array('type' => 'varchar', 'length' => '32', 'not null' => TRUE, 'default' => ''),
312
      'scope' => array('type' => 'varchar', 'length' => '16', 'not null' => TRUE, 'default' => ''),
313
      'management' => array('type' => 'varchar', 'length' => '16', 'not null' => TRUE, 'default' => ''),
314
      'allow' => array('type' => 'varchar', 'length' => '24', 'not null' => TRUE, 'default' => ''),
315
      'externalmx' => array('type' => 'varchar', 'length' => '128', 'not null' => TRUE, 'default' => ''),
316
      'externalns' => array('type' => 'varchar', 'length' => '128', 'not null' => TRUE, 'default' => ''),
317
      'notification' => array('type' => 'varchar', 'length' => '1024', 'not null' => TRUE, 'default' => ''),
318
      'comment' => array('type' => 'text', 'size' => 'big', 'not null' => FALSE),
319
      'user_created' => array('type' => 'int', 'not null' => TRUE),
320
      'user_changed' => array('type' => 'int', 'not null' => TRUE),
321
      'timestamp_created' => array('type' => 'int', 'not null' => TRUE),
322
      'timestamp_changed' => array('type' => 'int', 'not null' => TRUE)),
323
    'primary key' => array('id'),
324
  );
325
326
  $schema['guifi_dns_hosts'] = array(
327
    'comment' => 'store guifi dns hosts',
328
    'fields' => array(
329
      'id' => array('type' => 'int', 'size' => 'medium', 'not null' => TRUE),
330
      'counter' => array('type' => 'int', 'size' => 'tiny', 'not null' => TRUE),
331
      'host' => array('type' => 'varchar', 'length' => '128', 'not null' => TRUE, 'default' => ''),
332
      'ipv4' => array('type' => 'varchar', 'length' => '16', 'not null' => TRUE, 'default' => ''),
333
      'ipv6' => array('type' => 'varchar', 'length' => '128', 'not null' => TRUE, 'default' => ''),
334
      'aliases' => array('type' => 'varchar', 'length' => '1024', 'not null' => TRUE, 'default' => ''),
335
      'options' => array('type' => 'varchar', 'length' => '1024', 'not null' => TRUE, 'default' => ''),
336
      'user_created' => array('type' => 'int', 'not null' => TRUE),
337
      'user_changed' => array('type' => 'int', 'not null' => TRUE),
338
      'timestamp_created' => array('type' => 'int', 'not null' => TRUE),
339
      'timestamp_changed' => array('type' => 'int', 'not null' => TRUE)),
340
    'primary key' => array('id', 'counter'),
341
  );
342
343
  $schema['guifi_api_tokens'] = array(
344
    'comment' => 'store guifi api tokens',
345
    'fields' => array(
346
      'uid' => array('type' => 'int', 'size' => 'medium', 'not null' => TRUE),
347
      'token' => array('type' => 'varchar', 'length' => '1024', 'not null' => TRUE, 'default' => ''),
348
      'created' => array('type' => 'int', 'not null' => TRUE),
349
      'rand_key' => array('type' => 'int', 'size' => 'medium', 'not null' => TRUE)),
350
    'primary key' => array('uid'),
351
  );
352
353
  return $schema;
354
}
355
356
function guifi_install() {
357
358
  drupal_install_schema('guifi');
359
360
  // --
361
  // -- interface types
362
  // -- relation describes MAC (related to base MAC)
363
  // --
364
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('1', 'interface', 'Lan', 'Device base address (Lan)', '0');");
365
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('2', 'interface', 'wLan/Lan', 'Device lan & wlan (bridged)', '2');");
366
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('3', 'interface', 'wLan', 'wireless lan', '2');");
367
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('4', 'interface', 'Wan', 'Wan', '1');");
368
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('5', 'interface', 'wds/p2p', 'P2P Wds', '2');");
369
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('6', 'interface', 'vlan', 'Virtual network over Lan', '0');");
370
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('7', 'interface', 'vwan', 'Virtual network over Wan', '1');");
371
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('8', 'interface', 'vwlan', 'Virtual network over wLan', '2');");
372
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('9', 'interface', 'vlan2', 'vlan #2 (plugged into port #2)', '4');");
373
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('10', 'interface', 'vlan3', 'vlan #3 (plugged into port #3)', '5');");
374
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('11', 'interface', 'vlan4', 'vlan #4 (plugged into port #4)', '6');");
375
  //db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('9999', 'interface', 'vlan1',   'vlan #1 (plugged into port #1)', '3');");
376
377
  // --
378
  // -- radio mode types
379
  // --
380
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('1', 'mode', 'ap', 'AP or AP with WDS', 'ap|client');");
381
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('2', 'mode', 'client', 'Wireless client', 'ap');");
382
  //db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('3', 'mode', 'bridge', 'Wireless Bridge', 'bridge');");
383
  //db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('4', 'mode', 'routedclient', 'Routed client',     'ap');");
384
  //db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('9999', 'mode', 'NAT Client', 'NAT Client', 'ap|client');");
385
  //db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('8888', 'mode', 'Routed Client', 'Routed Client', 'ap|client');");
386
  //db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('7777', 'mode', 'Bridged Client', 'Bridged  Client', 'ap|client');");
387
388
  // --
389
  // -- link types
390
  // --
391
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('1', 'link', 'cable', 'Cable', 'vlan|vwan|vwlan|vlan1|vlan2|vlan3|vlan4|Lan|wLan/Lan|Wan');");
392
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('2', 'link', 'tunnel', 'Tunnel', 'tunnel');");
393
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('3', 'link', 'bridge', 'Wireless Bridge', 'wLan/Lan|Lan');");
394
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('4', 'link', 'wds', 'Wireless WDS', 'wds/p2p');");
395
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('5', 'link', 'ap/client', 'Wireless AP/Client', 'Wan/wLan|wLan/Lan');");
396
397
  // --
398
  // -- device types
399
  // --
400
  db_query("INSERT INTO {guifi_types} (id, type, text, description) VALUES ('1', 'device', 'radio', 'Wireless device, like a router, bridge, AP...');");
401
  db_query("INSERT INTO {guifi_types} (id, type, text, description) VALUES ('2', 'device', 'phone', 'Voip handset, telephone');");
402
  db_query("-- INSERT INTO {guifi_types} (id, type, text, description) VALUES ('3', 'device', 'mobile', 'Mobile device. like a laptop or pda');");
403
  db_query("INSERT INTO {guifi_types} (id, type, text, description) VALUES ('4', 'device', 'server', 'Server computer');");
404
  db_query("INSERT INTO {guifi_types} (id, type, text, description) VALUES ('5', 'device', 'nat', 'Firewall, private Network behind a NAT');");
405
  db_query("INSERT INTO {guifi_types} (id, type, text, description) VALUES ('6', 'device', 'ADSL', 'ADSL router or device providing internet access');");
406
  db_query("INSERT INTO {guifi_types} (id, type, text, description) VALUES ('7', 'device', 'cam', 'Network camera. Live view.');");
407
  db_query("INSERT INTO {guifi_types} (id, type, text, description) VALUES ('8', 'device', 'generic', 'Any device that uses a public IP (PC, game console, laptop, pda..)');");
408
409
  // --
410
  // -- service types
411
  // --
412
  db_query("INSERT INTO {guifi_types} (id, type, text, description) VALUES ('1', 'service', 'AP', 'Wireless connectivity for end users');");
413
  db_query("INSERT INTO {guifi_types} (id, type, text, description) VALUES ('2', 'service', 'ADSL', 'Open ADSL-type internet access');");
414
  db_query("INSERT INTO {guifi_types} (id, type, text, description) VALUES ('3', 'service', 'Proxy', 'Internet access trough a proxy');");
415
  db_query("INSERT INTO {guifi_types} (id, type, text, description) VALUES ('4', 'service', 'DNS', 'Domain Name Server service');");
416
  db_query("INSERT INTO {guifi_types} (id, type, text, description) VALUES ('5', 'service', 'NTP', 'Network Time Protocol service');");
417
  db_query("INSERT INTO {guifi_types} (id, type, text, description) VALUES ('6', 'service', 'mail', 'Mail server');");
418
  db_query("INSERT INTO {guifi_types} (id, type, text, description) VALUES ('7', 'service', 'web', 'Web server');");
419
  db_query("INSERT INTO {guifi_types} (id, type, text, description) VALUES ('8', 'service', 'ftp', 'FTP or shared disk server');");
420
  db_query("INSERT INTO {guifi_types} (id, type, text, description) VALUES ('9', 'service', 'p2p', 'Peer 2 Peer server');");
421
  db_query("INSERT INTO {guifi_types} (id, type, text, description) VALUES ('10', 'service', 'asterisk', 'Asterisk VoIP PBX server');");
422
  db_query("INSERT INTO {guifi_types} (id, type, text, description) VALUES ('11', 'service', 'radio', 'Radio broadcast');");
423
  db_query("INSERT INTO {guifi_types} (id, type, text, description) VALUES ('12', 'service', 'tv', 'TV broadcast');");
424
  db_query("INSERT INTO {guifi_types} (id, type, text, description) VALUES ('13', 'service', 'irc', 'IRC (chat) server');");
425
  db_query("INSERT INTO {guifi_types} (id, type, text, description) VALUES ('14', 'service', 'IM', 'Instant Messaging, jabber server');");
426
  db_query("INSERT INTO {guifi_types} (id, type, text, description) VALUES ('15', 'service', 'cam', 'Network camera with live view.');");
427
  db_query("INSERT INTO {guifi_types} (id, type, text, description) VALUES ('16', 'service', 'svn', 'Subversion/CVS repository.');");
428
  db_query("INSERT INTO {guifi_types} (id, type, text, description) VALUES ('17', 'service', 'meteo', 'Weather station.');");
429
  db_query("INSERT INTO {guifi_types} (id, type, text, description) VALUES ('18', 'service', 'apt-cache', 'Linux distribution cache.');");
430
  db_query("INSERT INTO {guifi_types} (id, type, text, description) VALUES ('19', 'service', 'wol', 'Wake-on-lan');");
431
  db_query("INSERT INTO {guifi_types} (id, type, text, description) VALUES ('20', 'service', 'iperf', 'iperf bandwidth test');");
432
  db_query("INSERT INTO {guifi_types} (id, type, text, description) VALUES ('21', 'service', 'teamspeak', 'TeamSpeak Server - Voice conference');");
433
  db_query("INSERT INTO {guifi_types} (id, type, text, description) VALUES ('22', 'service', 'games', 'Generic games server');");
434
  db_query("INSERT INTO {guifi_types} (id, type, text, description) VALUES ('23', 'service', 'SNPgraphs', 'SNP graph server');");
435
  db_query("INSERT INTO {guifi_types} (id, type, text, description) VALUES ('24', 'service', 'Streaming', 'Videoconferènia i/o Streaming');");
436
  db_query("INSERT INTO {guifi_types} (id, type, text, description) VALUES ('25', 'service', 'VPN', 'Virtual Private Network');");
437
  db_query("INSERT INTO {guifi_types} (id, type, text, description) VALUES ('26', 'service', 'LDAP', 'LDAP Server');");
438
  db_query("INSERT INTO {guifi_types} (id, type, text, description) VALUES ('27', 'service', 'LogServer', 'Ip log Server');");
439
440
441
  // --
442
  // -- status flag types
443
  // --
444
  db_query("INSERT INTO {guifi_types} (id, type, text, description) VALUES ('1', 'status', 'Planned',  'Planned');");
445
  db_query("INSERT INTO {guifi_types} (id, type, text, description) VALUES ('2', 'status', 'Reserved', 'Reserved');");
446
  db_query("INSERT INTO {guifi_types} (id, type, text, description) VALUES ('3', 'status', 'Building', 'Building');");
447
  db_query("INSERT INTO {guifi_types} (id, type, text, description) VALUES ('4', 'status', 'Testing',  'Testing');");
448
  db_query("INSERT INTO {guifi_types} (id, type, text, description) VALUES ('5', 'status', 'Working',  'Online');");
449
  db_query("INSERT INTO {guifi_types} (id, type, text, description) VALUES ('6', 'status', 'Dropped',  'Dropped');");
450
451
  // --
452
  // -- protocol types
453
  // --
454
  update_sql("DELETE FROM `guifi_types` WHERE `type` = 'protocol'");
455
  db_query("INSERT INTO {guifi_types} (id, type, text, description) VALUES ('1', 'protocol', '802.11a', '802.11a (1-54Mbps - 5Ghz)');");
456
  db_query("INSERT INTO {guifi_types} (id, type, text, description) VALUES ('2', 'protocol', '802.11b', '802.11b (1-11Mbps - 2.4Ghz)');");
457
  db_query("INSERT INTO {guifi_types} (id, type, text, description) VALUES ('3', 'protocol', '802.11g', '802.11g (2-54Mbps - 2.4Ghz)');");
458
  db_query("INSERT INTO {guifi_types} (id, type, text, description) VALUES ('4', 'protocol', '802.11n', '802.11n - MIMO (1-125Mbps - 2.4/5Ghz)');");
459
  db_query("INSERT INTO {guifi_types} (id, type, text, description) VALUES ('5', 'protocol', 'WiMAX', '802.16a - WiMAX (1-125Mbps - 2-8Ghz)');");
460
  db_query("INSERT INTO {guifi_types} (id, type, text, description) VALUES ('6', 'protocol', 'legacy', 'legacy/proprietary protocol');");
461
462
  // --
463
  // -- firmware types
464
  // --
465
  update_sql("DELETE FROM `guifi_types` WHERE `type` = 'firmware'");
466
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('1', 'firmware', 'n/a', 'not available', NULL);");
467
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('2', 'firmware', 'Alchemy', 'Alchemy from sveasoft', 'WRT54Gv1-4|WRT54GSv1-2');");
468
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('3', 'firmware', 'Talisman', 'Talisman from sveasoft', 'WRT54Gv1-4|WRT54GL|WRT54GSv1-2|WRT54GSv4');");
469
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('4', 'firmware', 'DD-WRTv23', 'DD-WRTv23Beta2 from BrainSlayer', 'WRT54Gv1-4|WRT54GL|WRT54GSv1-2|WRT54GSv4|Asus WL-500xx|WHR-HP-G54, WHR-G54S|NanoStation2|NanoStation5|NanoStation Loco2|NanoStation Loco5|Bullet2|Bullet5|RouterStation|RouterStationPro|Avila GW2348-4');");
470
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('5', 'firmware', 'DD-guifi', 'DD-guifi from Miquel Martos', 'WRT54Gv1-4|WRT54GL|WRT54GSv1-2|WRT54GSv4|WHR-HP-G54, WHR-G54S');");
471
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('6', 'firmware', 'RouterOSv2.9', 'RouterOS 2.9 from Mikrotik', 'Routerboard 532|Routerboard 133C|Routerboard 133|Routerboard 112|Routerboard 153|Supertrasto guifiBUS guifi.net');");
472
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('7', 'firmware', 'whiterussian', 'OpenWRT-whiterussian', 'WRT54Gv1-4|WRT54GL|WRT54GSv1-2|WRT54GSv4|Wrap|Routerboard 532|Routerboard 133C|Routerboard 133|Routerboard 112|Routerboard 153');");
473
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('8', 'firmware', 'kamikaze', 'OpenWRT kamikaze',
474
   'WRT54Gv1-4|WRT54GL|WRT54GSv1-2|WRT54GSv4|Meraki/Fonera|Wrap|Routerboard 532|Routerboard 133C|Routerboard 133|Routerboard 112|Routerboard 153|Supertrasto guifiBUS guifi.net|NanoStation2|NanoStation5|NanoStation Loco2|NanoStation Loco5|Bullet2|Bullet5|RouterStation|RouterStationPro|Avila GW2348-4|Asus WL-500xx|Alix1|Alix2|Alix3');");
475
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('9', 'firmware', 'Freifunk-BATMAN', 'OpenWRT-Freifunk-v1.6.16 with B.A.T.M.A.N', 'WRT54Gv1-4|WRT54GL|WRT54GSv1-2|WRT54GSv4|WHR-HP-G54, WHR-G54S');");
476
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('10', 'firmware', 'RouterOSv3.x', 'RouterOS 3.x from Mikrotik', 'Routerboard 532|Routerboard 133C|Routerboard 133|Routerboard 112|Routerboard 153|Supertrasto guifiBUS guifi.net|Routerboard 600|Routerboard 411|Routerboard 333|Routerboard 433');");
477
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('11', 'firmware', 'AirOsv221', 'Ubiquti AirOs 2.2.1', 'NanoStation2|NanoStation5|NanoStation Loco2|NanoStation Loco5|Bullet2|Bullet5')");
478
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('12', 'firmware', 'Freifunk-OLSR', 'OpenWRT-Freifunk-v1.6.16 with OLSR', 'WRT54Gv1-4|WRT54GL|WRT54GSv1-2|WRT54GSv4|WHR-HP-G54, WHR-G54S');");
479
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('13', 'firmware', 'AirOsv30', 'Ubiquti AirOs 3.0', 'NanoStation2|NanoStation5|NanoStation Loco2|NanoStation Loco5|Bullet2|Bullet5')");
480
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('14', 'firmware', 'RouterOSv4.0+', 'RouterOS 4.0 to 4.6 from Mikrotik', 'Routerboard 532|Routerboard 133C|Routerboard 133|Routerboard 112|Routerboard 153|Supertrasto guifiBUS guifi.net|Routerboard 600|Routerboard 411|Routerboard 333|Routerboard 433|Routerboard 800');");
481
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('15', 'firmware', 'AirOsv52', 'Ubiquti AirOs 5.2', 'AirMaxM2 Rocket/Nano/Loco|AirMaxM5 Rocket/Nano/Loco|AirMaxM2 Bullet/PwBrg/AirGrd/NanoBr|AirMaxM5 Bullet/PwBrg/AirGrd/NanoBr');");
482
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('16', 'firmware', 'RouterOSv4.7+', 'RouterOS 4.7 or newer from Mikrotik', 'Routerboard 532|Routerboard 133C|Routerboard 133|Routerboard 112|Routerboard 153|Supertrasto guifiBUS guifi.net|Routerboard 600|Routerboard 411|Routerboard 333|Routerboard 433|Routerboard 800|Routerboard 750/750G');");
483
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('17', 'firmware', 'GuifiStationOS1.0', 'GuifiStationOS v1.0 from Setup Informatica', 'GuifiStation2|GuifiStation5');");
484
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('18', 'firmware', 'gsffirm', 'Firmware de GràciaSenseFils MANET', 'Alix2|Alix3|WRT54Gv1-4|WRT54GL|WRT54GSv1-2|WRT54GSv4|Asus WL-500xx|WHR-HP-G54, WHR-G54S|NanoStation2|NanoStation5|NanoStation Loco2|NanoStation Loco5|Bullet2|Bullet5|RouterStation|RouterStationPro|Meraki/Fonera');");
485
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('19', 'firmware', 'RouterOSv5.x', 'RouterOS 5.x or newer from Mikrotik', 'Routerboard 532|Routerboard 133C|Routerboard 133|Routerboard 112|Routerboard 153|Supertrasto guifiBUS guifi.net|Routerboard 600|Routerboard 411|Routerboard 333|Routerboard 433|Routerboard 800|Routerboard 750/750G');");
486
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('20', 'firmware', 'AirOsv3.6+', 'Ubiquti AirOs 3.6+', 'NanoStation2|NanoStation5|NanoStation Loco2|NanoStation Loco5|Bullet2|Bullet5')");
487
  
488
  // --
489
  // -- antenna types
490
  // --
491
  db_query("INSERT INTO {guifi_types} (id, type, text, description) VALUES ('1', 'antenna', '0', 'original/integrated');");
492
  db_query("INSERT INTO {guifi_types} (id, type, text, description) VALUES ('2', 'antenna', '360', 'omnidirectional');");
493
  db_query("INSERT INTO {guifi_types} (id, type, text, description) VALUES ('3', 'antenna', '6', 'yagi/directive');");
494
  db_query("INSERT INTO {guifi_types} (id, type, text, description) VALUES ('4', 'antenna', '90', 'sector 90 degrees');");
495
  db_query("INSERT INTO {guifi_types} (id, type, text, description) VALUES ('5', 'antenna', '120', 'sector 120 degrees');");
496
  db_query("INSERT INTO {guifi_types} (id, type, text, description) VALUES ('6', 'antenna', '90', 'patch 90 degrees');");
497
  db_query("INSERT INTO {guifi_types} (id, type, text, description) VALUES ('7', 'antenna', '60', 'patch 60 degrees');");
498
  db_query("INSERT INTO {guifi_types} (id, type, text, description) VALUES ('8', 'antenna', '30', 'patch 30 degrees');");
499
500
  // --
501
  // -- orientation (bearing) types
502
  // --
503
/*
504
-- INSERT INTO {guifi_types} (id, type, text, description) VALUES ('bearing', 'N',   'North');
505
-- INSERT INTO {guifi_types} (id, type, text, description) VALUES ('bearing', 'NE',  'North east');
506
-- INSERT INTO {guifi_types} (id, type, text, description) VALUES ('bearing', 'E',   'East');
507
-- INSERT INTO {guifi_types} (id, type, text, description) VALUES ('bearing', 'SE',  'South east');
508
-- INSERT INTO {guifi_types} (id, type, text, description) VALUES ('bearing', 'S',   'South');
509
-- INSERT INTO {guifi_types} (id, type, text, description) VALUES ('bearing', 'SW',  'South west');
510
-- INSERT INTO {guifi_types} (id, type, text, description) VALUES ('bearing', 'W',   'West');
511
-- INSERT INTO {guifi_types} (id, type, text, description) VALUES ('bearing', 'NW',  'North east');
512
-- INSERT INTO {guifi_types} (id, type, text, description) VALUES ('bearing', 'all', '360 degrees');
513
*/
514
  // --
515
  // -- Time zones
516
  // --
517
518
  db_query("INSERT INTO {guifi_types} (id, type, text, description) VALUES ('1', 'tz', '-12 1 0', '(GMT-12:00) Kwajalein');");
519
  db_query("INSERT INTO {guifi_types} (id, type, text, description) VALUES ('2', 'tz', '-11 1 0', '(GMT-11:00) Midway Island, Samoa');");
520
  db_query("INSERT INTO {guifi_types} (id, type, text, description) VALUES ('3', 'tz', '-10 1 0', '(GMT-10:00) Hawaii');");
521
  db_query("INSERT INTO {guifi_types} (id, type, text, description) VALUES ('4', 'tz', '-09 1 1', '(GMT-09:00) Alaska');");
522
  db_query("INSERT INTO {guifi_types} (id, type, text, description) VALUES ('5', 'tz', '-08 1 1', '(GMT-08:00) Pacific Time (USA &amp; Canada)');");
523
  db_query("INSERT INTO {guifi_types} (id, type, text, description) VALUES ('6', 'tz', '-07 1 0', '(GMT-07:00) Arizona');");
524
  db_query("INSERT INTO {guifi_types} (id, type, text, description) VALUES ('7', 'tz', '-07 2 1', '(GMT-07:00) Mountain Time (USA &amp; Canada)');");
525
  db_query("INSERT INTO {guifi_types} (id, type, text, description) VALUES ('8', 'tz', '-06 1 0', '(GMT-06:00) Mexico');");
526
  db_query("INSERT INTO {guifi_types} (id, type, text, description) VALUES ('9', 'tz', '-06 2 1', '(GMT-06:00) Central Time (USA &amp; Canada)');");
527
  db_query("INSERT INTO {guifi_types} (id, type, text, description) VALUES ('10', 'tz', '-05 1 0', '(GMT-05:00) Indiana East, Colombia, Panama');");
528
  db_query("INSERT INTO {guifi_types} (id, type, text, description) VALUES ('11', 'tz', '-05 2 1', '(GMT-05:00) Eastern Time (USA &amp; Canada)');");
529
  db_query("INSERT INTO {guifi_types} (id, type, text, description) VALUES ('12', 'tz', '-04 1 0', '(GMT-04:00) Bolivia, Venezuela');");
530
  db_query("INSERT INTO {guifi_types} (id, type, text, description) VALUES ('13', 'tz', '-04 2 1', '(GMT-04:00) Atlantic Time (Canada), Brazil West');");
531
  db_query("INSERT INTO {guifi_types} (id, type, text, description) VALUES ('14', 'tz', '-03.5 1 1', '(GMT-03:30) Newfoundland');");
532
  db_query("INSERT INTO {guifi_types} (id, type, text, description) VALUES ('15', 'tz', '-03 1 0', '(GMT-03:00) Guyana');");
533
  db_query("INSERT INTO {guifi_types} (id, type, text, description) VALUES ('16', 'tz', '-03 2 1', '(GMT-03:00) Brazil East, Greenland');");
534
  db_query("INSERT INTO {guifi_types} (id, type, text, description) VALUES ('17', 'tz', '-02 1 0', '(GMT-02:00) Mid-Atlantic');");
535
  db_query("INSERT INTO {guifi_types} (id, type, text, description) VALUES ('18', 'tz', '-01 1 2', '(GMT-01:00) Azores');");
536
  db_query("INSERT INTO {guifi_types} (id, type, text, description) VALUES ('19', 'tz', '+00 1 0', '(GMT) Gambia, Liberia, Morocco');");
537
  db_query("INSERT INTO {guifi_types} (id, type, text, description) VALUES ('20', 'tz', '+00 2 2', '(GMT) England');");
538
  db_query("INSERT INTO {guifi_types} (id, type, text, description) VALUES ('21', 'tz', '+01 1 0', '(GMT+01:00) Tunisia');");
539
  db_query("INSERT INTO {guifi_types} (id, type, text, description) VALUES ('22', 'tz', '+01 2 2', '(GMT+01:00) Gurb, France, Germany, Italy');");
540
  db_query("INSERT INTO {guifi_types} (id, type, text, description) VALUES ('23', 'tz', '+02 1 0', '(GMT+02:00) South Africa');");
541
  db_query("INSERT INTO {guifi_types} (id, type, text, description) VALUES ('24', 'tz', '+02 2 2', '(GMT+02:00) Greece, Ukraine, Romania, Turkey');");
542
  db_query("INSERT INTO {guifi_types} (id, type, text, description) VALUES ('25', 'tz', '+03 1 0', '(GMT+03:00) Iraq, Jordan, Kuwait');");
543
  db_query("INSERT INTO {guifi_types} (id, type, text, description) VALUES ('26', 'tz', '+04 1 0', '(GMT+04:00) Armenia');");
544
  db_query("INSERT INTO {guifi_types} (id, type, text, description) VALUES ('27', 'tz', '+05 1 0', '(GMT+05:00) Pakistan, Russia');");
545
  db_query("INSERT INTO {guifi_types} (id, type, text, description) VALUES ('28', 'tz', '+06 1 0', '(GMT+06:00) Bangladesh, Russia');");
546
  db_query("INSERT INTO {guifi_types} (id, type, text, description) VALUES ('29', 'tz', '+07 1 0', '(GMT+07:00) Thailand, Russia');");
547
  db_query("INSERT INTO {guifi_types} (id, type, text, description) VALUES ('30', 'tz', '+08 1 0', '(GMT+08:00) China, Hong Kong, Australia Western');");
548
  db_query("INSERT INTO {guifi_types} (id, type, text, description) VALUES ('31', 'tz', '+08 2 0', '(GMT+08:00) Singapore, Taiwan, Russia');");
549
  db_query("INSERT INTO {guifi_types} (id, type, text, description) VALUES ('32', 'tz', '+09 1 0', '(GMT+09:00) Japan, Korea');");
550
  db_query("INSERT INTO {guifi_types} (id, type, text, description) VALUES ('33', 'tz', '+09.5 1 4', '(GMT+09:30) Australia Central');");
551
  db_query("INSERT INTO {guifi_types} (id, type, text, description) VALUES ('34', 'tz', '+10 1 0', '(GMT+10:00) Guam, Russia');");
552
  db_query("INSERT INTO {guifi_types} (id, type, text, description) VALUES ('35', 'tz', '+10 2 4', '(GMT+10:00) Australia Eastern');");
553
  db_query("INSERT INTO {guifi_types} (id, type, text, description) VALUES ('36', 'tz', '+11 1 0', '(GMT+11:00) Solomon Islands');");
554
  db_query("INSERT INTO {guifi_types} (id, type, text, description) VALUES ('37', 'tz', '+12 1 0', '(GMT+12:00) Fiji');");
555
  db_query("INSERT INTO {guifi_types} (id, type, text, description) VALUES ('38', 'tz', '+12 2 4', '(GMT+12:00) New Zealand');");
556
557
  // --
558
  // -- Wireless Channels
559
  // --
560
  update_sql("DELETE FROM `guifi_types` WHERE `type` = 'channel'");
561
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('1', 'channel', '0', 'Auto 2.4GHz', '802.11b|802.11g|802.11n');");
562
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('2', 'channel', '1', '1 - 2412 MHz', '802.11b|802.11g|802.11n');");
563
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('3', 'channel', '2', '2 - 2417 MHz', '802.11b|802.11g|802.11n');");
564
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('4', 'channel', '3', '3 - 2422 MHz', '802.11b|802.11g|802.11n');");
565
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('5', 'channel', '4', '4 - 2422 MHz', '802.11b|802.11g|802.11n');");
566
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('6', 'channel', '5', '5 - 2432 MHz', '802.11b|802.11g|802.11n');");
567
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('7', 'channel', '6', '6 - 2437 MHz', '802.11b|802.11g|802.11n');");
568
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('8', 'channel', '7', '7 - 2442 MHz', '802.11b|802.11g|802.11n');");
569
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('9', 'channel', '8', '8 - 2447 MHz', '802.11b|802.11g|802.11n');");
570
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('10', 'channel', '9', '9 - 2452 MHz', '802.11b|802.11g|802.11n');");
571
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('11', 'channel', '10', '10 - 2457 MHz', '802.11b|802.11g|802.11n');");
572
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('12', 'channel', '11', '11 - 2462 MHz', '802.11b|802.11g|802.11n');");
573
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('13', 'channel', '12', '12 - 2467 MHz', '802.11b|802.11g|802.11n');");
574
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('14', 'channel', '13', '13 - 2472 MHz', '802.11b|802.11g|802.11n');");
575
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('15', 'channel', '14', '14 - 2477 MHz', '802.11b|802.11g|802.11n');");
576
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('16', 'channel', '5000', 'Auto 5GHz', '802.11a|802.11n');");
577
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('17', 'channel', '5180', '36 - 5180MHz - 20Mhz', '802.11a|802.11n');");
578
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('18', 'channel', '5200', '40 - 5200MHz - 20Mhz', '802.11a|802.11n');");
579
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('19', 'channel', '5220', '44 - 5220MHz - 20Mhz', '802.11a|802.11n');");
580
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('20', 'channel', '5240', '48 - 5240MHz - 20Mhz', '802.11a|802.11n');");
581
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('21', 'channel', '5260', '52 - 5260MHz - 20Mhz', '802.11a|802.11n');");
582
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('22', 'channel', '5280', '56 - 5280MHz - 20Mhz', '802.11a|802.11n');");
583
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('23', 'channel', '5300', '60 - 5300MHz - 20Mhz', '802.11a|802.11n');");
584
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('24', 'channel', '5320', '64 - 5320MHz - 20Mhz', '802.11a|802.11n');");
585
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('25', 'channel', '5500', '100 - 5500MHz - 20Mhz', '802.11a|802.11n');");
586
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('26', 'channel', '5520', '104 - 5520MHz - 20Mhz', '802.11a|802.11n');");
587
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('27', 'channel', '5540', '108 - 5540MHz - 20Mhz', '802.11a|802.11n');");
588
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('28', 'channel', '5560', '112 - 5560MHz - 20Mhz', '802.11a|802.11n');");
589
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('29', 'channel', '5580', '116 - 5580MHz - 20Mhz', '802.11a|802.11n');");
590
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('30', 'channel', '5600', '120 - 5600MHz - 20Mhz', '802.11a|802.11n');");
591
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('31', 'channel', '5620', '124 - 5620MHz - 20Mhz', '802.11a|802.11n');");
592
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('32', 'channel', '5640', '128 - 5640MHz - 20Mhz', '802.11a|802.11n');");
593
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('33', 'channel', '5660', '132 - 5660MHz - 20Mhz', '802.11a|802.11n');");
594
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('34', 'channel', '5680', '136 - 5680MHz - 20Mhz', '802.11a|802.11n');");
595
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('35', 'channel', '5700', '140 - 5700MHz - 20Mhz', '802.11a|802.11n');");
596
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('36', 'channel', '5185', '37! - 5185MHz - 20Mhz/5Mhz', '802.11a|802.11n');");
597
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('37', 'channel', '5190', '38! - 5190MHz - 20Mhz/5Mhz', '802.11a|802.11n');");
598
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('38', 'channel', '5195', '39! - 5195MHz - 20Mhz/5Mhz', '802.11a|802.11n');");
599
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('39', 'channel', '5205', '41! - 5205MHz - 20Mhz/5Mhz', '802.11a|802.11n');");
600
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('40', 'channel', '5210', '42! - 5210MHz - 20Mhz/5Mhz', '802.11a|802.11n');");
601
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('41', 'channel', '5215', '43! - 5215MHz - 20Mhz/5Mhz', '802.11a|802.11n');");
602
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('42', 'channel', '5225', '45! - 5225MHz - 20Mhz/5Mhz', '802.11a|802.11n');");
603
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('43', 'channel', '5230', '46! - 5230MHz - 20Mhz/5Mhz', '802.11a|802.11n');");
604
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('44', 'channel', '5235', '47! - 5235MHz - 20Mhz/5Mhz', '802.11a|802.11n');");
605
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('45', 'channel', '5245', '49! - 5245MHz - 20Mhz/5Mhz', '802.11a|802.11n');");
606
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('46', 'channel', '5250', '50! - 5250MHz - 20Mhz/5Mhz', '802.11a|802.11n');");
607
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('47', 'channel', '5255', '51! - 5255MHz - 20Mhz/5Mhz', '802.11a|802.11n');");
608
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('48', 'channel', '5265', '53! - 5265MHz - 20Mhz/5Mhz', '802.11a|802.11n');");
609
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('49', 'channel', '5270', '54! - 5270MHz - 20Mhz/5Mhz', '802.11a|802.11n');");
610
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('50', 'channel', '5275', '55! - 5275MHz - 20Mhz/5Mhz', '802.11a|802.11n');");
611
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('51', 'channel', '5285', '57! - 5285MHz - 20Mhz/5Mhz', '802.11a|802.11n');");
612
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('52', 'channel', '5290', '58! - 5290MHz - 20Mhz/5Mhz', '802.11a|802.11n');");
613
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('53', 'channel', '5295', '59! - 5295MHz - 20Mhz/5Mhz', '802.11a|802.11n');");
614
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('54', 'channel', '5305', '61! - 5305MHz - 20Mhz/5Mhz', '802.11a|802.11n');");
615
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('55', 'channel', '5310', '62! - 5310MHz - 20Mhz/5Mhz', '802.11a|802.11n');");
616
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('56', 'channel', '5315', '63! - 5315MHz - 20Mhz/5Mhz', '802.11a|802.11n');");
617
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('57', 'channel', '5505', '101! - 5505MHz - 20Mhz/5Mhz', '802.11a|802.11n');");
618
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('58', 'channel', '5510', '102! - 5510MHz - 20Mhz/5Mhz', '802.11a|802.11n');");
619
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('59', 'channel', '5515', '103! - 5515MHz - 20Mhz/5Mhz', '802.11a|802.11n');");
620
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('60', 'channel', '5525', '105! - 5525MHz - 20Mhz/5Mhz', '802.11a|802.11n');");
621
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('61', 'channel', '5530', '106! - 5530MHz - 20Mhz/5Mhz', '802.11a|802.11n');");
622
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('62', 'channel', '5535', '107! - 5535MHz - 20Mhz/5Mhz', '802.11a|802.11n');");
623
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('63', 'channel', '5545', '109! - 5545MHz - 20Mhz/5Mhz', '802.11a|802.11n');");
624
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('64', 'channel', '5550', '110! - 5550MHz - 20Mhz/5Mhz', '802.11a|802.11n');");
625
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('65', 'channel', '5555', '111! - 5555MHz - 20Mhz/5Mhz', '802.11a|802.11n');");
626
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('66', 'channel', '5565', '113! - 5565MHz - 20Mhz/5Mhz', '802.11a|802.11n');");
627
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('67', 'channel', '5570', '114! - 5570MHz - 20Mhz/5Mhz', '802.11a|802.11n');");
628
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('68', 'channel', '5575', '115! - 5575MHz - 20Mhz/5Mhz', '802.11a|802.11n');");
629
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('69', 'channel', '5585', '117! - 5585MHz - 20Mhz/5Mhz', '802.11a|802.11n');");
630
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('70', 'channel', '5590', '118! - 5590MHz - 20Mhz/5Mhz', '802.11a|802.11n');");
631
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('71', 'channel', '5595', '119! - 5595MHz - 20Mhz/5Mhz', '802.11a|802.11n');");
632
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('72', 'channel', '5605', '121! - 5605MHz - 20Mhz/5Mhz', '802.11a|802.11n');");
633
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('73', 'channel', '5610', '122! - 5610MHz - 20Mhz/5Mhz', '802.11a|802.11n');");
634
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('74', 'channel', '5615', '123! - 5615MHz - 20Mhz/5Mhz', '802.11a|802.11n');");
635
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('75', 'channel', '5625', '125! - 5625MHz - 20Mhz/5Mhz', '802.11a|802.11n');");
636
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('76', 'channel', '5630', '126! - 5630MHz - 20Mhz/5Mhz', '802.11a|802.11n');");
637
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('77', 'channel', '5635', '127! - 5635MHz - 20Mhz/5Mhz', '802.11a|802.11n');");
638
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('78', 'channel', '5645', '129! - 5645MHz - 20Mhz/5Mhz', '802.11a|802.11n');");
639
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('79', 'channel', '5650', '130! - 5650MHz - 20Mhz/5Mhz', '802.11a|802.11n');");
640
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('80', 'channel', '5655', '131! - 5655MHz - 20Mhz/5Mhz', '802.11a|802.11n');");
641
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('81', 'channel', '5665', '133! - 5665MHz - 20Mhz/5Mhz', '802.11a|802.11n');");
642
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('82', 'channel', '5670', '134! - 5670MHz - 20Mhz/5Mhz', '802.11a|802.11n');");
643
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('83', 'channel', '5675', '135! - 5675MHz - 20Mhz/5Mhz', '802.11a|802.11n');");
644
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('84', 'channel', '5685', '137! - 5685MHz - 20Mhz/5Mhz', '802.11a|802.11n');");
645
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('85', 'channel', '5690', '138! - 5690MHz - 20Mhz/5Mhz', '802.11a|802.11n');");
646
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('86', 'channel', '5695', '139! - 5695MHz - 20Mhz/5Mhz', '802.11a|802.11n');");
647
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('87', 'channel', '0000', 'Auto 2-8GHz', 'WiMAX');");
648
649
  // --
650
  // -- Routing methods
651
  // -- Relations contains supported firmwares
652
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('1', 'routing', 'n/a', 'None', '');");
653
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('2', 'routing', 'Static', 'Static routing', '');");
654
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('3', 'routing', 'Gateway', 'Gateway to AP', '');");
655
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('4', 'routing', 'OSPF', 'OSPF', 'Alchemy|Talisman|DD-WRTv23|DD-guifi|RouterOSv2.9|RouterOSv3.x');");
656
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('5', 'routing', 'BGP', 'BGP', 'Alchemy|Talisman|DD-WRTv23|DD-guifi|RouterOSv2.9|RouterOSv3.x');");
657
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('6', 'routing', 'OLSR', 'OLSR', '');");
658
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('7', 'routing', 'OLSR-NG', 'OLSR-NG', '');");
659
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('8', 'routing', 'BATMAN', 'BATMAN', '');");
660
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('9', 'routing', 'RIP', 'RIP', '');");
661
662
663
  // --
664
  // -- ad-hoc dynamic protocols
665
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('1', 'adhoc', 'OLSR', 'ad-hoc mesh - OLSR', 'kamikaze|freifunk-OLSR');");
666
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('2', 'adhoc', 'OLSR-NG', 'ad-hoc mesh - OLSR-NG', 'kamikaze');");
667
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('3', 'adhoc', 'BATMAN', 'ad-hoc mesh - BATMAN', 'kamikaze|freifunk-BATMAN');");
668
  db_query("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('4', 'adhoc', 'RouterOS', 'ad-hoc mesh - RouterOS', 'RouterOSv3.x');");
669
670
  // Antenna Gain Types
671
  db_query("INSERT INTO `guifi_types` (`id`, `type`, `text`, `description`, `relations`) VALUES ('1', 'antenna_gain', '5', '5', NULL);");
672
  db_query("INSERT INTO `guifi_types` (`id`, `type`, `text`, `description`, `relations`) VALUES ('2', 'antenna_gain', '6', '6', NULL);");
673
  db_query("INSERT INTO `guifi_types` (`id`, `type`, `text`, `description`, `relations`) VALUES ('3', 'antenna_gain', '7', '7', NULL);");
674
  db_query("INSERT INTO `guifi_types` (`id`, `type`, `text`, `description`, `relations`) VALUES ('4', 'antenna_gain', '8', '8', NULL);");
675
  db_query("INSERT INTO `guifi_types` (`id`, `type`, `text`, `description`, `relations`) VALUES ('5', 'antenna_gain', '9', '9', NULL);");
676
  db_query("INSERT INTO `guifi_types` (`id`, `type`, `text`, `description`, `relations`) VALUES ('6', 'antenna_gain', '10', '10', NULL);");
677
  db_query("INSERT INTO `guifi_types` (`id`, `type`, `text`, `description`, `relations`) VALUES ('7', 'antenna_gain', '11', '11', NULL);");
678
  db_query("INSERT INTO `guifi_types` (`id`, `type`, `text`, `description`, `relations`) VALUES ('8', 'antenna_gain', '12', '12', NULL);");
679
  db_query("INSERT INTO `guifi_types` (`id`, `type`, `text`, `description`, `relations`) VALUES ('9', 'antenna_gain', '13', '13', NULL);");
680
  db_query("INSERT INTO `guifi_types` (`id`, `type`, `text`, `description`, `relations`) VALUES ('10', 'antenna_gain', '14', '14', NULL);");
681
  db_query("INSERT INTO `guifi_types` (`id`, `type`, `text`, `description`, `relations`) VALUES ('11', 'antenna_gain', '15', '15', NULL);");
682
  db_query("INSERT INTO `guifi_types` (`id`, `type`, `text`, `description`, `relations`) VALUES ('12', 'antenna_gain', '16', '16', NULL);");
683
  db_query("INSERT INTO `guifi_types` (`id`, `type`, `text`, `description`, `relations`) VALUES ('13', 'antenna_gain', '17', '17', NULL);");
684
  db_query("INSERT INTO `guifi_types` (`id`, `type`, `text`, `description`, `relations`) VALUES ('14', 'antenna_gain', '18', '18', NULL);");
685
  db_query("INSERT INTO `guifi_types` (`id`, `type`, `text`, `description`, `relations`) VALUES ('15', 'antenna_gain', '19', '19', NULL);");
686
  db_query("INSERT INTO `guifi_types` (`id`, `type`, `text`, `description`, `relations`) VALUES ('16', 'antenna_gain', '20', '20', NULL);");
687
  db_query("INSERT INTO `guifi_types` (`id`, `type`, `text`, `description`, `relations`) VALUES ('17', 'antenna_gain', '21', '21', NULL);");
688
  db_query("INSERT INTO `guifi_types` (`id`, `type`, `text`, `description`, `relations`) VALUES ('18', 'antenna_gain', '22', '22', NULL);");
689
  db_query("INSERT INTO `guifi_types` (`id`, `type`, `text`, `description`, `relations`) VALUES ('19', 'antenna_gain', '23', '23', NULL);");
690
  db_query("INSERT INTO `guifi_types` (`id`, `type`, `text`, `description`, `relations`) VALUES ('20', 'antenna_gain', '24', '24', NULL);");
691
  db_query("INSERT INTO `guifi_types` (`id`, `type`, `text`, `description`, `relations`) VALUES ('21', 'antenna_gain', '25', '25', NULL);");
692
  db_query("INSERT INTO `guifi_types` (`id`, `type`, `text`, `description`, `relations`) VALUES ('22', 'antenna_gain', '26', '26', NULL);");
693
  db_query("INSERT INTO `guifi_types` (`id`, `type`, `text`, `description`, `relations`) VALUES ('23', 'antenna_gain', '27', '27', NULL);");
694
  db_query("INSERT INTO `guifi_types` (`id`, `type`, `text`, `description`, `relations`) VALUES ('24', 'antenna_gain', '28', '28', NULL);");
695
  db_query("INSERT INTO `guifi_types` (`id`, `type`, `text`, `description`, `relations`) VALUES ('25', 'antenna_gain', '29', '29', NULL);");
696
  db_query("INSERT INTO `guifi_types` (`id`, `type`, `text`, `description`, `relations`) VALUES ('26', 'antenna_gain', '30', '30', NULL);");
697
  db_query("INSERT INTO `guifi_types` (`id`, `type`, `text`, `description`, `relations`) VALUES ('27', 'antenna_gain', '31', '31', NULL);");
698
  db_query("INSERT INTO `guifi_types` (`id`, `type`, `text`, `description`, `relations`) VALUES ('28', 'antenna_gain', '32', '32', NULL);");
699
  db_query("INSERT INTO `guifi_types` (`id`, `type`, `text`, `description`, `relations`) VALUES ('29', 'antenna_gain', '33', '33', NULL);");
700
  db_query("INSERT INTO `guifi_types` (`id`, `type`, `text`, `description`, `relations`) VALUES ('30', 'antenna_gain', '34', '34', NULL);");
701
  db_query("INSERT INTO `guifi_types` (`id`, `type`, `text`, `description`, `relations`) VALUES ('31', 'antenna_gain', '35', '35', NULL);");
702
  db_query("INSERT INTO `guifi_types` (`id`, `type`, `text`, `description`, `relations`) VALUES ('32', 'antenna_gain', '36', '36', '');");
703
  db_query("INSERT INTO `guifi_types` (`id`, `type`, `text`, `description`, `relations`) VALUES ('33', 'antenna_gain', 'more...', 'more...', NULL);");
704
705
  // --
706
  // -- Volcant dades de la taula guifi_manufacturer
707
  // --
708
  update_sql("TRUNCATE guifi_manufacturer");
709
  db_query("INSERT INTO {guifi_manufacturer} VALUES (1, 'Other', NULL);");
710
  db_query("INSERT INTO {guifi_manufacturer} VALUES (2, 'Linksys', 'http://www.linksys.com');");
711
  db_query("INSERT INTO {guifi_manufacturer} VALUES (8, 'Mikrotik', 'http://mikrotik.com');");
712
  db_query("INSERT INTO {guifi_manufacturer} VALUES (9, 'Buffalo', 'http://www.buffalotech.com');");
713
  db_query("INSERT INTO {guifi_manufacturer} VALUES (10, 'Ubiquiti', 'http://www.ubnt.com');");
714
  db_query("INSERT INTO {guifi_manufacturer} VALUES (11, 'Meraki', 'http://meraki.com');");
715
  db_query("INSERT INTO {guifi_manufacturer} VALUES (12, 'Gateworks', 'http://www.gateworks.com');");
716
  db_query("INSERT INTO {guifi_manufacturer} VALUES (13, 'Asus', 'http://asus.com');");
717
  db_query("INSERT INTO {guifi_manufacturer} VALUES (14, 'Pccengines', 'http://www.pcengines.ch');");
718
  db_query("INSERT INTO {guifi_manufacturer} VALUES (15, 'Setup Informatica', 'http://www.setup.cat');");
719
  // --
720
  // -- guifi_model
721
  // --
722
  update_sql("TRUNCATE guifi_model");
723
  db_query("INSERT INTO `guifi_model` (`mid`, `fid`, `model`, `type`, `radiodev_max`, `etherdev_max`, `potencia_max`, `AP`, `virtualAP`, `client`, `interfaces`, `url`, `comments`, `supported`, `notification`, `user_created`, `user_changed`, `timestamp_created`, `timestamp_changed`) VALUES
724
(3, 1, 'Other', NULL, 1, 1, NULL, 'Yes', 'No', 'Yes', 'wLan/Lan', 'none', 'To be used for unknown or not listed devices', 'Yes', '', 0, 0, 0, 0),
725
(1, 2, 'WRT54Gv1-4', 'Extern', 1, 1, 251, 'Si', 'No', 'Hack', 'wLan/Lan|vlan|vlan2|vlan3|vlan4|Wan', 'http://www.linksys.com/products/product.', 'El canvi de potència, mode client i WDS, via hack.\r\nHacks disponibles: sveasoft (Satori, Alchemy...), OpenWRT...', 'Yes', '', 0, 0, 0, 0),
726
(15, 9, 'WHR-HP-G54, WHR-G54S', 'Extern', 1, 1, 251, 'No', '', 'Hack', 'wLan/Lan|vlan|vlan2|vlan3|vlan4|Wan', 'http://www.buffalo-technology.com/products/product-detail.php?productid=124&categoryid=28', 'El canvi de potència, mode client i WDS, via hack.', 'Yes', '', 0, 0, 0, 0),
727
(16, 2, 'WRT54GL', 'Extern', 1, 1, 251, 'No', '', 'Hack', 'wLan/Lan|vlan|vlan2|vlan3|vlan4|Wan', 'http://www.linksys.com/products/product.', 'El canvi de potència, mode client i WDS, via hack.\r\nHacks disponibles: sveasoft (Satori, Alchemy...), OpenWRT, DD-WRT, ...', 'Yes', '', 0, 0, 0, 0),
728
(17, 2, 'WRT54GSv1-2', 'Extern', 1, 1, 251, 'No', '', 'Hack', 'wLan/Lan|vlan2|vlan3|vlan4|Wan', 'http://www.linksys.com/products/product.', 'El canvi de potència, mode client i WDS, via hack.\r\nHacks disponibles: sveasoft (Satori, Alchemy...), OpenWRT, DD-WRT, ...', 'Yes', '', 0, 0, 0, 0),
729
(18, 2, 'WRT54GSv4', 'Extern', 1, 1, 251, 'No', '', 'Hack', 'wLan/Lan|vlan|vlan2|vlan3|vlan4|Wan', 'http://www.linksys.com/products/product.', 'El canvi de potència mode client i WDS, via hack.\r\nHacks disponibles: sveasoft (Satori, Alchemy...), OpenWRT, DD-WRT, ...', 'Yes', '', 0, 0, 0, 0),
730
(19, 8, 'Routerboard 532', NULL, 6, 1, 400, 'Si', 'Yes', 'Si', 'wLan/Lan|ether2|ether3|ether4|ether5|ether6|ether7|ether8|ether9', 'http://www.routerboard.com', NULL, 'Yes', '', 0, 0, 0, 0),
731
(20, 8, 'Routerboard 133C', NULL, 1, 1, 400, 'Si', 'Yes', 'Si', 'wLan/Lan', 'http://www.routerboard.com', NULL, 'Yes', '', 0, 0, 0, 0),
732
(21, 8, 'Routerboard 133', NULL, 3, 1, 400, 'Si', 'Yes', 'Si', 'wLan/Lan|ether2|ether3', 'http://www.routerboard.com', NULL, 'Yes', '', 0, 0, 0, 0),
733
(22, 8, 'Routerboard 112', NULL, 2, 1, 400, 'Si', 'Yes', 'Si', 'wLan/Lan', 'http://www.routerboard.com', NULL, 'Yes', '', 0, 0, 0, 0),
734
(23, 8, 'Routerboard 153', NULL, 3, 1, 400, 'Si', 'Yes', 'Si', 'wLan/Lan|ether2|ether3|ether4|ether5', 'http://www.routerboard.com', NULL, 'Yes', '', 0, 0, 0, 0),
735
(24, 8, 'Supertrasto guifiBUS guifi.net', NULL, 24, 1, 400, 'Si', 'Yes', 'Si', 'wLan/Lan|ether2|ether3|ether4|ether5', 'http://www.routerboard.com', NULL, 'Yes', '', 0, 0, 0, 0),
736
(25, 10, 'NanoStation2', 'Extern', 1, 1, 400, 'No', 'No', 'Si', 'Wan', 'http://ubnt.com/products/ns2.php', 'Permet Firmwares de tercers', 'Yes', '', 0, 0, 0, 0),
737
(26, 10, 'NanoStation5', 'Extern', 1, 1, 400, 'No', 'No', 'Si', 'Wan', 'http://ubnt.com/products/ns5.php', 'Permet Firmwares de tercers', 'Yes', '', 0, 0, 0, 0),
738
(27, 8, 'Routerboard 600', 'Extern', 8, 1, 400, 'Si', 'Si', 'Si', 'wLan/Lan|ether2|ether3', 'http://www.routerboard.com', NULL, 'Yes', '', 0, 0, 0, 0),
739
(28, 8, 'Routerboard 333', NULL, 6, 1, 400, 'Si', 'Yes', 'Si', 'wLan/Lan|ether2|ether3', 'http://www.routerboard.com', NULL, 'Yes', '', 0, 0, 0, 0),
740
(29, 8, 'Routerboard 411', NULL, 6, 1, 400, 'Si', 'Yes', 'Si', 'wLan/Lan', 'http://www.routerboard.com', NULL, 'Yes', '', 0, 0, 0, 0),
741
(30, 11, 'Meraki/Fonera', 'Extern', 1, 1, 60, 'Si', 'Yes', 'Si', 'wLan/Lan', 'http://meraki.com', NULL, 'Yes', '', 0, 0, 0, 0),
742
(31, 8, 'Routerboard 433', NULL, 6, 1, 400, 'Si', 'Yes', 'Si', 'wLan/Lan|ether2|ether3', 'http://www.routerboard.com', NULL, 'Yes', '', 0, 0, 0, 0),
743
(32, 10, 'LiteStation2', 'Extern', 1, 1, 400, 'No', 'No', 'Si', 'Wan', 'http://ubnt.com/products/ls2.php', 'Permet Firmwares de tercers', 'Yes', '', 0, 0, 0, 0),
744
(33, 10, 'LiteStation5', 'Extern', 1, 1, 400, 'No', 'No', 'Si', 'Wan', 'http://ubnt.com/products/ls5.php', 'Permet Firmwares de tercers', 'Yes', '', 0, 0, 0, 0),
745
(34, 10, 'NanoStation Loco2', 'Extern', 1, 1, 400, 'No', 'No', 'Si', 'Wan', 'http://www.ubnt.com/products/loco.php', 'Permet Firmwares de tercers', 'Yes', '', 0, 0, 0, 0),
746
(35, 10, 'NanoStation Loco5', 'Extern', 1, 1, 400, 'No', 'No', 'Si', 'Wan', 'http://www.ubnt.com/products/loco.php', 'Permet Firmwares de tercers', 'Yes', '', 0, 0, 0, 0),
747
(36, 10, 'Bullet2', 'Extern', 1, 1, 400, 'No', 'No', 'Si', 'Wan', 'http://www.ubnt.com/products/loco.php', 'Permet Firmwares de tercers', 'Yes', '', 0, 0, 0, 0),
748
(37, 10, 'Bullet5', 'Extern', 1, 1, 400, 'No', 'No', 'Si', 'Wan', 'http://www.ubnt.com/products/loco.php', 'Permet Firmwares de tercers', 'Yes', '', 0, 0, 0, 0),
749
(38, 10, 'RouterStation', 'Extern', 4, 1, 400, 'No', 'No', 'Si', 'Wan', 'http://ubnt.com/products/ls5.php', 'Permet Firmwares de tercers', 'Yes', '', 0, 0, 0, 0),
750
(39, 12, 'Avila GW2348-4', 'Extern', 4, 1, 400, 'No', 'No', 'Si', 'Wan', 'http://www.gateworks.com/products/avila/gw2348-4.php', 'Permet Firmwares de tercers', 'Yes', '', 0, 0, 0, 0),
751
(40, 13, 'Asus WL-500xx', 'Extern', 1, 1, 400, 'No', 'No', 'Si', 'Wan', 'http://asus.com/products.aspx?l1=29&l2=172&l3=743&l4=60&model=1277&modelmenu=1', 'Permet Firmwares de tercers', 'Yes', '', 0, 0, 0, 0),
752
(41, 14, 'Alix1', 'Extern', 5, 1, 400, 'No', 'No', 'Si', 'wLan/Lan|eth0|eth1|eth2', 'http://www.pcengines.ch/alix1d.htm', 'Permet Firmwares de tercers', 'Yes', '', 0, 0, 0, 0),
753
(42, 14, 'Alix2', 'Extern', 2, 1, 400, 'No', 'No', 'Si', 'wLan/Lan|eth0|eth1|eth2', 'http://www.pcengines.ch/alix2d.htm', 'Permet Firmwares de tercers', 'Yes', '', 0, 0, 0, 0),
754
(43, 14, 'Alix3', 'Extern', 2, 1, 400, 'No', 'No', 'Si', 'wLan/Lan|eth0|eth1|eth2', 'http://www.pcengines.ch/alix3d.htm', 'Permet Firmwares de tercers', 'Yes', '', 0, 0, 0, 0),
755
(44, 8, 'Routerboard 800', NULL, 8, 1, 400, 'Si', 'Yes', 'Si', 'wLan/Lan|ether2|ether3|ether4|ether5|ether6|ether7|ether8|ether9', 'http://www.routerboard.com', NULL, 'Yes', '', 0, 0, 0, 0),
756
(45, 10, 'AirMaxM2 Rocket/Nano/Loco', 'Extern', 1, 1, 100, 'Yes', 'No', 'Si', 'eth0|ath0', 'http://ubnt.com/airmax', 'Permet Firmwares de tercers', 'Yes', '', 0, 0, 0, 0),
757
(46, 10, 'AirMaxM5 Rocket/Nano/Loco', 'Extern', 1, 1, 100, 'Yes', 'No', 'Si', 'eth0|ath0', 'http://ubnt.com/airmax', 'Permet Firmwares de tercers', 'Yes', '', 0, 0, 0, 0),
758
(47, 10, 'AirMaxM2 Bullet/PwBrg/AirGrd/NanoBr', 'Extern', 1, 1, 100, 'Yes', 'No', 'Si', 'eth0|ath0', 'http://ubnt.com/airmax', 'Permet Firmwares de tercers', 'Yes', '', 0, 0, 0, 0),
759
(48, 10, 'AirMaxM5 Bullet/PwBrg/AirGrd/NanoBr', 'Extern', 1, 1, 100, 'Yes', 'No', 'Si', 'eth0|ath0', 'http://ubnt.com/airmax', 'Permet Firmwares de tercers', 'Yes', '', 0, 0, 0, 0),
760
(49, 15, 'GuifiStation2', 'Extern', 1, 1, 100, 'Yes', 'No', 'Si', 'eth0|ath0', 'http://tienda.setupinformatica.com/wac/detalle.php?codigo=CPEGS2', 'Permet Firmwares de tercers', 'Yes', '', 0, 0, 0, 0),
761
(50, 15, 'GuifiStation5', 'Extern', 1, 1, 100, 'Yes', 'No', 'Si', 'eth0|ath0', 'http://tienda.setupinformatica.com/wac/detalle.php?codigo=CPEGS5', 'Permet Firmwares de tercers', 'Yes', '', 0, 0, 0, 0),
762
(51, 10, 'RouterStationPro', 'Extern', 4, 1, 400, 'No', 'No', 'Si', 'Wan', 'http://ubnt.com/rspro', 'Permet Firmwares de tercers', 'Yes', '', 0, 0, 0, 0),
763
(52, 8, 'Routerboard 750/G', 'Extern', 0, 5, 400, 'Yes', 'Yes', 'Yes', 'Lan/Lan|ether1|ether2|ether3|ether4|ether5', 'http://www.routerboard.com/pricelist.php?showProduct=90', 'Permet Firmwares de tercers', 'Yes', '', 0, 0, 0, 0),
764
(53, 8, 'Routerboard SXT 5HnD', NULL, 1, 1, NULL, 'Yes', 'Yes', 'Yes', 'wlan1|ether1', 'http://www.routerboard.com/index.php?showProduct=108', NULL, 'Yes', '', 0, 0, 0, 0),
765
(54, 8, 'Routerboard 1100', NULL, 0, 13, NULL, 'Yes', 'No', 'Yes', 'Lan/Lan|ether1|ether2|ether3|ether4|ether5|ether6|ether7|ether8|ether9|ether10|ether11|ether12|ether13', 'http://www.routerboard.com/index.php?showProduct=98', NULL, 'Yes', '', 0, 0, 0, 0);");
766
767
  // --
768
  // -- user status types
769
  // --
770
  db_query("INSERT INTO {guifi_types} (id, type, text, description) VALUES ('1', 'user_status', 'New',  'New');");
771
  db_query("INSERT INTO {guifi_types} (id, type, text, description) VALUES ('2', 'user_status', 'Pending',  'Pending');");
772
  db_query("INSERT INTO {guifi_types} (id, type, text, description) VALUES ('3', 'user_status', 'Approved', 'Approved');");
773
  db_query("INSERT INTO {guifi_types} (id, type, text, description) VALUES ('4', 'user_status', 'Rejected', 'Rejected');");
774
775
  // --
776
  // -- content filter types
777
  // --hidden
778
  db_query("INSERT INTO {guifi_types} (id, type, text, description) VALUES ('1', 'filter', 'porn',  'Porn & explicit sex content');");
779
  db_query("INSERT INTO {guifi_types} (id, type, text, description) VALUES ('2', 'filter', 'violence', 'Violence & Aggressive content');");
780
  db_query("INSERT INTO {guifi_types} (id, type, text, description) VALUES ('3', 'filter', 'downloads', 'Downloads, file-sharing...');");
781
  db_query("INSERT INTO {guifi_types} (id, type, text, description) VALUES ('4', 'filter', 'drugs',  'Drugs');");
782
  db_query("INSERT INTO {guifi_types} (id, type, text, description) VALUES ('5', 'filter', 'video', 'Audio & Video sites');");
783
  db_query("INSERT INTO {guifi_types} (id, type, text, description) VALUES ('6', 'filter', 'gambling', 'Gambling');");
784
  db_query("INSERT INTO {guifi_types} (id, type, text, description) VALUES ('7', 'filter', 'hacking',  'Illegal hacking & cracking');");
785
  db_query("INSERT INTO {guifi_types} (id, type, text, description) VALUES ('8', 'filter', 'mail', 'Email & webmail sites');");
786
  db_query("INSERT INTO {guifi_types} (id, type, text, description) VALUES ('9', 'filter', 'ads', 'Advertising');");
787
  db_query("INSERT INTO {guifi_types} (id, type, text, description) VALUES ('10', 'filter', 'proxy',  'External proxys');");
788
  db_query("INSERT INTO {guifi_types} (id, type, text, description) VALUES ('11', 'filter', 'redirect', 'Redirectors');");
789
  db_query("INSERT INTO {guifi_types} (id, type, text, description) VALUES ('12', 'filter', 'spyware', 'Spyware');");
790
  db_query("INSERT INTO {guifi_types} (id, type, text, description) VALUES ('13', 'filter', 'cracks', 'Illegal warez exchange, cracks...');");
791
792
}
793
794
// --
795
// This new release can be installed in a clean database.
796
// But updates 1 and 2 are necessary if it is installed
797
// on the old database that contains data for migrating purposes.
798
// Please, skip updates 1 and 2 if you work on a clean database.
799
// These updates will be commentED when the new release is published.
800
// --
801
// During development period, please create updates indicating the number of SVN revision.
802
// (Ex: guifi_update_XXX) Where XXX equals the number of revision.
803
// We move these updates to updates 1 and 2 when the process is necessary.
804
// --
805
806
//
807
// Database Updates!
808
//
809
/*
810
function guifi_update_1() {
811
  $items = array();
812
813
// Drop obsolete tables
814
    $items[] = update_sql("DROP TABLE `guifi_blocks`");
815
816
// Update some fields with a new names , types and lengths.
817
818
    $items[] = update_sql("ALTER TABLE `guifi_model`
819
                           CHANGE `mid` `mid` INT( 11 ) NOT NULL AUTO_INCREMENT ,
820
                           CHANGE model model VARCHAR( 40 ) NOT NULL DEFAULT '' ,
821
                           CHANGE `tipus` `tipus` VARCHAR( 10 ) NULL COMMENT 'Extern, PCI, PCMCIA' ,
822
                           CHANGE `radiodev_max` `radiodev_max` TINYINT( 2 ) NOT NULL DEFAULT '1' ,
823
                           CHANGE `modes` `modes` VARCHAR( 20 ) NOT NULL DEFAULT '802.11bg' COMMENT '802.11bg,802.11b,802.11a,802.11abg,WiMax,802.11n' ,
824
                           CHANGE `AP` `AP` VARCHAR( 5 ) NULL COMMENT 'Yes, No' ,
825
                           CHANGE `virtualAP` `virtualAP` VARCHAR( 5 ) NOT NULL DEFAULT 'no' COMMENT 'Yes, No' ,
826
                           CHANGE `WDS` `WDS` VARCHAR( 5 ) NULL COMMENT 'Si,No,Hack' ,
827
                           CHANGE `bridge` `bridge` VARCHAR( 5 ) NULL COMMENT 'Si,No,Hack' ,
828
                           CHANGE `client` `client` VARCHAR( 5 ) NULL COMMENT 'Si,No,Hack' ,
829
                           CHANGE `antenes` `antenes` VARCHAR( 5 ) NULL DEFAULT '2' COMMENT '2,1,0' ,
830
                           CHANGE `router` `router` VARCHAR( 5 ) NULL DEFAULT NULL COMMENT 'Si,No' ,
831
                           CHANGE `firewall` `firewall` VARCHAR( 5 ) NULL DEFAULT NULL COMMENT 'Si,No' ,
832
                           CHANGE `QoS` `QoS` VARCHAR( 5 ) NULL DEFAULT NULL COMMENT 'Si,No,Hack' ,
833
                           CHANGE `snmp` `snmp` VARCHAR( 5 ) NULL DEFAULT NULL COMMENT 'Si,No,Hack' ,
834
                           CHANGE `hack` `hack` VARCHAR( 5 ) NULL DEFAULT NULL COMMENT 'Si,No' ,
835
                           CHANGE `interfaces` `interfaces` VARCHAR( 240 ) NULL ,
836
                           CHANGE `supported` `supported` VARCHAR( 25 ) NOT NULL DEFAULT 'Yes'");
837
838
    $items[] = update_sql("ALTER TABLE `guifi_location`
839
                           CHANGE `nick` `nick` VARCHAR(40) NOT NULL DEFAULT '',
840
                           CHANGE `contact` `notification` VARCHAR( 1024 ) NOT NULL,
841
                           CHANGE `stable` `stable` VARCHAR(25) NOT NULL DEFAULT 'Yes',
842
                           CHANGE `graph_server` `graph_server` INT( 11 ) NOT NULL DEFAULT '0' COMMENT 'Foreign key to guifi_services (type SNPGraph)'");
843
844
    $items[] = update_sql("ALTER TABLE `guifi_devices`
845
                           CHANGE `nick` `nick` VARCHAR( 40 ) NOT NULL ,
846
                           CHANGE `contact` `notification` VARCHAR( 1024 ) NOT NULL,
847
                           CHANGE `graph_server` `graph_server` INT( 11 ) NOT NULL DEFAULT '0' COMMENT 'Foreign key to guifi_services (type SNPGraph)'");
848
849
    $items[] = update_sql("ALTER TABLE `guifi_interfaces`
850
                           CHANGE `device_id` `device_id` INT( 11 ) NOT NULL");
851
852
    $items[] = update_sql("ALTER TABLE `guifi_ipv4`
853
                           CHANGE `id` `id` INT( 11 ) NOT NULL");
854
855
    $items[] = update_sql("ALTER TABLE `guifi_links`
856
                           CHANGE `id` `id` INT( 11 ) NOT NULL ,
857
                           CHANGE `nid` `nid` INT( 11 ) NOT NULL ,
858
                           CHANGE `device_id` `device_id` INT( 11 ) NOT NULL ,
859
                           CHANGE `interface_id` `interface_id` INT( 11 ) NOT NULL ,
860
                           CHANGE `ipv4_id` `ipv4_id` INT( 11 ) NOT NULL");
861
862
    $items[] = update_sql("ALTER TABLE `guifi_manufacturer`
863
                           CHANGE `fid` `fid` INT( 11 ) NOT NULL AUTO_INCREMENT ,
864
                           CHANGE `nom` `nom` VARCHAR( 40 ) NOT NULL DEFAULT ''");
865
866
    $items[] = update_sql("ALTER TABLE `guifi_networks`
867
                           CHANGE `base` `base` VARCHAR( 255 ) NOT NULL DEFAULT '' ,
868
                           CHANGE `zone` `zone` INT( 10 ) UNSIGNED NOT NULL ,
869
                           CHANGE `network_type` `network_type` VARCHAR( 10 ) NOT NULL DEFAULT 'public'");
870
871
    $items[] = update_sql("ALTER TABLE `guifi_permission`
872
                           CHANGE `perm` `perm` LONGTEXT NULL DEFAULT NULL");
873
874
    $items[] = update_sql("ALTER TABLE `guifi_radios`
875
                           CHANGE `nid` `nid` INT( 11 ) NOT NULL ,
876
                           CHANGE `model_id` `model_id` INT( 10 ) NOT NULL ,
877
                           CHANGE `ssid` `ssid` VARCHAR( 20 ) NOT NULL DEFAULT '',
878
                           CHANGE `antmode` `antenna_mode` VARCHAR( 1024 ) NOT NULL ,
879
                           CHANGE `clients_accepted` `clients_accepted` VARCHAR( 5 ) NULL DEFAULT 'Yes' COMMENT 'Yes,No'");
880
881
    $items[] = update_sql("ALTER TABLE `guifi_services`
882
                           CHANGE `nick` `nick` VARCHAR( 40 ) NOT NULL DEFAULT '' ,
883
                           CHANGE `service_type` `service_type` VARCHAR( 40 ) NOT NULL DEFAULT '',
884
                           CHANGE `contact` `notification` VARCHAR( 1024 ) NOT NULL");
885
886
    $items[] = update_sql("ALTER TABLE `guifi_types`
887
                           CHANGE `type` `type` VARCHAR( 15 ) NOT NULL ,
888
                           CHANGE `text` `text` VARCHAR( 15 ) NOT NULL ,
889
                           CHANGE `description` `description` LONGTEXT NOT NULL ,
890
                           CHANGE `relations` `relations` LONGTEXT NULL DEFAULT NULL");
891
892
    $items[] = update_sql("ALTER TABLE `guifi_users`
893
                           CHANGE `firstname` `firstname` VARCHAR( 60 ) NOT NULL DEFAULT '' ,
894
                           CHANGE `lastname` `lastname` VARCHAR( 60 ) NOT NULL DEFAULT '' ,
895
                           CHANGE `username` `username` VARCHAR( 40 ) NOT NULL DEFAULT '' ,
896
                           CHANGE `password` `password` VARCHAR( 128 ) NOT NULL DEFAULT '',
897
                           CHANGE `email` `notification` VARCHAR( 1024 ) NULL DEFAULT NULL");
898
899
900
    $items[] = update_sql("ALTER TABLE `guifi_zone`
901
                           CHANGE `title` `title` VARCHAR( 255 ) NOT NULL DEFAULT '',
902
                           CHANGE `image` `image` VARCHAR( 255 ) NOT NULL DEFAULT '',
903
                           CHANGE `notification` `notification` VARCHAR( 1024 ) NOT NULL ,
904
                           CHANGE `local` `local` VARCHAR( 5 ) NULL DEFAULT 'Yes' COMMENT 'Yes,No',
905
                           CHANGE `graph_server` `graph_server` INT( 11 ) NOT NULL DEFAULT '0' COMMENT 'Foreign key to guifi_services (type SNPGraph)'");
906
907
// Update fileds with the new types
908
    $items[] = update_sql("UPDATE node SET type = REPLACE (type,'guifi-zone', 'guifi_zone')");
909
    $items[] = update_sql("UPDATE node SET type = REPLACE (type,'guifi-node', 'guifi_node')");
910
    $items[] = update_sql("UPDATE node SET type = REPLACE (type,'guifi-service', 'guifi_service')");
911
    $items[] = update_sql("UPDATE {guifi_devices} SET extra = REPLACE(extra,'s:11:\"NanoStation\"', 's:9:\"AirOsv221\"')");
912
913
    $query = db_query("
914
      SELECT *
915
      FROM {guifi_radios}
916
      WHERE protocol = '802.11abg'
917
    ");
918
    while ($protocol = db_fetch_object($query)) {
919
      if ($protocol->channel < 5000)
920
        $items[] = update_sql(sprintf("UPDATE {guifi_radios} SET protocol = REPLACE (protocol, '802.11abg', '802.11b') WHERE id = %d AND channel= %d", $protocol->id, $protocol->channel));
921
    }
922
    $items[] = update_sql("UPDATE {guifi_radios} SET protocol = REPLACE (protocol, '802.11g+', '802.11g')");
923
    $items[] = update_sql("UPDATE {guifi_radios} SET protocol = REPLACE (protocol, '802.11abg', '802.11a')");
924
    $items[] = update_sql("UPDATE {guifi_radios} SET protocol = REPLACE (protocol, '802.11bg', '802.11b')");
925
926
// Set abbreviated nick to zones without nick.
927
    $q = db_query('SELECT id, title, nick FROM {guifi_zone}');
928
      while ($z = db_fetch_object($q)) {
929
        if (empty($z->nick)) {
930
          $nick = guifi_abbreviate($z->title);
931
          $items[] = update_sql(
932
            sprintf("UPDATE {guifi_zone} SET nick='%s' WHERE id=%d",
933
            $nick,$z->id)
934
            );
935
        }
936
      }
937
938
  return $items;
939
}
940
941
//
942
// Database New entries!
943
//
944
function guifi_update_2() {
945
946
  // changes @ guifi_zones
947
  $items = array();
948
949
  db_add_field($items,'guifi_zone', 'zone_mode',
950
    array('type' => 'varchar', 'length' => 25, 'not null' => TRUE, 'default' => 'infrastructure', 'COMMENT' => 'infrastructure/ad-hoc'));
951
  db_add_field($items, 'guifi_zone', 'proxy_id',
952
    array('type' => 'int', 'length' => '11', 'not null' => TRUE, 'default' => '0', 'COMMENT' => 'Foreign key to guifi_services (type Proxy)'));
953
  db_add_field($items, 'guifi_zone', 'voip_id',
954
    array('type' => 'int', 'length' => '11', 'not null' => TRUE, 'default' => '0', 'COMMENT' => 'Foreign key to guifi_services (type VoIP)'));
955
  db_drop_field($items,'guifi_zone', 'mrtg_servers');
956
  db_drop_field($items,'guifi_zone', 'image');
957
  db_drop_field($items,'guifi_zone', 'map_poly');
958
  db_drop_field($items,'guifi_zone', 'map_coord');
959
960
  // changes @ guifi_users
961
  db_add_field($items, 'guifi_users', 'status',
962
    array('type' => 'varchar', 'length' => 25, 'not null' => TRUE, 'default' => 'new', 'COMMENT' => 'pending/approved/rejected'));
963
  db_add_field($items, 'guifi_users', 'content_filters',
964
    array('type' => 'text', 'size' => 'big', 'not null' => FALSE, 'default' => NULL));
965
  $items[] = update_sql("UPDATE {guifi_users} SET status = 'Approved'");
966
967
  // changes @ guifi_devices
968
  db_add_field($items, 'guifi_devices', 'last_online',
969
    array('type' => 'int', 'disp-width' => 11, 'not null' => TRUE, 'default' => 0, 'COMMENT' => 'Last time that this device has been seen online'));
970
  db_add_field($items, 'guifi_devices', 'last_flag',
971
    array('type' => 'varchar', 'length' => '40', 'not null' => TRUE, 'default' => 'N/A', 'COMMENT' => 'N/A, Online, Offline...'));
972
  db_add_field($items, 'guifi_devices', 'ly_availability',
973
    array('type' => 'numeric', 'precision' => '10', 'scale' => '6', 'not null' => FALSE, 'default' => NULL));
974
975
  // changes @ guifi_radios
976
  db_add_field($items, 'guifi_radios', 'ly_bytes_in',
977
    array('type' => 'numeric', 'precision' => 25,  'scale' => 0, 'not null' => FALSE, 'default' => NULL));
978
  db_add_field($items, 'guifi_radios', 'ly_bytes_out',
979
    array('type' => 'numeric', 'precision' => 25, 'scale' => 0, 'not null' => FALSE, 'default' => NULL));
980
981
  db_drop_field($items,'guifi_devices', 'url_mrtg_server');
982
983
  return $items;
984
}
985
*/
986
987
function guifi_update_540() {
988
  $items = array();
989
990
  db_change_field($items, 'guifi_radios', 'ssid', 'ssid',
991
    array('type' => 'varchar', 'length' => '128', 'not null' => TRUE, 'default' => ''));
992
  return $items;
993
}
994
995
function guifi_update_556() {
996
997
  // Data cleaning for backward compatibility purposes.
998
  // All notifications will be validated
999
  // In the meantime, empty notifications will remain empty, just leaving the
1000
  // code commented for further reference
1001
1002
  $items = array();
1003
1004
  $tables = array('guifi_zone', 'guifi_location', 'guifi_devices', 'guifi_services', 'guifi_users');
1005
1006
  foreach ($tables as $table)  {
1007
    $qmails = db_query('SELECT * FROM {%s}', $table);
1008
    while ($amails = db_fetch_object($qmails)) {
1009
      // validate the email
1010
      if (!empty($amails->notification))
1011
        $dmails = guifi_notification_validate($amails->notification);
1012
1013
      // if mails empty or not valid, take from uid or user_created
1014
//      if (empty($dmails)) {
1015
//        if (!isset($amails->nid))
1016
//          $amails->nid = $amails->id;
1017
//        $n = node_load(array('nid' => $amails->nid));
1018
//        $u = user_load($n->uid);
1019
//        $dmails = $u->mail;
1020
//      } // if was no mail
1021
1022
      // there was changes? then save the change
1023
      if ($dmails != $amails->notification) {
1024
        $items[] = update_sql(sprintf(
1025
            'UPDATE {%s} SET notification = "%s" WHERE id = %d',
1026
            $table, $dmails, $amails->id)
1027
          );
1028
      }
1029
1030
    } // foreach row
1031
1032
  } // foreach table
1033
1034
  return $items;
1035
}
1036
1037
function guifi_update_652() {
1038
  db_add_field($items, 'guifi_devices', 'last_stats',
1039
    array('type' => 'int', 'disp-width' => 11, 'not null' => TRUE, 'default' => 0, 'comment' => 'Last time that this device has been loaded with statistics'));
1040
  db_add_field($items, 'guifi_devices', 'latency_avg',
1041
    array('type' => 'int', 'disp-width' => 11, 'not null' => TRUE, 'default' => 0, 'comment' => 'Average latency'));
1042
  db_add_field($items, 'guifi_devices', 'latency_max',
1043
    array('type' => 'int', 'disp-width' => 11, 'not null' => TRUE, 'default' => 0, 'comment' => 'Maximum latency'));
1044
  db_change_field($items, 'guifi_radios', 'ly_bytes_in', 'ly_mb_in',
1045
    array('type' => 'numeric', 'disp-width' => 25, 'not null' => FALSE, 'default' => NULL));
1046
  db_change_field($items, 'guifi_radios', 'ly_bytes_out', 'ly_mb_out',
1047
    array('type' => 'numeric', 'disp-width' => 25, 'not null' => FALSE, 'default' => NULL));
1048
}
1049
1050
function guifi_update_661() {
1051
  $items = array();
1052
1053
  db_drop_field($items, 'guifi_networks', 'valid');
1054
1055
  $items[] = update_sql("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('1', 'adhoc', 'OLSR', 'ad-hoc mesh - OLSR', 'kamikaze|freifunk-OLSR');");
1056
  $items[] = update_sql("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('2', 'adhoc', 'OLSR-NG', 'ad-hoc mesh - OLSR-NG', 'kamikaze');");
1057
  $items[] = update_sql("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('3', 'adhoc', 'BATMAN', 'ad-hoc mesh - BATMAN', 'kamikaze|freifunk-BATMAN');");
1058
  $items[] = update_sql("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('4', 'adhoc', 'RouterOS', 'ad-hoc mesh - RouterOS', 'RouterOSv3.x');");
1059
1060
  return $items;
1061
}
1062
1063
1064
function guifi_update_664() {
1065
  $items = array();
1066
1067
  db_add_field($items, 'guifi_ipv4', 'ipv4_type',
1068
    array('type' => 'int', 'disp-width' => 11, 'not null' => TRUE, 'default' => 0, 'comment' => 'Address type'));
1069
  db_add_field($items, 'guifi_ipv4', 'zone_id',
1070
    array('type' => 'int', 'disp-width' => 11, 'not null' => TRUE, 'default' => 0, 'comment' => 'Address type'));
1071
1072
  $items[] = update_sql("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('1', 'ipv4_types', '1', 'public', '');");
1073
  $items[] = update_sql("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('2', 'ipv4_types', '2', 'backbone', '');");
1074
  $items[] = update_sql("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('3', 'ipv4_types', '3', 'ad-hoc mesh - OLSR', 'kamikaze|freifunk-OLSR');");
1075
  $items[] = update_sql("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('4', 'ipv4_types', '4', 'ad-hoc mesh - BATMAN', 'kamikaze|freifunk-BATMAN');");
1076
  $items[] = update_sql("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('5', 'ipv4_types', '5', 'ad-hoc mesh - BMX', 'kamikaze');");
1077
  $items[] = update_sql("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('6', 'ipv4_types', '6', 'ad-hoc mesh - RouterOS', 'RouterOSv3.x');");
1078
1079
  $sql = db_query(
1080
    'SELECT a.*, l.zone_id ' .
1081
    'FROM {guifi_ipv4} a, {guifi_interfaces} i, {guifi_devices} d, {guifi_location} l ' .
1082
    'WHERE a.interface_id=i.id AND i.device_id=d.id AND d.nid=l.id');
1083
  $pmin = ip2long('10.0.0.0');
1084
  $pmax = ip2long('11.0.0.0');
1085
  while ($ipv4 = db_fetch_object($sql)) {
1086
    // Set network type
1087
    $daddr = ip2long($ipv4->ipv4);
1088
    if ($ipv4->ipv4_type == 0) {
1089
       (($daddr >= $pmin) and ($daddr < $pmax)) ? $type = 1 : $type = 2;
1090
    }
1091
1092
    update_sql(sprintf('UPDATE {guifi_ipv4} SET ipv4_type=%s, zone_id=%d WHERE id=%d AND interface_id=%d',
1093
      $type, $ipv4->zone_id, $ipv4->id, $ipv4->interface_id));
1094
1095
  }
1096
1097
  return $items;
1098
}
1099
1100
function guifi_update_667() {
1101
  $items = array();
1102
1103
  $items[] = update_sql("DELETE FROM {guifi_types} WHERE type='adhoc'");
1104
  $items[] = update_sql("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('3', 'adhoc', 'OLSR', 'ad-hoc mesh - OLSR', 'kamikaze|freifunk-OLSR');");
1105
  $items[] = update_sql("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('4', 'adhoc', 'BATMAN', 'ad-hoc mesh - BATMAN', 'kamikaze|freifunk-BATMAN');");
1106
  $items[] = update_sql("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('5', 'adhoc', 'BMX', 'ad-hoc mesh - BMX', 'kamikaze|freifunk-BATMAN|freifunk-BMX');");
1107
  $items[] = update_sql("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('6', 'adhoc', 'RouterOS', 'ad-hoc mesh - RouterOS', 'RouterOSv3.x');");
1108
1109
  return $items;
1110
}
1111
1112
function guifi_update_700() {
1113
  $items = array();
1114
1115
  $items[] = update_sql("INSERT INTO {guifi_manufacturer} (fid ,nom ,url) VALUES ('12', 'Gateworks', 'http://www.gateworks.com'),('13', 'Asus', 'http://www.asus.com');");
1116
  $items[] = update_sql("INSERT INTO {guifi_model} (mid ,fid ,model ,tipus ,radiodev_max ,potencia_max ,modes ,AP ,virtualAP ,WDS ,bridge ,client ,connector ,antenes ,router ,firewall ,QoS ,snmp ,hack ,interfaces ,url ,comentaris ,supported) VALUES 
1117
  ('34', '10', 'NanoStation Loco2', 'Extern', '1', '400', '802.11bg', 'No', 'No', 'No', 'No', 'Si', 'RP-SMA', '2', 'Si', 'Si', 'Si', 'Si', 'Si', 'Wan', 'http://www.ubnt.com/products/loco.php', 'Permet Firmwares de tercers', 'Yes'),
1118
  ('35', '10', 'NanoStation Loco5', 'Extern', '1', '400', '802.11a', 'No', 'No', 'No', 'No', 'Si', 'RP-SMA', '2', 'Si', 'Si', 'Si', 'Si', 'Si', 'Wan', 'http://www.ubnt.com/products/loco.php', 'Permet Firmwares de tercers', 'Yes'),
1119
  ('36', '10', 'Bullet2', 'Extern', '1', '400', '802.11bg', 'No', 'No', 'No', 'No', 'Si', 'RP-SMA', '2', 'Si', 'Si', 'Si', 'Si', 'Si', 'Wan', 'http://www.ubnt.com/products/loco.php', 'Permet Firmwares de tercers', 'Yes'),
1120
  ('37', '10', 'Bullet5', 'Extern', '1', '400', '802.11a', 'No', 'No', 'No', 'No', 'Si', 'RP-SMA', '2', 'Si', 'Si', 'Si', 'Si', 'Si', 'Wan', 'http://www.ubnt.com/products/loco.php', 'Permet Firmwares de tercers', 'Yes'),
1121
  ('38', '10', 'RouterStation', 'Extern', '4', '400', '802.11abg', 'No', 'No', 'No', 'No', 'Si', 'RP-SMA', '2', 'Si', 'Si', 'Si', 'Si', 'Si', 'Wan', 'http://ubnt.com/products/ls5.php', 'Permet Firmwares de tercers', 'Yes'),
1122
  ('39', '12', 'Avila GW2348-4', 'Extern', '4', '400', '802.11abg', 'No', 'No', 'No', 'No', 'Si', 'RP-SMA', '2', 'Si', 'Si', 'Si', 'Si', 'Si', 'Wan', 'http://www.gateworks.com/products/avila/gw2348-4.php', 'Permet Firmwares de tercers', 'Yes'),
1123
  ('40', '13', 'Asus WL-500xx', 'Extern', '1', '400', '802.11bg', 'No', 'No', 'No', 'No', 'Si', 'RP-SMA', '2', 'Si', 'Si', 'Si', 'Si', 'Si', 'Wan', 'http://asus.com/products.aspx?l1=29&l2=172&l3=743&l4=60&model=1277&modelmenu=1', 'Permet Firmwares de tercers', 'Yes');");
1124
1125
  $items[] = update_sql("UPDATE {guifi_types} SET relations = 'WRT54Gv1-4|WRT54GL|WRT54GSv1-2|WRT54GSv4|Meraki/Fonera|Wrap|Routerboard 532|Routerboard 133C|Routerboard 133|Routerboard 112|Routerboard 153|Supertrasto guifiBUS guifi.net|NanoStation2|NanoStation5|NanoStation Loco2|NanoStation Loco5|Bullet2|Bullet5|RouterStation|Avila GW2348-4|Asus WL-500xx' WHERE id = 8 AND type = 'firmware'");
1126
  $items[] = update_sql("UPDATE {guifi_types} SET relations = 'WRT54Gv1-4|WRT54GL|WRT54GSv1-2|WRT54GSv4|Asus WL-500xx|WHR-HP-G54, WHR-G54S|NanoStation2|NanoStation5|NanoStation Loco2|NanoStation Loco5|Bullet2|Bullet5|RouterStation|Avila GW2348-4' WHERE id = 4 AND type = 'firmware'");
1127
  $items[] = update_sql("UPDATE {guifi_types} SET relations = 'NanoStation2|NanoStation5|NanoStation Loco2|NanoStation Loco5|Bullet2|Bullet5' WHERE id = 11 AND type = 'firmware'");
1128
  $items[] = update_sql("UPDATE {guifi_types} SET relations = 'NanoStation2|NanoStation5|NanoStation Loco2|NanoStation Loco5|Bullet2|Bullet5' WHERE id = 13 AND type = 'firmware'");
1129
1130
  return $items;
1131
}
1132
1133
function guifi_update_736() {
1134
  $items = array();
1135
1136
  $items[] = update_sql("INSERT INTO {guifi_manufacturer} (fid ,nom ,url) VALUES ('14', 'Pcengines', 'http://www.pcengines.ch');");
1137
  $items[] = update_sql("INSERT INTO {guifi_model} (mid ,fid ,model ,tipus ,radiodev_max ,potencia_max ,modes ,AP ,virtualAP ,WDS ,bridge ,client ,connector ,antenes ,router ,firewall ,QoS ,snmp ,hack ,interfaces ,url ,comentaris ,supported) VALUES 
1138
  (41, 14, 'Alix1', 'Extern', 5, 400, '802.11bg', 'No', 'No', 'No', 'No', 'Si', 'RP-SMA', '2', 'Si', 'Si', 'Si', 'Si', 'Si', 'wLan/Lan', 'http://www.pcengines.ch/alix1d.htm', 'Permet Firmwares de tercers', 'Yes'),
1139
  (42, 14, 'Alix2', 'Extern', 2, 400, '802.11bg', 'No', 'No', 'No', 'No', 'Si', 'RP-SMA', '2', 'Si', 'Si', 'Si', 'Si', 'Si', 'wLan/Lan|ether2', 'http://www.pcengines.ch/alix2d.htm', 'Permet Firmwares de tercers', 'Yes'),
1140
  (43, 14, 'Alix3', 'Extern', 2, 400, '802.11bg', 'No', 'No', 'No', 'No', 'Si', 'RP-SMA', '2', 'Si', 'Si', 'Si', 'Si', 'Si', 'wLan/Lan', 'http://www.pcengines.ch/alix3d.htm', 'Permet Firmwares de tercers', 'Yes'),
1141
  (44, 8, 'Routerboard 800', NULL, 8, 400, '802.11abg', 'Si', 'Yes', 'Si', 'Si', 'Si', 'N-Female', '2', 'Si', 'Si', 'Si', 'Si', 'No', 'wLan/Lan|ether2|ether3|ether4|ether5|ether6|ether7|ether8|ether9', 'http://www.routerboard.com', NULL,'Yes');");
1142
1143
  $items[] = update_sql("UPDATE {guifi_types} SET relations = 'WRT54Gv1-4|WRT54GL|WRT54GSv1-2|WRT54GSv4|Meraki/Fonera|Wrap|Routerboard 532|Routerboard 133C|Routerboard 133|Routerboard 112|Routerboard 153|Supertrasto guifiBUS guifi.net|NanoStation2|NanoStation5|NanoStation Loco2|NanoStation Loco5|Bullet2|Bullet5|RouterStation|Avila GW2348-4|Asus WL-500xx|Alix1|Alix2|Alix3' WHERE id = 8 AND type = 'firmware'");
1144
  $items[] = update_sql("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('14', 'firmware', 'RouterOSv4.x', 'RouterOS 4.x from Mikrotik', 'Routerboard 532|Routerboard 133C|Routerboard 133|Routerboard 112|Routerboard 153|Supertrasto guifiBUS guifi.net|Routerboard 600|Routerboard 411|Routerboard 333|Routerboard 433|Routerboard 800');");
1145
1146
  return $items;
1147
}
1148
1149
function guifi_update_743() {
1150
  $items = array();
1151
  
1152
  $items[] = update_sql("CREATE TABLE IF NOT EXISTS `guifi_api_tokens` (
1153
	  `uid` int(8) unsigned NOT NULL,
1154
	  `token` varchar(255) NOT NULL,
1155
	  `created` timestamp NULL DEFAULT NULL,
1156
	  `rand_key` int(6) NOT NULL,
1157
	  PRIMARY KEY (`uid`)
1158
	) ENGINE=MyISAM");
1159
  return $items;
1160
}
1161
1162
function guifi_update_768() {
1163
  $items = array();
1164
 
1165
  $items[] = update_sql("INSERT INTO {guifi_model} (mid ,fid ,model ,tipus ,radiodev_max ,potencia_max ,modes ,AP ,virtualAP ,WDS ,bridge ,client ,connector ,antenes ,router ,firewall ,QoS ,snmp ,hack ,interfaces ,url ,comentaris ,supported) VALUES
1166
   (45, 10, 'AirMaxM2 Rocket/Nano/Loco', 'Extern', 1, 100, '802.11bg', 'Yes', 'No', 'Si', 'Si','Si', NULL, '1', 'Si', 'Si', NULL, 'Si', 'Si', 'eth0|ath0', 'http://ubnt.com/airmax', 'Permet Firmwares de tercers','Yes'),
1167
   (46, 10, 'AirMaxM5 Rocket/Nano/Loco', 'Extern', 1, 100, '802.11a', 'Yes', 'No', 'si', 'Si', 'Si', NULL, '1', 'Si', 'Si', NULL, 'Si', 'Si', 'eth0|ath0', 'http://ubnt.com/airmax', 'Permet Firmwares de tercers','Yes'),
1168
   (47, 10, 'AirMaxM2 Bullet/PwBrg/AirGrd/NanoBr', 'Extern', 1, 100, '802.11bg', 'Yes', 'No', 'Si', 'Si','Si', NULL, '1', 'Si', 'Si', NULL, 'Si', 'Si', 'eth0|ath0', 'http://ubnt.com/airmax', 'Permet Firmwares de tercers','Yes'),
1169
   (48, 10, 'AirMaxM5 Bullet/PwBrg/AirGrd/NanoBr', 'Extern', 1, 100, '802.11a', 'Yes', 'No', 'si', 'Si', 'Si', NULL, '1', 'Si', 'Si', NULL, 'Si', 'Si', 'eth0|ath0', 'http://ubnt.com/airmax', 'Permet Firmwares de tercers','Yes');");
1170
1171
   $items[] = update_sql("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('15', 'firmware', 'AirOsv52', 'Ubiquti AirOs 5.2','AirMaxM2 Rocket/Nano/Loco|AirMaxM5 Rocket/Nano/Loco|AirMaxM2 Bullet/PwBrg/AirGrd/NanoBr|AirMaxM5 Bullet/PwBrg/AirGrd/NanoBr');");
1172
   $items[] = update_sql("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('16', 'firmware', 'RouterOSv4.7+', 'RouterOS 4.7 or newer from Mikrotik', 'Routerboard 532|Routerboard 133C|Routerboard 133|Routerboard 112|Routerboard 153|Supertrasto guifiBUS guifi.net|Routerboard 600|Routerboard 411|Routerboard 333|Routerboard 433|Routerboard 800');");
1173
   $items[] = update_sql("UPDATE {guifi_types} SET text = 'RouterOSv4.0+' , description = 'RouterOS 4.0 to 4.6 from Mikrotik' WHERE id = '14' AND type = 'firmware'");
1174
  return $items;
1175
}
1176
1177
function guifi_update_808() {
1178
  $items = array();
1179
  $items[] = update_sql("INSERT INTO {guifi_types} (id, type, text, description) VALUES ('26', 'service', 'LDAP', 'LDAP Server');");
1180
  return $items;
1181
}
1182
1183
function guifi_update_849() {
1184
  $items = array();
1185
  $items[] = update_sql("ALTER TABLE {guifi_dns_domains} ADD public VARCHAR( 5 ) NOT NULL DEFAULT 'yes' AFTER type;");
1186
  return $items;
1187
}
1188
1189
function guifi_update_851() {
1190
  $items = array();
1191
  $items[] = update_sql("INSERT INTO {guifi_manufacturer} VALUES (15, 'Setup Informatica', 'http://www.setup.cat');");
1192
  $items[] = update_sql("INSERT INTO {guifi_model} (mid ,fid ,model ,tipus ,radiodev_max ,potencia_max ,modes ,AP ,virtualAP ,WDS ,bridge ,client ,connector ,antenes ,router ,firewall ,QoS ,snmp ,hack ,interfaces ,url ,comentaris ,supported) VALUES
1193
  (49, 15, 'GuifiStation2', 'Extern', 1, 100, '802.11bg', 'Yes', 'No', 'si', 'Si', 'Si', NULL, '1', 'Si', 'Si', NULL, 'Si', 'Si', 'eth0|ath0', 'http://tienda.setupinformatica.com/wac/detalle.php?codigo=CPEGS2', 'Permet Firmwares de tercers', 'Yes'),
1194
  (50, 15, 'GuifiStation5', 'Extern', 1, 100, '802.11a', 'Yes', 'No', 'si', 'Si', 'Si', NULL, '1', 'Si', 'Si', NULL, 'Si', 'Si', 'eth0|ath0', 'http://tienda.setupinformatica.com/wac/detalle.php?codigo=CPEGS5', 'Permet Firmwares de tercers', 'Yes');");
1195
  $items[] = update_sql("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('17', 'firmware', 'GSOS', 'GuifiStationOS from Setup Informatica', 'GuifiStation2|GuifiStation5');");
1196
  return $items;
1197
}
1198
1199
function guifi_update_852() {
1200
   $items = array();
1201
   $items[] = update_sql("UPDATE {guifi_types} SET text = 'GuifiStationOS1.0' , description = 'GuifiStationOS v1.0 from Setup Informatica' WHERE id = '17' AND type = 'firmware'");
1202
  return $items;
1203
}
1204
1205
function guifi_update_873() {
1206
   $items = array();
1207
   $items[] = update_sql("ALTER TABLE {guifi_dns_domains} ADD externalmx VARCHAR( 128 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL AFTER allow"); 
1208
  return $items;
1209
}
1210
1211
function guifi_update_874() {
1212
   $items = array();
1213
   $items[] = update_sql("UPDATE {guifi_model} SET model = 'Routerboard 532' WHERE mid =19");
1214
   $items[] = update_sql("UPDATE {guifi_model} SET model = 'Routerboard 133C' WHERE mid =20");
1215
   $items[] = update_sql("UPDATE {guifi_model} SET model = 'Routerboard 133' WHERE mid =21");
1216
   $items[] = update_sql("UPDATE {guifi_model} SET model = 'Routerboard 112' WHERE mid =22");
1217
   $items[] = update_sql("UPDATE {guifi_model} SET model = 'Routerboard 153' WHERE mid =23");
1218
   $items[] = update_sql("UPDATE {guifi_model} SET model = 'Routerboard 600' WHERE mid =27");
1219
   $items[] = update_sql("UPDATE {guifi_model} SET model = 'Routerboard 333' WHERE mid =28");
1220
   $items[] = update_sql("UPDATE {guifi_model} SET model = 'Routerboard 411' WHERE mid =29");
1221
   $items[] = update_sql("UPDATE {guifi_model} SET model = 'Routerboard 433' WHERE mid =31");
1222
   $items[] = update_sql("UPDATE {guifi_model} SET model = 'Routerboard 800' WHERE mid =44");
1223
   $items[] = update_sql("UPDATE {guifi_types} SET `relations` = 'Routerboard 532|Routerboard 133C|Routerboard 133|Routerboard 112|Routerboard 153|Supertrasto guifiBUS guifi.net' WHERE id = 6 AND type = 'firmware'");
1224
   $items[] = update_sql("UPDATE {guifi_types} SET `relations` = 'WRT54Gv1-4|WRT54GL|WRT54GSv1-2|WRT54GSv4|Wrap|Routerboard 532|Routerboard 133C|Routerboard 133|Routerboard 112|Routerboard 153' WHERE id = 7 AND type = 'firmware'");
1225
   $items[] = update_sql("UPDATE {guifi_types} SET `relations` = 'WRT54Gv1-4|WRT54GL|WRT54GSv1-2|WRT54GSv4|Meraki/Fonera|Wrap|Routerboard 532|Routerboard 133|Routerboard 133|Routerboard 112|Routerboard 153|Supertrasto guifiBUS guifi.net|NanoStation2|NanoStation5|NanoStation Loco2|NanoStation Loco5|Bullet2|Bullet5|RouterStation|Avila GW2348-4|Asus WL-500xx|Alix1|Alix2|Alix3' WHERE id = 8 AND type = 'firmware'");
1226
   $items[] = update_sql("UPDATE {guifi_types} SET `relations` = 'Routerboard 532|Routerboard 133C|Routerboard 133|Routerboard 112|Routerboard 153|Supertrasto guifiBUS guifi.net|Routerboard 600|Routerboard 411|Routerboard 333|Routerboard 433' WHERE id = 10 AND type = 'firmware'");
1227
   $items[] = update_sql("UPDATE {guifi_types} SET `relations` = 'Routerboard 532|Routerboard 133C|Routerboard 133|Routerboard 112|Routerboard 153|Supertrasto guifiBUS guifi.net|Routerboard 600|Routerboard 411|Routerboard 333|Routerboard 433|Routerboard 800' WHERE id = 14 AND type = 'firmware'");
1228
   $items[] = update_sql("UPDATE {guifi_types} SET `relations` = 'Routerboard 532|Routerboard 133C|Routerboard 133|Routerboard 112|Routerboard 153|Supertrasto guifiBUS guifi.net|Routerboard 600|Routerboard 411|Routerboard 333|Routerboard 433|Routerboard 800' WHERE id = 16 AND type = 'firmware'");
1229
  return $items;
1230
}
1231
1232
function guifi_update_891() {
1233
   $items = array();
1234
   $items[] = update_sql("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('18', 'firmware', 'gsffirm', 'Firmware de GràciaSenseFils MANET', 'Alix2|Alix3|WRT54Gv1-4|WRT54GL|WRT54GSv1-2|WRT54GSv4|Asus WL-500xx|WHR-HP-G54, WHR-G54S|NanoStation2|NanoStation5|NanoStation Loco2|NanoStation Loco5|Bullet2|Bullet5|RouterStation|RouterStationPro|Meraki/Fonera');");
1235
   $items[] = update_sql("INSERT INTO {guifi_model} (mid ,fid ,model ,tipus ,radiodev_max ,potencia_max ,modes ,AP ,virtualAP ,WDS ,bridge ,client ,connector ,antenes ,router ,firewall ,QoS ,snmp ,hack ,interfaces ,url ,comentaris ,supported) VALUES 
1236
                                        (51, 10, 'RouterStationPro', 'Extern', 4, 400, '802.11abg', 'No', 'No', 'No', 'No', 'Si', 'RP-SMA', '2', 'Si', 'Si', 'Si', 'Si', 'Si', 'Wan', 'http://ubnt.com/rspro', 'Permet Firmwares de tercers', 'Yes');"); 
1237
   $items[] = update_sql("UPDATE {guifi_types} SET relations = 'WRT54Gv1-4|WRT54GL|WRT54GSv1-2|WRT54GSv4|Asus WL-500xx|WHR-HP-G54, WHR-G54S|NanoStation2|NanoStation5|NanoStation Loco2|NanoStation Loco5|Bullet2|Bullet5|RouterStation|RouterStationPro|Avila GW2348-4' WHERE id = 4 AND type = 'firmware'");
1238
   $items[] = update_sql("UPDATE {guifi_types} SET relations = 'WRT54Gv1-4|WRT54GL|WRT54GSv1-2|WRT54GSv4|Meraki/Fonera|Wrap|Routerboard 532|Routerboard 133C|Routerboard 133|Routerboard 112|Routerboard 153|Supertrasto guifiBUS guifi.net|NanoStation2|NanoStation5|NanoStation Loco2|NanoStation Loco5|Bullet2|Bullet5|RouterStation|RouterStationPro|Avila GW2348-4|Asus WL-500xx|Alix1|Alix2|Alix3' WHERE id = 8 AND type = 'firmware'"); 
1239
  return $items;
1240
}
1241
1242
function guifi_update_893() {
1243
  $items = array();
1244
  $items[] = update_sql("ALTER TABLE {guifi_dns_domains} ADD defipv6 VARCHAR( 128 ) NOT NULL AFTER defipv4;");
1245
  $items[] = update_sql("ALTER TABLE {guifi_dns_hosts} ADD ipv6 VARCHAR( 128 ) NOT NULL AFTER ipv4;");
1246
  return $items;
1247
}
1248
1249
function guifi_update_894() {
1250
  $items = array();
1251
  $items[] = update_sql("UPDATE {guifi_types} SET text = 'DD-WRTv23' , description = 'DD-WRTv23Beta2 from BrainSlayer' WHERE id = '4' AND type = 'firmware'");
1252
  return $items;
1253
}
1254
1255
function guifi_update_895() {
1256
  $items = array();
1257
  $items[] = update_sql("UPDATE {guifi_devices} SET extra = REPLACE(extra,'s:6:\"DD-WRT\"', 's:9:\"DD-WRTv23\"')");
1258
  return $items;
1259
}
1260
1261
function guifi_update_896() {
1262
  $items = array();
1263
  $items[] = update_sql("ALTER TABLE {guifi_devices} ADD logserver VARCHAR( 60 ) NOT NULL AFTER graph_server;");
1264
  $items[] = update_sql("INSERT INTO {guifi_types} (id, type, text, description) VALUES ('27', 'service', 'LogServer', 'Ip logs server');");
1265
  return $items;
1266
}
1267
1268
function guifi_update_900() {
1269
 $items = array();
1270
 $items[] = update_sql("ALTER TABLE {guifi_model} ADD etherdev_max tinyint(2) NOT NULL DEFAULT 1 AFTER radiodev_max");
1271
 $items[] = update_sql("ALTER TABLE {guifi_interfaces} ADD etherdev_counter tinyint(2) AFTER radiodev_counter");
1272
 $items[] = update_sql("ALTER TABLE {guifi_radios} ADD etherdev_counter tinyint(2) AFTER radiodev_counter");
1273
 $items[] = update_sql("INSERT INTO {guifi_model} (mid ,fid ,model ,tipus ,radiodev_max , etherdev_max, potencia_max ,modes ,AP ,virtualAP ,WDS ,bridge ,client ,connector ,antenes ,router ,firewall ,QoS ,snmp ,hack ,interfaces ,url ,comentaris ,supported) VALUES 
1274
                                      (52, 8, 'Routerboard 750/750G', 'Extern', '0', '5', '400', '802.11abg', 'Yes', 'Yes', 'Yes', 'Yes', 'Yes', 'None', '0', 'Yes','Yes', 'Yes', 'Yes', 'Yes', 'ether1|ether2|ether3|ether4|ether5', 'http://www.routerboard.com/pricelist.php?showProduct=90', 'Permet Firmwares de tercers', 'Yes');");
1275
 $items[] = update_sql("UPDATE {guifi_types} SET `relations` = 'Routerboard 532|Routerboard 133C|Routerboard 133|Routerboard 112|Routerboard 153|Supertrasto guifiBUS guifi.net|Routerboard 600|Routerboard 411|Routerboard 333|Routerboard 433|Routerboard 800|Routerboard 750/750G' WHERE id = 16 AND type = 'firmware'");
1276
 $items[] = update_sql("INSERT INTO {guifi_types} (id, type, text, description, relations) VALUES ('19', 'firmware', 'RouterOSv5.x', 'RouterOS 5.x or newer from Mikrotik', 'Routerboard 532|Routerboard 133C|Routerboard 133|Routerboard 112|Routerboard 153|Supertrasto guifiBUS guifi.net|Routerboard 600|Routerboard 411|Routerboard 333|Routerboard 433|Routerboard 800|Routerboard 750/750G');");
1277
  return $items;
1278
}
1279
1280
function guifi_update_901() {
1281
   $items = array();
1282
   $items[] = update_sql("ALTER TABLE {guifi_dns_domains} ADD externalns VARCHAR( 128 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL AFTER externalmx"); 
1283
  return $items;
1284
}
1285
1286
function guifi_update_902() {
1287
   $items = array();
1288
   $items[] = update_sql("ALTER TABLE {guifi_model} ADD notification varchar(1024) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL AFTER supported");
1289
   $items[] = update_sql("ALTER TABLE {guifi_model} ADD user_created mediumint(9) NOT NULL AFTER notification");
1290
   $items[] = update_sql("ALTER TABLE {guifi_model} ADD user_changed mediumint(9) NOT NULL AFTER user_created");
1291
   $items[] = update_sql("ALTER TABLE {guifi_model} ADD timestamp_created int(11) NOT NULL AFTER user_changed");
1292
   $items[] = update_sql("ALTER TABLE {guifi_model} ADD timestamp_changed int(11) NOT NULL AFTER timestamp_created");
1293
   $items[] = update_sql("ALTER TABLE {guifi_manufacturer} ADD notification varchar(1024) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL AFTER url");
1294
   $items[] = update_sql("ALTER TABLE {guifi_manufacturer} ADD user_created mediumint(9) NOT NULL AFTER notification");
1295
   $items[] = update_sql("ALTER TABLE {guifi_manufacturer} ADD user_changed mediumint(9) NOT NULL AFTER user_created");
1296
   $items[] = update_sql("ALTER TABLE {guifi_manufacturer} ADD timestamp_created int(11) NOT NULL AFTER user_changed");
1297
   $items[] = update_sql("ALTER TABLE {guifi_manufacturer} ADD timestamp_changed int(11) NOT NULL AFTER timestamp_created");
1298
   $items[] = update_sql("ALTER TABLE {guifi_model}
1299
  DROP potencia_max,
1300
  DROP modes,
1301
  DROP WDS,
1302
  DROP bridge,
1303
  DROP connector,
1304
  DROP antenes,
1305
  DROP router,
1306
  DROP firewall,
1307
  DROP QoS,
1308
  DROP snmp,
1309
  DROP hack");
1310
1311
   $items[] = update_sql("DELETE FROM {guifi_manufacturer} WHERE fid = 1");
1312
   $items[] = update_sql("DELETE FROM {guifi_manufacturer} WHERE fid = 3");
1313
   $items[] = update_sql("DELETE FROM {guifi_manufacturer} WHERE fid = 4");
1314
   $items[] = update_sql("DELETE FROM {guifi_manufacturer} WHERE fid = 5");
1315
   $items[] = update_sql("DELETE FROM {guifi_manufacturer} WHERE fid = 6");
1316
   $items[] = update_sql("DELETE FROM {guifi_manufacturer} WHERE fid = 7");
1317
   $items[] = update_sql("DELETE FROM {guifi_model WHERE mid = 2");
1318
   $items[] = update_sql("DELETE FROM {guifi_model WHERE mid = 3");
1319
   $items[] = update_sql("DELETE FROM {guifi_model WHERE mid = 4");
1320
   $items[] = update_sql("DELETE FROM {guifi_model WHERE mid = 5");
1321
   $items[] = update_sql("DELETE FROM {guifi_model WHERE mid = 6");
1322
   $items[] = update_sql("DELETE FROM {guifi_model WHERE mid = 7");
1323
   $items[] = update_sql("DELETE FROM {guifi_model WHERE mid = 8");
1324
   $items[] = update_sql("DELETE FROM {guifi_model WHERE mid = 10");
1325
   $items[] = update_sql("DELETE FROM {guifi_model WHERE mid = 11");
1326
   $items[] = update_sql("DELETE FROM {guifi_model WHERE mid = 12");
1327
   $items[] = update_sql("DELETE FROM {guifi_model WHERE mid = 13");
1328
   $items[] = update_sql("DELETE FROM {guifi_model WHERE mid = 14");
1329
1330
   $items[] = update_sql("ALTER TABLE {guifi_manufacturer} CHANGE nom name VARCHAR( 40 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT ''");
1331
   $items[] = update_sql("ALTER TABLE {guifi_model} CHANGE tipus type VARCHAR( 10 ) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT 'Extern, PCI, PCMCIA'");
1332
   $items[] = update_sql("ALTER TABLE {guifi_model} CHANGE comentaris comments VARCHAR( 240 ) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL"); 
1333
1334
   $items[] = update_sql("UPDATE {guifi_model} SET mid = '3', fid = '1' WHERE mid =99;");
1335
   $items[] = update_sql("UPDATE {guifi_manufacturer} SET fid = '99' WHERE fid =1;");
1336
   $items[] = update_sql("UPDATE {guifi_devices} SET extra = REPLACE( extra,'8:\"model_id\";s:1:\"2\"', '8:\"model_id\";s:1:\"3\"')");
1337
   $items[] = update_sql("UPDATE {guifi_devices} SET extra = REPLACE( extra,'8:\"model_id\";s:1:\"4\"', '8:\"model_id\";s:1:\"3\"')");
1338
   $items[] = update_sql("UPDATE {guifi_devices} SET extra = REPLACE( extra,'8:\"model_id\";s:1:\"5\"', '8:\"model_id\";s:1:\"3\"')");
1339
   $items[] = update_sql("UPDATE {guifi_devices} SET extra = REPLACE( extra,'8:\"model_id\";s:1:\"6\"', '8:\"model_id\";s:1:\"3\"')");
1340
   $items[] = update_sql("UPDATE {guifi_devices} SET extra = REPLACE( extra,'8:\"model_id\";s:1:\"8\"', '8:\"model_id\";s:1:\"3\"')");
1341
   $items[] = update_sql("UPDATE {guifi_devices} SET extra = REPLACE( extra,'8:\"model_id\";s:2:\"10\"', '8:\"model_id\";s:1:\"3\"')");
1342
   $items[] = update_sql("UPDATE {guifi_devices} SET extra = REPLACE( extra,'8:\"model_id\";s:2:\"13\"', '8:\"model_id\";s:1:\"3\"')");
1343
   $items[] = update_sql("UPDATE {guifi_devices} SET extra = REPLACE( extra,'8:\"model_id\";s:2:\"14\"', '8:\"model_id\";s:1:\"3\"')");
1344
   $items[] = update_sql("UPDATE {guifi_devices} SET extra = REPLACE( extra,'8:\"model_id\";s:2:\"99\"', '8:\"model_id\";s:1:\"3\"')");
1345
  return $items;
1346
}
1347
1348
?>