From fecb8c706dadb790c3a8c219275b4ba88e00b8ea Mon Sep 17 00:00:00 2001 From: Robin Millette Date: Fri, 15 May 2009 15:04:58 -0400 Subject: Attachments and their list now provide "ajax" view. Also added a few sidebars relating tags and attachments. --- classes/File.php | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'classes/File.php') diff --git a/classes/File.php b/classes/File.php index 2ddc5deb8..e5913115b 100644 --- a/classes/File.php +++ b/classes/File.php @@ -54,6 +54,17 @@ class File extends Memcached_DataObject return 'http://www.facebook.com/login.php' === $url; } + function getAttachments($post_id) { + $query = "select file.* from file join file_to_post on (file_id = file.id) join notice on (post_id = notice.id) where post_id = " . $this->escape($post_id); + $this->query($query); + $att = array(); + while ($this->fetch()) { + $att[] = clone($this); + } + $this->free(); + return $att; + } + function saveNew($redir_data, $given_url) { $x = new File; $x->url = $given_url; -- cgit v1.2.3-54-g00ecf