uploads interface fix
This commit is contained in:
parent
ac5a798bd3
commit
a768e06bf2
@ -57,7 +57,7 @@ class AdminHandler extends request_handler {
|
|||||||
list($custom_name, $note) = input('name, note');
|
list($custom_name, $note) = input('name, note');
|
||||||
|
|
||||||
if (!isset($_FILES['files']))
|
if (!isset($_FILES['files']))
|
||||||
redirect('/uploads/?error='.urlencode('no file'));
|
redirect('/admin/uploads/?error='.urlencode('no file'));
|
||||||
|
|
||||||
$files = [];
|
$files = [];
|
||||||
for ($i = 0; $i < count($_FILES['files']['name']); $i++) {
|
for ($i = 0; $i < count($_FILES['files']['name']); $i++) {
|
||||||
@ -77,14 +77,14 @@ class AdminHandler extends request_handler {
|
|||||||
|
|
||||||
foreach ($files as $f) {
|
foreach ($files as $f) {
|
||||||
if ($f['error'])
|
if ($f['error'])
|
||||||
redirect('/uploads/?error='.urlencode('error code '.$f['error']));
|
redirect('/admin/uploads/?error='.urlencode('error code '.$f['error']));
|
||||||
|
|
||||||
if (!$f['size'])
|
if (!$f['size'])
|
||||||
redirect('/uploads/?error='.urlencode('received empty file'));
|
redirect('/admin/uploads/?error='.urlencode('received empty file'));
|
||||||
|
|
||||||
$ext = extension($f['name']);
|
$ext = extension($f['name']);
|
||||||
if (!uploads::isExtensionAllowed($ext))
|
if (!uploads::isExtensionAllowed($ext))
|
||||||
redirect('/uploads/?error='.urlencode('extension not allowed'));
|
redirect('/admin/uploads/?error='.urlencode('extension not allowed'));
|
||||||
|
|
||||||
$upload_id = uploads::add(
|
$upload_id = uploads::add(
|
||||||
$f['tmp_name'],
|
$f['tmp_name'],
|
||||||
@ -92,20 +92,20 @@ class AdminHandler extends request_handler {
|
|||||||
$note);
|
$note);
|
||||||
|
|
||||||
if (!$upload_id)
|
if (!$upload_id)
|
||||||
redirect('/uploads/?error='.urlencode('failed to create upload'));
|
redirect('/admin/uploads/?error='.urlencode('failed to create upload'));
|
||||||
}
|
}
|
||||||
|
|
||||||
redirect('/uploads/');
|
redirect('/admin/uploads/');
|
||||||
}
|
}
|
||||||
|
|
||||||
function GET_upload_delete() {
|
function GET_upload_delete() {
|
||||||
list($id) = input('i:id');
|
list($id) = input('i:id');
|
||||||
$upload = uploads::get($id);
|
$upload = uploads::get($id);
|
||||||
if (!$upload)
|
if (!$upload)
|
||||||
redirect('/uploads/?error='.urlencode('upload not found'));
|
redirect('/admin/uploads/?error='.urlencode('upload not found'));
|
||||||
csrf_check('delupl'.$id);
|
csrf_check('delupl'.$id);
|
||||||
uploads::delete($id);
|
uploads::delete($id);
|
||||||
redirect('/uploads/');
|
redirect('/admin/uploads/');
|
||||||
}
|
}
|
||||||
|
|
||||||
function POST_upload_edit_note() {
|
function POST_upload_edit_note() {
|
||||||
@ -113,12 +113,12 @@ class AdminHandler extends request_handler {
|
|||||||
|
|
||||||
$upload = uploads::get($id);
|
$upload = uploads::get($id);
|
||||||
if (!$upload)
|
if (!$upload)
|
||||||
redirect('/uploads/?error='.urlencode('upload not found'));
|
redirect('/admin/uploads/?error='.urlencode('upload not found'));
|
||||||
|
|
||||||
csrf_check('editupl'.$id);
|
csrf_check('editupl'.$id);
|
||||||
|
|
||||||
$upload->setNote($note);
|
$upload->setNote($note);
|
||||||
redirect('/uploads/');
|
redirect('/admin/uploads/');
|
||||||
}
|
}
|
||||||
|
|
||||||
function POST_ajax_md_preview() {
|
function POST_ajax_md_preview() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user