davemds pushed a commit to branch master. http://git.enlightenment.org/website/www.git/commit/?id=c0bbfc58d02c4e24d9eb10a6ccec2dc54de4ac21
commit c0bbfc58d02c4e24d9eb10a6ccec2dc54de4ac21 Author: davemds <[email protected]> Date: Tue Nov 5 00:29:31 2013 +0100 This should fix the devs map --- public_html/p/contact/devsmap/en-body | 69 ++++++++++------------------------- 1 file changed, 20 insertions(+), 49 deletions(-) diff --git a/public_html/p/contact/devsmap/en-body b/public_html/p/contact/devsmap/en-body index 9b63b6a..0f53920 100644 --- a/public_html/p/contact/devsmap/en-body +++ b/public_html/p/contact/devsmap/en-body @@ -1,16 +1,9 @@ <?php /******* Enlightenment Developers Map *******/ -$cvs_dir = $_SERVER["DOCUMENT_ROOT"] . "/DATA/devs"; +$devs_dir = $_SERVER["DOCUMENT_ROOT"] . "/DATA/devs/developers"; $geocache_file = sys_get_temp_dir() . "/e_devs_map_geocache"; //*************************************************** -function -GetValueFromInfoFile($field, $InfoFile) -{ - if ($i=preg_match("/$field:[ \t]*([ ,@.:i\/~()!a-zA-Z0-9_-]*)/i", "$InfoFile", $result)) - return trim($result[1]); - else return ""; -} function GeoCoordsQuery($address) @@ -55,12 +48,6 @@ GeoCoordsQuery($address) return $coords; } -/* check cvs dir */ -if (!is_dir($cvs_dir)) -{ - echo "<div align=center><b>ERROR: can't find cvs devs directory path.</b></div>"; - exit(); -} /* load cache file if present */ $geocache = array(); @@ -87,34 +74,20 @@ if (file_exists($geocache_file)) } } -/* build a list of directory that contain the info.txt file */ -$dirs = array(); -if ($dh = opendir($cvs_dir)) -{ - while (($file = readdir($dh)) !== false) - if (is_dir("$cvs_dir/$file") AND file_exists("$cvs_dir/$file/info.txt")) - $dirs[] = $file; -} /* build the devs array, populated by parsing all the info.txt files */ $devs = array(); $tot_geodata = 0; $tot_guessed = 0; -foreach ($dirs as $dir) +foreach (developers_active() as $login => $data ) { - /* get user info from info.txt file */ - $txt = file_get_contents("$cvs_dir/$dir/info.txt"); - $Coords = GetValueFromInfoFile("GeoData", $txt); - $Location = GetValueFromInfoFile("Location", $txt); - $IRC = GetValueFromInfoFile("IRC Nick", $txt); - /* skip user without a nickname */ - if (!$IRC OR $IRC == "N/A") + if (!$data["IRC Nick"] OR $data["IRC nick"] == "N/A") continue; /* parse the GeoData fields */ $lat = $lon = 0; - $Coords = explode(" ", str_replace(","," ", $Coords)); + $Coords = explode(" ", str_replace(","," ", $data["GeoData"])); if($Coords && (count($Coords) == 2)) { $tot_geodata ++; @@ -124,7 +97,7 @@ foreach ($dirs as $dir) } /* or use the geocoder to guess the position */ - if (!($lat AND $lon) AND $Location) + if (!($lat AND $lon) AND $data["Location"]) { $coords = GeoCoordsQuery($Location); if ($coords["lat"] AND $coords["lon"]) @@ -142,36 +115,35 @@ foreach ($dirs as $dir) /* create an array entry for this developer */ $dev = array(); - $dev["IRC"] = $IRC; + $dev["Login"] = $data["Login"]; + $dev["IRC"] = $data["IRC Nick"]; $dev["lat"] = $lat; $dev["lon"] = $lon; - $dev["Location"] = $Location; - $dev["Name"] = GetvalueFrominfoFile("Name", $txt); - $dev["Email"] = GetvalueFrominfoFile("E-Mail", $txt); + $dev["Location"] = $data["Location"]; + $dev["Name"] = $data["Name"]; + $dev["Email"] = $data["E-Mail"]; if ($dev["Email"] && $dev["Email"][0] == '-') $dev["Email"] = ""; - $dev["WWW"] = GetValueFromInfoFile("WWW", $txt); - $dev["Managing"] = GetValueFromInfoFile("Managing", $txt); - $dev["Contributing"] = GetValueFromInfoFile("Contributing", $txt); - $dev["Group"] = GetValueFromInfoFile("Group", $txt); - $dev["Platform"] = GetValueFromInfoFile("Platform", $txt ); + $dev["WWW"] = $data["WWW"]; + $dev["Managing"] = $data["Managing"]; + $dev["Contributing"] = $data["Contributing"]; + $dev["Group"] = $dev["Group"]; + $dev["Platform"] = $dev["Platform"]; /* check the user icon (icon-map.png, green or red) */ - if (file_exists("$cvs_dir/$dir/icon-map.png")) - $dev["Icon"] = "/DATA/devs/$dir/icon-map.png"; - else + if (file_exists("$devs_dir/$dev[Login]/icon-map.png")) + $dev["Icon"] = "$devs_dir/$dev[Login]/icon-map.png"; + else $dev["Icon"] = $icon; /* check the user image (icon-med.png) */ - if (file_exists("$cvs_dir/$dir/icon-med.png")) - $dev["IconBig"] = "/DATA/devs/$dir/icon-med.png"; + if (file_exists("$devs_dir/$dev[Login]/icon-med.png")) + $dev["IconBig"] = "$devs_dir/$dev[Login]/icon-med.png"; else $dev["IconBig"] = ""; $devs[] = $dev; } -$devs2 = developers_active(); - /* sort the devs array by nickname */ function sort_by_irc($a, $b) { return strcasecmp($a["IRC"], $b["IRC"]); } @@ -181,7 +153,6 @@ usort($devs, "sort_by_irc"); if (isset($_REQUEST["debug"])) { print "<hr><b>DEVS ARRAY</b><pre>"; print_r($devs); print "</pre><hr>"; - print "<hr><b>DEVS ARRAY</b><pre>"; print_r($devs2); print "</pre><hr>"; } /******************************************************************************/ --
