diff options
author | Andy Staudacher <andy.st@gmail.com> | 2010-02-09 00:46:09 -0800 |
---|---|---|
committer | Andy Staudacher <andy.st@gmail.com> | 2010-02-09 00:46:09 -0800 |
commit | 42bc1279257268e2c68b5f4b06e62e95ca8228d4 (patch) | |
tree | 08943ceb9cf326db2f414c5d7204dff86442fa21 /modules/g2_import/helpers | |
parent | 992d305e19f472f53cd4adba5e6771d3116980ce (diff) |
Fix g2_import bugs related to item and user model validation.
Diffstat (limited to 'modules/g2_import/helpers')
-rw-r--r-- | modules/g2_import/helpers/g2_import.php | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/modules/g2_import/helpers/g2_import.php b/modules/g2_import/helpers/g2_import.php index 31368a5b..3b0f966a 100644 --- a/modules/g2_import/helpers/g2_import.php +++ b/modules/g2_import/helpers/g2_import.php @@ -304,7 +304,11 @@ class g2_import_Core { if ($user) { $message = t("Loaded existing user: '%name'.", array("name" => $user->name)); } else { - $user = identity::create_user($g2_user->getUsername(), $g2_user->getfullname(), ""); + $user = identity::create_user($g2_user->getUsername(), $g2_user->getfullname(), + // Note: The API expects a password in cleartext. + // Just use the hashed password as an unpredictable + // value here. The user will have to reset the password. + $g2_user->getHashedPassword(), $g2_user->getEmail()); $message = t("Created user: '%name'.", array("name" => $user->name)); } @@ -366,6 +370,7 @@ class g2_import_Core { $album->parent_id = self::map($g2_album->getParentId()); $album->name = $g2_album->getPathComponent(); $album->title = self::_decode_html_special_chars($g2_album->getTitle()); + $album->title or $album->title = $album->name; $album->description = self::_decode_html_special_chars(self::extract_description($g2_album)); $album->owner_id = self::map($g2_album->getOwnerId()); $album->view_count = g2(GalleryCoreApi::fetchItemViewCount($g2_album_id)); @@ -491,6 +496,7 @@ class g2_import_Core { $item->set_data_file($g2_path); $item->name = $g2_item->getPathComponent(); $item->title = self::_decode_html_special_chars($g2_item->getTitle()); + $item->title or $item->title = $item->name; $item->description = self::_decode_html_special_chars(self::extract_description($g2_item)); $item->owner_id = self::map($g2_item->getOwnerId()); $item->save(); @@ -512,6 +518,7 @@ class g2_import_Core { $item->set_data_file($g2_path); $item->name = $g2_item->getPathComponent(); $item->title = self::_decode_html_special_chars($g2_item->getTitle()); + $item->title or $item->title = $item->name; $item->description = self::_decode_html_special_chars(self::extract_description($g2_item)); $item->owner_id = self::map($g2_item->getOwnerId()); } catch (Exception $e) { |