]> git.mxchange.org Git - friendica.git/blobdiff - mod/wall_attach.php
bypass D* markdown bug for now
[friendica.git] / mod / wall_attach.php
index b539171cf9722761b78ec9314d407301dcfc6ced..a66ed0d059c6d36970d0f77ff2796541e68a301a 100644 (file)
@@ -60,15 +60,16 @@ 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();
-dbg(1);
-       $r = q("INSERT INTO `attach` ( `uid`, `hash`, `filetype`, `filesize`, `data`, `created`, `edited`, `allow_cid`, `allow_gid`,`deny_cid`, `deny_gid` )
-               VALUES ( %d, '%s', '%s', %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s' ) ",
+       $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),
                dbesc($hash),
+               dbesc($filename),
                dbesc($mimetype),
                intval($filesize),
                dbesc($filedata),