From: Mischa POSLAWSKY Date: Fri, 26 Oct 2018 18:48:48 +0000 (+0200) Subject: edit/foto/cover: replace fatal exceptions by abort() X-Git-Tag: v5.1~15 X-Git-Url: http://git.shiar.nl/minimedit.git/commitdiff_plain/c4a26421caba8b697d9aa197bb2a5c55b7e2c5ff edit/foto/cover: replace fatal exceptions by abort() Code cleanup, identical behaviour. --- diff --git a/edit/foto/cover/index.php b/edit/foto/cover/index.php index 06acc1d..6e59e85 100644 --- a/edit/foto/cover/index.php +++ b/edit/foto/cover/index.php @@ -1,8 +1,6 @@ admin('foto')) { - http_response_code(403); - print "Beheerrechten verplicht voor instellen van covers\n"; - exit; + abort("Beheerrechten verplicht voor instellen van covers", '403 unauthorised'); } $rootdir = 'foto' . $Page->path; @@ -10,9 +8,7 @@ $target = "$rootdir/index.jpg"; if (is_link($target) or file_exists($target)) { if (!unlink($target)) { - http_response_code(500); - print "Kon bestaande cover niet weghalen voor {$Page->path}\n"; - exit; + abort("Kon bestaande cover niet weghalen voor {$Page->path}", '500 delete error'); } } @@ -20,13 +16,9 @@ if (isset($_GET['img'])) { $img = str_repeat('../', substr_count($target, '/')); # up to docroot $img .= ltrim($_GET['img'], '/'); if (!symlink($img, $target)) { - http_response_code(500); - print "Fout bij instellen van cover voor {$Page->path}\n"; - exit; + abort("Fout bij instellen van cover voor {$Page->path}", '500 link error'); } } $album = pathinfo($rootdir); -header("Location: /{$album['dirname']}#{$album['basename']}"); -http_response_code(302); -exit; +abort("/{$album['dirname']}#{$album['basename']}", '302 linked');