Changeset 7723


Ignore:
Timestamp:
Apr 12, 2010, 7:15:57 PM (13 years ago)
Author:
rick
Message:

Hacked Google key support for multiple domains

Location:
trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/config.php

    r7702 r7723  
    3636$config['require'][]            = $config['folder_class'] . 'KMLFile.class.php';
    3737$config['require'][]            = $config['folder_class'] . 'KMLPlacemark.class.php';
     38
     39$config['googlekey']            = array();
     40$config['googlekey']['wirelessleiden.nl'] = 'ABQIAAAAKRiFs2kXKhTkKZkE_ms9rhTdBXm62xfhQU7Dk6ZBFSzYdmSteRQWjLqZhwX8afHvGpd4N3iKql6w8g';
     41$config['googlekey']['default'] = 'ABQIAAAAzr2EBOXUKnm_jVnk0OJI7xSosDVG8KKPE1-m51RBrvYughuyMxQ-i1QfUnH94QxWIa6N4U6MouMmBA';
    3842?>
  • trunk/src/map/index.php

    r7722 r7723  
    11<?php require_once("inc/kmlHandler.php"); ?>
     2<?php include("../config.php");
     3
     4# Key is defined to be the domain name if exists
     5$apikey = $config['googlekey']['default'];
     6$servername = $_SERVER['SERVER_NAME'];
     7
     8# Little hack, does not work with foo.co.uk domains
     9$servername = implode('.',array_slice(explode('.',$servername),-2));
     10if (array_key_exists($servername,$config['googlekey'])) {
     11  $apikey = $config['googlekey'][$servername];
     12}
     13?>
    214
    315<html>
     
    1729
    1830<!-- Loading in the google-api -->
    19 <script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAAzr2EBOXUKnm_jVnk0OJI7xSosDVG8KKPE1-m51RBrvYughuyMxQ-i1QfUnH94QxWIa6N4U6MouMmBA" type="text/javascript"></script>
     31<script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=<?=$apikey;?>" type="text/javascript"></script>
    2032<!-- Loading in the javascript that will add the map into #mapcanvas -->
    2133<script type="text/javascript" src="inc/nodemapWL.js"></script>
Note: See TracChangeset for help on using the changeset viewer.