'Utilities', 'description' => "Helper Utilities for your Drupal site.", 'page callback' => 'drupal_get_form', 'page arguments' => array('util_page'), 'access arguments' => array('administer site configuration'), 'type' => MENU_NORMAL_ITEM, ); $menu['admin/settings/util/general'] = array( 'title' => 'Base', 'description' => "Helper Utilities for your Drupal site.", 'page callback' => 'drupal_get_form', 'page arguments' => array('util_page'), 'access arguments' => array('administer site configuration'), 'type' => MENU_DEFAULT_LOCAL_TASK, 'weight' => -10, ); $menu['admin/reports/error_level'] = array( 'title' => 'Site Error Levels', 'description' => "Details the current site error reporting level.", 'page callback' => 'util_error_levels', 'page arguments' => array(3), 'access arguments' => array('access site reports'), 'type' => MENU_NORMAL_ITEM, ); return $menu; } function _util_page() { return drupal_get_form('util_page'); } function util_page() { $form = array(); // For now output empty page, this is purely to reserve space for future development // and to allow contribs to form_alter onto this page. $form['util'] = array( '#value' => theme('advanced_help_topic', 'util', 'util') . t('The Utility module is a grouping of commonly-needed utilities that are simple to code, everyone wants, but nobody actually codes them.'), ); $form['clear'] = array( '#value' => '

Clicking the "Save" button will rebuild the menus.

', '#prefix' => '
', '#suffix' => '
', ); $form['#submit'][] = array('util_page_submit'); $form['buttons']['#weight'] = 99; return system_settings_form($form); } function util_page_submit() { menu_rebuild(); } /** * Show the current error reporting level. */ function util_error_levels($current = NULL) { $e_all = 2047; $levels = array( 'E_ERROR ' => array('value' => 1, 'desc' => 'Fatal run-time errors. These indicate errors that can not be recovered from, such as a memory allocation problem. Execution of the script is halted. ', 'note' => ' '), 'E_WARNING ' => array('value' => 2, 'desc' => 'Run-time warnings (non-fatal errors). Execution of the script is not halted. ', 'note' => ' '), 'E_PARSE ' => array('value' => 4, 'desc' => 'Compile-time parse errors. Parse errors should only be generated by the parser. ', 'note' => ' '), 'E_NOTICE ' => array('value' => 8, 'desc' => 'Run-time notices. Indicate that the script encountered something that could indicate an error, but could also happen in the normal course of running a script. ', 'note' => ' '), 'E_CORE_ERROR ' => array('value' => 16, 'desc' => 'Fatal errors that occur during PHPs initial startup. This is like an E_ERROR, except it is generated by the core of PHP. ', 'note' => 'since PHP 4'), 'E_CORE_WARNING ' => array('value' => 32, 'desc' => 'Warnings (non-fatal errors) that occur during PHPs initial startup. This is like an E_WARNING, except it is generated by the core of PHP. ', 'note' => 'since PHP 4'), 'E_COMPILE_ERROR ' => array('value' => 64, 'desc' => 'Fatal compile-time errors. This is like an E_ERROR, except it is generated by the Zend Scripting Engine. ', 'note' => 'since PHP 4'), 'E_COMPILE_WARNING ' => array('value' => 128, 'desc' => 'Compile-time warnings (non-fatal errors). This is like an E_WARNING, except it is generated by the Zend Scripting Engine. ', 'note' => 'since PHP 4'), 'E_USER_ERROR ' => array('value' => 256, 'desc' => 'User-generated error message. This is like an E_ERROR, except it is generated in PHP code by using the PHP function trigger_error(). ', 'note' => 'since PHP 4'), 'E_USER_WARNING ' => array('value' => 512, 'desc' => 'User-generated warning message. This is like an E_WARNING, except it is generated in PHP code by using the PHP function trigger_error(). ', 'note' => 'since PHP 4'), 'E_USER_NOTICE ' => array('value' => 1024, 'desc' => 'User-generated notice message. This is like an E_NOTICE, except it is generated in PHP code by using the PHP function trigger_error(). ', 'note' => 'since PHP 4'), ); if (version_compare(PHP_VERSION, '5.0.0', '>=')) { $levels += array( 'E_STRICT ' => array('value' => 2048, 'desc' => 'Enable to have PHP suggest changes to your code which will ensure the best interoperability and forward compatibility of your code. ', 'note' => 'since PHP 5'), ); } if (version_compare(PHP_VERSION, '5.2.0', '>=')) { $e_all = 6143; $levels += array( 'E_RECOVERABLE_ERROR ' => array('value' => 4096, 'desc' => 'Catchable fatal error. It indicates that a probably dangerous error occured, but did not leave the Engine in an unstable state. If the error is not caught by a user defined handle (see also set_error_handler()), the application aborts as it was an E_ERROR. ', 'note' => 'since PHP 5.2.0'), ); } if (version_compare(PHP_VERSION, '5.3.0', '>=')) { $e_all = 30719; $levels += array( 'E_DEPRECATED ' => array('value' => 8192, 'desc' => 'Run-time notices. Enable this to receive warnings about code that will not work in future versions. ', 'note' => 'since PHP 5.3.0'), 'E_USER_DEPRECATED ' => array('value' => 16384, 'desc' => 'User-generated warning message. This is like an E_DEPRECATED, except it is generated in PHP code by using the PHP function trigger_error(). ', 'note' => 'since PHP 5.3.0'), ); } $levels += array( 'E_ALL ' => array('value' => $e_all, 'desc' => 'All errors and warnings, as supported, except of level E_STRICT. ', 'note' => '30719 in PHP 5.3.x, 6143 in PHP 5.2.x, 2047 previously.'), ); if (!$current) { $current = error_reporting(); } $output = "

Current Error Reporting Value: $current

"; $nots = "

Not Using

"; foreach ($levels as $level => $data) { // TRUE/FALSE would catch E_ALL; this does not, unless correct. if (($current & $data['value']) == $data['value']) { $output .= '

' . $level . ' ' . $data['desc'] . ' ' . $data['note'] . '' . '

'; } else { $nots .= '

' . $level . ' ' . $data['desc'] . ' ' . $data['note'] . '' . '

'; } } return $output . $nots; }