Can edit files in administration

This commit is contained in:
nemunaire 2014-01-14 18:49:38 +01:00
commit 8e7d652688
4 changed files with 44 additions and 12 deletions

View file

@ -30,14 +30,23 @@ try
$exercice->require = $_POST["require"];
$exercice->level = intval($_POST["level"]);
$exercice->keys = array();
$exercice->flush_keys();
foreach ($_POST as $k => $key)
{
if (preg_match("/k([0-9]+)_value/", $k, $out) && !empty($key) && !empty($_POST["k".$out[1]."_type"]))
$exercice->add_key($_POST["k".$out[1]."_type"], $key);
if (preg_match("/f([0-9]+)_name/", $k, $out) && !empty($key) && !empty($_POST["f".$out[1]."_path"]) && isset($exercice->files[$out[1]]))
{
$exercice->files[$out[1]]["path_orig"] = $_POST["f".$out[1]."_path"];
$exercice->files[$out[1]]["name"] = trim($_POST["f".$out[1]."_name"]);
$exercice->files[$out[1]]["sha1"] = $_POST["f".$out[1]."_sha1"];
}
}
//$exercice->update();
$exercice->update();
header("Location: /".implode("/", $p));
exit();
}
$template->assign("ex", $exercice);