PluginProbe
The WP Remote WordPress Plugin / 4.79
The WP Remote WordPress Plugin v4.79
6.72 6.69 6.65 6.62 6.48 6.47 4.87 4.97 5.05 5.09 5.16 5.22 5.24 5.25 5.38 5.41 5.42 5.45 5.47 5.53 5.56 5.65 5.68 5.72 5.73 All 53 releases
wpremote / protect / fw / config.php

config.php in The WP Remote WordPress Plugin 4.79, at protect/fw/config.php

124 lines 4.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 if (! (defined('ABSPATH') || defined('MCDATAPATH')) ) exit;
4 if (!class_exists('BVFWConfig')) :
5
6 class BVFWConfig {
7 public $mode;
8 public $requestProfilingMode;
9 public $roleLevel;
10 public $ipCookieMode;
11 public $adminCookieMode;
12 public $bypassLevel;
13 public $customRoles;
14 public $cookieKey;
15 public $cookiePath;
16 public $cookieDomain;
17 public $loggingMode;
18 public $rulesMode;
19
20 public static $requests_table = 'fw_requests';
21 public static $roleLevels = array(
22 'administrator' => BVFWConfig::ROLE_LEVEL_ADMIN,
23 'editor' => BVFWConfig::ROLE_LEVEL_EDITOR,
24 'author' => BVFWConfig::ROLE_LEVEL_AUTHOR,
25 'contributor' => BVFWConfig::ROLE_LEVEL_CONTRIBUTOR,
26 'subscriber' => BVFWConfig::ROLE_LEVEL_SUBSCRIBER
27 );
28
29 function __construct($confHash) {
30 $this->mode = array_key_exists('mode', $confHash) ? intval($confHash['mode']) : BVFWConfig::DISABLED;
31 $this->requestProfilingMode = array_key_exists('reqprofilingmode', $confHash) ? intval($confHash['reqprofilingmode']) : BVFWConfig::REQ_PROFILING_MODE_DISABLED;
32 $this->ipCookieMode = array_key_exists('ipcookiemode', $confHash) ? intval($confHash['ipcookiemode']) : BVFWConfig::IP_COOKIE_MODE_DISABLED;
33 $this->adminCookieMode = array_key_exists('admincookiemode', $confHash) ? intval($confHash['admincookiemode']) : BVFWConfig::ADMIN_COOKIE_MODE_DISABLED;
34 $this->loggingMode = array_key_exists('loggingmode', $confHash) ? intval($confHash['loggingmode']) : BVFWConfig::LOGGING_MODE_VISITOR;
35 $this->bypassLevel = array_key_exists('bypasslevel', $confHash) ? intval($confHash['bypasslevel']) : BVFWConfig::ROLE_LEVEL_CONTRIBUTOR;
36 $this->customRoles = array_key_exists('customroles', $confHash) ? $confHash['customroles'] : array();
37 $this->cookieKey = array_key_exists('cookiekey', $confHash) ? $confHash['cookiekey'] : "";
38 $this->cookiePath = array_key_exists('cookiepath', $confHash) ? $confHash['cookiepath'] : "";
39 $this->cookieDomain = array_key_exists('cookiedomain', $confHash) ? $confHash['cookiedomain'] : "";
40 $this->canSetCachePreventionCookie = array_key_exists('cansetcachepreventioncookie', $confHash) ?
41 $confHash['cansetcachepreventioncookie'] : false;
42 $this->rulesMode = array_key_exists('rulesmode', $confHash) ? intval($confHash['rulesmode']) : BVFWConfig::DISABLED;
43 }
44
45 #mode
46 const DISABLED = 1;
47 const AUDIT = 2;
48 const PROTECT = 3;
49
50 #Request Profiling Mode
51 const REQ_PROFILING_MODE_DISABLED = 1;
52 const REQ_PROFILING_MODE_NORMAL = 2;
53 const REQ_PROFILING_MODE_DEBUG = 3;
54
55 #IP Cookie Mode
56 const IP_COOKIE_MODE_ENABLED = 1;
57 const IP_COOKIE_MODE_DISABLED = 2;
58
59 #Admin Cookie Mode
60 const ADMIN_COOKIE_MODE_ENABLED = 1;
61 const ADMIN_COOKIE_MODE_DISABLED = 2;
62
63 #Role Level
64 const ROLE_LEVEL_SUBSCRIBER = 1;
65 const ROLE_LEVEL_CONTRIBUTOR = 2;
66 const ROLE_LEVEL_AUTHOR = 3;
67 const ROLE_LEVEL_EDITOR = 4;
68 const ROLE_LEVEL_ADMIN = 5;
69 const ROLE_LEVEL_CUSTOM = 6;
70
71 #WebServer Conf Mode
72 const MODE_APACHEMODPHP = 1;
73 const MODE_APACHESUPHP = 2;
74 const MODE_CGI_FASTCGI = 3;
75 const MODE_NGINX = 4;
76 const MODE_LITESPEED = 5;
77 const MODE_IIS = 6;
78
79 #Logging Mode
80 const LOGGING_MODE_VISITOR = 1;
81 const LOGGING_MODE_COMPLETE = 2;
82 const LOGGING_MODE_DISABLED = 3;
83
84 #Valid mc_data filenames (not used anywhere)
85 public static $validMcDataFilenames = array('mc.conf', 'mc_ips.conf', 'mc_rules.json');
86 public static $validDeletableFiles = array('mc.conf', 'mc_ips.conf', 'malcare-waf.php', 'mc.log', 'mc_data', 'mc_rules.json');
87
88 public function isActive() {
89 return ($this->mode !== BVFWConfig::DISABLED);
90 }
91
92 public function isProtecting() {
93 return ($this->mode === BVFWConfig::PROTECT);
94 }
95
96 public function isAuditing() {
97 return ($this->mode === BVFWConfig::AUDIT);
98 }
99
100 public function isReqProfilingModeDebug() {
101 return ($this->requestProfilingMode === BVFWConfig::REQ_PROFILING_MODE_DEBUG);
102 }
103
104 public function canProfileReqInfo() {
105 return ($this->requestProfilingMode !== BVFWConfig::REQ_PROFILING_MODE_DISABLED);
106 }
107
108 public function isCompleteLoggingEnabled() {
109 return ($this->loggingMode === BVFWConfig::LOGGING_MODE_COMPLETE);
110 }
111
112 public function isVisitorLoggingEnabled() {
113 return ($this->loggingMode === BVFWConfig::LOGGING_MODE_VISITOR);
114 }
115
116 public function isLoggingDisabled() {
117 return ($this->loggingMode === BVFWConfig::LOGGING_MODE_DISABLED);
118 }
119
120 public function isRulesModeEnabled() {
121 return ($this->rulesMode === BVFWConfig::PROTECT);
122 }
123 }
124 endif;