Added functionality to keep privacy settings when bookmarks exported via API.
authorBart Lantz <bartlantz@gmail.com>
Mon, 5 Mar 2012 02:21:12 +0000 (19:21 -0700)
committerBenjamin Mako Hill <mako@atdot.cc>
Sun, 8 Apr 2012 18:18:39 +0000 (14:18 -0400)
api/posts_all.php
api/posts_get.php
api/posts_recent.php

index 0831d9fa12c55f351d39b70dce1b897ab20b96bf..747741a695b94f0bf28f01a419a7976fa1f67335 100644 (file)
@@ -45,8 +45,14 @@ foreach($bookmarks['bookmarks'] as $row) {
     } else {
         $taglist = 'system:unfiled';
     }
     } else {
         $taglist = 'system:unfiled';
     }
+    // The privacy setting in scuttle is to set bStatus to 2 in the database.
+    if(trim($row['bStatus']) == '2') {
+        $shared = "no";
+    } else {
+        $shared = "yes";
+    }
 
 
-    echo "\t<post href=\"". filter($row['bAddress'], 'xml') .'" description="'. filter($row['bTitle'], 'xml') .'" '. $description .'hash="'. md5($row['bAddress']) . ($row['bStatus'] ? '" shared="no' : '') .'" tag="'. filter($taglist, 'xml') .'" time="'. gmdate('Y-m-d\TH:i:s\Z', strtotime($row['bDatetime'])) ."\" />\r\n";
+    echo "\t<post href=\"". filter($row['bAddress'], 'xml') .'" shared="' . $shared . '" description="'. filter($row['bTitle'], 'xml') .'" '. $description .'hash="'. md5($row['bAddress']) . ($row['bStatus'] ? '" shared="no' : '') .'" tag="'. filter($taglist, 'xml') .'" time="'. gmdate('Y-m-d\TH:i:s\Z', strtotime($row['bDatetime'])) ."\" />\r\n";
 }
 
 echo '</posts>';
 }
 
 echo '</posts>';
index d54f86a4ca06f4cb9d11de46033243a4539a0e72..2c875ecdaaf770d3d56753c9738add43c1240ea6 100644 (file)
@@ -54,8 +54,14 @@ foreach ($bookmarks['bookmarks'] as $row) {
     } else {
         $taglist = 'system:unfiled';
     }
     } else {
         $taglist = 'system:unfiled';
     }
+    // The privacy setting in scuttle is to set bStatus to 2 in database.
+    if(trim($row['bStatus']) == '2') {
+        $shared = "no";
+    } else {
+        $shared = "yes";
+    }
 
 
-    echo "\t<post href=\"". filter($row['bAddress'], 'xml') .'" description="'. filter($row['bTitle'], 'xml') .'" '. $description .'hash="'. $row['bHash'] .'" others="'. $bookmarkservice->countOthers($row['bAddress']) .'" tag="'. filter($taglist, 'xml') .'" time="'. gmdate('Y-m-d\TH:i:s\Z', strtotime($row['bDatetime'])) ."\" />\r\n";
+    echo "\t<post href=\"". filter($row['bAddress'], 'xml') .'"  shared="' . $shared . '" description="'. filter($row['bTitle'], 'xml') .'" '. $description .'hash="'. $row['bHash'] .'" others="'. $bookmarkservice->countOthers($row['bAddress']) .'" tag="'. filter($taglist, 'xml') .'" time="'. gmdate('Y-m-d\TH:i:s\Z', strtotime($row['bDatetime'])) ."\" />\r\n";
 }
 
 echo '</posts>';
 }
 
 echo '</posts>';
index 476eecb3133ed89004c6ec3670f89621e593e4ff..38124d258d88d548d86e045dfe13b871707f955f 100644 (file)
@@ -1,3 +1,4 @@
+
 <?php
 // Implements the del.icio.us API request for a user's recent posts, optionally filtered by
 // tag and/or number of posts (default 15, max 100, just like del.icio.us).
 <?php
 // Implements the del.icio.us API request for a user's recent posts, optionally filtered by
 // tag and/or number of posts (default 15, max 100, just like del.icio.us).
@@ -55,8 +56,14 @@ foreach ($bookmarks['bookmarks'] as $row) {
     } else {
         $taglist = 'system:unfiled';
     }
     } else {
         $taglist = 'system:unfiled';
     }
+    // The privacy setting in scuttle is to set bStatus to 2 in the database.
+    if(trim($row['bStatus']) == '2') {
+        $shared = "no";
+    } else {
+        $shared = "yes";
+    }
 
 
-    echo "\t<post href=\"". filter($row['bAddress'], 'xml') .'" description="'. filter($row['bTitle'], 'xml') .'" '. $description .'hash="'. $row['bHash'] .'" tag="'. filter($taglist, 'xml') .'" time="'. gmdate('Y-m-d\TH:i:s\Z', strtotime($row['bDatetime'])) ."\" />\r\n";
+    echo "\t<post href=\"". filter($row['bAddress'], 'xml') .'" shared="' . $shared . '" description="'. filter($row['bTitle'], 'xml') .'" '. $description .'hash="'. $row['bHash'] .'" tag="'. filter($taglist, 'xml') .'" time="'. gmdate('Y-m-d\TH:i:s\Z', strtotime($row['bDatetime'])) ."\" />\r\n";
 }
 
 echo '</posts>';
 }
 
 echo '</posts>';

Benjamin Mako Hill || Want to submit a patch?