Moved the filter sanitation to insure no empty filters will get loaded

This commit is contained in:
2019-06-05 13:14:05 +02:00
parent e1f32c142b
commit 4a878e32ef
16 changed files with 362 additions and 242 deletions

View File

@ -10866,13 +10866,16 @@ class Interpretation extends Fields
$type = ComponentbuilderHelper::safeString($filter['custom']['type'], 'F');
$otherFilter[] = PHP_EOL . $this->_t(2) . "//" . $this->setLine(__LINE__) . " Set " . $CodeName . " Selection";
$otherFilter[] = $this->_t(2) . "\$this->" . $codeName . "Options = JFormHelper::loadFieldType('" . $type . "')->options;";
$otherFilter[] = $this->_t(2) . "if (\$this->" . $codeName . "Options)";
$otherFilter[] = $this->_t(2) . "//" . $this->setLine(__LINE__) . " We do some sanitation for " . $Codename . " filter";
$otherFilter[] = $this->_t(2) . "if (" . $Component . "Helper::checkArray(\$this->" . $codeName . "Options) &&";
$otherFilter[] = $this->_t(3) . "isset(\$this->" . $codeName . "Options[0]->value) &&";
$otherFilter[] = $this->_t(3) . "!" . $Component . "Helper::checkString(\$this->" . $codeName . "Options[0]->value))";
$otherFilter[] = $this->_t(2) . "{";
$otherFilter[] = $this->_t(3) . "unset(\$this->" . $codeName . "Options[0]);";
$otherFilter[] = $this->_t(2) . "}";
$otherFilter[] = $this->_t(2) . "//" . $this->setLine(__LINE__) . " Only load " . $Codename . " filter if it has values";
$otherFilter[] = $this->_t(2) . "if (" . $Component . "Helper::checkArray(\$this->" . $codeName . "Options))";
$otherFilter[] = $this->_t(2) . "{";
$otherFilter[] = $this->_t(3) . "//" . $this->setLine(__LINE__) . " We do some sanitation for " . $Codename . " filter";
$otherFilter[] = $this->_t(3) . "if (isset(\$this->" . $codeName . "Options[0]) && !" . $Component . "Helper::checkString(\$this->" . $codeName . "Options[0]->value))";
$otherFilter[] = $this->_t(3) . "{";
$otherFilter[] = $this->_t(4) . "unset(\$this->" . $codeName . "Options[0]);";
$otherFilter[] = $this->_t(3) . "}";
$otherFilter[] = $this->_t(3) . "//" . $this->setLine(__LINE__) . " " . $CodeName . " Filter";
$otherFilter[] = $this->_t(3) . "JHtmlSidebar::addFilter(";
$otherFilter[] = $this->_t(4) . "'- Select '.JText:" . ":_('" . $filter['lang'] . "').' -',";
@ -10905,13 +10908,16 @@ class Interpretation extends Fields
}
$otherFilter[] = PHP_EOL . $this->_t(2) . "//" . $this->setLine(__LINE__) . " Set " . $Codename . " Selection";
$otherFilter[] = $this->_t(2) . "\$this->" . $filter['code'] . "Options = " . $functionName;
$otherFilter[] = $this->_t(2) . "if (\$this->" . $filter['code'] . "Options)";
$otherFilter[] = $this->_t(2) . "//" . $this->setLine(__LINE__) . " We do some sanitation for " . $Codename . " filter";
$otherFilter[] = $this->_t(2) . "if (" . $Component . "Helper::checkArray(\$this->" . $filter['code'] . "Options) &&";
$otherFilter[] = $this->_t(3) . "isset(\$this->" . $filter['code'] . "Options[0]->value) &&";
$otherFilter[] = $this->_t(3) . "!" . $Component . "Helper::checkString(\$this->" . $filter['code'] . "Options[0]->value))";
$otherFilter[] = $this->_t(2) . "{";
$otherFilter[] = $this->_t(3) . "unset(\$this->" . $filter['code'] . "Options[0]);";
$otherFilter[] = $this->_t(2) . "}";
$otherFilter[] = $this->_t(2) . "//" . $this->setLine(__LINE__) . " Only load " . $Codename . " filter if it has values";
$otherFilter[] = $this->_t(2) . "if (" . $Component . "Helper::checkArray(\$this->" . $filter['code'] . "Options))";
$otherFilter[] = $this->_t(2) . "{";
$otherFilter[] = $this->_t(3) . "//" . $this->setLine(__LINE__) . " We do some sanitation for " . $Codename . " filter";
$otherFilter[] = $this->_t(3) . "if (isset(\$this->" . $filter['code'] . "Options[0]) && !" . $Component . "Helper::checkString(\$this->" . $filter['code'] . "Options[0]->value))";
$otherFilter[] = $this->_t(3) . "{";
$otherFilter[] = $this->_t(4) . "unset(\$this->" . $filter['code'] . "Options[0]);";
$otherFilter[] = $this->_t(3) . "}";
$otherFilter[] = $this->_t(3) . "//" . $this->setLine(__LINE__) . " " . $Codename . " Filter";
$otherFilter[] = $this->_t(3) . "JHtmlSidebar::addFilter(";
$otherFilter[] = $this->_t(4) . "'- Select '.JText:" . ":_('" . $filter['lang'] . "').' -',";