Subversion Repositories eFlore/Projets.eflore-projets

Rev

Rev 861 | Rev 863 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 861 Rev 862
Line 24... Line 24...
24
define('_COSTE_TEXTE_MAX_RESULT_LIMIT', 500);
24
define('_COSTE_TEXTE_MAX_RESULT_LIMIT', 500);
Line 25... Line 25...
25
 
25
 
26
// simplifie et accélère la sanitization de l'input:
26
// simplifie et accélère la sanitization de l'input:
27
// SELECT MAX(num_nom) FROM coste_v2_00;
27
// SELECT MAX(num_nom) FROM coste_v2_00;
-
 
28
define('_COSTE_TEXTE_MAX_COSTE_NN', 7015 + 1000);
-
 
29
// SELECT MAX(page) FROM coste_v2_00;
-
 
30
define('_COSTE_TEXTE_MAX_COSTE_PAGE', 4126);
-
 
31
// SELECT MAX(tome) FROM coste_v2_00;
-
 
32
define('_COSTE_TEXTE_MAX_COSTE_TOME', 3);
-
 
33
// SELECT MAX(num_taxonomique) FROM coste_v2_00;
28
define('_COSTE_TEXTE_MAX_COSTE_NN', 7015 + 1000);
34
define('_COSTE_TEXTE_MAX_BDTFX_NT', 37809);
29
// SELECT MAX(num_nom) FROM bdtfx_v1_02;
35
// SELECT MAX(num_nom) FROM bdtfx_v1_02;
Line 30... Line 36...
30
define('_COSTE_TEXTE_MAX_BDTFX_NN', 103386 + 10000);
36
define('_COSTE_TEXTE_MAX_BDTFX_NN', 103386 + 10000);
31
 
37
 
32
/*restore_error_handler();
38
/*restore_error_handler();
33
  error_reporting(E_ALL);*/
39
  error_reporting(E_ALL);*/
34
class Textes {
40
class Textes {
35
	// paramètres autorisés
41
	// paramètres autorisés
36
	static $allow_params = array(
42
	static $allow_params = array(
37
		'txt.format', 'retour.format', 'retour.champs',
43
		'txt.format', 'retour.format', 'retour.champs',
38
		'recherche',
44
		'recherche',
39
		'masque.ns', 'masque.txt', 'masque.page', 'masque.tome', 'masque.famille',
45
		'masque.ns', 'masque.txt', 'masque.page', 'masque.tome', 'masque.famille', 'masque.nt',
40
		'masque.titre', // masque sur titre de la page wiki correspondante (page "clef" OR page "description")
46
		'masque.titre', // masque sur titre de la page wiki correspondante (page "clef" OR page "description")
41
		'navigation.depart', 'navigation.limite');
47
		'navigation.depart', 'navigation.limite');
42
	// et valeurs par défaut
48
	// et valeurs par défaut
Line 263... Line 269...
263
 
269
 
264
		if(array_key_exists('masque.tome', $params)) {
270
		if(array_key_exists('masque.tome', $params)) {
265
			$stack[] = 'c.tome = ' . intval($params['masque.tome']);
271
			$stack[] = 'c.tome = ' . intval($params['masque.tome']);
Line -... Line 272...
-
 
272
		}
-
 
273
 
-
 
274
		if(array_key_exists('masque.nt', $params)) {
-
 
275
			$stack[] = 'c.flore_bdtfx_nt = ' . intval($params['masque.nt']);
266
		}
276
		}
267
 
277
 
268
		// ajout de la contrainte sur coste:nn ou bdtfx:nn si un composant d'URL supplémentaire
278
		// ajout de la contrainte sur coste:nn ou bdtfx:nn si un composant d'URL supplémentaire
269
		// comportant un #id existe, cf self::requestFilterIds()
279
		// comportant un #id existe, cf self::requestFilterIds()
270
		$o_stack = array();
280
		$o_stack = array();
Line 385... Line 395...
385
		$p['navigation.depart'] = filter_var(@$params['navigation.depart'],
395
		$p['navigation.depart'] = filter_var(@$params['navigation.depart'],
386
												  FILTER_VALIDATE_INT,
396
												  FILTER_VALIDATE_INT,
387
												  array('options' => array('default' => NULL,
397
												  array('options' => array('default' => NULL,
388
																		   'min_range' => 0,
398
																		   'min_range' => 0,
389
																		   'max_range' => _COSTE_TEXTE_MAX_COSTE_NN)));
399
																		   'max_range' => _COSTE_TEXTE_MAX_COSTE_NN)));
-
 
400
		$p['masque.page'] = filter_var(@$params['masque.page'],
-
 
401
												  FILTER_VALIDATE_INT,
-
 
402
												  array('options' => array('default' => NULL,
-
 
403
																		   'min_range' => 0,
-
 
404
																		   'max_range' => _COSTE_TEXTE_MAX_COSTE_PAGE)));
-
 
405
		$p['masque.tome'] = filter_var(@$params['masque.tome'],
-
 
406
												  FILTER_VALIDATE_INT,
-
 
407
												  array('options' => array('default' => NULL,
-
 
408
																		   'min_range' => 0,
-
 
409
																		   'max_range' => _COSTE_TEXTE_MAX_COSTE_TOME)));
-
 
410
		$p['masque.nt'] = filter_var(@$params['masque.nt'],
-
 
411
												  FILTER_VALIDATE_INT,
-
 
412
												  array('options' => array('default' => NULL,
-
 
413
																		   'min_range' => 0,
-
 
414
																		   'max_range' => _COSTE_TEXTE_MAX_BDTFX_NT)));
Line 390... Line 415...
390
 
415
 
391
		// on filtre les NULL, FALSE et '', mais pas les 0, d'où le callback()
416
		// on filtre les NULL, FALSE et '', mais pas les 0, d'où le callback()
392
		// TODO: PHP-5.3
417
		// TODO: PHP-5.3
393
		$p = array_filter($p, create_function('$a','return !in_array($a, array("",false,null),true);'));
418
		$p = array_filter($p, create_function('$a','return !in_array($a, array("",false,null),true);'));