diff options
| author | Tim Almdal <tnalmdal@shaw.ca> | 2009-10-24 10:09:57 -0700 |
|---|---|---|
| committer | Tim Almdal <tnalmdal@shaw.ca> | 2009-10-24 10:09:57 -0700 |
| commit | 5212deb5b117fd93911c40d5427b55b3063eea4e (patch) | |
| tree | 3d4622d2739950ebc3f8df0b821aef1062869889 /modules/gallery/models | |
| parent | 7afb4c5c30faeb700c6d17b1746b051382e0d418 (diff) | |
| parent | 607662d66be4361c20322c7db84f9e7b1c529ba2 (diff) | |
Merge branch 'master' into talmdal_dev
Diffstat (limited to 'modules/gallery/models')
| -rw-r--r-- | modules/gallery/models/item.php | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/modules/gallery/models/item.php b/modules/gallery/models/item.php index db89c6df..ca1e10cb 100644 --- a/modules/gallery/models/item.php +++ b/modules/gallery/models/item.php @@ -99,6 +99,10 @@ class Item_Model extends ORM_MPTT { throw new Exception("@todo INVALID_MOVE_TYPE $target->type"); } + if (file_exists($target_file = "{$target->file_path()}/$this->name")) { + throw new Exception("@todo INVALID_MOVE_TARGET_EXISTS: $target_file"); + } + if ($this->id == 1) { throw new Exception("@todo INVALID_SOURCE root album"); } @@ -147,6 +151,10 @@ class Item_Model extends ORM_MPTT { $old_relative_path = urldecode($this->relative_path()); $new_relative_path = dirname($old_relative_path) . "/" . $new_name; + if (file_exists(VARPATH . "albums/$new_relative_path")) { + throw new Exception("@todo INVALID_RENAME_FILE_EXISTS: $new_relative_path"); + } + @rename(VARPATH . "albums/$old_relative_path", VARPATH . "albums/$new_relative_path"); @rename(VARPATH . "resizes/$old_relative_path", VARPATH . "resizes/$new_relative_path"); @rename(VARPATH . "thumbs/$old_relative_path", VARPATH . "thumbs/$new_relative_path"); |
