From a79348ff0a8af6d59696ee31fd7a293707989a84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=A6=8C=EA=A6=AB=EA=A6=B6=EA=A6=8F=EA=A7=80=EA=A6=A6?= =?UTF-8?q?=EA=A6=BF=EA=A6=A7=EA=A6=AE=EA=A6=91=EA=A6=A9=EA=A6=AD=EA=A7=80?= Date: Sun, 4 Jul 2021 18:52:14 +0800 Subject: Separated web code --- catalog.cfg | 750 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 750 insertions(+) create mode 100644 catalog.cfg (limited to 'catalog.cfg') diff --git a/catalog.cfg b/catalog.cfg new file mode 100644 index 0000000..45ad3be --- /dev/null +++ b/catalog.cfg @@ -0,0 +1,750 @@ +#==========================================================================# + +# catalog.cfg + +#==========================================================================# + +## We want to hide the .gdbm, .autonumber, .numeric, .sql, .db files +## Needs to go before VariableDatabase +DatabaseDefault HIDE_AUTO_FILES 1 + +# Read in some initial default variables from a directory. These are +# larger ones -- they could conceivably be maintained in the +# VariableDatabase but might be easier to maintain in a file, especially +# for development. +# +# Notable settings: COMMON_MENU, COPYRIGHT +# +DirConfig Variable variables + +# Read in large variables or dynamic variables from a series +# of files in a directory +VariableDatabase variable + +# Read in site-specific variables from a database (if any). +# Used to create a information for a temporarily transferred +# catalog, i.e. for development. +# +# Ignored if file doesn't exist. +VariableDatabase site + +# Warn if any important modules or usertags are missing. + +Require module Digest::MD5 "Need %s %s for better cache keys." +Require module Safe::Hole "Need %s %s for embedded perl object access." + +# Encoding +Variable MV_UTF8 1 +Variable MV_HTTP_CHARSET utf-8 + +#==========================================================================# + +# Can send various files outside the catalog directory, for disk partition +# reasons, for example. + +ParseVariables Yes + +ifdef LOGDIR +ErrorFile __LOGDIR__/error.log +AsciiTrack __LOGDIR__/tracking.asc +#TrackFile __LOGDIR__/usertrack +endif + +ifndef LOGDIR +AsciiTrack logs/tracking.asc +#TrackFile logs/usertrack +endif + +ifdef CACHEDIR +SessionDatabase __CACHEDIR__/session +ScratchDir __CACHEDIR__/tmp +endif + +ifndef CACHEDIR +SessionDatabase session +ScratchDir tmp +endif + +ifdef RUNDIR +RunDir __RUNDIR__ +endif + +#==========================================================================# + +# Database setup + +ParseVariables Yes + +ifndef INDEV +DatabaseDefault LOG_ERROR_SESSION 0 +endif + +## Quote all identifiers to avoid name clash issues and SQL injection attacks +DatabaseDefault QUOTE_IDENTIFIERS 1 + +ifdef MYSQL +DatabaseDefault NO_ASCII_INDEX 1 +include dbconf/mysql/mysql.cfg +endif + +ifdef PGSQL +DatabaseDefault NO_ASCII_INDEX 1 +include dbconf/pgsql/pgsql.cfg +endif + +ifdef SQLITE +DatabaseDefault NO_ASCII_INDEX 1 +include dbconf/sqlite/sqlite.cfg +endif + +# Default DBM if nothing else defined +ifndef SOME_DATABASE +Require We_need_a_database "%s, must have either MySQL or Postgres" +endif + +### Uncomment these for DBI sessions +# SessionType DBI +# SessionDB sessions +# Database sessions sessions.txt __SQLDSN__ +# NoImport sessions + +### You can change the length of the session ID. Must be integer between +### 8 and 32. +# Limit session_id_length 8 + +#==========================================================================# + +# The URLs which are written to refer back to our catalog. + + + +VendURL http://__SERVER_NAME____CGI_URL__ +SecureURL __SECURE_SERVER____CGI_URL__ + +ifndef SECURE_ENABLE +SecureURL http://__SERVER_NAME____CGI_URL__ +endif + +# Set the image path for relative images +ImageDir __IMAGE_DIR__/ +ImageDirInternal http://__SERVER_NAME____IMAGE_DIR__/ + + + +#==========================================================================# + +# Here we set up the catalog theme. + + + +## +## Here we pick up the region variables like LEFTONLY_TOP and LEFTONLY_BOTTOM. +## +## Commenting; new variables TOP and BOTTOM will be defined in variable directory. +## No longer going to need multiple leftright_top, leftonly_top, etc; will be +## defined in "display_class" in each page. + +#DirConfig Variable templates/regions + +# TRAFFIC is defined system-wide in interchange.cfg. When in low-traffic +# mode, variables are dynamic -- i.e. when you change the region file +# the page changes. Otherwise a reconfig must be done to change the +# variable. +# +# Careful, this can change the way *other* variables are interpreted. +ifdef @TRAFFIC =~ /low/i +Pragma dynamic_variables +Pragma dynamic_variables_file_only +endif + +# Provide some links for the admin to edit pages if we have the UI in +ifdef @UI +Autoload admin_links +endif + +#==========================================================================# + +# Internationalization +LocaleDatabase locale + +# Default locale +ifdef DEFAULT_LOCALE +DefaultLocale __DEFAULT_LOCALE__ +endif + +ifdef DEFAULT_LOCALE +# Database definitions for localized databases +include dbconf/locales/{__LOCALES__}.cfg +endif + +Locale en_US currency_symbol Rp +Locale en_US mon_decimal_point "" +Locale en_US frac_digits 0 + +Locale id_ID currency_symbol Rp +Locale id_ID p_cs_precedes 1 +Locale id_ID mon_thousands_sep . +Locale id_ID mon_decimal_point "" +Locale id_ID frac_digits 0 + +#==========================================================================# + +# Various catalog settings. + +ScratchDefault mv_add_dot_html 0 +ScratchDefault mv_no_session_id 1 +ScratchDefault mv_no_count 1 + +ifdef DEFAULT_COUNTRY +ValuesDefault country __DEFAULT_COUNTRY__ +ValuesDefault b_country __DEFAULT_COUNTRY__ +endif + +ValuesDefault fname Pengguna lname Baru + +DirectoryIndex index.html +SpecialPage catalog index +SpecialPage violation ../special_pages/violation +SpecialPage put_handler admin_publish +SpecialPage report ../etc/report +SpecialPage receipt ../etc/receipt + +# Allow others in our group to read/write files by default +ReadPermission group +WritePermission group + +# Don't send X-Track HTTP response header +UserTrack no + +# If a specific user session accesses this catalog more than this many +# times with no pauses of 30 seconds or more, the LockoutCommand (if set) +# is executed. Set this to 0 if you're getting links to 127.0.0.1 +# during your testing. +RobotLimit 100 + +# We also count the number of accesses from the same IP address. More than +# RobotLimit accesses within a one hour period will cause a Forbidden result. +# Uncomment the following line to change the 1 hour period to 30 minutes. +# Limit ip_session_expire 30 + +# The default lockout time is one day. Uncomment the following line to change +# it to just under an hour. +# Limit robot_expire 0.04 + +# Strip whitespace from top of pages so you don't have to scroll down +# before the HTML starts when doing 'view source' in a browser. +Pragma strip_white + +# Don't allow +Pragma no_html_comment_embed + +## DATA INSERTION PRAGMAS for form database inserts or updates + +## Restricts inserts to insert-only, but allows the fall-through +## behavior from update to insert. No existing data will be clobbered. +# Pragma dml=preserve + +## Pragma 'dml=strict' forces update or insert to only perform the +## requested action. +# Pragma dml=strict + +## Pragma 'dml=upsert' (the default) preserves Interchange's original +## method of doing an update if the record exists, otherwise doing an +## insert. This can clobber an existing key. +# Pragma dml=upsert + +## END DATA INSERTION PRAGMAS + +#==========================================================================# + +# User session related settings. + +# Whether to encrypt passwords in UserDB +UserDB default crypt 1 +UserDB default bcrypt 1 + +# These 2 lines are needed for query/pw_reset +UserDB default promote 1 +UserDB default from_plain 1 + +# The pepper should be unique for your site, but note that if you change this, +# it will make previously-crypted passwords inaccessible -- +# so set this before you start adding users, or don't set at all. +UserDB default bcrypt_pepper __BCRYPT_PEPPER__ + +# Set to 1 to make the username and password case-insensitive +UserDB default ignore_case 1 + +# Change a field to something that doesn't conflict in MySQL +UserDB default time_field mod_time + +# Don't want people setting their credit limit or dealer status directly +UserDB default scratch "dealer price_level credit_limit usernick" +UserDB default expire_field expiration + +# Update the database with the date when creating a user +UserDB default created_date_iso created + +# Update the database with the date when updating a user via set_values +UserDB default updated_date_iso updated + +# Set some other things you want to retain but which don't deserve their +# own field -- stored in serial field preferences +UserDB default extra_fields <{state_cs_in} && !$CGI->{state}){ + $CGI->{state} = $CGI->{state_cs_in}; + } + return; + [/calc] + mv_same_billing=always_pass + fname=required + lname=required + address1=required + address2=always_pass + city=required + country=required + state=multistate + zip=multizip + phone_day=phone + [if !session logged_in]email=email_only[/if] +EOV +endif + +## Payment-related stuff + +EncryptKey __PGP_KEY__ + +## These routes are not order routes, but payment routes +Route authorizenet id "__MV_PAYMENT_ID__" +Route authorizenet secret "__MV_PAYMENT_SECRET__" +Route authorizenet host "__MV_PAYMENT_HOST__" +Route authorizenet referer "__MV_PAYMENT_REFERER__" + +Route itransact id "__MV_PAYMENT_ID__" + +Route netbilling id "__MV_PAYMENT_ID__" +Route netbilling secret "__MV_PAYMENT_SECRET__" + +Route signio id "__MV_PAYMENT_ID__" +Route signio secret "__MV_PAYMENT_SECRET__" +Route signio partner "__MV_PAYMENT_PARTNER__" +Route signio vendor "__MV_PAYMENT_VENDOR__" +Route signio host "__MV_PAYMENT_HOST__" + +Route skipjack id "__MV_PAYMENT_ID__" +Route skipjack partner "__MV_PAYMENT_PARTNER__" + +Route linkpoint id "__MV_PAYMENT_ID__" +Route linkpoint host "__MV_PAYMENT_HOST__" +Route linkpoint keyfile "__MV_PAYMENT_SECRET__" + +# This prevents a user from setting this value, you may want to unset +# this if you have user-selectable handling charges like insurance +FormIgnore mv_handling +# +# + +# Along these lines further, for better integrity and less chance of a +# user screwing up your order routes: +# Note that __ORDER_ROUTES__ is empty by default, default Route "default" +# is used with cascades +FormIgnore mv_order_route + +## This route places the order entry in the database. If you don't +## have an inventory table (or a userdb table for that matter) make +## sure you remove it from the list of "transactions" tables. + +Route log <{deliverable} = $CGI->{mv_arg}; + $CGI->{mv_nextpage} = 'deliver'; + if(! $Session->{username} and $CGI->{mv_username}) { + $Tag->userdb('login'); + } + return 1; +} +EOR + +# Pricing setup +# +# If the user is logged in and is marked as a "dealer" (1 in the dealer +# field in the userdb database) then they are given quantity discounts +# based on price groups. (All products are in price group 1 as +# distributed.) If the quantity is 1, then pricing comes from the +# "wholesale" field in the products database. + +AutoModifier pricing:price_group + +# +# If the user is not a dealer (or not logged in) then pricing just comes +# from "price". Any quantity discounts will be set in the qN fields in the +# database, and are separate from dealer quantity discounts. +# + +Profile dealer < < 'nontaxable', +} +EOR + +Profile distributor < < 'nontaxable', +} +EOR + +## This should match the default direct setting below this paragraph +Profile default CommonAdjust "pricing:q5,q10 ;:sale_price, ;:price, ;$, :related, ==:options" +Profile default NonTaxableField +Profile default PriceField 0 + +CommonAdjust pricing:q5,q10 ;:sale_price, ;:price, ;$, :related, ==:options +PriceField 0 + +## This sets the type of options pertaining to the product +OptionsEnable option_type + +## Finally, set which tables products can be ordered from +ProductFiles products variants + +#==========================================================================# + +## Tag which provides a CSS button-looking link +UserTag b-link Order href form +UserTag b-link HasEndTag +UserTag b-link addAttr +UserTag b-link Routine <{no_javascript}) { + $opt->{extra} ||= 'style="font-size: smaller"'; + return $Tag->page($opt) . $anchor . ''; + } + my $class = $opt->{class} || 'btn'; + my $url = $Tag->area($opt); + my $string = $Tag->filter('encode_entities', $anchor); + my @properties; + push @properties, "type=button"; + push @properties, qq{value="$string"}; + push @properties, qq{class="$class"}; + for(qw/style id name/) { + next unless $opt->{$_}; + push @properties, qq{$_="$opt->{$_}"}; + } + push @properties, qq{onClick="window.location='$url'"}; + push @properties, qq{onMouseOver="saveblink=window.status;window.status='$url'"}; + push @properties, qq{onMouseOut="window.status=saveblink"}; + if($opt->{title}) { + $opt->{title} = $Tag->filter('encode_entities', $opt->{title}); + } + else { + $opt->{title} = $string; + } + push @properties, qq{title="$opt->{title}"}; + push @properties, $opt->{extra} if $opt->{extra}; + + return qq{'; +} +EOR + +### Shipping setup. See Interchange docs -- you will want to change +### the origin postal code and default destination postal codes, for sure. +Shipping Postal default_geo 45056 +Shipping QueryUPS default_geo 45056 +Shipping default dir products/ship + +#Database 2ndDayAir ship/2ndDayAir.csv CSV +#Database 2ndDayAirAM ship/2ndDayAirAM.csv CSV +#Database 3DaySelect ship/3DaySelect.csv CSV +#Database Expedited ship/Expedited.csv CSV +#Database Express ship/Express.csv CSV +#Database Ground ship/Ground.csv CSV +#Database NextDayAir ship/NextDayAir.csv CSV +#Database NextDayAirSaver ship/NextDayAirSaver.csv CSV +#Database Xarea ship/Xarea.csv CSV +#Database Zone ship/Zone.csv CSV +#Database usps ship/usps.txt TAB +#Database Book ship/Book.txt TAB +#Database Priority ship/Priority.txt TAB +#Database air_pp ship/air_pp.txt TAB +#Database surf_pp ship/surf_pp.txt TAB +#Database ups_cache ship/ups_cache.txt __SQLDSN__ +#Database ups_cache AUTO_SEQUENCE ups_cache_seq +#Database ups_cache DEFAULT_TYPE varchar(12) +#Database ups_cache INDEX weight origin zip shipmode country + +include usertag/*.tag + +## Uncomment +MaxQuantityField inventory:quantity + +## Builds a series of hidden variables given an IC-style form +## specification, i.e. +## +## [hiddens] +## mv_action=refresh +## mv_nextpage=foo +## [/hiddens] +## +UserTag hiddens Interpolate 1 +UserTag hiddens HasEndTag +UserTag hiddens Routine <filter('encode_entities', $v); + push @out, qq{}; + } + return join "\n", @out; +} +EOR + +## When uncommented, delivers a redirect if we get a request for an image +## DeliverImage Yes + +## Map a subroutine to happen if the page is not there +SpecialSub missing ncheck_category + +UserTag edisplay Alias error auto=1 class="alert alert-danger list-unstyled" +UserTag wdisplay Alias warnings auto=1 list_class="alert alert-success list-unstyled" +UserTag ecgi Alias cgi keep=1 filter=encode_entities name= + +CodeDef string2uri Filter +CodeDef string2uri Description Sanitize a string for use in a URL +CodeDef string2uri Routine <