|
|
|
@ -205,15 +205,20 @@
|
|
|
|
|
|
|
|
|
|
// Regex callback, makes >>quotes into links
|
|
|
|
|
function quote_link($match) {
|
|
|
|
|
$query = "SELECT post_id FROM posts WHERE post_id=$1";
|
|
|
|
|
$query = "SELECT user_id FROM posts WHERE post_id=$1";
|
|
|
|
|
$result = pg_query_params($query, [$match[1]]) or die('Query failed: ' . pg_last_error());
|
|
|
|
|
$row_count = pg_num_rows($result);
|
|
|
|
|
if($row_count > 0) {
|
|
|
|
|
$row = pg_fetch_array($result);
|
|
|
|
|
$you = (!empty($row['user_id']) && $row['user_id'] == $_COOKIE['uid']) ? ' (You)' : '';
|
|
|
|
|
pg_free_result($result);
|
|
|
|
|
return "<a href=\"#p{$match[1]}\">{$match[0]}$you</a>";
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
pg_free_result($result);
|
|
|
|
|
if($row_count > 0)
|
|
|
|
|
return "<a href=\"#p{$match[1]}\">{$match[0]}</a>";
|
|
|
|
|
else
|
|
|
|
|
return "<del>{$match[0]}</del>";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Prints the post list
|
|
|
|
|
function show_posts() {
|
|
|
|
|