File tree Expand file tree Collapse file tree 1 file changed +15
-8
lines changed
Expand file tree Collapse file tree 1 file changed +15
-8
lines changed Original file line number Diff line number Diff line change 33use CrowdSecBouncer \Constants ;
44
55require_once __DIR__ . '/Bounce.php ' ;
6+ require_once __DIR__ .'/options-config.php ' ;
7+
8+ function getConfigs ()
9+ {
10+ $ crowdSecWpPluginOptions = getCrowdSecOptionsConfig ();
11+ $ finalConfigs = [];
12+ foreach ($ crowdSecWpPluginOptions as $ option ) {
13+ $ finalConfigs [$ option ['name ' ]] = get_option ($ option ['name ' ]);
14+ }
15+
16+ return $ finalConfigs ;
17+ }
18+
619
720function safelyBounceCurrentIp ()
821{
@@ -13,14 +26,8 @@ function safelyBounceCurrentIp()
1326 if (\PHP_SESSION_NONE === session_status ()) {
1427 session_start ();
1528 }
16- if (!file_exists (__DIR__ .'/standalone-settings.php ' )) {
17- return ;
18- }
19- require_once __DIR__ .'/standalone-settings.php ' ;
20- $ crowdSecConfig = json_decode ($ crowdSecJsonStandaloneConfig , true );
21- if (!count ($ crowdSecConfig )) {
22- return ;
23- }
29+
30+ $ crowdSecConfig = getConfigs ();
2431 // Retro compatibility with crowdsec php lib < 0.14.0
2532 if ($ crowdSecConfig ['crowdsec_bouncing_level ' ] === 'normal_boucing ' ){
2633 $ crowdSecConfig ['crowdsec_bouncing_level ' ] = Constants::BOUNCING_LEVEL_NORMAL ;
You can’t perform that action at this time.
0 commit comments