| @@ -1,9 +1,9 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | if (!defined('ABSPATH') && !defined('MCDATAPATH')) exit; |
| 3 | 3 | |
| 4 | -if (!class_exists('MCProtectFWRule')) : | |
| 5 | -class MCProtectFWRule { | |
| 4 | +if (!class_exists('WPRProtectFWRule_V672')) : | |
| 5 | +class WPRProtectFWRule_V672 { | |
| 6 | 6 | public $id; |
| 7 | 7 | public $logic; |
| 8 | 8 | public $actions; |
| 9 | 9 | public $execute_on; |
| @@ -28,8 +28,24 @@ | ||
| 28 | 28 | const EXE_ON_UPDATE_USER_METADATA = 14; |
| 29 | 29 | const EXE_ON_UPDATE_USER_META = 15; |
| 30 | 30 | const EXE_ON_ADD_OPTION = 16; |
| 31 | 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; | |
| 32 | 48 | |
| 33 | 49 | const SQLIREGEX = '/(?:[^\\w<]|\\/\\*\\![0-9]*|^)(?: |
| 34 | 50 | @@HOSTNAME| |
| 35 | 51 | ALTER|ANALYZE|ASENSITIVE| |
| @@ -87,15 +103,15 @@ | ||
| 87 | 103 | return false; |
| 88 | 104 | } |
| 89 | 105 | |
| 90 | 106 | if (!array_key_exists('min_rule_engine_ver', $attributes) || !is_float($attributes['min_rule_engine_ver']) || |
| 91 | - $attributes['min_rule_engine_ver'] > MCProtectFWRuleEngine::VERSION) { | |
| 107 | + $attributes['min_rule_engine_ver'] > WPRProtectFWRuleEngine_V672::VERSION) { | |
| 92 | 108 | |
| 93 | 109 | return false; |
| 94 | 110 | } |
| 95 | 111 | |
| 96 | 112 | if (array_key_exists('max_rule_engine_ver', $attributes) && (!is_float($attributes['max_rule_engine_ver']) || |
| 97 | - $attributes['max_rule_engine_ver'] < MCProtectFWRuleEngine::VERSION)) { | |
| 113 | + $attributes['max_rule_engine_ver'] < WPRProtectFWRuleEngine_V672::VERSION)) { | |
| 98 | 114 | |
| 99 | 115 | return false; |
| 100 | 116 | } |
| 101 | 117 | |
| @@ -112,82 +128,82 @@ | ||
| 112 | 128 | } |
| 113 | 129 | |
| 114 | 130 | if (!array_key_exists('execute_on', $attributes)) { |
| 115 | 131 | if (array_key_exists('level', $attributes) && $attributes['level'] === 1) { |
| 116 | - $attributes['execute_on'] = MCProtectFWRule::EXE_ON_BOOT; | |
| 132 | + $attributes['execute_on'] = WPRProtectFWRule_V672::EXE_ON_BOOT; | |
| 117 | 133 | } else { |
| 118 | 134 | return false; |
| 119 | 135 | } |
| 120 | 136 | } |
| 121 | 137 | |
| 122 | - return new MCProtectFWRule($attributes); | |
| 138 | + return new WPRProtectFWRule_V672($attributes); | |
| 123 | 139 | } |
| 124 | 140 | |
| 125 | 141 | public function isExeOnBoot() { |
| 126 | - return ($this->execute_on === MCProtectFWRule::EXE_ON_BOOT); | |
| 142 | + return ($this->execute_on === WPRProtectFWRule_V672::EXE_ON_BOOT); | |
| 127 | 143 | } |
| 128 | 144 | |
| 129 | 145 | public function isExeOnPreUpdateOption() { |
| 130 | - return ($this->execute_on === MCProtectFWRule::EXE_ON_PRE_UPDATE_OPTION); | |
| 146 | + return ($this->execute_on === WPRProtectFWRule_V672::EXE_ON_PRE_UPDATE_OPTION); | |
| 131 | 147 | } |
| 132 | 148 | |
| 133 | 149 | public function isExeOnPreDeletePost() { |
| 134 | - return ($this->execute_on === MCProtectFWRule::EXE_ON_PRE_DELETE_POST); | |
| 150 | + return ($this->execute_on === WPRProtectFWRule_V672::EXE_ON_PRE_DELETE_POST); | |
| 135 | 151 | } |
| 136 | 152 | |
| 137 | 153 | public function isExeOnWPInsertPostEmptyContent() { |
| 138 | - return ($this->execute_on === MCProtectFWRule::EXE_ON_WP_INSERT_POST_EMPTY_CONTENT); | |
| 154 | + return ($this->execute_on === WPRProtectFWRule_V672::EXE_ON_WP_INSERT_POST_EMPTY_CONTENT); | |
| 139 | 155 | } |
| 140 | 156 | |
| 141 | 157 | public function isExeOnInsertUserMeta() { |
| 142 | - return ($this->execute_on === MCProtectFWRule::EXE_ON_INSERT_USER_META); | |
| 158 | + return ($this->execute_on === WPRProtectFWRule_V672::EXE_ON_INSERT_USER_META); | |
| 143 | 159 | } |
| 144 | 160 | |
| 145 | 161 | public function isExeOnDeleteOption() { |
| 146 | - return ($this->execute_on === MCProtectFWRule::EXE_ON_DELETE_OPTION); | |
| 162 | + return ($this->execute_on === WPRProtectFWRule_V672::EXE_ON_DELETE_OPTION); | |
| 147 | 163 | } |
| 148 | 164 | |
| 149 | 165 | public function isExeOnDeleteUser() { |
| 150 | - return ($this->execute_on === MCProtectFWRule::EXE_ON_DELETE_USER); | |
| 166 | + return ($this->execute_on === WPRProtectFWRule_V672::EXE_ON_DELETE_USER); | |
| 151 | 167 | } |
| 152 | 168 | |
| 153 | 169 | public function isExeOnPasswordReset() { |
| 154 | - return ($this->execute_on === MCProtectFWRule::EXE_ON_PASSWORD_RESET); | |
| 170 | + return ($this->execute_on === WPRProtectFWRule_V672::EXE_ON_PASSWORD_RESET); | |
| 155 | 171 | } |
| 156 | 172 | |
| 157 | 173 | public function isExeOnSendAuthCookies() { |
| 158 | - return ($this->execute_on === MCProtectFWRule::EXE_ON_SEND_AUTH_COOKIES); | |
| 174 | + return ($this->execute_on === WPRProtectFWRule_V672::EXE_ON_SEND_AUTH_COOKIES); | |
| 159 | 175 | } |
| 160 | 176 | |
| 161 | 177 | public function isExeOnSetAuthCookie() { |
| 162 | - return ($this->execute_on === MCProtectFWRule::EXE_ON_SET_AUTH_COOKIE); | |
| 178 | + return ($this->execute_on === WPRProtectFWRule_V672::EXE_ON_SET_AUTH_COOKIE); | |
| 163 | 179 | } |
| 164 | 180 | |
| 165 | 181 | public function isExeOnInit() { |
| 166 | - return ($this->execute_on === MCProtectFWRule::EXE_ON_INIT); | |
| 182 | + return ($this->execute_on === WPRProtectFWRule_V672::EXE_ON_INIT); | |
| 167 | 183 | } |
| 168 | 184 | |
| 169 | 185 | public function isExeOnUserRegister() { |
| 170 | - return ($this->execute_on === MCProtectFWRule::EXE_ON_USER_REGISTER); | |
| 186 | + return ($this->execute_on === WPRProtectFWRule_V672::EXE_ON_USER_REGISTER); | |
| 171 | 187 | } |
| 172 | 188 | |
| 173 | 189 | public function isExeOnAddUserMeta() { |
| 174 | - return ($this->execute_on === MCProtectFWRule::EXE_ON_ADD_USER_META); | |
| 190 | + return ($this->execute_on === WPRProtectFWRule_V672::EXE_ON_ADD_USER_META); | |
| 175 | 191 | } |
| 176 | 192 | |
| 177 | 193 | public function isExeOnUpdateUserMetadata() { |
| 178 | - return ($this->execute_on === MCProtectFWRule::EXE_ON_UPDATE_USER_METADATA); | |
| 194 | + return ($this->execute_on === WPRProtectFWRule_V672::EXE_ON_UPDATE_USER_METADATA); | |
| 179 | 195 | } |
| 180 | 196 | |
| 181 | 197 | public function isExeOnUpdateUserMeta() { |
| 182 | - return ($this->execute_on === MCProtectFWRule::EXE_ON_UPDATE_USER_META); | |
| 198 | + return ($this->execute_on === WPRProtectFWRule_V672::EXE_ON_UPDATE_USER_META); | |
| 183 | 199 | } |
| 184 | 200 | |
| 185 | 201 | public function isExeOnAddOption() { |
| 186 | - return ($this->execute_on === MCProtectFWRule::EXE_ON_ADD_OPTION); | |
| 202 | + return ($this->execute_on === WPRProtectFWRule_V672::EXE_ON_ADD_OPTION); | |
| 187 | 203 | } |
| 188 | 204 | |
| 189 | 205 | public function isExeOnWpPreInsertUserData() { |
| 190 | - return ($this->execute_on === MCProtectFWRule::EXE_ON_WP_PRE_INSERT_USER_DATA); | |
| 206 | + return ($this->execute_on === WPRProtectFWRule_V672::EXE_ON_WP_PRE_INSERT_USER_DATA); | |
| 191 | 207 | } |
| 192 | 208 | } |
| 193 | -endif; | |
| 209 | +endif; | |