mirror of
https://github.com/Pathduck/gallery3.git
synced 2026-07-11 17:53:50 -04:00
Don't allow moving an item into its own hierarchy. Just silently skip
those sources for now.
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user