Begin work on fixing mentions.

This commit is contained in:
Robert Miles 2018-11-04 10:38:39 -05:00 committed by khuxkm fbexl
parent 47b7be48fc
commit 8136c2508f
1 changed files with 11 additions and 1 deletions

View File

@ -1,4 +1,13 @@
<?php
function lookup($match) {
$data = $thread["data"];
$usermap = $thread["usermap"];
$postnum = $match[1];
if ($postnum==0) {
return ">>OP";
}
return ">>".$postnum.$usermap[$data["messages"][$postnum]["author"]]["user_name"];
}
foreach($thread["data"]["messages"] as $message) {
$username = $thread["usermap"][$message["author"]]["user_name"];
$time = round($message['created']);
@ -7,7 +16,8 @@
echo "\t\t<div class='well' id='post{$message["post_id"]}'>".PHP_EOL;
echo "\t\t\t<p>&gt;{$message['post_id']} {$username} @ {$time}</p>".PHP_EOL;
echo "\t\t\t<pre>";
echo str_replace(">>0",">>OP",$message["body"]).PHP_EOL;
// echo str_replace(">>0",">>OP",$message["body"]).PHP_EOL;
echo preg_replace_callback("/>>(\d+)/",'lookup',$message["body"]).PHP_EOL;
echo "</pre>".PHP_EOL;
echo "\t\t</div>".PHP_EOL;
}