From 80ae6c14fb7967fc01f6dfe2e598050dacd1d2ba Mon Sep 17 00:00:00 2001 From: uckelman Date: Tue, 11 May 2010 20:02:40 +0000 Subject: 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 --- src/PhpBB3.php | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-) (limited to 'src') 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( -- cgit v1.2.3