Add ThemeNotFoundException

This commit is contained in:
Li Chen 2013-11-28 22:25:54 +01:00
parent a6ad7597c8
commit 7bd2e3eecf
2 changed files with 48 additions and 28 deletions

View File

@ -136,6 +136,13 @@ else if ($n && $p[0] == SALT_USER)
{
$tmp = explode("-", $p[2]);
$id = intval($tmp[0]);
if ($id == 0)
$page = "404";
else
{
try
{
$THEME = new Theme($id);
unset($tmp, $id);
$template->assign("cur_theme", $THEME);
@ -152,8 +159,6 @@ else if ($n && $p[0] == SALT_USER)
$id_exo = $exo->id;
}
try
{
$EXERCICE = new Exercice($id_exo, $THEME);
$template->assign("cur_exercice", $EXERCICE);
$page = require("team/exercice.php");
@ -166,6 +171,11 @@ else if ($n && $p[0] == SALT_USER)
{
$page = "404";
}
catch(ThemeNotFoundException $e)
{
$page = "404";
}
}
}
}
}

View File

@ -20,6 +20,11 @@ class Theme
$this->id = $res['id'];
$this->name = $res['name'];
}
else
{
$db->deconnexion();
throw new ThemeNotFoundException();
}
$db->deconnexion();
}
}
@ -137,3 +142,8 @@ class Theme
return $array;
}
}
class ThemeNotFoundException extends Exception
{
}