summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCflip <36554078+cflip@users.noreply.github.com>2021-01-28 17:14:00 -0700
committerCflip <36554078+cflip@users.noreply.github.com>2021-01-28 17:14:00 -0700
commit4c9d433ba1c52ad67e4cccabf04e709bb8b85070 (patch)
treef63dc40912ab4b30511f885e7d757d0bc2a98f88
parent64ee5ff9c43b46e6d76f97af4fa2789cd9ea43b3 (diff)
bug fixes
-rw-r--r--thread.php8
1 files changed, 5 insertions, 3 deletions
diff --git a/thread.php b/thread.php
index d6d01f8..01ffeaa 100644
--- a/thread.php
+++ b/thread.php
@@ -19,7 +19,9 @@ function add_quote($dbc, $thread_id, $matches) {
return '<blockquote>Invalid quote!</blockquote>';
}
- return '<blockquote><a href="#' . $id + 1 .'">Quote from ' . $reply['user_name'] . '</a><br>' . $reply['post_content'] . '</blockquote>';
+ $id = $id + 1;
+
+ return '<blockquote><a href="#' . $id .'">Quote from ' . $reply['user_name'] . '</a><br>' . $reply['post_content'] . '</blockquote>';
}
}
@@ -72,9 +74,9 @@ if (mysqli_num_rows($result) == 0) {
"/\s*[a-zA-Z\/\/:\.]*youtu(be.com\/watch\?v=|.be\/)([a-zA-Z0-9\-_]+)([a-zA-Z0-9\/\*\-\_\?\&\;\%\=\.]*)/i",
'<br><iframe class="youtube-embed" src="//www.youtube.com/embed/$2" allowfullscreen></iframe>', $post_content);
- $post_content = preg_replace('/(https?:\/\/[^ ]+?(?:\.jpg|\.png|\.gif))/', '<img class="image-embed" src="$1" alt="$1" />', $post_content);
+ $post_content = preg_replace('@\b(http(s)?://)([^\s]*?(?:\.[a-z\d?=/_-]+)+(?:\.jpg|\.png|\.gif))(?![^<]*?(?:</\w+>|/?>))@i', '<img class="image-embed" src="http$2://$3" alt="http$2://$3" />', $post_content);
//$post_content = preg_replace('/^>/', '<span class="greentext">garb</span>', $post_content);
- $post_content = preg_replace('@\b(http(s)?://)?([^\s]*?(?:\.[a-z\d?=/_-]+)+)(?![^<]*?(?:</\w+>|/?>))@i', '<a href="http$2://$3">$0</a>', $post_content);
+ $post_content = preg_replace('@\b(http(s)?://)([^\s]*?(?:\.[a-z\d?=/_-]+)+)(?![^<]*?(?:</\w+>|/?>))@i', '<a href="http$2://$3">$0</a>', $post_content);
echo '<td class="post-content">' . $post_content . '</td></tr>';