/** * reports ands logs error * * skip the log of there are filesystem problems. * * @param string $err * @param bool $skiplog */ function errDie($errstring, $skiplog = false) { $err = DATE_LOGGING . " - " . SELF . " - {$errstring}"; if (pg_ErrorMessage()) { $err .= " - " . pg_ErrorMessage(); } // log error to file die($errstring); if ($skiplog === false && ($fd = cfs::fopen("error_log", 'a'))) { if (cfs::fwrite($fd, "{$err}\n")) { $errlog_msg = "Error has been logged. Please notify the administrator."; } else { $errlog_msg = "Error writing to error log. Please notify the administrator."; } cfs::fclose($fd); } else { $errlog_msg = "Error opening error log. Please notify the administrator."; } $OUTPUT = "{$errstring} {$errlog_msg}"; require "newtemplate.php"; }
/** * reports ands logs error * * skip the log of there are filesystem problems. * * @param string $err * @param bool $skiplog */ function errDie($errstring, $skiplog = false) { pglib_transaction("ROLLBACK"); if (!defined("USER_NAME")) { define("USER_NAME", "Not Logged In"); } $err = DATE_LOGGING . " - " . SELF . " - " . USER_NAME . " - {$errstring}"; if (pg_ErrorMessage()) { $err .= " - " . pg_ErrorMessage(); } // log error to file if ($skiplog === false && ($fd = cfs::fopen("error_log", 'a'))) { if (cfs::fwrite($fd, "{$err}\n")) { $errlog_msg = "Error has been logged. Please notify the administrator."; } else { $errlog_msg = "Error writing to error log. Please notify the administrator."; } cfs::fclose($fd); } else { $errlog_msg = "Error opening error log. Please notify the administrator."; } $OUTPUT = "{$errstring} {$errlog_msg}"; require relpath("template.php"); }