Merge branch 'master' into privatekey2

Conflicts:

	data/templates/default/bookmarks.tpl.php
This commit is contained in:
Mark Pemberton 2011-06-04 00:38:07 -04:00
commit b628e63e01
102 changed files with 1022 additions and 598 deletions

View file

@ -41,7 +41,6 @@
Test your zip with: unzip -l SemanticScuttle-0.95.0.zip Test your zip with: unzip -l SemanticScuttle-0.95.0.zip
--> -->
<mkdir dir="dist" />
<echo msg="Creating distribution zip for SemanticScuttle ${version}"/> <echo msg="Creating distribution zip for SemanticScuttle ${version}"/>
<delete file="${distfile}" failonerror="false"/> <delete file="${distfile}" failonerror="false"/>
<zip destfile="${distfile}" prefix="${phing.project.name}-${version}/"> <zip destfile="${distfile}" prefix="${phing.project.name}-${version}/">
@ -121,18 +120,19 @@
<replacement <replacement
path="src/SemanticScuttle/header.php" path="src/SemanticScuttle/header.php"
type="pear-config" type="pear-config" from="@data_dir@" to="data_dir"
from="@data_dir@" to="data_dir" />
<replacement
path="src/SemanticScuttle/header.php"
type="pear-config" from="@www_dir@" to="www_dir"
/> />
<replacement <replacement
path="www/www-header.php" path="www/www-header.php"
type="pear-config" type="pear-config" from="@data_dir@" to="data_dir"
from="@data_dir@" to="data_dir"
/> />
<replacement <replacement
path="tests/prepare.php" path="tests/prepare.php"
type="pear-config" type="pear-config" from="@data_dir@" to="data_dir"
from="@data_dir@" to="data_dir"
/> />
<changelog version="0.97" date="2010-06-09" license="GPL"> <changelog version="0.97" date="2010-06-09" license="GPL">
@ -207,6 +207,48 @@
</target> </target>
<!-- you need to have the python docutils package installed, since
we use the rst2html tool -->
<target name="build-docs">
<foreach param="fname" absparam="abs-fname" target="build-doc-file">
<fileset dir=".">
<include name="doc/ChangeLog"/>
<include name="doc/**.txt"/>
<include name="doc/**.rst"/>
<include name="doc/**/*.rst"/>
<exclude name="doc/LICENSE.txt"/>
<exclude name="doc/developers/TODO.rst"/>
</fileset>
</foreach>
</target>
<target name="build-doc-file" depends="check"
description="Builds a single documentation file. Pass file path as $fname"
>
<echo msg="${fname}"/>
<php function="preg_replace" returnProperty="outfile">
<param value="/^(.+)(.rst|.txt)$/"/>
<param value="dist/\1.html"/>
<param value="${fname}"/>
</php>
<!-- only render file if the doc file is newer than the html file -->
<property name="isuptodate" value="false"/>
<uptodate property="isuptodate" srcfile="${fname}" targetfile="${outfile}" />
<if>
<not><istrue value="${isuptodate}"/></not>
<then>
<exec
command="rst2html --exit-status=2 ${fname} ${outfile}"
checkreturn="1"
/>
</then>
</if>
</target>
<target name="release" depends="check,zip,package,deploy-sf" <target name="release" depends="check,zip,package,deploy-sf"
description="Release the version on sourceforge" description="Release the version on sourceforge"
@ -314,6 +356,10 @@
<fail unless="sfuser" message="Sourceforge username not defined!" /> <fail unless="sfuser" message="Sourceforge username not defined!" />
<fail unless="sfproject" message="Sourceforge project name not defined!" /> <fail unless="sfproject" message="Sourceforge project name not defined!" />
<fail unless="sffilepath" message="Sourceforge project file path not defined!" /> <fail unless="sffilepath" message="Sourceforge project file path not defined!" />
<mkdir dir="dist" />
<mkdir dir="dist/doc" />
<mkdir dir="dist/doc/developers" />
</target> </target>
</project> </project>

View file

@ -63,6 +63,15 @@ $sidebarTopMessage = '';
*/ */
$sidebarBottomMessage = ''; $sidebarBottomMessage = '';
/**
* The HTML theme to use. With themes, you can give your semanticscuttle
* installation a new look.
*
* Themes are the folders in data/templates/
*
* @var string
*/
$theme = 'default';
/*************************************************** /***************************************************

20
data/schema/1.sql Normal file
View file

@ -0,0 +1,20 @@
RENAME TABLE `sc_tags` TO `sc_bookmarks2tags` ;
CREATE TABLE `sc_searchhistory` (
`shId` int(11) NOT NULL auto_increment,
`shTerms` varchar(255) NOT NULL default '',
`shRange` varchar(32) NOT NULL default '',
`shDatetime` datetime NOT NULL default '0000-00-00 00:00:00',
`shNbResults` int(6) NOT NULL default '0',
`uId` int(11) NOT NULL default '0',
PRIMARY KEY (`shId`)
);
CREATE TABLE `sc_tags` (
`tId` int(11) NOT NULL auto_increment,
`tag` varchar(32) NOT NULL default '',
`uId` int(11) NOT NULL default '0',
`tDescription` varchar(255) default NULL,
PRIMARY KEY (`tId`),
UNIQUE KEY `sc_tags_tag_uId` (`tag`, `uId`)
);

10
data/schema/2.sql Normal file
View file

@ -0,0 +1,10 @@
ALTER TABLE `sc_bookmarks` CHANGE `bDescription` `bDescription` VARCHAR( 1500 )
CREATE TABLE `sc_tagscache` (
`tcId` int(11) NOT NULL auto_increment,
`tag1` varchar(100) NOT NULL default '',
`tag2` varchar(100) NOT NULL default '',
`relationType` varchar(32) NOT NULL default '',
`uId` int(11) NOT NULL default '0',
PRIMARY KEY (`tcId`),
UNIQUE KEY `sc_tagscache_tag1_tag2_type_uId` (`tag1`,`tag2`,`relationType`,`uId`)
);

85
data/schema/3.sql Normal file
View file

@ -0,0 +1,85 @@
/* modify and add fields */
ALTER TABLE `sc_bookmarks` MODIFY `bAddress` varchar(1500) NOT NULL;
ALTER TABLE `sc_bookmarks` MODIFY `bDescription` TEXT default NULL;
ALTER TABLE `sc_bookmarks` ADD `bPrivateNote` TEXT NULL AFTER `bDescription` ;
ALTER TABLE `sc_tags` MODIFY `tDescription` TEXT default NULL;
ALTER TABLE `sc_commondescription` MODIFY `cdDescription` TEXT default NULL;
/* convert to UTF-8 if your table is ISO-something (through BLOB: tips provided by MYSQL documentation)*/
/* first need to remove index keys because of BLOB constraints*/
ALTER TABLE `sc_tags` DROP INDEX `sc_tags_tag_uId`;
ALTER TABLE `sc_bookmarks2tags` DROP INDEX `sc_bookmarks2tags_tag_bId`;
ALTER TABLE `sc_bookmarks2tags` DROP INDEX `sc_bookmarks2tags_bId`;
ALTER TABLE `sc_tags2tags` DROP INDEX `sc_tags2tags_tag1_tag2_uId`;
ALTER TABLE `sc_commondescription` DROP INDEX `sc_commondescription_tag_datetime`;
ALTER TABLE `sc_tagscache` DROP INDEX `sc_tagscache_tag1_tag2_type_uId`;
ALTER TABLE `sc_tagsstats` DROP INDEX `sc_tagsstats_tag1_type_uId`;
/* secondly convert through BLOB type */
ALTER TABLE `sc_bookmarks` CHANGE `bTitle` `bTitle` BLOB;
ALTER TABLE `sc_bookmarks` CHANGE `bTitle` `bTitle` varchar(255) CHARACTER SET utf8;
ALTER TABLE `sc_bookmarks` CHANGE `bAddress` `bAddress` BLOB;
ALTER TABLE `sc_bookmarks` CHANGE `bAddress` `bAddress` varchar(1500) CHARACTER SET utf8;
ALTER TABLE `sc_bookmarks` CHANGE `bDescription` `bDescription` BLOB;
ALTER TABLE `sc_bookmarks` CHANGE `bDescription` `bDescription` text CHARACTER SET utf8;
ALTER TABLE `sc_bookmarks` CHANGE `bPrivateNote` `bPrivateNote` BLOB;
ALTER TABLE `sc_bookmarks` CHANGE `bPrivateNote` `bPrivateNote` text CHARACTER SET utf8;
ALTER TABLE `sc_tags` CHANGE `tag` `tag` BLOB;
ALTER TABLE `sc_tags` CHANGE `tag` `tag` varchar(100) CHARACTER SET utf8;
ALTER TABLE `sc_tags` CHANGE `tDescription` `tDescription` BLOB;
ALTER TABLE `sc_tags` CHANGE `tDescription` `tDescription` text CHARACTER SET utf8;
ALTER TABLE `sc_bookmarks2tags` CHANGE `tag` `tag` BLOB;
ALTER TABLE `sc_bookmarks2tags` CHANGE `tag` `tag` varchar(100) CHARACTER SET utf8;
ALTER TABLE `sc_users` CHANGE `name` `name` BLOB;
ALTER TABLE `sc_users` CHANGE `name` `name` varchar(50) CHARACTER SET utf8;
ALTER TABLE `sc_users` CHANGE `uContent` `uContent` BLOB;
ALTER TABLE `sc_users` CHANGE `uContent` `uContent` text CHARACTER SET utf8;
ALTER TABLE `sc_tags2tags` CHANGE `tag1` `tag1` BLOB;
ALTER TABLE `sc_tags2tags` CHANGE `tag1` `tag1` varchar(100) CHARACTER SET utf8;
ALTER TABLE `sc_tags2tags` CHANGE `tag2` `tag2` BLOB;
ALTER TABLE `sc_tags2tags` CHANGE `tag2` `tag2` varchar(100) CHARACTER SET utf8;
ALTER TABLE `sc_tagsstats` CHANGE `tag1` `tag1` BLOB;
ALTER TABLE `sc_tagsstats` CHANGE `tag1` `tag1` varchar(100) CHARACTER SET utf8;
ALTER TABLE `sc_tagscache` CHANGE `tag1` `tag1` BLOB;
ALTER TABLE `sc_tagscache` CHANGE `tag1` `tag1` varchar(100) CHARACTER SET utf8;
ALTER TABLE `sc_tagscache` CHANGE `tag2` `tag2` BLOB;
ALTER TABLE `sc_tagscache` CHANGE `tag2` `tag2` varchar(100) CHARACTER SET utf8;
ALTER TABLE `sc_commondescription` CHANGE `tag` `tag` BLOB;
ALTER TABLE `sc_commondescription` CHANGE `tag` `tag` varchar(100) CHARACTER SET utf8;
ALTER TABLE `sc_commondescription` CHANGE `cdTitle` `cdTitle` BLOB;
ALTER TABLE `sc_commondescription` CHANGE `cdTitle` `cdTitle` varchar(255) CHARACTER SET utf8;
ALTER TABLE `sc_commondescription` CHANGE `cdDescription` `cdDescription` BLOB;
ALTER TABLE `sc_commondescription` CHANGE `cdDescription` `cdDescription` text CHARACTER SET utf8;
ALTER TABLE `sc_searchhistory` CHANGE `shTerms` `shTerms` BLOB;
ALTER TABLE `sc_searchhistory` CHANGE `shTerms` `shTerms` varchar(255) CHARACTER SET utf8;
ALTER TABLE `sc_searchhistory` CHANGE `shRange` `shRange` BLOB;
ALTER TABLE `sc_searchhistory` CHANGE `shRange` `shRange` varchar(32) CHARACTER SET utf8;
/* Thirdly re-add index keys */
ALTER TABLE `sc_tags` ADD UNIQUE KEY `sc_tags_tag_uId` (`tag`, `uId`);
ALTER TABLE `sc_bookmarks2tags` ADD UNIQUE KEY `sc_bookmarks2tags_tag_bId` (`tag`,`bId`);
ALTER TABLE `sc_bookmarks2tags` ADD KEY `sc_bookmarks2tags_bId` (`bId`);
ALTER TABLE `sc_tags2tags` ADD UNIQUE KEY `sc_tags2tags_tag1_tag2_uId` (`tag1`,`tag2`,`relationType`,`uId`);
ALTER TABLE `sc_commondescription` ADD UNIQUE KEY `sc_commondescription_tag_datetime` (`tag`,`cdDatetime`);
ALTER TABLE `sc_tagscache` ADD UNIQUE KEY `sc_tagscache_tag1_tag2_type_uId` (`tag1`,`tag2`,`relationType`,`uId`);
ALTER TABLE `sc_tagsstats` ADD UNIQUE KEY `sc_tagsstats_tag1_type_uId` (`tag1`,`relationType`,`uId`);
/* Change tables to utf-8 charset */
ALTER TABLE `sc_bookmarks` CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE `sc_tags` CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE `sc_bookmarks2tags` CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE `sc_users` CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE `sc_watched` CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE `sc_tags2tags` CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE `sc_tagsstats` CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE `sc_tagscache` CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE `sc_commondescription` CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE `sc_searchhistory` CHARACTER SET utf8 COLLATE utf8_general_ci;

11
data/schema/4.sql Normal file
View file

@ -0,0 +1,11 @@
ALTER TABLE `sc_bookmarks` ADD `bVoting` INT NOT NULL;
ALTER TABLE `sc_bookmarks` ADD `bVotes` INT NOT NULL;
CREATE TABLE `sc_votes` (
`bId` INT NOT NULL ,
`uId` INT NOT NULL ,
`vote` INT( 2 ) NOT NULL ,
UNIQUE KEY `bid_2` (`bId`,`uId`),
KEY `bid` (`bId`),
KEY `uid` (`uId`)
) CHARACTER SET utf8 COLLATE utf8_general_ci ;

1
data/schema/5.sql Normal file
View file

@ -0,0 +1 @@
ALTER TABLE `sc_bookmarks` ADD `bShort` VARCHAR(16) NULL DEFAULT NULL;

View file

@ -39,7 +39,9 @@ include('search.menu.php');
<?php if($GLOBALS['enableAdminColors']!=false && isset($userid) && $userservice->isAdmin($userid) && $pageName != PAGE_WATCHLIST) : ?> <?php if($GLOBALS['enableAdminColors']!=false && isset($userid) && $userservice->isAdmin($userid) && $pageName != PAGE_WATCHLIST) : ?>
<div style="width:70%;text-align:center;"> <div style="width:70%;text-align:center;">
<img src="<?php echo ROOT ?>images/logo_24.gif" width="12px"/> <?php echo T_('Bookmarks on this page are managed by an admin user.'); ?><img src="<?php echo ROOT ?>images/logo_24.gif" width="12px"/> <img src="<?php $theme->resource('images/logo_24.gif'); ?>" width="12px"/>
<?php echo T_('Bookmarks on this page are managed by an admin user.'); ?>
<img src="<?php $theme->resource('images/logo_24.gif'); ?>" width="12px"/>
</div> </div>
<?php endif?> <?php endif?>
@ -70,7 +72,7 @@ if ($userservice->isLoggedOn()) {
) { ) {
echo ' <a href="'. createURL('tagcommondescriptionedit', $currenttag).'" title="'.T_('Edit the common description of this tag').'">'; echo ' <a href="'. createURL('tagcommondescriptionedit', $currenttag).'" title="'.T_('Edit the common description of this tag').'">';
echo !is_array($cDescription) || strlen($cDescription['cdDescription'])==0?T_('Edit the common description of this tag'):''; echo !is_array($cDescription) || strlen($cDescription['cdDescription'])==0?T_('Edit the common description of this tag'):'';
echo ' <img src="'.ROOT.'images/b_edit.png" /></a>'; echo ' <img src="' . $theme->resource('images/b_edit.png') . '" /></a>';
} else if (isset($hash)) { } else if (isset($hash)) {
echo ' (<a href="'.createURL('bookmarkcommondescriptionedit', $hash).'" title="'.T_('Edit the common description of this bookmark').'">'; echo ' (<a href="'.createURL('bookmarkcommondescriptionedit', $hash).'" title="'.T_('Edit the common description of this bookmark').'">';
echo T_('Edit the common description of this bookmark').'</a>)'; echo T_('Edit the common description of this bookmark').'</a>)';
@ -95,7 +97,7 @@ if($userservice->isLoggedOn()) {
if($currenttag!= '') { if($currenttag!= '') {
echo ' <a href="'. createURL('tagedit', $currenttag).'" title="'.T_('Edit your personal description of this tag').'" >'; echo ' <a href="'. createURL('tagedit', $currenttag).'" title="'.T_('Edit your personal description of this tag').'" >';
echo strlen($pDescription['tDescription'])==0?T_('Edit your personal description of this tag'):''; echo strlen($pDescription['tDescription'])==0?T_('Edit your personal description of this tag'):'';
echo ' <img src="'.ROOT.'images/b_edit.png" /></a>'; echo ' <img src="' . $theme->resource('images/b_edit.png') . '" /></a>';
} }
} }
?></p> ?></p>
@ -361,9 +363,15 @@ if ($currenttag!= '') {
} }
// Admin specific design // Admin specific design
if ($userservice->isAdmin($row['username']) && $GLOBALS['enableAdminColors']) { if ($userservice->isAdmin($row['username'])
&& $GLOBALS['enableAdminColors']
) {
$adminBgClass = ' class="adminBackground"'; $adminBgClass = ' class="adminBackground"';
$adminStar = ' <img src="'. ROOT .'images/logo_24.gif" width="12px" title="'. T_('This bookmark is certified by an admin user.') .'" />'; $adminStar = ' <img'
. ' src="' . $theme->resource('images/logo_24.gif') . '"'
. ' width="12px"'
. ' title="' . T_('This bookmark is certified by an admin user.') . '"'
. '/>';
} else { } else {
$adminBgClass = ''; $adminBgClass = '';
$adminStar = ''; $adminStar = '';

View file

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

View file

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

View file

@ -0,0 +1,66 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" />
<title><?php echo filter($GLOBALS['sitename'] .(isset($pagetitle) ? ' » ' . $pagetitle : '')); ?></title>
<link rel="icon" type="image/png" href="<?php echo $theme->resource('icon.png');?>" />
<link rel="stylesheet" type="text/css" href="<?php echo $theme->resource('scuttle.css');?>" />
<link rel="search" type="application/opensearchdescription+xml" href="<?php echo ROOT ?>api/opensearch.php" title="<?php echo htmlspecialchars($GLOBALS['sitename']) ?>"/>
<?php
if (isset($rsschannels)) {
$size = count($rsschannels);
for ($i = 0; $i < $size; $i++) {
echo ' <link rel="alternate" type="application/rss+xml" title="'
. htmlspecialchars($rsschannels[$i][0]) . '"'
. ' href="'. $rsschannels[$i][1] .'" />';
}
}
?>
<?php if (isset($loadjs)) :?>
<?php if (DEBUG_MODE) : ?>
<script type="text/javascript" src="<?php echo ROOT_JS ?>jquery-1.4.2.js"></script>
<script type="text/javascript" src="<?php echo ROOT_JS ?>jquery.jstree.js"></script>
<?php else: ?>
<script type="text/javascript" src="<?php echo ROOT_JS ?>jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="<?php echo ROOT_JS ?>jquery.jstree.min.js"></script>
<?php endif ?>
<script type="text/javascript" src="<?php echo ROOT ?>jsScuttle.php"></script>
<?php endif ?>
</head>
<body>
<?php
$headerstyle = '';
if(isset($_GET['popup'])) {
$headerstyle = ' class="popup"';
}
?>
<div id="header" <?php echo $headerstyle; ?>>
<h1><a href="<?php echo ROOT ?>"><?php echo $GLOBALS['sitename']; ?></a></h1>
<?php
if(!isset($_GET['popup'])) {
$this->includeTemplate('toolbar.inc');
}
?></div>
<?php
if (isset($subtitle)) {
echo '<h2>'. $subtitle ."</h2>\n";
}
if(DEBUG_MODE) {
echo '<p class="error">'. T_('Admins, your installation is in "Debug Mode" ($debugMode = true). To go in "Normal Mode" and hide debugging messages, change $debugMode to false into config.php.') ."</p>\n";
}
if (isset($error) && $error!='') {
echo '<p class="error">'. $error ."</p>\n";
}
if (isset($msg) && $msg!='') {
echo '<p class="success">'. $msg ."</p>\n";
}
if (isset($tipMsg) && $tipMsg!='') {
echo '<p class="tipMsg">'. $tipMsg ."</p>\n";
}
?>

View file

@ -4,8 +4,8 @@
<head> <head>
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" /> <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" />
<title><?php echo filter($GLOBALS['sitename'] .(isset($pagetitle) ? ' » ' . $pagetitle : '')); ?></title> <title><?php echo filter($GLOBALS['sitename'] .(isset($pagetitle) ? ' » ' . $pagetitle : '')); ?></title>
<link rel="icon" type="image/png" href="<?php echo ROOT ?>icon.png" /> <link rel="icon" type="image/png" href="<?php echo $theme->resource('icon.png');?>" />
<link rel="stylesheet" type="text/css" href="<?php echo ROOT ?>scuttle.css" /> <link rel="stylesheet" type="text/css" href="<?php echo $theme->resource('scuttle.css');?>" />
<link rel="search" type="application/opensearchdescription+xml" href="<?php echo ROOT ?>api/opensearch.php" title="<?php echo htmlspecialchars($GLOBALS['sitename']) ?>"/> <link rel="search" type="application/opensearchdescription+xml" href="<?php echo ROOT ?>api/opensearch.php" title="<?php echo htmlspecialchars($GLOBALS['sitename']) ?>"/>
<?php <?php
if (isset($rsschannels)) { if (isset($rsschannels)) {
@ -40,7 +40,7 @@ if(isset($_GET['popup'])) {
?> ?>
<div id="header" <?php echo $headerstyle; ?>> <div id="header" <?php echo $headerstyle; ?>>
<h1><a href="<?php echo ROOT ?>"><?php echo $GLOBALS['sitename']; ?></a></h1> <h1><a href="<?php echo ROOT ?>">.</a></h1>
<?php <?php
if(!isset($_GET['popup'])) { if(!isset($_GET['popup'])) {
$this->includeTemplate('toolbar.inc'); $this->includeTemplate('toolbar.inc');

View file

@ -1,23 +1,28 @@
ChangeLog for SemantiScuttle ChangeLog for SemantiScuttle
============================ ============================
0.98.0 - 2011-XX-XX 0.98.0 - 2011-XX-XX
------------------- -------------------
- Switch to jQuery and drop dojo - Switch to jQuery and drop dojo
- Fix bug #3187177: Wrong URL / Export XML Bookmarks - Fix bug #3187177: Wrong URL / Export XML Bookmarks
- Fix bug in getTagsForBookmarks() that fetched all tags - Fix bug in ``getTagsForBookmarks()`` that fetched all tags
- Fix bug #3097187: Using opensearch with two tags does not work in Firefox - Fix bug #3097187: Using opensearch with two tags does not work in Firefox
- Fix bug #3251877: French translation JavaScript Bug when editing bookmarks - Fix bug #3251877: French translation JavaScript Bug when editing bookmarks
- Fix bug #3168521: Title of tag-filtered RSS Feed is broken
- Fix bug #2853627: Javascript warning
- Implement request #1989987: Theming support
- Implement request #3054906: Show user's full name instead of nickname - Implement request #3054906: Show user's full name instead of nickname
- Implement patch #3059829: update FR_CA translation - Implement patch #3059829: update ``FR_CA`` translation
- Show error message on mysqli connection errors - Show error message on mysqli connection errors
- Update php-gettext library to 1.0.10 - Update php-gettext library to 1.0.10
- api/posts/add respects the "replace" parameter now - ``api/posts/add`` respects the "replace" parameter now
- Fix privacy issue when fetching tags of several users - Fix privacy issue when fetching tags of several users
- Fix Google custom search XML - Fix Google custom search XML
- Only URLs with an allowed protocol may be added to the database - Only URLs with an allowed protocol may be added to the database
- Support HTTPS connections when $root is not configured - Support HTTPS connections when ``$root`` is not configured
- SQL schema version table to ease future database upgrades - SQL schema version table to ease future database upgrades
- Documentation is written with rST (reStructuredText) now
0.97.2 - 2011-02-17 0.97.2 - 2011-02-17
@ -68,10 +73,12 @@ your SemanticScuttle installations!
- Fix several SQL injection possibilities - Fix several SQL injection possibilities
- Fix E_NOTICE when calling alltags.php without any parameter - Fix E_NOTICE when calling alltags.php without any parameter
- Implement part of request #2928950: - Implement part of request #2928950:
- User adjustable entry count: rss.php?count=20 - User adjustable entry count: rss.php?count=20
- Fix HTTP content type header for RSS - Fix HTTP content type header for RSS
- Add config option to allow sorting by bookmark creation date - Add config option to allow sorting by bookmark creation date
instead of modification date instead of modification date
- Implement request #2833793: Export to avahi config files - Implement request #2833793: Export to avahi config files
- we support zeroconf networking! - we support zeroconf networking!
- Implement request #2934868: Do not display full redirection URL - Implement request #2934868: Do not display full redirection URL
@ -181,7 +188,7 @@ your SemanticScuttle installations!
- Major Refactoring: add a tag cache improving query processing - Major Refactoring: add a tag cache improving query processing
(knowledge inference on tag relations) [DB modified] (knowledge inference on tag relations) [DB modified]
- Interface fix: allows to remove a tag from the selection into - Interface fix: allows to remove a tag from the selection into
subtitle bar thanks to a *. subtitle bar thanks to a \*.
- New Feature: authorizes anchors with brackets into descriptions - New Feature: authorizes anchors with brackets into descriptions
of bookmark. For example: "[city]Paris[/city]". of bookmark. For example: "[city]Paris[/city]".
This text between anchors will be highlighted when the This text between anchors will be highlighted when the
@ -219,6 +226,7 @@ your SemanticScuttle installations!
0.90 - 2008-06-05 0.90 - 2008-06-05
----------------- -----------------
The main improvements of this new version are: The main improvements of this new version are:
- menu tags (tags which are included into the "menu" tag and - menu tags (tags which are included into the "menu" tag and
thus which appear on the main page) thus which appear on the main page)
- connexion with Google Custom Search Engine which allows to - connexion with Google Custom Search Engine which allows to
@ -227,6 +235,7 @@ The main improvements of this new version are:
All the changes: All the changes:
- New feature: add Google Custom Search Engine into - New feature: add Google Custom Search Engine into
gsearch/ folder and looking into all bookmarks [Config modified] gsearch/ folder and looking into all bookmarks [Config modified]
- Interface design: antispam question is hidden when - Interface design: antispam question is hidden when
@ -279,6 +288,7 @@ The main change of this release is the possibility to preview websites
through thumbnails (thanks to artviper.net). through thumbnails (thanks to artviper.net).
All the changes: All the changes:
- Interface design: display SemanticScuttle version number - Interface design: display SemanticScuttle version number
on "about" page on "about" page
- Bug fix: allow clean urls thanks to .htaccess - Bug fix: allow clean urls thanks to .htaccess
@ -298,6 +308,7 @@ All the changes:
0.87 - 2008-02-14 0.87 - 2008-02-14
----------------- -----------------
This new version brings two major features to SemanticScuttle: This new version brings two major features to SemanticScuttle:
1) You can now create a synonym link between tags. 1) You can now create a synonym link between tags.
For example, by linking the tags "monument" and "monuments", For example, by linking the tags "monument" and "monuments",
you can find resources tagged with the first one when you navigate you can find resources tagged with the first one when you navigate
@ -310,6 +321,7 @@ This new version brings two major features to SemanticScuttle:
ones (more difficult but more powerful). ones (more difficult but more powerful).
All the changes: All the changes:
- Interface design: allow to access to users' bookmarks from last - Interface design: allow to access to users' bookmarks from last
user sidebox. (Currently, we can just access to their profiles). user sidebox. (Currently, we can just access to their profiles).
- Interface design: hide multiple URLs repeated into history page - Interface design: hide multiple URLs repeated into history page
@ -335,9 +347,11 @@ All the changes:
----------------- -----------------
- New feature: Add stats (nb children, nb descendants, depth, - New feature: Add stats (nb children, nb descendants, depth,
nb update) to structured tags nb update) to structured tags
- Allow to visualize structured tags according to stats - Allow to visualize structured tags according to stats
- Add admin page to update stats from the existing structured - Add admin page to update stats from the existing structured
tags in the database tags in the database
- Translation: improve French translation (add missing translations, - Translation: improve French translation (add missing translations,
transform "labels" into "tags") transform "labels" into "tags")
- New feature: List all users in a users page and users block on - New feature: List all users in a users page and users block on

View file

@ -1,51 +1,60 @@
============================
SemanticScuttle installation SemanticScuttle installation
============================ ============================
Prerequisites Prerequisites
------------- =============
To run SemanticScuttle, you need: To run SemanticScuttle, you need:
- PHP5 with filter functions enabled - PHP5 with filter functions enabled
- A web server, for example Apache - A web server, for example Apache
Installation instructions Installation instructions
------------------------- =========================
1. Create a new MySQL database 1. Create a new MySQL database
2. Import tables.sql into that database, i.e. 2. Import ``data/tables.sql`` into that database, i.e.
run run ::
> mysql -umyusername semanticscuttle < data/tables.sql
$ mysql -umyusername semanticscuttle < data/tables.sql
on the shell ("semanticscuttle" being the database name) on the shell ("semanticscuttle" being the database name)
3. Copy data/config.php.dist to data/config.php and modify it as
3. Copy ``data/config.php.dist`` to ``data/config.php`` and modify it as
necessary. necessary.
4. Make the cache directory writable by your web server. 4. Make the cache directory writable by your web server.
For example, run For example, run ::
> chmod 0777 cache
$ chmod 0777 cache
on the shell. on the shell.
5. Set the www/ directory as document root in your web server, 5. Set the ``www/`` directory as document root in your web server,
restart the web server. restart the web server.
Ugly www directory in URLs Ugly www directory in URLs
-------------------------- ==========================
In case point 5 of the installation instructions cannot be put into In case point 5 of the installation instructions cannot be put into
practice by you because you are not able to change the web server practice by you because you are not able to change the web server
configuration, you are not lost! There is a way to get rid of configuration, you are not lost! There is a way to get rid of
www/ in your URL! ``www/`` in your URL!
Imagine following directory layout: ::
Imagine following directory layout:
/home/customer123/ /home/customer123/
www/ www/
subdomain1/ subdomain1/
subdomain2/ subdomain2/
subdomain3/ subdomain3/
Create a SemanticScuttle directory somewhere outside www if possible Create a SemanticScuttle directory somewhere outside ``www`` if possible
and put all directories except www/ in there. Move all files and and put all directories except ``www/`` in there. Move all files and
directories from www/ into your subdomain directory. Then modify directories from ``www/`` into your subdomain directory. Then modify
subdomain/www-header.php to include the correct file path. ``subdomain/www-header.php`` to include the correct file path.
The new directory layout should look that way: ::
The new directory layout should look that way:
/home/customer123/ /home/customer123/
semanticscuttle/ semanticscuttle/
doc/ doc/
@ -60,8 +69,11 @@ The new directory layout should look that way:
www-header.php www-header.php
subdomain3/ subdomain3/
Now open www-header.php and replace Now open www-header.php and replace ::
require_once '../src/SemanticScuttle/header.php'; require_once '../src/SemanticScuttle/header.php';
with
with ::
require_once '../../semanticscuttle/src/SemanticScuttle/header.php'; require_once '../../semanticscuttle/src/SemanticScuttle/header.php';

67
doc/README.rst Normal file
View file

@ -0,0 +1,67 @@
====================
SemanticScuttle 0.98
====================
A social bookmarking tool experimenting with new features
like structured tags or collaborative descriptions of tags.
https://sourceforge.net/projects/semanticscuttle/
Available under the GNU General Public License
Installation
============
See `INSTALL.rst`__
__ INSTALL.html
Upgrading from a previous version
=================================
See `UPGRADE.txt`__
__ UPGRADE.html
Public API
==========
SemanticScuttle supports most of the `del.icio.us API`__.
Almost all of the neat tools made for that system can be modified
to work with your SemanticScuttle installation. If you find a tool
that won't let you change the API address, ask the creator to add
this setting. You never know, they might just do it.
__ http://del.icio.us/doc/api
Links
-----
- `further documentation`__
- `support and help questions`__
- `development mailing list instructions`__
- `suggestions`_ for SemanticScuttle
- `bug reports`_
- `feature requests`_
- `patches`_
__ http://semanticscuttle.wiki.sourceforge.net/
__ http://sourceforge.net/forum/forum.php?forum_id=759510
__ https://sourceforge.net/mailarchive/forum.php?forum_name=semanticscuttle-devel
.. _suggestions: http://sourceforge.net/forum/forum.php?forum_id=759511
.. _bug reports: http://sourceforge.net/tracker/?group_id=211356&atid=1017430
.. _feature requests: https://sourceforge.net/tracker/?group_id=211356&atid=1017433
.. _patches: https://sourceforge.net/tracker/?group_id=211356&atid=1017432
Known issues
============
Number of bookmarks always 0: "0 bookmark(s)"
---------------------------------------------
This issue occurs when debug mode is enabled.
Technically, this is because the database layers ``DEBUG_EXTRA`` gets
enabled through debug mode.

View file

@ -1,91 +0,0 @@
SemanticScuttle 0.94
====================
A social bookmarking tool experimenting with new features
like structured tags or collaborative descriptions of tags.
https://sourceforge.net/projects/semanticscuttle/
Available under the GNU General Public License
Installation
------------
See INSTALL.txt
Upgrading from a previous version
---------------------------------
See UPGRADE.txt
Public API
----------
Scuttle supports most of the del.icio.us API [1].
Almost all of the neat tools made for that system can be modified
to work with your SemanticScuttle installation. If you find a tool
that won't let you change the API address, ask the creator to add
this setting. You never know, they might just do it.
[1] http://del.icio.us/doc/api
Translations
------------
Scuttle is available in the following languages :
English en-GB 100% (Default)
Chinese zh-CN 86%
Danish dk-DK 100%
Dutch nl-NL 68%
French fr-FR 100%
German de-DE 100%
Hindi hi-IN 100%
Italian it-IT 89%
Japanese ja-JP 100%
Lithuanian lt-LT 100%
Portuguese pt-BR 100%
Spanish es-ES 94%
Translations are managed with gettext <includes/php-gettext>.
To provide additional translations:
- execute of of the scripts in <includes/php-gettext/bin/>
for example to complete french (France) translation on a
GNU/Linux system, type
./gettexts.sh fr_FR
- then edit the file <locales/fr_FR/LC_MESSAGES/messages.po>
with poedit
(that will update <locales/fr_FR/LC_MESSAGES/messages.mo>)
Links
-----
http://semanticscuttle.wiki.sourceforge.net/
- further documentation
http://sourceforge.net/forum/forum.php?forum_id=759510
- support and help questions
https://sourceforge.net/mailarchive/forum.php?forum_name=semanticscuttle-devel
- development mailing list instructions
http://sourceforge.net/forum/forum.php?forum_id=759511
- suggestions for SemanticScuttle
http://sourceforge.net/tracker/?group_id=211356&atid=1017430
- bug reports
https://sourceforge.net/tracker/?group_id=211356&atid=1017433
- feature requests
https://sourceforge.net/tracker/?group_id=211356&atid=1017432
- patches
Known issues
------------
Number of bookmarks always 0: "0 bookmark(s)"
This issue occurs when debug mode is enabled.
Technically, this is because the database layers DEBUG_EXTRA gets
enabled through debug mode.

View file

@ -1,86 +1,87 @@
=================================================
Upgrading SemanticScuttle from a previous version Upgrading SemanticScuttle from a previous version
================================================= =================================================
From version 0.97 to 0.98 From version 0.97 to 0.98
------------------------- =========================
Database updates: Apply data/schema/6.sql or do the following: Database updates
----------------
CREATE TABLE `sc_version` ( Apply ``data/schema/6.sql``
`schema_version` int(11) NOT NULL
) DEFAULT CHARSET=utf8;
INSERT INTO `sc_version` (`schema_version`) VALUES ('6');
ALTER TABLE `sc_users` ADD `privateKey` VARCHAR(33) NULL; ALTER TABLE `sc_users` ADD `privateKey` VARCHAR(33) NULL;
CREATE UNIQUE INDEX `privateKey` ON `sc_users` (`privateKey`); CREATE UNIQUE INDEX `privateKey` ON `sc_users` (`privateKey`);
From version 0.96 to 0.97 From version 0.96 to 0.97
------------------------- =========================
No database changes necessary. No database changes necessary.
From version 0.95 to 0.96 From version 0.95 to 0.96
------------------------- =========================
Update your database: Database updates
- ALTER TABLE `sc_bookmarks` ADD `bShort` VARCHAR(16) NULL DEFAULT NULL; ----------------
Apply ``data/schema/5.sql``
API: API
The method signatures of addBookmark() and updateBookmark() ---
changed due to the addition of the $short parameter. The method signatures of ``addBookmark()`` and ``updateBookmark()``
changed due to the addition of the ``$short`` parameter.
We got complaints about the changed file structure, and people told We got complaints about the changed file structure, and people told
us that they just cannot set the document root to www/, because they us that they just cannot set the document root to ``www/``, because they
are not admins on their http server. This is a valid point, and are not admins on their HTTP server. This is a valid point, and
with 0.96.0 you can easily change it. See INSTALL.txt for more information with 0.96.0 you can easily change it. See `INSTALL.txt`_ for more information
about moving www/. about moving ``www/``.
.. _INSTALL.txt: INSTALL.html
From version 0.94 to 0.95 From version 0.94 to 0.95
-------------------------- =========================
The file structure completely changed in 0.95.0 compared The file structure completely changed in 0.95.0 compared
to previous versions. We recommend that you start with a to previous versions. We recommend that you start with a
fresh installation, just copying over your config.php file. fresh installation, just copying over your ``config.php`` file.
Set your web server document root directory to www/. Set your web server document root directory to ``www/``.
Yes, we kind of lost the ability to run SemanticScuttle Yes, we kind of lost the ability to run SemanticScuttle
in a subdirectory of a hostname. This functionality will in a subdirectory of a hostname. This functionality will
be back in one of the next releases, but for now, you have be back in one of the next releases, but for now, you have
to live with it. to live with it.
Update your database: Update your database
- ALTER TABLE `sc_bookmarks` ADD `bVoting` INT NOT NULL; --------------------
- ALTER TABLE `sc_bookmarks` ADD `bVotes` INT NOT NULL; Apply ``data/schema/4.sql``.
- Add the new votes database table. See data/tables.sql.
Currently, only MySQL can be used as database backend. Currently, only MySQL can be used as database backend.
All other DBMS (database management systems) have not been All other DBMS (database management systems) have not been
tested except for PostgreSQL, and SemanticScuttle fails there. tested except for PostgreSQL, and SemanticScuttle fails there.
The de_AT translation has been re-added. This is because Translation
de_AT provides a rather ugly "official German" style, -----------
while the normal de_DE is friendlier. Choose what you like. The ``de_AT`` translation has been re-added. This is because
``de_AT`` provides a rather ugly "official German" style,
while the normal ``de_DE`` is friendlier. Choose what you like.
From version 0.93 to 0.94 From version 0.93 to 0.94
------------------------- =========================
- Nothing changed except for the default configuration file. - Nothing changed except for the default configuration file.
It is recommended to start with a fresh config file, It is recommended to start with a fresh config file,
but not neccesary. Old config files still work. but not neccesary. Old config files still work.
- If you used translation de_AT, please switch to de_DE. - If you used translation ``de_AT``, please switch to ``de_DE``.
de_AT was moved to de_DE and de_AT has been removed. ``de_AT`` was moved to ``de_DE`` and ``de_AT`` has been removed.
From version 0.92 to 0.93 From version 0.92 to 0.93
------------------------- =========================
- Backup your database - Backup your database
- Make a copy from your SemanticScuttle Web directory - Make a copy from your SemanticScuttle Web directory
- Upgrade your database by following instructions ONE after ONE (order is important) : - Upgrade your current configuration file (``config.inc.php``) with respect to ``config.inc.php.example`` ::
#NOTHING TO CHANGE IN DB
- Upgrade your current configuration file (config.inc.php) with respect to config.inc.php.example
$footerMessage = ''; #HTML message appearing at the bottom of the page (just above SemanticScuttle credits) $footerMessage = ''; #HTML message appearing at the bottom of the page (just above SemanticScuttle credits)
$sidebarTopMessage = ''; #HTML message appearing at the top of the sidebar $sidebarTopMessage = ''; #HTML message appearing at the top of the sidebar
$sidebarBottomMessage = ''; #HTML message appearing at the bottom of the sidebar $sidebarBottomMessage = ''; #HTML message appearing at the bottom of the sidebar
@ -90,177 +91,75 @@ $defaultPerPageForAdmins = 20; # default number of bookmarks per page for admins
From version 0.91 to 0.92 From version 0.91 to 0.92
------------------------- =========================
Message: this version modifies the database to UTF-8 charset. The idea is to convert the content (through BLOB type) and then to change the tables' charsets. Message: this version modifies the database to UTF-8 charset. The idea is to convert the content (through BLOB type) and then to change the tables' charsets.
- Backup your database - Backup your database
- Make a copy from your SemanticScuttle Web directory - Make a copy from your SemanticScuttle Web directory
- Upgrade your database by following instructions ONE after ONE (order is important) : - Upgrade your database by applying ``data/schema/3.sql``
- Upgrade your current configuration file (``config.inc.php``) with respect to ``config.inc.php.example``
/* modify and add fields */ - Add variable ::
ALTER TABLE `sc_bookmarks` MODIFY `bAddress` varchar(1500) NOT NULL;
ALTER TABLE `sc_bookmarks` MODIFY `bDescription` TEXT default NULL;
ALTER TABLE `sc_bookmarks` ADD `bPrivateNote` TEXT NULL AFTER `bDescription` ;
ALTER TABLE `sc_tags` MODIFY `tDescription` TEXT default NULL;
ALTER TABLE `sc_commondescription` MODIFY `cdDescription` TEXT default NULL;
/* convert to UTF-8 if your table is ISO-something (through BLOB: tips provided by MYSQL documentation)*/ $descriptionAnchors = array("author", "isbn", "address"=>"[address][street][/street][city][/city][/address]"); #add a possible anchor (structured content) for bookmarks' description field
/* first need to remove index keys because of BLOB constraints*/
ALTER TABLE `sc_tags` DROP INDEX `sc_tags_tag_uId`;
ALTER TABLE `sc_bookmarks2tags` DROP INDEX `sc_bookmarks2tags_tag_bId`;
ALTER TABLE `sc_bookmarks2tags` DROP INDEX `sc_bookmarks2tags_bId`;
ALTER TABLE `sc_tags2tags` DROP INDEX `sc_tags2tags_tag1_tag2_uId`;
ALTER TABLE `sc_commondescription` DROP INDEX `sc_commondescription_tag_datetime`;
ALTER TABLE `sc_tagscache` DROP INDEX `sc_tagscache_tag1_tag2_type_uId`;
ALTER TABLE `sc_tagsstats` DROP INDEX `sc_tagsstats_tag1_type_uId`;
/* secondly convert through BLOB type */ - Add variable ::
ALTER TABLE `sc_bookmarks` CHANGE `bTitle` `bTitle` BLOB;
ALTER TABLE `sc_bookmarks` CHANGE `bTitle` `bTitle` varchar(255) CHARACTER SET utf8;
ALTER TABLE `sc_bookmarks` CHANGE `bAddress` `bAddress` BLOB;
ALTER TABLE `sc_bookmarks` CHANGE `bAddress` `bAddress` varchar(1500) CHARACTER SET utf8;
ALTER TABLE `sc_bookmarks` CHANGE `bDescription` `bDescription` BLOB;
ALTER TABLE `sc_bookmarks` CHANGE `bDescription` `bDescription` text CHARACTER SET utf8;
ALTER TABLE `sc_bookmarks` CHANGE `bPrivateNote` `bPrivateNote` BLOB;
ALTER TABLE `sc_bookmarks` CHANGE `bPrivateNote` `bPrivateNote` text CHARACTER SET utf8;
ALTER TABLE `sc_tags` CHANGE `tag` `tag` BLOB; $enableCommonTagDescriptionEditedByAll = true; #true mean everybody can edit common description. Else just the admins can do it.
ALTER TABLE `sc_tags` CHANGE `tag` `tag` varchar(100) CHARACTER SET utf8; - Add variable ::
ALTER TABLE `sc_tags` CHANGE `tDescription` `tDescription` BLOB;
ALTER TABLE `sc_tags` CHANGE `tDescription` `tDescription` text CHARACTER SET utf8;
ALTER TABLE `sc_bookmarks2tags` CHANGE `tag` `tag` BLOB; $googleAnalyticsCode = ''; #Allow GoogleAnalytics tracker https://www.google.com/analytics/
ALTER TABLE `sc_bookmarks2tags` CHANGE `tag` `tag` varchar(100) CHARACTER SET utf8;
ALTER TABLE `sc_users` CHANGE `name` `name` BLOB;
ALTER TABLE `sc_users` CHANGE `name` `name` varchar(50) CHARACTER SET utf8;
ALTER TABLE `sc_users` CHANGE `uContent` `uContent` BLOB;
ALTER TABLE `sc_users` CHANGE `uContent` `uContent` text CHARACTER SET utf8;
ALTER TABLE `sc_tags2tags` CHANGE `tag1` `tag1` BLOB;
ALTER TABLE `sc_tags2tags` CHANGE `tag1` `tag1` varchar(100) CHARACTER SET utf8;
ALTER TABLE `sc_tags2tags` CHANGE `tag2` `tag2` BLOB;
ALTER TABLE `sc_tags2tags` CHANGE `tag2` `tag2` varchar(100) CHARACTER SET utf8;
ALTER TABLE `sc_tagsstats` CHANGE `tag1` `tag1` BLOB;
ALTER TABLE `sc_tagsstats` CHANGE `tag1` `tag1` varchar(100) CHARACTER SET utf8;
ALTER TABLE `sc_tagscache` CHANGE `tag1` `tag1` BLOB;
ALTER TABLE `sc_tagscache` CHANGE `tag1` `tag1` varchar(100) CHARACTER SET utf8;
ALTER TABLE `sc_tagscache` CHANGE `tag2` `tag2` BLOB;
ALTER TABLE `sc_tagscache` CHANGE `tag2` `tag2` varchar(100) CHARACTER SET utf8;
ALTER TABLE `sc_commondescription` CHANGE `tag` `tag` BLOB;
ALTER TABLE `sc_commondescription` CHANGE `tag` `tag` varchar(100) CHARACTER SET utf8;
ALTER TABLE `sc_commondescription` CHANGE `cdTitle` `cdTitle` BLOB;
ALTER TABLE `sc_commondescription` CHANGE `cdTitle` `cdTitle` varchar(255) CHARACTER SET utf8;
ALTER TABLE `sc_commondescription` CHANGE `cdDescription` `cdDescription` BLOB;
ALTER TABLE `sc_commondescription` CHANGE `cdDescription` `cdDescription` text CHARACTER SET utf8;
ALTER TABLE `sc_searchhistory` CHANGE `shTerms` `shTerms` BLOB;
ALTER TABLE `sc_searchhistory` CHANGE `shTerms` `shTerms` varchar(255) CHARACTER SET utf8;
ALTER TABLE `sc_searchhistory` CHANGE `shRange` `shRange` BLOB;
ALTER TABLE `sc_searchhistory` CHANGE `shRange` `shRange` varchar(32) CHARACTER SET utf8;
/* Thirdly re-add index keys */
ALTER TABLE `sc_tags` ADD UNIQUE KEY `sc_tags_tag_uId` (`tag`, `uId`);
ALTER TABLE `sc_bookmarks2tags` ADD UNIQUE KEY `sc_bookmarks2tags_tag_bId` (`tag`,`bId`);
ALTER TABLE `sc_bookmarks2tags` ADD KEY `sc_bookmarks2tags_bId` (`bId`);
ALTER TABLE `sc_tags2tags` ADD UNIQUE KEY `sc_tags2tags_tag1_tag2_uId` (`tag1`,`tag2`,`relationType`,`uId`);
ALTER TABLE `sc_commondescription` ADD UNIQUE KEY `sc_commondescription_tag_datetime` (`tag`,`cdDatetime`);
ALTER TABLE `sc_tagscache` ADD UNIQUE KEY `sc_tagscache_tag1_tag2_type_uId` (`tag1`,`tag2`,`relationType`,`uId`);
ALTER TABLE `sc_tagsstats` ADD UNIQUE KEY `sc_tagsstats_tag1_type_uId` (`tag1`,`relationType`,`uId`);
/* Change tables to utf-8 charset */
ALTER TABLE `sc_bookmarks` CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE `sc_tags` CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE `sc_bookmarks2tags` CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE `sc_users` CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE `sc_watched` CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE `sc_tags2tags` CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE `sc_tagsstats` CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE `sc_tagscache` CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE `sc_commondescription` CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE `sc_searchhistory` CHARACTER SET utf8 COLLATE utf8_general_ci;
- Upgrade your current configuration file (config.inc.php) with respect to config.inc.php.example
* Add variable : $descriptionAnchors = array("author", "isbn", "address"=>"[address][street][/street][city][/city][/address]"); #add a possible anchor (structured content) for bookmarks' description field
* Add variable : $enableCommonTagDescriptionEditedByAll = true; #true mean everybody can edit common description. Else just the admins can do it.
* Add variable : $googleAnalyticsCode = ''; #Allow GoogleAnalytics tracker https://www.google.com/analytics/
From version 0.90 to 0.91 From version 0.90 to 0.91
------------------------- =========================
- Backup you database - Backup you database
- Make a copy from your SemanticScuttle Web directory - Make a copy from your SemanticScuttle Web directory
- Upgrade your database by following instructions ONE after ONE (order is important) : - Upgrade your database by applying ``data/schema/2.sql``
* ALTER TABLE `sc_bookmarks` CHANGE `bDescription` `bDescription` VARCHAR( 1500 ) - Upgrade your current configuration file (``config.inc.php``) with respect to ``config.inc.php.example``
* CREATE TABLE `sc_tagscache` (
`tcId` int(11) NOT NULL auto_increment, - Delete last line ::
`tag1` varchar(100) NOT NULL default '',
`tag2` varchar(100) NOT NULL default '', include_once('debug.inc.php');
`relationType` varchar(32) NOT NULL default '',
`uId` int(11) NOT NULL default '0', - Add variable::
PRIMARY KEY (`tcId`),
UNIQUE KEY `sc_tagscache_tag1_tag2_type_uId` (`tag1`,`tag2`,`relationType`,`uId`) $menu2Tags = array('example', 'of', 'menu', 'tags');
);
- Upgrade your current configuration file (config.inc.php) with respect to config.inc.php.example - Add variable::
* Delete last line : include_once('debug.inc.php');
* Add variable: $menu2Tags = array('example', 'of', 'menu', 'tags'); $debugMode = true; # if true, show debug messages
* Add variable: $debugMode = true; # if true, show debug messages
From version 0.89 to 0.90 From version 0.89 to 0.90
------------------------- =========================
- Backup you database - Backup you database
- Make a copy from your SemanticScuttle Web directory - Make a copy from your SemanticScuttle Web directory
- Upgrade your current configuration file (config.inc.php) with respect to config.inc.php.example - Upgrade your current configuration file (config.inc.php) with respect to config.inc.php.example
# add these lines under $enableWebsiteThumbnails = false; # enableWebsiteThumbnails {true|false}:
add these lines under ``$enableWebsiteThumbnails = false; # enableWebsiteThumbnails {true|false}``::
$thumbnailsUserId = ''; $thumbnailsUserId = '';
$thumbnailsKey = ''; $thumbnailsKey = '';
From version 0.88 to 0.89 From version 0.88 to 0.89
------------------------- =========================
- Backup you database - Backup you database
- Make a copy from your SemanticScuttle Web directory - Make a copy from your SemanticScuttle Web directory
- Upgrade your database by following instructions ONE after ONE (order is important) : - Upgrade your database by applying ``data/schema/1.sql``
- Upgrade your current configuration file (``config.inc.php``) with respect to ``config.inc.php.example``
- add line::
* change the table called 'sc_tags' into 'sc_bookmarks2tags' by executing the following SQL commands (after changing 'yourdatabasename' and adapting its name prefix 'sc_' to your convenience):
RENAME TABLE `yourdatabasename`.`sc_tags` TO `yourdatabasename`.`sc_bookmarks2tags` ;
* add the following table (adapt its name prefix to your convenience) executing the following SQL commands:
CREATE TABLE `sc_searchhistory` (
`shId` int(11) NOT NULL auto_increment,
`shTerms` varchar(255) NOT NULL default '',
`shRange` varchar(32) NOT NULL default '',
`shDatetime` datetime NOT NULL default '0000-00-00 00:00:00',
`shNbResults` int(6) NOT NULL default '0',
`uId` int(11) NOT NULL default '0',
PRIMARY KEY (`shId`)
);
CREATE TABLE `sc_tags` (
`tId` int(11) NOT NULL auto_increment,
`tag` varchar(32) NOT NULL default '',
`uId` int(11) NOT NULL default '0',
`tDescription` varchar(255) default NULL,
PRIMARY KEY (`tId`),
UNIQUE KEY `sc_tags_tag_uId` (`tag`, `uId`)
);
- Upgrade your current configuration file (config.inc.php) with respect to config.inc.php.example
# add line:
$sizeSearchHistory = 10; $sizeSearchHistory = 10;
# add sidebar block index line:
- add sidebar block index line::
$index_sidebar_blocks = array('search','menu','users','popular'); $index_sidebar_blocks = array('search','menu','users','popular');
# add line:
- add line::
$enableGoogleCustomSearch = true; $enableGoogleCustomSearch = true;

213
doc/authentication.rst Normal file
View file

@ -0,0 +1,213 @@
============================================
External authentication with SemanticScuttle
============================================
Most times, one piece of software is only a part in the big puzzle
that makes the software landscape of a company or organization.
SemanticScuttle is not different and should integrate as nicely as
possible with all other systems.
One of the basic tasks of integration is user authentication against
a central database - be it a central user database, an LDAP or a
active directory server.
Since version 0.96, SemanticScuttle supports user authentication against
external systems. To provide a wide range of supported systems, we chose
to utilize PEAR's `Authentication package`__.
It does this by providing different "`authentication containers`__",
for example Database, IMAP, LDAP, POP3, RADIUS, SAP and SOAP.
Please be aware of the fact that, after successful authentication, the user
and his scrambled password are stored in the SemanticScuttle database.
This is required for proper functioning of the software. It does not mean
that you will be able to login if your external authentication provider
is offline - you won't, execpt you switch it off in the SemanticScuttle
configuration.
__ http://pear.php.net/package/Auth
__ http://pear.php.net/manual/en/package.authentication.auth.intro-storage.php
Basic configuration
===================
The default configuration file ``data/config.default.php`` has an own section
on auth options and an explanation of the single entries.
To utilize the external authentication, you need to install the
PEAR Auth package: ::
$ pear install auth
If you do not have a PEAR installation available, you can try to manually
install the files in the src/ directory. If you choose to do that, the
src/ directory should look similar to that: ::
src/
Auth.php
Auth/
Anonymous.php
Container.php
Container/
..
SemanticScuttle/
header.php
..
After that, modify your ``data/config.php`` file. The most important change
is to use ::
$serviceoverrides['User'] = 'SemanticScuttle_Service_AuthUser';
which tells SemanticScuttle to switch to the special authentication service.
Now that's done, you can configure the single auth options:
``$authType = 'MDB2';``
selects the authentication container.
``$authOptions``
is an array of options specific to the authentication container. Please
consult the PEAR Auth documentation for more information.
``$authDebug = true;``
should be used when setup fails, since it may give important hints
where it fails.
Please note that login will seem to fail with
debugging activated. Going back to the main page after that will
show that you are logged in.
Authentication examples
=======================
General database authentification
---------------------------------
Here you also need the PEAR `MDB2 package`_.
The "``new_link``" option is important!
``config.php`` settings: ::
$serviceoverrides['User'] = 'SemanticScuttle_Service_AuthUser';
$authType = 'MDB2';
$authOptions = array(
'dsn' => array(
'phptype' => 'mysql',
'hostspec' => 'FIXME',
'username' => 'FIXME',
'password' => 'FIXME',
'database' => 'FIXME',
'new_link' => true,
),
'table' => 'usersFIXME',
'usernamecol' => 'usernameFIXME',
'passwordcol' => 'passwordFIXME',
'cryptType' => 'md5',
);
Mantis Bugtracker
-----------------
Here you also need the PEAR `MDB2 package`_.
``config.php`` settings: ::
$serviceoverrides['User'] = 'SemanticScuttle_Service_AuthUser';
$authType = 'MDB2';
$authOptions = array(
'dsn' => array(
'phptype' => 'mysql',
'hostspec' => 'FIXME',
'username' => 'FIXME',
'password' => 'FIXME',
'database' => 'FIXME',
'new_link' => true,
),
'table' => 'mantis_user_table',
'usernamecol' => 'username',
'passwordcol' => 'password',
'cryptType' => 'md5',
);
.. _MDB2 package: http://pear.php.net/package/MDB2
MediaWiki
---------
Unfortunately, the password column does not contain a simple hashed
password - for good reasons as described on
http://www.mediawiki.org/wiki/Manual_talk:User_table#user_password_column
If you configure your MediaWiki_ to use passwords without salt, you
can make it work nevertheless:
MediaWiki ``LocalSettings.php``: ::
$wgPasswordSalt = false;
\- after that, users need to change/update their passwords to get them
unsalted in the database. You can verify if the passwords are unhashed
if you do ::
SELECT CAST( user_password AS CHAR ) FROM user
on your MediaWiki database. Passwords prefixed with "``:A:``" can be used.
Another problem is that mediawiki user names begin with an uppercase letter.
You need to modify ``www/login.php`` and remove the "``utf8_strtolower``" function
call: ::
$posteduser = trim(utf8_strtolower(POST_USERNAME));
becomes ::
$posteduser = trim(POST_USERNAME);
``config.php`` settings: ::
$serviceoverrides['User'] = 'SemanticScuttle_Service_AuthUser';
$authType = 'MDB2';
$authOptions = array(
'dsn' => array(
'phptype' => 'mysql',
'hostspec' => 'FIXME',
'username' => 'FIXME',
'password' => 'FIXME',
'database' => 'FIXME',
'new_link' => true,
),
'table' => 'user',
'usernamecol' => 'user_name',
'passwordcol' => 'user_password',
'cryptType' => 'md5_mediawiki',
);
function md5_mediawiki($password) {
return ':A:' . md5($password);
}
.. _MediaWiki: http://www.mediawiki.org/wiki/MediaWiki
Active Directory / LDAP
-----------------------
Here we authenticate against an active directory server.
``config.php`` settings: ::
$serviceoverrides['User'] = 'SemanticScuttle_Service_AuthUser';
$authType = 'LDAP';
$authOptions = array(
'host' => '192.168.1.4',
'version' => 3,
'basedn' => 'DC=EXAMPLE,DC=ORG',
'binddn' => 'readuser',
'bindpw' => 'readuser',
'userattr' => 'sAMAccountName',
'userfilter' => '(objectClass=user)',
'attributes' => array(''),
);
$authEmailSuffix = '@example.org';

View file

@ -1,197 +0,0 @@
External authentication with SemanticScuttle
============================================
Most times, one piece of software is only a part in the big puzzle
that makes the software landscape of a company or organization.
SemanticScuttle is not different and should integrate as nicely as
possible with all other systems.
One of the basic tasks of integration is user authentication against
a central database - be it a central user database, an LDAP or a
active directory server.
Since version 0.96, SemanticScuttle supports user authentication against
external systems. To provide a wide range of supported systems, we chose
to utilize PEAR's Authentication package [1].
It does this by providing different "authentication containers" [2],
for example Database, IMAP, LDAP, POP3, RADIUS, SAP and SOAP.
Please be aware of the fact that, after successful authentication, the user
and his scrambled password are stored in the SemanticScuttle database.
This is required for proper functioning of the software. It does not mean
that you will be able to login if your external authentication provider
is offline - you won't, execpt you switch it off in the SemanticScuttle
configuration.
[1] http://pear.php.net/package/Auth
[2] http://pear.php.net/manual/en/package.authentication.auth.intro-storage.php
Basic configuration
===================
The default configuration file data/config.default.php has an own section
on auth options and an explanation of the single entries.
To utilize the external authentication, you need to install the
PEAR Auth package:
$ pear install auth
If you do not have a PEAR installation available, you can try to manually
install the files in the src/ directory. If you choose to do that, the
src/ directory should look similar to that:
src/
Auth.php
Auth/
Anonymous.php
Container.php
Container/
..
SemanticScuttle/
header.php
..
After that, modify your data/config.php file. The most important change
is to use
$serviceoverrides['User'] = 'SemanticScuttle_Service_AuthUser';
which tells SemanticScuttle to switch to the special authentication service.
Now that's done, you can configure the single auth options:
$authType = 'MDB2';
selects the authentication container.
$authOptions
is an array of options specific to the authentication container. Please
consult the PEAR Auth documentation for more information.
$authDebug = true;
should be used when setup fails, since it may give important hints
where it fails. Please note that login will seem to fail with
debugging activated. Going back to the main page after that will
show that you are logged in.
Authentication examples
=======================
General database authentification
---------------------------------
Here you also need the PEAR MDB2 package.
The "new_link" option is important!
config.php settings:
-8<------------------
$serviceoverrides['User'] = 'SemanticScuttle_Service_AuthUser';
$authType = 'MDB2';
$authOptions = array(
'dsn' => array(
'phptype' => 'mysql',
'hostspec' => 'FIXME',
'username' => 'FIXME',
'password' => 'FIXME',
'database' => 'FIXME',
'new_link' => true,
),
'table' => 'usersFIXME',
'usernamecol' => 'usernameFIXME',
'passwordcol' => 'passwordFIXME',
'cryptType' => 'md5',
);
-8<------------------
Mantis Bugtracker
-----------------
Here you also need the PEAR MDB2 package.
config.php settings:
-8<------------------
$serviceoverrides['User'] = 'SemanticScuttle_Service_AuthUser';
$authType = 'MDB2';
$authOptions = array(
'dsn' => array(
'phptype' => 'mysql',
'hostspec' => 'FIXME',
'username' => 'FIXME',
'password' => 'FIXME',
'database' => 'FIXME',
'new_link' => true,
),
'table' => 'mantis_user_table',
'usernamecol' => 'username',
'passwordcol' => 'password',
'cryptType' => 'md5',
);
-8<------------------
MediaWiki
---------
Unfortunately, the password column does not contain a simple hashed
password - for good reasons as described on
http://www.mediawiki.org/wiki/Manual_talk:User_table#user_password_column
If you configure your mediawiki to use passwords without salt, you
can make it work nevertheless:
MediaWiki LocalSettings.php:
$wgPasswordSalt = false;
- after that, users need to change/update their passwords to get them
unsalted in the database. You can verify if the passwords are unhashed
if you do
SELECT CAST( user_password AS CHAR ) FROM user
on your MediaWiki database. Passwords prefixed with ":A:" can be used.
Another problem is that mediawiki user names begin with an uppercase letter.
You need to modify www/login.php and remove the "utf8_strtolower" function
call:
$posteduser = trim(utf8_strtolower(POST_USERNAME));
becomes
$posteduser = trim(POST_USERNAME);
config.php settings:
-8<------------------
$serviceoverrides['User'] = 'SemanticScuttle_Service_AuthUser';
$authType = 'MDB2';
$authOptions = array(
'dsn' => array(
'phptype' => 'mysql',
'hostspec' => 'FIXME',
'username' => 'FIXME',
'password' => 'FIXME',
'database' => 'FIXME',
'new_link' => true,
),
'table' => 'user',
'usernamecol' => 'user_name',
'passwordcol' => 'user_password',
'cryptType' => 'md5_mediawiki',
);
function md5_mediawiki($password) {
return ':A:' . md5($password);
}
-8<------------------
Active Directory / LDAP
-----------------------
Here we authenticate against an active directory server.
config.php settings:
-8<------------------
$serviceoverrides['User'] = 'SemanticScuttle_Service_AuthUser';
$authType = 'LDAP';
$authOptions = array(
'host' => '192.168.1.4',
'version' => 3,
'basedn' => 'DC=EXAMPLE,DC=ORG',
'binddn' => 'readuser',
'bindpw' => 'readuser',
'userattr' => 'sAMAccountName',
'userfilter' => '(objectClass=user)',
'attributes' => array(''),
);
$authEmailSuffix = '@example.org';
-8<------------------

View file

@ -1,20 +0,0 @@
How to debug SemanticScuttle
============================
Database queries
----------------
In config.php, enable debugMode.
Further, add the following there:
-------
register_shutdown_function(
create_function('', <<<FNC
\$GLOBALS['db'] = SemanticScuttle_Service_Factory::getDb();
\$GLOBALS['db']->sql_report('display');
FNC
)
);
------
To see database queries in SemanticScuttle, add
> ?explain=1
to your URL.

View file

@ -0,0 +1,24 @@
How to debug SemanticScuttle
============================
Database queries
----------------
In ``data/config.php``, enable ``debugMode``.
Further, add the following afterwards: ::
register_shutdown_function(
create_function('', <<<FNC
\$GLOBALS['db'] = SemanticScuttle_Service_Factory::getDb();
\$GLOBALS['db']->sql_report('display');
FNC
)
);
To see database queries in SemanticScuttle, add ::
?explain=1
to your URL.

View file

@ -1,21 +0,0 @@
Running unit tests
==================
Go to the SemanticScuttle main directory and run
$ php tests/AllTests.php
or
$ phpunit tests/AllTests.php
also remember the --verbose parameter to PHPUnit.
If you want to run a specific test class only:
$ phpunit tests/BookmarksTest.php
If you need to test one method only:
$ phpunit --filter BookmarkTest::testUnificationOfBookmarks tests/BookmarkTest.php
Caveats
-------
Having debugging enabled and database driver "mysql4" activated
will lead to failing tests because of FOUND_ROWS() usage, which
does not work nicely with database debugging.

View file

@ -0,0 +1,26 @@
Running unit tests
==================
Go to the SemanticScuttle ``tests`` directory and run ``phpunit``::
$ cd tests
$ phpunit .
also remember the ``--verbose`` parameter to PHPUnit.
If you want to run a specific test class only: ::
$ cd tests
$ phpunit BookmarksTest.php
If you need to test one method only: ::
$ cd tests
$ phpunit --filter BookmarkTest::testUnificationOfBookmarks tests/BookmarkTest.php
Caveats
-------
Having debugging enabled and database driver "``mysql4``" activated
will lead to failing tests because of ``FOUND_ROWS()`` usage, which
does not work nicely with database debugging.

View file

@ -1,40 +0,0 @@
Translating SemanticScuttle
===========================
SemanticScuttle uses gnu gettext for translation. It does not
rely on the php extension but ships with a pure php implementation,
php-gettext[1].
Using gettext from within the code is really easy:
Enclose the string you want to translate in a "T_" function call.
For example, to translate
> echo "Vote for";
just write
> echo T_("Vote for");
Translation basics
------------------
We keep one base translation file, data/locales/messages.po.
This file is auto-generated via xgettext from all our php source files.
In case you added a new string to the code that needs translation,
update the base translation file by running
> php scripts/update-translation-base.php
After that has been done, the changes to the base messages.po file
need to be merged into the single language translation files,
for example data/locales/de_DE/LC_MESSAGES/messages.po.
Updating them from the master file is as easy as running
> php scripts/update-translation.php de_DE
When the translation is ready, the .po file needs to be compiled
in a machine-readable .mo file. Use
> php scripts/compile-translation.php de_DE
to achieve that.
[1] https://launchpad.net/php-gettext/

View file

@ -0,0 +1,47 @@
===========================
Translating SemanticScuttle
===========================
SemanticScuttle uses gnu gettext for translation. It does not
rely on the php extension but ships with a pure php implementation,
php-gettext_.
Using gettext from within the code is really easy:
Enclose the string you want to translate in a "``T_``" function call.
For example, to translate::
echo "Vote for";
just write ::
echo T_("Vote for");
.. _php-gettext: https://launchpad.net/php-gettext/
Translation basics
==================
We keep one base translation file, ``data/locales/messages.po``.
This file is auto-generated via ``xgettext`` from all our php source files.
In case you added a new string to the code that needs translation,
update the base translation file by running ::
$ php scripts/update-translation-base.php
After that has been done, the changes to the base ``messages.po`` file
need to be merged into the single language translation files,
for example ``data/locales/de_DE/LC_MESSAGES/messages.po``.
Updating them from the master file is as easy as running::
$ php scripts/update-translation.php de_DE
When the translation is ready, the ``.po`` file needs to be compiled
in a machine-readable ``.mo`` file. Use ::
$ php scripts/compile-translation.php de_DE
to achieve that.

45
doc/index.rst Normal file
View file

@ -0,0 +1,45 @@
=============================
SemanticScuttle documentation
=============================
First reads
===========
- README_
- `installation guide`_
- `upgrade instructions`_
.. _README: README.html
.. _installation guide: INSTALL.html
.. _upgrade instructions: UPGRADE.html
Features
========
- `Custom user authentication`__
- `SSL Client certificates`__
- Themes__
__ authentication.html
__ ssl-client-certificates.html
__ themes.html
Developer documentation
=======================
- `General development rules`__
- `Delicious API`__
- `Debugging HowTo`__
- `How to release a new version`__
- `Running unit testes`__
- `How to translate SemanticScuttle`__
__ developers/rules.html
__ developers/api.html
__ developers/debugging.html
__ developers/release-new-version.html
__ developers/running-unit-tests.html
__ developers/translation.html

48
doc/themes.rst Normal file
View file

@ -0,0 +1,48 @@
======================
SemanticScuttle Themes
======================
SemanticScuttle may be changed visually by supplying custom "themes" (skins)
that modify the visual appearance.
Changing the current theme
==========================
In ``data/config.php``, set your theme like this: ::
$theme = 'darkmood';
The available themes are the folders in ``www/themes/``.
By default, SemanticScuttle ships only one usable theme ("default") and one
to demonstrate how to create your own theme ("testdummy").
Creating your own theme
=======================
Have a look at the "testdummy" theme in ``www/themes/testdummy/``.
CSS and image files
-------------------
Since both file types need to be accessible via the web server directly,
they are located in the ``www/`` folder: ::
www/themes/$themename/
The main CSS file that automatically gets included is ::
www/themes/$themename/scuttle.css
Several template files in SemanticScuttle include image files. If they do not
exist in your theme, the default ones are used automatically.
Note that this is not true for images that are specified in the CSS files.
Template files
--------------
The templates of the default file are located in ::
data/templates/default/
You may put your theme template files into ::
data/templates/$themename/

View file

@ -76,6 +76,9 @@ class SemanticScuttle_Model_Template
* Sets variables and includes the template file, * Sets variables and includes the template file,
* causing it to be rendered. * causing it to be rendered.
* *
* Does not take care of themes and so.
* The include path must be set so the correct theme is used.
*
* @return void * @return void
*/ */
public function parse() public function parse()

View file

@ -0,0 +1,97 @@
<?php
/**
* SemanticScuttle - your social bookmark manager.
*
* PHP version 5.
*
* @category Bookmarking
* @package SemanticScuttle
* @author Christian Weiske <cweiske@cweiske.de>
* @license AGPL v3 or later http://www.gnu.org/licenses/agpl.html
* @link http://sourceforge.net/projects/semanticscuttle
*/
/**
* A theme, the visual representation of SemanticScuttle.
*
* @category Bookmarking
* @package SemanticScuttle
* @author Christian Weiske <cweiske@cweiske.de>
* @license AGPL v3 or later http://www.gnu.org/licenses/agpl.html
* @link http://sourceforge.net/projects/semanticscuttle
*/
class SemanticScuttle_Model_Theme
{
/**
* Theme name. Also the path part of template and resource files
*
* @var string
*/
protected $name = null;
/**
* Local path to the www themes directory.
* Needs to have a trailing slash.
*
* @var string
*/
protected $wwwThemeDir = null;
/**
* Create a new theme instance.
*
* @param string $name Theme name "data/templates/(*)/"
*/
public function __construct($name = 'default')
{
$this->name = $name;
$this->wwwThemeDir = $GLOBALS['wwwdir'] . '/themes/';
//TODO: implement theme hierarchies with parent fallback
}
/**
* Returns the URL path to a resource file (www/themes/$name/$file).
* Automatically falls back to the parent theme if the file does not exist
* in the theme.
*
* Must always be used when adding i.e. images to the output.
*
* @param string $file File name to find the path for, i.e. "scuttle.css".
*
* @return string Full path
*/
public function resource($file)
{
$themeFile = $this->wwwThemeDir . $this->name . '/' . $file;
if (file_exists($themeFile)) {
return ROOT . 'themes/' . $this->name . '/' . $file;
}
$defaultFile = $this->wwwThemeDir . 'default/' . $file;
if (file_exists($defaultFile)) {
return ROOT . 'themes/default/' . $file;
}
//file does not exist. fall back to the theme file
// to guide the theme author a bit.
// TODO: logging. in admin mode, there should be a message
return ROOT . 'themes/' . $this->name . '/' . $file;
}
/**
* Returns the theme name.
*
* @return string Theme name
*/
public function getName()
{
return $this->name;
}
}
?>

View file

@ -14,6 +14,7 @@
*/ */
require_once 'SemanticScuttle/Model/Template.php'; require_once 'SemanticScuttle/Model/Template.php';
require_once 'SemanticScuttle/Model/Theme.php';
/** /**
* SemanticScuttle template service. * SemanticScuttle template service.
@ -38,6 +39,14 @@ class SemanticScuttle_Service_Template extends SemanticScuttle_Service
*/ */
protected $basedir; protected $basedir;
/**
* The template theme to use.
* Set in constructor based on $GLOBALS['theme']
*
* @var SemanticScuttle_Model_Theme
*/
protected $theme;
/** /**
@ -64,6 +73,8 @@ class SemanticScuttle_Service_Template extends SemanticScuttle_Service
protected function __construct() protected function __construct()
{ {
$this->basedir = $GLOBALS['TEMPLATES_DIR']; $this->basedir = $GLOBALS['TEMPLATES_DIR'];
$this->theme = new SemanticScuttle_Model_Theme($GLOBALS['theme']);
//FIXME: verify the theme exists
} }
@ -74,19 +85,33 @@ class SemanticScuttle_Service_Template extends SemanticScuttle_Service
* @param string $template Template filename relative * @param string $template Template filename relative
* to template dir * to template dir
* @param array $vars Array of template variables. * @param array $vars Array of template variables.
* The current theme object will be added
* automatically with name "theme".
* *
* @return SemanticScuttle_Model_Template Template object * @return SemanticScuttle_Model_Template Template object
*/ */
function loadTemplate($template, $vars = null) public function loadTemplate($template, $vars = null)
{ {
if (substr($template, -4) != '.php') { if (substr($template, -4) != '.php') {
$template .= '.php'; $template .= '.php';
} }
$oldIncPath = get_include_path();
set_include_path(
$this->basedir . $this->theme->getName()
. PATH_SEPARATOR . $this->basedir . 'default'
//needed since services are instantiated in templates
. PATH_SEPARATOR . $oldIncPath
);
$vars['theme'] = $this->theme;
$tpl = new SemanticScuttle_Model_Template( $tpl = new SemanticScuttle_Model_Template(
$this->basedir .'/'. $template, $vars, $this $template, $vars, $this
); );
$tpl->parse(); $tpl->parse();
set_include_path($oldIncPath);
return $tpl; return $tpl;
} }
} }

View file

@ -18,9 +18,12 @@
if ('@data_dir@' == '@' . 'data_dir@') { if ('@data_dir@' == '@' . 'data_dir@') {
//non pear-install //non pear-install
$datadir = dirname(__FILE__) . '/../../data/'; $datadir = dirname(__FILE__) . '/../../data/';
$wwwdir = dirname(__FILE__) . '/../../www/';
} else { } else {
//pear installation; files are in include path //pear installation; files are in include path
$datadir = '@data_dir@/SemanticScuttle/'; $datadir = '@data_dir@/SemanticScuttle/';
//FIXME: when you have multiple installations, the www_dir will be wrong
$wwwdir = '@www_dir@/SemanticScuttle/';
} }
if (!file_exists($datadir . '/config.php')) { if (!file_exists($datadir . '/config.php')) {

View file

@ -38,9 +38,12 @@ function getTitle($url) {
preg_match_all('/<title>(.*)<\/title>/si', $html, $matches); preg_match_all('/<title>(.*)<\/title>/si', $html, $matches);
$title = $matches[1][0]; $title = $matches[1][0];
$encoding = 'utf-8';
// Get encoding from charset attribute // Get encoding from charset attribute
preg_match_all('/<meta.*charset=([^;"]*)">/i', $html, $matches); preg_match_all('/<meta.*charset=([^;"]*)">/i', $html, $matches);
if (isset($matches[1][0])) {
$encoding = strtoupper($matches[1][0]); $encoding = strtoupper($matches[1][0]);
}
// Convert to UTF-8 from the original encoding // Convert to UTF-8 from the original encoding
if (function_exists("mb_convert_encoding")) { if (function_exists("mb_convert_encoding")) {

View file

@ -3,6 +3,7 @@ $GLOBALS['saveInLastUrl'] = false;
$httpContentType = 'text/javascript'; $httpContentType = 'text/javascript';
require_once 'www-header.php'; require_once 'www-header.php';
require_once 'SemanticScuttle/functions.php'; require_once 'SemanticScuttle/functions.php';
$theme = new SemanticScuttle_Model_Theme($GLOBALS['theme']);
$player_root = ROOT .'includes/player/'; $player_root = ROOT .'includes/player/';
?> ?>
@ -62,7 +63,7 @@ function isAvailable(input, response){
username = username.trim(); username = username.trim();
var availability = document.getElementById("availability"); var availability = document.getElementById("availability");
if (username != '') { if (username != '') {
usernameField.style.backgroundImage = 'url(<?php echo ROOT; ?>images/loading.gif)'; usernameField.style.backgroundImage = 'url(<?php echo $theme->resource('images/loading.gif'); ?>)';
if (response != '') { if (response != '') {
usernameField.style.backgroundImage = 'none'; usernameField.style.backgroundImage = 'none';
if (response == 'true') { if (response == 'true') {
@ -110,7 +111,7 @@ function getNewPrivateKey(input, response){
function getTitle(input, response){ function getTitle(input, response){
var title = document.getElementById('titleField'); var title = document.getElementById('titleField');
if (title.value == '') { if (title.value == '') {
title.style.backgroundImage = 'url(<?php echo ROOT; ?>images/loading.gif)'; title.style.backgroundImage = 'url(<?php echo $theme->resource('images/loading.gif');?>)';
if (response != null) { if (response != null) {
title.style.backgroundImage = 'none'; title.style.backgroundImage = 'none';
title.value = response; title.value = response;

View file

Before

Width:  |  Height:  |  Size: 771 B

After

Width:  |  Height:  |  Size: 771 B

View file

Before

Width:  |  Height:  |  Size: 451 B

After

Width:  |  Height:  |  Size: 451 B

View file

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View file

Before

Width:  |  Height:  |  Size: 873 B

After

Width:  |  Height:  |  Size: 873 B

View file

Before

Width:  |  Height:  |  Size: 684 B

After

Width:  |  Height:  |  Size: 684 B

View file

Before

Width:  |  Height:  |  Size: 726 B

After

Width:  |  Height:  |  Size: 726 B

View file

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

View file

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

View file

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

View file

Before

Width:  |  Height:  |  Size: 401 B

After

Width:  |  Height:  |  Size: 401 B

View file

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

View file

Before

Width:  |  Height:  |  Size: 419 B

After

Width:  |  Height:  |  Size: 419 B

View file

Before

Width:  |  Height:  |  Size: 495 B

After

Width:  |  Height:  |  Size: 495 B

View file

Before

Width:  |  Height:  |  Size: 415 B

After

Width:  |  Height:  |  Size: 415 B

View file

Before

Width:  |  Height:  |  Size: 625 B

After

Width:  |  Height:  |  Size: 625 B

Some files were not shown because too many files have changed in this diff Show more