Better error checking for content

merge-requests/5/head
Terence Eden 2024-03-07 11:33:26 +00:00
rodzic 3b05ec48a1
commit fad6ad7c20
1 zmienionych plików z 11 dodań i 1 usunięć

Wyświetl plik

@ -614,7 +614,17 @@ HTML;
if ( "Create" == $type || "Update" == $type || "Note" == $type ) { if ( "Create" == $type || "Update" == $type || "Note" == $type ) {
// Get the HTML content // Get the HTML content
// There is a slight difference between the formatting of sent and received messages // 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 // Sanitise the HTML
$content = strip_tags( $content, $allowed_elements ); $content = strip_tags( $content, $allowed_elements );