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 61b3ddd commit 95b8f8a
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
3 changes: 1 addition & 2 deletions .htaccess
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@

# if a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d


# otherwise forward it to index.php
RewriteRule . index.php
</IfModule>
Expand Down
7 changes: 6 additions & 1 deletion application/helpers/admin/statistics_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -3188,7 +3188,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
Original file line number Diff line number Diff line change
Expand Up @@ -3463,7 +3463,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 @@ -3615,9 +3619,9 @@ class=\"mapservice\" value = \"{$aQuestionAttributes['location_mapservice']}\" >
</div>";
Yii::app()->getClientScript()->registerScriptFile(Yii::app()->getConfig('generalscripts')."map.js");
if ($aQuestionAttributes['location_mapservice']==1 && !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != "off")
Yii::app()->getClientScript()->registerScriptFile("https://maps.googleapis.com/maps/api/js?sensor=false");
Yii::app()->getClientScript()->registerScriptFile("https://maps.googleapis.com/maps/api/js?sensor=false$sGoogleMapsAPIKey");
else if ($aQuestionAttributes['location_mapservice']==1)
Yii::app()->getClientScript()->registerScriptFile("http://maps.googleapis.com/maps/api/js?sensor=false");
Yii::app()->getClientScript()->registerScriptFile("http://maps.googleapis.com/maps/api/js?sensor=false$sGoogleMapsAPIKey");
elseif ($aQuestionAttributes['location_mapservice']==2)
Yii::app()->getClientScript()->registerScriptFile("http://www.openlayers.org/api/OpenLayers.js");

Expand Down

0 comments on commit 95b8f8a

Please sign in to comment.