#!/usr/bin/perl -w
# ----------------------------------------------------------------------------
# FrameIt 5.13a (01/17/2000)
# Copyright (c) 1999 Jason M. Hinkle. All rights reserved. This program is
# free software; you may redistribute it and/or modify it under the same
# terms as Perl itself.
# For more information see: http://www.verysimple.com/scripts/
#
# LEGAL DISCLAIMER:
# This software is provided as-is. Use it at your own risk. The
# author takes no responsibility for any damages or losses directly
# or indirectly caused by this software.
# @@@@
# (o o)
# -------------------------------------------------------oOOo-(_)-oOOo--------
##############################################################################
# CONFIGURATION VARIABLES
#
# DO NOT EDIT THIS VARIABLE UNLESS YOU HAVE MOVED OR RENAMED THE CONFIGURATION
# FILE, OR YOU ARE GETTING A "CONFIG FILE NOT FOUND" ERROR!!! THE SCRIPT WILL
# BE ABLE TO SET THIS VARIABLE AUTOMATICALLY AS LONG AS THE CONFIG FILE IS IN
# THE SAME DIRECTORY AS THE SCRIPT.
my $configFilePath = "";
#
# END OF CONFIGURATION VARIABLES
##############################################################################
## this is supposed to exit gracefully if the mod can't be found.
## BEGIN supposedly compiles before anything else. eval supposedly
## makes the script keep going. it don't work.
BEGIN {
# include current directory in module search path
push(@INC,`pwd`);
# Import supporting libraries
eval {
use strict;
use CGI;
require 5.000;
# use CGI::Request; # alternative - see object initialization below too
};
&FatalError($@) if ($@);
}
# Flush the Perl buffer
$|++;
# Create new CGI object to parse the input from the browser
my $objBrowser = new CGI;
# my $objBrowser = new CGI::Request; # alternative - see "use" above
# Set debugmode to 1 to check for configuration problems:
my $debugMode = $objBrowser->param('Debug') || $objBrowser->param('Debug');
# Set the configFilePath unless it has been specifically assigned above.
# This routine should work for both UNIX and NT servers.
$configFilePath = &CurrentDirectory . "FrameIt.cfg" unless ($configFilePath);
# Create the FrameIt object or die if not successful:
my $objFrameIt = FrameIt->new($configFilePath,$debugMode);
&FatalError("config file could not be read") unless ($objFrameIt);
if ($objBrowser->param('footer')) {
# the footer is always called by the script, so we have to override HTTP_REFERER
$objFrameIt->ReferringUrl($objBrowser->param('referringUrl')) if ($objBrowser->param('referringUrl'));
}
# BACKWARDS COMPATIBILITY: check for FrameIt 4.1 and earlier variables:
my $url = $objBrowser->param('Url') || $objBrowser->param('url');
my $text = $objBrowser->param('Text') || $objBrowser->param('text');
my $title = $objBrowser->param('Title') || $objBrowser->param('title');
my $link = $objBrowser->param('Link') || $objBrowser->param('override_link');
my $footerUrl = $objBrowser->param('FooterUrl') || $objBrowser->param('override_footer');
my $footerSize = $objBrowser->param('FooterSize') || $objBrowser->param('footer_frame_size');
my $linkTarget = $objBrowser->param('LinkTarget') || $objBrowser->param('parent_frame');
if (defined($objBrowser->param('remove'))) {
my $removeFrame = "1" if ($objBrowser->param('remove') eq "YES" || $objBrowser->param('remove') eq "yes");
}
my $removeFrame = $objBrowser->param('ShowRemoveFrame') if ($objBrowser->param('ShowRemoveFrame'));
# Load alternate config file if requested
$objFrameIt->ConfigFile($objBrowser->param('ConfigFile')) if ($objBrowser->param('ConfigFile'));
# Set the FrameIt properties. These are needed by both the body and footer frame
$objFrameIt->AdText($objBrowser->param('AdText')) if ($objBrowser->param('AdText'));
$objFrameIt->AdUrl($objBrowser->param('AdUrl')) if ($objBrowser->param('AdUrl'));
$objFrameIt->BodyFrame($objBrowser->param('BodyFrame')) if ($objBrowser->param('BodyFrame'));
$objFrameIt->FooterBackground($objBrowser->param('FooterBackground')) if ($objBrowser->param('FooterBackground'));
$objFrameIt->FooterBgcolor($objBrowser->param('FooterBgcolor')) if ($objBrowser->param('FooterBgcolor'));
$objFrameIt->FooterFontFace($objBrowser->param('FooterFontFace')) if ($objBrowser->param('FooterFontFace'));
$objFrameIt->FooterFontSize($objBrowser->param('FooterFontSize')) if ($objBrowser->param('FooterFontSize'));
$objFrameIt->FooterFrame($objBrowser->param('FooterFrame')) if ($objBrowser->param('FooterFrame'));
$objFrameIt->FooterTextColor($objBrowser->param('FooterTextColor')) if ($objBrowser->param('FooterTextColor'));
$objFrameIt->FooterTextStyle($objBrowser->param('FooterTextStyle')) if ($objBrowser->param('FooterTextStyle'));
$objFrameIt->Link($link) if ($link);
$objFrameIt->LinkTarget($linkTarget) if ($linkTarget);
$objFrameIt->ShowRemoveFrame($removeFrame) if ($removeFrame);
$objFrameIt->ShowAd($objBrowser->param('ShowAd')) if ($objBrowser->param('ShowAd'));
$objFrameIt->Text($text) if ($text);
$objFrameIt->Url($url) if ($url);
# Determine if we are outputting the Default, ShowCode, FrameSet or
# the Footer and set the properties that are needed for that particular task:
if ($url) {
if ($objBrowser->param('footer')) {
$objFrameIt->OutputFooterFrame();
} else {
# These properties are not needed by the footer frame:
$objFrameIt->AllowResize($objBrowser->param('AllowResize')) if ($objBrowser->param('AllowResize'));
$objFrameIt->FrameBorder($objBrowser->param('FrameBorder')) if ($objBrowser->param('FrameBorder'));
$objFrameIt->FooterLocation($objBrowser->param('FooterLocation')) if ($objBrowser->param('FooterLocation'));
$objFrameIt->FooterSize($footerSize) if ($footerSize);
$objFrameIt->FooterUrl($footerUrl) if ($footerUrl);
$objFrameIt->Title($title) if ($title);
$objFrameIt->TextForLink($objBrowser->param('TextForLink')) if ($objBrowser->param('TextForLink'));
# output either the frameset or the code
$objFrameIt->OutputCode() if ($objBrowser->param('outputCode'));
$objFrameIt->OutputFrameset() unless ($objBrowser->param('outputCode'));
}
} else {
$objFrameIt->OutputDefault();
}
print "\nFrameIt exited normally\n\n" if ($debugMode);
exit;
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sub CurrentDirectory {
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
my ($pathToScript,$position) = "";
if ($ENV{'PATH_TRANSLATED'}) {
$pathToScript = $ENV{'PATH_TRANSLATED'};
$position = rindex ($pathToScript,'\\');
} else {
$pathToScript = $ENV{'SCRIPT_FILENAME'};
$position = rindex ($pathToScript,'/');
}
my $currentDir = substr ($pathToScript,0,$position + 1);
return $currentDir;
}
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sub FatalError {
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# this error can occur when the object could not be created, so
# we can't call any methods or properties.
my $errorNumber = shift;
print "Content-type: text/html\n\n";
print "\n";
print "
\n";
print "FrameIt.cgi Fatal Error\n";
print "\n";
print "\n";
print "\n";
print "FrameIt 5.13a \n";
print "Advanced Link Redirector\n";
print " |
\n";
print "\n";
print "Fatal Error: " . $errorNumber . "\n";
print "
\n";
print "This script has encountered an error. Please use the \"back\" button\n";
print "on your browser to return to the previous page and try again.\n";
print "If you continue to have problems, please contact the webmaster. \n";
print "
\n";
print "If you are the webmaster, please use the FrameIt debug mode to \n";
print "locate the error. \n";
print "
\n";
print "\n";
print "\n";
exit;
}
# ----------------------------------------------------------------------------
# FrameIt Module 5.01.03
# Copyright (c) 1999 Jason M. Hinkle. All rights reserved. This module is
# free software; you may redistribute it and/or modify it under the same
# terms as Perl itself.
# For more information see: http://www.verysimple.com/scripts/
#
# LEGAL DISCLAIMER:
# This software is provided as-is. Use it at your own risk. The
# author takes no responsibility for any damages or losses directly
# or indirectly caused by this software.
# ----------------------------------------------------------------------------
package FrameIt;
require 5.000;
my $ID =q( $Id: FrameIt.pm,v 5.13a 2000/01/17 17:00:00 sdowd Exp $ );
my $VERSION = "5.13a";
=head1 NAME
FrameIt.pm - Perl 5 module to power FrameIt.cgi
=head1 SYNOPSIS
push(@INC,'pwd'); # (includes current directory in module search path)
use FrameIt;
=head1 DESCRIPTION
This module provides an object oriented interface for FrameIt.cgi.
No user serviceable parts inside!
=head1 USAGE
Here is a basic example script:
#!/usr/bin/perl
# Import the supporting libraries:
push(@INC,'pwd');
use FrameIt;
$configFilePath = "/home/www/FrameIt.cfg";
# Create and use the FrameIt object:
$objFrameIt = FrameIt->new($configFilePath);
$objFrameIt->OutputFrameset();
Refer to http://www.verysimple.com/scripts/ for more information.
=head1 AUTHOR
Jason M. Hinkle
=head1 COPYRIGHT
Copyright (c) 1999 Jason M. Hinkle. All rights reserved.
This module is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.
=head1 CREDITS
Props to WWW.CPAN.ORG
=cut
# Set Globals
my %configFileVariables;
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sub new {
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
my $class = shift;
my $configFile = shift || "./FrameIt.cfg";
my $debugMode = shift;
my $httpReferer = $ENV{'HTTP_REFERER'} || "http://no.referring.url/";
my $httpUserAgent = $ENV{'HTTP_USER_AGENT'} || "NoUserAgent";
my $httpRemoteHost = $ENV{'REMOTE_HOST'} || "0.0.0.0";
print "Content-type: text/plain\n\n" if ($debugMode);
print "FrameIt->new (Debug Mode)\n" if ($debugMode);
my $this = {
_ConfigFile => $configFile,
_DebugMode => $debugMode,
_LogHost => $httpRemoteHost,
_LogReferrer => $httpReferer,
_LogAgent => $httpUserAgent,
ReferringUrl => $ENV{'HTTP_REFERER'},
ScriptUrl => $ENV{'SCRIPT_NAME'},
FooterUrl => $ENV{'SCRIPT_NAME'} . "?footer=1",
LinkTarget => "_top",
FooterBackground=> "",
FooterBgcolor => "#ffffff",
FooterTextColor => "#0000ff",
FooterTextStyle => "",
BodyFrame => "body",
FooterFrame => "footer",
Text => "Back",
Link => $ENV{'HTTP_REFERER'},
FooterSize => "35",
FooterFontSize => "2",
FooterFontFace => "Arial,Helvetica",
FooterLocation => "1",
EnableLogging => "0",
LogFilePath => "",
RemoveFooter => "",
ConfigFile => "",
ShowRemoveFrame => "",
ShowAd => "",
AllowResize => "",
FrameBorder => "",
HideAdAuthorized=> "",
Title => "",
Url => "",
};
bless $this;
print "FrameIt->new sucessfully created new object\n" if ($debugMode);
return 0 unless ($this->LoadConfigFile($configFile));
$this->{_IsAuthorized} = $this->_SetAuthorized();
$this->{_IsBanned} = $this->_SetBanned();
return $this;
}
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sub Version {
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
return "5.13a";
# To Do: Why is this not working? Variable out of scope?
# return $VERSION;
}
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sub LoadConfigFile {
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
my $this = shift;
my $configFile = shift;
# Set ConfigFileVariables to avoid Uninitialized Variable Warnings
$configFileVariables{'ConfigFile'} = "" unless defined($configFileVariables{'ConfigFile'});
$configFileVariables{'FooterFrame'} = "" unless defined($configFileVariables{'FooterFrame'});
$configFileVariables{'BodyFrame'} = "" unless defined($configFileVariables{'BodyFrame'});
$configFileVariables{'LinkTarget'} = "" unless defined($configFileVariables{'LinkTarget'});
$configFileVariables{'AllowResize'} = "" unless defined($configFileVariables{'AllowResize'});
$configFileVariables{'FrameBorder'} = "" unless defined($configFileVariables{'FrameBorder'});
$configFileVariables{'ShowAd'} = "" unless defined($configFileVariables{'ShowAd'});
$configFileVariables{'HideAdAuthorized'} = "" unless defined($configFileVariables{'HideAdAuthorized'});
$configFileVariables{'AdText'} = "" unless defined($configFileVariables{'AdText'});
$configFileVariables{'AdUrl'} = "" unless defined($configFileVariables{'AdUrl'});
$configFileVariables{'Title'} = "" unless defined($configFileVariables{'Title'});
$configFileVariables{'Url'} = "" unless defined($configFileVariables{'Url'});
$configFileVariables{'Text'} = "" unless defined($configFileVariables{'Text'});
$configFileVariables{'Link'} = "" unless defined($configFileVariables{'Link'});
$configFileVariables{'FooterSize'} = "" unless defined($configFileVariables{'FooterSize'});
$configFileVariables{'FooterBgColor'} = "" unless defined($configFileVariables{'FooterBgColor'});
$configFileVariables{'FooterBackground'} = "" unless defined($configFileVariables{'FooterBackground'});
$configFileVariables{'FooterTextColor'} = "" unless defined($configFileVariables{'FooterTextColor'});
$configFileVariables{'FooterTextStyle'} = "" unless defined($configFileVariables{'FooterTextStyle'});
$configFileVariables{'FooterFontFace'} = "" unless defined($configFileVariables{'FooterFontFace'});
$configFileVariables{'FooterFontSize'} = "" unless defined($configFileVariables{'FooterFontSize'});
$configFileVariables{'FooterLocation'} = "" unless defined($configFileVariables{'FooterLocation'});
$configFileVariables{'ShowRemoveFrame'} = "" unless defined($configFileVariables{'ShowRemoveFrame'});
$configFileVariables{'FooterUrl'} = "" unless defined($configFileVariables{'FooterUrl'});
my $allowSecurityChange = 1 if ($configFile eq $this->{_ConfigFile});
unless (-r $configFile) {
print "FrameIt->LoadConfigFile unable to read config file: " . $configFile . "\n" if ($this->{_DebugMode});
$this->CrashAndBurn("LoadConfigFile couldn't read: $configFile") if ($this->{_ShowWarnings} && !$allowSecurityChange);
return 0;
}
print "FrameIt->LoadConfigFile loading config file: " . $configFile . "\n" if ($this->{_DebugMode});
open(CONFIG, "$configFile");
my @configFile = ;
close(CONFIG);
print "{" . "\n" if ($this->{_DebugMode});
my $configLine;
my $configComment;
my $configKey;
my $configValue;
foreach $configLine (@configFile) {
# check for null value to avoid "uninitialized variable" warning
if (defined($configLine)) { # check for null value
chop $configLine; # remove the line break
if ($configLine) { # check for blank line
($configLine, $configComment) = split(/[\t ]*#[\t ]*/,$configLine); # remove comments
if ($configLine) { # check for comment only
($configKey, $configValue) = split(/[\t ]*=[\t ]*/,$configLine); # split key/value
if (defined($configValue)) { # check for key with no value
# remove all the trailing spaces from value if necessary:
while ( substr($configValue, (length($configValue) -1), 1) eq " ") {
chop $configValue;
}
if (($configValue) || ($configValue="0")) { # check if value was just a bunch of spaces
$configValue = "0" if $configValue eq "-1";
# security setting variables are denoted by _ as the first character.
# do not allow alternate config files to change these:
unless (substr($configKey,0,1) eq "_" && !$allowSecurityChange) {
print " SET: " . $configKey . " = \"" . $configValue . "\"\n" if ($this->{_DebugMode});
$this->{$configKey} = $configValue;
$configFileVariables{$configKey} = $configValue;
} else {
print " IGNORED: " . $configKey . " = \"" . $configValue . "\"\n" if ($this->{_DebugMode});
}
} # value is spaces
} # key with no value
} # comment only
} # blank line
} # null
}
print "}" . "\n" if ($this->{_DebugMode});
return 1;
}
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sub Title {
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
my $name = "Title";
my $this = shift;
my $newValue = shift;
unless ($newValue) {
print "FrameIt->" . $name . " returned current value: " . $this->{$name} . "\n" if ($this->{_DebugMode});
return $this->{$name};
}
$this->{$name} = $newValue;
print "FrameIt->" . $name . " set to: " . $newValue . "\n" if ($this->{_DebugMode});
return 1;
}
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sub TextForLink {
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
my $name = "TextForLink";
my $this = shift;
my $newValue = shift;
unless ($newValue) {
print "FrameIt->" . $name . " returned current value: " . $this->{$name} . "\n" if ($this->{_DebugMode});
return $this->{$name};
}
$this->{$name} = $newValue;
print "FrameIt->" . $name . " set to: " . $newValue . "\n" if ($this->{_DebugMode});
return 1;
}
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sub ConfigFile {
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
my $name = "ConfigFile";
my $this = shift;
my $newValue = shift;
unless ($newValue) {
print "FrameIt->" . $name . " returned current value: " . $this->{$name} . "\n" if ($this->{_DebugMode});
return $this->{$name};
}
if ($this->{_RestrictUnauthorizedDomains} && !$this->{_IsAuthorized}) {
# Restrict the usage of this script
print "FrameIt->" . $name . " not authorized to set to: " . $newValue . "\n" if ($this->{_DebugMode});
$this->CrashAndBurn("Only Authorized Domains may override " . $name) if ($this->{_ShowWarnings});
} else {
$this->{$name} = $newValue;
print "FrameIt->" . $name . " set to: " . $newValue . "\n" if ($this->{_DebugMode});
$this->LoadConfigFile($newValue);
}
return 1;
}
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sub Url {
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
my $name = "Url";
my $this = shift;
my $newValue = shift;
unless ($newValue) {
print "FrameIt->" . $name . " returned current value: " . $this->{$name} . "\n" if ($this->{_DebugMode});
return $this->{$name};
}
$this->{$name} = $newValue;
print "FrameIt->" . $name . " set to: " . $newValue . "\n" if ($this->{_DebugMode});
return 1;
}
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sub EnableLogging {
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
my $name = "EnableLogging";
my $this = shift;
my $newValue = shift;
unless ($newValue) {
print "FrameIt->" . $name . " returned current value: " . $this->{$name} . "\n" if ($this->{_DebugMode});
return $this->{$name};
}
$this->{$name} = $newValue;
print "FrameIt->" . $name . " set to: " . $newValue . "\n" if ($this->{_DebugMode});
return 1;
}
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sub LogFilePath {
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
my $name = "LogFilePath";
my $this = shift;
my $newValue = shift;
unless ($newValue) {
print "FrameIt->" . $name . " returned current value: " . $this->{$name} . "\n" if ($this->{_DebugMode});
return $this->{$name};
}
$this->{$name} = $newValue;
print "FrameIt->" . $name . " set to: " . $newValue . "\n" if ($this->{_DebugMode});
return 1;
}
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sub AllowResize {
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
my $name = "AllowResize";
my $this = shift;
my $newValue = shift;
unless ($newValue) {
print "FrameIt->" . $name . " returned current value: " . $this->{$name} . "\n" if ($this->{_DebugMode});
return $this->{$name};
}
if ($newValue eq "1") {
$this->{$name} = "1";
print "FrameIt->" . $name . " set to: 1\n" if ($this->{_DebugMode});
} else {
$this->{$name} = "0";
print "FrameIt->" . $name . " set to: 0\n" if ($this->{_DebugMode});
}
return 1;
}
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sub FrameBorder {
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
my $name = "FrameBorder";
my $this = shift;
my $newValue = shift;
unless (defined($newValue)) {
print "FrameIt->" . $name . " returned current value: " . $this->{$name} . "\n" if ($this->{_DebugMode});
return $this->{$name};
}
if ($newValue eq "1") {
$this->{$name} = "1";
print "FrameIt->" . $name . " set to: 1\n" if ($this->{_DebugMode});
} else {
$this->{$name} = "0";
print "FrameIt->" . $name . " set to: 0\n" if ($this->{_DebugMode});
}
return 1;
}
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sub ReferringUrl {
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
my $name = "ReferringUrl";
my $this = shift;
my $newValue = shift;
unless ($newValue) {
print "FrameIt->" . $name . " returned current value: " . $this->{$name} . "\n" if ($this->{_DebugMode});
return $this->{$name};
}
$this->{$name} = $newValue;
print "FrameIt->" . $name . " set to: " . $newValue . "\n" if ($this->{_DebugMode});
return 1;
}
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sub BodyFrame {
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
my $name = "BodyFrame";
my $this = shift;
my $newValue = shift;
unless ($newValue) {
print "FrameIt->" . $name . " returned current value: " . $this->{$name} . "\n" if ($this->{_DebugMode});
return $this->{$name};
}
$this->{$name} = $newValue;
print "FrameIt->" . $name . " set to: " . $newValue . "\n" if ($this->{_DebugMode});
return 1;
}
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sub FooterFrame {
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
my $name = "FooterFrame";
my $this = shift;
my $newValue = shift;
unless ($newValue) {
print "FrameIt->" . $name . " returned current value: " . $this->{$name} . "\n" if ($this->{_DebugMode});
return $this->{$name};
}
$this->{$name} = $newValue;
print "FrameIt->" . $name . " set to: " . $newValue . "\n" if ($this->{_DebugMode});
return 1;
}
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sub FooterSize {
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
my $name = "FooterSize";
my $this = shift;
my $newValue = shift;
unless ($newValue) {
print "FrameIt->" . $name . " returned current value: " . $this->{$name} . "\n" if ($this->{_DebugMode});
return $this->{$name};
}
if ($this->{_RestrictUnauthorizedDomains} && !$this->{_IsAuthorized}) {
# Restrict the usage of this script
print "FrameIt->" . $name . " not authorized to set to: " . $newValue . "\n" if ($this->{_DebugMode});
$this->CrashAndBurn("Only Authorized Domains may override " . $name) if ($this->{_ShowWarnings});
} else {
$this->{$name} = $newValue;
print "FrameIt->" . $name . " set to: " . $newValue . "\n" if ($this->{_DebugMode});
}
return 1;
}
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sub FooterUrl {
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
my $name = "FooterUrl";
my $this = shift;
my $newValue = shift;
unless ($newValue) {
print "FrameIt->" . $name . " returned current value: " . $this->{$name} . "\n" if ($this->{_DebugMode});
return $this->{$name};
}
if ($this->{_RestrictUnauthorizedDomains} && !$this->{_IsAuthorized}) {
# Restrict the usage of this script
print "FrameIt->" . $name . " not authorized to set to: " . $newValue . "\n" if ($this->{_DebugMode});
$this->CrashAndBurn("Only Authorized Domains may override " . $name) if ($this->{_ShowWarnings});
} else {
$this->{$name} = $newValue;
print "FrameIt->" . $name . " set to: " . $newValue . "\n" if ($this->{_DebugMode});
}
return 1;
}
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sub ScriptUrl {
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
my $name = "ScriptUrl";
my $this = shift;
my $newValue = shift;
unless ($newValue) {
print "FrameIt->" . $name . " returned current value: " . $this->{$name} . "\n" if ($this->{_DebugMode});
return $this->{$name};
}
$this->{$name} = $newValue;
print "FrameIt->" . $name . " set to: " . $newValue . "\n" if ($this->{_DebugMode});
return 1;
}
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sub LinkTarget {
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
my $name = "LinkTarget";
my $this = shift;
my $newValue = shift;
unless ($newValue) {
print "FrameIt->" . $name . " returned current value: " . $this->{$name} . "\n" if ($this->{_DebugMode});
return $this->{$name};
}
$this->{$name} = $newValue;
print "FrameIt->" . $name . " set to: " . $newValue . "\n" if ($this->{_DebugMode});
return 1;
}
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sub Text {
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
my $name = "Text";
my $this = shift;
my $newValue = shift;
unless ($newValue) {
my ($tempValue) = $this->{$name};
if (substr ($tempValue,0,4) eq "http") {
$tempValue = "
";
}
print "FrameIt->" . $name . " returned current value: " . $this->{$name} . "\n" if ($this->{_DebugMode});
return $tempValue;
}
$this->{$name} = substr($newValue,0,60);
print "FrameIt->" . $name . " set to: " . $newValue . "\n" if ($this->{_DebugMode});
return 1;
}
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sub Link {
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
my $name = "Link";
my $this = shift;
my $newValue = shift;
unless ($newValue) {
print "FrameIt->" . $name . " returned current value: " . $this->{$name} . "\n" if ($this->{_DebugMode});
return $this->{$name};
}
$this->{$name} = $newValue;
print "FrameIt->" . $name . " set to: " . $newValue . "\n" if ($this->{_DebugMode});
return 1;
}
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sub FooterLocation {
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
my $name = "FooterLocation";
my $this = shift;
my $newValue = shift;
unless ($newValue) {
print "FrameIt->" . $name . " returned current value: " . $this->{$name} . "\n" if ($this->{_DebugMode});
return $this->{$name};
}
if ($this->{_RestrictUnauthorizedDomains} && !$this->{_IsAuthorized} && $newValue eq "3") {
# Restrict the usage of this script
print "FrameIt->" . $name . " not authorized to set to: " . $newValue . "\n" if ($this->{_DebugMode});
$this->CrashAndBurn("Only Authorized Domains may change " . $name . " to redirect") if ($this->{_ShowWarnings});
} else {
$this->{$name} = $newValue;
print "FrameIt->" . $name . " set to: " . $newValue . "\n" if ($this->{_DebugMode});
}
return 1;
}
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sub FooterFontSize {
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
my $name = "FooterFontSize";
my $this = shift;
my $newValue = shift;
unless ($newValue) {
print "FrameIt->" . $name . " returned current value: " . $this->{$name} . "\n" if ($this->{_DebugMode});
return $this->{$name};
}
$this->{$name} = $newValue;
print "FrameIt->" . $name . " set to: " . $newValue . "\n" if ($this->{_DebugMode});
return 1;
}
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sub FooterFontFace {
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
my $name = "FooterFontFace";
my $this = shift;
my $newValue = shift;
unless ($newValue) {
print "FrameIt->" . $name . " returned current value: " . $this->{$name} . "\n" if ($this->{_DebugMode});
return $this->{$name};
}
$this->{$name} = $newValue;
print "FrameIt->" . $name . " set to: " . $newValue . "\n" if ($this->{_DebugMode});
return 1;
}
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sub ShowRemoveFrame {
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
my $name = "ShowRemoveFrame";
my $this = shift;
my $newValue = shift;
unless ($newValue) {
print "FrameIt->" . $name . " returned current value: " . $this->{$name} . "\n" if ($this->{_DebugMode});
return $this->{$name};
}
if ($newValue eq "1") {
$this->{$name} = "1";
print "FrameIt->" . $name . " set to: 1\n" if ($this->{_DebugMode});
} else {
$this->{$name} = "";
print "FrameIt->" . $name . " set to: 0\n" if ($this->{_DebugMode});
}
return 1;
}
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sub ShowAd {
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
my $name = "ShowAd";
my $this = shift;
my $newValue = shift;
unless ($newValue) {
print "FrameIt->" . $name . " returned current value: " . $this->{$name} . "\n" if ($this->{_DebugMode});
return $this->{$name};
}
if ($this->{_RestrictUnauthorizedDomains} && !$this->{_IsAuthorized}) {
# Restrict the usage of this script
print "FrameIt->" . $name . " not authorized to set to: " . $newValue . "\n" if ($this->{_DebugMode});
$this->CrashAndBurn("Only Authorized Domains may override " . $name) if ($this->{_ShowWarnings});
} else {
if ($newValue eq "1") {
$this->{$name} = "1";
print "FrameIt->" . $name . " set to: 1\n" if ($this->{_DebugMode});
} else {
$this->{$name} = "";
print "FrameIt->" . $name . " set to: 0\n" if ($this->{_DebugMode});
}
}
return 1;
}
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sub HideAdAuthorized {
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
my $name = "HideAdAuthorized";
my $this = shift;
my $newValue = shift;
unless ($newValue) {
print "FrameIt->" . $name . " returned current value: " . $this->{$name} . "\n" if ($this->{_DebugMode});
return $this->{$name};
}
if ($this->{_RestrictUnauthorizedDomains} && !$this->{_IsAuthorized}) {
# Restrict the usage of this script
print "FrameIt->" . $name . " not authorized to set to: " . $newValue . "\n" if ($this->{_DebugMode});
$this->CrashAndBurn("Only Authorized Domains may override " . $name) if ($this->{_ShowWarnings});
} else {
if ($newValue eq "1") {
$this->{$name} = "1";
print "FrameIt->" . $name . " set to: 1\n" if ($this->{_DebugMode});
} else {
$this->{$name} = "";
print "FrameIt->" . $name . " set to: 0\n" if ($this->{_DebugMode});
}
}
return 1;
}
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sub AdText {
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
my $name = "AdText";
my $this = shift;
my $newValue = shift;
unless ($newValue) {
my ($tempValue) = $this->{$name};
if (substr ($tempValue,0,4) eq "http") {
$tempValue = "
";
}
print "FrameIt->" . $name . " returned current value: " . $this->{$name} . "\n" if ($this->{_DebugMode});
return $tempValue;
}
if ($this->{_RestrictUnauthorizedDomains} && !$this->{_IsAuthorized}) {
# Restrict the usage of this script
print "FrameIt->" . $name . " not authorized to set to: " . $newValue . "\n" if ($this->{_DebugMode});
$this->CrashAndBurn("Only Authorized Domains may override " . $name) if ($this->{_ShowWarnings});
} else {
$this->{$name} = $newValue;
print "FrameIt->" . $name . " set to: " . $newValue . "\n" if ($this->{_DebugMode});
}
return 1;
}
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sub FooterBgcolor {
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
my $name = "FooterBgcolor";
my $this = shift;
my $newValue = shift;
unless ($newValue) {
print "FrameIt->" . $name . " returned current value: " . $this->{$name} . "\n" if ($this->{_DebugMode});
return $this->{$name};
}
$this->{$name} = $newValue;
print "FrameIt->" . $name . " set to: " . $newValue . "\n" if ($this->{_DebugMode});
return 1;
}
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sub FooterBackground {
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
my $name = "FooterBackground";
my $this = shift;
my $newValue = shift;
unless ($newValue) {
print "FrameIt->" . $name . " returned current value: " . $this->{$name} . "\n" if ($this->{_DebugMode});
return $this->{$name};
}
$this->{$name} = $newValue;
print "FrameIt->" . $name . " set to: " . $newValue . "\n" if ($this->{_DebugMode});
return 1;
}
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sub FooterTextColor {
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
my $name = "FooterTextColor";
my $this = shift;
my $newValue = shift;
unless ($newValue) {
print "FrameIt->" . $name . " returned current value: " . $this->{$name} . "\n" if ($this->{_DebugMode});
return $this->{$name};
}
$this->{$name} = $newValue;
print "FrameIt->" . $name . " set to: " . $newValue . "\n" if ($this->{_DebugMode});
return 1;
}
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sub FooterTextStyle {
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
my $name = "FooterTextStyle";
my $this = shift;
my $newValue = shift;
unless ($newValue) {
print "FrameIt->" . $name . " returned current value: " . $this->{$name} . "\n" if ($this->{_DebugMode});
return $this->{$name};
}
$this->{$name} = $newValue;
print "FrameIt->" . $name . " set to: " . $newValue . "\n" if ($this->{_DebugMode});
return 1;
}
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sub AdUrl {
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
my $name = "AdUrl";
my $this = shift;
my $newValue = shift;
unless ($newValue) {
print "FrameIt->" . $name . " returned current value: " . $this->{$name} . "\n" if ($this->{_DebugMode});
return $this->{$name};
}
if ($this->{_RestrictUnauthorizedDomains} && !$this->{_IsAuthorized}) {
# Restrict the usage of this script
print "FrameIt->" . $name . " not authorized to set to: " . $newValue . "\n" if ($this->{_DebugMode});
$this->CrashAndBurn("Only Authorized Domains may override " . $name) if ($this->{_ShowWarnings});
} else {
$this->{$name} = $newValue;
print "FrameIt->" . $name . " set to: " . $newValue . "\n" if ($this->{_DebugMode});
}
return 1;
}
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sub OutputFrameset {
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# output the HTML headers
my $this = shift;
print "FrameIt->OutputFrameSet called (output below)\n\n" if ($this->{_DebugMode});
# If no referrer, display AdText instead of return link
$this->{'Text'} = $this->{'AdText'} unless ($ENV{'HTTP_REFERER'});
$this->{'Link'} = $this->{'AdUrl'} unless ($ENV{'HTTP_REFERER'});
# Print error and exit if the domain is banned
$this->CrashAndBurn($this->ReferringUrl . " has been banned from using this script.") if ($this->{_IsBanned});
if ($this->{_AllowOnlyAuthorizedDomains} && !$this->{_IsAuthorized}) {
# Disallow Unauthorized Domain
$this->CrashAndBurn($this->ReferringUrl . " is not authorized to use this script.")
}
# mess with the footer URL a bit
$footerTempValue = $this->_UnPassThru($this->FooterUrl);
$footerTempValue .= "?" unless ($footerTempValue =~ /\?/);
# get variables ready to pass to the footer, since 0 can be confused as NULL
my $showRemoveFrame = $this->ShowRemoveFrame() || "-1";
my $showAd = $this->ShowAd() || "-1";
# don't bother passing these variables if this is unauthorized domain.
unless ($this->{_RestrictUnauthorizedDomains} && !$this->{_IsAuthorized}) {
$footerTempValue .= "&ShowAd=" . $showAd;
$footerTempValue .= "&AdText=" . $this->_PassThru($this->AdText);
$footerTempValue .= "&AdUrl=" . $this->_PassThru($this->AdUrl);
}
$footerTempValue .= "&Url=" . $this->_PassThru($this->Url);
$footerTempValue .= "&referringUrl=" . $this->ReferringUrl;
$footerTempValue .= "&Link=" . $this->Link;
$footerTempValue .= "&Text=" . $this->_PassThru($this->Text);
$footerTempValue .= "&FooterFontFace=" . $this->FooterFontFace;
$footerTempValue .= "&FooterFontSize=" . $this->FooterFontSize;
$footerTempValue .= "&FooterBgcolor=" . $this->FooterBgcolor;
$footerTempValue .= "&FooterBackground=" . $this->FooterBackground;
$footerTempValue .= "&FooterTextColor=" . $this->FooterTextColor;
$footerTempValue .= "&FooterTextStyle=" . $this->FooterTextStyle;
$footerTempValue .= "&ShowRemoveFrame=" . $showRemoveFrame;
$footerTempValue .= "&BodyFrame=" . $this->BodyFrame;
$footerTempValue .= "&LinkTarget=" . $this->LinkTarget;
# change FooterUrl manually instead of through the function/wrapper or else the
# function will try to do a security check. This is probably not too slick.
$this->{'FooterUrl'} = $footerTempValue;
# replace any passed thru variables
$this->Url($this->_UnPassThru($this->Url));
$this->Title($this->_UnPassThru($this->Title));
if ($this->FooterLocation eq "3") {
print "Location: " . $this->Url . "\n\n";
return 1;
}
# set the text for frame resize
my $resize = "noresize";
if ($this->AllowResize()) {
$resize = "";
}
# set the text for frame border
my $frameborder = "no";
if ($this->FrameBorder()) {
$frameborder = "yes";
}
print "Content-type: text/html\n\n";
print "\n";
print "\n";
print "" . $this->Title . "\n";
print "\n";
if ($this->FooterLocation eq "2") {
print "