Subversion Repositories eFlore/Projets.eflore-projets

Compare Revisions

Ignore whitespace Rev 938 → Rev 939

/trunk/services/modules/0.1/coste/Images.php
95,22 → 95,13
private function analyserMasque($valeur, $type_masque) {
$this->masque[] = "$type_masque=$valeur";
if (empty($valeur)) {
if (!$valeur) {
$e = 'renseignez une valeur pour masque.nn';
$this->renvoyerErreur(RestServeur::HTTP_CODE_MAUVAISE_REQUETE,$e);
} elseif (preg_match('/^[0-9]+$/', $valeur)) {
$this->requete_condition[] = " flore_bdtfx_".$type_masque." = $valeur";
} elseif (preg_match('/[0-9]+/', $valeur)){
// suppression des valeurs vides
while(strstr($valeur,',,')) {
$valeur = str_replace(',,',',',$valeur);
}
$condition = " flore_bdtfx_".$type_masque." IN ($valeur) AND flore_bdtfx_".$type_masque." not in (0, '')";
$this->requete_condition[] = $condition;
} else {
$e = "valeur incorrecte pour masque.".$type_masque;
$this->renvoyerErreur(RestServeur::HTTP_CODE_MAUVAISE_REQUETE,$e);
}
$arr = array_filter(array_map('intval', explode(',', $valeur)));
if(!$arr) $this->renvoyerErreur(RestServeur::HTTP_CODE_MAUVAISE_REQUETE, "valeur incorrecte pour masque.".$type_masque);
$this->requete_condition[] = sprintf(" flore_bdtfx_%s IN (%s)", $type_masque, implode(',', $arr));
}