Fix obscur deletion in admin panel; add Whirlpool hash

This commit is contained in:
nemunaire 2014-01-20 11:11:11 +01:00
parent 5b2b4265a4
commit 0774eb7009
2 changed files with 7 additions and 4 deletions

View File

@ -2,7 +2,7 @@
if(!defined('ONYX')) exit; if(!defined('ONYX')) exit;
$template->assign("fortyp", array("raw" => "RAW", "sha1" => "SHA-1", "md5" => "MD5", "sha224" => "SHA-224", "sha256" => "SHA-256", "sha384" => "SHA-384", "sha512" => "SHA-512")); $template->assign("fortyp", array("raw" => "RAW", "sha1" => "SHA-1", "md5" => "MD5", "sha224" => "SHA-224", "sha256" => "SHA-256", "sha384" => "SHA-384", "sha512" => "SHA-512", "whirlpool" => "Whirlpool"));
$p = $out[0]; $p = $out[0];

View File

@ -301,8 +301,11 @@ class Exercice
function flush_keys() function flush_keys()
{ {
$id = $this->id;
$db = new BDD(); $db = new BDD();
$db->query("DELETE FROM exercice_keys WHERE id_exercice = ".intval($this->id)); $db->escape($id);
$db->query("DELETE FROM exercice_keys WHERE id_exercice = '$id'");
$db->deconnexion(); $db->deconnexion();
$this->keys = array(); $this->keys = array();
@ -312,9 +315,9 @@ class Exercice
{ {
if ($format == "raw") if ($format == "raw")
{ {
$this->add_key("sha1", hash("sha1", $value)); $this->add_key("sha256", hash("sha256", $value));
$this->add_key("sha512", hash("sha512", $value)); $this->add_key("sha512", hash("sha512", $value));
$this->add_key("md5", hash("md5", $value)); $this->add_key("whirlpool", hash("whirlpool", $value));
} }
else else
$this->keys[] = array( $this->keys[] = array(