Merge branch 'master' of ssh://git.nemunai.re:6224/fic2014-server

This commit is contained in:
Quentin Grosyeux 2013-10-26 21:45:10 +02:00
commit 070f1b263f
13 changed files with 70 additions and 15 deletions

View file

@ -1,5 +1,7 @@
<?php
//TODO: get the exercice number
if(!defined('ONYX')) exit;
class Exercice
@ -18,13 +20,14 @@ class Exercice
if (!empty($id))
{
$db = new BDD();
// TODO escape id ?
$res = $db->unique_query("SELECT `id`, `id_theme`, `require`, `level`, `points`, `statement`
FROM exercices
WHERE id=" . intval($id));
WHERE id= '$id'");
if (!empty($res))
{
$this->id = intval($res['id']);
$this->id = $res['id'];
$this->theme = new Theme($res['id_theme']);
$this->require = $res['require'];
$this->level = $res['level'];
@ -32,10 +35,10 @@ class Exercice
$this->statement = $res['statement'];
$this->files = $db->query("SELECT `id`, `path`, `name`
FROM exercice_files
WHERE id_exercice = $id");
WHERE id_exercice = '$id'");
$this->keys = $db->query("SELECT `id`, `format`, `value`
FROM exercice_keys
WHERE id_exercice = $id");
WHERE id_exercice = '$id'");
}
$db->deconnexion();
}
@ -67,7 +70,7 @@ class Exercice
{
$db->query("UPDATE exercices
SET `theme` = '".$theme."', `require` = '".$require."', `level` = '".$level."', `point` = '".$point."', `statement` = '".$statement."'
WHERE id = ".$id);
WHERE id = '$id'");
$aff = $db->affected();
}
@ -154,4 +157,4 @@ class Exercice
"sha1" => $sha1
);
}
}
}

View file

@ -2,5 +2,9 @@
if(!defined('ONYX')) exit;
$exercice = new Exercice($EXERCICE);
$template->assign("Exercice", $exercice);
//$template->assign("Number", $ex_number);
return "teams/exercice";

View file

@ -2,5 +2,4 @@
if(!defined('ONYX')) exit;
return "teams/change";
return "teams/me";

View file

@ -10,7 +10,7 @@ try
return "teams/team";
}
catch($e)
catch(Exception $e)
{
return "404";
}