####################################################### # Newcalendar for SP1 mod by Ironwing and GauGau. # # Based on Event Calendar by Nermware # # Support: boardmod.yabbforums.com # # Version 3.b5 Special - Group SSI Test # ####################################################### # IndexCal routine # IncludeCal routine # WhosCal routine # IncludeCal2 routine $Newcalendarplver = 'NewcalendarSP1 3.8b5'; # IndexCal shows today's events in Info Center on BoardIndex # Split into two subs to allow for addon mods, called by BoardIndex.pl, calls IncludeCal2 sub IndexCal { chomp $newcalgroup; @newcalgrouplist = split(",",$newcalgroup); $newcalgroupflag = 0; foreach $newcalgroupitem (@newcalgrouplist) { if ($settings[7] eq $newcalgroupitem) { $newcalgroupflag = 1; } } if ($newcalopen == 1 || $settings[7] eq 'Administrator' || $newcalgroupflag == 1 ) { $moonincludeflag = 0; $yeardbflag = 'dummy'; IncludeCal2(); if ($data ne "") { @brs = $data =~ /\/gi; $numofbrs = scalar @brs; @lis = $data =~ /\/gi; $numoflis = scalar @lis; $numdatalines = $numofbrs + $numoflis; if( $numdatalines > $ncdatalines ) { @datatemp = ''; @datatemp = split (/\/, $data); $numofbrs2 = int ($numofbrs/2); $numofbrs3 = $numofbrs2 + 1; $ii = 0; foreach $datahunk (@datatemp) { if ( ($ii != 0 ) && ( $ii != $numofbrs3 ) ) { $datatemp[$ii] = "\n\" . $datatemp[$ii]; } $ii++; } $yymain .= qq~
~; for ($i=0; $i <= $numofbrs2; $i++) { $yymain .= qq~$datatemp[$i]~; } $yymain .= qq~ ~; for ($i=$numofbrs3; $i <= $numofbrs; $i++) { $yymain .= qq~$datatemp[$i]~; } $yymain .= qq~
~; } else { $data =~ s~^\~~; $yymain .= qq~$data~; } } else { $yymain .= qq~$ecaltxt{'73'}~; } } # end newcalgroup control } # end routine # IncludeCal shows today's events on any HTML page through SSI # Split into two subs to allow for addon mods, called by YaBB.pl, calls IncludeCal2 sub IncludeCal { $moonincludeflag = 1; $yeardbflag = 'dummy'; if (defined($INFO{'group'})) { $SSIgroup = $INFO{'group'}; IncludeCal3(); } else { IncludeCal2(); } print qq~Content-type: text/html\n\n~; if ($data ne "") { print qq~$data~; } else { print qq~$ecaltxt{'73'}~; } exit; } # WhosCal shows today's events in the modified Whoson mod (YaBB FrontEnd mod). # Split into two subs to allow for addon mods, called by Whoson SSI mod, calls IncludeCal2. sub WhosCal { $moonincludeflag = 1; $yeardbflag = 'dummy'; IncludeCal2(); print qq~$data~; } # IncludeCal2 shows today's events on BoardIndex, WhosOn, and SSI call on html pages. # Called by IndexCal, IncludeCal, and WhosCal subs sub IncludeCal2 { require "$vardir/newcalsettings.txt"; #This is the settings file require "$sourcedir/Newcalendar.pl"; @sbjlist = split(" ",$sbjlist); # Groups add-on start @sbjlistgroup = @sbjlist; @groupkeys = keys(%newcalgstypes); foreach $dummy1(@groupkeys) { @dummy = @{$newcalgstypes{$dummy1}}; foreach $dummy2(@dummy) { push (@sbjlistgroup,$dummy2); } } # the next two lines remove duplicates from the list of event types foreach(@sbjlistgroup){ $dummyhash{$_} = '5'; } @sbjlistgroup = sort (keys(%dummyhash) ); # Groups add-on end $dbfile = "$vardir/newcaldb.txt"; #This is the database file use Time::Local; #keep? Try without and see $acttype = GetActType(); @seldate = GetSelDate(); GetDbData(); if( -e("$vardir/extended_profiles_fields.txt") ) { require "$sourcedir/ExtendedProfiles.pl"; } 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 (@sbjlistgroup) { $itemcount=0; foreach $info (@{ $dayinfo{$thisdaysecs} }) { @daydata = split(/\{/,$info); next if($daydata[1] =~ /DELETED/); ### Groups add-on $newcalgsflag = 0; if (!-e("$vardir/MemberStats.txt")) { # Load the membergroups list. fopen(FILE, "$vardir/membergroups.txt") || &fatal_error("100 $txt{'106'}: $txt{'23'} membergroups.txt"); @membergroups = ; fclose(FILE); for($i=0;$i <= 6;$i++) { shift @membergroups; } foreach $memgroup (@membergroups) { chomp $memgroup; $memgroup =~ s/\s*$//g; if ( $settings[7] eq $memgroup || $settings[7] eq 'Administrator' || $newcalgroupflag == 1 ) { foreach (@{$newcalgstypes{$memgroup}}) { if ( $_ eq $daydata[1] ) { $newcalgsflag = 1; } } } } } else { foreach $ammgroup(@MemStat) { chomp $ammgroup; if ( $settings[7] eq $ammgroup || $settings[7] eq 'Administrator' || $newcalgroupflag == 1 ) { foreach (@{$newcalgstypes{$ammgroup}}) { if ( $_ eq $daydata[1] ) { $newcalgsflag = 1; } } } } } # @sbjlist = split(" ",$sbjlist); foreach $item (@sbjlist) { chomp $item; if( $daydata[1] eq $item ) { $newcalgsflag = 1; } } if ( $newcalgsflag == 0 ) { next; } ### end groups add-on $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; $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++; } } } } &LoadCensorList; foreach (@censored) { ($tmpa,$tmpb) = @{$_}; $data =~ s~\Q$tmpa\E~$tmpb~gi; } } #### speed if ($addbdays2 == 1) { my($bdaymonth,$bmonth,$byear,$bdayweek) = (gmtime($thisdaysecs))[3,4,5,6]; $bmonth += 1; $byear += 1900; $calwhobg = ""; $countbd = 0; fopen(FILE, "$memberdir/memberbirth.txt"); @birth = ; $memcount = @birth; fclose(FILE); chomp(@birth); for($i=0;$i<$memcount;$i++) { ($usernames, $userdispname, $userbd) = split(/\|/, $birth[$i]); if ($userbd ne "") { ($matchm, $matchd, $useryear) = split(/\//, $userbd); if(($bmonth == $matchm) && ($bdaymonth == $matchd)) { ### Add Age $newcalagestring = ''; if( $newcalshowage2 == 1 ) { $newcalage = $byear - $useryear; $newcalagestring = qq~($newcalage)~; } ### End Age if( $countbd == 0 ){ $calwhobg .=qq~$userdispname $newcalagestring~; } if( $countbd > 0 ){ $calwhobg .=qq~, $userdispname $newcalagestring~; } $countbd++; } } } chomp $calwhobg; if ($calwhobg ne "") { $calwhobg = qq~
  • $ecaltxt{'56'}$calwhobg
  • ~; } #### end speed ### End Birthday section Begin EXP section # $newcalexp = 1; if ( $newcalexp == 1) { $expstring = ""; @expcount =''; 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 "$ecaltxt{'62'}$usernames.dat"; @userbd = ; fclose(FILE); chomp $userbd[1]; chomp $userbd[16]; if ( -e "$memberdir/$usernames.ext") { $ii = 0; foreach $infosho(@ncfieldinfosho) { if( $infosho == 1) { if ( $ncfieldann[$ii] == 1 ) { $expuserdate = ext_get($usernames,"$ncfieldname[$ii]"); if ($expuserdate ne "") { ($usermonth, $userday, $useryear) = split(/\//, $expuserdate); if(($bmonth == $usermonth) && ($bdaymonth == $userday)) { $newcalagestring = ''; if( ( $ncfieldinfoage[$ii] == 1 ) && ( $byear > $useryear ) ) { $newcalage = $thisyear - $useryear; $newcalagestring = qq~($newcalage)~; } if( $expcount[$ii] == 0 ){ $expstring .=qq~
  • $ncfieldname[$ii]: $userbd[1] $newcalagestring~; } if( $expcount[$ii] > 0 ){ $expstring .=qq~, $userbd[1] $newcalagestring~; } $expcount[$ii]++; } } } else { $expuserdate = ext_get($usernames,"$ncfieldname[$ii]"); if ($expuserdate ne "") { ($usermonth, $userday, $useryear) = split(/\//, $expuserdate); if( ($bmonth == $usermonth) && ($bdaymonth == $userday) && ($byear == $useryear) ) { if( $expcount[$ii] == 0 ){ $expstring .=qq~
  • $ncfieldname[$ii]: $userbd[1]~; } if( $expcount[$ii] > 0 ){ $expstring .=qq~, $userbd[1]~; } $expcount[$ii]++; } } } #end loop for one time events } $ii++; } # end monsho loop } # end username.ext file exists loop } # end if username.dat file exists } # end loop for each username in memberlist file # chomp $calwhobg; # if ($calwhobg ne "") { # $calwhobg = qq~
  • $ecaltxt{'56'}$calwhobg
  • ~; # } chomp $expstring; if ($expstring ne "") { $expstring = qq~$expstring~; } } # end newcalexp if statement } # end bday stuff ### end new b-day stuff if ( $calwhobg ne "" || $data2 ne "" || $expstring) { if ( $todaysecs == $thisdaysecs) { $data .= qq~$txt{'769'}:~ . $data2 . $calwhobg . $expstring; } 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 . $expstring; } else { $data .= qq~
    $thisweekdayname, $monthname $thisdaymonth:~ . $data2 . $calwhobg . $expstring; } } } } # end of loop for each date # Add moon phase info if ( ( $newcalmoon2 == 1 ) && ( $moonincludeflag == 1 ) ) { require "$sourcedir/MoonPhase.pl"; #This is the moon phase calculator ( $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 } # IncludeCal3 provides output for SSI call on html pages. Groups enabled. # Called by IncludeCal sub IncludeCal3 { require "$vardir/newcalsettings.txt"; #This is the settings file require "$sourcedir/Newcalendar.pl"; @sbjlist = split(" ",$sbjlist); # Groups add-on start @sbjlistgroup = @sbjlist; @groupkeys = keys(%newcalgstypes); foreach $dummy1(@groupkeys) { @dummy = @{$newcalgstypes{$dummy1}}; foreach $dummy2(@dummy) { push (@sbjlistgroup,$dummy2); } } # the next two lines remove duplicates from the list of event types foreach(@sbjlistgroup){ $dummyhash{$_} = '5'; } @sbjlistgroup = sort (keys(%dummyhash) ); # Groups add-on end $dbfile = "$vardir/newcaldb.txt"; #This is the database file use Time::Local; #keep? Try without and see $acttype = GetActType(); @seldate = GetSelDate(); GetDbData(); if( -e("$vardir/extended_profiles_fields.txt") ) { require "$sourcedir/ExtendedProfiles.pl"; } 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 (@sbjlistgroup) { $itemcount=0; foreach $info (@{ $dayinfo{$thisdaysecs} }) { @daydata = split(/\{/,$info); next if($daydata[1] =~ /DELETED/); ### Groups add-on $newcalgsflag = 0; if (!-e("$vardir/MemberStats.txt")) { # Load the membergroups list. fopen(FILE, "$vardir/membergroups.txt") || &fatal_error("100 $txt{'106'}: $txt{'23'} membergroups.txt"); @membergroups = ; fclose(FILE); for($i=0;$i <= 6;$i++) { shift @membergroups; } foreach $memgroup (@membergroups) { chomp $memgroup; $memgroup =~ s/\s*$//g; unless ($SSIgroup eq $memgroup) {next;} foreach (@{$newcalgstypes{$memgroup}}) { if ( $_ eq $daydata[1] ) { $newcalgsflag = 1; } } } } else { foreach $ammgroup(@MemStat) { chomp $ammgroup; unless ($SSIgroup eq $ammgroup) {next;} foreach (@{$newcalgstypes{$ammgroup}}) { if ( $_ eq $daydata[1] ) { $newcalgsflag = 1; } } } } # @sbjlist = split(" ",$sbjlist); foreach $item (@sbjlist) { chomp $item; if( $daydata[1] eq $item ) { $newcalgsflag = 1; } } if ( $newcalgsflag == 0 ) { next; } ### end groups add-on $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; $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++; } } } } &LoadCensorList; foreach (@censored) { ($tmpa,$tmpb) = @{$_}; $data =~ s~\Q$tmpa\E~$tmpb~gi; } } #### speed if ($addbdays2 == 1) { my($bdaymonth,$bmonth,$byear,$bdayweek) = (gmtime($thisdaysecs))[3,4,5,6]; $bmonth += 1; $byear += 1900; $calwhobg = ""; $countbd = 0; fopen(FILE, "$memberdir/memberbirth.txt"); @birth = ; $memcount = @birth; fclose(FILE); chomp(@birth); for($i=0;$i<$memcount;$i++) { ($usernames, $userdispname, $userbd) = split(/\|/, $birth[$i]); if ($userbd ne "") { ($matchm, $matchd, $useryear) = split(/\//, $userbd); if(($bmonth == $matchm) && ($bdaymonth == $matchd)) { ### Add Age $newcalagestring = ''; if( $newcalshowage2 == 1 ) { $newcalage = $byear - $useryear; $newcalagestring = qq~($newcalage)~; } ### End Age if( $countbd == 0 ){ $calwhobg .=qq~$userdispname $newcalagestring~; } if( $countbd > 0 ){ $calwhobg .=qq~, $userdispname $newcalagestring~; } $countbd++; } } } chomp $calwhobg; if ($calwhobg ne "") { $calwhobg = qq~
  • $ecaltxt{'56'}$calwhobg
  • ~; } #### end speed ### End Birthday section Begin EXP section # $newcalexp = 1; if ( $newcalexp == 1) { $expstring = ""; @expcount =''; 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 "$ecaltxt{'62'}$usernames.dat"; @userbd = ; fclose(FILE); chomp $userbd[1]; chomp $userbd[16]; if ( -e "$memberdir/$usernames.ext") { $ii = 0; foreach $infosho(@ncfieldinfosho) { if( $infosho == 1) { if ( $ncfieldann[$ii] == 1 ) { $expuserdate = ext_get($usernames,"$ncfieldname[$ii]"); if ($expuserdate ne "") { ($usermonth, $userday, $useryear) = split(/\//, $expuserdate); if(($bmonth == $usermonth) && ($bdaymonth == $userday)) { $newcalagestring = ''; if( ( $ncfieldinfoage[$ii] == 1 ) && ( $byear > $useryear ) ) { $newcalage = $thisyear - $useryear; $newcalagestring = qq~($newcalage)~; } if( $expcount[$ii] == 0 ){ $expstring .=qq~
  • $ncfieldname[$ii]: $userbd[1] $newcalagestring~; } if( $expcount[$ii] > 0 ){ $expstring .=qq~, $userbd[1] $newcalagestring~; } $expcount[$ii]++; } } } else { $expuserdate = ext_get($usernames,"$ncfieldname[$ii]"); if ($expuserdate ne "") { ($usermonth, $userday, $useryear) = split(/\//, $expuserdate); if( ($bmonth == $usermonth) && ($bdaymonth == $userday) && ($byear == $useryear) ) { if( $expcount[$ii] == 0 ){ $expstring .=qq~
  • $ncfieldname[$ii]: $userbd[1]~; } if( $expcount[$ii] > 0 ){ $expstring .=qq~, $userbd[1]~; } $expcount[$ii]++; } } } #end loop for one time events } $ii++; } # end monsho loop } # end username.ext file exists loop } # end if username.dat file exists } # end loop for each username in memberlist file # chomp $calwhobg; # if ($calwhobg ne "") { # $calwhobg = qq~
  • $ecaltxt{'56'}$calwhobg
  • ~; # } chomp $expstring; if ($expstring ne "") { $expstring = qq~$expstring~; } } # end newcalexp if statement } # end bday stuff ### end new b-day stuff if ( $calwhobg ne "" || $data2 ne "" || $expstring) { if ( $todaysecs == $thisdaysecs) { $data .= qq~$txt{'769'}:~ . $data2 . $calwhobg . $expstring; } 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 . $expstring; } else { $data .= qq~
    $thisweekdayname, $monthname $thisdaymonth:~ . $data2 . $calwhobg . $expstring; } } } } # end of loop for each date # Add moon phase info if ( ( $newcalmoon2 == 1 ) && ( $moonincludeflag == 1 ) ) { require "$sourcedir/MoonPhase.pl"; #This is the moon phase calculator ( $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 } 1;