', $wbits);
$w30bits=explode('0', $wbits);
for ($iw=0; $iw<(-1 + sizeof($w30bits)); $iw+=1) { // used to be +=2
if (strpos($w30bits[$iw], " title=") !== false) {
$onebits=explode('', $w30bits[$iw]);
$suffixg="";
$suffixd="";
if (sizeof($onebits) > 1) {
//$preonebits=explode('"UTC', $w30bits[1 + $iw]);
$preonebits=explode('>', $w30bits[1 + $iw]);
if (strpos($onebits[-1 + sizeof($onebits)], ":3") !== false) $suffixg=".5";
if (strpos($preonebits[-1 + sizeof($preonebits)], ":3") !== false) $suffixd=".5";
$xdst=str_replace("−0", "-", str_replace("+", "", str_replace("+0", "", str_replace("-0", "-", str_replace(":0", "", str_replace(":3", "", $preonebits[-1 + sizeof($preonebits)])))))) . $suffixd;
$preonebits=explode('>', $onebits[-1 + sizeof($onebits)]);
$xgmt=str_replace("−0", "-", str_replace("+", "", str_replace("+0", "", str_replace("-0", "-", str_replace(":0", "", str_replace(":3", "", $preonebits[-1 + sizeof($preonebits)])))))) . $suffixg;
if (strpos($w30bits[1 + $iw], " title=") !== false) $xdst=$xgmt;
$preonebits=explode('>', $onebits[-2 + sizeof($onebits)]);
$vs=$preonebits[-1 + sizeof($preonebits)];
}
$onebits=explode('', $w30bits[$iw]);
if (sizeof($onebits) > 3) {
$preonebits=explode('>', $onebits[-4 + sizeof($onebits)]);
$latlong=$preonebits[-1 + sizeof($preonebits)];
if (strpos($vs, "°") === false) $overallextra .= "\n" . ' "TimeZoneId ' . $latlong . display_latlong($latlong, $vs) . '" : "' . str_replace("@%@/@%@", "-", $vs) . '", "DST" : "' . $xdst . '", "GMT" : "' . $xgmt . '" ';
}
}
}
file_put_contents("wbits.html", $overallextra);
$wcont=@file_get_contents("wbits.html");
}
return $wcont;
}
function display_latlong($inll, $vis) {
global $mapsuffix, $clickall, $toplace, $place;
$mapsplace=$vis;
$visbits=explode("/", $vis);
if (sizeof($visbits) == 3) {
$mapsplace=$visbits[2] . "/" . $visbits[1] . "/" . $visbits[0];
} else if (sizeof($visbits) > 1) {
$mapsplace=substr($vis, (strlen($visbits[0]) + 1)) . "/" . $visbits[0];
}
$outll=str_replace("~", "", str_replace("~ ", "", str_replace("+", " ", str_replace("-", " -", "~" . $inll))));
$obits=explode(" ", $outll);
if (sizeof($obits) != 2) return "";
$factor=1.0;
if (strpos($obits[0], "-") !== false) $factor=-1.0;
$latl=strlen(str_replace("-", "", $obits[0]));
$latis=0.0;
if ($latl >= 5) {
$latis+=substr($obits[0], strlen($obits[0]) - 2, 2) / 3600.0;
$latis+=substr($obits[0], strlen($obits[0]) - 4, 2) / 60.0;
$latis+=str_replace("-", "", substr($obits[0], 0, strlen($obits[0]) - 4));
$latis*=$factor;
} else if ($latl >= 3) {
$latis+=substr($obits[0], strlen($obits[0]) - 2, 2) / 60.0;
$latis+=str_replace("-", "", substr($obits[0], 0, strlen($obits[0]) - 2));
$latis*=$factor;
} else {
$latis+=str_replace("-", "", substr($obits[0], 0, strlen($obits[0]) - 0));
$latis*=$factor;
}
$factor=1.0;
if (strpos($obits[1], "-") !== false) $factor=-1.0;
$longl=strlen(str_replace("-", "", $obits[1]));
$longis=0.0;
if ($longl >= 6) {
$longis+=substr($obits[1], strlen($obits[1]) - 2, 2) / 3600.0;
$longis+=substr($obits[1], strlen($obits[1]) - 4, 2) / 60.0;
$longis+=str_replace("-", "", substr($obits[1], 0, strlen($obits[1]) - 4));
$longis*=$factor;
} else if ($longl >= 4) {
$longis+=substr($obits[1], strlen($obits) - 2, 2) / 60.0;
$longis+=str_replace("-", "", substr($obits[1], 0, strlen($obits[1]) - 2));
$longis*=$factor;
} else {
$longis+=str_replace("-", "", substr($obits[1], 0, strlen($obits[1]) - 0));
$longis*=$factor;
}
if ($place != "" && $toplace != "") {
return " ,[" . str_replace("3333333", "33", str_replace("6666667", "66", $latis)) . "," . str_replace("3333333", "33", str_replace("6666667", "66", $longis)) . str_replace("place1", str_replace(" ", "%20", $mapsplace), $mapsuffix) . str_replace(" ", "%20", $vis) . "~]";
} else {
return " ,[" . str_replace("3333333", "33", str_replace("6666667", "66", $latis)) . "," . str_replace("3333333", "33", str_replace("6666667", "66", $longis)) . ",~" . $vis . "~]";
}
}
if (isset($_GET['url'])) {
$prebits=explode("&", urldecode($_GET['url']));
$bits=explode("/", $prebits[0]);
$zonematch=str_replace("−", "-", $bits[-1 + sizeof($bits)]);
if (file_exists("wbits.html")) {
$acontobodyinnerHTML=@file_get_contents("wbits.html");
} else if (11 == 11) {
$acontobodyinnerHTML=dowbits();
} else {
if (file_exists("gmt" . $bits[-1 + sizeof($bits)] . ".xxx")) {
$acontobodyinnerHTML=@file_get_contents("gmt" . $bits[-1 + sizeof($bits)] . ".xxx");
} else if (file_exists("gmt1.xxx") && $bits[-1 + sizeof($bits)] == "") { // && ($region != "" || $place != "")) {
$acontobodyinnerHTML="";
foreach (glob("gmt*.xxx") as $filename) {
$ac=@file_get_contents($filename);
if (strpos($ac, " : ") !== false) $acontobodyinnerHTML.=$ac;
}
if (($region == "" && $place == "")) $place="-";
} else {
$acontobodyinnerHTML=@file_get_contents(urldecode($_GET['url']));
}
}
$datacnt=1;
$pretablebit="
";
$mapbit=""; //Optional Google Map May Go Below | ";
$tablestuff="Time Zone ID | Daylight Saving Time (Now) | Greenwich Mean Time(zone) | " . $mapbit . "
---|
";
$disp=true;
$stuff=explode(" : ", $acontobodyinnerHTML);
if (sizeof($stuff) > 1) {
for ($i=1; $i 1) {
$mapsplace=substr($tzi, (strlen($visbits[0]) + 1)) . "/" . $visbits[0];
}
$thistitle=",[" . str_replace('"', '', str_replace(",~", str_replace("place1", str_replace(" ", "%20", $mapsplace), $mapsuffix), $dqstuff[-1 + sizeof($dqstuff)]));
} else {
$thistitle=",[" . str_replace('"', '', $dqstuff[-1 + sizeof($dqstuff)]);
}
} else {
$thistitle=",[" . str_replace('"', '', substr($dqstuff[-1 + sizeof($dqstuff)], 0, strpos($dqstuff[-1 + sizeof($dqstuff)], ",%22A")) . ",~" . str_replace(" ", "%20", $tzi) . "~]");
}
}
$dqstuff=explode('"', $stuff[(1 + $i)]);
$dst=str_replace("−", "-", $dqstuff[1]);
$dqstuff=explode('"', $stuff[(2 + $i)]);
$gmt=str_replace("−", "-", $dqstuff[1]);
$disp=true;
$okay=true;
$timestamp = time();
if ($zonematch != "") {
if (strpos(("~" . $gmt . "."), "~" . $zonematch . ".") === false) $disp=false;
}
if ($region != "") {
if (strpos(("~" . $tzi), "~" . $region . "-") === false && strpos(("~" . $tzi), "~" . $region . "/") === false) $disp=false;
}
if ($place != "" && $toplace != "") {
$clickall=' class="onload" ';
if (strpos(strtolower(str_replace("_", " ", $tzi)), strtolower(str_replace("_", " ", $place))) === false && strpos(strtolower(str_replace("_", " ", $tzi)), strtolower(str_replace("_", " ", $toplace))) === false) $disp=false;
} else if ($place != "") {
if (strpos(strtolower(str_replace("_", " ", $tzi)), strtolower(str_replace("_", " ", $place))) === false) $disp=false;
} else if ($toplace != "") {
if (strpos(strtolower(str_replace("_", " ", $tzi)), strtolower(str_replace("_", " ", $toplace))) === false) $disp=false;
}
if ($disp) {
// Thanks to http://stackoverflow.com/questions/851574/how-do-i-get-greenwich-mean-time-in-php
$okay = date_default_timezone_set(str_replace("-", "/", $tzi));
$dr = date('r', $timestamp);
$drs = explode(" +", str_replace("+0", "+", str_replace("30", ".5", str_replace("00", "", str_replace("000", "0", $dr)))));
if (sizeof($drs) == 1) {
$drs = explode(" -", str_replace("-0", "-", str_replace("30", ".5", str_replace("00", "", str_replace("000", "0", $dr)))));
if (sizeof($drs) == 2) $drs[1]="-" . $drs[1];
}
if (sizeof($drs) == 2) {
if ($drs[1] == "") $drs[1] = "0";
}
if (!$okay && $firstgood != "") {
$dst = $gmt;
$dr = $firstgood;
}
if ($okay && sizeof($drs) == 2) $dst = $drs[1];
if ($dst != $gmt) {
//if ($okay && sizeof($drs) == 2) $dst = $drs[1];
$datacnt++;
//$tablestuff=str_replace("", "" . $tzi . " | " . $dst . " (" . $dr . ") | " . $gmt . " | " . $formbit . "
", $tablestuff);
if ($datacnt >= 3 && $clickall != "" && strpos(strtolower(str_replace("_", " ", $tzi)), strtolower(str_replace("_", " ", $place))) !== false) {
$tablestuff=str_replace("", "" . $tzi . " | " . $dst . " (" . $dr . ") | " . $gmt . " |
", $tablestuff);
} else {
$tablestuff=str_replace("", "" . $tzi . " | " . $dst . " (" . $dr . ") | " . $gmt . " |
" . $formbit . $posttablebit, $tablestuff);
}
$tablestuff=str_replace("= 3 && $clickall != "" && strpos(strtolower(str_replace("_", " ", $tzi)), strtolower(str_replace("_", " ", $place))) !== false) {
$tablestuff=str_replace("", "" . $tzi . " | " . $dst . " (" . $dr . ") | " . $gmt . " |
", $tablestuff);
} else {
$tablestuff=str_replace("
", "" . $tzi . " | " . $dst . " (" . $dr . ") | " . $gmt . " |
" . $formbit . $posttablebit, $tablestuff);
}
$tablestuff=str_replace(" var rt="' . str_replace("+", " ", urlencode(str_replace(" rowspan=1 ", " rowspan=" . $datacnt . " ", $tablestuff))) . '";