diff options
| author | Nathan Kinkade <nkinkade@nkinka.de> | 2010-09-17 20:23:05 +0000 |
|---|---|---|
| committer | Nathan Kinkade <nkinkade@nkinka.de> | 2010-09-17 20:23:05 +0000 |
| commit | 7a5de04e51daa102840a02af6b9ce8138d08c4bb (patch) | |
| tree | a3f8bcb9ac961523b4835b8865c152c8835f25e7 /modules/gallery/helpers/gallery_event.php | |
| parent | f96a75f2b13a0bd7a37b320aa5655f67868ca80d (diff) | |
| parent | 3e1743b21fd35b9d6d540e827292f1f4f006b531 (diff) | |
Pulled latest source from upstream.
Diffstat (limited to 'modules/gallery/helpers/gallery_event.php')
| -rw-r--r-- | modules/gallery/helpers/gallery_event.php | 31 |
1 files changed, 25 insertions, 6 deletions
diff --git a/modules/gallery/helpers/gallery_event.php b/modules/gallery/helpers/gallery_event.php index df5394c9..b59bb9b9 100644 --- a/modules/gallery/helpers/gallery_event.php +++ b/modules/gallery/helpers/gallery_event.php @@ -63,6 +63,8 @@ class gallery_event_Core { ->update("logs") ->set("user_id", $admin->id) ->execute(); + module::set_var("gallery", "email_from", $admin->email); + module::set_var("gallery", "email_reply_to", $admin->email); } static function group_created($group) { @@ -116,8 +118,8 @@ class gallery_event_Core { $batch_missing_album_cover[$parent->id] = 1; Session::instance()->set("batch_missing_album_cover", $batch_missing_album_cover); } else { - // Choose the first child as the new cover. - if ($child = $parent->children(1)->current()) { + // Choose the first viewable child as the new cover. + if ($child = $parent->viewable()->children(1)->current()) { item::make_album_cover($child); } } @@ -155,7 +157,11 @@ class gallery_event_Core { } static function item_moved($item, $old_parent) { - access::recalculate_permissions($item->parent()); + if ($item->is_album()) { + access::recalculate_album_permissions($item->parent()); + } else { + access::recalculate_photo_permissions($item); + } // If the new parent doesn't have an album cover, make this it. if (!$item->parent()->album_cover_item_id) { @@ -208,10 +214,10 @@ class gallery_event_Core { ->label($user->display_name())); if (Router::$controller == "admin") { - $continue_url = url::site(""); - } else if (isset($theme->item)) { + $continue_url = url::abs_site(""); + } else if ($item = $theme->item()) { if (access::user_can(identity::guest(), "view", $theme->item)) { - $continue_url = $theme->item->abs_url(); + $continue_url = $item->abs_url(); } else { $continue_url = item::root()->abs_url(); } @@ -547,4 +553,17 @@ class gallery_event_Core { $data->content[] = (object) array("title" => t("User information"), "view" => $v); } + + static function user_updated($original_user, $updated_user) { + // If the default from/reply-to email address is set to the install time placeholder value + // of unknown@unknown.com then adopt the value from the first admin to set their own email + // address so that we at least have a valid address for the Gallery. + if ($updated_user->admin) { + $email = module::get_var("gallery", "email_from", ""); + if ($email == "unknown@unknown.com") { + module::set_var("gallery", "email_from", $updated_user->email); + module::set_var("gallery", "email_reply_to", $updated_user->email); + } + } + } } |
