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

Hacked Google key support for multiple domains

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.