summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/MailmanLib.php11
-rw-r--r--src/PhpBB3Conf.php5
-rw-r--r--src/PhpBB3Lib.php30
3 files changed, 46 insertions, 0 deletions
diff --git a/src/MailmanLib.php b/src/MailmanLib.php
new file mode 100644
index 0000000..ca3dadf
--- /dev/null
+++ b/src/MailmanLib.php
@@ -0,0 +1,11 @@
+<?php
+
+function read_raw_message($url) {
+ $input = file_get_contents($url);
+ if (!$input) {
+ trigger_error("No input in $url", E_USER_ERROR);
+ }
+ return $input;
+}
+
+?>
diff --git a/src/PhpBB3Conf.php b/src/PhpBB3Conf.php
new file mode 100644
index 0000000..7f023d9
--- /dev/null
+++ b/src/PhpBB3Conf.php
@@ -0,0 +1,5 @@
+<?php
+
+$phpbb_root_path = '/var/www/forum/';
+
+?>
diff --git a/src/PhpBB3Lib.php b/src/PhpBB3Lib.php
new file mode 100644
index 0000000..f9f91d7
--- /dev/null
+++ b/src/PhpBB3Lib.php
@@ -0,0 +1,30 @@
+<?php
+
+# phpBB setup
+define('IN_PHPBB', true);
+require_once(__DIR__ . '/PhpBB3Conf.php');
+$phpEx = substr(strrchr(__FILE__, '.'), 1);
+require_once($phpbb_root_path . 'common.' . $phpEx);
+#require_once($phpbb_root_path . 'includes/functions_user.' . $phpEx);
+
+
+function get_user_id($from) {
+ global $db;
+
+ $sql = 'SELECT user_id FROM ' . USERS_TABLE .
+ ' WHERE user_email = "' . $db->sql_escape($from) . '"';
+
+ $result = $db->sql_query($sql);
+// FIXME: what to do if more than one row is returned?
+ $row = $db->sql_fetchrow($result);
+ $db->sql_freeresult($result);
+
+ if (!$row) {
+ trigger_error("Unknown user email: $from", E_USER_ERROR);
+ }
+
+ return $row['user_id'];
+}
+
+
+?>