moved debug() function and code down into the \psm namespace of inc.php
set minimal error reporting when not in debug mode
fixed references to portal->hasRendered() and debug()
prevent errors if $tr['file'] or $tr['line'] are not set in backtrace() function