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 $template_variables Array with psuedo-variables to build the template.
 * @return array                     Array with psuedo-variables to build the template including extra information.
 */
function sucuriscan_sitecheck_scanner_results($scan_results = false, $template_variables = array())
{
    $secvars = array('CacheLifeTime' => SUCURISCAN_SITECHECK_LIFETIME, 'WebsiteStatus' => 'Site status unknown', 'NoMalwareRowVisibility' => 'visible', 'FixButtonVisibility' => 'hidden', 'MalwarePayloadList' => '');
    if (isset($scan_results['MALWARE']['WARN'])) {
        $template_variables['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::get_sitecheck_malware($malres);
            if ($malres !== false) {
                $secvars['MalwarePayloadList'] .= SucuriScanTemplate::get_snippet('malwarescan-resmalware', array('MalwareKey' => $key, 'MalwareDocs' => SucuriScan::escape($malres['malware_docs']), 'MalwareType' => SucuriScan::escape($malres['malware_type']), 'MalwarePayload' => SucuriScan::escape($malres['malware_payload']), 'AlertMessage' => SucuriScan::escape($malres['alert_message']), 'InfectedUrl' => SucuriScan::escape($malres['infected_url'])));
            }
        }
    } else {
        $secvars['WebsiteStatus'] = 'Site clean (no malware was identified)';
    }
    $template_variables['ScannerResults.Content'] = SucuriScanTemplate::get_section('malwarescan-resmalware', $secvars);
    return $template_variables;
}