From eb322e831297ee8fd773049c1a00c915c49dc93e Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Wed, 18 Jul 2018 13:18:37 +0200 Subject: set the correct album name when moving photos --- include/attach.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'include/attach.php') diff --git a/include/attach.php b/include/attach.php index 2a9badaac..202412263 100644 --- a/include/attach.php +++ b/include/attach.php @@ -2325,6 +2325,7 @@ function attach_move($channel_id, $resource_id, $new_folder_hash) { return false; $newdirname = $n[0]['filename']; + $newalbumname = $n[0]['display_path']; $newstorepath = dbunescbin($n[0]['content']) . '/' . $resource_id; } else { @@ -2332,6 +2333,7 @@ function attach_move($channel_id, $resource_id, $new_folder_hash) { // root directory $newdirname = EMPTY_STR; + $newalbumname = EMPTY_STR; $newstorepath = 'store/' . $c['channel_address'] . '/' . $resource_id; } @@ -2419,7 +2421,7 @@ function attach_move($channel_id, $resource_id, $new_folder_hash) { if($r[0]['is_photo']) { $t = q("update photo set album = '%s', filename = '%s', os_path = '%s', display_path = '%s' where resource_id = '%s' and uid = %d", - dbesc($newdirname), + dbesc($newalbumname), dbesc($filename), dbesc($x['os_path']), dbesc($x['path']), -- cgit v1.2.3 From abe35817cd4f81c2d9c8305573c5fa5cbe154095 Mon Sep 17 00:00:00 2001 From: "M.Dent (DM42.Net)" Date: Sat, 15 Sep 2018 23:09:16 -0400 Subject: Add attach_delete hook --- include/attach.php | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'include/attach.php') diff --git a/include/attach.php b/include/attach.php index 202412263..4db5bc435 100644 --- a/include/attach.php +++ b/include/attach.php @@ -1428,6 +1428,8 @@ function attach_delete($channel_id, $resource, $is_photo = 0) { if(! $r) { attach_drop_photo($channel_id,$resource); + $arr = ['channel_id' => $channel_id, 'resource' => $resource, 'is_photo'=>$is_photo]; + call_hooks("attach_delete",$arr); return; } @@ -1486,6 +1488,9 @@ function attach_delete($channel_id, $resource, $is_photo = 0) { intval($channel_id) ); + $arr = ['channel_id' => $channel_id, 'resource' => $resource, 'is_photo'=>$is_photo]; + call_hooks("attach_delete",$arr); + file_activity($channel_id, $object, $object['allow_cid'], $object['allow_gid'], $object['deny_cid'], $object['deny_gid'], 'update', true); return; -- cgit v1.2.3