From e9911678116fccd6fc290d835a9213715dd60a22 Mon Sep 17 00:00:00 2001 From: Steve Allison Date: Wed, 20 Feb 2013 21:29:16 +0000 Subject: [PATCH] Move config variables to just-before-use --- defense.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/defense.php b/defense.php index 4f6b5a2..3e40f4e 100644 --- a/defense.php +++ b/defense.php @@ -71,8 +71,6 @@ class defense extends rcube_plugin { $this->load_config(); // set config variables, set defaults - $this->whitelist = $this->rc->config->get('defense_whitelist', array('127.0.0.1')); - $this->blacklist = $this->rc->config->get('defense_blacklist', array()); $this->fail_max = $this->rc->config->get('defense_fail_max', 5); $this->fail_reset = $this->rc->config->get('defense_fail_reset', 600); $this->ban_period = $this->rc->config->get('defense_ban_period', 120); @@ -99,6 +97,11 @@ class defense extends rcube_plugin { * @return string Login form HTML */ public function hookLoginForm($content) { + + // set config variables, set defaults + $this->whitelist = $this->rc->config->get('defense_whitelist', array('127.0.0.1')); + $this->blacklist = $this->rc->config->get('defense_blacklist', array()); + // If IP is listed in whitelist, return unmodified $content if ($this->isIPinArray($this->ipaddr, $this->whitelist)) { return $content;