annotate msite.inc.php @ 816:95c3e0a1058e

Add new helper function stProbeFileInfo().
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 24 Nov 2014 21:33:58 +0200
parents 4df1bfd11131
children 41f7ab5eddc3
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1 <?
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
2 //
571
ce11ea112a65 Change the header blurb a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 570
diff changeset
3 // FAPWeb - Simple Web-based Demoparty Management System
33
5bf22431176c Modularize.
Matti Hamalainen <ccr@tnsp.org>
parents: 32
diff changeset
4 // Generic and miscellaneous site support code
565
ed2247111fdd Bump copyright years.
Matti Hamalainen <ccr@tnsp.org>
parents: 558
diff changeset
5 // (C) Copyright 2012-2014 Tecnic Software productions (TNSP)
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
6 //
175
8df523e6326a User require_once instead of require.
Matti Hamalainen <ccr@tnsp.org>
parents: 172
diff changeset
7 require_once "msitegen.inc.php";
51
7bdf89601ba0 Work on session stuff.
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
8
184
1b30c2107e5b Add function for validating input with different definable conditions. Use
Matti Hamalainen <ccr@tnsp.org>
parents: 176
diff changeset
9 // Define modes of party information display system
410
298822ed0420 Change display mode constant values.
Matti Hamalainen <ccr@tnsp.org>
parents: 407
diff changeset
10 define("SMODE_DISABLED", 0);
298822ed0420 Change display mode constant values.
Matti Hamalainen <ccr@tnsp.org>
parents: 407
diff changeset
11 define("SMODE_ROTATE", 1);
298822ed0420 Change display mode constant values.
Matti Hamalainen <ccr@tnsp.org>
parents: 407
diff changeset
12 define("SMODE_COMPO", 2);
139
75cf14ee99a7 More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
13
8
4c5f651aa107 Migrate certain settings to SQL database, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 7
diff changeset
14
184
1b30c2107e5b Add function for validating input with different definable conditions. Use
Matti Hamalainen <ccr@tnsp.org>
parents: 176
diff changeset
15 // Define sizes of database fields, see createdb.php
1b30c2107e5b Add function for validating input with different definable conditions. Use
Matti Hamalainen <ccr@tnsp.org>
parents: 176
diff changeset
16 // and also the places where input is validated.
1b30c2107e5b Add function for validating input with different definable conditions. Use
Matti Hamalainen <ccr@tnsp.org>
parents: 176
diff changeset
17 define("SET_LEN_USERNAME", 32);
1b30c2107e5b Add function for validating input with different definable conditions. Use
Matti Hamalainen <ccr@tnsp.org>
parents: 176
diff changeset
18 define("SET_LEN_GROUPS", 64);
1b30c2107e5b Add function for validating input with different definable conditions. Use
Matti Hamalainen <ccr@tnsp.org>
parents: 176
diff changeset
19 define("SET_LEN_ONELINER", 64);
1b30c2107e5b Add function for validating input with different definable conditions. Use
Matti Hamalainen <ccr@tnsp.org>
parents: 176
diff changeset
20 define("SET_LEN_EMAIL", 80);
716
e7fbcf4190e6 Add registration host.
Matti Hamalainen <ccr@tnsp.org>
parents: 703
diff changeset
21 define("SET_LEN_REGHOST", 128);
184
1b30c2107e5b Add function for validating input with different definable conditions. Use
Matti Hamalainen <ccr@tnsp.org>
parents: 176
diff changeset
22
1b30c2107e5b Add function for validating input with different definable conditions. Use
Matti Hamalainen <ccr@tnsp.org>
parents: 176
diff changeset
23 define("SET_LEN_NEWS_TITLE", 128);
1b30c2107e5b Add function for validating input with different definable conditions. Use
Matti Hamalainen <ccr@tnsp.org>
parents: 176
diff changeset
24 define("SET_LEN_NEWS_TEXT", 4096);
1b30c2107e5b Add function for validating input with different definable conditions. Use
Matti Hamalainen <ccr@tnsp.org>
parents: 176
diff changeset
25 define("SET_LEN_NEWS_AUTHOR", 64);
1b30c2107e5b Add function for validating input with different definable conditions. Use
Matti Hamalainen <ccr@tnsp.org>
parents: 176
diff changeset
26
1b30c2107e5b Add function for validating input with different definable conditions. Use
Matti Hamalainen <ccr@tnsp.org>
parents: 176
diff changeset
27 define("SET_LEN_COMPO_NAME", 128);
1b30c2107e5b Add function for validating input with different definable conditions. Use
Matti Hamalainen <ccr@tnsp.org>
parents: 176
diff changeset
28 define("SET_LEN_COMPO_DESC", 4096);
533
f872843ae396 Add file path to compo data.
Matti Hamalainen <ccr@tnsp.org>
parents: 531
diff changeset
29 define("SET_LEN_COMPO_PATH", 128);
184
1b30c2107e5b Add function for validating input with different definable conditions. Use
Matti Hamalainen <ccr@tnsp.org>
parents: 176
diff changeset
30
1b30c2107e5b Add function for validating input with different definable conditions. Use
Matti Hamalainen <ccr@tnsp.org>
parents: 176
diff changeset
31 define("SET_LEN_ENTRY_NAME", 64);
1b30c2107e5b Add function for validating input with different definable conditions. Use
Matti Hamalainen <ccr@tnsp.org>
parents: 176
diff changeset
32 define("SET_LEN_ENTRY_AUTHOR", 64);
526
e074775d853e Make filename field shorter.
Matti Hamalainen <ccr@tnsp.org>
parents: 512
diff changeset
33 define("SET_LEN_ENTRY_FILENAME", 128);
796
589cb2d88332 Make entry info field shorter.
Matti Hamalainen <ccr@tnsp.org>
parents: 792
diff changeset
34 define("SET_LEN_ENTRY_INFO", 40*3);
527
d6726a4883a6 Add "notes" field for entries, to contain notes private to organizers.
Matti Hamalainen <ccr@tnsp.org>
parents: 526
diff changeset
35 define("SET_LEN_ENTRY_NOTES", 1024);
528
dd5c5577c495 Add preview file and file type fields for entry, for screenshots etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 527
diff changeset
36 define("SET_LEN_ENTRY_PREVIEW_FILE", 128);
184
1b30c2107e5b Add function for validating input with different definable conditions. Use
Matti Hamalainen <ccr@tnsp.org>
parents: 176
diff changeset
37
506
d29166d97b46 Change some database field sizes.
Matti Hamalainen <ccr@tnsp.org>
parents: 503
diff changeset
38 define("SET_LEN_DISP_SLIDE_TITLE", 64);
420
e9f6e242c4b9 Define some more SQL field lengths.
Matti Hamalainen <ccr@tnsp.org>
parents: 410
diff changeset
39 define("SET_LEN_DISP_SLIDE_TEXT", 4096);
e9f6e242c4b9 Define some more SQL field lengths.
Matti Hamalainen <ccr@tnsp.org>
parents: 410
diff changeset
40 define("SET_LEN_ROT_LIST_NAME", 128);
184
1b30c2107e5b Add function for validating input with different definable conditions. Use
Matti Hamalainen <ccr@tnsp.org>
parents: 176
diff changeset
41
503
3232f682f0d2 Change how table schemas are defined, in preparation for future database
Matti Hamalainen <ccr@tnsp.org>
parents: 491
diff changeset
42 define("SET_LEN_VOTEKEY", 64);
508
b6fe46c86ff3 Add definitions for entry flags and compo types. Not used yet (though the
Matti Hamalainen <ccr@tnsp.org>
parents: 506
diff changeset
43
b6fe46c86ff3 Add definitions for entry flags and compo types. Not used yet (though the
Matti Hamalainen <ccr@tnsp.org>
parents: 506
diff changeset
44
b6fe46c86ff3 Add definitions for entry flags and compo types. Not used yet (though the
Matti Hamalainen <ccr@tnsp.org>
parents: 506
diff changeset
45 //
702
c527b42a7857 Comments.
Matti Hamalainen <ccr@tnsp.org>
parents: 700
diff changeset
46 // Entry preview type (value)
508
b6fe46c86ff3 Add definitions for entry flags and compo types. Not used yet (though the
Matti Hamalainen <ccr@tnsp.org>
parents: 506
diff changeset
47 //
700
d0418af28559 Add EPREV_NONE define.
Matti Hamalainen <ccr@tnsp.org>
parents: 699
diff changeset
48 define("EPREV_NONE", 0); // No preview
528
dd5c5577c495 Add preview file and file type fields for entry, for screenshots etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 527
diff changeset
49 define("EPREV_IMAGE", 1); // Preview is image (PNG, JPEG)
700
d0418af28559 Add EPREV_NONE define.
Matti Hamalainen <ccr@tnsp.org>
parents: 699
diff changeset
50 define("EPREV_AUDIO", 2); // Preview is audio (Vorbis, MP3)
528
dd5c5577c495 Add preview file and file type fields for entry, for screenshots etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 527
diff changeset
51
703
242cb053fbb2 Add array/list of preview types and descriptions for them.
Matti Hamalainen <ccr@tnsp.org>
parents: 702
diff changeset
52 $previewTypeList = array(
752
c714140541d5 Add more data to previewTypeList array and implement array index argument in
Matti Hamalainen <ccr@tnsp.org>
parents: 746
diff changeset
53 EPREV_NONE => array("No previews" , "Default"),
c714140541d5 Add more data to previewTypeList array and implement array index argument in
Matti Hamalainen <ccr@tnsp.org>
parents: 746
diff changeset
54 EPREV_IMAGE => array("Image file" , "Image"),
c714140541d5 Add more data to previewTypeList array and implement array index argument in
Matti Hamalainen <ccr@tnsp.org>
parents: 746
diff changeset
55 EPREV_AUDIO => array("Audio file" , "Audio"),
703
242cb053fbb2 Add array/list of preview types and descriptions for them.
Matti Hamalainen <ccr@tnsp.org>
parents: 702
diff changeset
56 );
242cb053fbb2 Add array/list of preview types and descriptions for them.
Matti Hamalainen <ccr@tnsp.org>
parents: 702
diff changeset
57
815
4df1bfd11131 Add file classes.
Matti Hamalainen <ccr@tnsp.org>
parents: 809
diff changeset
58 //
4df1bfd11131 Add file classes.
Matti Hamalainen <ccr@tnsp.org>
parents: 809
diff changeset
59 // File format classes
4df1bfd11131 Add file classes.
Matti Hamalainen <ccr@tnsp.org>
parents: 809
diff changeset
60 //
4df1bfd11131 Add file classes.
Matti Hamalainen <ccr@tnsp.org>
parents: 809
diff changeset
61 define("EFILE_UNKNOWN", 0);
4df1bfd11131 Add file classes.
Matti Hamalainen <ccr@tnsp.org>
parents: 809
diff changeset
62 define("EFILE_IMAGE", 1);
4df1bfd11131 Add file classes.
Matti Hamalainen <ccr@tnsp.org>
parents: 809
diff changeset
63 define("EFILE_AUDIO", 2);
4df1bfd11131 Add file classes.
Matti Hamalainen <ccr@tnsp.org>
parents: 809
diff changeset
64 define("EFILE_ARCHIVE", 5);
703
242cb053fbb2 Add array/list of preview types and descriptions for them.
Matti Hamalainen <ccr@tnsp.org>
parents: 702
diff changeset
65
702
c527b42a7857 Comments.
Matti Hamalainen <ccr@tnsp.org>
parents: 700
diff changeset
66 //
c527b42a7857 Comments.
Matti Hamalainen <ccr@tnsp.org>
parents: 700
diff changeset
67 // Entry flags (bitfield)
c527b42a7857 Comments.
Matti Hamalainen <ccr@tnsp.org>
parents: 700
diff changeset
68 //
508
b6fe46c86ff3 Add definitions for entry flags and compo types. Not used yet (though the
Matti Hamalainen <ccr@tnsp.org>
parents: 506
diff changeset
69 define("EFLAG_DISQUALIFIED", 1); // Entry is disqualified
b6fe46c86ff3 Add definitions for entry flags and compo types. Not used yet (though the
Matti Hamalainen <ccr@tnsp.org>
parents: 506
diff changeset
70 define("EFLAG_PROBLEMS", 2); // Has some problems
b6fe46c86ff3 Add definitions for entry flags and compo types. Not used yet (though the
Matti Hamalainen <ccr@tnsp.org>
parents: 506
diff changeset
71
690
bad79296eb34 Cleanups, rename variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 680
diff changeset
72 $entryFlagsList = array(
bad79296eb34 Cleanups, rename variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 680
diff changeset
73 EFLAG_DISQUALIFIED => array("Disqualified", "img/disqualified.png"),
bad79296eb34 Cleanups, rename variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 680
diff changeset
74 EFLAG_PROBLEMS => array("Has problems", "img/problems.png"),
bad79296eb34 Cleanups, rename variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 680
diff changeset
75 );
bad79296eb34 Cleanups, rename variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 680
diff changeset
76
508
b6fe46c86ff3 Add definitions for entry flags and compo types. Not used yet (though the
Matti Hamalainen <ccr@tnsp.org>
parents: 506
diff changeset
77
b6fe46c86ff3 Add definitions for entry flags and compo types. Not used yet (though the
Matti Hamalainen <ccr@tnsp.org>
parents: 506
diff changeset
78 //
792
b42b23073209 Improve printing of results with more options (in the admin interface).
Matti Hamalainen <ccr@tnsp.org>
parents: 785
diff changeset
79 // Results output flags
b42b23073209 Improve printing of results with more options (in the admin interface).
Matti Hamalainen <ccr@tnsp.org>
parents: 785
diff changeset
80 //
b42b23073209 Improve printing of results with more options (in the admin interface).
Matti Hamalainen <ccr@tnsp.org>
parents: 785
diff changeset
81 define("RFLAG_NORMAL", 0);
b42b23073209 Improve printing of results with more options (in the admin interface).
Matti Hamalainen <ccr@tnsp.org>
parents: 785
diff changeset
82 define("RFLAG_DISQUALIFIED", 1);
b42b23073209 Improve printing of results with more options (in the admin interface).
Matti Hamalainen <ccr@tnsp.org>
parents: 785
diff changeset
83 define("RFLAG_HIDDEN_COMPOS", 2);
b42b23073209 Improve printing of results with more options (in the admin interface).
Matti Hamalainen <ccr@tnsp.org>
parents: 785
diff changeset
84
b42b23073209 Improve printing of results with more options (in the admin interface).
Matti Hamalainen <ccr@tnsp.org>
parents: 785
diff changeset
85 //
508
b6fe46c86ff3 Add definitions for entry flags and compo types. Not used yet (though the
Matti Hamalainen <ccr@tnsp.org>
parents: 506
diff changeset
86 // Competition types
b6fe46c86ff3 Add definitions for entry flags and compo types. Not used yet (though the
Matti Hamalainen <ccr@tnsp.org>
parents: 506
diff changeset
87 //
606
3d2b70fbeb78 Slight cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 605
diff changeset
88 define("COMPO_NORMAL", 0); // Normal voting compo, points determine placement
3d2b70fbeb78 Slight cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 605
diff changeset
89 define("COMPO_POINTS", 1); // Assigned points, points determines placement (no voting)
508
b6fe46c86ff3 Add definitions for entry flags and compo types. Not used yet (though the
Matti Hamalainen <ccr@tnsp.org>
parents: 506
diff changeset
90 define("COMPO_ASSIGN", 2); // Assigned places (no voting)
b6fe46c86ff3 Add definitions for entry flags and compo types. Not used yet (though the
Matti Hamalainen <ccr@tnsp.org>
parents: 506
diff changeset
91
b6fe46c86ff3 Add definitions for entry flags and compo types. Not used yet (though the
Matti Hamalainen <ccr@tnsp.org>
parents: 506
diff changeset
92
b6fe46c86ff3 Add definitions for entry flags and compo types. Not used yet (though the
Matti Hamalainen <ccr@tnsp.org>
parents: 506
diff changeset
93 $compoModeData = array(
b6fe46c86ff3 Add definitions for entry flags and compo types. Not used yet (though the
Matti Hamalainen <ccr@tnsp.org>
parents: 506
diff changeset
94 COMPO_NORMAL => array("Normal",
b6fe46c86ff3 Add definitions for entry flags and compo types. Not used yet (though the
Matti Hamalainen <ccr@tnsp.org>
parents: 506
diff changeset
95 "Normal voting compo.",
b6fe46c86ff3 Add definitions for entry flags and compo types. Not used yet (though the
Matti Hamalainen <ccr@tnsp.org>
parents: 506
diff changeset
96 ),
b6fe46c86ff3 Add definitions for entry flags and compo types. Not used yet (though the
Matti Hamalainen <ccr@tnsp.org>
parents: 506
diff changeset
97 COMPO_POINTS => array("Points",
b6fe46c86ff3 Add definitions for entry flags and compo types. Not used yet (though the
Matti Hamalainen <ccr@tnsp.org>
parents: 506
diff changeset
98 "Assigned points (no voting).",
745
7ac6d1fdc078 Add two new fields to compoModeData.
Matti Hamalainen <ccr@tnsp.org>
parents: 742
diff changeset
99 "Points",
508
b6fe46c86ff3 Add definitions for entry flags and compo types. Not used yet (though the
Matti Hamalainen <ccr@tnsp.org>
parents: 506
diff changeset
100 ),
b6fe46c86ff3 Add definitions for entry flags and compo types. Not used yet (though the
Matti Hamalainen <ccr@tnsp.org>
parents: 506
diff changeset
101 COMPO_ASSIGN => array("Assigned",
b6fe46c86ff3 Add definitions for entry flags and compo types. Not used yet (though the
Matti Hamalainen <ccr@tnsp.org>
parents: 506
diff changeset
102 "Assigned places (no points, no voting).",
745
7ac6d1fdc078 Add two new fields to compoModeData.
Matti Hamalainen <ccr@tnsp.org>
parents: 742
diff changeset
103 "Place",
508
b6fe46c86ff3 Add definitions for entry flags and compo types. Not used yet (though the
Matti Hamalainen <ccr@tnsp.org>
parents: 506
diff changeset
104 ),
b6fe46c86ff3 Add definitions for entry flags and compo types. Not used yet (though the
Matti Hamalainen <ccr@tnsp.org>
parents: 506
diff changeset
105 );
b6fe46c86ff3 Add definitions for entry flags and compo types. Not used yet (though the
Matti Hamalainen <ccr@tnsp.org>
parents: 506
diff changeset
106
641
1a123c6c2241 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 640
diff changeset
107
94
6edd7d623eab Start adding votekey modes code.
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
108 //
6edd7d623eab Start adding votekey modes code.
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
109 // Different voting modes
6edd7d623eab Start adding votekey modes code.
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
110 //
6edd7d623eab Start adding votekey modes code.
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
111 define("VOTE_FREELY", 0);
274
81507072f25d Add explanations of the different voting modes.
Matti Hamalainen <ccr@tnsp.org>
parents: 261
diff changeset
112 define("VOTE_ACTIVATE", 1);
81507072f25d Add explanations of the different voting modes.
Matti Hamalainen <ccr@tnsp.org>
parents: 261
diff changeset
113 define("VOTE_ASSIGN", 2);
94
6edd7d623eab Start adding votekey modes code.
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
114
274
81507072f25d Add explanations of the different voting modes.
Matti Hamalainen <ccr@tnsp.org>
parents: 261
diff changeset
115 $voteModeData = array(
81507072f25d Add explanations of the different voting modes.
Matti Hamalainen <ccr@tnsp.org>
parents: 261
diff changeset
116 VOTE_FREELY => array("Freeform voting",
282
50e52dc43916 Add missing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 274
diff changeset
117 "Vote keys are not tied to attendees, and do not need to be activated. ".
274
81507072f25d Add explanations of the different voting modes.
Matti Hamalainen <ccr@tnsp.org>
parents: 261
diff changeset
118 "Take one printed key slip, give it to attendee."
81507072f25d Add explanations of the different voting modes.
Matti Hamalainen <ccr@tnsp.org>
parents: 261
diff changeset
119 ),
81507072f25d Add explanations of the different voting modes.
Matti Hamalainen <ccr@tnsp.org>
parents: 261
diff changeset
120 VOTE_ACTIVATE => array("Key activation",
81507072f25d Add explanations of the different voting modes.
Matti Hamalainen <ccr@tnsp.org>
parents: 261
diff changeset
121 "Vote keys are not tied to attendees, but require manual activation. ".
81507072f25d Add explanations of the different voting modes.
Matti Hamalainen <ccr@tnsp.org>
parents: 261
diff changeset
122 "Take one printed key slip, find it by the index number in the list below, set to activated. ".
81507072f25d Add explanations of the different voting modes.
Matti Hamalainen <ccr@tnsp.org>
parents: 261
diff changeset
123 "Give key slip to attendee."
81507072f25d Add explanations of the different voting modes.
Matti Hamalainen <ccr@tnsp.org>
parents: 261
diff changeset
124 ),
81507072f25d Add explanations of the different voting modes.
Matti Hamalainen <ccr@tnsp.org>
parents: 261
diff changeset
125 VOTE_ASSIGN => array("Assigned keys",
307
c0d573a5de5b Add procedure description to assigned keys mode.
Matti Hamalainen <ccr@tnsp.org>
parents: 282
diff changeset
126 "Votekeys are tied to attendees, activated by assigning the key to attendee. ".
c0d573a5de5b Add procedure description to assigned keys mode.
Matti Hamalainen <ccr@tnsp.org>
parents: 282
diff changeset
127 "Take one printed key slip, find attendee in the list below, enter key ID number, assign, check. ".
c0d573a5de5b Add procedure description to assigned keys mode.
Matti Hamalainen <ccr@tnsp.org>
parents: 282
diff changeset
128 "Give key slip to attendee."
274
81507072f25d Add explanations of the different voting modes.
Matti Hamalainen <ccr@tnsp.org>
parents: 261
diff changeset
129 ),
81507072f25d Add explanations of the different voting modes.
Matti Hamalainen <ccr@tnsp.org>
parents: 261
diff changeset
130 );
94
6edd7d623eab Start adding votekey modes code.
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
131
6edd7d623eab Start adding votekey modes code.
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
132
535
88c048f3b9e1 Add comments.
Matti Hamalainen <ccr@tnsp.org>
parents: 533
diff changeset
133 //
807
0bb4b1973e08 Add file type list.
Matti Hamalainen <ccr@tnsp.org>
parents: 806
diff changeset
134 // Data about the file types we use
0bb4b1973e08 Add file type list.
Matti Hamalainen <ccr@tnsp.org>
parents: 806
diff changeset
135 //
809
a165d2e101f9 Rename array.
Matti Hamalainen <ccr@tnsp.org>
parents: 808
diff changeset
136 $fileTypeData = array(
807
0bb4b1973e08 Add file type list.
Matti Hamalainen <ccr@tnsp.org>
parents: 806
diff changeset
137 "PNG" => array(
815
4df1bfd11131 Add file classes.
Matti Hamalainen <ccr@tnsp.org>
parents: 809
diff changeset
138 "class" => EFILE_IMAGE,
807
0bb4b1973e08 Add file type list.
Matti Hamalainen <ccr@tnsp.org>
parents: 806
diff changeset
139 "type" => EPREV_IMAGE,
0bb4b1973e08 Add file type list.
Matti Hamalainen <ccr@tnsp.org>
parents: 806
diff changeset
140 "mime" => "image/png",
0bb4b1973e08 Add file type list.
Matti Hamalainen <ccr@tnsp.org>
parents: 806
diff changeset
141 "fext" => ".png",
808
887e88fad15a More filetype data.
Matti Hamalainen <ccr@tnsp.org>
parents: 807
diff changeset
142 "test" => "^PNG image data",
807
0bb4b1973e08 Add file type list.
Matti Hamalainen <ccr@tnsp.org>
parents: 806
diff changeset
143 ),
0bb4b1973e08 Add file type list.
Matti Hamalainen <ccr@tnsp.org>
parents: 806
diff changeset
144 "JPEG" => array(
815
4df1bfd11131 Add file classes.
Matti Hamalainen <ccr@tnsp.org>
parents: 809
diff changeset
145 "class" => EFILE_IMAGE,
807
0bb4b1973e08 Add file type list.
Matti Hamalainen <ccr@tnsp.org>
parents: 806
diff changeset
146 "type" => EPREV_IMAGE,
0bb4b1973e08 Add file type list.
Matti Hamalainen <ccr@tnsp.org>
parents: 806
diff changeset
147 "mime" => "image/jpeg",
0bb4b1973e08 Add file type list.
Matti Hamalainen <ccr@tnsp.org>
parents: 806
diff changeset
148 "fext" => ".jpg",
808
887e88fad15a More filetype data.
Matti Hamalainen <ccr@tnsp.org>
parents: 807
diff changeset
149 "test" => "^JPEG image data",
807
0bb4b1973e08 Add file type list.
Matti Hamalainen <ccr@tnsp.org>
parents: 806
diff changeset
150 ),
0bb4b1973e08 Add file type list.
Matti Hamalainen <ccr@tnsp.org>
parents: 806
diff changeset
151 "GIF" => array(
815
4df1bfd11131 Add file classes.
Matti Hamalainen <ccr@tnsp.org>
parents: 809
diff changeset
152 "class" => EFILE_IMAGE,
807
0bb4b1973e08 Add file type list.
Matti Hamalainen <ccr@tnsp.org>
parents: 806
diff changeset
153 "type" => EPREV_IMAGE,
0bb4b1973e08 Add file type list.
Matti Hamalainen <ccr@tnsp.org>
parents: 806
diff changeset
154 "mime" => "image/gif",
0bb4b1973e08 Add file type list.
Matti Hamalainen <ccr@tnsp.org>
parents: 806
diff changeset
155 "fext" => ".gif",
808
887e88fad15a More filetype data.
Matti Hamalainen <ccr@tnsp.org>
parents: 807
diff changeset
156 "test" => "^GIF image data",
807
0bb4b1973e08 Add file type list.
Matti Hamalainen <ccr@tnsp.org>
parents: 806
diff changeset
157 ),
0bb4b1973e08 Add file type list.
Matti Hamalainen <ccr@tnsp.org>
parents: 806
diff changeset
158
0bb4b1973e08 Add file type list.
Matti Hamalainen <ccr@tnsp.org>
parents: 806
diff changeset
159 "MP3" => array(
815
4df1bfd11131 Add file classes.
Matti Hamalainen <ccr@tnsp.org>
parents: 809
diff changeset
160 "class" => EFILE_AUDIO,
807
0bb4b1973e08 Add file type list.
Matti Hamalainen <ccr@tnsp.org>
parents: 806
diff changeset
161 "type" => EPREV_AUDIO,
0bb4b1973e08 Add file type list.
Matti Hamalainen <ccr@tnsp.org>
parents: 806
diff changeset
162 "mime" => "audio/mpeg",
0bb4b1973e08 Add file type list.
Matti Hamalainen <ccr@tnsp.org>
parents: 806
diff changeset
163 "fext" => ".mp3",
808
887e88fad15a More filetype data.
Matti Hamalainen <ccr@tnsp.org>
parents: 807
diff changeset
164 "test" => "MPEG ADTS, layer III",
807
0bb4b1973e08 Add file type list.
Matti Hamalainen <ccr@tnsp.org>
parents: 806
diff changeset
165 ),
0bb4b1973e08 Add file type list.
Matti Hamalainen <ccr@tnsp.org>
parents: 806
diff changeset
166 "OggVorbis" => array(
815
4df1bfd11131 Add file classes.
Matti Hamalainen <ccr@tnsp.org>
parents: 809
diff changeset
167 "class" => EFILE_AUDIO,
807
0bb4b1973e08 Add file type list.
Matti Hamalainen <ccr@tnsp.org>
parents: 806
diff changeset
168 "type" => EPREV_AUDIO,
0bb4b1973e08 Add file type list.
Matti Hamalainen <ccr@tnsp.org>
parents: 806
diff changeset
169 "mime" => "audio/ogg; codecs=vorbis",
0bb4b1973e08 Add file type list.
Matti Hamalainen <ccr@tnsp.org>
parents: 806
diff changeset
170 "fext" => ".ogg",
808
887e88fad15a More filetype data.
Matti Hamalainen <ccr@tnsp.org>
parents: 807
diff changeset
171 "test" => "Ogg data, Vorbis audio",
887e88fad15a More filetype data.
Matti Hamalainen <ccr@tnsp.org>
parents: 807
diff changeset
172 ),
815
4df1bfd11131 Add file classes.
Matti Hamalainen <ccr@tnsp.org>
parents: 809
diff changeset
173 "FLAC" => array(
4df1bfd11131 Add file classes.
Matti Hamalainen <ccr@tnsp.org>
parents: 809
diff changeset
174 "class" => EFILE_AUDIO,
4df1bfd11131 Add file classes.
Matti Hamalainen <ccr@tnsp.org>
parents: 809
diff changeset
175 "type" => EPREV_AUDIO,
4df1bfd11131 Add file classes.
Matti Hamalainen <ccr@tnsp.org>
parents: 809
diff changeset
176 "mime" => "audio/x-flac",
4df1bfd11131 Add file classes.
Matti Hamalainen <ccr@tnsp.org>
parents: 809
diff changeset
177 "fext" => ".flac",
4df1bfd11131 Add file classes.
Matti Hamalainen <ccr@tnsp.org>
parents: 809
diff changeset
178 ),
4df1bfd11131 Add file classes.
Matti Hamalainen <ccr@tnsp.org>
parents: 809
diff changeset
179 "WAV" => array(
4df1bfd11131 Add file classes.
Matti Hamalainen <ccr@tnsp.org>
parents: 809
diff changeset
180 "class" => EFILE_AUDIO,
4df1bfd11131 Add file classes.
Matti Hamalainen <ccr@tnsp.org>
parents: 809
diff changeset
181 "type" => EPREV_AUDIO,
4df1bfd11131 Add file classes.
Matti Hamalainen <ccr@tnsp.org>
parents: 809
diff changeset
182 "mime" => "audio/x-wav",
4df1bfd11131 Add file classes.
Matti Hamalainen <ccr@tnsp.org>
parents: 809
diff changeset
183 "fext" => ".wav",
4df1bfd11131 Add file classes.
Matti Hamalainen <ccr@tnsp.org>
parents: 809
diff changeset
184 ),
808
887e88fad15a More filetype data.
Matti Hamalainen <ccr@tnsp.org>
parents: 807
diff changeset
185
887e88fad15a More filetype data.
Matti Hamalainen <ccr@tnsp.org>
parents: 807
diff changeset
186 // Special cases
887e88fad15a More filetype data.
Matti Hamalainen <ccr@tnsp.org>
parents: 807
diff changeset
187 "ILBM" => array(
815
4df1bfd11131 Add file classes.
Matti Hamalainen <ccr@tnsp.org>
parents: 809
diff changeset
188 "class" => EFILE_IMAGE,
808
887e88fad15a More filetype data.
Matti Hamalainen <ccr@tnsp.org>
parents: 807
diff changeset
189 "mime" => "gfx", // Special cases to be converted through gfxconv ..
887e88fad15a More filetype data.
Matti Hamalainen <ccr@tnsp.org>
parents: 807
diff changeset
190 "fext" => ".lbm",
887e88fad15a More filetype data.
Matti Hamalainen <ccr@tnsp.org>
parents: 807
diff changeset
191 "test" => "^IFF data",
887e88fad15a More filetype data.
Matti Hamalainen <ccr@tnsp.org>
parents: 807
diff changeset
192 ),
887e88fad15a More filetype data.
Matti Hamalainen <ccr@tnsp.org>
parents: 807
diff changeset
193 "PCX" => array(
815
4df1bfd11131 Add file classes.
Matti Hamalainen <ccr@tnsp.org>
parents: 809
diff changeset
194 "class" => EFILE_IMAGE,
808
887e88fad15a More filetype data.
Matti Hamalainen <ccr@tnsp.org>
parents: 807
diff changeset
195 "mime" => "image/x-pcx",
887e88fad15a More filetype data.
Matti Hamalainen <ccr@tnsp.org>
parents: 807
diff changeset
196 "fext" => ".pcx",
887e88fad15a More filetype data.
Matti Hamalainen <ccr@tnsp.org>
parents: 807
diff changeset
197 "test" => "^PCX ver\. 3\.0",
887e88fad15a More filetype data.
Matti Hamalainen <ccr@tnsp.org>
parents: 807
diff changeset
198 ),
887e88fad15a More filetype data.
Matti Hamalainen <ccr@tnsp.org>
parents: 807
diff changeset
199
887e88fad15a More filetype data.
Matti Hamalainen <ccr@tnsp.org>
parents: 807
diff changeset
200 "PTMOD" => array(
815
4df1bfd11131 Add file classes.
Matti Hamalainen <ccr@tnsp.org>
parents: 809
diff changeset
201 "class" => EFILE_AUDIO,
808
887e88fad15a More filetype data.
Matti Hamalainen <ccr@tnsp.org>
parents: 807
diff changeset
202 "mime" => "audio/x-mod",
887e88fad15a More filetype data.
Matti Hamalainen <ccr@tnsp.org>
parents: 807
diff changeset
203 "fext" => ".mod",
887e88fad15a More filetype data.
Matti Hamalainen <ccr@tnsp.org>
parents: 807
diff changeset
204 "test" => "^\d+-channel Protracker module",
887e88fad15a More filetype data.
Matti Hamalainen <ccr@tnsp.org>
parents: 807
diff changeset
205 ),
887e88fad15a More filetype data.
Matti Hamalainen <ccr@tnsp.org>
parents: 807
diff changeset
206 "PTMOD" => array(
815
4df1bfd11131 Add file classes.
Matti Hamalainen <ccr@tnsp.org>
parents: 809
diff changeset
207 "class" => EFILE_AUDIO,
808
887e88fad15a More filetype data.
Matti Hamalainen <ccr@tnsp.org>
parents: 807
diff changeset
208 "mime" => "audio/x-mod",
887e88fad15a More filetype data.
Matti Hamalainen <ccr@tnsp.org>
parents: 807
diff changeset
209 "fext" => ".mod",
887e88fad15a More filetype data.
Matti Hamalainen <ccr@tnsp.org>
parents: 807
diff changeset
210 "test" => "^\d+-channel Fasttracker module",
887e88fad15a More filetype data.
Matti Hamalainen <ccr@tnsp.org>
parents: 807
diff changeset
211 ),
887e88fad15a More filetype data.
Matti Hamalainen <ccr@tnsp.org>
parents: 807
diff changeset
212 "S3M" => array(
815
4df1bfd11131 Add file classes.
Matti Hamalainen <ccr@tnsp.org>
parents: 809
diff changeset
213 "class" => EFILE_AUDIO,
808
887e88fad15a More filetype data.
Matti Hamalainen <ccr@tnsp.org>
parents: 807
diff changeset
214 "mime" => "audio/x-mod",
887e88fad15a More filetype data.
Matti Hamalainen <ccr@tnsp.org>
parents: 807
diff changeset
215 "fext" => ".s3m",
887e88fad15a More filetype data.
Matti Hamalainen <ccr@tnsp.org>
parents: 807
diff changeset
216 "test" => "^ScreamTracker III Module",
887e88fad15a More filetype data.
Matti Hamalainen <ccr@tnsp.org>
parents: 807
diff changeset
217 ),
887e88fad15a More filetype data.
Matti Hamalainen <ccr@tnsp.org>
parents: 807
diff changeset
218 "XM" => array(
815
4df1bfd11131 Add file classes.
Matti Hamalainen <ccr@tnsp.org>
parents: 809
diff changeset
219 "class" => EFILE_AUDIO,
808
887e88fad15a More filetype data.
Matti Hamalainen <ccr@tnsp.org>
parents: 807
diff changeset
220 "mime" => "audio/x-mod",
887e88fad15a More filetype data.
Matti Hamalainen <ccr@tnsp.org>
parents: 807
diff changeset
221 "fext" => ".xm",
887e88fad15a More filetype data.
Matti Hamalainen <ccr@tnsp.org>
parents: 807
diff changeset
222 "test" => "^Fasttracker II module",
887e88fad15a More filetype data.
Matti Hamalainen <ccr@tnsp.org>
parents: 807
diff changeset
223 ),
887e88fad15a More filetype data.
Matti Hamalainen <ccr@tnsp.org>
parents: 807
diff changeset
224 "IT" => array(
815
4df1bfd11131 Add file classes.
Matti Hamalainen <ccr@tnsp.org>
parents: 809
diff changeset
225 "class" => EFILE_AUDIO,
808
887e88fad15a More filetype data.
Matti Hamalainen <ccr@tnsp.org>
parents: 807
diff changeset
226 "mime" => "audio/x-mod",
887e88fad15a More filetype data.
Matti Hamalainen <ccr@tnsp.org>
parents: 807
diff changeset
227 "fext" => ".it",
887e88fad15a More filetype data.
Matti Hamalainen <ccr@tnsp.org>
parents: 807
diff changeset
228 "test" => "^Impulse Tracker module",
887e88fad15a More filetype data.
Matti Hamalainen <ccr@tnsp.org>
parents: 807
diff changeset
229 ),
887e88fad15a More filetype data.
Matti Hamalainen <ccr@tnsp.org>
parents: 807
diff changeset
230 "PTM" => array(
815
4df1bfd11131 Add file classes.
Matti Hamalainen <ccr@tnsp.org>
parents: 809
diff changeset
231 "class" => EFILE_AUDIO,
808
887e88fad15a More filetype data.
Matti Hamalainen <ccr@tnsp.org>
parents: 807
diff changeset
232 "mime" => "audio/x-mod",
887e88fad15a More filetype data.
Matti Hamalainen <ccr@tnsp.org>
parents: 807
diff changeset
233 "fext" => ".ptm",
887e88fad15a More filetype data.
Matti Hamalainen <ccr@tnsp.org>
parents: 807
diff changeset
234 "test" => "^Poly Tracker PTM Module",
807
0bb4b1973e08 Add file type list.
Matti Hamalainen <ccr@tnsp.org>
parents: 806
diff changeset
235 ),
815
4df1bfd11131 Add file classes.
Matti Hamalainen <ccr@tnsp.org>
parents: 809
diff changeset
236
4df1bfd11131 Add file classes.
Matti Hamalainen <ccr@tnsp.org>
parents: 809
diff changeset
237 "AVI" => array(
4df1bfd11131 Add file classes.
Matti Hamalainen <ccr@tnsp.org>
parents: 809
diff changeset
238 "class" => EFILE_VIDEO,
4df1bfd11131 Add file classes.
Matti Hamalainen <ccr@tnsp.org>
parents: 809
diff changeset
239 "mime" => "video/x-msvideo",
4df1bfd11131 Add file classes.
Matti Hamalainen <ccr@tnsp.org>
parents: 809
diff changeset
240 "fext" => ".avi",
4df1bfd11131 Add file classes.
Matti Hamalainen <ccr@tnsp.org>
parents: 809
diff changeset
241 ),
4df1bfd11131 Add file classes.
Matti Hamalainen <ccr@tnsp.org>
parents: 809
diff changeset
242 "WMV" => array(
4df1bfd11131 Add file classes.
Matti Hamalainen <ccr@tnsp.org>
parents: 809
diff changeset
243 "class" => EFILE_VIDEO,
4df1bfd11131 Add file classes.
Matti Hamalainen <ccr@tnsp.org>
parents: 809
diff changeset
244 "mime" => "video/x-ms-asf",
4df1bfd11131 Add file classes.
Matti Hamalainen <ccr@tnsp.org>
parents: 809
diff changeset
245 "fext" => ".wmv",
4df1bfd11131 Add file classes.
Matti Hamalainen <ccr@tnsp.org>
parents: 809
diff changeset
246 ),
4df1bfd11131 Add file classes.
Matti Hamalainen <ccr@tnsp.org>
parents: 809
diff changeset
247 "MP4" => array(
4df1bfd11131 Add file classes.
Matti Hamalainen <ccr@tnsp.org>
parents: 809
diff changeset
248 "class" => EFILE_VIDEO,
4df1bfd11131 Add file classes.
Matti Hamalainen <ccr@tnsp.org>
parents: 809
diff changeset
249 "mime" => "video/mp4",
4df1bfd11131 Add file classes.
Matti Hamalainen <ccr@tnsp.org>
parents: 809
diff changeset
250 "fext" => ".mp4",
4df1bfd11131 Add file classes.
Matti Hamalainen <ccr@tnsp.org>
parents: 809
diff changeset
251 ),
4df1bfd11131 Add file classes.
Matti Hamalainen <ccr@tnsp.org>
parents: 809
diff changeset
252 "MOV" => array(
4df1bfd11131 Add file classes.
Matti Hamalainen <ccr@tnsp.org>
parents: 809
diff changeset
253 "class" => EFILE_VIDEO,
4df1bfd11131 Add file classes.
Matti Hamalainen <ccr@tnsp.org>
parents: 809
diff changeset
254 "mime" => "video/quicktime",
4df1bfd11131 Add file classes.
Matti Hamalainen <ccr@tnsp.org>
parents: 809
diff changeset
255 "fext" => ".mov",
4df1bfd11131 Add file classes.
Matti Hamalainen <ccr@tnsp.org>
parents: 809
diff changeset
256 ),
4df1bfd11131 Add file classes.
Matti Hamalainen <ccr@tnsp.org>
parents: 809
diff changeset
257 "MKV" => array(
4df1bfd11131 Add file classes.
Matti Hamalainen <ccr@tnsp.org>
parents: 809
diff changeset
258 "class" => EFILE_VIDEO,
4df1bfd11131 Add file classes.
Matti Hamalainen <ccr@tnsp.org>
parents: 809
diff changeset
259 "mime" => "video/x-matroska",
4df1bfd11131 Add file classes.
Matti Hamalainen <ccr@tnsp.org>
parents: 809
diff changeset
260 "fext" => ".mkv",
4df1bfd11131 Add file classes.
Matti Hamalainen <ccr@tnsp.org>
parents: 809
diff changeset
261 ),
4df1bfd11131 Add file classes.
Matti Hamalainen <ccr@tnsp.org>
parents: 809
diff changeset
262
4df1bfd11131 Add file classes.
Matti Hamalainen <ccr@tnsp.org>
parents: 809
diff changeset
263 // Archives
4df1bfd11131 Add file classes.
Matti Hamalainen <ccr@tnsp.org>
parents: 809
diff changeset
264 "LHA" => array(
4df1bfd11131 Add file classes.
Matti Hamalainen <ccr@tnsp.org>
parents: 809
diff changeset
265 "class" => EFILE_ARCHIVE,
4df1bfd11131 Add file classes.
Matti Hamalainen <ccr@tnsp.org>
parents: 809
diff changeset
266 "mime" => "application/x-lha",
4df1bfd11131 Add file classes.
Matti Hamalainen <ccr@tnsp.org>
parents: 809
diff changeset
267 "fext" => ".lha",
4df1bfd11131 Add file classes.
Matti Hamalainen <ccr@tnsp.org>
parents: 809
diff changeset
268 ),
4df1bfd11131 Add file classes.
Matti Hamalainen <ccr@tnsp.org>
parents: 809
diff changeset
269 "ZIP" => array(
4df1bfd11131 Add file classes.
Matti Hamalainen <ccr@tnsp.org>
parents: 809
diff changeset
270 "class" => EFILE_ARCHIVE,
4df1bfd11131 Add file classes.
Matti Hamalainen <ccr@tnsp.org>
parents: 809
diff changeset
271 "mime" => "application/zip",
4df1bfd11131 Add file classes.
Matti Hamalainen <ccr@tnsp.org>
parents: 809
diff changeset
272 "fext" => ".zip",
4df1bfd11131 Add file classes.
Matti Hamalainen <ccr@tnsp.org>
parents: 809
diff changeset
273 ),
4df1bfd11131 Add file classes.
Matti Hamalainen <ccr@tnsp.org>
parents: 809
diff changeset
274 "7ZIP" => array(
4df1bfd11131 Add file classes.
Matti Hamalainen <ccr@tnsp.org>
parents: 809
diff changeset
275 "class" => EFILE_ARCHIVE,
4df1bfd11131 Add file classes.
Matti Hamalainen <ccr@tnsp.org>
parents: 809
diff changeset
276 "mime" => "application/x-7z-compressed",
4df1bfd11131 Add file classes.
Matti Hamalainen <ccr@tnsp.org>
parents: 809
diff changeset
277 "fext" => ".7z",
4df1bfd11131 Add file classes.
Matti Hamalainen <ccr@tnsp.org>
parents: 809
diff changeset
278 ),
4df1bfd11131 Add file classes.
Matti Hamalainen <ccr@tnsp.org>
parents: 809
diff changeset
279 "RAR" => array(
4df1bfd11131 Add file classes.
Matti Hamalainen <ccr@tnsp.org>
parents: 809
diff changeset
280 "class" => EFILE_ARCHIVE,
4df1bfd11131 Add file classes.
Matti Hamalainen <ccr@tnsp.org>
parents: 809
diff changeset
281 "mime" => "application/x-rar",
4df1bfd11131 Add file classes.
Matti Hamalainen <ccr@tnsp.org>
parents: 809
diff changeset
282 "fext" => ".rar",
4df1bfd11131 Add file classes.
Matti Hamalainen <ccr@tnsp.org>
parents: 809
diff changeset
283 ),
4df1bfd11131 Add file classes.
Matti Hamalainen <ccr@tnsp.org>
parents: 809
diff changeset
284 "ARJ" => array(
4df1bfd11131 Add file classes.
Matti Hamalainen <ccr@tnsp.org>
parents: 809
diff changeset
285 "class" => EFILE_ARCHIVE,
4df1bfd11131 Add file classes.
Matti Hamalainen <ccr@tnsp.org>
parents: 809
diff changeset
286 "mime" => "application/x-arj",
4df1bfd11131 Add file classes.
Matti Hamalainen <ccr@tnsp.org>
parents: 809
diff changeset
287 "fext" => ".arj",
4df1bfd11131 Add file classes.
Matti Hamalainen <ccr@tnsp.org>
parents: 809
diff changeset
288 ),
4df1bfd11131 Add file classes.
Matti Hamalainen <ccr@tnsp.org>
parents: 809
diff changeset
289
4df1bfd11131 Add file classes.
Matti Hamalainen <ccr@tnsp.org>
parents: 809
diff changeset
290 // Final fallback
4df1bfd11131 Add file classes.
Matti Hamalainen <ccr@tnsp.org>
parents: 809
diff changeset
291 "MISC" => array(
4df1bfd11131 Add file classes.
Matti Hamalainen <ccr@tnsp.org>
parents: 809
diff changeset
292 "class" => EFILE_ARCHIVE,
4df1bfd11131 Add file classes.
Matti Hamalainen <ccr@tnsp.org>
parents: 809
diff changeset
293 "mime" => "application/octet-stream",
4df1bfd11131 Add file classes.
Matti Hamalainen <ccr@tnsp.org>
parents: 809
diff changeset
294 "fext" => FALSE,
4df1bfd11131 Add file classes.
Matti Hamalainen <ccr@tnsp.org>
parents: 809
diff changeset
295 ),
807
0bb4b1973e08 Add file type list.
Matti Hamalainen <ccr@tnsp.org>
parents: 806
diff changeset
296 );
0bb4b1973e08 Add file type list.
Matti Hamalainen <ccr@tnsp.org>
parents: 806
diff changeset
297
0bb4b1973e08 Add file type list.
Matti Hamalainen <ccr@tnsp.org>
parents: 806
diff changeset
298
0bb4b1973e08 Add file type list.
Matti Hamalainen <ccr@tnsp.org>
parents: 806
diff changeset
299 //
535
88c048f3b9e1 Add comments.
Matti Hamalainen <ccr@tnsp.org>
parents: 533
diff changeset
300 // Party infromation system data/variables handling
88c048f3b9e1 Add comments.
Matti Hamalainen <ccr@tnsp.org>
parents: 533
diff changeset
301 //
143
20893a5442b7 Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents: 139
diff changeset
302 function stReloadDisplayVars()
20893a5442b7 Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents: 139
diff changeset
303 {
20893a5442b7 Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents: 139
diff changeset
304 global $displayVars, $displayVarsChanged;
20893a5442b7 Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents: 139
diff changeset
305
20893a5442b7 Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents: 139
diff changeset
306 $displayVars = array();
20893a5442b7 Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents: 139
diff changeset
307 $displayVarsChanged = array();
20893a5442b7 Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents: 139
diff changeset
308
542
8c1a53532be0 Rename various database tables and column names for better SQL compatibility.
Matti Hamalainen <ccr@tnsp.org>
parents: 535
diff changeset
309 if (($res = stExecSQL("SELECT * FROM display_vars")) !== FALSE)
143
20893a5442b7 Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents: 139
diff changeset
310 {
20893a5442b7 Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents: 139
diff changeset
311 foreach ($res as $row)
354
1dd598221874 Simplify code by reusing functions from site module.
Matti Hamalainen <ccr@tnsp.org>
parents: 307
diff changeset
312 $displayVars[$row["key"]] = stGetSQLSettingData($row);
143
20893a5442b7 Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents: 139
diff changeset
313 }
20893a5442b7 Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents: 139
diff changeset
314 }
20893a5442b7 Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents: 139
diff changeset
315
20893a5442b7 Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents: 139
diff changeset
316
20893a5442b7 Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents: 139
diff changeset
317 function stSaveDisplayVars()
20893a5442b7 Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents: 139
diff changeset
318 {
144
c030c3cf0d80 More work on display system.
Matti Hamalainen <ccr@tnsp.org>
parents: 143
diff changeset
319 global $db, $displayVars, $displayVarsChanged;
143
20893a5442b7 Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents: 139
diff changeset
320
542
8c1a53532be0 Rename various database tables and column names for better SQL compatibility.
Matti Hamalainen <ccr@tnsp.org>
parents: 535
diff changeset
321 foreach (stExecSQL("SELECT * FROM display_vars") as $item)
143
20893a5442b7 Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents: 139
diff changeset
322 if (isset($displayVarsChanged[$item["key"]]))
20893a5442b7 Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents: 139
diff changeset
323 {
20893a5442b7 Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents: 139
diff changeset
324 $val = $displayVars[$item["key"]];
354
1dd598221874 Simplify code by reusing functions from site module.
Matti Hamalainen <ccr@tnsp.org>
parents: 307
diff changeset
325 stExecSQL(
542
8c1a53532be0 Rename various database tables and column names for better SQL compatibility.
Matti Hamalainen <ccr@tnsp.org>
parents: 535
diff changeset
326 "UPDATE display_vars SET ".stGetSettingSQL($item, $val).
354
1dd598221874 Simplify code by reusing functions from site module.
Matti Hamalainen <ccr@tnsp.org>
parents: 307
diff changeset
327 " WHERE key=".$db->quote($item["key"]));
143
20893a5442b7 Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents: 139
diff changeset
328 }
20893a5442b7 Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents: 139
diff changeset
329 }
20893a5442b7 Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents: 139
diff changeset
330
20893a5442b7 Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents: 139
diff changeset
331
407
eaea1ae2bc3d Moar work.
Matti Hamalainen <ccr@tnsp.org>
parents: 396
diff changeset
332 function stDisplayUpdated()
eaea1ae2bc3d Moar work.
Matti Hamalainen <ccr@tnsp.org>
parents: 396
diff changeset
333 {
eaea1ae2bc3d Moar work.
Matti Hamalainen <ccr@tnsp.org>
parents: 396
diff changeset
334 stSetDisplayVar("lastUpdate", time());
eaea1ae2bc3d Moar work.
Matti Hamalainen <ccr@tnsp.org>
parents: 396
diff changeset
335 }
eaea1ae2bc3d Moar work.
Matti Hamalainen <ccr@tnsp.org>
parents: 396
diff changeset
336
eaea1ae2bc3d Moar work.
Matti Hamalainen <ccr@tnsp.org>
parents: 396
diff changeset
337
454
ea7fc4e9f602 Moar work.
Matti Hamalainen <ccr@tnsp.org>
parents: 447
diff changeset
338 function stSetDisplayVarUpd($name, $value)
ea7fc4e9f602 Moar work.
Matti Hamalainen <ccr@tnsp.org>
parents: 447
diff changeset
339 {
ea7fc4e9f602 Moar work.
Matti Hamalainen <ccr@tnsp.org>
parents: 447
diff changeset
340 if (stGetDisplayVar($name) != $value)
ea7fc4e9f602 Moar work.
Matti Hamalainen <ccr@tnsp.org>
parents: 447
diff changeset
341 {
ea7fc4e9f602 Moar work.
Matti Hamalainen <ccr@tnsp.org>
parents: 447
diff changeset
342 stSetDisplayVar($name, $value);
ea7fc4e9f602 Moar work.
Matti Hamalainen <ccr@tnsp.org>
parents: 447
diff changeset
343 stDisplayUpdated();
ea7fc4e9f602 Moar work.
Matti Hamalainen <ccr@tnsp.org>
parents: 447
diff changeset
344 return TRUE;
ea7fc4e9f602 Moar work.
Matti Hamalainen <ccr@tnsp.org>
parents: 447
diff changeset
345 }
ea7fc4e9f602 Moar work.
Matti Hamalainen <ccr@tnsp.org>
parents: 447
diff changeset
346 else
ea7fc4e9f602 Moar work.
Matti Hamalainen <ccr@tnsp.org>
parents: 447
diff changeset
347 return FALSE;
ea7fc4e9f602 Moar work.
Matti Hamalainen <ccr@tnsp.org>
parents: 447
diff changeset
348 }
ea7fc4e9f602 Moar work.
Matti Hamalainen <ccr@tnsp.org>
parents: 447
diff changeset
349
ea7fc4e9f602 Moar work.
Matti Hamalainen <ccr@tnsp.org>
parents: 447
diff changeset
350
143
20893a5442b7 Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents: 139
diff changeset
351 function stGetDisplayVar($name)
20893a5442b7 Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents: 139
diff changeset
352 {
20893a5442b7 Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents: 139
diff changeset
353 global $displayVars;
20893a5442b7 Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents: 139
diff changeset
354 if (isset($displayVars[$name]))
20893a5442b7 Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents: 139
diff changeset
355 return $displayVars[$name];
20893a5442b7 Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents: 139
diff changeset
356 else
20893a5442b7 Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents: 139
diff changeset
357 die("No display var for '".$name."'.\n");
20893a5442b7 Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents: 139
diff changeset
358 }
20893a5442b7 Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents: 139
diff changeset
359
20893a5442b7 Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents: 139
diff changeset
360
20893a5442b7 Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents: 139
diff changeset
361 function stSetDisplayVar($name, $value)
20893a5442b7 Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents: 139
diff changeset
362 {
20893a5442b7 Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents: 139
diff changeset
363 global $displayVars, $displayVarsChanged;
20893a5442b7 Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents: 139
diff changeset
364 if (isset($displayVars[$name]))
20893a5442b7 Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents: 139
diff changeset
365 {
20893a5442b7 Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents: 139
diff changeset
366 $displayVars[$name] = $value;
20893a5442b7 Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents: 139
diff changeset
367 $displayVarsChanged[$name] = true;
20893a5442b7 Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents: 139
diff changeset
368 }
20893a5442b7 Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents: 139
diff changeset
369 else
20893a5442b7 Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents: 139
diff changeset
370 die("No display var for '".$name."'.\n");
20893a5442b7 Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents: 139
diff changeset
371 }
20893a5442b7 Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents: 139
diff changeset
372
20893a5442b7 Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents: 139
diff changeset
373
806
59528ba5813a Move stuff around.
Matti Hamalainen <ccr@tnsp.org>
parents: 800
diff changeset
374 //
59528ba5813a Move stuff around.
Matti Hamalainen <ccr@tnsp.org>
parents: 800
diff changeset
375 // Like stExecSQL(), but throws error messages to "userspace".
59528ba5813a Move stuff around.
Matti Hamalainen <ccr@tnsp.org>
parents: 800
diff changeset
376 //
484
c8591a8fadbc Move stExecSQLCond() to site module.
Matti Hamalainen <ccr@tnsp.org>
parents: 459
diff changeset
377 function stExecSQLCond($sql, $msg = FALSE)
c8591a8fadbc Move stExecSQLCond() to site module.
Matti Hamalainen <ccr@tnsp.org>
parents: 459
diff changeset
378 {
c8591a8fadbc Move stExecSQLCond() to site module.
Matti Hamalainen <ccr@tnsp.org>
parents: 459
diff changeset
379 global $db;
c8591a8fadbc Move stExecSQLCond() to site module.
Matti Hamalainen <ccr@tnsp.org>
parents: 459
diff changeset
380 if (($res = stDBExecSQL($db, $sql)) !== FALSE)
c8591a8fadbc Move stExecSQLCond() to site module.
Matti Hamalainen <ccr@tnsp.org>
parents: 459
diff changeset
381 {
c8591a8fadbc Move stExecSQLCond() to site module.
Matti Hamalainen <ccr@tnsp.org>
parents: 459
diff changeset
382 if ($msg !== FALSE)
c8591a8fadbc Move stExecSQLCond() to site module.
Matti Hamalainen <ccr@tnsp.org>
parents: 459
diff changeset
383 stSetStatus(200, $msg);
c8591a8fadbc Move stExecSQLCond() to site module.
Matti Hamalainen <ccr@tnsp.org>
parents: 459
diff changeset
384 return $res;
c8591a8fadbc Move stExecSQLCond() to site module.
Matti Hamalainen <ccr@tnsp.org>
parents: 459
diff changeset
385 }
c8591a8fadbc Move stExecSQLCond() to site module.
Matti Hamalainen <ccr@tnsp.org>
parents: 459
diff changeset
386 else
c8591a8fadbc Move stExecSQLCond() to site module.
Matti Hamalainen <ccr@tnsp.org>
parents: 459
diff changeset
387 {
c8591a8fadbc Move stExecSQLCond() to site module.
Matti Hamalainen <ccr@tnsp.org>
parents: 459
diff changeset
388 stSetStatus(902, "Error in SQL execution.");
c8591a8fadbc Move stExecSQLCond() to site module.
Matti Hamalainen <ccr@tnsp.org>
parents: 459
diff changeset
389 return FALSE;
c8591a8fadbc Move stExecSQLCond() to site module.
Matti Hamalainen <ccr@tnsp.org>
parents: 459
diff changeset
390 }
c8591a8fadbc Move stExecSQLCond() to site module.
Matti Hamalainen <ccr@tnsp.org>
parents: 459
diff changeset
391 }
c8591a8fadbc Move stExecSQLCond() to site module.
Matti Hamalainen <ccr@tnsp.org>
parents: 459
diff changeset
392
c8591a8fadbc Move stExecSQLCond() to site module.
Matti Hamalainen <ccr@tnsp.org>
parents: 459
diff changeset
393
205
77d33161f8be More work on admin interface.
Matti Hamalainen <ccr@tnsp.org>
parents: 184
diff changeset
394 function stPrintAttendee($item, $row, $tr, $full, $edit, $eclass = "")
37
238c73840b61 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 35
diff changeset
395 {
238c73840b61 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 35
diff changeset
396 $id = $item["id"];
238c73840b61 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 35
diff changeset
397 $prefix = "at";
677
64d80a7f7e26 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 674
diff changeset
398
205
77d33161f8be More work on admin interface.
Matti Hamalainen <ccr@tnsp.org>
parents: 184
diff changeset
399 if ($tr)
77d33161f8be More work on admin interface.
Matti Hamalainen <ccr@tnsp.org>
parents: 184
diff changeset
400 {
77d33161f8be More work on admin interface.
Matti Hamalainen <ccr@tnsp.org>
parents: 184
diff changeset
401 echo
77d33161f8be More work on admin interface.
Matti Hamalainen <ccr@tnsp.org>
parents: 184
diff changeset
402 " <tr class=\"".($row % 2 == 1 ? "rodd" : "reven").$eclass.
77d33161f8be More work on admin interface.
Matti Hamalainen <ccr@tnsp.org>
parents: 184
diff changeset
403 "\" id=\"attendee".$id."\" ".($full ? "onClick=\"activateAttendee(".$id.")\"" : "").">";
77d33161f8be More work on admin interface.
Matti Hamalainen <ccr@tnsp.org>
parents: 184
diff changeset
404 }
677
64d80a7f7e26 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 674
diff changeset
405
71
d74fb8cf0062 Adjust attendee output again, we're separating vote keys from there once more. Durr.
Matti Hamalainen <ccr@tnsp.org>
parents: 70
diff changeset
406 echo
679
cbb66cb60930 Rename a function.
Matti Hamalainen <ccr@tnsp.org>
parents: 677
diff changeset
407 stGetTDFormTextInput($edit, 20, SET_LEN_USERNAME, "name", $id, $prefix, $item["name"]).
cbb66cb60930 Rename a function.
Matti Hamalainen <ccr@tnsp.org>
parents: 677
diff changeset
408 stGetTDFormTextInput($edit, 20, SET_LEN_GROUPS, "groups", $id, $prefix, $item["groups"]).
71
d74fb8cf0062 Adjust attendee output again, we're separating vote keys from there once more. Durr.
Matti Hamalainen <ccr@tnsp.org>
parents: 70
diff changeset
409 "<td class=\"regtime\">".date("d.m. H:i", $item["regtime"])."</td>".
679
cbb66cb60930 Rename a function.
Matti Hamalainen <ccr@tnsp.org>
parents: 677
diff changeset
410 stGetTDFormTextInput($edit, 30, SET_LEN_ONELINER, "oneliner", $id, $prefix, $item["oneliner"], "autocomplete=\"off\"");
37
238c73840b61 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 35
diff changeset
411
205
77d33161f8be More work on admin interface.
Matti Hamalainen <ccr@tnsp.org>
parents: 184
diff changeset
412 if ($full)
37
238c73840b61 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 35
diff changeset
413 {
238c73840b61 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 35
diff changeset
414 echo
716
e7fbcf4190e6 Add registration host.
Matti Hamalainen <ccr@tnsp.org>
parents: 703
diff changeset
415 stGetTDFormTextInput($edit, 15, SET_LEN_EMAIL, "email", $id, $prefix, $item["email"], "autocomplete=\"off\"").
e7fbcf4190e6 Add registration host.
Matti Hamalainen <ccr@tnsp.org>
parents: 703
diff changeset
416 stGetTDFormTextInput($edit, 15, SET_LEN_REGHOST, "reghost", $id, $prefix, $item["reghost"], "autocomplete=\"off\"");
205
77d33161f8be More work on admin interface.
Matti Hamalainen <ccr@tnsp.org>
parents: 184
diff changeset
417
77d33161f8be More work on admin interface.
Matti Hamalainen <ccr@tnsp.org>
parents: 184
diff changeset
418 if ($edit)
77d33161f8be More work on admin interface.
Matti Hamalainen <ccr@tnsp.org>
parents: 184
diff changeset
419 {
77d33161f8be More work on admin interface.
Matti Hamalainen <ccr@tnsp.org>
parents: 184
diff changeset
420 echo
77d33161f8be More work on admin interface.
Matti Hamalainen <ccr@tnsp.org>
parents: 184
diff changeset
421 "<td>".
680
c9b96a7b9dc4 Add new helper function and use it.
Matti Hamalainen <ccr@tnsp.org>
parents: 679
diff changeset
422 stGetFormButtonElement($prefix."upd".$id, "","", "Upd", "updateAttendee(".$id.")").
c9b96a7b9dc4 Add new helper function and use it.
Matti Hamalainen <ccr@tnsp.org>
parents: 679
diff changeset
423 stGetFormButtonElement($prefix."del".$id, "","", "Del", "deleteAttendee(".$id.")").
205
77d33161f8be More work on admin interface.
Matti Hamalainen <ccr@tnsp.org>
parents: 184
diff changeset
424 "</td>";
77d33161f8be More work on admin interface.
Matti Hamalainen <ccr@tnsp.org>
parents: 184
diff changeset
425 }
77d33161f8be More work on admin interface.
Matti Hamalainen <ccr@tnsp.org>
parents: 184
diff changeset
426 else
77d33161f8be More work on admin interface.
Matti Hamalainen <ccr@tnsp.org>
parents: 184
diff changeset
427 echo "<td></td>";
37
238c73840b61 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 35
diff changeset
428 }
205
77d33161f8be More work on admin interface.
Matti Hamalainen <ccr@tnsp.org>
parents: 184
diff changeset
429
77d33161f8be More work on admin interface.
Matti Hamalainen <ccr@tnsp.org>
parents: 184
diff changeset
430 if ($tr)
674
3e37a29468bf Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 665
diff changeset
431 echo "</tr>\n";
37
238c73840b61 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 35
diff changeset
432 }
238c73840b61 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 35
diff changeset
433
238c73840b61 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 35
diff changeset
434
222
b236b4d8d7a9 Remove useless code.
Matti Hamalainen <ccr@tnsp.org>
parents: 207
diff changeset
435 function stPrintNewsItem($item)
37
238c73840b61 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 35
diff changeset
436 {
238c73840b61 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 35
diff changeset
437 echo
592
642df17214f6 Improve news item DOM IDs.
Matti Hamalainen <ccr@tnsp.org>
parents: 585
diff changeset
438 "<div class=\"newsItem\" id=\"news".$item["id"]."\">\n".
37
238c73840b61 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 35
diff changeset
439 " <h2>".chentities($item["title"])."</h2>\n".
592
642df17214f6 Improve news item DOM IDs.
Matti Hamalainen <ccr@tnsp.org>
parents: 585
diff changeset
440 " <div class=\"newsText\">".dhentities($item["text"])."</div>\n".
593
3cceb9f13762 And some more tweaking.
Matti Hamalainen <ccr@tnsp.org>
parents: 592
diff changeset
441 " <div class=\"newsAuthor\"><span class=\"newsSig\">-- ".chentities($item["author"])."</span>".
3cceb9f13762 And some more tweaking.
Matti Hamalainen <ccr@tnsp.org>
parents: 592
diff changeset
442 "<span class=\"newsDate\">".date("d M Y / H:i", $item["utime"])."</span></div>\n".
37
238c73840b61 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 35
diff changeset
443 "</div>\n";
238c73840b61 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 35
diff changeset
444 }
238c73840b61 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 35
diff changeset
445
238c73840b61 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 35
diff changeset
446
806
59528ba5813a Move stuff around.
Matti Hamalainen <ccr@tnsp.org>
parents: 800
diff changeset
447 function stGetTDFormTextInput($edit, $size, $len, $name, $id, $prefix, $value, $extra = "")
59528ba5813a Move stuff around.
Matti Hamalainen <ccr@tnsp.org>
parents: 800
diff changeset
448 {
59528ba5813a Move stuff around.
Matti Hamalainen <ccr@tnsp.org>
parents: 800
diff changeset
449 return
59528ba5813a Move stuff around.
Matti Hamalainen <ccr@tnsp.org>
parents: 800
diff changeset
450 "<td class=\"".$name."\">".
59528ba5813a Move stuff around.
Matti Hamalainen <ccr@tnsp.org>
parents: 800
diff changeset
451 ($edit ? stGetFormTextInput($size, $len, $name, $id, $prefix, $value, $extra) : chentities($value)).
59528ba5813a Move stuff around.
Matti Hamalainen <ccr@tnsp.org>
parents: 800
diff changeset
452 "</td>";
59528ba5813a Move stuff around.
Matti Hamalainen <ccr@tnsp.org>
parents: 800
diff changeset
453 }
59528ba5813a Move stuff around.
Matti Hamalainen <ccr@tnsp.org>
parents: 800
diff changeset
454
59528ba5813a Move stuff around.
Matti Hamalainen <ccr@tnsp.org>
parents: 800
diff changeset
455
59528ba5813a Move stuff around.
Matti Hamalainen <ccr@tnsp.org>
parents: 800
diff changeset
456 function stGetEditFormTextInput($mode, $title, $size, $len, $name, $id, $prefix, $value, $extra = "")
59528ba5813a Move stuff around.
Matti Hamalainen <ccr@tnsp.org>
parents: 800
diff changeset
457 {
59528ba5813a Move stuff around.
Matti Hamalainen <ccr@tnsp.org>
parents: 800
diff changeset
458 return
59528ba5813a Move stuff around.
Matti Hamalainen <ccr@tnsp.org>
parents: 800
diff changeset
459 "<div class=\"editControl\"><span class=\"editControlTitle\">".chentities($title)."</span>".
59528ba5813a Move stuff around.
Matti Hamalainen <ccr@tnsp.org>
parents: 800
diff changeset
460 ($mode ? stGetFormTextInput($size, $len, $name, $id, $prefix, $value, $extra) : chentities($value)).
59528ba5813a Move stuff around.
Matti Hamalainen <ccr@tnsp.org>
parents: 800
diff changeset
461 "</div>";
59528ba5813a Move stuff around.
Matti Hamalainen <ccr@tnsp.org>
parents: 800
diff changeset
462 }
59528ba5813a Move stuff around.
Matti Hamalainen <ccr@tnsp.org>
parents: 800
diff changeset
463
59528ba5813a Move stuff around.
Matti Hamalainen <ccr@tnsp.org>
parents: 800
diff changeset
464
59528ba5813a Move stuff around.
Matti Hamalainen <ccr@tnsp.org>
parents: 800
diff changeset
465 function stGetEditFormTextArea($mode, $title, $rows, $cols, $name, $id, $prefix, $value, $extra = "")
59528ba5813a Move stuff around.
Matti Hamalainen <ccr@tnsp.org>
parents: 800
diff changeset
466 {
59528ba5813a Move stuff around.
Matti Hamalainen <ccr@tnsp.org>
parents: 800
diff changeset
467 return
59528ba5813a Move stuff around.
Matti Hamalainen <ccr@tnsp.org>
parents: 800
diff changeset
468 "<div class=\"editControl\"><span class=\"editControlTitle\">".chentities($title)."</span>".
59528ba5813a Move stuff around.
Matti Hamalainen <ccr@tnsp.org>
parents: 800
diff changeset
469 stGetFormTextArea($rows, $cols, $name, $id, $prefix, $value, ($mode ? "" : " disabled=\"disabled\" ").$extra).
59528ba5813a Move stuff around.
Matti Hamalainen <ccr@tnsp.org>
parents: 800
diff changeset
470 "</div>";
59528ba5813a Move stuff around.
Matti Hamalainen <ccr@tnsp.org>
parents: 800
diff changeset
471 }
59528ba5813a Move stuff around.
Matti Hamalainen <ccr@tnsp.org>
parents: 800
diff changeset
472
59528ba5813a Move stuff around.
Matti Hamalainen <ccr@tnsp.org>
parents: 800
diff changeset
473
59528ba5813a Move stuff around.
Matti Hamalainen <ccr@tnsp.org>
parents: 800
diff changeset
474 function stConvSwitchMode(&$str, &$mode, $newMode)
59528ba5813a Move stuff around.
Matti Hamalainen <ccr@tnsp.org>
parents: 800
diff changeset
475 {
59528ba5813a Move stuff around.
Matti Hamalainen <ccr@tnsp.org>
parents: 800
diff changeset
476 if ($newMode != $mode)
59528ba5813a Move stuff around.
Matti Hamalainen <ccr@tnsp.org>
parents: 800
diff changeset
477 {
59528ba5813a Move stuff around.
Matti Hamalainen <ccr@tnsp.org>
parents: 800
diff changeset
478 if ($mode != "")
59528ba5813a Move stuff around.
Matti Hamalainen <ccr@tnsp.org>
parents: 800
diff changeset
479 $str .= "\n</".$mode.">\n";
59528ba5813a Move stuff around.
Matti Hamalainen <ccr@tnsp.org>
parents: 800
diff changeset
480
59528ba5813a Move stuff around.
Matti Hamalainen <ccr@tnsp.org>
parents: 800
diff changeset
481 $mode = $newMode;
59528ba5813a Move stuff around.
Matti Hamalainen <ccr@tnsp.org>
parents: 800
diff changeset
482
59528ba5813a Move stuff around.
Matti Hamalainen <ccr@tnsp.org>
parents: 800
diff changeset
483 if ($mode != "")
59528ba5813a Move stuff around.
Matti Hamalainen <ccr@tnsp.org>
parents: 800
diff changeset
484 $str .= "<".$mode.">\n";
59528ba5813a Move stuff around.
Matti Hamalainen <ccr@tnsp.org>
parents: 800
diff changeset
485 }
59528ba5813a Move stuff around.
Matti Hamalainen <ccr@tnsp.org>
parents: 800
diff changeset
486 }
59528ba5813a Move stuff around.
Matti Hamalainen <ccr@tnsp.org>
parents: 800
diff changeset
487
59528ba5813a Move stuff around.
Matti Hamalainen <ccr@tnsp.org>
parents: 800
diff changeset
488
59528ba5813a Move stuff around.
Matti Hamalainen <ccr@tnsp.org>
parents: 800
diff changeset
489 function stConvertCommonDesc($desc, $chent)
59528ba5813a Move stuff around.
Matti Hamalainen <ccr@tnsp.org>
parents: 800
diff changeset
490 {
59528ba5813a Move stuff around.
Matti Hamalainen <ccr@tnsp.org>
parents: 800
diff changeset
491 $str = "";
59528ba5813a Move stuff around.
Matti Hamalainen <ccr@tnsp.org>
parents: 800
diff changeset
492 $mode = "";
59528ba5813a Move stuff around.
Matti Hamalainen <ccr@tnsp.org>
parents: 800
diff changeset
493
59528ba5813a Move stuff around.
Matti Hamalainen <ccr@tnsp.org>
parents: 800
diff changeset
494 foreach (explode("\n", $desc) as $line)
59528ba5813a Move stuff around.
Matti Hamalainen <ccr@tnsp.org>
parents: 800
diff changeset
495 {
59528ba5813a Move stuff around.
Matti Hamalainen <ccr@tnsp.org>
parents: 800
diff changeset
496 if (preg_match("/^\s*\s*\*(.+)$/", $line, $m))
59528ba5813a Move stuff around.
Matti Hamalainen <ccr@tnsp.org>
parents: 800
diff changeset
497 {
59528ba5813a Move stuff around.
Matti Hamalainen <ccr@tnsp.org>
parents: 800
diff changeset
498 stConvSwitchMode($str, $mode, "ol");
59528ba5813a Move stuff around.
Matti Hamalainen <ccr@tnsp.org>
parents: 800
diff changeset
499 $str .= "<li>".($chent ? chentities($m[1]) : $m[1])."</li>\n";
59528ba5813a Move stuff around.
Matti Hamalainen <ccr@tnsp.org>
parents: 800
diff changeset
500 }
59528ba5813a Move stuff around.
Matti Hamalainen <ccr@tnsp.org>
parents: 800
diff changeset
501 else
59528ba5813a Move stuff around.
Matti Hamalainen <ccr@tnsp.org>
parents: 800
diff changeset
502 if (preg_match("/^\s*-\s*(.+)$/", $line, $m))
59528ba5813a Move stuff around.
Matti Hamalainen <ccr@tnsp.org>
parents: 800
diff changeset
503 {
59528ba5813a Move stuff around.
Matti Hamalainen <ccr@tnsp.org>
parents: 800
diff changeset
504 stConvSwitchMode($str, $mode, "ul");
59528ba5813a Move stuff around.
Matti Hamalainen <ccr@tnsp.org>
parents: 800
diff changeset
505 $str .= "<li>".($chent ? chentities($m[1]) : $m[1])."</li>\n";
59528ba5813a Move stuff around.
Matti Hamalainen <ccr@tnsp.org>
parents: 800
diff changeset
506 }
59528ba5813a Move stuff around.
Matti Hamalainen <ccr@tnsp.org>
parents: 800
diff changeset
507 else
59528ba5813a Move stuff around.
Matti Hamalainen <ccr@tnsp.org>
parents: 800
diff changeset
508 {
59528ba5813a Move stuff around.
Matti Hamalainen <ccr@tnsp.org>
parents: 800
diff changeset
509 stConvSwitchMode($str, $mode, "p");
59528ba5813a Move stuff around.
Matti Hamalainen <ccr@tnsp.org>
parents: 800
diff changeset
510 $str .= ($chent ? chentities($line) : $line);
59528ba5813a Move stuff around.
Matti Hamalainen <ccr@tnsp.org>
parents: 800
diff changeset
511 }
59528ba5813a Move stuff around.
Matti Hamalainen <ccr@tnsp.org>
parents: 800
diff changeset
512 }
59528ba5813a Move stuff around.
Matti Hamalainen <ccr@tnsp.org>
parents: 800
diff changeset
513
59528ba5813a Move stuff around.
Matti Hamalainen <ccr@tnsp.org>
parents: 800
diff changeset
514 stConvSwitchMode($str, $mode, "");
59528ba5813a Move stuff around.
Matti Hamalainen <ccr@tnsp.org>
parents: 800
diff changeset
515
59528ba5813a Move stuff around.
Matti Hamalainen <ccr@tnsp.org>
parents: 800
diff changeset
516 return $str;
59528ba5813a Move stuff around.
Matti Hamalainen <ccr@tnsp.org>
parents: 800
diff changeset
517 }
59528ba5813a Move stuff around.
Matti Hamalainen <ccr@tnsp.org>
parents: 800
diff changeset
518
59528ba5813a Move stuff around.
Matti Hamalainen <ccr@tnsp.org>
parents: 800
diff changeset
519
59528ba5813a Move stuff around.
Matti Hamalainen <ccr@tnsp.org>
parents: 800
diff changeset
520 function stGetNumberSuffix($val)
59528ba5813a Move stuff around.
Matti Hamalainen <ccr@tnsp.org>
parents: 800
diff changeset
521 {
59528ba5813a Move stuff around.
Matti Hamalainen <ccr@tnsp.org>
parents: 800
diff changeset
522 switch ($val)
59528ba5813a Move stuff around.
Matti Hamalainen <ccr@tnsp.org>
parents: 800
diff changeset
523 {
59528ba5813a Move stuff around.
Matti Hamalainen <ccr@tnsp.org>
parents: 800
diff changeset
524 case 1: return "st";
59528ba5813a Move stuff around.
Matti Hamalainen <ccr@tnsp.org>
parents: 800
diff changeset
525 case 2: return "nd";
59528ba5813a Move stuff around.
Matti Hamalainen <ccr@tnsp.org>
parents: 800
diff changeset
526 case 3: return "rd";
59528ba5813a Move stuff around.
Matti Hamalainen <ccr@tnsp.org>
parents: 800
diff changeset
527 case 4: case 5: case 6:
59528ba5813a Move stuff around.
Matti Hamalainen <ccr@tnsp.org>
parents: 800
diff changeset
528 case 7: case 8: case 9: return "th";
59528ba5813a Move stuff around.
Matti Hamalainen <ccr@tnsp.org>
parents: 800
diff changeset
529 default: return "th";
59528ba5813a Move stuff around.
Matti Hamalainen <ccr@tnsp.org>
parents: 800
diff changeset
530 }
59528ba5813a Move stuff around.
Matti Hamalainen <ccr@tnsp.org>
parents: 800
diff changeset
531 }
59528ba5813a Move stuff around.
Matti Hamalainen <ccr@tnsp.org>
parents: 800
diff changeset
532
59528ba5813a Move stuff around.
Matti Hamalainen <ccr@tnsp.org>
parents: 800
diff changeset
533
69
30a4420e85ab stGenerateUserKey() simply returns a generated key now (string) or FALSE if
Matti Hamalainen <ccr@tnsp.org>
parents: 66
diff changeset
534 function stGenerateUserKey()
65
72b22729ae7e Add function for generating vote keys into site lib.
Matti Hamalainen <ccr@tnsp.org>
parents: 53
diff changeset
535 {
69
30a4420e85ab stGenerateUserKey() simply returns a generated key now (string) or FALSE if
Matti Hamalainen <ccr@tnsp.org>
parents: 66
diff changeset
536 global $db;
99
2169c3177f47 Limit the vote key character space even more.
Matti Hamalainen <ccr@tnsp.org>
parents: 94
diff changeset
537 $keyChars = "abdefghjkmnpqrstwxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789";
65
72b22729ae7e Add function for generating vote keys into site lib.
Matti Hamalainen <ccr@tnsp.org>
parents: 53
diff changeset
538
72b22729ae7e Add function for generating vote keys into site lib.
Matti Hamalainen <ccr@tnsp.org>
parents: 53
diff changeset
539 while (TRUE)
72b22729ae7e Add function for generating vote keys into site lib.
Matti Hamalainen <ccr@tnsp.org>
parents: 53
diff changeset
540 {
69
30a4420e85ab stGenerateUserKey() simply returns a generated key now (string) or FALSE if
Matti Hamalainen <ccr@tnsp.org>
parents: 66
diff changeset
541 // Generate one randomized keycode
65
72b22729ae7e Add function for generating vote keys into site lib.
Matti Hamalainen <ccr@tnsp.org>
parents: 53
diff changeset
542 $key = "";
72b22729ae7e Add function for generating vote keys into site lib.
Matti Hamalainen <ccr@tnsp.org>
parents: 53
diff changeset
543 for ($n = 0; $n < stGetSetting("userKeyLength"); $n++)
72b22729ae7e Add function for generating vote keys into site lib.
Matti Hamalainen <ccr@tnsp.org>
parents: 53
diff changeset
544 $key .= $keyChars[rand() % strlen($keyChars)];
72b22729ae7e Add function for generating vote keys into site lib.
Matti Hamalainen <ccr@tnsp.org>
parents: 53
diff changeset
545
72b22729ae7e Add function for generating vote keys into site lib.
Matti Hamalainen <ccr@tnsp.org>
parents: 53
diff changeset
546 // Check if it already exists, to avoid duplicates
69
30a4420e85ab stGenerateUserKey() simply returns a generated key now (string) or FALSE if
Matti Hamalainen <ccr@tnsp.org>
parents: 66
diff changeset
547 // We need custom query code here, because stFetchSQLColumn()
30a4420e85ab stGenerateUserKey() simply returns a generated key now (string) or FALSE if
Matti Hamalainen <ccr@tnsp.org>
parents: 66
diff changeset
548 // won't work due to it returning FALSE in error cases.
87
3da47d3e6a3c Remove a function, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 72
diff changeset
549 $sql = stPrepareSQL("SELECT * FROM votekeys WHERE key=%s", $key);
65
72b22729ae7e Add function for generating vote keys into site lib.
Matti Hamalainen <ccr@tnsp.org>
parents: 53
diff changeset
550 if (($res = @$db->query($sql)) !== FALSE)
72b22729ae7e Add function for generating vote keys into site lib.
Matti Hamalainen <ccr@tnsp.org>
parents: 53
diff changeset
551 {
69
30a4420e85ab stGenerateUserKey() simply returns a generated key now (string) or FALSE if
Matti Hamalainen <ccr@tnsp.org>
parents: 66
diff changeset
552 // Did we get results?
65
72b22729ae7e Add function for generating vote keys into site lib.
Matti Hamalainen <ccr@tnsp.org>
parents: 53
diff changeset
553 if ($res->fetchColumn() === FALSE)
72b22729ae7e Add function for generating vote keys into site lib.
Matti Hamalainen <ccr@tnsp.org>
parents: 53
diff changeset
554 {
69
30a4420e85ab stGenerateUserKey() simply returns a generated key now (string) or FALSE if
Matti Hamalainen <ccr@tnsp.org>
parents: 66
diff changeset
555 // Nope, return key
30a4420e85ab stGenerateUserKey() simply returns a generated key now (string) or FALSE if
Matti Hamalainen <ccr@tnsp.org>
parents: 66
diff changeset
556 return $key;
65
72b22729ae7e Add function for generating vote keys into site lib.
Matti Hamalainen <ccr@tnsp.org>
parents: 53
diff changeset
557 }
72b22729ae7e Add function for generating vote keys into site lib.
Matti Hamalainen <ccr@tnsp.org>
parents: 53
diff changeset
558 }
72b22729ae7e Add function for generating vote keys into site lib.
Matti Hamalainen <ccr@tnsp.org>
parents: 53
diff changeset
559 else
72b22729ae7e Add function for generating vote keys into site lib.
Matti Hamalainen <ccr@tnsp.org>
parents: 53
diff changeset
560 {
72b22729ae7e Add function for generating vote keys into site lib.
Matti Hamalainen <ccr@tnsp.org>
parents: 53
diff changeset
561 stLogSQLError($sql);
72b22729ae7e Add function for generating vote keys into site lib.
Matti Hamalainen <ccr@tnsp.org>
parents: 53
diff changeset
562 return FALSE;
72b22729ae7e Add function for generating vote keys into site lib.
Matti Hamalainen <ccr@tnsp.org>
parents: 53
diff changeset
563 }
72b22729ae7e Add function for generating vote keys into site lib.
Matti Hamalainen <ccr@tnsp.org>
parents: 53
diff changeset
564 }
72b22729ae7e Add function for generating vote keys into site lib.
Matti Hamalainen <ccr@tnsp.org>
parents: 53
diff changeset
565 }
66
230aacc22cb4 Move some functions to site lib.
Matti Hamalainen <ccr@tnsp.org>
parents: 65
diff changeset
566
230aacc22cb4 Move some functions to site lib.
Matti Hamalainen <ccr@tnsp.org>
parents: 65
diff changeset
567
103
c6b9041078ec Add hard limit option for attendees, and add feature of using "0" to disable
Matti Hamalainen <ccr@tnsp.org>
parents: 99
diff changeset
568 function stCheckRegistrationAvailable()
c6b9041078ec Add hard limit option for attendees, and add feature of using "0" to disable
Matti Hamalainen <ccr@tnsp.org>
parents: 99
diff changeset
569 {
c6b9041078ec Add hard limit option for attendees, and add feature of using "0" to disable
Matti Hamalainen <ccr@tnsp.org>
parents: 99
diff changeset
570 global $maxAttendeesHard, $maxAttendeesSoft, $numAttendees;
c6b9041078ec Add hard limit option for attendees, and add feature of using "0" to disable
Matti Hamalainen <ccr@tnsp.org>
parents: 99
diff changeset
571
c6b9041078ec Add hard limit option for attendees, and add feature of using "0" to disable
Matti Hamalainen <ccr@tnsp.org>
parents: 99
diff changeset
572 $maxAttendeesHard = stGetSetting("maxAttendeesHard");
c6b9041078ec Add hard limit option for attendees, and add feature of using "0" to disable
Matti Hamalainen <ccr@tnsp.org>
parents: 99
diff changeset
573 $maxAttendeesSoft = stGetSetting("maxAttendeesSoft");
c6b9041078ec Add hard limit option for attendees, and add feature of using "0" to disable
Matti Hamalainen <ccr@tnsp.org>
parents: 99
diff changeset
574 if (($numAttendees = stFetchSQLColumn("SELECT COUNT(*) FROM attendees")) === FALSE)
c6b9041078ec Add hard limit option for attendees, and add feature of using "0" to disable
Matti Hamalainen <ccr@tnsp.org>
parents: 99
diff changeset
575 $numAttendees = 0;
c6b9041078ec Add hard limit option for attendees, and add feature of using "0" to disable
Matti Hamalainen <ccr@tnsp.org>
parents: 99
diff changeset
576
c6b9041078ec Add hard limit option for attendees, and add feature of using "0" to disable
Matti Hamalainen <ccr@tnsp.org>
parents: 99
diff changeset
577 return stChkSetting("allowRegister") && ($maxAttendeesHard <= 0 || $numAttendees < $maxAttendeesHard);
c6b9041078ec Add hard limit option for attendees, and add feature of using "0" to disable
Matti Hamalainen <ccr@tnsp.org>
parents: 99
diff changeset
578 }
135
eecac02579c4 Move stChop() to site module and rename it to stStrChop().
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
579
eecac02579c4 Move stChop() to site module and rename it to stStrChop().
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
580
646
2eeca16e9c96 Improve attendee adding/updating data validation.
Matti Hamalainen <ccr@tnsp.org>
parents: 641
diff changeset
581 function stValidateRequestUserData($admin, $id = FALSE)
207
e31c42a9b574 Slowly work on input validation.
Matti Hamalainen <ccr@tnsp.org>
parents: 205
diff changeset
582 {
646
2eeca16e9c96 Improve attendee adding/updating data validation.
Matti Hamalainen <ccr@tnsp.org>
parents: 641
diff changeset
583 $res = TRUE;
2eeca16e9c96 Improve attendee adding/updating data validation.
Matti Hamalainen <ccr@tnsp.org>
parents: 641
diff changeset
584 $chk = 0;
207
e31c42a9b574 Slowly work on input validation.
Matti Hamalainen <ccr@tnsp.org>
parents: 205
diff changeset
585
646
2eeca16e9c96 Improve attendee adding/updating data validation.
Matti Hamalainen <ccr@tnsp.org>
parents: 641
diff changeset
586 if (stChkRequestItem("name", $name,
2eeca16e9c96 Improve attendee adding/updating data validation.
Matti Hamalainen <ccr@tnsp.org>
parents: 641
diff changeset
587 array(CHK_ISGT, VT_STR, 0, "Handle / name not given."),
2eeca16e9c96 Improve attendee adding/updating data validation.
Matti Hamalainen <ccr@tnsp.org>
parents: 641
diff changeset
588 array(CHK_LTEQ, VT_STR, SET_LEN_USERNAME, "Handle / name is too long, should be less than ".SET_LEN_USERNAME." characters.")))
2eeca16e9c96 Improve attendee adding/updating data validation.
Matti Hamalainen <ccr@tnsp.org>
parents: 641
diff changeset
589 $chk++;
2eeca16e9c96 Improve attendee adding/updating data validation.
Matti Hamalainen <ccr@tnsp.org>
parents: 641
diff changeset
590 else
2eeca16e9c96 Improve attendee adding/updating data validation.
Matti Hamalainen <ccr@tnsp.org>
parents: 641
diff changeset
591 $res = FALSE;
207
e31c42a9b574 Slowly work on input validation.
Matti Hamalainen <ccr@tnsp.org>
parents: 205
diff changeset
592
646
2eeca16e9c96 Improve attendee adding/updating data validation.
Matti Hamalainen <ccr@tnsp.org>
parents: 641
diff changeset
593 if (stChkRequestItem("groups", $groups,
2eeca16e9c96 Improve attendee adding/updating data validation.
Matti Hamalainen <ccr@tnsp.org>
parents: 641
diff changeset
594 array(CHK_LTEQ, VT_STR, SET_LEN_GROUPS, "Groups are too long, should be less than ".SET_LEN_GROUPS." characters.")))
2eeca16e9c96 Improve attendee adding/updating data validation.
Matti Hamalainen <ccr@tnsp.org>
parents: 641
diff changeset
595 $chk++;
2eeca16e9c96 Improve attendee adding/updating data validation.
Matti Hamalainen <ccr@tnsp.org>
parents: 641
diff changeset
596 else
2eeca16e9c96 Improve attendee adding/updating data validation.
Matti Hamalainen <ccr@tnsp.org>
parents: 641
diff changeset
597 $res = FALSE;
2eeca16e9c96 Improve attendee adding/updating data validation.
Matti Hamalainen <ccr@tnsp.org>
parents: 641
diff changeset
598
2eeca16e9c96 Improve attendee adding/updating data validation.
Matti Hamalainen <ccr@tnsp.org>
parents: 641
diff changeset
599 if (!stChkRequestItem("oneliner", $oneliner,
2eeca16e9c96 Improve attendee adding/updating data validation.
Matti Hamalainen <ccr@tnsp.org>
parents: 641
diff changeset
600 array(CHK_LTEQ, VT_STR, SET_LEN_ONELINER, "Oneliner is too long, should be less than ".SET_LEN_ONELINER." characters.")))
2eeca16e9c96 Improve attendee adding/updating data validation.
Matti Hamalainen <ccr@tnsp.org>
parents: 641
diff changeset
601 $res = FALSE;
207
e31c42a9b574 Slowly work on input validation.
Matti Hamalainen <ccr@tnsp.org>
parents: 205
diff changeset
602
e31c42a9b574 Slowly work on input validation.
Matti Hamalainen <ccr@tnsp.org>
parents: 205
diff changeset
603 $email = stGetRequestItem("email");
e31c42a9b574 Slowly work on input validation.
Matti Hamalainen <ccr@tnsp.org>
parents: 205
diff changeset
604 if (!$admin && stGetSetting("requireEMail") && strlen($email) < 4)
e31c42a9b574 Slowly work on input validation.
Matti Hamalainen <ccr@tnsp.org>
parents: 205
diff changeset
605 {
e31c42a9b574 Slowly work on input validation.
Matti Hamalainen <ccr@tnsp.org>
parents: 205
diff changeset
606 stError("E-mail address not given, or it is too short.");
646
2eeca16e9c96 Improve attendee adding/updating data validation.
Matti Hamalainen <ccr@tnsp.org>
parents: 641
diff changeset
607 $res = FALSE;
207
e31c42a9b574 Slowly work on input validation.
Matti Hamalainen <ccr@tnsp.org>
parents: 205
diff changeset
608 }
e31c42a9b574 Slowly work on input validation.
Matti Hamalainen <ccr@tnsp.org>
parents: 205
diff changeset
609
605
f928b0a6e1af Better validation for e-mail addresses.
Matti Hamalainen <ccr@tnsp.org>
parents: 598
diff changeset
610 if (strlen($email) > 0 && preg_match("/^[a-z0-9][a-z0-9\+\-\.\%_]*@[a-z0-9.-]+\.[a-z]{2,4}$/i", $email) != 1)
207
e31c42a9b574 Slowly work on input validation.
Matti Hamalainen <ccr@tnsp.org>
parents: 205
diff changeset
611 {
e31c42a9b574 Slowly work on input validation.
Matti Hamalainen <ccr@tnsp.org>
parents: 205
diff changeset
612 stError("E-mail address not in proper format.");
646
2eeca16e9c96 Improve attendee adding/updating data validation.
Matti Hamalainen <ccr@tnsp.org>
parents: 641
diff changeset
613 $res = FALSE;
207
e31c42a9b574 Slowly work on input validation.
Matti Hamalainen <ccr@tnsp.org>
parents: 205
diff changeset
614 }
e31c42a9b574 Slowly work on input validation.
Matti Hamalainen <ccr@tnsp.org>
parents: 205
diff changeset
615
e31c42a9b574 Slowly work on input validation.
Matti Hamalainen <ccr@tnsp.org>
parents: 205
diff changeset
616 if (strlen($email) > SET_LEN_EMAIL)
e31c42a9b574 Slowly work on input validation.
Matti Hamalainen <ccr@tnsp.org>
parents: 205
diff changeset
617 {
e31c42a9b574 Slowly work on input validation.
Matti Hamalainen <ccr@tnsp.org>
parents: 205
diff changeset
618 stError("E-mail address too long, max ".SET_LEN_EMAIL." characters.");
646
2eeca16e9c96 Improve attendee adding/updating data validation.
Matti Hamalainen <ccr@tnsp.org>
parents: 641
diff changeset
619 $res = FALSE;
2eeca16e9c96 Improve attendee adding/updating data validation.
Matti Hamalainen <ccr@tnsp.org>
parents: 641
diff changeset
620 }
2eeca16e9c96 Improve attendee adding/updating data validation.
Matti Hamalainen <ccr@tnsp.org>
parents: 641
diff changeset
621
2eeca16e9c96 Improve attendee adding/updating data validation.
Matti Hamalainen <ccr@tnsp.org>
parents: 641
diff changeset
622 // Check if another user already exists
2eeca16e9c96 Improve attendee adding/updating data validation.
Matti Hamalainen <ccr@tnsp.org>
parents: 641
diff changeset
623 if ($chk >= 2)
2eeca16e9c96 Improve attendee adding/updating data validation.
Matti Hamalainen <ccr@tnsp.org>
parents: 641
diff changeset
624 {
2eeca16e9c96 Improve attendee adding/updating data validation.
Matti Hamalainen <ccr@tnsp.org>
parents: 641
diff changeset
625 if ($id !== false)
2eeca16e9c96 Improve attendee adding/updating data validation.
Matti Hamalainen <ccr@tnsp.org>
parents: 641
diff changeset
626 // By another ID, if we are updating an entry
647
60b51ab059da Oops, forgot an AND from one SQL clause.
Matti Hamalainen <ccr@tnsp.org>
parents: 646
diff changeset
627 $sql = stPrepareSQL("SELECT * FROM attendees WHERE id<>%d AND name=%s AND groups=%s", $id, $name, $groups);
646
2eeca16e9c96 Improve attendee adding/updating data validation.
Matti Hamalainen <ccr@tnsp.org>
parents: 641
diff changeset
628 else
2eeca16e9c96 Improve attendee adding/updating data validation.
Matti Hamalainen <ccr@tnsp.org>
parents: 641
diff changeset
629 // Or just exists, if adding
2eeca16e9c96 Improve attendee adding/updating data validation.
Matti Hamalainen <ccr@tnsp.org>
parents: 641
diff changeset
630 $sql = stPrepareSQL("SELECT * FROM attendees WHERE name=%s AND groups=%s", $name, $groups);
2eeca16e9c96 Improve attendee adding/updating data validation.
Matti Hamalainen <ccr@tnsp.org>
parents: 641
diff changeset
631
648
9e4b8df65879 Oops, fix a 10L.
Matti Hamalainen <ccr@tnsp.org>
parents: 647
diff changeset
632 if (($data = stFetchSQL($sql)) !== false)
646
2eeca16e9c96 Improve attendee adding/updating data validation.
Matti Hamalainen <ccr@tnsp.org>
parents: 641
diff changeset
633 {
2eeca16e9c96 Improve attendee adding/updating data validation.
Matti Hamalainen <ccr@tnsp.org>
parents: 641
diff changeset
634 stError("Someone with the same name and groups is already registered.");
2eeca16e9c96 Improve attendee adding/updating data validation.
Matti Hamalainen <ccr@tnsp.org>
parents: 641
diff changeset
635 $res = FALSE;
2eeca16e9c96 Improve attendee adding/updating data validation.
Matti Hamalainen <ccr@tnsp.org>
parents: 641
diff changeset
636 }
207
e31c42a9b574 Slowly work on input validation.
Matti Hamalainen <ccr@tnsp.org>
parents: 205
diff changeset
637 }
646
2eeca16e9c96 Improve attendee adding/updating data validation.
Matti Hamalainen <ccr@tnsp.org>
parents: 641
diff changeset
638 return $res;
648
9e4b8df65879 Oops, fix a 10L.
Matti Hamalainen <ccr@tnsp.org>
parents: 647
diff changeset
639
207
e31c42a9b574 Slowly work on input validation.
Matti Hamalainen <ccr@tnsp.org>
parents: 205
diff changeset
640 }
e31c42a9b574 Slowly work on input validation.
Matti Hamalainen <ccr@tnsp.org>
parents: 205
diff changeset
641
e31c42a9b574 Slowly work on input validation.
Matti Hamalainen <ccr@tnsp.org>
parents: 205
diff changeset
642
792
b42b23073209 Improve printing of results with more options (in the admin interface).
Matti Hamalainen <ccr@tnsp.org>
parents: 785
diff changeset
643 function stGetCompoResultsSQL($mode, $compo, $flags)
531
ec30ad303bd1 Modularize.
Matti Hamalainen <ccr@tnsp.org>
parents: 528
diff changeset
644 {
623
8e6331d7870d Some work on compo type handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 606
diff changeset
645 //
8e6331d7870d Some work on compo type handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 606
diff changeset
646 // Act based on competition type
8e6331d7870d Some work on compo type handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 606
diff changeset
647 //
640
c78e11aa3162 Rename a database field, so that it does not conflict with AJAX request item
Matti Hamalainen <ccr@tnsp.org>
parents: 637
diff changeset
648 switch ($compo["ctype"])
531
ec30ad303bd1 Modularize.
Matti Hamalainen <ccr@tnsp.org>
parents: 528
diff changeset
649 {
623
8e6331d7870d Some work on compo type handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 606
diff changeset
650 case COMPO_NORMAL:
8e6331d7870d Some work on compo type handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 606
diff changeset
651 //
8e6331d7870d Some work on compo type handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 606
diff changeset
652 // "Normal" competition, where results are somehow
8e6331d7870d Some work on compo type handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 606
diff changeset
653 // based on points / voting.
8e6331d7870d Some work on compo type handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 606
diff changeset
654 //
8e6331d7870d Some work on compo type handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 606
diff changeset
655 switch ($mode)
8e6331d7870d Some work on compo type handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 606
diff changeset
656 {
8e6331d7870d Some work on compo type handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 606
diff changeset
657 case VOTE_FREELY:
8e6331d7870d Some work on compo type handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 606
diff changeset
658 $sql =
8e6331d7870d Some work on compo type handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 606
diff changeset
659 "SELECT entries.*,SUM(votes.value) AS votesum ".
8e6331d7870d Some work on compo type handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 606
diff changeset
660 "FROM entries ".
8e6331d7870d Some work on compo type handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 606
diff changeset
661 "LEFT JOIN votes ON votes.entry_id=entries.id";
8e6331d7870d Some work on compo type handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 606
diff changeset
662 break;
8e6331d7870d Some work on compo type handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 606
diff changeset
663
8e6331d7870d Some work on compo type handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 606
diff changeset
664 case VOTE_ACTIVATE:
8e6331d7870d Some work on compo type handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 606
diff changeset
665 $sql =
8e6331d7870d Some work on compo type handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 606
diff changeset
666 "SELECT entries.*, ".
8e6331d7870d Some work on compo type handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 606
diff changeset
667 "(SELECT SUM(votes.value) FROM votes ".
8e6331d7870d Some work on compo type handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 606
diff changeset
668 "LEFT JOIN votekeys ON votes.key_id=votekeys.id ".
8e6331d7870d Some work on compo type handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 606
diff changeset
669 "WHERE votes.entry_id=entries.id AND votekeys.active<>0) ".
8e6331d7870d Some work on compo type handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 606
diff changeset
670 "AS votesum ".
8e6331d7870d Some work on compo type handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 606
diff changeset
671 "FROM entries";
8e6331d7870d Some work on compo type handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 606
diff changeset
672 break;
8e6331d7870d Some work on compo type handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 606
diff changeset
673
8e6331d7870d Some work on compo type handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 606
diff changeset
674 case VOTE_ASSIGN:
8e6331d7870d Some work on compo type handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 606
diff changeset
675 $sql =
8e6331d7870d Some work on compo type handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 606
diff changeset
676 "SELECT entries.*, ".
8e6331d7870d Some work on compo type handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 606
diff changeset
677 "(SELECT SUM(votes.value) FROM votes ".
8e6331d7870d Some work on compo type handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 606
diff changeset
678 "LEFT JOIN votekeys ON votes.key_id=votekeys.id ".
8e6331d7870d Some work on compo type handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 606
diff changeset
679 "LEFT JOIN attendees ON votekeys.id=attendees.key_id ".
8e6331d7870d Some work on compo type handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 606
diff changeset
680 "WHERE votes.entry_id=entries.id AND attendees.key_id<>0) ".
8e6331d7870d Some work on compo type handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 606
diff changeset
681 "AS votesum ".
8e6331d7870d Some work on compo type handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 606
diff changeset
682 "FROM entries";
8e6331d7870d Some work on compo type handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 606
diff changeset
683 break;
8e6331d7870d Some work on compo type handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 606
diff changeset
684 }
8e6331d7870d Some work on compo type handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 606
diff changeset
685
8e6331d7870d Some work on compo type handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 606
diff changeset
686 $extra =
8e6331d7870d Some work on compo type handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 606
diff changeset
687 "GROUP BY entries.id ".
8e6331d7870d Some work on compo type handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 606
diff changeset
688 "ORDER BY votesum DESC";
531
ec30ad303bd1 Modularize.
Matti Hamalainen <ccr@tnsp.org>
parents: 528
diff changeset
689 break;
ec30ad303bd1 Modularize.
Matti Hamalainen <ccr@tnsp.org>
parents: 528
diff changeset
690
623
8e6331d7870d Some work on compo type handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 606
diff changeset
691 case COMPO_POINTS:
8e6331d7870d Some work on compo type handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 606
diff changeset
692 //
695
dff9b125f774 Work on results printing and remove "show authors" option as it is rather
Matti Hamalainen <ccr@tnsp.org>
parents: 690
diff changeset
693 // Points ..
623
8e6331d7870d Some work on compo type handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 606
diff changeset
694 //
724
fd84eb4d8b74 Refactor compo results code for modularity.
Matti Hamalainen <ccr@tnsp.org>
parents: 721
diff changeset
695 $sql = "SELECT entries.*,entries.evalue AS votesum FROM entries";
623
8e6331d7870d Some work on compo type handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 606
diff changeset
696 $extra = "ORDER BY entries.evalue DESC";
531
ec30ad303bd1 Modularize.
Matti Hamalainen <ccr@tnsp.org>
parents: 528
diff changeset
697 break;
695
dff9b125f774 Work on results printing and remove "show authors" option as it is rather
Matti Hamalainen <ccr@tnsp.org>
parents: 690
diff changeset
698
dff9b125f774 Work on results printing and remove "show authors" option as it is rather
Matti Hamalainen <ccr@tnsp.org>
parents: 690
diff changeset
699 case COMPO_ASSIGN:
dff9b125f774 Work on results printing and remove "show authors" option as it is rather
Matti Hamalainen <ccr@tnsp.org>
parents: 690
diff changeset
700 //
dff9b125f774 Work on results printing and remove "show authors" option as it is rather
Matti Hamalainen <ccr@tnsp.org>
parents: 690
diff changeset
701 // Ascending
dff9b125f774 Work on results printing and remove "show authors" option as it is rather
Matti Hamalainen <ccr@tnsp.org>
parents: 690
diff changeset
702 //
724
fd84eb4d8b74 Refactor compo results code for modularity.
Matti Hamalainen <ccr@tnsp.org>
parents: 721
diff changeset
703 $sql = "SELECT entries.*,entries.evalue AS votesum FROM entries";
695
dff9b125f774 Work on results printing and remove "show authors" option as it is rather
Matti Hamalainen <ccr@tnsp.org>
parents: 690
diff changeset
704 $extra = "ORDER BY entries.evalue ASC";
dff9b125f774 Work on results printing and remove "show authors" option as it is rather
Matti Hamalainen <ccr@tnsp.org>
parents: 690
diff changeset
705 break;
531
ec30ad303bd1 Modularize.
Matti Hamalainen <ccr@tnsp.org>
parents: 528
diff changeset
706 }
ec30ad303bd1 Modularize.
Matti Hamalainen <ccr@tnsp.org>
parents: 528
diff changeset
707
623
8e6331d7870d Some work on compo type handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 606
diff changeset
708 return $sql." ".
606
3d2b70fbeb78 Slight cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 605
diff changeset
709 "WHERE entries.compo_id=".$compo["id"]." ".
792
b42b23073209 Improve printing of results with more options (in the admin interface).
Matti Hamalainen <ccr@tnsp.org>
parents: 785
diff changeset
710 (($flags & RFLAG_DISQUALIFIED) ? "" : "AND (entries.flags & ".EFLAG_DISQUALIFIED.")=0 ").
623
8e6331d7870d Some work on compo type handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 606
diff changeset
711 $extra;
531
ec30ad303bd1 Modularize.
Matti Hamalainen <ccr@tnsp.org>
parents: 528
diff changeset
712 }
ec30ad303bd1 Modularize.
Matti Hamalainen <ccr@tnsp.org>
parents: 528
diff changeset
713
ec30ad303bd1 Modularize.
Matti Hamalainen <ccr@tnsp.org>
parents: 528
diff changeset
714
792
b42b23073209 Improve printing of results with more options (in the admin interface).
Matti Hamalainen <ccr@tnsp.org>
parents: 785
diff changeset
715 function stGetCompoResults($flags)
724
fd84eb4d8b74 Refactor compo results code for modularity.
Matti Hamalainen <ccr@tnsp.org>
parents: 721
diff changeset
716 {
fd84eb4d8b74 Refactor compo results code for modularity.
Matti Hamalainen <ccr@tnsp.org>
parents: 721
diff changeset
717 $voteKeyMode = stGetSetting("voteKeyMode");
fd84eb4d8b74 Refactor compo results code for modularity.
Matti Hamalainen <ccr@tnsp.org>
parents: 721
diff changeset
718 $out = array();
792
b42b23073209 Improve printing of results with more options (in the admin interface).
Matti Hamalainen <ccr@tnsp.org>
parents: 785
diff changeset
719 $sql = "SELECT * FROM compos ".(($flags & RFLAG_HIDDEN_COMPOS) ? "" : "WHERE visible<>0 ")."ORDER BY name DESC";
724
fd84eb4d8b74 Refactor compo results code for modularity.
Matti Hamalainen <ccr@tnsp.org>
parents: 721
diff changeset
720 if (($res = stExecSQL($sql)) === false)
fd84eb4d8b74 Refactor compo results code for modularity.
Matti Hamalainen <ccr@tnsp.org>
parents: 721
diff changeset
721 return $out;
fd84eb4d8b74 Refactor compo results code for modularity.
Matti Hamalainen <ccr@tnsp.org>
parents: 721
diff changeset
722
fd84eb4d8b74 Refactor compo results code for modularity.
Matti Hamalainen <ccr@tnsp.org>
parents: 721
diff changeset
723 // For each compo that has been set visible
fd84eb4d8b74 Refactor compo results code for modularity.
Matti Hamalainen <ccr@tnsp.org>
parents: 721
diff changeset
724 foreach ($res as $compo)
fd84eb4d8b74 Refactor compo results code for modularity.
Matti Hamalainen <ccr@tnsp.org>
parents: 721
diff changeset
725 {
fd84eb4d8b74 Refactor compo results code for modularity.
Matti Hamalainen <ccr@tnsp.org>
parents: 721
diff changeset
726 // Check if there are any entries for it
fd84eb4d8b74 Refactor compo results code for modularity.
Matti Hamalainen <ccr@tnsp.org>
parents: 721
diff changeset
727 $sql =
fd84eb4d8b74 Refactor compo results code for modularity.
Matti Hamalainen <ccr@tnsp.org>
parents: 721
diff changeset
728 "SELECT COUNT(*) FROM entries ".
792
b42b23073209 Improve printing of results with more options (in the admin interface).
Matti Hamalainen <ccr@tnsp.org>
parents: 785
diff changeset
729 "WHERE compo_id=".$compo["id"].
b42b23073209 Improve printing of results with more options (in the admin interface).
Matti Hamalainen <ccr@tnsp.org>
parents: 785
diff changeset
730 (($flags & RFLAG_DISQUALIFIED) ? "" : " AND (entries.flags & ".EFLAG_DISQUALIFIED.")=0");
724
fd84eb4d8b74 Refactor compo results code for modularity.
Matti Hamalainen <ccr@tnsp.org>
parents: 721
diff changeset
731
798
b97d4b754bc0 Show also empty compos with RFLAG_HIDDEN_COMPOS.
Matti Hamalainen <ccr@tnsp.org>
parents: 797
diff changeset
732 if (($nentries = stFetchSQLColumn($sql)) !== FALSE &&
b97d4b754bc0 Show also empty compos with RFLAG_HIDDEN_COMPOS.
Matti Hamalainen <ccr@tnsp.org>
parents: 797
diff changeset
733 ($nentries > 0 || ($flags & RFLAG_HIDDEN_COMPOS)))
724
fd84eb4d8b74 Refactor compo results code for modularity.
Matti Hamalainen <ccr@tnsp.org>
parents: 721
diff changeset
734 {
fd84eb4d8b74 Refactor compo results code for modularity.
Matti Hamalainen <ccr@tnsp.org>
parents: 721
diff changeset
735 // Get voting results by mode
792
b42b23073209 Improve printing of results with more options (in the admin interface).
Matti Hamalainen <ccr@tnsp.org>
parents: 785
diff changeset
736 $sql = stGetCompoResultsSQL($voteKeyMode, $compo, $flags);
724
fd84eb4d8b74 Refactor compo results code for modularity.
Matti Hamalainen <ccr@tnsp.org>
parents: 721
diff changeset
737
fd84eb4d8b74 Refactor compo results code for modularity.
Matti Hamalainen <ccr@tnsp.org>
parents: 721
diff changeset
738 $out[$compo["id"]] = $compo;
fd84eb4d8b74 Refactor compo results code for modularity.
Matti Hamalainen <ccr@tnsp.org>
parents: 721
diff changeset
739 $out[$compo["id"]]["results"] = array();
fd84eb4d8b74 Refactor compo results code for modularity.
Matti Hamalainen <ccr@tnsp.org>
parents: 721
diff changeset
740 $prev = FALSE;
fd84eb4d8b74 Refactor compo results code for modularity.
Matti Hamalainen <ccr@tnsp.org>
parents: 721
diff changeset
741 $index = 0;
fd84eb4d8b74 Refactor compo results code for modularity.
Matti Hamalainen <ccr@tnsp.org>
parents: 721
diff changeset
742
fd84eb4d8b74 Refactor compo results code for modularity.
Matti Hamalainen <ccr@tnsp.org>
parents: 721
diff changeset
743 foreach (stExecSQL($sql) as $entry)
fd84eb4d8b74 Refactor compo results code for modularity.
Matti Hamalainen <ccr@tnsp.org>
parents: 721
diff changeset
744 {
fd84eb4d8b74 Refactor compo results code for modularity.
Matti Hamalainen <ccr@tnsp.org>
parents: 721
diff changeset
745 if ($entry["votesum"] !== $prev)
fd84eb4d8b74 Refactor compo results code for modularity.
Matti Hamalainen <ccr@tnsp.org>
parents: 721
diff changeset
746 $index++;
fd84eb4d8b74 Refactor compo results code for modularity.
Matti Hamalainen <ccr@tnsp.org>
parents: 721
diff changeset
747
fd84eb4d8b74 Refactor compo results code for modularity.
Matti Hamalainen <ccr@tnsp.org>
parents: 721
diff changeset
748 $entry["position"] = $index;
fd84eb4d8b74 Refactor compo results code for modularity.
Matti Hamalainen <ccr@tnsp.org>
parents: 721
diff changeset
749 $out[$compo["id"]]["results"][] = $entry;
fd84eb4d8b74 Refactor compo results code for modularity.
Matti Hamalainen <ccr@tnsp.org>
parents: 721
diff changeset
750
fd84eb4d8b74 Refactor compo results code for modularity.
Matti Hamalainen <ccr@tnsp.org>
parents: 721
diff changeset
751 $prev = $entry["votesum"];
fd84eb4d8b74 Refactor compo results code for modularity.
Matti Hamalainen <ccr@tnsp.org>
parents: 721
diff changeset
752 }
fd84eb4d8b74 Refactor compo results code for modularity.
Matti Hamalainen <ccr@tnsp.org>
parents: 721
diff changeset
753 }
fd84eb4d8b74 Refactor compo results code for modularity.
Matti Hamalainen <ccr@tnsp.org>
parents: 721
diff changeset
754 }
fd84eb4d8b74 Refactor compo results code for modularity.
Matti Hamalainen <ccr@tnsp.org>
parents: 721
diff changeset
755
fd84eb4d8b74 Refactor compo results code for modularity.
Matti Hamalainen <ccr@tnsp.org>
parents: 721
diff changeset
756 return $out;
fd84eb4d8b74 Refactor compo results code for modularity.
Matti Hamalainen <ccr@tnsp.org>
parents: 721
diff changeset
757 }
fd84eb4d8b74 Refactor compo results code for modularity.
Matti Hamalainen <ccr@tnsp.org>
parents: 721
diff changeset
758
fd84eb4d8b74 Refactor compo results code for modularity.
Matti Hamalainen <ccr@tnsp.org>
parents: 721
diff changeset
759
695
dff9b125f774 Work on results printing and remove "show authors" option as it is rather
Matti Hamalainen <ccr@tnsp.org>
parents: 690
diff changeset
760 function stGetCompoResultLine($html, $entry, $points, $showAuthor)
dff9b125f774 Work on results printing and remove "show authors" option as it is rather
Matti Hamalainen <ccr@tnsp.org>
parents: 690
diff changeset
761 {
dff9b125f774 Work on results printing and remove "show authors" option as it is rather
Matti Hamalainen <ccr@tnsp.org>
parents: 690
diff changeset
762 $name = stStrChopPad($entry["name"], 30);
dff9b125f774 Work on results printing and remove "show authors" option as it is rather
Matti Hamalainen <ccr@tnsp.org>
parents: 690
diff changeset
763 $author = stStrChopPad($entry["author"], 30);
dff9b125f774 Work on results printing and remove "show authors" option as it is rather
Matti Hamalainen <ccr@tnsp.org>
parents: 690
diff changeset
764
dff9b125f774 Work on results printing and remove "show authors" option as it is rather
Matti Hamalainen <ccr@tnsp.org>
parents: 690
diff changeset
765 $out = sprintf(" %s", $html ? chentities($name) : $name);
dff9b125f774 Work on results printing and remove "show authors" option as it is rather
Matti Hamalainen <ccr@tnsp.org>
parents: 690
diff changeset
766
792
b42b23073209 Improve printing of results with more options (in the admin interface).
Matti Hamalainen <ccr@tnsp.org>
parents: 785
diff changeset
767 // Author?
695
dff9b125f774 Work on results printing and remove "show authors" option as it is rather
Matti Hamalainen <ccr@tnsp.org>
parents: 690
diff changeset
768 if ($showAuthor)
dff9b125f774 Work on results printing and remove "show authors" option as it is rather
Matti Hamalainen <ccr@tnsp.org>
parents: 690
diff changeset
769 $out .= sprintf(" by %s", $html ? chentities($author) : $author);
dff9b125f774 Work on results printing and remove "show authors" option as it is rather
Matti Hamalainen <ccr@tnsp.org>
parents: 690
diff changeset
770
792
b42b23073209 Improve printing of results with more options (in the admin interface).
Matti Hamalainen <ccr@tnsp.org>
parents: 785
diff changeset
771 // Points?
698
3f322be347d6 Fix the results display.
Matti Hamalainen <ccr@tnsp.org>
parents: 697
diff changeset
772 if ($points !== FALSE)
695
dff9b125f774 Work on results printing and remove "show authors" option as it is rather
Matti Hamalainen <ccr@tnsp.org>
parents: 690
diff changeset
773 $out .= sprintf(" (%d pts)", $points);
dff9b125f774 Work on results printing and remove "show authors" option as it is rather
Matti Hamalainen <ccr@tnsp.org>
parents: 690
diff changeset
774
792
b42b23073209 Improve printing of results with more options (in the admin interface).
Matti Hamalainen <ccr@tnsp.org>
parents: 785
diff changeset
775 // Add disqualified flag etc.
b42b23073209 Improve printing of results with more options (in the admin interface).
Matti Hamalainen <ccr@tnsp.org>
parents: 785
diff changeset
776 if ($entry["flags"] & EFLAG_DISQUALIFIED)
b42b23073209 Improve printing of results with more options (in the admin interface).
Matti Hamalainen <ccr@tnsp.org>
parents: 785
diff changeset
777 $out .= " [DISQ]";
b42b23073209 Improve printing of results with more options (in the admin interface).
Matti Hamalainen <ccr@tnsp.org>
parents: 785
diff changeset
778
695
dff9b125f774 Work on results printing and remove "show authors" option as it is rather
Matti Hamalainen <ccr@tnsp.org>
parents: 690
diff changeset
779 return $out."\n";
dff9b125f774 Work on results printing and remove "show authors" option as it is rather
Matti Hamalainen <ccr@tnsp.org>
parents: 690
diff changeset
780 }
dff9b125f774 Work on results printing and remove "show authors" option as it is rather
Matti Hamalainen <ccr@tnsp.org>
parents: 690
diff changeset
781
dff9b125f774 Work on results printing and remove "show authors" option as it is rather
Matti Hamalainen <ccr@tnsp.org>
parents: 690
diff changeset
782
792
b42b23073209 Improve printing of results with more options (in the admin interface).
Matti Hamalainen <ccr@tnsp.org>
parents: 785
diff changeset
783 function stGetCompoResultsASCIIStr($html, $flags)
511
6fe66ea0e954 Move most of the results code to site module, remove the support for HTML
Matti Hamalainen <ccr@tnsp.org>
parents: 508
diff changeset
784 {
6fe66ea0e954 Move most of the results code to site module, remove the support for HTML
Matti Hamalainen <ccr@tnsp.org>
parents: 508
diff changeset
785 $out = "";
792
b42b23073209 Improve printing of results with more options (in the admin interface).
Matti Hamalainen <ccr@tnsp.org>
parents: 785
diff changeset
786 foreach (stGetCompoResults($flags) as $compo)
511
6fe66ea0e954 Move most of the results code to site module, remove the support for HTML
Matti Hamalainen <ccr@tnsp.org>
parents: 508
diff changeset
787 {
724
fd84eb4d8b74 Refactor compo results code for modularity.
Matti Hamalainen <ccr@tnsp.org>
parents: 721
diff changeset
788 // Output compo title / header
fd84eb4d8b74 Refactor compo results code for modularity.
Matti Hamalainen <ccr@tnsp.org>
parents: 721
diff changeset
789 if ($html)
511
6fe66ea0e954 Move most of the results code to site module, remove the support for HTML
Matti Hamalainen <ccr@tnsp.org>
parents: 508
diff changeset
790 {
724
fd84eb4d8b74 Refactor compo results code for modularity.
Matti Hamalainen <ccr@tnsp.org>
parents: 721
diff changeset
791 $out .=
fd84eb4d8b74 Refactor compo results code for modularity.
Matti Hamalainen <ccr@tnsp.org>
parents: 721
diff changeset
792 "<pre>\n".
fd84eb4d8b74 Refactor compo results code for modularity.
Matti Hamalainen <ccr@tnsp.org>
parents: 721
diff changeset
793 "<b> ".chentities($compo["name"])." </b>\n".
fd84eb4d8b74 Refactor compo results code for modularity.
Matti Hamalainen <ccr@tnsp.org>
parents: 721
diff changeset
794 str_repeat("=", strlen($compo["name"]) + 2)."-- - .\n\n";
fd84eb4d8b74 Refactor compo results code for modularity.
Matti Hamalainen <ccr@tnsp.org>
parents: 721
diff changeset
795 }
fd84eb4d8b74 Refactor compo results code for modularity.
Matti Hamalainen <ccr@tnsp.org>
parents: 721
diff changeset
796 else
fd84eb4d8b74 Refactor compo results code for modularity.
Matti Hamalainen <ccr@tnsp.org>
parents: 721
diff changeset
797 {
fd84eb4d8b74 Refactor compo results code for modularity.
Matti Hamalainen <ccr@tnsp.org>
parents: 721
diff changeset
798 $out .=
fd84eb4d8b74 Refactor compo results code for modularity.
Matti Hamalainen <ccr@tnsp.org>
parents: 721
diff changeset
799 " ".$compo["name"]."\n".
fd84eb4d8b74 Refactor compo results code for modularity.
Matti Hamalainen <ccr@tnsp.org>
parents: 721
diff changeset
800 str_repeat("=", strlen($compo["name"]) + 2)."-- - .\n\n";
fd84eb4d8b74 Refactor compo results code for modularity.
Matti Hamalainen <ccr@tnsp.org>
parents: 721
diff changeset
801 }
511
6fe66ea0e954 Move most of the results code to site module, remove the support for HTML
Matti Hamalainen <ccr@tnsp.org>
parents: 508
diff changeset
802
724
fd84eb4d8b74 Refactor compo results code for modularity.
Matti Hamalainen <ccr@tnsp.org>
parents: 721
diff changeset
803 // List results for this compo
fd84eb4d8b74 Refactor compo results code for modularity.
Matti Hamalainen <ccr@tnsp.org>
parents: 721
diff changeset
804 $prev = FALSE;
fd84eb4d8b74 Refactor compo results code for modularity.
Matti Hamalainen <ccr@tnsp.org>
parents: 721
diff changeset
805 foreach ($compo["results"] as $entry)
fd84eb4d8b74 Refactor compo results code for modularity.
Matti Hamalainen <ccr@tnsp.org>
parents: 721
diff changeset
806 {
fd84eb4d8b74 Refactor compo results code for modularity.
Matti Hamalainen <ccr@tnsp.org>
parents: 721
diff changeset
807 if ($entry["position"] !== $prev)
fd84eb4d8b74 Refactor compo results code for modularity.
Matti Hamalainen <ccr@tnsp.org>
parents: 721
diff changeset
808 $out .= sprintf("%3d%s.", $entry["position"], stGetNumberSuffix($entry["position"]));
fd84eb4d8b74 Refactor compo results code for modularity.
Matti Hamalainen <ccr@tnsp.org>
parents: 721
diff changeset
809 else
fd84eb4d8b74 Refactor compo results code for modularity.
Matti Hamalainen <ccr@tnsp.org>
parents: 721
diff changeset
810 $out .= " -''-";
511
6fe66ea0e954 Move most of the results code to site module, remove the support for HTML
Matti Hamalainen <ccr@tnsp.org>
parents: 508
diff changeset
811
724
fd84eb4d8b74 Refactor compo results code for modularity.
Matti Hamalainen <ccr@tnsp.org>
parents: 721
diff changeset
812 $out .= stGetCompoResultLine($html, $entry,
fd84eb4d8b74 Refactor compo results code for modularity.
Matti Hamalainen <ccr@tnsp.org>
parents: 721
diff changeset
813 ($compo["ctype"] != COMPO_ASSIGN) ? $entry["votesum"] : FALSE,
fd84eb4d8b74 Refactor compo results code for modularity.
Matti Hamalainen <ccr@tnsp.org>
parents: 721
diff changeset
814 ($compo["ctype"] != COMPO_NORMAL) ? $compo["show_authors"] : TRUE);
511
6fe66ea0e954 Move most of the results code to site module, remove the support for HTML
Matti Hamalainen <ccr@tnsp.org>
parents: 508
diff changeset
815
724
fd84eb4d8b74 Refactor compo results code for modularity.
Matti Hamalainen <ccr@tnsp.org>
parents: 721
diff changeset
816 $prev = $entry["position"];
fd84eb4d8b74 Refactor compo results code for modularity.
Matti Hamalainen <ccr@tnsp.org>
parents: 721
diff changeset
817 }
fd84eb4d8b74 Refactor compo results code for modularity.
Matti Hamalainen <ccr@tnsp.org>
parents: 721
diff changeset
818 $out .= "\n\n".($html ? "</pre>\n" : "");
fd84eb4d8b74 Refactor compo results code for modularity.
Matti Hamalainen <ccr@tnsp.org>
parents: 721
diff changeset
819 }
695
dff9b125f774 Work on results printing and remove "show authors" option as it is rather
Matti Hamalainen <ccr@tnsp.org>
parents: 690
diff changeset
820
511
6fe66ea0e954 Move most of the results code to site module, remove the support for HTML
Matti Hamalainen <ccr@tnsp.org>
parents: 508
diff changeset
821 return $out;
6fe66ea0e954 Move most of the results code to site module, remove the support for HTML
Matti Hamalainen <ccr@tnsp.org>
parents: 508
diff changeset
822 }
6fe66ea0e954 Move most of the results code to site module, remove the support for HTML
Matti Hamalainen <ccr@tnsp.org>
parents: 508
diff changeset
823
6fe66ea0e954 Move most of the results code to site module, remove the support for HTML
Matti Hamalainen <ccr@tnsp.org>
parents: 508
diff changeset
824
716
e7fbcf4190e6 Add registration host.
Matti Hamalainen <ccr@tnsp.org>
parents: 703
diff changeset
825 function stGetAttendeeRegistrationSQL()
e7fbcf4190e6 Add registration host.
Matti Hamalainen <ccr@tnsp.org>
parents: 703
diff changeset
826 {
e7fbcf4190e6 Add registration host.
Matti Hamalainen <ccr@tnsp.org>
parents: 703
diff changeset
827 return stPrepareSQL(
e7fbcf4190e6 Add registration host.
Matti Hamalainen <ccr@tnsp.org>
parents: 703
diff changeset
828 "INSERT INTO attendees (regtime,name,groups,oneliner,email,reghost) VALUES (%d,%S,%S,%S,%S,%s)",
e7fbcf4190e6 Add registration host.
Matti Hamalainen <ccr@tnsp.org>
parents: 703
diff changeset
829 time(), "name", "groups", "oneliner", "email", $_SERVER["REMOTE_ADDR"]);
e7fbcf4190e6 Add registration host.
Matti Hamalainen <ccr@tnsp.org>
parents: 703
diff changeset
830 }
e7fbcf4190e6 Add registration host.
Matti Hamalainen <ccr@tnsp.org>
parents: 703
diff changeset
831
e7fbcf4190e6 Add registration host.
Matti Hamalainen <ccr@tnsp.org>
parents: 703
diff changeset
832
721
69a829f687a9 Preliminary work for entry previews.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
833 function stMakePath($isURL, $repExt, $components)
69a829f687a9 Preliminary work for entry previews.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
834 {
780
f8d09e0de027 Properly implement stMakePath() replacing the stub function.
Matti Hamalainen <ccr@tnsp.org>
parents: 774
diff changeset
835 $res = array();
f8d09e0de027 Properly implement stMakePath() replacing the stub function.
Matti Hamalainen <ccr@tnsp.org>
parents: 774
diff changeset
836
f8d09e0de027 Properly implement stMakePath() replacing the stub function.
Matti Hamalainen <ccr@tnsp.org>
parents: 774
diff changeset
837 // If this is URL, the first component is passed as is
f8d09e0de027 Properly implement stMakePath() replacing the stub function.
Matti Hamalainen <ccr@tnsp.org>
parents: 774
diff changeset
838 if ($isURL)
f8d09e0de027 Properly implement stMakePath() replacing the stub function.
Matti Hamalainen <ccr@tnsp.org>
parents: 774
diff changeset
839 {
f8d09e0de027 Properly implement stMakePath() replacing the stub function.
Matti Hamalainen <ccr@tnsp.org>
parents: 774
diff changeset
840 $res[] = array_shift($components);
f8d09e0de027 Properly implement stMakePath() replacing the stub function.
Matti Hamalainen <ccr@tnsp.org>
parents: 774
diff changeset
841 $first = FALSE;
f8d09e0de027 Properly implement stMakePath() replacing the stub function.
Matti Hamalainen <ccr@tnsp.org>
parents: 774
diff changeset
842 }
f8d09e0de027 Properly implement stMakePath() replacing the stub function.
Matti Hamalainen <ccr@tnsp.org>
parents: 774
diff changeset
843 else
f8d09e0de027 Properly implement stMakePath() replacing the stub function.
Matti Hamalainen <ccr@tnsp.org>
parents: 774
diff changeset
844 $first = TRUE;
f8d09e0de027 Properly implement stMakePath() replacing the stub function.
Matti Hamalainen <ccr@tnsp.org>
parents: 774
diff changeset
845
f8d09e0de027 Properly implement stMakePath() replacing the stub function.
Matti Hamalainen <ccr@tnsp.org>
parents: 774
diff changeset
846 // Handle each path component
f8d09e0de027 Properly implement stMakePath() replacing the stub function.
Matti Hamalainen <ccr@tnsp.org>
parents: 774
diff changeset
847 foreach ($components as $subComponent)
f8d09e0de027 Properly implement stMakePath() replacing the stub function.
Matti Hamalainen <ccr@tnsp.org>
parents: 774
diff changeset
848 {
f8d09e0de027 Properly implement stMakePath() replacing the stub function.
Matti Hamalainen <ccr@tnsp.org>
parents: 774
diff changeset
849 foreach (explode("/", $subComponent) as $item)
f8d09e0de027 Properly implement stMakePath() replacing the stub function.
Matti Hamalainen <ccr@tnsp.org>
parents: 774
diff changeset
850 {
f8d09e0de027 Properly implement stMakePath() replacing the stub function.
Matti Hamalainen <ccr@tnsp.org>
parents: 774
diff changeset
851 if ($item == "..")
f8d09e0de027 Properly implement stMakePath() replacing the stub function.
Matti Hamalainen <ccr@tnsp.org>
parents: 774
diff changeset
852 array_pop($res);
f8d09e0de027 Properly implement stMakePath() replacing the stub function.
Matti Hamalainen <ccr@tnsp.org>
parents: 774
diff changeset
853 else
f8d09e0de027 Properly implement stMakePath() replacing the stub function.
Matti Hamalainen <ccr@tnsp.org>
parents: 774
diff changeset
854 if ($item != "." && ($item != "" || $first))
f8d09e0de027 Properly implement stMakePath() replacing the stub function.
Matti Hamalainen <ccr@tnsp.org>
parents: 774
diff changeset
855 $res[] = preg_replace("/[^a-zA-Z0-9\,\.\/_-]/", "_", $item);
f8d09e0de027 Properly implement stMakePath() replacing the stub function.
Matti Hamalainen <ccr@tnsp.org>
parents: 774
diff changeset
856
f8d09e0de027 Properly implement stMakePath() replacing the stub function.
Matti Hamalainen <ccr@tnsp.org>
parents: 774
diff changeset
857 $first = FALSE;
f8d09e0de027 Properly implement stMakePath() replacing the stub function.
Matti Hamalainen <ccr@tnsp.org>
parents: 774
diff changeset
858 }
f8d09e0de027 Properly implement stMakePath() replacing the stub function.
Matti Hamalainen <ccr@tnsp.org>
parents: 774
diff changeset
859 }
f8d09e0de027 Properly implement stMakePath() replacing the stub function.
Matti Hamalainen <ccr@tnsp.org>
parents: 774
diff changeset
860
800
98aae54eb940 Comment.
Matti Hamalainen <ccr@tnsp.org>
parents: 799
diff changeset
861 // Optionally, replace the file extension with given string
780
f8d09e0de027 Properly implement stMakePath() replacing the stub function.
Matti Hamalainen <ccr@tnsp.org>
parents: 774
diff changeset
862 if ($repExt !== FALSE && ($tmp = array_pop($res)) !== false)
f8d09e0de027 Properly implement stMakePath() replacing the stub function.
Matti Hamalainen <ccr@tnsp.org>
parents: 774
diff changeset
863 {
f8d09e0de027 Properly implement stMakePath() replacing the stub function.
Matti Hamalainen <ccr@tnsp.org>
parents: 774
diff changeset
864 if (($spos = strrpos($tmp, ".")) !== FALSE)
f8d09e0de027 Properly implement stMakePath() replacing the stub function.
Matti Hamalainen <ccr@tnsp.org>
parents: 774
diff changeset
865 $tmp = substr($tmp, 0, $spos).$repExt;
f8d09e0de027 Properly implement stMakePath() replacing the stub function.
Matti Hamalainen <ccr@tnsp.org>
parents: 774
diff changeset
866 else
f8d09e0de027 Properly implement stMakePath() replacing the stub function.
Matti Hamalainen <ccr@tnsp.org>
parents: 774
diff changeset
867 $tmp .= $repExt;
f8d09e0de027 Properly implement stMakePath() replacing the stub function.
Matti Hamalainen <ccr@tnsp.org>
parents: 774
diff changeset
868
f8d09e0de027 Properly implement stMakePath() replacing the stub function.
Matti Hamalainen <ccr@tnsp.org>
parents: 774
diff changeset
869 $res[] = $tmp;
f8d09e0de027 Properly implement stMakePath() replacing the stub function.
Matti Hamalainen <ccr@tnsp.org>
parents: 774
diff changeset
870 }
f8d09e0de027 Properly implement stMakePath() replacing the stub function.
Matti Hamalainen <ccr@tnsp.org>
parents: 774
diff changeset
871
f8d09e0de027 Properly implement stMakePath() replacing the stub function.
Matti Hamalainen <ccr@tnsp.org>
parents: 774
diff changeset
872 return implode("/", $res);
721
69a829f687a9 Preliminary work for entry previews.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
873 }
69a829f687a9 Preliminary work for entry previews.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
874
69a829f687a9 Preliminary work for entry previews.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
875
69a829f687a9 Preliminary work for entry previews.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
876 function stGetEntryPreviewData($compo, $entry, $probePreview, $fullData)
69a829f687a9 Preliminary work for entry previews.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
877 {
69a829f687a9 Preliminary work for entry previews.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
878 $res = array();
742
66e415b69c75 Rename some variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 734
diff changeset
879 $entryPath = stGetSetting("entryPath");
66e415b69c75 Rename some variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 734
diff changeset
880 $previewPath = stGetSetting("previewPath");
66e415b69c75 Rename some variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 734
diff changeset
881 $previewURL = stGetSetting("previewURL");
721
69a829f687a9 Preliminary work for entry previews.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
882 $thumbDir = stGetSetting("thumbnailSubDir");
69a829f687a9 Preliminary work for entry previews.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
883
781
6e9e42005701 Cleanups, fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 780
diff changeset
884 $filename = $entry["filename"];
6e9e42005701 Cleanups, fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 780
diff changeset
885
721
69a829f687a9 Preliminary work for entry previews.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
886 // Data for the actual entry file
69a829f687a9 Preliminary work for entry previews.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
887 $res["previewType"] = ($entry["preview_type"] != EPREV_NONE) ? $entry["preview_type"] : $compo["preview_type"];
781
6e9e42005701 Cleanups, fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 780
diff changeset
888 $res["entryFile"] = stMakePath(FALSE, FALSE, array($entryPath, $compo["cpath"], $filename));
721
69a829f687a9 Preliminary work for entry previews.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
889 if ($fullData)
69a829f687a9 Preliminary work for entry previews.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
890 {
69a829f687a9 Preliminary work for entry previews.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
891 $res["entrySize"] = @filesize($res["entryFile"]);
69a829f687a9 Preliminary work for entry previews.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
892 }
69a829f687a9 Preliminary work for entry previews.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
893
69a829f687a9 Preliminary work for entry previews.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
894 // Based on preview type, set some basics
69a829f687a9 Preliminary work for entry previews.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
895 switch ($res["previewType"])
69a829f687a9 Preliminary work for entry previews.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
896 {
69a829f687a9 Preliminary work for entry previews.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
897 case EPREV_IMAGE:
781
6e9e42005701 Cleanups, fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 780
diff changeset
898 $res["fileBase"] = stMakePath(FALSE, "_sshot", array($filename));
721
69a829f687a9 Preliminary work for entry previews.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
899 $res["preferType"] = "PNG";
69a829f687a9 Preliminary work for entry previews.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
900 $fileTypeList = array(
69a829f687a9 Preliminary work for entry previews.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
901 "PNG" => array(".png", ".PNG"),
69a829f687a9 Preliminary work for entry previews.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
902 "GIF" => array(".gif", ".GIF"),
69a829f687a9 Preliminary work for entry previews.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
903 "JPEG" => array(".jpg", ".JPG"),
69a829f687a9 Preliminary work for entry previews.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
904 );
69a829f687a9 Preliminary work for entry previews.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
905 break;
69a829f687a9 Preliminary work for entry previews.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
906
69a829f687a9 Preliminary work for entry previews.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
907 case EPREV_AUDIO:
781
6e9e42005701 Cleanups, fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 780
diff changeset
908 $res["fileBase"] = stMakePath(FALSE, "_sample", array($filename));
721
69a829f687a9 Preliminary work for entry previews.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
909 $res["preferType"] = "PNG";
69a829f687a9 Preliminary work for entry previews.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
910 $fileTypeList = array(
799
cce7307d2c75 Handle preview audio mime type.
Matti Hamalainen <ccr@tnsp.org>
parents: 798
diff changeset
911 "audio/mpeg" => array(".mp3", ".MP3"),
cce7307d2c75 Handle preview audio mime type.
Matti Hamalainen <ccr@tnsp.org>
parents: 798
diff changeset
912 "audio/ogg; codecs=vorbis" => array(".ogg", ".OGG", ".oga", ".OGA"),
721
69a829f687a9 Preliminary work for entry previews.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
913 );
69a829f687a9 Preliminary work for entry previews.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
914 break;
69a829f687a9 Preliminary work for entry previews.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
915
69a829f687a9 Preliminary work for entry previews.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
916 default:
69a829f687a9 Preliminary work for entry previews.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
917 return FALSE;
69a829f687a9 Preliminary work for entry previews.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
918 }
69a829f687a9 Preliminary work for entry previews.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
919
69a829f687a9 Preliminary work for entry previews.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
920 // Find the preview file(s)
781
6e9e42005701 Cleanups, fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 780
diff changeset
921 foreach ($fileTypeList as $fileType => $fileExts)
721
69a829f687a9 Preliminary work for entry previews.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
922 {
781
6e9e42005701 Cleanups, fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 780
diff changeset
923 foreach ($fileExts as $fext)
721
69a829f687a9 Preliminary work for entry previews.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
924 {
742
66e415b69c75 Rename some variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 734
diff changeset
925 $filename = stMakePath(FALSE, $fext, array($previewPath, $compo["cpath"], $res["fileBase"]));
721
69a829f687a9 Preliminary work for entry previews.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
926 if ($probePreview == FALSE || file_exists($filename))
69a829f687a9 Preliminary work for entry previews.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
927 {
781
6e9e42005701 Cleanups, fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 780
diff changeset
928 $res["previewFileType"] = $fileType;
721
69a829f687a9 Preliminary work for entry previews.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
929 $res["previewPath"] = $filename;
742
66e415b69c75 Rename some variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 734
diff changeset
930 $res["previewURL"] = stMakePath(TRUE, $fext, array($previewURL, $compo["cpath"], $res["fileBase"]));
721
69a829f687a9 Preliminary work for entry previews.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
931
69a829f687a9 Preliminary work for entry previews.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
932 if ($res["previewType"] == EPREV_IMAGE)
69a829f687a9 Preliminary work for entry previews.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
933 {
781
6e9e42005701 Cleanups, fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 780
diff changeset
934 $res["thumbPath"] = stMakePath(FALSE, $fext, array($previewPath, $compo["cpath"], $thumbDir, $res["fileBase"]));
742
66e415b69c75 Rename some variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 734
diff changeset
935 $res["thumbURL"] = stMakePath(TRUE, $fext, array($previewURL, $compo["cpath"], $thumbDir, $res["fileBase"]));
721
69a829f687a9 Preliminary work for entry previews.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
936 }
69a829f687a9 Preliminary work for entry previews.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
937
69a829f687a9 Preliminary work for entry previews.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
938 if ($fullData)
69a829f687a9 Preliminary work for entry previews.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
939 {
69a829f687a9 Preliminary work for entry previews.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
940 $res["previewSize"] = @filesize($res["previewPath"]);
69a829f687a9 Preliminary work for entry previews.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
941 $res["thumbSize"] = @filesize($res["thumbPath"]);
69a829f687a9 Preliminary work for entry previews.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
942 }
69a829f687a9 Preliminary work for entry previews.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
943
69a829f687a9 Preliminary work for entry previews.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
944 return $res;
69a829f687a9 Preliminary work for entry previews.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
945 }
69a829f687a9 Preliminary work for entry previews.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
946 }
69a829f687a9 Preliminary work for entry previews.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
947 }
69a829f687a9 Preliminary work for entry previews.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
948
69a829f687a9 Preliminary work for entry previews.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
949 return FALSE;
69a829f687a9 Preliminary work for entry previews.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
950 }
69a829f687a9 Preliminary work for entry previews.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
951
69a829f687a9 Preliminary work for entry previews.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
952
774
d6668b73bb01 Modularize preview HTML stuff into a function stPrintPreviewElements().
Matti Hamalainen <ccr@tnsp.org>
parents: 752
diff changeset
953 function stPrintPreviewElements($compo, $entry)
d6668b73bb01 Modularize preview HTML stuff into a function stPrintPreviewElements().
Matti Hamalainen <ccr@tnsp.org>
parents: 752
diff changeset
954 {
d6668b73bb01 Modularize preview HTML stuff into a function stPrintPreviewElements().
Matti Hamalainen <ccr@tnsp.org>
parents: 752
diff changeset
955 if (($pdata = stGetEntryPreviewData($compo, $entry, FALSE, TRUE)) === FALSE)
d6668b73bb01 Modularize preview HTML stuff into a function stPrintPreviewElements().
Matti Hamalainen <ccr@tnsp.org>
parents: 752
diff changeset
956 return FALSE;
d6668b73bb01 Modularize preview HTML stuff into a function stPrintPreviewElements().
Matti Hamalainen <ccr@tnsp.org>
parents: 752
diff changeset
957
d6668b73bb01 Modularize preview HTML stuff into a function stPrintPreviewElements().
Matti Hamalainen <ccr@tnsp.org>
parents: 752
diff changeset
958 switch ($pdata["previewType"])
d6668b73bb01 Modularize preview HTML stuff into a function stPrintPreviewElements().
Matti Hamalainen <ccr@tnsp.org>
parents: 752
diff changeset
959 {
d6668b73bb01 Modularize preview HTML stuff into a function stPrintPreviewElements().
Matti Hamalainen <ccr@tnsp.org>
parents: 752
diff changeset
960 case EPREV_IMAGE:
d6668b73bb01 Modularize preview HTML stuff into a function stPrintPreviewElements().
Matti Hamalainen <ccr@tnsp.org>
parents: 752
diff changeset
961 if ($pdata["previewSize"] === FALSE || $pdata["thumbSize"] === FALSE)
d6668b73bb01 Modularize preview HTML stuff into a function stPrintPreviewElements().
Matti Hamalainen <ccr@tnsp.org>
parents: 752
diff changeset
962 {
d6668b73bb01 Modularize preview HTML stuff into a function stPrintPreviewElements().
Matti Hamalainen <ccr@tnsp.org>
parents: 752
diff changeset
963 echo
d6668b73bb01 Modularize preview HTML stuff into a function stPrintPreviewElements().
Matti Hamalainen <ccr@tnsp.org>
parents: 752
diff changeset
964 "<img class=\"imagePreview\" src=\"img/nopreview_tn.png\" alt=\"Preview\" />";
d6668b73bb01 Modularize preview HTML stuff into a function stPrintPreviewElements().
Matti Hamalainen <ccr@tnsp.org>
parents: 752
diff changeset
965 }
d6668b73bb01 Modularize preview HTML stuff into a function stPrintPreviewElements().
Matti Hamalainen <ccr@tnsp.org>
parents: 752
diff changeset
966 else
d6668b73bb01 Modularize preview HTML stuff into a function stPrintPreviewElements().
Matti Hamalainen <ccr@tnsp.org>
parents: 752
diff changeset
967 {
d6668b73bb01 Modularize preview HTML stuff into a function stPrintPreviewElements().
Matti Hamalainen <ccr@tnsp.org>
parents: 752
diff changeset
968 echo
d6668b73bb01 Modularize preview HTML stuff into a function stPrintPreviewElements().
Matti Hamalainen <ccr@tnsp.org>
parents: 752
diff changeset
969 "<a href=\"".ihentities($pdata["previewURL"]).
785
7735f97b2bbf Preliminal implementation of the preview image zoom box.
Matti Hamalainen <ccr@tnsp.org>
parents: 781
diff changeset
970 "\" onClick=\"return jsShowPreviewImage('".ihentities($pdata["previewURL"])."');\">".
774
d6668b73bb01 Modularize preview HTML stuff into a function stPrintPreviewElements().
Matti Hamalainen <ccr@tnsp.org>
parents: 752
diff changeset
971 "<img class=\"imagePreview\" src=\"".ihentities($pdata["thumbURL"]).
d6668b73bb01 Modularize preview HTML stuff into a function stPrintPreviewElements().
Matti Hamalainen <ccr@tnsp.org>
parents: 752
diff changeset
972 "\" alt=\"Preview\" /></a>";
d6668b73bb01 Modularize preview HTML stuff into a function stPrintPreviewElements().
Matti Hamalainen <ccr@tnsp.org>
parents: 752
diff changeset
973 }
d6668b73bb01 Modularize preview HTML stuff into a function stPrintPreviewElements().
Matti Hamalainen <ccr@tnsp.org>
parents: 752
diff changeset
974 break;
d6668b73bb01 Modularize preview HTML stuff into a function stPrintPreviewElements().
Matti Hamalainen <ccr@tnsp.org>
parents: 752
diff changeset
975
d6668b73bb01 Modularize preview HTML stuff into a function stPrintPreviewElements().
Matti Hamalainen <ccr@tnsp.org>
parents: 752
diff changeset
976 case EPREV_AUDIO:
d6668b73bb01 Modularize preview HTML stuff into a function stPrintPreviewElements().
Matti Hamalainen <ccr@tnsp.org>
parents: 752
diff changeset
977 if ($pdata["previewSize"] !== FALSE)
d6668b73bb01 Modularize preview HTML stuff into a function stPrintPreviewElements().
Matti Hamalainen <ccr@tnsp.org>
parents: 752
diff changeset
978 {
d6668b73bb01 Modularize preview HTML stuff into a function stPrintPreviewElements().
Matti Hamalainen <ccr@tnsp.org>
parents: 752
diff changeset
979 echo
799
cce7307d2c75 Handle preview audio mime type.
Matti Hamalainen <ccr@tnsp.org>
parents: 798
diff changeset
980 "<audio controls preload=\"none\" class=\"audioPreview\">".
cce7307d2c75 Handle preview audio mime type.
Matti Hamalainen <ccr@tnsp.org>
parents: 798
diff changeset
981 "<source src=\"".ihentities($pdata["previewURL"])."\" type=\"".$pdata["previewFileType"]."\">".
774
d6668b73bb01 Modularize preview HTML stuff into a function stPrintPreviewElements().
Matti Hamalainen <ccr@tnsp.org>
parents: 752
diff changeset
982 "</audio>";
d6668b73bb01 Modularize preview HTML stuff into a function stPrintPreviewElements().
Matti Hamalainen <ccr@tnsp.org>
parents: 752
diff changeset
983 }
d6668b73bb01 Modularize preview HTML stuff into a function stPrintPreviewElements().
Matti Hamalainen <ccr@tnsp.org>
parents: 752
diff changeset
984 break;
d6668b73bb01 Modularize preview HTML stuff into a function stPrintPreviewElements().
Matti Hamalainen <ccr@tnsp.org>
parents: 752
diff changeset
985 }
d6668b73bb01 Modularize preview HTML stuff into a function stPrintPreviewElements().
Matti Hamalainen <ccr@tnsp.org>
parents: 752
diff changeset
986
d6668b73bb01 Modularize preview HTML stuff into a function stPrintPreviewElements().
Matti Hamalainen <ccr@tnsp.org>
parents: 752
diff changeset
987 return TRUE;
d6668b73bb01 Modularize preview HTML stuff into a function stPrintPreviewElements().
Matti Hamalainen <ccr@tnsp.org>
parents: 752
diff changeset
988 }
d6668b73bb01 Modularize preview HTML stuff into a function stPrintPreviewElements().
Matti Hamalainen <ccr@tnsp.org>
parents: 752
diff changeset
989
d6668b73bb01 Modularize preview HTML stuff into a function stPrintPreviewElements().
Matti Hamalainen <ccr@tnsp.org>
parents: 752
diff changeset
990
816
95c3e0a1058e Add new helper function stProbeFileInfo().
Matti Hamalainen <ccr@tnsp.org>
parents: 815
diff changeset
991 //
95c3e0a1058e Add new helper function stProbeFileInfo().
Matti Hamalainen <ccr@tnsp.org>
parents: 815
diff changeset
992 // Probe file type information
95c3e0a1058e Add new helper function stProbeFileInfo().
Matti Hamalainen <ccr@tnsp.org>
parents: 815
diff changeset
993 //
95c3e0a1058e Add new helper function stProbeFileInfo().
Matti Hamalainen <ccr@tnsp.org>
parents: 815
diff changeset
994 function stProbeFileInfo($filename)
95c3e0a1058e Add new helper function stProbeFileInfo().
Matti Hamalainen <ccr@tnsp.org>
parents: 815
diff changeset
995 {
95c3e0a1058e Add new helper function stProbeFileInfo().
Matti Hamalainen <ccr@tnsp.org>
parents: 815
diff changeset
996 global $previewFileTypeList;
95c3e0a1058e Add new helper function stProbeFileInfo().
Matti Hamalainen <ccr@tnsp.org>
parents: 815
diff changeset
997
95c3e0a1058e Add new helper function stProbeFileInfo().
Matti Hamalainen <ccr@tnsp.org>
parents: 815
diff changeset
998 // Get file magic info
95c3e0a1058e Add new helper function stProbeFileInfo().
Matti Hamalainen <ccr@tnsp.org>
parents: 815
diff changeset
999 if (($finfo = finfo_open()) === false)
95c3e0a1058e Add new helper function stProbeFileInfo().
Matti Hamalainen <ccr@tnsp.org>
parents: 815
diff changeset
1000 return stError("Internal error. Failed to initialize finfo().");
95c3e0a1058e Add new helper function stProbeFileInfo().
Matti Hamalainen <ccr@tnsp.org>
parents: 815
diff changeset
1001
95c3e0a1058e Add new helper function stProbeFileInfo().
Matti Hamalainen <ccr@tnsp.org>
parents: 815
diff changeset
1002 $sdata = @finfo_file($finfo, $filename, FILEINFO_NONE);
95c3e0a1058e Add new helper function stProbeFileInfo().
Matti Hamalainen <ccr@tnsp.org>
parents: 815
diff changeset
1003 $smime = @finfo_file($finfo, $filename, FILEINFO_MIME_TYPE);
95c3e0a1058e Add new helper function stProbeFileInfo().
Matti Hamalainen <ccr@tnsp.org>
parents: 815
diff changeset
1004 finfo_close($finfo);
95c3e0a1058e Add new helper function stProbeFileInfo().
Matti Hamalainen <ccr@tnsp.org>
parents: 815
diff changeset
1005
95c3e0a1058e Add new helper function stProbeFileInfo().
Matti Hamalainen <ccr@tnsp.org>
parents: 815
diff changeset
1006 // Did we get anything?
95c3e0a1058e Add new helper function stProbeFileInfo().
Matti Hamalainen <ccr@tnsp.org>
parents: 815
diff changeset
1007 if ($sdata === FALSE || $smime === FALSE)
95c3e0a1058e Add new helper function stProbeFileInfo().
Matti Hamalainen <ccr@tnsp.org>
parents: 815
diff changeset
1008 return stError("Internal error, failed to probe file.");
95c3e0a1058e Add new helper function stProbeFileInfo().
Matti Hamalainen <ccr@tnsp.org>
parents: 815
diff changeset
1009
95c3e0a1058e Add new helper function stProbeFileInfo().
Matti Hamalainen <ccr@tnsp.org>
parents: 815
diff changeset
1010 // Match through our supported types ..
95c3e0a1058e Add new helper function stProbeFileInfo().
Matti Hamalainen <ccr@tnsp.org>
parents: 815
diff changeset
1011 foreach ($previewFileTypeList as $fid => $fdata)
95c3e0a1058e Add new helper function stProbeFileInfo().
Matti Hamalainen <ccr@tnsp.org>
parents: 815
diff changeset
1012 {
95c3e0a1058e Add new helper function stProbeFileInfo().
Matti Hamalainen <ccr@tnsp.org>
parents: 815
diff changeset
1013 $fdata["id"] = $fid;
95c3e0a1058e Add new helper function stProbeFileInfo().
Matti Hamalainen <ccr@tnsp.org>
parents: 815
diff changeset
1014
95c3e0a1058e Add new helper function stProbeFileInfo().
Matti Hamalainen <ccr@tnsp.org>
parents: 815
diff changeset
1015 if (isset($fdata["test"]))
95c3e0a1058e Add new helper function stProbeFileInfo().
Matti Hamalainen <ccr@tnsp.org>
parents: 815
diff changeset
1016 {
95c3e0a1058e Add new helper function stProbeFileInfo().
Matti Hamalainen <ccr@tnsp.org>
parents: 815
diff changeset
1017 if (preg_match("/".$fdata["test"]."/", $sdata))
95c3e0a1058e Add new helper function stProbeFileInfo().
Matti Hamalainen <ccr@tnsp.org>
parents: 815
diff changeset
1018 return $fdata;
95c3e0a1058e Add new helper function stProbeFileInfo().
Matti Hamalainen <ccr@tnsp.org>
parents: 815
diff changeset
1019 }
95c3e0a1058e Add new helper function stProbeFileInfo().
Matti Hamalainen <ccr@tnsp.org>
parents: 815
diff changeset
1020 else
95c3e0a1058e Add new helper function stProbeFileInfo().
Matti Hamalainen <ccr@tnsp.org>
parents: 815
diff changeset
1021 if ($fdata["mime"] == $smime)
95c3e0a1058e Add new helper function stProbeFileInfo().
Matti Hamalainen <ccr@tnsp.org>
parents: 815
diff changeset
1022 return $fdata;
95c3e0a1058e Add new helper function stProbeFileInfo().
Matti Hamalainen <ccr@tnsp.org>
parents: 815
diff changeset
1023 }
95c3e0a1058e Add new helper function stProbeFileInfo().
Matti Hamalainen <ccr@tnsp.org>
parents: 815
diff changeset
1024
95c3e0a1058e Add new helper function stProbeFileInfo().
Matti Hamalainen <ccr@tnsp.org>
parents: 815
diff changeset
1025 return stError("No matching allowed file type found.");
95c3e0a1058e Add new helper function stProbeFileInfo().
Matti Hamalainen <ccr@tnsp.org>
parents: 815
diff changeset
1026 }
95c3e0a1058e Add new helper function stProbeFileInfo().
Matti Hamalainen <ccr@tnsp.org>
parents: 815
diff changeset
1027
95c3e0a1058e Add new helper function stProbeFileInfo().
Matti Hamalainen <ccr@tnsp.org>
parents: 815
diff changeset
1028
585
cec36fd24d21 Clean up the menu and HTML somewhat.
Matti Hamalainen <ccr@tnsp.org>
parents: 571
diff changeset
1029 // Get link helper function
cec36fd24d21 Clean up the menu and HTML somewhat.
Matti Hamalainen <ccr@tnsp.org>
parents: 571
diff changeset
1030 function stGetMainPageLink($id, $name, $show = TRUE)
cec36fd24d21 Clean up the menu and HTML somewhat.
Matti Hamalainen <ccr@tnsp.org>
parents: 571
diff changeset
1031 {
699
9a948144dcc9 Various cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 698
diff changeset
1032 global $pageName;
585
cec36fd24d21 Clean up the menu and HTML somewhat.
Matti Hamalainen <ccr@tnsp.org>
parents: 571
diff changeset
1033 if ($show)
699
9a948144dcc9 Various cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 698
diff changeset
1034 return " <a class=\"".($id == $pageName ? "active" : "inactive")."\" href=\"".$id."\">".$name."</a>\n";
585
cec36fd24d21 Clean up the menu and HTML somewhat.
Matti Hamalainen <ccr@tnsp.org>
parents: 571
diff changeset
1035 else
cec36fd24d21 Clean up the menu and HTML somewhat.
Matti Hamalainen <ccr@tnsp.org>
parents: 571
diff changeset
1036 return "";
cec36fd24d21 Clean up the menu and HTML somewhat.
Matti Hamalainen <ccr@tnsp.org>
parents: 571
diff changeset
1037 }
cec36fd24d21 Clean up the menu and HTML somewhat.
Matti Hamalainen <ccr@tnsp.org>
parents: 571
diff changeset
1038
797
7126403af18f Move function.
Matti Hamalainen <ccr@tnsp.org>
parents: 796
diff changeset
1039
7126403af18f Move function.
Matti Hamalainen <ccr@tnsp.org>
parents: 796
diff changeset
1040 function stNormalizeListSlideOrder($list_id)
7126403af18f Move function.
Matti Hamalainen <ccr@tnsp.org>
parents: 796
diff changeset
1041 {
7126403af18f Move function.
Matti Hamalainen <ccr@tnsp.org>
parents: 796
diff changeset
1042 }
7126403af18f Move function.
Matti Hamalainen <ccr@tnsp.org>
parents: 796
diff changeset
1043
7126403af18f Move function.
Matti Hamalainen <ccr@tnsp.org>
parents: 796
diff changeset
1044
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1045 ?>