Subversion Repositories eFlore/Projets.eflore-projets

Compare Revisions

Ignore whitespace Rev 858 → Rev 859

/trunk/services/modules/0.1/coste/Textes.php
5,14 → 5,17
* @license GPL v3 <http://www.gnu.org/licenses/gpl.txt>
* @license CECILL v2 <http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt>
*
* pattern: /service:eflore:0.1/coste/textes/bdtfx.nn:182
* pattern: /service:eflore:0.1/coste/textes/bdtfx.nn:182,631
* params: txt.format=(htm|txt) , retour.champs=(titre,texte,...) , retour.format=(min|max), ...
*
* Ce webservice est censé pouvoir:
* 1) retourner des informations (choisies) à propos d'un taxon donné (à partir de son numéro nomenclatural
* 2) retourner des informations (choisies) à propos de taxons recherchés (à partir de divers critères)
* 1) retourner des informations (choisies) à propos d'un ou plusieurs taxon(s) donné(s)
* (à partir de son numéro nomenclatural
* 2) retourner des informations (choisies) à propos de taxons recherchés
* (à partir de divers critères)
*
* TODO: masque.titre => masque.tag
* TODO: clarifier l'attribut "tag" retourné (tag de la description ou des clefs de détermination)
*
*/
 
20,6 → 23,10
// *et* la valeur maximale autorisée pour navigation.limite.
define('_COSTE_TEXTE_MAX_RESULT_LIMIT', 500);
 
// simplifie et accélère la sanitization de l'input:
// SELECT MAX(num_nom) FROM coste_v2_00;
define('_COSTE_TEXTE_MAX_NUM_NOM', 7015 + 1000);
 
/*restore_error_handler();
error_reporting(E_ALL);*/
class Textes {
348,7 → 355,7
FILTER_VALIDATE_INT,
array('options' => array('default' => NULL,
'min_range' => 0,
'max_range' => 10000))); // count(1) from coste_v2_00
'max_range' => _COSTE_TEXTE_MAX_NUM_NOM)));
 
// on filtre les NULL, FALSE et '', mais pas les 0, d'où le callback()
// TODO: PHP-5.3
398,7 → 405,11
}
 
static function getNN($refnn) {
if(is_numeric($refnn) && intval($refnn) >= 1) return intval($refnn);
if(is_numeric($refnn)) {
$t = intval($refnn);
if($t >= 1 && $t < _COSTE_TEXTE_MAX_NUM_NOM) return $t;
return FALSE;
}
if(strpos($refnn, 'bdtfx.nn:') !== 0) return FALSE;
return intval(str_replace('bdtfx.nn:', '', $refnn));
}