Skip to content

Commit

Permalink
Fix: cannot update Street View parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
fisharebest committed Jun 4, 2016
1 parent bb23c48 commit 31a32a1
Showing 1 changed file with 20 additions and 18 deletions.
38 changes: 20 additions & 18 deletions app/Module/GoogleMapsModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -3107,6 +3107,26 @@ private function placesEdit() {
$place_name = Filter::post('place_name', null, Filter::get('place_name'));
$placeid = (int) $placeid; // Convert empty string to zero

// Update Street View fields fields
if ($action === 'update_sv_params' && Auth::isAdmin() && Filter::checkCsrf()) {
Database::prepare(
"UPDATE `##placelocation`" .
" SET sv_lati = :sv_latitude, sv_long = :sv_longitude, sv_bearing = :sv_bearing, sv_elevation = :sv_elevation, sv_zoom = :sv_zoom" .
" WHERE pl_id = :place_id"
)->execute(array(
'sv_latitude' => (float) Filter::post('sv_latiText'),
'sv_longitude' => (float) Filter::post('sv_longText'),
'sv_bearing' => (float) Filter::post('sv_bearText'),
'sv_elevation' => (float) Filter::post('sv_elevText'),
'sv_zoom' => (float) Filter::post('sv_zoomText'),
'place_id' => $placeid,
));
// TODO - submit this data via AJAX, so we won't need to redraw the page.
header('Location: ' . Filter::post('destination', null, 'index.php'));

return;
}

$controller = new SimpleController;
$controller
->restrictAccess(Auth::isAdmin())
Expand Down Expand Up @@ -3147,24 +3167,6 @@ private function placesEdit() {
return;
}

// Update placelocation STREETVIEW fields
// TODO: This ought to be a POST request, rather than a GET request
if ($action == 'update_sv_params' && Auth::isAdmin()) {
Database::prepare(
"UPDATE `##placelocation` SET sv_lati=?, sv_long=?, sv_bearing=?, sv_elevation=?, sv_zoom=? WHERE pl_id=?"
)->execute(array(
(float) Filter::get('svlati'),
(float) Filter::get('svlong'),
(float) Filter::get('svbear'),
(float) Filter::get('svelev'),
(float) Filter::get('svzoom'),
$placeid,
));
$controller->addInlineJavascript('window.close();');

return;
}

if ($action === 'update') {
// --- find the place in the file
$row =
Expand Down

0 comments on commit 31a32a1

Please sign in to comment.