helper.func.php 946 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. /**
  3. * The helpers of zin lib of ZenTaoPMS.
  4. *
  5. * @copyright Copyright 2024 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
  6. * @author Hao Sun <sunhao@easycorp.ltd>
  7. * @package zin
  8. * @version $Id
  9. * @link https://www.zentao.net
  10. */
  11. namespace zin;
  12. /**
  13. * Check if the debug mode is on.
  14. *
  15. * @param int $level - The min debug level.
  16. * @return bool
  17. */
  18. function isDebug($level = 1)
  19. {
  20. global $config;
  21. $debug = isset($config->debug) ? $config->debug : 0;
  22. if(is_bool($debug)) $debug = $debug ? 1 : 0;
  23. return $debug >= $level;
  24. }
  25. /**
  26. * Trigger an error.
  27. *
  28. * @param string $message - The error message.
  29. * @param int $level - The error level.
  30. * @param string $scope - The error scope.
  31. * @return void
  32. */
  33. function triggerError($message, $level = E_USER_ERROR, $scope = 'ZIN')
  34. {
  35. trigger_error("[$scope] $message", $level);
  36. }