+if ((isExtensionActive('debug')) && (getTotalFatalErrors() == 0)) {
+ // Is the request parameter set?
+ if (isPostRequestElementSet('request')) {
+ // Handle the request
+ if (DEBUG_HANDLE_REQUEST(postRequestElement('request'))) {
+ // Construct FQFN for the module
+ $inc = sprintf("inc/debug/%s/request_%s",
+ getConfig('debug_mode'),
+ SQL_ESCAPE(postRequestElement('request'))
+ );
+
+ // Is the module there? Else we log it!
+ if (isIncludeReadable($inc)) {
+ // Load the request module
+ loadInclude($inc);
+ } else {
+ // Missing request file, may happen while development
+ DEBUG_ABUSE_LOG(__FILE__, __LINE__, 'request_404', postRequestElement('request'));
+ }
+ } else {
+ // Unhandled request detected
+ DEBUG_ABUSE_LOG(__FILE__, __LINE__, 'request_unhandled', postRequestElement('request'));
+ }
+ } else {
+ // Empty request
+ DEBUG_ABUSE_LOG(__FILE__, __LINE__, 'request_empty', '');
+ }
+} else {
+ // Not installed or fatal errors
+ DEBUG_ABUSE_LOG(__FILE__, __LINE__, 'request_fatal', getTotalFatalErrors());