main
Pk11 2 years ago
parent 89d571d245
commit 604478271b

@ -205,14 +205,19 @@
// 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);
pg_free_result($result);
if($row_count > 0)
return "<a href=\"#p{$match[1]}\">{$match[0]}</a>";
else
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);
return "<del>{$match[0]}</del>";
}
}
// Prints the post list

Loading…
Cancel
Save