diff options
author | Alex AUVOLAT <alexis211@gmail.com> | 2012-06-21 16:34:27 +0200 |
---|---|---|
committer | Alex AUVOLAT <alexis211@gmail.com> | 2012-06-21 16:34:27 +0200 |
commit | 889e8eaf7c40817663dd602a21ac771062ccac3b (patch) | |
tree | ca8ac81ee202165333e5ffe16147d09e5cdaf2ab /lib/file/folder.php | |
parent | 5c4caed8560d5fded00525844dfa8386b97e7918 (diff) | |
download | Bits-889e8eaf7c40817663dd602a21ac771062ccac3b.tar.gz Bits-889e8eaf7c40817663dd602a21ac771062ccac3b.zip |
Big change, sir. Can now upload any kind of files.
Diffstat (limited to 'lib/file/folder.php')
-rw-r--r-- | lib/file/folder.php | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/lib/file/folder.php b/lib/file/folder.php new file mode 100644 index 0000000..15e8625 --- /dev/null +++ b/lib/file/folder.php @@ -0,0 +1,43 @@ +<?php + +require("lib/conf/file.php"); + +assert_redir(count($args) == 3, 'file'); +$fldid = intval($args[2]); + +$fld = mysql_fetch_assoc(sql( + "SELECT folders.id AS id, folders.name AS name, folders.comment_html AS comment_html, ". + "folders.public AS public, account.id AS owner, account.login AS ownername FROM folders ". + "LEFT JOIN account ON account.id = folders.owner ". + "WHERE folders.id = $fldid" +)); +assert_error($fld && ($fld['public'] != 0 || $fld['owner'] == $user['id']), + "This folder does not exist, or you are not allowed to see it."); + +$can_edit = ($user['priv'] >= $apps['file']['editfld'] && $user['id'] == $fld['owner']); +$is_owner = ($user['id'] == $fld['owner']); + +$filters = array ( + "order" => array ( + "name" => "title", + "upl_date" => "date uploaded", + ), + "way" => $ord_ways, +); +$fdefaults = array ( + "order" => "name", + "way" => "ASC", +); + +$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"); +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"); +$folers = array(); +while ($f = mysql_fetch_assoc($s)) $folders[] = $f; + +require("tpl/file/folder.php"); |