diff options
| author | Savetheinternet <savetheinternet@tinyboard.org> | 2011-04-30 18:52:04 +1000 |
|---|---|---|
| committer | Savetheinternet <savetheinternet@tinyboard.org> | 2011-04-30 18:52:04 +1000 |
| commit | 7eac1fc242ef95f06c2ba75c16a49191af9e0d38 (patch) | |
| tree | d9af795ca165517329a007d594b2ca0aa82cbc46 /inc/functions.php | |
| parent | 1873c82aa9bcb71a1df7fcb0b44950fd5bf57b5c (diff) | |
added an error handling thing and started on custom fields
Diffstat (limited to 'inc/functions.php')
| -rw-r--r-- | inc/functions.php | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/inc/functions.php b/inc/functions.php index 3830e90a..c23168d9 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -94,6 +94,31 @@ if($config['memcached']['enabled']) memcached_open(); + + // Test custom fields and stuff + if(isset($config['fields'])) { + $error_func = function_exists('error') ? 'error' : 'basic_error_function_because_the_other_isnt_loaded_yet'; + + foreach($config['fields'] as $index => $field) { + if(!is_array($field)) + $error_func(sprintf("Error parsing custom fields. Field at index %d is not an array!", $index)); + if(!isset($field['name'])) + $error_func(sprintf("Error parsing custom fields. Field at index %d doesn't have a name!", $index)); + } + } + } + + function basic_error_function_because_the_other_isnt_loaded_yet($message) { + if(function_exists('sql_close')) sql_close(); + // Yes, this is horrible. + die('<!DOCTYPE html><html><head><title>Error</title>' . + '<style type="text/css">' . + 'body{text-align:center;font-family:arial, helvetica, sans-serif;font-size:10pt;}' . + 'p{padding:0;margin:20px 0;}' . + 'p.c{font-size:11px;}' . + '</style></head>' . + '<body><h2>Error</h2>' . $message . '<hr/>' . + '<p class="c">This alternative error page is being displayed because the other couldn\'t be found or hasn\'t loaded yet.</p></body></html>'); } function fatal_error_handler() { |
