don't try to get to database at initialize time
This commit is contained in:
parent
642adc3b00
commit
482faf6614
|
@ -49,32 +49,26 @@ class BlacklistPlugin extends Plugin
|
||||||
public $urls = array();
|
public $urls = array();
|
||||||
public $canAdmin = true;
|
public $canAdmin = true;
|
||||||
|
|
||||||
private $_nicknamePatterns = array();
|
function _getNicknamePatterns()
|
||||||
private $_urlPatterns = array();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Initialize the plugin
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
|
|
||||||
function initialize()
|
|
||||||
{
|
{
|
||||||
$confNicknames = $this->_configArray('blacklist', 'nicknames');
|
$confNicknames = $this->_configArray('blacklist', 'nicknames');
|
||||||
|
|
||||||
$dbNicknames = Nickname_blacklist::getPatterns();
|
$dbNicknames = Nickname_blacklist::getPatterns();
|
||||||
|
|
||||||
$this->_nicknamePatterns = array_merge($this->nicknames,
|
return array_merge($this->nicknames,
|
||||||
$confNicknames,
|
$confNicknames,
|
||||||
$dbNicknames);
|
$dbNicknames);
|
||||||
|
}
|
||||||
|
|
||||||
|
function _getUrlPatterns()
|
||||||
|
{
|
||||||
$confURLs = $this->_configArray('blacklist', 'urls');
|
$confURLs = $this->_configArray('blacklist', 'urls');
|
||||||
|
|
||||||
$dbURLs = Homepage_blacklist::getPatterns();
|
$dbURLs = Homepage_blacklist::getPatterns();
|
||||||
|
|
||||||
$this->_urlPatterns = array_merge($this->urls,
|
return array_merge($this->urls,
|
||||||
$confURLs,
|
$confURLs,
|
||||||
$dbURLs);
|
$dbURLs);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -265,7 +259,9 @@ class BlacklistPlugin extends Plugin
|
||||||
|
|
||||||
private function _checkUrl($url)
|
private function _checkUrl($url)
|
||||||
{
|
{
|
||||||
foreach ($this->_urlPatterns as $pattern) {
|
$patterns = $this->_getUrlPatterns();
|
||||||
|
|
||||||
|
foreach ($patterns as $pattern) {
|
||||||
if (preg_match("/$pattern/", $url)) {
|
if (preg_match("/$pattern/", $url)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -286,7 +282,9 @@ class BlacklistPlugin extends Plugin
|
||||||
|
|
||||||
private function _checkNickname($nickname)
|
private function _checkNickname($nickname)
|
||||||
{
|
{
|
||||||
foreach ($this->_nicknamePatterns as $pattern) {
|
$patterns = $this->_getNicknamePatterns();
|
||||||
|
|
||||||
|
foreach ($patterns as $pattern) {
|
||||||
if (preg_match("/$pattern/", $nickname)) {
|
if (preg_match("/$pattern/", $nickname)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user