new: Allow the new type "substring" to be used for warninglists

pull/1857/head
Iglocska 2017-01-18 12:12:28 +01:00
parent 0cbcffd5c9
commit 31b6ffd625
1 changed files with 11 additions and 0 deletions

View File

@ -164,6 +164,8 @@ class Warninglist extends AppModel{
$result = $this->__evalCIDRList($listValues, $value[$component]);
} else if ($listType === 'string') {
$result = $this->__evalString($listValues, $value[$component]);
} else if ($listType === 'substring') {
$result = $this->__evalSubString($listValues, $value[$component]);
}
if ($result) return ($component + 1);
}
@ -242,6 +244,15 @@ class Warninglist extends AppModel{
if (in_array($value, $listValues)) return true;
return false;
}
private function __evalSubString($listValues, $value) {
foreach ($listValues as $listValue) {
if (strpos($value, $listValue) !== false) {
return true;
}
}
return false;
}
public function fetchTLDLists() {
$tldLists = $this->find('list', array('conditions' => array('Warninglist.name' => $this->__tlds, 'Warninglist.enabled' => 1), 'recursive' => -1, 'fields' => array('Warninglist.id', 'Warninglist.name')));