PluginProbe
Defender Security – Malware Scanner, Login Security & Firewall / 5.4.0
Defender Security – Malware Scanner, Login Security & Firewall v5.4.0
6.3.0 6.2.3 6.2.4 6.2.0 6.2.1 6.2.2 6.1.0 5.3.1 5.4.0 5.4.1 5.5.0 5.5.1 5.6.0 5.6.1 5.6.2 5.7.0 5.7.1 5.7.2 5.8.0 5.8.1 5.9.0 6.0.0 6.0.1 3.0.1 3.1.0 All 141 releases
defender-security / src / view / ip-lockout / locked.php

locked.php in Defender Security – Malware Scanner, Login Security & Firewall 5.4.0, at src/view/ip-lockout/locked.php

550 lines 15.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * This template is used to display locked IP email.
4 *
5 * @package WP_Defender
6 */
7
8 /**
9 * WPCS errors in this page are,
10 * 1) Stylesheets must be registered/enqueued via wp_enqueue_style()
11 * 2) Script must be registered/enqueued via wp_enqueue_script()
12 * @codingStandardsIgnoreFile
13 */
14 ?>
15 <!DOCTYPE html>
16 <html lang="en">
17 <head>
18 <meta charset="UTF-8">
19 <meta name="viewport" content="width=device-width, initial-scale=1">
20 <title>
21 <?php
22 $devman_img = defender_asset_url( '/assets/img/def-stand.svg' );
23 $devman_icon = defender_asset_url( '/assets/img/defender-30.svg' );
24 $info = defender_white_label_status();
25 if ( strlen( $info['hero_image'] ) > 0 ) {
26 $devman_img = $info['hero_image'];
27 }
28 bloginfo( 'name' )
29 ?>
30 </title>
31 <link rel="stylesheet"
32 href="https://fonts.bunny.net/css?family=Roboto+Condensed:400,700|Roboto:400,500,300,300italic">
33 <link rel="stylesheet" href="<?php defender_asset_url( '/assets/css/styles.css', true ); ?>">
34 <style>
35 html,
36 body {
37 margin: 0;
38 padding: 0;
39 }
40
41 .wp-defender {
42 display: grid;
43 place-content: center;
44 font-family: Roboto, sans-serif;
45 color: #000;
46 font-size: 13px;
47 line-height: 18px;
48 min-height: 100vh; /* Ensure content fills at least the viewport height */
49 }
50
51 .container {
52 display: flex;
53 flex-direction: column;
54 align-items: center;
55 justify-content: center;
56 gap: 30px;
57 width: auto;
58 max-width: 100%; /* Ensure container doesn't overflow on smaller screens */
59 padding: 0 20px; /* Add padding for better readability and spacing */
60 }
61
62 .image,
63 .plugin-icon {
64 border-radius: 50%;
65 background-repeat: no-repeat;
66 background-size: contain;
67 background-position: center;
68 max-width: 100%; /* Ensure image doesn't overflow its container */
69 }
70
71 .image {
72 width: 128px;
73 height: 128px;
74 background-image: url("<?php echo esc_url_raw( $devman_img ); ?>");
75 }
76
77 .plugin-icon {
78 width: 30px;
79 height: 30px;
80 background-image: url("<?php echo esc_url_raw( $devman_icon ); ?>");
81 }
82
83 .powered {
84 display: grid;
85 justify-content: center;
86 gap: 10px;
87 font-size: 10px;
88 color: #C0C0C0;
89 justify-items: center;
90 padding: 0 20px;
91 max-width: 100%;
92 }
93
94 .powered strong {
95 color: #8A8A8A;
96 }
97
98 .locked_page_header {
99 color: #333333;
100 }
101
102 .message {
103 text-align: center;
104 font-size: 15px;
105 line-height: 30px;
106 color: #666666;
107 }
108
109 #countdown-time {
110 font-weight: bold;
111 font-size: 28px;
112 line-height: 40px;
113 color: #666666;
114 display: inline-flex;
115 gap: 6px;
116 }
117
118 #remaining-time {
119 margin-left: 10px;
120 }
121
122 .sui-icon-stopwatch::before {
123 color: inherit !important;
124 font-size: 24px !important;
125 }
126
127 .day-notation {
128 font-weight: normal;
129 }
130
131 #wd_step_show_success .success_icon,
132 #wd_agf_unlock_me_success .success_icon {
133 width: 60px;
134 height: 60px;
135 margin: 0 auto;
136 background-image: url("<?php defender_asset_url( '/assets/img/green-icon.svg', true ); ?>");
137 background-repeat: no-repeat;
138 background-size: contain;
139 background-position: center;
140 }
141
142 </style>
143 <?php if ( ! empty( $is_unlock_me_agf ) || ! empty( $is_unlock_me ) ) { ?>
144 <link rel="stylesheet" href="<?php echo esc_url( defender_asset_url( '/assets/css/unlock.css' ) ); ?>">
145 <script src="<?php echo esc_url_raw( includes_url( '/js/jquery/jquery.min.js' ) ); ?>"></script>
146 <?php } ?>
147 </head>
148
149 <body class="<?php echo esc_attr( 'sui-' . DEFENDER_SUI ); ?>">
150 <div class="wp-defender">
151 <div class="container">
152 <?php
153 if (
154 ( false === $info['hide_branding'] ) ||
155 ( true === $info['hide_branding'] && ! empty( $info['hero_image'] ) )
156 ) {
157 echo '<div class="image"></div>';
158 }
159 ?>
160 <h1 class="locked_page_header"><?php esc_html_e( 'Access Denied', 'defender-security' ); ?></h1>
161 <p class="message" <?php echo ! empty( $hide_btn_agf ) ? 'style="margin-top: -1.5em; margin-bottom: 3em"' : ''; ?>>
162 <?php
163 echo wp_kses_post( $message );
164 echo ! empty( $hide_btn_agf ) ? '' : '<br/>';
165 if ( ! empty( $is_unlock_me_agf ) ) {
166 if ( empty( $hide_btn_agf ) ) {
167 printf(
168 /* translators: 1. Module name. 2. Button title. */
169 esc_html__(
170 'Your IP appeared in the %s service. Click on the %s button below to unlock yourself.',
171 'defender-security'
172 ),
173 $module_name_agf,
174 '<strong>' . esc_html( $button_title ) . '</strong>',
175 );
176 } else {
177 printf(
178 /* translators: %s: Module name. */
179 esc_html__(
180 'Your IP address has been blocked from accessing this website because it is listed in the %s.',
181 'defender-security'
182 ),
183 '<strong>' . $module_name_agf . '</strong>'
184 );
185 }
186 } else if ( ! empty( $is_unlock_me ) ) {
187 printf(
188 /* translators: %s: Button title. */
189 esc_html__(
190 'If you are a site admin, click on the %s button below to unlock yourself.',
191 'defender-security'
192 ),
193 '<strong>' . esc_html( $button_title ) . '</strong>',
194 );
195 }
196 ?>
197 </p>
198 <?php if ( ! empty( $is_unlock_me_agf ) ) {
199 if ( empty( $hide_btn_agf ) ) { ?>
200 <div class="unlock_wrap sui-wrap">
201 <!--Step#1-->
202 <form id="wd_agf_unlock_me_form">
203 <input type="checkbox" id="wd_agf_unlock_me_checkbox"
204 name="captcha"
205 style="display: none;">
206 <button type="button" id="wd_agf_unlock_me"
207 class="sui-button sui-button-lg sui-button-blue"
208 disabled="disabled"
209 >
210 <i class="sui-icon-lock" aria-hidden="true"></i>
211 <?php echo esc_html( $button_title ); ?>
212 </button>
213 </form>
214 <!--Step#2-->
215 <div class="sui-box unlock_section" id="wd_agf_unlock_me_success">
216 <div class="success_icon"></div>
217 <p>
218 <?php
219 esc_html_e(
220 'Your IP is removed from the AntiBot Global FIrewall blocklist.',
221 'defender-security'
222 );
223 ?>
224 </p>
225 </div>
226 <!--Step#3-->
227 <div class="sui-box unlock_section" id="wd_agf_unlock_me_fail">
228 <p>
229 <?php echo sprintf(
230 /* translators: 1. Open tag. 2. Close tag. */
231 esc_html__( 'Verification failed. Please %1$sretry%2$s.', 'defender-security' ),
232 '<a href="javascript:void(0);" class="retry-link">',
233 '</a>'
234 ); ?>
235 </p>
236 </div>
237 <!--Step#4-->
238 <div class="sui-box unlock_section" id="wd_agf_unlock_me_error">
239 <p>
240 <?php echo sprintf(
241 /* translators: 1. Open tag. 2. Close tag. */
242 esc_html__( 'Unexpected error occurred. Please %1$sretry%2$s.', 'defender-security' ),
243 '<a href="javascript:void(0);" class="retry-link">',
244 '</a>'
245 ); ?>
246 </p>
247 </div>
248 </div>
249 <?php }
250 } else if ( ! empty( $is_unlock_me ) ) { ?>
251 <div class="unlock_wrap sui-wrap">
252 <!--Step#1-->
253 <button type="button" id="wd_step_show_toggle"
254 class="sui-button sui-button-lg sui-button-blue"
255 <?php disabled( $button_disabled, true ); ?>
256 >
257 <i class="sui-icon-lock" aria-hidden="true"></i>
258 <?php echo esc_html( $button_title ); ?>
259 </button>
260 <!--Step#2-->
261 <form method="post" class="sui-box unlock_section" id="wd_step_show_form" action="">
262 <div class="sui-form-field">
263 <label for="unlock_user_field" id="label-unlock_user_field" class="sui-label">
264 <?php esc_html_e( 'Enter your registered username or email', 'defender-security' ); ?>
265 </label>
266 <div class="sui-row">
267 <div class="sui-col-md-9">
268 <input type="text"
269 placeholder="<?php esc_attr_e( 'Enter your username or email.', 'defender-security' ); ?>"
270 id="unlock_user_field"
271 class="sui-form-control"
272 aria-labelledby="label-unlock_user_field"
273 />
274 </div>
275 <div class="sui-col-md-3">
276 <button type="button" class="sui-button sui-button-lg sui-button-blue"
277 id="wd_verify_user">
278 <?php echo esc_html( $button_title ); ?>
279 </button>
280 </div>
281 </div>
282 </div>
283 </form>
284 <!--Step#3-->
285 <div class="sui-box unlock_section" id="wd_step_show_success">
286 <div class="success_icon"></div>
287 <p id="unlock_sent_email">
288 <?php
289 esc_html_e(
290 'If the username/email exists, an email will be sent to your registered email address.',
291 'defender-security'
292 );
293 ?>
294 </p>
295 <p>
296 <?php
297 printf(
298 /* translators: %s: Resend link. */
299 esc_html__( 'Didn\'t get the email? %s.', 'defender-security' ),
300 '<a href="" id="unlock_sent_again_link">' . esc_html__( 'Try again', 'defender-security' ) . '</a>'
301 );
302 ?>
303 </p>
304 </div>
305
306 </div>
307 <?php } ?>
308 <?php if ( ! empty( $remaining_time ) && is_int( $remaining_time ) && $remaining_time > 0 ) { ?>
309 <p class="message"><?php esc_html_e( 'You will be able to attempt to access again in:', 'defender-security' ); ?></p>
310 <p id="countdown-time"><span class="sui-icon-stopwatch" aria-hidden="true"></span><span
311 id="remaining-time"></span></p>
312 <?php } ?>
313 </div>
314 <?php if ( ! $info['hide_doc_link'] ) { ?>
315 <div class="powered">
316 <div class="plugin-icon"></div>
317 <div>
318 <?php esc_html_e( 'Powered by', 'defender-security' ); ?>
319 <strong><?php esc_html_e( 'Defender', 'defender-security' ); ?></strong>
320 </div>
321 </div>
322 <?php
323 }
324 ?>
325 </div>
326 <?php if ( ! empty( $remaining_time ) && is_int( $remaining_time ) && $remaining_time > 0 ) { ?>
327 <script>
328 function CountDownTimer(duration, granularity) {
329 this.duration = duration;
330 this.granularity = granularity || 1000;
331 this.tickFtns = [];
332 this.running = false;
333 }
334
335 CountDownTimer.prototype.start = function () {
336 if (this.running) {
337 return;
338 }
339 this.running = true;
340 var start = Date.now(),
341 that = this,
342 diff, obj;
343
344 (function timer() {
345 diff = that.duration - (((Date.now() - start) / 1000) | 0);
346
347 if (diff > 0) {
348 setTimeout(timer, that.granularity);
349 } else {
350 diff = 0;
351 that.running = false;
352 }
353
354 obj = CountDownTimer.parse(diff);
355 that.tickFtns.forEach(function (ftn) {
356 ftn.call(this, obj);
357 }, that);
358 }());
359 };
360
361 CountDownTimer.prototype.onTick = function (ftn) {
362 if (typeof ftn === 'function') {
363 this.tickFtns.push(ftn);
364 }
365 return this;
366 };
367
368 CountDownTimer.prototype.expired = function () {
369 return !this.running;
370 };
371
372 CountDownTimer.parse = function (seconds) {
373 const DAY_IN_SECONDS = 86400;
374 const HOUR_IN_SECONDS = 3600;
375 const MINUTES_IN_SECONDS = 60;
376
377 seconds = Number(seconds);
378
379 let days = Math.floor(seconds / DAY_IN_SECONDS);
380
381 let dayNotation = days > 1 ? 'Days' : 'Day';
382
383 let displayDays = days > 0 ? (days + '<span class="day-notation">&nbsp;' + dayNotation + '&nbsp;</span>') : '';
384
385 seconds %= DAY_IN_SECONDS;
386 let hours = String(Math.floor(seconds / HOUR_IN_SECONDS)).padStart(2, 0);
387
388 seconds %= HOUR_IN_SECONDS;
389 let minutes = String(Math.floor(seconds / MINUTES_IN_SECONDS)).padStart(2, 0);
390
391 seconds = String(seconds % MINUTES_IN_SECONDS).padStart(2, 0);
392
393 return displayDays + hours + ':' + minutes + ':' + seconds;
394 };
395
396 window.onload = function () {
397 let display = document.getElementById("remaining-time"),
398 timer = new CountDownTimer(<?php echo esc_attr( $remaining_time ); ?>);
399
400 timer.onTick(format).onTick(pageRefresh).start();
401
402 function pageRefresh() {
403 if (this.expired()) {
404 setTimeout(
405 () => {
406 window.location.href = window.location.href;
407 },
408 1000 // Intentional 1 second delay to allow browser parse headers and redirect.
409 );
410 }
411 }
412
413 function format(formattedTime) {
414 display.innerHTML = formattedTime;
415 }
416 }
417 </script>
418 <?php } ?>
419
420 <?php if ( ! empty( $is_unlock_me_agf ) && empty( $hide_btn_agf ) ) { ?>
421 <script>
422 let altcha = <?php echo json_encode( $altcha ); ?>;
423
424 jQuery(function ($) {
425 function agf_unlock_user(that) {
426 let data = altcha;
427 data.solution = that.data('solution');
428 data.captcha = $('#wd_agf_unlock_me_checkbox').prop('checked') ? 1 : 0;
429
430 $.ajax({
431 type: 'POST',
432 url: '<?php echo $action_agf_unlock_user; ?>',
433 data: data,
434 beforeSend: function () {
435 that.prop('disabled', true);
436 },
437 success: function (response) {
438 if (response.success) {
439 // Enable button.
440 that.prop('disabled', false);
441 // Hide the current step and show the next one.
442 $('#wd_agf_unlock_me').hide();
443 $('#wd_agf_unlock_me_success').show();
444
445 setTimeout(function() {
446 window.location.reload(true);
447 }, 1000);
448 } else {
449 $('#wd_agf_unlock_me').hide();
450 // If the response has data and the data has a message, show that message in the fail box.
451 // Otherwise, just show the fail box.
452 if (response.data && response.data.message) {
453 $('#wd_agf_unlock_me_fail').html(response.data.message).show();
454 } else {
455 $('#wd_agf_unlock_me_fail').show();
456 }
457 }
458 },
459 error: function (e) {
460 $('#wd_agf_unlock_me').hide();
461 $('#wd_agf_unlock_me_error').show();
462 }
463 })
464 }
465
466 $('body').on('click', '#wd_agf_unlock_me', function (e) {
467 e.preventDefault();
468 agf_unlock_user($(this));
469 });
470
471 $('body').on('click', '.retry-link', function (e) {
472 window.location.reload(true);
473 });
474 });
475 </script>
476 <script src="<?php echo plugins_url( 'assets/js/altcha.js', WP_DEFENDER_FILE ); ?>"></script>
477 <?php } else if ( ! empty( $is_unlock_me ) ) { ?>
478 <script>
479 jQuery(function ($) {
480 //Verify user.
481 function verifyUser(that) {
482 let userField = $.trim($('#unlock_user_field').val());
483 //No action if the field is empty.
484 if ('' == userField) {
485 return;
486 }
487 let data = {
488 data: JSON.stringify({
489 'user_data': userField
490 })
491 };
492 $.ajax({
493 type: 'POST',
494 url: '<?php echo $action_verify_blocked_user; ?>',
495 data: data,
496 beforeSend: function () {
497 that.prop('disabled', true);
498 },
499 success: function (response) {
500 // Enable button.
501 that.prop('disabled', false);
502 // Hide the current step and show the next one.
503 $('#wd_step_show_form').hide();
504 $('#wd_step_show_success').show();
505 },
506 error: function (e) {
507 console.log('Unexpected error occurred: ', e);
508 }
509 })
510 }
511
512 //Show a form for communication with the user.
513 $('body').on('click', '#wd_step_show_toggle', function () {
514 $(this).hide();
515 $('#wd_step_show_form').show();
516 });
517 // Verify a blocked user.
518 $('body').on('click', '#wd_verify_user', function (e) {
519 e.preventDefault();
520 verifyUser($(this));
521 });
522 $(window).on('keydown', function (event) {
523 if (event.keyCode == 13 && jQuery(event.target).attr('id') === 'unlock_user_field') {
524 verifyUser(jQuery(event.target))
525 }
526 });
527 //Show the form again.
528 $('body').on('click', '#unlock_sent_again_link', function (e) {
529 let that = $(this);
530 e.preventDefault();
531 //Check the attempt limit.
532 $.ajax({
533 type: 'POST',
534 url: '<?php echo $action_send_again; ?>',
535 data: {},
536 success: function (response) {
537 if (response.success === false) {
538 location.reload();
539 }
540 $('#wd_step_show_success').hide();
541 $('#wd_step_show_form').show();
542 }
543 });
544 });
545 })
546 </script>
547 <?php } ?>
548 </body>
549 </html>
550