1 Replies - 877 Views - Last Post: 14 February 2012 - 03:18 PM Rate Topic: -----

#1 Angelonoobprogrammer   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 22-September 08

Google Maps API Key with expressionengine v 1.6.9

Posted 14 February 2012 - 02:27 PM

Hello Everyone,

This is my first time using google's map api key. were currently utilizing the crm expression engine.
Recently I'm trying to add a location within our module called "Google Maps API Location Finder" but when I try to add it in the module will say This "location key is already in use"

Couple of questions:
1. Is that mean i Need to get a new api key?
what I did: I generated another key, but didn't want to implement it if will cause issues with the current code with the new api key.
2. If I do replace it with the new api key will it change anything? such as if i need to recode everything?

thank you in advance!



<?php

class Location_finder_CP 
{
    var $version = '1.0';
    
    function location_finder_module_install()
    {
        
        global $DB;
        
        $sql[] = "INSERT INTO exp_modules (module_id, 
                                           module_name, 
                                           module_version, 
                                           has_cp_backend) 
                                           VALUES 
                                           ('', 
                                           'Location_finder', 
                                           '$this->version', 
                                           'y')";
                                           
        $sql[] = "CREATE TABLE IF NOT EXISTS `exp_location_finder` (
                 `location_id` INT(6) UNSIGNED NOT NULL AUTO_INCREMENT,
                 `location_name` VARCHAR(100) NOT NULL,
		 `locaqtion_key` VARCHAR(100) NOT NULL,
                 `location_address` VARCHAR(255) NOT NULL,
                 `location_phone` VARCHAR(15) NOT NULL,
		 `location_description` text NOT NULL,
		 `location_hours` VARCHAR(100) NOT NULL,
		 `location_image_url` VARCHAR(255) NOT NULL,
                 `location_lat` FLOAT(10,6),
                 `location_lng` FLOAT(10,6),
                 PRIMARY KEY (`location_id`));";
                 
        $sql[] = "INSERT INTO exp_actions (action_id, class, method) VALUES ('', 'Location_finder', 'search_locations')";
    
        foreach ($sql as $query)
        {
            $DB->query($query);
        }
        
        return true;
        
        
    }
    
    function location_finder_module_deinstall()
    {
        
        global $DB;    

        $query = $DB->query("SELECT module_id
                             FROM exp_modules 
                             WHERE module_name = 'Location_finder'"); 
                
        $sql[] = "DELETE FROM exp_module_member_groups 
                  WHERE module_id = '".$query->row['module_id']."'";      
                  
        $sql[] = "DELETE FROM exp_modules 
                  WHERE module_name = 'Location_finder'";
                  
        $sql[] = "DELETE FROM exp_actions 
                  WHERE class = 'Location_finder'";
                  
        $sql[] = "DELETE FROM exp_actions 
                  WHERE class = 'Location_finder_CP'";
                  
        $sql[] = "DROP TABLE IF EXISTS exp_location_finder";

        foreach ($sql as $query)
        {
            $DB->query($query);
        }

        return true;       
        
    }
    
    function Location_finder_CP( $switch = TRUE )
    {
        global $IN;
        
        if ($switch)
        {
            switch($IN->GBL('P'))
            {
                 case 'view'            :	$this->view_locations();
                     break;	
                 case 'delete_confirm'  :   $this->delete_confirm();
                     break;        
                 case 'delete'          :	$this->delete_locations();
                     break;
                 case 'add'             :	$this->modify_location();
                     break;
                 case 'modify'          :	$this->modify_location();
                     break;
                 case 'update'          :	$this->update_location();
                     break;
                 case 'edit'            :	$this->edit_location();
                     break;                     
                 default                :	$this->view_locations();
                     break;  
            }
        }
    }   
    
    
    function location_home()
    {
        global $DSP, $LANG;

        $DSP->title = $LANG->line('location_finder_module_name');
        $DSP->crumb = $DSP->anchor(BASE.
                                   AMP.'C=modules'.
                                   AMP.'M=location_finder',
                                   $LANG->line('location_finder_module_name'));
        $DSP->crumb .= $DSP->crumb_item($LANG->line('location_finder_menu')); 

        $DSP->body .= $DSP->heading($LANG->line('location_finder_menu'));

        $DSP->body .= $DSP->qdiv('itemWrapper', $DSP->heading($DSP->anchor(BASE.
                                                                           AMP.'C=modules'.
                                                                           AMP.'M=location_finder'.
                                                                           AMP.'P=add', 
                                                                           $LANG->line('add_location')),
                                                                           5));

        $DSP->body .= $DSP->qdiv('itemWrapper', $DSP->heading($DSP->anchor(BASE.
                                                                           AMP.'C=modules'.
                                                                           AMP.'M=location_finder'.
                                                                           AMP.'P=view', 
                                                                           $LANG->line('view_locations')),
                                                                           5));
    }     
    
    function view_locations($msg = '') {
        
        global $DSP, $LANG, $DB;
        
        if ($msg != '')
        {
			$DSP->body .= $DSP->qdiv('successBox', $DSP->qdiv('success', $msg));
        }        
        
		$DSP->crumb  = $DSP->anchor(BASE.AMP.'C=modules'.AMP.'M=location_finder', $LANG->line('location_finder_module_name'));
		$DSP->crumb .= $DSP->crumb_item('Location List');         
        
        
        $query = $DB->query("SELECT * FROM exp_location_finder ORDER BY location_name");
        
        if ($query->num_rows == 0)
        {
			$DSP->body .= $DSP->div('box');
			$DSP->body .= $DSP->qdiv('itemWrapper', $DSP->heading($LANG->line('loc_no_locations_exist'), 5));
        	$DSP->body .= $DSP->qdiv('itemWrapper', $DSP->anchor( BASE.AMP.'C=modules'.AMP.'M=location_finder'.AMP.'P=edit', $LANG->line('loc_create_new')));
			$DSP->body .= $DSP->div_c();
        
			return;
        }           
        
        $DSP->body	.=	$DSP->toggle();
        
        $DSP->body_props .= ' onload="magic_check()" ';
        
        $DSP->body .= $DSP->magic_checkboxes();
                
        $DSP->body	.=	$DSP->form_open(array('action' => 'C=modules'.AMP.'M=location_finder'.AMP.'P=delete_confirm', 'name' => 'target', 'id' => 'target'));

		$DSP->body .= $DSP->table_open(array('class' => 'tableBorder', 'width' => '100%'));
		$DSP->body .= $DSP->table_row(array(           
									array(
											'text'	=> $LANG->line('loc_location_name'),
											'class'	=> 'tableHeadingAlt'
										),
									array(
											'text'	=> $LANG->line('loc_location_key'),
											'class'	=> 'tableHeadingAlt'
										),                                     
									array(
											'text'	=> $LANG->line('loc_location_address'),
											'class'	=> 'tableHeadingAlt'
										),  
									array(
											'text'	=> $LANG->line('loc_location_phone'),
											'class'	=> 'tableHeadingAlt'
										),                                      
									array(
											'text'	=> $LANG->line('loc_location_lat'),
											'class'	=> 'tableHeadingAlt'
										),   
									array(
											'text'	=> $LANG->line('loc_location_lng'),
											'class'	=> 'tableHeadingAlt'
										),                                       
									array(
											'text'	=> $LANG->line('loc_location_edit'),
											'class'	=> 'tableHeadingAlt'
										),
									array(
											'text'	=> $DSP->input_checkbox('toggleflag', '', '', "onclick=\"toggle(this);\"").NBS.$LANG->line('loc_location_delete').NBS.NBS,
											'class'	=> 'tableHeadingAlt'
										)
									)
								);
		
		$i = 0;
		foreach ($query->result as $row)
		{	
            $style = ($i++ % 2) ? 'tableCellOne' : 'tableCellTwo';
			$DSP->body .= $DSP->table_row(array(               
										array(
												'text'	=> $DSP->qdiv('defaultBold', $row['location_name']),
												'class'	=> $style,
												'width'	=> '15%'
											),
										array(
												'text'	=> $DSP->qdiv('defaultBold', $row['location_key']),
												'class'	=> $style,
												'width'	=> '15%'
											),                                         
										array(
												'text'	=> $DSP->qdiv('defaultBold', $row['location_address']),
												'class'	=> $style,
												'width'	=> '20%'
											),
										array(
												'text'	=> $DSP->qdiv('defaultBold', $row['location_phone']),
												'class'	=> $style,
												'width'	=> '10%'
											),                                        
										array(
												'text'	=> $DSP->qdiv('defaultBold', $row['location_lat']),
												'class'	=> $style,
												'width'	=> '10%'
											),
										array(
												'text'	=> $DSP->qdiv('defaultBold', $row['location_lng']),
												'class'	=> $style,
												'width'	=> '10%'
											),                                        
										array(
												'text'	=> $DSP->qdiv('defaultBold', $DSP->anchor(BASE.AMP.'C=modules'.AMP.'M=location_finder'.AMP.'P=edit'.AMP.'location_id='.$row['location_id'], $LANG->line('loc_location_edit'))),
												'class'	=> $style,
												'width'	=> '15%'
											),
										array(
												'text'	=> $DSP->input_checkbox('toggle[]', $row['location_id'], '', " id='delete_box_".$row['location_id']."'"),
												'class'	=> $style,
												'width'	=> '10%'
											)
									)
								);            
            
        }
        
        $style = ($i++ % 2) ? 'tableCellOne' : 'tableCellTwo';
		$DSP->body .= $DSP->table_row(array(
									array(
											'text'		=> $DSP->qdiv('itemWrapper', ''),
											'class'		=> $style,
											'colspan'	=> '7'
										),           
		
									array(
											'text'		=> $DSP->qdiv('itemWrapper', $DSP->input_submit($LANG->line('loc_location_delete'))),
											'class'		=> $style,
											'colspan'	=> '1'
										)
									)
								);
	
		
        $DSP->body	.=	$DSP->table_close(); 
        $DSP->body	.=	$DSP->form_close(); 
        
        $DSP->body .= $DSP->qdiv('itemWrapper', $DSP->heading($DSP->anchor(BASE.
                                                                           AMP.'C=modules'.
                                                                           AMP.'M=location_finder'.
                                                                           AMP.'P=edit', 
                                                                           $LANG->line('add_location')),
                                                                           5));        
    }
    
    
    function edit_location()
    {
		global $IN, $DSP, $LANG, $DB;
		        
        $location_id	    = '0';
        $location_name	    = '';
        $location_address	= '';
        $location_phone     = '';
        $location_lat       = '0';
        $location_lng       = '0';
        $location_key       = '';
        $location_description = '';
        $location_hours = '';
        $location_image_url = '';
	$google_maps_api_key = 'ABQIAAAAr2gU_6oVfk0msbLg-7t1khSFOaySqug3uCeoLFZJQZGAaXFyhRRY0aZndv2OvN_O-jveAwA6yY27LQ';
        
        $r = <<<EOT
            
            <script src="http://maps.google.com/maps?file=api&amp;v=2&amp;sensor=false&amp;key=$google_maps_api_key" type="text/javascript"></script>
            
            <script type="text/javascript">
            <!--
            
            var map;
            var geocoder;
            
            function load() {
                if (GBrowserIsCompatible()) {
                    geocoder = new GClientGeocoder();
                    map = new GMap2(document.getElementById('map'));
                    map.addControl(new GSmallMapControl());
                    map.addControl(new GMapTypeControl());
                    
                    showCurrentLocation();
                }
            }  
            
            function showCurrentLocation() {
                var lat = document.getElementById('location_lat').value;
                var lng = document.getElementById('location_lng').value;
                var name = document.getElementById('location_name').value;
                var address = document.getElementById('location_address').value;
                var phone = document.getElementById('location_phone').value;
                
                
                if (lat != 0 && lng != 0) {
                    setLocation(lat, lng, name, address, phone);
                } else {
                    map.setCenter(new GLatLng(40, -100), 4);   
                }                                

            }
            
            function setLocation(lat, lng, name, address, phone) {
                map.clearOverlays();
                map.setCenter(new GLatLng(lat, lng), 14);                
                var point = new GLatLng(lat, lng);                        
                var marker = createMarker(point, name, address, phone);
                map.addOverlay(marker);
            }
                        
            function searchLocations() {
                var name = document.getElementById('location_name').value;
                var phone = document.getElementById('location_phone').value;            
                var address = document.getElementById('location_address').value;
                geocoder.getLatLng(address, function(latlng) {
                    if (!latlng) {                        
                        alert(address + ' not found');                        
                    } else {                                                
                        setLocation(latlng.lat(), latlng.lng(), name, address, phone);                        
                        document.getElementById('location_lat').value = latlng.lat();
                        document.getElementById('location_lng').value = latlng.lng();                                                
                    }
                });
            }   
            
            function createMarker(point, name, address, phone) {
                var marker = new GMarker(point);
                return marker;
            }            
            -->
            </script>
        
EOT;

        $DSP->body  .= $r;  
        
        $DSP->body_props .= ' onload="load()" onunload="GUnload()" ';
        
        if (is_numeric($IN->GBL('location_id')))
        {
        	$query = $DB->query("SELECT * FROM exp_location_finder WHERE location_id = '".$DB->escape_str($IN->GBL('location_id'))."'");
        	
        	if ($query->num_rows == 1)
        	{
        		$location_id = $query->row['location_id'];
                $location_key = $query->row['location_key'];
        		$location_name = $query->row['location_name'];
                $location_address = $query->row['location_address'];
                $location_phone = $query->row['location_phone'];
                $location_hours = $query->row['location_hours'];
                $location_crossroads = $query->row['location_crossroads'];
                $location_description = $query->row['location_description'];
                $location_image_url = $query->row['location_image_url'];
                $location_lat = $query->row['location_lat']; 
                $location_lng = $query->row['location_lng']; 
        	}
        }   
        
    	$title = ($location_id == 0) ? $LANG->line('loc_create_new') : $LANG->line('loc_edit_location');
        $DSP->title = $title;  
		$DSP->crumb  = $DSP->anchor(BASE.AMP.'C=modules'.AMP.'M=location_finder', $LANG->line('location_finder_module_name'));
		$DSP->crumb .= $DSP->crumb_item($title);   
        
        $DSP->body .= $DSP->qdiv('tableHeading', $title); 
                        
        $DSP->body	.=	$DSP->form_open(
        								array('action' => 'C=modules'.AMP.'M=location_finder'.AMP.'P=update'),
        								array('location_id' => $location_id)
        								);

        $DSP->body	.=	$DSP->table('tableBorder', '0', '0', '100%').
						$DSP->tr().
						$DSP->table_qcell('tableHeadingAlt', array('&nbsp;', '&nbsp;')).
						$DSP->tr_c();
		
		$style ='tableCellOne';
				  
		$DSP->body .= $DSP->tr();
		$DSP->body .= $DSP->table_qcell($style, $DSP->qdiv('defaultBold', $LANG->line('loc_location_name')).$DSP->qdiv('default', $LANG->line('loc_title_info')), '50%');				
		$DSP->body .= $DSP->table_qcell($style, $DSP->qdiv('defaultBold', $DSP->qdiv('itemWrapper', $DSP->input_text('location_name', $location_name, '40', '100', 'input', '100%'))), '50%');
		$DSP->body .= $DSP->tr_c();

		$DSP->body .= $DSP->tr();
		$DSP->body .= $DSP->table_qcell($style, $DSP->qdiv('defaultBold', $LANG->line('loc_location_key')).$DSP->qdiv('default', $LANG->line('loc_key_info')), '50%');				
		$DSP->body .= $DSP->table_qcell($style, $DSP->qdiv('defaultBold', $DSP->qdiv('itemWrapper', $DSP->input_text('location_key', $location_key, '40', '100', 'input', '100%'))), '50%');
		$DSP->body .= $DSP->tr_c();
		
        
		$DSP->body .= $DSP->tr();
		$DSP->body .= $DSP->table_qcell($style, $DSP->qdiv('defaultBold', $LANG->line('loc_location_address')).$DSP->qdiv('default', $LANG->line('loc_address_info')));
		$DSP->body .= $DSP->table_qcell($style, $DSP->qdiv('defaultBold', $DSP->qdiv('itemWrapper', $DSP->input_text('location_address', $location_address, '35', '100', 'input', '75%') . $DSP->br().$DSP->anchor('javascript:searchLocations()', 'Find Address on Map and Update Latitude/Longitude', '', FALSE).'<div id="map" style="overflow: hidden; width:400px; height:400px"></div>')));
		$DSP->body .= $DSP->tr_c();
        
		$DSP->body .= $DSP->tr();
		$DSP->body .= $DSP->table_qcell($style, $DSP->qdiv('defaultBold', $LANG->line('loc_location_phone')).$DSP->qdiv('default', $LANG->line('loc_phone_info')), '50%');				
		$DSP->body .= $DSP->table_qcell($style, $DSP->qdiv('defaultBold', $DSP->qdiv('itemWrapper', $DSP->input_text('location_phone', $location_phone, '35', '40', 'input', '100%'))), '50%');
		$DSP->body .= $DSP->tr_c();        
        
		$DSP->body .= $DSP->tr();
		$DSP->body .= $DSP->table_qcell($style, $DSP->qdiv('defaultBold', $LANG->line('loc_location_description')).$DSP->qdiv('default', $LANG->line('loc_description_info')), '50%');				
		$DSP->body .= $DSP->table_qcell($style, $DSP->qdiv('defaultBold', $DSP->qdiv('itemWrapper', $DSP->input_textarea('location_description', $location_description, '10', 'textarea', '100%'))), '50%');
		$DSP->body .= $DSP->tr_c();         
        
		$DSP->body .= $DSP->tr();
		$DSP->body .= $DSP->table_qcell($style, $DSP->qdiv('defaultBold', $LANG->line('loc_location_hours')).$DSP->qdiv('default', $LANG->line('loc_hours_info')), '50%');				
		$DSP->body .= $DSP->table_qcell($style, $DSP->qdiv('defaultBold', $DSP->qdiv('itemWrapper', $DSP->input_textarea('location_hours', $location_hours, '2', 'textarea', '100%'))), '50%');
		$DSP->body .= $DSP->tr_c();  
        
		$DSP->body .= $DSP->tr();
		$DSP->body .= $DSP->table_qcell($style, $DSP->qdiv('defaultBold', $LANG->line('loc_location_crossroads')).$DSP->qdiv('default', $LANG->line('loc_crossroads_info')), '50%');				
		$DSP->body .= $DSP->table_qcell($style, $DSP->qdiv('defaultBold', $DSP->qdiv('itemWrapper', $DSP->input_text('location_crossroads', $location_crossroads, '35', '100', 'input', '100%'))), '50%');
		$DSP->body .= $DSP->tr_c();    
        
		$DSP->body .= $DSP->tr();
		$DSP->body .= $DSP->table_qcell($style, $DSP->qdiv('defaultBold', $LANG->line('loc_location_image')).$DSP->qdiv('default', $LANG->line('loc_image_info')), '50%');				
		$DSP->body .= $DSP->table_qcell($style, $DSP->qdiv('defaultBold', $DSP->qdiv('itemWrapper', $DSP->input_text('location_image_url', $location_image_url, '255', '255', 'input', '100%'))), '50%');
		$DSP->body .= $DSP->tr_c();        
        
		$DSP->body .= $DSP->tr();
		$DSP->body .= $DSP->table_qcell($style, $DSP->qdiv('defaultBold', $LANG->line('loc_location_lat')).$DSP->qdiv('default', $LANG->line('loc_lat_info')));
		$DSP->body .= $DSP->table_qcell($style, $DSP->qdiv('defaultBold', $DSP->qdiv('itemWrapper', $DSP->input_text('location_lat', $location_lat, '35', '100', 'input', '100%'))));
		$DSP->body .= $DSP->tr_c();

		$DSP->body .= $DSP->tr();
		$DSP->body .= $DSP->table_qcell($style, $DSP->qdiv('defaultBold', $LANG->line('loc_location_lng')).$DSP->qdiv('default', $LANG->line('loc_lng_info')));
		$DSP->body .= $DSP->table_qcell($style, $DSP->qdiv('defaultBold', $DSP->qdiv('itemWrapper', $DSP->input_text('location_lng', $location_lng, '35', '100', 'input', '100%'))));
		$DSP->body .= $DSP->tr_c();        
        
        $DSP->body .= $DSP->table_c(); 
        
    	
    	$button = ($location_id == 0) ? $LANG->line('loc_create_new') : $LANG->line('loc_location_update');
    	
		$DSP->body	.=	$DSP->qdiv('itemWrapperTop', $DSP->input_submit($button));             
        
        $DSP->body	.=	$DSP->form_close(); 



    }
    
    function update_location() {
        
		global $IN, $DSP, $LANG, $DB;
		
		$location_id = (is_numeric($IN->GBL('location_id')) AND $IN->GBL('location_id') != 0) ? $IN->GBL('location_id') : FALSE;
        
        if ($_POST['location_name'] == '' OR $_POST['location_address'] == '' OR $_POST['location_lat'] == '' OR $_POST['location_lng'] == '')
        {
			return $DSP->error_message($LANG->line('loc_all_fields_required'));
        }
        
        
        if (preg_match('/[^0-9\.\-]/i', $_POST['location_lat']))
        {
			return $DSP->error_message($LANG->line('loc_invalid_latitude'));
        }
        
        if (preg_match('/[^0-9\.\-]/i', $_POST['location_lng']))
        {
			return $DSP->error_message($LANG->line('loc_invalid_longitude'));
        }        
        

		$sql = "SELECT COUNT(*) AS count FROM exp_location_finder WHERE location_key = '".$DB->escape_str($_POST['location_key'])."'";

    	if ($location_id !== FALSE)
    	{
    		$sql .= " AND location_id != '".$location_id."'";
    	}

		$query = $DB->query($sql);

    	if ($query->row['count'] > 0)
    	{
			return $DSP->error_message($LANG->line('loc_location_key_taken'));
    	}
    	
    	if ($location_id === FALSE)
    	{
    		$DB->query("INSERT INTO exp_location_finder (location_id, location_key, location_name, location_address, location_phone, location_description, location_hours, location_image_url, location_lat, location_lng, location_crossroads) values ('', '".$DB->escape_str($_POST['location_key'])."','".$DB->escape_str($_POST['location_name'])."', '".$DB->escape_str($_POST['location_address'])."', '".$DB->escape_str($_POST['location_phone'])."', '".$DB->escape_str($_POST['location_description'])."', '".$DB->escape_str($_POST['location_hours'])."', '".$DB->escape_str($_POST['location_image_url'])."', '".$DB->escape_str($_POST['location_lat'])."', '".$DB->escape_str($_POST['location_lng'])."', '".$DB->escape_str($_POST['location_crossroads'])."')");
    	}
    	else
    	{
    		$DB->query("UPDATE exp_location_finder SET location_name = '".$DB->escape_str($_POST['location_name'])."', location_key = '".$DB->escape_str($_POST['location_key'])."', location_address = '".$DB->escape_str($_POST['location_address'])."', location_phone = '".$DB->escape_str($_POST['location_phone'])."', location_description = '".$DB->escape_str($_POST['location_description'])."', location_hours = '".$DB->escape_str($_POST['location_hours'])."', location_image_url = '".$DB->escape_str($_POST['location_image_url'])."', location_lat = '".$DB->escape_str($_POST['location_lat'])."', location_lng = '".$DB->escape_str($_POST['location_lng'])."', location_crossroads = '".$DB->escape_str($_POST['location_crossroads'])."' WHERE location_id = '{$location_id}'");
    	}
    	
    	
    	$msg = ($location_id === FALSE) ? $LANG->line('loc_location_created') : $LANG->line('loc_location_updated');
    	
    	return $this->view_locations($msg);
    }
    
    function delete_confirm()
    { 
        global $IN, $DSP, $LANG;
        
        if ( ! $IN->GBL('toggle', 'POST'))
        { 
            return $this->view_locations();
        }
        
        $DSP->title = $LANG->line('location_finder_module_name');
		$DSP->crumb  = $DSP->anchor(BASE.AMP.'C=modules'.AMP.'M=location_finder', $LANG->line('location_finder_module_name'));
		$DSP->crumb .= $DSP->crumb_item($LANG->line('loc_delete_confirm'));

        $DSP->body	.=	$DSP->form_open(array('action' => 'C=modules'.AMP.'M=location_finder'.AMP.'P=delete'));
        
        $i = 0;
        
        foreach ($_POST as $key => $val)
        {        
            if (strstr($key, 'toggle') AND ! is_array($val) AND is_numeric($val))
            {
                $DSP->body	.=	$DSP->input_hidden('delete[]', $val);
                
                $i++;
            }        
        }
        
		$DSP->body .= $DSP->qdiv('alertHeading', $LANG->line('loc_delete_confirm'));
		$DSP->body .= $DSP->div('box');
		$DSP->body .= $DSP->qdiv('defaultBold', $LANG->line('loc_delete_question'));
		$DSP->body .= $DSP->qdiv('alert', BR.$LANG->line('action_can_not_be_undone'));
		$DSP->body .= $DSP->qdiv('', BR.$DSP->input_submit($LANG->line('loc_location_delete')));
		$DSP->body .= $DSP->qdiv('alert',$DSP->div_c());
		$DSP->body .= $DSP->div_c();
		$DSP->body .= $DSP->form_close();
    }
    /* END */    
    
    function delete_locations() {

        global $IN, $DSP, $LANG, $SESS, $DB;
        
        
        if ( ! $IN->GBL('delete', 'POST'))
        {
            return $this->view_locations();
        }

        $ids = array();
                
        foreach ($_POST as $key => $val)
        {        
            if (strstr($key, 'delete') AND ! is_array($val) AND is_numeric($val))
            {
                $ids[] = "location_id = '".$val."'";
            }        
        }
        
        $IDS = implode(" OR ", $ids);
        
        $DB->query("DELETE FROM exp_location_finder WHERE ".$IDS);
    
        $message = (count($ids) == 1) ? $LANG->line('loc_location_deleted') : $LANG->line('loc_locations_deleted');

        return $this->view_locations($message);      
        
    }
   
}



Is This A Good Question/Topic? 0
  • +

Replies To: Google Maps API Key with expressionengine v 1.6.9

#2 JackOfAllTrades   User is offline

  • Saucy!
  • member icon

Reputation: 6258
  • View blog
  • Posts: 24,026
  • Joined: 23-August 08

Re: Google Maps API Key with expressionengine v 1.6.9

Posted 14 February 2012 - 03:18 PM

I would think you'd want to contact Google about something like this. Although I wouldn't expect an error about "location key", but rather "API key" if it was the Google API's problem. You have "location key" stuff in your code; are you sure it's not your code that's generating the error?
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1