diff --git a/index.php b/index.php index 4632878..d708292 100644 --- a/index.php +++ b/index.php @@ -576,7 +576,8 @@ HTML; if ( isset( $message["published"] ) ) { $published = $message["published"]; } else { - $published_hexstamp = end( explode( "/", explode( "-", $message_file)[0] ) ) ; + $segments = explode("/", explode("-", $inbox_file ?? "")[0]); + $published_hexstamp = end($segments); $published_time = hexdec( $published_hexstamp ); $published = date( "c", $published_time ); @@ -596,10 +597,8 @@ HTML; foreach ( $messages_ordered as $published=>$message ) { // Set up the common components - $object = $message["object"]; + $object = $message["object"] ?? []; - // Get the message's ID. - // Set up the HTML representation if ( isset( $message["object"]["id"] ) ) { $id = $message["object"]["id"]; $publishedHTML = "{$published}"; @@ -625,10 +624,9 @@ HTML; $actor = "https://example.com/anonymous"; } // Assume that what comes after the final `/` in the URl is the name - $actorName = end( explode( "/", $actor ) ); + $actorArray = explode( "/", $actor ); + $actorName = end( $actorArray ); $actorServer = parse_url( $actor, PHP_URL_HOST ); - $actorUsername = "@{$actorName}@{$actorServer}"; - // Make i18n usernames readable and safe. $actorName = htmlspecialchars( rawurldecode( $actorName ) ); $actorHTML = "@{$actorName}";