Add catch NotFoundException in admin/exercice.php

This commit is contained in:
Li Chen 2013-12-01 20:29:59 +01:00
parent ad5052bb99
commit 8f2edb7048

View File

@ -4,17 +4,33 @@ if(!defined('ONYX')) exit;
$p = $out[0]; $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]); $tmp = explode("-", $p[2]);
$id = intval($tmp[0]); $id = intval($tmp[0]);
if ($id == 0) if ($id == 0)
return "404"; return "404";
$theme = new Theme($id); $theme = new Theme($id);
$template->assign("theme", $theme); $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"; return SALT_ADMIN."/exercice";