I'm using Evolution 1.0.2
Yes in order to create a more streamlined experience for users, and increase security by not displaying any information a hacker could use. I'd like to redirect any parse error to a page not found for my production environment.
Could a plugin be used to accomplish such a thing? Something like this:
if ($modx->event->name == 'OnPageNotFound') {
$errorPage = $modx->getOption('pnf.page');
if (empty($errorPage)) {
$modx->sendErrorPage();
} else {
$mailto = $modx->getOption('pnf.mailto');
if (!empty($mailto)) {
// send a message to a local account
$resourceId = $modx->resource->get('id');
$subject = 'Page not found';
$body = 'Someone tried to access document id '.$resourceId;
$modx->getService('mail', 'mail.modPHPMailer');
$modx->mail->set(modMail::MAIL_BODY, $body);
$modx->mail->set(modMail::MAIL_FROM, '$modx->getOption('pnf.mailfrom'));
$modx->mail->set(modMail::MAIL_FROM_NAME, 'MODx');
$modx->mail->set(modMail::MAIL_SENDER, 'MODx');
$modx->mail->set(modMail::MAIL_SUBJECT, $subject);
$modx->mail->address('to',$mailto);
$modx->mail->setHTML(true);
$modx->mail->send();
}
$url = $this->makeUrl($scriptProperties['page']);
$modx->sendRedirect($url, 1);
exit;
}
}
Except instead of triggering when the page isn't found (OnPageNotFound) trigger whenever a parse error is detected.