//If photo id is not correct or the owner is not the current user, goto photo management page if (!$photo || $photo['poster'] != $userID) { buckys_redirect('/photo_manage.php', MSG_INVALID_REQUEST, MSG_TYPE_ERROR); } if (isset($_POST['action'])) { //Create New Album if ($_POST['action'] == 'save-photo') { if ($photo['poster'] != $userID) { buckys_redirect('/photo_manage.php', MSG_INVALID_REQUEST, MSG_TYPE_ERROR); } //Update Photo Caption and Privacy BuckysPost::updatePhoto($userID, $_POST); //Change user profile image if ($_POST['photo_visibility'] == 2) { if (!$photo['is_profile']) { BuckysPost::createProfileImage($photo, $_POST); } //Update profile image with old one BuckysUser::updateUserFields($userID, array('thumbnail' => $photo['image'])); } else { if ($userData['thumbnail'] == $photo['image']) { //If it was a profile image and now it is not, remove it from the profile image BuckysUser::updateUserFields($userID, array('thumbnail' => '')); } } //Save Album if (isset($_POST['album']) && $_POST['album'] != '' && isset($albums[$_POST['album']])) { BuckysAlbum::addPhotoToAlbum($_POST['album'], $photo['postID']); } buckys_redirect('/photo_edit.php?photoID=' . $photo['postID'], MSG_PHOTO_UPDATED, MSG_TYPE_SUCCESS); exit;