PluginProbe
Defender Security – Malware Scanner, Login Security & Firewall / 6.2.4
Defender Security – Malware Scanner, Login Security & Firewall v6.2.4
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 6.2.4, at src/view/ip-lockout/locked.php

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