From f83530a122119d7f69812493f9c2f4987ccb2065 Mon Sep 17 00:00:00 2001 From: Cflip <36554078+cflip@users.noreply.github.com> Date: Wed, 10 Feb 2021 20:40:32 -0700 Subject: Reorganize code and add info to front page --- includes/functions_display.php | 118 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 118 insertions(+) create mode 100644 includes/functions_display.php (limited to 'includes/functions_display.php') diff --git a/includes/functions_display.php b/includes/functions_display.php new file mode 100644 index 0000000..479648f --- /dev/null +++ b/includes/functions_display.php @@ -0,0 +1,118 @@ +
Invalid quote!'; + } + + $id = $id + 1; + + return '
Quote from ' . $reply['user_name'] . ''; + } +} + +function display_posts($dbc, $sql_result) { + echo '
' . $reply['post_content'] . '
' . $post_index . ' | |
---|---|
Posted by ' . $row['user_name'] . ' ' . date('m/d/Y g:ia', strtotime($row['post_date'])) . ' | ';
+
+ $post_content = $row['post_content'];
+
+ $post_content = preg_replace_callback('/>#\d+/', function($matches) use($thread_id, $dbc) {
+ return add_quote($dbc, $thread_id, $matches);
+ }, $post_content);
+
+ // Replace YouTube URLs with embedded YouTube videos.
+ $post_content = preg_replace(
+ "/\s*[a-zA-Z\/\/:\.]*youtu(be.com\/watch\?v=|.be\/)([a-zA-Z0-9\-_]+)([a-zA-Z0-9\/\*\-\_\?\&\;\%\=\.]*)/i",
+ '' . $post_content . ' |