Configuration Reference ======================= icconfig.1.82 (Draft) 1. Interchange Configuration Files ================================== This is an alphabetical reference to the configuration directives used in Interchange global and catalog configuration files. Interchange has multiple catalog capability, and therefore splits its configuration into two pieces. One is global, interchange.cfg, and affects every catalog running under it. The other, catalog.cfg is specific to an individual catalog, and has no effect on other catalogs. 1.1. Directive syntax --------------------- Configuration directives are normally specified with the directive as the first word on the line, with its value or values following. Capitalization of the directive name is not significant. Leading and trailing whitespace is stripped from the line. Including files in directives Additional files may be called with an include file notation like this: DirectiveName {mv_nextpage} = 'bar'; } EOR If it returns a true (non-zero, non-empty) value, Interchange will display the page defined in $CGI->{mv_nextpage}. Otherwise, Interchange will not display any page. The default Interchange actions can be overridden, if desired. There is also a catalog-specific version of this directive, which overrides any action of the same name. The global version affects all catalogs -- there is also a catalog-specific version of FormAction which is protected by Safe. 2.24. FullUrl *global* ---------------------- Normally Interchange 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. Then, set the server name in the Catalog directive accordingly, such as yourdomain.com/cgi-bin/simple. A yes/no directive, the default is No. FullUrl Yes If it is set in this fashion, all catalogs must be defined in this fashion. NOTE: The individual catalog setting will not work, as this is used before the catalog name is known. 2.25. GlobalSub *global* ------------------------ Defines a global subroutine for use by the [perl sub] subname arg /perl] construct. Use the "here document" capability of Interchange configuration files to make it easy to define: GlobalSub <inc(); return "There have been $number orders placed.\n"; } EOF As with Perl "here documents," the EOF (or other end marker) must be the ONLY thing on the line, with no leading or trailing white space. Do not append a semicolon to the marker. (The above marker appears indented. It should not be that way in the file!) IMPORTANT NOTE: These global subroutines are not subject to security checks. They can do most anything! For most purposes, scratch subroutines or catalog subroutines (also Sub) are better. GlobalSub routines are subject to full Perl use strict checking, so errors are possible if lexical variables or complete package qualifications are not used for the variables. 2.26. HammerLock *global* ------------------------- The number of seconds after which a locked session could be considered to be lost due to malfunction. This will kill the lock on the session. Only here for monitoring of session hand-off. If this error shows up in the error log, the system setup should be examined. Default is 30. HammerLock 60 This mostly doesn't apply to Interchange when using the default file-based sessions. 2.27. HitCount *global* ----------------------- Increments a counter in ConfDir for every access to the catalog. The file is named hits.catalogname, where catalogname is the short catalog identifier. A Yes/No directive, default is No. HitCount Yes 2.28. HouseKeeping *global* --------------------------- How often, in seconds, the Interchange server will "wake up" and look for user reconfiguration requests and hung search processes. On some systems, this wakeup is the only time the server will terminate in response to a stop command. Default is 60. HouseKeeping 5 2.29. Inet_Mode *global* ------------------------ Determines whether INET-domain sockets will be monitored on startup. Overridden by the command-line parameter -i. Default is Yes. 2.30. IpHead *global* --------------------- Implements the domain/IP session qualifiers so that only the first IpQuad dot-quads of the IP address are used to qualify the session ID. The default is 1. This is a slight 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 Yes 2.31. IpQuad *global* --------------------- The number of dot-quads that IpHead will look at. Default is 1. IpQuad 2 2.32. Locale *global* --------------------- Sets the global Locale for use in error messages. Normally set from a file's contents, as in the example before: Locale connect($dsn) or die "$script_name cannot connect to DBI: $DBI::errstr\n"; my %data; $data{KEY} = $opt_k || ''; local ($/); $data{MSG} = <>; $data{LEVEL} = $opt_p || 'interchange.info'; $template =~ s/\~\~(\w+)\~\~/$dbh->quote($data{$1})/; my $sth = $dbh->prepare($template) or die "$script_name error executing query: $template\n"; $sth->execute() or die "$script_name error executing query: $template\n"; exit; 2.58. TagDir *global* --------------------- Defines the directory or directories that Interchange will scan for tag, filter, widget, and other code declarations. TagDir code etc/other_code Relative to the Interchange software root. Default is code. 2.59. TagGroup *global* ----------------------- Defines a group of tags for possible inclusion or exclusion in the set of ITL tags Interchange will compile and use. TagGroup :file "counter file include log value_extended" EOF Default is defined in lib/Vend/Config.pm, and is too lengthy to show here. Above is the default :file group. 2.60. TagInclude *global* ------------------------- Includes or excludes a set of IC tags for compilation and use. The TagDir is scanned for files, and when found they are checked against tag names and the groups defined in .TagGroup. TagInclude ALL !:crufty !get_url The above will include all tags by default, but not the group :crufty nor the tag get_url. Default is ALL. 2.61. TcpHost *global* ---------------------- When running in INET mode, using tlink, specifies the hosts that are allowed to send/receive transactions from any catalog on this Interchange server. Can be either an name or IP number, and multiple hosts can be specified in a space-separated list. Default is localhost. TcpHost localhost secure.domain.com 2.62. TcpMap *global* --------------------- When running in INET mode, using tlink or the internal HTTP server, specifies the port(s) which will be monitored by the Interchange server. Default is 7786. To use the internal HTTP server (perhaps only for password-protected queries), a catalog may be mapped to a port. If three catalogs were running on the server www.akopia.com, named simple, sample, and search, the directive might look like this: TcpMap 7786 - 7787 simple 7788 sample 7789 search Note: To map large numbers of ports, use the < (CATROOT)' string 'string' Note that this is set globally once only when the Interchange daemon is started, so it's pointless to change the variable after that. 2.70. VarName *global* ---------------------- Sets the names of variables that will be remapped to and from the URL when Interchange writes it. For instance, to display the variable mv_session_id as session in the user's URL: VarName mv_session_id session The default can also be set in the etc/varnames file after the first time Interchange is run. Setting it in interchange.cfg is probably better for clarity. There is also a catalog-specific version of this setting. 3. catalog.cfg ============== Each catalog must have a catalog.cfg file located in its base catalog directory. It contains most of the configurable parameters for Interchange. Each is independent from catalog to catalog. Additional configuration techniques are available in the catalog.cfg file. First, set a Variable and use its results in a subsequent configuration setting if ParseVariables is on: Variable SERVER_NAME www.akopia.com Variable CGI_URL /cgi-bin/demo ParseVariables Yes VendURL http://__SERVER_NAME____CGI_URL__ ParseVariables No Define subroutine watches Almost any configuration variable can be set up to be tied to a subroutine if the Tie::Watch module is installed. It uses a notation like the <{special_handling}) { return 'vip@akopia.com'; } else { return $default; } } EOF When the order is mailed out, if the user has a variable called special_handling set in their session (from UserDB, perhaps), the order will be sent to 'vip@akopia.com.' Note the single quotes to prevent problems with the @ sign. Otherwise, the order will get sent to the previously defined value of orders@akopia.com. If the configuration value being watched is a SCALAR, the subroutine gets the following call: &{$subref}(SELF, PREVIOUS_VALUE) The subroutine should simply return the proper value. SELF is a reference to the Tie::Watch object (read its documentation for what all it can do) and PREVIOUS_VALUE is the previously set value for the directive. If set after the watch is set up, it will simply have the effect of destroying the watch and having unpredictable effects. (In the future, a "Store" routine may be able to be set up that can subsequently set values). If the configuration value being watched is an ARRAY, the subroutine gets the following call: &{$subref}(SELF, INDEX, PREVIOUS_VALUE) INDEX is the index of the array element being accessed. Setting up watch points on array values is not recommended. Most Interchange subroutines call arrays in their list context, and no access method is provided for that. If the configuration value being watched is a HASH, the subroutine gets the following call: &{$subref}(SELF, KEY, PREVIOUS_VALUE) KEY is the index into the hash, an example of HASH type Interchange configuration values. NOTE: The following is not recommended for performance reasons. The Variable is a commonly used thing and should not bear the extra overhead of tieing, but it illustrates the power of this operation: Variable TESTIT Unwatch worked. Variable <&EOV sub { my ($self, $key, $orig) = @_; if($key eq 'TESTIT') { # only the first time if($Scratch->{$key}++) { $self->Unwatch(); return $orig->{TESTIT}; } else { return "Tie::Watch works! -- name=$Values->{name}"; } } else { return $orig->{$key}; } } EOV The first time __TESTIT__ is called for a particular user, it will return the string "Tie::Watch works! -- name=" along with their name set in the session (if that exists). Any other variables will receive the value that they were set to previously. Once the TESTIT key has been accessed for that user, the watch is dropped upon the next access. 3.2. Configuration Directives in catalog.cfg -------------------------------------------- All directives except MailOrderTo and VendURL have default values and are optional, though most catalogs will want to configure some of them. 3.3. ActionMap -------------- Allows setting of Interchange actions, usually with a Perl subroutine. Actions are page names like: process Perform a processing function order Order items scan Search based on path info search Search based on submitted form variables These are the standard supplied actions for Interchange. They can be overwritten with user-defined versions if desired. For example, to ignore the order action, set: ActionMap order sub { return 1 } When the leading part of the incoming path is equal to order, it will trigger an action. The page name will be shifted up, and the order stripped from the page name. So this custom order action would essentially perform a no-op, and a URL like: Go to the next page would be the equivalent of "[area nextpage]." If the action does not return a true (non-zero, non-blank) status, no page will be displayed by Interchange, not even the special missing page. A response may also be generated via Perl or MVASP. The standard process action has a number of associated FormAction settings. Besides using Perl, Interchange tags may be used in an action, though they are not nearly as efficient. 3.4. AlwaysSecure ----------------- Determines whether checkout page operations should always be secure. Set it to the pages that should always be secure, separated by spaces and/or tabs. AlwaysSecure ord/checkout 3.5. AsciiTrack --------------- A file name to log formatted orders in. Unless preceded by a leading '/', will be placed relative to the catalog directory. Disabled by default. AsciiTrack etc/tracking.asc If a Route is set up to supplant, this is ignored. 3.6. AutoEnd ------------ Sets an action that is automatically performed at the end of every access. It is performed after any page parsing occurs, just before the transaction ends. It takes the same kinds of parameters as Autoload. 3.7. Autoload ------------- Sets an action that is automatically performed for every access. It is performed before any page parsing occurs, and before the action or page is even determined. It can be set to a string containing ITL tags or to the name of a catalog (Sub) or global subroutine. The return value from the code run is discarded. For example, to automatically run the Sub or GlobalSub named 'testsub': Autoload testsub To remap any mv_nextpage accesses to the private subdirectory of pages, set: Autoload [perl] $CGI->{mv_nextpage} =~ s:^private/:public/:; [/perl] You can temporarily change any of the catalog configuration settings, for example, to use a different flypage depending on the user's browser type: Autoload <{browser} =~ /msie/i) { $Config->{Special}->{flypage} = 'ie_flypage'; } [/perl] EOA Please note that SpecialPage is the corresponding directive in the catalog configuration, not Special. This is an exceptional case. Usually the hash key has the same name as the catalog configuration directive. 3.8. AutoModifier ----------------- Sets an attribute in a shopping cart entry to the field of the same name in the ProductsFile pertaining to this item. This is useful when doing shipping calculations or other embedded Perl that is based on item attributes. To set whether an item is defined as "heavy" and requires truck shipment, set: AutoModifier heavy When an item is added to the shopping cart using Interchange's routines, the heavy attribute will be set to the value of the heavy field in the products database. In the default demo that would be products. Any changes to ProductFiles would affect that, of course. Some values are used by Interchange and are not legal: mv_mi mv_si mv_ib group code quantity item 3.9. AutoVariable ----------------- Specifies directives which should be translated to Variable settings. For scalars, the directive name becomes the Variable name and yields its value, i.e. DescriptionField becomes __DescriptionField__, which would by default be description. Array variables have a _N added, where _N is the ordinal index, i.e. ProductFiles becomes __ProductFiles_0__, __ProductFiles_1__, etc. Hash variables have a _KEY added, i.e. SpecialPage becomes __SpecialPage_missing__, __SpecialPage_violation__, etc. Doesn't handle hash keys that have non-word characters or whitespace. Only single-level arrays and hashes are translated properly. 3.10. CommonAdjust ------------------ Settings for Interchange pricing. See Chained pricing. CommonAdjust pricing:q2,q5,q10,q25, ;products:price, ==size:pricing 3.11. ConfigDir --------------- The default directory where directive values will be read from when using the {DirConfig}{Variable}{VARNAME}, for use if dynamic_variables Pragma is set. Pragma dynamic_variables enables dynamic updating of variables from files. Pragma dynamic_variables_files_only restricts dynamic variables to files only -- otherwise variables are dynamically read from the VarDatabase definition as well. With dynamic variables, all @_VARIABLE_@ and __VARIABLE__ settings are checked first to see if the source file is defined. If there is a key present, even if its contents are blank, it is returned. Example -- in the case of this catalog.cfg entry: DirConfig Variable templates/foundation/regions If the file NOLEFT_TOP is present at catalog config time, __NOLEFT_TOP__ will equal [include templates/foundation/regions/NOLEFT_TOP]. 3.23. DirectoryIndex -------------------- If DirectoryIndex is set, and a page would normally be defined as missing, it's value is appended (with a separating / if appropriate) and the resulting page is looked for. To get the behavior normally associated with an HTTP server, where "index.html" is looked for in a directory, do: DirectoryIndex index.html Default is blank, disabling the behavior. NOTE: Unlike Apache, only one value is accepted. 3.24. DisplayErrors ------------------- If the administrator has enabled DisplayErrors globally, setting this to "Yes" will display the error returned from Interchange in case something is wrong with embedded Perl programs, tags, or Interchange itself. Usually, this will be used during development or debugging. Default is No. DisplayErrors Yes 3.25. DynamicData ----------------- When set to one or more Interchange database identifiers, any pages using data items from the specified database(s) will not be cached or built statically. This allows dynamic updating of certain arbitrary databases (even the products database) while still allowing static/cached page performance gains on pages not using those data items. DynamicData inventory Overridden by [tag flag build][/tag], depending on context. 3.26. EncryptProgram -------------------- Contains a program command line specification that indicates how an external encryption program will work. Two placeholders, %p and %f, are defined, which are replaced at encryption time with the password and temporary file name respectively. See Order Security. This is separate from the PGP directive, which enables PGP encryption of the entire order. If PGP is the encryption program (Interchange determines this by searching for the string pgp in the command string), no password field or file field need be used. The field mv_credit_card_number will never be written to disk in this case. EncryptProgram /usr/local/bin/pgp -feat sales@company.com If the order Route method of sending orders is used (default in the demo), this sets the default value of the encrypt_program attribute. 3.27. ErrorFile --------------- This is where Interchange will write its runtime errors for THIS CATALOG ONLY. It can be shared with other catalogs or the main Interchange error log, but if it is root-based, permission to write the file is required. ErrorFile /home/interchange/error.log 3.28. ExtraSecure ----------------- Disallows access to pages which are marked with AlwaysSecure unless the browser is in HTTPS mode. A Yes/No directive, the default is 'No.' ExtraSecure Yes 3.29. Filter ------------ Assigns one or more filters (comma separated) to be automatically applied to a variable. As an example, multiple form variable submissions on the same page come back null-separated, like 'value1\0value2\0value3'. To automatically change those nulls to spaces, you could use this directive: Filter mail_list null_to_space Of course you could just as easily use the [filter] tag on the page if the filter is only going to be used in a few places. See the [filter] tag documentation (wiki FilterTag) for more information and a list of filters. 3.30. FormAction ---------------- Allows set up of a form action (like the standard ones return, submit, refresh, etc.). It requires a Perl subroutine as a target: FormAction foo <{mv_nextpage} = 'bar'; } EOR If it returns a true (non-zero, non-empty) value, Interchange will display the page defined in $CGI->{mv_nextpage}. Otherwise, Interchange will not display any page. The default Interchange actions can be overridden if desired. There is also a global version of this directive, which is overridden if a catalog-specific action exists. 3.31. FormIgnore ---------------- Set to the name(s) of variables that should not be carried in the user session values. Must match exactly and are case sensitive. FormIgnore mv_searchtype 3.32. FractionalItems --------------------- Whether the quantity field for items in the shopping cart should be allowed to be fractional, i.e., 2.5 or 1.25. Default is No. FractionalItems Yes 3.33. Glimpse ------------- The pathname for the glimpse command, used if glimpse searches are to be enabled. To use glimpseserver, the -C, -J, and -K tags must be used. Glimpse /usr/local/bin/glimpse -C -J srch_engine -K2345 3.34. History ------------- How many of the most recent user clicks should be stored in the session history. Default is 0. 3.35. HTMLsuffix ---------------- The file extension that will be seen as a page in the pages directory. Default is .html. HTMLsuffix .htm 3.36. ImageAlias ---------------- Aliases for images, ala Apache/NCSA, ScriptAlias, and Alias directives. Relocates images based in a particular directory to another for Interchange use; operates after ImageDir. Useful for editing Interchange pages with an HTML editor. Default is blank. ImageAlias /images/ /thiscatalog/images/ 3.37. ImageDir -------------- The directory where all relative IMG and INPUT source file specifications are based. IT MUST HAVE A TRAILING / TO WORK. If the images are to be in the DocumentRoot (of the HTTP server or virtual server) subdirectory images, for example, use the ImageDir specification '/images/'. This would change SRC="order.gif" to SRC="/images/order.gif" in IMG and INPUT tags. It has no effect on other SRC tags. ImageDir /images/ Can be set in the Locale settings to allow different image sets for different locales (MV3.07 and up). 3.38. ImageDirInternal ---------------------- A value for ImageDir only when the internal HTTP server is in use. It must have a trailing / to work, and should always begin with a fully-qualified path starting with http://. ImageDirInternal http://www.server.name/images/ 3.39. ImageDirSecure -------------------- A value for ImageDir only when the pages are being served via HTTPS. It must have a trailing / to work, and should always begin with a fully-qualified path starting with http://. ImageDirSecure /secure/images/ This is useful if using separate HTTPS and HTTP servers, and cannot make the image directory path heads match. 3.40. Locale ------------ Sets the special locale array. Tries to use POSIX setlocale based on the value of itself, then tries to accept a custom setting with the proper definitions of mon_decimal_point, thousands_sep, and frac_digits, which are the the only international settings required. Default, if not set, is to use US-English settings. Example of the custom setting: Locale custom mon_decimal_point , mon_thousands_sep . frac_digits 0 Example of POSIX setlocale for France, if properly aliased: Locale fr See setlocale(3) for more information. If embedded Perl code is used to sort search returns, the setlocale() will carry through to string collation. See Internationalization. 3.41. LocaleDatabase -------------------- Set to the Interchange database identifier of a table that contains Locale settings. These settings add on to and overwrite any that are set in the catalog configuration files, including any include files. Database locale locale.asc TAB LocaleDatabase locale 3.42. MailOrderTo ----------------- Specifies the e-mail address to mail completed orders to. MailOrderTo orders@xyzcorp.com If 'none' is specified, no e-mailed order will be sent. 3.43. NoCache ------------- The names of Interchange pages that are not to be built statically if STATIC PAGE BUILDING is in use. If the name is a directory, no pages in that directory (or any below it) will be cached or built statically. NoCache ord NoCache special 3.44. NoImport -------------- When set to one or more Interchange database identifiers, those database(s) will never be subject to import. Normally, Interchange checks to see if each database needs to be created and populated (from the source text file) when the Interchange daemon is started or restarted, or a catalog is reconfigured. This is useful for SQL databases used by other applications besides Interchange, or large databases you load and back up outside of Interchange. With this option you can omit the source text file for SQL databases entirely. NoImport inventory 3.45. NoImportExternal ---------------------- When set to true, this directive prevents database imports for all "external" databases: NoImportExternal Yes External database types are DBI (all popular SQL databases) and LDAP. Internal database types are the DBM variants (GDBM, DB_File, SDBM) and in-memory databases. The default setting is false (databases may be imported). 3.46. NonTaxableField --------------------- The name of the field in the products database that is set (to 1 or Yes) if an item is not to be taxed. Interchange will log an error and tax it anyway if the field doesn't exist in the database. Blank by default, disabling the feature. NonTaxableField wholesale 3.47. NoSearch -------------- Here you can provide one or more filename fragments that will be matched against the file name used in any attempted search (the mv_search_file or 'fi' attribute). You may separate multiple match strings with whitespace, and may include shell-style wildcards. The default setting is 'userdb', which means that by default you cannot use Interchange-style searches on the userdb table. (Pure SQL searches still work with it, however.) For example, consider this setting: NoSearch userdb .* *.secret In this case any search file with 'userdb' in its name, or beginning with a dot, or ending in '.secret', will not be searchable. 3.48. OfflineDir ---------------- The location of the offline database files for use with the Interchange offline database build command. Set to "offline" as the default, and is relative to VendRoot if there is no leading slash. OfflineDir /usr/data/interchange/offline 3.49. OnFly ----------- Enables on-the-fly item additions to the shopping cart. If set to the name of a valid UserTag, that tag definition will be used to parse and format the item with the following call: $item = Vend::Parse::do_tag($Vend::Cfg->{OnFly}, $code, $quantity, $fly[$j], ); $fly[$j] is the value of mv_order_fly for that item. A default onfly tag is provided by Interchange. For more information, see the section that describes how to set up an on-the-fly item. 3.50. OrderCounter ------------------ The name of the file (relative to catalog root if no leading /) that maintains the order number counter. If not set, the order will be assigned a string based on the time of the order and the user's session number. OrderCounter etc/order.number Bear in mind that Interchange provides the order number as a convenience for display, and that no internal functions depend on it. Custom order number routines may be defined and used without fear of consequences. If a Route is set up to supplant and the counter attribute is set there, this is ignored. 3.51. OrderLineLimit -------------------- The number of items that the user is allowed to place in the shopping cart. Some poorly-mannered robots may "attack" a site by following all links one after another. Some even ignore any robots.txt file that may have been created. If one of these bad robots orders several dozen or more items, the time required to save and restore the shopping cart from the user session may become excessive. If the limit is exceeded, the command defined in the Global directive LockoutCommand will be executed and the shopping cart will be emptied. The default is 0, disabling the check. Set it to a number greater than the number of line items a user is ever expected to order. OrderLineLimit 50 3.52. OrderProfile ------------------ Allows an unlimited number of profiles to be set up, specifying complex checks to be performed at each of the steps in the checkout process. The files specified can be located anywhere. If relative paths are used, they are relative to the catalog root directory. OrderProfile etc/profiles.order etc/profiles.login The actions defined here are also used for mv_click actions if there is no action defined in scratch space. They are accessed by setting the mv_order_profile variable to the name of the order profile. Multiple profiles can reside in the same file, if separated by __END__ tokens, which must be on a line by themselves. The profile is named by placing a name following a __NAME__ pragma: __NAME__ billing The __NAME__ must begin the line, and be followed by whitespace and the name. The search profile can then be accessed by . See Advanced Multi-level Order Pages. 3.53. OrderReport ----------------- The location of the simple order report file. Defaults to etc/report. OrderReport /data/order-form 3.54. PageDir ------------- Location of catalog pages. Defaults to the pages subdirectory in the VendRoot directory. PageDir /data/catalog/pages Can be set in the Locale settings to allow different page sets for different locales. 3.55. PageSelectField --------------------- Sets a products database column which can be used to select the on-the-fly template page. This allows multiple on-the-fly pages to be defined. If the field is empty (no spaces), the default flypage will be used. PageSelectField display_page 3.56. ParseVariables -------------------- Determines whether global and catalog variables will be parsed in catalog configuration directives (not including the Variable directive itself, which never parses its settings). Applies only to variables with names in ALL CAPS. Default setting is No. The foundation catalog.cfg turns ParseVariables on and usually expects it to be on. Variable STORE_ID topshop ParseVariables Yes StaticDir /home/__STORE_ID__/www/cat ParseVariables No 3.57. Password -------------- The encrypted or unencrypted password (depending on Variable MV_NO_CRYPT) that will cause internal authorization checks for RemoteUser to allow access. Below is the encrypted setting for a blank password. Password bAWoVkuzphOX. 3.58. PGP --------- If credit card information is to be accepted, and the e-mailed order will go over an insecure network to reach its destination, PGP security should be used. The key ring to be used must be for the user that is running the Interchange server, or defined by the environment variable PGPPATH, and the key user specified must have a key on the public key ring of that user. PGP /usr/local/bin/pgp -feat orders@company.com If this directive is non-null, the PGP command string as specified will be used to encrypt the entire order in addition to any encryption done as a result if CreditCardAuto. If, for some reason, an error comes from PGP, the customer will be given the special page failed. If a Route is set up to supplant, this is ignored. 3.59. Pragma ------------ Sets the default value of an Interchange pragma. The directive is set like this: Pragma my_pragma_name To enable a pragma for only a particular page, set it anywhere in the page: [pragma my_pragma_name] To disable a pragma for a particular page, set it anywhere in the page: [pragma my_pragma_name 0] Descriptions of each pragma follow. dynamic_variables dynamic_variables_file_only init_page Defines a Sub or GlobalSub which will run before page Variable processing. A *reference* to the contents of the page is passed to the routine. For instance, if a page was found that did not have a @_VARIABLE_@ in it, you could wrap it with a template: Pragma init_page=wrap_page Sub <} and $Scratch->{page_title} = $1; $$pref = < $$pref \@_MYTEMPLATE_BOTTOM_\@ EOF return; } EOS post_page Defines a Sub or GlobalSub which will run after page Variable processing but before tag interpolation. A o reference* to the contents of the page is passed to the routine. Example -- you want your users to be able to edit pages and just put in . You can use post_page to handle this. To do so, put in catalog.cfg: Pragma post_page=relative_urls ### Take hrefs like and make relative to current ### directory Sub <var('MV_PAGE', 1); pop @dirs; my $basedir = join "/", @dirs; $basedir ||= ''; $basedir .= '/' if $basedir; my $sub = sub { my ($entire, $pre, $url) = @_; return $entire if $url =~ /^\w+:/; my($page, $form) = split /\?/, $url, 2; my $u = $Tag->area({ href => "$basedir$page", form => $form, }); return qq{$pre"$u"}; }; $$page =~ s{ ( ( ]+?\s+)? href \s*=\s* ) (["']) ([^\s"'>]+) \3 )} { $sub->($1,$2,$4) }gsiex; return; } EOR pre_page Defines a Sub or GlobalSub which will run after page Variable processing but before tag interpolation. A o reference* to the contents of the page is passed to the routine. no_image_rewrite Prevents image locations in pages from being altered by Interchange. Added in Interchange 4.7.0. Interchange normally rewrites image locations to point to ImageDir. This applies to image locations mentioned in , , , , and . When this pragma is not set, the following tag: Would, assuming an ImageDir set to /foundation/images, be transformed into: When pragma no_image_rewrite is set, the tag would remain unchanged. safe_data By default Interchange does not allow data returned from databases to be reparsed for Interchange tags. Setting the safe_data pragma eliminates this restriction. If for some reason you want to have tags in your database, for example, to use [page ...] for catalog-internal hyperlinks in your product descriptions, you need to enable safe_data. Some things to consider: 1. It may be better to use the safe_data attribute available to certain tags instead of the pragma, or perhaps to use [pragma] for a whole page or [tag pragma] ... [/tag] for a small block, instead of a catalog-wide Pragma directive. 2. In any case it is strongly recommended that you surround the area with [restrict] ... [/restrict] tags to allow only the specific (hopefully relatively safe) set of tags you expect to appear, such as [page] or [area]. Expect security compromises if you allow [calc] or [perl], or other extremely powerful tags. 3. Be certain that you know everywhere the data in your database will be used. Will it always be possible to reparse for tags? What about when it's used to create an emailed plain-text receipt -- will a literal '[page ...]' tag show up in the product description on the receipt? Would the desired output of '' be any better in a plaintext situation? What if you access your database from applications other than Interchange? You'll then have to decide what to do with such tags; perhaps you can simply strip them, but will the missing tag output cause you any trouble? In short, safe_data is disabled by default for a reason, and you should be very careful if you decide to enable it. (Watch out for parse order with [tag pragma] or [restrict] when used with lists that retrieve data from the database, as in [PREFIX-*] and the flypage. Loops parse before regular tags like [tag] and [restrict], and thus aren't affected by it.) strip_white Set this to strip whitespace from the tops of HTML pages output by Interchange. Such whitespace usually comes from Interchange tags at the top of the page. The pragma's purpose is mostly to make 'view source' in the browser a slightly more tolerable experience. Default is off; whitespace is unchanged. 3.60. PriceCommas ----------------- If no commas are desired in price numbers (for the [item-price] tag), set this to No. The default is to use commas (or whatever is the thousands separator for a locale). PriceCommas no This is overridden if a Locale price_picture is set. 3.61. PriceDivide ----------------- The number the price should be divided by to get the price in units (dollars or such). The default is one. If penny pricing is used, set it to 100. PriceDivide 100 Can be set in the Locale settings to allow a price adjustment factor for different currencies. 3.62. PriceField ---------------- The field in the product database that will be accessed with the [item-price] element. Default is "price." PriceField ProductPrice Can be set in the Locale settings to allow different price fields for different currencies. 3.63. ProductDir ---------------- Location of the database files. Defaults to the products subdirectory of the VendRoot directory. May not be set to an absolute directory unless NoAbsolute is defined as No. ProductDir /data/catalog/for-sale Most people never set this directive and use the default of products. 3.64. ProductFiles ------------------ Database tables that should be seen as the "products" database. ProductFiles vendor_a vendor_b The key thing about this is that each will be searched in sequence for a product code to order or an [item-field ....] or [loop-field ...] to insert. The main difference between [item-field ....] and [item-data table ...] is this fall-through behavior. Default is products. 3.65. ReadPermission and WritePermission ---------------------------------------- By default, only the user account that Interchange runs under (as set by the SETUID permission on vlink) can read and write files created by Interchange. WritePermission and ReadPermission can be set to user, group, or 'world'. ReadPermission group WritePermission group 3.66. RemoteUser ---------------- The value of the HTTP environment variable REMOTE_USER that will enable catalog reconfiguration. HTTP basic authentication must be enabled for this to work. Default is blank, disabling this check. RemoteUser interchange 3.67. Replace ------------- Causes a directive to be emptied and re-set (to its default if no value is specified). Useful for directives that add to the value by default. Replace NoCache ord special multi reconfig query Capitalization must be exact on each directive. 3.68. Require ------------- Forces a Perl module, global UserTag, or GlobalSub to be present before the catalog will configure. This is useful when transporting catalogs to make sure they will have all needed facilities. Require usertag email Require globalsub form_mail Require module Business::UPS 3.69. RobotLimit ---------------- The RobotLimit directive defines the number of consecutive pages a user session may access without a 30 second pause. If the limit is exceeded, the command defined in the Global directive LockoutCommand will be executed and catalog URLs will be rewritten with host 127.0.0.1, sending the robot back to itself. The default is 0, disabling the check. RobotLimit 200 3.70. Route ----------- Sets up order routes. See Custom Order Routing. There are examples in the demo simple. 3.71. SalesTax -------------- If non-blank, enables automatic addition of sales tax based on the order form. The value is one of three types of values: multi The special value "multi" enables table-based lookup of taxing rates based on the value of user form values, by default country and state. [itl-tags] If the value has a left square bracket, it is interpolated for ITL tags and the result used as the amount of the salestax. var1, var2 A comma-separated list of the field names (as placed in the checkout page, for example ord/checkout.html) in priority order. These are be used to look up sales tax percentage in the salestax.asc ASCII table. (This table is not supplied with Interchange.) SalesTax zip state 3.72. SalesTaxFunction ---------------------- A Perl subroutine that will return a hash reference with the sales tax settings. This can be used to query a database for the tax for a particular vendor: SalesTaxFunction <{source}; my $tax = $TextSearch->hash( { se => $vendor_id, fi => 'salestax.asc', sf => 'vendor_code', ml => 1000, } ); $tax = {} if ! $tax; $tax->{DEFAULT} = 0.0; return $tax; EOR or simply produce a table: SalesTaxFunction < 0.0, IL => 0.075, OH => 0.065, }; EOR A DEFAULT value must always be returned or the function will be ignored. 3.73. SaveExpire ---------------- The default amount of time that a cookie will be valid (other than the MV_SESSION_ID cookie). The ones used in Interchange by default are MV_USERNAME and MV_PASSWORD for the CookieLogin feature. Specified the same as SessionExpire, with an integer number followed by one of minutes, hours, days, or weeks. SaveExpire 52 weeks Default is 30 days. 3.74. ScratchDefault -------------------- The default scratch variable settings that the user will start with when their session is initialized. To disable placing URL rewrite strings after the user has given a cookie, set: ScratchDefault mv_no_session_id 1 ScratchDefault mv_no_count 1 ScratchDefault mv_add_dot_html 1 To set the default locale: ScratchDefault mv_locale de_DE 3.75. ScratchDir ---------------- The directory where temporary files will be written, notably cached searches and retired session IDs. Defaults to tmp in the catalog directory. ScratchDir /tmp 3.76. SearchProfile ------------------- Allows an unlimited number of search profiles to be set up, specifying complex searches based on a single click. The directive accepts a file name based in the catalog directory if the path is relative: SearchProfile etc/search.profiles As an added measure of control, the specification is evaluated with the special Interchange tag syntax to provide conditional setting of search parameters. The following file specifies a dictionary-based search in the file 'dict.product': __NAME__ dict_search mv_search_file=dict.product mv_return_fields=1 [if value fast_search] mv_dict_limit=-1 mv_last=1 [/if] __END__ The __NAME__ is the value to be specified in the mv_profile variable on the search form, as in or with mp=profile in the one-click search. [page scan se=Renaissance/mp=dict_search]Renaissance Art Multiple profiles can reside in the same file, if separated by __END__ tokens. __NAME__ tokens should be left-aligned, and __END__ must be on a line by itself with no leading or trailing whitespace. 3.77. SecureURL --------------- The base URL for secure forms/page transmissions. Normally it is the same as VendURL except for the https: protocol definition. Default is blank, disabling secure access. SecureURL https://machine.com/xyzcorp/cgi-bin/vlink 3.78. SendMailProgram --------------------- The location of the sendmail binary, needed for mailing orders. Must be found at startup. This often needs to be set for FreeBSD or BSDI. SendMailProgram /usr/sbin/sendmail If set to none, no mail can be sent by standard Interchange facilities. The default is the value in interchange.cfg and varies depending on operating system. 3.79. SeparateItems ------------------- Changes the default when ordering an item via Interchange to allowing multiple lines on the order form for each item. The default, No, puts all orders with the same part number on the same line. Setting SeparateItems to Yes allows the item attributes to be easily set for different instances of the same part number, allowing easy setting of things such as size or color. SeparateItems Yes Can be overridden with the mv_separate_items variables (both scratch and values). 3.80. SessionDatabase --------------------- When storing sessions, specify the name of the directory or DBM file to use. The file extensions of .db or .gdbm (depending on the DBM implementation used) will be appended. If the default file-based sessions are used, it is the name of the directory. SessionDatabase session-data Can be an absolute path name, if desired. It is possible for multiple catalogs to share the same session file, as well as for multiple Interchange servers to serve the same catalogs. If serving a extremely busy store, multiple parallel Interchange servers can share the same NFS-based file system and serve users in a "ping-pong" fashion using the file-based sessions. On huge systems, the level of directory hashing may be changed. By default, only 48 * 48 hashing is done. See the source for SessionFile.pm. 3.81. SessionDB --------------- The name of the Interchange database to be used for sessions if DBI is specified as the session type. This is not recommended. 3.82. SessionExpire ------------------- A customer can exit the browser or leave the catalog pages at any time, and no indication is given to the web server aside from the lack of further requests that have the same session ID. Old session information needs to be periodically expired. The SessionExpire specifies the minimum time to keep track of session information. Defaults to one day. Format is an integer number, followed by s(econds), m(inutes), h(ours), d(ays), or w(eeks). SessionExpire 20 minutes If CookieLogin is in use, this can be a small value. If the customer's browser has the Interchange session cookie stored, he/she will be automatically logged back in with the next request. Note, however, that the customer's cart and session values will be reset. 3.83. SessionLockFile --------------------- The file to use for locking coordination of the sessions. SessionLockFile session-data.lock This only applies when using DBM-based sessions. It is possible for multiple catalogs to share the same session file. SessionDatabase needs to be set appropriately if the database is to be shared. Defaults to session.lock, which is appropriate for separate session files (and therefore standalone catalogs). Can be an absolute path name, if desired. 3.84. SessionType ----------------- The type of session management to be used. Use one of the following: DB_File Berkeley DB DBI DBI (don't use this, normally) File File-based sessions (the default) NFS File-based sessions, forces use of fcntl locking GDBM GDBM The default is file-based sessions, which provides the best performance and reliability in most environments. If you are planning on running Interchange servers with an NFS-mounted filesystem as the session target, you must set SessionType to "NFS". The other requisites are usually: 1. fcntl() supported in Perl 2. lock daemon running on NFS server system 3. lock daemon running on Interchange server See also the global directive LockType. 3.85. SpecialPage ----------------- Sets a special page to other than its default value. Can be set as many times as necessary. Will have no effect if not one of the Interchange Required Pages. SpecialPage checkout ord/checkout SpecialPage failed special/error_on_order SpecialPage interact special/browser_problem SpecialPage noproduct special/no_product_found SpecialPage order ord/basket SpecialPage search srch/results 3.86. SpecialPageDir -------------------- The directory where special pages are kept. Defaults to special_pages in the catalog directory. SpecialPageDir pages/special 3.87. Static ------------ A Yes/No directive. Enables static page building and display features. Default is No. Static Yes 3.88. StaticAll --------------- A Yes/No directive. Tells Interchange to try and build all pages in the catalog statically when called with the static page build option. This is subject to the settings of StaticFly, StaticPath, and NoCache. Default is No. Pages that have dynamic elements will not be built statically, though that may be overridden with [tag flag build][/tag] on the page in question. StaticAll Yes 3.89. StaticDepth ----------------- The number of levels of static search building that will be done if a search results page contains a search. Default is one, though it could be very long if set higher. Set to 0 to disable re-scanning of search results pages. StaticDepth 2 3.90. StaticDir --------------- The absolute path of the directory which should be used as the root for static pages. The user ID executing Interchange must have write permission on the directory (and all files within) if this is to work. StaticDir /home/you/www/catalog 3.91. StaticFly --------------- A Yes/No directive. If set to Yes, static builds will attempt to generate a page for every part number in the database using the on-the-fly page build capability. If pages are already present with those names, they will be overwritten. The default is No. StaticFly Yes 3.92. StaticPage ---------------- Tells Interchange to build the named page (or pages, whitespace separated) when employing the static page-building capability of Interchange. Not necessary if using StaticAll. StaticPage info/about_us info/terms_and_conditions 3.93. StaticPath ---------------- The path (relative to HTTP document root) which should be used in pages built with the static page-building capability of Interchange. StaticPath /catalog 3.94. StaticPattern ------------------- A perl regular expression which is used to qualify pages that are to be built statically. The default is blank, which means all pages qualify. StaticPattern ^info|^help 3.95. StaticSuffix ------------------ The extension to be appended to a normal Interchange page name when building statically. Default is .html. Also affects the name of pages in the Interchange page directory. If set to .htm, the pages must be named with that extension. StaticSuffix .htm 3.96. Sub --------- Defines a catalog subroutine for use by the [perl][/perl] or [mvasp] embedded perl languages. Use the "here document" capability of Interchange configuration files to make it easy to define: Sub <{quantity} <=> $b->{quantity} } @$items; foreach $item (@$items) { my $code = $item->{code}; $out .= ''; } $out .= '</TABLE>'; return $out; } EOF As with Perl "here documents," the EOF (or other end marker) must be the ONLY thing on the line, with no leading or trailing white space. Do not append a semicolon to the marker. The above would be called with: [perl] my $cart = $Carts->{main}; return sort_cart_by_quantity($cart); [/perl] and will display an HTML table of the items in the current shopping cart, sorted by the quantity. Syntax errors will be reported at catalog startup time. Catalog subroutines may not perform unsafe operations. The Safe.pm module enforces this unless global operations are allowed for the catalog. See AllowGlobal. 3.97. Suggests -------------- Generates a warning message when a Perl module, global UserTag, or GlobalSub is not present at catalog configuration time. Same as the Require directive except not fatal. Suggest usertag table_editor Suggest globalsub file_info Suggest module Business::UPS 3.98. TableRestrict ------------------- Used to provide "views" in database-based searches. Does not affect the text searches. Affects the table being searched. Takes the form of field=session_param, where field is a column in the table being iterated over, and session_param is a $Session key (i.e., [data session username]). TableRestrict products owner=username The above would prevent the database search from returning any records except those where the column owner contains the current value of [data session username]. Probably most usefully set by embedded Perl code in certain situations. For example: [calc] # Restrict edit to owned fields $Config->{TableRestrict}{products} = 'owner=username'; return; [/calc] When using SQL-based databases, in effect it turns the base search query select * from products into select * from products where owner = '[data session username]' Interchange databases are similarly affected, though the methodology is different. Also may be useful in "mall" situations, where user is allowed to only see products from the current store ID. 3.99. TaxShipping ----------------- A comma or space-separated list of states or jurisdictions that tax shipping cost, i.e., UT. Blank by default, never taxing shipping. TaxShipping UT,NV,94024 3.100. TemplateDir ------------------ Sets one or more directories (separated by whitespace) which will be searched (in order) for pages not found in the PageDir. If a page is not found in directories specified here, the search continues with the global TemplateDir setting, if defined. TemplateDir /var/lib/interchange/foundation/bonus_pages This is undefined by default. 3.101. TrackFile ---------------- Name of a logfile that tracks user traffic. This is used in the back office administration report on traffic by affiliate. The default is that no such file is kept. See Usertracking for more information. 3.102. UpsZoneFile ------------------ The file containing the UPS zone information, specified relative to the catalog directory unless it begins with a /. It can be in the format distributed by UPS or can be in a tab-delimited format, with the three-letter zip prefix of the customer used to determine the zone. It interpolates based on the value in mv_shipmode. A user database named the same as the mv_shipmode variable must be present or the lookup will return zero. IMPORTANT NOTE: Zone information and updated pricing from UPS must be obtained in order for this to work properly. The zone information is specific to a region! UpsZoneFile /usr/interchange/data/ups_zone.asc 3.103. UseModifier ------------------ Determines whether any attributes, the modifiers specified in the directive, can be attached to the item. See Item Attributes. The default is no modifier. Don't use a value of quantity or this directive will not work properly. UseModifier size,color Some values are used by Interchange and are not legal: mv_mi mv_si mv_ib group code quantity item 3.104. UserDB ------------- Sets parameters to define the behavior of Interchange's user database functions. Parameter Default Explanation ...................... ....................... ...................... acl acl Set field for simple access control storage addr_field address_book Set field name for address book assign_username 0 Tell interchange to automatically assign username bill_field accounts Set field name for accounts cart_field carts Set field name for cart storage clear_coookie Comma-separated list of cookies to clear on explicit logout clear_session Clear user session completely on logout counter Counter file for assign_username function crypt 1 Encrypt (1) or not encrypt (0) passwords database userdb Sets user database table db_acl db_acl Set field for database access control storage expire_field expiration Set field for expiration date file_acl file_acl Set field for file access control storage force_lower 0 Force possibly upper-case database fields to lower case session variable names ignore_case 0 Ignore case in usernames/passwords indirect_login Log in field if different than real username logfile error.log File to log authentications/errors md5 0 Use MD5 for encryption algorithm instead of crypt no_get 0 Don't get values from database on login no_login 0 Log people in to accounts even if they are already logged in outboard_key_col Set field providing key for outboard tables outboard Set fields that live in another table pass_field password Set field name for password passminlen 2 Minimum length for password pref_field preferences Set field name for preferences scratch Fields to set in user Scratch space (instead of Values) sql_counter SQL counter spec (sequence or AUTO_INCREMENT) for assign_username function super_field super Field to determine superuser status if admin profile time_field time Set field for storing last login time unix_time 0 Set if unix (seconds since 1970) time to go in log files userminlen 2 Minimum length for username username_mask Regular expression usernames must not match These are set in a catalog.cfg file with something like: UserDB default crypt 0 UserDB admin crypt 1 UserDB admin md5 1 where default or admin is the name of the profile to set. These can be overriden if passed in the tag: [userdb userminlen=6 new-account=1] 3.105. UserTag -------------- Defines a catalog-based UserTag that will run under Safe.pm restrictions. For many purposes, a global UserTag (CfgUserTagGlobal) is better. 3.106. ValuesDefault -------------------- Sets the initial state of the user values, i.e., [value key] or $Values->{key}. ValuesDefault fname New ValuesDefault lname User When the user session starts, [value fname] [value lname] will be "New User." 3.107. Variable --------------- Defines a catalog variable that will be available in the current catalog with the notation __VARIABLE__. Variable identifiers must begin with a capital letter, and can contain only word characters (A-Z,a-z,0-9 and underscore). They are case-sensitive. Variable DOCUMENT_ROOT /usr/local/etc/httpd/htdocs Only variables with ALL CAPS names will be parsed in catalog pages or, when the ParseVariables directive is set, in catalog configuration directives (other than in Variable directives themselves). These are substituted second (right after global Variables) in any Interchange page, and can contain any valid Interchange tags except global variables. If a variable is called with the notation @_VARIABLE_@, and there is no catalog Variable with its name, the global Variable value will be inserted. 3.108. VariableDatabase ----------------------- The name of a database containing a field Variable which will be used to set Interchange variable values. For example, a database defined as: Database var var.txt TAB VariableDatabase var and containing code Variable HELLO Hi! would cause __HELLO__ to appear as Hi!. The field name is case-sensitive, and variable would not work. The values are inserted at time of definition. Any single-level hash-oriented Interchange directive, such as SpecialPage, ScratchDefault, or ValuesDefault, can be set in the same way. If the VariableDatabase named does not exist at definition time, a database of the default type with an ASCII file source appending .txt is assumed. In other words: VariableDatabase variable is equivalent to Database variable variable.txt TAB VariableDatabase variable 3.109. VendURL -------------- Specifies the base URL that will run vlink as a cgi-bin program. VendURL http://machine.company.com/cgi-bin/vlink 3.110. WideOpen --------------- Disables IP qualification of user sessions. This degrades catalog security. Do not use unless using encryption or a real-time payment gateway. ______________________________________________________________________ Copyright 2002-2004 Interchange Development Group. Copyright 2001-2002 Red Hat, Inc. Freely redistributable under terms of the GNU General Public License.
'; $out .= $code; $out .= ''; $out .= $Tag->data('products', 'name', $code); $out .= ''; $out .= $Tag->data('products', 'price', $code); $out .= '