#!/usr/bin/perl print ("Content-type: text/html\n\n"); eval { ($0 =~ m,(.*)/[^/]+,) && unshift (@INC, "$1"); # Get the script location: UNIX / or Windows / ($0 =~ m,(.*)\\[^\\]+,) && unshift (@INC, "$1"); # Get the script location: Windows \ #substitute all require files here for the file require "gb_variables.pl"; require "ugb_lib.pl"; require "gb_styles.pl"; }; &ReadParse; #adjust bgcolor variables if ($BGColor ne ""){ $BGColor = qq(bgcolor="$BGColor"); } if ($TableColorStrip ne "") { $TableColorStrip = qq(bgcolor="$TableColorStrip"); } if ($AltRowColor1 ne "") { $AltRowColor1 = qq(bgcolor="$AltRowColor1"); } if ($AltRowColor2 ne "") { $AltRowColor2 = qq(bgcolor="$AltRowColor2"); } if ($PageBackground ne "") { $PageBackground = qq(background="$PageBackground"); } if ($TableBorderColor ne ""){ $TableWidth2 = "100%"; $BorderTop = qq(
); $BorderBottom = qq(
); } else { $TableWidth2 = $TableWidth; $BorderTop = ""; $BorderBottom = ""; } if (@in == 0) { &Summary; } if ($in{'action'} eq "summary") { &Summary; } if ($in{'action'} eq "addentry") { &AddEntry; } if ($in{'action'} eq "submitentry") { &SubmitEntry; } sub SubmitEntry { if (($in{'Field1Value'} eq "") || ($in{'Field1Value'} !~ /[a-zA-Z0-9]/)) { &StandardHTML("Das Feld \"$Field1\" ist ein Pflichtfeld, welches Sie ausfüllen müssen!"); exit; } if (($in{'Field4Value'} eq "") || ($in{'Field4Value'} !~ /[a-zA-Z0-9]/)) { &StandardHTML("Das Feld \"$Field4\" ist ein Pflichtfeld, welches Sie ausfüllen müssen!"); exit; } &GetDateTime; #get current date and time #add entry to entries.file if ($TimeFormat eq "US") { $ThisTime = $USTime; } else { $ThisTime = $EuroTime; } if ($DateFormat eq "US") { $ThisDate = "$USDate"; } elsif ($DateFormat eq "USExpanded") { $ThisDate = "$USDateExpanded"; } elsif ($DateFormat eq "Euro") { $ThisDate = "$EuroDate"; } else { $ThisDate = "$EuroDateExpanded"; } $Field1Value = &decodeURL($in{'Field1Value'}); $Field1Value = &CleanThis($Field1Value); $Field1Value = &PipeCleaner($Field1Value); $Field2Value = &decodeURL($in{'Field2Value'}); $Field2Value = &CleanThis($Field2Value); $Field2Value = &PipeCleaner($Field2Value); $Field3Value = &decodeURL($in{'Field3Value'}); $Field3Value = &CleanThis($Field3Value); $Field3Value = &PipeCleaner($Field3Value); $Field4Value = &decodeURL($in{'Field4Value'}); $Field4Value = &PipeCleaner($Field4Value); #HTML NOT ALLOWED IN FIRST 3 FIELDS! $Field1Value =~ s/<.+?>//g; $Field2Value =~ s/<.+?>//g; $Field3Value =~ s/<.+?>//g; if ($Field2Value ne "") { if ($Field2Hyper eq "url") { if ($Field2Value =~ /http:/) { $Field2Value = qq($Field2Value); } else { $Field2Value = qq($Field2Value); } } elsif ($Field2Hyper eq "email") { $Field2Value = qq($Field2Value); } else { $Field2Value = $Field2Value; } } #end Field2Value ne "" if ($Field3Value ne "") { if ($Field3Hyper eq "url") { if ($Field3Value =~ /http:/) { $Field3Value = qq($Field3Value); } else { $Field3Value = qq($Field3Value); } } elsif ($Field3Hyper eq "email") { $Field2Value = qq($Field3Value); } else { $Field3Value = $Field3Value; } } #end Field3Value ne "" if ($HTMLAllow ne "yes") { $Field4Value =~ s/<.+?>//g; } $Field4Value = &Truncate($Field4Value); $Field4Value = &ConvertReturns($Field4Value); if ($Censor eq "ON") { @censored = split(/ /, $censorwords); $Field4Value = &CensorCheck("$Field4Value"); } #Smiley/Frown conversion--- $Field4Value = &Smilies("$Field4Value"); #UBB Code-ify (if allowed) if ($UBBCodeAllow eq "yes") { $Field4Value = &UBBCode("$Field4Value"); } #END UBB CODE #determine ID NUMBER if (-e "$GB_NON_CGI_Path/entries.file") { open (OLDENTRIES, "$GB_NON_CGI_Path/entries.file") || die ("Die Datei der Gästebuch-Einträge kann nicht geöffnet werden."); @entries = ; close (OLDENTRIES); @backwards = reverse(@entries); $lastline = @backwards[0]; @laststats = split(/\|\|/, $lastline); $LastNumber = $laststats[6]; chomp($LastNumber); $NextNumber = $LastNumber + 1; } else { $NextNumber = 1; } open (ENTRIES, ">>$GB_NON_CGI_Path/entries.file"); print ENTRIES "$ThisDate||$ThisTime||$Field1Value||$Field2Value||$Field3Value||$Field4Value||$NextNumber\n"; close (ENTRIES); chmod (0666, "$GB_NON_CGI_Path/entries.file"); &TopHTML; print<
Gästebuch ansehen | $Link1Name | $Link2Name
TEST &BottomHTML; } #end Submit Entry sub AddEntry { &TopHTML; if ($UBBCodeAllow eq "yes") { $UBBLine = qq( UGB-Code erlaubt); } else { $UBBLine = qq( UGB-Code nicht erlaubt); } if ($HTMLAllow eq "yes") { $HTMLLine = qq( HTML-Code erlaubt); } else { $HTMLLine = qq( HTML-Code nicht erlaubt); } print< $AddEntryIntro

$UBBLine       $HTMLLine
$BorderTop MIDDLE if ($Field2 ne "") { print< MID2 } if ($Field3 ne "") { print< MID3 } print<
$GBTitle
$Field1 *
$Field2
$Field3
$Field4 *

Was ist UGB-Code?

$BorderBottom

* Pflichtfeld

ENDTABLE &BottomHTML; } # end Add Entry sr sub Summary { &TopHTML; print <<_TOP_OF_PAGE;

$IntroText

Um sich einzutragen, klicken Sie hier!

_TOP_OF_PAGE &GetEntries; print <<_BOTTOM_HTML; $BorderBottom
Administration $ContinueWording

Tragen Sie sich ein!

$Link1Name | $Link2Name

_BOTTOM_HTML &BottomHTML; } #end Summary sr sub UpdateEntries { if (-e "$GB_NON_CGI_Path/entries.file") { open (ENTRIES, "$GB_NON_CGI_Path/entries.file") || die ("Die Datei der Gästebuch-Einträge kann nicht geöffnet werden."); @entries = ; close (ENTRIES); $ArrayLine = 0; @newarray = @blank; foreach $one(@entries) { chomp($one); $ArrayLine++; $NewLine = ("$one" . "||$ArrayLine"); push(@newarray, $NewLine); } open (THIS, ">$GB_NON_CGI_Path/entries.file") || die ("Die Datei der Gästebuch-Einträge kann nicht geöffnet werden."); foreach $uno(@newarray) { chomp($uno); print THIS "$uno\n"; } close (THIS); open (DIAG, ">$GB_NON_CGI_Path/diagnostic.file") || die ("Die Diagnose-Datei kann nicht geöffnet werden."); print DIAG "Diese Datei darf nicht manuell gelöscht werden!"; close (DIAG); } } sub GetEntries { unless (-e "$GB_NON_CGI_Path/diagnostic.file") { &UpdateEntries; } if (-e "$GB_NON_CGI_Path/entries.file") { open (ENTRIES, "$GB_NON_CGI_Path/entries.file") || die ("Die Datei der Gästebuch-Einträge kann nicht geöffnet werden."); @entries = ; close (ENTRIES); $Total = @entries; $LastArrayNumber = $Total - 1; if ($Total < $MaxDisplay) { $MaxDisplay = $Total; } @sortentries = reverse(@entries); $TotalEntries = @sortentries; #determine start and end points in array if ($in{'startwith'} eq "") { $startarraynum = "0"; $start = "1"; } else { $startarraynum = $in{'startwith'}; $start = $startarraynum + 1; } $MaxDisplay--; $endarraynum = $startarraynum + $MaxDisplay; $end = $endarraynum + 1; if ($end > $Total) { $endarraynum = $Total - 1; $end = $Total; } $startwith = $endarraynum + 1; if ($startwith < $Total) { $ContinueWording = qq(Weitere Einträge); } else { $ContinueWording = ""; } @finalarray = @sortentries[$startarraynum...$endarraynum]; print< Zeige Einträge $start - $end von $Total Einträgen           $ContinueWording $Field1 $Field4 TableStart $AlternateColor = $AltRowColor1; for $thisentry(@finalarray) { @entryline = split(/\|\|/, $thisentry); chomp($entryline[6]); print < $entryline[2]
GUTS if ($entryline[3] ne "") { print< $Field2: $entryline[3]
THELINE } if ($entryline[4] ne "") { print< $Field3: $entryline[4]
THELINE } print< erstellt am $entryline[0] um $entryline[1] Uhr $TimeZone    Eintrag löschen


$entryline[5] Guts2 if ($AlternateColor eq "$AltRowColor1") { $AlternateColor = "$AltRowColor2"; } else { $AlternateColor = "$AltRowColor1"; } } #end FOREACH } else { print< $Field1 $Field4 ** Keine Einträge vorhanden ** GUTS } } #end sr sub TopHTML { print< $GBTitle $Header
$GBTitle
TOP } #end TopHTML sr sub BottomHTML { print< $Footer

$CopyrightWording

Ultimate Guestbook, Version 1.1
© Infopop Corporation, 1999-2000
Deutsche Übersetzung von thinkfactory.

Bottom } # end BottomHTML sr sub GetDateTime { if ($TimeZoneOffset) { if (($TimeZoneOffset ne "") || ($TimeZoneOffset ne "0")) { $adjustTime = time() + ($TimeZoneOffset * 3600); } else { $adjustTime = time(); } ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) = localtime ($adjustTime); } else { ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) = localtime (time); } $mon++; $year = $year + 1900; $monformat = sprintf ("%2d", $mon); $monformat =~tr/ /0/; $mdayformat = sprintf ("%2d", $mday); $mdayformat =~tr/ /0/; @months = ("blank" , "Januar", "Februar", "März", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Dezember"); #date format options $USDate = "$monformat-$mdayformat-$year"; $EuroDate = "$mdayformat-$monformat-$year"; $USDateExpanded = "$months[$mon] $mday, $year"; $EuroDateExpanded = "$mday $months[$mon] $year"; #time format options $min = sprintf ("%2d", $min); $min =~tr/ /0/; $hour = sprintf ("%2d", $hour); $hour =~tr/ /0/; $EuroTime = "$hour:$min"; &NormalTime; #convert to US time $USTime = "$USHour:$min $AMPM"; } #end GetDateTime sr sub NormalTime { if ($hour < 12) { $AMPM = "AM"; $USHour = "$hour"; } if ($hour > 12) { $USHour = $hour - 12; $AMPM = "PM"; } if ($hour == 12) { $AMPM = "PM"; $USHour = "12"; } if ($hour == 0) { $USHour = "12"; } $UHhour = sprintf ("%2d", $USHour); $USHour =~tr/ /0/; }