]> gitweb.fluxo.info Git - semanticscuttle.git/commitdiff
import state of version 0.97.1 v0.97.1
authorChristian Weiske <cweiske@cweiske.de>
Mon, 14 Feb 2011 17:02:07 +0000 (18:02 +0100)
committerChristian Weiske <cweiske@cweiske.de>
Mon, 14 Feb 2011 17:02:07 +0000 (18:02 +0100)
build.xml
doc/ChangeLog
src/SemanticScuttle/Service/Bookmark.php
tests/AllTests.php
www/api/posts_delete.php

index c1db166f16c6c1a7371927bfcfd0ed71c330c51e..3c04907e6b103e71be2b7fdb67f6cfcdf5641a70 100644 (file)
--- a/build.xml
+++ b/build.xml
@@ -9,7 +9,7 @@
   <property file="build.properties" />
 
   <property name="version-m"  value="0.97" />
-  <property name="version"    value="0.97.0" />
+  <property name="version"    value="0.97.1" />
   <property name="zipfile"    value="${phing.project.name}-${version}.zip" />
   <property name="distfile"   value="dist/${zipfile}" />
   <property name="sfproject"  value="SemanticScuttle" />
@@ -99,4 +99,4 @@
     <fail unless="sffilepath" message="Sourceforge project file path not defined!" />
   </target>
 
-</project>
\ No newline at end of file
+</project>
index 5b4e4d3fa73a5073f99b6fb1b53589e56a870fdc..92898c472ef04da06826a9c79ab0ecd19aea52e8 100644 (file)
@@ -1,6 +1,14 @@
 ChangeLog for SemantiScuttle
 ============================
 
+0.97.1 - 2010-09-30
+-------------------
+This is a security release! We do highly recommend to update
+your SemanticScuttle installations!
+
+- Fix bug #3077187: Permission problem when deleting bookmarks
+
+
 0.97.0 - 2010-06-09
 -------------------
 - Many SQL optimizations - SemanticScuttle shows bookmarks 4 times faster now
index 364b1a08f43fa013236c65ec67eaabf30e03992e..97e0d8f06c097ff65f14fd9e77dff23ba80d27e0 100644 (file)
@@ -168,7 +168,10 @@ class SemanticScuttle_Service_Bookmark extends SemanticScuttle_DbService
      * Retrieves a bookmark with the given URL.
      * DOES NOT RESPECT PRIVACY SETTINGS!
      *
-     * @param string $hash URL
+     * @param string  $address URL to get bookmarks for
+     * @param boolean $all     Retrieve from all users (true)
+     *                         or only bookmarks owned by the current
+     *                         user (false)
      *
      * @return mixed Array with bookmark data or false in case
      *               of an error (i.e. not found).
@@ -176,9 +179,9 @@ class SemanticScuttle_Service_Bookmark extends SemanticScuttle_DbService
      * @uses getBookmarkByHash()
      * @see  getBookmarkByShortname()
      */
-    public function getBookmarkByAddress($address)
+    public function getBookmarkByAddress($address, $all = true)
     {
-        return $this->getBookmarkByHash($this->getHash($address));
+        return $this->getBookmarkByHash($this->getHash($address), $all);
     }
 
 
@@ -187,16 +190,19 @@ class SemanticScuttle_Service_Bookmark extends SemanticScuttle_DbService
      * Retrieves a bookmark with the given hash.
      * DOES NOT RESPECT PRIVACY SETTINGS!
      *
-     * @param string $hash URL hash
+     * @param string  $hash URL hash
+     * @param boolean $all  Retrieve from all users (true)
+     *                      or only bookmarks owned by the current
+     *                      user (false)
      *
      * @return mixed Array with bookmark data or false in case
      *               of an error (i.e. not found).
      *
      * @see getHash()
      */
-    public function getBookmarkByHash($hash)
+    public function getBookmarkByHash($hash, $all = true)
     {
-        return $this->_getbookmark('bHash', $hash, true);
+        return $this->_getbookmark('bHash', $hash, $all);
     }
 
 
index d29de7f70bba7238fd8d1202c9650fc8ab866298..126604141be9ef223a6e6971e63f8e9efa0a4a9f 100644 (file)
@@ -64,6 +64,7 @@ class AllTests extends PHPUnit_Framework_TestSuite
         $suite->addTestFile($tdir . '/TagTest.php');
         $suite->addTestFile($tdir . '/VoteTest.php');
         $suite->addTestFile($tdir . '/UserTest.php');
+        $suite->addTestFile($tdir . '/Api/PostsDeleteTest.php');
         return $suite;
     }
 
index a63cc62485ee0884e73d44fd4d42336a928ad000..69b242959354b2ef6a2d0017029cae1d3e4d2a9b 100644 (file)
@@ -1,33 +1,57 @@
 <?php
-// Implements the del.icio.us API request to delete a post.
-
-// del.icio.us behavior:
-// - returns "done" even if the bookmark doesn't exist;
-// - does NOT allow the hash for the url parameter;
-// - doesn't set the Content-Type to text/xml (we do).
+/**
+ * API for deleting a bookmark.
+ * The delicious API is implemented here.
+ *
+ * The delicious API behaves like that:
+ * - does NOT allow the hash for the url parameter
+ * - doesn't set the Content-Type to text/xml
+ *   - we do it correctly, too
+ *
+ * SemanticScuttle - your social bookmark manager.
+ *
+ * PHP version 5.
+ *
+ * @category Bookmarking
+ * @package  SemanticScuttle
+ * @author   Benjamin Huynh-Kim-Bang <mensonge@users.sourceforge.net>
+ * @author   Christian Weiske <cweiske@cweiske.de>
+ * @author   Eric Dane <ericdane@users.sourceforge.net>
+ * @license  GPL http://www.gnu.org/licenses/gpl.html
+ * @link     http://sourceforge.net/projects/semanticscuttle
+ * @link     http://www.delicious.com/help/api
+ */
 
 // Force HTTP authentication first!
 $httpContentType = 'text/xml';
 require_once 'httpauth.inc.php';
 
-/* Service creation: only useful services are created */
-$bookmarkservice =SemanticScuttle_Service_Factory::get('Bookmark');
-
+$bs  = SemanticScuttle_Service_Factory::get('Bookmark');
+$uId = $userservice->getCurrentUserId();
 
-// Note that del.icio.us only errors out if no URL was passed in; there's no error on attempting
-// to delete a bookmark you don't have.
 
 // Error out if there's no address
-if (is_null($_REQUEST['url'])) {
-    $deleted = false;
+if (!isset($_REQUEST['url'])
+    || $_REQUEST['url'] == ''
+) {
+    $msg = 'something went wrong';
+} else if (!$bs->bookmarkExists($_REQUEST['url'], $uId)) {
+    //the user does not have such a bookmark
+    header('HTTP/1.0 404 Not Found');
+    $msg = 'item not found';
 } else {
-    $bookmark = $bookmarkservice->getBookmarkByAddress($_REQUEST['url']);
-    $bid = $bookmark['bId'];
-    $delete = $bookmarkservice->deleteBookmark($bid);
-    $deleted = true;
+    $bookmark = $bs->getBookmarkByAddress($_REQUEST['url'], false);
+    $bId      = $bookmark['bId'];
+    $deleted  = $bs->deleteBookmark($bId);
+    $msg      = 'done';
+    if (!$deleted) {
+        //something really went wrong
+        header('HTTP/1.0 500 Internal Server Error');
+        $msg = 'something really went wrong';
+    }
 }
 
 // Set up the XML file and output the result.
-echo '<?xml version="1.0" standalone="yes" ?'.">\r\n";
-echo '<result code="'. ($deleted ? 'done' : 'something went wrong') .'" />';
+echo '<?xml version="1.0" standalone="yes" ?' . ">\r\n";
+echo '<result code="' . $msg . '" />';
 ?>
\ No newline at end of file