diff options
Diffstat (limited to 'Zotlabs/Module/Emoji.php')
-rw-r--r-- | Zotlabs/Module/Emoji.php | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/Zotlabs/Module/Emoji.php b/Zotlabs/Module/Emoji.php new file mode 100644 index 000000000..595c9fc60 --- /dev/null +++ b/Zotlabs/Module/Emoji.php @@ -0,0 +1,60 @@ +<?php +namespace Zotlabs\Module; + +use Zotlabs\Web\Controller; +use Zotlabs\Daemon\Master; +use Zotlabs\Lib\ActivityStreams; +use App; + + +class Emoji extends Controller { + + function init() { + + $shortname = argv(1); + + if (!$shortname) { + killme(); + } + + $emojis = get_emojis(); + + if (!isset($emojis[$shortname])) { + killme(); + } + + $emoji = $emojis[$shortname]; + +hz_syslog(print_r($emoji, true)); + + + if (!file_exists($emoji['filepath'])) { + killme(); + } + + $image = getimagesize($emoji['filepath']); + + if(ActivityStreams::is_as_request()) { + $last_modified = date(ATOM_TIME, filemtime($emoji['filepath'])); + + $obj = [ + 'id' => z_root() . '/emoji/' . $shortname, + 'type' => 'Emoji', + 'name' => $emoji['shortname'], + 'updated' => $last_modified, + 'icon' => [ + 'type' => 'Image', + 'mediaType' => $image['mime'], + 'url' => z_root() . '/' . $emoji['filepath'] + ] + ]; + + as_return_and_die($obj); + } + + header('Content-Type: ' . $image['mime']); + echo file_get_contents($emoji['filepath']); + killme(); + } + +} |