#!/usr/bin/perl print ("Content-type: text/html\n "); eval { (\$0 =~ m,(.*)/[^/]+,) && unshift (@INC, "$1"); # Get the script location: UNIX / or Windows / (\$0 =~ m,(.*)\[^\]+,) && unshift (@INC, "$1"); # Get the script location: Windows \n#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 { &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 ("Couldn't open guestbook entries file."); @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<
تصفح سجل الزوار | $Link1Name | $Link2Name
TEST &BottomHTML; } #end Submit Entry sub AddEntry { &TopHTML; if (\$UBBCodeAllow eq "yes") { \$UBBLine = qq(
يمكن استخدام كود الـ UBB); } else { \$UBBLine = qq( لا يمكن استخدام كود الـ UBB); } if (\$HTMLAllow eq "yes") { \$HTMLLine = qq(يمكن استخدام كود الـ HTML); } else { \$HTMLLine = qq( لا يمكن استخدام كود الـ HTML); } print< \$AddEntryIntro

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

ماهو كود الـ UBB ؟

\$BorderBottom

* حقول مطلوبة

ENDTABLE &BottomHTML; } # end Add Entry sr sub Summary { &TopHTML; print <<_TOP_OF_PAGE;
لإضافة ملاحظاتك وتوقيعك، تفضل هنا!
_TOP_OF_PAGE &GetEntries; print <<_BOTTOM_HTML; \$BorderBottom
خاص بالمشرف على السجل \$ContinueWording

إضافة التوقيع

$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 ("Couldn't open guestbook entries file."); @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 ("Couldn't open guestbook entries file."); foreach \$uno(@newarray) { chomp(\$uno); print THIS "\$uno\n"; } close (THIS); open (DIAG, ">\$GB_NON_CGI_Path/diagnostic.file") || die ("Couldn't open guestbook diagnostic file."); print DIAG "don't delete this file if you are running the Ultimate Guestbook"; 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 ("Couldn't open guestbook entries file."); @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 = "2"; } 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(السجلات التالية); } else { \$ContinueWording = ""; } @finalarray = @sortentries[\$startarraynum...$endarraynum]; print< عرض السجلات $start - $end من اجمالي السجلات ($Total)          $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< نُشِرَ في $entryline[0] $entryline[1] $TimeZone    مسح هذا التوقيع؛ خاص بالمشرف
$entryline[5] Guts2 if (\$AlternateColor eq "$AltRowColor1") { \$AlternateColor = "$AltRowColor2"; } else { \$AlternateColor = "$AltRowColor1"; } } #end FOREACH } else { print< $Field1 $Field4 لا يوجد توقيعات في سجل الزوار حالياَ GUTS } } #end sr sub TopHTML { print< \$GBTitle \$Header
$GBTitle
TOP } #end TopHTML sr sub BottomHTML { print< \$Footer

ترجمة جبــال
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" , "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"); #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 = "صباحاً"; \$USHour = "$hour"; } if (\$hour > 12) { \$USHour = $hour - 12; \$AMPM = "مساء"; } if (\$hour == 12) { \$AMPM = "PM"; \$USHour = "12"; } if (\$hour == 0) { \$USHour = "12"; } \$UHhour = sprintf ("%2d", $USHour); \$USHour =~tr/ /0/; }