aboutsummaryrefslogtreecommitdiffstats
path: root/mod
diff options
context:
space:
mode:
authorFriendika <info@friendika.com>2011-08-03 19:18:58 -0700
committerFriendika <info@friendika.com>2011-08-03 19:18:58 -0700
commitad1e827169d9f57c02746b51c5268bdbe2cd8ac9 (patch)
treea6770ab49f632a8a63f1738b05eec3de32c1ea8b /mod
parentd0b7723bbcd4e9a4fd5c97370bd1c738fdcdab28 (diff)
downloadvolse-hubzilla-ad1e827169d9f57c02746b51c5268bdbe2cd8ac9.tar.gz
volse-hubzilla-ad1e827169d9f57c02746b51c5268bdbe2cd8ac9.tar.bz2
volse-hubzilla-ad1e827169d9f57c02746b51c5268bdbe2cd8ac9.zip
several fixes for attachments
Diffstat (limited to 'mod')
-rw-r--r--mod/item.php6
-rw-r--r--mod/wall_attach.php6
2 files changed, 8 insertions, 4 deletions
diff --git a/mod/item.php b/mod/item.php
index b71c35041..fd5d405ff 100644
--- a/mod/item.php
+++ b/mod/item.php
@@ -304,6 +304,10 @@ function item_post(&$a) {
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",
+ dbesc($str_contact_allow),
+ dbesc($str_group_allow),
+ dbesc($str_contact_deny),
+ dbesc($str_group_deny),
intval($profile_uid),
intval($attach)
);
@@ -436,7 +440,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']) ? $r[0]['filename'] : ' ') . '"[/attach]';
+ $attachments .= '[attach]href="' . $a->get_baseurl() . '/attach/' . $r[0]['id'] . '" length="' . $r[0]['filesize'] . '" type="' . $r[0]['filetype'] . '" title="' . (($r[0]['filename']) ? $r[0]['filename'] : '') . '"[/attach]';
}
$body = str_replace($match[1],'',$body);
}
diff --git a/mod/wall_attach.php b/mod/wall_attach.php
index f18fd10b7..ef6554df3 100644
--- a/mod/wall_attach.php
+++ b/mod/wall_attach.php
@@ -60,11 +60,11 @@ function wall_attach_post(&$a) {
}
$filedata = @file_get_contents($src);
-
- $mimetype = mime_content_type($src);
+ $mimetype = z_mime_content_type($filename);
+ if((! strlen($mimetype)) || ($mimetype === 'application/octet-stream') && function_exists('mime_content_type'))
+ $mimetype = mime_content_type($filename);
$hash = random_string();
$created = datetime_convert();
-
$r = q("INSERT INTO `attach` ( `uid`, `hash`, `filename`, `filetype`, `filesize`, `data`, `created`, `edited`, `allow_cid`, `allow_gid`,`deny_cid`, `deny_gid` )
VALUES ( %d, '%s', '%s', '%s', %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s' ) ",
intval($page_owner_uid),