 |
 |
 |
#!/usr/bin/perl
use CGI::Carp qw(fatalsToBrowser);
#
# csCalendar - v1.55 - 051902
#
$basepath = './';
#####################################################################
# #
# Copyright © 1999-2001 CGISCRIPT.NET - All Rights Reserved #
# #
#####################################################################
# #
# THIS COPYRIGHT INFORMATION MUST REMAIN INTACT #
# AND MAY NOT BE MODIFIED IN ANY WAY #
# #
#####################################################################
#
# When you downloaded this script you agreed to accept the terms
# of this Agreement. This Agreement is a legal contract, which
# specifies the terms of the license and warranty limitation between
# you and CGISCRIPT.NET. You should carefully read the following
# terms and conditions before installing or using this software.
# Unless you have a different license agreement obtained from
# CGISCRIPT.NET, installation or use of this software indicates
# your acceptance of the license and warranty limitation terms
# contained in this Agreement. If you do not agree to the terms of this
# Agreement, promptly delete and destroy all copies of the Software.
#
# Versions of the Software
# Only one copy of the registered version of CGISCRIPT.NET
# may used on one web site.
#
# License to Redistribute
# Distributing the software and/or documentation with other products
# (commercial or otherwise) or by other than electronic means without
# CGISCRIPT.NET's prior written permission is forbidden.
# All rights to the CGISCRIPT.NET software and documentation not expressly
# granted under this Agreement are reserved to CGISCRIPT.NET.
#
# Disclaimer of Warranty
# THIS SOFTWARE AND ACCOMPANYING DOCUMENTATION ARE PROVIDED "AS IS" AND
# WITHOUT WARRANTIES AS TO PERFORMANCE OF MERCHANTABILITY OR ANY OTHER
# WARRANTIES WHETHER EXPRESSED OR IMPLIED. BECAUSE OF THE VARIOUS HARDWARE
# AND SOFTWARE ENVIRONMENTS INTO WHICH CGISCRIPT.NET MAY BE USED, NO WARRANTY
# OF FITNESS FOR A PARTICULAR PURPOSE IS OFFERED. THE USER MUST ASSUME THE
# ENTIRE RISK OF USING THIS PROGRAM. ANY LIABILITY OF CGISCRIPT.NET WILL BE
# LIMITED EXCLUSIVELY TO PRODUCT REPLACEMENT OR REFUND OF PURCHASE PRICE.
# IN NO CASE SHALL CGISCRIPT.NET BE LIABLE FOR ANY INCIDENTAL, SPECIAL OR
# CONSEQUENTIAL DAMAGES OR LOSS, INCLUDING, WITHOUT LIMITATION, LOST PROFITS
# OR THE INABILITY TO USE EQUIPMENT OR ACCESS DATA, WHETHER SUCH DAMAGES ARE
# BASED UPON A BREACH OF EXPRESS OR IMPLIED WARRANTIES, BREACH OF CONTRACT,
# NEGLIGENCE, STRICT TORT, OR ANY OTHER LEGAL THEORY. THIS IS TRUE EVEN IF
# CGISCRIPT.NET IS ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. IN NO CASE WILL
# CGISCRIPT.NET' LIABILITY EXCEED THE AMOUNT OF THE LICENSE FEE ACTUALLY PAID
# BY LICENSEE TO CGISCRIPT.NET.
#
# Credits:
# Andy Angrick - Programmer - angrick@cgiscript.net
# Mike Barone - Design - mbarone@cgiscript.net
#
# For information about this script or other scripts see
# http://www.cgiscript.net
#
# Thank you for trying out our script.
# If you have any suggestions or ideas for a new innovative script
# please direct them to suggest@cgiscript.net. Thanks.
#
########################################################################
# Config Variables #
########################################################################
(! -e "$basepath/setup.cgi")?($nosetup=1):(require("$basepath/setup.cgi"));
$flock=1;
########################################################################
# End Config Variables #
########################################################################
require("$basepath/libs.cgi");
$| = 1;
&main;
sub main{
use Time::Local;
@DoW = ('Sun','Mon','Tue','Wed','Thu','Fri','Sat');
@MoY = ('January','February','March','April','May','June',
'July','August','September','October','November','December');
&getdata;
print "Content-type: text/html\n\n";
($in{'command'} eq 'savesetup')&&(($nosetup)?(&SaveSetup):(&PError("Error. Permission denied.")));
$in{'cgiurl'} = $cgiurl."/csCalendar.cgi";
$in{'imageurl'} = $imageurl;
if($in{'command'} eq 'viewsmall'){
&GetCookies;
foreach $i (keys %cookie){
next if ($i eq 'command');
$in{$i} = $cookie{$i};
}
}
if($in{'command'} eq 'viewlarge'){
&GetCookies;
foreach $i (keys %cookie){
next if ($i eq 'command');
$in{$i} = $cookie{$i};
}
}
($in{'command'} eq '')&&($nosetup)&&(&Setup);
($in{'command'} eq 'view')&&(&View);
($in{'command'} eq '')&&(&ViewInit);
($in{'command'} eq 'login')&&(&Login);
($in{'command'} eq 'viewsmall')&&(&ViewSmall);
($in{'command'} eq 'viewlarge')&&(&ViewLarge);
($in{'command'} eq 'showsubmit')&&(&ShowSubmit);
($in{'command'} eq 'submitforapproval')&&(&SubmitForApproval);
&GetLogin;
($in{'command'} eq 'manage')&&(&Manage);
($in{'command'} eq 'addnew')&&(&AddNew);
($in{'command'} eq 'delete')&&(&Delete);
($in{'command'} eq 'savechanges')&&(&SaveChanges);
($in{'command'} eq 'showedit')&&(&ShowEdit);
($in{'command'} eq 'savesettings')&&(&SaveSettings);
($in{'command'} eq 'showpending')&&(&ShowPending);
($in{'command'} eq 'approve')&&(&Approve);
($in{'command'} eq 'showlinks')&&(&ShowLinks);
}
sub ShowLinks{
$in{'smalljs'} = qq||;
$in{'largejs'} = qq||;
$in{'initjs'} = qq||;
($myurl) = $in{'cgiurl'} =~ /http:\/\/.*?(\/.*)/i;
$in{'small'} = qq||;
$in{'large'} = qq||;
$in{'init'} = qq||;
&PageOut("$cgipath/t_show_links.htm");
exit;
}
sub ViewInit{
if(!$in{'mday'}){
&ctime(time);
$in{'mday'} = $in{'myday'};
}
$in{'mode'} = '1';
&ViewCalendarSub;
($in{'o'} eq 'j')?(&PageOutJS("$cgipath/t_view_init.htm")):(&PageOut("$cgipath/t_view_init.htm"));
exit;
}
sub SubmitForApproval{
(!$in{'eventname'})&&(&PError("Error. Please enter an event title"));
##get highest ID in DB for unique ID.
my $sfile = &CheckSafe("$datapath/calenderdata.cgi");
open(DB,$sfile);
($flock)&&(flock(DB,2));
$id = 0;
while(){
($idt,@rest) = split("~",$_);
($idt > $id)&&($id = $idt);
}
close DB;
($flock)&&(flock(DB,8));
$id++;
&GetOutVars(0,$id);
&SendEmailNotify;
my $sfile = &CheckSafe("$datapath/calenderdata.cgi");
open(DB,">>$sfile");
($flock)&&(flock(DB,2));
print DB "$newentry\n";
close DB;
($flock)&&(flock(DB,8));
print <<"EOF";
EOF
exit;
}
sub SendEmailNotify{
$in{'fulldate'} = &ctime(timelocal(0,0,0,$in{'mday'},$in{'mymonth'}-1,$in{'myyear'}));
chomp $in{'fulldate'};
$in{'eventname'} =~ s/(\d+);/pack("c",$1)/ge;
$in{'eventdescription'} =~ s/(\d+);/pack("c",$1)/ge;
$in{'eventdescription'} =~ s/\\n/\n/g;
$message = qq|
The follow event has been submitted for your approval
Event Date
----------------
$in{'fulldate'}
Event Name
----------------
$in{'eventname'}
Event Description
-----------------
$in{'eventdescription'}
$in{'cgiurl'}?command=manage
|;
if($sendmail){
my $sfile = &CheckSafe("$sendmail");
open(MAIL,"|$sfile -t");
print MAIL <<"EOF";
To: $memail
From: $memail
Subject: New Calendar Submission
$message
EOF
close MAIL;
}
if($mailserver){
require("$basepath/sendmail.cgi");
&SendMail($memail,$memail,"New Calendar Submission",$message,$mailserver);
}
}
sub ShowSubmit{
&ViewCalendarSub;
&PageOut("$cgipath/t_public_add.htm");
exit;
}
sub ViewSmall{
$in{'mode'} = '1';
&ViewCalendarSub;
if($in{'allowpublic'} eq 'Yes'){
$in{'submitentry'} = qq||;
}
($in{'o'} eq 'j')?(&PageOutJS("$cgipath/t_view_small.htm")):(&PageOut("$cgipath/t_view_small.htm"));
exit;
}
sub ViewLarge{
$in{'mode'} = '1';
&ViewCalendarSub;
if($in{'allowpublic'} eq 'Yes'){
$in{'submitentry'} = qq||;
}
($in{'o'} eq 'j')?(&PageOutJS("$cgipath/t_view_large.htm")):(&PageOut("$cgipath/t_view_large.htm"));
exit;
}
sub View{
my $sfile = &CheckSafe("$datapath/calenderdata.cgi");
open(DB,"$sfile");
while(){
chomp;
@f = split("~",$_);
if($f[0] eq $in{'id'}){
$in{'eventname'} = $f[4];
$in{'eventname'} =~ s/(\d+);/pack("c",$1)/ge;
$in{'eventdescription'} = $f[5];
$in{'eventdescription'} =~ s/\\n/\n/g;
$in{'eventdescription'} =~ s/(\d+);/pack("c",$1)/ge;
$in{'eventdescription'} =~ s/\n/ \n/g;
$in{'mday'} = $f[1];
$in{'mymonth'} = $f[2];
$in{'myyear'} = $f[3];
last;
}
}
close DB;
$in{'fulldate'} = &ctime(timelocal(0,0,0,$in{'mday'},$in{'mymonth'}-1,$in{'myyear'}));
&PageOut("$cgipath/t_view.htm");
exit;
}
sub Approve{
my $sfile = &CheckSafe("$datapath/calenderdata.cgi");
open(DB,"+<$sfile");
while(){
@f = split("~",$_);
($f[0] ne $in{'id'})?(push(@l,$_)):(push(@l,"$f[0]~$f[1]~$f[2]~$f[3]~$f[4]~$f[5]~1\n"));
}
seek(DB,0,0);
foreach $i (@l){
print DB $i;
}
truncate(DB, tell(DB));
print <<"EOF";
EOF
exit;
}
sub ShowPending{
&GetEvents(0);
(!$in{'eventline'})&&($in{'eventline'} = qq|| No entries awaiting approval. | |);
&PageOut("$cgipath/t_admin_approval.htm");
exit;
}
sub SaveSettings{
my $sfile = &CheckSafe("$datapath/settings.cgi");
open(DB,">$sfile");
$in{'allowpublic'} =~ s/'//g;
$in{'dateformat'} =~ s/'//g;
$in{'separator'} =~ s/'//g;
print DB <<"EOF";
\$in{'allowpublic'} = '$in{'allowpublic'}';
\$in{'dateformat'} = '$in{'dateformat'}';
\$in{'separator'} = '$in{'separator'}';
1;
EOF
close DB;
print <<"EOF";
EOF
exit;
}
sub ShowEdit{
my $sfile = &CheckSafe("$datapath/calenderdata.cgi");
open(DB,"$sfile");
while(){
chomp;
@f = split("~",$_);
if($f[0] eq $in{'id'}){
$in{'eventname'} = $f[4];
$in{'eventdescription'} = $f[5];
$in{'eventdescription'} =~ s/\\n/\n/g;
$in{'mday'} = $f[1];
$in{'mymonth'} = $f[2];
$in{'myyear'} = $f[3];
last;
}
}
close DB;
$in{'bm1'} = qq||;
$in{'bm2'} = qq|
window.location = "#edit";
document.form1.eventname.focus();
|;
&Manage;
}
sub SaveChanges{
(!$in{'eventname'})&&(&PError("Error. Please enter an event title"));
(!$in{'id'})&&(&PError("Error. No id specified"));
&GetOutVars($in{'mode'},$in{'id'});
my $sfile = &CheckSafe("$datapath/calenderdata.cgi");
open(DB,"+<$sfile");
while(){
@f = split("~",$_);
($f[0] ne $in{'id'})?(push(@l,$_)):(push(@l,"$newentry\n"));
}
seek(DB,0,0);
foreach $i (@l){
print DB $i;
}
truncate(DB, tell(DB));
print <<"EOF";
EOF
exit;
}
sub Delete{
(!$in{'id'})&&(&PError("Error. No id specified"));
my $sfile = &CheckSafe("$datapath/calenderdata.cgi");
open(DB,"+<$sfile");
while(){
@f = split("~",$_);
($f[0] ne $in{'id'})&&(push(@l,$_));
}
seek(DB,0,0);
foreach $i (@l){
print DB $i;
}
truncate(DB, tell(DB));
print <<"EOF";
EOF
exit;
}
sub AddNew{
(!$in{'eventname'})&&(&PError("Error. Please enter an event title"));
##get highest ID in DB for unique ID.
my $sfile = &CheckSafe("$datapath/calenderdata.cgi");
open(DB,"$sfile");
($flock)&&(flock(DB,2));
$id = 0;
while(){
($idt,@rest) = split("~",$_);
($idt > $id)&&($id = $idt);
}
close DB;
($flock)&&(flock(DB,8));
$id++;
&GetOutVars(1,$id);
my $sfile = &CheckSafe("$datapath/calenderdata.cgi");
open(DB,">>$sfile");
($flock)&&(flock(DB,2));
print DB "$newentry\n";
close DB;
($flock)&&(flock(DB,8));
print <<"EOF";
EOF
exit;
}
sub GetOutVars{
my ($type,$id) = @_;
##check for long lines
$in{'eventname'} =~ s/(\S{40,41})/$1 /g;
$in{'eventdescription'} =~ s/(\S{100,101})/$1 /g;
##dhtml
if($in{'command'} eq 'submitforapproval'){
$in{'eventname'} =~ s/\<.*?\>//gs;
$in{'eventdescription'} =~ s/\<.*?\>//gs;
}
$in{'eventname'} =~ s/(\d+);/pack("c",$1)/ge;
$in{'eventdescription'} =~ s/(\d+);/pack("c",$1)/ge;
$in{'eventname'} =~ s/([^\w\s\n])/''.ord($1).';'/ge;
$in{'eventdescription'} =~ s/([^\w\s\n])/''.ord($1).';'/ge;
$in{'eventdescription'} =~ s/\r*\n/\\n/g;
$in{'eventname'} =~ s/\r*\n/\\n/g;
$in{'mday'} = sprintf("%.2d",$in{'mday'});
$in{'mymonth'} = sprintf("%.2d",$in{'mymonth'});
$in{'myyear'} = sprintf("%.4d",$in{'myyear'});
$newentry = "$id~$in{'mday'}~$in{'mymonth'}~$in{'myyear'}~$in{'eventname'}~$in{'eventdescription'}~$type";
}
sub GetSettings{
(-e "$datapath/settings.cgi")&&(require("$datapath/settings.cgi"));
(!$in{'allowpublic'})&&($in{'allowpublic'} = 'No');
(!$in{'dateformat'})&&($in{'dateformat'} = 'English');
(!$in{'separator'})&&($in{'separator'} = 'Hyphen');
$in{'allow'.$in{'allowpublic'}} = 'checked';
$in{'dateformat'.$in{'dateformat'}} = 'checked';
$in{'separator'.$in{'separator'}} = 'checked';
}
sub ViewCalendarSub{
(!$in{'viewby'})&&($in{'viewby'} = 'day');
&GetSettings;
if(!$in{'mymonth'}){
&GetDateInfo(time);
}
else{
&GetDateInfo(timelocal(0,0,0,1,$in{'mymonth'}-1,$in{'myyear'}));
}
(!$in{'myday'})&&($in{'myday'}='01');
(!$in{'mday'})&&($in{'mday'}=$in{'myday'});
&GetEvents($in{'mode'});
&CreateCalendar;
$in{'mymonth'} = sprintf("%.2d",$in{'mymonth'});
$in{'m'.$in{'mymonth'}} = 'selected';
$in{'y'.$in{'myyear'}} = 'selected';
$in{'fulldate'} = &ctime(timelocal(0,0,0,$in{'mday'},$in{'mymonth'}-1,$in{'myyear'}));
($in{'viewby'} eq 'month')&&($msg = 'month');
($in{'viewby'} eq 'day')&&($msg = 'day');
($in{'viewby'} eq 'all')&&($msg = 'calendar');
($in{'mode'} eq '0')&&($msg = 'queue');
(!$in{'eventline'})&&($in{'eventline'} = qq|| No entries for this $msg. | |);
($in{'viewby'} eq 'month')&&($in{'vmonth'} = 'selected');
($in{'viewby'} eq 'day')&&($in{'vday'} = 'selected');
($in{'viewby'} eq 'all')&&($in{'vall'} = 'selected');
}
sub Manage{
if(!$in{'mday'}){
&ctime(time);
$in{'mday'} = $in{'myday'};
}
(!$in{'viewby'})&&($in{'viewby'} = 'day');
($in{'mode'} eq '')&&($in{'mode'} = '1');
&ViewCalendarSub;
($in{'mode'} eq '0')?(&PageOut("$cgipath/t_admin_approval.htm")):(&PageOut("$cgipath/t_admin_entries.htm"));
}
sub GetEvents{
my ($type) = @_;
my $sfile = &CheckSafe("$datapath/calenderdata.cgi");
open(DB,"$sfile");
while(){
chomp;
@f = split("~",$_);
($f[6] != $type)&&(next);
#highlighted days
$h{$f[1].$f[2].$f[3]}='';
$c{$f[1].$f[2].$f[3]}='bgcolor="#CCCCCC"';
if($f[2] == $in{'mymonth'}){
$t{$f[1].$f[2].$f[3]} .= "- $f[4] ";
}
if($in{'mode'} eq '0'){
$order{"$f[3]$f[2]$f[1]$f[0]"} = $_;
}
else{
if($in{'viewby'} eq 'month'){
if(($f[2] == $in{'mymonth'})&&($f[3] == $in{'myyear'})){
$order{"$f[3]$f[2]$f[1]$f[0]"} = $_;
}
}
elsif($in{'viewby'} eq 'day'){
if(($f[1] == $in{'mday'})&&($f[2] == $in{'mymonth'})&&($f[3] == $in{'myyear'})){
$order{"$f[3]$f[2]$f[1]$f[0]"} = $_;
}
}
else{
$order{"$f[3]$f[2]$f[1]$f[0]"} = $_;
}
}
}
close DB;
foreach $i (sort keys %order){
@f = split("~",$order{$i});
($type eq '0')&&($button = qq~ | Approve~);
if($in{'command'} ne 'viewsmall'){
$manageline = qq~
Modify |
Delete$button |
~;
}
($in{'separator'} eq 'Slash')&&($separator = '/');
($in{'separator'} eq 'Hyphen')&&($separator = '-');
($in{'separator'} eq 'Period')&&($separator = '.');
if($in{'dateformat'} eq 'English'){
$thisdate = "$f[2]$separator$f[1]$separator$f[3]";
}
else{
$thisdate = "$f[1]$separator$f[2]$separator$f[3]";
}
$in{'eventline'} .= qq~
| $thisdate |
$f[4] |
$manageline
~;
}
}
sub CreateCalendar{
$in{'calendarsmall'} = qq|
| $DoW[$fmday[0]] |
$DoW[$fmday[1]] |
$DoW[$fmday[2]] |
$DoW[$fmday[3]] |
$DoW[$fmday[4]] |
$DoW[$fmday[5]] |
$DoW[$fmday[6]] |
|;
$in{'calendarlarge'} = qq|
| $DoW[$fmday[0]] |
$DoW[$fmday[1]] |
$DoW[$fmday[2]] |
$DoW[$fmday[3]] |
$DoW[$fmday[4]] |
$DoW[$fmday[5]] |
$DoW[$fmday[6]] |
|;
my $day;
my $cday;
if($in{'command'} ne 'viewlarge'){
for $h (0..6){
$in{'calendarsmall'} .= qq|\n|;
for $v (0..6){
$day++;
$offday = $day - $fdayoffset;
(($offday <= $dim)&&($offday > 0))?($cday = $offday):($cday = '');
($offday > $dim)&&($te = 1);
$today = sprintf("%.2d",$cday).sprintf("%.2d",$in{'mymonth'}).sprintf("%.4d",$in{'myyear'});
if($cday){
$in{'calendarsmall'} .= qq|| $h{$today}$cday | \n|;
}
else{
$in{'calendarsmall'} .= qq|  | \n|;
}
}
$in{'calendarsmall'} .= qq| \n|;
($te)&&(last);
}
$in{'calendarsmall'} .= qq| |;
}
else{
for $h (0..6){
$in{'calendarlarge'} .= qq|\n|;
for $v (0..6){
$day++;
$offday = $day - $fdayoffset;
(($offday <= $dim)&&($offday > 0))?($cday = $offday):($cday = '');
($offday > $dim)&&($te = 1);
$today = sprintf("%.2d",$cday).sprintf("%.2d",$in{'mymonth'}).sprintf("%.4d",$in{'myyear'});
if($cday){
$in{'calendarlarge'} .= qq|$h{$today}$cday $t{$today} | \n|;
}
else{
$in{'calendarlarge'} .= qq|  | \n|;
}
}
$in{'calendarlarge'} .= qq| \n|;
($te)&&(last);
}
$in{'calendarlarge'} .= qq| |;
}
}
sub GetDateInfo{
my ($time) = @_;
&ctime($time);
$bom = timelocal(0,0,0,1,$in{'mymonth'}-1,$in{'myyear'});
@info = localtime($bom);
$fdayoffset = $info[6];
for $i (0..6){
$didx = $fday + $i;
($didx > 6)&&($didx = $didx - 7);
$fmday[$i] = $didx;
}
for $i (0..32){
@info = localtime($bom + (86400 * $i));
if($info[4] != ($in{'mymonth'}-1)){
last;
}
$dim = $info[3];
}
}
sub PageOutJS{
local($file) = @_;
my $sfile = &CheckSafe("$file");
open(OUT,"$sfile")||print "$!: $file ";
while(){
$o = $_;
$o =~ s/in\((\w+)\)/$in{$1}/g;
$o =~ s/\"/\\"/g;
$o =~ s/\\n/\\\\n/g;
$o =~ s/(scr)(ipt)/$1\"\+\"$2/gsi;
@mylines = split(/\r*\n/,$o);
foreach $q (@mylines){
print qq|document.write("$q\\n");\n|;
}
}
close OUT;
}
sub GetLogin{
&GetCookies;
$in{'UserName'} = $cookie{'UserName'};
$in{'PassWord'} = $cookie{'PassWord'};
if(!$in{'UserName'}){
&PageOut("$cgipath/t_login.htm");
exit;
}
if(($in{'UserName'} eq $username)&&($in{'PassWord'} eq $password)){
#good to go.
return;
}
&PError("Error. Invalid username or password");
}
sub Login{
&PageOut("$cgipath/t_login.htm");
exit;
}
sub SaveSetup{
(-e "$basepath/setup.cgi")&&(&PError("Error. Access Denied"));
($ENV{'REQUEST_METHOD'} !~ /post/i)&&(&PError("Error. Access Denied"));
(!$in{'cgipath'})&&(&PError("Error. Please enter a cgipath variable"));
(!$in{'cgiurl'})&&(&PError("Error. Please enter a cgiurl variable"));
(!$in{'datapath'})&&(&PError("Error. Please enter a datapath variable"));
(!$in{'imageurl'})&&(&PError("Error. Please enter an imageurl variable"));
(!$in{'sendmail'})&&(&PError("Error. Please enter the path to sendmail"));
(!$in{'username'})&&(&PError("Error. Please enter a username"));
(!$in{'username'})&&(&PError("Error. Please enter a username"));
(!$in{'password'})&&(&PError("Error. Please enter a password"));
my $sfile = &CheckSafe("$basepath/setup.cgi");
open(SETUP,">$sfile");
print SETUP <<"EOF";
\$cgipath = '$in{'cgipath'}';
\$cgiurl = '$in{'cgiurl'}';
\$datapath = '$in{'datapath'}';
\$imageurl = '$in{'imageurl'}';
\$sendmail = '$in{'sendmail'}';
\$memail = '$in{'memail'}';
\$username = '$in{'username'}';
\$password = '$in{'password'}';
1;
EOF
close SETUP;
print <<"EOF";
EOF
exit;
}
sub Setup{
use Cwd;
$in{'cgipath'} = Cwd::cwd();
$in{'cgiurl'} = "$ENV{'HTTP_HOST'}/$ENV{'SCRIPT_NAME'}";
$in{'cgiurl'} =~ s/\/\//\//g;
$in{'cgiurl'} = "http://".$in{'cgiurl'};
$in{'cgiurl'} =~ s/\/csCalendar\.cgi//i;
$in{'datapath'} = $in{'cgipath'}.'/data';
$in{'imageurl'} = $in{'cgiurl'}.'/images';
$in{'sendmail'} = '/usr/sbin/sendmail';
$in{'memail'} = 'you@yourdomain.com';
$in{'username'} = 'demo';
$in{'password'} = 'demo';
&PageOut("t_setup.htm");
exit;
}
sub CheckSafe{
my ($file) = @_;
($file =~ /\.\./)&&(&PError("Error. Invalid filename"));
($file =~ /\|/)&&(&PError("Error. Invalid filename"));
return $file;
} |
 |