added time zone scheme for Brazil to CLI and web lead loaders script

fixed country field in CLI and web lead loaders

git-svn-id: svn://192.168.202.10@380 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
mattf
2006-11-10 17:39:28 +00:00
parent 3fb5dcb0c6
commit c47dc2ea4e
6 changed files with 739 additions and 87 deletions
+1 -1
View File
@@ -835,7 +835,7 @@ sub NZL_dstcalc {
sub BZL_dstcalc { sub BZL_dstcalc {
#********************************************************************** #**********************************************************************
# LSO-LSF # TSO-LSF
# This is returns 1 if Daylight Savings Time is in effect and 0 if # This is returns 1 if Daylight Savings Time is in effect and 0 if
# Standard time is in effect. Brazil # Standard time is in effect. Brazil
# Based on Third Sunday October to Last Sunday February at 1 am. # Based on Third Sunday October to Last Sunday February at 1 am.
+2 -2
View File
@@ -466,7 +466,7 @@ if ($DB) {print "SEED TIME $secX : $year-$mon-$mday $hour:$min:$sec LOC
if ($multi_insert_counter > 8) if ($multi_insert_counter > 8)
{ {
### insert good deal into pending_transactions table ### ### insert good deal into pending_transactions table ###
$stmtZ = "INSERT INTO vicidial_list values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments','0');"; $stmtZ = "INSERT INTO vicidial_list values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments','0');";
if (!$T) {$affected_rows = $dbhA->do($stmtZ); } # or die "Couldn't execute query: |$stmtZ|\n"; if (!$T) {$affected_rows = $dbhA->do($stmtZ); } # or die "Couldn't execute query: |$stmtZ|\n";
if($DB){print STDERR "\n|$affected_rows|$stmtZ|\n";} if($DB){print STDERR "\n|$affected_rows|$stmtZ|\n";}
@@ -476,7 +476,7 @@ if ($DB) {print "SEED TIME $secX : $year-$mon-$mday $hour:$min:$sec LOC
} }
else else
{ {
$multistmt .= "('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments','0'),"; $multistmt .= "('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments','0'),";
$multi_insert_counter++; $multi_insert_counter++;
} }
+181 -26
View File
@@ -13,12 +13,13 @@
# 60619-1652 - Added variable filtering to eliminate SQL injection attack threat # 60619-1652 - Added variable filtering to eliminate SQL injection attack threat
# 60822-1105 - fixed for nonwritable directories # 60822-1105 - fixed for nonwritable directories
# 60906-1059 - added filter of non-digits in alt_phone field # 60906-1059 - added filter of non-digits in alt_phone field
# 61110-1222 - added new USA-Canada DST scheme and Brazil DST scheme
# #
# make sure vicidial_list exists and that your file follows the formatting correctly. This page does not dedupe or do any other lead filtering actions yet at this time. # make sure vicidial_list exists and that your file follows the formatting correctly. This page does not dedupe or do any other lead filtering actions yet at this time.
# #
$version = '2.0.1'; $version = '2.0.2';
$build = '60822-1105'; $build = '61110-1222';
header ("Content-type: text/html; charset=utf-8"); header ("Content-type: text/html; charset=utf-8");
@@ -300,14 +301,14 @@ if ($leadfile and filesize($LF_path)<=8388608) {
$dsec = ( ( ($hour * 3600) + ($min * 60) ) + $sec ); $dsec = ( ( ($hour * 3600) + ($min * 60) ) + $sec );
$AC_processed=0; $AC_processed=0;
if ( (!$AC_processed) and ($dst_range == 'FSA-LSO') ) if ( (!$AC_processed) and ($dst_range == 'SSM-FSN') )
{ {
if ($DBX) {print " First Sunday April to Last Sunday October\n";} if ($DBX) {print " Second Sunday March to First Sunday November\n";}
#********************************************************************** #**********************************************************************
# FSA-LSO # SSM-FSN
# This is returns 1 if Daylight Savings Time is in effect and 0 if # This is returns 1 if Daylight Savings Time is in effect and 0 if
# Standard time is in effect. # Standard time is in effect.
# Based on first Sunday in April and last Sunday in October at 2 am. # Based on Second Sunday March to First Sunday November at 2 am.
# INPUTS: # INPUTS:
# mm INTEGER Month. # mm INTEGER Month.
# dd INTEGER Day of the month. # dd INTEGER Day of the month.
@@ -321,64 +322,147 @@ if ($leadfile and filesize($LF_path)<=8388608) {
# and 9:00 UTC in October # and 9:00 UTC in October
# OUTPUT: # OUTPUT:
# INTEGER 1 = DST, 0 = not DST # INTEGER 1 = DST, 0 = not DST
#
# S M T W T F S
# 1 2 3 4 5 6 7
# 8 9 10 11 12 13 14
#15 16 17 18 19 20 21
#22 23 24 25 26 27 28
#29 30 31
#
# S M T W T F S
# 1 2 3 4 5 6
# 7 8 9 10 11 12 13
#14 15 16 17 18 19 20
#21 22 23 24 25 26 27
#28 29 30 31
#
#**********************************************************************
$USACAN_DST=0;
$mm = $mon;
$dd = $mday;
$ns = $dsec;
$dow= $wday;
if ($mm < 3 || $mm > 11) {
$USACAN_DST=0;
} elseif ($mm >= 4 and $mm <= 10) {
$USACAN_DST=1;
} elseif ($mm == 3) {
if ($dd > 13) {
$USACAN_DST=1;
} elseif ($dd >= ($dow+8)) {
if ($timezone) {
if ($dow == 0 and $ns < (7200+$timezone*3600)) {
$USACAN_DST=0;
} else {
$USACAN_DST=1;
}
} else {
if ($dow == 0 and $ns < 7200) {
$USACAN_DST=0;
} else {
$USACAN_DST=1;
}
}
} else {
$USACAN_DST=0;
}
} elseif ($mm == 11) {
if ($dd > 7) {
$USACAN_DST=0;
} elseif ($dd < ($dow+1)) {
$USACAN_DST=1;
} elseif ($dow == 0) {
if ($timezone) { # UTC calculations
if ($ns < (7200+($timezone-1)*3600)) {
$USACAN_DST=1;
} else {
$USACAN_DST=0;
}
} else { # local time calculations
if ($ns < 7200) {
$USACAN_DST=1;
} else {
$USACAN_DST=0;
}
}
} else {
$USACAN_DST=0;
}
} # end of month checks
if ($DBX) {print " DST: $USACAN_DST\n";}
if ($USACAN_DST) {$gmt_offset++;}
$AC_processed++;
}
if ( (!$AC_processed) and ($dst_range == 'FSA-LSO') )
{
if ($DBX) {print " First Sunday April to Last Sunday October\n";}
#**********************************************************************
# FSA-LSO
# This is returns 1 if Daylight Savings Time is in effect and 0 if
# Standard time is in effect.
# Based on first Sunday in April and last Sunday in October at 2 am.
#********************************************************************** #**********************************************************************
$USA_DST=0; $NA_DST=0;
$mm = $mon; $mm = $mon;
$dd = $mday; $dd = $mday;
$ns = $dsec; $ns = $dsec;
$dow= $wday; $dow= $wday;
if ($mm < 4 || $mm > 10) { if ($mm < 4 || $mm > 10) {
$USA_DST=0; $NA_DST=0;
} elseif ($mm >= 5 and $mm <= 9) { } elseif ($mm >= 5 and $mm <= 9) {
$USA_DST=1; $NA_DST=1;
} elseif ($mm == 4) { } elseif ($mm == 4) {
if ($dd > 7) { if ($dd > 7) {
$USA_DST=1; $NA_DST=1;
} elseif ($dd >= ($dow+1)) { } elseif ($dd >= ($dow+1)) {
if ($timezone) { if ($timezone) {
if ($dow == 0 and $ns < (7200+$timezone*3600)) { if ($dow == 0 and $ns < (7200+$timezone*3600)) {
$USA_DST=0; $NA_DST=0;
} else { } else {
$USA_DST=1; $NA_DST=1;
} }
} else { } else {
if ($dow == 0 and $ns < 7200) { if ($dow == 0 and $ns < 7200) {
$USA_DST=0; $NA_DST=0;
} else { } else {
$USA_DST=1; $NA_DST=1;
} }
} }
} else { } else {
$USA_DST=0; $NA_DST=0;
} }
} elseif ($mm == 10) { } elseif ($mm == 10) {
if ($dd < 25) { if ($dd < 25) {
$USA_DST=1; $NA_DST=1;
} elseif ($dd < ($dow+25)) { } elseif ($dd < ($dow+25)) {
$USA_DST=1; $NA_DST=1;
} elseif ($dow == 0) { } elseif ($dow == 0) {
if ($timezone) { # UTC calculations if ($timezone) { # UTC calculations
if ($ns < (7200+($timezone-1)*3600)) { if ($ns < (7200+($timezone-1)*3600)) {
$USA_DST=1; $NA_DST=1;
} else { } else {
$USA_DST=0; $NA_DST=0;
} }
} else { # local time calculations } else { # local time calculations
if ($ns < 7200) { if ($ns < 7200) {
$USA_DST=1; $NA_DST=1;
} else { } else {
$USA_DST=0; $NA_DST=0;
} }
} }
} else { } else {
$USA_DST=0; $NA_DST=0;
} }
} # end of month checks } # end of month checks
if ($DBX) {print " DST: $USA_DST\n";} if ($DBX) {print " DST: $NA_DST\n";}
if ($USA_DST) {$gmt_offset++;} if ($NA_DST) {$gmt_offset++;}
$AC_processed++; $AC_processed++;
} }
@@ -652,6 +736,77 @@ if ($leadfile and filesize($LF_path)<=8388608) {
if ($NZL_DST) {$gmt_offset++;} if ($NZL_DST) {$gmt_offset++;}
$AC_processed++; $AC_processed++;
} }
if ( (!$AC_processed) and ($dst_range == 'TSO-LSF') )
{
if ($DBX) {print " Third Sunday October to Last Sunday February\n";}
#**********************************************************************
# TSO-LSF
# This is returns 1 if Daylight Savings Time is in effect and 0 if
# Standard time is in effect. Brazil
# Based on Third Sunday October to Last Sunday February at 1 am.
#**********************************************************************
$BZL_DST=0;
$mm = $mon;
$dd = $mday;
$ns = $dsec;
$dow= $wday;
if ($mm < 2 || $mm > 10) {
$BZL_DST=1;
} elseif ($mm >= 3 and $mm <= 9) {
$BZL_DST=0;
} elseif ($mm == 2) {
if ($dd < 22) {
$BZL_DST=1;
} elseif ($dd < ($dow+22)) {
$BZL_DST=1;
} elseif ($dow == 0) {
if ($timezone) { # UTC calculations
if ($ns < (3600+($timezone-1)*3600)) {
$BZL_DST=1;
} else {
$BZL_DST=0;
}
} else { # local time calculations
if ($ns < 3600) {
$BZL_DST=1;
} else {
$BZL_DST=0;
}
}
} else {
$BZL_DST=0;
}
} elseif ($mm == 10) {
if ($dd < 22) {
$BZL_DST=0;
} elseif ($dd < ($dow+22)) {
$BZL_DST=0;
} elseif ($dow == 0) {
if ($timezone) { # UTC calculations
if ($ns < (3600+($timezone-1)*3600)) {
$BZL_DST=0;
} else {
$BZL_DST=1;
}
} else { # local time calculations
if ($ns < 3600) {
$BZL_DST=0;
} else {
$BZL_DST=1;
}
}
} else {
$BZL_DST=1;
}
} # end of month checks
if ($DBX) {print " DST: $BZL_DST\n";}
if ($BZL_DST) {$gmt_offset++;}
$AC_processed++;
}
if (!$AC_processed) if (!$AC_processed)
{ {
if ($DBX) {print " No DST Method Found\n";} if ($DBX) {print " No DST Method Found\n";}
@@ -662,7 +817,7 @@ if ($leadfile and filesize($LF_path)<=8388608) {
if ($multi_insert_counter > 8) { if ($multi_insert_counter > 8) {
### insert good deal into pending_transactions table ### ### insert good deal into pending_transactions table ###
$stmtZ = "INSERT INTO vicidial_list values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0);"; $stmtZ = "INSERT INTO vicidial_list values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0);";
$rslt=mysql_query($stmtZ, $link); $rslt=mysql_query($stmtZ, $link);
if ($WeBRooTWritablE > 0) if ($WeBRooTWritablE > 0)
{fwrite($stmt_file, $stmtZ."\r\n");} {fwrite($stmt_file, $stmtZ."\r\n");}
@@ -670,7 +825,7 @@ if ($leadfile and filesize($LF_path)<=8388608) {
$multi_insert_counter=0; $multi_insert_counter=0;
} else { } else {
$multistmt .= "('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0),"; $multistmt .= "('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0),";
$multi_insert_counter++; $multi_insert_counter++;
} }
+195 -24
View File
@@ -13,6 +13,7 @@
# 60811-1329 - changed to use /etc/astguiclient.conf for configs # 60811-1329 - changed to use /etc/astguiclient.conf for configs
# 60822-1121 - fixed for nonwritable directories # 60822-1121 - fixed for nonwritable directories
# 60906-1058 - added filter of non-digits in alt_phone field # 60906-1058 - added filter of non-digits in alt_phone field
# 61110-1229 - added new USA-Canada DST scheme and Brazil DST scheme
# #
### begin parsing run-time options ### ### begin parsing run-time options ###
@@ -317,12 +318,21 @@ foreach $oWkS (@{$oBook->{Worksheet}}) {
$dsec = ( ( ($hour * 3600) + ($min * 60) ) + $sec ); $dsec = ( ( ($hour * 3600) + ($min * 60) ) + $sec );
$AC_processed=0; $AC_processed=0;
if ( (!$AC_processed) && ($dst_range =~ /SSM-FSN/) )
{
if ($DBX) {print " Second Sunday March to First Sunday November\n";}
&USACAN_dstcalc;
if ($DBX) {print " DST: $USACAN_DST\n";}
if ($USACAN_DST) {$area_GMT++;}
$AC_processed++;
}
if ( (!$AC_processed) && ($dst_range =~ /FSA-LSO/) ) if ( (!$AC_processed) && ($dst_range =~ /FSA-LSO/) )
{ {
if ($DBX) {print " First Sunday April to Last Sunday October\n";} if ($DBX) {print " First Sunday April to Last Sunday October\n";}
&USA_dstcalc; &NA_dstcalc;
if ($DBX) {print " DST: $USA_DST\n";} if ($DBX) {print " DST: $NA_DST\n";}
if ($USA_DST) {$gmt_offset++;} if ($NA_DST) {$area_GMT++;}
$AC_processed++; $AC_processed++;
} }
if ( (!$AC_processed) && ($dst_range =~ /LSM-LSO/) ) if ( (!$AC_processed) && ($dst_range =~ /LSM-LSO/) )
@@ -357,6 +367,14 @@ foreach $oWkS (@{$oBook->{Worksheet}}) {
if ($NZL_DST) {$gmt_offset++;} if ($NZL_DST) {$gmt_offset++;}
$AC_processed++; $AC_processed++;
} }
if ( (!$AC_processed) && ($dst_range =~ /TSO-LSF/) )
{
if ($DBX) {print " Third Sunday October to Last Sunday February\n";}
&BZL_dstcalc;
if ($DBX) {print " DST: $BZL_DST\n";}
if ($BZL_DST) {$area_GMT++;}
$AC_processed++;
}
if (!$AC_processed) if (!$AC_processed)
{ {
if ($DBX) {print " No DST Method Found\n";} if ($DBX) {print " No DST Method Found\n";}
@@ -406,12 +424,12 @@ exit;
sub USA_dstcalc { sub USACAN_dstcalc {
#********************************************************************** #**********************************************************************
# FSA-LSO # SSM-FSN
# This is returns 1 if Daylight Savings Time is in effect and 0 if # This is returns 1 if Daylight Savings Time is in effect and 0 if
# Standard time is in effect. # Standard time is in effect.
# Based on first Sunday in April and last Sunday in October at 2 am. # Based on Second Sunday March to First Sunday November at 2 am.
# INPUTS: # INPUTS:
# mm INTEGER Month. # mm INTEGER Month.
# dd INTEGER Day of the month. # dd INTEGER Day of the month.
@@ -425,59 +443,140 @@ sub USA_dstcalc {
# and 9:00 UTC in October # and 9:00 UTC in October
# OUTPUT: # OUTPUT:
# INTEGER 1 = DST, 0 = not DST # INTEGER 1 = DST, 0 = not DST
#
# S M T W T F S
# 1 2 3 4 5 6 7
# 8 9 10 11 12 13 14
#15 16 17 18 19 20 21
#22 23 24 25 26 27 28
#29 30 31
#
# S M T W T F S
# 1 2 3 4 5 6
# 7 8 9 10 11 12 13
#14 15 16 17 18 19 20
#21 22 23 24 25 26 27
#28 29 30 31
#
#**********************************************************************
$USACAN_DST=0;
$mm = $mon;
$dd = $mday;
$ns = $dsec;
$dow= $wday;
if ($mm < 3 || $mm > 11) {
$USACAN_DST=0; return 0;
} elsif ($mm >= 4 && $mm <= 10) {
$USACAN_DST=1; return 1;
} elsif ($mm == 3) {
if ($dd > 13) {
$USACAN_DST=1; return 1;
} elsif ($dd >= ($dow+8)) {
if ($timezone) {
if ($dow == 0 && $ns < (7200+$timezone*3600)) {
$USACAN_DST=0; return 0;
} else {
$USACAN_DST=1; return 1;
}
} else {
if ($dow == 0 && $ns < 7200) {
$USACAN_DST=0; return 0;
} else {
$USACAN_DST=1; return 1;
}
}
} else {
$USACAN_DST=0; return 0;
}
} elsif ($mm == 11) {
if ($dd > 7) {
$USACAN_DST=0; return 0;
} elsif ($dd < ($dow+1)) {
$USACAN_DST=1; return 1;
} elsif ($dow == 0) {
if ($timezone) { # UTC calculations
if ($ns < (7200+($timezone-1)*3600)) {
$USACAN_DST=1; return 1;
} else {
$USACAN_DST=0; return 0;
}
} else { # local time calculations
if ($ns < 7200) {
$USACAN_DST=1; return 1;
} else {
$USACAN_DST=0; return 0;
}
}
} else {
$USACAN_DST=0; return 0;
}
} # end of month checks
} # end of subroutine dstcalc
sub NA_dstcalc {
#**********************************************************************
# FSA-LSO
# This is returns 1 if Daylight Savings Time is in effect and 0 if
# Standard time is in effect.
# Based on first Sunday in April and last Sunday in October at 2 am.
#********************************************************************** #**********************************************************************
$USA_DST=0; $NA_DST=0;
$mm = $mon; $mm = $mon;
$dd = $mday; $dd = $mday;
$ns = $dsec; $ns = $dsec;
$dow= $wday; $dow= $wday;
if ($mm < 4 || $mm > 10) { if ($mm < 4 || $mm > 10) {
$USA_DST=0; return 0; $NA_DST=0; return 0;
} elsif ($mm >= 5 && $mm <= 9) { } elsif ($mm >= 5 && $mm <= 9) {
$USA_DST=1; return 1; $NA_DST=1; return 1;
} elsif ($mm == 4) { } elsif ($mm == 4) {
if ($dd > 7) { if ($dd > 7) {
$USA_DST=1; return 1; $NA_DST=1; return 1;
} elsif ($dd >= ($dow+1)) { } elsif ($dd >= ($dow+1)) {
if ($timezone) { if ($timezone) {
if ($dow == 0 && $ns < (7200+$timezone*3600)) { if ($dow == 0 && $ns < (7200+$timezone*3600)) {
$USA_DST=0; return 0; $NA_DST=0; return 0;
} else { } else {
$USA_DST=1; return 1; $NA_DST=1; return 1;
} }
} else { } else {
if ($dow == 0 && $ns < 7200) { if ($dow == 0 && $ns < 7200) {
$USA_DST=0; return 0; $NA_DST=0; return 0;
} else { } else {
$USA_DST=1; return 1; $NA_DST=1; return 1;
} }
} }
} else { } else {
$USA_DST=0; return 0; $NA_DST=0; return 0;
} }
} elsif ($mm == 10) { } elsif ($mm == 10) {
if ($dd < 25) { if ($dd < 25) {
$USA_DST=1; return 1; $NA_DST=1; return 1;
} elsif ($dd < ($dow+25)) { } elsif ($dd < ($dow+25)) {
$USA_DST=1; return 1; $NA_DST=1; return 1;
} elsif ($dow == 0) { } elsif ($dow == 0) {
if ($timezone) { # UTC calculations if ($timezone) { # UTC calculations
if ($ns < (7200+($timezone-1)*3600)) { if ($ns < (7200+($timezone-1)*3600)) {
$USA_DST=1; return 1; $NA_DST=1; return 1;
} else { } else {
$USA_DST=0; return 0; $NA_DST=0; return 0;
} }
} else { # local time calculations } else { # local time calculations
if ($ns < 7200) { if ($ns < 7200) {
$USA_DST=1; return 1; $NA_DST=1; return 1;
} else { } else {
$USA_DST=0; return 0; $NA_DST=0; return 0;
} }
} }
} else { } else {
$USA_DST=0; return 0; $NA_DST=0; return 0;
} }
} # end of month checks } # end of month checks
} # end of subroutine dstcalc } # end of subroutine dstcalc
@@ -487,6 +586,7 @@ sub USA_dstcalc {
sub GBR_dstcalc { sub GBR_dstcalc {
#********************************************************************** #**********************************************************************
# LSM-LSO
# This is returns 1 if Daylight Savings Time is in effect and 0 if # This is returns 1 if Daylight Savings Time is in effect and 0 if
# Standard time is in effect. # Standard time is in effect.
# Based on last Sunday in March and last Sunday in October at 1 am. # Based on last Sunday in March and last Sunday in October at 1 am.
@@ -554,6 +654,7 @@ sub GBR_dstcalc {
sub AUS_dstcalc { sub AUS_dstcalc {
#********************************************************************** #**********************************************************************
# LSO-LSM
# This is returns 1 if Daylight Savings Time is in effect and 0 if # This is returns 1 if Daylight Savings Time is in effect and 0 if
# Standard time is in effect. # Standard time is in effect.
# Based on last Sunday in October and last Sunday in March at 1 am. # Based on last Sunday in October and last Sunday in March at 1 am.
@@ -622,6 +723,7 @@ sub AUS_dstcalc {
sub AUST_dstcalc { sub AUST_dstcalc {
#********************************************************************** #**********************************************************************
# FSO-LSM
# TASMANIA ONLY # TASMANIA ONLY
# This is returns 1 if Daylight Savings Time is in effect and 0 if # This is returns 1 if Daylight Savings Time is in effect and 0 if
# Standard time is in effect. # Standard time is in effect.
@@ -661,7 +763,7 @@ sub AUST_dstcalc {
$AUST_DST=0; return 0; $AUST_DST=0; return 0;
} }
} elsif ($mm == 10) { } elsif ($mm == 10) {
if ($dd > 7) { if ($dd >= 8) {
$AUST_DST=1; return 1; $AUST_DST=1; return 1;
} elsif ($dd >= ($dow+1)) { } elsif ($dd >= ($dow+1)) {
if ($timezone) { if ($timezone) {
@@ -689,6 +791,7 @@ sub AUST_dstcalc {
sub NZL_dstcalc { sub NZL_dstcalc {
#********************************************************************** #**********************************************************************
# FSO-TSM
# This is returns 1 if Daylight Savings Time is in effect and 0 if # This is returns 1 if Daylight Savings Time is in effect and 0 if
# Standard time is in effect. # Standard time is in effect.
# Based on first Sunday in October and third Sunday in March at 1 am. # Based on first Sunday in October and third Sunday in March at 1 am.
@@ -727,7 +830,7 @@ sub NZL_dstcalc {
$NZL_DST=0; return 0; $NZL_DST=0; return 0;
} }
} elsif ($mm == 10) { } elsif ($mm == 10) {
if ($dd > 7) { if ($dd >= 8) {
$NZL_DST=1; return 1; $NZL_DST=1; return 1;
} elsif ($dd >= ($dow+1)) { } elsif ($dd >= ($dow+1)) {
if ($timezone) { if ($timezone) {
@@ -748,3 +851,71 @@ sub NZL_dstcalc {
} }
} # end of month checks } # end of month checks
} # end of subroutine dstcalc } # end of subroutine dstcalc
sub BZL_dstcalc {
#**********************************************************************
# TSO-LSF
# This is returns 1 if Daylight Savings Time is in effect and 0 if
# Standard time is in effect. Brazil
# Based on Third Sunday October to Last Sunday February at 1 am.
#**********************************************************************
$BZL_DST=0;
$mm = $mon;
$dd = $mday;
$ns = $dsec;
$dow= $wday;
if ($mm < 2 || $mm > 10) {
$BZL_DST=1; return 1;
} elsif ($mm >= 3 && $mm <= 9) {
$BZL_DST=0; return 0;
} elsif ($mm == 2) {
if ($dd < 22) {
$BZL_DST=1; return 1;
} elsif ($dd < ($dow+22)) {
$BZL_DST=1; return 1;
} elsif ($dow == 0) {
if ($timezone) { # UTC calculations
if ($ns < (3600+($timezone-1)*3600)) {
$BZL_DST=1; return 1;
} else {
$BZL_DST=0; return 0;
}
} else { # local time calculations
if ($ns < 3600) {
$BZL_DST=1; return 1;
} else {
$BZL_DST=0; return 0;
}
}
} else {
$BZL_DST=0; return 0;
}
} elsif ($mm == 10) {
if ($dd < 22) {
$BZL_DST=0; return 0;
} elsif ($dd < ($dow+22)) {
$BZL_DST=0; return 0;
} elsif ($dow == 0) {
if ($timezone) { # UTC calculations
if ($ns < (3600+($timezone-1)*3600)) {
$BZL_DST=0; return 0;
} else {
$BZL_DST=1; return 1;
}
} else { # local time calculations
if ($ns < 3600) {
$BZL_DST=0; return 0;
} else {
$BZL_DST=1; return 1;
}
}
} else {
$BZL_DST=1; return 1;
}
} # end of month checks
} # end of subroutine dstcalc
+195 -24
View File
@@ -12,6 +12,7 @@
# 60811-1232 - Changed to DBI # 60811-1232 - Changed to DBI
# 60811-1329 - changed to use /etc/astguiclient.conf for configs # 60811-1329 - changed to use /etc/astguiclient.conf for configs
# 60906-1056 - added filter of non-digits in alt_phone field # 60906-1056 - added filter of non-digits in alt_phone field
# 61110-1229 - added new USA-Canada DST scheme and Brazil DST scheme
# #
### begin parsing run-time options ### ### begin parsing run-time options ###
@@ -317,12 +318,21 @@ foreach $oWkS (@{$oBook->{Worksheet}}) {
$dsec = ( ( ($hour * 3600) + ($min * 60) ) + $sec ); $dsec = ( ( ($hour * 3600) + ($min * 60) ) + $sec );
$AC_processed=0; $AC_processed=0;
if ( (!$AC_processed) && ($dst_range =~ /SSM-FSN/) )
{
if ($DBX) {print " Second Sunday March to First Sunday November\n";}
&USACAN_dstcalc;
if ($DBX) {print " DST: $USACAN_DST\n";}
if ($USACAN_DST) {$area_GMT++;}
$AC_processed++;
}
if ( (!$AC_processed) && ($dst_range =~ /FSA-LSO/) ) if ( (!$AC_processed) && ($dst_range =~ /FSA-LSO/) )
{ {
if ($DBX) {print " First Sunday April to Last Sunday October\n";} if ($DBX) {print " First Sunday April to Last Sunday October\n";}
&USA_dstcalc; &NA_dstcalc;
if ($DBX) {print " DST: $USA_DST\n";} if ($DBX) {print " DST: $NA_DST\n";}
if ($USA_DST) {$gmt_offset++;} if ($NA_DST) {$area_GMT++;}
$AC_processed++; $AC_processed++;
} }
if ( (!$AC_processed) && ($dst_range =~ /LSM-LSO/) ) if ( (!$AC_processed) && ($dst_range =~ /LSM-LSO/) )
@@ -357,6 +367,14 @@ foreach $oWkS (@{$oBook->{Worksheet}}) {
if ($NZL_DST) {$gmt_offset++;} if ($NZL_DST) {$gmt_offset++;}
$AC_processed++; $AC_processed++;
} }
if ( (!$AC_processed) && ($dst_range =~ /TSO-LSF/) )
{
if ($DBX) {print " Third Sunday October to Last Sunday February\n";}
&BZL_dstcalc;
if ($DBX) {print " DST: $BZL_DST\n";}
if ($BZL_DST) {$area_GMT++;}
$AC_processed++;
}
if (!$AC_processed) if (!$AC_processed)
{ {
if ($DBX) {print " No DST Method Found\n";} if ($DBX) {print " No DST Method Found\n";}
@@ -406,12 +424,12 @@ exit;
sub USA_dstcalc { sub USACAN_dstcalc {
#********************************************************************** #**********************************************************************
# FSA-LSO # SSM-FSN
# This is returns 1 if Daylight Savings Time is in effect and 0 if # This is returns 1 if Daylight Savings Time is in effect and 0 if
# Standard time is in effect. # Standard time is in effect.
# Based on first Sunday in April and last Sunday in October at 2 am. # Based on Second Sunday March to First Sunday November at 2 am.
# INPUTS: # INPUTS:
# mm INTEGER Month. # mm INTEGER Month.
# dd INTEGER Day of the month. # dd INTEGER Day of the month.
@@ -425,59 +443,140 @@ sub USA_dstcalc {
# and 9:00 UTC in October # and 9:00 UTC in October
# OUTPUT: # OUTPUT:
# INTEGER 1 = DST, 0 = not DST # INTEGER 1 = DST, 0 = not DST
#
# S M T W T F S
# 1 2 3 4 5 6 7
# 8 9 10 11 12 13 14
#15 16 17 18 19 20 21
#22 23 24 25 26 27 28
#29 30 31
#
# S M T W T F S
# 1 2 3 4 5 6
# 7 8 9 10 11 12 13
#14 15 16 17 18 19 20
#21 22 23 24 25 26 27
#28 29 30 31
#
#**********************************************************************
$USACAN_DST=0;
$mm = $mon;
$dd = $mday;
$ns = $dsec;
$dow= $wday;
if ($mm < 3 || $mm > 11) {
$USACAN_DST=0; return 0;
} elsif ($mm >= 4 && $mm <= 10) {
$USACAN_DST=1; return 1;
} elsif ($mm == 3) {
if ($dd > 13) {
$USACAN_DST=1; return 1;
} elsif ($dd >= ($dow+8)) {
if ($timezone) {
if ($dow == 0 && $ns < (7200+$timezone*3600)) {
$USACAN_DST=0; return 0;
} else {
$USACAN_DST=1; return 1;
}
} else {
if ($dow == 0 && $ns < 7200) {
$USACAN_DST=0; return 0;
} else {
$USACAN_DST=1; return 1;
}
}
} else {
$USACAN_DST=0; return 0;
}
} elsif ($mm == 11) {
if ($dd > 7) {
$USACAN_DST=0; return 0;
} elsif ($dd < ($dow+1)) {
$USACAN_DST=1; return 1;
} elsif ($dow == 0) {
if ($timezone) { # UTC calculations
if ($ns < (7200+($timezone-1)*3600)) {
$USACAN_DST=1; return 1;
} else {
$USACAN_DST=0; return 0;
}
} else { # local time calculations
if ($ns < 7200) {
$USACAN_DST=1; return 1;
} else {
$USACAN_DST=0; return 0;
}
}
} else {
$USACAN_DST=0; return 0;
}
} # end of month checks
} # end of subroutine dstcalc
sub NA_dstcalc {
#**********************************************************************
# FSA-LSO
# This is returns 1 if Daylight Savings Time is in effect and 0 if
# Standard time is in effect.
# Based on first Sunday in April and last Sunday in October at 2 am.
#********************************************************************** #**********************************************************************
$USA_DST=0; $NA_DST=0;
$mm = $mon; $mm = $mon;
$dd = $mday; $dd = $mday;
$ns = $dsec; $ns = $dsec;
$dow= $wday; $dow= $wday;
if ($mm < 4 || $mm > 10) { if ($mm < 4 || $mm > 10) {
$USA_DST=0; return 0; $NA_DST=0; return 0;
} elsif ($mm >= 5 && $mm <= 9) { } elsif ($mm >= 5 && $mm <= 9) {
$USA_DST=1; return 1; $NA_DST=1; return 1;
} elsif ($mm == 4) { } elsif ($mm == 4) {
if ($dd > 7) { if ($dd > 7) {
$USA_DST=1; return 1; $NA_DST=1; return 1;
} elsif ($dd >= ($dow+1)) { } elsif ($dd >= ($dow+1)) {
if ($timezone) { if ($timezone) {
if ($dow == 0 && $ns < (7200+$timezone*3600)) { if ($dow == 0 && $ns < (7200+$timezone*3600)) {
$USA_DST=0; return 0; $NA_DST=0; return 0;
} else { } else {
$USA_DST=1; return 1; $NA_DST=1; return 1;
} }
} else { } else {
if ($dow == 0 && $ns < 7200) { if ($dow == 0 && $ns < 7200) {
$USA_DST=0; return 0; $NA_DST=0; return 0;
} else { } else {
$USA_DST=1; return 1; $NA_DST=1; return 1;
} }
} }
} else { } else {
$USA_DST=0; return 0; $NA_DST=0; return 0;
} }
} elsif ($mm == 10) { } elsif ($mm == 10) {
if ($dd < 25) { if ($dd < 25) {
$USA_DST=1; return 1; $NA_DST=1; return 1;
} elsif ($dd < ($dow+25)) { } elsif ($dd < ($dow+25)) {
$USA_DST=1; return 1; $NA_DST=1; return 1;
} elsif ($dow == 0) { } elsif ($dow == 0) {
if ($timezone) { # UTC calculations if ($timezone) { # UTC calculations
if ($ns < (7200+($timezone-1)*3600)) { if ($ns < (7200+($timezone-1)*3600)) {
$USA_DST=1; return 1; $NA_DST=1; return 1;
} else { } else {
$USA_DST=0; return 0; $NA_DST=0; return 0;
} }
} else { # local time calculations } else { # local time calculations
if ($ns < 7200) { if ($ns < 7200) {
$USA_DST=1; return 1; $NA_DST=1; return 1;
} else { } else {
$USA_DST=0; return 0; $NA_DST=0; return 0;
} }
} }
} else { } else {
$USA_DST=0; return 0; $NA_DST=0; return 0;
} }
} # end of month checks } # end of month checks
} # end of subroutine dstcalc } # end of subroutine dstcalc
@@ -487,6 +586,7 @@ sub USA_dstcalc {
sub GBR_dstcalc { sub GBR_dstcalc {
#********************************************************************** #**********************************************************************
# LSM-LSO
# This is returns 1 if Daylight Savings Time is in effect and 0 if # This is returns 1 if Daylight Savings Time is in effect and 0 if
# Standard time is in effect. # Standard time is in effect.
# Based on last Sunday in March and last Sunday in October at 1 am. # Based on last Sunday in March and last Sunday in October at 1 am.
@@ -554,6 +654,7 @@ sub GBR_dstcalc {
sub AUS_dstcalc { sub AUS_dstcalc {
#********************************************************************** #**********************************************************************
# LSO-LSM
# This is returns 1 if Daylight Savings Time is in effect and 0 if # This is returns 1 if Daylight Savings Time is in effect and 0 if
# Standard time is in effect. # Standard time is in effect.
# Based on last Sunday in October and last Sunday in March at 1 am. # Based on last Sunday in October and last Sunday in March at 1 am.
@@ -622,6 +723,7 @@ sub AUS_dstcalc {
sub AUST_dstcalc { sub AUST_dstcalc {
#********************************************************************** #**********************************************************************
# FSO-LSM
# TASMANIA ONLY # TASMANIA ONLY
# This is returns 1 if Daylight Savings Time is in effect and 0 if # This is returns 1 if Daylight Savings Time is in effect and 0 if
# Standard time is in effect. # Standard time is in effect.
@@ -661,7 +763,7 @@ sub AUST_dstcalc {
$AUST_DST=0; return 0; $AUST_DST=0; return 0;
} }
} elsif ($mm == 10) { } elsif ($mm == 10) {
if ($dd > 7) { if ($dd >= 8) {
$AUST_DST=1; return 1; $AUST_DST=1; return 1;
} elsif ($dd >= ($dow+1)) { } elsif ($dd >= ($dow+1)) {
if ($timezone) { if ($timezone) {
@@ -689,6 +791,7 @@ sub AUST_dstcalc {
sub NZL_dstcalc { sub NZL_dstcalc {
#********************************************************************** #**********************************************************************
# FSO-TSM
# This is returns 1 if Daylight Savings Time is in effect and 0 if # This is returns 1 if Daylight Savings Time is in effect and 0 if
# Standard time is in effect. # Standard time is in effect.
# Based on first Sunday in October and third Sunday in March at 1 am. # Based on first Sunday in October and third Sunday in March at 1 am.
@@ -727,7 +830,7 @@ sub NZL_dstcalc {
$NZL_DST=0; return 0; $NZL_DST=0; return 0;
} }
} elsif ($mm == 10) { } elsif ($mm == 10) {
if ($dd > 7) { if ($dd >= 8) {
$NZL_DST=1; return 1; $NZL_DST=1; return 1;
} elsif ($dd >= ($dow+1)) { } elsif ($dd >= ($dow+1)) {
if ($timezone) { if ($timezone) {
@@ -748,3 +851,71 @@ sub NZL_dstcalc {
} }
} # end of month checks } # end of month checks
} # end of subroutine dstcalc } # end of subroutine dstcalc
sub BZL_dstcalc {
#**********************************************************************
# TSO-LSF
# This is returns 1 if Daylight Savings Time is in effect and 0 if
# Standard time is in effect. Brazil
# Based on Third Sunday October to Last Sunday February at 1 am.
#**********************************************************************
$BZL_DST=0;
$mm = $mon;
$dd = $mday;
$ns = $dsec;
$dow= $wday;
if ($mm < 2 || $mm > 10) {
$BZL_DST=1; return 1;
} elsif ($mm >= 3 && $mm <= 9) {
$BZL_DST=0; return 0;
} elsif ($mm == 2) {
if ($dd < 22) {
$BZL_DST=1; return 1;
} elsif ($dd < ($dow+22)) {
$BZL_DST=1; return 1;
} elsif ($dow == 0) {
if ($timezone) { # UTC calculations
if ($ns < (3600+($timezone-1)*3600)) {
$BZL_DST=1; return 1;
} else {
$BZL_DST=0; return 0;
}
} else { # local time calculations
if ($ns < 3600) {
$BZL_DST=1; return 1;
} else {
$BZL_DST=0; return 0;
}
}
} else {
$BZL_DST=0; return 0;
}
} elsif ($mm == 10) {
if ($dd < 22) {
$BZL_DST=0; return 0;
} elsif ($dd < ($dow+22)) {
$BZL_DST=0; return 0;
} elsif ($dow == 0) {
if ($timezone) { # UTC calculations
if ($ns < (3600+($timezone-1)*3600)) {
$BZL_DST=0; return 0;
} else {
$BZL_DST=1; return 1;
}
} else { # local time calculations
if ($ns < 3600) {
$BZL_DST=0; return 0;
} else {
$BZL_DST=1; return 1;
}
}
} else {
$BZL_DST=1; return 1;
}
} # end of month checks
} # end of subroutine dstcalc
+165 -10
View File
@@ -15,11 +15,12 @@
# 60619-1651 - Added variable filtering to eliminate SQL injection attack threat # 60619-1651 - Added variable filtering to eliminate SQL injection attack threat
# 60822-1121 - fixed for nonwritable directories # 60822-1121 - fixed for nonwritable directories
# 60906-1100 - added filter of non-digits in alt_phone field # 60906-1100 - added filter of non-digits in alt_phone field
# 61110-1222 - added new USA-Canada DST scheme and Brazil DST scheme
# #
# make sure vicidial_list exists and that your file follows the formatting correctly. This page does not dedupe or do any other lead filtering actions yet at this time. # make sure vicidial_list exists and that your file follows the formatting correctly. This page does not dedupe or do any other lead filtering actions yet at this time.
$version = '2.0.1'; $version = '2.0.2';
$build = '60906-1100'; $build = '61110-1222';
require("dbconnect.php"); require("dbconnect.php");
@@ -368,7 +369,7 @@ function ParseFileName() {
$state = $row[$state_field]; $state = $row[$state_field];
$province = $row[$province_field]; $province = $row[$province_field];
$postal_code = $row[$postal_code_field]; $postal_code = $row[$postal_code_field];
$country_code = $row[$country_code_field]; $country_code = $row[$country_code_field];
$gender = $row[$gender_field]; $gender = $row[$gender_field];
$date_of_birth = $row[$date_of_birth_field]; $date_of_birth = $row[$date_of_birth_field];
$alt_phone = eregi_replace("[^0-9]", "", $row[$alt_phone_field]); $alt_phone = eregi_replace("[^0-9]", "", $row[$alt_phone_field]);
@@ -477,7 +478,7 @@ function ParseFileName() {
$state = $row[$state_field]; $state = $row[$state_field];
$province = $row[$province_field]; $province = $row[$province_field];
$postal_code = $row[$postal_code_field]; $postal_code = $row[$postal_code_field];
$country_code = $row[$country_code_field]; $country_code = $row[$country_code_field];
$gender = $row[$gender_field]; $gender = $row[$gender_field];
$date_of_birth = $row[$date_of_birth_field]; $date_of_birth = $row[$date_of_birth_field];
$alt_phone = eregi_replace("[^0-9]", "", $row[$alt_phone_field]); $alt_phone = eregi_replace("[^0-9]", "", $row[$alt_phone_field]);
@@ -605,7 +606,7 @@ if ($leadfile && filesize($LF_path)<=8388608) {
$state = $row[13]; $state = $row[13];
$province = $row[14]; $province = $row[14];
$postal_code = $row[15]; $postal_code = $row[15];
$country_code = $row[16]; $country_code = $row[16];
$gender = $row[17]; $gender = $row[17];
$date_of_birth = $row[18]; $date_of_birth = $row[18];
$alt_phone = eregi_replace("[^0-9]", "", $row[19]); $alt_phone = eregi_replace("[^0-9]", "", $row[19]);
@@ -730,7 +731,7 @@ if ($leadfile && filesize($LF_path)<=8388608) {
$state = $row[13]; $state = $row[13];
$province = $row[14]; $province = $row[14];
$postal_code = $row[15]; $postal_code = $row[15];
$country_code = $row[16]; $country_code = $row[16];
$gender = $row[17]; $gender = $row[17];
$date_of_birth = $row[18]; $date_of_birth = $row[18];
$alt_phone = eregi_replace("[^0-9]", "", $row[19]); $alt_phone = eregi_replace("[^0-9]", "", $row[19]);
@@ -1086,14 +1087,14 @@ $AC_localtime = mktime(($Shour + $AC_GMT_diff), $Smin, $Ssec, $Smon, $Smday, $Sy
$dsec = ( ( ($hour * 3600) + ($min * 60) ) + $sec ); $dsec = ( ( ($hour * 3600) + ($min * 60) ) + $sec );
$AC_processed=0; $AC_processed=0;
if ( (!$AC_processed) and ($dst_range == 'FSA-LSO') ) if ( (!$AC_processed) and ($dst_range == 'SSM-FSN') )
{ {
if ($DBX) {print " First Sunday April to Last Sunday October\n";} if ($DBX) {print " Second Sunday March to First Sunday November\n";}
#********************************************************************** #**********************************************************************
# FSA-LSO # SSM-FSN
# This is returns 1 if Daylight Savings Time is in effect and 0 if # This is returns 1 if Daylight Savings Time is in effect and 0 if
# Standard time is in effect. # Standard time is in effect.
# Based on first Sunday in April and last Sunday in October at 2 am. # Based on Second Sunday March to First Sunday November at 2 am.
# INPUTS: # INPUTS:
# mm INTEGER Month. # mm INTEGER Month.
# dd INTEGER Day of the month. # dd INTEGER Day of the month.
@@ -1107,6 +1108,89 @@ if ( (!$AC_processed) and ($dst_range == 'FSA-LSO') )
# and 9:00 UTC in October # and 9:00 UTC in October
# OUTPUT: # OUTPUT:
# INTEGER 1 = DST, 0 = not DST # INTEGER 1 = DST, 0 = not DST
#
# S M T W T F S
# 1 2 3 4 5 6 7
# 8 9 10 11 12 13 14
#15 16 17 18 19 20 21
#22 23 24 25 26 27 28
#29 30 31
#
# S M T W T F S
# 1 2 3 4 5 6
# 7 8 9 10 11 12 13
#14 15 16 17 18 19 20
#21 22 23 24 25 26 27
#28 29 30 31
#
#**********************************************************************
$USACAN_DST=0;
$mm = $mon;
$dd = $mday;
$ns = $dsec;
$dow= $wday;
if ($mm < 3 || $mm > 11) {
$USACAN_DST=0;
} elseif ($mm >= 4 and $mm <= 10) {
$USACAN_DST=1;
} elseif ($mm == 3) {
if ($dd > 13) {
$USACAN_DST=1;
} elseif ($dd >= ($dow+8)) {
if ($timezone) {
if ($dow == 0 and $ns < (7200+$timezone*3600)) {
$USACAN_DST=0;
} else {
$USACAN_DST=1;
}
} else {
if ($dow == 0 and $ns < 7200) {
$USACAN_DST=0;
} else {
$USACAN_DST=1;
}
}
} else {
$USACAN_DST=0;
}
} elseif ($mm == 11) {
if ($dd > 7) {
$USACAN_DST=0;
} elseif ($dd < ($dow+1)) {
$USACAN_DST=1;
} elseif ($dow == 0) {
if ($timezone) { # UTC calculations
if ($ns < (7200+($timezone-1)*3600)) {
$USACAN_DST=1;
} else {
$USACAN_DST=0;
}
} else { # local time calculations
if ($ns < 7200) {
$USACAN_DST=1;
} else {
$USACAN_DST=0;
}
}
} else {
$USACAN_DST=0;
}
} # end of month checks
if ($DBX) {print " DST: $USACAN_DST\n";}
if ($USACAN_DST) {$gmt_offset++;}
$AC_processed++;
}
if ( (!$AC_processed) and ($dst_range == 'FSA-LSO') )
{
if ($DBX) {print " First Sunday April to Last Sunday October\n";}
#**********************************************************************
# FSA-LSO
# This is returns 1 if Daylight Savings Time is in effect and 0 if
# Standard time is in effect.
# Based on first Sunday in April and last Sunday in October at 2 am.
#********************************************************************** #**********************************************************************
$USA_DST=0; $USA_DST=0;
@@ -1438,6 +1522,77 @@ if ( (!$AC_processed) and ($dst_range == 'FSO-TSM') )
if ($NZL_DST) {$gmt_offset++;} if ($NZL_DST) {$gmt_offset++;}
$AC_processed++; $AC_processed++;
} }
if ( (!$AC_processed) and ($dst_range == 'TSO-LSF') )
{
if ($DBX) {print " Third Sunday October to Last Sunday February\n";}
#**********************************************************************
# TSO-LSF
# This is returns 1 if Daylight Savings Time is in effect and 0 if
# Standard time is in effect. Brazil
# Based on Third Sunday October to Last Sunday February at 1 am.
#**********************************************************************
$BZL_DST=0;
$mm = $mon;
$dd = $mday;
$ns = $dsec;
$dow= $wday;
if ($mm < 2 || $mm > 10) {
$BZL_DST=1;
} elseif ($mm >= 3 and $mm <= 9) {
$BZL_DST=0;
} elseif ($mm == 2) {
if ($dd < 22) {
$BZL_DST=1;
} elseif ($dd < ($dow+22)) {
$BZL_DST=1;
} elseif ($dow == 0) {
if ($timezone) { # UTC calculations
if ($ns < (3600+($timezone-1)*3600)) {
$BZL_DST=1;
} else {
$BZL_DST=0;
}
} else { # local time calculations
if ($ns < 3600) {
$BZL_DST=1;
} else {
$BZL_DST=0;
}
}
} else {
$BZL_DST=0;
}
} elseif ($mm == 10) {
if ($dd < 22) {
$BZL_DST=0;
} elseif ($dd < ($dow+22)) {
$BZL_DST=0;
} elseif ($dow == 0) {
if ($timezone) { # UTC calculations
if ($ns < (3600+($timezone-1)*3600)) {
$BZL_DST=0;
} else {
$BZL_DST=1;
}
} else { # local time calculations
if ($ns < 3600) {
$BZL_DST=0;
} else {
$BZL_DST=1;
}
}
} else {
$BZL_DST=1;
}
} # end of month checks
if ($DBX) {print " DST: $BZL_DST\n";}
if ($BZL_DST) {$gmt_offset++;}
$AC_processed++;
}
if (!$AC_processed) if (!$AC_processed)
{ {
if ($DBX) {print " No DST Method Found\n";} if ($DBX) {print " No DST Method Found\n";}