Humanitarian OpenStreetMap Team Documentation : http://pierzen.dev.openstreetmap.org/hot/monitor-map/ This is the first version of the project. Documentation to come later. ------------------------------------------------------------------> */ // protection against xss attack if(isset($_GET[rss])){ // Site Protection : convert to numeric $_GET[rss]=intval($_GET[rss]); } else { $_GET[rss] = 1; } // default value; if (!in_array($_GET[rss], array(1, 2,))) { $_GET[rss]=1;} // Gdoc_csv files to read to read switch($_GET[rss]) { case 1: // Master Registry (Gdoc Spreadheet) $gdoc_csv="https://docs.google.com/spreadsheet/pub?hl=en_US&hl=en_US&key=&single=true&gid=&output=txt"; break; case 2: // Newly added records Registry (Gdoc Spreadheet) $gdoc_csv="https://docs.google.com/spreadsheet/pub?hl=en_US&hl=en_US&key=&single=true&gid=&output=txt"; break; default: $_GET[rss] = 1; // Master Registry (Gdoc Spreadheet) $gdoc_csv="https://docs.google.com/spreadsheet/pub?hl=en_US&hl=en_US&key=&single=true&gid=&output=txt"; break; } //header georss echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo " Libya Health Facilities Registry\n"; echo " http://samoa.standbytaskforce.com/\n"; echo " Wed, 28 Dec 2011 19:30:00 GMT\n"; echo "Geolocalisation of Libya Health Facilities, GDoc worksheet work in progress live feed\n"; echo "SBTF and HOT-OSM teams\n"; echo "\n"; // read line $arrResult = array(); $arrLines = file("$gdoc_csv"); //echo "

Test RSS Feed

"; $nblines=0; /* Array ( [0] => [1] => FACILITY NAME [2] => FACILITY NAME (translated) * only those with a working knowledge of Arabic insert translations pls [3] => TYPE [4] => HF ADDRESS [5] => SHABIA or CITY (For Reference) [6] => LATITUDE [7] => LONGITUDE [8] => LICENSE/Origin [9] => CONTACT/PHONE NUMBER [10] => Comment origin [11] => Other comments ) )*/ foreach($arrLines as $line) { if (!get_magic_quotes_gpc()) { $line = addslashes($line); } $col = explode( "\t", $line); // rss 2 : for columns to correspond with other files // column 2 timestamp is eliminated but moved in HF unique ID variable if ($_GET[rss] == 2) { for ($ic = 1; $ic < 17; $ic++) { if (isset($col[$ic])) { $prev_ic=$ic-1; $col[($prev_ic)]=trim($col[$ic]); } } $col[0]="N ".trim($col[0]); // echo "\nCols"; // print_r($col); } // ger-rss==2 $nbcols=sizeof($col); $nblines=$nblines+1; /* // firebug console if ($i<=3) { $txt=print_r($col); FB::log("$txt");} */ // process line 3 +, if latitude indicated if ($nblines>=3 && $col[8]<>"") { // vars $hf_id = $col[0]; $facility_name_en = $col[1]; $facility_name_ar = $col[2]; // echo "debug : $nblines $facility_name_en $facility_name_ar
\n" ; If ($facility_name_en <> "" && $facility_name_ar <> "") { $facility_name = $facility_name_en . "
\n" . $facility_name_ar;} else If ($facility_name_en <> "") { $facility_name = $facility_name_en;} else If ($facility_name_ar <> "") { $facility_name = $facility_name_ar;} else $facility_name = ""; $facility_sector = $col[3]; $facility_type = $col[4]; // 5 health facility comments $hf_address = $col[6]; $shabia_city = $col[7]; $lat = $col[8]; $lon = $col[9]; $license = $col[10]; $contact = $col[11]; If ($contact == "0") {$contact = "";} if ($col[12]) {$comment_origin = $col[12];} else {$comment_origin ="";} if ($col[13]) {$comment_other = $col[13];} else {$comment_other ="";} echo "\n"; echo " <![CDATA[" . $facility_name . "]]>\n"; $georss_desc = " HF Id: " . $hf_id . " \n
Type: " . $facility_type . "
\n
Sector: " . $facility_sector . "
\n"; if (!empty($hf_address)) { $georss_desc = $georss_desc ."
Address: ". $hf_address . "
\n";} if (!empty($shabia_city)) { $georss_desc = $georss_desc . "
City: " . $shabia_city . "
\n";} if (!empty($georss_desc)) { $georss_desc = $georss_desc . "
\n";} if (!empty($license)) { $georss_desc = $georss_desc . "
License: " . $license . "
\n";} if (!empty($contact)) { $georss_desc = $georss_desc . "
Contact: " . $contact . "
\n";} if (!empty($comment_origin)) { $georss_desc = $georss_desc . "
Comment: " . $comment_origin . "
\n";} if (!empty($comment_other)) { $georss_desc = $georss_desc . "
Other: " . $comment_other . "
\n";} echo $georss_desc . "]]>
\n"; echo " ". Date("l F d, Y") . "\n"; echo " " . $lat . " " . $lon . "\n"; echo "
\n"; } // $nblines } // $line echo "
"; echo "
"; ?>