Subversion Repositories eFlore/Projets.eflore-projets

Rev

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

Rev 858 Rev 859
Line 3... Line 3...
3
 * @copyright 2013 Tela Botanica (accueil@tela-botanica.org)
3
 * @copyright 2013 Tela Botanica (accueil@tela-botanica.org)
4
 * @author Raphaël Droz <raphael@tela-botanica.org>
4
 * @author Raphaël Droz <raphael@tela-botanica.org>
5
 * @license GPL v3 <http://www.gnu.org/licenses/gpl.txt>
5
 * @license GPL v3 <http://www.gnu.org/licenses/gpl.txt>
6
 * @license CECILL v2 <http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt>
6
 * @license CECILL v2 <http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt>
7
 *
7
 *
8
 * pattern: /service:eflore:0.1/coste/textes/bdtfx.nn:182
8
 * pattern: /service:eflore:0.1/coste/textes/bdtfx.nn:182,631
9
 * params: txt.format=(htm|txt) ,  retour.champs=(titre,texte,...) , retour.format=(min|max), ...
9
 * params: txt.format=(htm|txt) ,  retour.champs=(titre,texte,...) , retour.format=(min|max), ...
10
 *
10
 *
11
 * Ce webservice est censé pouvoir:
11
 * Ce webservice est censé pouvoir:
12
 * 1) retourner des informations (choisies) à propos d'un taxon donné (à partir de son numéro nomenclatural
12
 * 1) retourner des informations (choisies) à propos d'un ou plusieurs taxon(s) donné(s)
-
 
13
 *	  (à partir de son numéro nomenclatural
13
 * 2) retourner des informations (choisies) à propos de taxons recherchés (à partir de divers critères)
14
 * 2) retourner des informations (choisies) à propos de taxons recherchés
-
 
15
 *	  (à partir de divers critères)
14
 *
16
 *
15
 * TODO: masque.titre => masque.tag
17
 * TODO: masque.titre => masque.tag
-
 
18
 * TODO: clarifier l'attribut "tag" retourné (tag de la description ou des clefs de détermination)
16
 *
19
 *
17
 */
20
 */
Line 18... Line 21...
18
 
21
 
19
// affecte le nombre d'ids autorisés dans le dernier segment d'URL
22
// affecte le nombre d'ids autorisés dans le dernier segment d'URL
20
// *et* la valeur maximale autorisée pour navigation.limite.
23
// *et* la valeur maximale autorisée pour navigation.limite.
Line -... Line 24...
-
 
24
define('_COSTE_TEXTE_MAX_RESULT_LIMIT', 500);
-
 
25
 
-
 
26
// simplifie et accélère la sanitization de l'input:
-
 
27
// SELECT MAX(num_nom) FROM coste_v2_00;
21
define('_COSTE_TEXTE_MAX_RESULT_LIMIT', 500);
28
define('_COSTE_TEXTE_MAX_NUM_NOM', 7015 + 1000);
22
 
29
 
23
/*restore_error_handler();
30
/*restore_error_handler();
24
  error_reporting(E_ALL);*/
31
  error_reporting(E_ALL);*/
25
class Textes {
32
class Textes {
Line 346... Line 353...
346
																		   'max_range' => _COSTE_TEXTE_MAX_RESULT_LIMIT)));
353
																		   'max_range' => _COSTE_TEXTE_MAX_RESULT_LIMIT)));
347
		$p['navigation.depart'] = filter_var(@$params['navigation.depart'],
354
		$p['navigation.depart'] = filter_var(@$params['navigation.depart'],
348
												  FILTER_VALIDATE_INT,
355
												  FILTER_VALIDATE_INT,
349
												  array('options' => array('default' => NULL,
356
												  array('options' => array('default' => NULL,
350
																		   'min_range' => 0,
357
																		   'min_range' => 0,
351
																		   'max_range' => 10000))); // count(1) from coste_v2_00
358
																		   'max_range' => _COSTE_TEXTE_MAX_NUM_NOM)));
Line 352... Line 359...
352
 
359
 
353
		// on filtre les NULL, FALSE et '', mais pas les 0, d'où le callback()
360
		// on filtre les NULL, FALSE et '', mais pas les 0, d'où le callback()
354
		// TODO: PHP-5.3
361
		// TODO: PHP-5.3
355
		$p = array_filter($p, create_function('$a','return !in_array($a, array("",false,null),true);'));
362
		$p = array_filter($p, create_function('$a','return !in_array($a, array("",false,null),true);'));
Line 396... Line 403...
396
					   self::$default_params['retour.champs']
403
					   self::$default_params['retour.champs']
397
		);
404
		);
398
	}
405
	}
Line 399... Line 406...
399
 
406
 
-
 
407
	static function getNN($refnn) {
-
 
408
		if(is_numeric($refnn)) {
400
	static function getNN($refnn) {
409
			$t = intval($refnn);
-
 
410
			if($t >= 1 && $t < _COSTE_TEXTE_MAX_NUM_NOM) return $t;
-
 
411
			return FALSE;
401
		if(is_numeric($refnn) && intval($refnn) >= 1) return intval($refnn);
412
		}
402
		if(strpos($refnn, 'bdtfx.nn:') !== 0) return FALSE;
413
		if(strpos($refnn, 'bdtfx.nn:') !== 0) return FALSE;
403
		return intval(str_replace('bdtfx.nn:', '', $refnn));
414
		return intval(str_replace('bdtfx.nn:', '', $refnn));
404
	}
415
	}