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('x' => array('required', 'numeric'),
|
7
|
'y' => array('required', 'numeric'),
|
8
|
'panorama' => array('required'),
|
9
|
'ref_point' => array('required'),
|
10
|
);
|
11
|
|
12
|
|
13
|
$validator = new FormValidator($fields_spec);
|
14
|
if ($validator->validate($_REQUEST)) {
|
15
|
$vals = $validator->sane_values();
|
16
|
|
17
|
|
18
|
$pano = site_point::get(urldecode($vals['panorama']));
|
19
|
|
20
|
$ref_point_name = urldecode($vals['ref_point']);
|
21
|
$ref_point = RefPoint::get($ref_point_name);
|
22
|
|
23
|
$pano->set_reference($ref_point, $vals['x'], $vals['y']);
|
24
|
$pano->save_params();
|
25
|
|
26
|
} else {
|
27
|
|
28
|
http_response_code(400);
|
29
|
echo var_dump($validator->errors());
|
30
|
}
|
31
|
|
32
|
|
33
|
?>
|