Merge branch '0.98'

This commit is contained in:
Christian Weiske 2011-08-06 10:38:44 +02:00
commit d2e437b4db
10 changed files with 106 additions and 7 deletions

View file

@ -81,13 +81,15 @@ $theme = 'default';
/**
* SemanticScuttle root directory.
*
* Set to NULL to autodetect the root url of the website.
*
* If your installation is in a subdirectory like
* "http://www.example.com/semanticscuttle/" then
* replace NULL by your address (between "" and with trailing '/')
*
* The autodetection works for both HTTP and HTTPS urls.
* If you offer HTTP *only*, then set your root url here.
*
* @var string
*/
$root = null;

View file

@ -28,7 +28,6 @@ window.onload = function() {
</tr>
</table>
</p>
<?php if (isset($referrer)): ?>
<div><input type="hidden" name="referrer" value="<?php echo $referrer; ?>" /></div>

View file

@ -3,6 +3,16 @@ ChangeLog for SemantiScuttle
.. contents::
0.98.2 - 2011-08-XX
-------------------
- Fix bug #3385724: Rename tag ends with XML Parsing Error
- Fix bug #3386178: "system:unfiled" secret tag does not work
- Fix bug #3384416: Update documentation to explain HTTP/HTTPS root problem
Run ``scripts/fix-unfiled-tags.php`` to fix old bookmarks that miss the
``system:unfiled`` tags.
0.98.1 - 2011-08-01
-------------------
- Fix bug #3375635: XML parsing problem in top.inc.php

View file

@ -4,6 +4,12 @@ Upgrading SemanticScuttle from a previous version
.. contents::
From version 0.94-0.98.1 to 0.98.2
==================================
Run ``scripts/fix-unfiled-tags.php`` to fix old bookmarks that miss the
``system:unfiled`` tags.
From version 0.97 to 0.98
=========================
Database updates

View file

@ -2,6 +2,8 @@
Configuration files
===================
.. contents::
SemanticScuttle uses at least two configuration files:
1. Default configuration file ``config.default.php``
@ -56,3 +58,24 @@ per-host configuration files:
- ``data/config.$hostname.php``
- ``/etc/semanticscuttle/config.$hostname.php``
Configuration options
=====================
``$root`` URL
-------------
Normally, this configuration setting is detected automatically and will
work for both HTTP and HTTPS installations.
If your installation is available on **HTTP only**, then you need to configure
it.
The value is the full URL to your installation, including a trailing
slash::
$root = "http://homepage.example.org/semanticscuttle/";
or::
$root = "http://bookmarks.example.org/";

View file

@ -0,0 +1,35 @@
<?php
/**
* SemanticScuttle from approximately 0.94 up to 0.98.2, system:unfiled
* tags were not created when adding new bookmarks with the web interface.
*
* This script adds system:unfiled tags for all bookmarks that have no
* tags.
*/
require_once dirname(__FILE__) . '/../src/SemanticScuttle/header-standalone.php';
//needed to load the database object
$bt = SemanticScuttle_Service_Factory::get('Bookmark2Tag');
$db = SemanticScuttle_Service_Factory::getDb();
$query = <<<SQL
SELECT b.bId
FROM sc_bookmarks AS b
LEFT JOIN sc_bookmarks2tags AS bt ON b.bId = bt.bId
WHERE bt.bId IS NULL
SQL;
if (!($dbresult = $db->sql_query($query))) {
die('Strange SQL error');
}
while ($row = $db->sql_fetchrow($dbresult)) {
$db->sql_query(
'INSERT INTO ' . $bt->getTableName() . ' '
. $db->sql_build_array(
'INSERT',
array('bId' => $row['bId'], 'tag' => 'system:unfiled')
)
);
}
$db->sql_freeresult($dbresult);
?>

View file

@ -271,10 +271,11 @@ class SemanticScuttle_Service_Bookmark2Tag extends SemanticScuttle_DbService
* Retrieves all tags for a given bookmark except system tags.
*
* @param integer $bookmarkid ID of the bookmark
* @param boolean $systemTags Return "system:*" tags or not
*
* @return array Array of tags
*/
public function getTagsForBookmark($bookmarkid)
public function getTagsForBookmark($bookmarkid, $systemTags = false)
{
if (!is_numeric($bookmarkid)) {
message_die(
@ -285,9 +286,11 @@ class SemanticScuttle_Service_Bookmark2Tag extends SemanticScuttle_DbService
}
$query = 'SELECT tag FROM ' . $this->getTableName()
. ' WHERE bId = ' . intval($bookmarkid)
. ' AND LEFT(tag, 7) <> "system:"'
. ' ORDER BY id ASC';
. ' WHERE bId = ' . intval($bookmarkid);
if (!$systemTags) {
$query .= ' AND LEFT(tag, 7) <> "system:"';
}
$query .= ' ORDER BY id ASC';
if (!($dbresult = $this->db->sql_query($query))) {
message_die(

View file

@ -143,6 +143,7 @@ class SemanticScuttle_Service_Tag extends SemanticScuttle_DbService
if(!is_array($tags)) {
$tags = utf8_strtolower(trim($tags));
} else {
$tags = array_filter($tags);//remove empty values
for($i=0; $i<count($tags); $i++) {
$tags[$i] = utf8_strtolower(trim($tags[$i]));
}

View file

@ -71,6 +71,26 @@ class Bookmark2TagTest extends TestBase
public function testAttachTagsWithoutTagsAddsSystemUnfiled()
{
$bid = $this->addBookmark(null, null, 0, array());
$this->assertEquals(
array('system:unfiled'),
$this->b2ts->getTagsForBookmark($bid, true)
);
}
public function testAttachTagsWithArrayWithEmptyStringAddsSystemUnfiled()
{
$bid = $this->addBookmark(null, null, 0, array(''));
$this->assertEquals(
array('system:unfiled'),
$this->b2ts->getTagsForBookmark($bid, true)
);
}
/**
* Test getTagsForBookmark() when the bookmark has no tags
*

View file

@ -67,7 +67,7 @@ if (POST_CONFIRM) {
$template = 'error.500.tpl';
}
} elseif (POST_CANCEL) {
header('Location: '. createURL('bookmarks', $currentUser->getUsername() .'/'. $tags));
header('Location: '. createURL('bookmarks', $currentUser->getUsername() .'/'. $tag));
} else {
$tplVars['subtitle'] = T_('Rename Tag') .': '. $tag;
$tplVars['formaction'] = $_SERVER['SCRIPT_NAME'] .'/'. $tag;