diff options
author | Bharat Mediratta <bharat@menalto.com> | 2010-11-28 17:01:51 -0800 |
---|---|---|
committer | Bharat Mediratta <bharat@menalto.com> | 2010-11-28 17:01:51 -0800 |
commit | a36c894c636bfb70f0921aa6c7eb9393d61d772b (patch) | |
tree | ce170f4b18ad7e24d53ea86d321416c1990e87d3 /modules/g2_import | |
parent | 5fb5d10e5aece1726575b8afbac2f7603ea7632e (diff) |
Fix g2_import::g2_url() to only replace the $g2_base_url once at the
beginning of the url string. Also, only do this when we're about to
put it into the map, not when we're getting the g2 url else the url is
mangled for other purposes. Fixes #1512.
Diffstat (limited to 'modules/g2_import')
-rw-r--r-- | modules/g2_import/helpers/g2_import.php | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/modules/g2_import/helpers/g2_import.php b/modules/g2_import/helpers/g2_import.php index 678dac3b..8de5ce44 100644 --- a/modules/g2_import/helpers/g2_import.php +++ b/modules/g2_import/helpers/g2_import.php @@ -1200,6 +1200,11 @@ class g2_import_Core { $g2_map->g3_id = $g3_id; $g2_map->g2_id = $g2_id; $g2_map->resource_type = $resource_type; + + if (strpos($g2_url, self::$g2_base_url) === 0) { + $g2_url = substr($g2_url, strlen(self::$g2_base_url)); + } + $g2_map->g2_url = $g2_url; $g2_map->save(); self::$map[$g2_id] = $g3_id; @@ -1212,13 +1217,12 @@ class g2_import_Core { static function g2_url($params) { global $gallery; - $url = $gallery->getUrlGenerator()->generateUrl( + return $gallery->getUrlGenerator()->generateUrl( $params, array("forceSessionId" => false, "htmlEntities" => false, "urlEncode" => false, "useAuthToken" => false)); - return str_replace(self::$g2_base_url, "", $url); } static function lower_error_reporting() { |