function sendEmail($lastemailsent, $emailinterval, $alreadyRunning) { $emailreport = false; if ($this->db->getTotals() === 0) { $emailreport = $this->sendEmailAnyway($lastemailsent, $emailinterval); } else { $emailreport = true; } if (Logfile::getNoErrors() > 0) { $emailreport = true; } if ($alreadyRunning) { $emailreport = true; } return $emailreport; }
function summaryReport() { $text = ""; if (Logfile::getNoErrors() > 0) { $text .= "<h2>WARNING</h2><p>Errors occurred during the scanning process, see error log on server for details</p>"; } if ($this->total === 0) { $text .= "<p>File structure has NOT changed.</p>" . PHP_EOL; } else { $text .= "<p>File structure has changed:-</p><ul>" . PHP_EOL; $text .= "<li> NEW files:" . $this->new . "</li>" . PHP_EOL; $text .= "<li> CHANGED files:" . $this->changed . "</li>" . PHP_EOL; $text .= "<li> DELETED files:" . $this->deleted . "</li></ul>" . PHP_EOL; $text .= "<p> </p>" . PHP_EOL; $text .= "<p>PLEASE review the changes, if you expected these changes then ignore this email</p>" . PHP_EOL; $text .= "<p>This email should also go to Administrators who will also review the changes</p>" . PHP_EOL; $text .= "<p>If you have any concerns that your site has been hacked then please raise a Support Issue</p>" . PHP_EOL; $text .= "<p> </p>" . PHP_EOL; if ($this->new > 0) { $text .= "<p> NEW files</p>" . PHP_EOL; $text .= "<ul>" . PHP_EOL; $text .= $this->listFilesInState(self::STATE_NEW, $this->new); $text .= "</ul>" . PHP_EOL; } if ($this->changed > 0) { $text .= "<p> CHANGED files</p>" . PHP_EOL; $text .= "<ul>" . PHP_EOL; $text .= $this->listFilesInState(self::STATE_CHANGED, $this->changed); $text .= "</ul>" . PHP_EOL; } if ($this->deleted > 0) { $text .= "<p> DELETED files</p>" . PHP_EOL; $text .= "<ul>" . PHP_EOL; $text .= $this->listFilesInState(self::STATE_DELETED, $this->deleted); $text .= "</ul>" . PHP_EOL; } } $text .= "<p> </p>" . PHP_EOL; $text .= "<p> </p>" . PHP_EOL; $text .= "<p>PHP version: " . PHP_VERSION . " Web Monitor version: " . VERSION_NUMBER . "</p>" . PHP_EOL; $text .= "<p>---------------------------------</p>" . PHP_EOL; return $text; }