From 9bede5763a63bec7b1a7ea2ba9f4e8cea33087d5 Mon Sep 17 00:00:00 2001 From: Andy Staudacher Date: Sat, 6 Feb 2010 13:15:02 -0800 Subject: Fix g2_import admin screen: It wouldn't work if it didn't know the location of G2 yet. --- modules/g2_import/controllers/admin_g2_import.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'modules/g2_import') diff --git a/modules/g2_import/controllers/admin_g2_import.php b/modules/g2_import/controllers/admin_g2_import.php index 6dd155b9..f216091a 100644 --- a/modules/g2_import/controllers/admin_g2_import.php +++ b/modules/g2_import/controllers/admin_g2_import.php @@ -32,13 +32,14 @@ class Admin_g2_import_Controller extends Admin_Controller { $view = new Admin_View("admin.html"); $view->content = new View("admin_g2_import.html"); $view->content->form = $this->_get_import_form(); - $view->content->version = g2_import::version(); + $view->content->version = ''; if (g2_import::is_initialized()) { $view->content->g2_stats = $g2_stats; $view->content->g2_sizes = $g2_sizes; $view->content->thumb_size = module::get_var("gallery", "thumb_size"); $view->content->resize_size = module::get_var("gallery", "resize_size"); + $view->content->version = g2_import::version(); } g2_import::restore_error_reporting(); print $view; -- cgit v1.2.3 From d8d1155615739a9e6f1f12d4f1ce2ec7cc9cd444 Mon Sep 17 00:00:00 2001 From: Andy Staudacher Date: Sat, 6 Feb 2010 14:20:19 -0800 Subject: Fix maintenance view, which was broken when the g2_import module was installed but not configured correctly. --- modules/g2_import/helpers/g2_import_task.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'modules/g2_import') diff --git a/modules/g2_import/helpers/g2_import_task.php b/modules/g2_import/helpers/g2_import_task.php index e0212b33..2e81adef 100644 --- a/modules/g2_import/helpers/g2_import_task.php +++ b/modules/g2_import/helpers/g2_import_task.php @@ -19,14 +19,15 @@ */ class g2_import_task_Core { static function available_tasks() { + $version = ''; g2_import::lower_error_reporting(); if (g2_import::is_configured()) { g2_import::init(); + $version = g2_import::version(); } - $version = g2_import::version(); g2_import::restore_error_reporting(); - if (class_exists("GalleryCoreApi")) { + if (g2_import::is_initialized()) { return array(Task_Definition::factory() ->callback("g2_import_task::import") ->name(t("Import from Gallery 2")) -- cgit v1.2.3 From e092405fdf23412a27903227bc6d2f422f4e9f2d Mon Sep 17 00:00:00 2001 From: Andy Staudacher Date: Sat, 6 Feb 2010 14:59:28 -0800 Subject: Fix g2 redirect to use external redirect (and declare it as permanent). Redirects weren't working for me in Firefox 3.5 when not signed into G3 (and all items are public). --- modules/g2_import/views/admin_g2_import.html.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'modules/g2_import') diff --git a/modules/g2_import/views/admin_g2_import.html.php b/modules/g2_import/views/admin_g2_import.html.php index 6a5214a3..41ef7f85 100644 --- a/modules/g2_import/views/admin_g2_import.html.php +++ b/modules/g2_import/views/admin_g2_import.html.php @@ -103,7 +103,7 @@ <IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase
- RewriteRule ^(.*)$ [QSA,L]
+ RewriteRule ^(.*)$ [QSA,L,R=301]
</IfModule>
-- cgit v1.2.3 From d069155228acb9c9e86814a89cb2400434d18321 Mon Sep 17 00:00:00 2001 From: Andy Staudacher Date: Sat, 6 Feb 2010 15:08:10 -0800 Subject: Fix g2 redirects for non-admins. The g2 URL mapping controller was accidentally declared as admin controller. (The previous attempt to fix this isn't a bad change either, thus keeping the external permenant redirect). --- modules/g2_import/controllers/g2.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'modules/g2_import') diff --git a/modules/g2_import/controllers/g2.php b/modules/g2_import/controllers/g2.php index 5fd4400c..70461600 100644 --- a/modules/g2_import/controllers/g2.php +++ b/modules/g2_import/controllers/g2.php @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -class G2_Controller extends Admin_Controller { +class G2_Controller extends Controller { /** * Redirect Gallery 2 urls to their appropriate matching Gallery 3 url. * -- cgit v1.2.3 From 33b39efb491d730c8653ca3c06a22297338aa8b8 Mon Sep 17 00:00:00 2001 From: Andy Staudacher Date: Sat, 6 Feb 2010 15:46:13 -0800 Subject: Add core.DownloadItem redirect for G2's Photo and Movie items (was previously omitted, but we already had core.DownloadItem redirects for derivatives) --- modules/g2_import/controllers/g2.php | 1 + modules/g2_import/helpers/g2_import.php | 4 ++++ 2 files changed, 5 insertions(+) (limited to 'modules/g2_import') diff --git a/modules/g2_import/controllers/g2.php b/modules/g2_import/controllers/g2.php index 70461600..8260cf9f 100644 --- a/modules/g2_import/controllers/g2.php +++ b/modules/g2_import/controllers/g2.php @@ -64,6 +64,7 @@ class G2_Controller extends Controller { case "resize": url::redirect($item->resize_url(true)); + case "file": case "full": url::redirect($item->file_url(true)); diff --git a/modules/g2_import/helpers/g2_import.php b/modules/g2_import/helpers/g2_import.php index 0fcc0539..f13c63b1 100644 --- a/modules/g2_import/helpers/g2_import.php +++ b/modules/g2_import/helpers/g2_import.php @@ -541,6 +541,10 @@ class g2_import_Core { $item->save(); self::set_map($g2_item_id, $item->id, "item", $g2_item_url); + + self::set_map($g2_item_id, $item->id, "file", + self::g2_url(array("view" => "core.DownloadItem", "itemId" => $g2_item_id))); + $derivatives = g2(GalleryCoreApi::fetchDerivativesByItemIds(array($g2_item_id))); if (!empty($derivatives[$g2_item_id])) { foreach ($derivatives[$g2_item_id] as $derivative) { -- cgit v1.2.3