From a5af531fbee1db0c3a0ae0d23388245b2d2ec2de Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Thu, 17 Sep 2009 07:04:11 -0700 Subject: Don't show links as part of the auto complete list --- modules/server_add/controllers/admin_server_add.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/server_add/controllers/admin_server_add.php b/modules/server_add/controllers/admin_server_add.php index 7cd82d60..38190fee 100644 --- a/modules/server_add/controllers/admin_server_add.php +++ b/modules/server_add/controllers/admin_server_add.php @@ -36,7 +36,7 @@ class Admin_Server_Add_Controller extends Admin_Controller { if ($form->validate()) { 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)) { + } 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; @@ -73,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; } } -- cgit v1.2.3 From 86681eebf7ee2bf28b12fd12ee6a5fe70bc36d0a Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Thu, 17 Sep 2009 07:29:37 -0700 Subject: Move the check_environment into the installer helper and call it from the command line installer as well as the web installer. --- installer/cli.php | 5 +++++ installer/installer.php | 41 +++++++++++++++++++++++++++++++++++++++++ installer/web.php | 42 +----------------------------------------- 3 files changed, 47 insertions(+), 41 deletions(-) diff --git a/installer/cli.php b/installer/cli.php index 50845ea4..182c3d26 100644 --- a/installer/cli.php +++ b/installer/cli.php @@ -30,6 +30,11 @@ if (installer::already_installed()) { return; } +$errors = installer::check_environment(); +if ($errors) { + oops(implode("errors", "\n")); +} + $config = parse_cli_params(); if (!installer::connect($config)) { oops("Unable to connect to the database.\n" . mysql_error() . "\n"); diff --git a/installer/installer.php b/installer/installer.php index 7a417634..70afc440 100644 --- a/installer/installer.php +++ b/installer/installer.php @@ -178,4 +178,45 @@ class installer { static function prepend_prefix($prefix, $sql) { return preg_replace("#{([a-zA-Z0-9_]+)}#", "{$prefix}$1", $sql); } + + static function check_environment() { + if (!function_exists("mysql_query") && !function_exists("mysqli_set_charset")) { + $errors[] = "Gallery 3 requires a MySQL database, but PHP doesn't have either the MySQL or the MySQLi extension."; + } + + if (!@preg_match("/^.$/u", utf8_encode("\xF1"))) { + $errors[] = "PHP is missing Perl-Compatible Regular Expression support."; + } + + if (!(function_exists("spl_autoload_register"))) { + $errors[] = "PHP is missing Standard PHP Library (SPL) support"; + } + + if (!(class_exists("ReflectionClass"))) { + $errors[] = "PHP is missing reflection support"; + } + + if (!(function_exists("filter_list"))) { + $errors[] = "PHP is missing the filter extension"; + } + + if (!(extension_loaded("iconv"))) { + $errors[] = "PHP is missing the iconv extension"; + } + + if (!(extension_loaded("simplexml"))) { + $errors[] = "PHP is missing the SimpleXML extension"; + } + + if (extension_loaded("mbstring") && (ini_get("mbstring.func_overload") & MB_OVERLOAD_STRING)) { + $errors[] = "The mbstring extension is overloading PHP's native string functions. Please disable it."; + } + + if (!function_exists("json_encode")) { + $errors[] = "PHP is missing the JavaScript Object Notation (JSON) extension. Please install it."; + } + + return @$errors; +} + } diff --git a/installer/web.php b/installer/web.php index eb0211a6..c46f072a 100644 --- a/installer/web.php +++ b/installer/web.php @@ -23,7 +23,7 @@ if (installer::already_installed()) { switch (@$_GET["step"]) { default: case "welcome": - $errors = check_environment(); + $errors = installer::check_environment(); if ($errors) { $content = render("environment_errors.html.php", array("errors" => $errors)); } else { @@ -80,43 +80,3 @@ function render($view, $args=array()) { function oops($error) { return render("oops.html.php", array("error" => $error)); } - -function check_environment() { - if (!function_exists("mysql_query") && !function_exists("mysqli_set_charset")) { - $errors[] = "Gallery 3 requires a MySQL database, but PHP doesn't have either the MySQL or the MySQLi extension."; - } - - if (!@preg_match("/^.$/u", utf8_encode("\xF1"))) { - $errors[] = "PHP is missing Perl-Compatible Regular Expression support."; - } - - if (!(function_exists("spl_autoload_register"))) { - $errors[] = "PHP is missing Standard PHP Library (SPL) support"; - } - - if (!(class_exists("ReflectionClass"))) { - $errors[] = "PHP is missing reflection support"; - } - - if (!(function_exists("filter_list"))) { - $errors[] = "PHP is missing the filter extension"; - } - - if (!(extension_loaded("iconv"))) { - $errors[] = "PHP is missing the iconv extension"; - } - - if (!(extension_loaded("simplexml"))) { - $errors[] = "PHP is missing the SimpleXML extension"; - } - - if (extension_loaded("mbstring") && (ini_get("mbstring.func_overload") & MB_OVERLOAD_STRING)) { - $errors[] = "The mbstring extension is overloading PHP's native string functions. Please disable it."; - } - - if (!function_exists("json_encode")) { - $errors[] = "PHP is missing the JavaScript Object Notation (JSON) extension. Please install it."; - } - - return @$errors; -} -- cgit v1.2.3 From 88c374dee8b63957b7523850508c9bd7b8c4f100 Mon Sep 17 00:00:00 2001 From: Andy Staudacher Date: Thu, 17 Sep 2009 10:01:15 -0700 Subject: Arg, fixing the "Sharing your Translations" text, thanks engineer@gmc --- modules/gallery/views/admin_languages.html.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/gallery/views/admin_languages.html.php b/modules/gallery/views/admin_languages.html.php index ab370f88..fb30c7ba 100644 --- a/modules/gallery/views/admin_languages.html.php +++ b/modules/gallery/views/admin_languages.html.php @@ -98,6 +98,6 @@ -

t("Sharing your translations")

+

-- cgit v1.2.3 From be1d49d017a71ee0967c47325986f482532a4f16 Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Thu, 17 Sep 2009 10:55:50 -0700 Subject: Change the timeout on resubmitting the next task iteration to 25ms instead of. This allows the jQuery.ajax method to complete its processing. Otherwise, the browser can spend time thrashing around trying to send the next request. --- modules/server_add/js/server_add.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/server_add/js/server_add.js b/modules/server_add/js/server_add.js index 51ef41a7..4c411715 100644 --- a/modules/server_add/js/server_add.js +++ b/modules/server_add/js/server_add.js @@ -39,7 +39,7 @@ function start_add() { success: function(data, textStatus) { $("#gStatus").html(data.status); $("#gServerAdd .gProgressBar").progressbar("value", data.percent_complete); - setTimeout(function() { run_add(data.url); }, 0); + setTimeout(function() { run_add(data.url); }, 25); } }); return false; @@ -56,7 +56,7 @@ function run_add(url) { if (data.done) { $("#gServerAddProgress").slideUp(); } else { - setTimeout(function() { run_add(url); }, 0); + setTimeout(function() { run_add(url); }, 25); } } }); -- cgit v1.2.3 From c7f8d8be6fe9e15b11ef781bdd6ed279fcb5f1a4 Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Thu, 17 Sep 2009 10:57:22 -0700 Subject: Don't try to creat an album that corresponds to the staging directory. Just add the contents of the staging directlyinto the album that server_add was invoked from. Fixes ticket #785 --- modules/server_add/controllers/server_add.php | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/modules/server_add/controllers/server_add.php b/modules/server_add/controllers/server_add.php index 26b3bd08..9769cd6f 100644 --- a/modules/server_add/controllers/server_add.php +++ b/modules/server_add/controllers/server_add.php @@ -137,17 +137,25 @@ class Server_Add_Controller extends Admin_Controller { // form [path, parent_id] where the parent_id refers to another Server_Add_File_Model. We // have this extra level of abstraction because we don't know its Item_Model id yet. $queue = $task->get("queue"); + $paths = unserialize(module::get_var("server_add", "authorized_paths")); + while ($queue && microtime(true) - $start < 0.5) { list($file, $parent_entry_id) = array_shift($queue); - $entry = ORM::factory("server_add_file"); - $entry->task_id = $task->id; - $entry->file = $file; - $entry->parent_id = $parent_entry_id; - $entry->save(); + // Ignore the staging directories as directories to be imported. + if (empty($paths[$file])) { + $entry = ORM::factory("server_add_file"); + $entry->task_id = $task->id; + $entry->file = $file; + $entry->parent_id = $parent_entry_id; + $entry->save(); + $entry_id = $entry->id; + } else { + $entry_id = null; + } foreach (glob("$file/*") as $child) { if (is_dir($child)) { - $queue[] = array($child, $entry->id); + $queue[] = array($child, $entry_id); } else { $ext = strtolower(pathinfo($child, PATHINFO_EXTENSION)); if (in_array($ext, array("gif", "jpeg", "jpg", "png", "flv", "mp4")) && @@ -155,7 +163,7 @@ class Server_Add_Controller extends Admin_Controller { $child_entry = ORM::factory("server_add_file"); $child_entry->task_id = $task->id; $child_entry->file = $child; - $child_entry->parent_id = $entry->id; + $child_entry->parent_id = $entry_id; $child_entry->save(); } } -- cgit v1.2.3 From 6469763225b1f74bc5391f09446bcf280bea389e Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Thu, 17 Sep 2009 11:10:15 -0700 Subject: Reload the album when server_add dialog is closed --- modules/server_add/views/server_add_tree_dialog.html.php | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/server_add/views/server_add_tree_dialog.html.php b/modules/server_add/views/server_add_tree_dialog.html.php index 8eb6e4df..dd4efd06 100644 --- a/modules/server_add/views/server_add_tree_dialog.html.php +++ b/modules/server_add/views/server_add_tree_dialog.html.php @@ -50,6 +50,7 @@ }); $("#gServerCloseButton").click(function(event) { $("#gDialog").dialog("close"); + window.location.reload(); }); }); -- cgit v1.2.3