summaryrefslogtreecommitdiff
path: root/classes
diff options
context:
space:
mode:
authorRobin Millette <millette@controlyourself.ca>2009-06-09 15:18:12 -0400
committerRobin Millette <millette@controlyourself.ca>2009-06-09 15:18:12 -0400
commit27af3c67a2a9ea856aa2de041a986d452cce3025 (patch)
tree2d4a6c93e33ec0fb32b572e26323352356aa13d5 /classes
parentfe38827a76520e4a910f9e988b11d0914872d44e (diff)
Improve file upload and attachment interface.
Diffstat (limited to 'classes')
-rw-r--r--classes/Notice.php12
1 files changed, 12 insertions, 0 deletions
diff --git a/classes/Notice.php b/classes/Notice.php
index 1b5c0ab0a..0b1017e12 100644
--- a/classes/Notice.php
+++ b/classes/Notice.php
@@ -277,6 +277,18 @@ class Notice extends Memcached_DataObject
return true;
}
+ function getUploadedAttachment() {
+ $post = clone $this;
+ $query = 'select file.url as uploaded from file join file_to_post on file.id = file_id where post_id=' . $post->escape($post->id) . ' and url like "%/notice/%/file"';
+ $post->query($query);
+ $post->fetch();
+ $ret = $post->uploaded;
+// var_dump($post);
+ $post->free();
+// die();
+ return $ret;
+ }
+
function hasAttachments() {
$post = clone $this;
$query = "select count(file_id) as n_attachments from file join file_to_post on (file_id = file.id) join notice on (post_id = notice.id) where post_id = " . $post->escape($post->id);