feedback
"; $earlierdatecode=""; $laterdatecode=""; $testdatecode=$datecode; $i=0; $todaydatecode=todaydatecode(); while ($earlierdatecode=="" and $i<50) { $testdatecode=earlierday ($testdatecode); //echo $testearlierdatecode . " "; if (doesentryexist($testdatecode)) { $earlierdatecode=$testdatecode; } $i++; //echo $i; } $displaydata.="previous | "; $i=0; $testdatecode=$datecode; while ($laterdatecode=="" and $i<50 and ($laterdatecode<=$todaydatecode)) { //echo $testdatecode . " " . laterday ($testdatecode) . "
"; $testdatecode=laterday ($testdatecode); if (doesentryexist($testdatecode)) { $laterdatecode=$testdatecode; } $i++; //echo $i; } if ($laterdatecode!="") { $displaydata.="next "; } else { $displaydata.=" the future"; } $displaydata.= ""; return $displaydata; } function asecularcalendar($datecode, $day_name_length = 3, $month_href = NULL, $first_day = 0) { global $rootFile; $style="littlenav"; $cellbgcolor="ffcc99"; if ($datecode=="" or $datecode=="_") { $datecode=todaydatecode(); } $datearray=getdate(makedate($datecode)); $month=$datearray["mon"]; $year=$datearray["year"]; $todaydatecode=$datecode; //echo $month . " " . $year; $first_of_month = gmmktime(0,0,0,$month,1,$year); $day_names = array(); #generate all the day names according to the current locale for($n=0,$t=(3+$first_day)*86400; $n<7; $n++,$t+=86400) #January 4, 1970 was a Sunday { $day_names[$n] = ucfirst(gmstrftime('%A',$t)); #%A means full textual day name } list($month, $year, $month_name, $weekday) = explode(',',gmstrftime('%m,%Y,%B,%w',$first_of_month)); $weekday = ($weekday + 7 - $first_day) % 7; #adjust for $first_day $title = htmlentities(ucfirst($month_name)).' '.$year; #note that some locales don't capitalize month and day names $out = ''; $out .= '\n"; $out .= ""; $row=0; if($day_name_length){ #if the day names should be shown ($day_name_length > 0) #if day_name_length is >3, the full name of the day will be printed foreach($day_names as $d) { $out .= ''; } $out .= "\n"; } if ($weekday > 0) $out .= ''; #initial 'empty' days for($day=1,$days_in_month=gmdate('t',$first_of_month); $day<=$days_in_month; $day++,$weekday++) { if($weekday == 7) { $weekday = 0; #start a new week $out .= "\n"; $row++; } $datecode=substr($year,2,2) . str_pad($month, 2, '0', STR_PAD_LEFT). str_pad($day, 2, '0', STR_PAD_LEFT); $url=datecodetourl($datecode); //echo (file_exists($url) and strpos($url, "#")<1 . "
"); if ( file_exists($url) and strpos($url, "#")<1) { $link="" . $rootFile . "?" . $datecode; $content = $day; $out .= ''; } else $out .= ""; } if ($weekday != 7) $out .= ''; #remaining "empty" days $out.="\n"; //echo $row; if ($row<5) { $out.="\n"; #keep all calendars the same height to help with rapid nav } $out.="
' . ($month_href ? ''.$title.'' : $title). "
'.htmlentities($day_name_length < 4 ? substr($d,0,$day_name_length) : $d).'
 
' : '>'). ($link ? ''.$content.'' : $content).'$day 
 
\n"; $out.="
"; $out.=asecularmonthnav($datecode); $out.= asecularyearnav($datecode); $out.="
"; return $out; } function asecularmonthnav($datecode) { global $rootFile; $style="littlenav"; $out=""; $todaydatecode=$datecode; $thisitemmonthname=datecodetomonthname($todaydatecode); $earliermonth=earliermonthcode($datecode) . "01" ; $latermonth=latermonthcode($datecode) . "01"; $prevmonthname=substr(datecodetomonthname($earliermonth),0,3); $nextmonthname=substr(datecodetomonthname($latermonth),0,3); $out.= "" . $prevmonthname . ""; $out.= " | " . $thisitemmonthname . ""; if ($latermonth < todaydatecode() or $latermonth>"960101" ) { $out.= " | " . $nextmonthname . ""; } else { $out.= " | " . $nextmonthname . ""; } return $out; } function asecularrss($intNumber, $intNumberOfDescriptions) //return a display of $intNumber recent REA articles, the first $intNumberOfDescriptions presented with descriptions as well { global $rootFile; global $rootDir; $todaydatecode=todaydatecode(); $count=0; $poo=0; $out="" . chr(13) . chr(10); $out.="" . chr(13) . chr(10); $out.="asecular.com" . chr(13) . chr(10); $out.="http://asecular.com" . chr(13) . chr(10); $out.="Your leaking thatched hut during the dismantlement of post-Enlightenment society." . chr(13) . chr(10); $out.="en-us" . chr(13) . chr(10); while ($count<$intNumber && $poo<70) { $partialurl=datecodetourl($todaydatecode); $url= $partialurl; //echo $url; if (file_exists($url) and $partialurl!="") { $handle=fopen ($url, "r"); $content=fread($handle, filesize($url)); //echo $url; //echo $content; fclose($handle); $title=parseRanTitle($content); if (substr($title, 0, 1)!="*") //do not show asterisk-preceded titles { if ($intNumberOfDescriptions>0) { if (strpos($content, "")>0) { $out.="" . chr(13) . chr(10); $out.="" . filterHTML($title) . "" . chr(13) . chr(10); $out.="http://asecular.com/" . $rootFile . "?" . $todaydatecode . "." . chr(13) . chr(10); $out.="" . date("m/d/y", makedate($todaydatecode)) . "" . chr(13) . chr(10); $out.="" . filterHTML(parseRanDescription($content)) . "" . chr(13) . chr(10); $out.="Judas Gutenberg" . chr(13) . chr(10); $upper=substr($todaydatecode, 0, 4); $body=parseAsecularContent($content, "a img", "href src", $rootDir . $upper . "/"); $body=str_replace("&", "&", $body); $body=str_replace("\"", """, $body); //$out.="" .filterHTML($body) . "" . chr(13) . chr(10); $out.="" . chr(13) . chr(10); $intNumberOfDescriptions--; } } else { $out=$out . "
"; } } $count++; } $todaydatecode=earlierday($todaydatecode); $poo++; } $out.="
" . chr(13) . chr(10); $out.="
" . chr(13) . chr(10); return($out); } function asecularRawData($todaydatecode) { $partialurl=datecodetourl($todaydatecode); $url= $partialurl; if (file_exists($url) and $partialurl!="") { $handle=fopen ($url, "r"); $content=fread($handle, filesize($url)); fclose($handle); } //$content=str_replace("
", "
" , $content); $unicode = json_decode("\ufffd") ; $content = str_replace($unicode, " ", $content); return($content); } function eliminateHidden($in) { $strBegin = ""; $beginCommentTagLoc = strpos($in, $strBegin); while($beginCommentTagLoc !== false) { $foundCrap = parseBetween($in, $strBegin, $strEnd); $in = str_replace($strBegin . $foundCrap . $strEnd, "[REDACTED]", $in); $beginCommentTagLoc = strpos($in, "", $strSearch); $intPos=strpos($strSearch, "/".$strTag); } } } return $strSearch; } function defeed($strIn) //no linefeeds in $strIn! { $strOut=$strIn; $strOut=str_replace(chr(10), "", $strOut); $strOut=str_replace(chr(13), "", $strOut); return($strOut); } //i needed this because the Spies.com PHP parser is kinda oldschool if (!function_exists("ob_get_clean")) { function ob_get_clean() { $ob_contents = ob_get_contents(); ob_end_clean(); return $ob_contents; } } function stringprefix($strIn, $strPrefix) //adds a prefix to quoted strings that look like URLs found within $strIn { $strEndingList="swf htm php jpg gif"; $intCursor=0; $intEndCursor=1; $bwlNotDone=true; $strOut=$strIn; $intCount=0; while($intEndCursor>0 and $intCount<12000 and $bwlNotDone) { $intCursor=strpos($strIn, chr(34), $intCursor); $intEndCursor=strpos($strIn, chr(34), $intCursor+1); $strThisQuotedString=substr($strIn, $intCursor +1, $intEndCursor-$intCursor-1); if ($intCursor) { if (substr($strThisQuotedString, strlen($strThisQuotedString)-4,1)==".") { if (inList($strEndingList, substr($strThisQuotedString, strlen($strThisQuotedString)-3, strlen($strThisQuotedString)))) { if (substr($strThisQuotedString, 0 , strlen($strPrefix))!=$strPrefix) { $strOut=str_replace($strThisQuotedString, $strPrefix.$strThisQuotedString,$strOut); } } } } else { $bwlNotDone=false; } $intCursor=$intEndCursor+1; $intCount++; } return($strOut); } function tagHREFprefixer($strIn, $strTagList, $strParameterList, $strPrefix) //scans through HTML in $strIn and appends $strPrefix to URL parameters in space-delimited $strParameterList list in tags named in space-delimited $strTagList //this is great for cases where you are dealing with the display of the same cluttered HTML file viewed from several different depths in a website directory { global $rootFile; $arrParamList = explode(" ", $strParameterList); $modifiedUrls = []; // Initialize an array to track modified URLs $intCursor=0; $intEndCursor=1; $intCount=0; $bwlNotDone=true; $strBadBegins="/ ! $"; $strOut=$strIn; //$strOut=str_replace("", "--~", $strOut); while($intEndCursor>0 and $intCount<3933 and $bwlNotDone) { $intCursor=strpos($strIn, "<", $intCursor); $intEndCursor=strpos($strIn, ">", $intCursor); //echo $intCursor . "!"; if ($intCursor>-1) { $strThisTag=substr($strIn, $intCursor +1, $intEndCursor-$intCursor-1); $strFullTag=substr($strIn, $intCursor , 1+$intEndCursor-$intCursor); //$excerpt=substr($strIn, $intCursor +1, strlen($strIn)); //handle embedded PHP on the fly WOO HOO! if (substr($strThisTag, 0, 1)=="?") { $strThisTagMod=substr($strThisTag, 1, strlen($strThisTag)-2); if (substr($strThisTagMod, 0 , 7)!="include") { $strThisTagMod=stringprefix($strThisTagMod, $strPrefix); ob_start(); eval($strThisTagMod . ";"); $strThis = ob_get_clean(); $strOut=str_replace($strFullTag, $strThis, $strOut); } } else if (!inList($strBadBegins, substr($strThisTag, 0, 1)))//not interested in end tags or comments { //echo $strThisTag . "
"; $arrThis=parameterarray($strThisTag); if (count($arrThis)>1) { if (inList($strTagList, $arrThis[0])) { for($t=1; $t"; $arrItem[1]=RemoveEndCharactersIfMatch($arrItem[1], "\""); $arrItem[1]=RemoveEndCharactersIfMatch($arrItem[1], "'"); //echo $strParameterList . " ." . $arrItem[1] . ".
"; $cleanedParam = removebalancedendquotes($arrItem[1]); if (!isset($modifiedUrls[$strPrefix . $cleanedParam ])) { //if (inList($strParameterList,$arrItem[0])) foreach($arrParamList as $param) { //echo("*" . $param . "%"); //echo strtolower(substr($arrItem[1], 0, 6)) . "
"; if ( trim(strtolower(substr($arrItem[1], 0, 6)))=="https:" || strtolower(substr($arrItem[1], 0, 5))=="http:" || substr($arrItem[1], 0, 1)=="#") { //echo "!
"; } else { //this is kind of ponderous i know //echo "$
"; //echo $arrItem[1]; $strThisParameter=removebalancedendquotes($arrItem[1]); //echo $strThisParameter . "
"; //echo substr($strThisParameter, 0 , 10) . "
"; //echo substr($strThisParameter, 0 , 1); //echo $strThisParameter . "
"; if (substr($strThisParameter, 0 , strlen($strPrefix))!=$strPrefix && substr($strThisParameter, 0 , 1)!="#" && substr($strThisParameter, 0 , 10)!="javascript") { //echo $strThisParameter, $strPrefix . $strThisParameter . "
"; //echo $strThisParameter . "*" . "
"; //echo "|" . $param . "=" .$strPrefix . str_replace($strThisParameter, "\"", "") . "=|
"; //echo $strThisParameter . "=" . findCharacterBeforeString($strOut, $strThisParameter) ; $precedingChar = findCharacterBeforeString($strOut, $strThisParameter); if($precedingChar == '"' || $precedingChar == '' ){ //echo "*1" . $precedingChar . "*" . $strThisParameter; //echo "#" . $param . "=" . $strThisParameter . '"'; //echo "
"; $len = strlen($strOut); $strOut = str_replace($param . "=\"" . $strThisParameter . '"', $param . "=\"" .$strPrefix . str_replace("\"", "", $strThisParameter) . '"', $strOut); if( strpos($strOut, $param . "=\"" . $strPrefix . str_replace("\"", "", $strThisParameter)) === false){ $strOut=str_replace($param . "=" . $strThisParameter . '"', $param . "=\"" .$strPrefix . str_replace("\"", "", $strThisParameter), $strOut); } } else if($precedingChar == '='){ //echo $strThisParameter . "X!X"; $strOut=str_replace($param . "=" . $strThisParameter, $param . "=" .$strPrefix . str_replace("\"", "", $strThisParameter), $strOut); } else if($precedingChar == "'"){ //echo $strThisParameter . "X!X"; $strOut=str_replace($param . "='" . $strThisParameter . "'", $param . "='" .$strPrefix . str_replace("\"", "", $strThisParameter) . "'", $strOut); } else { //echo "*2" . $precedingChar . "*" . $strThisParameter; } //echo "
"; if(findCharacterBeforeString($strOut, $strThisParameter) == "'"){ //$strOut=str_replace($param . "=" . $strThisParameter . "'", $param . "=\"" .$strPrefix . str_replace("'", "", $strThisParameter), $strOut); } } } } } $modifiedUrls[$strPrefix . $cleanedParam ] = "1"; } } } } } } else { $bwlNotDone=false; } if (intval($intCursor) 0) { return $haystack[$position - 1]; } else { // There is no character before the needle (it's at the beginning) return false; } } function tagName($strThisTag) { //returns the name of an XML tag, assuming no < or > $intSpaceLocation=strpos($strThisTag, " "); if (!$intSpaceLocation) { $intSpaceLocation=strlen($strThisTag); } $strThisTagName=substr($strThisTag, 0, $intSpaceLocation); return($strThisTagName); } function parameterarray($strThisTag) //returns an array of a parameter pairs from a tag //warning- doesn't handle spaces in parameter yet!! { $arrOut=array(); $intSpaceLocation=1; $intCursor=0; $intCount=0; $bwlNotDone=true; while($intSpaceLocation>0 and $intCount<500 and $bwlNotDone) { $intSpaceLocation=strpos($strThisTag, " ", $intCursor); if (!$intSpaceLocation) { $intSpaceLocation=strlen($strThisTag); $bwlNotDone=false; } $strThisParameterPair=substr($strThisTag, $intCursor, $intSpaceLocation-$intCursor); if ($strThisParameterPair!="") { $arrOut[]=$strThisParameterPair; } $intCursor= $intSpaceLocation+1; $intCount++; } return($arrOut); } function inList($strList, $item) //look to see if item is in the space-delimited strList (similar to my ASP version) { $arrThis=explode(' ', $strList); for ($t=0; $ttime() || $bwlDontExpire) //if not expired { $handle=fopen ($url, "r"); $content=fread($handle, filesize($url)); fclose($handle); } } return($content); } function filewritecache($strKey, $strIn) //write $strIn to the filesystem cache under the key $strKey { $url="cache/" . $strKey . ".htm"; $handle=fopen ($url, "w"); $content=fwrite($handle, $strIn); fclose($handle); } function logEmail($strEmail) //write $strIn to the filesystem cache under the key $strKey { $url="emails_for_gus_x.txt"; $handle=fopen ($url, "a"); $content=fwrite($handle, $strEmail); fclose($handle); } function calculateexpiration($datecode) //intelligently give me a cache expiration in days based on the $datecode of the content - in this case i use a period a third of the content's age. { $date = makedate($datecode); $diff = time()-$date; $daysDiff = floor($diff/60/60/24); $intOut=floor($daysDiff/3); return($intOut); } function deMultiple($strIn, $chrIn) //remove multiple side-by-side instances of $chrIn - works best for things like spaces and chr(13) { $strOut=$strIn; while(strpos($strOut, $chrIn . $chrIn)) { $strOut = str_replace( $chrIn . $chrIn, $chrIn, $strOut); } return($strOut); } function filterHTML($strIn) //remove all HTML tags in $strIn. Works best if the tags are complete. { //return(strip_tags($strIn)); $strTemp = $strIn; $i=0; while (!(strpos($strTemp,"<")===false) and !(strpos($strTemp, ">")===false) and $i<50) { $strTemp = substr($strTemp, 0, strpos($strTemp, "<",0)) . " " . substr($strTemp, 1+strpos($strTemp, ">",0),strlen($strTemp)-strpos($strTemp, ">",0)); $i++; } return ($strTemp); } function TruncateString($strIn, $intVal) //make $strIn only $intVal long { if (strlen($strIn)>$intVal) { $strOut=substr($strIn, 0, $intVal . "..."); } else { $strOut= $strIn; } return($strOut); } function ProperNounList($strIn, $strFilter="") { $strIn=filterHTML($strIn); //echo $strIn . "
"; //December 11, revised Dec 28 2003 //extracts proper nouns that are not at the beginning of sentences. //based on a version I wrote in ASP that worked poorly. //$strFilter contains a space-delimited list of words to /not/ include in generated lists. $strFilter.=" I Gretchen My Mine Our Today Email Feedback Monday Tuesday Wednesday Thursday Friday Saturday Sunday January February March April May June July August September October November December May Jun Jul Aug Sep Oct Nov Dec Jan Feb Mar Apr Hurley Woodstock Kingston Thanksgiving Christmas Halloween Easter Passover Chaunuka Hanukah"; $strIn=str_replace(chr(10), " ", $strIn); $strIn=str_replace(chr(13), " ", $strIn); $strIn=str_replace("

", " ", $strIn); if (strLen($strIn)>250) { $strIn=deMultiple($strIn, " "); $strThisFilter=""; $strWord=""; $bwlBeginSentenceMode=true; $bwlGoodWordMode=false; $strOut=""; //$strIn=TruncateString($strIn,2000); $count=0; if ($strIn!="") { for ($i=0; strlen($strIn)>$i and $count<5000; $i++) { $count++; $chrThis=substr($strIn, $i, 1); $intASC=ord($chrThis); if ($intASC>64 and $intASC<91 or $intASC>96 and $intASC<123 or $intASC==32 or $intASC>47 and $intASC<58 or inList(". ! ? - (", $chrThis))//useful character { } else { $chrThis=" "; } if (inList(". ! ? - (", $chrThis)) { $bwlBeginSentenceMode=true; $bwlGoodWordMode=false; } if (!$bwlBeginSentenceMode) { if ($intASC>64 and $intASC<91) { $bwlGoodWordMode=true; } if ($bwlGoodWordMode) { if (!(inList(". ! ? , - (", $chrThis) or $chrThis==" ")) { $strWord=$strWord . $chrThis; } else { $bwlGoodWordMode=false; if (!inList($strFilter, $strWord) && !inList($strThisFilter, $strWord)) { $strOut=$strOut . " " . $strWord; $strThisFilter=$strThisFilter . " " . $strWord . " " . $strWord . "s" . " " . $strWord . "es" . " " . $strWord. "ed" . " " . $strWord . "ing"; //$strFilter.=" " . $strWord;//just added this aug 6 2011 to make words only appear once. } $strWord=""; } } } else if (($intASC>64 and $intASC<91 ) and $intASC!=32) { $bwlBeginSentenceMode=false; if (!inList($strFilter, $strWord) and !inList($strThisFilter, $strWord)) { if(!is_int($strWord)) { $strOut=$strOut . " " . $strWord; } $strThisFilter=$strThisFilter . " " . $strWord . " " . $strWord . "s" . " " . $strWord . "es" . " " . $strWord. "ed" . " " . $strWord . "ing"; //$strFilter.=" " . $strWord ;//just added this aug 6 2011 to make words only appear once. } $strWord=""; } } } } else { $strOut=$strIn; } return($strOut); } function textinfo($strInOriginal, $infotype, $intParameterOne, $intParameterOne) //give a text of $strInOriginal, return various forms of info based on $infotype (see below for the various infotypes) //for $infotype, you can pass in a range with $intParameterOne the floor and $intParameterOne the ceiling //saying what sized words you want considered in the data returned. { $intSum=0; $count=0; $strOut=""; $strUniqueWordList=""; $arrWords=array(); $strIn=filterHTML($strInOriginal); $strIn=deMultiple($strIn, " "); $strIn=strtolower($strIn); for ($i=0; strlen($strIn)>$i; $i++) { $chrThis=substr($strIn, $i, 1); $intASC=ord($chrThis); if ($intASC>64 and $intASC<91 or $intASC>96 and $intASC<123 or $intASC==32 or $intASC>47 and $intASC<58 ) { } else { $chrThis=" "; } $strOut=$strOut . $chrThis; } //echo($strOut); $arrThis=explode(" ", $strOut); foreach($arrThis as $strThis) { $intThisLen=strlen($strThis); if ($intThisLen>0) { if (!inList($strUniqueWordList, $strThis)) { $strUniqueWordList=$strUniqueWordList . " " . $strThis; $arrWords[$strThis]=1; } else { $arrWords[$strThis]++; } $intSum=$intSum + $intThisLen; $count++; } } $intAverage=$intSum/$count; arsort($arrWords); if ($infotype==0) { return($intAverage); } else if ($infotype==1) //number of words { return($count); } else if ($infotype==2) //list of unique words as they happened { return($strUniqueWordList); } else if ($infotype==3) { return(count($arrWords));//number of unique words } else if ($infotype==4) //list all unique words in order of number of times they were used, smallest to greatest { $strOut=""; foreach($arrWords as $key => $value) { $strOut=$strOut. " " . $key; } return($strOut); } else if ($infotype==5) //list all unique words with the number of times they occurred { $strOut=""; foreach($arrWords as $key => $value) { if ($value>$intParameterOne and $value<$intParametertwo) { $strOut=$strOut. " " . $key . " " . $value; } } return($strOut); } } function day($datein) { $datearray=getdate($datein); //$dayoftheweek=$datearray["weekday"]; //$year=$datearray["year"]; //$month=$datearray["month"]; $day=$datearray["mday"]; return $day; } function month($datein) { $datearray=getdate($datein); //$dayoftheweek=$datearray["weekday"]; //$year=$datearray["year"]; $month=$datearray["mon"]; //$day=$datearray["mday"]; return $month; } function year($datein) { $datearray=getdate($datein); //$dayoftheweek=$datearray["weekday"]; $year=$datearray["year"]; //$month=$datearray["month"]; //$day=$datearray["mday"]; return $year; } function weekday($datein) { $datearray=getdate($datein); $dayoftheweek=$datearray["wday"]; //$year=$datearray["year"]; //$month=$datearray["month"]; //$day=$datearray["mday"]; return $dayoftheweek; } function monthname($datein) { $datearray=getdate($datein); //$dayoftheweek=$datearray["weekday"]; //$year=$datearray["year"]; $month=$datearray["month"]; //$day=$datearray["mday"]; return $month; } function beginswith($strIn, $what) { if (substr($strIn,0, strlen($what))==$what) { return true; } return false; } function contains($strIn, $what) { if (strpos(" " . $strIn, $what)>0) { return true; } return false; } function gracefuldecay() { //go through the parameters and return the first that isn't empty $intArgs =func_num_args(); for($i=0; $i<$intArgs; $i++) { $option=func_get_arg($i); if ($option!="") { return $option; } } } function RemoveLastCharacterIfMatch($strIn, $chrIn) { $out=$strIn; if (substr($strIn, strlen($strIn)-1, 1) ==$chrIn) { $out= substr($strIn, 0, strlen($strIn)-1); } return $out; } function RemoveFirstCharacterIfMatch($strIn, $chrIn) { $out=$strIn; //echo substr($strIn, 0, 1) . "
"; if (substr($strIn, 0, 1) ==$chrIn) { $out= substr($strIn, 1); } return $out; } function RemoveEndCharactersIfMatch($strIn, $chrIn) { $out= RemoveFirstCharacterIfMatch($strIn, $chrIn); $out= RemoveLastCharacterIfMatch($out, $chrIn); return $out; } function SingleQuoteEscape($strIn) { $out= str_replace("'", "\'", $strIn); return $out; } function todegs($v) { if (contains($v, " ")) { $v=deMultiple($v, " "); $v=RemoveEndCharactersIfMatch($v, " "); $arrDegs=explode(" ", $v); $deg=$arrDegs[0]; $mins=$arrDegs[1]; $secs=$arrDegs[2]; $v=intval($deg) + intval($mins)/60 + intval($secs)/3600; } $v=RemoveEndCharactersIfMatch($v, "-"); if (contains($v, "-")) { $arrDegs=explode("-", $v); $deg=$arrDegs[0]; $mins=$arrDegs[1]; $secs=$arrDegs[2]; $v=intval($deg) + intval($mins)/60 + intval($secs)/3600; } if ($v>60) { //force northern western hemisphere $v=-$v; } return $v; } function GoogleMapper($strData, $latcenter="41.930996", $loncenter="-74.107462", $scale=16, $width=450, $height=450, $bwlShowHouse=true, $bwlShowTrailSystem=true) { GLOBAL $serverroot; $out="

\n"; $out.=""; $out.=""; return $out; } function ReadAndAddTrack($objname, $urlofdata) { //returns the javascript to draw a track on a google map from a file of return/comma delimited coordinates //in the form color_of_track[return]lat,lon[return]lat,lon[return]lat,lon[return]lat,lon[return]etc... $out=""; $out.="var points = new Array();\n"; $i=0; if (file_exists($urlofdata)) { $handle=fopen ($urlofdata, "r"); $content=fread($handle, filesize($urlofdata)); $content=configstringclean($content); $arrData=explode(chr(10), $content); $color=$arrData[0]; foreach($arrData as $thisdata) { $subdata=explode(",", $thisdata); if(count($subdata)>1) { $out.="points[" . $i . "] = new GPoint(" . $subdata[1] . "," . $subdata[0] . ");\n"; } else if (count($subdata)==1) //allows us to put several tracks in one file { $out.="var trail = new GPolyline(points, '#" .$color . "', 1, 1);\n"; $out.= $objname . ".addOverlay(trail);\n\n"; $out.="var points = new Array();\n"; $i=0; $color=$subdata[0]; } $i++; } if(trim($color)!="") { $out.="var trail = new GPolyline(points, '#" .$color . "', 1, 1);\n"; $out."trail.geodesic=true;\n"; $out.= $objname . ".addOverlay(trail);\n\n"; } } return $out; } function configstringclean($strIn) { $out=$strIn; $out=str_replace(chr(13), chr(10), $out); $out=deMultiple($out, chr(10)); $out=RemoveEndCharactersIfMatch($out,chr(10)); return $out; } function PolyLineMap($arrData, $longcenter=-74.107214, $latcenter=41.930866, $scale=14) { //global $urlbasis; $out=""; $patchcount=0; $mapheader=" \n"; $out=$mapheader . $out; $out.="
"; $out.="\n"; return $out; } ?>