summaryrefslogtreecommitdiff
path: root/lib/file
diff options
context:
space:
mode:
Diffstat (limited to 'lib/file')
-rw-r--r--lib/file/editinfo.php6
-rw-r--r--lib/file/folder.php3
-rw-r--r--lib/file/index.php6
-rw-r--r--lib/file/upload.php3
4 files changed, 12 insertions, 6 deletions
diff --git a/lib/file/editinfo.php b/lib/file/editinfo.php
index eea9f35..500a7fc 100644
--- a/lib/file/editinfo.php
+++ b/lib/file/editinfo.php
@@ -30,7 +30,11 @@ if (isset($_POST['name']) && isset($_POST['comment']) && isset($_POST['folder'])
} else {
sql("UPDATE files SET name = '" . escs($name) . "', comment='" . escs($comment). "',
comment_html = '" . escs($comment_html) . "', folder = $folder WHERE id = $id");
- header("Location: file");
+ if ($folder == 0) {
+ header("Location: file");
+ } else {
+ header("Location: folder-file-$folder");
+ }
die();
}
}
diff --git a/lib/file/folder.php b/lib/file/folder.php
index 15e8625..f3beedd 100644
--- a/lib/file/folder.php
+++ b/lib/file/folder.php
@@ -33,7 +33,8 @@ $title = $fld["name"];
$files = array();
$fileq = sql("SELECT files.id AS id, files.name AS name, files.extension AS extension, files.upl_date AS upl_date, ".
- "files.comment_html AS comment_html FROM files WHERE files.folder = $fldid");
+ "files.comment_html AS comment_html FROM files WHERE files.folder = $fldid ".
+ "ORDER BY " . get_filter('order') . " " . get_filter('way'));
while ($img = mysql_fetch_assoc($fileq)) $files[] = $img;
$s = sql("SELECT id, name FROM folders WHERE owner = " . $fld['owner'] . ($fld['owner'] == $user['id'] ? '' : " AND public != 0"). " ORDER BY name ASC");
diff --git a/lib/file/index.php b/lib/file/index.php
index 34686c5..1a60a79 100644
--- a/lib/file/index.php
+++ b/lib/file/index.php
@@ -6,7 +6,7 @@ $filters = array (
"order" => array (
"name" => "title",
"upl_date" => "date uploaded",
- "folder_name" => "folder",
+ //"folder_name" => "folder",
),
"way" => $ord_ways,
);
@@ -15,13 +15,13 @@ $fdefaults = array (
"way" => "DESC",
);
-$title = "Image upload";
+$title = "File upload";
$files = array();
$fileq = sql("SELECT files.id AS id, files.name AS name, files.extension AS extension, files.upl_date AS upl_date, ".
"files.comment_html AS comment_html, folders.id AS folder_id, folders.name AS folder_name ".
" FROM files LEFT JOIN folders ON folders.id = files.folder ".
- "WHERE files.owner = " . $user['id'] .
+ "WHERE files.folder = 0 AND files.owner = " . $user['id'] .
" ORDER BY " . get_filter('order') . " " . get_filter('way'));
while ($img = mysql_fetch_assoc($fileq)) $files[] = $img;
diff --git a/lib/file/upload.php b/lib/file/upload.php
index 4b5299d..21fa065 100644
--- a/lib/file/upload.php
+++ b/lib/file/upload.php
@@ -7,6 +7,7 @@ require("lib/conf/file.php");
if (isset($_FILES['file']) && isset($_POST['name'])) {
$name = esca($_POST['name']);
+ $folder = (isset($_POST['folder']) ? intval($_POST['folder']) : 0);
if ($name == "") $name = $_FILES['file']['name'];
if ($_FILES['file']['error'] != 0) {
$error = "Sorry, an error occurred while uploading your file. Try with a smaller one.";
@@ -15,7 +16,7 @@ if (isset($_FILES['file']) && isset($_POST['name'])) {
$origname = strtolower(basename($_FILES['file']['name']));
$type = preg_replace("#^.+\.([a-z0-9]+)$#", "$1", $origname);
- sql("INSERT INTO files(owner, extension, name, upl_date) VALUES(" . $user['id'] . ", '$type', '" . escs($name) . "', NOW())");
+ sql("INSERT INTO files(owner, folder, extension, name, upl_date) VALUES(" . $user['id'] . ", $folder, '$type', '" . escs($name) . "', NOW())");
$id = mysql_insert_id();
$filen = $savedir . $id . "." . $type;
if (!copy($_FILES['file']['tmp_name'], $filen)) {