Fix bug #109: preserve privacy setting from Delicious export files.

Thanks for David Glenck for the initial version of this patch.
This commit is contained in:
Christian Weiske 2013-03-18 22:18:09 +01:00
parent a67a7f761d
commit 943d149e31

View file

@ -67,6 +67,8 @@ if ($userservice->isLoggedOn() && sizeof($_FILES) > 0 && $_FILES['userfile']['si
$bDatetime = ""; //bDateTime optional $bDatetime = ""; //bDateTime optional
$bCategories = ""; //bCategories optional $bCategories = ""; //bCategories optional
$bPrivateNote = ""; //bPrivateNote optional
$bPrivate = $status; //bPrivate set default
foreach ($attributes[0] as $attribute) { foreach ($attributes[0] as $attribute) {
$att = preg_split('/\s*=\s*/s', $attribute, 2); $att = preg_split('/\s*=\s*/s', $attribute, 2);
@ -86,6 +88,11 @@ if ($userservice->isLoggedOn() && sizeof($_FILES) > 0 && $_FILES['userfile']['si
break; break;
case "NOTE": case "NOTE":
$bPrivateNote = $attrVal; $bPrivateNote = $attrVal;
break;
case "PRIVATE":
if ($attrVal) {
$bPrivate = 2;//private
}
} }
} }
$bTitle = trim($titles[$i]); $bTitle = trim($titles[$i]);
@ -102,7 +109,7 @@ if ($userservice->isLoggedOn() && sizeof($_FILES) > 0 && $_FILES['userfile']['si
$bDatetime = gmdate('Y-m-d H:i:s'); $bDatetime = gmdate('Y-m-d H:i:s');
} }
if ($bookmarkservice->addBookmark($bAddress, $bTitle, $bDescription, $bPrivateNote, $status, $bCategories, null, $bDatetime, false, true)) { if ($bookmarkservice->addBookmark($bAddress, $bTitle, $bDescription, $bPrivateNote, $bPrivate, $bCategories, null, $bDatetime, false, true)) {
$countImportedBookmarks++; $countImportedBookmarks++;
} else { } else {
$tplVars['error'] = T_('There was an error saving your bookmark. Please try again or contact the administrator.'); $tplVars['error'] = T_('There was an error saving your bookmark. Please try again or contact the administrator.');