diff options
author | Bharat Mediratta <bharat@menalto.com> | 2012-02-06 20:02:32 -0800 |
---|---|---|
committer | Bharat Mediratta <bharat@menalto.com> | 2012-02-06 20:02:32 -0800 |
commit | cdbd9b5a9dbaba0cd9e2a1204f5cc2a28b994737 (patch) | |
tree | 00f9d25b716920b7309176c8397099bbeb704621 /modules | |
parent | 065dd32f3168edc06ca235301c728ede8db849e6 (diff) |
Don't support display contexts for robots. Fixes #1819.
Diffstat (limited to 'modules')
-rw-r--r-- | modules/gallery/helpers/item.php | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/modules/gallery/helpers/item.php b/modules/gallery/helpers/item.php index 77d53663..2b663f45 100644 --- a/modules/gallery/helpers/item.php +++ b/modules/gallery/helpers/item.php @@ -407,20 +407,26 @@ class item_Core { * Set the display context callback for any future item renders. */ static function set_display_context_callback() { - $args = func_get_args(); - Cache::instance()->set("display_context_" . $sid = Session::instance()->id(), $args, - array("display_context")); + if (!request::user_agent("robot")) { + $args = func_get_args(); + Cache::instance()->set("display_context_" . $sid = Session::instance()->id(), $args, + array("display_context")); + } } /** * Call the display context callback for the given item */ static function get_display_context($item) { - $args = Cache::instance()->get("display_context_" . $sid = Session::instance()->id()); - $callback = $args[0]; - $args[0] = $item; - if (!$callback) { + if (!request::user_agent("robot")) { + $args = Cache::instance()->get("display_context_" . $sid = Session::instance()->id()); + $callback = $args[0]; + $args[0] = $item; + } + + if (empty($callback)) { $callback = "Albums_Controller::get_display_context"; + $args = array($item); } return call_user_func_array($callback, $args); } |