aboutsummaryrefslogtreecommitdiffstats
path: root/mod
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2013-02-01 00:49:07 -0800
committerfriendica <info@friendica.com>2013-02-01 00:49:07 -0800
commit344b8593a818c9ea1d07a365b8a2496d699b1620 (patch)
tree9669c68a798c743b1ef860a9e73696740dad94ca /mod
parent5ca88ca10a11a76237aa34d1d93ba3e878567767 (diff)
downloadvolse-hubzilla-344b8593a818c9ea1d07a365b8a2496d699b1620.tar.gz
volse-hubzilla-344b8593a818c9ea1d07a365b8a2496d699b1620.tar.bz2
volse-hubzilla-344b8593a818c9ea1d07a365b8a2496d699b1620.zip
sort out the rest of the nasty stuff in the attachment/file api - time to move on to something else
Diffstat (limited to 'mod')
-rw-r--r--mod/item.php11
-rw-r--r--mod/magic.php3
2 files changed, 10 insertions, 4 deletions
diff --git a/mod/item.php b/mod/item.php
index c482f3ea9..8d01a12f8 100644
--- a/mod/item.php
+++ b/mod/item.php
@@ -471,14 +471,19 @@ function item_post(&$a) {
$match = false;
if(preg_match_all('/(\[attachment\](.*?)\[\/attachment\])/',$body,$match)) {
+ $attachments = array();
foreach($match[2] as $mtch) {
$hash = substr($mtch,0,strpos($mtch,','));
$rev = intval(substr($mtch,strpos($mtch,',')));
$r = attach_by_hash_nodata($hash,$rev);
if($r['success']) {
- if(strlen($attachments))
- $attachments .= ',';
- $attachments .= '[attach]href="' . $a->get_baseurl() . '/attach/' . $r['data']['hash'] . '" length="' . $r['data']['filesize'] . '" type="' . $r['data']['filetype'] . '" title="' . urlencode($r['data']['filename']) . '" revision="' . $r['data']['revision'] . '"[/attach]';
+ $attachments[] = array(
+ 'href' => $a->get_baseurl() . '/attach/' . $r['data']['hash'],
+ 'length' => $r['data']['filesize'],
+ 'type' => $r['data']['filetype'],
+ 'title' => urlencode($r['data']['filename']),
+ 'revision' => $r['data']['revision']
+ );
}
$body = str_replace($match[1],'',$body);
}
diff --git a/mod/magic.php b/mod/magic.php
index d7a6674ee..408619b7e 100644
--- a/mod/magic.php
+++ b/mod/magic.php
@@ -10,7 +10,8 @@ function magic_init(&$a) {
if($hash) {
$x = q("select xchan.xchan_url, hubloc.* from xchan left join hubloc on xchan_hash = hubloc_hash
- where hublock_hash = '%s' and (hubloc_flags & %d) limit 1",
+ where hubloc_hash = '%s' and (hubloc_flags & %d) limit 1",
+ dbesc($hash),
intval(HUBLOC_FLAGS_PRIMARY)
);
}