root / ajax / rm_reference.php @ a1063f68
1 |
<?php
|
---|---|
2 |
require_once('../class/FormValidator.class.php'); |
3 |
require_once('../class/RefPoint.class.php'); |
4 |
require_once('../class/site_point.class.php'); |
5 |
|
6 |
$fields_spec = array('panorama' => array('required'), |
7 |
'ref_point' => array('required'), |
8 |
); |
9 |
|
10 |
|
11 |
$validator = new FormValidator($fields_spec); |
12 |
if ($validator->validate($_REQUEST)) { |
13 |
$vals = $validator->sane_values(); |
14 |
|
15 |
// temp test code
|
16 |
$pano = site_point::get(urldecode($vals['panorama'])); |
17 |
|
18 |
$ref_point_name = urldecode($vals['ref_point']); |
19 |
$ref_point = RefPoint::get($ref_point_name); |
20 |
|
21 |
$pano->unset_reference($ref_point); |
22 |
$pano->save_params();
|
23 |
|
24 |
} else {
|
25 |
// Set our response code
|
26 |
http_response_code(400);
|
27 |
echo var_dump($validator->errors()); |
28 |
} |
29 |
|
30 |
// Test url : clear ;curl 'http://localhost/~jocelyn/panorama/ajax/add_reference.php?x=42&y=42&panorama=pano_couttolenc_bords_jointifs&ref_point=%C3%89glise%20saint-jacques'
|
31 |
|
32 |
?>
|