=head1 NAME icvariables - Interchange Programmer Variables Reference =head1 DESCRIPTION =head1 Interchange Special Variables Interchange defines some special variables which control behavior. They can be of several types, and the conventions for using them depend on whether you have based your catalog and server on the standard "foundation" distribution. We will distinguish between these by calling intrinsic variables CORE variables, noting the distribution variables as DISTRIBUTION, and noting the foundation catalog practices as FOUNDATION. =over 4 =item "Variable" configuration file definitions =back Defined in interchange.cfg or catalog.cfg with the Variable configuration directive, these are accessed with: Access in ITL with From ----------------------- ------------------- __VARNAME__ (catalog.cfg only) @_VARNAME_@ (catalog.cfg, falls back to interchange.cfg) @@VARNAME@@ (interchange.cfg only) [var VARNAME] (catalog.cfg only) [var VARNAME 1] (interchange.cfg only) [var VARNAME 2] (catalog.cfg, falls back to interchange.cfg) Embedded Perl From ----------------------- ------------------- $Variable->{VARNAME} (catalog.cfg only) $Tag->var('VARNAME') (catalog.cfg only) $Tag->var('VARNAME', 1) (interchange.cfg only) $Tag->var('VARNAME', 2) (catalog.cfg, falls back to interchange.cfg) Global subs / Usertags From ----------------------- ------------------- $::Variable->{VARNAME} (catalog.cfg only) $Tag->var('VARNAME') (catalog.cfg only) $Tag->var('VARNAME', 1) (interchange.cfg only) $Tag->var('VARNAME', 2) (catalog.cfg, falls back to interchange.cfg) $Global::Variable->{VARNAME} (interchange.cfg only, only in Global code) Variables set with I are not normally modified dynamically, though you can do it as a part of the I routine or in other code. They will not retain the value unless I is in use. =over 4 =item Scratch =back User scratch variables are initialized whenever a new user session is created. They start with whatever is defined in the ScratchDefault directive in catalog.cfg; otherwise they are not defined. Access in ITL with Attributes ----------------------- ------------------- [scratch varname] Displays [scratchd varname] Displays and deletes Embedded Perl From ----------------------- ------------------- $Scratch->{varname} Accessor $Session->{scratch}{varname} Equivalent Global subs / Usertags From ----------------------- ------------------- $::Scratch->{varname} Accessor $::Session->{scratch}{varname} Equivalent They can be set in several ways: Set in ITL with Attributes ----------------------- ------------------- [set varname]VAL[/set] Sets to VAL, no interpretation of ITL inside [seti varname]VAL[/seti] Sets to VAL, interprets ITL inside [tmpn varname]VAL[/tmpn] Sets to VAL, no ITL interpretation, temporary [tmp varname]VAL[/tmp] Sets to VAL, interprets ITL inside, temporary Embedded Perl From ----------------------- ------------------- $Scratch->{varname} = 'VAL'; Sets to VAL $Tag->tmp(varname); Set as temporary, must set value afterwards. Global subs / Usertags From ----------------------- ------------------- $::Scratch->{varname}='a' Sets to a =over 4 =item CGI =back CGI variables are the raw data which comes from the user. =over 4 =item WARNING: It is a security risk to use these variables for display in the page. =back You can use them for testing without worry, though you should never set their value into a database or display on the page unless you have processed them first, as they can have arbitrary values. The most common security risk is displaying HTML code, which allows remote scripting exploits like cookie-stealing. [calc] #### DO NOT DO THIS!!!! my $out = $CGI->{varname}; return $out; [/calc] That will transform the value. If you wish to output a safe value but keep the actual value intact, do: [calc] #### This is safe, makes value safe for rest of page my $out = $Tag->cgi( { name => 'varname', filter => 'entities' } ); #### This is safe too, doesn't transform value my $other = $Tag->filter($CGI->{varname}, 'entities'); ### Now you can return stuff to the page return $out . $other; [/calc] The access methods are: Access in ITL with Attributes ----------------------- ------------------- [cgi varname] Doesn't stop ITL code, don't use! [cgi name=varname filter=entities] Use this for safety Embedded Perl From ----------------------- ------------------- $CGI->{varname} Don't use for output values! They can be set as well. Set in ITL with Attributes ----------------------- ------------------- [cgi name=varname set="VAL"] Sets to VAL, VAL can be ITL, shows VAL [cgi name=varname set="VAL" hide=1] Sets to VAL, VAL can be ITL, no output Embedded Perl From ----------------------- ------------------- $CGI->{varname} = 'VAL'; Sets to VAL, next access to [cgi varname] shows new value =over 4 =item Values =back User form variables are initialized whenever a new user session is created. They start with whatever is defined in the I<> directive in catalog.cfg; otherwise they are not defined except as called out in other configuration directives, i.e. the obsolete DefaultShipping. Access in ITL with Attributes ----------------------- ------------------- [value varname] Displays Embedded Perl From ----------------------- ------------------- $Values->{varname} Accessor They can be set as well, though the normal method of setting is from user input via form. If Interchange receives an action which performs the update of values (by default go or return, refresh, or submit), the value of CGI variables will be transferred to them subject to other considerations (FormIgnore settings, credit card variables, etc., discussed below).!block example Set in ITL with Attributes ----------------------- ------------------- [value name=varname set="VAL"] Sets to VAL, VAL can be ITL, shows VAL [value name=varname set="VAL" hide=1] Sets to VAL, VAL can be ITL, no output Embedded Perl Attributes ----------------------- ------------------- $Values->{varname} = 'VAL'; Sets to VAL, next access to [value varname] shows new value =over 4 =item Session variables =back You can also directly access the user session. Normally you don't set these values unless you are an experienced Interchange programmer, but there are several values that are frequently used. One example is username, which holds the logged-in user's username. Access in ITL with Attributes ----------------------- ------------------- [data session username] Displays Embedded Perl From ----------------------- ------------------- $Session->{username} Accessor They can be set as well, but if you are experienced enough to contemplate doing these things you will easily be able to figure it out. =over 4 =item Values not transmitted from CGI =back The following variables are never copied from CGI: mv_todo mv_todo.submit.x mv_todo.submit.y mv_todo.return.x mv_todo.return.y mv_todo.checkout.x mv_todo.checkout.y mv_todo.todo.x mv_todo.todo.y mv_todo.map mv_doit mv_check mv_click mv_nextpage mv_failpage mv_successpage mv_more_ip mv_credit_card_number mv_credit_card_cvv2 You can define more with the FormIgnore catalog.cfg directive. =over 4 =item Global program variables =back If you are programming a GlobalSub or global UserTag, you have access to all Interchange facilities including all the preset variables and configuration directives. The Global package is used to hold variables that are set at program start and whose value is retained. The Vend package is used for variables that might be set at some point during program execution, but that will always be reset to undefined at the end of the transaction. One example is $Vend::Cookie, which holds the raw cookie value sent by the user. If you are going to set or access these variables, you should be getting your documentation from the source code. =head1 IC Variables =head2 Standard global (interchange.cfg) Variable values =over 4 =item I I =back =over 4 =item CGIWRAP_WORKAROUND =back Used in Vend/Dispatch.pm. Implemented to Fix Cobalt/CGIwrap problem. If set to 1, it removes the scriptname from the URL pathinfo. =over 4 =item IMAGE_MOGRIFY =back Used in code/SystemTag/image.tag. Specifies the location of mogrify command. If ImageMagick is installed, you can display an arbitrary size of the image, creating it if necessary. =over 4 =item LANG =item MV_DOLLAR_ZERO =back Used in scripts/interchange.PL. This parameter specifies how Interchange will be displayed in ps command. This may not work on BSD based Kernels. =over 4 =item MV_FILE =back Used in lib/Vend/File.pm. This is the filename of the most recently returned contents. This variable is not set in interchange.cfg, but is set by interchange while interchange is runnning. =over 4 =item MV_GETPPID_BROKEN =back Used in lib/Vend/Server.pm. If configured, the server uses a syscall(MV_GETPPID_PROKEN) instead of the perl function getppid() to find the parent PID. If MV_GETPPID_BROKEN is set to 1, the system uses syscall(64). =over 4 =item MV_MAILFROM =back Used in lib/Vend/Util.pm. If configured, it specifies the default email user address if it has not been set in catalog.cfg or variables.txt. Overrides the MailOrdersTo directive. my $from = $::Variable->{MV_MAILFROM} || $Global::Variable->{MV_MAILFROM} || $Vend::Cfg->{MailOrderTo}; =over 4 =item MV_NO_CRYPT =back Used in lib/Vend/UserDB.pm and lib/Vend/Util.pm. If configured, it disables the use of crypt or md5 hashing of passwords serverwide. =over 4 =item MV_PAGE =back Used systemwide. This is the relative path of the page being served without the suffix. This value is not set in interchange.cfg, but is set by interchange while interchange is running. This is often referenced as @@MV_PAGE@@. =over 4 =item MV_PREV_PAGE =back Used systemwide. This is the relative path of the last (previous) page that was served without the suffix. This value is not set in interchange.cfg, but is set by interchange while interchange is running. This is often referenced as @@MV_PREV_PAGE@@. =over 4 =item MV_SESSION_READ_RETRY =back Used in lib/Vend/Session.pm. This variable specifies the number of times that interchange will attemt to read the session file before failing. The default value is 5. =over 4 =item UI_BASE =back Used systemwide. This variable specifies the relative path to the admin interface. The default value is 'admin'. =over 4 =item UI_IMAGE_DIR =back Used within the admin and by code/SystemTag/image.tag. This variable specifies the relative path to the admin images and CSS definitions. It is set in dist/lib/UI/ui.cfg. The default value is '/interchange-5/'. =over 4 =item UI_IMAGE_DIR_SECURE =back Used within the admin and by code/SystemTag/image.tag. This variable specifies the relative path to the admin images and CSS definitions while connecting via SSL. It is set in dist/lib/UI/ui.cfg. The default value is '/interchange-5/'. =over 4 =item UI_SECURITY_OVERRIDE =back Used in dist/lib/UI/Primitive.pm. If configured and no UI_ACCESS_TABLE found, then it will return that there is an acl set. This would allow you to test acls See sub ui_acl_enabled() for more details. =head2 Standard catalog (catalog.cfg) Variable values =over 4 =item ACTIVE_SESSION_MINUTES =back Used in code/UI_Tag/dump_session.coretag, lib/UI/pages/admin/genconfig.html and lib/UI/pages/admin/show_session.html. This variable overrides the I directive. =over 4 =item ADL_COMPONENT =back Used in lib/UI/ui.cfg. This variable can be overriden by ADL_COMPONENT_TEMPLATE. Apparently not used anywhere. The default is: [page href="admin/content_editor" form=| ui_name=[control component] ui_type=component |][loc]edit[/loc] [control component] =over 4 =item ADL_COMPONENT_TEMPLATE =back Used in lib/UI/ui.cfg. This variable can be used to override ADL_COMPONENT. Apparently not used anywhere. =over 4 =item ADL_ITEM =back Used in lib/UI/ui.cfg. The default is: [loc]edit[/loc] [loc]item[/loc] =over 4 =item ADL_ITEM_TEMPLATE =back Used in lib/UI/ui.cfg. This variable can be used to override ADL_ITEM. Apparently not used anywhere. =over 4 =item ADL_MENU =back Used in foundation/templates/components/product_flyout, foundation/templates/components/product_tree and lib/UI/ui.cfg. The default value is: $::Variable->{ADL_MENU} = $::Variable->{ADL_MENU_TEMPLATE} || <[loc]edit[/loc] [loc]menu[/loc] =over 4 =item ADL_MENU_TEMPLATE =back Used in lib/UI/ui.cfg. This variable can be used to override ADL_MENU. Apparently not used anywhere. =over 4 =item ADL_PAGE Used in the foundation templates LEFTONLY_BOTTOM,LEFTRIGHT_BOTTOM, and NOLEFT_BOTTOM and lib/UI/ui.cfg. This variable defines how the admin edit page links are displayed. =back The default is: [page href="admin/content_editor" form=" ui_name=[var MV_PAGE 1][var ADL_SUFFIX] ui_type=page "][loc]edit[/loc] [loc]page[/loc] [page href="[var MV_PAGE 1]" form=" ui_mozilla_edit=1 "][loc]show tags[/loc] =over 4 =item ADL_MENU_TEMPLATE =back Used in lib/UI/ui.cfg. This variable can be used to override ADL_PAGE. =over 4 =item ADL_SUFFIX =back Used in lib/UI/ui.cfg. It defaults to the value of the [I] directive. It specifies the page suffix for links coming from ADL_PAGE at the bottom of the foundation template files. =over 4 =item BACKUP_DIRECTORY =back Used in code/UI_Tag/backup_database.coretag. This variable will override where the backup_database tab places the database backups. By default, the backups are placed in /backup. =over 4 =item BAR_LINK_TEMPLATE =back Used in the bar_link subroutine found in catalog_before.cfg. It defines how the links are displayed in the foundation/templates/components/category_horizontal, foundation/templates/components/category_vert_toggle and foundation/templates/components/category_vertical The default value is configured in variables.txt. The default is: $ANCHOR$ =over 4 =item CREATE_COMMAND_MYSQL =back Used in code/UI_Tag/xfer_catalog.coretag. It allows one to override the command that is used create tables under mysql. The default is 'mysqladmin create %s'. =over 4 =item CREATE_COMMAND_PG =back Used in code/UI_Tag/xfer_catalog.coretag. It allows one to override the command that is used create tables under PostgresSQL. The default is 'createdb %s'. =over 4 =item CUSTOMER_VIEW_LARGE =back Used in lib/UI/pages/admin/customer.html. It allows one to select not to build huge lists of customers every time you access the customer tab. The default is 0. =over 4 =item CYBER_ID =back Used in eg/globalsub/authorizenet, eg/globalsub/signio and lib/Vend/Payment/ECHO.pm. It specifies the vendor's ID for communicating with a payment gateway. =over 4 =item CYBER_PORT =back Used in eg/globalsub/authorizenet, eg/globalsub/signio and lib/Vend/Payment.pm. Specifies the port over which to communicate with the gateway server. =over 4 =item CYBER_PRECISION =back Used in eg/globalsub/authorizenet, eg/globalsub/signio, lib/Vend/Payment.pm and lib/Vend/Payment/ECHO.pm. It defines the precision of (the number of decimal points) used with the vendor gateway. If not defined, the default is 2. =over 4 =item CYBER_SCRIPT =back Used in eg/globalsub/authorizenet. It defines the path of the program on the payment gateway. if not set, it uses the default of '/gateway/transact.dll'. It is overriden by MV_PAYMENT_SCRIPT =over 4 =item CYBER_SECRET =back Used in eg/globalsub/authorizenet, eg/globalsub/signio, and lib/Vend/Payment/ECHO.pm. It defines the password the vendor used for autorization to the payment gateway. =over 4 =item CYBER_SERVER =back Used in eg/globalsub/authorizenet, eg/globalsub/signio, and lib/Vend/Payment/ECHO.pm. It overrides the address of the payment gateway. =over 4 =item DUMP_COMMAND_MYSQL =back Used in code/UI_Tag/xfer_catalog.coretag. It allows one to override the command that is used create tables under mysql. The default is 'mysqldump --add-drop-table'. =over 4 =item DUMP_COMMAND_PG =back Used in code/UI_Tag/xfer_catalog.coretag. It allows one to override the command that is used create tables under PostgresSQL. The default is 'pg_dump -c -O'. =over 4 =item ECHO_PAYMENT_ID =back Used in lib/Vend/Payment/ECHO.pm. Specifies your ECHO ID. =over 4 =item ECHO_PAYMENT_PRECISION =back Used in lib/Vend/Payment/ECHO.pm. Specifies the number of digits of precision for the gateway. =over 4 =item ECHO_PAYMENT_SECRET =back Used in lib/Vend/Payment/ECHO.pm. Specifies the password used to indentify the vendor. =over 4 =item ECHO_PAYMENT_SERVER =back Used in lib/Vend/Payment/ECHO.pm. Specifies the address of the payment gateway. =over 4 =item FORUM_EMAIL_NOTIFY =back Used in foundation/pages/forum/reply.html. It is initially set to __MVC_EMAILSERVICE__ when the catalog is initially created. =over 4 =item FORUM_SUBMIT_EMAIL =back Used in foundation/pages/forum/submit.html. It specifies the email address that the forum submission should be sent to. =over 4 =item LANG =back Used in lib/Vend/Dispatch.pm and lib/Vend/File.pm. =over 4 =item MV_AUTOLOAD =back Used in lib/Vend/Interpolate.pm. It specifies the value to be placed in the beginning of the html if the $Vend::PageInit is defined and not 0. =over 4 =item MV_COMPONENT_DIR =back Used in code/UserTag/component.tag. If defined, it specifies a directory location where the components will be located. If not defined, code/UserTag/component.tag looks in templates/components. =over 4 =item MV_COUNTRY_FIELD =back Used in lib/Vend/Interpolate.pm. If defined, it specifies the field to be used in tax/vat calculations. If undefined, the value 'country' is used. =over 4 =item MV_COUNTRY_TABLE =back Used in lib/Vend/Interpolate.pm. If defined, it specifies the table to be used in tax/vat calculations. If undefined, the value 'country' is used. =over 4 =item MV_COUNTRY_TAX_FIELD =back Used in lib/Vend/Interpolate.pm. If defined, it specifies the field used to look up the tax. If undefined, the value 'tax' is used. =over 4 =item MV_CREDIT_CARD_INFO_TEMPLATE =back Used in sub build_cc_info() in /lib/Vend/Order.pm. If not defined, the following template is used: join("\t", qw( {MV_CREDIT_CARD_TYPE} {MV_CREDIT_CARD_NUMBER} {MV_CREDIT_CARD_EXP_MONTH}/{MV_CREDIT_CARD_EXP_YEAR} {MV_CREDIT_CARD_CVV2} )) . "\n"; =over 4 =item MV_DEFAULT_SEARCH_DB =back Used in lib/Vend/Scan.pm. Specifies that an unspecified (default) search will be a db search, not a text search. It is set to 1 in variable.txt =over 4 =item MV_DEFAULT_SEARCH_FILE =back Used in lib/Vend/Config.pm, lib/Vend/Glimpse.pm and lib/Vend/TextSearch.pm. It specifies the file to be used for text searches by default. It is set to products in catalog_before.cfg and foundation/catalog.cfg. =over 4 =item MV_DEFAULT_SEARCH_TABLE =back Used in lib/Vend/Config.pm, lib/Vend/DbSearch.pm and lib/Vend/RefSearch.pm. It specifies the table to be used for searches by default. It is set to products in catalog_before.cfg and foundation/catalog.cfg. =over 4 =item MV_ERROR_STD_LABEL =back Used in code/SystemTag/error.coretag. If defined, it overrides the default error imessage in the stdlabel field. If undefined, the following template is used. {LABEL} (%s) [else]{REQUIRED }{LABEL}{REQUIRED }[/else] =over 4 =item MV_NO_CRYPT =back Used in lib/Vend/UserDB.pm and lib/Vend/Util.pm. If configured, it disables the use of crypt or md5 hashing of passwords for the individual catalog. =over 4 =item MV_OPTION_TABLE_MAP =back Used in lib/Vend/Config.pm, lib/Vend/Data.pm and lib/Vend/Options/Old48.pm. It is a quoted space-delimited list of fields in the form of "field1=field2" to map options into. =over 4 =item MV_OPTION_TABLE =back Used in foundation/products/variable.txt, lib/UI/pages/admin/item_option_phantom.html, lib/UI/pages/admin/item_option_old.html, lib/UI/ui.cfg, lib/Vend/Config.pm, lib/Vend/Options.pm and lib/Vend/Options/Simple.pm. If the Interchange variable MV_OPTION_TABLE is not set, it defaults to "options", which combines options for Simple, Matrix, and Modular into that one table. This goes along with foundation and construct demos up until Interchange 4.9.8. =over 4 =item MV_PAYMENT_ID =back Used in eg/globalsub/authorizenet, eg/globalsub/signio, /foundation/catalog.cfg, /foundation/products/variable.txt, lib/Vend/Payment/AuthorizeNet.pm, lib/Vend/Payment/BoA.pm, lib/Vend/Payment/ECHO.pm, lib/Vend/Payment/PSiGate.pm, lib/Vend/Payment/Signio.pm, lib/Vend/Payment/Skipjack.pm, lib/Vend/Payment/TestPayment.pm, lib/Vend/Payment/WellsFargo.pm, lib/Vend/Payment/iTransact.pm. Specifies your merchant ID for your payment gateway. =over 4 =item MV_PAYMENT_MODE =back Payment Gateway Which payment processor module you wish to use. The default value is not set. Valid values are : authorizeneti, boa, echo, mcve, psigate,signio, skipjack, trustcommerce, testpayment, wellsfargo, itransact and linkpoint. =over 4 =item MV_PAYMENT_PRECISION =back Specifies the number of digits of precision for the gateway. =over 4 =item MV_PAYMENT_SECRET =back Specifies the password used to indentify the vendor. =over 4 =item MV_PAYMENT_SERVER =back Specifies the address of the payment gateway. =over 4 =item MV_PAYMENT_TEST =back Used in eg/globalsub/authorizenet, lib/Vend/Payment/AuthorizeNet.pm and lib/Vend/Payment/PSiGate.pm. Specifies that the gateway is in testing mode. =over 4 =item MV_SHIP_ADDRESS_TEMPLATE Used in lib/Vend/Interpolate.pm. Overrides the default template used in tag_address(). =back If not set, the template used is: $template .= "{company}\n" if $addr->{"${pre}company"}; $template .= <