Skip to content

Commit

Permalink
Merge pull request #529 from WPWhiteSecurity/develop
Browse files Browse the repository at this point in the history
4.1.2 Release
  • Loading branch information
DannyWPWS authored Jun 24, 2020
2 parents 07fe613 + 90c630d commit c535713
Show file tree
Hide file tree
Showing 27 changed files with 1,205 additions and 3,606 deletions.
2 changes: 1 addition & 1 deletion classes/AbstractSensor.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ abstract class WSAL_AbstractSensor {
/**
* Instance of WpSecurityAuditLog.
*
* @var object
* @var WpSecurityAuditLog
*/
protected $plugin;

Expand Down
1 change: 1 addition & 0 deletions classes/AuditLogListView.php
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ public function extra_tablenav( $which ) {
}
}


// Switch to live or archive DB.
if ( $this->_plugin->settings->IsArchivingEnabled() ) {
if (
Expand Down
3 changes: 2 additions & 1 deletion classes/Helpers/Options.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ public function get_logging_path() {
require_once ABSPATH . 'wp-admin/includes/file.php';
}
$relative_path = $this->get_option_value( 'custom-logging-dir', \WSAL_Settings::DEFAULT_LOGGING_DIR );
$absolute_path = trailingslashit( \get_home_path() ) . trailingslashit( ltrim( $relative_path, '/' ) );
$absolute_path = trailingslashit( ABSPATH ) . trailingslashit( ltrim( $relative_path, '/' ) );
return $absolute_path;
}

Expand All @@ -153,6 +153,7 @@ public function get_logging_url() {
$relative_url = $this->get_option_value( 'custom-logging-dir', \WSAL_Settings::DEFAULT_LOGGING_DIR );
$absolute_url = trailingslashit( \get_site_url() ) . trailingslashit( ltrim( $relative_url, '/' ) );
return $absolute_url;

}

}
8 changes: 4 additions & 4 deletions classes/Models/ActiveRecord.php
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ public function LoadData( $data ) {
case is_array( $copy->$key ):
case is_object( $copy->$key ):
$json_decoded_val = WSAL_Helpers_DataHelper::JsonDecode( $val );
$this->$key = ( null == $json_decoded_val ) ? $val : $json_decoded_val;
$this->$key = ( null == $json_decoded_val ) ? $val : $json_decoded_val;
break;
case is_int( $copy->$key ):
$this->$key = (int) $val;
Expand Down Expand Up @@ -220,10 +220,10 @@ public function Save() {
$this->created_on = $this->GetMicrotime();
}
$update_id = $this->getId();
$result = $this->getAdapter()->Save( $this );
$result = $this->getAdapter()->Save( $this );

if ( false !== $result ) {
$this->_state = ( ! empty( $update_id ) ) ? self::STATE_UPDATED : self::STATE_CREATED;
$this->_state = ( ! empty( $update_id )) ? self::STATE_UPDATED : self::STATE_CREATED;
}
return $result;
}
Expand All @@ -236,7 +236,7 @@ public function Save() {
*/
public function Delete() {
$this->_state = self::STATE_UNKNOWN;
$result = $this->getAdapter()->Delete( $this );
$result = $this->getAdapter()->Delete( $this );
if ( false !== $result ) {
$this->_state = self::STATE_DELETED;
}
Expand Down
6 changes: 5 additions & 1 deletion classes/Models/Occurrence.php
Original file line number Diff line number Diff line change
Expand Up @@ -204,14 +204,18 @@ public function GetMessage( $meta_formatter = null, $highlight = false, $meta =
'name' => __( 'BBPress', 'wp-security-audit-log' ),
'event_ids' => array( 8000, 8001, 8002, 8003, 8004, 8005, 8006, 8007, 8008, 8009, 8010, 8011, 8012, 8013, 8014, 8015, 8016, 8017, 8018, 8019, 8020, 8021, 8022, 8023 ),
),
'wfcm' => array(
'name' => __( 'WFCM', 'wp-security-audit-log' ),
'event_ids' => array( 6028, 6029, 6030, 6031, 6032, 6033 ),
),
);
$installer_nonce = wp_create_nonce( 'wsal-install-addon' );
foreach ( $addon_event_codes as $key => $addon ) {
$f1 = in_array( $this->alert_id, $addon['event_ids'], true );
if ( in_array( $this->alert_id, $addon['event_ids'], true ) ) {
// check key and update message here.
$message = sprintf(
'The details of this event are unknown. You need to install the add-on for %1$s to see the details.%2$s%3$sInstall and activate add-on%4$s',
'The details of this event are unknown. You need to install the add-on for %1$s to see the details.%2$s%3$sInstall and activate extension %4$s',
esc_html( $addon['name'] ),
'<br />',
'<button type="button" class="button-primary wsal-addon-install-trigger" data-nonce="' . esc_attr( $installer_nonce ) . '" data-addon-name="' . esc_attr( $key ) . '">',
Expand Down
16 changes: 2 additions & 14 deletions classes/SensorManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ public function __construct( WpSecurityAuditLog $plugin ) {
/*
* @since 3.5.1 Allow loading classes where names match the
* filename 1:1. Prior to version 3.5.1 sensors were always
* asummed to be defined WITH `WSAL_Sensors_` prefis in the
* class name but WITHOUT it in the filename. This behavor
* assumed to be defined WITH `WSAL_Sensors_` prefix in the
* class name but WITHOUT it in the filename. This behavior
* is retained for back-compat.
*/
$class = ( class_exists( $sensor ) ) ? $sensor : 'WSAL_Sensors_' . $sensor;
Expand Down Expand Up @@ -297,18 +297,6 @@ public function check_sensor_before_load( $load_sensor, $filepath ) {
}
break;

case 'FileChanges':
// If file changes is disabled then don't load file changes sensor.
if ( 'enable' !== $this->plugin->GetGlobalOption( 'scan-file-changes', 'enable' ) ) {
$load_sensor = false;

// Clear scheduled hook if there is any hook scheduled.
if ( wp_next_scheduled( WSAL_Sensors_FileChanges::$schedule_hook ) ) {
wp_clear_scheduled_hook( WSAL_Sensors_FileChanges::$schedule_hook );
}
}
break;

case 'FrontendWooCommerce':
if ( is_user_logged_in() || ! WpSecurityAuditLog::is_woocommerce_active() || empty( $frontend_events['woocommerce'] ) ) {
$load_sensor = false;
Expand Down
Loading

0 comments on commit c535713

Please sign in to comment.