################################################# #Newcalendar for SP1 mod by Ironwing and GauGau.# #Based on Event Calendar by Nermware # #Support: boardmod.yabbforums.com # #Version 3.51a # ################################################# $Newcalendarplver = 'NewcalendarSP1 3.51a for SP1'; # CalMain is the main calendar routine, called by YaBB sub CalMain { $rev = "1.3.1"; #This is the Nermware calendar ver num, must not change require "$vardir/eventcal.txt"; #This is the settings file @sbjlist = split(" ",$sbjlist); $yytitle = $calpagetitle; $dbfile = "$vardir/eventcaldb"; #This is the database file $origcom = qq~$ecaltxt{'58'}eventcalendar.pl v$rev$ecaltxt{'59'}~;# Nermware credit must remain $adaptcom = 'Ironwing'; use Time::Local; use CGI; $webpage_obj = new CGI; $acttype = GetActType(); @seldate = GetSelDate(); GetDbData(); if($acttype =~ /display/) { CalBDay2(); DisCalendar(); DisCalForm(); } EnterData() if($acttype =~ /enterdata/); ViewData() if($acttype =~ /viewdata/); NewCalSearch() if($acttype =~ /search/); if(($acttype =~ /newdata/) || ($acttype =~ /deldata/)) { NewData(); $acttype = display; GetDbData(); if ($addbdays == 1) { CalBDay2(); } DisCalendar(); DisCalForm(); } SendTrailer(); &template; exit; } # GetActType determines type of action selected by user # called by CalMain sub and IndexCal sub sub GetActType { my($type) = "display"; $type = $webpage_obj->param('acttype') if(defined($webpage_obj->param('acttype'))); $type = newdata if(defined($webpage_obj->param('newdata'))); $type = deldata if(defined($webpage_obj->param('deldata'))); return('display') if ($type =~ /display/); return('enterdata') if ($type =~ /enterdata/); return('viewdata') if($type =~/viewdata/); return('newdata') if($type =~/newdata/); return('deldata') if($type =~/deldata/); return('search') if($type =~/search/); return('badtype'); } # GetSelDate determines current time/date or selected time/date to display # called by CalMain sub and IndexCal sub sub GetSelDate { (my($selmonth),my($selday),my($selyear)) = (localtime(time + (3600*($timeoffset + $settings[18]))))[4,3,5]; $selyear = $selyear+1900; $selmonth = $webpage_obj->param('selmonth') if (defined($webpage_obj->param('selmonth'))); $selday = $webpage_obj->param('selday') if (defined($webpage_obj->param('selday'))); $selyear = $webpage_obj->param('selyear') if (defined($webpage_obj->param('selyear'))); return($selmonth,$selday,$selyear); } # GetDbData gets event data from database and builds recurring event data, # called by CalMain sub and IndexCal sub sub GetDbData { my($thismonth) = $seldate[0]; my($thisyear) = $seldate[2]; my($selmonfst) = timegm(0,0,0,1,$thismonth,$thisyear); # my($nextmonth) = $thismonth+1; my($nextmonth) = $thismonth+2; my($nextyear) = $thisyear; if($nextmonth = 12) { $nextmonth = 0; $nextyear = $thisyear+1; } if($nextmonth = 13) { $nextmonth = 1; $nextyear = $thisyear+1; } my($nxtmonfst) = timegm(0,0,0,1,$nextmonth,$nextyear); die("ERROR .. unable to open $dbfile\n") unless fopen(DBFILE,$dbfile); while ($strline=) { chop($strline); @line = split(/\|/,$strline); my($index) = shift(@line); $dayinfo{$index} = [ @line ] if($index < $nxtmonfst); } fclose(DBFILE); # return if(($acttype !~ /display/) && ($acttype !~ /viewdata/)); return if(($acttype =~ /enterdata/) || ($acttype =~ /newdata/) || ($acttype =~ /deldata/) || ($acttype =~ /badtype/) ); my($daysecs) = 24*60*60; my($weeksecs) = 168*60*60; my(@dayinfokeys) = keys(%dayinfo); foreach $index (@dayinfokeys) { my($element) = ""; my(@entry) = (); foreach $element (@{ $dayinfo{$index} }) { my(@entry) = split('{',$element); my($repeatfor) = $entry[$#entry]; if($repeatfor > 1) { my($newindex) = $index; $addsecs = $daysecs if($entry[$#entry-1] =~ /$ecaltxt{'43'}/); $addsecs = $weeksecs if($entry[$#entry-1] =~ /$ecaltxt{'44'}/); if(($entry[$#entry-1] =~ /$ecaltxt{'43'}/) || ($entry[$#entry-1] =~ /$ecaltxt{'44'}/)) { for($i=2;$i<=$repeatfor;$i++) { $newindex = $newindex + $addsecs; $entry[$#entry] = 0; ${$dayinfo{$newindex}}[++$#{$dayinfo{$newindex}}] = join('{',@entry) if(($newindex < $nxtmonfst) && ($newindex >= $selmonfst)); } next; } my($addyears) = my($addmonths) = 0; $addyears = 1 if($entry[$#entry-1] =~ /$ecaltxt{'46'}/); $addmonths = 1 if($entry[$#entry-1] =~ /$ecaltxt{'45'}/); my(@thisdate) = gmtime($index); ### added for holder $addmonths = 1 if($entry[$#entry-1] =~ /$ecaltxt{'46a'}/); # find day of week of this event my ($dayofweek) = $thisdate[6]; # find week of month of this event my ($weekofmonth) = int( ($thisdate[3] - 1) / 7 ); ### splice(@thisdate,-1,3); for($i=2;$i<=$entry[$#entry];$i++) { $thisdate[4] = $thisdate[4] + $addmonths; $thisdate[5] = $thisdate[5] + $addyears; if($thisdate[4] > 11) { $thisdate[4]=0; $thisdate[5]++; } ### added for holder # find day of week of first day of new month $tstring = timegm(0,0,0,1,$thisdate[4],$thisdate[5]); my (@newmonth1st) = gmtime($tstring); my ($wdaynewmonth1st) = $newmonth1st[6]; # calculate new month day if ( $entry[$#entry-1] =~ /$ecaltxt{'46a'}/ ) { if ( $wdaynewmonth1st <= $dayofweek ) { $thisdate[3] = ( $weekofmonth * 7 ) + 1 + $dayofweek - $wdaynewmonth1st; } else { $thisdate[3] = ( $weekofmonth * 7 ) + 8 + $dayofweek - $wdaynewmonth1st; } } ### $newindex = timegm(@thisdate); ### Test if new date is in same month if ( $entry[$#entry-1] =~ /$ecaltxt{'46a'}/ ) { $testindexflag = 1; my (@testindex) = gmtime($newindex); if ( $testindex[4] != $thisdate[4] ) { $testindexflag = 0; } ${$dayinfo{$newindex}}[++$#{$dayinfo{$newindex}}] = $element if( ($newindex < $nxtmonfst) && ($newindex >= $selmonfst) && ($testindexflag == 1) ); } else { ${$dayinfo{$newindex}}[++$#{$dayinfo{$newindex}}] = $element if( ($newindex < $nxtmonfst) && ($newindex >= $selmonfst) ); } } } } } } #DisCalendar generates month view calendar page, called by CalMain sub sub DisCalendar { require "$sourcedir/MoonPhase.pl"; #This is the moon phase calculator my($thismonth) = $seldate[0]; my($thisyear) = $seldate[2]; $monthname = ($ecaltxt{'01'},$ecaltxt{'02'},$ecaltxt{'03'},$ecaltxt{'04'},$ecaltxt{'05'},$ecaltxt{'06'},$ecaltxt{'07'},$ecaltxt{'08'},$ecaltxt{'09'},$ecaltxt{'10'},$ecaltxt{'11'},$ecaltxt{'12'})[$thismonth]; my($thisdaysecs) = timegm(0,0,0,1,$thismonth,$thisyear); my($thisdayweek) = (gmtime($thisdaysecs))[6]; if ($mondayfirst == 1) { if ($thisdayweek == 0) { $thisdayweek = 6; } else { $thisdayweek = $thisdayweek - 1; } } my($daysecs) = 24*60*60; my(@today) = localtime(time + (3600*($timeoffset + $settings[18]))); my($todaysecs) = timegm(0,0,0,$today[3],$today[4],$today[5]); my($nextmonth) = $thismonth+1; my($nextyear) = $thisyear; if($nextmonth > 11) { $nextmonth = 0; $nextyear = $thisyear+1; } my($prevmonth) = $thismonth-1; my($prevyear) = $thisyear; if($prevmonth < 0) { $prevmonth = 11; $prevyear = $thisyear-1; } ###### newcaladmingroup stuff chomp $newcaladmingroup; @newcaladmingrouplist = split(",",$newcaladmingroup); $newcaladmingroupflag = 0; foreach $newcaladmingroupitem (@newcaladmingrouplist) { if ($settings[7] eq $newcaladmingroupitem) { $newcaladmingroupflag = 1; } } ############ $yymain .= qq~
~; if ($mondayfirst == 1) { $yymain .= qq~ ~; } else { $yymain .= qq~ ~; } $yymain .= qq~~ if($thisdayweek > 0); my($thisdaymonth) = 1; for($thisdaysecs;$thisdaysecs <= $thisdaysecs+$daysecs*31;$thisdaysecs=$thisdaysecs+$daysecs) { $thismoonsecs = $thisdaysecs + $daysecs; last if ((gmtime($thisdaysecs))[4] != $thismonth); $data=""; ($thisdaymonth,$thisdayweek) = (gmtime($thisdaysecs))[3,6]; if ($mondayfirst == 1) { if ($thisdayweek == 0) { $thisdayweek = 6; } else { $thisdayweek = $thisdayweek - 1; } } if (defined($dayinfo{$thisdaysecs})) { $data = ""; foreach $info (@{ $dayinfo{$thisdaysecs} }) { @daydata = split(/\{/,$info); next if($daydata[1] =~ /DELETED/); # Run UBBC interpreter on the event name. $message = $daydata[0]; # put the message back into the proper variable to do ubbc on it &wrap; if($enable_ubbc) { if(!$yyYaBBCloaded) { require "$sourcedir/YaBBC.pl"; } &DoUBBC; } &wrap2; $daydata[0] = $message; # End UBBC $data = $data . qq~
  • $daydata[0]
  • ~; } $data = $data . "

    "; # Censor the subject. &LoadCensorList; foreach (@censored) { ($tmpa,$tmpb) = @{$_}; $data =~ s~\Q$tmpa\E~$tmpb~gi; } # End censor subject routine } # Add bday code if ($addbdays == 1) { while (($bdaykey, $bdayindex) = each %bdayshash) { if ($bdayindex == $thisdaysecs) { $data .= qq~
  • $ecaltxt{'57'}$bdaykey

  • ~; } } } # End bday code # Add moon phase info if ($newcalmoon == 1) { ( $MoonPhase, $MoonIllum, $MoonAge, $MoonDist, $MoonAng, $SunDist, $SunAng ) = phase($thismoonsecs); if ( ($MoonPhase >= 0.48305) && ( $MoonPhase <= 0.51695) ){ $data = $data . '
    ' . qq~ $ecaltxt{'78'}~; } if ( ($MoonPhase <= 0.01695) || ( $MoonPhase >= 0.98305) ){ $data = $data . '
    ' . qq~ $ecaltxt{'77'}~; } } # end moon phase info if($thisdayweek == 0) { $yymain .= qq~~; } else { $yymain .= qq~$thisdaymonth$data~; } } else { if($todaysecs == $thisdaysecs) { $yymain .= qq~$thisdaymonth$data~; } else { $yymain .= qq~$thisdaymonth$data~; } } } else { if($todaysecs == $thisdaysecs) { $yymain .= qq~$thisdaymonth$data~; } else { $yymain .= qq~$thisdaymonth$data~; } } } $yymain .= qq~
    $caltitle
    $monthname         $thisyear
    $ecaltxt{'14'}
    $ecaltxt{'15'}
    $ecaltxt{'16'}
    $ecaltxt{'17'}
    $ecaltxt{'18'}
    $ecaltxt{'19'}
    $ecaltxt{'13'}
    $ecaltxt{'13'}
    $ecaltxt{'14'}
    $ecaltxt{'15'}
    $ecaltxt{'16'}
    $ecaltxt{'17'}
    $ecaltxt{'18'}
    $ecaltxt{'19'}
    ~; } else { $yymain .= qq~ ~; } if( $username ne "Guest" || $newcalguest == 1 ){ # if ($newcaladmin != 1 || $settings[7] eq 'Administrator' ) { if ($newcaladmin != 1 || $newcaladmingroupflag == 1 || $settings[7] eq 'Administrator' ) { if($todaysecs == $thisdaysecs) { $yymain .= qq~$thisdaymonth$data

    ~; $yymain .= qq~$ecaltxt{'24'}
    $ecaltxt{'25'}
    ~; } # DisCalForm displays select month-year form at bottom of month view page, called by CalMain sub DisCalForm { $yymain .= qq~
    $ecaltxt{'26'}
    $ecaltxt{'27'}
    $ecaltxt{'28'}
    ~; } # EnterData generates Edit Events page, called by CalMain sub EnterData { my($daynum) = timegm(0,0,0,$seldate[1],$seldate[0],$seldate[2]); if (defined($dayinfo{$daynum})) { my($entrynum) = 0; foreach $entry (@{ $dayinfo{$daynum} }) { my(@daydata) = split(/\{/,$entry); $dayvars[$entrynum] = [ @daydata ]; $entrynum++; } } ($thisdaymonth,$thismonth,$thisyear,$thisdayweek) = (gmtime($daynum))[3,4,5,6]; $thisweekdayname = ($ecaltxt{'13'},$ecaltxt{'14'},$ecaltxt{'15'},$ecaltxt{'16'},$ecaltxt{'17'},$ecaltxt{'18'},$ecaltxt{'19'})[$thisdayweek]; $monthname = ($ecaltxt{'01'},$ecaltxt{'02'},$ecaltxt{'03'},$ecaltxt{'04'},$ecaltxt{'05'},$ecaltxt{'06'},$ecaltxt{'07'},$ecaltxt{'08'},$ecaltxt{'09'},$ecaltxt{'10'},$ecaltxt{'11'},$ecaltxt{'12'})[$thismonth]; $thisyear += 1900; if ($newcaldate == 1) { $newcaldatestring = qq~$thisweekdayname $thisdaymonth. $monthname $thisyear~; } else { $newcaldatestring = qq~$thisweekdayname, $monthname $thisdaymonth, $thisyear~; } my($entrynumstr)=1; my($title) = ""; my($subject) = "$sbjdefault"; my($repeatnum) = 1; my($repeatby) = "Daily"; my($comment) = ""; my($eventusername) = 'Invalid user name placeholder'; #Sets variable to string no legitimate user name could possibly be. ###### newcaladmingroup stuff chomp $newcaladmingroup; @newcaladmingrouplist = split(",",$newcaladmingroup); $newcaladmingroupflag = 0; foreach $newcaladmingroupitem (@newcaladmingrouplist) { if ($settings[7] eq $newcaladmingroupitem) { $newcaladmingroupflag = 1; } } ############ $yymain .= qq~

    $entitle


    ~; $newcalmax2 = $newcalmax - 1; for ($entrynum=0;$entrynum<=$newcalmax2;$entrynum++) { if (${$dayvars[$entrynum]}[1] !~ /DELETED/) { $title = ${$dayvars[$entrynum]}[0] if (defined(${$dayvars[$entrynum]}[0])); $subject = ${$dayvars[$entrynum]}[1] if (defined(${$dayvars[$entrynum]}[1])); $comment = ${$dayvars[$entrynum]}[2] if (defined(${$dayvars[$entrynum]}[2])); $comment =~ s~
    ~\n~g; $eventusername = ${$dayvars[$entrynum]}[3] if (defined(${$dayvars[$entrynum]}[3])); $repeatby = ${$dayvars[$entrynum]}[4] if (defined(${$dayvars[$entrynum]}[4])); $repeatnum = ${$dayvars[$entrynum]}[5] if (defined(${$dayvars[$entrynum]}[5])); } if($username eq $eventusername || $settings[7] eq 'Administrator' || $newcaladmingroupflag == 1 || $eventusername eq 'Invalid user name placeholder') { if($eventusername eq 'Invalid user name placeholder') {$eventusername = $username}; #Sets new events to current username ##### Get Display name # Load the current nickname of the account name of the event poster. if( $eventusername ne 'Guest' && -e "$memberdir/$eventusername.dat" ) { &LoadUser($eventusername); $mname2 = $userprofile{$eventusername}->[1] || $mname2 || $txt{'28'}; } else { $mname2 ||= $txt{'28'}; } ##### Get Display name end $yymain .= qq~
    $ecaltxt{'41'}$entrynumstr$ecaltxt{'42'}$newcaldatestring
    $ecaltxt{'31'} $ecaltxt{'37'}
    $ecaltxt{'50'} $ecaltxt{'35'}
    $ecaltxt{'54'} $mname2
    ~; } # The above closing bracket is the end of the username controlled exclusion $entrynumstr++; $title = ""; $subject = "$sbjdefault"; $repeatnum = 1; $repeatby = "Daily"; $comment = ""; $eventusername = 'Invalid user name placeholder'; #reset the variable for the next iteration } $yymain .=qq~ $ecaltxt{'53'}
    $ecaltxt{'31'} $ecaltxt{'32'}
    $ecaltxt{'33'} $ecaltxt{'34'}
    $ecaltxt{'35'} $ecaltxt{'36'}
    $ecaltxt{'37'} $ecaltxt{'38'}
    $ecaltxt{'39'} $ecaltxt{'40'}

    ~; } # ViewData shows Events Details page, called by CalMain sub ViewData { my($daynum) = timegm(0,0,0,$seldate[1],$seldate[0],$seldate[2]); if (defined($dayinfo{$daynum})) { my($entrynum) = 0; foreach $entry (@{ $dayinfo{$daynum} }) { my(@daydata) = split(/\{/,$entry); $dayvars[$entrynum] = [ @daydata ]; $entrynum++; } } #### new date string stuff ($thisdaymonth,$thismonth,$thisyear,$thisdayweek) = (gmtime($daynum))[3,4,5,6]; $thisweekdayname = ($ecaltxt{'13'},$ecaltxt{'14'},$ecaltxt{'15'},$ecaltxt{'16'},$ecaltxt{'17'},$ecaltxt{'18'},$ecaltxt{'19'})[$thisdayweek]; $monthname = ($ecaltxt{'01'},$ecaltxt{'02'},$ecaltxt{'03'},$ecaltxt{'04'},$ecaltxt{'05'},$ecaltxt{'06'},$ecaltxt{'07'},$ecaltxt{'08'},$ecaltxt{'09'},$ecaltxt{'10'},$ecaltxt{'11'},$ecaltxt{'12'})[$thismonth]; $thisyear += 1900; if ($newcaldate == 1) { $newcaldatestring = qq~$thisweekdayname $thisdaymonth. $monthname $thisyear~; } else { $newcaldatestring = qq~$thisweekdayname, $monthname $thisdaymonth, $thisyear~; } my($subject) = ""; my($commentview) = ""; $yymain .= qq~

    $vwtitle


    ~; $newcalmax2 = $newcalmax - 1; for ($entrynum=0;$entrynum<=$newcalmax2;$entrynum++) { next if !(defined(${$dayvars[$entrynum]}[0])); next if(${$dayvars[$entrynum]}[1] =~ /DELETED/); # Addon for user security $commentview = ${$dayvars[$entrynum]}[2] if (defined(${$dayvars[$entrynum]}[2])); $eventusername = ${$dayvars[$entrynum]}[3] if (defined(${$dayvars[$entrynum]}[3])); # Censor the subject and message. &LoadCensorList; foreach (@censored) { ($tmpa,$tmpb) = @{$_}; $commentview =~ s~\Q$tmpa\E~$tmpb~gi; ${$dayvars[$entrynum]}[0] =~ s~\Q$tmpa\E~$tmpb~gi; } ##### Get Display name # Load the current nickname of the account name of the event poster. if( $eventusername ne 'Guest' && -e "$memberdir/$eventusername.dat" ) { &LoadUser($eventusername); $mname = $userprofile{$eventusername}->[1] || $mname || $txt{'28'}; $mname2 = $mname; $mname = qq~$mname~; } else { $mname = $txt{'28'}; $mname2 = $mname; } ##### Get Display name end ####### Media Player mod $mediausername = $mname2; ####### Media Player mod end # Run UBBC interpreter on the description. $message = $commentview; # put the message back into the proper variable to do ubbc on it &wrap; if($enable_ubbc) { if(!$yyYaBBCloaded) { require "$sourcedir/YaBBC.pl"; } &DoUBBC; } &wrap2; $commentview = $message; # Run UBBC interpreter on the event name. $eventnamesend = ${dayvars[$entrynum]}[0]; #bypass UBBC for SendEvent $message = ${dayvars[$entrynum]}[0]; # put the message back into the proper variable to do ubbc on it &wrap; if($enable_ubbc) { if(!$yyYaBBCloaded) { require "$sourcedir/YaBBC.pl"; } &DoUBBC; } &wrap2; ${dayvars[$entrynum]}[0] = $message; # End UBBC #End addon for user security $yymain .= qq~ ~; #### send event form if ($newcalsend == 1) { my($eventday) = $seldate[1]; my($eventmonth) = $seldate[0]; my($eventyear) = $seldate[2]; $yymain .= qq~ ~; } #### end send event form } $yymain .= qq~
    $ecaltxt{'49'}$newcaldatestring

    $ecaltxt{'31'} ${$dayvars[$entrynum]}[0]
    $ecaltxt{'50'} ${$dayvars[$entrynum]}[1]
    $ecaltxt{'35'} $commentview
    $ecaltxt{'54'} $mname


    ~; } # NewData writes new enteries to database file, called by CalMain sub sub NewData { my($daynum) = timegm(0,0,0,$seldate[1],$seldate[0],$seldate[2]); my($arrayloc) = $webpage_obj->param('formnum'); my($title) = $webpage_obj->param('title'); my($subject) = $webpage_obj->param('subject'); my($comment) = $webpage_obj->param('comment'); my($eventusername) = $webpage_obj->param('eventusername'); my($repeatby) = $webpage_obj->param('repeatby'); my($repeatnum) = $webpage_obj->param('repeatnum'); # Addon for user security $title =~ s/\cM//g; $title =~ s~\[([^\]]{0,30})\n([^\]]{0,30})\]~\[$1$2\]~g; $title =~ s~\[/([^\]]{0,30})\n([^\]]{0,30})\]~\[/$1$2\]~g; $title =~ s~(\w+://[^<>\s\n\"\]\[]+)\n([^<>\s\n\"\]\[]+)~$1\n$2~g; $eventusername =~ tr/!-~/ /cs; if (length($comment)>$MaxMessLen) { &fatal_error($txt{'499'}); } &spam_protection; $comment =~ s/\cM//g; $comment =~ s~\[([^\]]{0,30})\n([^\]]{0,30})\]~\[$1$2\]~g; $comment =~ s~\[/([^\]]{0,30})\n([^\]]{0,30})\]~\[/$1$2\]~g; $comment =~ s~(\w+://[^<>\s\n\"\]\[]+)\n([^<>\s\n\"\]\[]+)~$1\n$2~g; &ToHTML($comment); $comment =~ s~\t~ \  \  \ ~g; $comment =~ s~\n~
    ~g; # End addon for user security # $repeatby =~ tr/!-~/ /cs; $repeatnum =~ tr/!-~/ /cs; $title =~ s/[\{\|]//g; $subject =~ s/[\{\|]//g; $comment =~ s/[\{\|]//g; $eventusername =~ s/[\{\|]//g; $repeatby =~ s/[\{\|]//g; $repeatnum =~ s/[\{\|]//g; $subject = "DELETED" if($acttype=~/deldata/); my($dbentry) = join( '{',$title,$subject,$comment,$eventusername,$repeatby,$repeatnum); ${$dayinfo{$daynum}}[$arrayloc]="$dbentry"; my($dbrow) = "$daynum"; foreach $one (@{$dayinfo{$daynum}}) { $dbrow = join('|',$dbrow,$one); } die("ERROR .. unable to open $dbfile\n") unless fopen(DBFILE,">>$dbfile"); print(DBFILE "$dbrow\n"); fclose(DBFILE); CompactCal(); } # SendTrailer puts footer at bottom of all calendar pages. # Nermware credit must be shown on all calendar pages. sub SendTrailer { my $helpfile2 = $helpfile; $helpfile2 =~ m/(.+)(\/.+$)/; my $newcalhelpfile = $1 . qq~/NewcalendarHelp.html~; $yymain .= qq~
    $ecaltxt{'89'}~; if ($newcalhelp == 1) { $yymain .= qq~                  $ecaltxt{'96'}~; } $yymain .= qq~
    $ecaltxt{'23'}$mbname

    $origcom
    $Newcalendarplver$ecaltxt{'51'}$adaptcom
    ~; } #CompactCal removes duplicate calendar entries. Called by sub NewData. sub CompactCal { # Only last record for a date is kept in hash since index is reused. # Since this sub is run each time NewData is called, the database should never contain duplicate date info. # In campactdayinfo hash: keys are index dates and values are complete date-event strings my %compactdayinfo; die("ERROR .. unable to open $dbfile\n") unless fopen(DBFILE,$dbfile); $dummy=; # read first line which is always empty while ($strline=) { chop($strline); @line = split(/\|/,$strline); my($index) = shift(@line); $compactdayinfo{$index} = $strline; } fclose(DBFILE); # now write events back to dbfile without duplicates. fopen(DBFILE, ">$dbfile"); print DBFILE qq~\n~; while (($dateindex, $dayevents) = each %compactdayinfo) { print DBFILE qq~$dayevents\n~; } fclose(DBFILE); } # CalSettings generates edit settings page for Newcalendar in the Admin Center. Calls CalSettings2. sub CalSettings { &is_admin; require "$vardir/eventcal.txt"; my($newcalopenchecked); my($newcaldatechecked); my($newcalmoonchecked); my($newcalmoon2checked); my($newcalguestchecked); my($mondayfirstchecked); my($newcalsendchecked); my($addbdayschecked); my($newcaladminchecked); my($newcalhelpchecked); if ($newcalopen) { $newcalopenchecked = ' checked'; } if ($newcaldate) { $newcaldatechecked = ' checked'; } if ($newcalmoon) { $newcalmoonchecked = ' checked'; } if ($newcalmoon2) { $newcalmoon2checked = ' checked'; } if ($newcalguest) { $newcalguestchecked = ' checked'; } if ($mondayfirst) { $mondayfirstchecked = ' checked'; } if ($addbdays) { $addbdayschecked = ' checked'; } if ($newcalsend) { $newcalsendchecked = ' checked'; } if ($newcaladmin) { $newcaladminchecked = ' checked'; } if ($newcalhelp) { $newcalhelpchecked = ' checked'; } my $helpfile2 = $helpfile; $helpfile2 =~ m/(.+)(\/.+$)/; my $newcalhelpfile = $1 . qq~/NewcalendarHelp.html~; $yymain .= qq~
    $ecaltxt{'60'}
    $ecaltxt{'96'}
    $ecaltxt{'61'}
    $txt{'593'}
    $ecaltxt{'62'}
    $ecaltxt{'63'}
    $ecaltxt{'64'}
    $ecaltxt{'65'}
    $ecaltxt{'66'}
    $ecaltxt{'67'}
    $ecaltxt{'68'}
    $ecaltxt{'69'}
    $ecaltxt{'75'}
    $ecaltxt{'94'}

    $ecaltxt{'93'}
    $ecaltxt{'95'}
    $ecaltxt{'71'}
    $ecaltxt{'72'}
    $ecaltxt{'80'}

    $ecaltxt{'74'}
    $ecaltxt{'76'}

    $ecaltxt{'79'}
    $ecaltxt{'81'}

    $ecaltxt{'82'}
    $ecaltxt{'88'}
    $ecaltxt{'97'}

    ~; $yytitle = $ecaltxt{'60'}; &template; exit; } # CalSettings2 saves changes to Newcalendar settings in eventcal.txt. Called by CalSettings. sub CalSettings2 { &is_admin; my @onoff = qw/ newcaladmin newcalopen newcalguest newcaldate mondayfirst newcalmoon newcalmoon2 addbdays newcalsend/; # Set as 0 or 1 if box was checked or not my $fi; map { $fi = lc $_; ${$_} = $FORM{$fi} eq 'on' ? 1 : 0; } @onoff; $newcalopen = $FORM{'newcalopen'} || 0; $newcaldate = $FORM{'newcaldate'} || 0; $newcalmoon = $FORM{'newcalmoon'} || 0; $newcalmoon2 = $FORM{'newcalmoon2'} || 0; $newcalguest = $FORM{'newcalguest'} || 0; $mondayfirst = $FORM{'mondayfirst'} || 0; $addbdays = $FORM{'addbdays'} || 0; $newcalsend = $FORM{'newcalsend'} || 0; $newcaladmin = $FORM{'newcaladmin'} || 0; $newcalhelp = $FORM{'newcalhelp'} || 0; $calpagetitle = $FORM{'calpagetitle'} || 'My Calendar Page'; $caltitle = $FORM{'caltitle'} || 'My Calendar'; $sbjlist = $FORM{'sbjlist'} || 'Meeting Game Birthday Anniversary Other'; $sbjdefault = $FORM{'sbjdefault'} || 'Meeting'; $vwpgtitle = $FORM{'vwpgtitle'} || 'Notices for Selected Date'; $vwtitle = $FORM{'vwtitle'} || 'Notices for Selected Date'; $enpgtitle = $FORM{'enpgtitle'} || 'Edit Notices Page'; $entitle = $FORM{'entitle'} || 'Edit Notices Page'; $newcalmax = $FORM{'newcalmax'} || 5; if ($newcalmax < 1) {$newcalmax = 1}; $newcalspread = $FORM{'newcalspread'} || 1; if ($newcalspread < 1) {$newcalspread = 1}; $newcalgroup = $FORM{'newcalgroup'} || 'Newcalendar Group'; $newcaladmingroup = $FORM{'newcaladmingroup'} || 'Newcalendar Moderators'; my $filler = q~ ~; my $setfile = << "EOF"; ############################################################################### # eventcal.txt - Settings for Newcalendar 3.51 # ############################################################################### \$calpagetitle = "$calpagetitle"; # Title of the calendar page (window title) \$caltitle = "$caltitle"; # Title of the calendar (not the window title) \$sbjlist = "$sbjlist"; # Selection for subject (type) menu, modify to suit event types desired \$sbjdefault = "$sbjdefault"; # Default subject list selection \$vwpgtitle = "$vwpgtitle"; # Viewer page title (window title) \$vwtitle = "$vwtitle"; # Viewer table title (not the window title) \$enpgtitle = "$enpgtitle"; # Edit page title (window title) \$entitle = "$entitle"; # Edit table title (not the window title) \$newcalmax = $newcalmax; # Maximum number of events per date (default = 5) \$newcalspread = $newcalspread; # Number of days of events to display on BoardIndex, Whoson, and SSI (default = 1) \$newcaladmin = $newcaladmin; # Set to 1 to limit event posting to Admins and Cal Moderators only, 0 for all members \$newcaladmingroup = "$newcaladmingroup"; # Names of groups to allow event posting if newcaladmin = 1 \$newcalgroup = "$newcalgroup"; # Names of groups to give exclusive calendar access if newcalopen = 0 \$newcalopen = $newcalopen; # Newcalendar open to all or just admin + group Newcalgroup \$newcaldate = $newcaldate; # Newcalendar Date Format: Check for 31/12/2002,
    uncheck for 12/31/2002 \$newcalmoon = $newcalmoon; # Newcalendar moon phase on/off switch for main calendar \$newcalmoon2 = $newcalmoon2; # Newcalendar moon phase on/off switch for BoardIndex, Who'on, and SSI \$newcalguest = $newcalguest; # Newcalendar guest event posting on/off switch \$mondayfirst = $mondayfirst; # First day of week: Checked - Sunday, Unchecked - Monday \$addbdays = $addbdays; # Add birthdays to calendar: checked on, unchecked off \$newcalsend = $newcalsend; # Allow users to send event notices via email: checked on, unchecked off \$newcalhelp = $newcalhelp; # Show Calendar Help file link next to Calendar Search: checked on, unchecked off 1; EOF $setfile =~ s~(.+\;)\s+(\#.+$)~$1 . substr( $filler, 0, (70-(length $1)) ) . $2 ~gem; $setfile =~ s~(.{64,}\;)\s+(\#.+$)~$1 . "\n " . $2~gem; $setfile =~ s~^\s\s\s+(\#.+$)~substr( $filler, 0, 70 ) . $1~gem; fopen(FILE, ">$vardir/eventcal.txt"); print FILE $setfile; fclose(FILE); $yySetLocation = qq~$cgi;action=admin~; &redirectexit; } # IndexCal and IndexCal2 show today's events in Info Center on BoardIndex # Split into two subs to allow for addon mods (like CalBDay), called by YaBB sub IndexCal { require "$vardir/eventcal.txt"; #This is the settings file @sbjlist = split(" ",$sbjlist); $yytitle = $calpagetitle; $dbfile = "$vardir/eventcaldb"; #This is the database file use Time::Local; #keep? Try without and see use CGI; #Already called in YaBB but may need more functions $webpage_obj = new CGI; #keep or lose? $acttype = GetActType(); @seldate = GetSelDate(); GetDbData(); IndexCal2(); } # IndexCal2 shows today's events in Info Center on BoardIndex, called by IndexCal sub sub IndexCal2 { my($thismonth) = $seldate[0]; my($thisyear) = $seldate[2]; my($newcalspread2) = 24*60*60*($newcalspread-1); my($daysecs) = 24*60*60; my(@today) = localtime(time + (3600*($timeoffset + $settings[18]))); my($todaysecs) = timegm(0,0,0,$today[3],$today[4],$today[5]); my($thisdaysecs) = $todaysecs; my($thisdaymonth) = 1; my ($addbdaytext) = 0; $data = ""; for ($thisdaysecs = $todaysecs; $thisdaysecs <= $todaysecs+$newcalspread2; $thisdaysecs += $daysecs) { $data2 = ""; ($thisdaymonth,$thismonth,$thisdayweek) = (gmtime($thisdaysecs))[3,4,6]; if (defined($dayinfo{$thisdaysecs})) { foreach $item (@sbjlist) { $itemcount=0; foreach $info (@{ $dayinfo{$thisdaysecs} }) { @daydata = split(/\{/,$info); next if($daydata[1] =~ /DELETED/); # Run UBBC interpreter on the event name. $message = $daydata[0]; # put the message back into the proper variable to do ubbc on it &wrap; if($enable_ubbc) { if(!$yyYaBBCloaded) { require "$sourcedir/YaBBC.pl"; } &DoUBBC; } &wrap2; $daydata[0] = $message; # End UBBC $daydata[0] =~ s/(^.+)( $)/$1/; chomp $item; if($daydata[1] eq $item) { if ($itemcount == 0) { $data2 = $data2 . qq~
  • $daydata[1]: $daydata[0]~; $itemcount++; } else { $data2 = $data2 . qq~, $daydata[0]~; $itemcount++; } } } } # Censor the subject. &LoadCensorList; foreach (@censored) { ($tmpa,$tmpb) = @{$_}; $data =~ s~\Q$tmpa\E~$tmpb~gi; } } #### new b-day stuff if ($addbdays == 1) { my($bdaymonth,$bmonth,$byear,$bdayweek) = (gmtime($thisdaysecs))[3,4,5,6]; $bmonth += 1; $byear += 1900; $calwhobg = ""; $countbd = 0; fopen(FILE, "$memberdir/memberlist.txt") || die "cannot open list file"; @members = ; fclose(FILE); foreach $usernames (@members) { chomp $usernames; if ( -e "$memberdir/$usernames.dat") { fopen(FILE, "$memberdir/$usernames.dat") || die "cannot open user file"; @userbd = ; fclose(FILE); chomp $userbd[16]; ($matchm, $matchd, $useryear) = split(/\//, $userbd[16]); if(($bmonth == $matchm) && ($bdaymonth == $matchd)) { $age = $byear - $useryear; $calwhobg .=qq~$userbd[1] ($age) ~; $countbd++; } } } chomp $calwhobg; if ($calwhobg ne "") { $calwhobg = qq~
  • $ecaltxt{'56'}$calwhobg
  • ~; } } ### end new b-day stuff if ( $calwhobg ne "" || $data2 ne "" ) { if ( $todaysecs == $thisdaysecs) { $data .= qq~$txt{'769'}:~ . $data2 . $calwhobg; } else { $thisweekdayname = ($ecaltxt{'13'},$ecaltxt{'14'},$ecaltxt{'15'},$ecaltxt{'16'},$ecaltxt{'17'},$ecaltxt{'18'},$ecaltxt{'19'})[$thisdayweek]; $monthname = ($ecaltxt{'01'},$ecaltxt{'02'},$ecaltxt{'03'},$ecaltxt{'04'},$ecaltxt{'05'},$ecaltxt{'06'},$ecaltxt{'07'},$ecaltxt{'08'},$ecaltxt{'09'},$ecaltxt{'10'},$ecaltxt{'11'},$ecaltxt{'12'})[$thismonth]; if ($newcaldate == 1) { $data .= qq~
    $thisweekdayname $thisdaymonth. $monthname:~ . $data2 . $calwhobg; } else { $data .= qq~
    $thisweekdayname, $monthname $thisdaymonth:~ . $data2 . $calwhobg; } } } } # end of loop for each date if ($data ne "") { $yymain .= qq~$data~; } else { $yymain .= qq~$ecaltxt{'73'}~; } } # CalBDay2 adds All Birthdays to Calendar, called by CalMain sub sub CalBDay2 { %bdayshash; #keys are userprofstrings, values are birthdays in timegm format my $thisyear = $seldate[2]; $userprofstring = ""; open(FILE, "$memberdir/memberlist.txt") || die "cannot open list file"; @members = ; close(FILE); foreach $usernames (@members) { chomp $usernames; if ( -e "$memberdir/$usernames.dat") { fopen(FILE, "$memberdir/$usernames.dat") || die "cannot open user file"; @userbd = ; fclose(FILE); chomp $userbd[16]; #skip user if no birthday in file or birthday date invalid. if ($userbd[16] ne "") { ($usermonth, $userday, $dummyyear) = split(/\//, $userbd[16]); if ($usermonth > 0 && $usermonth < 13) { if ($userday > 0 && $userday < 32) { $usermonth = $usermonth - 1; $bdayindex = timegm(0,0,0,$userday,$usermonth,$thisyear); $userprofstring = qq~$userbd[1]~; $bdayshash{$userprofstring} = $bdayindex; } } } }# end file exists }#end foreach } # IncludeCal and IncludeCal2 show today's events on any HTML page through include virtual # Split into two subs to allow for addon mods (like CalBDay), called by YaBB sub IncludeCal { require "$vardir/eventcal.txt"; #This is the settings file require "$sourcedir/MoonPhase.pl"; #This is the moon phase calculator @sbjlist = split(" ",$sbjlist); $yytitle = $calpagetitle; $dbfile = "$vardir/eventcaldb"; #This is the database file use Time::Local; #keep? Try without and see use CGI; #Already called in YaBB but may need more functions $webpage_obj = new CGI; #keep or lose? $acttype = GetActType(); @seldate = GetSelDate(); GetDbData(); IncludeCal2(); exit; } # IncludeCal2 shows today's events as SSI call on html pages, called by IncludeCal sub sub IncludeCal2 { my($thismonth) = $seldate[0]; my($thisyear) = $seldate[2]; my($newcalspread2) = 24*60*60*($newcalspread-1); my($daysecs) = 24*60*60; my(@today) = localtime(time + (3600*($timeoffset + $settings[18]))); my($todaysecs) = timegm(0,0,0,$today[3],$today[4],$today[5]); my($thisdaysecs) = $todaysecs; my($thisdaymonth) = 1; my ($addbdaytext) = 0; $data = ""; for ($thisdaysecs = $todaysecs; $thisdaysecs <= $todaysecs+$newcalspread2; $thisdaysecs += $daysecs) { $data2 = ""; ($thisdaymonth,$thismonth,$thisdayweek) = (gmtime($thisdaysecs))[3,4,6]; if (defined($dayinfo{$thisdaysecs})) { foreach $item (@sbjlist) { $itemcount=0; foreach $info (@{ $dayinfo{$thisdaysecs} }) { @daydata = split(/\{/,$info); next if($daydata[1] =~ /DELETED/); # Run UBBC interpreter on the event name. $message = $daydata[0]; # put the message back into the proper variable to do ubbc on it &wrap; if($enable_ubbc) { if(!$yyYaBBCloaded) { require "$sourcedir/YaBBC.pl"; } &DoUBBC; } &wrap2; $daydata[0] = $message; # End UBBC $daydata[0] =~ s/(^.+)( $)/$1/; chomp $item; if($daydata[1] eq $item) { if ($itemcount == 0) { $data2 = $data2 . qq~
  • $daydata[1]: $daydata[0]~; $itemcount++; } else { $data2 = $data2 . qq~, $daydata[0]~; $itemcount++; } } } } # Censor the subject. &LoadCensorList; foreach (@censored) { ($tmpa,$tmpb) = @{$_}; $data =~ s~\Q$tmpa\E~$tmpb~gi; } } #### new b-day stuff if ($addbdays == 1) { my($bdaymonth,$bmonth,$byear,$bdayweek) = (gmtime($thisdaysecs))[3,4,5,6]; $bmonth += 1; $byear += 1900; $calwhobg = ""; $countbd = 0; fopen(FILE, "$memberdir/memberlist.txt") || die "cannot open list file"; @members = ; fclose(FILE); foreach $usernames (@members) { chomp $usernames; if ( -e "$memberdir/$usernames.dat") { fopen(FILE, "$memberdir/$usernames.dat") || die "cannot open user file"; @userbd = ; fclose(FILE); chomp $userbd[16]; ($matchm, $matchd, $useryear) = split(/\//, $userbd[16]); if(($bmonth == $matchm) && ($bdaymonth == $matchd)) { $age = $byear - $useryear; $calwhobg .=qq~$userbd[1] ($age) ~; $countbd++; } } } chomp $calwhobg; if ($calwhobg ne "") { $calwhobg = qq~
  • $ecaltxt{'56'}$calwhobg
  • ~; } } ### end new b-day stuff if ( $calwhobg ne "" || $data2 ne "" ) { if ( $todaysecs == $thisdaysecs) { $data .= qq~$txt{'769'}:~ . $data2 . $calwhobg; } else { $thisweekdayname = ($ecaltxt{'13'},$ecaltxt{'14'},$ecaltxt{'15'},$ecaltxt{'16'},$ecaltxt{'17'},$ecaltxt{'18'},$ecaltxt{'19'})[$thisdayweek]; $monthname = ($ecaltxt{'01'},$ecaltxt{'02'},$ecaltxt{'03'},$ecaltxt{'04'},$ecaltxt{'05'},$ecaltxt{'06'},$ecaltxt{'07'},$ecaltxt{'08'},$ecaltxt{'09'},$ecaltxt{'10'},$ecaltxt{'11'},$ecaltxt{'12'})[$thismonth]; if ($newcaldate == 1) { $data .= qq~
    $thisweekdayname $thisdaymonth. $monthname:~ . $data2 . $calwhobg; } else { $data .= qq~
    $thisweekdayname, $monthname $thisdaymonth:~ . $data2 . $calwhobg; } } } } # end of loop for each date # Add moon phase info if ($newcalmoon2 == 1) { ( $MoonPhase, $MoonIllum, $MoonAge, $MoonDist, $MoonAng, $SunDist, $SunAng ) = phase(); my ($newphaselow) = 0.016666667; my ($newphasehigh) = 0.983333333; my ($phaseincrement) = 0.033333333; if ( ($MoonPhase < $newphaselow) || ($MoonPhase > $newphasehigh) ){ $data = $data . '
    ' . qq~~; } else { $gifnumber = 1; for ($phasescan = $newphaselow; $phasescan < $newphasehigh; $phasescan += $phaseincrement) { if ( ($MoonPhase > $phasescan) && ( $MoonPhase <= ($phasescan + $phaseincrement)) ){ if ($gifnumber < 10) { $data = $data . '
    ' . qq~~; } else { $data = $data . '
    ' . qq~~; } } $gifnumber++; } } } # end moon phase info print qq~Content-type: text/html\n\n~; if ($data ne "") { print qq~$data~; } else { print qq~$ecaltxt{'73'}~; } } # WhosCal and WhosCal2 show today's events in the modified Whoson mod # Split into two subs to allow for addon mods (like WhosBDay), called by Whoson SSI mod sub WhosCal { require "$vardir/eventcal.txt"; #This is the settings file @sbjlist = split(" ",$sbjlist); require "$sourcedir/MoonPhase.pl"; #This is the moon phase calculator $dbfile = "$vardir/eventcaldb"; #This is the database file use Time::Local; #keep? Try without and see use CGI; #Already called in YaBB but may need more functions $webpage_obj = new CGI; #keep or lose? $acttype = GetActType(); @seldate = GetSelDate(); GetDbData(); WhosCal2(); } # WhosCal2 shows today's events in the modified Whoson mod, called by WhosCal sub sub WhosCal2 { my($thismonth) = $seldate[0]; my($thisyear) = $seldate[2]; my($newcalspread2) = 24*60*60*($newcalspread-1); my($daysecs) = 24*60*60; my(@today) = localtime(time + (3600*($timeoffset + $settings[18]))); my($todaysecs) = timegm(0,0,0,$today[3],$today[4],$today[5]); my($thisdaysecs) = $todaysecs; my($thisdaymonth) = 1; my ($addbdaytext) = 0; $data = ""; for ($thisdaysecs = $todaysecs; $thisdaysecs <= $todaysecs+$newcalspread2; $thisdaysecs += $daysecs) { $data2 = ""; ($thisdaymonth,$thismonth,$thisdayweek) = (gmtime($thisdaysecs))[3,4,6]; if (defined($dayinfo{$thisdaysecs})) { foreach $item (@sbjlist) { $itemcount=0; foreach $info (@{ $dayinfo{$thisdaysecs} }) { @daydata = split(/\{/,$info); next if($daydata[1] =~ /DELETED/); # Run UBBC interpreter on the event name. $message = $daydata[0]; # put the message back into the proper variable to do ubbc on it &wrap; if($enable_ubbc) { if(!$yyYaBBCloaded) { require "$sourcedir/YaBBC.pl"; } &DoUBBC; } &wrap2; $daydata[0] = $message; # End UBBC $daydata[0] =~ s/(^.+)( $)/$1/; chomp $item; if($daydata[1] eq $item) { if ($itemcount == 0) { $data2 = $data2 . qq~
  • $daydata[1]: $daydata[0]~; $itemcount++; } else { $data2 = $data2 . qq~, $daydata[0]~; $itemcount++; } } } } # Censor the subject. &LoadCensorList; foreach (@censored) { ($tmpa,$tmpb) = @{$_}; $data =~ s~\Q$tmpa\E~$tmpb~gi; } } #### new b-day stuff if ($addbdays == 1) { my($bdaymonth,$bmonth,$byear,$bdayweek) = (gmtime($thisdaysecs))[3,4,5,6]; $bmonth += 1; $byear += 1900; $calwhobg = ""; $countbd = 0; fopen(FILE, "$memberdir/memberlist.txt") || die "cannot open list file"; @members = ; fclose(FILE); foreach $usernames (@members) { chomp $usernames; if ( -e "$memberdir/$usernames.dat") { fopen(FILE, "$memberdir/$usernames.dat") || die "cannot open user file"; @userbd = ; fclose(FILE); chomp $userbd[16]; ($matchm, $matchd, $useryear) = split(/\//, $userbd[16]); if(($bmonth == $matchm) && ($bdaymonth == $matchd)) { $age = $byear - $useryear; $calwhobg .= qq~$userbd[1]
    ~; $countbd++; } } } chomp $calwhobg; if ($calwhobg ne "") { $calwhobg = qq~
  • $ecaltxt{'56'}$calwhobg
  • ~; } } ### end new b-day stuff if ( $calwhobg ne "" || $data2 ne "" ) { if ( $todaysecs == $thisdaysecs) { $data .= qq~$txt{'769'}:~ . $data2 . $calwhobg; } else { $thisweekdayname = ($ecaltxt{'13'},$ecaltxt{'14'},$ecaltxt{'15'},$ecaltxt{'16'},$ecaltxt{'17'},$ecaltxt{'18'},$ecaltxt{'19'})[$thisdayweek]; $monthname = ($ecaltxt{'01'},$ecaltxt{'02'},$ecaltxt{'03'},$ecaltxt{'04'},$ecaltxt{'05'},$ecaltxt{'06'},$ecaltxt{'07'},$ecaltxt{'08'},$ecaltxt{'09'},$ecaltxt{'10'},$ecaltxt{'11'},$ecaltxt{'12'})[$thismonth]; if ($newcaldate == 1) { $data .= qq~
    $thisweekdayname $thisdaymonth. $monthname:~ . $data2 . $calwhobg; } else { $data .= qq~
    $thisweekdayname, $monthname $thisdaymonth:~ . $data2 . $calwhobg; } } } } # end of loop for each date # Add moon phase info if ($newcalmoon2 == 1) { ( $MoonPhase, $MoonIllum, $MoonAge, $MoonDist, $MoonAng, $SunDist, $SunAng ) = phase(); my ($newphaselow) = 0.016666667; my ($newphasehigh) = 0.983333333; my ($phaseincrement) = 0.033333333; if ( ($MoonPhase < $newphaselow) || ($MoonPhase > $newphasehigh) ){ $data = $data . '
    ' . qq~~; } else { $gifnumber = 1; for ($phasescan = $newphaselow; $phasescan < $newphasehigh; $phasescan += $phaseincrement) { if ( ($MoonPhase > $phasescan) && ( $MoonPhase <= ($phasescan + $phaseincrement)) ){ if ($gifnumber < 10) { $data = $data . '
    ' . qq~~; } else { $data = $data . '
    ' . qq~~; } } $gifnumber++; } } } # end moon phase info print qq~$data~; } sub NewCalSearch { $yytitle = "$ecaltxt{'89'}"; $yymain .= qq~
    $txt{'183'}
    $txt{'582'}:  
    $txt{'573'}:
    $ecaltxt{'90'} $ecaltxt{'91'}



    ~; SendTrailer(); &template; exit; } sub NewCalSearch2 { my($eventsfound) = 0; my $searchtype = $FORM{'searchtype'}; my $search = $FORM{'search'}; if( $searchtype eq 'anywords' ) { $searchtype = 2; } elsif( $searchtype eq 'asphrase' ) { $searchtype = 3; } else { $searchtype = 1; } if ($search eq ""){ &fatal_error($txt{'754'}); } if ($search =~ m~/~){ &fatal_error($txt{'397'}); } if ($search =~ m~\\~){ &fatal_error($txt{'397'}); } my $searchsubject = $FORM{'subfield'} eq 'on'; my $searchmessage = $FORM{'msgfield'} eq 'on'; $search =~ s/\A\s+//; $search =~ s/\s+\Z//; &ToHTML($search); $search =~ s/\t/ \  \  \ /g; $search =~ s/\cM//g; $search =~ s/\n/
    /g; if( $searchtype != 3 ) { @search = split( /\s+/, $search ); } else { @search = ( $search ); } require "$vardir/eventcal.txt"; #This is the settings file @sbjlist = split(" ",$sbjlist); $dbfile = "$vardir/eventcaldb"; #This is the database file use Time::Local; #keep? Try without and see use CGI; #Already called in YaBB but may need more functions $webpage_obj = new CGI; #keep or lose? $acttype = GetActType(); @seldate = GetSelDate(); GetDbData(); # at this point each key in $dayinfo{$index} holds the # date index of an event and the value is string holding # each event field, separated by {. $yymain .= qq~
    ~; ####snippet one#### my(@searchdayinfokeys) = keys(%dayinfo); foreach $searchindex (@searchdayinfokeys) { my($searchmonth, $searchday, $searchyear) = (gmtime($searchindex))[4,3,5]; $searchyear += 1900; $searchmonth += 1; my($searchelement) = ""; my(@searchentry) = (); my($entrynum) = 0; foreach $searchelement (@{ $dayinfo{$searchindex} }) { my(@searchentry) = split('{',$searchelement); $dayvars[$entrynum] = [ @searchentry ]; $entrynum++; } eventcheck: for ($entrynum=0;$entrynum<=$newcalmax2;$entrynum++) { next if !(defined(${$dayvars[$entrynum]}[0])); next if(${$dayvars[$entrynum]}[1] =~ /DELETED/); $eventname = ${$dayvars[$entrynum]}[0] if (defined(${$dayvars[$entrynum]}[0])); $eventmessage = ${$dayvars[$entrynum]}[2] if (defined(${$dayvars[$entrynum]}[2])); if( $searchsubject ) { if( $searchtype == 2 ) { $subfound = 0; foreach( @search ) { if( $eventname =~ m~\Q$_\E~i ) { $subfound = 1; last; } } } else { $subfound = 1; foreach( @search ) { if( $eventname !~ m~\Q$_\E~i ) { $subfound = 0; last; } } } } if( $searchmessage && ! $subfound ) { if( $searchtype == 2 ) { $msgfound = 0; foreach( @search ) { if( $eventmessage =~ m~\Q$_\E~i ) { $msgfound = 1; last; } } } else { $msgfound = 1; foreach( @search ) { if( $eventmessage !~ m~\Q$_\E~i ) { $msgfound = 0; last; } } } } unless( $msgfound || $subfound ) { next eventcheck; } if( $subfound || $msgfound ) { $eventsfound = 1; # this is what to do with matching events: ########### # Censor the subject and message. &LoadCensorList; foreach (@censored) { ($tmpa,$tmpb) = @{$_}; $eventmessage =~ s~\Q$tmpa\E~$tmpb~gi; $eventname =~ s~\Q$tmpa\E~$tmpb~gi; } # Run UBBC interpreter on the description. $message = $eventmessage; # put the message back into the proper variable to do ubbc on it &wrap; if($enable_ubbc) { if(!$yyYaBBCloaded) { require "$sourcedir/YaBBC.pl"; } &DoUBBC; } &wrap2; $eventmessage = $message; # Run UBBC interpreter on the event name. $eventnamesend = ${dayvars[$entrynum]}[0]; #bypass UBBC for SendEvent $message = $eventname; # put the message back into the proper variable to do ubbc on it &wrap; if($enable_ubbc) { if(!$yyYaBBCloaded) { require "$sourcedir/YaBBC.pl"; } &DoUBBC; } &wrap2; $eventname = $message; # End UBBC foreach( @search ) { $eventmessage =~ s~(\Q$_\E)~$_~ig; $eventname =~ s~(\Q$_\E)~$_~ig; } ##### Get Display name $eventusername = ${$dayvars[$entrynum]}[3]; # Load the current nickname of the account name of the event poster. if( $eventusername ne 'Guest' && -e "$memberdir/$eventusername.dat" ) { &LoadUser($eventusername); $mname = $userprofile{$eventusername}->[1] || $mname || $txt{'28'}; $mname2 = $mname; $mname = qq~$mname~; } else { $mname = $txt{'28'}; $mname2 = $mname; } ##### Get Display name end ####### Media Player mod $mediausername = $mname2; ####### Media Player mod end $yymain .= qq~ ~; } } } if ($eventsfound == 0) { $yymain .= qq~ ~; } $yymain .= qq~
    $txt{'166'}
    $ecaltxt{'85'} $searchmonth/$searchday/$searchyear
    $ecaltxt{'31'} $eventname
    $ecaltxt{'50'} ${$dayvars[$entrynum]}[1]
    $ecaltxt{'35'} $eventmessage
    $ecaltxt{'54'} $mname

    $ecaltxt{'92'}

    ~; $yytitle = "$txt{'166'}"; &template; exit; } 1;