This repository has been archived by the owner on Dec 19, 2023. It is now read-only.
/
minivend.cfg.dist
440 lines (369 loc) · 12.3 KB
/
minivend.cfg.dist
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
## Catalog Default: blank
#
# Specify a catalog to be run by this MiniVend server. The three required
# parameters are the name, the directory, and the script name that (the path
# vlink is named to) will run the catalog. Additional parameters are aliases
# for the catalog.
#
# If FullUrl is enabled, you will need to set the full server and script path.
#
# This is a multiple directive -- the number of catalogs that can be defined is
# limited only by your machine resources.
#
#Catalog simple /home/user/catalogs/simple /cgi-bin/simple /cgi-bin/alias
## AdminUser Default: blank
#
# The user and password which will allow access to the special mv_admin
# administration catalog. No default; if not present then access is
# disabled.
#
# The password is a normal encrypted string unless the global
# Variable MV_NO_CRYPT is non-blank and non-zero.
#
Variable MV_NO_CRYPT 1
AdminUser minivend:nevairbe
## AllowGlobal Default: blank
#
# Normally MiniVend does not allow references to global routines for catalog
# subroutines and UserTag definitions. Set to the name of any catalogs allowed
# to use global routines and variables. THIS IS UNSAFE unless you trust the
# user not only to write good Perl code, but to have access to all files
# readable and writable by MiniVend.
#
AllowGlobal _mv_admin
## CheckHTML Default: blank
#
# The name and arguments of an external program for checking page HTML.
#
# CheckHTML /usr/local/bin/weblint -s -
#
# Do not use redirection of I/O in this call. You will always receive
# stderr output. Activate on the page with [tag flag checkhtml][/tag]
# at the very top or very bottom.
#
# CheckHTML
## DisplayErrors Default: No
#
# Controls whether program errors will be appended to the browser display.
#
# DisplayErrors Yes
## DomainTail Default: Yes
#
# Implements the domain/ip session qualifiers so that only the major domain is
# used to qualify the session ID. This is a compromise on security, but it
# allows non-cookie-accepting browsers like AOL's V2.0 to use multiple proxy
# servers.
#
# Default is yes, since most everyone wants AOL to work.
#
# DomainTail
## DumpStructure Default: No
#
# Causes MiniVend to dump complete configuration hash to a file
# with a .structure extension. Useful for seeing what the catalog
# and MV configuration really are.
#
# DumpStructure
## FullURL Default: No
#
# Normally MiniVend determines which catalog to call by determining the
# SCRIPT_NAME from the CGI call. This means that different (and maybe virtual)
# hosts cannot use the same SCRIPT_NAME to call different catalogs. Set FullUrl
# to yes to differentiate based on the calling host. You must then set the
# server name in the Catalog directive accordingly, i.e.
# yourdomain.com/cgi-bin/sample.
#
# FullUrl
## GlobalSub Default: blank
#
# Defines a F<global> subroutine for use by the B<[perl sub] subname arg
# [/perl]> construct.
#
# IMPORTANT NOTE: These global subroutines are NOT SUBJECT TO SECURITY CHECKS
# -- they can do most anything! For most purposes, scratch subroutines
# or catalog subroutines are better.
#
# You may define as many as desired.
#
GlobalSub sub test_global_sub { return 'Test of global subroutine OK.' }
## HammerLock Default: 30
#
# The number of seconds after which a locked or running session could be
# considered to be lost due to malfunction.
#
# Controls the timeout for killing an apparently hung process, like a glimpse
# search, as well as the lock on a session.
#
# If you don't have long-running searches or long-running database imports,
# consider setting this to 15 seconds or less. If you may have long-running
# searches, consider setting to 60 seconds. The default of 30 is probably a
# good bet for most catalogs.
#
# HammerLock
## HouseKeeping Default: 60
#
# How often (in seconds) MiniVend will wake up to look for user reconfiguration
# requests and check for hung processes.
#
# If you have a very lightly used server then you could set this to a high
# number to allow MiniVend to be swapped to disk more readily.
#
HouseKeeping 5
## IpHead Default: No
#
# Implements the domain/ip session qualifiers so that only the first
# dot-quad of the IP address is used to qualify the session ID. This is a
# compromise on security, but it allows non-cookie-accepting browsers like
# AOL's V2.0 to use multiple proxy servers.
#
# DomainTail is preferable unless one of your HTTP servers does not do host
# name lookups.
#
# Default is no, and DomainTail must be set to 'no' for it to operate.
#
# IpHead
## IpQuad Default: 1
#
# Modifies IpHead to set the number of dot-quads checked.
#
# If you use PGP or CyberCash, you should probably use the
# catalog.cfg directive "WideOpen" instead.
#
# IpQuad 1
## LockoutCommand Default: blank
#
# The name of a command (as you would enter it from the shell) that will lock
# out the host IP of an offending system. The IP address will be substituted
# for the first occurrence of the string %s. See the docs under RobotLimit.
#
# LockoutCommand ipfwadm -I -i deny -S %s
## Mall Default: No
#
# Whether MiniVend will send cookies corresponding to only the CGI program in
# use. Allows different stores in the same domain to each store separate
# cookie information -- affects cookie path.
#
# May be used to control other settings in the future.
#
# Mall
## MaxServers Default: 4
#
# The number of servers that MiniVend will allow to serve requests
# simultaneously. Set lower if you wish to conserve memory at all costs.
#
MaxServers 5
## NoAbsolute Default: No
#
# Whether MiniVend [file ...] and other tags can read any file on the system.
# The default is to allow any file to be read -- this should be changed in a
# multi-user environment.
#
# NoAbsolute
## PIDcheck Default: No
#
# If non-zero, enables a check of running MiniVend processes during the
# housekeeping routine. If a process has been running (or is hung) for
# longer than PIDcheck seconds then a kill -9 will be issued and the
# server count decremented.
#
# During the housekeeping routine, the number of servers checked by
# MaxServers will be recounted based on PID files.
#
# Default is 0, disabling the check. It is recommended that you
# use this only for MiniVend 3.12 or higher, and it is recommended that
# you *do* use it for that version.
#
PIDcheck 300
## SafeUntrap Default: ftfile sort
#
# Sets the codes that will be untrapped in the Safe.pm module, used for
# embedded Perl and conditional operations. You can see the Safe.pm
# documentation by typing 'perldoc Safe' at the command prompt. The default is
# 'ftfile sort' (or '249 148' if using Perl 5.003), which untraps the file
# existence test operator and the sort operator. Define it as blank to not
# allow any besides the very restrictive Safe.pm defaults.
#
# SafeUntrap
## SubCatalog Default: none
#
# Allows definition of a catalog which shares most of the characteristics of
# another catalog. Only the items that are changed from the base catalog are
# added. The parameters are 1) the catalog ID 2) the base catalog ID, 3) the
# directory to use (typically the same as the base catalog), and 4) the
# SCRIPT_NAME that will trigger the catalog. Any additional parameters are
# aliases for the SCRIPT_NAME.
#
# The main reason that this would be used would be to conserve memory in a
# series of stores that share most of the same pages or databases.
#
# SubCatalog sample2 sample /usr/catalogs/sample /cgi-bin/sample2
## TcpHost Default: localhost
#
# The host(s) that will be allowed to generate MiniVend requests when running
# in INET mode. You are responsible for security! Remember that socket
# communications are not necessarily secure when going over a wire!
#
# TcpHost
## TcpMap Default: localhost#
#
# The port(s) that will be monitored for running MiniVend requests.
# Specified by a port name and then a catalog name (or - for all
# catalogs).
#
TcpMap 7786 -
## TcpPort Default: 7786
#
# The port that will be monitored for MiniVend requests when running in INET
# mode.
#
# This is deprecated by TcpMap.
#
# TcpPort
## TolerateGet Default: No
#
# Allows forms to use METHOD=GET instead of POST.
#
TolerateGet Yes
## Variable Default: none
#
# Variable values that can be accessed on pages of ALL catalogs with
# @@VARIABLE@@ notation. A few special ones have MV_ prefixes, if you
# don't use that prefix you will be fine.
#
Variable TEST_VARIABLE Test of global variable OK.
## UserTag Default: none
#
# Custom tag for every catalog served by this MiniVend.
#
# UserTag
# [loc locale*] message [/loc]
#
# This tag is the equivalent of [L] ... [/L] localization, except
# it works with contained tags
#
UserTag loc hasEndTag 1
UserTag loc Interpolate 1
UserTag loc Order locale
UserTag loc Routine <<EOF
sub {
my ($locale, $message) = @_;
return $message unless $Vend::Cfg->{Locale};
my $ref;
if($locale) {
return $message
unless defined $Vend::Cfg->{Locale_repository}{$locale};
$ref = $Vend::Cfg->{Locale_repository}{$locale}
}
else {
$ref = $Vend::Cfg->{Locale};
}
return defined $ref->{$message} ? $ref->{$message} : $message;
}
EOF
# [var name=variablename global=1]
#
# This tag is the equivalent of __VARIABLE__ except that it will
# works in other variables
#
UserTag var Interpolate 1
UserTag var PosNumber 2
UserTag var Order name global
UserTag var Routine <<EOF
sub {
$_[1] and return $Global::Variable->{shift @_};
return $Vend::Cfg->{Variable}{shift @_};
}
EOF
# [summary amount=n.nn
# name=label*
# hide=1*
# total=1*
# reset=1*
# format="%.2f"*
# currency=1* ]
#
# Calculates column totals (if used properly. 8-\)
#
#
UserTag summary Order amount name currency format total reset hide
UserTag summary PosNumber 6
UserTag summary Routine <<EOF
use vars qw/%summary_hash/;
sub {
my ($amount, $name, $currency, $format, $total, $reset, $hide) = @_;
unless ($name) {
$name = 'ONLY0000';
%summary_hash = () if Vend::Util::is_yes($reset);
}
else {
$summary_hash{$name} = 0 if Vend::Util::is_yes($reset);
}
$summary_hash{$name} += $amount if length $amount;
$amount = $summary_hash{$name} if Vend::Util::is_yes($total);
return '' if defined $hide && Vend::Util::is_yes($hide);
return sprintf $format, $amount if $format;
return Vend::Util::currency($amount) if $currency;
return $amount;
}
EOF
# [db-date table format]
#
# This tag returns the last-modified time of a database table,
# 'products' by default. Accepts a POSIX strftime value for
# date format; uses '%A %d %b %Y' by default.
#
UserTag db-date Order table format
UserTag db-date PosNumber 2
UserTag db-date Routine <<EOF
sub {
my ($format, $db) = @_;
$format = '%A %d %b %Y';
$db = 'products' unless $db;
my $mtime = (stat($Vend::Cfg->{Database}{'file'}))[9];
return POSIX::strftime($format, localtime($mtime));
}
EOF
# [db-count table]
#
# This tag returns the number of records in a database table,
# 'products' by default.
#
UserTag db-count Order table
UserTag db-count PosNumber 1
UserTag db-count Routine <<EOF
sub {
my ($db) = @_;
$db = 'products' unless $db;
my $ref = Vend::Data::database_exists_ref($db)
or return "Bad table $db";
$ref = $ref->ref();
my $count;
while ($ref->each_record()) {
$count++;
}
return $count;
}
EOF
UserTag bar-button Order page current
UserTag bar-button PosNumber 2
UserTag bar-button HasEndTag 1
UserTag bar-button Routine <<EOR
sub {
use strict;
my ($page, $current, $html) = @_;
$current = $Global::Variable->{MV_PAGE}
if ! $current;
$html =~ s:\[selected\]([\000-\377]*)\[/selected]::i;
my $alt = $1;
return $html if $page ne $current;
return $alt;
}
EOR
### The old user database stuff
### DON'T ### include userdb.cfg
### The minivend administration stuff
#include admin/mv_admin.cfg
### Include if you want non-English error messages. Not complete.
# #include locale.error
#include flycat.cfg
#include form_mail.cfg