Added functionality to keep privacy settings when bookmarks exported via API.
[scuttle] / api / posts_recent.php
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).
@@ -55,8 +56,14 @@ foreach ($bookmarks['bookmarks'] as $row) {
     } 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>';

Benjamin Mako Hill || Want to submit a patch?