NAME
mat - administrative interface for MiniVend
SYNOPSIS
http://SERVER_NAME/protected-bin/mat
DESCRIPTION
The MiniVend Administration Tool (MAT) puts an HTML adminstrative interface on the MiniVend shopping cart software, allowing non-UNIX users to administer it.
When VendRoot is referred to in the following text, it refers to the directory where MiniVend is installed.
It reads the set of configurable variables from a defaults file (normally VendRoot/bin/minivend.def), and modifies them with those in the MiniVend configuration file (by default VendRoot/minivend.cfg).
It is dispatched by an SUID executable compiled from C, which must be in a password-protected CGI directory. It should NEVER BE SUID ROOT! The author won't be responsible in any case, and especially if the program is left unprotected.
The HTML DocumentRoot and the MiniVend PageDir must be defined in program variables. That is normally done by the MiniVend configuration utility, but can be done manually.
It's default action when called with the GET method is to dispatch its form, with the current configuration filled in. If it receives a post back from a form that it has dispatched, and that it has current authorization for, it will perform one of several actions.
- 1. Start Server Starts the MiniVend Server.
- 2. Stop Server Starts the MiniVend Server.
- 3. Re-read Configuration Restarts the MiniVend Server, in effect making it re-read configuration and possibly re-build the database.
- 4. Display Error Log Displays the MiniVend error log.
- 5. Rename .htm to .html Rename any .htm files in the MiniVend page or HTML page directory to .html extenstions. Skips the automatically-generated catalog directory.
- 6. Add Carriage Returns Add carriage returns to any files in the MiniVend page or HTML page directory. Skips the automatically-generated catalog directory.
- 7. Trim Carriage Returns Remove carriage returns from any files in the MiniVend page or HTML page directory. Skips the automatically-generated catalog directory.
- 8. Display Sessions Displays the MiniVend sessions in the database.
- 9. Expire Sessions Expires the MiniVend session file according to the setting of SessionExpire.
- 10. Configure Change the MiniVend configuration file.
Options
None, other than those in the configuration files and program variables.
Configuration File Format
The defaults file, then the configuration file, are scanned at program startup. There is only one variable type -- simple (scalar) variables. A new variable may be installed by simply adding it to the minivend.def file, along with any default value.
The format is simple. The variable name is the first entry on the line, and may contain only alpha-numeric characters, dashes, and underscores. It is followed by any number of spaces and/or tabs or equals signs, then the variable value. The variable value is everything till the end of the line, with no same-line comments allowed.
The MiniVend configuration file is then scanned, and values are checked against the defaults. If a variable differs, it will be written to the configuration file. If it is the same, it will not be written.
WARNING:Only program hackers should change the minivend.def file, for if it differs from the configuration in the minivend.pl file, the system will not work.
The variables themselves are described in the MiniVend documentation.
Start Server Function
Simply calls the VendRoot/bin/start file, starting the MiniVend server. This option will not be presented if the server is running.
Stop Server Function
Simply calls the VendRoot/bin/stop file, stopping the MiniVend server. This option will not be presented if the server is not running.
Restart Server Function
Simply calls the VendRoot/bin/restart file, restarting the MiniVend server. This makes MiniVend re-read configuration, but not rebuild the database. This option will not be presented if the server is not running.
Rename .htm to .html Function
This is activated by clicking the Rename .htm to .html button in the form. The RENAME function simply changes all files in a directory tree that have a .htm file extension to a .html extension. It is recursive, which means that ALL files under the VendRoot/pages and/or HTML DocumentRoot (as selected) will be changed.
WARNING: This will destroy any contents of files with the same root file name that have a .html extension. It does check to see that the .htm file is newer, but be careful.
Unless the number of files is very large (greater than 1000), the function should not take long. On completion, the status of the operation is returned to the browser in HTML format.
Add/Trim Carriage Returns Function
This is activated by clicking the Add Carriage Returns or Trim Carriage Returns buttons in the form. Depending on whether the HTML Directory or Page Directory checkboxes are selected, it will operate on the HTML tree or the MiniVend tree. It is recursive, which means that ALL files under the VendRoot/pages and/or HTML DocumentRoot (as selected) will be changed.
The Add Carriage Returns function simply adds or trims carriage returns (^M characters) to all .htm, .html, .cfg, .asc, or .txt files in a directory tree. If adding, it adds them to a line before the linefeed only if not already present.
If removing, it removes all unencoded carriage returns at the end of a line.
On completion, the status of the operation is returned to the browser.
Display Error Log Function
The Display Error Log function simply shows the contents of MiniVend's error log.
Display Sessions Function
The Display Sessions function simply dumps any user sessions in the session database to the browser in plain/text format. Lines will not be wrapped, so the output may be hard to read. Save to a file to examine all information.
Expire Function
The Expire function simply expires all sessions that are older than allowed by the SessionExpire variable. This is normally best done on a daily basis by a crontab(8) entry, but is provided for convenience.
Configuration Editing
Each configuration variable is presented in a fill-out form, and is written as is. Any variables that are not the default value will be at the top -- the ones that have the default value will be in alphabetical order toward the bottom of the file.
Certain variables may have an effect on sessions in progress, in particular the variables which set the frames for certain functions.
After the file is written, the file is tested, and if there are any problems reported, the old file will be restored.
Bugs
None yet known in this version. Just wait.
Author
Mike Heins, mikeh@iac.net
Credits
Few routines but much of the inspiration came from Andrew Wilcox's Vend 0.2 package. Give him the credit.