sql.php 837 B

12345678910111213141516171819202122232425262728293031
  1. <?php
  2. class Logger_SQL {
  3. function log_error($errno, $errstr, $file, $line, $context) {
  4. if ($errno == E_NOTICE) return false;
  5. if (Db::get()) {
  6. $errno = Db::get()->escape_string($errno);
  7. $errstr = Db::get()->escape_string($errstr);
  8. $file = Db::get()->escape_string($file);
  9. $line = Db::get()->escape_string($line);
  10. $context = ''; // backtrace is a lot of data which is not really critical to store
  11. //$context = db_escape_string( serialize($context));
  12. $owner_uid = $_SESSION["uid"] ? $_SESSION["uid"] : "NULL";
  13. $result = Db::get()->query(
  14. "INSERT INTO ttrss_error_log
  15. (errno, errstr, filename, lineno, context, owner_uid, created_at) VALUES
  16. ($errno, '$errstr', '$file', '$line', '$context', $owner_uid, NOW())");
  17. return Db::get()->affected_rows($result) != 0;
  18. }
  19. return false;
  20. }
  21. }
  22. ?>