Add ThemeNotFoundException
This commit is contained in:
parent
a6ad7597c8
commit
7bd2e3eecf
@ -136,36 +136,46 @@ else if ($n && $p[0] == SALT_USER)
|
|||||||
{
|
{
|
||||||
$tmp = explode("-", $p[2]);
|
$tmp = explode("-", $p[2]);
|
||||||
$id = intval($tmp[0]);
|
$id = intval($tmp[0]);
|
||||||
$THEME = new Theme($id);
|
|
||||||
unset($tmp, $id);
|
|
||||||
$template->assign("cur_theme", $THEME);
|
|
||||||
|
|
||||||
if ($n == 4 || ($n >= 5 && $p[4] == "submission"))
|
if ($id == 0)
|
||||||
$id_exo = $p[3];
|
$page = "404";
|
||||||
else if ($n == 3)
|
else
|
||||||
{
|
{
|
||||||
foreach($THEME->get_exercices_ordered() as $exo)
|
try
|
||||||
{
|
{
|
||||||
if (! $exo->has_solved($TEAM))
|
$THEME = new Theme($id);
|
||||||
break;
|
unset($tmp, $id);
|
||||||
}
|
$template->assign("cur_theme", $THEME);
|
||||||
$id_exo = $exo->id;
|
|
||||||
}
|
|
||||||
|
|
||||||
try
|
if ($n == 4 || ($n >= 5 && $p[4] == "submission"))
|
||||||
{
|
$id_exo = $p[3];
|
||||||
$EXERCICE = new Exercice($id_exo, $THEME);
|
else if ($n == 3)
|
||||||
$template->assign("cur_exercice", $EXERCICE);
|
{
|
||||||
$page = require("team/exercice.php");
|
foreach($THEME->get_exercices_ordered() as $exo)
|
||||||
}
|
{
|
||||||
catch(ExerciceNotFoundException $e)
|
if (! $exo->has_solved($TEAM))
|
||||||
{
|
break;
|
||||||
$page = "404";
|
}
|
||||||
}
|
$id_exo = $exo->id;
|
||||||
catch(InvalidThemeException $e)
|
}
|
||||||
{
|
|
||||||
$page = "404";
|
$EXERCICE = new Exercice($id_exo, $THEME);
|
||||||
}
|
$template->assign("cur_exercice", $EXERCICE);
|
||||||
|
$page = require("team/exercice.php");
|
||||||
|
}
|
||||||
|
catch(ExerciceNotFoundException $e)
|
||||||
|
{
|
||||||
|
$page = "404";
|
||||||
|
}
|
||||||
|
catch(InvalidThemeException $e)
|
||||||
|
{
|
||||||
|
$page = "404";
|
||||||
|
}
|
||||||
|
catch(ThemeNotFoundException $e)
|
||||||
|
{
|
||||||
|
$page = "404";
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,11 @@ class Theme
|
|||||||
$this->id = $res['id'];
|
$this->id = $res['id'];
|
||||||
$this->name = $res['name'];
|
$this->name = $res['name'];
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$db->deconnexion();
|
||||||
|
throw new ThemeNotFoundException();
|
||||||
|
}
|
||||||
$db->deconnexion();
|
$db->deconnexion();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -137,3 +142,8 @@ class Theme
|
|||||||
return $array;
|
return $array;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class ThemeNotFoundException extends Exception
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user