diff --git a/mod.php b/mod.php index df3cf528..7e6f1f1f 100644 --- a/mod.php +++ b/mod.php @@ -298,7 +298,26 @@ while($log = $query->fetch()) { $log['text'] = utf8tohtml($log['text']); $log['text'] = preg_replace('/(\d+\.\d+\.\d+\.\d+)/', '$1', $log['text']); - + + if(isset($boards[$log['board']])) { + if(preg_match('/post #(\d+)/', $log['text'], $match)) { + $post_query = prepare(sprintf("SELECT `thread` FROM `posts_%s` WHERE `id` = :id", $boards[$log['board']])); + $post_query->bindValue(':id', $match[1], PDO::PARAM_INT); + $post_query->execute() or error(db_error($query)); + + if($post = $post_query->fetch()) { + $log['text'] = preg_replace('/post #(\d+)/', '$0', $log['text']); + } + } + } + $body .= '