summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoruckelman <uckelman@nomic.net>2010-07-27 20:52:33 +0000
committeruckelman <uckelman@nomic.net>2010-07-27 20:52:33 +0000
commitfa7ff7be8b5bafdfc3f6b63bdf58cf75c82202cb (patch)
tree3178830891d17b5537fbe488c413d0f65f397a60 /src
parentb3481ffa2097b304291c13cabd00b229695f643c (diff)
* 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
Diffstat (limited to 'src')
-rw-r--r--src/forum_post_send.php25
1 files changed, 17 insertions, 8 deletions
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 '<p>';
@@ -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);