This commit is contained in:
Javier Casares 2026-03-28 10:06:54 +00:00
commit 5add9b5e84
7 changed files with 372 additions and 21 deletions

View file

@ -86,7 +86,7 @@ class Two_Factor_Extended_Audit_Log {
$logs = $this->get_logs();
$log_entry = array(
'timestamp' => current_time( 'timestamp' ),
'timestamp' => time(),
'action' => sanitize_key( $action ),
'description' => sanitize_text_field( $description ),
'user_id' => $user_id,
@ -302,7 +302,7 @@ class Two_Factor_Extended_Audit_Log {
*/
public function cleanup_old_logs(): void {
$logs = $this->get_logs();
$cutoff_time = current_time( 'timestamp' ) - ( self::RETENTION_DAYS * DAY_IN_SECONDS );
$cutoff_time = time() - ( self::RETENTION_DAYS * DAY_IN_SECONDS );
$filtered_logs = array_filter(
$logs,
@ -429,7 +429,7 @@ class Two_Factor_Extended_Audit_Log {
'recent_count' => 0,
);
$recent_cutoff = current_time( 'timestamp' ) - ( 7 * DAY_IN_SECONDS );
$recent_cutoff = time() - ( 7 * DAY_IN_SECONDS );
foreach ( $logs as $log ) {
$action = isset( $log['action'] ) && is_string( $log['action'] ) ? $log['action'] : '';

View file

@ -769,7 +769,7 @@ class Two_Factor_Extended_Settings {
$export_data = array(
'version' => TWO_FACTOR_EXTENDED_VERSION,
'timestamp' => current_time( 'timestamp' ),
'timestamp' => time(),
'settings' => $settings,
);
@ -968,9 +968,8 @@ class Two_Factor_Extended_Settings {
}
// Get current tab.
// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Tab parameter for UI navigation
$tab_param = isset( $_GET['tab'] ) && is_string( $_GET['tab'] ) ? $_GET['tab'] : '';
$current_tab = $tab_param ? sanitize_key( $tab_param ) : 'settings';
// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Tab parameter for UI navigation; no state change
$current_tab = isset( $_GET['tab'] ) && is_string( $_GET['tab'] ) ? sanitize_key( wp_unslash( $_GET['tab'] ) ) : 'settings';
// Define tabs.
$tabs = array(