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)); |
} |
|
|