public function start()
 {
     global $projectTmpDir, $php_errormsg;
     $authenticator = new Auth();
     if ($authenticator->auth()) {
         ob_start();
         if (!empty($_GET['a'])) {
             $action = $_GET['a'];
             $interval = empty($_GET['delay']) ? 5 : (int) $_GET['delay'];
             $fileScanner = new FileList();
             $fileScanner->setInterval($interval);
             if ($action === 'cleanUp') {
                 $this->removeTempFiles();
                 print json_encode(array('type' => 'cleanUp', 'status' => 'ok', 'phpError' => $php_errormsg));
             } else {
                 if ($action === 'getFileList') {
                     echo $fileScanner->performScanning();
                 } else {
                     if ($action === 'getSignatureScanResult') {
                         $this->detector = new MalwareDetector();
                         $this->detector->setRequestDelay($interval);
                         print $this->detector->malwareScanRound();
                     } else {
                         if ($action === 'getWebsiteLog') {
                             //REPORTING
                             $xmlLog = $this->getXMLReport();
                             $logFilename = $projectTmpDir . '/scan_log.xml';
                             file_put_contents2($logFilename, $xmlLog);
                             print json_encode(array('type' => 'getWebsiteLog', 'status' => 'ok', 'phpError' => $php_errormsg));
                         }
                     }
                 }
             }
         } else {
             //GENERATE INTERFACE
             $fileScanner = new FileList();
             define('PS_ARCHIVE_DOWNLOAD_URL', $_SERVER['PHP_SELF'] . '?controller=download&f=report');
             $this->templateOutput($fileScanner->getInterval());
         }
     }
 }