Projet

Général

Profil

Révision 3a832cbc

Ajouté par Jocelyn Delande il y a presque 11 ans

Added sanity checks

Voir les différences:

ajax/add_reference.php
15 15
  $vals = $validator->sane_values();
16 16

  
17 17
  // temp test code
18
  $pano = site_point::get($vals['panorama']);
18
  $pano = site_point::get(urldecode($vals['panorama']));
19 19

  
20 20
  $ref_point_name = urldecode($vals['ref_point']);
21 21
  $ref_point = RefPoint::get($ref_point_name);
ajax/rm_reference.php
13 13
  $vals = $validator->sane_values();
14 14

  
15 15
  // temp test code
16
  $pano = site_point::get($vals['panorama']);
16
  $pano = site_point::get(urldecode($vals['panorama']));
17 17

  
18 18
  $ref_point_name = urldecode($vals['ref_point']);
19 19
  $ref_point = RefPoint::get($ref_point_name);
......
26 26
   http_response_code(400);
27 27
   echo var_dump($validator->errors());
28 28
 }
29

  
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'
30 31

  
31 32
?>
class/site_point.class.php
41 41
	    $params = parse_ini_file($this->params_path());
42 42
	    if ($params) {
43 43
		    $this->params = $params;
44
		    foreach ($params[self::$REF_KEY] as $ref => $vals) {
45
			    $bits = explode(',',$vals);
46
			    $this->params[self::$REF_KEY][$ref] = array(floatval($bits[0]),
47
			                                          floatval($bits[1]));
44
		    if (isset($params[self::$REF_KEY])) {
45
			    foreach ($params[self::$REF_KEY] as $ref => $vals) {
46
				    $bits = explode(',',$vals);
47
				    $this->params[self::$REF_KEY][$ref] = array(floatval($bits[0]),
48
				                                                floatval($bits[1]));
49
			    }
48 50
		    }
49 51
		    if (isset($params['image_loop'])) {
50 52
			    $this->params['image_loop'] = (bool)($params['image_loop']);

Formats disponibles : Unified diff