Ejemplo n.º 1
0
$rm = strtoupper($_SERVER['REQUEST_METHOD']);
if ('POST' == $rm) {
    if (function_exists('wp_nonce_field')) {
        check_admin_referer('wss-wp-scan-nonce');
    }
    $scanSettings = WsdWPScanSettings::getSettings();
    $scanProgress = $scanSettings['SCAN_PROGRESS'];
    $scanState = $scanSettings['SCAN_STATE'];
    $scanType = $scanSettings['SCAN_TYPE'];
    $scanID = $scanSettings['SCAN_ID'];
    //#! Check if this is a request to delete scans
    if (isset($_POST['deleteScan'])) {
        $scanID = intval($_POST['deleteScan']);
        wssLog('Receiving delete scan command for scan ID: ', $scanID);
        if (WsdWpScanner::isValidScan($scanID)) {
            if (!WsdWpScanner::deleteScan($scanID)) {
                echo '<script type="text/javascript">alert("Error: Could not delete scan. Scan ID = "+' . $scanID . ');</script>';
            }
        } else {
            echo '<script type="text/javascript">alert("Invalid scan id provided: "+' . $scanID . ');</script>';
        }
    } elseif (isset($_POST['deleteAllScans'])) {
        wssLog('Receiving command: delete all scans.');
        if (WsdWpScanner::deleteAllScans()) {
            $eInfo['message'] = 'All scans have been deleted.';
        } else {
            $eInfo['error'] = 'An error occurred while deleting the scans. Please try again in a few moments.';
        }
    } else {
        // scanType
        if (isset($_POST['scanType'])) {