Changeset 1224

Show
Ignore:
Timestamp:
09/19/10 17:03:24 (3 years ago)
Author:
d0nut
Message:

cleanup icons and fix gmap update job

Location:
g-map
Files:
21 removed
3 modified
7 moved

Legend:

Unmodified
Added
Removed
  • g-map/files/lib/data/gmap/GmapApi.class.php

    r1223 r1224  
    77 * @license     GNU General Public License <http://opensource.org/licenses/gpl-3.0.html> 
    88 */ 
    9 class Gmap extends DatabaseObject { 
     9class GmapApi extends DatabaseObject { 
     10        protected $apikey = null; 
     11        protected $cache_search = array(); 
     12 
     13        /** 
     14         * 
     15         */ 
     16        public function __construct() { 
     17 
     18                $res = null; 
     19 
     20                $apikey = GMAP_API_KEY; 
     21                $apikey = explode("\n", $apikey); 
     22                $apikey = $apikey[0]; 
     23                $apikey = explode(":", $apikey); 
     24                if(count($apikey) == 2) { 
     25                        $this->apikey = $apikey; 
     26                } 
     27        } 
     28 
     29        /** 
     30         * is active? api key existent? 
     31         */ 
     32        public function isActive() { 
     33                return !empty($this->apikey); 
     34        } 
    1035         
    1136        /** 
     
    1338         * @param location 
    1439         */ 
    15         public static function search($location) { 
    16                 $res = null; 
     40        public function search($location) { 
    1741 
    18                 $lookupstring = urlencode(trim($location)); 
     42                if(!$this->isActive()) { 
     43                        return; 
     44                } 
     45 
     46                $lookupstring = urlencode(StringUtil::trim($location)); 
     47                if(isset($this->cache_search[$lookupstring])) { 
     48                        return $this->cache_search[$lookupstring]; 
     49                } 
    1950 
    2051                $req_url = "maps.google.com"; 
    2152                $io = @fsockopen($req_url, 80, $errno, $errstr, 5 ); 
    2253                if ($io) { 
    23                         $send  = "GET /maps/geo?q=".$lookupstring."&key=".MAP_API."&output=csv HTTP/1.1\r\n"; 
     54                        $send  = "GET /maps/geo?q=".$lookupstring."&key=".$apikey."&output=csv HTTP/1.1\r\n"; 
    2455                        $send .= "Host: maps.google.com\r\n"; 
    2556                        $send .= "Accept-Language: de, en;q=0.50\r\n"; 
    2657                        $send .= "Connection: Close\r\n\r\n"; 
    2758                        fputs($io, $send); 
    28                          
     59 
    2960                        while (!feof($io)) { 
    3061                                $send = fgets($io, 4096); 
     
    3970                        fclose($io); 
    4071                } 
    41                  
    42                 return $res; 
     72 
     73                return $this->cache_search[$lookupstring] = $res; 
    4374        } 
    4475} 
  • g-map/files/lib/data/gmap/GmapCluster.class.php

    r1223 r1224  
    88 */ 
    99class GmapCluster { 
     10 
    1011        const OFFSET = 268435456; 
    1112        const RADIUS = 85445659.4471; /* $self::OFFSET / pi() */ 
  • g-map/files/lib/data/gmap/GmapPersonal.class.php

    r1222 r1224  
    11<?php 
     2 
     3/** 
     4 * personal objects 
     5 * 
     6 * @author      Torben Brodt 
     7 * @license     GNU General Public License <http://opensource.org/licenses/gpl-3.0.html> 
     8 */ 
    29class GmapPersonal { 
    310         
  • g-map/pagemenu.xml

    r1221 r1224  
    44        <import> 
    55                <pagemenuitem name="wcf.header.menu.map"> 
    6                         <icon>mapM.png</icon> 
     6                        <icon>gmapM.png</icon> 
    77                        <link>index.php?page=Map</link> 
    88                        <showorder>10</showorder>