<?php if (!WsdUtil::canLoad()) { return; } if (!WsdUtil::isAdministrator()) { return; } // retrieve the list of all previous scans $scans = WsdWpScanner::getScans(); $numScans = count($scans); if ($numScans < 1) { echo '<p>There are no finished scans yet.</p>'; } else { if (!$showScanForm) { echo '<form method="post" id="wpScanFormDelete">'; echo function_exists('wp_nonce_field') ? wp_nonce_field('wss-wp-scan-nonce') : ''; } echo '<ul id="wssLastScansList">'; foreach ($scans as $scan) { $scanFailed = $scan->scanResult == 0; echo '<li>'; echo '<a class="scanReportItem-js" id="e-' . $scan->scanId . '" href="admin.php?page=' . WPS_PLUGIN_PREFIX . 'wpscan&scan=' . $scan->scanId . '" title="Click to view the scan report">' . $scan->scanEndDate . '</a>'; if ($scanFailed) { echo '<i class="icon-exclamation-sign" title="Scan Failed"></i>'; } else { echo '<i class="icon-ok" title="Scan Completed"></i>'; } echo ' <a href="#" title="Delete scan report" class="wss-delete-scan-js" data-scan-id="' . $scan->scanId . '"><i class="icon-remove"></i></a>'; echo '</li>'; }
<?php if (!WsdUtil::canLoad()) { return; } if (!WsdUtil::isAdministrator()) { return; } // get last scan info $scanID = WsdWpScanner::getLastScanID_table(); $scanInfo = WsdWpScanner::getScanInfo($scanID); $scanId = $scanInfo->scanId; $scanStartDate = $scanInfo->scanStartDate; $scanEndDate = $scanInfo->scanEndDate; $scanFailed = $scanInfo->scanResult == 0; $scanType = $scanInfo->scanType; $h24 = 24 * 60 * 60; $since = 0; if ($scanType == 0) { $since = strtotime($scanStartDate); } elseif ($scanType == 1) { $since = strtotime($scanStartDate) - $h24; } elseif ($scanType == 2) { $since = strtotime($scanStartDate) - 2 * $h24; } elseif ($scanType == 3) { $since = strtotime($scanStartDate) - 3 * $h24; } elseif ($scanType == 4) { $since = strtotime($scanStartDate) - 4 * $h24; } elseif ($scanType == 5) { $since = strtotime($scanStartDate) - 5 * $h24; } elseif ($scanType == 6) {
<?php if ($enableSubmit) { ?> <input type="button" id="inputFormScan" class="button button-primary" value="Scan" /><?php } ?> </form> <div id="scanStateWrapper"> <?php /**[[ check the state ]]*/ ?> <?php if ($scanState == WsdWPScanSettings::SCAN_STATE_NONE) { //#! Check if there is a previous scan completed $scanID = WsdWpScanner::getLastScanID_table(); if (!empty($scanID)) { echo WsdUtil::loadTemplate('tpl-scan-done'); } else { echo WsdUtil::loadTemplate('tpl-scan-none'); } } elseif ($scanState == WsdWPScanSettings::SCAN_STATE_WAITING) { echo WsdUtil::loadTemplate('tpl-scan-waiting', array('scanID' => $scanSettings['SCAN_ID'])); } elseif ($scanState == WsdWPScanSettings::SCAN_STATE_DONE) { echo WsdUtil::loadTemplate('tpl-scan-done'); } elseif ($scanState == WsdWPScanSettings::SCAN_STATE_IN_PROGRESS) { echo WsdUtil::loadTemplate('tpl-scan-progress', array('scanID' => $scanSettings['SCAN_ID'])); } ?> </div> </div>
public static function stopScan($completed = false, $failReason = '') { $scanID = self::$_scanID; if (empty($scanID)) { $optData = WpsOption::getOption(WpsSettings::WP_FILE_SCAN_OPTION_NAME); if (empty($optData)) { wssLog('Empty $optData. Checking db table for any incomplete scan.'); $sid = WsdWpScanner::getLastScanID_table(); if (empty($sid)) { wssLog('No incomplete scans found either.'); return; } else { wssLog("Incomplete scan found: {$sid}"); $scanID = $sid; } } else { $scanID = $optData['SCAN_ID']; if (empty($scanID)) { return; } } } $m = __METHOD__ . '() '; wssLog($m . 'triggered.'); if ($completed) { self::_markScanCompleted(); } else { wssLog('Fail reason: ' . $failReason); self::_markScanFailed($scanID, $failReason); } WsdWPScanSettings::deleteSettings(); wssLog('Scan (' . $scanID . ') marked as ' . ($completed ? 'completed' : 'failed') . ' and options deleted.' . PHP_EOL . str_repeat('=', 50)); }
if (empty($scanID)) { if (!headers_sent()) { header("Location: admin.php?page=" . WPS_PLUGIN_PREFIX . 'wpscan'); exit; } echo '<script type="text/javascript">window.location.href = "admin.php?page=' . WPS_PLUGIN_PREFIX . 'wpscan";</script>'; return; } else { $isValidScan = WsdWpScanner::isValidScan($scanID); if ($isValidScan) { $scanInfo = WsdWpScanner::getScanInfo($scanID); $scanStartDate = $scanInfo->scanStartDate; $scanEndDate = $scanInfo->scanEndDate; $scanFailed = $scanInfo->scanResult; $failReason = $scanInfo->failReason; $entries = WsdWpScanner::getFailedEntries($scanID); $scanType = $scanInfo->scanType; $h24 = 24 * 60 * 60; $since = 0; if ($scanType == 0) { $since = strtotime($scanStartDate); } elseif ($scanType == 1) { $since = strtotime($scanStartDate) - $h24; } elseif ($scanType == 2) { $since = strtotime($scanStartDate) - 2 * $h24; } elseif ($scanType == 3) { $since = strtotime($scanStartDate) - 3 * $h24; } elseif ($scanType == 4) { $since = strtotime($scanStartDate) - 4 * $h24; } elseif ($scanType == 5) { $since = strtotime($scanStartDate) - 5 * $h24;