Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93
/home/sportsfe.../httpdocs/clone/wp-conte.../plugins/wordfenc.../modules/login-se.../views/manage
File: activate.php
<?php
[0] Fix | Delete
if (!defined('WORDFENCE_LS_VERSION')) { exit; }
[1] Fix | Delete
/**
[2] Fix | Delete
* @var \WordfenceLS\Model_2faInitializationData $initializationData The initialization data for setting up 2FA for a specific user. Required.
[3] Fix | Delete
*/
[4] Fix | Delete
$user = $initializationData->get_user();
[5] Fix | Delete
$recovery = $initializationData->get_recovery_codes();
[6] Fix | Delete
?>
[7] Fix | Delete
<div class="wfls-block wfls-always-active wfls-flex-item-full-width">
[8] Fix | Delete
<div class="wfls-block-header wfls-block-header-border-bottom">
[9] Fix | Delete
<div class="wfls-block-header-content">
[10] Fix | Delete
<div class="wfls-block-title">
[11] Fix | Delete
<strong><?php esc_html_e('2. Enter Code from Authenticator App', 'wordfence'); ?></strong>
[12] Fix | Delete
</div>
[13] Fix | Delete
</div>
[14] Fix | Delete
</div>
[15] Fix | Delete
<div class="wfls-block-content wfls-padding-add-bottom">
[16] Fix | Delete
<p><?php esc_html_e('Download Recovery Codes', 'wordfence'); ?> <em class="wfls-text-small"><?php esc_html_e('Optional', 'wordfence'); ?></em></p>
[17] Fix | Delete
<p><?php echo esc_html(sprintf(__('Use one of these %d codes to log in if you lose access to your authenticator device. Codes are %d characters long plus optional spaces. Each one may be used only once.', 'wordfence'), count($recovery), \WordfenceLS\Model_Crypto::strlen($recovery[0]) * 2)); ?></p>
[18] Fix | Delete
<ul class="wfls-recovery-codes">
[19] Fix | Delete
<?php
[20] Fix | Delete
$recoveryCodeFileContents = sprintf(__('Two-Factor Authentication Recovery Codes - %s (%s)', 'wordfence'), home_url(), $user->user_login) . "\r\n";
[21] Fix | Delete
$recoveryCodeFileContents .= "\r\n" . sprintf(__('Each line of %d letters and numbers is a single recovery code, with optional spaces for readability. To use a recovery code, after entering your username and password, enter the code like "1234 5678 90AB CDEF" at the 2FA prompt. If your site has a custom login prompt and does not show a 2FA prompt, you can use the single-step method by entering your password and the code together in the Password field, like "mypassword1234 5678 90AB CDEF". Your recovery codes are:', 'wordfence'), \WordfenceLS\Model_Crypto::strlen($recovery[0]) * 2) . "\r\n\r\n";
[22] Fix | Delete
foreach ($recovery as $c) {
[23] Fix | Delete
$hex = bin2hex($c);
[24] Fix | Delete
$blocks = str_split($hex, 4);
[25] Fix | Delete
echo '<li>' . implode(' ', $blocks) . '</li>';
[26] Fix | Delete
$recoveryCodeFileContents .= implode(' ', $blocks) . "\r\n";
[27] Fix | Delete
}
[28] Fix | Delete
?>
[29] Fix | Delete
</ul>
[30] Fix | Delete
<p class="wfls-center"><a href="#" class="wfls-btn wfls-btn-default" id="wfls-recovery-download" target="_blank" rel="noopener noreferrer"><i class="dashicons dashicons-download"></i> <?php esc_html_e('Download', 'wordfence'); ?></a></p>
[31] Fix | Delete
[32] Fix | Delete
<hr class="wfls-half">
[33] Fix | Delete
[34] Fix | Delete
<p><?php esc_html_e('Enter the code from your authenticator app below to verify and activate two-factor authentication for this account.', 'wordfence'); ?></p>
[35] Fix | Delete
<p><input type="text" id="wfls-activate-field" value="" size="6" maxlength="6" placeholder="123456" autocomplete="off"></p>
[36] Fix | Delete
</div>
[37] Fix | Delete
<div class="wfls-block-footer">
[38] Fix | Delete
<div class="wfls-block-footer-content">
[39] Fix | Delete
<div class="wfls-block-title" id="wfls-activation-help-link-container">
[40] Fix | Delete
<a href="<?php echo \WordfenceLS\Controller_Support::esc_supportURL(\WordfenceLS\Controller_Support::ITEM_MODULE_LOGIN_SECURITY_2FA); ?>" target="_blank" rel="noopener noreferrer"><?php esc_html_e('For help on setting up an app, visit our help article.', 'wordfence'); ?></a>
[41] Fix | Delete
</div>
[42] Fix | Delete
<div class="wfls-block-footer-action"><a href="#" id="wfls-activate" class="wfls-btn wfls-btn-default wfls-disabled"><?php esc_html_e('Activate', 'wordfence'); ?></a></div>
[43] Fix | Delete
</div>
[44] Fix | Delete
</div>
[45] Fix | Delete
</div>
[46] Fix | Delete
<script type="application/javascript">
[47] Fix | Delete
(function($) {
[48] Fix | Delete
$(function() {
[49] Fix | Delete
$('#wfls-activate-field').on('keyup', function(e) {
[50] Fix | Delete
$('#wfls-activate').toggleClass('wfls-disabled', $('#wfls-activate-field').val().length != 6);
[51] Fix | Delete
[52] Fix | Delete
if (e.keyCode == 13) {
[53] Fix | Delete
$('#wfls-activate').trigger('click');
[54] Fix | Delete
}
[55] Fix | Delete
});
[56] Fix | Delete
[57] Fix | Delete
$('#wfls-recovery-download').on('click', function(e) {
[58] Fix | Delete
e.preventDefault();
[59] Fix | Delete
e.stopPropagation();
[60] Fix | Delete
saveAs(new Blob(["<?php echo str_replace("\n", "\\n", str_replace("\r", "\\r", addslashes($recoveryCodeFileContents))); ?>"], {type: "text/plain;charset=" + document.characterSet}), '<?php echo \WordfenceLS\Text\Model_JavaScript::esc_js(preg_replace('~^https?://~i', '', home_url())) . '_' . \WordfenceLS\Text\Model_JavaScript::esc_js($user->user_login) . '_recoverycodes.txt'; ?>');
[61] Fix | Delete
WFLS.savedRecoveryCodes = true;
[62] Fix | Delete
});
[63] Fix | Delete
[64] Fix | Delete
$('#wfls-activate').on('click', function(e) {
[65] Fix | Delete
e.preventDefault();
[66] Fix | Delete
e.stopPropagation();
[67] Fix | Delete
[68] Fix | Delete
if (WFLS.userIsActivating) { //Likely a double-click
[69] Fix | Delete
return;
[70] Fix | Delete
}
[71] Fix | Delete
[72] Fix | Delete
WFLS.userIsActivating = true;
[73] Fix | Delete
[74] Fix | Delete
var payload = {
[75] Fix | Delete
secret: '<?php echo bin2hex($initializationData->get_raw_secret()); ?>',
[76] Fix | Delete
recovery: ['<?php echo implode('\', \'', array_map(function($c) { return bin2hex($c); }, $recovery)); ?>'],
[77] Fix | Delete
code: $('#wfls-activate-field').val(),
[78] Fix | Delete
user: <?php echo $user->ID; ?>,
[79] Fix | Delete
};
[80] Fix | Delete
[81] Fix | Delete
WFLS.ajax(
[82] Fix | Delete
'wordfence_ls_activate',
[83] Fix | Delete
payload,
[84] Fix | Delete
function(response) {
[85] Fix | Delete
if (response.error) {
[86] Fix | Delete
WFLS.userIsActivating = false;
[87] Fix | Delete
WFLS.panelModal((WFLS.screenSize(500) ? '300px' : '400px'), '<?php echo \WordfenceLS\Text\Model_JavaScript::esc_js(__('Error Activating 2FA', 'wordfence')); ?>', response.error, {includeDefaultButtons: true});
[88] Fix | Delete
}
[89] Fix | Delete
else {
[90] Fix | Delete
$('#wfls-activation-controls').crossfade($('#wfls-deactivation-controls'));
[91] Fix | Delete
$('#wfls-recovery-code-count').text(response.text);
[92] Fix | Delete
$('#wfls-activate-field').val('');
[93] Fix | Delete
[94] Fix | Delete
$('.wfls-notice[data-notice-type="wfls-will-be-required"]').find('.wfls-dismiss-link').trigger('click');
[95] Fix | Delete
[96] Fix | Delete
if (!WFLS.savedRecoveryCodes) {
[97] Fix | Delete
var prompt = $('#wfls-tmpl-recovery-skipped-prompt').tmpl({});
[98] Fix | Delete
var promptHTML = $("<div />").append(prompt).html();
[99] Fix | Delete
WFLS.panelHTML((WFLS.screenSize(500) ? '300px' : '400px'), promptHTML, { fixed: true, overlayClose: false, closeButton: false, className: 'wfls-modal', onComplete: function() {
[100] Fix | Delete
$('#wfls-recovery-skipped-download').on('click', function(e) {
[101] Fix | Delete
e.preventDefault();
[102] Fix | Delete
e.stopPropagation();
[103] Fix | Delete
saveAs(new Blob(["<?php echo str_replace("\n", "\\n", str_replace("\r", "\\r", addslashes($recoveryCodeFileContents))); ?>"], {type: "text/plain;charset=" + document.characterSet}), '<?php echo \WordfenceLS\Text\Model_JavaScript::esc_js(preg_replace('~^https?://~i', '', home_url())) . '_' . \WordfenceLS\Text\Model_JavaScript::esc_js($user->user_login) . '_recoverycodes.txt'; ?>');
[104] Fix | Delete
WFLS.panelClose();
[105] Fix | Delete
});
[106] Fix | Delete
$('#wfls-recovery-skipped-skip').on('click', function(e) {
[107] Fix | Delete
e.preventDefault();
[108] Fix | Delete
e.stopPropagation();
[109] Fix | Delete
WFLS.panelClose();
[110] Fix | Delete
});
[111] Fix | Delete
}});
[112] Fix | Delete
}
[113] Fix | Delete
WFLS.savedRecoveryCodes = false;
[114] Fix | Delete
WFLS.userIsActivating = false;
[115] Fix | Delete
}
[116] Fix | Delete
},
[117] Fix | Delete
function(error) {
[118] Fix | Delete
WFLS.panelModal((WFLS.screenSize(500) ? '300px' : '400px'), '<?php echo \WordfenceLS\Text\Model_JavaScript::esc_js(__('Error Activating 2FA', 'wordfence')); ?>', '<?php echo \WordfenceLS\Text\Model_JavaScript::esc_js(__('An error was encountered while trying to activate two-factor authentication. Please try again.', 'wordfence')); ?>', {includeDefaultButtons: true});
[119] Fix | Delete
WFLS.userIsActivating = false;
[120] Fix | Delete
}
[121] Fix | Delete
);
[122] Fix | Delete
});
[123] Fix | Delete
});
[124] Fix | Delete
})(jQuery);
[125] Fix | Delete
</script>
[126] Fix | Delete
<script type="text/x-jquery-template" id="wfls-tmpl-recovery-skipped-prompt">
[127] Fix | Delete
<?php
[128] Fix | Delete
echo \WordfenceLS\Model_View::create('common/modal-prompt', array(
[129] Fix | Delete
'title' => __('Download Recovery Codes', 'wordfence'),
[130] Fix | Delete
'message' => __('Reminder: If you lose access to your authenticator device, you can use recovery codes to log in. If you have not saved a copy of your recovery codes, we recommend downloading them now.', 'wordfence'),
[131] Fix | Delete
'primaryButton' => array('id' => 'wfls-recovery-skipped-download', 'label' => __('Download', 'wordfence'), 'link' => '#'),
[132] Fix | Delete
'secondaryButtons' => array(array('id' => 'wfls-recovery-skipped-skip', 'label' => __('Skip', 'wordfence'), 'link' => '#')),
[133] Fix | Delete
))->render();
[134] Fix | Delete
?>
[135] Fix | Delete
</script>
[136] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function