mirror of
https://git.sekbaer.de/Friendica/friendica.git
synced 2025-06-08 00:04:27 +02:00
API: The media upload (audio, video) is now possible
This commit is contained in:
parent
e3c782010f
commit
7dc75d585e
9 changed files with 151 additions and 41 deletions
|
@ -245,6 +245,7 @@ class Attach
|
|||
* @param string $src Source file name
|
||||
* @param int $uid User id
|
||||
* @param string $filename Optional file name
|
||||
* @param string $filetype Optional file type
|
||||
* @param string $allow_cid
|
||||
* @param string $allow_gid
|
||||
* @param string $deny_cid
|
||||
|
@ -252,7 +253,7 @@ class Attach
|
|||
* @return boolean|int Insert id or false on failure
|
||||
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
||||
*/
|
||||
public static function storeFile(string $src, int $uid, string $filename = '', string $allow_cid = '', string $allow_gid = '', string $deny_cid = '', string $deny_gid = '')
|
||||
public static function storeFile(string $src, int $uid, string $filename = '', string $filetype = '', string $allow_cid = '', string $allow_gid = '', string $deny_cid = '', string $deny_gid = '')
|
||||
{
|
||||
if ($filename === '') {
|
||||
$filename = basename($src);
|
||||
|
@ -260,7 +261,7 @@ class Attach
|
|||
|
||||
$data = @file_get_contents($src);
|
||||
|
||||
return self::store($data, $uid, $filename, '', null, $allow_cid, $allow_gid, $deny_cid, $deny_gid);
|
||||
return self::store($data, $uid, $filename, $filetype, null, $allow_cid, $allow_gid, $deny_cid, $deny_gid);
|
||||
}
|
||||
|
||||
|
||||
|
@ -345,6 +346,16 @@ class Attach
|
|||
}
|
||||
}
|
||||
|
||||
public static function setPermissionForId(int $id, int $uid, string $str_contact_allow, string $str_circle_allow, string $str_contact_deny, string $str_circle_deny)
|
||||
{
|
||||
$fields = [
|
||||
'allow_cid' => $str_contact_allow, 'allow_gid' => $str_circle_allow,
|
||||
'deny_cid' => $str_contact_deny, 'deny_gid' => $str_circle_deny,
|
||||
];
|
||||
|
||||
self::update($fields, ['id' => $id, 'uid' => $uid]);
|
||||
}
|
||||
|
||||
public static function addAttachmentToBody(string $body, int $uid): string
|
||||
{
|
||||
preg_match_all("/\[attachment\](.*?)\[\/attachment\]/ism", $body, $matches, PREG_SET_ORDER);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue