aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Module/Poster.php
diff options
context:
space:
mode:
authorMax Kostikov <max@kostikov.co>2019-05-02 11:33:07 +0200
committerMax Kostikov <max@kostikov.co>2019-05-02 11:33:07 +0200
commit47fba5827bd106f53625b543f30643ca5ba1c16e (patch)
treebef05781eacc6dbc67d03899e0dde0257ce58096 /Zotlabs/Module/Poster.php
parent47f75ad8bfbe8325a76ae6fe466aa8080fc87045 (diff)
parent516167c0f8579c8a068b6e52557e7e1109f897ae (diff)
downloadvolse-hubzilla-47fba5827bd106f53625b543f30643ca5ba1c16e.tar.gz
volse-hubzilla-47fba5827bd106f53625b543f30643ca5ba1c16e.tar.bz2
volse-hubzilla-47fba5827bd106f53625b543f30643ca5ba1c16e.zip
Merge branch 'dev' into 'dev'
# Conflicts: # Zotlabs/Lib/ThreadItem.php
Diffstat (limited to 'Zotlabs/Module/Poster.php')
-rw-r--r--Zotlabs/Module/Poster.php37
1 files changed, 37 insertions, 0 deletions
diff --git a/Zotlabs/Module/Poster.php b/Zotlabs/Module/Poster.php
new file mode 100644
index 000000000..10317ee61
--- /dev/null
+++ b/Zotlabs/Module/Poster.php
@@ -0,0 +1,37 @@
+<?php
+
+namespace Zotlabs\Module;
+
+use Zotlabs\Web\Controller;
+
+require_once('include/security.php');
+
+class Poster extends Controller {
+
+ function init() {
+
+ $nick = argv(1);
+ $hash = argv(2);
+
+ if(! ($nick && $hash)) {
+ return;
+ }
+
+ $u = channelx_by_nick($nick);
+
+ $sql_extra = permissions_sql(intval($u['channel_id']));
+
+ $r = q("select content from attach where hash = '%s' and uid = %d and os_storage = 1 $sql_extra limit 1",
+ dbesc($hash),
+ intval($u['channel_id'])
+ );
+ if($r) {
+ $path = dbunescbin($r[0]['content']);
+ if($path && @file_exists($path . '.thumb')) {
+ header('Content-Type: image/jpeg');
+ echo file_get_contents($path . '.thumb');
+ killme();
+ }
+ }
+ }
+}