function fdx_ajax_file_scan() { $settings = $this->fdx_get_settings(); check_ajax_referer('fdx-scanner_scan'); $start = (int) $_POST['start']; $max = $settings['p3_op1']; $args = compact('start', 'max'); $scanner = new File_FDX_Scanner(ABSPATH, $args); $result = $scanner->run(); if (is_wp_error($result)) { $message = $result->get_error_message(); $data = $result->get_error_data(); echo json_encode(array('status' => 'error', 'message' => $message, 'data' => $data)); } else { if ($result) { echo json_encode(array('status' => 'complete')); } else { echo json_encode(array('status' => 'running', 'data' => __('Scanner filesystem', $this->hook) . ': ' . ($start + $max) . '...')); } } exit; }
} elseif (current_time('timestamp') - 15 * 24 * 60 * 60 > get_site_option('p3_log_time')) { echo '<div class="box-shortcode box-yellow">' . sprintf(__('Warning: Executed for more than <code>%s</code> days. Click in button "Execute" for a new analysis.', $this->hook), '15') . '</div>'; } else { echo '<div class="box-shortcode box-blue">' . __('Last run on', $this->hook) . ':<strong>' . date(get_option('date_format') . ', ' . get_option('time_format'), get_site_option('p3_log_time')) . '</strong></div>'; } } /* poststuff and sidebar *********************************************************************************/ echo '<div id="poststuff"><div id="post-body" class="metabox-holder columns-2">'; include 'inc-sidebar.php'; //include echo '<div class="postbox-container"><div class="meta-box-sortables" id="hiddenoff">'; //if error if (isset($_POST['action']) && 'scan' == $_POST['action']) { check_admin_referer('fdx-scan_all'); $scanner = new File_FDX_Scanner(ABSPATH, array('start' => 0)); $scanner->run(); $scanner = new RunEnd(); $scanner->RunEnd(); } //------------postbox 1 echo '<form action="" method="post">'; echo '<input type="hidden" name="action" value="scan" />'; echo '<div class="postbox">'; echo '<div class="handlediv" title="' . __('Click to toggle', $this->hook) . '"><br /></div><h3 class="hndle"><span>' . __('File System', $this->hook) . '</span> '; submit_button(__('Execute', $this->hook), 'primary', 'Submit', false, array('id' => 'run-scanner')); echo '</h3><div class="inside">'; echo '<p>' . __('Scours your file system by suspicious or potentially malicious files, compressed, log, binary, data, and temporary files. And any unknown file in WP core.', $this->hook) . '</p><p>'; echo __('Detects unknown file found in WP core', $this->hook) . ': <code>*' . __('any file', $this->hook) . '</code><br />'; echo __('Detects suspicious or potentially malicious files', $this->hook) . ': <code>*.exe</code> | <code>*.com</code> | <code>*.scr</code> | <code>*.bat</code> | <code>*.msi</code> | <code>*.vb</code> | <code>*.cpl</code><br />'; echo __('Detects compressed files', $this->hook) . ': <code>*.zip</code> | <code>*.rar</code> | <code>*.7z</code> | <code>*.gz</code> | <code>*.tar</code> | <code>*.bz2</code><br />';