summaryrefslogtreecommitdiff
path: root/modules/gallery/controllers
diff options
context:
space:
mode:
authorTim Almdal <tnalmdal@shaw.ca>2009-10-09 01:28:17 -0700
committerTim Almdal <tnalmdal@shaw.ca>2009-10-09 01:28:17 -0700
commit53393a144609c0d8402b14606f52422bf3f28daf (patch)
tree14a6a71e5e0727af8e1aba4cdff577d7e35671be /modules/gallery/controllers
parent79b4b8bdc606ecd46b258e32b3973511a43d38b0 (diff)
parent3fc1eb58428c4ecdfdf7d54f51fd2fa4449cc02f (diff)
Merge branch 'master' of git@github.com:gallery/gallery3
Diffstat (limited to 'modules/gallery/controllers')
-rw-r--r--modules/gallery/controllers/movies.php13
-rw-r--r--modules/gallery/controllers/photos.php12
2 files changed, 23 insertions, 2 deletions
diff --git a/modules/gallery/controllers/movies.php b/modules/gallery/controllers/movies.php
index 2a917c58..01a9fc8b 100644
--- a/modules/gallery/controllers/movies.php
+++ b/modules/gallery/controllers/movies.php
@@ -61,7 +61,18 @@ class Movies_Controller extends Items_Controller {
access::required("edit", $movie);
$form = movie::get_edit_form($movie);
- if ($valid = $form->validate()) {
+ $valid = $form->validate();
+
+ if ($valid) {
+ $new_ext = pathinfo($form->edit_item->filename->value, PATHINFO_EXTENSION);
+ $old_ext = pathinfo($photo->name, PATHINFO_EXTENSION);
+ if (strcasecmp($new_ext, $old_ext)) {
+ $form->edit_item->filename->add_error("illegal_extension", 1);
+ $valid = false;
+ }
+ }
+
+ if ($valid) {
if ($form->edit_item->filename->value != $movie->name ||
$form->edit_item->slug->value != $movie->slug) {
// Make sure that there's not a name or slug conflict
diff --git a/modules/gallery/controllers/photos.php b/modules/gallery/controllers/photos.php
index 81e7519e..fbff53ce 100644
--- a/modules/gallery/controllers/photos.php
+++ b/modules/gallery/controllers/photos.php
@@ -63,7 +63,17 @@ class Photos_Controller extends Items_Controller {
$form = photo::get_edit_form($photo);
$valid = $form->validate();
- if ($valid = $form->validate()) {
+
+ if ($valid) {
+ $new_ext = pathinfo($form->edit_item->filename->value, PATHINFO_EXTENSION);
+ $old_ext = pathinfo($photo->name, PATHINFO_EXTENSION);
+ if (strcasecmp($new_ext, $old_ext)) {
+ $form->edit_item->filename->add_error("illegal_extension", 1);
+ $valid = false;
+ }
+ }
+
+ if ($valid) {
if ($form->edit_item->filename->value != $photo->name ||
$form->edit_item->slug->value != $photo->slug) {
// Make sure that there's not a name or slug conflict