From fa7ff7be8b5bafdfc3f6b63bdf58cf75c82202cb Mon Sep 17 00:00:00 2001 From: uckelman Date: Tue, 27 Jul 2010 20:52:33 +0000 Subject: * Don't throw on replies to old posts. * Only utf8_quote non-ascii names and subjects. git-svn-id: https://vassalengine.svn.sourceforge.net/svnroot/vassalengine/site-src/trunk@7042 67b53d14-2c14-4ace-a08f-0dab2b34000c --- src/forum_post_send.php | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/forum_post_send.php b/src/forum_post_send.php index 969f6de..96cd009 100644 --- a/src/forum_post_send.php +++ b/src/forum_post_send.php @@ -16,7 +16,7 @@ catch (Exception $e) { function send_post_to_lists($config, $user, $mode, $data, $post_data) { require_once('Log.php'); - $logger = &Log::singleton('file', '/var/log/listbridge', 'test2'); + $logger = &Log::singleton('file', '/var/log/listbridge', 'one'); /* print '

'; @@ -54,10 +54,17 @@ function send_post_to_lists($config, $user, $mode, $data, $post_data) { $userName = $user->data['username']; $userEmail = $user->data['user_email']; - $from = utf8_quote($userName) . ' <' . $userEmail . '>'; - $sender = 'forum-bridge@test2.nomic.net'; - $subject = utf8_quote('[' . $post_data['forum_name'] . '] ' - . $post_data['post_subject']); + # NB: Don't use utf8_quote on things which don't need it. + $from = (is_ascii($userName) ? $userName : utf8_quote($userName)) . + ' <' . $userEmail . '>'; + + $sender = 'forum-bridge@vassalengine.org'; + + $subject = '[' . $post_data['forum_name'] . '] ' + . $post_data['post_subject']; + if (!is_ascii($subject)) { + $subject = utf8_quote($subject); + } $phpbb = new PhpBB3(); @@ -82,10 +89,12 @@ function send_post_to_lists($config, $user, $mode, $data, $post_data) { $firstId = $data['topic_first_post_id']; $firstMessageId = $bridge->getMessageId($firstId); if ($firstMessageId === false) { - throw new Exception('unrecognized post id: ' . $firstId); + $logger->info($postId . ' replies to an unknown message'); + } + else { + $inReplyTo = $references = $firstMessageId; + $logger->info($postId . ' replies to ' . $firstMessageId); } - - $inReplyTo = $references = $firstMessageId; } else if ($mode == 'edit') { $inReplyTo = $bridge->getMessageId($postId); -- cgit v1.2.3