X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=mod%2Fwall_attach.php;h=c9d13abef4df037b610828c9828e53a02f187dde;hb=10ede7314136edb1c475e1af546a59ff4c5648cf;hp=18125685450c4760929ce37f90926f69f16a4a94;hpb=8ec5b06e0440302cef9f6bc2f35730fca5a9030e;p=friendica.git diff --git a/mod/wall_attach.php b/mod/wall_attach.php index 1812568545..c9d13abef4 100644 --- a/mod/wall_attach.php +++ b/mod/wall_attach.php @@ -1,9 +1,11 @@ $limit)) { - $msg = upgrade_message(true); - if ($r_json) { - echo json_encode(array('error'=>$msg)); - } else { - echo $msg. EOL ; - } - @unlink($src); - killme(); - } - - $filedata = @file_get_contents($src); $mimetype = z_mime_content_type($filename); $hash = get_guid(64); $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), - dbesc($hash), - dbesc($filename), - dbesc($mimetype), - intval($filesize), - dbesc($filedata), - dbesc($created), - dbesc($created), - dbesc('<' . $page_owner_cid . '>'), - dbesc(''), - dbesc(''), - dbesc('') - ); + + $fields = array('uid' => $page_owner_uid, 'hash' => $hash, 'filename' => $filename, 'filetype' => $mimetype, + 'filesize' => $filesize, 'data' => $filedata, 'created' => $created, 'edited' => $created, + 'allow_cid' => '<' . $page_owner_cid . '>', 'allow_gid' => '','deny_cid' => '', 'deny_gid' => ''); + + $r = dba::insert('attach', $fields); @unlink($src);