diff options
author | Nicolas BERNSTEIN <alexis211@gmail.com> | 2012-03-18 14:08:31 +0100 |
---|---|---|
committer | Nicolas BERNSTEIN <alexis211@gmail.com> | 2012-03-18 14:08:31 +0100 |
commit | ccff9ce8d8a2818699ce4e20a310986fc95ea022 (patch) | |
tree | c585ead91c894c621c73b63bc84012709e795151 /lib/image/folder.php | |
parent | 24547ccec6526fcef3cccb34bc35fb81f31236b3 (diff) | |
download | Bits-ccff9ce8d8a2818699ce4e20a310986fc95ea022.tar.gz Bits-ccff9ce8d8a2818699ce4e20a310986fc95ea022.zip |
Added a way of classifying images in folders.
Diffstat (limited to 'lib/image/folder.php')
-rw-r--r-- | lib/image/folder.php | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/lib/image/folder.php b/lib/image/folder.php new file mode 100644 index 0000000..56166d8 --- /dev/null +++ b/lib/image/folder.php @@ -0,0 +1,43 @@ +<?php + +require("lib/conf/image.php"); + +assert_redir(count($args) == 3, 'image'); +$fldid = intval($args[2]); + +$fld = mysql_fetch_assoc(sql( + "SELECT img_folders.id AS id, img_folders.name AS name, img_folders.comment_html AS comment_html, ". + "img_folders.public AS public, account.id AS owner, account.login AS ownername FROM img_folders ". + "LEFT JOIN account ON account.id = img_folders.owner ". + "WHERE img_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['image']['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"]; + +$images = array(); +$files = sql("SELECT images.id AS id, images.name AS name, images.extension AS extension, images.upl_date AS upl_date, ". + "images.comment_html AS comment_html FROM images WHERE images.folder = $fldid"); +while ($img = mysql_fetch_assoc($files)) $images[] = $img; + +$s = sql("SELECT id, name FROM img_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/image/folder.php"); |