diff options
author | Tobias Diekershoff <tobias.diekershoff@gmx.net> | 2011-05-30 06:19:59 +0200 |
---|---|---|
committer | Tobias Diekershoff <tobias.diekershoff@gmx.net> | 2011-05-30 06:19:59 +0200 |
commit | 087f79236e79975d482f739e84cc16f6648e1bec (patch) | |
tree | e7296753df9d9ae92adbc5acf9d2997193b65d99 /mod/item.php | |
parent | 770d1bb7a368cdaba8e7340b54fd4b13ffea66b8 (diff) | |
parent | c3478a1485334e9a399fe0786af54d63bb666a60 (diff) | |
download | volse-hubzilla-087f79236e79975d482f739e84cc16f6648e1bec.tar.gz volse-hubzilla-087f79236e79975d482f739e84cc16f6648e1bec.tar.bz2 volse-hubzilla-087f79236e79975d482f739e84cc16f6648e1bec.zip |
Merge branch 'master' of git://github.com/friendika/friendika
Diffstat (limited to 'mod/item.php')
-rw-r--r-- | mod/item.php | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/mod/item.php b/mod/item.php index b07f26e32..0fb780adc 100644 --- a/mod/item.php +++ b/mod/item.php @@ -204,6 +204,8 @@ function item_post(&$a) { continue; $image_uri = substr($image,strrpos($image,'/') + 1); $image_uri = substr($image_uri,0, strpos($image_uri,'-')); + if(! strlen($image_uri)) + continue; $srch = '<' . intval($profile_uid) . '>'; $r = q("SELECT `id` FROM `photo` WHERE `allow_cid` = '%s' AND `allow_gid` = '' AND `deny_cid` = '' AND `deny_gid` = '' AND `resource-id` = '%s' AND `uid` = %d LIMIT 1", @@ -231,7 +233,7 @@ function item_post(&$a) { } - $match = null; + $match = false; if(preg_match_all("/\[attachment\](.+?)\[\/attachment\]/",$body,$match)) { $attaches = $match[1]; @@ -239,13 +241,13 @@ function item_post(&$a) { foreach($attaches as $attach) { $r = q("SELECT * FROM `attach` WHERE `uid` = %d AND `id` = %d LIMIT 1", intval($profile_uid), - intval($attaches) + intval($attach) ); if(count($r)) { $r = q("UPDATE `attach` SET `allow_cid` = '%s', `allow_gid` = '%s', `deny_cid` = '%s', `deny_gid` = '%s' WHERE `uid` = %d AND `id` = %d LIMIT 1", intval($profile_uid), - intval($attaches) + intval($attach) ); } } @@ -361,6 +363,7 @@ function item_post(&$a) { } $attachments = ''; + $match = false; if(preg_match_all('/(\[attachment\]([0-9]+)\[\/attachment\])/',$body,$match)) { foreach($match[2] as $mtch) { @@ -371,7 +374,7 @@ function item_post(&$a) { if(count($r)) { if(strlen($attachments)) $attachments .= ','; - $attachments .= '[attach]href="' . $a->get_baseurl() . '/attach/' . $r[0]['id'] . '" size="' . $r[0]['filesize'] . '" type="' . $r[0]['filetype'] . '" title="' . $r[0]['filename'] . '"[/attach]'; + $attachments .= '[attach]href="' . $a->get_baseurl() . '/attach/' . $r[0]['id'] . '" size="' . $r[0]['filesize'] . '" type="' . $r[0]['filetype'] . '" title="' . (($r[0]['filename']) ? $r[0]['filename'] : ' ') . '"[/attach]'; } $body = str_replace($match[1],'',$body); } |