Skip to content

Commit

Permalink
Begin work on fixing mentions.
Browse files Browse the repository at this point in the history
  • Loading branch information
MineRobber9000 committed Oct 8, 2019
1 parent 47b7be4 commit 8136c25
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion client/thread.php
Original file line number Diff line number Diff line change
@@ -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']);
Expand All @@ -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;
}
Expand Down

0 comments on commit 8136c25

Please sign in to comment.