Compare commits

...

10 Commits
master ... 0.97

Author SHA1 Message Date
Christian Weiske
b2687abf91 Fix bug #3065284: AjaxVote problem with Webkit browsers
Conflicts:

	doc/ChangeLog
2011-02-16 08:50:30 +01:00
Christian Weiske
e4d2d0ba2f remove svntag task from build file since we do not have svn anymore 2011-02-16 00:38:19 +01:00
Christian Weiske
128eb20408 prepare release of 0.97.2 by updating versions and setting the release date 2011-02-16 00:16:33 +01:00
Christian Weiske
8d178085f4 unittests run with phpunit 3.5.x, upgrade changelog 2011-02-16 00:14:01 +01:00
Christian Weiske
8fb9a4b743 make unittests run with phpunit 3.5.x 2011-02-16 00:12:08 +01:00
Christian Weiske
2407385965 Fix bug #3073215: Updating bookmark time does not work
git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@745 b3834d28-1941-0410-a4f8-b48e95affb8f
(cherry picked from commit b17e8f940c)

Conflicts:

	doc/ChangeLog
2011-02-15 07:59:02 +01:00
Christian Weiske
17e097d4f8 Fix bug #3111254: Search in my_watchlist results in error
(cherry picked from commit 5a8327be1d)

Conflicts:

	doc/ChangeLog
2011-02-15 07:55:10 +01:00
Christian Weiske
60814a1bd3 Fix bug #3074816: French translation breaks edit javascript
Also fixes #3094047 and #3178592

git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@757 b3834d28-1941-0410-a4f8-b48e95affb8f
(cherry picked from commit f0456530b4)

Conflicts:

	doc/ChangeLog
2011-02-15 07:49:58 +01:00
Christian Weiske
67db678292 merge fix from master 2011-02-14 18:16:56 +01:00
Christian Weiske
8365c4d11a import state of version 0.97.1 2011-02-14 18:02:07 +01:00
13 changed files with 142 additions and 64 deletions

View File

@ -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.2" />
<property name="zipfile" value="${phing.project.name}-${version}.zip" />
<property name="distfile" value="dist/${zipfile}" />
<property name="sfproject" value="SemanticScuttle" />
@ -48,7 +48,7 @@
<target name="release" depends="check,zip,deploy-sf,svntag"
<target name="release" depends="check,zip,deploy-sf"
description="Release the version on sourceforge"
>
<!-- meta-target -->
@ -80,16 +80,6 @@
</target>
<target name="svntag"
description="create the svn tag for the current version"
>
<exec
command="svn cp ${svnpath}trunk ${svnpath}/tags/${version} -m 'tag version ${version}'"
escape="false" checkreturn="true"
/>
</target>
<target name="check"
description="Check variables"
>
@ -99,4 +89,4 @@
<fail unless="sffilepath" message="Sourceforge project file path not defined!" />
</target>
</project>
</project>

View File

@ -17,7 +17,7 @@ $this->includeTemplate($GLOBALS['top_include']);
<?php if(!is_null($currentUser) && $currentUser->isAdmin()): ?>
<li>SemanticScuttle v0.97.0</li>
<li>SemanticScuttle v0.97.2</li>
<?php endif ?>
</ul>

View File

@ -140,14 +140,26 @@ if (empty($_REQUEST['popup']) && (!isset($showdelete) || !$showdelete)) {
<p>
<script type="text/javascript">
var browser=navigator.appName;
if (browser == "Opera")
{
document.write('<?php echo sprintf(T_("Click one of the following bookmarklets to add a button you can click whenever you want to add the page you are on to %s"), jsEscTitle($GLOBALS['sitename'])); ?>:</p>');
}
else
{
document.write('<?php echo sprintf(T_("Drag one of the following bookmarklets to your browser's bookmarks and click it whenever you want to add the page you are on to %s"), jsEscTitle($GLOBALS['sitename'])); ?>:</p>');
}
if (browser == "Opera") {
document.write(
<?php echo json_encode(
sprintf(
T_("Click one of the following bookmarklets to add a button you can click whenever you want to add the page you are on to %s"),
$GLOBALS['sitename']
)
); ?> + ':</p>'
);
} else {
document.write(
<?php echo json_encode(
sprintf(
T_("Drag one of the following bookmarklets to your browser's bookmarks and click it whenever you want to add the page you are on to %s"),
$GLOBALS['sitename']
)
);
?> + ':</p>'
);
}
var selection = '';
if (window.getSelection) {
selection = 'window.getSelection()';

View File

@ -1,6 +1,25 @@
ChangeLog for SemantiScuttle
============================
0.97.2 - 2011-02-17
-------------------
- Fix bug #3178597: Broken link to context in gsearch admin index page
- Fix bug #3074816: French translation breaks edit javascript
This also fixes #3094047 and #3178592
- Fix bug #3111254: Search in my_watchlist results in error
- Fix bug #3073215: Updating bookmark time does not work
- Make Unittests run with phpunit 3.5.x
- Fix bug #3065284: AjaxVote problem with Webkit browsers
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

View 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);
}
@ -611,7 +617,7 @@ class SemanticScuttle_Service_Bookmark extends SemanticScuttle_DbService
if (!is_null($date)) {
$datetime = gmdate('Y-m-d H:i:s', strtotime($date));
$updates[] = array('bDateTime' => $datetime);
$updates['bDatetime'] = $datetime;
}
$sql = 'UPDATE '. $GLOBALS['tableprefix'] .'bookmarks SET '. $this->db->sql_build_array('UPDATE', $updates) .' WHERE bId = '. intval($bId);

View File

@ -356,7 +356,7 @@ class SemanticScuttle_Service_User extends SemanticScuttle_DbService
public function getCurrentUserId()
{
if (isset($_SESSION[$this->getSessionKey()])) {
return $_SESSION[$this->getSessionKey()];
return (int)$_SESSION[$this->getSessionKey()];
} else if (isset($_COOKIE[$this->getCookieKey()])) {
$cook = split(':', $_COOKIE[$this->getCookieKey()]);
@ -377,10 +377,10 @@ class SemanticScuttle_Service_User extends SemanticScuttle_DbService
if ($row = $this->db->sql_fetchrow($dbresult)) {
$this->setCurrentUserId(
$row[$this->getFieldName('primary')]
(int)$row[$this->getFieldName('primary')]
);
$this->db->sql_freeresult($dbresult);
return $_SESSION[$this->getSessionKey()];
return (int)$_SESSION[$this->getSessionKey()];
}
}
return false;

View File

@ -17,9 +17,6 @@ if (!defined('PHPUnit_MAIN_METHOD')) {
}
require_once 'prepare.php';
require_once 'PHPUnit/Framework/TestSuite.php';
PHPUnit_Util_Filter::addFileToFilter(__FILE__);
/**
* SemanticScuttle unit tests.
@ -64,6 +61,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;
}

View File

@ -982,6 +982,38 @@ class BookmarkTest extends TestBase
$this->assertEquals('newShortNambb', $bm['bShort']);
}
/**
* Tests if updating a bookmark's date works.
* This once was a bug, see bug #3073215.
*
* @return void
*
* @link https://sourceforge.net/tracker/?func=detail&atid=1017430&aid=3073215&group_id=211356
*/
public function testUpdateBookmarkDate()
{
$bid = $this->bs->addBookmark(
'http://example.org', 'title', 'desc', 'priv',
0, array(), 'myShortName'
);
$bm = $this->bs->getBookmark($bid);
$this->assertEquals('myShortName', $bm['bShort']);
$this->assertTrue(
$this->bs->updateBookmark(
$bid, 'http://example2.org', 'my title', 'desc',
'priv', 0, array(), 'newShortNambb',
//we need to use zulu (GMT) time zone here
// since the dates/times are stored as that
// in the database
'2002-03-04T05:06:07Z'
)
);
$bm = $this->bs->getBookmark($bid);
$this->assertEquals('newShortNambb', $bm['bShort']);
$this->assertEquals('2002-03-04 05:06:07', $bm['bDatetime']);
}
/**

View File

@ -11,10 +11,6 @@
* @link http://sourceforge.net/projects/semanticscuttle
*/
require_once 'PHPUnit/Framework.php';
PHPUnit_Util_Filter::addFileToFilter(__FILE__);
/**
* Base unittest class that provides several helper methods.
*

View File

@ -11,10 +11,6 @@
* @link http://sourceforge.net/projects/semanticscuttle
*/
require_once 'PHPUnit/Framework.php';
PHPUnit_Util_Filter::addFileToFilter(__FILE__);
/**
* Base unittest class for web API tests.
*

View 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 . '" />';
?>

View File

@ -31,7 +31,9 @@ if($GLOBALS['enableGoogleCustomSearch']==false) {
echo '<p><small>';
echo T_('Admin tips: ');
echo T_('To refresh manually Google Custom Search Engine, goes to: ');
echo '<a href="http://www.google.com/coop/cse/cref?cref='.ROOT.'search/context.php">http://www.google.com/coop/cse/cref</a><br/>';
echo '<a href="http://www.google.com/coop/cse/cref?cref='
. ROOT . 'gsearch/context.php">http://www.google.com/coop/cse/cref</a>'
. '<br/>';
echo T_('If no result appears, check that all the urls are valid in the admin section.');
echo '</small></p>';

View File

@ -155,7 +155,10 @@ function processVotingResult() {
var bmnode = document.getElementById('bmv-'+bookmark);
bmnode.parentNode.replaceChild(
response.getElementsByTagName('html')[0].firstChild,
xmlhttp.responseXML.importNode(
response.getElementsByTagName('html')[0].firstChild,
true
),
bmnode
);
}