Esempio n. 1
0
     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'])) {
         $type = intval($_POST['scanType']);
         $eInfo['message'] = $type;
         $scanSettings = WsdWPScanSettings::getSettings();
         $scanProgress = $scanSettings['SCAN_PROGRESS'];
         $scanState = $scanSettings['SCAN_STATE'];
         $scanType = $scanSettings['SCAN_TYPE'];
         $result = WsdWpScanner::registerScan($type);
         if (-1 == $result) {
             $eInfo['error'] = "A scan is already pending to start. You must wait for it to finish to register another one.";
             $enableSubmit = false;
         } elseif (0 == $result) {
             $eInfo['error'] = "A scan is already in progress. You must wait for it to finish to register another one.";
             $enableSubmit = false;
         } elseif (1 == $result) {
             $eInfo['error'] = "Invalid form. Please provide a valid scan type.";
         } elseif (2 == $result) {
             $eInfo['error'] = "Internal Error: could not retrieve the ID for the last added scan.";
         } elseif (3 === $result) {
             $eInfo['message'] = "Scan successfully registered. It should start in approximately 1 minute. You can come back later on to check on its status.";
             $scanSettings = WsdWPScanSettings::getSettings();
             $scanProgress = $scanSettings['SCAN_PROGRESS'];
             $scanState = $scanSettings['SCAN_STATE'];