From 6b8b1e26a6bc0e0ee0f0970f430e9240f23bd0d1 Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Sat, 28 Mar 2009 03:45:20 +0000 Subject: setting owner correctly for edit multi --- edit_multi.php | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) (limited to 'edit_multi.php') diff --git a/edit_multi.php b/edit_multi.php index 5b78e6691..501e23102 100644 --- a/edit_multi.php +++ b/edit_multi.php @@ -8,17 +8,26 @@ gatekeeper(); set_context('photos'); - - $page_owner = page_owner_entity(); - if ($page_owner === false || is_null($page_owner)) { - $page_owner = $_SESSION['user']; - set_page_owner($page_owner->getGUID()); - } - + + // parse out photo guids $file_string = get_input('files'); $file_array_sent = explode('-', $file_string); $new_file_array = array(); - + + // set owner of page based on first photo guid + $photo_guid = (int)$file_array_sent[0]; + $photo = get_entity($photo_guid); + error_log($photo_guid); + + // set page owner based on owner of photo album + set_page_owner($photo->owner_guid); + $album = get_entity($photo->container_guid); + if ($album) { + $owner_guid = $album->container_guid; + if ($owner_guid) + set_page_owner($owner_guid); + } + foreach ($file_array_sent as $file_guid) { if ($entity = get_entity($file_guid)) { if ($entity->canEdit()){ -- cgit v1.2.3