From 8f2edb704872c9d7cf8e472c87d3db628f2a11dd Mon Sep 17 00:00:00 2001 From: Li Chen Date: Sun, 1 Dec 2013 20:29:59 +0100 Subject: [PATCH] Add catch NotFoundException in admin/exercice.php --- onyx/include/admin/exercice.php | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/onyx/include/admin/exercice.php b/onyx/include/admin/exercice.php index fa6858cd..415e1901 100644 --- a/onyx/include/admin/exercice.php +++ b/onyx/include/admin/exercice.php @@ -4,17 +4,33 @@ if(!defined('ONYX')) exit; $p = $out[0]; -if (isset($p[2])) +//TODO maybe move the try catch to index.html ? +try { + if (isset($p[2])) + { $tmp = explode("-", $p[2]); $id = intval($tmp[0]); if ($id == 0) return "404"; $theme = new Theme($id); $template->assign("theme", $theme); + } + + if (isset($p[3])) + $template->assign("ex", new Exercice($p[3], $theme)); +} +catch (ThemeNotFoundException $e) +{ + return "404"; +} +catch(ExerciceNotFoundException $e) +{ + return "404"; +} +catch(ExerciceNotFoundException $e) +{ + return "404"; } -if (isset($p[3])) - $template->assign("ex", new Exercice($p[3], $theme)); - return SALT_ADMIN."/exercice";