summaryrefslogtreecommitdiff
blob: 8a054f995b85e12d2b6994c04be523c8661b2d6d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<?php
function debug ($type, $text=null) {
	global $S;
	if ($S['conf']['debug']) {
		if ($text===null) {
			$text=$type;
			$type=null;
		}
		if (defined('STDERR')) { // This is backend, probably
			fputs(STDERR, (isset($type)?$type.': ':'').$text."\n");
		} else { // This is probably frontend
			$S['debug'][]=array($type, $text);
		}
	}
}
?>