diff --git a/.gitignore b/.gitignore index b5cef7f..3d7b952 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ .DS_Store /config/config-db.php /public/robots.txt +/.debug diff --git a/ajaxchat.php b/ajaxchat.php index c5414fc..3ddfd2d 100644 --- a/ajaxchat.php +++ b/ajaxchat.php @@ -8,6 +8,16 @@ */ define('AJAX_CHAT_PATH', __DIR__); +define('AJAX_CHAT_DEBUG', is_file(AJAX_CHAT_PATH . '/.debug')); + +// Only show errors in debug mode: +if(AJAX_CHAT_DEBUG) { + ini_set('display_errors', 'on'); + error_reporting(-1); +} else { + ini_set('display_errors', 'off'); + error_reporting(0); +} // Include Class libraries: require_once AJAX_CHAT_PATH . '/src/AJAXChat.php'; diff --git a/public/index.php b/public/index.php index 9abd2ed..20d9879 100644 --- a/public/index.php +++ b/public/index.php @@ -7,10 +7,6 @@ * @link https://blueimp.net/ajax/ */ -// Show all errors: -ini_set('display_errors', 'On'); -error_reporting(-1); - // Include Class libraries: require_once __DIR__ . '/../ajaxchat.php';