From fad6ad7c200254976910ecfdf5dd7cd7ae627eb5 Mon Sep 17 00:00:00 2001 From: Terence Eden Date: Thu, 7 Mar 2024 11:33:26 +0000 Subject: [PATCH] Better error checking for content --- index.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/index.php b/index.php index 39d10f2..7574e64 100644 --- a/index.php +++ b/index.php @@ -614,7 +614,17 @@ HTML; if ( "Create" == $type || "Update" == $type || "Note" == $type ) { // Get the HTML content // There is a slight difference between the formatting of sent and received messages - "Note" == $type ? $content = $message["content"] : $content = $object["content"]; + if ( "Note" == $type ) { + $content = $message["content"]; + } else { + // If there is a content node + if ( isset ( $object["content"] ) ) { + $content = $object["content"]; + } else { + // Anything weird will just get dumped to screen + htmlspecialchars( print_r( $object, true ) ); + } + } // Sanitise the HTML $content = strip_tags( $content, $allowed_elements );