diff options
Diffstat (limited to 'modules/g2_import')
-rw-r--r-- | modules/g2_import/controllers/g2.php | 9 | ||||
-rw-r--r-- | modules/g2_import/helpers/g2_import.php | 22 |
2 files changed, 22 insertions, 9 deletions
diff --git a/modules/g2_import/controllers/g2.php b/modules/g2_import/controllers/g2.php index 2c6ad1b4..d260c9b4 100644 --- a/modules/g2_import/controllers/g2.php +++ b/modules/g2_import/controllers/g2.php @@ -35,12 +35,9 @@ class G2_Controller extends Controller { $id = $input->get("g2_itemId"); if ($id) { - // Requests by id are either core.DownloadItem or - // core.ShowItem requests. - // Later versions of Gallery 2 don't specify g2_view if - // it's the default (core.ShowItem). - // And in some cases (bbcode, embedding) people are using - // the id style URLs although URL rewriting is enabled. + // Requests by id are either core.DownloadItem or core.ShowItem requests. Later versions of + // Gallery 2 don't specify g2_view if it's the default (core.ShowItem). And in some cases + // (bbcode, embedding) people are using the id style URLs although URL rewriting is enabled. $where = array(array("g2_id", "=", $id)); $view = $input->get("g2_view"); if ($view) { diff --git a/modules/g2_import/helpers/g2_import.php b/modules/g2_import/helpers/g2_import.php index f2e9dad9..c3737f8f 100644 --- a/modules/g2_import/helpers/g2_import.php +++ b/modules/g2_import/helpers/g2_import.php @@ -178,7 +178,17 @@ class g2_import_Core { "module", "rewrite", "modrewrite.embeddedLocation", $g2_embed_location)); g2($gallery->getStorage()->checkPoint()); } - self::$g2_base_url = $g2_embed_location; + + if ($g2_embed_location) { + self::$g2_base_url = $g2_embed_location; + } else { + self::$g2_base_url = $GLOBALS["gallery"]->getUrlGenerator()->generateUrl( + array(), + array("forceSessionId" => false, + "htmlEntities" => false, + "urlEncode" => false, + "useAuthToken" => false)); + } return true; } @@ -689,8 +699,7 @@ class g2_import_Core { $title = $g2_item->getTitle(); $title or $title = $g2_item->getPathComponent(); $messages[] = - t("<a href=\"%g2_url\">%title</a> from Gallery 2 could not be processed; " . - "(imported as <a href=\"%g3_url\">%title</a>)", + t("<a href=\"%g2_url\">%title</a> from Gallery 2 could not be processed; (imported as <a href=\"%g3_url\">%title</a>)", array("g2_url" => $g2_item_url, "g3_url" => $item->url(), "title" => $title)); @@ -846,6 +855,11 @@ class g2_import_Core { array("id" => $g2_comment_id, "exception" => (string)$e)); } + if (self::map($g2_comment->getId())) { + // Already imported + return; + } + $item_id = self::map($g2_comment->getParentId()); if (empty($item_id)) { // Item was not mapped. @@ -878,6 +892,8 @@ class g2_import_Core { $e); } + self::set_map($g2_comment->getId(), $comment->id, "comment"); + // Backdate the creation date. We can't do this at creation time because // Comment_Model::save() will override it. db::update("comments") |