diff options
author | Charly Root <root@muse-sequencer.org> | 2013-10-08 00:00:53 +0200 |
---|---|---|
committer | Charly Root <root@muse-sequencer.org> | 2013-10-08 00:00:53 +0200 |
commit | a1632d25fc46d130357c23c2304b5b73be8894f1 (patch) | |
tree | 8ad8fd45b88d89b74d03e2c0e24c2a9abce678cd /src/PhpBB3Impl.php | |
parent | f1dc6c534e9eb5071ca3ab3604a863ef878ca5ef (diff) |
allow posting by unknown email addresses
Diffstat (limited to 'src/PhpBB3Impl.php')
-rw-r--r-- | src/PhpBB3Impl.php | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/src/PhpBB3Impl.php b/src/PhpBB3Impl.php index de61c5b..cc6d400 100644 --- a/src/PhpBB3Impl.php +++ b/src/PhpBB3Impl.php @@ -193,12 +193,25 @@ class PhpBB3Impl implements PhpBB3 { $userId = $this->getUserId($msg->getFrom()); if ($userId === false) { - throw new Exception('unrecognized email address: ' . $msg->getFrom()); - } + $userId = ANONYMOUS; - $userName = $this->getUserName($userId); - if ($userName === false) { - throw new Exception('unrecognized user id: ' . $userId); + $dispname = $msg->getFromDisplayName(); + if ($dispname === '') { + $userName = $msg->getFrom(); + } + else { + $userName = $dispname . ' (' . $msg->getFrom() . ')'; + } + if (validate_username($userName, '') !== false) { + $userName = 'EMail Poster'; + } + } + else + { + $userName = $this->getUserName($userId); + if ($userName === false) { + throw new Exception('unrecognized user id: ' . $userId); + } } $subject = $msg->getSubject(); |