]> gitweb.fluxo.info Git - semanticscuttle.git/commitdiff
Fix bug #109: preserve privacy setting from Delicious export files.
authorChristian Weiske <cweiske@cweiske.de>
Mon, 18 Mar 2013 21:18:09 +0000 (22:18 +0100)
committerChristian Weiske <cweiske@cweiske.de>
Mon, 18 Mar 2013 22:06:41 +0000 (23:06 +0100)
Thanks for David Glenck for the initial version of this patch.

www/importNetscape.php

index b476c40c53b4b6247a077ccb28223219ff52eeda..a014b95513f5a6656eac236429b9173b5d539abb 100644 (file)
@@ -67,6 +67,8 @@ if ($userservice->isLoggedOn() && sizeof($_FILES) > 0 && $_FILES['userfile']['si
 
                $bDatetime = ""; //bDateTime optional
                $bCategories = ""; //bCategories optional
+               $bPrivateNote = ""; //bPrivateNote optional
+               $bPrivate = $status; //bPrivate set default
 
                foreach ($attributes[0] as $attribute) {
                        $att = preg_split('/\s*=\s*/s', $attribute, 2);
@@ -86,6 +88,11 @@ if ($userservice->isLoggedOn() && sizeof($_FILES) > 0 && $_FILES['userfile']['si
                                        break;
                                case "NOTE":
                                        $bPrivateNote = $attrVal;
+                                       break;
+                               case "PRIVATE":
+                                       if ($attrVal) {
+                                               $bPrivate = 2;//private
+                                       }
                        }
                }
                $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');
                                }
 
-                               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++;
                                } else {
                                        $tplVars['error'] = T_('There was an error saving your bookmark. Please try again or contact the administrator.');