summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/F2M.php19
-rw-r--r--src/PhpBB3.php12
-rw-r--r--test/PhpBB3Test.php16
3 files changed, 46 insertions, 1 deletions
diff --git a/src/F2M.php b/src/F2M.php
index 980aca8..5933f36 100644
--- a/src/F2M.php
+++ b/src/F2M.php
@@ -9,6 +9,10 @@ catch (Exception $e) {
function send_to_lists($user, $data, $post_data) {
+ require_once(__DIR__ . '/PhpBB3.php');
+
+ $phpbb = new PhpBB3();
+
/*
require_once('Mail.php');
@@ -21,14 +25,15 @@ function send_to_lists($user, $data, $post_data) {
$userName = $user->data['username'];
$userEmail = $user->data['user_email'];
- $date = $data['post_time'];
$subject = $post_data['post_subject'];
+ $date = $phpbb->getPostTime($postId);
$body = $data['message'];
print '<p>';
var_dump($data);
var_dump($post_data);
+ var_dump($date);
print '</p>';
/*
@@ -57,4 +62,16 @@ function send_to_lists($user, $data, $post_data) {
}
+function get_post_time($postId) {
+ throw_if_null($postId);
+
+ global $db;
+
+ $sql = 'SELECT post_time FROM ' . POSTS_TABLE . ' ' .
+ 'WHERE post_id = ' . $postId;
+
+ $row = $this->get_exactly_one_row($sql);
+ return $row ? $row['user_id'] : false;
+}
+
?>
diff --git a/src/PhpBB3.php b/src/PhpBB3.php
index aca8333..48361a6 100644
--- a/src/PhpBB3.php
+++ b/src/PhpBB3.php
@@ -108,6 +108,18 @@ class PhpBB3 {
}
}
+ public function getPostTime($postId) {
+ throw_if_null($postId);
+
+ global $db;
+
+ $sql = 'SELECT post_time FROM ' . POSTS_TABLE . ' ' .
+ 'WHERE post_id = ' . $postId;
+
+ $row = $this->get_exactly_one_row($sql);
+ return $row ? $row['post_time'] : false;
+ }
+
public function postMessage($postType, $forumId, $topicId, $msg) {
throw_if_null($msg);
diff --git a/test/PhpBB3Test.php b/test/PhpBB3Test.php
index ca94526..fbd68e2 100644
--- a/test/PhpBB3Test.php
+++ b/test/PhpBB3Test.php
@@ -116,4 +116,20 @@ EOF;
array(1, true, null)
);
}
+
+ /**
+ * @dataProvider providerGetPostTime
+ */
+ public function testGetPostTime($post_id, $expected, $ex) {
+ $this->markTestIncomplete();
+
+ if ($ex) $this->setExpectedException($ex);
+ $run = 'getPostTime(' . $post_id . ')';
+ $this->assertEquals($expected, $this->exec_kludge($run));
+ }
+
+ public function providerGetPostTime() {
+ return array(
+ );
+ }
}