PluginProbe
The WP Remote WordPress Plugin / 6.76
The WP Remote WordPress Plugin v6.76
6.76 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 All 54 releases
wpremote / protect / fw / rule.php

rule.php in The WP Remote WordPress Plugin 6.76, at protect/fw/rule.php

210 lines 12.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 if (!defined('ABSPATH') && !defined('MCDATAPATH')) exit;
3
4 if (!class_exists('WPRProtectFWRule_V676')) :
5 class WPRProtectFWRule_V676 {
6 public $id;
7 public $logic;
8 public $actions;
9 public $execute_on;
10 public $min_rule_engine_ver;
11 public $max_rule_engine_ver;
12 public $config = array();
13 public $opts = array();
14
15 const EXE_ON_BOOT = 1;
16 const EXE_ON_PRE_UPDATE_OPTION = 2;
17 const EXE_ON_PRE_DELETE_POST = 3;
18 const EXE_ON_WP_INSERT_POST_EMPTY_CONTENT = 4;
19 const EXE_ON_INSERT_USER_META = 5;
20 const EXE_ON_DELETE_OPTION = 6;
21 const EXE_ON_DELETE_USER = 7;
22 const EXE_ON_PASSWORD_RESET = 8;
23 const EXE_ON_SEND_AUTH_COOKIES = 9;
24 const EXE_ON_SET_AUTH_COOKIE = 10;
25 const EXE_ON_INIT = 11;
26 const EXE_ON_USER_REGISTER = 12;
27 const EXE_ON_ADD_USER_META = 13;
28 const EXE_ON_UPDATE_USER_METADATA = 14;
29 const EXE_ON_UPDATE_USER_META = 15;
30 const EXE_ON_ADD_OPTION = 16;
31 const EXE_ON_WP_PRE_INSERT_USER_DATA = 17;
32 const EXE_ON_REST_REQUEST_BEFORE_CALLBACKS = 18;
33 const EXE_ON_ADMIN_INIT = 19;
34 const EXE_ON_WP_HANDLE_UPLOAD_PREFILTER = 20;
35 const EXE_ON_TEMPLATE_REDIRECT = 21;
36 const EXE_ON_WP_LOADED = 22;
37 const EXE_ON_ADD_POST_METADATA = 23;
38 const EXE_ON_UPDATE_POST_METADATA = 24;
39 const EXE_ON_DELETE_POST_METADATA = 25;
40 const EXE_ON_ADD_TERM_METADATA = 26;
41 const EXE_ON_UPDATE_TERM_METADATA = 27;
42 const EXE_ON_DELETE_TERM_METADATA = 28;
43 const EXE_ON_ADD_COMMENT_METADATA = 29;
44 const EXE_ON_UPDATE_COMMENT_METADATA = 30;
45 const EXE_ON_DELETE_COMMENT_METADATA = 31;
46 const EXE_ON_ADD_USER_METADATA = 32;
47 const EXE_ON_DELETE_USER_METADATA = 33;
48
49 const SQLIREGEX = '/(?:[^\\w<]|\\/\\*\\![0-9]*|^)(?:
50 @@HOSTNAME|
51 ALTER|ANALYZE|ASENSITIVE|
52 BEFORE|BENCHMARK|BETWEEN|BIGINT|BINARY|BLOB|
53 CALL|CASE|CHANGE|CHAR|CHARACTER|CHAR_LENGTH|COLLATE|COLUMN|CONCAT|CONDITION|CONSTRAINT|CONTINUE|CONVERT|CREATE|CROSS|CURRENT_DATE|CURRENT_TIME|CURRENT_TIMESTAMP|CURRENT_USER|CURSOR|
54 DATABASE|DATABASES|DAY_HOUR|DAY_MICROSECOND|DAY_MINUTE|DAY_SECOND|DECIMAL|DECLARE|DEFAULT|DELAYED|DELETE|DESCRIBE|DETERMINISTIC|DISTINCT|DISTINCTROW|DOUBLE|DROP|DUAL|DUMPFILE|
55 EACH|ELSE|ELSEIF|ELT|ENCLOSED|ESCAPED|EXISTS|EXIT|EXPLAIN|EXTRACTVALUE|
56 FETCH|FLOAT|FLOAT4|FLOAT8|FORCE|FOREIGN|FROM|FULLTEXT|
57 GRANT|GROUP|HAVING|HEX|HIGH_PRIORITY|HOUR_MICROSECOND|HOUR_MINUTE|HOUR_SECOND|
58 IFNULL|IGNORE|INDEX|INFILE|INNER|INOUT|INSENSITIVE|INSERT|INTERVAL|ISNULL|ITERATE|
59 JOIN|KILL|LEADING|LEAVE|LIMIT|LINEAR|LINES|LOAD|LOAD_FILE|LOCALTIME|LOCALTIMESTAMP|LOCK|LONG|LONGBLOB|LONGTEXT|LOOP|LOW_PRIORITY|
60 MASTER_SSL_VERIFY_SERVER_CERT|MATCH|MAXVALUE|MEDIUMBLOB|MEDIUMINT|MEDIUMTEXT|MID|MIDDLEINT|MINUTE_MICROSECOND|MINUTE_SECOND|MODIFIES|
61 NATURAL|NO_WRITE_TO_BINLOG|NULL|NUMERIC|OPTION|ORD|ORDER|OUTER|OUTFILE|
62 PRECISION|PRIMARY|PRIVILEGES|PROCEDURE|PROCESSLIST|PURGE|
63 RANGE|READ_WRITE|REGEXP|RELEASE|REPEAT|REQUIRE|RESIGNAL|RESTRICT|RETURN|REVOKE|RLIKE|ROLLBACK|
64 SCHEMA|SCHEMAS|SECOND_MICROSECOND|SELECT|SENSITIVE|SEPARATOR|SHOW|SIGNAL|SLEEP|SMALLINT|SPATIAL|SPECIFIC|SQLEXCEPTION|SQLSTATE|SQLWARNING|SQL_BIG_RESULT|SQL_CALC_FOUND_ROWS|SQL_SMALL_RESULT|STARTING|STRAIGHT_JOIN|SUBSTR|
65 TABLE|TERMINATED|TINYBLOB|TINYINT|TINYTEXT|TRAILING|TRANSACTION|TRIGGER|
66 UNDO|UNHEX|UNION|UNLOCK|UNSIGNED|UPDATE|UPDATEXML|USAGE|USING|UTC_DATE|UTC_TIME|UTC_TIMESTAMP|
67 VALUES|VARBINARY|VARCHAR|VARCHARACTER|VARYING|WHEN|WHERE|WHILE|WRITE|YEAR_MONTH|ZEROFILL)(?=[^\\w]|$)/ix';
68 const XSSREGEX = '/(?:
69 #tags
70 (?:\\<|\\+ADw\\-|\\xC2\\xBC)(script|iframe|svg|object|embed|applet|link|style|meta|\\/\\/|\\?xml\\-stylesheet)(?:[^\\w]|\\xC2\\xBE)|
71 #protocols
72 (?:^|[^\\w])(?:(?:\\s*(?:&\\#(?:x0*6a|0*106)|j)\\s*(?:&\\#(?:x0*61|0*97)|a)\\s*(?:&\\#(?:x0*76|0*118)|v)\\s*(?:&\\#(?:x0*61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0*67|0*103)|g)|(?:&\\#(?:x0*62|0*98)|b)(?:&\\#(?:x0*6d|0*109)|m)(?:&\\#(?:x0*70|0*112)|p)|(?:&\\#(?:x0*67|0*103)|g)(?:&\\#(?:x0*69|0*105)|i)(?:&\\#(?:x0*66|0*102)|f)|(?:&\\#(?:x0*70|0*112)|p)?(?:&\\#(?:x0*6a|0*106)|j)(?:&\\#(?:x0*70|0*112)|p)(?:&\\#(?:x0*65|0*101)|e)(?:&\\#(?:x0*67|0*103)|g)|(?:&\\#(?:x0*74|0*116)|t)(?:&\\#(?:x0*69|0*105)|i)(?:&\\#(?:x0*66|0*102)|f)(?:&\\#(?:x0*66|0*102)|f)|(?:&\\#(?:x0*73|0*115)|s)(?:&\\#(?:x0*76|0*118)|v)(?:&\\#(?:x0*67|0*103)|g)(?:&\\#(?:x0*2b|0*43)|\\+)(?:&\\#(?:x0*78|0*120)|x)(?:&\\#(?:x0*6d|0*109)|m)(?:&\\#(?:x0*6c|0*108)|l))(?:(?:&\\#(?:x0*3b|0*59)|;)(?:&\\#(?:x0*63|0*99)|c)(?:&\\#(?:x0*68|0*104)|h)(?:&\\#(?:x0*61|0*97)|a)(?:&\\#(?:x0*72|0*114)|r)(?:&\\#(?:x0*73|0*115)|s)(?:&\\#(?:x0*65|0*101)|e)(?:&\\#(?:x0*74|0*116)|t)(?:&\\#(?:x0*3d|0*61)|=)[\\-a-z0-9]+)?(?:(?:&\\#(?:x0*3b|0*59)|;)(?:&\\#(?:x0*62|0*98)|b)(?:&\\#(?:x0*61|0*97)|a)(?:&\\#(?:x0*73|0*115)|s)(?:&\\#(?:x0*65|0*101)|e)(?:&\\#(?:x0*36|0*54)|6)(?:&\\#(?:x0*34|0*52)|4))?(?:&\\#(?:x0*2c|0*44)|,)))\\s*(?:&\\#(?:x0*3a|0*58)|&colon|\\:)|
73 #css expression
74 (?:^|[^\\w])(?:(?:\\\\0*65|\\\\0*45|e)(?:\\/\\*.*?\\*\\/)*(?:\\\\0*78|\\\\0*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\0*6e|\\\\0*4e|n)(?:\\/\\*.*?\\*\\/)*(?:\\\\0*64|\\\\0*44|d)(?:\\/\\*.*?\\*\\/)*(?:\\\\0*69|\\\\0*49|i)(?:\\/\\*.*?\\*\\/)*(?:\\\\0*6e|\\\\0*4e|n)(?:\\/\\*.*?\\*\\/)*(?:\\\\0*67|\\\\0*47|g)(?:\\/\\*.*?\\*\\/)*))[^\\w]*(?:\\\\0*3a|\\\\0*3a|:)[^\\w]*(?:\\\\0*75|\\\\0*55|u)(?:\\\\0*72|\\\\0*52|r)(?:\\\\0*6c|\\\\0*4c|l)|
77 #properties
78 (?:^|[^\\w])(?:on(?:abort|activate|afterprint|afterupdate|autocomplete|autocompleteerror|beforeactivate|beforecopy|beforecut|beforedeactivate|beforeeditfocus|beforepaste|beforeprint|beforeunload|beforeupdate|blur|bounce|cancel|canplay|canplaythrough|cellchange|change|click|close|contextmenu|controlselect|copy|cuechange|cut|dataavailable|datasetchanged|datasetcomplete|dblclick|deactivate|drag|dragend|dragenter|dragleave|dragover|dragstart|drop|durationchange|emptied|encrypted|ended|error|errorupdate|filterchange|finish|focus|focusin|focusout|formchange|forminput|hashchange|help|input|invalid|keydown|keypress|keyup|languagechange|layoutcomplete|load|loadeddata|loadedmetadata|loadstart|losecapture|message|mousedown|mouseenter|mouseleave|mousemove|mouseout|mouseover|mouseup|mousewheel|move|moveend|movestart|mozfullscreenchange|mozfullscreenerror|mozpointerlockchange|mozpointerlockerror|offline|online|page|pagehide|pageshow|paste|pause|play|playing|popstate|progress|propertychange|ratechange|readystatechange|reset|resize|resizeend|resizestart|rowenter|rowexit|rowsdelete|rowsinserted|scroll|search|seeked|seeking|select|selectstart|show|stalled|start|storage|submit|suspend|timer|timeupdate|toggle|unload|volumechange|waiting|webkitfullscreenchange|webkitfullscreenerror|wheel)|formaction|data\\-bind|ev:event)[^\\w]
79 )/ix';
80
81 public function __construct($attributes) {
82 $this->id = $attributes['id'];
83 $this->logic = $attributes['rule_logic'];
84 $this->actions = $attributes['actions'];
85 $this->execute_on = $attributes['execute_on'];
86 $this->min_rule_engine_ver = $attributes['min_rule_engine_ver'];
87
88 if (array_key_exists('max_rule_engine_ver', $attributes)) {
89 $this->max_rule_engine_ver = $attributes['max_rule_engine_ver'];
90 }
91
92 if (array_key_exists('config', $attributes) && is_array($attributes['config'])) {
93 $this->config = $attributes['config'];
94 }
95
96 if (array_key_exists('opts', $attributes) && is_array($attributes['opts'])) {
97 $this->opts = $attributes['opts'];
98 }
99 }
100
101 public static function init($attributes) {
102 if (!is_array($attributes)) {
103 return false;
104 }
105
106 if (!array_key_exists('min_rule_engine_ver', $attributes) || !is_float($attributes['min_rule_engine_ver']) ||
107 $attributes['min_rule_engine_ver'] > WPRProtectFWRuleEngine_V676::VERSION) {
108
109 return false;
110 }
111
112 if (array_key_exists('max_rule_engine_ver', $attributes) && (!is_float($attributes['max_rule_engine_ver']) ||
113 $attributes['max_rule_engine_ver'] < WPRProtectFWRuleEngine_V676::VERSION)) {
114
115 return false;
116 }
117
118 if (!array_key_exists('id', $attributes) || (is_int($attributes['id']) && $attributes['id'] <= 0)) {
119 return false;
120 }
121
122 if (!array_key_exists('rule_logic', $attributes) || !is_array($attributes['rule_logic'])) {
123 return false;
124 }
125
126 if (!array_key_exists('actions', $attributes) || !is_array($attributes['actions'])) {
127 return false;
128 }
129
130 if (!array_key_exists('execute_on', $attributes)) {
131 if (array_key_exists('level', $attributes) && $attributes['level'] === 1) {
132 $attributes['execute_on'] = WPRProtectFWRule_V676::EXE_ON_BOOT;
133 } else {
134 return false;
135 }
136 }
137
138 return new WPRProtectFWRule_V676($attributes);
139 }
140
141 public function isExeOnBoot() {
142 return ($this->execute_on === WPRProtectFWRule_V676::EXE_ON_BOOT);
143 }
144
145 public function isExeOnPreUpdateOption() {
146 return ($this->execute_on === WPRProtectFWRule_V676::EXE_ON_PRE_UPDATE_OPTION);
147 }
148
149 public function isExeOnPreDeletePost() {
150 return ($this->execute_on === WPRProtectFWRule_V676::EXE_ON_PRE_DELETE_POST);
151 }
152
153 public function isExeOnWPInsertPostEmptyContent() {
154 return ($this->execute_on === WPRProtectFWRule_V676::EXE_ON_WP_INSERT_POST_EMPTY_CONTENT);
155 }
156
157 public function isExeOnInsertUserMeta() {
158 return ($this->execute_on === WPRProtectFWRule_V676::EXE_ON_INSERT_USER_META);
159 }
160
161 public function isExeOnDeleteOption() {
162 return ($this->execute_on === WPRProtectFWRule_V676::EXE_ON_DELETE_OPTION);
163 }
164
165 public function isExeOnDeleteUser() {
166 return ($this->execute_on === WPRProtectFWRule_V676::EXE_ON_DELETE_USER);
167 }
168
169 public function isExeOnPasswordReset() {
170 return ($this->execute_on === WPRProtectFWRule_V676::EXE_ON_PASSWORD_RESET);
171 }
172
173 public function isExeOnSendAuthCookies() {
174 return ($this->execute_on === WPRProtectFWRule_V676::EXE_ON_SEND_AUTH_COOKIES);
175 }
176
177 public function isExeOnSetAuthCookie() {
178 return ($this->execute_on === WPRProtectFWRule_V676::EXE_ON_SET_AUTH_COOKIE);
179 }
180
181 public function isExeOnInit() {
182 return ($this->execute_on === WPRProtectFWRule_V676::EXE_ON_INIT);
183 }
184
185 public function isExeOnUserRegister() {
186 return ($this->execute_on === WPRProtectFWRule_V676::EXE_ON_USER_REGISTER);
187 }
188
189 public function isExeOnAddUserMeta() {
190 return ($this->execute_on === WPRProtectFWRule_V676::EXE_ON_ADD_USER_META);
191 }
192
193 public function isExeOnUpdateUserMetadata() {
194 return ($this->execute_on === WPRProtectFWRule_V676::EXE_ON_UPDATE_USER_METADATA);
195 }
196
197 public function isExeOnUpdateUserMeta() {
198 return ($this->execute_on === WPRProtectFWRule_V676::EXE_ON_UPDATE_USER_META);
199 }
200
201 public function isExeOnAddOption() {
202 return ($this->execute_on === WPRProtectFWRule_V676::EXE_ON_ADD_OPTION);
203 }
204
205 public function isExeOnWpPreInsertUserData() {
206 return ($this->execute_on === WPRProtectFWRule_V676::EXE_ON_WP_PRE_INSERT_USER_DATA);
207 }
208 }
209 endif;
210