summaryrefslogtreecommitdiff
path: root/modules/gallery/controllers/photos.php
diff options
context:
space:
mode:
authorTim Almdal <tnalmdal@shaw.ca>2009-10-22 10:09:25 -0700
committerTim Almdal <tnalmdal@shaw.ca>2009-10-22 13:11:02 -0700
commit4cb9ec1d6d37b49ebafc68d0a94d794a1acb8b28 (patch)
tree82b4cf69a7cd84efdd8cb71e19e309f816008996 /modules/gallery/controllers/photos.php
parent51a69d7218de1cb4e82872e64560d4e3d3a01f8d (diff)
Use the request::referrer to determine if we are editting the photo or album
from the context menu or from its photo or album page. Fixes ticket #745. Thanks to jankoprowski for the referrer approach.
Diffstat (limited to 'modules/gallery/controllers/photos.php')
-rw-r--r--modules/gallery/controllers/photos.php4
1 files changed, 3 insertions, 1 deletions
diff --git a/modules/gallery/controllers/photos.php b/modules/gallery/controllers/photos.php
index 6bb5af89..54cd63c6 100644
--- a/modules/gallery/controllers/photos.php
+++ b/modules/gallery/controllers/photos.php
@@ -100,6 +100,8 @@ class Photos_Controller extends Items_Controller {
}
if ($valid) {
+ $watching_album = $photo->url() != ($location = parse_url(request::referrer(), PHP_URL_PATH));
+
$photo->title = $form->edit_item->title->value;
$photo->description = $form->edit_item->description->value;
$photo->slug = $form->edit_item->slug->value;
@@ -114,7 +116,7 @@ class Photos_Controller extends Items_Controller {
print json_encode(
array("result" => "success",
- "location" => $photo->url()));
+ "location" => $watching_album ? $location : $photo->url()));
} else {
print json_encode(
array("result" => "error",