summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcflip <36554078+cflip@users.noreply.github.com>2021-04-08 14:22:06 -0600
committercflip <36554078+cflip@users.noreply.github.com>2021-04-08 14:22:06 -0600
commit442022125d9e843b10a3e36167e422d0becb5788 (patch)
tree74da505494a28363b6e4670b9119caae149cb4c1
parent117f875d6287b03131e75a839e563b05b15ecd48 (diff)
Fix quote links
-rw-r--r--model/Post.php8
1 files changed, 3 insertions, 5 deletions
diff --git a/model/Post.php b/model/Post.php
index 308b5ac..5d85f20 100644
--- a/model/Post.php
+++ b/model/Post.php
@@ -5,7 +5,7 @@ include_once 'Thread.php';
function add_quote($dbc, $thread_id, $matches) {
foreach ($matches as $match) {
$id = (int) filter_var($match, FILTER_SANITIZE_NUMBER_INT);
- $sql = "SELECT post_content, post_author, user_name FROM posts LEFT JOIN users ON post_author = user_id WHERE post_id = " . $id;
+ $sql = "SELECT post_content, post_author, post_thread, user_name FROM posts LEFT JOIN users ON post_author = user_id WHERE post_id = " . $id;
$result = mysqli_query($dbc, $sql);
if (!$result) {
@@ -18,9 +18,7 @@ function add_quote($dbc, $thread_id, $matches) {
return '<blockquote><span style="color:red;">This post has been deleted</span></blockquote>';
}
- $id = $id + 1;
-
- return '<blockquote><a href="#' . $id .'">Quote from ' . $reply['user_name'] . '</a><br>' . $reply['post_content'] . '</blockquote>';
+ return '<blockquote><a href="/viewthread.php?id=' . $reply['post_thread'] . '#p' . $id .'">Quote from ' . $reply['user_name'] . '</a><br>' . $reply['post_content'] . '</blockquote>';
}
}
@@ -59,7 +57,7 @@ class Post {
}
function display_content($dbc) {
- echo '<div class="header"><b>#' . $this->id . '</b>';
+ echo '<div class="header" id="p' . $this->id . '"><b>#' . $this->id . '</b>';
echo ' Posted by <a href="viewuser.php?id='. $this->author->id . '">' . $this->author->name . '</a>';
echo ' on ' . date('m/d/Y g:ia', strtotime($this->date));
if (isset($_SESSION['signed_in']) && $_SESSION['user_id'] == $this->author->id) {