#!/usr/local4/bin/perl #/scripts 775 # # Copyright 1996, ScendTek Internet Corp., All Rights Reserved # This software may not be copied, used, or distributed without # the written permission of ScendTek Internet Corp. # # # ZyView - View Dispatcher # push(@INC,'/usr/local2/WebUsers/Staff/jsl102/zyview_conf/zvutils'); require 'cgi2.pl'; require 'var_utils2.pl'; require 'view_utils2.pl'; require 'sess_utils2.pl'; require 'zerror2.pl'; require 'usr_auth_utils2.pl'; require 'debug_conf2.pl'; require 'debug_utils2.pl'; ##### These lines can be used for command-line testing of zyview # Simply un-comment the lines below and type "zyview" at the prompt. # You should see basic configuration data displayed. #$ENV{"PATH_INFO"} ='/D=basic/V=test'; #$ENV{"REQUEST_METHOD"} = "POST"; #$ENV{"CONTENT_LENGTH"} = 0; ##### (%PATH) = &get_path_info; &ReadParse(*STD); # returns stdin vars in %STD foreach $key (keys %PATH) { $FORM{$key} = $PATH{$key}; } foreach $key (keys %STD) { # STD has precedence to overide PATH $FORM{$key} = $STD{$key}; } # Extract ZyView specific variables from array and place in VARS # allow for compatibility with Zyview 1.0 # DB -> ZBASE, V -> ZVIEW, REC -> ASSOCIATE (2.0 -> 1.0) # VARS = D(dbase), V(view), R(record), U(user), P(passwd), S(session), T(debug Type) if ($FORM{ZBASE}) { $VARS{D} = $FORM{ZBASE}; delete $FORM{ZBASE}; } elsif ($FORM{D}) { $VARS{D} = $FORM{D}; delete $FORM{D}; } else { &zerror("No ZyView Database name was specified"); } if ($FORM{ZVIEW}) { $VARS{V} = $FORM{ZVIEW}; delete $FORM{ZVIEW}; } elsif ($FORM{V}) { $VARS{V} = $FORM{V}; delete $FORM{V}; } if ($FORM{ASSOCIATE}) { $VARS{R} = $FORM{ASSOCIATE}; delete $FORM{ASSOCIATE}; } elsif ($FORM{R}) { $VARS{R} = $FORM{R}; delete $FORM{R}; } if ($VARS{R}) { $VARS{R} =~ s/\s+//g; # no spaces in indexes } # Debug Type if ($FORM{T}) { $VARS{T} = $FORM{T}; delete $FORM{T}; &debug_init($VARS{T}); } # User Name Checks if ($FORM{U}) { $VARS{U} = $FORM{U}; delete $FORM{U}; } # Passwd Checks if ($FORM{P}) { $VARS{P} = $FORM{P}; delete $FORM{P}; } # Session Number Checks if ($FORM{S}) { # S = number:name $VARS{S} = $FORM{S}; delete $FORM{S}; } $DEBUG && &debug("TRACE","Calling open_view..."); # Open View file, read and check contents &open_view($VARS{D}, $VARS{V}); # Allowable View Check if ($VARS{V}) { $VIEWNAME = $VARS{V}; } else { $VIEWNAME = "DEFAULT"; } unless ($AUTHENTICATION{$VIEWNAME} || $AUTHENTICATION{OTHER}) { &zerror("View: $VARS{V} not allowed for this ZyView Database"); } # Authentication Check $AUTHSTR = $AUTHENTICATION{$VIEWNAME} || $AUTHENTICATION{OTHER}; $hold = $AUTHSTR; $hold =~ s/\s*anyone\s*//ig; # remove 'anyone', if ANYTHING left, user and pw is required if ($hold) { # authentication checking required if anything but 'anyone' in $AUTHSTR unless ($VARS{U} && $VARS{P}) { &sess_reg_user("UP"); # get both User and PW exit; } unless (&auth_user($AUTHSTR, $VARS{U}, $VARS{P})) { &sess_reg_user("RUP"); # R indicates retry exit; } } # Session Management Checks if ($VIEW{SESSION} =~ /on/i) { unless ($VARS{U}) { &sess_reg_user("U"); # get user name only exit; } &sess_check($VARS{U},$VARS{S}); # check current session file } ############################################################## # Open script and send ZyView data $scr = $VIEW{SCRIPT_TRANSLATED}; ##### This line will be changed to "| $scr" # #unless (open(ZSCRIPT, ">/tmp/zyview.out")) { $DEBUG && &debug("TRACE","Ready to open view script..."); require "$scr"; # load view generation script to run! &debug_close;