Example #1
0
/**
 * Process the data returned from the results of a SiteCheck scan and generate
 * the HTML code to display the information in the malware scan page inside the
 * remote scanner results tab.
 *
 * @param  array $scan_results Array with information of the scanning.
 * @param  array $params       Array with psuedo-variables to build the template.
 * @return array               Psuedo-variables to build the template including extra info.
 */
function sucuriscan_sitecheck_scanner_results($scan_results = false, $params = array())
{
    $secvars = array('CacheLifeTime' => SUCURISCAN_SITECHECK_LIFETIME, 'WebsiteStatus' => 'Site status unknown', 'NoMalwareRowVisibility' => 'visible', 'FixButtonVisibility' => 'hidden', 'MalwarePayloadList' => '');
    if (isset($scan_results['MALWARE']['WARN'])) {
        $params['ScannerResults.CssClass'] = 'sucuriscan-red-tab';
        $secvars['WebsiteStatus'] = 'Site compromised (malware was identified)';
        $secvars['NoMalwareRowVisibility'] = 'hidden';
        $secvars['FixButtonVisibility'] = 'visible';
        foreach ($scan_results['MALWARE']['WARN'] as $key => $malres) {
            $malres = SucuriScanAPI::getSitecheckMalware($malres);
            if ($malres !== false) {
                $secvars['MalwarePayloadList'] .= SucuriScanTemplate::getSnippet('malwarescan-resmalware', array('MalwareKey' => $key, 'MalwareDocs' => $malres['malware_docs'], 'MalwareType' => $malres['malware_type'], 'MalwarePayload' => $malres['malware_payload'], 'AlertMessage' => $malres['alert_message'], 'InfectedUrl' => $malres['infected_url']));
            }
        }
    } else {
        $secvars['WebsiteStatus'] = 'Site clean (no malware was identified)';
    }
    $params['ScannerResults.Content'] = SucuriScanTemplate::getSection('malwarescan-resmalware', $secvars);
    return $params;
}