Skip to content

Commit

Permalink
clean taxon string before using it in getTaxonWhereFrag string in set…
Browse files Browse the repository at this point in the history
…SqlWhere
  • Loading branch information
Atticus29 committed Jun 24, 2024
1 parent 773a686 commit 6250abd
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions classes/OccurrenceTaxaManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ public function getTaxonWhereFrag(){
$tidInArr = array();
$taxonType = $this->taxaArr['taxontype'];
foreach($this->taxaArr['taxa'] as $searchTaxon => $searchArr){
$cleanedSearchTaxon = $this->cleanInStr($searchTaxon);
if(isset($searchArr['taxontype'])) $taxonType = $searchArr['taxontype'];
if($taxonType == TaxaSearchType::TAXONOMIC_GROUP){
//Class, order, or other higher rank
Expand All @@ -251,10 +252,10 @@ public function getTaxonWhereFrag(){
//$sqlWhereTaxa .= 'OR (((ts.family = "'.$searchTaxon.'") AND (ts.taxauthid = '.$this->taxAuthId.')) OR o.sciname = "'.$searchTaxon.'") ';
if(isset($searchArr['tid'])){
$tidArr = array_keys($searchArr['tid']);
$sqlWhereTaxa .= 'OR ((ts.family = "'.$searchTaxon.'") OR (ts.tid IN('.implode(',', $tidArr).'))) ';
$sqlWhereTaxa .= 'OR ((ts.family = "'.$cleanedSearchTaxon.'") OR (ts.tid IN('.implode(',', $tidArr).'))) ';
}
else{
$sqlWhereTaxa .= 'OR ((o.family = "'.$searchTaxon.'") OR (o.sciname = "'.$searchTaxon.'")) ';
$sqlWhereTaxa .= 'OR ((o.family = "'.$cleanedSearchTaxon.'") OR (o.sciname = "'.$cleanedSearchTaxon.'")) ';
}
}
else{
Expand Down

0 comments on commit 6250abd

Please sign in to comment.