From 0d163247b2cf93a8cefa638e4f134c85b29e91a6 Mon Sep 17 00:00:00 2001
From: cflip <36554078+cflip@users.noreply.github.com>
Date: Sun, 25 Apr 2021 17:48:17 -0600
Subject: Delete unused functions_display.php script
---
includes/functions_display.php | 110 -----------------------------------------
1 file changed, 110 deletions(-)
delete mode 100644 includes/functions_display.php
diff --git a/includes/functions_display.php b/includes/functions_display.php
deleted file mode 100644
index 47ba188..0000000
--- a/includes/functions_display.php
+++ /dev/null
@@ -1,110 +0,0 @@
-
';
- echo '';
- echo $row['cat_description'];
- if ($thread) {
- echo ' | ' . $thread['thread_subject'] . ' ';
- echo 'by ' . $thread['user_name'] . ' | ';
- } else {
- $no_threads_msg = 'There are no threads in this category yet.';
- echo ''. $no_threads_msg .' | ';
- }
- }
-
- mysqli_stmt_close($stmt);
- mysqli_free_result($thread_res);
-}
-
-function display_threads($dbc, $sql_result, $show_category = false) {
- $sql = "SELECT post_id, post_date, user_id, user_name FROM posts JOIN users ON post_author = user_id WHERE post_thread = ? ORDER BY post_id DESC LIMIT 1";
- $stmt = mysqli_stmt_init($dbc);
-
- if (!mysqli_stmt_prepare($stmt, $sql)) {
- die('Could not create thread due to internal error: ' . mysqli_error($dbc));
- }
-
- while ($row = mysqli_fetch_assoc($sql_result)) {
- mysqli_stmt_bind_param($stmt, "i", $row['thread_id']);
- mysqli_stmt_execute($stmt);
-
- $thread_res = mysqli_stmt_get_result($stmt);
- $thread = mysqli_fetch_assoc($thread_res);
-
- echo '';
- echo '';
- echo 'by ' . $row['user_name'] . ' ';
- if ($show_category) {
- echo 'in ' . $row['cat_name'] . ' ';
- }
- echo 'on ' . date('M d, Y', strtotime($row['thread_date'])) . '';
- echo ' | by ' . $thread['user_name'] . ' ';
- echo '' . date('m/d/Y g:ia', strtotime($thread['post_date'])) . ' |
';
- }
-
- mysqli_stmt_close($stmt);
-}
-
-function add_quote($dbc, $thread_id, $matches) {
- foreach ($matches as $match) {
- $id = (int) filter_var($match, FILTER_SANITIZE_NUMBER_INT) - 1;
- $sql = "SELECT post_content, post_author, user_name FROM posts LEFT JOIN users ON post_author = user_id WHERE post_thread = " . $thread_id . " LIMIT 1 OFFSET " . $id;
- $result = mysqli_query($dbc, $sql);
-
- if (!$result) {
- return '';
- }
-
- $reply = mysqli_fetch_assoc($result);
-
- if (empty($reply)) {
- return 'Invalid quote!
';
- }
-
- $id = $id + 1;
-
- return 'Quote from ' . $reply['user_name'] . '
' . $reply['post_content'] . '
';
- }
-}
-
-function display_posts($dbc, $thread_id, $sql_result) {
- while ($row = mysqli_fetch_assoc($sql_result)) {
- echo '#' . $row['post_id'] . ' Posted by ' . $row['user_name'] . ' on ' . 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 create_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);
- // Replace Image URLs with embedded images.
- $post_content = preg_replace('@\b(http(s)?://)([^\s]*?(?:\.[a-z\d?=/_-]+)+(?:\.jpg|\.png|\.gif))(?![^<]*?(?:\w+>|/?>))@i', '
', $post_content);
- // Replace other URLs with links.
- $post_content = preg_replace('@\b(http(s)?://)([^\s]*?(?:\.[a-z\d?=/_-]+)+)(?![^<]*?(?:\w+>|/?>))@i', '$0', $post_content);
-
- echo $post_content;
- }
-}
\ No newline at end of file
--
cgit v1.2.3