private function scan_checkSpamvertized()
 {
     if (wfConfig::get('isPaid')) {
         if (wfConfig::get('spamvertizeCheck')) {
             $this->statusIDX['spamvertizeCheck'] = wordfence::statusStart("Checking if your site is being Spamvertised");
             $result = $this->api->call('spamvertize_check', array(), array('siteURL' => site_url()));
             $haveIssues = false;
             if ($result['haveIssues'] && is_array($result['issues'])) {
                 foreach ($result['issues'] as $issue) {
                     $this->addIssue($issue['type'], $issue['level'], $issue['ignoreP'], $issue['ignoreC'], $issue['shortMsg'], $issue['longMsg'], $issue['data']);
                     $haveIssues = true;
                 }
             }
             wordfence::statusEnd($this->statusIDX['spamvertizeCheck'], $haveIssues);
         } else {
             wordfence::statusDisabled("Skipping check if your site is being spamvertized");
         }
     } else {
         wordfence::statusPaidOnly("Check if your site is being Spamvertized is for paid members only");
         sleep(2);
     }
 }
 /**
  * @param string $striplen
  * @param string $path
  * @param array $only
  * @param array $themes
  * @param array $plugins
  * @param wfScanEngine $engine
  * @throws Exception
  */
 public function __construct($striplen, $path, $only, $themes, $plugins, $engine)
 {
     $this->striplen = $striplen;
     $this->path = $path;
     $this->only = $only;
     $this->startTime = microtime(true);
     if (wfConfig::get('scansEnabled_core')) {
         $this->coreEnabled = true;
     }
     if (wfConfig::get('scansEnabled_plugins')) {
         $this->pluginsEnabled = true;
     }
     if (wfConfig::get('scansEnabled_themes')) {
         $this->themesEnabled = true;
     }
     if (wfConfig::get('scansEnabled_malware')) {
         $this->malwareEnabled = true;
     }
     $this->db = new wfDB();
     //Doing a delete for now. Later we can optimize this to only scan modified files.
     //$this->db->queryWrite("update " . $this->db->prefix() . "wfFileMods set oldMD5 = newMD5");
     $this->db->queryWrite("delete from " . $this->db->prefix() . "wfFileMods");
     $fetchCoreHashesStatus = wordfence::statusStart("Fetching core, theme and plugin file signatures from Wordfence");
     $dataArr = $engine->api->binCall('get_known_files', json_encode(array('plugins' => $plugins, 'themes' => $themes)));
     if ($dataArr['code'] != 200) {
         wordfence::statusEndErr();
         throw new Exception("Got error response from Wordfence servers: " . $dataArr['code']);
     }
     $this->knownFiles = @json_decode($dataArr['data'], true);
     if (!is_array($this->knownFiles)) {
         wordfence::statusEndErr();
         throw new Exception("Invalid response from Wordfence servers.");
     }
     wordfence::statusEnd($fetchCoreHashesStatus, false, true);
     if ($this->malwareEnabled) {
         $malwarePrefixStatus = wordfence::statusStart("Fetching list of known malware files from Wordfence");
         $malwareData = $engine->api->getStaticURL('/malwarePrefixes.bin');
         if (!$malwareData) {
             wordfence::statusEndErr();
             throw new Exception("Could not fetch malware signatures from Wordfence servers.");
         }
         if (strlen($malwareData) % 4 != 0) {
             wordfence::statusEndErr();
             throw new Exception("Malware data received from Wordfence servers was not valid.");
         }
         $this->malwareData = array();
         for ($i = 0; $i < strlen($malwareData); $i += 4) {
             $this->malwareData[substr($malwareData, $i, 4)] = '1';
         }
         wordfence::statusEnd($malwarePrefixStatus, false, true);
     }
     if ($this->path[strlen($this->path) - 1] != '/') {
         $this->path .= '/';
     }
     if (!is_readable($path)) {
         throw new Exception("Could not read directory " . $this->path . " to do scan.");
     }
     $this->haveIssues = array('core' => false, 'themes' => false, 'plugins' => false, 'malware' => false);
     if ($this->coreEnabled) {
         $this->status['core'] = wordfence::statusStart("Comparing core WordPress files against originals in repository");
     } else {
         wordfence::statusDisabled("Skipping core scan");
     }
     if ($this->themesEnabled) {
         $this->status['themes'] = wordfence::statusStart("Comparing open source themes against WordPress.org originals");
     } else {
         wordfence::statusDisabled("Skipping theme scan");
     }
     if ($this->pluginsEnabled) {
         $this->status['plugins'] = wordfence::statusStart("Comparing plugins against WordPress.org originals");
     } else {
         wordfence::statusDisabled("Skipping plugin scan");
     }
     if ($this->malwareEnabled) {
         $this->status['malware'] = wordfence::statusStart("Scanning for known malware files");
     } else {
         wordfence::statusDisabled("Skipping malware scan");
     }
 }
 private function scan_publicSite()
 {
     if (wfConfig::get('isPaid')) {
         if (wfConfig::get('scansEnabled_public')) {
             $this->publicScanEnabled = true;
             $this->statusIDX['public'] = wordfence::statusStart("Doing Remote Scan of public site for problems");
             $result = $this->api->call('scan_public_site', array(), array('siteURL' => site_url()));
             $haveIssues = false;
             if ($result['haveIssues'] && is_array($result['issues'])) {
                 foreach ($result['issues'] as $issue) {
                     $this->addIssue($issue['type'], $issue['level'], $issue['ignoreP'], $issue['ignoreC'], $issue['shortMsg'], $issue['longMsg'], $issue['data']);
                     $haveIssues = true;
                 }
             }
             wordfence::statusEnd($this->statusIDX['public'], $haveIssues);
         } else {
             wordfence::statusDisabled("Skipping remote scan of public site for problems");
         }
     } else {
         wordfence::statusPaidOnly("Remote scan of public facing site only available to paid members");
         sleep(2);
         //enough time to read the message before it scrolls off.
     }
 }