diff options
author | Bharat Mediratta <bharat@menalto.com> | 2011-01-06 08:17:01 -0800 |
---|---|---|
committer | Bharat Mediratta <bharat@menalto.com> | 2011-01-06 08:17:01 -0800 |
commit | 84f287865e5382d7c01c11d1b518c97e8d2bd97b (patch) | |
tree | 7b2673f08736e2bf83298b84155ce6dc584f8687 | |
parent | 56c4997663cfc93174bd0b450768b0bffffb5169 (diff) |
Don't allow moving an item into its own hierarchy. Just silently skip
those sources for now.
-rw-r--r-- | modules/organize/controllers/organize.php | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/modules/organize/controllers/organize.php b/modules/organize/controllers/organize.php index 2ded8a2e..82f74c9e 100644 --- a/modules/organize/controllers/organize.php +++ b/modules/organize/controllers/organize.php @@ -81,6 +81,12 @@ class Organize_Controller extends Controller { $source = ORM::factory("item", $source_id); access::required("edit", $source->parent()); + if ($source->contains($new_parent) || $source->id == $new_parent->id) { + // Can't move an item into its own hierarchy. Silently skip this, + // since the UI shouldn't even allow this operation. + continue; + } + $source->parent_id = $new_parent->id; $source->save(); } |