Index: amfphp.module =================================================================== --- amfphp.module (revision 2581) +++ amfphp.module (working copy) @@ -1,6 +1,26 @@ 'admin/settings/amfphp/exceptions', + 'title' => t('AMFPHP Exceptions Configuration'), + 'callback' => 'drupal_get_form', + 'callback arguments' => array('amfphp_admin'), + 'description' => t('AMFPHP Exception handling configuration'), + 'access' => user_access('administer site configuration') + ); + } + return $items; +} + /* * Implementation of hook_requirements() */ @@ -47,8 +67,8 @@ $gateway->setClassPath($servicesPath); $gateway->setClassMappingsPath($voPath); $gateway->setCharsetHandler("utf8_decode", "ISO-8859-1", "ISO-8859-1"); - $gateway->setErrorHandling(E_ALL ^ E_NOTICE); - + $gateway->setErrorHandling(variable_get(AMFPHP_EXCEPTION_HANDLER, 2039)); + if(PRODUCTION_SERVER) { $gateway->disableDebug(); @@ -98,5 +118,27 @@ * Implementation of hook_server_error() */ function amfphp_server_error($message) { - trigger_error($message, E_USER_ERROR); + trigger_error($message, variable_get(AMFPHP_EXCEPTION_HANDLER, 2039)); +} + +function amfphp_admin(){ + $form = array(); + $form['amfphp'] = array( + '#type' => 'fieldset', + '#title' => t('AMFPHP Exception Settings'), + '#collapsible' => FALSE, + '#collapsed' => FALSE, + '#weight' => -4, + ); + $form['amfphp'][AMFPHP_EXCEPTION_HANDLER] = array( + '#type' => 'select', + '#title' => t('Select PHP error threshold'), + '#default_value' => variable_get(AMFPHP_EXCEPTION_HANDLER, 2039), + '#options' => array( + 2039 => t('E_ALL ^ E_NOTICE'), + 2047 => t('E_ERROR') + ), + '#description' => 'Configure the PHP error types for which AMFPHP will throw exceptions' + ); + return system_settings_form($form); } \ No newline at end of file