Added gmt lookup to add new lead process for admin web interface
git-svn-id: svn://192.168.202.10@2320 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
# admin_modify_lead.php version 2.10
|
||||
# admin_modify_lead.php version 2.12
|
||||
#
|
||||
# ViciDial database administration modify lead in vicidial_list
|
||||
# admin_modify_lead.php
|
||||
@@ -67,6 +67,7 @@
|
||||
# 150107-1729 - Added ignore_group_on_search user option
|
||||
# 150114-2321 - Added date_of_birth as editable field
|
||||
# 150312-1506 - Fixed minor Iframe form bug related to custom fields
|
||||
# 150514-1522 - Added $gmt_offset lookup for adding a new lead
|
||||
#
|
||||
|
||||
require("dbconnect_mysqli.php");
|
||||
@@ -395,22 +396,65 @@ if ($scb_count_to_print > 0)
|
||||
<?php
|
||||
echo "<a href=\"./admin.php?ADD=100\">"._QXZ("ADMINISTRATION")."</a>: "._QXZ("Lead record modification")."<BR>\n";
|
||||
|
||||
### BEGIN - Add a new lead in the system ###
|
||||
if ($lead_id == 'NEW')
|
||||
{
|
||||
$secX = date("U");
|
||||
$hour = date("H");
|
||||
$min = date("i");
|
||||
$sec = date("s");
|
||||
$mon = date("m");
|
||||
$mday = date("d");
|
||||
$year = date("Y");
|
||||
$isdst = date("I");
|
||||
$Shour = date("H");
|
||||
$Smin = date("i");
|
||||
$Ssec = date("s");
|
||||
$Smon = date("m");
|
||||
$Smday = date("d");
|
||||
$Syear = date("Y");
|
||||
|
||||
### Grab Server GMT value from the database
|
||||
$stmt="SELECT local_gmt FROM servers where active='Y' limit 1;";
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
$gmt_recs = mysqli_num_rows($rslt);
|
||||
if ($gmt_recs > 0)
|
||||
{
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$DBSERVER_GMT = $row[0];
|
||||
if (strlen($DBSERVER_GMT)>0) {$SERVER_GMT = $DBSERVER_GMT;}
|
||||
if ($isdst) {$SERVER_GMT++;}
|
||||
}
|
||||
else
|
||||
{
|
||||
$SERVER_GMT = date("O");
|
||||
$SERVER_GMT = preg_replace("/\+/i","",$SERVER_GMT);
|
||||
$SERVER_GMT = ($SERVER_GMT + 0);
|
||||
$SERVER_GMT = ($SERVER_GMT / 100);
|
||||
}
|
||||
|
||||
$LOCAL_GMT_OFF = $SERVER_GMT;
|
||||
$LOCAL_GMT_OFF_STD = $SERVER_GMT;
|
||||
|
||||
$USarea = substr($phone_number, 0, 3);
|
||||
$postalgmt='';
|
||||
|
||||
$gmt_offset = lookup_gmt($phone_code,$USarea,$state,$LOCAL_GMT_OFF_STD,$Shour,$Smin,$Ssec,$Smon,$Smday,$Syear,$postalgmt,$postal_code);
|
||||
$comments = preg_replace("/\n/",'!N',$comments);
|
||||
$comments = preg_replace("/\r/",'',$comments);
|
||||
$stmt="INSERT INTO vicidial_list set status='" . mysqli_real_escape_string($link, $status) . "',title='" . mysqli_real_escape_string($link, $title) . "',first_name='" . mysqli_real_escape_string($link, $first_name) . "',middle_initial='" . mysqli_real_escape_string($link, $middle_initial) . "',last_name='" . mysqli_real_escape_string($link, $last_name) . "',address1='" . mysqli_real_escape_string($link, $address1) . "',address2='" . mysqli_real_escape_string($link, $address2) . "',address3='" . mysqli_real_escape_string($link, $address3) . "',city='" . mysqli_real_escape_string($link, $city) . "',state='" . mysqli_real_escape_string($link, $state) . "',province='" . mysqli_real_escape_string($link, $province) . "',postal_code='" . mysqli_real_escape_string($link, $postal_code) . "',country_code='" . mysqli_real_escape_string($link, $country_code) . "',alt_phone='" . mysqli_real_escape_string($link, $alt_phone) . "',phone_number='$phone_number',phone_code='$phone_code',email='" . mysqli_real_escape_string($link, $email) . "',security_phrase='" . mysqli_real_escape_string($link, $security) . "',comments='" . mysqli_real_escape_string($link, $comments) . "',rank='" . mysqli_real_escape_string($link, $rank) . "',owner='" . mysqli_real_escape_string($link, $owner) . "',vendor_lead_code='" . mysqli_real_escape_string($link, $vendor_id) . "', list_id='" . mysqli_real_escape_string($link, $list_id) . "',date_of_birth='" . mysqli_real_escape_string($link, $date_of_birth) . "',entry_date=NOW();";
|
||||
$stmt="INSERT INTO vicidial_list set status='" . mysqli_real_escape_string($link, $status) . "',title='" . mysqli_real_escape_string($link, $title) . "',first_name='" . mysqli_real_escape_string($link, $first_name) . "',middle_initial='" . mysqli_real_escape_string($link, $middle_initial) . "',last_name='" . mysqli_real_escape_string($link, $last_name) . "',address1='" . mysqli_real_escape_string($link, $address1) . "',address2='" . mysqli_real_escape_string($link, $address2) . "',address3='" . mysqli_real_escape_string($link, $address3) . "',city='" . mysqli_real_escape_string($link, $city) . "',state='" . mysqli_real_escape_string($link, $state) . "',province='" . mysqli_real_escape_string($link, $province) . "',postal_code='" . mysqli_real_escape_string($link, $postal_code) . "',country_code='" . mysqli_real_escape_string($link, $country_code) . "',alt_phone='" . mysqli_real_escape_string($link, $alt_phone) . "',phone_number='$phone_number',phone_code='$phone_code',email='" . mysqli_real_escape_string($link, $email) . "',security_phrase='" . mysqli_real_escape_string($link, $security) . "',comments='" . mysqli_real_escape_string($link, $comments) . "',rank='" . mysqli_real_escape_string($link, $rank) . "',owner='" . mysqli_real_escape_string($link, $owner) . "',vendor_lead_code='" . mysqli_real_escape_string($link, $vendor_id) . "', list_id='" . mysqli_real_escape_string($link, $list_id) . "',date_of_birth='" . mysqli_real_escape_string($link, $date_of_birth) . "',gmt_offset_now='$gmt_offset',entry_date=NOW();";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
$affected_rows = mysqli_affected_rows($link);
|
||||
if ($affected_rows > 0)
|
||||
{
|
||||
$lead_id = mysqli_insert_id($link);
|
||||
echo _QXZ("Lead has been added").": $lead_id<BR><BR>\n";
|
||||
echo _QXZ("Lead has been added").": $lead_id ($gmt_offset)<BR><BR>\n";
|
||||
$end_call=0;
|
||||
}
|
||||
else
|
||||
{echo _QXZ("ERROR: Lead not added, please go back and look at what you entered")."<BR><BR>\n";}
|
||||
### END - Add a new lead in the system ###
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
#
|
||||
# functions.php version 2.10
|
||||
# functions.php version 2.12
|
||||
#
|
||||
# functions for administrative scripts and reports
|
||||
#
|
||||
@@ -23,6 +23,7 @@
|
||||
# 141229-1535 - Added code to QXZ allowing for on-the-fly mysql phrase lookups
|
||||
# 150210-1358 - Added precision S default to 0 in sec_convert
|
||||
# 150216-1528 - Fixed non-latin problem, issue #828
|
||||
# 150514-1522 - Added lookup_gmt function, copied from agc/functions.php
|
||||
#
|
||||
|
||||
##### BEGIN validate user login credentials, check for failed lock out #####
|
||||
@@ -415,6 +416,765 @@ function download_max_system_stats($campaign_id,$days_graph,$title,$metric,$metr
|
||||
##### END download max stats data #####
|
||||
|
||||
|
||||
##### LOOKUP GMT, FINDS THE CURRENT GMT OFFSET FOR A PHONE NUMBER #####
|
||||
|
||||
function lookup_gmt($phone_code,$USarea,$state,$LOCAL_GMT_OFF_STD,$Shour,$Smin,$Ssec,$Smon,$Smday,$Syear,$postalgmt,$postal_code)
|
||||
{
|
||||
global $link;
|
||||
|
||||
$postalgmt_found=0;
|
||||
if ( (preg_match("/POSTAL/i",$postalgmt)) && (strlen($postal_code)>4) )
|
||||
{
|
||||
if (preg_match('/^1$/', $phone_code))
|
||||
{
|
||||
$stmt="select postal_code,state,GMT_offset,DST,DST_range,country,country_code from vicidial_postal_codes where country_code='$phone_code' and postal_code LIKE \"$postal_code%\";";
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
$pc_recs = mysqli_num_rows($rslt);
|
||||
if ($pc_recs > 0)
|
||||
{
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$gmt_offset = $row[2]; $gmt_offset = preg_replace("/\+/i","",$gmt_offset);
|
||||
$dst = $row[3];
|
||||
$dst_range = $row[4];
|
||||
$PC_processed++;
|
||||
$postalgmt_found++;
|
||||
$post++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($postalgmt_found < 1)
|
||||
{
|
||||
$PC_processed=0;
|
||||
### UNITED STATES ###
|
||||
if ($phone_code =='1')
|
||||
{
|
||||
$stmt="select country_code,country,areacode,state,GMT_offset,DST,DST_range,geographic_description from vicidial_phone_codes where country_code='$phone_code' and areacode='$USarea';";
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
$pc_recs = mysqli_num_rows($rslt);
|
||||
if ($pc_recs > 0)
|
||||
{
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$gmt_offset = $row[4]; $gmt_offset = preg_replace("/\+/i","",$gmt_offset);
|
||||
$dst = $row[5];
|
||||
$dst_range = $row[6];
|
||||
$PC_processed++;
|
||||
}
|
||||
}
|
||||
### MEXICO ###
|
||||
if ($phone_code =='52')
|
||||
{
|
||||
$stmt="select country_code,country,areacode,state,GMT_offset,DST,DST_range,geographic_description from vicidial_phone_codes where country_code='$phone_code' and areacode='$USarea';";
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
$pc_recs = mysqli_num_rows($rslt);
|
||||
if ($pc_recs > 0)
|
||||
{
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$gmt_offset = $row[4]; $gmt_offset = preg_replace("/\+/i","",$gmt_offset);
|
||||
$dst = $row[5];
|
||||
$dst_range = $row[6];
|
||||
$PC_processed++;
|
||||
}
|
||||
}
|
||||
### AUSTRALIA ###
|
||||
if ($phone_code =='61')
|
||||
{
|
||||
$stmt="select country_code,country,areacode,state,GMT_offset,DST,DST_range,geographic_description from vicidial_phone_codes where country_code='$phone_code' and state='$state';";
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
$pc_recs = mysqli_num_rows($rslt);
|
||||
if ($pc_recs > 0)
|
||||
{
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$gmt_offset = $row[4]; $gmt_offset = preg_replace("/\+/i","",$gmt_offset);
|
||||
$dst = $row[5];
|
||||
$dst_range = $row[6];
|
||||
$PC_processed++;
|
||||
}
|
||||
}
|
||||
### ALL OTHER COUNTRY CODES ###
|
||||
if (!$PC_processed)
|
||||
{
|
||||
$PC_processed++;
|
||||
$stmt="select country_code,country,areacode,state,GMT_offset,DST,DST_range,geographic_description from vicidial_phone_codes where country_code='$phone_code';";
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
$pc_recs = mysqli_num_rows($rslt);
|
||||
if ($pc_recs > 0)
|
||||
{
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$gmt_offset = $row[4]; $gmt_offset = preg_replace("/\+/i","",$gmt_offset);
|
||||
$dst = $row[5];
|
||||
$dst_range = $row[6];
|
||||
$PC_processed++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
### Find out if DST to raise the gmt offset ###
|
||||
$AC_GMT_diff = ($gmt_offset - $LOCAL_GMT_OFF_STD);
|
||||
$AC_localtime = mktime(($Shour + $AC_GMT_diff), $Smin, $Ssec, $Smon, $Smday, $Syear);
|
||||
$hour = date("H",$AC_localtime);
|
||||
$min = date("i",$AC_localtime);
|
||||
$sec = date("s",$AC_localtime);
|
||||
$mon = date("m",$AC_localtime);
|
||||
$mday = date("d",$AC_localtime);
|
||||
$wday = date("w",$AC_localtime);
|
||||
$year = date("Y",$AC_localtime);
|
||||
$dsec = ( ( ($hour * 3600) + ($min * 60) ) + $sec );
|
||||
|
||||
$AC_processed=0;
|
||||
if ( (!$AC_processed) and ($dst_range == 'SSM-FSN') )
|
||||
{
|
||||
if ($DBX) {print " "._QXZ("Second Sunday March to First Sunday November")."\n";}
|
||||
#**********************************************************************
|
||||
# SSM-FSN
|
||||
# This is returns 1 if Daylight Savings Time is in effect and 0 if
|
||||
# Standard time is in effect.
|
||||
# Based on Second Sunday March to First Sunday November at 2 am.
|
||||
# INPUTS:
|
||||
# mm INTEGER Month.
|
||||
# dd INTEGER Day of the month.
|
||||
# ns INTEGER Seconds into the day.
|
||||
# dow INTEGER Day of week (0=Sunday, to 6=Saturday)
|
||||
# OPTIONAL INPUT:
|
||||
# timezone INTEGER hour difference UTC - local standard time
|
||||
# (DEFAULT is blank)
|
||||
# make calculations based on UTC time,
|
||||
# which means shift at 10:00 UTC in April
|
||||
# and 9:00 UTC in October
|
||||
# OUTPUT:
|
||||
# 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 " "._QXZ("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;
|
||||
$mm = $mon;
|
||||
$dd = $mday;
|
||||
$ns = $dsec;
|
||||
$dow= $wday;
|
||||
|
||||
if ($mm < 4 || $mm > 10) {
|
||||
$USA_DST=0;
|
||||
} elseif ($mm >= 5 and $mm <= 9) {
|
||||
$USA_DST=1;
|
||||
} elseif ($mm == 4) {
|
||||
if ($dd > 7) {
|
||||
$USA_DST=1;
|
||||
} elseif ($dd >= ($dow+1)) {
|
||||
if ($timezone) {
|
||||
if ($dow == 0 and $ns < (7200+$timezone*3600)) {
|
||||
$USA_DST=0;
|
||||
} else {
|
||||
$USA_DST=1;
|
||||
}
|
||||
} else {
|
||||
if ($dow == 0 and $ns < 7200) {
|
||||
$USA_DST=0;
|
||||
} else {
|
||||
$USA_DST=1;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$USA_DST=0;
|
||||
}
|
||||
} elseif ($mm == 10) {
|
||||
if ($dd < 25) {
|
||||
$USA_DST=1;
|
||||
} elseif ($dd < ($dow+25)) {
|
||||
$USA_DST=1;
|
||||
} elseif ($dow == 0) {
|
||||
if ($timezone) { # UTC calculations
|
||||
if ($ns < (7200+($timezone-1)*3600)) {
|
||||
$USA_DST=1;
|
||||
} else {
|
||||
$USA_DST=0;
|
||||
}
|
||||
} else { # local time calculations
|
||||
if ($ns < 7200) {
|
||||
$USA_DST=1;
|
||||
} else {
|
||||
$USA_DST=0;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$USA_DST=0;
|
||||
}
|
||||
} # end of month checks
|
||||
|
||||
if ($DBX) {print " DST: $USA_DST\n";}
|
||||
if ($USA_DST) {$gmt_offset++;}
|
||||
$AC_processed++;
|
||||
}
|
||||
|
||||
if ( (!$AC_processed) and ($dst_range == 'LSM-LSO') )
|
||||
{
|
||||
if ($DBX) {print " "._QXZ("Last Sunday March to Last Sunday October")."\n";}
|
||||
#**********************************************************************
|
||||
# This is s 1 if Daylight Savings Time is in effect and 0 if
|
||||
# Standard time is in effect.
|
||||
# Based on last Sunday in March and last Sunday in October at 1 am.
|
||||
#**********************************************************************
|
||||
|
||||
$GBR_DST=0;
|
||||
$mm = $mon;
|
||||
$dd = $mday;
|
||||
$ns = $dsec;
|
||||
$dow= $wday;
|
||||
|
||||
if ($mm < 3 || $mm > 10) {
|
||||
$GBR_DST=0;
|
||||
} elseif ($mm >= 4 and $mm <= 9) {
|
||||
$GBR_DST=1;
|
||||
} elseif ($mm == 3) {
|
||||
if ($dd < 25) {
|
||||
$GBR_DST=0;
|
||||
} elseif ($dd < ($dow+25)) {
|
||||
$GBR_DST=0;
|
||||
} elseif ($dow == 0) {
|
||||
if ($timezone) { # UTC calculations
|
||||
if ($ns < (3600+($timezone-1)*3600)) {
|
||||
$GBR_DST=0;
|
||||
} else {
|
||||
$GBR_DST=1;
|
||||
}
|
||||
} else { # local time calculations
|
||||
if ($ns < 3600) {
|
||||
$GBR_DST=0;
|
||||
} else {
|
||||
$GBR_DST=1;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$GBR_DST=1;
|
||||
}
|
||||
} elseif ($mm == 10) {
|
||||
if ($dd < 25) {
|
||||
$GBR_DST=1;
|
||||
} elseif ($dd < ($dow+25)) {
|
||||
$GBR_DST=1;
|
||||
} elseif ($dow == 0) {
|
||||
if ($timezone) { # UTC calculations
|
||||
if ($ns < (3600+($timezone-1)*3600)) {
|
||||
$GBR_DST=1;
|
||||
} else {
|
||||
$GBR_DST=0;
|
||||
}
|
||||
} else { # local time calculations
|
||||
if ($ns < 3600) {
|
||||
$GBR_DST=1;
|
||||
} else {
|
||||
$GBR_DST=0;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$GBR_DST=0;
|
||||
}
|
||||
} # end of month checks
|
||||
if ($DBX) {print " DST: $GBR_DST\n";}
|
||||
if ($GBR_DST) {$gmt_offset++;}
|
||||
$AC_processed++;
|
||||
}
|
||||
if ( (!$AC_processed) and ($dst_range == 'LSO-LSM') )
|
||||
{
|
||||
if ($DBX) {print " "._QXZ("Last Sunday October to Last Sunday March")."\n";}
|
||||
#**********************************************************************
|
||||
# This is s 1 if Daylight Savings Time is in effect and 0 if
|
||||
# Standard time is in effect.
|
||||
# Based on last Sunday in October and last Sunday in March at 1 am.
|
||||
#**********************************************************************
|
||||
|
||||
$AUS_DST=0;
|
||||
$mm = $mon;
|
||||
$dd = $mday;
|
||||
$ns = $dsec;
|
||||
$dow= $wday;
|
||||
|
||||
if ($mm < 3 || $mm > 10) {
|
||||
$AUS_DST=1;
|
||||
} elseif ($mm >= 4 and $mm <= 9) {
|
||||
$AUS_DST=0;
|
||||
} elseif ($mm == 3) {
|
||||
if ($dd < 25) {
|
||||
$AUS_DST=1;
|
||||
} elseif ($dd < ($dow+25)) {
|
||||
$AUS_DST=1;
|
||||
} elseif ($dow == 0) {
|
||||
if ($timezone) { # UTC calculations
|
||||
if ($ns < (3600+($timezone-1)*3600)) {
|
||||
$AUS_DST=1;
|
||||
} else {
|
||||
$AUS_DST=0;
|
||||
}
|
||||
} else { # local time calculations
|
||||
if ($ns < 3600) {
|
||||
$AUS_DST=1;
|
||||
} else {
|
||||
$AUS_DST=0;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$AUS_DST=0;
|
||||
}
|
||||
} elseif ($mm == 10) {
|
||||
if ($dd < 25) {
|
||||
$AUS_DST=0;
|
||||
} elseif ($dd < ($dow+25)) {
|
||||
$AUS_DST=0;
|
||||
} elseif ($dow == 0) {
|
||||
if ($timezone) { # UTC calculations
|
||||
if ($ns < (3600+($timezone-1)*3600)) {
|
||||
$AUS_DST=0;
|
||||
} else {
|
||||
$AUS_DST=1;
|
||||
}
|
||||
} else { # local time calculations
|
||||
if ($ns < 3600) {
|
||||
$AUS_DST=0;
|
||||
} else {
|
||||
$AUS_DST=1;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$AUS_DST=1;
|
||||
}
|
||||
} # end of month checks
|
||||
if ($DBX) {print " DST: $AUS_DST\n";}
|
||||
if ($AUS_DST) {$gmt_offset++;}
|
||||
$AC_processed++;
|
||||
}
|
||||
|
||||
if ( (!$AC_processed) and ($dst_range == 'FSO-LSM') )
|
||||
{
|
||||
if ($DBX) {print " "._QXZ("First Sunday October to Last Sunday March")."\n";}
|
||||
#**********************************************************************
|
||||
# TASMANIA ONLY
|
||||
# This is s 1 if Daylight Savings Time is in effect and 0 if
|
||||
# Standard time is in effect.
|
||||
# Based on first Sunday in October and last Sunday in March at 1 am.
|
||||
#**********************************************************************
|
||||
|
||||
$AUST_DST=0;
|
||||
$mm = $mon;
|
||||
$dd = $mday;
|
||||
$ns = $dsec;
|
||||
$dow= $wday;
|
||||
|
||||
if ($mm < 3 || $mm > 10) {
|
||||
$AUST_DST=1;
|
||||
} elseif ($mm >= 4 and $mm <= 9) {
|
||||
$AUST_DST=0;
|
||||
} elseif ($mm == 3) {
|
||||
if ($dd < 25) {
|
||||
$AUST_DST=1;
|
||||
} elseif ($dd < ($dow+25)) {
|
||||
$AUST_DST=1;
|
||||
} elseif ($dow == 0) {
|
||||
if ($timezone) { # UTC calculations
|
||||
if ($ns < (3600+($timezone-1)*3600)) {
|
||||
$AUST_DST=1;
|
||||
} else {
|
||||
$AUST_DST=0;
|
||||
}
|
||||
} else { # local time calculations
|
||||
if ($ns < 3600) {
|
||||
$AUST_DST=1;
|
||||
} else {
|
||||
$AUST_DST=0;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$AUST_DST=0;
|
||||
}
|
||||
} elseif ($mm == 10) {
|
||||
if ($dd > 7) {
|
||||
$AUST_DST=1;
|
||||
} elseif ($dd >= ($dow+1)) {
|
||||
if ($timezone) {
|
||||
if ($dow == 0 and $ns < (7200+$timezone*3600)) {
|
||||
$AUST_DST=0;
|
||||
} else {
|
||||
$AUST_DST=1;
|
||||
}
|
||||
} else {
|
||||
if ($dow == 0 and $ns < 3600) {
|
||||
$AUST_DST=0;
|
||||
} else {
|
||||
$AUST_DST=1;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$AUST_DST=0;
|
||||
}
|
||||
} # end of month checks
|
||||
if ($DBX) {print " DST: $AUST_DST\n";}
|
||||
if ($AUST_DST) {$gmt_offset++;}
|
||||
$AC_processed++;
|
||||
}
|
||||
|
||||
if ( (!$AC_processed) and ($dst_range == 'FSO-FSA') )
|
||||
{
|
||||
if ($DBX) {print " "._QXZ("Sunday in October to First Sunday in April")."\n";}
|
||||
#**********************************************************************
|
||||
# FSO-FSA
|
||||
# 2008+ AUSTRALIA ONLY (country code 61)
|
||||
# This is returns 1 if Daylight Savings Time is in effect and 0 if
|
||||
# Standard time is in effect.
|
||||
# Based on first Sunday in October and first Sunday in April at 1 am.
|
||||
#**********************************************************************
|
||||
|
||||
$AUSE_DST=0;
|
||||
$mm = $mon;
|
||||
$dd = $mday;
|
||||
$ns = $dsec;
|
||||
$dow= $wday;
|
||||
|
||||
if ($mm < 4 or $mm > 10) {
|
||||
$AUSE_DST=1;
|
||||
} elseif ($mm >= 5 and $mm <= 9) {
|
||||
$AUSE_DST=0;
|
||||
} elseif ($mm == 4) {
|
||||
if ($dd > 7) {
|
||||
$AUSE_DST=0;
|
||||
} elseif ($dd >= ($dow+1)) {
|
||||
if ($timezone) {
|
||||
if ($dow == 0 and $ns < (3600+$timezone*3600)) {
|
||||
$AUSE_DST=1;
|
||||
} else {
|
||||
$AUSE_DST=0;
|
||||
}
|
||||
} else {
|
||||
if ($dow == 0 and $ns < 7200) {
|
||||
$AUSE_DST=1;
|
||||
} else {
|
||||
$AUSE_DST=0;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$AUSE_DST=1;
|
||||
}
|
||||
} elseif ($mm == 10) {
|
||||
if ($dd >= 8) {
|
||||
$AUSE_DST=1;
|
||||
} elseif ($dd >= ($dow+1)) {
|
||||
if ($timezone) {
|
||||
if ($dow == 0 and $ns < (7200+$timezone*3600)) {
|
||||
$AUSE_DST=0;
|
||||
} else {
|
||||
$AUSE_DST=1;
|
||||
}
|
||||
} else {
|
||||
if ($dow == 0 and $ns < 3600) {
|
||||
$AUSE_DST=0;
|
||||
} else {
|
||||
$AUSE_DST=1;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$AUSE_DST=0;
|
||||
}
|
||||
} # end of month checks
|
||||
if ($DBX) {print " DST: $AUSE_DST\n";}
|
||||
if ($AUSE_DST) {$gmt_offset++;}
|
||||
$AC_processed++;
|
||||
}
|
||||
|
||||
if ( (!$AC_processed) and ($dst_range == 'FSO-TSM') )
|
||||
{
|
||||
if ($DBX) {print " "._QXZ("First Sunday October to Third Sunday March")."\n";}
|
||||
#**********************************************************************
|
||||
# This is s 1 if Daylight Savings Time is in effect and 0 if
|
||||
# Standard time is in effect.
|
||||
# Based on first Sunday in October and third Sunday in March at 1 am.
|
||||
#**********************************************************************
|
||||
|
||||
$NZL_DST=0;
|
||||
$mm = $mon;
|
||||
$dd = $mday;
|
||||
$ns = $dsec;
|
||||
$dow= $wday;
|
||||
|
||||
if ($mm < 3 || $mm > 10) {
|
||||
$NZL_DST=1;
|
||||
} elseif ($mm >= 4 and $mm <= 9) {
|
||||
$NZL_DST=0;
|
||||
} elseif ($mm == 3) {
|
||||
if ($dd < 14) {
|
||||
$NZL_DST=1;
|
||||
} elseif ($dd < ($dow+14)) {
|
||||
$NZL_DST=1;
|
||||
} elseif ($dow == 0) {
|
||||
if ($timezone) { # UTC calculations
|
||||
if ($ns < (3600+($timezone-1)*3600)) {
|
||||
$NZL_DST=1;
|
||||
} else {
|
||||
$NZL_DST=0;
|
||||
}
|
||||
} else { # local time calculations
|
||||
if ($ns < 3600) {
|
||||
$NZL_DST=1;
|
||||
} else {
|
||||
$NZL_DST=0;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$NZL_DST=0;
|
||||
}
|
||||
} elseif ($mm == 10) {
|
||||
if ($dd > 7) {
|
||||
$NZL_DST=1;
|
||||
} elseif ($dd >= ($dow+1)) {
|
||||
if ($timezone) {
|
||||
if ($dow == 0 and $ns < (7200+$timezone*3600)) {
|
||||
$NZL_DST=0;
|
||||
} else {
|
||||
$NZL_DST=1;
|
||||
}
|
||||
} else {
|
||||
if ($dow == 0 and $ns < 3600) {
|
||||
$NZL_DST=0;
|
||||
} else {
|
||||
$NZL_DST=1;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$NZL_DST=0;
|
||||
}
|
||||
} # end of month checks
|
||||
if ($DBX) {print " DST: $NZL_DST\n";}
|
||||
if ($NZL_DST) {$gmt_offset++;}
|
||||
$AC_processed++;
|
||||
}
|
||||
|
||||
if ( (!$AC_processed) and ($dst_range == 'LSS-FSA') )
|
||||
{
|
||||
if ($DBX) {print " "._QXZ("Last Sunday in September to First Sunday in April")."\n";}
|
||||
#**********************************************************************
|
||||
# LSS-FSA
|
||||
# 2007+ NEW ZEALAND (country code 64)
|
||||
# This is returns 1 if Daylight Savings Time is in effect and 0 if
|
||||
# Standard time is in effect.
|
||||
# Based on last Sunday in September and first Sunday in April at 1 am.
|
||||
#**********************************************************************
|
||||
|
||||
$NZLN_DST=0;
|
||||
$mm = $mon;
|
||||
$dd = $mday;
|
||||
$ns = $dsec;
|
||||
$dow= $wday;
|
||||
|
||||
if ($mm < 4 || $mm > 9) {
|
||||
$NZLN_DST=1;
|
||||
} elseif ($mm >= 5 && $mm <= 9) {
|
||||
$NZLN_DST=0;
|
||||
} elseif ($mm == 4) {
|
||||
if ($dd > 7) {
|
||||
$NZLN_DST=0;
|
||||
} elseif ($dd >= ($dow+1)) {
|
||||
if ($timezone) {
|
||||
if ($dow == 0 && $ns < (3600+$timezone*3600)) {
|
||||
$NZLN_DST=1;
|
||||
} else {
|
||||
$NZLN_DST=0;
|
||||
}
|
||||
} else {
|
||||
if ($dow == 0 && $ns < 7200) {
|
||||
$NZLN_DST=1;
|
||||
} else {
|
||||
$NZLN_DST=0;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$NZLN_DST=1;
|
||||
}
|
||||
} elseif ($mm == 9) {
|
||||
if ($dd < 25) {
|
||||
$NZLN_DST=0;
|
||||
} elseif ($dd < ($dow+25)) {
|
||||
$NZLN_DST=0;
|
||||
} elseif ($dow == 0) {
|
||||
if ($timezone) { # UTC calculations
|
||||
if ($ns < (3600+($timezone-1)*3600)) {
|
||||
$NZLN_DST=0;
|
||||
} else {
|
||||
$NZLN_DST=1;
|
||||
}
|
||||
} else { # local time calculations
|
||||
if ($ns < 3600) {
|
||||
$NZLN_DST=0;
|
||||
} else {
|
||||
$NZLN_DST=1;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$NZLN_DST=1;
|
||||
}
|
||||
} # end of month checks
|
||||
if ($DBX) {print " DST: $NZLN_DST\n";}
|
||||
if ($NZLN_DST) {$gmt_offset++;}
|
||||
$AC_processed++;
|
||||
}
|
||||
|
||||
if ( (!$AC_processed) and ($dst_range == 'TSO-LSF') )
|
||||
{
|
||||
if ($DBX) {print " "._QXZ("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 ($DBX) {print " "._QXZ("No DST Method Found")."\n";}
|
||||
if ($DBX) {print " DST: 0\n";}
|
||||
$AC_processed++;
|
||||
}
|
||||
|
||||
return $gmt_offset;
|
||||
}
|
||||
|
||||
|
||||
function mysql_to_mysqli($stmt, $link)
|
||||
{
|
||||
$rslt=mysqli_query($link, $stmt);
|
||||
|
||||
Reference in New Issue
Block a user