public function reportErrors()
{
// if there're no actual errors,
if (!$this->hasErrors() || $this->countErrors() == $this->countUserErrors()) {
// then simply return.
return;
}
// Delete all the prev_errors in session & store new prev_errors in session
$this->savePreviousErrors();
$response = Response::getInstance();
$jsCode = '';
if ($GLOBALS['cfg']['SendErrorReports'] == 'always') {
if ($response->isAjax()) {
// set flag for automatic report submission.
$response->addJSON('_sendErrorAlways', '1');
} else {
// send the error reports asynchronously & without asking user
$jsCode .= '$("#pma_report_errors_form").submit();' . 'PMA_ajaxShowMessage(
PMA_messages["phpErrorsBeingSubmitted"], false
);';
// js code to appropriate focusing,
$jsCode .= '$("html, body").animate({
scrollTop:$(document).height()
}, "slow");';
}
} elseif ($GLOBALS['cfg']['SendErrorReports'] == 'ask') {
//ask user whether to submit errors or not.
if (!$response->isAjax()) {
// js code to show appropriate msgs, event binding & focusing.
$jsCode = 'PMA_ajaxShowMessage(PMA_messages["phpErrorsFound"]);' . '$("#pma_ignore_errors_popup").bind("click", function() {
PMA_ignorePhpErrors()
});' . '$("#pma_ignore_all_errors_popup").bind("click",
function() {
PMA_ignorePhpErrors(false)
});' . '$("#pma_ignore_errors_bottom").bind("click", function(e) {
e.preventDefaulut();
PMA_ignorePhpErrors()
});' . '$("#pma_ignore_all_errors_bottom").bind("click",
function(e) {
e.preventDefault();
PMA_ignorePhpErrors(false)
});' . '$("html, body").animate({
scrollTop:$(document).height()
}, "slow");';
}
}
// The errors are already sent from the response.
// Just focus on errors division upon load event.
$response->getFooter()->getScripts()->addCode($jsCode);
}