1 | <?php |
||
36 | class Configuration |
||
37 | { |
||
38 | /** |
||
39 | * @var string |
||
40 | */ |
||
41 | const CONF_MAX_FAILURES = 'max_failures'; |
||
42 | |||
43 | /** |
||
44 | * @var string |
||
45 | */ |
||
46 | const CONF_DISABLED = 'disabled'; |
||
47 | |||
48 | /** |
||
49 | * @var string |
||
50 | */ |
||
51 | const CONF_RESTRICTION_TIME = 'restriction_time'; |
||
52 | |||
53 | /** |
||
54 | * @var string |
||
55 | */ |
||
56 | const CONF_SECONDS_TILL_RESET = 'seconds_till_reset'; |
||
57 | |||
58 | /** |
||
59 | * @var string |
||
60 | */ |
||
61 | const LOGGING_ENABLED = 'logging_enabled'; |
||
62 | |||
63 | /** |
||
64 | * @var string |
||
65 | */ |
||
66 | const LOGGING_LEVEL = 'logging_level'; |
||
67 | |||
68 | /** |
||
69 | * @var string |
||
70 | */ |
||
71 | const EXCLUDED_IPS = 'exclude_ips'; |
||
72 | |||
73 | /** |
||
74 | * @var string |
||
75 | */ |
||
76 | const X_FORWARDED_FOR = 'x_forwarded_for'; |
||
77 | |||
78 | /** |
||
79 | * @var string |
||
80 | */ |
||
81 | const CONF_IDENTIFICATION_IDENTIFIER = 'identification_identifier'; |
||
82 | |||
83 | /** |
||
84 | * @var array |
||
85 | */ |
||
86 | private $configuration = array(); |
||
87 | |||
88 | /** |
||
89 | * Initialize configuration array |
||
90 | */ |
||
91 | 11 | public function __construct() |
|
92 | { |
||
93 | 11 | $conf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['felogin_bruteforce_protection']); |
|
94 | 11 | if (is_array($conf)) { |
|
95 | 10 | $this->configuration = $conf; |
|
96 | } |
||
97 | 11 | } |
|
98 | |||
99 | /** |
||
100 | * Tells if the protection is enabled. |
||
101 | * |
||
102 | * @return boolean |
||
103 | */ |
||
104 | 2 | public function isEnabled() |
|
111 | |||
112 | /** |
||
113 | * Returns the maximum number of allowed failures for an ip. |
||
114 | * |
||
115 | * @return integer |
||
116 | */ |
||
117 | 1 | public function getMaximumNumberOfFailures() |
|
121 | |||
122 | /** |
||
123 | * Returns the number of seconds of the restriction time. |
||
124 | * |
||
125 | * @return integer |
||
126 | */ |
||
127 | 1 | public function getRestrictionTime() |
|
131 | |||
132 | /** |
||
133 | * Returns the number of seconds after an entry is resetted. |
||
134 | * |
||
135 | * @return integer |
||
136 | */ |
||
137 | 1 | public function getResetTime() |
|
141 | |||
142 | /** |
||
143 | * @return boolean |
||
144 | */ |
||
145 | public function isLoggingEnabled() |
||
149 | |||
150 | /** |
||
151 | * @return int |
||
152 | */ |
||
153 | public function getLogLevel() |
||
157 | |||
158 | /** |
||
159 | * @return array |
||
160 | */ |
||
161 | 2 | public function getExcludedIps() |
|
165 | |||
166 | /** |
||
167 | * @return boolean |
||
168 | */ |
||
169 | 2 | public function getXForwardedFor() |
|
173 | |||
174 | /** |
||
175 | * @return integer |
||
176 | **/ |
||
177 | 1 | public function getIdentificationIdentifier() |
|
181 | |||
182 | /** |
||
183 | * @param string $key |
||
184 | * @return mixed |
||
185 | * @throws Exception |
||
186 | */ |
||
187 | 11 | public function get($key) |
|
194 | } |
||
195 |