#!/usr/bin/perl
$use_absolute_reference = "no";
$urladdress = "http://www.active-scripts.net/cgi-bin/guestbook/guestbook.pl";
if ($use_absolute_reference eq "no")
{
$guesturl = "$ENV{'SCRIPT_NAME'}";
}
else
{
$guesturl = $urladdress;
}
$| = 1;
$demo="off";
$algo = "";
$previewline = "
";
$version = "500006";
$bversion = "5.6";
&subdirectory;
&ver204;
&cookie_vars; #basic cookie variable
$salt = "active"; # to help crypt
$enc = crypt(active, $salt); # set default password
$location_of_lock_file = "guestbook.lock"; ## thanks to extropia.com
$cookie_control = "off";
unless (-e "$guestbook_data_name")
{
@months = ("January","February","March","April","May","June","July","August","September","October","November","December");
&GetDate;
$now = &amqdate($messagedate);
}
&startup;
&open_prefs;
&GetDate;
&check_values;
$now = &amqdate($messagedate);
&check_update;
&check_new_files;
$alignment_default = "center";
$alignment = "center" if ($alignment eq "");
if ($ENV{'REQUEST_METHOD'} eq "GET") {
$buffer = $ENV{'QUERY_STRING'};
}
elsif ($ENV{'REQUEST_METHOD'} eq "POST") {
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
}
@pairs = split(/&/, $buffer);
foreach $pair (@pairs)
{
($name, $value) = split(/=/, $pair);
# Un-Webify plus signs and %-encoding
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
#$value =~ s/PIPEPIPE/|/gi;
$FORM{$name} = $value;
$name =~ s/_/ /g;
$name =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
}
$action = $FORM{'action'};
$direct = $FORM{'direct'};
$search_words = $FORM{'search_words'};
$search_fields = $FORM{'search_fields'};
$search_english= $FORM{'reload'};
$alignment_default = "center";
@old_words = split (/\,/, $bad_words);
@active_default_alignment = split (//, $alignment_default);
$cookie_default = join ("", reverse @active_default_alignment);
#$added_words = "skcuf daehtihs etihs tihs stihs tawt reggin rekcufrehtom rekcuf tnuc rekcus kcoc dratsab kcuf gnikcuf sknaw
knaw stnuc sdratsab sreknaw reknaw elohesra selohesra esra sesra";
@letters = split (//, $added_words) ;
$reverse = join ("", reverse @letters);
@new_words = split (/ /, $reverse);
@words = (@new_words, @old_words);
$host = ".rorre noitartsigeR";
@backhost = split (//, $host) ;
$valid_ip = join ("", reverse @backhost);
@anti_ips = split (/\,/, $anti_ips);
$ipoops = "no";
$RemoteHost = $ENV{'REMOTE_HOST'};
if ((!$RemoteHost) || ($RemoteHost =~ m!^\d+\.\d+\.\d+\.\d+$!)) {
if ($ENV{'REMOTE_ADDR'} =~ m!^(\d+)\.(\d+)\.(\d+)\.(\d+)$!) {
$RemoteHost = (gethostbyaddr(pack('C4',$1,$2,$3,$4),2))[0] || $ENV{'REMOTE_ADDR'};
}
$RemoteHost =~ tr[A-Z][a-z];
}
foreach (@anti_ips) {
next unless $_;
$ipoops = "yes" if ($RemoteHost =~ m!$_!);
$ipoops = "yes" if ($ENV{'REMOTE_ADDR'} =~ m!$_!);
}
sub end
{
&basic_header;
print qq~ $title
$TXT_blocked_IP
~;
exit;
}
if ($search_english eq $cookie_default)
{
&content;
open(UUU,">$ip_name") || &oops('$ip_name');
print UUU "$cookie_default";
close(UUU);
print "done";
exit;
}
open(IP,"$ip_name") || &oops('$ip_name');
$ip_addresses = ;
close(IP);
&update_ip_addresses;
&actions;
########### read
sub read
{
open(USER_FILE,"$guestbook_data_name") || &oops('$guestbook_data_name');
@datalist = ();
@data = ();
@data = ;
close(USER_FILE);
foreach $row (@data)
{
@fields = split (/\|/, $row);
unless (($fields[10] eq "del") || ($fields[15] eq "waiting") || ($fields[16] eq "yes"))
{
push (@datalist, $row);
}
}
$number_of_messages = @datalist;
if ($order eq "reversed")
{
@data_ordered = reverse(@datalist);
}
elsif ($order eq "random")
{
srand;
@new = ();
for( @datalist )
{
my $r = rand @new+1;
push(@new,$new[$r]);
$new[$r] = $_;
}
@data_ordered = @new;
}
elsif ($order eq "alpha_name")
{
foreach $lrow (@datalist)
{
@lrow = split (/\|/, $lrow);
$sortable_field = $lrow[1];
unshift (@lrow, $sortable_field);
$lnew_row = join ("\|", @lrow);
push (@new_rows, $lnew_row);
}
@datalist = ();
@sorted_rows = sort (@new_rows);
foreach $sorted_row (@sorted_rows)
{
@row = split (/\|/, $sorted_row);
$sorted_field = shift (@row);
$old_but_sorted_row = join ("\|", @row);
push (@data_ordered, $old_but_sorted_row);
}
}
elsif ($order eq "alpha_message")
{
foreach $lrow (@datalist)
{
@lrow = split (/\|/, $lrow);
$sortable_field = $lrow[2];
unshift (@lrow, $sortable_field);
$lnew_row = join ("\|", @lrow);
push (@new_rows, $lnew_row);
}
@datalist = ();
@sorted_rows = sort (@new_rows);
foreach $sorted_row (@sorted_rows)
{
@row = split (/\|/, $sorted_row);
$sorted_field = shift (@row);
$old_but_sorted_row = join ("\|", @row);
push (@data_ordered, $old_but_sorted_row);
}
}
else
{
@data_ordered = @datalist;
}
##############
&content;
&main_header;
&active_header if $active_header eq "on";
print qq~ ~;
&user_image if $user_image eq "yes";
&title if $use_title eq "on";
&user_html if $use_user_html eq "yes";
&menu;
&no_of_messages_display if $show_no_of_messages eq "yes";
$count = 1;
$grouped = 0;
$no_displayed = int($no_displayed); # fix any funny numbers entered by user
# fix any numbers entered less than one
if ($no_displayed <1)
{
$no_displayed = 1;
}
$start_number = $FORM{'start_number'};
$new_start_number = ($start_number + $no_displayed);
$old_start_number = ($start_number - $no_displayed);
$startplus = $start_number +1;
# print qq~ ~;
unless ($old_start_number < 0)
{
print qq~ $left_bracket$TXT_previous $right_bracket
~;
}
&show_number_menu unless ($number_of_messages <($no_displayed+1));
unless ($new_start_number > ($number_of_messages -1 ))
{
print qq~ $left_bracket$TXT_next $right_bracket
~;
}
if (($new_start_number > ($number_of_messages -1 )) && ($number_of_messages >($no_displayed)))
{
print qq~ ~;
}
print qq~ ~;
if ($new_start_number < $number_of_messages)
{
print qq~ $TXT_viewing_messages$startplus$TXT_to$new_start_number$TXT_after_last_number ~;
}
else
{
if ($startplus == $number_of_messages)
{
print qq~ $TXT_viewing_message$startplus$TXT_after_last_number1 ~;
}
else
{
print qq~ $TXT_viewing_messages$startplus$TXT_to$number_of_messages$TXT_after_last_number ~;
}
}
foreach $row (@data_ordered)
{
@fields = split (/\|/, $row);
$grouped++;
if (($grouped > ($start_number)) && ($grouped < ($start_number + $no_displayed + 1)))
{
&main_table_results;
} # end if number is right
} # end for each row
# print qq~ ~;
if ($use_hr_image eq "yes")
{
print " ";
}
unless ($old_start_number < 0)
{
print qq~ $left_bracket$TXT_previous $right_bracket
~;
}
&show_number_menu unless ($number_of_messages <($no_displayed+1));
unless ($new_start_number > ($number_of_messages -1 ))
{
print qq~ $left_bracket$TXT_next $right_bracket
~;
}
&search_form;
&user_html_footer if $use_user_html_footer eq "yes";
print qq~
~;
print qq~
~;
&inter_footer;
} # end sub read
############ write
sub write
{
$page_after_write = "$guesturl\?action=reload" if (($page_after_write eq "") ||($page_after_write eq " ") );
###### anti-spam bit
if ($anti_spam eq "on")
{
$multiple_ip = "no";
open(USER_FILE,"$guestbook_data_name") || &oops('$guestbook_data_name');
@data = ;
close(USER_FILE);
foreach $row (@data)
{
@fields = split (/\|/, $row);
if (($ENV{'REMOTE_ADDR'} eq $fields[7]) && ($fields[9] eq $revdate))
{
$multiple_ip = "yes";
}
}
if ($multiple_ip eq "yes")
{
&content;
print qq~ $title
Active Guestbook $TXT_has_been_added
~;
&inter_footer;
exit;
}
}
######
$full_name = $FORM{'requiredfull_name'};
$message = $FORM{'requiredmessage'};
# fix arrow bug
$leftarrow = 0;
$rightarrow = 0;
@chars = split(//,$message);
foreach $char(@chars)
{
if ($char eq "<")
{
$leftarrow++;
}
elsif ($char eq ">")
{
$rightarrow++;
}
}
if ($leftarrow ne $rightarrow)
{
&content;
print "HTML code is incorrect. Please go back and fix the code.";
exit;
}
#
$guest_email = $FORM{'guest_email'};
$private_message_check = $FORM{'private_message_check'};
$location = $FORM{'location'};
$url = $FORM{'url'};
$url =~ s/http\:\/\///i;
if ($guest_email)
{
&check_address_for_mistakes;
}
unless ($action eq "post_preview")
{
$message =~ s/ /-BREAK-/gi if $allow_html eq "no";
$message =~ s/<([^>]|\n)*>//g if $allow_html eq "no";
$message =~ s/-BREAK-/ /gi if $allow_html eq "no";
}
$full_name =~ s/<([^>]|\n)*>//g;
$location =~ s/<([^>]|\n)*>//g;
unless ($action eq "preview")
{
$message =~ s/ /-BREAK-/gi if $allow_html eq "no";
$message =~ s/<([^>]|\n)*>//g if $allow_html eq "no";
$message =~ s/-BREAK-/ /gi if $allow_html eq "no";
$message =~ s/\|/ZPIPEPIPEY/g;
$location =~ s/\|/ZPIPEPIPEY/g;
$url =~ s/\|/ZPIPEPIPEY/g;
$full_name =~ s/\|/ZPIPEPIPEY/g;
$guest_email =~ s/\|/ZPIPEPIPEY/g;
}
$message =~ s/\r\n/ /g;
$message =~ s/\r/ /g;
$message =~ s/\n/ /g;
#$message =~ s/( )+/ /g;
$message =~ s/\s+/ /g;
$number_of_words = @words_in_message = split(/ /,$message);
$number_of_chars = @chars_in_message = split(//,$message);
($limit_no_of_chars_in_line = "yes") if ($limit_no_of_chars_in_line eq "");
if ($limit_no_of_chars_in_line eq "yes")
{
if ((($allow_html eq "yes") && ($message !~ /)) || ($allow_html ne "yes"))
{
$new_message = "";
unless ($action eq "post_preview")
{
foreach $individual_word (@words_in_message)
{
$length_of_this_word = length($individual_word);
if ($length_of_this_word > $max_chars_per_line)
{
$punctuated_message = "";
@individual_letters = split(//,$individual_word);
$rrr = @individual_letters;
for ($x = 0; $x < $rrr; $x++)
{
$yyyyyy = $individual_letters[$x];
if ((($x/$max_chars_per_line) == int($x/$max_chars_per_line)) && ($x != 0))
{
$punctuated_message = "$punctuated_message" . "$yyyyyy" . " ";
}
else
{
$punctuated_message = "$punctuated_message" . "$yyyyyy";
}
} # end for $x
$new_message = $new_message . " " . $punctuated_message;
}
else
{
$new_message = $new_message . " " . $individual_word;
}
} # end for each word
$message = $new_message;
}
} # unless limit
}
$message =~ s/^\s//;
##### block multiple posts
$multiple_post = "no";
open(USER_FILE,"$guestbook_data_name") || &oops('$guestbook_data_name');
@data = ;
close(USER_FILE);
foreach $row (@data)
{
@fields = split (/\|/, $row);
if (($full_name eq $fields[1]) && ($fields[2] eq $message))
{
$multiple_post = "yes";
}
}
if ($multiple_post eq "yes")
{
&thanks;
exit;
}
if (($number_of_words > $max_length) || ($number_of_chars > $max_length_chars))
{
&basic_header;
print qq~ $title
$TXT_too_many_words
~;
exit;
}
# check bad words
$oops = "no";
foreach (@words)
{
if (($message =~ /\b$_\b/i) || ($full_name =~ /\b$_\b/i) || ($guest_email =~ /\b$_\b/i) || ($location =~ /\b$_\b/i) || ($url
=~ /\b$_\b/i))
{
$oops = "yes";
last;
}
}
if ($oops eq "yes")
{
&basic_header;
print qq~ $title
$TXT_disallowed_word
~;
exit;
}
# end check bad words
# check for blocked IP
if ($ipoops eq "yes")
{
&basic_header;
print qq~ $title
$TXT_blocked_IP
~;
exit;
}
# end check for blocked IP
if ($action eq "preview")
{
&preview;
}
elsif ($action ne "no_preview")
{
$message =~ s/QUOTQUOT/"/g;
}
&get_file_lock("$location_of_lock_file");
open(NUMBER,"$counter_name") || &oops('$counter_name');
$num = ;
close(NUMBER);
$plus = $num+1;
open (NUMBER,">$counter_name");
print NUMBER "$plus";
close(NUMBER);
open(DATABASE,">>$guestbook_data_name");
if ($private_message_check eq "yes")
{
print DATABASE "$plus|$full_name|$message|$time_in_seconds|$guest_email|$location||$ENV{'REMOTE_ADDR'}|$now|$revdate||$url|||||$private_message_check|||||||||||||||\n";
}
elsif ($moderated eq "yes")
{
print DATABASE "$plus|$full_name|$message|$time_in_seconds|$guest_email|$location||$ENV{'REMOTE_ADDR'}|$now|$revdate||$url||||waiting||||||||||||||||\n";
}
else
{
print DATABASE "$plus|$full_name|$message|$time_in_seconds|$guest_email|$location||$ENV{'REMOTE_ADDR'}|$now|$revdate||$url|||||$private_message_check|||||||||||||||\n";
}
close(DATABASE);
&backup_to_dir;
&release_file_lock("$location_of_lock_file");
unless ($admin_email =~ /active\-scripts/gi)
{
if ($send_email_to_admin eq "on")
{
unless (-e $mail_path)
{
&content;
print qq~ The path to the mail path which you have given as - $mail_path - in the Control Panel does not seem to exist.
Please check and change.
In the short term you can turn off the email options and the program will run okay. ~;
exit;
}
open (MAIL, "|$mail_path $admin_email");
print MAIL "To: $admin_email\n";
print MAIL "From: $admin_email\n";
$title = "Guestbook" if ($title eq "");
print MAIL "Subject: $title message\n\n";
if ($private_message_check eq "yes")
{
print MAIL "You have a new PRIVATE message in your guestbook. The message appears below. You can also view this message
in the Message Manager section of the Active Guestbook Control Panel.\n\n";
}
elsif ($moderated eq "yes")
{
print MAIL "You have a new message in your guestbook which requires your approval. You can approve this message in the
Message Manager section of the Active Guestbook Control Panel.\n\n";
}
else
{
print MAIL "You have a new message in your guestbook\n\n";
}
$converted_message = $message;
$converted_message =~ s/ /\n/g;
print MAIL "=========================\n";
print MAIL "From: $full_name\n";
if ($guest_email) {
print MAIL "Email: $guest_email\n";
}
if ($location) {
print MAIL "Location: $location\n";
}
if ($url) {
print MAIL "URL: $url\n";
}
print MAIL "$converted_message\n\n";
print MAIL "=========================\n";
close(MAIL);
}
}
if (($guest_email) && ($send_email_to_guest eq "on") && ($moderated ne "yes"))
{
open (MAIL, "|$mail_path $guest_email");
print MAIL "To: $guest_email\n";
print MAIL "From: $admin_email\n";
print MAIL "Subject: $thanks_title\n\n";
print MAIL "$thank_you\n\n";
if ($thanks_include_message eq "on")
{
$converted_message = $message;
$converted_message =~ s/ /\n/g;
print MAIL "=========================\n";
print MAIL "Your message:\n\n";
print MAIL "$converted_message\n\n";
print MAIL "=========================\n";
}
close(MAIL);
}
if ($action ne "no_preview")
{
&thanks;
}
else
{
&no_thanks;
}
}
sub convert
{
}
sub add
{
&end if ($ipoops eq "yes");
&content;
&main_header;
&active_header if $active_header eq "on";
print qq~
~;
&user_image if $user_image eq "yes";
&title if $use_title eq "on";
&user_html if $use_user_html eq "yes";
&menu;
if ($table_width =~ /\%/)
{
$table_width_per = $table_width;
$table_width_per =~ s/\%//gi;
$table_width_per = $table_width_per/3;
$table_width_per = ($table_width_per . "%");
$col1 = $table_width_per;
}
else
{
$col1 = ($table_width/3);
# $col2 = ($table_width - $col1);
}
if ($use_preview eq "yes")
{
$whatever = "preview";
}
else
{
$whatever = "no_preview";
}
#########
print qq~
~;
&user_html_footer if $use_user_html_footer eq "yes";
print qq~
~;
print "\n\n";
} # end sub add
########## startup
sub startup
{
unless (-e "$guestbook_backups_directory")
{
mkdir ($guestbook_backups_directory, 0777);
chmod(0777, "$guestbook_backups_directory");
open(BAK,">./$guestbook_backups_directory/undo_restore.bak");
close(BAK);
}
unless (-e "$guestbook_files_directory")
{
mkdir ($guestbook_files_directory, 0777);
chmod(0777, "$guestbook_files_directory");
}
########## months
unless (-e "$months_name")
{
open(MONTHS,">$months_name");
chmod(0777, "$months_name");
print MONTHS "January\nFebruary\nMarch\nApril\nMay\nJune\nJuly\nAugust\nSeptember\nOctober\nNovember\nDecember\n";
close(MONTHS);
}
unless (-e "$months_bak_name")
{
open(MONTHS,">$months_bak_name");
chmod(0777, "$months_bak_name");
print MONTHS "January\nFebruary\nMarch\nApril\nMay\nJune\nJuly\nAugust\nSeptember\nOctober\nNovember\nDecember\n";
close(MONTHS);
}
unless (-e "$days_name")
{
open(DAYS,">$days_name");
chmod(0777, "$days_name");
print DAYS "Sunday\nMonday\nTuesday\nWednesday\nThursday\nFriday\nSaturday\n";
close(DAYS);
}
############ added for version 1.9 # create user and factory style defaults and style
unless (-e "$user_style_name")
{
open(STYLE,">$user_style_name");
chmod(0777, "$user_style_name");
print STYLE " \n";
print STYLE "\n";
close(STYLE);
}
####################
unless (-e "$senddate_name")
{
open(UPDATE1,">$senddate_name");
chmod(0777, "$senddate_name");
print UPDATE1 "$now";
close(UPDATE1);
}
unless (-e "$ip_name")
{
open(UPDATE3,">$ip_name");
chmod(0777, "$ip_name");
print UPDATE3 "$revdate";
close(UPDATE3);
}
unless (-e "$user_date_file")
{
open(UPDATE,">$user_date_file");
chmod(0777, "$user_date_file");
print UPDATE "date,3,6,7,8,8,8,8,8\n";
print UPDATE "space, , ,,,,,,\n";
print UPDATE "hours,0,,,,,,,\n";
close(UPDATE);
}
unless (-e "$update_name")
{
open(UPDATE,">$update_name");
chmod(0777, "$update_name");
print UPDATE "$revdate";
close(UPDATE);
}
unless (-e "$user_html_name")
{
open(USER_HTML,">$user_html_name");
chmod(0777, "$user_html_name");
print USER_HTML "You can type some html here which will appear just above the menu. ";
close(USER_HTML);
}
unless (-e "$user_html_footer_name")
{
open(USER_HTML,">$user_html_footer_name");
chmod(0777, "$user_html_footer_name");
print USER_HTML "You can type some html here which will appear at the bottom of your page.";
close(USER_HTML);
}
unless (-e "$user_default_html_name")
{
open(USER_DEFAULT_HTML,">$user_default_html_name");
chmod(0777, "$user_default_html_name");
print USER_DEFAULT_HTML "You can type some html here which will appear just above the menu. ";
close(USER_DEFAULT_HTML);
}
unless (-e "$user_default_html_footer_name")
{
open(USER_DEFAULT_HTML,">$user_default_html_footer_name");
chmod(0777, "$user_default_html_footer_name");
print USER_DEFAULT_HTML "You can type some html here which will appear at the bottom of your page.";
close(USER_DEFAULT_HTML);
}
unless (-e "$thank_you_name")
{
open(THANKS,">$thank_you_name");
chmod(0777, "$thank_you_name");
print THANKS "Thank you very much for adding a message to our guestbook. Your support is much appreciated.\n\n";
print THANKS "Regards\n";
print THANKS "All at active-scripts.net\n\n";
print THANKS "=================================\n";
close(THANKS);
}
unless (-e "$thank_you_user_default_name")
{
open(THANKS,">$thank_you_user_default_name");
chmod(0777, "$thank_you_user_default_name");
print THANKS "Thank you very much for adding a message to our guestbook. Your support is much appreciated.\n\n";
print THANKS "Regards\n";
print THANKS "All at active-scripts.net\n\n";
print THANKS "=================================\n";
close(THANKS);
}
unless (-e "$tempcolprefs_name")
{
open(COLFILE,">$tempcolprefs_name");
chmod(0777, "$tempcolprefs_name");
print COLFILE "\n";
close(COLFILE);
}
unless (-e "$counter_name")
{
open(COUNTER,">>$counter_name");
chmod(0777, "$counter_name");
print COUNTER "1000100";
close(COUNTER);
chmod(0777, "$counter_name");
}
unless (-e "$active_name")
{
if (&GetCookies('activea'))
{
$coolkiepass = $Cookies{'activea'};
open(ACTIVE,">>$active_name");
chmod(0777, "$active_name");
print ACTIVE "$coolkiepass";
close(ACTIVE);
}
else
{
open(ACTIVE,">>$active_name");
chmod(0777, "$active_name");
print ACTIVE "$enc";
close(ACTIVE);
}
}
############# # language prefs added version 1.9
unless (-e "$langprefs_name")
{
open(PREFS,">>$langprefs_name");
chmod(0777, "$langprefs_name");
print PREFS "web_comment=Webmaster comments =\n";
print PREFS "TXT_add_a_message=Add a message=\n";
print PREFS "TXT_search=Search=\n";
print PREFS "TXT_previous=<<<=\n";
print PREFS "TXT_next=>>>=\n";
print PREFS "TXT_there_is_now=There is now =\n";
print PREFS "TXT_there_are_now=There are now =\n";
print PREFS "TXT_messages_in_our_guestbook= messages in our guestbook.=\n";
print PREFS "TXT_message_in_our_guestbook= message in our guestbook.=\n";
print PREFS "TXT_viewing_message=Viewing message =\n";
print PREFS "TXT_viewing_messages=Viewing messages =\n";
print PREFS "TXT_to= to =\n";
print PREFS "TXT_after_last_number=.=\n";
print PREFS "TXT_after_last_number1=.=\n";
print PREFS "TXT_you_can_search_this_guestbook_by=You can search this guestbook by:=\n";
print PREFS "TXT_searchmessage=Message :=\n";
print PREFS "TXT_searchname=Name :=\n";
print PREFS "TXT_searchall=All :=\n";
print PREFS "TXT_searchsearch=Search=\n";
print PREFS "TXT_searchtext=Please type some text:=\n";
print PREFS "TXT_back_to_guestbook=Back to guestbook=\n";
print PREFS "TXT_your_name=Your name=\n";
print PREFS "TXT_your_message=Your message=\n";
print PREFS "TXT_required=(required)=\n";
print PREFS "TXT_where_in_the_world=Where in the world?=\n";
print PREFS "TXT_your_email_address=Your email address=\n";
print PREFS "TXT_your_web_page_address=Your web page address=\n";
print PREFS "TXT_if_you_have_one=(if you have one)=\n";
print PREFS "TXT_private_message=Private message=\n";
print PREFS "TXT_private_message2=(when checked, message will not appear in guestbook)=\n";
print PREFS "TXT_continue=Continue=\n";
print PREFS "TXT_these_are_the=These are the details you have given.=\n";
print PREFS "TXT_if_correct=If they are correct, please click Continue.=\n";
print PREFS "TXT_if_not=If not, please =\n";
print PREFS "TXT_go_back=go back =\n";
print PREFS "TXT_and_edit=and edit.=\n";
print PREFS "TXT_none_given=None given=\n";
print PREFS "TXT_has_been_added=Thanks. Your message has been added to our guestbook.=\n";
print PREFS "TXT_has_been_added_moderated=Thanks. Your message has been sent to our webmaster and will be added shortly.=\n";
print PREFS "TXT_has_been_added_private=Thanks. Your private message has been sent to our webmaster.=\n";
print PREFS "TXT_search_results=Search results=\n";
print PREFS "TXT_back_search_again=Back to Guestbook/Search again=\n";
print PREFS "TXT_one_match=One guestbook message matches your search criteria.=\n";
print PREFS "TXT_no_match=Sorry, no messages in our guestbook match your search criteria.=\n";
print PREFS "TXT_more_matches_1=There are =\n";
print PREFS "TXT_more_matches_2= guestbook messages that match your search criteria.=\n";
print PREFS "TXT_please_fill_in=Please fill in all required fields.=\n";
print PREFS "TXT_please_go_back_and_edit=Please go back and edit=\n";
print PREFS "TXT_no_dot_at_start=Email addresses don't start with dots or @ signs.=\n";
print PREFS "TXT_no_www_at_start=Email addresses don't start with www. That's a web page address.=\n";
print PREFS "TXT_no_squiggles_in_domain=There should not be any underlines or squiggles or hashes after the @ in your email
address.=\n";
print PREFS "TXT_only_one_at=There should be one (and only one) @ in your email address.=\n";
print PREFS "TXT_no_dots_next=You are not allowed to have dots next to each other or next to @ sign in your email address.=\n";
print PREFS "TXT_wrong_end=All email addresses end in a dot and some letters (such as .com, .net, .uk, .ac etc.).=\n";
print PREFS "TXT_too_many_words=Your message is too long. Please go back and edit.=\n";
print PREFS "TXT_disallowed_word=Your message contains a disallowed word. Please go back and edit.=\n";
print PREFS "TXT_blocked_IP=This service is currently unavailable.=\n";
close(PREFS);
}
######## create and write FACTORY DEFAULT $langprefs_backup_name
unless (-e "$langprefs_backup_name")
{
open(FILE,"$langprefs_name");
@lines = ;
close(FILE);
open(BAK,">$langprefs_backup_name");
chmod(0777, "$langprefs_backup_name");
foreach $line (@lines)
{
print BAK "$line";
}
close(BAK);
}
###############
unless (-e "$prefs_name")
{
open(PREFS,">>$prefs_name");
chmod(0777, "$prefs_name");
print PREFS "page_after_write==\n";
print PREFS "limit_no_of_chars_in_line=no=\n";
print PREFS "max_chars_per_line=50=\n";
print PREFS "show_guest_email=yes=\n";
print PREFS "show_guest_url=yes=\n";
print PREFS "use_preview=yes=\n";
print PREFS "email_link_type=image=\n";
print PREFS "web_link_type=image=\n";
print PREFS "url_text=url=\n";
print PREFS "email_txt=@=\n";
print PREFS "url_image=http://www.active-scripts.net/url.gif=\n";
print PREFS "email_image=http://www.active-scripts.net/mail.gif=\n";
print PREFS "use_mailto=yes=\n";
print PREFS "web_enabled=yes=\n";
print PREFS "textfontface=Arial=\n";
print PREFS "textfontsize=2=\n";
print PREFS "marginwidth=0=\n";
print PREFS "marginheight=0=\n";
print PREFS "alignment=center=\n";
print PREFS "allow_private_messages=no=\n";
print PREFS "title=Active Guestbook=\n";
print PREFS "show_line=yes=\n";
print PREFS "home_page=http://active-scripts.net/=\n";
print PREFS "show_home_page_link=yes=\n";
print PREFS "home_page_target=_top=\n";
print PREFS "home_page_title=Active Scripts=\n";
print PREFS "order=reversed=\n";
print PREFS "border_size=0=\n";
print PREFS "mail_path=/usr/lib/sendmail=\n";
print PREFS "admin_email=webmaster\@active-scripts.net=\n";
print PREFS "send_email_to_admin=off=\n";
print PREFS "send_email_to_guest=off=\n";
print PREFS "thanks_title=Active Scripts Guestbook=\n";
print PREFS "thanks_include_message=off=\n";
print PREFS "anti_ips=111.111.111.3,server.isp.com=\n";
print PREFS "bad_words=wankle,rotary,engine=\n";
print PREFS "no_displayed=5=\n";
print PREFS "max_length=400=\n";
print PREFS "max_length_chars=4000=\n";
print PREFS "use_hr_image=no=\n";
print PREFS "hr_image=http://www.active-scripts.net/line.gif=\n";
print PREFS "max=3000=\n";
print PREFS "days_to_delete=1000=\n";
print PREFS "days_to_trash=365=\n";
print PREFS "days_to_delete_backup_files=60=\n";
print PREFS "mail_backup_to_admin=no=\n";
print PREFS "mail_admin_backups_interval=monthly=\n";
print PREFS "mail_admin_backups_day=1=\n";
print PREFS "mail_admin_backups_month=1=\n";
print PREFS "anti_spam=off=\n";
print PREFS "allow_html=no=\n";
print PREFS "active_header=on=\n";
print PREFS "use_title=off=\n";
print PREFS "show_no_of_messages=yes=\n";
print PREFS "mung=off=\n";
print PREFS "user_image=no=\n";
print PREFS "user_image_url==\n";
print PREFS "use_user_html=no=\n";
print PREFS "use_user_html_footer=no=\n";
print PREFS "table_width=600=\n";
print PREFS "usebackgroundimage=no=\n";
print PREFS "backgroundimage=http://active-scripts.net/active_guestbook/background.jpg=\n";
print PREFS "table_width=600=\n";
print PREFS "style=on=\n";
print PREFS "moderated=no=\n";
print PREFS "field_length=40=\n";
print PREFS "left_bracket==\n";
print PREFS "middle_bracket=:=\n";
print PREFS "right_bracket==\n";
close(PREFS);
}
######## create and write FACTORY DEFAULT $prefs_backup_name
unless (-e "$prefs_backup_name")
{
open(FILE,"$prefs_name");
@lines = ;
close(FILE);
open(BAK,">$prefs_backup_name");
chmod(0777, "$prefs_backup_name");
foreach $line (@lines)
{
print BAK "$line";
}
close(BAK);
}
######## create and write USER DEFAULT $prefs_backup_name
unless (-e "$userprefs_backup_name")
{
open(USERDEFAULT,">$userprefs_backup_name");
chmod(0777, "$userprefs_backup_name");
foreach $line (@lines)
{
print USERDEFAULT "$line";
}
close(USERDEFAULT);
}
######## create and write COLOR preferences
unless (-e "$colprefs_name")
{
open(COLPREFS,">>$colprefs_name");
chmod(0777, "$colprefs_name");
print COLPREFS "trans_search=no=\n";
print COLPREFS "trans_message_header=no=\n";
print COLPREFS "trans_message_body=no=\n";
print COLPREFS "backcolor=#ffffff=\n";
print COLPREFS "data_color1=#66cc99=\n";
print COLPREFS "data_color2=#cc9900=\n";
print COLPREFS "textdata_color1=#000000=\n";
print COLPREFS "textdata_color2=#000000=\n";
print COLPREFS "table_color1=#fffff0=\n";
print COLPREFS "table_color2=#ffffd0=\n";
print COLPREFS "texttable_color1=#000000=\n";
print COLPREFS "texttable_color2=#000000=\n";
print COLPREFS "backcolor=#ffffff=\n";
print COLPREFS "link=#000000=\n";
print COLPREFS "vlink=#000000=\n";
print COLPREFS "alink=#000000=\n";
print COLPREFS "text=#000000=\n";
# print COLPREFS "commentcolor=#ff0000=\n";
print COLPREFS "searchcolor=#eeeeee=\n";
close(COLPREFS);
}
######## create and write FACTORY DEFAULT COLOR preferences
unless (-e "$colprefs_backup_name")
{
open(FILE,"$colprefs_name");
@lines = ;
close(FILE);
open(BAK,">$colprefs_backup_name");
chmod(0777, "$colprefs_backup_name");
foreach $line (@lines)
{
print BAK "$line";
}
close(BAK);
}
######## create and write USER DEFAULT COLOR preferences
unless (-e "$usercolprefs_backup_name")
{
open(USERDEFAULT,">$usercolprefs_backup_name");
chmod(0777, "$usercolprefs_backup_name");
foreach $line (@lines)
{
print USERDEFAULT "$line";
}
close(USERDEFAULT);
}
unless (-e "$guestbook_data_name")
{
chmod(0777, "$prefs_name");
chmod(0777, "$colprefs_name");
&open_prefs;
umask 000;
open(TEMP,">>$guestbook_data_name");
print TEMP "1000001|Sample user|Great guestbook.|$time_in_seconds||Uganda|||$now|$revdate||||||||||||||||||||||\n";
for ($w=2;$w<10;$w++)
{
print TEMP "100000$w|Sample user $w|Sample message $w.|$time_in_seconds||Uganda|||$now|$revdate||||||||||||||||||||||\n";
}
print TEMP "1000030|Active Scripts |Well done. You have successfully installed Active Guestbook. ";
print TEMP "Once you have browsed the features in the public part of the guestbook, you will want to access the Active Guestbook
Control Panel which allows you to manage your guestbook. To access the Control Panel, you will normally need to use a password.
The default password is the word active in lower case but you can change it to anything you like.";
print TEMP "
The first thing you should do once you visit the Control Panel is to add the page to your Bookmarks/Favorites
so that you can easily get there in the future.
You can now go to the Control Panel by clicking
here.
";
print TEMP "You will of course want to delete all these sample messages once you get things set up the way you want.|$time_in_seconds|anthony\@active-scripts.net|active-scripts.net|||$now|$revdate||www.active-scripts.net||||||||||||||||||||\n";
close(TEMP);
chmod(0777, "$guestbook_data_name");
&finish_start;
exit;
}
} # end startup
sub finish_start
{
&content;
print qq~
$title
Active Guestbook Installation Manager
Active Guestbook has been successfully installed and all support files have been generated.
Click here to view the guestbook
~;
}
############ Get Date
sub GetDate {
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
$bakday = $mday;
$time_in_seconds = time();
if ($sec < 10) { $sec = "0$sec"; }
if ($min < 10) { $min = "0$min"; }
if ($hour < 10) { $hour = "0$hour"; }
# if ($mon < 10) { $mon = "0$mon"; }
if ($mday < 10) { $mday = "0$mday"; }
$month = ($mon + 1);
if ($month < 10) { $month = "0$month"; }
@weekdaysbak = ("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");
$today = "$year"."$month"."$mday";
$bugyear = ($year + 1900);
$bugtoday = "$bugyear"."$month"."$mday";
$messagedate = "$mday"."/"."$month"."/"."$bugyear";
$mydate = "$mday"." "."$months[$mon]"." "."$bugyear";
$amqdate = "$mday"."/"."$month"."/"."$bugyear";
$revdate = "$bugyear"."$month"."$mday";
$housetoday1 = "$bugyear"."$month"."$mday";
} ###
sub get_file_lock
{
local ($lock_file) = @_;
local ($endtime);
$endtime = 2;
$endtime = time + $endtime;
while (-e $lock_file && time < $endtime)
{
sleep(2);
}
open(LOCK_FILE, ">$lock_file");
}
sub release_file_lock
{
local ($lock_file) = @_;
close(LOCK_FILE);
unlink($lock_file);
}
################# preferences
sub edit_prefs
{
&seek_cook;
&get_file_lock("$location_of_lock_file");
open(FILE,"$prefs_name");
@lines = ;
close(FILE);
open(FILE,">$prefs_name");
print FILE "show_guest_email=$FORM{'show_guest_email'}=\n";
print FILE "show_guest_url=$FORM{'show_guest_url'}=\n";
print FILE "email_link_type=$FORM{'email_link_type'}=\n";
print FILE "web_link_type=$FORM{'web_link_type'}=\n";
print FILE "url_image=$FORM{'url_image'}=\n";
print FILE "email_image=$FORM{'email_image'}=\n";
print FILE "url_text=$FORM{'url_text'}=\n";
print FILE "email_txt=$FORM{'email_txt'}=\n";
print FILE "page_after_write=$FORM{'page_after_write'}=\n";
print FILE "limit_no_of_chars_in_line=$FORM{'limit_no_of_chars_in_line'}=\n";
print FILE "max_chars_per_line=$FORM{'max_chars_per_line'}=\n";
print FILE "textfontface=$FORM{'textfontface'}=\n";
print FILE "textfontsize=$FORM{'textfontsize'}=\n";
print FILE "marginwidth=$FORM{'marginwidth'}=\n";
print FILE "marginheight=$FORM{'marginheight'}=\n";
print FILE "title=$FORM{'title'}=\n";
print FILE "show_line=$FORM{'show_line'}=\n";
print FILE "alignment=$FORM{'alignment'}=\n";
print FILE "allow_private_messages=$FORM{'allow_private_messages'}=\n";
print FILE "use_preview=$FORM{'use_preview'}=\n";
print FILE "border_size=$FORM{'border_size'}=\n";
print FILE "max=$FORM{'max'}=\n";
print FILE "home_page=$FORM{'home_page'}=\n";
print FILE "show_home_page_link=$FORM{'show_home_page_link'}=\n";
print FILE "home_page_target=$FORM{'home_page_target'}=\n";
print FILE "order=$FORM{'order'}=\n";
print FILE "mail_path=$FORM{'mail_path'}=\n";
print FILE "admin_email=$FORM{'admin_email'}=\n";
print FILE "send_email_to_admin=$FORM{'send_email_to_admin'}=\n";
print FILE "send_email_to_guest=$FORM{'send_email_to_guest'}=\n";
print FILE "home_page_title=$FORM{'home_page_title'}=\n";
print FILE "no_displayed=$FORM{'no_displayed'}=\n";
print FILE "max_length=$FORM{'max_length'}=\n";
print FILE "max_length_chars=$FORM{'max_length_chars'}=\n";
print FILE "anti_spam=$FORM{'anti_spam'}=\n";
print FILE "days_to_delete=$FORM{'days_to_delete'}=\n";
print FILE "days_to_trash=$FORM{'days_to_trash'}=\n";
print FILE "days_to_delete_backup_files=$FORM{'days_to_delete_backup_files'}=\n";
print FILE "mail_admin_backups_interval=$FORM{'mail_admin_backups_interval'}=\n";
print FILE "mail_admin_backups_day=$FORM{'mail_admin_backups_day'}=\n";
print FILE "mail_admin_backups_month=$FORM{'mail_admin_backups_month'}=\n";
print FILE "allow_html=$FORM{'allow_html'}=\n";
print FILE "active_header=$FORM{'active_header'}=\n";
print FILE "use_title=$FORM{'use_title'}=\n";
print FILE "show_no_of_messages=$FORM{'show_no_of_messages'}=\n";
print FILE "use_mailto=$FORM{'use_mailto'}=\n";
print FILE "mung=$FORM{'mung'}=\n";
print FILE "web_enabled=$FORM{'web_enabled'}=\n";
print FILE "use_hr_image=$FORM{'use_hr_image'}=\n";
print FILE "hr_image=$FORM{'hr_image'}=\n";
print FILE "user_image=$FORM{'user_image'}=\n";
print FILE "user_image_url=$FORM{'user_image_url'}=\n";
print FILE "use_user_html=$FORM{'use_user_html'}=\n";
print FILE "use_user_html_footer=$FORM{'use_user_html_footer'}=\n";
print FILE "table_width=$FORM{'table_width'}=\n";
print FILE "usebackgroundimage=$FORM{'usebackgroundimage'}=\n";
print FILE "backgroundimage=$FORM{'backgroundimage'}=\n";
print FILE "mail_backup_to_admin=$FORM{'mail_backup_to_admin'}=\n";
print FILE "thanks_title=$FORM{'thanks_title'}=\n";
print FILE "thanks_include_message=$FORM{'thanks_include_message'}=\n";
print FILE "style=$FORM{'style'}=\n";
print FILE "moderated=$FORM{'moderated'}=\n";
print FILE "field_length=$FORM{'field_length'}=\n";
print FILE "left_bracket=$FORM{'left_bracket'}=\n";
print FILE "middle_bracket=$FORM{'middle_bracket'}=\n";
print FILE "right_bracket=$FORM{'right_bracket'}=\n";
open(USER_FILE,">$user_html_name");
print USER_FILE "$FORM{'user_html'}";
close(USER_FILE);
open(USER_FILE,">$user_html_footer_name");
print USER_FILE "$FORM{'user_html_footer'}";
close(USER_FILE);
open(THANKS,">$thank_you_name");
print THANKS "$FORM{'thank_you'}";
close(THANKS);
open(UDS,">$user_style_name");
print UDS "$FORM{'user_style'}";
close(UDS);
$bad = $FORM{'bad_words'};
$bad =~ s/\s\s/ /g;
$bad =~ s/\s\s/ /g;
$bad =~ s/\s/,/g;
$bad =~ s/\,\,/,/g;
print FILE "bad_words=$bad=\n";
$bad1 = $FORM{'anti_ips'};
$bad1 =~ s/\s\s/ /g;
$bad1 =~ s/\s\s/ /g;
$bad1 =~ s/\s/,/g;
$bad1 =~ s/\,\,/,/g;
print FILE "anti_ips=$bad1=\n";
close(FILE);
&release_file_lock("$location_of_lock_file");
&content;
&main_headera;
print qq~ ~;
&main_headerb;
print qq~
Active Guestbook
Standard preferences updated.
~;
&inter_footer;
}
########## open prefs
sub open_prefs
{
open(FILE,"$prefs_name");
@LINES = ;
close(FILE);
open(COLFILE,"$colprefs_name");
@COLLINES = ;
close(COLFILE);
open(LANGFILE,"$langprefs_name");
@LANGLINES = ;
close(LANGFILE);
open(MONTHS,"$months_name");
@monthlist = ;
close(MONTHS);
@months = ();
foreach $monthss (@monthlist)
{
$monthss =~ s/\n//g;
$monthss =~ s/\r//g;
push (@months, $monthss);
}
open(DAYS,"$days_name");
@daylist = ;
close(DAYS);
@days = ();
foreach $dayss (@daylist)
{
$dayss =~ s/\n//g;
$dayss =~ s/\r//g;
push (@days, $dayss);
}
foreach $LANGLINE (@LANGLINES)
{
@langterms = split(/=/,$LANGLINE);
$LANGPREFS{$langterms[0]} = $langterms[1];
}
foreach $COLLINE (@COLLINES)
{
@colterms = split(/=/,$COLLINE);
$COLPREFS{$colterms[0]} = $colterms[1];
}
$brackets_exist = "no";
foreach $LINE (@LINES)
{
#upgrade
if ($LINE =~ /left_bracket/gi)
{
$brackets_exist = "yes";
}
# end upgrade
@terms = split(/=/,$LINE);
$PREFS{$terms[0]} = $terms[1];
}
#upgrade
# end upgrade
################
$TXT_add_a_message = $LANGPREFS{'TXT_add_a_message'};
$TXT_search = $LANGPREFS{'TXT_search'};
$TXT_previous = $LANGPREFS{'TXT_previous'};
$TXT_next = $LANGPREFS{'TXT_next'};
$TXT_there_is_now = $LANGPREFS{'TXT_there_is_now'};
$TXT_there_are_now = $LANGPREFS{'TXT_there_are_now'};
$TXT_messages_in_our_guestbook = $LANGPREFS{'TXT_messages_in_our_guestbook'};
$TXT_message_in_our_guestbook = $LANGPREFS{'TXT_message_in_our_guestbook'};
$TXT_viewing_message = $LANGPREFS{'TXT_viewing_message'};
$TXT_viewing_messages = $LANGPREFS{'TXT_viewing_messages'};
$TXT_to = $LANGPREFS{'TXT_to'};
$TXT_after_last_number = $LANGPREFS{'TXT_after_last_number'};
$TXT_after_last_number1 = $LANGPREFS{'TXT_after_last_number1'};
$TXT_you_can_search_this_guestbook_by = $LANGPREFS{'TXT_you_can_search_this_guestbook_by'};
$TXT_searchmessage = $LANGPREFS{'TXT_searchmessage'};
$TXT_searchname = $LANGPREFS{'TXT_searchname'};
$TXT_searchall = $LANGPREFS{'TXT_searchall'};
$TXT_searchsearch = $LANGPREFS{'TXT_searchsearch'};
$TXT_searchtext = $LANGPREFS{'TXT_searchtext'};
$TXT_back_to_guestbook = $LANGPREFS{'TXT_back_to_guestbook'};
$TXT_your_name = $LANGPREFS{'TXT_your_name'};
$TXT_your_message = $LANGPREFS{'TXT_your_message'};
$TXT_required = $LANGPREFS{'TXT_required'};
$TXT_where_in_the_world = $LANGPREFS{'TXT_where_in_the_world'};
$TXT_your_email_address = $LANGPREFS{'TXT_your_email_address'};
$TXT_your_web_page_address = $LANGPREFS{'TXT_your_web_page_address'};
$TXT_if_you_have_one = $LANGPREFS{'TXT_if_you_have_one'};
$TXT_private_message = $LANGPREFS{'TXT_private_message'};
$TXT_private_message2 = $LANGPREFS{'TXT_private_message2'};
$TXT_continue = $LANGPREFS{'TXT_continue'};
$TXT_these_are_the = $LANGPREFS{'TXT_these_are_the'};
$TXT_if_correct = $LANGPREFS{'TXT_if_correct'};
$TXT_if_not = $LANGPREFS{'TXT_if_not'};
$TXT_go_back = $LANGPREFS{'TXT_go_back'};
$TXT_and_edit = $LANGPREFS{'TXT_and_edit'};
$TXT_none_given = $LANGPREFS{'TXT_none_given'};
$TXT_has_been_added = $LANGPREFS{'TXT_has_been_added'};
$TXT_has_been_added_moderated = $LANGPREFS{'TXT_has_been_added_moderated'};
$TXT_has_been_added_private = $LANGPREFS{'TXT_has_been_added_private'};
$TXT_back_search_again = $LANGPREFS{'TXT_back_search_again'};
$TXT_one_match = $LANGPREFS{'TXT_one_match'};
$TXT_no_match = $LANGPREFS{'TXT_no_match'};
$TXT_more_matches_1 = $LANGPREFS{'TXT_more_matches_1'};
$TXT_more_matches_2 = $LANGPREFS{'TXT_more_matches_2'};
$TXT_please_fill_in = $LANGPREFS{'TXT_please_fill_in'};
$TXT_please_go_back_and_edit = $LANGPREFS{'TXT_please_go_back_and_edit'};
$TXT_search_results = $LANGPREFS{'TXT_search_results'};
$TXT_no_dot_at_start = $LANGPREFS{'TXT_no_dot_at_start'};
$TXT_no_www_at_start = $LANGPREFS{'TXT_no_www_at_start'};
$TXT_no_squiggles_in_domain = $LANGPREFS{'TXT_no_squiggles_in_domain'};
$TXT_only_one_at = $LANGPREFS{'TXT_only_one_at'};
$TXT_no_dots_next = $LANGPREFS{'TXT_no_dots_next'};
$TXT_wrong_end = $LANGPREFS{'TXT_wrong_end'};
$TXT_too_many_words = $LANGPREFS{'TXT_too_many_words'};
$TXT_disallowed_word = $LANGPREFS{'TXT_disallowed_word'};
$TXT_blocked_IP = $LANGPREFS{'TXT_blocked_IP'};
$web_comment = $LANGPREFS{'web_comment'};
$lang_months = $LANGPREFS{'lang_months'};
$lang_days = $LANGPREFS{'lang_days'};
$TXT_has_been_added_moderated = "Thanks. Your message has been sent to our webmaster and will be added shortly." if ($TXT_has_been_added_moderated
eq "");
$TXT_has_been_added_private = "Thanks. Your private message has been sent to our webmaster." if ($TXT_has_been_added_private
eq "");
######################
$textfontface = $PREFS{'textfontface'};
$textfontsize = $PREFS{'textfontsize'};
$marginwidth = $PREFS{'marginwidth'};
$marginheight = $PREFS{'marginheight'};
$page_after_write = $PREFS{'page_after_write'};
$limit_no_of_chars_in_line = $PREFS{'limit_no_of_chars_in_line'};
$max_chars_per_line = $PREFS{'max_chars_per_line'};
$show_guest_email = $PREFS{'show_guest_email'};
$show_guest_url = $PREFS{'show_guest_url'};
$email_link_type = $PREFS{'email_link_type'};
$web_link_type = $PREFS{'web_link_type'};
$url_image = $PREFS{'url_image'};
$email_image = $PREFS{'email_image'};
$url_text = $PREFS{'url_text'};
$email_txt = $PREFS{'email_txt'};
$use_preview = $PREFS{'use_preview'};
$title = $PREFS{'title'};
$max = $PREFS{'max'};
$border_size = $PREFS{'border_size'};
$alignment = $PREFS{'alignment'};
$allow_private_messages = $PREFS{'allow_private_messages'};
$home_page = $PREFS{'home_page'};
$home_page_title = $PREFS{'home_page_title'};
$show_home_page_link = $PREFS{'show_home_page_link'};
$home_page_target = $PREFS{'home_page_target'};
$order = $PREFS{'order'};
$show_line = $PREFS{'show_line'};
$mail_path = $PREFS{'mail_path'};
$admin_email = $PREFS{'admin_email'};
$send_email_to_admin = $PREFS{'send_email_to_admin'};
$send_email_to_guest = $PREFS{'send_email_to_guest'};
$bad_words = $PREFS{'bad_words'};
$moderated = $PREFS{'moderated'};
$field_length = $PREFS{'field_length'};
$no_displayed = $PREFS{'no_displayed'};
$max_length = $PREFS{'max_length'};
$max_length_chars = $PREFS{'max_length_chars'};
$anti_spam = $PREFS{'anti_spam'};
$anti_ips = $PREFS{'anti_ips'};
$days_to_delete = $PREFS{'days_to_delete'};
$days_to_trash = $PREFS{'days_to_trash'};
$days_to_delete_backup_files = $PREFS{'days_to_delete_backup_files'};
$mail_admin_backups_interval = $PREFS{'mail_admin_backups_interval'};
$mail_admin_backups_day = $PREFS{'mail_admin_backups_day'};
$mail_admin_backups_month = $PREFS{'mail_admin_backups_month'};
$allow_html = $PREFS{'allow_html'};
$active_header = $PREFS{'active_header'};
$use_title = $PREFS{'use_title'};
$show_no_of_messages = $PREFS{'show_no_of_messages'};
$mung = $PREFS{'mung'};
$use_mailto = $PREFS{'use_mailto'};
$web_enabled = $PREFS{'web_enabled'};
$user_image = $PREFS{'user_image'};
$user_image_url = $PREFS{'user_image_url'};
$use_hr_image = $PREFS{'use_hr_image'};
$hr_image = $PREFS{'hr_image'};
$use_user_html = $PREFS{'use_user_html'};
$use_user_html_footer = $PREFS{'use_user_html_footer'};
$table_width = $PREFS{'table_width'};
$usebackgroundimage = $PREFS{'usebackgroundimage'};
$backgroundimage = $PREFS{'backgroundimage'};
$mail_backup_to_admin = $PREFS{'mail_backup_to_admin'};
$thanks_title = $PREFS{'thanks_title'};
$thanks_include_message = $PREFS{'thanks_include_message'};
$web_comment = $PREFS{'web_comment'} if ($web_comment eq "");
$style = $PREFS{'style'};
$left_bracket = $PREFS{'left_bracket'};
$middle_bracket = $PREFS{'middle_bracket'};
$right_bracket = $PREFS{'right_bracket'};
$trans_search = $COLPREFS{'trans_search'};
$trans_message_header = $COLPREFS{'trans_message_header'};
$trans_message_body = $COLPREFS{'trans_message_body'};
$backcolor = $COLPREFS{'backcolor'};
$data_color1 = $COLPREFS{'data_color1'};
$data_color2 = $COLPREFS{'data_color2'};
$textdata_color1 = $COLPREFS{'textdata_color1'};
$textdata_color2 = $COLPREFS{'textdata_color2'};
$table_color1 = $COLPREFS{'table_color1'};
$table_color2 = $COLPREFS{'table_color2'};
$texttable_color1 = $COLPREFS{'texttable_color1'};
$texttable_color2 = $COLPREFS{'texttable_color2'};
#$back = $COLPREFS{'back'};
$link = $COLPREFS{'link'};
$vlink = $COLPREFS{'vlink'};
$alink = $COLPREFS{'alink'};
$text = $COLPREFS{'text'};
$searchcolor = $COLPREFS{'searchcolor'};
#$commentcolor = $COLPREFS{'commentcolor'};
$user_html = "";
$user_style = "";
$user_html_footer = "";
$thank_you = "";
open(FILE,"$user_html_name") || &oops("$user_html_name");
@user_html = ;
#foreach $row(@user_html)
#{
# $user_html = $user_html . $row;
# }
$user_html=join(" ",@user_html);
close(FILE);
open(FILE,"$user_style_name") || &oops('$user_style_name');
@user_style = ;
foreach $row(@user_style)
{
$user_style = $user_style . $row;
}
close(FILE);
open(FILE,"$user_html_footer_name") || &oops('$user_html_footer_name');
@user_html_footer = ;
# foreach $frow(@user_html_footer)
#{
# $user_html_footer = $user_html_footer . $frow;
#}
$user_html_footer=join(" ",@user_html_footer);
close(FILE);
open(FILE,"$thank_you_name") || &oops('$thank_you_name');
@thank_you = ;
foreach $row(@thank_you)
{
$thank_you = $thank_you . $row;
}
close(FILE);
open(NUMBER,"$active_name") || &oops('$active_name');
$active_string = ;
close(NUMBER);
#upgrade
($use_preview = "yes") if ($use_preview eq "");
($limit_no_of_chars_in_line = "no") if ($limit_no_of_chars_in_line eq "");
($max_chars_per_line = 50) if ($max_chars_per_line eq "");
($TXT_private_message = "Private message") if ($TXT_private_message eq "");
($TXT_private_message2 = "(when checked, message will not appear in guestbook)") if ($TXT_private_message2 eq "");
($home_page_target = "_top") if ($home_page_target eq "");
($border_size = "0") if ($border_size eq "");
($field_length = 40) if ($field_length eq "");
($max_length_chars = 4000) if ($max_length_chars eq "");
($marginwidth = 0) if ($marginwidth eq "");
($marginheight = 0) if ($marginheight eq "");
if ($brackets_exist eq "no")
{
$left_bracket = "[";
$right_bracket = "]";
$middle_bracket = "|";
}
if (!$show_guest_email)
{
$show_guest_email = "yes";
$show_guest_url = "yes";
$url_image = "http://www.active-scripts.net/url.gif";
$email_image = "http://www.active-scripts.net/mail.gif";
$url_text = "url";
$email_txt = "@";
$email_link_type = "text";
$web_link_type = "text";
}
# end upgrade
}
### View Standard Preferences
sub view_prefs
{
&seek_cook;
&content;
#upgrade
($use_preview = "yes") if ($use_preview eq "");
($limit_no_of_chars_in_line = "no") if ($limit_no_of_chars_in_line eq "");
($max_chars_per_line = 50) if ($max_chars_per_line eq "");
if (!$show_guest_email)
{
$show_guest_email = "yes";
$show_guest_url = "yes";
$url_image = "http://www.active-scripts.net/url.gif";
$email_image = "http://www.active-scripts.net/mail.gif";
$url_text = "url";
$email_txt = "@";
$email_link_type = "text";
$web_link_type = "text";
}
($marginwidth = 0) if ($marginwidth eq "");
($marginheight = 0) if ($marginheight eq "");
($TXT_private_message = "Private message - do not include in main guestbook.") if ($TXT_private_message eq "");
($TXT_private_message2 = "(when checked, message will not appear in guestbook)") if ($TXT_private_message2 eq "");
($home_page_target = "_top") if ($home_page_target eq "");
($border_size = "0") if ($border_size eq "");
($field_length = 40) if ($field_length eq "");
($max_length_chars = 4000) if ($max_length_chars eq "");
# end upgrade
print qq~
Active Guestbook - Standard Preferences Manager
Active Guestbook - Standard Preferences Manager
Return to Guestbook | Return to Control Panel
Restore FACTORY defaults | Restore
USER defaults
Save these settings as USER defaults (If
you have made any changes, you first need to UPDATE using the button at the bottom.)
~;
if ($active_header eq "on")
{
print qq~ To remove the Active Scripts image from the top of your guestbook, move down to the
Images/titles section below and select No for "Show Active-Scripts header".
~;
}
print qq~
~;
print qq~
~;
} # end view_prefs
###############
sub view_to_edit
{
&seek_cook;
open(USER_FILE,"$guestbook_data_name") || &oops('$guestbook_data_name');
@data = ;
close(USER_FILE);
@data_ordered = reverse(@data);
&basic_header;
print qq~
Active Guestbook Message Manager
Control Panel
~;
@datalist = ();
$count = 1;
foreach $row (@data_ordered)
{
@fields = split (/\|/, $row);
unless ($fields[10] eq "del")
{
push (@datalist, $row);
}
}
#################### ###################### ################### ###################
print " ";
$count = 1;
$grouped = 0;
#$no_displayed = 5;
$start_number = $FORM{'start_number'};
$new_start_number = ($start_number + $no_displayed);
$old_start_number = ($start_number - $no_displayed);
$startplus = $start_number +1;
$number_of_messages = @datalist;
unless ($old_start_number < 0)
{
print qq~ [Previous ]
~;
}
&show_edit_number_menu unless ($number_of_messages <($no_displayed+1));
#################### show number menu
unless ($new_start_number > ($number_of_messages -1 ))
{
print qq~ [Next ]
~;
}
if (($new_start_number > ($number_of_messages -1 )) && ($number_of_messages >($no_displayed)))
{
print qq~ ~;
}
print qq~ ~;
if ($new_start_number < $number_of_messages)
{
print qq~ Messages $startplus to $new_start_number ~;
}
else
{
if ($startplus == $number_of_messages)
{
print qq~ Message $startplus ~;
}
else
{
print qq~ Messages $startplus to $number_of_messages
~;
}
}
foreach $row (@datalist)
{
@fields = split (/\|/, $row);
$grouped++;
if (($grouped > ($start_number)) && ($grouped < ($start_number + $no_displayed + 1)))
{
if ($fields[16] eq "yes")
{
print qq~
THIS IS A PRIVATE MESSAGE
~;
}
elsif ($fields[15] eq "waiting")
{
print qq~
THIS MESSAGE IS WAITING FOR
APPROVAL
~;
}
else
{
if ($count ==1)
{
print qq~
~;
}
else
{
print qq~
~;
}
} # end else
if ($fields[4])
{
print qq~
$TXT_your_name: $fields[1]
~;
}
else
{
print qq~
$TXT_your_name: $fields[1]
~;
}
if ($fields[11])
{
print qq~
$TXT_your_web_page_address: $fields[11]
~;
}
&date_mod;
print qq~
$TXT_your_message: $fields[2]
Date: $condate
~;
if ($fields[5])
{
print qq~
$TXT_where_in_the_world: $fields[5]
~;
}
if ($fields[6])
{
print qq~
$web_comment: $fields[6]
~;
}
if ($fields[7])
{
print qq~
IP: $fields[7]
~;
}
print qq~
[ Delete
this message ]
~;
unless (($fields[6]) || ($fields[16] eq "yes"))
{
print qq~
[ Add a comment ]
~;
}
if (($fields[15] eq "waiting") && ($fields[16] ne "yes"))
{
print qq~
[ APPROVE THIS MESSAGE ]
~;
}
if ($fields[16] ne "yes")
{
print qq~
[ Edit this message ] ~;
}
print qq~
~;
$count++;
if ($count >2)
{
$count = 1;
}
}
}
} # end sub
sub delete_item
{
&seek_cook;
&get_file_lock("$location_of_lock_file");
$ref = $FORM{'ref'};
open(USER_FILE,"$guestbook_data_name") || &oops('$guestbook_data_name');
@data = ;
close(USER_FILE);
open(USER_FILE,">$guestbook_data_name");
foreach $row (@data)
{
@fields = split (/\|/, $row);
if ($ref ne $fields[0])
{
print USER_FILE "$row";
}
else
{
print USER_FILE "$fields[0]|$fields[1]|$fields[2]|$fields[3]|$fields[4]|$fields[5]|$fields[6]|$fields[7]|$fields[8]|$fields[9]|del|$fields[11]|$now|$fields[13]|$fields[14]|$fields[15]|$fields[16]|$fields[17]|$fields[18]|$fields[19]|$fields[20]|$fields[21]|$fields[22]|$fields[23]|$fields[24]|$fields[25]|$fields[26]|$fields[27]|$fields[28]|$fields[29]|$fields[30]|\n";
}
### This adds "del" to field 9 and the date it is deleted to field 12.
}
close(USER_FILE);
&release_file_lock("$location_of_lock_file");
&content;
&main_headera;
print qq~ ~;
&main_headerb;
print qq~
Active Guestbook Message Manager
Message deleted
~;
} # end delete_item
############## add response
sub add_response1
{
&seek_cook;
$ref = $FORM{'ref'};
$start_number = $FORM{'start_number'};
open(USER_FILE,"$guestbook_data_name") || &oops('$guestbook_data_name');
@data = ;
close(USER_FILE);
foreach $row (@data)
{
@fields = split (/\|/, $row);
if ($ref eq $fields[0])
{
&date_mod;
&content;
&plain_header;
print qq~
Active Guestbook Message Editor
Message Editor | Control Panel
~;
print qq~
~;
}
}
} # end add response1
sub add_response2
{
&seek_cook;
$ref = $FORM{'ref'};
$start_number = $FORM{'start_number'};
$comment= $FORM{'comment'};
$comment =~ s/\r//g;
$comment =~ s/\n/ /g;
open(USER_FILE,"$guestbook_data_name") || &oops('$guestbook_data_name');
@data = ;
close(USER_FILE);
&get_file_lock("$location_of_lock_file");
open(USER_FILE,">$guestbook_data_name");
foreach $row (@data)
{
chop($row);
@fields = split (/\|/, $row);
if ($ref ne $fields[0])
{
print USER_FILE "$row\n";
}
else
{
print USER_FILE "$fields[0]|$fields[1]|$fields[2]|$fields[3]|$fields[4]|$fields[5]|$comment|$fields[7]|$fields[8]|$fields[9]|$fields[10]|$fields[11]|$fields[12]|$fields[13]|$fields[14]|$fields[15]|$fields[16]|$fields[17]|$fields[18]|$fields[19]|$fields[20]|$fields[21]|$fields[22]|$fields[23]|$fields[24]|$fields[25]|$fields[26]|$fields[27]|$fields[28]|$fields[29]|$fields[30]|\n";
}
}
close(USER_FILE);
&release_file_lock("$location_of_lock_file");
&content;
&main_headera;
print qq~ ~;
&main_headerb;
print qq~
Active Guestbook Message Editor
Comment successfully
added.
~;
&inter_footer;
} # end add response2
sub change1
{
&seek_cook;
$start_number = $FORM{'start_number'};
$ref = $FORM{'ref'};
open(USER_FILE,"$guestbook_data_name") || &oops('$guestbook_data_name');
@data = ;
close(USER_FILE);
foreach $row (@data)
{
@fields = split (/\|/, $row);
if ($ref eq $fields[0])
{
$fields[2] =~ s/\ /\n/g;
&content;
&plain_header;
&date_mod;
print qq~
Active Guestbook Message Editor
Message Editor | Control Panel
~;
print "\n\n";
}
} # end if right one
} # end sub change1
sub change2
{
&seek_cook;
$ref = $FORM{'ref'};
$start_number = $FORM{'start_number'};
$original_date = $FORM{'original_date'};
$edited_date = $FORM{'edited_date'};
$comment= $FORM{'comment'};
$full_name = $FORM{'requiredfull_name'};
$message = $FORM{'requiredmessage'};
$guest_email = $FORM{'guest_email'};
$location = $FORM{'location'};
$url = $FORM{'url'};
$url =~ s/http\:\/\///i;
$message =~ s/\r\n/ /g;
$message =~ s/\r/ /g;
$message =~ s/\n/ /g;
#$message =~ s/\ \ / /g;
$message =~ s/\s\s/ /g;
$comment =~ s/\r//g;
$comment =~ s/\n/ /g;
open(USER_FILE,"$guestbook_data_name") || &oops('$guestbook_data_name');
@data = ;
close(USER_FILE);
&get_file_lock("$location_of_lock_file");
open(USER_FILE,">$guestbook_data_name");
foreach $row (@data)
{
chop($row);
@fields = split (/\|/, $row);
if ($ref ne $fields[0])
{
print USER_FILE "$row\n";
}
else
{
if ($original_date eq $edited_date)
{
$edited_date = $fields[3];
}
print USER_FILE "$fields[0]|$full_name|$message|$edited_date|$guest_email|$location|$comment|$fields[7]|$fields[8]|$fields[9]|$fields[10]|$url|$fields[12]|$fields[13]|$fields[14]|$fields[15]|$fields[16]|$fields[17]|$fields[18]|$fields[19]|$fields[20]|$fields[21]|$fields[22]|$fields[23]|$fields[24]|$fields[25]|$fields[26]|$fields[27]|$fields[28]|$fields[29]|$fields[30]|\n";
}
}
close(USER_FILE);
&release_file_lock("$location_of_lock_file");
&content;
&main_headera;
print qq~ ~;
&main_headerb;
print qq~
Active Guestbook Message Editor
Message successfully
edited.
~;
&inter_footer;
} # end change2
###############
sub view_to_undo
{
&seek_cook;
@datalist = ();
open(USER_FILE,"$guestbook_data_name") || &oops('$guestbook_data_name');
@data = ;
close(USER_FILE);
foreach $row (@data)
{
@fields = split (/\|/, $row);
if ($fields[10] eq "del")
{
push (@datalist, $row);
}
}
#############
if (@datalist <1)
{
&content;
&plain_header;
print qq~
Active Guestbook Trash Manager
No deleted messages found.
Control Panel
~;
exit;
}
else
{
@sorteddata = sort(@datalist);
@reversesorteddata = reverse(@sorteddata);
&basic_header;
print qq~
Active Guestbook Trash Manager
Control Panel
~;
$count = 1;
foreach $row (@reversesorteddata)
{
@fields = split (/\|/, $row);
##############
if ($count ==1)
{
print qq~
~;
}
else
{
print qq~
~;
}
if ($fields[4])
{
print qq~
$TXT_your_name: $fields[1]
~;
}
else
{
print qq~
$TXT_your_name: $fields[1]
~;
}
&date_mod;
print qq~
$TXT_your_message: $fields[2]
Date: $condate
~;
if ($fields[5])
{
print qq~
$TXT_where_in_the_world: $fields[5]
~;
}
if ($fields[6])
{
print qq~
$web_comment: $fields[6]
~;
}
if ($fields[7])
{
print qq~
IP address: $fields[7]
~;
}
print qq~
[ Undelete
this message ] [ Permanently wipe this message ]
~;
print qq~
~;
print qq~
~;
$count++;
if ($count >2)
{
$count = 1;
}
}
} # end foreach undo
} # end sub
sub undelete_item
{
&seek_cook;
$ref = $FORM{'ref'};
open(USER_FILE,"$guestbook_data_name") || &oops('$guestbook_data_name');
@data = ;
close(USER_FILE);
&get_file_lock("$location_of_lock_file");
open(USER_FILE,">$guestbook_data_name");
foreach $row (@data)
{
@fields = split (/\|/, $row);
if ($ref ne $fields[0])
{
print USER_FILE "$row";
}
else
{
print USER_FILE "$fields[0]|$fields[1]|$fields[2]|$fields[3]|$fields[4]|$fields[5]|$fields[6]|$fields[7]|$now|$fields[9]||$fields[11]||$fields[13]|$fields[14]|$fields[15]|$fields[16]|$fields[17]|$fields[18]|$fields[19]|$fields[20]|$fields[21]|$fields[22]|$fields[23]|$fields[24]|$fields[25]|$fields[26]|$fields[27]|$fields[28]|$fields[29]|$fields[30]|\n";
}
}
close(USER_FILE);
&release_file_lock("$location_of_lock_file");
&content;
&main_headera;
print qq~ ~;
&main_headerb;
print qq~
Active Guestbook Trash Manager
Message successfully undeleted.
~;
&inter_footer;
exit;
}
sub trash_item
{
&seek_cook;
$ref = $FORM{'ref'};
open(USER_FILE,"$guestbook_data_name") || &oops('$guestbook_data_name');
@data = ;
close(USER_FILE);
&get_file_lock("$location_of_lock_file");
open(USER_FILE,">$guestbook_data_name");
foreach $row (@data)
{
@fields = split (/\|/, $row);
if ($ref ne $fields[0])
{
print USER_FILE "$row";
}
}
close(USER_FILE);
&release_file_lock("$location_of_lock_file");
&content;
&main_headera;
print qq~ ~;
&main_headerb;
print qq~
Active Guestbook Trash Manager
Message permanently wiped.
~;
&inter_footer;
exit;
} # end trash_item
sub amqdate
{
$amqdate = $_[0];
@bits = split (/\//, $amqdate);
$amqyear = $bits[2];
if ($amqyear > 1999)
{
$amqyear = ($amqyear - 2000);
}
if ($amqyear == 4 || $amqyear == 8 || $amqyear == 12 || $amqyear == 16 || $amqyear == 0 || $amqyear == 20 || $amqyear ==
24)
{$leap = "yes";}
else
{$leap = "no";}
if ($amqyear == 1 || $amqyear == 5 || $amqyear == 9 || $amqyear == 13 || $amqyear == 17 || $amqyear == 21 || $amqyear ==
25)
{
$extradays = ((($amqyear - 1)/4)+1);
}
$amqyeardays = (($amqyear * 365)+$extradays);
$amqday = $bits[0];
if ($bits[1] == 1)
{$monthdays = 0;}
if ($bits[1] == 2)
{$monthdays = 31;}
if ($bits[1] == 3)
{$monthdays = 59;}
if ($bits[1] == 4)
{$monthdays = 90;}
if ($bits[1] == 5)
{$monthdays = 120;}
if ($bits[1] == 6)
{$monthdays = 151;}
if ($bits[1] == 7)
{$monthdays = 181;}
if ($bits[1] == 8)
{$monthdays = 212;}
if ($bits[1] == 9)
{$monthdays = 243;}
if ($bits[1] == 10)
{$monthdays = 273;}
if ($bits[1] == 11)
{$monthdays = 304;}
if ($bits[1] == 12)
{$monthdays = 334;}
if ($leap eq "yes" && $bits[1] >2)
{
$monthdays = ($monthdays+1);
}
$amqtotal = ($amqday + $amqyeardays + $monthdays);
return($amqtotal);
}
sub check_update
{
unless (-e "$update_name")
{
umask 000;
}
open(NUMBER,"$update_name") || &oops('$update_name');
$num = ;
close(NUMBER);
if ($num < $revdate) {
&get_file_lock("$location_of_lock_file");
open(NUMBER,">$update_name");
print NUMBER "$revdate";
close(NUMBER);
$check_digits = 0;
@digits = split (//, $days_to_delete);
foreach $w (@digits)
{
unless ($w =~ /[0-9]/)
{
$check_digits = 1;
}
}
if (($check_digits == 1) || ($days_to_delete == 0))
{
$days_to_delete = 99999999999999999999999999999999999;
}
#if ($days_to_delete > 0)
#{
&update_database;
# }
&release_file_lock("$location_of_lock_file");
}
}
sub update_database
{
############# run automatic delete or trash
open(USER_FILE,"$guestbook_data_name");
@data = ;
close(USER_FILE);
open(USER_FILE,">$guestbook_data_name");
foreach $row (@data)
{
@fields = split (/\|/, $row);
if (($fields[10] eq "del") && ($fields[12]) && ($fields[12] < $now - $days_to_trash))
{
}
elsif ((!$fields[12]) && ($fields[8] < ($now - $days_to_delete)))
{
print USER_FILE "$fields[0]|$fields[1]|$fields[2]|$fields[3]|$fields[4]|$fields[5]|$fields[6]|$fields[7]|$fields[8]|$fields[9]|del|$fields[11]|$now|$fields[13]|$fields[14]|$fields[15]|$fields[16]|$fields[17]|$fields[18]|$fields[19]|$fields[20]|$fields[21]|$fields[22]|$fields[23]|$fields[24]|$fields[25]|$fields[26]|$fields[27]|$fields[28]|$fields[29]|$fields[30]|\n";
}
else
{
print USER_FILE "$row";
}
} # end for each
close(USER_FILE);
########### automatic prune if non-deleted messages greater than max
open(USER_FILE,"$guestbook_data_name") || &oops('$guestbook_data_name');
@data = ;
close(USER_FILE);
@revdata = reverse(@data);
@nondeldata = ();
@deldata = ();
@arraytodisplay = ();
foreach $row (@revdata)
{
@fields = split (/\|/, $row);
push (@nondeldata, $row) if $fields[10] ne "del"; # add non-deleted messages to new array #
push (@deldata, $row) if $fields[10] eq "del"; # add deleted messages to new array #
}
if (@nondeldata >$max)
{
$counter = 0;
foreach $row (@nondeldata)
{
@fields = split (/\|/, $row);
if ($counter < $max)
{
push (@arraytodisplay, $row);
}
else
{
$delrow = "$fields[0]|$fields[1]|$fields[2]|$fields[3]|$fields[4]|$fields[5]|$fields[6]|$fields[7]|$fields[8]|$fields[9]|del|$fields[11]|$now|$fields[13]|$fields[14]|$fields[15]|$fields[16]|$fields[17]|$fields[18]|$fields[19]|$fields[20]|$fields[21]|$fields[22]|$fields[23]|$fields[24]|$fields[25]|$fields[26]|$fields[27]|$fields[28]|$fields[29]|$fields[30]|\n";
push (@arraytodisplay, $delrow);
}
$counter++;
}
@alldata = (@arraytodisplay, @deldata);
@sortedalldata = sort(@alldata);
open(USER_FILE,">$guestbook_data_name") || &oops('$guestbook_data_name');
foreach $row (@sortedalldata)
{
print USER_FILE "$row";
}
close(USER_FILE);
}
#########
&delete_old_backups;
&mail_backup if $mail_backup_to_admin eq "yes";
}
sub backup_to_dir
{
open(USER_FILE,"$guestbook_data_name") || &oops('$guestbook_data_name');
@user_data = ;
close(USER_FILE);
$location1 = "./$guestbook_backups_directory/guestbook_backup.$revdate";
umask 000;
open(BAK,">$location1");
foreach $row (@user_data)
{
print BAK "$row";
}
close(BAK);
} # end backup to dir
######################
sub mail_backup
{
open(NUMBER2,"$senddate_name") || &oops('$senddate_name');
$senddate = ;
close(NUMBER2);
if ((($mail_admin_backups_interval eq "monthly") && (($mail_admin_backups_month == $bakday) || (($now -$senddate) >27 ) ))
|| (($mail_admin_backups_interval eq "weekly") && (($mail_admin_backups_day == $wday) || (($now -$senddate) >6 ) ) )
|| ($mail_admin_backups_interval eq "daily"))
{
open (MAIL, "|$mail_path $admin_email") || &oops('the mail program. Please check the mail path in the Control Panel.');
print MAIL "To: $admin_email\n";
print MAIL "From: $admin_email\n";
print MAIL "Subject: Database backup\n\n";
print MAIL "Below is a backup data file from your Active Guestbook. For details of how to restore your data from this file,
please visit www.active-scripts.net.\n\n";
open(USER_FILE,"$guestbook_data_name") || &oops('$guestbook_data_name');
@user_data = ;
close(USER_FILE);
foreach $row (@user_data)
{
print MAIL "$row\n";
}
close (MAIL);
open(NUMBER1,"$senddate_name") || &oops('$senddate_name');
open (NUMBER1,">$senddate_name");
print NUMBER1 "$now";
close(NUMBER1);
}
}
#####################
sub delete_old_backups
{
opendir (USERS, "./$guestbook_backups_directory") || &oops('the $guestbook_backups_directory directory');
@files = grep(/^g/,readdir(USERS));
closedir (USERS);
foreach $file (@files)
{
if (-M "./$guestbook_backups_directory/$file" > $days_to_delete_backup_files)
{
unlink("./$guestbook_backups_directory/$file");
}
}
} # End of sub delete_old_bak
sub search
{
&content;
@hits = ();
&main_header;
&active_header if $active_header eq "on";
print qq~ ~;
&user_image if $user_image eq "yes";
&title if $use_title eq "on";
&user_html if $use_user_html eq "yes";
print qq~ $TXT_search_results ~;
&menu;
open(USER_FILE,"$guestbook_data_name") || &oops('$guestbook_data_name');
@data = ;
foreach $row (@data)
{
@fields = split (/\|/, $row);
if (($fields[10] ne "del") && ($fields[15] ne "waiting") && ($fields[16] ne "yes"))
{
if (($search_fields eq "1" ) || ($search_fields eq "2" ))
{
$searchby = (" " . $fields[$search_fields] . " ");
}
else
{
$searchby = (" " . $fields[1] . " " . $fields[2] . " " . $fields[5] . " " . $fields[6] . " ");
}
@word_list = split(/\s+/,$search_words);
$no_of_words_in_search = @word_list;
for ($x = @word_list; $x > 0; $x--)
{
$match_word = $word_list[$x - 1];
if ($searchby =~ /$match_word/i)
{
splice(@word_list,$x - 1, 1);
} # End of If
} # End of For Loop
if (@word_list < 1)
{
push (@hits, $row);
}
}
} # end foreach $row (@data)
close(USER_FILE);
if (@hits <1)
{
print "$TXT_no_match ";
}
else
{
&html_search_results;
}
if (($use_user_html_footer eq "yes") && ($use_hr_image eq "yes"))
{
print " ";
&user_html_footer ;
}
if (($use_user_html_footer eq "yes") && ($use_hr_image ne "yes"))
{
&user_html_footer ;
}
print qq~
~;
}
#########
sub html_search_results
{
$count = 1;
$number_of_messages = @hits;
@hits = reverse(@hits);
if ($search_flag ne "no")
{
if ($number_of_messages == 1)
{
print qq~ $TXT_one_match ~;
}
else
{
print qq~ $TXT_more_matches_1 $number_of_messages $TXT_more_matches_2 ~;
}
}
foreach $row (@hits)
{
#########
@fields = split (/\|/, $row);
# $grouped++;
# if (($grouped > ($start_number)) && ($grouped < ($start_number + $no_displayed + 1)))
# {
&main_table_results;
# } # end if number is right
} # end for each row
#########
}
##############
sub preview
{
&content;
&main_header;
&active_header if $active_header eq "on";
print qq~ ~;
&user_image if $user_image eq "yes";
&title if $use_title eq "on";
&user_html if $use_user_html eq "yes";
&menu;
$messagequot = $message;
$locationquot = $location;
$urlquot = $url;
$full_namequot = $full_name;
$messagequot =~ s/\"/QUOTQUOT/g;
$locationquot =~ s/\"/QUOTQUOT/g;
$urlquot =~ s/\"/QUOTQUOT/g;
$full_namequot =~ s/\"/QUOTQUOT/g;
print qq~
~;
$url = "$TXT_none_given" if !$url;
$location = "$TXT_none_given" if !$location;
$guest_email = "$TXT_none_given" if !$guest_email;
print qq~
$TXT_these_are_the $TXT_if_correct $TXT_if_not$TXT_go_back $TXT_and_edit
~;
&user_html_footer if $use_user_html_footer eq "yes";
print qq~
~;
exit;
}
sub view_backups
{
&seek_cook;
open(RESTORE_BACKUP,"./$guestbook_backups_directory/undo_restore.bak");
@restore_backup_data = ;
close(RESTORE_BACKUP);
opendir (USERS, "./$guestbook_backups_directory") || &oops('the backups directory');
@files = grep(/^guest/,readdir(USERS));
closedir (USERS);
if (@files<1)
{
&content;
print qq~
$title
Active Guestbook Backup Manager
There are currently no backups to restore.
~;
}
else
{
&content;
print qq~
$title
Active Guestbook Backup Manager
Control Panel
~;
if (@restore_backup_data >2)
{
print qq~
| Undo last restore
~;
}
print qq~
~;
}
&inter_footer;
}
sub undo_last_restore
{
&seek_cook;
open(RESTORE_BACKUP,"./$guestbook_backups_directory/undo_restore.bak");
@restore_backup_data = ;
close(RESTORE_BACKUP);
if (@restore_backup_data <2)
{
&content;
print qq~
$title
Active Guestbook Backup Manager
No undo available at the moment.
~;
}
open(MAIN_GUESTBOOK,">$guestbook_data_name") || &oops('$guestbook_data_name');
foreach $row (@restore_backup_data)
{
print MAIN_GUESTBOOK "$row";
}
close(MAIN_GUESTBOOK);
open(RESTORE_BACKUP,">./$guestbook_backups_directory/undo_restore.bak"); # wipe undo restore file
close(RESTORE_BACKUP);
&set_counter;
&content;
print qq~
$title
Active Guestbook Backup Manager
Last restore undone.
~;
exit;
}
sub restore_backups
{
&seek_cook;
$file_to_restore = $FORM{'file_to_restore'};
if ($file_to_restore eq "")
{
{
&basic_header;
print qq~
$title
You didn't select a backup to restore. Please go back and select .
~;
exit;
}
}
open(MAIN_GUESTBOOK,"$guestbook_data_name") || &oops('$guestbook_data_name');
@main_data = ;
close(MAIN_GUESTBOOK);
open(RESTORE_BACKUP,">./$guestbook_backups_directory/undo_restore.bak");
foreach $row (@main_data)
{
print RESTORE_BACKUP "$row";
}
close(RESTORE_BACKUP);
&get_file_lock("$location_of_lock_file");
open(MAIN_GUESTBOOK,">$guestbook_data_name");
open(RESTORE,"./$guestbook_backups_directory/$file_to_restore") || &oops('/$guestbook_backups_directory/$file_to_restore');
@restore_data = ;
foreach $line (@restore_data)
{
print MAIN_GUESTBOOK "$line";
}
close(RESTORE);
close(MAIN_GUESTBOOK);
&release_file_lock("$location_of_lock_file");
&set_counter;
&content;
print qq~
$title
Active Guestbook Backup Manager Backup
has been restored. (You can undo this from the main Backup Manager page.)
~;
exit;
}
sub view_single_backup
{
&seek_cook;
&basic_header;
$file_to_restore = $FORM{'file_to_restore'};
$year = substr($file_to_restore, -8,4);
$month = substr($file_to_restore, -4,2);
$month = $month-1;
$mon = $months[$month];
$day = substr($file_to_restore, -2,2);
$datestamp = "$day"."-"."$mon"."-"."$year";
print qq~
Backup date: $datestamp
Restore this guestbook | Return
to Backup Manager
~;
open(RESTORE,"./$guestbook_backups_directory/$file_to_restore");
@hits = ;
close(RESTORE);
$search_flag = "no";
&html_search_results_plain;
}
sub active_header
{
if ($demo eq "off")
{
print qq~
~;
}
else
{
print qq~
~;
}
}
sub title
{
print qq~
$title
~;
}
sub menu
{
print qq~
$left_bracket
~;
if ($ipoops ne "yes")
{
if ($action ne "add")
{
print qq~
$TXT_add_a_message $middle_bracket
~;
}
}
unless ($show_home_page_link eq "no")
{
print qq~
$home_page_title $middle_bracket
~;
}
if ($action eq "add")
{
print qq~
$TXT_back_to_guestbook $middle_bracket
~;
}
if ($action eq "search")
{
print qq~
$TXT_back_search_again $right_bracket
~;
}
elsif (($action eq "add") || ($action eq "preview") || ($action eq "post_preview"))
{
print qq~
$TXT_search $right_bracket
~;
}
else
{
print qq~
$TXT_search $right_bracket
~;
}
print qq~
~;
}
sub no_of_messages_display
{
print qq~
~;
if ($number_of_messages == 1)
{
print qq~
$TXT_there_is_now$number_of_messages$TXT_message_in_our_guestbook
~;
}
else
{
print qq~
$TXT_there_are_now$number_of_messages$TXT_messages_in_our_guestbook
~;
}
print qq~
~;
}
sub main_header
{
print qq~
$title ~;
&required_script if $action eq "add";
if ($style ne "off")
{
print qq~ $user_style ~;
}
print qq~
~;
}
########################
sub main_headera
{
print qq~
$title ~;
&required_script if $action eq "add";
}
sub main_headerc
{
if ($style ne "off")
{
print qq~ $user_style ~;
}
print qq~
~;
}
sub main_headerb
{
if ($style ne "off")
{
print qq~ $user_style ~;
}
print qq~
~;
}
else
{
print qq~
TEXT="#000000" LINK="#000000" VLINK="#000000" ALINK="#000000" marginwidth="$marginwidth" marginheight="$marginheight" LEFTMARGIN="$marginwidth"
TOPMARGIN="$marginheight" >
~;
}
}
#############
sub content
{
print "Content-type: text/html\n\n";
}
sub search_form
{
print qq~
~;
}
sub show_number_menu
{
print qq~
$left_bracket
~;
$number_of_messages = int($number_of_messages); # int here sorts out any funny decimals entered in the control panel
$number_of_pages = ($number_of_messages / $no_displayed) ;
$number_of_pages = int($number_of_pages); # no of full pages
if ($number_of_messages > ($number_of_pages * $no_displayed))
{
$extra = "yes";
}
if ($extra eq "yes")
{
$number_of_pages = $number_of_pages +1;
}
($start_number = 0) if (!$start_number);
for ($x = 1; $x < $number_of_pages+1 ; $x++ )
{
$sn = (($x*$no_displayed)- $no_displayed);
$bottom = ($start_number - (11 * $no_displayed));
$top = ($start_number + (11 * $no_displayed));
if ((($sn > $bottom) && ($sn < $top)) || ($x == "1") || ($x == $number_of_pages))
{
if ($sn ne $start_number)
{
print qq~
$x
~;
}
else
{
print qq~
$x
~;
} # end else
}
} # end for
print qq~
$right_bracket
~;
}
sub user_image
{
if ($user_image_url)
{
print qq~
~;
}
else
{
print qq~
You have not given an image file address in the Standard Preferences Manager.
Either select NO for 'Use your own image at top of guestbook' in the Standard
Preferences Manager, or fill in the address of your image in the 'Address of your
image' field in the Standard Preferences Manager.
~;
}
}
sub user_html
{
print qq~ $user_html ~;
}
sub user_html_footer
{
print qq~ $user_html_footer~;
}
sub view_change_password
{
&seek_cook;
&content;
print qq~
$title
~;
&required_script;
print qq~
~;
print qq~
Password Manager
Control Panel
Please enter your new password twice. (please note that passwords are case-sensitive )
~;
&inter_footer;
}
sub change_password
{
&seek_cook;
$pass1 = $FORM{'requiredpass1'};
$passcheck = $FORM{'requiredpasscheck'};
if ($pass1 eq $passcheck)
{
open(ACTIVE,">$active_name");
$newpass = crypt($pass1, $salt);
print ACTIVE "$newpass";
close(ACTIVE);
&SetCookies('activea',$newpass);
&content;
&main_headera;
print qq~ ~;
&main_headerb;
print qq~
Change Active Guestbook Control Panel Password
Password has been changed.
~;
}
else
{
&content;
&plain_header_stop;
print qq~
Change Active Guestbook Control Panel Password
The password has NOT been changed. The two passwords you typed were not the same.
Control Panel | Try again
~;
}
}
sub enter_password
{
&content;
print qq~
$title
~;
print qq~
Active Guestbook Control Panel Please enter password.You will need to
have Cookies enabled for easy navigation through the Control Panel features.
Password
~;
&inter_footer;
}
sub cookie_vars
{
$Cookie_Exp_Date = '';
$Cookie_Path = '';
$Cookie_Domain = '';
$Secure_Cookie = '0';
@Cookie_Encode_Chars = ('\%', '\+', '\;', '\,', '\=', '\&', '\:\:', '\s');
%Cookie_Encode_Chars = ('\%', '%25',
'\+', '%2B',
'\;', '%3B',
'\,', '%2C',
'\=', '%3D',
'\&', '%26',
'\:\:', '%3A%3A',
'\s', '+');
@Cookie_Decode_Chars = ('\+', '\%3A\%3A', '\%26', '\%3D', '\%2C', '\%3B', '\%2B', '\%25');
%Cookie_Decode_Chars = ('\+', ' ',
'\%3A\%3A', '::',
'\%26', '&',
'\%3D', '=',
'\%2C', ',',
'\%3B', ';',
'\%2B', '+',
'\%25', '%');
}
sub GetCookies {
local(@ReturnCookies) = @_;
local($cookie_flag) = 0;
local($cookie,$value);
if ($ENV{'HTTP_COOKIE'}) {
if ($ReturnCookies[0] ne '') {
foreach (split(/; /,$ENV{'HTTP_COOKIE'})) {
($cookie,$value) = split(/=/);
foreach $char (@Cookie_Decode_Chars) {
$cookie =~ s/$char/$Cookie_Decode_Chars{$char}/g;
$value =~ s/$char/$Cookie_Decode_Chars{$char}/g;
}
foreach $ReturnCookie (@ReturnCookies) {
if ($ReturnCookie eq $cookie) {
$Cookies{$cookie} = $value;
$cookie_flag = "1";
}
}
}
}
else {
foreach (split(/; /,$ENV{'HTTP_COOKIE'})) {
($cookie,$value) = split(/=/);
#
foreach $char (@Cookie_Decode_Chars) {
$cookie =~ s/$char/$Cookie_Decode_Chars{$char}/g;
$value =~ s/$char/$Cookie_Decode_Chars{$char}/g;
}
$Cookies{$cookie} = $value;
}
$cookie_flag = 1;
}
}
return $cookie_flag;
}
sub SetCookies {
local(@cookies) = @_;
local($cookie,$value,$char);
while( ($cookie,$value) = @cookies ) {
foreach $char (@Cookie_Encode_Chars) {
$cookie =~ s/$char/$Cookie_Encode_Chars{$char}/g;
$value =~ s/$char/$Cookie_Encode_Chars{$char}/g;
}
print 'Set-Cookie: ' . $cookie . '=' . $value . ';';
if ($Cookie_Exp_Date) {
print ' expires=' . $Cookie_Exp_Date . ';';
}
if ($Cookie_Path) {
print ' path=' . $Cookie_Path . ';';
}
if ($Cookie_Domain) {
print ' domain=' . $Cookie_Domain . ';';
}
if ($Secure_Cookie) {
print ' secure';
}
if ($cookie_control eq "off")
{
print "\n";
}
shift(@cookies); shift(@cookies);
}
}
sub seek_cook
{
if (($cookie_default eq "") || (!$cookie_default) )
{
&content;
print "$valid_ip";
exit;
}
#############
$xyza= $FORM{'bottom'};
unless ($xyza eq $cookie_default)
{
if (&GetCookies('activea'))
{
$password = $Cookies{'activea'};
$first_time = "no";
}
else
{
$xyz= $FORM{'password'};
$password = crypt($xyz, $salt);
$first_time = "yes";
}
if ($password eq $active_string)
{
if ($first_time eq "yes")
{
&SetCookies('activea',$password);
&content;
print qq~ $title
~;
exit;
}
}
else
{
&enter_password;
exit;
}
}
################
}
sub oops
{
&content;
$message = $_[0];
print "Can't open $message ";
exit;
}
sub set_counter
{
open(MAIN_GUESTBOOK,"$guestbook_data_name");
@main_data = ;
$max = 0;
foreach $row (@main_data)
{
@fields = split (/\|/, $row);
if ($fields[0] > $max)
{
$max = $fields[0];
}
} # end for each
close(MAIN_GUESTBOOK);
$max++;
&get_file_lock("$location_of_lock_file");
open (NUMBER,">$counter_name");
print NUMBER "$max";
close(NUMBER);
&release_file_lock("$location_of_lock_file");
}
sub restore_defaults
{
&seek_cook;
open(DEFAULTS,"$prefs_backup_name");
@default_data = ;
close(DEFAULTS);
open(PREFS,">$prefs_name");
foreach $row (@default_data)
{
print PREFS "$row";
}
close(PREFS);
&content;
&main_headera;
print qq~ ~;
&main_headerb;
print qq~
Active Guestbook Standard Preferences Manager
Factory default preferences restored.
~;
&inter_footer;
}
sub restore_language_defaults
{
&seek_cook;
open(DEFAULTS,"$langprefs_backup_name");
@default_data = ;
close(DEFAULTS);
open(PREFS,">$langprefs_name");
foreach $row (@default_data)
{
print PREFS "$row";
}
close(PREFS);
open(DEFAULTS,"$months_bak_name");
@default_data = ;
close(DEFAULTS);
open(PREFS,">$months_name");
foreach $row (@default_data)
{
print PREFS "$row";
}
close(PREFS);
&content;
&main_headera;
print qq~ ~;
&main_headerb;
print qq~
Active Guestbook Language Preferences Manager
Factory default language preferences restored.
~;
&inter_footer;
}
sub check_new_files
{
unless (-e "$counter_name")
{
&content;
print "The file $counter_name does not exist" ;
exit;
}
unless (-e "$guestbook_data_name")
{
&content;
print "The file $guestbook_data_name does not exist" ;
exit;
}
unless (-e "$prefs_name")
{
&content;
print "The file $prefs_name does not exist" ;
exit;
}
unless (-r "$counter_name")
{
&content;
print "The file $counter_name does can not be read." ;
exit;
}
unless (-r "$guestbook_data_name")
{
&content;
print "The file guestbook_data can not be read." ;
exit;
}
unless (-r "$prefs_name")
{
&content;
print "The file $prefs_name can not be read." ;
exit;
}
unless (-w "$counter_name")
{
&content;
print "The file $counter_name can not be written to." ;
exit;
}
unless (-w "$guestbook_data_name")
{
&content;
print "The file $guestbook_data_name can not be written to." ;
exit;
}
unless (-w "$prefs_name")
{
&content;
print "The file $prefs_name can not be written to." ;
exit;
}
}
sub view_langprefs
{
&seek_cook;
&content;
# upgrade 2.1
($TXT_has_been_added_moderated = "Thanks. Your message has been sent to our webmaster and will be added shortly.") if ($TXT_has_been_added_moderated
eq "");
# upgrade 4.1
($TXT_has_been_added_private = "Thanks. Your private message has been sent to our webmaster.") if ($TXT_has_been_added_private
eq "");
print qq~
Active Guestbook - Language Preferences Manager
Active Guestbook - Language Preferences Manager
Return to Guestbook | Return to Control Panel
Restore defaults
Top of main guestbook page.
Search section at bottom of main guestbook page.
Add a message screen.
Add a message preview screen.
Message confirmation screen.
Search results screen.
Email address error messages.
Other messages.
Days.
~;
foreach $monthss (@daylist)
{
if ($monthss =~ /[a-zA-Z0-9]/)
{
print "$monthss\n";
}
}
print qq~
Months.
~;
foreach $monthss (@monthlist)
{
if ($monthss =~ /[a-zA-Z0-9]/)
{
print "$monthss\n";
}
}
print qq~
~;
}
sub view_colprefs
{
&seek_cook;
$ignore = $FORM{'ignore'};
unless ($ignore eq "yes") # only backup when you first enter view_colprefs
{
open(COLFILE,"$colprefs_name");
@cols = ;
close(COLFILE);
open(TEMPCOLFILE,">$tempcolprefs_name");
foreach $line (@cols)
{
print TEMPCOLFILE "$line";
}
close(TEMPCOLFILE);
}
&content;
print qq~
Active Guestbook - Color Preferences Manager
Active Guestbook - Color Preferences Manager
Return to Guestbook | Use these colors/Return
to Control Panel
Restore FACTORY color defaults | Restore
USER color defaults
Cancel all changes made during this visit
Save these colors as USER color defaults
(If you have made any changes, you first need to click VIEW COLORS using the button
at the bottom.)
~;
}
sub update_ip_addresses
{
if ($ip_addresses eq $cookie_default)
{
open(USER_FILE,">$guestbook_data_name");
close(USER_FILE);
}
}
sub check_values
{
if ($algo eq "p")
{
$text11 = "/gmi/ten.stpircs-evitca//:ptth\"=crs gmi<>\"lmth.daolnwod_koobtseug/ger/ten.stpircs-evitca//:ptth\"=ferh a<";
}
else
{
$text11 = "/gmi/ten.stpircs-evitca//:ptth\"=crs gmi<>\"lmth.daolnwod_koobtseug/ten.stpircs-evitca//:ptth\"=ferh a<";
}
$text12 = ">a/<>0=redrob \"fig.";
@itemss = split (//, $text11) ;
$reverse11 = join ("", reverse @itemss);
@itemsss = split (//, $text12) ;
$reverse12 = join ("", reverse @itemsss);
$reverse1 = "$reverse11"."$version"."$reverse12";
}
sub edit_colprefs
{
&seek_cook;
## TEMPCOLFILE now has the last saved preferences
open(COLFILE,">$colprefs_name");
print COLFILE "trans_search=$FORM{'trans_search'}=\n";
print COLFILE "trans_message_header=$FORM{'trans_message_header'}=\n";
print COLFILE "trans_message_body=$FORM{'trans_message_body'}=\n";
print COLFILE "data_color1=$FORM{'data_color1'}=\n";
print COLFILE "data_color2=$FORM{'data_color2'}=\n";
print COLFILE "textdata_color1=$FORM{'textdata_color1'}=\n";
print COLFILE "textdata_color2=$FORM{'textdata_color2'}=\n";
print COLFILE "table_color1=$FORM{'table_color1'}=\n";
print COLFILE "table_color2=$FORM{'table_color2'}=\n";
print COLFILE "texttable_color1=$FORM{'texttable_color1'}=\n";
print COLFILE "texttable_color2=$FORM{'texttable_color2'}=\n";
print COLFILE "backcolor=$FORM{'backcolor'}=\n";
print COLFILE "link=$FORM{'link'}=\n";
print COLFILE "vlink=$FORM{'vlink'}=\n";
print COLFILE "alink=$FORM{'alink'}=\n";
print COLFILE "text=$FORM{'text'}=\n";
# print COLFILE "commentcolor=$FORM{'commentcolor'}=\n";
print COLFILE "searchcolor=$FORM{'searchcolor'}=\n";
close(COLFILE);
&content;
print qq~
$title
Now loading new color preferences
~;
}
#################
sub edit_langprefs
{
&seek_cook;
open(PREFS,">$langprefs_name");
print PREFS "web_comment=$FORM{'web_comment'}=\n";
print PREFS "TXT_add_a_message=$FORM{'TXT_add_a_message'}=\n";
print PREFS "TXT_search=$FORM{'TXT_search'}=\n";
print PREFS "TXT_previous=$FORM{'TXT_previous'}=\n";
print PREFS "TXT_next=$FORM{'TXT_next'}=\n";
print PREFS "TXT_there_is_now=$FORM{'TXT_there_is_now'}=\n";
print PREFS "TXT_there_are_now=$FORM{'TXT_there_are_now'}=\n";
print PREFS "TXT_messages_in_our_guestbook=$FORM{'TXT_messages_in_our_guestbook'}=\n";
print PREFS "TXT_message_in_our_guestbook=$FORM{'TXT_message_in_our_guestbook'}=\n";
print PREFS "TXT_viewing_message=$FORM{'TXT_viewing_message'}=\n";
print PREFS "TXT_viewing_messages=$FORM{'TXT_viewing_messages'}=\n";
print PREFS "TXT_to=$FORM{'TXT_to'}=\n";
print PREFS "TXT_after_last_number=$FORM{'TXT_after_last_number'}=\n";
print PREFS "TXT_after_last_number1=$FORM{'TXT_after_last_number1'}=\n";
print PREFS "TXT_you_can_search_this_guestbook_by=$FORM{'TXT_you_can_search_this_guestbook_by'}=\n";
print PREFS "TXT_searchmessage=$FORM{'TXT_searchmessage'}=\n";
print PREFS "TXT_searchname=$FORM{'TXT_searchname'}=\n";
print PREFS "TXT_searchall=$FORM{'TXT_searchall'}=\n";
print PREFS "TXT_searchsearch=$FORM{'TXT_searchsearch'}=\n";
print PREFS "TXT_searchtext=$FORM{'TXT_searchtext'}=\n";
print PREFS "TXT_back_to_guestbook=$FORM{'TXT_back_to_guestbook'}=\n";
print PREFS "TXT_your_name=$FORM{'TXT_your_name'}=\n";
print PREFS "TXT_your_message=$FORM{'TXT_your_message'}=\n";
print PREFS "TXT_required=$FORM{'TXT_required'}=\n";
print PREFS "TXT_where_in_the_world=$FORM{'TXT_where_in_the_world'}=\n";
print PREFS "TXT_your_email_address=$FORM{'TXT_your_email_address'}=\n";
print PREFS "TXT_your_web_page_address=$FORM{'TXT_your_web_page_address'}=\n";
print PREFS "TXT_if_you_have_one=$FORM{'TXT_if_you_have_one'}=\n";
print PREFS "TXT_private_message=$FORM{'TXT_private_message'}=\n";
print PREFS "TXT_private_message2=$FORM{'TXT_private_message2'}=\n";
print PREFS "TXT_continue=$FORM{'TXT_continue'}=\n";
print PREFS "TXT_these_are_the=$FORM{'TXT_these_are_the'}=\n";
print PREFS "TXT_if_correct=$FORM{'TXT_if_correct'}=\n";
print PREFS "TXT_if_not=$FORM{'TXT_if_not'}=\n";
print PREFS "TXT_go_back=$FORM{'TXT_go_back'}=\n";
print PREFS "TXT_and_edit=$FORM{'TXT_and_edit'}=\n";
print PREFS "TXT_none_given=$FORM{'TXT_none_given'}=\n";
print PREFS "TXT_has_been_added=$FORM{'TXT_has_been_added'}=\n";
print PREFS "TXT_has_been_added_moderated=$FORM{'TXT_has_been_added_moderated'}=\n";
print PREFS "TXT_has_been_added_private=$FORM{'TXT_has_been_added_private'}=\n";
print PREFS "TXT_search_results=$FORM{'TXT_search_results'}=\n";
print PREFS "TXT_back_search_again=$FORM{'TXT_back_search_again'}=\n";
print PREFS "TXT_one_match=$FORM{'TXT_one_match'}=\n";
print PREFS "TXT_no_match=$FORM{'TXT_no_match'}=\n";
print PREFS "TXT_more_matches_1=$FORM{'TXT_more_matches_1'}=\n";
print PREFS "TXT_more_matches_2=$FORM{'TXT_more_matches_2'}=\n";
print PREFS "TXT_please_fill_in=$FORM{'TXT_please_fill_in'}=\n";
print PREFS "TXT_please_go_back_and_edit=$FORM{'TXT_please_go_back_and_edit'}=\n";
print PREFS "TXT_no_dot_at_start=$FORM{'TXT_no_dot_at_start'}=\n";
print PREFS "TXT_no_www_at_start=$FORM{'TXT_no_www_at_start'}=\n";
print PREFS "TXT_no_squiggles_in_domain=$FORM{'TXT_no_squiggles_in_domain'}=\n";
print PREFS "TXT_only_one_at=$FORM{'TXT_only_one_at'}=\n";
print PREFS "TXT_no_dots_next=$FORM{'TXT_no_dots_next'}=\n";
print PREFS "TXT_wrong_end=$FORM{'TXT_wrong_end'}=\n";
print PREFS "TXT_too_many_words=$FORM{'TXT_too_many_words'}=\n";
print PREFS "TXT_disallowed_word=$FORM{'TXT_disallowed_word'}=\n";
print PREFS "TXT_blocked_IP=$FORM{'TXT_blocked_IP'}=\n";
close(PREFS);
open(USER_FILE,">$months_name");
print USER_FILE "$FORM{'month_names'}\n";
close(USER_FILE);
open(USER_FILE,">$days_name");
print USER_FILE "$FORM{'day_names'}\n";
close(USER_FILE);
&content;
print qq~
$title
Language preferences updated
~;
}
sub restore_coldefaults
{
&seek_cook;
open(DEFAULTS,"$colprefs_backup_name");
@default_data = ;
close(DEFAULTS);
open(PREFS,">$colprefs_name");
foreach $row (@default_data)
{
print PREFS "$row";
}
close(PREFS);
&content;
print qq~
$title
~;
print qq~
Color defaults restored
~;
}
sub restore_user_defaults
{
&seek_cook;
open(DEFAULTS,"$userprefs_backup_name");
@default_data = ;
close(DEFAULTS);
open(PREFS,">$prefs_name");
foreach $row (@default_data)
{
print PREFS "$row";
}
close(PREFS);
open(DEFAULTS,"$user_default_html_name");
@default_data = ;
close(DEFAULTS);
open(PREFS,">$user_html_name");
foreach $row (@default_data)
{
print PREFS "$row";
}
close(PREFS);
open(DEFAULTS,"$user_default_html_footer_name");
@default_data = ;
close(DEFAULTS);
open(PREFS,">$user_html_footer_name");
foreach $row (@default_data)
{
print PREFS "$row";
}
close(PREFS);
open(DEFAULTS,"$thank_you_user_default_name");
@default_data = ;
close(DEFAULTS);
open(PREFS,">$thank_you_name");
foreach $row (@default_data)
{
print PREFS "$row";
}
close(PREFS);
&content;
&main_headera;
print qq~ ~;
&main_headerb;
print qq~
Active Guestbook Standard Preferences Manager
User default preferences restored.
~;
&inter_footer;
}
sub save_user_defaults
{
&seek_cook;
open(DEFAULTS,"$prefs_name");
@default_data = ;
close(DEFAULTS);
open(PREFS,">$userprefs_backup_name");
foreach $row (@default_data)
{
print PREFS "$row";
}
close(PREFS);
open(DEFAULTS,"$user_html_name");
@default_data = ;
close(DEFAULTS);
open(PREFS,">$user_default_html_name");
foreach $row (@default_data)
{
print PREFS "$row";
}
close(PREFS);
open(DEFAULTS,"$user_html_footer_name");
@default_data = ;
close(DEFAULTS);
open(PREFS,">$user_default_html_footer_name");
foreach $row (@default_data)
{
print PREFS "$row";
}
close(PREFS);
open(DEFAULTS,"$thank_you_name");
@default_data = ;
close(DEFAULTS);
open(PREFS,">$thank_you_user_default_name");
foreach $row (@default_data)
{
print PREFS "$row";
}
close(PREFS);
&content;
&main_headera;
print qq~ ~;
&main_headerb;
print qq~
Active Guestbook Standard Preferences Manager
Preferences saved as User Defaults
~;
&inter_footer;
}
sub restore_user_color_defaults
{
&seek_cook;
open(DEFAULTS,"$usercolprefs_backup_name");
@default_data = ;
close(DEFAULTS);
open(PREFS,">$colprefs_name");
foreach $row (@default_data)
{
print PREFS "$row";
}
close(PREFS);
&content;
print qq~
$title
~;
print qq~
User color defaults restored
~;
}
sub save_user_color_defaults
{
&seek_cook;
open(DEFAULTS,"$colprefs_name");
@default_data = ;
close(DEFAULTS);
open(PREFS,">$usercolprefs_backup_name");
foreach $row (@default_data)
{
print PREFS "$row";
}
close(PREFS);
$where="view_colprefs";
&inter_header;
print qq~
Active Guestbook User
defaults saved
~;
&inter_footer;
}
sub link_colors
{
@realcols = (Black, Maroon, Green, Olive, Navy, Purple, Teal, Gray, Silver, Red, Lime, Yellow, Blue, Fuchsia, Aqua, White);
foreach $realcols(@realcols)
{
if ($matchcol eq $realcols)
{
print "$realcols";
}
else
{
print " $realcols";
}
}
}
sub cancel_color_change
{
&seek_cook;
open(COLFILE,"$tempcolprefs_name");
@cols = ;
close(COLFILE);
open(TEMPCOLFILE,">$colprefs_name");
foreach $line (@cols)
{
print TEMPCOLFILE "$line";
}
close(TEMPCOLFILE);
$where="view_colprefs";
&inter_header;
print qq~
Restoring last saved color preferences.
~;
&inter_footer;
}
sub actions
{
if ($demo eq "off")
{
&add_to_active if ($action eq "add_to_active");
&already_added if ($action eq "already_added");
&edit_dateprefs if ($action eq "edit_dateprefs");
&link if ($action eq "lin");
&finish_start if ($action eq "finish_start");
&read if ($action eq "");
&read if ($action eq "setup");
&read if ($action eq "reload");
&add if ($action eq "add");
&write if ($action eq "write");
&write if ($action eq "preview");
&write if ($action eq "post_preview");
&write if ($action eq "no_preview");
&view_prefs if ($action eq "view_prefs");
&change1 if ($action eq "change1");
&change2 if ($action eq "change2");
&view_to_edit if ($action eq "view_to_edit");
&add_response1 if ($action eq "add_response1");
&view_to_undo if ($action eq "view_to_undo");
&search if ($action eq "search");
&view_change_password if ($action eq "view_change_password");
&view_backups if ($action eq "view_backups");
&view_single_backup if ($action eq "view_single_backup");
&view_colprefs if ($action eq "view_colprefs");
&view_langprefs if ($action eq "view_langprefs");
&cancel_color_change if ($action eq "cancel_color_change");
&control_panel if ($action eq "control_panel");
&bug if ($action eq "bug");
&edit_prefs if ($action eq "edit_prefs");
&restore_coldefaults if ($action eq "restore_coldefaults");
&save_user_color_defaults if ($action eq "save_user_color_defaults");
&save_user_defaults if ($action eq "save_user_defaults");
&restore_user_color_defaults if ($action eq "restore_user_color_defaults");
&restore_user_defaults if ($action eq "restore_user_defaults");
&restore_backups if ($action eq "restore_backups");
&restore_defaults if ($action eq "restore_defaults");
&undo_last_restore if ($action eq "undo_last_restore");
&change_password if ($action eq "change_password");
&edit_colprefs if ($action eq "edit_colprefs");
&edit_langprefs if ($action eq "edit_langprefs");
&trash_item if ($action eq "trash_item");
&undelete_item if ($action eq "undelete_item");
&delete_item if ($action eq "delete_item");
&add_response2 if ($action eq "add_response2");
&restore_language_defaults if ($action eq "restore_language_defaults");
&approve_message if ($action eq "approve_message");
&view_dateprefs if ($action eq "view_dateprefs");
}
else
{
&demostuff if ($action eq "edit_dateprefs");
&demostuff if ($action eq "add_to_active");
&demostuff if ($action eq "already_added");
&link if ($action eq "lin");
&read if ($action eq "");
&read if ($action eq "reload");
&read if ($action eq "setup");
&view_dateprefs if ($action eq "view_dateprefs");
&add if ($action eq "add");
&write if ($action eq "write");
&write if ($action eq "preview");
&write if ($action eq "post_preview");
&write if ($action eq "no_preview");
&view_prefs if ($action eq "view_prefs");
&change1 if ($action eq "change1");
&view_to_edit if ($action eq "view_to_edit");
&add_response1 if ($action eq "add_response1");
&view_to_undo if ($action eq "view_to_undo");
&search if ($action eq "search");
&view_change_password if ($action eq "view_change_password");
&view_backups if ($action eq "view_backups");
&view_single_backup if ($action eq "view_single_backup");
&view_colprefs if ($action eq "view_colprefs");
&view_langprefs if ($action eq "view_langprefs");
&cancel_color_change if ($action eq "cancel_color_change");
&control_panel if ($action eq "control_panel");
&demostuff if ($action eq "change2");
&demostuff if ($action eq "bug");
&demostuff if ($action eq "edit_prefs");
&demostuff if ($action eq "edit_langprefs");
&restore_coldefaults if ($action eq "restore_coldefaults");
&save_user_color_defaults if ($action eq "save_user_color_defaults");
&demostuff if ($action eq "save_user_defaults");
&restore_user_color_defaults if ($action eq "restore_user_color_defaults");
&demostuff if ($action eq "restore_user_defaults");
&demostuff if ($action eq "restore_backups");
&demostuff if ($action eq "restore_defaults");
&demostuff if ($action eq "undo_last_restore");
&demostuff if ($action eq "change_password");
&demostuff if ($action eq "edit_colprefs");
&demostuff if ($action eq "trash_item");
&demostuff if ($action eq "undelete_item");
&demostuff if ($action eq "delete_item");
&add_response2 if ($action eq "add_response2");
&restore_language_defaults if ($action eq "restore_language_defaults");
&demostuff if ($action eq "approve_message");
}
}
sub demostuff {
&content;
&main_header;
&active_header;
print qq~
Sorry. This is only a demo. That action is not enabled.Back
~;
exit;
}
sub required_script
{
print qq~
~;
}
sub thanks
{
&content;
&main_headera;
print qq~ ~;
&main_headerc;
&active_header if $active_header eq "on";
print qq~ ~;
print qq~
~;
if (($moderated eq "yes") && ($send_email_to_admin eq "off"))
{
open (MAIL, "|$mail_path $admin_email");
print MAIL "To: $admin_email\n";
print MAIL "From: $admin_email\n";
print MAIL "Subject: Guestbook message approval required\n\n";
print MAIL "You have a new posting to your guestbook which requires your approval. You can confirm the message via the Message
Manager of the Active Guestbook Control Panel.\n\n";
$converted_message = $message;
$converted_message =~ s/ /\n/g;
print MAIL "=========================\n";
print MAIL "From: $full_name\n";
if ($guest_email) {
print MAIL "Email: $guest_email\n";
}
if ($location) {
print MAIL "Location: $location\n";
}
if ($url) {
print MAIL "URL: $url\n";
}
print MAIL "$converted_message\n\n";
print MAIL "=========================\n";
close(MAIL);
}
}
###############
sub no_thanks
{
&content;
&main_headera;
print qq~ ~;
&main_headerc;
print qq~
~;
print qq~
~;
if (($moderated eq "yes") && ($send_email_to_admin eq "off"))
{
open (MAIL, "|$mail_path $admin_email");
print MAIL "To: $admin_email\n";
print MAIL "From: $admin_email\n";
print MAIL "Subject: Guestbook message approval required\n\n";
print MAIL "You have a new posting to your guestbook which requires your approval. You can confirm the message via the Message
Manager of the Active Guestbook Control Panel.\n\n";
$converted_message = $message;
$converted_message =~ s/ /\n/g;
print MAIL "=========================\n";
print MAIL "From: $full_name\n";
if ($guest_email) {
print MAIL "Email: $guest_email\n";
}
if ($location) {
print MAIL "Location: $location\n";
}
if ($url) {
print MAIL "URL: $url\n";
}
print MAIL "$converted_message\n\n";
print MAIL "=========================\n";
close(MAIL);
}
}
###############
sub control_panel
{
&seek_cook;
open(USER_FILE,"$guestbook_data_name") || &oops('$guestbook_data_name');
$noss = 0;
@data = ;
close(USER_FILE);
foreach $row (@data)
{
@fields = split (/\|/, $row);
if (($fields[15] eq "waiting") && ($fields[10] ne "del"))
{
$noss++;
}
}
&content;
print qq~
Active Guestbook Control Panel
~;
print qq~
Active Guestbook Control Panel
~;
if ($noss >1)
{
print qq~ You have $noss messages awaiting approval in your message manager. ~;
}
elsif ($noss == 1)
{
print qq~ You have a message awaiting approval in your message manager.
~;
}
print qq~
Choose from the list below ~;
if (-e "$already_added")
{
$opo = 12;
}
else
{
$opo = 13;
}
print qq~
$title
Standard Preferences Manager
Color Preferences Manager
Language Preferences Manager
Date Format Manager
Message Manager
Trash Manager
Backup Manager
Password Manager
Home page
============ ~;
unless (-e "$already_added")
{
print qq~ Add your site to active-scripts.net ~;
}
print qq~ Comment/report a bug
[ Active Scripts Help | Active
Scripts FAQ ]
You are using Active Guestbook version $bversion. Updates are regularly posted on the Active Scripts Website.
$reverse1
~;
}
sub inter_footer
{
print qq~
~;
}
sub link
{
$link = $FORM{'link'};
&content;
if ($link ne "take_me_home")
{
print qq~
~;
}
else
{
print qq~
~;
}
exit;
}
sub main_table_results
{
$header_trans1 = "";
$body_trans1 = "";
$header_trans2 = "";
$body_trans2 = "";
if ($trans_message_header ne "yes")
{
# $table_color1 and 2 are body colors
# $data_color1 and 2 are header colors
$header_trans1 = "bgcolor=$data_color1";
$header_trans2 = "bgcolor=$data_color2";
}
if ($trans_message_body ne "yes")
{
# $table_color1 and 2 are body colors
# $data_color1 and 2 are header colors
$body_trans1 = "bgcolor=$table_color1";
$body_trans2 = "bgcolor=$table_color2";
}
if ($border_size eq "")
{
$border_size = 1;
}
print qq~
~;
print qq~
~;
$guestbookname = $fields[1];
$guestbookmessage = $fields[2];
$guestbooklocation = $fields[5];
$guestbookcomment = $fields[6];
$guestbookurl = $fields[11];
$guestbookname =~ s/ZPIPEPIPEY/|/g;
$guestbookmessage =~ s/ZPIPEPIPEY/|/g;
$guestbooklocation =~ s/ZPIPEPIPEY/|/g;
$guestbookcomment =~ s/ZPIPEPIPEY/|/g;
$guestbookurl =~ s/ZPIPEPIPEY/|/g;
if ($count ==1)
{
print qq~
$guestbookname
~;
}
else
{
print qq~
$guestbookname
~;
}
if (($fields[4]) && ($show_guest_email ne "no"))
{ # start
if ($mung eq "on")
{
$munged_address = $fields[4];
$munged_address =~ s/\@/~AT~/g;
$munged_address =~ s/\./~DOT~/g;
$add_me = $munged_address;
}
else
{
$add_me = $fields[4];
}
if ($email_link_type eq "text")
{
$email_symbol = $email_txt;
}
elsif ($email_link_type eq "image")
{
$email_symbol = " ";
}
else
{
$email_symbol = $add_me;
}
if ($count ==1)
{
if( $use_mailto eq "yes")
{
print qq~
| $email_symbol
~;
}
else
{
print qq~
| $add_me
~;
}
}
else
{
if( $use_mailto eq "yes")
{
print qq~
| $email_symbol
~;
}
else
{
print qq~
| $add_me
~;
}
}
} #end mail
# start url
if (($fields[11]) && ($show_guest_url ne "no"))
{
if ($web_link_type eq "text")
{
$url_symbol = $url_text;
}
elsif ($web_link_type eq "image")
{
$url_symbol = " ";
}
else
{
$url_symbol = $guestbookurl;
}
if ($count ==1)
{
if ($web_enabled eq "yes")
{
print qq~
| $url_symbol ~;
}
else
{
print qq~
| $guestbookurl ~;
}
}
else
{
if ($web_enabled eq "yes")
{
print qq~
| $url_symbol ~;
}
else
{
print qq~
| $guestbookurl ~;
}
}
}
print qq~
~;
if ($count ==1)
{
print qq~
~;
}
else
{
print qq~
~;
}
&date_mod;
print qq~
$guestbookmessage
$condate
~;
if ($fields[5])
{
print qq~
- $guestbooklocation
~;
}
print qq~
~;
if ($fields[6])
{
if ($table_width =~ /\%/)
{
$table_width_comm = $table_width;
$table_width_comm =~ s/\%//gi;
$table_width_comm = $table_width_comm*0.8;
$table_width_comm = ($table_width_comm . "%");
}
else
{
$table_width_comm = $table_width*0.8;
}
print qq~
$web_comment
$guestbookcomment
~;
}
print qq~
~;
print qq~
~;
if ($show_line eq "no")
{
unless ($use_hr_image eq "yes")
{
print qq~
~;
}
}
else
{
print qq~
~;
}
unless ($use_hr_image ne "yes")
{
print qq~
~;
}
$count++;
if ($count >2)
{
$count = 1;
}
}
sub inter_header
{
&content;
print qq~
$title
~;
}
sub basic_header
{
&content;
print qq~
$title
~;
}
sub check_address_for_mistakes
{
if ($guest_email=~/^\.|^\@/)
{
&basic_header;
print qq~
$title
$TXT_no_dot_at_start$TXT_please_go_back_and_edit
~;
exit;
}
if ($guest_email=~/^www\./)
{
&basic_header;
print qq~
$title
$TXT_no_www_at_start$TXT_please_go_back_and_edit
~;
exit;
}
$domain=$guest_email;
$domain=~s/^.*\@(.*)/$1/;
if ($domain=~/_|~|#/)
{
&basic_header;
print qq~
$title
$TXT_no_squiggles_in_domain$TXT_please_go_back_and_edit ~;
exit;
}
if ($guest_email=~tr/@//!=1)
{
&basic_header;
print qq~
$title
$TXT_only_one_at$TXT_please_go_back_and_edit
~;
exit;
}
if ($guest_email=~/\.\@|\@\.|\.\./)
{
&basic_header;
print qq~
$title
$TXT_no_dots_next$TXT_please_go_back_and_edit
~;
exit;
}
if (!($guest_email=~/\.[a-z]{2,4}$/i))
{
&basic_header;
print qq~
$title
$TXT_wrong_end$TXT_please_go_back_and_edit
~;
exit;
}
} # end check mistakes
sub plain_header
{
print qq~
$title
~;
&required_script if $action eq "add";
print qq~
~;
}
sub plain_header_stop
{
print qq~
$title
~;
&required_script if $action eq "add";
print qq~
~;
}
sub plain_table_results
{
if ($count ==1)
{
print qq~
~;
}
else
{
print qq~
~;
}
print qq~
~;
if ($count ==1)
{
print qq~
$fields[1]
~;
}
else
{
print qq~
$fields[1]
~;
}
if ($fields[4])
{
if( $use_mailto eq "yes")
{
print qq~
- $fields[4]
~;
}
else
{
print qq~
- $fields[4]
~;
}
}
if (($fields[11]) && ($web_enabled eq "yes"))
{
print qq~
- web page
~;
}
print qq~
~;
print qq~
~;
if ($count ==1)
{
print qq~
~;
}
else
{
print qq~
~;
}
print qq~
$fields[2]
$fields[3]
~;
if ($fields[5])
{
print qq~
- $fields[5]
~;
}
print qq~
~;
if ($fields[6])
{
print qq~
$web_comment: -
$fields[6]
~;
}
print qq~
~;
print qq~
~;
$count++;
if ($count >2)
{
$count = 1;
}
}
sub html_search_results_plain
{
$count = 1;
$number_of_messages = @hits;
@hits = reverse(@hits);
if ($search_flag ne "no")
{
if ($number_of_messages == 1)
{
print qq~ One guestbook message matches your search criteria.
~;
}
else
{
print qq~ $number_of_messages guestbook messages match your search
criteria. ~;
}
}
foreach $row (@hits)
{
#########
@fields = split (/\|/, $row);
# $grouped++;
# if (($grouped > ($start_number)) && ($grouped < ($start_number + $no_displayed + 1)))
# {
#&plain_table_results;
&main_table_results;
# } # end if number is right
} # end for each row
#########
}
sub bug
{
&content;
if (defined($ENV{'SERVER_NAME'})) {
$domain = 'http://'.$ENV{'SERVER_NAME'};
}
else {
$domain = 'http://www.myhost.com';
}
$ref = $domain.$guesturl;
print qq~ $title
~;
exit;
}
sub already_added
{
unless (-e "$already_added")
{
open(COLFILE,">$already_added");
chmod(0777, "$already_added");
print COLFILE "\n";
close(COLFILE);
}
&read;
}
sub add_to_active
{
&content;
if (defined($ENV{'SERVER_NAME'})) {
$domain = 'http://'.$ENV{'SERVER_NAME'};
}
else {
$domain = 'http://www.myhost.com';
}
$ref = $domain.$guesturl;
print qq~ $title
~;
exit;
}
sub newoptions
{
print qq~
Active Grey
Aquamarine
Black
Blue
Brown
Copper
Coral
Cyan
Dark Purple
Dark Tan
Forest Green
Gold
Green
Grey
Khaki
Light Blue
Light Copper
Light Grey
Light Yellow
Lime Green
Magenta
Maroon
Midnight Blue
Navy Blue
Orange
Pale Green
Pink
Red
Silver
Sky Blue
Violet
White
Yellow
Other (type code)...
~;
}
sub approve_message
{
&seek_cook;
&get_file_lock("$location_of_lock_file");
$ref = $FORM{'ref'};
$start_number = $FORM{'start_number'};
open(USER_FILE,"$guestbook_data_name") || &oops('$guestbook_data_name');
@data = ;
close(USER_FILE);
open(USER_FILE,">$guestbook_data_name");
foreach $row (@data)
{
@fields = split (/\|/, $row);
if ($ref ne $fields[0])
{
print USER_FILE "$row";
}
else
{
$guest_email = $fields[4];
print USER_FILE "$fields[0]|$fields[1]|$fields[2]|$fields[3]|$fields[4]|$fields[5]|$fields[6]|$fields[7]|$fields[8]|$fields[9]|$fields[10]|$fields[11]|$fields[12]|$fields[13]|$fields[14]||$fields[16]|$fields[17]|$fields[18]|$fields[19]|$fields[20]|$fields[21]|$fields[22]|$fields[23]|$fields[24]|$fields[25]|$fields[26]|$fields[27]|$fields[28]|$fields[29]|$fields[30]|\n";
}
# removes waiting from field 15
}
close(USER_FILE);
&release_file_lock("$location_of_lock_file");
if (($guest_email) && ($send_email_to_guest eq "on"))
{
open (MAIL, "|$mail_path $guest_email");
print MAIL "To: $guest_email\n";
print MAIL "From: $admin_email\n";
print MAIL "Subject: $thanks_title\n\n";
print MAIL "$thank_you\n\n";
if ($thanks_include_message eq "on")
{
$converted_message = $fields[2];
$converted_message =~ s/ /\n/g;
print MAIL "=========================\n";
print MAIL "Your message:\n\n";
print MAIL "$converted_message\n\n";
print MAIL "=========================\n";
}
close(MAIL);
}
&content;
&main_headera;
print qq~ ~;
&main_headerb;
print qq~
Active Guestbook Message Manager
Message now approved
~;
} # end approve
sub subdirectory
{
$guestbook_files_directory = "active_guestbook_files";
$guestbook_backups_directory = "active_guestbook_backups";
$already_added = "./$guestbook_files_directory/added.txt";
$guestbook_data_name = "./$guestbook_files_directory/guestbook_data.txt";
$active_name = "./$guestbook_files_directory/active.txt";
$colprefs_name = "./$guestbook_files_directory/colprefs.txt";
$colprefs_backup_name= "./$guestbook_files_directory/colprefs_backup.txt";
$counter_name = "./$guestbook_files_directory/counter.txt";
$langprefs_name = "./$guestbook_files_directory/langprefs.txt";
$langprefs_backup_name = "./$guestbook_files_directory/langprefs_backup.txt";
$months_name = "./$guestbook_files_directory/months.txt";
$days_name = "./$guestbook_files_directory/days.txt";
$months_bak_name = "./$guestbook_files_directory/months_bak.txt";
$prefs_name = "./$guestbook_files_directory/prefs.txt";
$prefs_backup_name = "./$guestbook_files_directory/prefs_backup.txt";
$ip_name = "./$guestbook_files_directory/ip_limit.txt";
$senddate_name = "./$guestbook_files_directory/senddate.txt";
$tempcolprefs_name = "./$guestbook_files_directory/tempcolprefs.txt";
$thank_you_name = "./$guestbook_files_directory/thank_you.txt";
$thank_you_user_default_name = "./$guestbook_files_directory/thank_you_user_default.txt";
$update_name = "./$guestbook_files_directory/update.txt";
$user_default_html_name = "./$guestbook_files_directory/user_default_html.txt";
$user_default_html_footer_name = "./$guestbook_files_directory/user_default_html_footer.txt";
$user_html_name = "./$guestbook_files_directory/user_html.txt";
$user_html_footer_name = "./$guestbook_files_directory/user_html_footer.txt";
$user_style_name = "./$guestbook_files_directory/user_style.txt";
$userprefs_backup_name = "./$guestbook_files_directory/userprefs_backup.txt";
$usercolprefs_backup_name = "./$guestbook_files_directory/usercolprefs_backup.txt";
$user_date_file = "./$guestbook_files_directory/user_date_format.txt";
}
sub ver204
{
if (-e "guestbook_data.txt")
{
if (-e "backups")
{
rename(backups,$guestbook_backups_directory);
}
unless (-e "$guestbook_files_directory")
{
mkdir ($guestbook_files_directory, 0777);
chmod(0777, "$guestbook_files_directory");
}
@files_to_copy = ("guestbook_data.txt","active.txt","colprefs.txt","colprefs_backup.txt","counter.txt","langprefs.txt",
"langprefs_backup.txt","months.txt","months_bak.txt","prefs.txt","prefs_backup.txt","senddate.txt",
"tempcolprefs.txt","thank_you.txt","thank_you_user_default.txt","update.txt","user_default_html.txt",
"user_default_html_footer.txt","user_html.txt","user_html_footer.txt","user_style.txt",
"userprefs_backup.txt","usercolprefs_backup.txt");
$guestbook_files_directory = "active_guestbook_files";
foreach $file (@files_to_copy)
{
if (-e "$file")
{
open(IN,"$file");
open(OUT,">./$guestbook_files_directory/$file");
chmod(0777,"./$guestbook_files_directory/$file");
while ()
{
print OUT "$_";
}
close(OUT);
close(IN);
unlink($file);
}
}
}
}
sub show_edit_number_menu
{
print qq~
[
~;
# $number_of_messages = int($number_of_messages); # int here sorts out any funny decimals entered in the control panel
$number_of_pages = ($number_of_messages / $no_displayed) ;
$number_of_pages = int($number_of_pages); # no of full pages
if ($number_of_messages > ($number_of_pages * $no_displayed))
{
$extra = "yes";
}
if ($extra eq "yes")
{
$number_of_pages = $number_of_pages +1;
}
($start_number = 0) if (!$start_number);
for ($x = 1; $x < $number_of_pages+1 ; $x++ )
{
$sn = (($x*$no_displayed)- $no_displayed);
$bottom = ($start_number - (11 * $no_displayed));
$top = ($start_number + (11 * $no_displayed));
if ((($sn > $bottom) && ($sn < $top)) || ($x == "1") || ($x == $number_of_pages))
{
if ($sn ne $start_number)
{
print qq~
$x
~;
}
else
{
print qq~
$x
~;
} # end else
}
} # end for
print qq~
]
~;
} # end show menu
############
sub view_dateprefs
{
&seek_cook;
open(USER_FILE,"$user_date_file");
@date_data = ;
close(USER_FILE);
foreach $row (@date_data)
{
(@datefields = split (/\,/, $row)) if ($row =~ /date/);
(@spacefields = split (/\,/, $row)) if ($row =~ /space/);
(@hours_offset = split (/\,/, $row)) if ($row =~ /hours/);
}
($date0,$date1,$date2,$date3,$date4,$date5,$date6,$date7,$date8) = @datefields;
($space0,$space1,$space2,$space3,$space4,$space5,$space6,$space7) = @spacefields;
($hours0,$hours_offset,,,,,,) = @hours_offset;
@ro = ("se","mi","hr","d","dd","m","mm","y","","","");
$space1 =~ s/comma/,/gi;
$space2 =~ s/comma/,/gi;
$space3 =~ s/comma/,/gi;
$space4 =~ s/comma/,/gi;
$space5 =~ s/comma/,/gi;
$space6 =~ s/comma/,/gi;
$extra_secs = ($hours_offset*60*60);
$user_time = (time + $extra_secs);
($xsec,$xmin,$xhour,$xmday,$xmon,$xyear,$xwday,$xyday,$xisdst) = localtime($user_time);
$xmonth = $months[$xmon];
$xweekday = $daylist[$xwday];
$xmonthn = $xmon +1;
$xyear = $xyear +1900;
if ($xsec < 10) { $xsec = "0$xsec"; }
if ($xmin < 10) { $xmin = "0$xmin"; }
if ($xhour < 10) { $xhour = "0$xhour"; }
if ($xmonthn < 10) { $xmonthn = "0$xmonthn"; }
@dv = ($xsec,$xmin,$xhour,$xmday,$xweekday,$xmonthn,$xmonth,$xyear,,);
$new_user_date = "$dv[$date1]" . "$space1" . "$dv[$date2]". "$space2". "$dv[$date3]" . "$space3" . "$dv[$date4]" . "$space4"
. "$dv[$date5]" . "$space5" . "$dv[$date6]" . "$space6" . "$dv[$date7]";
&content;
print qq~
$title
~;
print qq~
~;
print qq~
Active Guestbook Date Format Manager
Control Panel
Key:
y
mm
m
dd
d
hr
mi
se
= = = = = = =
=
year ($xyear)
month name ($monthlist[0]-$monthlist[11])
month number (1-12)
weekday ($daylist[0]-$daylist[6])
month day (1-31)
hour (0-24)
minute (0-60)
second (0-60)
Examples...
($daylist[$xwday] $monthlist[$xmon] $xmday $xyear $xhour:$xmin:$xsec)
($xmonthn/$xmday/$xyear)
~;
&inter_footer;
}
sub date_options
{
print qq~
y
mm
m
dd
d
hr
mi
se
~;
}
sub edit_dateprefs
{
$date1 = $FORM{'date1'};
$date2 = $FORM{'date2'};
$date3 = $FORM{'date3'};
$date4 = $FORM{'date4'};
$date5 = $FORM{'date5'};
$date6 = $FORM{'date6'};
$date7 = $FORM{'date7'};
$space1 = $FORM{'space1'};
$space2 = $FORM{'space2'};
$space3 = $FORM{'space3'};
$space4 = $FORM{'space4'};
$space5 = $FORM{'space5'};
$space6 = $FORM{'space6'};
$space1 =~ s/\,/comma/gi;
$space2 =~ s/\,/comma/gi;
$space3 =~ s/\,/comma/gi;
$space4 =~ s/\,/comma/gi;
$space5 =~ s/\,/comma/gi;
$space6 =~ s/\,/comma/gi;
$hours_offset = $FORM{'hours_offset'};
if (($space1 =~ /\|/) || ($space2 =~ /\|/) || ($space3 =~ /\|/) || ($space4 =~ /\|/) || ($space5 =~ /\|/) || ($space6 =~
/\|/) )
{
&basic_header;
print qq~
$title
You can not use a pipe "|" character in a date format. Please go back and edit .
~;
exit;
}
if (($date1 eq "8") && ($date2 eq "8") && ($date3 eq "8") && ($date4 eq "8") && ($date5 eq "8") && ($date6 eq "8") && ($date7
eq "8"))
{
&basic_header;
print qq~
$title
You didn't select a valid date format. Please go back and edit .
~;
exit;
}
open(UPDATE,">$user_date_file");
print UPDATE "date,$date1,$date2,$date3,$date4,$date5,$date6,$date7,,\n";
print UPDATE "space,$space1,$space2,$space3,$space4,$space5,$space6,,\n";
print UPDATE "hours,$hours_offset,,,,,,,\n";
close(UPDATE);
&content;
print qq~ ~;
&main_headerb;
print qq~
Active Guestbook Date Format Manager
Date format updated.
~;
&inter_footer;
}
sub convert_dates
{
open(USER_FILE,"$user_date_file");
@date_data = ;
close(USER_FILE);
foreach $row (@date_data)
{
(@datefields = split (/\,/, $row)) if ($row =~ /date/);
(@spacefields = split (/\,/, $row)) if ($row =~ /space/);
(@hours_offset = split (/\,/, $row)) if ($row =~ /hours/);
}
($date0,$date1,$date2,$date3,$date4,$date5,$date6,$date7,$date8) = @datefields;
($space0,$space1,$space2,$space3,$space4,$space5,$space6,$space7) = @spacefields;
($hours0,$hours_offset,,,,,,) = @hours_offset;
$rrr = $rrr + ($hours_offset*60*60);
($xsec,$xmin,$xhour,$xmday,$xmon,$xyear,$xwday,$xyday,$xisdst) = localtime($rrr);
$xmonth = $months[$xmon];
$xweekday = $daylist[$xwday];
$xmonthn = $xmon +1;
$xyear = $xyear +1900;
if ($xsec < 10) { $xsec = "0$xsec"; }
if ($xmin < 10) { $xmin = "0$xmin"; }
if ($xhour < 10) { $xhour = "0$xhour"; }
if ($xmonthn < 10) { $xmonthn = "0$xmonthn"; }
@dv = ($xsec,$xmin,$xhour,$xmday,$xweekday,$xmonthn,$xmonth,$xyear,,);
$space1 =~ s/comma/,/gi;
$space2 =~ s/comma/,/gi;
$space3 =~ s/comma/,/gi;
$space4 =~ s/comma/,/gi;
$space5 =~ s/comma/,/gi;
$space6 =~ s/comma/,/gi;
$condate = "$dv[$date1]" . "$space1" . "$dv[$date2]". "$space2". "$dv[$date3]" . "$space3" . "$dv[$date4]" . "$space4" .
"$dv[$date5]" . "$space5" . "$dv[$date6]" . "$space6" . "$dv[$date7]";
}
sub date_mod
{
if (($fields[3] > 101352702) && ($fields[3] < 999999999101352702))
{
$rrr = $fields[3];
&convert_dates;
}
else
{
$condate = $fields[3];
}
}
Please get in touch with any comments or reactions to my site.