diff options
author | cflip <36554078+cflip@users.noreply.github.com> | 2021-05-15 09:15:58 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-15 09:15:58 -0600 |
commit | 45acfc48b3dd80b945a1501edea9ad4faa700c0f (patch) | |
tree | 87319e8b64789564e5d9ae227361593c419d905b /includes | |
parent | 87b1dfd1f77b08915ee5e905da45e316ba2c0e7d (diff) | |
parent | 2b03ca63d06ec5da45c887ef7cb3daa35a8642f7 (diff) |
Merge pull request #16 from cflip/h5p9sl
Add error handling
Diffstat (limited to 'includes')
-rw-r--r-- | includes/Session.php | 2 | ||||
-rw-r--r-- | includes/error.php | 25 | ||||
-rw-r--r-- | includes/templates/header.php | 4 |
3 files changed, 30 insertions, 1 deletions
diff --git a/includes/Session.php b/includes/Session.php index 7951d70..ceaa765 100644 --- a/includes/Session.php +++ b/includes/Session.php @@ -54,4 +54,4 @@ class Session return $result; } -}
\ No newline at end of file +} diff --git a/includes/error.php b/includes/error.php new file mode 100644 index 0000000..5e33212 --- /dev/null +++ b/includes/error.php @@ -0,0 +1,25 @@ +<?php +function user_notice($message) { + echo '<p class="error">'. $message .'</p>'; +} + +function handle_error($errno, $errstr, $errfile, $errline) { + if (!(error_reporting() & $errno)) { + // This error code is not included in error_reporting, so let it fall + // through to the standard PHP error handler + return false; + } + + switch ($errno) { + // See https://www.php.net/manual/en/errorfunc.constants.php + case E_USER_NOTICE: + user_notice($errstr); + break; + default: + return false; + } + return true; +} + +$old_error_handler = set_error_handler('handle_error'); +?> diff --git a/includes/templates/header.php b/includes/templates/header.php index 1db9cda..5070cfe 100644 --- a/includes/templates/header.php +++ b/includes/templates/header.php @@ -1,4 +1,6 @@ +<header> <h1>cflip.net forum<sup style="font-size: small;">beta</sup></h1> +<p> [<a href="/">Home</a>] [<a href="/search.php?type=thread&sort=lr">All Threads</a>] [<a href="/search.php?type=post&sort=cd">All Posts</a>] @@ -16,3 +18,5 @@ } ?> </span> +</p> +</header> |