summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoruckelman <uckelman@nomic.net>2010-05-11 20:02:40 +0000
committeruckelman <uckelman@nomic.net>2010-05-11 20:02:40 +0000
commit80ae6c14fb7967fc01f6dfe2e598050dacd1d2ba (patch)
tree878ddabbf5fdac0cb2a095746fe200e3db44ae4c /src
parent6ecbb3c2e9148de47f7f7c045b8c4d1aafeb49b7 (diff)
Adjusted to use attachment writer shim.
git-svn-id: https://vassalengine.svn.sourceforge.net/svnroot/vassalengine/site-src/trunk@6851 67b53d14-2c14-4ace-a08f-0dab2b34000c
Diffstat (limited to 'src')
-rw-r--r--src/PhpBB3.php27
1 files changed, 10 insertions, 17 deletions
diff --git a/src/PhpBB3.php b/src/PhpBB3.php
index 8b0f875..1cab492 100644
--- a/src/PhpBB3.php
+++ b/src/PhpBB3.php
@@ -284,25 +284,18 @@ class PhpBB3 {
throw new Exception("Adding attachment failed: $sql");
}
- # write the attachment to disk
- $realPath = $phpbb_root_path . $config['upload_path'] . '/' . $realFilename;
- $count = file_put_contents($realPath, $data);
- if ($count === false) {
- throw new Exception('Failed to write attachment file: ' . $realPath);
- }
+ # post the attachment data to our attachment writer shim
+ require_once(__DIR__ . '/HTTP_POST_multipart.php');
-# FIXME: how to get right uid, gid for file? This surely won't work.
-/*
- $result = chown($realPath, 'apache');
- if ($result === false) {
- throw new Exception('Failed to chown attachment file: ' . $realPath);
- }
+ $url = 'http://www.test.nomic.net/forum/attachment_writer.php';
+ $poster = new HTTP_POST_multipart();
+ $poster->addData('password', '5rnudbp7dLkijcwrT@sz');
+ $poster->addFile(1, $physicalFilename, $mimetype, null, 'binary', $data);
+ $result = $poster->post($url);
- chgrp($realPath, 'apache');
- if ($result === false) {
- throw new Exception('Failed to chgrp attachment file: ' . $realPath);
- }
-*/
+ if ($result != 1) {
+ throw new Exception('Attachment writer failed: ' . $result);
+ }
# return the attachment info needed by submit_post
return array(