diff options
author | Bharat Mediratta <bharat@menalto.com> | 2009-09-21 21:29:13 -0700 |
---|---|---|
committer | Bharat Mediratta <bharat@menalto.com> | 2009-09-21 21:29:13 -0700 |
commit | e5a78d39ec49332054cbc1a398d7c110e1d9191c (patch) | |
tree | c2acb4731a381b7a1b28fa5ed505a76adb23a3ef /modules/server_add/controllers/admin_server_add.php | |
parent | 529ded3388673036314eefd5bfb1cfc0b76f7f9e (diff) | |
parent | 33690a32bcf132e5ab470ff77ba23c073ac26271 (diff) |
Merge branch 'master' of git@github.com:gallery/gallery3 into bharat_dev
Conflicts:
modules/gallery/controllers/albums.php
Diffstat (limited to 'modules/server_add/controllers/admin_server_add.php')
-rw-r--r-- | modules/server_add/controllers/admin_server_add.php | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/modules/server_add/controllers/admin_server_add.php b/modules/server_add/controllers/admin_server_add.php index fac2aa44..38190fee 100644 --- a/modules/server_add/controllers/admin_server_add.php +++ b/modules/server_add/controllers/admin_server_add.php @@ -34,15 +34,17 @@ class Admin_Server_Add_Controller extends Admin_Controller { $form = $this->_get_admin_form(); $paths = unserialize(module::get_var("server_add", "authorized_paths", "a:0:{}")); if ($form->validate()) { - if (is_readable($form->add_path->path->value)) { + if (is_link($form->add_path->path->value)) { + $form->add_path->path->add_error("is_symlink", 1); + } else if (!is_readable($form->add_path->path->value)) { + $form->add_path->path->add_error("not_readable", 1); + } else { $path = $form->add_path->path->value; $paths[$path] = 1; module::set_var("server_add", "authorized_paths", serialize($paths)); message::success(t("Added path %path", array("path" => $path))); server_add::check_config($paths); url::redirect("admin/server_add"); - } else { - $form->add_path->path->add_error("not_readable", 1); } } @@ -71,7 +73,7 @@ class Admin_Server_Add_Controller extends Admin_Controller { $directories = array(); $path_prefix = $this->input->get("q"); foreach (glob("{$path_prefix}*") as $file) { - if (is_dir($file)) { + if (is_dir($file) && !is_link($file)) { $directories[] = $file; } } @@ -84,9 +86,10 @@ class Admin_Server_Add_Controller extends Admin_Controller { array("id" => "gServerAddAdminForm")); $add_path = $form->group("add_path"); $add_path->input("path")->label(t("Path"))->rules("required") - ->error_messages("not_readable", t("This directory is not readable by the webserver")); + ->error_messages("not_readable", t("This directory is not readable by the webserver")) + ->error_messages("is_symlink", t("Symbolic links are not allowed")); $add_path->submit("add")->value(t("Add Path")); return $form; } -}
\ No newline at end of file +} |