0,0 → 1,92 |
<?php |
$isEntryPoint = true; |
include("lib/common.php"); |
|
try { |
// save session |
if($_POST["save"] !== null) { |
$id = $p->integer($_POST["id"], true, "ID"); |
|
// dummy session to store user input |
$s = $sm->newSession(); |
$s->setExpire ($_POST["expire"]); |
$s->setSizeLimit ($_POST["size_limit"]); |
$s->setCountLimit ($_POST["count_limit"]); |
$s->setDownloadable ($_POST["downloadable"]); |
$s->setUploadable ($_POST["uploadable"]); |
$s->setDeletable ($_POST["deletable"]); |
$s->setPublicComment ($_POST["public_comment"]); |
$s->setPrivateComment($_POST["private_comment"]); |
$s->setBlocked ($_POST["blocked"]); |
|
// load |
if($id) { |
$s2 = $sm->getSession($id); |
} |
else { |
$s2 = $sm->newSession(); |
} |
|
// parse the input |
try { |
$s2->setExpire ($p->date ($_POST["expire"], true, "Expire")); |
$s2->setSizeLimit ($p->size ($_POST["size_limit"], true, "Size Limit")); |
$s2->setCountLimit ($p->integer($_POST["count_limit"], true, "Files Limit")); |
$s2->setDownloadable ($p->boolean($_POST["downloadable"])); |
$s2->setUploadable ($p->boolean($_POST["uploadable"])); |
$s2->setDeletable ($p->boolean($_POST["deletable"])); |
$s2->setPublicComment ($p->string ($_POST["public_comment"])); |
$s2->setPrivateComment($p->string ($_POST["private_comment"])); |
$s2->setBlocked ($p->boolean($_POST["blocked"])); |
} |
catch(Exception $ex) { |
dataCollected(); |
include("pages/manage_display.php"); |
exit; |
} |
|
// save |
if($id) { |
$sm->update($s2); // existing |
} |
else { |
$sm->insert($s2); // new |
} |
|
// end |
dataCollected(); |
http_redirect("admin.php"); |
} |
|
// delete one file from a session |
else if($_GET["delete"]) { |
$id = $p->integer($_GET["id"], false, "ID"); |
$name = $p->string($_GET["delete"], false, "Name"); |
$s = $sm->getSession($id); |
$s->removeFile($name); |
|
dataCollected(); |
http_redirect("manage.php?id=$id"); |
} |
|
// display existing session |
else if($id = $_GET["id"]) { |
$id = $p->integer($id, true, "ID"); |
$s = $sm->getSession($id); |
|
dataCollected(); |
include("pages/manage_display.php"); |
} |
|
// display new session |
else { |
$s = $sm->newSession(); |
|
dataCollected(); |
include("pages/manage_display.php"); |
} |
} |
catch(Exception $ex) { |
generalError(); |
} |
?> |