#!/usr/bin/perl #!-------------------- #! LEGAL NOTICE #!-------------------- #! PUBLISHER & MANAGER ENGINE v2.x - Date Version Tuesday, July 14 th 2003 #! #! This file and the source codes contained herein are the property #! of Turn-It-Digital Consulting Group (Turn-It-Digital). Use of this file #! is restricted to the specific terms and conditions in the License Agreement #! associated with this file. Distribution of this file or portions of this #! file for uses ot covered by the License Agreement is not allowed without a #! written agreement signed by an officer of Turn-It-Digital. #! #! Copyright 1998-2002 Turn-It-Digital Consulting Group. All rights reserved. #! http://www.turnitdigital.com/ #! #!-------------------- #! SCRIPT DESCTIPTION #!-------------------- #! #! >>Write description here.<<< #! #! Features: #! #! #!------------------------------------------------------------------------------ #! BEGIN SCRIPT: #!------------------------------------------------------------------------------ #!------------------------------------------------------------------------------ #!--------------WARNING: DO NOT MODIFY BELOW THIS POINT ------------------------ #!------------------------------------------------------------------------------ #!------------------------------------------------------------------------------ ############ Code Library Requirements & Begining Calls ######################## # require "$ENV{'DOCUMENT_ROOT'}/eWebObjects/shared-code/lib1.cgi"; require "$ENV{'DOCUMENT_ROOT'}/eWebMaster/global-variables.cgi"; # ############ Variables ######################################################### # # ############ Intro & Action to Take? ########################################### # # ############ SUB ROUTINES ###################################################### # eval { &intro; } ; if ($@) { &error ("Error Initializing.\nReason: $@"); } sub intro { &print_headers; %in = &parse; require "variables.cgi"; if ($in{'action'} eq "add-record") { &add_record; } elsif ($in{'action'} eq "process-addition") { &process_addition; } elsif ($in{'action'} eq "see-edit-list") { &see_edit_list; } elsif ($in{'action'} eq "see-data-list") { &see_data_list; } elsif ($in{'action'} eq "see-edit-id") { &see_edit_id; } elsif ($in{'action'} eq "process-edit") { &process_edit; } elsif ($in{'action'} eq "see-delete-list") { &see_delete_list; } elsif ($in{'action'} eq "process-delete") { &process_delete; } elsif ($in{'action'} eq "build_pages") { &build_pages; } elsif ($in{'action'} eq "build_pages2") { &build_pages2; } elsif ($in{'action'} eq "build_all") { &build_all; } elsif ($in{'action'} eq "add-many") { &add_many; } elsif ($in{'action'} eq "edit-many") { &edit_many; } else { $timestamp = time; $timenow = &formatday2($rec{'$timestamp'}); $lower=1; $upper=100; $random = int(rand( $upper-$lower+1 ) ) + $lower; ; # hello 555 $timenow -- $random print qq~ $wywg_header $wywg_footer ~; } } sub add_record { my ($head) = ""; open (HEADER, $template_directory."/$template_admin") or &error ("Error Opening File in sub header_template.\nReason: $@"); @header =
; close (HEADER); $dropmenu_status = qq~ ~; $timestamp = time; $title = "$in{'title'}"; $content = "$in{'content'}"; $html = "$in{'html'}"; $file = "$folder_publisher-$timestamp$extention"; $showimages = &show_images; $tecbox1 = "$in{'box1'}"; $tecbox2 = "$in{'box2'}"; $tecbox3 = "$in{'box3'}"; $tecbox4 = "$in{'box4'}"; $tecbox5 = "$in{'box5'}"; $tecbox6 = "$in{'box6'}"; $tecbox7 = "$in{'box7'}"; $tecbox8 = "$in{'box8'}"; $tecbox9 = "$in{'box9'}"; $tecbox0 = "$in{'box0'}"; $tecsubheadline = "$in{'subheadline'}"; $teckeywords = "$in{'keywords'}"; $tecmodifyby = "$in{'modifyby'}"; $tecauthor = "$username"; $tecstatus = "pending"; $tecdropmenu = "$dropmenu_status"; $insert_html = "$begin"; foreach $line (@header) { $line =~ s/\$title/$title/gi; $line =~ s/\$content/$content/gi; $line =~ s/\$html/$html/gi; $line =~ s/\$showimages/$showimages/gi; $line =~ s/\$file/$file/gi; $line =~ s/\$tecbox1/$tecbox1/gi; $line =~ s/\$tecbox2/$tecbox2/gi; $line =~ s/\$tecbox3/$tecbox3/gi; $line =~ s/\$tecbox4/$tecbox4/gi; $line =~ s/\$tecbox5/$tecbox5/gi; $line =~ s/\$tecbox6/$tecbox6/gi; $line =~ s/\$tecbox7/$tecbox7/gi; $line =~ s/\$tecbox8/$tecbox8/gi; $line =~ s/\$tecbox9/$tecbox9/gi; $line =~ s/\$tecbox0/$tecbox0/gi; $line =~ s/\$tecsubheadline/$tecsubheadline/gi; $line =~ s/\$teckeywords/$teckeywords/gi; $line =~ s/\$tecmodifyby/$tecmodifyby/gi; $line =~ s/\$tecauthor/$tecauthor/gi; $line =~ s/\$tecstatus/$tecstatus/gi; $line =~ s/\$tecdropmenu/$tecdropmenu/gi; $line =~ s/\$insert_html/$insert_html/gi; $head .= $line; } print qq~ $wywg_header ~; # old81 print qq~ Administer $publisher

Add a $singular_name

~; print @header; print qq~
~; print qq~ $wywg_footer ~; } sub process_addition { $timestamp = time; $id = &getprcount; $headline = &encode_chars($in{'headline'}); if ($headline eq "") { &submit_error("You Did Not Enter a Headline"); } $summary = &encode_chars($in{'summary'}); if ($summary eq "") { &submit_error("You did not enter a one paragraph description. Please go back and enter it."); } $file = &encode_chars($in{'file'}); $DynamicHTML = &encode_chars2($in{'DynamicHTML'}); $box1 = &encode_chars($in{'box1'}); $box2 = &encode_chars($in{'box2'}); $box3 = &encode_chars($in{'box3'}); $box4 = &encode_chars($in{'box4'}); $box5 = &encode_chars($in{'box5'}); $box6 = &encode_chars($in{'box6'}); $box7 = &encode_chars($in{'box7'}); $box8 = &encode_chars($in{'box8'}); $box9 = &encode_chars($in{'box9'}); $box0 = &encode_chars($in{'box0'}); $subheadline = &encode_chars($in{'subheadline'}); $keywords = &encode_chars($in{'keywords'}); $modifyby = &encode_chars($in{'modifyby'}); $author = &encode_chars($in{'author'}); $tecstatus = &encode_chars($in{'Status'}); $printoutput .= $id.$delim.$timestamp.$delim.$file.$delim.$headline.$delim.$summary.$delim.$DynamicHTML.$delim.$box1.$delim.$box2.$delim.$box3.$delim.$box4.$delim.$box5.$delim.$box6.$delim.$box7.$delim.$box8.$delim.$box9.$delim.$box0.$delim.$subheadline.$delim.$keywords.$delim.$modifyby.$delim.$author.$delim.$tecstatus."\n"; open (PRDATA, ">>".$cgi_directory."/database.cgi") or &error ("Error Opening File in sub process_addition .\nReason: $@"); print PRDATA $printoutput; close (PRDATA); open (HEADER, $template_directory."/$template_name") or &error ("Error Opening File in sub header_template.\nReason: $@"); @header =
; close (HEADER); $timestamp = time; $title = "$headline"; $content = "$summary"; $html = &java2($DynamicHTML); $tecfile = "$file"; $tecfolder = "$folder_publisher"; $tecid = "$id"; $tecbox1 = "$box1"; $tecbox2 = "$box2"; $tecbox3 = "$box3"; $tecbox4 = "$box4"; $tecbox5 = "$box5"; $tecbox6 = "$box6"; $tecbox7 = "$box7"; $tecbox8 = "$box8"; $tecbox9 = "$box9"; $tecbox0 = "$box0"; $tecsubheadline = "$subheadline"; $teckeywords = "$keywords"; $tecmodifyby = "$modifyby"; $tecauthor = "$author"; $tecstatus = "$tecstatus"; foreach $line (@header) { $line =~ s/\$title/$title/gi; $line =~ s/\$content/$content/gi; $line =~ s/\$html/$html/gi; $line =~ s/\$tecfile/$tecfile/gi; $line =~ s/\$tecfolder/$tecfolder/gi; $line =~ s/\$tecid/$tecid/gi; $line =~ s/\$tecbox1/$tecbox1/gi; $line =~ s/\$tecbox2/$tecbox2/gi; $line =~ s/\$tecbox3/$tecbox3/gi; $line =~ s/\$tecbox4/$tecbox4/gi; $line =~ s/\$tecbox5/$tecbox5/gi; $line =~ s/\$tecbox6/$tecbox6/gi; $line =~ s/\$tecbox7/$tecbox7/gi; $line =~ s/\$tecbox8/$tecbox8/gi; $line =~ s/\$tecbox9/$tecbox9/gi; $line =~ s/\$tecbox0/$tecbox0/gi; $line =~ s/\$tecsubheadline/$tecsubheadline/gi; $line =~ s/\$teckeywords/$teckeywords/gi; $line =~ s/\$tecmodifyby/$tecmodifyby/gi; $line =~ s/\$tecauthor/$tecauthor/gi; $line =~ s/\$tecstatus/$tecstatus/gi; $head .= $line; } $makelive = "$tecstatus"; $erase = "$file"; if ($makelive eq "live") { open (NEWS, ">$html_directory/$file") or &error ("Error Opening File in sub build_pages.\nReason: $@"); chmod 0755, "$html_directory/$file"; print NEWS @header; close (NEWS); } elsif ($makelive eq "pending") { system("rm $html_directory/$erase"); } # print qq~ $wywg_header $wywg_footer ~; } sub see_edit_list { $menu = &build_menu; print qq~ $wywg_header

Edit News Items

Choose Article to Edit:

$wywg_footer ~; } sub see_data_list { # $max = "$in{'show'}"; open (COUNT, "$ENV{'DOCUMENT_ROOT'}/eWebObjects/$folder_publisher/count.txt"); $max = ; close (COUNT); open (TXTFILE, "$ENV{'DOCUMENT_ROOT'}/eWebObjects/$folder_publisher/database.cgi"); @lines = ; close(TXTFILE); @lines = sort(@lines); if (@lines) { print qq~ $wywg_header
Administer $publisher

Currently, the size of "$publisher" is $max web page(s). $description

$sort_fields2 $wywg_footer ~; } } sub see_edit_id { &split_prdata_file; %rec = &get_record($in{'ID'}); my ($head) = ""; open (HEADER, $template_directory."/$template_admin") or &error ("Error Opening File in sub header_template.\nReason: $@"); @header =
; close (HEADER); if ($rec{'Status'} eq "") { $dropmenu_status = qq~ ~; } elsif ($rec{'Status'} eq "pending") { $dropmenu_status = qq~ ~; } elsif ($rec{'Status'} eq "live") { $dropmenu_status = qq~ ~; } $title = "$rec{'Title'}"; $content = &breaks($rec{'Content'}); $html = &java($rec{'DynamicHTML'}); $file = "$rec{'file'}"; $tecbox1 = "$rec{'box1'}"; $showimages = &show_images; $tecbox2 = "$rec{'box2'}"; $tecbox3 = "$rec{'box3'}"; $tecbox4 = "$rec{'box4'}"; $tecbox5 = "$rec{'box5'}"; $tecbox6 = "$rec{'box6'}"; $tecbox7 = "$rec{'box7'}"; $tecbox8 = "$rec{'box8'}"; $tecbox9 = "$rec{'box9'}"; $tecbox0 = "$rec{'box0'}"; $tecsubheadline = "$rec{'subheadline'}"; $teckeywords = "$rec{'keywords'}"; $tecmodifyby = "$rec{'modifyby'}"; $tecauthor = "$rec{'author'}"; $tecstatus = "$rec{'Status'}"; $tecdropmenu = "$dropmenu_status"; $lockfile = " onChange=\"this.value='$file';\" readonly"; $lockauthor = " onChange=\"this.value='$tecauthor';\" readonly"; $insert_html = ""; foreach $line (@header) { $line =~ s/\$title/$title/gi; $line =~ s/\$content/$content/gi; $line =~ s/\$html/$html/gi; $line =~ s/\$tecbox1/$tecbox1/gi; $line =~ s/\$showimages/$showimages/gi; $line =~ s/\$file/$file/gi; $line =~ s/\$tecbox2/$tecbox2/gi; $line =~ s/\$tecbox3/$tecbox3/gi; $line =~ s/\$tecbox4/$tecbox4/gi; $line =~ s/\$tecbox5/$tecbox5/gi; $line =~ s/\$tecbox6/$tecbox6/gi; $line =~ s/\$tecbox7/$tecbox7/gi; $line =~ s/\$tecbox8/$tecbox8/gi; $line =~ s/\$tecbox9/$tecbox9/gi; $line =~ s/\$tecbox0/$tecbox0/gi; $line =~ s/\$tecsubheadline/$tecsubheadline/gi; $line =~ s/\$teckeywords/$teckeywords/gi; $line =~ s/\$tecmodifyby/$tecmodifyby/gi; $line =~ s/\$tecauthor/$tecauthor/gi; $line =~ s/\$tecstatus/$tecstatus/gi; $line =~ s/\$tecdropmenu/$tecdropmenu/gi; $line =~ s/\$lockfile/$lockfile/gi; $line =~ s/\$lockauthor/$lockauthor/gi; $line =~ s/\$insert_html/$insert_html/gi; $head .= $line; } print qq~ $wywg_header ~; ## old print qq~ Administer $publisher

Edit a $singular_name

~; print @header; print qq~
~; print qq~ $wywg_footer ~; } sub process_edit { my ($output,$found); $found = 0; if ($in{'change_date'} == 1) { $date = time; } else { $date = $in{'Date'}; } $headline = &encode_chars($in{'headline'}); if ($headline eq "") { &submit_error("You Did Not Enter a Headline"); } $summary = &encode_chars($in{'summary'}); if ($summary eq "") { &submit_error("You Did Not Enter a News Item "); } $file = &encode_chars($in{'file'}); $DynamicHTML = &encode_chars2($in{'DynamicHTML'}); $box2 = &encode_chars($in{'box2'}); $box1 = &encode_chars($in{'box1'}); $box3 = &encode_chars($in{'box3'}); $box4 = &encode_chars($in{'box4'}); $box5 = &encode_chars($in{'box5'}); $box6 = &encode_chars($in{'box6'}); $box7 = &encode_chars($in{'box7'}); $box8 = &encode_chars($in{'box8'}); $box9 = &encode_chars($in{'box9'}); $box0 = &encode_chars($in{'box0'}); $subheadline = &encode_chars($in{'subheadline'}); $keywords = &encode_chars($in{'keywords'}); $modifyby = &encode_chars($in{'modifyby'}); $author = &encode_chars($in{'author'}); $tecstatus = &encode_chars($in{'Status'}); open (PRDATA, $cgi_directory."/database.cgi") or &error ("Error Opening File in sub process_edit .\nReason: $@"); while () { chomp($_); (/^#/) and ($output .= $_ and next); (/^\s*$/) and next; ($id,$timestamp,$title) = split(/\|\|\|/); if ($id eq $in{'ID'}) { $output .= $in{'ID'}.$delim.$date.$delim.$file.$delim.$headline.$delim.$summary.$delim.$DynamicHTML.$delim.$box1.$delim.$box2.$delim.$box3.$delim.$box4.$delim.$box5.$delim.$box6.$delim.$box7.$delim.$box8.$delim.$box9.$delim.$box0.$delim.$subheadline.$delim.$keywords.$delim.$modifyby.$delim.$author.$delim.$tecstatus."\n"; $found = 1; } else { $output .= "$_\n"; } } close (PRDATA); if ($found) { open (PRDATA, ">$cgi_directory/database.cgi") or &error ("Error Opening File in sub process_edit .\nReason: $@"); print PRDATA $output; close (PRDATA); } open (HEADER, $template_directory."/$template_name") or &error ("Error Opening File in sub header_template.\nReason: $@"); @header =
; close (HEADER); $timestamp = time; $title = "$headline"; $content = "$summary"; $html = &java2($DynamicHTML); $tecfile = "$file"; $tecfolder = "$folder_publisher"; $tecid = "$id"; $tecbox1 = "$box1"; $tecbox2 = "$box2"; $tecbox3 = "$box3"; $tecbox4 = "$box4"; $tecbox5 = "$box5"; $tecbox6 = "$box6"; $tecbox7 = "$box7"; $tecbox8 = "$box8"; $tecbox9 = "$box9"; $tecbox0 = "$box0"; $tecsubheadline = "$subheadline"; $teckeywords = "$keywords"; $tecmodifyby = "$modifyby"; $tecauthor = "$author"; $tecstatus = "$tecstatus"; foreach $line (@header) { $line =~ s/\$title/$title/gi; $line =~ s/\$content/$content/gi; $line =~ s/\$html/$html/gi; $line =~ s/\$tecfile/$tecfile/gi; $line =~ s/\$tecfolder/$tecfolder/gi; $line =~ s/\$tecid/$tecid/gi; $line =~ s/\$tecbox1/$tecbox1/gi; $line =~ s/\$tecbox2/$tecbox2/gi; $line =~ s/\$tecbox3/$tecbox3/gi; $line =~ s/\$tecbox4/$tecbox4/gi; $line =~ s/\$tecbox5/$tecbox5/gi; $line =~ s/\$tecbox6/$tecbox6/gi; $line =~ s/\$tecbox7/$tecbox7/gi; $line =~ s/\$tecbox8/$tecbox8/gi; $line =~ s/\$tecbox9/$tecbox9/gi; $line =~ s/\$tecbox0/$tecbox0/gi; $line =~ s/\$tecsubheadline/$tecsubheadline/gi; $line =~ s/\$teckeywords/$teckeywords/gi; $line =~ s/\$tecmodifyby/$tecmodifyby/gi; $line =~ s/\$tecauthor/$tecauthor/gi; $line =~ s/\$tecstatus/$tecstatus/gi; $head .= $line; } $makelive = "$tecstatus"; $erase = "$file"; if ($makelive eq "live") { open (NEWS, ">$html_directory/$file") or &error ("Error Opening File in sub build_pages.\nReason: $@"); chmod 0755, "$html_directory/$file"; print NEWS @header; close (NEWS); } elsif ($makelive eq "pending") { system("rm $html_directory/$erase"); } # print qq~ $wywg_header $wywg_footer ~; } sub see_delete_list { $menu = &build_menu; print qq~ $wywg_header $erase_content $wywg_footer ~; } sub process_delete { my ($delete_output) = ""; my ($count) = 0; open (PRDATA, $cgi_directory."/database.cgi") or &error ("Error Opening File in sub see_delete_list_two .\nReason: $@"); while () { chomp($_); (/^#/) and ($delete_output .= $_ and next); (/^\s*$/) and next; ($id,$timestamp,$file,$title,$content,$DynamicHTML,$box1,$box2,$box3,$box4,$box5,$box6,$box7,$box8,$box9,$box0,$subheadline,$keywords,$modifyby,$author,$tecstatus) = split(/\Q$delim\E/); if ($id eq $in{'ID'}) { $found = 1; system("rm $html_directory/$file"); next; } else { $count++; $delete_output .= $count.$delim.$timestamp.$delim.$file.$delim.$title.$delim.$content.$delim.$DynamicHTML.$delim.$box1.$delim.$box2.$delim.$box3.$delim.$box4.$delim.$box5.$delim.$box6.$delim.$box7.$delim.$box8.$delim.$box9.$delim.$box0.$delim.$subheadline.$delim.$keywords.$delim.$modifyby.$delim.$author.$delim.$tecstatus."\n";; } } close (PRDATA); if ($found) { open (PRDATA, ">$cgi_directory/database.cgi") or &error ("Error Opening File in sub see_delete_list_two .\nReason: $@"); print PRDATA $delete_output; close (PRDATA); open (PRCOUNT, ">$cgi_directory/count.txt") or &error ("Error Opening File in sub see_delete_list_two .\nReason: $@"); print PRCOUNT $count; close (PRCOUNT); } print qq~ $wywg_header $wywg_footer ~; } ## chmod 0755, or chmod (0755, "example.txt"); sub build_pages { &split_prdata_file; my ($count) = 0; $prcount = @id; for ($j=1;$j<$prcount+1;$j++) { %tmp = &get_record($j); $page = &header_template(%tmp); $date81 = $tmp{'Date'}; $open81 = ""; $makelive = "$tmp{'Status'}"; $erase = "$tmp{'file'}"; if ($makelive eq "live") { open (NEWS, ">$html_directory/$tmp{'file'}") or &error ("Error Opening File in sub build_pages.\nReason: $@"); chmod 0755, "$html_directory/$tmp{'file'}"; print NEWS $page; close (NEWS); } elsif ($makelive eq "pending") { system("rm $html_directory/$erase"); } $count++; } print qq~ $wywg_header $successful_publish $wywg_footer~; } sub build_pages2 { &split_prdata_file; my ($count) = 0; $prcount = @id; for ($j=1;$j<$prcount+1;$j++) { %tmp = &get_record($j); $page = &header_template(%tmp); open (NEWS, ">$html_directory/$tmp{'file'}") or &error ("Error Opening File in sub build_pages2.\nReason: $@"); print NEWS $page; close (NEWS); $count++; } print qq~ $wywg_header $successful_publish $wywg_footer~; } sub build_all { &build_pages2; } sub getprcount { # Gets the Next Available ID Number and Increments The count.txt Number open (PRCOUNT, "$cgi_directory/count.txt") or &error ("Error Opening File in sub getnum.\nReason: $@");; $prcount = ; close (PRCOUNT); $prcount = $prcount+1; open (PRCOUNT, ">$cgi_directory/count.txt") or &error ("Error Opening File in sub getnum.\nReason: $@"); print PRCOUNT $prcount; close (PRCOUNT); return ($prcount); } sub get_record { # Gets the Record info in a hash my %record; $ID = shift; $ID--; $record{'ID'} = $id[$ID]; $record{'Date'} = $date[$ID]; $record{'Title'} = $title[$ID]; $record{'Content'} = $content[$ID]; $record{'file'} = $file[$ID]; $record{'DynamicHTML'} = $DynamicHTML[$ID]; $record{'box1'} = $box1[$ID]; $record{'box2'} = $box2[$ID]; $record{'box3'} = $box3[$ID]; $record{'box4'} = $box4[$ID]; $record{'box5'} = $box5[$ID]; $record{'box6'} = $box6[$ID]; $record{'box7'} = $box7[$ID]; $record{'box8'} = $box8[$ID]; $record{'box9'} = $box9[$ID]; $record{'box0'} = $box0[$ID]; $record{'subheadline'} = $subheadline[$ID]; $record{'keywords'} = $keywords[$ID]; $record{'modifyby'} = $modifyby[$ID]; $record{'author'} = $author[$ID]; $record{'Status'} = $status[$ID]; foreach $key (keys %record) { $record{$key} = &decode_chars($record{$key}); } return (%record); } sub split_prdata_file { # Splits the PRData file into 4 arrays open (PRDATA, "<".$cgi_directory."/database.cgi") or &error ("Error Opening File in sub split_prdata_file.\nReason: $@"); @prdata = ; close (PRDATA); foreach $line (@prdata) { ($line =~ /^\s*$/) and next; chomp($line); @inf = split(/\Q$delim\E/, $line); foreach $val (@inf) { $val = &decode_chars($val); } push @id, $inf[0]; push @date, $inf[1]; push @file, $inf[2]; push @title, $inf[3]; push @content, $inf[4]; push @DynamicHTML, $inf[5];push @box1, $inf[6]; push @box2, $inf[7]; push @box3, $inf[8]; push @box4, $inf[9]; push @box5, $inf[10]; push @box6, $inf[11]; push @box7, $inf[12]; push @box8, $inf[13]; push @box9, $inf[14]; push @box0, $inf[15]; push @subheadline, $inf[16]; push @keywords, $inf[17]; push @modifyby, $inf[18]; push @author, $inf[19]; push @status, $inf[20]; } @prdata = (); } sub edit_many { open (TXTFILE, "$ENV{'DOCUMENT_ROOT'}/eWebObjects/$folder_publisher/database.cgi"); @lines = ; close(TXTFILE); @lines = sort(@lines); $num = @lines; $max = "$in{'show'}"; if (@lines) { print qq~ ~; if ($num < $max) { $max = $num; } for ($i=0;$i<$max;$i++) { ($id,$date,$file,$headline,$body,$dynamic_html,$box1,$box2,$box3,$box4,$box5,$box6,$box7,$box8,$box9,$box0,$subheadline,$keywords,$modifyby,$author,$tecstatus) = split(/\Q$delim\E/,$lines[$i]); print qq~ $headline - $file



~; } print qq~ ~; } } sub add_many { open (TXTFILE, "$ENV{'DOCUMENT_ROOT'}/eWebObjects/$folder_publisher/database.cgi"); @lines = ; close(TXTFILE); @lines = sort(@lines); $num = "500"; $max = "$in{'show'}"; if (@lines) { print qq~ ~; if ($num < $max) { $max = $num; } for ($i=0;$i<$max;$i++) { ($id,$date,$file,$headline,$body,$dynamic_html,$box1,$box2,$box3,$box4,$box5,$box6,$box7,$box8,$box9,$box0,$subheadline,$keywords,$modifyby,$author,$tecstatus) = split(/\Q$delim\E/,$lines[$i]); print qq~


~; } print qq~ ~; } } sub breaks { #changes newlines to
's new $str =~ s/
/\n/g; old $tmp =~ s/\n/\n
/g; my ($tmp) = shift; $tmp =~ s/
/\n/g; return ($tmp); } sub encode_chars { my ($tmp) = shift; $tmp =~ s/^\s+//g; $tmp =~ s/^\

//g; # Trimp leading

# Trim leading blanks... $tmp =~ s/\s+$//g; # ... then the trailing ones $tmp =~ s/\Q$delim\E/~~/og; # Change delimeter to ~~ symbol. $tmp =~ s/\n/
/g; # Change newline to
symbol. $tmp =~ s/\r//g; # linefeed character. # add return ($tmp); } sub encode_chars2 { my ($tmp) = shift; $tmp =~ s/^\s+//g; # Trim leading blanks... $tmp =~ s/^\

//g; # Trimp leading

$tmp =~ s/\s+$//g; # ... then the trailing ones $tmp =~ s/\Q$delim\E/~~/og; # Change delimeter to ~~ symbol. $tmp =~ s/\n/``/g; # Change newline to `` symbol. $tmp =~ s/\Q[insert \E/\[an error occurred while processing this directive]/og; $tmp =~ s/\r//g; # linefeed character. return ($tmp); } sub java { my ($tmp) = shift; # $tmp =~ s/\Q"\E/\\"/og; # $tmp =~ s/\Q'\E/\\'/og; $tmp =~ s/``/\n/g; $tmp =~ s/\Q[an error occurred while processing this directive]\E/ -]/og; return ($tmp); } sub java2 { my ($tmp) = shift; # $tmp =~ s/\Q"\E/\\"/og; # $tmp =~ s/\Q'\E/\\'/og; $tmp =~ s/``/\n/g; $tmp =~ s/\Q[insert \E/\[an error occurred while processing this directive]/og; return ($tmp); } sub decode_chars { my ($str); $str = shift; $str =~ s/~~/\Q$delim\E/g; # Retrieve Delimiter.. $str =~ s/
/\n/g; # Changes
back to newlines.. return ($str); } sub print_headers { # If the content type header isn't printed yet, this will print it. if (!$headers_printed) { print "Content-type: text/html\n\n"; $headers_printed = 1; } } sub html_page { my %rec = @_; my ($page) = ""; $page .= qq~ ~; return ($page); } sub header_template { %rec = @_; my ($head) = ""; open (HEADER, $template_directory."/$template_name") or &error ("Error Opening File in sub header_template.\nReason: $@"); @header =

; close (HEADER); $title = "$rec{'Title'}"; $content = "$rec{'Content'}"; $html = &java2($rec{'DynamicHTML'}); $tecfile = "$rec{'file'}"; $tecfolder = "$folder_publisher"; $tecid = "$rec{'ID'}"; $tecbox1 = "$rec{'box1'}"; $tecbox2 = "$rec{'box2'}"; $tecbox3 = "$rec{'box3'}"; $tecbox4 = "$rec{'box4'}"; $tecbox5 = "$rec{'box5'}"; $tecbox6 = "$rec{'box6'}"; $tecbox7 = "$rec{'box7'}"; $tecbox8 = "$rec{'box8'}"; $tecbox9 = "$rec{'box9'}"; $tecbox0 = "$rec{'box0'}"; $tecsubheadline = "$rec{'subheadline'}"; $teckeywords = "$rec{'keywords'}"; $tecmodifyby = "$rec{'modifyby'}"; $tecauthor = "$rec{'author'}"; $tecstatus = "$rec{'Status'}"; foreach $line (@header) { $line =~ s/\$title/$title/gi; $line =~ s/\$content/$content/gi; $line =~ s/\$html/$html/gi; $line =~ s/\$tecfile/$tecfile/gi; $line =~ s/\$tecid/$tecid/gi; $line =~ s/\$tecfolder/$tecfolder/gi; $line =~ s/\$tecbox1/$tecbox1/gi; $line =~ s/\$tecbox2/$tecbox2/gi; $line =~ s/\$tecbox3/$tecbox3/gi; $line =~ s/\$tecbox4/$tecbox4/gi; $line =~ s/\$tecbox5/$tecbox5/gi; $line =~ s/\$tecbox6/$tecbox6/gi; $line =~ s/\$tecbox7/$tecbox7/gi; $line =~ s/\$tecbox8/$tecbox8/gi; $line =~ s/\$tecbox9/$tecbox9/gi; $line =~ s/\$tecbox0/$tecbox0/gi; $line =~ s/\$tecsubheadline/$tecsubheadline/gi; $line =~ s/\$teckeywords/$teckeywords/gi; $line =~ s/\$tecmodifyby/$tecmodifyby/gi; $line =~ s/\$tecauthor/$tecauthor/gi; $line =~ s/\$tecstatus/$tecstatus/gi; $head .= $line; } @header = (); return ($head); } sub admin_template { %rec = @_; my ($head) = ""; open (HEADER, $template_directory."/$template_admin") or &error ("Error Opening File in sub header_template.\nReason: $@"); @header =
; close (HEADER); $title = "$rec{'Title'}"; $content = &breaks($rec{'Content'}); $html = "$rec{'DynamicHTML'}"; $tecbox1 = "$rec{'box1'}"; $tecbox2 = "$rec{'box2'}"; $tecbox3 = "$rec{'box3'}"; $tecbox4 = "$rec{'box4'}"; $tecbox5 = "$rec{'box5'}"; $tecbox6 = "$rec{'box6'}"; $tecbox7 = "$rec{'box7'}"; $tecbox8 = "$rec{'box8'}"; $tecbox9 = "$rec{'box9'}"; $tecbox0 = "$rec{'box0'}"; $tecsubheadline = "$rec{'subheadline'}"; $teckeywords = "$rec{'keywords'}"; $tecmodifyby = "$rec{'modifyby'}"; $tecauthor = "$rec{'author'}"; $tecstatus = "$rec{'Status'}"; foreach $line (@header) { $line =~ s/\$title/$title/gi; $line =~ s/\$content/$content/gi; $line =~ s/\$html/$html/gi; $line =~ s/\$tecbox1/$tecbox1/gi; $line =~ s/\$tecbox2/$tecbox2/gi; $line =~ s/\$tecbox3/$tecbox3/gi; $line =~ s/\$tecbox4/$tecbox4/gi; $line =~ s/\$tecbox5/$tecbox5/gi; $line =~ s/\$tecbox6/$tecbox6/gi; $line =~ s/\$tecbox7/$tecbox7/gi; $line =~ s/\$tecbox8/$tecbox8/gi; $line =~ s/\$tecbox9/$tecbox9/gi; $line =~ s/\$tecbox0/$tecbox0/gi; $line =~ s/\$tecsubheadline/$tecsubheadline/gi; $line =~ s/\$teckeywords/$teckeywords/gi; $line =~ s/\$tecmodifyby/$tecmodifyby/gi; $line =~ s/\$tecauthor/$tecauthor/gi; $line =~ s/\$tecstatus/$tecstatus/gi; $head .= $line; } @header = (); return ($head); } sub footer_page { open (FOOTER, $cgi_directory."/footer.shtml") or &error ("Error Opening File in sub footer_page.\nReason: $@"); my($footer) = ""; my (@foot) =