From 65ff2470a505fbc18211093ac131c29b1e820c3e Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sun, 9 Jan 2011 22:34:44 -0800 Subject: Use eeldivad's fallback code from http://gallery.menalto.com/node/96806#comment-358404 instead of relying solely on preg_quote. Fixes #1460. --- modules/server_add/controllers/server_add.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'modules/server_add/controllers') diff --git a/modules/server_add/controllers/server_add.php b/modules/server_add/controllers/server_add.php index 15b92cc0..05543a68 100644 --- a/modules/server_add/controllers/server_add.php +++ b/modules/server_add/controllers/server_add.php @@ -167,8 +167,11 @@ class Server_Add_Controller extends Admin_Controller { $entry->delete(); } - $path = preg_replace("/(\*|\?|\[)/", "[$1]", $entry->path); - foreach (glob("$path/*") as $child_path) { + $child_paths = glob(preg_quote($entry->path) . "/*"); + if (!$child_paths) { + $child_paths = glob("$path/*"); + } + foreach ($child_paths as $child_path) { if (!is_dir($child_path)) { $ext = strtolower(pathinfo($child_path, PATHINFO_EXTENSION)); if (!in_array($ext, array("gif", "jpeg", "jpg", "png", "flv", "mp4", "m4v")) || @@ -189,8 +192,8 @@ class Server_Add_Controller extends Admin_Controller { // We've processed this entry, mark it as done. $entry->checked = 1; $entry->save(); + $dirs_scanned++; } - $dirs_scanned++; } // We have no idea how long this can take because we have no idea how deep the tree -- cgit v1.2.3