#!/usr/bin/perl
###############################################################################
# imageFolio.cgi (lightbox ready) #
###############################################################################
#
# ImageFolio Basic Editon 2.2 by BizDesign, Inc.
# written by Greg Raaum, webmaster@imageFolio.com
# Available from http://www.ImageFolio.com
# ---------------------------------------------------------------------------
# PROGRAM NAME : ImageFolio Basic Edition
# VERSION : 2.2
# LAST MODIFIED : 11/03/2000
# ===========================================================================
# COPYRIGHT NOTICE :
#
# Copyright (c) 1999-2000 BizDesign, Inc. All Rights Reserved.
# Selling the code for this program without prior written consent is
# expressly forbidden.
#
# Obtain written permission before redistributing this software over the
# Internet or in any other medium. In all cases copyright and header must
# remain intact.
#
# Feel free to modify the code of this program to suit your likings.
#
# Although this program has been thoroughly tested on BizDesign's servers, we
# do not warrant that it works on all servers and will not be held liable
# for anything, including but not limited to, misusage, error, or loss of data.
#
# Use at your own risk!
###############################################################################
# Do not modify below this line unless you know what you are doing.
###############################################################################
eval {
($0 =~ m,(.*)/[^/]+,) && unshift (@INC, "$1"); # Get the script location: UNIX
($0 =~ m,(.*)\\[^\\]+,) && unshift (@INC, "$1"); # Get the script location: Windows
require "config.pl"; # Change this to the absolute path if you have problems.
if ($display_lightbox==1){
require "$lightbox_scripts_path/lightbox_config.pl"; # Change this to the absolute path if you have problems.
}
require "$libpath/shared.pl"; # Change this to the absolute path if you have problems.
⊤
};
if ($@) { print "Content-type: text/plain\n\nError: $@\n"; }
exit;
###############################################################################
# TOP
# Determines what to do
###############################################################################
sub top {
$| = 1; # flush output
$incoming = $ENV{'QUERY_STRING'};
@pairs = split(/&/, $incoming);
foreach $pair (@pairs) {
($name, $value) = split(/=/, $pair);
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$FORM{$name} = $value;
}
&parse_form;
&load_values;
if (!$FORM{'lightbox'}){
if ($referrer_check) { &check_referrer; }}
if ($FORM{'action'} eq "view") { require "$libpath/images.pl"; &view_image; }
elsif ($FORM{'direct'}) { require "$libpath/thumbnails.pl"; &gen_image_table; }
elsif ($FORM{'lightbox'}) { require "$lightbox_scripts_path/lightbox.pl"; &gen_image_table; }
else { require "$libpath/home.pl"; &gen_home_page; }
}
###############################################################################
# CHECK REFERRER
# Make sure we are pulling this page from the site and not a bookmark or link
###############################################################################
sub check_referrer {
for(@ref) { if ($ENV{'HTTP_REFERER'} =~ /$_/) { $ok = 1; } }
if ($ok != 1) { print "Content-type: text/html\nLocation:$domain\n\n"; exit; }
}
###############################################################################
# LOAD VALUES
# Establishes default values for commonly used variables
###############################################################################
sub load_values {
my ($found, $i, $pos, $count, $cnt, $nav, $subcatlinks, $thumbimages);
if ($FORM{'direct'}) {
if ( (!(-e "$image_directory/$FORM{'direct'}")) ||
(!(-d "$image_directory/$FORM{'direct'}")) ||
($FORM{'direct'} =~ /\.\./) ) {
print qq|Content-type: text/html\n\n