#!/usr/bin/perl
# Bookmarks: 0,10915 0,604 0,7049 0,8109 0,12472 0,12472 0,0 0,0 0,12472
$| = 1;
$varurl = time;
$mainbak = "#e5e5e5"; $titlebak = "#669999"; $bordoutline = "#444444";
$cptitlefont = " ";
use CGI qw(:all);
use CGI::Carp qw/fatalsToBrowser/;
use Time::Local;
use File::Find;
for (param()) { $FORM{$_} = param($_); }
$book = $FORM{'book'};
if ($FORM{'action'} eq "cpfromchild"){
$book = "";
$FORM{'action'} = "control_panel";
}
if ($book eq ""){
$cptext = "(MASTER)";
}
else{
$cptext = "($book)";
}
$cooknamelocal = $book;
$cooknamelocal = "activehh" if ($cooknamelocal eq "" );
while (( $name, $value) = each %FORM){
if ($name =~ /gdate/){
@datevalues = split(/\_/, $name);
$DVS{$datevalues[1]} = $value;
}
if ($name =~ /mtloading/){
$ert = $name;
$ert =~ s/mtloading//gi;
push (@listofsearchcriteria, $ert);
}
if ($FORM{'action'} eq "edit_field_details"){
$value =~ s/\|/PIPEPIPE/gi;
$FORM{$name} = $value;
}
$FORM{'24'} = $FORM{'b24'};
$FORM{'57'} = $FORM{'b57'};
}
if ($FORM{'action'} eq "edit_page_layout"){
$FORM{'7'} = $FORM{'b7'};
}
$new12 = "existing" . "10000005" ;
$cgifont = "";
$cgifont2 = "";
$cgifont3 = "";
$cgifont4 = "";
$use_absolute_reference = "no";
$urladdress = "http://www.energyflow.tv/cgi/pb/powerbook.cgi";
%FARRARY = ('10000001', '1', '10000002', '2', '10000003', '5', '10000004', '4', '10000005', '11',
'10000006', '17', '10000007', '18', '10000008', '19', '10000009', '20', '10000010',
'21', '10000011', '22', '10000012', '23',
'10000013', '24', '10000014', '25', '10000015',
'26', '10000016', '27', '10000017', '28', '10000018', '29', '10000019', '30', '10000020', '31'
);
%COLARRARY = (
'eeeeee' => 'Active Grey', '70db93' => 'Aquamarine', '000000' => 'Black', '0000ff' => 'Blue', 'a62a2a' => 'Brown',
'b87333' => 'Copper', 'ff7f00' => 'Coral', '00ffff' => 'Cyan', '871f78' => 'Dark Purple', '97694f' => 'Dark Tan',
'238e23' => 'Forest Green', 'cd7f32' => 'Gold', '00ff00' => 'Green', 'a8a8a8' => 'Grey', '9f9f5f' => 'Khaki',
'808000' => 'Light Copper', 'cccccc' => 'Light Grey', 'ffffcc' => 'Light Yellow', '32cd32' => 'Lime Green',
'ff00ff' => 'Magenta', '8e236b' => 'Maroon', '2f2f4f' => 'Midnight Blue', '000080' => 'Navy Blue',
'ff7f00' => 'Orange', '8fbc8f' => 'Pale Green', 'bc8f8f' => 'Pink', 'ff0000' => 'Red', 'e6e8fa' => 'Silver',
'3299cc' => 'Sky Blue', 'cc3299' => 'Violet', 'ffffff' => 'White', 'ffff00' => 'Yellow'
);
$sinday = 60*60*24;
$countingup = 0;
if ($use_absolute_reference eq "no"){
$guesturl = "$ENV{'SCRIPT_NAME'}";
$guestroot = "$ENV{'HTTP_HOST'}";
$fullguest = "$guestroot" . "$guesturl" . "?book=$book";
}
else{
$guesturl = $urladdress;
}
$demo="off";
$algo = "";
$version = "10000000";
$version2 = "10000000a";
$bversion = "1.3.2";
$cookiedata = $ENV{'HTTP_COOKIE'};
@cookies = split(/;/,$cookiedata );
$blcook = "$book" . "lcook";
foreach $i (@cookies){
($name,$cid) = split(/=/,$i);
if (($name =~ /actabuse/) || ($name =~ /$cooknamelocal/) ||($name =~ /actiuse/) ||($name =~ /$blcook/) ){
$name =~ s/\s+//gi;
}
$COOK{$name} = $cid;
}
while ((my $n, my $v) = each %COOK){
if ($n =~ /^$blcook/){
push (@deadlines, $n);
}
}
$newaction = param('newaction');
$server_names = "./active_powerbook_files/activeserver.txt";
open(SERFILE,"$server_names"); #needs to run here to check if valid
@serverdata = ;
close(SERFILE);
foreach $row (@serverdata)
{
@serverfields = split (/\|/, $row);
$SERVCOL{$serverfields[1]} = $serverfields[5];
$SERVLANG{$serverfields[1]} = $serverfields[6];
$SERVPREF{$serverfields[1]} = $serverfields[7];
$SERVDATE{$serverfields[1]} = $serverfields[8];
$SERVMENU{$serverfields[1]} = $serverfields[9];
$SERVACCESS{$serverfields[1]} = $serverfields[10];
$SERVFIELD{$serverfields[1]} = $serverfields[11];
$SERVLAYOUT{$serverfields[1]} = $serverfields[12];
$SERVDATA{$serverfields[1]} = $serverfields[13];
$SERVCPLINK{$serverfields[1]} = $serverfields[14];
$SERVMANAGEMESSAGESONLY{$serverfields[1]} = $serverfields[15];
}
if ($book ne ""){
$authorized = "no";
foreach $row (@serverdata){
@serverfields = split (/\|/, $row);
if (($book eq $serverfields[1]) && ($serverfields[2] eq "Active")){
($mastercol, $masterlang, $masterpref, $masterdate, $mastermenu, $masteraccess,
$masterfield, $masterlayout, $masterdata, $mastercplink, $mastermanagemessagesonly) =
($serverfields[5], $serverfields[6], $serverfields[7], $serverfields[8],
$serverfields[9], $serverfields[10], $serverfields[11], $serverfields[12], $serverfields[13], $serverfields[14], $serverfields[15] );
$authorized = "yes";
last;
}
}
if ($authorized eq "no"){
&content;
print qq~ Requested PowerBook is either Inactive or does not exist. ~;
exit;
}
}
&subdirectory;
@lets = qw(a s e r g j u l v n);
# $salt = "k4"; # to help crypt
# $enc = crypt(active, $salt); # set default password
if (-e "$location_of_lock_file"){
($dev1, $ino1, $mode1, $nlink1, $uid1, $gid1, $rdev1,
$size1, $atime1, $mtime1, $ctime1, $blksize1, $blocks1) = stat "$location_of_lock_file";
if (($varurl - $ctime1) > 60){
unlink ("$location_of_lock_file");
}
}
unless (-e "$powerbook_data_name"){
@months = ("January","February","March","April","May","June","July","August","September","October","November","December");
&GetDate;
$now = &amqdate($messagedate);
}
$servepass = $FORM{'servepass'};
&startup;
&open_prefs;
open(USER_FILE,"$field_names");
@fnamedata = ;
close(USER_FILE);
foreach $fnrow (@fnamedata){
@fnamefields = split (/\|/, $fnrow);
$FTYPES{$fnamefields[12]} = $fnamefields[2] ;
}
&mygmtime;
$no_of_blocked = 0;
$found_blocked_computer = "no";
foreach $bloc (@thoseblocked){
$no_of_blocked++;
@fieldsb = split (/\|/, $bloc);
$cookname = $fieldsb[1];
$BLOCKED_MESSAGES{$fieldsb[0]} = $fieldsb[2];
if ($COOK{$cookname} eq $fieldsb[2] ){
$found_blocked_computer = "yes";
}
}
if ( $found_blocked_computer eq "yes"){
&content;
print qq~ The requested file was not found. ~;
exit;
}
&GetDate;
&check_values;
$now = &amqdate($messagedate);
&check_update;
&check_new_files;
$alignment_default = "center";
$alignment = "center" if ($alignment eq "");
$action = $FORM{'action'};
$no_displayed = 100000000000000 if (($action eq "view_to_undo") ||($action eq "view_to_edit") );
open(PERM_FILE,"$perms");
$permvalue = ;
close(PERM_FILE);
open(USER_FILE,"$access_name");
@access_data = ;
close(USER_FILE);
open(PERM_FILE,"$singleperms");
$singlepermvalue = ;
close(PERM_FILE);
$whichusers = "all" if ($permvalue eq "0");
$whichusers = "single password" if ($permvalue eq "1");
$whichusers = "multiple passwords" if ($permvalue eq "2");
$whichusers = "webmaster" if ($permvalue eq "3");
&read_menus;
$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 = "";
#$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~ $cgifont2 $title
$cgifont $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;
sub load_data_and_count {
open(USER_FILE,"$powerbook_data_name") || &oops('$powerbook_data_name');
@datalist = ();
@data = ();
@data = ;
close(USER_FILE);
&open_field_data;
foreach $row (@data) {
@fields = split (/\|/, $row);
if ($action eq "view_to_edit"){
unless ($fields[10] eq "del"){ # only use displayable messages
if ($fields[33]){ # if this is a response
$FUPS{$fields[33]} = "yes"; # add field33 to the FUPS hash as yes
if ($fields[15] eq "waiting"){
$NEEDAPPR{$fields[33]} = "yes";
}
$numm = "$fields[33]" . "R" . "$fields[0]"; # create a string with both the original message ref (33) and the response ref (0)
$FUPPS{$numm} = $row; # and then add it to the FUPPS hash with a value of the full row
}
else{
push (@datalist, $row); # not a response (and displayable) so go for it
}
}
}
elsif ($action ne "view_to_undo"){
unless (($fields[10] eq "del") || ($fields[15] eq "waiting") || ($fields[16] eq "yes")){ # only use displayable messages
if ($fields[33]){ # if this is a response
$FUPS{$fields[33]} = "yes"; # add field33 to the FUPS hash as yes
$numm = "$fields[33]" . "R" . "$fields[0]"; # create a string with both the original message ref (33) and the response ref (0)
$FUPPS{$numm} = $row; # and then add it to the FUPPS hash with a value of the full row
}
else{
push (@datalist, $row); # not a response (and displayable) so go for it
}
} # end unless
}
else {# must be view to undo
if ($fields[10] eq "del"){
push (@datalist, $row);
$MAINDEL{$fields[0]} = "yes"; # tells us if main message is deleted
}
}
}
$number_of_messages = @datalist;
}
sub read{
if (($action eq "view_to_edit") || ($action eq "view_to_undo")){
&seek_cook;
if ($masterdata eq "yes"){
&content;
print qq~ These settings are currently controlled by the Master Control Panel.
Back ~;
exit;
}
}
&load_data_and_count;
$count = 1;
$grouped = 0;
$no_displayed = int($no_displayed);
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;
$fieldtosortbynew = 3 if ($fieldtosortbynew eq "");
$ordertosortbynew = "reverse" if ($ordertosortbynew eq "");
if (($action eq "view_to_edit") || ($action eq "view_to_undo") ){ $fieldtosortbynew = 3; }
foreach $lrow (@datalist){
@lrow = split (/\|/, $lrow);
$sortable_field = $lrow[$fieldtosortbynew];
if (($fieldtosortbynew == 3) && ($sortable_field < 1000000000)){ # sort dates prior to 2000 or so
$sortable_field = "0" . $sortable_field;
}
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);
}
if ($ordertosortbynew ne "normal"){
@data_ordered = reverse(@data_ordered);
}
else{
@data_ordered = reverse(@data_ordered) if (($action eq "view_to_edit") || ($action eq "view_to_undo")) ;
}
if ($action eq "view_to_edit"){
&followhead; # header for editing followup messages
}
elsif ($action eq "view_to_undo"){
&basic_header;
print qq~
~;
}
else ## main view page html starts
{
&content;
&main_header;
&user_html if $use_user_html eq "yes";
print qq~ ~; # sets the alignment of the main page
}
# start of table to hold book
print qq~
~;
if ( ($action ne "view_followup_edit")){
$countingup = $start_number;
$pagetype = "MAIN";
$pagetype = "EDIT" if ($action eq "view_to_edit");
&load_page;
}
print qq~
~;
print qq~
~;
&user_html_footer if (($use_user_html_footer eq "yes") && ($action ne "view_to_edit") &&($action ne "view_to_undo"));
print qq~
~;
&get_file_lock($location_of_lock_file);
open(NUMBER,"$viewed") || &oops('$viewed');
$num = ;
close(NUMBER);
$plus = $num+1;
open (NUMBER,">$viewed");
flock(FILE,2);
print NUMBER "$plus";
close(NUMBER);
&release_file_lock($location_of_lock_file);
# print qq~ $plus ~;
&inter_footer;
}
sub temp_passstuff
{
if ($whichusers eq "single password"){
unless ($singlepermvalue eq $FORM{'useraccess_pass'}){
&content;
print "Incorrect password";
exit;
}
}
if ($whichusers eq "multiple passwords"){
&content;
$founduser = "no";
foreach $row3(@access_data) {
@userdata = split(/\|/,$row3);
if (($userdata[2] eq "$FORM{'useraccess_pass'}") && ($userdata[4] eq "$FORM{'sername'}") ){
$founduser = "yes";
}
}
unless ($founduser eq "yes"){
&content;
print "Incorrect password and/or username";
exit;
}
}
}
sub write{
$oops = "no";
&seek_cook if ($whichusers eq "webmaster");
unless ($okay = "yes"){
if (($whichusers eq "multiple passwords") || ($whichusers eq "single password")){
unless ($COOK{'actiuse'} eq "ok"){
&content;
print qq~
~;
exit;
}
}
}
$page_after_write =~ s/\s+//gi;
$page_after_write = "$guesturl?book=$book&action=reload&vat=$varurl"if (($page_after_write eq "") ||($page_after_write eq "http://") );
if ($anti_spam eq "on"){
$multiple_ip = "no";
open(USER_FILE,"$powerbook_data_name") || &oops('$powerbook_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 PowerBook $cgifont $TXT_has_been_added
~;
&inter_footer;
exit;
}
}
# check for blocked IP
if ($ipoops eq "yes"){
&basic_header;
print qq~
$cgifont2 $title$cgifont
$TXT_blocked_IP ~;
exit;
}
open(USER_FILE,"$field_names");
@data = ;
close(USER_FILE);
foreach $row (@data){
@fields = split (/\|/, $row);
$FIELDNAMES{$fields[12]} = $fields[1];
$FIELDTYPES{$fields[12]} = $fields[2];
$FIELDADDSORT{$fields[12]} = $fields[36];
}
foreach $row (@data){
@fields = split (/\|/, $row);
next if ($fields[21] ne "yes");
$detail = param($fields[12]); #################
if ($fields[2] eq "TABLE"){
$detail = "";
$query = new CGI;
@detailsarray = $query->param($fields[12]);
foreach (@detailsarray)
{
$detail .= "$_/";
}
}
$detail =~ s/\|/PIPEPIPE/g;
if (($fields[20] eq "yes") && ($detail eq "")){
&responses($TXT_please_fill_in, 'none', 'yes') ;
exit;
}
$detail =~ s/\r\n/ /g; $detail =~ s/\r/ /g; $detail =~ s/\n/ /g; $detail =~ s/\s+/ /g;
if ($fields[2] eq "EMAIL"){
$detail =~ s/\s+//g;
&check_address_for_mistakes if $detail ne "";
}
elsif ($fields[2] eq "URL"){
$detail =~ s/http\:\/\///i;
}
$leftarrow = $rightarrow = 0;
@chars = split(//,$detail);
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;
}
# unless ($action eq "change2"){
$detail =~ s/ /-BREAKS-/gi if $allow_html eq "no";
$detail =~ s/<([^>]|\n)*>//g if $allow_html eq "no"; ## removes html but leaves the breaks
$detail =~ s/-BREAKS-/ /gi if $allow_html eq "no";
# }
@nwords = @words;
foreach $ohdear (@nwords){
if (($ohdear =~ /^\*/) && ($ohdear =~ /\*$/)){
$ohdear =~ s/\*//gi;
if ($detail =~ /$ohdear/i){
$oops = "yes"; last;
}
}
elsif ($ohdear =~ /\*$/){
$ohdear =~ s/\*//gi;
if ($detail =~ /\b$ohdear/i){
$oops = "yes"; last;
}
}
elsif ($ohdear =~ /^\*/) {
$ohdear =~ s/\*//gi;
if ($detail =~ /$ohdear\b/i){
$oops = "yes"; last;
}
}
else {
if ($detail =~ /\b$ohdear\b/i) {
$oops = "yes"; last;
}
}
} # end foreach $ohdear
if ($oops eq "yes"){
&responses($TXT_disallowed_word, 'none', 'yes') ;
exit;
}
$number_of_words = @words_in_message = split(/ /,$detail);
$number_of_chars = @chars_in_message = split(//,$detail);
if (($number_of_words > $max_length) && ($fields[2] ne "IMAGE")&& ($fields[2] ne "FILE") && ($fields[2] ne "TABLE") ){
&responses($TXT_too_many_words, 'none', 'yes') ;
exit;
}
if (($fields[2] eq "EMAIL") && ($fields[45] eq "yes") && ($detail)){
push(@listofemails, $fields[12]);
$THANKEMAIL{$fields[12]} = $detail;
$THANKSUBJECT{$fields[12]} = $fields[46];
$THANKTEXT{$fields[12]} = $fields[47];
$INCLUDEDFIELDS{$fields[12]} = $fields[52];
}
if (((($allow_html eq "yes") && ($detail !~ /)) || ($allow_html ne "yes")) && ($fields[2] eq "TEXTAREA") ){
$new_message = "";
$max_chars_per_line = 2 if ($max_chars_per_line < 2);
while ($max_chars_per_line % 2 == 1)
{
$max_chars_per_line++;
}
foreach $individual_word (@words_in_message){
$length_of_this_word = length($individual_word);
if ($length_of_this_word > $max_chars_per_line){
$newm = "";
@individual_letters = split(//,$individual_word);
$rrr = @individual_letters;
for (my $x = 0; $x < $rrr; $x++){
if ($x % $max_chars_per_line == ($max_chars_per_line-1)){
$newm .= "$individual_letters[$x] ";
}
else
{
$newm .= "$individual_letters[$x]";
}
}
$new_message = $new_message . " " . $newm;
}
else{
$new_message = $new_message . " " . $individual_word;
}
} # end for each word
$detail = $new_message;
} # unless limit
$detail =~ s/^\s//;
&handle_files;
$FIELDDB{$fields[12]} = $detail;
} # end of field names
$private_message_check = param('private_message_check');
($dev, $ino, $mode, $nlink, $uid, $gid, $rdev, $size, $atime, $mtime,
$ctime, $blksize, $blocks) = stat ($fullfile);
##### block multiple posts must happen after write
$multiple_post = "no";
open(USER_FILE,"$powerbook_data_name") || &oops('$powerbook_data_name');
@data = ;
close(USER_FILE);
$ck = time;
$cooooo = $ENV{'REMOTE_ADDR'};
print "Set-Cookie:actabuse$book$ck=$cooooo;expires=$expdate\n";
&get_file_lock($location_of_lock_file);
open(NUMBER,"$counter_name") || &oops('$counter_name');
$num = ;
close(NUMBER);
$plus = $num+1;
if ($num < 2000){ # counter has been corrupted
&set_counter;
}
open (NUMBER,">$counter_name");
print NUMBER "$plus";
close(NUMBER);
$latestmesscook = "$blcook" . "$plus";
print "Set-Cookie:$latestmesscook=$plus;expires=$expdate2\n";
$ref= param('ref');
$res = "";
$res = $ref if ($action eq "add_followup2");
open(DATABASE,">>$powerbook_data_name");
$moder = "waiting" if ($moderated eq "yes");
print DATABASE "$plus|$FIELDDB{'10000001'}|$FIELDDB{'10000002'}|$time_in_seconds|$FIELDDB{'10000004'}|$FIELDDB{'10000003'}||$ENV{'REMOTE_ADDR'}|$now|$revdate||$FIELDDB{'10000005'}||||$moder|$private_message_check|$FIELDDB{'10000006'}|$FIELDDB{'10000007'}|$FIELDDB{'10000008'}|$FIELDDB{'10000009'}|";
print DATABASE "$FIELDDB{'10000010'}|$FIELDDB{'10000011'}|$FIELDDB{'10000012'}|$FIELDDB{'10000013'}|$FIELDDB{'10000014'}|$FIELDDB{'10000015'}|$FIELDDB{'10000016'}|$FIELDDB{'10000017'}|$FIELDDB{'10000018'}|$FIELDDB{'10000019'}|$FIELDDB{'10000020'}||$res|||||||$ck|$cooooo|\n";
close(DATABASE);
&backup_to_dir;
&release_file_lock($location_of_lock_file);
my $sendactiveadminemail = "no"; my $sendactiveguestemail = "no";
if ($send_email_to_admin eq "on"){
if ($private_message_check eq "yes"){
$mailbody = "You have a new PRIVATE message in your PowerBook. \n\n";
$mailbody = $mailbody . "Powerbook\n - http://$fullguest\n";
$mailbody = $mailbody . "Control Panel\n - http://$fullguest\&action=control_panel\n";
}
elsif ($moderated eq "yes"){
$mailbody = "You have a new message in your PowerBook which requires your approval. You can view this message in the Message Manager section of the Active PowerBook Control Panel.\n\n";
$mailbody = $mailbody . "Powerbook\n - http://$fullguest\n";
$mailbody = $mailbody . "Control Panel\n - http://$fullguest\&action=control_panel\n";
}
else{
$mailbody = "You have a new message in your PowerBook\n\n";
$mailbody = $mailbody . "Powerbook\n - http://$fullguest\n";
$mailbody = $mailbody . "Control Panel\n - http://$fullguest\&action=control_panel\n";
}
if ($use_active_email eq "no"){
&sndml($admin_email, 'Active PowerBook message', $mailbody) ;
}
else{ # use active-scripts.net
$sendactiveadminemail = "yes";
}
}
open(USER_FILE,"$field_names");
@ffdata = ;
close(USER_FILE);
$newimage_dir_url =$image_dir_url;
$newimage_dir_url =~ s/http:\/\///gi;
foreach $ffrow (@ffdata){
@fffields = split (/\|/, $ffrow);
next if (($fffields[21] ne "yes") || ($fffields[2] eq "ADD RESPONSE")||($fffields[2] eq "EDIT")
||($fffields[2] eq "VIEW RESPONSES")||($fffields[2] eq "PRIVATE_OPTION")) ;
next if $FIELDDB{$fffields[12]} eq "";
$fftbit = "";
$fftbit = "http://$newimage_dir_url" if (($FIELDTYPES{$fffields[12]} eq "IMAGE") ||($FIELDTYPES{$fffields[12]} eq "FILE") );
$otheremailbody = $otheremailbody . "\n" . "$FIELDNAMES{$fffields[12]} - ". "$fftbit" . "$FIELDDB{$fffields[12]}";
}
$otheremailbody =~ s/ /\n/gi;
@other_emails = split(/\|/, $other_emails);
$subbs = "Active Powerbook Message.";
foreach $othem(@other_emails){
&sndml($othem, $subbs, $otheremailbody) ;
}
$listofemails = @listofemails;
if ($listofemails > 0){
if ($use_active_email ne "yes"){
foreach $recip (@listofemails){
$emailbody = $THANKTEXT{$recip};
$emailbody =~ s/RESPRESP/\n/gi;
$extrainfo = "";
if ($INCLUDEDFIELDS{$recip} ne ""){
$extrainfo = $INCLUDEDFIELDS{$recip};
@extravalues = split(/\//, $extrainfo);
for (@extravalues){
$TEMPHASH{$_} = $FIELDADDSORT{$_};
}
@keyswd = sort{$TEMPHASH{$a} cmp $TEMPHASH{$b}} keys %TEMPHASH;
for (@keyswd){
$fftbit = "";
$fftbit = "http://$image_dir_url" if (($FIELDTYPES{$_} eq "IMAGE") ||($FIELDTYPES{$_} eq "FILE") );
$emailbody = $emailbody . "\n" . "$FIELDNAMES{$_} - ". "$fftbit" . "$FIELDDB{$_}";
}
}
&sndml($THANKEMAIL{$recip}, $THANKSUBJECT{$recip}, $emailbody) ;
}
}
else {
$sendactiveguestemail = "yes";
}
}
if (($sendactiveadminemail eq "yes")||($sendactiveguestemail eq "yes") ){
&content;
print qq~
~;
exit;
}
##################
if ($FORM{'moveme'}){
&skipthanks;
}
else{
&thanks;
}
}
sub handle_files {
if ((($fields[2] eq "IMAGE") || ($fields[2] eq "FILE") )&& ($detail)){
$detail =~ s/\s/_/gi;
@orignames = split (/\\/, $detail);
@orignames = reverse(@orignames);
$origname = lc($orignames[0]);
my $revname = reverse($origname);
@tags = split (/\./, $revname);
$tag = reverse($tags[0]);
$found_tag = "no";
$alltags = $fields[44];
$alltags = "jpg gif" if (($alltags eq "") && ($fields[2] eq "IMAGE"));
$alltags = "doc xls" if (($alltags eq "") && ($fields[2] eq "FILE"));
if ($demo eq "on")
{
$alltags = "jpg gif" if ($fields[2] eq "IMAGE");
$alltags = "doc xls" if ($fields[2] eq "FILE");
}
$alltags =~ s/,/ /gi; $alltags =~ s/\./ /gi; $alltags =~ s/\"//gi; $alltags =~ s/\s+/ /gi;
@allowed_tags = split (/\s/, $alltags);
foreach $allowed_tag(@allowed_tags){
if ($tag eq $allowed_tag){
$found_tag = "yes" ;
last;
}
}
if ($found_tag eq "no"){
&responses($TXT_that_file_not_allowed, 'none', 'yes') ;
exit;
}
if ($origname =~ m,\.\.,){
&responses($TXT_no_double_dot, 'none', 'yes') ;
exit;
}
if ($origname =~ m,^\.,){
&responses($TXT_no_leading_dot, 'none', 'yes') ;
exit;
}
if (length($origname) > 50){
&responses($TXT_filename_too_long, 'none', 'yes') ;
exit;
}
if ($file !~ m,^([A-Za-z0-9\-_.]*)$,){
&responses($TXT_filename_bad, 'none', 'yes') ;
exit;
}
$image_dir_path =~ s/\/$//gi; $detail = $origname;
$dataee = param($fields[12]); $fullfile = "$image_dir_path/$detail";
$image_dir_pathtemp = "$image_dir_path/";
$g = 0;
$detail2 = $detail;
while (-e $fullfile){
$g++;
$detail2 = $g .$detail;
$fullfile = "$image_dir_path/$detail2";
}
$detail = $detail2;
$used_space = $free_space = $file_size = "";
$max_upload = $fields[39];
$max_upload = 100 if ($max_upload eq "");
$max_upload = 100 if ($demo eq "on");
$size = 0;
&find ( sub { $bsize += -s }, $image_dir_pathtemp );
$used_space = int ($bsize / 1024);
$free_space = ($max_upload_dir - $used_space);
umask 000;
open (OUTFILE, ">$fullfile");
binmode (OUTFILE);
while ($bytesread=read($dataee,$buffer,1024)) {
($fullfile =~ /cgi|pl$/) and ($buffer =~ s/\r//g);
print OUTFILE $buffer;
$file_size += 1024;
if (($file_size / 1000) > $free_space) {
close OUTFILE;
unlink ($fullfile);
&responses($TXT_file_no_space, 'none', 'yes') ;
exit;
}
if (($file_size / 1000) > $max_upload) {
close OUTFILE;
unlink ($fullfile);
&responses($TXT_file_too_large, 'none', 'yes') ;
exit;
}
}
close OUTFILE;
if (($file_size) == 0) {
unlink ($fullfile);
next;
}
}
if ($nameofexistingfileifitexists ne "") # need to delete existing file
{
$oldimagefile = "$image_dir_path/$nameofexistingfileifitexists";
if (-e $oldimagefile){
unlink($oldimagefile);
}
}
}
sub convert{
}
sub add{
if (($COOK{$cooknamelocal}) eq $active_string)
{
$logged_in_at_cp = "yes";
}
unless ($logged_in_at_cp eq "yes"){
if ($whichusers eq "webmaster"){
&seek_cook ;
}
else{
if (($whichusers eq "multiple passwords") || ($whichusers eq "single password"))
{
unless ($COOK{'actiuse'} eq "ok"){
&content;
print qq~
~;
exit;
}
}
}
} # end unless logged in
&end if ($ipoops eq "yes");
&content;
&main_header;
&user_html if $use_user_html eq "yes";
print qq~ ~;
print qq~
~; #holding table
$mtype="ADD";
$pagetype = "ADD";
$pagetype = "RESPONSE" if ($action eq "add_followup1");
&load_page;
print qq~
~;
&user_html_footer if $use_user_html_footer eq "yes";
print "\n\n";
} # end sub add
sub view_reponse1{
&content;
&main_header;
&user_html if $use_user_html eq "yes";
print qq~
~;
print qq~
~;
$mtype="RESPONSE";
$pagetype = "RESPONSE";
&load_view_response;
print qq~
~;
&user_html_footer if $use_user_html_footer eq "yes";
print "\n\n";
}
sub startup{
unless (-e "$powerbook_backups_directory"){
mkdir ($powerbook_backups_directory, 0755);
chmod(0755, "$powerbook_backups_directory");
open(BAK,">./$powerbook_backups_directory/undo_restore.bak");
chmod(0755, "./$powerbook_backups_directory/undo_restore.bak");
close(BAK);
}
unless (-e "$powerbook_files_directory"){
mkdir ($powerbook_files_directory, 0755);
chmod(0755, "$powerbook_files_directory");
}
unless (-e "$blocked_machines"){
open(BLOCKS,">$blocked_machines");
chmod(0755, "$blocked_machines");
close(BLOCKS);
}
unless (-e "$perms"){
open(PERMS,">$perms");
chmod(0755, "$perms");
print PERMS "0";
close(PERMS);
}
unless (-e "$nword"){
open(PERMS,">$nword");
chmod(0755, "$nword");
print PERMS "$varurl";
close(PERMS);
}
unless (-e "$viewed"){
open(PERMS,">$viewed");
chmod(0755, "$viewed");
print PERMS "0";
close(PERMS);
}
unless (-e "$htmlssi"){
open(PERMS,">$htmlssi");
chmod(0755, "$htmlssi");
print PERMS "$varurl";
close(PERMS);
}
unless (-e "$htmlssin"){
open(PERMS,">$htmlssin");
chmod(0755, "$htmlssin");
print PERMS "1234";
close(PERMS);
}
unless (-e "$singleperms"){
open(PERMS,">$singleperms");
chmod(0755, "$singleperms");
print PERMS "testing";
close(PERMS);
}
if ($book eq ""){
unless (-e "$server_names"){
open(PERMS,">$server_names");
chmod(0755, "$server_names");
print PERMS "100000001|testing|Active||||||||||||yes|||||||||||||||||||\n";
close(PERMS);
}
}
unless (-e "$months_name") {
open(MONTHS,">$months_name");
chmod(0755, "$months_name");
print MONTHS "January\nFebruary\nMarch\nApril\nMay\nJune\nJuly\nAugust\nSeptember\nOctober\nNovember\nDecember\n";
close(MONTHS);
}
unless (-e "$months_bak_name") {
©_file($months_name, $months_bak_name );
}
unless (-e "$days_name") {
open(DAYS,">$days_name");
chmod(0755, "$days_name");
print DAYS "Sunday\nMonday\nTuesday\nWednesday\nThursday\nFriday\nSaturday\n";
close(DAYS);
}
unless (-e "$days_bak_name") {
©_file($days_name, $days_bak_name );
}
unless (-e "$layout_name") {
open(DAYS,">$layout_name");
chmod(0755, "$layout_name");
print DAYS qq~50000001|10000001|IMAGE|yes|center|Arial|3|000000|My PowerBook|no|no|no|www.active-scripts.net/pb.jpg|There are | topics in our book.|There is | topic in our book.|Viewing messages | to |.|Viewing message|.|
hello
|yes|yes|yes|yes|yes|yes|yes|yes||||||||||||||||||||
50000012|10000002|NUMMENU|yes|center|Arial|2|blue|My PowerBook|no|no|no|www.active-scripts.net/pb.jpg|There are | topics in our book.|There is | topic in our book.|Viewing messages | to |.|Viewing message|.|Testing|yes|||||||||||||||Previous|Next|||||||||||
50000017|10000003|NONE|no|center|Arial|4|blue|TEXT|no|no|no|www.active-scripts.net/pb.jpg|There are | topics in our book.|There is | topic in our book.|Viewing messages | to |.|Viewing message|.|
hello
||||||||||||||||||||||||||||
50000011|10000004|TOTAL|yes|center|Arial|2|000000|My PowerBook|no|no|no|www.active-scripts.net/pb.jpg|There are | topics in our book.|There is | topic in our book.|Viewing messages | to |.|Viewing message|.|
hello
|yes|||||||||||||||||||||||||||
50000009|10000005|MENU|yes|center|Arial|3|000000|My PowerBook|yes|yes|yes|www.active-scripts.net/pb.jpg|There are | topics in our book.|There is | topic in our book.|Viewing messages | to |.|Viewing message|.|
hello
|yes|yes|yes|yes|yes|yes|yes|yes||||||||||||||||||||
50000013|10000006|TABLES|yes|center|Arial|3|000000|My PowerBook|yes|yes|yes|www.active-scripts.net/pb.jpg|There are | topics in our book.|There is | topic in our book.|Viewing messages | to |.|Viewing message|.|
hello
|yes|yes|yes|yes|yes|yes|yes|yes||||||||||||||||||||
50000006|10000007|TEXT|yes|center|Arial|3|red|Search Results|yes|no|no|www.active-scripts.net/pb.jpg|There are | topics in our book.|There is | topic in our book.|Viewing messages | to |.|Viewing message|.|
hello
|||||yes|||||||||||||||||||||||
50000014|10000008|NONE|no|center|Arial|3|000000|My Guestbook|no|no|no|www.active-scripts.net/pb.jpg|There are | topics in our book.|There is | topic in our book.|Viewing messages | to |.|Viewing message|.|
Please leave your mark ||||||||||||||||||||||||||||
50000010|10000009|VIEWING|yes|center|Arial|2|000000|My Guestbook|no|no|no|www.active-scripts.net/pb.jpg|There are | topics in our book.|There is | topic in our book.|Displaying topics | to |.|Displaying topic |.|
hello
|yes|||||||||||||||||||||||||||
50000005|10000010|TEXT|yes|center|Arial|2|blue|Search My Guestbook Please|yes|no|no|www.active-scripts.net/pb.jpg|There are | topics in our book.|There is | topic in our book.|Viewing messages | to |.|Viewing message|.|
hello
||||yes||||||||||||||||||||||||
50000004|10000011|TEXT|yes|center|Arial|3|blue|Login Please|yes|no|no|www.active-scripts.net/pb.jpg|There are | topics in our book.|There is | topic in our book.|Viewing messages | to |.|Viewing message|.|
hello
|||yes|||||||||||||||||||||||||
50000002|10000012|TEXT|yes|center|Arial|3|blue|Add a Message|yes|no|no|www.active-scripts.net/pb.jpg|There are | topics in our book.|There is | topic in our book.|Viewing messages | to |.|Viewing message|.|
hello
||yes||||||||||||||||||||||||||
50000003|10000013|TEXT|yes|center|Arial|3|blue|Add Response|yes|no|no|www.active-scripts.net/pb.jpg|There are | topics in our book.|There is | topic in our book.|Viewing messages | to |.|Viewing message|.|
hello
||||||yes||||||||||||||||||||||
50000015|10000014|NONE|no|right|Times|5|000000|TEXT|no|no|no|www.active-scripts.net/pb.jpg|There are | topics in our book.|There is | topic in our book.|Viewing messages | to |.|Viewing message|.|
hello
||||||||||||||||Back|Forth|||||||||||
50000007|10000015|TEXT|yes|center|Arial|3|red|Responses|yes|no|no|www.active-scripts.net/pb.jpg|There are | topics in our book.|There is | topic in our book.|You have been looking at topics | to |.|You have been looking at topic|.|
hello
|||||||yes|||||||||||||||||||||
50000008|10000016|TEXT|yes|center|Arial|3|green|Edit message|yes|yes|no|www.active-scripts.net/pb.jpg|There are | topics in our book.|There is | topic in our book.|Viewing messages | to |.|Viewing message|.|
hello
||||||||yes||||||||||||||||||||
50000016|10000017|NONE|no|center|Arial|3|green|Edit message|no|no|no|www.active-scripts.net/pb.jpg|There are | topics in our book.|There is | topic in our book.|Viewing messages | to |.|Viewing message|.|
hello
||||||||||||||||||||||||||||
50000018|10000018|NONE|no|center|Arial|3|green|Edit message|no|no|no|www.active-scripts.net/pb.jpg|There are | topics in our book.|There is | topic in our book.|Viewing messages | to |.|Viewing message|.|
hello
||||||||||||||||||||||||||||
50000019|10000019|NONE|no|center|Arial|3|green|Edit message|no|no|no|www.active-scripts.net/pb.jpg|There are | topics in our book.|There is | topic in our book.|Viewing messages | to |.|Viewing message|.|
hello
||||||||||||||||||||||||||||
50000020|10000020|NONE|no|center|Arial|3|green|Edit message|no|no|no|www.active-scripts.net/pb.jpg|There are | topics in our book.|There is | topic in our book.|Viewing messages | to |.|Viewing message|.|
hello
||||||||||||||||||||||||||||
~;
close(DAYS);
}
unless (-e "$access_name"){
open(DAYS,">$access_name");
chmod(0755, "$access_name");
print DAYS qq~1|1|donkey||support\@active-scripts.net||||||||||
2|1|monkey||sales\@active-scripts.net||||||||||
~;
close(DAYS);
}
unless (-e "$html_between_name"){
open(DAYS,">$html_between_name");
chmod(0755, "$html_between_name");
print DAYS "
\n";
close(DAYS);
}
unless (-e "$user_style_name"){
open(STYLE,">$user_style_name");
chmod(0755, "$user_style_name");
print STYLE qq~
~;
close(STYLE);
}
unless (-e "$senddate_name"){
open(UPDATE1,">$senddate_name");
chmod(0755, "$senddate_name");
print UPDATE1 "$now";
close(UPDATE1);
}
unless (-e "$gtp_backup_name"){
open(UPDATE1,">$gtp_backup_name");
chmod(0755, "$gtp_backup_name");
close(UPDATE1);
}
unless (-e "$ip_name"){
open(UPDATE3,">$ip_name");
chmod(0755, "$ip_name");
print UPDATE3 "$revdate";
close(UPDATE3);
}
unless (-e "$user_date_file"){
open(UPDATE,">$user_date_file");
chmod(0755, "$user_date_file");
print UPDATE qq~date,3,6,7,2,1,9,8,,
space, , , ,:,,,,
hours,5,,,,,,,
clock,12,am,pm,,,,,
~;
close(UPDATE);
}
unless (-e "$update_name"){
open(UPDATE,">$update_name");
chmod(0755, "$update_name");
print UPDATE "$revdate";
close(UPDATE);
}
unless (-e "$user_html_name"){
open(USER_HTML,">$user_html_name");
chmod(0755, "$user_html_name");
print USER_HTML qq~
Left column
~;
close(USER_HTML);
}
unless (-e "$user_html_footer_name"){
open(USER_HTML,">$user_html_footer_name");
chmod(0755, "$user_html_footer_name");
print USER_HTML qq~
Right column
~;
close(USER_HTML);
}
unless (-e "$user_default_html_name"){
©_file($user_html_name, $user_default_html_name );
}
unless (-e "$user_default_html_footer_name"){
©_file($user_html_footer_name, $user_default_html_footer_name );
}
unless (-e "$tempcolprefs_name"){
open(COLFILE,">$tempcolprefs_name");
chmod(0755, "$tempcolprefs_name");
print COLFILE "\n";
close(COLFILE);
}
unless (-e "$field_names"){
open(FIELDS,">>$field_names");
chmod(0755, "$field_names");
print FIELDS qq~10000001|Name|TEXT|40|60||||||||10000001|no||v|||||yes|yes|Arial|2|||||left||||||yes||10000001||||||||||||Your name||||||||||||||||||||||
10000004|Message|TEXTAREA|||40|4||||||10000002||break|v||||||yes|Arial|2|#0000ff||||left|yes||image||http://www.active-scripts.net/mail2.gif|yes||10000002||||||||||||Please leave a message||||||||||||||||||||||
10000007|Location|TEXT|40|60||||||||10000003|||h||| - |||yes|Arial|2||||yes|center||||||||10000005||||||||||||Where in the world are you?||||||||||||||||||||||
10000002|Email|EMAIL|40|||||Tim/Tom/Dog|Dog|||10000004|no||h||| PIPEPIPE |||yes|Arial|2|#ffffff||||left|yes||image|email|http://www.active-scripts.net/mail2.gif|||10000004||new|||||||yes|My PowerBook|We have received your message.RESPRESPMuch appreciated.RESPRESPRESPRESPThe TEAM.RESPRESP------|Your email address||||||||||||||||||||||
10000003|Website|URL|40|100|40|6||||||10000005|||h||| PIPEPIPE |||yes|Arial|2|||||left|yes||image|web|http://www.active-scripts.net/url2.gif|||10000003||||||||||||Your web page||||||||||||||||||||||
10000016|Field 16|TEXT|40|60||||||||10000006|||v|||||||Arial|2||||yes|right||||||||10000008||||||||||||||||||||||||||||||||||
10000005|How did you hear about us?|SELECT|||||1|Web/Newspaper/TV/Radio/Aliens/Other|Web|||10000007|||v|||How did you hear about us? -|||yes|Arial|2|#ffffcc||||left||||||||10000006||||||||||||How did you hear about us? ||||||||||||||||||||||
10000010|Field 10|TEXTAREA|40|60|20|4|1|10-15/16-20/21-25/Ancient|16-20|Yes|v|10000008|||h|no|||||no|Arial|2|#000000||||left|yes||image|link|www.active-scripts.net/mail2.gif|yes||10000011||||||||||||||||||||||||||||||||||
10000008|Webmaster Comments|TEXTAREA|40||40|3||Male/Female/Other|Other||h|10000009|||v|||Webmaster Comments - |||yes|Arial|2|#a62a2a||||left|yes||address|Another email address|http://www.active-scripts.net/url2.gif|||10000007|||||||||yes|Second response|GreatRESPRESPREally great|Webmaster Comments||yes||||||||||||||||||||
10000009|Field 9|TEXTAREA|30|||||Yes/No|Yes||h|10000010|||h||||||no|Arial|2|#9f9f5f|||yes|left|||address|Click here for file||||10000010|||100|||||doc xls||||||||||||||||||||||||||
10000006|Field 11|date|40|60|20|4|1|option1/option2/option3|option1|Yes|v|10000011|||v||||||yes|Arial|2||||yes|right|yes|no|image|link|http://www.active-scripts.net/url2.gif|||10000020||||||||||||||||||||||||||||||||||
10000017|Field 12|ADD RESPONSE||||||option1/option2/|option1||v|10000012|||v||||||yes|Arial|2|#000000||||left|||text|Add Response|http://www.active-scripts.net/smallguest.jpg|||10000019|yes|||||||||||||||||||||||||||||||||
10000018|Field 13|VIEW RESPONSES|40|60|20|4|1|option1/option2/option3|option1|Yes|v|10000013|no||h|no| | PIPEPIPE |||yes|Arial|2|#000000||||left|yes|no|text|View Responses|http://www.active-scripts.net/url2.gif|||10000018|yes|||||||||||||||||||||||||||||||||
10000014|Field 14|TEXT|40|60|20|4|1|option1/option2/option3|option1|Yes|v|10000014|||v|no||||||Arial|2|#000000||||left|yes|no|image|link|http://www.active-scripts.net/url2.gif|||10000013||||||||||||||||||||||||||||||||||
10000011|Field 11|TEXTAREA|||40|6||||||10000015|||v||||||no|Arial|2|||yes||center||||||||10000012||||||||||||||||||||||||||||||||||
10000015|Field 15|TEXT|40|60||||||||10000016|||v|||||||Arial|2|||||center||||||||10000014||||||||||||||||||||||||||||||||||
10000013|Field 13|TEXT|40|60|20|4|1|option1/option2/option3|option1|Yes|v|10000017|||v|no||||||Arial|2|#000000||||left|yes|no|image|link|http://www.active-scripts.net/url2.gif|||10000015||||||||||||||||||||||||||||||||||
10000012|Field 12|TEXT|40|60|20|4|1|option1/option2/option3|option1|Yes|v|10000018|||v|no||||||Arial|2|#000000||||left|yes|no|image|link|http://www.active-scripts.net/url2.gif|||10000016||||||||||||||||||||||||||||||||||
10000019|Field 19|EDIT|40|60|20|4|1|option1/option2/option3|option1|Yes|v|10000019|no||h|no|| PIPEPIPE |||yes|Arial|2|#000000||||left|yes|no|text|Edit Message|http://www.active-scripts.net/edit.jpg|||10000017|yes|||||||||||||||||||||||||||||||||
10000020|Field 20|PRIVATE_OPTION|40|60|20|4|1|option1/option2/option3|option1|Yes|v|10000020|no||v|no| (will not appear in PowerBook)|Keep Message Private |||yes|Times|2|#000000|no|no|no|left|yes|no|image|link|http://www.active-scripts.net/url2.gif|yes||10000009||||||||||||||||||||||||||||||||||
~;
close(FIELDS);
chmod(0755, "$field_names");
}
unless (-e "$counter_name"){
open(COUNTER,">>$counter_name");
chmod(0755, "$counter_name");
print COUNTER "2000200";
close(COUNTER);
chmod(0755, "$counter_name");
}
unless (-e "$html_between_name"){
open(COUNTER,">>$html_between_name");
chmod(0755, "$html_between_name");
print COUNTER "
";
close(COUNTER);
}
unless (-e "$menu_name"){
open(MENU,">>$menu_name");
chmod(0755, "$menu_name");
print MENU qq~ADD|LOGINYZXZXZXYLog in to add messagesYZXZXZXYwww.active-scripts.netYZXZXZXYYZXZXZXY|BACKYZXZXZXYBackYZXZXZXYYZXZXZXYYZXZXZXY|GUESTBOOKYZXZXZXYMain PowerBookYZXZXZXYYZXZXZXYYZXZXZXY|NONEYZXZXZXYLog inYZXZXZXYYZXZXZXYYZXZXZXY|SEARCHYZXZXZXYSearchYZXZXZXYYZXZXZXYYZXZXZXY|||||||Arial|2||||||||1|||1| PIPEPIPE |
SEARCH|LOGINYZXZXZXYLog in to add messagesYZXZXZXY/cgi-bin/brand/guestbook.cgi?action=addYZXZXZXYYZXZXZXY|BACKYZXZXZXYBackYZXZXZXYYZXZXZXYYZXZXZXY|GUESTBOOKYZXZXZXYPowerbookYZXZXZXYYZXZXZXYYZXZXZXY|NONEYZXZXZXYYZXZXZXYYZXZXZXYYZXZXZXY|NONEYZXZXZXYSci FiYZXZXZXYwww.scifiheaven.netYZXZXZXYYZXZXZXY|||||||Arial|2||||||||1|||1| PIPEPIPE |
SEARCHRESULTS|SEARCHYZXZXZXYSearch me againYZXZXZXY/cgi-bin/brand/guestbook.cgi?action=searchformYZXZXZXYYZXZXZXY|LOGINYZXZXZXYLog in to add messagesYZXZXZXY/cgi-bin/brand/guestbook.cgi?action=addYZXZXZXYYZXZXZXY|GUESTBOOKYZXZXZXYPowerbookYZXZXZXYwww.active-scripts.netYZXZXZXYYZXZXZXY|NONEYZXZXZXYYZXZXZXYYZXZXZXYYZXZXZXY|NONEYZXZXZXYYZXZXZXYYZXZXZXYYZXZXZXY|||||||Arial|2||||||||1|||1| PIPEPIPE |
MAIN|ADDYZXZXZXYAdd a messageYZXZXZXY/cgi-bin/brand/guestbook.cgi?action=addYZXZXZXYYZXZXZXY|USERYZXZXZXYHome PageYZXZXZXYwww.active-scripts.netYZXZXZXYYZXZXZXY|SEARCHYZXZXZXYSearchYZXZXZXY/cgi-bin/brand/guestbook.cgi?action=searchformYZXZXZXYYZXZXZXY|LOGINYZXZXZXYLog in to add messagesYZXZXZXYYZXZXZXYYZXZXZXY|NONEYZXZXZXYLogon siteYZXZXZXYwww.active-scripts.netYZXZXZXYYZXZXZXY|||||||Arial|2||||||||1|||1| PIPEPIPE |
LOGIN|NONEYZXZXZXYSearchYZXZXZXYwww.active-scripts.netYZXZXZXYYZXZXZXY|BACKYZXZXZXYBackYZXZXZXYYZXZXZXYYZXZXZXY|USERYZXZXZXYHome PageYZXZXZXYwww.active-scripts.netYZXZXZXYYZXZXZXY|GUESTBOOKYZXZXZXYPowerbookYZXZXZXYYZXZXZXYYZXZXZXY|NONEYZXZXZXYYZXZXZXYYZXZXZXYYZXZXZXY|||||||Arial|2||||||||1|||1| PIPEPIPE |
RESPONSE|LOGINYZXZXZXYLog in to add responseYZXZXZXYwww.active-scripts.netYZXZXZXYYZXZXZXY|BACKYZXZXZXYBackYZXZXZXYYZXZXZXYYZXZXZXY|GUESTBOOKYZXZXZXYPowerbookYZXZXZXYYZXZXZXYYZXZXZXY|NONEYZXZXZXYLogon siteYZXZXZXYYZXZXZXYYZXZXZXY|NONEYZXZXZXYYZXZXZXYYZXZXZXYYZXZXZXY|||||||Arial|2||||||||1|||1| PIPEPIPE |
EDIT|NONEYZXZXZXYLog inYZXZXZXYwww.active-scripts.netYZXZXZXYYZXZXZXY|BACKYZXZXZXYBackYZXZXZXYYZXZXZXYYZXZXZXY|USERYZXZXZXYHome PageYZXZXZXYwww.active-scripts.netYZXZXZXYYZXZXZXY|NONEYZXZXZXYLogon siteYZXZXZXYYZXZXZXYYZXZXZXY|NONEYZXZXZXYYZXZXZXYYZXZXZXYYZXZXZXY|||||||Arial|2||||||||1|||1| PIPEPIPE |
VIEWRESPONSE|ADDRESPONSEYZXZXZXYAdd a responseYZXZXZXYwww.active-scripts.netYZXZXZXYYZXZXZXY|BACKYZXZXZXYBackYZXZXZXYYZXZXZXYYZXZXZXY|GUESTBOOKYZXZXZXYPowerbookYZXZXZXYYZXZXZXYYZXZXZXY|LOGINYZXZXZXYLog in to add responseYZXZXZXYYZXZXZXYYZXZXZXY|NONEYZXZXZXYYZXZXZXYYZXZXZXYYZXZXZXY|||||||Arial|2||||||||1|||1| PIPEPIPE |
~;
close(MENU);
}
unless (-e "$active_name"){
open(PERMS,"$nword");
$numero = ;
close(PERMS);
@numeros = split(//, $numero);
$salt = "$lets[$numeros[8]]" . "$lets[$numeros[9]]";
$enc = crypt(active, $salt); # set default password
open(ACTIVE,">>$active_name");
chmod(0755, "$active_name");
print ACTIVE "$enc"; # SET IT
close(ACTIVE);
print "Set-Cookie:$cooknamelocal=$password\n";
}
unless (-e "$langprefs_name"){
open(PREFS,">>$langprefs_name");
chmod(0755, "$langprefs_name");
print PREFS qq~TXT_that_file_not_allowed=That file type is not allowed=
TXT_filename_bad=Bad filename=
TXT_main_language=iso-8859-1=
TXT_no_double_dot=No double dot in file name=
TXT_no_leading_dot=Can't have a dot at the start of a filename=
TXT_filename_too_long=Filename is too long=
TXT_searchall=All=
TXT_file_no_space=No more space available for files=
TXT_file_too_large=File is too big=
TXT_user_password_required=Password required=
TXT_user_email_required=Email required=
TXT_you_can_search_this_guestbook_by=You can search this PowerBook by:=
TXT_searchsearch=Search=
TXT_searchtext=Please type some text:=
TXT_required=(required)=
TXT_continue=Continue=
TXT_has_been_added=Thanks. Your message has been added to our PowerBook.=
TXT_has_been_added_moderated=Thanks. Your message has been sent to our webmaster and will be added shortly.=
TXT_has_been_added_private=Thanks. Your private message has been sent to our webmaster.=
TXT_one_match=One PowerBook message matches your search criteria.=
TXT_no_match=Sorry, no messages in our PowerBook match your search criteria.=
TXT_back=Back=
TXT_more_matches_1=There are =
TXT_more_matches_2= guestbook messages that match your search criteria.=
TXT_please_fill_in=Please fill in all required fields.=
TXT_please_go_back_and_edit=Please go back and edit=
TXT_no_dot_at_start=Email addresses don't start with dots or @ signs.=
TXT_no_www_at_start=Email addresses don't start with www. That's a web page address.=
TXT_no_squiggles_in_domain=There should not be any underlines or squiggles or hashes after the @ in your email address.=
TXT_only_one_at=There should be one (and only one) @ in your email address.=
TXT_no_dots_next=You are not allowed to have dots next to each other or next to @ sign in your email address.=
TXT_wrong_end=All email addresses end in a dot and some letters (such as .com, .net, .uk, .ac etc.).=
TXT_too_many_words=Your message is too long. Please go back and edit.=
TXT_disallowed_word=Your message contains a disallowed word. Please go back and edit.=
TXT_blocked_IP=This service is currently unavailable.=
~;
close(PREFS);
}
unless (-e "$langprefs_backup_name"){
©_file($langprefs_name, $langprefs_backup_name );
}
$pbname = $FORM{'book'};
$pbname = "Active Powerbook" if $pbname eq "";
$pbname =~ s/_/ /gi;
$pbname = uc($pbname);
unless (-e "$prefs_name"){
open(PREFS,">>$prefs_name");
chmod(0755, "$prefs_name");
print PREFS qq~hourstoedit=2=
title=$pbname=
allow_responses=yes=
active_authorisation=123abc123=
ordertosortbynew=reverse=
fieldtosortbynew=3=
other_emails==
page_after_write==
max_chars_per_line=50=
textfontface=Arial=
textfontsize=2=
marginwidth=20=
marginheight=20=
use_active_email=no=
image_dir_path==
alignment=center=
lic=4864483146=
allow_private_messages=yes=
border_size=0=
max=300000=
home_page=www.active-scripts.net=
image_dir_url=http://www.active-scripts.net/workingimages/=
max_upload_dir=100000=
order==
mail_path=/usr/lib/sendmail=
admin_email=admin\@active-scripts.net=
send_email_to_admin=off=
send_email_to_guest==
no_displayed=25=
max_length=400=
max_length_chars==
anti_spam=yes=
days_to_delete=100000=
days_to_trash=1000000=
days_to_delete_backup_files=20=
mail_admin_backups_interval=monthly=
mail_admin_backups_day=1=
mail_admin_backups_month=28=
allow_html=no=
use_own_html_between_messages=yes=
use_user_html=no=
use_user_html_footer=no=
table_width=700=
mail_backup_to_admin=no=
style=yes=
moderated=no=
bad_words=danglythings,wobblythings=
anti_ips=111.111.111.3,server.isp.com=
~;
close(PREFS);
}
unless (-e "$prefs_backup_name"){
©_file($prefs_name, $prefs_backup_name );
}
unless (-e "$userprefs_backup_name"){
©_file($prefs_name, $userprefs_backup_name );
}
unless (-e "$colprefs_name"){
open(COLPREFS,">>$colprefs_name");
chmod(0755, "$colprefs_name");
print COLPREFS qq~trans_add=no=
trans_message_header=no=
trans_message_body=no=
data_color1=#000000=
data_color2=#ff0000=
textdata_color1=#ffffff=
textdata_color2=#ffffff=
table_color1=#ffffff=
table_color2=#ffffff=
texttable_color1=#000000=
texttable_color2=#000000=
backcolor=#ffffff=
usebackgroundimage=yes=
backgroundimage=www.active-scripts.net/wood.jpg=
usebackgroundimageh1=yes=
backgroundimageh1=www.active-scripts.net/pbimages/back-04.gif=
usebackgroundimageh2=yes=
backgroundimageh2=www.active-scripts.net/pbimages/back-03.gif=
searchtext==
backgroundimagesearch==
usebackgroundimagesearch==
searchcolor==
addcolor=#ffffff=
addtext=#000000=
backgroundimageadd=www.active-scripts.net/pbimages/back-01.gif=
usebackgroundimageadd=yes=
addcolor=#ffffff=
usebackgroundimageb1=yes=
backgroundimageb1=www.active-scripts.net/pbimages/back-01.gif=
usebackgroundimageb2=yes=
backgroundimageb2=www.active-scripts.net/pbimages/back-02.gif=
link=#238e23=
vlink=#808000=
alink=#000000=
text=#000000=
~;
close(COLPREFS);
}
unless (-e "$colprefs_backup_name"){
©_file($colprefs_name, $colprefs_backup_name );
}
unless (-e "$usercolprefs_backup_name"){
©_file($colprefs_name, $usercolprefs_backup_name );
}
unless (-e "$powerbook_data_name"){
$insert = "";
if ($demo eq "on"){
$insert = "You can download Active PowerBook here .";
}
chmod(0755, "$prefs_name");
chmod(0755, "$colprefs_name");
&open_prefs;
umask 000;
open(TEMP,">>$powerbook_data_name");
print TEMP qq~2000004|Anthony|Hi, here we are|$time_in_seconds|anthony\@www.net|California|||$now|$revdate||www.www.net|||||||Web||||||||||||||||||||||$time_in_seconds||
2000005|Peter|Great|$time_in_seconds|peter\@peter.com|Peterland|||$now|$revdate||www.peter.com|||||||Newspaper||||||||||||||||||||||$time_in_seconds||
~;
print TEMP "2000006|Active Scripts |Well done. You have successfully installed Active PowerBook.
";
print TEMP "The default password is the word active in lower case.";
print TEMP "
With Active PowerBook you have full control over the appearance, fields, menus, messages etc. You can create unlimited powerbooks from a single script.";
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.
$insert You can now go to the Control Panel by clicking here.
|$time_in_seconds|anthony\@active-scripts.net|active-scripts.net|||$now|$revdate||www.active-scripts.net|||||||||||||||||||||||||||||$time_in_seconds||\n";
close(TEMP);
chmod(0755, "$powerbook_data_name");
&finish_start;
exit;
}
} # end startup
sub finish_start{
&content;
print qq~
$title
Active PowerBook Installation Manager
$cgifont Active PowerBook has been successfully installed and all support files have been generated.
Click here to enter Active PowerBook
~;
}
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 = 3;
$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);
}
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 "hourstoedit=$FORM{'hourstoedit'}=\n";
print FILE "allow_responses=$FORM{'allow_responses'}=\n";
print FILE "active_authorisation=$FORM{'active_authorisation'}=\n";
print FILE "ordertosortbynew=$FORM{'ordertosortbynew'}=\n";
print FILE "fieldtosortbynew=$FORM{'fieldtosortbynew'}=\n";
$formafterw = $FORM{'page_after_write'};
$formafterw =~ s/http:\/\///gi;
print FILE "page_after_write=$formafterw=\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 "use_active_email=$FORM{'use_active_email'}=\n";
print FILE "image_dir_path=$FORM{'image_dir_path'}=\n";
print FILE "alignment=$FORM{'alignment'}=\n";
#print FILE "lic=$FORM{'lic'}=\n";
print FILE "allow_private_messages=$FORM{'allow_private_messages'}=\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 "image_dir_url=$FORM{'image_dir_url'}=\n";
print FILE "max_upload_dir=$FORM{'max_upload_dir'}=\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 "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 "use_own_html_between_messages=$FORM{'use_own_html_between_messages'}=\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 "mail_backup_to_admin=$FORM{'mail_backup_to_admin'}=\n";
print FILE "style=$FORM{'style'}=\n";
print FILE "moderated=$FORM{'moderated'}=\n";
$FORM{'other_emails'}=~ s/\r\n/|/g;
print FILE "other_emails=$FORM{'other_emails'}=\n";
open(USER_FILE,">$user_html_name");
$ertyu = $FORM{'user_html'};
$ertyu =~ s/\r//gi;
print USER_FILE "$ertyu";
close(USER_FILE);
open(USER_FILE,">$user_html_footer_name");
$ertyu = $FORM{'user_html_footer'};
$ertyu =~ s/\r//gi;
print USER_FILE "$ertyu";
close(USER_FILE);
open(THANKS,">$html_between_name");
$ertyu = $FORM{'html_between'};
$ertyu =~ s/\r//gi;
print THANKS "$ertyu";
close(THANKS);
open(UDS,">$user_style_name");
$ertyu = $FORM{'user_style'};
$ertyu =~ s/\r//gi;
print UDS "$ertyu";
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~
~;
&inter_footer;
}
sub rest
{
unlink ("$htmlssi");
&content; print "Done"; exit;
}
sub open_prefs{
open(FILE,"$blocked_machines");
@thoseblocked = ;
close(FILE);
open(FILE,"$htmlssi");
$vartime1 = ;
$vartime2 = $vartime1;
close(FILE);
open(FILE,"$htmlssin");
$lic = ;
close(FILE);
open(PERMS,"$nword");
$numero = ;
close(PERMS);
@numeros = split(//, $numero);
$salt = "$lets[$numeros[8]]" . "$lets[$numeros[9]]";
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 = ();
$vartime1 = reverse($vartime1);
$vartime1 = $vartime1 + 7550345;
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];
}
foreach $LINE (@LINES){
@terms = split(/=/,$LINE);
$PREFS{$terms[0]} = $terms[1];
}
$TXT_filename_bad = $LANGPREFS{'TXT_filename_bad'};
$TXT_that_file_not_allowed = $LANGPREFS{'TXT_that_file_not_allowed'};
$TXT_no_double_dot = $LANGPREFS{'TXT_no_double_dot'};
$TXT_no_leading_dot = $LANGPREFS{'TXT_no_leading_dot'};
$TXT_filename_too_long = $LANGPREFS{'TXT_filename_too_long'};
$TXT_main_language = $LANGPREFS{'TXT_main_language'};
$TXT_searchall = $LANGPREFS{'TXT_searchall'};
$TXT_user_email_required = $LANGPREFS{'TXT_user_email_required'};
$TXT_user_password_required = $LANGPREFS{'TXT_user_password_required'};
$TXT_you_can_search_this_guestbook_by = $LANGPREFS{'TXT_you_can_search_this_guestbook_by'};
$TXT_searchsearch = $LANGPREFS{'TXT_searchsearch'};
$TXT_searchtext = $LANGPREFS{'TXT_searchtext'};
$TXT_required = $LANGPREFS{'TXT_required'};
$TXT_private_message = $LANGPREFS{'TXT_private_message'};
$TXT_private_message2 = $LANGPREFS{'TXT_private_message2'};
$TXT_continue = $LANGPREFS{'TXT_continue'};;
$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_file_too_large = $LANGPREFS{'TXT_file_too_large'};
$TXT_file_no_space = $LANGPREFS{'TXT_file_no_space'};
$TXT_please_go_back_and_edit = $LANGPREFS{'TXT_please_go_back_and_edit'};
$TXT_back = $LANGPREFS{'TXT_back'};
$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'};
$lang_months = $LANGPREFS{'lang_months'};
$lang_days = $LANGPREFS{'lang_days'};
$lang_daysh = (60*60*24*7);
$textfontface = $PREFS{'textfontface'};
$textfontsize = $PREFS{'textfontsize'};
$allow_responses = $PREFS{'allow_responses'};
$ordertosortbynew = $PREFS{'ordertosortbynew'};
$fieldtosortbynew = $PREFS{'fieldtosortbynew'};
$hourstoedit = $PREFS{'hourstoedit'};
$marginwidth = $PREFS{'marginwidth'};
$marginheight = $PREFS{'marginheight'};
$usertitlealignment = $PREFS{'usertitlealignment'};
$userimagealignment = $PREFS{'userimagealignment'};
$page_after_write = $PREFS{'page_after_write'};
$page_after_write =~ s/http\:\/\///gi;
$page_after_write_for_form = $page_after_write;
$page_after_write = "http://" . "$page_after_write";
$image_dir_url = $PREFS{'image_dir_url'};
$max_upload_dir = $PREFS{'max_upload_dir'};
$image_dir_path = $PREFS{'image_dir_path'};
$other_emails = $PREFS{'other_emails'};
if ($demo eq "on")
{
$max_upload_dir = 500000;
$image_dir_url = "www.active-scripts.net/powerbookdemoimages/";
$image_dir_path = "/home/fq17/active-scripts-www/powerbookdemoimages/";
}
$active_authorisation = $PREFS{'active_authorisation'};
$max_chars_per_line = $PREFS{'max_chars_per_line'};
$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'};
$use_active_email = $PREFS{'use_active_email'};
$home_page =~ s/http\:\/\///gi;
$home_page_for_form = $home_page;
$home_page_for_form = "http://" . "$page_after_write";
$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'};
$mail_path = $PREFS{'mail_path'};
$mail_path = "$mail_path" . " -t -oi";
$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'};
$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'};
$user_image = $PREFS{'user_image'};
$user_image_url = $PREFS{'user_image_url'};
$use_own_html_between_messages = $PREFS{'use_own_html_between_messages'};
$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'};
$style = $PREFS{'style'};
$trans_add = $COLPREFS{'trans_add'};
$trans_message_header = $COLPREFS{'trans_message_header'};
$trans_message_body = $COLPREFS{'trans_message_body'};
$backcolor = $COLPREFS{'backcolor'};
$usebackgroundimage = $COLPREFS{'usebackgroundimage'};
$backgroundimage = $COLPREFS{'backgroundimage'};
$backgroundimage = "http://" . "$backgroundimage";
$searchtext = $COLPREFS{'searchtext'};
$backgroundimagesearch = $COLPREFS{'backgroundimagesearch'};
$backgroundimagesearch = "http://" . "$backgroundimagesearch";
$usebackgroundimagesearch = $COLPREFS{'usebackgroundimagesearch'};
$addtext = $COLPREFS{'addtext'};
$backgroundimageadd = $COLPREFS{'backgroundimageadd'};
$backgroundimageadd = "http://" . "$backgroundimageadd";
$usebackgroundimageadd = $COLPREFS{'usebackgroundimageadd'};
$usebackgroundimageh1 = $COLPREFS{'usebackgroundimageh1'};
$backgroundimageh1 = $COLPREFS{'backgroundimageh1'};
$backgroundimageh1 = "http://" . "$backgroundimageh1";
$usebackgroundimageh2 = $COLPREFS{'usebackgroundimageh2'};
$backgroundimageh2 = $COLPREFS{'backgroundimageh2'};
$backgroundimageh2 = "http://" . "$backgroundimageh2";
$usebackgroundimageb1 = $COLPREFS{'usebackgroundimageb1'};
$backgroundimageb1 = $COLPREFS{'backgroundimageb1'};
$backgroundimageb1 = "http://" . "$backgroundimageb1";
$usebackgroundimageb2 = $COLPREFS{'usebackgroundimageb2'};
$backgroundimageb2 = $COLPREFS{'backgroundimageb2'};
$backgroundimageb2 = "http://" . "$backgroundimageb2";
$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'};
$link = $COLPREFS{'link'};
$vlink = $COLPREFS{'vlink'};
$alink = $COLPREFS{'alink'};
$text = $COLPREFS{'text'};
$searchcolor = $COLPREFS{'searchcolor'};
$addcolor = $COLPREFS{'addcolor'};
$user_html = $user_style = $user_html_footer = "";
open(FILE,"$user_html_name") || &oops("$user_html_name");
@user_html = ; $user_html=join(" ",@user_html); close(FILE);
open(FILE,"$html_between_name") || &oops("$html_between_name");
@html_between = ; $html_between=join(" ",@html_between); close(FILE);
open(FILE,"$user_style_name") || &oops('$user_style_name');
@user_style = ; $user_style=join(" ",@user_style); close(FILE);
open(FILE,"$user_html_footer_name") || &oops('$user_html_footer_name');
@user_html_footer = ; $user_html_footer=join(" ",@user_html_footer); close(FILE);
open(NUMBER,"$active_name") || &oops('$active_name');
$active_string = ;
close(NUMBER);
($max_chars_per_line = 50) if ($max_chars_per_line 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 "");
}
sub cpheader {
print qq~
~;
}
sub cpfooter{
print qq~
~;
}
sub view_prefs{
&seek_cook;
if ($mastermanagemessagesonly eq "yes"){
&content;
print qq~ Access to this section is currently restricted.
Back ~;
exit;
}
if ($masterpref eq "yes"){
&content;
print qq~ These settings are currently controlled by the Master Control Panel.
Back ~;
exit;
}
&content;
my $fblack = " $cgifont ";
my $fwhite = "";
my $rowbgcolor = "\$bordoutline";
($max_chars_per_line = 50) if ($max_chars_per_line eq "");
($marginwidth = 0) if ($marginwidth eq "");
($marginheight = 0) if ($marginheight 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 "");
print qq~
Active PowerBook $cptext Standard Preferences Manager
~;
my $minitab1 = "";
my $minitab2 = " $cgifont";
my $minitab4 = " $cgifont";
my $minitab3 = "
";
print qq~
~;
print qq~
~;
print qq~ ~;
########
&cpheader;
print qq~
$fwhiteFile uploads
$minitab1
Full path to upload directory (contact your host for details)
$minitab2
$minitab3
$minitab1
URL of upload directory
$minitab2
$minitab3
$minitab1 Maximum disk space for uploaded files (kb) $minitab2
$minitab3
~;
$tempmailpath = $mail_path; $tempmailpath =~ s/\-t\s\-oi//gi; $tempmailpath =~ s/\s+$//gi;
&cpheader;
print qq~
$fwhiteEmail info
$minitab1 Path to sendmail programme $minitab2
$minitab3
$minitab1 For those without access to sendmail Use active-scripts.net as your mail server (max 5 messages per day) $minitab2 ~;
$use_active_emailn = ""; $use_active_emaily = "";
if ($use_active_email ne "yes"){$use_active_emailn = "checked"; } else {$use_active_emaily = "checked"; }
print qq~ Yes - No
$minitab3 $minitab1 Authorisation code $minitab2
$minitab3
$minitab1 Your email address $minitab2
$minitab3
$minitab1 Send you email notification of new messages? $minitab2 ~;
$send_email_to_adminn = ""; $send_email_to_adminy = "";
if ($send_email_to_admin ne "on"){$send_email_to_adminn = "checked"; } else {$send_email_to_adminy = "checked"; }
print qq~ Yes - No
$minitab3 ~;
$other_emails =~ s/\|/\n/gi;
print qq~
$minitab1 Also send email to these addresses (one per row) $minitab2
$minitab3
~;
print qq~
~;
} # end view_prefs
###############
sub delete_item
{
&seek_cook;
&get_file_lock("$location_of_lock_file");
$ref = $FORM{'ref'};
open(USER_FILE,"$powerbook_data_name") || &oops('$powerbook_data_name');
@data = ;
close(USER_FILE);
open(USER_FILE,">$powerbook_data_name");
foreach $row (@data)
{
@fields = split (/\|/, $row);
if (($ref eq $fields[0]) || ($ref eq $fields[33]))
{
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]|$fields[31]|$fields[32]|$fields[33]|$fields[34]|$fields[35]|$fields[36]|$fields[37]|$fields[38]|$fields[39]|$fields[40]|$fields[41]|\n";
}
else
{
print USER_FILE "$row";
}
### This adds "del" to field 10 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~
~;
} # end delete_item
sub delete_all
{
&seek_cook;
&get_file_lock("$location_of_lock_file");
$ref = $FORM{'ref'};
open(USER_FILE,"$powerbook_data_name") || &oops('$powerbook_data_name');
@data = ;
close(USER_FILE);
open(USER_FILE,">$powerbook_data_name");
foreach $row (@data)
{
@fields = split (/\|/, $row);
if ($fields[10] eq "del")
{
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]|$fields[31]|$fields[32]|$fields[33]|$fields[34]|$fields[35]|$fields[36]|$fields[37]|$fields[38]|$fields[39]|$fields[40]|$fields[41]|\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;
print qq~
~;
print qq~
~;
} # end delete_all
sub trash_all
{
&seek_cook;
&get_file_lock("$location_of_lock_file");
open(USER_FILE,"$powerbook_data_name") || &oops('$powerbook_data_name');
@data = ;
close(USER_FILE);
open(USER_FILE,">$powerbook_data_name");
open(FIELDS_FILE,"$field_names");
@fielddata = ;
close(FIELDS_FILE);
foreach $row (@data)
{
@fields = split (/\|/, $row);
if ($fields[10] ne "del")
{
print USER_FILE "$row";
}
else
{
$image_dir_path =~ s/\/$//gi;
#########
foreach $fieldrow (@fielddata)
{
@fieldrows = split (/\|/, $fieldrow);
if (($fieldrows[2] eq "IMAGE") || ($fieldrows[2] eq "FILE") )
{
$numoffield = $FARRARY{$fieldrows[12]};
$name_of_file = $fields[$numoffield];
push(@imagesinthismessage, $name_of_file);
}
}
foreach $fname (@imagesinthismessage){
$fullfile = "$image_dir_path/$fname";
if (-e $fullfile)
{
unlink($fullfile);
}
}
}
}
close(USER_FILE);
&release_file_lock("$location_of_lock_file");
&content;
print qq~
~;
} # end trash all
sub undelete_item
{
&seek_cook;
$ref = $FORM{'ref'};
open(USER_FILE,"$powerbook_data_name") || &oops('$powerbook_data_name');
@data = ;
close(USER_FILE);
&get_file_lock("$location_of_lock_file");
open(USER_FILE,">$powerbook_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]|$fields[31]|$fields[32]|$fields[33]|$fields[34]|$fields[35]|$fields[36]|$fields[37]|$fields[38]|$fields[39]|$fields[40]|$fields[41]|\n";
}
}
close(USER_FILE);
&release_file_lock("$location_of_lock_file");
&content;
&main_headera;
print qq~ ~;
&main_headerb;
print qq~
~;
&inter_footer;
exit;
}
sub trash_item
{
&seek_cook;
$ref = $FORM{'ref'};
open(USER_FILE,"$powerbook_data_name") || &oops('$powerbook_data_name');
@data = ;
close(USER_FILE);
&get_file_lock("$location_of_lock_file");
open(USER_FILE,">$powerbook_data_name");
foreach $row (@data)
{
@fields = split (/\|/, $row);
if ($ref ne $fields[0])
{
print USER_FILE "$row";
}
else # just need to remove images from the image directory
{
open(FIELDS_FILE,"$field_names");
@fielddata = ;
close(FIELDS_FILE);
foreach $fieldrow (@fielddata)
{
@fieldrows = split (/\|/, $fieldrow);
if (($fieldrows[2] eq "IMAGE") || ($fieldrows[2] eq "FILE") )
{
$numoffield = $FARRARY{$fieldrows[12]};
$name_of_file = $fields[$numoffield];
push(@imagesinthismessage, $name_of_file);
}
}
}
}
close(USER_FILE);
$image_dir_path =~ s/\/$//gi;
foreach $fname (@imagesinthismessage)
{
$fullfile = "$image_dir_path/$fname";
if (-e $fullfile)
{
unlink($fullfile);
}
}
&release_file_lock("$location_of_lock_file");
&content;
&main_headera;
print qq~ ~;
&main_headerb;
print qq~
~;
&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
{
open(USER_FILE,"$powerbook_data_name"); # reset counter/refnumbers if necessary
@data = ; close(USER_FILE);
$foundlowone = "no";
foreach $row (@data)
{
@fields = split (/\|/, $row);
if ($fields[0] < 200000)
{
$foundlowone = "yes";
last;
}
}
if ($foundlowone ne "no"){
open(USER_FILE,">$powerbook_data_name");
my $y = 2015000;
foreach $row (@data)
{
$y++;
@fields = split (/\|/, $row);
print USER_FILE "$y|";
for (my $x = 1; $x < 31; $x++){
print USER_FILE "$fields[$x]|";
}
print USER_FILE "\n";
}
close(USER_FILE);
$y++;
open(USER_FILE,">$counter_name");
print USER_FILE "$y";
close(USER_FILE);
}
############# run automatic delete or trash
open(USER_FILE,"$powerbook_data_name");
@data = ;
close(USER_FILE);
open(USER_FILE,">$powerbook_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[3] < (time - ($days_to_delete*$sinday))))
{
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]|$fields[31]|$fields[32]|$fields[33]|$fields[34]|$fields[35]|$fields[36]|$fields[37]|$fields[38]|$fields[39]|$fields[40]|$fields[41]|\n";
}
else
{
print USER_FILE "$row";
}
} # end for each
close(USER_FILE);
########### automatic prune if non-deleted messages greater than max
open(USER_FILE,"$powerbook_data_name") || &oops('$powerbook_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]|$fields[31]|$fields[32]|$fields[33]|$fields[34]|$fields[35]|$fields[36]|$fields[37]|$fields[38]|$fields[39]|$fields[40]|$fields[41]|\n";
push (@arraytodisplay, $delrow);
}
$counter++;
}
@alldata = (@arraytodisplay, @deldata);
@sortedalldata = sort(@alldata);
open(USER_FILE,">$powerbook_data_name") || &oops('$powerbook_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,"$powerbook_data_name") || &oops('$powerbook_data_name');
@user_data = ;
close(USER_FILE);
$location1 = "./$powerbook_backups_directory/powerbook_backup.$revdate";
umask 000;
open(BAK,">$location1");
foreach $row (@user_data)
{
print BAK "$row";
}
close(BAK);
} # end backup to dir
sub mail_backup
{
$boook = $book;
$boook = "Master" if $book eq "";
open(USER_FILE,"$powerbook_data_name") || &oops('$powerbook_data_name');
@user_data = ;
close(USER_FILE);
$data=join("",@user_data);
if ($include_settings_in_email_backup eq "")
{
open(USER_FILE,"$counter_name");
$new_data = ;
close(USER_FILE);
$data = $data . "\n\n========\nCOUNTER\n". $new_data;
open(USER_FILE,"$prefs_name");
@new_data = ;
close(USER_FILE);
$new_data=join("",@new_data);
$data = $data . "\n\n========\nSTANDARD PREFS\n". $new_data;
open(USER_FILE,"$active_name");
@new_data = ;
close(USER_FILE);
$new_data=join("",@new_data);
$data = $data . "\n\n========\nACTIVE\n". $new_data;
open(USER_FILE,"$perms");
@new_data = ;
close(USER_FILE);
$new_data=join("",@new_data);
$data = $data . "\n\n========\nPERMS\n". $new_data;
open(USER_FILE,"$access_name");
@new_data = ;
close(USER_FILE);
$new_data=join("",@new_data);
$data = $data . "\n\n========\nACCESS\n". $new_data;
open(USER_FILE,"$singleperms");
@new_data = ;
close(USER_FILE);
$new_data=join("",@new_data);
$data = $data . "\n\n========\nSINGLEPERMS\n". $new_data;
open(USER_FILE,"$menu_name");
@new_data = ;
close(USER_FILE);
$new_data=join("",@new_data);
$data = $data . "\n\n========\nMENU\n". $new_data;
open(USER_FILE,"$layout_name");
@new_data = ;
close(USER_FILE);
$new_data=join("",@new_data);
$data = $data . "\n\n========\nLAYOUT\n". $new_data;
open(USER_FILE,"$field_names");
@new_data = ;
close(USER_FILE);
$new_data=join("",@new_data);
$data = $data . "\n\n========\nFIELDS\n". $new_data;
open(USER_FILE,"$colprefs_name");
@new_data = ;
close(USER_FILE);
$new_data=join("",@new_data);
$data = $data . "\n\n========\nCOLORS\n". $new_data;
open(USER_FILE,"$langprefs_name");
@new_data = ;
close(USER_FILE);
$new_data=join("",@new_data);
$data = $data . "\n\n========\nLANGUAGE\n". $new_data;
open(USER_FILE,"$months_name");
@new_data = ;
close(USER_FILE);
$new_data=join("",@new_data);
$data = $data . "\n\n========\nMONTHS\n". $new_data;
open(USER_FILE,"$days_name");
@new_data = ;
close(USER_FILE);
$new_data=join("",@new_data);
$data = $data . "\n\n========\nDAYS\n". $new_data;
open(USER_FILE,"$html_between_name");
@new_data = ;
close(USER_FILE);
$new_data=join("",@new_data);
$data = $data . "\n\n========\nHTMLBETWEEN\n". $new_data;
open(USER_FILE,"$user_style_name");
@new_data = ;
close(USER_FILE);
$new_data=join("",@new_data);
$data = $data . "\n\n========\nUSERSTYLE\n". $new_data;
open(USER_FILE,"$user_html_name");
@new_data = ;
close(USER_FILE);
$new_data=join("",@new_data);
$data = $data . "\n\n========\nUSERHTML\n". $new_data;
open(USER_FILE,"$user_html_footer_name");
@new_data = ;
close(USER_FILE);
$new_data=join("",@new_data);
$data = $data . "\n\n========\nUSERHTMLFOOTER\n". $new_data;
open(USER_FILE,"$user_date_file");
@new_data = ;
close(USER_FILE);
$new_data=join("",@new_data);
$data = $data . "\n\n========\nDATE\n". $new_data;
open(USER_FILE,"$senddate_name");
@new_data = ;
close(USER_FILE);
$new_data=join("",@new_data);
$data = $data . "\n\n========\nSENDDATE\n". $new_data;
open(USER_FILE,"$user_default_html_name");
@new_data = ;
close(USER_FILE);
$new_data=join("",@new_data);
$data = $data . "\n\n========\nUSERDEFAULTHTML\n". $new_data;
open(USER_FILE,"$user_default_html_footer_name");
@new_data = ;
close(USER_FILE);
$new_data=join("",@new_data);
$data = $data . "\n\n========\nUSERDEFAULTHTMLFOOTER\n". $new_data;
}
open(NUMBER2,"$senddate_name") || &oops('$senddate_name');
$senddate = ;
close(NUMBER2);
open(NUMBER1,"$senddate_name") || &oops('$senddate_name');
open (NUMBER1,">$senddate_name");
print NUMBER1 "$now";
close(NUMBER1);
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"))
{
if ($use_active_email eq "yes"){
&content;
$data =~ s/"/QQTT/gi;
print qq~
Sorry for the interruption. Processing backup at active-scripts.net... please wait a few seconds... Thank you...
~;
exit;
}
else{
$mailbody1 = "Below is a backup data file from your $boook Active PowerBook.\n\n" . "$data";
&sndml($admin_email, "Active PowerBook ($boook backup)", $mailbody1) ;
}
}
}
#####################
sub delete_old_backups
{
opendir (USERS, "./$powerbook_backups_directory") || &oops('the $powerbook_backups_directory directory');
@files = grep(/^p/,readdir(USERS));
closedir (USERS);
foreach $file (@files)
{
if (-M "./$powerbook_backups_directory/$file" > $days_to_delete_backup_files)
{
unlink("./$powerbook_backups_directory/$file");
}
}
} # End of sub delete_old_bak
#########
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 ~;
}
}
print qq~ ~;
foreach $row (@hits)
{
@fields = split (/\|/, $row);
&main_table_results;
} # end for each row
#########
print qq~ ~;
}
##############
sub view_backups
{
&seek_cook;
if ($masterdata eq "yes"){
&content;
print qq~ These settings are currently controlled by the Master Control Panel.
Back ~;
exit;
}
open(RESTORE_BACKUP,"./$powerbook_backups_directory/undo_restore.bak");
@restore_backup_data = ;
close(RESTORE_BACKUP);
opendir (USERS, "./$powerbook_backups_directory") || &oops('the backups directory');
@files = grep(/^power/,readdir(USERS));
closedir (USERS);
if (@files<1)
{
&content;
print qq~
Active PowerBook $cptext Backup Manager
Active PowerBook $cptext Backup Manager
$cgifont There are currently no backups to restore.
~;
}
else
{
&content;
print qq~
Active PowerBook $cptext Backup Manager
$cptitlefont Active PowerBook $cptext Backup Manager
$cgifont
~; &linkjump; print qq~ ~;
if (@restore_backup_data >2)
{
print qq~
- Undo last restore
~;
}
print qq~
~;
}
&inter_footer;
}
sub undo_last_restore
{
&seek_cook;
open(RESTORE_BACKUP,"./$powerbook_backups_directory/undo_restore.bak");
@restore_backup_data = ;
close(RESTORE_BACKUP);
if (@restore_backup_data <2)
{
&content;
print qq~
$title
Active PowerBook Backup Manager
$cgifont No undo available at the moment.
~;
}
open(MAIN_GUESTBOOK,">$powerbook_data_name") || &oops('$powerbook_data_name');
foreach $row (@restore_backup_data)
{
print MAIN_GUESTBOOK "$row";
}
close(MAIN_GUESTBOOK);
open(RESTORE_BACKUP,">./$powerbook_backups_directory/undo_restore.bak"); # wipe undo restore file
close(RESTORE_BACKUP);
&set_counter;
&content;
print qq~
Active PowerBook Backup Manager
$cgifont 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~
$cgifont2 $title $cgifont
You didn't select a backup to restore. Please go back and select .
~;
exit;
}
}
open(MAIN_GUESTBOOK,"$powerbook_data_name") || &oops('$powerbook_data_name');
@main_data = ;
close(MAIN_GUESTBOOK);
open(RESTORE_BACKUP,">./$powerbook_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,">$powerbook_data_name");
open(RESTORE,"./$powerbook_backups_directory/$file_to_restore") || &oops('/$powerbook_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 PowerBook Backup Manager $cgifont 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--;
$mon = $months[$month];
$day = substr($file_to_restore, -2,2);
$datestamp = "$day"."-"."$mon"."-"."$year";
print qq~
Backup date: $datestamp $cgifont
Restore this guestbook | Return to Backup Manager
~;
open(RESTORE,"./$powerbook_backups_directory/$file_to_restore");
@hits = ;
close(RESTORE);
$search_flag = "no";
print qq~ ~;
&html_search_results_plain;
print qq~
~;
}
sub active_header
{
if ($demo eq "off")
{
print qq~
~;
}
else
{
print qq~
~;
}
}
sub title
{
print qq~
$title
~;
}
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
~;
if ($thisisathankspage eq "yes")
{
$page_after_write = "$guesturl?book=$book&action=view_to_edit&vat=$varurl" if ($FORM{'moveme'});
$page_after_write = "$guesturl?book=$book&action=reload&vat=$varurl" if ($FORM{'sender'} eq "send_from_active");
print qq~ ~;
}
if ($style ne "no")
{
print qq~ $user_style ~;
}
print qq~
~; #start of body
}
########################
sub main_headera
{
print qq~
$title ~;
}
sub main_headerc
{
if ($style ne "no")
{
print qq~ $user_style ~;
}
print qq~
~;
}
sub main_headerb
{
if ($style ne "no")
{
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 main_headerd
{
print qq~
~;
}
sub content {
print "Content-type: text/html\n\n";
}
sub show_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~
~;
}
sub user_image {
if ($user_image_url)
{
print qq~
~;
}
}
sub user_html {
print qq~ $user_html ~;
}
sub user_html_footer {
print qq~ $user_html_footer~;
}
sub view_copy_prefs {
&seek_cook;
&content;
print qq~
$title
~;
&required_script;
print qq~
~;
open(SERFILE,"$server_names");
@serverdata =
;
close(SERFILE);
@serverdata = reverse(@serverdata);
print qq~
$cptitlefont Active PowerBook Settings Copy Utility
$cgifont
Master Control Panel Server Manager
~;
#&linkjump;
print qq~
Please select the source and destination. You can copy preferences from one powerbook to another. Once copied, you can then edit settings as you see fit.
~;
&inter_footer;
}
sub copy_individual_preferences {
&seek_cook;
$query = new CGI;
@prefarray = $query->param('pref');
foreach (@prefarray)
{
$FOUNDPREF{$_} ="yes";
}
if (($FORM{'source'} eq "")|| ($FORM{'destination'} eq "")|| ($FORM{'pref'} eq "") ){
&content;
print qq~ Error. You need to select a valid option in all fields.
Back ~;
exit;
}
if ($FORM{'source'} eq $FORM{'destination'}){
&content;
print qq~ Error. Source and Destination are the same.
Back ~;
exit;
}
open(SERFILE,"$server_names");
@serverdata = ;
close(SERFILE);
@serverdata = reverse(@serverdata);
foreach $row (@serverdata)
{
@serverfields = split (/\|/, $row);
$SEVF{$serverfields[0]} = $serverfields[1];
}
$asdf = $SEVF{$FORM{'source'}};
$asdf2 = $SEVF{$FORM{'destination'}};
$ssd = "$asdf" . "_active_powerbook_files";
$sdd = "$asdf2" . "_active_powerbook_files";
if ($FORM{'source'} eq "EPIGITHA89")
{
$ssd = "active_powerbook_files";
}
if ($FORM{'destination'} eq "EPIGITHA89")
{
$sdd = "active_powerbook_files";
}
$colsinsource = "./$ssd/colprefs.txt";
$colsindestination = "./$sdd/colprefs.txt";
unless ((-e "$colsinsource") && (-e "$colsindestination") ){ # checking the directory exists
&content;
print qq~ Error. The destination and/or the source powerbook does not appear to have been initialized. You must initiaize a powerbook by visiting it once.
Back ~;
exit;
}
if ($FOUNDPREF{'data'} eq "yes"){
$source8 = "./$ssd/powerbook_data.txt"; $destination8 = "./$sdd/powerbook_data.txt";
©_file($source8, $destination8 );
$source8 = "./$ssd/counter.txt"; $destination8 = "./$sdd/counter.txt";
©_file($source8, $destination8 );
}
if ($FOUNDPREF{'col'} eq "yes"){
$source8 = "./$ssd/colprefs.txt"; $destination8 = "./$sdd/colprefs.txt"; ©_file($source8, $destination8 );
}
if ($FOUNDPREF{'lang'} eq "yes"){
$source8 = "./$ssd/langprefs.txt"; $destination8 = "./$sdd/langprefs.txt"; ©_file($source8, $destination8 );
$source1 = "./$ssd/months.txt"; $destination1 = "./$sdd/months.txt";
$source2 = "./$ssd/days.txt"; $destination2 = "./$sdd/days.txt";
©_file($source1, $destination1 ); ©_file($source2, $destination2 );
}
if ($FOUNDPREF{'prefs'} eq "yes"){
$source8 = "./$ssd/prefs.txt"; $destination8 = "./$sdd/prefs.txt"; ©_file($source8, $destination8 );
$source1 = "./$ssd/html_between.txt"; $destination1 = "./$sdd/html_between.txt";
$source2 = "./$ssd/user_style.txt"; $destination2 = "./$sdd/user_style.txt";
$source3 = "./$ssd/user_html.txt"; $destination3 = "./$sdd/user_html.txt";
$source4 = "./$ssd/user_html_footer.txt"; $destination4 = "./$sdd/user_html_footer.txt";
©_file($source1, $destination1 ); ©_file($source2, $destination2 );
©_file($source3, $destination3 ); ©_file($source4, $destination4 );
}
if ($FOUNDPREF{'date'} eq "yes"){
$source8 = "./$ssd/user_date_format.txt"; $destination8 = "./$sdd/user_date_format.txt"; ©_file($source8, $destination8 );
}
if ($FOUNDPREF{'menu'} eq "yes"){
$source8 = "./$ssd/menuprefs.txt"; $destination8 = "./$sdd/menuprefs.txt"; ©_file($source8, $destination8 );
}
if ($FOUNDPREF{'perms'} eq "yes"){
$source8 = "./$ssd/perms.txt"; $destination8 = "./$sdd/perms.txt"; ©_file($source8, $destination8 );
$source1 = "./$ssd/individaccess.txt"; $destination1 = "./$sdd/individaccess.txt";
$source2 = "./$ssd/singleperms.txt"; $destination2 = "./$sdd/singleperms.txt";
©_file($source1, $destination1 ); ©_file($source2, $destination2 );
}
if ($FOUNDPREF{'fields'} eq "yes"){
$source8 = "./$ssd/field_names.txt"; $destination8 = "./$sdd/field_names.txt"; ©_file($source8, $destination8 );
}
if ($FOUNDPREF{'layout'} eq "yes"){
$source8 = "./$ssd/layout_name.txt"; $destination8 = "./$sdd/layout_name.txt"; ©_file($source8, $destination8 );
}
&content;
&main_headera;
print qq~ ~;
&main_headerd;
print qq~
Settings have been copied
~;
exit;
}
sub view_change_password {
&seek_cook;
if ($mastermanagemessagesonly eq "yes"){
&content;
print qq~ Access to this section is currently restricted.
Back ~;
exit;
}
&content;
print qq~
$title
~;
&required_script;
print qq~
~;
print qq~
$cptitlefont Active PowerBook $cptext Password Manager
$cgifont
~;
&linkjump; print qq~
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);
print "Set-Cookie:$cooknamelocal=$newpass\n";
&content;
&main_headera;
print qq~ ~;
&main_headerd;
print qq~
Change Active PowerBook Control Panel Password
Password has been changed.
~;
}
else
{
&content;
&plain_header_stop;
print qq~
Change Active PowerBook Control Panel Password
The password has NOT been changed. The two passwords you typed were not the same.
$cgifont
Control Panel | Try again
~;
}
}
sub enter_password
{
&content;
print qq~
$title
~;
print qq~
~;
}
sub view_colprefs
{
&seek_cook;
if ($mastermanagemessagesonly eq "yes"){
&content;
print qq~ Access to this section is currently restricted.
Back ~;
exit;
}
if ($mastercol eq "yes"){
&content;
print qq~ These settings are currently controlled by the Master Control Panel.
Back ~;
exit;
}
$ignore = $FORM{'ignore'};
unless ($ignore eq "yes") # only backup when you first enter view_colprefs
{
©_file($colprefs_name, $tempcolprefs_name );
}
&content;
print qq~
Active PowerBook $cptext Color/Images Manager
~;
}
sub update_ip_addresses
{
if ($ip_addresses eq $cookie_default)
{
open(USER_FILE,">$powerbook_data_name");
close(USER_FILE);
}
}
sub check_values
{
$text11 = "/gmirewop/ten.stpircs-evitca//:ptth\"=crs gmi<>\"lmth.1knilkoobrewop/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";
$text11 = "/gmirewop/ten.stpircs-evitca//:ptth\"=crs gmi<>\"lmth.2knilkoobrewop/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);
$reverse2 = "$reverse11"."$version2"."$reverse12";
}
sub edit_colprefs
{
&seek_cook;
## TEMPCOLFILE now has the last saved preferences
open(COLFILE,">$colprefs_name");
print COLFILE "trans_add=$FORM{'trans_add'}=\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 "usebackgroundimage=$FORM{'usebackgroundimage'}=\n";
print COLFILE "backgroundimage=$FORM{'backgroundimage'}=\n";
print COLFILE "usebackgroundimageh1=$FORM{'usebackgroundimageh1'}=\n";
print COLFILE "backgroundimageh1=$FORM{'backgroundimageh1'}=\n";
print COLFILE "usebackgroundimageh2=$FORM{'usebackgroundimageh2'}=\n";
print COLFILE "backgroundimageh2=$FORM{'backgroundimageh2'}=\n";
print COLFILE "searchtext=$FORM{'searchtext'}=\n";
print COLFILE "backgroundimagesearch=$FORM{'backgroundimagesearch'}=\n";
print COLFILE "usebackgroundimagesearch=$FORM{'usebackgroundimagesearch'}=\n";
print COLFILE "searchcolor=$FORM{'searchcolor'}=\n";
print COLFILE "addcolor=$FORM{'addcolor'}=\n";
print COLFILE "addtext=$FORM{'addtext'}=\n";
print COLFILE "backgroundimageadd=$FORM{'backgroundimageadd'}=\n";
print COLFILE "usebackgroundimageadd=$FORM{'usebackgroundimageadd'}=\n";
print COLFILE "addcolor=$FORM{'addcolor'}=\n";
print COLFILE "usebackgroundimageb1=$FORM{'usebackgroundimageb1'}=\n";
print COLFILE "backgroundimageb1=$FORM{'backgroundimageb1'}=\n";
print COLFILE "usebackgroundimageb2=$FORM{'usebackgroundimageb2'}=\n";
print COLFILE "backgroundimageb2=$FORM{'backgroundimageb2'}=\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";
close(COLFILE);
&content;
print qq~$title
~;
}
#################
sub edit_langprefs
{
&seek_cook;
open(PREFS,">$langprefs_name");
print PREFS "TXT_that_file_not_allowed=$FORM{'TXT_that_file_not_allowed'}=\n";
print PREFS "TXT_filename_bad=$FORM{'TXT_filename_bad'}=\n";
print PREFS "TXT_no_double_dot=$FORM{'TXT_no_double_dot'}=\n";
print PREFS "TXT_no_leading_dot=$FORM{'TXT_no_leading_dot'}=\n";
print PREFS "TXT_filename_too_long=$FORM{'TXT_filename_too_long'}=\n";
print PREFS "TXT_searchall=$FORM{'TXT_searchall'}=\n";
print PREFS "TXT_main_language=$FORM{'TXT_main_language'}=\n";
print PREFS "TXT_file_no_space=$FORM{'TXT_file_no_space'}=\n";
print PREFS "TXT_file_too_large=$FORM{'TXT_file_too_large'}=\n";
print PREFS "TXT_user_password_required=$FORM{'TXT_user_password_required'}=\n";
print PREFS "TXT_user_email_required=$FORM{'TXT_user_email_required'}=\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_you_can_search_this_guestbook_by=$FORM{'TXT_you_can_search_this_guestbook_by'}=\n";
print PREFS "TXT_searchsearch=$FORM{'TXT_searchsearch'}=\n";
print PREFS "TXT_searchtext=$FORM{'TXT_searchtext'}=\n";
print PREFS "TXT_required=$FORM{'TXT_required'}=\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_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_one_match=$FORM{'TXT_one_match'}=\n";
print PREFS "TXT_no_match=$FORM{'TXT_no_match'}=\n";
print PREFS "TXT_back=$FORM{'TXT_back'}=\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");
$ertyu = $FORM{'month_names'}; $ertyu =~ s/\r//gi;
print USER_FILE "$ertyu";
close(USER_FILE);
open(USER_FILE,">$days_name");
$ertyu = $FORM{'day_names'}; $ertyu =~ s/\r//gi;
print USER_FILE "$ertyu";
close(USER_FILE);
&content;
print qq~
$title
~;
}
sub restore_coldefaults
{
&seek_cook;
©_file($colprefs_backup_name, $colprefs_name );
&content;
print qq~
$title
~;
}
sub copy_file
{
($source, $destination) = @_;
open(SOURCE,"$source");
my $exist = "no" unless (-e "$destination");
open(DEST,">$destination");
print DEST ;
if ($exist eq "no"){
chmod(0755, "$destination");
}
close(DEST);
close(SOURCE);
}
sub restore_user_defaults
{
&seek_cook;
©_file($userprefs_backup_name, $prefs_name );
©_file($user_default_html_name, $user_html_name );
©_file($user_default_html_footer_name, $user_html_footer_name );
&content;
&main_headera;
print qq~ ~;
&main_headerb;
print qq~
$cgifont2 Active PowerBook Standard Preferences Manager
$cgifont User default preferences restored.
~;
&inter_footer;
}
sub save_user_defaults
{
&seek_cook;
©_file($prefs_name, $userprefs_backup_name );
©_file($user_html_name, $user_default_html_name );
©_file($user_html_footer_name, $user_default_html_footer_name );
&content;
&main_headera;
print qq~ ~;
&main_headerb;
print qq~
~;
&inter_footer;
}
sub restore_user_color_defaults
{
&seek_cook;
©_file($usercolprefs_backup_name, $colprefs_name );
&content;
print qq~
<$title>
~;
}
sub save_user_color_defaults
{
&seek_cook;
©_file($colprefs_name, $usercolprefs_backup_name );
$where="view_colprefs";
&inter_header;
print qq~
~;
&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;
©_file($tempcolprefs_name, $colprefs_name );
$where="view_colprefs";
&inter_header;
print qq~
$cgifont Restoring last saved color preferences.
~;
&inter_footer;
}
sub view_servers {
&seek_cook;
&content;
print qq~
Active PowerBook - Server Manager
~;
}
sub update_child_settings {
&seek_cook;
# 100000001|testing|Active||||||||||||||||||||||||||||||32|\n
open(SERFILE,"$server_names");
@serverdata = ;
close(SERFILE);
open(SERFILE,">$server_names");
foreach $row (@serverdata)
{
@serverfields = split (/\|/, $row);
for (my $x = 0; $x < 33; $x++)
{
$f = $g = "";
if ($x == 5)
{
$f = "$serverfields[0]" . "_col";
print SERFILE "$FORM{$f}|";
}
elsif ($x == 6)
{
$g = "$serverfields[0]" . "_lang";
print SERFILE "$FORM{$g}|";
}
elsif ($x == 7)
{
$h = "$serverfields[0]" . "_pref";
print SERFILE "$FORM{$h}|";
} # SERVMENU SERVACCESS SERVFIELD SERVLAYOUT
elsif ($x == 8) {
$i = "$serverfields[0]" . "_date";
print SERFILE "$FORM{$i}|";
}
elsif ($x == 9) {
$j = "$serverfields[0]" . "_menu";
print SERFILE "$FORM{$j}|";
}
elsif ($x == 10) {
$k = "$serverfields[0]" . "_access";
print SERFILE "$FORM{$k}|";
}
elsif ($x == 11) {
$l = "$serverfields[0]" . "_field";
print SERFILE "$FORM{$l}|";
}
elsif ($x == 12) {
$m = "$serverfields[0]" . "_layout";
print SERFILE "$FORM{$m}|";
}
elsif ($x == 13) {
$n = "$serverfields[0]" . "_data";
print SERFILE "$FORM{$n}|";
}
elsif ($x == 14) {
$o = "$serverfields[0]" . "_cplink";
print SERFILE "$FORM{$o}|";
}
elsif ($x == 15) {
$o = "$serverfields[0]" . "_managemessagesonly";
print SERFILE "$FORM{$o}|";
}
else
{
print SERFILE "$serverfields[$x]|";
}
}
print SERFILE "\n";
}
close(SERFILE);
&content;
print qq~
~;
exit;
}
sub create_new_book {
open(USER_FILE,"$server_names");
@serverdataa = ;
close(USER_FILE);
$name_exists = "no";
$oldno = 0;
$newbook = $FORM{'new_book'};
$newbook = lc($newbook);
$newbook =~ s/\s+/_/gi;
foreach $row (@serverdataa){
@serverdata = split(/\|/, $row);
$newno = $serverdata[0];
$oldno = $newno if ($newno > $oldno);
$name_exists = "yes" if ($newbook eq $serverdata[1]);
}
if ($name_exists eq "yes"){
&content;
print qq~ A PowerBook with the name "$newbook" already exists. Please go back and change .~;
exit;
}
if (($newbook !~ m,^([A-Za-z0-9\-_.]*)$,) || ($newbook eq "")){
&content;
print qq~ We don't like that name. Please go back and change .~;
exit;
}
open(USER_FILE,">>$server_names");
$newno++;
print USER_FILE "$newno|$newbook|Active||||||||||||yes|||||||||||||||||||\n";
close(USER_FILE);
&content;
print qq~
~;
exit;
}
sub active_inactive_server_book{
open(USER_FILE,"$server_names");
@serverdataa = ;
close(USER_FILE);
open(USER_FILE,">$server_names");
foreach $row (@serverdataa){
@serverdata = split(/\|/, $row);
# print qq~ ($FORM{'pbook'} eq $serverdata[0]) ~;
if ($FORM{'pbook'} eq $serverdata[0])
{
for ( $x = 0; $x < 33; $x++)
{
if ($x == 2)
{
if ($serverdata[2] eq "Inactive")
{
print USER_FILE "Active|";
}
else
{
print USER_FILE "Inactive|";
}
}
else
{
print USER_FILE "$serverdata[$x]|";
}
}
print USER_FILE "\n";
}
else {
print USER_FILE "$row";
}
}
close(USER_FILE);
&content;
print qq~
~;
exit;
}
sub edit_server_book{
}
sub delete_server_book{
open(USER_FILE,"$server_names");
@serverdataa = ;
close(USER_FILE);
open(USER_FILE,">$server_names");
foreach $row (@serverdataa){
@serverdata = split(/\|/, $row);
if ($FORM{'pbook'} eq $serverdata[0])
{
$bookname = $serverdata[1];
}
if ($FORM{'pbook'} ne $serverdata[0])
{
print USER_FILE "$row";
}
}
close(USER_FILE);
$backupdir = "$bookname" . "_active_powerbook_backups";
$filesdir = "$bookname" . "_active_powerbook_files";
#&content;
#print qq~ -- $backupdir = $filesdir ~;
# exit;
if (-e "$backupdir"){
opendir (USERS, "./$backupdir") || &oops(' backupdir');
@files = grep(//,readdir(USERS));
closedir (USERS);
foreach $file (@files)
{
unlink("./$backupdir/$file");
}
rmdir("$backupdir");
}
if (-e "$filesdir"){
opendir (USERS, "./$filesdir") || &oops('filesdir');
@files = grep(//,readdir(USERS));
closedir (USERS);
foreach $file (@files)
{
unlink("./$filesdir/$file");
}
rmdir("$filesdir");
}
&content;
print qq~
~;
exit;
}
sub actions
{
if ($newaction eq "no_preview"){
&write ; exit;
}
&active_inactive_server_book if ($action eq "active_inactive_server_book");
&edit_server_book if ($action eq "edit_server_book");
&delete_server_book if ($action eq "delete_server_book");
&enter_license if ($action eq "enter_license");
&update_license if ($action eq "update_license");
&mrtime if ($action eq "mrtime");
&view_copy_prefs if ($action eq "view_copy_prefs");
©_individual_preferences if ($action eq "copy_individual_preferences");
&lrgeet if ($action eq "lrgeet");
&update_child_settings if ($action eq "update_child_settings");
&create_new_book if ($action eq "create_new_book");
&view_servers if ($action eq "view_servers");
&makepubpriv if ($action eq "makepubpriv");
&guest_to_power if ($action eq "guest_to_power");
&edit_searchprefs if ($action eq "edit_searchprefs");
&thanks if ($action eq "thanks");
&update_perms if ($action eq "update_perms");
&update_single_perm if ($action eq "update_single_perm");
&view_access if ($action eq "view_access");
&disenable_user if ($action eq "enable_user");
&disenable_user if ($action eq "disable_user");
&edit_user if ($action eq "edit_user");
&delete_user if ($action eq "delete_user");
&view_to_edit_user if ($action eq "view_to_edit_user");
&view_to_add_user_from_cp if ($action eq "view_to_add_user_from_cp");
&add_user_from_cp if ($action eq "add_user_from_cp");
&userlogin if ($action eq "userlogin");
&verifyuserlogin if ($action eq "verifyuserlogin");
&logout if ($action eq "logout");
&view_page_layout if ($action eq "view_page_layout");
&view_page_layout if ($action eq "update_page_items");
&loadsearch if ($action eq "loadsearch");
&view_page_layout if ($action eq "newactive_inactive");
&view_addlayoutprefs if ($action eq "view_addlayoutprefs");
&view_to_edit_page_layout if ($action eq "view_to_edit_page_layout");
&view_request_license if ($action eq "view_request_license");
&edit_page_layout if ($action eq "edit_page_layout");
&overlayup if ($action eq "overlayup");
&overlaydown if ($action eq "overlaydown");
&rest if ($action eq "rest");
&view_searchprefs if ($action eq "view_searchprefs");
&unblockall if ($action eq "unblockall");
&searchform if ($action eq "searchform");
&add_to_active if ($action eq "add_to_active");
&delete_all if ($action eq "delete_all");
&delete_all_thread if ($action eq "delete_all_thread");
&trash_all if ($action eq "trash_all");
&view_menuprefs if ($action eq "view_menuprefs");
&edit_menuprefs if ($action eq "edit_menuprefs");
&view_layoutprefs if ($action eq "view_layoutprefs");
&view_layoutprefs if ($action eq "active_inactive");
&view_layoutprefs if ($action eq "pub_priv");
&move_up if ($action eq "move_up");
&move_down if ($action eq "move_down");
&edit_a_field if ($action eq "edit_a_field");
&view_to_edit_a_field if ($action eq "view_to_edit_a_field");
&edit_field_details if ($action eq "edit_field_details");
&already_added if ($action eq "already_added");
&unblock if ($action eq "unblock");
&block_computer if ($action eq "block_computer");
&make_first_body if ($action eq "make_first_body");
&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");
&read if ($action eq "view_to_edit");
&read2 if ($action eq "view_followup");
&read2 if ($action eq "view_followup_edit");
&add if ($action eq "cpadd_followup1");
&add if ($action eq "add_followup1");
&read 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");
&write if ($action eq "add_followup2");
&restore_language_defaults if ($action eq "restore_language_defaults");
&approve_message if ($action eq "approve_message");
&view_dateprefs if ($action eq "view_dateprefs");
}
sub demostuff {
&content;
&main_header;
&active_header;
print qq~
$cgifont Sorry. This is only a demo. That action is not enabled.Back
~;
exit;
}
sub required_script
{
print qq~
~;
}
sub responses
{
($responsemessage, $responsenextpage, $ispublic ) = @_;
&content;
print qq~
$title ~;
if ($responsenextpage ne "none"){
print qq~ ~;
}
else {
$responsenextpage = "javascript:history.go(-1)";
}
if ($style ne "no")
{
print qq~ $user_style ~;
}
print qq~
~;
print ""; #start of body
if ($ispublic eq "yes")
{
&user_html if $use_user_html eq "yes";
print qq~ ~; # sets the alignment of the main page
print qq~
~; # sets the alignment of the main page
# start of table to message
print qq~
~;
print qq~
~;
&user_html_footer if ($use_user_html_footer eq "yes");
}
}
sub thanks
{
$page_after_write =~ s/\s+//gi;
$page_after_write = "$guesturl?book=$book&action=reload&vat=$varurl" if (($page_after_write eq "") ||($page_after_write eq "http://") );
$thisisathankspage = "yes";
if (($private_message_check eq "yes") || ($FORM{'pm'} eq "yes")){
&responses($TXT_has_been_added_private, $page_after_write, 'yes') ;
}
elsif ($moderated eq "yes"){
&responses($TXT_has_been_added_moderated, $page_after_write, 'yes') ;
}
else{
&responses($TXT_has_been_added, $page_after_write, 'yes') ;
}
#if (($moderated eq "yes") && ($send_email_to_admin eq "off")){
#$mailbody = "You have a new posting to your Active PowerBook which requires your approval. You can confirm the message via the Message Manager of the Active PowerBook Control Panel.\n\n";
#&sndml($admin_email, 'PowerBook message approval required', $mailbody) ;
#}
}
sub sndml
{
($mailto, $subj, $mailtext ) = @_;
open (MAIL, "|$mail_path") || &oops('the mail program. Please check the mail path in the Control Panel.');
print MAIL "To: $mailto\n";
print MAIL "From: $admin_email\n";
print MAIL "Subject: $subj\n\n";
print MAIL "$mailtext\n\n";
print MAIL "=========================\n";
close(MAIL);
}
sub skipthanks
{
&content;
$page_after_write = "$guesturl?book=$book&action=view_to_edit&vat=$varurl" if ($FORM{'moveme'});
print qq~
~;
}
sub control_panel
{
&seek_cook;
open(USER_FILE,"$powerbook_data_name") || &oops('$powerbook_data_name');
$noss = 0;
@data =
;
close(USER_FILE);
foreach $row (@data)
{
@fields = split (/\|/, $row);
if (($fields[15] eq "waiting") && ($fields[10] ne "del"))
{
$noss++;
}
}
if ($book eq ""){
$cptext = "Master";
}
else
{
$cptext = "($book)";
}
&content;
print qq~
Active PowerBook $cptext Control Panel
~;
print qq~
~;
}
sub inter_footer
{
print qq~
~;
}
sub link
{
$link = $FORM{'link'};
&content;
if ($link ne "take_me_home")
{
print qq~
~;
}
else
{
$home_page = "http://" . "$home_page";
print qq~
~;
}
exit;
}
sub emailfield
{
print "$startbold"; print "$startitalic"; print "$startunderline"; print "$before";
if ($la[30] eq "yes")
{
$munged_address = $details;
$munged_address =~ s/\@/~AT~/g;
$munged_address =~ s/\./~DOT~/g;
$add_me = $munged_address;
}
else
{
$add_me = $details;
}
if ($la[31] eq "text")
{
$email_symbol = $la[32];
}
elsif ($la[31] eq "image")
{
$la33 = $la[33];
$la33 =~ s/http:\/\///gi;
$email_symbol = " ";
}
elsif ($la[31] eq "altfield") {
$urlaltfield = $FARRARY{$la[51]};
if ($FTYPES{$la[51]} eq "TEXT")
{
$email_symbol = "$fields[$urlaltfield]";
}
elsif ($FTYPES{$la[51]} eq "IMAGE")
{
$email_symbol = " ";
}
}
else
{
$email_symbol = $add_me;
}
if ($count ==1)
{
if( $la[29] eq "yes")
{
print qq~$prefcolor$email_symbol$postfcolor ~;
}
else
{
print qq~$prefcolor$add_me$postfcolor~;
}
}
else
{
if( $la[29] eq "yes")
{
print qq~$prefcolor$email_symbol$postfcolor ~;
}
else
{
print qq~$prefcolor$add_me$postfcolor~;
}
} #end mail
print "$after"; print "$endunderline"; print "$enditalic"; print "$endbold";
}
sub main_table_results
{
#$table_width = "100%";
$passwoor = $COOK{$cooknamelocal};
if ($passwoor eq $active_string)
{ $logged_in_cp = "yes";
}
$header_trans1 = ""; $body_trans1 = ""; $header_trans2 = ""; $body_trans2 = "";
if (($action eq "view_to_edit") || ($action eq "view_to_undo") || ($action eq "view_followup_edit"))
{
$border_size = 1; $table_width = 600; $textfontsize = 2; $textfontface = Arial;
($textdata_color1, $textdata_color2, $texttable_color1, $texttable_color2) = ('black', 'black', 'black', 'black' );
$data_color1 = $data_color2 = $table_color1 = $table_color2 = "#ffffff";
}
$header_back1 = $header_back2 = $body_back1 = $body_back2 = "";
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";
$header_back1 = "background = \"$backgroundimageh1\"" if ($usebackgroundimageh1 eq "yes");
$header_back2 = "background = \"$backgroundimageh2\"" if ($usebackgroundimageh2 eq "yes");
}
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";
$body_back1 = "background = \"$backgroundimageb1\"" if ($usebackgroundimageb1 eq "yes");
$body_back2 = "background = \"$backgroundimageb2\"" if ($usebackgroundimageb2 eq "yes");
}
if (($action eq "view_to_edit") || ($action eq "view_to_undo") || ($action eq "view_followup_edit") )
{
$header_trans1=$header_trans2=$body_trans1=$body_trans2="";
my $wb = "#ffffff";
$header_back1=$header_back2=$body_back1=$body_back2= "bgcolor=$wb";
}
if ($border_size eq "")
{
$border_size = 1;
}
@responsedata = ();
# checks to see if this message (field 0) has any responses
while (($k, $v) = each %FUPPS)
{
if ($k =~ /$fields[0]/)
{
push (@responsedata, $v); # and pushes them (entire rows) into the array
} # NB This will just COUNT them if viewing main table but will DISPLAY them if viewing thread
}
$howmany = @responsedata;
@responsedata = sort (@responsedata);
print qq~
~;
($secj,$minj,$hourj,$mdayj,$monj,$yearj,$wdayj,$ydayj,$isdstj) = localtime($fields[3]);
$bakday = $mday;
$time_in_seconds = time();
if ($secj < 10) { $sec = "0$secj"; }
if ($minj < 10) { $minj = "0$minj"; }
if ($hourj < 10) { $hour = "0$hourj"; }
if ($mdayj < 10) { $mday = "0$mdayj"; }
$monthj = ($monj + 1);
if ($monthj < 10) { $monthj = "0$monthj"; }
@weekdaysbakj = ("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");
$bugyearj = ($yearj + 1900);
$mydatej = "$months[$monj]"." ". "$mdayj"." ". "$bugyearj" . " " ."$hourj" . "\:" . "$minj" . "\:" . "$secj";
if ($action eq "view_to_undo"){
$countingup++;
print qq~ Entry $countingup: $mydatej
~;
if ($fields[7]){
print qq~IP: $fields[7]
~;
}
$state = "Undelete";
$warn = "";
if (($fields[33]) && ($MAINDEL{$fields[33]} eq "yes")){
$warn = "yes";
}
print qq~
[ $state |
Permanently wipe ]
~;
}
elsif (($action eq "view_to_edit") || ($action eq "view_followup_edit") ){
if (($fields[15] eq "waiting") && ($fields[16] ne "yes")){
print qq~ AWAITING APPROVAL
~;
}
else{
if ($NEEDAPPR{$fields[0]} eq "yes")
{
print qq~
RESPONSE AWAITING APPROVAL
~;
}
}
if ($fields[16] eq "yes"){
print qq~ PRIVATE MESSAGE
~;
}
if ($BLOCKED_MESSAGES{$fields[0]}){
print qq~ BLOCKED USER
~;
}
$countingup++;
print qq~ Entry $countingup: $mydatej
~;
if ($fields[7]){
print qq~IP: $fields[7]
~;
}
print qq~
[ Delete ~;
if (($FUPS{$fields[0]} eq "yes") || (($action eq "view_followup_edit") && (!$fields[33]))){
print "Thread ";
}
print qq~ ]
~;
$mainmessage = $fields[0];
$mainmessage = $fields[33] if ($fields[33]);
#if ($whichusers ne "webmaster")
#{
unless (($fields[16] eq "yes") || ($action eq "view_followup_edit")) # cos we wouldn't need to add response to private message
{
print qq~
[ Add Response ]
~;
}
#}
if (($fields[15] eq "waiting") && ($fields[16] ne "yes"))
{
print qq~
[ APPROVE ]
~;
}
if ($fields[16] ne "yes"){
print qq~
[ Edit ] ~;
}
if ($FUPS{$fields[0]} eq "yes"){
print qq~ [ ~;
if ($NEEDAPPR{$fields[0]} eq "yes"){
print qq~APPROVE /~;
}
print qq~View/Edit Responses ($howmany) ]~;
}
if ($BLOCKED_MESSAGES{$fields[0]}){
print qq~ [ BLOCKED (unblock ) ] ~;
}
else{
print qq~ [ Block computer ] ~;
}
if ($fields[16] eq "yes"){
$pubprivword = "public";
}
else{
$pubprivword = "private";
}
print qq~ [ Make $pubprivword ] ~;
print qq~ ~;
}
$image_dir_url =~ s/http\:\/\///gi;
$image_dir_url =~ s/\/$//gi;
open(USER_FILE,"$field_names"); @layout_data = ; close(USER_FILE);
@layout_data = sort(@layout_data);
$hearderstart = 1;
&date_mod;
$breakhappensat = ""; $lastfieldat = "";
foreach $splitpoint (@layout_data){ # find where the break is to see if there are any fields after it.
@findsplit = split (/\|/, $splitpoint);
if ($findsplit[14] eq "break"){
$breakhappensat = "$findsplit[12]";
}
if (($findsplit[21] eq "yes") || ($details ne "")){ # find the last field that will be used
$lastfieldat = "$findsplit[12]";
}
}
$breakinc = "yes";
if ($breakhappensat > $lastfieldat){ # if break happens after the last field to be displayed
$breakinc = "no";
}
foreach $row (@layout_data){
@la = split (/\|/, $row);
$rtyyyy = $FARRARY{$la[12]};
$details = $fields[$rtyyyy]; $details =~ s/PIPEPIPE/\|/gi;
$details = $condate if ($la[2] eq "date");
$before = $la[18]; $before =~ s/PIPEPIPE/\|/gi;
$after = $la[17]; $after =~ s/PIPEPIPE/\|/gi;
$sybs = $details; $sybs =~ s/\s+//gi;
$startbold = $endbold = $startitalic = $enditalic = $startunderline = $endunderline = $nameincluded = "";
$startboldlb = $endboldlb = $startitaliclb = $enditaliclb = $startunderlinelb = $endunderlinelb = "";
$startbold = "" if ($la[26] eq "yes");
$endbold = " " if ($la[26] eq "yes");
$startitalic = "" if ($la[27] eq "yes");
$enditalic = " " if ($la[27] eq "yes");
$startunderline = "" if ($la[25] eq "yes");
$endunderline = " " if ($la[25] eq "yes");
$startboldlb = "" if ($la[59] eq "yes");
$endboldlb = " " if ($la[59] eq "yes");
$startitaliclb = "" if ($la[60] eq "yes");
$enditaliclb = " " if ($la[60] eq "yes");
$startunderlinelb = "" if ($la[58] eq "yes");
$endunderlinelb = " " if ($la[58] eq "yes");
if ($guess eq "indeed"){
$details = $sybs = "Sample $la[1]";
$details = $sybs = "Sample date" if $la[2] eq "date";
$details = $sybs = " " if $la[2] eq "IMAGE";
if ($la[2] eq "FILE"){
$details = $sybs = qq~ filename.tag ~;
}
}
$details = $sybs = "$la[32] " if $la[2] eq "ADD RESPONSE";
$details = $sybs = "$la[32] " if $la[2] eq "VIEW RESPONSES";
$details = $sybs = "$la[32] " if $la[2] eq "EDIT";
unless (($action eq "view_to_edit") ||($action eq "change1") ||($action eq "view_to_undo") ){
$sybs = "" if ($la[13] eq "yes"); #non public field.
}
if ($breakinc eq "yes"){
next if ((($la[21] ne "yes") || ($sybs eq "")) && ($la[14] ne "break")) ;
# only use active fields and non blank fields and field with break
}
else{
next if (($la[21] ne "yes") || ($sybs eq "")) ; # only use active fields and non blank fields
}
############# sort out the table html
if (($la[14] ne "break") && ($hearderstart == 1)) ## first field and it is a header
{
print qq~ ~; # header tr
if ($count ==1){
print qq~
~;
}
else
{
print qq~
~;
}
}
elsif (($la[14] eq "break") && ($hearderstart == 1)) ## first field and it is a body
{
print qq~ ~; # body tr
if ($count ==1){
print qq~
~;
}
else{
print qq~
~;
}
}
elsif ($la[14] eq "break"){
print qq~ ~;
if ($count ==1){
print qq~
~;
}
else{
print qq~
~;
}
}
########### table html sorted, now for the fields
next if (($la[21] ne "yes") || ($sybs eq "") || ($la[2] eq "PRIVATE_OPTION") );
unless (($la[14] eq "break") || ($hearderstart == 1) || ($sybs eq "")) # unless start of header or footer or blank
{
print "" if ($la[15] eq "v"); #tail end of previous div
}
my $gofor = "no";
$gofor = "yes" if ($sybs ne "");
$gofor = "no" if ($la[2] eq "EDIT") ;
if ($la[2] eq "EDIT"){
$gofor = "no";
foreach my $waitmess(@deadlines){
if ($waitmess =~ /$blcook$fields[0]/){
$gofor = "yes";
last;} } }
$gofor = "no" if (($la[2] eq "EDIT") && ($action eq "view_to_undo")) ;
$gofor = "no" if ($la[2] eq "VIEW RESPONSES") && ($FUPS{$fields[0]} ne "yes"); # if no responses
$gofor = "yes" if (($action eq "view_page_layout") || ($action eq "view_layoutprefs")
|| ($action eq "move_up") || ($action eq "move_down") );
$gofor = "no" if (($action eq "view_followup") && ($la[2] eq "ADD RESPONSE"));
$gofor = "no" if ( (($action eq "view_to_edit")||($action eq "view_followup_edit")||($action eq "view_to_undo") ||
($action eq "view_single_backup") )&& (($la[2] eq "ADD RESPONSE")||($la[2] eq "VIEW RESPONSES") ));
if ($gofor eq "yes")
{
print "" if ($la[15] eq "v");
print " " if ($la[15] eq "h");
print qq~~;
$prefont = $postfont = $prefontlb ="";
$postfont = " ";
$prefont = "";
$prefontlb = "";
$prefcolor = $postfcolor =$prefcolorlb = "";
if ($la[37] eq "yes"){
$prefcolor = "";
$postfcolor = " ";
}
if ($la[62] eq "yes"){
$prefcolorlb = "";
$postfcolor = " ";
}
if ($action eq "view_to_edit"){
$prefcolor = "";
}
if ($la[2] eq "EMAIL"){
&emailfield;
}
elsif ($la[2] eq "TABLE"){
&tablefield;
}
elsif ($la[2] eq "URL"){
&urlfield;
}
elsif ($la[2] eq "ADD RESPONSE"){
&arfield;
}
elsif ($la[2] eq "VIEW RESPONSES"){
&vrfield;
}
elsif ($la[2] eq "EDIT"){
&editfield;
}
else{
&justdetails;
}
print " ";
}
$hearderstart = 0; # no longer first row
} # end for each row
print qq~
~;
print qq~
~; # end of table
if (($action eq "view_to_edit") || ($action eq "view_to_undo") || ($action eq "view_layoutprefs") ){
print " ";
}
else{
unless ($use_own_html_between_messages eq "no")
{
print "$html_between";
}
}
$count++;
if ($count >2){$count = 1;}
}
sub tablefield {
$tar = ""; ($tar = "target = \"$la[38]\"") if ($la[38]);
print "$startbold"; print "$startitalic"; print "$startunderline"; print "$before";
#print qq~ ~;
############## $prefcolor$details$postfcolor
@tablerows = split (/\//, $la[54]);
@tablecols = split (/\//, $la[53]);
@tableprops = split (/\//, $la[64]);
$fieldtableborder = $tableprops[0];
$fieldtablecellspacing = $tableprops[1];
$fieldtablecellpadding = $tableprops[2];
$fieldtablewidth = $tableprops[3];
@detailfields = split (/\//, $details);
$fieldtableborder = "1" if $fieldtableborder eq "";
$fieldtablecellspacing = "2" if $fieldtablecellspacing eq "";
$fieldtablecellpadding = "2" if $fieldtablecellpadding eq "";
$fieldtablewidth = "90%" if $fieldtablewidth eq "";
print qq~ $startboldlb$startitaliclb$startunderlinelb$prefontlb$prefcolorlb $la[1] $postfcolor$postfont$endunderlinelb$enditaliclb$endboldlb
~;
# $startbold$startitalic$startunderline
# $endunderline$enditalic$endbold
foreach $tablecols (@tablecols)
{
$op = $tablecols;
$op =~ s/\s+/ /gi;
print qq~ $startboldlb$startitaliclb$startunderlinelb$prefontlb$prefcolorlb$op$postfcolor$postfont$endunderlinelb$enditaliclb$endboldlb ~;
}
print qq~ ~;
$ct = 0;
foreach $tablerows (@tablerows) ###### ####
{
$oprow = $tablerows;
$oprow =~ s/\s+/ /gi;
print qq~ $startboldlb$startitaliclb$startunderlinelb$prefontlb$prefcolorlb$oprow$postfcolor$postfont$endunderlinelb$enditaliclb$endboldlb ~;
foreach $tablecols (@tablecols) ############
{
$tddetail = $detailfields[$ct];
$tddetail = " " if $tddetail eq "";
print qq~ $startbold$startitalic$startunderline$prefont$prefcolor$tddetail$postfcolor$postfont$endunderline$enditalic$endbold ~;
$ct++;
}
print qq~ ~;
$rownotemp++;
}
#################
print qq~
~;
print "$after"; print "$endunderline"; print "$enditalic"; print "$endbold";
}
sub makepubpriv
{
&seek_cook;
&get_file_lock("$location_of_lock_file");
$ref = $FORM{'ref'};
open(USER_FILE,"$powerbook_data_name") || &oops('$powerbook_data_name');
@data = ;
close(USER_FILE);
open(USER_FILE,">$powerbook_data_name");
foreach $row (@data)
{
@fields = split (/\|/, $row);
if ($ref eq $fields[0]){
for (my $x = 0; $x < 42; $x++){
if ($x == 16) {
if ($fields[16] eq "yes")
{
print USER_FILE "|";
}
else
{
print USER_FILE "yes|";
}
}
else{
print USER_FILE "$fields[$x]|";
}
}
print USER_FILE "\n";
}
else{
print USER_FILE "$row";
}
}
close(USER_FILE);
&release_file_lock("$location_of_lock_file");
&content;
&main_headera;
print qq~ ~;
&main_headerb;
print qq~
~;
}
sub justdetails
{ print "$startbold"; print "$startitalic"; print "$startunderline"; print "$before";
if ($la[2] eq "IMAGE"){
my $dimensions = "";
if ($la[43] eq "yes"){
$dimensions = "width=\"$la[41]\" height=\"$la[42]\"";
}
if ($guess eq "indeed"){
print " " ;
}
else{
print qq~ ~;
}
}
elsif ($la[2] eq "FILE"){
if ($guess eq "indeed"){
print qq~ $details ~;
}
else # main routine
{
if ($la[31] eq "text") {
$url_symbol = $la[32];
}
elsif ($la[31] eq "image") {
$url_symbol =~ s/http:\/\///gi;
$url_symbol = "http://" . $url_symbol;
$url_symbol = " ";
}
else {
$url_symbol = $details;
}
#if( $la[29] eq "yes") { #must be link
print qq~~;
print "$prefcolor$url_symbol$postfcolor";
print qq~ ~;
#}
#else {
#print qq~$prefcolor$details$postfcolor~;
#}
}
}
else
{
print "$prefcolor$details$postfcolor";
}
print "$after"; print "$endunderline"; print "$enditalic"; print "$endbold";
}
sub arfield
{
if ($la[31] eq "image")
{
$la33 = $la[33];
$la33 =~ s/http:\/\///gi;
$ar_symbol = " ";
}
else
{
$ar_symbol = $la[32];
}
unless (($action eq "view_followup") || ($action eq "view_to_edit") )
{
if ((($allow_responses ne "no") && ($action ne "view_to_edit")
&&($action ne "view_layoutprefs") && ($action ne "view_to_undo") && ($action ne "view_followup_edit"))
|| ($action eq "view_page_layout") || ($action eq "view_layoutprefs"))
{
$print_me = "no";
if (($whichusers eq "multiple passwords") || ($whichusers eq "single password"))
{
if ($COOK{'actiuse'} eq "ok")
{
$print_me = "yes";
}
else
{
$print_me = "no";
}
}
elsif ($whichusers eq "all")
{
$print_me = "yes";
}
else
{
$print_me = "no";
}
if (($whichusers eq "webmaster") && ($logged_in_cp eq "yes"))
{
$print_me = "yes";
}
if (($print_me eq "yes")|| ($action eq "view_page_layout") || ($action eq "view_layoutprefs")
|| ($action eq "move_up") || ($action eq "move_down"))
{
print "$startbold"; print "$startitalic"; print "$startunderline"; print "$before"; #####
print qq~ ~;
print "$prefcolor$ar_symbol$postfcolor";
print " "; print "$after"; print "$endunderline"; print "$enditalic"; print "$endbold";
}
}
}
}
sub vrfield
{
if ($la[31] eq "image")
{
$la33 = $la[33];
$la33 =~ s/http:\/\///gi;
$vr_symbol = " ";
}
else
{
$vr_symbol = $la[32];
}
unless (($action eq "view_followup") || ($action eq "view_to_edit") )
{
if (($FUPS{$fields[0]} eq "yes") || ($action eq "view_page_layout") || ($action eq "view_layoutprefs")
|| ($action eq "move_up") || ($action eq "move_down"))
{
print "$startbold"; print "$startitalic"; print "$startunderline"; print "$before";
print qq~ ~;
print "$prefcolor$vr_symbol ($howmany)$postfcolor";
print " "; print "$after"; print "$endunderline"; print "$enditalic"; print "$endbold";
}
}
}
sub editfield
{
if ($la[31] eq "image")
{
$la33 = $la[33];
$la33 =~ s/http:\/\///gi;
$edit_symbol = " ";
}
else
{
$edit_symbol = $la[32];
}
unless ($action eq "view_to_edit")
{
print "$startbold"; print "$startitalic"; print "$startunderline"; print "$before";
print qq~
~;
print "$prefcolor$edit_symbol$postfcolor";
print " "; print "$after"; print "$endunderline"; print "$enditalic"; print "$endbold";
}
}
sub urlfield
{
$tar = ""; ($tar = "target = \"$la[38]\"") if ($la[38]);
print "$startbold"; print "$startitalic"; print "$startunderline"; print "$before";
if ($la[31] eq "text") {
$url_symbol = $la[32];
}
elsif ($la[31] eq "image") {
$la33 = $la[33];
$la33 =~ s/http:\/\///gi;
$url_symbol = " ";
}
elsif ($la[31] eq "altfield") {
$urlaltfield = $FARRARY{$la[51]};
if ($FTYPES{$la[51]} eq "TEXT")
{
$url_symbol = "$fields[$urlaltfield]";
}
elsif ($FTYPES{$la[51]} eq "IMAGE")
{
$url_symbol = " ";
}
}
else {
$url_symbol = $details;
}
$url_symbol = "Sample $la[1]" if ((($url_symbol eq "") || ($FTYPES{$la[51]} eq "IMAGE")) && ($guess eq "indeed" ));
if ($count ==1) {
if( $la[29] eq "yes") {
print qq~$prefcolor$url_symbol$postfcolor ~;
}
else {
print qq~$prefcolor$details$postfcolor~;
}
}
else {
if( $la[29] eq "yes") {
print qq~$prefcolor$url_symbol$postfcolor ~;
}
else {
print qq~$prefcolor$details$postfcolor~;
}
} #end url
print "$after"; print "$endunderline"; print "$enditalic"; print "$endbold";
}
sub inter_header {
&content;
print qq~
$title
~;
}
sub basic_header {
&content;
print qq~
Active PowerBook
~;
}
sub check_address_for_mistakes {
$guest_email = $detail;
if ($guest_email=~/^\.|^\@/) {
&basic_header;
print qq~ $cgifont2 $title $cgifont $TXT_no_dot_at_start$TXT_please_go_back_and_edit
~;
exit;
}
if ($guest_email=~/^www\./) {
&basic_header;
print qq~
$cgifont2 $title $cgifont $TXT_no_www_at_start$TXT_please_go_back_and_edit
~;
exit;
}
$domain=$guest_email;
$domain=~s/^.*\@(.*)/$1/;
if ($domain=~/_|~|#/)
{
&basic_header;
print qq~
$cgifont2 $title $cgifont
$TXT_no_squiggles_in_domain$TXT_please_go_back_and_edit ~;
exit;
}
if ($guest_email=~tr/@//!=1)
{
&basic_header;
print qq~
$cgifont2 $title $cgifont
$TXT_only_one_at$TXT_please_go_back_and_edit
~;
exit;
}
if ($guest_email=~/\.\@|\@\.|\.\./)
{
&basic_header;
print qq~
$cgifont2 $title $cgifont
$TXT_no_dots_next$TXT_please_go_back_and_edit
~;
exit;
}
if (!($guest_email=~/\.[a-z]{2,4}$/i))
{
&basic_header;
print qq~
$cgifont2 $title $cgifont
$TXT_wrong_end$TXT_please_go_back_and_edit
~;
exit;
}
} # end check mistakes
sub plain_header
{
print qq~
$title
~;
print qq~
~;
}
sub plain_header_stop
{
print qq~
$title
~;
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"."&book=$book";
print qq~ $title
~;
exit;
}
sub already_added
{
unless (-e "$already_added")
{
open(COLFILE,">$already_added");
chmod(0755, "$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"."&book=$book";
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 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,"$powerbook_data_name") || &oops('$powerbook_data_name');
@data = ;
close(USER_FILE);
open(USER_FILE,">$powerbook_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]|$fields[31]|$fields[32]|$fields[33]|$fields[34]|$fields[35]|$fields[36]|$fields[37]|$fields[38]|$fields[39]|$fields[40]|$fields[41]|\n";
$conmessage = $fields[2];
}
# removes waiting from field 15
}
close(USER_FILE);
&release_file_lock("$location_of_lock_file");
&content;
&main_headera;
print qq~ ~;
&main_headerb;
print qq~
~;
} # end approve
sub subdirectory
{
if ($book eq "")
{
$powerbook_files_directory = "active_powerbook_files" ; #cannot change this or server won't work
$powerbook_backups_directory = "active_powerbook_backups";
$nword = "./active_powerbook_files/bkup.txt";
}
else
{
$powerbook_files_directory = "$book" . "_". "active_powerbook_files" ;
$powerbook_backups_directory = "$book" . "_". "active_powerbook_backups";
$nword = "./$powerbook_files_directory/bkup.txt";
}
$htmlssi = "./active_powerbook_files/htmlssinew.txt";
$htmlssin = "./active_powerbook_files/htmlssin.txt";
$blocked_machines = "./active_powerbook_files/blocked.txt"; #blocked on all books
$location_of_lock_file = "./$powerbook_files_directory/powerbook.lock";
$already_added = "./$powerbook_files_directory/added.txt";
if ($SERVDATA{$book} eq "yes"){
$powerbook_data_name = "./active_powerbook_files/powerbook_data.txt";
$counter_name = "./active_powerbook_files/counter.txt";
}
else{
$powerbook_data_name = "./$powerbook_files_directory/powerbook_data.txt";
$counter_name = "./$powerbook_files_directory/counter.txt";
}
$gbook_data_name = "./$powerbook_files_directory/guestbook_data.txt"; #used to copy data
$active_name = "./$powerbook_files_directory/active.txt";
if ($SERVACCESS{$book} eq "yes"){
$perms = "./active_powerbook_files/perms.txt";
$access_name = "./active_powerbook_files/individaccess.txt";
$singleperms = "./active_powerbook_files/singleperms.txt";
}
else{
$perms = "./$powerbook_files_directory/perms.txt";
$access_name = "./$powerbook_files_directory/individaccess.txt";
$singleperms = "./$powerbook_files_directory/singleperms.txt";
}
if ($SERVLAYOUT{$book} eq "yes"){
$layout_name = "./active_powerbook_files/layout_name.txt";
}
else{
$layout_name = "./$powerbook_files_directory/layout_name.txt";
}
if ($SERVMENU{$book} eq "yes"){
$menu_name = "./active_powerbook_files/menuprefs.txt";
}
else{
$menu_name = "./$powerbook_files_directory/menuprefs.txt";
}
if ($SERVFIELD{$book} eq "yes"){
$field_names = "./active_powerbook_files/field_names.txt";
}
else{
$field_names = "./$powerbook_files_directory/field_names.txt";
}
if ($SERVCOL{$book} eq "yes"){
$colprefs_name = "./active_powerbook_files/colprefs.txt";
}
else{
$colprefs_name = "./$powerbook_files_directory/colprefs.txt";
}
$colprefs_backup_name= "./$powerbook_files_directory/colprefs_backup.txt";
if ($SERVLANG{$book} eq "yes"){
$langprefs_name = "./active_powerbook_files/langprefs.txt";
$months_name = "./active_powerbook_files/months.txt";
$days_name = "./active_powerbook_files/days.txt";
}
else{
$months_name = "./$powerbook_files_directory/months.txt";
$langprefs_name = "./$powerbook_files_directory/langprefs.txt";
$days_name = "./$powerbook_files_directory/days.txt";
}
$langprefs_backup_name = "./$powerbook_files_directory/langprefs_backup.txt";
$gtp_backup_name = "./$powerbook_files_directory/gtp.txt";
$months_bak_name = "./$powerbook_files_directory/months_bak.txt";
$days_bak_name = "./$powerbook_files_directory/days_bak.txt";
if ($SERVPREF{$book} eq "yes"){
$prefs_name = "./active_powerbook_files/prefs.txt";
$html_between_name = "./active_powerbook_files/html_between.txt";
$user_style_name = "./active_powerbook_files/user_style.txt";
$user_html_name = "./active_powerbook_files/user_html.txt";
$user_html_footer_name = "./active_powerbook_files/user_html_footer.txt";
}
else{
$prefs_name = "./$powerbook_files_directory/prefs.txt";
$html_between_name = "./$powerbook_files_directory/html_between.txt";
$user_style_name = "./$powerbook_files_directory/user_style.txt";
$user_html_name = "./$powerbook_files_directory/user_html.txt";
$user_html_footer_name = "./$powerbook_files_directory/user_html_footer.txt";
}
if ($SERVDATE{$book} eq "yes"){
$user_date_file = "./active_powerbook_files/user_date_format.txt";
}
else{
$user_date_file = "./$powerbook_files_directory/user_date_format.txt";
}
$viewed = "./$powerbook_files_directory/viewed.txt";
$prefs_backup_name = "./$powerbook_files_directory/prefs_backup.txt";
$ip_name = "./active_powerbook_files/ip_limit.txt";
$senddate_name = "./$powerbook_files_directory/senddate.txt";
$tempcolprefs_name = "./$powerbook_files_directory/tempcolprefs.txt";
$update_name = "./$powerbook_files_directory/update.txt";
$user_default_html_name = "./$powerbook_files_directory/user_default_html.txt";
$user_default_html_footer_name = "./$powerbook_files_directory/user_default_html_footer.txt";
$userprefs_backup_name = "./$powerbook_files_directory/userprefs_backup.txt";
$usercolprefs_backup_name = "./$powerbook_files_directory/usercolprefs_backup.txt";
}
sub show_edit_number_menu
{
print qq~
$cgifont [
~;
# $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 (my $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;
if ($mastermanagemessagesonly eq "yes"){
&content;
print qq~ Access to this section is currently restricted.
Back ~;
exit;
}
if ($masterdate eq "yes"){
&content;
print qq~ These settings are currently controlled by the Master Control Panel.
Back ~;
exit;
}
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/);
(@clock_type = split (/\,/, $row)) if ($row =~ /^clock/);
}
($date0,$date1,$date2,$date3,$date4,$date5,$date6,$date7,$date8) = @datefields;
($space0,$space1,$space2,$space3,$space4,$space5,$space6,$space7) = @spacefields;
($hours0,$hours_offset,,,,,,) = @hours_offset;
($clock_type0,$clock_type,$amset,$pmset,,,,) = @clock_type;
@ro = ("se","mi","hr","d","dd","m","mm","y","am/pm","","");
$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 ($xmonthn < 10) { $xmonthn = "0$xmonthn"; }
if ($clock_type == 12){
$timeofday = "$amset" if $xhour < 12;
$timeofday = "$pmset" if $xhour > 11;
$xhour = ($xhour-12) if $xhour > 12;
}
if ($xhour < 10) { $xhour = "0$xhour"; }
@dv = ($xsec,$xmin,$xhour,$xmday,$xweekday,$xmonthn,$xmonth,$xyear,$timeofday,,);
$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~
Active PowerBook $cptext Date Format Manager
$cptitlefont Active PowerBook $cptext Date Format Manager
$cgifont
~;
&linkjump; print qq~
$cgifontKey:
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...
$cgifont
($daylist[$xwday] $monthlist[$xmon] $xmday $xyear $xhour:$xmin:$xsec)
($xmonthn/$xmday/$xyear)
~;
&inter_footer;
}
sub date_options
{
print qq~
am/pm
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'};
$clock_type = $FORM{'clock_type'};
$amset = $FORM{'amset'};
$pmset = $FORM{'pmset'};
$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~
$cgifont2 $title $cgifont
You can not use a pipe "|" character in a date format. Please go back and edit .
~;
exit;
}
if (($date1 eq "9") && ($date2 eq "9") && ($date3 eq "9") && ($date4 eq "9") && ($date5 eq "9") && ($date6 eq "9") && ($date7 eq "9"))
{
&basic_header;
print qq~
$cgifont2 $title $cgifont
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";
print UPDATE "clock,$clock_type,$amset,$pmset,,,,,\n";
close(UPDATE);
&content;
print qq~ ~;
&main_headerb;
print qq~
~;
&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/);
(@clock_type = split (/\,/, $row)) if ($row =~ /^clock/);
}
($date0,$date1,$date2,$date3,$date4,$date5,$date6,$date7,$date8) = @datefields;
($space0,$space1,$space2,$space3,$space4,$space5,$space6,$space7) = @spacefields;
($hours0,$hours_offset,,,,,,) = @hours_offset;
($clock_type0,$clock_type,$amset,$pmset,,,,) = @clock_type;
@ro = ("se","mi","hr","d","dd","m","mm","y","am/pm","","");
$space1 =~ s/comma/,/gi;
$space2 =~ s/comma/,/gi;
$space3 =~ s/comma/,/gi;
$space4 =~ s/comma/,/gi;
$space5 =~ s/comma/,/gi;
$space6 =~ s/comma/,/gi;
$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 ($xmonthn < 10) { $xmonthn = "0$xmonthn"; }
if ($clock_type == 12)
{
$timeofday = "$amset" if $xhour < 12;
$timeofday = "$pmset" if $xhour > 11;
$xhour = ($xhour-12) if $xhour > 12;
}
if ($xhour < 10) { $xhour = "0$xhour"; }
@dv = ($xsec,$xmin,$xhour,$xmday,$xweekday,$xmonthn,$xmonth,$xyear,$timeofday,,);
$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];
}
}
sub mygmtime {
@monthsa = ("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug",
"Sep","Oct","Nov","Dec");
@daysa = ("Sun","Mon","Tue","Wed","Thu","Fri","Sat");
# (time) would be now, so we want to set it to expire sometime
# later. here we expire it in 365 days.
my ($seca,$mina,$hra,$mdaya,$mona,$yra,$wdaya,$ydaya,$isdsta) = gmtime(time + (86400*365));
$timestr = sprintf("%3s, %02d-%3s-%4d %02d:%02d:%02d GMT", $daysa[$wdaya],$mdaya,$monthsa[$mona],$yra+1900,$hra,$mina,$seca);
my ($seca,$mina,$hra,$mdaya,$mona,$yra,$wdaya,$ydaya,$isdsta) = gmtime(time + (3600*$hourstoedit));
$timestr2 = sprintf("%3s, %02d-%3s-%4d %02d:%02d:%02d GMT", $daysa[$wdaya],$mdaya,$monthsa[$mona],$yra+1900,$hra,$mina,$seca);
$expdate = $timestr;
$expdate2 = $timestr2;
}
sub mygmtime2 {
@monthsa = ("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug",
"Sep","Oct","Nov","Dec");
@daysa = ("Sun","Mon","Tue","Wed","Thu","Fri","Sat");
# (time) would be now, so we want to set it to expire sometime
# later. here we expire it in 365 days.
($seca,$mina,$hra,$mdaya,$mona,$yra,$wdaya,$ydaya,$isdsta) = gmtime(time + (3600*$hourstoedit));
# format must be Wed, DD-Mon-YYYY HH:MM:SS GMT
$timestr2 = sprintf("%3s, %02d-%3s-%4d %02d:%02d:%02d GMT",$daysa[$wdaya],$mdaya,$monthsa[$mona],$yra+1900,$hra,$mina,$seca);
return $timestr2;
}
sub checklate
{
unless (-e "$powerbook_backups_directory") # check to see if this is a first install
{
# is not a first install, so check if new field names exist
unless (-e "$field_names")
{
# they don't exist, so therefore it must be an upgrade, so we must get the old field names
open(LANGFILE,"$langprefs_name");
@LANGLINES = ;
close(LANGFILE);
foreach $LANGLINE (@LANGLINES)
{
@langterms = split(/=/,$LANGLINE);
$LANGPREFS{$langterms[0]} = $langterms[1];
}
$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'};
}
}
}
sub view_layoutprefs
{
&seek_cook;
if ($mastermanagemessagesonly eq "yes"){
&content;
print qq~ Access to this section is currently restricted.
Back ~;
exit;
}
if ($masterfield eq "yes"){
&content;
print qq~ These settings are currently controlled by the Master Control Panel.
Back ~;
exit;
}
if ($FORM{'action'} eq "active_inactive")
{
open(USER_FILE,"$field_names");
@layout_data = ;
close(USER_FILE);
open(USER_FILE,">$field_names");
foreach $row (@layout_data)
{
@fs = split (/\|/, $row);
if ($fs[12] eq $FORM{'field'})
{
$change = "yes" if ($fs[21] ne "yes");
$change = "no" if ($fs[21] eq "yes");
for (my $x = 0; $x < 70; $x++){
if ($x == 21)
{
print USER_FILE "$change|";
}
else
{
print USER_FILE "$fs[$x]|";
}
}
print USER_FILE "\n";
}
else
{
print USER_FILE "$row";
}
}
close(USER_FILE);
}
elsif ($FORM{'action'} eq "pub_priv")
{
open(USER_FILE,"$field_names");
@layout_data = ;
close(USER_FILE);
open(USER_FILE,">$field_names");
foreach $row (@layout_data)
{
@fs = split (/\|/, $row);
if ($fs[12] eq $FORM{'field'})
{
$change = "yes" if ($fs[13] ne "yes");
$change = "no" if ($fs[13] eq "yes");
for (my $x = 0; $x < 70; $x++){
if ($x == 13)
{
print USER_FILE "$change|";
}
else
{
print USER_FILE "$fs[$x]|";
}
}
print USER_FILE "\n";
}
else
{
print USER_FILE "$row";
}
}
close(USER_FILE);
}
open(USER_FILE,"$field_names");
@layout_data = ;
close(USER_FILE);
@layout_data = sort(@layout_data);
$colorhere = "black";
&content;
print qq~
$title
~;
if ($style ne "no"){
print qq~ $user_style ~;
}
print qq~
~;
print qq~
$cptitlefont Active PowerBook $cptext Message Layout Manager
$cgifont ~;
&linkjump; print qq~ - Sample
~;
$bbod = "Header";
$kk = 0;
foreach $row (@layout_data)
{
@layoutfields = split (/\|/, $row);
$kk++;
$act = "Inactive";
$act = "Active" if ($layoutfields[21] eq "yes");
$pub = "Public";
$pub = "Private" if ($layoutfields[13] eq "yes");
$pub = "" if ($act eq "Inactive");
$co = "red";
$co = "blue" if ($layoutfields[21] eq "yes");
$bbod = "Body" if ($layoutfields[14] eq "break");
print qq~ $cgifont$kk ~;
if ($layoutfields[2] eq "ADD RESPONSE"){
$pub = ""; $act = "";
print "Add Response ";
}
elsif ($layoutfields[2] eq "VIEW RESPONSES"){
print "View Responses ";
$pub = ""; $act = "";
}
elsif ($layoutfields[2] eq "EDIT"){
print "Edit Message ";
$pub = ""; $act = "";
}
elsif ($layoutfields[2] eq "PRIVATE_OPTION"){
print "Private Message Option ";
$pub = ""; $act = "";
}
elsif ($layoutfields[2] ne "date")
{
print "$layoutfields[1]";
}
else
{
$pub = "";
print "Date ";
}
print qq~
~;
if ($layoutfields[2] eq "ADD RESPONSE"){
print "Add Response ";
}
elsif ($layoutfields[2] eq "VIEW RESPONSES"){
print "View Responses ";
}
elsif ($layoutfields[2] eq "EDIT"){
print "Edit Message ";
$pub = ""; $act = "";
}
elsif ($layoutfields[2] eq "PRIVATE_OPTION"){
print "Private Message ";
}
elsif ($layoutfields[2] ne "date")
{
print "$layoutfields[2]";
}
else
{
print "Message Date ";
}
print qq~
$act
$pub
$bbod
EDITOR
~;
unless ($kk == 1)
{
print qq~ Up ~;
}
print qq~ ~;
unless ($kk == 20)
{
print qq~ Down ~;
}
print qq~
~;
if ($layoutfields[2] eq "PRIVATE_OPTION"){
print qq~ (only appears in Add page) ~;
}
elsif ($layoutfields[2] eq "ADD RESPONSE"){
print qq~ (only appears if access allows) ~;
}
elsif ($layoutfields[2] eq "EDIT"){
print qq~ (appears if within allowed edit period) ~;
}
elsif ($layoutfields[2] eq "VIEW RESPONSES"){
print qq~ (only appears if responses exist) ~;
}
elsif ($layoutfields[50] eq "yes"){
print qq~ (entry currently limited to webmaster) ~;
}
print qq~
~;
}
print qq~
~;
######## put in sample
$guess = "indeed";
print qq~
$cptitlefont Sample message Note that the sample given is only a guide. Please check main page to see how the message will actually look.
~;
&main_table_results;
print qq~
~;
print qq~
~;
}
sub move_up
{
&seek_cook;
$addmove = $FORM{'addmove'};
$sortfield = "0";
$sortfield = "36" if ($addmove eq "yes");
open(USER_FILE,"$field_names");
@layout_data = ;
close(USER_FILE);
$field = $FORM{'field'};
my $min = "10000001";
my $max = "10000020";
foreach $row (@layout_data)
{
@layoutfields = split (/\|/, $row);
$current = $layoutfields[$sortfield] if ($field eq "$layoutfields[12]");
}
$one_up = $current - 1;
if ($one_up < $min)
{
&view_layoutprefs if $addmove ne "yes";
&view_addlayoutprefs if $addmove eq "yes";
exit;
}
open(USER_FILE,">$field_names");
foreach $row (@layout_data)
{
@fs = split (/\|/, $row);
if ($fs[$sortfield] eq $current)
{
if ($addmove eq "yes")
{
for (my $x = 0; $x < 70; $x++){
if ($x == 36)
{
print USER_FILE "$one_up|";
}
else
{
print USER_FILE "$fs[$x]|";
}
}
print USER_FILE "\n";
}
else
{
for (my $x = 0; $x < 70; $x++){
if ($x == 0)
{
print USER_FILE "$one_up|";
}
else
{
print USER_FILE "$fs[$x]|";
}
}
print USER_FILE "\n";
}
}
elsif ($fs[$sortfield] eq $one_up)
{
if ($addmove eq "yes")
{
for (my $x = 0; $x < 70; $x++){
if ($x == 36)
{
print USER_FILE "$current|";
}
else
{
print USER_FILE "$fs[$x]|";
}
}
print USER_FILE "\n";
}
else
{
for (my $x = 0; $x < 70; $x++){
if ($x == 0)
{
print USER_FILE "$current|";
}
else
{
print USER_FILE "$fs[$x]|";
}
}
print USER_FILE "\n";
}
}
else
{
print USER_FILE "$row";
}
}
close(USER_FILE);
if ($addmove eq "yes") {
&view_addlayoutprefs;
} else {
&view_layoutprefs;
}
}
sub move_down
{
my $min = "10000001";
my $max = "10000020";
&seek_cook;
$addmove = $FORM{'addmove'};
open(USER_FILE,"$field_names");
@layout_data = ;
close(USER_FILE);
$field = $FORM{'field'};
$sortfield = "0";
$sortfield = "36" if ($addmove eq "yes");
foreach $row (@layout_data)
{
@layoutfields = split (/\|/, $row);
$current = $layoutfields[$sortfield] if ($field eq "$layoutfields[12]");
}
$one_up = $current + 1;
if ($one_up > $max)
{
&view_layoutprefs if $addmove ne "yes";
&view_addlayoutprefs if $addmove eq "yes";
exit;
}
open(USER_FILE,">$field_names");
foreach $row (@layout_data)
{
@fs = split (/\|/, $row);
if ($fs[$sortfield] eq $current)
{
if ($addmove eq "yes")
{
for (my $x = 0; $x < 70; $x++){
if ($x == 36)
{
print USER_FILE "$one_up|";
}
else
{
print USER_FILE "$fs[$x]|";
}
}
print USER_FILE "\n";
}
else
{
for (my $x = 0; $x < 70; $x++){
if ($x == 0)
{
print USER_FILE "$one_up|";
}
else
{
print USER_FILE "$fs[$x]|";
}
}
print USER_FILE "\n";
}
}
elsif ($fs[$sortfield] eq $one_up)
{
if ($addmove eq "yes")
{
for (my $x = 0; $x < 70; $x++){
if ($x == 36)
{
print USER_FILE "$current|";
}
else
{
print USER_FILE "$fs[$x]|";
}
}
print USER_FILE "\n";
}
else
{
for (my $x = 0; $x < 70; $x++){
if ($x == 0)
{
print USER_FILE "$current|";
}
else
{
print USER_FILE "$fs[$x]|";
}
}
print USER_FILE "\n";
}
}
else
{
print USER_FILE "$row";
}
}
close(USER_FILE);
if ($addmove eq "yes") {
&view_addlayoutprefs;
} else {
&view_layoutprefs;
}
}
sub view_to_edit_a_field
{
&seek_cook;
open(USER_FILE,"$field_names");
@layout_data = ;
close(USER_FILE);
$field = $FORM{'field'};
foreach $row (@layout_data)
{
@la = split (/\|/, $row);
if ($field eq "$la[12]")
{
for ($x = 0; $x < 70; $x++)
{
$la[$x] =~ s/PIPEPIPE/\|/gi;
}
$y20 = ""; $y20 = "checked" if ($la[20] eq "yes"); $y13 = ""; $y13 = "checked" if ($la[13] eq "yes");
$y37 = ""; $y37 = "checked" if ($la[37] eq "yes"); $y62 = ""; $y62 = "checked" if ($la[62] eq "yes");
$y29 = ""; $y29 = "checked" if ($la[29] eq "yes"); $y30 = ""; $y30 = "checked" if ($la[30] eq "yes");
$y27 = ""; $y27 = "checked" if ($la[27] eq "yes"); $y26 = ""; $y26 = "checked" if ($la[26] eq "yes");
$y25 = ""; $y25 = "checked" if ($la[25] eq "yes"); $y60 = ""; $y60 = "checked" if ($la[60] eq "yes");
$y59 = ""; $y59 = "checked" if ($la[59] eq "yes"); $y58 = ""; $y58 = "checked" if ($la[58] eq "yes");
$y21 = ""; $y21 = "checked" if ($la[21] eq "yes"); $y43 = ""; $y43 = "checked" if ($la[43] eq "yes");
$y45 = ""; $y45 = "checked" if ($la[45] eq "yes"); $y49 = ""; $y49 = "checked" if ($la[49] eq "yes");
$y50 = ""; $y50 = "checked" if ($la[50] eq "yes");
$checkalignl = "checked" if ($la[28] eq "left"); $checkalignc = "checked" if ($la[28] eq "center");
$checkalignr = "checked" if ($la[28] eq "right");
$checkalignl2 = "checked" if ($la[61] eq "left");
$checkalignc2 = "checked" if ($la[61] eq "center"); $checkalignr2 = "checked" if ($la[61] eq "right");
$tableallcheckalignl = "checked" if ($la[63] eq "left");
$tableallcheckalignc = "checked" if ($la[63] eq "center"); $tableallcheckalignr = "checked" if ($la[63] eq "right");
$checkv = "checked" if ($la[15] eq "v");
$checkh = "checked" if ($la[15] eq "h");
$firstbody = "h" if ($la[15] eq "h");
$firstbody = "v" if ($la[15] eq "v");
$checkradiov = "checked" if ($la[11] eq "v");
$checkradioh = "checked" if ($la[11] eq "h");
$checkhyperadd = "checked" if ($la[31] eq "address");
$checkhypertext = "checked" if ($la[31] eq "text");
$checkhyperimage = "checked" if ($la[31] eq "image");
$checkhyperaltfield = "checked" if ($la[31] eq "altfield");
#@fieldtypes = ("TEXT","EMAIL","URL","TEXTAREA","IMAGE","FILE","CHECK","SELECT","RADIO","TABLE","DATE","date");
@fieldtypes = ("TEXT","EMAIL","URL","TEXTAREA","IMAGE","FILE","CHECK","SELECT","RADIO","TABLE","date");
&content;
print qq~
Active PowerBook
~;
print qq~
$cptitlefont Active PowerBook $cptext Field Editor
~;
&linkjump;
print qq~
";
exit;
}
if (($temptype eq "TEXT") || ($temptype eq "EMAIL") || ($temptype eq "URL") )
{
print qq~
$cgifontField Width: $cgifont
$cgifontMaximum characters: $cgifont
$cgifontKeep private?:
$cgifont
~;
if (($temptype eq "EMAIL") || ($temptype eq "URL"))
{
print qq~
$cgifontUse hyperlink?:
$cgifont
$cgifontHyperlink format:
$cgifont
address -
text -
image -
alternative field
Choose field ~;
open(USER_FILE,"$field_names");
@fdata = ;
close(USER_FILE);
foreach $frow (@fdata){
@ffields = split (/\|/, $frow);
next if (($ffields[21] ne "yes") || ($ffields[2] eq "ADD RESPONSE")||($ffields[2] eq "EDIT")
||($ffields[2] eq "VIEW RESPONSES")||($ffields[2] eq "PRIVATE_OPTION")) ;
if (($ffields[2] eq "TEXT") ||($ffields[2] eq "IMAGE") ) {
$optext = $ffields[1];
$optext = $ffields[2] if $ffields[2] eq "date";
print qq~ $optext ~;
}
}
print qq~
$cgifontHyperlink text: $cgifont
$cgifontHyperlink image: $cgifont
~;
}
if ($temptype eq "EMAIL")
{
print qq~
$cgifontMunged?:
$cgifont
$cgifontSend response/thank you message?:
$cgifont
$cgifontResponse subject: $cgifont
~;
$resp_text = $la[47];
$resp_text =~ s/RESPRESP/\n/gi;
print qq~ $cgifontResponse text: $cgifont$resp_text
~;
#################### INCLUDED FIELDS IN EMAIL
print qq~
$cgifontInclude in email: $cgifont ~;
$fieldstouseinemail = $la[52];
@fieldtouseinemail = split (/\//, $fieldstouseinemail);
foreach $uni (@fieldtouseinemail){
$UNICSS{$uni} = "yes";
}
@fdatanew_rows = ();
foreach $fdatarow (@fdata){
@fdatarow = split (/\|/, $fdatarow);
$fsortable_field = $fdatarow[36];
unshift (@fdatarow, $fsortable_field);
$flnew_row = join ("\|", @fdatarow);
push (@fdatanew_rows, $flnew_row);
}
@ndatalist = ();
@fsorted_rows = sort (@fdatanew_rows);
foreach $fsorted_row (@fsorted_rows){
@frow = split (/\|/, $fsorted_row);
$fsorted_field = shift (@frow);
$fold_but_sorted_row = join ("\|", @frow);
push (@fdata_ordered, $fold_but_sorted_row);
}
foreach $frow (@fdata_ordered){
@ffields = split (/\|/, $frow);
$checked="";
$checked="checked" if ($UNICSS{$ffields[12]});
next if (($ffields[21] ne "yes") || ($ffields[2] eq "ADD RESPONSE")||($ffields[2] eq "EDIT")
||($ffields[2] eq "VIEW RESPONSES")||($ffields[2] eq "PRIVATE_OPTION") || ($ffields[12] eq $FORM{'field'})|| ($ffields[2] eq "date") ) ;
$optext = $ffields[1];
$optext = "Date" if $ffields[2] eq "date";
print qq~ ($optext) ~;
}
print " ";
####################
}
if ($temptype eq "URL")
{
print qq~
$cgifontTarget window: $cgifont
~;
}
}
elsif (($temptype eq "ADD RESPONSE")||($temptype eq "VIEW RESPONSES")||($temptype eq "EDIT"))
{
print qq~
$cgifontFormat:
$cgifont
text -
image
$cgifontText: $cgifont
$cgifontImage: $cgifont
~;
}
elsif ($temptype eq "TEXTAREA")
{
print qq~
$cgifontColumns: $cgifont
$cgifontRows: $cgifont
$cgifontKeep private?:
$cgifont
~;
}
elsif ($temptype eq "TABLE")
{
$rownames = $la[54];
$rownames =~ s/\//\n/gi;
$rownames =~ s/( )+/ /g;
$colnames = $la[53];
$colnames =~ s/\//\n/gi;
$colnames =~ s/( )+/ /g;
print qq~
$cgifontField Width: $cgifont
$cgifontRow names: $cgifont$rownames
$cgifontColumn names: $cgifont$colnames
$cgifontKeep private?:
$cgifont
~;
}
elsif ($temptype eq "CHECK")
{
print qq~
$cgifontValue: $cgifont
$cgifontKeep private?:
$cgifont
~;
}
elsif ($temptype eq "SELECT")
{
$options = $la[8];
$options =~ s/\//\n/gi;
$options =~ s/( )+/ /g;
print qq~
$cgifontSize: $cgifont
$cgifontValues: $cgifont
$options
$cgifontDefault value: $cgifont
$cgifontKeep private?:
$cgifont
~;
}
elsif ($temptype eq "RADIO")
{
$options = $la[8];
$options =~ s/\//\n/gi;
$options =~ s/( )+/ /g;
print qq~
$cgifontLayout:
$cgifont
horizontal - vertical
$cgifontValues: $cgifont
$options
$cgifontDefault value:
$cgifont
$cgifontKeep private?:
$cgifont ~;
}
unless (($temptype eq "ADD RESPONSE")||($temptype eq "VIEW RESPONSES")||($temptype eq "EDIT")||($temptype eq "PRIVATE_OPTION")){
print qq~
$cgifontRequired?:
$cgifont
~; }
} # end else not date
#unless (($temptype eq "ADD RESPONSE")||($temptype eq "EDIT")||($temptype eq "VIEW RESPONSES")||($temptype eq "PRIVATE_OPTION")){
#print qq~
#$cgifontActive?:
#$cgifont
#~; }
if ($temptype ne "TABLE"){
print qq~
$cgifontFont Type: $cgifont
$cgifontFont Size: $cgifont
$cgifontUnderline:
$cgifont
$cgifontBold:
$cgifont
$cgifontItalic:
$cgifont
~;
}
else{
if ($checkh ne "checked") {
print qq~
$cgifontTable Alignment: $cgifont
left - center - right
~;
}
@tableprops = split (/\//, $la[64]);
$tborder = $tableprops[0];
$twidth = $tableprops[3];
$tspacing = $tableprops[1];
$tpadding = $tableprops[2];
$tborder = 1 if $tborder eq "" ;
$twidth = "90%" if $twidth eq "" ;
$tspacing = 2 if $tspacing eq "" ;
$tpadding = 2 if $tpadding eq "" ;
print qq~
$cgifontTable Border: $cgifont
$cgifontTable Width: (pixels or percentage) $cgifont
$cgifontTable Cellspacing: $cgifont
$cgifontTable Cellpadding: $cgifont
$cgifont3Values Font Type: $cgifont
$cgifont3Values Font Size: $cgifont
$cgifont3Values Underline:
$cgifont
$cgifont3Values Bold:
$cgifont
$cgifont3Values Italic:
$cgifont
$cgifont3Values Alignment: $cgifont3
left -
center -
right
~;
&vef_overridecolor;
print qq~
$cgifont4Labels Font Type: $cgifont
$cgifont4Labels Font Size: $cgifont
$cgifont4Labels Underline:
$cgifont4
$cgifont4Labels Bold:
$cgifont4
$cgifont4Labels Italic:
$cgifont
$cgifont4Labels Alignment: $cgifont4
left -
center -
right
~;
print qq~
$cgifont4Labels Override PowerBook default color?:
$cgifont
$cgifont4Labels Color:
Select New Color?
~;
&newoptions;
print qq~
~;
}
unless ($temptype eq "PRIVATE_OPTION"){
print qq~
$cgifontFollows previous field:
$cgifont ~;
if ($la[14] eq "break") {
print qq~ vertically - currently start of body section ~;
}
else {
print qq~ vertically - horizontally ~;
}
print qq~ ~;
unless ($temptype eq "TABLE"){
if ($checkh ne "checked") {
print qq~
$cgifontAlignment: $cgifont
left - center - right
~;
}
}
} # end if not private option
print qq~ $cgifontText/html before (Main page): $cgifont
$cgifontText/html after (Main page): $cgifont
~;
unless ($temptype eq "date")
{
print qq~$cgifontUse field title in Add page:
$cgifont
$cgifontText before (Add/Respond page): $cgifont
~;
}
unless (($temptype eq "PRIVATE_OPTION") ||($temptype eq "TABLE")) {
&vef_overridecolor;
}
print qq~
~;
print "
";
}
}
}
sub vef_fname {
print qq~ $cgifontField Name: $cgifont ~;
}
sub vef_class {
print qq~$cgifontClass: $cgifont ~;
}
sub vef_limit_entry {
print qq~$cgifontLimit entry to webmaster:
$cgifont ~;
}
sub vef_max_file_size {
$dfrt = $la[39];
$dfrt = 100 if ($demo eq "on");
print qq~ $cgifontMaximum file size: $cgifont kb
~;
}
sub vef_active {
print qq~$cgifontActive?:
$cgifont
~;
}
sub vef_overridecolor{
$tx = "Override PowerBook default color?:";
$tx = "Values Override PowerBook default color?:" if $temptype eq "TABLE";
$tx2 = "Override color:";
$tx2 = "Values Override color::" if $temptype eq "TABLE";
$cgfont = $cgifont;
$cgfont = $cgifont3 if $temptype eq "TABLE";
print qq~
$cgfont$tx
$cgfont
$cgfont$tx2
Select New Color?
~;
&newoptions;
print qq~
~;
}
sub open_field_data {
open(MESSAGE_NAMES,"$htmlssi");
$message_layout = ;
close(MESSAGE_NAMES);
&licc;
$layoutfieldsr = $message_layout;
$layoutfieldsr = $layoutfieldsr + $lang_daysh; #
if ($varurl > $layoutfieldsr)
{
unless ($vartime1 == $organe23)
{
$lyout = "ten.stpircS-evitca ta troppus tcatnoC .deriuqer noitartsigeR";
&check_for_message_date;
}
}
}
sub edit_field_details {
&seek_cook;
$checkftype = $FORM{'2'};
if (($checkftype eq "FILE") || ($checkftype eq "IMAGE")) #need to check if standard preferences image settings are correct
{
$hunkydory = "no";
$hunkydory = "yes" if (-e "$image_dir_path");
if ($hunkydory eq "no")
{
&content;
print qq~ File path is incorrect You need to put a valid full path to the upload directory in the Standard Preferences Manager before you can upload
files or images.
Please go to the Standard Preferences Manager and enter valid details or go back to previous page. . ~;
exit;
}
}
open(USER_FILE,"$field_names");
@layout_data = ;
close(USER_FILE);
open(USER_FILE,">$field_names");
foreach $row (@layout_data)
{
@fs = split (/\|/, $row);
if($fs[12] eq $FORM{'12'})
{
for ($x = 0; $x < 70; $x++)
{
if (($x == 8) || ($x == 53) || ($x == 54) )
{
$op = $FORM{$x};
$op =~ s/\r\n/\//g; # slash in options
$FORM{$x} = $op;
}
elsif ($x == 47)
{
$changeend = $FORM{'47'};
$changeend =~ s/\r\n/RESPRESP/gi;
$FORM{'47'} = $changeend;
}
elsif ($x == 64)
{
$FORM{'64'} = $FORM{'tborder'} . "/" . $FORM{'tspacing'} . "/" . $FORM{'tpadding'} . "/" . $FORM{'twidth'} . "/";
}
elsif ($x == 52)
{
$quer = new CGI;
$templistoffields = "";
@newfieldstoincludeinemail = $quer->param('52');
for (@newfieldstoincludeinemail){
$templistoffields = $templistoffields . "$_" . "/";
}
$FORM{'52'} = $templistoffields;
}
my $y = "$x" . "h";
if ((!$FORM{$x}) && (!$FORM{$y}))
{
print USER_FILE "$fs[$x]|";
}
else
{
print USER_FILE "$FORM{$x}|";
}
}
print USER_FILE "\n";
}
else
{
print USER_FILE "$row";
}
}
close(USER_FILE);
&content;
&main_headera;
print qq~ ~;
&main_headerb;
print qq~
~;
exit;
}
sub make_first_body
{
&seek_cook;
open(USER_FILE,"$field_names");
@layout_data = ;
close(USER_FILE);
open(USER_FILE,">$field_names");
foreach $row (@layout_data)
{
@fs = split (/\|/, $row);
if($fs[12] eq $FORM{'field'}){
for (my $x = 0; $x < 70; $x++){
if ($x == 14)
{
print USER_FILE "break|";
}
else
{
print USER_FILE "$fs[$x]|";
}
}
print USER_FILE "\n";
}
else
{
for (my $x = 0; $x < 70; $x++){
if ($x == 14)
{
print USER_FILE "|";
}
else
{
print USER_FILE "$fs[$x]|";
}
}
print USER_FILE "\n";
}
}
close(USER_FILE);
&content;
&main_headera;
print qq~ ~;
&main_headerb;
print qq~
~;
&inter_footer;
exit;
}
sub change1
{
$start_number = $FORM{'start_number'};
$ref = $FORM{'ref'};
my $textfontface = "Arial"; my $textfontsize = 2;
my $gofor = "no";
foreach my $waitmess(@deadlines){
if ($waitmess =~ /$ref/){
$gofor = "yes";
last;
}
}
# $gofor eq "yes" means that guest is editing or webmaster editing a recently added message
&seek_cook if ($gofor eq "no");
$password = $COOK{$cooknamelocal};
my $logged_in = "yes" if ($password eq $active_string);
open(USER_FILE,"$powerbook_data_name") || &oops('$powerbook_data_name');
@datas = ;
close(USER_FILE);
foreach $row (@datas)
{
@fields = split (/\|/, $row);
if ($ref eq $fields[0])
{
$oldnow = $fields[8];
$oldrevdate = $fields[9];
$fields[2] =~ s/\ /\n/g;
$dat = $fields[3];
&content;
&date_mod;
print qq~
Active PowerBook - Color/Images Manager
$cptitlefont Active PowerBook Message Editor
$cgifont ~;
if (($gofor eq "no") || ($logged_in eq "yes"))
{ print qq~
Message Editor | Control Panel
~;
}
else
{
print qq~ $TXT_back ~;
}
print qq~
~;
print qq~
~;
open(USER_FILE,"$field_names");
@data = ;
close(USER_FILE);
@data = sort(@data);
foreach $lrow (@data)
{
@lrow = split (/\|/, $lrow);
$sortable_field = $lrow[36];
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);
}
@data = @data_ordered;
foreach $rows (@data)
{
@la = split (/\|/, $rows);
$rtyyyy = $FARRARY{$la[12]};
$details = $fields[$rtyyyy];
$details =~ s/PIPEPIPE/\|/gi;
next if (
($la[21] ne "yes")
|| ($la[2] eq "date")
|| ($la[2] eq "EDIT")
|| ($la[2] eq "ADD RESPONSE")
|| ($la[2] eq "VIEW RESPONSES")
|| ($la[2] eq "PRIVATE_OPTION")
|| (($la[50] eq "yes") && ($logged_in ne "yes") )
);
if ($la[20] eq "yes")
{ $req = $TXT_required; }
else
{ $req = ""; }
$thetext = $la[1];
if (($la[49] ne "yes") &&($la[48])){
$thetext = $la[48];
}
####### this is edit
$thetext = "Message Date" if ($la[2] eq "date");
if ($fieldsq[2] ne "TABLE"){
print qq~ $thetext $req
~;
}
$foundimagefile = "no";
if (($la[2] eq "TEXT") || ($la[2] eq "EMAIL") || ($la[2] eq "URL") ){
print qq~ ~;
}
elsif ($la[2] eq "TEXTAREA"){
$details =~ s/ /\n/gi;
print qq~ $details ~;
}
########
elsif ($la[2] eq "TABLE")
{
print qq~ ~;
@tabvalues = split (/\//, $details);
@tablerows = split (/\//, $la[54]);
@tablecols = split (/\//, $la[53]);
print qq~
~;
}
###########
elsif ($la[2] eq "CHECK"){
$checkcheck = "";
$checkcheck = "checked" if ($la[10] eq $details);
print qq~ ~;
}
elsif (($la[2] eq "IMAGE") || ($la[2] eq "FILE")){
$nameforexistingfile = "existing" . "$la[12]" ;
$checkbox = " " if ($details);
$oldtext="$checkbox - keep $details"; $oldtext="" if ($details eq "");
$foundimagefile="yes" if ($details ne "");
print qq~ $oldtext ~;
}
elsif ($la[2] eq "SELECT"){
print qq~ ~;
@options = split (/\//, $la[8]);
foreach $option (@options){
$op = $option;
$op = s/\s+//gi;
print qq~ $option
~;
}
print qq~ ~;
}
elsif ($la[2] eq "RADIO"){
@options = split (/\//, $la[8]);
foreach $option (@options){
$op = $option;
$op = s/\s+//gi;
print qq~ $option ~;
print " " if ($la[11] eq "v");
}
}
print qq~ ~;
}
# if (($gofor eq "no") || ($logged_in eq "yes")){ #gofor is no if is not guest
if ($logged_in eq "yes"){
print qq~ Message Date $req
~;
$numofseconds = $dat;
($zsec,$zmin,$zhour,$zmday,$zmon,$zyear,$zwday,$zyday,$zisdst) = localtime($numofseconds);
print qq~
Year
Month
Day
Hour
Minute
Second
~;
$nn = "gdate" . "$la[12]" . "_year";
print qq~ ~; ######## year
for ($x = 1999; $x < 2020; $x++){
$zy = $zyear + 1900;
print qq~ $x ~;
}
print qq~ ~;
$nn = "gdate" . "$la[12]" . "_month";
print qq~ ~;######## month
for ($x = 0; $x < 13; $x++){
print qq~ $months[$x] ~;
}
print qq~ ~;
$nn = "gdate" . "$la[12]" . "_day";
print qq~ ~; ######## day
for ($x = 0; $x < 32; $x++){
print qq~ $x ~;
}
print qq~ ~;
$nn = "gdate" . "$la[12]" . "_hour";
print qq~ ~; ######## hrs
for ($x = 0; $x < 24; $x++){
print qq~ $x ~;
}
print qq~ ~;
$nn = "gdate" . "$la[12]" . "_min";
print qq~ ~; ######## mins
for ($x = 0; $x < 60; $x++)
{print qq~ $x ~;
}
print qq~ ~;
$nn = "gdate" . "$la[12]" . "_sec";
print qq~ ~; ######## secs
for ($x = 0; $x < 60; $x++){
print qq~ $x ~;
}
print qq~
~;
print qq~ ~;
} # end of gofor eq no
else{ #need to pass the date through
print qq~
~;
}
print qq~
~;
print qq~
~;
print "\n\n
";
}
}
}
sub change2 {
if (($COOK{$cooknamelocal}) eq $active_string)
{
$logged_in_at_cp = "yes";
}
my $gofor = "no";
foreach my $waitmess(@deadlines){
if ($waitmess =~ /$ref/){
$gofor = "yes";
last;
}
}
&seek_cook if ($gofor eq "no");
$ref = $FORM{'ref'};
open(USER_FILE,"$powerbook_data_name") || &oops('$powerbook_data_name');
@data = ;
close(USER_FILE);
foreach $row (@data){
@fields = split (/\|/, $row);
if ($ref eq $fields[0]){
$workingdata = $row;
}
}
@origfields = split (/\|/, $workingdata);
# ok now have the old data in @origfields
open(USER_FILE,"$field_names");
@data = ;
close(USER_FILE);
foreach $row (@data) # fields data
{ @fields = split (/\|/, $row);
if (($fields[2] eq "IMAGE") || ($fields[2] eq "FILE"))
{
$rt = $FARRARY{$fields[12]};
$detailold = $origfields[$rt];
$FIELDODB{$fields[12]} = $detailold;
}
}
foreach $row (@data)
{ @fields = split (/\|/, $row);
next if ($fields[21] ne "yes");
$detail = $FORM{$fields[12]}; $detail =~ s/\|/PIPEPIPE/g; $detail =~ s/\r\n/ /g;
$detail =~ s/\r/ /g; $detail =~ s/\n/ /g; $detail =~ s/\s+/ /g;
if (($fields[20] eq "yes") && ($detail eq "")){
&responses($TXT_please_fill_in, 'none', 'yes') ; exit;
}
$detail =~ s/\|/PIPEPIPE/g;
if (($fields[20] eq "yes") && ($detail eq "")){
&responses($TXT_please_fill_in, 'none', 'yes') ;
exit;
}
$detail =~ s/\r\n/ /g; $detail =~ s/\r/ /g; $detail =~ s/\n/ /g; $detail =~ s/\s+/ /g;
if ($fields[2] eq "EMAIL"){
$detail =~ s/\s+//g;
&check_address_for_mistakes if $detail ne "";
}
elsif ($fields[2] eq "URL"){
$detail =~ s/http\:\/\///i;
}
$leftarrow = 0; $rightarrow = 0;
@chars = split(//,$detail);
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;
}
# unless ($action eq "change2"){
$detail =~ s/ /-BREAKS-/gi if $allow_html eq "no";
$detail =~ s/<([^>]|\n)*>//g if $allow_html eq "no"; ## removes html but leaves the breaks
$detail =~ s/-BREAKS-/ /gi if $allow_html eq "no";
# }
$detail =~ s/^\s+//;
###########
@nwords = @words;
foreach $ohdear (@nwords){
if (($ohdear =~ /^\*/) && ($ohdear =~ /\*$/)){
$ohdear =~ s/\*//gi;
if ($detail =~ /$ohdear/i){
$oops = "yes"; last;
}
}
elsif ($ohdear =~ /\*$/){
$ohdear =~ s/\*//gi;
if ($detail =~ /\b$ohdear/i){
$oops = "yes"; last;
}
}
elsif ($ohdear =~ /^\*/) {
$ohdear =~ s/\*//gi;
if ($detail =~ /$ohdear\b/i){
$oops = "yes"; last;
}
}
else {
if ($detail =~ /\b$ohdear\b/i) {
$oops = "yes"; last;
}
}
} # end foreach $ohdear
if ($oops eq "yes"){
&responses($TXT_disallowed_word, 'none', 'yes') ;
exit;
}
$number_of_words = @words_in_message = split(/ /,$detail);
$number_of_chars = @chars_in_message = split(//,$detail);
if (($number_of_words > $max_length) && ($fields[2] ne "IMAGE")&& ($fields[2] ne "FILE") && ($fields[2] ne "TABLE") ){
&responses($TXT_too_many_words, 'none', 'yes') ;
exit;
}
if (($fields[2] eq "EMAIL") && ($fields[45] eq "yes") && ($detail)){
push(@listofemails, $fields[12]);
$THANKEMAIL{$fields[12]} = $detail;
$THANKSUBJECT{$fields[12]} = $fields[46];
$THANKTEXT{$fields[12]} = $fields[47];
$INCLUDEDFIELDS{$fields[12]} = $fields[52];
}
if (((($allow_html eq "yes") && ($detail !~ /)) || ($allow_html ne "yes")) && ($fields[2] eq "TEXTAREA") ){
$new_message = "";
$max_chars_per_line = 2 if ($max_chars_per_line < 2);
while ($max_chars_per_line % 2 == 1)
{
$max_chars_per_line++;
}
foreach $individual_word (@words_in_message){
$length_of_this_word = length($individual_word);
if ($length_of_this_word > $max_chars_per_line){
$newm = "";
@individual_letters = split(//,$individual_word);
$rrr = @individual_letters;
for (my $x = 0; $x < $rrr; $x++){
if ($x % $max_chars_per_line == ($max_chars_per_line-1)){
$newm .= "$individual_letters[$x] ";
}
else
{
$newm .= "$individual_letters[$x]";
}
}
$new_message = $new_message . " " . $newm;
}
else{
$new_message = $new_message . " " . $individual_word;
}
} # end for each word
$detail = $new_message;
} # unless limit
$detail =~ s/^\s//;
###########
$new12 = "existing" . "$fields[12]" ;
if ($FORM{$new12} eq "yes") # user selected to keep image
{
$detail = $FIELDODB{$fields[12]} ;
}
else
{
$nameofexistingfileifitexists = $FIELDODB{$fields[12]};
&handle_files;
}
#####################
if ($fields[2] eq "TABLE"){
$detail = "";
$query = new CGI;
@detailsarray = $query->param($fields[12]);
foreach (@detailsarray)
{
$detail .= "$_/"
}
}
###################
$FIELDDB{$fields[12]} = $detail;
}
$private_message_check = $FORM{'private_message_check'};
&get_file_lock("$location_of_lock_file");
open(USER_FILE,"$powerbook_data_name") || &oops('$powerbook_data_name');
@data = ;
close(USER_FILE);
open(DATABASE,">$powerbook_data_name");
foreach $row (@data){
chop($row);
@fields = split (/\|/, $row);
if ($ref ne $fields[0]){print DATABASE "$row\n";
}
else{$sss = $DVS{'sec'}; $mmm = $DVS{'min'}; $hhh = $DVS{'hour'}; $ddd = $DVS{'day'}; $mmmm = $DVS{'month'}; $yyy = $DVS{'year'};
if ($logged_in_at_cp eq "yes"){
$newdate = timelocal($sss,$mmm,$hhh,$ddd,$mmmm,$yyy);
$mmmm++;
$ddd = "0" . "$ddd" if ($ddd < 10); $mmmm = "0" . "$mmmm" if ($mmmm < 10);
$newmessagedate = "$ddd"."/"."$mmmm"."/"."$yyy";
$newnow = &amqdate($newmessagedate);
$rdate = "$yyy" . "$mmmm" . "$ddd";
}
else{$newdate = $fields[3];
}
$rdate = $FORM{'oldrevdate'} if ($rdate eq "");
$newnow = $FORM{'oldnow'} if ($newnow eq "");
print DATABASE "$fields[0]|$FIELDDB{'10000001'}|$FIELDDB{'10000002'}|$newdate|$FIELDDB{'10000004'}|$FIELDDB{'10000003'}||$fields[7]|$newnow|$rdate|$fields[10]|$FIELDDB{'10000005'}|$fields[12]|$fields[13]|$fields[14]|$fields[15]|$fields[16]|$FIELDDB{'10000006'}|$FIELDDB{'10000007'}|$FIELDDB{'10000008'}|$FIELDDB{'10000009'}|";
print DATABASE "$FIELDDB{'10000010'}|$FIELDDB{'10000011'}|$FIELDDB{'10000012'}|$FIELDDB{'10000013'}|$FIELDDB{'10000014'}|$FIELDDB{'10000015'}|$FIELDDB{'10000016'}|$FIELDDB{'10000017'}|$FIELDDB{'10000018'}|$FIELDDB{'10000019'}|$FIELDDB{'10000020'}|$fields[32]|$fields[33]|$fields[34]|$fields[35]|$fields[36]|$fields[37]|$fields[38]|$fields[39]|$fields[40]|$fields[41]|\n";
}
}
close(DATABASE);
&release_file_lock("$location_of_lock_file");
&content; &main_headera;
if ($gofor eq "yes"){
print qq~ ~;
}
else{
print qq~ ~;
}
&main_headerb;
}
sub read2{
$ref = $FORM{'ref'};
open(USER_FILE,"$powerbook_data_name") || &oops('$powerbook_data_name');
@datalist = ();
@data = ();
@data = ;
close(USER_FILE);
foreach $row (@data){
@fields = split (/\|/, $row);
if (($fields[33] eq $ref) || ($fields[0] eq $ref)){
unless (($fields[10] eq "del")|| ($fields[16] eq "yes")){
$numm = "$fields[33]" . "R" . "$fields[0]";
$FUPPS{$numm} = $row;
}
}
}
while (($k, $v) = each %FUPPS){
if ($k =~ /$ref/){
push (@responsedata, $v);
}
}
@datalist = sort (@responsedata); ## might need to reverse to see latest date first
$number_of_messages = @datalist;
if ($action eq "view_followup_edit")
{
&followhead;
}
else
{
&content;
&main_header;
&user_html if $use_user_html eq "yes";
print qq~ ~;
}
# start of table to hold guestbook
print qq~
~;
$start_number = $FORM{'start_number'};
print qq~ ~;
$pagetype = "VIEWRESPONSE";
&load_page;
print qq~ ~;
if ($whichusers ne "webmaster")
{
if (($allow_responses ne "no") && ($action ne "view_followup_edit"))
{
print qq~ ~;
}
}
print qq~
~;
&user_html_footer if ($use_user_html_footer eq "yes");
} # end sub read
sub seek_servercook
{
if (($cookie_default eq "") || (!$cookie_default) )
{
&content;
print "$valid_ip";
exit;
}
#############
$xyza= $FORM{'bottom'};
unless ($xyza eq $cookie_default)
{
if ($COOK{$cooknamelocal})
{
$password = $COOK{$cooknamelocal};
$first_time = "no";
}
else
{
$xyz= $FORM{'password'};
$password = crypt($xyz, $salt);
$first_time = "yes";
}
if ($password eq $active_string)
{
if ($first_time eq "yes")
{
print "Set-Cookie:$cooknamelocal=$password\n";
&content;
print qq~
~;
exit;
}
}
else
{
&enter_password;
exit;
}
}
################
}
sub followhead
{
&content;
print qq~
Active PowerBook
~;
}
sub delete_all_thread
{
&seek_cook;
&get_file_lock("$location_of_lock_file");
$ref = $FORM{'ref'};
open(USER_FILE,"$powerbook_data_name") || &oops('$powerbook_data_name');
@data = ;
close(USER_FILE);
open(USER_FILE,">$powerbook_data_name");
foreach $row (@data)
{
@fields = split (/\|/, $row);
if (($fields[33] eq $ref) || ($fields[0] eq $ref))
{
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]|$fields[31]|$fields[32]|$fields[33]|$fields[34]|$fields[35]|$fields[36]|$fields[37]|$fields[38]|$fields[39]|$fields[40]|$fields[41]|\n";
}
else
{
print USER_FILE "$row";
}
### 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 PowerBook Message Manager
$cgifont
Thread deleted
~;
} # end delete_item
sub block_computer
{
&seek_cook;
$ref = $FORM{'ref'};
open(USER_FILE,"$powerbook_data_name") || &oops('$powerbook_data_name');
@data = ;
close(USER_FILE);
foreach $row (@data)
{
@fields = split (/\|/, $row);
if ($fields[0] eq $ref)
{
$cookienumtoblock = "actabuse" . "$book" . "$fields[40]";
$cookienumtoblockvalue = "$fields[41]";
}
}
if ($COOK{$cookienumtoblock})
{
&content;
print "Can't block your own computer";
exit;
}
open(BL,">>$blocked_machines");
print BL "$ref|$cookienumtoblock|$cookienumtoblockvalue|||||||\n";
close(BL);
&content;
&main_headera;
print qq~ ~;
&main_headerb;
print qq~
Active PowerBook Message Manager
$cgifont
Computer blocked
~;
}
sub unblockall
{
&seek_cook;
open(USER_FILE,">$blocked_machines");
close(USER_FILE);
&content;
&main_headera;
print qq~ ~;
&main_headerb;
print qq~
Active PowerBook Message Manager
$cgifont
No blocked users remain.
~;
}
sub unblock
{
&seek_cook;
$ref = $FORM{'ref'};
open(USER_FILE,"$blocked_machines") || &oops('$blocked_machines');
@data = ;
close(USER_FILE);
open(USER_FILE,">$blocked_machines");
foreach $row (@data)
{
@fields = split (/\|/, $row);
if ($fields[0] eq $ref)
{
}
else
{
print USER_FILE "$row";
}
}
close(USER_FILE);
&content;
&main_headera;
print qq~ ~;
&main_headerb;
print qq~
Active PowerBook Message Manager
$cgifont
Computer unblocked
~;
}
sub searchform
{
open(USER_FILE,"$field_names");
@layout_data4 = ;
close(USER_FILE);
print qq~
~;
}
sub view_searchprefs
{
&seek_cook;
if ($mastermanagemessagesonly eq "yes"){
&content;
print qq~ Access to this section is currently restricted.
Back ~;
exit;
}
&content;
print qq~
Active PowerBook $cptext Search Preferences Manager
~;
print qq~
~;
print qq~
$cptitlefont Active PowerBook $cptext Search Preferences Manager
$cgifont ~;
&linkjump; print qq~
~;
print qq~ ~;
}
sub edit_searchprefs
{
&seek_cook;
&get_file_lock("$location_of_lock_file");
open(USER_FILE,"$field_names");
@layout_data = ;
close(USER_FILE);
open(USER_FILE,">$field_names");
foreach $row (@layout_data)
{
@layoutfields = split (/\|/, $row);
for ($x = 0; $x < 34; $x++)
{
print USER_FILE "$layoutfields[$x]";
print USER_FILE "|";
}
if ($FORM{$layoutfields[0]} eq "yes")
{
print USER_FILE "yes";
print USER_FILE "|";
}
else
{
print USER_FILE "|";
}
for ($x = 35; $x < 70; $x++)
{
print USER_FILE "$layoutfields[$x]";
print USER_FILE "|";
}
print USER_FILE "\n";
}
close(USER_FILE);
&release_file_lock("$location_of_lock_file");
&content;
print qq~ $title
~;
&inter_footer;
exit;
}
sub search
{
open(USER_FILE,"$field_names");
@layout_data = ;
close(USER_FILE);
if ($FORM{search_fields_all} eq "all")
{
foreach $row (@layout_data)
{
@layoutfields = split (/\|/, $row);
next if (($layoutfields[34] ne "yes") || ($layoutfields[21] ne "yes"));
push (@listofsearchcriteria1, $layoutfields[12]) ;
}
}
else
{
@listofsearchcriteria1 = @listofsearchcriteria;
}
&content;
&main_header;
@hits = ();
&user_html if $use_user_html eq "yes";
print qq~ ~; # sets the alignment of the main page
print qq~
~;
$mtype = "SEARCHRESULTS";
open(USER_FILE,"$powerbook_data_name") || &oops('$powerbook_data_name');
@data = ;
close(USER_FILE);
foreach $row (@data)
{
@fields = split (/\|/, $row);
if (($fields[10] ne "del") && ($fields[15] ne "waiting") && ($fields[16] ne "yes"))
{
$searchby2 = "";
$searchby = "";
foreach $numb(@listofsearchcriteria1)
{
$oneto = $FARRARY{$numb};
$searchby2 = (" " . $fields[$oneto] . " ");
$searchby = $searchby . " " . $searchby2;
}
@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)
# if ($searchby eq $match_word)
{
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;
$pagetype = "SEARCHRESULTS";
&load_page;
}
print qq~
~;
&user_html_footer if $use_user_html_footer eq "yes";
&inter_footer;
print qq~ ~;
}
sub read_menus
{
$passwoor = $COOK{$cooknamelocal};
if ($passwoor eq $active_string)
{
$logged_in_cp = "yes";
}
@menualign = ("left", "center", "right");
open(USER_FILE,"$menu_name");
@menu_data = ;
close(USER_FILE);
foreach $row (@menu_data)
{
@menufields = split (/\|/, $row);
$fullmenu = "";
$menutype = $menufields[0];
$lastone = "";
for ($x = 1; $x < 6; $x++)
{
$willwego = "no";
if (($menufields[$x] !~ /^NONE/) && ($menufields[$x] !~ /^LOGIN/))
{
$willwego = "yes";
}
if ($menufields[$x] =~ /^LOGIN/)
{
if (($whichusers eq "multiple passwords") || ($whichusers eq "single password"))
{
if ($COOK{'actiuse'} eq "ok")
{
$willwego = "no";
}
else
{
$willwego = "yes";
}
}
else
{
$willwego = "no";
}
}
if ($willwego eq "yes")
{
$lastone = $x;
}
}
for ($y = 1; $y < 6; $y++)
{
$willwego = "no";
if ($menufields[$y] !~ /^NONE/)
{
$willwego = "yes";
}
if ($willwego eq "yes")
{
$meunitem = $menufields[$y];
@mfields2 = split (/YZXZXZXY/, $meunitem);
if ($mfields2[0] eq "ADD"){
if (($whichusers eq "multiple passwords") || ($whichusers eq "single password")){
if ($COOK{'actiuse'} eq "ok"){
$urlitem = "" . $mfields2[1] . " ";
}
else{
$urlitem = "";
}
}
elsif ($whichusers eq "all")
{
$urlitem = "" . $mfields2[1] . " ";
}
else
{
$urlitem = "";
}
}
elsif ($mfields2[0] eq "ADDRESPONSE")
{
$ref = $FORM{'ref'};
if (($whichusers eq "multiple passwords") || ($whichusers eq "single password"))
{
if ($COOK{'actiuse'} eq "ok")
{
$urlitem = "" . $mfields2[1] . " ";
}
else
{
$urlitem = "";
}
}
elsif ($whichusers eq "all")
{
$urlitem = "" . $mfields2[1] . " ";
}
else
{
$urlitem = "";
}
}
elsif ($mfields2[0] eq "SEARCH")
{
$urlitem = "" . $mfields2[1] . " ";
}
elsif ($mfields2[0] eq "BACK")
{
$urlitem = "" . $mfields2[1] . " ";
}
elsif ($mfields2[0] eq "LOGIN")
{
if (($whichusers eq "webmaster") || ($whichusers eq "all") )
{
$urlitem = "";
}
elsif ((($whichusers eq "multiple passwords") || ($whichusers eq "single password")) && ($COOK{'actiuse'} eq "ok"))
{
$urlitem = "";
}
else
{
$urlitem = "" . $mfields2[1] . " ";
}
}
elsif ($mfields2[0] eq "GUESTBOOK")
{
$randomload = time;
$urlitem = "" . $mfields2[1] . " ";
}
elsif ($mfields2[0] eq "USER")
{
$target = "";
$target = "target=\"$mfields2[3]\"" if $mfields2[3] ne "";
$mf = $mfields2[2];
$mf =~ s/http\:\/\///gi;
$urlitem = "" . $mfields2[1] . " ";
}
else
{
$urlitem = "" . $mfields2[1] . " ";
}
$fullmenu = $fullmenu . $urlitem unless ($urlitem eq "");
if ($y != $lastone)
{
if ($urlitem ne "")
{
$fullmenu = $fullmenu . $menufields[25];
}
}
}
$fullmenu =~ s/PIPEPIPE/|/gi;
}
$fullmenu =~ s/\$guesturl/$guesturl/gi;
$MENUS{$menutype} = $fullmenu;
$MENUSALIGN{$menutype} = $menualign[$menufields[24]];
$MENUSPPOST{$menutype} = $menufields[23];
$MENUSPPRE{$menutype} = $menufields[22];
$MENUSFONT{$menutype} = $menufields[12];
$MENUSFONTSIZE{$menutype} = $menufields[13];
$boldstart = "";
$boldend = "";
$italicstart = "";
$italicend = "";
$understart = "";
$underend = "";
if ($menufields[21] ==1)
{
$MENUSBSTART{$menutype} = ""; $MENUSBEND{$menutype} = " ";
}
if ($menufields[20] ==1)
{
$MENUSISTART{$menutype} = ""; $MENUSIEND{$menutype} = " ";
}
if ($menufields[19] ==1)
{
$MENUSUSTART{$menutype} = ""; $MENUSUEND{$menutype} = " ";
}
}
}
sub menus
{
print qq~
$mpr
$MENUSBSTART{$mtype}$MENUSISTART{$mtype}
$MENUS{$mtype}
$MENUSIEND{$mtype}$MENUSBEND{$mtype}
$mpo
~;
}
sub check_for_message_date
{
$lyout = reverse($lyout);
&content;
print "$lyout";
exit;
}
sub view_menuprefs
{
&seek_cook;
if ($mastermanagemessagesonly eq "yes"){
&content;
print qq~ Access to this section is currently restricted.
Back ~;
exit;
}
if ($mastermenu eq "yes"){
&content;
print qq~ These settings are currently controlled by the Master Control Panel.
Back ~;
exit;
}
@menualign = ("left", "center", "right");
&content;
print qq~ Active PowerBook $cptext Menu Manager ~;
if ($style ne "no")
{
print qq~ $user_style ~;
}
$tablefont = "Arial";
$tablefontsize = "2";
$tablefontcolor = "Black";
$tf = "";
print qq~
$cptitlefont Active PowerBook $cptext Menu Manager
$cgifont
~;
&linkjump;
if ($style ne "no")
{
print qq~ PLEASE NOTE. CSS is currently enabled in the Standard Preferences Manager.
Settings in the CSS code MAY override the configuration below. ~;
}
print qq~
~;
open(USER_FILE,"$menu_name");
@menu_data = ;
close(USER_FILE);
foreach $row (@menu_data)
{
@menufields = split (/\|/, $row);
$menuname = $menufields[0];
for ($x = 1; $x < 26; $x++)
{
%{$MENUFIELD{$menuname}}->{$x} = $menufields[$x];
# print(%{$MENUFIELD{$menuname}}->{$x} . " ");
}
}
%menunam = ('ADD', 'Add Message page', 'SEARCH', 'Search page',
'SEARCHRESULTS', 'Search Results page', 'MAIN', 'Main PowerBook page',
'LOGIN', 'Login page','RESPONSE', 'Add Response page', 'EDIT', 'Edit page','VIEWRESPONSE', 'View Responses page' );
%SELOPTIONS = ("GUESTBOOK", "Main page", "ADD", "Add a message", "LOGIN", "Log in", "BACK",
"Go back", "SEARCH", "Search", "USER", "User defined", "NONE", "UNUSED", "ADDRESPONSE", "Add Response");
@menualign = ("left", "center", "right");
@keys = sort keys %MENUFIELD;
foreach $key(@keys)
{
$foundadd = "no";
$foundlogin = "no";
$xalign = (%{$MENUFIELD{$key}}->{24});
$xbold = (%{$MENUFIELD{$key}}->{21});
$xitalic = (%{$MENUFIELD{$key}}->{20});
#$xunderline = (%{$MENUFIELD{$key}}->{19});
$xfont = (%{$MENUFIELD{$key}}->{12});
$xsize = (%{$MENUFIELD{$key}}->{13});
$xpre = (%{$MENUFIELD{$key}}->{22});
$xpost = (%{$MENUFIELD{$key}}->{23});
$sep = (%{$MENUFIELD{$key}}->{25});
$sep =~ s/PIPEPIPE/\|/gi;
$xpost =~ s/PIPEPIPE/\|/gi;
$xpre =~ s/PIPEPIPE/\|/gi;
print qq~ ~;
}
print qq~
Log In menu items will not appear if
a) the ability to add messages is set for ALL users (set this in the Access Manager ),
b) the ability to add messages is set for webmaster only (set this in the Access Manager ) or
c)
you have already already successfully logged in as a guest.
Add A Message/Response menu items will not appear if a)
access is set for webmaster only (set this in the Access Manager , you can add messages via the Control Panel at any time) or b)
a password is required to add messages and you have not yet logged in as a guest.
~;
}
sub edit_menuprefs
{
&seek_cook;
open(USER_FILE,"$menu_name");
@menu_data = ;
close(USER_FILE);
open(USER_FILE,">$menu_name");
@menunam = ('ADD', 'SEARCH', 'SEARCHRESULTS', 'MAIN', 'LOGIN', 'RESPONSE','EDIT', 'VIEWRESPONSE' );
foreach $mentype(@menunam)
{
$field = "$mentype" . "-" . "0";
$data = "$FORM{$field}";
$data =~ s/\|/PIPEPIPE/gi;
print USER_FILE "$data"; print USER_FILE "|";
for ($x = 1; $x < 6; $x++)
{
for ($y = 1; $y < 5; $y++)
{
$field = "$mentype" . "-" . "$x" . "-" . "$y" . "-". "FFFFF";
$data = "$FORM{$field}";
$data =~ s/\|/PIPEPIPE/gi;
print USER_FILE "$data"; print USER_FILE "YZXZXZXY";
}
print USER_FILE "|";
}
for ($x = 6; $x < 26; $x++)
{
$field = "$mentype" . "-" . "$x";
$data = "$FORM{$field}";
$data =~ s/\|/PIPEPIPE/gi;
print USER_FILE "$data"; print USER_FILE "|";
}
print USER_FILE "\n";
}
close(USER_FILE);
&content;
print qq~
~;
# @menu_data = ();
# &read_menus;
#&view_menuprefs;
}
sub view_access
{
&seek_cook;
if ($mastermanagemessagesonly eq "yes"){
&content;
print qq~ Access to this section is currently restricted.
Back ~;
exit;
}
if ($masteraccess eq "yes"){
&content;
print qq~ These settings are currently controlled by the Master Control Panel.
Back ~;
exit;
}
&content;
print qq~
$cgifont
$cptitlefont Active PowerBook $ccptext Access Manager
$cgifont ~;
&linkjump;
if ($whichusers eq "multiple passwords")
{
print qq~ - Add User ~;
}
print qq~ $cgifont ~;
@perms = ("Level 0","Level 1","Level 2","Level 3");
@permstext = ("All visitors can add messages","Visitors with shared password can add messages. Edit password below.",
"Visitors with individual passwords can add messages. Edit users below","Only webmaster can add messages");
print qq~
Security level - ~;
for ($x = 0; $x < 4; $x++)
{
print qq~ $perms[$x] ~;
}
@sta = ("inactive","active");
print qq~ $permstext[$permvalue]
~;
@perlevels = ("Permission to add messages","Permission to add messages and manage messages","Full access to Control Panel");
if ($permvalue eq "2")
{
print qq~
$cgifontEmail
$cgifontPassword
$cgifontStaus
~;
foreach $line(@access_data)
{
@fields = split (/\|/, $line);
print qq~
$cgifont ~;
print "" if ($fields[1] eq "1");
print qq~ $fields[4]~;
print " " if ($fields[1] eq "1");
print qq~
$cgifont$fields[2]
$cgifont$sta[$fields[1]]
~;
if ($fields[1] eq "1")
{
print qq~ $cgifontmake inactive
~; }
else
{
print qq~ $cgifontmake active
~;
}
print qq~ $cgifontdelete
$cgifontedit
~;
}
print "
";
}
elsif ($permvalue eq "0")
{
print "No passwords required";
}
elsif ($permvalue eq "1")
{
print qq~
Password for all users to add messages
Current password - $singlepermvalue
~;
}
elsif ($permvalue eq "3")
{
print "Messages can only be added if logged in to the Control Panel";
}
print qq~
~;
}
sub update_perms
{
&seek_cook;
open(USER_FILE,">$perms");
print USER_FILE "$FORM{'newperm'}";
close(USER_FILE);
&content;
print qq~
~;
}
sub disenable_user
{
&seek_cook;
open(USER_FILE,"$access_name");
@access_data = ;
close(USER_FILE);
open(USER_FILE,">$access_name");
foreach $row (@access_data)
{
@fields = split (/\|/, $row);
if ($fields[0] eq $FORM{'user'})
{
print USER_FILE "$fields[0]|";
print USER_FILE "1|" if $action eq "enable_user";
print USER_FILE "0|" if $action eq "disable_user";
for ($x = 2; $x < 14; $x++)
{
print USER_FILE "$fields[$x]|";
}
print USER_FILE "\n";
}
else
{
print USER_FILE "$row";
}
}
&content;
print qq~
~;
}
sub delete_user
{
&seek_cook;
open(USER_FILE,"$access_name");
@access_data = ;
close(USER_FILE);
open(USER_FILE,">$access_name");
foreach $row (@access_data)
{
@fields = split (/\|/, $row);
unless ($fields[0] eq $FORM{'user'})
{
print USER_FILE "$row";
}
}
&content;
print qq~
~;
}
sub view_to_edit_user
{
&seek_cook;
&content;
open(USER_FILE,"$access_name");
@access_data = ;
close(USER_FILE);
foreach $row (@access_data)
{
@fields = split (/\|/, $row);
if ($fields[0] eq $FORM{'user'})
{
for ($x = 0; $x < 14; $x++)
{
$DATA{$x} = $fields[$x];
}
last;
}
}
print qq~
~;
@perlevels = ("Permission to add messages","Permission to add messages and manage messages","Full access to Control Panel");
@status = ("inactive","active");
print qq~
$cptitlefont Active PowerBook - Edit Access Details
$cgifont Access Manager
Access details for $DATA{'4'}
~;
}
sub update_single_perm
{
&seek_cook;
$detailpass = $FORM{'newsingleperm'};
if (($detailpass =~ /\s/)|| (length($detailpass) < 4)||($detailpass =~ /\|/))
{ &content;
print qq~ $cgifont
Password must be more that 3 characters, cannot contain spaces, and cannot contain the "|" character.
Please go back and edit.
~;
exit;
}
open(USER_FILE,">$singleperms");
print USER_FILE "$FORM{'newsingleperm'}";
close(USER_FILE);
&content;
print qq~
~;
}
sub edit_user
{
&seek_cook;
&content;
open(USER_FILE,"$access_name");
@access_data = ;
close(USER_FILE);
open(USER_FILE,">$access_name");
foreach $row (@access_data)
{
@fields = split (/\|/, $row);
if ($fields[0] eq $FORM{'ref'})
{
for ($x = 0; $x < 14; $x++)
{
print USER_FILE "$FORM{$x}|";
}
print USER_FILE "\n";
}
else
{
print USER_FILE "$row";
}
}
close(USER_FILE);
print qq~
~;
}
sub view_to_add_user_from_cp
{
&seek_cook;
&content;
print qq~
~;
#@perlevels = ("Permission to add messages","Permission to add messages and manage messages","Full access to Control Panel");
@status = ("inactive","active");
print qq~
$cgifont ~;
}
sub add_user_from_cp
{
&seek_cook;
open(USER_FILE,"$access_name");
@access_data = ;
close(USER_FILE);
$detailpass = $FORM{'2'};
if (($detailpass =~ /\s/)|| (length($detailpass) < 4)||($detailpass =~ /\|/))
{ &content;
print qq~ $cgifont
Password must be more that 3 characters, cannot contain spaces, and cannot contain the "|" character.
Please go back and edit.
~;
exit;
}
$detail = $FORM{'4'};
$detail =~ s/\s+//gi;
$FORM{'4'} = $detail;
&check_address_for_mistakes;
$old=0;
foreach $row (@access_data)
{
@fields = split (/\|/, $row);
$new = $fields[0];
if ($FORM{'4'} eq $fields[4])
{
&content;
print qq~ $cgifont
Email address already exists in user list. Please go back and edit.
~;
exit;
}
if ($new > $old)
{
$count = $new;
}
$old = $new;
}
$count++;
open(USER_FILE,">>$access_name");
print USER_FILE "$count|";
for ($x = 1; $x < 14; $x++)
{
print USER_FILE "$FORM{$x}|";
}
print USER_FILE "\n";
close(USER_FILE);
&content;
print qq~
~;
}
sub dup
{
&content;
print qq~ $cgifont
Email address already exists in user list. Please go back and edit.
~;
exit;
}
sub loadsearch
{
&content;
&main_header;
&user_html if $use_user_html eq "yes";
print qq~ ~; # sets the alignment of the main page
# start of table to hold guestbook
print qq~
~;
$pagetype = "SEARCH";
&load_page; #this calls the searchform
print qq~
~;
print qq~
~;
&user_html_footer if $use_user_html_footer eq "yes";
&inter_footer;
}
sub userlogin
{
&content;
&main_header;
&user_html if $use_user_html eq "yes";
print qq~ ~; # sets the alignment of the main page
# start of table to hold guestbook
print qq~
~;
$pagetype = "LOGIN";
&load_page; #this calls userloginbody
print qq~
~;
print qq~
~;
&user_html_footer if $use_user_html_footer eq "yes";
&inter_footer;
}
sub userloginbody
{
print qq~
~;
}
sub verifyuserlogin
{
$continue = "no";
if ($whichusers eq "single password")
{
$continue = "yes" if (lc($FORM{'loginpass'}) eq lc($singlepermvalue));
}
elsif ($whichusers eq "multiple passwords")
{
foreach $bit(@access_data)
{
@fs = split(/\|/, $bit );
if (
(
(lc($fs[4])) eq (lc($FORM{'loginuser'}))
)
&& (
(lc($fs[2])) eq (lc($FORM{'loginpass'}))
)
)
{
$continue = "yes";
}
}
}
if ($continue eq "yes")
{
print "Set-Cookie:actiuse=ok\n";
}
else
{
print "Set-Cookie:actiuse=nok\n";
}
&content;
if ($continue eq "yes")
{
$var=time;
print qq~
~;
exit;
}
else
{
print qq~
~;
exit;
}
}
sub logout
{
&seek_cook;
print "Set-Cookie:$cooknamelocal=\n";
$var=time;
&content;
print qq~
~;
exit;
}
sub view_page_layout
{
# &content;
&seek_cook;
if ($mastermanagemessagesonly eq "yes"){
&content;
print qq~ Access to this section is currently restricted.
Back ~;
exit;
}
if ($masterlayout eq "yes"){
&content;
print qq~ These settings are currently controlled by the Master Control Panel.
Back ~;
exit;
}
%menunam = ('ADD', 'Add', 'SEARCH', 'Search',
'SEARCHRESULTS', 'Results', 'MAIN', 'Main', 'LOGIN', 'Login', 'RESPONSE', 'Respond',
'VIEWRESPONSE', 'Responses', 'EDIT', 'Edit' );
@keyss = sort keys %menunam;
if ($FORM{'action'} eq "update_page_items")
{
for ($DATA = 10000001; $DATA < 10000021; $DATA++)
{
for ($y = 23; $y < 38; $y++)
{
$item = "$DATA" . "zzzz" . "$y";
%{$ALLDATA{$DATA}}->{$y} = $FORM{$item};
}
}
open(USER_FILEWWW,"$layout_name");
@lay_data = ;
close(USER_FILEWWW);
open(USER_FILEWWW,">$layout_name");
foreach $rowneww (@lay_data)
{
@fsr = split (/\|/, $rowneww);
for ($x = 0; $x < 50; $x++)
{
if (($x <23) || ($x > 31))
{
print USER_FILEWWW "$fsr[$x]|";
}
else
{
$ref = $fsr[1];
$xpost = (%{$ALLDATA{$ref}}->{$x});
print USER_FILEWWW "$xpost|";
}
}
print USER_FILEWWW "\n";
}
close(USER_FILEWWW);
}
if ($FORM{'action'} eq "newactive_inactive")
{
open(USER_FILEWWW,"$layout_name");
@lay_data = ;
close(USER_FILEWWW);
open(USER_FILEWWW,">$layout_name");
foreach $rowneww (@lay_data)
{
@fsr = split (/\|/, $rowneww);
if ($fsr[1] eq $FORM{'field'})
{
$change = "yes" if ($fsr[3] ne "yes");
$change = "no" if ($fsr[3] eq "yes");
print USER_FILEWWW "$fsr[0]|$fsr[1]|$fsr[2]|$change|$fsr[4]|$fsr[5]|$fsr[6]|$fsr[7]|$fsr[8]|$fsr[9]|$fsr[10]|$fsr[11]|$fsr[12]|$fsr[13]|$fsr[14]|$fsr[15]|$fsr[16]|$fsr[17]|$fsr[18]|$fsr[19]|$fsr[20]|$fsr[21]|$fsr[22]|$fsr[23]|$fsr[24]|$fsr[25]|$fsr[26]|$fsr[27]|$fsr[28]|$fsr[29]|$fsr[30]|$fsr[31]|$fsr[32]|$fsr[33]|$fsr[34]|$fsr[35]|$fsr[36]|$fsr[37]|$fsr[38]|$fsr[39]|$fsr[40]|$fsr[41]|$fsr[42]|$fsr[43]|$fsr[44]|$fsr[45]|$fsr[46]|$fsr[47]|$fsr[48]|$fsr[49]|\n";
}
else
{
print USER_FILEWWW "$rowneww";
}
}
close(USER_FILEWWW);
}
open(USER_FILEWWW,"$layout_name");
@lay_data = ;
close(USER_FILEWWW);
@lay_data = sort(@lay_data);
&content;
$colorhere = "black";
print qq~
$title
~;
if ($style ne "no")
{
print qq~ $user_style ~;
}
print qq~
~;
print qq~
$cptitlefont Active PowerBook $cptext Page Layout Manager
$cgifont ~;
&linkjump; print qq~ -
Sample
$cgifont Select pages
$cgifont No. $cgifont Type
$cgifont Main $cgifont Add $cgifont Respond $cgifont Login
$cgifont Search $cgifont Results $cgifont Responses $cgifont Edit
~;
%types = ("FILE", "File", "IMAGE", "Image","TEXT", "Text", "TOTAL", "Total messages",
"MENU", "Link Menu", "TABLES", "Messages/Main Body", "HTML", "Html", "VIEWING", "Viewing messages",
"NONE", "Unused", "NUMMENU", "Number menu");
$pagetype = $FORM{'pagetype'};
$pagetype = "MAIN" if ($FORM{'pagetype'} eq "");
@lay_data = sort(@lay_data);
$kk = 0;
$fldno = 0;
foreach $line(@lay_data)
{
$kk++;
print qq~
~;
@flss = split (/\|/, $line);
$fldno++;
$act = "Inactive";
$ft = "color=red";
$act = "Active" if $flss[3] eq "yes";
$ft = "color=blue" if $flss[3] eq "yes";
print qq~ $fldno
$types{$flss[2]} ~;
if ($types{$flss[2]} eq "Text")
{
$foll = "";
if (length($flss[8]) > 25)
{
$foll = "\.\.\.";
}
$textleft = substr($flss[8],0,25);
$textleft = $textleft . $foll;
print qq~ ($textleft) ~;
}
print qq~ ~;
print qq~ $cgifont$act ~;
print qq~ $cgifontEdit ~;
if ($kk == 1)
{print qq~ ~;}
else
{print qq~ $cgifontUp ~;}
if ($kk == 20)
{print qq~ ~;}
else
{ print qq~ $cgifontDown ~;}
if ($flss[3] eq "yes")
{
$check23 = ""; $check23 = "checked" if ($flss[23] eq "yes");
$check24 = ""; $check24 = "checked" if ($flss[24] eq "yes");
$check25 = ""; $check25 = "checked" if ($flss[25] eq "yes");
$check26 = ""; $check26 = "checked" if ($flss[26] eq "yes");
$check27 = ""; $check27 = "checked" if ($flss[27] eq "yes");
$check28 = ""; $check28 = "checked" if ($flss[28] eq "yes");
$check29 = ""; $check29 = "checked" if ($flss[29] eq "yes");
$check30 = ""; $check30 = "checked" if ($flss[30] eq "yes");
print qq~ $cgifont ~;
if (($flss[2] eq "VIEWING") || ($flss[2] eq "NUMMENU") || ($flss[2] eq "TOTAL") )
{
print qq~ x
x x
x x
x x ~;
}
else
{
print qq~ $cgifont ~;
print qq~ $cgifont ~;
print qq~ $cgifont ~;
print qq~ $cgifont ~;
print qq~ $cgifont ~;
print qq~ $cgifont ~;
print qq~ $cgifont ~;
}
}
else
{
print qq~ x
x x
x x
x x
x ~;
}
}
#$pagetype = $FORM{'pagetype'};
#$pagetype = "MAIN" if ($FORM{'pagetype'} eq "");
print qq~
~;
print qq~
~;
print qq~
~;
$table_width2 = "95%"; #$table_width = 600;
print qq~
$cptitlefont Sample
$cgifont Choose page to sample ~;
foreach $optionn (@keyss)
{
print qq~ $menunam{$optionn}
~;
}
print qq~
Note: The sample shown is only a guide. You need to check the relevant page to see exactly how it will look.
~;
%tyll = ("MAIN","23",
"ADD" ,"24",
"LOGIN" ,"25",
"SEARCH" ,"26",
"SEARCHRESULTS" ,"27",
"RESPONSE" ,"28",
"VIEWRESPONSE","29",
"EDIT" ,"30" );
##### $pagetype
@lay_data = sort(@lay_data);
foreach $line(@lay_data)
{
@flss = split (/\|/, $line);
$flss[7] =~ s/\#//gi;
for ($xx = 0; $xx < 50; $xx++)
{
$flss[$xx] =~ s/PIPEPIPE/|/g;
}
if (($flss[3] eq "yes") && ( $flss[$tyll{$pagetype}] eq "yes") && ($flss[2] ne "NONE") ) # 23 is MAIN
{
if ($flss[2] eq "IMAGE")
{
print qq~ ~; print qq~ ~;
}
elsif ($flss[2] eq "VIEWING")
{
print qq~ ~;
print "" if ($flss[11] eq "yes");
print "" if ($flss[9] eq "yes");
print "" if ($flss[10] eq "yes");
$num1 = 30; $num2 = 35;
print qq~ $flss[17]$num1$flss[18]$num2$flss[19] ~;
print " " if ($flss[10] eq "yes");
print " " if ($flss[9] eq "yes");
print " " if ($flss[11] eq "yes"); print qq~ ~;
}
elsif ($flss[2] eq "TEXT")
{
print qq~ ~;
print "" if ($flss[11] eq "yes");
print "" if ($flss[9] eq "yes");
print "" if ($flss[10] eq "yes");
print qq~ $flss[8] ~;
print " " if ($flss[10] eq "yes");
print " " if ($flss[9] eq "yes");
print " " if ($flss[11] eq "yes"); print qq~ ~;
}
elsif ($flss[2] eq "NUMMENU")
{
print qq~ ~;
print "" if ($flss[11] eq "yes");
print "" if ($flss[9] eq "yes");
print "" if ($flss[10] eq "yes");
print qq~ $flss[38] 2 3 4
5 $flss[39] ~;
print " " if ($flss[10] eq "yes");
print " " if ($flss[9] eq "yes");
print " " if ($flss[11] eq "yes"); print qq~ ~;
}
elsif ($flss[2] eq "MENU")
{
$mtype="$pagetype"; #demo
&menus;
}
elsif ($flss[2] eq "HTML")
{
print qq~ $flss[22] ~;
}
elsif ($flss[2] eq "TABLES")
{
$guess = "indeed";
print qq~ ~;
if (($pagetype eq "MAIN")||($pagetype eq "SEARCHRESULTS") ||($pagetype eq "VIEWRESPONSE")){
$count=1;
&main_table_results;
$count=2;
&main_table_results; }
elsif (($pagetype eq "ADD") ||($pagetype eq "RESPONSE")||($pagetype eq "EDIT") ){
&load_addpage; #demo works
}
elsif ($pagetype eq "LOGIN"){
&userloginbody;
}
elsif ($pagetype eq "SEARCH"){ #demo
&searchform;
}
print qq~ ~;
}
elsif ($flss[2] eq "TOTAL")
{
print qq~ ~;
print "" if ($flss[11] eq "yes");
print "" if ($flss[9] eq "yes");
print "" if ($flss[10] eq "yes");
$num = 300;
print qq~ $flss[13]$num$flss[14] ~;
print " " if ($flss[10] eq "yes");
print " " if ($flss[9] eq "yes");
print " " if ($flss[11] eq "yes"); print qq~ ~;
}
}
}
print qq~
~;
}
sub view_to_edit_page_layout
{
&seek_cook;
$pagetype = $FORM{'pagetype'};
$pagetype = "MAIN" if ($FORM{'pagetype'} eq "");
open(USER_FILE,"$layout_name");
@layout_data = ;
close(USER_FILE);
$field = $FORM{'field'};
foreach $row (@layout_data)
{
@la = split (/\|/, $row);
if ($field eq "$la[1]")
{
for ($x = 0; $x < 40; $x++)
{
$la[$x] =~ s/PIPEPIPE/\|/gi;
}
last;
}
}
$checkactive = "checked" if ($la[3] eq "yes");
%types = ("IMAGE", "Image","TEXT", "Text", "TOTAL", "Total messages",
"MENU", "Link Menu", "TABLES", "Messages", "HTML", "Html", "VIEWING", "Viewing messages",
"NONE", "Unused", "NUMMENU", "Number menu");
@skeys = sort{$types{$a} cmp $types{$b}} keys %types;
&content;
print qq~
Edit Layout
~;
print qq~
~;
print qq~
Page Layout Editor $cgifont
Control Panel -
Layout Manager
~;
}
sub edit_page_layout
{
&seek_cook;
$pagetype = $FORM{'pagetype'};
$pagetype = "MAIN" if ($FORM{'pagetype'} eq "");
open(USER_FIL,"$layout_name");
@layout_dat = ;
close(USER_FIL);
open(USER_FIL,">$layout_name");
foreach $row (@layout_dat)
{
@fs = split (/\|/, $row);
if($fs[1] eq $FORM{'1'})
{
for ($x = 0; $x < 50; $x++)
{
if (!$FORM{$x})
{
$detail = $fs[$x];
if (($x ==3) || ($x ==10) ||($x ==11) ||($x ==9))
{
$detail = "no";
}
}
else
{
$detail = $FORM{$x};
}
$detail =~ s/\|/PIPEPIPE/gi;
$detail =~ s/\r\n/ /g;
$detail =~ s/\r/ /g;
$detail =~ s/\n/ /g;
$detail =~ s/\s+/ /g;
if ($x ==12)
{
$detail =~ s/^http:\/\///g;
}
print USER_FIL "$detail|";
}
print USER_FIL "\n";
}
else
{
print USER_FIL "$row";
}
}
close(USER_FIL);
&content;
&main_headera;
print qq~ ~;
&main_headerb;
print qq~
~;
&inter_footer;
#&view_to_edit_a_field;
exit;
}
sub routines_for_layout_align
{
$checkalignl = "checked" if ($la[4] eq "left");
$checkalignc = "checked" if ($la[4] eq "center");
$checkalignr = "checked" if ($la[4] eq "right");
print qq~
$cgifontAlignment:
$cgifont
left - center - right
~;
}
sub routines_for_layout_imageurl
{
print qq~
$cgifontImage url: $cgifont http://
~;
}
sub routines_for_layout_imagehtml
{
print qq~
$cgifontHtml: $cgifont $la[22]
~;
}
sub routines_for_layout_font
{
$checkunderline = "checked" if ($la[11] eq "yes");
$checkbold = "checked" if ($la[9] eq "yes");
$checkitalic = "checked" if ($la[10] eq "yes");
print qq~
$cgifontFont Type: $cgifont
$cgifontFont Size: $cgifont ~;
if ($temptype ne "NUMMENU"){
print qq~ $cgifontFont Color:
$cgifont
Select New Color?~;
&newoptions;
print qq~ ~;
}
else{
print qq~ $cgifont
Colors in the number menu are set in the Color/Images Manager
and/or the CSS setting in the Standard Preferences Manager.
~;
}
print qq~
$cgifontUnderline: $cgifont
$cgifontBold: $cgifont
$cgifontItalic: $cgifont
~;
}
sub routine_for_layout_numbermenu
{
$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;
unless ($number_of_messages <($no_displayed+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 ~;
}
unless ($number_of_messages <($no_displayed+1))
{
print qq~ ~;
}
}
sub overlayup
{
my $min = "50000001";
my $max = "50000020";
&seek_cook;
open(USER_FILE,"$layout_name");
@layout_data = ;
close(USER_FILE);
$field = $FORM{'field'};
foreach $row (@layout_data)
{
@layoutfields = split (/\|/, $row);
$current = $layoutfields[0] if ($field eq "$layoutfields[1]");
}
$one_up = $current - 1;
if ($one_up < $min)
{
&view_page_layout;
exit;
}
open(USER_FILE,">$layout_name");
foreach $row (@layout_data)
{
@fs = split (/\|/, $row);
if ($fs[0] eq $current)
{
print USER_FILE "$one_up|$fs[1]|$fs[2]|$fs[3]|$fs[4]|$fs[5]|$fs[6]|$fs[7]|$fs[8]|$fs[9]|$fs[10]|$fs[11]|$fs[12]|$fs[13]|$fs[14]|$fs[15]|$fs[16]|$fs[17]|$fs[18]|$fs[19]|$fs[20]|$fs[21]|$fs[22]|$fs[23]|$fs[24]|$fs[25]|$fs[26]|$fs[27]|$fs[28]|$fs[29]|$fs[30]|$fs[31]|$fs[32]|$fs[33]|$fs[34]|$fs[35]|$fs[36]|$fs[37]|$fs[38]|$fs[39]|$fs[40]|$fs[41]|$fs[42]|$fs[43]|$fs[44]|$fs[45]|$fs[46]|$fs[47]|$fs[48]|$fs[49]|\n";
}
elsif ($fs[0] eq $one_up)
{
print USER_FILE "$current|$fs[1]|$fs[2]|$fs[3]|$fs[4]|$fs[5]|$fs[6]|$fs[7]|$fs[8]|$fs[9]|$fs[10]|$fs[11]|$fs[12]|$fs[13]|$fs[14]|$fs[15]|$fs[16]|$fs[17]|$fs[18]|$fs[19]|$fs[20]|$fs[21]|$fs[22]|$fs[23]|$fs[24]|$fs[25]|$fs[26]|$fs[27]|$fs[28]|$fs[29]|$fs[30]|$fs[31]|$fs[32]|$fs[33]|$fs[34]|$fs[35]|$fs[36]|$fs[37]|$fs[38]|$fs[39]|$fs[40]|$fs[41]|$fs[42]|$fs[43]|$fs[44]|$fs[45]|$fs[46]|$fs[47]|$fs[48]|$fs[49]|\n";
}
else
{
print USER_FILE "$row";
}
}
close(USER_FILE);
&view_page_layout;
}
sub overlaydown
{
my $min = "50000001";
my $max = "50000020";
&seek_cook;
open(USER_FILE,"$layout_name");
@layout_data = ;
close(USER_FILE);
$field = $FORM{'field'};
foreach $row (@layout_data)
{
@layoutfields = split (/\|/, $row);
$current = $layoutfields[0] if ($field eq "$layoutfields[1]");
}
$one_up = $current + 1;
if ($one_up > $max)
{
&view_page_layout;
exit;
}
open(USER_FILE,">$layout_name");
foreach $row (@layout_data)
{
@fs = split (/\|/, $row);
if ($fs[0] eq $current)
{
print USER_FILE "$one_up|$fs[1]|$fs[2]|$fs[3]|$fs[4]|$fs[5]|$fs[6]|$fs[7]|$fs[8]|$fs[9]|$fs[10]|$fs[11]|$fs[12]|$fs[13]|$fs[14]|$fs[15]|$fs[16]|$fs[17]|$fs[18]|$fs[19]|$fs[20]|$fs[21]|$fs[22]|$fs[23]|$fs[24]|$fs[25]|$fs[26]|$fs[27]|$fs[28]|$fs[29]|$fs[30]|$fs[31]|$fs[32]|$fs[33]|$fs[34]|$fs[35]|$fs[36]|$fs[37]|$fs[38]|$fs[39]|$fs[40]|$fs[41]|$fs[42]|$fs[43]|$fs[44]|$fs[45]|$fs[46]|$fs[47]|$fs[48]|$fs[49]|\n";
}
elsif ($fs[0] eq $one_up)
{
print USER_FILE "$current|$fs[1]|$fs[2]|$fs[3]|$fs[4]|$fs[5]|$fs[6]|$fs[7]|$fs[8]|$fs[9]|$fs[10]|$fs[11]|$fs[12]|$fs[13]|$fs[14]|$fs[15]|$fs[16]|$fs[17]|$fs[18]|$fs[19]|$fs[20]|$fs[21]|$fs[22]|$fs[23]|$fs[24]|$fs[25]|$fs[26]|$fs[27]|$fs[28]|$fs[29]|$fs[30]|$fs[31]|$fs[32]|$fs[33]|$fs[34]|$fs[35]|$fs[36]|$fs[37]|$fs[38]|$fs[39]|$fs[40]|$fs[41]|$fs[42]|$fs[43]|$fs[44]|$fs[45]|$fs[46]|$fs[47]|$fs[48]|$fs[49]|\n";
}
else
{
print USER_FILE "$row";
}
}
close(USER_FILE);
&view_page_layout;
}
sub load_page
{
%tyll = ("MAIN","23",
"ADD" ,"24",
"LOGIN" ,"25",
"SEARCH" ,"26",
"SEARCHRESULTS" ,"27",
"RESPONSE" ,"28" ,
"VIEWRESPONSE" ,"29",
"EDIT" ,"30"
);
open(USER_FILEWWW,"$layout_name");
@lay_data = ;
close(USER_FILEWWW);
@lay_data = sort(@lay_data);
#$pagetype = $FORM{'pagetype'};
$pagetype = "MAIN" if ($pagetype eq "");
@data_ordered = @datalist if ($action eq "view_followup_edit");
if (($pagetype eq "EDIT")||($action eq "view_followup_edit")||($action eq "view_to_undo") ){ # message manager
print qq~
~;
######
$count = 1;
$grouped = 0;
$no_displayed = 20; # 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;
unless ($old_start_number < 0)
{
print qq~ <<< ~;
}
&show_number_menu unless ($number_of_messages <($no_displayed+1));
unless ($new_start_number > ($number_of_messages -1 )){
print qq~ >>> ~;
}
############
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~
~;
}
else ########### one of the public pages
{
foreach $line(@lay_data)
{
@flss = split (/\|/, $line);
$flss[7] =~ s/\#//gi;
for (my $xx = 0; $xx < 50; $xx++)
{
$flss[$xx] =~ s/PIPEPIPE/|/g;
}
if (($flss[3] eq "yes") && ( $flss[$tyll{$pagetype}] eq "yes") && ($flss[2] ne "NONE") )
{
if ($flss[2] eq "IMAGE")
{
print qq~ ~; print qq~ ~;
}
elsif ($flss[2] eq "VIEWING")
{
print qq~ ~;
print "" if ($flss[11] eq "yes");
print "" if ($flss[9] eq "yes");
print "" if ($flss[10] eq "yes");
print qq~ ~;
if (($action ne "view_to_edit") && ($action ne "view_to_undo")) {
if ($new_start_number < $number_of_messages) {
print qq~ $flss[17]$startplus$flss[18]$new_start_number$flss[19] ~;
}
else {
if ($startplus == $number_of_messages){
print qq~ $flss[20]$startplus$flss[21] ~;
}
else {
print qq~ $flss[17]$startplus$flss[18]$number_of_messages$flss[19] ~;
}
}
}
print qq~ ~;
print " " if ($flss[10] eq "yes");
print " " if ($flss[9] eq "yes");
print " " if ($flss[11] eq "yes"); print qq~ ~;
}
elsif ($flss[2] eq "TEXT")
{
print qq~ ~;
print "" if ($flss[11] eq "yes");
print "" if ($flss[9] eq "yes");
print "" if ($flss[10] eq "yes");
print qq~ $flss[8] ~;
print " " if ($flss[10] eq "yes");
print " " if ($flss[9] eq "yes");
print " " if ($flss[11] eq "yes"); print qq~ ~;
}
elsif ($flss[2] eq "NUMMENU")
{
unless ($number_of_messages <($no_displayed+1))
{
print qq~ ~;
print "" if ($flss[11] eq "yes");
print "" if ($flss[9] eq "yes");
print "" if ($flss[10] eq "yes");
print qq~ $flss[30] ~;
$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;
unless ($old_start_number < 0)
{
print qq~ $flss[38] ~;
}
&show_number_menu unless ($number_of_messages <($no_displayed+1));
unless ($new_start_number > ($number_of_messages -1 ))
{
print qq~ $flss[39] ~;
}
print " " if ($flss[10] eq "yes");
print " " if ($flss[9] eq "yes");
print " " if ($flss[11] eq "yes"); print qq~ ~;
}
}
elsif ($flss[2] eq "MENU") {
$mtype="$pagetype";
&menus;
}
elsif ($flss[2] eq "HTML") {
print qq~ $flss[22] ~;
}
elsif ($flss[2] eq "TABLES") {
print qq~ ~;
if ($pagetype eq "MAIN"){
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
}
elsif ($pagetype eq "VIEWRESPONSE"){
foreach $row (@datalist){
@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
}
elsif (($pagetype eq "ADD")||($pagetype eq "RESPONSE")) {
&load_addpage;
}
elsif ($pagetype eq "LOGIN"){
&userloginbody;
}
elsif ($pagetype eq "SEARCHRESULTS")
{
foreach $row (@hits){
@fields = split (/\|/, $row);
&main_table_results;
}
}
elsif ($pagetype eq "SEARCH"){
&searchform;
}
print qq~ ~;
}
elsif ($flss[2] eq "TOTAL")
{
# &no_of_messages_display
print qq~ ~;
print "" if ($flss[11] eq "yes");
print "" if ($flss[9] eq "yes");
print "" if ($flss[10] eq "yes");
print qq~ ~;
if ($number_of_messages == 1)
{
print qq~
$flss[15]$number_of_messages$flss[16]
~;
}
else
{
print qq~
$flss[13]$number_of_messages$flss[14]
~;
}
print " " if ($flss[10] eq "yes");
print " " if ($flss[9] eq "yes");
print " " if ($flss[11] eq "yes"); print qq~ ~;
}
}
}
} # end of else one of main pages?
}
sub view_addlayoutprefs
{
&seek_cook;
if ($mastermanagemessagesonly eq "yes"){
&content;
print qq~ Access to this section is currently restricted.
Back ~;
exit;
}
open(USER_FILE,"$field_names");
@layout_data = ;
close(USER_FILE);
foreach $lrow (@layout_data)
{
@lrow = split (/\|/, $lrow);
$sortable_field = $lrow[36];
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);
}
@layout_data = @data_ordered;
&content;
print qq~
$title
~;
print qq~
~;
print qq~
$cptitlefont Active PowerBook $cptext Add Message/Response Layout Manager
$cgifont ~;
&linkjump; print qq~
- Sample
~;
$bbod = "Header";
$kk = 0;
foreach $row (@layout_data)
{
@layoutfields = split (/\|/, $row);
$kk++;
$co = "red";
$co = "blue" if ($layoutfields[21] eq "yes");
#next if ($layoutfields[2] eq "date") ;
#next if ($layoutfields[21] ne "yes") ;
print qq~ $cgifont$kk ~;
if ($layoutfields[2] eq "date")
{
$pub = "";
print "Date ";;
}
elsif ($layoutfields[2] eq "ADD RESPONSE")
{
$pub = "";
print "Add Response ";
}
elsif ($layoutfields[2] eq "EDIT")
{
$pub = "";
print "Edit Message ";
}
elsif ($layoutfields[2] eq "VIEW RESPONSES")
{
print "View Responses "; $pub = "";
}
elsif ($layoutfields[2] eq "PRIVATE_OPTION")
{
print qq~Private message (help ) ~;
}
else
{
print "$layoutfields[1]";
}
print qq~
~;
if ($layoutfields[2] eq "date")
{
print "Message Date ";
}
elsif ($layoutfields[2] eq "EDIT")
{
print "Edit Message ";
}
elsif ($layoutfields[2] eq "ADD RESPONSE")
{
print "Add Response ";
}
elsif ($layoutfields[2] eq "PRIVATE_OPTION")
{
print "Private message ";
}
elsif ($layoutfields[2] eq "VIEW RESPONSES")
{
print "View Responses ";
}
else
{
print "$layoutfields[2]";
}
print qq~
~;
unless ($kk == 1)
{
print qq~ Up ~;
}
print qq~ ~;
unless ($kk == 20)
{
print qq~ Down ~;
}
print qq~
~;
if (($layoutfields[2] eq "VIEW RESPONSES") || ($layoutfields[2] eq "date")|| ($layoutfields[2] eq "EDIT") || ($layoutfields[2] eq "ADD RESPONSE")){
print qq~ (not shown in Add page) ~;
}
elsif ($layoutfields[2] eq "PRIVATE_OPTION") {
print qq~ (only shown in Add page) ~;
}
elsif ($layoutfields[50] eq "yes") {
print qq~ (currently only available to webmaster) ~;
}
print qq~ ~;
}
print qq~
~;
$guess = "indeed";
&load_addpage;
my $mess = "disabled";
$mess = "enabled" if ($allow_private_messages eq "yes");
print qq~
NOTE: Private messages are currently $mess . The PRIVATE MESSAGE option box will only appear if you have allowed guests to add private messages via the
Standard Preferences Manager.
~;
exit;
}
sub load_addpage
{
open(USER_FILEWWW,"$field_names");
@file_data = ;
close(USER_FILEWWW);
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);
}
$whatever = "no_preview";
if ($guess eq "indeed"){
print qq~ ~;}
else {
print qq~
~;}
if (($action eq "add_followup1") || ($action eq "cpadd_followup1"))
{
$ref = $FORM{'ref'};
print qq~
~;
if ($action eq "cpadd_followup1")
{
print qq~ ~; # to take cp add response back to cp
}
}
else
{
print qq~ ~;
}
print qq~ ~;
@new_rows = ();
@data_ordered = ();
foreach $lrow (@file_data)
{
@lrow = split (/\|/, $lrow);
$sortable_field = $lrow[36];
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);
}
@layout_datac = @data_ordered;
foreach $rowss (@layout_datac)
{
@fieldsq = split (/\|/, $rowss);
next if (
($fieldsq[21] ne "yes")
|| ($fieldsq[2] eq "date")
|| ($fieldsq[2] eq "ADD RESPONSE")
|| ($fieldsq[2] eq "VIEW RESPONSES")
|| ($fieldsq[2] eq "EDIT")
|| (($allow_private_messages ne "yes")&& ($fieldsq[2] eq "PRIVATE_OPTION") )
|| (($fieldsq[50] eq "yes") && ( $COOK{$cooknamelocal} ne $active_string ) )
);
if ($fieldsq[20] eq "yes"){
$req = $TXT_required; }
else{
$req = "";}
if ($fieldsq[2] eq "PRIVATE_OPTION"){
$fieldsq[1] = $fieldsq[18];
}
if (($fieldsq[49] ne "yes") &&($fieldsq[48])){
$fieldsq[1] = $fieldsq[48];
}
if ($fieldsq[2] ne "TABLE"){
print qq~
$fieldsq[1] $req
~;
}
if (($fieldsq[2] eq "TEXT") || ($fieldsq[2] eq "EMAIL") || ($fieldsq[2] eq "URL") )
{
print qq~ ~;
}
elsif ($fieldsq[2] eq "TEXTAREA")
{
print qq~ ~;
}
elsif ($fieldsq[2] eq "CHECK")
{
print qq~ ~;
}
elsif (($fieldsq[2] eq "IMAGE") || ($fieldsq[2] eq "FILE"))
{
print qq~ ~;
}
elsif ($fieldsq[2] eq "PRIVATE_OPTION")
{
print qq~ $fieldsq[17] ~;
}
elsif ($fieldsq[2] eq "TABLE")
{
print qq~ ~;
@tablerows = split (/\//, $fieldsq[54]);
@tablecols = split (/\//, $fieldsq[53]);
print qq~
~;
}
elsif ($fieldsq[2] eq "SELECT")
{
print qq~ ~;
@optionsq = split (/\//, $fieldsq[8]);
foreach $optionq (@optionsq)
{
$op = $optionq;
$op =~ s/\s+//gi;
print qq~ $optionq
~;
}
print qq~ ~;
}
elsif ($fieldsq[2] eq "RADIO")
{
@optionsq = split (/\//, $fieldsq[8]);
foreach $optionq (@optionsq)
{
$op = $optionq;
$op =~ s/\s+//gi;
print qq~ $optionq ~;
print " " if ($fieldsq[11] eq "v"); }
}
print qq~ ~;
}
print qq~
~;
}
sub licc{
$organe23 = $lic;
}
sub guest_to_power
{
&seek_cook;
unless (-e "$gbook_data_name"){
&content;
print "Can't find guestbook data file. Make sure it is in the correct directory.";
exit;
}
©_file($powerbook_data_name, $gtp_backup_name ); # create backup of current data
©_file($gbook_data_name, $powerbook_data_name );
&content;
&load_data_and_count;
open(USER_FIL,"$powerbook_data_name");
@data = ;
close (USER_FIL);
open(USER_FIL,">$powerbook_data_name");
foreach $row (@data)
{
$row =~ s/\n/|||||||||||\n/gi;
print USER_FIL "$row";
}
close (USER_FIL);
open(USER_FIL,"$powerbook_data_name");
@data = ;
close (USER_FIL);
open(USER_FIL,">$powerbook_data_name");
foreach $row (@data)
{
@fields = split (/\|/, $row);
for (my $x = 0; $x < 42; $x++){
if ($x == 20){
print USER_FIL "$fields[6]|";
}
else {
print USER_FIL "$fields[$x]|";
}
}
print USER_FIL "\n";
}
close (USER_FIL);
print "Done";
exit;
}
sub view_request_license
{
&content;
print qq~
Active PowerBook
~;
print qq~
~;
&inter_footer;
}
sub linkjump
{
print qq~
~;
$newt = $title;
$newt = "PowerBook" if ($title eq "");
print qq~
$cptext Select
$cptext $newt ~;
print qq~
$cptext CONTROL PANEL ~;
if ($book ne "")
{
if ($mastercplink eq "yes")
{
print qq~ MASTER CONTROL PANEL ~;
}
}
print qq~
$cptext Message Manager
$cptext Recycle Bin
$cptext Backup Manager
$cptext Standard Preferences Manager
$cptext Color/Images Manager
$cptext Page Layout Manager
$cptext Field Editor/Message Layout Manager
$cptext Add/Respond Page Layout Manager
$cptext Search Preferences Manager
$cptext Menu Manager
$cptext Language Preferences Manager
$cptext Date Format Manager
$cptext Access Manager
$cptext Password Manager ~;
if ($book eq ""){
print qq~SERVER MANAGER ~;
}
print qq~ ~;
}
sub agg
{
unless ($vartime1 == $lic)
{
my $togo = ( ((60*60*24*7) - ($varurl - $vartime2 )) /(60*60));
$togo = int($togo);
&cpheader;
print qq~
$fwhiteLicense info
$minitab1
Enter license number
$minitab2
($togo hours left)
$minitab3
~;
}
}
sub enter_license
{
&content;
print qq~
Active PowerBook
~;
print qq~
~;
&inter_footer;
}
sub update_license {
open(PERMS,">$htmlssin");
print PERMS "$FORM{'license'}";
close(PERMS);
&content;
print qq~
~;
exit;
}
sub tempwipe
{
if (($temptype eq "ADD RESPONSE")||($temptype eq "VIEW RESPONSES")||($temptype eq "EDIT")||($temptype eq "PRIVATE_OPTION")){
print qq~
$cgifontOverride PowerBook link color?:
$cgifont
$cgifontOverride color:
Select New Color?
~;
&newoptions;
print qq~
~; }
}
# sub lrgeet
#{
#unlink "$active_name";
#&content;
#print "Done";
#}