diff options
-rw-r--r-- | modules/g2_import/controllers/admin_g2_import.php | 18 | ||||
-rw-r--r-- | modules/g2_import/helpers/g2_import.php | 34 | ||||
-rw-r--r-- | modules/g2_import/views/admin_g2_import.html.php | 5 | ||||
-rw-r--r-- | modules/gallery/controllers/quick.php | 4 |
4 files changed, 30 insertions, 31 deletions
diff --git a/modules/g2_import/controllers/admin_g2_import.php b/modules/g2_import/controllers/admin_g2_import.php index 968d97cd..f2969f49 100644 --- a/modules/g2_import/controllers/admin_g2_import.php +++ b/modules/g2_import/controllers/admin_g2_import.php @@ -44,20 +44,13 @@ class Admin_g2_import_Controller extends Admin_Controller { $form = $this->_get_import_form(); if ($form->validate()) { $embed_path = $form->configure_g2_import->embed_path->value; - $multi_path = $form->configure_g2_import->multi_path->value; - if (!is_file($embed_path) && file_exists("$embed_path/embed.php")) { $embed_path = "$embed_path/embed.php"; } - - if (!empty($multi_path) && !is_file($multi_path) && file_exists("$multi_path/config.php")) { - $multi_path = "$multi_path/embed.php"; - } - if (g2_import::is_valid_embed_path($embed_path, $multi_path)) { + if (g2_import::is_valid_embed_path($embed_path)) { message::success("Gallery 2 path saved."); module::set_var("g2_import", "embed_path", $embed_path); - module::set_var("g2_import", "multi_path", $multi_path); url::redirect("admin/g2_import"); } else { $form->configure_g2_import->embed_path->add_error("invalid", 1); @@ -74,16 +67,11 @@ class Admin_g2_import_Controller extends Admin_Controller { $form = new Forge( "admin/g2_import/save", "", "post", array("id" => "gAdminConfigureG2ImportForm")); $group = $form->group("configure_g2_import")->label(t("Configure Gallery 2 Import")); - $group->input("embed_path")->label(t("Filesystem path to your Gallery 2 embed.php file (in case of multisite config, use the path to the 'master')")) + $group->input("embed_path")->label(t("Filesystem path to your Gallery 2 embed.php file")) ->value(module::get_var("g2_import", "embed_path", "")); - - $group->input("multi_path")->label(t("Filesystem path to your Gallery 2 multisite instance config (leave empty if not applicable)")) - ->value(module::get_var("g2_import", "multi_path", "")); - $group->embed_path->error_messages( "invalid", t("The path you entered is not a Gallery 2 installation.")); - $group->submit("")->value(t("Save")); return $form; } -} +}
\ No newline at end of file diff --git a/modules/g2_import/helpers/g2_import.php b/modules/g2_import/helpers/g2_import.php index 33cfc158..19d02f25 100644 --- a/modules/g2_import/helpers/g2_import.php +++ b/modules/g2_import/helpers/g2_import.php @@ -37,24 +37,22 @@ class g2_import_Core { } $embed_path = module::get_var("g2_import", "embed_path"); - $multi_path = module::get_var("g2_import", "multi_path"); - if (empty($embed_path)) { throw new Exception("@todo G2_IMPORT_NOT_CONFIGURED"); } - g2_import::$init = g2_import::init_embed($embed_path, $multi_path); + g2_import::$init = g2_import::init_embed($embed_path); } - static function is_valid_embed_path($embed_path, $multi_path) { - return file_exists($embed_path) && (empty($multi_path) || file_exists($multi_path)) && g2_import::init_embed($embed_path, $multi_path); + static function is_valid_embed_path($embed_path) { + return file_exists($embed_path) && g2_import::init_embed($embed_path); } /** * Initialize the embedded Gallery2 instance. Call this before any other Gallery2 calls. */ - static function init_embed($embed_path, $multi_path) { - if (!is_file($embed_path) && (empty($multi_path) || is_dir($multi_path))) { + static function init_embed($embed_path) { + if (!is_file($embed_path)) { return false; } @@ -71,11 +69,17 @@ class g2_import_Core { @dir::unlink($mod_path); mkdir($mod_path); - $base_dir = dirname($embed_path); - if (!empty($multi_path)) - $config_dir = dirname($multi_path); - else - $config_dir = $base_dir; + $config_dir = dirname($embed_path); + if (filesize($embed_path) > 200) { + // Regular install + $base_dir = $config_dir; + } else { + // Multisite install. Line 2 of embed.php will be something like: + // require('/usr/home/bharat/public_html/gallery2/embed.php'); + $lines = file($embed_path); + preg_match("#require\('(.*)/embed.php'\);#", $lines[2], $matches); + $base_dir = $matches[1]; + } file_put_contents( "$mod_path/embed.php", @@ -107,11 +111,13 @@ class g2_import_Core { array("require_once(dirname(__FILE__) . '/modules/core/classes/Gallery.class');", "require_once(dirname(__FILE__) . '/modules/core/classes/GalleryDataCache.class');", "define('GALLERY_CONFIG_DIR', dirname(__FILE__));", - "\$gallery =& new Gallery();"), + "\$gallery =& new Gallery();", + "\$gallery = new Gallery();"), array("require_once(dirname(__FILE__) . '/Gallery.class');", "require_once('$base_dir/modules/core/classes/GalleryDataCache.class');", "define('GALLERY_CONFIG_DIR', '$config_dir');", - "\$gallery =& new G2_Gallery();"), + "\$gallery =& new G2_Gallery();", + "\$gallery = new G2_Gallery();"), array_merge(array("<?php defined(\"SYSPATH\") or die(\"No direct script access.\") ?>\n"), file("$base_dir/bootstrap.inc")))); diff --git a/modules/g2_import/views/admin_g2_import.html.php b/modules/g2_import/views/admin_g2_import.html.php index c0ee2b17..d5e29e12 100644 --- a/modules/g2_import/views/admin_g2_import.html.php +++ b/modules/g2_import/views/admin_g2_import.html.php @@ -3,7 +3,10 @@ <h1> <?= t("Gallery 2 Import") ?> </h1> <p> <?= t("Import your Gallery 2 users, photos, movies, comments and tags into your new Gallery 3 installation.") ?> - <?= t("<b>Note: The importer is a work in progress and does not currently support permissions, and movie formats other than Flash video and MP4</b>") ?> + <br/> + <?= t("<b>Note</b>: The importer is a work in progress and does not currently support permissions, and movie formats other than Flash video and MP4") ?> + <br/> + <?= t("<b>Note</b>: The importer has <i>known issues</i> with the eAccelerator PHP accelerator. If you're using eAccelerator, please disable it. One way to do that is to put <code>php_value eaccelerator.enable 0</code> in gallery3/.htaccess") ?> </p> <?= $form ?> </div> diff --git a/modules/gallery/controllers/quick.php b/modules/gallery/controllers/quick.php index 30383307..cff6686b 100644 --- a/modules/gallery/controllers/quick.php +++ b/modules/gallery/controllers/quick.php @@ -101,7 +101,9 @@ class Quick_Controller extends Controller { access::required("edit", $item); if ($item->is_album()) { - print t("Delete the album <b>%title</b>? All items within the album will also be deleted.", array("title" => $item->title)); + print t( + "Delete the album <b>%title</b>? All photos and movies in the album will also be deleted.", + array("title" => $item->title)); } else { print t("Are you sure you want to delete <b>%title</b>?", array("title" => $item->title)); } |