Skip to content

Commit

Permalink
Fixed issue: Google Maps API key not being used when entered
Browse files Browse the repository at this point in the history
  • Loading branch information
c-schmitz committed Dec 1, 2013
1 parent f2bcd3f commit 9209aa4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
7 changes: 6 additions & 1 deletion application/helpers/admin/statistics_helper.php
Expand Up @@ -3187,7 +3187,12 @@ public function generate_statistics($surveyid, $allfields, $q2show='all', $usegr

break;
case 'html':
$statisticsoutput .= "<script type=\"text/javascript\" src=\"http://maps.googleapis.com/maps/api/js?sensor=false\"></script>\n"
$sGoogleMapsAPIKey = trim(Yii::app()->getConfig("googleMapsAPIKey"));
if ($sGoogleMapsAPIKey!='')
{
$sGoogleMapsAPIKey='&key='.$sGoogleMapsAPIKey;
}
$statisticsoutput .= "<script type=\"text/javascript\" src=\"http://maps.googleapis.com/maps/api/js?sensor=false$sGoogleMapsAPIKey\"></script>\n"
."<script type=\"text/javascript\">var site_url='".Yii::app()->baseUrl."';var temppath='$tempurl';var imgpath='".Yii::app()->getConfig('adminimageurl')."';var aGMapData=".ls_json_encode($agmapdata) .";var aStatData=".ls_json_encode($astatdata)."</script>";
return $statisticsoutput;

Expand Down
10 changes: 7 additions & 3 deletions application/helpers/qanda_helper.php
Expand Up @@ -3806,7 +3806,11 @@ function do_shortfreetext($ia)
global $thissurvey;

$clang = Yii::app()->lang;
$googleMapsAPIKey = Yii::app()->getConfig("googleMapsAPIKey");
$sGoogleMapsAPIKey = trim(Yii::app()->getConfig("googleMapsAPIKey"));
if ($sGoogleMapsAPIKey!='')
{
$sGoogleMapsAPIKey='&key='.$sGoogleMapsAPIKey;
}
$extraclass ="";
$aQuestionAttributes = getQuestionAttributeValues($ia[0], $ia[4]);

Expand Down Expand Up @@ -3957,9 +3961,9 @@ class=\"mapservice\" value = \"{$aQuestionAttributes['location_mapservice']}\" >
<div id=\"gmap_canvas_$ia[1]_c\" style=\"width: {$aQuestionAttributes['location_mapwidth']}px; height: {$aQuestionAttributes['location_mapheight']}px\"></div>
</div>";
if ($aQuestionAttributes['location_mapservice']==1 && !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != "off")
header_includes("https://maps.googleapis.com/maps/api/js?sensor=false");
header_includes("https://maps.googleapis.com/maps/api/js?sensor=false$sGoogleMapsAPIKey");
else if ($aQuestionAttributes['location_mapservice']==1)
header_includes("http://maps.googleapis.com/maps/api/js?sensor=false");
header_includes("http://maps.googleapis.com/maps/api/js?sensor=false$sGoogleMapsAPIKey");
elseif ($aQuestionAttributes['location_mapservice']==2)
header_includes("http://www.openlayers.org/api/OpenLayers.js");

Expand Down

0 comments on commit 9209aa4

Please sign in to comment.