コード例 #1
0
 /**
  * Functionaly to execute when calling the verb
  *
  * Functionality to execute when calling this verb VIA Sync.
  *
  * @since 4.0.0
  *
  * @return array response indicating result of the file scan
  */
 public function run()
 {
     //We need the ITSEC_File_Change object to access the execution method.
     $module = new ITSEC_File_Change();
     $module->run();
     $response = $module->execute_file_check(false, true);
     return $response;
 }
コード例 #2
0
 /**
  * Performs a file change scan
  *
  * @since 1.12
  *
  * @return void
  */
 public function filescan()
 {
     if (!class_exists('ITSEC_File_Change')) {
         WP_CLI::error(__('File change scanning is not enabled. You must enable the module first.', 'it-l10n-ithemes-security-pro'));
     }
     $module = new ITSEC_File_Change();
     $module->run();
     $response = $module->execute_file_check(false, true);
     if (!is_array($response) && $response !== false) {
         //Response isn't correct, throw an error
         WP_CLI::error(__('There was an error in the scan operation. Please check the site logs or contact support.', 'it-l10n-ithemes-security-pro'));
     } elseif (isset($response['added']) && sizeof($response['added']) > 0 || isset($response['removed']) && sizeof($response['removed']) > 0 || isset($response['changed']) && sizeof($response['changed']) > 0) {
         //file changes were detected
         $added = array();
         $removed = array();
         $modified = array();
         //process added files if we have them
         if (isset($response['added']) && sizeof($response['added']) > 0) {
             foreach ($response['added'] as $index => $data) {
                 $added[] = $this->format_filescan(__('added', 'it-l10n-ithemes-security-pro'), $index, $data['h'], $data['d']);
             }
         }
         //process removed files if we have them
         if (isset($response['removed']) && sizeof($response['removed']) > 0) {
             foreach ($response['removed'] as $index => $data) {
                 $removed[] = $this->format_filescan(__('removed', 'it-l10n-ithemes-security-pro'), $index, $data['h'], $data['d']);
             }
         }
         //process modified files if we have them
         if (isset($response['changed']) && sizeof($response['changed']) > 0) {
             foreach ($response['changed'] as $index => $data) {
                 $modified[] = $this->format_filescan(__('modified', 'it-l10n-ithemes-security-pro'), $index, $data['h'], $data['d']);
             }
         }
         $file_changes = array_merge($added, $removed, $modified);
         $obj_type = 'itsec_file_changes';
         $obj_fields = array('type', 'file', 'hash', 'date');
         $defaults = array('format' => 'table', 'fields' => array('type', 'file', 'hash', 'date'));
         $formatter = $this->get_formatter($defaults, $obj_fields, $obj_type);
         $formatter->display_items($file_changes);
     } else {
         //no changes detected
         WP_CLI::success(__('File scan completed. No changes were detected.', 'it-l10n-ithemes-security-pro'));
     }
 }
コード例 #3
0
 /**
  * Executes one-time file scan.
  *
  * Processes the ajax request to execute a one-time file scan.
  *
  * @since 4.0.0
  *
  * @return void
  */
 public function wp_ajax_itsec_file_change_ajax()
 {
     if (!wp_verify_nonce(sanitize_text_field($_POST['nonce']), 'itsec_do_file_check')) {
         die(__('Security error!', 'it-l10n-better-wp-security'));
     }
     $module = new ITSEC_File_Change();
     $module->run();
     die($module->execute_file_check(false));
 }
コード例 #4
0
 public function file_check()
 {
     global $itsec_globals, $itsec_modules_path;
     if (!class_exists('ITSEC_File_Change')) {
         require $itsec_modules_path . 'file-change/class-itsec-file-change.php';
     }
     $module = new ITSEC_File_Change();
     $module->run();
     $file_change = get_site_option('itsec_file_change');
     if (false !== $file_change && isset($file_change['last_run'])) {
         $last_run = $file_change['last_run'];
     } else {
         $last_run = 0;
     }
     return array('result' => (int) $module->execute_file_check(false), 'last_run' => $last_run);
 }
コード例 #5
0
 public function file_check()
 {
     global $itsec_globals;
     if (!class_exists('ITSEC_File_Change')) {
         require trailingslashit($itsec_globals['plugin_dir']) . 'modules/free/file-change/class-itsec-file-change.php';
     }
     $module = new ITSEC_File_Change();
     $module->run();
     $file_change = get_site_option('itsec_file_change');
     if ($file_change !== false && isset($file_change['last_run'])) {
         $last_run = $file_change['last_run'];
     } else {
         $last_run = 0;
     }
     return array('result' => (int) $module->execute_file_check(false), 'last_run' => $last_run);
 }
コード例 #6
0
ファイル: active.php プロジェクト: Garth619/Femi9
<?php

require_once dirname(__FILE__) . '/class-itsec-file-change.php';
$itsec_file_change = new ITSEC_File_Change();
$itsec_file_change->run();
if (is_admin()) {
    require_once dirname(__FILE__) . '/admin.php';
}