Filter:   InfoImg
download tables.php
Language: PHP
LOC: 338
Project Info
Virtual Photo Album(vphotoalb)
Server: SourceForge
Type: cvs
...alb\vphotoalb\html\include\
   .htaccess
   antispam.php
   constants.php
   db.php
   db_my.php
   db_pg.php
   db_schema.php
   faq_strings.php
   form.php
   functions.php
   globals.php
   html.php
   html_verifier.php
   ImageProcessing.php
   input.php
   mime.php
   originals.php
   PictureFinder.php
   queries.php
   read_exif_data.php
   read_tiff_data.php
   SearchParameters.php
   security.php
   strings.en.php
   strings.fr.php
   strings.php
   tables.php

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
<?php
/* Definition of database tables.
 *
 * Written by: Chris Studholme
 * Copyright:  GPL (http://www.fsf.org/copyleft/gpl.html)
 * $Id: tables.php,v 1.17 2003/12/23 06:07:15 cstudhol Exp $
 */


require("include/db_schema.php");


/* Notes regarding field descriptions:
 *   (multilingual) - value is a serialized associative php array 
 *                    with language as key and strings for values
 *   (php-array)    - serialized general php array
 *   (CSV)          - comma serparated value list
 *   obsolete       - no longer used but can't be deleted because 
 *                    it was "not null" in the past
 */

$db_tables = array();

// master configuration data
$db_tables[] =
  new db_table("config", array("key"), array(),
	       array(new db_field("key","varchar(32) not null"), // key (reserved word => must change)
		     new db_field("type","varchar(32)"),         // type of value
		     new db_field("value","text"),               // value
		     new db_field("description","text"),         // description of value
		     new db_field("date_update","timestamp"),     // date of last update
		     )
	       );

// query cache
$db_tables[] =
  new db_table("cache", array("hash"), array(),
	       array(new db_field("hash","varchar(32) not null"), // hash of select query
		     new db_field("data","text"),                // query results (php array)
		     new db_field("date_create","timestamp"),     // date entry created
		     )
	       );

// image types
$db_tables[] =
  new db_table("types",array("typeid"), array(),
	       array(new db_field("typeid","int not null"),      // id (min 1, max 30, -1 thumbnail)
		     new db_field("name","text"),	         // name of type (multilingual)
		     //new db_field("name_plural","text"),	 // plural name (multilingual)
		     new db_field("preference","int"),           // preferred order
		     new db_field("filename_prefix","text"),     // filename prefix
		     new db_field("filename_suffix","text"),     // filename suffix
		     new db_field("options_type","text"),        // image options (php array)
		     new db_field("mimetype_src","text"),	 // mimetype of source (CSV)
		     new db_field("mimetype_dest","text"),	 // mimetype of destination
		     new db_field("date_update","timestamp"),     // date of last update
		     )
	       );

// image sources (camera types)
$db_tables[] =
  new db_table("sources",array("srcid"), array(),
	       array(new db_field("srcid","int not null"),       // id
		     new db_field("description","text"),	 // description of source
		     new db_field("detect","text"),	         // detection parameters (php array)
		     new db_field("options_src","text"),         // image options (php array)
		     new db_field("date_update","timestamp"),     // date of last update
		     )
	       );

// list of keywords defined by administrator
$db_tables[] =
  new db_table("keywords", array("wordid"), array(),
	       array(new db_field("wordid","int not null"),      // id
		     new db_field("lang","varchar(8)"),          // language (obsolete)
		     new db_field("word","text not null"),       // the keyword (multilingual)
		     new db_field("nosearch","smallint"),        // 1=can't search
		     new db_field("nopref","smallint"),          // 1=can't use in preferences
		     )
	       );
	
// list of groups to which persons might belong
$db_tables[] =
  new db_table("groups", array("groupid"), array(),
	       array(new db_field("groupid","int not null"),     // id
		     new db_field("name_group","text"),          // group name
		     new db_field("nosearch","smallint"),        // 1=can't search
		     )
	       );
	
// list of persons who might appear in pictures
$db_tables[] =
  new db_table("persons", array("personid"), array(),
	       array(new db_field("personid","int not null"),    // id
		     new db_field("name_last","text"),           // last name
		     new db_field("name_first","text"),          // first (and other) names
		     new db_field("comment","text"),             // private comment
		     new db_field("nosearch","smallint"),        // 1=can't search
		     )
	       );
	
// groups to which each person belongs
$db_tables[] =
  new db_table("person_groups", array("personid","groupid"), array("groupid"),
	       array(new db_field("personid","int not null"),    // person id
		     new db_field("groupid","int not null"),     // group id
		     )
	       );
	
// login name/password list
$db_tables[] =
  new db_table("users", array("userid"), array("login"),
	       array(new db_field("userid","int not null"),   // id
		     new db_field("login","varchar(32)"),     // login name
		     new db_field("password","text"),         // password (md5 encrypted)
		     new db_field("wordids_require","text"),  // required keywords (CSV)
		     new db_field("wordids_deny","text"),     // deny access to these pictures (CSV)
		     new db_field("wordids_search_default","text"), // default for new cookies (CSV)
		     new db_field("wordids_deny_default","text"), // default for new cookies (CSV)
		     new db_field("date_create","timestamp"),  // date of creation
		     new db_field("date_update","timestamp"),  // date of last update
		     new db_field("date_login","timestamp"),   // date of last login
		     new db_field("admin","smallint"),        // 1=administrator
		     )
	       );
	
// list of cookies given out
$db_tables[] =
  new db_table("cookies", array("cookie"), array("cid"),
	       array(new db_field("cid","int not null"),      // cookie id
		     new db_field("cookie","varchar(32) not null"), // cookie
		     new db_field("newcookie","varchar(32)"), // cookie to change to
		     new db_field("userid","int"),            // user last logged in as
		     new db_field("addr","varchar(64)"),      // address of last login
		     new db_field("date_create","timestamp"),  // date of creation
		     new db_field("date_update","timestamp"),  // date of last change
		     new db_field("date_login","timestamp"),   // date of last login
		     //new db_field("type","text"),             // preferred start page
		     new db_field("typeid","int"),            // preferred image type
		     new db_field("lang","varchar(8)"),       // preferred language
		     new db_field("name_caption","text"),     // name for captions
		     new db_field("name_toc","text"),         // name for public toc entries
		     new db_field("wordids_search","text"),   // searched keywords (CSV list)
		     new db_field("wordids_deny","text"),     // prevent showing of these pictures
		     new db_field("admin","smallint"),        // 1=administrator
		     )
	       );
	
// list of pictures in photo album
$db_tables[] =
  new db_table("pictures", array("picid"), array("type","path_thumb"),
	       array(new db_field("picid","int not null"),       // id
		     new db_field("type","int not null"),        // bitmap of types available
		     new db_field("srcid","int"),                // source of image
		     new db_field("options_pic","text"),         // image options (php array)
		     new db_field("path_thumb","text not null"), // path to thumbnail picture
		     new db_field("path_photos","text"),         // path to photos (php array)
		     new db_field("path_original","text"),       // path to original picture
		     new db_field("mimetype_original","text"),   // mimetype of original
		     new db_field("date","timestamp"),            // date picture was taken
		     new db_field("date_type","smallint"),       // 0=date/time 1=date 2=guess
		     new db_field("date_update","timestamp"),     // date of last record update
		     new db_field("date_update_image","timestamp"), // date of last image update
		     new db_field("date_view","timestamp"),       // date of last viewing
		     new db_field("addr_view","varchar(64)"),    // address of last viewing
		     new db_field("count_view","int"),           // total number of viewings
		     )
	       );
	
// captions for each picture
$db_tables[] =
  new db_table("picture_captions", array("picid","cid"), array("cid"),
	       array(new db_field("picid","int not null"),   // id
		     new db_field("cid","int not null"),     // cookie who posted
		     new db_field("addr","varchar(64)"),     // address of who updated
		     new db_field("userid","int"),           // user who updated
		     new db_field("name","text"),            // name of poster (optional)
		     new db_field("caption","text"),         // the caption (multilingual)
		     new db_field("lang","varchar(8)"),      // language of caption (obsolete)
		     new db_field("date_create","timestamp"), // date of creation
		     new db_field("date_update","timestamp"), // date of last update
		     )
	       );
	
// keywords associated with each picture
$db_tables[] =
  new db_table("picture_keywords", array("picid","wordid"), array("wordid"),
	       array(new db_field("picid","int not null"),  // id
		     new db_field("wordid","int not null"), // id
		     )
	       );
	
// persons appearing in each picture
$db_tables[] =
  new db_table("picture_persons", array("picid","personid"), array("personid"),
	       array(new db_field("picid","int not null"),    // id
		     new db_field("personid","int not null"), // id
		     new db_field("location","text"),         // where person is in picture
		     )
	       );
	
// table of contents (both public and private collections)
$db_tables[] =
  new db_table("toc", array("collid"), array("cid"),
	       array(new db_field("collid","int not null"),  // collection id
		     new db_field("cid","int"),              // cookie for favorite collection
		     new db_field("forall","smallint"),      // 1=visible to all
		     new db_field("seq","int"),              // sequence
		     new db_field("name","text"),            // short name of collection (multilingual)
		     new db_field("description","text"),     // description of collection (multilingual)
		     new db_field("photographer","text"),    // who are the photos credited to
		     new db_field("options_col","text"),     // image options (php array)
		     new db_field("date_start","date"),      // start date of photos
		     new db_field("date_end","date"),        // end date of photos
		     new db_field("date_create","timestamp"), // date of creation
		     new db_field("date_update","timestamp"), // date of last update
		     )
	       );
	
// mapping of pictures to collections (and preferred ordering)
$db_tables[] =
  new db_table("toc_pictures", array("collid","picid"), array("picid"),
	       array(new db_field("collid","int not null"), // collection id
		     new db_field("picid","int not null"),  // picture id
		     new db_field("seq","int"),             // sequence
		     )
	       );
	
// language dependent names and descriptions of toc entries (obsolete)
$db_tables[] =
  new db_table("toc_names", array("collid","lang"), array(),
	       array(new db_field("collid","int not null"), // collection id
		     new db_field("lang","varchar(8)"),     // language of name and desc
		     new db_field("name","text"),           // short name of collection
		     new db_field("description","text"),    // description of collection
		     )
	       );



$db_tables_defaults = array();

// default values for the config table
$db_tables_defaults["config"] = 
  array(
	array("key"=>"db_version",
	      "type"=>"float",
	      "value"=>strval($DB_VERSION),
	      "description"=>"Current version of database tables."),
	
	array("key"=>"copyright_name",
	      "type"=>"text",
	      "value"=>"Someone",
	      "description"=>"Full name of person to be considered coppyright owner of the content of the photo album (pictures and such)."),

	array("key"=>"copyright_email",
	      "type"=>"text",
	      "value"=>"someone@somewhere.com",
	      "description"=>"Email address of copyright owner."),
	
	array("key"=>"siteadmin_name",
	      "type"=>"text",
	      "value"=>"Someone",
	      "description"=>"Full name of site administrator."),

	array("key"=>"siteadmin_email",
	      "type"=>"text",
	      "value"=>"someone@somewhere.com",
	      "description"=>"Email address of site administrator."),

	array("key"=>"survey_email",
	      "type"=>"text",
	      "value"=>"someone@somewhere.com",
	      "description"=>"Email address to send comments to."),

	array("key"=>"toc_max_entries",
	      "type"=>"int",
	      "value"=>"40",
	      "description"=>"Maximum number of TOC entries to display on one page."),

	array("key"=>"toc_min_entries",
	      "type"=>"int",
	      "value"=>"20",
	      "description"=>"Minimum number of TOC entries to display on one page."),

	array("key"=>"toc_overlap",
	      "type"=>"int",
	      "value"=>"1",
	      "description"=>"Number of TOC entries that overlap from one page to next."),

	array("key"=>"thumb_max_entries",
	      "type"=>"int",
	      "value"=>"100",
	      "description"=>"Maximum number of photos to display on one page."),

	array("key"=>"thumb_min_entries",
	      "type"=>"int",
	      "value"=>"20",
	      "description"=>"Minimum number of photos to display on one page."),

	array("key"=>"thumb_overlap",
	      "type"=>"int",
	      "value"=>"1",
	      "description"=>"Number of photos that overlap from one page to next."),
	
	array("key"=>"allow_custom",
	      "type"=>"boolean",
	      "value"=>"1",
	      "description"=>"Allow users to create custom versions of images."),
	
	array("key"=>"allow_caption",
	      "type"=>"boolean",
	      "value"=>"1",
	      "description"=>"Allow users to add/edit captions."),

	array("key"=>"allow_prefs",
	      "type"=>"boolean",
	      "value"=>"1",
	      "description"=>"Allow users to change their preferences."),

	array("key"=>"default_lang",
	      "type"=>"language",
	      "value"=>$default_lang,
	      "description"=>"Default language."),

	array("key"=>"default_style",
	      "type"=>"stylesheet",
	      "value"=>$default_style,
	      "description"=>"Default stylesheet."),

	array("key"=>"auth_cookielogin_timelimit",
	      "type"=>"int",
	      "value"=>"90",
	      "description"=>"Maximum number of days that are allowed to pass between logins of a particular user w/o requiring a password to be entered.  Set to 0 to disable cookielogin feature."),
	
	array("key"=>"auth_cookielogin_location",
	      "type"=>"boolean",
	      "value"=>"1",
	      "description"=>"Set to yes to limit cookie logins (login w/o password) to users returning from the same address they previously logged in from."),
	
	array("key"=>"auth_realm",
	      "type"=>"text",
	      "value"=>"Virtual Photo Album",
	      "description"=>"Realm for basic authentication."),

	array("key"=>"options_global",
	      "type"=>"image_options",
	      "value"=>"a:1:{s:5:\"gamma\";d:1;}",
	      "description"=>"Global image processing parameters."),
	);


// default values for types table
$db_tables_defaults["types"] = 
  array(
	array("typeid"=>-1,
	      "name"=>array("en"=>"Thumbnail"),
	      //"name_plural"=>array("en"=>"Thumbnails"),
	      "preference"=>0,
	      "filename_prefix"=>"",
	      "filename_suffix"=>"t.jpg",
	      "options_type"=>array("bound"=>array(128,128),"jpeg_qual"=>75),
	      //"mimetype_src"=>, // ANY
	      "mimetype_dest"=>"image/jpeg"),

	array("typeid"=>1,
	      "name"=>array("en"=>"Little Photo"),
	      //"name_plural"=>array("en"=>"Little Photos"),
	      "preference"=>1,
	      "filename_prefix"=>"",
	      "filename_suffix"=>"l.jpg",
	      "options_type"=>array("bound"=>array(512,480),"jpeg_qual"=>85),
	      //"mimetype_src"=>"", // ANY
	      "mimetype_dest"=>"image/jpeg"),

	array("typeid"=>2,
	      "name"=>array("en"=>"Big Photo"),
	      //"name_plural"=>array("en"=>"Big Photos"),
	      "preference"=>2,
	      "filename_prefix"=>"",
	      "filename_suffix"=>"b.jpg",
	      "options_type"=>array("bound"=>array(768,600),"jpeg_qual"=>90),
	      //"mimetype_src"=>"", // ANY
	      "mimetype_dest"=>"image/jpeg"),

	array("typeid"=>3,
	      "name"=>array("en"=>"Mini-movie"),
	      //"name_plural"=>array("en"=>"Mini-movies"),
	      "preference"=>3,
	      "filename_prefix"=>"",
	      "filename_suffix"=>".gif",
	      "options_type"=>array(),
	      "mimetype_src"=>"application/x-tar",
	      "mimetype_dest"=>"image/gif"),
	);


// default values for sources table
$db_tables_defaults["sources"] = 
  array(
	array("srcid"=>1,
	      "description"=>"PhotoCD",
	      "options_src"=>array("gamma"=>1),
	      "detect"=>array()),

	array("srcid"=>2,
	      "description"=>"Scanned Prints",
	      "options_src"=>array("gamma"=>1),
	      "detect"=>array()),

	array("srcid"=>3,
	      "description"=>"Canon PowerShot S300",
	      "options_src"=>array("gamma"=>1),
	      "detect"=>array()),

	array("srcid"=>4,
	      "description"=>"Kodak DC120",
	      "options_src"=>array("gamma"=>1),
	      "detect"=>array()),

	array("srcid"=>5,
	      "description"=>"Kodak DC240",
	      "options_src"=>array("gamma"=>1),
	      "detect"=>array()),

	array("srcid"=>6,
	      "description"=>"Kodak DC265",
	      "options_src"=>array("gamma"=>1),
	      "detect"=>array()),

	array("srcid"=>7,
	      "description"=>"Nikon CoolPix 950",
	      "options_src"=>array("gamma"=>1),
	      "detect"=>array()),

	array("srcid"=>8,
	      "description"=>"Nikon CoolPix 990",
	      "options_src"=>array("gamma"=>1),
	      "detect"=>array()),
	);




?>