protected function get_scan_details()
 {
     require_once dirname(__FILE__) . '/class-itsec-malware-scanner.php';
     require_once dirname(__FILE__) . '/class-itsec-malware-scan-results-template.php';
     $results = ITSEC_Malware_Scanner::scan();
     $html = ITSEC_Malware_Scan_Results_Template::get_html($results, true);
     return $html;
 }
	public static function scan() {
		global $itsec_globals;
		
		require_once( dirname( __FILE__ ) . '/class-itsec-malware-scheduling-admin.php' );
		
		
		$defaults = array(
			'enabled'             => false,
			'email_notifications' => true,
			'email_contacts'      => array(),
		);
		
		$settings = get_site_option( 'itsec_malware_scheduling', array() );
		
		if ( ! is_array( $settings ) ) {
			$settings = array();
		}
		
		$settings = array_merge( $defaults, $settings );
		
		if ( ! $settings['enabled'] ) {
			ITSEC_Malware_Scheduling_Admin::update_schedule( $settings['enabled'] );
			return;
		}
		
		
		require_once( trailingslashit( $itsec_globals['plugin_dir'] ) . 'core/modules/malware/class-itsec-malware-scanner.php' );
		$results = ITSEC_Malware_Scanner::scan();
		
		if ( ! $settings['email_notifications'] ) {
			return;
		}
		
		$subject = self::get_email_subject( $results );
		
		if ( empty( $subject ) ) {
			return;
		}
		
		$addresses = self::get_email_addresses( $settings['email_contacts'] );
		
		if ( empty( $addresses ) ) {
			$display = ini_set( 'display_errors', false );
			trigger_error( __( 'One or more malware issues were found by iThemes Security, but no user could be found to send the email notification to. Please update the Malware Scan Scheduling settings for iThemes Security so that email notifications are properly sent.', 'it-l10n-ithemes-security-pro' ) );
			ini_set( 'display_errors', $display );
			return;
		}
		
		$message = self::get_email_message( $results );
		$headers = array( 'Content-Type: text/html; charset=UTF-8' );
		
		foreach ( $addresses as $address ) {
			wp_mail( $address, $subject, $message, $headers );
		}
	}
示例#3
0
 public function handle_ajax_request($data)
 {
     global $itsec_globals;
     require_once dirname(__FILE__) . '/class-itsec-malware-scanner.php';
     require_once dirname(__FILE__) . '/class-itsec-malware-scan-results-template.php';
     if (!ITSEC_Core::current_user_can_manage()) {
         $results = new WP_Error('itsec-settings-malware-scan-insufficient-privileges', __('An error prevented the scan from completing as expected. The currently logged in user does not have sufficient permissions to run this scan. You may need to log out of the site and log back in.', 'better-wp-security'));
     } else {
         $results = ITSEC_Malware_Scanner::scan();
     }
     ITSEC_Response::set_response(ITSEC_Malware_Scan_Results_Template::get_html($results, true));
 }
 public function run($arguments)
 {
     $arguments = Ithemes_Sync_Functions::merge_defaults($arguments, $this->default_arguments);
     require_once dirname(__FILE__) . '/class-itsec-malware-scanner.php';
     return ITSEC_Malware_Scanner::scan();
 }