diff options
author | Aaron Parecki <aaron@parecki.com> | 2016-12-29 06:41:12 -0800 |
---|---|---|
committer | Aaron Parecki <aaron@parecki.com> | 2016-12-29 06:41:12 -0800 |
commit | 90256b538547c68367f6711ae706d75495e92d19 (patch) | |
tree | 34bceea32f27dedf6e5b7cc68c21f30a9fcc0bfe /controllers | |
parent | b9a283f4b14f5b2f511171e96e3e4918bfa8a071 (diff) |
fix check for author info
Diffstat (limited to 'controllers')
-rw-r--r-- | controllers/controllers.php | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/controllers/controllers.php b/controllers/controllers.php index 889c08a..2e6f1e0 100644 --- a/controllers/controllers.php +++ b/controllers/controllers.php @@ -434,7 +434,7 @@ $app->get('/reply/preview', function() use($app) { if($data && $data['data']['type'] == 'entry') { $entry = $data['data']; // Create a nickname based on the author URL - if($entry['author']['url']) { + if(array_key_exists('author', $entry) && $entry['author']['url']) { $entry['author']['nickname'] = display_url($entry['author']['url']); } } @@ -442,8 +442,10 @@ $app->get('/reply/preview', function() use($app) { $mentions = []; if($entry) { - // Find all @-names in the post, as well as the author name - $mentions[] = $entry['author']['nickname']; + if(array_key_exists('author', $entry)) { + // Find all @-names in the post, as well as the author name + $mentions[] = $entry['author']['nickname']; + } if(preg_match_all('/(^|(?<=[\s\/]))@([a-z0-9_]+([a-z0-9_\.]*)?)/i', $entry['content']['text'], $matches)) { foreach($matches[0] as $nick) { |